react-native-plaid-link-sdk 11.5.2 → 11.6.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -156,6 +156,7 @@ While these older versions are expected to continue to work without disruption,
156
156
 
157
157
  | Plaid SDK Version | Min React Native Version | Android SDK | Android Min Version | Android Compile Version| iOS SDK | iOS Min Version | Status |
158
158
  |-------------------|--------------------------|-------------|---------------------|------------------------|---------|-----------------|-------------------------------|
159
+ | 11.6.0 | * | [4.2.0+] | 21 | 33 | >=5.3.1 | 14.0 | Active, supports Xcode 15.0.1 |
159
160
  | 11.5.2 | * | [4.1.1+] | 21 | 33 | >=5.2.1 | 14.0 | Active, supports Xcode 15.0.1 |
160
161
  | 11.5.1 | * | [4.1.1+] | 21 | 33 | >=5.2.0 | 14.0 | Active, supports Xcode 15.0.1 |
161
162
  | 11.5.0 | * | [4.1.1+] | 21 | 33 | >=5.2.0 | 14.0 | Active, supports Xcode 15.0.1 |
@@ -179,8 +180,8 @@ While these older versions are expected to continue to work without disruption,
179
180
  | 10.6.3 | >= 0.66.0 | [3.14.0+] | 21 | 33 | >=4.6.4 | 11.0 | Active, supports Xcode 14 |
180
181
  | 10.6.2 | >= 0.66.0 | [3.14.0+] | 21 | 33 | >=4.6.4 | 11.0 | Deprecated, supports Xcode 14 |
181
182
  | 10.6.0 | >= 0.66.0 | [3.14.0+] | 21 | 33 | >=4.6.4 | 11.0 | Deprecated, supports Xcode 14 |
182
- | 10.5.0 | >= 0.66.0 | [3.12.2+] | 21 | 33 | >=4.5.1 | 11.0 | Deprecated, supports Xcode 14 |
183
- | 10.4.0 | >= 0.66.0 | [3.12.2+] | 21 | 33 | >=4.4.0 | 11.0 | Deprecated, supports Xcode 14 |
183
+ | 10.5.0 | >= 0.66.0 | [3.13.2+] | 21 | 33 | >=4.5.1 | 11.0 | Deprecated, supports Xcode 14 |
184
+ | 10.4.0 | >= 0.66.0 | [3.13.2+] | 21 | 33 | >=4.4.0 | 11.0 | Deprecated, supports Xcode 14 |
184
185
  | 10.3.0 | >= 0.66.0 | [3.12.1+] | 21 | 33 | >=4.3.0 | 11.0 | Deprecated, supports Xcode 14 |
185
186
  | 10.2.0 | >= 0.66.0 | [3.12.0+] | 21 | 33 | >=4.3.0 | 11.0 | Deprecated, supports Xcode 14 |
186
187
  | 10.1.0 | >= 0.66.0 | [3.11.0+] | 21 | 33 | >=4.2.0 | 11.0 | Deprecated, supports Xcode 14 |
@@ -70,7 +70,7 @@ repositories {
70
70
 
71
71
  dependencies {
72
72
  implementation "com.facebook.react:react-native:+"
73
- implementation "com.plaid.link:sdk-core:4.1.1"
73
+ implementation "com.plaid.link:sdk-core:4.2.0"
74
74
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk8:$kotlin_version"
75
75
  implementation "com.jakewharton.rxrelay2:rxrelay:2.1.1"
76
76
  }
@@ -4,7 +4,7 @@
4
4
  <application>
5
5
  <meta-data
6
6
  android:name="com.plaid.link.react_native"
7
- android:value="11.5.2" />
7
+ android:value="11.6.0" />
8
8
  </application>
9
9
 
10
10
  </manifest>
@@ -14,6 +14,7 @@ import com.facebook.react.module.annotations.ReactModule
14
14
  import com.facebook.react.modules.core.DeviceEventManagerModule
15
15
  import com.plaid.gson.PlaidJsonConverter
16
16
  import com.plaid.link.Plaid
17
+ import com.plaid.link.PlaidHandler
17
18
  import com.plaid.link.configuration.LinkLogLevel
18
19
  import com.plaid.link.configuration.LinkTokenConfiguration
19
20
  import com.plaid.link.event.LinkEvent
@@ -35,6 +36,8 @@ class PlaidModule internal constructor(reactContext: ReactApplicationContext) :
35
36
  private var onSuccessCallback: Callback? = null
36
37
  private var onExitCallback: Callback? = null
37
38
 
39
+ private var plaidHandler: PlaidHandler? = null
40
+
38
41
  companion object {
39
42
  private const val LINK_TOKEN_PREFIX = "link"
40
43
 
@@ -76,6 +79,52 @@ class PlaidModule internal constructor(reactContext: ReactApplicationContext) :
76
79
  return builder.build()
77
80
  }
78
81
 
82
+ @ReactMethod
83
+ fun create(
84
+ token: String,
85
+ noLoadingState: Boolean,
86
+ logLevel: String,
87
+ ) {
88
+ val tokenConfiguration = getLinkTokenConfiguration(token, noLoadingState, getLogLevel(logLevel))
89
+ if (tokenConfiguration == null) {
90
+ throw LinkException("Unable to open link, please check that your configuration is valid")
91
+ }
92
+
93
+ // Set the event listener here instead of in open for Layer use cases.
94
+ try {
95
+ Plaid.setLinkEventListener { linkEvent: LinkEvent ->
96
+ var json = jsonConverter.convert(linkEvent)
97
+ val eventMap = convertJsonToMap(JSONObject(json))
98
+ reactApplicationContext.getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter::class.java)
99
+ .emit("onEvent", eventMap)
100
+ }
101
+ } catch (ex: JSONException) {
102
+ Log.e("PlaidModule", ex.toString())
103
+ throw ex
104
+ }
105
+
106
+ // Create Plaid handler.
107
+ this.plaidHandler = Plaid.create(
108
+ reactApplicationContext.getApplicationContext() as Application,
109
+ tokenConfiguration
110
+ )
111
+ }
112
+
113
+ @ReactMethod
114
+ fun open(onSuccessCallback: Callback, onExitCallback: Callback) {
115
+ val activity = currentActivity ?: throw IllegalStateException("Current activity is null")
116
+
117
+ plaidHandler?.let { handler ->
118
+ // Work with nonNullValue here
119
+ this.onSuccessCallback = onSuccessCallback
120
+ this.onExitCallback = onExitCallback
121
+ handler.open(activity)
122
+ } ?: run {
123
+ // Handler is nil.
124
+ throw LinkException("Create must be called before open.")
125
+ }
126
+ }
127
+
79
128
  @ReactMethod
80
129
  @Suppress("unused")
81
130
  fun startLinkActivityForResult(
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { LinkEventListener, PlaidLinkComponentProps, PlaidLinkProps } from './Types';
2
+ import { LinkEventListener, LinkOpenProps, LinkTokenConfiguration, PlaidLinkComponentProps, PlaidLinkProps } from './Types';
3
3
  /**
4
4
  * A hook that registers a listener on the Plaid emitter for the 'onEvent' type.
5
5
  * The listener is cleaned up when this view is unmounted
@@ -7,6 +7,14 @@ import { LinkEventListener, PlaidLinkComponentProps, PlaidLinkProps } from './Ty
7
7
  * @param LinkEventListener the listener to call
8
8
  */
9
9
  export declare const usePlaidEmitter: (LinkEventListener: LinkEventListener) => void;
10
- export declare const openLink: (props: PlaidLinkProps) => Promise<void>;
10
+ export declare const create: (props: LinkTokenConfiguration) => void;
11
+ export declare const open: (props: LinkOpenProps) => Promise<void>;
11
12
  export declare const dismissLink: () => void;
13
+ /**
14
+ * @deprecated This component is deprecated. Create your own component and use the create & open methods.
15
+ */
12
16
  export declare const PlaidLink: (props: PlaidLinkComponentProps) => React.JSX.Element;
17
+ /**
18
+ * @deprecated This method is deprecated. For faster loading use the create & open methods.
19
+ */
20
+ export declare const openLink: (props: PlaidLinkProps) => Promise<void>;
package/dist/PlaidLink.js CHANGED
@@ -28,12 +28,20 @@ export const usePlaidEmitter = (LinkEventListener) => {
28
28
  };
29
29
  }, []);
30
30
  };
31
- export const openLink = (props) => __awaiter(void 0, void 0, void 0, function* () {
31
+ export const create = (props) => {
32
32
  var _a, _b;
33
- let config = props.tokenConfig;
34
- let noLoadingState = (_a = config.noLoadingState) !== null && _a !== void 0 ? _a : false;
33
+ let token = props.token;
34
+ let noLoadingState = (_a = props.noLoadingState) !== null && _a !== void 0 ? _a : false;
35
35
  if (Platform.OS === 'android') {
36
- NativeModules.PlaidAndroid.startLinkActivityForResult(config.token, noLoadingState, (_b = config.logLevel) !== null && _b !== void 0 ? _b : LinkLogLevel.ERROR, (result) => {
36
+ NativeModules.PlaidAndroid.create(token, noLoadingState, (_b = props.logLevel) !== null && _b !== void 0 ? _b : LinkLogLevel.ERROR);
37
+ }
38
+ else {
39
+ NativeModules.RNLinksdk.create(token, noLoadingState);
40
+ }
41
+ };
42
+ export const open = (props) => __awaiter(void 0, void 0, void 0, function* () {
43
+ if (Platform.OS === 'android') {
44
+ NativeModules.PlaidAndroid.open((result) => {
37
45
  if (props.onSuccess != null) {
38
46
  props.onSuccess(result);
39
47
  }
@@ -48,7 +56,6 @@ export const openLink = (props) => __awaiter(void 0, void 0, void 0, function* (
48
56
  });
49
57
  }
50
58
  else {
51
- NativeModules.RNLinksdk.create(config.token, noLoadingState);
52
59
  let presentFullScreen = props.iOSPresentationStyle == LinkIOSPresentationStyle.FULL_SCREEN;
53
60
  NativeModules.RNLinksdk.open(presentFullScreen, (result) => {
54
61
  if (props.onSuccess != null) {
@@ -73,11 +80,65 @@ export const dismissLink = () => {
73
80
  NativeModules.RNLinksdk.dismiss();
74
81
  }
75
82
  };
83
+ /**
84
+ * @deprecated This component is deprecated. Create your own component and use the create & open methods.
85
+ */
76
86
  export const PlaidLink = (props) => {
87
+ // Create a handler.
88
+ create(props.tokenConfig);
77
89
  function onPress() {
78
90
  var _a;
79
91
  (_a = props.onPress) === null || _a === void 0 ? void 0 : _a.call(props);
80
- openLink(props);
92
+ const openProps = {
93
+ onSuccess: props.onSuccess,
94
+ onExit: props.onExit,
95
+ iOSPresentationStyle: props.iOSPresentationStyle,
96
+ logLevel: props.logLevel,
97
+ };
98
+ open(openProps);
81
99
  }
82
- return <TouchableOpacity onPress={onPress}>{props.children}</TouchableOpacity>;
100
+ return (<TouchableOpacity onPress={onPress}>{props.children}</TouchableOpacity>);
83
101
  };
102
+ /**
103
+ * @deprecated This method is deprecated. For faster loading use the create & open methods.
104
+ */
105
+ export const openLink = (props) => __awaiter(void 0, void 0, void 0, function* () {
106
+ var _a, _b;
107
+ let config = props.tokenConfig;
108
+ let noLoadingState = (_a = config.noLoadingState) !== null && _a !== void 0 ? _a : false;
109
+ if (Platform.OS === 'android') {
110
+ NativeModules.PlaidAndroid.startLinkActivityForResult(config.token, noLoadingState, (_b = config.logLevel) !== null && _b !== void 0 ? _b : LinkLogLevel.ERROR, (result) => {
111
+ if (props.onSuccess != null) {
112
+ props.onSuccess(result);
113
+ }
114
+ }, (result) => {
115
+ if (props.onExit != null) {
116
+ if (result.error != null && result.error.displayMessage != null) {
117
+ //TODO(RNSDK-118): Remove errorDisplayMessage field in next major update.
118
+ result.error.errorDisplayMessage = result.error.displayMessage;
119
+ }
120
+ props.onExit(result);
121
+ }
122
+ });
123
+ }
124
+ else {
125
+ NativeModules.RNLinksdk.create(config.token, noLoadingState);
126
+ let presentFullScreen = props.iOSPresentationStyle == LinkIOSPresentationStyle.FULL_SCREEN;
127
+ NativeModules.RNLinksdk.open(presentFullScreen, (result) => {
128
+ if (props.onSuccess != null) {
129
+ props.onSuccess(result);
130
+ }
131
+ }, (error, result) => {
132
+ if (props.onExit != null) {
133
+ if (error) {
134
+ var data = result || {};
135
+ data.error = error;
136
+ props.onExit(data);
137
+ }
138
+ else {
139
+ props.onExit(result);
140
+ }
141
+ }
142
+ });
143
+ }
144
+ });
package/dist/Types.d.ts CHANGED
@@ -409,6 +409,8 @@ export declare enum LinkEventName {
409
409
  OPEN = "OPEN",
410
410
  OPEN_MY_PLAID = "OPEN_MY_PLAID",
411
411
  OPEN_OAUTH = "OPEN_OAUTH",
412
+ PROFILE_ELIGIBILITY_CHECK_READY = "PROFILE_ELIGIBILITY_CHECK_READY",
413
+ PROFILE_ELIGIBILITY_CHECK_ERROR = "PROFILE_ELIGIBILITY_CHECK_ERROR",
412
414
  SEARCH_INSTITUTION = "SEARCH_INSTITUTION",
413
415
  SELECT_DEGRADED_INSTITUTION = "SELECT_DEGRADED_INSTITUTION",
414
416
  SELECT_DOWN_INSTITUTION = "SELECT_DOWN_INSTITUTION",
@@ -482,6 +484,12 @@ export interface PlaidLinkProps {
482
484
  logLevel?: LinkLogLevel;
483
485
  onPress?(): any;
484
486
  }
487
+ export interface LinkOpenProps {
488
+ onSuccess: LinkSuccessListener;
489
+ onExit?: LinkExitListener;
490
+ iOSPresentationStyle?: LinkIOSPresentationStyle;
491
+ logLevel?: LinkLogLevel;
492
+ }
485
493
  export type PlaidLinkComponentProps = (PlaidLinkProps & {
486
494
  children: React.ReactNode;
487
495
  });
package/dist/Types.js CHANGED
@@ -361,6 +361,8 @@ export var LinkEventName;
361
361
  LinkEventName["OPEN"] = "OPEN";
362
362
  LinkEventName["OPEN_MY_PLAID"] = "OPEN_MY_PLAID";
363
363
  LinkEventName["OPEN_OAUTH"] = "OPEN_OAUTH";
364
+ LinkEventName["PROFILE_ELIGIBILITY_CHECK_READY"] = "PROFILE_ELIGIBILITY_CHECK_READY";
365
+ LinkEventName["PROFILE_ELIGIBILITY_CHECK_ERROR"] = "PROFILE_ELIGIBILITY_CHECK_ERROR";
364
366
  LinkEventName["SEARCH_INSTITUTION"] = "SEARCH_INSTITUTION";
365
367
  LinkEventName["SELECT_DEGRADED_INSTITUTION"] = "SELECT_DEGRADED_INSTITUTION";
366
368
  LinkEventName["SELECT_DOWN_INSTITUTION"] = "SELECT_DOWN_INSTITUTION";
package/ios/RNLinksdk.m CHANGED
@@ -27,7 +27,7 @@ static NSString* const kRNLinkKitVersionConstant = @"version";
27
27
  RCT_EXPORT_MODULE();
28
28
 
29
29
  + (NSString*)sdkVersion {
30
- return @"11.5.2"; // SDK_VERSION
30
+ return @"11.6.0"; // SDK_VERSION
31
31
  }
32
32
 
33
33
  + (NSString*)objCBridgeVersion {
@@ -415,6 +415,10 @@ RCT_EXPORT_METHOD(dismiss) {
415
415
  return @"OPEN_MY_PLAID";
416
416
  case PLKEventNameValueOpenOAuth:
417
417
  return @"OPEN_OAUTH";
418
+ case PLKEventNameValueProfileEligibilityCheckReady:
419
+ return @"PROFILE_ELIGIBILITY_CHECK_READY";
420
+ case PLKEventNameValueProfileEligibilityCheckError:
421
+ return @"PROFILE_ELIGIBILITY_CHECK_ERROR";
418
422
  case PLKEventNameValueSearchInstitution:
419
423
  return @"SEARCH_INSTITUTION";
420
424
  case PLKEventNameValueSelectDegradedInstitution:
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-plaid-link-sdk",
3
- "version": "11.5.2",
3
+ "version": "11.6.0",
4
4
  "description": "React Native Plaid Link SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -16,5 +16,5 @@ Pod::Spec.new do |s|
16
16
  s.source_files = "ios/*.{h,m,swift}"
17
17
 
18
18
  s.dependency 'React-Core'
19
- s.dependency 'Plaid', '~> 5.2.1'
19
+ s.dependency 'Plaid', '~> 5.3.1'
20
20
  end