@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.
- package/README.md +0 -8
- package/android/.idea/AndroidProjectSystem.xml +6 -0
- package/android/.idea/caches/deviceStreaming.xml +1029 -0
- package/android/.idea/compiler.xml +6 -0
- package/android/.idea/gradle.xml +19 -0
- package/android/.idea/migrations.xml +10 -0
- package/android/.idea/misc.xml +10 -0
- package/android/.idea/runConfigurations.xml +17 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/build.gradle +76 -118
- package/android/gradle.properties +1 -1
- package/android/local.properties +8 -0
- package/android/settings.gradle +2 -0
- package/android/spotless.gradle +1 -1
- package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormView.kt +20 -17
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +13 -11
- package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +17 -21
- package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherManager.kt +2 -0
- package/android/src/main/java/com/reactnativestripesdk/CustomPaymentMethodActivity.kt +2 -0
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +53 -11
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +105 -117
- package/android/src/main/java/com/reactnativestripesdk/EventEmitterCompat.kt +4 -8
- package/android/src/main/java/com/reactnativestripesdk/FakeOnrampSdkModule.kt +154 -0
- package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetManager.kt +13 -15
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonView.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherManager.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/GooglePayRequestHelper.kt +7 -5
- package/android/src/main/java/com/reactnativestripesdk/NavigationBarManager.kt +31 -0
- package/android/src/main/java/com/reactnativestripesdk/NavigationBarView.kt +120 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentElementConfig.kt +228 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherManager.kt +1 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +3 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentOptionDisplayDataMapper.kt +4 -6
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +73 -30
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetManager.kt +19 -245
- package/android/src/main/java/com/reactnativestripesdk/StripeAbstractComposeView.kt +53 -17
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +52 -14
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +21 -2
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetView.kt +4 -4
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetViewManager.kt +2 -2
- package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetManager.kt +15 -35
- package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerSessionProvider.kt +2 -1
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +5 -10
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt +90 -77
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/TapAndPayProxy.kt +6 -4
- package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +13 -3
- package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +41 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/KeepJsAwakeTask.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +92 -44
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerDelegate.java +3 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerInterface.java +2 -0
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeOnrampSdkModuleSpec.java +118 -0
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +4 -0
- package/android/src/onramp/java/com/reactnativestripesdk/OnrampSdkModule.kt +922 -0
- package/android/src/test/java/com/facebook/testutils/shadows/ShadowArguments.kt +29 -0
- package/android/src/test/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManagerTest.kt +163 -0
- package/android/src/test/java/com/reactnativestripesdk/PaymentElementConfigTest.kt +976 -0
- package/android/src/test/java/com/reactnativestripesdk/PaymentSheetAppearanceTest.kt +801 -0
- package/android/src/test/java/com/reactnativestripesdk/PaymentSheetManagerTest.kt +523 -0
- package/android/src/test/java/com/reactnativestripesdk/addresssheet/AddressSheetViewTest.kt +551 -0
- package/android/src/test/java/com/reactnativestripesdk/mappers/MappersTest.kt +567 -0
- package/android/src/test/java/com/reactnativestripesdk/mappers/PaymentOptionDisplayDataMapperTest.kt +456 -0
- package/android/src/test/java/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxyTest.kt +43 -0
- package/android/src/test/resources/robolectric.properties +2 -0
- package/ios/AddressSheet/AddressSheetUtils.swift +3 -3
- package/ios/AddressSheet/AddressSheetView.swift +25 -25
- package/ios/AddressSheet/AddressSheetViewManager.swift +2 -2
- package/ios/ApplePayButtonManager.swift +1 -1
- package/ios/ApplePayButtonView.swift +9 -10
- package/ios/ApplePayUtils.swift +51 -51
- package/ios/ApplePayViewController.swift +25 -29
- package/ios/AuBECSDebitFormManager.swift +1 -1
- package/ios/AuBECSDebitFormView.swift +13 -15
- package/ios/CardFieldManager.swift +4 -4
- package/ios/CardFieldView.swift +9 -9
- package/ios/CardFormManager.swift +3 -3
- package/ios/CardFormView.swift +28 -28
- package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingView.swift +97 -0
- package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewController.swift +133 -0
- package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewManager.m +16 -0
- package/ios/ConnectAccountOnboarding/ConnectAccountOnboardingViewManager.swift +17 -0
- package/ios/CustomerSheet/CustomerSheetUtils.swift +15 -16
- package/ios/CustomerSheet/ReactNativeCustomerAdapter.swift +19 -19
- package/ios/EmbeddedPaymentElementView.swift +2 -2
- package/ios/Errors.swift +22 -23
- package/ios/FinancialConnections.swift +37 -37
- package/ios/Mappers.swift +210 -71
- package/ios/NavigationBarManager.m +13 -0
- package/ios/NavigationBarManager.swift +17 -0
- package/ios/NavigationBarView.swift +65 -0
- package/ios/NewArch/NavigationBarComponentView.h +10 -0
- package/ios/NewArch/NavigationBarComponentView.mm +86 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.h +1 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.m +7 -1
- package/ios/PaymentMethodFactory.swift +24 -24
- package/ios/PaymentOptionDisplayData+ReactNative.swift +4 -4
- package/ios/PaymentPassFinder.swift +9 -10
- package/ios/PaymentSheetAppearance.swift +137 -138
- package/ios/PushProvisioning/AddToWalletButtonManager.swift +2 -2
- package/ios/PushProvisioning/AddToWalletButtonView.swift +15 -17
- package/ios/PushProvisioning/PushProvisioningUtils.swift +11 -11
- package/ios/StripeContainerManager.swift +1 -1
- package/ios/StripeContainerView.swift +3 -3
- package/ios/StripeOnrampSdk.h +17 -0
- package/ios/StripeOnrampSdk.mm +158 -0
- package/ios/StripeSdk.mm +8 -0
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcuserdata/tianzhao.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/StripeSdk.xcodeproj/xcuserdata/tianzhao.xcuserdatad/xcschemes/xcschememanagement.plist +19 -0
- package/ios/StripeSdkEmitter.swift +4 -0
- package/ios/StripeSdkImpl+CustomerSheet.swift +30 -25
- package/ios/StripeSdkImpl+Embedded.swift +11 -9
- package/ios/StripeSdkImpl+PaymentSheet.swift +36 -34
- package/ios/StripeSdkImpl.swift +913 -185
- package/ios/UIColorExtension.swift +72 -0
- package/lib/commonjs/components/AddToWalletButton.js +1 -1
- package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
- package/lib/commonjs/components/AddressSheet.js +1 -1
- package/lib/commonjs/components/AddressSheet.js.map +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
- package/lib/commonjs/components/CardField.js +1 -1
- package/lib/commonjs/components/CardField.js.map +1 -1
- package/lib/commonjs/components/CardForm.js +1 -1
- package/lib/commonjs/components/CardForm.js.map +1 -1
- package/lib/commonjs/components/PlatformPayButton.js +1 -1
- package/lib/commonjs/components/PlatformPayButton.js.map +1 -1
- package/lib/commonjs/components/StripeContainer.js +1 -1
- package/lib/commonjs/components/StripeContainer.js.map +1 -1
- package/lib/commonjs/components/StripeProvider.js +1 -1
- package/lib/commonjs/components/StripeProvider.js.map +1 -1
- package/lib/commonjs/connect/Components.js +2 -0
- package/lib/commonjs/connect/Components.js.map +1 -0
- package/lib/commonjs/connect/ConnectComponentsProvider.js +2 -0
- package/lib/commonjs/connect/ConnectComponentsProvider.js.map +1 -0
- package/lib/commonjs/connect/EmbeddedComponent.js +19 -0
- package/lib/commonjs/connect/EmbeddedComponent.js.map +1 -0
- package/lib/commonjs/connect/ModalCloseButton.js +2 -0
- package/lib/commonjs/connect/ModalCloseButton.js.map +1 -0
- package/lib/commonjs/connect/NavigationBar.js +2 -0
- package/lib/commonjs/connect/NavigationBar.js.map +1 -0
- package/lib/commonjs/connect/connectTypes.js +2 -0
- package/lib/commonjs/connect/connectTypes.js.map +1 -0
- package/lib/commonjs/events.js +1 -1
- package/lib/commonjs/events.js.map +1 -1
- package/lib/commonjs/helpers.js +1 -1
- package/lib/commonjs/helpers.js.map +1 -1
- package/lib/commonjs/hooks/useOnramp.js +2 -0
- package/lib/commonjs/hooks/useOnramp.js.map +1 -0
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/plugin/withStripe.js +1 -1
- package/lib/commonjs/plugin/withStripe.js.map +1 -1
- package/lib/commonjs/specs/NativeAddToWalletButton.js +1 -1
- package/lib/commonjs/specs/NativeAddToWalletButton.js.map +1 -1
- package/lib/commonjs/specs/NativeAddressSheet.js +1 -1
- package/lib/commonjs/specs/NativeAddressSheet.js.map +1 -1
- package/lib/commonjs/specs/NativeApplePayButton.js +1 -1
- package/lib/commonjs/specs/NativeApplePayButton.js.map +1 -1
- package/lib/commonjs/specs/NativeAuBECSDebitForm.js +1 -1
- package/lib/commonjs/specs/NativeAuBECSDebitForm.js.map +1 -1
- package/lib/commonjs/specs/NativeCardField.js +1 -1
- package/lib/commonjs/specs/NativeCardField.js.map +1 -1
- package/lib/commonjs/specs/NativeCardForm.js +1 -1
- package/lib/commonjs/specs/NativeCardForm.js.map +1 -1
- package/lib/commonjs/specs/NativeConnectAccountOnboardingView.js +2 -0
- package/lib/commonjs/specs/NativeConnectAccountOnboardingView.js.map +1 -0
- package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js +1 -1
- package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js.map +1 -1
- package/lib/commonjs/specs/NativeGooglePayButton.js +1 -1
- package/lib/commonjs/specs/NativeGooglePayButton.js.map +1 -1
- package/lib/commonjs/specs/NativeNavigationBar.js +2 -0
- package/lib/commonjs/specs/NativeNavigationBar.js.map +1 -0
- package/lib/commonjs/specs/NativeOnrampSdkModule.js +2 -0
- package/lib/commonjs/specs/NativeOnrampSdkModule.js.map +1 -0
- package/lib/commonjs/specs/NativeStripeContainer.js +1 -1
- package/lib/commonjs/specs/NativeStripeContainer.js.map +1 -1
- package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/commonjs/types/EmbeddedPaymentElement.js +1 -1
- package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -1
- package/lib/commonjs/types/Errors.js +1 -1
- package/lib/commonjs/types/Errors.js.map +1 -1
- package/lib/commonjs/types/Onramp.js +2 -0
- package/lib/commonjs/types/Onramp.js.map +1 -0
- package/lib/commonjs/types/PaymentSheet.js.map +1 -1
- package/lib/commonjs/types/index.js +1 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/module/components/AddToWalletButton.js +1 -1
- package/lib/module/components/AddToWalletButton.js.map +1 -1
- package/lib/module/components/AddressSheet.js +1 -1
- package/lib/module/components/AddressSheet.js.map +1 -1
- package/lib/module/components/AuBECSDebitForm.js +1 -1
- package/lib/module/components/AuBECSDebitForm.js.map +1 -1
- package/lib/module/components/CardField.js +1 -1
- package/lib/module/components/CardField.js.map +1 -1
- package/lib/module/components/CardForm.js +1 -1
- package/lib/module/components/CardForm.js.map +1 -1
- package/lib/module/components/PlatformPayButton.js +1 -1
- package/lib/module/components/PlatformPayButton.js.map +1 -1
- package/lib/module/components/StripeContainer.js +1 -1
- package/lib/module/components/StripeContainer.js.map +1 -1
- package/lib/module/components/StripeProvider.js +1 -1
- package/lib/module/components/StripeProvider.js.map +1 -1
- package/lib/module/connect/Components.js +2 -0
- package/lib/module/connect/Components.js.map +1 -0
- package/lib/module/connect/ConnectComponentsProvider.js +2 -0
- package/lib/module/connect/ConnectComponentsProvider.js.map +1 -0
- package/lib/module/connect/EmbeddedComponent.js +19 -0
- package/lib/module/connect/EmbeddedComponent.js.map +1 -0
- package/lib/module/connect/ModalCloseButton.js +2 -0
- package/lib/module/connect/ModalCloseButton.js.map +1 -0
- package/lib/module/connect/NavigationBar.js +2 -0
- package/lib/module/connect/NavigationBar.js.map +1 -0
- package/lib/module/connect/connectTypes.js +2 -0
- package/lib/module/connect/connectTypes.js.map +1 -0
- package/lib/module/events.js +1 -1
- package/lib/module/events.js.map +1 -1
- package/lib/module/helpers.js +1 -1
- package/lib/module/helpers.js.map +1 -1
- package/lib/module/hooks/useOnramp.js +2 -0
- package/lib/module/hooks/useOnramp.js.map +1 -0
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/plugin/withStripe.js +1 -1
- package/lib/module/plugin/withStripe.js.map +1 -1
- package/lib/module/specs/NativeAddToWalletButton.js +1 -1
- package/lib/module/specs/NativeAddToWalletButton.js.map +1 -1
- package/lib/module/specs/NativeAddressSheet.js +1 -1
- package/lib/module/specs/NativeAddressSheet.js.map +1 -1
- package/lib/module/specs/NativeApplePayButton.js +1 -1
- package/lib/module/specs/NativeApplePayButton.js.map +1 -1
- package/lib/module/specs/NativeAuBECSDebitForm.js +1 -1
- package/lib/module/specs/NativeAuBECSDebitForm.js.map +1 -1
- package/lib/module/specs/NativeCardField.js +1 -1
- package/lib/module/specs/NativeCardField.js.map +1 -1
- package/lib/module/specs/NativeCardForm.js +1 -1
- package/lib/module/specs/NativeCardForm.js.map +1 -1
- package/lib/module/specs/NativeConnectAccountOnboardingView.js +2 -0
- package/lib/module/specs/NativeConnectAccountOnboardingView.js.map +1 -0
- package/lib/module/specs/NativeEmbeddedPaymentElement.js +1 -1
- package/lib/module/specs/NativeEmbeddedPaymentElement.js.map +1 -1
- package/lib/module/specs/NativeGooglePayButton.js +1 -1
- package/lib/module/specs/NativeGooglePayButton.js.map +1 -1
- package/lib/module/specs/NativeNavigationBar.js +2 -0
- package/lib/module/specs/NativeNavigationBar.js.map +1 -0
- package/lib/module/specs/NativeOnrampSdkModule.js +2 -0
- package/lib/module/specs/NativeOnrampSdkModule.js.map +1 -0
- package/lib/module/specs/NativeStripeContainer.js +1 -1
- package/lib/module/specs/NativeStripeContainer.js.map +1 -1
- package/lib/module/specs/NativeStripeSdkModule.js.map +1 -1
- package/lib/module/types/EmbeddedPaymentElement.js +1 -1
- package/lib/module/types/EmbeddedPaymentElement.js.map +1 -1
- package/lib/module/types/Errors.js +1 -1
- package/lib/module/types/Errors.js.map +1 -1
- package/lib/module/types/Onramp.js +2 -0
- package/lib/module/types/Onramp.js.map +1 -0
- package/lib/module/types/PaymentSheet.js.map +1 -1
- package/lib/module/types/index.js +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/typescript/src/components/StripeProvider.d.ts.map +1 -1
- package/lib/typescript/src/connect/Components.d.ts +23 -0
- package/lib/typescript/src/connect/Components.d.ts.map +1 -0
- package/lib/typescript/src/connect/ConnectComponentsProvider.d.ts +22 -0
- package/lib/typescript/src/connect/ConnectComponentsProvider.d.ts.map +1 -0
- package/lib/typescript/src/connect/EmbeddedComponent.d.ts +18 -0
- package/lib/typescript/src/connect/EmbeddedComponent.d.ts.map +1 -0
- package/lib/typescript/src/connect/ModalCloseButton.d.ts +7 -0
- package/lib/typescript/src/connect/ModalCloseButton.d.ts.map +1 -0
- package/lib/typescript/src/connect/NavigationBar.d.ts +8 -0
- package/lib/typescript/src/connect/NavigationBar.d.ts.map +1 -0
- package/lib/typescript/src/connect/connectTypes.d.ts +464 -0
- package/lib/typescript/src/connect/connectTypes.d.ts.map +1 -0
- package/lib/typescript/src/events.d.ts +4 -0
- package/lib/typescript/src/events.d.ts.map +1 -1
- package/lib/typescript/src/functions.d.ts.map +1 -1
- package/lib/typescript/src/helpers.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useOnramp.d.ts +158 -0
- package/lib/typescript/src/hooks/useOnramp.d.ts.map +1 -0
- package/lib/typescript/src/index.d.ts +4 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/plugin/withStripe.d.ts +15 -0
- package/lib/typescript/src/plugin/withStripe.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeConnectAccountOnboardingView.d.ts +14 -0
- package/lib/typescript/src/specs/NativeConnectAccountOnboardingView.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts +1 -0
- package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeNavigationBar.d.ts +11 -0
- package/lib/typescript/src/specs/NativeNavigationBar.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts +28 -0
- package/lib/typescript/src/specs/NativeOnrampSdkModule.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +3 -0
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -1
- package/lib/typescript/src/types/Errors.d.ts +5 -0
- package/lib/typescript/src/types/Errors.d.ts.map +1 -1
- package/lib/typescript/src/types/Onramp.d.ts +275 -0
- package/lib/typescript/src/types/Onramp.d.ts.map +1 -0
- package/lib/typescript/src/types/PaymentSheet.d.ts +7 -0
- package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
- package/lib/typescript/src/types/index.d.ts +7 -1
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/package.json +25 -14
- package/src/components/StripeProvider.tsx +5 -0
- package/src/connect/Components.tsx +279 -0
- package/src/connect/ConnectComponentsProvider.tsx +93 -0
- package/src/connect/EmbeddedComponent.tsx +407 -0
- package/src/connect/ModalCloseButton.tsx +44 -0
- package/src/connect/NavigationBar.tsx +29 -0
- package/src/connect/connectTypes.ts +626 -0
- package/src/events.ts +23 -0
- package/src/hooks/useOnramp.tsx +334 -0
- package/src/index.tsx +13 -0
- package/src/plugin/withStripe.ts +104 -7
- package/src/specs/NativeConnectAccountOnboardingView.ts +19 -0
- package/src/specs/NativeEmbeddedPaymentElement.ts +5 -1
- package/src/specs/NativeNavigationBar.ts +16 -0
- package/src/specs/NativeOnrampSdkModule.ts +47 -0
- package/src/specs/NativeStripeSdkModule.ts +5 -0
- package/src/types/EmbeddedPaymentElement.tsx +24 -3
- package/src/types/Errors.ts +6 -0
- package/src/types/Onramp.ts +317 -0
- package/src/types/PaymentSheet.ts +7 -0
- package/src/types/index.ts +8 -0
- 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
|
}
|
package/ios/CardFieldView.swift
CHANGED
|
@@ -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?
|
|
14
|
-
public var cardPostalCode: String?
|
|
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:
|
|
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
|
|
175
|
+
if cardField.postalCodeEntryEnabled {
|
|
176
176
|
cardData["postalCode"] = textField.postalCode ?? ""
|
|
177
177
|
}
|
|
178
|
-
if
|
|
178
|
+
if dangerouslyGetFullCardDetails {
|
|
179
179
|
cardData["number"] = textField.cardNumber ?? ""
|
|
180
180
|
cardData["cvc"] = textField.cvc ?? ""
|
|
181
181
|
}
|
|
182
|
-
onCardChange!(["card": cardData as [AnyHashable
|
|
182
|
+
onCardChange!(["card": cardData as [AnyHashable: Any]])
|
|
183
183
|
}
|
|
184
|
-
if
|
|
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)!
|
package/ios/CardFormView.swift
CHANGED
|
@@ -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?
|
|
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:
|
|
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
|
-
|
|
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
|
|
65
|
+
|
|
66
|
+
if dangerouslyGetFullCardDetails {
|
|
67
67
|
cardData["number"] = cardForm?.cardParams?.card?.number ?? ""
|
|
68
68
|
cardData["cvc"] = cardForm?.cardParams?.card?.cvc ?? ""
|
|
69
69
|
}
|
|
70
|
-
if
|
|
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
|
|
75
|
+
onFormComplete!(["card": cardData as [AnyHashable: Any]])
|
|
76
76
|
}
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
|
|
79
79
|
@objc public func focus() {
|
|
80
|
-
|
|
80
|
+
_ = cardForm?.becomeFirstResponder()
|
|
81
81
|
}
|
|
82
|
-
|
|
82
|
+
|
|
83
83
|
@objc public func blur() {
|
|
84
|
-
|
|
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:
|
|
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
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
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
|
|
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
|
|
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
|
|
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
|
|
160
|
+
if imageData != nil {
|
|
162
161
|
paymentOption.setValue(imageData, forKey: "image")
|
|
163
162
|
}
|
|
164
163
|
result.setValue(paymentOption, forKey: "paymentOption")
|
|
165
|
-
if
|
|
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 {
|