@elevasis/ui 2.31.0 → 2.32.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/{CoreAuthKitInner-KSEGSB67.js → CoreAuthKitInner-QC62UHTZ.js} +1 -1
- package/dist/api/index.js +3 -3
- package/dist/app/index.css +38 -0
- package/dist/app/index.d.ts +69 -9
- package/dist/app/index.js +7 -6
- package/dist/auth/context.js +1 -1
- package/dist/auth/index.js +1 -1
- package/dist/charts/index.js +5 -6
- package/dist/{chunk-XQHZBA65.js → chunk-2RJMVWFJ.js} +1 -6
- package/dist/{chunk-CW3UNAF2.js → chunk-4DYOXEH6.js} +410 -5
- package/dist/{chunk-HQGF4ATG.js → chunk-4MFNGNHF.js} +118 -141
- package/dist/{chunk-ND42LPY4.js → chunk-4QK76KIF.js} +6 -6
- package/dist/chunk-5FJJ72HU.js +13 -0
- package/dist/chunk-5J4PDX26.js +112 -0
- package/dist/{chunk-QDEETKYT.js → chunk-6DWD423K.js} +9 -9
- package/dist/{chunk-SHQXMW4F.js → chunk-7KZINJLP.js} +46 -28
- package/dist/{chunk-L3BVJWML.js → chunk-EPTHX4VZ.js} +1 -1
- package/dist/{chunk-JKSUN5GN.js → chunk-GCOQ3TBG.js} +81 -746
- package/dist/{chunk-DZTG5IAC.js → chunk-I2KLQ2HA.js} +1 -7
- package/dist/{chunk-L2NVFLXU.js → chunk-IQHU7O5Y.js} +4 -4
- package/dist/{chunk-P55BJZZW.js → chunk-IZWTVFJ2.js} +16 -4
- package/dist/{chunk-QHEWXU7I.js → chunk-JFL3GRD4.js} +1 -1
- package/dist/{chunk-Q6OYNEGR.js → chunk-LLRXA7D7.js} +5 -6
- package/dist/{chunk-7KC4P3AU.js → chunk-MOY4VOHF.js} +2 -12
- package/dist/{chunk-XQQEKWTL.js → chunk-N55DVMAG.js} +6 -2
- package/dist/{chunk-TOIXUWR6.js → chunk-ND5TDV2J.js} +1 -1
- package/dist/{chunk-WF227UBV.js → chunk-QQHOKTJA.js} +4 -4
- package/dist/{chunk-T3IPHEYJ.js → chunk-QTI3KC7D.js} +4335 -554
- package/dist/chunk-QXCDKE2O.js +486 -0
- package/dist/{chunk-3BAPR3KA.js → chunk-RQA2EVN3.js} +5 -15
- package/dist/{chunk-HYNYEBHM.js → chunk-RQTWIXJ5.js} +3 -3
- package/dist/chunk-T35FWDAB.js +4342 -0
- package/dist/{chunk-DWK2QIAK.js → chunk-TYRUKGGD.js} +1 -1
- package/dist/{chunk-GRDLB6LM.js → chunk-UROTM5OR.js} +13 -1
- package/dist/{chunk-6YT4IKJ7.js → chunk-VNAZTCHA.js} +15 -0
- package/dist/{chunk-5LJAEZMA.js → chunk-VRNMNB3O.js} +5 -6
- package/dist/chunk-WQPX44YM.js +1626 -0
- package/dist/{chunk-7HMCB26R.js → chunk-XZGSCABI.js} +1 -1
- package/dist/chunk-YLQEVSOR.js +299 -0
- package/dist/{chunk-Y4FWCG7Y.js → chunk-ZQOKIGZP.js} +8 -7
- package/dist/components/chat/index.js +1 -1
- package/dist/components/index.css +38 -0
- package/dist/components/index.d.ts +152 -50
- package/dist/components/index.js +36 -39
- package/dist/components/navigation/index.css +38 -0
- package/dist/components/navigation/index.js +4 -3
- package/dist/execution/index.d.ts +7 -2
- package/dist/execution/index.js +1 -1
- package/dist/features/auth/index.css +38 -0
- package/dist/features/auth/index.d.ts +91 -14
- package/dist/features/auth/index.js +42 -10
- package/dist/features/clients/index.css +38 -0
- package/dist/features/clients/index.d.ts +1 -1
- package/dist/features/clients/index.js +16 -15
- package/dist/features/crm/index.css +38 -0
- package/dist/features/crm/index.d.ts +80 -18
- package/dist/features/crm/index.js +16 -15
- package/dist/features/dashboard/index.css +38 -0
- package/dist/features/dashboard/index.d.ts +65 -25
- package/dist/features/dashboard/index.js +16 -16
- package/dist/features/delivery/index.css +38 -0
- package/dist/features/delivery/index.d.ts +80 -18
- package/dist/features/delivery/index.js +15 -15
- package/dist/features/knowledge/index.css +38 -0
- package/dist/features/knowledge/index.d.ts +20 -18
- package/dist/features/knowledge/index.js +112 -597
- package/dist/features/lead-gen/index.css +38 -0
- package/dist/features/lead-gen/index.d.ts +45 -43
- package/dist/features/lead-gen/index.js +16 -16
- package/dist/features/monitoring/index.css +38 -0
- package/dist/features/monitoring/index.d.ts +20 -18
- package/dist/features/monitoring/index.js +17 -17
- package/dist/features/monitoring/requests/index.css +38 -0
- package/dist/features/monitoring/requests/index.d.ts +21 -19
- package/dist/features/monitoring/requests/index.js +15 -14
- package/dist/features/operations/index.css +38 -0
- package/dist/features/operations/index.d.ts +930 -66
- package/dist/features/operations/index.js +21 -24
- package/dist/features/seo/index.d.ts +20 -18
- package/dist/features/seo/index.js +2 -2
- package/dist/features/settings/index.css +38 -0
- package/dist/features/settings/index.d.ts +80 -18
- package/dist/features/settings/index.js +16 -15
- package/dist/graph/index.js +1 -1
- package/dist/hooks/delivery/index.css +38 -0
- package/dist/hooks/delivery/index.d.ts +60 -0
- package/dist/hooks/delivery/index.js +3 -3
- package/dist/hooks/index.css +38 -0
- package/dist/hooks/index.d.ts +301 -87
- package/dist/hooks/index.js +14 -13
- package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +143 -33
- package/dist/hooks/operations/command-view/utils/transformCommandViewData.js +1 -1
- package/dist/hooks/published.css +38 -0
- package/dist/hooks/published.d.ts +301 -87
- package/dist/hooks/published.js +14 -13
- package/dist/index.css +38 -0
- package/dist/index.d.ts +976 -1341
- package/dist/index.js +15 -14
- package/dist/initialization/index.d.ts +60 -0
- package/dist/initialization/index.js +1 -1
- package/dist/knowledge/index.d.ts +809 -1160
- package/dist/knowledge/index.js +5988 -2140
- package/dist/{chunk-O2QOPJI5.js → knowledge-search-index-5KYPO746.js} +96 -852
- package/dist/layout/index.js +3 -4
- package/dist/organization/index.css +38 -0
- package/dist/organization/index.js +1 -1
- package/dist/profile/index.d.ts +60 -0
- package/dist/profile/index.js +1 -1
- package/dist/provider/ElevasisServiceContext.js +1 -1
- package/dist/provider/index.css +38 -0
- package/dist/provider/index.d.ts +786 -1249
- package/dist/provider/index.js +11 -10
- package/dist/provider/published.css +38 -0
- package/dist/provider/published.d.ts +783 -1246
- package/dist/provider/published.js +8 -7
- package/dist/router/context.js +1 -1
- package/dist/router/index.js +1 -1
- package/dist/sse/index.js +1 -1
- package/dist/supabase/index.d.ts +117 -0
- package/dist/supabase/index.js +1 -1
- package/dist/test-utils/index.d.ts +16 -9
- package/dist/test-utils/index.js +40 -33
- package/dist/test-utils/setup-integration.js +1 -1
- package/dist/test-utils/setup.js +1 -1
- package/dist/theme/index.js +3 -3
- package/dist/theme/presets/index.js +1 -1
- package/dist/typeform/index.js +1 -1
- package/dist/typeform/schemas.js +1 -1
- package/dist/types/index.d.ts +205 -35
- package/dist/utils/index.d.ts +65 -25
- package/dist/utils/index.js +2 -2
- package/dist/vite/index.js +1 -1
- package/dist/vite-plugin-knowledge/index.js +1 -1
- package/dist/zustand/index.js +1 -1
- package/package.json +39 -38
- package/src/provider/README.md +5 -5
- package/dist/chunk-542WPQU2.js +0 -413
- package/dist/chunk-6IXOKUBC.js +0 -347
- package/dist/chunk-CQZ3DNQY.js +0 -740
- package/dist/chunk-ECNNI3NT.js +0 -6
- package/dist/chunk-JDNEWB5F.js +0 -10
- package/dist/chunk-MVFCLZSK.js +0 -4337
- package/dist/chunk-OAVTMITG.js +0 -13
- package/dist/chunk-TVRQ6AQI.js +0 -476
|
@@ -0,0 +1,486 @@
|
|
|
1
|
+
import { devOnlyFor, requiresAdminFor, topLevel, parentOf, ancestorsOf, childrenOf, findById, findByPath, listAllSystems, defaultPathFor, getSortedSidebarEntries } from './chunk-T35FWDAB.js';
|
|
2
|
+
import { useInitialization } from './chunk-533DUEQY.js';
|
|
3
|
+
import { useOrganization } from './chunk-DD3CCMCZ.js';
|
|
4
|
+
import { createContext, useMemo, useCallback, useContext } from 'react';
|
|
5
|
+
import { IconSettings, IconArchive, IconShieldLock, IconBriefcase, IconUsers, IconChartBar, IconCalendar, IconDashboard, IconBrain, IconActivity, IconCode, IconTarget, IconTool } from '@tabler/icons-react';
|
|
6
|
+
import { jsx } from 'react/jsx-runtime';
|
|
7
|
+
|
|
8
|
+
function createFeatureAccessHook({
|
|
9
|
+
useInitialization: useInitialization2,
|
|
10
|
+
useOrganization: useOrganization2
|
|
11
|
+
}) {
|
|
12
|
+
return function useFeatureAccess2() {
|
|
13
|
+
const { profile, organizationReady } = useInitialization2();
|
|
14
|
+
const { currentMembership } = useOrganization2();
|
|
15
|
+
const { orgConfig, membershipConfig } = useMemo(() => {
|
|
16
|
+
const organizationConfig = currentMembership?.organization?.config;
|
|
17
|
+
const memberConfig = currentMembership?.config;
|
|
18
|
+
return { orgConfig: organizationConfig, membershipConfig: memberConfig };
|
|
19
|
+
}, [currentMembership]);
|
|
20
|
+
const userConfig = profile?.config;
|
|
21
|
+
const checkFeature = useCallback(
|
|
22
|
+
(featureKey) => {
|
|
23
|
+
if (profile?.is_platform_admin) {
|
|
24
|
+
return { allowed: true, restrictedBy: null };
|
|
25
|
+
}
|
|
26
|
+
const membershipValue = membershipConfig?.features?.[featureKey];
|
|
27
|
+
if (membershipValue === false) return { allowed: false, restrictedBy: "membership" };
|
|
28
|
+
return { allowed: true, restrictedBy: null };
|
|
29
|
+
},
|
|
30
|
+
[profile?.is_platform_admin, membershipConfig]
|
|
31
|
+
);
|
|
32
|
+
const hasFeature = useCallback((featureKey) => checkFeature(featureKey).allowed, [checkFeature]);
|
|
33
|
+
return {
|
|
34
|
+
orgConfig,
|
|
35
|
+
membershipConfig,
|
|
36
|
+
userConfig,
|
|
37
|
+
hasFeature,
|
|
38
|
+
checkFeature,
|
|
39
|
+
isReady: organizationReady
|
|
40
|
+
};
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// src/provider/resolvers/RouteResolver.ts
|
|
45
|
+
function normalizeRoutePath(path) {
|
|
46
|
+
const trimmedPath = path.trim();
|
|
47
|
+
if (!trimmedPath || trimmedPath === "/") {
|
|
48
|
+
return "/";
|
|
49
|
+
}
|
|
50
|
+
return trimmedPath.replace(/\/+$/, "") || "/";
|
|
51
|
+
}
|
|
52
|
+
function isRouteMatch(currentPath, route) {
|
|
53
|
+
const normalizedCurrentPath = normalizeRoutePath(currentPath);
|
|
54
|
+
const normalizedRoute = normalizeRoutePath(route);
|
|
55
|
+
return normalizedCurrentPath === normalizedRoute || normalizedCurrentPath.startsWith(`${normalizedRoute}/`);
|
|
56
|
+
}
|
|
57
|
+
|
|
58
|
+
// src/provider/resolvers/NavResolver.ts
|
|
59
|
+
function uniqueIds(ids) {
|
|
60
|
+
return ids ? [...new Set(ids)] : [];
|
|
61
|
+
}
|
|
62
|
+
|
|
63
|
+
// src/provider/validateManifests.ts
|
|
64
|
+
function listSystemRefs(systems) {
|
|
65
|
+
const refs = [];
|
|
66
|
+
function walk(map, prefix = "") {
|
|
67
|
+
for (const [key, system] of Object.entries(map)) {
|
|
68
|
+
const path = prefix ? `${prefix}.${key}` : key;
|
|
69
|
+
refs.push(path, system.id);
|
|
70
|
+
const subsystems = system.subsystems;
|
|
71
|
+
if (subsystems) {
|
|
72
|
+
walk(subsystems, path);
|
|
73
|
+
}
|
|
74
|
+
}
|
|
75
|
+
}
|
|
76
|
+
walk(systems);
|
|
77
|
+
return refs;
|
|
78
|
+
}
|
|
79
|
+
function validateManifests(manifests, organizationModel) {
|
|
80
|
+
if (!organizationModel) {
|
|
81
|
+
return;
|
|
82
|
+
}
|
|
83
|
+
const validSystemIds = /* @__PURE__ */ new Set([
|
|
84
|
+
...Object.keys(organizationModel.systems ?? {}),
|
|
85
|
+
...listSystemRefs(organizationModel.systems ?? {})
|
|
86
|
+
]);
|
|
87
|
+
const errors = [];
|
|
88
|
+
for (const manifest of manifests) {
|
|
89
|
+
const key = manifest.key;
|
|
90
|
+
const systemId = manifest.systemId;
|
|
91
|
+
if (!systemId) {
|
|
92
|
+
continue;
|
|
93
|
+
}
|
|
94
|
+
if (!validSystemIds.has(systemId)) {
|
|
95
|
+
errors.push(
|
|
96
|
+
`Manifest "${key}": systemId "${systemId}" is not a known system id. Valid values: ${[...validSystemIds].sort().join(", ")}`
|
|
97
|
+
);
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
if (errors.length > 0) {
|
|
101
|
+
throw new Error(
|
|
102
|
+
`System manifest validation failed with ${errors.length} error(s):
|
|
103
|
+
` + errors.map((e, i) => ` ${i + 1}. ${e}`).join("\n")
|
|
104
|
+
);
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
var ElevasisSystemsContext = createContext(null);
|
|
108
|
+
var FALLBACK_SIDEBAR_ICONS = {
|
|
109
|
+
"feature.dashboard": IconDashboard,
|
|
110
|
+
"feature.business": IconBriefcase,
|
|
111
|
+
"feature.sales": IconTarget,
|
|
112
|
+
"feature.clients": IconUsers,
|
|
113
|
+
"feature.projects": IconBriefcase,
|
|
114
|
+
"feature.operations": IconCode,
|
|
115
|
+
"feature.monitoring": IconActivity,
|
|
116
|
+
"feature.knowledge": IconBrain,
|
|
117
|
+
"feature.settings": IconSettings,
|
|
118
|
+
"feature.admin": IconShieldLock,
|
|
119
|
+
dashboard: IconDashboard,
|
|
120
|
+
calendar: IconCalendar,
|
|
121
|
+
business: IconBriefcase,
|
|
122
|
+
sales: IconChartBar,
|
|
123
|
+
clients: IconUsers,
|
|
124
|
+
projects: IconBriefcase,
|
|
125
|
+
admin: IconShieldLock,
|
|
126
|
+
archive: IconArchive,
|
|
127
|
+
settings: IconSettings
|
|
128
|
+
};
|
|
129
|
+
function isLifecycleEnabled(system) {
|
|
130
|
+
if (system.enabled === false) return false;
|
|
131
|
+
return system.lifecycle !== "deprecated" && system.lifecycle !== "archived";
|
|
132
|
+
}
|
|
133
|
+
function isSystemAccessible(systemId, context) {
|
|
134
|
+
const system = context.shellModel.findById(systemId);
|
|
135
|
+
if (!system || !isLifecycleEnabled(system)) return false;
|
|
136
|
+
if (!context.isSystemEnabled(systemId)) return false;
|
|
137
|
+
if (context.shellModel.requiresAdminFor(systemId) && !context.isPlatformAdmin) return false;
|
|
138
|
+
if (context.shellModel.devOnlyFor(systemId) && !context.isDev) return false;
|
|
139
|
+
return true;
|
|
140
|
+
}
|
|
141
|
+
function isSurfaceAccessible(node, context) {
|
|
142
|
+
if (node.devOnly && !context.isDev) return false;
|
|
143
|
+
if (node.requiresAdmin && !context.isPlatformAdmin) return false;
|
|
144
|
+
const systemTargets = node.targets?.systems ?? [];
|
|
145
|
+
if (systemTargets.length === 0) return true;
|
|
146
|
+
return systemTargets.some((systemId) => isSystemAccessible(systemId, context));
|
|
147
|
+
}
|
|
148
|
+
function iconForNode(node, context) {
|
|
149
|
+
if (node.type === "surface") {
|
|
150
|
+
const targetIcon = node.targets?.systems?.map((systemId) => context.shellModel.findById(systemId)?.iconComponent).find(Boolean);
|
|
151
|
+
if (targetIcon) return targetIcon;
|
|
152
|
+
}
|
|
153
|
+
return FALLBACK_SIDEBAR_ICONS[node.icon] ?? IconTool;
|
|
154
|
+
}
|
|
155
|
+
function activeMatchPathsForSurface(node, context) {
|
|
156
|
+
const paths = (node.targets?.systems ?? []).flatMap(
|
|
157
|
+
(systemId) => context.shellModel.childrenOf(systemId).map((child) => child.path).filter((path) => Boolean(path && path !== node.path))
|
|
158
|
+
);
|
|
159
|
+
return paths.length > 0 ? [...new Set(paths)] : void 0;
|
|
160
|
+
}
|
|
161
|
+
function surfaceToLinkItem(node, context, siblings) {
|
|
162
|
+
if (!isSurfaceAccessible(node, context)) return void 0;
|
|
163
|
+
const siblingShadows = siblings.some((sibling) => sibling !== node && sibling.path.startsWith(`${node.path}/`));
|
|
164
|
+
const activeMatchPaths = activeMatchPathsForSurface(node, context);
|
|
165
|
+
return {
|
|
166
|
+
label: node.label,
|
|
167
|
+
link: node.path,
|
|
168
|
+
...siblingShadows ? { exact: true } : {},
|
|
169
|
+
...activeMatchPaths ? { activeMatchPaths } : {}
|
|
170
|
+
};
|
|
171
|
+
}
|
|
172
|
+
function projectNode(node, context) {
|
|
173
|
+
if (node.type === "surface") {
|
|
174
|
+
if (!isSurfaceAccessible(node, context)) return void 0;
|
|
175
|
+
return {
|
|
176
|
+
label: node.label,
|
|
177
|
+
icon: iconForNode(node, context),
|
|
178
|
+
link: node.path
|
|
179
|
+
};
|
|
180
|
+
}
|
|
181
|
+
const childEntries = getSortedSidebarEntries(node.children);
|
|
182
|
+
const childSurfaces = childEntries.map(([, child]) => child).filter((child) => child.type === "surface");
|
|
183
|
+
const links = childEntries.flatMap(([, child]) => {
|
|
184
|
+
if (child.type === "surface") {
|
|
185
|
+
const link = surfaceToLinkItem(child, context, childSurfaces);
|
|
186
|
+
return link ? [link] : [];
|
|
187
|
+
}
|
|
188
|
+
const nestedGroup = projectNode(child, context);
|
|
189
|
+
return nestedGroup?.link ? [
|
|
190
|
+
{
|
|
191
|
+
label: nestedGroup.label,
|
|
192
|
+
link: nestedGroup.link
|
|
193
|
+
}
|
|
194
|
+
] : nestedGroup?.links ?? [];
|
|
195
|
+
});
|
|
196
|
+
if (links.length === 0) return void 0;
|
|
197
|
+
return {
|
|
198
|
+
label: node.label,
|
|
199
|
+
icon: iconForNode(node, context),
|
|
200
|
+
links
|
|
201
|
+
};
|
|
202
|
+
}
|
|
203
|
+
function projectSection(section, context) {
|
|
204
|
+
const entries = getSortedSidebarEntries(section);
|
|
205
|
+
return entries.flatMap(([, node]) => {
|
|
206
|
+
const group = projectNode(node, context);
|
|
207
|
+
return group ? [group] : [];
|
|
208
|
+
});
|
|
209
|
+
}
|
|
210
|
+
function projectSidebarLinks({
|
|
211
|
+
shellModel,
|
|
212
|
+
organizationModel,
|
|
213
|
+
isSystemEnabled,
|
|
214
|
+
isPlatformAdmin = false,
|
|
215
|
+
isDev = false,
|
|
216
|
+
section
|
|
217
|
+
}) {
|
|
218
|
+
const context = {
|
|
219
|
+
shellModel,
|
|
220
|
+
isSystemEnabled,
|
|
221
|
+
isPlatformAdmin,
|
|
222
|
+
isDev
|
|
223
|
+
};
|
|
224
|
+
const sidebar = organizationModel?.navigation.sidebar;
|
|
225
|
+
if (!sidebar) return [];
|
|
226
|
+
if (section) {
|
|
227
|
+
return projectSection(sidebar[section], context);
|
|
228
|
+
}
|
|
229
|
+
return [...projectSection(sidebar.primary, context), ...projectSection(sidebar.bottom, context)];
|
|
230
|
+
}
|
|
231
|
+
var useFeatureAccess = createFeatureAccessHook({
|
|
232
|
+
useInitialization,
|
|
233
|
+
useOrganization
|
|
234
|
+
});
|
|
235
|
+
function useElevasisSystems() {
|
|
236
|
+
const context = useContext(ElevasisSystemsContext);
|
|
237
|
+
if (!context) {
|
|
238
|
+
throw new Error(
|
|
239
|
+
"useElevasisSystems must be used within an ElevasisSystemsProvider. Wrap your app (or the relevant subtree) with <ElevasisSystemsProvider>."
|
|
240
|
+
);
|
|
241
|
+
}
|
|
242
|
+
return context;
|
|
243
|
+
}
|
|
244
|
+
function useOptionalElevasisSystems() {
|
|
245
|
+
return useContext(ElevasisSystemsContext);
|
|
246
|
+
}
|
|
247
|
+
function defaultSystems(organizationModel) {
|
|
248
|
+
if (!organizationModel) return [];
|
|
249
|
+
return listAllSystems(organizationModel).map(({ path, system }) => ({ ...system, id: path }));
|
|
250
|
+
}
|
|
251
|
+
function systemPath(system) {
|
|
252
|
+
return system.ui?.path ?? system.path ?? defaultPathFor(system.id);
|
|
253
|
+
}
|
|
254
|
+
function systemLabel(system) {
|
|
255
|
+
return system.label ?? system.title ?? system.id;
|
|
256
|
+
}
|
|
257
|
+
function moduleSystemId(module) {
|
|
258
|
+
return module.systemId ?? module.key;
|
|
259
|
+
}
|
|
260
|
+
function isLifecycleEnabled2(system) {
|
|
261
|
+
if (system.enabled === false) return false;
|
|
262
|
+
return system.lifecycle !== "deprecated" && system.lifecycle !== "archived";
|
|
263
|
+
}
|
|
264
|
+
function isOrganizationModelSystemEnabled(organizationModel, systemId) {
|
|
265
|
+
const system = defaultSystems(organizationModel).find((candidate) => candidate.id === systemId);
|
|
266
|
+
return system ? isLifecycleEnabled2(system) : void 0;
|
|
267
|
+
}
|
|
268
|
+
function resolveSystemModules(systems, isSystemEnabled) {
|
|
269
|
+
return systems.map((system) => {
|
|
270
|
+
const systemId = system.systemId;
|
|
271
|
+
const accessKey = systemId ?? system.key;
|
|
272
|
+
return {
|
|
273
|
+
...system,
|
|
274
|
+
systemId,
|
|
275
|
+
access: {
|
|
276
|
+
featureKey: system.key,
|
|
277
|
+
systemId,
|
|
278
|
+
enabled: isSystemEnabled(accessKey)
|
|
279
|
+
},
|
|
280
|
+
semantics: {
|
|
281
|
+
capabilityIds: uniqueIds(system.capabilityIds ?? [])
|
|
282
|
+
}
|
|
283
|
+
};
|
|
284
|
+
});
|
|
285
|
+
}
|
|
286
|
+
function buildShellSystems(organizationModel, modules) {
|
|
287
|
+
const iconBySystemId = new Map(
|
|
288
|
+
modules.flatMap((module) => module.systemId ? [[moduleSystemId(module), module.icon]] : [])
|
|
289
|
+
);
|
|
290
|
+
return defaultSystems(organizationModel).map((system) => ({
|
|
291
|
+
...system,
|
|
292
|
+
label: systemLabel(system),
|
|
293
|
+
path: systemPath(system),
|
|
294
|
+
iconComponent: iconBySystemId.get(system.id)
|
|
295
|
+
}));
|
|
296
|
+
}
|
|
297
|
+
function createShellModel(systems) {
|
|
298
|
+
const systemsRecord = Object.fromEntries(systems.map((s) => [s.id, s]));
|
|
299
|
+
return {
|
|
300
|
+
systems,
|
|
301
|
+
findByPath: (path) => findByPath(systemsRecord, normalizeRoutePath(path)),
|
|
302
|
+
findById: (id) => findById(systemsRecord, id),
|
|
303
|
+
childrenOf: (id) => childrenOf(systemsRecord, id),
|
|
304
|
+
ancestorsOf: (id) => ancestorsOf(systemsRecord, id),
|
|
305
|
+
parentOf: (id) => parentOf(systemsRecord, id),
|
|
306
|
+
topLevel: () => topLevel(systemsRecord),
|
|
307
|
+
requiresAdminFor: (id) => requiresAdminFor(systemsRecord, id),
|
|
308
|
+
devOnlyFor: (id) => devOnlyFor(systemsRecord, id)
|
|
309
|
+
};
|
|
310
|
+
}
|
|
311
|
+
function resolveOrganizationGraphSystem(systems, shellModel) {
|
|
312
|
+
for (const system of systems) {
|
|
313
|
+
const graphBridge = system.organizationGraph;
|
|
314
|
+
if (!graphBridge) continue;
|
|
315
|
+
const systemId = graphBridge.systemId;
|
|
316
|
+
if (!systemId) continue;
|
|
317
|
+
const node = shellModel.findById(systemId);
|
|
318
|
+
return {
|
|
319
|
+
available: Boolean(node),
|
|
320
|
+
systemId,
|
|
321
|
+
systemPath: node ? systemPath(node) : void 0
|
|
322
|
+
};
|
|
323
|
+
}
|
|
324
|
+
return {
|
|
325
|
+
available: false
|
|
326
|
+
};
|
|
327
|
+
}
|
|
328
|
+
function findMatchingNode(shellModel, currentPath) {
|
|
329
|
+
const normalizedPath = normalizeRoutePath(currentPath);
|
|
330
|
+
const exact = shellModel.findByPath(normalizedPath);
|
|
331
|
+
if (exact) return exact;
|
|
332
|
+
return [...shellModel.systems].filter((system) => {
|
|
333
|
+
const path = normalizeRoutePath(systemPath(system));
|
|
334
|
+
return path !== "/" && isRouteMatch(normalizedPath, path);
|
|
335
|
+
}).sort((a, b) => systemPath(b).length - systemPath(a).length)[0];
|
|
336
|
+
}
|
|
337
|
+
function ownsNode(module, node) {
|
|
338
|
+
if (!node || !module.systemId) return false;
|
|
339
|
+
return node.id === module.systemId || node.id.startsWith(`${module.systemId}.`);
|
|
340
|
+
}
|
|
341
|
+
function ownsRoutePrefix(module, normalizedPath) {
|
|
342
|
+
return (module.routePrefixes ?? []).some((prefix) => isRouteMatch(normalizedPath, normalizeRoutePath(prefix)));
|
|
343
|
+
}
|
|
344
|
+
function resolveRoute(systems, shellModel, currentPath, disabledSubsectionPaths) {
|
|
345
|
+
const node = findMatchingNode(shellModel, currentPath);
|
|
346
|
+
const normalizedPath = normalizeRoutePath(currentPath);
|
|
347
|
+
if (disabledSubsectionPaths.some((disabledPath) => isRouteMatch(normalizedPath, disabledPath))) {
|
|
348
|
+
return {
|
|
349
|
+
status: "hidden",
|
|
350
|
+
path: currentPath,
|
|
351
|
+
node
|
|
352
|
+
};
|
|
353
|
+
}
|
|
354
|
+
const system = systems.find((candidate) => ownsNode(candidate, node)) ?? systems.filter((candidate) => ownsRoutePrefix(candidate, normalizedPath)).sort((a, b) => Math.max(...(b.routePrefixes ?? []).map((prefix) => prefix.length)) - Math.max(...(a.routePrefixes ?? []).map((prefix) => prefix.length)))[0];
|
|
355
|
+
if (!system) {
|
|
356
|
+
return {
|
|
357
|
+
status: "unmatched",
|
|
358
|
+
path: currentPath,
|
|
359
|
+
node
|
|
360
|
+
};
|
|
361
|
+
}
|
|
362
|
+
return {
|
|
363
|
+
status: "matched",
|
|
364
|
+
path: currentPath,
|
|
365
|
+
system,
|
|
366
|
+
node
|
|
367
|
+
};
|
|
368
|
+
}
|
|
369
|
+
function ElevasisSystemsProvider({
|
|
370
|
+
systems,
|
|
371
|
+
organizationModel,
|
|
372
|
+
timeRange,
|
|
373
|
+
operationsApiUrl,
|
|
374
|
+
operationsSSEManager,
|
|
375
|
+
deliveryApiUrl,
|
|
376
|
+
deliverySSEManager,
|
|
377
|
+
disabledSubsectionPaths = [],
|
|
378
|
+
children
|
|
379
|
+
}) {
|
|
380
|
+
const activeSystems = systems ?? [];
|
|
381
|
+
const resolvedOrganizationModel = useMemo(() => {
|
|
382
|
+
if (!organizationModel) {
|
|
383
|
+
return void 0;
|
|
384
|
+
}
|
|
385
|
+
return {
|
|
386
|
+
...organizationModel,
|
|
387
|
+
knowledge: organizationModel.knowledge ?? { nodes: [] }
|
|
388
|
+
};
|
|
389
|
+
}, [organizationModel]);
|
|
390
|
+
useMemo(() => validateManifests(activeSystems, resolvedOrganizationModel), [activeSystems, resolvedOrganizationModel]);
|
|
391
|
+
const { hasFeature } = useFeatureAccess();
|
|
392
|
+
const hasResolvedSystem = useCallback(
|
|
393
|
+
(key) => {
|
|
394
|
+
if (!hasFeature(key)) {
|
|
395
|
+
return false;
|
|
396
|
+
}
|
|
397
|
+
const organizationModelSystemEnabled = isOrganizationModelSystemEnabled(resolvedOrganizationModel, key);
|
|
398
|
+
return organizationModelSystemEnabled ?? true;
|
|
399
|
+
},
|
|
400
|
+
[hasFeature, resolvedOrganizationModel]
|
|
401
|
+
);
|
|
402
|
+
const shellSystems = useMemo(
|
|
403
|
+
() => buildShellSystems(resolvedOrganizationModel, activeSystems),
|
|
404
|
+
[resolvedOrganizationModel, activeSystems]
|
|
405
|
+
);
|
|
406
|
+
const shellModel = useMemo(() => createShellModel(shellSystems), [shellSystems]);
|
|
407
|
+
const normalizedDisabledSubsectionPaths = useMemo(
|
|
408
|
+
() => [...new Set(disabledSubsectionPaths.map((path) => normalizeRoutePath(path)))],
|
|
409
|
+
[disabledSubsectionPaths]
|
|
410
|
+
);
|
|
411
|
+
const resolvedSystems = useMemo(
|
|
412
|
+
() => resolveSystemModules(activeSystems, hasResolvedSystem),
|
|
413
|
+
[activeSystems, hasResolvedSystem]
|
|
414
|
+
);
|
|
415
|
+
const enabledResolvedSystems = useMemo(
|
|
416
|
+
() => resolvedSystems.filter((system) => system.access.enabled),
|
|
417
|
+
[resolvedSystems]
|
|
418
|
+
);
|
|
419
|
+
const organizationGraph = useMemo(
|
|
420
|
+
() => resolveOrganizationGraphSystem(enabledResolvedSystems, shellModel),
|
|
421
|
+
[enabledResolvedSystems, shellModel]
|
|
422
|
+
);
|
|
423
|
+
const getResolvedSystem = useCallback(
|
|
424
|
+
(key) => resolvedSystems.find((system) => system.key === key),
|
|
425
|
+
[resolvedSystems]
|
|
426
|
+
);
|
|
427
|
+
const isSystemEnabled = useCallback((key) => hasResolvedSystem(key), [hasResolvedSystem]);
|
|
428
|
+
const getSidebarLinks = useCallback(
|
|
429
|
+
(options = {}) => projectSidebarLinks({
|
|
430
|
+
shellModel,
|
|
431
|
+
organizationModel: resolvedOrganizationModel,
|
|
432
|
+
isSystemEnabled,
|
|
433
|
+
...options
|
|
434
|
+
}),
|
|
435
|
+
[shellModel, resolvedOrganizationModel, isSystemEnabled]
|
|
436
|
+
);
|
|
437
|
+
const resolveRouteByPath = useCallback(
|
|
438
|
+
(path) => resolveRoute(enabledResolvedSystems, shellModel, path, normalizedDisabledSubsectionPaths),
|
|
439
|
+
[enabledResolvedSystems, shellModel, normalizedDisabledSubsectionPaths]
|
|
440
|
+
);
|
|
441
|
+
const shellRuntime = useMemo(
|
|
442
|
+
() => ({
|
|
443
|
+
resolveRoute: resolveRouteByPath
|
|
444
|
+
}),
|
|
445
|
+
[resolveRouteByPath]
|
|
446
|
+
);
|
|
447
|
+
const value = useMemo(
|
|
448
|
+
() => ({
|
|
449
|
+
shellModel,
|
|
450
|
+
shellRuntime,
|
|
451
|
+
getSidebarLinks,
|
|
452
|
+
enabledResolvedSystems,
|
|
453
|
+
resolvedSystems,
|
|
454
|
+
organizationGraph,
|
|
455
|
+
organizationModel: resolvedOrganizationModel,
|
|
456
|
+
timeRange,
|
|
457
|
+
operationsApiUrl,
|
|
458
|
+
operationsSSEManager,
|
|
459
|
+
deliveryApiUrl,
|
|
460
|
+
deliverySSEManager,
|
|
461
|
+
disabledSubsectionPaths: normalizedDisabledSubsectionPaths,
|
|
462
|
+
isSystemEnabled,
|
|
463
|
+
getResolvedSystem
|
|
464
|
+
}),
|
|
465
|
+
[
|
|
466
|
+
shellModel,
|
|
467
|
+
shellRuntime,
|
|
468
|
+
enabledResolvedSystems,
|
|
469
|
+
resolvedSystems,
|
|
470
|
+
organizationGraph,
|
|
471
|
+
resolvedOrganizationModel,
|
|
472
|
+
timeRange,
|
|
473
|
+
operationsApiUrl,
|
|
474
|
+
operationsSSEManager,
|
|
475
|
+
deliveryApiUrl,
|
|
476
|
+
deliverySSEManager,
|
|
477
|
+
normalizedDisabledSubsectionPaths,
|
|
478
|
+
isSystemEnabled,
|
|
479
|
+
getResolvedSystem,
|
|
480
|
+
getSidebarLinks
|
|
481
|
+
]
|
|
482
|
+
);
|
|
483
|
+
return /* @__PURE__ */ jsx(ElevasisSystemsContext.Provider, { value, children });
|
|
484
|
+
}
|
|
485
|
+
|
|
486
|
+
export { ElevasisSystemsProvider, createFeatureAccessHook, useElevasisSystems, useOptionalElevasisSystems };
|
|
@@ -367,6 +367,9 @@ var componentThemes = {
|
|
|
367
367
|
}
|
|
368
368
|
}
|
|
369
369
|
}),
|
|
370
|
+
// Tree pseudo-class/attribute state selectors (&:focus-visible, &[data-hovered],
|
|
371
|
+
// &[data-selected]) are in custom.css -- Mantine's styles object applies these
|
|
372
|
+
// as inline styles and React rejects selector keys.
|
|
370
373
|
Tree: Tree.extend({
|
|
371
374
|
defaultProps: {
|
|
372
375
|
levelOffset: DEFAULT_SIZE
|
|
@@ -380,11 +383,7 @@ var componentThemes = {
|
|
|
380
383
|
},
|
|
381
384
|
node: {
|
|
382
385
|
listStyle: "none",
|
|
383
|
-
outline: "none"
|
|
384
|
-
"&:focus-visible > [data-value]": {
|
|
385
|
-
outline: "2px solid color-mix(in srgb, var(--color-primary) 55%, transparent)",
|
|
386
|
-
outlineOffset: "2px"
|
|
387
|
-
}
|
|
386
|
+
outline: "none"
|
|
388
387
|
},
|
|
389
388
|
subtree: {
|
|
390
389
|
listStyle: "none",
|
|
@@ -402,16 +401,7 @@ var componentThemes = {
|
|
|
402
401
|
border: "1px solid transparent",
|
|
403
402
|
borderRadius: "var(--mantine-radius-sm)",
|
|
404
403
|
color: "var(--color-text)",
|
|
405
|
-
transition: `background-color var(--duration-fast) var(--easing), border-color var(--duration-fast) var(--easing), color var(--duration-fast) var(--easing)
|
|
406
|
-
"&[data-hovered]": {
|
|
407
|
-
backgroundColor: "var(--color-surface-hover)",
|
|
408
|
-
borderColor: "var(--color-border)"
|
|
409
|
-
},
|
|
410
|
-
"&[data-selected]": {
|
|
411
|
-
backgroundColor: "color-mix(in srgb, var(--color-primary) 12%, transparent)",
|
|
412
|
-
borderColor: "color-mix(in srgb, var(--color-primary) 38%, var(--color-border))",
|
|
413
|
-
color: "var(--color-primary)"
|
|
414
|
-
}
|
|
404
|
+
transition: `background-color var(--duration-fast) var(--easing), border-color var(--duration-fast) var(--easing), color var(--duration-fast) var(--easing)`
|
|
415
405
|
}
|
|
416
406
|
}
|
|
417
407
|
}),
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { mantineThemeOverride, createCssVariablesResolver, PresetsProvider } from './chunk-
|
|
1
|
+
import { mantineThemeOverride, createCssVariablesResolver, PresetsProvider } from './chunk-RQA2EVN3.js';
|
|
2
2
|
import { PRESETS, getPreset, generateShades } from './chunk-3FV6HBXS.js';
|
|
3
3
|
import { AppBackground } from './chunk-WLOQ4IBG.js';
|
|
4
|
-
import { ElevasisCoreProvider } from './chunk-
|
|
4
|
+
import { ElevasisCoreProvider } from './chunk-YLQEVSOR.js';
|
|
5
5
|
import { ElevasisLoader } from './chunk-SZHARWKU.js';
|
|
6
6
|
import { AppearanceProvider } from './chunk-E565XMTQ.js';
|
|
7
|
-
import { getErrorInfo, formatErrorMessage, getErrorTitle } from './chunk-
|
|
7
|
+
import { getErrorInfo, formatErrorMessage, getErrorTitle } from './chunk-2RJMVWFJ.js';
|
|
8
8
|
import { useMemo, useEffect } from 'react';
|
|
9
9
|
import { Loader, mergeThemeOverrides, MantineProvider } from '@mantine/core';
|
|
10
10
|
import '@mantine/core/styles.css';
|