2022-04-22 13:49:26 +00: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 11:05:15 +00:00
|
|
|
import { UserProvider } from '../../js/shared/context/user-context'
|
2022-04-22 13:49:26 +00:00
|
|
|
|
|
|
|
export const Success = args => {
|
|
|
|
setDefaultMeta()
|
|
|
|
useFetchMock(defaultSetupMocks)
|
|
|
|
|
2022-04-25 11:05:15 +00:00
|
|
|
return (
|
|
|
|
<UserProvider>
|
|
|
|
<AccountInfoSection {...args} />
|
|
|
|
</UserProvider>
|
|
|
|
)
|
2022-04-22 13:49:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const ReadOnly = args => {
|
|
|
|
setDefaultMeta()
|
|
|
|
window.metaAttributesCache.set('ol-isExternalAuthenticationSystemUsed', true)
|
|
|
|
window.metaAttributesCache.set('ol-shouldAllowEditingDetails', false)
|
|
|
|
|
2022-04-25 11:05:15 +00:00
|
|
|
return (
|
|
|
|
<UserProvider>
|
|
|
|
<AccountInfoSection {...args} />
|
|
|
|
</UserProvider>
|
|
|
|
)
|
2022-04-22 13:49:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const NoEmailInput = args => {
|
|
|
|
setDefaultMeta()
|
|
|
|
window.metaAttributesCache.set('ol-ExposedSettings', {
|
|
|
|
hasAffiliationsFeature: true,
|
|
|
|
})
|
|
|
|
useFetchMock(defaultSetupMocks)
|
|
|
|
|
2022-04-25 11:05:15 +00:00
|
|
|
return (
|
|
|
|
<UserProvider>
|
|
|
|
<AccountInfoSection {...args} />
|
|
|
|
</UserProvider>
|
|
|
|
)
|
2022-04-22 13:49:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export const Error = args => {
|
|
|
|
setDefaultMeta()
|
|
|
|
useFetchMock(fetchMock => fetchMock.post(/\/user\/settings/, 500))
|
|
|
|
|
2022-04-25 11:05:15 +00:00
|
|
|
return (
|
|
|
|
<UserProvider>
|
|
|
|
<AccountInfoSection {...args} />
|
|
|
|
</UserProvider>
|
|
|
|
)
|
2022-04-22 13:49:26 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
export default {
|
|
|
|
title: 'Account Settings / Account Info',
|
|
|
|
component: AccountInfoSection,
|
|
|
|
}
|