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