From 048c5d188210f1ed6e7ee3667c85bcaff59967a7 Mon Sep 17 00:00:00 2001 From: M Fahru Date: Mon, 7 Jul 2025 07:02:20 -0700 Subject: [PATCH] Merge pull request #25962 from overleaf/mf-stripe-payment-page-form-success-event [web] Simulate sending `payment-page-form-success` event when user successfully subscribe using Stripe GitOrigin-RevId: 82243fc16d3410670e4e6e9c0ccd487a5f2253a3 --- .../web/types/subscription/analytics-event.ts | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/services/web/types/subscription/analytics-event.ts b/services/web/types/subscription/analytics-event.ts index 8633884a7d..98ce12fdf1 100644 --- a/services/web/types/subscription/analytics-event.ts +++ b/services/web/types/subscription/analytics-event.ts @@ -1,5 +1,9 @@ import { CurrencyCode } from './currency' -import { PaymentProvider } from './dashboard/subscription' +import { + PaymentProvider, + StripePaymentProviderService, +} from './dashboard/subscription' +import { RecurlyPlanCode } from './plan' type PaymentPageFormSubmitEventBaseSegmentation = { currencyCode: CurrencyCode @@ -12,7 +16,7 @@ type PaymentPageFormSubmitEventBaseSegmentation = { type PaymentPageFormSubmitEventStripeSegmentation = PaymentPageFormSubmitEventBaseSegmentation & { - payment_provider: Exclude + payment_provider: StripePaymentProviderService stripe_price_id: string stripe_price_lookup_key: string } @@ -28,3 +32,25 @@ type PaymentPageFormSubmitEventRecurlySegmentation = export type PaymentPageFormSubmitEventSegmentation = | PaymentPageFormSubmitEventStripeSegmentation | PaymentPageFormSubmitEventRecurlySegmentation + +type PaymentPageFormSuccessEventBaseSegmentation = { + plan?: RecurlyPlanCode + upgradeType: 'standalone' + referrer?: string +} + +type PaymentPageFormSuccessEventStripeSegmentation = + PaymentPageFormSuccessEventBaseSegmentation & { + payment_provider: StripePaymentProviderService + stripe_price_id: string + stripe_price_lookup_key: string + } + +type PaymentPageFormSuccessEventRecurlySegmentation = + PaymentPageFormSuccessEventBaseSegmentation & { + payment_provider: 'recurly' + } + +export type PaymentPageFormSuccessEventSegmentation = + | PaymentPageFormSuccessEventStripeSegmentation + | PaymentPageFormSuccessEventRecurlySegmentation