@thunderid/react 0.5.0 → 0.6.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (113) hide show
  1. package/dist/api/{getScim2Me.d.ts → getUsersMe.d.ts} +11 -11
  2. package/dist/api/{getScim2Me.d.ts.map → getUsersMe.d.ts.map} +1 -1
  3. package/dist/api/{getScim2Me.js → getUsersMe.js} +12 -12
  4. package/dist/api/{getScim2Me.js.map → getUsersMe.js.map} +1 -1
  5. package/dist/api/updateMeProfile.d.ts +5 -5
  6. package/dist/api/updateMeProfile.js +6 -6
  7. package/dist/api/updateMeProfile.js.map +1 -1
  8. package/dist/cjs/api/{getScim2Me.cjs → getUsersMe.cjs} +11 -11
  9. package/dist/cjs/api/{getScim2Me.cjs.map → getUsersMe.cjs.map} +1 -1
  10. package/dist/cjs/api/updateMeProfile.cjs +6 -6
  11. package/dist/cjs/api/updateMeProfile.cjs.map +1 -1
  12. package/dist/cjs/components/presentation/UserProfile/BaseUserProfile.cjs +48 -58
  13. package/dist/cjs/components/presentation/UserProfile/BaseUserProfile.cjs.map +1 -1
  14. package/dist/cjs/components/presentation/UserProfile/UserProfile.cjs +21 -8
  15. package/dist/cjs/components/presentation/UserProfile/UserProfile.cjs.map +1 -1
  16. package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.cjs +9 -1
  17. package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.cjs.map +1 -1
  18. package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs +52 -9
  19. package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs.map +1 -1
  20. package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.cjs +11 -1
  21. package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.cjs.map +1 -1
  22. package/dist/cjs/components/presentation/auth/Recovery/BaseRecovery.cjs +18 -14
  23. package/dist/cjs/components/presentation/auth/Recovery/BaseRecovery.cjs.map +1 -1
  24. package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs +35 -9
  25. package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs.map +1 -1
  26. package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs +18 -13
  27. package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs.map +1 -1
  28. package/dist/cjs/components/primitives/AffixedField/AffixedField.cjs +88 -0
  29. package/dist/cjs/components/primitives/AffixedField/AffixedField.cjs.map +1 -0
  30. package/dist/cjs/components/primitives/AffixedField/AffixedField.styles.cjs +130 -0
  31. package/dist/cjs/components/primitives/AffixedField/AffixedField.styles.cjs.map +1 -0
  32. package/dist/cjs/contexts/ComponentRenderer/ComponentRendererContext.cjs.map +1 -1
  33. package/dist/cjs/contexts/ThunderID/ThunderIDContext.cjs +1 -0
  34. package/dist/cjs/contexts/ThunderID/ThunderIDContext.cjs.map +1 -1
  35. package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs +23 -7
  36. package/dist/cjs/contexts/ThunderID/ThunderIDProvider.cjs.map +1 -1
  37. package/dist/cjs/contexts/User/UserContext.cjs +0 -1
  38. package/dist/cjs/contexts/User/UserContext.cjs.map +1 -1
  39. package/dist/cjs/contexts/User/UserProvider.cjs +0 -2
  40. package/dist/cjs/contexts/User/UserProvider.cjs.map +1 -1
  41. package/dist/cjs/contexts/User/useUser.cjs +0 -1
  42. package/dist/cjs/contexts/User/useUser.cjs.map +1 -1
  43. package/dist/cjs/index.cjs +2 -2
  44. package/dist/cjs/utils/composeAffixedInputs.cjs +74 -0
  45. package/dist/cjs/utils/composeAffixedInputs.cjs.map +1 -0
  46. package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts +0 -20
  47. package/dist/components/presentation/UserProfile/BaseUserProfile.d.ts.map +1 -1
  48. package/dist/components/presentation/UserProfile/BaseUserProfile.js +50 -60
  49. package/dist/components/presentation/UserProfile/BaseUserProfile.js.map +1 -1
  50. package/dist/components/presentation/UserProfile/UserProfile.d.ts +1 -1
  51. package/dist/components/presentation/UserProfile/UserProfile.d.ts.map +1 -1
  52. package/dist/components/presentation/UserProfile/UserProfile.js +22 -9
  53. package/dist/components/presentation/UserProfile/UserProfile.js.map +1 -1
  54. package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.d.ts.map +1 -1
  55. package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.js +9 -1
  56. package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.js.map +1 -1
  57. package/dist/components/presentation/auth/AuthOptionFactory.d.ts +12 -4
  58. package/dist/components/presentation/auth/AuthOptionFactory.d.ts.map +1 -1
  59. package/dist/components/presentation/auth/AuthOptionFactory.js +52 -9
  60. package/dist/components/presentation/auth/AuthOptionFactory.js.map +1 -1
  61. package/dist/components/presentation/auth/InviteUser/BaseInviteUser.d.ts.map +1 -1
  62. package/dist/components/presentation/auth/InviteUser/BaseInviteUser.js +11 -1
  63. package/dist/components/presentation/auth/InviteUser/BaseInviteUser.js.map +1 -1
  64. package/dist/components/presentation/auth/Recovery/BaseRecovery.d.ts.map +1 -1
  65. package/dist/components/presentation/auth/Recovery/BaseRecovery.js +19 -15
  66. package/dist/components/presentation/auth/Recovery/BaseRecovery.js.map +1 -1
  67. package/dist/components/presentation/auth/SignIn/BaseSignIn.d.ts.map +1 -1
  68. package/dist/components/presentation/auth/SignIn/BaseSignIn.js +37 -11
  69. package/dist/components/presentation/auth/SignIn/BaseSignIn.js.map +1 -1
  70. package/dist/components/presentation/auth/SignUp/BaseSignUp.d.ts.map +1 -1
  71. package/dist/components/presentation/auth/SignUp/BaseSignUp.js +18 -13
  72. package/dist/components/presentation/auth/SignUp/BaseSignUp.js.map +1 -1
  73. package/dist/components/primitives/AffixedField/AffixedField.d.ts +52 -0
  74. package/dist/components/primitives/AffixedField/AffixedField.d.ts.map +1 -0
  75. package/dist/components/primitives/AffixedField/AffixedField.js +83 -0
  76. package/dist/components/primitives/AffixedField/AffixedField.js.map +1 -0
  77. package/dist/components/primitives/AffixedField/AffixedField.styles.d.ts +25 -0
  78. package/dist/components/primitives/AffixedField/AffixedField.styles.d.ts.map +1 -0
  79. package/dist/components/primitives/AffixedField/AffixedField.styles.js +127 -0
  80. package/dist/components/primitives/AffixedField/AffixedField.styles.js.map +1 -0
  81. package/dist/components/primitives/AffixedField/index.d.ts +20 -0
  82. package/dist/components/primitives/AffixedField/index.d.ts.map +1 -0
  83. package/dist/components/primitives/Dialog/Dialog.js +3 -3
  84. package/dist/components/primitives/Dialog/Dialog.js.map +1 -1
  85. package/dist/contexts/ComponentRenderer/ComponentRendererContext.d.ts +1 -0
  86. package/dist/contexts/ComponentRenderer/ComponentRendererContext.d.ts.map +1 -1
  87. package/dist/contexts/ComponentRenderer/ComponentRendererContext.js.map +1 -1
  88. package/dist/contexts/ThunderID/ThunderIDContext.d.ts +1 -0
  89. package/dist/contexts/ThunderID/ThunderIDContext.d.ts.map +1 -1
  90. package/dist/contexts/ThunderID/ThunderIDContext.js +1 -0
  91. package/dist/contexts/ThunderID/ThunderIDContext.js.map +1 -1
  92. package/dist/contexts/ThunderID/ThunderIDProvider.d.ts.map +1 -1
  93. package/dist/contexts/ThunderID/ThunderIDProvider.js +23 -7
  94. package/dist/contexts/ThunderID/ThunderIDProvider.js.map +1 -1
  95. package/dist/contexts/User/UserContext.d.ts +1 -2
  96. package/dist/contexts/User/UserContext.d.ts.map +1 -1
  97. package/dist/contexts/User/UserContext.js +0 -1
  98. package/dist/contexts/User/UserContext.js.map +1 -1
  99. package/dist/contexts/User/UserProvider.d.ts +0 -1
  100. package/dist/contexts/User/UserProvider.d.ts.map +1 -1
  101. package/dist/contexts/User/UserProvider.js +0 -2
  102. package/dist/contexts/User/UserProvider.js.map +1 -1
  103. package/dist/contexts/User/useUser.d.ts +0 -1
  104. package/dist/contexts/User/useUser.d.ts.map +1 -1
  105. package/dist/contexts/User/useUser.js +0 -1
  106. package/dist/contexts/User/useUser.js.map +1 -1
  107. package/dist/index.d.ts +2 -2
  108. package/dist/index.js +2 -2
  109. package/dist/utils/composeAffixedInputs.d.ts +52 -0
  110. package/dist/utils/composeAffixedInputs.d.ts.map +1 -0
  111. package/dist/utils/composeAffixedInputs.js +70 -0
  112. package/dist/utils/composeAffixedInputs.js.map +1 -0
  113. package/package.json +3 -2
@@ -8,6 +8,7 @@ const require_FlowMetaProvider = require('../FlowMeta/FlowMetaProvider.cjs');
8
8
  const require_I18nProvider = require('../I18n/I18nProvider.cjs');
9
9
  const require_ThemeProvider = require('../Theme/ThemeProvider.cjs');
10
10
  const require_UserProvider = require('../User/UserProvider.cjs');
11
+ const require_getUsersMe = require('../../api/getUsersMe.cjs');
11
12
  let __thunderid_browser = require("@thunderid/browser");
12
13
  __thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
13
14
  let react = require("react");
@@ -66,14 +67,28 @@ const ThunderIDProvider = ({ afterSignInUrl, afterSignOutUrl, baseUrl: initialBa
66
67
  resolvedBaseUrl = `${(await client.getConfiguration()).baseUrl}/o`;
67
68
  setBaseUrl(resolvedBaseUrl);
68
69
  }
70
+ const shouldFetchProfile = preferences?.user?.fetchUserProfile !== false;
69
71
  const claims = (0, __thunderid_browser.extractUserClaimsFromIdToken)(decodedToken);
70
- setUser(claims);
72
+ let profileData = claims;
73
+ const currentSignInStatus = await client.isSignedIn();
74
+ if (currentSignInStatus && shouldFetchProfile) try {
75
+ const fetchedProfile = await require_getUsersMe.default({
76
+ baseUrl: resolvedBaseUrl,
77
+ instanceId
78
+ });
79
+ profileData = {
80
+ ...claims,
81
+ ...fetchedProfile
82
+ };
83
+ } catch (err) {
84
+ logger.warn("Failed to fetch user profile from /users/me:", err);
85
+ }
86
+ setUser(profileData);
71
87
  setUserProfile({
72
- flattenedProfile: claims,
73
- profile: claims,
74
- schemas: []
88
+ flattenedProfile: (0, __thunderid_browser.generateFlattenedUserProfile)(profileData, []),
89
+ profile: profileData
75
90
  });
76
- setIsSignedInSync(await client.isSignedIn());
91
+ setIsSignedInSync(currentSignInStatus);
77
92
  } catch (error) {} finally {
78
93
  setIsUpdatingSession(false);
79
94
  setIsLoadingSync(client.isLoading());
@@ -207,8 +222,7 @@ const ThunderIDProvider = ({ afterSignInUrl, afterSignOutUrl, baseUrl: initialBa
207
222
  const handleProfileUpdate = (payload) => {
208
223
  setUser(payload);
209
224
  setUserProfile((prev) => ({
210
- schemas: prev?.schemas ?? [],
211
- flattenedProfile: (0, __thunderid_browser.generateFlattenedUserProfile)(payload, prev?.schemas ?? []),
225
+ flattenedProfile: (0, __thunderid_browser.generateFlattenedUserProfile)(payload),
212
226
  profile: payload
213
227
  }));
214
228
  };
@@ -251,6 +265,7 @@ const ThunderIDProvider = ({ afterSignInUrl, afterSignOutUrl, baseUrl: initialBa
251
265
  isSignedIn: isSignedInSync,
252
266
  organizationChain,
253
267
  organizationHandle: config?.organizationHandle,
268
+ preferences,
254
269
  reInitialize,
255
270
  recover,
256
271
  signIn,
@@ -292,6 +307,7 @@ const ThunderIDProvider = ({ afterSignInUrl, afterSignOutUrl, baseUrl: initialBa
292
307
  getStorageManager,
293
308
  instanceId,
294
309
  organizationChain,
310
+ preferences,
295
311
  recover,
296
312
  reInitialize,
297
313
  request,
@@ -1 +1 @@
1
- {"version":3,"file":"ThunderIDProvider.cjs","names":["logger: ReturnType<typeof createPackageComponentLogger>","ThunderIDProvider: FC<PropsWithChildren<ThunderIDProviderProps>>","reRenderCheckRef: RefObject<boolean>","client: ThunderIDReactClient","ThunderIDReactClient","storageManagerRef: any","useBrowserUrl","resolvedBaseUrl: string","decodedToken: IdToken","claims: User","arg1: any","isV2FlowRequest: boolean","ThunderIDRuntimeError","isAlreadySignedIn: boolean","currentUrl: URL","urlParams: URLSearchParams","code: string | null","executionIdFromUrl: string | null","storedExecutionId: string | null","interval: NodeJS.Timeout","status: boolean","getDecodedIdToken: () => Promise<IdToken>","getIdToken: () => Promise<string>","getAccessToken: () => Promise<string>","getStorageManager: () => Promise<any>","storageManager: any","request: (...args: any[]) => Promise<any>","requestAll: (...args: any[]) => Promise<any>","exchangeToken: (exchangeConfig: any) => Promise<any>","signOut: (...args: any[]) => Promise<any>","recover: (payload: any) => Promise<any>","signUp: (...args: any[]) => Promise<any>","clearSession: (...args: any[]) => Promise<any>","reInitialize: (reInitConfig: any) => Promise<any>","value: any","ThunderIDContext","I18nProvider","FlowMetaProvider","ThemeProvider","FlowProvider","UserProvider","ComponentRendererProvider"],"sources":["../../../../src/contexts/ThunderID/ThunderIDProvider.tsx"],"sourcesContent":["/**\n * Copyright (c) 2025-2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n ThunderIDRuntimeError,\n generateFlattenedUserProfile,\n OIDCDiscoveryApiResponse,\n SignInOptions,\n User,\n UserProfile,\n IdToken,\n extractUserClaimsFromIdToken,\n EmbeddedSignInFlowResponse,\n createPackageComponentLogger,\n getVendorPrefix,\n} from '@thunderid/browser';\nimport {FC, RefObject, PropsWithChildren, ReactElement, useEffect, useMemo, useRef, useState, useCallback} from 'react';\nimport ThunderIDContext from './ThunderIDContext';\nimport useBrowserUrl from '../../hooks/useBrowserUrl';\nimport {ThunderIDReactConfig} from '../../models/config';\nimport ThunderIDReactClient from '../../ThunderIDReactClient';\nimport ComponentRendererProvider from '../ComponentRenderer/ComponentRendererProvider';\nimport FlowProvider from '../Flow/FlowProvider';\nimport FlowMetaProvider from '../FlowMeta/FlowMetaProvider';\nimport I18nProvider from '../I18n/I18nProvider';\nimport ThemeProvider from '../Theme/ThemeProvider';\nimport UserProvider from '../User/UserProvider';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/react',\n 'ThunderIDProvider',\n);\n\n/**\n * Props interface of {@link ThunderIDProvider}\n */\nexport type ThunderIDProviderProps = ThunderIDReactConfig;\n\nconst ThunderIDProvider: FC<PropsWithChildren<ThunderIDProviderProps>> = ({\n afterSignInUrl,\n afterSignOutUrl,\n baseUrl: initialBaseUrl,\n clientId,\n children,\n extensions,\n scopes,\n preferences,\n signInUrl,\n signUpUrl,\n organizationHandle,\n applicationId,\n signInOptions,\n tokenRequest,\n syncSession,\n instanceId = 0,\n organizationChain,\n ...rest\n}: PropsWithChildren<ThunderIDProviderProps>): ReactElement => {\n const reRenderCheckRef: RefObject<boolean> = useRef(false);\n const client: ThunderIDReactClient = useMemo(() => new ThunderIDReactClient(instanceId), [instanceId]);\n const storageManagerRef: any = useRef<any>(null);\n const {hasAuthParams, hasCalledForThisInstance} = useBrowserUrl();\n const [user, setUser] = useState<any | null>(null);\n const [isSignedInSync, setIsSignedInSync] = useState<boolean>(false);\n const [isInitializedSync, setIsInitializedSync] = useState<boolean>(false);\n const [isLoadingSync, setIsLoadingSync] = useState<boolean>(true);\n\n const [userProfile, setUserProfile] = useState<UserProfile | null>(null);\n const [baseUrl, setBaseUrl] = useState<string>(initialBaseUrl ?? '');\n const [config, setConfig] = useState<ThunderIDReactConfig>({\n afterSignInUrl: afterSignInUrl ?? window.location.origin,\n afterSignOutUrl: afterSignOutUrl ?? window.location.origin,\n applicationId,\n baseUrl,\n clientId,\n organizationChain,\n organizationHandle,\n scopes,\n signInOptions,\n tokenRequest,\n signInUrl,\n signUpUrl,\n syncSession,\n ...rest,\n });\n\n const [isUpdatingSession, setIsUpdatingSession] = useState<boolean>(false);\n const [wellKnown, setWellKnown] = useState<OIDCDiscoveryApiResponse | null>(null);\n\n useEffect(() => {\n setBaseUrl(initialBaseUrl ?? '');\n }, [initialBaseUrl]);\n\n useEffect(() => {\n (async (): Promise<void> => {\n await client.initialize(config);\n const initializedConfig: ThunderIDReactConfig = await client.getConfiguration();\n setConfig(initializedConfig);\n setWellKnown(await client.getDiscoveryResponse());\n })();\n }, []);\n\n async function updateSession(): Promise<void> {\n try {\n // Set flag to prevent loading state tracking from interfering\n setIsUpdatingSession(true);\n setIsLoadingSync(true);\n let resolvedBaseUrl: string = baseUrl;\n\n const decodedToken: IdToken = await client.getDecodedIdToken();\n\n // If there's a `user_org` claim in the ID token,\n // Treat this login as a organization login.\n if (decodedToken?.['user_org']) {\n resolvedBaseUrl = `${(await client.getConfiguration()).baseUrl}/o`;\n setBaseUrl(resolvedBaseUrl);\n }\n\n // TEMPORARY: SCIM2 and Organizations endpoints are not yet supported.\n const claims: User = extractUserClaimsFromIdToken(decodedToken) as User;\n setUser(claims);\n setUserProfile({\n flattenedProfile: claims,\n profile: claims,\n schemas: [],\n });\n\n // CRITICAL: Update sign-in status BEFORE setting loading to false\n // This prevents the race condition where ProtectedRoute sees isLoading=false but isSignedIn=false\n const currentSignInStatus: boolean = await client.isSignedIn();\n setIsSignedInSync(currentSignInStatus);\n } catch (error) {\n // TODO: Add an error log.\n } finally {\n // Clear the flag and set final loading state\n setIsUpdatingSession(false);\n setIsLoadingSync(client.isLoading());\n }\n }\n\n async function signIn(...args: any): Promise<User | EmbeddedSignInFlowResponse> {\n // Check if this is a V2 embedded flow request BEFORE calling signIn\n // This allows us to skip session checks entirely for V2 flows\n const arg1: any = args[0];\n const isV2FlowRequest: boolean =\n typeof arg1 === 'object' && arg1 !== null && ('executionId' in arg1 || 'applicationId' in arg1);\n\n try {\n if (!isV2FlowRequest) {\n setIsUpdatingSession(true);\n setIsLoadingSync(true);\n }\n\n return await client.signIn(...args);\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Sign in failed: ${error instanceof Error ? error.message : String(JSON.stringify(error))}`,\n 'thunderid-signIn-Error',\n 'react',\n 'An error occurred while trying to sign in.',\n );\n } finally {\n if (!isV2FlowRequest) {\n setIsUpdatingSession(false);\n setIsLoadingSync(client.isLoading());\n }\n }\n }\n\n /**\n * Try signing in when the component is mounted.\n */\n useEffect(() => {\n // React 18.x Strict.Mode has a new check for `Ensuring reusable state` to facilitate an upcoming react feature.\n // https://reactjs.org/docs/strict-mode.html#ensuring-reusable-state\n // This will remount all the useEffects to ensure that there are no unexpected side effects.\n // When react remounts the signIn hook of the AuthProvider, it will cause a race condition. Hence, we have to\n // prevent the re-render of this hook as suggested in the following discussion.\n // https://github.com/reactwg/react-18/discussions/18#discussioncomment-795623\n if (reRenderCheckRef.current) {\n return;\n }\n\n reRenderCheckRef.current = true;\n\n (async (): Promise<void> => {\n // Sync session state whenever sign-in completes (both redirect and embedded V2 flows).\n // Pass the user returned by the SDK's sign-in flow so SCIM2/Me result is not discarded.\n await client.on('sign-in', async () => {\n await updateSession();\n });\n\n // User is already authenticated. Skip...\n const isAlreadySignedIn: boolean = await client.isSignedIn();\n\n // Start auto-refresh with a soft failure.\n const scheduleAutoRefresh = async (): Promise<void> => {\n try {\n await client.startAutoRefreshToken();\n } catch (error) {\n logger.warn('Failed to schedule automatic token refresh.', error);\n }\n };\n\n // Restore session state and kick off the refresh timer.\n const resumeSession = async (): Promise<void> => {\n await updateSession();\n await scheduleAutoRefresh();\n };\n\n if (isAlreadySignedIn) {\n await resumeSession();\n }\n\n // The access token may have expired while the refresh token is still valid.\n // Attempt a silent refresh — startAutoRefreshToken() calls refreshAccessToken()\n // immediately when timeUntilRefresh <= 0, then re-check sign-in status.\n await scheduleAutoRefresh();\n\n if (await client.isSignedIn()) {\n await resumeSession();\n return;\n }\n\n const currentUrl: URL = new URL(window.location.href);\n const hasAuthParamsResult: boolean =\n hasAuthParams(currentUrl, config.afterSignInUrl!) && hasCalledForThisInstance(currentUrl, instanceId ?? 0);\n\n if (hasAuthParamsResult) {\n try {\n const urlParams: URLSearchParams = currentUrl.searchParams;\n const code: string | null = urlParams.get('code');\n const executionIdFromUrl: string | null = urlParams.get('executionId');\n const storedExecutionId: string | null = sessionStorage.getItem(\n `${getVendorPrefix(config.vendor)}_execution_id`,\n );\n\n if (code && !executionIdFromUrl && !storedExecutionId) {\n await signIn();\n }\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Sign in failed: ${error instanceof Error ? error.message : String(JSON.stringify(error))}`,\n 'thunderid-signIn-Error',\n 'react',\n 'An error occurred while trying to sign in.',\n );\n }\n }\n })();\n }, []);\n\n /**\n * Check if the user is signed in and update the state accordingly.\n * This will also set an interval to check for the sign-in status every second\n * until the user is signed in.\n */\n useEffect(() => {\n let interval: NodeJS.Timeout;\n\n (async (): Promise<void> => {\n try {\n const status: boolean = await client.isSignedIn();\n\n setIsSignedInSync(status);\n\n if (!status) {\n interval = setInterval(async () => {\n const newStatus: boolean = await client.isSignedIn();\n\n if (newStatus) {\n setIsSignedInSync(true);\n clearInterval(interval);\n }\n }, 1000);\n } else {\n // TODO: Add a debug log to indicate that the user is already signed in.\n }\n } catch (error) {\n setIsSignedInSync(false);\n }\n })();\n\n return (): void => {\n if (interval) {\n clearInterval(interval);\n }\n };\n }, [client]);\n\n useEffect(() => {\n (async (): Promise<void> => {\n try {\n const status: boolean = await client.isInitialized();\n\n setIsInitializedSync(status);\n } catch (error) {\n setIsInitializedSync(false);\n }\n })();\n }, [client]);\n\n /**\n * Track loading state changes from the ThunderID client\n */\n useEffect(() => {\n const checkLoadingState = (): void => {\n // Don't override loading state during critical session updates\n if (isUpdatingSession) {\n return;\n }\n\n // Don't set loading=false while auth params are in the URL and user isn't signed in yet.\n // This prevents ProtectedRoute from redirecting before the sign-in effect processes the auth code.\n const currentUrl: URL = new URL(window.location.href);\n if (!isSignedInSync && hasAuthParams(currentUrl, config.afterSignInUrl!)) {\n return;\n }\n\n setIsLoadingSync(client.isLoading());\n };\n\n // Initial check\n checkLoadingState();\n\n // Set up an interval to check for loading state changes\n const interval: NodeJS.Timeout = setInterval(checkLoadingState, 100);\n\n return (): void => {\n clearInterval(interval);\n };\n }, [client, isLoadingSync, isSignedInSync, isUpdatingSession]);\n\n const signInSilently = async (options?: SignInOptions): Promise<User | boolean> => {\n try {\n setIsUpdatingSession(true);\n setIsLoadingSync(true);\n return await client.signInSilently(options);\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Error while signing in silently: ${error instanceof Error ? error.message : String(JSON.stringify(error))}`,\n 'thunderid-signInSilently-Error',\n 'react',\n 'An error occurred while trying to sign in silently.',\n );\n } finally {\n setIsUpdatingSession(false);\n setIsLoadingSync(client.isLoading());\n }\n };\n\n const handleProfileUpdate = (payload: User): void => {\n setUser(payload);\n setUserProfile((prev: UserProfile | null) => ({\n schemas: prev?.schemas ?? [],\n flattenedProfile: generateFlattenedUserProfile(payload, prev?.schemas ?? []),\n profile: payload,\n }));\n };\n\n const getDecodedIdToken: () => Promise<IdToken> = useCallback(\n async (): Promise<IdToken> => client.getDecodedIdToken(),\n [client],\n );\n\n const getIdToken: () => Promise<string> = useCallback(async (): Promise<string> => client.getIdToken(), [client]);\n\n const getAccessToken: () => Promise<string> = useCallback(\n async (): Promise<string> => client.getAccessToken(),\n [client],\n );\n\n const getStorageManager: () => Promise<any> = useCallback(async (): Promise<any> => {\n const storageManager: any = storageManagerRef.current ?? (await client.getStorageManager());\n if (storageManager) {\n storageManagerRef.current = storageManager;\n }\n return storageManager;\n }, [client]);\n\n const request: (...args: any[]) => Promise<any> = useCallback(\n async (...args: any[]): Promise<any> => client.request(...args),\n [client],\n );\n\n const requestAll: (...args: any[]) => Promise<any> = useCallback(\n async (...args: any[]): Promise<any> => client.requestAll(...args),\n [client],\n );\n\n const exchangeToken: (exchangeConfig: any) => Promise<any> = useCallback(\n async (exchangeConfig: any): Promise<any> => client.exchangeToken(exchangeConfig),\n [client],\n );\n\n const signOut: (...args: any[]) => Promise<any> = useCallback(\n async (...args: any[]): Promise<any> => client.signOut(...args),\n [client],\n );\n\n const recover: (payload: any) => Promise<any> = useCallback(\n async (payload: any): Promise<any> => client.recover(payload),\n [client],\n );\n\n const signUp: (...args: any[]) => Promise<any> = useCallback(\n async (...args: any[]): Promise<any> => client.signUp(...args),\n [client],\n );\n\n const clearSession: (...args: any[]) => Promise<any> = useCallback(\n async (...args: any[]): Promise<any> => client.clearSession(...args),\n [client],\n );\n\n const reInitialize: (reInitConfig: any) => Promise<any> = useCallback(\n async (reInitConfig: any): Promise<any> => client.reInitialize(reInitConfig),\n [client],\n );\n\n const value: any = useMemo(\n () => ({\n afterSignInUrl: config.afterSignInUrl,\n applicationId: config.applicationId,\n baseUrl,\n scopes: config.scopes,\n clearSession,\n clientId,\n discovery: {\n wellKnown,\n },\n exchangeToken,\n getAccessToken,\n getDecodedIdToken,\n getIdToken,\n getStorageManager,\n http: {\n request,\n requestAll,\n },\n instanceId,\n isInitialized: isInitializedSync,\n isLoading: isLoadingSync,\n isSignedIn: isSignedInSync,\n organizationChain,\n organizationHandle: config?.organizationHandle,\n reInitialize,\n recover,\n signIn,\n signInOptions,\n tokenRequest,\n signInSilently,\n signInUrl,\n signOut,\n signUp,\n signUpUrl,\n syncSession,\n user,\n vendor: getVendorPrefix(config.vendor),\n }),\n [\n applicationId,\n config?.organizationHandle,\n config.vendor,\n config.afterSignInUrl,\n config.scopes,\n signInUrl,\n signUpUrl,\n baseUrl,\n clientId,\n wellKnown,\n isInitializedSync,\n isLoadingSync,\n isSignedInSync,\n signIn,\n signInSilently,\n user,\n client,\n signInOptions,\n tokenRequest,\n syncSession,\n getDecodedIdToken,\n clearSession,\n exchangeToken,\n getAccessToken,\n getStorageManager,\n instanceId,\n organizationChain,\n recover,\n reInitialize,\n request,\n requestAll,\n signOut,\n signUp,\n ],\n );\n\n return (\n <ThunderIDContext.Provider value={value}>\n <I18nProvider preferences={preferences?.i18n} vendor={getVendorPrefix(config.vendor)}>\n <FlowMetaProvider enabled={preferences?.resolveFromMeta !== false}>\n <ThemeProvider\n theme={{\n ...preferences?.theme?.overrides,\n direction: preferences?.theme?.direction,\n }}\n >\n <FlowProvider>\n <UserProvider profile={userProfile!} onUpdateProfile={handleProfileUpdate}>\n <ComponentRendererProvider renderers={(extensions?.components?.renderers ?? {}) as any}>\n {children}\n </ComponentRendererProvider>\n </UserProvider>\n </FlowProvider>\n </ThemeProvider>\n </FlowMetaProvider>\n </I18nProvider>\n </ThunderIDContext.Provider>\n );\n};\n\nexport default ThunderIDProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;;AA2CA,MAAMA,+DACJ,oBACA,oBACD;AAOD,MAAMC,qBAAoE,EACxE,gBACA,iBACA,SAAS,gBACT,UACA,UACA,YACA,QACA,aACA,WACA,WACA,oBACA,eACA,eACA,cACA,aACA,aAAa,GACb,kBACA,GAAG,WAC0D;CAC7D,MAAMC,qCAA8C,MAAM;CAC1D,MAAMC,kCAA6C,IAAIC,qCAAqB,WAAW,EAAE,CAAC,WAAW,CAAC;CACtG,MAAMC,sCAAqC,KAAK;CAChD,MAAM,EAAC,eAAe,6BAA4BC,+BAAe;CACjE,MAAM,CAAC,MAAM,+BAAgC,KAAK;CAClD,MAAM,CAAC,gBAAgB,yCAAuC,MAAM;CACpE,MAAM,CAAC,mBAAmB,4CAA0C,MAAM;CAC1E,MAAM,CAAC,eAAe,wCAAsC,KAAK;CAEjE,MAAM,CAAC,aAAa,sCAA+C,KAAK;CACxE,MAAM,CAAC,SAAS,kCAA+B,kBAAkB,GAAG;CACpE,MAAM,CAAC,QAAQ,iCAA4C;EACzD,gBAAgB,kBAAkB,OAAO,SAAS;EAClD,iBAAiB,mBAAmB,OAAO,SAAS;EACpD;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA;EACA,GAAG;EACJ,CAAC;CAEF,MAAM,CAAC,mBAAmB,4CAA0C,MAAM;CAC1E,MAAM,CAAC,WAAW,oCAA0D,KAAK;AAEjF,4BAAgB;AACd,aAAW,kBAAkB,GAAG;IAC/B,CAAC,eAAe,CAAC;AAEpB,4BAAgB;AACd,GAAC,YAA2B;AAC1B,SAAM,OAAO,WAAW,OAAO;AAE/B,aADgD,MAAM,OAAO,kBAAkB,CACnD;AAC5B,gBAAa,MAAM,OAAO,sBAA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AClF,2CAACC;IAAiB,SAAS,aAAa,oBAAoB;cAC1D,2CAACC;KACC,OAAO;MACL,GAAG,aAAa,OAAO;MACvB,WAAW,aAAa,OAAO;MAChC;eAED,2CAACC,0CACC,2CAACC;MAAa,SAAS;MAAc,iBAAiB;gBACpD,2CAACC;OAA0B,WAAY,YAAY,YAAY,aAAa,EAAE;OAC3E;QACyB;OACf,GACF;MACD;KACC;IACN;GACW;;AAIhC,gCAAe"}
1
+ {"version":3,"file":"ThunderIDProvider.cjs","names":["logger: ReturnType<typeof createPackageComponentLogger>","ThunderIDProvider: FC<PropsWithChildren<ThunderIDProviderProps>>","reRenderCheckRef: RefObject<boolean>","client: ThunderIDReactClient","ThunderIDReactClient","storageManagerRef: any","useBrowserUrl","resolvedBaseUrl: string","decodedToken: IdToken","shouldFetchProfile: boolean","claims: User","currentSignInStatus: boolean","getUsersMe","arg1: any","isV2FlowRequest: boolean","ThunderIDRuntimeError","isAlreadySignedIn: boolean","currentUrl: URL","urlParams: URLSearchParams","code: string | null","executionIdFromUrl: string | null","storedExecutionId: string | null","interval: NodeJS.Timeout","status: boolean","getDecodedIdToken: () => Promise<IdToken>","getIdToken: () => Promise<string>","getAccessToken: () => Promise<string>","getStorageManager: () => Promise<any>","storageManager: any","request: (...args: any[]) => Promise<any>","requestAll: (...args: any[]) => Promise<any>","exchangeToken: (exchangeConfig: any) => Promise<any>","signOut: (...args: any[]) => Promise<any>","recover: (payload: any) => Promise<any>","signUp: (...args: any[]) => Promise<any>","clearSession: (...args: any[]) => Promise<any>","reInitialize: (reInitConfig: any) => Promise<any>","value: any","ThunderIDContext","I18nProvider","FlowMetaProvider","ThemeProvider","FlowProvider","UserProvider","ComponentRendererProvider"],"sources":["../../../../src/contexts/ThunderID/ThunderIDProvider.tsx"],"sourcesContent":["/**\n * Copyright (c) 2025-2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n ThunderIDRuntimeError,\n generateFlattenedUserProfile,\n OIDCDiscoveryApiResponse,\n SignInOptions,\n User,\n UserProfile,\n IdToken,\n extractUserClaimsFromIdToken,\n EmbeddedSignInFlowResponse,\n createPackageComponentLogger,\n getVendorPrefix,\n} from '@thunderid/browser';\nimport {FC, RefObject, PropsWithChildren, ReactElement, useEffect, useMemo, useRef, useState, useCallback} from 'react';\nimport ThunderIDContext from './ThunderIDContext';\nimport useBrowserUrl from '../../hooks/useBrowserUrl';\nimport {ThunderIDReactConfig} from '../../models/config';\nimport ThunderIDReactClient from '../../ThunderIDReactClient';\nimport ComponentRendererProvider from '../ComponentRenderer/ComponentRendererProvider';\nimport FlowProvider from '../Flow/FlowProvider';\nimport FlowMetaProvider from '../FlowMeta/FlowMetaProvider';\nimport I18nProvider from '../I18n/I18nProvider';\nimport ThemeProvider from '../Theme/ThemeProvider';\nimport UserProvider from '../User/UserProvider';\nimport getUsersMe from '../../api/getUsersMe';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/react',\n 'ThunderIDProvider',\n);\n\n/**\n * Props interface of {@link ThunderIDProvider}\n */\nexport type ThunderIDProviderProps = ThunderIDReactConfig;\n\nconst ThunderIDProvider: FC<PropsWithChildren<ThunderIDProviderProps>> = ({\n afterSignInUrl,\n afterSignOutUrl,\n baseUrl: initialBaseUrl,\n clientId,\n children,\n extensions,\n scopes,\n preferences,\n signInUrl,\n signUpUrl,\n organizationHandle,\n applicationId,\n signInOptions,\n tokenRequest,\n syncSession,\n instanceId = 0,\n organizationChain,\n ...rest\n}: PropsWithChildren<ThunderIDProviderProps>): ReactElement => {\n const reRenderCheckRef: RefObject<boolean> = useRef(false);\n const client: ThunderIDReactClient = useMemo(() => new ThunderIDReactClient(instanceId), [instanceId]);\n const storageManagerRef: any = useRef<any>(null);\n const {hasAuthParams, hasCalledForThisInstance} = useBrowserUrl();\n const [user, setUser] = useState<any | null>(null);\n const [isSignedInSync, setIsSignedInSync] = useState<boolean>(false);\n const [isInitializedSync, setIsInitializedSync] = useState<boolean>(false);\n const [isLoadingSync, setIsLoadingSync] = useState<boolean>(true);\n\n const [userProfile, setUserProfile] = useState<UserProfile | null>(null);\n const [baseUrl, setBaseUrl] = useState<string>(initialBaseUrl ?? '');\n const [config, setConfig] = useState<ThunderIDReactConfig>({\n afterSignInUrl: afterSignInUrl ?? window.location.origin,\n afterSignOutUrl: afterSignOutUrl ?? window.location.origin,\n applicationId,\n baseUrl,\n clientId,\n organizationChain,\n organizationHandle,\n scopes,\n signInOptions,\n tokenRequest,\n signInUrl,\n signUpUrl,\n syncSession,\n ...rest,\n });\n\n const [isUpdatingSession, setIsUpdatingSession] = useState<boolean>(false);\n const [wellKnown, setWellKnown] = useState<OIDCDiscoveryApiResponse | null>(null);\n\n useEffect(() => {\n setBaseUrl(initialBaseUrl ?? '');\n }, [initialBaseUrl]);\n\n useEffect(() => {\n (async (): Promise<void> => {\n await client.initialize(config);\n const initializedConfig: ThunderIDReactConfig = await client.getConfiguration();\n setConfig(initializedConfig);\n setWellKnown(await client.getDiscoveryResponse());\n })();\n }, []);\n\n async function updateSession(): Promise<void> {\n try {\n // Set flag to prevent loading state tracking from interfering\n setIsUpdatingSession(true);\n setIsLoadingSync(true);\n let resolvedBaseUrl: string = baseUrl;\n\n const decodedToken: IdToken = await client.getDecodedIdToken();\n\n // If there's a `user_org` claim in the ID token,\n // Treat this login as a organization login.\n if (decodedToken?.['user_org']) {\n resolvedBaseUrl = `${(await client.getConfiguration()).baseUrl}/o`;\n setBaseUrl(resolvedBaseUrl);\n }\n\n const shouldFetchProfile: boolean = preferences?.user?.fetchUserProfile !== false;\n const claims: User = extractUserClaimsFromIdToken(decodedToken) as User;\n let profileData = claims;\n const currentSignInStatus: boolean = await client.isSignedIn();\n\n if (currentSignInStatus && shouldFetchProfile) {\n try {\n const fetchedProfile = await getUsersMe({baseUrl: resolvedBaseUrl, instanceId});\n profileData = {...claims, ...fetchedProfile};\n } catch (err) {\n logger.warn('Failed to fetch user profile from /users/me:', err);\n }\n }\n\n setUser(profileData);\n setUserProfile({\n flattenedProfile: generateFlattenedUserProfile(profileData, []),\n profile: profileData,\n });\n\n // CRITICAL: Update sign-in status BEFORE setting loading to false\n // This prevents the race condition where ProtectedRoute sees isLoading=false but isSignedIn=false\n setIsSignedInSync(currentSignInStatus);\n } catch (error) {\n // TODO: Add an error log.\n } finally {\n // Clear the flag and set final loading state\n setIsUpdatingSession(false);\n setIsLoadingSync(client.isLoading());\n }\n }\n\n async function signIn(...args: any): Promise<User | EmbeddedSignInFlowResponse> {\n // Check if this is a V2 embedded flow request BEFORE calling signIn\n // This allows us to skip session checks entirely for V2 flows\n const arg1: any = args[0];\n const isV2FlowRequest: boolean =\n typeof arg1 === 'object' && arg1 !== null && ('executionId' in arg1 || 'applicationId' in arg1);\n\n try {\n if (!isV2FlowRequest) {\n setIsUpdatingSession(true);\n setIsLoadingSync(true);\n }\n\n return await client.signIn(...args);\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Sign in failed: ${error instanceof Error ? error.message : String(JSON.stringify(error))}`,\n 'thunderid-signIn-Error',\n 'react',\n 'An error occurred while trying to sign in.',\n );\n } finally {\n if (!isV2FlowRequest) {\n setIsUpdatingSession(false);\n setIsLoadingSync(client.isLoading());\n }\n }\n }\n\n /**\n * Try signing in when the component is mounted.\n */\n useEffect(() => {\n // React 18.x Strict.Mode has a new check for `Ensuring reusable state` to facilitate an upcoming react feature.\n // https://reactjs.org/docs/strict-mode.html#ensuring-reusable-state\n // This will remount all the useEffects to ensure that there are no unexpected side effects.\n // When react remounts the signIn hook of the AuthProvider, it will cause a race condition. Hence, we have to\n // prevent the re-render of this hook as suggested in the following discussion.\n // https://github.com/reactwg/react-18/discussions/18#discussioncomment-795623\n if (reRenderCheckRef.current) {\n return;\n }\n\n reRenderCheckRef.current = true;\n\n (async (): Promise<void> => {\n // Sync session state whenever sign-in completes (both redirect and embedded V2 flows).\n // Pass the user returned by the SDK's sign-in flow so users/me result is not discarded.\n await client.on('sign-in', async () => {\n await updateSession();\n });\n\n // User is already authenticated. Skip...\n const isAlreadySignedIn: boolean = await client.isSignedIn();\n\n // Start auto-refresh with a soft failure.\n const scheduleAutoRefresh = async (): Promise<void> => {\n try {\n await client.startAutoRefreshToken();\n } catch (error) {\n logger.warn('Failed to schedule automatic token refresh.', error);\n }\n };\n\n // Restore session state and kick off the refresh timer.\n const resumeSession = async (): Promise<void> => {\n await updateSession();\n await scheduleAutoRefresh();\n };\n\n if (isAlreadySignedIn) {\n await resumeSession();\n }\n\n // The access token may have expired while the refresh token is still valid.\n // Attempt a silent refresh — startAutoRefreshToken() calls refreshAccessToken()\n // immediately when timeUntilRefresh <= 0, then re-check sign-in status.\n await scheduleAutoRefresh();\n\n if (await client.isSignedIn()) {\n await resumeSession();\n return;\n }\n\n const currentUrl: URL = new URL(window.location.href);\n const hasAuthParamsResult: boolean =\n hasAuthParams(currentUrl, config.afterSignInUrl!) && hasCalledForThisInstance(currentUrl, instanceId ?? 0);\n\n if (hasAuthParamsResult) {\n try {\n const urlParams: URLSearchParams = currentUrl.searchParams;\n const code: string | null = urlParams.get('code');\n const executionIdFromUrl: string | null = urlParams.get('executionId');\n const storedExecutionId: string | null = sessionStorage.getItem(\n `${getVendorPrefix(config.vendor)}_execution_id`,\n );\n\n if (code && !executionIdFromUrl && !storedExecutionId) {\n await signIn();\n }\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Sign in failed: ${error instanceof Error ? error.message : String(JSON.stringify(error))}`,\n 'thunderid-signIn-Error',\n 'react',\n 'An error occurred while trying to sign in.',\n );\n }\n }\n })();\n }, []);\n\n /**\n * Check if the user is signed in and update the state accordingly.\n * This will also set an interval to check for the sign-in status every second\n * until the user is signed in.\n */\n useEffect(() => {\n let interval: NodeJS.Timeout;\n\n (async (): Promise<void> => {\n try {\n const status: boolean = await client.isSignedIn();\n\n setIsSignedInSync(status);\n\n if (!status) {\n interval = setInterval(async () => {\n const newStatus: boolean = await client.isSignedIn();\n\n if (newStatus) {\n setIsSignedInSync(true);\n clearInterval(interval);\n }\n }, 1000);\n } else {\n // TODO: Add a debug log to indicate that the user is already signed in.\n }\n } catch (error) {\n setIsSignedInSync(false);\n }\n })();\n\n return (): void => {\n if (interval) {\n clearInterval(interval);\n }\n };\n }, [client]);\n\n useEffect(() => {\n (async (): Promise<void> => {\n try {\n const status: boolean = await client.isInitialized();\n\n setIsInitializedSync(status);\n } catch (error) {\n setIsInitializedSync(false);\n }\n })();\n }, [client]);\n\n /**\n * Track loading state changes from the ThunderID client\n */\n useEffect(() => {\n const checkLoadingState = (): void => {\n // Don't override loading state during critical session updates\n if (isUpdatingSession) {\n return;\n }\n\n // Don't set loading=false while auth params are in the URL and user isn't signed in yet.\n // This prevents ProtectedRoute from redirecting before the sign-in effect processes the auth code.\n const currentUrl: URL = new URL(window.location.href);\n if (!isSignedInSync && hasAuthParams(currentUrl, config.afterSignInUrl!)) {\n return;\n }\n\n setIsLoadingSync(client.isLoading());\n };\n\n // Initial check\n checkLoadingState();\n\n // Set up an interval to check for loading state changes\n const interval: NodeJS.Timeout = setInterval(checkLoadingState, 100);\n\n return (): void => {\n clearInterval(interval);\n };\n }, [client, isLoadingSync, isSignedInSync, isUpdatingSession]);\n\n const signInSilently = async (options?: SignInOptions): Promise<User | boolean> => {\n try {\n setIsUpdatingSession(true);\n setIsLoadingSync(true);\n return await client.signInSilently(options);\n } catch (error) {\n throw new ThunderIDRuntimeError(\n `Error while signing in silently: ${error instanceof Error ? error.message : String(JSON.stringify(error))}`,\n 'thunderid-signInSilently-Error',\n 'react',\n 'An error occurred while trying to sign in silently.',\n );\n } finally {\n setIsUpdatingSession(false);\n setIsLoadingSync(client.isLoading());\n }\n };\n\n const handleProfileUpdate = (payload: User): void => {\n setUser(payload);\n setUserProfile((prev: UserProfile | null) => ({\n flattenedProfile: generateFlattenedUserProfile(payload),\n profile: payload,\n }));\n };\n\n const getDecodedIdToken: () => Promise<IdToken> = useCallback(\n async (): Promise<IdToken> => client.getDecodedIdToken(),\n [client],\n );\n\n const getIdToken: () => Promise<string> = useCallback(async (): Promise<string> => client.getIdToken(), [client]);\n\n const getAccessToken: () => Promise<string> = useCallback(\n async (): Promise<string> => client.getAccessToken(),\n [client],\n );\n\n const getStorageManager: () => Promise<any> = useCallback(async (): Promise<any> => {\n const storageManager: any = storageManagerRef.current ?? (await client.getStorageManager());\n if (storageManager) {\n storageManagerRef.current = storageManager;\n }\n return storageManager;\n }, [client]);\n\n const request: (...args: any[]) => Promise<any> = useCallback(\n async (...args: any[]): Promise<any> => client.request(...args),\n [client],\n );\n\n const requestAll: (...args: any[]) => Promise<any> = useCallback(\n async (...args: any[]): Promise<any> => client.requestAll(...args),\n [client],\n );\n\n const exchangeToken: (exchangeConfig: any) => Promise<any> = useCallback(\n async (exchangeConfig: any): Promise<any> => client.exchangeToken(exchangeConfig),\n [client],\n );\n\n const signOut: (...args: any[]) => Promise<any> = useCallback(\n async (...args: any[]): Promise<any> => client.signOut(...args),\n [client],\n );\n\n const recover: (payload: any) => Promise<any> = useCallback(\n async (payload: any): Promise<any> => client.recover(payload),\n [client],\n );\n\n const signUp: (...args: any[]) => Promise<any> = useCallback(\n async (...args: any[]): Promise<any> => client.signUp(...args),\n [client],\n );\n\n const clearSession: (...args: any[]) => Promise<any> = useCallback(\n async (...args: any[]): Promise<any> => client.clearSession(...args),\n [client],\n );\n\n const reInitialize: (reInitConfig: any) => Promise<any> = useCallback(\n async (reInitConfig: any): Promise<any> => client.reInitialize(reInitConfig),\n [client],\n );\n\n const value: any = useMemo(\n () => ({\n afterSignInUrl: config.afterSignInUrl,\n applicationId: config.applicationId,\n baseUrl,\n scopes: config.scopes,\n clearSession,\n clientId,\n discovery: {\n wellKnown,\n },\n exchangeToken,\n getAccessToken,\n getDecodedIdToken,\n getIdToken,\n getStorageManager,\n http: {\n request,\n requestAll,\n },\n instanceId,\n isInitialized: isInitializedSync,\n isLoading: isLoadingSync,\n isSignedIn: isSignedInSync,\n organizationChain,\n organizationHandle: config?.organizationHandle,\n preferences,\n reInitialize,\n recover,\n signIn,\n signInOptions,\n tokenRequest,\n signInSilently,\n signInUrl,\n signOut,\n signUp,\n signUpUrl,\n syncSession,\n user,\n vendor: getVendorPrefix(config.vendor),\n }),\n [\n applicationId,\n config?.organizationHandle,\n config.vendor,\n config.afterSignInUrl,\n config.scopes,\n signInUrl,\n signUpUrl,\n baseUrl,\n clientId,\n wellKnown,\n isInitializedSync,\n isLoadingSync,\n isSignedInSync,\n signIn,\n signInSilently,\n user,\n client,\n signInOptions,\n tokenRequest,\n syncSession,\n getDecodedIdToken,\n clearSession,\n exchangeToken,\n getAccessToken,\n getStorageManager,\n instanceId,\n organizationChain,\n preferences,\n recover,\n reInitialize,\n request,\n requestAll,\n signOut,\n signUp,\n ],\n );\n\n return (\n <ThunderIDContext.Provider value={value}>\n <I18nProvider preferences={preferences?.i18n} vendor={getVendorPrefix(config.vendor)}>\n <FlowMetaProvider enabled={preferences?.resolveFromMeta !== false}>\n <ThemeProvider\n theme={{\n ...preferences?.theme?.overrides,\n direction: preferences?.theme?.direction,\n }}\n >\n <FlowProvider>\n <UserProvider profile={userProfile!} onUpdateProfile={handleProfileUpdate}>\n <ComponentRendererProvider renderers={(extensions?.components?.renderers ?? {}) as any}>\n {children}\n </ComponentRendererProvider>\n </UserProvider>\n </FlowProvider>\n </ThemeProvider>\n </FlowMetaProvider>\n </I18nProvider>\n </ThunderIDContext.Provider>\n );\n};\n\nexport default ThunderIDProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;;;AA4CA,MAAMA,+DACJ,oBACA,oBACD;AAOD,MAAMC,qBA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O;aAClF,2CAACC;IAAiB,SAAS,aAAa,oBAAoB;cAC1D,2CAACC;KACC,OAAO;MACL,GAAG,aAAa,OAAO;MACvB,WAAW,aAAa,OAAO;MAChC;eAED,2CAACC,0CACC,2CAACC;MAAa,SAAS;MAAc,iBAAiB;gBACpD,2CAACC;OAA0B,WAAY,YAAY,YAAY,aAAa,EAAE;OAC3E;QACyB;OACf,GACF;MACD;KACC;IACN;GACW;;AAIhC,gCAAe"}
@@ -11,7 +11,6 @@ const UserContext = (0, react.createContext)({
11
11
  onUpdateProfile: () => null,
12
12
  profile: null,
13
13
  revalidateProfile: () => null,
14
- schemas: null,
15
14
  updateProfile: () => null
16
15
  });
17
16
  UserContext.displayName = "UserContext";
@@ -1 +1 @@
1
- {"version":3,"file":"UserContext.cjs","names":["UserContext: Context<UserContextProps | null>"],"sources":["../../../../src/contexts/User/UserContext.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {User, Schema, UpdateMeProfileConfig} from '@thunderid/browser';\nimport {Context, createContext} from 'react';\n\n/**\n * Props interface of {@link UserContext}\n */\nexport interface UserContextProps {\n flattenedProfile: User | null;\n onUpdateProfile: (payload: User) => void;\n profile: User | null;\n revalidateProfile: () => Promise<void>;\n schemas: Schema[] | null;\n updateProfile: (\n requestConfig: UpdateMeProfileConfig,\n sessionId?: string,\n ) => Promise<{data: {user: User}; error: string; success: boolean}>;\n}\n\n/**\n * Context object for managing user profile data and related operations.\n */\nconst UserContext: Context<UserContextProps | null> = createContext<null | UserContextProps>({\n flattenedProfile: null,\n onUpdateProfile: () => null,\n profile: null,\n revalidateProfile: () => null as unknown as Promise<void>,\n schemas: null,\n updateProfile: () => null as unknown as Promise<{data: {user: User}; error: string; success: boolean}>,\n});\n\nUserContext.displayName = 'UserContext';\n\nexport default UserContext;\n"],"mappings":";;;;;;;;AAuCA,MAAMA,uCAAuF;CAC3F,kBAAkB;CAClB,uBAAuB;CACvB,SAAS;CACT,yBAAyB;CACzB,SAAS;CACT,qBAAqB;CACtB,CAAC;AAEF,YAAY,cAAc;AAE1B,0BAAe"}
1
+ {"version":3,"file":"UserContext.cjs","names":["UserContext: Context<UserContextProps | null>"],"sources":["../../../../src/contexts/User/UserContext.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {User, UpdateMeProfileConfig} from '@thunderid/browser';\nimport {Context, createContext} from 'react';\n\n/**\n * Props interface of {@link UserContext}\n */\nexport interface UserContextProps {\n flattenedProfile: User | null;\n onUpdateProfile: (payload: User) => void;\n profile: User | null;\n revalidateProfile: () => Promise<void>;\n updateProfile: (\n requestConfig: UpdateMeProfileConfig,\n sessionId?: string,\n ) => Promise<{data: {user: User}; error: string; success: boolean}>;\n}\n\n/**\n * Context object for managing user profile data and related operations.\n */\nconst UserContext: Context<UserContextProps | null> = createContext<null | UserContextProps>({\n flattenedProfile: null,\n onUpdateProfile: () => null,\n profile: null,\n revalidateProfile: () => null as unknown as Promise<void>,\n updateProfile: () => null as unknown as Promise<{data: {user: User}; error: string; success: boolean}>,\n});\n\nUserContext.displayName = 'UserContext';\n\nexport default UserContext;\n"],"mappings":";;;;;;;;AAsCA,MAAMA,uCAAuF;CAC3F,kBAAkB;CAClB,uBAAuB;CACvB,SAAS;CACT,yBAAyB;CACzB,qBAAqB;CACtB,CAAC;AAEF,YAAY,cAAc;AAE1B,0BAAe"}
@@ -11,7 +11,6 @@ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
11
11
  *
12
12
  * This provider:
13
13
  * - Fetches user profile data from the ME endpoint
14
- * - Retrieves SCIM2 schemas for profile structure
15
14
  * - Generates both nested and flattened user profiles
16
15
  * - Provides functions for refreshing and updating user data
17
16
  * - Handles loading states and errors
@@ -40,7 +39,6 @@ const UserProvider = ({ children, profile, revalidateProfile, onUpdateProfile, u
40
39
  onUpdateProfile,
41
40
  profile: profile?.profile,
42
41
  revalidateProfile,
43
- schemas: profile?.schemas,
44
42
  updateProfile
45
43
  }), [
46
44
  profile,
@@ -1 +1 @@
1
- {"version":3,"file":"UserProvider.cjs","names":["UserProvider: FC<PropsWithChildren<UserProviderProps>>","contextValue: any","UserContext"],"sources":["../../../../src/contexts/User/UserProvider.tsx"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {UpdateMeProfileConfig, User, UserProfile} from '@thunderid/browser';\nimport {FC, PropsWithChildren, ReactElement, useMemo} from 'react';\nimport UserContext from './UserContext';\n\n/**\n * Props interface of {@link UserProvider}\n */\nexport interface UserProviderProps {\n onUpdateProfile?: (payload: User) => void;\n profile: UserProfile;\n revalidateProfile?: () => Promise<void>;\n updateProfile?: (\n requestConfig: UpdateMeProfileConfig,\n sessionId?: string,\n ) => Promise<{data: {user: User}; error: string; success: boolean}>;\n}\n\n/**\n * UserProvider component that manages user profile data and provides it through UserContext.\n *\n * This provider:\n * - Fetches user profile data from the ME endpoint\n * - Retrieves SCIM2 schemas for profile structure\n * - Generates both nested and flattened user profiles\n * - Provides functions for refreshing and updating user data\n * - Handles loading states and errors\n *\n * @example\n * ```tsx\n * // Basic usage\n * <UserProvider>\n * <App />\n * </UserProvider>\n *\n * // With custom error handling\n * <UserProvider onError={(error) => console.error('User error:', error)}>\n * <App />\n * </UserProvider>\n *\n * // Disable auto-fetch (fetch manually using refreshUser)\n * <UserProvider autoFetch={false}>\n * <App />\n * </UserProvider>\n * ```\n */\nconst UserProvider: FC<PropsWithChildren<UserProviderProps>> = ({\n children,\n profile,\n revalidateProfile,\n onUpdateProfile,\n updateProfile,\n}: PropsWithChildren<UserProviderProps>): ReactElement => {\n const contextValue: any = useMemo(\n () => ({\n flattenedProfile: profile?.flattenedProfile,\n onUpdateProfile,\n profile: profile?.profile,\n revalidateProfile,\n schemas: profile?.schemas,\n updateProfile,\n }),\n [profile, onUpdateProfile, revalidateProfile, updateProfile],\n );\n\n return <UserContext.Provider value={contextValue}>{children}</UserContext.Provider>;\n};\n\nexport default UserProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+DA,MAAMA,gBAA0D,EAC9D,UACA,SACA,mBACA,iBACA,oBACwD;CACxD,MAAMC,yCACG;EACL,kBAAkB,SAAS;EAC3B;EACA,SAAS,SAAS;EAClB;EACA,SAAS,SAAS;EAClB;EACD,GACD;EAAC;EAAS;EAAiB;EAAmB;EAAc,CAC7D;AAED,QAAO,2CAACC,4BAAY;EAAS,OAAO;EAAe;GAAgC;;AAGrF,2BAAe"}
1
+ {"version":3,"file":"UserProvider.cjs","names":["UserProvider: FC<PropsWithChildren<UserProviderProps>>","contextValue: any","UserContext"],"sources":["../../../../src/contexts/User/UserProvider.tsx"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {UpdateMeProfileConfig, User, UserProfile} from '@thunderid/browser';\nimport {FC, PropsWithChildren, ReactElement, useMemo} from 'react';\nimport UserContext from './UserContext';\n\n/**\n * Props interface of {@link UserProvider}\n */\nexport interface UserProviderProps {\n onUpdateProfile?: (payload: User) => void;\n profile: UserProfile;\n revalidateProfile?: () => Promise<void>;\n updateProfile?: (\n requestConfig: UpdateMeProfileConfig,\n sessionId?: string,\n ) => Promise<{data: {user: User}; error: string; success: boolean}>;\n}\n\n/**\n * UserProvider component that manages user profile data and provides it through UserContext.\n *\n * This provider:\n * - Fetches user profile data from the ME endpoint\n * - Generates both nested and flattened user profiles\n * - Provides functions for refreshing and updating user data\n * - Handles loading states and errors\n *\n * @example\n * ```tsx\n * // Basic usage\n * <UserProvider>\n * <App />\n * </UserProvider>\n *\n * // With custom error handling\n * <UserProvider onError={(error) => console.error('User error:', error)}>\n * <App />\n * </UserProvider>\n *\n * // Disable auto-fetch (fetch manually using refreshUser)\n * <UserProvider autoFetch={false}>\n * <App />\n * </UserProvider>\n * ```\n */\nconst UserProvider: FC<PropsWithChildren<UserProviderProps>> = ({\n children,\n profile,\n revalidateProfile,\n onUpdateProfile,\n updateProfile,\n}: PropsWithChildren<UserProviderProps>): ReactElement => {\n const contextValue: any = useMemo(\n () => ({\n flattenedProfile: profile?.flattenedProfile,\n onUpdateProfile,\n profile: profile?.profile,\n revalidateProfile,\n updateProfile,\n }),\n [profile, onUpdateProfile, revalidateProfile, updateProfile],\n );\n\n return <UserContext.Provider value={contextValue}>{children}</UserContext.Provider>;\n};\n\nexport default UserProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,MAAMA,gBAA0D,EAC9D,UACA,SACA,mBACA,iBACA,oBACwD;CACxD,MAAMC,yCACG;EACL,kBAAkB,SAAS;EAC3B;EACA,SAAS,SAAS;EAClB;EACA;EACD,GACD;EAAC;EAAS;EAAiB;EAAmB;EAAc,CAC7D;AAED,QAAO,2CAACC,4BAAY;EAAS,OAAO;EAAe;GAAgC;;AAGrF,2BAAe"}
@@ -9,7 +9,6 @@ react = require_rolldown_runtime.__toESM(react);
9
9
  *
10
10
  * This hook provides access to user profile data including:
11
11
  * - Raw profile API response
12
- * - SCIM2 schemas
13
12
  * - Nested user object
14
13
  * - Flattened user profile
15
14
  * - Functions to refresh and update user data
@@ -1 +1 @@
1
- {"version":3,"file":"useUser.cjs","names":["context: UserContextProps | null","UserContext"],"sources":["../../../../src/contexts/User/useUser.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {useContext} from 'react';\nimport UserContext, {UserContextProps} from './UserContext';\n\n/**\n * Hook to access the User context.\n *\n * This hook provides access to user profile data including:\n * - Raw profile API response\n * - SCIM2 schemas\n * - Nested user object\n * - Flattened user profile\n * - Functions to refresh and update user data\n * - Loading states and error handling\n *\n * @returns {UserContextProps} The user context value containing all user-related data and functions\n * @throws {Error} Throws an error if used outside of UserProvider\n *\n * @example\n * ```tsx\n * import {useUser} from '@thunderid/react';\n *\n * function ProfileComponent() {\n * const {\n * isLoading,\n * profile,\n * schemas,\n * user,\n * flattenedUser,\n * refreshUser,\n * updateUser,\n * error\n * } = useUser();\n *\n * if (isLoading) {\n * return <div>Loading user data...</div>;\n * }\n *\n * if (error) {\n * return <div>Error: {error.message}</div>;\n * }\n *\n * return (\n * <div>\n * <h1>Welcome {user?.name?.givenName}!</h1>\n * <p>Email: {flattenedUser?.emails}</p>\n * <button onClick={refreshUser}>Refresh Profile</button>\n * </div>\n * );\n * }\n *\n * // Access specific user properties\n * function UserEmail() {\n * const {flattenedUser} = useUser();\n * return <span>{flattenedUser?.emails?.[0]}</span>;\n * }\n *\n * // Update user profile\n * function EditProfile() {\n * const {updateUser, user} = useUser();\n *\n * const handleUpdate = async () => {\n * try {\n * await updateUser({\n * name: {\n * givenName: 'John',\n * familyName: 'Doe'\n * }\n * });\n * } catch (error) {\n * console.error('Update failed:', error);\n * }\n * };\n *\n * return <button onClick={handleUpdate}>Update Name</button>;\n * }\n * ```\n */\nconst useUser = (): UserContextProps => {\n const context: UserContextProps | null = useContext(UserContext);\n\n if (!context) {\n throw new Error('useUser must be used within a UserProvider');\n }\n\n return context;\n};\n\nexport default useUser;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA+FA,MAAM,gBAAkC;CACtC,MAAMA,gCAA8CC,4BAAY;AAEhE,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,6CAA6C;AAG/D,QAAO;;AAGT,sBAAe"}
1
+ {"version":3,"file":"useUser.cjs","names":["context: UserContextProps | null","UserContext"],"sources":["../../../../src/contexts/User/useUser.ts"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {useContext} from 'react';\nimport UserContext, {UserContextProps} from './UserContext';\n\n/**\n * Hook to access the User context.\n *\n * This hook provides access to user profile data including:\n * - Raw profile API response\n * - Nested user object\n * - Flattened user profile\n * - Functions to refresh and update user data\n * - Loading states and error handling\n *\n * @returns {UserContextProps} The user context value containing all user-related data and functions\n * @throws {Error} Throws an error if used outside of UserProvider\n *\n * @example\n * ```tsx\n * import {useUser} from '@thunderid/react';\n *\n * function ProfileComponent() {\n * const {\n * isLoading,\n * profile,\n * schemas,\n * user,\n * flattenedUser,\n * refreshUser,\n * updateUser,\n * error\n * } = useUser();\n *\n * if (isLoading) {\n * return <div>Loading user data...</div>;\n * }\n *\n * if (error) {\n * return <div>Error: {error.message}</div>;\n * }\n *\n * return (\n * <div>\n * <h1>Welcome {user?.name?.givenName}!</h1>\n * <p>Email: {flattenedUser?.emails}</p>\n * <button onClick={refreshUser}>Refresh Profile</button>\n * </div>\n * );\n * }\n *\n * // Access specific user properties\n * function UserEmail() {\n * const {flattenedUser} = useUser();\n * return <span>{flattenedUser?.emails?.[0]}</span>;\n * }\n *\n * // Update user profile\n * function EditProfile() {\n * const {updateUser, user} = useUser();\n *\n * const handleUpdate = async () => {\n * try {\n * await updateUser({\n * name: {\n * givenName: 'John',\n * familyName: 'Doe'\n * }\n * });\n * } catch (error) {\n * console.error('Update failed:', error);\n * }\n * };\n *\n * return <button onClick={handleUpdate}>Update Name</button>;\n * }\n * ```\n */\nconst useUser = (): UserContextProps => {\n const context: UserContextProps | null = useContext(UserContext);\n\n if (!context) {\n throw new Error('useUser must be used within a UserProvider');\n }\n\n return context;\n};\n\nexport default useUser;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8FA,MAAM,gBAAkC;CACtC,MAAMA,gCAA8CC,4BAAY;AAEhE,KAAI,CAAC,QACH,OAAM,IAAI,MAAM,6CAA6C;AAG/D,QAAO;;AAGT,sBAAe"}
@@ -12,6 +12,7 @@ const require_ThemeContext = require('./contexts/Theme/ThemeContext.cjs');
12
12
  const require_ThemeProvider = require('./contexts/Theme/ThemeProvider.cjs');
13
13
  const require_UserContext = require('./contexts/User/UserContext.cjs');
14
14
  const require_UserProvider = require('./contexts/User/UserProvider.cjs');
15
+ const require_getUsersMe = require('./api/getUsersMe.cjs');
15
16
  const require_ThunderIDProvider = require('./contexts/ThunderID/ThunderIDProvider.cjs');
16
17
  const require_useUser = require('./contexts/User/useUser.cjs');
17
18
  const require_useFlow = require('./contexts/Flow/useFlow.cjs');
@@ -90,7 +91,6 @@ const require_BaseLanguageSwitcher = require('./components/presentation/Language
90
91
  const require_LanguageSwitcher = require('./components/presentation/LanguageSwitcher/LanguageSwitcher.cjs');
91
92
  const require_KeyValueInput = require('./components/primitives/KeyValueInput/KeyValueInput.cjs');
92
93
  const require_BuildingAlt = require('./components/primitives/Icons/BuildingAlt.cjs');
93
- const require_getScim2Me = require('./api/getScim2Me.cjs');
94
94
  let __thunderid_browser = require("@thunderid/browser");
95
95
  __thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
96
96
 
@@ -267,7 +267,7 @@ Object.defineProperty(exports, 'getActiveTheme', {
267
267
  }
268
268
  });
269
269
  exports.getConsentOptionalKey = require_ConsentCheckboxList.getConsentOptionalKey;
270
- exports.getMeProfile = require_getScim2Me.default;
270
+ exports.getMeProfile = require_getUsersMe.default;
271
271
  Object.defineProperty(exports, 'http', {
272
272
  enumerable: true,
273
273
  get: function () {
@@ -0,0 +1,74 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
2
+ let __thunderid_browser = require("@thunderid/browser");
3
+ __thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
4
+
5
+ //#region src/utils/composeAffixedInputs.ts
6
+ /**
7
+ * Returns the runtime sentinel prefix used to tag "selected prefix" entries in the
8
+ * form-state map. Resolved through the vendor namespace so white-labeled deployments
9
+ * do not collide with each other or with a real field identifier.
10
+ */
11
+ const prefixSentinel = (vendor) => `__${(0, __thunderid_browser.getVendorPrefix)(vendor)}_prefix__`;
12
+ /**
13
+ * Returns the runtime sentinel prefix used to tag "postfix" entries in the form-state
14
+ * map. See {@link prefixSentinel}.
15
+ */
16
+ const postfixSentinel = (vendor) => `__${(0, __thunderid_browser.getVendorPrefix)(vendor)}_postfix__`;
17
+ /**
18
+ * Returns the sentinel key used to store the selected prefix `value` for the affixed
19
+ * field addressed by `identifier`. The vendor namespace controls the runtime string
20
+ * so consumers overriding `vendor` do not conflict with the SDK default.
21
+ */
22
+ const affixPrefixKey = (identifier, vendor) => `${prefixSentinel(vendor)}${identifier}`;
23
+ /**
24
+ * Returns the sentinel key used to store the postfix `value` for the affixed field
25
+ * addressed by `identifier`. See {@link affixPrefixKey}.
26
+ */
27
+ const affixPostfixKey = (identifier, vendor) => `${postfixSentinel(vendor)}${identifier}`;
28
+ /**
29
+ * Rewrites `formData` (returns a new object) so that any affixed-input identifier
30
+ * tracked by matching sentinel prefix/postfix keys is replaced with its composed
31
+ * form `${prefix}${typed}${postfix}`. Sentinel keys are stripped from the result.
32
+ *
33
+ * Behaviour:
34
+ * - Prefix present, postfix present → `prefix + typed + postfix`.
35
+ * - Only prefix present → `prefix + typed`.
36
+ * - Only postfix present → `typed + postfix`.
37
+ * - Both empty / typed empty → the identifier is left untouched.
38
+ * - No sentinel keys → returns a shallow copy of `formData` unchanged.
39
+ *
40
+ * The input object is not mutated. This is component-type agnostic: any field carrying
41
+ * matching sentinel keys is composed, regardless of whether it originated from a
42
+ * TEXT_INPUT, EMAIL_INPUT, PASSWORD_INPUT, or PHONE_INPUT.
43
+ *
44
+ * @param formData - The current form values map (values indexed by field identifier).
45
+ * @param vendor - The vendor namespace configured on the SDK client, if any. Sentinel
46
+ * keys are resolved through this namespace so composition ignores unrelated keys
47
+ * written by other vendors when multiple SDK instances share a form.
48
+ */
49
+ const composeAffixedInputs = (formData, vendor) => {
50
+ const composed = { ...formData };
51
+ const prefixTag = prefixSentinel(vendor);
52
+ const postfixTag = postfixSentinel(vendor);
53
+ for (const key of Object.keys(formData)) {
54
+ if (!key.startsWith(prefixTag) && !key.startsWith(postfixTag)) continue;
55
+ const identifier = key.startsWith(prefixTag) ? key.slice(prefixTag.length) : key.slice(postfixTag.length);
56
+ const typed = composed[identifier] ?? "";
57
+ if (typed === "") {
58
+ delete composed[affixPrefixKey(identifier, vendor)];
59
+ delete composed[affixPostfixKey(identifier, vendor)];
60
+ continue;
61
+ }
62
+ composed[identifier] = `${composed[affixPrefixKey(identifier, vendor)] ?? ""}${typed}${composed[affixPostfixKey(identifier, vendor)] ?? ""}`;
63
+ delete composed[affixPrefixKey(identifier, vendor)];
64
+ delete composed[affixPostfixKey(identifier, vendor)];
65
+ }
66
+ return composed;
67
+ };
68
+ var composeAffixedInputs_default = composeAffixedInputs;
69
+
70
+ //#endregion
71
+ exports.affixPostfixKey = affixPostfixKey;
72
+ exports.affixPrefixKey = affixPrefixKey;
73
+ exports.default = composeAffixedInputs_default;
74
+ //# sourceMappingURL=composeAffixedInputs.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"composeAffixedInputs.cjs","names":["composed: Record<string, string>","prefixTag: string","postfixTag: string","identifier: string","typed: string"],"sources":["../../../src/utils/composeAffixedInputs.ts"],"sourcesContent":["/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {getVendorPrefix} from '@thunderid/browser';\n\n/**\n * Returns the runtime sentinel prefix used to tag \"selected prefix\" entries in the\n * form-state map. Resolved through the vendor namespace so white-labeled deployments\n * do not collide with each other or with a real field identifier.\n */\nconst prefixSentinel = (vendor?: string): string => `__${getVendorPrefix(vendor)}_prefix__`;\n\n/**\n * Returns the runtime sentinel prefix used to tag \"postfix\" entries in the form-state\n * map. See {@link prefixSentinel}.\n */\nconst postfixSentinel = (vendor?: string): string => `__${getVendorPrefix(vendor)}_postfix__`;\n\n/**\n * Returns the sentinel key used to store the selected prefix `value` for the affixed\n * field addressed by `identifier`. The vendor namespace controls the runtime string\n * so consumers overriding `vendor` do not conflict with the SDK default.\n */\nexport const affixPrefixKey = (identifier: string, vendor?: string): string => `${prefixSentinel(vendor)}${identifier}`;\n\n/**\n * Returns the sentinel key used to store the postfix `value` for the affixed field\n * addressed by `identifier`. See {@link affixPrefixKey}.\n */\nexport const affixPostfixKey = (identifier: string, vendor?: string): string =>\n `${postfixSentinel(vendor)}${identifier}`;\n\n/**\n * Rewrites `formData` (returns a new object) so that any affixed-input identifier\n * tracked by matching sentinel prefix/postfix keys is replaced with its composed\n * form `${prefix}${typed}${postfix}`. Sentinel keys are stripped from the result.\n *\n * Behaviour:\n * - Prefix present, postfix present → `prefix + typed + postfix`.\n * - Only prefix present → `prefix + typed`.\n * - Only postfix present → `typed + postfix`.\n * - Both empty / typed empty → the identifier is left untouched.\n * - No sentinel keys → returns a shallow copy of `formData` unchanged.\n *\n * The input object is not mutated. This is component-type agnostic: any field carrying\n * matching sentinel keys is composed, regardless of whether it originated from a\n * TEXT_INPUT, EMAIL_INPUT, PASSWORD_INPUT, or PHONE_INPUT.\n *\n * @param formData - The current form values map (values indexed by field identifier).\n * @param vendor - The vendor namespace configured on the SDK client, if any. Sentinel\n * keys are resolved through this namespace so composition ignores unrelated keys\n * written by other vendors when multiple SDK instances share a form.\n */\nconst composeAffixedInputs = (formData: Record<string, string>, vendor?: string): Record<string, string> => {\n const composed: Record<string, string> = {...formData};\n const prefixTag: string = prefixSentinel(vendor);\n const postfixTag: string = postfixSentinel(vendor);\n\n for (const key of Object.keys(formData)) {\n if (!key.startsWith(prefixTag) && !key.startsWith(postfixTag)) {\n continue;\n }\n\n const identifier: string = key.startsWith(prefixTag) ? key.slice(prefixTag.length) : key.slice(postfixTag.length);\n\n const typed: string = composed[identifier] ?? '';\n if (typed === '') {\n // Preserve emptiness — required-field checks are the caller's responsibility.\n delete composed[affixPrefixKey(identifier, vendor)];\n delete composed[affixPostfixKey(identifier, vendor)];\n continue;\n }\n\n const prefix: string = composed[affixPrefixKey(identifier, vendor)] ?? '';\n const postfix: string = composed[affixPostfixKey(identifier, vendor)] ?? '';\n\n composed[identifier] = `${prefix}${typed}${postfix}`;\n delete composed[affixPrefixKey(identifier, vendor)];\n delete composed[affixPostfixKey(identifier, vendor)];\n }\n\n return composed;\n};\n\nexport default composeAffixedInputs;\n"],"mappings":";;;;;;;;;;AAyBA,MAAM,kBAAkB,WAA4B,8CAAqB,OAAO,CAAC;;;;;AAMjF,MAAM,mBAAmB,WAA4B,8CAAqB,OAAO,CAAC;;;;;;AAOlF,MAAa,kBAAkB,YAAoB,WAA4B,GAAG,eAAe,OAAO,GAAG;;;;;AAM3G,MAAa,mBAAmB,YAAoB,WAClD,GAAG,gBAAgB,OAAO,GAAG;;;;;;;;;;;;;;;;;;;;;;AAuB/B,MAAM,wBAAwB,UAAkC,WAA4C;CAC1G,MAAMA,WAAmC,EAAC,GAAG,UAAS;CACtD,MAAMC,YAAoB,eAAe,OAAO;CAChD,MAAMC,aAAqB,gBAAgB,OAAO;AAElD,MAAK,MAAM,OAAO,OAAO,KAAK,SAAS,EAAE;AACvC,MAAI,CAAC,IAAI,WAAW,UAAU,IAAI,CAAC,IAAI,WAAW,WAAW,CAC3D;EAGF,MAAMC,aAAqB,IAAI,WAAW,UAAU,GAAG,IAAI,MAAM,UAAU,OAAO,GAAG,IAAI,MAAM,WAAW,OAAO;EAEjH,MAAMC,QAAgB,SAAS,eAAe;AAC9C,MAAI,UAAU,IAAI;AAEhB,UAAO,SAAS,eAAe,YAAY,OAAO;AAClD,UAAO,SAAS,gBAAgB,YAAY,OAAO;AACnD;;AAMF,WAAS,cAAc,GAHA,SAAS,eAAe,YAAY,OAAO,KAAK,KAGpC,QAFX,SAAS,gBAAgB,YAAY,OAAO,KAAK;AAGzE,SAAO,SAAS,eAAe,YAAY,OAAO;AAClD,SAAO,SAAS,gBAAgB,YAAY,OAAO;;AAGrD,QAAO;;AAGT,mCAAe"}
@@ -17,25 +17,6 @@
17
17
  */
18
18
  import { User, Preferences } from '@thunderid/browser';
19
19
  import { FC, ReactElement } from 'react';
20
- interface ExtendedFlatSchema {
21
- path?: string;
22
- schemaId?: string;
23
- }
24
- interface Schema extends ExtendedFlatSchema {
25
- caseExact?: boolean;
26
- description?: string;
27
- displayName?: string;
28
- displayOrder?: string;
29
- multiValued?: boolean;
30
- mutability?: string;
31
- name?: string;
32
- required?: boolean;
33
- returned?: string;
34
- subAttributes?: Schema[];
35
- type?: string;
36
- uniqueness?: string;
37
- value?: any;
38
- }
39
20
  export interface BaseUserProfileProps {
40
21
  attributeMapping?: {
41
22
  [key: string]: string | string[] | undefined;
@@ -64,7 +45,6 @@ export interface BaseUserProfileProps {
64
45
  */
65
46
  preferences?: Preferences;
66
47
  profile?: User;
67
- schemas?: Schema[];
68
48
  showFields?: string[];
69
49
  title?: string;
70
50
  }
@@ -1 +1 @@
1
- {"version":3,"file":"BaseUserProfile.d.ts","sourceRoot":"","sources":["../../../../src/components/presentation/UserProfile/BaseUserProfile.tsx"],"names":[],"mappings":"AAAA;;;;;;;;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G,MAAM,EAAE,CAAC;QAC9B,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAC7B,OAAO,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;QAC5B,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,EAAE,CAAC;KAC9B,CAAC;IACF,UAAU,CAAC,EAAE,OAAO,CAAC;IACrB,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,qBAAqB,CAAC,EAAE,MAAM,EAAE,CAAC;IACjC,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAC;IACtB,QAAQ,CAAC,EAAE,YAAY,GAAG,IAAI,CAAC;IAC/B,gBAAgB,CAAC,EAAE,IAAI,CAAC;IACxB,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IACtB,SAAS,CAAC,EAAE,OAAO,CAAC;IACpB,IAAI,CAAC,EAAE,QAAQ,GAAG,OAAO,CAAC;IAC1B,YAAY,CAAC,EAAE,CAAC,IAAI,EAAE,OAAO,KAAK,IAAI,CAAC;IACvC,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,GAAG,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;IAC3C,IAAI,CAAC,EAAE,OAAO,CAAC;IACf;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAC1B,OAAO,CAAC,EAAE,IAAI,CAAC;IACf,UAAU,CAAC,EAAE,MAAM,EAAE,CAAC;IAEtB,KAAK,CAAC,EAAE,MAAM,CAAC;CAChB;AA+BD,QAAA,MAAM,eAAe,EAAE,EAAE,CAAC,oBAAoB,CAwkB7C,CAAC;AAEF,eAAe,eAAe,CAAC"}
@@ -14,8 +14,8 @@ import getDisplayName_default from "../../../utils/getDisplayName.js";
14
14
  import { Avatar } from "../../primitives/Avatar/Avatar.js";
15
15
  import Dialog_default from "../../primitives/Dialog/Dialog.js";
16
16
  import MultiInput_default from "../../primitives/MultiInput/MultiInput.js";
17
- import { WellKnownSchemaIds, bem, withVendorCSSClassPrefix } from "@thunderid/browser";
18
- import { useCallback, useState } from "react";
17
+ import { bem, startCase, withVendorCSSClassPrefix } from "@thunderid/browser";
18
+ import { useCallback, useEffect, useState } from "react";
19
19
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
20
20
  import { cx } from "@emotion/css";
21
21
 
@@ -38,18 +38,40 @@ const fieldsToSkip = [
38
38
  "verifiedEmailAddresses",
39
39
  "phoneNumbers.mobile",
40
40
  "emailAddresses",
41
- "preferredMFAOption"
41
+ "preferredMFAOption",
42
+ "attributes",
43
+ "picture",
44
+ "isReadOnly",
45
+ "isReadonly"
42
46
  ];
43
47
  const readonlyFields = [
44
- "username",
45
- "userName",
46
- "user_name"
48
+ "attributes",
49
+ "id",
50
+ "isReadOnly",
51
+ "ouId",
52
+ "username"
47
53
  ];
48
- const BaseUserProfile = ({ fallback = null, className = "", cardLayout = true, profile, schemas = [], flattenedProfile, mode = "inline", title, attributeMapping = {}, editable = true, onOpenChange, onUpdate, open = false, error = null, isLoading = false, preferences, showFields = [], hideFields = [], displayNameAttributes = [] }) => {
54
+ const BaseUserProfile = ({ fallback = null, className = "", cardLayout = true, profile, flattenedProfile, mode = "inline", title, attributeMapping = {}, editable = true, onOpenChange, onUpdate, open = false, error = null, isLoading = false, preferences, showFields = [], hideFields = [], displayNameAttributes = [] }) => {
49
55
  const { theme, colorScheme } = useTheme_default();
50
56
  const [editedUser, setEditedUser] = useState(flattenedProfile || profile);
51
57
  const [editingFields, setEditingFields] = useState({});
52
58
  const { t } = useTranslation_default(preferences?.i18n);
59
+ useEffect(() => {
60
+ const nextUser = flattenedProfile ?? profile;
61
+ if (!nextUser) return;
62
+ setEditedUser((prev) => {
63
+ if (!prev) return nextUser;
64
+ const updated = { ...nextUser };
65
+ Object.keys(prev).forEach((key) => {
66
+ if (editingFields[key]) updated[key] = prev[key];
67
+ });
68
+ return updated;
69
+ });
70
+ }, [
71
+ flattenedProfile,
72
+ profile,
73
+ editingFields
74
+ ]);
53
75
  /**
54
76
  * Determines if a field should be visible based on showFields, hideFields, and fieldsToSkip arrays.
55
77
  * Priority order:
@@ -127,8 +149,7 @@ const BaseUserProfile = ({ fallback = null, className = "", cardLayout = true, p
127
149
  else fieldValue = "";
128
150
  if (Array.isArray(fieldValue)) fieldValue = fieldValue.filter((v) => v !== void 0 && v !== null && v !== "");
129
151
  let payload = {};
130
- if (schema.schemaId && schema.schemaId !== WellKnownSchemaIds.User) payload = { [schema.schemaId]: { [fieldName]: fieldValue } };
131
- else set(payload, fieldName, fieldValue);
152
+ set(payload, fieldName, fieldValue);
132
153
  onUpdate(payload);
133
154
  toggleFieldEdit(fieldName);
134
155
  }, [
@@ -169,7 +190,7 @@ const BaseUserProfile = ({ fallback = null, className = "", cardLayout = true, p
169
190
  const renderSchemaField = (schema, isEditing, onEditValue, onStartEdit) => {
170
191
  if (!schema) return null;
171
192
  const { value, displayName, description, name, type, required, mutability, subAttributes, multiValued } = schema;
172
- const label = displayName || description || name || "";
193
+ const label = displayName || description || (name ? startCase(name) : "");
173
194
  if (subAttributes && Array.isArray(subAttributes)) return /* @__PURE__ */ jsx(Fragment, { children: subAttributes.map((subAttr, index) => {
174
195
  let displayValue$1;
175
196
  if (Array.isArray(subAttr.value)) displayValue$1 = subAttr.value.map((item) => typeof item === "object" ? JSON.stringify(item) : String(item)).join(", ");
@@ -383,60 +404,29 @@ const BaseUserProfile = ({ fallback = null, className = "", cardLayout = true, p
383
404
  ]
384
405
  }),
385
406
  /* @__PURE__ */ jsx(Divider_default, {}),
386
- profileEntries.map(([key, value], index) => /* @__PURE__ */ jsxs("div", { children: [/* @__PURE__ */ jsxs("div", {
387
- className: styles.sectionRow,
388
- children: [/* @__PURE__ */ jsx("div", {
389
- className: styles.sectionLabel,
390
- children: formatLabel(key)
391
- }), /* @__PURE__ */ jsx("div", {
392
- className: styles.sectionValue,
393
- children: typeof value === "object" ? /* @__PURE__ */ jsx(ObjectDisplay, { data: value }) : String(value)
394
- })]
395
- }), index < profileEntries.length - 1 && /* @__PURE__ */ jsx(Divider_default, {})] }, key))
407
+ profileEntries.map(([key, value]) => {
408
+ const schemaWithValue = {
409
+ name: key,
410
+ mutability: readonlyFields.includes(key) ? "READ_ONLY" : "READ_WRITE",
411
+ value
412
+ };
413
+ return /* @__PURE__ */ jsx("div", {
414
+ className: styles.info,
415
+ children: renderUserInfo(schemaWithValue)
416
+ }, key);
417
+ })
396
418
  ] });
397
419
  };
398
420
  const profileContent = /* @__PURE__ */ jsxs(Card_default, {
399
421
  className: containerClasses,
400
- children: [
401
- error && /* @__PURE__ */ jsxs(Alert_default, {
402
- variant: "error",
403
- className: cx(withVendorCSSClassPrefix(bem("user-profile", "alert")), styles.alert),
404
- children: [/* @__PURE__ */ jsx(Alert_default.Title, { children: t("errors.heading") || "Error" }), /* @__PURE__ */ jsx(Alert_default.Description, { children: error })]
405
- }),
406
- schemas && schemas.length > 0 && /* @__PURE__ */ jsx("div", {
407
- className: styles.header,
408
- children: /* @__PURE__ */ jsx(Avatar, {
409
- imageUrl: getMappedUserProfileValue_default("picture", mergedMappings, currentUser),
410
- name: getDisplayName_default(mergedMappings, profile),
411
- size: 80,
412
- alt: `${getDisplayName_default(mergedMappings, profile)}'s avatar`,
413
- isLoading
414
- })
415
- }),
416
- /* @__PURE__ */ jsx("div", {
417
- className: styles.infoContainer,
418
- children: schemas && schemas.length > 0 ? schemas.filter((schema) => {
419
- if (!schema.name || !shouldShowField(schema.name)) return false;
420
- if (!editable) {
421
- const value = flattenedProfile && schema.name ? flattenedProfile[schema.name] : void 0;
422
- return value !== void 0 && value !== "" && value !== null;
423
- }
424
- return true;
425
- }).sort((a, b) => {
426
- return (a.displayOrder ? parseInt(a.displayOrder, 10) : 999) - (b.displayOrder ? parseInt(b.displayOrder, 10) : 999);
427
- }).map((schema, index) => {
428
- const value = flattenedProfile && schema.name ? flattenedProfile[schema.name] : void 0;
429
- const schemaWithValue = {
430
- ...schema,
431
- value
432
- };
433
- return /* @__PURE__ */ jsx("div", {
434
- className: styles.info,
435
- children: renderUserInfo(schemaWithValue)
436
- }, schema.name || index);
437
- }) : renderProfileWithoutSchemas()
438
- })
439
- ]
422
+ children: [error && /* @__PURE__ */ jsxs(Alert_default, {
423
+ variant: "error",
424
+ className: cx(withVendorCSSClassPrefix(bem("user-profile", "alert")), styles.alert),
425
+ children: [/* @__PURE__ */ jsx(Alert_default.Title, { children: t("errors.heading") || "Error" }), /* @__PURE__ */ jsx(Alert_default.Description, { children: error })]
426
+ }), /* @__PURE__ */ jsx("div", {
427
+ className: styles.infoContainer,
428
+ children: renderProfileWithoutSchemas()
429
+ })]
440
430
  });
441
431
  if (mode === "popup") return /* @__PURE__ */ jsx(Dialog_default, {
442
432
  open,