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

19 lines
653 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) ->
2016-10-24 06:00:09 -04:00
event_tracking.sendMB "subscription-start-trial", { source, plan: $scope.startTrialPlanCode }
w = window.open()
sixpack.convert "track-changes-discount", ->
ga?('send', 'event', 'subscription-funnel', 'upgraded-free-trial', source)
url = "/user/subscription/new?planCode=#{$scope.startTrialPlanCode}&ssp=true"
if couponCode?
url = "#{url}&cc=#{couponCode}"
$scope.startedFreeTrial = true
w.location = url