@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
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import type { CardFormView, CardBrand } from '../types';
|
|
2
1
|
import React, {
|
|
3
2
|
forwardRef,
|
|
4
3
|
useCallback,
|
|
@@ -9,21 +8,17 @@ import React, {
|
|
|
9
8
|
import {
|
|
10
9
|
AccessibilityProps,
|
|
11
10
|
NativeSyntheticEvent,
|
|
12
|
-
requireNativeComponent,
|
|
13
|
-
UIManager,
|
|
14
11
|
StyleProp,
|
|
15
|
-
findNodeHandle,
|
|
16
12
|
ViewStyle,
|
|
17
13
|
} from 'react-native';
|
|
14
|
+
import NativeCardForm, { Commands } from '../specs/NativeCardForm';
|
|
18
15
|
import {
|
|
19
16
|
currentlyFocusedInput,
|
|
20
17
|
focusInput,
|
|
21
18
|
registerInput,
|
|
22
19
|
unregisterInput,
|
|
23
20
|
} from '../helpers';
|
|
24
|
-
|
|
25
|
-
const CardFormNative =
|
|
26
|
-
requireNativeComponent<CardFormView.NativeProps>('CardForm');
|
|
21
|
+
import type { CardBrand, CardFormView } from '../types';
|
|
27
22
|
|
|
28
23
|
/**
|
|
29
24
|
* Card Form Component Props
|
|
@@ -80,11 +75,11 @@ export const CardForm = forwardRef<CardFormView.Methods, Props>(
|
|
|
80
75
|
{
|
|
81
76
|
onFormComplete,
|
|
82
77
|
cardStyle,
|
|
83
|
-
// postalCodeEnabled = true,
|
|
84
|
-
// onFocus,
|
|
85
|
-
// onBlur,
|
|
86
78
|
placeholders,
|
|
87
79
|
defaultValues,
|
|
80
|
+
autofocus,
|
|
81
|
+
dangerouslyGetFullCardDetails,
|
|
82
|
+
disabled,
|
|
88
83
|
...props
|
|
89
84
|
},
|
|
90
85
|
ref
|
|
@@ -92,8 +87,8 @@ export const CardForm = forwardRef<CardFormView.Methods, Props>(
|
|
|
92
87
|
const inputRef = useRef<any>(null);
|
|
93
88
|
|
|
94
89
|
const onFormCompleteHandler = useCallback(
|
|
95
|
-
(event: NativeSyntheticEvent<CardFormView.Details>) => {
|
|
96
|
-
const card = event.nativeEvent;
|
|
90
|
+
(event: NativeSyntheticEvent<{ card: CardFormView.Details }>) => {
|
|
91
|
+
const card = event.nativeEvent.card;
|
|
97
92
|
|
|
98
93
|
const data: CardFormView.Details = {
|
|
99
94
|
last4: card.last4,
|
|
@@ -120,19 +115,11 @@ export const CardForm = forwardRef<CardFormView.Methods, Props>(
|
|
|
120
115
|
);
|
|
121
116
|
|
|
122
117
|
const focus = () => {
|
|
123
|
-
|
|
124
|
-
findNodeHandle(inputRef.current),
|
|
125
|
-
'focus' as any,
|
|
126
|
-
[]
|
|
127
|
-
);
|
|
118
|
+
Commands.focus(inputRef.current);
|
|
128
119
|
};
|
|
129
120
|
|
|
130
121
|
const blur = () => {
|
|
131
|
-
|
|
132
|
-
findNodeHandle(inputRef.current),
|
|
133
|
-
'blur' as any,
|
|
134
|
-
[]
|
|
135
|
-
);
|
|
122
|
+
Commands.blur(inputRef.current);
|
|
136
123
|
};
|
|
137
124
|
|
|
138
125
|
useImperativeHandle(ref, () => ({
|
|
@@ -145,9 +132,6 @@ export const CardForm = forwardRef<CardFormView.Methods, Props>(
|
|
|
145
132
|
const { focusedField } = event.nativeEvent;
|
|
146
133
|
if (focusedField) {
|
|
147
134
|
focusInput(inputRef.current);
|
|
148
|
-
// onFocus?.(focusedField);
|
|
149
|
-
} else {
|
|
150
|
-
// onBlur?.();
|
|
151
135
|
}
|
|
152
136
|
},
|
|
153
137
|
[]
|
|
@@ -168,7 +152,7 @@ export const CardForm = forwardRef<CardFormView.Methods, Props>(
|
|
|
168
152
|
}, [inputRef]);
|
|
169
153
|
|
|
170
154
|
return (
|
|
171
|
-
<
|
|
155
|
+
<NativeCardForm
|
|
172
156
|
ref={inputRef}
|
|
173
157
|
onFormComplete={onFormCompleteHandler}
|
|
174
158
|
cardStyle={{
|
|
@@ -182,8 +166,6 @@ export const CardForm = forwardRef<CardFormView.Methods, Props>(
|
|
|
182
166
|
textColor: cardStyle?.textColor,
|
|
183
167
|
textErrorColor: cardStyle?.textErrorColor,
|
|
184
168
|
fontFamily: cardStyle?.fontFamily,
|
|
185
|
-
// disabledBackgroundColor: cardStyle?.disabledBackgroundColor,
|
|
186
|
-
// type: cardStyle?.type,
|
|
187
169
|
}}
|
|
188
170
|
placeholders={{
|
|
189
171
|
number: placeholders?.number,
|
|
@@ -195,7 +177,10 @@ export const CardForm = forwardRef<CardFormView.Methods, Props>(
|
|
|
195
177
|
...(defaultValues ?? {}),
|
|
196
178
|
}}
|
|
197
179
|
onFocusChange={onFocusHandler}
|
|
198
|
-
|
|
180
|
+
autofocus={autofocus ?? false}
|
|
181
|
+
dangerouslyGetFullCardDetails={dangerouslyGetFullCardDetails ?? false}
|
|
182
|
+
disabled={disabled ?? false}
|
|
183
|
+
postalCodeEnabled
|
|
199
184
|
{...props}
|
|
200
185
|
/>
|
|
201
186
|
);
|
|
@@ -1,32 +1,30 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
NativeModules,
|
|
5
|
-
EmitterSubscription,
|
|
6
|
-
} from 'react-native';
|
|
7
|
-
import NativeStripeSdk from '../NativeStripeSdk';
|
|
2
|
+
import { EventSubscription } from 'react-native';
|
|
3
|
+
import NativeStripeSdk from '../specs/NativeStripeSdkModule';
|
|
8
4
|
import type {
|
|
9
5
|
CustomerSheetInitParams,
|
|
10
6
|
CustomerSheetPresentParams,
|
|
11
7
|
CustomerSheetResult,
|
|
12
|
-
CustomerSheetError,
|
|
13
|
-
StripeError,
|
|
14
8
|
CustomerAdapter,
|
|
9
|
+
StripeError,
|
|
10
|
+
CustomerSheetError,
|
|
15
11
|
} from '../types';
|
|
12
|
+
import { addListener } from '../events';
|
|
16
13
|
|
|
17
|
-
|
|
18
|
-
let
|
|
19
|
-
let
|
|
20
|
-
let
|
|
21
|
-
let
|
|
22
|
-
let
|
|
23
|
-
let setupIntentClientSecretForCustomerAttachCallback: EmitterSubscription | null =
|
|
14
|
+
let fetchPaymentMethodsCallback: EventSubscription | null = null;
|
|
15
|
+
let attachPaymentMethodCallback: EventSubscription | null = null;
|
|
16
|
+
let detachPaymentMethodCallback: EventSubscription | null = null;
|
|
17
|
+
let setSelectedPaymentOptionCallback: EventSubscription | null = null;
|
|
18
|
+
let fetchSelectedPaymentOptionCallback: EventSubscription | null = null;
|
|
19
|
+
let setupIntentClientSecretForCustomerAttachCallback: EventSubscription | null =
|
|
24
20
|
null;
|
|
25
21
|
|
|
26
22
|
/** Initialize an instance of Customer Sheet with your desired configuration. */
|
|
27
23
|
const initialize = async (
|
|
28
24
|
params: CustomerSheetInitParams
|
|
29
|
-
): Promise<{
|
|
25
|
+
): Promise<{
|
|
26
|
+
error?: StripeError<CustomerSheetError>;
|
|
27
|
+
}> => {
|
|
30
28
|
let customerAdapterOverrides = {};
|
|
31
29
|
if (params.customerAdapter) {
|
|
32
30
|
customerAdapterOverrides = configureCustomerAdapterEventListeners(
|
|
@@ -55,7 +53,7 @@ const configureCustomerAdapterEventListeners = (
|
|
|
55
53
|
): { [Property in keyof CustomerAdapter]: boolean } => {
|
|
56
54
|
if (customerAdapter.fetchPaymentMethods) {
|
|
57
55
|
fetchPaymentMethodsCallback?.remove();
|
|
58
|
-
fetchPaymentMethodsCallback =
|
|
56
|
+
fetchPaymentMethodsCallback = addListener(
|
|
59
57
|
'onCustomerAdapterFetchPaymentMethodsCallback',
|
|
60
58
|
async () => {
|
|
61
59
|
if (customerAdapter.fetchPaymentMethods) {
|
|
@@ -74,9 +72,9 @@ const configureCustomerAdapterEventListeners = (
|
|
|
74
72
|
|
|
75
73
|
if (customerAdapter.attachPaymentMethod) {
|
|
76
74
|
attachPaymentMethodCallback?.remove();
|
|
77
|
-
attachPaymentMethodCallback =
|
|
75
|
+
attachPaymentMethodCallback = addListener(
|
|
78
76
|
'onCustomerAdapterAttachPaymentMethodCallback',
|
|
79
|
-
async ({ paymentMethodId }
|
|
77
|
+
async ({ paymentMethodId }) => {
|
|
80
78
|
if (customerAdapter.attachPaymentMethod) {
|
|
81
79
|
const paymentMethod =
|
|
82
80
|
await customerAdapter.attachPaymentMethod(paymentMethodId);
|
|
@@ -94,9 +92,9 @@ const configureCustomerAdapterEventListeners = (
|
|
|
94
92
|
|
|
95
93
|
if (customerAdapter.detachPaymentMethod) {
|
|
96
94
|
detachPaymentMethodCallback?.remove();
|
|
97
|
-
detachPaymentMethodCallback =
|
|
95
|
+
detachPaymentMethodCallback = addListener(
|
|
98
96
|
'onCustomerAdapterDetachPaymentMethodCallback',
|
|
99
|
-
async ({ paymentMethodId }
|
|
97
|
+
async ({ paymentMethodId }) => {
|
|
100
98
|
if (customerAdapter.detachPaymentMethod) {
|
|
101
99
|
const paymentMethod =
|
|
102
100
|
await customerAdapter.detachPaymentMethod(paymentMethodId);
|
|
@@ -114,9 +112,9 @@ const configureCustomerAdapterEventListeners = (
|
|
|
114
112
|
|
|
115
113
|
if (customerAdapter.setSelectedPaymentOption) {
|
|
116
114
|
setSelectedPaymentOptionCallback?.remove();
|
|
117
|
-
setSelectedPaymentOptionCallback =
|
|
115
|
+
setSelectedPaymentOptionCallback = addListener(
|
|
118
116
|
'onCustomerAdapterSetSelectedPaymentOptionCallback',
|
|
119
|
-
async ({ paymentOption }
|
|
117
|
+
async ({ paymentOption }) => {
|
|
120
118
|
if (customerAdapter.setSelectedPaymentOption) {
|
|
121
119
|
await customerAdapter.setSelectedPaymentOption(paymentOption);
|
|
122
120
|
await NativeStripeSdk.customerAdapterSetSelectedPaymentOptionCallback();
|
|
@@ -131,7 +129,7 @@ const configureCustomerAdapterEventListeners = (
|
|
|
131
129
|
|
|
132
130
|
if (customerAdapter.fetchSelectedPaymentOption) {
|
|
133
131
|
fetchSelectedPaymentOptionCallback?.remove();
|
|
134
|
-
fetchSelectedPaymentOptionCallback =
|
|
132
|
+
fetchSelectedPaymentOptionCallback = addListener(
|
|
135
133
|
'onCustomerAdapterFetchSelectedPaymentOptionCallback',
|
|
136
134
|
async () => {
|
|
137
135
|
if (customerAdapter.fetchSelectedPaymentOption) {
|
|
@@ -151,7 +149,7 @@ const configureCustomerAdapterEventListeners = (
|
|
|
151
149
|
|
|
152
150
|
if (customerAdapter.setupIntentClientSecretForCustomerAttach) {
|
|
153
151
|
setupIntentClientSecretForCustomerAttachCallback?.remove();
|
|
154
|
-
setupIntentClientSecretForCustomerAttachCallback =
|
|
152
|
+
setupIntentClientSecretForCustomerAttachCallback = addListener(
|
|
155
153
|
'onCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback',
|
|
156
154
|
async () => {
|
|
157
155
|
if (customerAdapter.setupIntentClientSecretForCustomerAttach) {
|
|
@@ -8,15 +8,15 @@ import {
|
|
|
8
8
|
Platform,
|
|
9
9
|
NativeSyntheticEvent,
|
|
10
10
|
} from 'react-native';
|
|
11
|
-
import NativeStripeSdk from '../
|
|
11
|
+
import NativeStripeSdk from '../specs/NativeStripeSdkModule';
|
|
12
12
|
import {
|
|
13
13
|
ButtonType,
|
|
14
14
|
ButtonStyle,
|
|
15
15
|
ShippingMethod,
|
|
16
16
|
ShippingContact,
|
|
17
17
|
} from '../types/PlatformPay';
|
|
18
|
-
import
|
|
19
|
-
import
|
|
18
|
+
import NativeApplePayButton from '../specs/NativeApplePayButton';
|
|
19
|
+
import NativeGooglePayButton from '../specs/NativeGooglePayButton';
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
22
|
* PlatformPayButton Component Props
|
|
@@ -149,11 +149,11 @@ export function PlatformPayButton({
|
|
|
149
149
|
style={[disabled ? styles.disabled : styles.notDisabled, style]}
|
|
150
150
|
>
|
|
151
151
|
{Platform.OS === 'ios' ? (
|
|
152
|
-
<
|
|
152
|
+
<NativeApplePayButton
|
|
153
153
|
type={type}
|
|
154
154
|
buttonStyle={appearance}
|
|
155
155
|
borderRadius={borderRadius}
|
|
156
|
-
disabled={disabled}
|
|
156
|
+
disabled={disabled ?? false}
|
|
157
157
|
onShippingMethodSelectedAction={shippingMethodCallback}
|
|
158
158
|
onShippingContactSelectedAction={shippingContactCallback}
|
|
159
159
|
onCouponCodeEnteredAction={couponCodeCallback}
|
|
@@ -162,7 +162,7 @@ export function PlatformPayButton({
|
|
|
162
162
|
{...props}
|
|
163
163
|
/>
|
|
164
164
|
) : (
|
|
165
|
-
<
|
|
165
|
+
<NativeGooglePayButton
|
|
166
166
|
type={type}
|
|
167
167
|
appearance={appearance}
|
|
168
168
|
borderRadius={borderRadius}
|
|
@@ -1,14 +1,7 @@
|
|
|
1
1
|
import React from 'react';
|
|
2
2
|
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
StyleProp,
|
|
6
|
-
StyleSheet,
|
|
7
|
-
ViewStyle,
|
|
8
|
-
View,
|
|
9
|
-
} from 'react-native';
|
|
10
|
-
|
|
11
|
-
const StripeContainerNative = requireNativeComponent<any>('StripeContainer');
|
|
3
|
+
import { StyleProp, StyleSheet, ViewStyle, View } from 'react-native';
|
|
4
|
+
import NativeStripeContainer from '../specs/NativeStripeContainer';
|
|
12
5
|
|
|
13
6
|
/**
|
|
14
7
|
* Stripe Container Component Props
|
|
@@ -31,14 +24,14 @@ export function StripeContainer({
|
|
|
31
24
|
children,
|
|
32
25
|
}: Props) {
|
|
33
26
|
return (
|
|
34
|
-
<
|
|
35
|
-
keyboardShouldPersistTaps={keyboardShouldPersistTaps}
|
|
27
|
+
<NativeStripeContainer
|
|
28
|
+
keyboardShouldPersistTaps={keyboardShouldPersistTaps ?? true}
|
|
36
29
|
style={styles.container}
|
|
37
30
|
>
|
|
38
31
|
<View style={styles.container} accessible={false}>
|
|
39
32
|
{children}
|
|
40
33
|
</View>
|
|
41
|
-
</
|
|
34
|
+
</NativeStripeContainer>
|
|
42
35
|
);
|
|
43
36
|
}
|
|
44
37
|
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { useEffect } from 'react';
|
|
2
2
|
|
|
3
|
-
import NativeStripeSdk from '../
|
|
3
|
+
import NativeStripeSdk from '../specs/NativeStripeSdkModule';
|
|
4
4
|
import { isAndroid, shouldAttributeExpo } from '../helpers';
|
|
5
5
|
import type { AppInfo, InitStripeParams, InitialiseParams } from '../types';
|
|
6
6
|
import pjson from '../../package.json';
|
package/src/events.ts
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Compatibility helper to use new arch events if available and fallback
|
|
3
|
+
* to NativeEventEmitter or DeviceEventEmitter.
|
|
4
|
+
*
|
|
5
|
+
* Can be removed once we no longer need to support the old arch and use
|
|
6
|
+
* the methods on NativeStripeSdkModule directly.
|
|
7
|
+
*/
|
|
8
|
+
|
|
9
|
+
import {
|
|
10
|
+
DeviceEventEmitter,
|
|
11
|
+
EventSubscription,
|
|
12
|
+
NativeEventEmitter,
|
|
13
|
+
Platform,
|
|
14
|
+
} from 'react-native';
|
|
15
|
+
import NativeStripeSdkModule from './specs/NativeStripeSdkModule';
|
|
16
|
+
|
|
17
|
+
const compatEventEmitter =
|
|
18
|
+
// On new arch we use native module events. On old arch this doesn't exist
|
|
19
|
+
// so use NativeEventEmitter on iOS and DeviceEventEmitter on Android.
|
|
20
|
+
NativeStripeSdkModule.onConfirmHandlerCallback == null
|
|
21
|
+
? Platform.OS === 'ios'
|
|
22
|
+
? new NativeEventEmitter(NativeStripeSdkModule as any)
|
|
23
|
+
: DeviceEventEmitter
|
|
24
|
+
: null;
|
|
25
|
+
|
|
26
|
+
type Events =
|
|
27
|
+
| 'onConfirmHandlerCallback'
|
|
28
|
+
| 'onFinancialConnectionsEvent'
|
|
29
|
+
| 'onOrderTrackingCallback'
|
|
30
|
+
| 'onCustomerAdapterFetchPaymentMethodsCallback'
|
|
31
|
+
| 'onCustomerAdapterAttachPaymentMethodCallback'
|
|
32
|
+
| 'onCustomerAdapterDetachPaymentMethodCallback'
|
|
33
|
+
| 'onCustomerAdapterSetSelectedPaymentOptionCallback'
|
|
34
|
+
| 'onCustomerAdapterFetchSelectedPaymentOptionCallback'
|
|
35
|
+
| 'onCustomerAdapterSetupIntentClientSecretForCustomerAttachCallback'
|
|
36
|
+
| 'embeddedPaymentElementFormSheetConfirmComplete'
|
|
37
|
+
| 'embeddedPaymentElementDidUpdatePaymentOption'
|
|
38
|
+
| 'embeddedPaymentElementDidUpdateHeight'
|
|
39
|
+
| 'embeddedPaymentElementLoadingFailed';
|
|
40
|
+
|
|
41
|
+
export function addListener<EventT extends Events>(
|
|
42
|
+
event: EventT,
|
|
43
|
+
handler: Parameters<(typeof NativeStripeSdkModule)[EventT]>[0]
|
|
44
|
+
): EventSubscription {
|
|
45
|
+
if (compatEventEmitter != null) {
|
|
46
|
+
return compatEventEmitter.addListener(event, handler);
|
|
47
|
+
}
|
|
48
|
+
return NativeStripeSdkModule[event](handler as any);
|
|
49
|
+
}
|
package/src/functions.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { createError } from './helpers';
|
|
2
2
|
import { MissingRoutingNumber } from './types/Errors';
|
|
3
|
-
import NativeStripeSdk from './
|
|
3
|
+
import NativeStripeSdk from './specs/NativeStripeSdkModule';
|
|
4
4
|
import type {
|
|
5
5
|
PlatformPayError,
|
|
6
6
|
ConfirmPaymentResult,
|
|
@@ -32,14 +32,10 @@ import type {
|
|
|
32
32
|
FinancialConnections,
|
|
33
33
|
PlatformPay,
|
|
34
34
|
} from './types';
|
|
35
|
-
import {
|
|
36
|
-
Platform,
|
|
37
|
-
NativeEventEmitter,
|
|
38
|
-
NativeModules,
|
|
39
|
-
EmitterSubscription,
|
|
40
|
-
} from 'react-native';
|
|
35
|
+
import { Platform, EventSubscription } from 'react-native';
|
|
41
36
|
import type { CollectFinancialConnectionsAccountsParams } from './types/FinancialConnections';
|
|
42
37
|
import type { CollectBankAccountTokenParams } from './types/PaymentMethod';
|
|
38
|
+
import { addListener } from './events';
|
|
43
39
|
|
|
44
40
|
export const createPaymentMethod = async (
|
|
45
41
|
params: PaymentMethod.CreateParams,
|
|
@@ -353,10 +349,9 @@ export const verifyMicrodepositsForSetup = async (
|
|
|
353
349
|
}
|
|
354
350
|
};
|
|
355
351
|
|
|
356
|
-
|
|
357
|
-
let
|
|
358
|
-
let
|
|
359
|
-
let financialConnectionsEventListener: EmitterSubscription | null = null;
|
|
352
|
+
let confirmHandlerCallback: EventSubscription | null = null;
|
|
353
|
+
let orderTrackingCallbackListener: EventSubscription | null = null;
|
|
354
|
+
let financialConnectionsEventListener: EventSubscription | null = null;
|
|
360
355
|
|
|
361
356
|
export const initPaymentSheet = async (
|
|
362
357
|
params: PaymentSheet.SetupParams
|
|
@@ -365,15 +360,9 @@ export const initPaymentSheet = async (
|
|
|
365
360
|
const confirmHandler = params?.intentConfiguration?.confirmHandler;
|
|
366
361
|
if (confirmHandler) {
|
|
367
362
|
confirmHandlerCallback?.remove();
|
|
368
|
-
confirmHandlerCallback =
|
|
363
|
+
confirmHandlerCallback = addListener(
|
|
369
364
|
'onConfirmHandlerCallback',
|
|
370
|
-
({
|
|
371
|
-
paymentMethod,
|
|
372
|
-
shouldSavePaymentMethod,
|
|
373
|
-
}: {
|
|
374
|
-
paymentMethod: PaymentMethod.Result;
|
|
375
|
-
shouldSavePaymentMethod: boolean;
|
|
376
|
-
}) => {
|
|
365
|
+
({ paymentMethod, shouldSavePaymentMethod }) => {
|
|
377
366
|
confirmHandler(
|
|
378
367
|
paymentMethod,
|
|
379
368
|
shouldSavePaymentMethod,
|
|
@@ -386,7 +375,7 @@ export const initPaymentSheet = async (
|
|
|
386
375
|
const orderTrackingCallback = params?.applePay?.setOrderTracking;
|
|
387
376
|
if (orderTrackingCallback) {
|
|
388
377
|
orderTrackingCallbackListener?.remove();
|
|
389
|
-
orderTrackingCallbackListener =
|
|
378
|
+
orderTrackingCallbackListener = addListener(
|
|
390
379
|
'onOrderTrackingCallback',
|
|
391
380
|
() => {
|
|
392
381
|
orderTrackingCallback(NativeStripeSdk.configureOrderTracking);
|
|
@@ -471,7 +460,7 @@ export const collectBankAccountForPayment = async (
|
|
|
471
460
|
financialConnectionsEventListener?.remove();
|
|
472
461
|
|
|
473
462
|
if (params.onEvent) {
|
|
474
|
-
financialConnectionsEventListener =
|
|
463
|
+
financialConnectionsEventListener = addListener(
|
|
475
464
|
'onFinancialConnectionsEvent',
|
|
476
465
|
params.onEvent
|
|
477
466
|
);
|
|
@@ -509,7 +498,7 @@ export const collectBankAccountForSetup = async (
|
|
|
509
498
|
financialConnectionsEventListener?.remove();
|
|
510
499
|
|
|
511
500
|
if (params.onEvent) {
|
|
512
|
-
financialConnectionsEventListener =
|
|
501
|
+
financialConnectionsEventListener = addListener(
|
|
513
502
|
'onFinancialConnectionsEvent',
|
|
514
503
|
params.onEvent
|
|
515
504
|
);
|
|
@@ -554,7 +543,7 @@ export const collectBankAccountToken = async (
|
|
|
554
543
|
financialConnectionsEventListener?.remove();
|
|
555
544
|
|
|
556
545
|
if (params.onEvent) {
|
|
557
|
-
financialConnectionsEventListener =
|
|
546
|
+
financialConnectionsEventListener = addListener(
|
|
558
547
|
'onFinancialConnectionsEvent',
|
|
559
548
|
params.onEvent
|
|
560
549
|
);
|
|
@@ -597,7 +586,7 @@ export const collectFinancialConnectionsAccounts = async (
|
|
|
597
586
|
financialConnectionsEventListener?.remove();
|
|
598
587
|
|
|
599
588
|
if (params.onEvent) {
|
|
600
|
-
financialConnectionsEventListener =
|
|
589
|
+
financialConnectionsEventListener = addListener(
|
|
601
590
|
'onFinancialConnectionsEvent',
|
|
602
591
|
params.onEvent
|
|
603
592
|
);
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useState, useCallback } from 'react';
|
|
2
2
|
import { useStripe } from './useStripe';
|
|
3
|
-
import type { CollectFinancialConnectionsAccountsParams } from '
|
|
4
|
-
import type { CollectBankAccountTokenParams } from '
|
|
3
|
+
import type { CollectFinancialConnectionsAccountsParams } from '../types/FinancialConnections';
|
|
4
|
+
import type { CollectBankAccountTokenParams } from '../types/PaymentMethod';
|
|
5
5
|
|
|
6
6
|
/**
|
|
7
7
|
* React hook for accessing functions on the Financial Connections sheet.
|
package/src/hooks/useStripe.tsx
CHANGED
|
@@ -60,8 +60,8 @@ import {
|
|
|
60
60
|
updatePlatformPaySheet,
|
|
61
61
|
openPlatformPaySetup,
|
|
62
62
|
} from '../functions';
|
|
63
|
-
import type { CollectBankAccountTokenParams } from '
|
|
64
|
-
import type { CollectFinancialConnectionsAccountsParams } from '
|
|
63
|
+
import type { CollectBankAccountTokenParams } from '../types/PaymentMethod';
|
|
64
|
+
import type { CollectFinancialConnectionsAccountsParams } from '../types/FinancialConnections';
|
|
65
65
|
|
|
66
66
|
/**
|
|
67
67
|
* useStripe hook
|
package/src/index.tsx
CHANGED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import type {
|
|
3
|
+
DirectEventHandler,
|
|
4
|
+
WithDefault,
|
|
5
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
6
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
7
|
+
import type {
|
|
8
|
+
CardActionError,
|
|
9
|
+
GooglePayCardToken,
|
|
10
|
+
StripeError,
|
|
11
|
+
} from '../types';
|
|
12
|
+
import type { UnsafeMixed, ImageSource } from './utils';
|
|
13
|
+
|
|
14
|
+
type AddToWalletButtonCompleteEvent = Readonly<{
|
|
15
|
+
error: UnsafeMixed<StripeError<CardActionError>> | null;
|
|
16
|
+
}>;
|
|
17
|
+
|
|
18
|
+
type CardDetails = Readonly<{
|
|
19
|
+
primaryAccountIdentifier: string | null;
|
|
20
|
+
name: string;
|
|
21
|
+
description: string;
|
|
22
|
+
lastFour?: string;
|
|
23
|
+
brand?: string;
|
|
24
|
+
}>;
|
|
25
|
+
|
|
26
|
+
export interface NativeProps extends ViewProps {
|
|
27
|
+
iOSButtonStyle?: WithDefault<string, 'onDarkBackground'>;
|
|
28
|
+
androidAssetSource: ImageSource;
|
|
29
|
+
testEnv?: boolean;
|
|
30
|
+
cardDetails: UnsafeMixed<CardDetails>;
|
|
31
|
+
token?: UnsafeMixed<GooglePayCardToken> | null;
|
|
32
|
+
ephemeralKey: UnsafeMixed<object>;
|
|
33
|
+
onCompleteAction?: DirectEventHandler<AddToWalletButtonCompleteEvent>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type ComponentType = HostComponent<NativeProps>;
|
|
37
|
+
|
|
38
|
+
export default codegenNativeComponent<NativeProps>(
|
|
39
|
+
'AddToWalletButton'
|
|
40
|
+
) as ComponentType;
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import type {
|
|
3
|
+
DirectEventHandler,
|
|
4
|
+
WithDefault,
|
|
5
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
6
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
7
|
+
import type {
|
|
8
|
+
AddressDetails,
|
|
9
|
+
AddressSheetError,
|
|
10
|
+
PaymentSheet,
|
|
11
|
+
StripeError,
|
|
12
|
+
} from '../types';
|
|
13
|
+
import type { UnsafeMixed } from './utils';
|
|
14
|
+
|
|
15
|
+
type CollectAddressResult = Required<AddressDetails>;
|
|
16
|
+
|
|
17
|
+
type AddressSheetErrorEvent = Readonly<{
|
|
18
|
+
error: UnsafeMixed<StripeError<AddressSheetError>>;
|
|
19
|
+
}>;
|
|
20
|
+
|
|
21
|
+
type AdditionalFields = Readonly<{
|
|
22
|
+
phoneNumber?: string;
|
|
23
|
+
checkboxLabel?: string;
|
|
24
|
+
}>;
|
|
25
|
+
|
|
26
|
+
type OnSubmitActionEvent = Readonly<{
|
|
27
|
+
result: UnsafeMixed<CollectAddressResult>;
|
|
28
|
+
}>;
|
|
29
|
+
|
|
30
|
+
export interface NativeProps extends ViewProps {
|
|
31
|
+
visible: boolean;
|
|
32
|
+
presentationStyle?: WithDefault<string, 'popover'>;
|
|
33
|
+
animationStyle?: WithDefault<string, 'slide'>;
|
|
34
|
+
appearance?: UnsafeMixed<PaymentSheet.AppearanceParams>;
|
|
35
|
+
defaultValues?: UnsafeMixed<AddressDetails>;
|
|
36
|
+
additionalFields?: UnsafeMixed<AdditionalFields>;
|
|
37
|
+
allowedCountries?: Array<string>;
|
|
38
|
+
autocompleteCountries?: Array<string>;
|
|
39
|
+
primaryButtonTitle?: string;
|
|
40
|
+
sheetTitle?: string;
|
|
41
|
+
googlePlacesApiKey?: string;
|
|
42
|
+
onSubmitAction: DirectEventHandler<OnSubmitActionEvent>;
|
|
43
|
+
onErrorAction: DirectEventHandler<AddressSheetErrorEvent>;
|
|
44
|
+
}
|
|
45
|
+
|
|
46
|
+
type ComponentType = HostComponent<NativeProps>;
|
|
47
|
+
|
|
48
|
+
export default codegenNativeComponent<NativeProps>(
|
|
49
|
+
'AddressSheetView'
|
|
50
|
+
) as ComponentType;
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import type {
|
|
3
|
+
DirectEventHandler,
|
|
4
|
+
Int32,
|
|
5
|
+
WithDefault,
|
|
6
|
+
} from 'react-native/Libraries/Types/CodegenTypes';
|
|
7
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
8
|
+
import { ShippingContact, ShippingMethod } from '../types/PlatformPay';
|
|
9
|
+
import { UnsafeMixed } from './utils';
|
|
10
|
+
|
|
11
|
+
type OnShippingMethodSelectedActionEvent = {
|
|
12
|
+
shippingMethod: UnsafeMixed<ShippingMethod>;
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
type OnShippingContactSelectedActionEvent = {
|
|
16
|
+
shippingContact: UnsafeMixed<ShippingContact>;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
type OnCouponCodeEnteredActionEvent = {
|
|
20
|
+
couponCode: string;
|
|
21
|
+
};
|
|
22
|
+
|
|
23
|
+
type OnOrderTrackingActionEvent = {};
|
|
24
|
+
|
|
25
|
+
export interface NativeProps extends ViewProps {
|
|
26
|
+
disabled: boolean;
|
|
27
|
+
type: Int32;
|
|
28
|
+
buttonStyle: Int32;
|
|
29
|
+
borderRadius?: WithDefault<Int32, 4>;
|
|
30
|
+
onShippingMethodSelectedAction?: DirectEventHandler<OnShippingMethodSelectedActionEvent>;
|
|
31
|
+
onShippingContactSelectedAction?: DirectEventHandler<OnShippingContactSelectedActionEvent>;
|
|
32
|
+
onCouponCodeEnteredAction?: DirectEventHandler<OnCouponCodeEnteredActionEvent>;
|
|
33
|
+
onOrderTrackingAction?: DirectEventHandler<OnOrderTrackingActionEvent>;
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
type ComponentType = HostComponent<NativeProps>;
|
|
37
|
+
|
|
38
|
+
export default codegenNativeComponent<NativeProps>(
|
|
39
|
+
'ApplePayButton'
|
|
40
|
+
) as ComponentType;
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
import type { HostComponent, ViewProps } from 'react-native';
|
|
2
|
+
import type { DirectEventHandler } from 'react-native/Libraries/Types/CodegenTypes';
|
|
3
|
+
import codegenNativeComponent from 'react-native/Libraries/Utilities/codegenNativeComponent';
|
|
4
|
+
import type { AuBECSDebitFormComponent } from '../types';
|
|
5
|
+
import type { UnsafeMixed } from './utils';
|
|
6
|
+
|
|
7
|
+
type FormDetailsEvent = Readonly<{
|
|
8
|
+
accountNumber: string;
|
|
9
|
+
bsbNumber: string;
|
|
10
|
+
email: string;
|
|
11
|
+
name: string;
|
|
12
|
+
}>;
|
|
13
|
+
|
|
14
|
+
export interface NativeProps extends ViewProps {
|
|
15
|
+
companyName: string;
|
|
16
|
+
onCompleteAction: DirectEventHandler<FormDetailsEvent>;
|
|
17
|
+
formStyle?: UnsafeMixed<AuBECSDebitFormComponent.Styles>;
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
type ComponentType = HostComponent<NativeProps>;
|
|
21
|
+
|
|
22
|
+
export default codegenNativeComponent<NativeProps>(
|
|
23
|
+
'AuBECSDebitForm'
|
|
24
|
+
) as ComponentType;
|