react-native-plaid-link-sdk 12.0.0-beta.1 → 12.0.0-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -179,7 +179,8 @@ While these older versions are expected to continue to work without disruption,
179
179
 
180
180
  | Plaid SDK Version | Min React Native Version | Android SDK | Android Min Version | Android Compile Version| iOS SDK | iOS Min Version | Status |
181
181
  |-------------------|--------------------------|-------------|---------------------|------------------------|---------|-----------------|-------------------------------|
182
- | 12.0.0-beta.1 | * | [4.4.0+] | 21 | 34 | >=6.0.0 | 14.0 | Active, supports Xcode 15.3.0 |
182
+ | 12.0.0-beta.2 | * | [4.4.0+] | 21 | 34 | >=6.0.0 | 14.0 | Active, supports Xcode 15.3.0 |
183
+ | 12.0.0-beta.1 | * | [4.4.0+] | 21 | 34 | >=6.0.0 | 14.0 | **Deprecated** |
183
184
  | 11.10.0 | * | [4.4.0+] | 21 | 34 | >=5.5.0 | 14.0 | Active, supports Xcode 15.0.1 |
184
185
  | 11.9.0 | * | [4.3.1+] | 21 | 34 | >=5.5.0 | 14.0 | Active, supports Xcode 15.0.1 |
185
186
  | 11.8.2 | * | [4.3.1+] | 21 | 34 | >=5.4.2 | 14.0 | Active, supports Xcode 15.0.1 |
@@ -1,5 +1,5 @@
1
1
  import React from 'react';
2
- import { LinkEventListener, LinkOpenProps, LinkTokenConfiguration, PlaidLinkComponentProps, PlaidLinkProps } from './Types';
2
+ import { LinkEventListener, LinkOpenProps, LinkTokenConfiguration, PlaidLinkComponentProps, PlaidLinkProps, FinanceKitError } from './Types';
3
3
  /**
4
4
  * A hook that registers a listener on the Plaid emitter for the 'onEvent' type.
5
5
  * The listener is cleaned up when this view is unmounted
@@ -10,6 +10,21 @@ export declare const usePlaidEmitter: (linkEventListener: LinkEventListener) =>
10
10
  export declare const create: (props: LinkTokenConfiguration) => void;
11
11
  export declare const open: (props: LinkOpenProps) => Promise<void>;
12
12
  export declare const dismissLink: () => void;
13
+ /**
14
+ * Function to sync the user's transactions from their Apple card.
15
+ *
16
+ * @param {string} token - The `LinkToken` your server retrieved from the /link/token/create endpoint from the Plaid API.
17
+ * This token must be associated with an accessToken.
18
+ * @param {boolean} requestAuthorizationIfNeeded - Indicates if the user should be prompted to authorize the sync if
19
+ * they have not already done so.
20
+ * @param {function} completion - A callback function that is called when the sync has completed.
21
+ *
22
+ * @warning This method only works on iOS >= 17.4.
23
+ * @warning This method is not supported on Android or MacCatalyst.
24
+ * @warning This method can only be used once the user has granted access to their Apple card via a standard Link Session.
25
+ * @warning This method requires that your app has been granted FinanceKit access from Apple.
26
+ */
27
+ export declare const syncFinanceKit: (token: string, requestAuthorizationIfNeeded: boolean, completion: (error?: FinanceKitError) => void) => void;
13
28
  /**
14
29
  * @deprecated This component is deprecated. Create your own component and use the create & open methods.
15
30
  */
package/dist/PlaidLink.js CHANGED
@@ -10,7 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
10
10
  var _a;
11
11
  import React, { useEffect } from 'react';
12
12
  import { NativeEventEmitter, Platform, TouchableOpacity } from 'react-native';
13
- import { LinkIOSPresentationStyle, LinkLogLevel, } from './Types';
13
+ import { LinkIOSPresentationStyle, LinkLogLevel, FinanceKitErrorType, } from './Types';
14
14
  import RNLinksdkAndroid from './fabric/NativePlaidLinkModuleAndroid';
15
15
  import RNLinksdkiOS from './fabric/NativePlaidLinkModuleiOS';
16
16
  const RNLinksdk = (_a = (Platform.OS === 'android' ? RNLinksdkAndroid : RNLinksdkiOS)) !== null && _a !== void 0 ? _a : undefined;
@@ -82,6 +82,38 @@ export const dismissLink = () => {
82
82
  RNLinksdkiOS === null || RNLinksdkiOS === void 0 ? void 0 : RNLinksdkiOS.dismiss();
83
83
  }
84
84
  };
85
+ /**
86
+ * Function to sync the user's transactions from their Apple card.
87
+ *
88
+ * @param {string} token - The `LinkToken` your server retrieved from the /link/token/create endpoint from the Plaid API.
89
+ * This token must be associated with an accessToken.
90
+ * @param {boolean} requestAuthorizationIfNeeded - Indicates if the user should be prompted to authorize the sync if
91
+ * they have not already done so.
92
+ * @param {function} completion - A callback function that is called when the sync has completed.
93
+ *
94
+ * @warning This method only works on iOS >= 17.4.
95
+ * @warning This method is not supported on Android or MacCatalyst.
96
+ * @warning This method can only be used once the user has granted access to their Apple card via a standard Link Session.
97
+ * @warning This method requires that your app has been granted FinanceKit access from Apple.
98
+ */
99
+ export const syncFinanceKit = (token, requestAuthorizationIfNeeded, completion) => {
100
+ if (Platform.OS === 'android') {
101
+ completion({
102
+ type: FinanceKitErrorType.Unknown,
103
+ message: "FinanceKit is unavailable on Android!",
104
+ });
105
+ }
106
+ else {
107
+ RNLinksdkiOS === null || RNLinksdkiOS === void 0 ? void 0 : RNLinksdkiOS.syncFinanceKit(token, requestAuthorizationIfNeeded, () => {
108
+ completion();
109
+ }, (error) => {
110
+ completion({
111
+ type: error.type,
112
+ message: error.message,
113
+ });
114
+ });
115
+ }
116
+ };
85
117
  /**
86
118
  * @deprecated This component is deprecated. Create your own component and use the create & open methods.
87
119
  */
package/dist/Types.d.ts CHANGED
@@ -493,4 +493,32 @@ export interface LinkOpenProps {
493
493
  export type PlaidLinkComponentProps = (PlaidLinkProps & {
494
494
  children: React.ReactNode;
495
495
  });
496
+ export declare enum FinanceKitErrorType {
497
+ InvalidToken = 0,
498
+ PermissionError = 1,
499
+ LinkApiError = 2,
500
+ PermissionAccessError = 3,
501
+ Unknown = 4
502
+ }
503
+ interface InvalidTokenError {
504
+ type: FinanceKitErrorType.InvalidToken;
505
+ message: string;
506
+ }
507
+ interface PermissionError {
508
+ type: FinanceKitErrorType.PermissionError;
509
+ message: string;
510
+ }
511
+ interface LinkApiError {
512
+ type: FinanceKitErrorType.LinkApiError;
513
+ message: string;
514
+ }
515
+ interface PermissionAccessError {
516
+ type: FinanceKitErrorType.PermissionAccessError;
517
+ message: string;
518
+ }
519
+ interface UnknownError {
520
+ type: FinanceKitErrorType.Unknown;
521
+ message: string;
522
+ }
523
+ export type FinanceKitError = InvalidTokenError | PermissionError | LinkApiError | PermissionAccessError | UnknownError;
496
524
  export {};
package/dist/Types.js CHANGED
@@ -430,3 +430,11 @@ export var LinkIOSPresentationStyle;
430
430
  LinkIOSPresentationStyle["FULL_SCREEN"] = "FULL_SCREEN";
431
431
  LinkIOSPresentationStyle["MODAL"] = "MODAL";
432
432
  })(LinkIOSPresentationStyle || (LinkIOSPresentationStyle = {}));
433
+ export var FinanceKitErrorType;
434
+ (function (FinanceKitErrorType) {
435
+ FinanceKitErrorType[FinanceKitErrorType["InvalidToken"] = 0] = "InvalidToken";
436
+ FinanceKitErrorType[FinanceKitErrorType["PermissionError"] = 1] = "PermissionError";
437
+ FinanceKitErrorType[FinanceKitErrorType["LinkApiError"] = 2] = "LinkApiError";
438
+ FinanceKitErrorType[FinanceKitErrorType["PermissionAccessError"] = 3] = "PermissionAccessError";
439
+ FinanceKitErrorType[FinanceKitErrorType["Unknown"] = 4] = "Unknown";
440
+ })(FinanceKitErrorType || (FinanceKitErrorType = {}));
@@ -1,13 +1,14 @@
1
1
  import { TurboModule } from 'react-native';
2
2
  import { Int32 } from 'react-native/Libraries/Types/CodegenTypes';
3
3
  import { UnsafeObject } from './fabricUtils';
4
- import { LinkSuccess, LinkExit, LinkError } from '../Types';
4
+ import { LinkSuccess, LinkExit, LinkError, FinanceKitError } from '../Types';
5
5
  export interface Spec extends TurboModule {
6
6
  create(token: string, noLoadingState: boolean): void;
7
7
  open(fullScreen: boolean, onSuccess: (result: UnsafeObject<LinkSuccess>) => void, onExit: (error: UnsafeObject<LinkError>, result: UnsafeObject<LinkExit>) => void): void;
8
8
  dismiss(): void;
9
9
  addListener(eventName: string): void;
10
10
  removeListeners(count: Int32): void;
11
+ syncFinanceKit(token: string, requestAuthorizationIfNeeded: boolean, onSuccess: (success: void) => void, onError: (error: FinanceKitError) => void): void;
11
12
  }
12
13
  declare const _default: Spec | null;
13
14
  export default _default;
package/dist/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
- import { openLink, create, open, dismissLink, usePlaidEmitter, PlaidLink } from './PlaidLink';
1
+ import { openLink, PlaidLink, create, open, dismissLink, usePlaidEmitter, syncFinanceKit } from './PlaidLink';
2
2
  export * from './Types';
3
3
  export default PlaidLink;
4
- export { PlaidLink, openLink, create, open, dismissLink, usePlaidEmitter, };
4
+ export { PlaidLink, openLink, create, open, dismissLink, usePlaidEmitter, syncFinanceKit };
5
5
  export { EmbeddedLinkView } from './EmbeddedLink/EmbeddedLinkView';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
- import { openLink, create, open, dismissLink, usePlaidEmitter, PlaidLink, } from './PlaidLink';
1
+ import { openLink, PlaidLink, create, open, dismissLink, usePlaidEmitter, syncFinanceKit, } from './PlaidLink';
2
2
  export * from './Types';
3
3
  export default PlaidLink;
4
- export { PlaidLink, openLink, create, open, dismissLink, usePlaidEmitter, };
4
+ export { PlaidLink, openLink, create, open, dismissLink, usePlaidEmitter, syncFinanceKit };
5
5
  // Components
6
6
  export { EmbeddedLinkView } from './EmbeddedLink/EmbeddedLinkView';
package/ios/RNLinksdk.mm CHANGED
@@ -181,6 +181,28 @@ RCT_EXPORT_METHOD(dismiss) {
181
181
  self.presentingViewController = nil;
182
182
  }
183
183
 
184
+ RCT_EXPORT_METHOD(syncFinanceKit:(NSString *)token
185
+ requestAuthorizationIfNeeded:(BOOL)requestAuthorizationIfNeeded
186
+ onSuccess:(RCTResponseSenderBlock)onSuccess
187
+ onError:(RCTResponseSenderBlock)onError) {
188
+
189
+ [RNPlaidHelper syncFinanceKit:token
190
+ requestAuthorizationIfNeeded:requestAuthorizationIfNeeded
191
+ onSuccess:^{
192
+ onSuccess(@[]);
193
+ }
194
+ onError:^(NSError *error) {
195
+
196
+ NSDictionary *financeKitError = @{
197
+ @"type": [NSNumber numberWithInteger: error.code],
198
+ @"message": error.localizedDescription
199
+ };
200
+
201
+ onError(@[financeKitError]);
202
+ }
203
+ ];
204
+ }
205
+
184
206
  #pragma mark - Bridging
185
207
 
186
208
  + (PLKEnvironment)environmentFromString:(NSString *)string {
@@ -618,6 +640,8 @@ RCT_EXPORT_METHOD(dismiss) {
618
640
  return @"SELECT_SAVED_INSTITUTION";
619
641
  case PLKViewNameValueSelectSavedAccount:
620
642
  return @"SELECT_SAVED_ACCOUNT";
643
+ case PLKViewNameValueProfileDataReview:
644
+ return @"PROFILE_DATA_REVIEW";
621
645
  }
622
646
 
623
647
  return @"unknown";
@@ -4,4 +4,8 @@
4
4
 
5
5
  + (id <PLKHandler> _Nullable)createWithLinkTokenConfiguration:(PLKLinkTokenConfiguration * _Nonnull)linkTokenConfiguration error:(NSError * _Nullable * _Nullable)error;
6
6
 
7
+ + (void) syncFinanceKit:(NSString *_Nonnull)token
8
+ requestAuthorizationIfNeeded:(BOOL)requestAuthorizationIfNeeded
9
+ onSuccess:(void (^_Nonnull)(void))onSuccess
10
+ onError:(void (^_Nonnull)(NSError * _Nonnull error))onError;
7
11
  @end
@@ -7,4 +7,15 @@
7
7
  return [PLKPlaid createWithLinkTokenConfiguration:linkTokenConfiguration error:error];
8
8
  }
9
9
 
10
+ + (void)syncFinanceKit:(NSString *)token requestAuthorizationIfNeeded:(BOOL)requestAuthorizationIfNeeded onSuccess:(void (^)(void))onSuccess onError:(void (^)(NSError * _Nonnull))onError {
11
+ if (@available(iOS 17.4, *)) {
12
+ [PLKPlaid syncFinanceKitWithToken:token requestAuthorizationIfNeeded:requestAuthorizationIfNeeded onSuccess:onSuccess onError:onError];
13
+ } else {
14
+ NSError *error = [NSError errorWithDomain:@"com.plaid.financeKit"
15
+ code:1001
16
+ userInfo:@{ NSLocalizedDescriptionKey: @"FinanceKit Requires iOS >= 17.4" }];
17
+ onError(error);
18
+ }
19
+ }
20
+
10
21
  @end
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-native-plaid-link-sdk",
3
- "version": "12.0.0-beta.1",
3
+ "version": "12.0.0-beta.2",
4
4
  "description": "React Native Plaid Link SDK",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -28,5 +28,5 @@ Pod::Spec.new do |s|
28
28
  end
29
29
 
30
30
  s.dependency 'React-Core'
31
- s.dependency 'Plaid', '~> 6.0.0-beta1'
31
+ s.dependency 'Plaid', '~> 6.0.0-beta3'
32
32
  end
package/src/PlaidLink.tsx CHANGED
@@ -11,6 +11,8 @@ import {
11
11
  LinkTokenConfiguration,
12
12
  PlaidLinkComponentProps,
13
13
  PlaidLinkProps,
14
+ FinanceKitErrorType,
15
+ FinanceKitError,
14
16
  } from './Types';
15
17
  import RNLinksdkAndroid from './fabric/NativePlaidLinkModuleAndroid';
16
18
  import RNLinksdkiOS from './fabric/NativePlaidLinkModuleiOS';
@@ -100,6 +102,47 @@ export const dismissLink = () => {
100
102
  }
101
103
  };
102
104
 
105
+ /**
106
+ * Function to sync the user's transactions from their Apple card.
107
+ *
108
+ * @param {string} token - The `LinkToken` your server retrieved from the /link/token/create endpoint from the Plaid API.
109
+ * This token must be associated with an accessToken.
110
+ * @param {boolean} requestAuthorizationIfNeeded - Indicates if the user should be prompted to authorize the sync if
111
+ * they have not already done so.
112
+ * @param {function} completion - A callback function that is called when the sync has completed.
113
+ *
114
+ * @warning This method only works on iOS >= 17.4.
115
+ * @warning This method is not supported on Android or MacCatalyst.
116
+ * @warning This method can only be used once the user has granted access to their Apple card via a standard Link Session.
117
+ * @warning This method requires that your app has been granted FinanceKit access from Apple.
118
+ */
119
+ export const syncFinanceKit = (
120
+ token: string,
121
+ requestAuthorizationIfNeeded: boolean,
122
+ completion: (error?: FinanceKitError) => void
123
+ ): void => {
124
+ if (Platform.OS === 'android') {
125
+ completion({
126
+ type: FinanceKitErrorType.Unknown,
127
+ message: "FinanceKit is unavailable on Android!",
128
+ })
129
+ } else {
130
+ RNLinksdkiOS?.syncFinanceKit(
131
+ token,
132
+ requestAuthorizationIfNeeded,
133
+ () => {
134
+ completion()
135
+ },
136
+ (error: FinanceKitError) => {
137
+ completion({
138
+ type: error.type,
139
+ message: error.message,
140
+ })
141
+ }
142
+ )
143
+ }
144
+ };
145
+
103
146
  /**
104
147
  * @deprecated This component is deprecated. Create your own component and use the create & open methods.
105
148
  */
package/src/Types.ts CHANGED
@@ -557,3 +557,43 @@ export interface LinkOpenProps {
557
557
  export type PlaidLinkComponentProps = (PlaidLinkProps & {
558
558
  children: React.ReactNode
559
559
  });
560
+
561
+ export enum FinanceKitErrorType {
562
+ InvalidToken = 0,
563
+ PermissionError = 1,
564
+ LinkApiError = 2,
565
+ PermissionAccessError = 3,
566
+ Unknown = 4
567
+ }
568
+
569
+ interface InvalidTokenError {
570
+ type: FinanceKitErrorType.InvalidToken;
571
+ message: string;
572
+ }
573
+
574
+ interface PermissionError {
575
+ type: FinanceKitErrorType.PermissionError;
576
+ message: string;
577
+ }
578
+
579
+ interface LinkApiError {
580
+ type: FinanceKitErrorType.LinkApiError;
581
+ message: string;
582
+ }
583
+
584
+ interface PermissionAccessError {
585
+ type: FinanceKitErrorType.PermissionAccessError;
586
+ message: string;
587
+ }
588
+
589
+ interface UnknownError {
590
+ type: FinanceKitErrorType.Unknown;
591
+ message: string;
592
+ }
593
+
594
+ export type FinanceKitError =
595
+ | InvalidTokenError
596
+ | PermissionError
597
+ | LinkApiError
598
+ | PermissionAccessError
599
+ | UnknownError;
@@ -3,7 +3,7 @@
3
3
  import {TurboModuleRegistry, TurboModule} from 'react-native';
4
4
  import {Int32} from 'react-native/Libraries/Types/CodegenTypes';
5
5
  import {UnsafeObject} from './fabricUtils';
6
- import {LinkSuccess, LinkExit, LinkError} from '../Types';
6
+ import {LinkSuccess, LinkExit, LinkError, FinanceKitError} from '../Types';
7
7
 
8
8
  export interface Spec extends TurboModule {
9
9
  create(token: string, noLoadingState: boolean): void;
@@ -16,6 +16,12 @@ export interface Spec extends TurboModule {
16
16
  // those two are here for event emitter methods
17
17
  addListener(eventName: string): void;
18
18
  removeListeners(count: Int32): void;
19
+ syncFinanceKit(
20
+ token: string,
21
+ requestAuthorizationIfNeeded: boolean,
22
+ onSuccess: (success: void) => void,
23
+ onError: (error: FinanceKitError) => void
24
+ ): void
19
25
  }
20
26
 
21
27
  export default TurboModuleRegistry.get<Spec>('RNLinksdk');
package/src/index.ts CHANGED
@@ -1,10 +1,11 @@
1
1
  import {
2
2
  openLink,
3
+ PlaidLink,
3
4
  create,
4
5
  open,
5
6
  dismissLink,
6
7
  usePlaidEmitter,
7
- PlaidLink,
8
+ syncFinanceKit,
8
9
  } from './PlaidLink';
9
10
 
10
11
  export * from './Types';
@@ -18,6 +19,7 @@ export {
18
19
  open,
19
20
  dismissLink,
20
21
  usePlaidEmitter,
22
+ syncFinanceKit
21
23
  };
22
24
 
23
25
  // Components