mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-21 20:47:08 -05:00
Merge pull request #4052 from overleaf/ab-subscription-page-split-test-2
Subscription page split test GitOrigin-RevId: 022a91d97f20d584e47e1f6b5575e689983df129
This commit is contained in:
parent
ec3400c7cd
commit
03b2d184b5
5 changed files with 89 additions and 3 deletions
|
@ -32,7 +32,12 @@ const V1SubscriptionManager = require('./V1SubscriptionManager')
|
|||
const Errors = require('../Errors/Errors')
|
||||
const HttpErrorHandler = require('../Errors/HttpErrorHandler')
|
||||
const SubscriptionErrors = require('./Errors')
|
||||
const SplitTestHandler = require('../SplitTests/SplitTestHandler')
|
||||
const AnalyticsManager = require('../Analytics/AnalyticsManager')
|
||||
const OError = require('@overleaf/o-error')
|
||||
const _ = require('lodash')
|
||||
|
||||
const SUBSCRIPTION_PAGE_SPLIT_TEST = 'subscription-page'
|
||||
|
||||
module.exports = SubscriptionController = {
|
||||
plansPage(req, res, next) {
|
||||
|
@ -166,11 +171,47 @@ module.exports = SubscriptionController = {
|
|||
const plans = SubscriptionViewModelBuilder.buildPlansList(
|
||||
personalSubscription ? personalSubscription.plan : undefined
|
||||
)
|
||||
|
||||
let subscriptionCopy = 'default'
|
||||
if (
|
||||
personalSubscription ||
|
||||
hasSubscription ||
|
||||
(memberGroupSubscriptions &&
|
||||
memberGroupSubscriptions.length > 0) ||
|
||||
(confirmedMemberAffiliations &&
|
||||
confirmedMemberAffiliations.length > 0 &&
|
||||
_.find(confirmedMemberAffiliations, affiliation => {
|
||||
return affiliation.licence && affiliation.licence !== 'free'
|
||||
}))
|
||||
) {
|
||||
AnalyticsManager.recordEvent(user._id, 'subscription-page-view')
|
||||
} else {
|
||||
const testSegmentation = SplitTestHandler.getTestSegmentation(
|
||||
user._id,
|
||||
SUBSCRIPTION_PAGE_SPLIT_TEST
|
||||
)
|
||||
if (testSegmentation.enabled) {
|
||||
subscriptionCopy = testSegmentation.variant
|
||||
|
||||
AnalyticsManager.recordEvent(
|
||||
user._id,
|
||||
'subscription-page-view',
|
||||
{
|
||||
splitTestId: SUBSCRIPTION_PAGE_SPLIT_TEST,
|
||||
splitTestVariantId: testSegmentation.variant,
|
||||
}
|
||||
)
|
||||
} else {
|
||||
AnalyticsManager.recordEvent(user._id, 'subscription-page-view')
|
||||
}
|
||||
}
|
||||
|
||||
const data = {
|
||||
title: 'your_subscription',
|
||||
plans,
|
||||
user,
|
||||
hasSubscription,
|
||||
subscriptionCopy,
|
||||
fromPlansPage,
|
||||
personalSubscription,
|
||||
memberGroupSubscriptions,
|
||||
|
|
|
@ -56,6 +56,14 @@ block content
|
|||
a(href="mailto:support@overleaf.com") support@overleaf.com
|
||||
| to find out more.
|
||||
else
|
||||
p(ng-non-bindable) You're on the #{settings.appName} Free plan.
|
||||
|
|
||||
a(ng-controller="UpgradeSubscriptionController" href="/user/subscription/plans" ng-click="upgradeSubscription()").btn.btn-primary Upgrade now
|
||||
if (subscriptionCopy === 'new')
|
||||
p(ng-non-bindable) You are on the #{settings.appName} Free plan. Upgrade to access these Premium Features:
|
||||
ul
|
||||
li Invite more collaborators
|
||||
for feature in ['realtime_track_changes', 'full_doc_history', 'reference_search', 'reference_sync', 'dropbox_integration_lowercase', 'github_integration_lowercase', 'priority_support']
|
||||
li #{translate(feature)}
|
||||
a(ng-controller="UpgradeSubscriptionController" href="/user/subscription/plans" ng-click="upgradeSubscription()").btn.btn-primary Upgrade now
|
||||
else
|
||||
p(ng-non-bindable) You're on the #{settings.appName} Free plan.
|
||||
|
|
||||
a(ng-controller="UpgradeSubscriptionController" href="/user/subscription/plans" ng-click="upgradeSubscription()").btn.btn-primary Upgrade now
|
||||
|
|
|
@ -246,6 +246,16 @@ module.exports = settings =
|
|||
rolloutPercent: parseInt(process.env['SPLITTEST_EXAMPLE_PROJECT_FROG_VARIANT_ROLLOUT_PERCENT'] || '0', 10)
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
id: 'subscription-page'
|
||||
active: process.env['SPLITTEST_SUBSCRIPTION_PAGE_ACTIVE'] == 'true'
|
||||
variants: [
|
||||
{
|
||||
id: 'new'
|
||||
rolloutPercent: parseInt(process.env['SPLITTEST_SUBSCRIPTION_PAGE_NEW_VARIANT_ROLLOUT_PERCENT'] || '0', 10)
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
|
||||
|
|
21
services/web/config/settings.webpack.coffee
Normal file
21
services/web/config/settings.webpack.coffee
Normal file
|
@ -0,0 +1,21 @@
|
|||
Path = require('path')
|
||||
|
||||
module.exports = {
|
||||
overleafModuleImports: {
|
||||
# modules to import (an array of paths relative to this file in /app/config at build time)
|
||||
createFileModes: [
|
||||
Path.resolve(__dirname, '../modules/tpr-webmodule/frontend/js/components/create-file-mode-mendeley.js'),
|
||||
Path.resolve(__dirname, '../modules/tpr-webmodule/frontend/js/components/create-file-mode-zotero.js')
|
||||
],
|
||||
tprLinkedFileInfo: [
|
||||
Path.resolve(__dirname, '../modules/tpr-webmodule/frontend/js/components/linked-file-info.js')
|
||||
],
|
||||
tprLinkedFileRefreshError: [
|
||||
Path.resolve(__dirname, '../modules/tpr-webmodule/frontend/js/components/linked-file-refresh-error.js')
|
||||
],
|
||||
gitBridge: [Path.resolve(__dirname, '../modules/git-bridge/frontend/js/components/git-bridge-modal.js')]
|
||||
publishModal: [
|
||||
Path.resolve(__dirname, '../modules/publish-modal/frontend/js/components/publish-toolbar-button')
|
||||
]
|
||||
}
|
||||
}
|
|
@ -115,6 +115,12 @@ describe('SubscriptionController', function () {
|
|||
unprocessableEntity: sinon.stub(),
|
||||
}),
|
||||
'./Errors': SubscriptionErrors,
|
||||
'../Analytics/AnalyticsManager': (this.AnalyticsManager = {
|
||||
recordEvent: sinon.stub(),
|
||||
}),
|
||||
'../SplitTests/SplitTestHandler': (this.SplitTestHandler = {
|
||||
getTestSegmentation: () => {},
|
||||
}),
|
||||
},
|
||||
})
|
||||
|
||||
|
|
Loading…
Reference in a new issue