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'
|
2024-06-18 10:01:37 +00:00
|
|
|
import getMeta from '@/utils/meta'
|
2024-10-10 07:26:18 +00:00
|
|
|
import { bsVersionDecorator } from '../../../.storybook/utils/with-bootstrap-switcher'
|
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)
|
|
|
|
})
|
|
|
|
|
2024-06-18 10:01:37 +00:00
|
|
|
Object.assign(getMeta('ol-ExposedSettings'), {
|
2022-04-27 16:13:42 +00:00
|
|
|
hasAffiliationsFeature: false,
|
|
|
|
isOverleaf: false,
|
|
|
|
})
|
2024-06-18 10:01:37 +00:00
|
|
|
window.metaAttributesCache.set('ol-hideLinkingWidgets', true)
|
2022-04-27 16:13:42 +00:00
|
|
|
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],
|
2024-10-10 07:26:18 +00:00
|
|
|
argTypes: {
|
|
|
|
...bsVersionDecorator.argTypes,
|
|
|
|
},
|
2022-04-22 13:49:26 +00:00
|
|
|
}
|