@elevasis/ui 2.67.0 → 2.69.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.
Files changed (122) hide show
  1. package/dist/api/index.d.ts +1 -1
  2. package/dist/api/index.js +3 -3
  3. package/dist/app/index.d.ts +575 -370
  4. package/dist/app/index.js +17 -23
  5. package/dist/auth/index.css +149 -149
  6. package/dist/auth/index.d.ts +5 -0
  7. package/dist/auth/index.js +11 -13
  8. package/dist/charts/index.css +208 -208
  9. package/dist/charts/index.js +11 -13
  10. package/dist/{chunk-M535KHLW.js → chunk-26BTE3Z4.js} +1 -1
  11. package/dist/chunk-3KMDHCAR.js +52 -0
  12. package/dist/chunk-3MEXPLWT.js +265 -0
  13. package/dist/chunk-4JHLS234.js +39 -0
  14. package/dist/chunk-6PZFOHJK.js +1764 -0
  15. package/dist/chunk-7WJEPTE7.js +194 -0
  16. package/dist/chunk-AH52XQB7.js +1 -0
  17. package/dist/{chunk-UFTM5SZZ.js → chunk-AKANHRQ5.js} +9 -3
  18. package/dist/chunk-BZZCNLT6.js +12 -0
  19. package/dist/chunk-C75XWBYZ.js +383 -0
  20. package/dist/chunk-DLR4SDZW.js +51 -0
  21. package/dist/{chunk-4OEVLV66.js → chunk-FLECOYUS.js} +113 -148
  22. package/dist/chunk-IRV6KJPV.js +425 -0
  23. package/dist/chunk-IT7GTJCB.js +10 -0
  24. package/dist/chunk-LGKLC5MG.js +44 -0
  25. package/dist/chunk-MFLM7BVC.js +85 -0
  26. package/dist/chunk-MRVGQLWN.js +1595 -0
  27. package/dist/{chunk-4DV4ECMG.js → chunk-N7U24M2J.js} +4 -0
  28. package/dist/{chunk-I7BZVVVU.js → chunk-NM4A63KJ.js} +104 -415
  29. package/dist/chunk-NU3NBXHP.js +1194 -0
  30. package/dist/chunk-PDHTXPSF.js +12 -0
  31. package/dist/chunk-RW64UJWT.js +1934 -0
  32. package/dist/{chunk-JFBZ6XDW.js → chunk-SNZDFCOQ.js} +3 -49
  33. package/dist/chunk-TUMSNGTX.js +35 -0
  34. package/dist/chunk-UD657ICS.js +589 -0
  35. package/dist/{chunk-XNW3O6QW.js → chunk-VDX6DL7Z.js} +1 -1
  36. package/dist/chunk-WXHAHKKI.js +16411 -0
  37. package/dist/chunk-XAZR3T6Y.js +2162 -0
  38. package/dist/chunk-XQ3ILKYN.js +37 -0
  39. package/dist/chunk-YCRINA2D.js +67 -0
  40. package/dist/chunk-YGCMMOY4.js +1484 -0
  41. package/dist/chunk-YNRYIXUT.js +10945 -0
  42. package/dist/chunk-ZD6LM53O.js +4528 -0
  43. package/dist/chunk-ZPTEGGKU.js +631 -0
  44. package/dist/components/chat/index.js +2 -1
  45. package/dist/components/index.css +208 -208
  46. package/dist/components/index.d.ts +1634 -264
  47. package/dist/components/index.js +2774 -14
  48. package/dist/components/navigation/index.css +149 -149
  49. package/dist/components/navigation/index.js +12 -13
  50. package/dist/features/auth/index.css +149 -149
  51. package/dist/features/auth/index.d.ts +457 -167
  52. package/dist/features/auth/index.js +13 -14
  53. package/dist/features/clients/index.css +208 -208
  54. package/dist/features/clients/index.d.ts +39 -1
  55. package/dist/features/clients/index.js +16 -13
  56. package/dist/features/content/index.d.ts +1788 -0
  57. package/dist/features/content/index.js +2180 -0
  58. package/dist/features/crm/index.d.ts +1802 -231
  59. package/dist/features/crm/index.js +16 -13
  60. package/dist/features/dashboard/index.d.ts +1 -8
  61. package/dist/features/dashboard/index.js +17 -13
  62. package/dist/features/delivery/index.d.ts +457 -167
  63. package/dist/features/delivery/index.js +16 -13
  64. package/dist/features/knowledge/index.css +149 -149
  65. package/dist/features/knowledge/index.js +11 -13
  66. package/dist/features/lead-gen/index.d.ts +53 -104
  67. package/dist/features/lead-gen/index.js +17 -13
  68. package/dist/features/monitoring/index.js +16 -13
  69. package/dist/features/monitoring/requests/index.js +15 -20
  70. package/dist/features/operations/index.d.ts +1 -86
  71. package/dist/features/operations/index.js +22 -12
  72. package/dist/features/public-agent-chat/index.js +2 -1
  73. package/dist/features/seo/index.js +2 -1
  74. package/dist/features/settings/index.d.ts +457 -167
  75. package/dist/features/settings/index.js +15 -13
  76. package/dist/hooks/access/index.css +149 -149
  77. package/dist/hooks/access/index.d.ts +5 -0
  78. package/dist/hooks/access/index.js +11 -13
  79. package/dist/hooks/delivery/index.d.ts +457 -167
  80. package/dist/hooks/delivery/index.js +2 -23
  81. package/dist/hooks/index.d.ts +2203 -244
  82. package/dist/hooks/index.js +11 -13
  83. package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +1 -8
  84. package/dist/hooks/published.d.ts +2203 -244
  85. package/dist/hooks/published.js +11 -13
  86. package/dist/initialization/index.d.ts +465 -169
  87. package/dist/knowledge/index.css +149 -149
  88. package/dist/knowledge/index.d.ts +5 -90
  89. package/dist/knowledge/index.js +3215 -3203
  90. package/dist/{knowledge-search-index-6EZNBNSR.js → knowledge-search-index-LP2WVSQX.js} +689 -695
  91. package/dist/layout/index.css +149 -149
  92. package/dist/layout/index.js +15 -13
  93. package/dist/organization/index.d.ts +10 -4
  94. package/dist/organization/index.js +1 -21
  95. package/dist/profile/index.d.ts +457 -167
  96. package/dist/provider/index.d.ts +576 -372
  97. package/dist/provider/index.js +11 -13
  98. package/dist/provider/published.css +149 -149
  99. package/dist/provider/published.d.ts +576 -372
  100. package/dist/provider/published.js +11 -13
  101. package/dist/supabase/index.d.ts +906 -347
  102. package/dist/test-utils/index.d.ts +15 -2
  103. package/dist/test-utils/index.js +41 -12
  104. package/dist/test-utils/setup-integration.js +1 -1
  105. package/dist/test-utils/setup.js +1 -1
  106. package/dist/theme/index.js +3 -2
  107. package/dist/theme/presets/index.js +1 -1
  108. package/dist/typeform/index.js +2049 -1
  109. package/dist/types/index.d.ts +477 -177
  110. package/dist/utils/index.d.ts +1 -8
  111. package/dist/utils/index.js +1 -1
  112. package/dist/vite/index.js +2 -2
  113. package/dist/vite-plugin-knowledge/index.js +1 -1
  114. package/package.json +7 -3
  115. package/src/features/README.md +28 -28
  116. package/dist/chunk-5TERYXOO.js +0 -51390
  117. package/dist/chunk-AUDNF2Q7.js +0 -2050
  118. package/dist/index.d.ts +0 -17888
  119. package/dist/index.js +0 -30
  120. package/dist/{chunk-GMXGDO3I.js → chunk-MISHPEJX.js} +1 -1
  121. package/dist/{chunk-RBGVNPA6.js → chunk-XQBURFKM.js} +0 -0
  122. package/dist/{index.css → features/content/index.css} +149 -149
@@ -0,0 +1,265 @@
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 };
@@ -0,0 +1,39 @@
1
+ import { usePresetsContext } from './chunk-FLECOYUS.js';
2
+ import { useMemo } from 'react';
3
+
4
+ var BUILT_IN_NAMES = /* @__PURE__ */ new Set([
5
+ "default",
6
+ "tactical",
7
+ "regal",
8
+ "cyber-volt",
9
+ "aurora",
10
+ "rose-gold",
11
+ "midnight",
12
+ "titanium",
13
+ "obsidian",
14
+ "honey",
15
+ "abyss",
16
+ "canopy",
17
+ "slate",
18
+ "cyber-strike",
19
+ "cyber-chrome",
20
+ "cyber-void",
21
+ "quarry"
22
+ ]);
23
+ function titleCase(str) {
24
+ return str.replace(/(^|-)(\w)/g, (_, sep, char) => (sep ? " " : "") + char.toUpperCase());
25
+ }
26
+ function useAvailablePresets() {
27
+ const presetsMap = usePresetsContext();
28
+ return useMemo(() => {
29
+ return Object.entries(presetsMap).map(([key, preset]) => ({
30
+ value: key,
31
+ label: preset.label ?? titleCase(key),
32
+ description: preset.description ?? "",
33
+ colors: preset.colors ?? [preset.dark.primary, preset.dark.background, preset.light.background],
34
+ isCustom: !BUILT_IN_NAMES.has(key)
35
+ }));
36
+ }, [presetsMap]);
37
+ }
38
+
39
+ export { useAvailablePresets };