overleaf/services/web/frontend/js/main/account-upgrade.js
Alf Eaton 1ebc8a79cb Merge pull request #3495 from overleaf/ae-prettier-2
Upgrade Prettier to v2

GitOrigin-RevId: 85aa3fa1acb6332c4f58c46165a43d1a51471f33
2021-04-15 02:05:22 +00:00

49 lines
1 KiB
JavaScript

function startFreeTrial(source, version, $scope, eventTracking) {
const plan = 'collaborator_free_trial_7_days'
const w = window.open()
const go = function () {
let url
if (typeof ga === 'function') {
ga('send', 'event', 'subscription-funnel', 'upgraded-free-trial', source)
}
url = `/user/subscription/new?planCode=${plan}&ssp=true`
url = `${url}&itm_campaign=${source}`
if (version) {
url = `${url}&itm_content=${version}`
}
if ($scope) {
$scope.startedFreeTrial = true
}
if (eventTracking) {
eventTracking.sendMB('subscription-start-trial', { source, plan })
}
w.location = url
}
go()
}
function upgradePlan(source, $scope) {
const w = window.open()
const go = function () {
let url
if (typeof ga === 'function') {
ga('send', 'event', 'subscription-funnel', 'upgraded-plan', source)
}
url = '/user/subscription'
if ($scope) {
$scope.startedFreeTrial = true
}
w.location = url
}
go()
}
export { startFreeTrial, upgradePlan }