@stripe/stripe-react-native 0.44.0 → 0.45.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.clang-format +90 -0
- package/.editorconfig +3 -0
- package/CHANGELOG.md +7 -1
- package/android/build.gradle +89 -18
- package/android/gradle.properties +1 -1
- package/android/src/main/java/com/reactnativestripesdk/AuBECSDebitFormViewManager.kt +15 -6
- package/android/src/main/java/com/reactnativestripesdk/CardChangeEvent.kt +56 -0
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +4 -4
- package/android/src/main/java/com/reactnativestripesdk/CardFieldViewManager.kt +55 -45
- package/android/src/main/java/com/reactnativestripesdk/{CardFocusEvent.kt → CardFocusChangeEvent.kt} +2 -2
- package/android/src/main/java/com/reactnativestripesdk/CardFormCompleteEvent.kt +17 -16
- package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +5 -5
- package/android/src/main/java/com/reactnativestripesdk/CardFormViewManager.kt +39 -33
- package/android/src/main/java/com/reactnativestripesdk/CollectBankAccountLauncherFragment.kt +4 -2
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementView.kt +182 -0
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +231 -0
- package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetFragment.kt +8 -5
- package/android/src/main/java/com/reactnativestripesdk/GooglePayButtonManager.kt +14 -6
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +3 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentOptionDisplayDataMapper.kt +17 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +266 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +8 -13
- package/android/src/main/java/com/reactnativestripesdk/StripeContainerManager.kt +11 -3
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +106 -59
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +34 -4
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetView.kt +33 -27
- package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressSheetViewManager.kt +49 -24
- package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetFragment.kt +16 -3
- package/android/src/main/java/com/reactnativestripesdk/customersheet/ReactNativeCustomerAdapter.kt +11 -29
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +36 -12
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt +5 -3
- package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +4 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +21 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/AddToWalletButtonManagerDelegate.java +49 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/AddToWalletButtonManagerInterface.java +25 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/AddressSheetViewManagerDelegate.java +64 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/AddressSheetViewManagerInterface.java +30 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/ApplePayButtonManagerDelegate.java +41 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/ApplePayButtonManagerInterface.java +20 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/AuBECSDebitFormManagerDelegate.java +36 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/AuBECSDebitFormManagerInterface.java +20 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/CardFieldManagerDelegate.java +73 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/CardFieldManagerInterface.java +31 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/CardFormManagerDelegate.java +67 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/CardFormManagerInterface.java +29 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerDelegate.java +49 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/EmbeddedPaymentElementViewManagerInterface.java +21 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/GooglePayButtonManagerDelegate.java +38 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/GooglePayButtonManagerInterface.java +19 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/StripeContainerManagerDelegate.java +32 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/StripeContainerManagerInterface.java +17 -0
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +311 -0
- package/ios/AddressSheet/AddressSheetUtils.swift +21 -19
- package/ios/AddressSheet/AddressSheetView.swift +23 -17
- package/ios/ApplePayButtonManager.m +0 -1
- package/ios/ApplePayButtonManager.swift +1 -3
- package/ios/ApplePayButtonView.swift +25 -20
- package/ios/ApplePayViewController.swift +22 -22
- package/ios/AuBECSDebitFormView.swift +14 -8
- package/ios/CardFieldManager.swift +1 -4
- package/ios/CardFieldView.swift +28 -25
- package/ios/CardFormManager.swift +1 -4
- package/ios/CardFormView.swift +25 -16
- package/ios/CustomerSheet/CustomerSheetUtils.swift +12 -16
- package/ios/CustomerSheet/ReactNativeCustomerAdapter.swift +8 -8
- package/ios/EmbeddedPaymentElementManager.m +6 -0
- package/ios/EmbeddedPaymentElementView.swift +48 -0
- package/ios/NewArch/AddToWalletButtonComponentView.h +10 -0
- package/ios/NewArch/AddToWalletButtonComponentView.mm +93 -0
- package/ios/NewArch/AddressSheetViewComponentView.h +10 -0
- package/ios/NewArch/AddressSheetViewComponentView.mm +109 -0
- package/ios/NewArch/ApplePayButtonComponentView.h +10 -0
- package/ios/NewArch/ApplePayButtonComponentView.mm +124 -0
- package/ios/NewArch/AuBECSDebitFormComponentView.h +10 -0
- package/ios/NewArch/AuBECSDebitFormComponentView.mm +95 -0
- package/ios/NewArch/CardFieldComponentView.h +10 -0
- package/ios/NewArch/CardFieldComponentView.mm +125 -0
- package/ios/NewArch/CardFormComponentView.h +10 -0
- package/ios/NewArch/CardFormComponentView.mm +108 -0
- package/ios/NewArch/StripeContainerComponentView.h +10 -0
- package/ios/NewArch/StripeContainerComponentView.mm +74 -0
- package/ios/NewArch/StripeNewArchConversions.h +20 -0
- package/ios/NewArch/StripeNewArchConversions.mm +47 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.h +27 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.m +105 -0
- package/ios/PaymentOptionDisplayData+ReactNative.swift +55 -0
- package/ios/PaymentSheetAppearance.swift +194 -1
- package/ios/PushProvisioning/AddToWalletButtonView.swift +19 -13
- package/ios/StripeContainerView.swift +5 -3
- package/ios/StripeSdk.h +21 -0
- package/ios/StripeSdk.mm +415 -0
- package/ios/StripeSdkEmitter.swift +19 -0
- package/ios/{StripeSdk+CustomerSheet.swift → StripeSdkImpl+CustomerSheet.swift} +24 -25
- package/ios/StripeSdkImpl+Embedded.swift +327 -0
- package/ios/{StripeSdk+PaymentSheet.swift → StripeSdkImpl+PaymentSheet.swift} +18 -29
- package/ios/{StripeSdk.swift → StripeSdkImpl.swift} +50 -72
- package/ios/StripeSwiftInterop.h +25 -0
- package/ios/stripe_react_native.h +2 -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/CustomerSheet.js +1 -1
- package/lib/commonjs/components/CustomerSheet.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/events.js +2 -0
- package/lib/commonjs/events.js.map +1 -0
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/index.js +1 -1
- package/lib/commonjs/index.js.map +1 -1
- package/lib/commonjs/specs/NativeAddToWalletButton.js +2 -0
- package/lib/commonjs/specs/NativeAddToWalletButton.js.map +1 -0
- package/lib/commonjs/specs/NativeAddressSheet.js +2 -0
- package/lib/commonjs/specs/NativeAddressSheet.js.map +1 -0
- package/lib/commonjs/specs/NativeApplePayButton.js +2 -0
- package/lib/commonjs/specs/NativeApplePayButton.js.map +1 -0
- package/lib/commonjs/specs/NativeAuBECSDebitForm.js +2 -0
- package/lib/commonjs/specs/NativeAuBECSDebitForm.js.map +1 -0
- package/lib/commonjs/specs/NativeCardField.js +2 -0
- package/lib/commonjs/specs/NativeCardField.js.map +1 -0
- package/lib/commonjs/specs/NativeCardForm.js +2 -0
- package/lib/commonjs/specs/NativeCardForm.js.map +1 -0
- package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js +2 -0
- package/lib/commonjs/specs/NativeEmbeddedPaymentElement.js.map +1 -0
- package/lib/commonjs/specs/NativeGooglePayButton.js +2 -0
- package/lib/commonjs/specs/NativeGooglePayButton.js.map +1 -0
- package/lib/commonjs/specs/NativeStripeContainer.js +2 -0
- package/lib/commonjs/specs/NativeStripeContainer.js.map +1 -0
- package/lib/commonjs/specs/NativeStripeSdkModule.js +2 -0
- package/lib/commonjs/specs/NativeStripeSdkModule.js.map +1 -0
- package/lib/commonjs/specs/utils.js +2 -0
- package/lib/commonjs/specs/utils.js.map +1 -0
- package/lib/commonjs/types/EmbeddedPaymentElement.js +2 -0
- package/lib/commonjs/types/EmbeddedPaymentElement.js.map +1 -0
- package/lib/commonjs/types/PaymentSheet.js +1 -1
- package/lib/commonjs/types/PaymentSheet.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/CustomerSheet.js +1 -1
- package/lib/module/components/CustomerSheet.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/events.js +2 -0
- package/lib/module/events.js.map +1 -0
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/index.js +1 -1
- package/lib/module/index.js.map +1 -1
- package/lib/module/specs/NativeAddToWalletButton.js +2 -0
- package/lib/module/specs/NativeAddToWalletButton.js.map +1 -0
- package/lib/module/specs/NativeAddressSheet.js +2 -0
- package/lib/module/specs/NativeAddressSheet.js.map +1 -0
- package/lib/module/specs/NativeApplePayButton.js +2 -0
- package/lib/module/specs/NativeApplePayButton.js.map +1 -0
- package/lib/module/specs/NativeAuBECSDebitForm.js +2 -0
- package/lib/module/specs/NativeAuBECSDebitForm.js.map +1 -0
- package/lib/module/specs/NativeCardField.js +2 -0
- package/lib/module/specs/NativeCardField.js.map +1 -0
- package/lib/module/specs/NativeCardForm.js +2 -0
- package/lib/module/specs/NativeCardForm.js.map +1 -0
- package/lib/module/specs/NativeEmbeddedPaymentElement.js +2 -0
- package/lib/module/specs/NativeEmbeddedPaymentElement.js.map +1 -0
- package/lib/module/specs/NativeGooglePayButton.js +2 -0
- package/lib/module/specs/NativeGooglePayButton.js.map +1 -0
- package/lib/module/specs/NativeStripeContainer.js +2 -0
- package/lib/module/specs/NativeStripeContainer.js.map +1 -0
- package/lib/module/specs/NativeStripeSdkModule.js +2 -0
- package/lib/module/specs/NativeStripeSdkModule.js.map +1 -0
- package/lib/module/specs/utils.js +2 -0
- package/lib/module/specs/utils.js.map +1 -0
- package/lib/module/types/EmbeddedPaymentElement.js +2 -0
- package/lib/module/types/EmbeddedPaymentElement.js.map +1 -0
- package/lib/module/types/PaymentSheet.js +1 -1
- package/lib/module/types/PaymentSheet.js.map +1 -1
- package/lib/typescript/src/components/AddToWalletButton.d.ts.map +1 -1
- package/lib/typescript/src/components/AddressSheet.d.ts.map +1 -1
- package/lib/typescript/src/components/AuBECSDebitForm.d.ts.map +1 -1
- package/lib/typescript/src/components/CardField.d.ts +1 -1
- package/lib/typescript/src/components/CardField.d.ts.map +1 -1
- package/lib/typescript/src/components/CardForm.d.ts +1 -1
- package/lib/typescript/src/components/CardForm.d.ts.map +1 -1
- package/lib/typescript/src/components/CustomerSheet.d.ts +1 -1
- package/lib/typescript/src/components/CustomerSheet.d.ts.map +1 -1
- package/lib/typescript/src/components/StripeContainer.d.ts.map +1 -1
- package/lib/typescript/src/events.d.ts +13 -0
- package/lib/typescript/src/events.d.ts.map +1 -0
- package/lib/typescript/src/functions.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts +4 -4
- package/lib/typescript/src/hooks/useFinancialConnectionsSheet.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useStripe.d.ts +2 -2
- package/lib/typescript/src/hooks/useStripe.d.ts.map +1 -1
- package/lib/typescript/src/index.d.ts +2 -0
- package/lib/typescript/src/index.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativeAddToWalletButton.d.ts +27 -0
- package/lib/typescript/src/specs/NativeAddToWalletButton.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeAddressSheet.d.ts +34 -0
- package/lib/typescript/src/specs/NativeAddressSheet.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeApplePayButton.d.ts +28 -0
- package/lib/typescript/src/specs/NativeApplePayButton.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeAuBECSDebitForm.d.ts +19 -0
- package/lib/typescript/src/specs/NativeAuBECSDebitForm.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeCardField.d.ts +33 -0
- package/lib/typescript/src/specs/NativeCardField.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeCardForm.d.ts +31 -0
- package/lib/typescript/src/specs/NativeCardForm.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts +22 -0
- package/lib/typescript/src/specs/NativeEmbeddedPaymentElement.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeGooglePayButton.d.ts +11 -0
- package/lib/typescript/src/specs/NativeGooglePayButton.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeStripeContainer.d.ts +8 -0
- package/lib/typescript/src/specs/NativeStripeContainer.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +93 -0
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -0
- package/lib/typescript/src/specs/utils.d.ts +20 -0
- package/lib/typescript/src/specs/utils.d.ts.map +1 -0
- package/lib/typescript/src/types/CustomerSheet.d.ts +1 -5
- package/lib/typescript/src/types/CustomerSheet.d.ts.map +1 -1
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts +161 -0
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -0
- package/lib/typescript/src/types/PaymentSheet.d.ts +97 -4
- package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
- package/lib/typescript/src/types/components/CardFieldInput.d.ts +3 -2
- package/lib/typescript/src/types/components/CardFieldInput.d.ts.map +1 -1
- package/lib/typescript/src/types/components/CardFormView.d.ts +3 -1
- package/lib/typescript/src/types/components/CardFormView.d.ts.map +1 -1
- package/package.json +20 -1
- package/src/components/AddToWalletButton.tsx +2 -5
- package/src/components/AddressSheet.tsx +5 -16
- package/src/components/AuBECSDebitForm.tsx +3 -12
- package/src/components/CardField.tsx +20 -30
- package/src/components/CardForm.tsx +14 -29
- package/src/components/CustomerSheet.tsx +23 -25
- package/src/components/PlatformPayButton.tsx +6 -6
- package/src/components/StripeContainer.tsx +5 -12
- package/src/components/StripeProvider.tsx +1 -1
- package/src/events.ts +49 -0
- package/src/functions.ts +13 -24
- package/src/hooks/useFinancialConnectionsSheet.tsx +2 -2
- package/src/hooks/useStripe.tsx +2 -2
- package/src/index.tsx +3 -0
- package/src/specs/NativeAddToWalletButton.ts +40 -0
- package/src/specs/NativeAddressSheet.ts +50 -0
- package/src/specs/NativeApplePayButton.ts +40 -0
- package/src/specs/NativeAuBECSDebitForm.ts +24 -0
- package/src/specs/NativeCardField.ts +51 -0
- package/src/specs/NativeCardForm.ts +43 -0
- package/src/specs/NativeEmbeddedPaymentElement.ts +37 -0
- package/src/specs/NativeGooglePayButton.ts +20 -0
- package/src/specs/NativeStripeContainer.ts +12 -0
- package/src/specs/NativeStripeSdkModule.ts +219 -0
- package/src/specs/utils.ts +22 -0
- package/src/types/CustomerSheet.ts +1 -5
- package/src/types/EmbeddedPaymentElement.tsx +467 -0
- package/src/types/PaymentSheet.ts +114 -4
- package/src/types/components/CardFieldInput.ts +1 -2
- package/src/types/components/CardFormView.ts +1 -1
- package/stripe-react-native.podspec +27 -2
- package/android/.gradle/8.11.1/checksums/checksums.lock +0 -0
- package/android/.gradle/8.11.1/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/8.11.1/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/8.11.1/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/8.11.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/8.11.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/8.11.1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +0 -2
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/src/main/java/com/reactnativestripesdk/CardChangedEvent.kt +0 -54
- package/ios/StripeSdk.m +0 -244
- package/lib/commonjs/NativeStripeSdk.js +0 -2
- package/lib/commonjs/NativeStripeSdk.js.map +0 -1
- package/lib/commonjs/components/ApplePayButtonNative.js +0 -2
- package/lib/commonjs/components/ApplePayButtonNative.js.map +0 -1
- package/lib/commonjs/components/GooglePayButtonNative.js +0 -2
- package/lib/commonjs/components/GooglePayButtonNative.js.map +0 -1
- package/lib/module/NativeStripeSdk.js +0 -2
- package/lib/module/NativeStripeSdk.js.map +0 -1
- package/lib/module/components/ApplePayButtonNative.js +0 -2
- package/lib/module/components/ApplePayButtonNative.js.map +0 -1
- package/lib/module/components/GooglePayButtonNative.js +0 -2
- package/lib/module/components/GooglePayButtonNative.js.map +0 -1
- package/lib/typescript/src/NativeStripeSdk.d.ts +0 -58
- package/lib/typescript/src/NativeStripeSdk.d.ts.map +0 -1
- package/lib/typescript/src/components/ApplePayButtonNative.d.ts +0 -4
- package/lib/typescript/src/components/ApplePayButtonNative.d.ts.map +0 -1
- package/lib/typescript/src/components/GooglePayButtonNative.d.ts +0 -4
- package/lib/typescript/src/components/GooglePayButtonNative.d.ts.map +0 -1
- package/src/NativeStripeSdk.tsx +0 -159
- package/src/components/ApplePayButtonNative.tsx +0 -5
- package/src/components/GooglePayButtonNative.tsx +0 -7
|
@@ -0,0 +1,109 @@
|
|
|
1
|
+
#import "AddressSheetViewComponentView.h"
|
|
2
|
+
|
|
3
|
+
#import <react/renderer/components/rnstripe/ComponentDescriptors.h>
|
|
4
|
+
#import <react/renderer/components/rnstripe/EventEmitters.h>
|
|
5
|
+
#import <react/renderer/components/rnstripe/Props.h>
|
|
6
|
+
#import <react/renderer/components/rnstripe/RCTComponentViewHelpers.h>
|
|
7
|
+
|
|
8
|
+
#import <React/RCTConversions.h>
|
|
9
|
+
#import <React/RCTFabricComponentsPlugins.h>
|
|
10
|
+
|
|
11
|
+
#import "RCTFollyConvert.h"
|
|
12
|
+
#import "StripeNewArchConversions.h"
|
|
13
|
+
#import "StripeSwiftInterop.h"
|
|
14
|
+
|
|
15
|
+
using namespace facebook::react;
|
|
16
|
+
using namespace stripe::react;
|
|
17
|
+
|
|
18
|
+
@interface AddressSheetViewComponentView () <RCTAddressSheetViewViewProtocol>
|
|
19
|
+
@end
|
|
20
|
+
|
|
21
|
+
@implementation AddressSheetViewComponentView {
|
|
22
|
+
AddressSheetView *_view;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Needed because of this: https://github.com/facebook/react-native/pull/37274
|
|
26
|
+
+ (void)load
|
|
27
|
+
{
|
|
28
|
+
[super load];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
32
|
+
{
|
|
33
|
+
if (self = [super initWithFrame:frame]) {
|
|
34
|
+
static const auto defaultProps = std::make_shared<const AddressSheetViewProps>();
|
|
35
|
+
_props = defaultProps;
|
|
36
|
+
[self prepareView];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return self;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
- (void)prepareView
|
|
43
|
+
{
|
|
44
|
+
_view = [[AddressSheetView alloc] initWithFrame:self.frame];
|
|
45
|
+
self.contentView = _view;
|
|
46
|
+
|
|
47
|
+
__weak __typeof(self) weakSelf = self;
|
|
48
|
+
|
|
49
|
+
_view.onSubmitAction = ^(NSDictionary *event) {
|
|
50
|
+
__typeof(self) strongSelf = weakSelf;
|
|
51
|
+
if (!strongSelf || !strongSelf->_eventEmitter) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
AddressSheetViewEventEmitter::OnSubmitAction emitterEvent = {.result = convertIdToFollyDynamic(event[@"result"])};
|
|
55
|
+
std::static_pointer_cast<const AddressSheetViewEventEmitter>(strongSelf->_eventEmitter)
|
|
56
|
+
->onSubmitAction(std::move(emitterEvent));
|
|
57
|
+
};
|
|
58
|
+
|
|
59
|
+
_view.onErrorAction = ^(NSDictionary *event) {
|
|
60
|
+
__typeof(self) strongSelf = weakSelf;
|
|
61
|
+
if (!strongSelf || !strongSelf->_eventEmitter) {
|
|
62
|
+
return;
|
|
63
|
+
}
|
|
64
|
+
AddressSheetViewEventEmitter::OnErrorAction emitterEvent = {.error = convertIdToFollyDynamic(event[@"error"])};
|
|
65
|
+
std::static_pointer_cast<const AddressSheetViewEventEmitter>(strongSelf->_eventEmitter)
|
|
66
|
+
->onErrorAction(std::move(emitterEvent));
|
|
67
|
+
};
|
|
68
|
+
}
|
|
69
|
+
|
|
70
|
+
- (void)updateProps:(const facebook::react::Props::Shared &)props
|
|
71
|
+
oldProps:(const facebook::react::Props::Shared &)oldProps
|
|
72
|
+
{
|
|
73
|
+
const auto &newViewProps = *std::static_pointer_cast<const AddressSheetViewProps>(props);
|
|
74
|
+
|
|
75
|
+
_view.visible = newViewProps.visible;
|
|
76
|
+
_view.presentationStyle = RCTNSStringFromString(newViewProps.presentationStyle);
|
|
77
|
+
_view.animationStyle = RCTNSStringFromString(newViewProps.animationStyle);
|
|
78
|
+
_view.appearance = convertFollyDynamicToNSDictionaryOrNil(newViewProps.appearance);
|
|
79
|
+
_view.defaultValues = convertFollyDynamicToNSDictionaryOrNil(newViewProps.defaultValues);
|
|
80
|
+
_view.additionalFields = convertFollyDynamicToNSDictionaryOrNil(newViewProps.additionalFields);
|
|
81
|
+
_view.allowedCountries = convertStringVectorToNSArray(newViewProps.allowedCountries);
|
|
82
|
+
_view.autocompleteCountries = convertStringVectorToNSArray(newViewProps.autocompleteCountries);
|
|
83
|
+
_view.primaryButtonTitle = RCTNSStringFromStringNilIfEmpty(newViewProps.primaryButtonTitle);
|
|
84
|
+
_view.sheetTitle = RCTNSStringFromStringNilIfEmpty(newViewProps.sheetTitle);
|
|
85
|
+
|
|
86
|
+
[super updateProps:props oldProps:oldProps];
|
|
87
|
+
|
|
88
|
+
[_view didSetProps];
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
#pragma mark - RCTComponentViewProtocol
|
|
92
|
+
|
|
93
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
94
|
+
{
|
|
95
|
+
return concreteComponentDescriptorProvider<AddressSheetViewComponentDescriptor>();
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
- (void)prepareForRecycle
|
|
99
|
+
{
|
|
100
|
+
[super prepareForRecycle];
|
|
101
|
+
[self prepareView];
|
|
102
|
+
}
|
|
103
|
+
|
|
104
|
+
@end
|
|
105
|
+
|
|
106
|
+
Class<RCTComponentViewProtocol> AddressSheetViewCls(void)
|
|
107
|
+
{
|
|
108
|
+
return AddressSheetViewComponentView.class;
|
|
109
|
+
}
|
|
@@ -0,0 +1,124 @@
|
|
|
1
|
+
#import "ApplePayButtonComponentView.h"
|
|
2
|
+
|
|
3
|
+
#import <react/renderer/components/rnstripe/ComponentDescriptors.h>
|
|
4
|
+
#import <react/renderer/components/rnstripe/EventEmitters.h>
|
|
5
|
+
#import <react/renderer/components/rnstripe/Props.h>
|
|
6
|
+
#import <react/renderer/components/rnstripe/RCTComponentViewHelpers.h>
|
|
7
|
+
|
|
8
|
+
#import <React/RCTConversions.h>
|
|
9
|
+
#import <React/RCTFabricComponentsPlugins.h>
|
|
10
|
+
|
|
11
|
+
#import "RCTFollyConvert.h"
|
|
12
|
+
#import "StripeSwiftInterop.h"
|
|
13
|
+
|
|
14
|
+
using namespace facebook::react;
|
|
15
|
+
|
|
16
|
+
@interface ApplePayButtonComponentView () <RCTApplePayButtonViewProtocol>
|
|
17
|
+
@end
|
|
18
|
+
|
|
19
|
+
@implementation ApplePayButtonComponentView {
|
|
20
|
+
ApplePayButtonView *_view;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Needed because of this: https://github.com/facebook/react-native/pull/37274
|
|
24
|
+
+ (void)load
|
|
25
|
+
{
|
|
26
|
+
[super load];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
30
|
+
{
|
|
31
|
+
if (self = [super initWithFrame:frame]) {
|
|
32
|
+
static const auto defaultProps = std::make_shared<const ApplePayButtonProps>();
|
|
33
|
+
_props = defaultProps;
|
|
34
|
+
[self prepareView];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return self;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
- (void)prepareView
|
|
41
|
+
{
|
|
42
|
+
_view = [[ApplePayButtonView alloc] initWithFrame:self.frame];
|
|
43
|
+
self.contentView = _view;
|
|
44
|
+
|
|
45
|
+
__weak __typeof(self) weakSelf = self;
|
|
46
|
+
|
|
47
|
+
_view.onShippingMethodSelectedAction = ^(NSDictionary *event) {
|
|
48
|
+
__typeof(self) strongSelf = weakSelf;
|
|
49
|
+
if (!strongSelf || !strongSelf->_eventEmitter) {
|
|
50
|
+
return;
|
|
51
|
+
}
|
|
52
|
+
ApplePayButtonEventEmitter::OnShippingMethodSelectedAction emitterEvent = {
|
|
53
|
+
.shippingMethod = convertIdToFollyDynamic(event[@"shippingMethod"])};
|
|
54
|
+
std::static_pointer_cast<const ApplePayButtonEventEmitter>(strongSelf->_eventEmitter)
|
|
55
|
+
->onShippingMethodSelectedAction(std::move(emitterEvent));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
_view.onShippingContactSelectedAction = ^(NSDictionary *event) {
|
|
59
|
+
__typeof(self) strongSelf = weakSelf;
|
|
60
|
+
if (!strongSelf || !strongSelf->_eventEmitter) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
ApplePayButtonEventEmitter::OnShippingContactSelectedAction emitterEvent = {
|
|
64
|
+
.shippingContact = convertIdToFollyDynamic(event[@"shippingContact"])};
|
|
65
|
+
std::static_pointer_cast<const ApplePayButtonEventEmitter>(strongSelf->_eventEmitter)
|
|
66
|
+
->onShippingContactSelectedAction(std::move(emitterEvent));
|
|
67
|
+
};
|
|
68
|
+
|
|
69
|
+
_view.onCouponCodeEnteredAction = ^(NSDictionary *event) {
|
|
70
|
+
__typeof(self) strongSelf = weakSelf;
|
|
71
|
+
if (!strongSelf || !strongSelf->_eventEmitter) {
|
|
72
|
+
return;
|
|
73
|
+
}
|
|
74
|
+
ApplePayButtonEventEmitter::OnCouponCodeEnteredAction emitterEvent = {
|
|
75
|
+
.couponCode = RCTStringFromNSString(event[@"couponCode"])};
|
|
76
|
+
std::static_pointer_cast<const ApplePayButtonEventEmitter>(strongSelf->_eventEmitter)
|
|
77
|
+
->onCouponCodeEnteredAction(std::move(emitterEvent));
|
|
78
|
+
};
|
|
79
|
+
|
|
80
|
+
_view.onOrderTrackingAction = ^(NSDictionary *event) {
|
|
81
|
+
__typeof(self) strongSelf = weakSelf;
|
|
82
|
+
if (!strongSelf || !strongSelf->_eventEmitter) {
|
|
83
|
+
return;
|
|
84
|
+
}
|
|
85
|
+
ApplePayButtonEventEmitter::OnOrderTrackingAction emitterEvent = {};
|
|
86
|
+
std::static_pointer_cast<const ApplePayButtonEventEmitter>(strongSelf->_eventEmitter)
|
|
87
|
+
->onOrderTrackingAction(std::move(emitterEvent));
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
|
|
91
|
+
- (void)updateProps:(const facebook::react::Props::Shared &)props
|
|
92
|
+
oldProps:(const facebook::react::Props::Shared &)oldProps
|
|
93
|
+
{
|
|
94
|
+
const auto &newViewProps = *std::static_pointer_cast<const ApplePayButtonProps>(props);
|
|
95
|
+
|
|
96
|
+
_view.type = @(newViewProps.type);
|
|
97
|
+
_view.buttonStyle = @(newViewProps.buttonStyle);
|
|
98
|
+
_view.disabled = newViewProps.disabled;
|
|
99
|
+
_view.borderRadius = @(newViewProps.borderRadius);
|
|
100
|
+
|
|
101
|
+
[super updateProps:props oldProps:oldProps];
|
|
102
|
+
|
|
103
|
+
[_view didSetProps];
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
#pragma mark - RCTComponentViewProtocol
|
|
107
|
+
|
|
108
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
109
|
+
{
|
|
110
|
+
return concreteComponentDescriptorProvider<ApplePayButtonComponentDescriptor>();
|
|
111
|
+
}
|
|
112
|
+
|
|
113
|
+
- (void)prepareForRecycle
|
|
114
|
+
{
|
|
115
|
+
[super prepareForRecycle];
|
|
116
|
+
[self prepareView];
|
|
117
|
+
}
|
|
118
|
+
|
|
119
|
+
@end
|
|
120
|
+
|
|
121
|
+
Class<RCTComponentViewProtocol> ApplePayButtonCls(void)
|
|
122
|
+
{
|
|
123
|
+
return ApplePayButtonComponentView.class;
|
|
124
|
+
}
|
|
@@ -0,0 +1,95 @@
|
|
|
1
|
+
#import "AuBECSDebitFormComponentView.h"
|
|
2
|
+
|
|
3
|
+
#import <react/renderer/components/rnstripe/ComponentDescriptors.h>
|
|
4
|
+
#import <react/renderer/components/rnstripe/EventEmitters.h>
|
|
5
|
+
#import <react/renderer/components/rnstripe/Props.h>
|
|
6
|
+
#import <react/renderer/components/rnstripe/RCTComponentViewHelpers.h>
|
|
7
|
+
|
|
8
|
+
#import <React/RCTConversions.h>
|
|
9
|
+
#import <React/RCTFabricComponentsPlugins.h>
|
|
10
|
+
|
|
11
|
+
#import "RCTFollyConvert.h"
|
|
12
|
+
#import "StripeNewArchConversions.h"
|
|
13
|
+
#import "StripeSwiftInterop.h"
|
|
14
|
+
|
|
15
|
+
using namespace facebook::react;
|
|
16
|
+
using namespace stripe::react;
|
|
17
|
+
|
|
18
|
+
@interface AuBECSDebitFormComponentView () <RCTAuBECSDebitFormViewProtocol>
|
|
19
|
+
@end
|
|
20
|
+
|
|
21
|
+
@implementation AuBECSDebitFormComponentView {
|
|
22
|
+
AuBECSDebitFormView *_view;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
// Needed because of this: https://github.com/facebook/react-native/pull/37274
|
|
26
|
+
+ (void)load
|
|
27
|
+
{
|
|
28
|
+
[super load];
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
32
|
+
{
|
|
33
|
+
if (self = [super initWithFrame:frame]) {
|
|
34
|
+
static const auto defaultProps = std::make_shared<const AuBECSDebitFormProps>();
|
|
35
|
+
_props = defaultProps;
|
|
36
|
+
[self prepareView];
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
return self;
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
- (void)prepareView
|
|
43
|
+
{
|
|
44
|
+
_view = [[AuBECSDebitFormView alloc] initWithFrame:self.frame];
|
|
45
|
+
self.contentView = _view;
|
|
46
|
+
|
|
47
|
+
__weak __typeof(self) weakSelf = self;
|
|
48
|
+
|
|
49
|
+
_view.onCompleteAction = ^(NSDictionary *event) {
|
|
50
|
+
__typeof(self) strongSelf = weakSelf;
|
|
51
|
+
if (!strongSelf || !strongSelf->_eventEmitter) {
|
|
52
|
+
return;
|
|
53
|
+
}
|
|
54
|
+
AuBECSDebitFormEventEmitter::OnCompleteAction emitterEvent = {
|
|
55
|
+
.name = RCTStringFromNSString(event[@"name"]),
|
|
56
|
+
.accountNumber = RCTStringFromNSString(event[@"accountNumber"]),
|
|
57
|
+
.bsbNumber = RCTStringFromNSString(event[@"bsbNumber"]),
|
|
58
|
+
.email = RCTStringFromNSString(event[@"email"])};
|
|
59
|
+
std::static_pointer_cast<const AuBECSDebitFormEventEmitter>(strongSelf->_eventEmitter)
|
|
60
|
+
->onCompleteAction(std::move(emitterEvent));
|
|
61
|
+
};
|
|
62
|
+
}
|
|
63
|
+
|
|
64
|
+
- (void)updateProps:(const facebook::react::Props::Shared &)props
|
|
65
|
+
oldProps:(const facebook::react::Props::Shared &)oldProps
|
|
66
|
+
{
|
|
67
|
+
const auto &newViewProps = *std::static_pointer_cast<const AuBECSDebitFormProps>(props);
|
|
68
|
+
|
|
69
|
+
_view.companyName = RCTNSStringFromStringNilIfEmpty(newViewProps.companyName);
|
|
70
|
+
_view.formStyle = convertFollyDynamicToNSDictionaryOrNil(newViewProps.formStyle);
|
|
71
|
+
|
|
72
|
+
[super updateProps:props oldProps:oldProps];
|
|
73
|
+
|
|
74
|
+
[_view didSetProps];
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
#pragma mark - RCTComponentViewProtocol
|
|
78
|
+
|
|
79
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
80
|
+
{
|
|
81
|
+
return concreteComponentDescriptorProvider<AuBECSDebitFormComponentDescriptor>();
|
|
82
|
+
}
|
|
83
|
+
|
|
84
|
+
- (void)prepareForRecycle
|
|
85
|
+
{
|
|
86
|
+
[super prepareForRecycle];
|
|
87
|
+
[self prepareView];
|
|
88
|
+
}
|
|
89
|
+
|
|
90
|
+
@end
|
|
91
|
+
|
|
92
|
+
Class<RCTComponentViewProtocol> AuBECSDebitFormCls(void)
|
|
93
|
+
{
|
|
94
|
+
return AuBECSDebitFormComponentView.class;
|
|
95
|
+
}
|
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
#import "CardFieldComponentView.h"
|
|
2
|
+
|
|
3
|
+
#import <react/renderer/components/rnstripe/ComponentDescriptors.h>
|
|
4
|
+
#import <react/renderer/components/rnstripe/EventEmitters.h>
|
|
5
|
+
#import <react/renderer/components/rnstripe/Props.h>
|
|
6
|
+
#import <react/renderer/components/rnstripe/RCTComponentViewHelpers.h>
|
|
7
|
+
|
|
8
|
+
#import <React/RCTConversions.h>
|
|
9
|
+
#import <React/RCTFabricComponentsPlugins.h>
|
|
10
|
+
#import "RCTFollyConvert.h"
|
|
11
|
+
#import "StripeNewArchConversions.h"
|
|
12
|
+
#import "StripeSwiftInterop.h"
|
|
13
|
+
|
|
14
|
+
using namespace facebook::react;
|
|
15
|
+
using namespace stripe::react;
|
|
16
|
+
|
|
17
|
+
@interface CardFieldComponentView () <RCTCardFieldViewProtocol>
|
|
18
|
+
@end
|
|
19
|
+
|
|
20
|
+
@implementation CardFieldComponentView {
|
|
21
|
+
CardFieldView *_view;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Needed because of this: https://github.com/facebook/react-native/pull/37274
|
|
25
|
+
+ (void)load
|
|
26
|
+
{
|
|
27
|
+
[super load];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
31
|
+
{
|
|
32
|
+
if (self = [super initWithFrame:frame]) {
|
|
33
|
+
static const auto defaultProps = std::make_shared<const CardFieldProps>();
|
|
34
|
+
_props = defaultProps;
|
|
35
|
+
[self prepareView];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return self;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
- (void)prepareView
|
|
42
|
+
{
|
|
43
|
+
_view = [[CardFieldView alloc] initWithFrame:self.frame];
|
|
44
|
+
self.contentView = _view;
|
|
45
|
+
|
|
46
|
+
__weak __typeof(self) weakSelf = self;
|
|
47
|
+
|
|
48
|
+
_view.onCardChange = ^(NSDictionary *event) {
|
|
49
|
+
__typeof(self) strongSelf = weakSelf;
|
|
50
|
+
if (!strongSelf || !strongSelf->_eventEmitter) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
CardFieldEventEmitter::OnCardChange emitterEvent = {.card = convertIdToFollyDynamic(event[@"card"])};
|
|
54
|
+
std::static_pointer_cast<const CardFieldEventEmitter>(strongSelf->_eventEmitter)
|
|
55
|
+
->onCardChange(std::move(emitterEvent));
|
|
56
|
+
};
|
|
57
|
+
|
|
58
|
+
_view.onFocusChange = ^(NSDictionary *event) {
|
|
59
|
+
__typeof(self) strongSelf = weakSelf;
|
|
60
|
+
if (!strongSelf || !strongSelf->_eventEmitter) {
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
CardFieldEventEmitter::OnFocusChange emitterEvent = {.focusedField = RCTStringFromNSString(event[@"focusedField"])};
|
|
64
|
+
std::static_pointer_cast<const CardFieldEventEmitter>(strongSelf->_eventEmitter)
|
|
65
|
+
->onFocusChange(std::move(emitterEvent));
|
|
66
|
+
};
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
- (void)updateProps:(const facebook::react::Props::Shared &)props
|
|
70
|
+
oldProps:(const facebook::react::Props::Shared &)oldProps
|
|
71
|
+
{
|
|
72
|
+
const auto &newViewProps = *std::static_pointer_cast<const CardFieldProps>(props);
|
|
73
|
+
|
|
74
|
+
_view.autofocus = newViewProps.autofocus;
|
|
75
|
+
_view.cardStyle = convertFollyDynamicToNSDictionary(newViewProps.cardStyle);
|
|
76
|
+
_view.countryCode = RCTNSStringFromStringNilIfEmpty(newViewProps.countryCode);
|
|
77
|
+
_view.dangerouslyGetFullCardDetails = newViewProps.dangerouslyGetFullCardDetails;
|
|
78
|
+
_view.disabled = newViewProps.disabled;
|
|
79
|
+
_view.onBehalfOf = RCTNSStringFromStringNilIfEmpty(newViewProps.onBehalfOf);
|
|
80
|
+
_view.placeholders = convertFollyDynamicToNSDictionary(newViewProps.placeholders);
|
|
81
|
+
_view.postalCodeEnabled = newViewProps.postalCodeEnabled;
|
|
82
|
+
_view.preferredNetworks = convertIntVectorToNSArray(newViewProps.preferredNetworks);
|
|
83
|
+
|
|
84
|
+
[super updateProps:props oldProps:oldProps];
|
|
85
|
+
}
|
|
86
|
+
|
|
87
|
+
#pragma mark - RCTComponentViewProtocol
|
|
88
|
+
|
|
89
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
90
|
+
{
|
|
91
|
+
return concreteComponentDescriptorProvider<CardFieldComponentDescriptor>();
|
|
92
|
+
}
|
|
93
|
+
|
|
94
|
+
- (void)prepareForRecycle
|
|
95
|
+
{
|
|
96
|
+
[super prepareForRecycle];
|
|
97
|
+
[self prepareView];
|
|
98
|
+
}
|
|
99
|
+
|
|
100
|
+
- (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args
|
|
101
|
+
{
|
|
102
|
+
RCTCardFieldHandleCommand(self, commandName, args);
|
|
103
|
+
}
|
|
104
|
+
|
|
105
|
+
- (void)blur
|
|
106
|
+
{
|
|
107
|
+
[_view blur];
|
|
108
|
+
}
|
|
109
|
+
|
|
110
|
+
- (void)focus
|
|
111
|
+
{
|
|
112
|
+
[_view focus];
|
|
113
|
+
}
|
|
114
|
+
|
|
115
|
+
- (void)clear
|
|
116
|
+
{
|
|
117
|
+
[_view clear];
|
|
118
|
+
}
|
|
119
|
+
|
|
120
|
+
@end
|
|
121
|
+
|
|
122
|
+
Class<RCTComponentViewProtocol> CardFieldCls(void)
|
|
123
|
+
{
|
|
124
|
+
return CardFieldComponentView.class;
|
|
125
|
+
}
|
|
@@ -0,0 +1,108 @@
|
|
|
1
|
+
#import "CardFormComponentView.h"
|
|
2
|
+
|
|
3
|
+
#import <react/renderer/components/rnstripe/ComponentDescriptors.h>
|
|
4
|
+
#import <react/renderer/components/rnstripe/EventEmitters.h>
|
|
5
|
+
#import <react/renderer/components/rnstripe/Props.h>
|
|
6
|
+
#import <react/renderer/components/rnstripe/RCTComponentViewHelpers.h>
|
|
7
|
+
|
|
8
|
+
#import <React/RCTConversions.h>
|
|
9
|
+
#import <React/RCTFabricComponentsPlugins.h>
|
|
10
|
+
#import "RCTFollyConvert.h"
|
|
11
|
+
#import "StripeNewArchConversions.h"
|
|
12
|
+
#import "StripeSwiftInterop.h"
|
|
13
|
+
|
|
14
|
+
using namespace facebook::react;
|
|
15
|
+
using namespace stripe::react;
|
|
16
|
+
|
|
17
|
+
@interface CardFormComponentView () <RCTCardFormViewProtocol>
|
|
18
|
+
@end
|
|
19
|
+
|
|
20
|
+
@implementation CardFormComponentView {
|
|
21
|
+
CardFormView *_view;
|
|
22
|
+
}
|
|
23
|
+
|
|
24
|
+
// Needed because of this: https://github.com/facebook/react-native/pull/37274
|
|
25
|
+
+ (void)load
|
|
26
|
+
{
|
|
27
|
+
[super load];
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
31
|
+
{
|
|
32
|
+
if (self = [super initWithFrame:frame]) {
|
|
33
|
+
static const auto defaultProps = std::make_shared<const CardFormProps>();
|
|
34
|
+
_props = defaultProps;
|
|
35
|
+
[self prepareView];
|
|
36
|
+
}
|
|
37
|
+
|
|
38
|
+
return self;
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
- (void)prepareView
|
|
42
|
+
{
|
|
43
|
+
_view = [[CardFormView alloc] initWithFrame:self.frame];
|
|
44
|
+
self.contentView = _view;
|
|
45
|
+
|
|
46
|
+
__weak __typeof(self) weakSelf = self;
|
|
47
|
+
|
|
48
|
+
_view.onFormComplete = ^(NSDictionary *event) {
|
|
49
|
+
__typeof(self) strongSelf = weakSelf;
|
|
50
|
+
if (!strongSelf || !strongSelf->_eventEmitter) {
|
|
51
|
+
return;
|
|
52
|
+
}
|
|
53
|
+
CardFormEventEmitter::OnFormComplete emitterEvent = {.card = convertIdToFollyDynamic(event[@"card"])};
|
|
54
|
+
std::static_pointer_cast<const CardFormEventEmitter>(strongSelf->_eventEmitter)
|
|
55
|
+
->onFormComplete(std::move(emitterEvent));
|
|
56
|
+
};
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
- (void)updateProps:(const facebook::react::Props::Shared &)props
|
|
60
|
+
oldProps:(const facebook::react::Props::Shared &)oldProps
|
|
61
|
+
{
|
|
62
|
+
const auto &newViewProps = *std::static_pointer_cast<const CardFormProps>(props);
|
|
63
|
+
|
|
64
|
+
_view.autofocus = newViewProps.autofocus;
|
|
65
|
+
_view.cardStyle = convertFollyDynamicToNSDictionary(newViewProps.cardStyle);
|
|
66
|
+
_view.dangerouslyGetFullCardDetails = newViewProps.dangerouslyGetFullCardDetails;
|
|
67
|
+
_view.disabled = newViewProps.disabled;
|
|
68
|
+
_view.preferredNetworks = convertIntVectorToNSArray(newViewProps.preferredNetworks);
|
|
69
|
+
|
|
70
|
+
[super updateProps:props oldProps:oldProps];
|
|
71
|
+
|
|
72
|
+
[_view didSetProps];
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
#pragma mark - RCTComponentViewProtocol
|
|
76
|
+
|
|
77
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
78
|
+
{
|
|
79
|
+
return concreteComponentDescriptorProvider<CardFormComponentDescriptor>();
|
|
80
|
+
}
|
|
81
|
+
|
|
82
|
+
- (void)prepareForRecycle
|
|
83
|
+
{
|
|
84
|
+
[super prepareForRecycle];
|
|
85
|
+
[self prepareView];
|
|
86
|
+
}
|
|
87
|
+
|
|
88
|
+
- (void)handleCommand:(const NSString *)commandName args:(const NSArray *)args
|
|
89
|
+
{
|
|
90
|
+
RCTCardFormHandleCommand(self, commandName, args);
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
- (void)blur
|
|
94
|
+
{
|
|
95
|
+
[_view blur];
|
|
96
|
+
}
|
|
97
|
+
|
|
98
|
+
- (void)focus
|
|
99
|
+
{
|
|
100
|
+
[_view focus];
|
|
101
|
+
}
|
|
102
|
+
|
|
103
|
+
@end
|
|
104
|
+
|
|
105
|
+
Class<RCTComponentViewProtocol> CardFormCls(void)
|
|
106
|
+
{
|
|
107
|
+
return CardFormComponentView.class;
|
|
108
|
+
}
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
#import "StripeContainerComponentView.h"
|
|
2
|
+
|
|
3
|
+
#import <react/renderer/components/rnstripe/ComponentDescriptors.h>
|
|
4
|
+
#import <react/renderer/components/rnstripe/EventEmitters.h>
|
|
5
|
+
#import <react/renderer/components/rnstripe/Props.h>
|
|
6
|
+
#import <react/renderer/components/rnstripe/RCTComponentViewHelpers.h>
|
|
7
|
+
|
|
8
|
+
#import <React/RCTConversions.h>
|
|
9
|
+
#import <React/RCTFabricComponentsPlugins.h>
|
|
10
|
+
|
|
11
|
+
#import "RCTFollyConvert.h"
|
|
12
|
+
#import "StripeSwiftInterop.h"
|
|
13
|
+
|
|
14
|
+
using namespace facebook::react;
|
|
15
|
+
|
|
16
|
+
@interface StripeContainerComponentView () <RCTStripeContainerViewProtocol>
|
|
17
|
+
@end
|
|
18
|
+
|
|
19
|
+
@implementation StripeContainerComponentView {
|
|
20
|
+
StripeContainerView *_view;
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
// Needed because of this: https://github.com/facebook/react-native/pull/37274
|
|
24
|
+
+ (void)load
|
|
25
|
+
{
|
|
26
|
+
[super load];
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
- (instancetype)initWithFrame:(CGRect)frame
|
|
30
|
+
{
|
|
31
|
+
if (self = [super initWithFrame:frame]) {
|
|
32
|
+
static const auto defaultProps = std::make_shared<const StripeContainerProps>();
|
|
33
|
+
_props = defaultProps;
|
|
34
|
+
[self prepareView];
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return self;
|
|
38
|
+
}
|
|
39
|
+
|
|
40
|
+
- (void)prepareView
|
|
41
|
+
{
|
|
42
|
+
_view = [[StripeContainerView alloc] initWithFrame:self.frame];
|
|
43
|
+
self.contentView = _view;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
- (void)updateProps:(const facebook::react::Props::Shared &)props
|
|
47
|
+
oldProps:(const facebook::react::Props::Shared &)oldProps
|
|
48
|
+
{
|
|
49
|
+
const auto &newViewProps = *std::static_pointer_cast<const StripeContainerProps>(props);
|
|
50
|
+
|
|
51
|
+
_view.keyboardShouldPersistTaps = newViewProps.keyboardShouldPersistTaps;
|
|
52
|
+
|
|
53
|
+
[super updateProps:props oldProps:oldProps];
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
#pragma mark - RCTComponentViewProtocol
|
|
57
|
+
|
|
58
|
+
+ (ComponentDescriptorProvider)componentDescriptorProvider
|
|
59
|
+
{
|
|
60
|
+
return concreteComponentDescriptorProvider<StripeContainerComponentDescriptor>();
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
- (void)prepareForRecycle
|
|
64
|
+
{
|
|
65
|
+
[super prepareForRecycle];
|
|
66
|
+
[self prepareView];
|
|
67
|
+
}
|
|
68
|
+
|
|
69
|
+
@end
|
|
70
|
+
|
|
71
|
+
Class<RCTComponentViewProtocol> StripeContainerCls(void)
|
|
72
|
+
{
|
|
73
|
+
return StripeContainerComponentView.class;
|
|
74
|
+
}
|