Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 469
feat(ui,shared,localizations): Allow changing provider in self-serve SSO#8881
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
6348fe1c3b6c3f39ec1bae90231b4bfb96f8b0a72cfd12b0f5d807db571466285717e76838dafFile filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,8 @@ | ||
| --- | ||
| '@clerk/localizations': patch | ||
| '@clerk/clerk-js': patch | ||
| '@clerk/shared': patch | ||
| '@clerk/ui': patch | ||
| --- | ||
| Allow changing enterprise connection provider between self-serve SSO steps |
Large diffs are not rendered by default.
Uh oh!
There was an error while loading. Please reload this page.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,97 @@ | ||
| import type { LocalizationKey } from '@/customizables'; | ||
| import { Button, Col, descriptors, Flex, Heading, localizationKeys, Text, useLocalizations } from '@/customizables'; | ||
| import { Card } from '@/elements/Card'; | ||
| import { withCardStateProvider } from '@/elements/contexts'; | ||
| import { Modal } from '@/elements/Modal'; | ||
| type ChangeProviderDialogProps = { | ||
| isOpen: boolean; | ||
| onClose: () => void; | ||
| onConfirm: () => void; | ||
| isSubmitting?: boolean; | ||
| nextProviderLabel: LocalizationKey; | ||
| currentProviderLabel: LocalizationKey; | ||
| contentRef: React.RefObject<HTMLDivElement>; | ||
| }; | ||
| export const ChangeProviderDialog = (props: ChangeProviderDialogProps): JSX.Element | null => { | ||
| if (!props.isOpen) { | ||
| return null; | ||
| } | ||
| return ( | ||
| <Modal | ||
| handleClose={props.onClose} | ||
| canCloseModal={false} | ||
| portalRoot={props.contentRef} | ||
| containerSx={t => ({ | ||
| alignItems: 'center', | ||
| position: 'absolute', | ||
| inset: 0, | ||
| width: 'auto', | ||
| height: 'auto', | ||
| backgroundColor: 'inherit', | ||
| backdropFilter: `blur(${t.sizes.$2})`, | ||
| })} | ||
| > | ||
| <ChangeProviderDialogContent {...props} /> | ||
| </Modal> | ||
| ); | ||
| }; | ||
| const ChangeProviderDialogContent = withCardStateProvider((props: ChangeProviderDialogProps) => { | ||
| const { onClose, onConfirm, isSubmitting, nextProviderLabel, currentProviderLabel } = props; | ||
| const { t } = useLocalizations(); | ||
| const nextProvider = t(nextProviderLabel); | ||
| const currentProvider = t(currentProviderLabel); | ||
| return ( | ||
| <Card.Root | ||
| elementDescriptor={descriptors.configureSSOChangeProviderDialog} | ||
| sx={t => ({ borderRadius: t.radii.$md })} | ||
| > | ||
| <Card.Content sx={t => ({ textAlign: 'start', padding: t.sizes.$5 })}> | ||
| <Col sx={t => ({ gap: t.space.$4 })}> | ||
| <Col sx={t => ({ gap: t.space.$2 })}> | ||
| <Heading | ||
| textVariant='h2' | ||
| localizationKey={localizationKeys('configureSSO.changeProviderDialog.title', { | ||
| provider: nextProvider, | ||
| })} | ||
| sx={t => ({ fontSize: t.fontSizes.$md })} | ||
| /> | ||
| <Text | ||
| as='p' | ||
| colorScheme='secondary' | ||
| localizationKey={localizationKeys('configureSSO.changeProviderDialog.subtitle', { | ||
| provider: nextProvider, | ||
| currentProvider, | ||
| })} | ||
| /> | ||
| </Col> | ||
| <Flex | ||
| justify='end' | ||
| sx={t => ({ gap: t.space.$3 })} | ||
| > | ||
| <Button | ||
| elementDescriptor={descriptors.configureSSOChangeProviderDialogCancelButton} | ||
| variant='ghost' | ||
| isDisabled={isSubmitting} | ||
| onClick={onClose} | ||
| localizationKey={localizationKeys('configureSSO.changeProviderDialog.cancelButton')} | ||
| /> | ||
| <Button | ||
| elementDescriptor={descriptors.configureSSOChangeProviderDialogConfirmButton} | ||
| variant='solid' | ||
| isLoading={isSubmitting} | ||
| onClick={onConfirm} | ||
| localizationKey={localizationKeys('configureSSO.changeProviderDialog.confirmButton')} | ||
| /> | ||
| </Flex> | ||
| </Col> | ||
| </Card.Content> | ||
| </Card.Root> | ||
| ); | ||
| }); |
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.