2022-04-22 09:49:26 -04:00
|
|
|
import useFetchMock from '../hooks/use-fetch-mock'
|
|
|
|
import AccountInfoSection from '../../js/features/settings/components/account-info-section'
|
|
|
|
import { setDefaultMeta, defaultSetupMocks } from './helpers/account-info'
|
2022-04-25 07:05:15 -04:00
|
|
|
import { UserProvider } from '../../js/shared/context/user-context'
|
2024-06-18 06:01:37 -04:00
|
|
|
import getMeta from '@/utils/meta'
|
2024-10-10 03:26:18 -04:00
|
|
|
import { bsVersionDecorator } from '../../../.storybook/utils/with-bootstrap-switcher'
|
2022-04-22 09:49:26 -04:00
|
|
|
|
|
|
|
export const Success = args => {
|
|
|
|
setDefaultMeta()
|
|
|
|
useFetchMock(defaultSetupMocks)
|
|
|
|
|
2022-04-25 07:05:15 -04:00
|
|
|
return (
|
|
|
|
<UserProvider>
|
|
|
|
<AccountInfoSection {...args} />
|
|
|
|
</UserProvider>
|
|
|
|
)
|
2022-04-22 09:49:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export const ReadOnly = args => {
|
|
|
|
setDefaultMeta()
|
|
|
|
window.metaAttributesCache.set('ol-isExternalAuthenticationSystemUsed', true)
|
|
|
|
window.metaAttributesCache.set('ol-shouldAllowEditingDetails', false)
|
|
|
|
|
2022-04-25 07:05:15 -04:00
|
|
|
return (
|
|
|
|
<UserProvider>
|
|
|
|
<AccountInfoSection {...args} />
|
|
|
|
</UserProvider>
|
|
|
|
)
|
2022-04-22 09:49:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export const NoEmailInput = args => {
|
|
|
|
setDefaultMeta()
|
2024-06-18 06:01:37 -04:00
|
|
|
Object.assign(getMeta('ol-ExposedSettings'), {
|
2022-04-22 09:49:26 -04:00
|
|
|
hasAffiliationsFeature: true,
|
|
|
|
})
|
|
|
|
useFetchMock(defaultSetupMocks)
|
|
|
|
|
2022-04-25 07:05:15 -04:00
|
|
|
return (
|
|
|
|
<UserProvider>
|
|
|
|
<AccountInfoSection {...args} />
|
|
|
|
</UserProvider>
|
|
|
|
)
|
2022-04-22 09:49:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export const Error = args => {
|
|
|
|
setDefaultMeta()
|
|
|
|
useFetchMock(fetchMock => fetchMock.post(/\/user\/settings/, 500))
|
|
|
|
|
2022-04-25 07:05:15 -04:00
|
|
|
return (
|
|
|
|
<UserProvider>
|
|
|
|
<AccountInfoSection {...args} />
|
|
|
|
</UserProvider>
|
|
|
|
)
|
2022-04-22 09:49:26 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
title: 'Account Settings / Account Info',
|
|
|
|
component: AccountInfoSection,
|
2024-10-10 03:26:18 -04:00
|
|
|
argTypes: {
|
|
|
|
...bsVersionDecorator.argTypes,
|
|
|
|
},
|
2022-04-22 09:49:26 -04:00
|
|
|
}
|