@pablo2410/shared-ui 0.9.3 → 0.10.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/{HealthFooter-BP7S_iT-.d.ts → HealthFooter-wAa7a7WR.d.ts} +14 -1
- package/dist/chunk-3E3GLIQV.js +112 -0
- package/dist/chunk-3E3GLIQV.js.map +1 -0
- package/dist/{chunk-NXSFRNI7.js → chunk-3G43UG63.js} +1 -35
- package/dist/chunk-3G43UG63.js.map +1 -0
- package/dist/chunk-4QJMLQSH.js +28 -0
- package/dist/chunk-4QJMLQSH.js.map +1 -0
- package/dist/{chunk-QAQ4SQBH.js → chunk-HWXEAHLJ.js} +241 -190
- package/dist/chunk-HWXEAHLJ.js.map +1 -0
- package/dist/chunk-PLS7NDDR.js +162 -0
- package/dist/chunk-PLS7NDDR.js.map +1 -0
- package/dist/chunk-PS4K7FKB.js +37 -0
- package/dist/chunk-PS4K7FKB.js.map +1 -0
- package/dist/{chunk-4ATPOBMZ.js → chunk-ZLOUWBQN.js} +24 -4
- package/dist/chunk-ZLOUWBQN.js.map +1 -0
- package/dist/crossNav-Bd8-0qoi.d.ts +44 -0
- package/dist/hierarchy/core.d.ts +3 -89
- package/dist/hierarchy/core.js +6 -4
- package/dist/hierarchy/index.d.ts +58 -3
- package/dist/hierarchy/index.js +24 -6
- package/dist/layout/index.d.ts +5 -3
- package/dist/layout/index.js +8 -3
- package/dist/orgHierarchy-BLW4dt8Q.d.ts +90 -0
- package/dist/services/index.d.ts +35 -3
- package/dist/services/index.js +31 -116
- package/dist/services/index.js.map +1 -1
- package/dist/shell/index.d.ts +4 -2
- package/dist/shell/index.js +13 -4
- package/dist/shell/index.js.map +1 -1
- package/package.json +1 -1
- package/dist/chunk-4ATPOBMZ.js.map +0 -1
- package/dist/chunk-NXSFRNI7.js.map +0 -1
- package/dist/chunk-QAQ4SQBH.js.map +0 -1
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { O as OrgHierarchySelection } from './orgHierarchy-BLW4dt8Q.js';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* crossNav — build the sidebar cross-service links (service → service jump
|
|
5
|
+
* without going through the Portal Service Hub).
|
|
6
|
+
*
|
|
7
|
+
* Visibility mirrors the Portal ServiceHub rule: platform_admin and
|
|
8
|
+
* enterprise_admin see every live service; everyone else only sees the
|
|
9
|
+
* services granted in the portal `user_services` table. The current service
|
|
10
|
+
* never links to itself. Each link URL carries the caller's current
|
|
11
|
+
* org-hierarchy selection (?oh=…) so the breadcrumb arrives pre-aligned.
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/** Roles that see every live service regardless of individual grants. */
|
|
15
|
+
declare const ADMIN_SEE_ALL_ROLES: readonly ["platform_admin", "enterprise_admin"];
|
|
16
|
+
/**
|
|
17
|
+
* Legacy grant slugs → canonical catalog slugs. Auto-provisioned accounts
|
|
18
|
+
* were granted "sqdcp-logic" while the catalog slug is "sqdcp".
|
|
19
|
+
*/
|
|
20
|
+
declare const SLUG_ALIASES: Record<string, string>;
|
|
21
|
+
declare function normalizeServiceSlug(slug: string): string;
|
|
22
|
+
/** Display-ready cross-service link entry. */
|
|
23
|
+
interface CrossServiceLink {
|
|
24
|
+
slug: string;
|
|
25
|
+
name: string;
|
|
26
|
+
/** Lucide icon name from the service catalog (consumers resolve locally). */
|
|
27
|
+
icon: string;
|
|
28
|
+
accentColor: string;
|
|
29
|
+
/** Absolute URL including the ?oh= hierarchy selection param. */
|
|
30
|
+
url: string;
|
|
31
|
+
}
|
|
32
|
+
interface BuildCrossServiceLinksOptions {
|
|
33
|
+
/** Catalog slug of the service doing the rendering (excluded from links). */
|
|
34
|
+
currentSlug: string;
|
|
35
|
+
/** Grant slugs from the portal (raw — aliases are normalized here). */
|
|
36
|
+
grantedSlugs: string[];
|
|
37
|
+
/** Portal role of the current user (drives the admin see-all rule). */
|
|
38
|
+
role?: string | null;
|
|
39
|
+
/** Current org-hierarchy selection to carry across (may be empty/null). */
|
|
40
|
+
selection?: OrgHierarchySelection | null;
|
|
41
|
+
}
|
|
42
|
+
declare function buildCrossServiceLinks(options: BuildCrossServiceLinksOptions): CrossServiceLink[];
|
|
43
|
+
|
|
44
|
+
export { ADMIN_SEE_ALL_ROLES as A, type BuildCrossServiceLinksOptions as B, type CrossServiceLink as C, SLUG_ALIASES as S, buildCrossServiceLinks as b, normalizeServiceSlug as n };
|
package/dist/hierarchy/core.d.ts
CHANGED
|
@@ -1,91 +1,5 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
*
|
|
4
|
-
* Hierarchy: Enterprise > Business Unit > Site > Area > Asset
|
|
5
|
-
*
|
|
6
|
-
* Single source of truth for org-hierarchy types used by:
|
|
7
|
-
* - Portal (direct DB via tRPC)
|
|
8
|
-
* - All subdomains (via Portal Service API)
|
|
9
|
-
*
|
|
10
|
-
* The canonical data shape matches the Portal Service API response:
|
|
11
|
-
* GET /api/service/hierarchy
|
|
12
|
-
*/
|
|
13
|
-
interface OrgHierarchyNode {
|
|
14
|
-
id: number;
|
|
15
|
-
name: string;
|
|
16
|
-
code?: string;
|
|
17
|
-
}
|
|
18
|
-
interface OrgHierarchyEnterprise extends OrgHierarchyNode {
|
|
19
|
-
}
|
|
20
|
-
interface OrgHierarchyBusinessUnit extends OrgHierarchyNode {
|
|
21
|
-
enterpriseId: number;
|
|
22
|
-
}
|
|
23
|
-
interface OrgHierarchySite extends OrgHierarchyNode {
|
|
24
|
-
enterpriseId: number;
|
|
25
|
-
businessUnitId: number;
|
|
26
|
-
location?: string | null;
|
|
27
|
-
}
|
|
28
|
-
interface OrgHierarchyArea extends OrgHierarchyNode {
|
|
29
|
-
siteId: number;
|
|
30
|
-
}
|
|
31
|
-
interface OrgHierarchyAsset extends OrgHierarchyNode {
|
|
32
|
-
siteId: number;
|
|
33
|
-
areaId: number;
|
|
34
|
-
assetType?: string;
|
|
35
|
-
}
|
|
36
|
-
/**
|
|
37
|
-
* Canonical flat hierarchy payload.
|
|
38
|
-
* Every consumer (Portal tRPC, Service API REST) must return this shape.
|
|
39
|
-
*/
|
|
40
|
-
interface OrgHierarchyData {
|
|
41
|
-
enterprises: OrgHierarchyEnterprise[];
|
|
42
|
-
businessUnits: OrgHierarchyBusinessUnit[];
|
|
43
|
-
sites: OrgHierarchySite[];
|
|
44
|
-
areas: OrgHierarchyArea[];
|
|
45
|
-
assets: OrgHierarchyAsset[];
|
|
46
|
-
}
|
|
47
|
-
interface OrgHierarchySelection {
|
|
48
|
-
enterprise: OrgHierarchyNode | null;
|
|
49
|
-
businessUnit: OrgHierarchyNode | null;
|
|
50
|
-
site: OrgHierarchyNode | null;
|
|
51
|
-
area: OrgHierarchyNode | null;
|
|
52
|
-
asset: OrgHierarchyNode | null;
|
|
53
|
-
}
|
|
54
|
-
declare const ORG_HIERARCHY_EMPTY: OrgHierarchySelection;
|
|
55
|
-
/**
|
|
56
|
-
* An empty hierarchy payload. Use as the canonical "no data" value so every
|
|
57
|
-
* consumer returns the same shape (never null/undefined for a missing tree).
|
|
58
|
-
*/
|
|
59
|
-
declare const ORG_HIERARCHY_DATA_EMPTY: OrgHierarchyData;
|
|
60
|
-
interface OrgHierarchyContextValue {
|
|
61
|
-
/** Current selection at each level */
|
|
62
|
-
selection: OrgHierarchySelection;
|
|
63
|
-
/** Flat lists filtered by current selection */
|
|
64
|
-
enterprises: OrgHierarchyNode[];
|
|
65
|
-
businessUnits: OrgHierarchyNode[];
|
|
66
|
-
sites: OrgHierarchyNode[];
|
|
67
|
-
areas: OrgHierarchyNode[];
|
|
68
|
-
assets: OrgHierarchyNode[];
|
|
69
|
-
/** Setters — selecting a level clears all levels below it */
|
|
70
|
-
selectEnterprise: (node: OrgHierarchyNode | null) => void;
|
|
71
|
-
selectBusinessUnit: (node: OrgHierarchyNode | null) => void;
|
|
72
|
-
selectSite: (node: OrgHierarchyNode | null) => void;
|
|
73
|
-
selectArea: (node: OrgHierarchyNode | null) => void;
|
|
74
|
-
selectAsset: (node: OrgHierarchyNode | null) => void;
|
|
75
|
-
/** Whether the user can switch enterprises (platform_admin only) */
|
|
76
|
-
canSwitchEnterprise: boolean;
|
|
77
|
-
/** Loading state */
|
|
78
|
-
loading: boolean;
|
|
79
|
-
/** Breadcrumb trail as an array of { level, node } */
|
|
80
|
-
breadcrumbs: {
|
|
81
|
-
level: string;
|
|
82
|
-
node: OrgHierarchyNode;
|
|
83
|
-
}[];
|
|
84
|
-
}
|
|
85
|
-
declare const ORG_HIERARCHY_LEVELS: readonly ["enterprise", "businessUnit", "site", "area", "asset"];
|
|
86
|
-
type OrgHierarchyLevel = (typeof ORG_HIERARCHY_LEVELS)[number];
|
|
87
|
-
/** Human-readable labels for each level */
|
|
88
|
-
declare const ORG_HIERARCHY_LABELS: Record<OrgHierarchyLevel, string>;
|
|
1
|
+
import { a as OrgHierarchyData } from '../orgHierarchy-BLW4dt8Q.js';
|
|
2
|
+
export { c as ORG_HIERARCHY_DATA_EMPTY, d as ORG_HIERARCHY_EMPTY, e as ORG_HIERARCHY_LABELS, f as ORG_HIERARCHY_LEVELS, g as OrgHierarchyArea, h as OrgHierarchyAsset, i as OrgHierarchyBusinessUnit, b as OrgHierarchyContextValue, j as OrgHierarchyEnterprise, k as OrgHierarchyLevel, l as OrgHierarchyNode, O as OrgHierarchySelection, m as OrgHierarchySite } from '../orgHierarchy-BLW4dt8Q.js';
|
|
89
3
|
|
|
90
4
|
/**
|
|
91
5
|
* Enterprise Override — shared helper for platform_admin enterprise switching.
|
|
@@ -141,4 +55,4 @@ declare function applyEnterpriseOverride<T extends {
|
|
|
141
55
|
|
|
142
56
|
declare function scopeHierarchyToEnterprise(data: OrgHierarchyData | null, enterpriseId: number | null): OrgHierarchyData;
|
|
143
57
|
|
|
144
|
-
export { ACTIVE_ENTERPRISE_COOKIE,
|
|
58
|
+
export { ACTIVE_ENTERPRISE_COOKIE, OrgHierarchyData, applyEnterpriseOverride, scopeHierarchyToEnterprise };
|
package/dist/hierarchy/core.js
CHANGED
|
@@ -1,12 +1,14 @@
|
|
|
1
1
|
import {
|
|
2
2
|
ACTIVE_ENTERPRISE_COOKIE,
|
|
3
|
+
applyEnterpriseOverride,
|
|
4
|
+
scopeHierarchyToEnterprise
|
|
5
|
+
} from "../chunk-3G43UG63.js";
|
|
6
|
+
import {
|
|
3
7
|
ORG_HIERARCHY_DATA_EMPTY,
|
|
4
8
|
ORG_HIERARCHY_EMPTY,
|
|
5
9
|
ORG_HIERARCHY_LABELS,
|
|
6
|
-
ORG_HIERARCHY_LEVELS
|
|
7
|
-
|
|
8
|
-
scopeHierarchyToEnterprise
|
|
9
|
-
} from "../chunk-NXSFRNI7.js";
|
|
10
|
+
ORG_HIERARCHY_LEVELS
|
|
11
|
+
} from "../chunk-PS4K7FKB.js";
|
|
10
12
|
export {
|
|
11
13
|
ACTIVE_ENTERPRISE_COOKIE,
|
|
12
14
|
ORG_HIERARCHY_DATA_EMPTY,
|
|
@@ -1,8 +1,63 @@
|
|
|
1
|
-
import { OrgHierarchyData, OrgHierarchyContextValue } from '
|
|
2
|
-
export {
|
|
1
|
+
import { O as OrgHierarchySelection, a as OrgHierarchyData, b as OrgHierarchyContextValue } from '../orgHierarchy-BLW4dt8Q.js';
|
|
2
|
+
export { c as ORG_HIERARCHY_DATA_EMPTY, d as ORG_HIERARCHY_EMPTY, e as ORG_HIERARCHY_LABELS, f as ORG_HIERARCHY_LEVELS, g as OrgHierarchyArea, h as OrgHierarchyAsset, i as OrgHierarchyBusinessUnit, j as OrgHierarchyEnterprise, k as OrgHierarchyLevel, l as OrgHierarchyNode, m as OrgHierarchySite } from '../orgHierarchy-BLW4dt8Q.js';
|
|
3
|
+
export { ACTIVE_ENTERPRISE_COOKIE, applyEnterpriseOverride, scopeHierarchyToEnterprise } from './core.js';
|
|
3
4
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
5
|
import { ReactNode } from 'react';
|
|
5
6
|
|
|
7
|
+
/**
|
|
8
|
+
* selectionParams — serialize/deserialize the org-hierarchy selection through
|
|
9
|
+
* a URL query param so it can travel across subdomains (cross-service links).
|
|
10
|
+
*
|
|
11
|
+
* Format: ?oh=<entId>.<buId>.<siteId>.<areaId>.<assetId>, dot-joined ids
|
|
12
|
+
* top-down, truncated at the first unselected level (the cascade setters
|
|
13
|
+
* guarantee the selection is always a contiguous chain, so no gaps occur).
|
|
14
|
+
* e.g. ?oh=3.7.12 = enterprise 3 > business unit 7 > site 12.
|
|
15
|
+
*
|
|
16
|
+
* Node ids come from the Portal DB and are identical across every service,
|
|
17
|
+
* which is what makes this transport valid.
|
|
18
|
+
*/
|
|
19
|
+
|
|
20
|
+
/** Query-param key carrying the org-hierarchy selection between services. */
|
|
21
|
+
declare const ORG_HIERARCHY_PARAM = "oh";
|
|
22
|
+
/** Selection expressed as raw ids (what the URL param decodes to). */
|
|
23
|
+
interface OrgSelectionIds {
|
|
24
|
+
enterpriseId: number | null;
|
|
25
|
+
businessUnitId: number | null;
|
|
26
|
+
siteId: number | null;
|
|
27
|
+
areaId: number | null;
|
|
28
|
+
assetId: number | null;
|
|
29
|
+
}
|
|
30
|
+
/**
|
|
31
|
+
* Serialize a selection to the compact param value.
|
|
32
|
+
* Returns null when there is nothing meaningful to carry (no enterprise).
|
|
33
|
+
*/
|
|
34
|
+
declare function serializeSelectionParam(selection: OrgHierarchySelection): string | null;
|
|
35
|
+
/**
|
|
36
|
+
* Parse a param value back to ids. Returns null for anything malformed
|
|
37
|
+
* (empty, non-numeric, negative, or too many segments).
|
|
38
|
+
*/
|
|
39
|
+
declare function parseSelectionParam(value: string): OrgSelectionIds | null;
|
|
40
|
+
/**
|
|
41
|
+
* Append the selection param to an absolute URL (used when building
|
|
42
|
+
* cross-service links). Returns the URL unchanged when there is no selection
|
|
43
|
+
* or the URL is unparseable.
|
|
44
|
+
*/
|
|
45
|
+
declare function appendSelectionParam(url: string, selection: OrgHierarchySelection | null | undefined): string;
|
|
46
|
+
/** Read (without modifying) the selection param from the current location. */
|
|
47
|
+
declare function readSelectionParamFromLocation(): OrgSelectionIds | null;
|
|
48
|
+
/**
|
|
49
|
+
* Remove ONLY the selection param from the address bar (history.replaceState),
|
|
50
|
+
* preserving every other query param and the hash.
|
|
51
|
+
*/
|
|
52
|
+
declare function stripSelectionParamFromLocation(): void;
|
|
53
|
+
/**
|
|
54
|
+
* Resolve raw ids against the (already enterprise-scoped) hierarchy data,
|
|
55
|
+
* validating existence AND parent-child integrity level by level. Returns the
|
|
56
|
+
* deepest valid prefix as full nodes; an invalid enterprise yields the empty
|
|
57
|
+
* selection so callers fall back to their normal default behaviour.
|
|
58
|
+
*/
|
|
59
|
+
declare function resolveSelectionFromIds(ids: OrgSelectionIds, hierarchy: OrgHierarchyData): OrgHierarchySelection;
|
|
60
|
+
|
|
6
61
|
/**
|
|
7
62
|
* Read the Portal-set active-enterprise cookie on the client. This is the only
|
|
8
63
|
* signal a subdomain has that the platform admin switched enterprise; the value
|
|
@@ -69,4 +124,4 @@ interface HierarchyNavigatorProps {
|
|
|
69
124
|
}
|
|
70
125
|
declare function HierarchyNavigator({ hierarchy: ctx, compact, maxDepth, className, renderDropdown, }: HierarchyNavigatorProps): react_jsx_runtime.JSX.Element;
|
|
71
126
|
|
|
72
|
-
export { type CreateOrgHierarchyContextOptions, type DropdownRenderProps, HierarchyNavigator, type HierarchyNavigatorProps, OrgHierarchyContextValue, OrgHierarchyData, createOrgHierarchyContext, readActiveEnterpriseCookie };
|
|
127
|
+
export { type CreateOrgHierarchyContextOptions, type DropdownRenderProps, HierarchyNavigator, type HierarchyNavigatorProps, ORG_HIERARCHY_PARAM, OrgHierarchyContextValue, OrgHierarchyData, OrgHierarchySelection, type OrgSelectionIds, appendSelectionParam, createOrgHierarchyContext, parseSelectionParam, readActiveEnterpriseCookie, readSelectionParamFromLocation, resolveSelectionFromIds, serializeSelectionParam, stripSelectionParamFromLocation };
|
package/dist/hierarchy/index.js
CHANGED
|
@@ -2,16 +2,27 @@ import {
|
|
|
2
2
|
HierarchyNavigator,
|
|
3
3
|
createOrgHierarchyContext,
|
|
4
4
|
readActiveEnterpriseCookie
|
|
5
|
-
} from "../chunk-
|
|
5
|
+
} from "../chunk-ZLOUWBQN.js";
|
|
6
|
+
import {
|
|
7
|
+
ORG_HIERARCHY_PARAM,
|
|
8
|
+
appendSelectionParam,
|
|
9
|
+
parseSelectionParam,
|
|
10
|
+
readSelectionParamFromLocation,
|
|
11
|
+
resolveSelectionFromIds,
|
|
12
|
+
serializeSelectionParam,
|
|
13
|
+
stripSelectionParamFromLocation
|
|
14
|
+
} from "../chunk-3E3GLIQV.js";
|
|
6
15
|
import {
|
|
7
16
|
ACTIVE_ENTERPRISE_COOKIE,
|
|
17
|
+
applyEnterpriseOverride,
|
|
18
|
+
scopeHierarchyToEnterprise
|
|
19
|
+
} from "../chunk-3G43UG63.js";
|
|
20
|
+
import {
|
|
8
21
|
ORG_HIERARCHY_DATA_EMPTY,
|
|
9
22
|
ORG_HIERARCHY_EMPTY,
|
|
10
23
|
ORG_HIERARCHY_LABELS,
|
|
11
|
-
ORG_HIERARCHY_LEVELS
|
|
12
|
-
|
|
13
|
-
scopeHierarchyToEnterprise
|
|
14
|
-
} from "../chunk-NXSFRNI7.js";
|
|
24
|
+
ORG_HIERARCHY_LEVELS
|
|
25
|
+
} from "../chunk-PS4K7FKB.js";
|
|
15
26
|
import "../chunk-JT3XLKKD.js";
|
|
16
27
|
export {
|
|
17
28
|
ACTIVE_ENTERPRISE_COOKIE,
|
|
@@ -20,9 +31,16 @@ export {
|
|
|
20
31
|
ORG_HIERARCHY_EMPTY,
|
|
21
32
|
ORG_HIERARCHY_LABELS,
|
|
22
33
|
ORG_HIERARCHY_LEVELS,
|
|
34
|
+
ORG_HIERARCHY_PARAM,
|
|
35
|
+
appendSelectionParam,
|
|
23
36
|
applyEnterpriseOverride,
|
|
24
37
|
createOrgHierarchyContext,
|
|
38
|
+
parseSelectionParam,
|
|
25
39
|
readActiveEnterpriseCookie,
|
|
26
|
-
|
|
40
|
+
readSelectionParamFromLocation,
|
|
41
|
+
resolveSelectionFromIds,
|
|
42
|
+
scopeHierarchyToEnterprise,
|
|
43
|
+
serializeSelectionParam,
|
|
44
|
+
stripSelectionParamFromLocation
|
|
27
45
|
};
|
|
28
46
|
//# sourceMappingURL=index.js.map
|
package/dist/layout/index.d.ts
CHANGED
|
@@ -1,7 +1,9 @@
|
|
|
1
|
-
import { S as SharedSidebarConfig } from '../HealthFooter-
|
|
2
|
-
export { D as DashboardLayout, a as DashboardLayoutEnterprise, b as DashboardLayoutProps, c as DashboardLayoutUser, H as HealthFooter,
|
|
1
|
+
import { S as SharedSidebarConfig } from '../HealthFooter-wAa7a7WR.js';
|
|
2
|
+
export { C as CrossServiceNav, d as CrossServiceNavProps, D as DashboardLayout, a as DashboardLayoutEnterprise, b as DashboardLayoutProps, c as DashboardLayoutUser, H as HealthFooter, e as HealthFooterEnterprise, f as HealthFooterProps, g as HealthFooterUser, M as MenuItem, h as MenuSection, i as SharedSidebarProps, j as getInitials, k as isAdminRole, l as isMenuItemActive, u as useSidebarResize } from '../HealthFooter-wAa7a7WR.js';
|
|
3
3
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
4
4
|
import { ReactNode } from 'react';
|
|
5
|
+
import '../crossNav-Bd8-0qoi.js';
|
|
6
|
+
import '../orgHierarchy-BLW4dt8Q.js';
|
|
5
7
|
|
|
6
8
|
interface DashboardLayoutSkeletonProps {
|
|
7
9
|
className?: string;
|
|
@@ -53,7 +55,7 @@ interface FooterService {
|
|
|
53
55
|
slug: string;
|
|
54
56
|
/** Local route within the portal (e.g. /services/sqdcp) */
|
|
55
57
|
localRoute: string;
|
|
56
|
-
/** External URL for the subdomain (e.g. https://sqdcp.
|
|
58
|
+
/** External URL for the subdomain (e.g. https://sqdcp.oplyticsdigital.net) */
|
|
57
59
|
externalUrl?: string;
|
|
58
60
|
}
|
|
59
61
|
/** Standard Oplytics service list */
|
package/dist/layout/index.js
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import {
|
|
2
|
+
CrossServiceNav,
|
|
2
3
|
DashboardLayout,
|
|
3
4
|
DashboardLayoutSkeleton,
|
|
4
5
|
EnterpriseDebugLabel,
|
|
@@ -18,12 +19,16 @@ import {
|
|
|
18
19
|
policyDeploymentConfig,
|
|
19
20
|
sqdcpConfig,
|
|
20
21
|
useSidebarResize
|
|
21
|
-
} from "../chunk-
|
|
22
|
-
import "../chunk-
|
|
23
|
-
import "../chunk-
|
|
22
|
+
} from "../chunk-HWXEAHLJ.js";
|
|
23
|
+
import "../chunk-4QJMLQSH.js";
|
|
24
|
+
import "../chunk-ZLOUWBQN.js";
|
|
25
|
+
import "../chunk-3E3GLIQV.js";
|
|
26
|
+
import "../chunk-3G43UG63.js";
|
|
27
|
+
import "../chunk-PS4K7FKB.js";
|
|
24
28
|
import "../chunk-LTUYIBMA.js";
|
|
25
29
|
import "../chunk-JT3XLKKD.js";
|
|
26
30
|
export {
|
|
31
|
+
CrossServiceNav,
|
|
27
32
|
DashboardLayout,
|
|
28
33
|
DashboardLayoutSkeleton,
|
|
29
34
|
EnterpriseDebugLabel,
|
|
@@ -0,0 +1,90 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @oplytics/shared-ui/hierarchy — Org Hierarchy Types & Utilities
|
|
3
|
+
*
|
|
4
|
+
* Hierarchy: Enterprise > Business Unit > Site > Area > Asset
|
|
5
|
+
*
|
|
6
|
+
* Single source of truth for org-hierarchy types used by:
|
|
7
|
+
* - Portal (direct DB via tRPC)
|
|
8
|
+
* - All subdomains (via Portal Service API)
|
|
9
|
+
*
|
|
10
|
+
* The canonical data shape matches the Portal Service API response:
|
|
11
|
+
* GET /api/service/hierarchy
|
|
12
|
+
*/
|
|
13
|
+
interface OrgHierarchyNode {
|
|
14
|
+
id: number;
|
|
15
|
+
name: string;
|
|
16
|
+
code?: string;
|
|
17
|
+
}
|
|
18
|
+
interface OrgHierarchyEnterprise extends OrgHierarchyNode {
|
|
19
|
+
}
|
|
20
|
+
interface OrgHierarchyBusinessUnit extends OrgHierarchyNode {
|
|
21
|
+
enterpriseId: number;
|
|
22
|
+
}
|
|
23
|
+
interface OrgHierarchySite extends OrgHierarchyNode {
|
|
24
|
+
enterpriseId: number;
|
|
25
|
+
businessUnitId: number;
|
|
26
|
+
location?: string | null;
|
|
27
|
+
}
|
|
28
|
+
interface OrgHierarchyArea extends OrgHierarchyNode {
|
|
29
|
+
siteId: number;
|
|
30
|
+
}
|
|
31
|
+
interface OrgHierarchyAsset extends OrgHierarchyNode {
|
|
32
|
+
siteId: number;
|
|
33
|
+
areaId: number;
|
|
34
|
+
assetType?: string;
|
|
35
|
+
}
|
|
36
|
+
/**
|
|
37
|
+
* Canonical flat hierarchy payload.
|
|
38
|
+
* Every consumer (Portal tRPC, Service API REST) must return this shape.
|
|
39
|
+
*/
|
|
40
|
+
interface OrgHierarchyData {
|
|
41
|
+
enterprises: OrgHierarchyEnterprise[];
|
|
42
|
+
businessUnits: OrgHierarchyBusinessUnit[];
|
|
43
|
+
sites: OrgHierarchySite[];
|
|
44
|
+
areas: OrgHierarchyArea[];
|
|
45
|
+
assets: OrgHierarchyAsset[];
|
|
46
|
+
}
|
|
47
|
+
interface OrgHierarchySelection {
|
|
48
|
+
enterprise: OrgHierarchyNode | null;
|
|
49
|
+
businessUnit: OrgHierarchyNode | null;
|
|
50
|
+
site: OrgHierarchyNode | null;
|
|
51
|
+
area: OrgHierarchyNode | null;
|
|
52
|
+
asset: OrgHierarchyNode | null;
|
|
53
|
+
}
|
|
54
|
+
declare const ORG_HIERARCHY_EMPTY: OrgHierarchySelection;
|
|
55
|
+
/**
|
|
56
|
+
* An empty hierarchy payload. Use as the canonical "no data" value so every
|
|
57
|
+
* consumer returns the same shape (never null/undefined for a missing tree).
|
|
58
|
+
*/
|
|
59
|
+
declare const ORG_HIERARCHY_DATA_EMPTY: OrgHierarchyData;
|
|
60
|
+
interface OrgHierarchyContextValue {
|
|
61
|
+
/** Current selection at each level */
|
|
62
|
+
selection: OrgHierarchySelection;
|
|
63
|
+
/** Flat lists filtered by current selection */
|
|
64
|
+
enterprises: OrgHierarchyNode[];
|
|
65
|
+
businessUnits: OrgHierarchyNode[];
|
|
66
|
+
sites: OrgHierarchyNode[];
|
|
67
|
+
areas: OrgHierarchyNode[];
|
|
68
|
+
assets: OrgHierarchyNode[];
|
|
69
|
+
/** Setters — selecting a level clears all levels below it */
|
|
70
|
+
selectEnterprise: (node: OrgHierarchyNode | null) => void;
|
|
71
|
+
selectBusinessUnit: (node: OrgHierarchyNode | null) => void;
|
|
72
|
+
selectSite: (node: OrgHierarchyNode | null) => void;
|
|
73
|
+
selectArea: (node: OrgHierarchyNode | null) => void;
|
|
74
|
+
selectAsset: (node: OrgHierarchyNode | null) => void;
|
|
75
|
+
/** Whether the user can switch enterprises (platform_admin only) */
|
|
76
|
+
canSwitchEnterprise: boolean;
|
|
77
|
+
/** Loading state */
|
|
78
|
+
loading: boolean;
|
|
79
|
+
/** Breadcrumb trail as an array of { level, node } */
|
|
80
|
+
breadcrumbs: {
|
|
81
|
+
level: string;
|
|
82
|
+
node: OrgHierarchyNode;
|
|
83
|
+
}[];
|
|
84
|
+
}
|
|
85
|
+
declare const ORG_HIERARCHY_LEVELS: readonly ["enterprise", "businessUnit", "site", "area", "asset"];
|
|
86
|
+
type OrgHierarchyLevel = (typeof ORG_HIERARCHY_LEVELS)[number];
|
|
87
|
+
/** Human-readable labels for each level */
|
|
88
|
+
declare const ORG_HIERARCHY_LABELS: Record<OrgHierarchyLevel, string>;
|
|
89
|
+
|
|
90
|
+
export { type OrgHierarchySelection as O, type OrgHierarchyData as a, type OrgHierarchyContextValue as b, ORG_HIERARCHY_DATA_EMPTY as c, ORG_HIERARCHY_EMPTY as d, ORG_HIERARCHY_LABELS as e, ORG_HIERARCHY_LEVELS as f, type OrgHierarchyArea as g, type OrgHierarchyAsset as h, type OrgHierarchyBusinessUnit as i, type OrgHierarchyEnterprise as j, type OrgHierarchyLevel as k, type OrgHierarchyNode as l, type OrgHierarchySite as m };
|
package/dist/services/index.d.ts
CHANGED
|
@@ -1,3 +1,31 @@
|
|
|
1
|
+
export { A as ADMIN_SEE_ALL_ROLES, B as BuildCrossServiceLinksOptions, C as CrossServiceLink, S as SLUG_ALIASES, b as buildCrossServiceLinks, n as normalizeServiceSlug } from '../crossNav-Bd8-0qoi.js';
|
|
2
|
+
import '../orgHierarchy-BLW4dt8Q.js';
|
|
3
|
+
|
|
4
|
+
/**
|
|
5
|
+
* Platform domain resolution — single source of truth for building
|
|
6
|
+
* cross-service URLs (Service Hub cards, sidebar cross-nav, footers,
|
|
7
|
+
* "Back to Portal" links).
|
|
8
|
+
*
|
|
9
|
+
* Every service runs on a sibling subdomain of one parent domain
|
|
10
|
+
* (portal.oplyticsdigital.net, sqdcp.oplyticsdigital.net, …), so the parent
|
|
11
|
+
* domain is derived at runtime from the current hostname: strip the service
|
|
12
|
+
* label, keep the rest. Links therefore stay on whichever domain the app is
|
|
13
|
+
* served from — no per-app build args, and a future domain move needs no
|
|
14
|
+
* code change here.
|
|
15
|
+
*
|
|
16
|
+
* Outside a browser (SSR, tests) or on hosts with no parent domain
|
|
17
|
+
* (localhost, raw IPs) the canonical production domain is used.
|
|
18
|
+
*/
|
|
19
|
+
declare const DEFAULT_PLATFORM_DOMAIN = "oplyticsdigital.net";
|
|
20
|
+
declare function getPlatformDomain(): string;
|
|
21
|
+
/**
|
|
22
|
+
* Absolute https URL for a service subdomain label on the current platform
|
|
23
|
+
* domain, e.g. `platformUrl("sqdcp")` → `https://sqdcp.oplyticsdigital.net`.
|
|
24
|
+
*/
|
|
25
|
+
declare function platformUrl(subdomainLabel: string, path?: string): string;
|
|
26
|
+
/** Portal URL builder — the portal always lives at the `portal` label. */
|
|
27
|
+
declare function portalUrl(path?: string): string;
|
|
28
|
+
|
|
1
29
|
/**
|
|
2
30
|
* Shared Service Catalog — Single source of truth for all Oplytics.digital services.
|
|
3
31
|
*
|
|
@@ -28,8 +56,12 @@ interface ServiceDefinition {
|
|
|
28
56
|
status: ServiceStatus;
|
|
29
57
|
/** Core = standalone product, Hub = extension/add-on module */
|
|
30
58
|
category: ServiceCategory;
|
|
31
|
-
/**
|
|
32
|
-
|
|
59
|
+
/**
|
|
60
|
+
* Subdomain label on the platform domain (e.g. "sqdcp") — null if hosted
|
|
61
|
+
* on portal. Full URLs are built via getServiceUrl(), which resolves the
|
|
62
|
+
* platform domain at runtime (see ./platformDomain).
|
|
63
|
+
*/
|
|
64
|
+
subdomainLabel: string | null;
|
|
33
65
|
}
|
|
34
66
|
declare const SERVICE_CATALOG: ServiceDefinition[];
|
|
35
67
|
declare const coreServices: ServiceDefinition[];
|
|
@@ -40,4 +72,4 @@ declare const comingSoonServices: ServiceDefinition[];
|
|
|
40
72
|
declare function getServiceBySlug(slug: string): ServiceDefinition | undefined;
|
|
41
73
|
declare function getServiceUrl(service: ServiceDefinition): string | null;
|
|
42
74
|
|
|
43
|
-
export { SERVICE_CATALOG, type ServiceCategory, type ServiceDefinition, type ServiceStatus, comingSoonServices, coreServices, getServiceBySlug, getServiceUrl, hubServices, inDevServices, liveServices };
|
|
75
|
+
export { DEFAULT_PLATFORM_DOMAIN, SERVICE_CATALOG, type ServiceCategory, type ServiceDefinition, type ServiceStatus, comingSoonServices, coreServices, getPlatformDomain, getServiceBySlug, getServiceUrl, hubServices, inDevServices, liveServices, platformUrl, portalUrl };
|
package/dist/services/index.js
CHANGED
|
@@ -1,126 +1,41 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
category: "core",
|
|
24
|
-
subdomain: "sqdcp.oplytics.digital"
|
|
25
|
-
},
|
|
26
|
-
{
|
|
27
|
-
slug: "oee-manager",
|
|
28
|
-
name: "OEE Manager",
|
|
29
|
-
tagline: "Real-time equipment effectiveness tracking",
|
|
30
|
-
description: "Monitor Overall Equipment Effectiveness in real-time. Track availability, performance, and quality metrics across your entire production line.",
|
|
31
|
-
icon: "Gauge",
|
|
32
|
-
accentColor: "#8C34E9",
|
|
33
|
-
status: "live",
|
|
34
|
-
category: "core",
|
|
35
|
-
subdomain: "oeemanager.oplytics.digital"
|
|
36
|
-
},
|
|
37
|
-
{
|
|
38
|
-
slug: "action-manager",
|
|
39
|
-
name: "Action Manager",
|
|
40
|
-
tagline: "Track every action to closure",
|
|
41
|
-
description: "Capture, assign, and track corrective and preventive actions from any source. Ensure nothing falls through the cracks.",
|
|
42
|
-
icon: "ClipboardCheck",
|
|
43
|
-
accentColor: "#22C55E",
|
|
44
|
-
status: "live",
|
|
45
|
-
category: "core",
|
|
46
|
-
subdomain: "actionmanager.oplytics.digital"
|
|
47
|
-
},
|
|
48
|
-
{
|
|
49
|
-
slug: "connect",
|
|
50
|
-
name: "OplyticsConnect",
|
|
51
|
-
tagline: "Integrate machines, sensors, and systems",
|
|
52
|
-
description: "Industrial IoT connectivity layer. Connect PLCs, sensors, and legacy systems to the Oplytics platform with zero-code configuration.",
|
|
53
|
-
icon: "Plug",
|
|
54
|
-
accentColor: "#1DB8CE",
|
|
55
|
-
status: "in-development",
|
|
56
|
-
category: "core",
|
|
57
|
-
subdomain: "connect.oplytics.digital"
|
|
58
|
-
},
|
|
59
|
-
// ─── HUB SERVICES ───
|
|
60
|
-
{
|
|
61
|
-
slug: "safety-manager",
|
|
62
|
-
name: "Safety Manager",
|
|
63
|
-
tagline: "Proactive safety culture, powered by data",
|
|
64
|
-
description: "Incident reporting, hazard tracking, safety observations, and compliance management in one unified platform.",
|
|
65
|
-
icon: "Shield",
|
|
66
|
-
accentColor: "#EF4444",
|
|
67
|
-
status: "coming-soon",
|
|
68
|
-
category: "hub",
|
|
69
|
-
subdomain: "safetymanager.oplytics.digital"
|
|
70
|
-
},
|
|
71
|
-
{
|
|
72
|
-
slug: "quality-manager",
|
|
73
|
-
name: "Quality Manager",
|
|
74
|
-
tagline: "End-to-end quality assurance",
|
|
75
|
-
description: "Non-conformance tracking, CAPA management, audit scheduling, and quality metrics dashboards.",
|
|
76
|
-
icon: "CheckCircle",
|
|
77
|
-
accentColor: "#22C55E",
|
|
78
|
-
status: "coming-soon",
|
|
79
|
-
category: "hub",
|
|
80
|
-
subdomain: null
|
|
81
|
-
},
|
|
82
|
-
{
|
|
83
|
-
slug: "certification-manager",
|
|
84
|
-
name: "Certification Manager",
|
|
85
|
-
tagline: "Stay audit-ready, always",
|
|
86
|
-
description: "Manage ISO, IATF, and other certification requirements. Document control, audit trails, and compliance tracking.",
|
|
87
|
-
icon: "Award",
|
|
88
|
-
accentColor: "#F97316",
|
|
89
|
-
status: "coming-soon",
|
|
90
|
-
category: "hub",
|
|
91
|
-
subdomain: null
|
|
92
|
-
}
|
|
93
|
-
];
|
|
94
|
-
var coreServices = SERVICE_CATALOG.filter(
|
|
95
|
-
(s) => s.category === "core"
|
|
96
|
-
);
|
|
97
|
-
var hubServices = SERVICE_CATALOG.filter((s) => s.category === "hub");
|
|
98
|
-
var liveServices = SERVICE_CATALOG.filter(
|
|
99
|
-
(s) => s.status === "live"
|
|
100
|
-
);
|
|
101
|
-
var inDevServices = SERVICE_CATALOG.filter(
|
|
102
|
-
(s) => s.status === "in-development"
|
|
103
|
-
);
|
|
104
|
-
var comingSoonServices = SERVICE_CATALOG.filter(
|
|
105
|
-
(s) => s.status === "coming-soon"
|
|
106
|
-
);
|
|
107
|
-
function getServiceBySlug(slug) {
|
|
108
|
-
return SERVICE_CATALOG.find((s) => s.slug === slug);
|
|
109
|
-
}
|
|
110
|
-
function getServiceUrl(service) {
|
|
111
|
-
if (service.subdomain) {
|
|
112
|
-
return `https://${service.subdomain}`;
|
|
113
|
-
}
|
|
114
|
-
return null;
|
|
115
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
ADMIN_SEE_ALL_ROLES,
|
|
3
|
+
SERVICE_CATALOG,
|
|
4
|
+
SLUG_ALIASES,
|
|
5
|
+
buildCrossServiceLinks,
|
|
6
|
+
comingSoonServices,
|
|
7
|
+
coreServices,
|
|
8
|
+
getServiceBySlug,
|
|
9
|
+
getServiceUrl,
|
|
10
|
+
hubServices,
|
|
11
|
+
inDevServices,
|
|
12
|
+
liveServices,
|
|
13
|
+
normalizeServiceSlug
|
|
14
|
+
} from "../chunk-PLS7NDDR.js";
|
|
15
|
+
import {
|
|
16
|
+
DEFAULT_PLATFORM_DOMAIN,
|
|
17
|
+
getPlatformDomain,
|
|
18
|
+
platformUrl,
|
|
19
|
+
portalUrl
|
|
20
|
+
} from "../chunk-4QJMLQSH.js";
|
|
21
|
+
import "../chunk-3E3GLIQV.js";
|
|
22
|
+
import "../chunk-PS4K7FKB.js";
|
|
116
23
|
export {
|
|
24
|
+
ADMIN_SEE_ALL_ROLES,
|
|
25
|
+
DEFAULT_PLATFORM_DOMAIN,
|
|
117
26
|
SERVICE_CATALOG,
|
|
27
|
+
SLUG_ALIASES,
|
|
28
|
+
buildCrossServiceLinks,
|
|
118
29
|
comingSoonServices,
|
|
119
30
|
coreServices,
|
|
31
|
+
getPlatformDomain,
|
|
120
32
|
getServiceBySlug,
|
|
121
33
|
getServiceUrl,
|
|
122
34
|
hubServices,
|
|
123
35
|
inDevServices,
|
|
124
|
-
liveServices
|
|
36
|
+
liveServices,
|
|
37
|
+
normalizeServiceSlug,
|
|
38
|
+
platformUrl,
|
|
39
|
+
portalUrl
|
|
125
40
|
};
|
|
126
41
|
//# sourceMappingURL=index.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":[
|
|
1
|
+
{"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
|