@elevasis/ui 2.40.1 → 2.41.1

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 (92) hide show
  1. package/dist/api/index.js +4 -6
  2. package/dist/app/index.css +384 -0
  3. package/dist/app/index.d.ts +108 -0
  4. package/dist/app/index.js +17 -27
  5. package/dist/auth/index.css +659 -0
  6. package/dist/auth/index.js +19 -6
  7. package/dist/charts/index.css +533 -0
  8. package/dist/charts/index.js +18 -15
  9. package/dist/{chunk-RXH4D6TY.js → chunk-5M4HSHQ5.js} +631 -2
  10. package/dist/{chunk-TE4P6OSJ.js → chunk-7FJI76OH.js} +1 -1
  11. package/dist/chunk-GMXGDO3I.js +244 -0
  12. package/dist/{chunk-CXY7FMUM.js → chunk-GUKY77FJ.js} +50 -4
  13. package/dist/{chunk-5JYKCULK.js → chunk-NZ2F5RQ4.js} +44 -2
  14. package/dist/{chunk-WF7CONXF.js → chunk-OJJK27GC.js} +658 -6
  15. package/dist/{chunk-RX6RSKWC.js → chunk-QDXTIQT4.js} +29255 -18312
  16. package/dist/{chunk-73EWE2EW.js → chunk-V5HWC5EW.js} +1 -1
  17. package/dist/components/chat/index.js +1 -2
  18. package/dist/components/index.css +149 -149
  19. package/dist/components/index.js +13 -37
  20. package/dist/components/navigation/index.css +659 -0
  21. package/dist/components/navigation/index.js +25 -4
  22. package/dist/features/auth/index.js +14 -38
  23. package/dist/features/clients/index.css +149 -149
  24. package/dist/features/clients/index.js +13 -37
  25. package/dist/features/crm/index.js +13 -37
  26. package/dist/features/dashboard/index.js +13 -37
  27. package/dist/features/delivery/index.js +13 -37
  28. package/dist/features/knowledge/index.css +659 -0
  29. package/dist/features/knowledge/index.js +25 -248
  30. package/dist/features/lead-gen/index.d.ts +81 -0
  31. package/dist/features/lead-gen/index.js +13 -37
  32. package/dist/features/monitoring/index.js +13 -37
  33. package/dist/features/monitoring/requests/index.d.ts +69 -7
  34. package/dist/features/monitoring/requests/index.js +32 -41
  35. package/dist/features/operations/index.d.ts +79 -0
  36. package/dist/features/operations/index.js +13 -37
  37. package/dist/features/seo/index.js +1 -4
  38. package/dist/features/settings/index.js +13 -37
  39. package/dist/hooks/access/index.css +659 -0
  40. package/dist/hooks/access/index.js +19 -5
  41. package/dist/hooks/delivery/index.js +13 -37
  42. package/dist/hooks/index.d.ts +18 -6
  43. package/dist/hooks/index.js +13 -37
  44. package/dist/hooks/published.d.ts +18 -6
  45. package/dist/hooks/published.js +13 -37
  46. package/dist/index.d.ts +151 -7
  47. package/dist/index.js +14 -38
  48. package/dist/initialization/index.js +1 -1
  49. package/dist/knowledge/index.css +659 -0
  50. package/dist/knowledge/index.d.ts +81 -0
  51. package/dist/knowledge/index.js +25 -15
  52. package/dist/layout/index.css +659 -0
  53. package/dist/layout/index.d.ts +18 -2
  54. package/dist/layout/index.js +24 -7
  55. package/dist/organization/index.js +13 -37
  56. package/dist/provider/index.css +384 -0
  57. package/dist/provider/index.d.ts +120 -1
  58. package/dist/provider/index.js +18 -22
  59. package/dist/provider/published.css +533 -0
  60. package/dist/provider/published.d.ts +121 -2
  61. package/dist/provider/published.js +18 -17
  62. package/dist/test-utils/index.js +4 -6
  63. package/dist/theme/index.js +2 -5
  64. package/dist/theme/presets/index.js +1 -2
  65. package/dist/utils/index.js +1 -3
  66. package/package.json +3 -3
  67. package/dist/chunk-3KMDHCAR.js +0 -52
  68. package/dist/chunk-4DRI3G36.js +0 -1016
  69. package/dist/chunk-5EYJ2GIN.js +0 -122
  70. package/dist/chunk-66U7JOWV.js +0 -425
  71. package/dist/chunk-6D4LCJ52.js +0 -10
  72. package/dist/chunk-6EV47QQW.js +0 -340
  73. package/dist/chunk-6ROXVZ3L.js +0 -9
  74. package/dist/chunk-7MTWRSUZ.js +0 -357
  75. package/dist/chunk-7PHY5ONQ.js +0 -85
  76. package/dist/chunk-B2DZLPDL.js +0 -39
  77. package/dist/chunk-CLDCYJQT.js +0 -1
  78. package/dist/chunk-CTJBPF3Z.js +0 -734
  79. package/dist/chunk-DT3QYZVU.js +0 -23
  80. package/dist/chunk-IIMU5YAJ.js +0 -53
  81. package/dist/chunk-IUQAP4IO.js +0 -2131
  82. package/dist/chunk-J3FLIZY4.js +0 -423
  83. package/dist/chunk-K7GKKETO.js +0 -3157
  84. package/dist/chunk-L7GXUSCV.js +0 -215
  85. package/dist/chunk-LJDYY3XB.js +0 -133
  86. package/dist/chunk-NYBEU5TE.js +0 -118
  87. package/dist/chunk-RH5VWWSC.js +0 -624
  88. package/dist/chunk-SJNIOGVX.js +0 -112
  89. package/dist/chunk-TYRUKGGD.js +0 -46
  90. package/dist/chunk-WLOQ4IBG.js +0 -654
  91. package/dist/chunk-X4WBGKJQ.js +0 -138
  92. package/dist/chunk-X7D6SUKR.js +0 -1234
@@ -1,423 +0,0 @@
1
- import { getSortedSidebarEntries, getSemanticIconComponent } from './chunk-K7GKKETO.js';
2
- import { devOnlyFor, requiresAdminFor, topLevel, parentOf, ancestorsOf, childrenOf, findById, findByPath, listAllSystems, defaultPathFor } from './chunk-RH5VWWSC.js';
3
- import { createContext, useContext, useMemo, useCallback } from 'react';
4
- import { jsx } from 'react/jsx-runtime';
5
-
6
- // src/provider/resolvers/RouteResolver.ts
7
- function normalizeRoutePath(path) {
8
- const trimmedPath = path.trim();
9
- if (!trimmedPath || trimmedPath === "/") {
10
- return "/";
11
- }
12
- return trimmedPath.replace(/\/+$/, "") || "/";
13
- }
14
- function isRouteMatch(currentPath, route) {
15
- const normalizedCurrentPath = normalizeRoutePath(currentPath);
16
- const normalizedRoute = normalizeRoutePath(route);
17
- return normalizedCurrentPath === normalizedRoute || normalizedCurrentPath.startsWith(`${normalizedRoute}/`);
18
- }
19
-
20
- // src/provider/resolvers/NavResolver.ts
21
- function uniqueIds(ids) {
22
- return ids ? [...new Set(ids)] : [];
23
- }
24
-
25
- // src/provider/validateManifests.ts
26
- function listSystemRefs(systems) {
27
- const refs = [];
28
- function walk(map, prefix = "") {
29
- for (const [key, system] of Object.entries(map)) {
30
- const path = prefix ? `${prefix}.${key}` : key;
31
- refs.push(path, system.id);
32
- const subsystems = system.subsystems;
33
- if (subsystems) {
34
- walk(subsystems, path);
35
- }
36
- }
37
- }
38
- walk(systems);
39
- return refs;
40
- }
41
- function validateManifests(manifests, organizationModel) {
42
- if (!organizationModel) {
43
- return;
44
- }
45
- const validSystemIds = /* @__PURE__ */ new Set([
46
- ...Object.keys(organizationModel.systems ?? {}),
47
- ...listSystemRefs(organizationModel.systems ?? {})
48
- ]);
49
- const errors = [];
50
- for (const manifest of manifests) {
51
- const key = manifest.key;
52
- const systemId = manifest.systemId;
53
- if (!systemId) {
54
- continue;
55
- }
56
- if (!validSystemIds.has(systemId)) {
57
- errors.push(
58
- `Manifest "${key}": systemId "${systemId}" is not a known system id. Valid values: ${[...validSystemIds].sort().join(", ")}`
59
- );
60
- }
61
- }
62
- if (errors.length > 0) {
63
- throw new Error(
64
- `System manifest validation failed with ${errors.length} error(s):
65
- ` + errors.map((e, i) => ` ${i + 1}. ${e}`).join("\n")
66
- );
67
- }
68
- }
69
- var ElevasisSystemsContext = createContext(null);
70
-
71
- // src/provider/sidebarProjection.ts
72
- function isLifecycleEnabled(system) {
73
- if (system.enabled === false) return false;
74
- return system.lifecycle !== "deprecated" && system.lifecycle !== "archived";
75
- }
76
- function isSystemAccessible(systemId, context) {
77
- const system = context.shellModel.findById(systemId);
78
- if (!system || !isLifecycleEnabled(system)) return false;
79
- if (!context.isSystemEnabled(systemId)) return false;
80
- if (context.shellModel.requiresAdminFor(systemId) && !context.isPlatformAdmin) return false;
81
- if (context.shellModel.devOnlyFor(systemId) && !context.isDev) return false;
82
- return true;
83
- }
84
- function isSurfaceAccessible(node, context) {
85
- if (node.devOnly && !context.isDev) return false;
86
- if (node.requiresAdmin && !context.isPlatformAdmin) return false;
87
- const systemTargets = node.targets?.systems ?? [];
88
- if (systemTargets.length === 0) return true;
89
- return systemTargets.some((systemId) => isSystemAccessible(systemId, context));
90
- }
91
- function iconForNode(node, context) {
92
- if (node.type === "surface") {
93
- const targetIcon = node.targets?.systems?.map((systemId) => context.shellModel.findById(systemId)?.iconComponent).find(Boolean);
94
- if (targetIcon) return targetIcon;
95
- }
96
- return getSemanticIconComponent(node.icon);
97
- }
98
- function activeMatchPathsForSurface(node, context) {
99
- const targets = node.targets?.systems ?? [];
100
- if (targets.length !== 1) return void 0;
101
- const paths = context.shellModel.childrenOf(targets[0]).map((child) => child.path).filter((path) => Boolean(path && path !== node.path));
102
- return paths.length > 0 ? [...new Set(paths)] : void 0;
103
- }
104
- function surfaceToLinkItem(node, context, siblings) {
105
- if (!isSurfaceAccessible(node, context)) return void 0;
106
- const siblingShadows = siblings.some((sibling) => sibling !== node && sibling.path.startsWith(`${node.path}/`));
107
- const activeMatchPaths = activeMatchPathsForSurface(node, context);
108
- return {
109
- label: node.label,
110
- link: node.path,
111
- ...siblingShadows ? { exact: true } : {},
112
- ...activeMatchPaths ? { activeMatchPaths } : {}
113
- };
114
- }
115
- function projectNode(node, context) {
116
- if (node.type === "surface") {
117
- if (!isSurfaceAccessible(node, context)) return void 0;
118
- return {
119
- label: node.label,
120
- icon: iconForNode(node, context),
121
- link: node.path
122
- };
123
- }
124
- const childEntries = getSortedSidebarEntries(node.children);
125
- const childSurfaces = childEntries.map(([, child]) => child).filter((child) => child.type === "surface");
126
- const links = childEntries.flatMap(([, child]) => {
127
- if (child.type === "surface") {
128
- const link = surfaceToLinkItem(child, context, childSurfaces);
129
- return link ? [link] : [];
130
- }
131
- const nestedGroup = projectNode(child, context);
132
- return nestedGroup?.link ? [
133
- {
134
- label: nestedGroup.label,
135
- link: nestedGroup.link
136
- }
137
- ] : nestedGroup?.links ?? [];
138
- });
139
- if (links.length === 0) return void 0;
140
- return {
141
- label: node.label,
142
- icon: iconForNode(node, context),
143
- links
144
- };
145
- }
146
- function projectSection(section, context) {
147
- const entries = getSortedSidebarEntries(section);
148
- return entries.flatMap(([, node]) => {
149
- const group = projectNode(node, context);
150
- return group ? [group] : [];
151
- });
152
- }
153
- function projectSidebarLinks({
154
- shellModel,
155
- organizationModel,
156
- isSystemEnabled,
157
- isPlatformAdmin = false,
158
- isDev = false,
159
- section
160
- }) {
161
- const context = {
162
- shellModel,
163
- isSystemEnabled,
164
- isPlatformAdmin,
165
- isDev
166
- };
167
- const sidebar = organizationModel?.navigation.sidebar;
168
- if (!sidebar) return [];
169
- if (section) {
170
- return projectSection(sidebar[section], context);
171
- }
172
- return [...projectSection(sidebar.primary, context), ...projectSection(sidebar.bottom, context)];
173
- }
174
- function useElevasisSystems() {
175
- const context = useContext(ElevasisSystemsContext);
176
- if (!context) {
177
- throw new Error(
178
- "useElevasisSystems must be used within an ElevasisSystemsProvider. Wrap your app (or the relevant subtree) with <ElevasisSystemsProvider>."
179
- );
180
- }
181
- return context;
182
- }
183
- function useOptionalElevasisSystems() {
184
- return useContext(ElevasisSystemsContext);
185
- }
186
- function defaultSystems(organizationModel) {
187
- if (!organizationModel) return [];
188
- return listAllSystems(organizationModel).map(({ path, system }) => ({ ...system, id: path }));
189
- }
190
- function systemPath(system) {
191
- return system.ui?.path ?? system.path ?? defaultPathFor(system.id);
192
- }
193
- function systemLabel(system) {
194
- return system.label ?? system.title ?? system.id;
195
- }
196
- function moduleSystemId(module) {
197
- return module.systemId ?? module.key;
198
- }
199
- function isLifecycleEnabled2(system) {
200
- if (system.enabled === false) return false;
201
- return system.lifecycle !== "deprecated" && system.lifecycle !== "archived";
202
- }
203
- function isOrganizationModelSystemEnabled(organizationModel, systemId) {
204
- const system = defaultSystems(organizationModel).find((candidate) => candidate.id === systemId);
205
- return system ? isLifecycleEnabled2(system) : void 0;
206
- }
207
- function resolveSystemModules(systems, isSystemEnabled) {
208
- return systems.map((system) => {
209
- const systemId = system.systemId;
210
- const accessKey = systemId ?? system.key;
211
- return {
212
- ...system,
213
- systemId,
214
- access: {
215
- systemKey: system.key,
216
- systemId,
217
- enabled: isSystemEnabled(accessKey)
218
- },
219
- semantics: {
220
- capabilityIds: uniqueIds(system.capabilityIds ?? [])
221
- }
222
- };
223
- });
224
- }
225
- function buildShellSystems(organizationModel, modules) {
226
- const iconBySystemId = new Map(
227
- modules.flatMap((module) => module.systemId ? [[moduleSystemId(module), module.icon]] : [])
228
- );
229
- return defaultSystems(organizationModel).map((system) => ({
230
- ...system,
231
- label: systemLabel(system),
232
- path: systemPath(system),
233
- iconComponent: iconBySystemId.get(system.id)
234
- }));
235
- }
236
- function createShellModel(systems) {
237
- const systemsRecord = Object.fromEntries(systems.map((s) => [s.id, s]));
238
- return {
239
- systems,
240
- findByPath: (path) => findByPath(systemsRecord, normalizeRoutePath(path)),
241
- findById: (id) => findById(systemsRecord, id),
242
- childrenOf: (id) => childrenOf(systemsRecord, id),
243
- ancestorsOf: (id) => ancestorsOf(systemsRecord, id),
244
- parentOf: (id) => parentOf(systemsRecord, id),
245
- topLevel: () => topLevel(systemsRecord),
246
- requiresAdminFor: (id) => requiresAdminFor(systemsRecord, id),
247
- devOnlyFor: (id) => devOnlyFor(systemsRecord, id)
248
- };
249
- }
250
- function resolveOrganizationGraphSystem(systems, shellModel) {
251
- for (const system of systems) {
252
- const graphBridge = system.organizationGraph;
253
- if (!graphBridge) continue;
254
- const systemId = graphBridge.systemId;
255
- if (!systemId) continue;
256
- const node = shellModel.findById(systemId);
257
- return {
258
- available: Boolean(node),
259
- systemId,
260
- systemPath: node ? systemPath(node) : void 0
261
- };
262
- }
263
- return {
264
- available: false
265
- };
266
- }
267
- function findMatchingNode(shellModel, currentPath) {
268
- const normalizedPath = normalizeRoutePath(currentPath);
269
- const exact = shellModel.findByPath(normalizedPath);
270
- if (exact) return exact;
271
- return [...shellModel.systems].filter((system) => {
272
- const path = normalizeRoutePath(systemPath(system));
273
- return path !== "/" && isRouteMatch(normalizedPath, path);
274
- }).sort((a, b) => systemPath(b).length - systemPath(a).length)[0];
275
- }
276
- function ownsNode(module, node) {
277
- if (!node || !module.systemId) return false;
278
- return node.id === module.systemId || node.id.startsWith(`${module.systemId}.`);
279
- }
280
- function ownsRoutePrefix(module, normalizedPath) {
281
- return (module.routePrefixes ?? []).some((prefix) => isRouteMatch(normalizedPath, normalizeRoutePath(prefix)));
282
- }
283
- function resolveRoute(systems, shellModel, currentPath, disabledSubsectionPaths) {
284
- const node = findMatchingNode(shellModel, currentPath);
285
- const normalizedPath = normalizeRoutePath(currentPath);
286
- if (disabledSubsectionPaths.some((disabledPath) => isRouteMatch(normalizedPath, disabledPath))) {
287
- return {
288
- status: "hidden",
289
- path: currentPath,
290
- node
291
- };
292
- }
293
- const system = systems.find((candidate) => ownsNode(candidate, node)) ?? systems.filter((candidate) => ownsRoutePrefix(candidate, normalizedPath)).sort(
294
- (a, b) => Math.max(...(b.routePrefixes ?? []).map((prefix) => prefix.length)) - Math.max(...(a.routePrefixes ?? []).map((prefix) => prefix.length))
295
- )[0];
296
- if (!system) {
297
- return {
298
- status: "unmatched",
299
- path: currentPath,
300
- node
301
- };
302
- }
303
- return {
304
- status: "matched",
305
- path: currentPath,
306
- system,
307
- node
308
- };
309
- }
310
- function ElevasisSystemsProvider({
311
- systems,
312
- organizationModel,
313
- timeRange,
314
- operationsApiUrl,
315
- operationsSSEManager,
316
- deliveryApiUrl,
317
- deliverySSEManager,
318
- disabledSubsectionPaths = [],
319
- children
320
- }) {
321
- const activeSystems = systems ?? [];
322
- const resolvedOrganizationModel = useMemo(() => {
323
- if (!organizationModel) {
324
- return void 0;
325
- }
326
- return {
327
- ...organizationModel,
328
- knowledge: organizationModel.knowledge ?? {}
329
- };
330
- }, [organizationModel]);
331
- useMemo(() => validateManifests(activeSystems, resolvedOrganizationModel), [activeSystems, resolvedOrganizationModel]);
332
- const hasResolvedSystem = useCallback(
333
- (key) => {
334
- const organizationModelSystemEnabled = isOrganizationModelSystemEnabled(resolvedOrganizationModel, key);
335
- return organizationModelSystemEnabled ?? true;
336
- },
337
- [resolvedOrganizationModel]
338
- );
339
- const shellSystems = useMemo(
340
- () => buildShellSystems(resolvedOrganizationModel, activeSystems),
341
- [resolvedOrganizationModel, activeSystems]
342
- );
343
- const shellModel = useMemo(() => createShellModel(shellSystems), [shellSystems]);
344
- const normalizedDisabledSubsectionPaths = useMemo(
345
- () => [...new Set(disabledSubsectionPaths.map((path) => normalizeRoutePath(path)))],
346
- [disabledSubsectionPaths]
347
- );
348
- const resolvedSystems = useMemo(
349
- () => resolveSystemModules(activeSystems, hasResolvedSystem),
350
- [activeSystems, hasResolvedSystem]
351
- );
352
- const enabledResolvedSystems = useMemo(
353
- () => resolvedSystems.filter((system) => system.access.enabled),
354
- [resolvedSystems]
355
- );
356
- const organizationGraph = useMemo(
357
- () => resolveOrganizationGraphSystem(enabledResolvedSystems, shellModel),
358
- [enabledResolvedSystems, shellModel]
359
- );
360
- const getResolvedSystem = useCallback(
361
- (key) => resolvedSystems.find((system) => system.key === key),
362
- [resolvedSystems]
363
- );
364
- const isSystemEnabled = useCallback((key) => hasResolvedSystem(key), [hasResolvedSystem]);
365
- const getSidebarLinks = useCallback(
366
- (options = {}) => projectSidebarLinks({
367
- shellModel,
368
- organizationModel: resolvedOrganizationModel,
369
- isSystemEnabled,
370
- ...options
371
- }),
372
- [shellModel, resolvedOrganizationModel, isSystemEnabled]
373
- );
374
- const resolveRouteByPath = useCallback(
375
- (path) => resolveRoute(enabledResolvedSystems, shellModel, path, normalizedDisabledSubsectionPaths),
376
- [enabledResolvedSystems, shellModel, normalizedDisabledSubsectionPaths]
377
- );
378
- const shellRuntime = useMemo(
379
- () => ({
380
- resolveRoute: resolveRouteByPath
381
- }),
382
- [resolveRouteByPath]
383
- );
384
- const value = useMemo(
385
- () => ({
386
- shellModel,
387
- shellRuntime,
388
- getSidebarLinks,
389
- enabledResolvedSystems,
390
- resolvedSystems,
391
- organizationGraph,
392
- organizationModel: resolvedOrganizationModel,
393
- timeRange,
394
- operationsApiUrl,
395
- operationsSSEManager,
396
- deliveryApiUrl,
397
- deliverySSEManager,
398
- disabledSubsectionPaths: normalizedDisabledSubsectionPaths,
399
- isSystemEnabled,
400
- getResolvedSystem
401
- }),
402
- [
403
- shellModel,
404
- shellRuntime,
405
- enabledResolvedSystems,
406
- resolvedSystems,
407
- organizationGraph,
408
- resolvedOrganizationModel,
409
- timeRange,
410
- operationsApiUrl,
411
- operationsSSEManager,
412
- deliveryApiUrl,
413
- deliverySSEManager,
414
- normalizedDisabledSubsectionPaths,
415
- isSystemEnabled,
416
- getResolvedSystem,
417
- getSidebarLinks
418
- ]
419
- );
420
- return /* @__PURE__ */ jsx(ElevasisSystemsContext.Provider, { value, children });
421
- }
422
-
423
- export { ElevasisSystemsProvider, useElevasisSystems, useOptionalElevasisSystems };