@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
@@ -3,13 +3,13 @@ import UIKit
3
3
  import Stripe
4
4
 
5
5
  @objc(AuBECSDebitFormView)
6
- class AuBECSDebitFormView: UIView, STPAUBECSDebitFormViewDelegate {
6
+ public class AuBECSDebitFormView: UIView, STPAUBECSDebitFormViewDelegate {
7
7
 
8
8
  var auBecsFormView: STPAUBECSDebitFormView?
9
- @objc var onCompleteAction: RCTDirectEventBlock?
10
- @objc var companyName: NSString?
9
+ @objc public var onCompleteAction: RCTDirectEventBlock?
10
+ @objc public var companyName: NSString?
11
11
 
12
- override func didSetProps(_ changedProps: [String]!) {
12
+ @objc public func didSetProps() {
13
13
  if let auBecsFormView = self.auBecsFormView {
14
14
  auBecsFormView.removeFromSuperview()
15
15
  }
@@ -24,8 +24,14 @@ class AuBECSDebitFormView: UIView, STPAUBECSDebitFormViewDelegate {
24
24
  setStyles()
25
25
  }
26
26
  }
27
+
28
+ override public func didSetProps(_ changedProps: [String]!) {
29
+ // This is only called on old arch, for new arch didSetProps() will be called
30
+ // by the view component.
31
+ self.didSetProps();
32
+ }
27
33
 
28
- @objc var formStyle: NSDictionary = NSDictionary() {
34
+ @objc public var formStyle: NSDictionary = NSDictionary() {
29
35
  didSet {
30
36
  setStyles()
31
37
  }
@@ -60,7 +66,7 @@ class AuBECSDebitFormView: UIView, STPAUBECSDebitFormViewDelegate {
60
66
  }
61
67
  }
62
68
 
63
- func auBECSDebitForm(_ form: STPAUBECSDebitFormView, didChangeToStateComplete complete: Bool) {
69
+ public func auBECSDebitForm(_ form: STPAUBECSDebitFormView, didChangeToStateComplete complete: Bool) {
64
70
  onCompleteAction!([
65
71
  "accountNumber": form.paymentMethodParams?.auBECSDebit?.accountNumber ?? "",
66
72
  "bsbNumber": form.paymentMethodParams?.auBECSDebit?.bsbNumber ?? "",
@@ -69,11 +75,11 @@ class AuBECSDebitFormView: UIView, STPAUBECSDebitFormViewDelegate {
69
75
  ])
70
76
  }
71
77
 
72
- override init(frame: CGRect) {
78
+ override public init(frame: CGRect) {
73
79
  super.init(frame: frame)
74
80
  }
75
81
 
76
- override func layoutSubviews() {
82
+ override public func layoutSubviews() {
77
83
  if let auBecsFormView = self.auBecsFormView {
78
84
  auBecsFormView.frame = self.bounds
79
85
  }
@@ -3,10 +3,7 @@ import Foundation
3
3
  @objc(CardFieldManager)
4
4
  class CardFieldManager: RCTViewManager {
5
5
  override func view() -> UIView! {
6
- let cardField = CardFieldView()
7
- let stripeSdk = bridge.module(forName: "StripeSdk") as? StripeSdk
8
- stripeSdk?.cardFieldView = cardField;
9
- return cardField
6
+ return CardFieldView()
10
7
  }
11
8
 
12
9
  @objc func focus(_ reactTag: NSNumber) {
@@ -2,41 +2,42 @@ import Foundation
2
2
  import UIKit
3
3
  import Stripe
4
4
 
5
- class CardFieldView: UIView, STPPaymentCardTextFieldDelegate {
6
- @objc var onCardChange: RCTDirectEventBlock?
7
- @objc var onFocusChange: RCTDirectEventBlock?
8
- @objc var dangerouslyGetFullCardDetails: Bool = false
5
+ @objc(CardFieldView)
6
+ public class CardFieldView: UIView, STPPaymentCardTextFieldDelegate {
7
+ @objc public var onCardChange: RCTDirectEventBlock?
8
+ @objc public var onFocusChange: RCTDirectEventBlock?
9
+ @objc public var dangerouslyGetFullCardDetails: Bool = false
9
10
 
10
11
  private var cardField = STPPaymentCardTextField()
11
12
 
12
13
  public var cardParams: STPPaymentMethodParams? = nil
13
14
  public var cardPostalCode: String? = nil
14
15
 
15
- @objc var disabled: Bool = false {
16
+ @objc public var disabled: Bool = false {
16
17
  didSet {
17
18
  cardField.isUserInteractionEnabled = !disabled
18
19
  }
19
20
  }
20
21
 
21
- @objc var postalCodeEnabled: Bool = true {
22
+ @objc public var postalCodeEnabled: Bool = true {
22
23
  didSet {
23
24
  cardField.postalCodeEntryEnabled = postalCodeEnabled
24
25
  }
25
26
  }
26
27
 
27
- @objc var countryCode: String? {
28
+ @objc public var countryCode: String? {
28
29
  didSet {
29
30
  cardField.countryCode = countryCode
30
31
  }
31
32
  }
32
33
 
33
- @objc var onBehalfOf: String? {
34
+ @objc public var onBehalfOf: String? {
34
35
  didSet {
35
36
  cardField.onBehalfOf = onBehalfOf
36
37
  }
37
38
  }
38
39
 
39
- @objc var preferredNetworks: Array<Int>? {
40
+ @objc public var preferredNetworks: Array<Int>? {
40
41
  didSet {
41
42
  if let preferredNetworks = preferredNetworks {
42
43
  cardField.preferredNetworks = preferredNetworks.map(Mappers.intToCardBrand).compactMap { $0 }
@@ -44,7 +45,7 @@ class CardFieldView: UIView, STPPaymentCardTextFieldDelegate {
44
45
  }
45
46
  }
46
47
 
47
- @objc var placeholders: NSDictionary = NSDictionary() {
48
+ @objc public var placeholders: NSDictionary = NSDictionary() {
48
49
  didSet {
49
50
  if let numberPlaceholder = placeholders["number"] as? String {
50
51
  cardField.numberPlaceholder = numberPlaceholder
@@ -63,7 +64,7 @@ class CardFieldView: UIView, STPPaymentCardTextFieldDelegate {
63
64
  }
64
65
  }
65
66
 
66
- @objc var autofocus: Bool = false {
67
+ @objc public var autofocus: Bool = false {
67
68
  didSet {
68
69
  if autofocus == true {
69
70
  cardField.reactFocus()
@@ -71,7 +72,7 @@ class CardFieldView: UIView, STPPaymentCardTextFieldDelegate {
71
72
  }
72
73
  }
73
74
 
74
- @objc var cardStyle: NSDictionary = NSDictionary() {
75
+ @objc public var cardStyle: NSDictionary = NSDictionary() {
75
76
  didSet {
76
77
  if let borderWidth = cardStyle["borderWidth"] as? Int {
77
78
  cardField.borderWidth = CGFloat(borderWidth)
@@ -111,46 +112,48 @@ class CardFieldView: UIView, STPPaymentCardTextFieldDelegate {
111
112
  }
112
113
  }
113
114
 
114
- override init(frame: CGRect) {
115
+ override public init(frame: CGRect) {
115
116
  super.init(frame: frame)
116
117
  cardField.delegate = self
117
118
 
118
119
  self.addSubview(cardField)
120
+
121
+ StripeSdkImpl.shared.cardFieldView = self
119
122
  }
120
123
 
121
- func focus() {
124
+ @objc public func focus() {
122
125
  cardField.becomeFirstResponder()
123
126
  }
124
127
 
125
- func blur() {
128
+ @objc public func blur() {
126
129
  cardField.resignFirstResponder()
127
130
  }
128
131
 
129
- func clear() {
132
+ @objc public func clear() {
130
133
  cardField.clear()
131
134
  }
132
135
 
133
- func paymentCardTextFieldDidEndEditing(_ textField: STPPaymentCardTextField) {
134
- onFocusChange?(["focusedField": NSNull()])
136
+ public func paymentCardTextFieldDidEndEditing(_ textField: STPPaymentCardTextField) {
137
+ onFocusChange?(["focusedField": ""])
135
138
  }
136
139
 
137
- func paymentCardTextFieldDidBeginEditingNumber(_ textField: STPPaymentCardTextField) {
140
+ public func paymentCardTextFieldDidBeginEditingNumber(_ textField: STPPaymentCardTextField) {
138
141
  onFocusChange?(["focusedField": "CardNumber"])
139
142
  }
140
143
 
141
- func paymentCardTextFieldDidBeginEditingCVC(_ textField: STPPaymentCardTextField) {
144
+ public func paymentCardTextFieldDidBeginEditingCVC(_ textField: STPPaymentCardTextField) {
142
145
  onFocusChange?(["focusedField": "Cvc"])
143
146
  }
144
147
 
145
- func paymentCardTextFieldDidBeginEditingExpiration(_ textField: STPPaymentCardTextField) {
148
+ public func paymentCardTextFieldDidBeginEditingExpiration(_ textField: STPPaymentCardTextField) {
146
149
  onFocusChange?(["focusedField": "ExpiryDate"])
147
150
  }
148
151
 
149
- func paymentCardTextFieldDidBeginEditingPostalCode(_ textField: STPPaymentCardTextField) {
152
+ public func paymentCardTextFieldDidBeginEditingPostalCode(_ textField: STPPaymentCardTextField) {
150
153
  onFocusChange?(["focusedField": "PostalCode"])
151
154
  }
152
155
 
153
- func paymentCardTextFieldDidChange(_ textField: STPPaymentCardTextField) {
156
+ public func paymentCardTextFieldDidChange(_ textField: STPPaymentCardTextField) {
154
157
  if onCardChange != nil {
155
158
  let brand = STPCardValidator.brand(forNumber: textField.cardNumber ?? "")
156
159
  let validExpiryDate = STPCardValidator.validationState(
@@ -176,7 +179,7 @@ class CardFieldView: UIView, STPPaymentCardTextFieldDelegate {
176
179
  cardData["number"] = textField.cardNumber ?? ""
177
180
  cardData["cvc"] = textField.cvc ?? ""
178
181
  }
179
- onCardChange!(cardData as [AnyHashable : Any])
182
+ onCardChange!(["card": cardData as [AnyHashable : Any]])
180
183
  }
181
184
  if (textField.isValid) {
182
185
  self.cardParams = textField.paymentMethodParams
@@ -187,7 +190,7 @@ class CardFieldView: UIView, STPPaymentCardTextFieldDelegate {
187
190
  }
188
191
  }
189
192
 
190
- override func layoutSubviews() {
193
+ override public func layoutSubviews() {
191
194
  cardField.frame = self.bounds
192
195
  }
193
196
 
@@ -3,10 +3,7 @@ import Foundation
3
3
  @objc(CardFormManager)
4
4
  class CardFormManager: RCTViewManager {
5
5
  override func view() -> UIView! {
6
- let cardForm = CardFormView()
7
- let stripeSdk = bridge.module(forName: "StripeSdk") as? StripeSdk
8
- stripeSdk?.cardFormView = cardForm;
9
- return cardForm
6
+ return CardFormView()
10
7
  }
11
8
 
12
9
  override class func requiresMainQueueSetup() -> Bool {
@@ -2,22 +2,23 @@ import Foundation
2
2
  import UIKit
3
3
  import Stripe
4
4
 
5
- class CardFormView: UIView, STPCardFormViewDelegate {
5
+ @objc(CardFormView)
6
+ public class CardFormView: UIView, STPCardFormViewDelegate {
6
7
  public var cardForm: STPCardFormView?
7
8
 
8
9
  public var cardParams: STPPaymentMethodCardParams? = nil
9
10
 
10
- @objc var dangerouslyGetFullCardDetails: Bool = false
11
- @objc var onFormComplete: RCTDirectEventBlock?
12
- @objc var autofocus: Bool = false
13
- @objc var disabled: Bool = false
14
- @objc var preferredNetworks: Array<Int>? {
11
+ @objc public var dangerouslyGetFullCardDetails: Bool = false
12
+ @objc public var onFormComplete: RCTDirectEventBlock?
13
+ @objc public var autofocus: Bool = false
14
+ @objc public var disabled: Bool = false
15
+ @objc public var preferredNetworks: Array<Int>? {
15
16
  didSet {
16
17
  setPreferredNetworks()
17
18
  }
18
19
  }
19
-
20
- override func didSetProps(_ changedProps: [String]!) {
20
+
21
+ @objc public func didSetProps() {
21
22
  if let cardForm = self.cardForm {
22
23
  cardForm.removeFromSuperview()
23
24
  }
@@ -37,13 +38,19 @@ class CardFormView: UIView, STPCardFormViewDelegate {
37
38
  setPreferredNetworks()
38
39
  }
39
40
 
40
- @objc var cardStyle: NSDictionary = NSDictionary() {
41
+ override public func didSetProps(_ changedProps: [String]!) {
42
+ // This is only called on old arch, for new arch didSetProps() will be called
43
+ // by the view component.
44
+ self.didSetProps()
45
+ }
46
+
47
+ @objc public var cardStyle: NSDictionary = NSDictionary() {
41
48
  didSet {
42
49
  setStyles()
43
50
  }
44
51
  }
45
52
 
46
- func cardFormView(_ form: STPCardFormView, didChangeToStateComplete complete: Bool) {
53
+ public func cardFormView(_ form: STPCardFormView, didChangeToStateComplete complete: Bool) {
47
54
  if onFormComplete != nil {
48
55
  let brand = STPCardValidator.brand(forNumber: cardForm?.cardParams?.card?.number ?? "")
49
56
  var cardData: [String: Any?] = [
@@ -65,15 +72,15 @@ class CardFormView: UIView, STPCardFormViewDelegate {
65
72
  } else {
66
73
  self.cardParams = nil
67
74
  }
68
- onFormComplete!(cardData as [AnyHashable : Any])
75
+ onFormComplete!(["card": cardData as [AnyHashable : Any]])
69
76
  }
70
77
  }
71
78
 
72
- func focus() {
79
+ @objc public func focus() {
73
80
  let _ = cardForm?.becomeFirstResponder()
74
81
  }
75
82
 
76
- func blur() {
83
+ @objc public func blur() {
77
84
  let _ = cardForm?.resignFirstResponder()
78
85
  }
79
86
 
@@ -112,11 +119,13 @@ class CardFormView: UIView, STPCardFormViewDelegate {
112
119
  }
113
120
  }
114
121
 
115
- override init(frame: CGRect) {
122
+ override public init(frame: CGRect) {
116
123
  super.init(frame: frame)
124
+
125
+ StripeSdkImpl.shared.cardFormView = self
117
126
  }
118
-
119
- override func layoutSubviews() {
127
+
128
+ override public func layoutSubviews() {
120
129
  cardForm?.frame = self.bounds
121
130
  }
122
131
 
@@ -6,7 +6,7 @@
6
6
  //
7
7
 
8
8
  import Foundation
9
- @_spi(PrivateBetaCustomerSheet) @_spi(STP) @_spi(UpdatePaymentMethodBeta) import StripePaymentSheet
9
+ @_spi(PrivateBetaCustomerSheet) @_spi(STP) import StripePaymentSheet
10
10
 
11
11
  class CustomerSheetUtils {
12
12
  internal class func buildCustomerSheetConfiguration(
@@ -21,7 +21,6 @@ class CustomerSheetUtils {
21
21
  defaultBillingDetails: NSDictionary?,
22
22
  preferredNetworks: Array<Int>?,
23
23
  allowsRemovalOfLastSavedPaymentMethod: Bool?,
24
- updatePaymentMethodEnabled: Bool?,
25
24
  cardBrandAcceptance: PaymentSheet.CardBrandAcceptance
26
25
  ) -> CustomerSheet.Configuration {
27
26
  var config = CustomerSheet.Configuration()
@@ -38,10 +37,10 @@ class CustomerSheetUtils {
38
37
  config.preferredNetworks = preferredNetworks.map(Mappers.intToCardBrand).compactMap { $0 }
39
38
  }
40
39
  if let billingConfigParams = billingDetailsCollectionConfiguration {
41
- config.billingDetailsCollectionConfiguration.name = StripeSdk.mapToCollectionMode(str: billingConfigParams["name"] as? String)
42
- config.billingDetailsCollectionConfiguration.phone = StripeSdk.mapToCollectionMode(str: billingConfigParams["phone"] as? String)
43
- config.billingDetailsCollectionConfiguration.email = StripeSdk.mapToCollectionMode(str: billingConfigParams["email"] as? String)
44
- config.billingDetailsCollectionConfiguration.address = StripeSdk.mapToAddressCollectionMode(str: billingConfigParams["address"] as? String)
40
+ config.billingDetailsCollectionConfiguration.name = StripeSdkImpl.mapToCollectionMode(str: billingConfigParams["name"] as? String)
41
+ config.billingDetailsCollectionConfiguration.phone = StripeSdkImpl.mapToCollectionMode(str: billingConfigParams["phone"] as? String)
42
+ config.billingDetailsCollectionConfiguration.email = StripeSdkImpl.mapToCollectionMode(str: billingConfigParams["email"] as? String)
43
+ config.billingDetailsCollectionConfiguration.address = StripeSdkImpl.mapToAddressCollectionMode(str: billingConfigParams["address"] as? String)
45
44
  config.billingDetailsCollectionConfiguration.attachDefaultsToPaymentMethod = billingConfigParams["attachDefaultsToPaymentMethod"] as? Bool == true
46
45
  }
47
46
  if let defaultBillingDetails = defaultBillingDetails {
@@ -60,19 +59,16 @@ class CustomerSheetUtils {
60
59
  if let allowsRemovalOfLastSavedPaymentMethod = allowsRemovalOfLastSavedPaymentMethod {
61
60
  config.allowsRemovalOfLastSavedPaymentMethod = allowsRemovalOfLastSavedPaymentMethod
62
61
  }
63
- if let updatePaymentMethodEnabled = updatePaymentMethodEnabled {
64
- config.updatePaymentMethodEnabled = updatePaymentMethodEnabled
65
- }
66
62
  config.cardBrandAcceptance = cardBrandAcceptance
67
63
  return config
68
64
  }
69
-
65
+
70
66
  internal class func buildStripeCustomerAdapter(
71
67
  customerId: String,
72
68
  ephemeralKeySecret: String,
73
69
  setupIntentClientSecret: String?,
74
70
  customerAdapter: NSDictionary,
75
- stripeSdk: StripeSdk
71
+ stripeSdk: StripeSdkImpl
76
72
  ) -> StripeCustomerAdapter {
77
73
  if (customerAdapter.count > 0) {
78
74
  return buildCustomerAdapterOverride(
@@ -83,7 +79,7 @@ class CustomerSheetUtils {
83
79
  stripeSdk: stripeSdk
84
80
  )
85
81
  }
86
-
82
+
87
83
  if let setupIntentClientSecret = setupIntentClientSecret {
88
84
  return StripeCustomerAdapter(
89
85
  customerEphemeralKeyProvider: {
@@ -101,13 +97,13 @@ class CustomerSheetUtils {
101
97
  }
102
98
  )
103
99
  }
104
-
100
+
105
101
  internal class func buildCustomerAdapterOverride(
106
102
  customerAdapter: NSDictionary,
107
103
  customerId: String,
108
104
  ephemeralKeySecret: String,
109
105
  setupIntentClientSecret: String?,
110
- stripeSdk: StripeSdk
106
+ stripeSdk: StripeSdkImpl
111
107
  ) -> StripeCustomerAdapter {
112
108
  return ReactNativeCustomerAdapter(
113
109
  fetchPaymentMethods: customerAdapter["fetchPaymentMethods"] as? Bool ?? false,
@@ -157,7 +153,7 @@ class CustomerSheetUtils {
157
153
  }
158
154
  }
159
155
 
160
-
156
+
161
157
  internal class func buildPaymentOptionResult(label: String, imageData: String?, paymentMethod: STPPaymentMethod?) -> NSMutableDictionary {
162
158
  let result: NSMutableDictionary = [:]
163
159
  let paymentOption: NSMutableDictionary = [:]
@@ -171,7 +167,7 @@ class CustomerSheetUtils {
171
167
  }
172
168
  return result
173
169
  }
174
-
170
+
175
171
  internal class func interpretResult(result: CustomerSheet.CustomerSheetResult) -> NSDictionary {
176
172
  var payload: NSMutableDictionary = [:]
177
173
  switch result {
@@ -15,7 +15,7 @@ class ReactNativeCustomerAdapter: StripeCustomerAdapter {
15
15
  var overridesSetSelectedPaymentOption: Bool
16
16
  var overridesFetchSelectedPaymentOption: Bool
17
17
  var overridesSetupIntentClientSecretForCustomerAttach: Bool
18
- var stripeSdk: StripeSdk
18
+ var stripeSdk: StripeSdkImpl
19
19
 
20
20
  init(
21
21
  fetchPaymentMethods: Bool,
@@ -27,7 +27,7 @@ class ReactNativeCustomerAdapter: StripeCustomerAdapter {
27
27
  customerId: String,
28
28
  ephemeralKeySecret: String,
29
29
  setupIntentClientSecret: String?,
30
- stripeSdk: StripeSdk
30
+ stripeSdk: StripeSdkImpl
31
31
  ) {
32
32
  self.overridesFetchPaymentMethods = fetchPaymentMethods
33
33
  self.overridesAttachPaymentMethod = attachPaymentMethod
@@ -132,42 +132,42 @@ extension ReactNativeCustomerAdapter {
132
132
  func fetchPaymentMethods(completion: @escaping ([STPPaymentMethod]) -> Void) {
133
133
  DispatchQueue.main.async {
134
134
  self.stripeSdk.fetchPaymentMethodsCallback = completion
135
- self.stripeSdk.sendEvent(withName: "onCustomerAdapterFetchPaymentMethodsCallback", body: [:])
135
+ self.stripeSdk.emitter?.emitOnCustomerAdapterFetchPaymentMethodsCallback()
136
136
  }
137
137
  }
138
138
 
139
139
  func attachPaymentMethod(_ paymentMethodId: String, completion: @escaping () -> Void) {
140
140
  DispatchQueue.main.async {
141
141
  self.stripeSdk.attachPaymentMethodCallback = completion
142
- self.stripeSdk.sendEvent(withName: "onCustomerAdapterAttachPaymentMethodCallback", body: ["paymentMethodId": paymentMethodId])
142
+ self.stripeSdk.emitter?.emitOnCustomerAdapterAttachPaymentMethodCallback(["paymentMethodId": paymentMethodId])
143
143
  }
144
144
  }
145
145
 
146
146
  func detachPaymentMethod(_ paymentMethodId: String, completion: @escaping () -> Void) {
147
147
  DispatchQueue.main.async {
148
148
  self.stripeSdk.detachPaymentMethodCallback = completion
149
- self.stripeSdk.sendEvent(withName: "onCustomerAdapterDetachPaymentMethodCallback", body: ["paymentMethodId": paymentMethodId])
149
+ self.stripeSdk.emitter?.emitOnCustomerAdapterDetachPaymentMethodCallback(["paymentMethodId": paymentMethodId])
150
150
  }
151
151
  }
152
152
 
153
153
  func setSelectedPaymentOption(_ paymentOption: CustomerPaymentOption?, completion: @escaping () -> Void) {
154
154
  DispatchQueue.main.async {
155
155
  self.stripeSdk.setSelectedPaymentOptionCallback = completion
156
- self.stripeSdk.sendEvent(withName: "onCustomerAdapterSetSelectedPaymentOptionCallback", body: ["paymentOption": paymentOption?.value])
156
+ self.stripeSdk.emitter?.emitOnCustomerAdapterSetSelectedPaymentOptionCallback(["paymentOption": paymentOption?.value])
157
157
  }
158
158
  }
159
159
 
160
160
  func fetchSelectedPaymentOption(completion: @escaping (CustomerPaymentOption?) -> Void) {
161
161
  DispatchQueue.main.async {
162
162
  self.stripeSdk.fetchSelectedPaymentOptionCallback = completion
163
- self.stripeSdk.sendEvent(withName: "onCustomerAdapterFetchSelectedPaymentOptionCallback", body: [:])
163
+ self.stripeSdk.emitter?.emitOnCustomerAdapterFetchSelectedPaymentOptionCallback()
164
164
  }
165
165
  }
166
166
 
167
167
  func setupIntentClientSecretForCustomerAttach(completion: @escaping (String) -> Void) {
168
168
  DispatchQueue.main.async {
169
169
  self.stripeSdk.setupIntentClientSecretForCustomerAttachCallback = completion
170
- self.stripeSdk.sendEvent(withName: "onCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback", body: [:])
170
+ self.stripeSdk.emitter?.emitOnCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback()
171
171
  }
172
172
  }
173
173
  }
@@ -0,0 +1,6 @@
1
+ #import <Foundation/Foundation.h>
2
+ #import <React/RCTBridgeModule.h>
3
+ #import <React/RCTViewManager.h>
4
+
5
+ @interface RCT_EXTERN_MODULE(EmbeddedPaymentElementView, RCTViewManager)
6
+ @end
@@ -0,0 +1,48 @@
1
+ //
2
+ // EmbeddedPaymentElementView.swift
3
+ // stripe-react-native
4
+ //
5
+ // Created by Nick Porter on 4/16/25.
6
+ //
7
+
8
+ import Foundation
9
+ import UIKit
10
+ @_spi(EmbeddedPaymentElementPrivateBeta) import StripePaymentSheet
11
+
12
+ @objc(EmbeddedPaymentElementView)
13
+ class EmbeddedPaymentElementView: RCTViewManager {
14
+
15
+ override static func requiresMainQueueSetup() -> Bool {
16
+ return true
17
+ }
18
+
19
+ override func view() -> UIView! {
20
+ return EmbeddedPaymentElementContainerView(frame: .zero)
21
+ }
22
+ }
23
+
24
+ class EmbeddedPaymentElementContainerView: UIView, UIGestureRecognizerDelegate {
25
+ override init(frame: CGRect) {
26
+ super.init(frame: frame)
27
+ backgroundColor = .clear
28
+ attachPaymentElementIfAvailable()
29
+ }
30
+
31
+ required init?(coder: NSCoder) {
32
+ fatalError()
33
+ }
34
+
35
+ private func attachPaymentElementIfAvailable() {
36
+ guard let embeddedElement = StripeSdkImpl.shared.embeddedInstance else { return }
37
+ let paymentElementView = embeddedElement.view
38
+ addSubview(paymentElementView)
39
+ paymentElementView.translatesAutoresizingMaskIntoConstraints = false
40
+
41
+ NSLayoutConstraint.activate([
42
+ paymentElementView.topAnchor.constraint(equalTo: topAnchor),
43
+ paymentElementView.leadingAnchor.constraint(equalTo: leadingAnchor),
44
+ paymentElementView.trailingAnchor.constraint(equalTo: trailingAnchor),
45
+ paymentElementView.bottomAnchor.constraint(equalTo: bottomAnchor),
46
+ ])
47
+ }
48
+ }
@@ -0,0 +1,10 @@
1
+ #import <UIKit/UIKit.h>
2
+ #import <React/RCTViewComponentView.h>
3
+
4
+ NS_ASSUME_NONNULL_BEGIN
5
+
6
+ @interface AddToWalletButtonComponentView : RCTViewComponentView
7
+
8
+ @end
9
+
10
+ NS_ASSUME_NONNULL_END
@@ -0,0 +1,93 @@
1
+ #import "AddToWalletButtonComponentView.h"
2
+
3
+ #import <react/renderer/components/rnstripe/ComponentDescriptors.h>
4
+ #import <react/renderer/components/rnstripe/EventEmitters.h>
5
+ #import <react/renderer/components/rnstripe/Props.h>
6
+ #import <react/renderer/components/rnstripe/RCTComponentViewHelpers.h>
7
+
8
+ #import <React/RCTConversions.h>
9
+ #import <React/RCTFabricComponentsPlugins.h>
10
+
11
+ #import "RCTFollyConvert.h"
12
+ #import "StripeNewArchConversions.h"
13
+ #import "StripeSwiftInterop.h"
14
+
15
+ using namespace facebook::react;
16
+ using namespace stripe::react;
17
+
18
+ @interface AddToWalletButtonComponentView () <RCTAddToWalletButtonViewProtocol>
19
+ @end
20
+
21
+ @implementation AddToWalletButtonComponentView {
22
+ AddToWalletButtonView *_view;
23
+ }
24
+
25
+ // Needed because of this: https://github.com/facebook/react-native/pull/37274
26
+ + (void)load
27
+ {
28
+ [super load];
29
+ }
30
+
31
+ - (instancetype)initWithFrame:(CGRect)frame
32
+ {
33
+ if (self = [super initWithFrame:frame]) {
34
+ static const auto defaultProps = std::make_shared<const AddToWalletButtonProps>();
35
+ _props = defaultProps;
36
+ [self prepareView];
37
+ }
38
+
39
+ return self;
40
+ }
41
+
42
+ - (void)prepareView
43
+ {
44
+ _view = [[AddToWalletButtonView alloc] initWithFrame:self.frame];
45
+ self.contentView = _view;
46
+
47
+ __weak __typeof(self) weakSelf = self;
48
+
49
+ _view.onCompleteAction = ^(NSDictionary *event) {
50
+ __typeof(self) strongSelf = weakSelf;
51
+ if (!strongSelf || !strongSelf->_eventEmitter) {
52
+ return;
53
+ }
54
+ AddToWalletButtonEventEmitter::OnCompleteAction emitterEvent = {.error = convertIdToFollyDynamic(event[@"error"])};
55
+ std::static_pointer_cast<const AddToWalletButtonEventEmitter>(strongSelf->_eventEmitter)
56
+ ->onCompleteAction(std::move(emitterEvent));
57
+ };
58
+ }
59
+
60
+ - (void)updateProps:(const facebook::react::Props::Shared &)props
61
+ oldProps:(const facebook::react::Props::Shared &)oldProps
62
+ {
63
+ const auto &newViewProps = *std::static_pointer_cast<const AddToWalletButtonProps>(props);
64
+
65
+ _view.iOSButtonStyle = RCTNSStringFromStringNilIfEmpty(newViewProps.iOSButtonStyle);
66
+ _view.testEnv = newViewProps.testEnv;
67
+ _view.cardDetails = convertFollyDynamicToNSDictionaryOrNil(newViewProps.cardDetails);
68
+ _view.ephemeralKey = convertFollyDynamicToNSDictionaryOrNil(newViewProps.ephemeralKey);
69
+
70
+ [super updateProps:props oldProps:oldProps];
71
+
72
+ [_view didSetProps];
73
+ }
74
+
75
+ #pragma mark - RCTComponentViewProtocol
76
+
77
+ + (ComponentDescriptorProvider)componentDescriptorProvider
78
+ {
79
+ return concreteComponentDescriptorProvider<AddToWalletButtonComponentDescriptor>();
80
+ }
81
+
82
+ - (void)prepareForRecycle
83
+ {
84
+ [super prepareForRecycle];
85
+ [self prepareView];
86
+ }
87
+
88
+ @end
89
+
90
+ Class<RCTComponentViewProtocol> AddToWalletButtonCls(void)
91
+ {
92
+ return AddToWalletButtonComponentView.class;
93
+ }
@@ -0,0 +1,10 @@
1
+ #import <UIKit/UIKit.h>
2
+ #import <React/RCTViewComponentView.h>
3
+
4
+ NS_ASSUME_NONNULL_BEGIN
5
+
6
+ @interface AddressSheetViewComponentView : RCTViewComponentView
7
+
8
+ @end
9
+
10
+ NS_ASSUME_NONNULL_END