react-native-plaid-link-sdk 13.0.5 → 13.2.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.
Files changed (24) hide show
  1. package/AGENTS.md +233 -0
  2. package/CHANGELOG.md +51 -0
  3. package/README.md +69 -1
  4. package/android/build.gradle +1 -1
  5. package/android/src/main/AndroidManifest.xml +1 -1
  6. package/android/src/main/java/expo/modules/plaidlinksdk/RNPlaidLinkSdkVersion.kt +1 -1
  7. package/build/index.d.ts +70 -1
  8. package/build/index.d.ts.map +1 -1
  9. package/build/index.js +66 -1
  10. package/build/index.js.map +1 -1
  11. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Info.plist +0 -0
  12. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/LinkKit +0 -0
  13. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios.swiftmodule +0 -0
  14. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/PrivacyInfo.xcprivacy +1 -1
  15. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/_CodeSignature/CodeResources +9 -5
  16. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Info.plist +0 -0
  17. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/LinkKit +0 -0
  18. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftmodule +0 -0
  19. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule +0 -0
  20. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/PrivacyInfo.xcprivacy +1 -1
  21. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/_CodeSignature/CodeResources +11 -7
  22. package/ios/src/RNPlaidLinkSdkVersion.swift +1 -1
  23. package/package.json +3 -1
  24. package/src/index.ts +115 -1
package/AGENTS.md ADDED
@@ -0,0 +1,233 @@
1
+ # AGENTS.md
2
+
3
+ Guidance for AI coding agents integrating `react-native-plaid-link-sdk`.
4
+ Applies to **v13.x**. For v11/v12 integrations, see `V13_MIGRATION_GUIDE.md`.
5
+
6
+ If you learned this SDK before v13, your recalled API is out of date. v13 is a
7
+ rewrite onto Expo Modules with a session-based API. Read the rename table below
8
+ before writing any Plaid code.
9
+
10
+ ## The import
11
+
12
+ ```ts
13
+ import { createPlaidLinkSession } from "react-native-plaid-link-sdk";
14
+ ```
15
+
16
+ Every removed pre-v13 name is retained only as a migration diagnostic and is
17
+ not usable: `create`, `open`, `openLink`, `usePlaidEmitter`, `submit`,
18
+ `destroy`, `dismissLink`, `PlaidLink`, and `EmbeddedLinkView`.
19
+
20
+ ```ts
21
+ import { create, open } from "react-native-plaid-link-sdk";
22
+ import { EmbeddedLinkView } from "react-native-plaid-link-sdk";
23
+ ```
24
+
25
+ Using one reports `TS2349: This expression is not callable` followed by an exact
26
+ v13 replacement, such as `Removed in v13. Use await
27
+ createPlaidLinkSession(config), then call await session.open() on the returned
28
+ session.` Rendering `PlaidLink` or `EmbeddedLinkView` as JSX reports `TS2786`
29
+ carrying the same replacement. JavaScript callers receive the same guidance as a
30
+ runtime error.
31
+
32
+ Older v13 releases reported `TS2614 ... Did you mean to use 'import create from
33
+ "react-native-plaid-link-sdk"' instead?`. **That suggestion is wrong.** The
34
+ deprecated default export is the native module object, not any of these names.
35
+ Do not follow the default-import suggestion.
36
+
37
+ ## If you were about to write pre-v13 code
38
+
39
+ | Pre-v13 | v13 |
40
+ | --------------------------------------- | ------------------------------------------------------------ |
41
+ | `create(config)` | `await createPlaidLinkSession(config)` |
42
+ | `open({ onSuccess, onExit })` | `await session.open()` — callbacks now go to the create call |
43
+ | `openLink({ tokenConfig, onSuccess })` | `createPlaidLinkSession(...)` then `session.open()` |
44
+ | `<PlaidLink>` component | Build your own button, call `createPlaidLinkSession` |
45
+ | `usePlaidEmitter(listener)` | Pass `onEvent` to the create call |
46
+ | `submit(data)` | `await session.submit(data)` on a Layer session |
47
+ | `EmbeddedLinkView` | `PlaidEmbeddedSearchView` |
48
+ | `syncFinanceKit(token, bool, bool, cb)` | `await syncFinanceKit({ token, ... })` |
49
+ | `iOSPresentationStyle: FULL_SCREEN` | `await session.open(true)` |
50
+ | `destroy()` | Not needed — each create call resets session state |
51
+ | `dismissLink()` | No replacement in v13 |
52
+
53
+ The two changes that trip up most generated code: **callbacks moved from `open`
54
+ to the create call**, and **every create function is `async`**.
55
+
56
+ ## Complete v13 export surface
57
+
58
+ Functions — `createPlaidLinkSession`, `createPlaidIdentityVerificationSession`,
59
+ `createPlaidLayerSession`, `createPlaidHeadlessSession`, `syncFinanceKit`.
60
+
61
+ Constant — `sdkVersion`.
62
+
63
+ Component — `PlaidEmbeddedSearchView` (with `PlaidEmbeddedSearchViewProps`).
64
+
65
+ Types and enums — `LinkSuccess`, `LinkExit`, `LinkEvent`, `LinkEventName`,
66
+ `LinkError`, `LinkTokenConfiguration`, `PlaidLinkSession`, `PlaidLayerSession`,
67
+ `PlaidHeadlessSession`, `SubmissionData`, `FinanceKitSyncBehavior`, and the
68
+ other types in `ReactNativePlaidLinkSdk.types`.
69
+
70
+ Default export — deprecated native module instance. Do not use it; use the named
71
+ exports, including `sdkVersion`. It will be removed in the next major version.
72
+
73
+ ## Standard Link
74
+
75
+ ```ts
76
+ import { createPlaidLinkSession } from "react-native-plaid-link-sdk";
77
+
78
+ const session = await createPlaidLinkSession({
79
+ token: "#GENERATED_LINK_TOKEN#",
80
+ onSuccess: (success) => console.log("Success", success),
81
+ onExit: (exit) => console.log("Exit", exit),
82
+ onEvent: (event) => console.log("Event", event),
83
+ onLoad: () => console.log("Link loaded"),
84
+ });
85
+
86
+ await session.open();
87
+ ```
88
+
89
+ `onSuccess`, `onExit`, and `onEvent` are required. `onLoad` is optional.
90
+ `session.open(true)` requests full-screen presentation on iOS.
91
+
92
+ ## Identity Verification
93
+
94
+ Use the dedicated function — IDV does not emit `onLoad`, so do not wait for it.
95
+
96
+ ```ts
97
+ import { createPlaidIdentityVerificationSession } from "react-native-plaid-link-sdk";
98
+
99
+ const session = await createPlaidIdentityVerificationSession({
100
+ token: "#GENERATED_IDENTITY_VERIFICATION_LINK_TOKEN#",
101
+ onSuccess: (success) => console.log("Success", success),
102
+ onExit: (exit) => console.log("Exit", exit),
103
+ onEvent: (event) => console.log("Event", event),
104
+ });
105
+
106
+ await session.open();
107
+ ```
108
+
109
+ ## Layer
110
+
111
+ Open Link when the Layer flow emits `LAYER_READY`.
112
+
113
+ ```ts
114
+ import {
115
+ LinkEventName,
116
+ PlaidLayerSession,
117
+ createPlaidLayerSession,
118
+ } from "react-native-plaid-link-sdk";
119
+
120
+ let session: PlaidLayerSession;
121
+
122
+ session = await createPlaidLayerSession({
123
+ token: "#GENERATED_LINK_TOKEN#",
124
+ onSuccess: (success) => console.log("Success", success),
125
+ onExit: (exit) => console.log("Exit", exit),
126
+ onEvent: async (event) => {
127
+ if (event.eventName === LinkEventName.LAYER_READY) {
128
+ await session.open();
129
+ }
130
+ },
131
+ });
132
+
133
+ await session.submit({
134
+ phoneNumber: "415-555-0017",
135
+ dateOfBirth: "1975-01-18",
136
+ });
137
+ ```
138
+
139
+ ## Headless Link
140
+
141
+ ```ts
142
+ import { createPlaidHeadlessSession } from "react-native-plaid-link-sdk";
143
+
144
+ const session = await createPlaidHeadlessSession({
145
+ token: "#GENERATED_LINK_TOKEN#",
146
+ onSuccess: (success) => console.log("Success", success),
147
+ onExit: (exit) => console.log("Exit", exit),
148
+ onEvent: (event) => console.log("Event", event),
149
+ });
150
+
151
+ await session.start();
152
+ ```
153
+
154
+ Headless sessions use `start()`, not `open()`.
155
+
156
+ ## Embedded Search
157
+
158
+ ```tsx
159
+ import { PlaidEmbeddedSearchView } from "react-native-plaid-link-sdk";
160
+
161
+ export function EmbeddedSearch() {
162
+ return (
163
+ <PlaidEmbeddedSearchView
164
+ token="#GENERATED_LINK_TOKEN#"
165
+ style={{ height: 500 }}
166
+ onLoad={() => console.log("Embedded Search loaded")}
167
+ onSuccess={(success) => console.log("Success", success)}
168
+ onExit={(exit) => console.log("Exit", exit)}
169
+ onEvent={(event) => console.log("Event", event)}
170
+ />
171
+ );
172
+ }
173
+ ```
174
+
175
+ Give the view an explicit height. It accepts standard `ViewProps`.
176
+
177
+ ## FinanceKit
178
+
179
+ iOS only. Rejects on Android.
180
+
181
+ ```ts
182
+ import {
183
+ FinanceKitSyncBehavior,
184
+ syncFinanceKit,
185
+ } from "react-native-plaid-link-sdk";
186
+
187
+ try {
188
+ await syncFinanceKit({
189
+ token: "#GENERATED_LINK_TOKEN#",
190
+ requestAuthorizationIfNeeded: true,
191
+ syncBehavior: FinanceKitSyncBehavior.LIVE,
192
+ });
193
+ } catch (error) {
194
+ console.log("FinanceKit error", error);
195
+ }
196
+ ```
197
+
198
+ ## Setup that breaks the build if missed
199
+
200
+ v13 is an Expo Module. Bare React Native apps must install and configure `expo`
201
+ before this SDK:
202
+
203
+ ```sh
204
+ npm install react-native-plaid-link-sdk expo
205
+ npx pod-install
206
+ ```
207
+
208
+ Expo apps install the package alone, then rebuild the native app.
209
+
210
+ - React Native 0.76+, Expo 52+, iOS 15.1+, Xcode 16.1+.
211
+ - **Expo Go does not work.** Link ships custom native code, so the app needs a
212
+ development build or another custom native build.
213
+ - Rebuild native after installing. A JS-only reload will not pick up the module.
214
+
215
+ ## Never do these
216
+
217
+ - Do not import from `build/`, `src/`, `ios/`, or `android/`. Import from the
218
+ package root only.
219
+ - Do not call Link functions on the default export.
220
+ - Do not hardcode a link token. Tokens come from your server calling
221
+ `/link/token/create`. In generated code use a placeholder or a fetch to your
222
+ backend.
223
+ - Do not put Plaid client secrets in the app. They belong on your server.
224
+ - Do not use `create`, `open`, `openLink`, `usePlaidEmitter`, `submit`,
225
+ `destroy`, `dismissLink`, `EmbeddedLinkView`, or the `PlaidLink` component.
226
+
227
+ ## More
228
+
229
+ - `README.md` — full integration reference
230
+ - `V13_MIGRATION_GUIDE.md` — v11/v12 to v13 migration
231
+ - `CHANGELOG.md` — release history
232
+ - https://plaid.com/docs/link/react-native/ — Plaid docs
233
+ - `CONTRIBUTING.md` — for changes to this SDK repo itself
package/CHANGELOG.md CHANGED
@@ -1,5 +1,56 @@
1
1
  # RELEASES
2
2
 
3
+ ## LinkKit V13.2.0 — 2026-09-15
4
+
5
+ ### Changes
6
+
7
+ - Updates Android integration to `com.plaid.link:sdk-core:6.2.1`, which narrows
8
+ the SDK's consumer ProGuard rules from a blanket `-keep` to `-keepnames`. R8
9
+ can now shrink and optimize Plaid SDK code in minified apps while keeping
10
+ stack traces readable.
11
+ - Lowers the minimum supported Android version to API level 25 (Android 7.1),
12
+ down from API level 26 (Android 8.0), through the Android SDK update.
13
+ - Picks up Android fixes for a white screen when connecting a second OAuth
14
+ institution in the same Link session, and for `income_verification` document
15
+ uploads through the WebView file chooser.
16
+ - Updates the bundled iOS SDK to LinkKit 7.1.2, which fixes `onLoad` not being
17
+ called for Identity Verification sessions and corrects an invalid purpose
18
+ value in the privacy manifest.
19
+ - No changes to the JavaScript API.
20
+
21
+ ### Android
22
+
23
+ Android SDK [6.2.1](https://github.com/plaid/plaid-link-android/releases/tag/v6.2.1)
24
+
25
+ ### iOS
26
+
27
+ iOS SDK [7.1.2](https://github.com/plaid/plaid-link-ios/releases/tag/7.1.2)
28
+
29
+ ## LinkKit V13.1.0 — 2026-08-31
30
+
31
+ ### Changes
32
+
33
+ - Adds deprecated migration diagnostics for the removed `create`, `open`, and
34
+ `EmbeddedLinkView` APIs. TypeScript and JavaScript errors now identify the
35
+ corresponding v13 session API instead of suggesting an incorrect default
36
+ import.
37
+ - Adds a named `sdkVersion` export and deprecates the raw native-module default
38
+ export. The default export remains available in v13 for compatibility.
39
+ - Adds packaged guidance for AI coding agents and expands troubleshooting for
40
+ integrations generated from pre-v13 API knowledge.
41
+ - Adds packed-package TypeScript regression coverage for supported v13 APIs and
42
+ removed-API diagnostics.
43
+ - Leaves Android integration unchanged at `com.plaid.link:sdk-core:6.1.0`.
44
+ - Leaves the bundled iOS SDK unchanged at LinkKit 7.1.0.
45
+
46
+ ### Android
47
+
48
+ Android SDK [6.1.0](https://github.com/plaid/plaid-link-android/releases/tag/v6.1.0)
49
+
50
+ ### iOS
51
+
52
+ iOS SDK [7.1.0](https://github.com/plaid/plaid-link-ios/releases/tag/7.1.0)
53
+
3
54
  ## LinkKit V13.0.5 — 2026-08-28
4
55
 
5
56
  ### Changes
package/README.md CHANGED
@@ -9,6 +9,7 @@ same session-based JavaScript API.
9
9
  - [Documentation for the latest stable release](https://docs.expo.dev/versions/latest/sdk/react-native-plaid-link-sdk/)
10
10
  - [Documentation for the main branch](https://docs.expo.dev/versions/unversioned/sdk/react-native-plaid-link-sdk/)
11
11
  - [Plaid Link documentation](https://plaid.com/docs/link/)
12
+ - [Guidance for AI coding agents](./AGENTS.md)
12
13
 
13
14
  ## Requirements
14
15
 
@@ -288,7 +289,74 @@ configured in the Plaid Dashboard for the environment you are testing.
288
289
  Confirm that the iOS bundle identifier and redirect URI are configured in the
289
290
  Plaid Dashboard for the environment you are testing.
290
291
 
291
- ### Import path fails after upgrading to v13
292
+ ### TS2614: Module '"react-native-plaid-link-sdk"' has no exported member 'create'
293
+
294
+ v13 replaced the global `create` and `open` functions with session objects, so
295
+ pre-v13 usages no longer compile. Older v13 releases report one error per
296
+ removed import:
297
+
298
+ ```
299
+ error TS2614: Module '"react-native-plaid-link-sdk"' has no exported member 'create'.
300
+ Did you mean to use 'import create from "react-native-plaid-link-sdk"' instead?
301
+ error TS2614: Module '"react-native-plaid-link-sdk"' has no exported member 'open'.
302
+ Did you mean to use 'import open from "react-native-plaid-link-sdk"' instead?
303
+ error TS2614: Module '"react-native-plaid-link-sdk"' has no exported member 'EmbeddedLinkView'.
304
+ Did you mean to use 'import EmbeddedLinkView from "react-native-plaid-link-sdk"' instead?
305
+ ```
306
+
307
+ Older v13 releases reported the same error for every other removed API.
308
+
309
+ **Do not follow the suggested default import.** The package does have a default
310
+ export, but it is the native module object, not these functions. Rewriting the
311
+ import as `import create from "react-native-plaid-link-sdk"` only moves the
312
+ failure to the next line:
313
+
314
+ ```
315
+ error TS2349: This expression is not callable.
316
+ Type 'ReactNativePlaidLinkSdkModule' has no call signatures.
317
+ ```
318
+
319
+ Newer v13 releases retain every removed pre-v13 name — `create`, `open`,
320
+ `openLink`, `usePlaidEmitter`, `submit`, `destroy`, `dismissLink`, `PlaidLink`,
321
+ and `EmbeddedLinkView` — only as deprecated migration diagnostics. Their imports
322
+ resolve, but trying to use one produces `TS2349` with the exact replacement in
323
+ its type:
324
+
325
+ ```
326
+ error TS2349: This expression is not callable.
327
+ Type '{ readonly __migration_error__: "Removed in v13. Use await createPlaidLinkSession(config), then call await session.open() on the returned session."; }' has no call signatures.
328
+ ```
329
+
330
+ Rendering `PlaidLink` or `EmbeddedLinkView` as a JSX element reports `TS2786`
331
+ with the same replacement:
332
+
333
+ ```
334
+ error TS2786: 'EmbeddedLinkView' cannot be used as a JSX component.
335
+ Its type '{ readonly __migration_error__: "Removed in v13. Use PlaidEmbeddedSearchView."; }' is not a valid JSX element type.
336
+ ```
337
+
338
+ JavaScript callers receive the same replacement and a migration-guide link in a
339
+ runtime error. These diagnostic exports do not restore the pre-v13 global API.
340
+
341
+ Use the v13 replacements instead:
342
+
343
+ | Pre-v13 | v13 |
344
+ | --------------------------------------- | ---------------------------------------------------------- |
345
+ | `create(config)` | `await createPlaidLinkSession(config)` |
346
+ | `open({ onSuccess, onExit })` | `await session.open()` — callbacks move to the create call |
347
+ | `openLink({ tokenConfig, ... })` | `createPlaidLinkSession(...)`, then `session.open()` |
348
+ | `<PlaidLink>` component | Build your own button and call `createPlaidLinkSession` |
349
+ | `usePlaidEmitter(listener)` | Pass `onEvent` to the create call |
350
+ | `submit(data)` | `await session.submit(data)` on a Layer session |
351
+ | `EmbeddedLinkView` | `PlaidEmbeddedSearchView` |
352
+ | `syncFinanceKit(token, bool, bool, cb)` | `await syncFinanceKit({ token, ... })` |
353
+ | `destroy()` | Not needed — each create call resets session state |
354
+ | `dismissLink()` | No replacement in v13 |
355
+
356
+ The [v13 migration guide](./V13_MIGRATION_GUIDE.md) has full before and after
357
+ examples for every flow.
358
+
359
+ ### Cannot find module after upgrading to v13
292
360
 
293
361
  Import from the package root only:
294
362
 
@@ -25,7 +25,7 @@ kotlin {
25
25
  }
26
26
 
27
27
  dependencies {
28
- implementation "com.plaid.link:sdk-core:6.1.0"
28
+ implementation "com.plaid.link:sdk-core:6.2.1"
29
29
  testImplementation "junit:junit:4.13.2"
30
30
  }
31
31
 
@@ -2,6 +2,6 @@
2
2
  <application>
3
3
  <meta-data
4
4
  android:name="com.plaid.link.react_native"
5
- android:value="13.0.5" />
5
+ android:value="13.2.0" />
6
6
  </application>
7
7
  </manifest>
@@ -1,5 +1,5 @@
1
1
  package expo.modules.plaidlinksdk
2
2
 
3
3
  internal object RNPlaidLinkSdkVersion {
4
- const val SDK_VERSION = "13.0.5"
4
+ const val SDK_VERSION = "13.2.0"
5
5
  }
package/build/index.d.ts CHANGED
@@ -1,4 +1,68 @@
1
1
  import { LinkTokenConfiguration, IdentityVerificationTokenConfiguration, PlaidLinkSession, LayerTokenConfiguration, PlaidLayerSession, PlaidHeadlessSession, FinanceKitSyncBehavior } from "./ReactNativePlaidLinkSdk.types";
2
+ import NativePlaidModule from "./ReactNativePlaidLinkSdkModule";
3
+ /**
4
+ * @deprecated Removed in v13. Use `await createPlaidLinkSession(config)`, then
5
+ * call `await session.open()` on the returned session.
6
+ */
7
+ export declare const create: {
8
+ readonly __migration_error__: "Removed in v13. Use await createPlaidLinkSession(config), then call await session.open() on the returned session.";
9
+ };
10
+ /**
11
+ * @deprecated Removed in v13. Call `await session.open()` on the session
12
+ * returned by `createPlaidLinkSession(config)`.
13
+ */
14
+ export declare const open: {
15
+ readonly __migration_error__: "Removed in v13. Call await session.open() on the session returned by createPlaidLinkSession(config). Move onSuccess, onExit, and onEvent callbacks to the create call.";
16
+ };
17
+ /**
18
+ * @deprecated Removed in v13. Use `PlaidEmbeddedSearchView`.
19
+ */
20
+ export declare const EmbeddedLinkView: {
21
+ readonly __migration_error__: "Removed in v13. Use PlaidEmbeddedSearchView.";
22
+ };
23
+ /**
24
+ * @deprecated Removed in v13. Use `await createPlaidLinkSession(config)`, then
25
+ * call `await session.open()` on the returned session.
26
+ */
27
+ export declare const openLink: {
28
+ readonly __migration_error__: "Removed in v13. Use await createPlaidLinkSession(config), then call await session.open() on the returned session.";
29
+ };
30
+ /**
31
+ * @deprecated Removed in v13. Pass `onEvent` to the create call instead of
32
+ * subscribing separately.
33
+ */
34
+ export declare const usePlaidEmitter: {
35
+ readonly __migration_error__: "Removed in v13. Pass onEvent to createPlaidLinkSession(config) instead of subscribing separately.";
36
+ };
37
+ /**
38
+ * @deprecated Removed in v13. Call `await session.submit(data)` on the session
39
+ * returned by `createPlaidLayerSession(config)`.
40
+ */
41
+ export declare const submit: {
42
+ readonly __migration_error__: "Removed in v13. Call await session.submit(data) on the session returned by createPlaidLayerSession(config).";
43
+ };
44
+ /**
45
+ * @deprecated Removed in v13. Build your own button and call
46
+ * `await createPlaidLinkSession(config)`, then `await session.open()`.
47
+ */
48
+ export declare const PlaidLink: {
49
+ readonly __migration_error__: "Removed in v13. Build your own button and call await createPlaidLinkSession(config), then await session.open().";
50
+ };
51
+ /**
52
+ * @deprecated Removed in v13. Each create call resets session state, so no
53
+ * teardown call is needed.
54
+ */
55
+ export declare const destroy: {
56
+ readonly __migration_error__: "Removed in v13. Remove the call. Each create call resets session state, so no teardown is needed.";
57
+ };
58
+ /**
59
+ * @deprecated Removed in v13 with no replacement.
60
+ */
61
+ export declare const dismissLink: {
62
+ readonly __migration_error__: "Removed in v13. Remove the call. There is no programmatic dismiss API in v13.";
63
+ };
64
+ /** The React Native Plaid Link SDK version reported by the native module. */
65
+ export declare const sdkVersion: string;
2
66
  export declare function createPlaidLinkSession(config: LinkTokenConfiguration): Promise<PlaidLinkSession>;
3
67
  /**
4
68
  * Creates an Identity Verification session without waiting for an onLoad
@@ -13,6 +77,11 @@ export declare function syncFinanceKit(config: {
13
77
  syncBehavior?: FinanceKitSyncBehavior;
14
78
  }): Promise<void>;
15
79
  export { PlaidEmbeddedSearchView, type PlaidEmbeddedSearchViewProps, } from "./PlaidEmbeddedSearchView";
16
- export { default } from "./ReactNativePlaidLinkSdkModule";
80
+ /**
81
+ * @deprecated Use the package's named exports. Use `sdkVersion` to read the SDK
82
+ * version. The default export exposes internal native-module methods and will
83
+ * be removed in the next major version.
84
+ */
85
+ export default NativePlaidModule;
17
86
  export * from "./ReactNativePlaidLinkSdk.types";
18
87
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAKL,sBAAsB,EACtB,sCAAsC,EACtC,gBAAgB,EAChB,uBAAuB,EACvB,iBAAiB,EACjB,oBAAoB,EAEpB,sBAAsB,EACvB,MAAM,iCAAiC,CAAC;AAyCzC,wBAAsB,sBAAsB,CAC1C,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,gBAAgB,CAAC,CAwC3B;AAED;;;GAGG;AACH,wBAAsB,sCAAsC,CAC1D,MAAM,EAAE,sCAAsC,GAC7C,OAAO,CAAC,gBAAgB,CAAC,CA6C3B;AAED,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,iBAAiB,CAAC,CAqC5B;AAED,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CAmC/B;AAED,wBAAsB,cAAc,CAAC,MAAM,EAAE;IAC3C,KAA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AAC,gBAAgB,CAAC,CA6C3B;AAED,wBAAsB,uBAAuB,CAC3C,MAAM,EAAE,uBAAuB,GAC9B,OAAO,CAAC,iBAAiB,CAAC,CAqC5B;AAED,wBAAsB,0BAA0B,CAC9C,MAAM,EAAE,sBAAsB,GAC7B,OAAO,CAAC,oBAAoB,CAAC,CAmC/B;AAED,wBAAsB,cAAc,CAAC,MAAM,EAAE;IAC3C,KAAK,EAAE,MAAM,CAAC;IACd,4BAA4B,CAAC,EAAE,OAAO,CAAC;IACvC,YAAY,CAAC,EAAE,sBAAsB,CAAC;CACvC,GAAG,OAAO,CAAC,IAAI,CAAC,CAUhB;AAED,OAAO,EACL,uBAAuB,EACvB,KAAK,4BAA4B,GAClC,MAAM,2BAA2B,CAAC;AAEnC;;;;GAIG;AACH,eAAe,iBAAiB,CAAC;AACjC,cAAc,iCAAiC,CAAC"}
package/build/index.js CHANGED
@@ -1,6 +1,66 @@
1
1
  import { Platform } from "react-native";
2
2
  import { LinkEventName, FinanceKitSyncBehavior, } from "./ReactNativePlaidLinkSdk.types";
3
3
  import NativePlaidModule from "./ReactNativePlaidLinkSdkModule";
4
+ const V13_MIGRATION_GUIDE_URL = "https://github.com/plaid/react-native-plaid-link-sdk/blob/master/V13_MIGRATION_GUIDE.md";
5
+ /**
6
+ * Builds a deprecated export for an API removed in v13.
7
+ *
8
+ * The replacement text is single-sourced: it is thrown at runtime and encoded
9
+ * into the returned type, so `tsc` prints the exact v13 replacement instead of
10
+ * suggesting the (incorrect) default import. Keeping one source for both
11
+ * prevents the runtime message and the compiler diagnostic from drifting apart.
12
+ */
13
+ function migrationDiagnostic(name, replacement) {
14
+ const removed = () => {
15
+ throw new Error(`${name} was removed in react-native-plaid-link-sdk v13. ${replacement} See ${V13_MIGRATION_GUIDE_URL}`);
16
+ };
17
+ return removed;
18
+ }
19
+ /**
20
+ * @deprecated Removed in v13. Use `await createPlaidLinkSession(config)`, then
21
+ * call `await session.open()` on the returned session.
22
+ */
23
+ export const create = migrationDiagnostic("create", "Use await createPlaidLinkSession(config), then call await session.open() on the returned session.");
24
+ /**
25
+ * @deprecated Removed in v13. Call `await session.open()` on the session
26
+ * returned by `createPlaidLinkSession(config)`.
27
+ */
28
+ export const open = migrationDiagnostic("open", "Call await session.open() on the session returned by createPlaidLinkSession(config). Move onSuccess, onExit, and onEvent callbacks to the create call.");
29
+ /**
30
+ * @deprecated Removed in v13. Use `PlaidEmbeddedSearchView`.
31
+ */
32
+ export const EmbeddedLinkView = migrationDiagnostic("EmbeddedLinkView", "Use PlaidEmbeddedSearchView.");
33
+ /**
34
+ * @deprecated Removed in v13. Use `await createPlaidLinkSession(config)`, then
35
+ * call `await session.open()` on the returned session.
36
+ */
37
+ export const openLink = migrationDiagnostic("openLink", "Use await createPlaidLinkSession(config), then call await session.open() on the returned session.");
38
+ /**
39
+ * @deprecated Removed in v13. Pass `onEvent` to the create call instead of
40
+ * subscribing separately.
41
+ */
42
+ export const usePlaidEmitter = migrationDiagnostic("usePlaidEmitter", "Pass onEvent to createPlaidLinkSession(config) instead of subscribing separately.");
43
+ /**
44
+ * @deprecated Removed in v13. Call `await session.submit(data)` on the session
45
+ * returned by `createPlaidLayerSession(config)`.
46
+ */
47
+ export const submit = migrationDiagnostic("submit", "Call await session.submit(data) on the session returned by createPlaidLayerSession(config).");
48
+ /**
49
+ * @deprecated Removed in v13. Build your own button and call
50
+ * `await createPlaidLinkSession(config)`, then `await session.open()`.
51
+ */
52
+ export const PlaidLink = migrationDiagnostic("PlaidLink", "Build your own button and call await createPlaidLinkSession(config), then await session.open().");
53
+ /**
54
+ * @deprecated Removed in v13. Each create call resets session state, so no
55
+ * teardown call is needed.
56
+ */
57
+ export const destroy = migrationDiagnostic("destroy", "Remove the call. Each create call resets session state, so no teardown is needed.");
58
+ /**
59
+ * @deprecated Removed in v13 with no replacement.
60
+ */
61
+ export const dismissLink = migrationDiagnostic("dismissLink", "Remove the call. There is no programmatic dismiss API in v13.");
62
+ /** The React Native Plaid Link SDK version reported by the native module. */
63
+ export const sdkVersion = NativePlaidModule.sdkVersion;
4
64
  let successSub = null;
5
65
  let exitSub = null;
6
66
  let eventSub = null;
@@ -133,6 +193,11 @@ export async function syncFinanceKit(config) {
133
193
  await NativePlaidModule.syncFinanceKit(config.token, config.requestAuthorizationIfNeeded ?? true, config.syncBehavior ?? FinanceKitSyncBehavior.LIVE);
134
194
  }
135
195
  export { PlaidEmbeddedSearchView, } from "./PlaidEmbeddedSearchView";
136
- export { default } from "./ReactNativePlaidLinkSdkModule";
196
+ /**
197
+ * @deprecated Use the package's named exports. Use `sdkVersion` to read the SDK
198
+ * version. The default export exposes internal native-module methods and will
199
+ * be removed in the next major version.
200
+ */
201
+ export default NativePlaidModule;
137
202
  export * from "./ReactNativePlaidLinkSdk.types";
138
203
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAGL,aAAa,EASb,sBAAsB,GACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,iBAAiB,MAAM,iCAAiC,CAAC;AAIhE,IAAI,UAAU,GAAwB,IAAI,CAAC;AAC3C,IAAI,OAAO,GAAwB,IAAI,CAAC;AACxC,IAAI,QAAQ,GAAwB,IAAI,CAAC;AACzC,IAAI,gCAAgC,GAClC,IAAI,CAAC;AAEP,MAAM,oCAAoC,GAAG,IAAI,CAAC;AAElD,SAAS,qCAAqC;IAC5C,IAAI,gCAAgC,EAAE,CAAC;QACrC,YAAY,CAAC,gCAAgC,CAAC,CAAC;QAC/C,gCAAgC,GAAG,IAAI,CAAC;IAC1C,CAAC;AACH,CAAC;AAED,SAAS,gBAAgB,CAAC,UAA2C,EAAE;IACrE,qCAAqC,EAAE,CAAC;IACxC,UAAU,EAAE,MAAM,EAAE,CAAC;IACrB,OAAO,EAAE,MAAM,EAAE,CAAC;IAClB,IAAI,CAAC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;IACrB,CAAC,CACF,CAAC;IAEF,OAAO,GAAG,iBAAiB,CAAC,WAAW,CACrC,kBAAkB,EAClB,CAAC,IAAc,EAAE,EAAE;QACjB,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;QACpB,gBAAgB,EAAE,CAAC;IACrB,CAAC,CACF,CAAC;IAEF,QAAQ,GAAG,iBAAiB,CAAC,WAAW,CACtC,mBAAmB,EACnB,CAAC,KAAgB,EAAE,EAAE;QACnB,MAAM,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;IACxB,CAAC,CACF,CAAC;IAEF,MAAM,iBAAiB,CAAC,0BAA0B,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;IAEjE,IAAI,MAAM,CAAC,MAAM,EAAE,CAAC;QAClB,MAAM,CAAC,MAAM,EAAE,CAAC;IAClB,CAAC;IAED,OAAO;QACL,KAAK,EAAE,GAAG,EAAE,CAAC,iBAAiB,CAAC,oBAAoB,EAAE;KACtD,CAAC;AACJ,CAAC;AAED,MAAM,CAAC,KAAK,UAAU,cAAc,CAAC,MAIpC;IACC,IAAI,QAAQ,CAAC,EAAE,KAAK,SAAS,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,iBAAiB,CAAC,cAAc,CACpC,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,4BAA4B,IAAI,IAAI,EAC3C,MAAM,CAAC,YAAY,IAAI,sBAAsB,CAAC,IAAI,CACnD,CAAC;AACJ,CAAC;AAED,OAAO,EACL,uBAAuB,GAExB,MAAM,2BAA2B,CAAC;AACnC,OAAO,EAAE,OAAO,EAAE,MAAM,iCAAiC,CAAC;AAC1D,cAAc,iCAAiC,CAAC","sourcesContent":["import { Platform } from \"react-native\";\n\nimport {\n LinkExit,\n LinkEvent,\n LinkEventName,\n LinkSuccess,\n LinkTokenConfiguration,\n IdentityVerificationTokenConfiguration,\n PlaidLinkSession,\n LayerTokenConfiguration,\n PlaidLayerSession,\n PlaidHeadlessSession,\n SubmissionData,\n FinanceKitSyncBehavior,\n} from \"./ReactNativePlaidLinkSdk.types\";\nimport NativePlaidModule from \"./ReactNativePlaidLinkSdkModule\";\n\ntype Subscription = ReturnType<typeof NativePlaidModule.addListener>;\n\nlet successSub: Subscription | null = null;\nlet exitSub: Subscription | null = null;\nlet eventSub: Subscription | null = null;\nlet postSuccessHandoffCleanupTimeout: ReturnType<typeof setTimeout> | null =\n null;\n\nconst POST_SUCCESS_HANDOFF_EVENT_WINDOW_MS = 1500;\n\nfunction clearPostSuccessHandoffCleanupTimeout() {\n if (postSuccessHandoffCleanupTimeout) {\n clearTimeout(postSuccessHandoffCleanupTimeout);\n postSuccessHandoffCleanupTimeout = null;\n }\n}\n\nfunction cleanupListeners(options: { keepEventListener?: boolean } = {}) {\n clearPostSuccessHandoffCleanupTimeout();\n successSub?.remove();\n exitSub?.remove();\n if (!options.keepEventListener) {\n eventSub?.remove();\n eventSub = null;\n }\n successSub = null;\n exitSub = null;\n}\n\nfunction cleanupAfterPostSuccessHandoffWindow() {\n postSuccessHandoffCleanupTimeout = setTimeout(() => {\n cleanupListeners();\n }, POST_SUCCESS_HANDOFF_EVENT_WINDOW_MS);\n (\n postSuccessHandoffCleanupTimeout as unknown as { unref?: () => void }\n ).unref?.();\n}\n\nexport async function createPlaidLinkSession(\n config: LinkTokenConfiguration,\n): Promise<PlaidLinkSession> {\n cleanupListeners();\n\n successSub = NativePlaidModule.addListener(\n \"PlaidLink.onSuccess\",\n (success: LinkSuccess) => {\n config.onSuccess(success);\n cleanupListeners({ keepEventListener: true });\n cleanupAfterPostSuccessHandoffWindow();\n },\n );\n\n exitSub = NativePlaidModule.addListener(\n \"PlaidLink.onExit\",\n (exit: LinkExit) => {\n config.onExit(exit);\n cleanupListeners();\n },\n );\n\n eventSub = NativePlaidModule.addListener(\n \"PlaidLink.onEvent\",\n (event: LinkEvent) => {\n config.onEvent(event);\n if (\n postSuccessHandoffCleanupTimeout &&\n event.eventName === LinkEventName.HANDOFF\n ) {\n cleanupListeners();\n }\n },\n );\n\n await NativePlaidModule.createPlaidLinkSession(config.token);\n\n config.onLoad?.();\n\n return {\n open: (fullScreen = false) => NativePlaidModule.openLinkSession(fullScreen),\n };\n}\n\n/**\n * Creates an Identity Verification session without waiting for an onLoad\n * callback, which Identity Verification flows do not emit.\n */\nexport async function createPlaidIdentityVerificationSession(\n config: IdentityVerificationTokenConfiguration,\n): Promise<PlaidLinkSession> {\n cleanupListeners();\n\n successSub = NativePlaidModule.addListener(\n \"PlaidLink.onSuccess\",\n (success: LinkSuccess) => {\n config.onSuccess(success);\n cleanupListeners({ keepEventListener: true });\n cleanupAfterPostSuccessHandoffWindow();\n },\n );\n\n exitSub = NativePlaidModule.addListener(\n \"PlaidLink.onExit\",\n (exit: LinkExit) => {\n config.onExit(exit);\n cleanupListeners();\n },\n );\n\n eventSub = NativePlaidModule.addListener(\n \"PlaidLink.onEvent\",\n (event: LinkEvent) => {\n config.onEvent(event);\n if (\n postSuccessHandoffCleanupTimeout &&\n event.eventName === LinkEventName.HANDOFF\n ) {\n cleanupListeners();\n }\n },\n );\n\n try {\n await NativePlaidModule.createPlaidIdentityVerificationSession(\n config.token,\n );\n } catch (error) {\n cleanupListeners();\n throw error;\n }\n\n return {\n open: (fullScreen = false) => NativePlaidModule.openLinkSession(fullScreen),\n };\n}\n\nexport async function createPlaidLayerSession(\n config: LayerTokenConfiguration,\n): Promise<PlaidLayerSession> {\n cleanupListeners();\n\n successSub = NativePlaidModule.addListener(\n \"PlaidLink.onSuccess\",\n (success: LinkSuccess) => {\n config.onSuccess(success);\n cleanupListeners();\n },\n );\n\n exitSub = NativePlaidModule.addListener(\n \"PlaidLink.onExit\",\n (exit: LinkExit) => {\n config.onExit?.(exit);\n cleanupListeners();\n },\n );\n\n eventSub = NativePlaidModule.addListener(\n \"PlaidLink.onEvent\",\n (event: LinkEvent) => {\n config.onEvent?.(event);\n },\n );\n\n await NativePlaidModule.createPlaidLayerSession(config.token);\n\n return {\n open: () => NativePlaidModule.openLayerSession(),\n submit: (data: SubmissionData) =>\n NativePlaidModule.submitLayerData(\n data.phoneNumber,\n data.dateOfBirth,\n data.params,\n ),\n };\n}\n\nexport async function createPlaidHeadlessSession(\n config: LinkTokenConfiguration,\n): Promise<PlaidHeadlessSession> {\n cleanupListeners();\n\n successSub = NativePlaidModule.addListener(\n \"PlaidLink.onSuccess\",\n (success: LinkSuccess) => {\n config.onSuccess(success);\n cleanupListeners();\n },\n );\n\n exitSub = NativePlaidModule.addListener(\n \"PlaidLink.onExit\",\n (exit: LinkExit) => {\n config.onExit(exit);\n cleanupListeners();\n },\n );\n\n eventSub = NativePlaidModule.addListener(\n \"PlaidLink.onEvent\",\n (event: LinkEvent) => {\n config.onEvent(event);\n },\n );\n\n await NativePlaidModule.createPlaidHeadlessSession(config.token);\n\n if (config.onLoad) {\n config.onLoad();\n }\n\n return {\n start: () => NativePlaidModule.startHeadlessSession(),\n };\n}\n\nexport async function syncFinanceKit(config: {\n token: string;\n requestAuthorizationIfNeeded?: boolean;\n syncBehavior?: FinanceKitSyncBehavior;\n}): Promise<void> {\n if (Platform.OS === \"android\") {\n throw new Error(\"FinanceKit is only available on iOS\");\n }\n\n await NativePlaidModule.syncFinanceKit(\n config.token,\n config.requestAuthorizationIfNeeded ?? true,\n config.syncBehavior ?? FinanceKitSyncBehavior.LIVE,\n );\n}\n\nexport {\n PlaidEmbeddedSearchView,\n type PlaidEmbeddedSearchViewProps,\n} from \"./PlaidEmbeddedSearchView\";\nexport { default } from \"./ReactNativePlaidLinkSdkModule\";\nexport * from \"./ReactNativePlaidLinkSdk.types\";\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAGL,aAAa,EASb,sBAAsB,GACvB,MAAM,iCAAiC,CAAC;AACzC,OAAO,iBAAiB,MA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S,EAAE,CAAC;QAC9B,MAAM,IAAI,KAAK,CAAC,qCAAqC,CAAC,CAAC;IACzD,CAAC;IAED,MAAM,iBAAiB,CAAC,cAAc,CACpC,MAAM,CAAC,KAAK,EACZ,MAAM,CAAC,4BAA4B,IAAI,IAAI,EAC3C,MAAM,CAAC,YAAY,IAAI,sBAAsB,CAAC,IAAI,CACnD,CAAC;AACJ,CAAC;AAED,OAAO,EACL,uBAAuB,GAExB,MAAM,2BAA2B,CAAC;AAEnC;;;;GAIG;AACH,eAAe,iBAAiB,CAAC;AACjC,cAAc,iCAAiC,CAAC","sourcesContent":["import { Platform } from \"react-native\";\n\nimport {\n LinkExit,\n LinkEvent,\n LinkEventName,\n LinkSuccess,\n LinkTokenConfiguration,\n IdentityVerificationTokenConfiguration,\n PlaidLinkSession,\n LayerTokenConfiguration,\n PlaidLayerSession,\n PlaidHeadlessSession,\n SubmissionData,\n FinanceKitSyncBehavior,\n} from \"./ReactNativePlaidLinkSdk.types\";\nimport NativePlaidModule from \"./ReactNativePlaidLinkSdkModule\";\n\nconst V13_MIGRATION_GUIDE_URL =\n \"https://github.com/plaid/react-native-plaid-link-sdk/blob/master/V13_MIGRATION_GUIDE.md\";\n\n/**\n * Builds a deprecated export for an API removed in v13.\n *\n * The replacement text is single-sourced: it is thrown at runtime and encoded\n * into the returned type, so `tsc` prints the exact v13 replacement instead of\n * suggesting the (incorrect) default import. Keeping one source for both\n * prevents the runtime message and the compiler diagnostic from drifting apart.\n */\nfunction migrationDiagnostic<Replacement extends string>(\n name: string,\n replacement: Replacement,\n): { readonly __migration_error__: `Removed in v13. ${Replacement}` } {\n const removed = () => {\n throw new Error(\n `${name} was removed in react-native-plaid-link-sdk v13. ${replacement} See ${V13_MIGRATION_GUIDE_URL}`,\n );\n };\n\n return removed as unknown as {\n readonly __migration_error__: `Removed in v13. ${Replacement}`;\n };\n}\n\n/**\n * @deprecated Removed in v13. Use `await createPlaidLinkSession(config)`, then\n * call `await session.open()` on the returned session.\n */\nexport const create = migrationDiagnostic(\n \"create\",\n \"Use await createPlaidLinkSession(config), then call await session.open() on the returned session.\",\n);\n\n/**\n * @deprecated Removed in v13. Call `await session.open()` on the session\n * returned by `createPlaidLinkSession(config)`.\n */\nexport const open = migrationDiagnostic(\n \"open\",\n \"Call await session.open() on the session returned by createPlaidLinkSession(config). Move onSuccess, onExit, and onEvent callbacks to the create call.\",\n);\n\n/**\n * @deprecated Removed in v13. Use `PlaidEmbeddedSearchView`.\n */\nexport const EmbeddedLinkView = migrationDiagnostic(\n \"EmbeddedLinkView\",\n \"Use PlaidEmbeddedSearchView.\",\n);\n\n/**\n * @deprecated Removed in v13. Use `await createPlaidLinkSession(config)`, then\n * call `await session.open()` on the returned session.\n */\nexport const openLink = migrationDiagnostic(\n \"openLink\",\n \"Use await createPlaidLinkSession(config), then call await session.open() on the returned session.\",\n);\n\n/**\n * @deprecated Removed in v13. Pass `onEvent` to the create call instead of\n * subscribing separately.\n */\nexport const usePlaidEmitter = migrationDiagnostic(\n \"usePlaidEmitter\",\n \"Pass onEvent to createPlaidLinkSession(config) instead of subscribing separately.\",\n);\n\n/**\n * @deprecated Removed in v13. Call `await session.submit(data)` on the session\n * returned by `createPlaidLayerSession(config)`.\n */\nexport const submit = migrationDiagnostic(\n \"submit\",\n \"Call await session.submit(data) on the session returned by createPlaidLayerSession(config).\",\n);\n\n/**\n * @deprecated Removed in v13. Build your own button and call\n * `await createPlaidLinkSession(config)`, then `await session.open()`.\n */\nexport const PlaidLink = migrationDiagnostic(\n \"PlaidLink\",\n \"Build your own button and call await createPlaidLinkSession(config), then await session.open().\",\n);\n\n/**\n * @deprecated Removed in v13. Each create call resets session state, so no\n * teardown call is needed.\n */\nexport const destroy = migrationDiagnostic(\n \"destroy\",\n \"Remove the call. Each create call resets session state, so no teardown is needed.\",\n);\n\n/**\n * @deprecated Removed in v13 with no replacement.\n */\nexport const dismissLink = migrationDiagnostic(\n \"dismissLink\",\n \"Remove the call. There is no programmatic dismiss API in v13.\",\n);\n\n/** The React Native Plaid Link SDK version reported by the native module. */\nexport const sdkVersion = NativePlaidModule.sdkVersion;\n\ntype Subscription = ReturnType<typeof NativePlaidModule.addListener>;\n\nlet successSub: Subscription | null = null;\nlet exitSub: Subscription | null = null;\nlet eventSub: Subscription | null = null;\nlet postSuccessHandoffCleanupTimeout: ReturnType<typeof setTimeout> | null =\n null;\n\nconst POST_SUCCESS_HANDOFF_EVENT_WINDOW_MS = 1500;\n\nfunction clearPostSuccessHandoffCleanupTimeout() {\n if (postSuccessHandoffCleanupTimeout) {\n clearTimeout(postSuccessHandoffCleanupTimeout);\n postSuccessHandoffCleanupTimeout = null;\n }\n}\n\nfunction cleanupListeners(options: { keepEventListener?: boolean } = {}) {\n clearPostSuccessHandoffCleanupTimeout();\n successSub?.remove();\n exitSub?.remove();\n if (!options.keepEventListener) {\n eventSub?.remove();\n eventSub = null;\n }\n successSub = null;\n exitSub = null;\n}\n\nfunction cleanupAfterPostSuccessHandoffWindow() {\n postSuccessHandoffCleanupTimeout = setTimeout(() => {\n cleanupListeners();\n }, POST_SUCCESS_HANDOFF_EVENT_WINDOW_MS);\n (\n postSuccessHandoffCleanupTimeout as unknown as { unref?: () => void }\n ).unref?.();\n}\n\nexport async function createPlaidLinkSession(\n config: LinkTokenConfiguration,\n): Promise<PlaidLinkSession> {\n cleanupListeners();\n\n successSub = NativePlaidModule.addListener(\n \"PlaidLink.onSuccess\",\n (success: LinkSuccess) => {\n config.onSuccess(success);\n cleanupListeners({ keepEventListener: true });\n cleanupAfterPostSuccessHandoffWindow();\n },\n );\n\n exitSub = NativePlaidModule.addListener(\n \"PlaidLink.onExit\",\n (exit: LinkExit) => {\n config.onExit(exit);\n cleanupListeners();\n },\n );\n\n eventSub = NativePlaidModule.addListener(\n \"PlaidLink.onEvent\",\n (event: LinkEvent) => {\n config.onEvent(event);\n if (\n postSuccessHandoffCleanupTimeout &&\n event.eventName === LinkEventName.HANDOFF\n ) {\n cleanupListeners();\n }\n },\n );\n\n await NativePlaidModule.createPlaidLinkSession(config.token);\n\n config.onLoad?.();\n\n return {\n open: (fullScreen = false) => NativePlaidModule.openLinkSession(fullScreen),\n };\n}\n\n/**\n * Creates an Identity Verification session without waiting for an onLoad\n * callback, which Identity Verification flows do not emit.\n */\nexport async function createPlaidIdentityVerificationSession(\n config: IdentityVerificationTokenConfiguration,\n): Promise<PlaidLinkSession> {\n cleanupListeners();\n\n successSub = NativePlaidModule.addListener(\n \"PlaidLink.onSuccess\",\n (success: LinkSuccess) => {\n config.onSuccess(success);\n cleanupListeners({ keepEventListener: true });\n cleanupAfterPostSuccessHandoffWindow();\n },\n );\n\n exitSub = NativePlaidModule.addListener(\n \"PlaidLink.onExit\",\n (exit: LinkExit) => {\n config.onExit(exit);\n cleanupListeners();\n },\n );\n\n eventSub = NativePlaidModule.addListener(\n \"PlaidLink.onEvent\",\n (event: LinkEvent) => {\n config.onEvent(event);\n if (\n postSuccessHandoffCleanupTimeout &&\n event.eventName === LinkEventName.HANDOFF\n ) {\n cleanupListeners();\n }\n },\n );\n\n try {\n await NativePlaidModule.createPlaidIdentityVerificationSession(\n config.token,\n );\n } catch (error) {\n cleanupListeners();\n throw error;\n }\n\n return {\n open: (fullScreen = false) => NativePlaidModule.openLinkSession(fullScreen),\n };\n}\n\nexport async function createPlaidLayerSession(\n config: LayerTokenConfiguration,\n): Promise<PlaidLayerSession> {\n cleanupListeners();\n\n successSub = NativePlaidModule.addListener(\n \"PlaidLink.onSuccess\",\n (success: LinkSuccess) => {\n config.onSuccess(success);\n cleanupListeners();\n },\n );\n\n exitSub = NativePlaidModule.addListener(\n \"PlaidLink.onExit\",\n (exit: LinkExit) => {\n config.onExit?.(exit);\n cleanupListeners();\n },\n );\n\n eventSub = NativePlaidModule.addListener(\n \"PlaidLink.onEvent\",\n (event: LinkEvent) => {\n config.onEvent?.(event);\n },\n );\n\n await NativePlaidModule.createPlaidLayerSession(config.token);\n\n return {\n open: () => NativePlaidModule.openLayerSession(),\n submit: (data: SubmissionData) =>\n NativePlaidModule.submitLayerData(\n data.phoneNumber,\n data.dateOfBirth,\n data.params,\n ),\n };\n}\n\nexport async function createPlaidHeadlessSession(\n config: LinkTokenConfiguration,\n): Promise<PlaidHeadlessSession> {\n cleanupListeners();\n\n successSub = NativePlaidModule.addListener(\n \"PlaidLink.onSuccess\",\n (success: LinkSuccess) => {\n config.onSuccess(success);\n cleanupListeners();\n },\n );\n\n exitSub = NativePlaidModule.addListener(\n \"PlaidLink.onExit\",\n (exit: LinkExit) => {\n config.onExit(exit);\n cleanupListeners();\n },\n );\n\n eventSub = NativePlaidModule.addListener(\n \"PlaidLink.onEvent\",\n (event: LinkEvent) => {\n config.onEvent(event);\n },\n );\n\n await NativePlaidModule.createPlaidHeadlessSession(config.token);\n\n if (config.onLoad) {\n config.onLoad();\n }\n\n return {\n start: () => NativePlaidModule.startHeadlessSession(),\n };\n}\n\nexport async function syncFinanceKit(config: {\n token: string;\n requestAuthorizationIfNeeded?: boolean;\n syncBehavior?: FinanceKitSyncBehavior;\n}): Promise<void> {\n if (Platform.OS === \"android\") {\n throw new Error(\"FinanceKit is only available on iOS\");\n }\n\n await NativePlaidModule.syncFinanceKit(\n config.token,\n config.requestAuthorizationIfNeeded ?? true,\n config.syncBehavior ?? FinanceKitSyncBehavior.LIVE,\n );\n}\n\nexport {\n PlaidEmbeddedSearchView,\n type PlaidEmbeddedSearchViewProps,\n} from \"./PlaidEmbeddedSearchView\";\n\n/**\n * @deprecated Use the package's named exports. Use `sdkVersion` to read the SDK\n * version. The default export exposes internal native-module methods and will\n * be removed in the next major version.\n */\nexport default NativePlaidModule;\nexport * from \"./ReactNativePlaidLinkSdk.types\";\n"]}
@@ -13,7 +13,7 @@
13
13
  <false/>
14
14
  <key>NSPrivacyCollectedDataTypePurposes</key>
15
15
  <array>
16
- <string>User Identifier</string>
16
+ <string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
17
17
  </array>
18
18
  </dict>
19
19
  </array>
@@ -4,6 +4,10 @@
4
4
  <dict>
5
5
  <key>files</key>
6
6
  <dict>
7
+ <key>.DS_Store</key>
8
+ <data>
9
+ /w/bPAaHfCsSMRJW4L7pa8dCki4=
10
+ </data>
7
11
  <key>Headers/LinkKit-Swift.h</key>
8
12
  <data>
9
13
  9jY8sAjFPCyHvNo5AAqiMfhBWHI=
@@ -14,7 +18,7 @@
14
18
  </data>
15
19
  <key>Info.plist</key>
16
20
  <data>
17
- jySfKF6V8L646L2ZIfm9UoZ3TrI=
21
+ VYVFd0nB3TB3QnSP3vznDeTr4IQ=
18
22
  </data>
19
23
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios.abi.json</key>
20
24
  <data>
@@ -34,7 +38,7 @@
34
38
  </data>
35
39
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios.swiftmodule</key>
36
40
  <data>
37
- oErkT7zey9FCB/EEFoQNdFGsHdQ=
41
+ w3MHsBdRA/J88sn66xo3ki6ZxDo=
38
42
  </data>
39
43
  <key>Modules/module.modulemap</key>
40
44
  <data>
@@ -42,7 +46,7 @@
42
46
  </data>
43
47
  <key>PrivacyInfo.xcprivacy</key>
44
48
  <data>
45
- ZslbibRlnYFZ3P3mPkRNxCiXM44=
49
+ pjjVumVtdN+hiy24Hab5CL1L/wM=
46
50
  </data>
47
51
  </dict>
48
52
  <key>files2</key>
@@ -93,7 +97,7 @@
93
97
  <dict>
94
98
  <key>hash2</key>
95
99
  <data>
96
- v8AaePRyKSHfIMgeJp2LcEsv8AibCAcf8cpwZ50qx+8=
100
+ uOtJBu161a15PVz2KP+CY3UO2t0yDwDrBg9tSsgxXi4=
97
101
  </data>
98
102
  </dict>
99
103
  <key>Modules/module.modulemap</key>
@@ -107,7 +111,7 @@
107
111
  <dict>
108
112
  <key>hash2</key>
109
113
  <data>
110
- miWgwnkAGFMlwDVKKnSJH9MRPNSwFFxWqC4XV9/Zi4U=
114
+ 1zSw0jafazYLr6FRuKDuoPXTVBT0TuOI/gOsu5RgxBM=
111
115
  </data>
112
116
  </dict>
113
117
  </dict>
@@ -13,7 +13,7 @@
13
13
  <false/>
14
14
  <key>NSPrivacyCollectedDataTypePurposes</key>
15
15
  <array>
16
- <string>User Identifier</string>
16
+ <string>NSPrivacyCollectedDataTypePurposeAppFunctionality</string>
17
17
  </array>
18
18
  </dict>
19
19
  </array>
@@ -4,6 +4,10 @@
4
4
  <dict>
5
5
  <key>files</key>
6
6
  <dict>
7
+ <key>.DS_Store</key>
8
+ <data>
9
+ Qt6DR3oH9vuUX8osyQuqEav1eYk=
10
+ </data>
7
11
  <key>Headers/LinkKit-Swift.h</key>
8
12
  <data>
9
13
  T0kPYIntgQ61352a4qfCVCfTcVM=
@@ -14,7 +18,7 @@
14
18
  </data>
15
19
  <key>Info.plist</key>
16
20
  <data>
17
- S5G+/kcNZuPh7lisq8q9k97alZ4=
21
+ Dx4vQDklGmd1Tp97S5fmFsoJaQs=
18
22
  </data>
19
23
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.abi.json</key>
20
24
  <data>
@@ -34,7 +38,7 @@
34
38
  </data>
35
39
  <key>Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftmodule</key>
36
40
  <data>
37
- e9KXnkp1qkZTpv4WAVvS7DZehHY=
41
+ jrOqgKxh2OPoY0/8rT1FUJxgOCc=
38
42
  </data>
39
43
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
40
44
  <data>
@@ -54,7 +58,7 @@
54
58
  </data>
55
59
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule</key>
56
60
  <data>
57
- ke3ArYJwMaA/OO73VdnzLCQU4gs=
61
+ lVZdc6VNLvDrmbcy4FWTCIMj5UI=
58
62
  </data>
59
63
  <key>Modules/module.modulemap</key>
60
64
  <data>
@@ -62,7 +66,7 @@
62
66
  </data>
63
67
  <key>PrivacyInfo.xcprivacy</key>
64
68
  <data>
65
- ZslbibRlnYFZ3P3mPkRNxCiXM44=
69
+ pjjVumVtdN+hiy24Hab5CL1L/wM=
66
70
  </data>
67
71
  </dict>
68
72
  <key>files2</key>
@@ -113,7 +117,7 @@
113
117
  <dict>
114
118
  <key>hash2</key>
115
119
  <data>
116
- +T9lGaQyVLSZoXK8rmY3EEcPafHFBa+iB2dqnhWrT/M=
120
+ TkKlm6x2WDLKO8Jjk/BtbgiLrKhve0vB2AgeBOmKZrw=
117
121
  </data>
118
122
  </dict>
119
123
  <key>Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.abi.json</key>
@@ -148,7 +152,7 @@
148
152
  <dict>
149
153
  <key>hash2</key>
150
154
  <data>
151
- YivCIJkm4STVAmLq4XDt9Cg3cKUt/mFm3zrhsJR1PeE=
155
+ c9ZI57I0djFkDnl0mIdawwi/WBnZzm/CHP8/Vp73Wog=
152
156
  </data>
153
157
  </dict>
154
158
  <key>Modules/module.modulemap</key>
@@ -162,7 +166,7 @@
162
166
  <dict>
163
167
  <key>hash2</key>
164
168
  <data>
165
- miWgwnkAGFMlwDVKKnSJH9MRPNSwFFxWqC4XV9/Zi4U=
169
+ 1zSw0jafazYLr6FRuKDuoPXTVBT0TuOI/gOsu5RgxBM=
166
170
  </data>
167
171
  </dict>
168
172
  </dict>
@@ -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.5"
18
+ @objc public static let sdkVersion: String = "13.2.0"
19
19
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-plaid-link-sdk",
3
- "version": "13.0.5",
3
+ "version": "13.2.0",
4
4
  "description": "React Native Plaid Link SDK (New Architecture & Expo)",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -15,6 +15,7 @@
15
15
  "./package.json": "./package.json"
16
16
  },
17
17
  "files": [
18
+ "AGENTS.md",
18
19
  "android/build.gradle",
19
20
  "android/src/main/",
20
21
  "build/",
@@ -38,6 +39,7 @@
38
39
  "build": "expo-module build",
39
40
  "check:linkkit": "node scripts/validate-linkkit-xcframework.js",
40
41
  "check:package": "node scripts/check-package-entrypoints.js",
42
+ "check:typescript-api": "node scripts/check-typescript-api.js",
41
43
  "clean": "expo-module clean",
42
44
  "lint": "expo-module lint",
43
45
  "pack:dry-run": "node scripts/npm-dry-run.js pack",
package/src/index.ts CHANGED
@@ -16,6 +16,114 @@ import {
16
16
  } from "./ReactNativePlaidLinkSdk.types";
17
17
  import NativePlaidModule from "./ReactNativePlaidLinkSdkModule";
18
18
 
19
+ const V13_MIGRATION_GUIDE_URL =
20
+ "https://github.com/plaid/react-native-plaid-link-sdk/blob/master/V13_MIGRATION_GUIDE.md";
21
+
22
+ /**
23
+ * Builds a deprecated export for an API removed in v13.
24
+ *
25
+ * The replacement text is single-sourced: it is thrown at runtime and encoded
26
+ * into the returned type, so `tsc` prints the exact v13 replacement instead of
27
+ * suggesting the (incorrect) default import. Keeping one source for both
28
+ * prevents the runtime message and the compiler diagnostic from drifting apart.
29
+ */
30
+ function migrationDiagnostic<Replacement extends string>(
31
+ name: string,
32
+ replacement: Replacement,
33
+ ): { readonly __migration_error__: `Removed in v13. ${Replacement}` } {
34
+ const removed = () => {
35
+ throw new Error(
36
+ `${name} was removed in react-native-plaid-link-sdk v13. ${replacement} See ${V13_MIGRATION_GUIDE_URL}`,
37
+ );
38
+ };
39
+
40
+ return removed as unknown as {
41
+ readonly __migration_error__: `Removed in v13. ${Replacement}`;
42
+ };
43
+ }
44
+
45
+ /**
46
+ * @deprecated Removed in v13. Use `await createPlaidLinkSession(config)`, then
47
+ * call `await session.open()` on the returned session.
48
+ */
49
+ export const create = migrationDiagnostic(
50
+ "create",
51
+ "Use await createPlaidLinkSession(config), then call await session.open() on the returned session.",
52
+ );
53
+
54
+ /**
55
+ * @deprecated Removed in v13. Call `await session.open()` on the session
56
+ * returned by `createPlaidLinkSession(config)`.
57
+ */
58
+ export const open = migrationDiagnostic(
59
+ "open",
60
+ "Call await session.open() on the session returned by createPlaidLinkSession(config). Move onSuccess, onExit, and onEvent callbacks to the create call.",
61
+ );
62
+
63
+ /**
64
+ * @deprecated Removed in v13. Use `PlaidEmbeddedSearchView`.
65
+ */
66
+ export const EmbeddedLinkView = migrationDiagnostic(
67
+ "EmbeddedLinkView",
68
+ "Use PlaidEmbeddedSearchView.",
69
+ );
70
+
71
+ /**
72
+ * @deprecated Removed in v13. Use `await createPlaidLinkSession(config)`, then
73
+ * call `await session.open()` on the returned session.
74
+ */
75
+ export const openLink = migrationDiagnostic(
76
+ "openLink",
77
+ "Use await createPlaidLinkSession(config), then call await session.open() on the returned session.",
78
+ );
79
+
80
+ /**
81
+ * @deprecated Removed in v13. Pass `onEvent` to the create call instead of
82
+ * subscribing separately.
83
+ */
84
+ export const usePlaidEmitter = migrationDiagnostic(
85
+ "usePlaidEmitter",
86
+ "Pass onEvent to createPlaidLinkSession(config) instead of subscribing separately.",
87
+ );
88
+
89
+ /**
90
+ * @deprecated Removed in v13. Call `await session.submit(data)` on the session
91
+ * returned by `createPlaidLayerSession(config)`.
92
+ */
93
+ export const submit = migrationDiagnostic(
94
+ "submit",
95
+ "Call await session.submit(data) on the session returned by createPlaidLayerSession(config).",
96
+ );
97
+
98
+ /**
99
+ * @deprecated Removed in v13. Build your own button and call
100
+ * `await createPlaidLinkSession(config)`, then `await session.open()`.
101
+ */
102
+ export const PlaidLink = migrationDiagnostic(
103
+ "PlaidLink",
104
+ "Build your own button and call await createPlaidLinkSession(config), then await session.open().",
105
+ );
106
+
107
+ /**
108
+ * @deprecated Removed in v13. Each create call resets session state, so no
109
+ * teardown call is needed.
110
+ */
111
+ export const destroy = migrationDiagnostic(
112
+ "destroy",
113
+ "Remove the call. Each create call resets session state, so no teardown is needed.",
114
+ );
115
+
116
+ /**
117
+ * @deprecated Removed in v13 with no replacement.
118
+ */
119
+ export const dismissLink = migrationDiagnostic(
120
+ "dismissLink",
121
+ "Remove the call. There is no programmatic dismiss API in v13.",
122
+ );
123
+
124
+ /** The React Native Plaid Link SDK version reported by the native module. */
125
+ export const sdkVersion = NativePlaidModule.sdkVersion;
126
+
19
127
  type Subscription = ReturnType<typeof NativePlaidModule.addListener>;
20
128
 
21
129
  let successSub: Subscription | null = null;
@@ -251,5 +359,11 @@ export {
251
359
  PlaidEmbeddedSearchView,
252
360
  type PlaidEmbeddedSearchViewProps,
253
361
  } from "./PlaidEmbeddedSearchView";
254
- export { default } from "./ReactNativePlaidLinkSdkModule";
362
+
363
+ /**
364
+ * @deprecated Use the package's named exports. Use `sdkVersion` to read the SDK
365
+ * version. The default export exposes internal native-module methods and will
366
+ * be removed in the next major version.
367
+ */
368
+ export default NativePlaidModule;
255
369
  export * from "./ReactNativePlaidLinkSdk.types";