@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
|
@@ -0,0 +1,69 @@
|
|
|
1
|
+
import { NativeSyntheticEvent, StyleProp, ViewStyle } from 'react-native';
|
|
2
|
+
import * as PaymentSheetTypes from '../PaymentSheet';
|
|
3
|
+
/**
|
|
4
|
+
* The current state of the PaymentMethodMessagingElement view. Typically loading, succeeded, no_content, or failed.
|
|
5
|
+
*/
|
|
6
|
+
export type PaymentMethodMessagingElementState = {
|
|
7
|
+
status: 'loading';
|
|
8
|
+
} | {
|
|
9
|
+
status: 'loaded';
|
|
10
|
+
} | {
|
|
11
|
+
status: 'no_content';
|
|
12
|
+
} | {
|
|
13
|
+
status: 'failed';
|
|
14
|
+
error: Error;
|
|
15
|
+
};
|
|
16
|
+
/** Style for the images displayed by the element. */
|
|
17
|
+
export declare enum PaymentMethodMessagingElementStyle {
|
|
18
|
+
/** A flat style */
|
|
19
|
+
Flat = "flat",
|
|
20
|
+
/** A dark style */
|
|
21
|
+
Dark = "dark",
|
|
22
|
+
/** A light style */
|
|
23
|
+
Light = "light"
|
|
24
|
+
}
|
|
25
|
+
export interface PaymentMethodMessagingElementAppearance {
|
|
26
|
+
/** Font settings for the element. */
|
|
27
|
+
font?: PaymentSheetTypes.FontConfig;
|
|
28
|
+
/** The color used for the element text. */
|
|
29
|
+
textColor?: PaymentSheetTypes.ThemedColor;
|
|
30
|
+
/** The color used for the text that links to available BNPL plans. */
|
|
31
|
+
linkTextColor?: PaymentSheetTypes.ThemedColor;
|
|
32
|
+
/** The theme of the images displayed by the element. */
|
|
33
|
+
style?: PaymentMethodMessagingElementStyle;
|
|
34
|
+
}
|
|
35
|
+
/**
|
|
36
|
+
* Configuration object.
|
|
37
|
+
*/
|
|
38
|
+
export interface PaymentMethodMessagingElementConfiguration {
|
|
39
|
+
/** Amount intended to be collected in the smallest currency unit (e.g. 100 cents to charge $1.00). */
|
|
40
|
+
amount: number;
|
|
41
|
+
/** Three-letter ISO currency code, in lowercase. Must be a supported currency. */
|
|
42
|
+
currency: string;
|
|
43
|
+
/**
|
|
44
|
+
* Language code used to localize message displayed in the element.
|
|
45
|
+
* See [the Stripe documentation](https://docs.stripe.com/js/appendix/supported_locales) for a list of
|
|
46
|
+
* supported values. Defaults to the current device locale language.
|
|
47
|
+
* **Note**: Not all device locales are supported by Stripe, and English will be used in the case of
|
|
48
|
+
* an unsupported locale. If you want to ensure a specific locale is used, pass it explicitly.
|
|
49
|
+
*/
|
|
50
|
+
locale?: string;
|
|
51
|
+
/** Two letter country code of the customer's location. If not provided, country will be determined based on IP Address. */
|
|
52
|
+
country?: string;
|
|
53
|
+
/**
|
|
54
|
+
* The payment methods to request messaging for. Supported values are "affirm", "afterpay_clearpay", and "klarna".
|
|
55
|
+
* If null, uses your preferences from the [Stripe dashboard](https://dashboard.stripe.com/settings/payment_methods) to show the relevant payment methods.
|
|
56
|
+
* See [Dynamic payment methods](https://docs.stripe.com/payments/payment-methods/dynamic-payment-methods) for more details.
|
|
57
|
+
*/
|
|
58
|
+
paymentMethodTypes?: Array<string>;
|
|
59
|
+
}
|
|
60
|
+
export type OnStateChangeEvent = NativeSyntheticEvent<{
|
|
61
|
+
result: PaymentMethodMessagingElementState;
|
|
62
|
+
}>;
|
|
63
|
+
export interface NativeProps {
|
|
64
|
+
style?: StyleProp<ViewStyle>;
|
|
65
|
+
appearance?: PaymentMethodMessagingElementAppearance;
|
|
66
|
+
configuration: PaymentMethodMessagingElementConfiguration;
|
|
67
|
+
onStateChange(event: OnStateChangeEvent): void;
|
|
68
|
+
}
|
|
69
|
+
//# sourceMappingURL=PaymentMethodMessagingElementComponent.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"PaymentMethodMessagingElementComponent.d.ts","sourceRoot":"","sources":["../../../../../src/types/components/PaymentMethodMessagingElementComponent.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,oBAAoB,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,cAAc,CAAC;AAE1E,OAAO,KAAK,iBAAiB,MAAM,iBAAiB,CAAC;AAMrD;;GAEG;AACH,MAAM,MAAM,kCAAkC,GAC1C;IAAE,MAAM,EAAE,SAAS,CAAA;CAAE,GACrB;IAAE,MAAM,EAAE,QAAQ,CAAA;CAAE,GACpB;IAAE,MAAM,EAAE,YAAY,CAAA;CAAE,GACxB;IAAE,MAAM,EAAE,QAAQ,CAAC;IAAC,KAAK,EAAE,KAAK,CAAA;CAAE,CAAC;AAEvC,qDAAqD;AACrD,oBAAY,kCAAkC;IAC5C,mBAAmB;IACnB,IAAI,SAAS;IACb,mBAAmB;IACnB,IAAI,SAAS;IACb,oBAAoB;IACpB,KAAK,UAAU;CAChB;AAED,MAAM,WAAW,uCAAuC;IACtD,qCAAqC;IACrC,IAAI,CAAC,EAAE,iBAAiB,CAAC,UAAU,CAAC;IACpC,2CAA2C;IAC3C,SAAS,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC;IAC1C,sEAAsE;IACtE,aAAa,CAAC,EAAE,iBAAiB,CAAC,WAAW,CAAC;IAC9C,wDAAwD;IACxD,KAAK,CAAC,EAAE,kCAAkC,CAAC;CAC5C;AAED;;GAEG;AACH,MAAM,WAAW,0CAA0C;IACzD,sGAAsG;IACtG,MAAM,EAAE,MAAM,CAAC;IACf,kFAAkF;IAClF,QAAQ,EAAE,MAAM,CAAC;IACjB;;;;;;OAMG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,2HAA2H;IAC3H,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;;OAIG;IACH,kBAAkB,CAAC,EAAE,KAAK,CAAC,MAAM,CAAC,CAAC;CACpC;AAED,MAAM,MAAM,kBAAkB,GAAG,oBAAoB,CAAC;IACpD,MAAM,EAAE,kCAAkC,CAAC;CAC5C,CAAC,CAAC;AAEH,MAAM,WAAW,WAAW;IAC1B,KAAK,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;IAC7B,UAAU,CAAC,EAAE,uCAAuC,CAAC;IACrD,aAAa,EAAE,0CAA0C,CAAC;IAC1D,aAAa,CAAC,KAAK,EAAE,kBAAkB,GAAG,IAAI,CAAC;CAChD"}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { ApplePayError, CardActionError, ConfirmPaymentError, ConfirmSetupIntentError, CreatePaymentMethodError, CreateTokenError, GooglePayError, PaymentSheetError, RetrievePaymentIntentError, RetrieveSetupIntentError, StripeError, VerifyMicrodepositsError, CollectBankAccountError } from './Errors';
|
|
1
|
+
import type { ApplePayError, CardActionError, ConfirmPaymentError, ConfirmSetupIntentError, CreatePaymentMethodError, CreateTokenError, GooglePayError, PaymentSheetError, RetrievePaymentIntentError, RetrieveSetupIntentError, StripeError, VerifyMicrodepositsError, CollectBankAccountError, RadarError } from './Errors';
|
|
2
2
|
import * as ApplePay from './ApplePay';
|
|
3
3
|
import * as PaymentIntent from './PaymentIntent';
|
|
4
4
|
import * as PaymentMethod from './PaymentMethod';
|
|
@@ -110,6 +110,13 @@ export type CreateTokenResult = {
|
|
|
110
110
|
export type ConfirmPaymentSheetPaymentResult = {
|
|
111
111
|
error?: StripeError<PaymentSheetError>;
|
|
112
112
|
};
|
|
113
|
+
export type CreateRadarSessionResult = {
|
|
114
|
+
id: string;
|
|
115
|
+
error?: undefined;
|
|
116
|
+
} | {
|
|
117
|
+
id?: undefined;
|
|
118
|
+
error: StripeError<RadarError>;
|
|
119
|
+
};
|
|
113
120
|
export type ApplePayResult = {
|
|
114
121
|
paymentMethod: PaymentMethod.Result;
|
|
115
122
|
error?: undefined;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,0BAA0B,EAC1B,wBAAwB,EACxB,WAAW,EACX,wBAAwB,EACxB,uBAAuB,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../../src/types/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,aAAa,EACb,eAAe,EACf,mBAAmB,EACnB,uBAAuB,EACvB,wBAAwB,EACxB,gBAAgB,EAChB,cAAc,EACd,iBAAiB,EACjB,0BAA0B,EAC1B,wBAAwB,EACxB,WAAW,EACX,wBAAwB,EACxB,uBAAuB,EACvB,UAAU,EACX,MAAM,UAAU,CAAC;AAClB,OAAO,KAAK,QAAQ,MAAM,YAAY,CAAC;AACvC,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,aAAa,MAAM,iBAAiB,CAAC;AACjD,OAAO,KAAK,YAAY,MAAM,gBAAgB,CAAC;AAC/C,OAAO,KAAK,WAAW,MAA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MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC;IACd,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
|
package/package.json
CHANGED
|
@@ -24,6 +24,39 @@ import { useConnectComponents } from './ConnectComponentsProvider';
|
|
|
24
24
|
export { NavigationBar } from './NavigationBar';
|
|
25
25
|
export type { NavigationBarProps } from './NavigationBar';
|
|
26
26
|
|
|
27
|
+
/**
|
|
28
|
+
* A full-screen modal component for Connect account onboarding.
|
|
29
|
+
* Guides connected accounts through the process of providing required information.
|
|
30
|
+
*
|
|
31
|
+
* **Platform differences:**
|
|
32
|
+
* - iOS: Uses native modal with UIKit navigation bar
|
|
33
|
+
* - Android: Uses React Native Modal with custom navigation bar
|
|
34
|
+
*
|
|
35
|
+
* @param props.title - Optional title displayed in navigation bar
|
|
36
|
+
* @param props.onExit - Required callback when user closes the onboarding flow
|
|
37
|
+
* @param props.onStepChange - Optional callback fired when onboarding step changes
|
|
38
|
+
* @param props.recipientTermsOfServiceUrl - URL for recipient terms of service
|
|
39
|
+
* @param props.fullTermsOfServiceUrl - URL for full terms of service
|
|
40
|
+
* @param props.privacyPolicyUrl - URL for privacy policy
|
|
41
|
+
* @param props.collectionOptions - Configuration for which account fields to collect
|
|
42
|
+
* @param props.onLoaderStart - Callback when component begins loading
|
|
43
|
+
* @param props.onLoadError - Callback when component fails to load
|
|
44
|
+
* @param props.onPageDidLoad - Callback when component finishes loading
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```tsx
|
|
48
|
+
* <ConnectAccountOnboarding
|
|
49
|
+
* title="Complete your account setup"
|
|
50
|
+
* onExit={() => navigation.goBack()}
|
|
51
|
+
* onStepChange={({ step }) => console.log('Current step:', step)}
|
|
52
|
+
* collectionOptions={{
|
|
53
|
+
* fields: 'currently_due',
|
|
54
|
+
* futureRequirements: 'include'
|
|
55
|
+
* }}
|
|
56
|
+
* />
|
|
57
|
+
* ```
|
|
58
|
+
* @category Connect
|
|
59
|
+
*/
|
|
27
60
|
export function ConnectAccountOnboarding({
|
|
28
61
|
title,
|
|
29
62
|
onExit,
|
|
@@ -178,6 +211,28 @@ export function ConnectAccountOnboarding({
|
|
|
178
211
|
);
|
|
179
212
|
}
|
|
180
213
|
|
|
214
|
+
/**
|
|
215
|
+
* Displays a list of payments for the connected account with optional filtering.
|
|
216
|
+
* Embed this component to show payment history and details.
|
|
217
|
+
*
|
|
218
|
+
* @param props.defaultFilters - Optional filters to apply to the payments list
|
|
219
|
+
* @param props.onLoaderStart - Callback when component begins loading
|
|
220
|
+
* @param props.onLoadError - Callback when component fails to load
|
|
221
|
+
* @param props.onPageDidLoad - Callback when component finishes loading
|
|
222
|
+
* @param props.style - Optional styling for the component container
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* ```tsx
|
|
226
|
+
* <ConnectPayments
|
|
227
|
+
* defaultFilters={{
|
|
228
|
+
* status: ['successful', 'pending'],
|
|
229
|
+
* date: { after: new Date('2024-01-01') }
|
|
230
|
+
* }}
|
|
231
|
+
* style={{ flex: 1 }}
|
|
232
|
+
* />
|
|
233
|
+
* ```
|
|
234
|
+
* @category Connect
|
|
235
|
+
*/
|
|
181
236
|
export function ConnectPayments({
|
|
182
237
|
defaultFilters,
|
|
183
238
|
onLoaderStart,
|
|
@@ -205,6 +260,21 @@ export function ConnectPayments({
|
|
|
205
260
|
);
|
|
206
261
|
}
|
|
207
262
|
|
|
263
|
+
/**
|
|
264
|
+
* Displays payout information for the connected account.
|
|
265
|
+
* Shows payout history, schedules, and details.
|
|
266
|
+
*
|
|
267
|
+
* @param props.onLoaderStart - Callback when component begins loading
|
|
268
|
+
* @param props.onLoadError - Callback when component fails to load
|
|
269
|
+
* @param props.onPageDidLoad - Callback when component finishes loading
|
|
270
|
+
* @param props.style - Optional styling for the component container
|
|
271
|
+
*
|
|
272
|
+
* @example
|
|
273
|
+
* ```tsx
|
|
274
|
+
* <ConnectPayouts style={{ flex: 1 }} />
|
|
275
|
+
* ```
|
|
276
|
+
* @category Connect
|
|
277
|
+
*/
|
|
208
278
|
export function ConnectPayouts({
|
|
209
279
|
onLoaderStart,
|
|
210
280
|
onLoadError,
|
|
@@ -222,6 +292,27 @@ export function ConnectPayouts({
|
|
|
222
292
|
);
|
|
223
293
|
}
|
|
224
294
|
|
|
295
|
+
/**
|
|
296
|
+
* Displays detailed information for a specific payment.
|
|
297
|
+
* Typically used in a modal or detail view after selecting a payment from ConnectPayments.
|
|
298
|
+
*
|
|
299
|
+
* @param props.payment - The payment ID to display details for
|
|
300
|
+
* @param props.onClose - Required callback when user closes the detail view
|
|
301
|
+
* @param props.onLoaderStart - Callback when component begins loading
|
|
302
|
+
* @param props.onLoadError - Callback when component fails to load
|
|
303
|
+
* @param props.onPageDidLoad - Callback when component finishes loading
|
|
304
|
+
* @param props.style - Optional styling for the component container
|
|
305
|
+
*
|
|
306
|
+
* @example
|
|
307
|
+
* ```tsx
|
|
308
|
+
* <ConnectPaymentDetails
|
|
309
|
+
* payment="py_1234567890"
|
|
310
|
+
* onClose={() => setShowDetails(false)}
|
|
311
|
+
* style={{ flex: 1 }}
|
|
312
|
+
* />
|
|
313
|
+
* ```
|
|
314
|
+
* @category Connect
|
|
315
|
+
*/
|
|
225
316
|
export function ConnectPaymentDetails({
|
|
226
317
|
payment,
|
|
227
318
|
onClose,
|
|
@@ -5,6 +5,8 @@ import type {
|
|
|
5
5
|
LoadConnectAndInitialize,
|
|
6
6
|
StripeConnectInstance,
|
|
7
7
|
} from './connectTypes';
|
|
8
|
+
import { AnalyticsClient } from './analytics/AnalyticsClient';
|
|
9
|
+
import { Constants } from '../functions';
|
|
8
10
|
|
|
9
11
|
class ConnectInstance implements StripeConnectInstance {
|
|
10
12
|
initParams: StripeConnectInitParams;
|
|
@@ -19,6 +21,29 @@ class ConnectInstance implements StripeConnectInstance {
|
|
|
19
21
|
}
|
|
20
22
|
}
|
|
21
23
|
|
|
24
|
+
/**
|
|
25
|
+
* Creates a Connect instance for use with ConnectComponentsProvider.
|
|
26
|
+
* This instance manages the configuration and state for Connect embedded components.
|
|
27
|
+
*
|
|
28
|
+
* @param initParams - Initialization parameters including publishableKey and fetchClientSecret
|
|
29
|
+
* @returns A StripeConnectInstance that can be passed to ConnectComponentsProvider
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* ```ts
|
|
33
|
+
* const connectInstance = loadConnectAndInitialize({
|
|
34
|
+
* publishableKey: 'pk_test_123',
|
|
35
|
+
* fetchClientSecret: async () => {
|
|
36
|
+
* const response = await fetch('/account_session');
|
|
37
|
+
* const { client_secret } = await response.json();
|
|
38
|
+
* return client_secret;
|
|
39
|
+
* },
|
|
40
|
+
* appearance: {
|
|
41
|
+
* variables: { colorPrimary: '#635BFF' }
|
|
42
|
+
* }
|
|
43
|
+
* });
|
|
44
|
+
* ```
|
|
45
|
+
* @category Connect
|
|
46
|
+
*/
|
|
22
47
|
export const loadConnectAndInitialize: LoadConnectAndInitialize = (
|
|
23
48
|
initParams: StripeConnectInitParams
|
|
24
49
|
): StripeConnectInstance => {
|
|
@@ -34,6 +59,7 @@ export type ConnectComponentsPayload = {
|
|
|
34
59
|
appearance: StripeConnectInitParams['appearance'];
|
|
35
60
|
locale: StripeConnectInitParams['locale'];
|
|
36
61
|
connectInstance: ConnectInstance;
|
|
62
|
+
analyticsClient: AnalyticsClient;
|
|
37
63
|
};
|
|
38
64
|
|
|
39
65
|
const ConnectComponentsContext =
|
|
@@ -41,6 +67,42 @@ const ConnectComponentsContext =
|
|
|
41
67
|
|
|
42
68
|
ConnectComponentsContext.displayName = 'ConnectComponents';
|
|
43
69
|
|
|
70
|
+
/**
|
|
71
|
+
* Context provider that makes Connect instance configuration available to embedded components.
|
|
72
|
+
* Wrap your Connect components with this provider to enable them to access the shared configuration.
|
|
73
|
+
*
|
|
74
|
+
* @param props.connectInstance - Instance created via loadConnectAndInitialize
|
|
75
|
+
* @param props.children - React components to render within the provider
|
|
76
|
+
* @returns JSX.Element
|
|
77
|
+
*
|
|
78
|
+
* @throws Error if connectInstance is not created via loadConnectAndInitialize
|
|
79
|
+
*
|
|
80
|
+
* @example
|
|
81
|
+
* ```tsx
|
|
82
|
+
* function App() {
|
|
83
|
+
* const [connectInstance] = useState(() => {
|
|
84
|
+
* const fetchClientSecret = async () => {
|
|
85
|
+
* const response = await fetch('/account_session', { method: "POST" });
|
|
86
|
+
* const { client_secret: clientSecret } = await response.json();
|
|
87
|
+
* return clientSecret;
|
|
88
|
+
* };
|
|
89
|
+
*
|
|
90
|
+
* return loadConnectAndInitialize({
|
|
91
|
+
* publishableKey: 'pk_test_123',
|
|
92
|
+
* fetchClientSecret: fetchClientSecret,
|
|
93
|
+
* appearance,
|
|
94
|
+
* });
|
|
95
|
+
* });
|
|
96
|
+
*
|
|
97
|
+
* return (
|
|
98
|
+
* <ConnectComponentsProvider connectInstance={connectInstance}>
|
|
99
|
+
* <ConnectPayouts />
|
|
100
|
+
* </ConnectComponentsProvider>
|
|
101
|
+
* );
|
|
102
|
+
* }
|
|
103
|
+
* ```
|
|
104
|
+
* @category Connect
|
|
105
|
+
*/
|
|
44
106
|
export const ConnectComponentsProvider = ({
|
|
45
107
|
children,
|
|
46
108
|
connectInstance,
|
|
@@ -59,6 +121,11 @@ export const ConnectComponentsProvider = ({
|
|
|
59
121
|
connectInstance.initParams.locale
|
|
60
122
|
);
|
|
61
123
|
|
|
124
|
+
// Initialize analytics client with native system info
|
|
125
|
+
const analyticsClient = useMemo(() => {
|
|
126
|
+
return new AnalyticsClient(Constants.SYSTEM_INFO);
|
|
127
|
+
}, []);
|
|
128
|
+
|
|
62
129
|
if (!connectInstance.onUpdate) {
|
|
63
130
|
connectInstance.onUpdate = (options: StripeConnectUpdateParams) => {
|
|
64
131
|
if (options.appearance) {
|
|
@@ -71,8 +138,8 @@ export const ConnectComponentsProvider = ({
|
|
|
71
138
|
}
|
|
72
139
|
|
|
73
140
|
const value = useMemo(
|
|
74
|
-
() => ({ connectInstance, locale, appearance }),
|
|
75
|
-
[connectInstance, locale, appearance]
|
|
141
|
+
() => ({ connectInstance, locale, appearance, analyticsClient }),
|
|
142
|
+
[connectInstance, locale, appearance, analyticsClient]
|
|
76
143
|
);
|
|
77
144
|
|
|
78
145
|
return (
|