react-native-plaid-link-sdk 12.8.2 → 13.0.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 (183) hide show
  1. package/.eslintrc.js +5 -0
  2. package/.gitattributes +3 -0
  3. package/.nvmrc +1 -0
  4. package/CHANGELOG.md +1458 -0
  5. package/README.md +17 -277
  6. package/V13_MIGRATION_GUIDE.md +470 -0
  7. package/android/build.gradle +30 -98
  8. package/android/src/main/AndroidManifest.xml +1 -8
  9. package/android/src/main/java/expo/modules/plaidlinksdk/PlaidEmbeddedResultDispatcher.kt +19 -0
  10. package/android/src/main/java/expo/modules/plaidlinksdk/PlaidResultMappers.kt +217 -0
  11. package/android/src/main/java/expo/modules/plaidlinksdk/RNPlaidLinkSdkVersion.kt +5 -0
  12. package/android/src/main/java/expo/modules/plaidlinksdk/ReactNativePlaidLinkSdkModule.kt +183 -0
  13. package/android/src/main/java/expo/modules/plaidlinksdk/ReactNativePlaidLinkSdkView.kt +69 -0
  14. package/build/PlaidEmbeddedSearchView.d.ts +12 -0
  15. package/build/PlaidEmbeddedSearchView.d.ts.map +1 -0
  16. package/build/PlaidEmbeddedSearchView.js +8 -0
  17. package/build/PlaidEmbeddedSearchView.js.map +1 -0
  18. package/{dist/src/Types.d.ts → build/ReactNativePlaidLinkSdk.types.d.ts} +78 -47
  19. package/build/ReactNativePlaidLinkSdk.types.d.ts.map +1 -0
  20. package/{dist/build → build}/ReactNativePlaidLinkSdk.types.js +82 -71
  21. package/build/ReactNativePlaidLinkSdk.types.js.map +1 -0
  22. package/build/ReactNativePlaidLinkSdkModule.d.ts +16 -0
  23. package/build/ReactNativePlaidLinkSdkModule.d.ts.map +1 -0
  24. package/{dist/build → build}/ReactNativePlaidLinkSdkModule.js +1 -1
  25. package/build/ReactNativePlaidLinkSdkModule.js.map +1 -0
  26. package/build/index.d.ts +13 -0
  27. package/build/index.d.ts.map +1 -0
  28. package/build/index.js +134 -0
  29. package/build/index.js.map +1 -0
  30. package/eslint.config.js +3 -0
  31. package/expo-module.config.json +9 -0
  32. package/ios/Frameworks/LinkKit.xcframework/Info.plist +61 -0
  33. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Headers/LinkKit-Swift.h +327 -0
  34. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Headers/LinkKit.h +22 -0
  35. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Info.plist +0 -0
  36. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/LinkKit +0 -0
  37. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios.abi.json +53681 -0
  38. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios.private.swiftinterface +756 -0
  39. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios.swiftdoc +0 -0
  40. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios.swiftinterface +756 -0
  41. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios.swiftmodule +0 -0
  42. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/Modules/module.modulemap +11 -0
  43. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/PrivacyInfo.xcprivacy +32 -0
  44. package/ios/Frameworks/LinkKit.xcframework/ios-arm64/LinkKit.framework/_CodeSignature/CodeResources +205 -0
  45. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-maccatalyst/LinkKit.framework/Versions/A/Headers/LinkKit-Swift.h +650 -0
  46. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-maccatalyst/LinkKit.framework/Versions/A/Headers/LinkKit.h +22 -0
  47. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-maccatalyst/LinkKit.framework/Versions/A/LinkKit +0 -0
  48. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-maccatalyst/LinkKit.framework/Versions/A/Modules/LinkKit.swiftmodule/arm64-apple-ios-macabi.abi.json +52299 -0
  49. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-maccatalyst/LinkKit.framework/Versions/A/Modules/LinkKit.swiftmodule/arm64-apple-ios-macabi.private.swiftinterface +751 -0
  50. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-maccatalyst/LinkKit.framework/Versions/A/Modules/LinkKit.swiftmodule/arm64-apple-ios-macabi.swiftdoc +0 -0
  51. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-maccatalyst/LinkKit.framework/Versions/A/Modules/LinkKit.swiftmodule/arm64-apple-ios-macabi.swiftinterface +751 -0
  52. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-maccatalyst/LinkKit.framework/Versions/A/Modules/LinkKit.swiftmodule/arm64-apple-ios-macabi.swiftmodule +0 -0
  53. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-maccatalyst/LinkKit.framework/Versions/A/Modules/LinkKit.swiftmodule/x86_64-apple-ios-macabi.abi.json +52299 -0
  54. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-maccatalyst/LinkKit.framework/Versions/A/Modules/LinkKit.swiftmodule/x86_64-apple-ios-macabi.private.swiftinterface +751 -0
  55. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-maccatalyst/LinkKit.framework/Versions/A/Modules/LinkKit.swiftmodule/x86_64-apple-ios-macabi.swiftdoc +0 -0
  56. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-maccatalyst/LinkKit.framework/Versions/A/Modules/LinkKit.swiftmodule/x86_64-apple-ios-macabi.swiftinterface +751 -0
  57. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-maccatalyst/LinkKit.framework/Versions/A/Modules/LinkKit.swiftmodule/x86_64-apple-ios-macabi.swiftmodule +0 -0
  58. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-maccatalyst/LinkKit.framework/Versions/A/Modules/module.modulemap +11 -0
  59. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-maccatalyst/LinkKit.framework/Versions/A/Resources/Info.plist +59 -0
  60. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-maccatalyst/LinkKit.framework/Versions/A/Resources/PrivacyInfo.xcprivacy +32 -0
  61. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-maccatalyst/LinkKit.framework/Versions/A/_CodeSignature/CodeResources +230 -0
  62. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Headers/LinkKit-Swift.h +650 -0
  63. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Headers/LinkKit.h +22 -0
  64. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Info.plist +0 -0
  65. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/LinkKit +0 -0
  66. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.abi.json +53681 -0
  67. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.private.swiftinterface +756 -0
  68. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftdoc +0 -0
  69. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftinterface +756 -0
  70. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/arm64-apple-ios-simulator.swiftmodule +0 -0
  71. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.abi.json +53681 -0
  72. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.private.swiftinterface +756 -0
  73. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftdoc +0 -0
  74. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftinterface +756 -0
  75. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/LinkKit.swiftmodule/x86_64-apple-ios-simulator.swiftmodule +0 -0
  76. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/Modules/module.modulemap +11 -0
  77. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/PrivacyInfo.xcprivacy +32 -0
  78. package/ios/Frameworks/LinkKit.xcframework/ios-arm64_x86_64-simulator/LinkKit.framework/_CodeSignature/CodeResources +256 -0
  79. package/ios/ReactNativePlaidLinkSdk.podspec +31 -0
  80. package/ios/src/PlaidEmbeddedSearchView.swift +101 -0
  81. package/ios/src/RNPlaidLinkSdkVersion.swift +19 -0
  82. package/ios/src/ReactNativePlaidLinkSdkModule.swift +555 -0
  83. package/jest.config.js +21 -0
  84. package/jest.setup.js +7 -0
  85. package/package.json +32 -72
  86. package/scripts/check-package-entrypoints.js +146 -0
  87. package/scripts/extract-rn-enums.js +49 -0
  88. package/src/PlaidEmbeddedSearchView.tsx +35 -0
  89. package/src/ReactNativePlaidLinkSdk.types.ts +894 -0
  90. package/src/ReactNativePlaidLinkSdkModule.ts +31 -0
  91. package/src/index.ts +207 -22
  92. package/tsconfig.json +9 -0
  93. package/android/gradle/wrapper/gradle-wrapper.jar +0 -0
  94. package/android/gradle/wrapper/gradle-wrapper.properties +0 -6
  95. package/android/gradle.properties +0 -31
  96. package/android/gradlew +0 -174
  97. package/android/gradlew.bat +0 -89
  98. package/android/src/main/java/com/plaid/ActivityResultHandler.java +0 -7
  99. package/android/src/main/java/com/plaid/ActivityResultManager.java +0 -15
  100. package/android/src/main/java/com/plaid/GlobalFunctions.kt +0 -42
  101. package/android/src/main/java/com/plaid/PLKEmbeddedView.kt +0 -161
  102. package/android/src/main/java/com/plaid/PLKEmbeddedViewManager.kt +0 -50
  103. package/android/src/main/java/com/plaid/PlaidModule.kt +0 -291
  104. package/android/src/main/java/com/plaid/PlaidPackage.java +0 -117
  105. package/android/src/main/java/com/plaid/gson/PlaidJsonConverter.kt +0 -94
  106. package/android/src/main/java/com/plaid/gson/RNAccountAdapter.kt +0 -48
  107. package/android/src/main/java/com/plaid/gson/RNEventMetadataAdapter.kt +0 -49
  108. package/android/src/main/java/com/plaid/gson/RNLinkInstitutionAdapter.kt +0 -34
  109. package/android/src/main/res/layout/plk_embedded_view.xml +0 -5
  110. package/android/src/paper/java/com/facebook/react/viewmanagers/PLKEmbeddedViewManagerDelegate.java +0 -35
  111. package/android/src/paper/java/com/facebook/react/viewmanagers/PLKEmbeddedViewManagerInterface.java +0 -18
  112. package/android/src/paper/java/com/plaid/NativePlaidLinkModuleAndroidSpec.java +0 -64
  113. package/android/src/paper/java/com/plaid/NativePlaidLinkModuleiOSSpec.java +0 -59
  114. package/dist/build/EmbeddedLink/EmbeddedLinkView.d.ts +0 -2
  115. package/dist/build/EmbeddedLink/EmbeddedLinkView.js +0 -56
  116. package/dist/build/EmbeddedLink/EmbeddedLinkView.web.d.ts +0 -1
  117. package/dist/build/EmbeddedLink/EmbeddedLinkView.web.js +0 -2
  118. package/dist/build/EmbeddedLink/NativeEmbeddedLinkView.d.ts +0 -2
  119. package/dist/build/EmbeddedLink/NativeEmbeddedLinkView.js +0 -3
  120. package/dist/build/PlaidEmbeddedSearchView.d.ts +0 -2
  121. package/dist/build/PlaidEmbeddedSearchView.js +0 -25
  122. package/dist/build/PlaidLink.d.ts +0 -7
  123. package/dist/build/PlaidLink.js +0 -137
  124. package/dist/build/ReactNativePlaidLinkSdk.types.d.ts +0 -108
  125. package/dist/build/ReactNativePlaidLinkSdkModule.d.ts +0 -2
  126. package/dist/build/ReactNativePlaidLinkSdkView.d.ts +0 -2
  127. package/dist/build/ReactNativePlaidLinkSdkView.js +0 -7
  128. package/dist/build/Types.d.ts +0 -108
  129. package/dist/build/Types.js +0 -462
  130. package/dist/build/fabric/EmbeddedLinkViewNativeComponent.d.ts +0 -2
  131. package/dist/build/fabric/EmbeddedLinkViewNativeComponent.js +0 -3
  132. package/dist/build/fabric/NativePlaidLinkModuleAndroid.d.ts +0 -2
  133. package/dist/build/fabric/NativePlaidLinkModuleAndroid.js +0 -5
  134. package/dist/build/fabric/NativePlaidLinkModuleiOS.d.ts +0 -2
  135. package/dist/build/fabric/NativePlaidLinkModuleiOS.js +0 -5
  136. package/dist/build/fabric/fabricUtils.d.ts +0 -1
  137. package/dist/build/fabric/fabricUtils.js +0 -2
  138. package/dist/build/index.d.ts +0 -14
  139. package/dist/build/index.js +0 -154
  140. package/dist/src/EmbeddedLink/EmbeddedLinkView.d.ts +0 -13
  141. package/dist/src/EmbeddedLink/EmbeddedLinkView.js +0 -55
  142. package/dist/src/EmbeddedLink/EmbeddedLinkView.web.d.ts +0 -1
  143. package/dist/src/EmbeddedLink/EmbeddedLinkView.web.js +0 -1
  144. package/dist/src/EmbeddedLink/NativeEmbeddedLinkView.d.ts +0 -2
  145. package/dist/src/EmbeddedLink/NativeEmbeddedLinkView.js +0 -2
  146. package/dist/src/PlaidLink.d.ts +0 -34
  147. package/dist/src/PlaidLink.js +0 -136
  148. package/dist/src/Types.js +0 -463
  149. package/dist/src/__tests__/Types.tests.d.ts +0 -1
  150. package/dist/src/__tests__/Types.tests.js +0 -14
  151. package/dist/src/fabric/EmbeddedLinkViewNativeComponent.d.ts +0 -15
  152. package/dist/src/fabric/EmbeddedLinkViewNativeComponent.js +0 -2
  153. package/dist/src/fabric/NativePlaidLinkModuleAndroid.d.ts +0 -15
  154. package/dist/src/fabric/NativePlaidLinkModuleAndroid.js +0 -4
  155. package/dist/src/fabric/NativePlaidLinkModuleiOS.d.ts +0 -15
  156. package/dist/src/fabric/NativePlaidLinkModuleiOS.js +0 -4
  157. package/dist/src/fabric/fabricUtils.d.ts +0 -1
  158. package/dist/src/fabric/fabricUtils.js +0 -1
  159. package/dist/src/index.d.ts +0 -4
  160. package/dist/src/index.js +0 -5
  161. package/ios/PLKEmbeddedView.m +0 -7
  162. package/ios/PLKEmbeddedView.swift +0 -116
  163. package/ios/PLKEmbeddedViewComponentView.h +0 -28
  164. package/ios/PLKEmbeddedViewComponentView.mm +0 -91
  165. package/ios/PLKEmbeddedViewManager.swift +0 -14
  166. package/ios/PLKFabricHelpers.h +0 -116
  167. package/ios/RNLinksdk-Bridging-Header.h +0 -8
  168. package/ios/RNLinksdk.h +0 -19
  169. package/ios/RNLinksdk.mm +0 -732
  170. package/ios/RNPlaidHelper.h +0 -15
  171. package/ios/RNPlaidHelper.m +0 -33
  172. package/ios/react_native_plaid_link_sdk.h +0 -2
  173. package/react-native-plaid-link-sdk.podspec +0 -40
  174. package/src/EmbeddedLink/EmbeddedLinkView.tsx +0 -95
  175. package/src/EmbeddedLink/EmbeddedLinkView.web.tsx +0 -5
  176. package/src/EmbeddedLink/NativeEmbeddedLinkView.tsx +0 -3
  177. package/src/PlaidLink.tsx +0 -167
  178. package/src/Types.ts +0 -634
  179. package/src/__tests__/Types.tests.ts +0 -15
  180. package/src/fabric/EmbeddedLinkViewNativeComponent.ts +0 -24
  181. package/src/fabric/NativePlaidLinkModuleAndroid.ts +0 -32
  182. package/src/fabric/NativePlaidLinkModuleiOS.ts +0 -33
  183. package/src/fabric/fabricUtils.ts +0 -2
@@ -1,15 +0,0 @@
1
- #import <LinkKit/LinkKit.h>
2
-
3
- @interface RNPlaidHelper : NSObject
4
-
5
- + (id<PLKHandler> _Nullable)createWithLinkTokenConfiguration:(PLKLinkTokenConfiguration * _Nonnull)linkTokenConfiguration
6
- onLoad:(void (^_Nullable)(void))onLoad
7
- error:(NSError * _Nullable * _Nullable)error;
8
-
9
- + (void)syncFinanceKit:(NSString * _Nonnull)token
10
- requestAuthorizationIfNeeded:(BOOL)requestAuthorizationIfNeeded
11
- simulatedBehavior:(BOOL)simulatedBehavior
12
- onSuccess:(void (^_Nonnull)(void))onSuccess
13
- onError:(void (^_Nonnull)(NSError * _Nonnull error))onError;
14
-
15
- @end
@@ -1,33 +0,0 @@
1
- #import "RNPlaidHelper.h"
2
-
3
- @implementation RNPlaidHelper
4
-
5
- + (id<PLKHandler> _Nullable)createWithLinkTokenConfiguration:(PLKLinkTokenConfiguration * _Nonnull)linkTokenConfiguration
6
- onLoad:(void (^_Nullable)(void))onLoad
7
- error:(NSError * _Nullable * _Nullable)error
8
- {
9
- // Newer LinkKit Objective-C bridge supports an onLoad callback.
10
- return [PLKPlaid createWithLinkTokenConfiguration:linkTokenConfiguration onLoad:onLoad error:error];
11
- }
12
-
13
- + (void)syncFinanceKit:(NSString * _Nonnull)token
14
- requestAuthorizationIfNeeded:(BOOL)requestAuthorizationIfNeeded
15
- simulatedBehavior:(BOOL)simulatedBehavior
16
- onSuccess:(void (^_Nonnull)(void))onSuccess
17
- onError:(void (^_Nonnull)(NSError * _Nonnull error))onError
18
- {
19
- if (@available(iOS 17.4, *)) {
20
- [PLKPlaid syncFinanceKitWithToken:token
21
- requestAuthorizationIfNeeded:requestAuthorizationIfNeeded
22
- simulatedBehavior:simulatedBehavior
23
- onSuccess:onSuccess
24
- onError:onError];
25
- } else {
26
- NSError *error = [NSError errorWithDomain:@"com.plaid.financeKit"
27
- code:1001
28
- userInfo:@{ NSLocalizedDescriptionKey: @"FinanceKit Requires iOS >= 17.4" }];
29
- onError(error);
30
- }
31
- }
32
-
33
- @end
@@ -1,2 +0,0 @@
1
- // xcode tries to import this header in the auto-generated swift header
2
- // same as here: https://github.com/rnmapbox/maps/blob/b76c000a237b9757a616982d6c07f6ecfd7d60a9/ios/RNMBX/rnmapbox_maps.h
@@ -1,40 +0,0 @@
1
- require 'json'
2
-
3
- package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
-
5
- fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
6
-
7
- Pod::Spec.new do |s|
8
- s.name = package['name']
9
- s.version = package['version']
10
- s.summary = package['description']
11
- s.license = package['license']
12
-
13
- s.authors = package['author']
14
- s.homepage = "https://plaid.com/docs/link/ios/"
15
- s.platform = :ios, "14.0"
16
-
17
- s.source = { :git => "https://github.com/plaid/react-native-plaid-link-sdk.git", :tag => "v#{s.version}" }
18
- s.source_files = "ios/**/*.{h,m,mm,swift}"
19
- # we need this since Swift generates import for `react_native_plaid_link_sdk/react_native_plaid_link_sdk.h` and we have to fake it
20
- s.header_dir = "react_native_plaid_link_sdk"
21
- # we don't want this to be seen by Swift
22
- s.private_header_files = 'ios/PLKFabricHelpers.h'
23
- s.module_name = "react_native_plaid_link_sdk"
24
-
25
- if ENV['USE_FRAMEWORKS'] == '1'
26
- s.pod_target_xcconfig = {
27
- "OTHER_CFLAGS" => "$(inherited) -DUSE_FRAMEWORKS",
28
- "OTHER_CPLUSPLUSFLAGS" => "$(inherited) -DUSE_FRAMEWORKS",
29
- }
30
- end
31
-
32
- if fabric_enabled
33
- install_modules_dependencies(s)
34
- else
35
- s.dependency "React-Core"
36
- end
37
-
38
- s.dependency 'React-Core'
39
- s.dependency 'Plaid', '~> 6.4.3'
40
- end
@@ -1,95 +0,0 @@
1
- import React from 'react';
2
- import { StyleProp, ViewStyle } from 'react-native';
3
- import NativeEmbeddedLinkView from './NativeEmbeddedLinkView';
4
- import {
5
- LinkSuccessListener,
6
- LinkSuccess,
7
- LinkExitListener,
8
- LinkExit,
9
- LinkIOSPresentationStyle,
10
- LinkOnEventListener,
11
- LinkEvent,
12
- LinkEventName,
13
- LinkEventMetadata,
14
- LinkError,
15
- LinkExitMetadata,
16
- LinkSuccessMetadata,
17
- } from '../Types';
18
-
19
- type EmbeddedLinkProps = {
20
- token: string,
21
- iOSPresentationStyle: LinkIOSPresentationStyle,
22
- onEvent: LinkOnEventListener | undefined,
23
- onSuccess: LinkSuccessListener,
24
- onExit: LinkExitListener | undefined,
25
- style: StyleProp<ViewStyle> | undefined,
26
- }
27
-
28
- class EmbeddedEvent implements LinkEvent {
29
- eventName: LinkEventName;
30
- metadata: LinkEventMetadata;
31
-
32
- constructor(event: any) {
33
- this.eventName = event.eventName
34
- this.metadata = event.metadata
35
- }
36
- }
37
-
38
- class EmbeddedExit implements LinkExit {
39
- error: LinkError | undefined;
40
- metadata: LinkExitMetadata;
41
-
42
- constructor(event: any) {
43
- this.error = event.error;
44
- this.metadata = event.metadata;
45
- }
46
- }
47
-
48
- class EmbeddedSuccess implements LinkSuccess {
49
- publicToken: string;
50
- metadata: LinkSuccessMetadata;
51
-
52
- constructor(event: any) {
53
- this.publicToken = event.publicToken;
54
- this.metadata = event.metadata;
55
- }
56
- }
57
-
58
- export const EmbeddedLinkView: React.FC<EmbeddedLinkProps> = (props) => {
59
-
60
- const {token, iOSPresentationStyle, onEvent, onSuccess, onExit, style} = props;
61
-
62
- const onEmbeddedEvent = (event: any) => {
63
-
64
- switch (event.nativeEvent.embeddedEventName) {
65
- case 'onSuccess': {
66
- if (!onSuccess) { return; }
67
- const embeddedSuccess = new EmbeddedSuccess(event.nativeEvent);
68
- onSuccess(embeddedSuccess);
69
- break;
70
- }
71
- case 'onExit': {
72
- if (!onExit) {return; }
73
- const embeddedExit = new EmbeddedExit(event.nativeEvent);
74
- onExit(embeddedExit);
75
- break;
76
- }
77
- case 'onEvent': {
78
- if (!onEvent) { return; }
79
- const embeddedEvent = new EmbeddedEvent(event.nativeEvent);
80
- onEvent(embeddedEvent);
81
- break;
82
- }
83
- default: {
84
- return;
85
- }
86
- }
87
- }
88
-
89
- return <NativeEmbeddedLinkView
90
- token={token}
91
- iOSPresentationStyle={iOSPresentationStyle.toString()}
92
- onEmbeddedEvent={onEmbeddedEvent}
93
- style={style}
94
- />
95
- };
@@ -1,5 +0,0 @@
1
- // EmbeddedLinkView.web.tsx is a shim file which causes web bundlers to ignore the EmbeddedLinkView.tsx file
2
- // which imports requireNativeComponent (causing a runtime error with react-native-web).
3
- // Ref - https://github.com/plaid/react-native-plaid-link-sdk/issues/564
4
- import React from 'react';
5
- export const EmbeddedLinkView = () => null;
@@ -1,3 +0,0 @@
1
- import NativeEmbeddedLinkView from '../fabric/EmbeddedLinkViewNativeComponent';
2
-
3
- export default NativeEmbeddedLinkView;
package/src/PlaidLink.tsx DELETED
@@ -1,167 +0,0 @@
1
- import { useEffect } from 'react';
2
- import { NativeEventEmitter, Platform } from 'react-native';
3
- import {
4
- LinkError,
5
- LinkEventListener,
6
- LinkExit,
7
- LinkIOSPresentationStyle,
8
- LinkLogLevel,
9
- LinkOpenProps,
10
- LinkSuccess,
11
- LinkTokenConfiguration,
12
- FinanceKitErrorType,
13
- FinanceKitError,
14
- SubmissionData,
15
- } from './Types';
16
- import RNLinksdkAndroid from './fabric/NativePlaidLinkModuleAndroid';
17
- import RNLinksdkiOS from './fabric/NativePlaidLinkModuleiOS';
18
-
19
- const RNLinksdk =
20
- (Platform.OS === 'android' ? RNLinksdkAndroid : RNLinksdkiOS) ?? undefined;
21
-
22
- /**
23
- * A hook that registers a listener on the Plaid emitter for the 'onEvent' type.
24
- * The listener is cleaned up when this view is unmounted
25
- *
26
- * @param LinkEventListener the listener to call
27
- */
28
- export const usePlaidEmitter = (linkEventListener: LinkEventListener) => {
29
- useEffect(() => {
30
- const emitter = new NativeEventEmitter(RNLinksdk);
31
- const listener = emitter.addListener('onEvent', linkEventListener);
32
- // Clean up after this effect:
33
- return function cleanup() {
34
- listener.remove();
35
- };
36
- }, []);
37
- };
38
-
39
- export const create = (props: LinkTokenConfiguration) => {
40
- let token = props.token;
41
- let noLoadingState = props.noLoadingState ?? false;
42
-
43
- if (Platform.OS === 'android') {
44
- RNLinksdkAndroid?.createPlaidLink(
45
- token,
46
- noLoadingState,
47
- props.logLevel ?? LinkLogLevel.ERROR,
48
- props.onLoad ?? (() => {}),
49
- );
50
- } else {
51
- const onLoad = props.onLoad ?? (() => {});
52
- RNLinksdkiOS?.createPlaidLink(token, noLoadingState, onLoad);
53
- }
54
- };
55
-
56
- export const open = (props: LinkOpenProps) => {
57
- if (Platform.OS === 'android') {
58
- RNLinksdkAndroid?.open(
59
- (result: LinkSuccess) => {
60
- if (props.onSuccess != null) {
61
- props.onSuccess(result);
62
- }
63
- },
64
- (result: LinkExit) => {
65
- if (props.onExit != null) {
66
- if (result.error != null && result.error.displayMessage != null) {
67
- //TODO(RNSDK-118): Remove errorDisplayMessage field in next major update.
68
- result.error.errorDisplayMessage = result.error.displayMessage;
69
- }
70
- props.onExit(result);
71
- }
72
- },
73
- );
74
- } else {
75
- let presentFullScreen =
76
- props.iOSPresentationStyle == LinkIOSPresentationStyle.FULL_SCREEN;
77
-
78
- RNLinksdkiOS?.open(
79
- presentFullScreen,
80
- (result: LinkSuccess) => {
81
- if (props.onSuccess != null) {
82
- props.onSuccess(result);
83
- }
84
- },
85
- (error: LinkError, result: LinkExit) => {
86
- if (props.onExit != null) {
87
- if (error) {
88
- var data = result || {};
89
- data.error = error;
90
- props.onExit(data);
91
- } else {
92
- props.onExit(result);
93
- }
94
- }
95
- },
96
- );
97
- }
98
- };
99
-
100
- /**
101
- * Clears any previously created Plaid session and associated resources
102
- * that were captured during a prior call to create(). This method should
103
- * be invoked before starting a new layer session with create() to ensure
104
- * proper cleanup and avoid conflicts from lingering state or resources.
105
- */
106
- export const destroy = async () => {
107
- if (Platform.OS === 'android') {
108
- await RNLinksdkAndroid?.destroy();
109
- }
110
- };
111
-
112
- export const dismissLink = () => {
113
- if (Platform.OS === 'ios') {
114
- RNLinksdkiOS?.dismiss();
115
- }
116
- };
117
-
118
- export const submit = (data: SubmissionData): void => {
119
- if (Platform.OS === 'android') {
120
- RNLinksdkAndroid?.submit(data.phoneNumber, data.dateOfBirth, data.params);
121
- } else {
122
- RNLinksdkiOS?.submit(data.phoneNumber, data.dateOfBirth, data.params);
123
- }
124
- };
125
-
126
- /**
127
- * Function to sync the user's transactions from their Apple card.
128
- *
129
- * @param {string} token - The `LinkToken` your server retrieved from the /link/token/create endpoint from the Plaid API.
130
- * This token must be associated with an accessToken.
131
- * @param {boolean} requestAuthorizationIfNeeded - Indicates if the user should be prompted to authorize the sync if
132
- * they have not already done so.
133
- * @param {function} completion - A callback function that is called when the sync has completed.
134
- *
135
- * @warning This method only works on iOS >= 17.4.
136
- * @warning This method is not supported on Android or MacCatalyst.
137
- * @warning This method can only be used once the user has granted access to their Apple card via a standard Link Session.
138
- * @warning This method requires that your app has been granted FinanceKit access from Apple.
139
- */
140
- export const syncFinanceKit = (
141
- token: string,
142
- requestAuthorizationIfNeeded: boolean,
143
- simulatedBehavior: boolean,
144
- completion: (error?: FinanceKitError) => void
145
- ): void => {
146
- if (Platform.OS === 'android') {
147
- completion({
148
- type: FinanceKitErrorType.Unknown,
149
- message: "FinanceKit is unavailable on Android!",
150
- })
151
- } else {
152
- RNLinksdkiOS?.syncFinanceKit(
153
- token,
154
- requestAuthorizationIfNeeded,
155
- simulatedBehavior,
156
- () => {
157
- completion()
158
- },
159
- (error: FinanceKitError) => {
160
- completion({
161
- type: error.type,
162
- message: error.message,
163
- })
164
- }
165
- )
166
- }
167
- };