@funnelsgrove/payments 0.15.4 → 0.15.6

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 CHANGED
@@ -136,6 +136,7 @@ conversion event is introduced.
136
136
  - Wallet unavailable state must fall back to card/manual checkout or disappear.
137
137
  - Count `checkout_started` only at shared UI boundaries: when a shared card dialog opens or when Stripe reports Apple Pay / Google Pay intent. Checkout Sessions use confirmation or cancellation as a fallback because Stripe omits their click callback. Cancellation recovers the start with `checkout_start_source: wallet_cancel`; its timestamp is dismissal time, not wallet-open time. Closing the browser before either callback is still unobservable. Cancel has no payment-method field, so the method is included only when the element enables exactly one method.
138
138
  - Pass `checkoutAnalytics` to every current shared dialog and wallet surface. The package then owns `checkout_started`, `add_payment_info`, and verified `checkout_completed`, all deduplicated by the actual Checkout Session.
139
+ - Payment submission triggers, validation, declines, and retry identity follow [AE-BR-001–004](../../docs/product-specs/analytics-events.md#payment-information-submission). Keep that behavior inside shared checkout surfaces.
139
140
  - Call funnel lifecycle `completeStep` only from the shared checkout `onSuccess` callback. Payment-info submission is not step completion.
140
141
  - Wallet slots may create render-only Checkout Sessions on mount so Apple Pay and Google Pay render before the visitor taps. Session creation is technical preparation and must never emit `checkout_started`.
141
142
  - Shared checkout analytics deduplicates `checkout_started` by Checkout Session id. Wallet confirmation and cancellation may retry the start signal when the click callback is unavailable, without creating a duplicate. Cancellation never emits payment-info or purchase completion events.
@@ -72,6 +72,7 @@ function SharedStripeCheckoutV2CheckoutSessionForm({ amountCents, buttonColor, c
72
72
  const [submitting, setSubmitting] = useState(false);
73
73
  const submitInFlightRef = useRef(false);
74
74
  const [paymentElementReady, setPaymentElementReady] = useState(false);
75
+ const [paymentElementComplete, setPaymentElementComplete] = useState(false);
75
76
  const [error, setError] = useState(null);
76
77
  const [billingCountry, setBillingCountry] = useState(null);
77
78
  const initialCustomerEmail = (customerEmail === null || customerEmail === void 0 ? void 0 : customerEmail.trim()) || '';
@@ -194,6 +195,7 @@ function SharedStripeCheckoutV2CheckoutSessionForm({ amountCents, buttonColor, c
194
195
  });
195
196
  const handlePaymentElementChange = (event) => {
196
197
  var _a, _b;
198
+ setPaymentElementComplete(event.complete);
197
199
  setBillingCountry((_b = (_a = event.value.billingDetails) === null || _a === void 0 ? void 0 : _a.address.country) !== null && _b !== void 0 ? _b : fixedBillingCountry);
198
200
  };
199
201
  const trackCheckoutSuccess = async () => {
@@ -282,7 +284,9 @@ function SharedStripeCheckoutV2CheckoutSessionForm({ amountCents, buttonColor, c
282
284
  finishSubmitting();
283
285
  return;
284
286
  }
285
- await trackPaymentInfoSubmitted();
287
+ if (paymentElementComplete) {
288
+ await trackPaymentInfoSubmitted();
289
+ }
286
290
  const result = await checkoutState.checkout.confirm({
287
291
  redirect: 'if_required',
288
292
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnelsgrove/payments",
3
- "version": "0.15.4",
3
+ "version": "0.15.6",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/The-Solid-Grove/funnelsgrove.git",
@@ -32,8 +32,8 @@
32
32
  "test:run": "vitest run --passWithNoTests"
33
33
  },
34
34
  "dependencies": {
35
- "@funnelsgrove/analytics": "^0.1.101",
36
- "@funnelsgrove/runtime": "0.14.1",
35
+ "@funnelsgrove/analytics": "0.1.103",
36
+ "@funnelsgrove/runtime": "0.14.2",
37
37
  "@solidgate/react-sdk": "1.34.0",
38
38
  "@stripe/react-stripe-js": "^5.6.0",
39
39
  "@stripe/stripe-js": "^8.7.0",