mirror of
https://github.com/overleaf/overleaf.git
synced 2025-04-10 20:27:13 +00:00
Merge pull request #3266 from overleaf/hb-improve-upgrade-ctas
Different upgrade cta when user has a subscription GitOrigin-RevId: e26b8784035a4c38b523abf1ac0eeb52e1a63fb0
This commit is contained in:
parent
c257b9695a
commit
acd51e88c8
4 changed files with 45 additions and 19 deletions
|
@ -727,7 +727,7 @@ const ProjectController = {
|
|||
projectId,
|
||||
anonRequestToken,
|
||||
(error, privilegeLevel) => {
|
||||
let allowedFreeTrial
|
||||
let allowedFreeTrial = true
|
||||
if (error != null) {
|
||||
return next(error)
|
||||
}
|
||||
|
@ -738,12 +738,8 @@ const ProjectController = {
|
|||
return res.sendStatus(401)
|
||||
}
|
||||
|
||||
if (
|
||||
subscription != null &&
|
||||
subscription.freeTrial != null &&
|
||||
subscription.freeTrial.expiresAt != null
|
||||
) {
|
||||
allowedFreeTrial = !!subscription.freeTrial.allowed || true
|
||||
if (subscription != null) {
|
||||
allowedFreeTrial = false
|
||||
}
|
||||
|
||||
let wsUrl = Settings.wsUrl
|
||||
|
@ -794,9 +790,7 @@ const ProjectController = {
|
|||
last_name: user.last_name,
|
||||
referal_id: user.referal_id,
|
||||
signUpDate: user.signUpDate,
|
||||
subscription: {
|
||||
freeTrial: { allowed: allowedFreeTrial }
|
||||
},
|
||||
allowedFreeTrial: allowedFreeTrial,
|
||||
featureSwitches: user.featureSwitches,
|
||||
features: user.features,
|
||||
refProviders: user.refProviders,
|
||||
|
|
|
@ -579,13 +579,19 @@ script(type="text/ng-template", id="trackChangesUpgradeModalTemplate")
|
|||
i.fa.fa-check
|
||||
| #{translate("accept_or_reject_each_changes_individually")}
|
||||
|
||||
|
||||
.row.text-center(ng-controller="FreeTrialModalController")
|
||||
a.btn.btn-success(
|
||||
href
|
||||
ng-click="startFreeTrial('real-time-track-changes')"
|
||||
ng-show="project.owner._id == user.id"
|
||||
) #{translate("try_it_for_free")}
|
||||
.row.text-center
|
||||
div(ng-show="user.allowedFreeTrial" ng-controller="FreeTrialModalController")
|
||||
a.btn.btn-success(
|
||||
href
|
||||
ng-click="startFreeTrial('real-time-track-changes')"
|
||||
ng-show="project.owner._id == user.id"
|
||||
) #{translate("try_it_for_free")}
|
||||
div(ng-show="!user.allowedFreeTrial" ng-controller="UpgradeModalController")
|
||||
a.btn.btn-success(
|
||||
href
|
||||
ng-click="upgradePlan('projectMembers')"
|
||||
ng-show="project.owner._id == user.id"
|
||||
) #{translate("upgrade")}
|
||||
p(ng-show="project.owner._id != user.id"): strong #{translate("please_ask_the_project_owner_to_upgrade_to_track_changes")}
|
||||
|
||||
.modal-footer()
|
||||
|
|
|
@ -203,14 +203,20 @@ script(type='text/ng-template', id='shareProjectModalTemplate')
|
|||
li
|
||||
i.fa.fa-check
|
||||
|#{translate("compile_larger_projects")}
|
||||
|
||||
p.text-center.row-spaced-thin(ng-controller="FreeTrialModalController")
|
||||
p.text-center.row-spaced-thin(ng-show="user.allowedFreeTrial" ng-controller="FreeTrialModalController")
|
||||
a.btn.btn-success(
|
||||
href
|
||||
ng-class="buttonClass"
|
||||
ng-click="startFreeTrial('projectMembers')"
|
||||
) #{translate("start_free_trial")}
|
||||
|
||||
p.text-center.row-spaced-thin(ng-show="!user.allowedFreeTrial" ng-controller="UpgradeModalController")
|
||||
a.btn.btn-success(
|
||||
href
|
||||
ng-class="buttonClass"
|
||||
ng-click="upgradePlan('projectMembers')"
|
||||
) #{translate("upgrade")}
|
||||
|
||||
p.small(ng-show="startedFreeTrial")
|
||||
| #{translate("refresh_page_after_starting_free_trial")}
|
||||
.row.public-access-level.public-access-level--notice(ng-show="!isAdmin")
|
||||
|
|
|
@ -37,3 +37,23 @@ export default App.controller('FreeTrialModalController', function(
|
|||
go()
|
||||
}
|
||||
})
|
||||
|
||||
App.controller('UpgradeModalController', function($scope, eventTracking) {
|
||||
$scope.buttonClass = 'btn-primary'
|
||||
|
||||
$scope.upgradePlan = function(source) {
|
||||
const w = window.open()
|
||||
const go = function() {
|
||||
let url
|
||||
if (typeof ga === 'function') {
|
||||
ga('send', 'event', 'subscription-funnel', 'upgraded-plan', source)
|
||||
}
|
||||
url = '/user/subscription'
|
||||
$scope.startedFreeTrial = true
|
||||
|
||||
w.location = url
|
||||
}
|
||||
|
||||
go()
|
||||
}
|
||||
})
|
||||
|
|
Loading…
Add table
Reference in a new issue