Merge pull request #23319 from overleaf/rh-compile-timeout-students

Expose ODC role to compile timeout paywall

GitOrigin-RevId: eca3983019200349e90b4681b59720c0028fb3b6
This commit is contained in:
roo hutton
2025-02-04 09:05:10 +00:00
committed by Copybot
parent a38e0ffd53
commit e33f1bf108
4 changed files with 35 additions and 1 deletions
@@ -411,6 +411,13 @@ const _ProjectController = {
logger.error({ err, userId })
return null
}),
odcRole: OnboardingDataCollectionManager.getOnboardingDataValue(
userId,
'role'
).catch(err => {
logger.error({ err, userId })
return null
}),
})
)
const splitTestAssignments = {}
@@ -464,6 +471,7 @@ const _ProjectController = {
isTokenMember,
isInvitedMember,
usedLatex,
odcRole,
} = userValues
const brandVariation = project?.brandVariationId
@@ -816,6 +824,12 @@ const _ProjectController = {
'enabled'
? usedLatex
: null,
odcRole:
// only use the ODC role value if the split test is enabled
splitTestAssignments['paywall-change-compile-timeout']?.variant ===
'enabled'
? odcRole
: null,
isSaas: Features.hasFeature('saas'),
shouldLoadHotjar: splitTestAssignments.hotjar?.variant === 'enabled',
isReviewerRoleEnabled:
@@ -40,6 +40,7 @@ meta(name="ol-ro-mirror-on-client-no-local-storage" data-type="boolean" content=
meta(name="ol-isSaas" data-type="boolean" content=isSaas)
meta(name="ol-shouldLoadHotjar" data-type="boolean" content=shouldLoadHotjar)
meta(name="ol-isReviewerRoleEnabled" data-type="boolean" content=isReviewerRoleEnabled)
meta(name="ol-odcRole" data-type="string" content=odcRole)
meta(name="ol-isPaywallChangeCompileTimeoutEnabled" data-type="boolean" content=isPaywallChangeCompileTimeoutEnabled)
// translations for the loading page, before i18n has loaded in the client
@@ -1,5 +1,23 @@
import getMeta from '@/utils/meta'
import {
studentRoles,
StudentRole,
} from '../../../../../modules/onboarding/frontend/js/components/data/roles'
import { useMemo } from 'react'
function TimeoutUpgradePaywallPrompt() {
return <div>Hello world from new paywall component</div>
const odcRole = getMeta('ol-odcRole')
const isStudent = useMemo(
() => studentRoles.includes(odcRole as StudentRole),
[odcRole]
)
return (
<div>
<p>Hello world from new paywall component</p>
<p>Current user is {!isStudent && 'not'} a student.</p>
</div>
)
}
export default TimeoutUpgradePaywallPrompt
+1
View File
@@ -153,6 +153,7 @@ export interface Meta {
'ol-notifications': NotificationType[]
'ol-notificationsInstitution': InstitutionType[]
'ol-oauthProviders': OAuthProviders
'ol-odcRole': string
'ol-overallThemes': OverallThemeMeta[]
'ol-passwordStrengthOptions': PasswordStrengthOptions
'ol-personalAccessTokens': AccessToken[] | undefined