@digiform/wizard 0.3.0 → 0.3.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 (89) hide show
  1. package/core/src/types/guards.js +0 -12
  2. package/core/src/utils/apiBodyUtils.js +43 -75
  3. package/features/form-runtime/components/FormFooter.d.ts +5 -0
  4. package/features/form-runtime/hooks/useValidationEvents.d.ts +0 -1
  5. package/features/state-management/machines/formMachine.d.ts +3 -0
  6. package/features/state-management/machines/types.d.ts +4 -0
  7. package/features/state-management/machines/useFormMachine.d.ts +18 -0
  8. package/index.d.ts +2 -8
  9. package/index.js +2 -108
  10. package/package.json +1 -30
  11. package/styles.css +1 -1
  12. package/ui/src/lib/utils/templateUtils.js +11 -43
  13. package/wizard/src/features/api-integration/services/ApiCallService.js +65 -74
  14. package/wizard/src/features/dialog-system/components/ActionDialog/ActionDialog.js +39 -43
  15. package/wizard/src/features/dialog-system/components/ConfirmationDialog/ConfirmationDialog.js +37 -41
  16. package/wizard/src/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.js +44 -45
  17. package/wizard/src/features/form-runtime/FormWizard/FormWizard.js +56 -78
  18. package/wizard/src/features/form-runtime/components/FormField.js +28 -28
  19. package/wizard/src/features/form-runtime/components/FormFooter.js +53 -184
  20. package/wizard/src/features/form-runtime/components/FormSection/FormSection.js +152 -196
  21. package/wizard/src/features/form-runtime/components/FormStep/FormStep.js +82 -91
  22. package/wizard/src/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.js +24 -30
  23. package/wizard/src/features/form-runtime/config/configResolver.js +10 -14
  24. package/wizard/src/features/form-runtime/config/templateLoader.js +71 -108
  25. package/wizard/src/features/form-runtime/hooks/useComponentTriggers.js +45 -88
  26. package/wizard/src/features/form-runtime/hooks/useFieldEventHandlers.js +27 -41
  27. package/wizard/src/features/form-runtime/hooks/useFormFieldState.js +5 -5
  28. package/wizard/src/features/form-runtime/hooks/useValidationEvents.js +22 -25
  29. package/wizard/src/features/form-runtime/utils/errorUtils.js +31 -42
  30. package/wizard/src/features/form-runtime/utils/formDirtyStateSync.js +26 -37
  31. package/wizard/src/features/form-runtime/utils/logger.js +12 -12
  32. package/wizard/src/features/form-runtime/utils/validationUX.js +14 -55
  33. package/wizard/src/features/state-management/machines/actions/navigationActions.js +13 -8
  34. package/wizard/src/features/state-management/machines/componentTriggerEngine.js +167 -432
  35. package/wizard/src/features/state-management/machines/formMachine.js +558 -677
  36. package/wizard/src/features/state-management/machines/useFormMachine.js +172 -190
  37. package/wizard/src/features/trigger-action-system/components/ActionManager.js +35 -86
  38. package/wizard/src/features/validation-system/validation/SchemaBuilder.js +28 -82
  39. package/wizard/src/features/validation-system/validation/ValidationCache.js +11 -27
  40. package/wizard/src/features/validation-system/validation/ValidationEngine.js +24 -29
  41. package/wizard/src/features/validation-system/validation/ValidationExecutor.js +26 -58
  42. package/FormWizard.d.ts +0 -10
  43. package/core/src/types/api.js +0 -12
  44. package/core/src/types/form-config.js +0 -60
  45. package/core/src/types/form-wizard-config-schema.js +0 -113
  46. package/core/src/types/validation.js +0 -61
  47. package/features/api-integration.d.ts +0 -2
  48. package/features/api-integration.js +0 -17
  49. package/features/dialog-system.d.ts +0 -2
  50. package/features/dialog-system.js +0 -9
  51. package/features/form-runtime/utils/formSaver.d.ts +0 -22
  52. package/features/form-runtime.d.ts +0 -2
  53. package/features/form-runtime.js +0 -63
  54. package/features/index.d.ts +0 -11
  55. package/features/state-management/components/ValidationBuilder/ValidationBuilder.d.ts +0 -9
  56. package/features/state-management/machines/__tests__/setup.d.ts +0 -0
  57. package/features/state-management/machines/__tests__/vitest.config.d.ts +0 -2
  58. package/features/state-management/machines/actions/validationActions.d.ts +0 -68
  59. package/features/state-management/machines/lazyLoading.d.ts +0 -34
  60. package/features/state-management/machines/validation/index.d.ts +0 -5
  61. package/features/state-management/machines/validation/validateField.d.ts +0 -2
  62. package/features/state-management/machines/validation/validateForm.d.ts +0 -2
  63. package/features/state-management/machines/validation/validateSection.d.ts +0 -2
  64. package/features/state-management/machines/validation/validateStep.d.ts +0 -2
  65. package/features/state-management/machines/validation/validationTypes.d.ts +0 -1
  66. package/features/state-management.d.ts +0 -2
  67. package/features/state-management.js +0 -21
  68. package/features/trigger-action-system/components/FieldWarning/FieldWarning.d.ts +0 -20
  69. package/features/trigger-action-system.d.ts +0 -2
  70. package/features/trigger-action-system.js +0 -12
  71. package/features/validation-system.d.ts +0 -2
  72. package/features/validation-system.js +0 -23
  73. package/styles/index.d.ts +0 -0
  74. package/ui/src/components/badge/badge.js +0 -20
  75. package/ui/src/components/badge/badge.module.css.js +0 -12
  76. package/wizard/src/features/api-integration/services/ActionExecutor.js +0 -339
  77. package/wizard/src/features/api-integration/services/ApiCallExecutor.js +0 -6
  78. package/wizard/src/features/api-integration/services/DialogExecutor.js +0 -6
  79. package/wizard/src/features/api-integration/services/GenericTriggerService.js +0 -284
  80. package/wizard/src/features/api-integration/services/NavigationExecutor.js +0 -6
  81. package/wizard/src/features/form-runtime/config/templateConfig.js +0 -156
  82. package/wizard/src/features/form-runtime/config/templateUtils.js +0 -14
  83. package/wizard/src/features/form-runtime/utils/validation.js +0 -100
  84. package/wizard/src/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.js +0 -46
  85. package/wizard/src/features/trigger-action-system/components/ActionLoadingIndicator/ActionLoadingIndicator.module.css.js +0 -30
  86. package/wizard/src/features/trigger-action-system/utils/GenericTriggerEngine.js +0 -376
  87. package/wizard/src/features/validation-system/components/ValidationDebugger.js +0 -69
  88. package/wizard/src/features/validation-system/validation/tanstackSchemaAdapter.js +0 -17
  89. package/wizard/src/features/validation-system/validation/validationService.js +0 -74
@@ -1,108 +1,57 @@
1
1
  "use client";
2
- import { jsxs as s, jsx as r } from "react/jsx-runtime";
3
- import { ActionDialog as d } from "../../dialog-system/components/ActionDialog/ActionDialog.js";
4
- import { useFormMachine as p } from "../../state-management/machines/useFormMachine.js";
5
- import { memo as I } from "react";
6
- const D = I(({ className: g = "" }) => {
7
- const [i, a] = p(), { context: n } = i, l = (e) => {
8
- switch (console.log("🔥 ActionManager: Dialog button clicked!", e), console.log("🔥 ActionManager: Button action type:", e.type), e.type) {
2
+ import { jsxs as o, jsx as O } from "react/jsx-runtime";
3
+ import { memo as D } from "react";
4
+ import { useFormMachine as g } from "../../state-management/machines/useFormMachine.js";
5
+ import { ActionDialog as c } from "../../dialog-system/components/ActionDialog/ActionDialog.js";
6
+ const d = D(({ className: n = "" }) => {
7
+ const [t, e] = g(), { context: i } = t, s = (a) => {
8
+ switch (a.type) {
9
9
  case "close":
10
- console.log("🔥 ActionManager: Executing CLOSE action"), n.pendingNavigation ? (console.log(
11
- "🔥 ActionManager: Dialog cancelled during navigation - sending DIALOG_CANCELLED"
12
- ), a({ type: "DIALOG_CANCELLED" })) : a({ type: "HIDE_ACTION_DIALOG" });
10
+ i.pendingNavigation ? e({ type: "DIALOG_CANCELLED" }) : e({ type: "HIDE_ACTION_DIALOG" });
13
11
  break;
14
12
  case "navigate":
15
- e.type === "navigate" && console.log("🔥 ActionManager: Executing NAVIGATE action", {
16
- direction: e.direction,
17
- targetStep: e.targetStep,
18
- currentStep: n.currentStepIndex,
19
- updateOriginalValue: e.updateOriginalValue,
20
- componentId: e.componentId
21
- }), e.type === "navigate" && e.updateOriginalValue && e.componentId && (console.log(
22
- "🔥 ActionManager: Updating original value before navigation"
23
- ), a({
13
+ a.type, a.type === "navigate" && a.updateOriginalValue && a.componentId && e({
24
14
  type: "UPDATE_COMPONENT_ORIGINAL_VALUE",
25
- componentId: e.componentId
26
- })), n.pendingNavigation ? (console.log(
27
- "🔥 ActionManager: Dialog verified during navigation - sending DIALOG_VERIFIED"
28
- ), a({ type: "DIALOG_VERIFIED" })) : e.type === "navigate" && (e.direction === "next" ? (console.log("🔥 ActionManager: Sending NEXT event to machine"), a({ type: "NEXT" })) : e.direction === "previous" ? (console.log(
29
- "🔥 ActionManager: Sending PREVIOUS event to machine"
30
- ), a({ type: "PREVIOUS" })) : e.targetStep && (console.log(
31
- "🔥 ActionManager: Sending GO_TO_STEP event to machine"
32
- ), a({ type: "GO_TO_STEP", stepId: e.targetStep })));
15
+ componentId: a.componentId
16
+ }), i.pendingNavigation ? e({ type: "DIALOG_VERIFIED" }) : a.type === "navigate" && (a.direction === "next" ? e({ type: "NEXT" }) : a.direction === "previous" ? e({ type: "PREVIOUS" }) : a.targetStep && e({ type: "GO_TO_STEP", stepId: a.targetStep }));
33
17
  break;
34
18
  case "custom":
35
- console.log("🔥 ActionManager: Executing CUSTOM action", e), e.type === "custom" && e.handler === "updateOriginalValue" && e.componentId ? (console.log(
36
- "🔥 ActionManager: Executing updateOriginalValue handler",
37
- {
38
- componentId: e.componentId,
39
- pendingNavigation: n.pendingNavigation,
40
- saveState: n.saveState,
41
- isInSaveContext: n.saveState.savingSection !== null
42
- }
43
- ), a({
19
+ a.type === "custom" && a.handler === "updateOriginalValue" && a.componentId ? (e({
44
20
  type: "UPDATE_COMPONENT_ORIGINAL_VALUE",
45
- componentId: e.componentId
46
- }), n.saveState.savingSection !== null ? (console.log(
47
- "🔥 ActionManager: updateOriginalValue in SAVE context - hiding dialog without navigation"
48
- ), a({ type: "HIDE_ACTION_DIALOG" })) : (console.log(
49
- "🔥 ActionManager: updateOriginalValue in non-save context - hiding dialog"
50
- ), a({ type: "HIDE_ACTION_DIALOG" }))) : (console.warn(
21
+ componentId: a.componentId
22
+ }), i.saveState.savingSection !== null ? e({ type: "HIDE_ACTION_DIALOG" }) : e({ type: "HIDE_ACTION_DIALOG" })) : (console.warn(
51
23
  "Custom dialog action not implemented:",
52
- e.handler
53
- ), a({ type: "HIDE_ACTION_DIALOG" }));
24
+ a.handler
25
+ ), e({ type: "HIDE_ACTION_DIALOG" }));
54
26
  break;
55
27
  case "updateOriginalValue":
56
- console.log(
57
- "🔥 ActionManager: Executing UPDATE_ORIGINAL_VALUE action",
58
- {
59
- componentId: e.componentId,
60
- pendingNavigation: n.pendingNavigation,
61
- saveState: n.saveState,
62
- isInSaveContext: n.saveState.savingSection !== null
63
- }
64
- ), a({
28
+ e({
65
29
  type: "UPDATE_COMPONENT_ORIGINAL_VALUE",
66
- componentId: e.componentId
67
- }), n.saveState.savingSection !== null ? (console.log(
68
- "🔥 ActionManager: Update original value in SAVE context - hiding dialog without navigation"
69
- ), a({ type: "HIDE_ACTION_DIALOG" })) : n.pendingNavigation ? (console.log(
70
- "🔥 ActionManager: Update original value verified during navigation - sending DIALOG_VERIFIED"
71
- ), a({ type: "DIALOG_VERIFIED" })) : a({ type: "HIDE_ACTION_DIALOG" });
30
+ componentId: a.componentId
31
+ }), i.saveState.savingSection !== null ? e({ type: "HIDE_ACTION_DIALOG" }) : i.pendingNavigation ? e({ type: "DIALOG_VERIFIED" }) : e({ type: "HIDE_ACTION_DIALOG" });
72
32
  break;
73
33
  default:
74
- console.log("🔥 ActionManager: Unknown action type, hiding dialog"), a({ type: "HIDE_ACTION_DIALOG" });
34
+ e({ type: "HIDE_ACTION_DIALOG" });
75
35
  }
76
- }, c = () => {
77
- n.pendingNavigation ? (console.log(
78
- "🔥 ActionManager: Dialog closed during navigation - sending DIALOG_CANCELLED"
79
- ), a({ type: "DIALOG_CANCELLED" })) : a({ type: "HIDE_ACTION_DIALOG" });
80
- }, o = i.matches("showingActionDialog") && n.activeDialog !== null, t = i.matches("executingActions");
81
- return console.log(" ActionManager state:", {
82
- currentState: i.value,
83
- isDialogOpen: o,
84
- isExecutingActions: t,
85
- activeDialog: n.activeDialog,
86
- executingTrigger: n.executingTrigger
87
- }), i.matches("showingActionDialog") && console.log(" ActionManager: In showingActionDialog state!", {
88
- activeDialog: n.activeDialog,
89
- isDialogOpen: o
90
- }), /* @__PURE__ */ s("div", { className: g, children: [
91
- t && !1,
92
- /* @__PURE__ */ r(
93
- d,
36
+ }, p = () => {
37
+ i.pendingNavigation ? e({ type: "DIALOG_CANCELLED" }) : e({ type: "HIDE_ACTION_DIALOG" });
38
+ }, I = t.matches("showingActionDialog") && i.activeDialog !== null, l = t.matches("executingActions");
39
+ return t.matches("showingActionDialog"), /* @__PURE__ */ o("div", { className: n, children: [
40
+ l && !1,
41
+ /* @__PURE__ */ O(
42
+ c,
94
43
  {
95
- config: n.activeDialog,
96
- formData: n.data,
97
- onButtonClick: l,
98
- onClose: c,
99
- isOpen: o
44
+ config: i.activeDialog,
45
+ formData: i.data,
46
+ onButtonClick: s,
47
+ onClose: p,
48
+ isOpen: I
100
49
  }
101
50
  )
102
51
  ] });
103
52
  });
104
- D.displayName = "ActionManager";
53
+ d.displayName = "ActionManager";
105
54
  export {
106
- D as ActionManager,
107
- D as default
55
+ d as ActionManager,
56
+ d as default
108
57
  };
@@ -1,5 +1,5 @@
1
1
  "use client";
2
- import { z as l } from "zod";
2
+ import { z as r } from "zod";
3
3
  class d {
4
4
  messageStyle;
5
5
  secureValidatorConfig;
@@ -10,114 +10,63 @@ class d {
10
10
  * Creates a Zod schema for a component
11
11
  */
12
12
  createComponentSchema(i) {
13
- console.log("🔍 [SchemaBuilder] Creating schema for component:", {
14
- id: i.id,
15
- type: i.type,
16
- validation: i.validation
17
- });
18
13
  let a;
19
14
  switch (i.type) {
20
15
  case "text":
21
16
  case "tel":
22
17
  case "password":
23
18
  case "textarea":
24
- a = l.string();
19
+ a = r.string();
25
20
  break;
26
21
  case "email":
27
- console.log(
28
- `🔍 [SchemaBuilder] Creating EMAIL schema for component ${i.id}`
29
- ), a = l.string().email("Please enter a valid email address"), console.log(
30
- `✅ [SchemaBuilder] Email schema created for component ${i.id}:`,
31
- { schemaType: a.constructor.name }
32
- );
22
+ a = r.string().email("Please enter a valid email address");
33
23
  break;
34
24
  case "number":
35
- a = l.number();
25
+ a = r.number();
36
26
  break;
37
27
  case "checkbox":
38
- a = l.boolean();
28
+ a = r.boolean();
39
29
  break;
40
30
  case "date":
41
31
  case "time":
42
32
  case "datetime-local":
43
- a = l.string();
33
+ a = r.string();
44
34
  break;
45
35
  case "radioGroup":
46
36
  case "radio":
47
37
  case "select":
48
38
  case "dropdown":
49
- a = l.string();
39
+ a = r.string();
50
40
  break;
51
41
  case "range":
52
- a = l.number();
42
+ a = r.number();
53
43
  break;
54
44
  case "file":
55
- a = l.any();
45
+ a = r.any();
56
46
  break;
57
47
  case "hidden":
58
- a = l.string().optional();
48
+ a = r.string().optional();
59
49
  break;
60
50
  default:
61
- a = l.any();
51
+ a = r.any();
62
52
  }
63
53
  if (i.validation) {
64
- const e = i.validation, r = typeof e.required == "object" && e.required !== null ? e.required : null;
65
- if (r && r.value === !0) {
66
- const t = r.message || "This field is required";
67
- console.log(
68
- `🔍 [SchemaBuilder] Applying REQUIRED validation for ${i.id}:`,
69
- {
70
- message: t,
71
- componentType: i.type,
72
- requiredRule: r
73
- }
74
- ), i.type === "text" || i.type === "email" || i.type === "tel" || i.type === "password" || i.type === "textarea" ? (a = a.min(1, t), console.log(
75
- `🔍 [SchemaBuilder] Applied .min(1) for required text field ${i.id}`
76
- )) : (i.type === "radioGroup" || i.type === "radio" || i.type === "select" || i.type === "dropdown") && (a = a.refine(
54
+ const e = i.validation, l = typeof e.required == "object" && e.required !== null ? e.required : null;
55
+ if (l && l.value === !0) {
56
+ const t = l.message || "This field is required";
57
+ i.type === "text" || i.type === "email" || i.type === "tel" || i.type === "password" || i.type === "textarea" ? a = a.min(1, t) : (i.type === "radioGroup" || i.type === "radio" || i.type === "select" || i.type === "dropdown") && (a = a.refine(
77
58
  (s) => s != null && s !== "",
78
59
  {
79
60
  message: t
80
61
  }
81
- ), console.log(
82
- `🔍 [SchemaBuilder] Applied .refine() for required selection field ${i.id}`
83
62
  ));
84
63
  }
85
64
  if (e.minLength) {
86
- console.log(
87
- `🔍 [SchemaBuilder] Processing MINLENGTH validation for ${i.id}:`,
88
- {
89
- validationMinLength: e.minLength,
90
- rawValue: e.minLength.value,
91
- valueType: typeof e.minLength.value
92
- }
93
- );
94
65
  const t = typeof e.minLength.value == "string" ? Number(e.minLength.value) : e.minLength.value;
95
- if (console.log(
96
- `🔍 [SchemaBuilder] Converted minLength value for ${i.id}:`,
97
- {
98
- originalValue: e.minLength.value,
99
- convertedValue: t,
100
- convertedType: typeof t,
101
- isValidNumber: typeof t == "number" && !Number.isNaN(t)
102
- }
103
- ), typeof t == "number" && !Number.isNaN(t)) {
104
- if (a instanceof l.ZodString) {
66
+ if (typeof t == "number" && !Number.isNaN(t)) {
67
+ if (a instanceof r.ZodString) {
105
68
  const s = e.minLength.message || `Must be at least ${t} characters`;
106
- console.log(
107
- `🔍 [SchemaBuilder] Applying MINLENGTH validation for ${i.id}:`,
108
- {
109
- minLengthValue: t,
110
- message: s,
111
- schemaBeforeMinLength: a._def,
112
- schemaType: a.constructor.name
113
- }
114
- ), a = a.min(t, s), console.log(
115
- `🔍 [SchemaBuilder] Applied .min(${t}) for ${i.id}:`,
116
- {
117
- schemaAfterMinLength: a._def,
118
- schemaType: a.constructor.name
119
- }
120
- );
69
+ a = a.min(t, s);
121
70
  }
122
71
  } else
123
72
  console.warn(
@@ -128,7 +77,7 @@ class d {
128
77
  if (e.maxLength) {
129
78
  const t = typeof e.maxLength.value == "string" ? Number(e.maxLength.value) : e.maxLength.value;
130
79
  if (typeof t == "number" && !Number.isNaN(t)) {
131
- if (a instanceof l.ZodString) {
80
+ if (a instanceof r.ZodString) {
132
81
  const s = e.maxLength.message || `Must be no more than ${t} characters`;
133
82
  a = a.max(t, s);
134
83
  }
@@ -138,26 +87,23 @@ class d {
138
87
  e.maxLength.value
139
88
  );
140
89
  }
141
- if (e.pattern && a instanceof l.ZodString) {
90
+ if (e.pattern && a instanceof r.ZodString) {
142
91
  const t = typeof e.pattern == "string" ? { value: e.pattern, message: "Invalid format" } : e.pattern;
143
92
  if (t.value) {
144
93
  const s = t.message || "Invalid format";
145
94
  a = a.regex(new RegExp(t.value), s);
146
95
  }
147
96
  }
148
- if (e.email && i.type !== "email" && a instanceof l.ZodString) {
97
+ if (e.email && i.type !== "email" && a instanceof r.ZodString) {
149
98
  const t = typeof e.email == "boolean" && e.email ? { value: !0, message: "Please enter a valid email address" } : typeof e.email == "object" && e.email !== null ? e.email : null;
150
99
  if (t && (t.value === !0 || typeof e.email == "object" && e.email !== null && !("value" in e.email))) {
151
100
  const n = t?.message || "Please enter a valid email address";
152
101
  a = a.email(n);
153
102
  }
154
103
  }
155
- if (e.email && i.type === "email" && a instanceof l.ZodString) {
104
+ if (e.email && i.type === "email" && a instanceof r.ZodString) {
156
105
  const t = typeof e.email == "boolean" && e.email ? { message: "Please enter a valid email address" } : typeof e.email == "object" && e.email !== null ? e.email : null;
157
- t && t.message && (console.log(
158
- `🔍 [SchemaBuilder] Using custom email validation message for component ${i.id}:`,
159
- { customMessage: t.message }
160
- ), a = l.string().email(t.message));
106
+ t && t.message && (a = r.string().email(t.message));
161
107
  }
162
108
  if (i.type === "number" || i.type === "range") {
163
109
  if (e.min) {
@@ -197,14 +143,14 @@ class d {
197
143
  */
198
144
  createStepSchema(i) {
199
145
  const a = {};
200
- return i.sections?.forEach((o) => {
201
- o.components?.forEach((e) => {
146
+ return i.sections?.forEach((u) => {
147
+ u.components?.forEach((e) => {
202
148
  if (e.type === "button" || e.type === "submit" || e.type === "reset" || e.type === "paragraph" || e.type === "heading" || e.type === "alert")
203
149
  return;
204
- const r = this.createComponentSchema(e);
205
- a[e.id] = r;
150
+ const l = this.createComponentSchema(e);
151
+ a[e.id] = l;
206
152
  });
207
- }), l.object(a);
153
+ }), r.object(a);
208
154
  }
209
155
  /**
210
156
  * Updates the message style
@@ -11,38 +11,22 @@ class s {
11
11
  */
12
12
  getComponentSchema(e) {
13
13
  const c = `component_${e.id}`;
14
- (e.id === "text-i05t2ttw" || e.id === "radioGroup-c5q6aj4v" || e.id === "text-1759502191578-gci6gq1pm") && (console.log(
15
- `🧪 [ValidationCache] CLEARING CACHE for debugging component: ${e.id}`
16
- ), this.componentSchemaCache.delete(c));
17
- const a = this.componentSchemaCache.get(c);
18
- if (a)
19
- return console.log(
20
- `📋 [ValidationCache] Using cached schema for ${e.id}:`,
21
- {
22
- cacheKey: c,
23
- schemaType: a.constructor.name
24
- }
25
- ), a;
26
- console.log(
27
- `🔄 [ValidationCache] Creating new schema for ${e.id}:`,
28
- {
29
- cacheKey: c,
30
- componentType: e.type,
31
- hasValidation: !!e.validation
32
- }
33
- );
34
- const t = this.schemaBuilder.createComponentSchema(e);
35
- return this.componentSchemaCache.set(c, t), t;
14
+ (e.id === "text-i05t2ttw" || e.id === "radioGroup-c5q6aj4v" || e.id === "text-1759502191578-gci6gq1pm") && this.componentSchemaCache.delete(c);
15
+ const t = this.componentSchemaCache.get(c);
16
+ if (t)
17
+ return t;
18
+ const a = this.schemaBuilder.createComponentSchema(e);
19
+ return this.componentSchemaCache.set(c, a), a;
36
20
  }
37
21
  /**
38
22
  * Gets or creates a step schema with caching
39
23
  */
40
24
  getStepSchema(e) {
41
- const c = `step_${e.id}`, a = this.stepSchemaCache.get(c);
42
- if (a)
43
- return a;
44
- const t = this.schemaBuilder.createStepSchema(e);
45
- return this.stepSchemaCache.set(c, t), t;
25
+ const c = `step_${e.id}`, t = this.stepSchemaCache.get(c);
26
+ if (t)
27
+ return t;
28
+ const a = this.schemaBuilder.createStepSchema(e);
29
+ return this.stepSchemaCache.set(c, a), a;
46
30
  }
47
31
  /**
48
32
  * Clears all cached schemas
@@ -1,55 +1,55 @@
1
1
  "use client";
2
- import { SchemaBuilder as d } from "./SchemaBuilder.js";
3
- import { ValidationCache as o } from "./ValidationCache.js";
4
- import { ValidationExecutor as l } from "./ValidationExecutor.js";
5
- class c {
2
+ import { SchemaBuilder as n } from "./SchemaBuilder.js";
3
+ import { ValidationCache as r } from "./ValidationCache.js";
4
+ import { ValidationExecutor as d } from "./ValidationExecutor.js";
5
+ class o {
6
6
  debounceTimers = /* @__PURE__ */ new Map();
7
7
  debounceMs;
8
8
  schemaBuilder;
9
9
  validationExecutor;
10
10
  validationCache;
11
11
  constructor(e = {}) {
12
- this.debounceMs = e.debounceMs || 300, this.schemaBuilder = new d(
12
+ this.debounceMs = e.debounceMs || 300, this.schemaBuilder = new n(
13
13
  e.messageStyle || "withLabel",
14
14
  e.secureValidatorConfig
15
- ), this.validationExecutor = new l(this.schemaBuilder), this.validationCache = new o(this.schemaBuilder);
15
+ ), this.validationExecutor = new d(this.schemaBuilder), this.validationCache = new r(this.schemaBuilder);
16
16
  }
17
17
  /**
18
18
  * Validates a single field with debouncing
19
19
  */
20
- async validateFieldDebounced(e, i) {
21
- return new Promise((a) => {
20
+ async validateFieldDebounced(e, a) {
21
+ return new Promise((i) => {
22
22
  const t = `field_${e.id}`;
23
23
  if (this.debounceTimers.has(t)) {
24
- const n = this.debounceTimers.get(t);
25
- n && clearTimeout(n);
24
+ const s = this.debounceTimers.get(t);
25
+ s && clearTimeout(s);
26
26
  }
27
- const r = setTimeout(() => {
28
- const n = this.validateField(e, i);
29
- this.debounceTimers.delete(t), a(n);
27
+ const c = setTimeout(() => {
28
+ const s = this.validateField(e, a);
29
+ this.debounceTimers.delete(t), i(s);
30
30
  }, this.debounceMs);
31
- this.debounceTimers.set(t, r);
31
+ this.debounceTimers.set(t, c);
32
32
  });
33
33
  }
34
34
  /**
35
35
  * Validates a single field immediately (synchronous)
36
36
  */
37
- validateField(e, i) {
38
- const a = this.validationCache.getComponentSchema(e);
39
- return this.validationExecutor.validateFieldSync(i, a);
37
+ validateField(e, a) {
38
+ const i = this.validationCache.getComponentSchema(e);
39
+ return this.validationExecutor.validateFieldSync(a, i);
40
40
  }
41
41
  /**
42
42
  * Validates all fields in a step
43
43
  */
44
- async validateStep(e, i) {
45
- const a = this.validationCache.getStepSchema(e);
46
- return await this.validationExecutor.validateStep(i, a);
44
+ async validateStep(e, a) {
45
+ const i = this.validationCache.getStepSchema(e);
46
+ return await this.validationExecutor.validateStep(a, i);
47
47
  }
48
48
  /**
49
49
  * Validates an entire form
50
50
  */
51
- async validateForm(e, i) {
52
- return await this.validationExecutor.validateForm(e, i);
51
+ async validateForm(e, a) {
52
+ return await this.validationExecutor.validateForm(e, a);
53
53
  }
54
54
  /**
55
55
  * Creates and caches a Zod schema for a component
@@ -86,12 +86,7 @@ class c {
86
86
  ), this.validationCache.clearCache());
87
87
  }
88
88
  }
89
- const v = new c();
90
- function g(s) {
91
- return new c(s);
92
- }
89
+ new o();
93
90
  export {
94
- c as ValidationEngine,
95
- g as createValidationEngine,
96
- v as defaultValidationEngine
91
+ o as ValidationEngine
97
92
  };
@@ -1,17 +1,17 @@
1
1
  "use client";
2
2
  /* empty css */
3
- import { isTemplateStep as d } from "../../../../../ui/src/lib/types/guards.js";
3
+ import { isTemplateStep as c } from "../../../../../ui/src/lib/types/guards.js";
4
4
  class u {
5
5
  schemaBuilder;
6
- constructor(t) {
7
- this.schemaBuilder = t;
6
+ constructor(s) {
7
+ this.schemaBuilder = s;
8
8
  }
9
9
  /**
10
10
  * Validates a single field
11
11
  */
12
- async validateField(t, i) {
12
+ async validateField(s, i) {
13
13
  try {
14
- const e = await i.parseAsync(t);
14
+ const e = await i.parseAsync(s);
15
15
  return {
16
16
  isValid: !0,
17
17
  errors: [],
@@ -22,60 +22,28 @@ class u {
22
22
  return e && typeof e == "object" && "errors" in e ? r = e.errors.map((a) => a.message) : r = ["Validation failed"], {
23
23
  isValid: !1,
24
24
  errors: r,
25
- value: t
25
+ value: s
26
26
  };
27
27
  }
28
28
  }
29
29
  /**
30
30
  * Validates a single field synchronously
31
31
  */
32
- validateFieldSync(t, i) {
33
- let e = t;
34
- t == null && (e = ""), console.log("🔍 [ValidationExecutor] validateFieldSync input:", {
35
- originalValue: t,
36
- normalizedValue: e,
37
- valueType: typeof t,
38
- normalizedValueType: typeof e,
39
- valueLength: typeof e == "string" ? e.length : "N/A",
40
- schema: i._def
41
- });
32
+ validateFieldSync(s, i) {
33
+ let e = s;
34
+ s == null && (e = "");
42
35
  try {
43
36
  const r = i.parse(e);
44
- return console.log("🔍 [ValidationExecutor] validateFieldSync SUCCESS:", {
45
- value: t,
46
- result: r,
47
- isValid: !0
48
- }), {
37
+ return {
49
38
  isValid: !0,
50
39
  errors: [],
51
40
  value: r
52
41
  };
53
42
  } catch (r) {
54
- console.log("🔍 [ValidationExecutor] validateFieldSync ERROR:", {
55
- value: t,
56
- error: r,
57
- errorType: typeof r
58
- });
59
- let s = [];
60
- if (r && typeof r == "object" && "errors" in r) {
61
- const a = r;
62
- s = a.errors.map((o) => o.message), console.log("🔍 [ValidationExecutor] DETAILED Zod errors:", {
63
- fullZodError: a,
64
- individualErrors: a.errors.map((o) => ({
65
- message: o.message,
66
- path: o.path,
67
- code: o.code,
68
- fullError: o
69
- })),
70
- inputValue: t,
71
- inputType: typeof t,
72
- schemaType: i._def?.typeName || "unknown"
73
- });
74
- } else
75
- s = ["Validation failed"];
76
- return {
43
+ let t = [];
44
+ return r && typeof r == "object" && "errors" in r ? t = r.errors.map((o) => o.message) : t = ["Validation failed"], {
77
45
  isValid: !1,
78
- errors: s,
46
+ errors: t,
79
47
  value: e
80
48
  };
81
49
  }
@@ -83,16 +51,16 @@ class u {
83
51
  /**
84
52
  * Validates a step
85
53
  */
86
- async validateStep(t, i) {
54
+ async validateStep(s, i) {
87
55
  try {
88
- return await i.parseAsync(t), {
56
+ return await i.parseAsync(s), {
89
57
  isValid: !0,
90
58
  fieldErrors: {},
91
59
  generalErrors: []
92
60
  };
93
61
  } catch (e) {
94
62
  const r = {};
95
- let s = [];
63
+ let t = [];
96
64
  if (e && typeof e == "object" && "errors" in e) {
97
65
  const a = e;
98
66
  for (const o of a.errors)
@@ -100,34 +68,34 @@ class u {
100
68
  const l = o.path[0].toString();
101
69
  r[l] || (r[l] = []), r[l].push(o.message);
102
70
  } else
103
- s.push(o.message);
71
+ t.push(o.message);
104
72
  } else
105
- s = ["Step validation failed"];
73
+ t = ["Step validation failed"];
106
74
  return {
107
75
  isValid: !1,
108
76
  fieldErrors: r,
109
- generalErrors: s
77
+ generalErrors: t
110
78
  };
111
79
  }
112
80
  }
113
81
  /**
114
82
  * Validates a form
115
83
  */
116
- async validateForm(t, i) {
84
+ async validateForm(s, i) {
117
85
  const e = {}, r = [];
118
- let s = !0;
119
- for (const a of t.steps) {
120
- if (d(a)) {
86
+ let t = !0;
87
+ for (const a of s.steps) {
88
+ if (c(a)) {
121
89
  r.push(
122
90
  `Template step '${a.id}' needs to be resolved before validation`
123
- ), s = !1;
91
+ ), t = !1;
124
92
  continue;
125
93
  }
126
94
  const o = a, l = this.schemaBuilder.createStepSchema(o), n = await this.validateStep(i, l);
127
- n.isValid || (s = !1, Object.assign(e, n.fieldErrors), r.push(...n.generalErrors));
95
+ n.isValid || (t = !1, Object.assign(e, n.fieldErrors), r.push(...n.generalErrors));
128
96
  }
129
97
  return {
130
- isValid: s,
98
+ isValid: t,
131
99
  fieldErrors: e,
132
100
  generalErrors: r
133
101
  };
package/FormWizard.d.ts DELETED
@@ -1,10 +0,0 @@
1
- /**
2
- * Form Wizard Component - Legacy export file for backward compatibility
3
- *
4
- * This file maintains backward compatibility for existing imports.
5
- * New code should import from the features directory structure.
6
- */
7
- export * from '../../core/src/index.ts';
8
- export * from '../../ui/src/index.ts';
9
- export * from './features/form-runtime';
10
- export { FormWizard as default } from './features/form-runtime';