@funnelsgrove/payments 0.1.28 → 0.1.29

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -217,7 +217,10 @@ function SharedStripeCheckoutV2Form({ amountCents, buttonColor, cardSubmitLabel,
217
217
  setSubmitting(false);
218
218
  return;
219
219
  }
220
- const result = await checkoutState.checkout.confirm(Object.assign(Object.assign({}, (customerEmailEditable ? { email: syncedEmail || undefined } : {})), { redirect: 'if_required' }));
220
+ const result = await checkoutState.checkout.confirm({
221
+ email: syncedEmail || undefined,
222
+ redirect: 'if_required',
223
+ });
221
224
  if (result.type === 'error') {
222
225
  const message = result.error.message || 'Payment failed.';
223
226
  setSharedError(message);
@@ -257,7 +260,7 @@ function SharedStripeCheckoutV2Form({ amountCents, buttonColor, cardSubmitLabel,
257
260
  effectiveSelectedMethod === 'wallet' ? 'is-visible' : '',
258
261
  ]
259
262
  .filter(Boolean)
260
- .join(' '), children: [_jsxs("p", { className: 'shared-checkout-v2-secure-pill', children: [_jsx(SecurityLockIcon, { className: 'shared-checkout-v2-secure-pill-icon' }), secureLabel] }), _jsxs("div", { className: 'shared-checkout-v2-wallet-shell', "aria-label": walletAriaLabel, children: [_jsx(StripeCheckoutExpressCheckoutButton, { amountCents: amountCents, availabilityPaymentMethods: walletPaymentMethods, beforeConfirm: ensureCustomerEmail, className: 'shared-checkout-v2-express-buttons', confirmEmail: customerEmailEditable, customerEmail: resolvedCustomerEmail, customerName: customerName, initialAvailable: initialWalletAvailable, keepInitialAvailableOnReady: initialWalletAvailable === true, onAvailabilityChange: handleWalletAvailabilityChange, onError: setSharedError, onSuccess: onSuccess, options: expressCheckoutOptions, returnUrl: returnUrl, summaryLabel: expressCheckoutSummaryLabel }), _jsx("span", { className: 'shared-checkout-v2-sr-only', children: walletAriaLabel })] })] }), _jsxs("div", { hidden: effectiveSelectedMethod !== 'card', className: [
263
+ .join(' '), children: [_jsxs("p", { className: 'shared-checkout-v2-secure-pill', children: [_jsx(SecurityLockIcon, { className: 'shared-checkout-v2-secure-pill-icon' }), secureLabel] }), _jsxs("div", { className: 'shared-checkout-v2-wallet-shell', "aria-label": walletAriaLabel, children: [_jsx(StripeCheckoutExpressCheckoutButton, { amountCents: amountCents, availabilityPaymentMethods: walletPaymentMethods, beforeConfirm: ensureCustomerEmail, className: 'shared-checkout-v2-express-buttons', confirmEmail: Boolean(resolvedCustomerEmail), customerEmail: resolvedCustomerEmail, customerName: customerName, initialAvailable: initialWalletAvailable, keepInitialAvailableOnReady: initialWalletAvailable === true, onAvailabilityChange: handleWalletAvailabilityChange, onError: setSharedError, onSuccess: onSuccess, options: expressCheckoutOptions, returnUrl: returnUrl, summaryLabel: expressCheckoutSummaryLabel }), _jsx("span", { className: 'shared-checkout-v2-sr-only', children: walletAriaLabel })] })] }), _jsxs("div", { hidden: effectiveSelectedMethod !== 'card', className: [
261
264
  'shared-checkout-v2-card-panel',
262
265
  effectiveSelectedMethod === 'card' ? 'is-visible' : '',
263
266
  ]
@@ -1,5 +1,5 @@
1
1
  'use client';
2
- import { useCallback, useLayoutEffect, useMemo, useRef, useState, } from 'react';
2
+ import { useCallback, useEffect, useMemo, useRef, useState, } from 'react';
3
3
  import { createEmptyCheckoutPreparationLoading, } from '../paymentProvider.types.js';
4
4
  import { createStripeSubscriptionCheckout, getStripePromise, isStripeConfigured, updateStripeSubscriptionCheckoutPlan, } from '../../services/stripe.service.js';
5
5
  const getFriendlyStripeCheckoutError = (error) => {
@@ -23,7 +23,6 @@ export function useStripeSubscriptionCheckoutSession({ checkoutMode, analyticsMe
23
23
  const [loading, setLoading] = useState(createEmptyCheckoutPreparationLoading);
24
24
  const [runtimeStripePublishableKey, setRuntimeStripePublishableKey] = useState(null);
25
25
  const creatingIntentRef = useRef(null);
26
- const lastIntentKeyRef = useRef(null);
27
26
  const requestIdRef = useRef(0);
28
27
  const runtimeConfigSignature = [
29
28
  normalizeRuntimeConfigValue(runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.apiBaseUrl),
@@ -31,6 +30,7 @@ export function useStripeSubscriptionCheckoutSession({ checkoutMode, analyticsMe
31
30
  normalizeRuntimeConfigValue(runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.funnelVersionId),
32
31
  normalizeRuntimeConfigValue(runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.funnelSdkPublishableKey),
33
32
  ].join('|');
33
+ const analyticsMetadataSignature = JSON.stringify(analyticsMetadata !== null && analyticsMetadata !== void 0 ? analyticsMetadata : {});
34
34
  const configured = enabled &&
35
35
  (isStripeConfigured(checkoutMode) ||
36
36
  Boolean(normalizeRuntimeConfigValue(runtimeConfig === null || runtimeConfig === void 0 ? void 0 : runtimeConfig.funnelSdkPublishableKey)));
@@ -38,6 +38,7 @@ export function useStripeSubscriptionCheckoutSession({ checkoutMode, analyticsMe
38
38
  'stripe',
39
39
  checkoutMode,
40
40
  runtimeConfigSignature,
41
+ analyticsMetadataSignature,
41
42
  (couponId === null || couponId === void 0 ? void 0 : couponId.trim()) || '',
42
43
  returnUrl.trim(),
43
44
  ].join('|');
@@ -76,15 +77,7 @@ export function useStripeSubscriptionCheckoutSession({ checkoutMode, analyticsMe
76
77
  setRuntimeStripePublishableKey(null);
77
78
  setError(null);
78
79
  }, [clearActiveCheckoutSession, setError]);
79
- useLayoutEffect(() => {
80
- if (lastIntentKeyRef.current === null) {
81
- lastIntentKeyRef.current = intentKey;
82
- return;
83
- }
84
- if (lastIntentKeyRef.current === intentKey) {
85
- return;
86
- }
87
- lastIntentKeyRef.current = intentKey;
80
+ useEffect(() => {
88
81
  reset();
89
82
  }, [intentKey, reset]);
90
83
  const setSourceLoading = useCallback((source, value) => {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnelsgrove/payments",
3
- "version": "0.1.28",
3
+ "version": "0.1.29",
4
4
  "type": "module",
5
5
  "private": false,
6
6
  "main": "./dist/index.js",