@stripe/stripe-react-native 0.58.0 → 0.59.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/android/build.gradle +2 -0
- package/android/src/main/AndroidManifest.xml +27 -1
- package/android/src/main/java/com/reactnativestripesdk/EmbeddedPaymentElementViewManager.kt +2 -0
- package/android/src/main/java/com/reactnativestripesdk/EventEmitterCompat.kt +8 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentElementConfig.kt +8 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodMessagingElementConfig.kt +147 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodMessagingElementView.kt +164 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentMethodMessagingElementViewManager.kt +65 -0
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +1 -1
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetManager.kt +55 -26
- package/android/src/main/java/com/reactnativestripesdk/StripeConnectDeepLinkInterceptorActivity.kt +77 -0
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +325 -22
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkPackage.kt +1 -0
- package/android/src/main/java/com/reactnativestripesdk/customersheet/CustomerSheetManager.kt +3 -0
- package/android/src/main/java/com/reactnativestripesdk/utils/Errors.kt +8 -0
- package/android/src/main/res/xml/file_paths.xml +4 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/PaymentMethodMessagingElementViewManagerDelegate.java +36 -0
- package/android/src/oldarch/java/com/facebook/react/viewmanagers/PaymentMethodMessagingElementViewManagerInterface.java +18 -0
- package/android/src/oldarch/java/com/reactnativestripesdk/NativeStripeSdkModuleSpec.java +20 -0
- package/android/src/test/java/com/reactnativestripesdk/PaymentElementConfigTest.kt +37 -0
- package/android/src/test/java/com/reactnativestripesdk/PaymentMethodMessagingElementConfigTest.kt +543 -0
- package/android/src/test/java/com/reactnativestripesdk/PaymentSheetManagerTest.kt +70 -0
- package/ios/CustomerSheet/CustomerSheetUtils.swift +4 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.h +2 -0
- package/ios/OldArch/StripeSdkEventEmitterCompat.m +13 -1
- package/ios/PaymentMethodMessagingElementConfig.swift +116 -0
- package/ios/PaymentMethodMessagingElementHandler.m +9 -0
- package/ios/PaymentMethodMessagingElementView.swift +139 -0
- package/ios/StripeSdk.mm +40 -0
- package/ios/StripeSdkEmitter.swift +2 -0
- package/ios/StripeSdkImpl+CustomerSheet.swift +1 -0
- package/ios/StripeSdkImpl+Embedded.swift +4 -0
- package/ios/StripeSdkImpl+PaymentSheet.swift +16 -0
- package/ios/StripeSdkImpl.swift +132 -0
- package/jest/mock.js +20 -0
- package/lib/commonjs/connect/Components.js.map +1 -1
- package/lib/commonjs/connect/ConnectComponentsProvider.js +1 -1
- package/lib/commonjs/connect/ConnectComponentsProvider.js.map +1 -1
- package/lib/commonjs/connect/EmbeddedComponent.js +5 -5
- package/lib/commonjs/connect/EmbeddedComponent.js.map +1 -1
- package/lib/commonjs/connect/analytics/AnalyticsClient.js +2 -0
- package/lib/commonjs/connect/analytics/AnalyticsClient.js.map +1 -0
- package/lib/commonjs/connect/analytics/ComponentAnalyticsClient.js +2 -0
- package/lib/commonjs/connect/analytics/ComponentAnalyticsClient.js.map +1 -0
- package/lib/commonjs/connect/analytics/events.js +2 -0
- package/lib/commonjs/connect/analytics/events.js.map +1 -0
- package/lib/commonjs/connect/testUtils.js +2 -0
- package/lib/commonjs/connect/testUtils.js.map +1 -0
- package/lib/commonjs/events.js.map +1 -1
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/hooks/useStripe.js +1 -1
- package/lib/commonjs/hooks/useStripe.js.map +1 -1
- package/lib/commonjs/specs/NativePaymentMethodMessagingElement.js +2 -0
- package/lib/commonjs/specs/NativePaymentMethodMessagingElement.js.map +1 -0
- package/lib/commonjs/specs/NativeStripeSdkModule.js.map +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/PaymentSheet.js.map +1 -1
- package/lib/commonjs/types/components/PaymentMethodMessagingElementComponent.js +2 -0
- package/lib/commonjs/types/components/PaymentMethodMessagingElementComponent.js.map +1 -0
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/module/connect/Components.js.map +1 -1
- package/lib/module/connect/ConnectComponentsProvider.js +1 -1
- package/lib/module/connect/ConnectComponentsProvider.js.map +1 -1
- package/lib/module/connect/EmbeddedComponent.js +5 -5
- package/lib/module/connect/EmbeddedComponent.js.map +1 -1
- package/lib/module/connect/analytics/AnalyticsClient.js +2 -0
- package/lib/module/connect/analytics/AnalyticsClient.js.map +1 -0
- package/lib/module/connect/analytics/ComponentAnalyticsClient.js +2 -0
- package/lib/module/connect/analytics/ComponentAnalyticsClient.js.map +1 -0
- package/lib/module/connect/analytics/events.js +2 -0
- package/lib/module/connect/analytics/events.js.map +1 -0
- package/lib/module/connect/testUtils.js +2 -0
- package/lib/module/connect/testUtils.js.map +1 -0
- package/lib/module/events.js.map +1 -1
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/hooks/useStripe.js +1 -1
- package/lib/module/hooks/useStripe.js.map +1 -1
- package/lib/module/specs/NativePaymentMethodMessagingElement.js +2 -0
- package/lib/module/specs/NativePaymentMethodMessagingElement.js.map +1 -0
- package/lib/module/specs/NativeStripeSdkModule.js.map +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/PaymentSheet.js.map +1 -1
- package/lib/module/types/components/PaymentMethodMessagingElementComponent.js +2 -0
- package/lib/module/types/components/PaymentMethodMessagingElementComponent.js.map +1 -0
- package/lib/module/types/index.js.map +1 -1
- package/lib/typescript/src/connect/Components.d.ts +91 -0
- package/lib/typescript/src/connect/Components.d.ts.map +1 -1
- package/lib/typescript/src/connect/ConnectComponentsProvider.d.ts +61 -0
- package/lib/typescript/src/connect/ConnectComponentsProvider.d.ts.map +1 -1
- package/lib/typescript/src/connect/EmbeddedComponent.d.ts.map +1 -1
- package/lib/typescript/src/connect/analytics/AnalyticsClient.d.ts +32 -0
- package/lib/typescript/src/connect/analytics/AnalyticsClient.d.ts.map +1 -0
- package/lib/typescript/src/connect/analytics/ComponentAnalyticsClient.d.ts +94 -0
- package/lib/typescript/src/connect/analytics/ComponentAnalyticsClient.d.ts.map +1 -0
- package/lib/typescript/src/connect/analytics/events.d.ts +215 -0
- package/lib/typescript/src/connect/analytics/events.d.ts.map +1 -0
- package/lib/typescript/src/connect/testUtils.d.ts +45 -0
- package/lib/typescript/src/connect/testUtils.d.ts.map +1 -0
- package/lib/typescript/src/events.d.ts +2 -0
- package/lib/typescript/src/events.d.ts.map +1 -1
- package/lib/typescript/src/functions.d.ts +13 -1
- package/lib/typescript/src/functions.d.ts.map +1 -1
- package/lib/typescript/src/hooks/useStripe.d.ts +2 -1
- package/lib/typescript/src/hooks/useStripe.d.ts.map +1 -1
- package/lib/typescript/src/specs/NativePaymentMethodMessagingElement.d.ts +16 -0
- package/lib/typescript/src/specs/NativePaymentMethodMessagingElement.d.ts.map +1 -0
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts +16 -1
- package/lib/typescript/src/specs/NativeStripeSdkModule.d.ts.map +1 -1
- package/lib/typescript/src/types/CustomerSheet.d.ts +5 -0
- package/lib/typescript/src/types/CustomerSheet.d.ts.map +1 -1
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts +5 -0
- package/lib/typescript/src/types/EmbeddedPaymentElement.d.ts.map +1 -1
- package/lib/typescript/src/types/Errors.d.ts +4 -0
- package/lib/typescript/src/types/Errors.d.ts.map +1 -1
- package/lib/typescript/src/types/PaymentSheet.d.ts +5 -0
- package/lib/typescript/src/types/PaymentSheet.d.ts.map +1 -1
- package/lib/typescript/src/types/components/PaymentMethodMessagingElementComponent.d.ts +69 -0
- package/lib/typescript/src/types/components/PaymentMethodMessagingElementComponent.d.ts.map +1 -0
- package/lib/typescript/src/types/index.d.ts +8 -1
- package/lib/typescript/src/types/index.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/connect/Components.tsx +91 -0
- package/src/connect/ConnectComponentsProvider.tsx +69 -2
- package/src/connect/EmbeddedComponent.tsx +254 -30
- package/src/connect/analytics/AnalyticsClient.ts +75 -0
- package/src/connect/analytics/ComponentAnalyticsClient.ts +315 -0
- package/src/connect/analytics/events.ts +253 -0
- package/src/connect/testUtils.ts +37 -0
- package/src/events.ts +2 -0
- package/src/functions.ts +10 -0
- package/src/hooks/useStripe.tsx +8 -0
- package/src/specs/NativePaymentMethodMessagingElement.ts +25 -0
- package/src/specs/NativeStripeSdkModule.ts +21 -1
- package/src/types/CustomerSheet.ts +5 -0
- package/src/types/EmbeddedPaymentElement.tsx +5 -0
- package/src/types/Errors.ts +5 -0
- package/src/types/PaymentSheet.ts +6 -1
- package/src/types/components/PaymentMethodMessagingElementComponent.tsx +74 -0
- package/src/types/index.ts +11 -0
|
@@ -34,6 +34,7 @@ import type {
|
|
|
34
34
|
StripeError,
|
|
35
35
|
Token,
|
|
36
36
|
VerifyMicrodepositsParams,
|
|
37
|
+
CreateRadarSessionResult,
|
|
37
38
|
} from '../types';
|
|
38
39
|
import type {
|
|
39
40
|
EmbeddedPaymentElementConfiguration,
|
|
@@ -108,7 +109,16 @@ export interface Spec extends TurboModule {
|
|
|
108
109
|
Omit<PaymentMethod.CollectBankAccountParams, 'onEvent'>
|
|
109
110
|
>
|
|
110
111
|
): Promise<ConfirmSetupIntentResult | ConfirmPaymentResult>;
|
|
111
|
-
getConstants(): {
|
|
112
|
+
getConstants(): {
|
|
113
|
+
API_VERSIONS: { CORE: string; ISSUING: string };
|
|
114
|
+
SYSTEM_INFO: {
|
|
115
|
+
sdkVersion: string;
|
|
116
|
+
osVersion: string;
|
|
117
|
+
deviceType: string;
|
|
118
|
+
appName: string;
|
|
119
|
+
appVersion: string;
|
|
120
|
+
};
|
|
121
|
+
};
|
|
112
122
|
canAddCardToWallet(
|
|
113
123
|
params: UnsafeObject<CanAddCardToWalletParams>
|
|
114
124
|
): Promise<CanAddCardToWalletResult>;
|
|
@@ -193,6 +203,7 @@ export interface Spec extends TurboModule {
|
|
|
193
203
|
intentConfig: UnsafeObject<IntentConfiguration>
|
|
194
204
|
): Promise<void>;
|
|
195
205
|
clearEmbeddedPaymentOption(viewTag: Int32): Promise<void>;
|
|
206
|
+
createRadarSession(): Promise<CreateRadarSessionResult>;
|
|
196
207
|
|
|
197
208
|
setFinancialConnectionsForceNativeFlow(enabled: boolean): Promise<void>;
|
|
198
209
|
|
|
@@ -201,6 +212,15 @@ export interface Spec extends TurboModule {
|
|
|
201
212
|
url: string
|
|
202
213
|
): Promise<{ url?: string } | null>;
|
|
203
214
|
|
|
215
|
+
downloadAndShareFile(
|
|
216
|
+
url: string,
|
|
217
|
+
filename?: string | null
|
|
218
|
+
): Promise<{ success: boolean; error?: string }>;
|
|
219
|
+
authWebViewDeepLinkHandled(id: string): Promise<void>;
|
|
220
|
+
|
|
221
|
+
storeStripeConnectDeepLink(url: string): Promise<void>;
|
|
222
|
+
pollAndClearPendingStripeConnectUrls(): Promise<string[]>;
|
|
223
|
+
|
|
204
224
|
// Events
|
|
205
225
|
addListener: (eventType: string) => void;
|
|
206
226
|
removeListeners: (count: number) => void;
|
|
@@ -43,6 +43,11 @@ type CustomerSheetOptionalInitParams = {
|
|
|
43
43
|
* Note: Card brand filtering is not currently supported in Link.
|
|
44
44
|
*/
|
|
45
45
|
cardBrandAcceptance?: PaymentSheet.CardBrandAcceptance;
|
|
46
|
+
/** By default, CustomerSheet offers a card scan button within the new card entry form.
|
|
47
|
+
* When opensCardScannerAutomatically is set to true,
|
|
48
|
+
* the card entry form will initialize with the card scanner already open.
|
|
49
|
+
* Defaults to false. */
|
|
50
|
+
opensCardScannerAutomatically?: boolean;
|
|
46
51
|
};
|
|
47
52
|
|
|
48
53
|
/**
|
|
@@ -215,6 +215,11 @@ export interface EmbeddedPaymentElementConfiguration {
|
|
|
215
215
|
* Defaults to `true`.
|
|
216
216
|
*/
|
|
217
217
|
embeddedViewDisplaysMandateText?: boolean;
|
|
218
|
+
/** By default, EmbeddedPaymentElement offers a card scan button within the new card entry form.
|
|
219
|
+
* When opensCardScannerAutomatically is set to true,
|
|
220
|
+
* the card entry form will initialize with the card scanner already open.
|
|
221
|
+
* Defaults to false. */
|
|
222
|
+
opensCardScannerAutomatically?: boolean;
|
|
218
223
|
}
|
|
219
224
|
|
|
220
225
|
// -----------------------------------------------------------------------------
|
package/src/types/Errors.ts
CHANGED
|
@@ -92,6 +92,11 @@ export type SetupParamsBase = IntentParams & {
|
|
|
92
92
|
cardFundingFiltering?: CardFundingFiltering;
|
|
93
93
|
/** Configuration for custom payment methods in PaymentSheet */
|
|
94
94
|
customPaymentMethodConfiguration?: CustomPaymentMethodConfiguration;
|
|
95
|
+
/** By default, PaymentSheet offers a card scan button within the new card entry form.
|
|
96
|
+
* When opensCardScannerAutomatically is set to true,
|
|
97
|
+
* the card entry form will initialize with the card scanner already open.
|
|
98
|
+
* Defaults to false. */
|
|
99
|
+
opensCardScannerAutomatically?: boolean;
|
|
95
100
|
};
|
|
96
101
|
|
|
97
102
|
export type SetupParams =
|
|
@@ -649,7 +654,7 @@ export type PaymentMode = {
|
|
|
649
654
|
};
|
|
650
655
|
|
|
651
656
|
export type PaymentMethodOptions = {
|
|
652
|
-
/* This is
|
|
657
|
+
/* This feature is in Public Preview. It may not be feature complete and have breaking changes as we develop and update functionality.
|
|
653
658
|
A map of payment method types to setup_future_usage value. (e.g. card: 'OffSession') */
|
|
654
659
|
setupFutureUsageValues: {
|
|
655
660
|
[key: string]: FutureUsage;
|
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
import { NativeSyntheticEvent, StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
|
|
3
|
+
import * as PaymentSheetTypes from '../PaymentSheet';
|
|
4
|
+
|
|
5
|
+
// -----------------------------------------------------------------------------
|
|
6
|
+
// Types
|
|
7
|
+
// -----------------------------------------------------------------------------
|
|
8
|
+
|
|
9
|
+
/**
|
|
10
|
+
* The current state of the PaymentMethodMessagingElement view. Typically loading, succeeded, no_content, or failed.
|
|
11
|
+
*/
|
|
12
|
+
export type PaymentMethodMessagingElementState =
|
|
13
|
+
| { status: 'loading' }
|
|
14
|
+
| { status: 'loaded' }
|
|
15
|
+
| { status: 'no_content' }
|
|
16
|
+
| { status: 'failed'; error: Error };
|
|
17
|
+
|
|
18
|
+
/** Style for the images displayed by the element. */
|
|
19
|
+
export enum PaymentMethodMessagingElementStyle {
|
|
20
|
+
/** A flat style */
|
|
21
|
+
Flat = 'flat',
|
|
22
|
+
/** A dark style */
|
|
23
|
+
Dark = 'dark',
|
|
24
|
+
/** A light style */
|
|
25
|
+
Light = 'light',
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export interface PaymentMethodMessagingElementAppearance {
|
|
29
|
+
/** Font settings for the element. */
|
|
30
|
+
font?: PaymentSheetTypes.FontConfig;
|
|
31
|
+
/** The color used for the element text. */
|
|
32
|
+
textColor?: PaymentSheetTypes.ThemedColor;
|
|
33
|
+
/** The color used for the text that links to available BNPL plans. */
|
|
34
|
+
linkTextColor?: PaymentSheetTypes.ThemedColor;
|
|
35
|
+
/** The theme of the images displayed by the element. */
|
|
36
|
+
style?: PaymentMethodMessagingElementStyle;
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
/**
|
|
40
|
+
* Configuration object.
|
|
41
|
+
*/
|
|
42
|
+
export interface PaymentMethodMessagingElementConfiguration {
|
|
43
|
+
/** Amount intended to be collected in the smallest currency unit (e.g. 100 cents to charge $1.00). */
|
|
44
|
+
amount: number;
|
|
45
|
+
/** Three-letter ISO currency code, in lowercase. Must be a supported currency. */
|
|
46
|
+
currency: string;
|
|
47
|
+
/**
|
|
48
|
+
* Language code used to localize message displayed in the element.
|
|
49
|
+
* See [the Stripe documentation](https://docs.stripe.com/js/appendix/supported_locales) for a list of
|
|
50
|
+
* supported values. Defaults to the current device locale language.
|
|
51
|
+
* **Note**: Not all device locales are supported by Stripe, and English will be used in the case of
|
|
52
|
+
* an unsupported locale. If you want to ensure a specific locale is used, pass it explicitly.
|
|
53
|
+
*/
|
|
54
|
+
locale?: string;
|
|
55
|
+
/** Two letter country code of the customer's location. If not provided, country will be determined based on IP Address. */
|
|
56
|
+
country?: string;
|
|
57
|
+
/**
|
|
58
|
+
* The payment methods to request messaging for. Supported values are "affirm", "afterpay_clearpay", and "klarna".
|
|
59
|
+
* If null, uses your preferences from the [Stripe dashboard](https://dashboard.stripe.com/settings/payment_methods) to show the relevant payment methods.
|
|
60
|
+
* See [Dynamic payment methods](https://docs.stripe.com/payments/payment-methods/dynamic-payment-methods) for more details.
|
|
61
|
+
*/
|
|
62
|
+
paymentMethodTypes?: Array<string>;
|
|
63
|
+
}
|
|
64
|
+
|
|
65
|
+
export type OnStateChangeEvent = NativeSyntheticEvent<{
|
|
66
|
+
result: PaymentMethodMessagingElementState;
|
|
67
|
+
}>;
|
|
68
|
+
|
|
69
|
+
export interface NativeProps {
|
|
70
|
+
style?: StyleProp<ViewStyle>;
|
|
71
|
+
appearance?: PaymentMethodMessagingElementAppearance;
|
|
72
|
+
configuration: PaymentMethodMessagingElementConfiguration;
|
|
73
|
+
onStateChange(event: OnStateChangeEvent): void;
|
|
74
|
+
}
|
package/src/types/index.ts
CHANGED
|
@@ -12,6 +12,7 @@ import type {
|
|
|
12
12
|
StripeError,
|
|
13
13
|
VerifyMicrodepositsError,
|
|
14
14
|
CollectBankAccountError,
|
|
15
|
+
RadarError,
|
|
15
16
|
} from './Errors';
|
|
16
17
|
import * as ApplePay from './ApplePay';
|
|
17
18
|
import * as PaymentIntent from './PaymentIntent';
|
|
@@ -176,6 +177,16 @@ export type ConfirmPaymentSheetPaymentResult = {
|
|
|
176
177
|
error?: StripeError<PaymentSheetError>;
|
|
177
178
|
};
|
|
178
179
|
|
|
180
|
+
export type CreateRadarSessionResult =
|
|
181
|
+
| {
|
|
182
|
+
id: string;
|
|
183
|
+
error?: undefined;
|
|
184
|
+
}
|
|
185
|
+
| {
|
|
186
|
+
id?: undefined;
|
|
187
|
+
error: StripeError<RadarError>;
|
|
188
|
+
};
|
|
189
|
+
|
|
179
190
|
export type ApplePayResult =
|
|
180
191
|
| {
|
|
181
192
|
paymentMethod: PaymentMethod.Result;
|