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

17 lines
648 B
CoffeeScript
Raw Normal View History

define [
"base"
], (App) ->
App.controller "FreeTrialModalController", ($scope, abTestManager, sixpack)->
$scope.buttonClass = "btn-primary"
2015-11-16 10:52:47 -05:00
$scope.startFreeTrial = (source, couponCode) ->
sixpack.convert "track-changes-discount", ->
sixpack.participate 'free-trial-plan', ['student', 'collaborator'], (planName, rawResponse)->
ga?('send', 'event', 'subscription-funnel', 'upgraded-free-trial', source)
url = "/user/subscription/new?planCode=#{planName}_free_trial_7_days&ssp=#{planName == 'collaborator'}"
if couponCode?
2015-11-17 06:41:39 -05:00
url = "#{url}&cc=#{couponCode}"
window.open(url)
$scope.startedFreeTrial = true