mirror of
https://github.com/overleaf/overleaf.git
synced 2024-11-30 03:53:05 -05:00
aa480a2663
[web] migrate from window attributes to getMeta GitOrigin-RevId: 3dcf1ab6b01155e5e4abeb3e78d0fa9053e055bc
81 lines
2.2 KiB
JavaScript
81 lines
2.2 KiB
JavaScript
import useFetchMock from '../hooks/use-fetch-mock'
|
|
import SettingsPageRoot from '../../js/features/settings/components/root'
|
|
import {
|
|
setDefaultMeta as setDefaultLeaveMeta,
|
|
defaultSetupMocks as defaultSetupLeaveMocks,
|
|
} from './helpers/leave'
|
|
import {
|
|
setDefaultMeta as setDefaultAccountInfoMeta,
|
|
defaultSetupMocks as defaultSetupAccountInfoMocks,
|
|
} from './helpers/account-info'
|
|
import {
|
|
setDefaultMeta as setDefaultPasswordMeta,
|
|
defaultSetupMocks as defaultSetupPasswordMocks,
|
|
} from './helpers/password'
|
|
import {
|
|
setDefaultMeta as setDefaultEmailsMeta,
|
|
defaultSetupMocks as defaultSetupEmailsMocks,
|
|
} from './helpers/emails'
|
|
import {
|
|
setDefaultMeta as setDefaultLinkingMeta,
|
|
defaultSetupMocks as defaultSetupLinkingMocks,
|
|
setPersonalAccessTokensMeta,
|
|
} from './helpers/linking'
|
|
import { UserProvider } from '../../js/shared/context/user-context'
|
|
import { ScopeDecorator } from '../decorators/scope'
|
|
import getMeta from '@/utils/meta'
|
|
|
|
export const Overleaf = args => {
|
|
setDefaultLeaveMeta()
|
|
setDefaultAccountInfoMeta()
|
|
setDefaultPasswordMeta()
|
|
setDefaultEmailsMeta()
|
|
setDefaultLinkingMeta()
|
|
useFetchMock(fetchMock => {
|
|
defaultSetupLeaveMocks(fetchMock)
|
|
defaultSetupAccountInfoMocks(fetchMock)
|
|
defaultSetupPasswordMocks(fetchMock)
|
|
defaultSetupEmailsMocks(fetchMock)
|
|
defaultSetupLinkingMocks(fetchMock)
|
|
})
|
|
|
|
return (
|
|
<UserProvider>
|
|
<SettingsPageRoot {...args} />
|
|
</UserProvider>
|
|
)
|
|
}
|
|
|
|
export const OverleafWithAccessTokens = args => {
|
|
setPersonalAccessTokensMeta()
|
|
return Overleaf(args)
|
|
}
|
|
|
|
export const ServerPro = args => {
|
|
setDefaultAccountInfoMeta()
|
|
setDefaultPasswordMeta()
|
|
setPersonalAccessTokensMeta()
|
|
useFetchMock(fetchMock => {
|
|
defaultSetupAccountInfoMocks(fetchMock)
|
|
defaultSetupPasswordMocks(fetchMock)
|
|
})
|
|
|
|
Object.assign(getMeta('ol-ExposedSettings'), {
|
|
hasAffiliationsFeature: false,
|
|
isOverleaf: false,
|
|
})
|
|
window.metaAttributesCache.set('ol-hideLinkingWidgets', true)
|
|
window.metaAttributesCache.delete('ol-oauthProviders')
|
|
|
|
return (
|
|
<UserProvider>
|
|
<SettingsPageRoot {...args} />
|
|
</UserProvider>
|
|
)
|
|
}
|
|
|
|
export default {
|
|
title: 'Account Settings / Full Page',
|
|
component: SettingsPageRoot,
|
|
decorators: [ScopeDecorator],
|
|
}
|