1- import { useOrganization } from '@clerk/shared/react/index ' ;
1+ import { __internal_useUserEnterpriseConnections , useOrganization , useUser } from '@clerk/shared/react' ;
22import type { __experimental_ConfigureSSOProps } from '@clerk/shared/types' ;
33import React from 'react' ;
44
55import { useEnvironment , withCoreUserGuard } from '@/contexts' ;
6- import { Box , Col , Flex , Flow , Icon , localizationKeys , Text , useAppearance } from '@/customizables' ;
6+ import { Box , Col , descriptors , Flex , Flow , Icon , localizationKeys , Text , useAppearance } from '@/customizables' ;
77import { ApplicationLogo } from '@/elements/ApplicationLogo' ;
88import { withCardStateProvider } from '@/elements/contexts' ;
99import { NavBar , NavbarContextProvider } from '@/elements/Navbar' ;
1010import { ProfileCard } from '@/elements/ProfileCard' ;
1111import { BoxIcon } from '@/icons' ;
1212import { Route , Switch } from '@/router' ;
1313
14+ import { ConfigureSSOFlowProvider } from './ConfigureSSOContext' ;
15+ import { ConfigureCreateApp , ConfirmationStep , ProvideEmail , TestConfigurationStep , VerifyDomainStep } from './steps' ;
16+ import { ConfigureSSOWizard } from './wizard' ;
17+
1418const ConfigureSSOInternal = ( ) => {
1519 return (
1620 < Flow . Root flow = 'configureSSO' >
17- < Flow . Part >
18- < Switch >
19- < Route >
20- < AuthenticatedContent />
21- </ Route >
22- </ Switch >
23- </ Flow . Part >
21+ < Switch >
22+ < Route >
23+ < AuthenticatedContent />
24+ </ Route >
25+ </ Switch >
2426 </ Flow . Root >
2527 ) ;
2628} ;
@@ -32,6 +34,11 @@ const AuthenticatedContent = withCoreUserGuard(() => {
3234 const { parsedOptions } = useAppearance ( ) ;
3335 const hasLogo = Boolean ( parsedOptions . logoImageUrl || logoImageUrl ) ;
3436
37+ const { data : enterpriseConnections , isLoading : isLoadingEnterpriseConnections } =
38+ __internal_useUserEnterpriseConnections ( { enabled : true } ) ;
39+ // Currently FAPI only supports one enterprise connection per user
40+ const enterpriseConnection = enterpriseConnections ?. [ 0 ] ;
41+
3542 return (
3643 < ProfileCard . Root
3744 sx = { t => ( { display : 'grid' , gridTemplateColumns : '1fr 3fr' , height : t . sizes . $176 , overflow : 'hidden' } ) }
@@ -89,12 +96,97 @@ const AuthenticatedContent = withCoreUserGuard(() => {
8996 routes = { [ ] }
9097 contentRef = { contentRef }
9198 />
92- < ProfileCard . Content contentRef = { contentRef } />
99+ < Col
100+ ref = { contentRef }
101+ elementDescriptor = { descriptors . scrollBox }
102+ sx = { t => ( {
103+ backgroundColor : t . colors . $colorBackground ,
104+ position : 'relative' ,
105+ borderRadius : t . radii . $lg ,
106+ width : '100%' ,
107+ overflow : 'hidden' ,
108+ borderWidth : t . borderWidths . $normal ,
109+ borderStyle : t . borderStyles . $solid ,
110+ borderColor : t . colors . $borderAlpha150 ,
111+ marginBlock : '-1px' ,
112+ marginInlineEnd : '-1px' ,
113+ flex : 1 ,
114+ } ) }
115+ >
116+ < ConfigureSSOFlowProvider
117+ enterpriseConnection = { enterpriseConnection }
118+ isLoading = { isLoadingEnterpriseConnections }
119+ >
120+ < ConfigureSSOSteps />
121+ </ ConfigureSSOFlowProvider >
122+ </ Col >
93123 </ NavbarContextProvider >
94124 </ ProfileCard . Root >
95125 ) ;
96126} ) ;
97127
128+ const ConfigureSSOSteps = ( ) => {
129+ const { user } = useUser ( ) ;
130+
131+ const primaryEmailAddress = user ?. primaryEmailAddress ;
132+
133+ return (
134+ < ConfigureSSOWizard >
135+ < ConfigureSSOWizard . Step
136+ id = 'verify-email-domain'
137+ path = 'verify-email-domain'
138+ label = 'Verify domain'
139+ >
140+ < ConfigureSSOWizard >
141+ { ! primaryEmailAddress && (
142+ < ConfigureSSOWizard . Step
143+ id = 'provide-email'
144+ path = 'provide-email'
145+ >
146+ < ProvideEmail />
147+ </ ConfigureSSOWizard . Step >
148+ ) }
149+ < ConfigureSSOWizard . Step
150+ id = 'verify-domain'
151+ path = 'verify-domain'
152+ >
153+ < VerifyDomainStep />
154+ </ ConfigureSSOWizard . Step >
155+ </ ConfigureSSOWizard >
156+ </ ConfigureSSOWizard . Step >
157+ < ConfigureSSOWizard . Step
158+ id = 'configure'
159+ path = 'configure'
160+ label = 'Configure'
161+ >
162+ < ConfigureSSOWizard >
163+ { /* TODO: Implement configure steps */ }
164+ < ConfigureSSOWizard . Step
165+ id = 'create-app'
166+ path = 'create-app'
167+ >
168+ < ConfigureCreateApp />
169+ </ ConfigureSSOWizard . Step >
170+ </ ConfigureSSOWizard >
171+ </ ConfigureSSOWizard . Step >
172+ < ConfigureSSOWizard . Step
173+ id = 'test'
174+ path = 'test'
175+ label = 'Test'
176+ >
177+ < TestConfigurationStep />
178+ </ ConfigureSSOWizard . Step >
179+ < ConfigureSSOWizard . Step
180+ id = 'confirmation'
181+ path = 'confirmation'
182+ label = 'Confirmation'
183+ >
184+ < ConfirmationStep />
185+ </ ConfigureSSOWizard . Step >
186+ </ ConfigureSSOWizard >
187+ ) ;
188+ } ;
189+
98190const OrganizationSidebarSubtitle = ( ) => {
99191 const { organization } = useOrganization ( ) ;
100192
0 commit comments