Files
Verso/services/web/frontend/js/main/account-upgrade.ts
T
Alf Eaton 2fbb4615f9 Convert utility functions to TypeScript (#22658)
* Convert event-tracking to TypeScript

* Convert local-storage to TypeScript

* Convert mapSeries to TypeScript

* Convert SessionStorage to TypeScript

* Convert account-upgrade to TypeScript

* Convert isValidTeXFile to TypeScript

* Convert date functions to TypeScript

* Convert EventEmitter to TypeScript

* Convert isNetworkError to TypeScript

* Convert webpack-public-path to TypeScript

* Convert displayNameForUser to TypeScript

GitOrigin-RevId: 79c5a2d1101fcd520f3116f0f4af29d974189d94
2025-01-16 09:05:36 +00:00

30 lines
856 B
TypeScript

import * as eventTracking from '../infrastructure/event-tracking'
export function startFreeTrial(source: string, variant?: string) {
const eventSegmentation: Record<string, string> = { 'paywall-type': source }
if (variant) {
eventSegmentation.variant = variant
}
eventTracking.send('subscription-funnel', 'upgraded-free-trial', source)
eventTracking.sendMB('paywall-click', eventSegmentation)
const searchParams = new URLSearchParams({
itm_campaign: source,
})
window.open(`/user/subscription/choose-your-plan?${searchParams.toString()}`)
}
export function upgradePlan(source: string) {
const openedWindow = window.open()
if (typeof window.ga === 'function') {
window.ga('send', 'event', 'subscription-funnel', 'upgraded-plan', source)
}
if (openedWindow) {
openedWindow.location = '/user/subscription'
}
}