@thunderid/react 0.3.6 → 0.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/ThunderIDReactClient.d.ts.map +1 -1
  2. package/dist/ThunderIDReactClient.js +1 -5
  3. package/dist/ThunderIDReactClient.js.map +1 -1
  4. package/dist/cjs/ThunderIDReactClient.cjs +1 -5
  5. package/dist/cjs/ThunderIDReactClient.cjs.map +1 -1
  6. package/dist/cjs/components/factories/FieldFactory.cjs +2 -1
  7. package/dist/cjs/components/factories/FieldFactory.cjs.map +1 -1
  8. package/dist/cjs/components/presentation/auth/AcceptInvite/BaseAcceptInvite.cjs +1 -1
  9. package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs +56 -33
  10. package/dist/cjs/components/presentation/auth/AuthOptionFactory.cjs.map +1 -1
  11. package/dist/cjs/components/presentation/auth/InviteUser/BaseInviteUser.cjs +1 -1
  12. package/dist/cjs/components/presentation/auth/Recovery/BaseRecovery.cjs +1 -1
  13. package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs +8 -32
  14. package/dist/cjs/components/presentation/auth/SignIn/BaseSignIn.cjs.map +1 -1
  15. package/dist/cjs/components/presentation/auth/SignIn/SignIn.cjs +37 -27
  16. package/dist/cjs/components/presentation/auth/SignIn/SignIn.cjs.map +1 -1
  17. package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs +7 -3
  18. package/dist/cjs/components/presentation/auth/SignUp/BaseSignUp.cjs.map +1 -1
  19. package/dist/cjs/components/primitives/FormControl/FormControl.cjs +2 -1
  20. package/dist/cjs/components/primitives/FormControl/FormControl.cjs.map +1 -1
  21. package/dist/cjs/components/primitives/Typography/Typography.cjs.map +1 -1
  22. package/dist/cjs/contexts/FlowMeta/FlowMetaProvider.cjs +11 -3
  23. package/dist/cjs/contexts/FlowMeta/FlowMetaProvider.cjs.map +1 -1
  24. package/dist/cjs/index.cjs +3 -0
  25. package/dist/components/factories/FieldFactory.d.ts +4 -0
  26. package/dist/components/factories/FieldFactory.d.ts.map +1 -1
  27. package/dist/components/factories/FieldFactory.js +2 -1
  28. package/dist/components/factories/FieldFactory.js.map +1 -1
  29. package/dist/components/presentation/auth/AcceptInvite/BaseAcceptInvite.js +1 -1
  30. package/dist/components/presentation/auth/AuthOptionFactory.d.ts.map +1 -1
  31. package/dist/components/presentation/auth/AuthOptionFactory.js +57 -34
  32. package/dist/components/presentation/auth/AuthOptionFactory.js.map +1 -1
  33. package/dist/components/presentation/auth/InviteUser/BaseInviteUser.js +1 -1
  34. package/dist/components/presentation/auth/Recovery/BaseRecovery.js +1 -1
  35. package/dist/components/presentation/auth/SignIn/BaseSignIn.d.ts +5 -6
  36. package/dist/components/presentation/auth/SignIn/BaseSignIn.d.ts.map +1 -1
  37. package/dist/components/presentation/auth/SignIn/BaseSignIn.js +10 -34
  38. package/dist/components/presentation/auth/SignIn/BaseSignIn.js.map +1 -1
  39. package/dist/components/presentation/auth/SignIn/SignIn.d.ts.map +1 -1
  40. package/dist/components/presentation/auth/SignIn/SignIn.js +37 -27
  41. package/dist/components/presentation/auth/SignIn/SignIn.js.map +1 -1
  42. package/dist/components/presentation/auth/SignUp/BaseSignUp.d.ts +4 -0
  43. package/dist/components/presentation/auth/SignUp/BaseSignUp.d.ts.map +1 -1
  44. package/dist/components/presentation/auth/SignUp/BaseSignUp.js +8 -4
  45. package/dist/components/presentation/auth/SignUp/BaseSignUp.js.map +1 -1
  46. package/dist/components/primitives/FormControl/FormControl.d.ts +4 -0
  47. package/dist/components/primitives/FormControl/FormControl.d.ts.map +1 -1
  48. package/dist/components/primitives/FormControl/FormControl.js +2 -1
  49. package/dist/components/primitives/FormControl/FormControl.js.map +1 -1
  50. package/dist/components/primitives/Typography/Typography.d.ts +4 -0
  51. package/dist/components/primitives/Typography/Typography.d.ts.map +1 -1
  52. package/dist/components/primitives/Typography/Typography.js.map +1 -1
  53. package/dist/contexts/FlowMeta/FlowMetaProvider.d.ts +8 -0
  54. package/dist/contexts/FlowMeta/FlowMetaProvider.d.ts.map +1 -1
  55. package/dist/contexts/FlowMeta/FlowMetaProvider.js +11 -3
  56. package/dist/contexts/FlowMeta/FlowMetaProvider.js.map +1 -1
  57. package/dist/index.d.ts +1 -0
  58. package/dist/index.d.ts.map +1 -1
  59. package/dist/index.js +2 -1
  60. package/package.json +2 -2
@@ -1 +1 @@
1
- {"version":3,"file":"Typography.cjs","names":["variantMapping: Record<TypographyVariant, ElementType>","Typography: FC<TypographyProps>","useTheme","styles: Record<string, string>","useStyles","Component: ElementType"],"sources":["../../../../../src/components/primitives/Typography/Typography.tsx"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {CSSProperties, FC, ReactNode, ElementType} from 'react';\nimport useStyles, {TypographyVariant, TypographyAlign, TypographyColor} from './Typography.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\n\nexport interface TypographyProps {\n /**\n * Text alignment\n */\n align?: TypographyAlign;\n /**\n * The content to be rendered\n */\n children: ReactNode;\n /**\n * Additional CSS class names\n */\n className?: string;\n /**\n * Color variant\n */\n color?: TypographyColor;\n /**\n * The HTML element or React component to render\n */\n component?: ElementType;\n /**\n * Custom font size (overrides variant sizing)\n */\n fontSize?: string | number;\n /**\n * Custom font weight\n */\n fontWeight?: 'normal' | 'medium' | 'semibold' | 'bold' | number;\n /**\n * Whether to disable gutters (margin bottom)\n */\n gutterBottom?: boolean;\n /**\n * Whether the text should be displayed inline\n */\n inline?: boolean;\n /**\n * Line height\n */\n lineHeight?: string | number;\n /**\n * Whether the text should be clipped with ellipsis when it overflows\n */\n noWrap?: boolean;\n /**\n * Custom styles\n */\n style?: CSSProperties;\n /**\n * The typography variant to apply\n */\n variant?: TypographyVariant;\n}\n\n// Default component mapping for variants\nconst variantMapping: Record<TypographyVariant, ElementType> = {\n body1: 'p',\n body2: 'p',\n button: 'span',\n caption: 'span',\n h1: 'h1',\n h2: 'h2',\n h3: 'h3',\n h4: 'h4',\n h5: 'h5',\n h6: 'h6',\n overline: 'span',\n subtitle1: 'h6',\n subtitle2: 'h6',\n};\n\n/**\n * Typography component for consistent text rendering throughout the application.\n * Integrates with the theme system and provides semantic HTML elements.\n */\nconst Typography: FC<TypographyProps> = ({\n children,\n variant = 'body1',\n component,\n align = 'left',\n color = 'textPrimary',\n noWrap = false,\n className,\n style = {},\n inline = false,\n fontWeight,\n fontSize,\n lineHeight,\n gutterBottom = false,\n ...rest\n}: TypographyProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(\n theme,\n colorScheme,\n variant,\n align,\n color,\n noWrap,\n inline,\n gutterBottom,\n fontWeight,\n fontSize,\n lineHeight,\n );\n\n const Component: ElementType = component || variantMapping[variant] || 'span';\n\n const getVariantClass = (variantName: TypographyVariant): string => {\n switch (variantName) {\n case 'h1':\n return styles['typographyH1'];\n case 'h2':\n return styles['typographyH2'];\n case 'h3':\n return styles['typographyH3'];\n case 'h4':\n return styles['typographyH4'];\n case 'h5':\n return styles['typographyH5'];\n case 'h6':\n return styles['typographyH6'];\n case 'subtitle1':\n return styles['typographySubtitle1'];\n case 'subtitle2':\n return styles['typographySubtitle2'];\n case 'body1':\n return styles['typographyBody1'];\n case 'body2':\n return styles['typographyBody2'];\n case 'caption':\n return styles['typographyCaption'];\n case 'overline':\n return styles['typographyOverline'];\n case 'button':\n return styles['typographyButton'];\n default:\n return '';\n }\n };\n\n const typographyClassName: string = cx(\n withVendorCSSClassPrefix(bem('typography')),\n withVendorCSSClassPrefix(bem('typography', variant)),\n styles['typography'],\n getVariantClass(variant),\n noWrap && styles['typographyNoWrap'],\n inline && styles['typographyInline'],\n gutterBottom && styles['typographyGutterBottom'],\n className,\n );\n\n return (\n <Component className={typographyClassName} style={style} {...rest}>\n {children}\n </Component>\n );\n};\n\nexport default Typography;\n"],"mappings":";;;;;;;;;;;AAgFA,MAAMA,iBAAyD;CAC7D,OAAO;CACP,OAAO;CACP,QAAQ;CACR,SAAS;CACT,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,UAAU;CACV,WAAW;CACX,WAAW;CACZ;;;;;AAMD,MAAMC,cAAmC,EACvC,UACA,UAAU,SACV,WACA,QAAQ,QACR,QAAQ,eACR,SAAS,OACT,WACA,QAAQ,EAAE,EACV,SAAS,OACT,YACA,UACA,YACA,eAAe,MACf,GAAG,WACkB;CACrB,MAAM,EAAC,OAAO,gBAA4CC,0BAAU;CACpE,MAAMC,SAAiCC,kCACrC,OACA,aACA,SACA,OACA,OACA,QACA,QACA,cACA,YACA,UACA,WACD;CAED,MAAMC,YAAyB,aAAa,eAAe,YAAY;CAEvE,MAAM,mBAAmB,gBAA2C;AAClE,UAAQ,aAAR;GACE,KAAK,KACH,QAAO,OAAO;GAChB,KAAK,KACH,QAAO,OAAO;GAChB,KAAK,KACH,QAAO,OAAO;GAChB,KAAK,KACH,QAAO,OAAO;GAChB,KAAK,KACH,QAAO,OAAO;GAChB,KAAK,KACH,QAAO,OAAO;GAChB,KAAK,YACH,QAAO,OAAO;GAChB,KAAK,YACH,QAAO,OAAO;GAChB,KAAK,QACH,QAAO,OAAO;GAChB,KAAK,QACH,QAAO,OAAO;GAChB,KAAK,UACH,QAAO,OAAO;GAChB,KAAK,WACH,QAAO,OAAO;GAChB,KAAK,SACH,QAAO,OAAO;GAChB,QACE,QAAO;;;AAeb,QACE,2CAAC;EAAU,gHAXkB,aAAa,CAAC,iFACd,cAAc,QAAQ,CAAC,EACpD,OAAO,eACP,gBAAgB,QAAQ,EACxB,UAAU,OAAO,qBACjB,UAAU,OAAO,qBACjB,gBAAgB,OAAO,2BACvB,UACD;EAGmD;EAAO,GAAI;EAC1D;GACS;;AAIhB,yBAAe"}
1
+ {"version":3,"file":"Typography.cjs","names":["variantMapping: Record<TypographyVariant, ElementType>","Typography: FC<TypographyProps>","useTheme","styles: Record<string, string>","useStyles","Component: ElementType"],"sources":["../../../../../src/components/primitives/Typography/Typography.tsx"],"sourcesContent":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {cx} from '@emotion/css';\nimport {withVendorCSSClassPrefix, bem} from '@thunderid/browser';\nimport {CSSProperties, FC, ReactNode, ElementType} from 'react';\nimport useStyles, {TypographyVariant, TypographyAlign, TypographyColor} from './Typography.styles';\nimport useTheme from '../../../contexts/Theme/useTheme';\n\nexport interface TypographyProps {\n /**\n * Text alignment\n */\n align?: TypographyAlign;\n /**\n * The content to be rendered\n */\n children: ReactNode;\n /**\n * Additional CSS class names\n */\n className?: string;\n /**\n * Color variant\n */\n color?: TypographyColor;\n /**\n * The HTML element or React component to render\n */\n component?: ElementType;\n /**\n * Custom font size (overrides variant sizing)\n */\n fontSize?: string | number;\n /**\n * Custom font weight\n */\n fontWeight?: 'normal' | 'medium' | 'semibold' | 'bold' | number;\n /**\n * Whether to disable gutters (margin bottom)\n */\n gutterBottom?: boolean;\n /**\n * HTML id attribute\n */\n id?: string;\n /**\n * Whether the text should be displayed inline\n */\n inline?: boolean;\n /**\n * Line height\n */\n lineHeight?: string | number;\n /**\n * Whether the text should be clipped with ellipsis when it overflows\n */\n noWrap?: boolean;\n /**\n * Custom styles\n */\n style?: CSSProperties;\n /**\n * The typography variant to apply\n */\n variant?: TypographyVariant;\n}\n\n// Default component mapping for variants\nconst variantMapping: Record<TypographyVariant, ElementType> = {\n body1: 'p',\n body2: 'p',\n button: 'span',\n caption: 'span',\n h1: 'h1',\n h2: 'h2',\n h3: 'h3',\n h4: 'h4',\n h5: 'h5',\n h6: 'h6',\n overline: 'span',\n subtitle1: 'h6',\n subtitle2: 'h6',\n};\n\n/**\n * Typography component for consistent text rendering throughout the application.\n * Integrates with the theme system and provides semantic HTML elements.\n */\nconst Typography: FC<TypographyProps> = ({\n children,\n variant = 'body1',\n component,\n align = 'left',\n color = 'textPrimary',\n noWrap = false,\n className,\n style = {},\n inline = false,\n fontWeight,\n fontSize,\n lineHeight,\n gutterBottom = false,\n ...rest\n}: TypographyProps) => {\n const {theme, colorScheme}: ReturnType<typeof useTheme> = useTheme();\n const styles: Record<string, string> = useStyles(\n theme,\n colorScheme,\n variant,\n align,\n color,\n noWrap,\n inline,\n gutterBottom,\n fontWeight,\n fontSize,\n lineHeight,\n );\n\n const Component: ElementType = component || variantMapping[variant] || 'span';\n\n const getVariantClass = (variantName: TypographyVariant): string => {\n switch (variantName) {\n case 'h1':\n return styles['typographyH1'];\n case 'h2':\n return styles['typographyH2'];\n case 'h3':\n return styles['typographyH3'];\n case 'h4':\n return styles['typographyH4'];\n case 'h5':\n return styles['typographyH5'];\n case 'h6':\n return styles['typographyH6'];\n case 'subtitle1':\n return styles['typographySubtitle1'];\n case 'subtitle2':\n return styles['typographySubtitle2'];\n case 'body1':\n return styles['typographyBody1'];\n case 'body2':\n return styles['typographyBody2'];\n case 'caption':\n return styles['typographyCaption'];\n case 'overline':\n return styles['typographyOverline'];\n case 'button':\n return styles['typographyButton'];\n default:\n return '';\n }\n };\n\n const typographyClassName: string = cx(\n withVendorCSSClassPrefix(bem('typography')),\n withVendorCSSClassPrefix(bem('typography', variant)),\n styles['typography'],\n getVariantClass(variant),\n noWrap && styles['typographyNoWrap'],\n inline && styles['typographyInline'],\n gutterBottom && styles['typographyGutterBottom'],\n className,\n );\n\n return (\n <Component className={typographyClassName} style={style} {...rest}>\n {children}\n </Component>\n );\n};\n\nexport default Typography;\n"],"mappings":";;;;;;;;;;;AAoFA,MAAMA,iBAAyD;CAC7D,OAAO;CACP,OAAO;CACP,QAAQ;CACR,SAAS;CACT,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,IAAI;CACJ,UAAU;CACV,WAAW;CACX,WAAW;CACZ;;;;;AAMD,MAAMC,cAAmC,EACvC,UACA,UAAU,SACV,WACA,QAAQ,QACR,QAAQ,eACR,SAAS,OACT,WACA,QAAQ,EAAE,EACV,SAAS,OACT,YACA,UACA,YACA,eAAe,MACf,GAAG,WACkB;CACrB,MAAM,EAAC,OAAO,gBAA4CC,0BAAU;CACpE,MAAMC,SAAiCC,kCACrC,OACA,aACA,SACA,OACA,OACA,QACA,QACA,cACA,YACA,UACA,WACD;CAED,MAAMC,YAAyB,aAAa,eAAe,YAAY;CAEvE,MAAM,mBAAmB,gBAA2C;AAClE,UAAQ,aAAR;GACE,KAAK,KACH,QAAO,OAAO;GAChB,KAAK,KACH,QAAO,OAAO;GAChB,KAAK,KACH,QAAO,OAAO;GAChB,KAAK,KACH,QAAO,OAAO;GAChB,KAAK,KACH,QAAO,OAAO;GAChB,KAAK,KACH,QAAO,OAAO;GAChB,KAAK,YACH,QAAO,OAAO;GAChB,KAAK,YACH,QAAO,OAAO;GAChB,KAAK,QACH,QAAO,OAAO;GAChB,KAAK,QACH,QAAO,OAAO;GAChB,KAAK,UACH,QAAO,OAAO;GAChB,KAAK,WACH,QAAO,OAAO;GAChB,KAAK,SACH,QAAO,OAAO;GAChB,QACE,QAAO;;;AAeb,QACE,2CAAC;EAAU,gHAXkB,aAAa,CAAC,iFACd,cAAc,QAAQ,CAAC,EACpD,OAAO,eACP,gBAAgB,QAAQ,EACxB,UAAU,OAAO,qBACjB,UAAU,OAAO,qBACjB,gBAAgB,OAAO,2BACvB,UACD;EAGmD;EAAO,GAAI;EAC1D;GACS;;AAIhB,yBAAe"}
@@ -33,14 +33,15 @@ react_jsx_runtime = require_rolldown_runtime.__toESM(react_jsx_runtime);
33
33
  * </FlowMetaProvider>
34
34
  * ```
35
35
  */
36
- const FlowMetaProvider = ({ children, enabled = true }) => {
36
+ const FlowMetaProvider = ({ children, enabled = true, initialMeta = null }) => {
37
37
  const { baseUrl, applicationId, isInitialized } = require_useThunderID.default();
38
38
  const i18nContext = require_useI18n.default();
39
- const [meta, setMeta] = (0, react.useState)(null);
40
- const [isLoading, setIsLoading] = (0, react.useState)(true);
39
+ const [meta, setMeta] = (0, react.useState)(initialMeta);
40
+ const [isLoading, setIsLoading] = (0, react.useState)(!initialMeta);
41
41
  const [error, setError] = (0, react.useState)(null);
42
42
  const [pendingLanguage, setPendingLanguage] = (0, react.useState)(null);
43
43
  const lastFetchedRef = (0, react.useRef)(null);
44
+ const initialMetaConsumedRef = (0, react.useRef)(false);
44
45
  const fetchFlowMeta = (0, react.useCallback)(async () => {
45
46
  if (!enabled) {
46
47
  setMeta(null);
@@ -114,6 +115,13 @@ const FlowMetaProvider = ({ children, enabled = true }) => {
114
115
  }
115
116
  }, [pendingLanguage, i18nContext?.setLanguage]);
116
117
  (0, react.useEffect)(() => {
118
+ if (!initialMetaConsumedRef.current) {
119
+ initialMetaConsumedRef.current = true;
120
+ if (initialMeta) {
121
+ lastFetchedRef.current = fetchFlowMeta;
122
+ return;
123
+ }
124
+ }
117
125
  if (lastFetchedRef.current === fetchFlowMeta) return;
118
126
  lastFetchedRef.current = fetchFlowMeta;
119
127
  fetchFlowMeta();
@@ -1 +1 @@
1
- {"version":3,"file":"FlowMetaProvider.cjs","names":["FlowMetaProvider: FC<PropsWithChildren<FlowMetaProviderProps>>","useThunderID","i18nContext: I18nContextValue","useI18n","lastFetchedRef: RefObject<(() => Promise<void>) | null>","fetchFlowMeta: () => Promise<void>","FlowMetaType","err: unknown","switchLanguage: (language: string) => Promise<void>","result: FlowMetadataResponse","flatTranslations: Record<string, string>","value","bundle: I18nBundle","metaLanguage: string","TranslationBundleConstants","bundlesToInject: Record<string, I18nBundle>","value: any","FlowMetaContext"],"sources":["../../../../src/contexts/FlowMeta/FlowMetaProvider.tsx"],"sourcesContent":["/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n FlowMetadataResponse,\n FlowMetaType,\n getFlowMeta,\n I18nBundle,\n TranslationBundleConstants,\n} from '@thunderid/browser';\nimport {FC, PropsWithChildren, ReactElement, RefObject, useCallback, useEffect, useRef, useState} from 'react';\nimport FlowMetaContext from './FlowMetaContext';\nimport {I18nContextValue} from '../I18n/I18nContext';\nimport useI18n from '../I18n/useI18n';\nimport useThunderID from '../ThunderID/useThunderID';\n\nexport interface FlowMetaProviderProps {\n /**\n * When false the provider skips fetching and provides null meta.\n * @default true\n */\n enabled?: boolean;\n}\n\n/**\n * FlowMetaProvider fetches flow metadata from the `GET /flow/meta` endpoint\n * (v2 API) and makes it available to child components through `FlowMetaContext`.\n *\n * It is designed to be used in v2 embedded-flow scenarios and integrates with\n * `ThemeProvider` so that theme settings (colors, direction, typography, …)\n * from the server-side design configuration are applied automatically.\n *\n * @example\n * ```tsx\n * <FlowMetaProvider\n * config={{\n * baseUrl: 'https://localhost:8090',\n * type: FlowMetaType.App,\n * id: 'your-app-id',\n * }}\n * >\n * <ThemeProvider>\n * <App />\n * </ThemeProvider>\n * </FlowMetaProvider>\n * ```\n */\nconst FlowMetaProvider: FC<PropsWithChildren<FlowMetaProviderProps>> = ({\n children,\n enabled = true,\n}: PropsWithChildren<FlowMetaProviderProps>): ReactElement => {\n const {baseUrl, applicationId, isInitialized} = useThunderID();\n const i18nContext: I18nContextValue = useI18n();\n\n const [meta, setMeta] = useState<FlowMetadataResponse | null>(null);\n const [isLoading, setIsLoading] = useState<boolean>(true);\n const [error, setError] = useState<Error | null>(null);\n const [pendingLanguage, setPendingLanguage] = useState<string | null>(null);\n\n // Track the last fetchFlowMeta reference that was actually dispatched.\n // This prevents two classes of double-fetch:\n // 1. React StrictMode simulates unmount+remount — the re-mount fires the\n // effect again with the same fetchFlowMeta reference; without this guard\n // the else-branch would issue a redundant second network request.\n // 2. Rapid dependency changes (e.g. baseUrl stabilising) that produce two\n // effect firings before the first fetch completes.\n const lastFetchedRef: RefObject<(() => Promise<void>) | null> = useRef<(() => Promise<void>) | null>(null);\n const fetchFlowMeta: () => Promise<void> = useCallback(async (): Promise<void> => {\n if (!enabled) {\n setMeta(null);\n setIsLoading(false);\n return;\n }\n\n // Defer until ThunderID finishes initializing (e.g. loading applicationId\n // from storage on refresh). Once initialized, proceed even if applicationId\n // is absent — some flows (e.g. AcceptInvite) have no applicationId by design.\n if (!isInitialized && !applicationId) {\n return;\n }\n\n setIsLoading(true);\n setError(null);\n\n try {\n const result: FlowMetadataResponse = await getFlowMeta({\n baseUrl,\n ...(applicationId ? {id: applicationId, type: FlowMetaType.App} : {}),\n language: i18nContext?.currentLanguage,\n });\n setMeta(result);\n } catch (err: unknown) {\n setError(err instanceof Error ? err : new Error(String(err)));\n } finally {\n setIsLoading(false);\n }\n }, [enabled, baseUrl, applicationId, isInitialized, i18nContext?.currentLanguage]);\n\n const switchLanguage: (language: string) => Promise<void> = useCallback(\n async (language: string): Promise<void> => {\n if (!enabled) return;\n\n setIsLoading(true);\n setError(null);\n\n try {\n const result: FlowMetadataResponse = await getFlowMeta({\n baseUrl,\n ...(applicationId ? {id: applicationId, type: FlowMetaType.App} : {}),\n language,\n });\n\n // Inject translations for the new language before switching\n if (result.i18n?.translations && i18nContext?.injectBundles) {\n const flatTranslations: Record<string, string> = {};\n Object.entries(result.i18n.translations).forEach(([namespace, keys]: [string, Record<string, string>]) => {\n Object.entries(keys).forEach(([key, value]: [string, string]) => {\n flatTranslations[`${namespace}.${key}`] = value;\n });\n });\n const bundle: I18nBundle = {translations: flatTranslations} as unknown as I18nBundle;\n i18nContext.injectBundles({[language]: bundle});\n }\n\n // Defer setLanguage to the next effect cycle so injectBundles state\n // is committed before I18nProvider's setLanguage checks mergedBundles.\n setPendingLanguage(language);\n setMeta(result);\n } catch (err: unknown) {\n setError(err instanceof Error ? err : new Error(String(err)));\n } finally {\n setIsLoading(false);\n }\n },\n [enabled, baseUrl, applicationId, i18nContext],\n );\n\n // After injectBundles + setPendingLanguage are batched and committed, this\n // effect fires with the updated i18nContext (mergedBundles now includes the\n // new language), so setLanguage succeeds on the first switch.\n useEffect(() => {\n if (pendingLanguage && i18nContext?.setLanguage) {\n i18nContext.setLanguage(pendingLanguage);\n setPendingLanguage(null);\n }\n }, [pendingLanguage, i18nContext?.setLanguage]);\n\n useEffect(() => {\n if (lastFetchedRef.current === fetchFlowMeta) {\n // Same reference as the last dispatch — this is a StrictMode re-mount\n // or an effect re-fire with unchanged deps. Skip to avoid a duplicate fetch.\n return;\n }\n\n lastFetchedRef.current = fetchFlowMeta;\n fetchFlowMeta();\n }, [fetchFlowMeta]);\n\n // When meta loads with i18n translations, inject them into the i18n system.\n // Meta translations act as the base layer — prop-provided bundles still take precedence.\n useEffect(() => {\n if (!meta?.i18n?.translations || !i18nContext?.injectBundles) {\n return;\n }\n\n const metaLanguage: string = meta.i18n.language || TranslationBundleConstants.FALLBACK_LOCALE;\n\n // Flatten namespace-keyed translations to dot-path keys:\n // { \"signin\": { \"heading\": \"Sign In\" } } → { \"signin.heading\": \"Sign In\" }\n const flatTranslations: Record<string, string> = {};\n Object.entries(meta.i18n.translations).forEach(([namespace, keys]: [string, Record<string, string>]) => {\n Object.entries(keys).forEach(([key, value]: [string, string]) => {\n flatTranslations[`${namespace}.${key}`] = value;\n });\n });\n\n const bundle: I18nBundle = {translations: flatTranslations} as unknown as I18nBundle;\n\n // Inject under the meta language code and the i18n current language so\n // lookups succeed regardless of whether the system uses \"en\" or \"en-US\".\n const bundlesToInject: Record<string, I18nBundle> = {[metaLanguage]: bundle};\n if (i18nContext.currentLanguage && i18nContext.currentLanguage !== metaLanguage) {\n bundlesToInject[i18nContext.currentLanguage] = bundle;\n }\n if (i18nContext.fallbackLanguage && i18nContext.fallbackLanguage !== metaLanguage) {\n bundlesToInject[i18nContext.fallbackLanguage] = bundle;\n }\n\n i18nContext.injectBundles(bundlesToInject);\n }, [meta?.i18n?.translations, i18nContext?.injectBundles]);\n\n const value: any = {\n error,\n fetchFlowMeta,\n isLoading,\n meta,\n switchLanguage,\n };\n\n return <FlowMetaContext.Provider value={value}>{children}</FlowMetaContext.Provider>;\n};\n\nexport default FlowMetaProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA8DA,MAAMA,oBAAkE,EACtE,UACA,UAAU,WACkD;CAC5D,MAAM,EAAC,SAAS,eAAe,kBAAiBC,8BAAc;CAC9D,MAAMC,cAAgCC,yBAAS;CAE/C,MAAM,CAAC,MAAM,+BAAiD,KAAK;CACnE,MAAM,CAAC,WAAW,oCAAkC,KAAK;CACzD,MAAM,CAAC,OAAO,gCAAmC,KAAK;CACtD,MAAM,CAAC,iBAAiB,0CAA8C,KAAK;CAS3E,MAAMC,mCAA+F,KAAK;CAC1G,MAAMC,uCAAiD,YAA2B;AAChF,MAAI,CAAC,SAAS;AACZ,WAAQ,KAAK;AACb,gBAAa,MAAM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AK;;IAEzB,CAAC,iBAAiB,aAAa,YAAY,CAAC;AAE/C,4BAAgB;AACd,MAAI,eAAe,YAAY,cAG7B;AAGF,iBAAe,UAAU;AACzB,iBAAe;IACd,CAAC,cAAc,CAAC;AAInB,4BAAgB;AACd,MAAI,CAAC,MAAM,MAAM,gBAAgB,CAAC,aAAa,cAC7C;EAGF,MAAMM,eAAuB,KAAK,KAAK,YAAYC,+CAA2B;EAI9E,MAAMJ,mBAA2C,EAAE;AACnD,SAAO,QAAQ,KAAK,KAAK,aAAa,CAAC,SAAS,CAAC,WAAW,UAA4C;AACtG,UAAO,QAAQ,KAAK,CAAC,SAAS,CAAC,KAAKC,aAA6B;AAC/D,qBAAiB,GAAG,UAAU,GAAG,SAASA;KAC1C;IACF;EAEF,MAAMC,SAAqB,EAAC,cAAc,kBAAiB;EAI3D,MAAMG,kBAA8C,GAAE,eAAe,QAAO;AAC5E,MAAI,YAAY,mBAAmB,YAAY,oBAAoB,aACjE,iBAAgB,YAAY,mBAAmB;AAEjD,MAAI,YAAY,oBAAoB,YAAY,qBAAqB,aACnE,iBAAgB,YAAY,oBAAoB;AAGlD,cAAY,cAAc,gBAAgB;IACzC,CAAC,MAAM,MAAM,cAAc,aAAa,cAAc,CAAC;CAE1D,MAAMC,QAAa;EACjB;EACA;EACA;EACA;EACA;EACD;AAED,QAAO,2CAACC,gCAAgB;EAAgB;EAAQ;GAAoC;;AAGtF,+BAAe"}
1
+ {"version":3,"file":"FlowMetaProvider.cjs","names":["FlowMetaProvider: FC<PropsWithChildren<FlowMetaProviderProps>>","useThunderID","i18nContext: I18nContextValue","useI18n","lastFetchedRef: RefObject<(() => Promise<void>) | null>","initialMetaConsumedRef: RefObject<boolean>","fetchFlowMeta: () => Promise<void>","FlowMetaType","err: unknown","switchLanguage: (language: string) => Promise<void>","result: FlowMetadataResponse","flatTranslations: Record<string, string>","value","bundle: I18nBundle","metaLanguage: string","TranslationBundleConstants","bundlesToInject: Record<string, I18nBundle>","value: any","FlowMetaContext"],"sources":["../../../../src/contexts/FlowMeta/FlowMetaProvider.tsx"],"sourcesContent":["/**\n * Copyright (c) 2026, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {\n FlowMetadataResponse,\n FlowMetaType,\n getFlowMeta,\n I18nBundle,\n TranslationBundleConstants,\n} from '@thunderid/browser';\nimport {FC, PropsWithChildren, ReactElement, RefObject, useCallback, useEffect, useRef, useState} from 'react';\nimport FlowMetaContext from './FlowMetaContext';\nimport {I18nContextValue} from '../I18n/I18nContext';\nimport useI18n from '../I18n/useI18n';\nimport useThunderID from '../ThunderID/useThunderID';\n\nexport interface FlowMetaProviderProps {\n /**\n * When false the provider skips fetching and provides null meta.\n * @default true\n */\n enabled?: boolean;\n\n /**\n * Flow metadata resolved ahead of time (e.g. fetched server-side during SSR) and used to seed\n * the provider's state. When present, the provider skips its own initial client-side fetch —\n * avoiding a redundant request and the flash of untranslated i18n keys while that fetch is in\n * flight — but still fetches normally on subsequent changes (e.g. an explicit language switch).\n */\n initialMeta?: FlowMetadataResponse | null;\n}\n\n/**\n * FlowMetaProvider fetches flow metadata from the `GET /flow/meta` endpoint\n * (v2 API) and makes it available to child components through `FlowMetaContext`.\n *\n * It is designed to be used in v2 embedded-flow scenarios and integrates with\n * `ThemeProvider` so that theme settings (colors, direction, typography, …)\n * from the server-side design configuration are applied automatically.\n *\n * @example\n * ```tsx\n * <FlowMetaProvider\n * config={{\n * baseUrl: 'https://localhost:8090',\n * type: FlowMetaType.App,\n * id: 'your-app-id',\n * }}\n * >\n * <ThemeProvider>\n * <App />\n * </ThemeProvider>\n * </FlowMetaProvider>\n * ```\n */\nconst FlowMetaProvider: FC<PropsWithChildren<FlowMetaProviderProps>> = ({\n children,\n enabled = true,\n initialMeta = null,\n}: PropsWithChildren<FlowMetaProviderProps>): ReactElement => {\n const {baseUrl, applicationId, isInitialized} = useThunderID();\n const i18nContext: I18nContextValue = useI18n();\n\n const [meta, setMeta] = useState<FlowMetadataResponse | null>(initialMeta);\n const [isLoading, setIsLoading] = useState<boolean>(!initialMeta);\n const [error, setError] = useState<Error | null>(null);\n const [pendingLanguage, setPendingLanguage] = useState<string | null>(null);\n\n // Track the last fetchFlowMeta reference that was actually dispatched.\n // This prevents two classes of double-fetch:\n // 1. React StrictMode simulates unmount+remount — the re-mount fires the\n // effect again with the same fetchFlowMeta reference; without this guard\n // the else-branch would issue a redundant second network request.\n // 2. Rapid dependency changes (e.g. baseUrl stabilising) that produce two\n // effect firings before the first fetch completes.\n const lastFetchedRef: RefObject<(() => Promise<void>) | null> = useRef<(() => Promise<void>) | null>(null);\n const initialMetaConsumedRef: RefObject<boolean> = useRef(false);\n const fetchFlowMeta: () => Promise<void> = useCallback(async (): Promise<void> => {\n if (!enabled) {\n setMeta(null);\n setIsLoading(false);\n return;\n }\n\n // Defer until ThunderID finishes initializing (e.g. loading applicationId\n // from storage on refresh). Once initialized, proceed even if applicationId\n // is absent — some flows (e.g. AcceptInvite) have no applicationId by design.\n if (!isInitialized && !applicationId) {\n return;\n }\n\n setIsLoading(true);\n setError(null);\n\n try {\n const result: FlowMetadataResponse = await getFlowMeta({\n baseUrl,\n ...(applicationId ? {id: applicationId, type: FlowMetaType.App} : {}),\n language: i18nContext?.currentLanguage,\n });\n setMeta(result);\n } catch (err: unknown) {\n setError(err instanceof Error ? err : new Error(String(err)));\n } finally {\n setIsLoading(false);\n }\n }, [enabled, baseUrl, applicationId, isInitialized, i18nContext?.currentLanguage]);\n\n const switchLanguage: (language: string) => Promise<void> = useCallback(\n async (language: string): Promise<void> => {\n if (!enabled) return;\n\n setIsLoading(true);\n setError(null);\n\n try {\n const result: FlowMetadataResponse = await getFlowMeta({\n baseUrl,\n ...(applicationId ? {id: applicationId, type: FlowMetaType.App} : {}),\n language,\n });\n\n // Inject translations for the new language before switching\n if (result.i18n?.translations && i18nContext?.injectBundles) {\n const flatTranslations: Record<string, string> = {};\n Object.entries(result.i18n.translations).forEach(([namespace, keys]: [string, Record<string, string>]) => {\n Object.entries(keys).forEach(([key, value]: [string, string]) => {\n flatTranslations[`${namespace}.${key}`] = value;\n });\n });\n const bundle: I18nBundle = {translations: flatTranslations} as unknown as I18nBundle;\n i18nContext.injectBundles({[language]: bundle});\n }\n\n // Defer setLanguage to the next effect cycle so injectBundles state\n // is committed before I18nProvider's setLanguage checks mergedBundles.\n setPendingLanguage(language);\n setMeta(result);\n } catch (err: unknown) {\n setError(err instanceof Error ? err : new Error(String(err)));\n } finally {\n setIsLoading(false);\n }\n },\n [enabled, baseUrl, applicationId, i18nContext],\n );\n\n // After injectBundles + setPendingLanguage are batched and committed, this\n // effect fires with the updated i18nContext (mergedBundles now includes the\n // new language), so setLanguage succeeds on the first switch.\n useEffect(() => {\n if (pendingLanguage && i18nContext?.setLanguage) {\n i18nContext.setLanguage(pendingLanguage);\n setPendingLanguage(null);\n }\n }, [pendingLanguage, i18nContext?.setLanguage]);\n\n useEffect(() => {\n if (!initialMetaConsumedRef.current) {\n initialMetaConsumedRef.current = true;\n\n if (initialMeta) {\n // Seeded from SSR (or another caller) — skip the redundant first client-side fetch.\n // Later dependency changes (e.g. an explicit language switch) still fetch normally.\n lastFetchedRef.current = fetchFlowMeta;\n return;\n }\n }\n\n if (lastFetchedRef.current === fetchFlowMeta) {\n // Same reference as the last dispatch — this is a StrictMode re-mount\n // or an effect re-fire with unchanged deps. Skip to avoid a duplicate fetch.\n return;\n }\n\n lastFetchedRef.current = fetchFlowMeta;\n fetchFlowMeta();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [fetchFlowMeta]);\n\n // When meta loads with i18n translations, inject them into the i18n system.\n // Meta translations act as the base layer — prop-provided bundles still take precedence.\n useEffect(() => {\n if (!meta?.i18n?.translations || !i18nContext?.injectBundles) {\n return;\n }\n\n const metaLanguage: string = meta.i18n.language || TranslationBundleConstants.FALLBACK_LOCALE;\n\n // Flatten namespace-keyed translations to dot-path keys:\n // { \"signin\": { \"heading\": \"Sign In\" } } → { \"signin.heading\": \"Sign In\" }\n const flatTranslations: Record<string, string> = {};\n Object.entries(meta.i18n.translations).forEach(([namespace, keys]: [string, Record<string, string>]) => {\n Object.entries(keys).forEach(([key, value]: [string, string]) => {\n flatTranslations[`${namespace}.${key}`] = value;\n });\n });\n\n const bundle: I18nBundle = {translations: flatTranslations} as unknown as I18nBundle;\n\n // Inject under the meta language code and the i18n current language so\n // lookups succeed regardless of whether the system uses \"en\" or \"en-US\".\n const bundlesToInject: Record<string, I18nBundle> = {[metaLanguage]: bundle};\n if (i18nContext.currentLanguage && i18nContext.currentLanguage !== metaLanguage) {\n bundlesToInject[i18nContext.currentLanguage] = bundle;\n }\n if (i18nContext.fallbackLanguage && i18nContext.fallbackLanguage !== metaLanguage) {\n bundlesToInject[i18nContext.fallbackLanguage] = bundle;\n }\n\n i18nContext.injectBundles(bundlesToInject);\n }, [meta?.i18n?.translations, i18nContext?.injectBundles]);\n\n const value: any = {\n error,\n fetchFlowMeta,\n isLoading,\n meta,\n switchLanguage,\n };\n\n return <FlowMetaContext.Provider value={value}>{children}</FlowMetaContext.Provider>;\n};\n\nexport default FlowMetaProvider;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsEA,MAAMA,oBAAkE,EACtE,UACA,UAAU,MACV,cAAc,WAC8C;CAC5D,MAAM,EAAC,SAAS,eAAe,kBAAiBC,8BAAc;CAC9D,MAAMC,cAAgCC,yBAAS;CAE/C,MAAM,CAAC,MAAM,+BAAiD,YAAY;CAC1E,MAAM,CAAC,WAAW,oCAAkC,CAAC,YAAY;CACjE,MAA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User = require('./contexts/User/useUser.cjs');
17
17
  const require_useFlow = require('./contexts/Flow/useFlow.cjs');
18
18
  const require_useTheme = require('./contexts/Theme/useTheme.cjs');
19
19
  const require_useTranslation = require('./hooks/useTranslation.cjs');
20
+ const require_flowTransformer = require('./utils/flowTransformer.cjs');
20
21
  const require_useForm = require('./hooks/useForm.cjs');
21
22
  const require_Spinner = require('./components/primitives/Spinner/Spinner.cjs');
22
23
  const require_Button = require('./components/primitives/Button/Button.cjs');
@@ -258,6 +259,7 @@ Object.defineProperty(exports, 'extractEmojiFromUri', {
258
259
  return __thunderid_browser.extractEmojiFromUri;
259
260
  }
260
261
  });
262
+ exports.extractErrorMessage = require_flowTransformer.extractErrorMessage;
261
263
  Object.defineProperty(exports, 'getActiveTheme', {
262
264
  enumerable: true,
263
265
  get: function () {
@@ -284,6 +286,7 @@ Object.defineProperty(exports, 'navigate', {
284
286
  return __thunderid_browser.navigate;
285
287
  }
286
288
  });
289
+ exports.normalizeFlowResponse = require_flowTransformer.normalizeFlowResponse;
287
290
  Object.defineProperty(exports, 'resolveEmojiUrisInHtml', {
288
291
  enumerable: true,
289
292
  get: function () {
@@ -34,6 +34,10 @@ export interface FieldConfig {
34
34
  * Error message to display.
35
35
  */
36
36
  error?: string;
37
+ /**
38
+ * HTML id to apply to the rendered field.
39
+ */
40
+ id?: string;
37
41
  /**
38
42
  * Display name for the field.
39
43
  */
@@ -1 +1 @@
1
- {"version":3,"file":"FieldFactory.d.ts","sourceRoot":"","sources":["../../../src/components/factories/FieldFactory.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,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,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,YA2HjD,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":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAEH,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"}
@@ -44,13 +44,14 @@ 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, options = [], touched = false, placeholder } = config;
47
+ const { name, type, label, required, value, onChange, onBlur, disabled = false, error, className, id, options = [], touched = false, placeholder } = config;
48
48
  const validationError = error || validateFieldValue(value, type, required, touched);
49
49
  const commonProps = {
50
50
  className,
51
51
  "data-testid": `thunderid-signin-${name}`,
52
52
  disabled,
53
53
  error: validationError,
54
+ id,
54
55
  label,
55
56
  name,
56
57
  onBlur,
@@ -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":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {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 * 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 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 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":";;;;;;;;;;;;;AAwFA,MAAa,sBACX,OACA,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C;IACC,GAAI;IACJ,SAAS;IACT,WAAW,MAA2C,SAAS,EAAE,OAAO,QAAQ,UAAU,CAAC;KAC3F;;EAGN,KAAK,UAAU,IACb,QACE,oBAACC;GAAS,GAAI;GAAa,WAAW,MAA2C,SAAS,EAAE,OAAO,MAAM;IAAI;EAEjH,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
+ {"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":["/**\n * Copyright (c) 2025, WSO2 LLC. (https://www.wso2.com).\n *\n * WSO2 LLC. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\nimport {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":";;;;;;;;;;;;;AA4FA,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,gBACE;CAEJ,MAAMC,kBAAiC,SAAS,mBAAmB,OAAO,MAAM,UAAU,QAAQ;CAElG,MAAMC,cAAmC;EACvC;EACA,eAAe,oBAAoB;EACnC;EACA,OAAO;EAC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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"}
@@ -2,9 +2,9 @@ import ComponentRendererContext_default from "../../../../contexts/ComponentRend
2
2
  import useThunderID_default from "../../../../contexts/ThunderID/useThunderID.js";
3
3
  import useTheme_default from "../../../../contexts/Theme/useTheme.js";
4
4
  import useTranslation_default from "../../../../hooks/useTranslation.js";
5
+ import { extractErrorMessage, normalizeFlowResponse } from "../../../../utils/flowTransformer.js";
5
6
  import Spinner_default from "../../../primitives/Spinner/Spinner.js";
6
7
  import Button_default from "../../../primitives/Button/Button.js";
7
- import { extractErrorMessage, normalizeFlowResponse } from "../../../../utils/flowTransformer.js";
8
8
  import Typography_default from "../../../primitives/Typography/Typography.js";
9
9
  import Alert_default from "../../../primitives/Alert/Alert.js";
10
10
  import Card_default from "../../../primitives/Card/Card.js";
@@ -1 +1 @@
1
- {"version":3,"file":"AuthOptionFactory.d.ts","sourceRoot":"","sources":["../../../../src/components/presentation/auth/AuthOptionFactory.tsx"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;GAgBG;AAGH,OAAO,EAEL,oBAAoB,EACpB,qBAAqB,EAarB,4BAA4B,EAC7B,MAAM,oBAAoB,CAAC;AAE5B,OAAO,EAA8B,YAAY,EAAC,MAAM,OAAO,CAAC;AAChE,OAAO,EAGL,oBAAoB,EACrB,MAAM,8DAA8D,CAAC;AACtE,OAAO,EAAC,cAAc,EAAC,MAAM,+BAA+B,CAAC;AAgE7D,MAAM,MAAM,QAAQ,GAAG,QAAQ,GAAG,QAAQ,GAAG,UAAU,CAAC;AA4lBxD;;GAEG;AACH,eAAO,MAAM,sBAAsB,GACjC,YAAY,qBAAqB,EAAE,EACnC,YAAY,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,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AAoB,CAAC;IACxC,gBAAgB;IAChB,MAAM,CAAC,EAAE,GAAG,CAAC;IACb,6CAA6C;IAC7C,cAAc,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC;IACrC,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,2EAA2E;IAC3E,6BAA6B,CAAC,EAAE,CAC9B,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,EACb,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;CACf,KACA,YAAY,EAkBkC,CAAC"}
@@ -20,7 +20,7 @@ import flowIconRegistry_default from "../../primitives/Icons/flowIconRegistry.js
20
20
  import { EmbeddedFlowComponentType, EmbeddedFlowEventType, FieldType, createPackageComponentLogger, resolveEmojiUrisInHtml, resolveFlowTemplateLiterals } from "@thunderid/browser";
21
21
  import { cloneElement } from "react";
22
22
  import { jsx } from "react/jsx-runtime";
23
- import { css } from "@emotion/css";
23
+ import { css, cx } from "@emotion/css";
24
24
  import DOMPurify from "dompurify";
25
25
 
26
26
  //#region src/components/presentation/auth/AuthOptionFactory.tsx
@@ -141,8 +141,9 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
141
141
  const error = touchedFields[identifier] || false ? formErrors[identifier] : void 0;
142
142
  const fieldType = getFieldType(component.type);
143
143
  return cloneElement(createField({
144
- className: options.inputClassName,
144
+ className: cx(options.inputClassName, component.classes),
145
145
  error,
146
+ id: component.id,
146
147
  label: resolve(component.label) || "",
147
148
  name: identifier,
148
149
  onBlur: () => options.onInputBlur?.(identifier),
@@ -158,8 +159,9 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
158
159
  const value = formValues[identifier] || "";
159
160
  const error = touchedFields[identifier] || false ? formErrors[identifier] : void 0;
160
161
  return cloneElement(createField({
161
- className: options.inputClassName,
162
+ className: cx(options.inputClassName, component.classes),
162
163
  error,
164
+ id: component.id,
163
165
  label: resolve(component.label) || "",
164
166
  name: identifier,
165
167
  onBlur: () => options.onInputBlur?.(identifier),
@@ -201,33 +203,41 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
201
203
  options.onSubmit(component, formData, shouldSkipValidation);
202
204
  }
203
205
  };
206
+ const socialButtonClassName = cx(options.buttonClassName, component.classes);
204
207
  if (matchesSocialProvider(actionId, eventType, buttonText, "google", authType, componentVariant)) return /* @__PURE__ */ jsx(GoogleButton_default, {
208
+ id: component.id,
205
209
  onClick: handleClick,
206
- className: options.buttonClassName
210
+ className: socialButtonClassName
207
211
  }, key);
208
212
  if (matchesSocialProvider(actionId, eventType, buttonText, "github", authType, componentVariant)) return /* @__PURE__ */ jsx(GitHubButton_default, {
213
+ id: component.id,
209
214
  onClick: handleClick,
210
- className: options.buttonClassName
215
+ className: socialButtonClassName
211
216
  }, key);
212
217
  if (matchesSocialProvider(actionId, eventType, buttonText, "facebook", authType, componentVariant)) return /* @__PURE__ */ jsx(FacebookButton_default, {
218
+ id: component.id,
213
219
  onClick: handleClick,
214
- className: options.buttonClassName
220
+ className: socialButtonClassName
215
221
  }, key);
216
222
  if (matchesSocialProvider(actionId, eventType, buttonText, "microsoft", authType, componentVariant)) return /* @__PURE__ */ jsx(MicrosoftButton_default, {
223
+ id: component.id,
217
224
  onClick: handleClick,
218
- className: options.buttonClassName
225
+ className: socialButtonClassName
219
226
  }, key);
220
227
  if (matchesSocialProvider(actionId, eventType, buttonText, "linkedin", authType, componentVariant)) return /* @__PURE__ */ jsx(LinkedInButton_default, {
228
+ id: component.id,
221
229
  onClick: handleClick,
222
- className: options.buttonClassName
230
+ className: socialButtonClassName
223
231
  }, key);
224
232
  if (matchesSocialProvider(actionId, eventType, buttonText, "ethereum", authType, componentVariant)) return /* @__PURE__ */ jsx(SignInWithEthereumButton_default, {
233
+ id: component.id,
225
234
  onClick: handleClick,
226
- className: options.buttonClassName
235
+ className: socialButtonClassName
227
236
  }, key);
228
237
  if (actionId === "prompt_mobile" || eventType === "prompt_mobile") return /* @__PURE__ */ jsx(SmsOtpButton_default, {
238
+ id: component.id,
229
239
  onClick: handleClick,
230
- className: options.buttonClassName
240
+ className: socialButtonClassName
231
241
  }, key);
232
242
  const startIconEl = component.startIcon ? /* @__PURE__ */ jsx("img", {
233
243
  src: component.startIcon,
@@ -251,9 +261,10 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
251
261
  }) : null;
252
262
  return /* @__PURE__ */ jsx(Button_default, {
253
263
  fullWidth: true,
264
+ id: component.id,
254
265
  onClick: handleClick,
255
266
  disabled: isLoading || !isFormValid && !shouldSkipValidation || options.isTimeoutDisabled || component.config?.disabled,
256
- className: options.buttonClassName,
267
+ className: cx(options.buttonClassName, component.classes),
257
268
  "data-testid": "thunderid-signin-submit",
258
269
  variant: component.variant?.toLowerCase() === "primary" ? "solid" : "outline",
259
270
  color: component.variant?.toLowerCase() === "primary" ? "primary" : "secondary",
@@ -262,14 +273,19 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
262
273
  children: buttonText || "Submit"
263
274
  }, key);
264
275
  }
265
- case EmbeddedFlowComponentType.Text: return /* @__PURE__ */ jsx(Typography_default, {
266
- variant: getTypographyVariant(component.variant),
267
- style: {
268
- marginBottom: 2,
269
- textAlign: typeof component?.align === "string" ? component.align : "left"
270
- },
271
- children: resolve(component.label)
272
- }, key);
276
+ case EmbeddedFlowComponentType.Text: {
277
+ const variant = getTypographyVariant(component.variant);
278
+ return /* @__PURE__ */ jsx(Typography_default, {
279
+ id: component.id,
280
+ className: component.classes,
281
+ variant,
282
+ style: {
283
+ marginBottom: 2,
284
+ textAlign: typeof component?.align === "string" ? component.align : "left"
285
+ },
286
+ children: resolve(component.label)
287
+ }, key);
288
+ }
273
289
  case EmbeddedFlowComponentType.Divider: return /* @__PURE__ */ jsx(Divider_default, { children: resolve(component.label) || "" }, key);
274
290
  case EmbeddedFlowComponentType.Select: {
275
291
  const identifier = component.ref;
@@ -280,6 +296,7 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
280
296
  value: typeof opt === "string" ? opt : String(opt.value ?? "")
281
297
  }));
282
298
  return /* @__PURE__ */ jsx(Select_default, {
299
+ id: component.id,
283
300
  name: identifier,
284
301
  label: resolve(component.label) || "",
285
302
  placeholder: resolve(component.placeholder),
@@ -289,7 +306,7 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
289
306
  error,
290
307
  onChange: (e) => onInputChange(identifier, e.target.value),
291
308
  onBlur: () => options.onInputBlur?.(identifier),
292
- className: options.inputClassName
309
+ className: cx(options.inputClassName, component.classes)
293
310
  }, key);
294
311
  }
295
312
  case EmbeddedFlowComponentType.DateInput: {
@@ -297,6 +314,7 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
297
314
  const value = formValues[identifier] || "";
298
315
  const error = touchedFields[identifier] || false ? formErrors[identifier] : void 0;
299
316
  return /* @__PURE__ */ jsx(DatePicker_default, {
317
+ id: component.id,
300
318
  name: identifier,
301
319
  label: resolve(component.label) || "",
302
320
  placeholder: resolve(component.placeholder),
@@ -306,7 +324,7 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
306
324
  error,
307
325
  onChange: (e) => onInputChange(identifier, e.target.value),
308
326
  onBlur: () => options.onInputBlur?.(identifier),
309
- className: options.inputClassName
327
+ className: cx(options.inputClassName, component.classes)
310
328
  }, key);
311
329
  }
312
330
  case EmbeddedFlowComponentType.OuSelect:
@@ -325,6 +343,7 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
325
343
  })).filter(Boolean);
326
344
  return /* @__PURE__ */ jsx("form", {
327
345
  id: component.id,
346
+ className: component.classes,
328
347
  style: formStyles,
329
348
  children: blockComponents
330
349
  }, key);
@@ -404,20 +423,24 @@ const createAuthComponentFromFlow = (component, formValues, touchedFields, formE
404
423
  const gap = component.gap ?? 2;
405
424
  const align = component.align || "center";
406
425
  const justify = component.justify || "flex-start";
426
+ const stackStyle = {
427
+ alignItems: align,
428
+ display: "flex",
429
+ flexDirection: direction,
430
+ flexWrap: "wrap",
431
+ gap: `${gap * .5}rem`,
432
+ justifyContent: justify
433
+ };
434
+ const stackChildren = component.components ? component.components.map((childComponent, index) => createAuthComponentFromFlow(childComponent, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, authType, {
435
+ ...options,
436
+ inStack: true,
437
+ key: childComponent.id || `${component.id}_${index}`
438
+ })) : [];
407
439
  return /* @__PURE__ */ jsx("div", {
408
- style: {
409
- alignItems: align,
410
- display: "flex",
411
- flexDirection: direction,
412
- flexWrap: "wrap",
413
- gap: `${gap * .5}rem`,
414
- justifyContent: justify
415
- },
416
- children: component.components ? component.components.map((childComponent, index) => createAuthComponentFromFlow(childComponent, formValues, touchedFields, formErrors, isLoading, isFormValid, onInputChange, authType, {
417
- ...options,
418
- inStack: true,
419
- key: childComponent.id || `${component.id}_${index}`
420
- })) : []
440
+ id: component.id,
441
+ className: component.classes,
442
+ style: stackStyle,
443
+ children: stackChildren
421
444
  }, key);
422
445
  }
423
446
  case EmbeddedFlowComponentType.Consent: {