mirror of
https://github.com/overleaf/overleaf.git
synced 2024-10-31 21:21:03 -04:00
22 lines
No EOL
825 B
CoffeeScript
22 lines
No EOL
825 B
CoffeeScript
define [
|
|
"base"
|
|
], (App) ->
|
|
App.controller "FreeTrialModalController", ($scope, abTestManager)->
|
|
|
|
$scope.buttonClass = "btn-primary"
|
|
|
|
$scope.startFreeTrial = (source, couponCode) ->
|
|
|
|
testBuckets = [
|
|
{ bucketName:"student_control", planName:"student"}
|
|
{ bucketName:"collab_test", planName:"collaborator"}
|
|
]
|
|
|
|
editorPlanBucket = abTestManager.getABTestBucket "editor_plan", testBuckets
|
|
abTestManager.processTestWithStep("editor_plan", editorPlanBucket.bucketName, 0)
|
|
ga?('send', 'event', 'subscription-funnel', 'upgraded-free-trial', source)
|
|
url = "/user/subscription/new?planCode=#{editorPlanBucket.planName}_free_trial_7_days&ssp=#{editorPlanBucket.planName == 'collaborator'}"
|
|
if couponCode?
|
|
url = "#{url}&cc=#{couponCode}&scf=true"
|
|
window.open(url)
|
|
$scope.startedFreeTrial = true |