@digiform/wizard 0.3.1 → 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 (43) 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/state-management/machines/formMachine.d.ts +3 -0
  4. package/features/state-management/machines/types.d.ts +4 -0
  5. package/features/state-management/machines/useFormMachine.d.ts +18 -0
  6. package/package.json +1 -3
  7. package/styles.css +1 -1
  8. package/wizard/src/features/api-integration/services/ApiCallService.js +65 -74
  9. package/wizard/src/features/dialog-system/components/ActionDialog/ActionDialog.js +39 -43
  10. package/wizard/src/features/dialog-system/components/ConfirmationDialog/ConfirmationDialog.js +37 -41
  11. package/wizard/src/features/dialog-system/components/EmailVerificationDialog/EmailVerificationDialog.js +44 -45
  12. package/wizard/src/features/form-runtime/FormWizard/FormWizard.js +54 -79
  13. package/wizard/src/features/form-runtime/components/FormFooter.js +53 -184
  14. package/wizard/src/features/form-runtime/components/FormSection/FormSection.js +150 -194
  15. package/wizard/src/features/form-runtime/components/FormStep/FormStep.js +83 -92
  16. package/wizard/src/features/form-runtime/components/StepProgressIndicator/StepProgressIndicator.js +24 -30
  17. package/wizard/src/features/form-runtime/config/templateLoader.js +48 -55
  18. package/wizard/src/features/form-runtime/hooks/useComponentTriggers.js +44 -63
  19. package/wizard/src/features/form-runtime/hooks/useFieldEventHandlers.js +26 -40
  20. package/wizard/src/features/form-runtime/hooks/useValidationEvents.js +22 -25
  21. package/wizard/src/features/form-runtime/utils/formDirtyStateSync.js +26 -37
  22. package/wizard/src/features/form-runtime/utils/logger.js +12 -12
  23. package/wizard/src/features/state-management/machines/actions/navigationActions.js +13 -8
  24. package/wizard/src/features/state-management/machines/componentTriggerEngine.js +167 -432
  25. package/wizard/src/features/state-management/machines/formMachine.js +558 -677
  26. package/wizard/src/features/state-management/machines/useFormMachine.js +172 -190
  27. package/wizard/src/features/trigger-action-system/components/ActionManager.js +35 -86
  28. package/wizard/src/features/validation-system/validation/SchemaBuilder.js +28 -82
  29. package/wizard/src/features/validation-system/validation/ValidationCache.js +11 -27
  30. package/wizard/src/features/validation-system/validation/ValidationExecutor.js +26 -58
  31. package/features/form-runtime/utils/formSaver.d.ts +0 -22
  32. package/features/state-management/components/ValidationBuilder/ValidationBuilder.d.ts +0 -9
  33. package/features/state-management/machines/__tests__/setup.d.ts +0 -0
  34. package/features/state-management/machines/__tests__/vitest.config.d.ts +0 -2
  35. package/features/state-management/machines/actions/validationActions.d.ts +0 -68
  36. package/features/state-management/machines/lazyLoading.d.ts +0 -34
  37. package/features/state-management/machines/validation/index.d.ts +0 -5
  38. package/features/state-management/machines/validation/validateField.d.ts +0 -2
  39. package/features/state-management/machines/validation/validateForm.d.ts +0 -2
  40. package/features/state-management/machines/validation/validateSection.d.ts +0 -2
  41. package/features/state-management/machines/validation/validateStep.d.ts +0 -2
  42. package/features/state-management/machines/validation/validationTypes.d.ts +0 -1
  43. package/features/trigger-action-system/components/FieldWarning/FieldWarning.d.ts +0 -20
@@ -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,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
  };
@@ -1,22 +0,0 @@
1
- import { FormWizardConfig } from '../../../../../core/src/index.ts';
2
- export interface SaveResult {
3
- success: boolean;
4
- error?: {
5
- message: string;
6
- code?: string;
7
- };
8
- metadata?: {
9
- filePath?: string;
10
- timestamp?: number;
11
- };
12
- }
13
- /**
14
- * Save form configuration using the pluggable save provider system
15
- * This is a self-contained function that doesn't rely on external utilities
16
- */
17
- export declare function saveFormConfig(projectId: string, wizardId: string, config: FormWizardConfig): Promise<SaveResult>;
18
- /**
19
- * Load form configuration
20
- * Companion function to saveFormConfig for loading saved forms
21
- */
22
- export declare function loadFormConfig(projectId: string, wizardId: string): Promise<FormWizardConfig | null>;
@@ -1,9 +0,0 @@
1
- import { ComponentValidation } from '../../machines/validation/validationTypes';
2
- interface ValidationBuilderProps {
3
- componentType: string;
4
- componentLabel: string;
5
- validation: ComponentValidation;
6
- onChange: (validation: ComponentValidation) => void;
7
- }
8
- export declare const ValidationBuilder: React.FC<ValidationBuilderProps>;
9
- export {};
@@ -1,2 +0,0 @@
1
- declare const _default: import('vite').UserConfig;
2
- export default _default;
@@ -1,68 +0,0 @@
1
- import { ActionFunction } from 'xstate';
2
- import { FormMachineContext, FormMachineEvents } from '../types';
3
- /**
4
- * Set form data for a specific field (optimized to reduce object spreading)
5
- */
6
- export declare const setFormData: ActionFunction<import('xstate').MachineContext, import('xstate').AnyEventObject, import('xstate').EventObject, import('xstate').NonReducibleUnknown, import('xstate').ProvidedActor, never, never, never, never>;
7
- /**
8
- * Set field state for a component (optimized to reduce deep object spreading)
9
- */
10
- export declare const setFieldState: ActionFunction<import('xstate').MachineContext, import('xstate').AnyEventObject, import('xstate').EventObject, import('xstate').NonReducibleUnknown, import('xstate').ProvidedActor, never, never, never, never>;
11
- /**
12
- * Mark field as touched during validation (optimized to avoid unnecessary updates)
13
- */
14
- export declare const markFieldTouched: ActionFunction<import('xstate').MachineContext, import('xstate').AnyEventObject, import('xstate').EventObject, import('xstate').NonReducibleUnknown, import('xstate').ProvidedActor, never, never, never, never>;
15
- /**
16
- * Set form validation errors
17
- */
18
- export declare const setFormErrors: ActionFunction<import('xstate').MachineContext, import('xstate').AnyEventObject, import('xstate').EventObject, import('xstate').NonReducibleUnknown, import('xstate').ProvidedActor, never, never, never, never>;
19
- /**
20
- * Set submission state
21
- */
22
- export declare const setSubmittingTrue: ActionFunction<import('xstate').MachineContext, import('xstate').AnyEventObject, import('xstate').EventObject, import('xstate').NonReducibleUnknown, import('xstate').ProvidedActor, never, never, never, never>;
23
- export declare const setSubmittingFalse: ActionFunction<import('xstate').MachineContext, import('xstate').AnyEventObject, import('xstate').EventObject, import('xstate').NonReducibleUnknown, import('xstate').ProvidedActor, never, never, never, never>;
24
- /**
25
- * Set form submission errors
26
- */
27
- export declare const setSubmissionError: ActionFunction<import('xstate').MachineContext, import('xstate').AnyEventObject, import('xstate').EventObject, import('xstate').NonReducibleUnknown, import('xstate').ProvidedActor, never, never, never, never>;
28
- /**
29
- * Start section editing by creating backup (optimized backup creation)
30
- */
31
- export declare const startSectionEdit: ActionFunction<import('xstate').MachineContext, import('xstate').AnyEventObject, import('xstate').EventObject, import('xstate').NonReducibleUnknown, import('xstate').ProvidedActor, never, never, never, never>;
32
- /**
33
- * Cancel section editing by restoring from backup (optimized restoration)
34
- */
35
- export declare const cancelSectionEdit: ActionFunction<any, any, import('xstate').EventObject, import('xstate').NonReducibleUnknown, import('xstate').ProvidedActor, never, never, never, never>;
36
- /**
37
- * Set field change validation warning
38
- */
39
- export declare const setFieldValidationWarning: ActionFunction<import('xstate').MachineContext, import('xstate').AnyEventObject, import('xstate').EventObject, import('xstate').NonReducibleUnknown, import('xstate').ProvidedActor, never, never, never, never>;
40
- /**
41
- * Dismiss field validation warning
42
- */
43
- export declare const dismissFieldValidationWarning: ActionFunction<any, any, import('xstate').EventObject, import('xstate').NonReducibleUnknown, import('xstate').ProvidedActor, never, never, never, never>;
44
- /**
45
- * Start field verification process
46
- */
47
- export declare const startFieldVerification: ActionFunction<import('xstate').MachineContext, import('xstate').AnyEventObject, import('xstate').EventObject, import('xstate').NonReducibleUnknown, import('xstate').ProvidedActor, never, never, never, never>;
48
- /**
49
- * Complete field verification process
50
- */
51
- export declare const completeFieldVerification: ActionFunction<import('xstate').MachineContext, import('xstate').AnyEventObject, import('xstate').EventObject, import('xstate').NonReducibleUnknown, import('xstate').ProvidedActor, never, never, never, never>;
52
- /**
53
- * Clear field changes and validation state
54
- */
55
- export declare const clearFieldChanges: ActionFunction<import('xstate').MachineContext, import('xstate').AnyEventObject, import('xstate').EventObject, import('xstate').NonReducibleUnknown, import('xstate').ProvidedActor, never, never, never, never>;
56
- /**
57
- * Update form validity based on current step
58
- */
59
- export declare const updateFormValidity: ActionFunction<import('xstate').MachineContext, import('xstate').AnyEventObject, import('xstate').EventObject, import('xstate').NonReducibleUnknown, import('xstate').ProvidedActor, never, never, never, never>;
60
- /**
61
- * Reset TanStack Form dirty state for a specific field
62
- * This action is called via event to reset TanStack Form's field meta state
63
- */
64
- export declare const resetFieldTanStackState: ({ context, event, self, }: {
65
- context: FormMachineContext;
66
- event: FormMachineEvents;
67
- self: any;
68
- }) => void;