2014-11-24 18:59:55 -05:00
|
|
|
define [
|
|
|
|
"base"
|
|
|
|
], (App) ->
|
2016-07-12 11:41:22 -04:00
|
|
|
App.controller "FreeTrialModalController", ($scope, abTestManager, sixpack, event_tracking)->
|
2014-11-24 18:59:55 -05:00
|
|
|
|
2015-10-27 19:35:13 -04:00
|
|
|
$scope.buttonClass = "btn-primary"
|
2014-11-24 18:59:55 -05:00
|
|
|
|
2015-11-16 10:52:47 -05:00
|
|
|
$scope.startFreeTrial = (source, couponCode) ->
|
2016-08-10 12:29:43 -04:00
|
|
|
event_tracking.sendMB "subscription-start-trial", { source }
|
2016-07-13 04:49:57 -04:00
|
|
|
|
2015-11-17 09:56:03 -05:00
|
|
|
w = window.open()
|
2015-11-16 11:40:14 -05:00
|
|
|
sixpack.convert "track-changes-discount", ->
|
2015-11-17 10:54:59 -05:00
|
|
|
sixpack.participate 'in-editor-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?
|
|
|
|
url = "#{url}&cc=#{couponCode}"
|
|
|
|
$scope.startedFreeTrial = true
|
|
|
|
w.location = url
|