mirror of
https://github.com/overleaf/overleaf.git
synced 2024-12-11 17:06:43 -05:00
da2c0b3fea
Sending unnecessary query params to OL seems like a footgun, so switch to compromise that is more explicit but doesn't send unnecessary query params
42 lines
1.3 KiB
CoffeeScript
42 lines
1.3 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
|
|
|
|
if $scope.shouldABTestPlans
|
|
sixpack.participate 'plans-1610', ['default', 'heron', 'ibis'], (chosenVariation, rawResponse)->
|
|
if chosenVariation in ['heron', 'ibis']
|
|
plan = "collaborator_#{chosenVariation}"
|
|
go()
|
|
else
|
|
go()
|