overleaf/services/web/public/coffee/main/account-upgrade.coffee
Jessica Lawshe f44ddcb928 Remove "plans-1610" experiment
There is 1 place that the variants appear still,
`/web/public/coffee/main/subscription-dashboard.coffee`. This should
remain for users that bought these plans.
2018-04-12 10:18:15 -05:00

36 lines
1.1 KiB
CoffeeScript

define [
"base"
], (App) ->
App.controller "FreeTrialModalController", ($scope, abTestManager, sixpack, event_tracking)->
$scope.buttonClass = "btn-primary"
$scope.startFreeTrial = (source, couponCode) ->
plan = 'collaborator_free_trial_7_days'
w = window.open()
go = () ->
ga?('send', 'event', 'subscription-funnel', 'upgraded-free-trial', source)
if window.redirectToOLFreeTrialUrl?
url = window.redirectToOLFreeTrialUrl
else
url = "/user/subscription/new?planCode=#{plan}&ssp=true"
if couponCode?
url = "#{url}&cc=#{couponCode}"
$scope.startedFreeTrial = true
switch source
when "dropbox"
sixpack.participate 'teaser-dropbox-text', ['default', 'dropbox-focused'], (variant) ->
event_tracking.sendMB "subscription-start-trial", { source, plan, variant }
when "history"
sixpack.participate 'teaser-history', ['default', 'focused'], (variant) ->
event_tracking.sendMB "subscription-start-trial", { source, plan, variant }
else
event_tracking.sendMB "subscription-start-trial", { source, plan }
w.location = url
go()