@elevasis/ui 2.20.0 → 2.21.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/api/index.js +2 -2
- package/dist/app/index.js +4 -4
- package/dist/charts/index.js +3 -3
- package/dist/{chunk-FMFX4K6E.js → chunk-7GG6OSD7.js} +34 -9
- package/dist/{chunk-GTYUP7MB.js → chunk-ATEHYDL3.js} +5 -21
- package/dist/{chunk-AL23U6C3.js → chunk-BIWHHWCJ.js} +1 -2
- package/dist/{chunk-JR5WNTLA.js → chunk-BJWIKEQG.js} +6 -11
- package/dist/{chunk-GP3AFJYG.js → chunk-CZK67OHH.js} +6 -11
- package/dist/{chunk-TO7QXDBX.js → chunk-DMYELNGA.js} +2 -2
- package/dist/{chunk-2CFOFSSG.js → chunk-EDX6WIN3.js} +6 -11
- package/dist/{chunk-PJVG3ISO.js → chunk-EGKNRM6P.js} +6 -8
- package/dist/{chunk-ZE2KQSHL.js → chunk-I5WRKH25.js} +4 -4
- package/dist/chunk-KVW56ERD.js +24 -0
- package/dist/{chunk-YP6T426C.js → chunk-LQU62KHD.js} +144 -432
- package/dist/{chunk-OUYH2SBS.js → chunk-LVUCBY7X.js} +2 -2
- package/dist/chunk-S7RL77QS.js +48 -0
- package/dist/{chunk-OD7GWIZS.js → chunk-SGXXJE52.js} +1 -121
- package/dist/{chunk-R7OJCNL3.js → chunk-T6INEVX6.js} +1 -1
- package/dist/{chunk-CTTY6FUT.js → chunk-TSSKOQBX.js} +2 -2
- package/dist/{chunk-Q4QJOSVS.js → chunk-ULZ2B3NC.js} +1 -1
- package/dist/chunk-VQESMHQV.js +336 -0
- package/dist/{chunk-MZFJWCPH.js → chunk-XLZZOFGM.js} +5 -19
- package/dist/{chunk-BHR7IV72.js → chunk-XUYBOO32.js} +1 -1
- package/dist/{chunk-M7W7CGPL.js → chunk-Z6FAH4XV.js} +1 -1
- package/dist/components/index.d.ts +46 -87
- package/dist/components/index.js +27 -26
- package/dist/components/navigation/index.d.ts +1 -13
- package/dist/components/navigation/index.js +11 -1
- package/dist/execution/index.d.ts +27 -0
- package/dist/features/crm/index.d.ts +12 -35
- package/dist/features/crm/index.js +11 -10
- package/dist/features/dashboard/index.d.ts +25 -27
- package/dist/features/dashboard/index.js +12 -11
- package/dist/features/delivery/index.d.ts +12 -35
- package/dist/features/delivery/index.js +11 -10
- package/dist/features/lead-gen/index.d.ts +14 -37
- package/dist/features/lead-gen/index.js +11 -10
- package/dist/features/monitoring/index.d.ts +12 -35
- package/dist/features/monitoring/index.js +13 -12
- package/dist/features/monitoring/requests/index.d.ts +13 -36
- package/dist/features/monitoring/requests/index.js +11 -10
- package/dist/features/operations/index.d.ts +44 -65
- package/dist/features/operations/index.js +14 -13
- package/dist/features/seo/index.d.ts +12 -35
- package/dist/features/seo/index.js +1 -1
- package/dist/features/settings/index.d.ts +12 -35
- package/dist/features/settings/index.js +11 -10
- package/dist/hooks/delivery/index.js +2 -2
- package/dist/hooks/index.d.ts +46 -66
- package/dist/hooks/index.js +10 -9
- package/dist/hooks/operations/command-view/utils/transformCommandViewData.d.ts +92 -121
- package/dist/hooks/published.d.ts +46 -66
- package/dist/hooks/published.js +10 -9
- package/dist/index.d.ts +365 -452
- package/dist/index.js +10 -9
- package/dist/provider/index.d.ts +62 -125
- package/dist/provider/index.js +8 -7
- package/dist/provider/published.d.ts +62 -125
- package/dist/provider/published.js +6 -5
- package/dist/test-utils/index.js +2 -2
- package/dist/types/index.d.ts +108 -135
- package/dist/utils/index.d.ts +26 -59
- package/dist/utils/index.js +1 -1
- package/package.json +4 -4
- package/dist/chunk-LR5CRY5A.js +0 -514
- package/dist/chunk-MG3NF7QL.js +0 -63
package/dist/chunk-LR5CRY5A.js
DELETED
|
@@ -1,514 +0,0 @@
|
|
|
1
|
-
import { SubshellContainer, SubshellSidebar, SubshellRightSideContainer } from './chunk-RX4UWZZR.js';
|
|
2
|
-
import { FeatureUnavailableState } from './chunk-BHR7IV72.js';
|
|
3
|
-
import { useRouterContext } from './chunk-Q7DJKLEN.js';
|
|
4
|
-
import { useInitialization } from './chunk-DK2HVHCY.js';
|
|
5
|
-
import { useOrganization } from './chunk-DD3CCMCZ.js';
|
|
6
|
-
import { createContext, useMemo, useCallback, useContext } from 'react';
|
|
7
|
-
import { jsx, Fragment, jsxs } from 'react/jsx-runtime';
|
|
8
|
-
|
|
9
|
-
function createFeatureAccessHook({
|
|
10
|
-
useInitialization: useInitialization2,
|
|
11
|
-
useOrganization: useOrganization2
|
|
12
|
-
}) {
|
|
13
|
-
return function useFeatureAccess2() {
|
|
14
|
-
const { profile, organizationReady } = useInitialization2();
|
|
15
|
-
const { currentMembership } = useOrganization2();
|
|
16
|
-
const { orgConfig, membershipConfig } = useMemo(() => {
|
|
17
|
-
const organizationConfig = currentMembership?.organization?.config;
|
|
18
|
-
const memberConfig = currentMembership?.config;
|
|
19
|
-
return { orgConfig: organizationConfig, membershipConfig: memberConfig };
|
|
20
|
-
}, [currentMembership]);
|
|
21
|
-
const userConfig = profile?.config;
|
|
22
|
-
const checkFeature = useCallback(
|
|
23
|
-
(featureKey) => {
|
|
24
|
-
if (profile?.is_platform_admin) {
|
|
25
|
-
return { allowed: true, restrictedBy: null };
|
|
26
|
-
}
|
|
27
|
-
const membershipValue = membershipConfig?.features?.[featureKey];
|
|
28
|
-
if (membershipValue === false) return { allowed: false, restrictedBy: "membership" };
|
|
29
|
-
return { allowed: true, restrictedBy: null };
|
|
30
|
-
},
|
|
31
|
-
[profile?.is_platform_admin, membershipConfig]
|
|
32
|
-
);
|
|
33
|
-
const hasFeature = useCallback((featureKey) => checkFeature(featureKey).allowed, [checkFeature]);
|
|
34
|
-
return {
|
|
35
|
-
orgConfig,
|
|
36
|
-
membershipConfig,
|
|
37
|
-
userConfig,
|
|
38
|
-
hasFeature,
|
|
39
|
-
checkFeature,
|
|
40
|
-
isReady: organizationReady
|
|
41
|
-
};
|
|
42
|
-
};
|
|
43
|
-
}
|
|
44
|
-
var createUseFeatureAccess = createFeatureAccessHook;
|
|
45
|
-
|
|
46
|
-
// src/provider/resolvers/RouteResolver.ts
|
|
47
|
-
function normalizeRoutePath(path) {
|
|
48
|
-
const trimmedPath = path.trim();
|
|
49
|
-
if (!trimmedPath || trimmedPath === "/") {
|
|
50
|
-
return "/";
|
|
51
|
-
}
|
|
52
|
-
return trimmedPath.replace(/\/+$/, "") || "/";
|
|
53
|
-
}
|
|
54
|
-
function isRouteMatch(currentPath, route) {
|
|
55
|
-
const normalizedCurrentPath = normalizeRoutePath(currentPath);
|
|
56
|
-
const normalizedRoute = normalizeRoutePath(route);
|
|
57
|
-
return normalizedCurrentPath === normalizedRoute || normalizedCurrentPath.startsWith(`${normalizedRoute}/`);
|
|
58
|
-
}
|
|
59
|
-
|
|
60
|
-
// src/provider/resolvers/NavResolver.ts
|
|
61
|
-
function uniqueIds(ids) {
|
|
62
|
-
return ids ? [...new Set(ids)] : [];
|
|
63
|
-
}
|
|
64
|
-
function collectNavLinkPaths(links) {
|
|
65
|
-
if (!links?.length) {
|
|
66
|
-
return [];
|
|
67
|
-
}
|
|
68
|
-
return links.flatMap((link) => [link.link, ...collectNavLinkPaths(link.links)]);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
// src/provider/validateManifests.ts
|
|
72
|
-
function validateManifests(manifests, organizationModel) {
|
|
73
|
-
if (!organizationModel) {
|
|
74
|
-
return;
|
|
75
|
-
}
|
|
76
|
-
const validFeatureIds = new Set(organizationModel.features.map((f) => f.id));
|
|
77
|
-
const validCapabilityIds = /* @__PURE__ */ new Set([
|
|
78
|
-
...organizationModel.features.flatMap((f) => f.capabilityIds),
|
|
79
|
-
...organizationModel.navigation.surfaces.flatMap((s) => s.capabilityIds),
|
|
80
|
-
...organizationModel.resourceMappings.flatMap((r) => r.capabilityIds)
|
|
81
|
-
]);
|
|
82
|
-
const errors = [];
|
|
83
|
-
for (const manifest of manifests) {
|
|
84
|
-
const key = manifest.key;
|
|
85
|
-
if (!validFeatureIds.has(manifest.featureId)) {
|
|
86
|
-
errors.push(
|
|
87
|
-
`Manifest "${key}": featureId "${manifest.featureId}" is not a known feature id. Valid values: ${[...validFeatureIds].sort().join(", ")}`
|
|
88
|
-
);
|
|
89
|
-
}
|
|
90
|
-
if (manifest.capabilityIds) {
|
|
91
|
-
for (let i = 0; i < manifest.capabilityIds.length; i++) {
|
|
92
|
-
const capabilityId = manifest.capabilityIds[i];
|
|
93
|
-
if (!validCapabilityIds.has(capabilityId)) {
|
|
94
|
-
errors.push(
|
|
95
|
-
`Manifest "${key}": capabilityIds[${i}] references unknown capability "${capabilityId}". Valid capabilities: ${[...validCapabilityIds].sort().join(", ")}`
|
|
96
|
-
);
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
}
|
|
100
|
-
}
|
|
101
|
-
if (errors.length > 0) {
|
|
102
|
-
throw new Error(
|
|
103
|
-
`Feature manifest validation failed with ${errors.length} error(s):
|
|
104
|
-
` + errors.map((e, i) => ` ${i + 1}. ${e}`).join("\n")
|
|
105
|
-
);
|
|
106
|
-
}
|
|
107
|
-
}
|
|
108
|
-
var useFeatureAccess = createFeatureAccessHook({
|
|
109
|
-
useInitialization,
|
|
110
|
-
useOrganization
|
|
111
|
-
});
|
|
112
|
-
var ElevasisFeaturesContext = createContext(null);
|
|
113
|
-
function useElevasisFeatures() {
|
|
114
|
-
const context = useContext(ElevasisFeaturesContext);
|
|
115
|
-
if (!context) {
|
|
116
|
-
throw new Error(
|
|
117
|
-
"useElevasisFeatures must be used within an ElevasisFeaturesProvider. Wrap your app (or the relevant subtree) with <ElevasisFeaturesProvider>."
|
|
118
|
-
);
|
|
119
|
-
}
|
|
120
|
-
return context;
|
|
121
|
-
}
|
|
122
|
-
function useOptionalElevasisFeatures() {
|
|
123
|
-
return useContext(ElevasisFeaturesContext);
|
|
124
|
-
}
|
|
125
|
-
function findOrganizationModelFeature(organizationModel, featureId) {
|
|
126
|
-
if (!organizationModel) {
|
|
127
|
-
return void 0;
|
|
128
|
-
}
|
|
129
|
-
return organizationModel.features.find((f) => f.id === featureId);
|
|
130
|
-
}
|
|
131
|
-
function findSurfaceByPath(organizationModel, path) {
|
|
132
|
-
if (!organizationModel) {
|
|
133
|
-
return void 0;
|
|
134
|
-
}
|
|
135
|
-
const normalizedPath = normalizeRoutePath(path);
|
|
136
|
-
return organizationModel.navigation.surfaces.find((surface) => normalizeRoutePath(surface.path) === normalizedPath);
|
|
137
|
-
}
|
|
138
|
-
function findSurfaceById(organizationModel, id) {
|
|
139
|
-
if (!organizationModel) {
|
|
140
|
-
return void 0;
|
|
141
|
-
}
|
|
142
|
-
return organizationModel.navigation.surfaces.find((surface) => surface.id === id);
|
|
143
|
-
}
|
|
144
|
-
function findSurfacesByPaths(organizationModel, paths) {
|
|
145
|
-
if (!organizationModel || paths.length === 0) {
|
|
146
|
-
return [];
|
|
147
|
-
}
|
|
148
|
-
const normalizedPaths = new Set(paths.map((path) => normalizeRoutePath(path)));
|
|
149
|
-
return organizationModel.navigation.surfaces.filter(
|
|
150
|
-
(surface) => normalizedPaths.has(normalizeRoutePath(surface.path))
|
|
151
|
-
);
|
|
152
|
-
}
|
|
153
|
-
function getOrganizationModelFeatureLabel(organizationModel, featureId) {
|
|
154
|
-
if (!organizationModel || !featureId) {
|
|
155
|
-
return void 0;
|
|
156
|
-
}
|
|
157
|
-
return findOrganizationModelFeature(organizationModel, featureId)?.label;
|
|
158
|
-
}
|
|
159
|
-
function isOrganizationModelFeatureEnabled(organizationModel, featureId) {
|
|
160
|
-
if (!organizationModel) {
|
|
161
|
-
return void 0;
|
|
162
|
-
}
|
|
163
|
-
const feature = findOrganizationModelFeature(organizationModel, featureId);
|
|
164
|
-
if (!feature) {
|
|
165
|
-
return void 0;
|
|
166
|
-
}
|
|
167
|
-
return feature.enabled;
|
|
168
|
-
}
|
|
169
|
-
function resolveOrganizationGraphSurface(features, organizationModel) {
|
|
170
|
-
for (const feature of features) {
|
|
171
|
-
const graphBridge = feature.organizationGraph;
|
|
172
|
-
if (!graphBridge) {
|
|
173
|
-
continue;
|
|
174
|
-
}
|
|
175
|
-
const surface = findSurfaceById(organizationModel, graphBridge.surfaceId);
|
|
176
|
-
return {
|
|
177
|
-
available: Boolean(surface),
|
|
178
|
-
surfaceId: graphBridge.surfaceId,
|
|
179
|
-
surfacePath: surface?.path,
|
|
180
|
-
surfaceType: surface?.surfaceType,
|
|
181
|
-
featureId: surface?.featureId
|
|
182
|
-
};
|
|
183
|
-
}
|
|
184
|
-
return {
|
|
185
|
-
available: false
|
|
186
|
-
};
|
|
187
|
-
}
|
|
188
|
-
function resolveNavLink(link, organizationModel) {
|
|
189
|
-
const matchedSurface = findSurfaceByPath(organizationModel, link.link);
|
|
190
|
-
const featureLabel = getOrganizationModelFeatureLabel(organizationModel, link.featureKey);
|
|
191
|
-
return {
|
|
192
|
-
...link,
|
|
193
|
-
label: matchedSurface?.label ?? featureLabel ?? link.label,
|
|
194
|
-
link: matchedSurface?.path ?? link.link,
|
|
195
|
-
links: link.links?.map((nestedLink) => resolveNavLink(nestedLink, organizationModel))
|
|
196
|
-
};
|
|
197
|
-
}
|
|
198
|
-
function resolveNavEntry(navEntry, organizationModel, ownerFeatureId) {
|
|
199
|
-
const matchedSurface = navEntry.link ? findSurfaceByPath(organizationModel, navEntry.link) : void 0;
|
|
200
|
-
const featureLabel = getOrganizationModelFeatureLabel(organizationModel, navEntry.featureKey ?? ownerFeatureId);
|
|
201
|
-
return {
|
|
202
|
-
...navEntry,
|
|
203
|
-
label: featureLabel ?? matchedSurface?.label ?? navEntry.label,
|
|
204
|
-
link: matchedSurface?.path ?? navEntry.link,
|
|
205
|
-
links: navEntry.links?.map((link) => resolveNavLink(link, organizationModel))
|
|
206
|
-
};
|
|
207
|
-
}
|
|
208
|
-
function resolveFeatureModule(feature, organizationModel) {
|
|
209
|
-
if (!feature.navEntry) {
|
|
210
|
-
return feature;
|
|
211
|
-
}
|
|
212
|
-
return {
|
|
213
|
-
...feature,
|
|
214
|
-
navEntry: resolveNavEntry(feature.navEntry, organizationModel, feature.featureId)
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
function resolveFeatureSemantics(feature, resolvedFeature, organizationModel) {
|
|
218
|
-
const linkedPaths = [resolvedFeature.navEntry?.link, ...collectNavLinkPaths(resolvedFeature.navEntry?.links)].filter(
|
|
219
|
-
(path) => Boolean(path)
|
|
220
|
-
);
|
|
221
|
-
const linkedSurfaces = findSurfacesByPaths(organizationModel, linkedPaths);
|
|
222
|
-
const organizationGraphSurface = feature.organizationGraph ? findSurfaceById(organizationModel, feature.organizationGraph.surfaceId) : void 0;
|
|
223
|
-
const surfaces = [...linkedSurfaces, ...organizationGraphSurface ? [organizationGraphSurface] : []].filter(
|
|
224
|
-
(surface, index, items) => Boolean(surface) && items.findIndex((candidate) => candidate.id === surface.id) === index
|
|
225
|
-
);
|
|
226
|
-
return {
|
|
227
|
-
capabilityIds: uniqueIds([
|
|
228
|
-
...feature.capabilityIds ?? [],
|
|
229
|
-
...surfaces.flatMap((surface) => surface.capabilityIds)
|
|
230
|
-
]),
|
|
231
|
-
surfaceIds: surfaces.map((surface) => surface.id),
|
|
232
|
-
surfaces
|
|
233
|
-
};
|
|
234
|
-
}
|
|
235
|
-
function resolveFeatureModules(features, organizationModel, isFeatureEnabled) {
|
|
236
|
-
return features.map((feature) => {
|
|
237
|
-
const resolvedFeature = resolveFeatureModule(feature, organizationModel);
|
|
238
|
-
const featureId = feature.featureId;
|
|
239
|
-
return {
|
|
240
|
-
...resolvedFeature,
|
|
241
|
-
access: {
|
|
242
|
-
featureId,
|
|
243
|
-
enabled: isFeatureEnabled(featureId)
|
|
244
|
-
},
|
|
245
|
-
semantics: resolveFeatureSemantics(feature, resolvedFeature, organizationModel)
|
|
246
|
-
};
|
|
247
|
-
});
|
|
248
|
-
}
|
|
249
|
-
function filterNavLinks(links, disabledSubsectionPaths, isFeatureEnabled) {
|
|
250
|
-
return links.flatMap((link) => {
|
|
251
|
-
if (link.featureKey && !isFeatureEnabled(link.featureKey)) {
|
|
252
|
-
return [];
|
|
253
|
-
}
|
|
254
|
-
if (disabledSubsectionPaths.some((disabledPath) => isRouteMatch(link.link, disabledPath))) {
|
|
255
|
-
return [];
|
|
256
|
-
}
|
|
257
|
-
const nestedLinks = link.links?.length ? filterNavLinks(link.links, disabledSubsectionPaths, isFeatureEnabled) : void 0;
|
|
258
|
-
return [
|
|
259
|
-
{
|
|
260
|
-
...link,
|
|
261
|
-
links: nestedLinks
|
|
262
|
-
}
|
|
263
|
-
];
|
|
264
|
-
});
|
|
265
|
-
}
|
|
266
|
-
function createShellNavItem(navEntry, placement, source, featureId, links = navEntry.links) {
|
|
267
|
-
return {
|
|
268
|
-
...navEntry,
|
|
269
|
-
links,
|
|
270
|
-
placement,
|
|
271
|
-
source,
|
|
272
|
-
featureId
|
|
273
|
-
};
|
|
274
|
-
}
|
|
275
|
-
function createFeatureShellNavItem(feature, links = feature.navEntry?.links) {
|
|
276
|
-
if (!feature.navEntry) {
|
|
277
|
-
return void 0;
|
|
278
|
-
}
|
|
279
|
-
return createShellNavItem(feature.navEntry, "primary", "feature", feature.access.featureId, links);
|
|
280
|
-
}
|
|
281
|
-
function getFeatureNavItems(features, disabledSubsectionPaths, isFeatureEnabled) {
|
|
282
|
-
return features.flatMap((feature) => {
|
|
283
|
-
if (!feature.navEntry) {
|
|
284
|
-
return [];
|
|
285
|
-
}
|
|
286
|
-
const links = feature.navEntry.links?.length ? filterNavLinks(feature.navEntry.links, disabledSubsectionPaths, isFeatureEnabled) : void 0;
|
|
287
|
-
const navItem = createFeatureShellNavItem(feature, links);
|
|
288
|
-
return navItem ? [navItem] : [];
|
|
289
|
-
});
|
|
290
|
-
}
|
|
291
|
-
function resolveAppShellOverrides(appShellOverrides, organizationModel) {
|
|
292
|
-
if (!appShellOverrides) {
|
|
293
|
-
return {};
|
|
294
|
-
}
|
|
295
|
-
return {
|
|
296
|
-
primaryNavItems: appShellOverrides.primaryNavItems?.map((navItem) => resolveNavEntry(navItem, organizationModel)),
|
|
297
|
-
bottomNavItems: appShellOverrides.bottomNavItems?.map((navItem) => resolveNavEntry(navItem, organizationModel))
|
|
298
|
-
};
|
|
299
|
-
}
|
|
300
|
-
function getAppShellNavItems(navItems, placement, disabledSubsectionPaths, isFeatureEnabled) {
|
|
301
|
-
if (!navItems?.length) {
|
|
302
|
-
return [];
|
|
303
|
-
}
|
|
304
|
-
return navItems.flatMap((navItem) => {
|
|
305
|
-
if (navItem.featureKey && !isFeatureEnabled(navItem.featureKey)) {
|
|
306
|
-
return [];
|
|
307
|
-
}
|
|
308
|
-
const links = navItem.links?.length ? filterNavLinks(navItem.links, disabledSubsectionPaths, isFeatureEnabled) : void 0;
|
|
309
|
-
if (navItem.links && !links?.length && !navItem.link) {
|
|
310
|
-
return [];
|
|
311
|
-
}
|
|
312
|
-
return [createShellNavItem(navItem, placement, "app", navItem.featureKey, links)];
|
|
313
|
-
});
|
|
314
|
-
}
|
|
315
|
-
function findMatchingNavLink(links, currentPath) {
|
|
316
|
-
for (const link of links) {
|
|
317
|
-
if (link.links?.length) {
|
|
318
|
-
const nestedLink = findMatchingNavLink(link.links, currentPath);
|
|
319
|
-
if (nestedLink) {
|
|
320
|
-
return nestedLink;
|
|
321
|
-
}
|
|
322
|
-
}
|
|
323
|
-
if (isRouteMatch(currentPath, link.link)) {
|
|
324
|
-
return link;
|
|
325
|
-
}
|
|
326
|
-
}
|
|
327
|
-
return null;
|
|
328
|
-
}
|
|
329
|
-
function isHiddenNavLink(link, disabledSubsectionPaths, isFeatureEnabled) {
|
|
330
|
-
if (link.featureKey && !isFeatureEnabled(link.featureKey)) {
|
|
331
|
-
return true;
|
|
332
|
-
}
|
|
333
|
-
return disabledSubsectionPaths.some((disabledPath) => isRouteMatch(link.link, disabledPath));
|
|
334
|
-
}
|
|
335
|
-
function resolveRoute(features, currentPath, disabledSubsectionPaths, isFeatureEnabled) {
|
|
336
|
-
for (const feature of features) {
|
|
337
|
-
const navEntry = feature.navEntry;
|
|
338
|
-
const matchesSubshell = feature.subshellRoutes?.some((route) => isRouteMatch(currentPath, route)) ?? false;
|
|
339
|
-
const matchesEntryLink = navEntry?.link ? isRouteMatch(currentPath, navEntry.link) : false;
|
|
340
|
-
const matchedLink = navEntry?.links?.length ? findMatchingNavLink(navEntry.links, currentPath) : null;
|
|
341
|
-
if (!matchesSubshell && !matchesEntryLink && !matchedLink) {
|
|
342
|
-
continue;
|
|
343
|
-
}
|
|
344
|
-
if (matchedLink && isHiddenNavLink(matchedLink, disabledSubsectionPaths, isFeatureEnabled)) {
|
|
345
|
-
return {
|
|
346
|
-
status: "hidden",
|
|
347
|
-
path: currentPath,
|
|
348
|
-
feature,
|
|
349
|
-
navItem: createFeatureShellNavItem(feature),
|
|
350
|
-
navLink: matchedLink
|
|
351
|
-
};
|
|
352
|
-
}
|
|
353
|
-
return {
|
|
354
|
-
status: "matched",
|
|
355
|
-
path: currentPath,
|
|
356
|
-
feature,
|
|
357
|
-
navItem: createFeatureShellNavItem(feature),
|
|
358
|
-
navLink: matchedLink ?? void 0
|
|
359
|
-
};
|
|
360
|
-
}
|
|
361
|
-
return {
|
|
362
|
-
status: "unmatched",
|
|
363
|
-
path: currentPath
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
function ElevasisFeaturesProvider({
|
|
367
|
-
features,
|
|
368
|
-
organizationModel,
|
|
369
|
-
appShellOverrides,
|
|
370
|
-
timeRange,
|
|
371
|
-
operationsApiUrl,
|
|
372
|
-
operationsSSEManager,
|
|
373
|
-
deliveryApiUrl,
|
|
374
|
-
deliverySSEManager,
|
|
375
|
-
disabledSubsectionPaths = [],
|
|
376
|
-
children
|
|
377
|
-
}) {
|
|
378
|
-
useMemo(() => validateManifests(features, organizationModel), [features, organizationModel]);
|
|
379
|
-
const { hasFeature } = useFeatureAccess();
|
|
380
|
-
const hasResolvedFeature = useCallback(
|
|
381
|
-
(key) => {
|
|
382
|
-
if (!hasFeature(key)) {
|
|
383
|
-
return false;
|
|
384
|
-
}
|
|
385
|
-
const organizationModelFeatureEnabled = isOrganizationModelFeatureEnabled(organizationModel, key);
|
|
386
|
-
if (organizationModelFeatureEnabled === void 0) {
|
|
387
|
-
return true;
|
|
388
|
-
}
|
|
389
|
-
return organizationModelFeatureEnabled;
|
|
390
|
-
},
|
|
391
|
-
[hasFeature, organizationModel]
|
|
392
|
-
);
|
|
393
|
-
const normalizedDisabledSubsectionPaths = useMemo(() => {
|
|
394
|
-
const explicit = disabledSubsectionPaths.map((path) => normalizeRoutePath(path));
|
|
395
|
-
const fromModel = organizationModel?.navigation.surfaces.filter((s) => s.enabled === false).map((s) => normalizeRoutePath(s.path)) ?? [];
|
|
396
|
-
return [.../* @__PURE__ */ new Set([...explicit, ...fromModel])];
|
|
397
|
-
}, [disabledSubsectionPaths, organizationModel]);
|
|
398
|
-
const resolvedFeatures = useMemo(
|
|
399
|
-
() => resolveFeatureModules(features, organizationModel, hasResolvedFeature),
|
|
400
|
-
[features, organizationModel, hasResolvedFeature]
|
|
401
|
-
);
|
|
402
|
-
const resolvedAppShellOverrides = useMemo(
|
|
403
|
-
() => resolveAppShellOverrides(appShellOverrides, organizationModel),
|
|
404
|
-
[appShellOverrides, organizationModel]
|
|
405
|
-
);
|
|
406
|
-
const enabledResolvedFeatures = useMemo(
|
|
407
|
-
() => resolvedFeatures.filter((feature) => feature.access.enabled),
|
|
408
|
-
[resolvedFeatures]
|
|
409
|
-
);
|
|
410
|
-
const featureNavItems = useMemo(
|
|
411
|
-
() => getFeatureNavItems(enabledResolvedFeatures, normalizedDisabledSubsectionPaths, hasResolvedFeature),
|
|
412
|
-
[enabledResolvedFeatures, normalizedDisabledSubsectionPaths, hasResolvedFeature]
|
|
413
|
-
);
|
|
414
|
-
const primaryNavItems = useMemo(
|
|
415
|
-
() => [
|
|
416
|
-
...getAppShellNavItems(
|
|
417
|
-
resolvedAppShellOverrides.primaryNavItems,
|
|
418
|
-
"primary",
|
|
419
|
-
normalizedDisabledSubsectionPaths,
|
|
420
|
-
hasResolvedFeature
|
|
421
|
-
),
|
|
422
|
-
...featureNavItems
|
|
423
|
-
],
|
|
424
|
-
[resolvedAppShellOverrides.primaryNavItems, normalizedDisabledSubsectionPaths, hasResolvedFeature, featureNavItems]
|
|
425
|
-
);
|
|
426
|
-
const bottomNavItems = useMemo(
|
|
427
|
-
() => getAppShellNavItems(
|
|
428
|
-
resolvedAppShellOverrides.bottomNavItems,
|
|
429
|
-
"bottom",
|
|
430
|
-
normalizedDisabledSubsectionPaths,
|
|
431
|
-
hasResolvedFeature
|
|
432
|
-
),
|
|
433
|
-
[resolvedAppShellOverrides.bottomNavItems, normalizedDisabledSubsectionPaths, hasResolvedFeature]
|
|
434
|
-
);
|
|
435
|
-
const shellNavItems = useMemo(() => [...primaryNavItems, ...bottomNavItems], [primaryNavItems, bottomNavItems]);
|
|
436
|
-
const shellModel = useMemo(
|
|
437
|
-
() => ({
|
|
438
|
-
navItems: shellNavItems
|
|
439
|
-
}),
|
|
440
|
-
[shellNavItems]
|
|
441
|
-
);
|
|
442
|
-
const organizationGraph = useMemo(
|
|
443
|
-
() => resolveOrganizationGraphSurface(enabledResolvedFeatures, organizationModel),
|
|
444
|
-
[enabledResolvedFeatures, organizationModel]
|
|
445
|
-
);
|
|
446
|
-
const getResolvedFeature = useCallback(
|
|
447
|
-
(key) => resolvedFeatures.find((feature) => feature.key === key),
|
|
448
|
-
[resolvedFeatures]
|
|
449
|
-
);
|
|
450
|
-
const isFeatureEnabled = useCallback((key) => hasResolvedFeature(key), [hasResolvedFeature]);
|
|
451
|
-
const resolveRouteByPath = useCallback(
|
|
452
|
-
(path) => resolveRoute(enabledResolvedFeatures, path, normalizedDisabledSubsectionPaths, isFeatureEnabled),
|
|
453
|
-
[enabledResolvedFeatures, normalizedDisabledSubsectionPaths, isFeatureEnabled]
|
|
454
|
-
);
|
|
455
|
-
const shellRuntime = useMemo(
|
|
456
|
-
() => ({
|
|
457
|
-
resolveRoute: resolveRouteByPath
|
|
458
|
-
}),
|
|
459
|
-
[resolveRouteByPath]
|
|
460
|
-
);
|
|
461
|
-
const value = useMemo(
|
|
462
|
-
() => ({
|
|
463
|
-
shellModel,
|
|
464
|
-
shellRuntime,
|
|
465
|
-
enabledResolvedFeatures,
|
|
466
|
-
resolvedFeatures,
|
|
467
|
-
organizationGraph,
|
|
468
|
-
organizationModel,
|
|
469
|
-
timeRange,
|
|
470
|
-
operationsApiUrl,
|
|
471
|
-
operationsSSEManager,
|
|
472
|
-
deliveryApiUrl,
|
|
473
|
-
deliverySSEManager,
|
|
474
|
-
disabledSubsectionPaths: normalizedDisabledSubsectionPaths,
|
|
475
|
-
isFeatureEnabled,
|
|
476
|
-
getResolvedFeature
|
|
477
|
-
}),
|
|
478
|
-
[
|
|
479
|
-
shellModel,
|
|
480
|
-
shellRuntime,
|
|
481
|
-
enabledResolvedFeatures,
|
|
482
|
-
resolvedFeatures,
|
|
483
|
-
organizationGraph,
|
|
484
|
-
organizationModel,
|
|
485
|
-
timeRange,
|
|
486
|
-
operationsApiUrl,
|
|
487
|
-
operationsSSEManager,
|
|
488
|
-
deliveryApiUrl,
|
|
489
|
-
deliverySSEManager,
|
|
490
|
-
normalizedDisabledSubsectionPaths,
|
|
491
|
-
isFeatureEnabled,
|
|
492
|
-
getResolvedFeature
|
|
493
|
-
]
|
|
494
|
-
);
|
|
495
|
-
return /* @__PURE__ */ jsx(ElevasisFeaturesContext.Provider, { value, children });
|
|
496
|
-
}
|
|
497
|
-
function FeatureShell({ children }) {
|
|
498
|
-
const { shellRuntime } = useElevasisFeatures();
|
|
499
|
-
const { currentPath } = useRouterContext();
|
|
500
|
-
const routeMatch = shellRuntime.resolveRoute(currentPath);
|
|
501
|
-
if (routeMatch.status === "hidden") {
|
|
502
|
-
return /* @__PURE__ */ jsx(FeatureUnavailableState, { path: currentPath });
|
|
503
|
-
}
|
|
504
|
-
if (routeMatch.status !== "matched" || !routeMatch.feature?.sidebar) {
|
|
505
|
-
return /* @__PURE__ */ jsx(Fragment, { children });
|
|
506
|
-
}
|
|
507
|
-
const SidebarComponent = routeMatch.feature.sidebar;
|
|
508
|
-
return /* @__PURE__ */ jsxs(SubshellContainer, { children: [
|
|
509
|
-
/* @__PURE__ */ jsx(SubshellSidebar, { width: 250, children: /* @__PURE__ */ jsx(SidebarComponent, {}) }),
|
|
510
|
-
/* @__PURE__ */ jsx(SubshellRightSideContainer, { children })
|
|
511
|
-
] });
|
|
512
|
-
}
|
|
513
|
-
|
|
514
|
-
export { ElevasisFeaturesProvider, FeatureShell, createFeatureAccessHook, createUseFeatureAccess, useElevasisFeatures, useOptionalElevasisFeatures };
|
package/dist/chunk-MG3NF7QL.js
DELETED
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
import { useRouterContext } from './chunk-Q7DJKLEN.js';
|
|
2
|
-
import { useMemo } from 'react';
|
|
3
|
-
|
|
4
|
-
var useBreadcrumbs = (options = {}) => {
|
|
5
|
-
const { currentPath } = useRouterContext();
|
|
6
|
-
const { navItems = [] } = options;
|
|
7
|
-
return useMemo(() => {
|
|
8
|
-
const segments = currentPath.split("/").filter(Boolean);
|
|
9
|
-
if (segments.length === 0) {
|
|
10
|
-
return [{ label: "Dashboard", isActive: true }];
|
|
11
|
-
}
|
|
12
|
-
const breadcrumbs = [{ label: "Dashboard", path: "/" }];
|
|
13
|
-
let currentSegmentPath = "";
|
|
14
|
-
for (let i = 0; i < segments.length; i++) {
|
|
15
|
-
currentSegmentPath += `/${segments[i]}`;
|
|
16
|
-
const isLast = i === segments.length - 1;
|
|
17
|
-
let label = formatSegmentLabel(segments[i]);
|
|
18
|
-
let matchedItem = null;
|
|
19
|
-
for (const navItem of navItems) {
|
|
20
|
-
if (navItem.link === currentSegmentPath) {
|
|
21
|
-
matchedItem = navItem;
|
|
22
|
-
break;
|
|
23
|
-
}
|
|
24
|
-
if (navItem.links) {
|
|
25
|
-
for (const subItem of navItem.links) {
|
|
26
|
-
if (subItem.link === currentSegmentPath) {
|
|
27
|
-
if (i === 0 && subItem.label === "Overview") {
|
|
28
|
-
matchedItem = { label: navItem.label };
|
|
29
|
-
} else {
|
|
30
|
-
matchedItem = subItem;
|
|
31
|
-
}
|
|
32
|
-
break;
|
|
33
|
-
}
|
|
34
|
-
if (subItem.links) {
|
|
35
|
-
for (const nestedLink of subItem.links) {
|
|
36
|
-
if (nestedLink.link === currentSegmentPath) {
|
|
37
|
-
matchedItem = nestedLink;
|
|
38
|
-
break;
|
|
39
|
-
}
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (matchedItem) break;
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
if (matchedItem) break;
|
|
46
|
-
}
|
|
47
|
-
if (matchedItem) {
|
|
48
|
-
label = matchedItem.label;
|
|
49
|
-
}
|
|
50
|
-
breadcrumbs.push({
|
|
51
|
-
label,
|
|
52
|
-
path: isLast ? void 0 : currentSegmentPath,
|
|
53
|
-
isActive: isLast
|
|
54
|
-
});
|
|
55
|
-
}
|
|
56
|
-
return breadcrumbs;
|
|
57
|
-
}, [currentPath, navItems]);
|
|
58
|
-
};
|
|
59
|
-
function formatSegmentLabel(segment) {
|
|
60
|
-
return segment.split("-").map((word) => word.charAt(0).toUpperCase() + word.slice(1)).join(" ");
|
|
61
|
-
}
|
|
62
|
-
|
|
63
|
-
export { useBreadcrumbs };
|