Skip to content

Commit 0ceb6fb

Browse files
committed
feat(ui): add reset connection entry on ConfigureSSO step footers
Introduces a Step.Footer.Reset compound part that renders a destructive ghost button in the left of the step footer and opens the existing ResetConnectionDialog. Wires it into the Verify Domain, Configure, and Test steps so the reset action is reachable from anywhere in the wizard, not just the confirmation step. The slot gates itself on an existing enterprise connection so it stays hidden on the provider selection step.
1 parent c54190c commit 0ceb6fb

7 files changed

Lines changed: 50 additions & 1 deletion

File tree

packages/ui/src/components/ConfigureSSO/elements/Step.tsx

Lines changed: 36 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
import { type PropsWithChildren, type ReactNode } from 'react';
1+
import { useOrganization } from '@clerk/shared/react';
2+
import { type PropsWithChildren, type ReactNode, useState } from 'react';
23

34
import {
45
Badge,
@@ -9,12 +10,15 @@ import {
910
Heading,
1011
Icon,
1112
type LocalizationKey,
13+
localizationKeys,
1214
Text,
1315
useLocalizations,
1416
} from '@/customizables';
1517
import { ChevronLeft, ChevronRight } from '@/icons';
1618
import { common, type PropsOfComponent } from '@/styledSystem';
1719

20+
import { useConfigureSSO } from '../ConfigureSSOContext';
21+
import { ResetConnectionDialog } from '../ResetConnectionDialog';
1822
import { ProfileCardFooter } from './ProfileCard';
1923

2024
type StepLayoutProps = PropsOfComponent<typeof Col>;
@@ -188,11 +192,42 @@ const FooterContinue = ({ onClick, isDisabled, isLoading, label = 'Continue' }:
188192
};
189193
FooterContinue.displayName = 'Step.Footer.Continue';
190194

195+
const FooterReset = (): JSX.Element | null => {
196+
const { enterpriseConnection } = useConfigureSSO();
197+
const { organization } = useOrganization();
198+
const [isOpen, setIsOpen] = useState(false);
199+
200+
if (!enterpriseConnection) {
201+
return null;
202+
}
203+
204+
return (
205+
<>
206+
<Button
207+
elementDescriptor={descriptors.configureSSOFooterResetButton}
208+
variant='ghost'
209+
size='sm'
210+
colorScheme='danger'
211+
onClick={() => setIsOpen(true)}
212+
localizationKey={localizationKeys('configureSSO.confirmation.resetSection.title')}
213+
sx={{ marginInlineEnd: 'auto' }}
214+
/>
215+
<ResetConnectionDialog
216+
isOpen={isOpen}
217+
onClose={() => setIsOpen(false)}
218+
confirmationValue={organization?.name ?? ''}
219+
/>
220+
</>
221+
);
222+
};
223+
FooterReset.displayName = 'Step.Footer.Reset';
224+
191225
const Footer = ({ children }: PropsWithChildren): JSX.Element => <ProfileCardFooter>{children}</ProfileCardFooter>;
192226

193227
const FooterCompound = Object.assign(Footer, {
194228
Previous: FooterPrevious,
195229
Continue: FooterContinue,
230+
Reset: FooterReset,
196231
});
197232

198233
type StepCounterProps = {

packages/ui/src/components/ConfigureSSO/steps/ConfigureStep/saml/SamlCustomConfigureSteps.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,7 @@ const SamlCustomCreateAppStep = (): JSX.Element => {
130130
</Step.Body>
131131

132132
<Step.Footer>
133+
<Step.Footer.Reset />
133134
<Step.Footer.Previous
134135
onClick={() => goPrev()}
135136
isDisabled={isFirstStep}
@@ -204,6 +205,7 @@ const SamlCustomAttributeMappingStep = (): JSX.Element => {
204205
</Step.Body>
205206

206207
<Step.Footer>
208+
<Step.Footer.Reset />
207209
<Step.Footer.Previous
208210
onClick={() => goPrev()}
209211
isDisabled={isFirstStep}
@@ -239,6 +241,7 @@ const SamlCustomAssignUsersStep = (): JSX.Element => {
239241
</Step.Body>
240242

241243
<Step.Footer>
244+
<Step.Footer.Reset />
242245
<Step.Footer.Previous
243246
onClick={() => goPrev()}
244247
isDisabled={isFirstStep}
@@ -368,6 +371,7 @@ const SamlCustomIdentityProviderMetadataStep = (): JSX.Element => {
368371
</Step.Body>
369372

370373
<Step.Footer>
374+
<Step.Footer.Reset />
371375
<Step.Footer.Previous
372376
onClick={() => goPrev()}
373377
isDisabled={isFirstStep || card.isLoading}

packages/ui/src/components/ConfigureSSO/steps/ConfigureStep/saml/SamlOktaConfigureSteps.tsx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -240,6 +240,7 @@ const SamlOktaCreateAppStep = (): JSX.Element => {
240240
</Step.Body>
241241

242242
<Step.Footer>
243+
<Step.Footer.Reset />
243244
<Step.Footer.Previous
244245
onClick={() => goPrev()}
245246
isDisabled={isFirstStep}
@@ -346,6 +347,7 @@ const SamlOktaAttributeMappingStep = (): JSX.Element => {
346347
</Step.Body>
347348

348349
<Step.Footer>
350+
<Step.Footer.Reset />
349351
<Step.Footer.Previous
350352
onClick={() => goPrev()}
351353
isDisabled={isFirstStep}
@@ -437,6 +439,7 @@ const SamlOktaAssignUsersStep = (): JSX.Element => {
437439
</Step.Body>
438440

439441
<Step.Footer>
442+
<Step.Footer.Reset />
440443
<Step.Footer.Previous
441444
onClick={() => goPrev()}
442445
isDisabled={isFirstStep}
@@ -564,6 +567,7 @@ const SamlOktaIdentityProviderMetadataStep = (): JSX.Element => {
564567
</Step.Body>
565568

566569
<Step.Footer>
570+
<Step.Footer.Reset />
567571
<Step.Footer.Previous
568572
onClick={() => goPrev()}
569573
isDisabled={isFirstStep || card.isLoading}

packages/ui/src/components/ConfigureSSO/steps/TestConfigurationStep.tsx

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -177,6 +177,7 @@ export const TestConfigurationStep = (): JSX.Element => {
177177
) : null}
178178

179179
<Step.Footer>
180+
<Step.Footer.Reset />
180181
<Step.Footer.Previous onClick={() => goPrev()} />
181182
<ContinueTestSsoStepButton
182183
enterpriseConnectionId={enterpriseConnection?.id}

packages/ui/src/components/ConfigureSSO/steps/VerifyDomainStep.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,7 @@ export const VerifyDomainStep = (): JSX.Element => {
119119
</Step.Body>
120120

121121
<Step.Footer>
122+
<Step.Footer.Reset />
122123
<Step.Footer.Continue onClick={() => outerGoNext()} />
123124
</Step.Footer>
124125
</Step>
@@ -299,6 +300,7 @@ export const ProvideEmailStep = ({ emailAddressRef, preExistingEmailIdRef }: Pro
299300
</Step.Section>
300301

301302
<Step.Footer>
303+
<Step.Footer.Reset />
302304
<Step.Footer.Previous
303305
onClick={() => goPrev()}
304306
isDisabled
@@ -416,6 +418,7 @@ export const EnterVerificationCodeStep = ({
416418
</Step.Section>
417419

418420
<Step.Footer>
421+
<Step.Footer.Reset />
419422
<Step.Footer.Previous
420423
onClick={() => goPrev()}
421424
isDisabled={!!primaryEmailAddress}

packages/ui/src/customizables/elementDescriptors.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -554,6 +554,7 @@ export const APPEARANCE_KEYS = containsAllElementsConfigKeys([
554554
'configureSSOFooter',
555555
'configureSSOFooterPreviousButton',
556556
'configureSSOFooterContinueButton',
557+
'configureSSOFooterResetButton',
557558

558559
'configureSSOProviderGroup',
559560
'configureSSOProviderGroupLabel',

packages/ui/src/internal/appearance.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -690,6 +690,7 @@ export type ElementsConfig = {
690690
configureSSOFooter: WithOptions;
691691
configureSSOFooterPreviousButton: WithOptions;
692692
configureSSOFooterContinueButton: WithOptions;
693+
configureSSOFooterResetButton: WithOptions;
693694

694695
configureSSOProviderGroup: WithOptions<string>;
695696
configureSSOProviderGroupLabel: WithOptions<string>;

0 commit comments

Comments
 (0)