mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
11e58b5844
* Uncouple account-upgrade and exposted-settings from Angular * Mock socket shim with the correct methods * Extract timeout upgrade prompt to a component GitOrigin-RevId: ee8058b38bf5e20924a21f40d32c5bb0ee06c555
49 lines
1 KiB
JavaScript
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 }
|