@digiform/wizard 0.3.1 → 0.3.3

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 (54) hide show
  1. package/features/form-runtime/components/FormFooter.d.ts +5 -0
  2. package/features/form-runtime/hooks/useValidationEvents.d.ts +0 -1
  3. package/features/form-runtime/index.d.ts +0 -1
  4. package/features/state-management/machines/formMachine.d.ts +3 -0
  5. package/features/state-management/machines/types.d.ts +4 -0
  6. package/features/state-management/machines/useFormMachine.d.ts +24 -6
  7. package/package.json +31 -15
  8. package/styles.css +1 -1
  9. package/ui/src/lib/types/guards.js +1 -5
  10. package/wizard/src/features/api-integration/services/ApiCallService.js +65 -74
  11. package/wizard/src/features/dialog-system/components/ActionDialog/ActionDialog.js +39 -43
  12. package/wizard/src/features/dialog-system/components/ConfirmationDialog/ConfirmationDialog.js +37 -41
  13. package/wizard/src/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.js +44 -45
  14. package/wizard/src/features/form-runtime/FormWizard/FormWizard.js +48 -95
  15. package/wizard/src/features/form-runtime/FormWizard/FormWizard.module.css.js +4 -12
  16. package/wizard/src/features/form-runtime/components/FormFooter.js +53 -184
  17. package/wizard/src/features/form-runtime/components/FormSection/FormSection.js +150 -194
  18. package/wizard/src/features/form-runtime/components/FormStep/FormStep.js +92 -108
  19. package/wizard/src/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.js +24 -30
  20. package/wizard/src/features/form-runtime/hooks/useComponentTriggers.js +44 -63
  21. package/wizard/src/features/form-runtime/hooks/useFieldEventHandlers.js +26 -40
  22. package/wizard/src/features/form-runtime/hooks/useValidationEvents.js +22 -25
  23. package/wizard/src/features/form-runtime/utils/formDirtyStateSync.js +26 -37
  24. package/wizard/src/features/form-runtime/utils/logger.js +12 -12
  25. package/wizard/src/features/state-management/machines/actions/navigationActions.js +13 -8
  26. package/wizard/src/features/state-management/machines/componentTriggerEngine.js +167 -432
  27. package/wizard/src/features/state-management/machines/formMachine.js +558 -677
  28. package/wizard/src/features/state-management/machines/useFormMachine.js +173 -191
  29. package/wizard/src/features/trigger-action-system/components/ActionManager.js +35 -86
  30. package/wizard/src/features/validation-system/validation/SchemaBuilder.js +28 -82
  31. package/wizard/src/features/validation-system/validation/ValidationCache.js +11 -27
  32. package/wizard/src/features/validation-system/validation/ValidationExecutor.js +47 -87
  33. package/core/src/types/guards.js +0 -7
  34. package/features/form-runtime/config/configResolver.d.ts +0 -14
  35. package/features/form-runtime/config/index.d.ts +0 -9
  36. package/features/form-runtime/config/templateConfig.d.ts +0 -148
  37. package/features/form-runtime/config/templateLoader.d.ts +0 -25
  38. package/features/form-runtime/config/templateUtils.d.ts +0 -12
  39. package/features/form-runtime/utils/formSaver.d.ts +0 -22
  40. package/features/state-management/components/ValidationBuilder/ValidationBuilder.d.ts +0 -9
  41. package/features/state-management/machines/__tests__/setup.d.ts +0 -0
  42. package/features/state-management/machines/__tests__/vitest.config.d.ts +0 -2
  43. package/features/state-management/machines/actions/validationActions.d.ts +0 -68
  44. package/features/state-management/machines/lazyLoading.d.ts +0 -34
  45. package/features/state-management/machines/validation/index.d.ts +0 -5
  46. package/features/state-management/machines/validation/validateField.d.ts +0 -2
  47. package/features/state-management/machines/validation/validateForm.d.ts +0 -2
  48. package/features/state-management/machines/validation/validateSection.d.ts +0 -2
  49. package/features/state-management/machines/validation/validateStep.d.ts +0 -2
  50. package/features/state-management/machines/validation/validationTypes.d.ts +0 -1
  51. package/features/trigger-action-system/components/FieldWarning/FieldWarning.d.ts +0 -20
  52. package/ui/src/lib/utils/templateUtils.js +0 -20
  53. package/wizard/src/features/form-runtime/config/configResolver.js +0 -34
  54. package/wizard/src/features/form-runtime/config/templateLoader.js +0 -235
@@ -1,108 +1,57 @@
1
1
  "use client";
2
- import { jsxs as s, jsx as r } from "react/jsx-runtime";
3
- import { memo as d } from "react";
4
- import { useFormMachine as p } from "../../state-management/machines/useFormMachine.js";
5
- import { ActionDialog as I } from "../../dialog-system/components/ActionDialog/ActionDialog.js";
6
- const D = d(({ 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
- I,
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,138 +1,98 @@
1
1
  "use client";
2
- /* empty css */
3
- import { isTemplateStep as d } from "../../../../../ui/src/lib/types/guards.js";
4
- class u {
2
+ class d {
5
3
  schemaBuilder;
6
- constructor(t) {
7
- this.schemaBuilder = t;
4
+ constructor(s) {
5
+ this.schemaBuilder = s;
8
6
  }
9
7
  /**
10
8
  * Validates a single field
11
9
  */
12
- async validateField(t, i) {
10
+ async validateField(s, o) {
13
11
  try {
14
- const e = await i.parseAsync(t);
12
+ const r = await o.parseAsync(s);
15
13
  return {
16
14
  isValid: !0,
17
15
  errors: [],
18
- value: e
16
+ value: r
19
17
  };
20
- } catch (e) {
21
- let r = [];
22
- return e && typeof e == "object" && "errors" in e ? r = e.errors.map((a) => a.message) : r = ["Validation failed"], {
18
+ } catch (r) {
19
+ let e = [];
20
+ return r && typeof r == "object" && "errors" in r ? e = r.errors.map((i) => i.message) : e = ["Validation failed"], {
23
21
  isValid: !1,
24
- errors: r,
25
- value: t
22
+ errors: e,
23
+ value: s
26
24
  };
27
25
  }
28
26
  }
29
27
  /**
30
28
  * Validates a single field synchronously
31
29
  */
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
- });
30
+ validateFieldSync(s, o) {
31
+ let r = s;
32
+ s == null && (r = "");
42
33
  try {
43
- const r = i.parse(e);
44
- return console.log("🔍 [ValidationExecutor] validateFieldSync SUCCESS:", {
45
- value: t,
46
- result: r,
47
- isValid: !0
48
- }), {
34
+ const e = o.parse(r);
35
+ return {
49
36
  isValid: !0,
50
37
  errors: [],
51
- value: r
38
+ value: e
52
39
  };
53
- } 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 {
40
+ } catch (e) {
41
+ let t = [];
42
+ return e && typeof e == "object" && "errors" in e ? t = e.errors.map((a) => a.message) : t = ["Validation failed"], {
77
43
  isValid: !1,
78
- errors: s,
79
- value: e
44
+ errors: t,
45
+ value: r
80
46
  };
81
47
  }
82
48
  }
83
49
  /**
84
50
  * Validates a step
85
51
  */
86
- async validateStep(t, i) {
52
+ async validateStep(s, o) {
87
53
  try {
88
- return await i.parseAsync(t), {
54
+ return await o.parseAsync(s), {
89
55
  isValid: !0,
90
56
  fieldErrors: {},
91
57
  generalErrors: []
92
58
  };
93
- } catch (e) {
94
- const r = {};
95
- let s = [];
96
- if (e && typeof e == "object" && "errors" in e) {
97
- const a = e;
98
- for (const o of a.errors)
99
- if (o.path.length > 0) {
100
- const l = o.path[0].toString();
101
- r[l] || (r[l] = []), r[l].push(o.message);
59
+ } catch (r) {
60
+ const e = {};
61
+ let t = [];
62
+ if (r && typeof r == "object" && "errors" in r) {
63
+ const i = r;
64
+ for (const a of i.errors)
65
+ if (a.path.length > 0) {
66
+ const l = a.path[0].toString();
67
+ e[l] || (e[l] = []), e[l].push(a.message);
102
68
  } else
103
- s.push(o.message);
69
+ t.push(a.message);
104
70
  } else
105
- s = ["Step validation failed"];
71
+ t = ["Step validation failed"];
106
72
  return {
107
73
  isValid: !1,
108
- fieldErrors: r,
109
- generalErrors: s
74
+ fieldErrors: e,
75
+ generalErrors: t
110
76
  };
111
77
  }
112
78
  }
113
79
  /**
114
80
  * Validates a form
115
81
  */
116
- async validateForm(t, i) {
117
- const e = {}, r = [];
118
- let s = !0;
119
- for (const a of t.steps) {
120
- if (d(a)) {
121
- r.push(
122
- `Template step '${a.id}' needs to be resolved before validation`
123
- ), s = !1;
124
- continue;
125
- }
126
- 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));
82
+ async validateForm(s, o) {
83
+ const r = {}, e = [];
84
+ let t = !0;
85
+ for (const i of s.steps) {
86
+ const a = i, l = this.schemaBuilder.createStepSchema(a), n = await this.validateStep(o, l);
87
+ n.isValid || (t = !1, Object.assign(r, n.fieldErrors), e.push(...n.generalErrors));
128
88
  }
129
89
  return {
130
- isValid: s,
131
- fieldErrors: e,
132
- generalErrors: r
90
+ isValid: t,
91
+ fieldErrors: r,
92
+ generalErrors: e
133
93
  };
134
94
  }
135
95
  }
136
96
  export {
137
- u as ValidationExecutor
97
+ d as ValidationExecutor
138
98
  };
@@ -1,7 +0,0 @@
1
- "use client";
2
- function t(e) {
3
- return typeof e == "object" && e !== null && "templateId" in e;
4
- }
5
- export {
6
- t as isTemplateStep
7
- };
@@ -1,14 +0,0 @@
1
- import { FormWizardConfig } from '../../../../../core/src/index.ts';
2
- /**
3
- * Resolves a form wizard configuration, expanding any template step references
4
- * to their full step configurations
5
- */
6
- export declare function resolveFormWizardConfig(config: FormWizardConfig): Promise<FormWizardConfig>;
7
- /**
8
- * Checks if a configuration contains template step references
9
- */
10
- export declare function hasTemplateSteps(config: FormWizardConfig): boolean;
11
- /**
12
- * Gets template IDs used in a configuration
13
- */
14
- export declare function getUsedTemplateIds(config: FormWizardConfig): string[];
@@ -1,9 +0,0 @@
1
- /**
2
- * Form Runtime Configuration
3
- *
4
- * Configuration resolvers and template utilities
5
- */
6
- export * from './configResolver';
7
- export * from './templateConfig';
8
- export * from './templateLoader';
9
- export { getAvailableGenericTemplatesSync, getTemplateInfo, validateTemplateReferences, } from './templateUtils';