@thunderid/javascript 0.3.0 → 0.3.6

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 (129) hide show
  1. package/dist/StorageManager.d.ts +2 -2
  2. package/dist/StorageManager.d.ts.map +1 -1
  3. package/dist/ThunderIDJavaScriptClient.d.ts +2 -7
  4. package/dist/ThunderIDJavaScriptClient.d.ts.map +1 -1
  5. package/dist/api/{v2/executeEmbeddedRecoveryFlowV2.d.ts → executeEmbeddedRecoveryFlow.d.ts} +7 -7
  6. package/dist/api/executeEmbeddedRecoveryFlow.d.ts.map +1 -0
  7. package/dist/api/executeEmbeddedSignInFlow.d.ts +3 -3
  8. package/dist/api/executeEmbeddedSignInFlow.d.ts.map +1 -1
  9. package/dist/api/executeEmbeddedSignUpFlow.d.ts +4 -27
  10. package/dist/api/executeEmbeddedSignUpFlow.d.ts.map +1 -1
  11. package/dist/api/{v2/executeEmbeddedUserOnboardingFlowV2.d.ts → executeEmbeddedUserOnboardingFlow.d.ts} +6 -6
  12. package/dist/api/executeEmbeddedUserOnboardingFlow.d.ts.map +1 -0
  13. package/dist/api/getBrandingPreference.d.ts.map +1 -1
  14. package/dist/api/{v2/getFlowMetaV2.d.ts → getFlowMeta.d.ts} +7 -7
  15. package/dist/api/getFlowMeta.d.ts.map +1 -0
  16. package/dist/api/{v2/getOrganizationUnitChildren.d.ts → getOrganizationUnitChildren.d.ts} +1 -1
  17. package/dist/api/getOrganizationUnitChildren.d.ts.map +1 -0
  18. package/dist/cjs/index.cjs +1096 -1342
  19. package/dist/edge/index.js +1084 -1319
  20. package/dist/i18n/models/i18n.d.ts +3 -0
  21. package/dist/i18n/models/i18n.d.ts.map +1 -1
  22. package/dist/i18n/translations/en-US.d.ts.map +1 -1
  23. package/dist/i18n/translations/fr-FR.d.ts.map +1 -1
  24. package/dist/i18n/translations/hi-IN.d.ts.map +1 -1
  25. package/dist/i18n/translations/ja-JP.d.ts.map +1 -1
  26. package/dist/i18n/translations/pt-BR.d.ts.map +1 -1
  27. package/dist/i18n/translations/pt-PT.d.ts.map +1 -1
  28. package/dist/i18n/translations/si-LK.d.ts.map +1 -1
  29. package/dist/i18n/translations/ta-IN.d.ts.map +1 -1
  30. package/dist/i18n/translations/te-IN.d.ts.map +1 -1
  31. package/dist/index.d.ts +29 -36
  32. package/dist/index.d.ts.map +1 -1
  33. package/dist/index.js +1084 -1319
  34. package/dist/models/client.d.ts +3 -28
  35. package/dist/models/client.d.ts.map +1 -1
  36. package/dist/models/config.d.ts +1 -1
  37. package/dist/models/config.d.ts.map +1 -1
  38. package/dist/models/embedded-flow.d.ts +572 -92
  39. package/dist/models/embedded-flow.d.ts.map +1 -1
  40. package/dist/models/{v2/embedded-recovery-flow-v2.d.ts → embedded-recovery-flow.d.ts} +2 -3
  41. package/dist/models/embedded-recovery-flow.d.ts.map +1 -0
  42. package/dist/models/embedded-signin-flow.d.ts +310 -66
  43. package/dist/models/embedded-signin-flow.d.ts.map +1 -1
  44. package/dist/models/{v2/embedded-signup-flow-v2.d.ts → embedded-signup-flow.d.ts} +4 -5
  45. package/dist/models/embedded-signup-flow.d.ts.map +1 -0
  46. package/dist/models/extensions/components.d.ts +55 -0
  47. package/dist/models/extensions/components.d.ts.map +1 -0
  48. package/dist/models/{v2/flow-meta-v2.d.ts → flow-meta.d.ts} +1 -1
  49. package/dist/models/flow-meta.d.ts.map +1 -0
  50. package/dist/models/organization-unit.d.ts.map +1 -0
  51. package/dist/models/translation.d.ts.map +1 -0
  52. package/dist/models/{v2/vars.d.ts → vars.d.ts} +1 -1
  53. package/dist/models/vars.d.ts.map +1 -0
  54. package/dist/utils/buildValidatorFromRules.d.ts +31 -0
  55. package/dist/utils/buildValidatorFromRules.d.ts.map +1 -0
  56. package/dist/utils/containsMetaFlowTemplateLiteral.d.ts.map +1 -0
  57. package/dist/utils/countryCodeToFlagEmoji.d.ts.map +1 -0
  58. package/dist/utils/evaluateValidationRule.d.ts +42 -0
  59. package/dist/utils/evaluateValidationRule.d.ts.map +1 -0
  60. package/dist/utils/extractEmojiFromUri.d.ts.map +1 -0
  61. package/dist/utils/getRedirectBasedSignUpUrl.d.ts +1 -1
  62. package/dist/utils/getRedirectBasedSignUpUrl.d.ts.map +1 -1
  63. package/dist/utils/injectRequestedPermissions.d.ts.map +1 -0
  64. package/dist/utils/isEmojiUri.d.ts.map +1 -0
  65. package/dist/utils/isMetaFlowTemplateLiteral.d.ts.map +1 -0
  66. package/dist/utils/isTranslationFlowTemplateLiteral.d.ts.map +1 -0
  67. package/dist/utils/parseApiErrorMessage.d.ts.map +1 -1
  68. package/dist/utils/parseFlowTemplateLiteral.d.ts.map +1 -0
  69. package/dist/utils/{v2/resolveFlowTemplateLiterals.d.ts → resolveFlowTemplateLiterals.d.ts} +2 -2
  70. package/dist/utils/resolveFlowTemplateLiterals.d.ts.map +1 -0
  71. package/dist/utils/resolveLocaleDisplayName.d.ts.map +1 -0
  72. package/dist/utils/resolveLocaleEmoji.d.ts.map +1 -0
  73. package/dist/utils/{v2/resolveMeta.d.ts → resolveMeta.d.ts} +1 -1
  74. package/dist/utils/resolveMeta.d.ts.map +1 -0
  75. package/package.json +7 -7
  76. package/dist/api/initializeEmbeddedSignInFlow.d.ts +0 -52
  77. package/dist/api/initializeEmbeddedSignInFlow.d.ts.map +0 -1
  78. package/dist/api/v2/executeEmbeddedRecoveryFlowV2.d.ts.map +0 -1
  79. package/dist/api/v2/executeEmbeddedSignInFlowV2.d.ts +0 -22
  80. package/dist/api/v2/executeEmbeddedSignInFlowV2.d.ts.map +0 -1
  81. package/dist/api/v2/executeEmbeddedSignUpFlowV2.d.ts +0 -22
  82. package/dist/api/v2/executeEmbeddedSignUpFlowV2.d.ts.map +0 -1
  83. package/dist/api/v2/executeEmbeddedUserOnboardingFlowV2.d.ts.map +0 -1
  84. package/dist/api/v2/getFlowMetaV2.d.ts.map +0 -1
  85. package/dist/api/v2/getOrganizationUnitChildren.d.ts.map +0 -1
  86. package/dist/constants/v2/OIDCDiscoveryConstants.d.ts +0 -40
  87. package/dist/constants/v2/OIDCDiscoveryConstants.d.ts.map +0 -1
  88. package/dist/models/platforms.d.ts +0 -33
  89. package/dist/models/platforms.d.ts.map +0 -1
  90. package/dist/models/v2/embedded-flow-v2.d.ts +0 -550
  91. package/dist/models/v2/embedded-flow-v2.d.ts.map +0 -1
  92. package/dist/models/v2/embedded-recovery-flow-v2.d.ts.map +0 -1
  93. package/dist/models/v2/embedded-signin-flow-v2.d.ts +0 -345
  94. package/dist/models/v2/embedded-signin-flow-v2.d.ts.map +0 -1
  95. package/dist/models/v2/embedded-signup-flow-v2.d.ts.map +0 -1
  96. package/dist/models/v2/extensions/components.d.ts +0 -89
  97. package/dist/models/v2/extensions/components.d.ts.map +0 -1
  98. package/dist/models/v2/flow-meta-v2.d.ts.map +0 -1
  99. package/dist/models/v2/organization-unit.d.ts.map +0 -1
  100. package/dist/models/v2/translation.d.ts.map +0 -1
  101. package/dist/models/v2/vars.d.ts.map +0 -1
  102. package/dist/utils/identifyPlatform.d.ts +0 -31
  103. package/dist/utils/identifyPlatform.d.ts.map +0 -1
  104. package/dist/utils/resolveFieldType.d.ts +0 -21
  105. package/dist/utils/resolveFieldType.d.ts.map +0 -1
  106. package/dist/utils/v2/containsMetaFlowTemplateLiteral.d.ts.map +0 -1
  107. package/dist/utils/v2/countryCodeToFlagEmoji.d.ts.map +0 -1
  108. package/dist/utils/v2/extractEmojiFromUri.d.ts.map +0 -1
  109. package/dist/utils/v2/injectRequestedPermissions.d.ts.map +0 -1
  110. package/dist/utils/v2/isEmojiUri.d.ts.map +0 -1
  111. package/dist/utils/v2/isMetaFlowTemplateLiteral.d.ts.map +0 -1
  112. package/dist/utils/v2/isTranslationFlowTemplateLiteral.d.ts.map +0 -1
  113. package/dist/utils/v2/parseFlowTemplateLiteral.d.ts.map +0 -1
  114. package/dist/utils/v2/resolveFlowTemplateLiterals.d.ts.map +0 -1
  115. package/dist/utils/v2/resolveLocaleDisplayName.d.ts.map +0 -1
  116. package/dist/utils/v2/resolveLocaleEmoji.d.ts.map +0 -1
  117. package/dist/utils/v2/resolveMeta.d.ts.map +0 -1
  118. /package/dist/models/{v2/organization-unit.d.ts → organization-unit.d.ts} +0 -0
  119. /package/dist/models/{v2/translation.d.ts → translation.d.ts} +0 -0
  120. /package/dist/utils/{v2/containsMetaFlowTemplateLiteral.d.ts → containsMetaFlowTemplateLiteral.d.ts} +0 -0
  121. /package/dist/utils/{v2/countryCodeToFlagEmoji.d.ts → countryCodeToFlagEmoji.d.ts} +0 -0
  122. /package/dist/utils/{v2/extractEmojiFromUri.d.ts → extractEmojiFromUri.d.ts} +0 -0
  123. /package/dist/utils/{v2/injectRequestedPermissions.d.ts → injectRequestedPermissions.d.ts} +0 -0
  124. /package/dist/utils/{v2/isEmojiUri.d.ts → isEmojiUri.d.ts} +0 -0
  125. /package/dist/utils/{v2/isMetaFlowTemplateLiteral.d.ts → isMetaFlowTemplateLiteral.d.ts} +0 -0
  126. /package/dist/utils/{v2/isTranslationFlowTemplateLiteral.d.ts → isTranslationFlowTemplateLiteral.d.ts} +0 -0
  127. /package/dist/utils/{v2/parseFlowTemplateLiteral.d.ts → parseFlowTemplateLiteral.d.ts} +0 -0
  128. /package/dist/utils/{v2/resolveLocaleDisplayName.d.ts → resolveLocaleDisplayName.d.ts} +0 -0
  129. /package/dist/utils/{v2/resolveLocaleEmoji.d.ts → resolveLocaleEmoji.d.ts} +0 -0
@@ -21,142 +21,622 @@ export declare enum EmbeddedFlowType {
21
21
  Registration = "REGISTRATION",
22
22
  UserOnboarding = "USER_ONBOARDING"
23
23
  }
24
- export interface EmbeddedFlowExecuteRequestPayload {
25
- actionId?: string;
26
- flowType: EmbeddedFlowType;
27
- inputs?: Record<string, any>;
28
- }
29
- export interface EmbeddedFlowExecuteResponse {
30
- data: EmbeddedSignUpFlowData;
31
- flowId: string;
32
- flowStatus: EmbeddedFlowStatus;
33
- type: EmbeddedFlowResponseType;
34
- }
35
- export declare enum EmbeddedFlowStatus {
36
- Complete = "COMPLETE",
37
- Incomplete = "INCOMPLETE"
38
- }
39
24
  export declare enum EmbeddedFlowResponseType {
40
25
  Redirection = "REDIRECTION",
41
26
  View = "VIEW"
42
27
  }
43
- export interface EmbeddedSignUpFlowData {
44
- additionalData?: Record<string, any>;
45
- components?: EmbeddedFlowComponent[];
46
- redirectURL?: string;
28
+ /**
29
+ * Base request configuration for executing embedded flow operations.
30
+ *
31
+ * @template T - Type of the payload data being sent with the request
32
+ */
33
+ export interface EmbeddedFlowExecuteRequestConfigBase<T = any> extends Partial<Request> {
34
+ baseUrl?: string;
35
+ payload?: T;
36
+ url?: string;
47
37
  }
48
- export interface EmbeddedFlowComponent {
49
- components: EmbeddedFlowComponent[];
50
- config: Record<string, unknown>;
51
- id: string;
52
- type: EmbeddedFlowComponentType | string;
53
- variant?: string;
38
+ /**
39
+ * Internationalized message structure returned by the backend.
40
+ *
41
+ * The `defaultValue` field carries the untranslated fallback text.
42
+ */
43
+ export interface I18nMessage {
44
+ defaultValue?: string;
45
+ key: string;
46
+ }
47
+ /**
48
+ * Structured error returned in a flow response when flowStatus is ERROR.
49
+ */
50
+ export interface FlowExecutionError {
51
+ code: string;
52
+ description: I18nMessage;
53
+ message: I18nMessage;
54
54
  }
55
+ /**
56
+ * Component types supported by the ThunderID embedded flow API.
57
+ *
58
+ * These types define the different UI components that can be rendered
59
+ * as part of the embedded authentication flows. Each type corresponds
60
+ * to a specific UI element with its own behavior and properties.
61
+ *
62
+ * @example
63
+ * ```typescript
64
+ * // Check component type to render appropriate UI
65
+ * if (component.type === EmbeddedFlowComponentType.TextInput) {
66
+ * // Render text input field
67
+ * } else if (component.type === EmbeddedFlowComponentType.Action) {
68
+ * // Render button/action
69
+ * }
70
+ * ```
71
+ *
72
+ * @experimental This API may change in future versions
73
+ */
55
74
  export declare enum EmbeddedFlowComponentType {
56
- Button = "BUTTON",
57
- Checkbox = "CHECKBOX",
75
+ /** Interactive action component (buttons, links) for user interactions */
76
+ Action = "ACTION",
77
+ /** Container block component that groups other components */
78
+ Block = "BLOCK",
79
+ /** Consent component for displaying consent purposes and attributes */
80
+ Consent = "CONSENT",
81
+ /** Copyable text display component that shows text with a copy-to-clipboard action */
82
+ CopyableText = "COPYABLE_TEXT",
83
+ /** Date input field for selecting a calendar date */
84
+ DateInput = "DATE_INPUT",
85
+ /** Divider component for visual separation of content */
58
86
  Divider = "DIVIDER",
59
- Form = "FORM",
87
+ /** Email input field with validation for email addresses. */
88
+ EmailInput = "EMAIL_INPUT",
89
+ /** Icon display component for rendering named vector icons */
90
+ Icon = "ICON",
91
+ /** Image display component for logos and illustrations */
60
92
  Image = "IMAGE",
61
- Input = "INPUT",
62
- Radio = "RADIO",
93
+ /** One-time password input field for multi-factor authentication */
94
+ OtpInput = "OTP_INPUT",
95
+ /** Organization unit tree picker for selecting an OU */
96
+ OuSelect = "OU_SELECT",
97
+ /** Password input field with masking for sensitive data */
98
+ PasswordInput = "PASSWORD_INPUT",
99
+ /** Phone number input field with country code support */
100
+ PhoneInput = "PHONE_INPUT",
101
+ /** Rich text display component that renders formatted HTML content */
102
+ RichText = "RICH_TEXT",
103
+ /** Select/dropdown input component for single choice selection */
63
104
  Select = "SELECT",
64
- Typography = "TYPOGRAPHY"
105
+ /** Stack layout component for arranging children in a row or column */
106
+ Stack = "STACK",
107
+ /** Text display component for labels, headings, and messages */
108
+ Text = "TEXT",
109
+ /** Standard text input field for user data entry */
110
+ TextInput = "TEXT_INPUT",
111
+ /** Timer component for displaying a countdown */
112
+ Timer = "TIMER",
113
+ /** QR code display component for wallet-based flows (e.g. OpenID4VP) */
114
+ QrCode = "QR_CODE"
65
115
  }
66
116
  /**
67
- * Request configuration for executing embedded flow operations.
117
+ * Action variant types for buttons and interactive elements.
68
118
  *
69
- * This interface extends standard HTTP request configuration with additional
70
- * properties specific to embedded flow execution, such as base URL and payload data.
119
+ * @experimental This API may change in future versions
120
+ */
121
+ export declare enum EmbeddedFlowActionVariant {
122
+ /** Danger action button for destructive operations */
123
+ Danger = "DANGER",
124
+ /** Info action button for informational purposes */
125
+ Info = "INFO",
126
+ /** Link-styled action button */
127
+ Link = "LINK",
128
+ /** Outlined action button for secondary emphasis */
129
+ Outlined = "OUTLINED",
130
+ /** Primary action button with highest visual emphasis */
131
+ Primary = "PRIMARY",
132
+ /** Secondary action button with moderate visual emphasis */
133
+ Secondary = "SECONDARY",
134
+ /** Success action button for positive confirmations */
135
+ Success = "SUCCESS",
136
+ /** Tertiary action button with minimal visual emphasis */
137
+ Tertiary = "TERTIARY",
138
+ /** Warning action button for cautionary actions */
139
+ Warning = "WARNING"
140
+ }
141
+ /**
142
+ * Text variant types for typography components.
71
143
  *
72
- * @template T - Type of the payload data being sent with the request
144
+ * @experimental This API may change in future versions
145
+ */
146
+ export declare enum EmbeddedFlowTextVariant {
147
+ /** Primary body text for main content */
148
+ Body1 = "BODY_1",
149
+ /** Secondary body text for supplementary content */
150
+ Body2 = "BODY_2",
151
+ /** Text styled for button labels */
152
+ ButtonText = "BUTTON_TEXT",
153
+ /** Small caption text for annotations and descriptions */
154
+ Caption = "CAPTION",
155
+ /** Largest heading level for main titles */
156
+ Heading1 = "HEADING_1",
157
+ /** Second level heading for major sections */
158
+ Heading2 = "HEADING_2",
159
+ /** Third level heading for subsections */
160
+ Heading3 = "HEADING_3",
161
+ /** Fourth level heading for minor sections */
162
+ Heading4 = "HEADING_4",
163
+ /** Fifth level heading for detailed sections */
164
+ Heading5 = "HEADING_5",
165
+ /** Smallest heading level for fine-grained sections */
166
+ Heading6 = "HEADING_6",
167
+ /** Overline text for labels and categories */
168
+ Overline = "OVERLINE",
169
+ /** Primary subtitle text with larger emphasis */
170
+ Subtitle1 = "SUBTITLE_1",
171
+ /** Secondary subtitle text with moderate emphasis */
172
+ Subtitle2 = "SUBTITLE_2"
173
+ }
174
+ /**
175
+ * Event types for action components.
176
+ *
177
+ * @experimental This API may change in future versions
178
+ */
179
+ export declare enum EmbeddedFlowEventType {
180
+ /** Navigate back to the previous step */
181
+ Back = "BACK",
182
+ /** Cancel the current operation */
183
+ Cancel = "CANCEL",
184
+ /** Navigate to a different flow step or page */
185
+ Navigate = "NAVIGATE",
186
+ /** Reset form fields to initial state */
187
+ Reset = "RESET",
188
+ /** Submit form data to the server */
189
+ Submit = "SUBMIT",
190
+ /** Trigger an action or event */
191
+ Trigger = "TRIGGER"
192
+ }
193
+ /**
194
+ * Enhanced component interface for embedded flow components.
195
+ *
196
+ * This interface provides better support for modern form handling and user experience.
197
+ * It includes properties for labels, placeholders, and required field validation
198
+ * that are directly provided by the API response.
199
+ *
200
+ * @example
201
+ * ```typescript
202
+ * const component: EmbeddedFlowComponent = {
203
+ * id: 'username_field',
204
+ * type: EmbeddedFlowComponentType.TextInput,
205
+ * label: 'Username',
206
+ * placeholder: 'Enter your username',
207
+ * required: true,
208
+ * variant: 'TEXT',
209
+ * eventType: 'SUBMIT',
210
+ * components: []
211
+ * };
212
+ * ```
213
+ *
214
+ * @experimental This interface may change in future versions
73
215
  */
74
- export interface EmbeddedFlowExecuteRequestConfig<T = any> extends Partial<Request> {
216
+ export interface EmbeddedFlowComponent {
75
217
  /**
76
- * Base URL for the API endpoint.
77
- * This is typically the ThunderID organization URL.
218
+ * Alignment of children along the cross axis (for Stack components).
78
219
  */
79
- baseUrl?: string;
220
+ align?: string;
80
221
  /**
81
- * Payload data to be sent with the request.
82
- * The structure depends on the specific flow operation being executed.
222
+ * Alternative text for Image components.
83
223
  */
84
- payload?: T;
224
+ alt?: string;
85
225
  /**
86
- * Full URL for the API endpoint.
87
- * If provided, this overrides the baseUrl.
226
+ * Icon color, CSS color value (for Icon components).
88
227
  */
89
- url?: string;
228
+ color?: string;
229
+ /**
230
+ * Nested child components for container components like Block and Stack.
231
+ */
232
+ components?: EmbeddedFlowComponent[];
233
+ /**
234
+ * Display format hint for DateInput components (e.g., 'yyyy-MM-dd'). Used as the
235
+ * placeholder rendered by the date picker primitive. Pattern-level validation is
236
+ * declared separately via a `regex` rule in the `validation` array.
237
+ */
238
+ dateFormat?: string;
239
+ /**
240
+ * Layout direction for Stack components ('row' | 'column').
241
+ */
242
+ direction?: string;
243
+ /**
244
+ * Icon to render at the end of an Action button (URL string).
245
+ */
246
+ endIcon?: string;
247
+ /**
248
+ * Event type for action components that defines the interaction behavior.
249
+ * Only relevant for Action components.
250
+ */
251
+ eventType?: EmbeddedFlowEventType | string;
252
+ /**
253
+ * Gap between children in Stack components (number, maps to spacing units).
254
+ */
255
+ gap?: number;
256
+ /**
257
+ * Height of the component (for Image components, can be string with units or number for pixels).
258
+ * The value depends on the component type (e.g., for Image components).
259
+ */
260
+ height?: string | number;
261
+ /**
262
+ * Legacy flat configuration bag for V1 adapter-based components.
263
+ */
264
+ config?: Record<string, unknown>;
265
+ /**
266
+ * Unique identifier for the component
267
+ */
268
+ id: string;
269
+ /**
270
+ * Number of items across the main axis (for Stack grid-like layouts).
271
+ */
272
+ items?: string | number;
273
+ /**
274
+ * Justification of children along the main axis (for Stack components).
275
+ */
276
+ justify?: string;
277
+ /**
278
+ * Display label for the component (e.g., field label, button text).
279
+ * Supports internationalization and may contain template strings.
280
+ */
281
+ label?: string;
282
+ /**
283
+ * Icon name for Icon components (e.g., lucide-react icon names like 'ArrowLeftRight').
284
+ */
285
+ name?: string;
286
+ /**
287
+ * Options for SELECT components.
288
+ * Each option can be a string value or an object with value and label.
289
+ */
290
+ options?: (string | {
291
+ label: string;
292
+ value: string;
293
+ })[];
294
+ /**
295
+ * Placeholder text for input components.
296
+ * Provides helpful hints to users about expected input format.
297
+ */
298
+ placeholder?: string;
299
+ /**
300
+ * Reference identifier for the component (e.g., field name, action ref)
301
+ */
302
+ ref?: string;
303
+ /**
304
+ * Indicates whether this component represents a required field.
305
+ * Used for form validation and UI indicators.
306
+ */
307
+ required?: boolean;
308
+ /**
309
+ * Icon size in pixels (for Icon components).
310
+ */
311
+ size?: number;
312
+ /**
313
+ * Data source key for dynamic components (e.g., COPYABLE_TEXT).
314
+ * References a key in additionalData whose value is resolved at render time.
315
+ */
316
+ source?: string;
317
+ /**
318
+ * Image source URL (for Image components).
319
+ */
320
+ src?: string;
321
+ /**
322
+ * Icon to render at the start of an Action button (URL string).
323
+ */
324
+ startIcon?: string;
325
+ /**
326
+ * Component type that determines rendering behavior
327
+ */
328
+ type: EmbeddedFlowComponentType | string;
329
+ /**
330
+ * Declarative validation rules for input components. Evaluated client-side by the SDK
331
+ * (best-effort UX) before submission, and authoritatively re-evaluated server-side.
332
+ * Each rule represents exactly one constraint.
333
+ */
334
+ validation?: ValidationRule[];
335
+ /**
336
+ * Component variant that affects visual styling and behavior.
337
+ * The value depends on the component type (e.g., button variants, text variants).
338
+ */
339
+ variant?: EmbeddedFlowActionVariant | EmbeddedFlowTextVariant | string;
340
+ /**
341
+ * Width of the component (for Image components, can be string with units or number for pixels).
342
+ * The value depends on the component type (e.g., for Image components).
343
+ */
344
+ width?: string | number;
345
+ }
346
+ /**
347
+ * Supported validation rule types for `ValidationRule.type`.
348
+ *
349
+ * - `regex`: value must be a string regex pattern; the input must match.
350
+ * - `minLength`: value must be a number; input length must be >= value.
351
+ * - `maxLength`: value must be a number; input length must be <= value.
352
+ *
353
+ * @experimental Additional rule types (`oneOf`, `format`, ...) may be added later.
354
+ */
355
+ export type ValidationRuleType = 'regex' | 'minLength' | 'maxLength';
356
+ /**
357
+ * A single-constraint validation rule attached to an input component.
358
+ * Mirrors the server-side `ValidationRule` returned by ThunderID.
359
+ *
360
+ * @experimental This interface may change in future versions
361
+ */
362
+ export interface ValidationRule {
363
+ /**
364
+ * The constraint kind. Drives interpretation of `value` and the default fallback message.
365
+ */
366
+ type: ValidationRuleType;
367
+ /**
368
+ * The constraint parameter. String for `regex`, number for `minLength` / `maxLength`.
369
+ */
370
+ value: string | number;
371
+ /**
372
+ * Optional message returned when this rule fails. May be an i18n key (e.g.
373
+ * `"{{i18n(validation:email.invalid)}}"`) or a literal string. The server passes
374
+ * this through unchanged; the SDK substitutes a default i18n key when omitted.
375
+ */
376
+ message?: string;
90
377
  }
91
378
  /**
92
- * Error response structure for ThunderIDV1 embedded flow operations.
379
+ * A single validation failure for a specific input field returned by the server in
380
+ * `data.fieldErrors` when one or more rules fail.
93
381
  *
94
- * This interface defines the structure of error responses returned by ThunderIDV1 APIs
95
- * when flow operations (such as sign-up or sign-in) fail.
382
+ * @experimental This interface may change in future versions
383
+ */
384
+ export interface FieldError {
385
+ /** The `identifier` of the input that failed validation. */
386
+ identifier: string;
387
+ /** The failing rule's message (i18n key or literal string). */
388
+ message: string;
389
+ }
390
+ /**
391
+ * Response data structure for embedded flow API.
96
392
  *
97
- * **Key Characteristics:**
98
- * - Uses structured error codes (e.g., "FEE-60005") for programmatic error handling
99
- * - Provides both a brief `message` and detailed `description` for context
100
- * - Includes `flowType` to identify which flow operation failed
393
+ * This interface defines the structure of data returned by the API,
394
+ * which includes both legacy input/action arrays for backward compatibility
395
+ * and the new meta.components structure for modern component-driven UIs.
101
396
  *
102
- * **Error Handling:**
103
- * This error response format is automatically detected and processed by the
104
- * `extractErrorMessage()` and `checkForErrorResponse()` functions in the React
105
- * transformer to extract meaningful error messages for display to users.
397
+ * The key improvement is the meta.components field, which provides
398
+ * a rich component tree with proper labels, placeholders, and hierarchy
399
+ * that can be directly rendered without additional transformation.
106
400
  *
107
401
  * @example
108
402
  * ```typescript
109
- * // Typical ThunderIDV1 error response
110
- * const errorResponse: EmbeddedFlowExecuteErrorResponse = {
111
- * code: "FEE-60005",
112
- * message: "Error while provisioning user.",
113
- * description: "Error occurred while provisioning user in the request of flow id: ac57315c-6ca6-49dc-8664-fcdcff354f46",
114
- * flowType: "REGISTRATION"
403
+ * const response: EmbeddedFlowResponseData = {
404
+ * // Legacy format (for backward compatibility)
405
+ * inputs: [
406
+ * { ref: 'input_001', identifier: 'username', type: 'TEXT_INPUT', required: true }
407
+ * ],
408
+ * actions: [
409
+ * { ref: 'action_001', nextNode: 'basic_auth', eventType: 'SUBMIT' }
410
+ * ],
411
+ * // Modern format (recommended)
412
+ * meta: {
413
+ * components: [
414
+ * {
415
+ * id: 'text_001',
416
+ * type: 'TEXT',
417
+ * label: '{{ t(signin:heading.label) }}',
418
+ * variant: 'HEADING_1'
419
+ * },
420
+ * {
421
+ * id: 'block_001',
422
+ * type: 'BLOCK',
423
+ * components: [
424
+ * {
425
+ * id: 'input_001',
426
+ * type: 'TEXT_INPUT',
427
+ * label: '{{ t(signin:fields.username.label) }}',
428
+ * placeholder: '{{ t(signin:fields.username.placeholder) }}',
429
+ * required: true
430
+ * },
431
+ * {
432
+ * id: 'action_001',
433
+ * type: 'ACTION',
434
+ * label: '{{ t(signin:buttons.submit.label) }}',
435
+ * variant: 'PRIMARY',
436
+ * eventType: 'ACTIVATE'
437
+ * }
438
+ * ]
439
+ * }
440
+ * ]
441
+ * }
115
442
  * };
116
- *
117
- * // The transformer will extract: "Error occurred while provisioning user in the request of flow id: ac57315c-6ca6-49dc-8664-fcdcff354f46"
118
- * // (Prefers description over message as it's usually more detailed)
119
443
  * ```
120
444
  *
121
- * @see {@link EmbeddedSignUpFlowErrorResponse} for the ThunderIDV2 equivalent error structure
445
+ * @experimental This structure may change in future versions
122
446
  */
123
- export interface EmbeddedFlowExecuteErrorResponse {
447
+ export interface EmbeddedFlowResponseData {
124
448
  /**
125
- * Structured error code identifying the type of error.
126
- *
127
- * Format typically follows pattern like "FEE-XXXXX" where:
128
- * - "FEE" indicates Flow Execution Error
129
- * - XXXXX is a numeric identifier for the specific error type
130
- *
131
- * @example "FEE-60005" - User provisioning error
449
+ * Legacy action definitions for backward compatibility.
450
+ * @deprecated Use meta.components for new implementations
132
451
  */
133
- code: string;
452
+ actions?: {
453
+ /** Event type for the action (SUBMIT, ACTIVATE, etc.) */
454
+ eventType?: string;
455
+ /** Next flow node to navigate to (optional) */
456
+ nextNode?: string;
457
+ /** Reference identifier for the action */
458
+ ref: string;
459
+ }[];
134
460
  /**
135
- * Detailed error description with contextual information.
136
- *
137
- * This field usually contains more specific information about the error,
138
- * including flow IDs, operation details, and other debugging context.
139
- * The transformer prefers this field over `message` when extracting
140
- * error messages for display to users.
461
+ * Additional data dictionary for dynamic flow response properties.
462
+ * Can be used to pass custom data like passkey challenges, server alerts, etc.
463
+ */
464
+ additionalData?: Record<string, any>;
465
+ /**
466
+ * Per-field validation errors returned by the server when a submission fails one or
467
+ * more `validation` rules. Multiple failing rules on the same field appear as
468
+ * multiple entries, in the order the rules were declared.
141
469
  *
142
- * @example "Error occurred while provisioning user in the request of flow id: ac57315c-6ca6-49dc-8664-fcdcff354f46"
470
+ * Present only on `INCOMPLETE` responses caused by validation failures; absent on
471
+ * successful submissions and on `INCOMPLETE` responses caused by missing required fields.
143
472
  */
144
- description: string;
473
+ fieldErrors?: FieldError[];
145
474
  /**
146
- * Type of flow operation that encountered the error.
475
+ * Legacy input definitions for backward compatibility.
476
+ * @deprecated Use meta.components for new implementations
477
+ */
478
+ inputs?: {
479
+ /** Field identifier used in form submission */
480
+ identifier: string;
481
+ /** Reference identifier for the input */
482
+ ref: string;
483
+ /** Whether this input is required for form submission */
484
+ required: boolean;
485
+ /** Input type (TEXT_INPUT, PASSWORD_INPUT, etc.) */
486
+ type: string;
487
+ /** Server-side validation rules for the input (also returned for API-only customers). */
488
+ validation?: ValidationRule[];
489
+ }[];
490
+ /**
491
+ * Modern component-driven metadata structure.
492
+ * This contains the complete UI component tree with proper
493
+ * hierarchy, labels, and configuration that can be directly rendered.
147
494
  *
148
- * Currently only supports 'REGISTRATION' but may be extended to
149
- * include other flow types (e.g., 'LOGIN', 'PASSWORD_RESET') in the future.
495
+ * **This is the primary data source for implementations.**
496
+ * The legacy inputs/actions arrays are maintained only for backward compatibility.
497
+ */
498
+ meta?: {
499
+ /** Array of components that define the complete UI structure */
500
+ components: EmbeddedFlowComponent[];
501
+ };
502
+ /**
503
+ * Optional redirect URL for flow completion or external authentication.
504
+ */
505
+ redirectURL?: string;
506
+ }
507
+ /**
508
+ * Discriminator identifying the kind of consent a purpose represents. The same
509
+ * `ConsentPurposeData` envelope is used for both attribute and permission consent;
510
+ * the populated fields differ based on this discriminator.
511
+ *
512
+ * @experimental This type may change in future versions
513
+ */
514
+ export type ConsentPurposeType = 'attributes' | 'permissions';
515
+ /**
516
+ * Individual consent attribute/element decision.
517
+ *
518
+ * @experimental This interface may change in future versions
519
+ */
520
+ export interface ConsentAttributeElement {
521
+ /** Whether the user approved collection of this attribute */
522
+ approved: boolean;
523
+ /** The name of the attribute being consented */
524
+ name: string;
525
+ }
526
+ /**
527
+ * A single element presented for consent within a consent purpose. For attribute purposes
528
+ * the element is an attribute name. For permission purposes the element is a permission
529
+ * string and `parent` may carry rollup linkage supplied by the server: when set, the UI
530
+ * may render this permission as a child of `parent` and offer a single rollup toggle.
531
+ *
532
+ * @experimental This interface may change in future versions
533
+ */
534
+ export interface PromptElement {
535
+ /** Canonical element name (attribute name or permission string) */
536
+ name: string;
537
+ /**
538
+ * Canonical name of the rollup parent, permission-purpose only. Undefined for attribute
539
+ * elements and for top-level permissions.
540
+ */
541
+ parent?: string;
542
+ }
543
+ /**
544
+ * Consent decision for a single purpose.
545
+ *
546
+ * @experimental This interface may change in future versions
547
+ */
548
+ export interface ConsentPurposeDecision {
549
+ /** Whether the user approved this purpose */
550
+ approved: boolean;
551
+ /** Per-attribute decisions for this purpose */
552
+ elements: ConsentAttributeElement[];
553
+ /** The name of the consent purpose */
554
+ purposeName: string;
555
+ }
556
+ /**
557
+ * Full consent decisions structure sent to the backend when user submits the consent form.
558
+ *
559
+ * @experimental This interface may change in future versions
560
+ */
561
+ export interface ConsentDecisions {
562
+ /** Array of per-purpose decisions */
563
+ purposes: ConsentPurposeDecision[];
564
+ }
565
+ /**
566
+ * Single consent purpose data returned by the backend in additionalData.consent_prompt.
567
+ * The same envelope carries both attribute and permission purposes, distinguished by `type`.
568
+ *
569
+ * @experimental This interface may change in future versions
570
+ */
571
+ export interface ConsentPurposeData {
572
+ /** Optional human-readable description of the purpose */
573
+ description?: string;
574
+ /**
575
+ * Elements that are mandatory and cannot be declined. Used by attribute purposes;
576
+ * permission purposes today have no essential elements.
150
577
  */
151
- flowType: 'REGISTRATION' | 'RECOVERY';
578
+ essential: PromptElement[];
152
579
  /**
153
- * Brief error message describing what went wrong.
580
+ * Elements the user can opt in or out of. For attribute purposes these are optional
581
+ * attribute names. For permission purposes these are permission elements (which may
582
+ * carry rollup parent linkage).
583
+ */
584
+ optional: PromptElement[];
585
+ /** Unique identifier for the purpose */
586
+ purposeId: string;
587
+ /** Human-readable purpose name */
588
+ purposeName?: string;
589
+ /**
590
+ * Discriminator selecting between attribute and permission consent semantics.
591
+ */
592
+ type?: ConsentPurposeType;
593
+ }
594
+ /**
595
+ * Consent prompt data structure stored in additionalData.consent_prompt.
596
+ *
597
+ * @experimental This interface may change in future versions
598
+ */
599
+ export interface ConsentPromptData {
600
+ /** Array of consent purposes requiring user review */
601
+ purposes: ConsentPurposeData[];
602
+ }
603
+ /**
604
+ * Extended request configuration for ThunderID V2 embedded flow operations.
605
+ *
606
+ * This interface extends the base request configuration with V2-specific
607
+ * properties required for the enhanced embedded flow API. The authId parameter
608
+ * is particularly important for the V2 OAuth2 flow completion process.
609
+ *
610
+ * @template T The type of the payload data being sent with the request
611
+ *
612
+ * @example
613
+ * ```typescript
614
+ * const config: EmbeddedFlowExecuteRequestConfig = {
615
+ * baseUrl: 'https://localhost:8090',
616
+ * payload: {
617
+ * flowType: 'AUTHENTICATION',
618
+ * inputs: { username: 'user@example.com' }
619
+ * },
620
+ * authId: 'auth_12345', // V2-specific for OAuth completion
621
+ * headers: {
622
+ * 'Authorization': 'Bearer token'
623
+ * }
624
+ * };
625
+ * ```
626
+ *
627
+ * @experimental This configuration is part of the new ThunderID V2 platform
628
+ */
629
+ export interface EmbeddedFlowExecuteRequestConfig<T = any> extends EmbeddedFlowExecuteRequestConfigBase<T> {
630
+ /**
631
+ * Authentication ID used for OAuth2 flow completion in V2 API.
154
632
  *
155
- * This is typically a short, high-level description of the error.
156
- * For more detailed information, refer to the `description` field.
633
+ * When the embedded flow completes successfully and returns an assertion,
634
+ * this authId is used to complete the OAuth2 authorization flow by calling
635
+ * the `/oauth2/auth/callback` endpoint. This enables seamless transition from
636
+ * embedded flow to traditional OAuth2 flow completion.
157
637
  *
158
- * @example "Error while provisioning user."
638
+ * @example "auth_abc123def456"
159
639
  */
160
- message: string;
640
+ authId?: string;
161
641
  }
162
642
  //# sourceMappingURL=embedded-flow.d.ts.map