@elevasis/ui 2.2.1 → 2.3.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 (43) hide show
  1. package/dist/{chunk-J5TBNCMD.js → chunk-2XWEOJSX.js} +3 -3
  2. package/dist/{chunk-3WMJWXZY.js → chunk-47YILFON.js} +96 -68
  3. package/dist/{chunk-MZPVNRPL.js → chunk-ISHNN42L.js} +134 -10
  4. package/dist/{chunk-PFONCU6C.js → chunk-IWFIKQR5.js} +1 -1
  5. package/dist/{chunk-LH7RCX4Y.js → chunk-JT7WDIZI.js} +2 -2
  6. package/dist/{chunk-YOZEGIZA.js → chunk-NKV5MEWQ.js} +3877 -1543
  7. package/dist/{chunk-5KBVISVJ.js → chunk-PEATQEEP.js} +3 -3
  8. package/dist/{chunk-JT3FN6TE.js → chunk-Q3FTQP2M.js} +2 -2
  9. package/dist/{chunk-O6KZ46EJ.js → chunk-SWIAK47F.js} +3 -3
  10. package/dist/{chunk-M66JAN7R.js → chunk-VNUOQQNY.js} +1 -1
  11. package/dist/{chunk-2JTCPVZX.js → chunk-ZY4MWZW2.js} +2 -2
  12. package/dist/components/index.css +7 -0
  13. package/dist/components/index.d.ts +12 -1
  14. package/dist/components/index.js +851 -42
  15. package/dist/features/auth/index.css +7 -0
  16. package/dist/features/dashboard/index.css +7 -0
  17. package/dist/features/dashboard/index.d.ts +4 -0
  18. package/dist/features/dashboard/index.js +6 -6
  19. package/dist/features/monitoring/index.css +7 -0
  20. package/dist/features/monitoring/index.d.ts +4 -0
  21. package/dist/features/monitoring/index.js +7 -7
  22. package/dist/features/operations/index.css +7 -0
  23. package/dist/features/operations/index.d.ts +26 -14
  24. package/dist/features/operations/index.js +8 -8
  25. package/dist/features/settings/index.css +7 -0
  26. package/dist/features/settings/index.d.ts +4 -0
  27. package/dist/features/settings/index.js +7 -7
  28. package/dist/hooks/index.css +7 -0
  29. package/dist/hooks/index.d.ts +4 -1
  30. package/dist/hooks/index.js +5 -5
  31. package/dist/hooks/published.css +7 -0
  32. package/dist/hooks/published.d.ts +4 -1
  33. package/dist/hooks/published.js +4 -4
  34. package/dist/index.css +7 -0
  35. package/dist/index.d.ts +307 -249
  36. package/dist/index.js +6 -6
  37. package/dist/provider/index.css +7 -0
  38. package/dist/provider/index.d.ts +58 -2
  39. package/dist/provider/index.js +3 -3
  40. package/dist/provider/published.d.ts +58 -2
  41. package/dist/provider/published.js +1 -1
  42. package/dist/theme/index.js +2 -2
  43. package/package.json +9 -3
@@ -184,7 +184,15 @@ function useOptionalElevasisFeatures() {
184
184
  return useContext(ElevasisFeaturesContext);
185
185
  }
186
186
  function getEnabledFeatures(features, hasFeature) {
187
- return features.filter((feature) => hasFeature(feature.key));
187
+ return features.filter((feature) => {
188
+ const accessKeys = [feature.key, feature.navEntry?.featureKey].filter(
189
+ (key) => Boolean(key)
190
+ );
191
+ if (accessKeys.length === 0) {
192
+ return true;
193
+ }
194
+ return accessKeys.some((key) => hasFeature(key));
195
+ });
188
196
  }
189
197
  function normalizeRoutePath(path) {
190
198
  const trimmedPath = path.trim();
@@ -198,6 +206,90 @@ function isRouteMatch(currentPath, route) {
198
206
  const normalizedRoute = normalizeRoutePath(route);
199
207
  return normalizedCurrentPath === normalizedRoute || normalizedCurrentPath.startsWith(`${normalizedRoute}/`);
200
208
  }
209
+ function hasOrganizationModelFeatureKey(organizationModel, key) {
210
+ if (!organizationModel) {
211
+ return false;
212
+ }
213
+ return Object.prototype.hasOwnProperty.call(organizationModel.features.enabled, key);
214
+ }
215
+ function findSurfaceByPath(organizationModel, path) {
216
+ if (!organizationModel) {
217
+ return void 0;
218
+ }
219
+ const normalizedPath = normalizeRoutePath(path);
220
+ return organizationModel.navigation.surfaces.find(
221
+ (surface) => normalizeRoutePath(surface.path) === normalizedPath
222
+ );
223
+ }
224
+ function findSurfaceById(organizationModel, id) {
225
+ if (!organizationModel) {
226
+ return void 0;
227
+ }
228
+ return organizationModel.navigation.surfaces.find((surface) => surface.id === id);
229
+ }
230
+ function getOrganizationModelFeatureLabel(organizationModel, key) {
231
+ if (!organizationModel || !key) {
232
+ return void 0;
233
+ }
234
+ if (!hasOrganizationModelFeatureKey(organizationModel, key)) {
235
+ return void 0;
236
+ }
237
+ return organizationModel.features.labels[key];
238
+ }
239
+ function isOrganizationModelFeatureEnabled(organizationModel, key) {
240
+ if (!organizationModel) {
241
+ return void 0;
242
+ }
243
+ if (!hasOrganizationModelFeatureKey(organizationModel, key)) {
244
+ return void 0;
245
+ }
246
+ return organizationModel.features.enabled[key];
247
+ }
248
+ function resolveOrganizationGraphSurface(features, organizationModel) {
249
+ for (const feature of features) {
250
+ const graphBridge = feature.organizationGraph;
251
+ if (!graphBridge) {
252
+ continue;
253
+ }
254
+ const surface = findSurfaceById(organizationModel, graphBridge.surfaceId);
255
+ return {
256
+ available: Boolean(surface),
257
+ surfaceId: graphBridge.surfaceId,
258
+ surfacePath: surface?.path,
259
+ surfaceType: surface?.surfaceType,
260
+ featureKey: surface?.featureKey
261
+ };
262
+ }
263
+ return {
264
+ available: false
265
+ };
266
+ }
267
+ function resolveNavLink(link, organizationModel) {
268
+ const matchedSurface = findSurfaceByPath(organizationModel, link.link);
269
+ const featureLabel = getOrganizationModelFeatureLabel(organizationModel, link.featureKey);
270
+ return {
271
+ ...link,
272
+ label: matchedSurface?.label ?? featureLabel ?? link.label,
273
+ link: matchedSurface?.path ?? link.link,
274
+ links: link.links?.map((nestedLink) => resolveNavLink(nestedLink, organizationModel))
275
+ };
276
+ }
277
+ function resolveFeatureModule(feature, organizationModel) {
278
+ if (!feature.navEntry) {
279
+ return feature;
280
+ }
281
+ const matchedSurface = feature.navEntry.link ? findSurfaceByPath(organizationModel, feature.navEntry.link) : void 0;
282
+ const featureLabel = getOrganizationModelFeatureLabel(organizationModel, feature.navEntry.featureKey);
283
+ return {
284
+ ...feature,
285
+ navEntry: {
286
+ ...feature.navEntry,
287
+ label: matchedSurface?.label ?? featureLabel ?? feature.navEntry.label,
288
+ link: matchedSurface?.path ?? feature.navEntry.link,
289
+ links: feature.navEntry.links?.map((link) => resolveNavLink(link, organizationModel))
290
+ }
291
+ };
292
+ }
201
293
  function filterNavLinks(links, disabledSubsectionPaths, isFeatureEnabled) {
202
294
  return links.flatMap((link) => {
203
295
  if (link.featureKey && !isFeatureEnabled(link.featureKey)) {
@@ -282,6 +374,7 @@ function resolveNavRoute(features, currentPath, disabledSubsectionPaths, isFeatu
282
374
  }
283
375
  function ElevasisFeaturesProvider({
284
376
  features,
377
+ organizationModel,
285
378
  timeRange,
286
379
  operationsApiUrl,
287
380
  operationsSSEManager,
@@ -289,22 +382,49 @@ function ElevasisFeaturesProvider({
289
382
  children
290
383
  }) {
291
384
  const { hasFeature } = useFeatureAccess();
385
+ const hasResolvedFeature = useCallback(
386
+ (key) => {
387
+ if (!hasFeature(key)) {
388
+ return false;
389
+ }
390
+ const organizationModelFeatureEnabled = isOrganizationModelFeatureEnabled(
391
+ organizationModel,
392
+ key
393
+ );
394
+ if (organizationModelFeatureEnabled === void 0) {
395
+ return true;
396
+ }
397
+ return organizationModelFeatureEnabled;
398
+ },
399
+ [hasFeature, organizationModel]
400
+ );
292
401
  const normalizedDisabledSubsectionPaths = useMemo(
293
402
  () => disabledSubsectionPaths.map((path) => normalizeRoutePath(path)),
294
403
  [disabledSubsectionPaths]
295
404
  );
296
- const enabledFeatures = useMemo(() => getEnabledFeatures(features, hasFeature), [features, hasFeature]);
405
+ const enabledFeatures = useMemo(
406
+ () => getEnabledFeatures(features, hasResolvedFeature).map((feature) => resolveFeatureModule(feature, organizationModel)),
407
+ [features, hasResolvedFeature, organizationModel]
408
+ );
409
+ const allFeatures = useMemo(
410
+ () => features.map((feature) => resolveFeatureModule(feature, organizationModel)),
411
+ [features, organizationModel]
412
+ );
297
413
  const navItems = useMemo(
298
- () => getNavItems(enabledFeatures, normalizedDisabledSubsectionPaths, hasFeature),
299
- [enabledFeatures, normalizedDisabledSubsectionPaths, hasFeature]
414
+ () => getNavItems(enabledFeatures, normalizedDisabledSubsectionPaths, hasResolvedFeature),
415
+ [enabledFeatures, normalizedDisabledSubsectionPaths, hasResolvedFeature]
416
+ );
417
+ const organizationGraph = useMemo(
418
+ () => resolveOrganizationGraphSurface(enabledFeatures, organizationModel),
419
+ [enabledFeatures, organizationModel]
300
420
  );
301
421
  const getFeature = useCallback(
302
- (key) => features.find((feature) => feature.key === key),
303
- [features]
422
+ (key) => allFeatures.find((feature) => feature.key === key),
423
+ [allFeatures]
304
424
  );
305
425
  const isFeatureEnabled = useCallback(
306
- (key) => enabledFeatures.some((feature) => feature.key === key),
307
- [enabledFeatures]
426
+ (key) => hasResolvedFeature(key),
427
+ [hasResolvedFeature]
308
428
  );
309
429
  const resolveNavRouteByPath = useCallback(
310
430
  (path) => resolveNavRoute(enabledFeatures, path, normalizedDisabledSubsectionPaths, isFeatureEnabled),
@@ -314,7 +434,9 @@ function ElevasisFeaturesProvider({
314
434
  () => ({
315
435
  navItems,
316
436
  enabledFeatures,
317
- allFeatures: features,
437
+ allFeatures,
438
+ organizationGraph,
439
+ organizationModel,
318
440
  timeRange,
319
441
  operationsApiUrl,
320
442
  operationsSSEManager,
@@ -326,7 +448,9 @@ function ElevasisFeaturesProvider({
326
448
  [
327
449
  navItems,
328
450
  enabledFeatures,
329
- features,
451
+ allFeatures,
452
+ organizationGraph,
453
+ organizationModel,
330
454
  timeRange,
331
455
  operationsApiUrl,
332
456
  operationsSSEManager,
@@ -1,5 +1,5 @@
1
1
  import { useCyberColors, CyberLegendItem, CyberAreaChart } from './chunk-KFICYU6S.js';
2
- import { useResourcesHealth } from './chunk-J5TBNCMD.js';
2
+ import { useResourcesHealth } from './chunk-2XWEOJSX.js';
3
3
  import { getTimeRangeDates, formatBucketTime } from './chunk-LXHZYSMQ.js';
4
4
  import { CardHeader, EmptyState } from './chunk-Y3D3WFJG.js';
5
5
  import { Paper, Center, Loader, Group } from '@mantine/core';
@@ -1,6 +1,6 @@
1
- import { PRESETS, getPreset, generateShades, mantineThemeOverride, createCssVariablesResolver, PresetsProvider } from './chunk-3WMJWXZY.js';
1
+ import { PRESETS, getPreset, generateShades, mantineThemeOverride, createCssVariablesResolver, PresetsProvider } from './chunk-47YILFON.js';
2
2
  import { AppBackground } from './chunk-CYXZHBP4.js';
3
- import { ElevasisCoreProvider } from './chunk-MZPVNRPL.js';
3
+ import { ElevasisCoreProvider } from './chunk-ISHNN42L.js';
4
4
  import { ElevasisLoader } from './chunk-Y3D3WFJG.js';
5
5
  import { AppearanceProvider } from './chunk-QJ2KCHKX.js';
6
6
  import { getErrorInfo, formatErrorMessage, getErrorTitle } from './chunk-IOKL7BKE.js';