react-plaid-link
Advanced tools
Comparing version 0.1.0 to 0.1.2
'use strict'; | ||
var _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; | ||
var React = require('react'); | ||
@@ -7,2 +9,4 @@ var ReactScriptLoaderMixin = require('react-script-loader').ReactScriptLoaderMixin; | ||
var PlaidLink = React.createClass({ | ||
displayName: 'PlaidLink', | ||
mixins: [ReactScriptLoaderMixin], | ||
@@ -29,12 +33,16 @@ getDefaultProps: function getDefaultProps() { | ||
// The Plaid API environment on which to create user accounts. | ||
// For development and testing, use tartan. For production use, use production | ||
// For development and testing, use tartan. For production, use production | ||
env: React.PropTypes.oneOf(['tartan', 'production']).isRequired, | ||
// The public_key associated with your account; available form the dashboard | ||
publicKey: React.PropTypes.string.isRequired, | ||
// Open link to a specific institution, for a more custom solution | ||
institution: React.PropTypes.String, | ||
// Set to true to launch Link with longtail institution support enabled. | ||
// Longtail institutions are only available with Connect (product is connect). | ||
// Longtail institutions are only available with the Connect product. | ||
longtail: React.PropTypes.bool, | ||
// The public_key associated with your account; available from | ||
// the Plaid dashboard (https://dashboard.plaid.com) | ||
publicKey: React.PropTypes.string.isRequired, | ||
// The Plaid product you wish to use, either auth or connect. | ||
@@ -49,3 +57,3 @@ product: React.PropTypes.oneOf(['auth', 'connect']).isRequired, | ||
// Set to true to launch Link with the 'Select Account' pane enabled. | ||
// This allows users to select an individual account once they've authenticated | ||
// Allows users to select an individual account once they've authenticated | ||
selectAccount: React.PropTypes.bool, | ||
@@ -61,3 +69,3 @@ | ||
// A function that is called when a user has specifically exited the Link flow | ||
// A function that is called when a user has specifically exited Link flow | ||
onExit: React.PropTypes.func, | ||
@@ -102,3 +110,3 @@ | ||
onSuccess: this.props.onSuccess, | ||
onLoad: this.handleOnLoad, | ||
onLoad: this.handleLinkOnLoad, | ||
onExit: this.props.onExit | ||
@@ -109,3 +117,3 @@ }); | ||
}, | ||
handleOnLoad: function handleOnLoad() { | ||
handleLinkOnLoad: function handleLinkOnLoad() { | ||
this.props.onLoad && this.props.onLoad(); | ||
@@ -115,5 +123,8 @@ this.setState({ linkLoaded: true }); | ||
handleOnClick: function handleOnClick() { | ||
var institution = this.props.institution || null; | ||
if (this.state.linkLoaded) { | ||
this.linkHandler.open(this.props.institution); | ||
} else {} | ||
this.linkHandler.open(institution); | ||
} else { | ||
// consider a better way to wait for link to load... | ||
} | ||
}, | ||
@@ -123,6 +134,5 @@ render: function render() { | ||
'button', | ||
{ onClick: this.handleOnClick, | ||
disabled: this.state.disabledButton, | ||
style: this.props.buttonStyles, | ||
className: this.props.buttonClassName }, | ||
_extends({ onClick: this.handleOnClick, | ||
disabled: this.state.disabledButton | ||
}, this.props), | ||
React.createElement( | ||
@@ -129,0 +139,0 @@ 'span', |
{ | ||
"name": "react-plaid-link", | ||
"version": "0.1.0", | ||
"version": "0.1.2", | ||
"description": "A React component for Plaid Link", | ||
@@ -11,5 +11,2 @@ "files": [ | ||
"main": "src/PlaidLink.js", | ||
"scripts": { | ||
"version": "npm run build && git add -A dist" | ||
}, | ||
"repository": { | ||
@@ -33,4 +30,4 @@ "type": "git", | ||
"peerDependencies": { | ||
"react": "0.14.0", | ||
"react-dom": "0.14.0" | ||
"react": "^0.14.0 || ^15.0.0-0", | ||
"react-dom": "^0.14.0 || ^15.0.0-0" | ||
}, | ||
@@ -40,12 +37,12 @@ "devDependencies": { | ||
"babel-core": "6.5.x", | ||
"babel-eslint": "4.1.x", | ||
"babel-loader": "6.2.x", | ||
"babel-preset-es2015": "6.5.x", | ||
"babel-preset-react": "6.5.x", | ||
"babel-preset-stage-0": "6.5.x", | ||
"babel-register": "6.5.x", | ||
"babel-eslint": "4.1.x", | ||
"babel-loader": "6.2.x", | ||
"babel-preset-stage-0": "6.5.x", | ||
"enzyme": "1.5.x", | ||
"mocha": "2.3.x", | ||
"eslint": "2.2.x", | ||
"eslint-plugin-react": "4.0.x", | ||
"mocha": "2.3.x", | ||
"react": "0.14.3", | ||
@@ -56,4 +53,5 @@ "react-dom": "0.14.3", | ||
"webpack": "1.12.x", | ||
"webpack-dev-server": "1.12.x" | ||
"webpack-dev-server": "1.12.x", | ||
"xyz": "0.5.x" | ||
} | ||
} |
# react-plaid-link | ||
**This is still a WIP – stay tuned for updates, and please feel free to open a PR as you see fit** | ||
A simple [React](https://facebook.github.io/react/) component for easy | ||
@@ -4,0 +6,0 @@ integration with the [Plaid Link drop-in module](https://plaid.com/docs/link/) |
12720
232
69
19