@funnelsgrove/payments 0.1.24 → 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.
|
@@ -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);
|
|
@@ -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;
|
|
@@ -17,4 +18,4 @@ export type StripeCheckoutExpressCheckoutButtonProps = {
|
|
|
17
18
|
onError?: (message: string | null) => void;
|
|
18
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);
|