@stripe/stripe-react-native 0.44.0 → 0.45.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 (314) hide show
  1. package/.clang-format +90 -0
  2. package/.editorconfig +3 -0
  3. package/CHANGELOG.md +7 -1
  4. package/android/build.gradle +89 -18
  5. package/android/gradle.properties +1 -1
  6. package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormViewManager.kt +15 -6
  7. package/android/src/main/java/com/reactnativestripesdk/CardChangeEvent.kt +56 -0
  8. package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +4 -4
  9. package/android/src/main/java/com/reactnativestripesdk/CardFieldViewManager.kt +55 -45
  10. package/android/src/main/java/com/reactnativestripesdk/{CardFocusEvent.kt → CardFocusChangeEvent.kt} +2 -2
  11. package/android/src/main/java/com/reactnativestripesdk/CardFormCompleteEvent.kt +17 -16
  12. package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +5 -5
  13. package/android/src/main/java/com/reactnativestripesdk/CardFormViewManager.kt +39 -33
  14. package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherFragment.kt +4 -2
  15. package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +182 -0
  16. package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +231 -0
  17. package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetFragment.kt +8 -5
  18. package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonManager.kt +14 -6
  19. package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +3 -1
  20. package/android/src/main/java/com/reactnativestripesdk/PaymentOptionDisplayDataMapper.kt +17 -0
  21. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +266 -0
  22. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +8 -13
  23. package/android/src/main/java/com/reactnativestripesdk/StripeContainerManager.kt +11 -3
  24. package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +106 -59
  25. package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +34 -4
  26. package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetView.kt +33 -27
  27. package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetViewManager.kt +49 -24
  28. package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetFragment.kt +16 -3
  29. package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerAdapter.kt +11 -29
  30. package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +36 -12
  31. package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt +5 -3
  32. package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +4 -0
  33. package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +21 -0
  34. package/android/src/oldarch/java/com/facebook/react/viewmanagers/AddToWalletButtonManagerDelegate.java +49 -0
  35. package/android/src/oldarch/java/com/facebook/react/viewmanagers/AddToWalletButtonManagerInterface.java +25 -0
  36. package/android/src/oldarch/java/com/facebook/react/viewmanagers/AddressSheetViewManagerDelegate.java +64 -0
  37. package/android/src/oldarch/java/com/facebook/react/viewmanagers/AddressSheetViewManagerInterface.java +30 -0
  38. package/android/src/oldarch/java/com/facebook/react/viewmanagers/ApplePayButtonManagerDelegate.java +41 -0
  39. package/android/src/oldarch/java/com/facebook/react/viewmanagers/ApplePayButtonManagerInterface.java +20 -0
  40. package/android/src/oldarch/java/com/facebook/react/viewmanagers/AuBECSDebitFormManagerDelegate.java +36 -0
  41. package/android/src/oldarch/java/com/facebook/react/viewmanagers/AuBECSDebitFormManagerInterface.java +20 -0
  42. package/android/src/oldarch/java/com/facebook/react/viewmanagers/CardFieldManagerDelegate.java +73 -0
  43. package/android/src/oldarch/java/com/facebook/react/viewmanagers/CardFieldManagerInterface.java +31 -0
  44. package/android/src/oldarch/java/com/facebook/react/viewmanagers/CardFormManagerDelegate.java +67 -0
  45. package/android/src/oldarch/java/com/facebook/react/viewmanagers/CardFormManagerInterface.java +29 -0
  46. package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerDelegate.java +49 -0
  47. package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerInterface.java +21 -0
  48. package/android/src/oldarch/java/com/facebook/react/viewmanagers/GooglePayButtonManagerDelegate.java +38 -0
  49. package/android/src/oldarch/java/com/facebook/react/viewmanagers/GooglePayButtonManagerInterface.java +19 -0
  50. package/android/src/oldarch/java/com/facebook/react/viewmanagers/StripeContainerManagerDelegate.java +32 -0
  51. package/android/src/oldarch/java/com/facebook/react/viewmanagers/StripeContainerManagerInterface.java +17 -0
  52. package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +311 -0
  53. package/ios/AddressSheet/AddressSheetUtils.swift +21 -19
  54. package/ios/AddressSheet/AddressSheetView.swift +23 -17
  55. package/ios/ApplePayButtonManager.m +0 -1
  56. package/ios/ApplePayButtonManager.swift +1 -3
  57. package/ios/ApplePayButtonView.swift +25 -20
  58. package/ios/ApplePayViewController.swift +22 -22
  59. package/ios/AuBECSDebitFormView.swift +14 -8
  60. package/ios/CardFieldManager.swift +1 -4
  61. package/ios/CardFieldView.swift +28 -25
  62. package/ios/CardFormManager.swift +1 -4
  63. package/ios/CardFormView.swift +25 -16
  64. package/ios/CustomerSheet/CustomerSheetUtils.swift +12 -16
  65. package/ios/CustomerSheet/ReactNativeCustomerAdapter.swift +8 -8
  66. package/ios/EmbeddedPaymentElementManager.m +6 -0
  67. package/ios/EmbeddedPaymentElementView.swift +48 -0
  68. package/ios/NewArch/AddToWalletButtonComponentView.h +10 -0
  69. package/ios/NewArch/AddToWalletButtonComponentView.mm +93 -0
  70. package/ios/NewArch/AddressSheetViewComponentView.h +10 -0
  71. package/ios/NewArch/AddressSheetViewComponentView.mm +109 -0
  72. package/ios/NewArch/ApplePayButtonComponentView.h +10 -0
  73. package/ios/NewArch/ApplePayButtonComponentView.mm +124 -0
  74. package/ios/NewArch/AuBECSDebitFormComponentView.h +10 -0
  75. package/ios/NewArch/AuBECSDebitFormComponentView.mm +95 -0
  76. package/ios/NewArch/CardFieldComponentView.h +10 -0
  77. package/ios/NewArch/CardFieldComponentView.mm +125 -0
  78. package/ios/NewArch/CardFormComponentView.h +10 -0
  79. package/ios/NewArch/CardFormComponentView.mm +108 -0
  80. package/ios/NewArch/StripeContainerComponentView.h +10 -0
  81. package/ios/NewArch/StripeContainerComponentView.mm +74 -0
  82. package/ios/NewArch/StripeNewArchConversions.h +20 -0
  83. package/ios/NewArch/StripeNewArchConversions.mm +47 -0
  84. package/ios/OldArch/StripeSdkEventEmitterCompat.h +27 -0
  85. package/ios/OldArch/StripeSdkEventEmitterCompat.m +105 -0
  86. package/ios/PaymentOptionDisplayData+ReactNative.swift +55 -0
  87. package/ios/PaymentSheetAppearance.swift +194 -1
  88. package/ios/PushProvisioning/AddToWalletButtonView.swift +19 -13
  89. package/ios/StripeContainerView.swift +5 -3
  90. package/ios/StripeSdk.h +21 -0
  91. package/ios/StripeSdk.mm +415 -0
  92. package/ios/StripeSdkEmitter.swift +19 -0
  93. package/ios/{StripeSdk+CustomerSheet.swift → StripeSdkImpl+CustomerSheet.swift} +24 -25
  94. package/ios/StripeSdkImpl+Embedded.swift +327 -0
  95. package/ios/{StripeSdk+PaymentSheet.swift → StripeSdkImpl+PaymentSheet.swift} +18 -29
  96. package/ios/{StripeSdk.swift → StripeSdkImpl.swift} +50 -72
  97. package/ios/StripeSwiftInterop.h +25 -0
  98. package/ios/stripe_react_native.h +2 -0
  99. package/lib/commonjs/components/AddToWalletButton.js +1 -1
  100. package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
  101. package/lib/commonjs/components/AddressSheet.js +1 -1
  102. package/lib/commonjs/components/AddressSheet.js.map +1 -1
  103. package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
  104. package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
  105. package/lib/commonjs/components/CardField.js +1 -1
  106. package/lib/commonjs/components/CardField.js.map +1 -1
  107. package/lib/commonjs/components/CardForm.js +1 -1
  108. package/lib/commonjs/components/CardForm.js.map +1 -1
  109. package/lib/commonjs/components/CustomerSheet.js +1 -1
  110. package/lib/commonjs/components/CustomerSheet.js.map +1 -1
  111. package/lib/commonjs/components/PlatformPayButton.js +1 -1
  112. package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
  113. package/lib/commonjs/components/StripeContainer.js +1 -1
  114. package/lib/commonjs/components/StripeContainer.js.map +1 -1
  115. package/lib/commonjs/components/StripeProvider.js +1 -1
  116. package/lib/commonjs/components/StripeProvider.js.map +1 -1
  117. package/lib/commonjs/events.js +2 -0
  118. package/lib/commonjs/events.js.map +1 -0
  119. package/lib/commonjs/functions.js +1 -1
  120. package/lib/commonjs/functions.js.map +1 -1
  121. package/lib/commonjs/index.js +1 -1
  122. package/lib/commonjs/index.js.map +1 -1
  123. package/lib/commonjs/specs/NativeAddToWalletButton.js +2 -0
  124. package/lib/commonjs/specs/NativeAddToWalletButton.js.map +1 -0
  125. package/lib/commonjs/specs/NativeAddressSheet.js +2 -0
  126. package/lib/commonjs/specs/NativeAddressSheet.js.map +1 -0
  127. package/lib/commonjs/specs/NativeApplePayButton.js +2 -0
  128. package/lib/commonjs/specs/NativeApplePayButton.js.map +1 -0
  129. package/lib/commonjs/specs/NativeAuBECSDebitForm.js +2 -0
  130. package/lib/commonjs/specs/NativeAuBECSDebitForm.js.map +1 -0
  131. package/lib/commonjs/specs/NativeCardField.js +2 -0
  132. package/lib/commonjs/specs/NativeCardField.js.map +1 -0
  133. package/lib/commonjs/specs/NativeCardForm.js +2 -0
  134. package/lib/commonjs/specs/NativeCardForm.js.map +1 -0
  135. package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js +2 -0
  136. package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js.map +1 -0
  137. package/lib/commonjs/specs/NativeGooglePayButton.js +2 -0
  138. package/lib/commonjs/specs/NativeGooglePayButton.js.map +1 -0
  139. package/lib/commonjs/specs/NativeStripeContainer.js +2 -0
  140. package/lib/commonjs/specs/NativeStripeContainer.js.map +1 -0
  141. package/lib/commonjs/specs/NativeStripeSdkModule.js +2 -0
  142. package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -0
  143. package/lib/commonjs/specs/utils.js +2 -0
  144. package/lib/commonjs/specs/utils.js.map +1 -0
  145. package/lib/commonjs/types/EmbeddedPaymentElement.js +2 -0
  146. package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -0
  147. package/lib/commonjs/types/PaymentSheet.js +1 -1
  148. package/lib/commonjs/types/PaymentSheet.js.map +1 -1
  149. package/lib/module/components/AddToWalletButton.js +1 -1
  150. package/lib/module/components/AddToWalletButton.js.map +1 -1
  151. package/lib/module/components/AddressSheet.js +1 -1
  152. package/lib/module/components/AddressSheet.js.map +1 -1
  153. package/lib/module/components/AuBECSDebitForm.js +1 -1
  154. package/lib/module/components/AuBECSDebitForm.js.map +1 -1
  155. package/lib/module/components/CardField.js +1 -1
  156. package/lib/module/components/CardField.js.map +1 -1
  157. package/lib/module/components/CardForm.js +1 -1
  158. package/lib/module/components/CardForm.js.map +1 -1
  159. package/lib/module/components/CustomerSheet.js +1 -1
  160. package/lib/module/components/CustomerSheet.js.map +1 -1
  161. package/lib/module/components/PlatformPayButton.js +1 -1
  162. package/lib/module/components/PlatformPayButton.js.map +1 -1
  163. package/lib/module/components/StripeContainer.js +1 -1
  164. package/lib/module/components/StripeContainer.js.map +1 -1
  165. package/lib/module/components/StripeProvider.js +1 -1
  166. package/lib/module/components/StripeProvider.js.map +1 -1
  167. package/lib/module/events.js +2 -0
  168. package/lib/module/events.js.map +1 -0
  169. package/lib/module/functions.js +1 -1
  170. package/lib/module/functions.js.map +1 -1
  171. package/lib/module/index.js +1 -1
  172. package/lib/module/index.js.map +1 -1
  173. package/lib/module/specs/NativeAddToWalletButton.js +2 -0
  174. package/lib/module/specs/NativeAddToWalletButton.js.map +1 -0
  175. package/lib/module/specs/NativeAddressSheet.js +2 -0
  176. package/lib/module/specs/NativeAddressSheet.js.map +1 -0
  177. package/lib/module/specs/NativeApplePayButton.js +2 -0
  178. package/lib/module/specs/NativeApplePayButton.js.map +1 -0
  179. package/lib/module/specs/NativeAuBECSDebitForm.js +2 -0
  180. package/lib/module/specs/NativeAuBECSDebitForm.js.map +1 -0
  181. package/lib/module/specs/NativeCardField.js +2 -0
  182. package/lib/module/specs/NativeCardField.js.map +1 -0
  183. package/lib/module/specs/NativeCardForm.js +2 -0
  184. package/lib/module/specs/NativeCardForm.js.map +1 -0
  185. package/lib/module/specs/NativeEmbeddedPaymentElement.js +2 -0
  186. package/lib/module/specs/NativeEmbeddedPaymentElement.js.map +1 -0
  187. package/lib/module/specs/NativeGooglePayButton.js +2 -0
  188. package/lib/module/specs/NativeGooglePayButton.js.map +1 -0
  189. package/lib/module/specs/NativeStripeContainer.js +2 -0
  190. package/lib/module/specs/NativeStripeContainer.js.map +1 -0
  191. package/lib/module/specs/NativeStripeSdkModule.js +2 -0
  192. package/lib/module/specs/NativeStripeSdkModule.js.map +1 -0
  193. package/lib/module/specs/utils.js +2 -0
  194. package/lib/module/specs/utils.js.map +1 -0
  195. package/lib/module/types/EmbeddedPaymentElement.js +2 -0
  196. package/lib/module/types/EmbeddedPaymentElement.js.map +1 -0
  197. package/lib/module/types/PaymentSheet.js +1 -1
  198. package/lib/module/types/PaymentSheet.js.map +1 -1
  199. package/lib/typescript/src/components/AddToWalletButton.d.ts.map +1 -1
  200. package/lib/typescript/src/components/AddressSheet.d.ts.map +1 -1
  201. package/lib/typescript/src/components/AuBECSDebitForm.d.ts.map +1 -1
  202. package/lib/typescript/src/components/CardField.d.ts +1 -1
  203. package/lib/typescript/src/components/CardField.d.ts.map +1 -1
  204. package/lib/typescript/src/components/CardForm.d.ts +1 -1
  205. package/lib/typescript/src/components/CardForm.d.ts.map +1 -1
  206. package/lib/typescript/src/components/CustomerSheet.d.ts +1 -1
  207. package/lib/typescript/src/components/CustomerSheet.d.ts.map +1 -1
  208. package/lib/typescript/src/components/StripeContainer.d.ts.map +1 -1
  209. package/lib/typescript/src/events.d.ts +13 -0
  210. package/lib/typescript/src/events.d.ts.map +1 -0
  211. package/lib/typescript/src/functions.d.ts.map +1 -1
  212. package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts +4 -4
  213. package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts.map +1 -1
  214. package/lib/typescript/src/hooks/useStripe.d.ts +2 -2
  215. package/lib/typescript/src/hooks/useStripe.d.ts.map +1 -1
  216. package/lib/typescript/src/index.d.ts +2 -0
  217. package/lib/typescript/src/index.d.ts.map +1 -1
  218. package/lib/typescript/src/specs/NativeAddToWalletButton.d.ts +27 -0
  219. package/lib/typescript/src/specs/NativeAddToWalletButton.d.ts.map +1 -0
  220. package/lib/typescript/src/specs/NativeAddressSheet.d.ts +34 -0
  221. package/lib/typescript/src/specs/NativeAddressSheet.d.ts.map +1 -0
  222. package/lib/typescript/src/specs/NativeApplePayButton.d.ts +28 -0
  223. package/lib/typescript/src/specs/NativeApplePayButton.d.ts.map +1 -0
  224. package/lib/typescript/src/specs/NativeAuBECSDebitForm.d.ts +19 -0
  225. package/lib/typescript/src/specs/NativeAuBECSDebitForm.d.ts.map +1 -0
  226. package/lib/typescript/src/specs/NativeCardField.d.ts +33 -0
  227. package/lib/typescript/src/specs/NativeCardField.d.ts.map +1 -0
  228. package/lib/typescript/src/specs/NativeCardForm.d.ts +31 -0
  229. package/lib/typescript/src/specs/NativeCardForm.d.ts.map +1 -0
  230. package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts +22 -0
  231. package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts.map +1 -0
  232. package/lib/typescript/src/specs/NativeGooglePayButton.d.ts +11 -0
  233. package/lib/typescript/src/specs/NativeGooglePayButton.d.ts.map +1 -0
  234. package/lib/typescript/src/specs/NativeStripeContainer.d.ts +8 -0
  235. package/lib/typescript/src/specs/NativeStripeContainer.d.ts.map +1 -0
  236. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +93 -0
  237. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -0
  238. package/lib/typescript/src/specs/utils.d.ts +20 -0
  239. package/lib/typescript/src/specs/utils.d.ts.map +1 -0
  240. package/lib/typescript/src/types/CustomerSheet.d.ts +1 -5
  241. package/lib/typescript/src/types/CustomerSheet.d.ts.map +1 -1
  242. package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts +161 -0
  243. package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -0
  244. package/lib/typescript/src/types/PaymentSheet.d.ts +97 -4
  245. package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
  246. package/lib/typescript/src/types/components/CardFieldInput.d.ts +3 -2
  247. package/lib/typescript/src/types/components/CardFieldInput.d.ts.map +1 -1
  248. package/lib/typescript/src/types/components/CardFormView.d.ts +3 -1
  249. package/lib/typescript/src/types/components/CardFormView.d.ts.map +1 -1
  250. package/package.json +20 -1
  251. package/src/components/AddToWalletButton.tsx +2 -5
  252. package/src/components/AddressSheet.tsx +5 -16
  253. package/src/components/AuBECSDebitForm.tsx +3 -12
  254. package/src/components/CardField.tsx +20 -30
  255. package/src/components/CardForm.tsx +14 -29
  256. package/src/components/CustomerSheet.tsx +23 -25
  257. package/src/components/PlatformPayButton.tsx +6 -6
  258. package/src/components/StripeContainer.tsx +5 -12
  259. package/src/components/StripeProvider.tsx +1 -1
  260. package/src/events.ts +49 -0
  261. package/src/functions.ts +13 -24
  262. package/src/hooks/useFinancialConnectionsSheet.tsx +2 -2
  263. package/src/hooks/useStripe.tsx +2 -2
  264. package/src/index.tsx +3 -0
  265. package/src/specs/NativeAddToWalletButton.ts +40 -0
  266. package/src/specs/NativeAddressSheet.ts +50 -0
  267. package/src/specs/NativeApplePayButton.ts +40 -0
  268. package/src/specs/NativeAuBECSDebitForm.ts +24 -0
  269. package/src/specs/NativeCardField.ts +51 -0
  270. package/src/specs/NativeCardForm.ts +43 -0
  271. package/src/specs/NativeEmbeddedPaymentElement.ts +37 -0
  272. package/src/specs/NativeGooglePayButton.ts +20 -0
  273. package/src/specs/NativeStripeContainer.ts +12 -0
  274. package/src/specs/NativeStripeSdkModule.ts +219 -0
  275. package/src/specs/utils.ts +22 -0
  276. package/src/types/CustomerSheet.ts +1 -5
  277. package/src/types/EmbeddedPaymentElement.tsx +467 -0
  278. package/src/types/PaymentSheet.ts +114 -4
  279. package/src/types/components/CardFieldInput.ts +1 -2
  280. package/src/types/components/CardFormView.ts +1 -1
  281. package/stripe-react-native.podspec +27 -2
  282. package/android/.gradle/8.11.1/checksums/checksums.lock +0 -0
  283. package/android/.gradle/8.11.1/checksums/md5-checksums.bin +0 -0
  284. package/android/.gradle/8.11.1/checksums/sha1-checksums.bin +0 -0
  285. package/android/.gradle/8.11.1/executionHistory/executionHistory.lock +0 -0
  286. package/android/.gradle/8.11.1/fileChanges/last-build.bin +0 -0
  287. package/android/.gradle/8.11.1/fileHashes/fileHashes.lock +0 -0
  288. package/android/.gradle/8.11.1/gc.properties +0 -0
  289. package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
  290. package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
  291. package/android/.gradle/vcs-1/gc.properties +0 -0
  292. package/android/src/main/java/com/reactnativestripesdk/CardChangedEvent.kt +0 -54
  293. package/ios/StripeSdk.m +0 -244
  294. package/lib/commonjs/NativeStripeSdk.js +0 -2
  295. package/lib/commonjs/NativeStripeSdk.js.map +0 -1
  296. package/lib/commonjs/components/ApplePayButtonNative.js +0 -2
  297. package/lib/commonjs/components/ApplePayButtonNative.js.map +0 -1
  298. package/lib/commonjs/components/GooglePayButtonNative.js +0 -2
  299. package/lib/commonjs/components/GooglePayButtonNative.js.map +0 -1
  300. package/lib/module/NativeStripeSdk.js +0 -2
  301. package/lib/module/NativeStripeSdk.js.map +0 -1
  302. package/lib/module/components/ApplePayButtonNative.js +0 -2
  303. package/lib/module/components/ApplePayButtonNative.js.map +0 -1
  304. package/lib/module/components/GooglePayButtonNative.js +0 -2
  305. package/lib/module/components/GooglePayButtonNative.js.map +0 -1
  306. package/lib/typescript/src/NativeStripeSdk.d.ts +0 -58
  307. package/lib/typescript/src/NativeStripeSdk.d.ts.map +0 -1
  308. package/lib/typescript/src/components/ApplePayButtonNative.d.ts +0 -4
  309. package/lib/typescript/src/components/ApplePayButtonNative.d.ts.map +0 -1
  310. package/lib/typescript/src/components/GooglePayButtonNative.d.ts +0 -4
  311. package/lib/typescript/src/components/GooglePayButtonNative.d.ts.map +0 -1
  312. package/src/NativeStripeSdk.tsx +0 -159
  313. package/src/components/ApplePayButtonNative.tsx +0 -5
  314. package/src/components/GooglePayButtonNative.tsx +0 -7
@@ -1,4 +1,3 @@
1
- import type { CardFormView, CardBrand } from '../types';
2
1
  import React, {
3
2
  forwardRef,
4
3
  useCallback,
@@ -9,21 +8,17 @@ import React, {
9
8
  import {
10
9
  AccessibilityProps,
11
10
  NativeSyntheticEvent,
12
- requireNativeComponent,
13
- UIManager,
14
11
  StyleProp,
15
- findNodeHandle,
16
12
  ViewStyle,
17
13
  } from 'react-native';
14
+ import NativeCardForm, { Commands } from '../specs/NativeCardForm';
18
15
  import {
19
16
  currentlyFocusedInput,
20
17
  focusInput,
21
18
  registerInput,
22
19
  unregisterInput,
23
20
  } from '../helpers';
24
-
25
- const CardFormNative =
26
- requireNativeComponent<CardFormView.NativeProps>('CardForm');
21
+ import type { CardBrand, CardFormView } from '../types';
27
22
 
28
23
  /**
29
24
  * Card Form Component Props
@@ -80,11 +75,11 @@ export const CardForm = forwardRef<CardFormView.Methods, Props>(
80
75
  {
81
76
  onFormComplete,
82
77
  cardStyle,
83
- // postalCodeEnabled = true,
84
- // onFocus,
85
- // onBlur,
86
78
  placeholders,
87
79
  defaultValues,
80
+ autofocus,
81
+ dangerouslyGetFullCardDetails,
82
+ disabled,
88
83
  ...props
89
84
  },
90
85
  ref
@@ -92,8 +87,8 @@ export const CardForm = forwardRef<CardFormView.Methods, Props>(
92
87
  const inputRef = useRef<any>(null);
93
88
 
94
89
  const onFormCompleteHandler = useCallback(
95
- (event: NativeSyntheticEvent<CardFormView.Details>) => {
96
- const card = event.nativeEvent;
90
+ (event: NativeSyntheticEvent<{ card: CardFormView.Details }>) => {
91
+ const card = event.nativeEvent.card;
97
92
 
98
93
  const data: CardFormView.Details = {
99
94
  last4: card.last4,
@@ -120,19 +115,11 @@ export const CardForm = forwardRef<CardFormView.Methods, Props>(
120
115
  );
121
116
 
122
117
  const focus = () => {
123
- UIManager.dispatchViewManagerCommand(
124
- findNodeHandle(inputRef.current),
125
- 'focus' as any,
126
- []
127
- );
118
+ Commands.focus(inputRef.current);
128
119
  };
129
120
 
130
121
  const blur = () => {
131
- UIManager.dispatchViewManagerCommand(
132
- findNodeHandle(inputRef.current),
133
- 'blur' as any,
134
- []
135
- );
122
+ Commands.blur(inputRef.current);
136
123
  };
137
124
 
138
125
  useImperativeHandle(ref, () => ({
@@ -145,9 +132,6 @@ export const CardForm = forwardRef<CardFormView.Methods, Props>(
145
132
  const { focusedField } = event.nativeEvent;
146
133
  if (focusedField) {
147
134
  focusInput(inputRef.current);
148
- // onFocus?.(focusedField);
149
- } else {
150
- // onBlur?.();
151
135
  }
152
136
  },
153
137
  []
@@ -168,7 +152,7 @@ export const CardForm = forwardRef<CardFormView.Methods, Props>(
168
152
  }, [inputRef]);
169
153
 
170
154
  return (
171
- <CardFormNative
155
+ <NativeCardForm
172
156
  ref={inputRef}
173
157
  onFormComplete={onFormCompleteHandler}
174
158
  cardStyle={{
@@ -182,8 +166,6 @@ export const CardForm = forwardRef<CardFormView.Methods, Props>(
182
166
  textColor: cardStyle?.textColor,
183
167
  textErrorColor: cardStyle?.textErrorColor,
184
168
  fontFamily: cardStyle?.fontFamily,
185
- // disabledBackgroundColor: cardStyle?.disabledBackgroundColor,
186
- // type: cardStyle?.type,
187
169
  }}
188
170
  placeholders={{
189
171
  number: placeholders?.number,
@@ -195,7 +177,10 @@ export const CardForm = forwardRef<CardFormView.Methods, Props>(
195
177
  ...(defaultValues ?? {}),
196
178
  }}
197
179
  onFocusChange={onFocusHandler}
198
- // postalCodeEnabled={postalCodeEnabled}
180
+ autofocus={autofocus ?? false}
181
+ dangerouslyGetFullCardDetails={dangerouslyGetFullCardDetails ?? false}
182
+ disabled={disabled ?? false}
183
+ postalCodeEnabled
199
184
  {...props}
200
185
  />
201
186
  );
@@ -1,32 +1,30 @@
1
1
  import React from 'react';
2
- import {
3
- NativeEventEmitter,
4
- NativeModules,
5
- EmitterSubscription,
6
- } from 'react-native';
7
- import NativeStripeSdk from '../NativeStripeSdk';
2
+ import { EventSubscription } from 'react-native';
3
+ import NativeStripeSdk from '../specs/NativeStripeSdkModule';
8
4
  import type {
9
5
  CustomerSheetInitParams,
10
6
  CustomerSheetPresentParams,
11
7
  CustomerSheetResult,
12
- CustomerSheetError,
13
- StripeError,
14
8
  CustomerAdapter,
9
+ StripeError,
10
+ CustomerSheetError,
15
11
  } from '../types';
12
+ import { addListener } from '../events';
16
13
 
17
- const eventEmitter = new NativeEventEmitter(NativeModules.StripeSdk);
18
- let fetchPaymentMethodsCallback: EmitterSubscription | null = null;
19
- let attachPaymentMethodCallback: EmitterSubscription | null = null;
20
- let detachPaymentMethodCallback: EmitterSubscription | null = null;
21
- let setSelectedPaymentOptionCallback: EmitterSubscription | null = null;
22
- let fetchSelectedPaymentOptionCallback: EmitterSubscription | null = null;
23
- let setupIntentClientSecretForCustomerAttachCallback: EmitterSubscription | null =
14
+ let fetchPaymentMethodsCallback: EventSubscription | null = null;
15
+ let attachPaymentMethodCallback: EventSubscription | null = null;
16
+ let detachPaymentMethodCallback: EventSubscription | null = null;
17
+ let setSelectedPaymentOptionCallback: EventSubscription | null = null;
18
+ let fetchSelectedPaymentOptionCallback: EventSubscription | null = null;
19
+ let setupIntentClientSecretForCustomerAttachCallback: EventSubscription | null =
24
20
  null;
25
21
 
26
22
  /** Initialize an instance of Customer Sheet with your desired configuration. */
27
23
  const initialize = async (
28
24
  params: CustomerSheetInitParams
29
- ): Promise<{ error?: StripeError<CustomerSheetError> }> => {
25
+ ): Promise<{
26
+ error?: StripeError<CustomerSheetError>;
27
+ }> => {
30
28
  let customerAdapterOverrides = {};
31
29
  if (params.customerAdapter) {
32
30
  customerAdapterOverrides = configureCustomerAdapterEventListeners(
@@ -55,7 +53,7 @@ const configureCustomerAdapterEventListeners = (
55
53
  ): { [Property in keyof CustomerAdapter]: boolean } => {
56
54
  if (customerAdapter.fetchPaymentMethods) {
57
55
  fetchPaymentMethodsCallback?.remove();
58
- fetchPaymentMethodsCallback = eventEmitter.addListener(
56
+ fetchPaymentMethodsCallback = addListener(
59
57
  'onCustomerAdapterFetchPaymentMethodsCallback',
60
58
  async () => {
61
59
  if (customerAdapter.fetchPaymentMethods) {
@@ -74,9 +72,9 @@ const configureCustomerAdapterEventListeners = (
74
72
 
75
73
  if (customerAdapter.attachPaymentMethod) {
76
74
  attachPaymentMethodCallback?.remove();
77
- attachPaymentMethodCallback = eventEmitter.addListener(
75
+ attachPaymentMethodCallback = addListener(
78
76
  'onCustomerAdapterAttachPaymentMethodCallback',
79
- async ({ paymentMethodId }: { paymentMethodId: string }) => {
77
+ async ({ paymentMethodId }) => {
80
78
  if (customerAdapter.attachPaymentMethod) {
81
79
  const paymentMethod =
82
80
  await customerAdapter.attachPaymentMethod(paymentMethodId);
@@ -94,9 +92,9 @@ const configureCustomerAdapterEventListeners = (
94
92
 
95
93
  if (customerAdapter.detachPaymentMethod) {
96
94
  detachPaymentMethodCallback?.remove();
97
- detachPaymentMethodCallback = eventEmitter.addListener(
95
+ detachPaymentMethodCallback = addListener(
98
96
  'onCustomerAdapterDetachPaymentMethodCallback',
99
- async ({ paymentMethodId }: { paymentMethodId: string }) => {
97
+ async ({ paymentMethodId }) => {
100
98
  if (customerAdapter.detachPaymentMethod) {
101
99
  const paymentMethod =
102
100
  await customerAdapter.detachPaymentMethod(paymentMethodId);
@@ -114,9 +112,9 @@ const configureCustomerAdapterEventListeners = (
114
112
 
115
113
  if (customerAdapter.setSelectedPaymentOption) {
116
114
  setSelectedPaymentOptionCallback?.remove();
117
- setSelectedPaymentOptionCallback = eventEmitter.addListener(
115
+ setSelectedPaymentOptionCallback = addListener(
118
116
  'onCustomerAdapterSetSelectedPaymentOptionCallback',
119
- async ({ paymentOption }: { paymentOption: string }) => {
117
+ async ({ paymentOption }) => {
120
118
  if (customerAdapter.setSelectedPaymentOption) {
121
119
  await customerAdapter.setSelectedPaymentOption(paymentOption);
122
120
  await NativeStripeSdk.customerAdapterSetSelectedPaymentOptionCallback();
@@ -131,7 +129,7 @@ const configureCustomerAdapterEventListeners = (
131
129
 
132
130
  if (customerAdapter.fetchSelectedPaymentOption) {
133
131
  fetchSelectedPaymentOptionCallback?.remove();
134
- fetchSelectedPaymentOptionCallback = eventEmitter.addListener(
132
+ fetchSelectedPaymentOptionCallback = addListener(
135
133
  'onCustomerAdapterFetchSelectedPaymentOptionCallback',
136
134
  async () => {
137
135
  if (customerAdapter.fetchSelectedPaymentOption) {
@@ -151,7 +149,7 @@ const configureCustomerAdapterEventListeners = (
151
149
 
152
150
  if (customerAdapter.setupIntentClientSecretForCustomerAttach) {
153
151
  setupIntentClientSecretForCustomerAttachCallback?.remove();
154
- setupIntentClientSecretForCustomerAttachCallback = eventEmitter.addListener(
152
+ setupIntentClientSecretForCustomerAttachCallback = addListener(
155
153
  'onCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback',
156
154
  async () => {
157
155
  if (customerAdapter.setupIntentClientSecretForCustomerAttach) {
@@ -8,15 +8,15 @@ import {
8
8
  Platform,
9
9
  NativeSyntheticEvent,
10
10
  } from 'react-native';
11
- import NativeStripeSdk from '../NativeStripeSdk';
11
+ import NativeStripeSdk from '../specs/NativeStripeSdkModule';
12
12
  import {
13
13
  ButtonType,
14
14
  ButtonStyle,
15
15
  ShippingMethod,
16
16
  ShippingContact,
17
17
  } from '../types/PlatformPay';
18
- import GooglePayButtonNative from './GooglePayButtonNative';
19
- import ApplePayButtonNative from './ApplePayButtonNative';
18
+ import NativeApplePayButton from '../specs/NativeApplePayButton';
19
+ import NativeGooglePayButton from '../specs/NativeGooglePayButton';
20
20
 
21
21
  /**
22
22
  * PlatformPayButton Component Props
@@ -149,11 +149,11 @@ export function PlatformPayButton({
149
149
  style={[disabled ? styles.disabled : styles.notDisabled, style]}
150
150
  >
151
151
  {Platform.OS === 'ios' ? (
152
- <ApplePayButtonNative
152
+ <NativeApplePayButton
153
153
  type={type}
154
154
  buttonStyle={appearance}
155
155
  borderRadius={borderRadius}
156
- disabled={disabled}
156
+ disabled={disabled ?? false}
157
157
  onShippingMethodSelectedAction={shippingMethodCallback}
158
158
  onShippingContactSelectedAction={shippingContactCallback}
159
159
  onCouponCodeEnteredAction={couponCodeCallback}
@@ -162,7 +162,7 @@ export function PlatformPayButton({
162
162
  {...props}
163
163
  />
164
164
  ) : (
165
- <GooglePayButtonNative
165
+ <NativeGooglePayButton
166
166
  type={type}
167
167
  appearance={appearance}
168
168
  borderRadius={borderRadius}
@@ -1,14 +1,7 @@
1
1
  import React from 'react';
2
2
 
3
- import {
4
- requireNativeComponent,
5
- StyleProp,
6
- StyleSheet,
7
- ViewStyle,
8
- View,
9
- } from 'react-native';
10
-
11
- const StripeContainerNative = requireNativeComponent<any>('StripeContainer');
3
+ import { StyleProp, StyleSheet, ViewStyle, View } from 'react-native';
4
+ import NativeStripeContainer from '../specs/NativeStripeContainer';
12
5
 
13
6
  /**
14
7
  * Stripe Container Component Props
@@ -31,14 +24,14 @@ export function StripeContainer({
31
24
  children,
32
25
  }: Props) {
33
26
  return (
34
- <StripeContainerNative
35
- keyboardShouldPersistTaps={keyboardShouldPersistTaps}
27
+ <NativeStripeContainer
28
+ keyboardShouldPersistTaps={keyboardShouldPersistTaps ?? true}
36
29
  style={styles.container}
37
30
  >
38
31
  <View style={styles.container} accessible={false}>
39
32
  {children}
40
33
  </View>
41
- </StripeContainerNative>
34
+ </NativeStripeContainer>
42
35
  );
43
36
  }
44
37
 
@@ -1,6 +1,6 @@
1
1
  import React, { useEffect } from 'react';
2
2
 
3
- import NativeStripeSdk from '../NativeStripeSdk';
3
+ import NativeStripeSdk from '../specs/NativeStripeSdkModule';
4
4
  import { isAndroid, shouldAttributeExpo } from '../helpers';
5
5
  import type { AppInfo, InitStripeParams, InitialiseParams } from '../types';
6
6
  import pjson from '../../package.json';
package/src/events.ts ADDED
@@ -0,0 +1,49 @@
1
+ /**
2
+ * Compatibility helper to use new arch events if available and fallback
3
+ * to NativeEventEmitter or DeviceEventEmitter.
4
+ *
5
+ * Can be removed once we no longer need to support the old arch and use
6
+ * the methods on NativeStripeSdkModule directly.
7
+ */
8
+
9
+ import {
10
+ DeviceEventEmitter,
11
+ EventSubscription,
12
+ NativeEventEmitter,
13
+ Platform,
14
+ } from 'react-native';
15
+ import NativeStripeSdkModule from './specs/NativeStripeSdkModule';
16
+
17
+ const compatEventEmitter =
18
+ // On new arch we use native module events. On old arch this doesn't exist
19
+ // so use NativeEventEmitter on iOS and DeviceEventEmitter on Android.
20
+ NativeStripeSdkModule.onConfirmHandlerCallback == null
21
+ ? Platform.OS === 'ios'
22
+ ? new NativeEventEmitter(NativeStripeSdkModule as any)
23
+ : DeviceEventEmitter
24
+ : null;
25
+
26
+ type Events =
27
+ | 'onConfirmHandlerCallback'
28
+ | 'onFinancialConnectionsEvent'
29
+ | 'onOrderTrackingCallback'
30
+ | 'onCustomerAdapterFetchPaymentMethodsCallback'
31
+ | 'onCustomerAdapterAttachPaymentMethodCallback'
32
+ | 'onCustomerAdapterDetachPaymentMethodCallback'
33
+ | 'onCustomerAdapterSetSelectedPaymentOptionCallback'
34
+ | 'onCustomerAdapterFetchSelectedPaymentOptionCallback'
35
+ | 'onCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback'
36
+ | 'embeddedPaymentElementFormSheetConfirmComplete'
37
+ | 'embeddedPaymentElementDidUpdatePaymentOption'
38
+ | 'embeddedPaymentElementDidUpdateHeight'
39
+ | 'embeddedPaymentElementLoadingFailed';
40
+
41
+ export function addListener<EventT extends Events>(
42
+ event: EventT,
43
+ handler: Parameters<(typeof NativeStripeSdkModule)[EventT]>[0]
44
+ ): EventSubscription {
45
+ if (compatEventEmitter != null) {
46
+ return compatEventEmitter.addListener(event, handler);
47
+ }
48
+ return NativeStripeSdkModule[event](handler as any);
49
+ }
package/src/functions.ts CHANGED
@@ -1,6 +1,6 @@
1
1
  import { createError } from './helpers';
2
2
  import { MissingRoutingNumber } from './types/Errors';
3
- import NativeStripeSdk from './NativeStripeSdk';
3
+ import NativeStripeSdk from './specs/NativeStripeSdkModule';
4
4
  import type {
5
5
  PlatformPayError,
6
6
  ConfirmPaymentResult,
@@ -32,14 +32,10 @@ import type {
32
32
  FinancialConnections,
33
33
  PlatformPay,
34
34
  } from './types';
35
- import {
36
- Platform,
37
- NativeEventEmitter,
38
- NativeModules,
39
- EmitterSubscription,
40
- } from 'react-native';
35
+ import { Platform, EventSubscription } from 'react-native';
41
36
  import type { CollectFinancialConnectionsAccountsParams } from './types/FinancialConnections';
42
37
  import type { CollectBankAccountTokenParams } from './types/PaymentMethod';
38
+ import { addListener } from './events';
43
39
 
44
40
  export const createPaymentMethod = async (
45
41
  params: PaymentMethod.CreateParams,
@@ -353,10 +349,9 @@ export const verifyMicrodepositsForSetup = async (
353
349
  }
354
350
  };
355
351
 
356
- const eventEmitter = new NativeEventEmitter(NativeModules.StripeSdk);
357
- let confirmHandlerCallback: EmitterSubscription | null = null;
358
- let orderTrackingCallbackListener: EmitterSubscription | null = null;
359
- let financialConnectionsEventListener: EmitterSubscription | null = null;
352
+ let confirmHandlerCallback: EventSubscription | null = null;
353
+ let orderTrackingCallbackListener: EventSubscription | null = null;
354
+ let financialConnectionsEventListener: EventSubscription | null = null;
360
355
 
361
356
  export const initPaymentSheet = async (
362
357
  params: PaymentSheet.SetupParams
@@ -365,15 +360,9 @@ export const initPaymentSheet = async (
365
360
  const confirmHandler = params?.intentConfiguration?.confirmHandler;
366
361
  if (confirmHandler) {
367
362
  confirmHandlerCallback?.remove();
368
- confirmHandlerCallback = eventEmitter.addListener(
363
+ confirmHandlerCallback = addListener(
369
364
  'onConfirmHandlerCallback',
370
- ({
371
- paymentMethod,
372
- shouldSavePaymentMethod,
373
- }: {
374
- paymentMethod: PaymentMethod.Result;
375
- shouldSavePaymentMethod: boolean;
376
- }) => {
365
+ ({ paymentMethod, shouldSavePaymentMethod }) => {
377
366
  confirmHandler(
378
367
  paymentMethod,
379
368
  shouldSavePaymentMethod,
@@ -386,7 +375,7 @@ export const initPaymentSheet = async (
386
375
  const orderTrackingCallback = params?.applePay?.setOrderTracking;
387
376
  if (orderTrackingCallback) {
388
377
  orderTrackingCallbackListener?.remove();
389
- orderTrackingCallbackListener = eventEmitter.addListener(
378
+ orderTrackingCallbackListener = addListener(
390
379
  'onOrderTrackingCallback',
391
380
  () => {
392
381
  orderTrackingCallback(NativeStripeSdk.configureOrderTracking);
@@ -471,7 +460,7 @@ export const collectBankAccountForPayment = async (
471
460
  financialConnectionsEventListener?.remove();
472
461
 
473
462
  if (params.onEvent) {
474
- financialConnectionsEventListener = eventEmitter.addListener(
463
+ financialConnectionsEventListener = addListener(
475
464
  'onFinancialConnectionsEvent',
476
465
  params.onEvent
477
466
  );
@@ -509,7 +498,7 @@ export const collectBankAccountForSetup = async (
509
498
  financialConnectionsEventListener?.remove();
510
499
 
511
500
  if (params.onEvent) {
512
- financialConnectionsEventListener = eventEmitter.addListener(
501
+ financialConnectionsEventListener = addListener(
513
502
  'onFinancialConnectionsEvent',
514
503
  params.onEvent
515
504
  );
@@ -554,7 +543,7 @@ export const collectBankAccountToken = async (
554
543
  financialConnectionsEventListener?.remove();
555
544
 
556
545
  if (params.onEvent) {
557
- financialConnectionsEventListener = eventEmitter.addListener(
546
+ financialConnectionsEventListener = addListener(
558
547
  'onFinancialConnectionsEvent',
559
548
  params.onEvent
560
549
  );
@@ -597,7 +586,7 @@ export const collectFinancialConnectionsAccounts = async (
597
586
  financialConnectionsEventListener?.remove();
598
587
 
599
588
  if (params.onEvent) {
600
- financialConnectionsEventListener = eventEmitter.addListener(
589
+ financialConnectionsEventListener = addListener(
601
590
  'onFinancialConnectionsEvent',
602
591
  params.onEvent
603
592
  );
@@ -1,7 +1,7 @@
1
1
  import { useState, useCallback } from 'react';
2
2
  import { useStripe } from './useStripe';
3
- import type { CollectFinancialConnectionsAccountsParams } from 'src/types/FinancialConnections';
4
- import type { CollectBankAccountTokenParams } from 'src/types/PaymentMethod';
3
+ import type { CollectFinancialConnectionsAccountsParams } from '../types/FinancialConnections';
4
+ import type { CollectBankAccountTokenParams } from '../types/PaymentMethod';
5
5
 
6
6
  /**
7
7
  * React hook for accessing functions on the Financial Connections sheet.
@@ -60,8 +60,8 @@ import {
60
60
  updatePlatformPaySheet,
61
61
  openPlatformPaySetup,
62
62
  } from '../functions';
63
- import type { CollectBankAccountTokenParams } from 'src/types/PaymentMethod';
64
- import type { CollectFinancialConnectionsAccountsParams } from 'src/types/FinancialConnections';
63
+ import type { CollectBankAccountTokenParams } from '../types/PaymentMethod';
64
+ import type { CollectFinancialConnectionsAccountsParams } from '../types/FinancialConnections';
65
65
 
66
66
  /**
67
67
  * useStripe hook
package/src/index.tsx CHANGED
@@ -30,3 +30,6 @@ export * from './types/index';
30
30
 
31
31
  export * from './components/CustomerSheet';
32
32
  export type { Props as CustomerSheetProps } from './components/CustomerSheet';
33
+
34
+ export * from './types/EmbeddedPaymentElement';
35
+ export * from './types/PaymentSheet';
@@ -0,0 +1,40 @@
1
+ import type { HostComponent, ViewProps } from 'react-native';
2
+ import type {
3
+ DirectEventHandler,
4
+ WithDefault,
5
+ } from 'react-native/Libraries/Types/CodegenTypes';
6
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
7
+ import type {
8
+ CardActionError,
9
+ GooglePayCardToken,
10
+ StripeError,
11
+ } from '../types';
12
+ import type { UnsafeMixed, ImageSource } from './utils';
13
+
14
+ type AddToWalletButtonCompleteEvent = Readonly<{
15
+ error: UnsafeMixed<StripeError<CardActionError>> | null;
16
+ }>;
17
+
18
+ type CardDetails = Readonly<{
19
+ primaryAccountIdentifier: string | null;
20
+ name: string;
21
+ description: string;
22
+ lastFour?: string;
23
+ brand?: string;
24
+ }>;
25
+
26
+ export interface NativeProps extends ViewProps {
27
+ iOSButtonStyle?: WithDefault<string, 'onDarkBackground'>;
28
+ androidAssetSource: ImageSource;
29
+ testEnv?: boolean;
30
+ cardDetails: UnsafeMixed<CardDetails>;
31
+ token?: UnsafeMixed<GooglePayCardToken> | null;
32
+ ephemeralKey: UnsafeMixed<object>;
33
+ onCompleteAction?: DirectEventHandler<AddToWalletButtonCompleteEvent>;
34
+ }
35
+
36
+ type ComponentType = HostComponent<NativeProps>;
37
+
38
+ export default codegenNativeComponent<NativeProps>(
39
+ 'AddToWalletButton'
40
+ ) as ComponentType;
@@ -0,0 +1,50 @@
1
+ import type { HostComponent, ViewProps } from 'react-native';
2
+ import type {
3
+ DirectEventHandler,
4
+ WithDefault,
5
+ } from 'react-native/Libraries/Types/CodegenTypes';
6
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
7
+ import type {
8
+ AddressDetails,
9
+ AddressSheetError,
10
+ PaymentSheet,
11
+ StripeError,
12
+ } from '../types';
13
+ import type { UnsafeMixed } from './utils';
14
+
15
+ type CollectAddressResult = Required<AddressDetails>;
16
+
17
+ type AddressSheetErrorEvent = Readonly<{
18
+ error: UnsafeMixed<StripeError<AddressSheetError>>;
19
+ }>;
20
+
21
+ type AdditionalFields = Readonly<{
22
+ phoneNumber?: string;
23
+ checkboxLabel?: string;
24
+ }>;
25
+
26
+ type OnSubmitActionEvent = Readonly<{
27
+ result: UnsafeMixed<CollectAddressResult>;
28
+ }>;
29
+
30
+ export interface NativeProps extends ViewProps {
31
+ visible: boolean;
32
+ presentationStyle?: WithDefault<string, 'popover'>;
33
+ animationStyle?: WithDefault<string, 'slide'>;
34
+ appearance?: UnsafeMixed<PaymentSheet.AppearanceParams>;
35
+ defaultValues?: UnsafeMixed<AddressDetails>;
36
+ additionalFields?: UnsafeMixed<AdditionalFields>;
37
+ allowedCountries?: Array<string>;
38
+ autocompleteCountries?: Array<string>;
39
+ primaryButtonTitle?: string;
40
+ sheetTitle?: string;
41
+ googlePlacesApiKey?: string;
42
+ onSubmitAction: DirectEventHandler<OnSubmitActionEvent>;
43
+ onErrorAction: DirectEventHandler<AddressSheetErrorEvent>;
44
+ }
45
+
46
+ type ComponentType = HostComponent<NativeProps>;
47
+
48
+ export default codegenNativeComponent<NativeProps>(
49
+ 'AddressSheetView'
50
+ ) as ComponentType;
@@ -0,0 +1,40 @@
1
+ import type { HostComponent, ViewProps } from 'react-native';
2
+ import type {
3
+ DirectEventHandler,
4
+ Int32,
5
+ WithDefault,
6
+ } from 'react-native/Libraries/Types/CodegenTypes';
7
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
8
+ import { ShippingContact, ShippingMethod } from '../types/PlatformPay';
9
+ import { UnsafeMixed } from './utils';
10
+
11
+ type OnShippingMethodSelectedActionEvent = {
12
+ shippingMethod: UnsafeMixed<ShippingMethod>;
13
+ };
14
+
15
+ type OnShippingContactSelectedActionEvent = {
16
+ shippingContact: UnsafeMixed<ShippingContact>;
17
+ };
18
+
19
+ type OnCouponCodeEnteredActionEvent = {
20
+ couponCode: string;
21
+ };
22
+
23
+ type OnOrderTrackingActionEvent = {};
24
+
25
+ export interface NativeProps extends ViewProps {
26
+ disabled: boolean;
27
+ type: Int32;
28
+ buttonStyle: Int32;
29
+ borderRadius?: WithDefault<Int32, 4>;
30
+ onShippingMethodSelectedAction?: DirectEventHandler<OnShippingMethodSelectedActionEvent>;
31
+ onShippingContactSelectedAction?: DirectEventHandler<OnShippingContactSelectedActionEvent>;
32
+ onCouponCodeEnteredAction?: DirectEventHandler<OnCouponCodeEnteredActionEvent>;
33
+ onOrderTrackingAction?: DirectEventHandler<OnOrderTrackingActionEvent>;
34
+ }
35
+
36
+ type ComponentType = HostComponent<NativeProps>;
37
+
38
+ export default codegenNativeComponent<NativeProps>(
39
+ 'ApplePayButton'
40
+ ) as ComponentType;
@@ -0,0 +1,24 @@
1
+ import type { HostComponent, ViewProps } from 'react-native';
2
+ import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
3
+ import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
4
+ import type { AuBECSDebitFormComponent } from '../types';
5
+ import type { UnsafeMixed } from './utils';
6
+
7
+ type FormDetailsEvent = Readonly<{
8
+ accountNumber: string;
9
+ bsbNumber: string;
10
+ email: string;
11
+ name: string;
12
+ }>;
13
+
14
+ export interface NativeProps extends ViewProps {
15
+ companyName: string;
16
+ onCompleteAction: DirectEventHandler<FormDetailsEvent>;
17
+ formStyle?: UnsafeMixed<AuBECSDebitFormComponent.Styles>;
18
+ }
19
+
20
+ type ComponentType = HostComponent<NativeProps>;
21
+
22
+ export default codegenNativeComponent<NativeProps>(
23
+ 'AuBECSDebitForm'
24
+ ) as ComponentType;