@stripe/stripe-react-native 0.57.0 → 0.57.2

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 (324) hide show
  1. package/README.md +0 -8
  2. package/android/.idea/AndroidProjectSystem.xml +6 -0
  3. package/android/.idea/caches/deviceStreaming.xml +1029 -0
  4. package/android/.idea/compiler.xml +6 -0
  5. package/android/.idea/gradle.xml +19 -0
  6. package/android/.idea/migrations.xml +10 -0
  7. package/android/.idea/misc.xml +10 -0
  8. package/android/.idea/runConfigurations.xml +17 -0
  9. package/android/.idea/vcs.xml +6 -0
  10. package/android/build.gradle +76 -118
  11. package/android/gradle.properties +1 -1
  12. package/android/local.properties +8 -0
  13. package/android/settings.gradle +2 -0
  14. package/android/spotless.gradle +1 -1
  15. package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormView.kt +20 -17
  16. package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +13 -11
  17. package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +17 -21
  18. package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherManager.kt +2 -0
  19. package/android/src/main/java/com/reactnativestripesdk/CustomPaymentMethodActivity.kt +2 -0
  20. package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +53 -11
  21. package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +105 -117
  22. package/android/src/main/java/com/reactnativestripesdk/EventEmitterCompat.kt +4 -8
  23. package/android/src/main/java/com/reactnativestripesdk/FakeOnrampSdkModule.kt +154 -0
  24. package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetManager.kt +13 -15
  25. package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt +1 -1
  26. package/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherManager.kt +1 -1
  27. package/android/src/main/java/com/reactnativestripesdk/GooglePayRequestHelper.kt +7 -5
  28. package/android/src/main/java/com/reactnativestripesdk/NavigationBarManager.kt +31 -0
  29. package/android/src/main/java/com/reactnativestripesdk/NavigationBarView.kt +120 -0
  30. package/android/src/main/java/com/reactnativestripesdk/PaymentElementConfig.kt +228 -0
  31. package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherManager.kt +1 -0
  32. package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +3 -0
  33. package/android/src/main/java/com/reactnativestripesdk/PaymentOptionDisplayDataMapper.kt +4 -6
  34. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +73 -30
  35. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetManager.kt +19 -245
  36. package/android/src/main/java/com/reactnativestripesdk/StripeAbstractComposeView.kt +53 -17
  37. package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +52 -14
  38. package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +21 -2
  39. package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetView.kt +4 -4
  40. package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetViewManager.kt +2 -2
  41. package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetManager.kt +15 -35
  42. package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerSessionProvider.kt +2 -1
  43. package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +5 -10
  44. package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt +90 -77
  45. package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/TapAndPayProxy.kt +6 -4
  46. package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +13 -3
  47. package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +41 -0
  48. package/android/src/main/java/com/reactnativestripesdk/utils/KeepJsAwakeTask.kt +1 -1
  49. package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +92 -44
  50. package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerDelegate.java +3 -0
  51. package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerInterface.java +2 -0
  52. package/android/src/oldarch/java/com/reactnativestripesdk/NativeOnrampSdkModuleSpec.java +118 -0
  53. package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +4 -0
  54. package/android/src/onramp/java/com/reactnativestripesdk/OnrampSdkModule.kt +922 -0
  55. package/android/src/test/java/com/facebook/testutils/shadows/ShadowArguments.kt +29 -0
  56. package/android/src/test/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManagerTest.kt +163 -0
  57. package/android/src/test/java/com/reactnativestripesdk/PaymentElementConfigTest.kt +976 -0
  58. package/android/src/test/java/com/reactnativestripesdk/PaymentSheetAppearanceTest.kt +801 -0
  59. package/android/src/test/java/com/reactnativestripesdk/PaymentSheetManagerTest.kt +523 -0
  60. package/android/src/test/java/com/reactnativestripesdk/addresssheet/AddressSheetViewTest.kt +551 -0
  61. package/android/src/test/java/com/reactnativestripesdk/mappers/MappersTest.kt +567 -0
  62. package/android/src/test/java/com/reactnativestripesdk/mappers/PaymentOptionDisplayDataMapperTest.kt +456 -0
  63. package/android/src/test/java/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxyTest.kt +43 -0
  64. package/android/src/test/resources/robolectric.properties +2 -0
  65. package/ios/AddressSheet/AddressSheetUtils.swift +3 -3
  66. package/ios/AddressSheet/AddressSheetView.swift +25 -25
  67. package/ios/AddressSheet/AddressSheetViewManager.swift +2 -2
  68. package/ios/ApplePayButtonManager.swift +1 -1
  69. package/ios/ApplePayButtonView.swift +9 -10
  70. package/ios/ApplePayUtils.swift +51 -51
  71. package/ios/ApplePayViewController.swift +25 -29
  72. package/ios/AuBECSDebitFormManager.swift +1 -1
  73. package/ios/AuBECSDebitFormView.swift +13 -15
  74. package/ios/CardFieldManager.swift +4 -4
  75. package/ios/CardFieldView.swift +9 -9
  76. package/ios/CardFormManager.swift +3 -3
  77. package/ios/CardFormView.swift +28 -28
  78. package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingView.swift +97 -0
  79. package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewController.swift +133 -0
  80. package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewManager.m +16 -0
  81. package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewManager.swift +17 -0
  82. package/ios/CustomerSheet/CustomerSheetUtils.swift +15 -16
  83. package/ios/CustomerSheet/ReactNativeCustomerAdapter.swift +19 -19
  84. package/ios/EmbeddedPaymentElementView.swift +2 -2
  85. package/ios/Errors.swift +22 -23
  86. package/ios/FinancialConnections.swift +37 -37
  87. package/ios/Mappers.swift +210 -71
  88. package/ios/NavigationBarManager.m +13 -0
  89. package/ios/NavigationBarManager.swift +17 -0
  90. package/ios/NavigationBarView.swift +65 -0
  91. package/ios/NewArch/NavigationBarComponentView.h +10 -0
  92. package/ios/NewArch/NavigationBarComponentView.mm +86 -0
  93. package/ios/OldArch/StripeSdkEventEmitterCompat.h +1 -0
  94. package/ios/OldArch/StripeSdkEventEmitterCompat.m +7 -1
  95. package/ios/PaymentMethodFactory.swift +24 -24
  96. package/ios/PaymentOptionDisplayData+ReactNative.swift +4 -4
  97. package/ios/PaymentPassFinder.swift +9 -10
  98. package/ios/PaymentSheetAppearance.swift +137 -138
  99. package/ios/PushProvisioning/AddToWalletButtonManager.swift +2 -2
  100. package/ios/PushProvisioning/AddToWalletButtonView.swift +15 -17
  101. package/ios/PushProvisioning/PushProvisioningUtils.swift +11 -11
  102. package/ios/StripeContainerManager.swift +1 -1
  103. package/ios/StripeContainerView.swift +3 -3
  104. package/ios/StripeOnrampSdk.h +17 -0
  105. package/ios/StripeOnrampSdk.mm +158 -0
  106. package/ios/StripeSdk.mm +8 -0
  107. package/ios/StripeSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
  108. package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcuserdata/tianzhao.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
  109. package/ios/StripeSdk.xcodeproj/xcuserdata/tianzhao.xcuserdatad/xcschemes/xcschememanagement.plist +19 -0
  110. package/ios/StripeSdkEmitter.swift +4 -0
  111. package/ios/StripeSdkImpl+CustomerSheet.swift +30 -25
  112. package/ios/StripeSdkImpl+Embedded.swift +11 -9
  113. package/ios/StripeSdkImpl+PaymentSheet.swift +36 -34
  114. package/ios/StripeSdkImpl.swift +913 -185
  115. package/ios/UIColorExtension.swift +72 -0
  116. package/lib/commonjs/components/AddToWalletButton.js +1 -1
  117. package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
  118. package/lib/commonjs/components/AddressSheet.js +1 -1
  119. package/lib/commonjs/components/AddressSheet.js.map +1 -1
  120. package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
  121. package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
  122. package/lib/commonjs/components/CardField.js +1 -1
  123. package/lib/commonjs/components/CardField.js.map +1 -1
  124. package/lib/commonjs/components/CardForm.js +1 -1
  125. package/lib/commonjs/components/CardForm.js.map +1 -1
  126. package/lib/commonjs/components/PlatformPayButton.js +1 -1
  127. package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
  128. package/lib/commonjs/components/StripeContainer.js +1 -1
  129. package/lib/commonjs/components/StripeContainer.js.map +1 -1
  130. package/lib/commonjs/components/StripeProvider.js +1 -1
  131. package/lib/commonjs/components/StripeProvider.js.map +1 -1
  132. package/lib/commonjs/connect/Components.js +2 -0
  133. package/lib/commonjs/connect/Components.js.map +1 -0
  134. package/lib/commonjs/connect/ConnectComponentsProvider.js +2 -0
  135. package/lib/commonjs/connect/ConnectComponentsProvider.js.map +1 -0
  136. package/lib/commonjs/connect/EmbeddedComponent.js +19 -0
  137. package/lib/commonjs/connect/EmbeddedComponent.js.map +1 -0
  138. package/lib/commonjs/connect/ModalCloseButton.js +2 -0
  139. package/lib/commonjs/connect/ModalCloseButton.js.map +1 -0
  140. package/lib/commonjs/connect/NavigationBar.js +2 -0
  141. package/lib/commonjs/connect/NavigationBar.js.map +1 -0
  142. package/lib/commonjs/connect/connectTypes.js +2 -0
  143. package/lib/commonjs/connect/connectTypes.js.map +1 -0
  144. package/lib/commonjs/events.js +1 -1
  145. package/lib/commonjs/events.js.map +1 -1
  146. package/lib/commonjs/helpers.js +1 -1
  147. package/lib/commonjs/helpers.js.map +1 -1
  148. package/lib/commonjs/hooks/useOnramp.js +2 -0
  149. package/lib/commonjs/hooks/useOnramp.js.map +1 -0
  150. package/lib/commonjs/index.js +1 -1
  151. package/lib/commonjs/index.js.map +1 -1
  152. package/lib/commonjs/plugin/withStripe.js +1 -1
  153. package/lib/commonjs/plugin/withStripe.js.map +1 -1
  154. package/lib/commonjs/specs/NativeAddToWalletButton.js +1 -1
  155. package/lib/commonjs/specs/NativeAddToWalletButton.js.map +1 -1
  156. package/lib/commonjs/specs/NativeAddressSheet.js +1 -1
  157. package/lib/commonjs/specs/NativeAddressSheet.js.map +1 -1
  158. package/lib/commonjs/specs/NativeApplePayButton.js +1 -1
  159. package/lib/commonjs/specs/NativeApplePayButton.js.map +1 -1
  160. package/lib/commonjs/specs/NativeAuBECSDebitForm.js +1 -1
  161. package/lib/commonjs/specs/NativeAuBECSDebitForm.js.map +1 -1
  162. package/lib/commonjs/specs/NativeCardField.js +1 -1
  163. package/lib/commonjs/specs/NativeCardField.js.map +1 -1
  164. package/lib/commonjs/specs/NativeCardForm.js +1 -1
  165. package/lib/commonjs/specs/NativeCardForm.js.map +1 -1
  166. package/lib/commonjs/specs/NativeConnectAccountOnboardingView.js +2 -0
  167. package/lib/commonjs/specs/NativeConnectAccountOnboardingView.js.map +1 -0
  168. package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js +1 -1
  169. package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js.map +1 -1
  170. package/lib/commonjs/specs/NativeGooglePayButton.js +1 -1
  171. package/lib/commonjs/specs/NativeGooglePayButton.js.map +1 -1
  172. package/lib/commonjs/specs/NativeNavigationBar.js +2 -0
  173. package/lib/commonjs/specs/NativeNavigationBar.js.map +1 -0
  174. package/lib/commonjs/specs/NativeOnrampSdkModule.js +2 -0
  175. package/lib/commonjs/specs/NativeOnrampSdkModule.js.map +1 -0
  176. package/lib/commonjs/specs/NativeStripeContainer.js +1 -1
  177. package/lib/commonjs/specs/NativeStripeContainer.js.map +1 -1
  178. package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -1
  179. package/lib/commonjs/types/EmbeddedPaymentElement.js +1 -1
  180. package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -1
  181. package/lib/commonjs/types/Errors.js +1 -1
  182. package/lib/commonjs/types/Errors.js.map +1 -1
  183. package/lib/commonjs/types/Onramp.js +2 -0
  184. package/lib/commonjs/types/Onramp.js.map +1 -0
  185. package/lib/commonjs/types/PaymentSheet.js.map +1 -1
  186. package/lib/commonjs/types/index.js +1 -1
  187. package/lib/commonjs/types/index.js.map +1 -1
  188. package/lib/module/components/AddToWalletButton.js +1 -1
  189. package/lib/module/components/AddToWalletButton.js.map +1 -1
  190. package/lib/module/components/AddressSheet.js +1 -1
  191. package/lib/module/components/AddressSheet.js.map +1 -1
  192. package/lib/module/components/AuBECSDebitForm.js +1 -1
  193. package/lib/module/components/AuBECSDebitForm.js.map +1 -1
  194. package/lib/module/components/CardField.js +1 -1
  195. package/lib/module/components/CardField.js.map +1 -1
  196. package/lib/module/components/CardForm.js +1 -1
  197. package/lib/module/components/CardForm.js.map +1 -1
  198. package/lib/module/components/PlatformPayButton.js +1 -1
  199. package/lib/module/components/PlatformPayButton.js.map +1 -1
  200. package/lib/module/components/StripeContainer.js +1 -1
  201. package/lib/module/components/StripeContainer.js.map +1 -1
  202. package/lib/module/components/StripeProvider.js +1 -1
  203. package/lib/module/components/StripeProvider.js.map +1 -1
  204. package/lib/module/connect/Components.js +2 -0
  205. package/lib/module/connect/Components.js.map +1 -0
  206. package/lib/module/connect/ConnectComponentsProvider.js +2 -0
  207. package/lib/module/connect/ConnectComponentsProvider.js.map +1 -0
  208. package/lib/module/connect/EmbeddedComponent.js +19 -0
  209. package/lib/module/connect/EmbeddedComponent.js.map +1 -0
  210. package/lib/module/connect/ModalCloseButton.js +2 -0
  211. package/lib/module/connect/ModalCloseButton.js.map +1 -0
  212. package/lib/module/connect/NavigationBar.js +2 -0
  213. package/lib/module/connect/NavigationBar.js.map +1 -0
  214. package/lib/module/connect/connectTypes.js +2 -0
  215. package/lib/module/connect/connectTypes.js.map +1 -0
  216. package/lib/module/events.js +1 -1
  217. package/lib/module/events.js.map +1 -1
  218. package/lib/module/helpers.js +1 -1
  219. package/lib/module/helpers.js.map +1 -1
  220. package/lib/module/hooks/useOnramp.js +2 -0
  221. package/lib/module/hooks/useOnramp.js.map +1 -0
  222. package/lib/module/index.js +1 -1
  223. package/lib/module/index.js.map +1 -1
  224. package/lib/module/plugin/withStripe.js +1 -1
  225. package/lib/module/plugin/withStripe.js.map +1 -1
  226. package/lib/module/specs/NativeAddToWalletButton.js +1 -1
  227. package/lib/module/specs/NativeAddToWalletButton.js.map +1 -1
  228. package/lib/module/specs/NativeAddressSheet.js +1 -1
  229. package/lib/module/specs/NativeAddressSheet.js.map +1 -1
  230. package/lib/module/specs/NativeApplePayButton.js +1 -1
  231. package/lib/module/specs/NativeApplePayButton.js.map +1 -1
  232. package/lib/module/specs/NativeAuBECSDebitForm.js +1 -1
  233. package/lib/module/specs/NativeAuBECSDebitForm.js.map +1 -1
  234. package/lib/module/specs/NativeCardField.js +1 -1
  235. package/lib/module/specs/NativeCardField.js.map +1 -1
  236. package/lib/module/specs/NativeCardForm.js +1 -1
  237. package/lib/module/specs/NativeCardForm.js.map +1 -1
  238. package/lib/module/specs/NativeConnectAccountOnboardingView.js +2 -0
  239. package/lib/module/specs/NativeConnectAccountOnboardingView.js.map +1 -0
  240. package/lib/module/specs/NativeEmbeddedPaymentElement.js +1 -1
  241. package/lib/module/specs/NativeEmbeddedPaymentElement.js.map +1 -1
  242. package/lib/module/specs/NativeGooglePayButton.js +1 -1
  243. package/lib/module/specs/NativeGooglePayButton.js.map +1 -1
  244. package/lib/module/specs/NativeNavigationBar.js +2 -0
  245. package/lib/module/specs/NativeNavigationBar.js.map +1 -0
  246. package/lib/module/specs/NativeOnrampSdkModule.js +2 -0
  247. package/lib/module/specs/NativeOnrampSdkModule.js.map +1 -0
  248. package/lib/module/specs/NativeStripeContainer.js +1 -1
  249. package/lib/module/specs/NativeStripeContainer.js.map +1 -1
  250. package/lib/module/specs/NativeStripeSdkModule.js.map +1 -1
  251. package/lib/module/types/EmbeddedPaymentElement.js +1 -1
  252. package/lib/module/types/EmbeddedPaymentElement.js.map +1 -1
  253. package/lib/module/types/Errors.js +1 -1
  254. package/lib/module/types/Errors.js.map +1 -1
  255. package/lib/module/types/Onramp.js +2 -0
  256. package/lib/module/types/Onramp.js.map +1 -0
  257. package/lib/module/types/PaymentSheet.js.map +1 -1
  258. package/lib/module/types/index.js +1 -1
  259. package/lib/module/types/index.js.map +1 -1
  260. package/lib/typescript/src/components/StripeProvider.d.ts.map +1 -1
  261. package/lib/typescript/src/connect/Components.d.ts +23 -0
  262. package/lib/typescript/src/connect/Components.d.ts.map +1 -0
  263. package/lib/typescript/src/connect/ConnectComponentsProvider.d.ts +22 -0
  264. package/lib/typescript/src/connect/ConnectComponentsProvider.d.ts.map +1 -0
  265. package/lib/typescript/src/connect/EmbeddedComponent.d.ts +18 -0
  266. package/lib/typescript/src/connect/EmbeddedComponent.d.ts.map +1 -0
  267. package/lib/typescript/src/connect/ModalCloseButton.d.ts +7 -0
  268. package/lib/typescript/src/connect/ModalCloseButton.d.ts.map +1 -0
  269. package/lib/typescript/src/connect/NavigationBar.d.ts +8 -0
  270. package/lib/typescript/src/connect/NavigationBar.d.ts.map +1 -0
  271. package/lib/typescript/src/connect/connectTypes.d.ts +464 -0
  272. package/lib/typescript/src/connect/connectTypes.d.ts.map +1 -0
  273. package/lib/typescript/src/events.d.ts +4 -0
  274. package/lib/typescript/src/events.d.ts.map +1 -1
  275. package/lib/typescript/src/functions.d.ts.map +1 -1
  276. package/lib/typescript/src/helpers.d.ts.map +1 -1
  277. package/lib/typescript/src/hooks/useOnramp.d.ts +158 -0
  278. package/lib/typescript/src/hooks/useOnramp.d.ts.map +1 -0
  279. package/lib/typescript/src/index.d.ts +4 -0
  280. package/lib/typescript/src/index.d.ts.map +1 -1
  281. package/lib/typescript/src/plugin/withStripe.d.ts +15 -0
  282. package/lib/typescript/src/plugin/withStripe.d.ts.map +1 -1
  283. package/lib/typescript/src/specs/NativeConnectAccountOnboardingView.d.ts +14 -0
  284. package/lib/typescript/src/specs/NativeConnectAccountOnboardingView.d.ts.map +1 -0
  285. package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts +1 -0
  286. package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts.map +1 -1
  287. package/lib/typescript/src/specs/NativeNavigationBar.d.ts +11 -0
  288. package/lib/typescript/src/specs/NativeNavigationBar.d.ts.map +1 -0
  289. package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts +28 -0
  290. package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts.map +1 -0
  291. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +3 -0
  292. package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
  293. package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -1
  294. package/lib/typescript/src/types/Errors.d.ts +5 -0
  295. package/lib/typescript/src/types/Errors.d.ts.map +1 -1
  296. package/lib/typescript/src/types/Onramp.d.ts +275 -0
  297. package/lib/typescript/src/types/Onramp.d.ts.map +1 -0
  298. package/lib/typescript/src/types/PaymentSheet.d.ts +7 -0
  299. package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
  300. package/lib/typescript/src/types/index.d.ts +7 -1
  301. package/lib/typescript/src/types/index.d.ts.map +1 -1
  302. package/package.json +25 -14
  303. package/src/components/StripeProvider.tsx +5 -0
  304. package/src/connect/Components.tsx +279 -0
  305. package/src/connect/ConnectComponentsProvider.tsx +93 -0
  306. package/src/connect/EmbeddedComponent.tsx +407 -0
  307. package/src/connect/ModalCloseButton.tsx +44 -0
  308. package/src/connect/NavigationBar.tsx +29 -0
  309. package/src/connect/connectTypes.ts +626 -0
  310. package/src/events.ts +23 -0
  311. package/src/hooks/useOnramp.tsx +334 -0
  312. package/src/index.tsx +13 -0
  313. package/src/plugin/withStripe.ts +104 -7
  314. package/src/specs/NativeConnectAccountOnboardingView.ts +19 -0
  315. package/src/specs/NativeEmbeddedPaymentElement.ts +5 -1
  316. package/src/specs/NativeNavigationBar.ts +16 -0
  317. package/src/specs/NativeOnrampSdkModule.ts +47 -0
  318. package/src/specs/NativeStripeSdkModule.ts +5 -0
  319. package/src/types/EmbeddedPaymentElement.tsx +24 -3
  320. package/src/types/Errors.ts +6 -0
  321. package/src/types/Onramp.ts +317 -0
  322. package/src/types/PaymentSheet.ts +7 -0
  323. package/src/types/index.ts +8 -0
  324. package/stripe-react-native.podspec +20 -7
@@ -41,9 +41,8 @@ internal class PaymentSheetAppearance {
41
41
  appearance.primaryButton = try buildPrimaryButton(params: primaryButtonParams)
42
42
  }
43
43
 
44
-
45
44
  if let embeddedPaymentElementParams = userParams[PaymentSheetAppearanceKeys.EMBEDDED_PAYMENT_ELEMENT] as? NSDictionary {
46
- appearance.embeddedPaymentElement = try buildEmbeddedPaymentElementAppearance(params: embeddedPaymentElementParams)
45
+ appearance.embeddedPaymentElement = try buildEmbeddedPaymentElementAppearance(params: embeddedPaymentElementParams)
47
46
  }
48
47
 
49
48
  if let formInsetParams = userParams[PaymentSheetAppearanceKeys.FORM_INSETS] as? NSDictionary {
@@ -68,8 +67,8 @@ internal class PaymentSheetAppearance {
68
67
  private class func buildColors(params: NSDictionary) throws -> PaymentSheet.Appearance.Colors {
69
68
  var colors = PaymentSheet.Appearance.Colors()
70
69
 
71
- if (params.object(forKey: PaymentSheetAppearanceKeys.LIGHT) != nil && params.object(forKey: PaymentSheetAppearanceKeys.DARK) == nil ||
72
- params.object(forKey: PaymentSheetAppearanceKeys.DARK) != nil && params.object(forKey: PaymentSheetAppearanceKeys.LIGHT) == nil) {
70
+ if params.object(forKey: PaymentSheetAppearanceKeys.LIGHT) != nil && params.object(forKey: PaymentSheetAppearanceKeys.DARK) == nil ||
71
+ params.object(forKey: PaymentSheetAppearanceKeys.DARK) != nil && params.object(forKey: PaymentSheetAppearanceKeys.LIGHT) == nil {
73
72
  throw PaymentSheetAppearanceError.missingAppearanceMode
74
73
  }
75
74
 
@@ -105,7 +104,7 @@ internal class PaymentSheetAppearance {
105
104
  }
106
105
  if let offsetParams = params[PaymentSheetAppearanceKeys.OFFSET] as? NSDictionary {
107
106
  if let x = offsetParams[PaymentSheetAppearanceKeys.X] as? CGFloat, let y = offsetParams[PaymentSheetAppearanceKeys.Y] as? CGFloat {
108
- shadow.offset = CGSize(width: x, height:-y)
107
+ shadow.offset = CGSize(width: x, height: -y)
109
108
  }
110
109
  }
111
110
 
@@ -136,8 +135,8 @@ internal class PaymentSheetAppearance {
136
135
  }
137
136
  }
138
137
  if let colorParams = params[PaymentSheetAppearanceKeys.COLORS] as? NSDictionary {
139
- if (colorParams.object(forKey: PaymentSheetAppearanceKeys.LIGHT) != nil && colorParams.object(forKey: PaymentSheetAppearanceKeys.DARK) == nil ||
140
- colorParams.object(forKey: PaymentSheetAppearanceKeys.DARK) != nil && colorParams.object(forKey: PaymentSheetAppearanceKeys.LIGHT) == nil) {
138
+ if colorParams.object(forKey: PaymentSheetAppearanceKeys.LIGHT) != nil && colorParams.object(forKey: PaymentSheetAppearanceKeys.DARK) == nil ||
139
+ colorParams.object(forKey: PaymentSheetAppearanceKeys.DARK) != nil && colorParams.object(forKey: PaymentSheetAppearanceKeys.LIGHT) == nil {
141
140
  throw PaymentSheetAppearanceError.missingAppearanceMode
142
141
  }
143
142
 
@@ -161,9 +160,9 @@ internal class PaymentSheetAppearance {
161
160
 
162
161
  let darkCount = darkHexString.trimmingCharacters(in: CharacterSet.alphanumerics.inverted).count
163
162
  let lightCount = lightHexString.trimmingCharacters(in: CharacterSet.alphanumerics.inverted).count
164
- if (lightCount != 6 && lightCount != 8) {
163
+ if lightCount != 6 && lightCount != 8 {
165
164
  throw PaymentSheetAppearanceError.unexpectedHexStringLength(lightHexString)
166
- } else if (darkCount != 6 && darkCount != 8) {
165
+ } else if darkCount != 6 && darkCount != 8 {
167
166
  throw PaymentSheetAppearanceError.unexpectedHexStringLength(darkHexString)
168
167
  }
169
168
 
@@ -179,196 +178,196 @@ internal class PaymentSheetAppearance {
179
178
  }
180
179
  }
181
180
 
182
- private class func buildEmbeddedPaymentElementAppearance(params: NSDictionary) throws -> PaymentSheet.Appearance.EmbeddedPaymentElement {
183
- var embeddedAppearance = PaymentSheet.Appearance.EmbeddedPaymentElement()
181
+ private class func buildEmbeddedPaymentElementAppearance(params: NSDictionary) throws -> PaymentSheet.Appearance.EmbeddedPaymentElement {
182
+ var embeddedAppearance = PaymentSheet.Appearance.EmbeddedPaymentElement()
184
183
 
185
- if let rowParams = params[PaymentSheetAppearanceKeys.ROW] as? NSDictionary {
184
+ if let rowParams = params[PaymentSheetAppearanceKeys.ROW] as? NSDictionary {
186
185
  embeddedAppearance.row = try buildEmbeddedRow(params: rowParams)
187
- }
186
+ }
188
187
 
189
- return embeddedAppearance
190
- }
188
+ return embeddedAppearance
189
+ }
191
190
 
192
- private class func buildEmbeddedRow(params: NSDictionary) throws -> PaymentSheet.Appearance.EmbeddedPaymentElement.Row {
191
+ private class func buildEmbeddedRow(params: NSDictionary) throws -> PaymentSheet.Appearance.EmbeddedPaymentElement.Row {
193
192
  var row = PaymentSheet.Appearance.default.embeddedPaymentElement.row
194
193
 
195
- if let styleString = params[PaymentSheetAppearanceKeys.STYLE] as? String {
196
- switch styleString {
197
- case PaymentSheetAppearanceKeys.ROW_STYLE_FLAT_WITH_RADIO:
198
- row.style = .flatWithRadio
199
- case PaymentSheetAppearanceKeys.ROW_STYLE_FLOATING_BUTTON:
200
- row.style = .floatingButton
201
- case PaymentSheetAppearanceKeys.ROW_STYLE_FLAT_WITH_CHECKMARK:
202
- row.style = .flatWithCheckmark
203
- case PaymentSheetAppearanceKeys.ROW_STYLE_FLAT_WITH_DISCLOSURE:
204
- row.style = .flatWithDisclosure
205
- default:
206
- throw PaymentSheetAppearanceError.invalidRowStyle(styleString)
207
- }
208
- }
209
-
210
- if let additionalInsets = params[PaymentSheetAppearanceKeys.ADDITIONAL_INSETS] as? CGFloat {
211
- row.additionalInsets = additionalInsets
212
- }
213
-
214
- if let flatParams = params[PaymentSheetAppearanceKeys.FLAT] as? NSDictionary {
215
- row.flat = try buildEmbeddedFlat(params: flatParams)
216
- }
217
-
218
- if let floatingParams = params[PaymentSheetAppearanceKeys.FLOATING] as? NSDictionary {
219
- row.floating = try buildEmbeddedFloating(params: floatingParams)
220
- }
221
-
222
- return row
223
- }
224
-
225
- private class func buildEmbeddedFlat(params: NSDictionary) throws -> PaymentSheet.Appearance.EmbeddedPaymentElement.Row.Flat {
226
- var flat = PaymentSheet.Appearance.default.embeddedPaymentElement.row.flat
227
-
228
- if let thickness = params[PaymentSheetAppearanceKeys.SEPARATOR_THICKNESS] as? CGFloat {
229
- flat.separatorThickness = thickness
230
- }
231
-
232
- flat.separatorColor = parseThemedColor(
194
+ if let styleString = params[PaymentSheetAppearanceKeys.STYLE] as? String {
195
+ switch styleString {
196
+ case PaymentSheetAppearanceKeys.ROW_STYLE_FLAT_WITH_RADIO:
197
+ row.style = .flatWithRadio
198
+ case PaymentSheetAppearanceKeys.ROW_STYLE_FLOATING_BUTTON:
199
+ row.style = .floatingButton
200
+ case PaymentSheetAppearanceKeys.ROW_STYLE_FLAT_WITH_CHECKMARK:
201
+ row.style = .flatWithCheckmark
202
+ case PaymentSheetAppearanceKeys.ROW_STYLE_FLAT_WITH_DISCLOSURE:
203
+ row.style = .flatWithDisclosure
204
+ default:
205
+ throw PaymentSheetAppearanceError.invalidRowStyle(styleString)
206
+ }
207
+ }
208
+
209
+ if let additionalInsets = params[PaymentSheetAppearanceKeys.ADDITIONAL_INSETS] as? CGFloat {
210
+ row.additionalInsets = additionalInsets
211
+ }
212
+
213
+ if let flatParams = params[PaymentSheetAppearanceKeys.FLAT] as? NSDictionary {
214
+ row.flat = try buildEmbeddedFlat(params: flatParams)
215
+ }
216
+
217
+ if let floatingParams = params[PaymentSheetAppearanceKeys.FLOATING] as? NSDictionary {
218
+ row.floating = try buildEmbeddedFloating(params: floatingParams)
219
+ }
220
+
221
+ return row
222
+ }
223
+
224
+ private class func buildEmbeddedFlat(params: NSDictionary) throws -> PaymentSheet.Appearance.EmbeddedPaymentElement.Row.Flat {
225
+ var flat = PaymentSheet.Appearance.default.embeddedPaymentElement.row.flat
226
+
227
+ if let thickness = params[PaymentSheetAppearanceKeys.SEPARATOR_THICKNESS] as? CGFloat {
228
+ flat.separatorThickness = thickness
229
+ }
230
+
231
+ flat.separatorColor = parseThemedColor(
233
232
  params: params,
234
233
  key: PaymentSheetAppearanceKeys.SEPARATOR_COLOR,
235
234
  default: PaymentSheet.Appearance.default.colors.componentBorder
236
- )
235
+ )
237
236
 
238
- if let insetsParams = params[PaymentSheetAppearanceKeys.SEPARATOR_INSETS] as? NSDictionary {
239
- flat.separatorInsets = try buildEdgeInsets(params: insetsParams)
240
- }
237
+ if let insetsParams = params[PaymentSheetAppearanceKeys.SEPARATOR_INSETS] as? NSDictionary {
238
+ flat.separatorInsets = try buildEdgeInsets(params: insetsParams)
239
+ }
241
240
 
242
- if let topEnabled = params[PaymentSheetAppearanceKeys.TOP_SEPARATOR_ENABLED] as? Bool {
243
- flat.topSeparatorEnabled = topEnabled
244
- }
241
+ if let topEnabled = params[PaymentSheetAppearanceKeys.TOP_SEPARATOR_ENABLED] as? Bool {
242
+ flat.topSeparatorEnabled = topEnabled
243
+ }
245
244
 
246
- if let bottomEnabled = params[PaymentSheetAppearanceKeys.BOTTOM_SEPARATOR_ENABLED] as? Bool {
247
- flat.bottomSeparatorEnabled = bottomEnabled
248
- }
245
+ if let bottomEnabled = params[PaymentSheetAppearanceKeys.BOTTOM_SEPARATOR_ENABLED] as? Bool {
246
+ flat.bottomSeparatorEnabled = bottomEnabled
247
+ }
249
248
 
250
- if let radioParams = params[PaymentSheetAppearanceKeys.RADIO] as? NSDictionary {
251
- flat.radio = try buildEmbeddedRadio(params: radioParams)
252
- }
249
+ if let radioParams = params[PaymentSheetAppearanceKeys.RADIO] as? NSDictionary {
250
+ flat.radio = try buildEmbeddedRadio(params: radioParams)
251
+ }
253
252
 
254
- if let checkmarkParams = params[PaymentSheetAppearanceKeys.CHECKMARK] as? NSDictionary {
255
- flat.checkmark = try buildEmbeddedCheckmark(params: checkmarkParams)
256
- }
253
+ if let checkmarkParams = params[PaymentSheetAppearanceKeys.CHECKMARK] as? NSDictionary {
254
+ flat.checkmark = try buildEmbeddedCheckmark(params: checkmarkParams)
255
+ }
257
256
 
258
- if let disclosureParams = params[PaymentSheetAppearanceKeys.DISCLOSURE] as? NSDictionary {
259
- flat.disclosure = try buildEmbeddedDisclosure(params: disclosureParams)
260
- }
257
+ if let disclosureParams = params[PaymentSheetAppearanceKeys.DISCLOSURE] as? NSDictionary {
258
+ flat.disclosure = try buildEmbeddedDisclosure(params: disclosureParams)
259
+ }
261
260
 
262
- return flat
263
- }
261
+ return flat
262
+ }
264
263
 
265
- private class func buildEmbeddedRadio(params: NSDictionary) throws -> PaymentSheet.Appearance.EmbeddedPaymentElement.Row.Flat.Radio {
266
- var radio = PaymentSheet.Appearance.default.embeddedPaymentElement.row.flat.radio
264
+ private class func buildEmbeddedRadio(params: NSDictionary) throws -> PaymentSheet.Appearance.EmbeddedPaymentElement.Row.Flat.Radio {
265
+ var radio = PaymentSheet.Appearance.default.embeddedPaymentElement.row.flat.radio
267
266
 
268
- // Selected‐state color
267
+ // Selected‐state color
269
268
  radio.selectedColor = parseThemedColor(
270
- params: params,
271
- key: PaymentSheetAppearanceKeys.SELECTED_COLOR,
272
- default: PaymentSheet.Appearance.default.colors.primary
269
+ params: params,
270
+ key: PaymentSheetAppearanceKeys.SELECTED_COLOR,
271
+ default: PaymentSheet.Appearance.default.colors.primary
273
272
  )
274
273
 
275
274
  // Unselected‐state color
276
275
  radio.unselectedColor = parseThemedColor(
277
- params: params,
278
- key: PaymentSheetAppearanceKeys.UNSELECTED_COLOR,
279
- default: PaymentSheet.Appearance.default.colors.componentBorder
276
+ params: params,
277
+ key: PaymentSheetAppearanceKeys.UNSELECTED_COLOR,
278
+ default: PaymentSheet.Appearance.default.colors.componentBorder
280
279
  )
281
280
 
282
- return radio
283
- }
281
+ return radio
282
+ }
284
283
 
285
- private class func buildEmbeddedCheckmark(params: NSDictionary) throws -> PaymentSheet.Appearance.EmbeddedPaymentElement.Row.Flat.Checkmark {
284
+ private class func buildEmbeddedCheckmark(params: NSDictionary) throws -> PaymentSheet.Appearance.EmbeddedPaymentElement.Row.Flat.Checkmark {
286
285
  var checkmark = PaymentSheet.Appearance.default.embeddedPaymentElement.row.flat.checkmark
287
286
 
288
287
  checkmark.color = parseThemedColor(
289
- params: params,
290
- key: PaymentSheetAppearanceKeys.COLOR,
291
- default: PaymentSheet.Appearance.default.colors.primary
288
+ params: params,
289
+ key: PaymentSheetAppearanceKeys.COLOR,
290
+ default: PaymentSheet.Appearance.default.colors.primary
292
291
  )
293
292
 
294
- return checkmark
295
- }
293
+ return checkmark
294
+ }
296
295
 
297
296
  private class func buildEmbeddedDisclosure(params: NSDictionary) throws -> PaymentSheet.Appearance.EmbeddedPaymentElement.Row.Flat.Disclosure {
298
297
  var disclosure = PaymentSheet.Appearance.default.embeddedPaymentElement.row.flat.disclosure
299
298
 
300
299
  disclosure.color = parseThemedColor(
301
- params: params,
302
- key: PaymentSheetAppearanceKeys.COLOR,
303
- default: UIColor.systemGray // Default iOS system gray color
300
+ params: params,
301
+ key: PaymentSheetAppearanceKeys.COLOR,
302
+ default: UIColor.systemGray // Default iOS system gray color
304
303
  )
305
304
 
306
305
  return disclosure
307
- }
306
+ }
308
307
 
309
- private class func buildEmbeddedFloating(params: NSDictionary) throws -> PaymentSheet.Appearance.EmbeddedPaymentElement.Row.Floating {
310
- var floating = PaymentSheet.Appearance.default.embeddedPaymentElement.row.floating
308
+ private class func buildEmbeddedFloating(params: NSDictionary) throws -> PaymentSheet.Appearance.EmbeddedPaymentElement.Row.Floating {
309
+ var floating = PaymentSheet.Appearance.default.embeddedPaymentElement.row.floating
311
310
 
312
- if let spacing = params[PaymentSheetAppearanceKeys.SPACING] as? CGFloat {
313
- floating.spacing = spacing
314
- }
311
+ if let spacing = params[PaymentSheetAppearanceKeys.SPACING] as? CGFloat {
312
+ floating.spacing = spacing
313
+ }
315
314
 
316
- return floating
317
- }
315
+ return floating
316
+ }
318
317
 
319
- private class func buildEdgeInsets(params: NSDictionary) throws -> UIEdgeInsets {
320
- let top = params[PaymentSheetAppearanceKeys.TOP] as? CGFloat ?? 0
321
- let left = params[PaymentSheetAppearanceKeys.LEFT] as? CGFloat ?? 0
322
- let bottom = params[PaymentSheetAppearanceKeys.BOTTOM] as? CGFloat ?? 0
323
- let right = params[PaymentSheetAppearanceKeys.RIGHT] as? CGFloat ?? 0
318
+ private class func buildEdgeInsets(params: NSDictionary) throws -> UIEdgeInsets {
319
+ let top = params[PaymentSheetAppearanceKeys.TOP] as? CGFloat ?? 0
320
+ let left = params[PaymentSheetAppearanceKeys.LEFT] as? CGFloat ?? 0
321
+ let bottom = params[PaymentSheetAppearanceKeys.BOTTOM] as? CGFloat ?? 0
322
+ let right = params[PaymentSheetAppearanceKeys.RIGHT] as? CGFloat ?? 0
324
323
 
325
- return UIEdgeInsets(
324
+ return UIEdgeInsets(
326
325
  top: top,
327
326
  left: left,
328
327
  bottom: bottom,
329
328
  right: right
330
- )
331
- }
329
+ )
330
+ }
332
331
 
333
- private class func dynamicColor(
332
+ private class func dynamicColor(
334
333
  from hexDict: [String: String],
335
334
  default defaultColor: UIColor
336
- ) -> UIColor {
335
+ ) -> UIColor {
337
336
  return UIColor(
338
- dynamicProvider: { traitCollection in
339
- if traitCollection.userInterfaceStyle == .dark,
340
- let darkHex = hexDict[PaymentSheetAppearanceKeys.DARK] {
341
- return .init(
342
- hexString: darkHex
343
- )
344
- }
345
- if let lightHex = hexDict[PaymentSheetAppearanceKeys.LIGHT] {
346
- return .init(
347
- hexString: lightHex
348
- )
349
- }
350
- return defaultColor
351
- })
352
- }
337
+ dynamicProvider: { traitCollection in
338
+ if traitCollection.userInterfaceStyle == .dark,
339
+ let darkHex = hexDict[PaymentSheetAppearanceKeys.DARK] {
340
+ return .init(
341
+ hexString: darkHex
342
+ )
343
+ }
344
+ if let lightHex = hexDict[PaymentSheetAppearanceKeys.LIGHT] {
345
+ return .init(
346
+ hexString: lightHex
347
+ )
348
+ }
349
+ return defaultColor
350
+ })
351
+ }
353
352
 
354
- private class func parseThemedColor(
353
+ private class func parseThemedColor(
355
354
  params: NSDictionary,
356
355
  key: String,
357
356
  default defaultColor: UIColor
358
- ) -> UIColor {
357
+ ) -> UIColor {
359
358
  // Check if it's a dictionary with light/dark keys
360
359
  if let colorDict = params[key] as? [String: String] {
361
- return dynamicColor(from: colorDict, default: defaultColor)
360
+ return dynamicColor(from: colorDict, default: defaultColor)
362
361
  }
363
362
 
364
363
  // Check if it's a plain string
365
364
  if let colorString = params[key] as? String {
366
- return UIColor(hexString: colorString)
365
+ return UIColor(hexString: colorString)
367
366
  }
368
367
 
369
368
  // Fall back to default if no color provided
370
369
  return defaultColor
371
- }
370
+ }
372
371
 
373
372
  private class func buildFormInsets(params: NSDictionary) throws -> NSDirectionalEdgeInsets {
374
373
  let top = params[PaymentSheetAppearanceKeys.TOP] as? CGFloat ?? PaymentSheet.Appearance.default.formInsets.top
@@ -377,15 +376,15 @@ internal class PaymentSheetAppearance {
377
376
  let trailing = params[PaymentSheetAppearanceKeys.RIGHT] as? CGFloat ?? PaymentSheet.Appearance.default.formInsets.trailing
378
377
 
379
378
  return NSDirectionalEdgeInsets(
380
- top: top,
381
- leading: leading,
382
- bottom: bottom,
383
- trailing: trailing
379
+ top: top,
380
+ leading: leading,
381
+ bottom: bottom,
382
+ trailing: trailing
384
383
  )
385
384
  }
386
385
  }
387
386
 
388
- enum PaymentSheetAppearanceError : Error {
387
+ enum PaymentSheetAppearanceError: Error {
389
388
  case missingFont(String)
390
389
  case missingAppearanceMode
391
390
  case unexpectedHexStringLength(String)
@@ -8,11 +8,11 @@
8
8
  import Foundation
9
9
 
10
10
  @objc(AddToWalletButtonManager)
11
- class AddToWalletButtonManager : RCTViewManager {
11
+ class AddToWalletButtonManager: RCTViewManager {
12
12
  override func view() -> UIView! {
13
13
  return AddToWalletButtonView()
14
14
  }
15
-
15
+
16
16
  override class func requiresMainQueueSetup() -> Bool {
17
17
  return true
18
18
  }
@@ -10,8 +10,8 @@ import Stripe
10
10
 
11
11
  @objc(AddToWalletButtonView)
12
12
  public class AddToWalletButtonView: UIView {
13
- var pushProvisioningContext: STPPushProvisioningContext? = nil
14
- var addToWalletButton: PKAddPassButton? = nil
13
+ var pushProvisioningContext: STPPushProvisioningContext?
14
+ var addToWalletButton: PKAddPassButton?
15
15
 
16
16
  @objc public var testEnv: Bool = false
17
17
  @objc public var iOSButtonStyle: NSString?
@@ -22,7 +22,7 @@ public class AddToWalletButtonView: UIView {
22
22
  required init?(coder: NSCoder) {
23
23
  fatalError("init(coder:) has not been implemented")
24
24
  }
25
-
25
+
26
26
  @objc public func didSetProps() {
27
27
  if let addToWalletButton = addToWalletButton {
28
28
  addToWalletButton.removeFromSuperview()
@@ -45,12 +45,12 @@ public class AddToWalletButtonView: UIView {
45
45
  }
46
46
 
47
47
  @objc func beginPushProvisioning() {
48
- if (!PushProvisioningUtils.canAddPaymentPass(isTestMode: self.testEnv)) {
48
+ if !PushProvisioningUtils.canAddPaymentPass(isTestMode: self.testEnv) {
49
49
  onCompleteAction!(
50
50
  Errors.createError(
51
51
  ErrorType.Failed,
52
52
  "This app cannot add cards to Apple Pay. For information on requesting the necessary entitlement, see the Card Issuers section at developer.apple.com/apple-pay/."
53
- ) as? [AnyHashable : Any]
53
+ ) as? [AnyHashable: Any]
54
54
  )
55
55
  return
56
56
  }
@@ -60,17 +60,17 @@ public class AddToWalletButtonView: UIView {
60
60
  Errors.createError(
61
61
  ErrorType.Failed,
62
62
  "Missing parameters. `cardDetails.name` must be supplied in the props to <AddToWalletButton />"
63
- ) as? [AnyHashable : Any]
63
+ ) as? [AnyHashable: Any]
64
64
  )
65
65
  return
66
66
  }
67
67
 
68
- if (cardHolderName.isEmpty) {
68
+ if cardHolderName.isEmpty {
69
69
  onCompleteAction!(
70
70
  Errors.createError(
71
71
  ErrorType.Failed,
72
72
  "`cardDetails.name` is required, but the passed string was empty"
73
- ) as? [AnyHashable : Any]
73
+ ) as? [AnyHashable: Any]
74
74
  )
75
75
  return
76
76
  }
@@ -92,11 +92,11 @@ public class AddToWalletButtonView: UIView {
92
92
  let vc = findViewControllerPresenter(from: RCTKeyWindow()?.rootViewController ?? UIViewController())
93
93
  vc.present(controller!, animated: true, completion: nil)
94
94
  }
95
-
95
+
96
96
  override public init(frame: CGRect) {
97
97
  super.init(frame: frame)
98
98
  }
99
-
99
+
100
100
  override public func layoutSubviews() {
101
101
  if let addToWalletButton = self.addToWalletButton {
102
102
  addToWalletButton.frame = self.bounds
@@ -104,12 +104,11 @@ public class AddToWalletButtonView: UIView {
104
104
  }
105
105
  }
106
106
 
107
-
108
107
  extension AddToWalletButtonView: PKAddPaymentPassViewControllerDelegate {
109
108
  public func addPaymentPassViewController(_ controller: PKAddPaymentPassViewController, generateRequestWithCertificateChain certificates: [Data], nonce: Data, nonceSignature: Data, completionHandler handler: @escaping (PKAddPaymentPassRequest) -> Void) {
110
109
  self.pushProvisioningContext = STPPushProvisioningContext(keyProvider: self)
111
110
 
112
- self.pushProvisioningContext?.addPaymentPassViewController(controller, generateRequestWithCertificateChain: certificates, nonce: nonce, nonceSignature: nonceSignature, completionHandler: handler);
111
+ self.pushProvisioningContext?.addPaymentPassViewController(controller, generateRequestWithCertificateChain: certificates, nonce: nonce, nonceSignature: nonceSignature, completionHandler: handler)
113
112
  }
114
113
 
115
114
  public func addPaymentPassViewController(_ controller: PKAddPaymentPassViewController, didFinishAdding pass: PKPaymentPass?, error: Error?) {
@@ -118,28 +117,27 @@ extension AddToWalletButtonView: PKAddPaymentPassViewControllerDelegate {
118
117
  Errors.createError(
119
118
  error.code == PKAddPaymentPassError.userCancelled.rawValue ? ErrorType.Canceled : ErrorType.Failed,
120
119
  error as NSError?
121
- ) as? [AnyHashable : Any]
120
+ ) as? [AnyHashable: Any]
122
121
  )
123
122
  } else {
124
123
  onCompleteAction!([
125
124
  "error": NSNull(),
126
- ] as [AnyHashable : Any])
125
+ ] as [AnyHashable: Any])
127
126
  }
128
127
  controller.dismiss(animated: true, completion: nil)
129
128
  }
130
129
  }
131
130
 
132
-
133
131
  extension AddToWalletButtonView: STPIssuingCardEphemeralKeyProvider {
134
132
  public func createIssuingCardKey(withAPIVersion apiVersion: String, completion: @escaping STPJSONResponseCompletionBlock) {
135
- if let ephemeralKey = self.ephemeralKey as? [AnyHashable : Any] {
133
+ if let ephemeralKey = self.ephemeralKey as? [AnyHashable: Any] {
136
134
  completion(ephemeralKey, nil)
137
135
  } else {
138
136
  onCompleteAction!(
139
137
  Errors.createError(
140
138
  ErrorType.Failed,
141
139
  "Missing parameters. `ephemeralKey` must be supplied in the props to <AddToWalletButton />"
142
- ) as? [AnyHashable : Any]
140
+ ) as? [AnyHashable: Any]
143
141
  )
144
142
  completion(nil, nil)
145
143
  }
@@ -15,34 +15,34 @@ internal class PushProvisioningUtils {
15
15
  hasPairedAppleWatch: Bool,
16
16
  completion: @escaping (_ canAddCard: Bool, _ status: AddCardToWalletStatus?) -> Void
17
17
  ) {
18
- if (!canAddPaymentPass(isTestMode: testEnv)) {
18
+ if !canAddPaymentPass(isTestMode: testEnv) {
19
19
  completion(false, AddCardToWalletStatus.UNSUPPORTED_DEVICE)
20
20
  } else {
21
21
  PaymentPassFinder.findPassWith(
22
22
  primaryAccountIdentifier: primaryAccountIdentifier,
23
23
  hasPairedAppleWatch: hasPairedAppleWatch)
24
24
  { canAddCardToADevice, passLocations in
25
- var status: AddCardToWalletStatus? = nil
26
- if (!canAddCardToADevice) {
25
+ var status: AddCardToWalletStatus?
26
+ if !canAddCardToADevice {
27
27
  status = AddCardToWalletStatus.CARD_ALREADY_EXISTS
28
- } else if (passLocations.contains(.PAIRED_DEVICE)) {
28
+ } else if passLocations.contains(.PAIRED_DEVICE) {
29
29
  status = AddCardToWalletStatus.CARD_EXISTS_ON_PAIRED_DEVICE
30
- } else if (passLocations.contains(.CURRENT_DEVICE)) {
30
+ } else if passLocations.contains(.CURRENT_DEVICE) {
31
31
  status = AddCardToWalletStatus.CARD_EXISTS_ON_CURRENT_DEVICE
32
32
  }
33
33
  completion(canAddCardToADevice, status)
34
34
  }
35
35
  }
36
36
  }
37
-
37
+
38
38
  class func canAddPaymentPass(isTestMode: Bool) -> Bool {
39
- if (isTestMode) {
39
+ if isTestMode {
40
40
  return STPFakeAddPaymentPassViewController.canAddPaymentPass()
41
41
  }
42
42
 
43
43
  return PKAddPaymentPassViewController.canAddPaymentPass()
44
44
  }
45
-
45
+
46
46
  class func getPassLocation(last4: String) -> PaymentPassFinder.PassLocation? {
47
47
  let existingPassOnDevice: PKPass? = {
48
48
  if #available(iOS 13.4, *) {
@@ -53,7 +53,7 @@ internal class PushProvisioningUtils {
53
53
  .first(where: { $0.paymentPass?.primaryAccountNumberSuffix == last4 && $0.paymentPass?.passActivationState != .suspended && !$0.isRemotePass })
54
54
  }
55
55
  }()
56
-
56
+
57
57
  let existingPassOnPairedDevices: PKPass? = {
58
58
  if #available(iOS 13.4, *) {
59
59
  return PKPassLibrary().remoteSecureElementPasses
@@ -63,10 +63,10 @@ internal class PushProvisioningUtils {
63
63
  .first(where: { $0.paymentPass?.primaryAccountNumberSuffix == last4 && $0.paymentPass?.passActivationState != .suspended })
64
64
  }
65
65
  }()
66
-
66
+
67
67
  return existingPassOnDevice != nil ? PaymentPassFinder.PassLocation.CURRENT_DEVICE : (existingPassOnPairedDevices != nil ? PaymentPassFinder.PassLocation.PAIRED_DEVICE : nil)
68
68
  }
69
-
69
+
70
70
  enum AddCardToWalletStatus: String {
71
71
  case UNSUPPORTED_DEVICE
72
72
  case CARD_ALREADY_EXISTS
@@ -5,7 +5,7 @@ class StripeContainerManager: RCTViewManager {
5
5
  override func view() -> UIView! {
6
6
  return StripeContainerView()
7
7
  }
8
-
8
+
9
9
  override class func requiresMainQueueSetup() -> Bool {
10
10
  return false
11
11
  }
@@ -3,18 +3,18 @@ import UIKit
3
3
 
4
4
  @objc(StripeContainerView)
5
5
  public class StripeContainerView: UIView {
6
- var tapRecognizer: UITapGestureRecognizer? = nil
6
+ var tapRecognizer: UITapGestureRecognizer?
7
7
 
8
8
  @objc public var keyboardShouldPersistTaps: Bool = true {
9
9
  didSet {
10
- if (keyboardShouldPersistTaps == true) {
10
+ if keyboardShouldPersistTaps == true {
11
11
  removeListener()
12
12
  } else {
13
13
  setListener()
14
14
  }
15
15
  }
16
16
  }
17
-
17
+
18
18
  public override init(frame: CGRect) {
19
19
  super.init(frame: frame)
20
20
  }
@@ -0,0 +1,17 @@
1
+ #ifdef RCT_NEW_ARCH_ENABLED
2
+ #import <rnstripe/rnstripe.h>
3
+ #else
4
+ #import <React/RCTBridgeModule.h>
5
+ #import "StripeSdkEventEmitterCompat.h"
6
+ #endif
7
+
8
+ NS_ASSUME_NONNULL_BEGIN
9
+
10
+ #ifdef RCT_NEW_ARCH_ENABLED
11
+ @interface StripeOnrampSdk : NativeOnrampSdkModuleSpecBase <NativeOnrampSdkModuleSpec>
12
+ #else
13
+ @interface StripeOnrampSdk : StripeSdkEventEmitterCompat <RCTBridgeModule>
14
+ #endif
15
+ @end
16
+
17
+ NS_ASSUME_NONNULL_END