@thunderid/react 1.3.3 → 1.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/cjs/components/presentation/ChangeCredential/BaseChangeCredential.cjs +1 -1
- package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.cjs +1 -1
- package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs +56 -17
- package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.cjs +21 -5
- package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.cjs.map +1 -1
- package/dist/cjs/components/presentation/auth/InviteUser/InviteUser.cjs +6 -0
- package/dist/cjs/components/presentation/auth/InviteUser/InviteUser.cjs.map +1 -1
- package/dist/cjs/components/primitives/AuthFlowSelect/AuthFlowSelect.cjs +21 -0
- package/dist/cjs/components/primitives/AuthFlowSelect/AuthFlowSelect.cjs.map +1 -0
- package/dist/cjs/components/primitives/AuthFlowSelect/BaseAuthFlowSelect.cjs +32 -0
- package/dist/cjs/components/primitives/AuthFlowSelect/BaseAuthFlowSelect.cjs.map +1 -0
- package/dist/cjs/components/primitives/CopyableText/CopyableText.cjs +41 -21
- package/dist/cjs/components/primitives/CopyableText/CopyableText.cjs.map +1 -1
- package/dist/cjs/components/primitives/CopyableText/CopyableText.styles.cjs +5 -2
- package/dist/cjs/components/primitives/CopyableText/CopyableText.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/Icons/Copy.cjs +33 -0
- package/dist/cjs/components/primitives/Icons/Copy.cjs.map +1 -0
- package/dist/cjs/components/primitives/PasswordField/PasswordField.cjs +2 -1
- package/dist/cjs/components/primitives/PasswordField/PasswordField.cjs.map +1 -1
- package/dist/cjs/components/primitives/Select/ResourceSelect.cjs +104 -0
- package/dist/cjs/components/primitives/Select/ResourceSelect.cjs.map +1 -0
- package/dist/cjs/components/primitives/Select/Select.cjs +72 -21
- package/dist/cjs/components/primitives/Select/Select.cjs.map +1 -1
- package/dist/cjs/components/primitives/Select/Select.styles.cjs +19 -3
- package/dist/cjs/components/primitives/Select/Select.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/Select/useSelectMessages.cjs +21 -0
- package/dist/cjs/components/primitives/Select/useSelectMessages.cjs.map +1 -0
- package/dist/cjs/components/primitives/TextField/TextField.cjs +19 -3
- package/dist/cjs/components/primitives/TextField/TextField.cjs.map +1 -1
- package/dist/cjs/components/primitives/TextField/TextField.styles.cjs +18 -5
- package/dist/cjs/components/primitives/TextField/TextField.styles.cjs.map +1 -1
- package/dist/cjs/components/primitives/UserSelect/BaseUserSelect.cjs +33 -0
- package/dist/cjs/components/primitives/UserSelect/BaseUserSelect.cjs.map +1 -0
- package/dist/cjs/components/primitives/UserSelect/UserSelect.cjs +21 -0
- package/dist/cjs/components/primitives/UserSelect/UserSelect.cjs.map +1 -0
- package/dist/cjs/components/primitives/UserTypeSelect/BaseUserTypeSelect.cjs +31 -0
- package/dist/cjs/components/primitives/UserTypeSelect/BaseUserTypeSelect.cjs.map +1 -0
- package/dist/cjs/components/primitives/UserTypeSelect/UserTypeSelect.cjs +21 -0
- package/dist/cjs/components/primitives/UserTypeSelect/UserTypeSelect.cjs.map +1 -0
- package/dist/cjs/hooks/useFetchAuthFlows.cjs +36 -0
- package/dist/cjs/hooks/useFetchAuthFlows.cjs.map +1 -0
- package/dist/cjs/hooks/useFetchUserTypes.cjs +34 -0
- package/dist/cjs/hooks/useFetchUserTypes.cjs.map +1 -0
- package/dist/cjs/hooks/useFetchUsers.cjs +35 -0
- package/dist/cjs/hooks/useFetchUsers.cjs.map +1 -0
- package/dist/cjs/hooks/useInfiniteOptions.cjs +129 -0
- package/dist/cjs/hooks/useInfiniteOptions.cjs.map +1 -0
- package/dist/cjs/hooks/useManagementEndpoint.cjs.map +1 -1
- package/dist/cjs/index.cjs +56 -0
- package/dist/cjs/utils/createAuthenticatedFetcher.cjs +1 -0
- package/dist/cjs/utils/createAuthenticatedFetcher.cjs.map +1 -1
- package/dist/components/presentation/ChangeCredential/BaseChangeCredential.js +1 -1
- package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.d.ts.map +1 -1
- package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.js +1 -1
- package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.js.map +1 -1
- package/dist/components/presentation/auth/AuthOptionFactory.d.ts +9 -1
- package/dist/components/presentation/auth/AuthOptionFactory.d.ts.map +1 -1
- package/dist/components/presentation/auth/AuthOptionFactory.js +56 -17
- package/dist/components/presentation/auth/AuthOptionFactory.js.map +1 -1
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.d.ts +18 -2
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.d.ts.map +1 -1
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.js +22 -6
- package/dist/components/presentation/auth/InviteUser/BaseInviteUser.js.map +1 -1
- package/dist/components/presentation/auth/InviteUser/InviteUser.d.ts +2 -1
- package/dist/components/presentation/auth/InviteUser/InviteUser.d.ts.map +1 -1
- package/dist/components/presentation/auth/InviteUser/InviteUser.js +6 -0
- package/dist/components/presentation/auth/InviteUser/InviteUser.js.map +1 -1
- package/dist/components/primitives/AuthFlowSelect/AuthFlowSelect.d.ts +11 -0
- package/dist/components/primitives/AuthFlowSelect/AuthFlowSelect.d.ts.map +1 -0
- package/dist/components/primitives/AuthFlowSelect/AuthFlowSelect.js +19 -0
- package/dist/components/primitives/AuthFlowSelect/AuthFlowSelect.js.map +1 -0
- package/dist/components/primitives/AuthFlowSelect/BaseAuthFlowSelect.d.ts +14 -0
- package/dist/components/primitives/AuthFlowSelect/BaseAuthFlowSelect.d.ts.map +1 -0
- package/dist/components/primitives/AuthFlowSelect/BaseAuthFlowSelect.js +29 -0
- package/dist/components/primitives/AuthFlowSelect/BaseAuthFlowSelect.js.map +1 -0
- package/dist/components/primitives/CopyableText/CopyableText.d.ts +9 -0
- package/dist/components/primitives/CopyableText/CopyableText.d.ts.map +1 -1
- package/dist/components/primitives/CopyableText/CopyableText.js +40 -21
- package/dist/components/primitives/CopyableText/CopyableText.js.map +1 -1
- package/dist/components/primitives/CopyableText/CopyableText.styles.d.ts.map +1 -1
- package/dist/components/primitives/CopyableText/CopyableText.styles.js +5 -2
- package/dist/components/primitives/CopyableText/CopyableText.styles.js.map +1 -1
- package/dist/components/primitives/Icons/Copy.d.ts +7 -0
- package/dist/components/primitives/Icons/Copy.d.ts.map +1 -0
- package/dist/components/primitives/Icons/Copy.js +31 -0
- package/dist/components/primitives/Icons/Copy.js.map +1 -0
- package/dist/components/primitives/PasswordField/PasswordField.d.ts +9 -1
- package/dist/components/primitives/PasswordField/PasswordField.d.ts.map +1 -1
- package/dist/components/primitives/PasswordField/PasswordField.js +2 -1
- package/dist/components/primitives/PasswordField/PasswordField.js.map +1 -1
- package/dist/components/primitives/Select/ResourceSelect.d.ts +36 -0
- package/dist/components/primitives/Select/ResourceSelect.d.ts.map +1 -0
- package/dist/components/primitives/Select/ResourceSelect.js +100 -0
- package/dist/components/primitives/Select/ResourceSelect.js.map +1 -0
- package/dist/components/primitives/Select/Select.d.ts +22 -13
- package/dist/components/primitives/Select/Select.d.ts.map +1 -1
- package/dist/components/primitives/Select/Select.js +72 -22
- package/dist/components/primitives/Select/Select.js.map +1 -1
- package/dist/components/primitives/Select/Select.styles.d.ts.map +1 -1
- package/dist/components/primitives/Select/Select.styles.js +19 -3
- package/dist/components/primitives/Select/Select.styles.js.map +1 -1
- package/dist/components/primitives/Select/__tests__/selectTestUtils.d.ts +6 -0
- package/dist/components/primitives/Select/__tests__/selectTestUtils.d.ts.map +1 -0
- package/dist/components/primitives/Select/useSelectMessages.d.ts +9 -0
- package/dist/components/primitives/Select/useSelectMessages.d.ts.map +1 -0
- package/dist/components/primitives/Select/useSelectMessages.js +18 -0
- package/dist/components/primitives/Select/useSelectMessages.js.map +1 -0
- package/dist/components/primitives/TextField/TextField.d.ts +8 -0
- package/dist/components/primitives/TextField/TextField.d.ts.map +1 -1
- package/dist/components/primitives/TextField/TextField.js +19 -3
- package/dist/components/primitives/TextField/TextField.js.map +1 -1
- package/dist/components/primitives/TextField/TextField.styles.d.ts +2 -1
- package/dist/components/primitives/TextField/TextField.styles.d.ts.map +1 -1
- package/dist/components/primitives/TextField/TextField.styles.js +18 -5
- package/dist/components/primitives/TextField/TextField.styles.js.map +1 -1
- package/dist/components/primitives/UserSelect/BaseUserSelect.d.ts +15 -0
- package/dist/components/primitives/UserSelect/BaseUserSelect.d.ts.map +1 -0
- package/dist/components/primitives/UserSelect/BaseUserSelect.js +30 -0
- package/dist/components/primitives/UserSelect/BaseUserSelect.js.map +1 -0
- package/dist/components/primitives/UserSelect/UserSelect.d.ts +11 -0
- package/dist/components/primitives/UserSelect/UserSelect.d.ts.map +1 -0
- package/dist/components/primitives/UserSelect/UserSelect.js +19 -0
- package/dist/components/primitives/UserSelect/UserSelect.js.map +1 -0
- package/dist/components/primitives/UserTypeSelect/BaseUserTypeSelect.d.ts +14 -0
- package/dist/components/primitives/UserTypeSelect/BaseUserTypeSelect.d.ts.map +1 -0
- package/dist/components/primitives/UserTypeSelect/BaseUserTypeSelect.js +28 -0
- package/dist/components/primitives/UserTypeSelect/BaseUserTypeSelect.js.map +1 -0
- package/dist/components/primitives/UserTypeSelect/UserTypeSelect.d.ts +11 -0
- package/dist/components/primitives/UserTypeSelect/UserTypeSelect.d.ts.map +1 -0
- package/dist/components/primitives/UserTypeSelect/UserTypeSelect.js +19 -0
- package/dist/components/primitives/UserTypeSelect/UserTypeSelect.js.map +1 -0
- package/dist/hooks/useFetchAuthFlows.d.ts +9 -0
- package/dist/hooks/useFetchAuthFlows.d.ts.map +1 -0
- package/dist/hooks/useFetchAuthFlows.js +33 -0
- package/dist/hooks/useFetchAuthFlows.js.map +1 -0
- package/dist/hooks/useFetchUserTypes.d.ts +8 -0
- package/dist/hooks/useFetchUserTypes.d.ts.map +1 -0
- package/dist/hooks/useFetchUserTypes.js +31 -0
- package/dist/hooks/useFetchUserTypes.js.map +1 -0
- package/dist/hooks/useFetchUsers.d.ts +8 -0
- package/dist/hooks/useFetchUsers.d.ts.map +1 -0
- package/dist/hooks/useFetchUsers.js +32 -0
- package/dist/hooks/useFetchUsers.js.map +1 -0
- package/dist/hooks/useInfiniteOptions.d.ts +31 -0
- package/dist/hooks/useInfiniteOptions.d.ts.map +1 -0
- package/dist/hooks/useInfiniteOptions.js +126 -0
- package/dist/hooks/useInfiniteOptions.js.map +1 -0
- package/dist/hooks/useManagementEndpoint.d.ts +1 -1
- package/dist/hooks/useManagementEndpoint.d.ts.map +1 -1
- package/dist/hooks/useManagementEndpoint.js.map +1 -1
- package/dist/index.d.ts +18 -1
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +12 -2
- package/dist/utils/createAuthenticatedFetcher.d.ts.map +1 -1
- package/dist/utils/createAuthenticatedFetcher.js +1 -0
- package/dist/utils/createAuthenticatedFetcher.js.map +1 -1
- package/package.json +2 -2
|
@@ -7,8 +7,8 @@ const require_Typography = require('../../primitives/Typography/Typography.cjs')
|
|
|
7
7
|
const require_Alert = require('../../primitives/Alert/Alert.cjs');
|
|
8
8
|
const require_X = require('../../primitives/Icons/X.cjs');
|
|
9
9
|
const require_PasswordField = require('../../primitives/PasswordField/PasswordField.cjs');
|
|
10
|
-
const require_BaseChangeCredential_styles = require('./BaseChangeCredential.styles.cjs');
|
|
11
10
|
const require_Check = require('../../primitives/Icons/Check.cjs');
|
|
11
|
+
const require_BaseChangeCredential_styles = require('./BaseChangeCredential.styles.cjs');
|
|
12
12
|
let __thunderid_browser = require("@thunderid/browser");
|
|
13
13
|
__thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
14
14
|
let react = require("react");
|
|
@@ -205,7 +205,7 @@ const BaseAcceptInvite = ({ executionId, inviteToken, onSubmit, onComplete, onEr
|
|
|
205
205
|
const errors = {};
|
|
206
206
|
const validateComponents = (comps) => {
|
|
207
207
|
comps.forEach((comp) => {
|
|
208
|
-
if ((comp.type === "PASSWORD_INPUT" || comp.type === "TEXT_INPUT" || comp.type === "EMAIL_INPUT" || comp.type === "PHONE_INPUT" || comp.type === "OTP_INPUT" || comp.type === "DATE_INPUT") && comp.ref) {
|
|
208
|
+
if ((comp.type === "PASSWORD_INPUT" || comp.type === "TEXT_INPUT" || comp.type === "EMAIL_INPUT" || comp.type === "PHONE_INPUT" || comp.type === "OTP_INPUT" || comp.type === "DATE_INPUT" || comp.type === "SELECT") && comp.ref) {
|
|
209
209
|
const value = formValues[comp.ref];
|
|
210
210
|
if (comp.required && (!value || value.trim() === "")) errors[comp.ref] = t("validations.required.field.error");
|
|
211
211
|
else if (value) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"BaseAcceptInvite.cjs","names":["BaseAcceptInvite: FC<BaseAcceptInviteProps>","useThunderID","useTranslation","useTheme","customRenderers: ComponentRendererMap","ComponentRendererContext","styles: any","useStyles","challengeTokenRef: any","responseFieldErrors: FieldError[] | undefined","errors: Record<string, string>","touched: Record<string, boolean>","tokenValidationAttemptedRef: any","tempData: any","storageManager: any","handleError: any","errorMessage: string","extractErrorMessage","normalizeFlowResponseLocal: any","normalizeFlowResponse","components","response: any","handleInputChange: any","newErrors: any","handleInputBlur: any","validateForm: any","value: any","handleSubmit: any","validation: any","inputs: any","raw: any","purposes: any[]","ConsentConstants","payload: Record<string, any>","redirectURL: any","extractHeadings: any","title: string | undefined","subtitle: string | undefined","title","subtitle","filterHeadings: any","components: any","componentsWithoutHeadings: any","renderProps: BaseAcceptInviteRenderProps","CardPrimitive","cx","Spinner","Typography","AlertPrimitive","Button","renderInviteUserComponents"],"sources":["../../../../../../src/components/presentation/auth/AcceptInvite/BaseAcceptInvite.tsx"],"sourcesContent":["// Copyright 2025-2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n ConsentConstants,\n FieldError,\n FlowExecutionError,\n FlowMetadataResponse,\n Preferences,\n buildValidatorFromRules,\n} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode, useCallback, useContext, useEffect, useRef, useState} from 'react';\nimport useStyles from './BaseAcceptInvite.styles';\nimport ComponentRendererContext, {\n ComponentRendererMap,\n} from '../../../../contexts/ComponentRenderer/ComponentRendererContext';\nimport useTheme from '../../../../contexts/Theme/useTheme';\nimport useThunderID from '../../../../contexts/ThunderID/useThunderID';\nimport {useOAuthCallback} from '../../../../hooks/useOAuthCallback';\nimport useTranslation from '../../../../hooks/useTranslation';\nimport {cx} from '../../../../styles/emotion';\nimport {normalizeFlowResponse, extractErrorMessage} from '../../../../utils/flowTransformer';\nimport {initiateOAuthRedirect} from '../../../../utils/oauth';\nimport AlertPrimitive from '../../../primitives/Alert/Alert';\nimport Button from '../../../primitives/Button/Button';\n// eslint-disable-next-line import/no-named-as-default\nimport CardPrimitive, {CardProps} from '../../../primitives/Card/Card';\nimport Spinner from '../../../primitives/Spinner/Spinner';\nimport Typography from '../../../primitives/Typography/Typography';\nimport {renderInviteUserComponents} from '../AuthOptionFactory';\n\n/**\n * Flow response structure from the backend.\n */\nexport interface AcceptInviteFlowResponse {\n challengeToken?: string;\n data?: {\n additionalData?: Record<string, string>;\n components?: any[];\n fieldErrors?: FieldError[];\n meta?: {\n components?: any[];\n };\n redirectURL?: string;\n };\n error?: FlowExecutionError;\n executionId: string;\n flowStatus: 'INCOMPLETE' | 'COMPLETE' | 'ERROR';\n type?: 'VIEW' | 'REDIRECTION';\n}\n\n/**\n * Render props for custom UI rendering of AcceptInvite.\n */\nexport interface BaseAcceptInviteRenderProps {\n /**\n * Additional data from the current flow step (e.g. consentPrompt for consent nodes).\n */\n additionalData: Record<string, any>;\n\n /**\n * Flow components from the current step.\n */\n components: any[];\n\n /**\n * API error (if any).\n */\n error?: Error | null;\n\n /**\n * Current flow ID from URL.\n */\n executionId?: string;\n\n /**\n * Field validation errors.\n */\n fieldErrors: Record<string, string>;\n\n /**\n * Navigate to sign in page.\n */\n goToSignIn?: () => void;\n\n /**\n * Function to handle input blur.\n */\n handleInputBlur: (name: string) => void;\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 * Invite token from URL.\n */\n inviteToken?: string;\n\n /**\n * Whether the flow has completed successfully.\n */\n isComplete: boolean;\n\n /**\n * Loading state.\n */\n isLoading: boolean;\n\n /**\n * Whether the token validation failed.\n */\n isTokenInvalid: boolean;\n\n /**\n * Whether the form is valid.\n */\n isValid: boolean;\n\n /**\n * Whether the invite token is being validated.\n */\n isValidatingToken: boolean;\n\n /**\n * Flow metadata returned by the platform (v2 only). `null` while loading or unavailable.\n */\n meta: FlowMetadataResponse | null;\n\n /**\n * Subtitle for the current step.\n */\n subtitle?: string;\n\n /**\n * Title for the current step.\n */\n title?: string;\n\n /**\n * Touched fields.\n */\n touched: Record<string, boolean>;\n\n /**\n * Form values for the current step.\n */\n values: Record<string, string>;\n}\n\n/**\n * Props for the BaseAcceptInvite component.\n */\nexport interface BaseAcceptInviteProps {\n /**\n * Render props function for custom UI.\n * If not provided, default UI will be rendered.\n */\n children?: (props: BaseAcceptInviteRenderProps) => ReactNode;\n\n /**\n * Custom CSS class name.\n */\n className?: string;\n\n /**\n * Flow ID from the invite link URL.\n */\n executionId?: string;\n\n /**\n * Invite token from the invite link URL.\n */\n inviteToken?: string;\n\n /**\n * Callback when the flow completes successfully.\n */\n onComplete?: () => void;\n\n /**\n * Callback when an error occurs.\n */\n onError?: (error: Error) => void;\n\n /**\n * Callback when the flow state changes.\n */\n onFlowChange?: (response: AcceptInviteFlowResponse) => void;\n\n /**\n * Callback to navigate to sign in page.\n */\n onGoToSignIn?: () => void;\n\n /**\n * Function to submit flow step data.\n * This makes a request to the flow/execute endpoint.\n */\n onSubmit: (payload: Record<string, any>) => Promise<AcceptInviteFlowResponse>;\n\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 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 * Base component for accept invite flow (end-user).\n * Handles the flow logic for validating an invite token and setting a password.\n *\n * When no children are provided, renders a default UI with:\n * - Loading spinner during token validation\n * - Error alerts for invalid/expired tokens\n * - Password form with validation\n * - Success state with sign-in redirect\n *\n * Flow steps handled:\n * 1. Validate invite token (automatic on mount)\n * 2. Password input\n * 3. Flow completion\n */\nconst BaseAcceptInvite: FC<BaseAcceptInviteProps> = ({\n executionId,\n inviteToken,\n onSubmit,\n onComplete,\n onError,\n onFlowChange,\n onGoToSignIn,\n className = '',\n children,\n preferences,\n size = 'medium',\n variant = 'outlined',\n showTitle = true,\n showSubtitle = true,\n}: BaseAcceptInviteProps): ReactElement => {\n const {meta, isInitialized, getStorageManager, vendor} = useThunderID();\n const {t} = useTranslation(preferences?.i18n);\n const {theme} = useTheme();\n const customRenderers: ComponentRendererMap = useContext(ComponentRendererContext);\n const styles: any = useStyles(theme, theme.vars.colors.text.primary);\n const [isLoading, setIsLoading] = useState(false);\n const [isValidatingToken, setIsValidatingToken] = useState(true);\n const [isTokenInvalid, setIsTokenInvalid] = useState(false);\n const [isComplete, setIsComplete] = useState(false);\n const [currentFlow, setCurrentFlow] = useState<AcceptInviteFlowResponse | null>(null);\n const [apiError, setApiError] = useState<Error | null>(null);\n const [formValues, setFormValues] = useState<Record<string, string>>({});\n const [formErrors, setFormErrors] = useState<Record<string, string>>({});\n const [touchedFields, setTouchedFields] = useState<Record<string, boolean>>({});\n const [isFormValid, setIsFormValid] = useState(true);\n const [isStorageReady, setIsStorageReady] = useState(false);\n const challengeTokenRef: any = useRef<string | null>(null);\n\n /**\n * Project server-side validation errors from the most recent flow response into\n * the local formErrors state. First error per field wins; affected fields are\n * marked touched so errors render immediately.\n */\n useEffect(() => {\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 const touched: Record<string, boolean> = {};\n for (const fe of responseFieldErrors) {\n if (!(fe.identifier in errors)) {\n errors[fe.identifier] = fe.message;\n touched[fe.identifier] = true;\n }\n }\n setFormErrors(errors);\n setTouchedFields((prev: Record<string, boolean>) => ({...prev, ...touched}));\n }, [currentFlow]);\n\n const tokenValidationAttemptedRef: any = useRef(false);\n\n /**\n * Restore any challenge token persisted before an OAuth redirect.\n * Waits for SDK initialization before reading from storage.\n */\n useEffect(() => {\n if (!isInitialized) 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 } finally {\n setIsStorageReady(true);\n }\n })();\n }, [isInitialized]);\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 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 };\n\n /**\n * Handle error responses and extract meaningful error messages.\n * Uses the transformer's extractErrorMessage function for consistency.\n */\n const handleError: any = useCallback(\n (error: any) => {\n const errorMessage: string = extractErrorMessage(error, t, 'components.acceptInvite.errors.generic');\n\n // Set the API error state\n setApiError(error instanceof Error ? error : new Error(errorMessage));\n\n // Call the onError callback if provided\n onError?.(error instanceof Error ? error : new Error(errorMessage));\n },\n [t, onError],\n );\n\n /**\n * Normalize flow response to ensure component-driven format.\n * Transforms data.meta.components to data.components.\n */\n const normalizeFlowResponseLocal: any = useCallback(\n (response: AcceptInviteFlowResponse): AcceptInviteFlowResponse => {\n if (!response?.data?.meta?.components) {\n return response;\n }\n\n try {\n const {components} = normalizeFlowResponse(\n response,\n t,\n {\n defaultErrorKey: 'components.acceptInvite.errors.generic',\n resolveTranslations: false,\n },\n meta,\n );\n\n return {\n ...response,\n data: {\n ...response.data,\n components: components as any,\n },\n };\n } catch {\n // If transformer throws (e.g., error response), return as-is\n return response;\n }\n },\n [t, children],\n );\n\n /**\n * Handle OAuth callback when returning from OAuth provider.\n * This hook processes the authorization code and continues the flow.\n */\n useOAuthCallback({\n currentExecutionId: executionId ?? null,\n executionIdStorageKey: `${vendor}_execution_id`,\n isInitialized: isStorageReady,\n onComplete: () => {\n setIsValidatingToken(false);\n onComplete?.();\n },\n onError: (error: any) => {\n if (!error?.flowStatus) {\n setIsTokenInvalid(true);\n }\n setIsValidatingToken(false);\n handleError(error);\n },\n onFlowChange: (response: any) => {\n onFlowChange?.(response);\n if (response.flowStatus === 'COMPLETE') {\n setIsComplete(true);\n const completionComponents: any[] = response.data?.components || response.data?.meta?.components || [];\n if (completionComponents.length > 0) {\n setCurrentFlow(response);\n }\n } else {\n // Initialize currentFlow for next steps if not complete\n setCurrentFlow(response);\n setFormValues({});\n setFormErrors({});\n setTouchedFields({});\n }\n },\n onProcessingStart: () => {\n setIsValidatingToken(true);\n },\n onSubmit: async (payload: any) => {\n const rawResponse: any = await onSubmit({\n ...payload,\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n });\n const response: any = normalizeFlowResponseLocal(rawResponse);\n await setChallengeToken(response.challengeToken ?? null);\n return response;\n },\n tokenValidationAttemptedRef,\n });\n\n /**\n * Handle input value changes.\n */\n const handleInputChange: any = useCallback((name: string, value: string) => {\n setFormValues((prev: any) => ({...prev, [name]: value}));\n // Clear error when user starts typing\n setFormErrors((prev: any) => {\n const newErrors: any = {...prev};\n delete newErrors[name];\n return newErrors;\n });\n setIsFormValid(true);\n }, []);\n\n /**\n * Handle input blur.\n */\n const handleInputBlur: any = useCallback((name: string) => {\n setTouchedFields((prev: any) => ({...prev, [name]: true}));\n }, []);\n\n /**\n * Validate required fields based on components.\n */\n const validateForm: any = useCallback(\n (components: any[]): {errors: Record<string, string>; isValid: boolean} => {\n const errors: Record<string, string> = {};\n\n const validateComponents = (comps: any[]): any => {\n comps.forEach((comp: any) => {\n if (\n (comp.type === 'PASSWORD_INPUT' ||\n comp.type === 'TEXT_INPUT' ||\n comp.type === 'EMAIL_INPUT' ||\n comp.type === 'PHONE_INPUT' ||\n comp.type === 'OTP_INPUT' ||\n comp.type === 'DATE_INPUT') &&\n comp.ref\n ) {\n const value: any = formValues[comp.ref];\n if (comp.required && (!value || value.trim() === '')) {\n errors[comp.ref] = t('validations.required.field.error');\n } else if (value) {\n // Evaluate declarative validation rules from meta.components[].validation.\n const ruleValidator = buildValidatorFromRules(comp.validation);\n if (ruleValidator) {\n const message = ruleValidator(value);\n if (message) {\n errors[comp.ref] = t(message);\n }\n }\n }\n }\n if (comp.components && Array.isArray(comp.components)) {\n validateComponents(comp.components);\n }\n });\n };\n\n validateComponents(components);\n\n return {errors, isValid: Object.keys(errors).length === 0};\n },\n [formValues, t],\n );\n\n /**\n * Handle form submission.\n */\n const handleSubmit: any = useCallback(\n async (component: any, data?: Record<string, any>) => {\n if (!currentFlow) {\n return;\n }\n\n // Validate form before submission\n const components: any = currentFlow.data?.components || [];\n const validation: any = validateForm(components);\n\n if (!validation.isValid) {\n setIsFormValid(false);\n setFormErrors(validation.errors);\n // Mark all fields as touched\n const touched: Record<string, boolean> = {};\n Object.keys(validation.errors).forEach((key: any) => {\n touched[key] = true;\n });\n setTouchedFields((prev: any) => ({...prev, ...touched}));\n return;\n }\n\n setIsLoading(true);\n setApiError(null);\n\n try {\n // Build payload with form values\n const inputs: any = {...(data || formValues)};\n\n // Auto-compile consent_decisions if we are on a consent prompt step.\n // Mirrors the same logic in SignIn to ensure the server receives a\n // properly structured JSON payload rather than individual checkbox keys.\n const currentAdditionalData = (currentFlow?.data?.additionalData as Record<string, any>) ?? {};\n if (currentAdditionalData['consentPrompt']) {\n try {\n const raw: any = currentAdditionalData['consentPrompt'];\n const purposes: any[] = typeof raw === 'string' ? JSON.parse(raw) : raw.purposes || raw;\n const isDeny = component?.variant?.toLowerCase() !== 'primary';\n const decisions = {\n approved: !isDeny,\n ...(isDeny ? {reason: ConsentConstants.REASON_USER_DENIED} : {}),\n purposes: purposes.map((p: any) => ({\n approved: !isDeny,\n purposeName: p.purposeName,\n elements: [\n ...(p.essential || []).map((e: any) => ({approved: !isDeny, name: e.name})),\n ...(p.optional || []).map((e: any) => {\n const key = `__consent_opt__${p.purposeId}__${e.name}`;\n return {approved: !isDeny && inputs[key] === 'true', name: e.name};\n }),\n ],\n })),\n };\n inputs.consent_decisions = JSON.stringify(decisions);\n Object.keys(inputs).forEach((k: string) => {\n if (k.startsWith('__consent_opt__')) delete inputs[k];\n });\n } catch {\n // Leave inputs as-is if consent building fails\n }\n }\n\n const payload: Record<string, any> = {\n executionId: currentFlow.executionId,\n inputs,\n verbose: true,\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n };\n\n // Add action ID if component has one\n if (component?.id) {\n payload['action'] = component.id;\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 // Handle OAuth redirect response\n if (response.type === 'REDIRECTION') {\n const redirectURL: any = response.data?.redirectURL || response?.redirectURL;\n if (redirectURL && typeof window !== 'undefined') {\n // Initiate OAuth redirect with secure state management\n initiateOAuthRedirect(redirectURL, vendor);\n return;\n }\n }\n\n // Check for completion\n if (response.flowStatus === 'COMPLETE') {\n setIsComplete(true);\n const completionComponents: any[] = response.data?.components || response.data?.meta?.components || [];\n if (completionComponents.length > 0) {\n setCurrentFlow(response);\n } else {\n onComplete?.();\n }\n return;\n }\n\n // Check for error status\n if (response.flowStatus === 'ERROR') {\n handleError(response);\n return;\n }\n\n // Update current flow and reset form state for next step, preserving input values\n setCurrentFlow(response);\n setFormErrors({});\n setTouchedFields({});\n\n // Display error from INCOMPLETE response\n if (response?.error) {\n handleError(response);\n }\n } catch (err) {\n handleError(err);\n } finally {\n setIsLoading(false);\n }\n },\n [\n currentFlow,\n formValues,\n validateForm,\n onSubmit,\n onFlowChange,\n onComplete,\n handleError,\n normalizeFlowResponseLocal,\n ],\n );\n\n /**\n * reset form values, errors, and touched fields to initial state\n */\n const resetForm = useCallback(() => {\n setFormValues({});\n setFormErrors({});\n setTouchedFields({});\n }, []);\n\n /**\n * Validate invite token on component mount.\n */\n useEffect(() => {\n // Skip validation if already validated\n if (tokenValidationAttemptedRef.current) {\n return;\n }\n\n // If an OAuth code is present, this is a return from an OAuth redirect.\n // useOAuthCallback will handle the code — skip the initial invite validation.\n const urlParams: URLSearchParams = new URLSearchParams(window.location.search);\n if (urlParams.get('code')) {\n return;\n }\n\n // Validate required params for initial invite link\n if (!executionId || !inviteToken) {\n setIsValidatingToken(false);\n setIsTokenInvalid(true);\n handleError(new Error('Invalid invite link. Missing executionId or inviteToken.'));\n return;\n }\n\n tokenValidationAttemptedRef.current = true;\n\n (async (): Promise<void> => {\n setIsValidatingToken(true);\n setApiError(null);\n\n try {\n // Store executionId in sessionStorage for OAuth callback\n if (executionId) {\n sessionStorage.setItem(`${vendor}_execution_id`, executionId);\n }\n\n // Send the invite token to validate and continue the flow\n const payload: any = {\n executionId,\n inputs: {\n inviteToken,\n },\n verbose: true,\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 // Check for error (invalid token)\n if (response.flowStatus === 'ERROR') {\n setIsTokenInvalid(true);\n handleError(response);\n return;\n }\n\n // Token is valid, show the password form\n setCurrentFlow(response);\n\n // Display error from INCOMPLETE response\n if (response?.error) {\n handleError(response);\n }\n } catch (err) {\n setIsTokenInvalid(true);\n handleError(err);\n } finally {\n setIsValidatingToken(false);\n }\n })();\n }, [executionId, inviteToken, onSubmit, onFlowChange, handleError, normalizeFlowResponseLocal]);\n\n /**\n * Extract title and subtitle from components.\n */\n const extractHeadings: any = useCallback((components: any[]): {subtitle?: string; title?: string} => {\n let title: string | undefined;\n let subtitle: string | undefined;\n\n components.forEach((comp: any) => {\n if (comp.type === 'TEXT') {\n if (comp.variant === 'HEADING_1' && !title) {\n title = comp.label;\n } else if ((comp.variant === 'HEADING_2' || comp.variant === 'SUBTITLE_1') && !subtitle) {\n subtitle = comp.label;\n }\n }\n });\n\n return {subtitle, title};\n }, []);\n\n /**\n * Filter out heading components for default rendering.\n */\n const filterHeadings: any = useCallback(\n (components: any[]): any[] =>\n components.filter(\n (comp: any) => !(comp.type === 'TEXT' && (comp.variant === 'HEADING_1' || comp.variant === 'HEADING_2')),\n ),\n [],\n );\n\n // Get components from normalized response, with fallback to meta.components\n const components: any = currentFlow?.data?.components || currentFlow?.data?.meta?.components || [];\n const {title, subtitle} = extractHeadings(components);\n const componentsWithoutHeadings: any = filterHeadings(components);\n const additionalData: Record<string, any> = (currentFlow?.data?.additionalData as Record<string, any>) ?? {};\n\n // Render props\n const renderProps: BaseAcceptInviteRenderProps = {\n additionalData,\n components,\n error: apiError,\n executionId,\n fieldErrors: formErrors,\n goToSignIn: onGoToSignIn,\n handleInputBlur,\n handleInputChange,\n handleSubmit,\n inviteToken,\n isComplete,\n isLoading,\n isTokenInvalid,\n isValid: isFormValid,\n isValidatingToken,\n meta,\n subtitle,\n title,\n touched: touchedFields,\n values: formValues,\n };\n\n // If children render prop is provided, use it for custom UI\n if (children) {\n return <div className={className}>{children(renderProps)}</div>;\n }\n\n // Default rendering\n\n // Loading state during token validation\n if (isValidatingToken) {\n return (\n <CardPrimitive className={cx(className, styles.card)} variant={variant}>\n <CardPrimitive.Content>\n <div className={(styles as Record<string, string>)['tokenValidationContainer']}>\n <Spinner size=\"medium\" />\n <Typography variant=\"body1\">Validating your invite link...</Typography>\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n // Invalid token state\n if (isTokenInvalid) {\n return (\n <CardPrimitive className={cx(className, styles.card)} variant={variant}>\n <CardPrimitive.Header className={styles.header}>\n <CardPrimitive.Title level={2} className={styles.title}>\n Invalid Invite Link\n </CardPrimitive.Title>\n </CardPrimitive.Header>\n <CardPrimitive.Content>\n <AlertPrimitive variant=\"error\">\n <AlertPrimitive.Title>Unable to verify invite</AlertPrimitive.Title>\n <AlertPrimitive.Description>\n {apiError?.message ||\n 'This invite link is invalid or has expired. Please contact your administrator for a new invite.'}\n </AlertPrimitive.Description>\n </AlertPrimitive>\n {onGoToSignIn && (\n <div className={(styles as Record<string, string>)['goToSignInContainer']}>\n <Button variant=\"outline\" onClick={onGoToSignIn}>\n Go to Sign In\n </Button>\n </div>\n )}\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n // Flow components (password form)\n return (\n <CardPrimitive className={cx(className, styles.card)} variant={variant}>\n {(showTitle || showSubtitle) && (title || subtitle) && (\n <CardPrimitive.Header className={styles.header}>\n {showTitle && title && (\n <CardPrimitive.Title level={2} className={styles.title}>\n {title}\n </CardPrimitive.Title>\n )}\n {showSubtitle && subtitle && (\n <Typography variant=\"body1\" className={styles.subtitle}>\n {subtitle}\n </Typography>\n )}\n </CardPrimitive.Header>\n )}\n <CardPrimitive.Content>\n {apiError && (\n <div className={(styles as Record<string, string>)['errorContainer']}>\n <AlertPrimitive variant=\"error\">\n <AlertPrimitive.Description>{apiError.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n </div>\n )}\n <div>\n {componentsWithoutHeadings && componentsWithoutHeadings.length > 0\n ? renderInviteUserComponents(\n componentsWithoutHeadings,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n resetForm,\n handleInputChange,\n {\n _customRenderers: customRenderers,\n _theme: theme,\n onInputBlur: handleInputBlur,\n onSubmit: handleSubmit,\n size,\n variant,\n },\n )\n : !isLoading && (\n <AlertPrimitive variant=\"warning\">\n <Typography variant=\"body1\">No form components available</Typography>\n </AlertPrimitive>\n )}\n {isLoading && (\n <div className={(styles as Record<string, string>)['centeredSpinnerContainerSmall']}>\n <Spinner size=\"small\" />\n </div>\n )}\n </div>\n {onGoToSignIn && (\n <div className={(styles as Record<string, string>)['alreadyHaveAccountContainer']}>\n <Typography variant=\"body2\">\n Already have an account?{' '}\n <Button\n variant=\"text\"\n onClick={onGoToSignIn}\n className={(styles as Record<string, string>)['signInInlineButton']}\n >\n Sign In\n </Button>\n </Typography>\n </div>\n )}\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n};\n\nexport default BaseAcceptInvite;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0PA,MAAMA,oBAA+C,EACnD,aACA,aACA,UACA,YACA,SACA,cACA,cACA,YAAY,IACZ,UACA,aACA,OAAO,UACP,UAAU,YACV,YAAY,MACZ,eAAe,WAC0B;CACzC,MAAM,EAAC,MAAM,eAAe,mBAAmB,WAAUC,8BAAc;CACvE,MAAM,EAAC,MAAKC,+BAAe,aAAa,KAAK;CAC7C,MAAM,EAAC,UAASC,0BAAU;CAC1B,MAAMC,wCAAmDC,yCAAyB;CAClF,MAAMC,SAAcC,wCAAU,OAAO,MAAM,KAAK,OAAO,KAAK,QAAQ;CACpE,MAAM,CAAC,WAAW,oCAAyB,MAAM;CACjD,MAAM,CAAC,mBAAmB,4CAAiC,KAAK;CAChE,MAAM,CAAC,gBAAgB,yCAA8B,MAAM;CAC3D,MAAM,CAAC,YAAY,qCAA0B,MAAM;CACnD,MAAM,CAAC,aAAa,sCAA4D,KAAK;CACrF,MAAM,CAAC,UAAU,mCAAsC,KAAK;CAC5D,MAAM,CAAC,YAAY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Ae,SAAQ;cACtB,2CAACD;KAAW,SAAQ;eAAQ;MAAyC;KACtD,EAEtB,aACC,2CAAC;IAAI,WAAY,OAAkC;cACjD,2CAACD,2BAAQ,MAAK,UAAU;KACpB,IAEJ;GACL,gBACC,2CAAC;IAAI,WAAY,OAAkC;cACjD,4CAACC;KAAW,SAAQ;;MAAQ;MACD;MACzB,2CAACE;OACC,SAAQ;OACR,SAAS;OACT,WAAY,OAAkC;iBAC/C;QAEQ;;MACE;KACT;MAEc;GACV;;AAIpB,+BAAe"}
|
|
1
|
+
{"version":3,"file":"BaseAcceptInvite.cjs","names":["BaseAcceptInvite: FC<BaseAcceptInviteProps>","useThunderID","useTranslation","useTheme","customRenderers: ComponentRendererMap","ComponentRendererContext","styles: any","useStyles","challengeTokenRef: any","responseFieldErrors: FieldError[] | undefined","errors: Record<string, string>","touched: Record<string, boolean>","tokenValidationAttemptedRef: any","tempData: any","storageManager: any","handleError: any","errorMessage: string","extractErrorMessage","normalizeFlowResponseLocal: any","normalizeFlowResponse","components","response: any","handleInputChange: any","newErrors: any","handleInputBlur: any","validateForm: any","value: any","handleSubmit: any","validation: any","inputs: any","raw: any","purposes: any[]","ConsentConstants","payload: Record<string, any>","redirectURL: any","extractHeadings: any","title: string | undefined","subtitle: string | undefined","title","subtitle","filterHeadings: any","components: any","componentsWithoutHeadings: any","renderProps: BaseAcceptInviteRenderProps","CardPrimitive","cx","Spinner","Typography","AlertPrimitive","Button","renderInviteUserComponents"],"sources":["../../../../../../src/components/presentation/auth/AcceptInvite/BaseAcceptInvite.tsx"],"sourcesContent":["// Copyright 2025-2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {\n ConsentConstants,\n FieldError,\n FlowExecutionError,\n FlowMetadataResponse,\n Preferences,\n buildValidatorFromRules,\n} from '@thunderid/browser';\nimport {FC, ReactElement, ReactNode, useCallback, useContext, useEffect, useRef, useState} from 'react';\nimport useStyles from './BaseAcceptInvite.styles';\nimport ComponentRendererContext, {\n ComponentRendererMap,\n} from '../../../../contexts/ComponentRenderer/ComponentRendererContext';\nimport useTheme from '../../../../contexts/Theme/useTheme';\nimport useThunderID from '../../../../contexts/ThunderID/useThunderID';\nimport {useOAuthCallback} from '../../../../hooks/useOAuthCallback';\nimport useTranslation from '../../../../hooks/useTranslation';\nimport {cx} from '../../../../styles/emotion';\nimport {normalizeFlowResponse, extractErrorMessage} from '../../../../utils/flowTransformer';\nimport {initiateOAuthRedirect} from '../../../../utils/oauth';\nimport AlertPrimitive from '../../../primitives/Alert/Alert';\nimport Button from '../../../primitives/Button/Button';\n// eslint-disable-next-line import/no-named-as-default\nimport CardPrimitive, {CardProps} from '../../../primitives/Card/Card';\nimport Spinner from '../../../primitives/Spinner/Spinner';\nimport Typography from '../../../primitives/Typography/Typography';\nimport {renderInviteUserComponents} from '../AuthOptionFactory';\n\n/**\n * Flow response structure from the backend.\n */\nexport interface AcceptInviteFlowResponse {\n challengeToken?: string;\n data?: {\n additionalData?: Record<string, string>;\n components?: any[];\n fieldErrors?: FieldError[];\n meta?: {\n components?: any[];\n };\n redirectURL?: string;\n };\n error?: FlowExecutionError;\n executionId: string;\n flowStatus: 'INCOMPLETE' | 'COMPLETE' | 'ERROR';\n type?: 'VIEW' | 'REDIRECTION';\n}\n\n/**\n * Render props for custom UI rendering of AcceptInvite.\n */\nexport interface BaseAcceptInviteRenderProps {\n /**\n * Additional data from the current flow step (e.g. consentPrompt for consent nodes).\n */\n additionalData: Record<string, any>;\n\n /**\n * Flow components from the current step.\n */\n components: any[];\n\n /**\n * API error (if any).\n */\n error?: Error | null;\n\n /**\n * Current flow ID from URL.\n */\n executionId?: string;\n\n /**\n * Field validation errors.\n */\n fieldErrors: Record<string, string>;\n\n /**\n * Navigate to sign in page.\n */\n goToSignIn?: () => void;\n\n /**\n * Function to handle input blur.\n */\n handleInputBlur: (name: string) => void;\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 * Invite token from URL.\n */\n inviteToken?: string;\n\n /**\n * Whether the flow has completed successfully.\n */\n isComplete: boolean;\n\n /**\n * Loading state.\n */\n isLoading: boolean;\n\n /**\n * Whether the token validation failed.\n */\n isTokenInvalid: boolean;\n\n /**\n * Whether the form is valid.\n */\n isValid: boolean;\n\n /**\n * Whether the invite token is being validated.\n */\n isValidatingToken: boolean;\n\n /**\n * Flow metadata returned by the platform (v2 only). `null` while loading or unavailable.\n */\n meta: FlowMetadataResponse | null;\n\n /**\n * Subtitle for the current step.\n */\n subtitle?: string;\n\n /**\n * Title for the current step.\n */\n title?: string;\n\n /**\n * Touched fields.\n */\n touched: Record<string, boolean>;\n\n /**\n * Form values for the current step.\n */\n values: Record<string, string>;\n}\n\n/**\n * Props for the BaseAcceptInvite component.\n */\nexport interface BaseAcceptInviteProps {\n /**\n * Render props function for custom UI.\n * If not provided, default UI will be rendered.\n */\n children?: (props: BaseAcceptInviteRenderProps) => ReactNode;\n\n /**\n * Custom CSS class name.\n */\n className?: string;\n\n /**\n * Flow ID from the invite link URL.\n */\n executionId?: string;\n\n /**\n * Invite token from the invite link URL.\n */\n inviteToken?: string;\n\n /**\n * Callback when the flow completes successfully.\n */\n onComplete?: () => void;\n\n /**\n * Callback when an error occurs.\n */\n onError?: (error: Error) => void;\n\n /**\n * Callback when the flow state changes.\n */\n onFlowChange?: (response: AcceptInviteFlowResponse) => void;\n\n /**\n * Callback to navigate to sign in page.\n */\n onGoToSignIn?: () => void;\n\n /**\n * Function to submit flow step data.\n * This makes a request to the flow/execute endpoint.\n */\n onSubmit: (payload: Record<string, any>) => Promise<AcceptInviteFlowResponse>;\n\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 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 * Base component for accept invite flow (end-user).\n * Handles the flow logic for validating an invite token and setting a password.\n *\n * When no children are provided, renders a default UI with:\n * - Loading spinner during token validation\n * - Error alerts for invalid/expired tokens\n * - Password form with validation\n * - Success state with sign-in redirect\n *\n * Flow steps handled:\n * 1. Validate invite token (automatic on mount)\n * 2. Password input\n * 3. Flow completion\n */\nconst BaseAcceptInvite: FC<BaseAcceptInviteProps> = ({\n executionId,\n inviteToken,\n onSubmit,\n onComplete,\n onError,\n onFlowChange,\n onGoToSignIn,\n className = '',\n children,\n preferences,\n size = 'medium',\n variant = 'outlined',\n showTitle = true,\n showSubtitle = true,\n}: BaseAcceptInviteProps): ReactElement => {\n const {meta, isInitialized, getStorageManager, vendor} = useThunderID();\n const {t} = useTranslation(preferences?.i18n);\n const {theme} = useTheme();\n const customRenderers: ComponentRendererMap = useContext(ComponentRendererContext);\n const styles: any = useStyles(theme, theme.vars.colors.text.primary);\n const [isLoading, setIsLoading] = useState(false);\n const [isValidatingToken, setIsValidatingToken] = useState(true);\n const [isTokenInvalid, setIsTokenInvalid] = useState(false);\n const [isComplete, setIsComplete] = useState(false);\n const [currentFlow, setCurrentFlow] = useState<AcceptInviteFlowResponse | null>(null);\n const [apiError, setApiError] = useState<Error | null>(null);\n const [formValues, setFormValues] = useState<Record<string, string>>({});\n const [formErrors, setFormErrors] = useState<Record<string, string>>({});\n const [touchedFields, setTouchedFields] = useState<Record<string, boolean>>({});\n const [isFormValid, setIsFormValid] = useState(true);\n const [isStorageReady, setIsStorageReady] = useState(false);\n const challengeTokenRef: any = useRef<string | null>(null);\n\n /**\n * Project server-side validation errors from the most recent flow response into\n * the local formErrors state. First error per field wins; affected fields are\n * marked touched so errors render immediately.\n */\n useEffect(() => {\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 const touched: Record<string, boolean> = {};\n for (const fe of responseFieldErrors) {\n if (!(fe.identifier in errors)) {\n errors[fe.identifier] = fe.message;\n touched[fe.identifier] = true;\n }\n }\n setFormErrors(errors);\n setTouchedFields((prev: Record<string, boolean>) => ({...prev, ...touched}));\n }, [currentFlow]);\n\n const tokenValidationAttemptedRef: any = useRef(false);\n\n /**\n * Restore any challenge token persisted before an OAuth redirect.\n * Waits for SDK initialization before reading from storage.\n */\n useEffect(() => {\n if (!isInitialized) 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 } finally {\n setIsStorageReady(true);\n }\n })();\n }, [isInitialized]);\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 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 };\n\n /**\n * Handle error responses and extract meaningful error messages.\n * Uses the transformer's extractErrorMessage function for consistency.\n */\n const handleError: any = useCallback(\n (error: any) => {\n const errorMessage: string = extractErrorMessage(error, t, 'components.acceptInvite.errors.generic');\n\n // Set the API error state\n setApiError(error instanceof Error ? error : new Error(errorMessage));\n\n // Call the onError callback if provided\n onError?.(error instanceof Error ? error : new Error(errorMessage));\n },\n [t, onError],\n );\n\n /**\n * Normalize flow response to ensure component-driven format.\n * Transforms data.meta.components to data.components.\n */\n const normalizeFlowResponseLocal: any = useCallback(\n (response: AcceptInviteFlowResponse): AcceptInviteFlowResponse => {\n if (!response?.data?.meta?.components) {\n return response;\n }\n\n try {\n const {components} = normalizeFlowResponse(\n response,\n t,\n {\n defaultErrorKey: 'components.acceptInvite.errors.generic',\n resolveTranslations: false,\n },\n meta,\n );\n\n return {\n ...response,\n data: {\n ...response.data,\n components: components as any,\n },\n };\n } catch {\n // If transformer throws (e.g., error response), return as-is\n return response;\n }\n },\n [t, children],\n );\n\n /**\n * Handle OAuth callback when returning from OAuth provider.\n * This hook processes the authorization code and continues the flow.\n */\n useOAuthCallback({\n currentExecutionId: executionId ?? null,\n executionIdStorageKey: `${vendor}_execution_id`,\n isInitialized: isStorageReady,\n onComplete: () => {\n setIsValidatingToken(false);\n onComplete?.();\n },\n onError: (error: any) => {\n if (!error?.flowStatus) {\n setIsTokenInvalid(true);\n }\n setIsValidatingToken(false);\n handleError(error);\n },\n onFlowChange: (response: any) => {\n onFlowChange?.(response);\n if (response.flowStatus === 'COMPLETE') {\n setIsComplete(true);\n const completionComponents: any[] = response.data?.components || response.data?.meta?.components || [];\n if (completionComponents.length > 0) {\n setCurrentFlow(response);\n }\n } else {\n // Initialize currentFlow for next steps if not complete\n setCurrentFlow(response);\n setFormValues({});\n setFormErrors({});\n setTouchedFields({});\n }\n },\n onProcessingStart: () => {\n setIsValidatingToken(true);\n },\n onSubmit: async (payload: any) => {\n const rawResponse: any = await onSubmit({\n ...payload,\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n });\n const response: any = normalizeFlowResponseLocal(rawResponse);\n await setChallengeToken(response.challengeToken ?? null);\n return response;\n },\n tokenValidationAttemptedRef,\n });\n\n /**\n * Handle input value changes.\n */\n const handleInputChange: any = useCallback((name: string, value: string) => {\n setFormValues((prev: any) => ({...prev, [name]: value}));\n // Clear error when user starts typing\n setFormErrors((prev: any) => {\n const newErrors: any = {...prev};\n delete newErrors[name];\n return newErrors;\n });\n setIsFormValid(true);\n }, []);\n\n /**\n * Handle input blur.\n */\n const handleInputBlur: any = useCallback((name: string) => {\n setTouchedFields((prev: any) => ({...prev, [name]: true}));\n }, []);\n\n /**\n * Validate required fields based on components.\n */\n const validateForm: any = useCallback(\n (components: any[]): {errors: Record<string, string>; isValid: boolean} => {\n const errors: Record<string, string> = {};\n\n const validateComponents = (comps: any[]): any => {\n comps.forEach((comp: any) => {\n if (\n (comp.type === 'PASSWORD_INPUT' ||\n comp.type === 'TEXT_INPUT' ||\n comp.type === 'EMAIL_INPUT' ||\n comp.type === 'PHONE_INPUT' ||\n comp.type === 'OTP_INPUT' ||\n comp.type === 'DATE_INPUT' ||\n comp.type === 'SELECT') &&\n comp.ref\n ) {\n const value: any = formValues[comp.ref];\n if (comp.required && (!value || value.trim() === '')) {\n errors[comp.ref] = t('validations.required.field.error');\n } else if (value) {\n // Evaluate declarative validation rules from meta.components[].validation.\n const ruleValidator = buildValidatorFromRules(comp.validation);\n if (ruleValidator) {\n const message = ruleValidator(value);\n if (message) {\n errors[comp.ref] = t(message);\n }\n }\n }\n }\n if (comp.components && Array.isArray(comp.components)) {\n validateComponents(comp.components);\n }\n });\n };\n\n validateComponents(components);\n\n return {errors, isValid: Object.keys(errors).length === 0};\n },\n [formValues, t],\n );\n\n /**\n * Handle form submission.\n */\n const handleSubmit: any = useCallback(\n async (component: any, data?: Record<string, any>) => {\n if (!currentFlow) {\n return;\n }\n\n // Validate form before submission\n const components: any = currentFlow.data?.components || [];\n const validation: any = validateForm(components);\n\n if (!validation.isValid) {\n setIsFormValid(false);\n setFormErrors(validation.errors);\n // Mark all fields as touched\n const touched: Record<string, boolean> = {};\n Object.keys(validation.errors).forEach((key: any) => {\n touched[key] = true;\n });\n setTouchedFields((prev: any) => ({...prev, ...touched}));\n return;\n }\n\n setIsLoading(true);\n setApiError(null);\n\n try {\n // Build payload with form values\n const inputs: any = {...(data || formValues)};\n\n // Auto-compile consent_decisions if we are on a consent prompt step.\n // Mirrors the same logic in SignIn to ensure the server receives a\n // properly structured JSON payload rather than individual checkbox keys.\n const currentAdditionalData = (currentFlow?.data?.additionalData as Record<string, any>) ?? {};\n if (currentAdditionalData['consentPrompt']) {\n try {\n const raw: any = currentAdditionalData['consentPrompt'];\n const purposes: any[] = typeof raw === 'string' ? JSON.parse(raw) : raw.purposes || raw;\n const isDeny = component?.variant?.toLowerCase() !== 'primary';\n const decisions = {\n approved: !isDeny,\n ...(isDeny ? {reason: ConsentConstants.REASON_USER_DENIED} : {}),\n purposes: purposes.map((p: any) => ({\n approved: !isDeny,\n purposeName: p.purposeName,\n elements: [\n ...(p.essential || []).map((e: any) => ({approved: !isDeny, name: e.name})),\n ...(p.optional || []).map((e: any) => {\n const key = `__consent_opt__${p.purposeId}__${e.name}`;\n return {approved: !isDeny && inputs[key] === 'true', name: e.name};\n }),\n ],\n })),\n };\n inputs.consent_decisions = JSON.stringify(decisions);\n Object.keys(inputs).forEach((k: string) => {\n if (k.startsWith('__consent_opt__')) delete inputs[k];\n });\n } catch {\n // Leave inputs as-is if consent building fails\n }\n }\n\n const payload: Record<string, any> = {\n executionId: currentFlow.executionId,\n inputs,\n verbose: true,\n ...(challengeTokenRef.current ? {challengeToken: challengeTokenRef.current} : {}),\n };\n\n // Add action ID if component has one\n if (component?.id) {\n payload['action'] = component.id;\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 // Handle OAuth redirect response\n if (response.type === 'REDIRECTION') {\n const redirectURL: any = response.data?.redirectURL || response?.redirectURL;\n if (redirectURL && typeof window !== 'undefined') {\n // Initiate OAuth redirect with secure state management\n initiateOAuthRedirect(redirectURL, vendor);\n return;\n }\n }\n\n // Check for completion\n if (response.flowStatus === 'COMPLETE') {\n setIsComplete(true);\n const completionComponents: any[] = response.data?.components || response.data?.meta?.components || [];\n if (completionComponents.length > 0) {\n setCurrentFlow(response);\n } else {\n onComplete?.();\n }\n return;\n }\n\n // Check for error status\n if (response.flowStatus === 'ERROR') {\n handleError(response);\n return;\n }\n\n // Update current flow and reset form state for next step, preserving input values\n setCurrentFlow(response);\n setFormErrors({});\n setTouchedFields({});\n\n // Display error from INCOMPLETE response\n if (response?.error) {\n handleError(response);\n }\n } catch (err) {\n handleError(err);\n } finally {\n setIsLoading(false);\n }\n },\n [\n currentFlow,\n formValues,\n validateForm,\n onSubmit,\n onFlowChange,\n onComplete,\n handleError,\n normalizeFlowResponseLocal,\n ],\n );\n\n /**\n * reset form values, errors, and touched fields to initial state\n */\n const resetForm = useCallback(() => {\n setFormValues({});\n setFormErrors({});\n setTouchedFields({});\n }, []);\n\n /**\n * Validate invite token on component mount.\n */\n useEffect(() => {\n // Skip validation if already validated\n if (tokenValidationAttemptedRef.current) {\n return;\n }\n\n // If an OAuth code is present, this is a return from an OAuth redirect.\n // useOAuthCallback will handle the code — skip the initial invite validation.\n const urlParams: URLSearchParams = new URLSearchParams(window.location.search);\n if (urlParams.get('code')) {\n return;\n }\n\n // Validate required params for initial invite link\n if (!executionId || !inviteToken) {\n setIsValidatingToken(false);\n setIsTokenInvalid(true);\n handleError(new Error('Invalid invite link. Missing executionId or inviteToken.'));\n return;\n }\n\n tokenValidationAttemptedRef.current = true;\n\n (async (): Promise<void> => {\n setIsValidatingToken(true);\n setApiError(null);\n\n try {\n // Store executionId in sessionStorage for OAuth callback\n if (executionId) {\n sessionStorage.setItem(`${vendor}_execution_id`, executionId);\n }\n\n // Send the invite token to validate and continue the flow\n const payload: any = {\n executionId,\n inputs: {\n inviteToken,\n },\n verbose: true,\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 // Check for error (invalid token)\n if (response.flowStatus === 'ERROR') {\n setIsTokenInvalid(true);\n handleError(response);\n return;\n }\n\n // Token is valid, show the password form\n setCurrentFlow(response);\n\n // Display error from INCOMPLETE response\n if (response?.error) {\n handleError(response);\n }\n } catch (err) {\n setIsTokenInvalid(true);\n handleError(err);\n } finally {\n setIsValidatingToken(false);\n }\n })();\n }, [executionId, inviteToken, onSubmit, onFlowChange, handleError, normalizeFlowResponseLocal]);\n\n /**\n * Extract title and subtitle from components.\n */\n const extractHeadings: any = useCallback((components: any[]): {subtitle?: string; title?: string} => {\n let title: string | undefined;\n let subtitle: string | undefined;\n\n components.forEach((comp: any) => {\n if (comp.type === 'TEXT') {\n if (comp.variant === 'HEADING_1' && !title) {\n title = comp.label;\n } else if ((comp.variant === 'HEADING_2' || comp.variant === 'SUBTITLE_1') && !subtitle) {\n subtitle = comp.label;\n }\n }\n });\n\n return {subtitle, title};\n }, []);\n\n /**\n * Filter out heading components for default rendering.\n */\n const filterHeadings: any = useCallback(\n (components: any[]): any[] =>\n components.filter(\n (comp: any) => !(comp.type === 'TEXT' && (comp.variant === 'HEADING_1' || comp.variant === 'HEADING_2')),\n ),\n [],\n );\n\n // Get components from normalized response, with fallback to meta.components\n const components: any = currentFlow?.data?.components || currentFlow?.data?.meta?.components || [];\n const {title, subtitle} = extractHeadings(components);\n const componentsWithoutHeadings: any = filterHeadings(components);\n const additionalData: Record<string, any> = (currentFlow?.data?.additionalData as Record<string, any>) ?? {};\n\n // Render props\n const renderProps: BaseAcceptInviteRenderProps = {\n additionalData,\n components,\n error: apiError,\n executionId,\n fieldErrors: formErrors,\n goToSignIn: onGoToSignIn,\n handleInputBlur,\n handleInputChange,\n handleSubmit,\n inviteToken,\n isComplete,\n isLoading,\n isTokenInvalid,\n isValid: isFormValid,\n isValidatingToken,\n meta,\n subtitle,\n title,\n touched: touchedFields,\n values: formValues,\n };\n\n // If children render prop is provided, use it for custom UI\n if (children) {\n return <div className={className}>{children(renderProps)}</div>;\n }\n\n // Default rendering\n\n // Loading state during token validation\n if (isValidatingToken) {\n return (\n <CardPrimitive className={cx(className, styles.card)} variant={variant}>\n <CardPrimitive.Content>\n <div className={(styles as Record<string, string>)['tokenValidationContainer']}>\n <Spinner size=\"medium\" />\n <Typography variant=\"body1\">Validating your invite link...</Typography>\n </div>\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n // Invalid token state\n if (isTokenInvalid) {\n return (\n <CardPrimitive className={cx(className, styles.card)} variant={variant}>\n <CardPrimitive.Header className={styles.header}>\n <CardPrimitive.Title level={2} className={styles.title}>\n Invalid Invite Link\n </CardPrimitive.Title>\n </CardPrimitive.Header>\n <CardPrimitive.Content>\n <AlertPrimitive variant=\"error\">\n <AlertPrimitive.Title>Unable to verify invite</AlertPrimitive.Title>\n <AlertPrimitive.Description>\n {apiError?.message ||\n 'This invite link is invalid or has expired. Please contact your administrator for a new invite.'}\n </AlertPrimitive.Description>\n </AlertPrimitive>\n {onGoToSignIn && (\n <div className={(styles as Record<string, string>)['goToSignInContainer']}>\n <Button variant=\"outline\" onClick={onGoToSignIn}>\n Go to Sign In\n </Button>\n </div>\n )}\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n }\n\n // Flow components (password form)\n return (\n <CardPrimitive className={cx(className, styles.card)} variant={variant}>\n {(showTitle || showSubtitle) && (title || subtitle) && (\n <CardPrimitive.Header className={styles.header}>\n {showTitle && title && (\n <CardPrimitive.Title level={2} className={styles.title}>\n {title}\n </CardPrimitive.Title>\n )}\n {showSubtitle && subtitle && (\n <Typography variant=\"body1\" className={styles.subtitle}>\n {subtitle}\n </Typography>\n )}\n </CardPrimitive.Header>\n )}\n <CardPrimitive.Content>\n {apiError && (\n <div className={(styles as Record<string, string>)['errorContainer']}>\n <AlertPrimitive variant=\"error\">\n <AlertPrimitive.Description>{apiError.message}</AlertPrimitive.Description>\n </AlertPrimitive>\n </div>\n )}\n <div>\n {componentsWithoutHeadings && componentsWithoutHeadings.length > 0\n ? renderInviteUserComponents(\n componentsWithoutHeadings,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n resetForm,\n handleInputChange,\n {\n _customRenderers: customRenderers,\n _theme: theme,\n onInputBlur: handleInputBlur,\n onSubmit: handleSubmit,\n size,\n variant,\n },\n )\n : !isLoading && (\n <AlertPrimitive variant=\"warning\">\n <Typography variant=\"body1\">No form components available</Typography>\n </AlertPrimitive>\n )}\n {isLoading && (\n <div className={(styles as Record<string, string>)['centeredSpinnerContainerSmall']}>\n <Spinner size=\"small\" />\n </div>\n )}\n </div>\n {onGoToSignIn && (\n <div className={(styles as Record<string, string>)['alreadyHaveAccountContainer']}>\n <Typography variant=\"body2\">\n Already have an account?{' '}\n <Button\n variant=\"text\"\n onClick={onGoToSignIn}\n className={(styles as Record<string, string>)['signInInlineButton']}\n >\n Sign In\n </Button>\n </Typography>\n </div>\n )}\n </CardPrimitive.Content>\n </CardPrimitive>\n );\n};\n\nexport default BaseAcceptInvite;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0PA,MAAMA,oBAA+C,EACnD,aACA,aACA,UACA,YACA,SACA,cACA,cACA,YAAY,IACZ,UACA,aACA,OAAO,UACP,UAAU,YACV,YAAY,MACZ,eAAe,WAC0B;CACzC,MAAM,EAAC,MAAM,eAAe,mBAAmB,WAAUC,8BAAc;CACvE,MAAM,EAAC,MAAKC,+BAAe,aAAa,KAAK;CAC7C,MAAM,EAAC,UAASC,0BAAU;CAC1B,MAAMC,wCAAmDC,yCAAyB;CAClF,MAAMC,SAAcC,wCAAU,OAAO,MAAM,KAAK,OAAO,KAAK,QAAQ;CACpE,MAAM,CAAC,WAAW,oCAAyB,MAAM;CACjD,MAAM,CAAC,mBAAmB,4CAAiC,KAAK;CAChE,MAAM,CAAC,gBAAgB,yCAA8B,MAAM;CAC3D,MAAM,CAAC,YAAY,qCAA0B,MAAM;CACnD,MAAM,CAAC,aAAa,sCAA4D,KAAK;CACrF,MAAM,CAAC,UAAU,mCAAsC,KAAK;CAC5D,MAAM,CAAC,YAAY,qCAAkD,EAAE,CAAC;CACxE,MAAM,CAAC,YAAY,qCAAkD,EAAE,CAAC;CACxE,MAAM,CAAC,eAAe,wCAAsD,EAAE,CAAC;CAC/E,MAAM,CAAC,aAAa,sCAA2B,KAAK;CACpD,MAAM,CAAC,gBAAg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AC;IAAI,WAAY,OAAkC;cACjD,4CAACC;KAAW,SAAQ;;MAAQ;MACD;MACzB,2CAACE;OACC,SAAQ;OACR,SAAS;OACT,WAAY,OAAkC;iBAC/C;QAEQ;;MACE;KACT;MAEc;GACV;;AAIpB,+BAAe"}
|
|
@@ -22,6 +22,9 @@ const require_Divider = require('../../primitives/Divider/Divider.cjs');
|
|
|
22
22
|
const require_flowIconRegistry = require('../../primitives/Icons/flowIconRegistry.cjs');
|
|
23
23
|
const require_KeyValueList = require('../../primitives/KeyValueList/KeyValueList.cjs');
|
|
24
24
|
const require_AffixedField = require('../../primitives/AffixedField/AffixedField.cjs');
|
|
25
|
+
const require_BaseAuthFlowSelect = require('../../primitives/AuthFlowSelect/BaseAuthFlowSelect.cjs');
|
|
26
|
+
const require_BaseUserSelect = require('../../primitives/UserSelect/BaseUserSelect.cjs');
|
|
27
|
+
const require_BaseUserTypeSelect = require('../../primitives/UserTypeSelect/BaseUserTypeSelect.cjs');
|
|
25
28
|
let __thunderid_browser = require("@thunderid/browser");
|
|
26
29
|
__thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
|
|
27
30
|
let react = require("react");
|
|
@@ -133,20 +136,23 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
133
136
|
const customRenderers = options._customRenderers ?? {};
|
|
134
137
|
const key = options.key || component.id;
|
|
135
138
|
const customRenderer = customRenderers[component.id] ?? customRenderers[component.type];
|
|
136
|
-
if (customRenderer)
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
139
|
+
if (customRenderer) {
|
|
140
|
+
const rendered = customRenderer(component, {
|
|
141
|
+
additionalData: options.additionalData,
|
|
142
|
+
authType,
|
|
143
|
+
formErrors,
|
|
144
|
+
formValues,
|
|
145
|
+
isFormValid,
|
|
146
|
+
isLoading,
|
|
147
|
+
meta: options.meta,
|
|
148
|
+
resetForm,
|
|
149
|
+
onInputBlur: options.onInputBlur,
|
|
150
|
+
onInputChange,
|
|
151
|
+
onSubmit: options.onSubmit,
|
|
152
|
+
touchedFields
|
|
153
|
+
});
|
|
154
|
+
return rendered ? (0, react.cloneElement)(rendered, { key }) : null;
|
|
155
|
+
}
|
|
150
156
|
/** Resolve any remaining {{t()}} or {{meta()}} template expressions in a string at render time. */
|
|
151
157
|
const resolve = (text) => {
|
|
152
158
|
if (!text || !options.t && !options.meta) return text || "";
|
|
@@ -155,6 +161,28 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
155
161
|
t: options.t || ((k) => k)
|
|
156
162
|
});
|
|
157
163
|
};
|
|
164
|
+
const resourceSelectProps = () => {
|
|
165
|
+
const identifier = component.ref;
|
|
166
|
+
const isTouched = touchedFields[identifier] || false;
|
|
167
|
+
return {
|
|
168
|
+
className: require_emotion.cx(options.inputClassName, component.classes),
|
|
169
|
+
component,
|
|
170
|
+
error: isTouched ? formErrors[identifier] : void 0,
|
|
171
|
+
id: component.id,
|
|
172
|
+
label: resolve(component.label) || "",
|
|
173
|
+
name: identifier,
|
|
174
|
+
onBlur: () => options.onInputBlur?.(identifier),
|
|
175
|
+
onChange: (event) => onInputChange(identifier, event.target.value),
|
|
176
|
+
onError: options.onPickerError,
|
|
177
|
+
placeholder: resolve(component.placeholder),
|
|
178
|
+
required: component.required,
|
|
179
|
+
value: formValues[identifier] || ""
|
|
180
|
+
};
|
|
181
|
+
};
|
|
182
|
+
const skipUnsupported = (typeName) => {
|
|
183
|
+
logger.warn(`${typeName} component type is not supported. Skipping render.`);
|
|
184
|
+
return null;
|
|
185
|
+
};
|
|
158
186
|
switch (component.type) {
|
|
159
187
|
case __thunderid_browser.EmbeddedFlowComponentType.TextInput:
|
|
160
188
|
case __thunderid_browser.EmbeddedFlowComponentType.PasswordInput:
|
|
@@ -392,9 +420,19 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
392
420
|
className: require_emotion.cx(options.inputClassName, component.classes)
|
|
393
421
|
}, key);
|
|
394
422
|
}
|
|
395
|
-
case __thunderid_browser.EmbeddedFlowComponentType.OuSelect:
|
|
396
|
-
|
|
397
|
-
|
|
423
|
+
case __thunderid_browser.EmbeddedFlowComponentType.OuSelect: return skipUnsupported("OU_SELECT");
|
|
424
|
+
case __thunderid_browser.EmbeddedFlowComponentType.UserSelect: return options.fetchUsers ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_BaseUserSelect.default, {
|
|
425
|
+
...resourceSelectProps(),
|
|
426
|
+
fetchUsers: options.fetchUsers
|
|
427
|
+
}, key) : skipUnsupported("USER_SELECT");
|
|
428
|
+
case __thunderid_browser.EmbeddedFlowComponentType.AuthFlowSelect: return options.fetchAuthFlows ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_BaseAuthFlowSelect.default, {
|
|
429
|
+
...resourceSelectProps(),
|
|
430
|
+
fetchAuthFlows: options.fetchAuthFlows
|
|
431
|
+
}, key) : skipUnsupported("AUTH_FLOW_SELECT");
|
|
432
|
+
case __thunderid_browser.EmbeddedFlowComponentType.UserTypeSelect: return options.fetchUserTypes ? /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_BaseUserTypeSelect.default, {
|
|
433
|
+
...resourceSelectProps(),
|
|
434
|
+
fetchUserTypes: options.fetchUserTypes
|
|
435
|
+
}, key) : skipUnsupported("USER_TYPE_SELECT");
|
|
398
436
|
case __thunderid_browser.EmbeddedFlowComponentType.Block:
|
|
399
437
|
if (component.components && component.components.length > 0) {
|
|
400
438
|
const formClass = require_emotion.css({
|
|
@@ -545,6 +583,7 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
|
|
|
545
583
|
const value = sourceKey && options.additionalData ? String(options.additionalData[sourceKey] ?? "") : "";
|
|
546
584
|
return /* @__PURE__ */ (0, react_jsx_runtime.jsx)(require_CopyableText.default, {
|
|
547
585
|
label: resolve(component.label) || void 0,
|
|
586
|
+
masked: Boolean(component.masked),
|
|
548
587
|
value
|
|
549
588
|
}, key);
|
|
550
589
|
}
|