feat(events): attribute checkout_session events to originating paywall#880
feat(events): attribute checkout_session events to originating paywall#880JZDesign wants to merge 9 commits into
Conversation
…ishedHandler call The bracket-access syntax bypassed TypeScript's check on the new required paywallContext parameter from the Task 6/7 handler factory refactor.
…ywall into purchase
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (7)
📝 WalkthroughWalkthroughThis PR extends checkout session events with paywall context identifiers (session ID, paywall ID, offering ID) and threads them through all three checkout provider implementations (Stripe, Web Billing, Paddle) while validating the propagation in tests. ChangesPaywall Context Event Tracking
Estimated code review effort🎯 3 (Moderate) | ⏱️ ~25 minutes Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
Generated by 🚫 Danger |
Summary
Backend analytics couldn't tie successful purchases to the paywall that initiated them —
checkout_session_endcarried onlymode,outcome, andwith_redemption_info, no paywall identifiers. This PR threadspaywall_session_id,paywall_id, andoffering_idonto all fourcheckout_session_*events (start, finished, closed, errored) so purchases, drop-offs, and errors can all be attributed to their originating paywall.CheckoutSession*Eventinterfaces (factored into a sharedPaywallContexttype) and the matching event helpers insrc/behavioural-events/PurchaseParamswithpaywallSessionId?: stringandofferingId?: string(alongside the existingpaywallId?: string, all@internal)presentPaywall's internalstartPurchaseFlowto forward its already-generatedpaywallSessionIdUUID andoffering.identifierintopurchase()performStripePurchase/performWebBillingPurchase/performPaddlePurchaseand the three privatecreateCheckoutOn{Close,Finished,Error}Handlerfactoriespurchase({rcPackage}),presentExpressPurchaseButton) correctly emitnullfor the three fieldsTest Plan
purchase({ rcPackage, paywallId, paywallSessionId, offeringId })call asserts wire payload ofcheckout_session_endincludes all three IDs (src/tests/purchase.events.test.ts)presentPaywallforwardspaywallSessionId(UUID-shaped) andoffering.identifierinto the spiedpurchase()call (src/tests/present-paywall.events.test.ts)purchase.events.test.tsupdated to expectpaywall_session_id: null,paywall_id: null,offering_id: nullfor non-paywall flowspnpm typecheck,pnpm lint,pnpm buildcleangit diff origin/main -- api-report/empty (no public API drift — newPurchaseParamsfields are@internal)Follow-ups (out of scope)
closedanderroredcheckout_session_endevents when paywall context is supplied (production code is correct; just untested under the cancel/error paths)checkout_purchase_successful_impression/_dismissinsrc/ui/pages/success-page.svelte) to carry the same paywall context — requires extra Svelte context plumbing and was deliberately scoped out🤖 Generated with Claude Code
Summary by CodeRabbit
Release Notes