overleaf/services/web/public/coffee/main/account-upgrade.coffee

27 lines
691 B
CoffeeScript
Raw Normal View History

define [
"base"
], (App) ->
2016-07-12 11:41:22 -04:00
App.controller "FreeTrialModalController", ($scope, abTestManager, sixpack, event_tracking)->
$scope.buttonClass = "btn-primary"
2015-11-16 10:52:47 -05:00
$scope.startFreeTrial = (source, couponCode) ->
plan = 'collaborator_free_trial_7_days'
w = window.open()
go = () ->
ga?('send', 'event', 'subscription-funnel', 'upgraded-free-trial', source)
if window.useV2TrialUrl
url = "/user/trial"
else
url = "/user/subscription/new?planCode=#{plan}&ssp=true"
if couponCode?
url = "#{url}&cc=#{couponCode}"
$scope.startedFreeTrial = true
2016-10-27 07:22:58 -04:00
event_tracking.sendMB "subscription-start-trial", { source, plan }
w.location = url
2016-10-27 07:22:58 -04:00
go()