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
package/package.json CHANGED
@@ -1,86 +1,46 @@
1
1
  {
2
2
  "name": "react-native-plaid-link-sdk",
3
- "version": "12.8.2",
4
- "description": "React Native Plaid Link SDK",
5
- "main": "dist/index.js",
6
- "types": "dist/index.d.ts",
7
- "react-native": "src/index.ts",
8
- "files": [
9
- "dist/**/*",
10
- "android/**/*",
11
- "ios/**/*",
12
- "react-native-plaid-link-sdk.podspec",
13
- "src/**/*"
14
- ],
3
+ "version": "13.0.0",
4
+ "description": "React Native Plaid Link SDK (New Architecture & Expo)",
5
+ "main": "build/index.js",
6
+ "types": "build/index.d.ts",
15
7
  "scripts": {
16
- "lint": "eslint \"./**/*.{js,jsx}\" --fix",
17
- "prettier": "prettier \"./**/*.{js,jsx}\" --write",
18
- "test": "jest"
8
+ "build": "expo-module build",
9
+ "check:package": "node scripts/check-package-entrypoints.js",
10
+ "clean": "expo-module clean",
11
+ "lint": "expo-module lint",
12
+ "test": "expo-module test",
13
+ "prepare": "expo-module prepare",
14
+ "prepublishOnly": "expo-module prepublishOnly",
15
+ "expo-module": "expo-module",
16
+ "open:ios": "xed example/ios",
17
+ "open:android": "open -a \"Android Studio\" example/android",
18
+ "format": "prettier --write \"**/*.{ts,tsx}\""
19
19
  },
20
20
  "keywords": [
21
21
  "react-native",
22
- "Plaid"
22
+ "expo",
23
+ "react-native-plaid-link-sdk",
24
+ "ReactNativePlaidLinkSdk"
23
25
  ],
24
- "husky": {
25
- "hooks": {
26
- "pre-commit": "lint-staged"
27
- }
28
- },
29
- "lint-staged": {
30
- "*.{js,jsx}": [
31
- "prettier --write",
32
- "eslint --fix",
33
- "git add"
34
- ]
35
- },
36
- "jest": {
37
- "testPathIgnorePatterns": [
38
- "/node_modules/",
39
- "/example/"
40
- ]
26
+ "repository": "https://github.com/plaid/react-native-plaid-link-sdk",
27
+ "bugs": {
28
+ "url": "https://github.com/plaid/react-native-plaid-link-sdk/issues"
41
29
  },
42
30
  "author": "Plaid",
43
31
  "license": "MIT",
44
- "peerDependencies": {
45
- "react": "*",
46
- "react-native": "*"
47
- },
32
+ "homepage": "https://github.com/plaid/react-native-plaid-link-sdk#readme",
48
33
  "devDependencies": {
49
- "@babel/core": "^7.25.2",
50
- "@babel/eslint-parser": "^7.25.1",
51
- "@react-native-community/eslint-plugin": "^1.1.0",
52
- "@react-native/babel-preset": "^0.74.3",
53
- "@types/jest": "^26.0.14",
54
- "@types/react": "^18.2.6",
55
- "@types/react-native": "^0.71.3",
56
- "@types/react-test-renderer": "^16.9.3",
57
- "@typescript-eslint/eslint-plugin": "^4.33.0",
58
- "@typescript-eslint/parser": "^4.33.0",
59
- "babel-eslint": "^10.0.3",
60
- "eslint": "^7.32.0",
61
- "eslint-plugin-prettier": "^3.1.4",
62
- "eslint-plugin-react": "^7.16.0",
63
- "husky": "^3.1.0",
64
- "jest": "^29.6.1",
65
- "lint-staged": "^9.4.2",
66
- "prettier": "^1.18.2",
67
- "react": "18.2.0",
68
- "react-native": "0.84.1",
69
- "typescript": "^4.9.5"
34
+ "@testing-library/react-native": "^13.3.3",
35
+ "@types/jest": "^30.0.0",
36
+ "@types/react": "~19.1.1",
37
+ "expo": "^55.0.8",
38
+ "expo-module-scripts": "^55.0.2",
39
+ "react-native": "0.82.1"
70
40
  },
71
- "codegenConfig": {
72
- "name": "rnplaidlink",
73
- "type": "all",
74
- "jsSrcsDir": "./src/fabric",
75
- "android": {
76
- "javaPackageName": "com.plaid"
77
- },
78
- "ios": {
79
- "modules": {
80
- "RNLinksdk": {
81
- "className": "RNLinksdk"
82
- }
83
- }
84
- }
41
+ "peerDependencies": {
42
+ "expo": ">=52.0.0",
43
+ "react": ">=18.0.0",
44
+ "react-native": ">=0.76.0"
85
45
  }
86
46
  }
@@ -0,0 +1,146 @@
1
+ const { execFileSync } = require("child_process");
2
+ const fs = require("fs");
3
+ const os = require("os");
4
+ const path = require("path");
5
+
6
+ const root = path.resolve(__dirname, "..");
7
+ const packageJsonPath = path.join(root, "package.json");
8
+ const packageJson = require(packageJsonPath);
9
+
10
+ function fail(message) {
11
+ console.error(`Package entrypoint check failed: ${message}`);
12
+ process.exit(1);
13
+ }
14
+
15
+ function assertPackageFieldExists(fieldName) {
16
+ const fieldValue = packageJson[fieldName];
17
+
18
+ if (typeof fieldValue !== "string" || fieldValue.length === 0) {
19
+ fail(`package.json field "${fieldName}" must be a non-empty string.`);
20
+ }
21
+
22
+ const absolutePath = path.join(root, fieldValue);
23
+
24
+ if (!fs.existsSync(absolutePath)) {
25
+ fail(
26
+ `package.json field "${fieldName}" points to a missing file: ${fieldValue}`,
27
+ );
28
+ }
29
+
30
+ return fieldValue;
31
+ }
32
+
33
+ function parsePackJson(output) {
34
+ for (let start = 0; start < output.length; start += 1) {
35
+ if (output[start] !== "[") {
36
+ continue;
37
+ }
38
+
39
+ let depth = 0;
40
+ let inString = false;
41
+ let isEscaped = false;
42
+
43
+ for (let end = start; end < output.length; end += 1) {
44
+ const char = output[end];
45
+
46
+ if (isEscaped) {
47
+ isEscaped = false;
48
+ continue;
49
+ }
50
+
51
+ if (char === "\\") {
52
+ isEscaped = true;
53
+ continue;
54
+ }
55
+
56
+ if (char === '"') {
57
+ inString = !inString;
58
+ continue;
59
+ }
60
+
61
+ if (inString) {
62
+ continue;
63
+ }
64
+
65
+ if (char === "[") {
66
+ depth += 1;
67
+ } else if (char === "]") {
68
+ depth -= 1;
69
+
70
+ if (depth === 0) {
71
+ const candidate = output.slice(start, end + 1);
72
+ try {
73
+ const parsed = JSON.parse(candidate);
74
+ if (Array.isArray(parsed)) {
75
+ return parsed;
76
+ }
77
+ } catch (_error) {
78
+ break;
79
+ }
80
+ }
81
+ }
82
+ }
83
+ }
84
+
85
+ fail("npm pack did not return a JSON array in its output.");
86
+ }
87
+
88
+ const main = assertPackageFieldExists("main");
89
+ const types = assertPackageFieldExists("types");
90
+
91
+ try {
92
+ const resolved = require.resolve(root);
93
+ const expected = path.join(root, main);
94
+
95
+ if (resolved !== expected) {
96
+ fail(
97
+ `require.resolve('.') resolved to ${path.relative(
98
+ root,
99
+ resolved,
100
+ )}, expected ${main}`,
101
+ );
102
+ }
103
+ } catch (error) {
104
+ fail(`require.resolve('.') failed: ${error.message}`);
105
+ }
106
+
107
+ let packOutput;
108
+
109
+ try {
110
+ packOutput = execFileSync("npm", ["pack", "--dry-run", "--json"], {
111
+ cwd: root,
112
+ encoding: "utf8",
113
+ env: {
114
+ ...process.env,
115
+ npm_config_cache: path.join(
116
+ os.tmpdir(),
117
+ "react-native-plaid-link-sdk-npm-cache",
118
+ ),
119
+ },
120
+ });
121
+ } catch (error) {
122
+ fail(`npm pack --dry-run --json failed:\n${error.stderr || error.message}`);
123
+ }
124
+
125
+ const packResult = parsePackJson(packOutput);
126
+
127
+ const packedFiles = (packResult[0] && packResult[0].files) || [];
128
+ const files = new Set(packedFiles.map((file) => file.path));
129
+
130
+ for (const entrypoint of [main, types]) {
131
+ if (!files.has(entrypoint)) {
132
+ fail(`packed package does not include ${entrypoint}`);
133
+ }
134
+ }
135
+
136
+ for (const forbiddenPrefix of ["coverage/", "dist/", "example/"]) {
137
+ const forbiddenFile = packedFiles.find((file) =>
138
+ file.path.startsWith(forbiddenPrefix),
139
+ );
140
+
141
+ if (forbiddenFile) {
142
+ fail(`packed package must not include ${forbiddenFile.path}`);
143
+ }
144
+ }
145
+
146
+ console.log(`Package entrypoints are valid: ${main}, ${types}`);
@@ -0,0 +1,49 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+
4
+ function extractEnumValues(source, enumName) {
5
+ const enumMatch = source.match(
6
+ new RegExp(`export\\s+enum\\s+${enumName}\\s*\\{([\\s\\S]*?)\\n\\}`),
7
+ );
8
+
9
+ if (!enumMatch) {
10
+ throw new Error(`Could not find ${enumName}`);
11
+ }
12
+
13
+ return [...enumMatch[1].matchAll(/=\s*"([^"]+)"/g)].map((match) => match[1]);
14
+ }
15
+
16
+ function getReactNativeEnumValues(repoRoot = path.resolve(__dirname, "..")) {
17
+ const source = fs.readFileSync(
18
+ path.join(repoRoot, "src", "ReactNativePlaidLinkSdk.types.ts"),
19
+ "utf8",
20
+ );
21
+
22
+ return {
23
+ eventNames: extractEnumValues(source, "LinkEventName"),
24
+ viewNames: extractEnumValues(source, "LinkEventViewName"),
25
+ };
26
+ }
27
+
28
+ if (require.main === module) {
29
+ const values = getReactNativeEnumValues();
30
+ if (process.argv.includes("--json")) {
31
+ process.stdout.write(`${JSON.stringify(values)}\n`);
32
+ } else {
33
+ process.stdout.write(
34
+ [
35
+ "LinkEventName",
36
+ ...values.eventNames.map((value) => ` ${value}`),
37
+ "",
38
+ "LinkEventViewName",
39
+ ...values.viewNames.map((value) => ` ${value}`),
40
+ "",
41
+ ].join("\n"),
42
+ );
43
+ }
44
+ }
45
+
46
+ module.exports = {
47
+ extractEnumValues,
48
+ getReactNativeEnumValues,
49
+ };
@@ -0,0 +1,35 @@
1
+ import { requireNativeViewManager } from "expo-modules-core";
2
+ import * as React from "react";
3
+ import { ViewProps } from "react-native";
4
+
5
+ import {
6
+ LinkExit,
7
+ LinkEvent,
8
+ LinkSuccess,
9
+ } from "./ReactNativePlaidLinkSdk.types";
10
+
11
+ export type PlaidEmbeddedSearchViewProps = {
12
+ token: string;
13
+ onSuccess?: (success: LinkSuccess) => void;
14
+ onExit?: (exit: LinkExit) => void;
15
+ onEvent?: (event: LinkEvent) => void;
16
+ onLoad?: () => void;
17
+ } & ViewProps;
18
+
19
+ const NativeView: React.ComponentType<any> = requireNativeViewManager(
20
+ "ReactNativePlaidLinkSdk",
21
+ );
22
+
23
+ export function PlaidEmbeddedSearchView(props: PlaidEmbeddedSearchViewProps) {
24
+ const { onSuccess, onExit, onEvent, onLoad, ...restProps } = props;
25
+
26
+ return (
27
+ <NativeView
28
+ {...restProps}
29
+ onSuccess={(event: any) => onSuccess?.(event.nativeEvent)}
30
+ onExit={(event: any) => onExit?.(event.nativeEvent)}
31
+ onEvent={(event: any) => onEvent?.(event.nativeEvent)}
32
+ onLoad={(event: any) => onLoad?.()}
33
+ />
34
+ );
35
+ }