@funnelsgrove/payments 0.1.23 → 0.1.25
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/dist/components/shared/SharedStripeCheckoutDialog.d.ts +1 -1
- package/dist/components/shared/SharedStripeCheckoutDialog.js +1 -1
- package/dist/components/shared/SharedStripeCheckoutV2Dialog.d.ts +1 -1
- package/dist/components/shared/SharedStripeCheckoutV2Dialog.js +3 -6
- package/dist/components/shared/StripeCheckoutExpressCheckoutButton.d.ts +3 -2
- package/dist/components/shared/StripeCheckoutExpressCheckoutButton.js +5 -7
- package/dist/components/shared/StripeExpressCheckoutButton.d.ts +1 -1
- package/dist/components/shared/StripeExpressCheckoutButton.js +1 -1
- package/dist/providers/stripe/WalletSubscriptionCheckoutSlot.d.ts +1 -1
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@ export type SharedStripeCheckoutDialogProps = {
|
|
|
21
21
|
onCustomerEmailChange?: (value: string) => void;
|
|
22
22
|
onCustomerEmailCommit?: (email: string) => Promise<string | null | void>;
|
|
23
23
|
onError?: (message: string | null) => void;
|
|
24
|
-
onSuccess?: () => void
|
|
24
|
+
onSuccess?: () => void | Promise<void>;
|
|
25
25
|
paymentMethodLabels?: readonly string[];
|
|
26
26
|
poweredByLabel: string;
|
|
27
27
|
processingLabel: string;
|
|
@@ -210,7 +210,7 @@ function SharedStripeCheckoutForm({ amountCents, clientSecret, closeAriaLabel, c
|
|
|
210
210
|
}
|
|
211
211
|
if (typeof window !== 'undefined' &&
|
|
212
212
|
isSuccessfulIntentStatus((_a = result.paymentIntent) === null || _a === void 0 ? void 0 : _a.status)) {
|
|
213
|
-
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
|
|
213
|
+
await (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess());
|
|
214
214
|
window.location.assign(returnUrl);
|
|
215
215
|
return;
|
|
216
216
|
}
|
|
@@ -22,7 +22,7 @@ export type SharedStripeCheckoutV2DialogProps = {
|
|
|
22
22
|
onCustomerEmailCommit?: (email: string) => Promise<string | null | void>;
|
|
23
23
|
onError?: (message: string | null) => void;
|
|
24
24
|
onInactiveCheckoutSession?: () => void;
|
|
25
|
-
onSuccess?: () => void
|
|
25
|
+
onSuccess?: () => void | Promise<void>;
|
|
26
26
|
paymentMethodLabels?: readonly string[];
|
|
27
27
|
paypalButtonLabel: string;
|
|
28
28
|
paypalLabel: string;
|
|
@@ -217,10 +217,7 @@ function SharedStripeCheckoutV2Form({ amountCents, buttonColor, cardSubmitLabel,
|
|
|
217
217
|
setSubmitting(false);
|
|
218
218
|
return;
|
|
219
219
|
}
|
|
220
|
-
const result = await checkoutState.checkout.confirm({
|
|
221
|
-
email: syncedEmail || undefined,
|
|
222
|
-
redirect: 'if_required',
|
|
223
|
-
});
|
|
220
|
+
const result = await checkoutState.checkout.confirm(Object.assign(Object.assign({}, (customerEmailEditable ? { email: syncedEmail || undefined } : {})), { redirect: 'if_required' }));
|
|
224
221
|
if (result.type === 'error') {
|
|
225
222
|
const message = result.error.message || 'Payment failed.';
|
|
226
223
|
setSharedError(message);
|
|
@@ -228,7 +225,7 @@ function SharedStripeCheckoutV2Form({ amountCents, buttonColor, cardSubmitLabel,
|
|
|
228
225
|
return;
|
|
229
226
|
}
|
|
230
227
|
if (typeof window !== 'undefined') {
|
|
231
|
-
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
|
|
228
|
+
await (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess());
|
|
232
229
|
window.location.assign(returnUrl);
|
|
233
230
|
return;
|
|
234
231
|
}
|
|
@@ -260,7 +257,7 @@ function SharedStripeCheckoutV2Form({ amountCents, buttonColor, cardSubmitLabel,
|
|
|
260
257
|
effectiveSelectedMethod === 'wallet' ? 'is-visible' : '',
|
|
261
258
|
]
|
|
262
259
|
.filter(Boolean)
|
|
263
|
-
.join(' '), children: [_jsxs("p", { className: 'shared-checkout-v2-secure-pill', children: [_jsx(SecurityLockIcon, { className: 'shared-checkout-v2-secure-pill-icon' }), secureLabel] }), _jsxs("div", { className: 'shared-checkout-v2-wallet-shell', "aria-label": walletAriaLabel, children: [_jsx(StripeCheckoutExpressCheckoutButton, { amountCents: amountCents, availabilityPaymentMethods: walletPaymentMethods, beforeConfirm: ensureCustomerEmail, className: 'shared-checkout-v2-express-buttons', customerEmail: resolvedCustomerEmail, customerName: customerName, initialAvailable: initialWalletAvailable, keepInitialAvailableOnReady: initialWalletAvailable === true, onAvailabilityChange: handleWalletAvailabilityChange, onError: setSharedError, onSuccess: onSuccess, options: expressCheckoutOptions, returnUrl: returnUrl, summaryLabel: expressCheckoutSummaryLabel }), _jsx("span", { className: 'shared-checkout-v2-sr-only', children: walletAriaLabel })] })] }), _jsxs("div", { hidden: effectiveSelectedMethod !== 'card', className: [
|
|
260
|
+
.join(' '), children: [_jsxs("p", { className: 'shared-checkout-v2-secure-pill', children: [_jsx(SecurityLockIcon, { className: 'shared-checkout-v2-secure-pill-icon' }), secureLabel] }), _jsxs("div", { className: 'shared-checkout-v2-wallet-shell', "aria-label": walletAriaLabel, children: [_jsx(StripeCheckoutExpressCheckoutButton, { amountCents: amountCents, availabilityPaymentMethods: walletPaymentMethods, beforeConfirm: ensureCustomerEmail, className: 'shared-checkout-v2-express-buttons', confirmEmail: customerEmailEditable, customerEmail: resolvedCustomerEmail, customerName: customerName, initialAvailable: initialWalletAvailable, keepInitialAvailableOnReady: initialWalletAvailable === true, onAvailabilityChange: handleWalletAvailabilityChange, onError: setSharedError, onSuccess: onSuccess, options: expressCheckoutOptions, returnUrl: returnUrl, summaryLabel: expressCheckoutSummaryLabel }), _jsx("span", { className: 'shared-checkout-v2-sr-only', children: walletAriaLabel })] })] }), _jsxs("div", { hidden: effectiveSelectedMethod !== 'card', className: [
|
|
264
261
|
'shared-checkout-v2-card-panel',
|
|
265
262
|
effectiveSelectedMethod === 'card' ? 'is-visible' : '',
|
|
266
263
|
]
|
|
@@ -4,6 +4,7 @@ export type StripeCheckoutExpressCheckoutButtonProps = {
|
|
|
4
4
|
beforeConfirm?: () => Promise<string | null>;
|
|
5
5
|
summaryLabel: string;
|
|
6
6
|
returnUrl: string;
|
|
7
|
+
confirmEmail?: boolean;
|
|
7
8
|
customerEmail?: string | null;
|
|
8
9
|
customerName?: string | null;
|
|
9
10
|
className?: string;
|
|
@@ -15,6 +16,6 @@ export type StripeCheckoutExpressCheckoutButtonProps = {
|
|
|
15
16
|
onServerUpdate?: () => Promise<boolean>;
|
|
16
17
|
onAvailabilityChange?: (available: boolean) => void;
|
|
17
18
|
onError?: (message: string | null) => void;
|
|
18
|
-
onSuccess?: () => void
|
|
19
|
+
onSuccess?: () => void | Promise<void>;
|
|
19
20
|
};
|
|
20
|
-
export declare function StripeCheckoutExpressCheckoutButton({ beforeConfirm, returnUrl, customerEmail, className, options, availabilityPaymentMethods, initialAvailable, keepInitialAvailableOnReady, serverUpdateKey, onServerUpdate, onAvailabilityChange, onError, onSuccess, }: StripeCheckoutExpressCheckoutButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
21
|
+
export declare function StripeCheckoutExpressCheckoutButton({ beforeConfirm, returnUrl, confirmEmail, customerEmail, className, options, availabilityPaymentMethods, initialAvailable, keepInitialAvailableOnReady, serverUpdateKey, onServerUpdate, onAvailabilityChange, onError, onSuccess, }: StripeCheckoutExpressCheckoutButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -25,7 +25,7 @@ const buildDefaultOptions = () => ({
|
|
|
25
25
|
paypal: 'never',
|
|
26
26
|
},
|
|
27
27
|
});
|
|
28
|
-
export function StripeCheckoutExpressCheckoutButton({ beforeConfirm, returnUrl, customerEmail, className, options, availabilityPaymentMethods = ['applePay'], initialAvailable, keepInitialAvailableOnReady = false, serverUpdateKey, onServerUpdate, onAvailabilityChange, onError, onSuccess, }) {
|
|
28
|
+
export function StripeCheckoutExpressCheckoutButton({ beforeConfirm, returnUrl, confirmEmail = true, customerEmail, className, options, availabilityPaymentMethods = ['applePay'], initialAvailable, keepInitialAvailableOnReady = false, serverUpdateKey, onServerUpdate, onAvailabilityChange, onError, onSuccess, }) {
|
|
29
29
|
const checkoutState = useCheckout();
|
|
30
30
|
const appliedServerUpdateKeyRef = useRef('');
|
|
31
31
|
const serverUpdatePromiseRef = useRef(null);
|
|
@@ -122,11 +122,9 @@ export function StripeCheckoutExpressCheckoutButton({ beforeConfirm, returnUrl,
|
|
|
122
122
|
event.paymentFailed({ reason: 'invalid_payment_data', message });
|
|
123
123
|
return;
|
|
124
124
|
}
|
|
125
|
-
const result = await checkoutState.checkout.confirm({
|
|
126
|
-
email: preparedCustomerEmail || (customerEmail === null || customerEmail === void 0 ? void 0 : customerEmail.trim()) || undefined
|
|
127
|
-
expressCheckoutConfirmEvent: event,
|
|
128
|
-
redirect: 'if_required',
|
|
129
|
-
});
|
|
125
|
+
const result = await checkoutState.checkout.confirm(Object.assign(Object.assign({}, (confirmEmail
|
|
126
|
+
? { email: preparedCustomerEmail || (customerEmail === null || customerEmail === void 0 ? void 0 : customerEmail.trim()) || undefined }
|
|
127
|
+
: {})), { expressCheckoutConfirmEvent: event, redirect: 'if_required' }));
|
|
130
128
|
if (result.type === 'error') {
|
|
131
129
|
const message = result.error.message || 'Wallet checkout failed.';
|
|
132
130
|
onError === null || onError === void 0 ? void 0 : onError(message);
|
|
@@ -135,7 +133,7 @@ export function StripeCheckoutExpressCheckoutButton({ beforeConfirm, returnUrl,
|
|
|
135
133
|
}
|
|
136
134
|
onError === null || onError === void 0 ? void 0 : onError(null);
|
|
137
135
|
if (typeof window !== 'undefined') {
|
|
138
|
-
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
|
|
136
|
+
await (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess());
|
|
139
137
|
window.location.assign(returnUrl);
|
|
140
138
|
}
|
|
141
139
|
};
|
|
@@ -13,6 +13,6 @@ export type StripeExpressCheckoutButtonProps = {
|
|
|
13
13
|
keepInitialAvailableOnReady?: boolean;
|
|
14
14
|
onAvailabilityChange?: (available: boolean) => void;
|
|
15
15
|
onError?: (message: string | null) => void;
|
|
16
|
-
onSuccess?: () => void
|
|
16
|
+
onSuccess?: () => void | Promise<void>;
|
|
17
17
|
};
|
|
18
18
|
export declare function StripeExpressCheckoutButton({ amountCents, beforeConfirm, summaryLabel, returnUrl, customerEmail, customerName, className, options, availabilityPaymentMethods, initialAvailable, keepInitialAvailableOnReady, onAvailabilityChange, onError, onSuccess, }: StripeExpressCheckoutButtonProps): import("react/jsx-runtime").JSX.Element;
|
|
@@ -129,7 +129,7 @@ export function StripeExpressCheckoutButton({ amountCents, beforeConfirm, summar
|
|
|
129
129
|
onError === null || onError === void 0 ? void 0 : onError(null);
|
|
130
130
|
if (typeof window !== 'undefined' &&
|
|
131
131
|
isSuccessfulIntentStatus((_a = result.paymentIntent) === null || _a === void 0 ? void 0 : _a.status)) {
|
|
132
|
-
onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess();
|
|
132
|
+
await (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess());
|
|
133
133
|
window.location.assign(returnUrl);
|
|
134
134
|
}
|
|
135
135
|
};
|
|
@@ -18,7 +18,7 @@ export type WalletSubscriptionCheckoutSlotProps = {
|
|
|
18
18
|
expressCheckoutAllowed?: boolean;
|
|
19
19
|
onAvailabilityChange?: (available: boolean) => void;
|
|
20
20
|
onError?: (message: string | null) => void;
|
|
21
|
-
onSuccess?: () => void
|
|
21
|
+
onSuccess?: () => void | Promise<void>;
|
|
22
22
|
onUnavailableClick?: () => Promise<void> | void;
|
|
23
23
|
options?: Partial<StripeCheckoutExpressCheckoutElementOptions>;
|
|
24
24
|
placeholderLabel: string;
|