@funnelsgrove/payments 0.75.0 → 0.77.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.
@@ -1 +1 @@
1
- export declare const PAYMENTS_PACKAGE_VERSION = "0.75.0";
1
+ export declare const PAYMENTS_PACKAGE_VERSION = "0.77.0";
@@ -1,2 +1,2 @@
1
1
  // Generated by scripts/generate-package-version.mjs.
2
- export const PAYMENTS_PACKAGE_VERSION = "0.75.0";
2
+ export const PAYMENTS_PACKAGE_VERSION = "0.77.0";
@@ -0,0 +1,32 @@
1
+ /**
2
+ * Express Checkout Element of a standalone Elements group with
3
+ * `paymentMethodCreation: 'manual'`, rendered inside a Checkout Session's
4
+ * `CheckoutProvider`. Its wallet sheet only creates the PaymentMethod and
5
+ * closes; the caller then confirms the Checkout Session with that PaymentMethod.
6
+ */
7
+ import { type ComponentProps } from 'react';
8
+ import type { useCheckout } from '@stripe/react-stripe-js/checkout';
9
+ import { ExpressCheckoutElement } from '@stripe/react-stripe-js';
10
+ import type { Stripe, StripeElements, StripeError } from '@stripe/stripe-js';
11
+ export type ManualWallet = {
12
+ elements: StripeElements | null;
13
+ stripe: Stripe | null;
14
+ };
15
+ type Props = ComponentProps<typeof ExpressCheckoutElement> & {
16
+ checkout: Extract<ReturnType<typeof useCheckout>, {
17
+ type: 'success';
18
+ }>['checkout'] | null;
19
+ stripePromise: Promise<Stripe | null>;
20
+ walletRef: {
21
+ current: ManualWallet;
22
+ };
23
+ };
24
+ /** The sheet shows the Checkout Session's amount and currency. Renders nothing until the session has loaded. */
25
+ export declare function ManualWalletExpressCheckoutElement({ checkout, stripePromise, walletRef, ...element }: Props): import("react/jsx-runtime").JSX.Element | null;
26
+ /** Creates the PaymentMethod from the confirmed wallet sheet, which closes the sheet. */
27
+ export declare function createManualWalletPaymentMethod({ elements, stripe }: ManualWallet): Promise<{
28
+ paymentMethodId: string;
29
+ } | {
30
+ error: StripeError | undefined;
31
+ }>;
32
+ export {};
@@ -0,0 +1,52 @@
1
+ 'use client';
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 } from "react/jsx-runtime";
14
+ /**
15
+ * Express Checkout Element of a standalone Elements group with
16
+ * `paymentMethodCreation: 'manual'`, rendered inside a Checkout Session's
17
+ * `CheckoutProvider`. Its wallet sheet only creates the PaymentMethod and
18
+ * closes; the caller then confirms the Checkout Session with that PaymentMethod.
19
+ */
20
+ import { useEffect, useMemo } from 'react';
21
+ import { Elements, ExpressCheckoutElement, useElements, useStripe } from '@stripe/react-stripe-js';
22
+ function ManualWalletBridge({ walletRef }) {
23
+ const elements = useElements();
24
+ const stripe = useStripe();
25
+ useEffect(() => {
26
+ walletRef.current = { elements, stripe };
27
+ }, [elements, stripe, walletRef]);
28
+ return null;
29
+ }
30
+ /** The sheet shows the Checkout Session's amount and currency. Renders nothing until the session has loaded. */
31
+ export function ManualWalletExpressCheckoutElement(_a) {
32
+ var { checkout, stripePromise, walletRef } = _a, element = __rest(_a, ["checkout", "stripePromise", "walletRef"]);
33
+ const amount = checkout === null || checkout === void 0 ? void 0 : checkout.total.total.minorUnitsAmount;
34
+ const currency = checkout === null || checkout === void 0 ? void 0 : checkout.currency.toLowerCase();
35
+ const mode = (checkout === null || checkout === void 0 ? void 0 : checkout.recurring) ? 'subscription' : 'payment';
36
+ const options = useMemo(() => (amount === undefined || !currency
37
+ ? null
38
+ : { amount, currency, mode, paymentMethodCreation: 'manual' }), [amount, currency, mode]);
39
+ if (!options)
40
+ return null;
41
+ return (_jsxs(Elements, { stripe: stripePromise, options: options, children: [_jsx(ManualWalletBridge, { walletRef: walletRef }), _jsx(ExpressCheckoutElement, Object.assign({}, element))] }));
42
+ }
43
+ /** Creates the PaymentMethod from the confirmed wallet sheet, which closes the sheet. */
44
+ export async function createManualWalletPaymentMethod({ elements, stripe }) {
45
+ if (!elements || !stripe)
46
+ return { error: undefined };
47
+ const submitted = await elements.submit();
48
+ if (submitted.error)
49
+ return { error: submitted.error };
50
+ const created = await stripe.createPaymentMethod({ elements });
51
+ return created.paymentMethod ? { paymentMethodId: created.paymentMethod.id } : { error: created.error };
52
+ }
@@ -1,4 +1,4 @@
1
- import type { AvailablePaymentMethods, StripeCheckoutExpressCheckoutElementOptions } from '@stripe/stripe-js';
1
+ import type { AvailablePaymentMethods, Stripe, StripeCheckoutExpressCheckoutElementOptions } from '@stripe/stripe-js';
2
2
  import { type StripeSubscriptionCheckoutAnalyticsContext } from '../services/checkoutCompletionAnalytics.service.js';
3
3
  import { type StripeCheckoutErrorDetails } from '../services/stripeCheckoutError.js';
4
4
  export type StripeWalletCheckoutSuccess = {
@@ -36,6 +36,14 @@ export type StripeCheckoutExpressCheckoutButtonProps = {
36
36
  onEmbeddedComplete?: () => void;
37
37
  onVerificationPending?: () => void;
38
38
  onSuccess?: (result: StripeWalletCheckoutSuccess) => void | Promise<void>;
39
+ /**
40
+ * Same Stripe instance as the surrounding `CheckoutProvider`. When set, the
41
+ * wallet sheet only creates the PaymentMethod and closes; the Checkout Session
42
+ * is confirmed afterwards, so a bank decline reaches `onError` and
43
+ * `onPaymentRejected` with the sheet already closed. Without it the session is
44
+ * confirmed while the sheet stays open.
45
+ */
46
+ stripePromise?: Promise<Stripe | null> | null;
39
47
  unsupportedCountryMessage?: string;
40
48
  };
41
- export declare function StripeCheckoutExpressCheckoutButton({ beforeConfirm, checkoutAnalytics, checkoutSessionId, returnUrl, confirmEmail, customerEmail, className, options, availabilityPaymentMethods, initialAvailable, keepInitialAvailableOnReady, serverUpdateKey, supportedCountries, onServerUpdate, onAvailabilityChange, onElementMount, onElementRetry, onCancel, onError, onPaymentInfoSubmitted, onPaymentRejected, onSuccess, onEmbeddedComplete, onVerificationPending, unsupportedCountryMessage, }: StripeCheckoutExpressCheckoutButtonProps): import("react/jsx-runtime").JSX.Element;
49
+ export declare function StripeCheckoutExpressCheckoutButton({ beforeConfirm, checkoutAnalytics, checkoutSessionId, returnUrl, confirmEmail, customerEmail, className, options, availabilityPaymentMethods, initialAvailable, keepInitialAvailableOnReady, serverUpdateKey, supportedCountries, onServerUpdate, onAvailabilityChange, onElementMount, onElementRetry, onCancel, onError, onPaymentInfoSubmitted, onPaymentRejected, onSuccess, onEmbeddedComplete, onVerificationPending, stripePromise, unsupportedCountryMessage, }: StripeCheckoutExpressCheckoutButtonProps): import("react/jsx-runtime").JSX.Element;
@@ -8,6 +8,7 @@ import { ExpressCheckoutElement, useCheckout, } from '@stripe/react-stripe-js/ch
8
8
  import { queueStripeSubscriptionCheckoutStarted, trackPaidStripeSubscriptionCheckoutCompleted, trackStripeSubscriptionPaymentInfoSubmitted, } from '../services/checkoutCompletionAnalytics.service.js';
9
9
  import { getUnsupportedCheckoutCountryMessage, normalizeSupportedCheckoutCountries, } from './checkoutCountries.js';
10
10
  import { trackCheckoutCanceled, trackCheckoutFailureShown, } from '../../../services/checkoutObservability.service.js';
11
+ import { createManualWalletPaymentMethod, ManualWalletExpressCheckoutElement } from './ManualWalletExpressCheckoutElement.js';
11
12
  import { isStripeCheckoutAlreadyPaidError, normalizeStripeCheckoutError } from '../services/stripeCheckoutError.js';
12
13
  const ExpressCheckoutElementWithCancel = ExpressCheckoutElement;
13
14
  const WALLET_DECLINE_SHEET_MESSAGE = 'Your bank declined this card. Choose another card or approve the payment in your bank app.';
@@ -34,8 +35,9 @@ const buildDefaultOptions = () => ({
34
35
  paypal: 'never',
35
36
  },
36
37
  });
37
- export function StripeCheckoutExpressCheckoutButton({ beforeConfirm, checkoutAnalytics, checkoutSessionId, returnUrl, confirmEmail = true, customerEmail, className, options, availabilityPaymentMethods = ['applePay'], initialAvailable, keepInitialAvailableOnReady = false, serverUpdateKey, supportedCountries, onServerUpdate, onAvailabilityChange, onElementMount, onElementRetry, onCancel, onError, onPaymentInfoSubmitted, onPaymentRejected, onSuccess, onEmbeddedComplete, onVerificationPending, unsupportedCountryMessage, }) {
38
+ export function StripeCheckoutExpressCheckoutButton({ beforeConfirm, checkoutAnalytics, checkoutSessionId, returnUrl, confirmEmail = true, customerEmail, className, options, availabilityPaymentMethods = ['applePay'], initialAvailable, keepInitialAvailableOnReady = false, serverUpdateKey, supportedCountries, onServerUpdate, onAvailabilityChange, onElementMount, onElementRetry, onCancel, onError, onPaymentInfoSubmitted, onPaymentRejected, onSuccess, onEmbeddedComplete, onVerificationPending, stripePromise, unsupportedCountryMessage, }) {
38
39
  const checkoutState = useCheckout();
40
+ const manualWalletRef = useRef({ elements: null, stripe: null });
39
41
  const [completed, setCompleted] = useState(false);
40
42
  const completedRef = useRef(false);
41
43
  const verificationInFlightRef = useRef(false);
@@ -196,7 +198,7 @@ export function StripeCheckoutExpressCheckoutButton({ beforeConfirm, checkoutAna
196
198
  }
197
199
  };
198
200
  const handleConfirm = async (event) => {
199
- var _a, _b, _c;
201
+ var _a, _b, _c, _d;
200
202
  if (completedRef.current)
201
203
  return;
202
204
  // Checkout Sessions omits the Express Checkout onClick callback. Confirmation
@@ -267,9 +269,21 @@ export function StripeCheckoutExpressCheckoutButton({ beforeConfirm, checkoutAna
267
269
  await trackStripeSubscriptionPaymentInfoSubmitted(Object.assign({ checkoutSessionId }, checkoutAnalytics)).catch(() => 'analytics_rejected');
268
270
  }
269
271
  await (onPaymentInfoSubmitted === null || onPaymentInfoSubmitted === void 0 ? void 0 : onPaymentInfoSubmitted());
270
- const result = await checkoutState.checkout.confirm(Object.assign(Object.assign({}, (confirmEmail
272
+ let paymentMethodId = null;
273
+ if (stripePromise) {
274
+ const created = await createManualWalletPaymentMethod(manualWalletRef.current);
275
+ if ('error' in created) {
276
+ const message = ((_d = created.error) === null || _d === void 0 ? void 0 : _d.message) || 'Wallet checkout is not ready yet.';
277
+ reportFailure(message, 'wallet_payment_method', event.expressPaymentType, created.error);
278
+ event.paymentFailed({ reason: 'fail', message });
279
+ return;
280
+ }
281
+ // Creating the PaymentMethod closed the wallet sheet; the charge result shows on the page.
282
+ paymentMethodId = created.paymentMethodId;
283
+ }
284
+ const result = await checkoutState.checkout.confirm(Object.assign(Object.assign(Object.assign({}, (confirmEmail
271
285
  ? { email: preparedCustomerEmail || (customerEmail === null || customerEmail === void 0 ? void 0 : customerEmail.trim()) || undefined }
272
- : {})), { expressCheckoutConfirmEvent: event, redirect: 'if_required' }));
286
+ : {})), (paymentMethodId ? { paymentMethod: paymentMethodId } : { expressCheckoutConfirmEvent: event })), { redirect: 'if_required' }));
273
287
  if (result.type === 'error' && !isStripeCheckoutAlreadyPaidError(result.error)) {
274
288
  const message = result.error.message || 'Wallet checkout failed.';
275
289
  const details = reportFailure(message, 'wallet_confirmation', event.expressPaymentType, result.error);
@@ -279,12 +293,15 @@ export function StripeCheckoutExpressCheckoutButton({ beforeConfirm, checkoutAna
279
293
  message,
280
294
  paymentMethod: details.paymentMethod,
281
295
  });
296
+ if (paymentMethodId)
297
+ return;
282
298
  // Apple Pay shows a custom sheet message only for invalid_payment_data;
283
299
  // with 'fail' it shows a generic error and customers retry the same card.
284
300
  event.paymentFailed({ reason: 'invalid_payment_data', message: WALLET_DECLINE_SHEET_MESSAGE });
285
301
  return;
286
302
  }
287
- event.paymentFailed({ reason: 'fail', message });
303
+ if (!paymentMethodId)
304
+ event.paymentFailed({ reason: 'fail', message });
288
305
  return;
289
306
  }
290
307
  onError === null || onError === void 0 ? void 0 : onError(null);
@@ -323,6 +340,43 @@ export function StripeCheckoutExpressCheckoutButton({ beforeConfirm, checkoutAna
323
340
  }
324
341
  onCancel === null || onCancel === void 0 ? void 0 : onCancel();
325
342
  };
343
+ const elementHandlers = {
344
+ onCancel: handleCancel,
345
+ onClick: (event) => void handleClick(event),
346
+ onConfirm: (event) => void handleConfirm(event),
347
+ onLoadError: ({ error }) => {
348
+ if (loadRetryTimerRef.current !== null) {
349
+ return;
350
+ }
351
+ if (!walletReadyRef.current && !loadRetryUsedRef.current) {
352
+ loadRetryUsedRef.current = true;
353
+ onElementRetry === null || onElementRetry === void 0 ? void 0 : onElementRetry();
354
+ // Replace only the failed Element, retaining the Checkout Session.
355
+ loadRetryTimerRef.current = setTimeout(() => {
356
+ loadRetryTimerRef.current = null;
357
+ setLoadRetry(1);
358
+ }, 1000);
359
+ return;
360
+ }
361
+ setWalletAvailable(false);
362
+ onAvailabilityChange === null || onAvailabilityChange === void 0 ? void 0 : onAvailabilityChange(false);
363
+ reportFailure(error.message || 'Unable to load wallet checkout.', 'wallet_load');
364
+ },
365
+ onReady: ({ availablePaymentMethods: availablePaymentMethodsMap }) => {
366
+ walletReadyRef.current = true;
367
+ if (loadRetryTimerRef.current !== null) {
368
+ clearTimeout(loadRetryTimerRef.current);
369
+ loadRetryTimerRef.current = null;
370
+ }
371
+ const available = Boolean(availabilityPaymentMethods.some((paymentMethod) => availablePaymentMethodsMap === null || availablePaymentMethodsMap === void 0 ? void 0 : availablePaymentMethodsMap[paymentMethod]));
372
+ const resolvedAvailable = available || (keepInitialAvailableOnReady && initialAvailable === true);
373
+ setWalletAvailable(resolvedAvailable);
374
+ onAvailabilityChange === null || onAvailabilityChange === void 0 ? void 0 : onAvailabilityChange(resolvedAvailable);
375
+ if (resolvedAvailable) {
376
+ onError === null || onError === void 0 ? void 0 : onError(null);
377
+ }
378
+ },
379
+ };
326
380
  const inertWhileUpdating = (serverUpdatePending ? { inert: true } : {});
327
381
  if (verificationError && !completed)
328
382
  return _jsxs("div", { className: 'bg-background text-foreground p-6', children: [_jsx("p", { role: 'alert', children: verificationError }), _jsx("button", { type: 'button', disabled: verificationInFlight, className: 'bg-accent text-foreground border-border rounded border p-3', onClick: () => void verifyPaywall(), children: "Check payment status" })] });
@@ -335,37 +389,7 @@ export function StripeCheckoutExpressCheckoutButton({ beforeConfirm, checkoutAna
335
389
  serverUpdatePending ? 'is-server-update-pending' : '',
336
390
  ]
337
391
  .filter(Boolean)
338
- .join(' '), children: _jsx(ExpressCheckoutElementWithCancel, { options: resolvedOptions, onCancel: handleCancel, onClick: handleClick, onConfirm: (event) => void handleConfirm(event), onLoadError: ({ error }) => {
339
- if (loadRetryTimerRef.current !== null) {
340
- return;
341
- }
342
- if (!walletReadyRef.current && !loadRetryUsedRef.current) {
343
- loadRetryUsedRef.current = true;
344
- onElementRetry === null || onElementRetry === void 0 ? void 0 : onElementRetry();
345
- // Replace only the failed Element, retaining the Checkout Session.
346
- loadRetryTimerRef.current = setTimeout(() => {
347
- loadRetryTimerRef.current = null;
348
- setLoadRetry(1);
349
- }, 1000);
350
- return;
351
- }
352
- setWalletAvailable(false);
353
- onAvailabilityChange === null || onAvailabilityChange === void 0 ? void 0 : onAvailabilityChange(false);
354
- reportFailure(error.message || 'Unable to load wallet checkout.', 'wallet_load');
355
- }, onReady: ({ availablePaymentMethods: availablePaymentMethodsMap }) => {
356
- walletReadyRef.current = true;
357
- if (loadRetryTimerRef.current !== null) {
358
- clearTimeout(loadRetryTimerRef.current);
359
- loadRetryTimerRef.current = null;
360
- }
361
- const available = Boolean(availabilityPaymentMethods.some((paymentMethod) => availablePaymentMethodsMap === null || availablePaymentMethodsMap === void 0 ? void 0 : availablePaymentMethodsMap[paymentMethod]));
362
- const resolvedAvailable = available || (keepInitialAvailableOnReady && initialAvailable === true);
363
- setWalletAvailable(resolvedAvailable);
364
- onAvailabilityChange === null || onAvailabilityChange === void 0 ? void 0 : onAvailabilityChange(resolvedAvailable);
365
- if (resolvedAvailable) {
366
- onError === null || onError === void 0 ? void 0 : onError(null);
367
- }
368
- } }, loadRetry) })), _jsx("style", { children: stripeExpressCheckoutButtonStyles })] }));
392
+ .join(' '), children: stripePromise ? (_jsx(ManualWalletExpressCheckoutElement, Object.assign({}, elementHandlers, { checkout: checkoutState.type === 'success' ? checkoutState.checkout : null, options: resolvedOptions, stripePromise: stripePromise, walletRef: manualWalletRef }), loadRetry)) : (_jsx(ExpressCheckoutElementWithCancel, Object.assign({}, elementHandlers, { options: resolvedOptions }), loadRetry)) })), _jsx("style", { children: stripeExpressCheckoutButtonStyles })] }));
369
393
  }
370
394
  const stripeExpressCheckoutButtonStyles = `
371
395
  .stripe-express-checkout-button {
@@ -15,5 +15,5 @@ import { CheckoutProvider } from '@stripe/react-stripe-js/checkout';
15
15
  import { StripeCheckoutExpressCheckoutButton, } from './StripeCheckoutExpressCheckoutButton.js';
16
16
  export function StripeExpressCheckoutElement(_a) {
17
17
  var { appearance, clientSecret, stripePromise } = _a, buttonProps = __rest(_a, ["appearance", "clientSecret", "stripePromise"]);
18
- return (_jsx(CheckoutProvider, { stripe: stripePromise, options: Object.assign({ clientSecret }, (appearance ? { elementsOptions: { appearance } } : {})), children: _jsx(StripeCheckoutExpressCheckoutButton, Object.assign({}, buttonProps)) }, clientSecret));
18
+ return (_jsx(CheckoutProvider, { stripe: stripePromise, options: Object.assign({ clientSecret }, (appearance ? { elementsOptions: { appearance } } : {})), children: _jsx(StripeCheckoutExpressCheckoutButton, Object.assign({}, buttonProps, { stripePromise: stripePromise })) }, clientSecret));
19
19
  }
@@ -236,7 +236,7 @@ export function StripeWalletFirstCheckout(props) {
236
236
  if (!confirmedEmail)
237
237
  setBusy(false);
238
238
  return confirmedEmail;
239
- }, checkoutAnalytics: checkoutAnalytics, checkoutSessionId: checkoutSessionId, customerEmail: emailController ? email.resolvedCustomerEmail : props.customerEmail, customerName: props.customerName, initialAvailable: props.initialWalletAvailable, onAvailabilityChange: setWalletAvailable, 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, { blockId: 'wallet', checkoutSessionId, failureStage: 'wallet', paymentMethod: wallet }, details, true); }, onPaymentInfoSubmitted: props.onPaymentInfoSubmitted, onPaymentRejected: () => { setBusy(false); select('card'); }, onSuccess: async () => { await status.trackSuccess(walletPayment); }, onVerificationPending: () => status.markConfirmed(walletPayment), processingLabel: copy.processingLabel, returnUrl: props.returnUrl, summaryLabel: props.summaryLabel, supportedCountries: countries.supported, unavailableNote: copy.walletUnavailableNote.replace('{wallet}', copy.walletLabels[wallet]), unsupportedCountryMessage: countries.message, 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'));
239
+ }, checkoutAnalytics: checkoutAnalytics, checkoutSessionId: checkoutSessionId, customerEmail: emailController ? email.resolvedCustomerEmail : props.customerEmail, customerName: props.customerName, initialAvailable: props.initialWalletAvailable, onAvailabilityChange: setWalletAvailable, 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, { blockId: 'wallet', checkoutSessionId, failureStage: 'wallet', paymentMethod: wallet }, details, true); }, onPaymentInfoSubmitted: props.onPaymentInfoSubmitted, onPaymentRejected: () => { setBusy(false); select('card'); }, onSuccess: async () => { await status.trackSuccess(walletPayment); }, onVerificationPending: () => status.markConfirmed(walletPayment), processingLabel: copy.processingLabel, returnUrl: props.returnUrl, stripePromise: stripePromise, summaryLabel: props.summaryLabel, supportedCountries: countries.supported, unavailableNote: copy.walletUnavailableNote.replace('{wallet}', copy.walletLabels[wallet]), unsupportedCountryMessage: countries.message, 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'));
240
240
  }
241
241
  if (block.kind === 'card') {
242
242
  const brands = ((_a = props.cardBrandLabels) === null || _a === void 0 ? void 0 : _a.length)
@@ -8,7 +8,7 @@ export type WalletButtonSession = {
8
8
  /** Stripe's `colorPrimary`, e.g. the funnel's theme color. */
9
9
  themeColor?: string;
10
10
  };
11
- export type WalletButtonProps = Pick<StripeCheckoutExpressCheckoutButtonProps, 'amountCents' | 'beforeConfirm' | 'checkoutAnalytics' | 'checkoutSessionId' | 'customerEmail' | 'customerName' | 'onAvailabilityChange' | 'onCancel' | 'onEmbeddedComplete' | 'onError' | 'onPaymentInfoSubmitted' | 'onPaymentRejected' | 'onSuccess' | 'onVerificationPending' | 'returnUrl' | 'summaryLabel' | 'supportedCountries' | 'unsupportedCountryMessage'> & {
11
+ export type WalletButtonProps = Pick<StripeCheckoutExpressCheckoutButtonProps, 'amountCents' | 'beforeConfirm' | 'checkoutAnalytics' | 'checkoutSessionId' | 'customerEmail' | 'customerName' | 'onAvailabilityChange' | 'onCancel' | 'onEmbeddedComplete' | 'onError' | 'onPaymentInfoSubmitted' | 'onPaymentRejected' | 'onSuccess' | 'onVerificationPending' | 'returnUrl' | 'stripePromise' | 'summaryLabel' | 'supportedCountries' | 'unsupportedCountryMessage'> & {
12
12
  /** Availability known from an earlier render: the button shows without the progress bar. */
13
13
  initialAvailable?: boolean | null;
14
14
  wallet: PlatformWalletPaymentMethod;
@@ -31,7 +31,7 @@ export function WalletButton(_a) {
31
31
  var { session } = _a, slot = __rest(_a, ["session"]);
32
32
  if (!session)
33
33
  return _jsx(WalletSlot, Object.assign({}, slot));
34
- return (_jsxs(_Fragment, { children: [session.clientSecret && session.stripePromise ? (_jsx(CheckoutProvider, { stripe: session.stripePromise, options: buildWalletFirstCheckoutOptions(session.clientSecret, session.themeColor), children: _jsx(WalletSlot, Object.assign({}, slot)) }, session.clientSecret)) : (_jsx("div", { className: 'wfc-wallet-slot', children: _jsx("span", { className: 'wfc-progress', role: 'status', "aria-label": slot.processingLabel }) })), _jsx("style", { children: walletButtonStyles })] }));
34
+ return (_jsxs(_Fragment, { children: [session.clientSecret && session.stripePromise ? (_jsx(CheckoutProvider, { stripe: session.stripePromise, options: buildWalletFirstCheckoutOptions(session.clientSecret, session.themeColor), children: _jsx(WalletSlot, Object.assign({}, slot, { stripePromise: session.stripePromise })) }, session.clientSecret)) : (_jsx("div", { className: 'wfc-wallet-slot', children: _jsx("span", { className: 'wfc-progress', role: 'status', "aria-label": slot.processingLabel }) })), _jsx("style", { children: walletButtonStyles })] }));
35
35
  }
36
36
  function WalletSlot(_a) {
37
37
  var { initialAvailable = null, onAvailabilityChange, processingLabel, unavailableNote, wallet } = _a, button = __rest(_a, ["initialAvailable", "onAvailabilityChange", "processingLabel", "unavailableNote", "wallet"]);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnelsgrove/payments",
3
- "version": "0.75.0",
3
+ "version": "0.77.0",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/The-Solid-Grove/funnelsgrove.git",
@@ -46,11 +46,11 @@
46
46
  "jsdom": "20.0.3",
47
47
  "typescript": "^5",
48
48
  "vitest": "^3.2.4",
49
- "@funnelsgrove/runtime": "0.47.0",
50
- "@funnelsgrove/analytics": "0.30.0"
49
+ "@funnelsgrove/runtime": "0.48.0",
50
+ "@funnelsgrove/analytics": "0.31.0"
51
51
  },
52
52
  "peerDependencies": {
53
- "@funnelsgrove/runtime": "^0.47.0",
54
- "@funnelsgrove/analytics": "^0.30.0"
53
+ "@funnelsgrove/runtime": "^0.48.0",
54
+ "@funnelsgrove/analytics": "^0.31.0"
55
55
  }
56
56
  }