react-native-plaid-link-sdk 13.0.2 → 13.0.4

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 (33) hide show
  1. package/CHANGELOG.md +41 -0
  2. package/V13_MIGRATION_GUIDE.md +76 -0
  3. package/android/build.gradle +1 -1
  4. package/android/src/main/AndroidManifest.xml +1 -1
  5. package/android/src/main/java/expo/modules/plaidlinksdk/RNPlaidLinkSdkVersion.kt +1 -1
  6. package/build/index.d.ts.map +1 -1
  7. package/build/index.js +28 -5
  8. package/build/index.js.map +1 -1
  9. package/ios/Frameworks/LinkKit.xcframework/Info.plist +5 -5
  10. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Info.plist +0 -0
  11. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/LinkKit +0 -0
  12. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios.abi.json +578 -343
  13. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios.private.swiftinterface +10 -8
  14. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  15. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios.swiftinterface +10 -8
  16. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios.swiftmodule +0 -0
  17. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/_CodeSignature/CodeResources +11 -11
  18. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Info.plist +0 -0
  19. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/LinkKit +0 -0
  20. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.abi.json +578 -343
  21. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +10 -8
  22. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  23. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +10 -8
  24. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftmodule +0 -0
  25. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +578 -343
  26. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +10 -8
  27. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  28. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +10 -8
  29. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule +0 -0
  30. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/_CodeSignature/CodeResources +21 -21
  31. package/ios/src/RNPlaidLinkSdkVersion.swift +1 -1
  32. package/package.json +1 -1
  33. package/src/index.ts +37 -4
@@ -252,11 +252,13 @@ public enum ConfigurationError : Foundation.LocalizedError {
252
252
  get
253
253
  }
254
254
  }
255
+ @available(*, deprecated, message: "Present Link with PlaidLinkSheet(session:) or session.sheet() instead")
255
256
  @_Concurrency.MainActor @preconcurrency public struct PlaidLinkView<ErrorView> : SwiftUICore.View where ErrorView : SwiftUICore.View {
256
257
  @_Concurrency.MainActor @preconcurrency public init(token: Swift.String, onSuccess: @escaping LinkKit.OnSuccessHandler, onExit: LinkKit.OnExitHandler? = nil, onEvent: LinkKit.OnEventHandler? = nil, @SwiftUICore.ViewBuilder errorView: @escaping (any Swift.Error) -> ErrorView)
257
258
  @_Concurrency.MainActor @preconcurrency public var body: some SwiftUICore.View {
258
259
  get
259
260
  }
261
+ @available(*, deprecated, message: "Present Link with PlaidLinkSheet(session:) or session.sheet() instead")
260
262
  public typealias Body = @_opaqueReturnTypeOf("$s7LinkKit05PlaidA4ViewV4bodyQrvp", 0) __<ErrorView>
261
263
  }
262
264
  public enum AuthErrorCode : Swift.Error, Swift.CustomStringConvertible, Swift.Codable, Swift.Equatable {
@@ -679,17 +681,15 @@ public struct PlaidFinanceKit {
679
681
  @available(iOS 17.4, *)
680
682
  public static func sync(token: Swift.String, requestAuthorizationIfNeeded: Swift.Bool, syncBehavior: LinkKit.PlaidFinanceKit.SyncBehavior = .live) async throws
681
683
  }
682
- @_Concurrency.MainActor @preconcurrency public struct PlaidLinkUIViewControllerRepresentable : SwiftUI.UIViewControllerRepresentable {
684
+ @available(*, deprecated, message: "Present Link with PlaidLinkSheet(session:) or session.sheet() instead")
685
+ @_Concurrency.MainActor @preconcurrency public struct PlaidLinkUIViewControllerRepresentable : SwiftUICore.View {
683
686
  @_Concurrency.MainActor @preconcurrency public init(session: LinkKit.PlaidLinkSession)
684
687
  @_Concurrency.MainActor @preconcurrency public init(session: LinkKit.PlaidLayerSession)
685
- @objc @_hasMissingDesignatedInitializers final public class Coordinator : ObjectiveC.NSObject {
686
- @objc deinit
688
+ @_Concurrency.MainActor @preconcurrency public var body: some SwiftUICore.View {
689
+ get
687
690
  }
688
- @_Concurrency.MainActor @preconcurrency public func makeCoordinator() -> LinkKit.PlaidLinkUIViewControllerRepresentable.Coordinator
689
- @_Concurrency.MainActor @preconcurrency public func makeUIViewController(context: LinkKit.PlaidLinkUIViewControllerRepresentable.Context) -> UIKit.UIViewController
690
- @_Concurrency.MainActor @preconcurrency public func updateUIViewController(_ uiViewController: UIKit.UIViewController, context: LinkKit.PlaidLinkUIViewControllerRepresentable.Context)
691
- public typealias Body = Swift.Never
692
- public typealias UIViewControllerType = UIKit.UIViewController
691
+ @available(*, deprecated, message: "Present Link with PlaidLinkSheet(session:) or session.sheet() instead")
692
+ public typealias Body = @_opaqueReturnTypeOf("$s7LinkKit05PlaidA29UIViewControllerRepresentableV4bodyQrvp", 0) __
693
693
  }
694
694
  public enum InstitutionErrorCode : Swift.Error, Swift.CustomStringConvertible, Swift.Equatable, Swift.Codable {
695
695
  case institutionDown
@@ -747,6 +747,7 @@ public enum ExitStatus : Swift.CustomStringConvertible, Swift.Codable, Swift.Equ
747
747
  public static func == (a: LinkKit.ExitStatus, b: LinkKit.ExitStatus) -> Swift.Bool
748
748
  }
749
749
  extension LinkKit.EmbeddedSearchView : Swift.Sendable {}
750
+ @available(*, deprecated, message: "Present Link with PlaidLinkSheet(session:) or session.sheet() instead")
750
751
  extension LinkKit.PlaidLinkView : Swift.Sendable {}
751
752
  extension LinkKit.MFAType : Swift.Hashable {}
752
753
  extension LinkKit.PlaidLinkSheet : Swift.Sendable {}
@@ -756,4 +757,5 @@ extension LinkKit.Environment : Swift.Hashable {}
756
757
  extension LinkKit.PlaidFinanceKit.SyncBehavior : Swift.Equatable {}
757
758
  @available(iOS 17.4, *)
758
759
  extension LinkKit.PlaidFinanceKit.SyncBehavior : Swift.Hashable {}
760
+ @available(*, deprecated, message: "Present Link with PlaidLinkSheet(session:) or session.sheet() instead")
759
761
  extension LinkKit.PlaidLinkUIViewControllerRepresentable : Swift.Sendable {}
@@ -252,11 +252,13 @@ public enum ConfigurationError : Foundation.LocalizedError {
252
252
  get
253
253
  }
254
254
  }
255
+ @available(*, deprecated, message: "Present Link with PlaidLinkSheet(session:) or session.sheet() instead")
255
256
  @_Concurrency.MainActor @preconcurrency public struct PlaidLinkView<ErrorView> : SwiftUICore.View where ErrorView : SwiftUICore.View {
256
257
  @_Concurrency.MainActor @preconcurrency public init(token: Swift.String, onSuccess: @escaping LinkKit.OnSuccessHandler, onExit: LinkKit.OnExitHandler? = nil, onEvent: LinkKit.OnEventHandler? = nil, @SwiftUICore.ViewBuilder errorView: @escaping (any Swift.Error) -> ErrorView)
257
258
  @_Concurrency.MainActor @preconcurrency public var body: some SwiftUICore.View {
258
259
  get
259
260
  }
261
+ @available(*, deprecated, message: "Present Link with PlaidLinkSheet(session:) or session.sheet() instead")
260
262
  public typealias Body = @_opaqueReturnTypeOf("$s7LinkKit05PlaidA4ViewV4bodyQrvp", 0) __<ErrorView>
261
263
  }
262
264
  public enum AuthErrorCode : Swift.Error, Swift.CustomStringConvertible, Swift.Codable, Swift.Equatable {
@@ -679,17 +681,15 @@ public struct PlaidFinanceKit {
679
681
  @available(iOS 17.4, *)
680
682
  public static func sync(token: Swift.String, requestAuthorizationIfNeeded: Swift.Bool, syncBehavior: LinkKit.PlaidFinanceKit.SyncBehavior = .live) async throws
681
683
  }
682
- @_Concurrency.MainActor @preconcurrency public struct PlaidLinkUIViewControllerRepresentable : SwiftUI.UIViewControllerRepresentable {
684
+ @available(*, deprecated, message: "Present Link with PlaidLinkSheet(session:) or session.sheet() instead")
685
+ @_Concurrency.MainActor @preconcurrency public struct PlaidLinkUIViewControllerRepresentable : SwiftUICore.View {
683
686
  @_Concurrency.MainActor @preconcurrency public init(session: LinkKit.PlaidLinkSession)
684
687
  @_Concurrency.MainActor @preconcurrency public init(session: LinkKit.PlaidLayerSession)
685
- @objc @_hasMissingDesignatedInitializers final public class Coordinator : ObjectiveC.NSObject {
686
- @objc deinit
688
+ @_Concurrency.MainActor @preconcurrency public var body: some SwiftUICore.View {
689
+ get
687
690
  }
688
- @_Concurrency.MainActor @preconcurrency public func makeCoordinator() -> LinkKit.PlaidLinkUIViewControllerRepresentable.Coordinator
689
- @_Concurrency.MainActor @preconcurrency public func makeUIViewController(context: LinkKit.PlaidLinkUIViewControllerRepresentable.Context) -> UIKit.UIViewController
690
- @_Concurrency.MainActor @preconcurrency public func updateUIViewController(_ uiViewController: UIKit.UIViewController, context: LinkKit.PlaidLinkUIViewControllerRepresentable.Context)
691
- public typealias Body = Swift.Never
692
- public typealias UIViewControllerType = UIKit.UIViewController
691
+ @available(*, deprecated, message: "Present Link with PlaidLinkSheet(session:) or session.sheet() instead")
692
+ public typealias Body = @_opaqueReturnTypeOf("$s7LinkKit05PlaidA29UIViewControllerRepresentableV4bodyQrvp", 0) __
693
693
  }
694
694
  public enum InstitutionErrorCode : Swift.Error, Swift.CustomStringConvertible, Swift.Equatable, Swift.Codable {
695
695
  case institutionDown
@@ -747,6 +747,7 @@ public enum ExitStatus : Swift.CustomStringConvertible, Swift.Codable, Swift.Equ
747
747
  public static func == (a: LinkKit.ExitStatus, b: LinkKit.ExitStatus) -> Swift.Bool
748
748
  }
749
749
  extension LinkKit.EmbeddedSearchView : Swift.Sendable {}
750
+ @available(*, deprecated, message: "Present Link with PlaidLinkSheet(session:) or session.sheet() instead")
750
751
  extension LinkKit.PlaidLinkView : Swift.Sendable {}
751
752
  extension LinkKit.MFAType : Swift.Hashable {}
752
753
  extension LinkKit.PlaidLinkSheet : Swift.Sendable {}
@@ -756,4 +757,5 @@ extension LinkKit.Environment : Swift.Hashable {}
756
757
  extension LinkKit.PlaidFinanceKit.SyncBehavior : Swift.Equatable {}
757
758
  @available(iOS 17.4, *)
758
759
  extension LinkKit.PlaidFinanceKit.SyncBehavior : Swift.Hashable {}
760
+ @available(*, deprecated, message: "Present Link with PlaidLinkSheet(session:) or session.sheet() instead")
759
761
  extension LinkKit.PlaidLinkUIViewControllerRepresentable : Swift.Sendable {}
@@ -14,47 +14,47 @@
14
14
  </data>
15
15
  <key>Info.plist</key>
16
16
  <data>
17
- zSx3bhiFingz12RlJ7+lLoyGA2k=
17
+ S5G+/kcNZuPh7lisq8q9k97alZ4=
18
18
  </data>
19
19
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
20
20
  <data>
21
- BlapXKqZ1AOhb9bzugIyYJE64+U=
21
+ Frak3Juz1BPKI5pcBVTZH7nL1V8=
22
22
  </data>
23
23
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
24
24
  <data>
25
- m2Z36h2zoTCCToiKSBp5CjfHEtA=
25
+ B0yEqA9Rie0K8cjIBvBvAmdHCHU=
26
26
  </data>
27
27
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
28
28
  <data>
29
- wfMFkSE8OovbcWtupmu3Vgf+K+4=
29
+ yfoBbwifUtw4GE43c6eTdRBzxs4=
30
30
  </data>
31
31
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
32
32
  <data>
33
- m2Z36h2zoTCCToiKSBp5CjfHEtA=
33
+ B0yEqA9Rie0K8cjIBvBvAmdHCHU=
34
34
  </data>
35
35
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
36
36
  <data>
37
- DJhrXPcnV3f8LAIPiHoK0T0gJrc=
37
+ e9KXnkp1qkZTpv4WAVvS7DZehHY=
38
38
  </data>
39
39
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
40
40
  <data>
41
- BlapXKqZ1AOhb9bzugIyYJE64+U=
41
+ Frak3Juz1BPKI5pcBVTZH7nL1V8=
42
42
  </data>
43
43
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
44
44
  <data>
45
- 3GmEy35/kRXAjM+FJwxYGiD6as0=
45
+ XNTWgcntam8wE5KlcNrK68j8dks=
46
46
  </data>
47
47
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
48
48
  <data>
49
- Ch3JJ/J04f6PQt6hdKhKiTLmcpQ=
49
+ Zf+x/N/MHd57gqMxIDRgDaQaT4M=
50
50
  </data>
51
51
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
52
52
  <data>
53
- 3GmEy35/kRXAjM+FJwxYGiD6as0=
53
+ XNTWgcntam8wE5KlcNrK68j8dks=
54
54
  </data>
55
55
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
56
56
  <data>
57
- I3shGx2YIQUZTh4KWzWvZIh5750=
57
+ ke3ArYJwMaA/OO73VdnzLCQU4gs=
58
58
  </data>
59
59
  <key>Modules/module.modulemap</key>
60
60
  <data>
@@ -85,70 +85,70 @@
85
85
  <dict>
86
86
  <key>hash2</key>
87
87
  <data>
88
- Rhdw57cQxiS7wgaTGJvkA7fs+1V0X1/VCM0PLfj5ZB0=
88
+ MgpS3X8PCg5Zcf3p4En59oThXpm8Y9yOPi2iiHJL2zs=
89
89
  </data>
90
90
  </dict>
91
91
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface</key>
92
92
  <dict>
93
93
  <key>hash2</key>
94
94
  <data>
95
- Be1gRm8wlXStnKZAwQlPNRcT+dEs8fUZfDgY/KFYPb4=
95
+ 7IaPEt2hc1HdjPScDfQsefYP2TNRstmqKFq0f7CIxxw=
96
96
  </data>
97
97
  </dict>
98
98
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc</key>
99
99
  <dict>
100
100
  <key>hash2</key>
101
101
  <data>
102
- OJa7N4js0PHN/c0yMgNH1h0bDL8C3Se+gyZ2f+fjlew=
102
+ J7HRm9Mwn6vDNNnztpMLZsn+u+6zq9YYt3ItxMyi7rI=
103
103
  </data>
104
104
  </dict>
105
105
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface</key>
106
106
  <dict>
107
107
  <key>hash2</key>
108
108
  <data>
109
- Be1gRm8wlXStnKZAwQlPNRcT+dEs8fUZfDgY/KFYPb4=
109
+ 7IaPEt2hc1HdjPScDfQsefYP2TNRstmqKFq0f7CIxxw=
110
110
  </data>
111
111
  </dict>
112
112
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
113
113
  <dict>
114
114
  <key>hash2</key>
115
115
  <data>
116
- AvDB29gqSkL2ynVsTBIu8j84FNH2TMRoe1ZfSlH0il0=
116
+ +T9lGaQyVLSZoXK8rmY3EEcPafHFBa+iB2dqnhWrT/M=
117
117
  </data>
118
118
  </dict>
119
119
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
120
120
  <dict>
121
121
  <key>hash2</key>
122
122
  <data>
123
- Rhdw57cQxiS7wgaTGJvkA7fs+1V0X1/VCM0PLfj5ZB0=
123
+ MgpS3X8PCg5Zcf3p4En59oThXpm8Y9yOPi2iiHJL2zs=
124
124
  </data>
125
125
  </dict>
126
126
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface</key>
127
127
  <dict>
128
128
  <key>hash2</key>
129
129
  <data>
130
- h67sm1oy3uGGJeRyH9zZBOF9IEMQk2jCuKH62ZlDya0=
130
+ jT1ZjexmUAU7a50LI/FhRSVq3DCvutDv49Uc5eXeztE=
131
131
  </data>
132
132
  </dict>
133
133
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc</key>
134
134
  <dict>
135
135
  <key>hash2</key>
136
136
  <data>
137
- LRKo6EXujxti0NUt0UxorA843v0Tbi9pi6iGS6UGDro=
137
+ AycKvXLBMv2ni2meW0aM4dbSZIBEvBdEm9ylZxPQIs8=
138
138
  </data>
139
139
  </dict>
140
140
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface</key>
141
141
  <dict>
142
142
  <key>hash2</key>
143
143
  <data>
144
- h67sm1oy3uGGJeRyH9zZBOF9IEMQk2jCuKH62ZlDya0=
144
+ jT1ZjexmUAU7a50LI/FhRSVq3DCvutDv49Uc5eXeztE=
145
145
  </data>
146
146
  </dict>
147
147
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
148
148
  <dict>
149
149
  <key>hash2</key>
150
150
  <data>
151
- bE5g2V4zXFFlhnPA82/WvOASXTTBO4vojAhfHleee8A=
151
+ YivCIJkm4STVAmLq4XDt9Cg3cKUt/mFm3zrhsJR1PeE=
152
152
  </data>
153
153
  </dict>
154
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.2"
18
+ @objc public static let sdkVersion: String = "13.0.4"
19
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-plaid-link-sdk",
3
- "version": "13.0.2",
3
+ "version": "13.0.4",
4
4
  "description": "React Native Plaid Link SDK (New Architecture & Expo)",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
package/src/index.ts CHANGED
@@ -3,6 +3,7 @@ import { Platform } from "react-native";
3
3
  import {
4
4
  LinkExit,
5
5
  LinkEvent,
6
+ LinkEventName,
6
7
  LinkSuccess,
7
8
  LinkTokenConfiguration,
8
9
  PlaidLinkSession,
@@ -19,14 +20,37 @@ type Subscription = ReturnType<typeof NativePlaidModule.addListener>;
19
20
  let successSub: Subscription | null = null;
20
21
  let exitSub: Subscription | null = null;
21
22
  let eventSub: Subscription | null = null;
23
+ let postSuccessHandoffCleanupTimeout: ReturnType<typeof setTimeout> | null =
24
+ null;
22
25
 
23
- function cleanupListeners() {
26
+ const POST_SUCCESS_HANDOFF_EVENT_WINDOW_MS = 1500;
27
+
28
+ function clearPostSuccessHandoffCleanupTimeout() {
29
+ if (postSuccessHandoffCleanupTimeout) {
30
+ clearTimeout(postSuccessHandoffCleanupTimeout);
31
+ postSuccessHandoffCleanupTimeout = null;
32
+ }
33
+ }
34
+
35
+ function cleanupListeners(options: { keepEventListener?: boolean } = {}) {
36
+ clearPostSuccessHandoffCleanupTimeout();
24
37
  successSub?.remove();
25
38
  exitSub?.remove();
26
- eventSub?.remove();
39
+ if (!options.keepEventListener) {
40
+ eventSub?.remove();
41
+ eventSub = null;
42
+ }
27
43
  successSub = null;
28
44
  exitSub = null;
29
- eventSub = null;
45
+ }
46
+
47
+ function cleanupAfterPostSuccessHandoffWindow() {
48
+ postSuccessHandoffCleanupTimeout = setTimeout(() => {
49
+ cleanupListeners();
50
+ }, POST_SUCCESS_HANDOFF_EVENT_WINDOW_MS);
51
+ (
52
+ postSuccessHandoffCleanupTimeout as unknown as { unref?: () => void }
53
+ ).unref?.();
30
54
  }
31
55
 
32
56
  export async function createPlaidLinkSession(
@@ -38,7 +62,8 @@ export async function createPlaidLinkSession(
38
62
  "PlaidLink.onSuccess",
39
63
  (success: LinkSuccess) => {
40
64
  config.onSuccess(success);
41
- cleanupListeners();
65
+ cleanupListeners({ keepEventListener: true });
66
+ cleanupAfterPostSuccessHandoffWindow();
42
67
  },
43
68
  );
44
69
 
@@ -54,11 +79,19 @@ export async function createPlaidLinkSession(
54
79
  "PlaidLink.onEvent",
55
80
  (event: LinkEvent) => {
56
81
  config.onEvent(event);
82
+ if (
83
+ postSuccessHandoffCleanupTimeout &&
84
+ event.eventName === LinkEventName.HANDOFF
85
+ ) {
86
+ cleanupListeners();
87
+ }
57
88
  },
58
89
  );
59
90
 
60
91
  await NativePlaidModule.createPlaidLinkSession(config.token);
61
92
 
93
+ config.onLoad?.();
94
+
62
95
  return {
63
96
  open: (fullScreen = false) => NativePlaidModule.openLinkSession(fullScreen),
64
97
  };