@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
@@ -0,0 +1,467 @@
1
+ /* eslint-disable react-native/no-inline-styles */
2
+ import {
3
+ LayoutAnimation,
4
+ Platform,
5
+ findNodeHandle,
6
+ EventSubscription,
7
+ HostComponent,
8
+ } from 'react-native';
9
+ import type {
10
+ BillingDetails,
11
+ AddressDetails,
12
+ UserInterfaceStyle,
13
+ CardBrand,
14
+ } from './Common';
15
+ import type { PaymentMethod } from '.';
16
+ import * as PaymentSheetTypes from './PaymentSheet';
17
+ import NativeStripeSdkModule from '../specs/NativeStripeSdkModule';
18
+ import {
19
+ ReactElement,
20
+ useCallback,
21
+ useEffect,
22
+ useMemo,
23
+ useRef,
24
+ useState,
25
+ } from 'react';
26
+
27
+ import React from 'react';
28
+ import { addListener } from '../events';
29
+ import NativeEmbeddedPaymentElement, {
30
+ Commands,
31
+ NativeProps,
32
+ } from '../specs/NativeEmbeddedPaymentElement';
33
+
34
+ // -----------------------------------------------------------------------------
35
+ // Types
36
+ // -----------------------------------------------------------------------------
37
+
38
+ /**
39
+ * The final result of a confirm call.
40
+ * Typically: payment succeeded (“completed”), canceled, or failed with error.
41
+ */
42
+ export type EmbeddedPaymentElementResult =
43
+ | { status: 'completed' }
44
+ | { status: 'canceled' }
45
+ | { status: 'failed'; error: Error };
46
+
47
+ /**
48
+ * Contains details about a payment method that can be displayed to the customer in the embedded payment element UI.
49
+ */
50
+ export interface PaymentOptionDisplayData {
51
+ /**
52
+ * A user-facing label for the payment method, like "Apple Pay" or "•••• 4242" for a card.
53
+ */
54
+ label: string;
55
+ /**
56
+ * Optional billing details associated with the payment method, such as name, email, or address.
57
+ */
58
+ billingDetails?: BillingDetails;
59
+ /**
60
+ * A string identifier for the type of payment method.
61
+ * Stripe values: https://stripe.com/docs/api/payment_methods/object#payment_method_object-type
62
+ * External methods: https://stripe.com/docs/payments/external-payment-methods?platform=ios#available-external-payment-methods
63
+ * Apple Pay: "apple_pay"
64
+ */
65
+ paymentMethodType: string;
66
+ }
67
+
68
+ /**
69
+ * Describes the action performed when the bottom button in the embedded payment form sheet is tapped.
70
+ * The embedded view may show payment method options such as "Card". When selected, a form sheet appears
71
+ * for customers to input their payment details. At the bottom of that form sheet is a button.
72
+ * This type determines what tapping that button does:
73
+ * - In the `confirm` case, the button says “Pay” or “Set up” and triggers confirmation of the payment or setup intent inside the sheet.
74
+ * - In the `continue` case, the button says “Continue” and simply dismisses the sheet. The payment or setup is then confirmed outside the sheet, typically in your app.
75
+ */
76
+ export type EmbeddedFormSheetAction =
77
+ | {
78
+ /**
79
+ * The button says “Pay” or “Set up”. When tapped, it confirms the payment or setup directly within the form sheet.
80
+ * @param result - Callback invoked with the result of the confirmation. You can use this to show a success message or handle errors.
81
+ */
82
+ type: 'confirm';
83
+ onFormSheetConfirmComplete?: (
84
+ result: EmbeddedPaymentElementResult
85
+ ) => void;
86
+ }
87
+ | {
88
+ /**
89
+ * The button says “Continue”. When tapped, the form sheet closes without confirming anything.
90
+ * Use this when you want to handle confirmation elsewhere in your app after the customer has filled in their details.
91
+ */
92
+ type: 'continue';
93
+ };
94
+
95
+ /**
96
+ * Configuration object (subset of EmbeddedPaymentElement.Configuration).
97
+ */
98
+ export interface EmbeddedPaymentElementConfiguration {
99
+ /** Your customer-facing business name. On Android, this is required and cannot be an empty string. */
100
+ merchantDisplayName: string;
101
+ /** The identifier of the Stripe Customer object. See https://stripe.com/docs/api/customers/object#customer_object-id */
102
+ customerId?: string;
103
+ /** iOS only. Enable Apple Pay in the Payment Sheet by passing an ApplePayParams object. */
104
+ applePay?: PaymentSheetTypes.ApplePayParams;
105
+ /** Android only. Enable Google Pay in the Payment Sheet by passing a GooglePayParams object. */
106
+ googlePay?: PaymentSheetTypes.GooglePayParams;
107
+ /** Configuration for Link */
108
+ link?: PaymentSheetTypes.LinkParams;
109
+ /** The color styling to use for PaymentSheet UI. Defaults to 'automatic'. */
110
+ style?: UserInterfaceStyle;
111
+ /** A URL that redirects back to your app that EmbeddedPaymentElement can use to auto-dismiss web views used for additional authentication, e.g. 3DS2 */
112
+ returnURL?: string;
113
+ /** Configuration for how billing details are collected during checkout. */
114
+ billingDetailsCollectionConfiguration?: PaymentSheetTypes.BillingDetailsCollectionConfiguration;
115
+ /** PaymentSheet pre-populates the billing fields that are displayed in the Payment Sheet (only country and postal code, as of this version) with the values provided. */
116
+ defaultBillingDetails?: BillingDetails;
117
+ /**
118
+ * The shipping information for the customer. If set, EmbeddedPaymentElement will pre-populate the form fields with the values provided.
119
+ * This is used to display a "Billing address is same as shipping" checkbox if `defaultBillingDetails` is not provided.
120
+ * If `name` and `line1` are populated, it's also [attached to the PaymentIntent](https://stripe.com/docs/api/payment_intents/object#payment_intent_object-shipping) during payment.
121
+ */
122
+ defaultShippingDetails?: AddressDetails;
123
+ /** If true, allows payment methods that do not move money at the end of the checkout. Defaults to false.
124
+ *
125
+ * Some payment methods can’t guarantee you will receive funds from your customer at the end of the checkout
126
+ * because they take time to settle (eg. most bank debits, like SEPA or ACH) or require customer action to
127
+ * complete (e.g. OXXO, Konbini, Boleto). If this is set to true, make sure your integration listens to webhooks
128
+ * for notifications on whether a payment has succeeded or not.
129
+ */
130
+ allowsDelayedPaymentMethods?: boolean;
131
+ /** Customizes the appearance of EmbeddedPaymentElement */
132
+ appearance?: PaymentSheetTypes.AppearanceParams;
133
+ /** The label to use for the primary button. If not set, Payment Sheet will display suitable default labels for payment and setup intents. */
134
+ primaryButtonLabel?: string;
135
+ /** Optional configuration to display a custom message when a saved payment method is removed. iOS only. */
136
+ removeSavedPaymentMethodMessage?: string;
137
+ /** The list of preferred networks that should be used to process payments made with a co-branded card.
138
+ * This value will only be used if your user hasn't selected a network themselves. */
139
+ preferredNetworks?: Array<CardBrand>;
140
+ /** By default, EmbeddedPaymentElement will use a dynamic ordering that optimizes payment method display for the customer.
141
+ * You can override the default order in which payment methods are displayed in EmbeddedPaymentElement with a list of payment method types.
142
+ * See https://stripe.com/docs/api/payment_methods/object#payment_method_object-type for the list of valid types. You may also pass external payment methods.
143
+ * - Example: ["card", "external_paypal", "klarna"]
144
+ * - Note: If you omit payment methods from this list, they’ll be automatically ordered by Stripe after the ones you provide. Invalid payment methods are ignored.
145
+ */
146
+ paymentMethodOrder?: Array<String>;
147
+ /** This is an experimental feature that may be removed at any time.
148
+ * Defaults to true. If true, the customer can delete all saved payment methods.
149
+ * If false, the customer can't delete if they only have one saved payment method remaining.
150
+ */
151
+ allowsRemovalOfLastSavedPaymentMethod?: boolean;
152
+ /**
153
+ * By default, EmbeddedPaymentElement will accept all supported cards by Stripe.
154
+ * You can specify card brands EmbeddedPaymentElement should block or allow payment for by providing an array of those card brands.
155
+ * Note: This is only a client-side solution.
156
+ * Note: Card brand filtering is not currently supported in Link.
157
+ */
158
+ cardBrandAcceptance?: PaymentSheetTypes.CardBrandAcceptance;
159
+ /** The view can display payment methods like “Card” that, when tapped, open a sheet where customers enter their payment method details.
160
+ * The sheet has a button at the bottom. `formSheetAction` controls the action the button performs.
161
+ */
162
+ formSheetAction?: EmbeddedFormSheetAction;
163
+ }
164
+
165
+ // -----------------------------------------------------------------------------
166
+ // Embedded API
167
+ // -----------------------------------------------------------------------------
168
+
169
+ class EmbeddedPaymentElement {
170
+ /**
171
+ * Call this when the intent configuration changes (e.g., amount or currency).
172
+ * Cancels any in-progress update. Ensures the correct payment methods are shown and fields are collected.
173
+ * If the selected payment option becomes invalid, it may be cleared.
174
+ * Returns the final result of the update; earlier in-flight updates will return `{ status: 'canceled' }`.
175
+ */
176
+ async update(intentConfig: PaymentSheetTypes.IntentConfiguration) {
177
+ const result =
178
+ await NativeStripeSdkModule.updateEmbeddedPaymentElement(intentConfig);
179
+ return result;
180
+ }
181
+
182
+ /**
183
+ * Confirm the payment or setup intent.
184
+ * Waits for any in-progress `update()` call to finish before proceeding.
185
+ * May present authentication flows (e.g., 3DS) if required.
186
+ * Requires the most recent `update()` call to have succeeded.
187
+ * Returns the final result: success, failure, or cancellation.
188
+ */
189
+ async confirm(): Promise<EmbeddedPaymentElementResult> {
190
+ const result =
191
+ await NativeStripeSdkModule.confirmEmbeddedPaymentElement(-1);
192
+ return result;
193
+ }
194
+
195
+ /** Clear the currently selected payment option (reset to null). */
196
+ clearPaymentOption(): void {
197
+ NativeStripeSdkModule.clearEmbeddedPaymentOption(-1);
198
+ }
199
+ }
200
+
201
+ // -----------------------------------------------------------------------------
202
+ // JS Factory: createEmbeddedPaymentElement
203
+ // -----------------------------------------------------------------------------
204
+ let confirmHandlerCallback: EventSubscription | null = null;
205
+ let formSheetActionConfirmCallback: EventSubscription | null = null;
206
+
207
+ async function createEmbeddedPaymentElement(
208
+ intentConfig: PaymentSheetTypes.IntentConfiguration,
209
+ configuration: EmbeddedPaymentElementConfiguration
210
+ ): Promise<EmbeddedPaymentElement> {
211
+ setupConfirmHandlers(intentConfig, configuration);
212
+
213
+ await NativeStripeSdkModule.createEmbeddedPaymentElement(
214
+ intentConfig,
215
+ configuration
216
+ );
217
+ return new EmbeddedPaymentElement();
218
+ }
219
+
220
+ function setupConfirmHandlers(
221
+ intentConfig: PaymentSheetTypes.IntentConfiguration,
222
+ configuration: EmbeddedPaymentElementConfiguration
223
+ ) {
224
+ const confirmHandler = intentConfig.confirmHandler;
225
+ if (confirmHandler) {
226
+ confirmHandlerCallback?.remove();
227
+ confirmHandlerCallback = addListener(
228
+ 'onConfirmHandlerCallback',
229
+ ({
230
+ paymentMethod,
231
+ shouldSavePaymentMethod,
232
+ }: {
233
+ paymentMethod: PaymentMethod.Result;
234
+ shouldSavePaymentMethod: boolean;
235
+ }) => {
236
+ confirmHandler(
237
+ paymentMethod,
238
+ shouldSavePaymentMethod,
239
+ NativeStripeSdkModule.intentCreationCallback
240
+ );
241
+ }
242
+ );
243
+ }
244
+
245
+ if (configuration.formSheetAction?.type === 'confirm') {
246
+ const confirmFormSheetHandler =
247
+ configuration.formSheetAction.onFormSheetConfirmComplete;
248
+ if (confirmFormSheetHandler) {
249
+ formSheetActionConfirmCallback?.remove();
250
+ formSheetActionConfirmCallback = addListener(
251
+ 'embeddedPaymentElementFormSheetConfirmComplete',
252
+ (result: EmbeddedPaymentElementResult) => {
253
+ // Pass the result back to the formSheetAction handler
254
+ confirmFormSheetHandler(result);
255
+ }
256
+ );
257
+ }
258
+ }
259
+ }
260
+
261
+ // -----------------------------------------------------------------------------
262
+ // Hook: useEmbeddedPaymentElement
263
+ // -----------------------------------------------------------------------------
264
+ export interface UseEmbeddedPaymentElementResult {
265
+ // A view that displays payment methods. It can present a sheet to collect more details or display saved payment methods.
266
+ embeddedPaymentElementView: ReactElement | null;
267
+ /**
268
+ * Contains information about the customer's selected payment option.
269
+ * Use this to display the payment option in your own UI
270
+ */
271
+ paymentOption: PaymentOptionDisplayData | null;
272
+ /**
273
+ * Completes the payment or setup.
274
+ * @returns {Promise} The result of the payment after any presented view controllers are dismissed.
275
+ * @note This method requires that the last call to `update` succeeded. If the last `update` call failed, this call will fail. If this method is called while a call to `update` is in progress, it waits until the `update` call completes.
276
+ */
277
+ confirm: () => Promise<EmbeddedPaymentElementResult>;
278
+ /**
279
+ * Call this method when the IntentConfiguration values you used to initialize `EmbeddedPaymentElement` (amount, currency, etc.) change.
280
+ * This ensures the appropriate payment methods are displayed, collect the right fields, etc.
281
+ * @param {Object} intentConfiguration - An updated IntentConfiguration.
282
+ * @throws {Error} Sets loadingError if the update fails.
283
+ * @note Upon completion, `paymentOption` may become null if it's no longer available.
284
+ * @note If you call `update` while a previous call to `update` is still in progress, the previous call is canceled.
285
+ */
286
+ update: (intentConfig: PaymentSheetTypes.IntentConfiguration) => void;
287
+ // Sets the currently selected payment option to null
288
+ clearPaymentOption: () => void;
289
+ // Any error encountered during creation/update, or null
290
+ loadingError: Error | null;
291
+ }
292
+
293
+ /**
294
+ * An asynchronous failable initializer
295
+ * Loads the Customer's payment methods, their default payment method, etc.
296
+ * @param {Object} intentConfiguration - Information about the PaymentIntent or SetupIntent you will create later to complete the confirmation.
297
+ * @param {Object} configuration - Configuration for the PaymentSheet. e.g. your business name, customer details, etc.
298
+ * @returns {EmbeddedPaymentElement|null} A valid EmbeddedPaymentElement instance if successful, null otherwise.
299
+ * @description If loading fails, this function sets the loadingError state variable instead of throwing an error.
300
+ */
301
+ export function useEmbeddedPaymentElement(
302
+ intentConfig: PaymentSheetTypes.IntentConfiguration,
303
+ configuration: EmbeddedPaymentElementConfiguration
304
+ ): UseEmbeddedPaymentElementResult {
305
+ const isAndroid = Platform.OS === 'android';
306
+ const elementRef = useRef<EmbeddedPaymentElement | null>(null);
307
+ const [element, setElement] = useState<EmbeddedPaymentElement | null>(null);
308
+ const [paymentOption, setPaymentOption] =
309
+ useState<PaymentOptionDisplayData | null>(null);
310
+ const [height, setHeight] = useState<number | undefined>();
311
+ const viewRef = useRef<React.ComponentRef<HostComponent<NativeProps>>>(null);
312
+ const [loadingError, setLoadingError] = useState<Error | null>(null);
313
+
314
+ function getElementOrThrow(ref: {
315
+ current: EmbeddedPaymentElement | null;
316
+ }): EmbeddedPaymentElement {
317
+ if (!ref.current) {
318
+ throw new Error(
319
+ 'EmbeddedPaymentElement is not ready yet – wait until it finishes loading before calling this API.'
320
+ );
321
+ }
322
+ return ref.current;
323
+ }
324
+
325
+ // Create embedded payment element
326
+ useEffect(() => {
327
+ let active = true;
328
+ (async () => {
329
+ const el = await createEmbeddedPaymentElement(
330
+ intentConfig,
331
+ configuration
332
+ );
333
+ if (!active) return;
334
+ elementRef.current = el;
335
+ setElement(el);
336
+ })();
337
+ const getCurrentRef = () => viewRef.current;
338
+
339
+ return () => {
340
+ active = false;
341
+ elementRef.current?.clearPaymentOption();
342
+ elementRef.current = null;
343
+
344
+ const currentRef = getCurrentRef();
345
+
346
+ if (isAndroid && currentRef) {
347
+ Commands.clearPaymentOption(currentRef);
348
+ }
349
+
350
+ setElement(null);
351
+ };
352
+ }, [intentConfig, configuration, viewRef, isAndroid]);
353
+
354
+ useEffect(() => {
355
+ const sub = addListener(
356
+ 'embeddedPaymentElementDidUpdatePaymentOption',
357
+ ({ paymentOption: opt }) => setPaymentOption(opt ?? null)
358
+ );
359
+ return () => sub.remove();
360
+ });
361
+
362
+ // Listen for height changes
363
+ useEffect(() => {
364
+ const sub = addListener(
365
+ 'embeddedPaymentElementDidUpdateHeight',
366
+ ({ height: h }) => {
367
+ // ignore zero
368
+ if (h > 0) {
369
+ LayoutAnimation.configureNext(LayoutAnimation.Presets.easeInEaseOut);
370
+ setHeight(h);
371
+ }
372
+ }
373
+ );
374
+ return () => sub.remove();
375
+ }, []);
376
+
377
+ // Listen for loading failures
378
+ useEffect(() => {
379
+ const sub = addListener(
380
+ 'embeddedPaymentElementLoadingFailed',
381
+ (nativeError: { message: string }) => {
382
+ setLoadingError(new Error(nativeError.message));
383
+ }
384
+ );
385
+ return () => sub.remove();
386
+ }, []);
387
+
388
+ // Render the embedded view
389
+ const embeddedPaymentElementView = useMemo(() => {
390
+ if (isAndroid && configuration && intentConfig) {
391
+ return (
392
+ <NativeEmbeddedPaymentElement
393
+ ref={viewRef}
394
+ style={[{ width: '100%', height: height }]}
395
+ configuration={configuration}
396
+ intentConfiguration={intentConfig}
397
+ />
398
+ );
399
+ }
400
+ if (!element) return null;
401
+ return (
402
+ <NativeEmbeddedPaymentElement
403
+ ref={viewRef}
404
+ style={{ width: '100%', height }}
405
+ configuration={configuration}
406
+ intentConfiguration={intentConfig}
407
+ />
408
+ );
409
+ }, [configuration, element, height, intentConfig, isAndroid]);
410
+
411
+ // Other APIs
412
+ const confirm = useCallback((): Promise<EmbeddedPaymentElementResult> => {
413
+ const currentRef = viewRef.current;
414
+
415
+ if (isAndroid) {
416
+ if (currentRef) {
417
+ const promise = new Promise<EmbeddedPaymentElementResult>((resolve) => {
418
+ const sub = addListener(
419
+ 'embeddedPaymentElementFormSheetConfirmComplete',
420
+ (result: EmbeddedPaymentElementResult) => {
421
+ sub.remove();
422
+ resolve(result);
423
+ }
424
+ );
425
+ });
426
+
427
+ Commands.confirm(currentRef);
428
+
429
+ return promise;
430
+ } else {
431
+ return Promise.reject(
432
+ new Error('Unable to find Android embedded payment element view!')
433
+ );
434
+ }
435
+ }
436
+
437
+ // iOS: just proxy to the native hook
438
+ return getElementOrThrow(elementRef).confirm();
439
+ }, [isAndroid]);
440
+ const update = useCallback(
441
+ (cfg: PaymentSheetTypes.IntentConfiguration) =>
442
+ getElementOrThrow(elementRef).update(cfg),
443
+ []
444
+ );
445
+ const clearPaymentOption = useCallback((): Promise<void> => {
446
+ if (isAndroid) {
447
+ const tag = findNodeHandle(viewRef.current);
448
+ if (tag == null) {
449
+ return Promise.reject(new Error('Unable to find Android view handle'));
450
+ }
451
+ return NativeStripeSdkModule.clearEmbeddedPaymentOption(tag);
452
+ }
453
+
454
+ // iOS: clear on the element instance
455
+ getElementOrThrow(elementRef).clearPaymentOption();
456
+ return Promise.resolve();
457
+ }, [isAndroid]);
458
+
459
+ return {
460
+ embeddedPaymentElementView,
461
+ paymentOption,
462
+ confirm,
463
+ update,
464
+ clearPaymentOption,
465
+ loadingError,
466
+ };
467
+ }
@@ -84,10 +84,6 @@ export type SetupParamsBase = IntentParams & {
84
84
  * Note: Card brand filtering is not currently supported in Link.
85
85
  */
86
86
  cardBrandAcceptance?: CardBrandAcceptance;
87
- /** (Private Preview) This parameter is expected to be removed once we GA this feature
88
- * When using customerSessions, allow users to update their saved cards
89
- */
90
- updatePaymentMethodEnabled?: boolean;
91
87
  };
92
88
 
93
89
  export type SetupParams =
@@ -207,6 +203,9 @@ export type AppearanceParams = RecursivePartial<{
207
203
  };
208
204
  /** Describes the appearance of the primary "Pay" button at the bottom of your Payment Sheet */
209
205
  primaryButton: PrimaryButtonConfig;
206
+
207
+ /** Describes the appearance of the Embedded Mobile Payment Element */
208
+ embeddedPaymentElement: EmbeddedPaymentElementAppearance;
210
209
  }>;
211
210
 
212
211
  export type FontConfig = {
@@ -332,6 +331,117 @@ export type PrimaryButtonColorConfig = {
332
331
  border: string;
333
332
  };
334
333
 
334
+ /** A color that’s either a single hex or a light/dark pair */
335
+ export type ThemedColor = string | { light: string; dark: string };
336
+
337
+ /** Represents edge insets */
338
+ export interface EdgeInsetsConfig {
339
+ top?: number;
340
+ left?: number;
341
+ bottom?: number;
342
+ right?: number;
343
+ }
344
+
345
+ /** Display styles for rows in the Embedded Mobile Payment Element */
346
+ export enum RowStyle {
347
+ /** A flat style with radio buttons */
348
+ FlatWithRadio = 'flatWithRadio',
349
+ /** A floating button style */
350
+ FloatingButton = 'floatingButton',
351
+ /** A flat style with a checkmark */
352
+ FlatWithCheckmark = 'flatWithCheckmark',
353
+ }
354
+
355
+ /** Describes the appearance of the radio button */
356
+ export interface RadioConfig {
357
+ /** The color of the radio button when selected, represented as a hex string #AARRGGBB or #RRGGBB.
358
+ * @default The root appearance.colors.primary
359
+ */
360
+ selectedColor?: ThemedColor;
361
+
362
+ /** The color of the radio button when unselected, represented as a hex string #AARRGGBB or #RRGGBB.
363
+ * @default The root appearance.colors.componentBorder
364
+ */
365
+ unselectedColor?: ThemedColor;
366
+ }
367
+
368
+ /** Describes the appearance of the checkmark */
369
+ export interface CheckmarkConfig {
370
+ /** The color of the checkmark when selected, represented as a hex string #AARRGGBB or #RRGGBB.
371
+ * @default The root appearance.colors.primary
372
+ */
373
+ color?: ThemedColor;
374
+ }
375
+
376
+ /** Describes the appearance of the flat style row */
377
+ export interface FlatConfig {
378
+ /** The thickness of the separator line between rows.
379
+ * @default 1.0
380
+ */
381
+ separatorThickness?: number;
382
+
383
+ /** The color of the separator line between rows, represented as a hex string #AARRGGBB or #RRGGBB.
384
+ * @default The root appearance.colors.componentBorder
385
+ */
386
+ separatorColor?: ThemedColor;
387
+
388
+ /** The insets of the separator line between rows.
389
+ * @default { top: 0, left: 30, bottom: 0, right: 0 } for RowStyle.FlatWithRadio
390
+ * @default { top: 0, left: 0, bottom: 0, right: 0 } for RowStyle.FlatWithCheckmark and RowStyle.FloatingButton
391
+ */
392
+ separatorInsets?: EdgeInsetsConfig;
393
+
394
+ /** Determines if the top separator is visible at the top of the Element.
395
+ * @default true
396
+ */
397
+ topSeparatorEnabled?: boolean;
398
+
399
+ /** Determines if the bottom separator is visible at the bottom of the Element.
400
+ * @default true
401
+ */
402
+ bottomSeparatorEnabled?: boolean;
403
+
404
+ /** Appearance settings for the radio button (used when RowStyle is FlatWithRadio) */
405
+ radio?: RadioConfig;
406
+
407
+ /** Appearance settings for the checkmark (used when RowStyle is FlatWithCheckmark) */
408
+ checkmark?: CheckmarkConfig;
409
+ }
410
+
411
+ /** Describes the appearance of the floating button style payment method row */
412
+ export interface FloatingConfig {
413
+ /** The spacing between payment method rows.
414
+ * @default 12.0
415
+ */
416
+ spacing?: number;
417
+ }
418
+
419
+ /** Describes the appearance of the row in the Embedded Mobile Payment Element */
420
+ export interface RowConfig {
421
+ /** The display style of the row.
422
+ * @default RowStyle.FlatWithRadio
423
+ */
424
+ style?: RowStyle;
425
+
426
+ /** Additional vertical insets applied to a payment method row.
427
+ * Increasing this value increases the height of each row.
428
+ * @default 6.0
429
+ */
430
+ additionalInsets?: number;
431
+
432
+ /** Appearance settings for the flat style row */
433
+ flat?: FlatConfig;
434
+
435
+ /** Appearance settings for the floating button style row */
436
+ floating?: FloatingConfig;
437
+ }
438
+
439
+ /** Describes the appearance of the Embedded Mobile Payment Element */
440
+ export interface EmbeddedPaymentElementAppearance {
441
+ /** Describes the appearance of the row in the Embedded Mobile Payment Element */
442
+ row?: RowConfig;
443
+ }
444
+
335
445
  type RecursivePartial<T> = {
336
446
  [P in keyof T]?: T[P] extends (infer U)[]
337
447
  ? RecursivePartial<U>[]
@@ -55,14 +55,13 @@ export type OnFocusChangeEvent = NativeSyntheticEvent<{
55
55
  focusedField: FieldName | null;
56
56
  }>;
57
57
 
58
- export type OnCardChangeEvent = NativeSyntheticEvent<Details>;
58
+ export type OnCardChangeEvent = NativeSyntheticEvent<{ card: Details }>;
59
59
 
60
60
  /**
61
61
  * @ignore
62
62
  */
63
63
  export interface NativeProps {
64
64
  style?: StyleProp<ViewStyle>;
65
- value?: Partial<Details>;
66
65
  postalCodeEnabled?: boolean;
67
66
  autofocus?: boolean;
68
67
  countryCode: string | null;
@@ -53,7 +53,7 @@ export type OnFocusChangeEvent = NativeSyntheticEvent<{
53
53
  focusedField: FieldName | null;
54
54
  }>;
55
55
 
56
- export type OnFormCompleteEvent = NativeSyntheticEvent<Details>;
56
+ export type OnFormCompleteEvent = NativeSyntheticEvent<{ card: Details }>;
57
57
 
58
58
  /**
59
59
  * @ignore
@@ -2,7 +2,9 @@ require 'json'
2
2
 
3
3
  package = JSON.parse(File.read(File.join(__dir__, 'package.json')))
4
4
  # Keep stripe_version in sync with https://github.com/stripe/stripe-identity-react-native/blob/main/stripe-identity-react-native.podspec
5
- stripe_version = '~> 24.11.0'
5
+ stripe_version = '~> 24.12.0'
6
+
7
+ fabric_enabled = ENV['RCT_NEW_ARCH_ENABLED'] == '1'
6
8
 
7
9
  Pod::Spec.new do |s|
8
10
  s.name = 'stripe-react-native'
@@ -16,7 +18,19 @@ Pod::Spec.new do |s|
16
18
  s.source = { git: 'https://github.com/stripe/stripe-react-native.git', tag: s.version.to_s }
17
19
 
18
20
  s.source_files = 'ios/**/*.{h,m,mm,swift}'
19
- s.exclude_files = 'ios/Tests/'
21
+ s.exclude_files = [ 'ios/Tests/', 'ios/NewArch/' ]
22
+ # These headers contain c++ code so make sure they are private to avoid
23
+ # being exported to the umbrella header, which is used by swift interop.
24
+ # StripeSwiftInterop.h will cause circular dependency issues.
25
+ s.private_header_files = [ 'ios/StripeSdk.h', 'ios/StripeSwiftInterop.h' ]
26
+
27
+ s.header_dir = 'stripe_react_native'
28
+ s.pod_target_xcconfig = {
29
+ 'USE_HEADERMAP' => 'YES',
30
+ 'DEFINES_MODULE' => 'YES',
31
+ 'CLANG_CXX_LANGUAGE_STANDARD' => 'c++20',
32
+ 'SWIFT_COMPILATION_MODE' => 'wholemodule',
33
+ }
20
34
 
21
35
  s.test_spec 'Tests' do |test_spec|
22
36
  test_spec.platforms = { ios: '15.1' }
@@ -30,4 +44,15 @@ Pod::Spec.new do |s|
30
44
  s.dependency 'StripePaymentsUI', stripe_version
31
45
  s.dependency 'StripeApplePay', stripe_version
32
46
  s.dependency 'StripeFinancialConnections', stripe_version
47
+
48
+ if fabric_enabled
49
+ install_modules_dependencies(s)
50
+
51
+ s.subspec "NewArch" do |ss|
52
+ ss.source_files = "ios/NewArch/**/*.{h,m,mm}"
53
+ # These headers contain c++ code so make sure they are private to avoid
54
+ # being exported to the umbrella header, which is used by swift interop.
55
+ ss.private_header_files = '**/*.h'
56
+ end
57
+ end
33
58
  end