Merge pull request #15857 from overleaf/mf-split-test-website-redesign

[web] Configure `website-redesign` split test

GitOrigin-RevId: 8b1b3c6ab1ba9c674517ebdb87e89bd3a44aade7
This commit is contained in:
M Fahru 2023-11-21 11:30:19 -07:00 committed by Copybot
parent 9f80dd48e8
commit 8aed8f7dd7
2 changed files with 22 additions and 7 deletions

View file

@ -58,6 +58,12 @@ module.exports = HomeController = {
)
}
const websiteRedesignVariant =
res.locals.splitTestVariants?.['website-redesign']
const websiteRedesignActive =
websiteRedesignVariant === 'new-design' ||
websiteRedesignVariant === 'new-design-registration'
const onboardingFlowAssignment =
await SplitTestHandler.promises.getAssignment(
req,
@ -65,12 +71,18 @@ module.exports = HomeController = {
'onboarding-flow'
)
return res.render('external/home/v2', {
designSystemUpdatesVariant: designSystemUpdatesAssignment.variant,
onboardingFlowVariant: onboardingFlowAssignment.variant,
hideNewsletterCheckbox:
onboardingFlowAssignment.variant === 'token-confirmation-odc',
})
if (websiteRedesignActive) {
return res.render('external/home/website-redesign/index', {
onboardingFlowVariant: onboardingFlowAssignment.variant,
})
} else {
return res.render('external/home/v2', {
designSystemUpdatesVariant: designSystemUpdatesAssignment.variant,
onboardingFlowVariant: onboardingFlowAssignment.variant,
hideNewsletterCheckbox:
onboardingFlowAssignment.variant === 'token-confirmation-odc',
})
}
} else {
return res.redirect('/login')
}

View file

@ -81,7 +81,10 @@ function getWebpackAssets(entrypoint, section) {
module.exports = function (webRouter, privateApiRouter, publicApiRouter) {
webRouter.use(
expressify(
SplitTestMiddleware.loadAssignmentsInLocals(['design-system-updates'])
SplitTestMiddleware.loadAssignmentsInLocals([
'design-system-updates',
'website-redesign',
])
)
)