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'
|
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()
|
|
|
|
window.metaAttributesCache.set('ol-ExposedSettings', {
|
|
|
|
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,
|
|
|
|
}
|