@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
@@ -5,28 +5,28 @@ class CardFieldManager: RCTViewManager {
5
5
  override func view() -> UIView! {
6
6
  return CardFieldView()
7
7
  }
8
-
8
+
9
9
  @objc func focus(_ reactTag: NSNumber) {
10
10
  self.bridge!.uiManager.addUIBlock { (_: RCTUIManager?, viewRegistry: [NSNumber: UIView]?) in
11
11
  let view: CardFieldView = (viewRegistry![reactTag] as? CardFieldView)!
12
12
  view.focus()
13
13
  }
14
14
  }
15
-
15
+
16
16
  @objc func blur(_ reactTag: NSNumber) {
17
17
  self.bridge!.uiManager.addUIBlock { (_: RCTUIManager?, viewRegistry: [NSNumber: UIView]?) in
18
18
  let view: CardFieldView = (viewRegistry![reactTag] as? CardFieldView)!
19
19
  view.blur()
20
20
  }
21
21
  }
22
-
22
+
23
23
  @objc func clear(_ reactTag: NSNumber) {
24
24
  self.bridge!.uiManager.addUIBlock { (_: RCTUIManager?, viewRegistry: [NSNumber: UIView]?) in
25
25
  let view: CardFieldView = (viewRegistry![reactTag] as? CardFieldView)!
26
26
  view.clear()
27
27
  }
28
28
  }
29
-
29
+
30
30
  override class func requiresMainQueueSetup() -> Bool {
31
31
  return false
32
32
  }
@@ -1,6 +1,6 @@
1
1
  import Foundation
2
- import UIKit
3
2
  import Stripe
3
+ import UIKit
4
4
 
5
5
  @objc(CardFieldView)
6
6
  public class CardFieldView: UIView, STPPaymentCardTextFieldDelegate {
@@ -10,8 +10,8 @@ public class CardFieldView: UIView, STPPaymentCardTextFieldDelegate {
10
10
 
11
11
  private var cardField = STPPaymentCardTextField()
12
12
 
13
- public var cardParams: STPPaymentMethodParams? = nil
14
- public var cardPostalCode: String? = nil
13
+ public var cardParams: STPPaymentMethodParams?
14
+ public var cardPostalCode: String?
15
15
 
16
16
  @objc public var disabled: Bool = false {
17
17
  didSet {
@@ -37,7 +37,7 @@ public class CardFieldView: UIView, STPPaymentCardTextFieldDelegate {
37
37
  }
38
38
  }
39
39
 
40
- @objc public var preferredNetworks: Array<Int>? {
40
+ @objc public var preferredNetworks: [Int]? {
41
41
  didSet {
42
42
  if let preferredNetworks = preferredNetworks {
43
43
  cardField.preferredNetworks = preferredNetworks.map(Mappers.intToCardBrand).compactMap { $0 }
@@ -170,18 +170,18 @@ public class CardFieldView: UIView, STPPaymentCardTextFieldDelegate {
170
170
  "last4": textField.paymentMethodParams.card!.last4 ?? "",
171
171
  "validExpiryDate": Mappers.mapFromCardValidationState(state: validExpiryDate),
172
172
  "validCVC": Mappers.mapFromCardValidationState(state: validCVC),
173
- "validNumber": Mappers.mapFromCardValidationState(state: validNumber)
173
+ "validNumber": Mappers.mapFromCardValidationState(state: validNumber),
174
174
  ]
175
- if (cardField.postalCodeEntryEnabled) {
175
+ if cardField.postalCodeEntryEnabled {
176
176
  cardData["postalCode"] = textField.postalCode ?? ""
177
177
  }
178
- if (dangerouslyGetFullCardDetails) {
178
+ if dangerouslyGetFullCardDetails {
179
179
  cardData["number"] = textField.cardNumber ?? ""
180
180
  cardData["cvc"] = textField.cvc ?? ""
181
181
  }
182
- onCardChange!(["card": cardData as [AnyHashable : Any]])
182
+ onCardChange!(["card": cardData as [AnyHashable: Any]])
183
183
  }
184
- if (textField.isValid) {
184
+ if textField.isValid {
185
185
  self.cardParams = textField.paymentMethodParams
186
186
  self.cardPostalCode = textField.postalCode
187
187
  } else {
@@ -5,18 +5,18 @@ class CardFormManager: RCTViewManager {
5
5
  override func view() -> UIView! {
6
6
  return CardFormView()
7
7
  }
8
-
8
+
9
9
  override class func requiresMainQueueSetup() -> Bool {
10
10
  return false
11
11
  }
12
-
12
+
13
13
  @objc func focus(_ reactTag: NSNumber) {
14
14
  self.bridge!.uiManager.addUIBlock { (_: RCTUIManager?, viewRegistry: [NSNumber: UIView]?) in
15
15
  let view: CardFormView = (viewRegistry![reactTag] as? CardFormView)!
16
16
  view.focus()
17
17
  }
18
18
  }
19
-
19
+
20
20
  @objc func blur(_ reactTag: NSNumber) {
21
21
  self.bridge!.uiManager.addUIBlock { (_: RCTUIManager?, viewRegistry: [NSNumber: UIView]?) in
22
22
  let view: CardFormView = (viewRegistry![reactTag] as? CardFormView)!
@@ -1,55 +1,55 @@
1
1
  import Foundation
2
- import UIKit
3
2
  import Stripe
3
+ import UIKit
4
4
 
5
5
  @objc(CardFormView)
6
6
  public class CardFormView: UIView, STPCardFormViewDelegate {
7
7
  public var cardForm: STPCardFormView?
8
-
9
- public var cardParams: STPPaymentMethodCardParams? = nil
10
-
8
+
9
+ public var cardParams: STPPaymentMethodCardParams?
10
+
11
11
  @objc public var dangerouslyGetFullCardDetails: Bool = false
12
12
  @objc public var onFormComplete: RCTDirectEventBlock?
13
13
  @objc public var autofocus: Bool = false
14
14
  @objc public var disabled: Bool = false
15
- @objc public var preferredNetworks: Array<Int>? {
15
+ @objc public var preferredNetworks: [Int]? {
16
16
  didSet {
17
17
  setPreferredNetworks()
18
18
  }
19
19
  }
20
-
20
+
21
21
  @objc public func didSetProps() {
22
22
  if let cardForm = self.cardForm {
23
23
  cardForm.removeFromSuperview()
24
24
  }
25
-
25
+
26
26
  let style = self.cardStyle["type"] as? String == "borderless" ? STPCardFormViewStyle.borderless : STPCardFormViewStyle.standard
27
27
  let _cardForm = STPCardFormView(style: style)
28
28
  _cardForm.delegate = self
29
29
  _cardForm.isUserInteractionEnabled = !disabled
30
-
30
+
31
31
  if autofocus == true {
32
- let _ = _cardForm.becomeFirstResponder()
32
+ _ = _cardForm.becomeFirstResponder()
33
33
  }
34
-
34
+
35
35
  self.cardForm = _cardForm
36
36
  self.addSubview(_cardForm)
37
37
  setStyles()
38
38
  setPreferredNetworks()
39
39
  }
40
-
40
+
41
41
  override public func didSetProps(_ changedProps: [String]!) {
42
42
  // This is only called on old arch, for new arch didSetProps() will be called
43
43
  // by the view component.
44
44
  self.didSetProps()
45
45
  }
46
-
46
+
47
47
  @objc public var cardStyle: NSDictionary = NSDictionary() {
48
48
  didSet {
49
49
  setStyles()
50
50
  }
51
51
  }
52
-
52
+
53
53
  public func cardFormView(_ form: STPCardFormView, didChangeToStateComplete complete: Bool) {
54
54
  if onFormComplete != nil {
55
55
  let brand = STPCardValidator.brand(forNumber: cardForm?.cardParams?.card?.number ?? "")
@@ -60,30 +60,30 @@ public class CardFormView: UIView, STPCardFormViewDelegate {
60
60
  "brand": Mappers.mapFromCardBrand(brand) ?? NSNull(),
61
61
  "last4": cardForm?.cardParams?.card?.last4 ?? "",
62
62
  "postalCode": cardForm?.cardParams?.billingDetails?.address?.postalCode ?? "",
63
- "country": cardForm?.cardParams?.billingDetails?.address?.country
63
+ "country": cardForm?.cardParams?.billingDetails?.address?.country,
64
64
  ]
65
-
66
- if (dangerouslyGetFullCardDetails) {
65
+
66
+ if dangerouslyGetFullCardDetails {
67
67
  cardData["number"] = cardForm?.cardParams?.card?.number ?? ""
68
68
  cardData["cvc"] = cardForm?.cardParams?.card?.cvc ?? ""
69
69
  }
70
- if (complete) {
70
+ if complete {
71
71
  self.cardParams = cardForm?.cardParams?.card
72
72
  } else {
73
73
  self.cardParams = nil
74
74
  }
75
- onFormComplete!(["card": cardData as [AnyHashable : Any]])
75
+ onFormComplete!(["card": cardData as [AnyHashable: Any]])
76
76
  }
77
77
  }
78
-
78
+
79
79
  @objc public func focus() {
80
- let _ = cardForm?.becomeFirstResponder()
80
+ _ = cardForm?.becomeFirstResponder()
81
81
  }
82
-
82
+
83
83
  @objc public func blur() {
84
- let _ = cardForm?.resignFirstResponder()
84
+ _ = cardForm?.resignFirstResponder()
85
85
  }
86
-
86
+
87
87
  func setStyles() {
88
88
  if let backgroundColor = cardStyle["backgroundColor"] as? String {
89
89
  cardForm?.backgroundColor = UIColor(hexString: backgroundColor)
@@ -91,13 +91,13 @@ public class CardFormView: UIView, STPCardFormViewDelegate {
91
91
  /**
92
92
  The following reveals a bug in STPCardFormView where there's a extra space in the layer,
93
93
  and thus must remain commented out for now.
94
-
94
+
95
95
  if let borderWidth = cardStyle["borderWidth"] as? Int {
96
96
  cardForm?.layer.borderWidth = CGFloat(borderWidth)
97
97
  } else {
98
98
  cardForm?.layer.borderWidth = CGFloat(0)
99
99
  }
100
-
100
+
101
101
  */
102
102
  if let borderColor = cardStyle["borderColor"] as? String {
103
103
  cardForm?.layer.borderColor = UIColor(hexString: borderColor).cgColor
@@ -112,13 +112,13 @@ public class CardFormView: UIView, STPCardFormViewDelegate {
112
112
  // cardForm?.disabledBackgroundColor = UIColor(hexString: disabledBackgroundColor)
113
113
  // }
114
114
  }
115
-
115
+
116
116
  func setPreferredNetworks() {
117
117
  if let preferredNetworks = preferredNetworks {
118
118
  cardForm?.preferredNetworks = preferredNetworks.map(Mappers.intToCardBrand).compactMap { $0 }
119
119
  }
120
120
  }
121
-
121
+
122
122
  override public init(frame: CGRect) {
123
123
  super.init(frame: frame)
124
124
 
@@ -128,7 +128,7 @@ public class CardFormView: UIView, STPCardFormViewDelegate {
128
128
  override public func layoutSubviews() {
129
129
  cardForm?.frame = self.bounds
130
130
  }
131
-
131
+
132
132
  required init?(coder: NSCoder) {
133
133
  fatalError("init(coder:) has not been implemented")
134
134
  }
@@ -0,0 +1,97 @@
1
+ //
2
+ // ConnectAccountOnboardingView.swift
3
+ // stripe-react-native
4
+ //
5
+
6
+ import Foundation
7
+ import UIKit
8
+
9
+ @objc(ConnectAccountOnboardingView)
10
+ public class ConnectAccountOnboardingView: UIView {
11
+ @objc public var visible = false
12
+ @objc public var title: String?
13
+ @objc public var backgroundColorValue: String?
14
+ @objc public var textColorValue: String?
15
+ @objc public var onExitAction: RCTDirectEventBlock?
16
+
17
+ private var wasVisible = false
18
+ private var navigationController: UINavigationController?
19
+ private var viewController: ConnectAccountOnboardingViewController?
20
+
21
+ override public init(frame: CGRect) {
22
+ super.init(frame: frame)
23
+ super.backgroundColor = .clear
24
+ }
25
+
26
+ required init?(coder: NSCoder) {
27
+ fatalError("init(coder:) has not been implemented")
28
+ }
29
+
30
+ @objc public func didSetProps() {
31
+ if visible && !wasVisible {
32
+ // Delay presentation to ensure React Native has rendered children
33
+ DispatchQueue.main.async { [weak self] in
34
+ self?.presentModal()
35
+ }
36
+ wasVisible = true
37
+ } else if !visible && wasVisible {
38
+ dismissModal()
39
+ wasVisible = false
40
+ }
41
+ }
42
+
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
+ private func presentModal() {
50
+ // Create the view controller that wraps THIS view
51
+ viewController = ConnectAccountOnboardingViewController()
52
+ viewController?.title = title
53
+ viewController?.backgroundColorString = backgroundColorValue
54
+ viewController?.textColorString = textColorValue
55
+ viewController?.onClose = { [weak self] in
56
+ self?.handleClose()
57
+ }
58
+
59
+ // Add this entire React Native view to the view controller
60
+ viewController?.setReactContentView(self)
61
+
62
+ // Wrap in a navigation controller
63
+ navigationController = UINavigationController(rootViewController: viewController!)
64
+ navigationController?.modalPresentationStyle = .fullScreen
65
+ navigationController?.modalTransitionStyle = .coverVertical
66
+
67
+ // Find the presenting view controller and present
68
+ let presenter = findViewControllerPresenter(from: RCTKeyWindow()?.rootViewController ?? UIViewController())
69
+ presenter.present(navigationController!, animated: true)
70
+ }
71
+
72
+ private func dismissModal() {
73
+ navigationController?.dismiss(animated: true) { [weak self] in
74
+ self?.viewController = nil
75
+ self?.navigationController = nil
76
+ }
77
+ }
78
+
79
+ private func handleClose() {
80
+ visible = false
81
+ wasVisible = false
82
+ onExitAction?([:])
83
+ dismissModal()
84
+ }
85
+
86
+ override public func didMoveToSuperview() {
87
+ super.didMoveToSuperview()
88
+
89
+ // When added to native view hierarchy, ensure layout is triggered
90
+ if let superview = superview {
91
+ // Match the superview's bounds immediately
92
+ self.frame = superview.bounds
93
+ setNeedsLayout()
94
+ layoutIfNeeded()
95
+ }
96
+ }
97
+ }
@@ -0,0 +1,133 @@
1
+ //
2
+ // ConnectAccountOnboardingViewController.swift
3
+ // stripe-react-native
4
+ //
5
+
6
+ import Foundation
7
+ import UIKit
8
+
9
+ class ConnectAccountOnboardingViewController: UIViewController {
10
+ var onClose: (() -> Void)?
11
+ var backgroundColorString: String?
12
+ var textColorString: String?
13
+ private var reactContentView: UIView?
14
+
15
+ override func viewDidLoad() {
16
+ super.viewDidLoad()
17
+
18
+ // Use provided backgroundColor or fallback to system background
19
+ if let bgColor = backgroundColorString {
20
+ view.backgroundColor = UIColor(colorString: bgColor)
21
+ } else {
22
+ view.backgroundColor = .systemBackground
23
+ }
24
+
25
+ // Configure view controller to extend content behind navigation bar
26
+ extendedLayoutIncludesOpaqueBars = true
27
+ edgesForExtendedLayout = .all
28
+
29
+ // Setup navigation bar
30
+ setupNavigationBar()
31
+
32
+ // Add React content view if available
33
+ if let contentView = reactContentView {
34
+ addReactContent(contentView)
35
+ }
36
+ }
37
+
38
+ private func setupNavigationBar() {
39
+ // Configure navigation bar appearance to be translucent
40
+ if let navigationBar = navigationController?.navigationBar {
41
+ // Make navigation bar translucent so content shows behind it
42
+ navigationBar.isTranslucent = true
43
+
44
+ // Set tint color for navigation bar items (like the close button)
45
+ if let tintColorString = textColorString {
46
+ navigationBar.tintColor = UIColor(colorString: tintColorString)
47
+ }
48
+
49
+ // Set overrideUserInterfaceStyle based on whether background is specified
50
+ navigationBar.overrideUserInterfaceStyle = backgroundColorString == nil ? .light : .unspecified
51
+
52
+ // Configure navigation bar appearance with custom colors
53
+ let navAppearance = UINavigationBarAppearance()
54
+ navAppearance.configureWithOpaqueBackground()
55
+
56
+ if let bgColor = backgroundColorString {
57
+ navAppearance.backgroundColor = UIColor(colorString: bgColor)
58
+ }
59
+
60
+ if let titleColorString = textColorString {
61
+ let font = UIFont.systemFont(ofSize: UIFont.labelFontSize)
62
+ navAppearance.titleTextAttributes = [
63
+ .foregroundColor: UIColor(colorString: titleColorString),
64
+ .font: UIFontMetrics(forTextStyle: .largeTitle).scaledFont(for: font),
65
+ ]
66
+ }
67
+
68
+ navigationItem.standardAppearance = navAppearance
69
+ navigationItem.scrollEdgeAppearance = navAppearance
70
+
71
+ navigationBar.standardAppearance = navAppearance
72
+ navigationBar.scrollEdgeAppearance = navAppearance
73
+ }
74
+
75
+ // Add close button
76
+ let closeButton = UIBarButtonItem(
77
+ barButtonSystemItem: .close,
78
+ target: self,
79
+ action: #selector(handleCloseButtonPressed)
80
+ )
81
+ navigationItem.rightBarButtonItem = closeButton
82
+ }
83
+
84
+ @objc private func handleCloseButtonPressed() {
85
+ onClose?()
86
+ }
87
+
88
+ func setReactContentView(_ view: UIView) {
89
+ // Remove previous content if any
90
+ reactContentView?.removeFromSuperview()
91
+
92
+ reactContentView = view
93
+
94
+ // If view is already loaded, add the content immediately
95
+ if isViewLoaded {
96
+ addReactContent(view)
97
+ }
98
+ }
99
+
100
+ private func addReactContent(_ view: UIView) {
101
+ // Remove the view from its current superview if it has one
102
+ view.removeFromSuperview()
103
+
104
+ // Add as subview and setup constraints
105
+ self.view.addSubview(view)
106
+ view.translatesAutoresizingMaskIntoConstraints = false
107
+
108
+ // Pin to entire view edges so content extends behind navigation bar and fills completely
109
+ NSLayoutConstraint.activate([
110
+ view.topAnchor.constraint(equalTo: self.view.topAnchor),
111
+ view.leadingAnchor.constraint(equalTo: self.view.leadingAnchor),
112
+ view.trailingAnchor.constraint(equalTo: self.view.trailingAnchor),
113
+ view.bottomAnchor.constraint(equalTo: self.view.bottomAnchor),
114
+ ])
115
+ }
116
+
117
+ override func viewDidLayoutSubviews() {
118
+ super.viewDidLayoutSubviews()
119
+
120
+ // Ensure React Native view updates its layout when view controller bounds change
121
+ reactContentView?.setNeedsLayout()
122
+ reactContentView?.layoutIfNeeded()
123
+ }
124
+
125
+ override func viewWillDisappear(_ animated: Bool) {
126
+ super.viewWillDisappear(animated)
127
+
128
+ // If being dismissed (not just going to background), notify
129
+ if isBeingDismissed {
130
+ onClose?()
131
+ }
132
+ }
133
+ }
@@ -0,0 +1,16 @@
1
+ //
2
+ // ConnectAccountOnboardingViewManager.m
3
+ // stripe-react-native
4
+ //
5
+
6
+ #import <Foundation/Foundation.h>
7
+ #import <React/RCTBridgeModule.h>
8
+ #import <React/RCTViewManager.h>
9
+
10
+ @interface RCT_EXTERN_MODULE(ConnectAccountOnboardingViewManager, RCTViewManager)
11
+ RCT_EXPORT_VIEW_PROPERTY(visible, BOOL)
12
+ RCT_EXPORT_VIEW_PROPERTY(title, NSString)
13
+ RCT_REMAP_VIEW_PROPERTY(backgroundColor, backgroundColorValue, NSString)
14
+ RCT_REMAP_VIEW_PROPERTY(textColor, textColorValue, NSString)
15
+ RCT_EXPORT_VIEW_PROPERTY(onExitAction, RCTDirectEventBlock)
16
+ @end
@@ -0,0 +1,17 @@
1
+ //
2
+ // ConnectAccountOnboardingViewManager.swift
3
+ // stripe-react-native
4
+ //
5
+
6
+ import Foundation
7
+
8
+ @objc(ConnectAccountOnboardingViewManager)
9
+ class ConnectAccountOnboardingViewManager: RCTViewManager {
10
+ override func view() -> UIView! {
11
+ return ConnectAccountOnboardingView()
12
+ }
13
+
14
+ override class func requiresMainQueueSetup() -> Bool {
15
+ return true
16
+ }
17
+ }
@@ -19,7 +19,7 @@ class CustomerSheetUtils {
19
19
  merchantDisplayName: String?,
20
20
  billingDetailsCollectionConfiguration: NSDictionary?,
21
21
  defaultBillingDetails: NSDictionary?,
22
- preferredNetworks: Array<Int>?,
22
+ preferredNetworks: [Int]?,
23
23
  allowsRemovalOfLastSavedPaymentMethod: Bool?,
24
24
  cardBrandAcceptance: PaymentSheet.CardBrandAcceptance
25
25
  ) -> CustomerSheet.Configuration {
@@ -49,11 +49,11 @@ class CustomerSheetUtils {
49
49
  config.defaultBillingDetails.phone = defaultBillingDetails["phone"] as? String
50
50
  if let address = defaultBillingDetails["address"] as? [String: String] {
51
51
  config.defaultBillingDetails.address = .init(city: address["city"],
52
- country: address["country"],
53
- line1: address["line1"],
54
- line2: address["line2"],
55
- postalCode: address["postalCode"],
56
- state: address["state"])
52
+ country: address["country"],
53
+ line1: address["line1"],
54
+ line2: address["line2"],
55
+ postalCode: address["postalCode"],
56
+ state: address["state"])
57
57
  }
58
58
  }
59
59
  if let allowsRemovalOfLastSavedPaymentMethod = allowsRemovalOfLastSavedPaymentMethod {
@@ -62,7 +62,7 @@ class CustomerSheetUtils {
62
62
  config.cardBrandAcceptance = cardBrandAcceptance
63
63
  return config
64
64
  }
65
-
65
+
66
66
  internal class func buildStripeCustomerAdapter(
67
67
  customerId: String,
68
68
  ephemeralKeySecret: String,
@@ -70,7 +70,7 @@ class CustomerSheetUtils {
70
70
  customerAdapter: NSDictionary,
71
71
  stripeSdk: StripeSdkImpl
72
72
  ) -> StripeCustomerAdapter {
73
- if (customerAdapter.count > 0) {
73
+ if customerAdapter.count > 0 {
74
74
  return buildCustomerAdapterOverride(
75
75
  customerAdapter: customerAdapter,
76
76
  customerId: customerId,
@@ -79,7 +79,7 @@ class CustomerSheetUtils {
79
79
  stripeSdk: stripeSdk
80
80
  )
81
81
  }
82
-
82
+
83
83
  if let setupIntentClientSecret = setupIntentClientSecret {
84
84
  return StripeCustomerAdapter(
85
85
  customerEphemeralKeyProvider: {
@@ -97,7 +97,7 @@ class CustomerSheetUtils {
97
97
  }
98
98
  )
99
99
  }
100
-
100
+
101
101
  internal class func buildCustomerAdapterOverride(
102
102
  customerAdapter: NSDictionary,
103
103
  customerId: String,
@@ -120,7 +120,7 @@ class CustomerSheetUtils {
120
120
  }
121
121
 
122
122
  internal class func getModalPresentationStyle(_ string: String?) -> UIModalPresentationStyle {
123
- switch (string) {
123
+ switch string {
124
124
  case "fullscreen":
125
125
  return .fullScreen
126
126
  case "pageSheet":
@@ -139,7 +139,7 @@ class CustomerSheetUtils {
139
139
  }
140
140
 
141
141
  internal class func getModalTransitionStyle(_ string: String?) -> UIModalTransitionStyle {
142
- switch (string) {
142
+ switch string {
143
143
  case "flip":
144
144
  return .flipHorizontal
145
145
  case "curl":
@@ -153,21 +153,20 @@ class CustomerSheetUtils {
153
153
  }
154
154
  }
155
155
 
156
-
157
156
  internal class func buildPaymentOptionResult(label: String, imageData: String?, paymentMethod: STPPaymentMethod?) -> NSMutableDictionary {
158
157
  let result: NSMutableDictionary = [:]
159
158
  let paymentOption: NSMutableDictionary = [:]
160
159
  paymentOption.setValue(label, forKey: "label")
161
- if (imageData != nil) {
160
+ if imageData != nil {
162
161
  paymentOption.setValue(imageData, forKey: "image")
163
162
  }
164
163
  result.setValue(paymentOption, forKey: "paymentOption")
165
- if (paymentMethod != nil) {
164
+ if paymentMethod != nil {
166
165
  result.setValue(Mappers.mapFromPaymentMethod(paymentMethod), forKey: "paymentMethod")
167
166
  }
168
167
  return result
169
168
  }
170
-
169
+
171
170
  internal class func interpretResult(result: CustomerSheet.CustomerSheetResult) -> NSDictionary {
172
171
  var payload: NSMutableDictionary = [:]
173
172
  switch result {