@elevasis/ui 2.33.2 → 2.35.0
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.
- package/dist/api/index.d.ts +9 -2
- package/dist/api/index.js +3 -3
- package/dist/app/index.css +452 -0
- package/dist/app/index.d.ts +1255 -8
- package/dist/app/index.js +151 -13
- package/dist/charts/index.js +3 -6
- package/dist/chunk-26HFM4MH.js +41449 -0
- package/dist/{chunk-52K5RFDH.js → chunk-4U3XAWCN.js} +1328 -2492
- package/dist/{chunk-ND5TDV2J.js → chunk-57OZ3AEG.js} +1 -1
- package/dist/{chunk-E4WQGJNS.js → chunk-7FPLLSHN.js} +14 -1
- package/dist/{chunk-RQA2EVN3.js → chunk-AKW7KISS.js} +39 -3
- package/dist/chunk-AUDNF2Q7.js +2050 -0
- package/dist/{chunk-TYRUKGGD.js → chunk-GX6XBRRF.js} +1 -2
- package/dist/{chunk-V6SZ4ECN.js → chunk-LUYVRATI.js} +257 -6
- package/dist/{chunk-X4WBGKJQ.js → chunk-R3VCBZDC.js} +50 -3
- package/dist/chunk-SIQ3P4OR.js +1764 -0
- package/dist/{chunk-Z2K2EAPL.js → chunk-VDOOGGBA.js} +5 -6
- package/dist/{chunk-3FV6HBXS.js → chunk-WF7CONXF.js} +23 -23
- package/dist/chunk-YYX7OPZQ.js +25 -0
- package/dist/components/index.d.ts +69 -92
- package/dist/components/index.js +20 -3216
- package/dist/components/navigation/index.js +25 -7
- package/dist/execution/index.d.ts +9 -9
- package/dist/execution/index.js +1 -2
- package/dist/features/auth/index.js +23 -2
- package/dist/features/clients/index.js +20 -31
- package/dist/features/crm/index.js +20 -35
- package/dist/features/dashboard/index.d.ts +68 -91
- package/dist/features/dashboard/index.js +20 -33
- package/dist/features/delivery/index.js +20 -35
- package/dist/features/knowledge/index.js +25 -11
- package/dist/features/lead-gen/index.d.ts +9 -9
- package/dist/features/lead-gen/index.js +20 -36
- package/dist/features/monitoring/index.js +20 -35
- package/dist/features/monitoring/requests/index.js +20 -30
- package/dist/features/operations/index.d.ts +197 -188
- package/dist/features/operations/index.js +18 -42
- package/dist/features/seo/index.js +3 -4
- package/dist/features/settings/index.js +20 -32
- package/dist/graph/index.js +1 -1
- package/dist/hooks/delivery/index.js +30 -2
- package/dist/hooks/index.d.ts +105 -112
- package/dist/hooks/index.js +20 -26
- package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +55 -62
- package/dist/hooks/published.d.ts +105 -112
- package/dist/hooks/published.js +20 -25
- package/dist/index.css +532 -532
- package/dist/index.d.ts +10261 -6793
- package/dist/index.js +22 -31
- package/dist/knowledge/index.d.ts +51 -59
- package/dist/knowledge/index.js +40 -211
- package/dist/{knowledge-search-index-VMAW7FLR.js → knowledge-search-index-ORIJCEZX.js} +3 -3
- package/dist/layout/index.js +4 -10
- package/dist/organization/index.js +27 -2
- package/dist/provider/index.d.ts +71 -52
- package/dist/provider/index.js +20 -20
- package/dist/provider/published.d.ts +39 -47
- package/dist/provider/published.js +20 -15
- package/dist/test-utils/index.d.ts +2 -0
- package/dist/test-utils/index.js +16 -4
- package/dist/test-utils/setup.js +38 -0
- package/dist/theme/index.js +2 -3
- package/dist/theme/presets/index.d.ts +28 -3
- package/dist/theme/presets/index.js +1 -1
- package/dist/typeform/index.js +1 -2049
- package/dist/types/index.d.ts +88 -95
- package/dist/utils/index.d.ts +46 -69
- package/dist/utils/index.js +1 -1
- package/dist/zustand/index.d.ts +21 -8
- package/dist/zustand/index.js +32 -1
- package/package.json +5 -5
- package/dist/chunk-2ZZ72TAB.js +0 -2281
- package/dist/chunk-32I2RCGC.js +0 -85
- package/dist/chunk-3MEXPLWT.js +0 -265
- package/dist/chunk-3ZMAGTWF.js +0 -18
- package/dist/chunk-44I4LOH6.js +0 -1593
- package/dist/chunk-4DYOXEH6.js +0 -951
- package/dist/chunk-7M2VOCYN.js +0 -1
- package/dist/chunk-A4VDJJCV.js +0 -1864
- package/dist/chunk-BZZCNLT6.js +0 -12
- package/dist/chunk-CLDCYJQT.js +0 -1
- package/dist/chunk-E565XMTQ.js +0 -17
- package/dist/chunk-EPTHX4VZ.js +0 -749
- package/dist/chunk-GWGQI6V4.js +0 -447
- package/dist/chunk-HUJCU55S.js +0 -159
- package/dist/chunk-IBWMR4TI.js +0 -469
- package/dist/chunk-IIMU5YAJ.js +0 -53
- package/dist/chunk-IOXOPMYS.js +0 -145
- package/dist/chunk-J2UD7BOH.js +0 -347
- package/dist/chunk-JA5ECJJB.js +0 -387
- package/dist/chunk-JFL3GRD4.js +0 -39
- package/dist/chunk-KW7ZNQD7.js +0 -126
- package/dist/chunk-LGKLC5MG.js +0 -44
- package/dist/chunk-N55DVMAG.js +0 -14
- package/dist/chunk-O56ESZCQ.js +0 -1874
- package/dist/chunk-OIBHQH5Q.js +0 -96
- package/dist/chunk-PDHTXPSF.js +0 -12
- package/dist/chunk-QDFJSUG3.js +0 -13
- package/dist/chunk-R2XR4FCV.js +0 -48
- package/dist/chunk-R66W5UDG.js +0 -26
- package/dist/chunk-RYTEQBAO.js +0 -37
- package/dist/chunk-SZHARWKU.js +0 -15
- package/dist/chunk-T3J6U77J.js +0 -12056
- package/dist/chunk-TBVLQRXT.js +0 -68
- package/dist/chunk-TGVAIWIL.js +0 -1778
- package/dist/chunk-TKAYX2SP.js +0 -204
- package/dist/chunk-TUMSNGTX.js +0 -35
- package/dist/chunk-VGU4ZFYZ.js +0 -4752
- package/dist/chunk-VNAZTCHA.js +0 -65
- package/dist/chunk-VNFR57DF.js +0 -87
- package/dist/chunk-WKW6B5ID.js +0 -29
- package/dist/chunk-XCYKC6OZ.js +0 -1
- package/dist/chunk-XZGSCABI.js +0 -383
- package/dist/chunk-ZMK5Z6KE.js +0 -5198
- /package/dist/{chunk-2RJMVWFJ.js → chunk-GEFWMU26.js} +0 -0
- /package/dist/{chunk-22UVE3RA.js → chunk-HENXLGVD.js} +0 -0
package/dist/chunk-32I2RCGC.js
DELETED
|
@@ -1,85 +0,0 @@
|
|
|
1
|
-
import { useOptionalElevasisSystems } from './chunk-IBWMR4TI.js';
|
|
2
|
-
import { useRouterContext } from './chunk-Q7DJKLEN.js';
|
|
3
|
-
import { useMemo } from 'react';
|
|
4
|
-
|
|
5
|
-
var useBreadcrumbs = (options = {}) => {
|
|
6
|
-
const { currentPath } = useRouterContext();
|
|
7
|
-
const systemContext = useOptionalElevasisSystems();
|
|
8
|
-
const { labelsByPath = {} } = options;
|
|
9
|
-
return useMemo(() => {
|
|
10
|
-
const shellModel = systemContext?.shellModel;
|
|
11
|
-
const overriddenLabel = labelsByPath[currentPath];
|
|
12
|
-
if (overriddenLabel) {
|
|
13
|
-
return [{ label: overriddenLabel, isActive: true }];
|
|
14
|
-
}
|
|
15
|
-
if (shellModel) {
|
|
16
|
-
const matchedNode = shellModel.findByPath(currentPath);
|
|
17
|
-
if (matchedNode) {
|
|
18
|
-
return shellModel.ancestorsOf(matchedNode.id).map((node, index, items) => ({
|
|
19
|
-
label: labelsByPath[node.path ?? ""] ?? node.label,
|
|
20
|
-
path: index === items.length - 1 ? void 0 : node.path,
|
|
21
|
-
isActive: index === items.length - 1
|
|
22
|
-
}));
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
const segments = currentPath.split("/").filter(Boolean);
|
|
26
|
-
if (segments.length === 0) {
|
|
27
|
-
return [{ label: "Dashboard", isActive: true }];
|
|
28
|
-
}
|
|
29
|
-
const breadcrumbs = [{ label: "Dashboard", path: "/" }];
|
|
30
|
-
let currentSegmentPath = "";
|
|
31
|
-
for (let i = 0; i < segments.length; i++) {
|
|
32
|
-
currentSegmentPath += `/${segments[i]}`;
|
|
33
|
-
const isLast = i === segments.length - 1;
|
|
34
|
-
const label = labelsByPath[currentSegmentPath] ?? formatSegmentLabel(segments[i]);
|
|
35
|
-
breadcrumbs.push({
|
|
36
|
-
label,
|
|
37
|
-
path: isLast ? void 0 : currentSegmentPath,
|
|
38
|
-
isActive: isLast
|
|
39
|
-
});
|
|
40
|
-
}
|
|
41
|
-
return breadcrumbs;
|
|
42
|
-
}, [currentPath, systemContext, labelsByPath]);
|
|
43
|
-
};
|
|
44
|
-
function formatSegmentLabel(segment) {
|
|
45
|
-
const decodedSegment = safeDecodeURIComponent(segment);
|
|
46
|
-
const routeLabel = formatRouteIdLabel(decodedSegment);
|
|
47
|
-
if (routeLabel) return routeLabel;
|
|
48
|
-
return titleCaseSegment(decodedSegment);
|
|
49
|
-
}
|
|
50
|
-
function safeDecodeURIComponent(value) {
|
|
51
|
-
try {
|
|
52
|
-
return decodeURIComponent(value);
|
|
53
|
-
} catch {
|
|
54
|
-
return value;
|
|
55
|
-
}
|
|
56
|
-
}
|
|
57
|
-
function formatRouteIdLabel(segment) {
|
|
58
|
-
if (segment.startsWith("group:")) {
|
|
59
|
-
const groupKey = segment.slice("group:".length);
|
|
60
|
-
return groupKey === "graph" ? "Ontology" : titleCaseSegment(groupKey);
|
|
61
|
-
}
|
|
62
|
-
if (segment.startsWith("domain:")) {
|
|
63
|
-
return titleCaseSegment(segment.slice("domain:".length));
|
|
64
|
-
}
|
|
65
|
-
if (segment.startsWith("item:")) {
|
|
66
|
-
const rest = segment.slice("item:".length);
|
|
67
|
-
const separatorIndex = rest.indexOf(":");
|
|
68
|
-
const itemId = separatorIndex === -1 ? rest : rest.slice(separatorIndex + 1);
|
|
69
|
-
return formatOntologyOrIdLabel(itemId);
|
|
70
|
-
}
|
|
71
|
-
if (segment.startsWith("ontology:")) {
|
|
72
|
-
return formatOntologyOrIdLabel(segment);
|
|
73
|
-
}
|
|
74
|
-
return void 0;
|
|
75
|
-
}
|
|
76
|
-
function formatOntologyOrIdLabel(value) {
|
|
77
|
-
const localId = value.includes("/") ? value.slice(value.lastIndexOf("/") + 1) : value;
|
|
78
|
-
const suffix = localId.includes(":") ? localId.slice(localId.lastIndexOf(":") + 1) : localId;
|
|
79
|
-
return titleCaseSegment(suffix);
|
|
80
|
-
}
|
|
81
|
-
function titleCaseSegment(segment) {
|
|
82
|
-
return segment.split("-").flatMap((part) => part.split("_")).flatMap((part) => part.split(".")).map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
83
|
-
}
|
|
84
|
-
|
|
85
|
-
export { useBreadcrumbs };
|
package/dist/chunk-3MEXPLWT.js
DELETED
|
@@ -1,265 +0,0 @@
|
|
|
1
|
-
import { TextInput, Textarea, Radio, Stack, Checkbox, Select, NumberInput, Button } from '@mantine/core';
|
|
2
|
-
import { useForm } from '@mantine/form';
|
|
3
|
-
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
4
|
-
import { z } from 'zod';
|
|
5
|
-
|
|
6
|
-
// src/components/forms/ZodFormRenderer.tsx
|
|
7
|
-
function FormFieldRenderer({ field, form, richTextRenderer }) {
|
|
8
|
-
const commonProps = {
|
|
9
|
-
label: field.label,
|
|
10
|
-
description: field.description,
|
|
11
|
-
placeholder: field.placeholder,
|
|
12
|
-
required: field.required,
|
|
13
|
-
...form.getInputProps(field.name)
|
|
14
|
-
};
|
|
15
|
-
switch (field.type) {
|
|
16
|
-
case "text":
|
|
17
|
-
return /* @__PURE__ */ jsx(TextInput, { ...commonProps });
|
|
18
|
-
case "textarea":
|
|
19
|
-
return /* @__PURE__ */ jsx(Textarea, { ...commonProps, minRows: 3, autosize: true });
|
|
20
|
-
case "number":
|
|
21
|
-
return /* @__PURE__ */ jsx(NumberInput, { ...commonProps, min: field.min, max: field.max });
|
|
22
|
-
case "select":
|
|
23
|
-
return /* @__PURE__ */ jsx(
|
|
24
|
-
Select,
|
|
25
|
-
{
|
|
26
|
-
...commonProps,
|
|
27
|
-
data: field.options?.map((opt) => ({
|
|
28
|
-
label: opt.label,
|
|
29
|
-
value: String(opt.value)
|
|
30
|
-
})) || []
|
|
31
|
-
}
|
|
32
|
-
);
|
|
33
|
-
case "checkbox":
|
|
34
|
-
return /* @__PURE__ */ jsx(Checkbox, { ...commonProps, ...form.getInputProps(field.name, { type: "checkbox" }) });
|
|
35
|
-
case "radio":
|
|
36
|
-
return /* @__PURE__ */ jsx(Radio.Group, { ...commonProps, children: /* @__PURE__ */ jsx(Stack, { gap: "xs", children: field.options?.map((opt) => /* @__PURE__ */ jsx(Radio, { value: String(opt.value), label: opt.label }, opt.value)) }) });
|
|
37
|
-
case "richtext": {
|
|
38
|
-
const inputProps = form.getInputProps(field.name);
|
|
39
|
-
if (richTextRenderer) {
|
|
40
|
-
return richTextRenderer({
|
|
41
|
-
content: inputProps.value || "",
|
|
42
|
-
onChange: (content) => form.setFieldValue(field.name, content),
|
|
43
|
-
placeholder: field.placeholder
|
|
44
|
-
});
|
|
45
|
-
}
|
|
46
|
-
return /* @__PURE__ */ jsx(Textarea, { ...commonProps, minRows: 5, autosize: true });
|
|
47
|
-
}
|
|
48
|
-
default:
|
|
49
|
-
return /* @__PURE__ */ jsx(TextInput, { ...commonProps });
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
function toJsonSchema(zodSchema) {
|
|
53
|
-
return z.toJSONSchema(zodSchema);
|
|
54
|
-
}
|
|
55
|
-
function humanizeKey(name) {
|
|
56
|
-
return name.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase());
|
|
57
|
-
}
|
|
58
|
-
function unwrapNullable(schema) {
|
|
59
|
-
if (Array.isArray(schema.anyOf)) {
|
|
60
|
-
const nonNull = schema.anyOf.filter((s) => s.type !== "null");
|
|
61
|
-
if (nonNull.length === 1) return { ...nonNull[0], description: schema.description ?? nonNull[0].description };
|
|
62
|
-
}
|
|
63
|
-
return schema;
|
|
64
|
-
}
|
|
65
|
-
function defaultForLeaf(schema) {
|
|
66
|
-
if (schema.default !== void 0) return schema.default;
|
|
67
|
-
if (Array.isArray(schema.enum) && schema.enum.length > 0) return schema.enum[0];
|
|
68
|
-
switch (schema.type) {
|
|
69
|
-
case "string":
|
|
70
|
-
return "";
|
|
71
|
-
case "integer":
|
|
72
|
-
case "number":
|
|
73
|
-
return 0;
|
|
74
|
-
case "boolean":
|
|
75
|
-
return false;
|
|
76
|
-
case "array":
|
|
77
|
-
return [];
|
|
78
|
-
case "object":
|
|
79
|
-
return schema.properties ? extractDefaults(schema) : {};
|
|
80
|
-
default:
|
|
81
|
-
return void 0;
|
|
82
|
-
}
|
|
83
|
-
}
|
|
84
|
-
function extractDefaults(jsonSchema) {
|
|
85
|
-
if (jsonSchema.type !== "object" || !jsonSchema.properties) return {};
|
|
86
|
-
const result = {};
|
|
87
|
-
for (const [key, propSchema] of Object.entries(jsonSchema.properties)) {
|
|
88
|
-
result[key] = defaultForLeaf(unwrapNullable(propSchema));
|
|
89
|
-
}
|
|
90
|
-
return result;
|
|
91
|
-
}
|
|
92
|
-
function propSchemaToFormField(name, raw, required) {
|
|
93
|
-
const schema = unwrapNullable(raw);
|
|
94
|
-
const label = humanizeKey(name);
|
|
95
|
-
const description = schema.description ?? "";
|
|
96
|
-
if (Array.isArray(schema.enum) && schema.enum.length > 0) {
|
|
97
|
-
const values = schema.enum.filter((v) => typeof v === "string" || typeof v === "number");
|
|
98
|
-
return {
|
|
99
|
-
name,
|
|
100
|
-
label,
|
|
101
|
-
type: "select",
|
|
102
|
-
required,
|
|
103
|
-
placeholder: "",
|
|
104
|
-
description,
|
|
105
|
-
options: values.map((v) => ({ label: String(v), value: typeof v === "number" ? v : String(v) })),
|
|
106
|
-
defaultValue: schema.default ?? values[0]
|
|
107
|
-
};
|
|
108
|
-
}
|
|
109
|
-
switch (schema.type) {
|
|
110
|
-
case "string": {
|
|
111
|
-
const isLong = (schema.maxLength ?? 0) > 200;
|
|
112
|
-
return {
|
|
113
|
-
name,
|
|
114
|
-
label,
|
|
115
|
-
type: isLong ? "textarea" : "text",
|
|
116
|
-
required,
|
|
117
|
-
placeholder: "",
|
|
118
|
-
description,
|
|
119
|
-
defaultValue: schema.default ?? ""
|
|
120
|
-
};
|
|
121
|
-
}
|
|
122
|
-
case "number":
|
|
123
|
-
case "integer": {
|
|
124
|
-
const field = {
|
|
125
|
-
name,
|
|
126
|
-
label,
|
|
127
|
-
type: "number",
|
|
128
|
-
required,
|
|
129
|
-
placeholder: "",
|
|
130
|
-
description,
|
|
131
|
-
defaultValue: schema.default ?? 0
|
|
132
|
-
};
|
|
133
|
-
if (typeof schema.minimum === "number" && schema.minimum > Number.MIN_SAFE_INTEGER) field.min = schema.minimum;
|
|
134
|
-
if (typeof schema.maximum === "number" && schema.maximum < Number.MAX_SAFE_INTEGER) field.max = schema.maximum;
|
|
135
|
-
return field;
|
|
136
|
-
}
|
|
137
|
-
case "boolean":
|
|
138
|
-
return {
|
|
139
|
-
name,
|
|
140
|
-
label,
|
|
141
|
-
type: "checkbox",
|
|
142
|
-
required,
|
|
143
|
-
placeholder: "",
|
|
144
|
-
description,
|
|
145
|
-
defaultValue: schema.default ?? false
|
|
146
|
-
};
|
|
147
|
-
default:
|
|
148
|
-
return null;
|
|
149
|
-
}
|
|
150
|
-
}
|
|
151
|
-
function jsonSchemaToFormFields(jsonSchema) {
|
|
152
|
-
const fields = [];
|
|
153
|
-
const initialValues = {};
|
|
154
|
-
if (jsonSchema.type !== "object" || !jsonSchema.properties) {
|
|
155
|
-
fields.push({ name: "__input__", label: "Input (JSON)", fallback: true });
|
|
156
|
-
initialValues["__input__"] = jsonSchema.default !== void 0 ? JSON.stringify(jsonSchema.default, null, 2) : "";
|
|
157
|
-
return { fields, initialValues, isObject: false };
|
|
158
|
-
}
|
|
159
|
-
const required = new Set(jsonSchema.required ?? []);
|
|
160
|
-
for (const [name, propSchemaRaw] of Object.entries(jsonSchema.properties)) {
|
|
161
|
-
const propSchema = unwrapNullable(propSchemaRaw);
|
|
162
|
-
const isRequired = required.has(name) && propSchema.default === void 0;
|
|
163
|
-
const formField = propSchemaToFormField(name, propSchema, isRequired);
|
|
164
|
-
if (formField) {
|
|
165
|
-
fields.push(formField);
|
|
166
|
-
initialValues[name] = propSchema.default ?? formField.defaultValue;
|
|
167
|
-
} else {
|
|
168
|
-
fields.push({ name, label: humanizeKey(name), fallback: true });
|
|
169
|
-
initialValues[name] = propSchema.default !== void 0 ? JSON.stringify(propSchema.default, null, 2) : "";
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
return { fields, initialValues, isObject: true };
|
|
173
|
-
}
|
|
174
|
-
function sanitizeInput(schema, value) {
|
|
175
|
-
const jsonSchema = toJsonSchema(schema);
|
|
176
|
-
const emptyParse = schema.safeParse({});
|
|
177
|
-
const baseDefaults = emptyParse.success && emptyParse.data && typeof emptyParse.data === "object" && !Array.isArray(emptyParse.data) ? emptyParse.data : extractDefaults(jsonSchema);
|
|
178
|
-
if (value === null || value === void 0 || typeof value !== "object" || Array.isArray(value)) {
|
|
179
|
-
return baseDefaults;
|
|
180
|
-
}
|
|
181
|
-
if (jsonSchema.type !== "object" || !jsonSchema.properties) {
|
|
182
|
-
const parsed = schema.safeParse(value);
|
|
183
|
-
return parsed.success && parsed.data && typeof parsed.data === "object" && !Array.isArray(parsed.data) ? parsed.data : baseDefaults;
|
|
184
|
-
}
|
|
185
|
-
const raw = value;
|
|
186
|
-
const result = { ...baseDefaults };
|
|
187
|
-
if (schema instanceof z.ZodObject) {
|
|
188
|
-
const shape = schema.shape;
|
|
189
|
-
for (const key of Object.keys(jsonSchema.properties)) {
|
|
190
|
-
if (key in raw && shape[key]) {
|
|
191
|
-
const fieldParsed = shape[key].safeParse(raw[key]);
|
|
192
|
-
if (fieldParsed.success) {
|
|
193
|
-
result[key] = fieldParsed.data;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
}
|
|
197
|
-
}
|
|
198
|
-
return result;
|
|
199
|
-
}
|
|
200
|
-
function ZodFormRenderer({
|
|
201
|
-
schema,
|
|
202
|
-
defaults,
|
|
203
|
-
onSubmit,
|
|
204
|
-
submitLabel = "Submit",
|
|
205
|
-
isPending = false
|
|
206
|
-
}) {
|
|
207
|
-
const jsonSchema = toJsonSchema(schema);
|
|
208
|
-
const { fields, initialValues, isObject } = jsonSchemaToFormFields(jsonSchema);
|
|
209
|
-
const mergedInitialValues = { ...initialValues };
|
|
210
|
-
if (isObject && defaults) {
|
|
211
|
-
for (const [key, value] of Object.entries(defaults)) {
|
|
212
|
-
if (value !== void 0) mergedInitialValues[key] = value;
|
|
213
|
-
}
|
|
214
|
-
} else if (!isObject && defaults !== void 0) {
|
|
215
|
-
mergedInitialValues["__input__"] = JSON.stringify(defaults, null, 2);
|
|
216
|
-
}
|
|
217
|
-
const form = useForm({ initialValues: mergedInitialValues });
|
|
218
|
-
const handleSubmit = (values) => {
|
|
219
|
-
const coerced = {};
|
|
220
|
-
for (const field of fields) {
|
|
221
|
-
const raw = values[field.name];
|
|
222
|
-
if ("fallback" in field) {
|
|
223
|
-
try {
|
|
224
|
-
coerced[field.name] = raw !== "" && raw !== void 0 ? JSON.parse(raw) : void 0;
|
|
225
|
-
} catch {
|
|
226
|
-
coerced[field.name] = raw;
|
|
227
|
-
}
|
|
228
|
-
} else {
|
|
229
|
-
coerced[field.name] = raw;
|
|
230
|
-
}
|
|
231
|
-
}
|
|
232
|
-
const payload = isObject ? coerced : coerced["__input__"] ?? coerced;
|
|
233
|
-
const parsed = schema.safeParse(payload);
|
|
234
|
-
if (!parsed.success) {
|
|
235
|
-
for (const issue of parsed.error.issues) {
|
|
236
|
-
const path = issue.path.join(".");
|
|
237
|
-
if (path) form.setFieldError(path, issue.message);
|
|
238
|
-
}
|
|
239
|
-
return;
|
|
240
|
-
}
|
|
241
|
-
void onSubmit(parsed.data);
|
|
242
|
-
};
|
|
243
|
-
return /* @__PURE__ */ jsx("form", { onSubmit: form.onSubmit(handleSubmit), children: /* @__PURE__ */ jsxs(Stack, { children: [
|
|
244
|
-
fields.map((field) => {
|
|
245
|
-
if ("fallback" in field) {
|
|
246
|
-
return /* @__PURE__ */ jsx(
|
|
247
|
-
Textarea,
|
|
248
|
-
{
|
|
249
|
-
label: field.label,
|
|
250
|
-
placeholder: "Enter JSON value",
|
|
251
|
-
minRows: 3,
|
|
252
|
-
autosize: true,
|
|
253
|
-
...form.getInputProps(field.name),
|
|
254
|
-
error: form.errors[field.name]
|
|
255
|
-
},
|
|
256
|
-
field.name
|
|
257
|
-
);
|
|
258
|
-
}
|
|
259
|
-
return /* @__PURE__ */ jsx(FormFieldRenderer, { field, form }, field.name);
|
|
260
|
-
}),
|
|
261
|
-
/* @__PURE__ */ jsx(Button, { type: "submit", loading: isPending, fullWidth: true, children: submitLabel })
|
|
262
|
-
] }) });
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
export { FormFieldRenderer, ZodFormRenderer, sanitizeInput };
|
package/dist/chunk-3ZMAGTWF.js
DELETED
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import { useMemo } from 'react';
|
|
2
|
-
|
|
3
|
-
// src/execution/hooks/useMergedExecution.ts
|
|
4
|
-
function useMergedExecution(fetchedExecution, streamingLogs) {
|
|
5
|
-
return useMemo(() => {
|
|
6
|
-
if (!fetchedExecution) return void 0;
|
|
7
|
-
if (!streamingLogs || streamingLogs.length === 0) return fetchedExecution;
|
|
8
|
-
const existingKeys = new Set(fetchedExecution.executionLogs.map((log) => `${log.timestamp}:${log.message}`));
|
|
9
|
-
const newLogs = streamingLogs.filter((log) => !existingKeys.has(`${log.timestamp}:${log.message}`));
|
|
10
|
-
if (newLogs.length === 0) return fetchedExecution;
|
|
11
|
-
return {
|
|
12
|
-
...fetchedExecution,
|
|
13
|
-
executionLogs: [...fetchedExecution.executionLogs, ...newLogs].sort((a, b) => a.timestamp - b.timestamp)
|
|
14
|
-
};
|
|
15
|
-
}, [fetchedExecution, streamingLogs]);
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
export { useMergedExecution };
|