@digiform/wizard 0.1.7 → 0.2.2

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 (105) hide show
  1. package/FormWizard.d.ts +10 -0
  2. package/features/api-integration/components/EnhancedActionExecutor/EnhancedActionExecutor.d.ts +23 -0
  3. package/features/api-integration/index.d.ts +12 -0
  4. package/features/api-integration/services/ActionExecutor.d.ts +18 -0
  5. package/features/api-integration/services/ApiCallExecutor.d.ts +2 -0
  6. package/features/api-integration/services/ApiCallService.d.ts +40 -0
  7. package/features/api-integration/services/DialogExecutor.d.ts +2 -0
  8. package/features/api-integration/services/GenericTriggerService.d.ts +118 -0
  9. package/features/api-integration/services/NavigationExecutor.d.ts +2 -0
  10. package/features/dialog-system/components/ActionDialog/ActionDialog.d.ts +11 -0
  11. package/features/dialog-system/components/ConfirmationDialog/ConfirmationDialog.d.ts +11 -0
  12. package/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.d.ts +11 -0
  13. package/features/dialog-system/index.d.ts +8 -0
  14. package/features/form-runtime/ComponentAdapterComplete/ComponentAdapterComplete.d.ts +19 -0
  15. package/features/form-runtime/FormWizard/FormWizard.d.ts +10 -0
  16. package/features/form-runtime/components/FormField.d.ts +7 -0
  17. package/features/form-runtime/components/FormFooter.d.ts +5 -0
  18. package/features/form-runtime/components/FormHeader.d.ts +9 -0
  19. package/features/form-runtime/components/FormSection/FormSection.d.ts +6 -0
  20. package/features/form-runtime/components/FormStep/FormStep.d.ts +2 -0
  21. package/features/form-runtime/components/ProgressLoaderRuntime.d.ts +12 -0
  22. package/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.d.ts +2 -0
  23. package/features/form-runtime/components/displayValue/displayValue.d.ts +21 -0
  24. package/features/form-runtime/components/index.d.ts +3 -0
  25. package/features/form-runtime/components/renderers/DisplayModeRenderer/DisplayModeRenderer.d.ts +7 -0
  26. package/features/form-runtime/components/renderers/InteractiveFieldRenderer/InteractiveFieldRenderer.d.ts +13 -0
  27. package/features/form-runtime/config/configResolver.d.ts +14 -0
  28. package/features/form-runtime/config/index.d.ts +9 -0
  29. package/features/form-runtime/config/templateConfig.d.ts +148 -0
  30. package/features/form-runtime/config/templateLoader.d.ts +25 -0
  31. package/features/form-runtime/config/templateUtils.d.ts +12 -0
  32. package/features/form-runtime/context/LoaderContext.d.ts +31 -0
  33. package/features/form-runtime/hooks/index.d.ts +1 -0
  34. package/features/form-runtime/hooks/useApiActions.d.ts +42 -0
  35. package/features/form-runtime/hooks/useComponentTriggers.d.ts +42 -0
  36. package/features/form-runtime/hooks/useComponentVisibility.d.ts +13 -0
  37. package/features/form-runtime/hooks/useFieldEventHandlers.d.ts +14 -0
  38. package/features/form-runtime/hooks/useFormContext.d.ts +4 -0
  39. package/features/form-runtime/hooks/useFormFieldState.d.ts +13 -0
  40. package/features/form-runtime/hooks/useValidationEvents.d.ts +13 -0
  41. package/features/form-runtime/index.d.ts +12 -0
  42. package/features/form-runtime/utils/componentDisplayValue.d.ts +9 -0
  43. package/features/form-runtime/utils/errorUtils.d.ts +13 -0
  44. package/features/form-runtime/utils/fieldHelpers.d.ts +38 -0
  45. package/features/form-runtime/utils/formDataBuilder.d.ts +7 -0
  46. package/features/form-runtime/utils/formDirtyStateSync.d.ts +77 -0
  47. package/features/form-runtime/utils/formSaver.d.ts +22 -0
  48. package/features/form-runtime/utils/index.d.ts +4 -0
  49. package/features/form-runtime/utils/logger.d.ts +70 -0
  50. package/features/form-runtime/utils/validation.d.ts +3 -0
  51. package/features/form-runtime/utils/validationUX.d.ts +70 -0
  52. package/features/form-runtime/utils/visibilityUtils.d.ts +13 -0
  53. package/features/index.d.ts +11 -0
  54. package/features/state-management/components/ValidationBuilder/ValidationBuilder.d.ts +9 -0
  55. package/features/state-management/index.d.ts +8 -0
  56. package/features/state-management/machines/__tests__/setup.d.ts +0 -0
  57. package/features/state-management/machines/__tests__/testUtils.d.ts +78 -0
  58. package/features/state-management/machines/__tests__/vitest.config.d.ts +2 -0
  59. package/features/state-management/machines/actions/componentActions.d.ts +10 -0
  60. package/features/state-management/machines/actions/navigationActions.d.ts +50 -0
  61. package/features/state-management/machines/actions/saveActions.d.ts +38 -0
  62. package/features/state-management/machines/actions/validationActions.d.ts +68 -0
  63. package/features/state-management/machines/componentTriggerEngine.d.ts +90 -0
  64. package/features/state-management/machines/formMachine.d.ts +216 -0
  65. package/features/state-management/machines/guards/navigationGuards.d.ts +32 -0
  66. package/features/state-management/machines/guards/saveGuards.d.ts +55 -0
  67. package/features/state-management/machines/guards/triggerGuards.d.ts +24 -0
  68. package/features/state-management/machines/helpers/triggerHelpers.d.ts +14 -0
  69. package/features/state-management/machines/index.d.ts +4 -0
  70. package/features/state-management/machines/lazyLoading.d.ts +34 -0
  71. package/features/state-management/machines/performance.d.ts +80 -0
  72. package/features/state-management/machines/types.d.ts +315 -0
  73. package/features/state-management/machines/useFormMachine.d.ts +1508 -0
  74. package/features/state-management/machines/validation/index.d.ts +5 -0
  75. package/features/state-management/machines/validation/validateField.d.ts +2 -0
  76. package/features/state-management/machines/validation/validateForm.d.ts +2 -0
  77. package/features/state-management/machines/validation/validateSection.d.ts +2 -0
  78. package/features/state-management/machines/validation/validateStep.d.ts +2 -0
  79. package/features/state-management/machines/validation/validationTypes.d.ts +1 -0
  80. package/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.d.ts +8 -0
  81. package/features/trigger-action-system/components/ActionManager.d.ts +6 -0
  82. package/features/trigger-action-system/components/ComponentAlert/ComponentAlert.d.ts +10 -0
  83. package/features/trigger-action-system/components/FieldWarning/FieldWarning.d.ts +20 -0
  84. package/features/trigger-action-system/index.d.ts +10 -0
  85. package/features/trigger-action-system/utils/GenericTriggerEngine.d.ts +118 -0
  86. package/features/trigger-action-system/utils/triggerActionSystem.d.ts +193 -0
  87. package/features/validation-system/components/ValidationDebugger.d.ts +2 -0
  88. package/features/validation-system/index.d.ts +7 -0
  89. package/features/validation-system/validation/ActionValidation.d.ts +54 -0
  90. package/features/validation-system/validation/SchemaBuilder.d.ts +36 -0
  91. package/features/validation-system/validation/ValidationCache.d.ts +36 -0
  92. package/features/validation-system/validation/ValidationEngine.d.ts +86 -0
  93. package/features/validation-system/validation/ValidationExecutor.d.ts +36 -0
  94. package/features/validation-system/validation/index.d.ts +38 -0
  95. package/features/validation-system/validation/secureValidatorEngine.d.ts +64 -0
  96. package/features/validation-system/validation/tanstackSchemaAdapter.d.ts +15 -0
  97. package/features/validation-system/validation/validationService.d.ts +43 -0
  98. package/index.cjs +231 -284
  99. package/index.cjs.map +1 -1
  100. package/index.d.ts +8 -0
  101. package/index.js +231 -284
  102. package/index.js.map +1 -1
  103. package/package.json +1 -1
  104. package/styles/index.d.ts +0 -0
  105. package/styles.css +10 -18
@@ -0,0 +1,1508 @@
1
+ import { FieldChangeState, FieldWarning, VerificationConfig, VerificationStatus, ComponentConfig, FormData, FormErrors, FormFieldValue, FormWizardConfig } from '../../../../../core/src/index.ts';
2
+ import { ValidationEngine } from '../../validation-system';
3
+ import { default as React } from 'react';
4
+ import { ComponentAlert } from './types';
5
+ interface UseFormMachineProps {
6
+ config: FormWizardConfig;
7
+ initialData?: FormData;
8
+ onSubmit?: (data: FormData) => Promise<void> | void;
9
+ }
10
+ export declare const useFormMachineProvider: ({ config, initialData, onSubmit, }: UseFormMachineProps) => {
11
+ state: import('xstate').MachineSnapshot<import('./types').FormMachineContext, {
12
+ type: "SET_DATA";
13
+ key: string;
14
+ value: FormFieldValue;
15
+ } | {
16
+ type: "SET_FIELD_STATE";
17
+ componentId: string;
18
+ state: Partial<import('./types').FormMachineContext["fieldStates"][string]>;
19
+ } | {
20
+ type: "VALIDATE_FIELD";
21
+ componentId: string;
22
+ } | {
23
+ type: "VALIDATE_SECTION";
24
+ sectionId: string;
25
+ } | {
26
+ type: "VALIDATE_STEP";
27
+ stepId: string;
28
+ } | {
29
+ type: "VALIDATE_FORM";
30
+ } | {
31
+ type: "START_SECTION_EDIT";
32
+ sectionId: string;
33
+ componentIds: string[];
34
+ } | {
35
+ type: "CANCEL_SECTION_EDIT";
36
+ sectionId: string;
37
+ } | {
38
+ type: "NEXT";
39
+ } | {
40
+ type: "PREVIOUS";
41
+ } | {
42
+ type: "GO_TO_STEP";
43
+ stepId: string;
44
+ } | {
45
+ type: "REQUEST_NAVIGATION";
46
+ navigationType: "next" | "previous" | "step";
47
+ stepId?: string;
48
+ } | {
49
+ type: "SUBMIT";
50
+ } | {
51
+ type: "SUBMIT_SUCCESS";
52
+ } | {
53
+ type: "SUBMIT_ERROR";
54
+ error: Error;
55
+ } | {
56
+ type: "RESET";
57
+ } | {
58
+ type: "EXECUTE_ACTIONS";
59
+ trigger: import('../../../../../core/src/index.ts').ActionTrigger;
60
+ } | {
61
+ type: "EXECUTE_TRIGGER";
62
+ trigger: import('../../../../../core/src/index.ts').ActionTrigger;
63
+ } | {
64
+ type: "ACTION_START";
65
+ actionId: string;
66
+ } | {
67
+ type: "ACTION_SUCCESS";
68
+ actionId: string;
69
+ result: unknown;
70
+ } | {
71
+ type: "ACTION_ERROR";
72
+ actionId: string;
73
+ error: Error;
74
+ } | {
75
+ type: "ACTIONS_COMPLETED";
76
+ results: Record<string, unknown>;
77
+ } | {
78
+ type: "SHOW_ACTION_DIALOG";
79
+ dialogConfig: import('../../../../../core/src/index.ts').DialogConfig;
80
+ } | {
81
+ type: "HIDE_ACTION_DIALOG";
82
+ } | {
83
+ type: "DIALOG_BUTTON_CLICK";
84
+ buttonAction: string;
85
+ } | {
86
+ type: "FIELD_CHANGED";
87
+ fieldId: string;
88
+ oldValue: unknown;
89
+ newValue: unknown;
90
+ } | {
91
+ type: "TRIGGER_FIELD_WARNING";
92
+ fieldId: string;
93
+ warning: FieldWarning;
94
+ } | {
95
+ type: "DISMISS_FIELD_WARNING";
96
+ fieldId: string;
97
+ warningId?: string;
98
+ } | {
99
+ type: "SHOW_FIELD_WARNING";
100
+ fieldId: string;
101
+ warningId: string;
102
+ message: string;
103
+ warningType?: "warning" | "error" | "info";
104
+ } | {
105
+ type: "START_FIELD_VERIFICATION";
106
+ fieldId: string;
107
+ config: VerificationConfig;
108
+ } | {
109
+ type: "FIELD_VERIFICATION_COMPLETE";
110
+ fieldId: string;
111
+ result: unknown;
112
+ success: boolean;
113
+ } | {
114
+ type: "CLEAR_FIELD_CHANGES";
115
+ fieldId?: string;
116
+ } | {
117
+ type: "EVALUATE_COMPONENT_TRIGGERS";
118
+ componentId: string;
119
+ eventType: "valueChange" | "focus" | "blur";
120
+ value?: unknown;
121
+ } | {
122
+ type: "TRIGGER_COMPONENT_ACTION";
123
+ componentId: string;
124
+ triggerId: string;
125
+ actionId: string;
126
+ eventType?: "valueChange" | "focus" | "blur" | "navigationAttempt" | "sectionSave";
127
+ } | {
128
+ type: "COMPONENT_ACTION_START";
129
+ componentId: string;
130
+ actionId: string;
131
+ } | {
132
+ type: "COMPONENT_ACTION_COMPLETE";
133
+ componentId: string;
134
+ actionId: string;
135
+ result?: unknown;
136
+ } | {
137
+ type: "COMPONENT_ACTION_FAILED";
138
+ componentId: string;
139
+ actionId: string;
140
+ error: Error;
141
+ } | {
142
+ type: "SHOW_COMPONENT_ALERT";
143
+ componentId: string;
144
+ alert: ComponentAlert;
145
+ } | {
146
+ type: "DISMISS_COMPONENT_ALERT";
147
+ componentId: string;
148
+ alertId?: string;
149
+ } | {
150
+ type: "CLEAR_COMPONENT_ALERT";
151
+ componentId: string;
152
+ } | {
153
+ type: "SET_COMPONENT_ORIGINAL_VALUE";
154
+ componentId: string;
155
+ value: unknown;
156
+ source?: "initialized" | "api_populated" | "user_reset" | "user_verified" | "edit_start";
157
+ } | {
158
+ type: "MARK_COMPONENT_AS_POPULATED";
159
+ componentId: string;
160
+ value: unknown;
161
+ } | {
162
+ type: "EXECUTE_CONTEXT_ACTION";
163
+ execution: import('./componentTriggerEngine').TriggerExecution;
164
+ action: import('../../../../../core/src/index.ts').ComponentAction;
165
+ } | {
166
+ type: "CONTEXT_ACTION_COMPLETE";
167
+ componentId: string;
168
+ actionId: string;
169
+ result: unknown;
170
+ } | {
171
+ type: "CONTEXT_ACTIONS_COMPLETE";
172
+ results?: Record<string, unknown>;
173
+ } | {
174
+ type: "EXECUTE_CONTEXT_ACTIONS";
175
+ executionPlan: import('./componentTriggerEngine').ContextExecutionPlan;
176
+ } | {
177
+ type: "EXECUTE_FIELD_CHANGE_ACTIONS";
178
+ executionPlan: import('./componentTriggerEngine').ContextExecutionPlan;
179
+ componentId: string;
180
+ eventType: string;
181
+ value: unknown;
182
+ } | {
183
+ type: "SHOW_DIALOG";
184
+ dialog: import('../../../../../core/src/index.ts').DialogConfig;
185
+ } | {
186
+ type: "TRIGGER_ACTIONS_COMPLETE";
187
+ } | {
188
+ type: "DIALOG_VERIFIED";
189
+ } | {
190
+ type: "DIALOG_CANCELLED";
191
+ } | {
192
+ type: "RESET_FIELD_TANSTACK_STATE";
193
+ componentId: string;
194
+ form?: import('./types').MinimalFormApi;
195
+ } | {
196
+ type: "UPDATE_COMPONENT_ORIGINAL_VALUE";
197
+ componentId: string;
198
+ } | {
199
+ type: "COMPONENT_ACTION_ERROR";
200
+ componentId: string;
201
+ actionId: string;
202
+ error: Error;
203
+ } | {
204
+ type: "START_SAVE";
205
+ initiator: "sectionButton" | "navigation";
206
+ sectionId: string;
207
+ } | {
208
+ type: "SAVE_VALIDATION_SUCCESS";
209
+ sectionId: string;
210
+ executionPlan: import('./componentTriggerEngine').ContextExecutionPlan;
211
+ } | {
212
+ type: "SAVE_VALIDATION_FAILED";
213
+ sectionId: string;
214
+ errors: Record<string, string[]>;
215
+ } | {
216
+ type: "SAVE_DIALOG_SHOWN";
217
+ componentId: string;
218
+ actionId: string;
219
+ dialogId: string;
220
+ } | {
221
+ type: "SAVE_ACTIONS_COMPLETE";
222
+ sectionId: string;
223
+ results: Record<string, unknown>;
224
+ }, Record<string, import('xstate').AnyActorRef>, import('xstate').StateValue, string, import('xstate').NonReducibleUnknown, import('xstate').MetaObject, any>;
225
+ send: (event: {
226
+ type: "SET_DATA";
227
+ key: string;
228
+ value: FormFieldValue;
229
+ } | {
230
+ type: "SET_FIELD_STATE";
231
+ componentId: string;
232
+ state: Partial<import('./types').FormMachineContext["fieldStates"][string]>;
233
+ } | {
234
+ type: "VALIDATE_FIELD";
235
+ componentId: string;
236
+ } | {
237
+ type: "VALIDATE_SECTION";
238
+ sectionId: string;
239
+ } | {
240
+ type: "VALIDATE_STEP";
241
+ stepId: string;
242
+ } | {
243
+ type: "VALIDATE_FORM";
244
+ } | {
245
+ type: "START_SECTION_EDIT";
246
+ sectionId: string;
247
+ componentIds: string[];
248
+ } | {
249
+ type: "CANCEL_SECTION_EDIT";
250
+ sectionId: string;
251
+ } | {
252
+ type: "NEXT";
253
+ } | {
254
+ type: "PREVIOUS";
255
+ } | {
256
+ type: "GO_TO_STEP";
257
+ stepId: string;
258
+ } | {
259
+ type: "REQUEST_NAVIGATION";
260
+ navigationType: "next" | "previous" | "step";
261
+ stepId?: string;
262
+ } | {
263
+ type: "SUBMIT";
264
+ } | {
265
+ type: "SUBMIT_SUCCESS";
266
+ } | {
267
+ type: "SUBMIT_ERROR";
268
+ error: Error;
269
+ } | {
270
+ type: "RESET";
271
+ } | {
272
+ type: "EXECUTE_ACTIONS";
273
+ trigger: import('../../../../../core/src/index.ts').ActionTrigger;
274
+ } | {
275
+ type: "EXECUTE_TRIGGER";
276
+ trigger: import('../../../../../core/src/index.ts').ActionTrigger;
277
+ } | {
278
+ type: "ACTION_START";
279
+ actionId: string;
280
+ } | {
281
+ type: "ACTION_SUCCESS";
282
+ actionId: string;
283
+ result: unknown;
284
+ } | {
285
+ type: "ACTION_ERROR";
286
+ actionId: string;
287
+ error: Error;
288
+ } | {
289
+ type: "ACTIONS_COMPLETED";
290
+ results: Record<string, unknown>;
291
+ } | {
292
+ type: "SHOW_ACTION_DIALOG";
293
+ dialogConfig: import('../../../../../core/src/index.ts').DialogConfig;
294
+ } | {
295
+ type: "HIDE_ACTION_DIALOG";
296
+ } | {
297
+ type: "DIALOG_BUTTON_CLICK";
298
+ buttonAction: string;
299
+ } | {
300
+ type: "FIELD_CHANGED";
301
+ fieldId: string;
302
+ oldValue: unknown;
303
+ newValue: unknown;
304
+ } | {
305
+ type: "TRIGGER_FIELD_WARNING";
306
+ fieldId: string;
307
+ warning: FieldWarning;
308
+ } | {
309
+ type: "DISMISS_FIELD_WARNING";
310
+ fieldId: string;
311
+ warningId?: string;
312
+ } | {
313
+ type: "SHOW_FIELD_WARNING";
314
+ fieldId: string;
315
+ warningId: string;
316
+ message: string;
317
+ warningType?: "warning" | "error" | "info";
318
+ } | {
319
+ type: "START_FIELD_VERIFICATION";
320
+ fieldId: string;
321
+ config: VerificationConfig;
322
+ } | {
323
+ type: "FIELD_VERIFICATION_COMPLETE";
324
+ fieldId: string;
325
+ result: unknown;
326
+ success: boolean;
327
+ } | {
328
+ type: "CLEAR_FIELD_CHANGES";
329
+ fieldId?: string;
330
+ } | {
331
+ type: "EVALUATE_COMPONENT_TRIGGERS";
332
+ componentId: string;
333
+ eventType: "valueChange" | "focus" | "blur";
334
+ value?: unknown;
335
+ } | {
336
+ type: "TRIGGER_COMPONENT_ACTION";
337
+ componentId: string;
338
+ triggerId: string;
339
+ actionId: string;
340
+ eventType?: "valueChange" | "focus" | "blur" | "navigationAttempt" | "sectionSave";
341
+ } | {
342
+ type: "COMPONENT_ACTION_START";
343
+ componentId: string;
344
+ actionId: string;
345
+ } | {
346
+ type: "COMPONENT_ACTION_COMPLETE";
347
+ componentId: string;
348
+ actionId: string;
349
+ result?: unknown;
350
+ } | {
351
+ type: "COMPONENT_ACTION_FAILED";
352
+ componentId: string;
353
+ actionId: string;
354
+ error: Error;
355
+ } | {
356
+ type: "SHOW_COMPONENT_ALERT";
357
+ componentId: string;
358
+ alert: ComponentAlert;
359
+ } | {
360
+ type: "DISMISS_COMPONENT_ALERT";
361
+ componentId: string;
362
+ alertId?: string;
363
+ } | {
364
+ type: "CLEAR_COMPONENT_ALERT";
365
+ componentId: string;
366
+ } | {
367
+ type: "SET_COMPONENT_ORIGINAL_VALUE";
368
+ componentId: string;
369
+ value: unknown;
370
+ source?: "initialized" | "api_populated" | "user_reset" | "user_verified" | "edit_start";
371
+ } | {
372
+ type: "MARK_COMPONENT_AS_POPULATED";
373
+ componentId: string;
374
+ value: unknown;
375
+ } | {
376
+ type: "EXECUTE_CONTEXT_ACTION";
377
+ execution: import('./componentTriggerEngine').TriggerExecution;
378
+ action: import('../../../../../core/src/index.ts').ComponentAction;
379
+ } | {
380
+ type: "CONTEXT_ACTION_COMPLETE";
381
+ componentId: string;
382
+ actionId: string;
383
+ result: unknown;
384
+ } | {
385
+ type: "CONTEXT_ACTIONS_COMPLETE";
386
+ results?: Record<string, unknown>;
387
+ } | {
388
+ type: "EXECUTE_CONTEXT_ACTIONS";
389
+ executionPlan: import('./componentTriggerEngine').ContextExecutionPlan;
390
+ } | {
391
+ type: "EXECUTE_FIELD_CHANGE_ACTIONS";
392
+ executionPlan: import('./componentTriggerEngine').ContextExecutionPlan;
393
+ componentId: string;
394
+ eventType: string;
395
+ value: unknown;
396
+ } | {
397
+ type: "SHOW_DIALOG";
398
+ dialog: import('../../../../../core/src/index.ts').DialogConfig;
399
+ } | {
400
+ type: "TRIGGER_ACTIONS_COMPLETE";
401
+ } | {
402
+ type: "DIALOG_VERIFIED";
403
+ } | {
404
+ type: "DIALOG_CANCELLED";
405
+ } | {
406
+ type: "RESET_FIELD_TANSTACK_STATE";
407
+ componentId: string;
408
+ form?: import('./types').MinimalFormApi;
409
+ } | {
410
+ type: "UPDATE_COMPONENT_ORIGINAL_VALUE";
411
+ componentId: string;
412
+ } | {
413
+ type: "COMPONENT_ACTION_ERROR";
414
+ componentId: string;
415
+ actionId: string;
416
+ error: Error;
417
+ } | {
418
+ type: "START_SAVE";
419
+ initiator: "sectionButton" | "navigation";
420
+ sectionId: string;
421
+ } | {
422
+ type: "SAVE_VALIDATION_SUCCESS";
423
+ sectionId: string;
424
+ executionPlan: import('./componentTriggerEngine').ContextExecutionPlan;
425
+ } | {
426
+ type: "SAVE_VALIDATION_FAILED";
427
+ sectionId: string;
428
+ errors: Record<string, string[]>;
429
+ } | {
430
+ type: "SAVE_DIALOG_SHOWN";
431
+ componentId: string;
432
+ actionId: string;
433
+ dialogId: string;
434
+ } | {
435
+ type: "SAVE_ACTIONS_COMPLETE";
436
+ sectionId: string;
437
+ results: Record<string, unknown>;
438
+ }) => void;
439
+ currentStep: import('../../../../../core/src/index.ts').FormStepConfig | import('../../../../../core/src/index.ts').TemplateStepConfig;
440
+ currentStepId: string;
441
+ currentStepIndex: number;
442
+ data: FormData;
443
+ errors: FormErrors;
444
+ isValid: boolean;
445
+ isSubmitting: boolean;
446
+ dirtyFields: Record<string, boolean>;
447
+ touchedFields: Record<string, boolean>;
448
+ isFirstStep: boolean;
449
+ isLastStep: boolean;
450
+ steps: (import('../../../../../core/src/index.ts').FormStepConfig | import('../../../../../core/src/index.ts').TemplateStepConfig)[];
451
+ config: FormWizardConfig;
452
+ validationEngine: ValidationEngine;
453
+ findComponentById: (componentId: string) => ComponentConfig | null;
454
+ setFieldError: (componentId: string, message: string) => void;
455
+ clearFieldError: (componentId: string) => void;
456
+ setData: (key: string, value: FormFieldValue) => void;
457
+ validateField: (componentId: string) => boolean;
458
+ validateSection: (sectionId: string) => boolean;
459
+ validateStep: (stepId: string) => Promise<boolean>;
460
+ validateForm: () => Promise<boolean>;
461
+ nextStep: () => void;
462
+ previousStep: () => void;
463
+ goToStep: (stepId: string) => void;
464
+ submitForm: () => Promise<void>;
465
+ resetForm: () => void;
466
+ startSectionEdit: (sectionId: string, componentIds: string[]) => void;
467
+ cancelSectionEdit: (sectionId: string) => void;
468
+ trackFieldChange: (fieldId: string, oldValue: unknown, newValue: unknown) => void;
469
+ getFieldChanges: (fieldId?: string) => FieldChangeState | Record<string, FieldChangeState>;
470
+ clearFieldChanges: (fieldId?: string) => void;
471
+ showFieldWarning: (fieldId: string, warning: FieldWarning) => void;
472
+ dismissFieldWarning: (fieldId: string, warningId?: string) => void;
473
+ getFieldWarnings: (fieldId: string) => FieldWarning[];
474
+ startFieldVerification: (fieldId: string, config: VerificationConfig) => Promise<VerificationStatus>;
475
+ getVerificationStatus: (fieldId: string) => VerificationStatus | null;
476
+ hasActiveWarnings: boolean;
477
+ hasPendingVerifications: boolean;
478
+ hasFieldChanges: boolean;
479
+ fieldChangeState: Record<string, FieldChangeState>;
480
+ fieldValidationState: import('../../../../../core/src/index.ts').FieldValidationState;
481
+ evaluateComponentTriggers: (componentId: string, eventType: "valueChange" | "focus" | "blur", value?: unknown) => void;
482
+ setComponentOriginalValue: (componentId: string, value: unknown, source?: "initialized" | "api_populated" | "user_reset") => void;
483
+ markComponentAsPopulated: (componentId: string, value: unknown) => void;
484
+ getComponentOriginalValue: (componentId: string) => unknown;
485
+ isComponentDirty: (componentId: string, currentValue: unknown) => boolean;
486
+ getComponentAlerts: (componentId: string) => ComponentAlert[];
487
+ dismissComponentAlert: (componentId: string, alertId?: string) => void;
488
+ resetFieldDirtyState: (form: {
489
+ getFieldValue: (id: string) => unknown;
490
+ resetField: (id: string) => void;
491
+ setFieldValue: (id: string, value: unknown, options?: {
492
+ dontUpdateMeta?: boolean;
493
+ }) => void;
494
+ }, componentId: string) => void;
495
+ hasComponentTriggers: (componentId: string) => boolean;
496
+ hasComponentActions: (componentId: string) => boolean;
497
+ getComponentTriggerState: (componentId: string) => {
498
+ triggers: import('../../../../../core/src/index.ts').ComponentTrigger[];
499
+ triggerStates: Record<string, unknown>;
500
+ activeActions: import('./types').ComponentActionExecution[];
501
+ alerts: ComponentAlert[];
502
+ };
503
+ componentTriggerState: Record<string, import('./types').ComponentTriggerState>;
504
+ activeComponentActions: Record<string, import('./types').ComponentActionExecution[]>;
505
+ componentAlerts: Record<string, ComponentAlert[]>;
506
+ componentOriginalValues: Record<string, import('./types').ComponentOriginalValue>;
507
+ };
508
+ export type FormMachineContextType = ReturnType<typeof useFormMachineProvider>;
509
+ export declare const FormMachineContext: {
510
+ Provider: ({ children, value, }: {
511
+ children: React.ReactNode;
512
+ value: FormMachineContextType | null;
513
+ }) => React.FunctionComponentElement<React.ProviderProps<{
514
+ state: import('xstate').MachineSnapshot<import('./types').FormMachineContext, {
515
+ type: "SET_DATA";
516
+ key: string;
517
+ value: FormFieldValue;
518
+ } | {
519
+ type: "SET_FIELD_STATE";
520
+ componentId: string;
521
+ state: Partial<import('./types').FormMachineContext["fieldStates"][string]>;
522
+ } | {
523
+ type: "VALIDATE_FIELD";
524
+ componentId: string;
525
+ } | {
526
+ type: "VALIDATE_SECTION";
527
+ sectionId: string;
528
+ } | {
529
+ type: "VALIDATE_STEP";
530
+ stepId: string;
531
+ } | {
532
+ type: "VALIDATE_FORM";
533
+ } | {
534
+ type: "START_SECTION_EDIT";
535
+ sectionId: string;
536
+ componentIds: string[];
537
+ } | {
538
+ type: "CANCEL_SECTION_EDIT";
539
+ sectionId: string;
540
+ } | {
541
+ type: "NEXT";
542
+ } | {
543
+ type: "PREVIOUS";
544
+ } | {
545
+ type: "GO_TO_STEP";
546
+ stepId: string;
547
+ } | {
548
+ type: "REQUEST_NAVIGATION";
549
+ navigationType: "next" | "previous" | "step";
550
+ stepId?: string;
551
+ } | {
552
+ type: "SUBMIT";
553
+ } | {
554
+ type: "SUBMIT_SUCCESS";
555
+ } | {
556
+ type: "SUBMIT_ERROR";
557
+ error: Error;
558
+ } | {
559
+ type: "RESET";
560
+ } | {
561
+ type: "EXECUTE_ACTIONS";
562
+ trigger: import('../../../../../core/src/index.ts').ActionTrigger;
563
+ } | {
564
+ type: "EXECUTE_TRIGGER";
565
+ trigger: import('../../../../../core/src/index.ts').ActionTrigger;
566
+ } | {
567
+ type: "ACTION_START";
568
+ actionId: string;
569
+ } | {
570
+ type: "ACTION_SUCCESS";
571
+ actionId: string;
572
+ result: unknown;
573
+ } | {
574
+ type: "ACTION_ERROR";
575
+ actionId: string;
576
+ error: Error;
577
+ } | {
578
+ type: "ACTIONS_COMPLETED";
579
+ results: Record<string, unknown>;
580
+ } | {
581
+ type: "SHOW_ACTION_DIALOG";
582
+ dialogConfig: import('../../../../../core/src/index.ts').DialogConfig;
583
+ } | {
584
+ type: "HIDE_ACTION_DIALOG";
585
+ } | {
586
+ type: "DIALOG_BUTTON_CLICK";
587
+ buttonAction: string;
588
+ } | {
589
+ type: "FIELD_CHANGED";
590
+ fieldId: string;
591
+ oldValue: unknown;
592
+ newValue: unknown;
593
+ } | {
594
+ type: "TRIGGER_FIELD_WARNING";
595
+ fieldId: string;
596
+ warning: FieldWarning;
597
+ } | {
598
+ type: "DISMISS_FIELD_WARNING";
599
+ fieldId: string;
600
+ warningId?: string;
601
+ } | {
602
+ type: "SHOW_FIELD_WARNING";
603
+ fieldId: string;
604
+ warningId: string;
605
+ message: string;
606
+ warningType?: "warning" | "error" | "info";
607
+ } | {
608
+ type: "START_FIELD_VERIFICATION";
609
+ fieldId: string;
610
+ config: VerificationConfig;
611
+ } | {
612
+ type: "FIELD_VERIFICATION_COMPLETE";
613
+ fieldId: string;
614
+ result: unknown;
615
+ success: boolean;
616
+ } | {
617
+ type: "CLEAR_FIELD_CHANGES";
618
+ fieldId?: string;
619
+ } | {
620
+ type: "EVALUATE_COMPONENT_TRIGGERS";
621
+ componentId: string;
622
+ eventType: "valueChange" | "focus" | "blur";
623
+ value?: unknown;
624
+ } | {
625
+ type: "TRIGGER_COMPONENT_ACTION";
626
+ componentId: string;
627
+ triggerId: string;
628
+ actionId: string;
629
+ eventType?: "valueChange" | "focus" | "blur" | "navigationAttempt" | "sectionSave";
630
+ } | {
631
+ type: "COMPONENT_ACTION_START";
632
+ componentId: string;
633
+ actionId: string;
634
+ } | {
635
+ type: "COMPONENT_ACTION_COMPLETE";
636
+ componentId: string;
637
+ actionId: string;
638
+ result?: unknown;
639
+ } | {
640
+ type: "COMPONENT_ACTION_FAILED";
641
+ componentId: string;
642
+ actionId: string;
643
+ error: Error;
644
+ } | {
645
+ type: "SHOW_COMPONENT_ALERT";
646
+ componentId: string;
647
+ alert: ComponentAlert;
648
+ } | {
649
+ type: "DISMISS_COMPONENT_ALERT";
650
+ componentId: string;
651
+ alertId?: string;
652
+ } | {
653
+ type: "CLEAR_COMPONENT_ALERT";
654
+ componentId: string;
655
+ } | {
656
+ type: "SET_COMPONENT_ORIGINAL_VALUE";
657
+ componentId: string;
658
+ value: unknown;
659
+ source?: "initialized" | "api_populated" | "user_reset" | "user_verified" | "edit_start";
660
+ } | {
661
+ type: "MARK_COMPONENT_AS_POPULATED";
662
+ componentId: string;
663
+ value: unknown;
664
+ } | {
665
+ type: "EXECUTE_CONTEXT_ACTION";
666
+ execution: import('./componentTriggerEngine').TriggerExecution;
667
+ action: import('../../../../../core/src/index.ts').ComponentAction;
668
+ } | {
669
+ type: "CONTEXT_ACTION_COMPLETE";
670
+ componentId: string;
671
+ actionId: string;
672
+ result: unknown;
673
+ } | {
674
+ type: "CONTEXT_ACTIONS_COMPLETE";
675
+ results?: Record<string, unknown>;
676
+ } | {
677
+ type: "EXECUTE_CONTEXT_ACTIONS";
678
+ executionPlan: import('./componentTriggerEngine').ContextExecutionPlan;
679
+ } | {
680
+ type: "EXECUTE_FIELD_CHANGE_ACTIONS";
681
+ executionPlan: import('./componentTriggerEngine').ContextExecutionPlan;
682
+ componentId: string;
683
+ eventType: string;
684
+ value: unknown;
685
+ } | {
686
+ type: "SHOW_DIALOG";
687
+ dialog: import('../../../../../core/src/index.ts').DialogConfig;
688
+ } | {
689
+ type: "TRIGGER_ACTIONS_COMPLETE";
690
+ } | {
691
+ type: "DIALOG_VERIFIED";
692
+ } | {
693
+ type: "DIALOG_CANCELLED";
694
+ } | {
695
+ type: "RESET_FIELD_TANSTACK_STATE";
696
+ componentId: string;
697
+ form?: import('./types').MinimalFormApi;
698
+ } | {
699
+ type: "UPDATE_COMPONENT_ORIGINAL_VALUE";
700
+ componentId: string;
701
+ } | {
702
+ type: "COMPONENT_ACTION_ERROR";
703
+ componentId: string;
704
+ actionId: string;
705
+ error: Error;
706
+ } | {
707
+ type: "START_SAVE";
708
+ initiator: "sectionButton" | "navigation";
709
+ sectionId: string;
710
+ } | {
711
+ type: "SAVE_VALIDATION_SUCCESS";
712
+ sectionId: string;
713
+ executionPlan: import('./componentTriggerEngine').ContextExecutionPlan;
714
+ } | {
715
+ type: "SAVE_VALIDATION_FAILED";
716
+ sectionId: string;
717
+ errors: Record<string, string[]>;
718
+ } | {
719
+ type: "SAVE_DIALOG_SHOWN";
720
+ componentId: string;
721
+ actionId: string;
722
+ dialogId: string;
723
+ } | {
724
+ type: "SAVE_ACTIONS_COMPLETE";
725
+ sectionId: string;
726
+ results: Record<string, unknown>;
727
+ }, Record<string, import('xstate').AnyActorRef>, import('xstate').StateValue, string, import('xstate').NonReducibleUnknown, import('xstate').MetaObject, any>;
728
+ send: (event: {
729
+ type: "SET_DATA";
730
+ key: string;
731
+ value: FormFieldValue;
732
+ } | {
733
+ type: "SET_FIELD_STATE";
734
+ componentId: string;
735
+ state: Partial<import('./types').FormMachineContext["fieldStates"][string]>;
736
+ } | {
737
+ type: "VALIDATE_FIELD";
738
+ componentId: string;
739
+ } | {
740
+ type: "VALIDATE_SECTION";
741
+ sectionId: string;
742
+ } | {
743
+ type: "VALIDATE_STEP";
744
+ stepId: string;
745
+ } | {
746
+ type: "VALIDATE_FORM";
747
+ } | {
748
+ type: "START_SECTION_EDIT";
749
+ sectionId: string;
750
+ componentIds: string[];
751
+ } | {
752
+ type: "CANCEL_SECTION_EDIT";
753
+ sectionId: string;
754
+ } | {
755
+ type: "NEXT";
756
+ } | {
757
+ type: "PREVIOUS";
758
+ } | {
759
+ type: "GO_TO_STEP";
760
+ stepId: string;
761
+ } | {
762
+ type: "REQUEST_NAVIGATION";
763
+ navigationType: "next" | "previous" | "step";
764
+ stepId?: string;
765
+ } | {
766
+ type: "SUBMIT";
767
+ } | {
768
+ type: "SUBMIT_SUCCESS";
769
+ } | {
770
+ type: "SUBMIT_ERROR";
771
+ error: Error;
772
+ } | {
773
+ type: "RESET";
774
+ } | {
775
+ type: "EXECUTE_ACTIONS";
776
+ trigger: import('../../../../../core/src/index.ts').ActionTrigger;
777
+ } | {
778
+ type: "EXECUTE_TRIGGER";
779
+ trigger: import('../../../../../core/src/index.ts').ActionTrigger;
780
+ } | {
781
+ type: "ACTION_START";
782
+ actionId: string;
783
+ } | {
784
+ type: "ACTION_SUCCESS";
785
+ actionId: string;
786
+ result: unknown;
787
+ } | {
788
+ type: "ACTION_ERROR";
789
+ actionId: string;
790
+ error: Error;
791
+ } | {
792
+ type: "ACTIONS_COMPLETED";
793
+ results: Record<string, unknown>;
794
+ } | {
795
+ type: "SHOW_ACTION_DIALOG";
796
+ dialogConfig: import('../../../../../core/src/index.ts').DialogConfig;
797
+ } | {
798
+ type: "HIDE_ACTION_DIALOG";
799
+ } | {
800
+ type: "DIALOG_BUTTON_CLICK";
801
+ buttonAction: string;
802
+ } | {
803
+ type: "FIELD_CHANGED";
804
+ fieldId: string;
805
+ oldValue: unknown;
806
+ newValue: unknown;
807
+ } | {
808
+ type: "TRIGGER_FIELD_WARNING";
809
+ fieldId: string;
810
+ warning: FieldWarning;
811
+ } | {
812
+ type: "DISMISS_FIELD_WARNING";
813
+ fieldId: string;
814
+ warningId?: string;
815
+ } | {
816
+ type: "SHOW_FIELD_WARNING";
817
+ fieldId: string;
818
+ warningId: string;
819
+ message: string;
820
+ warningType?: "warning" | "error" | "info";
821
+ } | {
822
+ type: "START_FIELD_VERIFICATION";
823
+ fieldId: string;
824
+ config: VerificationConfig;
825
+ } | {
826
+ type: "FIELD_VERIFICATION_COMPLETE";
827
+ fieldId: string;
828
+ result: unknown;
829
+ success: boolean;
830
+ } | {
831
+ type: "CLEAR_FIELD_CHANGES";
832
+ fieldId?: string;
833
+ } | {
834
+ type: "EVALUATE_COMPONENT_TRIGGERS";
835
+ componentId: string;
836
+ eventType: "valueChange" | "focus" | "blur";
837
+ value?: unknown;
838
+ } | {
839
+ type: "TRIGGER_COMPONENT_ACTION";
840
+ componentId: string;
841
+ triggerId: string;
842
+ actionId: string;
843
+ eventType?: "valueChange" | "focus" | "blur" | "navigationAttempt" | "sectionSave";
844
+ } | {
845
+ type: "COMPONENT_ACTION_START";
846
+ componentId: string;
847
+ actionId: string;
848
+ } | {
849
+ type: "COMPONENT_ACTION_COMPLETE";
850
+ componentId: string;
851
+ actionId: string;
852
+ result?: unknown;
853
+ } | {
854
+ type: "COMPONENT_ACTION_FAILED";
855
+ componentId: string;
856
+ actionId: string;
857
+ error: Error;
858
+ } | {
859
+ type: "SHOW_COMPONENT_ALERT";
860
+ componentId: string;
861
+ alert: ComponentAlert;
862
+ } | {
863
+ type: "DISMISS_COMPONENT_ALERT";
864
+ componentId: string;
865
+ alertId?: string;
866
+ } | {
867
+ type: "CLEAR_COMPONENT_ALERT";
868
+ componentId: string;
869
+ } | {
870
+ type: "SET_COMPONENT_ORIGINAL_VALUE";
871
+ componentId: string;
872
+ value: unknown;
873
+ source?: "initialized" | "api_populated" | "user_reset" | "user_verified" | "edit_start";
874
+ } | {
875
+ type: "MARK_COMPONENT_AS_POPULATED";
876
+ componentId: string;
877
+ value: unknown;
878
+ } | {
879
+ type: "EXECUTE_CONTEXT_ACTION";
880
+ execution: import('./componentTriggerEngine').TriggerExecution;
881
+ action: import('../../../../../core/src/index.ts').ComponentAction;
882
+ } | {
883
+ type: "CONTEXT_ACTION_COMPLETE";
884
+ componentId: string;
885
+ actionId: string;
886
+ result: unknown;
887
+ } | {
888
+ type: "CONTEXT_ACTIONS_COMPLETE";
889
+ results?: Record<string, unknown>;
890
+ } | {
891
+ type: "EXECUTE_CONTEXT_ACTIONS";
892
+ executionPlan: import('./componentTriggerEngine').ContextExecutionPlan;
893
+ } | {
894
+ type: "EXECUTE_FIELD_CHANGE_ACTIONS";
895
+ executionPlan: import('./componentTriggerEngine').ContextExecutionPlan;
896
+ componentId: string;
897
+ eventType: string;
898
+ value: unknown;
899
+ } | {
900
+ type: "SHOW_DIALOG";
901
+ dialog: import('../../../../../core/src/index.ts').DialogConfig;
902
+ } | {
903
+ type: "TRIGGER_ACTIONS_COMPLETE";
904
+ } | {
905
+ type: "DIALOG_VERIFIED";
906
+ } | {
907
+ type: "DIALOG_CANCELLED";
908
+ } | {
909
+ type: "RESET_FIELD_TANSTACK_STATE";
910
+ componentId: string;
911
+ form?: import('./types').MinimalFormApi;
912
+ } | {
913
+ type: "UPDATE_COMPONENT_ORIGINAL_VALUE";
914
+ componentId: string;
915
+ } | {
916
+ type: "COMPONENT_ACTION_ERROR";
917
+ componentId: string;
918
+ actionId: string;
919
+ error: Error;
920
+ } | {
921
+ type: "START_SAVE";
922
+ initiator: "sectionButton" | "navigation";
923
+ sectionId: string;
924
+ } | {
925
+ type: "SAVE_VALIDATION_SUCCESS";
926
+ sectionId: string;
927
+ executionPlan: import('./componentTriggerEngine').ContextExecutionPlan;
928
+ } | {
929
+ type: "SAVE_VALIDATION_FAILED";
930
+ sectionId: string;
931
+ errors: Record<string, string[]>;
932
+ } | {
933
+ type: "SAVE_DIALOG_SHOWN";
934
+ componentId: string;
935
+ actionId: string;
936
+ dialogId: string;
937
+ } | {
938
+ type: "SAVE_ACTIONS_COMPLETE";
939
+ sectionId: string;
940
+ results: Record<string, unknown>;
941
+ }) => void;
942
+ currentStep: import('../../../../../core/src/index.ts').FormStepConfig | import('../../../../../core/src/index.ts').TemplateStepConfig;
943
+ currentStepId: string;
944
+ currentStepIndex: number;
945
+ data: FormData;
946
+ errors: FormErrors;
947
+ isValid: boolean;
948
+ isSubmitting: boolean;
949
+ dirtyFields: Record<string, boolean>;
950
+ touchedFields: Record<string, boolean>;
951
+ isFirstStep: boolean;
952
+ isLastStep: boolean;
953
+ steps: (import('../../../../../core/src/index.ts').FormStepConfig | import('../../../../../core/src/index.ts').TemplateStepConfig)[];
954
+ config: FormWizardConfig;
955
+ validationEngine: ValidationEngine;
956
+ findComponentById: (componentId: string) => ComponentConfig | null;
957
+ setFieldError: (componentId: string, message: string) => void;
958
+ clearFieldError: (componentId: string) => void;
959
+ setData: (key: string, value: FormFieldValue) => void;
960
+ validateField: (componentId: string) => boolean;
961
+ validateSection: (sectionId: string) => boolean;
962
+ validateStep: (stepId: string) => Promise<boolean>;
963
+ validateForm: () => Promise<boolean>;
964
+ nextStep: () => void;
965
+ previousStep: () => void;
966
+ goToStep: (stepId: string) => void;
967
+ submitForm: () => Promise<void>;
968
+ resetForm: () => void;
969
+ startSectionEdit: (sectionId: string, componentIds: string[]) => void;
970
+ cancelSectionEdit: (sectionId: string) => void;
971
+ trackFieldChange: (fieldId: string, oldValue: unknown, newValue: unknown) => void;
972
+ getFieldChanges: (fieldId?: string) => FieldChangeState | Record<string, FieldChangeState>;
973
+ clearFieldChanges: (fieldId?: string) => void;
974
+ showFieldWarning: (fieldId: string, warning: FieldWarning) => void;
975
+ dismissFieldWarning: (fieldId: string, warningId?: string) => void;
976
+ getFieldWarnings: (fieldId: string) => FieldWarning[];
977
+ startFieldVerification: (fieldId: string, config: VerificationConfig) => Promise<VerificationStatus>;
978
+ getVerificationStatus: (fieldId: string) => VerificationStatus | null;
979
+ hasActiveWarnings: boolean;
980
+ hasPendingVerifications: boolean;
981
+ hasFieldChanges: boolean;
982
+ fieldChangeState: Record<string, FieldChangeState>;
983
+ fieldValidationState: import('../../../../../core/src/index.ts').FieldValidationState;
984
+ evaluateComponentTriggers: (componentId: string, eventType: "valueChange" | "focus" | "blur", value?: unknown) => void;
985
+ setComponentOriginalValue: (componentId: string, value: unknown, source?: "initialized" | "api_populated" | "user_reset") => void;
986
+ markComponentAsPopulated: (componentId: string, value: unknown) => void;
987
+ getComponentOriginalValue: (componentId: string) => unknown;
988
+ isComponentDirty: (componentId: string, currentValue: unknown) => boolean;
989
+ getComponentAlerts: (componentId: string) => ComponentAlert[];
990
+ dismissComponentAlert: (componentId: string, alertId?: string) => void;
991
+ resetFieldDirtyState: (form: {
992
+ getFieldValue: (id: string) => unknown;
993
+ resetField: (id: string) => void;
994
+ setFieldValue: (id: string, value: unknown, options?: {
995
+ dontUpdateMeta?: boolean;
996
+ }) => void;
997
+ }, componentId: string) => void;
998
+ hasComponentTriggers: (componentId: string) => boolean;
999
+ hasComponentActions: (componentId: string) => boolean;
1000
+ getComponentTriggerState: (componentId: string) => {
1001
+ triggers: import('../../../../../core/src/index.ts').ComponentTrigger[];
1002
+ triggerStates: Record<string, unknown>;
1003
+ activeActions: import('./types').ComponentActionExecution[];
1004
+ alerts: ComponentAlert[];
1005
+ };
1006
+ componentTriggerState: Record<string, import('./types').ComponentTriggerState>;
1007
+ activeComponentActions: Record<string, import('./types').ComponentActionExecution[]>;
1008
+ componentAlerts: Record<string, ComponentAlert[]>;
1009
+ componentOriginalValues: Record<string, import('./types').ComponentOriginalValue>;
1010
+ } | null>>;
1011
+ };
1012
+ export declare const useFormMachine: () => readonly [import('xstate').MachineSnapshot<import('./types').FormMachineContext, {
1013
+ type: "SET_DATA";
1014
+ key: string;
1015
+ value: FormFieldValue;
1016
+ } | {
1017
+ type: "SET_FIELD_STATE";
1018
+ componentId: string;
1019
+ state: Partial<import('./types').FormMachineContext["fieldStates"][string]>;
1020
+ } | {
1021
+ type: "VALIDATE_FIELD";
1022
+ componentId: string;
1023
+ } | {
1024
+ type: "VALIDATE_SECTION";
1025
+ sectionId: string;
1026
+ } | {
1027
+ type: "VALIDATE_STEP";
1028
+ stepId: string;
1029
+ } | {
1030
+ type: "VALIDATE_FORM";
1031
+ } | {
1032
+ type: "START_SECTION_EDIT";
1033
+ sectionId: string;
1034
+ componentIds: string[];
1035
+ } | {
1036
+ type: "CANCEL_SECTION_EDIT";
1037
+ sectionId: string;
1038
+ } | {
1039
+ type: "NEXT";
1040
+ } | {
1041
+ type: "PREVIOUS";
1042
+ } | {
1043
+ type: "GO_TO_STEP";
1044
+ stepId: string;
1045
+ } | {
1046
+ type: "REQUEST_NAVIGATION";
1047
+ navigationType: "next" | "previous" | "step";
1048
+ stepId?: string;
1049
+ } | {
1050
+ type: "SUBMIT";
1051
+ } | {
1052
+ type: "SUBMIT_SUCCESS";
1053
+ } | {
1054
+ type: "SUBMIT_ERROR";
1055
+ error: Error;
1056
+ } | {
1057
+ type: "RESET";
1058
+ } | {
1059
+ type: "EXECUTE_ACTIONS";
1060
+ trigger: import('../../../../../core/src/index.ts').ActionTrigger;
1061
+ } | {
1062
+ type: "EXECUTE_TRIGGER";
1063
+ trigger: import('../../../../../core/src/index.ts').ActionTrigger;
1064
+ } | {
1065
+ type: "ACTION_START";
1066
+ actionId: string;
1067
+ } | {
1068
+ type: "ACTION_SUCCESS";
1069
+ actionId: string;
1070
+ result: unknown;
1071
+ } | {
1072
+ type: "ACTION_ERROR";
1073
+ actionId: string;
1074
+ error: Error;
1075
+ } | {
1076
+ type: "ACTIONS_COMPLETED";
1077
+ results: Record<string, unknown>;
1078
+ } | {
1079
+ type: "SHOW_ACTION_DIALOG";
1080
+ dialogConfig: import('../../../../../core/src/index.ts').DialogConfig;
1081
+ } | {
1082
+ type: "HIDE_ACTION_DIALOG";
1083
+ } | {
1084
+ type: "DIALOG_BUTTON_CLICK";
1085
+ buttonAction: string;
1086
+ } | {
1087
+ type: "FIELD_CHANGED";
1088
+ fieldId: string;
1089
+ oldValue: unknown;
1090
+ newValue: unknown;
1091
+ } | {
1092
+ type: "TRIGGER_FIELD_WARNING";
1093
+ fieldId: string;
1094
+ warning: FieldWarning;
1095
+ } | {
1096
+ type: "DISMISS_FIELD_WARNING";
1097
+ fieldId: string;
1098
+ warningId?: string;
1099
+ } | {
1100
+ type: "SHOW_FIELD_WARNING";
1101
+ fieldId: string;
1102
+ warningId: string;
1103
+ message: string;
1104
+ warningType?: "warning" | "error" | "info";
1105
+ } | {
1106
+ type: "START_FIELD_VERIFICATION";
1107
+ fieldId: string;
1108
+ config: VerificationConfig;
1109
+ } | {
1110
+ type: "FIELD_VERIFICATION_COMPLETE";
1111
+ fieldId: string;
1112
+ result: unknown;
1113
+ success: boolean;
1114
+ } | {
1115
+ type: "CLEAR_FIELD_CHANGES";
1116
+ fieldId?: string;
1117
+ } | {
1118
+ type: "EVALUATE_COMPONENT_TRIGGERS";
1119
+ componentId: string;
1120
+ eventType: "valueChange" | "focus" | "blur";
1121
+ value?: unknown;
1122
+ } | {
1123
+ type: "TRIGGER_COMPONENT_ACTION";
1124
+ componentId: string;
1125
+ triggerId: string;
1126
+ actionId: string;
1127
+ eventType?: "valueChange" | "focus" | "blur" | "navigationAttempt" | "sectionSave";
1128
+ } | {
1129
+ type: "COMPONENT_ACTION_START";
1130
+ componentId: string;
1131
+ actionId: string;
1132
+ } | {
1133
+ type: "COMPONENT_ACTION_COMPLETE";
1134
+ componentId: string;
1135
+ actionId: string;
1136
+ result?: unknown;
1137
+ } | {
1138
+ type: "COMPONENT_ACTION_FAILED";
1139
+ componentId: string;
1140
+ actionId: string;
1141
+ error: Error;
1142
+ } | {
1143
+ type: "SHOW_COMPONENT_ALERT";
1144
+ componentId: string;
1145
+ alert: ComponentAlert;
1146
+ } | {
1147
+ type: "DISMISS_COMPONENT_ALERT";
1148
+ componentId: string;
1149
+ alertId?: string;
1150
+ } | {
1151
+ type: "CLEAR_COMPONENT_ALERT";
1152
+ componentId: string;
1153
+ } | {
1154
+ type: "SET_COMPONENT_ORIGINAL_VALUE";
1155
+ componentId: string;
1156
+ value: unknown;
1157
+ source?: "initialized" | "api_populated" | "user_reset" | "user_verified" | "edit_start";
1158
+ } | {
1159
+ type: "MARK_COMPONENT_AS_POPULATED";
1160
+ componentId: string;
1161
+ value: unknown;
1162
+ } | {
1163
+ type: "EXECUTE_CONTEXT_ACTION";
1164
+ execution: import('./componentTriggerEngine').TriggerExecution;
1165
+ action: import('../../../../../core/src/index.ts').ComponentAction;
1166
+ } | {
1167
+ type: "CONTEXT_ACTION_COMPLETE";
1168
+ componentId: string;
1169
+ actionId: string;
1170
+ result: unknown;
1171
+ } | {
1172
+ type: "CONTEXT_ACTIONS_COMPLETE";
1173
+ results?: Record<string, unknown>;
1174
+ } | {
1175
+ type: "EXECUTE_CONTEXT_ACTIONS";
1176
+ executionPlan: import('./componentTriggerEngine').ContextExecutionPlan;
1177
+ } | {
1178
+ type: "EXECUTE_FIELD_CHANGE_ACTIONS";
1179
+ executionPlan: import('./componentTriggerEngine').ContextExecutionPlan;
1180
+ componentId: string;
1181
+ eventType: string;
1182
+ value: unknown;
1183
+ } | {
1184
+ type: "SHOW_DIALOG";
1185
+ dialog: import('../../../../../core/src/index.ts').DialogConfig;
1186
+ } | {
1187
+ type: "TRIGGER_ACTIONS_COMPLETE";
1188
+ } | {
1189
+ type: "DIALOG_VERIFIED";
1190
+ } | {
1191
+ type: "DIALOG_CANCELLED";
1192
+ } | {
1193
+ type: "RESET_FIELD_TANSTACK_STATE";
1194
+ componentId: string;
1195
+ form?: import('./types').MinimalFormApi;
1196
+ } | {
1197
+ type: "UPDATE_COMPONENT_ORIGINAL_VALUE";
1198
+ componentId: string;
1199
+ } | {
1200
+ type: "COMPONENT_ACTION_ERROR";
1201
+ componentId: string;
1202
+ actionId: string;
1203
+ error: Error;
1204
+ } | {
1205
+ type: "START_SAVE";
1206
+ initiator: "sectionButton" | "navigation";
1207
+ sectionId: string;
1208
+ } | {
1209
+ type: "SAVE_VALIDATION_SUCCESS";
1210
+ sectionId: string;
1211
+ executionPlan: import('./componentTriggerEngine').ContextExecutionPlan;
1212
+ } | {
1213
+ type: "SAVE_VALIDATION_FAILED";
1214
+ sectionId: string;
1215
+ errors: Record<string, string[]>;
1216
+ } | {
1217
+ type: "SAVE_DIALOG_SHOWN";
1218
+ componentId: string;
1219
+ actionId: string;
1220
+ dialogId: string;
1221
+ } | {
1222
+ type: "SAVE_ACTIONS_COMPLETE";
1223
+ sectionId: string;
1224
+ results: Record<string, unknown>;
1225
+ }, Record<string, import('xstate').AnyActorRef>, import('xstate').StateValue, string, import('xstate').NonReducibleUnknown, import('xstate').MetaObject, any>, (event: {
1226
+ type: "SET_DATA";
1227
+ key: string;
1228
+ value: FormFieldValue;
1229
+ } | {
1230
+ type: "SET_FIELD_STATE";
1231
+ componentId: string;
1232
+ state: Partial<import('./types').FormMachineContext["fieldStates"][string]>;
1233
+ } | {
1234
+ type: "VALIDATE_FIELD";
1235
+ componentId: string;
1236
+ } | {
1237
+ type: "VALIDATE_SECTION";
1238
+ sectionId: string;
1239
+ } | {
1240
+ type: "VALIDATE_STEP";
1241
+ stepId: string;
1242
+ } | {
1243
+ type: "VALIDATE_FORM";
1244
+ } | {
1245
+ type: "START_SECTION_EDIT";
1246
+ sectionId: string;
1247
+ componentIds: string[];
1248
+ } | {
1249
+ type: "CANCEL_SECTION_EDIT";
1250
+ sectionId: string;
1251
+ } | {
1252
+ type: "NEXT";
1253
+ } | {
1254
+ type: "PREVIOUS";
1255
+ } | {
1256
+ type: "GO_TO_STEP";
1257
+ stepId: string;
1258
+ } | {
1259
+ type: "REQUEST_NAVIGATION";
1260
+ navigationType: "next" | "previous" | "step";
1261
+ stepId?: string;
1262
+ } | {
1263
+ type: "SUBMIT";
1264
+ } | {
1265
+ type: "SUBMIT_SUCCESS";
1266
+ } | {
1267
+ type: "SUBMIT_ERROR";
1268
+ error: Error;
1269
+ } | {
1270
+ type: "RESET";
1271
+ } | {
1272
+ type: "EXECUTE_ACTIONS";
1273
+ trigger: import('../../../../../core/src/index.ts').ActionTrigger;
1274
+ } | {
1275
+ type: "EXECUTE_TRIGGER";
1276
+ trigger: import('../../../../../core/src/index.ts').ActionTrigger;
1277
+ } | {
1278
+ type: "ACTION_START";
1279
+ actionId: string;
1280
+ } | {
1281
+ type: "ACTION_SUCCESS";
1282
+ actionId: string;
1283
+ result: unknown;
1284
+ } | {
1285
+ type: "ACTION_ERROR";
1286
+ actionId: string;
1287
+ error: Error;
1288
+ } | {
1289
+ type: "ACTIONS_COMPLETED";
1290
+ results: Record<string, unknown>;
1291
+ } | {
1292
+ type: "SHOW_ACTION_DIALOG";
1293
+ dialogConfig: import('../../../../../core/src/index.ts').DialogConfig;
1294
+ } | {
1295
+ type: "HIDE_ACTION_DIALOG";
1296
+ } | {
1297
+ type: "DIALOG_BUTTON_CLICK";
1298
+ buttonAction: string;
1299
+ } | {
1300
+ type: "FIELD_CHANGED";
1301
+ fieldId: string;
1302
+ oldValue: unknown;
1303
+ newValue: unknown;
1304
+ } | {
1305
+ type: "TRIGGER_FIELD_WARNING";
1306
+ fieldId: string;
1307
+ warning: FieldWarning;
1308
+ } | {
1309
+ type: "DISMISS_FIELD_WARNING";
1310
+ fieldId: string;
1311
+ warningId?: string;
1312
+ } | {
1313
+ type: "SHOW_FIELD_WARNING";
1314
+ fieldId: string;
1315
+ warningId: string;
1316
+ message: string;
1317
+ warningType?: "warning" | "error" | "info";
1318
+ } | {
1319
+ type: "START_FIELD_VERIFICATION";
1320
+ fieldId: string;
1321
+ config: VerificationConfig;
1322
+ } | {
1323
+ type: "FIELD_VERIFICATION_COMPLETE";
1324
+ fieldId: string;
1325
+ result: unknown;
1326
+ success: boolean;
1327
+ } | {
1328
+ type: "CLEAR_FIELD_CHANGES";
1329
+ fieldId?: string;
1330
+ } | {
1331
+ type: "EVALUATE_COMPONENT_TRIGGERS";
1332
+ componentId: string;
1333
+ eventType: "valueChange" | "focus" | "blur";
1334
+ value?: unknown;
1335
+ } | {
1336
+ type: "TRIGGER_COMPONENT_ACTION";
1337
+ componentId: string;
1338
+ triggerId: string;
1339
+ actionId: string;
1340
+ eventType?: "valueChange" | "focus" | "blur" | "navigationAttempt" | "sectionSave";
1341
+ } | {
1342
+ type: "COMPONENT_ACTION_START";
1343
+ componentId: string;
1344
+ actionId: string;
1345
+ } | {
1346
+ type: "COMPONENT_ACTION_COMPLETE";
1347
+ componentId: string;
1348
+ actionId: string;
1349
+ result?: unknown;
1350
+ } | {
1351
+ type: "COMPONENT_ACTION_FAILED";
1352
+ componentId: string;
1353
+ actionId: string;
1354
+ error: Error;
1355
+ } | {
1356
+ type: "SHOW_COMPONENT_ALERT";
1357
+ componentId: string;
1358
+ alert: ComponentAlert;
1359
+ } | {
1360
+ type: "DISMISS_COMPONENT_ALERT";
1361
+ componentId: string;
1362
+ alertId?: string;
1363
+ } | {
1364
+ type: "CLEAR_COMPONENT_ALERT";
1365
+ componentId: string;
1366
+ } | {
1367
+ type: "SET_COMPONENT_ORIGINAL_VALUE";
1368
+ componentId: string;
1369
+ value: unknown;
1370
+ source?: "initialized" | "api_populated" | "user_reset" | "user_verified" | "edit_start";
1371
+ } | {
1372
+ type: "MARK_COMPONENT_AS_POPULATED";
1373
+ componentId: string;
1374
+ value: unknown;
1375
+ } | {
1376
+ type: "EXECUTE_CONTEXT_ACTION";
1377
+ execution: import('./componentTriggerEngine').TriggerExecution;
1378
+ action: import('../../../../../core/src/index.ts').ComponentAction;
1379
+ } | {
1380
+ type: "CONTEXT_ACTION_COMPLETE";
1381
+ componentId: string;
1382
+ actionId: string;
1383
+ result: unknown;
1384
+ } | {
1385
+ type: "CONTEXT_ACTIONS_COMPLETE";
1386
+ results?: Record<string, unknown>;
1387
+ } | {
1388
+ type: "EXECUTE_CONTEXT_ACTIONS";
1389
+ executionPlan: import('./componentTriggerEngine').ContextExecutionPlan;
1390
+ } | {
1391
+ type: "EXECUTE_FIELD_CHANGE_ACTIONS";
1392
+ executionPlan: import('./componentTriggerEngine').ContextExecutionPlan;
1393
+ componentId: string;
1394
+ eventType: string;
1395
+ value: unknown;
1396
+ } | {
1397
+ type: "SHOW_DIALOG";
1398
+ dialog: import('../../../../../core/src/index.ts').DialogConfig;
1399
+ } | {
1400
+ type: "TRIGGER_ACTIONS_COMPLETE";
1401
+ } | {
1402
+ type: "DIALOG_VERIFIED";
1403
+ } | {
1404
+ type: "DIALOG_CANCELLED";
1405
+ } | {
1406
+ type: "RESET_FIELD_TANSTACK_STATE";
1407
+ componentId: string;
1408
+ form?: import('./types').MinimalFormApi;
1409
+ } | {
1410
+ type: "UPDATE_COMPONENT_ORIGINAL_VALUE";
1411
+ componentId: string;
1412
+ } | {
1413
+ type: "COMPONENT_ACTION_ERROR";
1414
+ componentId: string;
1415
+ actionId: string;
1416
+ error: Error;
1417
+ } | {
1418
+ type: "START_SAVE";
1419
+ initiator: "sectionButton" | "navigation";
1420
+ sectionId: string;
1421
+ } | {
1422
+ type: "SAVE_VALIDATION_SUCCESS";
1423
+ sectionId: string;
1424
+ executionPlan: import('./componentTriggerEngine').ContextExecutionPlan;
1425
+ } | {
1426
+ type: "SAVE_VALIDATION_FAILED";
1427
+ sectionId: string;
1428
+ errors: Record<string, string[]>;
1429
+ } | {
1430
+ type: "SAVE_DIALOG_SHOWN";
1431
+ componentId: string;
1432
+ actionId: string;
1433
+ dialogId: string;
1434
+ } | {
1435
+ type: "SAVE_ACTIONS_COMPLETE";
1436
+ sectionId: string;
1437
+ results: Record<string, unknown>;
1438
+ }) => void, {
1439
+ currentStep: import('../../../../../core/src/index.ts').FormStepConfig | import('../../../../../core/src/index.ts').TemplateStepConfig;
1440
+ currentStepId: string;
1441
+ currentStepIndex: number;
1442
+ data: FormData;
1443
+ errors: FormErrors;
1444
+ isValid: boolean;
1445
+ isSubmitting: boolean;
1446
+ dirtyFields: Record<string, boolean>;
1447
+ touchedFields: Record<string, boolean>;
1448
+ isFirstStep: boolean;
1449
+ isLastStep: boolean;
1450
+ steps: (import('../../../../../core/src/index.ts').FormStepConfig | import('../../../../../core/src/index.ts').TemplateStepConfig)[];
1451
+ config: FormWizardConfig;
1452
+ validationEngine: ValidationEngine;
1453
+ findComponentById: (componentId: string) => ComponentConfig | null;
1454
+ setFieldError: (componentId: string, message: string) => void;
1455
+ clearFieldError: (componentId: string) => void;
1456
+ setData: (key: string, value: FormFieldValue) => void;
1457
+ validateField: (componentId: string) => boolean;
1458
+ validateSection: (sectionId: string) => boolean;
1459
+ validateStep: (stepId: string) => Promise<boolean>;
1460
+ validateForm: () => Promise<boolean>;
1461
+ nextStep: () => void;
1462
+ previousStep: () => void;
1463
+ goToStep: (stepId: string) => void;
1464
+ submitForm: () => Promise<void>;
1465
+ resetForm: () => void;
1466
+ startSectionEdit: (sectionId: string, componentIds: string[]) => void;
1467
+ cancelSectionEdit: (sectionId: string) => void;
1468
+ trackFieldChange: (fieldId: string, oldValue: unknown, newValue: unknown) => void;
1469
+ getFieldChanges: (fieldId?: string) => FieldChangeState | Record<string, FieldChangeState>;
1470
+ clearFieldChanges: (fieldId?: string) => void;
1471
+ showFieldWarning: (fieldId: string, warning: FieldWarning) => void;
1472
+ dismissFieldWarning: (fieldId: string, warningId?: string) => void;
1473
+ getFieldWarnings: (fieldId: string) => FieldWarning[];
1474
+ startFieldVerification: (fieldId: string, config: VerificationConfig) => Promise<VerificationStatus>;
1475
+ getVerificationStatus: (fieldId: string) => VerificationStatus | null;
1476
+ hasActiveWarnings: boolean;
1477
+ hasPendingVerifications: boolean;
1478
+ hasFieldChanges: boolean;
1479
+ fieldChangeState: Record<string, FieldChangeState>;
1480
+ fieldValidationState: import('../../../../../core/src/index.ts').FieldValidationState;
1481
+ evaluateComponentTriggers: (componentId: string, eventType: "valueChange" | "focus" | "blur", value?: unknown) => void;
1482
+ setComponentOriginalValue: (componentId: string, value: unknown, source?: "initialized" | "api_populated" | "user_reset") => void;
1483
+ markComponentAsPopulated: (componentId: string, value: unknown) => void;
1484
+ getComponentOriginalValue: (componentId: string) => unknown;
1485
+ isComponentDirty: (componentId: string, currentValue: unknown) => boolean;
1486
+ getComponentAlerts: (componentId: string) => ComponentAlert[];
1487
+ dismissComponentAlert: (componentId: string, alertId?: string) => void;
1488
+ resetFieldDirtyState: (form: {
1489
+ getFieldValue: (id: string) => unknown;
1490
+ resetField: (id: string) => void;
1491
+ setFieldValue: (id: string, value: unknown, options?: {
1492
+ dontUpdateMeta?: boolean;
1493
+ }) => void;
1494
+ }, componentId: string) => void;
1495
+ hasComponentTriggers: (componentId: string) => boolean;
1496
+ hasComponentActions: (componentId: string) => boolean;
1497
+ getComponentTriggerState: (componentId: string) => {
1498
+ triggers: import('../../../../../core/src/index.ts').ComponentTrigger[];
1499
+ triggerStates: Record<string, unknown>;
1500
+ activeActions: import('./types').ComponentActionExecution[];
1501
+ alerts: ComponentAlert[];
1502
+ };
1503
+ componentTriggerState: Record<string, import('./types').ComponentTriggerState>;
1504
+ activeComponentActions: Record<string, import('./types').ComponentActionExecution[]>;
1505
+ componentAlerts: Record<string, ComponentAlert[]>;
1506
+ componentOriginalValues: Record<string, import('./types').ComponentOriginalValue>;
1507
+ }];
1508
+ export default useFormMachine;