@funnelsgrove/payments 0.22.6 → 0.23.2

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.
Files changed (32) hide show
  1. package/README.md +27 -0
  2. package/dist/components/CheckoutEmailDialog.js +12 -13
  3. package/dist/config/billing.config.d.ts +3 -0
  4. package/dist/index.d.ts +1 -0
  5. package/dist/index.js +1 -0
  6. package/dist/providers/solidgate/components/SolidgateCheckoutDialog.d.ts +1 -1
  7. package/dist/providers/solidgate/components/SolidgateCheckoutDialog.js +19 -10
  8. package/dist/providers/solidgate/components/SolidgateCheckoutDialog.types.d.ts +3 -1
  9. package/dist/providers/stripe/components/StripeWalletSurface.internal.d.ts +2 -1
  10. package/dist/providers/stripe/components/StripeWalletSurface.internal.js +13 -33
  11. package/dist/providers/stripe/hooks/useStripeOneTimeCheckoutSession.d.ts +3 -1
  12. package/dist/providers/stripe/hooks/useStripeOneTimeCheckoutSession.js +29 -7
  13. package/dist/providers/stripe/hooks/useStripeSubscriptionCheckoutSession.d.ts +3 -1
  14. package/dist/providers/stripe/hooks/useStripeSubscriptionCheckoutSession.js +31 -9
  15. package/dist/providers/stripe/services/checkout/requests.d.ts +39 -29
  16. package/dist/providers/stripe/services/checkout/requests.js +12 -32
  17. package/dist/providers/stripe/services/checkoutCompletionAnalytics.service.d.ts +2 -1
  18. package/dist/providers/stripe/services/checkoutCompletionAnalytics.service.js +2 -2
  19. package/dist/providers/stripe/services/hostedCheckout/requests.d.ts +12 -10
  20. package/dist/providers/stripe/services/hostedCheckout/requests.js +4 -27
  21. package/dist/providers/stripe/services/oneClick/requests.d.ts +9 -8
  22. package/dist/providers/stripe/services/oneClick/requests.js +2 -20
  23. package/dist/providers/stripe/services/oneClick/types.d.ts +3 -1
  24. package/dist/services/checkoutObservability.service.d.ts +2 -1
  25. package/dist/services/checkoutObservability.service.js +1 -1
  26. package/dist/services/paywallOffer.service.js +19 -8
  27. package/dist/services/paywallPlans/types.d.ts +4 -2
  28. package/dist/services/publishedBillingRuntime.service.d.ts +23 -2
  29. package/dist/services/publishedBillingRuntime.service.js +38 -4
  30. package/dist/services/usePinnedPublishedBillingRuntime.d.ts +10 -0
  31. package/dist/services/usePinnedPublishedBillingRuntime.js +23 -0
  32. package/package.json +5 -5
package/README.md CHANGED
@@ -68,6 +68,23 @@ unchanged. Set `errorMessagePolicy: 'content'` to render load/cancel failures fr
68
68
  the content's `errorMessages`. The default `'server'` policy preserves existing
69
69
  error rendering independently of the selected labels.
70
70
 
71
+ ## Checkout email prompt
72
+
73
+ When the access email is missing or invalid, wallet surfaces render nothing.
74
+ The funnel's primary payment CTA (such as Get My Plan) opens `CheckoutEmailDialog`
75
+ and saves the email through the existing caller-owned identity update. Once the
76
+ caller adopts the saved email, wallet controls can mount. Provider email rejections
77
+ still open the surface's repair dialog; saving never confirms the old session.
78
+
79
+ `CheckoutEmailDialog` defaults to a light surface regardless of the browser or
80
+ ancestor theme. It inherits the funnel font. Set inherited `--checkout-email-*`
81
+ CSS variables on the funnel root or `.checkout-email-dialog` to customize it:
82
+ `background`, `foreground`, `muted`, `border`, `input-background`,
83
+ `button-background`, `button-foreground`, `focus`, and `error`.
84
+ For example, `--checkout-email-button-background: var(--color-primary)` uses the
85
+ funnel accent. Set foreground/background pairs together for custom dark surfaces.
86
+ Existing `dialog.checkout-email-dialog` CSS overrides continue to work.
87
+
71
88
  ## Advanced Wallet Primitives
72
89
 
73
90
  `ApplePaySubscriptionCheckoutSlot`, `GooglePaySubscriptionCheckoutSlot`, and `WalletSubscriptionCheckoutSlot` stay exported and runtime-compatible. They are backward-compatible advanced low-level primitives: reach for them only when a placement needs wiring the shared wallet surfaces do not cover. Never share one checkout hook result across placements; give each visible placement its own session.
@@ -194,3 +211,13 @@ including legacy wallet launchers. Mount it before wallet launch, persist throug
194
211
  `isValidCheckoutEmail` and `isCheckoutEmailError` share validation and recovery
195
212
  classification. `onCustomerEmailChange` in the card dialog reports a committed
196
213
  email, not each draft keystroke, so typing cannot prepare sessions for unsaved input.
214
+
215
+ ## Offer price money
216
+
217
+ Published plans expose optional `money: ProviderMoney`; new mappings supply it. Discount presentation and purchase analytics use its amount, currency and exponent. `amountCents` remains a legacy wire alias and does not define the scale of structured money. Independent plans can use different currencies. Currency is selected by the provider price, not by an Offer Set setting.
218
+
219
+ ### Published offer selection and checkout attempts
220
+
221
+ Use `resolvePublishedBillingRuntimeState` with configuration, browser locale and experiment assignments that are ready. Its result is `pending`, `resolved` or `error`. Pending/error states must not prepare Stripe card/wallet or Solidgate checkout; the maintained templates render an inert zero-plan state rather than a starter catalog.
222
+
223
+ `usePinnedPublishedBillingRuntime` holds the complete resolved catalog at the first payment preparation. Wire its `pin` callback to preparation and release both the payment session and this snapshot on explicit reset. Displayed prices, provider, revision, source version, locale and experiment assignment then remain consistent through background updates. The visitor can still choose another plan within the pinned offer set. A new attempt after reset can adopt the latest configuration.
@@ -47,20 +47,19 @@ export function CheckoutEmailDialog({ customerEmail, rejectedEmail, onSave, onCl
47
47
  if (!busyRef.current)
48
48
  onClose();
49
49
  }, children: [_jsxs("form", { onSubmit: submit, noValidate: true, "aria-busy": busy, children: [_jsx("h2", { id: titleId, children: title }), _jsx("p", { children: description }), _jsxs("label", { children: [emailLabel, _jsx("input", { type: 'email', autoComplete: 'email', inputMode: 'email', autoFocus: true, className: 'bg-background text-foreground border-border', value: draft, placeholder: placeholder, disabled: busy, "aria-invalid": Boolean(error), "aria-describedby": error ? errorId : undefined, onChange: (event) => { setDraft(event.target.value); setError(null); } })] }), error ? _jsx("p", { id: errorId, role: 'alert', children: error }) : null, _jsxs("div", { className: 'checkout-email-dialog-actions', children: [_jsx("button", { type: 'button', className: 'bg-background text-foreground border-border', disabled: busy, onClick: onClose, children: cancelLabel }), _jsx("button", { type: 'submit', className: 'bg-accent text-foreground border-border', disabled: busy, children: busy ? 'Saving…' : continueLabel })] })] }), _jsx("style", { children: `
50
- .checkout-email-dialog { color-scheme: light dark; box-sizing: border-box; width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; margin: auto; padding: 24px; border: 1px solid GrayText; border-radius: 20px; background: Canvas; color: CanvasText; font: inherit; }
51
- .dark .checkout-email-dialog, [data-theme=dark] .checkout-email-dialog { color-scheme: dark; }
52
- .light .checkout-email-dialog, [data-theme=light] .checkout-email-dialog { color-scheme: light; }
53
- .checkout-email-dialog::backdrop { background: rgb(0 0 0 / 45%); }
54
- .checkout-email-dialog h2 { color: inherit; margin: 0 0 12px; font-size: 24px; line-height: 1.2; }
55
- .checkout-email-dialog p { margin: 0 0 20px; line-height: 1.5; }
56
- .checkout-email-dialog label { display: grid; gap: 8px; }
57
- .checkout-email-dialog input { box-sizing: border-box; width: 100%; min-height: 48px; padding: 12px; border: 1px solid GrayText; border-radius: 10px; background: Canvas; color: CanvasText; font: inherit; font-size: 16px; }
58
- .checkout-email-dialog input::placeholder { color: GrayText; }
59
- .checkout-email-dialog [role=alert] { margin-top: 12px; font-weight: 600; }
50
+ .checkout-email-dialog { color-scheme: light; box-sizing: border-box; width: min(420px, calc(100vw - 32px)); max-height: calc(100dvh - 32px); overflow-y: auto; margin: auto; padding: 24px; border: 1px solid var(--checkout-email-border, #e3e6ed); border-radius: 24px; background: var(--checkout-email-background, #fff); color: var(--checkout-email-foreground, #252936); box-shadow: 0 24px 64px rgb(0 0 0 / 18%), 0 4px 16px rgb(0 0 0 / 6%); font: inherit; }
51
+ .checkout-email-dialog::backdrop { background: rgb(0 0 0 / 35%); }
52
+ .checkout-email-dialog h2 { color: inherit; margin: 0 0 8px; font-size: 24px; line-height: 1.2; }
53
+ .checkout-email-dialog p { color: var(--checkout-email-muted, #626978); margin: 0 0 20px; line-height: 1.5; }
54
+ .checkout-email-dialog label { display: grid; gap: 8px; font-weight: 600; }
55
+ .checkout-email-dialog input { box-sizing: border-box; width: 100%; min-height: 48px; padding: 12px; border: 1px solid var(--checkout-email-border, #e3e6ed); border-radius: 12px; background: var(--checkout-email-input-background, #f7f8fb); color: inherit; font: inherit; font-size: 16px; }
56
+ .checkout-email-dialog input::placeholder { color: var(--checkout-email-muted, #626978); }
57
+ .checkout-email-dialog [role=alert] { margin-top: 12px; color: var(--checkout-email-error, #b42318); font-weight: 600; }
60
58
  .checkout-email-dialog-actions { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 24px; }
61
- .checkout-email-dialog button { flex: 1; padding: 12px; min-height: 48px; border: 1px solid GrayText; border-radius: 10px; background: Canvas; color: CanvasText; font: inherit; cursor: pointer; }
62
- .checkout-email-dialog button[type=submit] { font-weight: 700; border: 2px solid CanvasText; }
59
+ .checkout-email-dialog button { flex: 1; padding: 12px; min-height: 48px; border: 1px solid var(--checkout-email-border, #e3e6ed); border-radius: 12px; background: var(--checkout-email-background, #fff); color: inherit; font: inherit; cursor: pointer; }
60
+ .checkout-email-dialog button[type=submit] { font-weight: 700; border-color: transparent; background: var(--checkout-email-button-background, #3156d3); color: var(--checkout-email-button-foreground, #fff); }
61
+ .checkout-email-dialog button:hover:not(:disabled) { filter: brightness(.96); }
63
62
  .checkout-email-dialog button:disabled { opacity: .6; cursor: wait; }
64
- .checkout-email-dialog :focus-visible { outline: 2px solid Highlight; outline-offset: 3px; }
63
+ .checkout-email-dialog :focus-visible { outline: 2px solid var(--checkout-email-focus, #3156d3); outline-offset: 3px; }
65
64
  ` })] }));
66
65
  }
@@ -1,3 +1,4 @@
1
+ import type { ProviderMoney } from '@funnelsgrove/runtime';
1
2
  export type BillingPlanComparison = {
2
3
  perDay: string;
3
4
  perWeek: string;
@@ -16,6 +17,8 @@ export type BillingPlanConfig = {
16
17
  featuredTag?: string;
17
18
  perDayAmount: string;
18
19
  amountCents: number;
20
+ money?: ProviderMoney;
21
+ currency?: string;
19
22
  analyticsPurchaseValue?: number;
20
23
  checkoutSummaryLabel?: string;
21
24
  followUpProviderPlanId?: string;
package/dist/index.d.ts CHANGED
@@ -5,6 +5,7 @@ export * from './services/planCatalog.service.js';
5
5
  export * from './services/paywallPlans.service.js';
6
6
  export * from './services/runtimeBillingPlanCatalog.service.js';
7
7
  export * from './services/publishedBillingRuntime.service.js';
8
+ export * from './services/usePinnedPublishedBillingRuntime.js';
8
9
  export * from './services/paywallOffer.service.js';
9
10
  export * from './services/paymentMethodAnalytics.service.js';
10
11
  export * from './services/checkoutObservability.service.js';
package/dist/index.js CHANGED
@@ -6,6 +6,7 @@ export * from './services/planCatalog.service.js';
6
6
  export * from './services/paywallPlans.service.js';
7
7
  export * from './services/runtimeBillingPlanCatalog.service.js';
8
8
  export * from './services/publishedBillingRuntime.service.js';
9
+ export * from './services/usePinnedPublishedBillingRuntime.js';
9
10
  export * from './services/paywallOffer.service.js';
10
11
  export * from './services/paymentMethodAnalytics.service.js';
11
12
  export * from './services/checkoutObservability.service.js';
@@ -1,3 +1,3 @@
1
1
  import type { SolidgateCheckoutDialogProps } from './SolidgateCheckoutDialog.types.js';
2
2
  export type { SolidgateCheckoutDialogState, SolidgateCheckoutDialogContent, SolidgateCheckoutDialogPresentation, SolidgateCheckoutDialogProps, SolidgateCheckoutAnalyticsContext, } from './SolidgateCheckoutDialog.types.js';
3
- export declare function SolidgateCheckoutDialog({ open, request, customerEmail, checkoutAnalytics, content, presentation, onClose, onCustomerEmailCommit, onSuccess, onRetry, onError, onStateChange, }: SolidgateCheckoutDialogProps): import("react/jsx-runtime").JSX.Element | null;
3
+ export declare function SolidgateCheckoutDialog({ open, request, customerEmail, checkoutAnalytics, content, presentation, onClose, onCustomerEmailCommit, onSuccess, onRetry, onError, onPreparationStart, onStateChange, }: SolidgateCheckoutDialogProps): import("react/jsx-runtime").JSX.Element | null;
@@ -65,7 +65,7 @@ const trackSolidgateCheckoutEvent = async (eventName, attemptId, context) => {
65
65
  }
66
66
  };
67
67
  const isAbortError = (error) => (error instanceof DOMException && error.name === 'AbortError');
68
- export function SolidgateCheckoutDialog({ open, request, customerEmail, checkoutAnalytics, content, presentation, onClose, onCustomerEmailCommit, onSuccess, onRetry, onError, onStateChange, }) {
68
+ export function SolidgateCheckoutDialog({ open, request, customerEmail, checkoutAnalytics, content, presentation, onClose, onCustomerEmailCommit, onSuccess, onRetry, onError, onPreparationStart, onStateChange, }) {
69
69
  const copy = useMemo(() => (Object.assign(Object.assign({}, defaultContent), content)), [content]);
70
70
  const [view, setView] = useState(initialView);
71
71
  const [retryRequest, setRetryRequest] = useState(null);
@@ -76,6 +76,7 @@ export function SolidgateCheckoutDialog({ open, request, customerEmail, checkout
76
76
  const [emailSubmitting, setEmailSubmitting] = useState(false);
77
77
  const [mountedPaymentAttemptId, setMountedPaymentAttemptId] = useState(null);
78
78
  const prepareAbortRef = useRef(null);
79
+ const preparedRequestRef = useRef(null);
79
80
  const statusAbortRef = useRef(null);
80
81
  const successAttemptRef = useRef(null);
81
82
  const paymentInfoAttemptRef = useRef(null);
@@ -146,6 +147,8 @@ export function SolidgateCheckoutDialog({ open, request, customerEmail, checkout
146
147
  runtimeFunnelId,
147
148
  successUrl,
148
149
  ]);
150
+ const latestRequestRef = useRef(normalizedRequest);
151
+ latestRequestRef.current = normalizedRequest;
149
152
  const setState = useCallback((nextView) => {
150
153
  var _a;
151
154
  setView(nextView);
@@ -167,8 +170,9 @@ export function SolidgateCheckoutDialog({ open, request, customerEmail, checkout
167
170
  }, []);
168
171
  const requiresEmailCommit = Boolean(onCustomerEmailCommit);
169
172
  useEffect(() => {
170
- var _a, _b, _c, _d, _e, _f;
173
+ var _a, _b, _c, _d, _e, _f, _g;
171
174
  if (!open) {
175
+ preparedRequestRef.current = null;
172
176
  (_a = prepareAbortRef.current) === null || _a === void 0 ? void 0 : _a.abort();
173
177
  (_b = statusAbortRef.current) === null || _b === void 0 ? void 0 : _b.abort();
174
178
  return;
@@ -184,8 +188,10 @@ export function SolidgateCheckoutDialog({ open, request, customerEmail, checkout
184
188
  return;
185
189
  }
186
190
  const controller = new AbortController();
187
- (_e = prepareAbortRef.current) === null || _e === void 0 ? void 0 : _e.abort();
188
- (_f = statusAbortRef.current) === null || _f === void 0 ? void 0 : _f.abort();
191
+ onPreparationStart === null || onPreparationStart === void 0 ? void 0 : onPreparationStart();
192
+ const preparedRequest = (_e = preparedRequestRef.current) !== null && _e !== void 0 ? _e : (preparedRequestRef.current = latestRequestRef.current);
193
+ (_f = prepareAbortRef.current) === null || _f === void 0 ? void 0 : _f.abort();
194
+ (_g = statusAbortRef.current) === null || _g === void 0 ? void 0 : _g.abort();
189
195
  prepareAbortRef.current = controller;
190
196
  successAttemptRef.current = null;
191
197
  paymentInfoAttemptRef.current = null;
@@ -195,7 +201,7 @@ export function SolidgateCheckoutDialog({ open, request, customerEmail, checkout
195
201
  setState(initialView);
196
202
  }
197
203
  });
198
- void prepareSolidgateCheckout(Object.assign(Object.assign({}, normalizedRequest), { signal: controller.signal }))
204
+ void prepareSolidgateCheckout(Object.assign(Object.assign({}, preparedRequest), { signal: controller.signal }))
199
205
  .then((checkout) => {
200
206
  if (!controller.signal.aborted) {
201
207
  setState({ state: 'ready', checkout, canResumeVerification: false });
@@ -211,7 +217,7 @@ export function SolidgateCheckoutDialog({ open, request, customerEmail, checkout
211
217
  }
212
218
  });
213
219
  return () => controller.abort();
214
- }, [committedEmail, normalizedRequest, open, requiresEmailCommit, setState, trackFailure]);
220
+ }, [checkoutKey, committedEmail, onPreparationStart, open, requiresEmailCommit, setState, trackFailure]);
215
221
  const paymentFormMounted = Boolean(view.checkout && mountedPaymentAttemptId === view.checkout.attemptId);
216
222
  const showPreparingLoader = view.state === 'loading'
217
223
  || (view.state === 'ready' && !paymentFormMounted);
@@ -395,8 +401,11 @@ export function SolidgateCheckoutDialog({ open, request, customerEmail, checkout
395
401
  setState(Object.assign(Object.assign({}, view), { state: 'recoverable_error', canResumeVerification: false }));
396
402
  trackFailure(copyRef.current.error, 'payment_form', (_a = view.checkout) === null || _a === void 0 ? void 0 : _a.attemptId);
397
403
  (_b = onErrorRef.current) === null || _b === void 0 ? void 0 : _b.call(onErrorRef, copyRef.current.error);
398
- } }, view.checkout.attemptId)) : null, presentation && view.checkout && showForm ? (_jsx("p", { className: 'solidgate-checkout-secure', children: presentation.secureLabel })) : null, statusMessage && view.state !== 'ready' ? (_jsx("div", { className: 'solidgate-checkout-status', children: _jsx("p", { role: 'status', "aria-live": 'polite', children: statusMessage }) })) : null, view.canResumeVerification ? (_jsx("button", { type: 'button', onClick: () => void verifyCanonicalStatus(), className: 'solidgate-checkout-action solidgate-checkout-action--spaced', children: copy.resumeVerification })) : null, (view.state === 'recoverable_error' || view.state === 'expired') && !view.canResumeVerification ? (_jsx("button", { type: 'button', onClick: onRetry || (() => setRetryRequest({
399
- originalKey: idempotencyKey,
400
- key: crypto.randomUUID(),
401
- })), className: 'solidgate-checkout-action solidgate-checkout-action--spaced', children: copy.retry })) : null] })) : null] }), _jsx("style", { children: solidgateCheckoutDialogStyles })] }));
404
+ } }, view.checkout.attemptId)) : null, presentation && view.checkout && showForm ? (_jsx("p", { className: 'solidgate-checkout-secure', children: presentation.secureLabel })) : null, statusMessage && view.state !== 'ready' ? (_jsx("div", { className: 'solidgate-checkout-status', children: _jsx("p", { role: 'status', "aria-live": 'polite', children: statusMessage }) })) : null, view.canResumeVerification ? (_jsx("button", { type: 'button', onClick: () => void verifyCanonicalStatus(), className: 'solidgate-checkout-action solidgate-checkout-action--spaced', children: copy.resumeVerification })) : null, (view.state === 'recoverable_error' || view.state === 'expired') && !view.canResumeVerification ? (_jsx("button", { type: 'button', onClick: onRetry || (() => {
405
+ preparedRequestRef.current = null;
406
+ setRetryRequest({
407
+ originalKey: idempotencyKey,
408
+ key: crypto.randomUUID(),
409
+ });
410
+ }), className: 'solidgate-checkout-action solidgate-checkout-action--spaced', children: copy.retry })) : null] })) : null] }), _jsx("style", { children: solidgateCheckoutDialogStyles })] }));
402
411
  }
@@ -1,4 +1,5 @@
1
1
  import type { FunnelSdkRuntimeConfigOverrides, FunnelStepType, RuntimeMode } from '@funnelsgrove/runtime';
2
+ import type { PublicAnalyticsFeatureFlags } from '@funnelsgrove/analytics';
2
3
  import type { PrepareSolidgateCheckoutInput, SolidgateCheckoutPreparation } from '../services/solidgate.service.js';
3
4
  export type SolidgateCheckoutDialogState = 'collecting_email' | 'loading' | 'ready' | 'submitting' | 'verifying' | 'success' | 'recoverable_error' | 'expired';
4
5
  export type SolidgateCheckoutDialogContent = {
@@ -52,11 +53,12 @@ export type SolidgateCheckoutDialogProps = {
52
53
  onSuccess?: (checkout: SolidgateCheckoutPreparation) => void | Promise<void>;
53
54
  onRetry?: () => void;
54
55
  onError?: (message: string) => void;
56
+ onPreparationStart?: () => void;
55
57
  onStateChange?: (state: SolidgateCheckoutDialogState) => void;
56
58
  };
57
59
  export type SolidgateCheckoutAnalyticsContext = {
58
60
  environment?: RuntimeMode;
59
- featureFlags?: Record<string, string | null | undefined>;
61
+ featureFlags?: PublicAnalyticsFeatureFlags;
60
62
  metadata?: Record<string, unknown> | null;
61
63
  runtimeConfig?: FunnelSdkRuntimeConfigOverrides;
62
64
  stepId: string;
@@ -59,6 +59,7 @@ export type StripeWalletSurfaceProps = {
59
59
  containerClassName?: string;
60
60
  customerEmail?: string | null;
61
61
  onCustomerEmailCommit?: CheckoutEmailDialogProps['onSave'];
62
+ /** @deprecated Resolve the email from the funnel's primary payment CTA instead. */
62
63
  onResolveCustomerEmail?: () => Promise<string | null>;
63
64
  emailDialogContent?: Pick<CheckoutEmailDialogProps, 'title' | 'description' | 'emailLabel' | 'placeholder' | 'invalidMessage' | 'continueLabel' | 'cancelLabel'>;
64
65
  customerName?: string | null;
@@ -84,4 +85,4 @@ export type StripeWalletSurfaceProps = {
84
85
  surfaceId: string;
85
86
  suspended?: boolean;
86
87
  };
87
- export declare function StripeWalletSurface({ amountCents, appearance, applePayOptions, applePayPlaceholderLabel, beforeConfirm, checkoutAnalytics, className, containerClassName, customerEmail, onCustomerEmailCommit, onResolveCustomerEmail, emailDialogContent, customerName, disabled, googlePayOptions, googlePayPlaceholderLabel, onAvailabilityChange, onCancel, onError, onPaymentInfoSubmitted, onSuccess, onUnavailableClick, paymentMethods, renderHeader, resolveMethodClassName, resolveMethodWrapperClassName, returnUrl, session, slotClassName, summaryLabel, surfaceId, suspended, }: StripeWalletSurfaceProps): import("react/jsx-runtime").JSX.Element | null;
88
+ export declare function StripeWalletSurface({ amountCents, appearance, applePayOptions, applePayPlaceholderLabel, beforeConfirm, checkoutAnalytics, className, containerClassName, customerEmail, onCustomerEmailCommit, emailDialogContent, customerName, disabled, googlePayOptions, googlePayPlaceholderLabel, onAvailabilityChange, onCancel, onError, onPaymentInfoSubmitted, onSuccess, onUnavailableClick, paymentMethods, renderHeader, resolveMethodClassName, resolveMethodWrapperClassName, returnUrl, session, slotClassName, summaryLabel, surfaceId, suspended, }: StripeWalletSurfaceProps): import("react/jsx-runtime").JSX.Element | null;
@@ -76,8 +76,8 @@ function buildAvailabilitySignature(availability) {
76
76
  .join(','),
77
77
  ].join('|');
78
78
  }
79
- export function StripeWalletSurface({ amountCents, appearance, applePayOptions, applePayPlaceholderLabel, beforeConfirm, checkoutAnalytics, className, containerClassName, customerEmail, onCustomerEmailCommit, onResolveCustomerEmail, emailDialogContent, customerName, disabled, googlePayOptions, googlePayPlaceholderLabel, onAvailabilityChange, onCancel, onError, onPaymentInfoSubmitted, onSuccess, onUnavailableClick, paymentMethods, renderHeader, resolveMethodClassName, resolveMethodWrapperClassName, returnUrl, session, slotClassName, summaryLabel, surfaceId, suspended = false, }) {
80
- var _a, _b, _c;
79
+ export function StripeWalletSurface({ amountCents, appearance, applePayOptions, applePayPlaceholderLabel, beforeConfirm, checkoutAnalytics, className, containerClassName, customerEmail, onCustomerEmailCommit, emailDialogContent, customerName, disabled, googlePayOptions, googlePayPlaceholderLabel, onAvailabilityChange, onCancel, onError, onPaymentInfoSubmitted, onSuccess, onUnavailableClick, paymentMethods, renderHeader, resolveMethodClassName, resolveMethodWrapperClassName, returnUrl, session, slotClassName, summaryLabel, surfaceId, suspended = false, }) {
80
+ var _a, _b;
81
81
  const [emailDialogOpen, setEmailDialogOpen] = useState(false);
82
82
  const [rejectedEmail, setRejectedEmail] = useState(null);
83
83
  const [savedEmail, setSavedEmail] = useState(null);
@@ -85,32 +85,10 @@ export function StripeWalletSurface({ amountCents, appearance, applePayOptions,
85
85
  const needsEmail = !isValidCheckoutEmail(normalizedEmail)
86
86
  || rejectedEmail === normalizedEmail
87
87
  || (savedEmail !== null && savedEmail !== normalizedEmail);
88
- const [resolvingEmail, setResolvingEmail] = useState(false);
89
88
  useEffect(() => {
90
89
  if (savedEmail === normalizedEmail)
91
90
  setSavedEmail(null);
92
91
  }, [normalizedEmail, savedEmail]);
93
- const openEmailDialog = async () => {
94
- if (resolvingEmail)
95
- return;
96
- if (!onCustomerEmailCommit) {
97
- await (onUnavailableClick === null || onUnavailableClick === void 0 ? void 0 : onUnavailableClick());
98
- return;
99
- }
100
- setResolvingEmail(true);
101
- try {
102
- const resolved = await (onResolveCustomerEmail === null || onResolveCustomerEmail === void 0 ? void 0 : onResolveCustomerEmail());
103
- if (isValidCheckoutEmail(resolved) && (resolved === null || resolved === void 0 ? void 0 : resolved.trim()) !== rejectedEmail)
104
- return;
105
- setEmailDialogOpen(true);
106
- }
107
- catch (_a) {
108
- setEmailDialogOpen(true);
109
- }
110
- finally {
111
- setResolvingEmail(false);
112
- }
113
- };
114
92
  const platformWalletPaymentMethods = usePlatformWalletPaymentMethods();
115
93
  const walletPaymentMethods = normalizeStripeWalletSurfaceMethods(paymentMethods !== null && paymentMethods !== void 0 ? paymentMethods : platformWalletPaymentMethods);
116
94
  const normalizedSurfaceId = surfaceId.trim();
@@ -192,14 +170,16 @@ export function StripeWalletSurface({ amountCents, appearance, applePayOptions,
192
170
  suspended,
193
171
  });
194
172
  if (needsEmail && session.configured && !suspended && walletPaymentMethods.length > 0) {
195
- return (_jsxs("div", { className: containerClassName, "data-wallet-surface-id": normalizedSurfaceId, children: [_jsx("button", { type: 'button', className: ['bg-card text-foreground border-border', className].filter(Boolean).join(' '), style: { minHeight: 55, width: '100%', borderRadius: 12, font: 'inherit', cursor: 'pointer' }, disabled: disabled || resolvingEmail, onClick: () => void openEmailDialog(), children: (_b = emailDialogContent === null || emailDialogContent === void 0 ? void 0 : emailDialogContent.continueLabel) !== null && _b !== void 0 ? _b : 'Continue' }), emailDialogOpen && onCustomerEmailCommit ? (_jsx(CheckoutEmailDialog, Object.assign({}, emailDialogContent, { customerEmail: normalizedEmail, rejectedEmail: rejectedEmail, onClose: () => setEmailDialogOpen(false), onSave: async (email) => {
196
- const saved = await onCustomerEmailCommit(email);
197
- const nextEmail = normalizeCheckoutEmailResult(saved, email, emailDialogContent === null || emailDialogContent === void 0 ? void 0 : emailDialogContent.invalidMessage);
198
- setSavedEmail(nextEmail);
199
- setRejectedEmail(null);
200
- session.setError(null);
201
- return nextEmail;
202
- } }))) : null] }));
173
+ if (!emailDialogOpen || !onCustomerEmailCommit)
174
+ return null;
175
+ return (_jsx("div", { className: containerClassName, "data-wallet-surface-id": normalizedSurfaceId, children: _jsx(CheckoutEmailDialog, Object.assign({}, emailDialogContent, { customerEmail: normalizedEmail, rejectedEmail: rejectedEmail, onClose: () => setEmailDialogOpen(false), onSave: async (email) => {
176
+ const saved = await onCustomerEmailCommit(email);
177
+ const nextEmail = normalizeCheckoutEmailResult(saved, email, emailDialogContent === null || emailDialogContent === void 0 ? void 0 : emailDialogContent.invalidMessage);
178
+ setSavedEmail(nextEmail);
179
+ setRejectedEmail(null);
180
+ session.setError(null);
181
+ return nextEmail;
182
+ } })) }));
203
183
  }
204
184
  if (!shouldRenderSurface) {
205
185
  return null;
@@ -209,7 +189,7 @@ export function StripeWalletSurface({ amountCents, appearance, applePayOptions,
209
189
  containerClassName !== null && containerClassName !== void 0 ? containerClassName : '',
210
190
  ]
211
191
  .filter(Boolean)
212
- .join(' '), "data-wallet-surface-id": normalizedSurfaceId, children: [(_c = renderHeader === null || renderHeader === void 0 ? void 0 : renderHeader({ availability })) !== null && _c !== void 0 ? _c : null, visibleWalletPaymentMethods.map((method) => {
192
+ .join(' '), "data-wallet-surface-id": normalizedSurfaceId, children: [(_b = renderHeader === null || renderHeader === void 0 ? void 0 : renderHeader({ availability })) !== null && _b !== void 0 ? _b : null, visibleWalletPaymentMethods.map((method) => {
213
193
  var _a;
214
194
  return (_jsx("div", { className: [
215
195
  'stripe-subscription-wallet-surface__method',
@@ -15,6 +15,8 @@ export type StripeOneTimeCheckoutSessionInput = {
15
15
  couponId?: string | null;
16
16
  customerEmail?: string | null;
17
17
  enabled?: boolean;
18
+ onPreparationStart?: () => void;
19
+ onReset?: () => void;
18
20
  onError?: (message: string | null) => void;
19
21
  plan?: StripeOneTimeCheckoutPlanInput | null;
20
22
  returnUrl: string;
@@ -52,4 +54,4 @@ export type StripeOneTimeCheckoutIntentKeyInput = Pick<StripeOneTimeCheckoutSess
52
54
  };
53
55
  export declare function buildStripeOneTimeCheckoutIntentKey({ runtimeConfigRevisionId, paymentProfileId, provider, checkoutMode, couponId, customerEmail, plan, returnUrl, runtimeConfig, stripePublishableKey, userId, }: StripeOneTimeCheckoutIntentKeyInput): string;
54
56
  export declare function shouldResetStripeOneTimeCheckoutSessionForIntentKey(previousIntentKey: string | null, nextIntentKey: string): boolean;
55
- export declare function useStripeOneTimeCheckoutSession({ runtimeConfigRevisionId, paymentProfileId, provider, analyticsMetadata, checkoutAnalytics, checkoutMode, couponId, customerEmail, enabled, onError, plan, returnUrl, runtimeConfig, stripePublishableKey, stripeLocale, userId, }: StripeOneTimeCheckoutSessionInput): StripeOneTimeCheckoutSession;
57
+ export declare function useStripeOneTimeCheckoutSession({ runtimeConfigRevisionId: nextRuntimeConfigRevisionId, paymentProfileId: nextPaymentProfileId, provider: nextProvider, analyticsMetadata, checkoutAnalytics, checkoutMode: nextCheckoutMode, couponId, customerEmail, enabled, onError, onPreparationStart, onReset, plan, returnUrl, runtimeConfig: nextRuntimeConfig, stripePublishableKey: nextStripePublishableKey, stripeLocale, userId, }: StripeOneTimeCheckoutSessionInput): StripeOneTimeCheckoutSession;
@@ -71,8 +71,20 @@ export function buildStripeOneTimeCheckoutIntentKey({ runtimeConfigRevisionId, p
71
71
  export function shouldResetStripeOneTimeCheckoutSessionForIntentKey(previousIntentKey, nextIntentKey) {
72
72
  return previousIntentKey !== null && previousIntentKey !== nextIntentKey;
73
73
  }
74
- export function useStripeOneTimeCheckoutSession({ runtimeConfigRevisionId, paymentProfileId, provider, analyticsMetadata, checkoutAnalytics, checkoutMode, couponId, customerEmail, enabled = true, onError, plan, returnUrl, runtimeConfig, stripePublishableKey, stripeLocale, userId, }) {
75
- var _a, _b, _c;
74
+ export function useStripeOneTimeCheckoutSession({ runtimeConfigRevisionId: nextRuntimeConfigRevisionId, paymentProfileId: nextPaymentProfileId, provider: nextProvider, analyticsMetadata, checkoutAnalytics, checkoutMode: nextCheckoutMode, couponId, customerEmail, enabled = true, onError, onPreparationStart, onReset, plan, returnUrl, runtimeConfig: nextRuntimeConfig, stripePublishableKey: nextStripePublishableKey, stripeLocale, userId, }) {
75
+ var _a, _b, _c, _d, _e;
76
+ const preparedSelectionRef = useRef(null);
77
+ const nextSelection = {
78
+ checkoutMode: nextCheckoutMode,
79
+ runtimeConfig: nextRuntimeConfig,
80
+ runtimeConfigRevisionId: nextRuntimeConfigRevisionId,
81
+ paymentProfileId: nextPaymentProfileId,
82
+ provider: nextProvider,
83
+ stripePublishableKey: nextStripePublishableKey,
84
+ };
85
+ const latestSelectionRef = useRef(nextSelection);
86
+ latestSelectionRef.current = nextSelection;
87
+ const { checkoutMode, runtimeConfig, runtimeConfigRevisionId, paymentProfileId, provider, stripePublishableKey, } = (_a = preparedSelectionRef.current) !== null && _a !== void 0 ? _a : nextSelection;
76
88
  const [clientSecret, setClientSecret] = useState(null);
77
89
  const [clientSecretIntentKey, setClientSecretIntentKey] = useState(null);
78
90
  const [checkoutSessionId, setCheckoutSessionId] = useState(null);
@@ -106,9 +118,10 @@ export function useStripeOneTimeCheckoutSession({ runtimeConfigRevisionId, payme
106
118
  userId,
107
119
  });
108
120
  const planKey = [
109
- (_a = plan === null || plan === void 0 ? void 0 : plan.id) !== null && _a !== void 0 ? _a : '',
110
- (_b = plan === null || plan === void 0 ? void 0 : plan.providerPlanId) !== null && _b !== void 0 ? _b : '',
111
- (_c = plan === null || plan === void 0 ? void 0 : plan.amountCents) !== null && _c !== void 0 ? _c : '',
121
+ (_b = plan === null || plan === void 0 ? void 0 : plan.offerSetId) !== null && _b !== void 0 ? _b : '',
122
+ (_c = plan === null || plan === void 0 ? void 0 : plan.id) !== null && _c !== void 0 ? _c : '',
123
+ (_d = plan === null || plan === void 0 ? void 0 : plan.providerPlanId) !== null && _d !== void 0 ? _d : '',
124
+ (_e = plan === null || plan === void 0 ? void 0 : plan.amountCents) !== null && _e !== void 0 ? _e : '',
112
125
  ].join('|');
113
126
  const activeClientSecret = clientSecretIntentKey === intentKey ? clientSecret : null;
114
127
  const activeCheckoutSessionId = clientSecretIntentKey === intentKey ? checkoutSessionId : null;
@@ -139,12 +152,17 @@ export function useStripeOneTimeCheckoutSession({ runtimeConfigRevisionId, payme
139
152
  onError === null || onError === void 0 ? void 0 : onError(message);
140
153
  }, [clearActiveCheckoutSession, onError]);
141
154
  const reset = useCallback(() => {
155
+ preparedSelectionRef.current = null;
142
156
  attemptRef.current = null;
143
157
  clearActiveCheckoutSession();
144
158
  setLoading(createEmptyCheckoutPreparationLoading());
145
159
  setRuntimeStripePublishableKey(null);
146
160
  setError(null);
147
161
  }, [clearActiveCheckoutSession, setError]);
162
+ const releaseAndReset = useCallback(() => {
163
+ reset();
164
+ onReset === null || onReset === void 0 ? void 0 : onReset();
165
+ }, [onReset, reset]);
148
166
  useIsomorphicLayoutEffect(() => {
149
167
  const previousIntentKey = previousIntentKeyRef.current;
150
168
  previousIntentKeyRef.current = intentKey;
@@ -278,9 +296,12 @@ export function useStripeOneTimeCheckoutSession({ runtimeConfigRevisionId, payme
278
296
  userId,
279
297
  ]);
280
298
  const prepareCheckout = useCallback(async (source, options = {}) => {
299
+ var _a;
281
300
  if (!configured || !plan) {
282
301
  return null;
283
302
  }
303
+ onPreparationStart === null || onPreparationStart === void 0 ? void 0 : onPreparationStart();
304
+ (_a = preparedSelectionRef.current) !== null && _a !== void 0 ? _a : (preparedSelectionRef.current = latestSelectionRef.current);
284
305
  if (!options.forceNew && activeClientSecret) {
285
306
  return activeClientSecret;
286
307
  }
@@ -297,6 +318,7 @@ export function useStripeOneTimeCheckoutSession({ runtimeConfigRevisionId, payme
297
318
  configured,
298
319
  createCheckoutSession,
299
320
  plan,
321
+ onPreparationStart,
300
322
  setError,
301
323
  setSourceLoading,
302
324
  ]);
@@ -314,7 +336,7 @@ export function useStripeOneTimeCheckoutSession({ runtimeConfigRevisionId, payme
314
336
  prepareCardCheckout,
315
337
  prepareWalletCheckout,
316
338
  provider: 'stripe',
317
- reset,
339
+ reset: releaseAndReset,
318
340
  restartCardCheckout,
319
341
  restartWalletCheckout,
320
342
  planKey,
@@ -330,7 +352,7 @@ export function useStripeOneTimeCheckoutSession({ runtimeConfigRevisionId, payme
330
352
  planKey,
331
353
  prepareCardCheckout,
332
354
  prepareWalletCheckout,
333
- reset,
355
+ releaseAndReset,
334
356
  restartCardCheckout,
335
357
  restartWalletCheckout,
336
358
  setError,
@@ -13,6 +13,8 @@ export type StripeSubscriptionCheckoutSessionInput = {
13
13
  customerEmail?: string | null;
14
14
  displayPlan?: PaywallDisplayPlan | null;
15
15
  enabled?: boolean;
16
+ onPreparationStart?: () => void;
17
+ onReset?: () => void;
16
18
  onError?: (message: string | null) => void;
17
19
  plan?: PaywallPlan | null;
18
20
  returnUrl: string;
@@ -59,4 +61,4 @@ export declare function shouldResetStripeSubscriptionCheckoutSessionForIntentKey
59
61
  export declare function isInactiveCheckoutSessionError(message?: string | null): boolean;
60
62
  export declare function shouldAutoRecoverStripeSubscriptionCheckoutSession(message: string | null | undefined, alreadyRecovered: boolean): boolean;
61
63
  export declare const shouldReportStripeCheckoutFailureShown: (message: string) => boolean;
62
- export declare function useStripeSubscriptionCheckoutSession({ checkoutMode, analyticsMetadata, checkoutAnalytics, couponId, customerEmail, displayPlan, enabled, onError, plan, returnUrl, runtimeConfig, runtimeConfigRevisionId, paymentProfileId, provider, stripePublishableKey, stripeLocale, userId, }: StripeSubscriptionCheckoutSessionInput): StripeSubscriptionCheckoutSession;
64
+ export declare function useStripeSubscriptionCheckoutSession({ checkoutMode: nextCheckoutMode, analyticsMetadata, checkoutAnalytics, couponId, customerEmail, displayPlan, enabled, onError, onPreparationStart, onReset, plan, returnUrl, runtimeConfig: nextRuntimeConfig, runtimeConfigRevisionId: nextRuntimeConfigRevisionId, paymentProfileId: nextPaymentProfileId, provider: nextProvider, stripePublishableKey: nextStripePublishableKey, stripeLocale, userId, }: StripeSubscriptionCheckoutSessionInput): StripeSubscriptionCheckoutSession;
@@ -71,8 +71,20 @@ export function shouldAutoRecoverStripeSubscriptionCheckoutSession(message, alre
71
71
  return !alreadyRecovered && isInactiveCheckoutSessionError(message);
72
72
  }
73
73
  export const shouldReportStripeCheckoutFailureShown = (message) => !isInactiveCheckoutSessionError(message);
74
- export function useStripeSubscriptionCheckoutSession({ checkoutMode, analyticsMetadata, checkoutAnalytics, couponId, customerEmail, displayPlan, enabled = true, onError, plan, returnUrl, runtimeConfig, runtimeConfigRevisionId, paymentProfileId, provider, stripePublishableKey, stripeLocale, userId, }) {
75
- var _a, _b, _c, _d, _e;
74
+ export function useStripeSubscriptionCheckoutSession({ checkoutMode: nextCheckoutMode, analyticsMetadata, checkoutAnalytics, couponId, customerEmail, displayPlan, enabled = true, onError, onPreparationStart, onReset, plan, returnUrl, runtimeConfig: nextRuntimeConfig, runtimeConfigRevisionId: nextRuntimeConfigRevisionId, paymentProfileId: nextPaymentProfileId, provider: nextProvider, stripePublishableKey: nextStripePublishableKey, stripeLocale, userId, }) {
75
+ var _a, _b, _c, _d, _e, _f, _g;
76
+ const preparedSelectionRef = useRef(null);
77
+ const nextSelection = {
78
+ checkoutMode: nextCheckoutMode,
79
+ runtimeConfig: nextRuntimeConfig,
80
+ runtimeConfigRevisionId: nextRuntimeConfigRevisionId,
81
+ paymentProfileId: nextPaymentProfileId,
82
+ provider: nextProvider,
83
+ stripePublishableKey: nextStripePublishableKey,
84
+ };
85
+ const latestSelectionRef = useRef(nextSelection);
86
+ latestSelectionRef.current = nextSelection;
87
+ const { checkoutMode, runtimeConfig, runtimeConfigRevisionId, paymentProfileId, provider, stripePublishableKey, } = (_a = preparedSelectionRef.current) !== null && _a !== void 0 ? _a : nextSelection;
76
88
  const [clientSecret, setClientSecret] = useState(null);
77
89
  const [clientSecretIntentKey, setClientSecretIntentKey] = useState(null);
78
90
  const [checkoutSessionId, setCheckoutSessionId] = useState(null);
@@ -97,11 +109,12 @@ export function useStripeSubscriptionCheckoutSession({ checkoutMode, analyticsMe
97
109
  Boolean(normalizeRuntimeConfigValue(runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.funnelSdkPublishableKey)) ||
98
110
  Boolean(normalizeRuntimeConfigValue(stripePublishableKey)));
99
111
  const planKey = [
100
- (_a = plan === null || plan === void 0 ? void 0 : plan.id) !== null && _a !== void 0 ? _a : '',
101
- (_b = plan === null || plan === void 0 ? void 0 : plan.providerPlanId) !== null && _b !== void 0 ? _b : '',
102
- (_c = plan === null || plan === void 0 ? void 0 : plan.amountCents) !== null && _c !== void 0 ? _c : '',
103
- (_d = displayPlan === null || displayPlan === void 0 ? void 0 : displayPlan.id) !== null && _d !== void 0 ? _d : '',
104
- (_e = displayPlan === null || displayPlan === void 0 ? void 0 : displayPlan.amountCents) !== null && _e !== void 0 ? _e : '',
112
+ (_b = plan === null || plan === void 0 ? void 0 : plan.offerSetId) !== null && _b !== void 0 ? _b : '',
113
+ (_c = plan === null || plan === void 0 ? void 0 : plan.id) !== null && _c !== void 0 ? _c : '',
114
+ (_d = plan === null || plan === void 0 ? void 0 : plan.providerPlanId) !== null && _d !== void 0 ? _d : '',
115
+ (_e = plan === null || plan === void 0 ? void 0 : plan.amountCents) !== null && _e !== void 0 ? _e : '',
116
+ (_f = displayPlan === null || displayPlan === void 0 ? void 0 : displayPlan.id) !== null && _f !== void 0 ? _f : '',
117
+ (_g = displayPlan === null || displayPlan === void 0 ? void 0 : displayPlan.amountCents) !== null && _g !== void 0 ? _g : '',
105
118
  ].join('|');
106
119
  const intentKey = buildStripeSubscriptionCheckoutIntentKey({
107
120
  checkoutMode,
@@ -153,6 +166,7 @@ export function useStripeSubscriptionCheckoutSession({ checkoutMode, analyticsMe
153
166
  onError === null || onError === void 0 ? void 0 : onError(message);
154
167
  }, [clearActiveCheckoutSession, intentKey, onError]);
155
168
  const reset = useCallback(() => {
169
+ preparedSelectionRef.current = null;
156
170
  attemptRef.current = null;
157
171
  recoveredIntentKeyRef.current = null;
158
172
  handledRecoveryRequestRef.current = recoveryRequest;
@@ -161,6 +175,10 @@ export function useStripeSubscriptionCheckoutSession({ checkoutMode, analyticsMe
161
175
  setRuntimeStripePublishableKey(null);
162
176
  setError(null);
163
177
  }, [clearActiveCheckoutSession, recoveryRequest, setError]);
178
+ const releaseAndReset = useCallback(() => {
179
+ reset();
180
+ onReset === null || onReset === void 0 ? void 0 : onReset();
181
+ }, [onReset, reset]);
164
182
  useIsomorphicLayoutEffect(() => {
165
183
  const previousIntentKey = previousIntentKeyRef.current;
166
184
  previousIntentKeyRef.current = intentKey;
@@ -300,9 +318,12 @@ export function useStripeSubscriptionCheckoutSession({ checkoutMode, analyticsMe
300
318
  userId,
301
319
  ]);
302
320
  const prepareCheckout = useCallback(async (source, options = {}) => {
321
+ var _a;
303
322
  if (!configured || !plan || !displayPlan) {
304
323
  return null;
305
324
  }
325
+ onPreparationStart === null || onPreparationStart === void 0 ? void 0 : onPreparationStart();
326
+ (_a = preparedSelectionRef.current) !== null && _a !== void 0 ? _a : (preparedSelectionRef.current = latestSelectionRef.current);
306
327
  if (!options.forceNew && activeClientSecret) {
307
328
  return activeClientSecret;
308
329
  }
@@ -320,6 +341,7 @@ export function useStripeSubscriptionCheckoutSession({ checkoutMode, analyticsMe
320
341
  createCheckoutSubscription,
321
342
  displayPlan,
322
343
  plan,
344
+ onPreparationStart,
323
345
  setError,
324
346
  setSourceLoading,
325
347
  ]);
@@ -416,7 +438,7 @@ export function useStripeSubscriptionCheckoutSession({ checkoutMode, analyticsMe
416
438
  prepareCardCheckout,
417
439
  prepareWalletCheckout,
418
440
  provider: 'stripe',
419
- reset,
441
+ reset: releaseAndReset,
420
442
  restartCardCheckout,
421
443
  restartWalletCheckout,
422
444
  planKey,
@@ -434,7 +456,7 @@ export function useStripeSubscriptionCheckoutSession({ checkoutMode, analyticsMe
434
456
  planKey,
435
457
  prepareCardCheckout,
436
458
  prepareWalletCheckout,
437
- reset,
459
+ releaseAndReset,
438
460
  restartCardCheckout,
439
461
  restartWalletCheckout,
440
462
  setError,