2024-06-20 12:59:19 -04:00
|
|
|
import { User, Features } from '../../../types/user'
|
2024-06-18 06:01:37 -04:00
|
|
|
import { User as MinimalUser } from '../../../types/admin/user'
|
|
|
|
import { User as ManagedUser } from '../../../types/group-management/user'
|
|
|
|
import { UserSettings } from '../../../types/user-settings'
|
|
|
|
import { OAuthProviders } from '../../../types/oauth-providers'
|
|
|
|
import { ExposedSettings } from '../../../types/exposed-settings'
|
|
|
|
import {
|
|
|
|
type AllowedImageName,
|
|
|
|
OverallThemeMeta,
|
|
|
|
type SpellCheckLanguage,
|
|
|
|
} from '../../../types/project-settings'
|
|
|
|
import { CurrencyCode } from '../../../types/subscription/currency'
|
|
|
|
import { PricingFormState } from '../../../types/subscription/payment-context-value'
|
|
|
|
import { Plan } from '../../../types/subscription/plan'
|
|
|
|
import { Affiliation } from '../../../types/affiliation'
|
|
|
|
import type { PortalTemplate } from '../../../types/portal-template'
|
|
|
|
import { UserEmailData } from '../../../types/user-email'
|
|
|
|
import {
|
|
|
|
GroupsAndEnterpriseBannerVariant,
|
|
|
|
Institution as InstitutionType,
|
|
|
|
Notification as NotificationType,
|
|
|
|
PendingGroupSubscriptionEnrollment,
|
2024-10-03 13:01:32 -04:00
|
|
|
USGovBannerVariant,
|
2024-06-18 06:01:37 -04:00
|
|
|
} from '../../../types/project/dashboard/notification'
|
|
|
|
import { Survey } from '../../../types/project/dashboard/survey'
|
|
|
|
import { GetProjectsResponseBody } from '../../../types/project/dashboard/api'
|
|
|
|
import { Tag } from '../../../app/src/Features/Tags/types'
|
|
|
|
import { Institution } from '../../../types/institution'
|
|
|
|
import {
|
|
|
|
ManagedGroupSubscription,
|
|
|
|
MemberGroupSubscription,
|
|
|
|
} from '../../../types/subscription/dashboard/subscription'
|
|
|
|
import { SplitTestInfo } from '../../../types/split-test'
|
|
|
|
import { ValidationStatus } from '../../../types/group-management/validation'
|
|
|
|
import { ManagedInstitution } from '../../../types/subscription/dashboard/managed-institution'
|
|
|
|
import { GroupSSOTestResult } from '../../../modules/group-settings/frontend/js/utils/types'
|
|
|
|
import {
|
|
|
|
AccessToken,
|
|
|
|
InstitutionLink,
|
|
|
|
SAMLError,
|
|
|
|
} from '../../../types/settings-page'
|
|
|
|
import { SuggestedLanguage } from '../../../types/system-message'
|
|
|
|
import type { TeamInvite } from '../../../types/team-invite'
|
|
|
|
import { GroupPlans } from '../../../types/subscription/dashboard/group-plans'
|
|
|
|
import { GroupSSOLinkingStatus } from '../../../types/subscription/sso'
|
|
|
|
import { PasswordStrengthOptions } from '../../../types/password-strength-options'
|
|
|
|
import { Subscription as ProjectDashboardSubscription } from '../../../types/project/dashboard/subscription'
|
|
|
|
import { ThirdPartyIds } from '../../../types/third-party-ids'
|
|
|
|
import { Publisher } from '../../../types/subscription/dashboard/publisher'
|
2024-08-21 06:33:17 -04:00
|
|
|
import { DefaultNavbarMetadata } from '@/features/ui/components/types/default-navbar-metadata'
|
2024-08-29 06:48:16 -04:00
|
|
|
import { FatFooterMetadata } from '@/features/ui/components/types/fat-footer-metadata'
|
2024-06-18 06:01:37 -04:00
|
|
|
export interface Meta {
|
|
|
|
'ol-ExposedSettings': ExposedSettings
|
|
|
|
'ol-allInReconfirmNotificationPeriods': UserEmailData[]
|
2024-07-29 11:27:30 -04:00
|
|
|
'ol-allowedExperiments': string[]
|
2024-06-18 06:01:37 -04:00
|
|
|
'ol-allowedImageNames': AllowedImageName[]
|
|
|
|
'ol-anonymous': boolean
|
2024-10-02 04:25:02 -04:00
|
|
|
'ol-baseAssetPath': string
|
2024-06-18 06:01:37 -04:00
|
|
|
'ol-bootstrapVersion': 3 | 5
|
|
|
|
'ol-brandVariation': Record<string, any>
|
|
|
|
|
|
|
|
// dynamic keys based on permissions
|
|
|
|
'ol-cannot-add-secondary-email': boolean
|
|
|
|
'ol-cannot-change-password': boolean
|
|
|
|
'ol-cannot-delete-own-account': boolean
|
|
|
|
'ol-cannot-join-subscription': boolean
|
|
|
|
'ol-cannot-leave-group-subscription': boolean
|
|
|
|
'ol-cannot-link-google-sso': boolean
|
|
|
|
'ol-cannot-link-other-third-party-sso': boolean
|
|
|
|
'ol-cannot-reactivate-subscription': boolean
|
2024-06-21 09:58:26 -04:00
|
|
|
'ol-cannot-use-ai': boolean
|
2024-10-09 05:17:12 -04:00
|
|
|
'ol-chatEnabled': boolean
|
2024-06-18 06:01:37 -04:00
|
|
|
'ol-countryCode': PricingFormState['country']
|
|
|
|
'ol-couponCode': PricingFormState['coupon']
|
|
|
|
'ol-createdAt': Date
|
|
|
|
'ol-csrfToken': string
|
|
|
|
'ol-currentInstitutionsWithLicence': Institution[]
|
|
|
|
'ol-currentManagedUserAdminEmail': string
|
|
|
|
'ol-currentUrl': string
|
|
|
|
'ol-debugPdfDetach': boolean
|
|
|
|
'ol-detachRole': 'detached' | 'detacher' | ''
|
2024-10-02 04:25:02 -04:00
|
|
|
'ol-dictionariesRoot': 'string'
|
2024-06-18 06:01:37 -04:00
|
|
|
'ol-dropbox': { error: boolean; registered: boolean }
|
|
|
|
'ol-editorThemes': string[]
|
|
|
|
'ol-email': string
|
|
|
|
'ol-emailAddressLimit': number
|
|
|
|
'ol-error': { name: string } | undefined
|
|
|
|
'ol-expired': boolean
|
2024-06-20 12:59:19 -04:00
|
|
|
'ol-features': Features
|
2024-08-29 06:48:16 -04:00
|
|
|
'ol-footer': FatFooterMetadata
|
2024-06-18 06:01:37 -04:00
|
|
|
'ol-fromPlansPage': boolean
|
|
|
|
'ol-gitBridgeEnabled': boolean
|
|
|
|
'ol-gitBridgePublicBaseUrl': string
|
|
|
|
'ol-github': { enabled: boolean; error: boolean }
|
|
|
|
'ol-groupId': string
|
|
|
|
'ol-groupName': string
|
|
|
|
'ol-groupPlans': GroupPlans
|
|
|
|
'ol-groupSSOActive': boolean
|
|
|
|
'ol-groupSSOTestResult': GroupSSOTestResult
|
|
|
|
'ol-groupSettingsEnabledFor': string[]
|
|
|
|
'ol-groupSize': number
|
|
|
|
'ol-groupSsoSetupSuccess': boolean
|
|
|
|
'ol-groupSubscriptionsPendingEnrollment': PendingGroupSubscriptionEnrollment[]
|
|
|
|
'ol-groupsAndEnterpriseBannerVariant': GroupsAndEnterpriseBannerVariant
|
|
|
|
'ol-hasGroupSSOFeature': boolean
|
|
|
|
'ol-hasIndividualRecurlySubscription': boolean
|
|
|
|
'ol-hasManagedUsersFeature': boolean
|
|
|
|
'ol-hasPassword': boolean
|
|
|
|
'ol-hasSubscription': boolean
|
|
|
|
'ol-hasTrackChangesFeature': boolean
|
|
|
|
'ol-hideLinkingWidgets': boolean // CI only
|
|
|
|
'ol-i18n': { currentLangCode: string }
|
|
|
|
'ol-inactiveTutorials': string[]
|
|
|
|
'ol-institutionEmailNonCanonical': string | undefined
|
|
|
|
'ol-institutionLinked': InstitutionLink | undefined
|
|
|
|
'ol-inviteToken': string
|
|
|
|
'ol-inviterName': string
|
|
|
|
'ol-isExternalAuthenticationSystemUsed': boolean
|
|
|
|
'ol-isManagedAccount': boolean
|
|
|
|
'ol-isProfessional': boolean
|
|
|
|
'ol-isRegisteredViaGoogle': boolean
|
|
|
|
'ol-isRestrictedTokenMember': boolean
|
|
|
|
'ol-isSaas': boolean
|
|
|
|
'ol-itm_campaign': string
|
|
|
|
'ol-itm_content': string
|
|
|
|
'ol-itm_referrer': string
|
2024-06-20 12:59:19 -04:00
|
|
|
'ol-labs': boolean
|
2024-06-18 06:01:37 -04:00
|
|
|
'ol-languages': SpellCheckLanguage[]
|
|
|
|
'ol-learnedWords': string[]
|
|
|
|
'ol-legacyEditorThemes': string[]
|
2024-08-26 09:00:49 -04:00
|
|
|
'ol-linkSharingEnforcement': boolean
|
2024-06-25 02:08:24 -04:00
|
|
|
'ol-linkSharingWarning': boolean
|
2024-06-18 06:01:37 -04:00
|
|
|
'ol-loadingText': string
|
|
|
|
'ol-managedGroupSubscriptions': ManagedGroupSubscription[]
|
|
|
|
'ol-managedInstitutions': ManagedInstitution[]
|
|
|
|
'ol-managedPublishers': Publisher[]
|
|
|
|
'ol-managedUsersActive': boolean
|
|
|
|
'ol-managedUsersEnabled': boolean
|
|
|
|
'ol-managers': MinimalUser[]
|
|
|
|
'ol-mathJaxPath': string
|
|
|
|
'ol-maxDocLength': number
|
|
|
|
'ol-memberGroupSubscriptions': MemberGroupSubscription[]
|
|
|
|
'ol-memberOfSSOEnabledGroups': GroupSSOLinkingStatus[]
|
|
|
|
'ol-members': MinimalUser[]
|
2024-08-21 06:33:17 -04:00
|
|
|
'ol-navbar': DefaultNavbarMetadata
|
2024-06-18 06:01:37 -04:00
|
|
|
'ol-no-single-dollar': boolean
|
|
|
|
'ol-notifications': NotificationType[]
|
|
|
|
'ol-notificationsInstitution': InstitutionType[]
|
|
|
|
'ol-oauthProviders': OAuthProviders
|
|
|
|
'ol-overallThemes': OverallThemeMeta[]
|
|
|
|
'ol-passwordStrengthOptions': PasswordStrengthOptions
|
|
|
|
'ol-personalAccessTokens': AccessToken[] | undefined
|
|
|
|
'ol-plan': Plan
|
|
|
|
'ol-planCode': string
|
|
|
|
'ol-planCodesChangingAtTermEnd': string[] | undefined
|
|
|
|
'ol-plans': Plan[]
|
|
|
|
'ol-portalTemplates': PortalTemplate[]
|
|
|
|
'ol-postCheckoutRedirect': string
|
|
|
|
'ol-postUrl': string
|
|
|
|
'ol-prefetchedProjectsBlob': GetProjectsResponseBody | undefined
|
|
|
|
'ol-primaryEmail': { email: string; confirmed: boolean }
|
|
|
|
'ol-project': any // TODO
|
|
|
|
'ol-projectSyncSuccessMessage': string
|
|
|
|
'ol-projectTags': Tag[]
|
|
|
|
'ol-project_id': string
|
|
|
|
'ol-recommendedCurrency': CurrencyCode
|
|
|
|
'ol-reconfirmationRemoveEmail': string
|
|
|
|
'ol-reconfirmedViaSAML': string
|
|
|
|
'ol-recurlyApiKey': string
|
|
|
|
'ol-recurlySubdomain': string
|
2024-08-22 11:00:20 -04:00
|
|
|
'ol-ro-mirror-on-client-no-local-storage': boolean
|
2024-06-18 06:01:37 -04:00
|
|
|
'ol-samlError': SAMLError | undefined
|
|
|
|
'ol-settingsGroupSSO': { enabled: boolean } | undefined
|
|
|
|
'ol-settingsPlans': Plan[]
|
|
|
|
'ol-shouldAllowEditingDetails': boolean
|
|
|
|
'ol-showAiErrorAssistant': boolean
|
|
|
|
'ol-showBrlGeoBanner': boolean
|
|
|
|
'ol-showCouponField': boolean
|
|
|
|
'ol-showGroupsAndEnterpriseBanner': boolean
|
|
|
|
'ol-showInrGeoBanner': boolean
|
|
|
|
'ol-showLATAMBanner': boolean
|
|
|
|
'ol-showSupport': boolean
|
|
|
|
'ol-showSymbolPalette': boolean
|
|
|
|
'ol-showTemplatesServerPro': boolean
|
2024-10-03 13:01:32 -04:00
|
|
|
'ol-showUSGovBanner': boolean
|
2024-06-18 06:01:37 -04:00
|
|
|
'ol-showUpgradePrompt': boolean
|
|
|
|
'ol-skipUrl': string
|
|
|
|
'ol-splitTestInfo': { [name: string]: SplitTestInfo }
|
|
|
|
'ol-splitTestVariants': { [name: string]: string }
|
|
|
|
'ol-ssoDisabled': boolean
|
|
|
|
'ol-ssoErrorMessage': string
|
|
|
|
'ol-subscription': any // TODO: mixed types, split into two fields
|
|
|
|
'ol-subscriptionId': string
|
|
|
|
'ol-suggestedLanguage': SuggestedLanguage | undefined
|
|
|
|
'ol-survey': Survey | undefined
|
|
|
|
'ol-symbolPaletteAvailable': boolean
|
|
|
|
'ol-tags': Tag[]
|
|
|
|
'ol-teamInvites': TeamInvite[]
|
|
|
|
'ol-thirdPartyIds': ThirdPartyIds
|
2024-07-15 05:12:58 -04:00
|
|
|
'ol-translationIoNotLoaded': string
|
2024-07-22 05:54:27 -04:00
|
|
|
'ol-translationLoadErrorMessage': string
|
2024-07-15 05:12:58 -04:00
|
|
|
'ol-translationMaintenance': string
|
2024-07-22 05:54:27 -04:00
|
|
|
'ol-translationUnableToJoin': string
|
2024-10-03 13:01:32 -04:00
|
|
|
'ol-usGovBannerVariant': USGovBannerVariant
|
2024-06-18 06:01:37 -04:00
|
|
|
'ol-useShareJsHash': boolean
|
2024-08-01 08:19:58 -04:00
|
|
|
'ol-usedLatex': 'never' | 'occasionally' | 'often' | undefined
|
2024-06-18 06:01:37 -04:00
|
|
|
'ol-user': User
|
|
|
|
'ol-userAffiliations': Affiliation[]
|
2024-08-07 11:30:55 -04:00
|
|
|
'ol-userCanExtendTrial': boolean
|
|
|
|
'ol-userCanNotStartRequestedTrial': boolean
|
2024-06-18 06:01:37 -04:00
|
|
|
'ol-userEmails': UserEmailData[]
|
|
|
|
'ol-userSettings': UserSettings
|
|
|
|
'ol-user_id': string | undefined
|
|
|
|
'ol-users': ManagedUser[]
|
|
|
|
'ol-usersBestSubscription': ProjectDashboardSubscription | undefined
|
|
|
|
'ol-usersEmail': string | undefined
|
|
|
|
'ol-validationStatus': ValidationStatus
|
2024-08-20 14:45:04 -04:00
|
|
|
'ol-websiteRedesignPlansVariant': 'default' | 'light-design' | 'new-design'
|
2024-06-18 06:01:37 -04:00
|
|
|
'ol-wikiEnabled': boolean
|
|
|
|
'ol-writefullCssUrl': string
|
|
|
|
'ol-writefullEnabled': boolean
|
|
|
|
'ol-writefullJsUrl': string
|
|
|
|
'ol-wsUrl': string
|
|
|
|
}
|
|
|
|
|
|
|
|
// cache for parsed values
|
|
|
|
window.metaAttributesCache = window.metaAttributesCache || new Map()
|
|
|
|
|
|
|
|
export default function getMeta<T extends keyof Meta>(name: T): Meta[T] {
|
|
|
|
if (window.metaAttributesCache.has(name)) {
|
|
|
|
return window.metaAttributesCache.get(name)
|
|
|
|
}
|
|
|
|
const element = document.head.querySelector(
|
|
|
|
`meta[name="${name}"]`
|
|
|
|
) as HTMLMetaElement
|
|
|
|
if (!element) {
|
|
|
|
return undefined!
|
|
|
|
}
|
|
|
|
const plainTextValue = element.content
|
|
|
|
let value
|
|
|
|
switch (element.dataset.type) {
|
|
|
|
case 'boolean':
|
|
|
|
// in pug: content=false -> no content field
|
|
|
|
// in pug: content=true -> empty content field
|
|
|
|
value = element.hasAttribute('content')
|
|
|
|
break
|
|
|
|
case 'json':
|
|
|
|
if (!plainTextValue) {
|
|
|
|
// JSON.parse('') throws
|
|
|
|
value = undefined
|
|
|
|
} else {
|
|
|
|
value = JSON.parse(plainTextValue)
|
|
|
|
}
|
|
|
|
break
|
|
|
|
default:
|
|
|
|
value = plainTextValue
|
|
|
|
}
|
|
|
|
window.metaAttributesCache.set(name, value)
|
|
|
|
return value
|
|
|
|
}
|