2020-04-06 07:45:56 -04:00
|
|
|
define(['../base'], App =>
|
2019-10-23 08:22:50 -04:00
|
|
|
App.controller('FreeTrialModalController', function($scope, eventTracking) {
|
2018-11-05 05:06:39 -05:00
|
|
|
$scope.buttonClass = 'btn-primary'
|
|
|
|
|
2019-10-25 04:22:23 -04:00
|
|
|
$scope.startFreeTrial = function(source, version) {
|
2018-11-05 05:06:39 -05:00
|
|
|
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
|
|
|
|
)
|
|
|
|
}
|
2019-10-23 08:22:50 -04:00
|
|
|
url = `/user/subscription/new?planCode=${plan}&ssp=true`
|
2019-10-25 04:22:23 -04:00
|
|
|
url = `${url}&itm_campaign=${source}`
|
|
|
|
if (version) {
|
|
|
|
url = `${url}&itm_content=${version}`
|
|
|
|
}
|
|
|
|
|
2018-11-05 05:06:39 -05:00
|
|
|
$scope.startedFreeTrial = true
|
|
|
|
|
2019-10-23 08:22:50 -04:00
|
|
|
eventTracking.sendMB('subscription-start-trial', { source, plan })
|
2018-11-05 05:06:39 -05:00
|
|
|
|
2019-10-23 08:22:50 -04:00
|
|
|
w.location = url
|
2018-11-05 05:06:39 -05:00
|
|
|
}
|
|
|
|
|
2019-10-23 08:22:50 -04:00
|
|
|
go()
|
|
|
|
}
|
2018-11-05 05:06:39 -05:00
|
|
|
}))
|