Open Overleaf assist paywall if in "overleaf-assist-bundle" split-test (#23894)
* Add overleaf assist paywall modal component in storybook * update img alt * remove data-action * rename assistant -> assist * use css var for blue color * Open Overleaf assist paywall if in "overleaf-assist-bundle" split-test * dont use optional planCode GitOrigin-RevId: 9315ee2350cb7bc804afa720047849c220781686
This commit is contained in:
committed by
Copybot
parent
a8030f9e32
commit
0a270e0870
@@ -356,6 +356,7 @@ const _ProjectController = {
|
||||
'papers-integration',
|
||||
'editor-redesign',
|
||||
'paywall-change-compile-timeout',
|
||||
'overleaf-assist-bundle',
|
||||
].filter(Boolean)
|
||||
|
||||
const getUserValues = async userId =>
|
||||
@@ -756,6 +757,9 @@ const _ProjectController = {
|
||||
chatEnabled = Features.hasFeature('chat')
|
||||
}
|
||||
|
||||
const isOverleafAssistBundleEnabled =
|
||||
splitTestAssignments['overleaf-assist-bundle']?.variant === 'enabled'
|
||||
|
||||
const isPaywallChangeCompileTimeoutEnabled =
|
||||
splitTestAssignments['paywall-change-compile-timeout']?.variant ===
|
||||
'enabled'
|
||||
@@ -764,6 +768,10 @@ const _ProjectController = {
|
||||
isPaywallChangeCompileTimeoutEnabled &&
|
||||
(await ProjectController._getPaywallPlansPrices(req, res))
|
||||
|
||||
const addonPrices =
|
||||
isOverleafAssistBundleEnabled &&
|
||||
(await ProjectController._getAddonPrices(req, res))
|
||||
|
||||
res.render(template, {
|
||||
title: project.name,
|
||||
priority_title: true,
|
||||
@@ -865,7 +873,10 @@ const _ProjectController = {
|
||||
reviewerRoleAssignment?.variant === 'enabled' ||
|
||||
Object.keys(project.reviewer_refs || {}).length > 0,
|
||||
isPaywallChangeCompileTimeoutEnabled,
|
||||
isOverleafAssistBundleEnabled,
|
||||
paywallPlans,
|
||||
addonPrices,
|
||||
planCode: subscription?.planCode,
|
||||
})
|
||||
timer.done()
|
||||
} catch (err) {
|
||||
@@ -900,6 +911,28 @@ const _ProjectController = {
|
||||
return plansData
|
||||
},
|
||||
|
||||
async _getAddonPrices(req, res, addonPlans = ['assistBundle']) {
|
||||
const plansData = {}
|
||||
|
||||
const locale = req.i18n.language
|
||||
const { currency } = await SubscriptionController.getRecommendedCurrency(
|
||||
req,
|
||||
res
|
||||
)
|
||||
|
||||
addonPlans.forEach(plan => {
|
||||
const annualPrice = Settings.localizedAddOnsPricing[currency][plan].annual
|
||||
const monthlyPrice =
|
||||
Settings.localizedAddOnsPricing[currency][plan].monthly
|
||||
|
||||
plansData[plan] = {
|
||||
annual: formatCurrency(annualPrice, currency, locale, true),
|
||||
monthly: formatCurrency(monthlyPrice, currency, locale, true),
|
||||
}
|
||||
})
|
||||
return plansData
|
||||
},
|
||||
|
||||
async _refreshFeatures(req, user) {
|
||||
// If the feature refresh has failed in this session, don't retry
|
||||
// it - require the user to log in again.
|
||||
@@ -1203,6 +1236,7 @@ const ProjectController = {
|
||||
_isInPercentageRollout: _ProjectController._isInPercentageRollout,
|
||||
_refreshFeatures: _ProjectController._refreshFeatures,
|
||||
_getPaywallPlansPrices: _ProjectController._getPaywallPlansPrices,
|
||||
_getAddonPrices: _ProjectController._getAddonPrices,
|
||||
}
|
||||
|
||||
module.exports = ProjectController
|
||||
|
||||
Reference in New Issue
Block a user