@thunderid/react 0.3.6 → 0.4.0
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.
- package/dist/ThunderIDReactClient.d.ts.map +1 -1
- package/dist/ThunderIDReactClient.js +1 -5
- package/dist/ThunderIDReactClient.js.map +1 -1
- package/dist/cjs/ThunderIDReactClient.cjs +1 -5
- package/dist/cjs/ThunderIDReactClient.cjs.map +1 -1
- package/dist/cjs/components/factories/FieldFactory.cjs +2 -1
- package/dist/cjs/components/factories/FieldFactory.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.cjs +1 -1
- package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs +56 -33
- package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.cjs +1 -1
- package/dist/cjs/components/presentation/auth/Recovery/BaseRecovery.cjs +1 -1
- package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs +8 -32
- package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/SignIn/SignIn.cjs +37 -27
- package/dist/cjs/components/presentation/auth/SignIn/SignIn.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs +7 -3
- package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs.map +1 -1
- package/dist/cjs/components/primitives/FormControl/FormControl.cjs +2 -1
- package/dist/cjs/components/primitives/FormControl/FormControl.cjs.map +1 -1
- package/dist/cjs/components/primitives/Typography/Typography.cjs.map +1 -1
- package/dist/cjs/contexts/FlowMeta/FlowMetaProvider.cjs +11 -3
- package/dist/cjs/contexts/FlowMeta/FlowMetaProvider.cjs.map +1 -1
- package/dist/cjs/index.cjs +3 -0
- package/dist/components/factories/FieldFactory.d.ts +4 -0
- package/dist/components/factories/FieldFactory.d.ts.map +1 -1
- package/dist/components/factories/FieldFactory.js +2 -1
- package/dist/components/factories/FieldFactory.js.map +1 -1
- package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.js +1 -1
- package/dist/components/presentation/auth/AuthOptionFactory.d.ts.map +1 -1
- package/dist/components/presentation/auth/AuthOptionFactory.js +57 -34
- package/dist/components/presentation/auth/AuthOptionFactory.js.map +1 -1
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.js +1 -1
- package/dist/components/presentation/auth/Recovery/BaseRecovery.js +1 -1
- package/dist/components/presentation/auth/SignIn/BaseSignIn.d.ts +5 -6
- package/dist/components/presentation/auth/SignIn/BaseSignIn.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignIn/BaseSignIn.js +10 -34
- package/dist/components/presentation/auth/SignIn/BaseSignIn.js.map +1 -1
- package/dist/components/presentation/auth/SignIn/SignIn.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignIn/SignIn.js +37 -27
- package/dist/components/presentation/auth/SignIn/SignIn.js.map +1 -1
- package/dist/components/presentation/auth/SignUp/BaseSignUp.d.ts +4 -0
- package/dist/components/presentation/auth/SignUp/BaseSignUp.d.ts.map +1 -1
- package/dist/components/presentation/auth/SignUp/BaseSignUp.js +8 -4
- package/dist/components/presentation/auth/SignUp/BaseSignUp.js.map +1 -1
- package/dist/components/primitives/FormControl/FormControl.d.ts +4 -0
- package/dist/components/primitives/FormControl/FormControl.d.ts.map +1 -1
- package/dist/components/primitives/FormControl/FormControl.js +2 -1
- package/dist/components/primitives/FormControl/FormControl.js.map +1 -1
- package/dist/components/primitives/Typography/Typography.d.ts +4 -0
- package/dist/components/primitives/Typography/Typography.d.ts.map +1 -1
- package/dist/components/primitives/Typography/Typography.js.map +1 -1
- package/dist/contexts/FlowMeta/FlowMetaProvider.d.ts +8 -0
- package/dist/contexts/FlowMeta/FlowMetaProvider.d.ts.map +1 -1
- package/dist/contexts/FlowMeta/FlowMetaProvider.js +11 -3
- package/dist/contexts/FlowMeta/FlowMetaProvider.js.map +1 -1
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +2 -1
- package/package.json +2 -2
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseSignUp.js","names":["logger: ReturnType<typeof createPackageComponentLogger>","BaseSignUpContent: FC<BaseSignUpProps>","useTheme","customRenderers: ComponentRendererMap","ComponentRendererContext","useTranslation","useFlow","useThunderID","styles: any","useStyles","challengeTokenRef: any","initializationAttemptedRef: any","passkeyProcessedRef: any","tempData: any","storageManager: any","handleError: any","errorMessage: string","normalizeFlowResponseLocal: any","extractFormFields: any","fields: FormField[]","fieldName: any","responseFieldErrors: FieldError[] | undefined","errors: Record<string, string>","setupFormFields: any","fields: any","initialValues: Record<string, string>","data: any","components: unknown[] | undefined","normalized: any","redirectUrl: any","popup: any","hasProcessedCallback: any","popupMonitor: ReturnType<typeof setInterval> | null","messageHandler: ((event: MessageEvent) => Promise<void>) | null","expectedOrigin: any","payload: EmbeddedSignUpFlowRequest","continueResponse: any","normalizedContinueResponse: any","popupUrl: any","url: any","code: any","state: any","filteredInputs: Record<string, any>","response: any","effectiveExecutionIdForPasskey: any","passkeyResponse: any","passkeyResponseObj: any","inputs: any","processedResponse: any","containerClasses: any","inputClasses: any","buttonClasses: any","errorClasses: any","messageClasses: any","renderComponents: any","urlParams: any","payload: any","url: URL","result: any","CardPrimitive","Spinner","AlertPrimitive","getAuthComponentHeadings","Typography","BaseSignUp: FC<BaseSignUpProps>","content: ReactElement","Logo","FlowProvider","ComponentPreferencesContext"],"sources":["../../../../../src/components/presentation/auth/SignUp/BaseSignUp.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 {cx} from '@emotion/css';\nimport {\n EmbeddedSignUpFlowRequest,\n EmbeddedSignUpFlowResponse,\n EmbeddedSignUpFlowStatus,\n EmbeddedSignUpFlowType,\n withVendorCSSClassPrefix,\n EmbeddedFlowComponentType,\n FieldError,\n createPackageComponentLogger,\n buildValidatorFromRules,\n Preferences,\n} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode, useCallback, useContext, useEffect, useRef, useState} from 'react';\nimport useStyles from './BaseSignUp.styles';\nimport ComponentRendererContext, {\n ComponentRendererMap,\n} from '../../../../contexts/ComponentRenderer/ComponentRendererContext';\nimport FlowProvider from '../../../../contexts/Flow/FlowProvider';\nimport useFlow from '../../../../contexts/Flow/useFlow';\nimport ComponentPreferencesContext from '../../../../contexts/I18n/ComponentPreferencesContext';\nimport useTheme from '../../../../contexts/Theme/useTheme';\nimport useThunderID from '../../../../contexts/ThunderID/useThunderID';\nimport {useForm, FormField} from '../../../../hooks/useForm';\nimport useTranslation from '../../../../hooks/useTranslation';\nimport {normalizeFlowResponse, extractErrorMessage} from '../../../../utils/flowTransformer';\nimport getAuthComponentHeadings from '../../../../utils/getAuthComponentHeadings';\nimport {handlePasskeyRegistration} from '../../../../utils/passkey';\nimport AlertPrimitive from '../../../primitives/Alert/Alert';\n// eslint-disable-next-line import/no-named-as-default\nimport CardPrimitive, {CardProps} from '../../../primitives/Card/Card';\nimport Logo from '../../../primitives/Logo/Logo';\nimport Spinner from '../../../primitives/Spinner/Spinner';\nimport Typography from '../../../primitives/Typography/Typography';\nimport {renderSignUpComponents} from '../AuthOptionFactory';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/react',\n 'BaseSignUp',\n);\n\n/**\n * State for tracking passkey registration\n */\ninterface PasskeyState {\n actionId: string | null;\n creationOptions: string | null;\n error: Error | null;\n executionId: string | null;\n isActive: boolean;\n}\n\n/**\n * Render props for custom UI rendering\n */\nexport interface BaseSignUpRenderProps {\n /**\n * Flow components\n */\n components: any[];\n\n /**\n * API error (if any)\n */\n error?: Error | null;\n\n /**\n * Field validation errors\n */\n fieldErrors: Record<string, string>;\n\n /**\n * Function to handle input changes\n */\n handleInputChange: (name: string, value: string) => void;\n\n /**\n * Function to handle form submission\n */\n handleSubmit: (component: any, data?: Record<string, any>) => Promise<void>;\n\n /**\n * Loading state\n */\n isLoading: boolean;\n\n /**\n * Whether the form is valid\n */\n isValid: boolean;\n\n /**\n * Flow messages\n */\n messages: {message: string; type: string}[];\n\n /**\n * Flow subtitle\n */\n subtitle: string;\n\n /**\n * Flow title\n */\n title: string;\n\n /**\n * Touched fields\n */\n touched: Record<string, boolean>;\n\n /**\n * Function to validate the form\n */\n validateForm: () => {fieldErrors: Record<string, string>; isValid: boolean};\n\n /**\n * Form values\n */\n values: Record<string, string>;\n}\n\n/**\n * Props for the BaseSignUp component.\n */\nexport interface BaseSignUpProps {\n /**\n * URL to redirect after successful sign-up.\n */\n afterSignUpUrl?: string;\n\n /**\n * Custom CSS class name for the submit button.\n */\n buttonClassName?: string;\n\n /**\n * Render props function for custom UI\n */\n children?: (props: BaseSignUpRenderProps) => ReactNode;\n\n /**\n * Custom CSS class name for the form container.\n */\n className?: string;\n\n /**\n * Error object to display\n */\n error?: Error | null;\n\n /**\n * Custom CSS class name for error messages.\n */\n errorClassName?: string;\n\n /**\n * Custom CSS class name for form inputs.\n */\n inputClassName?: string;\n\n isInitialized?: boolean;\n\n /**\n * Custom CSS class name for info messages.\n */\n messageClassName?: string;\n\n /**\n * Callback function called when the sign-up flow completes and requires redirection.\n * This allows platform-specific handling of redirects (e.g., Next.js router.push).\n * @param response - The response from the sign-up flow containing the redirect URL, etc.\n */\n onComplete?: (response: EmbeddedSignUpFlowResponse) => void;\n\n /**\n * Callback function called when sign-up fails.\n * @param error - The error that occurred during sign-up.\n */\n onError?: (error: Error) => void;\n\n /**\n * Callback function called when sign-up flow status changes.\n * @param response - The current sign-up response.\n */\n onFlowChange?: (response: EmbeddedSignUpFlowResponse) => void;\n\n /**\n * Function to initialize sign-up flow.\n * @returns Promise resolving to the initial sign-up response.\n */\n onInitialize?: (payload?: EmbeddedSignUpFlowRequest) => Promise<EmbeddedSignUpFlowResponse>;\n\n /**\n * Function to handle sign-up steps.\n * @param payload - The sign-up payload.\n * @returns Promise resolving to the sign-up response.\n */\n onSubmit?: (payload: EmbeddedSignUpFlowRequest) => Promise<EmbeddedSignUpFlowResponse>;\n /**\n * Component-level preferences to override global i18n and theme settings.\n * Preferences are deep-merged with global ones, with component preferences\n * taking precedence. Affects this component and all its descendants.\n */\n preferences?: Preferences;\n\n /**\n * Whether to redirect after sign-up.\n */\n shouldRedirectAfterSignUp?: boolean;\n\n /**\n * Whether to show the logo.\n */\n showLogo?: boolean;\n\n /**\n * Whether to show the subtitle.\n */\n showSubtitle?: boolean;\n\n /**\n * Whether to show the title.\n */\n showTitle?: boolean;\n\n /**\n * Size variant for the component.\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Theme variant for the component.\n */\n variant?: CardProps['variant'];\n}\n\n/**\n * Internal component that consumes FlowContext and renders the sign-up UI.\n */\nconst BaseSignUpContent: FC<BaseSignUpProps> = ({\n afterSignUpUrl,\n onInitialize,\n onSubmit,\n onError,\n onFlowChange,\n onComplete,\n error: externalError,\n className = '',\n inputClassName = '',\n buttonClassName = '',\n errorClassName = '',\n messageClassName = '',\n size = 'medium',\n variant = 'outlined',\n isInitialized,\n children,\n showTitle = true,\n showSubtitle = true,\n}: BaseSignUpProps): ReactElement => {\n const {theme, colorScheme} = useTheme();\n const customRenderers: ComponentRendererMap = useContext(ComponentRendererContext);\n const {t} = useTranslation();\n const {subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages} = useFlow();\n const {meta, isInitialized: isSdkInitialized, getStorageManager} = useThunderID();\n const styles: any = useStyles(theme, colorScheme);\n\n const [isLoading, setIsLoading] = useState(false);\n const [isFlowInitialized, setIsFlowInitialized] = useState(false);\n const [currentFlow, setCurrentFlow] = useState<EmbeddedSignUpFlowResponse | null>(null);\n const [apiError, setApiError] = useState<Error | null>(null);\n const [isStorageReady, setIsStorageReady] = useState(false);\n const [passkeyState, setPasskeyState] = useState<PasskeyState>({\n actionId: null,\n creationOptions: null,\n error: null,\n executionId: null,\n isActive: false,\n });\n const challengeTokenRef: any = useRef<string | null>(null);\n\n const initializationAttemptedRef: any = useRef(false);\n const passkeyProcessedRef: any = useRef(false);\n\n /**\n * Restore any challenge token persisted before an OAuth redirect.\n */\n useEffect(() => {\n if (!isSdkInitialized) return;\n\n (async (): Promise<void> => {\n try {\n const storageManager: any = await getStorageManager();\n const tempData: any = await storageManager?.getTemporaryData();\n if (tempData?.challengeToken) {\n challengeTokenRef.current = tempData.challengeToken as string;\n }\n } catch {\n // StorageManager unavailable — continue without persisted token\n } finally {\n setIsStorageReady(true);\n }\n })();\n }, [isSdkInitialized]);\n\n /**\n * Updates challengeTokenRef immediately (stale-closure safe) and persists via\n * the provider's StorageManager so the token survives OAuth redirects.\n */\n const setChallengeToken = async (challengeToken: string | null): Promise<void> => {\n challengeTokenRef.current = challengeToken;\n try {\n const storageManager: any = await getStorageManager();\n if (storageManager) {\n if (challengeToken) {\n await storageManager.setTemporaryDataParameter('challengeToken', challengeToken);\n } else {\n await storageManager.removeTemporaryDataParameter('challengeToken');\n }\n }\n } catch {\n logger.warn('Failed to persist challenge token in storage.');\n }\n };\n\n /**\n * Handle error responses and extract meaningful error messages\n * Uses the transformer's extractErrorMessage function.\n */\n const handleError: any = useCallback(\n (error: any) => {\n const errorMessage: string = extractErrorMessage(error, t);\n\n // Set the API error state\n setApiError(error instanceof Error ? error : new Error(errorMessage));\n\n // Clear existing messages and add the error message\n clearMessages();\n addMessage({\n message: errorMessage,\n type: 'error',\n });\n },\n [t, addMessage, clearMessages],\n );\n\n /**\n * Normalize flow response to ensure component-driven format\n * Uses normalizeFlowResponse for modern API format responses\n */\n const normalizeFlowResponseLocal: any = useCallback(\n (response: EmbeddedSignUpFlowResponse): EmbeddedSignUpFlowResponse => {\n if (response?.data) {\n const {components} = normalizeFlowResponse(\n response,\n t,\n {\n defaultErrorKey: 'components.signUp.errors.generic',\n resolveTranslations: false,\n },\n meta,\n );\n\n return {\n ...response,\n data: {\n ...(response.data as any),\n components,\n },\n } as EmbeddedSignUpFlowResponse;\n }\n\n return response;\n },\n [t, children],\n );\n\n /**\n * Extract form fields from flow components\n */\n const extractFormFields: any = useCallback(\n (components: any[]): FormField[] => {\n const fields: FormField[] = [];\n\n const processComponents = (comps: any[]): any => {\n comps.forEach((component: any) => {\n if (\n component.type === EmbeddedFlowComponentType.TextInput ||\n component.type === EmbeddedFlowComponentType.PasswordInput ||\n component.type === EmbeddedFlowComponentType.EmailInput ||\n component.type === EmbeddedFlowComponentType.Select ||\n component.type === EmbeddedFlowComponentType.DateInput\n ) {\n // Use component.ref (mapped identifier) as the field name instead of component.id\n // This ensures form field names match what the input components use\n const fieldName: any = component.ref || component.id;\n const ruleValidator = buildValidatorFromRules(component.validation);\n\n fields.push({\n initialValue: '',\n name: fieldName,\n required: component.required || false,\n validator: (value: string) => {\n if (component.required && (!value || value.trim() === '')) {\n return t('validations.required.field.error');\n }\n // Add email validation if it's an email field\n if (\n (component.type === EmbeddedFlowComponentType.EmailInput || component.variant === 'EMAIL') &&\n value &&\n !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value)\n ) {\n return t('field.email.invalid');\n }\n // Evaluate declarative validation rules from meta.components[].validation.\n if (ruleValidator && value) {\n const ruleMessage = ruleValidator(value);\n if (ruleMessage) {\n return t(ruleMessage);\n }\n }\n\n return null;\n },\n });\n }\n\n if (component.components && Array.isArray(component.components)) {\n processComponents(component.components);\n }\n });\n };\n\n processComponents(components);\n return fields;\n },\n [t],\n );\n\n const formFields: any = (currentFlow?.data as any)?.components\n ? extractFormFields((currentFlow!.data as any).components)\n : [];\n\n const form: any = useForm<Record<string, string>>({\n fields: formFields,\n initialValues: {},\n requiredMessage: t('validations.required.field.error'),\n validateOnBlur: true,\n validateOnChange: false,\n });\n\n const {\n values: formValues,\n touched: touchedFields,\n errors: formErrors,\n isValid: isFormValid,\n setValue: setFormValue,\n setTouched: setFormTouched,\n setErrors: setFormErrors,\n clearErrors: clearFormErrors,\n validateForm,\n touchAllFields,\n reset: resetForm,\n } = form;\n\n /**\n * Project server-side validation errors from the most recent flow response into the\n * form's `errors` state. See BaseSignIn for the same pattern: first error per field\n * wins, and the affected fields are marked touched so the error renders immediately.\n */\n useEffect(() => {\n clearFormErrors();\n const responseFieldErrors: FieldError[] | undefined = (currentFlow?.data as any)?.fieldErrors;\n if (!responseFieldErrors || responseFieldErrors.length === 0) {\n return;\n }\n const errors: Record<string, string> = {};\n for (const fe of responseFieldErrors) {\n if (!(fe.identifier in errors)) {\n errors[fe.identifier] = fe.message;\n }\n }\n setFormErrors(errors);\n Object.keys(errors).forEach((field: string) => setFormTouched(field, true));\n }, [currentFlow, setFormErrors, setFormTouched, clearFormErrors]);\n\n /**\n * Setup form fields based on the current flow.\n */\n const setupFormFields: any = useCallback(\n (flowResponse: EmbeddedSignUpFlowResponse) => {\n const fields: any = extractFormFields((flowResponse.data as any)?.components || []);\n const initialValues: Record<string, string> = {};\n\n fields.forEach((field: any) => {\n initialValues[field.name] = field.initialValue || '';\n });\n\n resetForm();\n\n Object.keys(initialValues).forEach((key: any) => {\n setFormValue(key, initialValues[key]);\n });\n },\n [extractFormFields, resetForm, setFormValue],\n );\n\n /**\n * Determine whether a completed flow finished on a display-only screen.\n * Such a completion must be rendered, not redirected past.\n */\n const isDisplayOnlyCompletion = (response: EmbeddedSignUpFlowResponse): boolean => {\n const data: any = response?.data;\n const components: unknown[] | undefined = data?.components ?? data?.meta?.components;\n\n return (\n response?.flowStatus === EmbeddedSignUpFlowStatus.Complete &&\n Array.isArray(components) &&\n components.length > 0 &&\n !(response as {assertion?: string})?.assertion &&\n !data?.redirectURL &&\n !(response as any)?.redirectUrl\n );\n };\n\n /**\n * Handle a completed flow. A flow can complete on a display-only screen; in\n * that case render the screen and skip onComplete so the wrapper does not\n * immediately redirect away from it. Otherwise hand off to onComplete.\n */\n const handleFlowCompletion = (response: EmbeddedSignUpFlowResponse): void => {\n if (isDisplayOnlyCompletion(response)) {\n const normalized: any = normalizeFlowResponseLocal(response);\n setCurrentFlow(normalized);\n setupFormFields(normalized);\n return;\n }\n\n onComplete?.(response);\n };\n\n /**\n * Handle input value changes.\n * Only updates the value without marking as touched.\n * Touched state is set on blur to avoid premature validation.\n */\n const handleInputChange = (name: string, value: string): void => {\n setFormValue(name, value);\n };\n\n /**\n * Handle input blur event.\n * Marks the field as touched, which triggers validation.\n */\n const handleInputBlur = (name: string): void => {\n setFormTouched(name, true);\n };\n\n /**\n * Check if the response contains a redirection URL and perform the redirect if necessary.\n * @param response - The sign-up response\n * @returns true if a redirect was performed, false otherwise\n */\n const handleRedirectionIfNeeded = (response: EmbeddedSignUpFlowResponse): boolean => {\n if (response?.type === EmbeddedSignUpFlowType.Redirection && (response?.data as any)?.redirectURL) {\n /**\n * Open a popup window to handle redirection prompts for social sign-up\n */\n const redirectUrl: any = (response.data as any).redirectURL;\n const popup: any = window.open(redirectUrl, 'oauth_popup', 'width=500,height=600,scrollbars=yes,resizable=yes');\n\n if (!popup) {\n logger.error('Failed to open popup window');\n return false;\n }\n\n let hasProcessedCallback: any = false; // Prevent multiple processing\n let popupMonitor: ReturnType<typeof setInterval> | null = null;\n let messageHandler: ((event: MessageEvent) => Promise<void>) | null = null;\n\n /**\n * Clean up event listener and popup monitor\n */\n const cleanup = (): void => {\n if (messageHandler) {\n window.removeEventListener('message', messageHandler);\n }\n if (popupMonitor) {\n clearInterval(popupMonitor);\n }\n };\n\n /**\n * Add an event listener to the window to capture the message from the popup\n */\n messageHandler = async function messageEventHandler(event: MessageEvent): Promise<void> {\n /**\n * Check if the message is from our popup window\n */\n if (event.source !== popup) {\n return;\n }\n\n /**\n * Check the origin of the message to ensure it's from a trusted source\n */\n const expectedOrigin: any = afterSignUpUrl ? new URL(afterSignUpUrl).origin : window.location.origin;\n if (event.origin !== expectedOrigin && event.origin !== window.location.origin) {\n return;\n }\n\n const {code, state} = event.data;\n\n if (code && state) {\n hasProcessedCallback = true;\n\n const payload: EmbeddedSignUpFlowRequest = {\n ...(currentFlow?.executionId && {executionId: currentFlow.executionId}),\n inputs: {\n code,\n state,\n },\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n };\n\n try {\n const continueResponse: any = await onSubmit!(payload);\n onFlowChange?.(continueResponse);\n\n if (continueResponse.flowStatus === EmbeddedSignUpFlowStatus.Error) {\n handleError(continueResponse);\n onError?.(continueResponse);\n } else if (continueResponse.flowStatus === EmbeddedSignUpFlowStatus.Complete) {\n handleFlowCompletion(continueResponse as EmbeddedSignUpFlowResponse);\n } else if (continueResponse.flowStatus === EmbeddedSignUpFlowStatus.Incomplete) {\n const normalizedContinueResponse: any = normalizeFlowResponseLocal(continueResponse);\n setCurrentFlow(normalizedContinueResponse);\n setupFormFields(normalizedContinueResponse);\n\n // Display error from INCOMPLETE response\n if (normalizedContinueResponse?.error) {\n handleError(normalizedContinueResponse);\n }\n }\n\n popup.close();\n cleanup();\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n popup.close();\n cleanup();\n }\n }\n };\n\n window.addEventListener('message', messageHandler);\n\n /**\n * Monitor popup for closure and URL changes\n */\n popupMonitor = setInterval(async () => {\n try {\n if (popup.closed) {\n cleanup();\n return;\n }\n\n // Skip if we've already processed a callback\n if (hasProcessedCallback) {\n return;\n }\n\n // Try to access popup URL to check for callback\n try {\n const popupUrl: any = popup.location.href;\n\n // Check if we've been redirected to the callback URL\n if (popupUrl && (popupUrl.includes('code=') || popupUrl.includes('error='))) {\n hasProcessedCallback = true; // Set flag to prevent multiple processing\n\n // Parse the URL for OAuth parameters\n const url: any = new URL(popupUrl);\n const code: any = url.searchParams.get('code');\n const state: any = url.searchParams.get('state');\n const error: any = url.searchParams.get('error');\n\n if (error) {\n logger.error('OAuth error:');\n popup.close();\n cleanup();\n return;\n }\n\n if (code && state) {\n const payload: EmbeddedSignUpFlowRequest = {\n ...(currentFlow?.executionId && {executionId: currentFlow.executionId}),\n inputs: {\n code,\n state,\n },\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n };\n\n try {\n const continueResponse: any = await onSubmit!(payload);\n onFlowChange?.(continueResponse);\n\n if (continueResponse.flowStatus === EmbeddedSignUpFlowStatus.Error) {\n handleError(continueResponse);\n onError?.(continueResponse);\n } else if (continueResponse.flowStatus === EmbeddedSignUpFlowStatus.Complete) {\n handleFlowCompletion(continueResponse as EmbeddedSignUpFlowResponse);\n } else if (continueResponse.flowStatus === EmbeddedSignUpFlowStatus.Incomplete) {\n const normalizedContinueResponse: any = normalizeFlowResponseLocal(continueResponse);\n setCurrentFlow(normalizedContinueResponse);\n setupFormFields(normalizedContinueResponse);\n\n // Display error from INCOMPLETE response\n if (normalizedContinueResponse?.error) {\n handleError(normalizedContinueResponse);\n }\n }\n\n popup.close();\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n popup.close();\n }\n }\n }\n } catch (e) {\n // Cross-origin error is expected when popup navigates to OAuth provider\n // This is normal and we can ignore it\n }\n } catch (e) {\n logger.error('Error monitoring popup:');\n }\n }, 1000);\n\n return true;\n }\n\n return false;\n };\n\n /**\n * Handle component submission (for buttons outside forms).\n */\n const handleSubmit = async (component: any, data?: Record<string, any>, skipValidation?: boolean): Promise<void> => {\n if (!currentFlow) {\n return;\n }\n\n // Only validate for form submit actions, skip for social/trigger actions\n if (!skipValidation) {\n // Mark all fields as touched before validation\n touchAllFields();\n\n const validation: ReturnType<typeof validateForm> = validateForm();\n\n if (!validation.isValid) {\n return;\n }\n }\n\n setIsLoading(true);\n setApiError(null);\n clearMessages();\n\n try {\n // Filter out empty or undefined input values\n const filteredInputs: Record<string, any> = {};\n if (data) {\n Object.entries(data).forEach(([key, value]: [string, any]) => {\n if (value !== null && value !== undefined && value !== '') {\n filteredInputs[key] = value;\n }\n });\n }\n\n const payload: EmbeddedSignUpFlowRequest = {\n ...(currentFlow.executionId && {executionId: currentFlow.executionId}),\n ...(component.id && {action: component.id}),\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n inputs: filteredInputs,\n };\n\n const rawResponse: any = await onSubmit!(payload);\n const response: any = normalizeFlowResponseLocal(rawResponse);\n onFlowChange?.(response);\n\n await setChallengeToken(response.challengeToken ?? null);\n\n if (response.flowStatus === EmbeddedSignUpFlowStatus.Error) {\n handleError(response);\n onError?.(new Error(extractErrorMessage(response, t)));\n return;\n }\n\n if (response.flowStatus === EmbeddedSignUpFlowStatus.Complete) {\n handleFlowCompletion(response as EmbeddedSignUpFlowResponse);\n return;\n }\n\n if (response.flowStatus === EmbeddedSignUpFlowStatus.Incomplete) {\n if (handleRedirectionIfNeeded(response)) {\n return;\n }\n\n if (response.data?.additionalData?.passkeyCreationOptions) {\n const {passkeyCreationOptions}: any = response.data.additionalData;\n const effectiveExecutionIdForPasskey: any = response.executionId ?? currentFlow?.executionId;\n\n // Reset passkey processed ref to allow processing\n passkeyProcessedRef.current = false;\n\n // Set passkey state to trigger the passkey\n setPasskeyState({\n actionId: component.id || 'submit',\n creationOptions: passkeyCreationOptions,\n error: null,\n executionId: effectiveExecutionIdForPasskey,\n isActive: true,\n });\n setIsLoading(false);\n return;\n }\n setCurrentFlow(response);\n setupFormFields(response);\n\n // Display error from INCOMPLETE response\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (response?.error) {\n handleError(response);\n }\n }\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n } finally {\n setIsLoading(false);\n }\n };\n\n /**\n * Handle passkey registration when passkey state becomes active.\n * This effect auto-triggers the browser passkey popup and submits the result.\n */\n useEffect(() => {\n if (!passkeyState.isActive || !passkeyState.creationOptions || !passkeyState.executionId) {\n return;\n }\n\n // Prevent re-processing\n if (passkeyProcessedRef.current) {\n return;\n }\n passkeyProcessedRef.current = true;\n\n const performPasskeyRegistration = async (): Promise<void> => {\n const passkeyResponse: any = await handlePasskeyRegistration(passkeyState.creationOptions!);\n const passkeyResponseObj: any = JSON.parse(passkeyResponse);\n\n const inputs: any = {\n attestationObject: passkeyResponseObj.response.attestationObject,\n clientDataJSON: passkeyResponseObj.response.clientDataJSON,\n credentialId: passkeyResponseObj.id,\n };\n\n // After successful registration, submit the result to the server\n const payload: EmbeddedSignUpFlowRequest = {\n executionId: passkeyState.executionId ?? undefined,\n inputs,\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n } as any;\n\n const nextResponse: any = await onSubmit!(payload);\n const processedResponse: any = normalizeFlowResponseLocal(nextResponse);\n onFlowChange?.(processedResponse);\n\n if (processedResponse.flowStatus === EmbeddedSignUpFlowStatus.Complete) {\n handleFlowCompletion(processedResponse as EmbeddedSignUpFlowResponse);\n } else {\n setCurrentFlow(processedResponse);\n setupFormFields(processedResponse);\n }\n };\n\n performPasskeyRegistration()\n .then(() => {\n setPasskeyState({actionId: null, creationOptions: null, error: null, executionId: null, isActive: false});\n })\n .catch((error: any) => {\n setPasskeyState((prev: any) => ({...prev, error: error as Error, isActive: false}));\n handleError(error);\n onError?.(error as Error);\n });\n }, [passkeyState.isActive, passkeyState.creationOptions, passkeyState.executionId]);\n\n const containerClasses: any = cx(\n [\n withVendorCSSClassPrefix('signup'),\n withVendorCSSClassPrefix(`signup--${size}`),\n withVendorCSSClassPrefix(`signup--${variant}`),\n ],\n className,\n );\n\n const inputClasses: any = cx(\n [\n withVendorCSSClassPrefix('signup__input'),\n size === 'small' && withVendorCSSClassPrefix('signup__input--small'),\n size === 'large' && withVendorCSSClassPrefix('signup__input--large'),\n ],\n inputClassName,\n );\n\n const buttonClasses: any = cx(\n [\n withVendorCSSClassPrefix('signup__button'),\n size === 'small' && withVendorCSSClassPrefix('signup__button--small'),\n size === 'large' && withVendorCSSClassPrefix('signup__button--large'),\n ],\n buttonClassName,\n );\n\n const errorClasses: any = cx([withVendorCSSClassPrefix('signup__error')], errorClassName);\n\n const messageClasses: any = cx([withVendorCSSClassPrefix('signup__messages')], messageClassName);\n\n /**\n * Render form components based on flow data using the factory\n */\n const renderComponents: any = useCallback(\n (components: any[]): ReactElement[] =>\n renderSignUpComponents(\n components,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n handleInputChange,\n {\n _customRenderers: customRenderers,\n _theme: theme,\n buttonClassName: buttonClasses,\n inputClassName: inputClasses,\n onInputBlur: handleInputBlur,\n onSubmit: handleSubmit,\n size,\n variant,\n },\n ),\n [\n customRenderers,\n formValues,\n touchedFields,\n formErrors,\n isFormValid,\n isLoading,\n size,\n theme,\n variant,\n inputClasses,\n buttonClasses,\n handleSubmit,\n handleInputBlur,\n ],\n );\n\n /**\n * Parse URL parameters to check for OAuth redirect state.\n */\n const getUrlParams = (): any => {\n const urlParams: any = new URL(window?.location?.href ?? '').searchParams;\n return {\n code: urlParams.get('code'),\n error: urlParams.get('error'),\n state: urlParams.get('state'),\n };\n };\n\n // Initialize the flow on component mount\n useEffect(() => {\n // Skip initialization if we're in an OAuth redirect state.\n const urlParams: any = getUrlParams();\n if (urlParams.code || urlParams.state) {\n return;\n }\n\n if (isInitialized && isStorageReady && !isFlowInitialized && !initializationAttemptedRef.current) {\n initializationAttemptedRef.current = true;\n\n (async (): Promise<void> => {\n setIsLoading(true);\n setApiError(null);\n clearMessages();\n\n try {\n const payload: any = challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : undefined;\n const rawResponse: any = await onInitialize?.(payload);\n const response: any = normalizeFlowResponseLocal(rawResponse);\n\n await setChallengeToken(response.challengeToken ?? null);\n setCurrentFlow(response);\n setIsFlowInitialized(true);\n onFlowChange?.(response);\n\n // Clean up executionId and applicationId from URL after storing in state\n if (window?.location?.href) {\n const url: URL = new URL(window.location.href);\n url.searchParams.delete('executionId');\n url.searchParams.delete('applicationId');\n window.history.replaceState({}, '', url.toString());\n }\n\n if (response.flowStatus === EmbeddedSignUpFlowStatus.Error) {\n handleError(response);\n onError?.(new Error(extractErrorMessage(response, t)));\n return;\n }\n\n if (response.flowStatus === EmbeddedSignUpFlowStatus.Complete) {\n handleFlowCompletion(response as EmbeddedSignUpFlowResponse);\n return;\n }\n\n if (response.flowStatus === EmbeddedSignUpFlowStatus.Incomplete) {\n setupFormFields(response);\n\n // Display error from INCOMPLETE response\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (response?.error) {\n handleError(response);\n }\n }\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n } finally {\n setIsLoading(false);\n }\n })();\n }\n }, [\n isInitialized,\n isStorageReady,\n isFlowInitialized,\n onInitialize,\n onComplete,\n onError,\n onFlowChange,\n setupFormFields,\n normalizeFlowResponseLocal,\n afterSignUpUrl,\n t,\n ]);\n\n // If render props are provided, use them\n if (children) {\n const renderProps: BaseSignUpRenderProps = {\n components: (currentFlow?.data as any)?.components || [],\n error: apiError,\n fieldErrors: formErrors,\n handleInputChange,\n handleSubmit,\n isLoading,\n isValid: isFormValid,\n messages: flowMessages || [],\n subtitle: flowSubtitle || t('signup.subheading'),\n title: flowTitle || t('signup.heading'),\n touched: touchedFields,\n validateForm: () => {\n const result: any = validateForm();\n return {fieldErrors: result.errors, isValid: result.isValid};\n },\n values: formValues,\n };\n\n return <div className={containerClasses}>{children(renderProps)}</div>;\n }\n\n if (!isFlowInitialized && isLoading) {\n return (\n <CardPrimitive className={cx(containerClasses, styles.card)} variant={variant}>\n <CardPrimitive.Content>\n <div className={styles.loadingContainer}>\n <Spinner size=\"medium\" />\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n if (!currentFlow) {\n return (\n <CardPrimitive className={cx(containerClasses, styles.card)} variant={variant}>\n <CardPrimitive.Content>\n <AlertPrimitive variant=\"error\" className={errorClasses}>\n <AlertPrimitive.Title>{t('errors.heading')}</AlertPrimitive.Title>\n <AlertPrimitive.Description>{t('errors.signup.flow.initialization.failure')}</AlertPrimitive.Description>\n </AlertPrimitive>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n // Extract heading and subheading components and filter them from the main components\n const componentsToRender: any = (currentFlow.data as any)?.components || [];\n const {title, subtitle, componentsWithoutHeadings} = getAuthComponentHeadings(\n componentsToRender,\n flowTitle,\n flowSubtitle,\n t('signup.heading'),\n t('signup.subheading'),\n );\n\n return (\n <CardPrimitive className={cx(containerClasses, styles.card)} variant={variant}>\n {(showTitle || showSubtitle) && (\n <CardPrimitive.Header className={styles.header}>\n {showTitle && (\n <CardPrimitive.Title level={2} className={styles.title}>\n {title}\n </CardPrimitive.Title>\n )}\n {showSubtitle && (\n <Typography variant=\"body1\" className={styles.subtitle}>\n {subtitle}\n </Typography>\n )}\n </CardPrimitive.Header>\n )}\n <CardPrimitive.Content>\n {externalError && (\n <div className={styles.flowMessagesContainer}>\n <AlertPrimitive variant=\"error\" className={cx(styles.flowMessageItem, messageClasses)}>\n <AlertPrimitive.Description>{externalError.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n </div>\n )}\n {flowMessages && flowMessages.length > 0 && (\n <div className={styles.flowMessagesContainer}>\n {flowMessages.map((message: any, index: number) => (\n <AlertPrimitive\n key={message.id || index}\n variant={message.type?.toLowerCase() === 'error' ? 'error' : 'info'}\n className={cx(styles.flowMessageItem, messageClasses)}\n >\n <AlertPrimitive.Description>{message.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n ))}\n </div>\n )}\n <div className={styles.contentContainer}>\n {componentsWithoutHeadings && componentsWithoutHeadings.length > 0 ? (\n renderComponents(componentsWithoutHeadings)\n ) : (\n <AlertPrimitive variant=\"warning\">\n <Typography variant=\"body1\">{t('errors.signup.components.not.available')}</Typography>\n </AlertPrimitive>\n )}\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n};\n\n/**\n * BaseSignUp component that provides embedded sign-up flow for ThunderIDV2.\n * This component handles both the presentation layer and sign-up flow logic.\n * It accepts API functions as props to maintain framework independence.\n */\nconst BaseSignUp: FC<BaseSignUpProps> = ({preferences, showLogo = true, ...rest}: BaseSignUpProps): ReactElement => {\n const {theme, colorScheme} = useTheme();\n const styles: any = useStyles(theme, colorScheme);\n\n const content: ReactElement = (\n <div>\n {showLogo && (\n <div className={styles.logoContainer}>\n <Logo size=\"large\" />\n </div>\n )}\n <FlowProvider>\n <BaseSignUpContent showLogo={showLogo} {...rest} />\n </FlowProvider>\n </div>\n );\n\n if (!preferences) return content;\n\n return <ComponentPreferencesContext.Provider value={preferences}>{content}</ComponentPreferencesContext.Provider>;\n};\n\nexport default BaseSignUp;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAsDA,MAAMA,WAA0D,6BAC9D,oBACA,aACD;;;;AAyMD,MAAMC,qBAA0C,EAC9C,gBACA,cACA,UACA,SACA,cACA,YACA,OAAO,eACP,YAAY,IACZ,iBAAiB,IACjB,kBAAkB,IAClB,iBAAiB,IACjB,mBAAmB,IACnB,OAAO,UACP,UAAU,YACV,eACA,UACA,YAAY,MACZ,eAAe,WACoB;CACnC,MAAM,EAAC,OAAO,gBAAeC,kBAAU;CACvC,MAAMC,kBAAwC,WAAWC,iCAAyB;CAClF,MAAM,EAAC,MAAKC,wBAAgB;CAC5B,MAAM,EAAC,UAAU,cAAc,OAAO,WAAW,UAAU,cAAc,YAAY,kBAAiBC,iBAAS;CAC/G,MAAM,EAAC,MAAM,eAAe,kBAAkB,sBAAqBC,sBAAc;CACjF,MAAMC,SAAcC,0BAAU,OAAO,YAAY;CAEjD,MAAM,CAAC,WAAW,gBAAgB,SAAS,MAAM;CACjD,MAAM,CAAC,mBAAmB,wBAAwB,SAAS,MAAM;CACjE,MAAM,CAAC,aAAa,kBAAkB,SAA4C,KAAK;CACvF,MAAM,CAAC,UAAU,eAAe,SAAuB,KAAK;CAC5D,MAAM,CAAC,gBAAgB,qBAAqB,SAAS,MAAM;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I,WAAW,OAAO;cACpB,6BAA6B,0BAA0B,SAAS,IAC/D,iBAAiB,0BAA0B,GAE3C,oBAACA;KAAe,SAAQ;eACtB,oBAACE;MAAW,SAAQ;gBAAS,EAAE,yCAAyC;OAAc;MACvE;KAEf;MACgB;GACV;;;;;;;AASpB,MAAMC,cAAmC,EAAC,aAAa,WAAW,KAAM,GAAG,WAAyC;CAClH,MAAM,EAAC,OAAO,gBAAe9D,kBAAU;CACvC,MAAMM,SAAcC,0BAAU,OAAO,YAAY;CAEjD,MAAMwD,UACJ,qBAAC,oBACE,YACC,oBAAC;EAAI,WAAW,OAAO;YACrB,oBAACC,gBAAK,MAAK,UAAU;GACjB,EAER,oBAACC,kCACC,oBAAC;EAA4B;EAAU,GAAI;GAAQ,GACtC,IACX;AAGR,KAAI,CAAC,YAAa,QAAO;AAEzB,QAAO,oBAACC,oCAA4B;EAAS,OAAO;YAAc;GAA+C;;AAGnH,yBAAe"}
|
|
1
|
+
{"version":3,"file":"BaseSignUp.js","names":["logger: ReturnType<typeof createPackageComponentLogger>","BaseSignUpContent: FC<BaseSignUpProps>","useTheme","customRenderers: ComponentRendererMap","ComponentRendererContext","useTranslation","useFlow","useThunderID","styles: any","useStyles","challengeTokenRef: any","initializationAttemptedRef: any","passkeyProcessedRef: any","tempData: any","storageManager: any","handleError: any","errorMessage: string","normalizeFlowResponseLocal: any","extractFormFields: any","fields: FormField[]","fieldName: any","responseFieldErrors: FieldError[] | undefined","errors: Record<string, string>","setupFormFields: any","fields: any","initialValues: Record<string, string>","data: any","components: unknown[] | undefined","normalized: any","redirectUrl: any","popup: any","hasProcessedCallback: any","popupMonitor: ReturnType<typeof setInterval> | null","messageHandler: ((event: MessageEvent) => Promise<void>) | null","expectedOrigin: any","payload: EmbeddedSignUpFlowRequest","continueResponse: any","normalizedContinueResponse: any","popupUrl: any","url: any","code: any","state: any","filteredInputs: Record<string, any>","response: any","effectiveExecutionIdForPasskey: any","passkeyResponse: any","passkeyResponseObj: any","inputs: any","processedResponse: any","containerClasses: any","inputClasses: any","buttonClasses: any","errorClasses: any","messageClasses: any","renderComponents: any","urlParams: any","payload: any","url: URL","result: any","CardPrimitive","Spinner","AlertPrimitive","getAuthComponentHeadings","Typography","BaseSignUp: FC<BaseSignUpProps>","content: ReactElement","Logo","FlowProvider","ComponentPreferencesContext"],"sources":["../../../../../src/components/presentation/auth/SignUp/BaseSignUp.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 {cx} from '@emotion/css';\nimport {\n EmbeddedSignUpFlowRequest,\n EmbeddedSignUpFlowResponse,\n EmbeddedSignUpFlowStatus,\n EmbeddedSignUpFlowType,\n withVendorCSSClassPrefix,\n EmbeddedFlowComponentType,\n FieldError,\n createPackageComponentLogger,\n buildValidatorFromRules,\n Preferences,\n} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode, useCallback, useContext, useEffect, useMemo, useRef, useState} from 'react';\nimport useStyles from './BaseSignUp.styles';\nimport ComponentRendererContext, {\n ComponentRendererMap,\n} from '../../../../contexts/ComponentRenderer/ComponentRendererContext';\nimport FlowProvider from '../../../../contexts/Flow/FlowProvider';\nimport useFlow from '../../../../contexts/Flow/useFlow';\nimport ComponentPreferencesContext from '../../../../contexts/I18n/ComponentPreferencesContext';\nimport useTheme from '../../../../contexts/Theme/useTheme';\nimport useThunderID from '../../../../contexts/ThunderID/useThunderID';\nimport {useForm, FormField} from '../../../../hooks/useForm';\nimport useTranslation from '../../../../hooks/useTranslation';\nimport {normalizeFlowResponse, extractErrorMessage} from '../../../../utils/flowTransformer';\nimport getAuthComponentHeadings from '../../../../utils/getAuthComponentHeadings';\nimport {handlePasskeyRegistration} from '../../../../utils/passkey';\nimport AlertPrimitive from '../../../primitives/Alert/Alert';\n// eslint-disable-next-line import/no-named-as-default\nimport CardPrimitive, {CardProps} from '../../../primitives/Card/Card';\nimport Logo from '../../../primitives/Logo/Logo';\nimport Spinner from '../../../primitives/Spinner/Spinner';\nimport Typography from '../../../primitives/Typography/Typography';\nimport {renderSignUpComponents} from '../AuthOptionFactory';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/react',\n 'BaseSignUp',\n);\n\n/**\n * State for tracking passkey registration\n */\ninterface PasskeyState {\n actionId: string | null;\n creationOptions: string | null;\n error: Error | null;\n executionId: string | null;\n isActive: boolean;\n}\n\n/**\n * Render props for custom UI rendering\n */\nexport interface BaseSignUpRenderProps {\n /**\n * Flow components\n */\n components: any[];\n\n /**\n * API error (if any)\n */\n error?: Error | null;\n\n /**\n * Field validation errors\n */\n fieldErrors: Record<string, string>;\n\n /**\n * Function to handle input changes\n */\n handleInputChange: (name: string, value: string) => void;\n\n /**\n * Function to handle form submission\n */\n handleSubmit: (component: any, data?: Record<string, any>) => Promise<void>;\n\n /**\n * Loading state\n */\n isLoading: boolean;\n\n /**\n * Whether the form is valid\n */\n isValid: boolean;\n\n /**\n * Flow messages\n */\n messages: {message: string; type: string}[];\n\n /**\n * Flow subtitle\n */\n subtitle: string;\n\n /**\n * Flow title\n */\n title: string;\n\n /**\n * Touched fields\n */\n touched: Record<string, boolean>;\n\n /**\n * Function to validate the form\n */\n validateForm: () => {fieldErrors: Record<string, string>; isValid: boolean};\n\n /**\n * Form values\n */\n values: Record<string, string>;\n}\n\n/**\n * Props for the BaseSignUp component.\n */\nexport interface BaseSignUpProps {\n /**\n * URL to redirect after successful sign-up.\n */\n afterSignUpUrl?: string;\n\n /**\n * Custom CSS class name for the submit button.\n */\n buttonClassName?: string;\n\n /**\n * Render props function for custom UI\n */\n children?: (props: BaseSignUpRenderProps) => ReactNode;\n\n /**\n * Custom CSS class name for the form container.\n */\n className?: string;\n\n /**\n * Error object to display\n */\n error?: Error | null;\n\n /**\n * Custom CSS class name for error messages.\n */\n errorClassName?: string;\n\n /**\n * HTML id attribute for the form container.\n */\n id?: string;\n\n /**\n * Custom CSS class name for form inputs.\n */\n inputClassName?: string;\n\n isInitialized?: boolean;\n\n /**\n * Custom CSS class name for info messages.\n */\n messageClassName?: string;\n\n /**\n * Callback function called when the sign-up flow completes and requires redirection.\n * This allows platform-specific handling of redirects (e.g., Next.js router.push).\n * @param response - The response from the sign-up flow containing the redirect URL, etc.\n */\n onComplete?: (response: EmbeddedSignUpFlowResponse) => void;\n\n /**\n * Callback function called when sign-up fails.\n * @param error - The error that occurred during sign-up.\n */\n onError?: (error: Error) => void;\n\n /**\n * Callback function called when sign-up flow status changes.\n * @param response - The current sign-up response.\n */\n onFlowChange?: (response: EmbeddedSignUpFlowResponse) => void;\n\n /**\n * Function to initialize sign-up flow.\n * @returns Promise resolving to the initial sign-up response.\n */\n onInitialize?: (payload?: EmbeddedSignUpFlowRequest) => Promise<EmbeddedSignUpFlowResponse>;\n\n /**\n * Function to handle sign-up steps.\n * @param payload - The sign-up payload.\n * @returns Promise resolving to the sign-up response.\n */\n onSubmit?: (payload: EmbeddedSignUpFlowRequest) => Promise<EmbeddedSignUpFlowResponse>;\n /**\n * Component-level preferences to override global i18n and theme settings.\n * Preferences are deep-merged with global ones, with component preferences\n * taking precedence. Affects this component and all its descendants.\n */\n preferences?: Preferences;\n\n /**\n * Whether to redirect after sign-up.\n */\n shouldRedirectAfterSignUp?: boolean;\n\n /**\n * Whether to show the logo.\n */\n showLogo?: boolean;\n\n /**\n * Whether to show the subtitle.\n */\n showSubtitle?: boolean;\n\n /**\n * Whether to show the title.\n */\n showTitle?: boolean;\n\n /**\n * Size variant for the component.\n */\n size?: 'small' | 'medium' | 'large';\n\n /**\n * Theme variant for the component.\n */\n variant?: CardProps['variant'];\n}\n\n/**\n * Internal component that consumes FlowContext and renders the sign-up UI.\n */\nconst BaseSignUpContent: FC<BaseSignUpProps> = ({\n afterSignUpUrl,\n onInitialize,\n onSubmit,\n onError,\n onFlowChange,\n onComplete,\n error: externalError,\n id,\n className = '',\n inputClassName = '',\n buttonClassName = '',\n errorClassName = '',\n messageClassName = '',\n size = 'medium',\n variant = 'outlined',\n isInitialized,\n children,\n showTitle = true,\n showSubtitle = true,\n}: BaseSignUpProps): ReactElement => {\n const {theme, colorScheme} = useTheme();\n const customRenderers: ComponentRendererMap = useContext(ComponentRendererContext);\n const {t} = useTranslation();\n const {subtitle: flowSubtitle, title: flowTitle, messages: flowMessages, addMessage, clearMessages} = useFlow();\n const {meta, isInitialized: isSdkInitialized, getStorageManager} = useThunderID();\n const styles: any = useStyles(theme, colorScheme);\n\n const [isLoading, setIsLoading] = useState(false);\n const [isFlowInitialized, setIsFlowInitialized] = useState(false);\n const [currentFlow, setCurrentFlow] = useState<EmbeddedSignUpFlowResponse | null>(null);\n const [apiError, setApiError] = useState<Error | null>(null);\n const [isStorageReady, setIsStorageReady] = useState(false);\n const [passkeyState, setPasskeyState] = useState<PasskeyState>({\n actionId: null,\n creationOptions: null,\n error: null,\n executionId: null,\n isActive: false,\n });\n const challengeTokenRef: any = useRef<string | null>(null);\n\n const initializationAttemptedRef: any = useRef(false);\n const passkeyProcessedRef: any = useRef(false);\n\n /**\n * Restore any challenge token persisted before an OAuth redirect.\n */\n useEffect(() => {\n if (!isSdkInitialized) return;\n\n (async (): Promise<void> => {\n try {\n const storageManager: any = await getStorageManager();\n const tempData: any = await storageManager?.getTemporaryData();\n if (tempData?.challengeToken) {\n challengeTokenRef.current = tempData.challengeToken as string;\n }\n } catch {\n // StorageManager unavailable — continue without persisted token\n } finally {\n setIsStorageReady(true);\n }\n })();\n }, [isSdkInitialized]);\n\n /**\n * Updates challengeTokenRef immediately (stale-closure safe) and persists via\n * the provider's StorageManager so the token survives OAuth redirects.\n */\n const setChallengeToken = async (challengeToken: string | null): Promise<void> => {\n challengeTokenRef.current = challengeToken;\n try {\n const storageManager: any = await getStorageManager();\n if (storageManager) {\n if (challengeToken) {\n await storageManager.setTemporaryDataParameter('challengeToken', challengeToken);\n } else {\n await storageManager.removeTemporaryDataParameter('challengeToken');\n }\n }\n } catch {\n logger.warn('Failed to persist challenge token in storage.');\n }\n };\n\n /**\n * Handle error responses and extract meaningful error messages\n * Uses the transformer's extractErrorMessage function.\n */\n const handleError: any = useCallback(\n (error: any) => {\n const errorMessage: string = extractErrorMessage(error, t);\n\n // Set the API error state\n setApiError(error instanceof Error ? error : new Error(errorMessage));\n\n // Clear existing messages and add the error message\n clearMessages();\n addMessage({\n message: errorMessage,\n type: 'error',\n });\n },\n [t, addMessage, clearMessages],\n );\n\n /**\n * Normalize flow response to ensure component-driven format\n * Uses normalizeFlowResponse for modern API format responses\n */\n const normalizeFlowResponseLocal: any = useCallback(\n (response: EmbeddedSignUpFlowResponse): EmbeddedSignUpFlowResponse => {\n if (response?.data) {\n const {components} = normalizeFlowResponse(\n response,\n t,\n {\n defaultErrorKey: 'components.signUp.errors.generic',\n resolveTranslations: false,\n },\n meta,\n );\n\n return {\n ...response,\n data: {\n ...(response.data as any),\n components,\n },\n } as EmbeddedSignUpFlowResponse;\n }\n\n return response;\n },\n [t, children],\n );\n\n /**\n * Extract form fields from flow components\n */\n const extractFormFields: any = useCallback(\n (components: any[]): FormField[] => {\n const fields: FormField[] = [];\n\n const processComponents = (comps: any[]): any => {\n comps.forEach((component: any) => {\n if (\n component.type === EmbeddedFlowComponentType.TextInput ||\n component.type === EmbeddedFlowComponentType.PasswordInput ||\n component.type === EmbeddedFlowComponentType.EmailInput ||\n component.type === EmbeddedFlowComponentType.Select ||\n component.type === EmbeddedFlowComponentType.DateInput\n ) {\n // Use component.ref (mapped identifier) as the field name instead of component.id\n // This ensures form field names match what the input components use\n const fieldName: any = component.ref || component.id;\n const ruleValidator = buildValidatorFromRules(component.validation);\n\n fields.push({\n initialValue: '',\n name: fieldName,\n required: component.required || false,\n validator: (value: string) => {\n if (component.required && (!value || value.trim() === '')) {\n return t('validations.required.field.error');\n }\n // Add email validation if it's an email field\n if (\n (component.type === EmbeddedFlowComponentType.EmailInput || component.variant === 'EMAIL') &&\n value &&\n !/^[^\\s@]+@[^\\s@]+\\.[^\\s@]+$/.test(value)\n ) {\n return t('field.email.invalid');\n }\n // Evaluate declarative validation rules from meta.components[].validation.\n if (ruleValidator && value) {\n const ruleMessage = ruleValidator(value);\n if (ruleMessage) {\n return t(ruleMessage);\n }\n }\n\n return null;\n },\n });\n }\n\n if (component.components && Array.isArray(component.components)) {\n processComponents(component.components);\n }\n });\n };\n\n processComponents(components);\n return fields;\n },\n [t],\n );\n\n const formFields: any = useMemo(\n () => ((currentFlow?.data as any)?.components ? extractFormFields((currentFlow!.data as any).components) : []),\n [currentFlow, extractFormFields],\n );\n\n const form: any = useForm<Record<string, string>>({\n fields: formFields,\n initialValues: {},\n requiredMessage: t('validations.required.field.error'),\n validateOnBlur: true,\n validateOnChange: false,\n });\n\n const {\n values: formValues,\n touched: touchedFields,\n errors: formErrors,\n isValid: isFormValid,\n setValue: setFormValue,\n setTouched: setFormTouched,\n setErrors: setFormErrors,\n clearErrors: clearFormErrors,\n validateForm,\n touchAllFields,\n reset: resetForm,\n } = form;\n\n /**\n * Project server-side validation errors from the most recent flow response into the\n * form's `errors` state. See BaseSignIn for the same pattern: first error per field\n * wins, and the affected fields are marked touched so the error renders immediately.\n */\n useEffect(() => {\n clearFormErrors();\n const responseFieldErrors: FieldError[] | undefined = (currentFlow?.data as any)?.fieldErrors;\n if (!responseFieldErrors || responseFieldErrors.length === 0) {\n return;\n }\n const errors: Record<string, string> = {};\n for (const fe of responseFieldErrors) {\n if (!(fe.identifier in errors)) {\n errors[fe.identifier] = fe.message;\n }\n }\n setFormErrors(errors);\n Object.keys(errors).forEach((field: string) => setFormTouched(field, true));\n }, [currentFlow, setFormErrors, setFormTouched, clearFormErrors]);\n\n /**\n * Setup form fields based on the current flow.\n */\n const setupFormFields: any = useCallback(\n (flowResponse: EmbeddedSignUpFlowResponse) => {\n const fields: any = extractFormFields((flowResponse.data as any)?.components || []);\n const initialValues: Record<string, string> = {};\n\n fields.forEach((field: any) => {\n initialValues[field.name] = field.initialValue || '';\n });\n\n resetForm();\n\n Object.keys(initialValues).forEach((key: any) => {\n setFormValue(key, initialValues[key]);\n });\n },\n [extractFormFields, resetForm, setFormValue],\n );\n\n /**\n * Determine whether a completed flow finished on a display-only screen.\n * Such a completion must be rendered, not redirected past.\n */\n const isDisplayOnlyCompletion = (response: EmbeddedSignUpFlowResponse): boolean => {\n const data: any = response?.data;\n const components: unknown[] | undefined = data?.components ?? data?.meta?.components;\n\n return (\n response?.flowStatus === EmbeddedSignUpFlowStatus.Complete &&\n Array.isArray(components) &&\n components.length > 0 &&\n !(response as {assertion?: string})?.assertion &&\n !data?.redirectURL &&\n !(response as any)?.redirectUrl\n );\n };\n\n /**\n * Handle a completed flow. A flow can complete on a display-only screen; in\n * that case render the screen and skip onComplete so the wrapper does not\n * immediately redirect away from it. Otherwise hand off to onComplete.\n */\n const handleFlowCompletion = (response: EmbeddedSignUpFlowResponse): void => {\n if (isDisplayOnlyCompletion(response)) {\n const normalized: any = normalizeFlowResponseLocal(response);\n setCurrentFlow(normalized);\n setupFormFields(normalized);\n return;\n }\n\n onComplete?.(response);\n };\n\n /**\n * Handle input value changes.\n * Only updates the value without marking as touched.\n * Touched state is set on blur to avoid premature validation.\n */\n const handleInputChange = (name: string, value: string): void => {\n setFormValue(name, value);\n };\n\n /**\n * Handle input blur event.\n * Marks the field as touched, which triggers validation.\n */\n const handleInputBlur = (name: string): void => {\n setFormTouched(name, true);\n };\n\n /**\n * Check if the response contains a redirection URL and perform the redirect if necessary.\n * @param response - The sign-up response\n * @returns true if a redirect was performed, false otherwise\n */\n const handleRedirectionIfNeeded = (response: EmbeddedSignUpFlowResponse): boolean => {\n if (response?.type === EmbeddedSignUpFlowType.Redirection && (response?.data as any)?.redirectURL) {\n /**\n * Open a popup window to handle redirection prompts for social sign-up\n */\n const redirectUrl: any = (response.data as any).redirectURL;\n const popup: any = window.open(redirectUrl, 'oauth_popup', 'width=500,height=600,scrollbars=yes,resizable=yes');\n\n if (!popup) {\n logger.error('Failed to open popup window');\n return false;\n }\n\n let hasProcessedCallback: any = false; // Prevent multiple processing\n let popupMonitor: ReturnType<typeof setInterval> | null = null;\n let messageHandler: ((event: MessageEvent) => Promise<void>) | null = null;\n\n /**\n * Clean up event listener and popup monitor\n */\n const cleanup = (): void => {\n if (messageHandler) {\n window.removeEventListener('message', messageHandler);\n }\n if (popupMonitor) {\n clearInterval(popupMonitor);\n }\n };\n\n /**\n * Add an event listener to the window to capture the message from the popup\n */\n messageHandler = async function messageEventHandler(event: MessageEvent): Promise<void> {\n /**\n * Check if the message is from our popup window\n */\n if (event.source !== popup) {\n return;\n }\n\n /**\n * Check the origin of the message to ensure it's from a trusted source\n */\n const expectedOrigin: any = afterSignUpUrl ? new URL(afterSignUpUrl).origin : window.location.origin;\n if (event.origin !== expectedOrigin && event.origin !== window.location.origin) {\n return;\n }\n\n const {code, state} = event.data;\n\n if (code && state) {\n hasProcessedCallback = true;\n\n const payload: EmbeddedSignUpFlowRequest = {\n ...(currentFlow?.executionId && {executionId: currentFlow.executionId}),\n inputs: {\n code,\n state,\n },\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n };\n\n try {\n const continueResponse: any = await onSubmit!(payload);\n onFlowChange?.(continueResponse);\n\n if (continueResponse.flowStatus === EmbeddedSignUpFlowStatus.Error) {\n handleError(continueResponse);\n onError?.(continueResponse);\n } else if (continueResponse.flowStatus === EmbeddedSignUpFlowStatus.Complete) {\n handleFlowCompletion(continueResponse as EmbeddedSignUpFlowResponse);\n } else if (continueResponse.flowStatus === EmbeddedSignUpFlowStatus.Incomplete) {\n const normalizedContinueResponse: any = normalizeFlowResponseLocal(continueResponse);\n setCurrentFlow(normalizedContinueResponse);\n setupFormFields(normalizedContinueResponse);\n\n // Display error from INCOMPLETE response\n if (normalizedContinueResponse?.error) {\n handleError(normalizedContinueResponse);\n }\n }\n\n popup.close();\n cleanup();\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n popup.close();\n cleanup();\n }\n }\n };\n\n window.addEventListener('message', messageHandler);\n\n /**\n * Monitor popup for closure and URL changes\n */\n popupMonitor = setInterval(async () => {\n try {\n if (popup.closed) {\n cleanup();\n return;\n }\n\n // Skip if we've already processed a callback\n if (hasProcessedCallback) {\n return;\n }\n\n // Try to access popup URL to check for callback\n try {\n const popupUrl: any = popup.location.href;\n\n // Check if we've been redirected to the callback URL\n if (popupUrl && (popupUrl.includes('code=') || popupUrl.includes('error='))) {\n hasProcessedCallback = true; // Set flag to prevent multiple processing\n\n // Parse the URL for OAuth parameters\n const url: any = new URL(popupUrl);\n const code: any = url.searchParams.get('code');\n const state: any = url.searchParams.get('state');\n const error: any = url.searchParams.get('error');\n\n if (error) {\n logger.error('OAuth error:');\n popup.close();\n cleanup();\n return;\n }\n\n if (code && state) {\n const payload: EmbeddedSignUpFlowRequest = {\n ...(currentFlow?.executionId && {executionId: currentFlow.executionId}),\n inputs: {\n code,\n state,\n },\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n };\n\n try {\n const continueResponse: any = await onSubmit!(payload);\n onFlowChange?.(continueResponse);\n\n if (continueResponse.flowStatus === EmbeddedSignUpFlowStatus.Error) {\n handleError(continueResponse);\n onError?.(continueResponse);\n } else if (continueResponse.flowStatus === EmbeddedSignUpFlowStatus.Complete) {\n handleFlowCompletion(continueResponse as EmbeddedSignUpFlowResponse);\n } else if (continueResponse.flowStatus === EmbeddedSignUpFlowStatus.Incomplete) {\n const normalizedContinueResponse: any = normalizeFlowResponseLocal(continueResponse);\n setCurrentFlow(normalizedContinueResponse);\n setupFormFields(normalizedContinueResponse);\n\n // Display error from INCOMPLETE response\n if (normalizedContinueResponse?.error) {\n handleError(normalizedContinueResponse);\n }\n }\n\n popup.close();\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n popup.close();\n }\n }\n }\n } catch (e) {\n // Cross-origin error is expected when popup navigates to OAuth provider\n // This is normal and we can ignore it\n }\n } catch (e) {\n logger.error('Error monitoring popup:');\n }\n }, 1000);\n\n return true;\n }\n\n return false;\n };\n\n /**\n * Handle component submission (for buttons outside forms).\n */\n const handleSubmit = async (component: any, data?: Record<string, any>, skipValidation?: boolean): Promise<void> => {\n if (!currentFlow) {\n return;\n }\n\n // Only validate for form submit actions, skip for social/trigger actions\n if (!skipValidation) {\n // Mark all fields as touched before validation\n touchAllFields();\n\n const validation: ReturnType<typeof validateForm> = validateForm();\n\n if (!validation.isValid) {\n return;\n }\n }\n\n setIsLoading(true);\n setApiError(null);\n clearMessages();\n\n try {\n // Filter out empty or undefined input values\n const filteredInputs: Record<string, any> = {};\n if (data) {\n Object.entries(data).forEach(([key, value]: [string, any]) => {\n if (value !== null && value !== undefined && value !== '') {\n filteredInputs[key] = value;\n }\n });\n }\n\n const payload: EmbeddedSignUpFlowRequest = {\n ...(currentFlow.executionId && {executionId: currentFlow.executionId}),\n ...(component.id && {action: component.id}),\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n inputs: filteredInputs,\n };\n\n const rawResponse: any = await onSubmit!(payload);\n const response: any = normalizeFlowResponseLocal(rawResponse);\n onFlowChange?.(response);\n\n await setChallengeToken(response.challengeToken ?? null);\n\n if (response.flowStatus === EmbeddedSignUpFlowStatus.Error) {\n handleError(response);\n onError?.(new Error(extractErrorMessage(response, t)));\n return;\n }\n\n if (response.flowStatus === EmbeddedSignUpFlowStatus.Complete) {\n handleFlowCompletion(response as EmbeddedSignUpFlowResponse);\n return;\n }\n\n if (response.flowStatus === EmbeddedSignUpFlowStatus.Incomplete) {\n if (handleRedirectionIfNeeded(response)) {\n return;\n }\n\n if (response.data?.additionalData?.passkeyCreationOptions) {\n const {passkeyCreationOptions}: any = response.data.additionalData;\n const effectiveExecutionIdForPasskey: any = response.executionId ?? currentFlow?.executionId;\n\n // Reset passkey processed ref to allow processing\n passkeyProcessedRef.current = false;\n\n // Set passkey state to trigger the passkey\n setPasskeyState({\n actionId: component.id || 'submit',\n creationOptions: passkeyCreationOptions,\n error: null,\n executionId: effectiveExecutionIdForPasskey,\n isActive: true,\n });\n setIsLoading(false);\n return;\n }\n setCurrentFlow(response);\n setupFormFields(response);\n\n // Display error from INCOMPLETE response\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (response?.error) {\n handleError(response);\n }\n }\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n } finally {\n setIsLoading(false);\n }\n };\n\n /**\n * Handle passkey registration when passkey state becomes active.\n * This effect auto-triggers the browser passkey popup and submits the result.\n */\n useEffect(() => {\n if (!passkeyState.isActive || !passkeyState.creationOptions || !passkeyState.executionId) {\n return;\n }\n\n // Prevent re-processing\n if (passkeyProcessedRef.current) {\n return;\n }\n passkeyProcessedRef.current = true;\n\n const performPasskeyRegistration = async (): Promise<void> => {\n const passkeyResponse: any = await handlePasskeyRegistration(passkeyState.creationOptions!);\n const passkeyResponseObj: any = JSON.parse(passkeyResponse);\n\n const inputs: any = {\n attestationObject: passkeyResponseObj.response.attestationObject,\n clientDataJSON: passkeyResponseObj.response.clientDataJSON,\n credentialId: passkeyResponseObj.id,\n };\n\n // After successful registration, submit the result to the server\n const payload: EmbeddedSignUpFlowRequest = {\n executionId: passkeyState.executionId ?? undefined,\n inputs,\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n } as any;\n\n const nextResponse: any = await onSubmit!(payload);\n const processedResponse: any = normalizeFlowResponseLocal(nextResponse);\n onFlowChange?.(processedResponse);\n\n if (processedResponse.flowStatus === EmbeddedSignUpFlowStatus.Complete) {\n handleFlowCompletion(processedResponse as EmbeddedSignUpFlowResponse);\n } else {\n setCurrentFlow(processedResponse);\n setupFormFields(processedResponse);\n }\n };\n\n performPasskeyRegistration()\n .then(() => {\n setPasskeyState({actionId: null, creationOptions: null, error: null, executionId: null, isActive: false});\n })\n .catch((error: any) => {\n setPasskeyState((prev: any) => ({...prev, error: error as Error, isActive: false}));\n handleError(error);\n onError?.(error as Error);\n });\n }, [passkeyState.isActive, passkeyState.creationOptions, passkeyState.executionId]);\n\n const containerClasses: any = cx(\n [\n withVendorCSSClassPrefix('signup'),\n withVendorCSSClassPrefix(`signup--${size}`),\n withVendorCSSClassPrefix(`signup--${variant}`),\n ],\n className,\n );\n\n const inputClasses: any = cx(\n [\n withVendorCSSClassPrefix('signup__input'),\n size === 'small' && withVendorCSSClassPrefix('signup__input--small'),\n size === 'large' && withVendorCSSClassPrefix('signup__input--large'),\n ],\n inputClassName,\n );\n\n const buttonClasses: any = cx(\n [\n withVendorCSSClassPrefix('signup__button'),\n size === 'small' && withVendorCSSClassPrefix('signup__button--small'),\n size === 'large' && withVendorCSSClassPrefix('signup__button--large'),\n ],\n buttonClassName,\n );\n\n const errorClasses: any = cx([withVendorCSSClassPrefix('signup__error')], errorClassName);\n\n const messageClasses: any = cx([withVendorCSSClassPrefix('signup__messages')], messageClassName);\n\n /**\n * Render form components based on flow data using the factory\n */\n const renderComponents: any = useCallback(\n (components: any[]): ReactElement[] =>\n renderSignUpComponents(\n components,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n handleInputChange,\n {\n _customRenderers: customRenderers,\n _theme: theme,\n buttonClassName: buttonClasses,\n inputClassName: inputClasses,\n onInputBlur: handleInputBlur,\n onSubmit: handleSubmit,\n size,\n variant,\n },\n ),\n [\n customRenderers,\n formValues,\n touchedFields,\n formErrors,\n isFormValid,\n isLoading,\n size,\n theme,\n variant,\n inputClasses,\n buttonClasses,\n handleSubmit,\n handleInputBlur,\n ],\n );\n\n /**\n * Parse URL parameters to check for OAuth redirect state.\n */\n const getUrlParams = (): any => {\n const urlParams: any = new URL(window?.location?.href ?? '').searchParams;\n return {\n code: urlParams.get('code'),\n error: urlParams.get('error'),\n state: urlParams.get('state'),\n };\n };\n\n // Initialize the flow on component mount\n useEffect(() => {\n // Skip initialization if we're in an OAuth redirect state.\n const urlParams: any = getUrlParams();\n if (urlParams.code || urlParams.state) {\n return;\n }\n\n if (isInitialized && isStorageReady && !isFlowInitialized && !initializationAttemptedRef.current) {\n initializationAttemptedRef.current = true;\n\n (async (): Promise<void> => {\n setIsLoading(true);\n setApiError(null);\n clearMessages();\n\n try {\n const payload: any = challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : undefined;\n const rawResponse: any = await onInitialize?.(payload);\n const response: any = normalizeFlowResponseLocal(rawResponse);\n\n await setChallengeToken(response.challengeToken ?? null);\n setCurrentFlow(response);\n setIsFlowInitialized(true);\n onFlowChange?.(response);\n\n // Clean up executionId and applicationId from URL after storing in state\n if (window?.location?.href) {\n const url: URL = new URL(window.location.href);\n url.searchParams.delete('executionId');\n url.searchParams.delete('applicationId');\n window.history.replaceState({}, '', url.toString());\n }\n\n if (response.flowStatus === EmbeddedSignUpFlowStatus.Error) {\n handleError(response);\n onError?.(new Error(extractErrorMessage(response, t)));\n return;\n }\n\n if (response.flowStatus === EmbeddedSignUpFlowStatus.Complete) {\n handleFlowCompletion(response as EmbeddedSignUpFlowResponse);\n return;\n }\n\n if (response.flowStatus === EmbeddedSignUpFlowStatus.Incomplete) {\n setupFormFields(response);\n\n // Display error from INCOMPLETE response\n // eslint-disable-next-line @typescript-eslint/no-unsafe-member-access\n if (response?.error) {\n handleError(response);\n }\n }\n } catch (err) {\n handleError(err);\n onError?.(err as Error);\n } finally {\n setIsLoading(false);\n }\n })();\n }\n }, [\n isInitialized,\n isStorageReady,\n isFlowInitialized,\n onInitialize,\n onComplete,\n onError,\n onFlowChange,\n setupFormFields,\n normalizeFlowResponseLocal,\n afterSignUpUrl,\n t,\n ]);\n\n // If render props are provided, use them\n if (children) {\n const renderProps: BaseSignUpRenderProps = {\n components: (currentFlow?.data as any)?.components || [],\n error: apiError,\n fieldErrors: formErrors,\n handleInputChange,\n handleSubmit,\n isLoading,\n isValid: isFormValid,\n messages: flowMessages || [],\n subtitle: flowSubtitle || t('signup.subheading'),\n title: flowTitle || t('signup.heading'),\n touched: touchedFields,\n validateForm: () => {\n const result: any = validateForm();\n return {fieldErrors: result.errors, isValid: result.isValid};\n },\n values: formValues,\n };\n\n return (\n <div id={id} className={containerClasses}>\n {children(renderProps)}\n </div>\n );\n }\n\n if (!isFlowInitialized && isLoading) {\n return (\n <CardPrimitive id={id} className={cx(containerClasses, styles.card)} variant={variant}>\n <CardPrimitive.Content>\n <div className={styles.loadingContainer}>\n <Spinner size=\"medium\" />\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n if (!currentFlow) {\n return (\n <CardPrimitive id={id} className={cx(containerClasses, styles.card)} variant={variant}>\n <CardPrimitive.Content>\n <AlertPrimitive variant=\"error\" className={errorClasses}>\n <AlertPrimitive.Title>{t('errors.heading')}</AlertPrimitive.Title>\n <AlertPrimitive.Description>{t('errors.signup.flow.initialization.failure')}</AlertPrimitive.Description>\n </AlertPrimitive>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n // Extract heading and subheading components and filter them from the main components\n const componentsToRender: any = (currentFlow.data as any)?.components || [];\n const {title, subtitle, componentsWithoutHeadings} = getAuthComponentHeadings(\n componentsToRender,\n flowTitle,\n flowSubtitle,\n t('signup.heading'),\n t('signup.subheading'),\n );\n\n return (\n <CardPrimitive id={id} className={cx(containerClasses, styles.card)} variant={variant}>\n {(showTitle || showSubtitle) && (\n <CardPrimitive.Header className={styles.header}>\n {showTitle && (\n <CardPrimitive.Title level={2} className={styles.title}>\n {title}\n </CardPrimitive.Title>\n )}\n {showSubtitle && (\n <Typography variant=\"body1\" className={styles.subtitle}>\n {subtitle}\n </Typography>\n )}\n </CardPrimitive.Header>\n )}\n <CardPrimitive.Content>\n {externalError && (\n <div className={styles.flowMessagesContainer}>\n <AlertPrimitive variant=\"error\" className={cx(styles.flowMessageItem, messageClasses)}>\n <AlertPrimitive.Description>{externalError.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n </div>\n )}\n {flowMessages && flowMessages.length > 0 && (\n <div className={styles.flowMessagesContainer}>\n {flowMessages.map((message: any, index: number) => (\n <AlertPrimitive\n key={message.id || index}\n variant={message.type?.toLowerCase() === 'error' ? 'error' : 'info'}\n className={cx(styles.flowMessageItem, messageClasses)}\n >\n <AlertPrimitive.Description>{message.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n ))}\n </div>\n )}\n <div className={styles.contentContainer}>\n {componentsWithoutHeadings && componentsWithoutHeadings.length > 0 ? (\n renderComponents(componentsWithoutHeadings)\n ) : (\n <AlertPrimitive variant=\"warning\">\n <Typography variant=\"body1\">{t('errors.signup.components.not.available')}</Typography>\n </AlertPrimitive>\n )}\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n};\n\n/**\n * BaseSignUp component that provides embedded sign-up flow for ThunderIDV2.\n * This component handles both the presentation layer and sign-up flow logic.\n * It accepts API functions as props to maintain framework independence.\n */\nconst BaseSignUp: FC<BaseSignUpProps> = ({preferences, showLogo = true, ...rest}: BaseSignUpProps): ReactElement => {\n const {theme, colorScheme} = useTheme();\n const styles: any = useStyles(theme, colorScheme);\n\n const content: ReactElement = (\n <div>\n {showLogo && (\n <div className={styles.logoContainer}>\n <Logo size=\"large\" />\n </div>\n )}\n <FlowProvider>\n <BaseSignUpContent showLogo={showLogo} {...rest} />\n </FlowProvider>\n </div>\n );\n\n if (!preferences) return content;\n\n return <ComponentPreferencesContext.Provider value={preferences}>{content}</ComponentPreferencesContext.Provider>;\n};\n\nexport default BaseSignUp;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAsDA,MAAMA,WAA0D,6BAC9D,oBACA,aACD;;;;AA8MD,MAAMC,qBAA0C,EAC9C,gBACA,cACA,UACA,SACA,cACA,YACA,OAAO,eACP,IACA,YAAY,IACZ,iBAAiB,IACjB,kBAAkB,IAClB,iBA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AGnH,yBAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormControl.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/FormControl/FormControl.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAC,aAAa,EAAE,EAAE,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAKnD,MAAM,MAAM,0BAA0B,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,eAAe,CAAC,EAAE,0BAA0B,CAAC;IAC7C;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,
|
|
1
|
+
{"version":3,"file":"FormControl.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/FormControl/FormControl.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAC,aAAa,EAAE,EAAE,EAAE,SAAS,EAAC,MAAM,OAAO,CAAC;AAKnD,MAAM,MAAM,0BAA0B,GAAG,MAAM,GAAG,QAAQ,CAAC;AAE3D,MAAM,WAAW,gBAAgB;IAC/B;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB;;OAEG;IACH,eAAe,CAAC,EAAE,0BAA0B,CAAC;IAC7C;;OAEG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;CACvB;AAED,QAAA,MAAM,WAAW,EAAE,EAAE,CAAC,gBAAgB,CA6BrC,CAAC;AAEF,eAAe,WAAW,CAAC"}
|
|
@@ -6,10 +6,11 @@ import { jsx, jsxs } from "react/jsx-runtime";
|
|
|
6
6
|
import { cx } from "@emotion/css";
|
|
7
7
|
|
|
8
8
|
//#region src/components/primitives/FormControl/FormControl.tsx
|
|
9
|
-
const FormControl = ({ children, error, helperText, className, helperTextAlign = "left", helperTextMarginLeft }) => {
|
|
9
|
+
const FormControl = ({ children, error, helperText, className, id, helperTextAlign = "left", helperTextMarginLeft }) => {
|
|
10
10
|
const { theme, colorScheme } = useTheme_default();
|
|
11
11
|
const styles = FormControl_styles_default(theme, colorScheme, helperTextAlign, helperTextMarginLeft, !!error);
|
|
12
12
|
return /* @__PURE__ */ jsxs("div", {
|
|
13
|
+
id,
|
|
13
14
|
className: cx(withVendorCSSClassPrefix(bem("form-control")), styles["formControl"], className),
|
|
14
15
|
children: [children, (error || helperText) && /* @__PURE__ */ jsx(Typography_default, {
|
|
15
16
|
variant: "caption",
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FormControl.js","names":["FormControl: FC<FormControlProps>","useTheme","styles: Record<string, string>","useStyles","Typography"],"sources":["../../../../src/components/primitives/FormControl/FormControl.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 {cx} from '@emotion/css';\nimport {bem, withVendorCSSClassPrefix} from '@thunderid/browser';\nimport {CSSProperties, FC, ReactNode} from 'react';\nimport useStyles from './FormControl.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport Typography from '../Typography/Typography';\n\nexport type FormControlHelperTextAlign = 'left' | 'center';\n\nexport interface FormControlProps {\n /**\n * The content to be wrapped by the form control\n */\n children: ReactNode;\n /**\n * Additional CSS class names\n */\n className?: string;\n /**\n * Error message to display below the content\n */\n error?: string;\n /**\n * Helper text to display below the content\n */\n helperText?: string;\n /**\n * Custom alignment for helper text (default: left, center for OTP)\n */\n helperTextAlign?: FormControlHelperTextAlign;\n /**\n * Custom margin left for helper text (for components like Checkbox)\n */\n helperTextMarginLeft?: string;\n /**\n * Custom container style\n */\n style?: CSSProperties;\n}\n\nconst FormControl: FC<FormControlProps> = ({\n children,\n error,\n helperText,\n className,\n helperTextAlign = 'left',\n helperTextMarginLeft,\n}: FormControlProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme, helperTextAlign, helperTextMarginLeft, !!error);\n\n return (\n <div className={cx(withVendorCSSClassPrefix(bem('form-control')), styles['formControl'], className)}>\n {children}\n {(error || helperText) && (\n <Typography\n variant=\"caption\"\n color={error ? 'error' : 'textSecondary'}\n className={cx(withVendorCSSClassPrefix(bem('form-control', 'helper-text')), styles['helperText'], {\n [withVendorCSSClassPrefix(bem('form-control', 'helper-text', 'error'))]: !!error,\n [styles['helperTextError']]: !!error,\n })}\n >\n {error || helperText}\n </Typography>\n )}\n </div>\n );\n};\n\nexport default FormControl;\n"],"mappings":";;;;;;;;
|
|
1
|
+
{"version":3,"file":"FormControl.js","names":["FormControl: FC<FormControlProps>","useTheme","styles: Record<string, string>","useStyles","Typography"],"sources":["../../../../src/components/primitives/FormControl/FormControl.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 {cx} from '@emotion/css';\nimport {bem, withVendorCSSClassPrefix} from '@thunderid/browser';\nimport {CSSProperties, FC, ReactNode} from 'react';\nimport useStyles from './FormControl.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\nimport Typography from '../Typography/Typography';\n\nexport type FormControlHelperTextAlign = 'left' | 'center';\n\nexport interface FormControlProps {\n /**\n * The content to be wrapped by the form control\n */\n children: ReactNode;\n /**\n * Additional CSS class names\n */\n className?: string;\n /**\n * Error message to display below the content\n */\n error?: string;\n /**\n * Helper text to display below the content\n */\n helperText?: string;\n /**\n * Custom alignment for helper text (default: left, center for OTP)\n */\n helperTextAlign?: FormControlHelperTextAlign;\n /**\n * Custom margin left for helper text (for components like Checkbox)\n */\n helperTextMarginLeft?: string;\n /**\n * HTML id attribute\n */\n id?: string;\n /**\n * Custom container style\n */\n style?: CSSProperties;\n}\n\nconst FormControl: FC<FormControlProps> = ({\n children,\n error,\n helperText,\n className,\n id,\n helperTextAlign = 'left',\n helperTextMarginLeft,\n}: FormControlProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(theme, colorScheme, helperTextAlign, helperTextMarginLeft, !!error);\n\n return (\n <div id={id} className={cx(withVendorCSSClassPrefix(bem('form-control')), styles['formControl'], className)}>\n {children}\n {(error || helperText) && (\n <Typography\n variant=\"caption\"\n color={error ? 'error' : 'textSecondary'}\n className={cx(withVendorCSSClassPrefix(bem('form-control', 'helper-text')), styles['helperText'], {\n [withVendorCSSClassPrefix(bem('form-control', 'helper-text', 'error'))]: !!error,\n [styles['helperTextError']]: !!error,\n })}\n >\n {error || helperText}\n </Typography>\n )}\n </div>\n );\n};\n\nexport default FormControl;\n"],"mappings":";;;;;;;;AA8DA,MAAMA,eAAqC,EACzC,UACA,OACA,YACA,WACA,IACA,kBAAkB,QAClB,2BACsB;CACtB,MAAM,EAAC,OAAO,gBAA4CC,kBAAU;CACpE,MAAMC,SAAiCC,2BAAU,OAAO,aAAa,iBAAiB,sBAAsB,CAAC,CAAC,MAAM;AAEpH,QACE,qBAAC;EAAQ;EAAI,WAAW,GAAG,yBAAyB,IAAI,eAAe,CAAC,EAAE,OAAO,gBAAgB,UAAU;aACxG,WACC,SAAS,eACT,oBAACC;GACC,SAAQ;GACR,OAAO,QAAQ,UAAU;GACzB,WAAW,GAAG,yBAAyB,IAAI,gBAAgB,cAAc,CAAC,EAAE,OAAO,eAAe;KAC/F,yBAAyB,IAAI,gBAAgB,eAAe,QAAQ,CAAC,GAAG,CAAC,CAAC;KAC1E,OAAO,qBAAqB,CAAC,CAAC;IAChC,CAAC;aAED,SAAS;IACC;GAEX;;AAIV,0BAAe"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Typography.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/Typography/Typography.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAC,aAAa,EAAE,EAAE,EAAE,SAAS,EAAE,WAAW,EAAC,MAAM,OAAO,CAAC;AAChE,OAAkB,EAAC,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAGnG,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B;;OAEG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;IAChE;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B;AAmBD;;;GAGG;AACH,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAkFnC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
1
|
+
{"version":3,"file":"Typography.d.ts","sourceRoot":"","sources":["../../../../src/components/primitives/Typography/Typography.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAIH,OAAO,EAAC,aAAa,EAAE,EAAE,EAAE,SAAS,EAAE,WAAW,EAAC,MAAM,OAAO,CAAC;AAChE,OAAkB,EAAC,iBAAiB,EAAE,eAAe,EAAE,eAAe,EAAC,MAAM,qBAAqB,CAAC;AAGnG,MAAM,WAAW,eAAe;IAC9B;;OAEG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB;;OAEG;IACH,QAAQ,EAAE,SAAS,CAAC;IACpB;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,eAAe,CAAC;IACxB;;OAEG;IACH,SAAS,CAAC,EAAE,WAAW,CAAC;IACxB;;OAEG;IACH,QAAQ,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC3B;;OAEG;IACH,UAAU,CAAC,EAAE,QAAQ,GAAG,QAAQ,GAAG,UAAU,GAAG,MAAM,GAAG,MAAM,CAAC;IAChE;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IACvB;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,UAAU,CAAC,EAAE,MAAM,GAAG,MAAM,CAAC;IAC7B;;OAEG;IACH,MAAM,CAAC,EAAE,OAAO,CAAC;IACjB;;OAEG;IACH,KAAK,CAAC,EAAE,aAAa,CAAC;IACtB;;OAEG;IACH,OAAO,CAAC,EAAE,iBAAiB,CAAC;CAC7B;AAmBD;;;GAGG;AACH,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAkFnC,CAAC;AAEF,eAAe,UAAU,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Typography.js","names":["variantMapping: Record<TypographyVariant, ElementType>","Typography: FC<TypographyProps>","useTheme","styles: Record<string, string>","useStyles","Component: ElementType"],"sources":["../../../../src/components/primitives/Typography/Typography.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 {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {CSSProperties, FC, ReactNode, ElementType} from 'react';\nimport useStyles, {TypographyVariant, TypographyAlign, TypographyColor} from './Typography.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\n\nexport interface TypographyProps {\n /**\n * Text alignment\n */\n align?: TypographyAlign;\n /**\n * The content to be rendered\n */\n children: ReactNode;\n /**\n * Additional CSS class names\n */\n className?: string;\n /**\n * Color variant\n */\n color?: TypographyColor;\n /**\n * The HTML element or React component to render\n */\n component?: ElementType;\n /**\n * Custom font size (overrides variant sizing)\n */\n fontSize?: string | number;\n /**\n * Custom font weight\n */\n fontWeight?: 'normal' | 'medium' | 'semibold' | 'bold' | number;\n /**\n * Whether to disable gutters (margin bottom)\n */\n gutterBottom?: boolean;\n /**\n * Whether the text should be displayed inline\n */\n inline?: boolean;\n /**\n * Line height\n */\n lineHeight?: string | number;\n /**\n * Whether the text should be clipped with ellipsis when it overflows\n */\n noWrap?: boolean;\n /**\n * Custom styles\n */\n style?: CSSProperties;\n /**\n * The typography variant to apply\n */\n variant?: TypographyVariant;\n}\n\n// Default component mapping for variants\nconst variantMapping: Record<TypographyVariant, ElementType> = {\n body1: 'p',\n body2: 'p',\n button: 'span',\n caption: 'span',\n h1: 'h1',\n h2: 'h2',\n h3: 'h3',\n h4: 'h4',\n h5: 'h5',\n h6: 'h6',\n overline: 'span',\n subtitle1: 'h6',\n subtitle2: 'h6',\n};\n\n/**\n * Typography component for consistent text rendering throughout the application.\n * Integrates with the theme system and provides semantic HTML elements.\n */\nconst Typography: FC<TypographyProps> = ({\n children,\n variant = 'body1',\n component,\n align = 'left',\n color = 'textPrimary',\n noWrap = false,\n className,\n style = {},\n inline = false,\n fontWeight,\n fontSize,\n lineHeight,\n gutterBottom = false,\n ...rest\n}: TypographyProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(\n theme,\n colorScheme,\n variant,\n align,\n color,\n noWrap,\n inline,\n gutterBottom,\n fontWeight,\n fontSize,\n lineHeight,\n );\n\n const Component: ElementType = component || variantMapping[variant] || 'span';\n\n const getVariantClass = (variantName: TypographyVariant): string => {\n switch (variantName) {\n case 'h1':\n return styles['typographyH1'];\n case 'h2':\n return styles['typographyH2'];\n case 'h3':\n return styles['typographyH3'];\n case 'h4':\n return styles['typographyH4'];\n case 'h5':\n return styles['typographyH5'];\n case 'h6':\n return styles['typographyH6'];\n case 'subtitle1':\n return styles['typographySubtitle1'];\n case 'subtitle2':\n return styles['typographySubtitle2'];\n case 'body1':\n return styles['typographyBody1'];\n case 'body2':\n return styles['typographyBody2'];\n case 'caption':\n return styles['typographyCaption'];\n case 'overline':\n return styles['typographyOverline'];\n case 'button':\n return styles['typographyButton'];\n default:\n return '';\n }\n };\n\n const typographyClassName: string = cx(\n withVendorCSSClassPrefix(bem('typography')),\n withVendorCSSClassPrefix(bem('typography', variant)),\n styles['typography'],\n getVariantClass(variant),\n noWrap && styles['typographyNoWrap'],\n inline && styles['typographyInline'],\n gutterBottom && styles['typographyGutterBottom'],\n className,\n );\n\n return (\n <Component className={typographyClassName} style={style} {...rest}>\n {children}\n </Component>\n );\n};\n\nexport default Typography;\n"],"mappings":";;;;;;;
|
|
1
|
+
{"version":3,"file":"Typography.js","names":["variantMapping: Record<TypographyVariant, ElementType>","Typography: FC<TypographyProps>","useTheme","styles: Record<string, string>","useStyles","Component: ElementType"],"sources":["../../../../src/components/primitives/Typography/Typography.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 {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {CSSProperties, FC, ReactNode, ElementType} from 'react';\nimport useStyles, {TypographyVariant, TypographyAlign, TypographyColor} from './Typography.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\n\nexport interface TypographyProps {\n /**\n * Text alignment\n */\n align?: TypographyAlign;\n /**\n * The content to be rendered\n */\n children: ReactNode;\n /**\n * Additional CSS class names\n */\n className?: string;\n /**\n * Color variant\n */\n color?: TypographyColor;\n /**\n * The HTML element or React component to render\n */\n component?: ElementType;\n /**\n * Custom font size (overrides variant sizing)\n */\n fontSize?: string | number;\n /**\n * Custom font weight\n */\n fontWeight?: 'normal' | 'medium' | 'semibold' | 'bold' | number;\n /**\n * Whether to disable gutters (margin bottom)\n */\n gutterBottom?: boolean;\n /**\n * HTML id attribute\n */\n id?: string;\n /**\n * Whether the text should be displayed inline\n */\n inline?: boolean;\n /**\n * Line height\n */\n lineHeight?: string | number;\n /**\n * Whether the text should be clipped with ellipsis when it overflows\n */\n noWrap?: boolean;\n /**\n * Custom styles\n */\n style?: CSSProperties;\n /**\n * The typography variant to apply\n */\n variant?: TypographyVariant;\n}\n\n// Default component mapping for variants\nconst variantMapping: Record<TypographyVariant, ElementType> = {\n body1: 'p',\n body2: 'p',\n button: 'span',\n caption: 'span',\n h1: 'h1',\n h2: 'h2',\n h3: 'h3',\n h4: 'h4',\n h5: 'h5',\n h6: 'h6',\n overline: 'span',\n subtitle1: 'h6',\n subtitle2: 'h6',\n};\n\n/**\n * Typography component for consistent text rendering throughout the application.\n * Integrates with the theme system and provides semantic HTML elements.\n */\nconst Typography: FC<TypographyProps> = ({\n children,\n variant = 'body1',\n component,\n align = 'left',\n color = 'textPrimary',\n noWrap = false,\n className,\n style = {},\n inline = false,\n fontWeight,\n fontSize,\n lineHeight,\n gutterBottom = false,\n ...rest\n}: TypographyProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(\n theme,\n colorScheme,\n variant,\n align,\n color,\n noWrap,\n inline,\n gutterBottom,\n fontWeight,\n fontSize,\n lineHeight,\n );\n\n const Component: ElementType = component || variantMapping[variant] || 'span';\n\n const getVariantClass = (variantName: TypographyVariant): string => {\n switch (variantName) {\n case 'h1':\n return styles['typographyH1'];\n case 'h2':\n return styles['typographyH2'];\n case 'h3':\n return styles['typographyH3'];\n case 'h4':\n return styles['typographyH4'];\n case 'h5':\n return styles['typographyH5'];\n case 'h6':\n return styles['typographyH6'];\n case 'subtitle1':\n return styles['typographySubtitle1'];\n case 'subtitle2':\n return styles['typographySubtitle2'];\n case 'body1':\n return styles['typographyBody1'];\n case 'body2':\n return styles['typographyBody2'];\n case 'caption':\n return styles['typographyCaption'];\n case 'overline':\n return styles['typographyOverline'];\n case 'button':\n return styles['typographyButton'];\n default:\n return '';\n }\n };\n\n const typographyClassName: string = cx(\n withVendorCSSClassPrefix(bem('typography')),\n withVendorCSSClassPrefix(bem('typography', variant)),\n styles['typography'],\n getVariantClass(variant),\n noWrap && styles['typographyNoWrap'],\n inline && styles['typographyInline'],\n gutterBottom && styles['typographyGutterBottom'],\n className,\n );\n\n return (\n <Component className={typographyClassName} style={style} {...rest}>\n {children}\n </Component>\n );\n};\n\nexport default Typography;\n"],"mappings":";;;;;;;AAoFA,MAAMA,iBAAyD;CAC7D,OAAO;CACP,OAAO;CACP,QAAQ;CACR,SAAS;CACT,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,UAAU;CACV,WAAW;CACX,WAAW;CACZ;;;;;AAMD,MAAMC,cAAmC,EACvC,UACA,UAAU,SACV,WACA,QAAQ,QACR,QAAQ,eACR,SAAS,OACT,WACA,QAAQ,EAAE,EACV,SAAS,OACT,YACA,UACA,YACA,eAAe,MACf,GAAG,WACkB;CACrB,MAAM,EAAC,OAAO,gBAA4CC,kBAAU;CACpE,MAAMC,SAAiCC,0BACrC,OACA,aACA,SACA,OACA,OACA,QACA,QACA,cACA,YACA,UACA,WACD;CAED,MAAMC,YAAyB,aAAa,eAAe,YAAY;CAEvE,MAAM,mBAAmB,gBAA2C;AAClE,UAAQ,aAAR;GACE,KAAK,KACH,QAAO,OAAO;GAChB,KAAK,KACH,QAAO,OAAO;GAChB,KAAK,KACH,QAAO,OAAO;GAChB,KAAK,KACH,QAAO,OAAO;GAChB,KAAK,KACH,QAAO,OAAO;GAChB,KAAK,KACH,QAAO,OAAO;GAChB,KAAK,YACH,QAAO,OAAO;GAChB,KAAK,YACH,QAAO,OAAO;GAChB,KAAK,QACH,QAAO,OAAO;GAChB,KAAK,QACH,QAAO,OAAO;GAChB,KAAK,UACH,QAAO,OAAO;GAChB,KAAK,WACH,QAAO,OAAO;GAChB,KAAK,SACH,QAAO,OAAO;GAChB,QACE,QAAO;;;AAeb,QACE,oBAAC;EAAU,WAZuB,GAClC,yBAAyB,IAAI,aAAa,CAAC,EAC3C,yBAAyB,IAAI,cAAc,QAAQ,CAAC,EACpD,OAAO,eACP,gBAAgB,QAAQ,EACxB,UAAU,OAAO,qBACjB,UAAU,OAAO,qBACjB,gBAAgB,OAAO,2BACvB,UACD;EAGmD;EAAO,GAAI;EAC1D;GACS;;AAIhB,yBAAe"}
|
|
@@ -15,6 +15,7 @@
|
|
|
15
15
|
* specific language governing permissions and limitations
|
|
16
16
|
* under the License.
|
|
17
17
|
*/
|
|
18
|
+
import { FlowMetadataResponse } from '@thunderid/browser';
|
|
18
19
|
import { FC, PropsWithChildren } from 'react';
|
|
19
20
|
export interface FlowMetaProviderProps {
|
|
20
21
|
/**
|
|
@@ -22,6 +23,13 @@ export interface FlowMetaProviderProps {
|
|
|
22
23
|
* @default true
|
|
23
24
|
*/
|
|
24
25
|
enabled?: boolean;
|
|
26
|
+
/**
|
|
27
|
+
* Flow metadata resolved ahead of time (e.g. fetched server-side during SSR) and used to seed
|
|
28
|
+
* the provider's state. When present, the provider skips its own initial client-side fetch —
|
|
29
|
+
* avoiding a redundant request and the flash of untranslated i18n keys while that fetch is in
|
|
30
|
+
* flight — but still fetches normally on subsequent changes (e.g. an explicit language switch).
|
|
31
|
+
*/
|
|
32
|
+
initialMeta?: FlowMetadataResponse | null;
|
|
25
33
|
}
|
|
26
34
|
/**
|
|
27
35
|
* FlowMetaProvider fetches flow metadata from the `GET /flow/meta` endpoint
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowMetaProvider.d.ts","sourceRoot":"","sources":["../../../src/contexts/FlowMeta/FlowMetaProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;
|
|
1
|
+
{"version":3,"file":"FlowMetaProvider.d.ts","sourceRoot":"","sources":["../../../src/contexts/FlowMeta/FlowMetaProvider.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,OAAO,EACL,oBAAoB,EAKrB,MAAM,oBAAoB,CAAC;AAC5B,OAAO,EAAC,EAAE,EAAE,iBAAiB,EAAoE,MAAM,OAAO,CAAC;AAM/G,MAAM,WAAW,qBAAqB;IACpC;;;OAGG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAElB;;;;;OAKG;IACH,WAAW,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;CAC3C;AAED;;;;;;;;;;;;;;;;;;;;;;GAsBG;AACH,QAAA,MAAM,gBAAgB,EAAE,EAAE,CAAC,iBAAiB,CAAC,qBAAqB,CAAC,CAuKlE,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -29,14 +29,15 @@ import { jsx } from "react/jsx-runtime";
|
|
|
29
29
|
* </FlowMetaProvider>
|
|
30
30
|
* ```
|
|
31
31
|
*/
|
|
32
|
-
const FlowMetaProvider = ({ children, enabled = true }) => {
|
|
32
|
+
const FlowMetaProvider = ({ children, enabled = true, initialMeta = null }) => {
|
|
33
33
|
const { baseUrl, applicationId, isInitialized } = useThunderID_default();
|
|
34
34
|
const i18nContext = useI18n_default();
|
|
35
|
-
const [meta, setMeta] = useState(
|
|
36
|
-
const [isLoading, setIsLoading] = useState(
|
|
35
|
+
const [meta, setMeta] = useState(initialMeta);
|
|
36
|
+
const [isLoading, setIsLoading] = useState(!initialMeta);
|
|
37
37
|
const [error, setError] = useState(null);
|
|
38
38
|
const [pendingLanguage, setPendingLanguage] = useState(null);
|
|
39
39
|
const lastFetchedRef = useRef(null);
|
|
40
|
+
const initialMetaConsumedRef = useRef(false);
|
|
40
41
|
const fetchFlowMeta = useCallback(async () => {
|
|
41
42
|
if (!enabled) {
|
|
42
43
|
setMeta(null);
|
|
@@ -110,6 +111,13 @@ const FlowMetaProvider = ({ children, enabled = true }) => {
|
|
|
110
111
|
}
|
|
111
112
|
}, [pendingLanguage, i18nContext?.setLanguage]);
|
|
112
113
|
useEffect(() => {
|
|
114
|
+
if (!initialMetaConsumedRef.current) {
|
|
115
|
+
initialMetaConsumedRef.current = true;
|
|
116
|
+
if (initialMeta) {
|
|
117
|
+
lastFetchedRef.current = fetchFlowMeta;
|
|
118
|
+
return;
|
|
119
|
+
}
|
|
120
|
+
}
|
|
113
121
|
if (lastFetchedRef.current === fetchFlowMeta) return;
|
|
114
122
|
lastFetchedRef.current = fetchFlowMeta;
|
|
115
123
|
fetchFlowMeta();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"FlowMetaProvider.js","names":["FlowMetaProvider: FC<PropsWithChildren<FlowMetaProviderProps>>","useThunderID","i18nContext: I18nContextValue","useI18n","lastFetchedRef: RefObject<(() => Promise<void>) | null>","fetchFlowMeta: () => Promise<void>","err: unknown","switchLanguage: (language: string) => Promise<void>","result: FlowMetadataResponse","flatTranslations: Record<string, string>","value","bundle: I18nBundle","metaLanguage: string","bundlesToInject: Record<string, I18nBundle>","value: any","FlowMetaContext"],"sources":["../../../src/contexts/FlowMeta/FlowMetaProvider.tsx"],"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 {\n FlowMetadataResponse,\n FlowMetaType,\n getFlowMeta,\n I18nBundle,\n TranslationBundleConstants,\n} from '@thunderid/browser';\nimport {FC, PropsWithChildren, ReactElement, RefObject, useCallback, useEffect, useRef, useState} from 'react';\nimport FlowMetaContext from './FlowMetaContext';\nimport {I18nContextValue} from '../I18n/I18nContext';\nimport useI18n from '../I18n/useI18n';\nimport useThunderID from '../ThunderID/useThunderID';\n\nexport interface FlowMetaProviderProps {\n /**\n * When false the provider skips fetching and provides null meta.\n * @default true\n */\n enabled?: boolean;\n}\n\n/**\n * FlowMetaProvider fetches flow metadata from the `GET /flow/meta` endpoint\n * (v2 API) and makes it available to child components through `FlowMetaContext`.\n *\n * It is designed to be used in v2 embedded-flow scenarios and integrates with\n * `ThemeProvider` so that theme settings (colors, direction, typography, …)\n * from the server-side design configuration are applied automatically.\n *\n * @example\n * ```tsx\n * <FlowMetaProvider\n * config={{\n * baseUrl: 'https://localhost:8090',\n * type: FlowMetaType.App,\n * id: 'your-app-id',\n * }}\n * >\n * <ThemeProvider>\n * <App />\n * </ThemeProvider>\n * </FlowMetaProvider>\n * ```\n */\nconst FlowMetaProvider: FC<PropsWithChildren<FlowMetaProviderProps>> = ({\n children,\n enabled = true,\n}: PropsWithChildren<FlowMetaProviderProps>): ReactElement => {\n const {baseUrl, applicationId, isInitialized} = useThunderID();\n const i18nContext: I18nContextValue = useI18n();\n\n const [meta, setMeta] = useState<FlowMetadataResponse | null>(null);\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [error, setError] = useState<Error | null>(null);\n const [pendingLanguage, setPendingLanguage] = useState<string | null>(null);\n\n // Track the last fetchFlowMeta reference that was actually dispatched.\n // This prevents two classes of double-fetch:\n // 1. React StrictMode simulates unmount+remount — the re-mount fires the\n // effect again with the same fetchFlowMeta reference; without this guard\n // the else-branch would issue a redundant second network request.\n // 2. Rapid dependency changes (e.g. baseUrl stabilising) that produce two\n // effect firings before the first fetch completes.\n const lastFetchedRef: RefObject<(() => Promise<void>) | null> = useRef<(() => Promise<void>) | null>(null);\n const fetchFlowMeta: () => Promise<void> = useCallback(async (): Promise<void> => {\n if (!enabled) {\n setMeta(null);\n setIsLoading(false);\n return;\n }\n\n // Defer until ThunderID finishes initializing (e.g. loading applicationId\n // from storage on refresh). Once initialized, proceed even if applicationId\n // is absent — some flows (e.g. AcceptInvite) have no applicationId by design.\n if (!isInitialized && !applicationId) {\n return;\n }\n\n setIsLoading(true);\n setError(null);\n\n try {\n const result: FlowMetadataResponse = await getFlowMeta({\n baseUrl,\n ...(applicationId ? {id: applicationId, type: FlowMetaType.App} : {}),\n language: i18nContext?.currentLanguage,\n });\n setMeta(result);\n } catch (err: unknown) {\n setError(err instanceof Error ? err : new Error(String(err)));\n } finally {\n setIsLoading(false);\n }\n }, [enabled, baseUrl, applicationId, isInitialized, i18nContext?.currentLanguage]);\n\n const switchLanguage: (language: string) => Promise<void> = useCallback(\n async (language: string): Promise<void> => {\n if (!enabled) return;\n\n setIsLoading(true);\n setError(null);\n\n try {\n const result: FlowMetadataResponse = await getFlowMeta({\n baseUrl,\n ...(applicationId ? {id: applicationId, type: FlowMetaType.App} : {}),\n language,\n });\n\n // Inject translations for the new language before switching\n if (result.i18n?.translations && i18nContext?.injectBundles) {\n const flatTranslations: Record<string, string> = {};\n Object.entries(result.i18n.translations).forEach(([namespace, keys]: [string, Record<string, string>]) => {\n Object.entries(keys).forEach(([key, value]: [string, string]) => {\n flatTranslations[`${namespace}.${key}`] = value;\n });\n });\n const bundle: I18nBundle = {translations: flatTranslations} as unknown as I18nBundle;\n i18nContext.injectBundles({[language]: bundle});\n }\n\n // Defer setLanguage to the next effect cycle so injectBundles state\n // is committed before I18nProvider's setLanguage checks mergedBundles.\n setPendingLanguage(language);\n setMeta(result);\n } catch (err: unknown) {\n setError(err instanceof Error ? err : new Error(String(err)));\n } finally {\n setIsLoading(false);\n }\n },\n [enabled, baseUrl, applicationId, i18nContext],\n );\n\n // After injectBundles + setPendingLanguage are batched and committed, this\n // effect fires with the updated i18nContext (mergedBundles now includes the\n // new language), so setLanguage succeeds on the first switch.\n useEffect(() => {\n if (pendingLanguage && i18nContext?.setLanguage) {\n i18nContext.setLanguage(pendingLanguage);\n setPendingLanguage(null);\n }\n }, [pendingLanguage, i18nContext?.setLanguage]);\n\n useEffect(() => {\n if (lastFetchedRef.current === fetchFlowMeta) {\n // Same reference as the last dispatch — this is a StrictMode re-mount\n // or an effect re-fire with unchanged deps. Skip to avoid a duplicate fetch.\n return;\n }\n\n lastFetchedRef.current = fetchFlowMeta;\n fetchFlowMeta();\n }, [fetchFlowMeta]);\n\n // When meta loads with i18n translations, inject them into the i18n system.\n // Meta translations act as the base layer — prop-provided bundles still take precedence.\n useEffect(() => {\n if (!meta?.i18n?.translations || !i18nContext?.injectBundles) {\n return;\n }\n\n const metaLanguage: string = meta.i18n.language || TranslationBundleConstants.FALLBACK_LOCALE;\n\n // Flatten namespace-keyed translations to dot-path keys:\n // { \"signin\": { \"heading\": \"Sign In\" } } → { \"signin.heading\": \"Sign In\" }\n const flatTranslations: Record<string, string> = {};\n Object.entries(meta.i18n.translations).forEach(([namespace, keys]: [string, Record<string, string>]) => {\n Object.entries(keys).forEach(([key, value]: [string, string]) => {\n flatTranslations[`${namespace}.${key}`] = value;\n });\n });\n\n const bundle: I18nBundle = {translations: flatTranslations} as unknown as I18nBundle;\n\n // Inject under the meta language code and the i18n current language so\n // lookups succeed regardless of whether the system uses \"en\" or \"en-US\".\n const bundlesToInject: Record<string, I18nBundle> = {[metaLanguage]: bundle};\n if (i18nContext.currentLanguage && i18nContext.currentLanguage !== metaLanguage) {\n bundlesToInject[i18nContext.currentLanguage] = bundle;\n }\n if (i18nContext.fallbackLanguage && i18nContext.fallbackLanguage !== metaLanguage) {\n bundlesToInject[i18nContext.fallbackLanguage] = bundle;\n }\n\n i18nContext.injectBundles(bundlesToInject);\n }, [meta?.i18n?.translations, i18nContext?.injectBundles]);\n\n const value: any = {\n error,\n fetchFlowMeta,\n isLoading,\n meta,\n switchLanguage,\n };\n\n return <FlowMetaContext.Provider value={value}>{children}</FlowMetaContext.Provider>;\n};\n\nexport default FlowMetaProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,MAAMA,oBAAkE,EACtE,UACA,UAAU,WACkD;CAC5D,MAAM,EAAC,SAAS,eAAe,kBAAiBC,sBAAc;CAC9D,MAAMC,cAAgCC,iBAAS;CAE/C,MAAM,CAAC,MAAM,WAAW,SAAsC,KAAK;CACnE,MAAM,CAAC,WAAW,gBAAgB,SAAkB,KAAK;CACzD,MAAM,CAAC,OAAO,YAAY,SAAuB,KAAK;CACtD,MAAM,CAAC,iBAAiB,sBAAsB,SAAwB,KAAK;CAS3E,MAAMC,iBAA0D,OAAqC,KAAK;CAC1G,MAAMC,gBAAqC,YAAY,YAA2B;AAChF,MAAI,CAAC,SAAS;AACZ,WAAQ,KAAK;AACb,gBAAa,MAAM;AACnB;;AAMF,MAAI,CAAC,iBAAiB,CAAC,cACrB;AAGF,eAAa,KAAK;AAClB,WAAS,KAAK;AAEd,MAAI;AAMF,WALqC,MAAM,YAAY;IACrD;IACA,GAAI,gBAAgB;KAAC,IAAI;KAAe,MAAM,aAAa;KAAI,GAAG,EAAE;IACpE,UAAU,aAAa;IACxB,CAAC,CACa;WACRC,KAAc;AACrB,YAAS,eAAe,QAAQ,MAAM,IAAI,MAAM,OAAO,IAAI,CAAC,CAAC;YACrD;AACR,gBAAa,MAAM;;IAEpB;EAAC;EAAS;EAAS;EAAe;EAAe,aAAa;EAAgB,CAAC;CAElF,MAAMC,iBAAsD,YAC1D,OAAO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aAA6B;AAC/D,qBAAiB,GAAG,UAAU,GAAG,SAASA;KAC1C;IACF;EAEF,MAAMC,SAAqB,EAAC,cAAc,kBAAiB;EAI3D,MAAME,kBAA8C,GAAE,eAAe,QAAO;AAC5E,MAAI,YAAY,mBAAmB,YAAY,oBAAoB,aACjE,iBAAgB,YAAY,mBAAmB;AAEjD,MAAI,YAAY,oBAAoB,YAAY,qBAAqB,aACnE,iBAAgB,YAAY,oBAAoB;AAGlD,cAAY,cAAc,gBAAgB;IACzC,CAAC,MAAM,MAAM,cAAc,aAAa,cAAc,CAAC;CAE1D,MAAMC,QAAa;EACjB;EACA;EACA;EACA;EACA;EACD;AAED,QAAO,oBAACC,wBAAgB;EAAgB;EAAQ;GAAoC;;AAGtF,+BAAe"}
|
|
1
|
+
{"version":3,"file":"FlowMetaProvider.js","names":["FlowMetaProvider: FC<PropsWithChildren<FlowMetaProviderProps>>","useThunderID","i18nContext: I18nContextValue","useI18n","lastFetchedRef: RefObject<(() => Promise<void>) | null>","initialMetaConsumedRef: RefObject<boolean>","fetchFlowMeta: () => Promise<void>","err: unknown","switchLanguage: (language: string) => Promise<void>","result: FlowMetadataResponse","flatTranslations: Record<string, string>","value","bundle: I18nBundle","metaLanguage: string","bundlesToInject: Record<string, I18nBundle>","value: any","FlowMetaContext"],"sources":["../../../src/contexts/FlowMeta/FlowMetaProvider.tsx"],"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 {\n FlowMetadataResponse,\n FlowMetaType,\n getFlowMeta,\n I18nBundle,\n TranslationBundleConstants,\n} from '@thunderid/browser';\nimport {FC, PropsWithChildren, ReactElement, RefObject, useCallback, useEffect, useRef, useState} from 'react';\nimport FlowMetaContext from './FlowMetaContext';\nimport {I18nContextValue} from '../I18n/I18nContext';\nimport useI18n from '../I18n/useI18n';\nimport useThunderID from '../ThunderID/useThunderID';\n\nexport interface FlowMetaProviderProps {\n /**\n * When false the provider skips fetching and provides null meta.\n * @default true\n */\n enabled?: boolean;\n\n /**\n * Flow metadata resolved ahead of time (e.g. fetched server-side during SSR) and used to seed\n * the provider's state. When present, the provider skips its own initial client-side fetch —\n * avoiding a redundant request and the flash of untranslated i18n keys while that fetch is in\n * flight — but still fetches normally on subsequent changes (e.g. an explicit language switch).\n */\n initialMeta?: FlowMetadataResponse | null;\n}\n\n/**\n * FlowMetaProvider fetches flow metadata from the `GET /flow/meta` endpoint\n * (v2 API) and makes it available to child components through `FlowMetaContext`.\n *\n * It is designed to be used in v2 embedded-flow scenarios and integrates with\n * `ThemeProvider` so that theme settings (colors, direction, typography, …)\n * from the server-side design configuration are applied automatically.\n *\n * @example\n * ```tsx\n * <FlowMetaProvider\n * config={{\n * baseUrl: 'https://localhost:8090',\n * type: FlowMetaType.App,\n * id: 'your-app-id',\n * }}\n * >\n * <ThemeProvider>\n * <App />\n * </ThemeProvider>\n * </FlowMetaProvider>\n * ```\n */\nconst FlowMetaProvider: FC<PropsWithChildren<FlowMetaProviderProps>> = ({\n children,\n enabled = true,\n initialMeta = null,\n}: PropsWithChildren<FlowMetaProviderProps>): ReactElement => {\n const {baseUrl, applicationId, isInitialized} = useThunderID();\n const i18nContext: I18nContextValue = useI18n();\n\n const [meta, setMeta] = useState<FlowMetadataResponse | null>(initialMeta);\n const [isLoading, setIsLoading] = useState<boolean>(!initialMeta);\n const [error, setError] = useState<Error | null>(null);\n const [pendingLanguage, setPendingLanguage] = useState<string | null>(null);\n\n // Track the last fetchFlowMeta reference that was actually dispatched.\n // This prevents two classes of double-fetch:\n // 1. React StrictMode simulates unmount+remount — the re-mount fires the\n // effect again with the same fetchFlowMeta reference; without this guard\n // the else-branch would issue a redundant second network request.\n // 2. Rapid dependency changes (e.g. baseUrl stabilising) that produce two\n // effect firings before the first fetch completes.\n const lastFetchedRef: RefObject<(() => Promise<void>) | null> = useRef<(() => Promise<void>) | null>(null);\n const initialMetaConsumedRef: RefObject<boolean> = useRef(false);\n const fetchFlowMeta: () => Promise<void> = useCallback(async (): Promise<void> => {\n if (!enabled) {\n setMeta(null);\n setIsLoading(false);\n return;\n }\n\n // Defer until ThunderID finishes initializing (e.g. loading applicationId\n // from storage on refresh). Once initialized, proceed even if applicationId\n // is absent — some flows (e.g. AcceptInvite) have no applicationId by design.\n if (!isInitialized && !applicationId) {\n return;\n }\n\n setIsLoading(true);\n setError(null);\n\n try {\n const result: FlowMetadataResponse = await getFlowMeta({\n baseUrl,\n ...(applicationId ? {id: applicationId, type: FlowMetaType.App} : {}),\n language: i18nContext?.currentLanguage,\n });\n setMeta(result);\n } catch (err: unknown) {\n setError(err instanceof Error ? err : new Error(String(err)));\n } finally {\n setIsLoading(false);\n }\n }, [enabled, baseUrl, applicationId, isInitialized, i18nContext?.currentLanguage]);\n\n const switchLanguage: (language: string) => Promise<void> = useCallback(\n async (language: string): Promise<void> => {\n if (!enabled) return;\n\n setIsLoading(true);\n setError(null);\n\n try {\n const result: FlowMetadataResponse = await getFlowMeta({\n baseUrl,\n ...(applicationId ? {id: applicationId, type: FlowMetaType.App} : {}),\n language,\n });\n\n // Inject translations for the new language before switching\n if (result.i18n?.translations && i18nContext?.injectBundles) {\n const flatTranslations: Record<string, string> = {};\n Object.entries(result.i18n.translations).forEach(([namespace, keys]: [string, Record<string, string>]) => {\n Object.entries(keys).forEach(([key, value]: [string, string]) => {\n flatTranslations[`${namespace}.${key}`] = value;\n });\n });\n const bundle: I18nBundle = {translations: flatTranslations} as unknown as I18nBundle;\n i18nContext.injectBundles({[language]: bundle});\n }\n\n // Defer setLanguage to the next effect cycle so injectBundles state\n // is committed before I18nProvider's setLanguage checks mergedBundles.\n setPendingLanguage(language);\n setMeta(result);\n } catch (err: unknown) {\n setError(err instanceof Error ? err : new Error(String(err)));\n } finally {\n setIsLoading(false);\n }\n },\n [enabled, baseUrl, applicationId, i18nContext],\n );\n\n // After injectBundles + setPendingLanguage are batched and committed, this\n // effect fires with the updated i18nContext (mergedBundles now includes the\n // new language), so setLanguage succeeds on the first switch.\n useEffect(() => {\n if (pendingLanguage && i18nContext?.setLanguage) {\n i18nContext.setLanguage(pendingLanguage);\n setPendingLanguage(null);\n }\n }, [pendingLanguage, i18nContext?.setLanguage]);\n\n useEffect(() => {\n if (!initialMetaConsumedRef.current) {\n initialMetaConsumedRef.current = true;\n\n if (initialMeta) {\n // Seeded from SSR (or another caller) — skip the redundant first client-side fetch.\n // Later dependency changes (e.g. an explicit language switch) still fetch normally.\n lastFetchedRef.current = fetchFlowMeta;\n return;\n }\n }\n\n if (lastFetchedRef.current === fetchFlowMeta) {\n // Same reference as the last dispatch — this is a StrictMode re-mount\n // or an effect re-fire with unchanged deps. Skip to avoid a duplicate fetch.\n return;\n }\n\n lastFetchedRef.current = fetchFlowMeta;\n fetchFlowMeta();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [fetchFlowMeta]);\n\n // When meta loads with i18n translations, inject them into the i18n system.\n // Meta translations act as the base layer — prop-provided bundles still take precedence.\n useEffect(() => {\n if (!meta?.i18n?.translations || !i18nContext?.injectBundles) {\n return;\n }\n\n const metaLanguage: string = meta.i18n.language || TranslationBundleConstants.FALLBACK_LOCALE;\n\n // Flatten namespace-keyed translations to dot-path keys:\n // { \"signin\": { \"heading\": \"Sign In\" } } → { \"signin.heading\": \"Sign In\" }\n const flatTranslations: Record<string, string> = {};\n Object.entries(meta.i18n.translations).forEach(([namespace, keys]: [string, Record<string, string>]) => {\n Object.entries(keys).forEach(([key, value]: [string, string]) => {\n flatTranslations[`${namespace}.${key}`] = value;\n });\n });\n\n const bundle: I18nBundle = {translations: flatTranslations} as unknown as I18nBundle;\n\n // Inject under the meta language code and the i18n current language so\n // lookups succeed regardless of whether the system uses \"en\" or \"en-US\".\n const bundlesToInject: Record<string, I18nBundle> = {[metaLanguage]: bundle};\n if (i18nContext.currentLanguage && i18nContext.currentLanguage !== metaLanguage) {\n bundlesToInject[i18nContext.currentLanguage] = bundle;\n }\n if (i18nContext.fallbackLanguage && i18nContext.fallbackLanguage !== metaLanguage) {\n bundlesToInject[i18nContext.fallbackLanguage] = bundle;\n }\n\n i18nContext.injectBundles(bundlesToInject);\n }, [meta?.i18n?.translations, i18nContext?.injectBundles]);\n\n const value: any = {\n error,\n fetchFlowMeta,\n isLoading,\n meta,\n switchLanguage,\n };\n\n return <FlowMetaContext.Provider value={value}>{children}</FlowMetaContext.Provider>;\n};\n\nexport default FlowMetaProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsEA,MAAMA,oBAAkE,EACtE,UACA,UAAU,MACV,cAAc,WAC8C;CAC5D,MAAM,EAAC,SAAS,eAAe,kBAAiBC,sBAAc;CAC9D,MAAMC,cAAgCC,iBAAS;CAE/C,MAAM,CAAC,MAAM,WAAW,SAAsC,YAAY;CAC1E,MAAM,CAAC,WAAW,gBAAgB,SAAkB,CAAC,YAAY;CACjE,MAAM,CAAC,OAAO,YAAY,SAAuB,KAAK;CACtD,MAAM,CAAC,iBAAiB,sBAAsB,SAAwB,KAAK;CAS3E,MAAMC,iBAA0D,OAAqC,KAAK;CAC1G,MAAMC,yBAA6C,OAAO,MAAM;CAChE,MAAMC,gBAAqC,YAAY,YAA2B;AAChF,MAAI,CAAC,SAAS;AACZ,WAAQ,KAAK;AACb,gBAAa,MAAM;AACnB;;AAMF,MAAI,CAAC,iBAAiB,CAAC,cACrB;AAGF,eAAa,KAAK;AAClB,WAAS,KAAK;AAEd,MAAI;AAMF,WALqC,MAAM,YAAY;IACrD;IACA,GAAI,gBAAgB;KAAC,IAAI;KAAe,MAAM,aAAa;KAAI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AI,eAAe,YAAY,cAG7B;AAGF,iBAAe,UAAU;AACzB,iBAAe;IAEd,CAAC,cAAc,CAAC;AAInB,iBAAgB;AACd,MAAI,CAAC,MAAM,MAAM,gBAAgB,CAAC,aAAa,cAC7C;EAGF,MAAMM,eAAuB,KAAK,KAAK,YAAY,2BAA2B;EAI9E,MAAMH,mBAA2C,EAAE;AACnD,SAAO,QAAQ,KAAK,KAAK,aAAa,CAAC,SAAS,CAAC,WAAW,UAA4C;AACtG,UAAO,QAAQ,KAAK,CAAC,SAAS,CAAC,KAAKC,aAA6B;AAC/D,qBAAiB,GAAG,UAAU,GAAG,SAASA;KAC1C;IACF;EAEF,MAAMC,SAAqB,EAAC,cAAc,kBAAiB;EAI3D,MAAME,kBAA8C,GAAE,eAAe,QAAO;AAC5E,MAAI,YAAY,mBAAmB,YAAY,oBAAoB,aACjE,iBAAgB,YAAY,mBAAmB;AAEjD,MAAI,YAAY,oBAAoB,YAAY,qBAAqB,aACnE,iBAAgB,YAAY,oBAAoB;AAGlD,cAAY,cAAc,gBAAgB;IACzC,CAAC,MAAM,MAAM,cAAc,aAAa,cAAc,CAAC;CAE1D,MAAMC,QAAa;EACjB;EACA;EACA;EACA;EACA;EACD;AAED,QAAO,oBAACC,wBAAgB;EAAgB;EAAQ;GAAoC;;AAGtF,+BAAe"}
|
package/dist/index.d.ts
CHANGED
|
@@ -46,6 +46,7 @@ export { default as useBrowserUrl } from './hooks/useBrowserUrl';
|
|
|
46
46
|
export * from './hooks/useBrowserUrl';
|
|
47
47
|
export { default as useTranslation } from './hooks/useTranslation';
|
|
48
48
|
export * from './hooks/useTranslation';
|
|
49
|
+
export { normalizeFlowResponse, extractErrorMessage } from './utils/flowTransformer';
|
|
49
50
|
export { default as useForm } from './hooks/useForm';
|
|
50
51
|
export { default as BaseSignInButton } from './components/actions/SignInButton/BaseSignInButton';
|
|
51
52
|
export * from './components/actions/SignInButton/BaseSignInButton';
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 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B,CAAC;AACzD,cAAc,kBAAkB,CAAC;AAEjC,OAAO,EACL,qBAAqB,EACrB,IAAI,EACJ,cAAc,EACd,QAAQ,EACR,sBAAsB,EACtB,UAAU,EACV,gBAAgB,EAChB,mBAAmB,EACnB,WAAW,EACX,2BAA2B,EAC3B,sBAAsB,EACtB,wBAAwB,EACxB,kBAAkB,EAClB,yBAAyB,EACzB,yBAAyB,EACzB,uBAAuB,EACvB,qBAAqB,EACrB,KAAK,qBAAqB,EAC1B,KAAK,wBAAwB,EAC7B,KAAK,gCAAgC,EACrC,wBAAwB,EACxB,sBAAsB,EACtB,KAAK,kCAAkC,EACvC,KAAK,0BAA0B,EAC/B,KAAK,kCAAkC,EACvC,KAAK,iCAAiC,EACtC,KAAK,yBAAyB,EAC9B,wBAAwB,EACxB,sBAAsB,EACtB,KAAK,kCAAkC,EACvC,KAAK,0BAA0B,EAC/B,KAAK,kCAAkC,EACvC,KAAK,iCAAiC,EACtC,KAAK,yBAAyB,EAC9B,KAAK,+BAA+B,EACpC,KAAK,sBAAsB,EAC3B,KAAK,oBAAoB,EACzB,KAAK,iBAAiB,EACtB,0BAA0B,EAC1B,wBAAwB,EACxB,KAAK,4BAA4B,EACjC,KAAK,mCAAmC,EACxC,KAAK,2BAA2B,EAChC,KAAK,iCAAiC,GACvC,MAAM,oBAAoB,CAAC"}
|
package/dist/index.js
CHANGED
|
@@ -16,6 +16,7 @@ import useUser_default from "./contexts/User/useUser.js";
|
|
|
16
16
|
import useFlow_default from "./contexts/Flow/useFlow.js";
|
|
17
17
|
import useTheme_default from "./contexts/Theme/useTheme.js";
|
|
18
18
|
import useTranslation_default from "./hooks/useTranslation.js";
|
|
19
|
+
import { extractErrorMessage, normalizeFlowResponse } from "./utils/flowTransformer.js";
|
|
19
20
|
import useForm_default from "./hooks/useForm.js";
|
|
20
21
|
import Spinner_default from "./components/primitives/Spinner/Spinner.js";
|
|
21
22
|
import Button_default from "./components/primitives/Button/Button.js";
|
|
@@ -91,4 +92,4 @@ import BuildingAlt_default from "./components/primitives/Icons/BuildingAlt.js";
|
|
|
91
92
|
import getScim2Me_default from "./api/getScim2Me.js";
|
|
92
93
|
import { EMOJI_URI_SCHEME, EmbeddedFlowActionVariant, EmbeddedFlowComponentType, EmbeddedFlowEventType, EmbeddedFlowTextVariant, EmbeddedRecoveryFlowStatus, EmbeddedRecoveryFlowType, EmbeddedSignInFlowStatus, EmbeddedSignInFlowType, EmbeddedSignUpFlowStatus, EmbeddedSignUpFlowType, ThunderIDRuntimeError, countryCodeToFlagEmoji, extractEmojiFromUri, getActiveTheme, http, isEmojiUri, navigate, resolveEmojiUrisInHtml, resolveFlowTemplateLiterals, resolveLocaleDisplayName, resolveLocaleEmoji, resolveMeta } from "@thunderid/browser";
|
|
93
94
|
|
|
94
|
-
export { AcceptInvite_default as AcceptInvite, Alert_default as Alert, BaseAcceptInvite_default as BaseAcceptInvite, BaseInviteUser_default as BaseInviteUser, BaseLanguageSwitcher_default as BaseLanguageSwitcher, BaseRecovery_default as BaseRecovery, BaseSignIn_default as BaseSignIn, BaseSignInButton_default as BaseSignInButton, BaseSignOutButton_default as BaseSignOutButton, BaseSignUp_default as BaseSignUp, BaseSignUpButton_default as BaseSignUpButton, BaseUser_default as BaseUser, BaseUserAvatar_default as BaseUserAvatar, BaseUserDropdown_default as BaseUserDropdown, BaseUserProfile_default as BaseUserProfile, BuildingAlt_default as BuildingAlt, Button_default as Button, Callback, Card_default as Card, Checkbox_default as Checkbox, CircleAlert_default as CircleAlert, CircleCheck_default as CircleCheck, Consent_default as Consent, ConsentCheckboxList_default as ConsentCheckboxList, DatePicker_default as DatePicker, Divider_default as Divider, EMOJI_URI_SCHEME, EmbeddedFlowActionVariant, EmbeddedFlowComponentType, EmbeddedFlowEventType, EmbeddedFlowTextVariant, EmbeddedRecoveryFlowStatus, EmbeddedRecoveryFlowType, EmbeddedSignInFlowStatus, EmbeddedSignInFlowType, EmbeddedSignUpFlowStatus, EmbeddedSignUpFlowType, Eye_default as Eye, EyeOff_default as EyeOff, FacebookButton_default as FacebookButton, FieldFactory, FlowContext_default as FlowContext, FlowMetaProvider_default as FlowMetaProvider, FlowProvider_default as FlowProvider, FlowTimer_default as FlowTimer, FormControl_default as FormControl, GitHubButton_default as GitHubButton, GoogleButton_default as GoogleButton, I18nContext_default as I18nContext, I18nProvider_default as I18nProvider, Info_default as Info, InputLabel_default as InputLabel, InviteUser_default as InviteUser, KeyValueInput_default as KeyValueInput, LanguageSwitcher_default as LanguageSwitcher, LinkedInButton_default as LinkedInButton, Loading_default as Loading, LogOut_default as LogOut, Logo_default as Logo, MicrosoftButton_default as MicrosoftButton, MultiInput_default as MultiInput, OAuthCallback, OtpField_default as OtpField, PasswordField_default as PasswordField, Recovery_default as Recovery, Select_default as Select, SignIn_default as SignIn, SignInButton_default as SignInButton, SignInWithEthereumButton_default as SignInWithEthereumButton, SignOutButton_default as SignOutButton, SignUp_default as SignUp, SignUpButton_default as SignUpButton, SignedIn_default as SignedIn, SignedOut_default as SignedOut, Spinner_default as Spinner, TextField_default as TextField, ThemeContext_default as ThemeContext, ThemeProvider_default as ThemeProvider, ThunderIDContext_default as ThunderIDContext, ThunderIDProvider_default as ThunderIDProvider, ThunderIDRuntimeError, Toggle_default as Toggle, TokenCallback, TriangleAlert_default as TriangleAlert, Typography_default as Typography, User_default as User, UserAvatar_default as UserAvatar, UserContext_default as UserContext, UserDropdown_default as UserDropdown, User_default$1 as UserIcon, UserProfile_default as UserProfile, UserProvider_default as UserProvider, countryCodeToFlagEmoji, createField, extractEmojiFromUri, getActiveTheme, getConsentOptionalKey, getScim2Me_default as getMeProfile, http, isEmojiUri, navigate, resolveEmojiUrisInHtml, resolveFlowTemplateLiterals, resolveLocaleDisplayName, resolveLocaleEmoji, resolveMeta, updateMeProfile_default as updateMeProfile, useBrowserUrl_default as useBrowserUrl, useFlow_default as useFlow, useForm_default as useForm, useI18n_default as useI18n, useOAuthCallback, useTheme_default as useTheme, useThunderID_default as useThunderID, useTranslation_default as useTranslation, useUser_default as useUser, validateFieldValue };
|
|
95
|
+
export { AcceptInvite_default as AcceptInvite, Alert_default as Alert, BaseAcceptInvite_default as BaseAcceptInvite, BaseInviteUser_default as BaseInviteUser, BaseLanguageSwitcher_default as BaseLanguageSwitcher, BaseRecovery_default as BaseRecovery, BaseSignIn_default as BaseSignIn, BaseSignInButton_default as BaseSignInButton, BaseSignOutButton_default as BaseSignOutButton, BaseSignUp_default as BaseSignUp, BaseSignUpButton_default as BaseSignUpButton, BaseUser_default as BaseUser, BaseUserAvatar_default as BaseUserAvatar, BaseUserDropdown_default as BaseUserDropdown, BaseUserProfile_default as BaseUserProfile, BuildingAlt_default as BuildingAlt, Button_default as Button, Callback, Card_default as Card, Checkbox_default as Checkbox, CircleAlert_default as CircleAlert, CircleCheck_default as CircleCheck, Consent_default as Consent, ConsentCheckboxList_default as ConsentCheckboxList, DatePicker_default as DatePicker, Divider_default as Divider, EMOJI_URI_SCHEME, EmbeddedFlowActionVariant, EmbeddedFlowComponentType, EmbeddedFlowEventType, EmbeddedFlowTextVariant, EmbeddedRecoveryFlowStatus, EmbeddedRecoveryFlowType, EmbeddedSignInFlowStatus, EmbeddedSignInFlowType, EmbeddedSignUpFlowStatus, EmbeddedSignUpFlowType, Eye_default as Eye, EyeOff_default as EyeOff, FacebookButton_default as FacebookButton, FieldFactory, FlowContext_default as FlowContext, FlowMetaProvider_default as FlowMetaProvider, FlowProvider_default as FlowProvider, FlowTimer_default as FlowTimer, FormControl_default as FormControl, GitHubButton_default as GitHubButton, GoogleButton_default as GoogleButton, I18nContext_default as I18nContext, I18nProvider_default as I18nProvider, Info_default as Info, InputLabel_default as InputLabel, InviteUser_default as InviteUser, KeyValueInput_default as KeyValueInput, LanguageSwitcher_default as LanguageSwitcher, LinkedInButton_default as LinkedInButton, Loading_default as Loading, LogOut_default as LogOut, Logo_default as Logo, MicrosoftButton_default as MicrosoftButton, MultiInput_default as MultiInput, OAuthCallback, OtpField_default as OtpField, PasswordField_default as PasswordField, Recovery_default as Recovery, Select_default as Select, SignIn_default as SignIn, SignInButton_default as SignInButton, SignInWithEthereumButton_default as SignInWithEthereumButton, SignOutButton_default as SignOutButton, SignUp_default as SignUp, SignUpButton_default as SignUpButton, SignedIn_default as SignedIn, SignedOut_default as SignedOut, Spinner_default as Spinner, TextField_default as TextField, ThemeContext_default as ThemeContext, ThemeProvider_default as ThemeProvider, ThunderIDContext_default as ThunderIDContext, ThunderIDProvider_default as ThunderIDProvider, ThunderIDRuntimeError, Toggle_default as Toggle, TokenCallback, TriangleAlert_default as TriangleAlert, Typography_default as Typography, User_default as User, UserAvatar_default as UserAvatar, UserContext_default as UserContext, UserDropdown_default as UserDropdown, User_default$1 as UserIcon, UserProfile_default as UserProfile, UserProvider_default as UserProvider, countryCodeToFlagEmoji, createField, extractEmojiFromUri, extractErrorMessage, getActiveTheme, getConsentOptionalKey, getScim2Me_default as getMeProfile, http, isEmojiUri, navigate, normalizeFlowResponse, resolveEmojiUrisInHtml, resolveFlowTemplateLiterals, resolveLocaleDisplayName, resolveLocaleEmoji, resolveMeta, updateMeProfile_default as updateMeProfile, useBrowserUrl_default as useBrowserUrl, useFlow_default as useFlow, useForm_default as useForm, useI18n_default as useI18n, useOAuthCallback, useTheme_default as useTheme, useThunderID_default as useThunderID, useTranslation_default as useTranslation, useUser_default as useUser, validateFieldValue };
|