@funnelsgrove/payments 0.9.0 → 0.9.1

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
@@ -106,11 +106,11 @@ Funnels should call `resolvePublishedBillingRuntime` once at their runtime-provi
106
106
  - Stripe owns real card fields and wallet controls. Local wallet buttons are placeholders until Stripe confirms availability.
107
107
  - Keep `planId` as the funnel plan key and send Stripe's price id only as `providerPlanId`; the API uses both fields to resolve the active test/live offer mapping.
108
108
  - Wallet unavailable state must fall back to card/manual checkout or disappear.
109
- - Count `checkout_started` only at shared UI boundaries: when a shared card dialog opens or when Stripe reports an Apple Pay / Google Pay button click.
109
+ - 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 as a fallback because Stripe omits their click callback.
110
110
  - 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.
111
111
  - Call funnel lifecycle `completeStep` only from the shared checkout `onSuccess` callback. Payment-info submission is not step completion.
112
112
  - 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`.
113
- - Shared checkout analytics deduplicates `checkout_started` by Checkout Session id. Card submit and wallet confirmation must not emit it again.
113
+ - Shared checkout analytics deduplicates `checkout_started` by Checkout Session id. Wallet confirmation may retry the start signal when the click callback is unavailable, without creating a duplicate.
114
114
  - Do not call `publicAnalyticsSdk.trackCheckoutStarted`, `trackPaymentInfoSubmitted`, or `trackCheckoutCompleted` directly from funnel checkout components.
115
115
  - Funnel paywalls should style wallet buttons through the shared slot API: `className` for the Stripe button/placeholder, `slotClassName` for the outer slot, `appearance` for Stripe Elements appearance, and `options` for Stripe Express Checkout options.
116
116
  - Keep discount math reusable here, but keep offer activation timing in funnel code.
@@ -95,8 +95,18 @@ export function StripeCheckoutExpressCheckoutButton({ beforeConfirm, checkoutAna
95
95
  }
96
96
  await (onSuccess === null || onSuccess === void 0 ? void 0 : onSuccess());
97
97
  };
98
+ const queueCheckoutStarted = (paymentMethod) => {
99
+ if (!checkoutAnalytics) {
100
+ return;
101
+ }
102
+ queueStripeSubscriptionCheckoutStarted(Object.assign(Object.assign({}, checkoutAnalytics), { checkoutSessionId, checkoutStartSource: 'wallet_click', paymentMethod }));
103
+ };
98
104
  const handleConfirm = async (event) => {
99
105
  var _a, _b, _c;
106
+ // Checkout Sessions omits the Express Checkout onClick callback. Confirmation
107
+ // is therefore the first reliable wallet-intent boundary for this provider.
108
+ // Session-based analytics deduplication keeps this idempotent if onClick fires.
109
+ queueCheckoutStarted(event.expressPaymentType);
100
110
  if (checkoutState.type !== 'success') {
101
111
  const message = checkoutState.type === 'error'
102
112
  ? checkoutState.error.message
@@ -163,9 +173,7 @@ export function StripeCheckoutExpressCheckoutButton({ beforeConfirm, checkoutAna
163
173
  }
164
174
  };
165
175
  const handleClick = (event) => {
166
- if (checkoutAnalytics) {
167
- queueStripeSubscriptionCheckoutStarted(Object.assign(Object.assign({}, checkoutAnalytics), { checkoutSessionId, checkoutStartSource: 'wallet_click', paymentMethod: event.expressPaymentType }));
168
- }
176
+ queueCheckoutStarted(event.expressPaymentType);
169
177
  event.resolve();
170
178
  };
171
179
  return (_jsxs(_Fragment, { children: [_jsx("div", { className: [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@funnelsgrove/payments",
3
- "version": "0.9.0",
3
+ "version": "0.9.1",
4
4
  "repository": {
5
5
  "type": "git",
6
6
  "url": "git+https://github.com/The-Solid-Grove/funnelsgrove.git",