@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,311 @@
1
+ // This is a modified version of the codegen file. Since old arch does not support mEventEmitterCallback
2
+ // we implement event emitting with RCTDeviceEventEmitter.
3
+ // To update this file, take the file generated by codegen and add the `invoke(String, Object)` and
4
+ // `invoke(String)` methods. Then replace `mEventEmitterCallback.invoke` with the `invoke` method.
5
+
6
+ /**
7
+ * This code was generated by [react-native-codegen](https://www.npmjs.com/package/react-native-codegen).
8
+ *
9
+ * Do not edit this file as changes may cause incorrect behavior and will be lost
10
+ * once the code is regenerated.
11
+ *
12
+ * @generated by codegen project: GenerateModuleJavaSpec.js
13
+ *
14
+ * @nolint
15
+ */
16
+
17
+ package com.reactnativestripesdk;
18
+
19
+ import com.facebook.proguard.annotations.DoNotStrip;
20
+ import com.facebook.react.bridge.Promise;
21
+ import com.facebook.react.bridge.ReactApplicationContext;
22
+ import com.facebook.react.bridge.ReactContextBaseJavaModule;
23
+ import com.facebook.react.bridge.ReactMethod;
24
+ import com.facebook.react.bridge.ReadableArray;
25
+ import com.facebook.react.bridge.ReadableMap;
26
+ import com.facebook.react.common.build.ReactBuildConfig;
27
+ import com.facebook.react.modules.core.DeviceEventManagerModule;
28
+ import com.facebook.react.turbomodule.core.interfaces.TurboModule;
29
+ import java.util.Arrays;
30
+ import java.util.HashSet;
31
+ import java.util.Map;
32
+ import java.util.Set;
33
+ import javax.annotation.Nonnull;
34
+ import javax.annotation.Nullable;
35
+
36
+ public abstract class NativeStripeSdkModuleSpec extends ReactContextBaseJavaModule implements TurboModule {
37
+ public static final String NAME = "StripeSdk";
38
+
39
+ public NativeStripeSdkModuleSpec(ReactApplicationContext reactContext) {
40
+ super(reactContext);
41
+ }
42
+
43
+ @Override
44
+ public @Nonnull String getName() {
45
+ return NAME;
46
+ }
47
+
48
+ private void invoke(String eventName, Object params) {
49
+ getReactApplicationContext()
50
+ .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
51
+ .emit(eventName, params);
52
+ }
53
+
54
+ private void invoke(String eventName) {
55
+ invoke(eventName, null);
56
+ }
57
+
58
+ protected final void emitOnConfirmHandlerCallback(ReadableMap value) {
59
+ invoke("onConfirmHandlerCallback", value);
60
+ }
61
+
62
+ protected final void emitOnFinancialConnectionsEvent(ReadableMap value) {
63
+ invoke("onFinancialConnectionsEvent", value);
64
+ }
65
+
66
+ protected final void emitOnOrderTrackingCallback() {
67
+ invoke("onOrderTrackingCallback");
68
+ }
69
+
70
+ protected final void emitOnCustomerAdapterFetchPaymentMethodsCallback() {
71
+ invoke("onCustomerAdapterFetchPaymentMethodsCallback");
72
+ }
73
+
74
+ protected final void emitOnCustomerAdapterAttachPaymentMethodCallback(ReadableMap value) {
75
+ invoke("onCustomerAdapterAttachPaymentMethodCallback", value);
76
+ }
77
+
78
+ protected final void emitOnCustomerAdapterDetachPaymentMethodCallback(ReadableMap value) {
79
+ invoke("onCustomerAdapterDetachPaymentMethodCallback", value);
80
+ }
81
+
82
+ protected final void emitOnCustomerAdapterSetSelectedPaymentOptionCallback(ReadableMap value) {
83
+ invoke("onCustomerAdapterSetSelectedPaymentOptionCallback", value);
84
+ }
85
+
86
+ protected final void emitOnCustomerAdapterFetchSelectedPaymentOptionCallback() {
87
+ invoke("onCustomerAdapterFetchSelectedPaymentOptionCallback");
88
+ }
89
+
90
+ protected final void emitOnCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback() {
91
+ invoke("onCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback");
92
+ }
93
+
94
+ protected final void emitEmbeddedPaymentElementDidUpdateHeight(ReadableMap value) {
95
+ invoke("embeddedPaymentElementDidUpdateHeight", value);
96
+ }
97
+
98
+ protected final void emitEmbeddedPaymentElementWillPresent() {
99
+ invoke("embeddedPaymentElementWillPresent");
100
+ }
101
+
102
+ protected final void emitEmbeddedPaymentElementDidUpdatePaymentOption(ReadableMap value) {
103
+ invoke("embeddedPaymentElementDidUpdatePaymentOption", value);
104
+ }
105
+
106
+ protected final void emitEmbeddedPaymentElementFormSheetConfirmComplete(ReadableMap value) {
107
+ invoke("embeddedPaymentElementFormSheetConfirmComplete", value);
108
+ }
109
+
110
+ protected final void emitEmbeddedPaymentElementRowSelectionImmediateAction() {
111
+ invoke("embeddedPaymentElementRowSelectionImmediateAction");
112
+ }
113
+
114
+ protected final void emitEmbeddedPaymentElementLoadingFailed(ReadableMap value) {
115
+ invoke("embeddedPaymentElementLoadingFailed", value);
116
+ }
117
+
118
+ @ReactMethod
119
+ @DoNotStrip
120
+ public abstract void initialise(ReadableMap params, Promise promise);
121
+
122
+ @ReactMethod
123
+ @DoNotStrip
124
+ public abstract void createPaymentMethod(ReadableMap params, ReadableMap options, Promise promise);
125
+
126
+ @ReactMethod
127
+ @DoNotStrip
128
+ public abstract void handleNextAction(String paymentIntentClientSecret, @Nullable String returnURL, Promise promise);
129
+
130
+ @ReactMethod
131
+ @DoNotStrip
132
+ public abstract void handleNextActionForSetup(String setupIntentClientSecret, @Nullable String returnURL, Promise promise);
133
+
134
+ @ReactMethod
135
+ @DoNotStrip
136
+ public abstract void confirmPayment(String paymentIntentClientSecret, @Nullable ReadableMap params, @Nullable ReadableMap options, Promise promise);
137
+
138
+ @ReactMethod
139
+ @DoNotStrip
140
+ public abstract void confirmSetupIntent(String paymentIntentClientSecret, ReadableMap params, ReadableMap options, Promise promise);
141
+
142
+ @ReactMethod
143
+ @DoNotStrip
144
+ public abstract void retrievePaymentIntent(String clientSecret, Promise promise);
145
+
146
+ @ReactMethod
147
+ @DoNotStrip
148
+ public abstract void retrieveSetupIntent(String clientSecret, Promise promise);
149
+
150
+ @ReactMethod
151
+ @DoNotStrip
152
+ public abstract void initPaymentSheet(ReadableMap params, Promise promise);
153
+
154
+ @ReactMethod
155
+ @DoNotStrip
156
+ public abstract void intentCreationCallback(ReadableMap result, Promise promise);
157
+
158
+ @ReactMethod
159
+ @DoNotStrip
160
+ public abstract void presentPaymentSheet(ReadableMap options, Promise promise);
161
+
162
+ @ReactMethod
163
+ @DoNotStrip
164
+ public abstract void confirmPaymentSheetPayment(Promise promise);
165
+
166
+ @ReactMethod
167
+ @DoNotStrip
168
+ public abstract void createTokenForCVCUpdate(String cvc, Promise promise);
169
+
170
+ @ReactMethod
171
+ @DoNotStrip
172
+ public abstract void handleURLCallback(String url, Promise promise);
173
+
174
+ @ReactMethod
175
+ @DoNotStrip
176
+ public abstract void createToken(ReadableMap params, Promise promise);
177
+
178
+ @ReactMethod
179
+ @DoNotStrip
180
+ public abstract void openApplePaySetup(Promise promise);
181
+
182
+ @ReactMethod
183
+ @DoNotStrip
184
+ public abstract void verifyMicrodeposits(boolean isPaymentIntent, String clientSecret, ReadableMap params, Promise promise);
185
+
186
+ @ReactMethod
187
+ @DoNotStrip
188
+ public abstract void collectBankAccount(boolean isPaymentIntent, String clientSecret, ReadableMap params, Promise promise);
189
+
190
+ protected abstract Map<String, Object> getTypedExportedConstants();
191
+
192
+ @Override
193
+ @DoNotStrip
194
+ public final @Nullable Map<String, Object> getConstants() {
195
+ Map<String, Object> constants = getTypedExportedConstants();
196
+ if (ReactBuildConfig.DEBUG || ReactBuildConfig.IS_INTERNAL_BUILD) {
197
+ Set<String> obligatoryFlowConstants = new HashSet<>(Arrays.asList(
198
+ "API_VERSIONS"
199
+ ));
200
+ Set<String> optionalFlowConstants = new HashSet<>();
201
+ Set<String> undeclaredConstants = new HashSet<>(constants.keySet());
202
+ undeclaredConstants.removeAll(obligatoryFlowConstants);
203
+ undeclaredConstants.removeAll(optionalFlowConstants);
204
+ if (!undeclaredConstants.isEmpty()) {
205
+ throw new IllegalStateException(String.format("Native Module Flow doesn't declare constants: %s", undeclaredConstants));
206
+ }
207
+ undeclaredConstants = obligatoryFlowConstants;
208
+ undeclaredConstants.removeAll(constants.keySet());
209
+ if (!undeclaredConstants.isEmpty()) {
210
+ throw new IllegalStateException(String.format("Native Module doesn't fill in constants: %s", undeclaredConstants));
211
+ }
212
+ }
213
+ return constants;
214
+ }
215
+
216
+ @ReactMethod
217
+ @DoNotStrip
218
+ public abstract void canAddCardToWallet(ReadableMap params, Promise promise);
219
+
220
+ @ReactMethod
221
+ @DoNotStrip
222
+ public abstract void isCardInWallet(ReadableMap params, Promise promise);
223
+
224
+ @ReactMethod
225
+ @DoNotStrip
226
+ public abstract void collectBankAccountToken(String clientSecret, ReadableMap params, Promise promise);
227
+
228
+ @ReactMethod
229
+ @DoNotStrip
230
+ public abstract void collectFinancialConnectionsAccounts(String clientSecret, ReadableMap params, Promise promise);
231
+
232
+ @ReactMethod
233
+ @DoNotStrip
234
+ public abstract void resetPaymentSheetCustomer(Promise promise);
235
+
236
+ @ReactMethod
237
+ @DoNotStrip
238
+ public abstract void isPlatformPaySupported(ReadableMap params, Promise promise);
239
+
240
+ @ReactMethod
241
+ @DoNotStrip
242
+ public abstract void createPlatformPayPaymentMethod(ReadableMap params, boolean usesDeprecatedTokenFlow, Promise promise);
243
+
244
+ @ReactMethod
245
+ @DoNotStrip
246
+ public abstract void dismissPlatformPay(Promise promise);
247
+
248
+ @ReactMethod
249
+ @DoNotStrip
250
+ public abstract void updatePlatformPaySheet(ReadableArray summaryItems, ReadableArray shippingMethods, ReadableArray errors, Promise promise);
251
+
252
+ @ReactMethod
253
+ @DoNotStrip
254
+ public abstract void confirmPlatformPay(String clientSecret, ReadableMap params, boolean isPaymentIntent, Promise promise);
255
+
256
+ @ReactMethod
257
+ @DoNotStrip
258
+ public abstract void configureOrderTracking(String orderTypeIdentifier, String orderIdentifier, String webServiceUrl, String authenticationToken, Promise promise);
259
+
260
+ @ReactMethod
261
+ @DoNotStrip
262
+ public abstract void initCustomerSheet(ReadableMap params, ReadableMap customerAdapterOverrides, Promise promise);
263
+
264
+ @ReactMethod
265
+ @DoNotStrip
266
+ public abstract void presentCustomerSheet(ReadableMap params, Promise promise);
267
+
268
+ @ReactMethod
269
+ @DoNotStrip
270
+ public abstract void retrieveCustomerSheetPaymentOptionSelection(Promise promise);
271
+
272
+ @ReactMethod
273
+ @DoNotStrip
274
+ public abstract void customerAdapterFetchPaymentMethodsCallback(ReadableArray paymentMethods, Promise promise);
275
+
276
+ @ReactMethod
277
+ @DoNotStrip
278
+ public abstract void customerAdapterAttachPaymentMethodCallback(ReadableMap paymentMethod, Promise promise);
279
+
280
+ @ReactMethod
281
+ @DoNotStrip
282
+ public abstract void customerAdapterDetachPaymentMethodCallback(ReadableMap paymentMethod, Promise promise);
283
+
284
+ @ReactMethod
285
+ @DoNotStrip
286
+ public abstract void customerAdapterSetSelectedPaymentOptionCallback(Promise promise);
287
+
288
+ @ReactMethod
289
+ @DoNotStrip
290
+ public abstract void customerAdapterFetchSelectedPaymentOptionCallback(@Nullable String paymentOption, Promise promise);
291
+
292
+ @ReactMethod
293
+ @DoNotStrip
294
+ public abstract void customerAdapterSetupIntentClientSecretForCustomerAttachCallback(String clientSecret, Promise promise);
295
+
296
+ @ReactMethod
297
+ @DoNotStrip
298
+ public abstract void createEmbeddedPaymentElement(ReadableMap intentConfig, ReadableMap configuration, Promise promise);
299
+
300
+ @ReactMethod
301
+ @DoNotStrip
302
+ public abstract void confirmEmbeddedPaymentElement(double viewTag, Promise promise);
303
+
304
+ @ReactMethod
305
+ @DoNotStrip
306
+ public abstract void updateEmbeddedPaymentElement(ReadableMap intentConfig, Promise promise);
307
+
308
+ @ReactMethod
309
+ @DoNotStrip
310
+ public abstract void clearEmbeddedPaymentOption(double viewTag, Promise promise);
311
+ }
@@ -13,7 +13,7 @@ class AddressSheetUtils {
13
13
  guard let params = params else {
14
14
  return AddressViewController.Configuration.DefaultAddressDetails()
15
15
  }
16
-
16
+
17
17
  return AddressViewController.Configuration.DefaultAddressDetails(
18
18
  address: buildAddress(params: params["address"] as? NSDictionary),
19
19
  name: params["name"] as? String,
@@ -21,7 +21,7 @@ class AddressSheetUtils {
21
21
  isCheckboxSelected: params["isCheckboxSelected"] as? Bool
22
22
  )
23
23
  }
24
-
24
+
25
25
  internal class func buildAddressDetails(params: NSDictionary?) -> AddressViewController.AddressDetails {
26
26
  guard let params = params else { return AddressViewController.AddressDetails(address: buildAddress(params: nil)) }
27
27
  return AddressViewController.AddressDetails(
@@ -30,7 +30,7 @@ class AddressSheetUtils {
30
30
  phone: params["phone"] as? String,
31
31
  isCheckboxSelected: params["isCheckboxSelected"] as? Bool)
32
32
  }
33
-
33
+
34
34
  internal class func buildAddress(params: NSDictionary?) -> PaymentSheet.Address {
35
35
  guard let params = params else { return PaymentSheet.Address() }
36
36
  return PaymentSheet.Address(
@@ -42,7 +42,7 @@ class AddressSheetUtils {
42
42
  state: params["state"] as? String
43
43
  )
44
44
  }
45
-
45
+
46
46
  internal class func buildAddress(params: NSDictionary?) -> AddressViewController.AddressDetails.Address {
47
47
  guard let params = params else { return AddressViewController.AddressDetails.Address(country: "", line1: "") }
48
48
  return AddressViewController.AddressDetails.Address(
@@ -54,7 +54,7 @@ class AddressSheetUtils {
54
54
  state: params["state"] as? String
55
55
  )
56
56
  }
57
-
57
+
58
58
  internal class func buildAdditionalFieldsConfiguration(params: NSDictionary?) -> AddressViewController.Configuration.AdditionalFields {
59
59
  guard let params = params else {
60
60
  return AddressViewController.Configuration.AdditionalFields(phone: .hidden, checkboxLabel: nil)
@@ -65,7 +65,7 @@ class AddressSheetUtils {
65
65
  checkboxLabel: params["checkboxLabel"] as? String
66
66
  )
67
67
  }
68
-
68
+
69
69
  internal class func getFieldConfiguration(input: String?, default: AddressViewController.Configuration.AdditionalFields.FieldConfiguration) -> AddressViewController.Configuration.AdditionalFields.FieldConfiguration {
70
70
  switch (input) {
71
71
  case "optional":
@@ -78,21 +78,23 @@ class AddressSheetUtils {
78
78
  return `default`
79
79
  }
80
80
  }
81
-
81
+
82
82
  internal class func buildResult(address: AddressViewController.AddressDetails) -> [AnyHashable : Any] {
83
83
  return [
84
- "name": address.name ?? NSNull(),
85
- "address": [
86
- "country": address.address.country,
87
- "state": address.address.state,
88
- "line1": address.address.line1,
89
- "line2": address.address.line2,
90
- "postalCode": address.address.postalCode,
91
- "city": address.address.city,
92
- ],
93
- "phone": address.phone ?? NSNull(),
94
- "isCheckboxSelected": address.isCheckboxSelected ?? NSNull(),
95
- ] as [AnyHashable : Any]
84
+ "result": [
85
+ "name": address.name ?? NSNull(),
86
+ "address": [
87
+ "country": address.address.country,
88
+ "state": address.address.state,
89
+ "line1": address.address.line1,
90
+ "line2": address.address.line2,
91
+ "postalCode": address.address.postalCode,
92
+ "city": address.address.city,
93
+ ],
94
+ "phone": address.phone ?? NSNull(),
95
+ "isCheckboxSelected": address.isCheckboxSelected ?? NSNull(),
96
+ ] as [AnyHashable : Any]
97
+ ]
96
98
  }
97
99
 
98
100
  }
@@ -9,33 +9,33 @@ import Foundation
9
9
  import StripePaymentSheet
10
10
 
11
11
  @objc(AddressSheetView)
12
- class AddressSheetView: UIView {
13
- @objc var visible = false
14
- @objc var presentationStyle: String = "popover"
15
- @objc var animationStyle: String = ""
16
- @objc var appearance: NSDictionary? = nil
17
- @objc var defaultValues: NSDictionary? = nil
18
- @objc var additionalFields: NSDictionary? = nil
19
- @objc var allowedCountries: [String] = []
20
- @objc var autocompleteCountries: [String] = []
21
- @objc var primaryButtonTitle: String? = nil
22
- @objc var sheetTitle: String? = nil
23
- @objc var onSubmitAction: RCTDirectEventBlock?
24
- @objc var onErrorAction: RCTDirectEventBlock?
12
+ public class AddressSheetView: UIView {
13
+ @objc public var visible = false
14
+ @objc public var presentationStyle: String = "popover"
15
+ @objc public var animationStyle: String = ""
16
+ @objc public var appearance: NSDictionary? = nil
17
+ @objc public var defaultValues: NSDictionary? = nil
18
+ @objc public var additionalFields: NSDictionary? = nil
19
+ @objc public var allowedCountries: [String] = []
20
+ @objc public var autocompleteCountries: [String] = []
21
+ @objc public var primaryButtonTitle: String? = nil
22
+ @objc public var sheetTitle: String? = nil
23
+ @objc public var onSubmitAction: RCTDirectEventBlock?
24
+ @objc public var onErrorAction: RCTDirectEventBlock?
25
25
 
26
26
  private var wasVisible = false
27
27
  private var addressViewController: AddressViewController? = nil
28
28
  internal var addressDetails: AddressViewController.AddressDetails? = nil
29
29
 
30
- override init(frame: CGRect) {
30
+ override public init(frame: CGRect) {
31
31
  super.init(frame: frame)
32
32
  }
33
33
 
34
34
  required init?(coder: NSCoder) {
35
35
  fatalError("init(coder:) has not been implemented")
36
36
  }
37
-
38
- override func didSetProps(_ changedProps: [String]!) {
37
+
38
+ @objc public func didSetProps() {
39
39
  if (visible && !wasVisible) {
40
40
  presentAddressSheet()
41
41
  wasVisible = true
@@ -44,6 +44,12 @@ class AddressSheetView: UIView {
44
44
  wasVisible = false
45
45
  }
46
46
  }
47
+
48
+ override public func didSetProps(_ changedProps: [String]!) {
49
+ // This is only called on old arch, for new arch didSetProps() will be called
50
+ // by the view component.
51
+ self.didSetProps()
52
+ }
47
53
 
48
54
  private func presentAddressSheet() {
49
55
  if (STPAPIClient.shared.publishableKey == nil) {
@@ -123,7 +129,7 @@ class AddressSheetView: UIView {
123
129
  }
124
130
 
125
131
  extension AddressSheetView: AddressViewControllerDelegate {
126
- func addressViewControllerDidFinish(_ addressViewController: AddressViewController, with address: AddressViewController.AddressDetails?) {
132
+ public func addressViewControllerDidFinish(_ addressViewController: AddressViewController, with address: AddressViewController.AddressDetails?) {
127
133
  guard let address = address else {
128
134
  onErrorAction!(
129
135
  Errors.createError(
@@ -3,7 +3,6 @@
3
3
  #import <React/RCTViewManager.h>
4
4
 
5
5
  @interface RCT_EXTERN_MODULE(ApplePayButtonManager, RCTViewManager)
6
- RCT_EXPORT_VIEW_PROPERTY(onPressAction, RCTDirectEventBlock)
7
6
  RCT_EXPORT_VIEW_PROPERTY(type, NSNumber)
8
7
  RCT_EXPORT_VIEW_PROPERTY(buttonStyle, NSNumber)
9
8
  RCT_EXPORT_VIEW_PROPERTY(borderRadius, NSNumber)
@@ -3,9 +3,7 @@ import Foundation
3
3
  @objc(ApplePayButtonManager)
4
4
  class ApplePayButtonManager: RCTViewManager {
5
5
  override func view() -> UIView! {
6
- let view = ApplePayButtonView(frame: CGRect.init())
7
- view.stripeSdk = bridge.module(forName: "StripeSdk") as? StripeSdk
8
- return view
6
+ return ApplePayButtonView(frame: CGRect.init())
9
7
  }
10
8
 
11
9
  override class func requiresMainQueueSetup() -> Bool {
@@ -2,29 +2,27 @@ import Foundation
2
2
  import UIKit
3
3
 
4
4
  @objc(ApplePayButtonView)
5
- class ApplePayButtonView: UIView {
5
+ public class ApplePayButtonView: UIView {
6
6
  var applePayButton: PKPaymentButton?
7
- var stripeSdk: StripeSdk?
8
-
9
- @objc var onPressAction: RCTDirectEventBlock?
10
- @objc var onShippingMethodSelectedAction: RCTDirectEventBlock?
11
- @objc var onShippingContactSelectedAction: RCTDirectEventBlock?
12
- @objc var onCouponCodeEnteredAction: RCTDirectEventBlock?
13
- @objc var onOrderTrackingAction: RCTDirectEventBlock?
7
+
8
+ @objc public var onShippingMethodSelectedAction: RCTDirectEventBlock?
9
+ @objc public var onShippingContactSelectedAction: RCTDirectEventBlock?
10
+ @objc public var onCouponCodeEnteredAction: RCTDirectEventBlock?
11
+ @objc public var onOrderTrackingAction: RCTDirectEventBlock?
14
12
 
15
- @objc var type: NSNumber?
16
- @objc var buttonStyle: NSNumber?
17
- @objc var borderRadius: NSNumber?
18
- @objc var disabled = false
13
+ @objc public var type: NSNumber?
14
+ @objc public var buttonStyle: NSNumber?
15
+ @objc public var borderRadius: NSNumber?
16
+ @objc public var disabled = false
19
17
 
20
18
  @objc func handleApplePayButtonTapped() {
21
- stripeSdk?.shippingMethodUpdateJSCallback = onShippingMethodSelectedAction
22
- stripeSdk?.shippingContactUpdateJSCallback = onShippingContactSelectedAction
23
- stripeSdk?.couponCodeEnteredJSCallback = onCouponCodeEnteredAction
24
- stripeSdk?.platformPayOrderTrackingJSCallback = onOrderTrackingAction
19
+ StripeSdkImpl.shared.shippingMethodUpdateJSCallback = onShippingMethodSelectedAction
20
+ StripeSdkImpl.shared.shippingContactUpdateJSCallback = onShippingContactSelectedAction
21
+ StripeSdkImpl.shared.couponCodeEnteredJSCallback = onCouponCodeEnteredAction
22
+ StripeSdkImpl.shared.platformPayOrderTrackingJSCallback = onOrderTrackingAction
25
23
  }
26
-
27
- override func didSetProps(_ changedProps: [String]!) {
24
+
25
+ @objc public func didSetProps() {
28
26
  if let applePayButton = self.applePayButton {
29
27
  applePayButton.removeFromSuperview()
30
28
  }
@@ -42,11 +40,18 @@ class ApplePayButtonView: UIView {
42
40
  }
43
41
  }
44
42
 
45
- override init(frame: CGRect) {
43
+ override public func didSetProps(_ changedProps: [String]!) {
44
+ // This is only called on old arch, for new arch didSetProps() will be called
45
+ // by the view component.
46
+ self.didSetProps()
47
+ }
48
+
49
+
50
+ override public init(frame: CGRect) {
46
51
  super.init(frame: frame)
47
52
  }
48
53
 
49
- override func layoutSubviews() {
54
+ override public func layoutSubviews() {
50
55
  if let applePayButton = self.applePayButton {
51
56
  applePayButton.frame = self.bounds
52
57
  }
@@ -8,8 +8,8 @@
8
8
  import Foundation
9
9
  import Stripe
10
10
 
11
- extension StripeSdk : PKPaymentAuthorizationViewControllerDelegate, STPApplePayContextDelegate {
12
- func paymentAuthorizationViewController(
11
+ extension StripeSdkImpl : PKPaymentAuthorizationViewControllerDelegate, STPApplePayContextDelegate {
12
+ public func paymentAuthorizationViewController(
13
13
  _ controller: PKPaymentAuthorizationViewController,
14
14
  didAuthorizePayment payment: PKPayment,
15
15
  handler completion: @escaping (PKPaymentAuthorizationResult) -> Void
@@ -51,7 +51,7 @@ extension StripeSdk : PKPaymentAuthorizationViewControllerDelegate, STPApplePayC
51
51
  }
52
52
  }
53
53
 
54
- func paymentAuthorizationViewControllerDidFinish(
54
+ public func paymentAuthorizationViewControllerDidFinish(
55
55
  _ controller: PKPaymentAuthorizationViewController
56
56
  ) {
57
57
  if (applePaymentMethodFlowCanBeCanceled) {
@@ -72,7 +72,7 @@ extension StripeSdk : PKPaymentAuthorizationViewControllerDelegate, STPApplePayC
72
72
  }
73
73
 
74
74
  @available(iOS 15.0, *)
75
- func paymentAuthorizationViewController(
75
+ public func paymentAuthorizationViewController(
76
76
  _ controller: PKPaymentAuthorizationViewController,
77
77
  didChangeCouponCode couponCode: String,
78
78
  handler completion: @escaping (PKPaymentRequestCouponCodeUpdate) -> Void
@@ -91,7 +91,7 @@ extension StripeSdk : PKPaymentAuthorizationViewControllerDelegate, STPApplePayC
91
91
  }
92
92
  }
93
93
 
94
- func paymentAuthorizationViewController(
94
+ public func paymentAuthorizationViewController(
95
95
  _ controller: PKPaymentAuthorizationViewController,
96
96
  didSelect shippingMethod: PKShippingMethod,
97
97
  handler completion: @escaping (PKPaymentRequestShippingMethodUpdate) -> Void
@@ -106,7 +106,7 @@ extension StripeSdk : PKPaymentAuthorizationViewControllerDelegate, STPApplePayC
106
106
  }
107
107
  }
108
108
 
109
- func paymentAuthorizationViewController(
109
+ public func paymentAuthorizationViewController(
110
110
  _ controller: PKPaymentAuthorizationViewController,
111
111
  didSelectShippingContact contact: PKContact,
112
112
  handler completion: @escaping (PKPaymentRequestShippingContactUpdate) -> Void
@@ -125,7 +125,7 @@ extension StripeSdk : PKPaymentAuthorizationViewControllerDelegate, STPApplePayC
125
125
  }
126
126
  }
127
127
 
128
- func applePayContext(
128
+ public func applePayContext(
129
129
  _ context: STPApplePayContext,
130
130
  didSelect shippingMethod: PKShippingMethod,
131
131
  handler: @escaping (PKPaymentRequestShippingMethodUpdate) -> Void
@@ -140,7 +140,7 @@ extension StripeSdk : PKPaymentAuthorizationViewControllerDelegate, STPApplePayC
140
140
  }
141
141
  }
142
142
 
143
- func applePayContext(
143
+ public func applePayContext(
144
144
  _ context: STPApplePayContext,
145
145
  didSelectShippingContact contact: PKContact,
146
146
  handler: @escaping (PKPaymentRequestShippingContactUpdate) -> Void
@@ -159,7 +159,7 @@ extension StripeSdk : PKPaymentAuthorizationViewControllerDelegate, STPApplePayC
159
159
  }
160
160
  }
161
161
 
162
- func applePayContext(
162
+ public func applePayContext(
163
163
  _ context: STPApplePayContext,
164
164
  didCreatePaymentMethod paymentMethod: STPPaymentMethod,
165
165
  paymentInformation: PKPayment,
@@ -175,20 +175,20 @@ extension StripeSdk : PKPaymentAuthorizationViewControllerDelegate, STPApplePayC
175
175
  }
176
176
  }
177
177
 
178
- func applePayContext(
179
- _ context: STPApplePayContext,
180
- willCompleteWithResult authorizationResult: PKPaymentAuthorizationResult,
181
- handler: @escaping (PKPaymentAuthorizationResult) -> Void
182
- ) {
183
- if let callback = self.platformPayOrderTrackingJSCallback {
184
- self.orderTrackingHandler = (authorizationResult, handler)
185
- callback(nil)
186
- } else {
187
- handler(authorizationResult)
188
- }
189
- }
178
+ public func applePayContext(
179
+ _ context: STPApplePayContext,
180
+ willCompleteWithResult authorizationResult: PKPaymentAuthorizationResult,
181
+ handler: @escaping (PKPaymentAuthorizationResult) -> Void
182
+ ) {
183
+ if let callback = self.platformPayOrderTrackingJSCallback {
184
+ self.orderTrackingHandler = (authorizationResult, handler)
185
+ callback(nil)
186
+ } else {
187
+ handler(authorizationResult)
188
+ }
189
+ }
190
190
 
191
- func applePayContext(
191
+ public func applePayContext(
192
192
  _ context: STPApplePayContext,
193
193
  didCompleteWith status: STPPaymentStatus,
194
194
  error: Error?