11import type { EnterpriseConnectionResource , OrganizationDomainResource } from '@clerk/shared/types' ;
22import React , { type PropsWithChildren } from 'react' ;
33
4+ import { useOptions } from '@/contexts' ;
5+
46import type { OrganizationEnterpriseConnection } from './domain/organizationEnterpriseConnection' ;
57import type {
68 EnterpriseConnectionMutations ,
@@ -11,9 +13,9 @@ import type {
1113export type { OrganizationDomainMutations } ;
1214
1315/**
14- * Shared state for the ConfigureSSO wizard, persisted across steps. Everything
15- * is sourced from the umbrella `useOrganizationEnterpriseConnection` hook one
16- * level up, so the context never observes a loading state and the steps read
16+ * Shared state for the ConfigureSSO wizard, persisted across steps. Connection
17+ * state is sourced from the umbrella `useOrganizationEnterpriseConnection` hook
18+ * one level up, so the context never observes a loading state and the steps read
1719 * display gates / mutations from a single place instead of re-deriving.
1820 */
1921export interface ConfigureSSOData {
@@ -26,6 +28,8 @@ export interface ConfigureSSOData {
2628 testRuns : TestRunsView ;
2729 organizationDomains : OrganizationDomainResource [ ] | undefined ;
2830 onExit ?: ( ) => void ;
31+ /** Temporary gate for the self-serve OIDC flow; remove at OIDC GA. */
32+ isOIDCFlowEnabled : boolean ;
2933}
3034
3135interface ConfigureSSOProviderProps {
@@ -53,6 +57,8 @@ export const ConfigureSSOProvider = ({
5357 onExit,
5458 children,
5559} : PropsWithChildren < ConfigureSSOProviderProps > ) : JSX . Element => {
60+ const isOIDCFlowEnabled = useOptions ( ) . experimental ?. oidcSelfServe ?? false ;
61+
5662 const value = React . useMemo < ConfigureSSOData > (
5763 ( ) => ( {
5864 contentRef,
@@ -63,6 +69,7 @@ export const ConfigureSSOProvider = ({
6369 enterpriseConnectionMutations,
6470 organizationDomainMutations,
6571 onExit,
72+ isOIDCFlowEnabled,
6673 } ) ,
6774 [
6875 contentRef ,
@@ -73,6 +80,7 @@ export const ConfigureSSOProvider = ({
7380 organizationDomains ,
7481 enterpriseConnection ,
7582 onExit ,
83+ isOIDCFlowEnabled ,
7684 ] ,
7785 ) ;
7886
0 commit comments