2022-04-22 09:49:26 -04:00
|
|
|
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 {
|
2022-04-25 07:04:44 -04:00
|
|
|
setDefaultMeta as setDefaultLinkingMeta,
|
|
|
|
defaultSetupMocks as defaultSetupLinkingMocks,
|
2023-05-17 04:59:51 -04:00
|
|
|
setPersonalAccessTokensMeta,
|
2022-04-25 07:04:44 -04:00
|
|
|
} from './helpers/linking'
|
2022-04-22 09:49:26 -04:00
|
|
|
import { UserProvider } from '../../js/shared/context/user-context'
|
2022-05-24 03:47:08 -04:00
|
|
|
import { ScopeDecorator } from '../decorators/scope'
|
2024-06-18 06:01:37 -04:00
|
|
|
import getMeta from '@/utils/meta'
|
2022-04-22 09:49:26 -04:00
|
|
|
|
2022-04-27 12:13:42 -04:00
|
|
|
export const Overleaf = args => {
|
2022-04-22 09:49:26 -04:00
|
|
|
setDefaultLeaveMeta()
|
|
|
|
setDefaultAccountInfoMeta()
|
|
|
|
setDefaultPasswordMeta()
|
|
|
|
setDefaultEmailsMeta()
|
2022-04-25 07:04:44 -04:00
|
|
|
setDefaultLinkingMeta()
|
2022-04-25 07:05:15 -04:00
|
|
|
useFetchMock(fetchMock => {
|
|
|
|
defaultSetupLeaveMocks(fetchMock)
|
|
|
|
defaultSetupAccountInfoMocks(fetchMock)
|
|
|
|
defaultSetupPasswordMocks(fetchMock)
|
|
|
|
defaultSetupEmailsMocks(fetchMock)
|
|
|
|
defaultSetupLinkingMocks(fetchMock)
|
|
|
|
})
|
2022-04-22 09:49:26 -04:00
|
|
|
|
|
|
|
return (
|
|
|
|
<UserProvider>
|
|
|
|
<SettingsPageRoot {...args} />
|
|
|
|
</UserProvider>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2023-05-17 04:59:51 -04:00
|
|
|
export const OverleafWithAccessTokens = args => {
|
|
|
|
setPersonalAccessTokensMeta()
|
|
|
|
return Overleaf(args)
|
|
|
|
}
|
|
|
|
|
2022-04-27 12:13:42 -04:00
|
|
|
export const ServerPro = args => {
|
|
|
|
setDefaultAccountInfoMeta()
|
|
|
|
setDefaultPasswordMeta()
|
2023-05-17 04:59:51 -04:00
|
|
|
setPersonalAccessTokensMeta()
|
2022-04-27 12:13:42 -04:00
|
|
|
useFetchMock(fetchMock => {
|
|
|
|
defaultSetupAccountInfoMocks(fetchMock)
|
|
|
|
defaultSetupPasswordMocks(fetchMock)
|
|
|
|
})
|
|
|
|
|
2024-06-18 06:01:37 -04:00
|
|
|
Object.assign(getMeta('ol-ExposedSettings'), {
|
2022-04-27 12:13:42 -04:00
|
|
|
hasAffiliationsFeature: false,
|
|
|
|
isOverleaf: false,
|
|
|
|
})
|
2024-06-18 06:01:37 -04:00
|
|
|
window.metaAttributesCache.set('ol-hideLinkingWidgets', true)
|
2022-04-27 12:13:42 -04:00
|
|
|
window.metaAttributesCache.delete('ol-oauthProviders')
|
|
|
|
|
|
|
|
return (
|
|
|
|
<UserProvider>
|
|
|
|
<SettingsPageRoot {...args} />
|
|
|
|
</UserProvider>
|
|
|
|
)
|
|
|
|
}
|
|
|
|
|
2022-04-22 09:49:26 -04:00
|
|
|
export default {
|
|
|
|
title: 'Account Settings / Full Page',
|
|
|
|
component: SettingsPageRoot,
|
2022-05-24 03:47:08 -04:00
|
|
|
decorators: [ScopeDecorator],
|
2022-04-22 09:49:26 -04:00
|
|
|
}
|