Skip to content
This repository was archived by the owner on Feb 18, 2022. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,5 @@ xcuserdata

## requirejs ##
/examples/requirejs/public/vendor/*

*.log
12 changes: 6 additions & 6 deletions react-native/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
Currently only iOS is supported.

:warning: Note that this is the React Native bridge for Link officially supported by Plaid, but is very different
from the module with the same name available on [npmjs](https://www.npmjs.com/package/react-native-plaid-link);
from the module with a similar name available on [npmjs](https://www.npmjs.com/package/react-native-plaid-link);
we strongly recommend favoring this React Native bridge.

## Prerequisites
Expand All @@ -17,16 +17,16 @@ To complete the steps in this example the following software is needed:
## Using React Native for Plaid Link

* Clone the [Plaid Link](https://github.com/plaid/link) repository
* Add this `react-native-plaid-link` component to your react-native project and install the necessary dependencies:
* Add this `react-native-plaid-linkkit` component to your react-native project and install the necessary dependencies:
```sh
% cd $PATH_TO_YOUR_REACT_NATIVE_PROJECT
% yarn add file:$PATH_TO_YOUR_CLONE_OF_THIS_REPO/react-native/linkkit
% yarn install
% react-native link react-native-plaid-link
% react-native link react-native-plaid-linkkit
```
* Integrate the native Plaid Link for iOS SDK (LinkKit.framework) into the iOS part of your react-native project, see the [documentation](https://plaid.com/docs/link/ios/) for details.
* In your `App.js` import Plaid Link using:
`import PlaidLink from 'react-native-plaid-link';`
`import PlaidLink from 'react-native-plaid-linkkit';`
* Create a `linkHandler` object (we recommend doing so in `componentDidMount()`) and replace any of the placeholder `<#VARIABLE#>`s in the example below according to your setup (for details see the [Plaid Link documentation](https://plaid.com/docs/quickstart/#client-side-link-configuration)):
```js
this.linkHandler = PlaidLink.create({
Expand All @@ -45,10 +45,10 @@ To complete the steps in this example the following software is needed:

## About the linkdemo_reactnative Xcode project

ℹ️ In order build and run the `linkdemo_reactnative` iOS demo application the `react-native-plaid-link` component must be registered and linked to the Xcode project as mentioned above, e.g.:
ℹ️ In order build and run the `linkdemo_reactnative` iOS demo application the `react-native-plaid-linkkit` component must be registered and linked to the Xcode project as mentioned above, e.g.:
```sh
% cd link/react-native/demo
% yarn add file:../linkkit
% yarn install
% react-native link react-native-plaid-link
% react-native link react-native-plaid-linkkit
```
2 changes: 1 addition & 1 deletion react-native/demo/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import {
TouchableOpacity,
View
} from 'react-native';
import PlaidLink from 'react-native-plaid-link';
import PlaidLink from 'react-native-plaid-linkkit';

const title = Platform.select({
ios: 'Plaid Link\nSDK Example',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1093,7 +1093,7 @@
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-plaid-link/ios/**",
"$(SRCROOT)/../node_modules/react-native-plaid-linkkit/ios/**",
);
INFOPLIST_FILE = linkdemo_reactnativeTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
Expand All @@ -1119,7 +1119,7 @@
DEVELOPMENT_TEAM = Z2P2MSMY87;
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-plaid-link/ios/**",
"$(SRCROOT)/../node_modules/react-native-plaid-linkkit/ios/**",
);
INFOPLIST_FILE = linkdemo_reactnativeTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 9.0;
Expand Down Expand Up @@ -1150,7 +1150,7 @@
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-plaid-link/ios/**",
"$(SRCROOT)/../node_modules/react-native-plaid-linkkit/ios/**",
);
INFOPLIST_FILE = linkdemo_reactnative/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand Down Expand Up @@ -1178,7 +1178,7 @@
);
HEADER_SEARCH_PATHS = (
"$(inherited)",
"$(SRCROOT)/../node_modules/react-native-plaid-link/ios/**",
"$(SRCROOT)/../node_modules/react-native-plaid-linkkit/ios/**",
);
INFOPLIST_FILE = linkdemo_reactnative/Info.plist;
LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks";
Expand Down
2 changes: 1 addition & 1 deletion react-native/demo/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"invariant": "^2.2.4",
"react": "16.4.1",
"react-native": "0.56.0",
"react-native-plaid-link": "file:../linkkit"
"react-native-plaid-linkkit": "file:../linkkit"
},
"devDependencies": {
"babel-jest": "22.4.4",
Expand Down
2 changes: 1 addition & 1 deletion react-native/demo/yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -4416,7 +4416,7 @@ react-native-git-upgrade@^0.2.7:
shelljs "^0.7.5"
yeoman-environment "1.5.3"

"react-native-plaid-link@file:../linkkit":
"react-native-plaid-linkkit@file:../linkkit":
version "0.1.0"
dependencies:
react-native-cli "^2.0.1"
Expand Down
158 changes: 158 additions & 0 deletions react-native/linkkit/index.d.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
type EventName =
| 'OPEN'
| 'EXIT'
| 'TRANSITION_VIEW'
| 'SEARCH_INSTITUTION'
| 'SELECT_INSTITUTION'
// | 'SUBMIT_CREDENTIALS' // Happens in webview, does this happen in Plaid Link?
| 'ERROR'
| 'HANDOFF'

export interface EventMeta {
link_session_id: string
request_id?: string

status?: string
exit_status?: string

timestamp?: Date
view_name?: string

mfa_type?: string

institution?: Institution
institution_search_query?: string
institution_name?: string
institution_id?: string

account_id?: null
account?: Account
accounts?: Account[]

error_type?: string
error_code?: string
error_message?: string
}

export interface Account {
id?: string
type?: string
mask?: string
name?: string
subtype?: string
}

export interface Institution {
name: string
institution_id: string
}

export interface PlaidConfiguration {
key: string
env: 'sandbox' | 'development' | 'production'
product: string[]
clientName?: string
webhook?: string
selectAccount?: boolean

userLegalName?: string
userEmailAddress?: string
countryCodes?: string[]
language?: string
publicToken?: string
institution?: string

onSuccess: (publicToken: string, meta: EventMeta) => void
onExit: (error: any, meta: EventMeta) => void
onEvent?: (eventName: EventName, meta: EventMeta) => void
}

interface PlaidLink {
/**
* Create Plaid Link.
*
* The `configuration` object must contain one or more of:
*
* - `key` (string) - the Plaid public_key (required)
* - `env` (string) - the Plaid environment (required)
* - `product` (array of strings) - a list of Plaid products (required)
* - `clientName` (string) - the name to display on info panes (recommended)
* - `webhook` (string) - webhook to receive transaction and error updates
* - `selectAccount` (boolean) - enables the select account flow when set to true
*
* - `userLegalName` (string) - the legal name of the end-user, necessary for microdeposit support
* - `userEmailAddress` (string) - the email address of the end-user, necessary for microdeposit support
* - `countryCodes` (array of strings) - a list of ISO 3166-1 alpha-2 country codes, used to select institutions available in the given countries
* - `language` (string) - Plaid-supported language to localize Link. English ('en') will be used by default. For details consult https://plaid.com/docs/#parameter-reference.
* - `publicToken` (string) - the public_token to invoke update mode (see https://plaid.com/docs/quickstart/#use-link-to-resolve-error)
* - `institution` (string) - institution identifier for which to invoke the custom initializer flow
*
* The are deprecated configuration options for the legacy API
* - `longtailAuth` (boolean) - enable longtail auth institutions
* - `apiVersion` (string) - the Plaid API version to use
*
* - `onSuccess` (function) - takes two parameters: the created public_token and the associated metadata.
* - `onExit` (function) - takes two parameters: error and the associated metadata.
* - `onEvent` (function) - takes two parameters: the event name and the associated metadata.
*/
create: (config: PlaidConfiguration) => this

/**
* Open Plaid Link.
*
* Calling `open()` will present the Plaid Link user interface implemented by the native `PLKPlaidLinkViewController`
*/
open: () => void
version: string
}

declare const PlaidLink: PlaidLink

export default PlaidLink

/** TODO: Better mapping of eventName to metadata */
// export type PlaidEvent =
// | {
// eventName: 'EXIT'
// metadata: { link_session_id: string }
// }
// | {
// eventName: 'TRANSITION_VIEW'
// metadata: { link_session_id: string }
// }
// | {
// eventName: 'OPEN'
// metadata: { link_session_id: string }
// }
// | {
// metadata: { public_token: string; link_session_id: string }
// }
// | {
// eventName: 'SEARCH_INSTITUTION'
// metadata: { institution_search_query: string; link_session_id: string }
// }
// | {
// eventName: 'SELECT_INSTITUTION'
// metadata: {
// institution_id: string
// institution_name: string
// link_session_id: string
// }
// }
// | {
// eventName: 'SUBMIT_CREDENTIALS'
// metadata: {
// institution_id: string
// institution_name: string
// link_session_id: string
// }
// }
// | {
// eventName: 'ERROR'
// metadata: {
// error_code: string // 'INVALID_CREDENTIALS'
// error_message: string // 'the provided credentials were not correct'
// error_type: string // 'ITEM_ERROR'
// link_session_id: string
// }
// }
4 changes: 2 additions & 2 deletions react-native/linkkit/package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "react-native-plaid-link",
"name": "react-native-plaid-linkkit",
"version": "0.1.0",
"description": "A React Native bridge to the Plaid Link for iOS SDK",
"main": "index.js",
Expand All @@ -22,7 +22,7 @@
"peerDependencies": {
"react-native": "^0.41.2"
},
"dependencies": {
"devDependencies": {
"react-native-cli": "^2.0.1",
"react-native-git-upgrade": "^0.2.7"
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,23 @@

Pod::Spec.new do |s|
s.name = "RNLinkkit"
s.version = "1.0.0"
s.name = "react-native-plaid-linkkit"
s.version = "0.1.0"
s.summary = "RNLinkkit"
s.description = <<-DESC
RNLinkkit
DESC
s.homepage = ""
s.homepage = "https://github.com/alkafinance/plaid-link/tree/master/react-native"
s.license = "MIT"
# s.license = { :type => "MIT", :file => "FILE_LICENSE" }
s.author = { "author" => "[email protected]" }
s.platform = :ios, "7.0"
s.source = { :git => "https://github.com/author/RNLinkkit.git", :tag => "master" }
s.source_files = "RNLinkkit/**/*.{h,m}"
s.source_files = "ios/RNLinkkit.{h,m}"
s.requires_arc = true


s.dependency "React"
s.dependency "Plaid"
#s.dependency "others"

end
Expand Down