@funnelsgrove/payments 0.66.0 → 0.68.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/README.md +27 -5
- package/dist/generated/package-version.d.ts +1 -1
- package/dist/generated/package-version.js +1 -1
- package/dist/providers/solidgate/components/SolidgateCheckoutDialog.js +5 -1
- package/dist/providers/solidgate/services/solidgateDeclineMessage.js +1 -1
- package/dist/providers/stripe/components/StripeWalletFirstCheckout.d.ts +27 -2
- package/dist/providers/stripe/components/StripeWalletFirstCheckout.js +205 -100
- package/dist/providers/stripe/components/StripeWalletFirstCheckout.options.d.ts +16 -0
- package/dist/providers/stripe/components/StripeWalletFirstCheckout.options.js +19 -0
- package/dist/providers/stripe/components/StripeWalletFirstCheckout.styles.d.ts +3 -1
- package/dist/providers/stripe/components/StripeWalletFirstCheckout.styles.js +13 -8
- package/dist/providers/stripe/components/WalletButton.d.ts +20 -0
- package/dist/providers/stripe/components/WalletButton.js +52 -0
- package/dist/providers/stripe/components/index.d.ts +1 -0
- package/dist/providers/stripe/components/index.js +1 -0
- package/dist/providers/stripe/hooks/useStripeOneTimeCheckoutSession.d.ts +10 -3
- package/dist/providers/stripe/hooks/useStripeOneTimeCheckoutSession.js +18 -8
- package/dist/providers/stripe/hooks/useStripeSubscriptionCheckoutSession.d.ts +10 -3
- package/dist/providers/stripe/hooks/useStripeSubscriptionCheckoutSession.js +19 -8
- package/dist/providers/stripe/services/checkout/requests.d.ts +8 -4
- package/dist/providers/stripe/services/checkout/requests.js +6 -6
- package/dist/providers/stripe/services/checkout/types.d.ts +9 -0
- package/dist/providers/stripe/services/checkoutCompletionAnalytics.service.d.ts +1 -1
- package/dist/providers/stripe/services/oneClick/completePayment.js +4 -1
- package/dist/providers/stripe/services/oneClick/confirmation.js +8 -5
- package/dist/providers/stripe/services/oneClick/types.d.ts +2 -0
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -28,9 +28,10 @@ Use these for new subscription paywalls:
|
|
|
28
28
|
- `trackPaidStripeSubscriptionCheckoutCompleted`
|
|
29
29
|
- `trackStripeSubscriptionPaymentInfoSubmitted`
|
|
30
30
|
|
|
31
|
-
For an inline subscription form with the device wallet first and card
|
|
32
|
-
`StripeWalletFirstCheckout`. It shows one
|
|
33
|
-
elsewhere, preselected, with Stripe's own button
|
|
31
|
+
For an inline subscription form with the device wallet first and card last, use
|
|
32
|
+
`StripeWalletFirstCheckout`. It shows one block per payment method: one wallet, Google Pay
|
|
33
|
+
on Android and Apple Pay elsewhere, preselected, with Stripe's own button; every other
|
|
34
|
+
method the offer supports (Pix, Klarna, …) as one block; and the card form.
|
|
34
35
|
|
|
35
36
|
- Pass the card hook's `clientSecret`, `checkoutSessionId` and `stripePromise`. While the
|
|
36
37
|
Checkout Session is being created, pass `clientSecret={null}`: the full layout renders
|
|
@@ -58,9 +59,30 @@ elsewhere, preselected, with Stripe's own button, and the card form as the secon
|
|
|
58
59
|
- Where the browser cannot pay with that wallet, the wallet stays first and its slot shows
|
|
59
60
|
`walletUnavailableNote` (`{wallet}` is replaced with the wallet name). The card remains
|
|
60
61
|
one tap away. This is deliberate: the layout must not move.
|
|
62
|
+
- Other methods follow [CHECKOUT-BR-010](../../docs/product-specs/stripe-integration.md#checkout-br-010-additional-stripe-payment-methods):
|
|
63
|
+
create the card session with `paymentMethodTypes: ['card']` so its form never shows another
|
|
64
|
+
method, and pass the hook's `availablePaymentMethodTypes` and the same hook input as
|
|
65
|
+
`methodSessionInput` (its `onError`, `onReset` and `onPreparationStart` are not used; each
|
|
66
|
+
block shows its own session error). Each other block then owns a Checkout Session restricted
|
|
67
|
+
to its methods, created with its own idempotency key when the block is selected (at once when
|
|
68
|
+
it is the `initialMethod`, as soon as the card session has reported the offer's methods), and
|
|
69
|
+
renders Stripe's Payment Element for that session, which collects what the method needs, e.g.
|
|
70
|
+
the CPF for Pix. Without extras, without `methodSessionInput`, or when the card session itself
|
|
71
|
+
offers other methods (they would repeat), nothing changes. Once any block confirmed a payment
|
|
72
|
+
the other blocks stay disabled, so one visitor cannot pay twice across sessions. `methods`
|
|
73
|
+
sets the blocks and their order; the default is `['wallet', 'other', 'card']`. A method
|
|
74
|
+
named in it, e.g. `['wallet', 'pix', 'card']`, gets its own block; unnamed extras share the
|
|
75
|
+
`'other'` block when it is listed, else they are not offered. `initialMethod` may name any
|
|
76
|
+
block, including `'other'` or a method inside it. `copy.methodLabels` names the methods
|
|
77
|
+
(`{ pix: 'Pix' }`); a missing type shows its capitalized name.
|
|
78
|
+
- `WalletButton` is the wallet block's slot on its own: progress bar at the button's height,
|
|
79
|
+
then Stripe's Apple Pay or Google Pay button, or the unavailable note. Inside an existing
|
|
80
|
+
`CheckoutProvider` omit `session`; for a standalone placement pass
|
|
81
|
+
`session={{ clientSecret, stripePromise, themeColor }}` and it owns that session's scope.
|
|
61
82
|
- The component owns `checkout_shown` (once per mount, `checkout_surface: inline`),
|
|
62
|
-
`checkout_started` (when the card form opens, or on wallet intent),
|
|
63
|
-
`add_payment_info` and verified `checkout_completed`.
|
|
83
|
+
`checkout_started` (when the card or another method's form opens, or on wallet intent),
|
|
84
|
+
`add_payment_info` and verified `checkout_completed`. Another method's session is created
|
|
85
|
+
with `checkoutStartSource: 'checkout_render'`, so creating it is not a start.
|
|
64
86
|
- After confirmation, the payment status stays in the form until the caller replaces it.
|
|
65
87
|
With the runtime's embedded completion, the success screen takes over. Otherwise
|
|
66
88
|
`onSuccess` runs, and then the page navigates to `returnUrl`.
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PAYMENTS_PACKAGE_VERSION = "0.
|
|
1
|
+
export declare const PAYMENTS_PACKAGE_VERSION = "0.68.0";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Generated by scripts/generate-package-version.mjs.
|
|
2
|
-
export const PAYMENTS_PACKAGE_VERSION = "0.
|
|
2
|
+
export const PAYMENTS_PACKAGE_VERSION = "0.68.0";
|
|
@@ -306,10 +306,14 @@ export function SolidgateCheckoutDialog({ open, layout = 'dialog', visible = tru
|
|
|
306
306
|
trackFailure(copyRef.current.expired, 'payment_expired', checkout.attemptId);
|
|
307
307
|
}
|
|
308
308
|
else if (result.status === 'failed') {
|
|
309
|
+
// Solidgate may report one result more than once; count each declined attempt once.
|
|
310
|
+
const alreadyReported = declinedAttemptRef.current === checkout.attemptId;
|
|
309
311
|
declinedAttemptRef.current = checkout.attemptId;
|
|
310
312
|
const failureMessage = solidgateDeclineMessage(result.failureCode);
|
|
311
313
|
setState({ state: 'recoverable_error', checkout, canResumeVerification: false, failureMessage });
|
|
312
|
-
|
|
314
|
+
if (!alreadyReported) {
|
|
315
|
+
trackFailure(failureMessage, 'payment_failed', checkout.attemptId, Object.assign(Object.assign({}, (isSolidgateCustomerDecline(result.failureCode) ? { providerDeclineCode: result.failureCode } : {})), { providerErrorCode: result.failureCode }));
|
|
316
|
+
}
|
|
313
317
|
(_c = onErrorRef.current) === null || _c === void 0 ? void 0 : _c.call(onErrorRef, failureMessage);
|
|
314
318
|
}
|
|
315
319
|
else if (result.status === 'requires_payment' && !challengeActive) {
|
|
@@ -25,7 +25,7 @@ export const solidgateDeclineMessage = (code) => ((code && Object.hasOwn(message
|
|
|
25
25
|
// Issuer, card-data and bank-verification refusals; other codes stay platform failures.
|
|
26
26
|
const customerDeclineCodes = new Set([
|
|
27
27
|
'2.04', '2.06', '2.08', '2.09', '2.15',
|
|
28
|
-
'3.01', '3.02', '3.03', '3.04', '3.05', '3.06', '3.07', '3.09', '3.11', '3.13',
|
|
28
|
+
'3.01', '3.02', '3.03', '3.04', '3.05', '3.06', '3.07', '3.08', '3.09', '3.11', '3.13',
|
|
29
29
|
'4.08',
|
|
30
30
|
]);
|
|
31
31
|
export const isSolidgateCustomerDecline = (code) => (Boolean(code && customerDeclineCodes.has(code)));
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { Stripe, StripeCheckoutPaymentElementOptions } from '@stripe/stripe-js';
|
|
2
2
|
import type { PlatformWalletPaymentMethod } from './walletPlatform.js';
|
|
3
3
|
import { type StripeSubscriptionCheckoutAnalyticsContext } from '../services/checkoutCompletionAnalytics.service.js';
|
|
4
|
+
import { type StripeSubscriptionCheckoutSessionInput } from '../hooks/useStripeSubscriptionCheckoutSession.js';
|
|
4
5
|
import { type StripeCheckoutErrorDetails } from '../services/stripeCheckoutError.js';
|
|
5
6
|
export type StripeWalletFirstCheckoutCopy = {
|
|
6
7
|
/** Benefit bullets under the wallet header, per wallet. */
|
|
@@ -16,7 +17,14 @@ export type StripeWalletFirstCheckoutCopy = {
|
|
|
16
17
|
paymentConfirmed: string;
|
|
17
18
|
paymentFailed: string;
|
|
18
19
|
formNotReady: string;
|
|
20
|
+
/** Labels of other Stripe methods by type, e.g. `{ pix: 'Pix' }`; a missing type shows its capitalized name. */
|
|
21
|
+
methodLabels?: Partial<Record<string, string>>;
|
|
19
22
|
};
|
|
23
|
+
/**
|
|
24
|
+
* A payment method block: the platform wallet, the card form, one block with every
|
|
25
|
+
* other method the offer supports (`'other'`), or one Stripe method type such as `'pix'`.
|
|
26
|
+
*/
|
|
27
|
+
export type StripeWalletFirstMethod = 'wallet' | 'card' | 'other' | (string & {});
|
|
20
28
|
export type StripeWalletFirstCheckoutProps = {
|
|
21
29
|
amountCents: number;
|
|
22
30
|
buttonColor: string;
|
|
@@ -39,8 +47,25 @@ export type StripeWalletFirstCheckoutProps = {
|
|
|
39
47
|
stripePromise: Promise<Stripe | null> | null;
|
|
40
48
|
summaryLabel: string;
|
|
41
49
|
themeColor: string;
|
|
42
|
-
/** The
|
|
43
|
-
initialMethod?:
|
|
50
|
+
/** The block selected on mount; defaults to the platform wallet. */
|
|
51
|
+
initialMethod?: StripeWalletFirstMethod;
|
|
52
|
+
/**
|
|
53
|
+
* The blocks and their order; defaults to the wallet, every other method the offer supports as one
|
|
54
|
+
* block, then the card. A method named here gets its own block; other methods not named go into the
|
|
55
|
+
* `'other'` block when it is listed, else they are not offered.
|
|
56
|
+
*/
|
|
57
|
+
methods?: readonly StripeWalletFirstMethod[];
|
|
58
|
+
/**
|
|
59
|
+
* Every method the offer supports, from the card session's `availablePaymentMethodTypes`
|
|
60
|
+
* (CHECKOUT-BR-010). Null or missing while unknown: only the wallet and the card show.
|
|
61
|
+
*/
|
|
62
|
+
availablePaymentMethodTypes?: readonly string[] | null;
|
|
63
|
+
/**
|
|
64
|
+
* Checkout session input used to create one Checkout Session per other method block, usually the
|
|
65
|
+
* card hook's input; its `paymentMethodTypes` is replaced per block and its callbacks are not used
|
|
66
|
+
* (each block shows its own session error). Without it no other method shows.
|
|
67
|
+
*/
|
|
68
|
+
methodSessionInput?: StripeSubscriptionCheckoutSessionInput;
|
|
44
69
|
/**
|
|
45
70
|
* Card form options merged over the defaults. Keys of `fields.billingDetails` merge one by one,
|
|
46
71
|
* e.g. `{ fields: { billingDetails: { address: { country: 'auto', postalCode: 'never' } } } }`.
|
|
@@ -1,142 +1,232 @@
|
|
|
1
1
|
'use client';
|
|
2
|
-
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
13
|
+
import { jsx as _jsx, jsxs as _jsxs, Fragment as _Fragment } from "react/jsx-runtime";
|
|
3
14
|
/**
|
|
4
|
-
* Wallet-first inline Stripe checkout (Checkout Sessions)
|
|
15
|
+
* Wallet-first inline Stripe checkout (Checkout Sessions), one block per
|
|
16
|
+
* payment method (CHECKOUT-BR-010).
|
|
5
17
|
*
|
|
6
18
|
* One platform wallet is the first, preselected method: Google Pay on Android,
|
|
7
19
|
* Apple Pay everywhere else, shown with Stripe's own wallet button. Card
|
|
8
|
-
* payment is
|
|
9
|
-
*
|
|
10
|
-
*
|
|
11
|
-
*
|
|
12
|
-
*
|
|
13
|
-
*
|
|
14
|
-
*
|
|
15
|
-
*
|
|
16
|
-
*
|
|
20
|
+
* payment is the last method. Between them, every other method the offer
|
|
21
|
+
* supports (Pix, Klarna, …) forms one block, or its own block when `methods`
|
|
22
|
+
* names it. The wallet and the card share the caller's Checkout Session; every
|
|
23
|
+
* other block owns a Checkout Session restricted to its methods, created when
|
|
24
|
+
* the block is selected. The whole layout renders immediately, even before the
|
|
25
|
+
* checkout session exists; the wallet slot holds a progress bar at the exact
|
|
26
|
+
* button height until Stripe's button replaces it, so nothing moves. Where the
|
|
27
|
+
* wallet cannot pay, the same slot explains that. The card form has no email or
|
|
28
|
+
* terms text: the session carries the email. Stripe asks for the postal code
|
|
29
|
+
* only for card countries that use it (US, CA, UK). `paymentElementOptions`
|
|
30
|
+
* overrides these card form defaults. `initialMethod` opens another block
|
|
31
|
+
* first, e.g. `'card'` for a bottom-of-page "complete your order" block; the
|
|
32
|
+
* wallet stays one tap away.
|
|
17
33
|
*
|
|
18
|
-
* The caller owns the
|
|
19
|
-
*
|
|
34
|
+
* The caller owns the card Checkout Session (`clientSecret`, created with
|
|
35
|
+
* `paymentMethodTypes: ['card']` so its form never shows another method), the
|
|
36
|
+
* copy and what happens after `onSuccess`.
|
|
20
37
|
*/
|
|
21
38
|
import { useEffect, useMemo, useRef, useState } from 'react';
|
|
22
39
|
import { CheckoutProvider, PaymentElement, useCheckout } from '@stripe/react-stripe-js/checkout';
|
|
23
40
|
import { completePaywallCheckout } from '@funnelsgrove/runtime';
|
|
24
|
-
import { StripeCheckoutExpressCheckoutButton } from './StripeCheckoutExpressCheckoutButton.js';
|
|
25
41
|
import { ApplePayMark, CardBrandMarks, GooglePayMark, MethodCard, usePlatformWallet } from '../../../components/walletFirstParts.js';
|
|
26
42
|
import { stripeWalletFirstCheckoutStyles } from './StripeWalletFirstCheckout.styles.js';
|
|
43
|
+
import { WalletButton } from './WalletButton.js';
|
|
44
|
+
import { buildWalletFirstCheckoutOptions } from './StripeWalletFirstCheckout.options.js';
|
|
45
|
+
import { getCheckoutSessionPaymentMethodTypes } from '../services/checkoutSessionPaymentMethods.js';
|
|
27
46
|
import { queueStripeSubscriptionCheckoutStarted, trackPaidStripeSubscriptionCheckoutCompleted, trackStripeCheckoutShown, trackStripeSubscriptionPaymentInfoSubmitted, } from '../services/checkoutCompletionAnalytics.service.js';
|
|
28
47
|
import { trackCheckoutFailureShown } from '../../../services/checkoutObservability.service.js';
|
|
29
48
|
import { useCheckoutShownOnce } from '../hooks/useCheckoutShownOnce.js';
|
|
49
|
+
import { useStripeSubscriptionCheckoutSession } from '../hooks/useStripeSubscriptionCheckoutSession.js';
|
|
30
50
|
import { isStripeCheckoutAlreadyPaidError, normalizeStripeCheckoutError } from '../services/stripeCheckoutError.js';
|
|
31
|
-
const
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
};
|
|
51
|
+
const DEFAULT_METHODS = ['wallet', 'other', 'card'];
|
|
52
|
+
const RESERVED_METHODS = new Set(['wallet', 'card', 'other']);
|
|
53
|
+
/** Only methods the offer supports become blocks; unnamed extras share the `'other'` block. */
|
|
54
|
+
function resolveMethodBlocks(methods, availablePaymentMethodTypes, canCreateSessions) {
|
|
55
|
+
const extras = (availablePaymentMethodTypes !== null && availablePaymentMethodTypes !== void 0 ? availablePaymentMethodTypes : []).filter((type) => type !== 'card');
|
|
56
|
+
const named = methods.filter((method) => !RESERVED_METHODS.has(method));
|
|
57
|
+
const blocks = [];
|
|
58
|
+
for (const method of new Set(methods)) {
|
|
59
|
+
if (method === 'wallet') {
|
|
60
|
+
blocks.push({ id: 'wallet', kind: 'wallet' });
|
|
61
|
+
}
|
|
62
|
+
else if (method === 'card') {
|
|
63
|
+
blocks.push({ id: 'card', kind: 'card' });
|
|
64
|
+
}
|
|
65
|
+
else if (!canCreateSessions) {
|
|
66
|
+
continue;
|
|
67
|
+
}
|
|
68
|
+
else if (method === 'other') {
|
|
69
|
+
const types = extras.filter((type) => !named.includes(type));
|
|
70
|
+
if (types.length)
|
|
71
|
+
blocks.push({ id: 'other', kind: 'session', types });
|
|
72
|
+
}
|
|
73
|
+
else if (extras.includes(method)) {
|
|
74
|
+
blocks.push({ id: method, kind: 'session', types: [method] });
|
|
75
|
+
}
|
|
76
|
+
}
|
|
77
|
+
return blocks;
|
|
78
|
+
}
|
|
79
|
+
const methodLabel = (type, copy) => { var _a, _b; return (_b = (_a = copy.methodLabels) === null || _a === void 0 ? void 0 : _a[type]) !== null && _b !== void 0 ? _b : type.replace(/_/g, ' ').replace(/^./, (first) => first.toUpperCase()); };
|
|
41
80
|
export function StripeWalletFirstCheckout(props) {
|
|
42
|
-
|
|
81
|
+
var _a, _b, _c, _d;
|
|
82
|
+
const { availablePaymentMethodTypes, buttonColor, checkoutAnalytics, checkoutSessionId, clientSecret, copy, initialMethod = 'wallet', methods = DEFAULT_METHODS, methodSessionInput, onError, onSuccess, stripePromise, themeColor, } = props;
|
|
43
83
|
const wallet = usePlatformWallet();
|
|
84
|
+
// A card session that offers other methods itself shows them in its form; other blocks would repeat them.
|
|
85
|
+
const cardSessionCardsOnly = getCheckoutSessionPaymentMethodTypes(checkoutSessionId).every((type) => type === 'card');
|
|
86
|
+
const canCreateSessions = Boolean(methodSessionInput) && cardSessionCardsOnly;
|
|
87
|
+
// Keyed by content so inline arrays from the caller keep each block's `types` identity stable.
|
|
88
|
+
const methodsKey = methods.join(',');
|
|
89
|
+
const availableKey = (_a = availablePaymentMethodTypes === null || availablePaymentMethodTypes === void 0 ? void 0 : availablePaymentMethodTypes.join(',')) !== null && _a !== void 0 ? _a : null;
|
|
90
|
+
const blocks = useMemo(() => resolveMethodBlocks(methodsKey.split(',').filter(Boolean), availableKey === null ? null : availableKey.split(',').filter(Boolean), canCreateSessions), [methodsKey, availableKey, canCreateSessions]);
|
|
44
91
|
const [selected, setSelected] = useState(initialMethod);
|
|
45
|
-
// A
|
|
46
|
-
const
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
92
|
+
// A method inside the other block selects that block; a hidden block gives way to the first one.
|
|
93
|
+
const activeId = (_d = ((_c = (_b = blocks.find((block) => block.id === selected)) !== null && _b !== void 0 ? _b : blocks.find((block) => block.kind === 'session' && block.types.includes(selected))) !== null && _c !== void 0 ? _c : blocks[0])) === null || _d === void 0 ? void 0 : _d.id;
|
|
94
|
+
// A form that is open on mount has not been opened by the visitor yet.
|
|
95
|
+
const [engaged, setEngaged] = useState(initialMethod === 'wallet');
|
|
96
|
+
const select = (id) => {
|
|
97
|
+
if (id !== 'wallet')
|
|
98
|
+
setEngaged(true);
|
|
99
|
+
setSelected(id);
|
|
100
|
+
};
|
|
101
|
+
const engage = () => setEngaged(true);
|
|
102
|
+
const [busy, setBusy] = useState(false);
|
|
103
|
+
const [confirmed, setConfirmed] = useState(false);
|
|
104
|
+
const [completed, setCompleted] = useState(false);
|
|
105
|
+
const [error, setError] = useState(null);
|
|
106
|
+
// A replaced card session starts clean, as its remounted form did before.
|
|
107
|
+
const [seenClientSecret, setSeenClientSecret] = useState(clientSecret);
|
|
108
|
+
if (seenClientSecret !== clientSecret) {
|
|
109
|
+
setSeenClientSecret(clientSecret);
|
|
110
|
+
setError(null);
|
|
111
|
+
setBusy(false);
|
|
112
|
+
}
|
|
113
|
+
const paymentStatus = completed ? copy.paymentConfirmed : confirmed ? copy.verifyingPayment : null;
|
|
114
|
+
const status = {
|
|
115
|
+
busy,
|
|
116
|
+
paymentStatus,
|
|
117
|
+
locked: Boolean(paymentStatus) && !error,
|
|
118
|
+
error,
|
|
119
|
+
setBusy,
|
|
120
|
+
markConfirmed: () => setConfirmed(true),
|
|
121
|
+
markCompleted: () => setCompleted(true),
|
|
122
|
+
showError: (message, context, details, alreadyTracked = false) => {
|
|
123
|
+
const errorDetails = message ? details !== null && details !== void 0 ? details : normalizeStripeCheckoutError(message, undefined, context.paymentMethod) : undefined;
|
|
124
|
+
if (message && checkoutAnalytics && !alreadyTracked) {
|
|
125
|
+
trackCheckoutFailureShown(Object.assign({ analytics: checkoutAnalytics, checkoutSessionId: context.checkoutSessionId, errorMessage: message, failureStage: context.failureStage, provider: 'stripe' }, errorDetails));
|
|
126
|
+
}
|
|
127
|
+
setError(message);
|
|
128
|
+
if (message)
|
|
129
|
+
onError === null || onError === void 0 ? void 0 : onError(message, errorDetails);
|
|
130
|
+
else
|
|
131
|
+
onError === null || onError === void 0 ? void 0 : onError(message);
|
|
132
|
+
},
|
|
133
|
+
trackSuccess: async (paidCheckoutSessionId, embedded = false) => {
|
|
134
|
+
if (checkoutAnalytics)
|
|
135
|
+
await trackPaidStripeSubscriptionCheckoutCompleted(Object.assign(Object.assign({}, checkoutAnalytics), { checkoutSessionId: paidCheckoutSessionId }));
|
|
136
|
+
if (embedded)
|
|
137
|
+
return false;
|
|
138
|
+
return (await (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess())) === true;
|
|
139
|
+
},
|
|
51
140
|
};
|
|
52
|
-
|
|
141
|
+
// Once any block confirmed a payment, no other block may start a second one.
|
|
142
|
+
const disabled = busy || confirmed;
|
|
53
143
|
const style = { '--wfc-theme': themeColor, '--wfc-button': buttonColor };
|
|
54
|
-
const options = useMemo(() => clientSecret ?
|
|
55
|
-
clientSecret,
|
|
56
|
-
elementsOptions: { appearance: Object.assign(Object.assign({}, appearance), { variables: Object.assign(Object.assign({}, appearance.variables), { colorPrimary: themeColor }) }) },
|
|
57
|
-
} : null, [clientSecret, themeColor]);
|
|
144
|
+
const options = useMemo(() => clientSecret ? buildWalletFirstCheckoutOptions(clientSecret, themeColor) : null, [clientSecret, themeColor]);
|
|
58
145
|
// The whole layout shows on mount, so one mount is one show.
|
|
59
146
|
useCheckoutShownOnce(Boolean(checkoutAnalytics), () => {
|
|
60
147
|
if (checkoutAnalytics)
|
|
61
148
|
trackStripeCheckoutShown(Object.assign(Object.assign({}, checkoutAnalytics), { checkoutSessionId, checkoutSurface: 'inline' }));
|
|
62
149
|
});
|
|
63
|
-
|
|
64
|
-
|
|
150
|
+
const cardPaymentElementOptions = useMemo(() => resolveCardPaymentElementOptions(props.paymentElementOptions), [props.paymentElementOptions]);
|
|
151
|
+
const live = Boolean(options && stripePromise);
|
|
152
|
+
const formProps = {
|
|
153
|
+
checkoutAnalytics, copy, customerEmail: props.customerEmail, engaged, onEngage: engage, returnUrl: props.returnUrl, status,
|
|
154
|
+
};
|
|
155
|
+
const renderBlock = (block) => {
|
|
156
|
+
const checked = activeId === block.id;
|
|
157
|
+
if (block.kind === 'wallet') {
|
|
158
|
+
const WalletMark = wallet === 'applePay' ? ApplePayMark : GooglePayMark;
|
|
159
|
+
const walletNote = checked ? status.paymentStatus : null;
|
|
160
|
+
return (_jsxs(MethodCard, { checked: checked, disabled: disabled, label: copy.walletLabels[wallet], onSelect: () => select('wallet'), header: _jsx(WalletMark, {}), children: [_jsx("ul", { className: 'wfc-benefits', children: copy.walletBenefits[wallet].map((item) => _jsxs("li", { children: [_jsx(CheckIcon, {}), item] }, item)) }), live ? _jsx(WalletButton, { amountCents: props.amountCents, beforeConfirm: async () => { setBusy(true); return props.customerEmail || null; }, checkoutAnalytics: checkoutAnalytics, checkoutSessionId: checkoutSessionId, customerEmail: props.customerEmail, customerName: props.customerName, onCancel: () => { var _a; setBusy(false); (_a = props.onCancel) === null || _a === void 0 ? void 0 : _a.call(props); }, onEmbeddedComplete: () => setCompleted(true), onError: (message, details) => { setBusy(false); status.showError(message, { checkoutSessionId, failureStage: 'wallet', paymentMethod: wallet }, details, true); }, onPaymentRejected: () => { setBusy(false); select('card'); }, onSuccess: async () => { await status.trackSuccess(checkoutSessionId); }, onVerificationPending: () => setConfirmed(true), processingLabel: copy.processingLabel, returnUrl: props.returnUrl, summaryLabel: props.summaryLabel, unavailableNote: copy.walletUnavailableNote.replace('{wallet}', copy.walletLabels[wallet]), wallet: wallet }) : _jsx("div", { className: 'wfc-wallet-slot', children: _jsx("span", { className: 'wfc-progress', role: 'status', "aria-label": copy.processingLabel }) }), _jsx("p", { className: walletNote ? 'wfc-secure is-status' : 'wfc-secure', role: walletNote ? 'status' : undefined, children: walletNote || copy.secureNote })] }, 'wallet'));
|
|
161
|
+
}
|
|
162
|
+
if (block.kind === 'card') {
|
|
163
|
+
return (_jsx(MethodCard, { checked: checked, disabled: disabled, label: copy.cardLabel, onSelect: () => select('card'), header: _jsx(CardBrandMarks, {}), children: live
|
|
164
|
+
? _jsx(MethodForm, Object.assign({}, formProps, { checkoutSessionId: checkoutSessionId, failureStage: 'card_form', paymentElementOptions: cardPaymentElementOptions, paymentMethod: 'card', selected: checked, startSource: 'card_form_open' }))
|
|
165
|
+
: _jsx(FormPlaceholder, {}) }, 'card'));
|
|
166
|
+
}
|
|
167
|
+
return methodSessionInput ? (_jsx(SessionMethodBlock, Object.assign({}, formProps, { block: block, checked: checked, disabled: disabled, onSelect: () => select(block.id), sessionInput: methodSessionInput, themeColor: themeColor }), block.id)) : null;
|
|
168
|
+
};
|
|
169
|
+
const layout = (_jsxs("div", { className: 'wfc', style: style, children: [blocks.map(renderBlock), error ? _jsx("p", { className: 'wfc-error', role: 'alert', children: error }) : null] }));
|
|
170
|
+
return (_jsxs(_Fragment, { children: [options && stripePromise ? (_jsx(CheckoutProvider, { stripe: stripePromise, options: options, children: layout }, options.clientSecret)) : layout, _jsx("style", { children: stripeWalletFirstCheckoutStyles })] }));
|
|
171
|
+
}
|
|
172
|
+
/** Stripe collects what each other method needs (e.g. the CPF for Pix); only the card form restricts its fields. */
|
|
173
|
+
const methodPaymentElementOptions = {
|
|
174
|
+
layout: 'tabs',
|
|
175
|
+
terms: { card: 'never' },
|
|
176
|
+
wallets: { applePay: 'never', googlePay: 'never', link: 'never' },
|
|
177
|
+
};
|
|
178
|
+
/** One block with its own Checkout Session restricted to its methods, created when the block is selected. */
|
|
179
|
+
function SessionMethodBlock(_a) {
|
|
180
|
+
var { block, checked, disabled, onSelect, sessionInput, themeColor } = _a, form = __rest(_a, ["block", "checked", "disabled", "onSelect", "sessionInput", "themeColor"]);
|
|
181
|
+
// The caller's callbacks belong to the card session; this block reports its own session error below.
|
|
182
|
+
const session = useStripeSubscriptionCheckoutSession(Object.assign(Object.assign({}, sessionInput), { onError: undefined, onPreparationStart: undefined, onReset: undefined, paymentMethodTypes: block.types }));
|
|
183
|
+
const { activeClientSecret, prepareCardCheckout } = session;
|
|
184
|
+
// Session creation is preparation, not a checkout start; the client reports the start on engagement.
|
|
65
185
|
useEffect(() => {
|
|
66
|
-
if (!
|
|
186
|
+
if (!checked || activeClientSecret)
|
|
67
187
|
return;
|
|
68
|
-
|
|
69
|
-
}, [
|
|
70
|
-
|
|
188
|
+
void prepareCardCheckout({ checkoutStartSource: 'checkout_render' });
|
|
189
|
+
}, [activeClientSecret, checked, prepareCardCheckout]);
|
|
190
|
+
const options = useMemo(() => activeClientSecret ? buildWalletFirstCheckoutOptions(activeClientSecret, themeColor) : null, [activeClientSecret, themeColor]);
|
|
191
|
+
const label = block.types.map((type) => methodLabel(type, form.copy)).join(' · ');
|
|
192
|
+
return (_jsxs(MethodCard, { checked: checked, disabled: disabled, label: label, onSelect: onSelect, header: _jsx("span", { className: 'wfc-method-label', children: label }), children: [options && session.stripePromise ? (_jsx(CheckoutProvider, { stripe: session.stripePromise, options: options, children: _jsx(MethodForm, Object.assign({}, form, { checkoutSessionId: session.checkoutSessionId, failureStage: 'method_form', paymentElementOptions: methodPaymentElementOptions, paymentMethod: block.types.length === 1 ? block.types[0] : undefined, selected: checked, startSource: 'method_form_open' })) }, options.clientSecret)) : _jsx(FormPlaceholder, {}), session.error ? _jsx("p", { className: 'wfc-error', role: 'alert', children: session.error }) : null] }));
|
|
71
193
|
}
|
|
72
|
-
|
|
194
|
+
/** Stripe's Payment Element for one Checkout Session plus the submit button; must render inside that session's `CheckoutProvider`. */
|
|
195
|
+
function MethodForm({ checkoutAnalytics, checkoutSessionId, copy, customerEmail, engaged, failureStage, onEngage, paymentElementOptions, paymentMethod, returnUrl, selected, startSource, status, }) {
|
|
73
196
|
const checkoutState = useCheckout();
|
|
74
|
-
// null until Stripe answers; the slot shows progress at the button's height meanwhile.
|
|
75
|
-
const [walletAvailable, setWalletAvailable] = useState(null);
|
|
76
|
-
const [walletConfirming, setWalletConfirming] = useState(false);
|
|
77
197
|
const [paymentElementReady, setPaymentElementReady] = useState(false);
|
|
78
198
|
const [paymentElementComplete, setPaymentElementComplete] = useState(false);
|
|
199
|
+
const [pickedMethod, setPickedMethod] = useState(undefined);
|
|
79
200
|
const [submitting, setSubmitting] = useState(false);
|
|
201
|
+
// Confirmation belongs to this session: a replaced session confirms again.
|
|
80
202
|
const [providerConfirmed, setProviderConfirmed] = useState(false);
|
|
81
|
-
const [completed, setCompleted] = useState(false);
|
|
82
|
-
const [error, setError] = useState(null);
|
|
83
203
|
const submitInFlight = useRef(false);
|
|
84
|
-
const
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
applePay: wallet === 'applePay' ? 'always' : 'never',
|
|
92
|
-
googlePay: wallet === 'googlePay' ? 'always' : 'never',
|
|
93
|
-
},
|
|
94
|
-
}), [wallet]);
|
|
95
|
-
const paymentElementOptions = useMemo(() => {
|
|
96
|
-
var _a;
|
|
97
|
-
const billingDetails = (_a = paymentElementOverrides === null || paymentElementOverrides === void 0 ? void 0 : paymentElementOverrides.fields) === null || _a === void 0 ? void 0 : _a.billingDetails;
|
|
98
|
-
return Object.assign(Object.assign({ layout: 'tabs', terms: { card: 'never' }, wallets: { applePay: 'never', googlePay: 'never', link: 'never' } }, paymentElementOverrides), { fields: {
|
|
99
|
-
billingDetails: typeof billingDetails === 'string' ? billingDetails : Object.assign({ name: 'never', email: 'never',
|
|
100
|
-
// US banks match the postal code against the cardholder's; without it they decline more as fraud.
|
|
101
|
-
address: { country: 'auto', postalCode: 'auto' } }, billingDetails),
|
|
102
|
-
} });
|
|
103
|
-
}, [paymentElementOverrides]);
|
|
204
|
+
const method = paymentMethod !== null && paymentMethod !== void 0 ? paymentMethod : pickedMethod;
|
|
205
|
+
// The checkout starts when the visitor opens the form, or, when it opens preselected, on their first input into it.
|
|
206
|
+
useEffect(() => {
|
|
207
|
+
if (!checkoutAnalytics || !selected || !engaged)
|
|
208
|
+
return;
|
|
209
|
+
queueStripeSubscriptionCheckoutStarted(Object.assign(Object.assign({}, checkoutAnalytics), { checkoutSessionId, checkoutStartSource: startSource, paymentMethod: method }));
|
|
210
|
+
}, [checkoutAnalytics, checkoutSessionId, selected, engaged, method, startSource]);
|
|
104
211
|
// A hidden Payment Element measures 0px wide; let Stripe re-layout when it opens.
|
|
105
212
|
useEffect(() => {
|
|
106
|
-
if (selected
|
|
213
|
+
if (!selected)
|
|
107
214
|
return;
|
|
108
215
|
const timer = window.setTimeout(() => window.dispatchEvent(new Event('resize')), 0);
|
|
109
216
|
return () => window.clearTimeout(timer);
|
|
110
217
|
}, [selected]);
|
|
111
|
-
const
|
|
112
|
-
|
|
113
|
-
if (message && checkoutAnalytics && !alreadyTracked) {
|
|
114
|
-
trackCheckoutFailureShown(Object.assign({ analytics: checkoutAnalytics, checkoutSessionId, errorMessage: message, failureStage: 'card_form', provider: 'stripe' }, errorDetails));
|
|
115
|
-
}
|
|
116
|
-
setError(message);
|
|
117
|
-
if (message)
|
|
118
|
-
onError === null || onError === void 0 ? void 0 : onError(message, errorDetails);
|
|
119
|
-
else
|
|
120
|
-
onError === null || onError === void 0 ? void 0 : onError(message);
|
|
121
|
-
};
|
|
122
|
-
/** Resolves true when the caller's onSuccess handled the navigation itself. */
|
|
123
|
-
const trackSuccess = async (embedded = false) => {
|
|
124
|
-
if (checkoutAnalytics)
|
|
125
|
-
await trackPaidStripeSubscriptionCheckoutCompleted(Object.assign(Object.assign({}, checkoutAnalytics), { checkoutSessionId }));
|
|
126
|
-
if (embedded)
|
|
127
|
-
return false;
|
|
128
|
-
return (await (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess())) === true;
|
|
129
|
-
};
|
|
218
|
+
const failure = { checkoutSessionId, failureStage, paymentMethod: method };
|
|
219
|
+
const showError = (message, details, alreadyTracked = false) => status.showError(message, failure, details, alreadyTracked);
|
|
130
220
|
const finishPaidCheckout = async () => {
|
|
131
221
|
if (await completePaywallCheckout('stripe', checkoutSessionId || '', {
|
|
132
|
-
beforeNotify: async () => {
|
|
222
|
+
beforeNotify: async () => { status.markCompleted(); await status.trackSuccess(checkoutSessionId, true); },
|
|
133
223
|
}))
|
|
134
224
|
return;
|
|
135
|
-
if (await trackSuccess())
|
|
225
|
+
if (await status.trackSuccess(checkoutSessionId))
|
|
136
226
|
return;
|
|
137
227
|
window.location.assign(returnUrl);
|
|
138
228
|
};
|
|
139
|
-
const
|
|
229
|
+
const submit = async (event) => {
|
|
140
230
|
event.preventDefault();
|
|
141
231
|
if (submitInFlight.current)
|
|
142
232
|
return;
|
|
@@ -152,6 +242,7 @@ function StripeWalletFirstCheckoutForm({ amountCents, checkoutAnalytics, checkou
|
|
|
152
242
|
}
|
|
153
243
|
submitInFlight.current = true;
|
|
154
244
|
setSubmitting(true);
|
|
245
|
+
status.setBusy(true);
|
|
155
246
|
showError(null);
|
|
156
247
|
let confirmed = providerConfirmed;
|
|
157
248
|
try {
|
|
@@ -168,13 +259,15 @@ function StripeWalletFirstCheckoutForm({ amountCents, checkoutAnalytics, checkou
|
|
|
168
259
|
const result = await checkout.confirm({ redirect: 'if_required' });
|
|
169
260
|
if (result.type === 'error' && !isStripeCheckoutAlreadyPaidError(result.error)) {
|
|
170
261
|
const message = result.error.message || copy.paymentFailed;
|
|
171
|
-
showError(message, normalizeStripeCheckoutError(message, result.error,
|
|
262
|
+
showError(message, normalizeStripeCheckoutError(message, result.error, method));
|
|
172
263
|
submitInFlight.current = false;
|
|
173
264
|
setSubmitting(false);
|
|
265
|
+
status.setBusy(false);
|
|
174
266
|
return;
|
|
175
267
|
}
|
|
176
268
|
confirmed = true;
|
|
177
269
|
setProviderConfirmed(true);
|
|
270
|
+
status.markConfirmed();
|
|
178
271
|
}
|
|
179
272
|
await finishPaidCheckout();
|
|
180
273
|
}
|
|
@@ -182,19 +275,31 @@ function StripeWalletFirstCheckoutForm({ amountCents, checkoutAnalytics, checkou
|
|
|
182
275
|
showError(submitError instanceof Error && submitError.message ? submitError.message : copy.paymentFailed, undefined, confirmed);
|
|
183
276
|
submitInFlight.current = false;
|
|
184
277
|
setSubmitting(false);
|
|
278
|
+
status.setBusy(false);
|
|
185
279
|
}
|
|
186
280
|
};
|
|
187
281
|
// After a successful confirmation the form stays in place and reports progress
|
|
188
282
|
// where the customer paid, until the success screen takes over.
|
|
189
|
-
const
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
283
|
+
const { locked } = status;
|
|
284
|
+
return (_jsxs("form", { className: 'wfc-card-form', onSubmit: (event) => void submit(event), children: [_jsx(PaymentElement, { options: paymentElementOptions, onChange: (event) => {
|
|
285
|
+
var _a;
|
|
286
|
+
setPaymentElementComplete(event.complete);
|
|
287
|
+
setPickedMethod((_a = event.value) === null || _a === void 0 ? void 0 : _a.type);
|
|
288
|
+
if (!event.empty)
|
|
289
|
+
onEngage();
|
|
290
|
+
}, onReady: () => setPaymentElementReady(true) }), _jsx("button", { type: 'submit', className: 'wfc-submit', disabled: locked || submitting || !paymentElementReady, "aria-live": 'polite', children: locked && status.paymentStatus ? status.paymentStatus : submitting ? copy.processingLabel : copy.cardSubmitLabel }), _jsx("p", { className: 'wfc-secure', children: copy.secureNote })] }));
|
|
291
|
+
}
|
|
292
|
+
function FormPlaceholder() {
|
|
293
|
+
return _jsx("span", { className: 'wfc-progress wfc-progress--form', "aria-hidden": 'true' });
|
|
193
294
|
}
|
|
194
|
-
|
|
195
|
-
|
|
196
|
-
const
|
|
197
|
-
return (
|
|
295
|
+
function resolveCardPaymentElementOptions(overrides) {
|
|
296
|
+
var _a;
|
|
297
|
+
const billingDetails = (_a = overrides === null || overrides === void 0 ? void 0 : overrides.fields) === null || _a === void 0 ? void 0 : _a.billingDetails;
|
|
298
|
+
return Object.assign(Object.assign(Object.assign({}, methodPaymentElementOptions), overrides), { fields: {
|
|
299
|
+
billingDetails: typeof billingDetails === 'string' ? billingDetails : Object.assign({ name: 'never', email: 'never',
|
|
300
|
+
// US banks match the postal code against the cardholder's; without it they decline more as fraud.
|
|
301
|
+
address: { country: 'auto', postalCode: 'auto' } }, billingDetails),
|
|
302
|
+
} });
|
|
198
303
|
}
|
|
199
304
|
function CheckIcon() {
|
|
200
305
|
return _jsx("svg", { className: 'wfc-check', viewBox: '0 0 16 16', "aria-hidden": 'true', children: _jsx("path", { d: 'M3 8.5 6.5 12 13 4.5', fill: 'none', stroke: 'currentColor', strokeWidth: '2', strokeLinecap: 'round', strokeLinejoin: 'round' }) });
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
export declare function buildWalletFirstCheckoutOptions(clientSecret: string, themeColor?: string): {
|
|
2
|
+
clientSecret: string;
|
|
3
|
+
elementsOptions: {
|
|
4
|
+
appearance: {
|
|
5
|
+
variables: {
|
|
6
|
+
colorPrimary?: string | undefined;
|
|
7
|
+
borderRadius: string;
|
|
8
|
+
colorBackground: string;
|
|
9
|
+
colorText: string;
|
|
10
|
+
colorTextPlaceholder: string;
|
|
11
|
+
spacingUnit: string;
|
|
12
|
+
};
|
|
13
|
+
labels: "above";
|
|
14
|
+
};
|
|
15
|
+
};
|
|
16
|
+
};
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
/** `CheckoutProvider` options shared by every Checkout Session scope of the wallet-first checkout. Internal to the package. */
|
|
2
|
+
const appearance = {
|
|
3
|
+
labels: 'above',
|
|
4
|
+
variables: {
|
|
5
|
+
borderRadius: '12px',
|
|
6
|
+
colorBackground: '#fff',
|
|
7
|
+
colorText: '#303136',
|
|
8
|
+
colorTextPlaceholder: '#8c909a',
|
|
9
|
+
spacingUnit: '4px',
|
|
10
|
+
},
|
|
11
|
+
};
|
|
12
|
+
export function buildWalletFirstCheckoutOptions(clientSecret, themeColor) {
|
|
13
|
+
return {
|
|
14
|
+
clientSecret,
|
|
15
|
+
elementsOptions: {
|
|
16
|
+
appearance: Object.assign(Object.assign({}, appearance), { variables: Object.assign(Object.assign({}, appearance.variables), (themeColor ? { colorPrimary: themeColor } : {})) }),
|
|
17
|
+
},
|
|
18
|
+
};
|
|
19
|
+
}
|
|
@@ -1,2 +1,4 @@
|
|
|
1
|
+
/** Wallet slot of WalletButton: progress bar, Stripe's wallet button and the unavailable note share one height. */
|
|
2
|
+
export declare const walletButtonStyles = "\n.wfc-wallet-slot { position:relative; height:55px; }\n.wfc-wallet-button { height:55px; overflow:hidden; border-radius:12px; }\n.wfc-progress { position:relative; display:block; height:100%; overflow:hidden; border-radius:12px; background:#eef0f6; }\n.wfc-progress::after { content:''; position:absolute; inset:0; background:linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent); transform:translateX(-100%); animation:wfc-sheen 1.3s ease-in-out infinite; }\n.wfc-progress--overlay { position:absolute; inset:0; z-index:1; }\n@keyframes wfc-sheen { to { transform:translateX(100%); } }\n@media (prefers-reduced-motion: reduce) { .wfc-progress::after { animation:none; } }\n.wfc-wallet-unavailable { position:absolute; inset:0; z-index:1; display:flex; align-items:center; justify-content:center; margin:0; padding:0 16px; border-radius:12px; background:#f4f5f8; color:#6b6773; font-size:14px; line-height:1.35; text-align:center; }\n";
|
|
1
3
|
/** Styles for StripeWalletFirstCheckout; colors come from its `themeColor` and `buttonColor` props. */
|
|
2
|
-
export declare const stripeWalletFirstCheckoutStyles = "\n.wfc { display:grid; gap:12px; }\n/* The radio marks the choice; every card keeps the same quiet border. */\n.wfc-method { border-radius:16px; background:#fff; box-shadow:0 0 0 1.5px #e6e6ec; }\n.wfc-method-head { display:flex; align-items:center; gap:14px; width:100%; min-height:60px; padding:14px 16px; border:0; background:transparent; color:inherit; text-align:left; cursor:pointer; border-radius:16px; }\n.wfc-method-head:disabled { cursor:default; }\n.wfc-method-head:focus-visible { outline:3px solid var(--wfc-theme); outline-offset:2px; }\n.wfc-radio { flex:none; width:24px; height:24px; border-radius:50%; border:2px solid #b8bac4; background:#fff; transition:border-color .2s ease, box-shadow .2s ease; }\n.wfc-method[data-checked='true'] .wfc-radio { border-color:var(--wfc-theme); box-shadow:inset 0 0 0 4px #fff, inset 0 0 0 12px var(--wfc-theme); }\n.wfc-method-body { display:grid; grid-template-rows:0fr; opacity:0; transition:grid-template-rows .34s cubic-bezier(.25,.8,.25,1), opacity .22s ease; }\n.wfc-method-body[data-open='true'] { grid-template-rows:1fr; opacity:1; transition:grid-template-rows .34s cubic-bezier(.25,.8,.25,1), opacity .28s ease .08s; }\n.wfc-method-clip { min-height:0; overflow:hidden; }\n.wfc-method-content { padding:0 16px 16px; }\n@media (prefers-reduced-motion: reduce) { .wfc-method-body, .wfc-method-body[data-open='true'] { transition:none; } }\n.wfc-mark { height:30px; width:auto; color:#000; }\n.wfc-card-marks { display:flex; gap:6px; align-items:center; }\n.wfc-brand { width:40px; height:26px; border-radius:4px; }\n.wfc-benefits { margin:0 0 16px; padding:0; list-style:none; display:grid; gap:10px; font-size:15px; line-height:1.4; color:#303136; }\n.wfc-benefits li { display:flex; gap:10px; align-items:flex-start; }\n.wfc-check { flex:none; width:16px; height:16px; margin-top:2px; color:var(--wfc-theme); }\n.wfc-wallet-slot { position:relative; height:55px; }\n.wfc-wallet-button { height:55px; overflow:hidden; border-radius:12px; }\n.wfc-progress { position:relative; display:block; height:100%; overflow:hidden; border-radius:12px; background:#eef0f6; }\n.wfc-progress::after { content:''; position:absolute; inset:0; background:linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent); transform:translateX(-100%); animation:wfc-sheen 1.3s ease-in-out infinite; }\n.wfc-progress--overlay { position:absolute; inset:0; z-index:1; }\n
|
|
4
|
+
export declare const stripeWalletFirstCheckoutStyles = "\n.wfc { display:grid; gap:12px; }\n/* The radio marks the choice; every card keeps the same quiet border. */\n.wfc-method { border-radius:16px; background:#fff; box-shadow:0 0 0 1.5px #e6e6ec; }\n.wfc-method-head { display:flex; align-items:center; gap:14px; width:100%; min-height:60px; padding:14px 16px; border:0; background:transparent; color:inherit; text-align:left; cursor:pointer; border-radius:16px; }\n.wfc-method-head:disabled { cursor:default; }\n.wfc-method-head:focus-visible { outline:3px solid var(--wfc-theme); outline-offset:2px; }\n.wfc-radio { flex:none; width:24px; height:24px; border-radius:50%; border:2px solid #b8bac4; background:#fff; transition:border-color .2s ease, box-shadow .2s ease; }\n.wfc-method[data-checked='true'] .wfc-radio { border-color:var(--wfc-theme); box-shadow:inset 0 0 0 4px #fff, inset 0 0 0 12px var(--wfc-theme); }\n.wfc-method-body { display:grid; grid-template-rows:0fr; opacity:0; transition:grid-template-rows .34s cubic-bezier(.25,.8,.25,1), opacity .22s ease; }\n.wfc-method-body[data-open='true'] { grid-template-rows:1fr; opacity:1; transition:grid-template-rows .34s cubic-bezier(.25,.8,.25,1), opacity .28s ease .08s; }\n.wfc-method-clip { min-height:0; overflow:hidden; }\n.wfc-method-content { padding:0 16px 16px; }\n@media (prefers-reduced-motion: reduce) { .wfc-method-body, .wfc-method-body[data-open='true'] { transition:none; } }\n.wfc-mark { height:30px; width:auto; color:#000; }\n.wfc-card-marks { display:flex; gap:6px; align-items:center; }\n.wfc-brand { width:40px; height:26px; border-radius:4px; }\n.wfc-benefits { margin:0 0 16px; padding:0; list-style:none; display:grid; gap:10px; font-size:15px; line-height:1.4; color:#303136; }\n.wfc-benefits li { display:flex; gap:10px; align-items:flex-start; }\n.wfc-check { flex:none; width:16px; height:16px; margin-top:2px; color:var(--wfc-theme); }\n\n.wfc-wallet-slot { position:relative; height:55px; }\n.wfc-wallet-button { height:55px; overflow:hidden; border-radius:12px; }\n.wfc-progress { position:relative; display:block; height:100%; overflow:hidden; border-radius:12px; background:#eef0f6; }\n.wfc-progress::after { content:''; position:absolute; inset:0; background:linear-gradient(90deg, transparent, rgba(255,255,255,.75), transparent); transform:translateX(-100%); animation:wfc-sheen 1.3s ease-in-out infinite; }\n.wfc-progress--overlay { position:absolute; inset:0; z-index:1; }\n@keyframes wfc-sheen { to { transform:translateX(100%); } }\n@media (prefers-reduced-motion: reduce) { .wfc-progress::after { animation:none; } }\n.wfc-wallet-unavailable { position:absolute; inset:0; z-index:1; display:flex; align-items:center; justify-content:center; margin:0; padding:0 16px; border-radius:12px; background:#f4f5f8; color:#6b6773; font-size:14px; line-height:1.35; text-align:center; }\n\n.wfc-progress--form { height:320px; }\n.wfc-method-label { font-size:17px; font-weight:600; line-height:1.2; color:#303136; }\n.wfc-secure { margin:16px 0 0; text-align:center; font-size:14px; line-height:1.45; color:#8c909a; }\n.wfc-card-form { display:grid; gap:14px; }\n.wfc-card-form .wfc-secure { margin-top:0; }\n.wfc-submit { min-height:52px; border:0; border-radius:12px; background:var(--wfc-button); color:#fff; font:600 17px/1.2 inherit; cursor:pointer; }\n.wfc-submit:disabled { opacity:.6; cursor:default; }\n.wfc-error { margin:0; color:#c62828; font-size:14px; text-align:center; }\n.wfc-secure.is-status { color:var(--wfc-theme); font-weight:600; }\n";
|