@thunderid/react 0.13.1 → 1.0.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/cjs/components/factories/FieldFactory.cjs +4 -1
  2. package/dist/cjs/components/factories/FieldFactory.cjs.map +1 -1
  3. package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs +5 -0
  4. package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs.map +1 -1
  5. package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs +3 -1
  6. package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs.map +1 -1
  7. package/dist/cjs/components/presentation/auth/SignUp/SignUp.cjs +1 -1
  8. package/dist/cjs/components/presentation/auth/SignUp/SignUp.cjs.map +1 -1
  9. package/dist/cjs/components/primitives/OtpField/OtpField.cjs +4 -3
  10. package/dist/cjs/components/primitives/OtpField/OtpField.cjs.map +1 -1
  11. package/dist/cjs/contexts/I18n/I18nProvider.cjs +1 -2
  12. package/dist/cjs/contexts/I18n/I18nProvider.cjs.map +1 -1
  13. package/dist/cjs/hooks/useTranslation.cjs +1 -2
  14. package/dist/cjs/hooks/useTranslation.cjs.map +1 -1
  15. package/dist/cjs/utils/flowTransformer.cjs +12 -6
  16. package/dist/cjs/utils/flowTransformer.cjs.map +1 -1
  17. package/dist/components/factories/FieldFactory.d.ts +8 -0
  18. package/dist/components/factories/FieldFactory.d.ts.map +1 -1
  19. package/dist/components/factories/FieldFactory.js +4 -1
  20. package/dist/components/factories/FieldFactory.js.map +1 -1
  21. package/dist/components/presentation/auth/AuthOptionFactory.d.ts.map +1 -1
  22. package/dist/components/presentation/auth/AuthOptionFactory.js +5 -0
  23. package/dist/components/presentation/auth/AuthOptionFactory.js.map +1 -1
  24. package/dist/components/presentation/auth/SignUp/BaseSignUp.d.ts.map +1 -1
  25. package/dist/components/presentation/auth/SignUp/BaseSignUp.js +3 -1
  26. package/dist/components/presentation/auth/SignUp/BaseSignUp.js.map +1 -1
  27. package/dist/components/presentation/auth/SignUp/SignUp.d.ts.map +1 -1
  28. package/dist/components/presentation/auth/SignUp/SignUp.js +1 -1
  29. package/dist/components/presentation/auth/SignUp/SignUp.js.map +1 -1
  30. package/dist/components/primitives/OtpField/OtpField.d.ts +4 -0
  31. package/dist/components/primitives/OtpField/OtpField.d.ts.map +1 -1
  32. package/dist/components/primitives/OtpField/OtpField.js +4 -3
  33. package/dist/components/primitives/OtpField/OtpField.js.map +1 -1
  34. package/dist/contexts/I18n/I18nProvider.d.ts.map +1 -1
  35. package/dist/contexts/I18n/I18nProvider.js +2 -3
  36. package/dist/contexts/I18n/I18nProvider.js.map +1 -1
  37. package/dist/hooks/useTranslation.d.ts.map +1 -1
  38. package/dist/hooks/useTranslation.js +2 -3
  39. package/dist/hooks/useTranslation.js.map +1 -1
  40. package/dist/utils/flowTransformer.d.ts +7 -11
  41. package/dist/utils/flowTransformer.d.ts.map +1 -1
  42. package/dist/utils/flowTransformer.js +10 -6
  43. package/dist/utils/flowTransformer.js.map +1 -1
  44. package/package.json +2 -2
@@ -1,4 +1,7 @@
1
+ const require_rolldown_runtime = require('../_virtual/rolldown_runtime.cjs');
1
2
  const require_resolveTranslationsInArray = require('./resolveTranslationsInArray.cjs');
3
+ let __thunderid_browser = require("@thunderid/browser");
4
+ __thunderid_browser = require_rolldown_runtime.__toESM(__thunderid_browser);
2
5
 
3
6
  //#region src/utils/flowTransformer.ts
4
7
  /**
@@ -87,8 +90,10 @@ const transformComponents = (response, t, resolveTranslations = true, meta) => {
87
90
  * Extract error message from flow error response.
88
91
  *
89
92
  * Resolution order:
90
- * 1. Structured `error` object: try i18n lookup via `t(error.message.key)`.
91
- * 2. Fallback to `defaultValue` from `message`, then `description`.
93
+ * 1. Structured `error` object: try i18n lookup via `t(error.message.key, error.message.params)`.
94
+ * Bundle entries keep the backend's `{{param(name)}}` placeholders, so `params` must be passed
95
+ * through; a resolved value that still holds an unsubstituted placeholder is treated as a miss.
96
+ * 2. Fallback to `defaultValue` from `message`, then `description` (the backend pre-substitutes it).
92
97
  * 3. Standard `Error.message`.
93
98
  * 4. Generic translated fallback via `defaultErrorKey`.
94
99
  */
@@ -96,11 +101,12 @@ const extractErrorMessage = (error, t, defaultErrorKey = "errors.flow.generic")
96
101
  if (error && typeof error === "object" && error.error) {
97
102
  const flowError = error.error;
98
103
  if (flowError?.message?.key) {
99
- const translated = t(flowError.message.key);
100
- if (translated && translated !== flowError.message.key) return translated;
104
+ const params = flowError.message.params;
105
+ const translated = t(flowError.message.key, params);
106
+ if (translated && translated !== flowError.message.key && !(0, __thunderid_browser.hasUnresolvedTranslationParams)(translated)) return translated;
101
107
  const systemKey = `system.${flowError.message.key}`;
102
- const systemTranslated = t(systemKey);
103
- if (systemTranslated && systemTranslated !== systemKey) return systemTranslated;
108
+ const systemTranslated = t(systemKey, params);
109
+ if (systemTranslated && systemTranslated !== systemKey && !(0, __thunderid_browser.hasUnresolvedTranslationParams)(systemTranslated)) return systemTranslated;
104
110
  }
105
111
  const fallback = flowError?.message?.defaultValue ?? flowError?.description?.defaultValue;
106
112
  if (fallback) return fallback;
@@ -1 +1 @@
1
- {"version":3,"file":"flowTransformer.cjs","names":["mapping: Map<string, string>","transformedComponent: any","inputData: any","value: string","refMapping: Map<string, string>","actionMapping: Map<string, string>","inputsData: any[]","resolveTranslationsInArray","flowError: FlowErrorResponse['error']","translated: string","systemTranslated: string","fallback: string | undefined","additionalData: Record<string, any>","parsed: any"],"sources":["../../../src/utils/flowTransformer.ts"],"sourcesContent":["// Copyright 2025-2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * @fileoverview Shared flow response transformer utilities for v2 embedded flows.\n *\n * This module provides reusable transformation functions for normalizing embedded flow\n * responses from ThunderID APIs. It handles both successful responses with component\n * extraction and error responses with proper error message extraction.\n *\n * Key features:\n * - Component extraction from flow meta structure\n * - Translation string resolution in components\n * - Error response detection and message extraction\n * - Configurable error handling (throw vs return errors)\n *\n * Usage:\n * ```typescript\n * import { normalizeFlowResponse } from '../../../utils/flowTransformer';\n *\n * const { executionId, components } = normalizeFlowResponse(apiResponse, t, {\n * defaultErrorKey: 'components.signIn.errors.generic'\n * });\n * ```\n *\n * This transformer is used by both SignIn and SignUp v2 components to ensure\n * consistent response handling across all embedded flows.\n */\n\nimport {EmbeddedFlowComponent, FlowMetadataResponse} from '@thunderid/browser';\nimport resolveTranslationsInArray from './resolveTranslationsInArray';\nimport {UseTranslation} from '../hooks/useTranslation';\n\n/**\n * Generic flow error response interface that covers common error structure\n */\nexport interface FlowErrorResponse {\n error?: {\n code: string;\n description: {key: string; defaultValue?: string};\n message: {key: string; defaultValue?: string};\n };\n executionId: string;\n flowStatus: 'ERROR';\n}\n\n/**\n * Configuration options for flow transformation\n */\nexport interface FlowTransformOptions {\n /**\n * Default error message key for translation fallback\n * @default 'errors.flow.generic'\n */\n defaultErrorKey?: string;\n /**\n * Whether to resolve translation strings or keep them as i18n keys\n * @default true\n */\n resolveTranslations?: boolean;\n /**\n * Whether to throw errors or return them as normalized response\n * @default true\n */\n throwOnError?: boolean;\n}\n\n/**\n * Create a mapping from ref to identifier based on data.inputs array.\n * This handles cases where meta.components use 'ref' to reference inputs,\n * and data.inputs contain the actual 'identifier' field.\n *\n * @param response - The flow response object\n * @returns Map of ref to identifier\n */\nconst createInputRefMapping = (response: any): Map<string, string> => {\n const mapping: Map<string, string> = new Map<string, string>();\n\n if (response?.data?.inputs && Array.isArray(response.data.inputs)) {\n response.data.inputs.forEach((input: any) => {\n if (input.ref && input.identifier) {\n mapping.set(input.ref, input.identifier);\n }\n });\n }\n\n return mapping;\n};\n\n/**\n * Create a mapping from action ref to nextNode based on data.actions array.\n * This handles cases where meta.components reference actions by ref,\n * and data.actions contain the actual nextNode field for routing.\n *\n * @param response - The flow response object\n * @returns Map of action ref to nextNode\n */\nconst createActionRefMapping = (response: any): Map<string, string> => {\n const mapping: Map<string, string> = new Map<string, string>();\n\n if (response?.data?.actions && Array.isArray(response.data.actions)) {\n response.data.actions.forEach((action: any) => {\n if (action.ref && action.nextNode) {\n mapping.set(action.ref, action.nextNode);\n }\n });\n }\n\n return mapping;\n};\n\n/**\n * Apply input ref mapping to components recursively.\n * This ensures that component.ref values are mapped to the correct identifier\n * from data.inputs, enabling proper form submission.\n *\n * @param components - Array of components to transform\n * @param refMapping - Map of ref to identifier\n * @param actionMapping - Map of action ref to nextNode\n * @param inputsData - Array of input data for resolving SELECT options\n * @returns Transformed components with correct identifiers and action references\n */\nconst applyInputRefMapping = (\n components: EmbeddedFlowComponent[],\n refMapping: Map<string, string>,\n actionMapping: Map<string, string>,\n inputsData: any[] = [],\n): EmbeddedFlowComponent[] =>\n components.map((component: EmbeddedFlowComponent) => {\n const transformedComponent: any = {...component} as EmbeddedFlowComponent & {\n actionRef?: string;\n options?: {label: string; value: string}[];\n };\n\n // If this component has a ref that maps to an identifier, update it\n if (transformedComponent.ref && refMapping.has(transformedComponent.ref)) {\n transformedComponent.ref = refMapping.get(transformedComponent.ref);\n }\n\n // For SELECT components, copy options from data.inputs\n // The component.id matches the input.ref in the data structure\n if (transformedComponent.type === 'SELECT' && component.id) {\n const inputData: any = inputsData.find((input: any) => input.ref === component.id);\n if (inputData?.options) {\n transformedComponent.options = inputData.options.map((opt: any) => {\n if (typeof opt === 'string') {\n return {label: opt, value: opt};\n }\n // Safely handle non-string values to prevent React key crashes\n const value: string = typeof opt.value === 'object' ? JSON.stringify(opt.value) : String(opt.value || '');\n const label: string = typeof opt.label === 'object' ? JSON.stringify(opt.label) : String(opt.label || value);\n\n return {label, value};\n });\n }\n }\n\n // If this is an action component, map its id to the nextNode\n // Store the nextNode reference as actionRef property for later use\n if (\n transformedComponent.type === 'ACTION' &&\n transformedComponent.id &&\n actionMapping.has(transformedComponent.id)\n ) {\n transformedComponent.actionRef = actionMapping.get(transformedComponent.id);\n }\n\n // Recursively apply to nested components\n if (transformedComponent.components && Array.isArray(transformedComponent.components)) {\n transformedComponent.components = applyInputRefMapping(\n transformedComponent.components,\n refMapping,\n actionMapping,\n inputsData,\n );\n }\n\n return transformedComponent;\n });\n\n/**\n * Transform and resolve translations in components from flow response.\n * This function extracts components from the response meta structure and optionally resolves\n * any translation strings within them. It also handles mapping of input refs to identifiers\n * and action refs to nextNode values.\n *\n * @param response - The flow response object containing components in meta structure\n * @param t - Translation function from useTranslation hook\n * @param resolveTranslations - Whether to resolve translation strings or keep them as i18n keys (default: true)\n * @returns Array of flow components with resolved or unresolved translations\n */\nexport const transformComponents = (\n response: any,\n t: UseTranslation['t'],\n resolveTranslations = true,\n meta?: FlowMetadataResponse | null,\n): EmbeddedFlowComponent[] => {\n if (!response?.data?.meta?.components) {\n return [];\n }\n\n let {components} = response.data.meta;\n\n // Create mapping from ref to identifier based on data.inputs\n const refMapping: Map<string, string> = createInputRefMapping(response);\n\n // Create mapping from action ref to nextNode based on data.actions\n const actionMapping: Map<string, string> = createActionRefMapping(response);\n\n // Get inputs data for SELECT option resolution\n const inputsData: any[] = response?.data?.inputs || [];\n\n // Apply ref and action mapping if there are any mappings\n if (refMapping.size > 0 || actionMapping.size > 0 || inputsData.length > 0) {\n components = applyInputRefMapping(components, refMapping, actionMapping, inputsData);\n }\n\n return resolveTranslations ? resolveTranslationsInArray(components, t, undefined, meta) : components;\n};\n\n/**\n * Extract error message from flow error response.\n *\n * Resolution order:\n * 1. Structured `error` object: try i18n lookup via `t(error.message.key)`.\n * 2. Fallback to `defaultValue` from `message`, then `description`.\n * 3. Standard `Error.message`.\n * 4. Generic translated fallback via `defaultErrorKey`.\n */\nexport const extractErrorMessage = (\n error: FlowErrorResponse | any,\n t: UseTranslation['t'],\n defaultErrorKey = 'errors.flow.generic',\n): string => {\n if (error && typeof error === 'object' && error.error) {\n const flowError: FlowErrorResponse['error'] = error.error;\n\n // 1. Try i18n lookup on message.key first (preferred for user-facing errors)\n if (flowError?.message?.key) {\n const translated: string = t(flowError.message.key);\n if (translated && translated !== flowError.message.key) {\n return translated;\n }\n\n // If the key resolved to itself, retry under the 'system:' namespace\n const systemKey = `system.${flowError.message.key}`;\n const systemTranslated: string = t(systemKey);\n if (systemTranslated && systemTranslated !== systemKey) {\n return systemTranslated;\n }\n }\n\n // 2. Fall back to defaultValue from message, then description\n const fallback: string | undefined = flowError?.message?.defaultValue ?? flowError?.description?.defaultValue;\n if (fallback) {\n return fallback;\n }\n }\n\n // Legacy backward compatibility\n if (error && typeof error === 'object' && error.failureReason) {\n return error.failureReason;\n }\n\n if (error instanceof Error && error.message) {\n return error.message;\n }\n\n return t(defaultErrorKey);\n};\n\n/**\n * Check if a response is an error response and extract the error message.\n * This function identifies error responses by checking for ERROR status and failure reasons.\n *\n * @param response - The flow response to check\n * @param t - Translation function for error messages\n * @param defaultErrorKey - Default translation key for generic errors\n * @returns Error message string if response is an error, null otherwise\n */\nexport const checkForErrorResponse = (\n response: any,\n t: UseTranslation['t'],\n defaultErrorKey = 'errors.flow.generic',\n): string | null => {\n if (response?.flowStatus === 'ERROR') {\n return extractErrorMessage(response, t, defaultErrorKey);\n }\n\n return null;\n};\n\n/**\n * Generic flow response normalizer that handles both success and error responses.\n * This is the main transformer function that should be used by all flow components.\n *\n * @param response - The raw flow response from the API\n * @param t - Translation function from useTranslation hook\n * @param options - Configuration options for transformation behavior\n * @returns Normalized flow response with executionId and transformed components\n * @throws {any} The original response if it's an error and throwOnError is true\n */\nexport const normalizeFlowResponse = (\n response: any,\n t: UseTranslation['t'],\n options: FlowTransformOptions = {},\n meta?: FlowMetadataResponse | null,\n): {\n additionalData: Record<string, any>;\n components: EmbeddedFlowComponent[];\n executionId: string;\n} => {\n const {throwOnError = true, defaultErrorKey = 'errors.flow.generic', resolveTranslations = true} = options;\n\n // Check if this is an error response\n const errorMessage: string | null = checkForErrorResponse(response, t, defaultErrorKey);\n\n if (errorMessage && throwOnError) {\n // Throw the original response so it can be caught by error handling\n throw response;\n }\n\n const additionalData: Record<string, any> = (response?.data?.additionalData as Record<string, any>) ?? {};\n\n // The consent prompt is serialized as a JSON string (array) by the backend.\n // Parse it and wrap in the expected {purposes: [...]} structure.\n if (typeof additionalData['consentPrompt'] === 'string') {\n try {\n const parsed: any = JSON.parse(additionalData['consentPrompt']);\n additionalData['consentPrompt'] = {purposes: Array.isArray(parsed) ? parsed : []};\n } catch {\n // Leave unparseable value as-is\n }\n }\n\n return {\n additionalData,\n components: transformComponents(response, t, resolveTranslations, meta),\n executionId: response.executionId,\n };\n};\n"],"mappings":";;;;;;;;;;;AA2EA,MAAM,yBAAyB,aAAuC;CACpE,MAAMA,0BAA+B,IAAI,KAAqB;AAE9D,KAAI,UAAU,MAAM,UAAU,MAAM,QAAQ,SAAS,KAAK,OAAO,CAC/D,UAAS,KAAK,OAAO,SAAS,UAAe;AAC3C,MAAI,MAAM,OAAO,MAAM,WACrB,SAAQ,IAAI,MAAM,KAAK,MAAM,WAAW;GAE1C;AAGJ,QAAO;;;;;;;;;;AAWT,MAAM,0BAA0B,aAAuC;CACrE,MAAMA,0BAA+B,IAAI,KAAqB;AAE9D,KAAI,UAAU,MAAM,WAAW,MAAM,QAAQ,SAAS,KAAK,QAAQ,CACjE,UAAS,KAAK,QAAQ,SAAS,WAAgB;AAC7C,MAAI,OAAO,OAAO,OAAO,SACvB,SAAQ,IAAI,OAAO,KAAK,OAAO,SAAS;GAE1C;AAGJ,QAAO;;;;;;;;;;;;;AAcT,MAAM,wBACJ,YACA,YACA,eACA,aAAoB,EAAE,KAEtB,WAAW,KAAK,cAAqC;CACnD,MAAMC,uBAA4B,EAAC,GAAG,WAAU;AAMhD,KAAI,qBAAqB,OAAO,WAAW,IAAI,qBAAqB,IAAI,CACtE,sBAAqB,MAAM,WAAW,IAAI,qBAAqB,IAAI;AAKrE,KAAI,qBAAqB,SAAS,YAAY,UAAU,IAAI;EAC1D,MAAMC,YAAiB,WAAW,MAAM,UAAe,MAAM,QAAQ,UAAU,GAAG;AAClF,MAAI,WAAW,QACb,sBAAqB,UAAU,UAAU,QAAQ,KAAK,QAAa;AAC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AAO;GAIT,MAAM,YAAY,UAAU,UAAU,QAAQ;GAC9C,MAAMC,mBAA2B,EAAE,UAAU;AAC7C,OAAI,oBAAoB,qBAAqB,UAC3C,QAAO;;EAKX,MAAMC,WAA+B,WAAW,SAAS,gBAAgB,WAAW,aAAa;AACjG,MAAI,SACF,QAAO;;AAKX,KAAI,SAAS,OAAO,UAAU,YAAY,MAAM,cAC9C,QAAO,MAAM;AAGf,KAAI,iBAAiB,SAAS,MAAM,QAClC,QAAO,MAAM;AAGf,QAAO,EAAE,gBAAgB;;;;;;;;;;;AAY3B,MAAa,yBACX,UACA,GACA,kBAAkB,0BACA;AAClB,KAAI,UAAU,eAAe,QAC3B,QAAO,oBAAoB,UAAU,GAAG,gBAAgB;AAG1D,QAAO;;;;;;;;;;;;AAaT,MAAa,yBACX,UACA,GACA,UAAgC,EAAE,EAClC,SAKG;CACH,MAAM,EAAC,eAAe,MAAM,kBAAkB,uBAAuB,sBAAsB,SAAQ;AAKnG,KAFoC,sBAAsB,UAAU,GAAG,gBAAgB,IAEnE,aAElB,OAAM;CAGR,MAAMC,iBAAuC,UAAU,MAAM,kBAA0C,EAAE;AAIzG,KAAI,OAAO,eAAe,qBAAqB,SAC7C,KAAI;EACF,MAAMC,SAAc,KAAK,MAAM,eAAe,iBAAiB;AAC/D,iBAAe,mBAAmB,EAAC,UAAU,MAAM,QAAQ,OAAO,GAAG,SAAS,EAAE,EAAC;SAC3E;AAKV,QAAO;EACL;EACA,YAAY,oBAAoB,UAAU,GAAG,qBAAqB,KAAK;EACvE,aAAa,SAAS;EACvB"}
1
+ {"version":3,"file":"flowTransformer.cjs","names":["mapping: Map<string, string>","transformedComponent: any","inputData: any","value: string","refMapping: Map<string, string>","actionMapping: Map<string, string>","inputsData: any[]","resolveTranslationsInArray","flowError: FlowErrorResponse['error']","params: Record<string, string> | undefined","translated: string","systemTranslated: string","fallback: string | undefined","additionalData: Record<string, any>","parsed: any"],"sources":["../../../src/utils/flowTransformer.ts"],"sourcesContent":["// Copyright 2025-2026 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\n/**\n * @fileoverview Shared flow response transformer utilities for v2 embedded flows.\n *\n * This module provides reusable transformation functions for normalizing embedded flow\n * responses from ThunderID APIs. It handles both successful responses with component\n * extraction and error responses with proper error message extraction.\n *\n * Key features:\n * - Component extraction from flow meta structure\n * - Translation string resolution in components\n * - Error response detection and message extraction\n * - Configurable error handling (throw vs return errors)\n *\n * Usage:\n * ```typescript\n * import { normalizeFlowResponse } from '../../../utils/flowTransformer';\n *\n * const { executionId, components } = normalizeFlowResponse(apiResponse, t, {\n * defaultErrorKey: 'components.signIn.errors.generic'\n * });\n * ```\n *\n * This transformer is used by both SignIn and SignUp v2 components to ensure\n * consistent response handling across all embedded flows.\n */\n\nimport {\n EmbeddedFlowComponent,\n FlowMetadataResponse,\n I18nMessage,\n hasUnresolvedTranslationParams,\n} from '@thunderid/browser';\nimport resolveTranslationsInArray from './resolveTranslationsInArray';\nimport {UseTranslation} from '../hooks/useTranslation';\n\n/**\n * Generic flow error response interface that covers common error structure\n */\nexport interface FlowErrorResponse {\n error?: {\n code: string;\n description: I18nMessage;\n message: I18nMessage;\n };\n executionId: string;\n flowStatus: 'ERROR';\n}\n\n/**\n * Configuration options for flow transformation\n */\nexport interface FlowTransformOptions {\n /**\n * Default error message key for translation fallback\n * @default 'errors.flow.generic'\n */\n defaultErrorKey?: string;\n /**\n * Whether to resolve translation strings or keep them as i18n keys\n * @default true\n */\n resolveTranslations?: boolean;\n /**\n * Whether to throw errors or return them as normalized response\n * @default true\n */\n throwOnError?: boolean;\n}\n\n/**\n * Create a mapping from ref to identifier based on data.inputs array.\n * This handles cases where meta.components use 'ref' to reference inputs,\n * and data.inputs contain the actual 'identifier' field.\n *\n * @param response - The flow response object\n * @returns Map of ref to identifier\n */\nconst createInputRefMapping = (response: any): Map<string, string> => {\n const mapping: Map<string, string> = new Map<string, string>();\n\n if (response?.data?.inputs && Array.isArray(response.data.inputs)) {\n response.data.inputs.forEach((input: any) => {\n if (input.ref && input.identifier) {\n mapping.set(input.ref, input.identifier);\n }\n });\n }\n\n return mapping;\n};\n\n/**\n * Create a mapping from action ref to nextNode based on data.actions array.\n * This handles cases where meta.components reference actions by ref,\n * and data.actions contain the actual nextNode field for routing.\n *\n * @param response - The flow response object\n * @returns Map of action ref to nextNode\n */\nconst createActionRefMapping = (response: any): Map<string, string> => {\n const mapping: Map<string, string> = new Map<string, string>();\n\n if (response?.data?.actions && Array.isArray(response.data.actions)) {\n response.data.actions.forEach((action: any) => {\n if (action.ref && action.nextNode) {\n mapping.set(action.ref, action.nextNode);\n }\n });\n }\n\n return mapping;\n};\n\n/**\n * Apply input ref mapping to components recursively.\n * This ensures that component.ref values are mapped to the correct identifier\n * from data.inputs, enabling proper form submission.\n *\n * @param components - Array of components to transform\n * @param refMapping - Map of ref to identifier\n * @param actionMapping - Map of action ref to nextNode\n * @param inputsData - Array of input data for resolving SELECT options\n * @returns Transformed components with correct identifiers and action references\n */\nconst applyInputRefMapping = (\n components: EmbeddedFlowComponent[],\n refMapping: Map<string, string>,\n actionMapping: Map<string, string>,\n inputsData: any[] = [],\n): EmbeddedFlowComponent[] =>\n components.map((component: EmbeddedFlowComponent) => {\n const transformedComponent: any = {...component} as EmbeddedFlowComponent & {\n actionRef?: string;\n options?: {label: string; value: string}[];\n };\n\n // If this component has a ref that maps to an identifier, update it\n if (transformedComponent.ref && refMapping.has(transformedComponent.ref)) {\n transformedComponent.ref = refMapping.get(transformedComponent.ref);\n }\n\n // For SELECT components, copy options from data.inputs\n // The component.id matches the input.ref in the data structure\n if (transformedComponent.type === 'SELECT' && component.id) {\n const inputData: any = inputsData.find((input: any) => input.ref === component.id);\n if (inputData?.options) {\n transformedComponent.options = inputData.options.map((opt: any) => {\n if (typeof opt === 'string') {\n return {label: opt, value: opt};\n }\n // Safely handle non-string values to prevent React key crashes\n const value: string = typeof opt.value === 'object' ? JSON.stringify(opt.value) : String(opt.value || '');\n const label: string = typeof opt.label === 'object' ? JSON.stringify(opt.label) : String(opt.label || value);\n\n return {label, value};\n });\n }\n }\n\n // If this is an action component, map its id to the nextNode\n // Store the nextNode reference as actionRef property for later use\n if (\n transformedComponent.type === 'ACTION' &&\n transformedComponent.id &&\n actionMapping.has(transformedComponent.id)\n ) {\n transformedComponent.actionRef = actionMapping.get(transformedComponent.id);\n }\n\n // Recursively apply to nested components\n if (transformedComponent.components && Array.isArray(transformedComponent.components)) {\n transformedComponent.components = applyInputRefMapping(\n transformedComponent.components,\n refMapping,\n actionMapping,\n inputsData,\n );\n }\n\n return transformedComponent;\n });\n\n/**\n * Transform and resolve translations in components from flow response.\n * This function extracts components from the response meta structure and optionally resolves\n * any translation strings within them. It also handles mapping of input refs to identifiers\n * and action refs to nextNode values.\n *\n * @param response - The flow response object containing components in meta structure\n * @param t - Translation function from useTranslation hook\n * @param resolveTranslations - Whether to resolve translation strings or keep them as i18n keys (default: true)\n * @returns Array of flow components with resolved or unresolved translations\n */\nexport const transformComponents = (\n response: any,\n t: UseTranslation['t'],\n resolveTranslations = true,\n meta?: FlowMetadataResponse | null,\n): EmbeddedFlowComponent[] => {\n if (!response?.data?.meta?.components) {\n return [];\n }\n\n let {components} = response.data.meta;\n\n // Create mapping from ref to identifier based on data.inputs\n const refMapping: Map<string, string> = createInputRefMapping(response);\n\n // Create mapping from action ref to nextNode based on data.actions\n const actionMapping: Map<string, string> = createActionRefMapping(response);\n\n // Get inputs data for SELECT option resolution\n const inputsData: any[] = response?.data?.inputs || [];\n\n // Apply ref and action mapping if there are any mappings\n if (refMapping.size > 0 || actionMapping.size > 0 || inputsData.length > 0) {\n components = applyInputRefMapping(components, refMapping, actionMapping, inputsData);\n }\n\n return resolveTranslations ? resolveTranslationsInArray(components, t, undefined, meta) : components;\n};\n\n/**\n * Extract error message from flow error response.\n *\n * Resolution order:\n * 1. Structured `error` object: try i18n lookup via `t(error.message.key, error.message.params)`.\n * Bundle entries keep the backend's `{{param(name)}}` placeholders, so `params` must be passed\n * through; a resolved value that still holds an unsubstituted placeholder is treated as a miss.\n * 2. Fallback to `defaultValue` from `message`, then `description` (the backend pre-substitutes it).\n * 3. Standard `Error.message`.\n * 4. Generic translated fallback via `defaultErrorKey`.\n */\nexport const extractErrorMessage = (\n error: FlowErrorResponse | any,\n t: UseTranslation['t'],\n defaultErrorKey = 'errors.flow.generic',\n): string => {\n if (error && typeof error === 'object' && error.error) {\n const flowError: FlowErrorResponse['error'] = error.error;\n\n // 1. Try i18n lookup on message.key first (preferred for user-facing errors)\n if (flowError?.message?.key) {\n const params: Record<string, string> | undefined = flowError.message.params;\n\n const translated: string = t(flowError.message.key, params);\n if (translated && translated !== flowError.message.key && !hasUnresolvedTranslationParams(translated)) {\n return translated;\n }\n\n // If the key resolved to itself, retry under the 'system:' namespace\n const systemKey = `system.${flowError.message.key}`;\n const systemTranslated: string = t(systemKey, params);\n if (systemTranslated && systemTranslated !== systemKey && !hasUnresolvedTranslationParams(systemTranslated)) {\n return systemTranslated;\n }\n }\n\n // 2. Fall back to defaultValue from message, then description\n const fallback: string | undefined = flowError?.message?.defaultValue ?? flowError?.description?.defaultValue;\n if (fallback) {\n return fallback;\n }\n }\n\n // Legacy backward compatibility\n if (error && typeof error === 'object' && error.failureReason) {\n return error.failureReason;\n }\n\n if (error instanceof Error && error.message) {\n return error.message;\n }\n\n return t(defaultErrorKey);\n};\n\n/**\n * Check if a response is an error response and extract the error message.\n * This function identifies error responses by checking for ERROR status and failure reasons.\n *\n * @param response - The flow response to check\n * @param t - Translation function for error messages\n * @param defaultErrorKey - Default translation key for generic errors\n * @returns Error message string if response is an error, null otherwise\n */\nexport const checkForErrorResponse = (\n response: any,\n t: UseTranslation['t'],\n defaultErrorKey = 'errors.flow.generic',\n): string | null => {\n if (response?.flowStatus === 'ERROR') {\n return extractErrorMessage(response, t, defaultErrorKey);\n }\n\n return null;\n};\n\n/**\n * Generic flow response normalizer that handles both success and error responses.\n * This is the main transformer function that should be used by all flow components.\n *\n * @param response - The raw flow response from the API\n * @param t - Translation function from useTranslation hook\n * @param options - Configuration options for transformation behavior\n * @returns Normalized flow response with executionId and transformed components\n * @throws {any} The original response if it's an error and throwOnError is true\n */\nexport const normalizeFlowResponse = (\n response: any,\n t: UseTranslation['t'],\n options: FlowTransformOptions = {},\n meta?: FlowMetadataResponse | null,\n): {\n additionalData: Record<string, any>;\n components: EmbeddedFlowComponent[];\n executionId: string;\n} => {\n const {throwOnError = true, defaultErrorKey = 'errors.flow.generic', resolveTranslations = true} = options;\n\n // Check if this is an error response\n const errorMessage: string | null = checkForErrorResponse(response, t, defaultErrorKey);\n\n if (errorMessage && throwOnError) {\n // Throw the original response so it can be caught by error handling\n throw response;\n }\n\n const additionalData: Record<string, any> = (response?.data?.additionalData as Record<string, any>) ?? {};\n\n // The consent prompt is serialized as a JSON string (array) by the backend.\n // Parse it and wrap in the expected {purposes: [...]} structure.\n if (typeof additionalData['consentPrompt'] === 'string') {\n try {\n const parsed: any = JSON.parse(additionalData['consentPrompt']);\n additionalData['consentPrompt'] = {purposes: Array.isArray(parsed) ? parsed : []};\n } catch {\n // Leave unparseable value as-is\n }\n }\n\n return {\n additionalData,\n components: transformComponents(response, t, resolveTranslations, meta),\n executionId: response.executionId,\n };\n};\n"],"mappings":";;;;;;;;;;;;;;AAgFA,MAAM,yBAAyB,aAAuC;CACpE,MAAMA,0BAA+B,IAAI,KAAqB;AAE9D,KAAI,UAAU,MAAM,UAAU,MAAM,QAAQ,SAAS,KAAK,OAAO,CAC/D,UAAS,KAAK,OAAO,SAAS,UAAe;AAC3C,MAAI,MAAM,OAAO,MAAM,WACrB,SAAQ,IAAI,MAAM,KAAK,MAAM,WAAW;GAE1C;AAGJ,QAAO;;;;;;;;;;AAWT,MAAM,0BAA0B,aAAuC;CACrE,MAAMA,0BAA+B,IAAI,KAAqB;AAE9D,KAAI,UAAU,MAAM,WAAW,MAAM,QAAQ,SAAS,KAAK,QAAQ,CACjE,UAAS,KAAK,QAAQ,SAAS,WAAgB;AAC7C,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aAElB,OAAM;CAGR,MAAMC,iBAAuC,UAAU,MAAM,kBAA0C,EAAE;AAIzG,KAAI,OAAO,eAAe,qBAAqB,SAC7C,KAAI;EACF,MAAMC,SAAc,KAAK,MAAM,eAAe,iBAAiB;AAC/D,iBAAe,mBAAmB,EAAC,UAAU,MAAM,QAAQ,OAAO,GAAG,SAAS,EAAE,EAAC;SAC3E;AAKV,QAAO;EACL;EACA,YAAY,oBAAoB,UAAU,GAAG,qBAAqB,KAAK;EACvE,aAAa,SAAS;EACvB"}
@@ -25,10 +25,18 @@ export interface FieldConfig {
25
25
  * Display name for the field.
26
26
  */
27
27
  label: string;
28
+ /**
29
+ * Number of characters for OTP fields.
30
+ */
31
+ length?: number;
28
32
  /**
29
33
  * The name of the field.
30
34
  */
31
35
  name: string;
36
+ /**
37
+ * Whether an OTP field accepts digits only. Defaults to true.
38
+ */
39
+ numericOnly?: boolean;
32
40
  /**
33
41
  * Callback function when the field loses focus.
34
42
  */
@@ -1 +1 @@
1
- {"version":3,"file":"FieldFactory.d.ts","sourceRoot":"","sources":["../../../src/components/factories/FieldFactory.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAc,EAAE,EAAE,YAAY,EAAC,MAAM,OAAO,CAAC;AAKpD,OAAe,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAC;AAGjE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,IAAI,EAAE,SAAS,CAAC;IAChB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,MAAM,EACb,MAAM,SAAS,EACf,kBAAgB,EAChB,iBAAe,KACd,MAAM,GAAG,IAsBX,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,WAAW,GAAI,QAAQ,WAAW,KAAG,YA6HjD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,WAAW,CAA4D,CAAC;AAEtG,eAAe,YAAY,CAAC"}
1
+ {"version":3,"file":"FieldFactory.d.ts","sourceRoot":"","sources":["../../../src/components/factories/FieldFactory.tsx"],"names":[],"mappings":"AAGA,OAAO,EAAC,SAAS,EAAC,MAAM,oBAAoB,CAAC;AAC7C,OAAO,EAAc,EAAE,EAAE,YAAY,EAAC,MAAM,OAAO,CAAC;AAKpD,OAAe,EAAC,YAAY,EAAC,MAAM,6BAA6B,CAAC;AAGjE;;GAEG;AACH,MAAM,WAAW,WAAW;IAC1B;;OAEG;IACH,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IACnB;;OAEG;IACH,KAAK,CAAC,EAAE,MAAM,CAAC;IACf;;OAEG;IACH,EAAE,CAAC,EAAE,MAAM,CAAC;IACZ;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;IACd;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB;;OAEG;IACH,IAAI,EAAE,MAAM,CAAC;IACb;;OAEG;IACH,WAAW,CAAC,EAAE,OAAO,CAAC;IACtB;;OAEG;IACH,MAAM,CAAC,EAAE,MAAM,IAAI,CAAC;IACpB;;OAEG;IACH,QAAQ,EAAE,CAAC,KAAK,EAAE,MAAM,KAAK,IAAI,CAAC;IAClC;;OAEG;IACH,OAAO,CAAC,EAAE,YAAY,EAAE,CAAC;IACzB;;OAEG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC;IACrB;;OAEG;IACH,QAAQ,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,OAAO,CAAC,EAAE,OAAO,CAAC;IAClB;;OAEG;IACH,IAAI,EAAE,SAAS,CAAC;IAChB;;OAEG;IACH,KAAK,EAAE,MAAM,CAAC;CACf;AAED;;GAEG;AACH,eAAO,MAAM,kBAAkB,GAC7B,OAAO,MAAM,EACb,MAAM,SAAS,EACf,kBAAgB,EAChB,iBAAe,KACd,MAAM,GAAG,IAsBX,CAAC;AAEF;;;;;;;;;;;;;;;;;;GAkBG;AACH,eAAO,MAAM,WAAW,GAAI,QAAQ,WAAW,KAAG,YAqIjD,CAAC;AAEF;;GAEG;AACH,eAAO,MAAM,YAAY,EAAE,EAAE,CAAC,WAAW,CAA4D,CAAC;AAEtG,eAAe,YAAY,CAAC"}
@@ -44,7 +44,7 @@ const validateFieldValue = (value, type, required = false, touched = false) => {
44
44
  * ```
45
45
  */
46
46
  const createField = (config) => {
47
- const { name, type, label, required, value, onChange, onBlur, disabled = false, error, className, id, options = [], touched = false, placeholder } = config;
47
+ const { name, type, label, required, value, onChange, onBlur, disabled = false, error, className, id, options = [], touched = false, placeholder, length, numericOnly = true } = config;
48
48
  const validationError = error || validateFieldValue(value, type, required, touched);
49
49
  const commonProps = {
50
50
  className,
@@ -96,6 +96,9 @@ const createField = (config) => {
96
96
  }
97
97
  case FieldType.Otp: return /* @__PURE__ */ jsx(OtpField_default, {
98
98
  ...commonProps,
99
+ length,
100
+ type: numericOnly ? "number" : "text",
101
+ uppercase: !numericOnly,
99
102
  onChange: (e) => onChange(e.target.value)
100
103
  });
101
104
  case FieldType.Number: return /* @__PURE__ */ jsx(TextField_default, {
@@ -1 +1 @@
1
- {"version":3,"file":"FieldFactory.js","names":["numValue: number","validationError: string | null","commonProps: Record<string, any>","PasswordField","TextField","DatePicker","isChecked: boolean","Checkbox","OtpField","fieldOptions: SelectOption[]","Select","FieldFactory: FC<FieldConfig>"],"sources":["../../../src/components/factories/FieldFactory.tsx"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {FieldType} from '@thunderid/browser';\nimport {ChangeEvent, FC, ReactElement} from 'react';\nimport Checkbox from '../primitives/Checkbox/Checkbox';\nimport DatePicker from '../primitives/DatePicker/DatePicker';\nimport OtpField from '../primitives/OtpField/OtpField';\nimport PasswordField from '../primitives/PasswordField/PasswordField';\nimport Select, {SelectOption} from '../primitives/Select/Select';\nimport TextField from '../primitives/TextField/TextField';\n\n/**\n * Interface for field configuration.\n */\nexport interface FieldConfig {\n /**\n * Additional CSS class name.\n */\n className?: string;\n /**\n * Whether the field is disabled.\n */\n disabled?: boolean;\n /**\n * Error message to display.\n */\n error?: string;\n /**\n * HTML id to apply to the rendered field.\n */\n id?: string;\n /**\n * Display name for the field.\n */\n label: string;\n /**\n * The name of the field.\n */\n name: string;\n /**\n * Callback function when the field loses focus.\n */\n onBlur?: () => void;\n /**\n * Callback function when the field value changes.\n */\n onChange: (value: string) => void;\n /**\n * Additional options for multi-valued fields.\n */\n options?: SelectOption[];\n /**\n * Placeholder text for the field.\n */\n placeholder?: string;\n /**\n * Whether the field is required.\n */\n required: boolean;\n /**\n * Whether the field has been touched/interacted with by the user.\n */\n touched?: boolean;\n /**\n * The field type.\n */\n type: FieldType;\n /**\n * Current value of the field.\n */\n value: string;\n}\n\n/**\n * Utility function to validate field values based on type\n */\nexport const validateFieldValue = (\n value: string,\n type: FieldType,\n required = false,\n touched = false,\n): string | null => {\n if (required && touched && (!value || value.trim() === '')) {\n return 'This field is required';\n }\n\n if (!value || value.trim() === '') {\n return null;\n }\n\n switch (type) {\n case FieldType.Number: {\n const numValue: number = parseInt(value, 10);\n if (Number.isNaN(numValue)) {\n return 'Please enter a valid number';\n }\n break;\n }\n default:\n break;\n }\n\n return null;\n};\n\n/**\n * Factory function to create form fields based on field type.\n *\n * @param config - The field configuration\n * @returns The appropriate React component for the field type\n *\n * @example\n * ```tsx\n * const field = createField({\n * param: 'username',\n * type: FieldType.Text,\n * label: 'Username',\n * confidential: false,\n * required: true,\n * value: '',\n * onChange: (value) => console.log(value)\n * });\n * ```\n */\nexport const createField = (config: FieldConfig): ReactElement => {\n const {\n name,\n type,\n label,\n required,\n value,\n onChange,\n onBlur,\n disabled = false,\n error,\n className,\n id,\n options = [],\n touched = false,\n placeholder,\n } = config;\n\n const validationError: string | null = error || validateFieldValue(value, type, required, touched);\n\n const commonProps: Record<string, any> = {\n className,\n 'data-testid': `thunderid-signin-${name}`,\n disabled,\n error: validationError,\n id,\n label,\n name,\n onBlur,\n placeholder,\n required,\n value,\n };\n\n switch (type) {\n case FieldType.Password:\n return <PasswordField {...commonProps} onChange={onChange} />;\n case FieldType.Text:\n return (\n <TextField\n {...commonProps}\n type=\"text\"\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)}\n autoComplete=\"off\"\n />\n );\n case FieldType.Email:\n return (\n <TextField\n {...commonProps}\n type=\"email\"\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)}\n autoComplete=\"email\"\n />\n );\n case FieldType.Tel:\n return (\n <TextField\n {...commonProps}\n type=\"tel\"\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)}\n autoComplete=\"tel\"\n />\n );\n case FieldType.Date:\n return (\n <DatePicker {...commonProps} onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)} />\n );\n case FieldType.Checkbox: {\n const isChecked: boolean = value === 'true' || (value as any) === true;\n return (\n <Checkbox\n {...commonProps}\n checked={isChecked}\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.checked.toString())}\n />\n );\n }\n case FieldType.Otp:\n return (\n <OtpField {...commonProps} onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)} />\n );\n case FieldType.Number:\n return (\n <TextField\n {...commonProps}\n type=\"number\"\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)}\n helperText=\"Enter a numeric value\"\n />\n );\n case FieldType.Select: {\n const fieldOptions: SelectOption[] = options.length > 0 ? options : [];\n\n if (fieldOptions.length > 0) {\n return (\n <Select\n {...commonProps}\n options={fieldOptions}\n onChange={(e: ChangeEvent<HTMLSelectElement>): void => onChange(e.target.value)}\n helperText=\"Select from available options\"\n />\n );\n }\n\n return (\n <TextField\n {...commonProps}\n type=\"text\"\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)}\n helperText=\"Enter multiple values separated by commas (e.g., value1, value2, value3)\"\n placeholder=\"value1, value2, value3\"\n />\n );\n }\n default:\n return (\n <TextField\n {...commonProps}\n type=\"text\"\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)}\n helperText=\"Unknown field type, treating as text\"\n />\n );\n }\n};\n\n/**\n * React component wrapper for the field factory.\n */\nexport const FieldFactory: FC<FieldConfig> = (props: FieldConfig): ReactElement => createField(props);\n\nexport default FieldFactory;\n"],"mappings":";;;;;;;;;;;;;AA6EA,MAAa,sBACX,OACA,MACA,WAAW,OACX,UAAU,UACQ;AAClB,KAAI,YAAY,YAAY,CAAC,SAAS,MAAM,MAAM,KAAK,IACrD,QAAO;AAGT,KAAI,CAAC,SAAS,MAAM,MAAM,KAAK,GAC7B,QAAO;AAGT,SAAQ,MAAR;EACE,KAAK,UAAU,QAAQ;GACrB,MAAMA,WAAmB,SAAS,OAAO,GAAG;AAC5C,OAAI,OAAO,MAAM,S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L,WAAW,MAA2C,SAAS,EAAE,OAAO,MAAM;GAC9E,YAAW;IACX;EAEN,KAAK,UAAU,QAAQ;GACrB,MAAMK,eAA+B,QAAQ,SAAS,IAAI,UAAU,EAAE;AAEtE,OAAI,aAAa,SAAS,EACxB,QACE,oBAACC;IACC,GAAI;IACJ,SAAS;IACT,WAAW,MAA4C,SAAS,EAAE,OAAO,MAAM;IAC/E,YAAW;KACX;AAIN,UACE,oBAACN;IACC,GAAI;IACJ,MAAK;IACL,WAAW,MAA2C,SAAS,EAAE,OAAO,MAAM;IAC9E,YAAW;IACX,aAAY;KACZ;;EAGN,QACE,QACE,oBAACA;GACC,GAAI;GACJ,MAAK;GACL,WAAW,MAA2C,SAAS,EAAE,OAAO,MAAM;GAC9E,YAAW;IACX;;;;;;AAQV,MAAaO,gBAAiC,UAAqC,YAAY,MAAM"}
1
+ {"version":3,"file":"FieldFactory.js","names":["numValue: number","validationError: string | null","commonProps: Record<string, any>","PasswordField","TextField","DatePicker","isChecked: boolean","Checkbox","OtpField","fieldOptions: SelectOption[]","Select","FieldFactory: FC<FieldConfig>"],"sources":["../../../src/components/factories/FieldFactory.tsx"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport {FieldType} from '@thunderid/browser';\nimport {ChangeEvent, FC, ReactElement} from 'react';\nimport Checkbox from '../primitives/Checkbox/Checkbox';\nimport DatePicker from '../primitives/DatePicker/DatePicker';\nimport OtpField from '../primitives/OtpField/OtpField';\nimport PasswordField from '../primitives/PasswordField/PasswordField';\nimport Select, {SelectOption} from '../primitives/Select/Select';\nimport TextField from '../primitives/TextField/TextField';\n\n/**\n * Interface for field configuration.\n */\nexport interface FieldConfig {\n /**\n * Additional CSS class name.\n */\n className?: string;\n /**\n * Whether the field is disabled.\n */\n disabled?: boolean;\n /**\n * Error message to display.\n */\n error?: string;\n /**\n * HTML id to apply to the rendered field.\n */\n id?: string;\n /**\n * Display name for the field.\n */\n label: string;\n /**\n * Number of characters for OTP fields.\n */\n length?: number;\n /**\n * The name of the field.\n */\n name: string;\n /**\n * Whether an OTP field accepts digits only. Defaults to true.\n */\n numericOnly?: boolean;\n /**\n * Callback function when the field loses focus.\n */\n onBlur?: () => void;\n /**\n * Callback function when the field value changes.\n */\n onChange: (value: string) => void;\n /**\n * Additional options for multi-valued fields.\n */\n options?: SelectOption[];\n /**\n * Placeholder text for the field.\n */\n placeholder?: string;\n /**\n * Whether the field is required.\n */\n required: boolean;\n /**\n * Whether the field has been touched/interacted with by the user.\n */\n touched?: boolean;\n /**\n * The field type.\n */\n type: FieldType;\n /**\n * Current value of the field.\n */\n value: string;\n}\n\n/**\n * Utility function to validate field values based on type\n */\nexport const validateFieldValue = (\n value: string,\n type: FieldType,\n required = false,\n touched = false,\n): string | null => {\n if (required && touched && (!value || value.trim() === '')) {\n return 'This field is required';\n }\n\n if (!value || value.trim() === '') {\n return null;\n }\n\n switch (type) {\n case FieldType.Number: {\n const numValue: number = parseInt(value, 10);\n if (Number.isNaN(numValue)) {\n return 'Please enter a valid number';\n }\n break;\n }\n default:\n break;\n }\n\n return null;\n};\n\n/**\n * Factory function to create form fields based on field type.\n *\n * @param config - The field configuration\n * @returns The appropriate React component for the field type\n *\n * @example\n * ```tsx\n * const field = createField({\n * param: 'username',\n * type: FieldType.Text,\n * label: 'Username',\n * confidential: false,\n * required: true,\n * value: '',\n * onChange: (value) => console.log(value)\n * });\n * ```\n */\nexport const createField = (config: FieldConfig): ReactElement => {\n const {\n name,\n type,\n label,\n required,\n value,\n onChange,\n onBlur,\n disabled = false,\n error,\n className,\n id,\n options = [],\n touched = false,\n placeholder,\n length,\n numericOnly = true,\n } = config;\n\n const validationError: string | null = error || validateFieldValue(value, type, required, touched);\n\n const commonProps: Record<string, any> = {\n className,\n 'data-testid': `thunderid-signin-${name}`,\n disabled,\n error: validationError,\n id,\n label,\n name,\n onBlur,\n placeholder,\n required,\n value,\n };\n\n switch (type) {\n case FieldType.Password:\n return <PasswordField {...commonProps} onChange={onChange} />;\n case FieldType.Text:\n return (\n <TextField\n {...commonProps}\n type=\"text\"\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)}\n autoComplete=\"off\"\n />\n );\n case FieldType.Email:\n return (\n <TextField\n {...commonProps}\n type=\"email\"\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)}\n autoComplete=\"email\"\n />\n );\n case FieldType.Tel:\n return (\n <TextField\n {...commonProps}\n type=\"tel\"\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)}\n autoComplete=\"tel\"\n />\n );\n case FieldType.Date:\n return (\n <DatePicker {...commonProps} onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)} />\n );\n case FieldType.Checkbox: {\n const isChecked: boolean = value === 'true' || (value as any) === true;\n return (\n <Checkbox\n {...commonProps}\n checked={isChecked}\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.checked.toString())}\n />\n );\n }\n case FieldType.Otp:\n return (\n <OtpField\n {...commonProps}\n length={length}\n type={numericOnly ? 'number' : 'text'}\n uppercase={!numericOnly}\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)}\n />\n );\n case FieldType.Number:\n return (\n <TextField\n {...commonProps}\n type=\"number\"\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)}\n helperText=\"Enter a numeric value\"\n />\n );\n case FieldType.Select: {\n const fieldOptions: SelectOption[] = options.length > 0 ? options : [];\n\n if (fieldOptions.length > 0) {\n return (\n <Select\n {...commonProps}\n options={fieldOptions}\n onChange={(e: ChangeEvent<HTMLSelectElement>): void => onChange(e.target.value)}\n helperText=\"Select from available options\"\n />\n );\n }\n\n return (\n <TextField\n {...commonProps}\n type=\"text\"\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)}\n helperText=\"Enter multiple values separated by commas (e.g., value1, value2, value3)\"\n placeholder=\"value1, value2, value3\"\n />\n );\n }\n default:\n return (\n <TextField\n {...commonProps}\n type=\"text\"\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onChange(e.target.value)}\n helperText=\"Unknown field type, treating as text\"\n />\n );\n }\n};\n\n/**\n * React component wrapper for the field factory.\n */\nexport const FieldFactory: FC<FieldConfig> = (props: FieldConfig): ReactElement => createField(props);\n\nexport default FieldFactory;\n"],"mappings":";;;;;;;;;;;;;AAqFA,MAAa,sBACX,OACA,MACA,WAAW,OACX,UAAU,UACQ;AAClB,KAAI,YAAY,YAAY,CAAC,SAAS,MAAM,MAAM,KAAK,IACrD,QAAO;AAGT,KAAI,CAAC,SAAS,MAAM,MAAM,KAAK,GAC7B,QAAO;AAGT,SAAQ,MAAR;EACE,KAAK,UAAU,QAAQ;GACrB,MAAMA,WAAmB,SAAS,OAAO,GAAG;AAC5C,OAAI,OAAO,MAAM,SAAS,CACxB,QAAO;AAET;;EAEF,QACE;;AAGJ,QAAO;;;;;;;;;;;;;;;;;;;;;AAsBT,MAAa,eAAe,WAAsC;CAChE,MAAM,EACJ,MACA,MACA,OACA,UACA,OACA,UACA,QACA,WAAW,OACX,OACA,WACA,IACA,UAAU,EAAE,EACZ,UAAU,OACV,aACA,QACA,cAAc,SACZ;CAEJ,MAAMC,kBAAiC,SAAS,mBAAmB,OAAO,MAAM,UAAU,QAAQ;CAElG,MAAMC,cAAmC;EACvC;EACA,eAAe,oBAAoB;EACnC;EACA,OAAO;EACP;EACA;EACA;EACA;EACA;EACA;EACA;EACD;AAED,SAAQ,MAAR;EACE,KAAK,UAAU,SACb,QAAO,oBAACC;GAAc,GAAI;GAAuB;IAAY;EAC/D,KAAK,UAAU,KACb,QACE,oBAACC;GACC,GAAI;GACJ,MAAK;GACL,WAAW,MAA2C,SAAS,EAAE,OAAO,MAAM;GAC9E,cAAa;IACb;EAEN,KAAK,UAAU,MACb,QACE,oBAACA;GACC,GAAI;GACJ,MAAK;GACL,WAAW,MAA2C,SAAS,EAAE,OAAO,MAAM;GAC9E,cAAa;IACb;EAEN,KAAK,UAAU,IACb,QACE,oBAACA;GACC,GAAI;GACJ,MAAK;GACL,WAAW,MAA2C,SAAS,EAAE,OAAO,MAAM;GAC9E,cAAa;IACb;EAEN,KAAK,UAAU,KACb,QACE,oBAACC;GAAW,GAAI;GAAa,WAAW,MAA2C,SAAS,EAAE,OAAO,MAAM;IAAI;EAEnH,KAAK,UAAU,UAAU;GACvB,MAAMC,YAAqB,UAAU,UAAW,UAAkB;AAClE,UACE,oBAACC;IACC,GAAI;IACJ,SAAS;IACT,WAAW,MAA2C,SAAS,EAAE,OAAO,QAAQ,UAAU,CAAC;KAC3F;;EAGN,KAAK,UAAU,IACb,QACE,oBAACC;GACC,GAAI;GACI;GACR,MAAM,cAAc,WAAW;GAC/B,WAAW,CAAC;GACZ,WAAW,MAA2C,SAAS,EAAE,OAAO,MAAM;IAC9E;EAEN,KAAK,UAAU,OACb,QACE,oBAACJ;GACC,GAAI;GACJ,MAAK;GACL,WAAW,MAA2C,SAAS,EAAE,OAAO,MAAM;GAC9E,YAAW;IACX;EAEN,KAAK,UAAU,QAAQ;GACrB,MAAMK,eAA+B,QAAQ,SAAS,IAAI,UAAU,EAAE;AAEtE,OAAI,aAAa,SAAS,EACxB,QACE,oBAACC;IACC,GAAI;IACJ,SAAS;IACT,WAAW,MAA4C,SAAS,EAAE,OAAO,MAAM;IAC/E,YAAW;KACX;AAIN,UACE,oBAACN;IACC,GAAI;IACJ,MAAK;IACL,WAAW,MAA2C,SAAS,EAAE,OAAO,MAAM;IAC9E,YAAW;IACX,aAAY;KACZ;;EAGN,QACE,QACE,oBAACA;GACC,GAAI;GACJ,MAAK;GACL,WAAW,MAA2C,SAAS,EAAE,OAAO,MAAM;GAC9E,YAAW;IACX;;;;;;AAQV,MAAaO,gBAAiC,UAAqC,YAAY,MAAM"}
@@ -1 +1 @@
1
- {"version":3,"file":"AuthOptionFactory.d.ts","sourceRoot":"","sources":["../../../../src/components/presentation/auth/AuthOptionFactory.tsx"],"names":[],"m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,KAAK,IAAI,CAAC;IAC5G,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,+EAA+E;IAC/E,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;IACxB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,6FAA6F;IAC7F,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,KACA,YAAY,EAmBkC,CAAC"}
1
+ {"version":3,"file":"AuthOptionFactory.d.ts","sourceRoot":"","sources":["../../../../src/components/presentation/auth/AuthOptionFactory.tsx"],"names":[],"mappings":"AAIA,OAAO,EAGL,oBAAoB,EACpB,qBAAqB,EAarB,4BAA4B,EAE7B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAA2C,YAAY,EAAC,MAAM,OAAO,CAAC;AAC7E,OAAO,EAGL,oBAAoB,EACrB,MAAM,8DAA8D,CAAC;AACtE,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAqF7D,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;AAytBxD;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,YAAY,qBAAqB,EAAE,EACnC,YAAY,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,eAAe,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACtC,YAAY,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,EAClC,WAAW,OAAO,EAClB,aAAa,OAAO,EACpB,WAAW,MAAM,IAAI,EACrB,eAAe,CAAC,IAAI,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,KAAK,IAAI,EACpD,UAAU;IACR,gBAAgB;IAChB,gBAAgB,CAAC,EAAE,oBAAoB,CAAC;IACxC,gBAAgB;IAChB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,6CAA6C;IAC7C,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,eA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MAAM,EAAE,MAAM,KACX,OAAO,CAAC,4BAA4B,CAAC,CAAC;IAC3C,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,2EAA2E;IAC3E,IAAI,CAAC,EAAE,oBAAoB,GAAG,IAAI,CAAC;IACnC,WAAW,CAAC,EAAE,CAAC,IAAI,EAAE,MAAM,KAAK,IAAI,CAAC;IACrC,QAAQ,CAAC,EAAE,CAAC,SAAS,EAAE,qBAAqB,EAAE,IAAI,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,cAAc,CAAC,EAAE,OAAO,KAAK,IAAI,CAAC;IAC5G,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IACpC,+EAA+E;IAC/E,CAAC,CAAC,EAAE,cAAc,CAAC,GAAG,CAAC,CAAC;IACxB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,6FAA6F;IAC7F,MAAM,CAAC,EAAE,MAAM,CAAC;CACjB,KACA,YAAY,EAmBkC,CAAC"}
@@ -204,12 +204,17 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
204
204
  const identifier = component.ref;
205
205
  const value = formValues[identifier] || "";
206
206
  const error = touchedFields[identifier] || false ? formErrors[identifier] : void 0;
207
+ const reportedLength = Number(options.additionalData?.["otpLength"]);
208
+ const otpLength = Number.isInteger(reportedLength) && reportedLength > 0 ? reportedLength : void 0;
209
+ const numericOnly = options.additionalData?.["otpNumericOnly"] !== "false";
207
210
  return cloneElement(createField({
208
211
  className: cx(options.inputClassName, component.classes),
209
212
  error,
210
213
  id: component.id,
211
214
  label: resolve(component.label) || "",
215
+ length: otpLength,
212
216
  name: identifier,
217
+ numericOnly,
213
218
  onBlur: () => options.onInputBlur?.(identifier),
214
219
  onChange: (newValue) => onInputChange(identifier, newValue),
215
220
  placeholder: resolve(component.placeholder) || "",
@@ -1 +1 @@
1
- {"version":3,"file":"AuthOptionFactory.js","names":["logger: ReturnType<typeof createPackageComponentLogger>","richTextClassCache: string | undefined","authOptionIconClassCache: string | undefined","providerId: any","providerMatches: any","theme: any","customRenderers: ComponentRendererMap","key: string | number","customRenderer: ComponentRenderer | undefined","identifier: string","value: string","error: string","fieldType: string","hasPrefixes: boolean","hasPostfix: boolean","prefixStateKey: string","postfixStateKey: string","defaultPrefixValue: string","selectedPrefix: string","AffixedField","actionId: string","eventType: string","buttonText: string","componentVariant: string","shouldSkipValidation: boolean","buttonType: HTMLButtonElement['type']","formData: Record<string, any>","consentPrompt: ConsentPromptData | undefined","isDeny: boolean","decisions: ConsentDecisions","socialButtonClassName: string","GoogleButton","GitHubButton","FacebookButton","MicrosoftButton","LinkedInButton","SignInWithEthereumButton","SmsOtpButton","startIconEl: ReactElement | null","endIconEl: ReactElement | null","Button","variant: any","textAlignClass: string","Typography","Divider","selectOptions: any","Select","DatePicker","formClass: string","blockComponents: any","richTextAction: EmbeddedFlowComponentAction | undefined","syntheticAction: EmbeddedFlowComponent","formData: Record<string, string>","handleRichTextClick: React.MouseEventHandler<HTMLDivElement> | undefined","anchor: HTMLAnchorElement | null","handleRichTextKeyDown: React.KeyboardEventHandler<HTMLDivElement> | undefined","explicitHeight: string","explicitWidth: string","ImageComponent","iconName: string","IconComponent: any","flowIconRegistry","direction: string","gap: number","align: string","justify: string","rawItems: string | number | undefined","parsedItems: number","items: number | null","isColumn: boolean","gridJustify: string","track: string","stackClass: string","stackChildren: (ReactElement | null)[]","consentPromptRawData: ConsentPromptData | string | undefined","Consent","textTemplate: string","timeoutMs: number","FlowTimer","sourceKey: string | undefined","CopyableText"],"sources":["../../../../src/components/presentation/auth/AuthOptionFactory.tsx"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {CSSInterpolation} from '@emotion/css/create-instance';\nimport {\n ConsentConstants,\n FieldType,\n FlowMetadataResponse,\n EmbeddedFlowComponent,\n EmbeddedFlowComponentAction,\n EmbeddedFlowComponentType,\n EmbeddedFlowTextVariant,\n EmbeddedFlowEventType,\n createPackageComponentLogger,\n resolveFlowTemplateLiterals,\n resolveEmojiUrisInHtml,\n ConsentPurposeData,\n ConsentPromptData,\n ConsentDecisions,\n ConsentPurposeDecision,\n ConsentAttributeElement,\n OrganizationUnitListResponse,\n PrefixOption,\n} from '@thunderid/browser';\nimport DOMPurify from 'dompurify';\nimport {ChangeEvent, cloneElement, CSSProperties, ReactElement} from 'react';\nimport {\n ComponentRenderer,\n ComponentRenderContext,\n ComponentRendererMap,\n} from '../../../contexts/ComponentRenderer/ComponentRendererContext';\nimport {UseTranslation} from '../../../hooks/useTranslation';\nimport {css, cx} from '../../../styles/emotion';\nimport Consent from '../../adapters/Consent';\nimport {getConsentOptionalKey} from '../../adapters/ConsentCheckboxList';\nimport FacebookButton from '../../adapters/FacebookButton';\nimport FlowTimer from '../../adapters/FlowTimer';\nimport GitHubButton from '../../adapters/GitHubButton';\nimport GoogleButton from '../../adapters/GoogleButton';\nimport ImageComponent from '../../adapters/ImageComponent';\nimport LinkedInButton from '../../adapters/LinkedInButton';\nimport MicrosoftButton from '../../adapters/MicrosoftButton';\nimport SignInWithEthereumButton from '../../adapters/SignInWithEthereumButton';\nimport SmsOtpButton from '../../adapters/SmsOtpButton';\nimport {createField} from '../../factories/FieldFactory';\nimport Button from '../../primitives/Button/Button';\nimport CopyableText from '../../primitives/CopyableText/CopyableText';\nimport DatePicker from '../../primitives/DatePicker/DatePicker';\nimport Divider from '../../primitives/Divider/Divider';\nimport flowIconRegistry from '../../primitives/Icons/flowIconRegistry';\nimport AffixedField from '../../primitives/AffixedField/AffixedField';\nimport Select from '../../primitives/Select/Select';\nimport {affixPostfixKey, affixPrefixKey} from '../../../utils/composeAffixedInputs';\nimport Typography from '../../primitives/Typography/Typography';\nimport {TypographyVariant} from '../../primitives/Typography/Typography.styles';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/react',\n 'AuthOptionFactory',\n);\n\n/**\n * Replaces `emoji:` URIs embedded in HTML before DOMPurify sanitization.\n *\n * DOMPurify strips unknown URI schemes from attributes (e.g. `src=\"emoji:🦊\"` → `src=\"\"`).\n * This function converts:\n * - `<img src=\"emoji:X\" alt=\"Y\">` → `<span role=\"img\" aria-label=\"Y\">X</span>`\n * - Any remaining `emoji:X` text occurrences → `X`\n */\n\n// This module's functions (renderSignInComponents, etc.) are called imperatively from a\n// component's render, not React components/hooks themselves — so these classes can't be computed\n// at module scope: that runs at import time, before <ThunderIDProvider> has had a chance to\n// configure Emotion's CSP nonce, which would insert them into an un-nonced <style> tag. Instead\n// they're computed lazily, on first actual use (still just once — Emotion's own cache dedupes any\n// further calls to a no-op after that).\nlet richTextClassCache: string | undefined;\n\n/** Ensures rich-text content (including all inner elements from the server) always word-wraps. */\nfunction getRichTextClass(): string {\n richTextClassCache ??= css`\n overflow-wrap: anywhere;\n & * {\n overflow-wrap: anywhere;\n word-break: break-word;\n }\n & .rich-text-align-left {\n text-align: left;\n }\n & .rich-text-align-center {\n text-align: center;\n }\n & .rich-text-align-right {\n text-align: right;\n }\n & .rich-text-align-justify {\n text-align: justify;\n }\n & a,\n & .rich-text-link {\n text-decoration: underline;\n }\n & span[role='img'] {\n display: inline-block;\n }\n `;\n return richTextClassCache;\n}\n\nlet authOptionIconClassCache: string | undefined;\n\nfunction getAuthOptionIconClass(): string {\n authOptionIconClassCache ??= css({height: '1.25em', objectFit: 'contain', width: '1.25em'});\n return authOptionIconClassCache;\n}\n\nexport type AuthType = 'signin' | 'signup' | 'recovery';\n\n/**\n * Get the appropriate FieldType for an input component.\n */\n/** Upper bound on STACK grid slots, so a mistyped `items` cannot render thousands of cells. */\nconst MAX_STACK_ITEMS = 12;\n\nconst getFieldType = (variant: EmbeddedFlowComponentType): FieldType => {\n switch (variant) {\n case EmbeddedFlowComponentType.EmailInput:\n return FieldType.Email;\n case EmbeddedFlowComponentType.PhoneInput:\n return FieldType.Tel;\n case EmbeddedFlowComponentType.PasswordInput:\n return FieldType.Password;\n case EmbeddedFlowComponentType.TextInput:\n default:\n return FieldType.Text;\n }\n};\n\n/**\n * Get typography variant from component variant.\n */\nconst getTypographyVariant = (variant: string): any => {\n const variantMap: Record<EmbeddedFlowTextVariant, TypographyVariant> = {\n BODY_1: 'body1',\n BODY_2: 'body2',\n BUTTON_TEXT: 'button',\n CAPTION: 'caption',\n HEADING_1: 'h1',\n HEADING_2: 'h2',\n HEADING_3: 'h3',\n HEADING_4: 'h4',\n HEADING_5: 'h5',\n HEADING_6: 'h6',\n OVERLINE: 'overline',\n SUBTITLE_1: 'subtitle1',\n SUBTITLE_2: 'subtitle2',\n };\n\n return variantMap[variant] || 'h3';\n};\n\n/**\n * Check if a button text or action matches a social provider.\n */\nconst matchesSocialProvider = (\n actionId: string,\n eventType: string,\n buttonText: string,\n provider: string,\n authType: AuthType,\n /* eslint-disable-next-line @typescript-eslint/no-unused-vars */\n _componentVariant?: string,\n): boolean => {\n const providerId: any = `${provider}_auth`;\n const providerMatches: any = actionId === providerId || eventType === providerId;\n\n // Social buttons usually have \"Sign in with X\" or \"Continue with X\" text,\n // so also check button text for the provider name to increase chances of correct detection (especially for signup flows where action IDs are less standardized)\n if (buttonText.toLowerCase().includes(provider)) {\n return true;\n }\n\n // For signup, also check button text\n if (authType === 'signup') {\n return providerMatches || buttonText.toLowerCase().includes(provider);\n }\n\n return providerMatches;\n};\n\n/**\n * Create an auth component from flow component configuration.\n */\nconst createAuthComponentFromFlow = (\n component: EmbeddedFlowComponent,\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n resetForm: () => void,\n onInputChange: (name: string, value: string) => void,\n authType: AuthType,\n options: {\n /** @internal Passed from the host React component so hooks aren't called inside a loop. */\n _customRenderers?: ComponentRendererMap;\n /** @internal Passed from the host React component so hooks aren't called inside a loop. */\n _theme?: any;\n /** Additional data from the flow response, used for different dynamic data */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n /** Current consent purpose being rendered. Set by CONSENT_PURPOSE block iteration. */\n currentConsentPurpose?: ConsentPurposeData;\n inStack?: boolean;\n inputClassName?: string;\n /** Flag to determine if the step timeline has expired */\n isTimeoutDisabled?: boolean;\n key?: string | number;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n /** Vendor namespace used to derive affix sentinel keys for prefix/postfix-bearing inputs. */\n vendor?: string;\n } = {},\n): ReactElement | null => {\n const theme: any = options._theme;\n const customRenderers: ComponentRendererMap = options._customRenderers ?? {};\n\n const key: string | number = options.key || component.id;\n\n const customRenderer: ComponentRenderer | undefined =\n customRenderers[component.id] ?? customRenderers[component.type];\n if (customRenderer) {\n const renderCtx: ComponentRenderContext = {\n additionalData: options.additionalData,\n authType,\n formErrors,\n formValues,\n isFormValid,\n isLoading,\n meta: options.meta,\n resetForm,\n onInputBlur: options.onInputBlur,\n onInputChange,\n onSubmit: options.onSubmit,\n touchedFields,\n };\n return customRenderer(component, renderCtx);\n }\n\n /** Resolve any remaining {{t()}} or {{meta()}} template expressions in a string at render time. */\n const resolve = (text: string | undefined): string => {\n if (!text || (!options.t && !options.meta)) {\n return text || '';\n }\n return resolveFlowTemplateLiterals(text, {meta: options.meta, t: options.t || ((k: string): string => k)});\n };\n\n switch (component.type) {\n case EmbeddedFlowComponentType.TextInput:\n case EmbeddedFlowComponentType.PasswordInput:\n case EmbeddedFlowComponentType.EmailInput:\n case EmbeddedFlowComponentType.PhoneInput: {\n const identifier: string = component.ref!;\n const value: string = formValues[identifier] || '';\n const isTouched: boolean = touchedFields[identifier] || false;\n const error: string = isTouched ? formErrors[identifier] : undefined!;\n const fieldType: string = getFieldType(component.type);\n\n // Prefix/postfix are accepted on any text-family input. When either is present,\n // route to AffixedField so the leading affix renders and submit-time composition\n // is picked up by composeAffixedInputs via the sentinel keys.\n // Both string.length and Array.length are defined, so a single truthy+length\n // check covers `prefixes?: string | PrefixOption[]`.\n const hasPrefixes: boolean = !!component.prefixes && component.prefixes.length > 0;\n const hasPostfix: boolean = typeof component.postfix === 'string' && component.postfix.length > 0;\n\n if (hasPrefixes || hasPostfix) {\n const prefixStateKey: string = affixPrefixKey(identifier, options.vendor);\n const postfixStateKey: string = affixPostfixKey(identifier, options.vendor);\n const defaultPrefixValue: string = hasPrefixes\n ? typeof component.prefixes === 'string'\n ? component.prefixes\n : (component.prefixes as PrefixOption[])[0].value\n : '';\n const selectedPrefix: string = formValues[prefixStateKey] ?? defaultPrefixValue;\n\n return (\n <AffixedField\n key={key}\n className={cx(options.inputClassName, component.classes)}\n id={component.id}\n label={resolve(component.label) || ''}\n name={identifier}\n placeholder={resolve(component.placeholder) || ''}\n required={component.required || false}\n error={error}\n value={value}\n type={fieldType}\n prefixes={component.prefixes}\n prefixValue={selectedPrefix}\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onInputChange(identifier, e.target.value)}\n onBlur={(): void => options.onInputBlur?.(identifier)}\n onPrefixChange={(newPrefix: string): void => onInputChange(prefixStateKey, newPrefix)}\n onFocus={(): void => {\n if (hasPrefixes && formValues[prefixStateKey] === undefined) {\n onInputChange(prefixStateKey, defaultPrefixValue);\n }\n if (hasPostfix && formValues[postfixStateKey] === undefined) {\n onInputChange(postfixStateKey, component.postfix!);\n }\n }}\n />\n );\n }\n\n const field: any = createField({\n className: cx(options.inputClassName, component.classes),\n error,\n id: component.id,\n label: resolve(component.label) || '',\n name: identifier,\n onBlur: () => options.onInputBlur?.(identifier),\n onChange: (newValue: string) => onInputChange(identifier, newValue),\n placeholder: resolve(component.placeholder) || '',\n required: component.required || false,\n type: fieldType as FieldType,\n value,\n });\n\n return cloneElement(field, {key});\n }\n\n case EmbeddedFlowComponentType.OtpInput: {\n const identifier: string = component.ref!;\n const value: string = formValues[identifier] || '';\n const isTouched: boolean = touchedFields[identifier] || false;\n const error: string = isTouched ? formErrors[identifier] : undefined!;\n\n const field: any = createField({\n className: cx(options.inputClassName, component.classes),\n error,\n id: component.id,\n label: resolve(component.label) || '',\n name: identifier,\n onBlur: () => options.onInputBlur?.(identifier),\n onChange: (newValue: string) => onInputChange(identifier, newValue),\n placeholder: resolve(component.placeholder) || '',\n required: component.required || false,\n type: FieldType.Otp,\n value,\n });\n\n return cloneElement(field, {key});\n }\n\n case EmbeddedFlowComponentType.Action: {\n const actionId: string = component.id;\n const eventType: string = component.eventType || '';\n const buttonText: string = resolve(component.label);\n const componentVariant: string = component.variant || '';\n\n // Only validate on submit type events.\n const shouldSkipValidation: boolean = eventType.toUpperCase() !== EmbeddedFlowEventType.Submit;\n\n // Determine the button type based on the event type. Default to 'submit' if not recognized.\n const buttonTypeEnum = {\n [EmbeddedFlowEventType.Submit]: 'submit',\n [EmbeddedFlowEventType.Reset]: 'reset',\n [EmbeddedFlowEventType.Cancel]: 'button',\n [EmbeddedFlowEventType.Trigger]: 'button',\n [EmbeddedFlowEventType.Back]: 'button',\n };\n const buttonType: HTMLButtonElement['type'] = buttonTypeEnum[eventType.toUpperCase()] ?? 'submit';\n\n const handleClick = (): any => {\n if (options.onSubmit) {\n const formData: Record<string, any> = {};\n Object.keys(formValues).forEach((field: any) => {\n // Include all values, even empty strings, to ensure proper submission\n formData[field] = formValues[field];\n });\n\n // For consent actions, build the consent_decisions JSON from the form values.\n // The allow action captures per-attribute choices; the deny action sends\n // all purposes as rejected so the backend ConsentExecutor can fail the flow.\n const consentPrompt: ConsentPromptData | undefined = options.additionalData?.['consentPrompt'] as\n | ConsentPromptData\n | undefined;\n if (consentPrompt && eventType.toUpperCase() === EmbeddedFlowEventType.Submit) {\n const isDeny: boolean = componentVariant.toLowerCase() !== 'primary';\n const decisions: ConsentDecisions = {\n approved: !isDeny,\n ...(isDeny ? {reason: ConsentConstants.REASON_USER_DENIED} : {}),\n purposes: consentPrompt.purposes.map(\n (p: ConsentPurposeData): ConsentPurposeDecision => ({\n approved: !isDeny,\n elements: [\n // Permission purposes carry no essential elements, so the server sends null here\n ...(p.essential ?? []).map((e): ConsentAttributeElement => ({approved: !isDeny, name: e.name})),\n ...(p.optional ?? []).map(\n (e): ConsentAttributeElement => ({\n approved: !isDeny && formValues[getConsentOptionalKey(p.purposeId, e.name)] === 'true',\n name: e.name,\n }),\n ),\n ],\n purposeName: p.purposeName!,\n }),\n ),\n };\n formData['consent_decisions'] = JSON.stringify(decisions);\n }\n\n // For submit events, pass the form data to the onSubmit callback. For other event types, reset the form and call onSubmit with an empty data object.\n if (eventType.toUpperCase() === EmbeddedFlowEventType.Submit) {\n options.onSubmit(component, formData, shouldSkipValidation);\n } else {\n resetForm();\n options.onSubmit(component, {}, shouldSkipValidation);\n }\n }\n };\n\n // Render branded social login buttons for known action IDs\n\n const socialButtonClassName: string = cx(options.buttonClassName, component.classes);\n\n if (matchesSocialProvider(actionId, eventType, buttonText, 'google', authType, componentVariant)) {\n return <GoogleButton key={key} id={component.id} onClick={handleClick} className={socialButtonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'github', authType, componentVariant)) {\n return <GitHubButton key={key} id={component.id} onClick={handleClick} className={socialButtonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'facebook', authType, componentVariant)) {\n return <FacebookButton key={key} id={component.id} onClick={handleClick} className={socialButtonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'microsoft', authType, componentVariant)) {\n return <MicrosoftButton key={key} id={component.id} onClick={handleClick} className={socialButtonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'linkedin', authType, componentVariant)) {\n return <LinkedInButton key={key} id={component.id} onClick={handleClick} className={socialButtonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'ethereum', authType, componentVariant)) {\n return (\n <SignInWithEthereumButton\n key={key}\n id={component.id}\n onClick={handleClick}\n className={socialButtonClassName}\n />\n );\n }\n if (actionId === 'prompt_mobile' || eventType === 'prompt_mobile') {\n return <SmsOtpButton key={key} id={component.id} onClick={handleClick} className={socialButtonClassName} />;\n }\n\n const startIconEl: ReactElement | null = component.startIcon ? (\n <img src={component.startIcon} alt=\"\" aria-hidden=\"true\" className={getAuthOptionIconClass()} />\n ) : null;\n\n const endIconEl: ReactElement | null = component.endIcon ? (\n <img src={component.endIcon} alt=\"\" aria-hidden=\"true\" className={getAuthOptionIconClass()} />\n ) : null;\n\n return (\n <Button\n fullWidth\n key={key}\n id={component.id}\n onClick={handleClick}\n disabled={\n isLoading ||\n (!isFormValid && !shouldSkipValidation) ||\n options.isTimeoutDisabled ||\n (component as any).config?.disabled\n }\n className={cx(options.buttonClassName, component.classes)}\n data-testid=\"thunderid-signin-submit\"\n variant={component.variant?.toLowerCase() === 'primary' ? 'solid' : 'outline'}\n color={component.variant?.toLowerCase() === 'primary' ? 'primary' : 'secondary'}\n startIcon={startIconEl}\n endIcon={endIconEl}\n type={buttonType}\n >\n {buttonText || 'Submit'}\n </Button>\n );\n }\n\n case EmbeddedFlowComponentType.Text: {\n const variant: any = getTypographyVariant(component.variant!);\n const textAlignClass: string = css({\n marginBottom: 2,\n textAlign:\n typeof component?.align === 'string' ? (component.align as React.CSSProperties['textAlign']) : 'left',\n });\n return (\n <Typography key={key} id={component.id} className={cx(component.classes, textAlignClass)} variant={variant}>\n {resolve(component.label)}\n </Typography>\n );\n }\n\n case EmbeddedFlowComponentType.Divider: {\n return <Divider key={key}>{resolve(component.label) || ''}</Divider>;\n }\n\n case EmbeddedFlowComponentType.Select: {\n const identifier: string = component.ref!;\n const value: string = formValues[identifier] || '';\n const isTouched: boolean = touchedFields[identifier] || false;\n const error: string = isTouched ? formErrors[identifier] : undefined!;\n\n // Options are pre-sanitized by flowTransformer to {value: string, label: string} format\n const selectOptions: any = (component.options || []).map((opt: any) => ({\n label: typeof opt === 'string' ? opt : String(opt.label ?? opt.value ?? ''),\n value: typeof opt === 'string' ? opt : String(opt.value ?? ''),\n }));\n\n return (\n <Select\n key={key}\n id={component.id}\n name={identifier}\n label={resolve(component.label) || ''}\n placeholder={resolve(component.placeholder)}\n required={component.required}\n options={selectOptions}\n value={value}\n error={error}\n onChange={(e: any): void => onInputChange(identifier, e.target.value)}\n onBlur={(): any => options.onInputBlur?.(identifier)}\n className={cx(options.inputClassName, component.classes)}\n />\n );\n }\n\n case EmbeddedFlowComponentType.DateInput: {\n const identifier: string = component.ref!;\n const value: string = formValues[identifier] || '';\n const isTouched: boolean = touchedFields[identifier] || false;\n const error: string = isTouched ? formErrors[identifier] : undefined!;\n\n return (\n <DatePicker\n key={key}\n id={component.id}\n name={identifier}\n label={resolve(component.label) || ''}\n placeholder={resolve(component.placeholder)}\n required={component.required}\n dateFormat={component.dateFormat}\n value={value}\n error={error}\n onChange={(e: any): void => onInputChange(identifier, e.target.value)}\n onBlur={(): any => options.onInputBlur?.(identifier)}\n className={cx(options.inputClassName, component.classes)}\n />\n );\n }\n\n case EmbeddedFlowComponentType.OuSelect: {\n logger.warn('OU_SELECT component type is not supported. Skipping render.');\n return null;\n }\n\n case EmbeddedFlowComponentType.Block: {\n if (component.components && component.components.length > 0) {\n const formClass: string = css({\n display: 'flex',\n flexDirection: 'column',\n gap: `calc(${theme?.vars?.spacing?.unit ?? '4px'} * 2)`,\n });\n\n const blockComponents: any = component.components\n .map((childComponent: any, index: any) =>\n createAuthComponentFromFlow(\n childComponent,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n resetForm,\n onInputChange,\n authType,\n {\n ...options,\n key: childComponent.id || `${component.id}_${index}`,\n },\n ),\n )\n .filter(Boolean);\n\n return (\n <form id={component.id} key={key} className={cx(component.classes, formClass)}>\n {blockComponents}\n </form>\n );\n }\n return null;\n }\n\n case EmbeddedFlowComponentType.RichText: {\n const richTextAction: EmbeddedFlowComponentAction | undefined = component.action;\n\n const dispatchRichTextAction = (): void => {\n if (!richTextAction || !options.onSubmit) {\n return;\n }\n const eventTypeValue = String(richTextAction.eventType ?? EmbeddedFlowEventType.Submit);\n const shouldSkipValidation: boolean = eventTypeValue.toUpperCase() === String(EmbeddedFlowEventType.Trigger);\n const syntheticAction: EmbeddedFlowComponent = {\n eventType: eventTypeValue,\n id: `${component.id}_action`,\n ref: richTextAction.ref,\n type: EmbeddedFlowComponentType.Action,\n };\n const formData: Record<string, string> = {};\n Object.keys(formValues).forEach((field: string) => {\n formData[field] = formValues[field];\n });\n options.onSubmit(syntheticAction, formData, shouldSkipValidation);\n };\n\n // Sentinel-anchor contract: only anchors carrying `data-action-ref` equal to\n // richTextAction.ref dispatch the action. Anchors without the sentinel (or with\n // a non-matching one) are treated as ordinary links and are ignored here.\n const isMatchingSentinelAnchor = (anchor: HTMLAnchorElement): boolean =>\n anchor.getAttribute('data-action-ref') === richTextAction?.ref;\n\n const handleRichTextClick: React.MouseEventHandler<HTMLDivElement> | undefined = richTextAction\n ? (event: React.MouseEvent<HTMLDivElement>): void => {\n const anchor: HTMLAnchorElement | null = (event.target as HTMLElement).closest('a');\n if (!anchor || !isMatchingSentinelAnchor(anchor)) {\n return;\n }\n event.preventDefault();\n dispatchRichTextAction();\n }\n : undefined;\n\n const handleRichTextKeyDown: React.KeyboardEventHandler<HTMLDivElement> | undefined = richTextAction\n ? (event: React.KeyboardEvent<HTMLDivElement>): void => {\n if (event.key !== 'Enter' && event.key !== ' ') {\n return;\n }\n const anchor: HTMLAnchorElement | null = (event.target as HTMLElement).closest('a');\n if (!anchor || !isMatchingSentinelAnchor(anchor)) {\n return;\n }\n event.preventDefault();\n dispatchRichTextAction();\n }\n : undefined;\n\n return (\n // Sentinel anchors are made keyboard-operable via the container's onKeyDown\n // (Enter/Space activate the matching anchor). Authors should ensure the anchor\n // is focusable (`href` or `tabIndex`); the click+keydown delegation covers both\n // pointer and keyboard activation once focus lands on the anchor.\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div\n key={key}\n className={getRichTextClass()}\n onClick={handleRichTextClick}\n onKeyDown={handleRichTextKeyDown}\n // Manually sanitizes with `DOMPurify`.\n // IMPORTANT: DO NOT REMOVE OR MODIFY THIS SANITIZATION STEP.\n dangerouslySetInnerHTML={{__html: DOMPurify.sanitize(resolveEmojiUrisInHtml(resolve(component.label)))}}\n />\n );\n }\n\n case EmbeddedFlowComponentType.Image: {\n const explicitHeight: string = resolve(component.height?.toString());\n const explicitWidth: string = resolve(component.width?.toString());\n return (\n <ImageComponent\n key={key}\n component={\n {\n config: {\n alt: resolve(component.alt) || resolve(component.label) || 'Image',\n height: explicitHeight || (options.inStack ? '50' : 'auto'),\n src: resolve(component.src),\n width: explicitWidth || (options.inStack ? '50' : '100%'),\n },\n } as any\n }\n formErrors={undefined!}\n formValues={undefined!}\n isFormValid={false}\n isLoading={false}\n onInputChange={(): void => {\n throw new Error('Function not implemented.');\n }}\n touchedFields={undefined!}\n />\n );\n }\n\n case EmbeddedFlowComponentType.Icon: {\n const iconName: string = component.name || '';\n const IconComponent: any = flowIconRegistry[iconName];\n if (!IconComponent) {\n logger.warn(`Unknown icon name: \"${iconName}\". Skipping render.`);\n return null;\n }\n return <IconComponent key={key} size={component.size || 24} color={component.color || 'currentColor'} />;\n }\n\n case EmbeddedFlowComponentType.Stack: {\n const direction: string = (component as any).direction || 'row';\n const gap: number = (component as any).gap ?? 2;\n const align: string = (component as any).align || 'center';\n const justify: string = (component as any).justify || 'flex-start';\n\n // `items` is the number of slots across the main axis and `direction` picks\n // that axis: with `row` it is the column count (items: 2 with four buttons\n // renders a 2 x 2 grid), and with `column` it is the row count and children\n // flow into further columns. Fewer than two slots keeps the flex layout, so\n // stacks authored before grid support are unaffected.\n const rawItems: string | number | undefined = component.items;\n const parsedItems: number =\n typeof rawItems === 'string' ? Number(rawItems) : typeof rawItems === 'number' ? rawItems : NaN;\n const items: number | null =\n Number.isFinite(parsedItems) && Math.floor(parsedItems) >= 2\n ? Math.min(Math.floor(parsedItems), MAX_STACK_ITEMS)\n : null;\n // CSS Grid has no reverse auto-flow, so the reverse variants fall back to\n // their base axis rather than silently becoming a row.\n const isColumn: boolean = direction.startsWith('column');\n const gridJustify: string = component.justify ?? 'stretch';\n // Equal `1fr` tracks fill the container, leaving `justify-content` no free\n // space to distribute. Content-sized tracks restore it, so every justify\n // value has a visible effect while the default stays an even split.\n const track: string = gridJustify === 'stretch' ? '1fr' : 'auto';\n\n const stackStyle: CSSProperties =\n items !== null\n ? {\n alignItems: component.align ?? 'stretch',\n display: 'grid',\n gap: `${gap * 0.5}rem`,\n gridAutoFlow: isColumn ? 'column' : 'row',\n justifyContent: gridJustify,\n width: '100%',\n ...(isColumn\n ? {gridTemplateRows: `repeat(${items}, ${track})`}\n : {gridTemplateColumns: `repeat(${items}, ${track})`}),\n }\n : {\n alignItems: align,\n display: 'flex',\n flexDirection: direction as CSSProperties['flexDirection'],\n flexWrap: 'wrap',\n gap: `${gap * 0.5}rem`,\n justifyContent: justify,\n };\n\n const stackClass: string = css(stackStyle as CSSInterpolation);\n\n const stackChildren: (ReactElement | null)[] = component.components\n ? component.components.map((childComponent: any, index: number) =>\n createAuthComponentFromFlow(\n childComponent,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n resetForm,\n onInputChange,\n authType,\n {\n ...options,\n inStack: true,\n key: childComponent.id || `${component.id}_${index}`,\n },\n ),\n )\n : [];\n\n return (\n <div key={key} id={component.id} className={cx(component.classes, stackClass)}>\n {stackChildren}\n </div>\n );\n }\n\n case EmbeddedFlowComponentType.Consent: {\n const consentPromptRawData: ConsentPromptData | string | undefined = options.additionalData?.['consentPrompt'];\n\n return (\n <Consent\n key={key}\n consentData={consentPromptRawData as any}\n formValues={formValues}\n onInputChange={onInputChange}\n config={component.config}\n meta={options.meta}\n t={options.t}\n />\n );\n }\n\n case EmbeddedFlowComponentType.Timer: {\n const textTemplate: string = resolve((component as any).label) || 'Time remaining: {time}';\n const timeoutMs: number = Number(options.additionalData?.['stepTimeout']) || 0;\n const expiresIn: number = timeoutMs > 0 ? Math.max(0, Math.floor((timeoutMs - Date.now()) / 1000)) : 0;\n\n return <FlowTimer key={key} expiresIn={expiresIn} textTemplate={textTemplate} />;\n }\n\n case EmbeddedFlowComponentType.CopyableText: {\n const sourceKey: string | undefined = (component as any).source;\n const value: string = sourceKey && options.additionalData ? String(options.additionalData[sourceKey] ?? '') : '';\n const labelText: string | undefined = resolve((component as any).label) || undefined;\n\n return <CopyableText key={key} label={labelText} value={value} />;\n }\n\n default:\n // Gracefully handle unsupported component types by returning null\n logger.warn(`Unsupported component type: ${component.type}. Skipping render.`);\n return null;\n }\n};\n\n/**\n * Processes an array of components and renders them as React elements for sign-in.\n */\nexport const renderSignInComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n resetForm: () => void,\n onInputChange: (name: string, value: string) => void,\n options?: {\n /** @internal */\n _customRenderers?: ComponentRendererMap;\n /** @internal */\n _theme?: any;\n /** Additional data from the flow response */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n inputClassName?: string;\n /** Flag to determine if the step timeline has expired */\n isTimeoutDisabled?: boolean;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n /** Vendor namespace used to derive affix sentinel keys for prefix/postfix-bearing inputs. */\n vendor?: string;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createAuthComponentFromFlow(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n resetForm,\n onInputChange,\n 'signin',\n {\n ...options,\n key: component.id || index,\n },\n ),\n )\n .filter((x): x is ReactElement => x !== null);\n\n/**\n * Processes an array of components and renders them as React elements for sign-up.\n */\nexport const renderSignUpComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n resetForm: () => void,\n onInputChange: (name: string, value: string) => void,\n options?: {\n /** @internal */\n _customRenderers?: ComponentRendererMap;\n /** @internal */\n _theme?: any;\n /** Additional data from the flow response */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n inputClassName?: string;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n /** Vendor namespace used to derive affix sentinel keys for prefix/postfix-bearing inputs. */\n vendor?: string;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createAuthComponentFromFlow(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n resetForm,\n onInputChange,\n 'signup',\n {\n ...options,\n key: component.id || index,\n },\n ),\n )\n .filter((x): x is ReactElement => x !== null);\n\n/**\n * Processes an array of components and renders them as React elements for recovery flow.\n */\nexport const renderRecoveryComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n resetForm: () => void,\n onInputChange: (name: string, value: string) => void,\n options?: {\n /** @internal */\n _customRenderers?: ComponentRendererMap;\n /** @internal */\n _theme?: any;\n /** Additional data from the flow response */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n inputClassName?: string;\n /** Flag to determine if the step timeline has expired */\n isTimeoutDisabled?: boolean;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n /** Vendor namespace used to derive affix sentinel keys for prefix/postfix-bearing inputs. */\n vendor?: string;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createAuthComponentFromFlow(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n resetForm,\n onInputChange,\n 'recovery',\n {\n ...options,\n key: component.id || index,\n },\n ),\n )\n .filter((x): x is ReactElement => x !== null);\n\n/**\n * Processes an array of components and renders them as React elements for invite user.\n * This is used by both InviteUser and AcceptInvite components.\n */\nexport const renderInviteUserComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n resetForm: () => void,\n onInputChange: (name: string, value: string) => void,\n options?: {\n /** @internal */\n _customRenderers?: ComponentRendererMap;\n /** @internal */\n _theme?: any;\n /** Additional data from the flow response */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n /** Function to fetch child organization units for OU_SELECT components. */\n fetchOrganizationUnitChildren?: (\n parentId: string,\n limit: number,\n offset: number,\n ) => Promise<OrganizationUnitListResponse>;\n inputClassName?: string;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n /** Vendor namespace used to derive affix sentinel keys for prefix/postfix-bearing inputs. */\n vendor?: string;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createAuthComponentFromFlow(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n resetForm,\n onInputChange,\n 'signup',\n {\n ...options,\n key: component.id || index,\n },\n ),\n )\n .filter((x): x is ReactElement => x !== null);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDA,MAAMA,WAA0D,6BAC9D,oBACA,oBACD;;;;;;;;;AAiBD,IAAIC;;AAGJ,SAAS,mBAA2B;AAClC,wBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;AA0B1B,QAAO;;AAGT,IAAIC;AAEJ,SAAS,yBAAiC;AACxC,8BAA6B,IAAI;EAAC,QAAQ;EAAU,WAAW;EAAW,OAAO;EAAS,CAAC;AAC3F,QAAO;;;;;;AAST,MAAM,kBAAkB;AAExB,MAAM,gBAAgB,YAAkD;AACtE,SAAQ,SAAR;EACE,KAAK,0BAA0B,WAC7B,QAAO,UAAU;EACnB,KAAK,0BAA0B,WAC7B,QAAO,UAAU;EACnB,KAAK,0BAA0B,cAC7B,QAAO,UAAU;EACnB,KAAK,0BAA0B;EAC/B,QACE,QAAO,UAAU;;;;;;AAOvB,MAAM,wBAAwB,YAAyB;AAiBrD,QAhBuE;EACrE,QAAQ;EACR,QAAQ;EACR,aAAa;EACb,SAAS;EACT,WAAW;EACX,WAAW;EACX,WAAW;EACX,WAAW;EACX,WAAW;EACX,WAAW;EACX,UAAU;EACV,YAAY;EACZ,YAAY;EACb,CAEiB,YAAY;;;;;AAMhC,MAAM,yBACJ,UACA,WACA,YACA,UACA,UAEA,sBACY;CACZ,MAAMC,aAAkB,GAAG,SAAS;CACpC,MAAMC,kBAAuB,aAAa,cAAc,cAAc;AAItE,KAAI,WAAW,aAAa,CAAC,SAAS,SAAS,CAC7C,QAAO;AAIT,KAAI,aAAa,SACf,QAAO,mBAAmB,WAAW,aAAa,CAAC,SAAS,SAAS;AAGvE,QAAO;;;;;AAMT,MAAM,+BACJ,WACA,YACA,eACA,YACA,WACA,aACA,WACA,eACA,UACA,U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B;MAA9B,IAAuC;;EAGnE;AAEE,YAAO,KAAK,+BAA+B,UAAU,KAAK,oBAAoB;AAC9E,UAAO;;;;;;AAOb,MAAa,0BACX,YACA,YACA,eACA,YACA,WACA,aACA,WACA,eACA,YAuBA,WACG,KAAK,WAAgB,UACpB,4BACE,WACA,YACA,eACA,YACA,WACA,aACA,WACA,eACA,UACA;CACE,GAAG;CACH,KAAK,UAAU,MAAM;CACtB,CACF,CACF,CACA,QAAQ,MAAyB,MAAM,KAAK;;;;AAKjD,MAAa,0BACX,YACA,YACA,eACA,YACA,WACA,aACA,WACA,eACA,YAqBA,WACG,KAAK,WAAgB,UACpB,4BACE,WACA,YACA,eACA,YACA,WACA,aACA,WACA,eACA,UACA;CACE,GAAG;CACH,KAAK,UAAU,MAAM;CACtB,CACF,CACF,CACA,QAAQ,MAAyB,MAAM,KAAK;;;;AAKjD,MAAa,4BACX,YACA,YACA,eACA,YACA,WACA,aACA,WACA,eACA,YAuBA,WACG,KAAK,WAAgB,UACpB,4BACE,WACA,YACA,eACA,YACA,WACA,aACA,WACA,eACA,YACA;CACE,GAAG;CACH,KAAK,UAAU,MAAM;CACtB,CACF,CACF,CACA,QAAQ,MAAyB,MAAM,KAAK;;;;;AAMjD,MAAa,8BACX,YACA,YACA,eACA,YACA,WACA,aACA,WACA,eACA,YA2BA,WACG,KAAK,WAAgB,UACpB,4BACE,WACA,YACA,eACA,YACA,WACA,aACA,WACA,eACA,UACA;CACE,GAAG;CACH,KAAK,UAAU,MAAM;CACtB,CACF,CACF,CACA,QAAQ,MAAyB,MAAM,KAAK"}
1
+ {"version":3,"file":"AuthOptionFactory.js","names":["logger: ReturnType<typeof createPackageComponentLogger>","richTextClassCache: string | undefined","authOptionIconClassCache: string | undefined","providerId: any","providerMatches: any","theme: any","customRenderers: ComponentRendererMap","key: string | number","customRenderer: ComponentRenderer | undefined","identifier: string","value: string","error: string","fieldType: string","hasPrefixes: boolean","hasPostfix: boolean","prefixStateKey: string","postfixStateKey: string","defaultPrefixValue: string","selectedPrefix: string","AffixedField","reportedLength: number","otpLength: number | undefined","numericOnly: boolean","actionId: string","eventType: string","buttonText: string","componentVariant: string","shouldSkipValidation: boolean","buttonType: HTMLButtonElement['type']","formData: Record<string, any>","consentPrompt: ConsentPromptData | undefined","isDeny: boolean","decisions: ConsentDecisions","socialButtonClassName: string","GoogleButton","GitHubButton","FacebookButton","MicrosoftButton","LinkedInButton","SignInWithEthereumButton","SmsOtpButton","startIconEl: ReactElement | null","endIconEl: ReactElement | null","Button","variant: any","textAlignClass: string","Typography","Divider","selectOptions: any","Select","DatePicker","formClass: string","blockComponents: any","richTextAction: EmbeddedFlowComponentAction | undefined","syntheticAction: EmbeddedFlowComponent","formData: Record<string, string>","handleRichTextClick: React.MouseEventHandler<HTMLDivElement> | undefined","anchor: HTMLAnchorElement | null","handleRichTextKeyDown: React.KeyboardEventHandler<HTMLDivElement> | undefined","explicitHeight: string","explicitWidth: string","ImageComponent","iconName: string","IconComponent: any","flowIconRegistry","direction: string","gap: number","align: string","justify: string","rawItems: string | number | undefined","parsedItems: number","items: number | null","isColumn: boolean","gridJustify: string","track: string","stackClass: string","stackChildren: (ReactElement | null)[]","consentPromptRawData: ConsentPromptData | string | undefined","Consent","textTemplate: string","timeoutMs: number","FlowTimer","sourceKey: string | undefined","CopyableText"],"sources":["../../../../src/components/presentation/auth/AuthOptionFactory.tsx"],"sourcesContent":["// Copyright 2025 The ThunderID Authors\n// SPDX-License-Identifier: Apache-2.0\n\nimport type {CSSInterpolation} from '@emotion/css/create-instance';\nimport {\n ConsentConstants,\n FieldType,\n FlowMetadataResponse,\n EmbeddedFlowComponent,\n EmbeddedFlowComponentAction,\n EmbeddedFlowComponentType,\n EmbeddedFlowTextVariant,\n EmbeddedFlowEventType,\n createPackageComponentLogger,\n resolveFlowTemplateLiterals,\n resolveEmojiUrisInHtml,\n ConsentPurposeData,\n ConsentPromptData,\n ConsentDecisions,\n ConsentPurposeDecision,\n ConsentAttributeElement,\n OrganizationUnitListResponse,\n PrefixOption,\n} from '@thunderid/browser';\nimport DOMPurify from 'dompurify';\nimport {ChangeEvent, cloneElement, CSSProperties, ReactElement} from 'react';\nimport {\n ComponentRenderer,\n ComponentRenderContext,\n ComponentRendererMap,\n} from '../../../contexts/ComponentRenderer/ComponentRendererContext';\nimport {UseTranslation} from '../../../hooks/useTranslation';\nimport {css, cx} from '../../../styles/emotion';\nimport Consent from '../../adapters/Consent';\nimport {getConsentOptionalKey} from '../../adapters/ConsentCheckboxList';\nimport FacebookButton from '../../adapters/FacebookButton';\nimport FlowTimer from '../../adapters/FlowTimer';\nimport GitHubButton from '../../adapters/GitHubButton';\nimport GoogleButton from '../../adapters/GoogleButton';\nimport ImageComponent from '../../adapters/ImageComponent';\nimport LinkedInButton from '../../adapters/LinkedInButton';\nimport MicrosoftButton from '../../adapters/MicrosoftButton';\nimport SignInWithEthereumButton from '../../adapters/SignInWithEthereumButton';\nimport SmsOtpButton from '../../adapters/SmsOtpButton';\nimport {createField} from '../../factories/FieldFactory';\nimport Button from '../../primitives/Button/Button';\nimport CopyableText from '../../primitives/CopyableText/CopyableText';\nimport DatePicker from '../../primitives/DatePicker/DatePicker';\nimport Divider from '../../primitives/Divider/Divider';\nimport flowIconRegistry from '../../primitives/Icons/flowIconRegistry';\nimport AffixedField from '../../primitives/AffixedField/AffixedField';\nimport Select from '../../primitives/Select/Select';\nimport {affixPostfixKey, affixPrefixKey} from '../../../utils/composeAffixedInputs';\nimport Typography from '../../primitives/Typography/Typography';\nimport {TypographyVariant} from '../../primitives/Typography/Typography.styles';\n\nconst logger: ReturnType<typeof createPackageComponentLogger> = createPackageComponentLogger(\n '@thunderid/react',\n 'AuthOptionFactory',\n);\n\n/**\n * Replaces `emoji:` URIs embedded in HTML before DOMPurify sanitization.\n *\n * DOMPurify strips unknown URI schemes from attributes (e.g. `src=\"emoji:🦊\"` → `src=\"\"`).\n * This function converts:\n * - `<img src=\"emoji:X\" alt=\"Y\">` → `<span role=\"img\" aria-label=\"Y\">X</span>`\n * - Any remaining `emoji:X` text occurrences → `X`\n */\n\n// This module's functions (renderSignInComponents, etc.) are called imperatively from a\n// component's render, not React components/hooks themselves — so these classes can't be computed\n// at module scope: that runs at import time, before <ThunderIDProvider> has had a chance to\n// configure Emotion's CSP nonce, which would insert them into an un-nonced <style> tag. Instead\n// they're computed lazily, on first actual use (still just once — Emotion's own cache dedupes any\n// further calls to a no-op after that).\nlet richTextClassCache: string | undefined;\n\n/** Ensures rich-text content (including all inner elements from the server) always word-wraps. */\nfunction getRichTextClass(): string {\n richTextClassCache ??= css`\n overflow-wrap: anywhere;\n & * {\n overflow-wrap: anywhere;\n word-break: break-word;\n }\n & .rich-text-align-left {\n text-align: left;\n }\n & .rich-text-align-center {\n text-align: center;\n }\n & .rich-text-align-right {\n text-align: right;\n }\n & .rich-text-align-justify {\n text-align: justify;\n }\n & a,\n & .rich-text-link {\n text-decoration: underline;\n }\n & span[role='img'] {\n display: inline-block;\n }\n `;\n return richTextClassCache;\n}\n\nlet authOptionIconClassCache: string | undefined;\n\nfunction getAuthOptionIconClass(): string {\n authOptionIconClassCache ??= css({height: '1.25em', objectFit: 'contain', width: '1.25em'});\n return authOptionIconClassCache;\n}\n\nexport type AuthType = 'signin' | 'signup' | 'recovery';\n\n/**\n * Get the appropriate FieldType for an input component.\n */\n/** Upper bound on STACK grid slots, so a mistyped `items` cannot render thousands of cells. */\nconst MAX_STACK_ITEMS = 12;\n\nconst getFieldType = (variant: EmbeddedFlowComponentType): FieldType => {\n switch (variant) {\n case EmbeddedFlowComponentType.EmailInput:\n return FieldType.Email;\n case EmbeddedFlowComponentType.PhoneInput:\n return FieldType.Tel;\n case EmbeddedFlowComponentType.PasswordInput:\n return FieldType.Password;\n case EmbeddedFlowComponentType.TextInput:\n default:\n return FieldType.Text;\n }\n};\n\n/**\n * Get typography variant from component variant.\n */\nconst getTypographyVariant = (variant: string): any => {\n const variantMap: Record<EmbeddedFlowTextVariant, TypographyVariant> = {\n BODY_1: 'body1',\n BODY_2: 'body2',\n BUTTON_TEXT: 'button',\n CAPTION: 'caption',\n HEADING_1: 'h1',\n HEADING_2: 'h2',\n HEADING_3: 'h3',\n HEADING_4: 'h4',\n HEADING_5: 'h5',\n HEADING_6: 'h6',\n OVERLINE: 'overline',\n SUBTITLE_1: 'subtitle1',\n SUBTITLE_2: 'subtitle2',\n };\n\n return variantMap[variant] || 'h3';\n};\n\n/**\n * Check if a button text or action matches a social provider.\n */\nconst matchesSocialProvider = (\n actionId: string,\n eventType: string,\n buttonText: string,\n provider: string,\n authType: AuthType,\n /* eslint-disable-next-line @typescript-eslint/no-unused-vars */\n _componentVariant?: string,\n): boolean => {\n const providerId: any = `${provider}_auth`;\n const providerMatches: any = actionId === providerId || eventType === providerId;\n\n // Social buttons usually have \"Sign in with X\" or \"Continue with X\" text,\n // so also check button text for the provider name to increase chances of correct detection (especially for signup flows where action IDs are less standardized)\n if (buttonText.toLowerCase().includes(provider)) {\n return true;\n }\n\n // For signup, also check button text\n if (authType === 'signup') {\n return providerMatches || buttonText.toLowerCase().includes(provider);\n }\n\n return providerMatches;\n};\n\n/**\n * Create an auth component from flow component configuration.\n */\nconst createAuthComponentFromFlow = (\n component: EmbeddedFlowComponent,\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n resetForm: () => void,\n onInputChange: (name: string, value: string) => void,\n authType: AuthType,\n options: {\n /** @internal Passed from the host React component so hooks aren't called inside a loop. */\n _customRenderers?: ComponentRendererMap;\n /** @internal Passed from the host React component so hooks aren't called inside a loop. */\n _theme?: any;\n /** Additional data from the flow response, used for different dynamic data */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n /** Current consent purpose being rendered. Set by CONSENT_PURPOSE block iteration. */\n currentConsentPurpose?: ConsentPurposeData;\n inStack?: boolean;\n inputClassName?: string;\n /** Flag to determine if the step timeline has expired */\n isTimeoutDisabled?: boolean;\n key?: string | number;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n /** Vendor namespace used to derive affix sentinel keys for prefix/postfix-bearing inputs. */\n vendor?: string;\n } = {},\n): ReactElement | null => {\n const theme: any = options._theme;\n const customRenderers: ComponentRendererMap = options._customRenderers ?? {};\n\n const key: string | number = options.key || component.id;\n\n const customRenderer: ComponentRenderer | undefined =\n customRenderers[component.id] ?? customRenderers[component.type];\n if (customRenderer) {\n const renderCtx: ComponentRenderContext = {\n additionalData: options.additionalData,\n authType,\n formErrors,\n formValues,\n isFormValid,\n isLoading,\n meta: options.meta,\n resetForm,\n onInputBlur: options.onInputBlur,\n onInputChange,\n onSubmit: options.onSubmit,\n touchedFields,\n };\n return customRenderer(component, renderCtx);\n }\n\n /** Resolve any remaining {{t()}} or {{meta()}} template expressions in a string at render time. */\n const resolve = (text: string | undefined): string => {\n if (!text || (!options.t && !options.meta)) {\n return text || '';\n }\n return resolveFlowTemplateLiterals(text, {meta: options.meta, t: options.t || ((k: string): string => k)});\n };\n\n switch (component.type) {\n case EmbeddedFlowComponentType.TextInput:\n case EmbeddedFlowComponentType.PasswordInput:\n case EmbeddedFlowComponentType.EmailInput:\n case EmbeddedFlowComponentType.PhoneInput: {\n const identifier: string = component.ref!;\n const value: string = formValues[identifier] || '';\n const isTouched: boolean = touchedFields[identifier] || false;\n const error: string = isTouched ? formErrors[identifier] : undefined!;\n const fieldType: string = getFieldType(component.type);\n\n // Prefix/postfix are accepted on any text-family input. When either is present,\n // route to AffixedField so the leading affix renders and submit-time composition\n // is picked up by composeAffixedInputs via the sentinel keys.\n // Both string.length and Array.length are defined, so a single truthy+length\n // check covers `prefixes?: string | PrefixOption[]`.\n const hasPrefixes: boolean = !!component.prefixes && component.prefixes.length > 0;\n const hasPostfix: boolean = typeof component.postfix === 'string' && component.postfix.length > 0;\n\n if (hasPrefixes || hasPostfix) {\n const prefixStateKey: string = affixPrefixKey(identifier, options.vendor);\n const postfixStateKey: string = affixPostfixKey(identifier, options.vendor);\n const defaultPrefixValue: string = hasPrefixes\n ? typeof component.prefixes === 'string'\n ? component.prefixes\n : (component.prefixes as PrefixOption[])[0].value\n : '';\n const selectedPrefix: string = formValues[prefixStateKey] ?? defaultPrefixValue;\n\n return (\n <AffixedField\n key={key}\n className={cx(options.inputClassName, component.classes)}\n id={component.id}\n label={resolve(component.label) || ''}\n name={identifier}\n placeholder={resolve(component.placeholder) || ''}\n required={component.required || false}\n error={error}\n value={value}\n type={fieldType}\n prefixes={component.prefixes}\n prefixValue={selectedPrefix}\n onChange={(e: ChangeEvent<HTMLInputElement>): void => onInputChange(identifier, e.target.value)}\n onBlur={(): void => options.onInputBlur?.(identifier)}\n onPrefixChange={(newPrefix: string): void => onInputChange(prefixStateKey, newPrefix)}\n onFocus={(): void => {\n if (hasPrefixes && formValues[prefixStateKey] === undefined) {\n onInputChange(prefixStateKey, defaultPrefixValue);\n }\n if (hasPostfix && formValues[postfixStateKey] === undefined) {\n onInputChange(postfixStateKey, component.postfix!);\n }\n }}\n />\n );\n }\n\n const field: any = createField({\n className: cx(options.inputClassName, component.classes),\n error,\n id: component.id,\n label: resolve(component.label) || '',\n name: identifier,\n onBlur: () => options.onInputBlur?.(identifier),\n onChange: (newValue: string) => onInputChange(identifier, newValue),\n placeholder: resolve(component.placeholder) || '',\n required: component.required || false,\n type: fieldType as FieldType,\n value,\n });\n\n return cloneElement(field, {key});\n }\n\n case EmbeddedFlowComponentType.OtpInput: {\n const identifier: string = component.ref!;\n const value: string = formValues[identifier] || '';\n const isTouched: boolean = touchedFields[identifier] || false;\n const error: string = isTouched ? formErrors[identifier] : undefined!;\n\n // The server reports the length and character set of the code it generated, so the field\n // matches the OTP the user received. An older server omits both and the defaults apply.\n const reportedLength: number = Number(options.additionalData?.['otpLength']);\n const otpLength: number | undefined =\n Number.isInteger(reportedLength) && reportedLength > 0 ? reportedLength : undefined;\n const numericOnly: boolean = options.additionalData?.['otpNumericOnly'] !== 'false';\n\n const field: any = createField({\n className: cx(options.inputClassName, component.classes),\n error,\n id: component.id,\n label: resolve(component.label) || '',\n length: otpLength,\n name: identifier,\n numericOnly,\n onBlur: () => options.onInputBlur?.(identifier),\n onChange: (newValue: string) => onInputChange(identifier, newValue),\n placeholder: resolve(component.placeholder) || '',\n required: component.required || false,\n type: FieldType.Otp,\n value,\n });\n\n return cloneElement(field, {key});\n }\n\n case EmbeddedFlowComponentType.Action: {\n const actionId: string = component.id;\n const eventType: string = component.eventType || '';\n const buttonText: string = resolve(component.label);\n const componentVariant: string = component.variant || '';\n\n // Only validate on submit type events.\n const shouldSkipValidation: boolean = eventType.toUpperCase() !== EmbeddedFlowEventType.Submit;\n\n // Determine the button type based on the event type. Default to 'submit' if not recognized.\n const buttonTypeEnum = {\n [EmbeddedFlowEventType.Submit]: 'submit',\n [EmbeddedFlowEventType.Reset]: 'reset',\n [EmbeddedFlowEventType.Cancel]: 'button',\n [EmbeddedFlowEventType.Trigger]: 'button',\n [EmbeddedFlowEventType.Back]: 'button',\n };\n const buttonType: HTMLButtonElement['type'] = buttonTypeEnum[eventType.toUpperCase()] ?? 'submit';\n\n const handleClick = (): any => {\n if (options.onSubmit) {\n const formData: Record<string, any> = {};\n Object.keys(formValues).forEach((field: any) => {\n // Include all values, even empty strings, to ensure proper submission\n formData[field] = formValues[field];\n });\n\n // For consent actions, build the consent_decisions JSON from the form values.\n // The allow action captures per-attribute choices; the deny action sends\n // all purposes as rejected so the backend ConsentExecutor can fail the flow.\n const consentPrompt: ConsentPromptData | undefined = options.additionalData?.['consentPrompt'] as\n | ConsentPromptData\n | undefined;\n if (consentPrompt && eventType.toUpperCase() === EmbeddedFlowEventType.Submit) {\n const isDeny: boolean = componentVariant.toLowerCase() !== 'primary';\n const decisions: ConsentDecisions = {\n approved: !isDeny,\n ...(isDeny ? {reason: ConsentConstants.REASON_USER_DENIED} : {}),\n purposes: consentPrompt.purposes.map(\n (p: ConsentPurposeData): ConsentPurposeDecision => ({\n approved: !isDeny,\n elements: [\n // Permission purposes carry no essential elements, so the server sends null here\n ...(p.essential ?? []).map((e): ConsentAttributeElement => ({approved: !isDeny, name: e.name})),\n ...(p.optional ?? []).map(\n (e): ConsentAttributeElement => ({\n approved: !isDeny && formValues[getConsentOptionalKey(p.purposeId, e.name)] === 'true',\n name: e.name,\n }),\n ),\n ],\n purposeName: p.purposeName!,\n }),\n ),\n };\n formData['consent_decisions'] = JSON.stringify(decisions);\n }\n\n // For submit events, pass the form data to the onSubmit callback. For other event types, reset the form and call onSubmit with an empty data object.\n if (eventType.toUpperCase() === EmbeddedFlowEventType.Submit) {\n options.onSubmit(component, formData, shouldSkipValidation);\n } else {\n resetForm();\n options.onSubmit(component, {}, shouldSkipValidation);\n }\n }\n };\n\n // Render branded social login buttons for known action IDs\n\n const socialButtonClassName: string = cx(options.buttonClassName, component.classes);\n\n if (matchesSocialProvider(actionId, eventType, buttonText, 'google', authType, componentVariant)) {\n return <GoogleButton key={key} id={component.id} onClick={handleClick} className={socialButtonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'github', authType, componentVariant)) {\n return <GitHubButton key={key} id={component.id} onClick={handleClick} className={socialButtonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'facebook', authType, componentVariant)) {\n return <FacebookButton key={key} id={component.id} onClick={handleClick} className={socialButtonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'microsoft', authType, componentVariant)) {\n return <MicrosoftButton key={key} id={component.id} onClick={handleClick} className={socialButtonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'linkedin', authType, componentVariant)) {\n return <LinkedInButton key={key} id={component.id} onClick={handleClick} className={socialButtonClassName} />;\n }\n if (matchesSocialProvider(actionId, eventType, buttonText, 'ethereum', authType, componentVariant)) {\n return (\n <SignInWithEthereumButton\n key={key}\n id={component.id}\n onClick={handleClick}\n className={socialButtonClassName}\n />\n );\n }\n if (actionId === 'prompt_mobile' || eventType === 'prompt_mobile') {\n return <SmsOtpButton key={key} id={component.id} onClick={handleClick} className={socialButtonClassName} />;\n }\n\n const startIconEl: ReactElement | null = component.startIcon ? (\n <img src={component.startIcon} alt=\"\" aria-hidden=\"true\" className={getAuthOptionIconClass()} />\n ) : null;\n\n const endIconEl: ReactElement | null = component.endIcon ? (\n <img src={component.endIcon} alt=\"\" aria-hidden=\"true\" className={getAuthOptionIconClass()} />\n ) : null;\n\n return (\n <Button\n fullWidth\n key={key}\n id={component.id}\n onClick={handleClick}\n disabled={\n isLoading ||\n (!isFormValid && !shouldSkipValidation) ||\n options.isTimeoutDisabled ||\n (component as any).config?.disabled\n }\n className={cx(options.buttonClassName, component.classes)}\n data-testid=\"thunderid-signin-submit\"\n variant={component.variant?.toLowerCase() === 'primary' ? 'solid' : 'outline'}\n color={component.variant?.toLowerCase() === 'primary' ? 'primary' : 'secondary'}\n startIcon={startIconEl}\n endIcon={endIconEl}\n type={buttonType}\n >\n {buttonText || 'Submit'}\n </Button>\n );\n }\n\n case EmbeddedFlowComponentType.Text: {\n const variant: any = getTypographyVariant(component.variant!);\n const textAlignClass: string = css({\n marginBottom: 2,\n textAlign:\n typeof component?.align === 'string' ? (component.align as React.CSSProperties['textAlign']) : 'left',\n });\n return (\n <Typography key={key} id={component.id} className={cx(component.classes, textAlignClass)} variant={variant}>\n {resolve(component.label)}\n </Typography>\n );\n }\n\n case EmbeddedFlowComponentType.Divider: {\n return <Divider key={key}>{resolve(component.label) || ''}</Divider>;\n }\n\n case EmbeddedFlowComponentType.Select: {\n const identifier: string = component.ref!;\n const value: string = formValues[identifier] || '';\n const isTouched: boolean = touchedFields[identifier] || false;\n const error: string = isTouched ? formErrors[identifier] : undefined!;\n\n // Options are pre-sanitized by flowTransformer to {value: string, label: string} format\n const selectOptions: any = (component.options || []).map((opt: any) => ({\n label: typeof opt === 'string' ? opt : String(opt.label ?? opt.value ?? ''),\n value: typeof opt === 'string' ? opt : String(opt.value ?? ''),\n }));\n\n return (\n <Select\n key={key}\n id={component.id}\n name={identifier}\n label={resolve(component.label) || ''}\n placeholder={resolve(component.placeholder)}\n required={component.required}\n options={selectOptions}\n value={value}\n error={error}\n onChange={(e: any): void => onInputChange(identifier, e.target.value)}\n onBlur={(): any => options.onInputBlur?.(identifier)}\n className={cx(options.inputClassName, component.classes)}\n />\n );\n }\n\n case EmbeddedFlowComponentType.DateInput: {\n const identifier: string = component.ref!;\n const value: string = formValues[identifier] || '';\n const isTouched: boolean = touchedFields[identifier] || false;\n const error: string = isTouched ? formErrors[identifier] : undefined!;\n\n return (\n <DatePicker\n key={key}\n id={component.id}\n name={identifier}\n label={resolve(component.label) || ''}\n placeholder={resolve(component.placeholder)}\n required={component.required}\n dateFormat={component.dateFormat}\n value={value}\n error={error}\n onChange={(e: any): void => onInputChange(identifier, e.target.value)}\n onBlur={(): any => options.onInputBlur?.(identifier)}\n className={cx(options.inputClassName, component.classes)}\n />\n );\n }\n\n case EmbeddedFlowComponentType.OuSelect: {\n logger.warn('OU_SELECT component type is not supported. Skipping render.');\n return null;\n }\n\n case EmbeddedFlowComponentType.Block: {\n if (component.components && component.components.length > 0) {\n const formClass: string = css({\n display: 'flex',\n flexDirection: 'column',\n gap: `calc(${theme?.vars?.spacing?.unit ?? '4px'} * 2)`,\n });\n\n const blockComponents: any = component.components\n .map((childComponent: any, index: any) =>\n createAuthComponentFromFlow(\n childComponent,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n resetForm,\n onInputChange,\n authType,\n {\n ...options,\n key: childComponent.id || `${component.id}_${index}`,\n },\n ),\n )\n .filter(Boolean);\n\n return (\n <form id={component.id} key={key} className={cx(component.classes, formClass)}>\n {blockComponents}\n </form>\n );\n }\n return null;\n }\n\n case EmbeddedFlowComponentType.RichText: {\n const richTextAction: EmbeddedFlowComponentAction | undefined = component.action;\n\n const dispatchRichTextAction = (): void => {\n if (!richTextAction || !options.onSubmit) {\n return;\n }\n const eventTypeValue = String(richTextAction.eventType ?? EmbeddedFlowEventType.Submit);\n const shouldSkipValidation: boolean = eventTypeValue.toUpperCase() === String(EmbeddedFlowEventType.Trigger);\n const syntheticAction: EmbeddedFlowComponent = {\n eventType: eventTypeValue,\n id: `${component.id}_action`,\n ref: richTextAction.ref,\n type: EmbeddedFlowComponentType.Action,\n };\n const formData: Record<string, string> = {};\n Object.keys(formValues).forEach((field: string) => {\n formData[field] = formValues[field];\n });\n options.onSubmit(syntheticAction, formData, shouldSkipValidation);\n };\n\n // Sentinel-anchor contract: only anchors carrying `data-action-ref` equal to\n // richTextAction.ref dispatch the action. Anchors without the sentinel (or with\n // a non-matching one) are treated as ordinary links and are ignored here.\n const isMatchingSentinelAnchor = (anchor: HTMLAnchorElement): boolean =>\n anchor.getAttribute('data-action-ref') === richTextAction?.ref;\n\n const handleRichTextClick: React.MouseEventHandler<HTMLDivElement> | undefined = richTextAction\n ? (event: React.MouseEvent<HTMLDivElement>): void => {\n const anchor: HTMLAnchorElement | null = (event.target as HTMLElement).closest('a');\n if (!anchor || !isMatchingSentinelAnchor(anchor)) {\n return;\n }\n event.preventDefault();\n dispatchRichTextAction();\n }\n : undefined;\n\n const handleRichTextKeyDown: React.KeyboardEventHandler<HTMLDivElement> | undefined = richTextAction\n ? (event: React.KeyboardEvent<HTMLDivElement>): void => {\n if (event.key !== 'Enter' && event.key !== ' ') {\n return;\n }\n const anchor: HTMLAnchorElement | null = (event.target as HTMLElement).closest('a');\n if (!anchor || !isMatchingSentinelAnchor(anchor)) {\n return;\n }\n event.preventDefault();\n dispatchRichTextAction();\n }\n : undefined;\n\n return (\n // Sentinel anchors are made keyboard-operable via the container's onKeyDown\n // (Enter/Space activate the matching anchor). Authors should ensure the anchor\n // is focusable (`href` or `tabIndex`); the click+keydown delegation covers both\n // pointer and keyboard activation once focus lands on the anchor.\n // eslint-disable-next-line jsx-a11y/no-static-element-interactions\n <div\n key={key}\n className={getRichTextClass()}\n onClick={handleRichTextClick}\n onKeyDown={handleRichTextKeyDown}\n // Manually sanitizes with `DOMPurify`.\n // IMPORTANT: DO NOT REMOVE OR MODIFY THIS SANITIZATION STEP.\n dangerouslySetInnerHTML={{__html: DOMPurify.sanitize(resolveEmojiUrisInHtml(resolve(component.label)))}}\n />\n );\n }\n\n case EmbeddedFlowComponentType.Image: {\n const explicitHeight: string = resolve(component.height?.toString());\n const explicitWidth: string = resolve(component.width?.toString());\n return (\n <ImageComponent\n key={key}\n component={\n {\n config: {\n alt: resolve(component.alt) || resolve(component.label) || 'Image',\n height: explicitHeight || (options.inStack ? '50' : 'auto'),\n src: resolve(component.src),\n width: explicitWidth || (options.inStack ? '50' : '100%'),\n },\n } as any\n }\n formErrors={undefined!}\n formValues={undefined!}\n isFormValid={false}\n isLoading={false}\n onInputChange={(): void => {\n throw new Error('Function not implemented.');\n }}\n touchedFields={undefined!}\n />\n );\n }\n\n case EmbeddedFlowComponentType.Icon: {\n const iconName: string = component.name || '';\n const IconComponent: any = flowIconRegistry[iconName];\n if (!IconComponent) {\n logger.warn(`Unknown icon name: \"${iconName}\". Skipping render.`);\n return null;\n }\n return <IconComponent key={key} size={component.size || 24} color={component.color || 'currentColor'} />;\n }\n\n case EmbeddedFlowComponentType.Stack: {\n const direction: string = (component as any).direction || 'row';\n const gap: number = (component as any).gap ?? 2;\n const align: string = (component as any).align || 'center';\n const justify: string = (component as any).justify || 'flex-start';\n\n // `items` is the number of slots across the main axis and `direction` picks\n // that axis: with `row` it is the column count (items: 2 with four buttons\n // renders a 2 x 2 grid), and with `column` it is the row count and children\n // flow into further columns. Fewer than two slots keeps the flex layout, so\n // stacks authored before grid support are unaffected.\n const rawItems: string | number | undefined = component.items;\n const parsedItems: number =\n typeof rawItems === 'string' ? Number(rawItems) : typeof rawItems === 'number' ? rawItems : NaN;\n const items: number | null =\n Number.isFinite(parsedItems) && Math.floor(parsedItems) >= 2\n ? Math.min(Math.floor(parsedItems), MAX_STACK_ITEMS)\n : null;\n // CSS Grid has no reverse auto-flow, so the reverse variants fall back to\n // their base axis rather than silently becoming a row.\n const isColumn: boolean = direction.startsWith('column');\n const gridJustify: string = component.justify ?? 'stretch';\n // Equal `1fr` tracks fill the container, leaving `justify-content` no free\n // space to distribute. Content-sized tracks restore it, so every justify\n // value has a visible effect while the default stays an even split.\n const track: string = gridJustify === 'stretch' ? '1fr' : 'auto';\n\n const stackStyle: CSSProperties =\n items !== null\n ? {\n alignItems: component.align ?? 'stretch',\n display: 'grid',\n gap: `${gap * 0.5}rem`,\n gridAutoFlow: isColumn ? 'column' : 'row',\n justifyContent: gridJustify,\n width: '100%',\n ...(isColumn\n ? {gridTemplateRows: `repeat(${items}, ${track})`}\n : {gridTemplateColumns: `repeat(${items}, ${track})`}),\n }\n : {\n alignItems: align,\n display: 'flex',\n flexDirection: direction as CSSProperties['flexDirection'],\n flexWrap: 'wrap',\n gap: `${gap * 0.5}rem`,\n justifyContent: justify,\n };\n\n const stackClass: string = css(stackStyle as CSSInterpolation);\n\n const stackChildren: (ReactElement | null)[] = component.components\n ? component.components.map((childComponent: any, index: number) =>\n createAuthComponentFromFlow(\n childComponent,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n resetForm,\n onInputChange,\n authType,\n {\n ...options,\n inStack: true,\n key: childComponent.id || `${component.id}_${index}`,\n },\n ),\n )\n : [];\n\n return (\n <div key={key} id={component.id} className={cx(component.classes, stackClass)}>\n {stackChildren}\n </div>\n );\n }\n\n case EmbeddedFlowComponentType.Consent: {\n const consentPromptRawData: ConsentPromptData | string | undefined = options.additionalData?.['consentPrompt'];\n\n return (\n <Consent\n key={key}\n consentData={consentPromptRawData as any}\n formValues={formValues}\n onInputChange={onInputChange}\n config={component.config}\n meta={options.meta}\n t={options.t}\n />\n );\n }\n\n case EmbeddedFlowComponentType.Timer: {\n const textTemplate: string = resolve((component as any).label) || 'Time remaining: {time}';\n const timeoutMs: number = Number(options.additionalData?.['stepTimeout']) || 0;\n const expiresIn: number = timeoutMs > 0 ? Math.max(0, Math.floor((timeoutMs - Date.now()) / 1000)) : 0;\n\n return <FlowTimer key={key} expiresIn={expiresIn} textTemplate={textTemplate} />;\n }\n\n case EmbeddedFlowComponentType.CopyableText: {\n const sourceKey: string | undefined = (component as any).source;\n const value: string = sourceKey && options.additionalData ? String(options.additionalData[sourceKey] ?? '') : '';\n const labelText: string | undefined = resolve((component as any).label) || undefined;\n\n return <CopyableText key={key} label={labelText} value={value} />;\n }\n\n default:\n // Gracefully handle unsupported component types by returning null\n logger.warn(`Unsupported component type: ${component.type}. Skipping render.`);\n return null;\n }\n};\n\n/**\n * Processes an array of components and renders them as React elements for sign-in.\n */\nexport const renderSignInComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n resetForm: () => void,\n onInputChange: (name: string, value: string) => void,\n options?: {\n /** @internal */\n _customRenderers?: ComponentRendererMap;\n /** @internal */\n _theme?: any;\n /** Additional data from the flow response */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n inputClassName?: string;\n /** Flag to determine if the step timeline has expired */\n isTimeoutDisabled?: boolean;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n /** Vendor namespace used to derive affix sentinel keys for prefix/postfix-bearing inputs. */\n vendor?: string;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createAuthComponentFromFlow(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n resetForm,\n onInputChange,\n 'signin',\n {\n ...options,\n key: component.id || index,\n },\n ),\n )\n .filter((x): x is ReactElement => x !== null);\n\n/**\n * Processes an array of components and renders them as React elements for sign-up.\n */\nexport const renderSignUpComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n resetForm: () => void,\n onInputChange: (name: string, value: string) => void,\n options?: {\n /** @internal */\n _customRenderers?: ComponentRendererMap;\n /** @internal */\n _theme?: any;\n /** Additional data from the flow response */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n inputClassName?: string;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n /** Vendor namespace used to derive affix sentinel keys for prefix/postfix-bearing inputs. */\n vendor?: string;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createAuthComponentFromFlow(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n resetForm,\n onInputChange,\n 'signup',\n {\n ...options,\n key: component.id || index,\n },\n ),\n )\n .filter((x): x is ReactElement => x !== null);\n\n/**\n * Processes an array of components and renders them as React elements for recovery flow.\n */\nexport const renderRecoveryComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n resetForm: () => void,\n onInputChange: (name: string, value: string) => void,\n options?: {\n /** @internal */\n _customRenderers?: ComponentRendererMap;\n /** @internal */\n _theme?: any;\n /** Additional data from the flow response */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n inputClassName?: string;\n /** Flag to determine if the step timeline has expired */\n isTimeoutDisabled?: boolean;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n /** Vendor namespace used to derive affix sentinel keys for prefix/postfix-bearing inputs. */\n vendor?: string;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createAuthComponentFromFlow(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n resetForm,\n onInputChange,\n 'recovery',\n {\n ...options,\n key: component.id || index,\n },\n ),\n )\n .filter((x): x is ReactElement => x !== null);\n\n/**\n * Processes an array of components and renders them as React elements for invite user.\n * This is used by both InviteUser and AcceptInvite components.\n */\nexport const renderInviteUserComponents = (\n components: EmbeddedFlowComponent[],\n formValues: Record<string, string>,\n touchedFields: Record<string, boolean>,\n formErrors: Record<string, string>,\n isLoading: boolean,\n isFormValid: boolean,\n resetForm: () => void,\n onInputChange: (name: string, value: string) => void,\n options?: {\n /** @internal */\n _customRenderers?: ComponentRendererMap;\n /** @internal */\n _theme?: any;\n /** Additional data from the flow response */\n additionalData?: Record<string, any>;\n buttonClassName?: string;\n /** Function to fetch child organization units for OU_SELECT components. */\n fetchOrganizationUnitChildren?: (\n parentId: string,\n limit: number,\n offset: number,\n ) => Promise<OrganizationUnitListResponse>;\n inputClassName?: string;\n /** Flow metadata for resolving {{meta(...)}} expressions at render time */\n meta?: FlowMetadataResponse | null;\n onInputBlur?: (name: string) => void;\n onSubmit?: (component: EmbeddedFlowComponent, data?: Record<string, any>, skipValidation?: boolean) => void;\n size?: 'small' | 'medium' | 'large';\n /** Translation function for resolving {{t(...)}} expressions at render time */\n t?: UseTranslation['t'];\n variant?: any;\n /** Vendor namespace used to derive affix sentinel keys for prefix/postfix-bearing inputs. */\n vendor?: string;\n },\n): ReactElement[] =>\n components\n .map((component: any, index: any) =>\n createAuthComponentFromFlow(\n component,\n formValues,\n touchedFields,\n formErrors,\n isLoading,\n isFormValid,\n resetForm,\n onInputChange,\n 'signup',\n {\n ...options,\n key: component.id || index,\n },\n ),\n )\n .filter((x): x is ReactElement => x !== null);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;AAwDA,MAAMA,WAA0D,6BAC9D,oBACA,oBACD;;;;;;;;;AAiBD,IAAIC;;AAGJ,SAAS,mBAA2B;AAClC,wBAAuB,GAAG;;;;;;;;;;;;;;;;;;;;;;;;;;AA0B1B,QAAO;;AAGT,IAAIC;AAEJ,SAAS,yBAAiC;AACxC,8BAA6B,IAAI;EAAC,QAAQ;EAAU,WAAW;EAAW,OAAO;EAAS,CAAC;AAC3F,QAAO;;;;;;AAST,MAAM,kBAAkB;AAExB,MAAM,gBAAgB,YAAkD;AACtE,SAAQ,SAAR;EACE,KAAK,0BAA0B,WAC7B,QAAO,UAAU;EACnB,KAAK,0BAA0B,WAC7B,QAAO,UAAU;EACnB,KAAK,0BAA0B,cAC7B,QAAO,UAAU;EACnB,KAAK,0BAA0B;EAC/B,QACE,QAAO,UAAU;;;;;;AAOvB,MAAM,wBAAwB,YAAyB;AAiBrD,QAhBuE;EACrE,QAAQ;EACR,QAAQ;EACR,aAAa;EACb,SAAS;EACT,WAAW;EACX,WAAW;EACX,WAAW;EACX,WAAW;EACX,WAAW;EACX,WAAW;EACX,UAAU;EACV,YAAY;EACZ,YAAY;EACb,CAEiB,YAAY;;;;;AAMhC,MAAM,yBACJ,UACA,WACA,YACA,UACA,UAEA,sBACY;CACZ,MAAMC,aAAkB,GAAG,SAAS;CACpC,MAAMC,kBAAuB,aAAa,cAAc,cAAc;AAItE,KAAI,WAAW,aAAa,CAAC,SAAS,SAAS,CAC7C,QAAO;AAIT,KAAI,aAAa,SACf,QAAO,mBAAmB,WAAW,aAAa,CAAC,SAAS,SAAS;AAGvE,QA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KAAK,IAAI,IAAK,CAAC,GAAG;IAErC;MAAzC,IAAyD;;EAGlF,KAAK,0BAA0B,cAAc;GAC3C,MAAMC,YAAiC,UAAkB;GACzD,MAAMxE,QAAgB,aAAa,QAAQ,iBAAiB,OAAO,QAAQ,eAAe,cAAc,GAAG,GAAG;AAG9G,UAAO,oBAACyE;IAAuB,OAFO,QAAS,UAAkB,MAAM,IAAI;IAEnB;MAA9B,IAAuC;;EAGnE;AAEE,YAAO,KAAK,+BAA+B,UAAU,KAAK,oBAAoB;AAC9E,UAAO;;;;;;AAOb,MAAa,0BACX,YACA,YACA,eACA,YACA,WACA,aACA,WACA,eACA,YAuBA,WACG,KAAK,WAAgB,UACpB,4BACE,WACA,YACA,eACA,YACA,WACA,aACA,WACA,eACA,UACA;CACE,GAAG;CACH,KAAK,UAAU,MAAM;CACtB,CACF,CACF,CACA,QAAQ,MAAyB,MAAM,KAAK;;;;AAKjD,MAAa,0BACX,YACA,YACA,eACA,YACA,WACA,aACA,WACA,eACA,YAqBA,WACG,KAAK,WAAgB,UACpB,4BACE,WACA,YACA,eACA,YACA,WACA,aACA,WACA,eACA,UACA;CACE,GAAG;CACH,KAAK,UAAU,MAAM;CACtB,CACF,CACF,CACA,QAAQ,MAAyB,MAAM,KAAK;;;;AAKjD,MAAa,4BACX,YACA,YACA,eACA,YACA,WACA,aACA,WACA,eACA,YAuBA,WACG,KAAK,WAAgB,UACpB,4BACE,WACA,YACA,eACA,YACA,WACA,aACA,WACA,eACA,YACA;CACE,GAAG;CACH,KAAK,UAAU,MAAM;CACtB,CACF,CACF,CACA,QAAQ,MAAyB,MAAM,KAAK;;;;;AAMjD,MAAa,8BACX,YACA,YACA,eACA,YACA,WACA,aACA,WACA,eACA,YA2BA,WACG,KAAK,WAAgB,UACpB,4BACE,WACA,YACA,eACA,YACA,WACA,aACA,WACA,eACA,UACA;CACE,GAAG;CACH,KAAK,UAAU,MAAM;CACtB,CACF,CACF,CACA,QAAQ,MAAyB,MAAM,KAAK"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K,IAAI,CAAC;IAE5D;;;OAGG;IACH,OAAO,CAAC,EAAE,CAAC,KAAK,EAAE,KAAK,KAAK,IAAI,CAAC;IAEjC;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,QAAQ,EAAE,0BAA0B,KAAK,IAAI,CAAC;IAE9D;;;OAGG;IACH,YAAY,CAAC,EAAE,CAAC,OAAO,CAAC,EAAE,yBAAyB,KAAK,OAAO,CAAC,0BAA0B,CAAC,CAAC;IAE5F;;;;OAIG;IACH,QAAQ,CAAC,EAAE,CAAC,OAAO,EAAE,yBAAyB,KAAK,OAAO,CAAC,0BAA0B,CAAC,CAAC;IACvF;;;;OAIG;IACH,WAAW,CAAC,EAAE,WAAW,CAAC;IAE1B;;;;;OAKG;IACH,2BAA2B,CAAC,EAAE,OAAO,CAAC;IAEtC;;OAEG;IACH,yBAAyB,CAAC,EAAE,OAAO,CAAC;IAEpC;;OAEG;IACH,QAAQ,CAAC,EAAE,OAAO,CAAC;IAEnB;;OAEG;IACH,YAAY,CAAC,EAAE,OAAO,CAAC;IAEvB;;OAEG;IACH,SAAS,CAAC,EAAE,OAAO,CAAC;IAEpB;;OAEG;IACH,IAAI,CAAC,EAAE,OAAO,GAAG,QAAQ,GAAG,OAAO,CAAC;IAEpC;;OAEG;IACH,OAAO,CAAC,EAAE,SAAS,CAAC,SAAS,CAAC,CAAC;CAChC;AA+7BD;;;;GAIG;AACH,QAAA,MAAM,UAAU,EAAE,EAAE,CAAC,eAAe,CAoBnC,CAAC;AAEF,eAAe,UAAU,CAAC"}
@@ -49,6 +49,7 @@ const BaseSignUpContent = ({ afterSignUpUrl, onInitialize, onSubmit, onError, on
49
49
  const challengeTokenRef = useRef(null);
50
50
  const initializationAttemptedRef = useRef(false);
51
51
  const passkeyProcessedRef = useRef(false);
52
+ const isFlowCompletedRef = useRef(false);
52
53
  /**
53
54
  * Restore any challenge token persisted before an OAuth redirect.
54
55
  */
@@ -210,6 +211,7 @@ const BaseSignUpContent = ({ afterSignUpUrl, onInitialize, onSubmit, onError, on
210
211
  setupFormFields(normalized);
211
212
  return;
212
213
  }
214
+ isFlowCompletedRef.current = true;
213
215
  onComplete?.(response);
214
216
  };
215
217
  /**
@@ -369,7 +371,7 @@ const BaseSignUpContent = ({ afterSignUpUrl, onInitialize, onSubmit, onError, on
369
371
  * Handle component submission (for buttons outside forms).
370
372
  */
371
373
  const handleSubmit = async (component, data, skipValidation) => {
372
- if (!currentFlow) return;
374
+ if (!currentFlow || isFlowCompletedRef.current) return;
373
375
  if (!skipValidation) {
374
376
  touchAllFields();
375
377
  if (!validateForm().isValid) return;