@elevasis/ui 2.10.2 → 2.11.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 (40) hide show
  1. package/dist/app/index.js +2 -2
  2. package/dist/{chunk-TSX4I3NW.js → chunk-23PZ57GB.js} +1 -1
  3. package/dist/{chunk-6PNHW4X2.js → chunk-24UMQV5B.js} +51 -95
  4. package/dist/chunk-3ZMAGTWF.js +18 -0
  5. package/dist/{chunk-WHQXDETX.js → chunk-AQDBRRZD.js} +124 -5
  6. package/dist/{chunk-CLXMNMIS.js → chunk-BDENEI4Q.js} +536 -39
  7. package/dist/{chunk-GJVGV7QZ.js → chunk-BLQLWIOW.js} +276 -5
  8. package/dist/chunk-BRXELOHC.js +47 -0
  9. package/dist/{chunk-YQLE5HR5.js → chunk-BSCTPKXM.js} +2 -2
  10. package/dist/{chunk-LPSBID5V.js → chunk-DJBORKTR.js} +1 -1
  11. package/dist/{chunk-E3IFHX6A.js → chunk-DOFVHWAP.js} +483 -321
  12. package/dist/{chunk-XA34RETF.js → chunk-GHIPBT5V.js} +1 -14
  13. package/dist/{chunk-KYOF6NYW.js → chunk-KDAOCM66.js} +1 -1
  14. package/dist/{chunk-CYT4PORT.js → chunk-L34DFR2K.js} +7 -51
  15. package/dist/{chunk-AT5XCBTU.js → chunk-TNOIOBYI.js} +2 -2
  16. package/dist/{chunk-M6ZZ2FW5.js → chunk-XYSMBMAR.js} +3 -3
  17. package/dist/components/index.d.ts +69 -3
  18. package/dist/components/index.js +20 -18
  19. package/dist/execution/index.js +2 -1
  20. package/dist/features/crm/index.d.ts +7 -2
  21. package/dist/features/crm/index.js +6 -4
  22. package/dist/features/dashboard/index.js +7 -5
  23. package/dist/features/delivery/index.d.ts +14 -1
  24. package/dist/features/delivery/index.js +6 -4
  25. package/dist/features/lead-gen/index.js +10 -8
  26. package/dist/features/monitoring/index.js +8 -6
  27. package/dist/features/operations/index.js +9 -7
  28. package/dist/features/settings/index.js +7 -5
  29. package/dist/hooks/index.d.ts +230 -51
  30. package/dist/hooks/index.js +5 -3
  31. package/dist/hooks/published.d.ts +230 -51
  32. package/dist/hooks/published.js +5 -3
  33. package/dist/index.d.ts +191 -22
  34. package/dist/index.js +7 -5
  35. package/dist/provider/index.js +2 -2
  36. package/dist/supabase/index.js +2 -47
  37. package/dist/theme/index.js +2 -2
  38. package/dist/zustand/index.d.ts +0 -4
  39. package/dist/zustand/index.js +0 -10
  40. package/package.json +2 -2
@@ -1,21 +1,23 @@
1
1
  import { ResourceHealthChart } from './chunk-LGKLC5MG.js';
2
2
  import { useCyberColors, HeroStatsRow } from './chunk-STZJ7SY5.js';
3
3
  import { AppShellCenteredContainer, AppShellLoader } from './chunk-YEX4MQSY.js';
4
- import { STATUS_COLORS, getStatusIcon, formatDuration, getStatusColors, AGENT_CONSTANTS, shouldAnimateEdge, TIMELINE_CONSTANTS, calculateBarPosition, CONTAINER_CONSTANTS, useExecutionPath, useUnifiedWorkflowLayout, WORKFLOW_CONSTANTS, useReactFlowAgent } from './chunk-XA34RETF.js';
5
- import { useDashboardMetrics, useResources, useTimeRangeDates, useUnresolvedErrors, useRecentExecutionsByResource, useCommandQueue, useScheduledTasks, useResourcesHealth } from './chunk-E3IFHX6A.js';
4
+ import { STATUS_COLORS, getStatusIcon, formatDuration, getStatusColors, AGENT_CONSTANTS, shouldAnimateEdge, TIMELINE_CONSTANTS, calculateBarPosition, CONTAINER_CONSTANTS, useExecutionPath, useUnifiedWorkflowLayout, WORKFLOW_CONSTANTS, useReactFlowAgent } from './chunk-GHIPBT5V.js';
5
+ import { useExecuteResource, useDashboardMetrics, useResources, useTimeRangeDates, useUnresolvedErrors, useRecentExecutionsByResource, useCommandQueue, useScheduledTasks, useResourcesHealth } from './chunk-DOFVHWAP.js';
6
6
  import { getTimeRangeDates } from './chunk-LXHZYSMQ.js';
7
7
  import { Graph_module_css_default, useDirectedChainHighlighting, useNodeSelection, useFitViewTrigger } from './chunk-22UVE3RA.js';
8
- import { glassBase } from './chunk-6PNHW4X2.js';
8
+ import { glassBase } from './chunk-24UMQV5B.js';
9
9
  import { GlowDot, CardHeader, EmptyState, PageTitleCaption, TabCountBadge } from './chunk-SQQGLGHW.js';
10
10
  import { ResourceStatusColors } from './chunk-ELJIFLCB.js';
11
11
  import { formatTimeAgo, formatRelativeTime } from './chunk-IOKL7BKE.js';
12
12
  import { useInitialization } from './chunk-TUXTSEAF.js';
13
13
  import { memo, useMemo, useEffect, useState, useCallback, Fragment } from 'react';
14
- import { Paper, Stack, Text, Group, Badge, Box, useComputedColorScheme, Card, ActionIcon, Loader, SegmentedControl, Center, SimpleGrid, Title, Tabs, Grid, ThemeIcon } from '@mantine/core';
14
+ import { Paper, Stack, Text, Group, Badge, Box, useComputedColorScheme, Card, ActionIcon, Loader, SegmentedControl, TextInput, Textarea, Radio, Checkbox, Select, NumberInput, Button, Modal, Center, SimpleGrid, Title, Tabs, Grid, ThemeIcon } from '@mantine/core';
15
15
  import { jsxs, jsx, Fragment as Fragment$1 } from 'react/jsx-runtime';
16
16
  import { Position, Handle, getSmoothStepPath, BaseEdge as BaseEdge$1, EdgeLabelRenderer, Panel, useReactFlow, Controls, ReactFlowProvider, ReactFlow } from '@xyflow/react';
17
17
  import { IconPlayerPlay, IconPlayerStop, IconArrowsSplit, IconSquare, IconFocus2, IconArrowUpRight, IconLayoutDashboard, IconActivity, IconAlertTriangle, IconHandStop, IconCalendarEvent, IconCircleCheck, IconBrain, IconGitBranch } from '@tabler/icons-react';
18
18
  import '@xyflow/react/dist/style.css';
19
+ import { notifications } from '@mantine/notifications';
20
+ import { useForm } from '@mantine/form';
19
21
  import '@mantine/charts/styles.css';
20
22
 
21
23
  var DOMAIN_COLORS = {
@@ -1192,6 +1194,275 @@ function AgentExecutionTimeline({ iterationData, selectedIterationId }) {
1192
1194
  )
1193
1195
  ] });
1194
1196
  }
1197
+ function FormFieldRenderer({ field, form, richTextRenderer }) {
1198
+ const commonProps = {
1199
+ label: field.label,
1200
+ description: field.description,
1201
+ placeholder: field.placeholder,
1202
+ required: field.required,
1203
+ ...form.getInputProps(field.name)
1204
+ };
1205
+ switch (field.type) {
1206
+ case "text":
1207
+ return /* @__PURE__ */ jsx(TextInput, { ...commonProps });
1208
+ case "textarea":
1209
+ return /* @__PURE__ */ jsx(Textarea, { ...commonProps, minRows: 3, autosize: true });
1210
+ case "number":
1211
+ return /* @__PURE__ */ jsx(NumberInput, { ...commonProps, min: field.min, max: field.max });
1212
+ case "select":
1213
+ return /* @__PURE__ */ jsx(
1214
+ Select,
1215
+ {
1216
+ ...commonProps,
1217
+ data: field.options?.map((opt) => ({
1218
+ label: opt.label,
1219
+ value: String(opt.value)
1220
+ })) || []
1221
+ }
1222
+ );
1223
+ case "checkbox":
1224
+ return /* @__PURE__ */ jsx(Checkbox, { ...commonProps, ...form.getInputProps(field.name, { type: "checkbox" }) });
1225
+ case "radio":
1226
+ 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)) }) });
1227
+ case "richtext": {
1228
+ const inputProps = form.getInputProps(field.name);
1229
+ if (richTextRenderer) {
1230
+ return richTextRenderer({
1231
+ content: inputProps.value || "",
1232
+ onChange: (content) => form.setFieldValue(field.name, content),
1233
+ placeholder: field.placeholder
1234
+ });
1235
+ }
1236
+ return /* @__PURE__ */ jsx(Textarea, { ...commonProps, minRows: 5, autosize: true });
1237
+ }
1238
+ default:
1239
+ return /* @__PURE__ */ jsx(TextInput, { ...commonProps });
1240
+ }
1241
+ }
1242
+ function getTypeName(schema) {
1243
+ return schema._def.typeName;
1244
+ }
1245
+ function unwrapOptionalOrNullable(schema) {
1246
+ const name = getTypeName(schema);
1247
+ if (name === "ZodOptional" || name === "ZodNullable") {
1248
+ return unwrapOptionalOrNullable(schema._def.innerType);
1249
+ }
1250
+ if (name === "ZodDefault") {
1251
+ return unwrapOptionalOrNullable(schema._def.innerType);
1252
+ }
1253
+ return schema;
1254
+ }
1255
+ function getDefaultValue(schema) {
1256
+ const name = getTypeName(schema);
1257
+ if (name === "ZodDefault") {
1258
+ const def = schema._def;
1259
+ return def.defaultValue();
1260
+ }
1261
+ if (name === "ZodOptional" || name === "ZodNullable") {
1262
+ return getDefaultValue(schema._def.innerType);
1263
+ }
1264
+ return void 0;
1265
+ }
1266
+ function zodTypeToFormField(name, fieldSchema, required) {
1267
+ const inner = unwrapOptionalOrNullable(fieldSchema);
1268
+ const typeName = getTypeName(inner);
1269
+ const label = name.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase());
1270
+ switch (typeName) {
1271
+ case "ZodString": {
1272
+ const checks = inner._def.checks ?? [];
1273
+ const maxCheck = checks.find((c) => c.kind === "max");
1274
+ const isLong = maxCheck ? (maxCheck.value ?? 0) > 200 : false;
1275
+ return {
1276
+ name,
1277
+ label,
1278
+ type: isLong ? "textarea" : "text",
1279
+ required,
1280
+ placeholder: "",
1281
+ description: "",
1282
+ defaultValue: ""
1283
+ };
1284
+ }
1285
+ case "ZodNumber":
1286
+ return {
1287
+ name,
1288
+ label,
1289
+ type: "number",
1290
+ required,
1291
+ placeholder: "",
1292
+ description: "",
1293
+ defaultValue: 0
1294
+ };
1295
+ case "ZodBoolean":
1296
+ return {
1297
+ name,
1298
+ label,
1299
+ type: "checkbox",
1300
+ required,
1301
+ placeholder: "",
1302
+ description: "",
1303
+ defaultValue: false
1304
+ };
1305
+ case "ZodEnum": {
1306
+ const values = inner._def.values;
1307
+ return {
1308
+ name,
1309
+ label,
1310
+ type: "select",
1311
+ required,
1312
+ placeholder: "",
1313
+ description: "",
1314
+ options: values.map((v) => ({ label: v, value: v })),
1315
+ defaultValue: values[0] ?? ""
1316
+ };
1317
+ }
1318
+ default:
1319
+ return null;
1320
+ }
1321
+ }
1322
+ function ZodFormRenderer({
1323
+ schema,
1324
+ defaults,
1325
+ onSubmit,
1326
+ submitLabel = "Submit",
1327
+ isPending = false
1328
+ }) {
1329
+ const typeName = getTypeName(schema);
1330
+ const fields = [];
1331
+ const initialValues = {};
1332
+ if (typeName === "ZodObject") {
1333
+ const shape = schema.shape;
1334
+ for (const [fieldName, fieldSchema] of Object.entries(shape)) {
1335
+ const isRequired = getTypeName(fieldSchema) !== "ZodOptional" && getTypeName(fieldSchema) !== "ZodNullable";
1336
+ const formField = zodTypeToFormField(fieldName, fieldSchema, isRequired);
1337
+ const defaultForField = defaults?.[fieldName];
1338
+ const fieldDefault = defaultForField ?? getDefaultValue(fieldSchema);
1339
+ if (formField) {
1340
+ fields.push(formField);
1341
+ initialValues[fieldName] = fieldDefault ?? formField.defaultValue;
1342
+ } else {
1343
+ const raw = fieldDefault !== void 0 ? JSON.stringify(fieldDefault, null, 2) : "";
1344
+ fields.push({ name: fieldName, label: fieldName, fallback: true });
1345
+ initialValues[fieldName] = raw;
1346
+ }
1347
+ }
1348
+ } else {
1349
+ const raw = defaults !== void 0 ? JSON.stringify(defaults, null, 2) : "";
1350
+ fields.push({ name: "__input__", label: "Input (JSON)", fallback: true });
1351
+ initialValues["__input__"] = raw;
1352
+ }
1353
+ const form = useForm({ initialValues });
1354
+ const handleSubmit = (values) => {
1355
+ const coerced = {};
1356
+ for (const field of fields) {
1357
+ const raw = values[field.name];
1358
+ if ("fallback" in field) {
1359
+ try {
1360
+ coerced[field.name] = raw !== "" && raw !== void 0 ? JSON.parse(raw) : void 0;
1361
+ } catch {
1362
+ coerced[field.name] = raw;
1363
+ }
1364
+ } else {
1365
+ coerced[field.name] = raw;
1366
+ }
1367
+ }
1368
+ const payload = typeName === "ZodObject" ? coerced : coerced["__input__"] ?? coerced;
1369
+ const parsed = schema.safeParse(payload);
1370
+ if (!parsed.success) {
1371
+ for (const issue of parsed.error.issues) {
1372
+ const path = issue.path.join(".");
1373
+ if (path) form.setFieldError(path, issue.message);
1374
+ }
1375
+ return;
1376
+ }
1377
+ void onSubmit(parsed.data);
1378
+ };
1379
+ return /* @__PURE__ */ jsx("form", { onSubmit: form.onSubmit(handleSubmit), children: /* @__PURE__ */ jsxs(Stack, { children: [
1380
+ fields.map((field) => {
1381
+ if ("fallback" in field) {
1382
+ const label = field.label.replace(/([A-Z])/g, " $1").replace(/^./, (s) => s.toUpperCase());
1383
+ return /* @__PURE__ */ jsx(
1384
+ Textarea,
1385
+ {
1386
+ label,
1387
+ placeholder: "Enter JSON value",
1388
+ minRows: 3,
1389
+ autosize: true,
1390
+ ...form.getInputProps(field.name),
1391
+ error: form.errors[field.name]
1392
+ },
1393
+ field.name
1394
+ );
1395
+ }
1396
+ return /* @__PURE__ */ jsx(FormFieldRenderer, { field, form }, field.name);
1397
+ }),
1398
+ /* @__PURE__ */ jsx(Button, { type: "submit", loading: isPending, fullWidth: true, children: submitLabel })
1399
+ ] }) });
1400
+ }
1401
+ function RunResourceButton({
1402
+ resourceId,
1403
+ resourceType,
1404
+ getInput,
1405
+ label,
1406
+ icon,
1407
+ color,
1408
+ organizationModel,
1409
+ onSuccess,
1410
+ onError
1411
+ }) {
1412
+ const [modalState, setModalState] = useState(null);
1413
+ const { execute, isPending } = useExecuteResource({ resourceId, resourceType });
1414
+ const mapping = organizationModel?.resourceMappings?.find((m) => m.resourceId === resourceId);
1415
+ const resolvedLabel = label ?? mapping?.label ?? "Run";
1416
+ const resolvedColor = color ?? mapping?.color ?? void 0;
1417
+ const handleExecute = useCallback(
1418
+ async (input) => {
1419
+ try {
1420
+ const result = await execute(input);
1421
+ setModalState(null);
1422
+ notifications.show({
1423
+ title: "Execution started",
1424
+ message: `Execution ${result.executionId} started`,
1425
+ color: "green"
1426
+ });
1427
+ onSuccess?.(result);
1428
+ } catch (err) {
1429
+ const error = err instanceof Error ? err : new Error(String(err));
1430
+ notifications.show({
1431
+ title: "Execution failed",
1432
+ message: error.message,
1433
+ color: "red"
1434
+ });
1435
+ onError?.(error);
1436
+ }
1437
+ },
1438
+ [execute, onSuccess, onError]
1439
+ );
1440
+ const handleClick = useCallback(() => {
1441
+ const result = getInput();
1442
+ if ("schema" in result) {
1443
+ const withSchema = result;
1444
+ setModalState({
1445
+ schema: withSchema.schema,
1446
+ defaults: "defaults" in result ? result.defaults : void 0
1447
+ });
1448
+ } else {
1449
+ void handleExecute(result);
1450
+ }
1451
+ }, [getInput, handleExecute]);
1452
+ return /* @__PURE__ */ jsxs(Fragment$1, { children: [
1453
+ /* @__PURE__ */ jsx(Button, { leftSection: icon, color: resolvedColor, loading: isPending, onClick: handleClick, children: resolvedLabel }),
1454
+ /* @__PURE__ */ jsx(Modal, { opened: modalState !== null, onClose: () => setModalState(null), children: modalState !== null && /* @__PURE__ */ jsx(
1455
+ ZodFormRenderer,
1456
+ {
1457
+ schema: modalState.schema,
1458
+ defaults: modalState.defaults,
1459
+ isPending,
1460
+ submitLabel: resolvedLabel,
1461
+ onSubmit: (data) => handleExecute(data)
1462
+ }
1463
+ ) })
1464
+ ] });
1465
+ }
1195
1466
  var DEFAULT_LIMIT = 6;
1196
1467
  var typeIcons = {
1197
1468
  workflow: IconGitBranch,
@@ -1801,4 +2072,4 @@ function UnresolvedErrorsTeaser({ timeRange, onNavigateToAllErrors }) {
1801
2072
  );
1802
2073
  }
1803
2074
 
1804
- export { AgentExecutionTimeline, AgentExecutionVisualizer, AgentIterationEdge, AgentIterationNode, BaseEdge, BaseNode, Dashboard, EmptyVisualizer, ExecutionStats, ExecutionStatusBadge, GraphBackground, GraphContainer, GraphFitViewButton, GraphFitViewHandler, GraphLegend, OperationsOverview, RecentExecutionsByResource, ResourceOverview, TimelineAxis, TimelineBar, TimelineContainer, TimelineRow, UnifiedWorkflowEdge, UnifiedWorkflowGraph, UnifiedWorkflowNode, UnresolvedErrorsTeaser, VisualizerContainer, WorkflowExecutionTimeline, getGraphBackgroundStyles, useGraphBackgroundStyles, useGraphTheme };
2075
+ export { AgentExecutionTimeline, AgentExecutionVisualizer, AgentIterationEdge, AgentIterationNode, BaseEdge, BaseNode, Dashboard, EmptyVisualizer, ExecutionStats, ExecutionStatusBadge, FormFieldRenderer, GraphBackground, GraphContainer, GraphFitViewButton, GraphFitViewHandler, GraphLegend, OperationsOverview, RecentExecutionsByResource, ResourceOverview, RunResourceButton, TimelineAxis, TimelineBar, TimelineContainer, TimelineRow, UnifiedWorkflowEdge, UnifiedWorkflowGraph, UnifiedWorkflowNode, UnresolvedErrorsTeaser, VisualizerContainer, WorkflowExecutionTimeline, ZodFormRenderer, getGraphBackgroundStyles, useGraphBackgroundStyles, useGraphTheme };
@@ -0,0 +1,47 @@
1
+ import { useAuthContext } from './chunk-BRJ3QZ4E.js';
2
+ import { createClient } from '@supabase/supabase-js';
3
+ import { useMemo } from 'react';
4
+
5
+ function getSupabaseConfig() {
6
+ const url = import.meta.env?.VITE_SUPABASE_URL;
7
+ const anonKey = import.meta.env?.VITE_SUPABASE_ANON_KEY;
8
+ if (!url || !anonKey) {
9
+ throw new Error("Missing Supabase environment variables (VITE_SUPABASE_URL, VITE_SUPABASE_ANON_KEY)");
10
+ }
11
+ return { url, anonKey };
12
+ }
13
+ var _supabase = null;
14
+ function getSupabaseClient() {
15
+ if (!_supabase) {
16
+ const { url, anonKey } = getSupabaseConfig();
17
+ _supabase = createClient(url, anonKey);
18
+ }
19
+ return _supabase;
20
+ }
21
+ var useSupabase = () => {
22
+ const { getAccessToken } = useAuthContext();
23
+ const { url, anonKey } = getSupabaseConfig();
24
+ return useMemo(
25
+ () => createClient(url, anonKey, {
26
+ global: {
27
+ headers: {
28
+ // Additional headers if needed
29
+ }
30
+ },
31
+ accessToken: async () => {
32
+ try {
33
+ const token = await getAccessToken();
34
+ if (!token) {
35
+ return null;
36
+ }
37
+ return token;
38
+ } catch {
39
+ return null;
40
+ }
41
+ }
42
+ }),
43
+ [getAccessToken, url, anonKey]
44
+ );
45
+ };
46
+
47
+ export { getSupabaseClient, useSupabase };
@@ -2,8 +2,8 @@ import { FilterBar } from './chunk-PDHTXPSF.js';
2
2
  import { CustomModal } from './chunk-GBMNCNHX.js';
3
3
  import { CyberAreaChart, CostTrendChart, ActivityTrendChart } from './chunk-STZJ7SY5.js';
4
4
  import { AppShellLoader } from './chunk-YEX4MQSY.js';
5
- import { formatDuration } from './chunk-XA34RETF.js';
6
- import { useResolveError, useResolveAllErrors, usePaginationState, useErrorDetails, useMarkAsRead, useExecutionLogsFilters, useExecutionLogs, useExecutionHealth, useErrorAnalysis, useTimeRangeDates, useErrorDetail, useResolveErrorsByExecution, useResources, useCostTrends, useCostSummary, useCostByModel, useCostBreakdown, useActivityFilters, useActivityTrend, useActivities, useNotifications, useMarkAllAsRead, useTestNotification } from './chunk-E3IFHX6A.js';
5
+ import { formatDuration } from './chunk-GHIPBT5V.js';
6
+ import { useResolveError, useResolveAllErrors, usePaginationState, useErrorDetails, useMarkAsRead, useExecutionLogsFilters, useExecutionLogs, useExecutionHealth, useErrorAnalysis, useTimeRangeDates, useErrorDetail, useResolveErrorsByExecution, useResources, useCostTrends, useCostSummary, useCostByModel, useCostBreakdown, useActivityFilters, useActivityTrend, useActivities, useNotifications, useMarkAllAsRead, useTestNotification } from './chunk-DOFVHWAP.js';
7
7
  import { formatBucketTime, getTimeRangeDates } from './chunk-LXHZYSMQ.js';
8
8
  import { CenteredErrorState, CardHeader, StatsCardSkeleton, TrendIndicator, DetailCardSkeleton, EmptyState, PageTitleCaption, JsonViewer } from './chunk-SQQGLGHW.js';
9
9
  import { PAGE_SIZE_DEFAULT } from './chunk-IOKL7BKE.js';
@@ -1,4 +1,4 @@
1
- import { PRESETS, getPreset, generateShades, mantineThemeOverride, createCssVariablesResolver, PresetsProvider } from './chunk-6PNHW4X2.js';
1
+ import { PRESETS, getPreset, generateShades, mantineThemeOverride, createCssVariablesResolver, PresetsProvider } from './chunk-24UMQV5B.js';
2
2
  import { AppBackground } from './chunk-F4TPY6YL.js';
3
3
  import { ElevasisCoreProvider } from './chunk-R7WLWGPO.js';
4
4
  import { ElevasisLoader } from './chunk-SZHARWKU.js';