mirror of
https://github.com/yu-i-i/overleaf-cep.git
synced 2026-11-15 06:33:55 +01:00
Merge pull request #36496 from overleaf/oa-annual-events
[web] Subscription event segmentation GitOrigin-RevId: fdc25ac7bc7320ed82617b7c27c12a17eb31d723
This commit is contained in:
+22
@@ -0,0 +1,22 @@
|
||||
import { PaidSubscription } from '@ol-types/subscription/dashboard/subscription'
|
||||
import isInFreeTrial from './is-in-free-trial'
|
||||
|
||||
/**
|
||||
* The shared segmentation for `subscription-page-*` analytics events, so that
|
||||
* every event fired from the subscription dashboard can be compared against the
|
||||
* `subscription-page-view` event recorded server side.
|
||||
*/
|
||||
export default function getSubscriptionEventSegmentation(
|
||||
subscription?: PaidSubscription
|
||||
) {
|
||||
return {
|
||||
plan_code: subscription?.planCode,
|
||||
billing_cycle: subscription?.plan
|
||||
? subscription.plan.annual
|
||||
? 'annual'
|
||||
: 'monthly'
|
||||
: undefined,
|
||||
is_trial: isInFreeTrial(subscription?.payment?.trialEndsAt),
|
||||
currency: subscription?.payment?.currency,
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user