react-native-plaid-link-sdk 13.0.3 → 13.0.5

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.
Files changed (42) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/README.md +27 -0
  3. package/android/src/main/AndroidManifest.xml +1 -1
  4. package/android/src/main/java/expo/modules/plaidlinksdk/RNPlaidLinkSdkVersion.kt +1 -1
  5. package/android/src/main/java/expo/modules/plaidlinksdk/ReactNativePlaidLinkSdkModule.kt +21 -0
  6. package/build/ReactNativePlaidLinkSdk.types.d.ts +11 -0
  7. package/build/ReactNativePlaidLinkSdk.types.d.ts.map +1 -1
  8. package/build/ReactNativePlaidLinkSdk.types.js.map +1 -1
  9. package/build/ReactNativePlaidLinkSdkModule.d.ts +1 -0
  10. package/build/ReactNativePlaidLinkSdkModule.d.ts.map +1 -1
  11. package/build/ReactNativePlaidLinkSdkModule.js.map +1 -1
  12. package/build/index.d.ts +6 -1
  13. package/build/index.d.ts.map +1 -1
  14. package/build/index.js +60 -5
  15. package/build/index.js.map +1 -1
  16. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Info.plist +0 -0
  17. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/LinkKit +0 -0
  18. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios.abi.json +266 -31
  19. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios.private.swiftinterface +10 -8
  20. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  21. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios.swiftinterface +10 -8
  22. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios.swiftmodule +0 -0
  23. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/_CodeSignature/CodeResources +11 -15
  24. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Info.plist +0 -0
  25. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/LinkKit +0 -0
  26. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.abi.json +266 -31
  27. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +10 -8
  28. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  29. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +10 -8
  30. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftmodule +0 -0
  31. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +266 -31
  32. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +10 -8
  33. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  34. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +10 -8
  35. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule +0 -0
  36. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/_CodeSignature/CodeResources +21 -25
  37. package/ios/src/RNPlaidLinkSdkVersion.swift +1 -1
  38. package/ios/src/ReactNativePlaidLinkSdkModule.swift +35 -0
  39. package/package.json +1 -1
  40. package/src/ReactNativePlaidLinkSdk.types.ts +15 -0
  41. package/src/ReactNativePlaidLinkSdkModule.ts +1 -0
  42. package/src/index.ts +89 -4
@@ -4,10 +4,6 @@
4
4
  <dict>
5
5
  <key>files</key>
6
6
  <dict>
7
- <key>.DS_Store</key>
8
- <data>
9
- 4IMHiMtR4egh14Zlt9TJ2LiJqj8=
10
- </data>
11
7
  <key>Headers/LinkKit-Swift.h</key>
12
8
  <data>
13
9
  T0kPYIntgQ61352a4qfCVCfTcVM=
@@ -18,47 +14,47 @@
18
14
  </data>
19
15
  <key>Info.plist</key>
20
16
  <data>
21
- 0qEqMiGHH1FF4MwRNbZp6IN8HPg=
17
+ S5G+/kcNZuPh7lisq8q9k97alZ4=
22
18
  </data>
23
19
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
24
20
  <data>
25
- BkrqlOFDwvfFphmlzgh2TjvplfM=
21
+ Frak3Juz1BPKI5pcBVTZH7nL1V8=
26
22
  </data>
27
23
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
28
24
  <data>
29
- m2Z36h2zoTCCToiKSBp5CjfHEtA=
25
+ B0yEqA9Rie0K8cjIBvBvAmdHCHU=
30
26
  </data>
31
27
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
32
28
  <data>
33
- wfMFkSE8OovbcWtupmu3Vgf+K+4=
29
+ yfoBbwifUtw4GE43c6eTdRBzxs4=
34
30
  </data>
35
31
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
36
32
  <data>
37
- m2Z36h2zoTCCToiKSBp5CjfHEtA=
33
+ B0yEqA9Rie0K8cjIBvBvAmdHCHU=
38
34
  </data>
39
35
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
40
36
  <data>
41
- 4lRFW70l5HwRmmb60qm4EL1ivag=
37
+ e9KXnkp1qkZTpv4WAVvS7DZehHY=
42
38
  </data>
43
39
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
44
40
  <data>
45
- BkrqlOFDwvfFphmlzgh2TjvplfM=
41
+ Frak3Juz1BPKI5pcBVTZH7nL1V8=
46
42
  </data>
47
43
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
48
44
  <data>
49
- 3GmEy35/kRXAjM+FJwxYGiD6as0=
45
+ XNTWgcntam8wE5KlcNrK68j8dks=
50
46
  </data>
51
47
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
52
48
  <data>
53
- Ch3JJ/J04f6PQt6hdKhKiTLmcpQ=
49
+ Zf+x/N/MHd57gqMxIDRgDaQaT4M=
54
50
  </data>
55
51
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
56
52
  <data>
57
- 3GmEy35/kRXAjM+FJwxYGiD6as0=
53
+ XNTWgcntam8wE5KlcNrK68j8dks=
58
54
  </data>
59
55
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
60
56
  <data>
61
- U4n8BDsdrLL0Jp0JJUAnvOmLrUI=
57
+ ke3ArYJwMaA/OO73VdnzLCQU4gs=
62
58
  </data>
63
59
  <key>Modules/module.modulemap</key>
64
60
  <data>
@@ -89,70 +85,70 @@
89
85
  <dict>
90
86
  <key>hash2</key>
91
87
  <data>
92
- JOixkVppvFrWL0o2YutfZ5DQLS58K/l7cmuE48xpMqM=
88
+ MgpS3X8PCg5Zcf3p4En59oThXpm8Y9yOPi2iiHJL2zs=
93
89
  </data>
94
90
  </dict>
95
91
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
96
92
  <dict>
97
93
  <key>hash2</key>
98
94
  <data>
99
- Be1gRm8wlXStnKZAwQlPNRcT+dEs8fUZfDgY/KFYPb4=
95
+ 7IaPEt2hc1HdjPScDfQsefYP2TNRstmqKFq0f7CIxxw=
100
96
  </data>
101
97
  </dict>
102
98
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
103
99
  <dict>
104
100
  <key>hash2</key>
105
101
  <data>
106
- OJa7N4js0PHN/c0yMgNH1h0bDL8C3Se+gyZ2f+fjlew=
102
+ J7HRm9Mwn6vDNNnztpMLZsn+u+6zq9YYt3ItxMyi7rI=
107
103
  </data>
108
104
  </dict>
109
105
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
110
106
  <dict>
111
107
  <key>hash2</key>
112
108
  <data>
113
- Be1gRm8wlXStnKZAwQlPNRcT+dEs8fUZfDgY/KFYPb4=
109
+ 7IaPEt2hc1HdjPScDfQsefYP2TNRstmqKFq0f7CIxxw=
114
110
  </data>
115
111
  </dict>
116
112
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
117
113
  <dict>
118
114
  <key>hash2</key>
119
115
  <data>
120
- PbebpXva0crbCfCxOt3xokGbkesohnJkTXcPScHPRwE=
116
+ +T9lGaQyVLSZoXK8rmY3EEcPafHFBa+iB2dqnhWrT/M=
121
117
  </data>
122
118
  </dict>
123
119
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
124
120
  <dict>
125
121
  <key>hash2</key>
126
122
  <data>
127
- JOixkVppvFrWL0o2YutfZ5DQLS58K/l7cmuE48xpMqM=
123
+ MgpS3X8PCg5Zcf3p4En59oThXpm8Y9yOPi2iiHJL2zs=
128
124
  </data>
129
125
  </dict>
130
126
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
131
127
  <dict>
132
128
  <key>hash2</key>
133
129
  <data>
134
- h67sm1oy3uGGJeRyH9zZBOF9IEMQk2jCuKH62ZlDya0=
130
+ jT1ZjexmUAU7a50LI/FhRSVq3DCvutDv49Uc5eXeztE=
135
131
  </data>
136
132
  </dict>
137
133
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
138
134
  <dict>
139
135
  <key>hash2</key>
140
136
  <data>
141
- LRKo6EXujxti0NUt0UxorA843v0Tbi9pi6iGS6UGDro=
137
+ AycKvXLBMv2ni2meW0aM4dbSZIBEvBdEm9ylZxPQIs8=
142
138
  </data>
143
139
  </dict>
144
140
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
145
141
  <dict>
146
142
  <key>hash2</key>
147
143
  <data>
148
- h67sm1oy3uGGJeRyH9zZBOF9IEMQk2jCuKH62ZlDya0=
144
+ jT1ZjexmUAU7a50LI/FhRSVq3DCvutDv49Uc5eXeztE=
149
145
  </data>
150
146
  </dict>
151
147
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
152
148
  <dict>
153
149
  <key>hash2</key>
154
150
  <data>
155
- 9oOlbNYMW0VV99UwkszWUdrSA0HC/VIOBYekc++71Hk=
151
+ YivCIJkm4STVAmLq4XDt9Cg3cKUt/mFm3zrhsJR1PeE=
156
152
  </data>
157
153
  </dict>
158
154
  <key>Modules/module.modulemap</key>
@@ -15,5 +15,5 @@ public class RNPlaidLinkSdkVersion: NSObject {
15
15
  ///
16
16
  /// This should match the version specified in package.json.
17
17
  /// Update this value when bumping the SDK version.
18
- @objc public static let sdkVersion: String = "13.0.3"
18
+ @objc public static let sdkVersion: String = "13.0.5"
19
19
  }
@@ -70,6 +70,40 @@ public class ReactNativePlaidLinkSdkModule: Module {
70
70
  }
71
71
  }
72
72
 
73
+ AsyncFunction(ModuleFunctionName.createPlaidIdentityVerificationSession.rawValue) {
74
+ (token: String, promise: Promise) in
75
+ let onSuccess: OnSuccessHandler = { [weak self] success in
76
+ self?.sendEvent(ModuleEventName.onSuccess.rawValue, success.asDictionary)
77
+ }
78
+
79
+ let onExit: OnExitHandler = { [weak self] exit in
80
+ self?.sendEvent(ModuleEventName.onExit.rawValue, exit.asDictionary)
81
+ self?.linkSession = nil
82
+ }
83
+
84
+ let onEvent: OnEventHandler = { [weak self] event in
85
+ self?.sendEvent(ModuleEventName.onEvent.rawValue, event.asDictionary)
86
+ }
87
+
88
+ let config = LinkTokenConfiguration(
89
+ token: token,
90
+ onSuccess: onSuccess,
91
+ onExit: onExit,
92
+ onEvent: onEvent,
93
+ onLoad: nil
94
+ )
95
+
96
+ do {
97
+ let session = try Plaid.createPlaidLinkSession(configuration: config)
98
+ self.linkSession = session
99
+ self.sessionCreationError = nil
100
+ promise.resolve()
101
+ } catch {
102
+ self.sessionCreationError = error
103
+ promise.reject("IDENTITY_VERIFICATION_SESSION_CREATE_ERROR", error.localizedDescription)
104
+ }
105
+ }
106
+
73
107
  AsyncFunction(ModuleFunctionName.createPlaidLayerSession.rawValue) { (token: String, promise: Promise) in
74
108
  let onSuccess: OnSuccessHandler = { [weak self] success in
75
109
  self?.sendEvent(ModuleEventName.onSuccess.rawValue, success.asDictionary)
@@ -348,6 +382,7 @@ public class ReactNativePlaidLinkSdkModule: Module {
348
382
  /// Function names that the module can call from JavaScript.
349
383
  enum ModuleFunctionName: String, CaseIterable {
350
384
  case createPlaidLinkSession
385
+ case createPlaidIdentityVerificationSession
351
386
  case createPlaidLayerSession
352
387
  case createPlaidHeadlessSession
353
388
  case openLinkSession
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-plaid-link-sdk",
3
- "version": "13.0.3",
3
+ "version": "13.0.5",
4
4
  "description": "React Native Plaid Link SDK (New Architecture & Expo)",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -801,6 +801,21 @@ export interface LinkTokenConfiguration {
801
801
  onLoad?: () => void;
802
802
  }
803
803
 
804
+ /** Configuration for an Identity Verification Link session. */
805
+ export interface IdentityVerificationTokenConfiguration {
806
+ /** The Identity Verification link token created by your server. */
807
+ token: string;
808
+
809
+ /** Called when the Identity Verification flow completes successfully. */
810
+ onSuccess: LinkSuccessListener;
811
+
812
+ /** Called when the user exits the Identity Verification flow. */
813
+ onExit: LinkExitListener;
814
+
815
+ /** Called as the user reaches points in the Identity Verification flow. */
816
+ onEvent: LinkOnEventListener;
817
+ }
818
+
804
819
  export interface LayerTokenConfiguration {
805
820
  /** The link-token your server retrieved from the /link/token/create endpoint. */
806
821
  token: string;
@@ -8,6 +8,7 @@ import {
8
8
  declare class ReactNativePlaidLinkSdkModule extends NativeModule<ReactNativePlaidLinkSdkModuleEvents> {
9
9
  sdkVersion: string;
10
10
  createPlaidLinkSession(token: string): Promise<void>;
11
+ createPlaidIdentityVerificationSession(token: string): Promise<void>;
11
12
  createPlaidLayerSession(token: string): Promise<void>;
12
13
  createPlaidHeadlessSession(token: string): Promise<void>;
13
14
  openLinkSession(fullScreen: boolean): Promise<void>;
package/src/index.ts CHANGED
@@ -3,8 +3,10 @@ import { Platform } from "react-native";
3
3
  import {
4
4
  LinkExit,
5
5
  LinkEvent,
6
+ LinkEventName,
6
7
  LinkSuccess,
7
8
  LinkTokenConfiguration,
9
+ IdentityVerificationTokenConfiguration,
8
10
  PlaidLinkSession,
9
11
  LayerTokenConfiguration,
10
12
  PlaidLayerSession,
@@ -19,14 +21,37 @@ type Subscription = ReturnType<typeof NativePlaidModule.addListener>;
19
21
  let successSub: Subscription | null = null;
20
22
  let exitSub: Subscription | null = null;
21
23
  let eventSub: Subscription | null = null;
24
+ let postSuccessHandoffCleanupTimeout: ReturnType<typeof setTimeout> | null =
25
+ null;
22
26
 
23
- function cleanupListeners() {
27
+ const POST_SUCCESS_HANDOFF_EVENT_WINDOW_MS = 1500;
28
+
29
+ function clearPostSuccessHandoffCleanupTimeout() {
30
+ if (postSuccessHandoffCleanupTimeout) {
31
+ clearTimeout(postSuccessHandoffCleanupTimeout);
32
+ postSuccessHandoffCleanupTimeout = null;
33
+ }
34
+ }
35
+
36
+ function cleanupListeners(options: { keepEventListener?: boolean } = {}) {
37
+ clearPostSuccessHandoffCleanupTimeout();
24
38
  successSub?.remove();
25
39
  exitSub?.remove();
26
- eventSub?.remove();
40
+ if (!options.keepEventListener) {
41
+ eventSub?.remove();
42
+ eventSub = null;
43
+ }
27
44
  successSub = null;
28
45
  exitSub = null;
29
- eventSub = null;
46
+ }
47
+
48
+ function cleanupAfterPostSuccessHandoffWindow() {
49
+ postSuccessHandoffCleanupTimeout = setTimeout(() => {
50
+ cleanupListeners();
51
+ }, POST_SUCCESS_HANDOFF_EVENT_WINDOW_MS);
52
+ (
53
+ postSuccessHandoffCleanupTimeout as unknown as { unref?: () => void }
54
+ ).unref?.();
30
55
  }
31
56
 
32
57
  export async function createPlaidLinkSession(
@@ -38,7 +63,8 @@ export async function createPlaidLinkSession(
38
63
  "PlaidLink.onSuccess",
39
64
  (success: LinkSuccess) => {
40
65
  config.onSuccess(success);
41
- cleanupListeners();
66
+ cleanupListeners({ keepEventListener: true });
67
+ cleanupAfterPostSuccessHandoffWindow();
42
68
  },
43
69
  );
44
70
 
@@ -54,6 +80,12 @@ export async function createPlaidLinkSession(
54
80
  "PlaidLink.onEvent",
55
81
  (event: LinkEvent) => {
56
82
  config.onEvent(event);
83
+ if (
84
+ postSuccessHandoffCleanupTimeout &&
85
+ event.eventName === LinkEventName.HANDOFF
86
+ ) {
87
+ cleanupListeners();
88
+ }
57
89
  },
58
90
  );
59
91
 
@@ -66,6 +98,59 @@ export async function createPlaidLinkSession(
66
98
  };
67
99
  }
68
100
 
101
+ /**
102
+ * Creates an Identity Verification session without waiting for an onLoad
103
+ * callback, which Identity Verification flows do not emit.
104
+ */
105
+ export async function createPlaidIdentityVerificationSession(
106
+ config: IdentityVerificationTokenConfiguration,
107
+ ): Promise<PlaidLinkSession> {
108
+ cleanupListeners();
109
+
110
+ successSub = NativePlaidModule.addListener(
111
+ "PlaidLink.onSuccess",
112
+ (success: LinkSuccess) => {
113
+ config.onSuccess(success);
114
+ cleanupListeners({ keepEventListener: true });
115
+ cleanupAfterPostSuccessHandoffWindow();
116
+ },
117
+ );
118
+
119
+ exitSub = NativePlaidModule.addListener(
120
+ "PlaidLink.onExit",
121
+ (exit: LinkExit) => {
122
+ config.onExit(exit);
123
+ cleanupListeners();
124
+ },
125
+ );
126
+
127
+ eventSub = NativePlaidModule.addListener(
128
+ "PlaidLink.onEvent",
129
+ (event: LinkEvent) => {
130
+ config.onEvent(event);
131
+ if (
132
+ postSuccessHandoffCleanupTimeout &&
133
+ event.eventName === LinkEventName.HANDOFF
134
+ ) {
135
+ cleanupListeners();
136
+ }
137
+ },
138
+ );
139
+
140
+ try {
141
+ await NativePlaidModule.createPlaidIdentityVerificationSession(
142
+ config.token,
143
+ );
144
+ } catch (error) {
145
+ cleanupListeners();
146
+ throw error;
147
+ }
148
+
149
+ return {
150
+ open: (fullScreen = false) => NativePlaidModule.openLinkSession(fullScreen),
151
+ };
152
+ }
153
+
69
154
  export async function createPlaidLayerSession(
70
155
  config: LayerTokenConfiguration,
71
156
  ): Promise<PlaidLayerSession> {