2014-11-24 23:59:55 +00:00
|
|
|
define [
|
|
|
|
"base"
|
|
|
|
], (App) ->
|
2016-07-12 15:41:22 +00:00
|
|
|
App.controller "FreeTrialModalController", ($scope, abTestManager, sixpack, event_tracking)->
|
2014-11-24 23:59:55 +00:00
|
|
|
|
2015-10-27 23:35:13 +00:00
|
|
|
$scope.buttonClass = "btn-primary"
|
2014-11-24 23:59:55 +00:00
|
|
|
|
2015-11-16 15:52:47 +00:00
|
|
|
$scope.startFreeTrial = (source, couponCode) ->
|
2016-10-24 10:00:09 +00:00
|
|
|
event_tracking.sendMB "subscription-start-trial", { source, plan: $scope.startTrialPlanCode }
|
2016-07-13 08:49:57 +00:00
|
|
|
|
2015-11-17 14:56:03 +00:00
|
|
|
w = window.open()
|
2015-11-16 16:40:14 +00:00
|
|
|
sixpack.convert "track-changes-discount", ->
|
2016-10-13 12:47:05 +00:00
|
|
|
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
|