2021-01-14 10:16:54 -05:00
|
|
|
function startFreeTrial(source, version, $scope, eventTracking) {
|
|
|
|
const plan = 'collaborator_free_trial_7_days'
|
|
|
|
|
|
|
|
const w = window.open()
|
2021-04-14 09:17:21 -04:00
|
|
|
const go = function () {
|
2021-01-14 10:16:54 -05:00
|
|
|
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}`
|
|
|
|
}
|
2018-11-05 05:06:39 -05:00
|
|
|
|
2021-01-14 10:16:54 -05:00
|
|
|
if ($scope) {
|
2020-05-19 05:02:56 -04:00
|
|
|
$scope.startedFreeTrial = true
|
2021-01-14 10:16:54 -05:00
|
|
|
}
|
2018-11-05 05:06:39 -05:00
|
|
|
|
2021-01-14 10:16:54 -05:00
|
|
|
if (eventTracking) {
|
2020-05-19 05:02:56 -04:00
|
|
|
eventTracking.sendMB('subscription-start-trial', { source, plan })
|
2019-10-23 08:22:50 -04:00
|
|
|
}
|
2020-05-19 05:02:56 -04:00
|
|
|
|
2021-01-14 10:16:54 -05:00
|
|
|
w.location = url
|
2020-05-19 05:02:56 -04:00
|
|
|
}
|
2020-10-13 05:22:55 -04:00
|
|
|
|
2021-01-14 10:16:54 -05:00
|
|
|
go()
|
|
|
|
}
|
|
|
|
|
|
|
|
function upgradePlan(source, $scope) {
|
|
|
|
const w = window.open()
|
2021-04-14 09:17:21 -04:00
|
|
|
const go = function () {
|
2021-01-14 10:16:54 -05:00
|
|
|
if (typeof ga === 'function') {
|
|
|
|
ga('send', 'event', 'subscription-funnel', 'upgraded-plan', source)
|
2020-10-13 05:22:55 -04:00
|
|
|
}
|
2021-05-05 09:05:04 -04:00
|
|
|
const url = '/user/subscription'
|
2020-10-13 05:22:55 -04:00
|
|
|
|
2021-01-14 10:16:54 -05:00
|
|
|
if ($scope) {
|
|
|
|
$scope.startedFreeTrial = true
|
|
|
|
}
|
|
|
|
|
|
|
|
w.location = url
|
2020-10-13 05:22:55 -04:00
|
|
|
}
|
2021-01-14 10:16:54 -05:00
|
|
|
|
|
|
|
go()
|
|
|
|
}
|
|
|
|
|
|
|
|
export { startFreeTrial, upgradePlan }
|