@elevasis/ui 2.36.0 → 2.38.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 (95) hide show
  1. package/dist/api/index.js +4 -3
  2. package/dist/app/index.css +0 -384
  3. package/dist/app/index.d.ts +75 -2
  4. package/dist/app/index.js +22 -21
  5. package/dist/auth/index.d.ts +91 -28
  6. package/dist/auth/index.js +5 -1
  7. package/dist/charts/index.js +9 -3
  8. package/dist/chunk-4O3VAALW.js +349 -0
  9. package/dist/{chunk-O2Q4VMRN.js → chunk-566XWGPP.js} +76 -109
  10. package/dist/chunk-5EYJ2GIN.js +122 -0
  11. package/dist/chunk-6D4LCJ52.js +10 -0
  12. package/dist/chunk-6ROXVZ3L.js +9 -0
  13. package/dist/{chunk-YYX7OPZQ.js → chunk-73EWE2EW.js} +1 -1
  14. package/dist/{chunk-SIQ3P4OR.js → chunk-7GQFIWP4.js} +8 -756
  15. package/dist/{chunk-VKIZUUPM.js → chunk-7YXZFS56.js} +31 -14
  16. package/dist/{chunk-AKW7KISS.js → chunk-7ZWXTH5J.js} +2 -44
  17. package/dist/chunk-A7IG36LB.js +215 -0
  18. package/dist/chunk-B2DZLPDL.js +39 -0
  19. package/dist/chunk-C6BDBZRO.js +422 -0
  20. package/dist/chunk-CLDCYJQT.js +1 -0
  21. package/dist/{chunk-LUYVRATI.js → chunk-DA6I5VEY.js} +5 -213
  22. package/dist/chunk-H2MEFUQD.js +337 -0
  23. package/dist/chunk-I53EX4VU.js +734 -0
  24. package/dist/chunk-IIMU5YAJ.js +53 -0
  25. package/dist/chunk-JXVNHVK7.js +79 -0
  26. package/dist/chunk-M7Q4UBRY.js +85 -0
  27. package/dist/{chunk-K4UZU3TU.js → chunk-P34FFSOX.js} +1 -1
  28. package/dist/chunk-PGWANFNE.js +112 -0
  29. package/dist/{chunk-F6EFC2MJ.js → chunk-Q64E2TZY.js} +440 -2075
  30. package/dist/chunk-S3XR4II4.js +30 -0
  31. package/dist/chunk-SHZT7ULK.js +425 -0
  32. package/dist/{chunk-GX6XBRRF.js → chunk-TYRUKGGD.js} +2 -1
  33. package/dist/{chunk-R3VCBZDC.js → chunk-X4WBGKJQ.js} +3 -50
  34. package/dist/{chunk-GEFWMU26.js → chunk-X66MVMZT.js} +1 -9
  35. package/dist/{chunk-57OZ3AEG.js → chunk-Y3JQBSKQ.js} +1 -1
  36. package/dist/components/index.d.ts +74 -42
  37. package/dist/components/index.js +34 -19
  38. package/dist/components/navigation/index.js +3 -31
  39. package/dist/features/auth/index.d.ts +97 -99
  40. package/dist/features/auth/index.js +37 -99
  41. package/dist/features/clients/index.js +34 -19
  42. package/dist/features/crm/index.d.ts +65 -0
  43. package/dist/features/crm/index.js +34 -19
  44. package/dist/features/dashboard/index.js +34 -19
  45. package/dist/features/delivery/index.d.ts +65 -0
  46. package/dist/features/delivery/index.js +34 -19
  47. package/dist/features/knowledge/index.js +6 -30
  48. package/dist/features/lead-gen/index.d.ts +1096 -1
  49. package/dist/features/lead-gen/index.js +34 -19
  50. package/dist/features/monitoring/index.js +34 -19
  51. package/dist/features/monitoring/requests/index.js +34 -19
  52. package/dist/features/notes/index.d.ts +72 -0
  53. package/dist/features/notes/index.js +621 -0
  54. package/dist/features/operations/index.d.ts +10 -2
  55. package/dist/features/operations/index.js +34 -19
  56. package/dist/features/right-panel-host/index.d.ts +214 -0
  57. package/dist/features/right-panel-host/index.js +639 -0
  58. package/dist/features/seo/index.js +3 -2
  59. package/dist/features/settings/index.d.ts +68 -35
  60. package/dist/features/settings/index.js +34 -19
  61. package/dist/hooks/access/index.d.ts +90 -0
  62. package/dist/hooks/access/index.js +10 -0
  63. package/dist/hooks/delivery/index.d.ts +65 -0
  64. package/dist/hooks/delivery/index.js +34 -19
  65. package/dist/hooks/index.d.ts +1644 -1651
  66. package/dist/hooks/index.js +34 -19
  67. package/dist/hooks/published.d.ts +1644 -1651
  68. package/dist/hooks/published.js +34 -19
  69. package/dist/hooks/user-notes/index.d.ts +57 -0
  70. package/dist/hooks/user-notes/index.js +3 -0
  71. package/dist/index.d.ts +294 -277
  72. package/dist/index.js +35 -20
  73. package/dist/initialization/index.d.ts +65 -19
  74. package/dist/knowledge/index.d.ts +10 -2
  75. package/dist/knowledge/index.js +173 -28
  76. package/dist/layout/index.js +5 -3
  77. package/dist/organization/index.d.ts +0 -19
  78. package/dist/organization/index.js +34 -19
  79. package/dist/profile/index.d.ts +65 -0
  80. package/dist/provider/index.css +0 -384
  81. package/dist/provider/index.d.ts +75 -2
  82. package/dist/provider/index.js +16 -21
  83. package/dist/provider/published.css +0 -523
  84. package/dist/provider/published.d.ts +75 -2
  85. package/dist/provider/published.js +11 -21
  86. package/dist/supabase/index.d.ts +127 -0
  87. package/dist/test-utils/index.d.ts +2 -21
  88. package/dist/test-utils/index.js +5 -18
  89. package/dist/theme/index.js +3 -1
  90. package/dist/types/index.d.ts +115 -59
  91. package/dist/utils/index.js +2 -1
  92. package/package.json +21 -5
  93. package/src/auth/README.md +6 -6
  94. package/dist/components/navigation/index.css +0 -649
  95. package/dist/features/knowledge/index.css +0 -649
@@ -0,0 +1,53 @@
1
+ import { sidebarIconSize, sidebarIconStroke, sidebarIconInnerSize } from './chunk-DT3QYZVU.js';
2
+ import { Box, Group, ThemeIcon } from '@mantine/core';
3
+ import { jsx, jsxs } from 'react/jsx-runtime';
4
+
5
+ var SubshellSidebarSection = ({
6
+ icon: Icon,
7
+ label,
8
+ rightSection,
9
+ withTopBorder = false
10
+ }) => {
11
+ return /* @__PURE__ */ jsx(
12
+ Box,
13
+ {
14
+ p: "sm",
15
+ style: {
16
+ borderTop: withTopBorder ? "1px solid var(--color-border)" : void 0,
17
+ borderBottom: "1px solid var(--color-border)"
18
+ },
19
+ children: /* @__PURE__ */ jsxs(Group, { gap: "xs", children: [
20
+ /* @__PURE__ */ jsx(
21
+ ThemeIcon,
22
+ {
23
+ variant: "light",
24
+ size: sidebarIconSize,
25
+ style: {
26
+ backgroundColor: "var(--color-surface)",
27
+ color: "var(--color-primary)",
28
+ flexShrink: 0
29
+ },
30
+ children: /* @__PURE__ */ jsx(Icon, { size: sidebarIconInnerSize, stroke: sidebarIconStroke })
31
+ }
32
+ ),
33
+ /* @__PURE__ */ jsx(
34
+ Box,
35
+ {
36
+ c: "var(--color-text)",
37
+ style: {
38
+ fontFamily: "var(--elevasis-font-family-subtitle)",
39
+ flex: 1,
40
+ fontSize: "var(--mantine-font-size-md)",
41
+ fontWeight: 500,
42
+ lineHeight: 1.2
43
+ },
44
+ children: label
45
+ }
46
+ ),
47
+ rightSection
48
+ ] })
49
+ }
50
+ );
51
+ };
52
+
53
+ export { SubshellSidebarSection };
@@ -0,0 +1,79 @@
1
+ import { useElevasisServices } from './chunk-KJ3QUBNU.js';
2
+ import { useQuery, useQueryClient, useMutation } from '@tanstack/react-query';
3
+
4
+ var PRIORITY_ORDER = {
5
+ urgent: 0,
6
+ high: 1,
7
+ normal: 2,
8
+ low: 3
9
+ };
10
+ function sortNotes(notes) {
11
+ return [...notes].sort((a, b) => {
12
+ if (a.pinned !== b.pinned) return a.pinned ? -1 : 1;
13
+ const pa = PRIORITY_ORDER[a.priority] ?? 2;
14
+ const pb = PRIORITY_ORDER[b.priority] ?? 2;
15
+ if (pa !== pb) return pa - pb;
16
+ return new Date(b.updatedAt).getTime() - new Date(a.updatedAt).getTime();
17
+ });
18
+ }
19
+ var userNotesKeys = {
20
+ all: ["user-notes"],
21
+ list: (workOSOrgId) => [...userNotesKeys.all, "list", workOSOrgId]
22
+ };
23
+ function useUserNotes() {
24
+ const { apiRequest, isReady, workOSOrganizationId } = useElevasisServices();
25
+ return useQuery({
26
+ queryKey: userNotesKeys.list(workOSOrganizationId),
27
+ queryFn: async () => {
28
+ const response = await apiRequest("/user-notes");
29
+ return sortNotes(response.notes);
30
+ },
31
+ enabled: isReady
32
+ });
33
+ }
34
+ function useCreateUserNote() {
35
+ const queryClient = useQueryClient();
36
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
37
+ return useMutation({
38
+ mutationFn: (data) => apiRequest("/user-notes", {
39
+ method: "POST",
40
+ body: JSON.stringify(data)
41
+ }),
42
+ onSuccess: () => {
43
+ queryClient.invalidateQueries({
44
+ queryKey: userNotesKeys.list(workOSOrganizationId)
45
+ });
46
+ }
47
+ });
48
+ }
49
+ function useUpdateUserNote() {
50
+ const queryClient = useQueryClient();
51
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
52
+ return useMutation({
53
+ mutationFn: ({ id, ...data }) => apiRequest(`/user-notes/${id}`, {
54
+ method: "PATCH",
55
+ body: JSON.stringify(data)
56
+ }),
57
+ onSuccess: () => {
58
+ queryClient.invalidateQueries({
59
+ queryKey: userNotesKeys.list(workOSOrganizationId)
60
+ });
61
+ }
62
+ });
63
+ }
64
+ function useDeleteUserNote() {
65
+ const queryClient = useQueryClient();
66
+ const { apiRequest, workOSOrganizationId } = useElevasisServices();
67
+ return useMutation({
68
+ mutationFn: (id) => apiRequest(`/user-notes/${id}`, {
69
+ method: "DELETE"
70
+ }),
71
+ onSuccess: () => {
72
+ queryClient.invalidateQueries({
73
+ queryKey: userNotesKeys.list(workOSOrganizationId)
74
+ });
75
+ }
76
+ });
77
+ }
78
+
79
+ export { useCreateUserNote, useDeleteUserNote, useUpdateUserNote, useUserNotes, userNotesKeys };
@@ -0,0 +1,85 @@
1
+ import { useRouterContext } from './chunk-Q7DJKLEN.js';
2
+ import { useOptionalElevasisSystems } from './chunk-C6BDBZRO.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 };
@@ -1,4 +1,4 @@
1
- import { buildOrganizationGraph, projectOrganizationSurfaces, compileOrganizationOntology, SemanticIcon, getSortedSidebarEntries, parseOntologyId, getSystem, resolveSystemConfig } from './chunk-O2Q4VMRN.js';
1
+ import { buildOrganizationGraph, projectOrganizationSurfaces, compileOrganizationOntology, SemanticIcon, getSortedSidebarEntries, parseOntologyId, getSystem, resolveSystemConfig } from './chunk-566XWGPP.js';
2
2
  import { useMemo, useState, useRef, useEffect } from 'react';
3
3
  import { useTree, Text, Tree, UnstyledButton, Group, TextInput } from '@mantine/core';
4
4
  import { useClipboard } from '@mantine/hooks';
@@ -0,0 +1,112 @@
1
+ import { mantineThemeOverride, createCssVariablesResolver } from './chunk-7ZWXTH5J.js';
2
+ import { PresetsProvider } from './chunk-6D4LCJ52.js';
3
+ import { PRESETS, getPreset, generateShades } from './chunk-WF7CONXF.js';
4
+ import { AppBackground } from './chunk-WLOQ4IBG.js';
5
+ import { ElevasisCoreProvider } from './chunk-H2MEFUQD.js';
6
+ import { ElevasisLoader } from './chunk-I53EX4VU.js';
7
+ import { AppearanceProvider } from './chunk-A7IG36LB.js';
8
+ import { getErrorInfo, formatErrorMessage, getErrorTitle } from './chunk-X66MVMZT.js';
9
+ import { useElevasisSystems, ElevasisSystemsProvider } from './chunk-C6BDBZRO.js';
10
+ import { resolveOrganizationModel } from './chunk-566XWGPP.js';
11
+ import { useMemo, useEffect } from 'react';
12
+ import { Loader, mergeThemeOverrides, MantineProvider } from '@mantine/core';
13
+ import '@mantine/core/styles.css';
14
+ import '@mantine/notifications/styles.css';
15
+ import { notifications } from '@mantine/notifications';
16
+ import { jsx } from 'react/jsx-runtime';
17
+
18
+ var EMPTY_CANONICAL_MODEL = resolveOrganizationModel(void 0, { mergeDefaults: false });
19
+ function useResolvedOrganizationModel() {
20
+ const { organizationModel } = useElevasisSystems();
21
+ return useMemo(() => organizationModel ?? EMPTY_CANONICAL_MODEL, [organizationModel]);
22
+ }
23
+ var mantineAdapter = {
24
+ success(title, message) {
25
+ notifications.show({ title, message, autoClose: 5e3, color: "green", position: "top-right" });
26
+ },
27
+ error(title, message) {
28
+ notifications.show({ title, message, autoClose: 5e3, color: "red", position: "top-right" });
29
+ },
30
+ info(title, message) {
31
+ notifications.show({ title, message, autoClose: 5e3, color: "blue", position: "top-right" });
32
+ },
33
+ warning(title, message) {
34
+ notifications.show({ title, message, autoClose: 5e3, color: "orange", position: "top-right" });
35
+ },
36
+ apiError(error) {
37
+ const { message, code, requestId, fields, retryAfter } = getErrorInfo(error);
38
+ const hasFields = fields && Object.keys(fields).length > 0;
39
+ notifications.show({
40
+ title: getErrorTitle(code),
41
+ message: formatErrorMessage(message, requestId, fields, retryAfter),
42
+ autoClose: retryAfter ? retryAfter * 1e3 : hasFields ? 8e3 : 5e3,
43
+ color: "red",
44
+ position: "top-right"
45
+ });
46
+ }
47
+ };
48
+ function ElevasisUIProvider({ theme, children, ...coreProps }) {
49
+ const resolvedColorScheme = theme?.colorScheme ?? "dark";
50
+ const activePresets = theme?.presets ?? PRESETS;
51
+ const preset = useMemo(() => getPreset(theme?.preset ?? "default", theme?.presets), [theme?.preset, theme?.presets]);
52
+ const resolvedAppearance = {
53
+ background: theme?.background ?? preset.background ?? /* @__PURE__ */ jsx(AppBackground, {}),
54
+ loader: theme?.loader ?? preset.loader ?? /* @__PURE__ */ jsx(Loader, { size: "xl", loaders: { elevasis: ElevasisLoader }, type: "elevasis" })
55
+ };
56
+ useEffect(() => {
57
+ if (!preset.fontImports?.length) return;
58
+ const links = [];
59
+ for (const href of preset.fontImports) {
60
+ if (document.querySelector(`link[href="${href}"]`)) continue;
61
+ const link = document.createElement("link");
62
+ link.rel = "stylesheet";
63
+ link.href = href;
64
+ document.head.appendChild(link);
65
+ links.push(link);
66
+ }
67
+ const subtitleFont = preset.subtitleFontFamily ?? preset.framework?.headings?.fontFamily ?? preset.framework?.fontFamily ?? "";
68
+ document.documentElement.style.setProperty("--elevasis-font-family-subtitle", subtitleFont);
69
+ return () => {
70
+ links.forEach((l) => l.remove());
71
+ document.documentElement.style.removeProperty("--elevasis-font-family-subtitle");
72
+ };
73
+ }, [
74
+ preset.fontImports,
75
+ preset.subtitleFontFamily,
76
+ preset.framework?.headings?.fontFamily,
77
+ preset.framework?.fontFamily
78
+ ]);
79
+ const resolvedTheme = useMemo(() => {
80
+ const primaryHex = theme?.tokens?.primary ?? preset.dark.primary;
81
+ const primaryOverride = {
82
+ primaryColor: "primary",
83
+ colors: { primary: generateShades(primaryHex) }
84
+ };
85
+ let base = mergeThemeOverrides(mantineThemeOverride, primaryOverride);
86
+ if (preset.framework) base = mergeThemeOverrides(base, preset.framework);
87
+ return theme?.mantine ? mergeThemeOverrides(base, theme.mantine) : base;
88
+ }, [theme?.mantine, preset, theme?.tokens?.primary]);
89
+ const cssVariablesResolver = useMemo(
90
+ () => createCssVariablesResolver(theme?.tokens, theme?.preset, theme?.presets),
91
+ [theme?.tokens, theme?.preset, theme?.presets]
92
+ );
93
+ return /* @__PURE__ */ jsx(
94
+ MantineProvider,
95
+ {
96
+ theme: resolvedTheme,
97
+ defaultColorScheme: resolvedColorScheme,
98
+ cssVariablesResolver,
99
+ children: /* @__PURE__ */ jsx(PresetsProvider, { value: activePresets, children: /* @__PURE__ */ jsx(AppearanceProvider, { value: resolvedAppearance, children: /* @__PURE__ */ jsx(ElevasisCoreProvider, { notifications: mantineAdapter, ...coreProps, children }) }) })
100
+ }
101
+ );
102
+ }
103
+ function createTestSystemsProvider({
104
+ organizationModel,
105
+ systems = []
106
+ } = {}) {
107
+ return function TestSystemsProvider({ children }) {
108
+ return /* @__PURE__ */ jsx(ElevasisSystemsProvider, { systems, organizationModel, children });
109
+ };
110
+ }
111
+
112
+ export { ElevasisUIProvider, createTestSystemsProvider, useResolvedOrganizationModel };