@pablo2410/shared-ui 0.24.0 → 0.25.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1 +1 @@
1
- {"version":3,"sources":["../../src/tour/TourShell.tsx","../../src/tour/useSpotlight.ts","../../src/tour/spotlightMath.ts","../../src/tour/useTour.ts","../../src/tour/tourMachine.ts"],"sourcesContent":["/**\n * TourShell — the Opi onboarding tour overlay chrome.\n *\n * Deliberately shell-only, same split as OpiInsightsShell: this owns the\n * overlay, orb, narration area, step dots, and Back/Next/Skip controls.\n * The consumer (Portal) owns the step list, narration fetching (falling\n * back to the step's scripted text), and persistence. Hand-rolled overlay\n * (no Radix Dialog) to stay dependency-free, matching OpiInsightsShell's\n * own precedent rather than pulling in /primitives.\n *\n * Two render modes, chosen automatically per step:\n * - Centered modal (original, unchanged) — used for intro/outro steps, any\n * \"service\" step authored without `step.spotlight`, and as the fallback\n * when a spotlight target can't be resolved on the page at all.\n * - Spotlight — used when `step.spotlight` is present AND useSpotlight\n * resolves a real element for it. The backdrop is drawn as four\n * rectangles framing the target (never a single element covering it),\n * so the real page element underneath stays exactly as clickable,\n * hoverable, and focusable as it already was — no coordination needed\n * with whatever onClick the consumer's own element already has. See\n * spotlightMath.ts for the geometry and useSpotlight.ts for the DOM\n * measurement this mode is built on.\n */\nimport { useEffect, useRef, type ReactNode } from \"react\";\nimport {\n X,\n ChevronLeft,\n ChevronRight,\n ArrowRight,\n ExternalLink,\n} from \"lucide-react\";\nimport type { TourStep } from \"./types\";\nimport { useSpotlight } from \"./useSpotlight\";\nimport { computeSpotlightFrame, computePanelPosition } from \"./spotlightMath\";\n\nexport interface TourShellSkin {\n accent: string;\n overlayBg: string;\n panelBg: string;\n panelBorder: string;\n mutedText: string;\n bodyText: string;\n softText: string;\n}\n\nconst defaultSkin: TourShellSkin = {\n accent: \"#8C34E9\",\n overlayBg: \"rgba(10,14,26,0.72)\",\n panelBg: \"#0e1624\",\n panelBorder: \"1px solid #1e2738\",\n mutedText: \"#596475\",\n bodyText: \"#c0c6d0\",\n softText: \"#8890a0\",\n};\n\n/** Panel size assumed for spotlight placement math — the spotlight panel is\n * narrower/shorter than the centered modal's max-w-md, since it sits next\n * to a card rather than owning the whole screen. Kept as a constant (not\n * measured live via ref) because spotlightMath needs a size up front to\n * compute placement before the panel has painted — the panel's own CSS\n * width/height below must match this or the two drift apart. */\nconst SPOTLIGHT_PANEL_SIZE = { width: 320, height: 280 };\n\nexport interface TourShellProps {\n step: TourStep;\n index: number;\n total: number;\n isFirst: boolean;\n isLast: boolean;\n onNext: () => void;\n onBack: () => void;\n onDismiss: () => void;\n /** Narration to render — pass the live AI reply once resolved; while\n * pending or on failure, pass `step.fallbackText` so the tour never\n * shows a blank state. */\n narration: string;\n /** True while an AI narration pass is in flight — shows a subtle pulse, never blocks Next. */\n narrationPending?: boolean;\n /** Rendered below the narration/highlights — e.g. a docked OpiAskBar. */\n children?: ReactNode;\n skin?: TourShellSkin;\n /** Orb / avatar mark shown in the header — pass OpiOrb from the consumer. */\n orb?: ReactNode;\n /**\n * Fires when the user activates the spotlighted element itself (a\n * document-level capture-phase listener scoped to the resolved target —\n * see useSpotlight.ts), alongside — never instead of — whatever the\n * consumer's own element does on click. Only meaningful when the current\n * step has `spotlight` and a target was found; ignored otherwise. Opt-in\n * per step via the consumer wiring it up, not a built-in auto-advance —\n * a later in-app spotlight (inside a subdomain) may want \"just look\n * here,\" no navigation expected.\n */\n onSpotlightTargetActivated?: () => void;\n}\n\n/**\n * Full-viewport dismissible overlay. Esc always dismisses. In centered\n * mode, clicking the backdrop dismisses too; in spotlight mode, each of the\n * four backdrop segments independently dismisses on click, same behavior,\n * just split across four elements instead of one.\n */\nexport function TourShell({\n step,\n index,\n total,\n isFirst,\n isLast,\n onNext,\n onBack,\n onDismiss,\n narration,\n narrationPending,\n children,\n skin = defaultSkin,\n orb,\n onSpotlightTargetActivated,\n}: TourShellProps) {\n const panelRef = useRef<HTMLDivElement>(null);\n const { rect, found } = useSpotlight(step.spotlight?.selector ?? null);\n const isSpotlight = Boolean(step.spotlight) && found && rect !== null;\n\n useEffect(() => {\n const onKeyDown = (e: KeyboardEvent) => {\n if (e.key === \"Escape\") onDismiss();\n };\n document.addEventListener(\"keydown\", onKeyDown);\n return () => document.removeEventListener(\"keydown\", onKeyDown);\n }, [onDismiss]);\n\n useEffect(() => {\n panelRef.current?.focus();\n }, [step.id]);\n\n // Document-level capture listener for onSpotlightTargetActivated — fires\n // alongside the target's own click handling (never stopPropagation'd),\n // so it never fights whatever onClick the consumer's element already has.\n useEffect(() => {\n if (!isSpotlight || !onSpotlightTargetActivated || !step.spotlight) return;\n const selector = step.spotlight.selector;\n const onClickCapture = (e: MouseEvent) => {\n const target = e.target as Element | null;\n if (target?.closest(`[data-tour-target=\"${selector}\"]`)) {\n onSpotlightTargetActivated();\n }\n };\n document.addEventListener(\"click\", onClickCapture, { capture: true });\n return () =>\n document.removeEventListener(\"click\", onClickCapture, {\n capture: true,\n });\n }, [isSpotlight, onSpotlightTargetActivated, step.spotlight]);\n\n if (isSpotlight && rect) {\n const viewport = { width: window.innerWidth, height: window.innerHeight };\n const frame = computeSpotlightFrame(rect, viewport);\n const panelPos = computePanelPosition(\n rect,\n SPOTLIGHT_PANEL_SIZE,\n viewport,\n step.spotlight?.placement ?? \"auto\"\n );\n\n return (\n <>\n {([\"top\", \"bottom\", \"left\", \"right\"] as const).map(side => {\n const segment = frame[side];\n if (segment.width <= 0 || segment.height <= 0) return null;\n return (\n <div\n key={side}\n className=\"fixed z-50\"\n style={{\n top: segment.top,\n left: segment.left,\n width: segment.width,\n height: segment.height,\n background: skin.overlayBg,\n }}\n onClick={onDismiss}\n />\n );\n })}\n {/* Ring around the target — never covers it, pointer-events none so\n it can't intercept the click meant for the real element. */}\n <div\n className=\"fixed z-50 rounded-xl pointer-events-none transition-all\"\n style={{\n top: rect.top - 4,\n left: rect.left - 4,\n width: rect.width + 8,\n height: rect.height + 8,\n boxShadow: `0 0 0 2px ${skin.accent}, 0 0 24px 4px ${skin.accent}66`,\n }}\n />\n <div\n ref={panelRef}\n tabIndex={-1}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={step.label}\n className=\"fixed z-50 rounded-xl overflow-hidden flex flex-col outline-none\"\n style={{\n top: panelPos.top,\n left: panelPos.left,\n width: SPOTLIGHT_PANEL_SIZE.width,\n maxHeight: SPOTLIGHT_PANEL_SIZE.height,\n background: skin.panelBg,\n border: skin.panelBorder,\n }}\n >\n <TourShellHeader step={step} orb={orb} onDismiss={onDismiss} />\n <TourShellStepDots total={total} index={index} skin={skin} />\n <div className=\"overflow-y-auto px-4 py-3 space-y-3\">\n <TourShellBody\n step={step}\n narration={narration}\n narrationPending={narrationPending}\n skin={skin}\n children={children}\n />\n </div>\n <TourShellFooter\n isFirst={isFirst}\n isLast={isLast}\n onNext={onNext}\n onBack={onBack}\n onDismiss={onDismiss}\n skin={skin}\n />\n </div>\n </>\n );\n }\n\n return (\n <div\n className=\"fixed inset-0 z-50 flex items-center justify-center p-4\"\n style={{ background: skin.overlayBg }}\n onClick={e => {\n if (e.target === e.currentTarget) onDismiss();\n }}\n >\n <div\n ref={panelRef}\n tabIndex={-1}\n role=\"dialog\"\n aria-modal=\"true\"\n aria-label={step.label}\n className=\"w-full max-w-md rounded-xl overflow-hidden flex flex-col max-h-[85vh] outline-none\"\n style={{ background: skin.panelBg, border: skin.panelBorder }}\n >\n <TourShellHeader step={step} orb={orb} onDismiss={onDismiss} />\n <TourShellStepDots total={total} index={index} skin={skin} />\n <div className=\"overflow-y-auto px-5 py-4 space-y-4\">\n <TourShellBody\n step={step}\n narration={narration}\n narrationPending={narrationPending}\n skin={skin}\n children={children}\n />\n </div>\n <TourShellFooter\n isFirst={isFirst}\n isLast={isLast}\n onNext={onNext}\n onBack={onBack}\n onDismiss={onDismiss}\n skin={skin}\n />\n </div>\n </div>\n );\n}\n\nfunction TourShellHeader({\n step,\n orb,\n onDismiss,\n}: {\n step: TourStep;\n orb: ReactNode;\n onDismiss: () => void;\n}) {\n return (\n <div\n className=\"flex items-center justify-between gap-3 px-5 py-4 shrink-0\"\n style={{\n background: \"linear-gradient(135deg, #2a1450 0%, #1a0e33 100%)\",\n }}\n >\n <div className=\"flex items-center gap-2.5 min-w-0\">\n {orb}\n <span className=\"text-sm font-bold text-white truncate\">\n {step.label}\n </span>\n </div>\n <button\n onClick={onDismiss}\n className=\"p-1 rounded hover:bg-white/10 transition-colors shrink-0\"\n title=\"Skip tour\"\n >\n <X size={16} className=\"text-white/70\" />\n </button>\n </div>\n );\n}\n\nfunction TourShellStepDots({\n total,\n index,\n skin,\n}: {\n total: number;\n index: number;\n skin: TourShellSkin;\n}) {\n return (\n <div\n className=\"flex items-center gap-1.5 px-5 py-3 shrink-0\"\n style={{ borderBottom: skin.panelBorder }}\n >\n {Array.from({ length: total }, (_, i) => (\n <span\n key={i}\n className=\"h-1.5 rounded-full transition-all\"\n style={{\n width: i === index ? 20 : 8,\n background: i === index ? skin.accent : skin.mutedText,\n opacity: i === index ? 1 : 0.4,\n }}\n />\n ))}\n </div>\n );\n}\n\nfunction TourShellBody({\n step,\n narration,\n narrationPending,\n skin,\n children,\n}: {\n step: TourStep;\n narration: string;\n narrationPending?: boolean;\n skin: TourShellSkin;\n children?: ReactNode;\n}) {\n return (\n <>\n <p\n className=\"text-[13px] leading-relaxed transition-opacity\"\n style={{\n color: skin.bodyText,\n opacity: narrationPending ? 0.7 : 1,\n }}\n >\n {narration}\n </p>\n\n {step.features && step.features.length > 0 ? (\n <ul className=\"space-y-2\">\n {step.features.map((f, i) => (\n <li key={i} className=\"text-[12.5px] leading-relaxed\">\n <span className=\"font-semibold\" style={{ color: skin.accent }}>\n {f.name}\n </span>\n <span style={{ color: skin.softText }}> — {f.detail}</span>\n </li>\n ))}\n </ul>\n ) : (\n step.highlights &&\n step.highlights.length > 0 && (\n <ul className=\"space-y-1.5\">\n {step.highlights.map((h, i) => (\n <li\n key={i}\n className=\"text-[12.5px] leading-relaxed pl-3 relative\"\n style={{ color: skin.softText }}\n >\n <span\n className=\"absolute left-0\"\n style={{ color: skin.mutedText }}\n >\n •\n </span>\n {h}\n </li>\n ))}\n </ul>\n )\n )}\n\n {step.action && (\n <a\n href={step.action.href}\n target={step.action.external ? \"_blank\" : undefined}\n rel={step.action.external ? \"noopener noreferrer\" : undefined}\n className=\"inline-flex items-center gap-1.5 px-3.5 py-2 rounded-lg text-[13px] font-semibold transition-opacity hover:opacity-90\"\n style={{ background: `${skin.accent}20`, color: skin.accent }}\n >\n {step.action.label}\n {step.action.external ? (\n <ExternalLink size={13} />\n ) : (\n <ArrowRight size={13} />\n )}\n </a>\n )}\n\n {children}\n </>\n );\n}\n\nfunction TourShellFooter({\n isFirst,\n isLast,\n onNext,\n onBack,\n onDismiss,\n skin,\n}: {\n isFirst: boolean;\n isLast: boolean;\n onNext: () => void;\n onBack: () => void;\n onDismiss: () => void;\n skin: TourShellSkin;\n}) {\n return (\n <div\n className=\"flex items-center justify-between gap-2 px-5 py-3.5 shrink-0\"\n style={{ borderTop: skin.panelBorder }}\n >\n <button\n onClick={onDismiss}\n className=\"text-[12px] font-medium transition-colors hover:underline\"\n style={{ color: skin.mutedText }}\n >\n Skip tour\n </button>\n <div className=\"flex items-center gap-2\">\n {!isFirst && (\n <button\n onClick={onBack}\n className=\"flex items-center gap-1 px-3 py-1.5 rounded-md text-[12.5px] font-medium transition-colors\"\n style={{ color: skin.bodyText, border: skin.panelBorder }}\n >\n <ChevronLeft size={13} />\n Back\n </button>\n )}\n <button\n onClick={onNext}\n className=\"flex items-center gap-1 px-3.5 py-1.5 rounded-md text-[12.5px] font-bold text-white transition-opacity hover:opacity-90\"\n style={{\n background: \"linear-gradient(135deg, #8C34E9 0%, #5B1FA6 100%)\",\n }}\n >\n {isLast ? \"Done\" : \"Next\"}\n {!isLast && <ChevronRight size={13} />}\n </button>\n </div>\n </div>\n );\n}\n","/**\n * useSpotlight — resolves a `data-tour-target` element and keeps its\n * measured rect fresh across resize/scroll/layout-shift, for TourShell's\n * spotlight render path.\n *\n * This is the DOM-touching half of the spotlight primitive; the actual\n * placement geometry is pure functions in spotlightMath.ts. This package has\n * no jsdom/@testing-library/react (see tourMachine.ts's own note on the same\n * gap), so this hook's correctness is exercised for real once a consumer\n * wires it up against real markup — see the R1 plan's step 3 manual-\n * verification checkpoint, not a unit test here.\n */\nimport { useEffect, useRef, useState } from \"react\";\nimport type { Rect } from \"./spotlightMath\";\n\nexport interface UseSpotlightResult {\n /** The target's current viewport-relative rect, or null while unresolved. */\n rect: Rect | null;\n /** False if no element in the DOM currently carries this selector —\n * callers must fall back to the non-spotlight rendering path, never\n * throw or render a spotlight around nothing. */\n found: boolean;\n}\n\nconst RESIZE_DEBOUNCE_MS = 100;\n\n/**\n * @param selector The `data-tour-target` attribute value to look for\n * (e.g. \"service-card-policy-deployment\"). Pass `null` to disable\n * resolution entirely (e.g. the current step has no spotlight).\n */\nexport function useSpotlight(selector: string | null): UseSpotlightResult {\n const [rect, setRect] = useState<Rect | null>(null);\n const [found, setFound] = useState(false);\n // Guards the one-time scroll-into-view per selector, per useSpotlight's own\n // doc comment: re-measuring on resize/scroll must never re-trigger a scroll.\n const scrolledForSelector = useRef<string | null>(null);\n\n useEffect(() => {\n if (!selector) {\n setRect(null);\n setFound(false);\n return;\n }\n\n let resizeTimer: ReturnType<typeof setTimeout> | undefined;\n let cancelled = false;\n\n const measure = () => {\n if (cancelled) return;\n const el = document.querySelector<HTMLElement>(\n `[data-tour-target=\"${selector}\"]`\n );\n if (!el) {\n setRect(null);\n setFound(false);\n return;\n }\n const domRect = el.getBoundingClientRect();\n setRect({\n top: domRect.top,\n left: domRect.left,\n width: domRect.width,\n height: domRect.height,\n });\n setFound(true);\n\n if (scrolledForSelector.current !== selector) {\n scrolledForSelector.current = selector;\n el.scrollIntoView({ block: \"center\", behavior: \"smooth\" });\n }\n };\n\n // Initial measure. A freshly-mounted target may not have painted yet on\n // the very first tick (e.g. right after the tour opens) — one microtask\n // deferral covers that without a fixed arbitrary delay.\n measure();\n const initialFrame = requestAnimationFrame(measure);\n\n const onResize = () => {\n if (resizeTimer) clearTimeout(resizeTimer);\n resizeTimer = setTimeout(measure, RESIZE_DEBOUNCE_MS);\n };\n // Capture phase: catches scroll on any ancestor scroll container, not\n // just document-level scroll (document-level is what ServiceHub.tsx\n // actually uses today, per the R1 plan's grounding, but capture-phase\n // costs nothing extra and keeps this hook correct if that changes).\n const onScroll = () => measure();\n\n window.addEventListener(\"resize\", onResize);\n window.addEventListener(\"scroll\", onScroll, { capture: true });\n\n // Layout shifts with no resize/scroll event — e.g. a conditionally\n // rendered sibling card appearing above the target, or the target\n // itself not existing yet at mount (e.g. the tour opened before\n // ServiceHub's card grid finished loading its services query) and\n // appearing moments later. Observing document.body rather than the\n // target's own (possibly not-yet-existent) parent means both cases are\n // covered by the same subscription with no race between \"did the\n // target exist when we looked\" and \"attach the observer\" — `measure`\n // itself is what re-checks `found` on every mutation, so a target that\n // doesn't exist yet is simply re-resolved the moment it does.\n const observer = new MutationObserver(measure);\n observer.observe(document.body, {\n childList: true,\n subtree: true,\n attributes: true,\n });\n\n return () => {\n cancelled = true;\n cancelAnimationFrame(initialFrame);\n if (resizeTimer) clearTimeout(resizeTimer);\n window.removeEventListener(\"resize\", onResize);\n window.removeEventListener(\"scroll\", onScroll, { capture: true });\n observer?.disconnect();\n };\n }, [selector]);\n\n return { rect, found };\n}\n","/**\n * Pure geometry behind the spotlight rendering mode — no React, no DOM\n * access, just numbers in and numbers out. Factored out so it's testable\n * without jsdom (this package has none — see tourMachine.ts for the same\n * split/precedent on the step-index state machine).\n *\n * TourShell is the consumer: given a target element's measured rect (from\n * useSpotlight.ts) and the current viewport size, it needs to know (a) the\n * four backdrop-frame rectangles that surround the target without ever\n * covering it, and (b) where to place the explanation panel so it doesn't\n * overflow the viewport, honoring a preferred placement when there's room.\n */\n\nexport interface Rect {\n top: number;\n left: number;\n width: number;\n height: number;\n}\n\nexport interface Size {\n width: number;\n height: number;\n}\n\nexport type Placement = \"top\" | \"bottom\" | \"left\" | \"right\" | \"auto\";\n\n/** The four backdrop segments that frame a target rect without covering it.\n * Each is a plain rect in viewport (fixed-position) coordinates. A segment\n * with zero width or height (e.g. the target touches a viewport edge) is\n * still returned — the caller can skip rendering a degenerate rect, but\n * the geometry itself doesn't special-case it. */\nexport interface SpotlightFrame {\n top: Rect;\n bottom: Rect;\n left: Rect;\n right: Rect;\n}\n\n/** Frames `target` within a `viewport` sized 0,0 to width,height. */\nexport function computeSpotlightFrame(\n target: Rect,\n viewport: Size\n): SpotlightFrame {\n const targetBottom = target.top + target.height;\n const targetRight = target.left + target.width;\n\n return {\n // Full-width strip above the target.\n top: {\n top: 0,\n left: 0,\n width: viewport.width,\n height: Math.max(0, target.top),\n },\n // Full-width strip below the target.\n bottom: {\n top: targetBottom,\n left: 0,\n width: viewport.width,\n height: Math.max(0, viewport.height - targetBottom),\n },\n // Strip to the left of the target, spanning only the target's own row\n // (the top/bottom strips already cover the rest of those rows).\n left: {\n top: target.top,\n left: 0,\n width: Math.max(0, target.left),\n height: target.height,\n },\n // Strip to the right of the target, same row-only span as `left`.\n right: {\n top: target.top,\n left: targetRight,\n width: Math.max(0, viewport.width - targetRight),\n height: target.height,\n },\n };\n}\n\ntype ConcretePlacement = Exclude<Placement, \"auto\">;\n\nconst FALLBACK_ORDER: Record<ConcretePlacement, ConcretePlacement[]> = {\n bottom: [\"bottom\", \"top\", \"right\", \"left\"],\n top: [\"top\", \"bottom\", \"right\", \"left\"],\n right: [\"right\", \"left\", \"bottom\", \"top\"],\n left: [\"left\", \"right\", \"bottom\", \"top\"],\n};\n// \"auto\" tries the same order as the default \"bottom\" preference.\nconst AUTO_ORDER: ConcretePlacement[] = FALLBACK_ORDER.bottom;\n\nconst PANEL_GAP = 12;\n\nexport interface PanelPosition {\n top: number;\n left: number;\n placement: ConcretePlacement;\n}\n\n/**\n * Where to place a panel of `panelSize` next to `target`, preferring\n * `placement` but falling back through the other three sides (then finally\n * clamping into the viewport) if the preferred side doesn't have room.\n */\nexport function computePanelPosition(\n target: Rect,\n panelSize: Size,\n viewport: Size,\n placement: Placement = \"auto\"\n): PanelPosition {\n const order = placement === \"auto\" ? AUTO_ORDER : FALLBACK_ORDER[placement];\n\n for (const candidate of order) {\n const pos = placeAt(candidate, target, panelSize);\n if (fits(pos, panelSize, viewport)) {\n return { ...pos, placement: candidate };\n }\n }\n\n // Nothing fit cleanly (a very small viewport, or a target close to every\n // edge at once) — fall back to the first candidate's position, clamped\n // into the viewport rather than left overflowing.\n const fallback = order[0];\n const pos = placeAt(fallback, target, panelSize);\n return {\n top: clamp(pos.top, 0, Math.max(0, viewport.height - panelSize.height)),\n left: clamp(pos.left, 0, Math.max(0, viewport.width - panelSize.width)),\n placement: fallback,\n };\n}\n\nfunction placeAt(\n side: ConcretePlacement,\n target: Rect,\n panelSize: Size\n): { top: number; left: number } {\n const targetCenterX = target.left + target.width / 2;\n const targetCenterY = target.top + target.height / 2;\n\n switch (side) {\n case \"bottom\":\n return {\n top: target.top + target.height + PANEL_GAP,\n left: targetCenterX - panelSize.width / 2,\n };\n case \"top\":\n return {\n top: target.top - panelSize.height - PANEL_GAP,\n left: targetCenterX - panelSize.width / 2,\n };\n case \"right\":\n return {\n top: targetCenterY - panelSize.height / 2,\n left: target.left + target.width + PANEL_GAP,\n };\n case \"left\":\n return {\n top: targetCenterY - panelSize.height / 2,\n left: target.left - panelSize.width - PANEL_GAP,\n };\n }\n}\n\nfunction fits(\n pos: { top: number; left: number },\n panelSize: Size,\n viewport: Size\n): boolean {\n return (\n pos.top >= 0 &&\n pos.left >= 0 &&\n pos.top + panelSize.height <= viewport.height &&\n pos.left + panelSize.width <= viewport.width\n );\n}\n\nfunction clamp(value: number, min: number, max: number): number {\n return Math.min(Math.max(value, min), max);\n}\n","/**\n * useTour — pure step-index state machine for the onboarding tour.\n *\n * Deliberately dumb: it doesn't fetch steps, doesn't call any AI endpoint,\n * doesn't persist anything itself. The consumer (Portal) owns all of that\n * and is told about every state change via the on* callbacks so it can\n * write to user_settings however it likes. See OpiInsightsShell for the\n * same shell-owns-chrome/consumer-owns-data split.\n *\n * The actual transitions live in tourMachine.ts as plain functions (no\n * React import) so they're testable without a DOM renderer — this package\n * has no jsdom/@testing-library/react set up (see src/hooks/hooks.test.ts).\n * This file is just the useState wrapper around them.\n */\nimport { useCallback, useState } from \"react\";\nimport type { TourStep } from \"./types\";\nimport {\n backIndex,\n gotoIndex,\n nextIndex,\n resolveInitialIndex,\n} from \"./tourMachine\";\n\nexport interface UseTourOptions {\n /** Called whenever the current step changes (not on initial mount). */\n onStepChange?: (step: TourStep, index: number) => void;\n /** Called once when the user reaches the last step and advances past it. */\n onComplete?: () => void;\n /** Called when the user dismisses the tour before completion. */\n onDismiss?: () => void;\n /** Step id to resume on, if the tour was already in progress. */\n initialStepId?: string | null;\n}\n\nexport interface UseTourResult {\n step: TourStep;\n index: number;\n total: number;\n isFirst: boolean;\n isLast: boolean;\n next: () => void;\n back: () => void;\n goto: (stepId: string) => void;\n dismiss: () => void;\n}\n\nexport function useTour(\n steps: TourStep[],\n opts: UseTourOptions = {}\n): UseTourResult {\n if (steps.length === 0) {\n throw new Error(\"useTour requires at least one step\");\n }\n\n const [index, setIndex] = useState(() =>\n resolveInitialIndex(steps, opts.initialStepId)\n );\n\n const next = useCallback(() => {\n const result = nextIndex(steps, index);\n if (result.completed) {\n opts.onComplete?.();\n return;\n }\n setIndex(result.index);\n opts.onStepChange?.(steps[result.index], result.index);\n // eslint-disable-next-line react-hooks/exhaustive-deps -- opts callbacks read fresh via closure; steps identity is expected stable per mount\n }, [index, steps]);\n\n const back = useCallback(() => {\n const target = backIndex(index);\n if (target === index) return;\n setIndex(target);\n opts.onStepChange?.(steps[target], target);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, [index, steps]);\n\n const goto = useCallback(\n (stepId: string) => {\n const target = gotoIndex(steps, stepId, index);\n if (target === index) return;\n setIndex(target);\n opts.onStepChange?.(steps[target], target);\n // eslint-disable-next-line react-hooks/exhaustive-deps\n },\n [steps, index]\n );\n\n const dismiss = useCallback(() => {\n opts.onDismiss?.();\n // eslint-disable-next-line react-hooks/exhaustive-deps\n }, []);\n\n return {\n step: steps[index],\n index,\n total: steps.length,\n isFirst: index === 0,\n isLast: index === steps.length - 1,\n next,\n back,\n goto,\n dismiss,\n };\n}\n","/**\n * Pure step-index transitions behind useTour — factored out so the actual\n * state machine logic is testable in a plain Node environment, without a\n * React renderer (this package has no jsdom/@testing-library/react set up;\n * see src/hooks/hooks.test.ts's note on the same limitation). useTour.ts is\n * the thin useState wrapper; this file has no React import at all.\n */\nimport type { TourStep } from \"./types\";\n\nexport interface TourMachineResult {\n index: number;\n /** True if this call reached the end and should fire onComplete instead of moving. */\n completed: boolean;\n}\n\nexport function resolveInitialIndex(\n steps: TourStep[],\n initialStepId: string | null | undefined\n): number {\n if (!initialStepId) return 0;\n const found = steps.findIndex(s => s.id === initialStepId);\n return found === -1 ? 0 : found;\n}\n\nexport function nextIndex(\n steps: TourStep[],\n current: number\n): TourMachineResult {\n if (current >= steps.length - 1) {\n return { index: current, completed: true };\n }\n return { index: current + 1, completed: false };\n}\n\nexport function backIndex(current: number): number {\n return Math.max(0, current - 1);\n}\n\nexport function gotoIndex(\n steps: TourStep[],\n stepId: string,\n current: number\n): number {\n const target = steps.findIndex(s => s.id === stepId);\n return target === -1 ? current : target;\n}\n"],"mappings":";AAuBA,SAAS,aAAAA,YAAW,UAAAC,eAA8B;AAClD;AAAA,EACE;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,EACA;AAAA,OACK;;;AClBP,SAAS,WAAW,QAAQ,gBAAgB;AAY5C,IAAM,qBAAqB;AAOpB,SAAS,aAAa,UAA6C;AACxE,QAAM,CAAC,MAAM,OAAO,IAAI,SAAsB,IAAI;AAClD,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,KAAK;AAGxC,QAAM,sBAAsB,OAAsB,IAAI;AAEtD,YAAU,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IACA;AAAA,EACF;AACF;","names":["useEffect","useRef","pos","useRef","useEffect","useState","useState"]}
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@pablo2410/shared-ui",
3
- "version": "0.24.0",
3
+ "version": "0.25.1",
4
4
  "description": "Shared UI component library for all Oplytics.digital subdomains",
5
5
  "type": "module",
6
6
  "exports": {
@@ -85,17 +85,17 @@
85
85
  },
86
86
  "devDependencies": {
87
87
  "@tailwindcss/cli": "^4.3.3",
88
- "@types/google.maps": "^3.66.3",
88
+ "@types/google.maps": "^3.66.5",
89
89
  "@types/react": "^19.3.0",
90
90
  "@types/react-dom": "^19.3.0",
91
- "prettier": "^3.9.7",
91
+ "prettier": "^3.9.9",
92
92
  "react": "^19.3.0",
93
93
  "react-dom": "^19.3.0",
94
94
  "tailwindcss": "^4.3.3",
95
95
  "tsup": "^8.5.1",
96
96
  "typescript": "^5.9.3",
97
- "vite": "^7.1.0",
98
- "vitest": "^5.0.1"
97
+ "vite": "^8.3.2",
98
+ "vitest": "^5.0.3"
99
99
  },
100
100
  "dependencies": {
101
101
  "@radix-ui/react-accordion": "^1.2.20",
@@ -129,11 +129,11 @@
129
129
  "cmdk": "^1.1.1",
130
130
  "embla-carousel-react": "^8.6.0",
131
131
  "input-otp": "^1.5.0",
132
- "lucide-react": "^1.47.0",
132
+ "lucide-react": "^1.52.0",
133
133
  "next-themes": "^0.4.6",
134
- "react-day-picker": "^10.0.1",
135
- "react-hook-form": "^7.88.0",
136
- "react-resizable-panels": "^4.12.4",
134
+ "react-day-picker": "^10.0.2",
135
+ "react-hook-form": "^7.89.0",
136
+ "react-resizable-panels": "^4.14.2",
137
137
  "recharts": "^3.10.1",
138
138
  "sonner": "^2.0.8",
139
139
  "tailwind-merge": "^3.7.0",
@@ -142,6 +142,12 @@
142
142
  "publishConfig": {
143
143
  "access": "public"
144
144
  },
145
+ "pnpm": {
146
+ "overrides": {
147
+ "esbuild": "^0.28.1",
148
+ "@parcel/watcher": "^2.6.0"
149
+ }
150
+ },
145
151
  "repository": {
146
152
  "type": "git",
147
153
  "url": "https://github.com/Oplytics-Digital/oplytics-shared-ui.git"
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/services/platformDomain.ts"],"sourcesContent":["/**\n * Platform domain resolution — single source of truth for building\n * cross-service URLs (Service Hub cards, sidebar cross-nav, footers,\n * \"Back to Portal\" links).\n *\n * Every service runs on a sibling subdomain of one parent domain\n * (portal.oplyticsdigital.net, sqdcp.oplyticsdigital.net, …), so the parent\n * domain is derived at runtime from the current hostname: strip the service\n * label, keep the rest. Links therefore stay on whichever domain the app is\n * served from — no per-app build args, and a future domain move needs no\n * code change here.\n *\n * Outside a browser (SSR, tests) or on hosts with no parent domain\n * (localhost, raw IPs) the canonical production domain is used.\n */\n\nexport const DEFAULT_PLATFORM_DOMAIN = \"oplyticsdigital.net\";\n\nconst IPV4 = /^\\d{1,3}(\\.\\d{1,3}){3}$/;\n\nexport function getPlatformDomain(): string {\n if (typeof window === \"undefined\") return DEFAULT_PLATFORM_DOMAIN;\n const host = window.location.hostname;\n if (!host || host === \"localhost\" || IPV4.test(host)) {\n return DEFAULT_PLATFORM_DOMAIN;\n }\n const parts = host.split(\".\");\n // sqdcp.oplyticsdigital.net → oplyticsdigital.net\n if (parts.length >= 3) return parts.slice(1).join(\".\");\n // already on the apex (oplyticsdigital.net)\n if (parts.length === 2) return host;\n return DEFAULT_PLATFORM_DOMAIN;\n}\n\n/**\n * Absolute https URL for a service subdomain label on the current platform\n * domain, e.g. `platformUrl(\"sqdcp\")` → `https://sqdcp.oplyticsdigital.net`.\n */\nexport function platformUrl(subdomainLabel: string, path = \"\"): string {\n return `https://${subdomainLabel}.${getPlatformDomain()}${path}`;\n}\n\n/** Portal URL builder — the portal always lives at the `portal` label. */\nexport function portalUrl(path = \"\"): string {\n return platformUrl(\"portal\", path);\n}\n"],"mappings":";AAgBO,IAAM,0BAA0B;AAEvC,IAAM,OAAO;AAEN,SAAS,oBAA4B;AAC1C,MAAI,OAAO,WAAW,YAAa,QAAO;AAC1C,QAAM,OAAO,OAAO,SAAS;AAC7B,MAAI,CAAC,QAAQ,SAAS,eAAe,KAAK,KAAK,IAAI,GAAG;AACpD,WAAO;AAAA,EACT;AACA,QAAM,QAAQ,KAAK,MAAM,GAAG;AAE5B,MAAI,MAAM,UAAU,EAAG,QAAO,MAAM,MAAM,CAAC,EAAE,KAAK,GAAG;AAErD,MAAI,MAAM,WAAW,EAAG,QAAO;AAC/B,SAAO;AACT;AAMO,SAAS,YAAY,gBAAwB,OAAO,IAAY;AACrE,SAAO,WAAW,cAAc,IAAI,kBAAkB,CAAC,GAAG,IAAI;AAChE;AAGO,SAAS,UAAU,OAAO,IAAY;AAC3C,SAAO,YAAY,UAAU,IAAI;AACnC;","names":[]}
@@ -1 +0,0 @@
1
- {"version":3,"sources":["../src/layout/SharedSidebar.tsx","../src/layout/DashboardLayout.tsx","../src/layout/CrossServiceNav.tsx","../src/layout/HealthFooter.tsx","../src/layout/EnterpriseDebugLabel.tsx","../src/layout/DashboardLayoutSkeleton.tsx","../src/layout/SharedPageHeader.tsx","../src/layout/SharedFooter.tsx","../src/layout/ServiceFooter.tsx","../src/layout/createServiceLayout.tsx","../src/layout/serviceConfigs.ts"],"sourcesContent":["/**\n * SharedSidebar — Config-driven sidebar component for all Oplytics subdomains.\n *\n * Replaces per-subdomain DashboardLayout sidebar implementations with a single\n * shared component. Each subdomain provides its own configuration (menu items,\n * service name, feature flags) and gets a consistent sidebar experience.\n *\n * Features:\n * - Resizable sidebar with localStorage persistence\n * - Collapsible icon mode with tooltips\n * - Service branding (icon + name) in header\n * - \"Back to Service Hub/Portal\" link (configurable)\n * - Grouped menu sections with optional section labels\n * - Admin-only menu items (role-gated)\n * - User avatar footer with optional logout dropdown\n * - Mobile-responsive with auto-collapse\n *\n * Usage:\n * import { createServiceLayout } from \"@shared/components/SharedSidebar\";\n * const MyLayout = createServiceLayout({ serviceName: \"SQDCP\", ... });\n * // Then use <MyLayout>{children}</MyLayout> in your routes\n *\n * @module shared/components/SharedSidebar\n */\n\nimport React, { CSSProperties, useEffect, useRef, useState } from \"react\";\n\n/* ── Types ── */\n\nexport interface MenuItem {\n icon: React.ComponentType<{ className?: string }>;\n label: string;\n path: string;\n /** Optional badge text (e.g. count) */\n badge?: string | number;\n /**\n * Optional accent classes applied to this item's icon + label at all times\n * (active or not) — e.g. \"text-purple-400\" to flag a premium/upsell item.\n * Omit for the default muted/active-primary treatment every other item uses.\n */\n accentClassName?: string;\n}\n\nexport interface MenuSection {\n /** Section label displayed above items */\n label?: string;\n /** Alias for label — used by DashboardLayout */\n title?: string;\n items: MenuItem[];\n adminOnly?: boolean;\n /**\n * Optional accent classes applied to the section label text — e.g.\n * \"text-purple-400\" for a \"Premium Service\" heading. Omit for the\n * default muted-foreground treatment.\n */\n labelClassName?: string;\n}\n\nexport interface SharedSidebarConfig {\n /** Display name shown in sidebar header */\n serviceName: string;\n /** Icon component rendered next to service name */\n serviceIcon: React.ReactNode;\n /** Primary navigation items */\n menuSections: MenuSection[];\n /** Show \"Back to Service Hub\" / \"Back to Portal\" link at top of nav */\n backLink?: {\n label: string;\n path: string;\n };\n /** localStorage key prefix for sidebar width persistence */\n storageKeyPrefix?: string;\n /** Default sidebar width in pixels (default: 260) */\n defaultWidth?: number;\n /** Minimum sidebar width in pixels (default: 200) */\n minWidth?: number;\n /** Maximum sidebar width in pixels (default: 480) */\n maxWidth?: number;\n}\n\nexport interface SharedSidebarProps {\n config: SharedSidebarConfig;\n /** Current route location */\n location: string;\n /** Navigate to a path */\n setLocation: (path: string) => void;\n /** Current user object (null if not authenticated) */\n user: { name?: string; email?: string; role?: string } | null;\n /** Logout handler */\n onLogout?: () => void;\n /** Whether sidebar is collapsed */\n isCollapsed: boolean;\n /** Toggle sidebar collapsed state */\n toggleSidebar: () => void;\n /** Whether user has admin role */\n isAdmin: boolean;\n /** Children rendered in SidebarInset main area */\n children: React.ReactNode;\n}\n\n/* ── Constants ── */\n\nconst ADMIN_ROLES = [\n \"enterprise_admin\",\n \"platform_admin\",\n \"admin\",\n \"superuser\",\n];\n\n/* ── Helpers ── */\n\nexport function isAdminRole(role?: string): boolean {\n return !!role && ADMIN_ROLES.includes(role);\n}\n\nexport function getInitials(name?: string): string {\n if (!name) return \"U\";\n return name\n .split(\" \")\n .map(n => n[0])\n .join(\"\")\n .toUpperCase()\n .slice(0, 2);\n}\n\n/**\n * Determines if a menu item is active based on current location.\n * Exact match for root paths, startsWith for nested paths.\n */\nexport function isMenuItemActive(\n itemPath: string,\n location: string,\n basePath?: string\n): boolean {\n if (basePath) {\n // For subdomain routes with a base path (e.g., /app/policy-deployment)\n if (itemPath === basePath) return location === basePath;\n return location.startsWith(itemPath);\n }\n // For root-level routes\n if (itemPath === \"/\") return location === \"/\";\n return location.startsWith(itemPath);\n}\n\n/* ── Resize Hook ── */\n\nexport function useSidebarResize(config: {\n storageKey: string;\n defaultWidth: number;\n minWidth: number;\n maxWidth: number;\n}) {\n const [width, setWidth] = useState(() => {\n if (typeof window === \"undefined\") return config.defaultWidth;\n const saved = localStorage.getItem(config.storageKey);\n return saved ? parseInt(saved, 10) : config.defaultWidth;\n });\n const [isResizing, setIsResizing] = useState(false);\n const startX = useRef(0);\n const startWidth = useRef(config.defaultWidth);\n\n useEffect(() => {\n localStorage.setItem(config.storageKey, String(width));\n }, [width, config.storageKey]);\n\n useEffect(() => {\n if (!isResizing) return;\n const onMove = (e: MouseEvent) => {\n const newWidth = Math.min(\n config.maxWidth,\n Math.max(\n config.minWidth,\n startWidth.current + (e.clientX - startX.current)\n )\n );\n setWidth(newWidth);\n };\n const onUp = () => {\n setIsResizing(false);\n };\n document.addEventListener(\"mousemove\", onMove);\n document.addEventListener(\"mouseup\", onUp);\n document.body.style.cursor = \"col-resize\";\n document.body.style.userSelect = \"none\";\n return () => {\n document.removeEventListener(\"mousemove\", onMove);\n document.removeEventListener(\"mouseup\", onUp);\n document.body.style.cursor = \"\";\n document.body.style.userSelect = \"\";\n };\n }, [isResizing, config.minWidth, config.maxWidth]);\n\n const startResize = (e: React.MouseEvent) => {\n setIsResizing(true);\n startX.current = e.clientX;\n startWidth.current = width;\n };\n\n return { width, isResizing, startResize };\n}\n\n/* ── Export config type for subdomain use ── */\nexport type { SharedSidebarConfig as SidebarConfig };\n","/**\n * DashboardLayout — the canonical sidebar + header shell for every Oplytics\n * subdomain (the \"Policy Deployment\" gold-standard layout, consolidated).\n *\n * Built on the shadcn `Sidebar` primitives shipped from `@pablo2410/shared-ui/primitives`.\n * It renders an identical chrome across services:\n * - Collapsible icon sidebar with a brand header (icon + service name)\n * - \"← Service Hub\" link pinned to the top of the nav\n * - Grouped, optionally admin-gated menu sections\n * - Settings footer\n * - Sticky top header with a hierarchy-breadcrumb slot, reporting-toolbar\n * slot, and a user menu\n *\n * The component is intentionally app-agnostic: it imports no app hooks\n * (`useAuth`, `useHierarchy`, router). Apps pass identity, navigation state,\n * and their hierarchy navigator / reporting toolbar in as props/slots.\n *\n * Oplytics dark theme: #0D1220 header, #1E2738 border, #8C34E9 accent.\n */\nimport { type ReactNode } from \"react\";\nimport {\n Sidebar,\n SidebarContent,\n SidebarFooter,\n SidebarHeader,\n SidebarInset,\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n SidebarProvider,\n SidebarTrigger,\n useSidebar,\n Avatar,\n AvatarFallback,\n DropdownMenu,\n DropdownMenuContent,\n DropdownMenuItem,\n DropdownMenuSeparator,\n DropdownMenuTrigger,\n} from \"../primitives\";\nimport { portalUrl as buildPortalUrl } from \"../services/platformDomain\";\nimport { useIsMobile } from \"../primitives/useMobile\";\nimport {\n ArrowLeft,\n ExternalLink,\n LogOut,\n PanelLeft,\n Settings,\n} from \"lucide-react\";\nimport { cn } from \"../utils/cn\";\nimport {\n type MenuItem,\n type MenuSection,\n isMenuItemActive,\n} from \"./SharedSidebar\";\nimport { CrossServiceNav } from \"./CrossServiceNav\";\nimport type { CrossServiceLink } from \"../services/crossNav\";\nimport { HealthFooter } from \"./HealthFooter\";\nimport { EnterpriseDebugLabel } from \"./EnterpriseDebugLabel\";\n\n/* ── Re-export sidebar types ── */\nexport type { MenuItem, MenuSection };\n\n/* ── Types ── */\n\nexport interface DashboardLayoutUser {\n name?: string;\n email?: string;\n role?: string;\n avatarUrl?: string;\n /** The user's stable identifier (typically the JWT `openId` claim).\n * Optional — only used by the HealthFooter diagnostic strip. */\n openId?: string;\n /** The enterprise id from the JWT (`enterpriseId` claim). May be null\n * for platform_admin users who haven't selected an active enterprise.\n * Optional — only used by the HealthFooter diagnostic strip. */\n enterpriseId?: number | null;\n}\n\nexport interface DashboardLayoutEnterprise {\n /** The enterprise id the org-hierarchy is currently scoped to. Optional\n * — only used by the HealthFooter diagnostic strip; the visible header\n * badge only needs `name` (and optionally `code`). */\n id?: number;\n name: string;\n code?: string;\n}\n\nexport interface DashboardLayoutProps {\n /** Service/module name shown in the sidebar brand header (e.g. \"OEE Manager\").\n * Stays constant across navigation — for a per-route secondary label\n * (e.g. the active section name), pass `sectionLabel` instead of changing\n * this on navigate. */\n serviceName: string;\n /** Optional secondary label shown next to `serviceName`, separated by a\n * \"›\" (e.g. serviceName=\"Admin Controls\", sectionLabel=\"Users\" renders\n * \"Admin Controls › Users\"). Typically the active nav item's label —\n * update this per route instead of swapping `serviceName` itself, so the\n * primary brand name stays stable while navigating. */\n sectionLabel?: string;\n /** Service icon (a lucide icon element), shown in the sidebar brand + header. */\n serviceIcon?: ReactNode;\n /** Primary navigation sections. */\n menuSections: MenuSection[];\n /** Admin-only navigation sections, rendered when `isAdmin` is true. */\n adminSections?: MenuSection[];\n /** Whether the current user may see `adminSections`. */\n isAdmin?: boolean;\n /** Current route (the app's router supplies this). */\n activePath: string;\n /** Navigate handler (the app's router supplies this). */\n onNavigate: (path: string) => void;\n /** Optional override for active-item detection. */\n isActive?: (itemPath: string, activePath: string) => boolean;\n /** URL for the \"← Service Hub\" link at the top of the nav (full-page nav). */\n serviceHubUrl?: string;\n /** URL for the \"Portal\" link in the header (right of the reporting toolbar).\n * Omit to hide the link. Defaults to the platform portal root when not\n * explicitly disabled — pass `null` to hide it. */\n portalUrl?: string | null;\n /** Direct links to sibling services, rendered under the Service Hub link.\n * Build with `buildCrossServiceLinks` (services/crossNav) so provisioning\n * gating and the ?oh= hierarchy carry-over are handled consistently. */\n crossServiceLinks?: CrossServiceLink[];\n /** Footer \"Settings\" route. Omit to hide the footer. */\n settingsPath?: string;\n /** Authenticated user (drives the header user menu). */\n user?: DashboardLayoutUser | null;\n /** Sign-out handler invoked from the user menu. */\n onLogout?: () => void;\n /** \"User Settings\" target in the user menu (full-page nav). */\n userSettingsUrl?: string;\n /** App-provided hierarchy navigator rendered in the header breadcrumb slot. */\n hierarchyNavigator?: ReactNode;\n /** Selected enterprise — passed to the user menu's diagnostic label\n * (EnterpriseDebugLabel) and, where a hierarchy navigator is supplied,\n * already visible via the breadcrumb; no longer rendered as a separate\n * header badge (removed as redundant with both). */\n enterprise?: DashboardLayoutEnterprise | null;\n /** App-provided reporting toolbar rendered on the right of the header. */\n reportingToolbar?: ReactNode;\n /** Whether the sidebar starts expanded. Defaults to `!isMobile`. */\n defaultOpen?: boolean;\n /** Extra footer rendered fixed at the bottom (e.g. a debug/health bar).\n * Coexists with `showHealthFooter` — pass both if you want both. */\n footer?: ReactNode;\n /** When true AND the current user has `role === \"platform_admin\"`, the\n * shell renders the standardised platform-admin diagnostic strip\n * (`HealthFooter`) fixed at the bottom of the viewport. Subdomains\n * opt in with one prop and inherit any future improvements to the\n * strip without code changes. */\n showHealthFooter?: boolean;\n /**\n * Deployed-build info shown in the HealthFooter diagnostic strip\n * (build: version · commit · date). The consuming app supplies these from\n * its own build-time constants (e.g. Vite `define` of __BUILD_DATE__ /\n * __COMMIT_HASH__) and passes them down — globals can't be read from inside\n * this pre-compiled package, so they must arrive as props.\n */\n buildDate?: string;\n commitHash?: string;\n buildVersion?: string;\n /** Main content. */\n children: ReactNode;\n}\n\n/* Defaults resolve the platform domain at render time (see platformDomain). */\nconst defaultServiceHubUrl = () => buildPortalUrl(\"/app\");\nconst defaultUserSettingsUrl = () => buildPortalUrl(\"/account\");\nconst defaultPortalUrl = () => buildPortalUrl(\"/\");\n\n/* ── Header: user menu ── */\n\nfunction UserMenu({\n user,\n onLogout,\n userSettingsUrl = defaultUserSettingsUrl(),\n enterprise,\n}: {\n user: DashboardLayoutUser;\n onLogout?: () => void;\n userSettingsUrl?: string;\n /** Active enterprise, used to render the TEMP diagnostic chip inside the menu. */\n enterprise?: { id?: number | null; name?: string | null } | null;\n}) {\n const initials = (user.name || \"U\")\n .split(\" \")\n .map(n => n[0])\n .join(\"\")\n .toUpperCase()\n .slice(0, 2);\n\n return (\n <DropdownMenu>\n <DropdownMenuTrigger asChild>\n <button className=\"flex items-center gap-2 rounded-md px-2 py-1 hover:bg-[#1E2738] transition-colors outline-none focus-visible:ring-1 focus-visible:ring-[#8C34E9]\">\n <Avatar className=\"h-7 w-7 border border-[#2A2A3E]\">\n <AvatarFallback className=\"text-[10px] font-medium bg-[#8C34E9]/20 text-[#C084FC]\">\n {initials}\n </AvatarFallback>\n </Avatar>\n <span className=\"shell-hidden shell-md:block text-xs text-[#E2E8F0] truncate max-w-[100px]\">\n {user.name || \"User\"}\n </span>\n </button>\n </DropdownMenuTrigger>\n <DropdownMenuContent\n align=\"end\"\n className=\"w-48 bg-[#0D1220] border-[#1E2738]\"\n >\n <div className=\"px-3 py-2 border-b border-[#1E2738]\">\n <p className=\"text-xs font-medium text-[#E2E8F0] truncate\">\n {user.name}\n </p>\n <p className=\"text-[10px] text-[#596475] truncate\">{user.role}</p>\n </div>\n {/* TEMP DIAGNOSTIC — remove once subdomain enterprise-data issue is fixed.\n Lives inside the user menu (below the name, above User Settings) to keep\n it out of the header bar. */}\n <div className=\"px-2 py-2 border-b border-[#1E2738]\">\n <EnterpriseDebugLabel\n selectionEnterpriseId={enterprise?.id ?? null}\n cookieEnterpriseName={enterprise?.name ?? null}\n />\n </div>\n <DropdownMenuItem\n onClick={() => {\n window.location.href = userSettingsUrl;\n }}\n className=\"text-xs text-[#E2E8F0] hover:bg-[#1E2738] cursor-pointer focus:bg-[#1E2738]\"\n >\n <Settings className=\"h-3.5 w-3.5 mr-2 text-[#8890A0]\" />\n User Settings\n </DropdownMenuItem>\n <DropdownMenuSeparator className=\"bg-[#1E2738]\" />\n <DropdownMenuItem\n onClick={() => onLogout?.()}\n className=\"text-xs text-[#EF4444] hover:bg-[#EF4444]/10 cursor-pointer focus:bg-[#EF4444]/10 focus:text-[#EF4444]\"\n >\n <LogOut className=\"h-3.5 w-3.5 mr-2\" />\n Sign Out\n </DropdownMenuItem>\n </DropdownMenuContent>\n </DropdownMenu>\n );\n}\n\n/* ── Sidebar nav section ── */\n\nfunction NavSection({\n section,\n marginTop,\n isCollapsed,\n resolveActive,\n onNavigate,\n}: {\n section: MenuSection;\n marginTop?: boolean;\n isCollapsed: boolean;\n resolveActive: (path: string) => boolean;\n onNavigate: (path: string) => void;\n}) {\n const label = section.title ?? section.label;\n return (\n <>\n {label && (\n <div className={cn(\"px-4 py-2\", marginTop && \"mt-2\")}>\n {!isCollapsed && (\n <span\n className={cn(\n \"text-xs font-medium uppercase tracking-wider\",\n section.labelClassName ?? \"text-muted-foreground\"\n )}\n >\n {label}\n </span>\n )}\n </div>\n )}\n <SidebarMenu className=\"px-2 py-1\">\n {section.items.map((item: MenuItem) => {\n const active = resolveActive(item.path);\n const Icon = item.icon;\n return (\n <SidebarMenuItem key={item.path}>\n <SidebarMenuButton\n isActive={active}\n onClick={() => onNavigate(item.path)}\n tooltip={item.label}\n className=\"h-10 transition-all font-normal\"\n >\n {Icon && (\n <Icon\n className={cn(\n \"h-4 w-4\",\n item.accentClassName ?? (active && \"text-primary\")\n )}\n />\n )}\n <span className={cn(item.accentClassName)}>{item.label}</span>\n </SidebarMenuButton>\n </SidebarMenuItem>\n );\n })}\n </SidebarMenu>\n </>\n );\n}\n\n/* ── Inner shell (runs inside SidebarProvider, so it can call useSidebar) ── */\n\nfunction DashboardShell({\n serviceName,\n sectionLabel,\n serviceIcon,\n menuSections,\n adminSections,\n isAdmin = false,\n activePath,\n onNavigate,\n isActive,\n serviceHubUrl = defaultServiceHubUrl(),\n portalUrl = defaultPortalUrl(),\n crossServiceLinks,\n settingsPath,\n user,\n onLogout,\n userSettingsUrl,\n hierarchyNavigator,\n enterprise,\n reportingToolbar,\n footer,\n showHealthFooter,\n buildDate,\n commitHash,\n buildVersion,\n children,\n}: DashboardLayoutProps) {\n const { toggleSidebar, state } = useSidebar();\n const isCollapsed = state === \"collapsed\";\n\n const navigate = onNavigate;\n const resolveActive = (path: string) =>\n isActive ? isActive(path, activePath) : isMenuItemActive(path, activePath);\n\n return (\n <>\n <Sidebar collapsible=\"icon\" className=\"border-r-0\">\n <SidebarHeader\n className={cn(\n sectionLabel && !isCollapsed ? \"h-16\" : \"h-16 justify-center\"\n )}\n >\n <div className=\"flex items-center gap-3 px-2 transition-all w-full\">\n <button\n onClick={toggleSidebar}\n className=\"h-8 w-8 flex items-center justify-center hover:bg-accent rounded-lg transition-colors focus:outline-none focus-visible:ring-2 focus-visible:ring-ring shrink-0\"\n aria-label=\"Toggle navigation\"\n >\n <PanelLeft className=\"h-4 w-4 text-muted-foreground\" />\n </button>\n {!isCollapsed ? (\n <div className=\"flex items-center gap-2 min-w-0\">\n {serviceIcon && (\n <span className=\"text-[#8C34E9] shrink-0\">{serviceIcon}</span>\n )}\n <span className=\"flex flex-col min-w-0 leading-tight\">\n <span className=\"font-semibold tracking-tight truncate\">\n {serviceName}\n </span>\n {sectionLabel && (\n <span className=\"text-xs text-[#8890A0] truncate\">\n {sectionLabel}\n </span>\n )}\n </span>\n </div>\n ) : null}\n </div>\n </SidebarHeader>\n\n <SidebarContent className=\"gap-0\">\n {/* Service Hub — pinned to the top of the nav */}\n {serviceHubUrl && (\n <SidebarMenu className=\"px-2 pt-2 pb-1\">\n <SidebarMenuItem>\n <SidebarMenuButton\n onClick={() => {\n window.location.href = serviceHubUrl;\n }}\n tooltip=\"Back to Service Hub\"\n className=\"h-10 transition-all font-normal text-muted-foreground hover:text-foreground\"\n >\n <ArrowLeft className=\"h-4 w-4\" />\n <span>Service Hub</span>\n </SidebarMenuButton>\n </SidebarMenuItem>\n </SidebarMenu>\n )}\n\n {/* Cross-service links — jump straight to a sibling service */}\n <CrossServiceNav links={crossServiceLinks ?? []} />\n\n {/* Primary navigation */}\n {menuSections.map((section, i) => (\n <NavSection\n key={section.title ?? section.label ?? `section-${i}`}\n section={section}\n isCollapsed={isCollapsed}\n resolveActive={resolveActive}\n onNavigate={navigate}\n />\n ))}\n\n {/* Admin-only navigation */}\n {isAdmin &&\n adminSections?.map((section, i) => (\n <NavSection\n key={section.title ?? section.label ?? `admin-${i}`}\n section={section}\n marginTop\n isCollapsed={isCollapsed}\n resolveActive={resolveActive}\n onNavigate={navigate}\n />\n ))}\n </SidebarContent>\n\n {settingsPath && (\n <SidebarFooter className=\"p-2\">\n <SidebarMenu>\n <SidebarMenuItem>\n <SidebarMenuButton\n onClick={() => navigate(settingsPath)}\n tooltip=\"Settings\"\n className=\"h-10 transition-all font-normal text-muted-foreground hover:text-foreground\"\n >\n <Settings className=\"h-4 w-4\" />\n <span>Settings</span>\n </SidebarMenuButton>\n </SidebarMenuItem>\n </SidebarMenu>\n </SidebarFooter>\n )}\n </Sidebar>\n\n <SidebarInset>\n <header\n className={cn(\n \"flex items-center justify-between h-14 px-4\",\n \"bg-[#0D1220]/95 border-b border-[#1E2738]\",\n \"backdrop-blur supports-[backdrop-filter]:backdrop-blur\",\n \"sticky top-0 z-40\"\n )}\n >\n {/* LEFT: mobile trigger + service icon + hierarchy breadcrumb */}\n <div className=\"flex items-center gap-2 min-w-0 flex-1\">\n <SidebarTrigger className=\"h-9 w-9 rounded-lg bg-background shrink-0 shell-md:hidden\" />\n {serviceIcon && (\n <span className=\"text-[#8C34E9] shrink-0 shell-hidden shell-sm:block\">\n {serviceIcon}\n </span>\n )}\n {hierarchyNavigator && (\n <div className=\"min-w-0 overflow-x-auto scrollbar-none\">\n {hierarchyNavigator}\n </div>\n )}\n </div>\n\n {/* RIGHT: reporting toolbar + portal link + user menu */}\n <div className=\"flex items-center gap-2 shrink-0\">\n {reportingToolbar}\n {portalUrl && (\n <a\n href={portalUrl}\n className=\"shell-hidden shell-md:flex items-center gap-1 px-2 py-1 rounded-md text-[10px] text-[#8890A0] hover:text-[#E2E8F0] hover:bg-[#1E2738] transition-colors\"\n title=\"Back to Portal\"\n >\n <ExternalLink className=\"h-3 w-3\" />\n <span>Portal</span>\n </a>\n )}\n <div className=\"w-px h-6 bg-[#1E2738] shell-hidden shell-md:block\" />\n {user && (\n <UserMenu\n user={user}\n onLogout={onLogout}\n userSettingsUrl={userSettingsUrl}\n enterprise={enterprise}\n />\n )}\n </div>\n </header>\n\n <main className=\"flex-1 p-4 md:p-6 pb-14\">{children}</main>\n </SidebarInset>\n\n {footer}\n\n {/* Standardised platform-admin diagnostic strip — opt-in via prop. */}\n {showHealthFooter && user?.role === \"platform_admin\" && (\n <HealthFooter\n user={user}\n enterprise={enterprise}\n buildDate={buildDate}\n commitHash={commitHash}\n buildVersion={buildVersion}\n />\n )}\n </>\n );\n}\n\n/* ── Public component ── */\n\nexport function DashboardLayout(props: DashboardLayoutProps) {\n const isMobile = useIsMobile();\n return (\n <SidebarProvider defaultOpen={props.defaultOpen ?? !isMobile}>\n <DashboardShell {...props} />\n </SidebarProvider>\n );\n}\n","/**\n * CrossServiceNav — sidebar block of direct links to sibling Oplytics\n * services, rendered directly under the \"← Service Hub\" back link.\n *\n * Built on the same Sidebar primitives as the rest of the nav so it works\n * both inside the shared DashboardLayout shell and in bespoke sidebars\n * (e.g. Policy Deployment) — any consumer inside a <SidebarProvider>.\n *\n * Link entries come from `buildCrossServiceLinks` (services/crossNav), which\n * owns provisioning/gating and appends the ?oh= hierarchy selection param.\n * Navigation is a full page load, matching the Service Hub link.\n */\nimport {\n SidebarMenu,\n SidebarMenuButton,\n SidebarMenuItem,\n useSidebar,\n} from \"../primitives\";\nimport {\n ClipboardCheck,\n Gauge,\n LayoutGrid,\n Target,\n ExternalLink,\n type LucideIcon,\n} from \"lucide-react\";\nimport type { CrossServiceLink } from \"../services/crossNav\";\n\n/** Catalog icon names → lucide components for the live core services. */\nconst ICONS: Record<string, LucideIcon> = {\n Target,\n LayoutGrid,\n Gauge,\n ClipboardCheck,\n};\n\nexport interface CrossServiceNavProps {\n /** Display-ready links from buildCrossServiceLinks. Renders nothing when empty. */\n links: CrossServiceLink[];\n /** Section label above the links (hidden when the sidebar is collapsed). */\n label?: string;\n}\n\nexport function CrossServiceNav({\n links,\n label = \"Services\",\n}: CrossServiceNavProps) {\n const { state } = useSidebar();\n const isCollapsed = state === \"collapsed\";\n\n if (links.length === 0) return null;\n\n return (\n <>\n {!isCollapsed && (\n <div className=\"px-4 pt-2\">\n <span className=\"text-xs font-medium text-muted-foreground uppercase tracking-wider\">\n {label}\n </span>\n </div>\n )}\n <SidebarMenu className=\"px-2 py-1\">\n {links.map(link => {\n const Icon = ICONS[link.icon] ?? ExternalLink;\n return (\n <SidebarMenuItem key={link.slug}>\n <SidebarMenuButton\n onClick={() => {\n window.location.href = link.url;\n }}\n tooltip={link.name}\n className=\"h-10 transition-all font-normal text-muted-foreground hover:text-foreground\"\n >\n <Icon className=\"h-4 w-4\" />\n <span>{link.name}</span>\n </SidebarMenuButton>\n </SidebarMenuItem>\n );\n })}\n </SidebarMenu>\n </>\n );\n}\n","/**\n * HealthFooter — thin fixed strip at the bottom of the viewport that prints\n * the current platform-admin diagnostic context. Used to verify the\n * end-to-end auth + hierarchy resolution: JWT role, JWT-stamped enterprise id,\n * the enterprise the hierarchy actually selected, and the openId of the\n * signed-in user.\n *\n * Ported from oplytics-policy-deployment/client/src/components/PolicyDeploymentLayout.tsx\n * so every subdomain that adopts the canonical shell gets the same strip\n * automatically. Use `DashboardLayout` / `OplyticsServiceShell`'s\n * `showHealthFooter` prop to auto-render this for platform_admin only —\n * or render it manually via the existing `footer` slot for full control.\n *\n * role: platform_admin jwt.eid: 30002 hierarchy.eid: 30002\n * enterprise: Lincoln Electric user: KxULoAniQat2Vm7Z9Ds32m\n */\nimport type { CSSProperties } from \"react\";\n\n// Build stamp — injected at each app's build time via Vite `define`\n// (see the app's vite.config.ts). Lets the diagnostic strip show exactly which\n// build/commit is deployed and when it was built — so you can tell at a glance\n// whether the live site is running the latest code.\ndeclare const __BUILD_DATE__: string;\ndeclare const __COMMIT_HASH__: string;\ndeclare const __APP_VERSION__: string;\n\n/** Format an ISO build timestamp as a compact \"9 Jul 07:37Z\" (UTC). */\nfunction formatBuildDate(iso?: string): string | undefined {\n if (!iso) return undefined;\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return undefined;\n const day = d.getUTCDate();\n const month = d.toLocaleString(\"en-GB\", { month: \"short\", timeZone: \"UTC\" });\n const hh = String(d.getUTCHours()).padStart(2, \"0\");\n const mm = String(d.getUTCMinutes()).padStart(2, \"0\");\n return `${day} ${month} ${hh}:${mm}Z`;\n}\n\nexport interface HealthFooterUser {\n /** JWT role string (e.g. \"platform_admin\"). */\n role?: string;\n /** The user's stable identifier (typically the JWT `openId` claim). */\n openId?: string;\n /** The enterprise id from the JWT (`enterpriseId` claim). May be null\n * for platform_admin users who haven't selected an active enterprise. */\n enterpriseId?: number | null;\n}\n\nexport interface HealthFooterEnterprise {\n /** The enterprise id the org-hierarchy is currently scoped to. */\n id?: number;\n /** Human-readable name of the scoped enterprise. */\n name?: string;\n}\n\nexport interface HealthFooterProps {\n user?: HealthFooterUser | null;\n enterprise?: HealthFooterEnterprise | null;\n /** Optional extra CSS class for the container. */\n className?: string;\n /** Optional inline style override (z-index, etc.). */\n style?: CSSProperties;\n /** Override the build version (default: build-time __APP_VERSION__). */\n buildVersion?: string;\n /** Override the build/deploy timestamp, ISO (default: build-time __BUILD_DATE__). */\n buildDate?: string;\n /** Override the deployed commit hash (default: build-time __COMMIT_HASH__). */\n commitHash?: string;\n}\n\nexport function HealthFooter({\n user,\n enterprise,\n className,\n style,\n buildVersion,\n buildDate,\n commitHash,\n}: HealthFooterProps) {\n const version =\n buildVersion ??\n (typeof __APP_VERSION__ !== \"undefined\" ? __APP_VERSION__ : undefined);\n const commit =\n commitHash ??\n (typeof __COMMIT_HASH__ !== \"undefined\" ? __COMMIT_HASH__ : undefined);\n const builtAt = formatBuildDate(\n buildDate ??\n (typeof __BUILD_DATE__ !== \"undefined\" ? __BUILD_DATE__ : undefined)\n );\n const buildStamp = [version && `v${version}`, commit, builtAt]\n .filter(Boolean)\n .join(\" · \");\n\n return (\n <div\n className={\n \"fixed bottom-0 left-0 right-0 h-8 bg-zinc-900 border-t border-zinc-800 \" +\n \"flex items-center px-4 gap-6 text-[11px] text-zinc-400 z-50 font-mono\" +\n (className ? ` ${className}` : \"\")\n }\n style={style}\n data-slot=\"health-footer\"\n >\n <span>\n role: <span className=\"text-zinc-200\">{user?.role ?? \"–\"}</span>\n </span>\n <span>\n jwt.eid:{\" \"}\n <span className=\"text-zinc-200\">{user?.enterpriseId ?? \"null\"}</span>\n </span>\n <span>\n hierarchy.eid:{\" \"}\n <span className=\"text-zinc-200\">{enterprise?.id ?? \"–\"}</span>\n </span>\n <span>\n enterprise:{\" \"}\n <span className=\"text-zinc-200\">{enterprise?.name ?? \"–\"}</span>\n </span>\n <span>\n user: <span className=\"text-zinc-200\">{user?.openId ?? \"–\"}</span>\n </span>\n {buildStamp && (\n <span\n className=\"ml-auto text-zinc-500\"\n title=\"Deployed build (version · commit · build date UTC)\"\n >\n build: <span className=\"text-zinc-300\">{buildStamp}</span>\n </span>\n )}\n </div>\n );\n}\n","/**\n * EnterpriseDebugLabel — TEMPORARY DIAGNOSTIC chip.\n *\n * ⚠️ This is a problem-fixing aid, NOT permanent UI. Remove once the\n * subdomain \"wrong enterprise data\" issue is resolved.\n *\n * Purpose: make it plainly visible, on every page (portal + all subdomains),\n * WHICH enterprise the loaded data actually belongs to — and surface the\n * desync that causes subdomains to show the wrong enterprise's data.\n *\n * It compares two ids that are supposed to agree:\n * • cookie — the active-enterprise cookie (ACTIVE_ENTERPRISE_COOKIE), the\n * single cross-subdomain source of truth that the backend uses\n * to scope ALL data (via applyEnterpriseOverride).\n * • sel — the UI hierarchy selection's enterprise id.\n * When they diverge, the chip turns red and shows \"≠\" — that's the bug.\n *\n * Self-contained: reads the cookie directly and reads the hierarchy selection\n * defensively, so it can render even on pages mounted outside a hierarchy\n * provider (it just omits the selection comparison in that case).\n */\nimport { useEffect, useState } from \"react\";\nimport { cn } from \"../utils/cn\";\nimport { readActiveEnterpriseCookie } from \"../hierarchy\";\n\nexport interface EnterpriseDebugLabelProps {\n /**\n * The selection's enterprise id, if the host app can supply it (e.g. from\n * useOrgHierarchy().selection.enterprise?.id). Optional — when omitted, only\n * the cookie id is shown. Passing it enables the cookie-vs-selection mismatch\n * check, which is the most useful diagnostic.\n */\n selectionEnterpriseId?: number | null;\n /**\n * Optional enterprise name to show alongside the cookie id for readability.\n */\n cookieEnterpriseName?: string | null;\n className?: string;\n}\n\nexport function EnterpriseDebugLabel({\n selectionEnterpriseId,\n cookieEnterpriseName,\n className,\n}: EnterpriseDebugLabelProps) {\n // Read the cookie on the client. Re-read on focus/visibility so a switch made\n // in another tab/subdomain is reflected without a manual reload.\n const [cookieId, setCookieId] = useState<string | null>(null);\n useEffect(() => {\n const read = () => setCookieId(readActiveEnterpriseCookie());\n read();\n window.addEventListener(\"focus\", read);\n document.addEventListener(\"visibilitychange\", read);\n return () => {\n window.removeEventListener(\"focus\", read);\n document.removeEventListener(\"visibilitychange\", read);\n };\n }, []);\n\n const cookieNum =\n cookieId !== null && cookieId !== \"\" ? Number(cookieId) : null;\n const hasSelection =\n selectionEnterpriseId !== undefined && selectionEnterpriseId !== null;\n const mismatch =\n hasSelection && cookieNum !== null && cookieNum !== selectionEnterpriseId;\n const noActive = cookieNum === null;\n\n return (\n <div\n className={cn(\n \"flex items-center gap-1.5 px-2 py-1 rounded-md border font-mono text-[10px] leading-none whitespace-nowrap\",\n mismatch\n ? \"bg-[#EF4444]/15 border-[#EF4444]/40 text-[#FCA5A5]\"\n : noActive\n ? \"bg-[#F59E0B]/15 border-[#F59E0B]/40 text-[#FCD34D]\"\n : \"bg-[#10B981]/10 border-[#10B981]/30 text-[#6EE7B7]\",\n className\n )}\n title=\"TEMP DIAGNOSTIC: enterprise the loaded data is scoped to (cookie) vs. the UI hierarchy selection. Remove once subdomain data issue is fixed.\"\n >\n <span aria-hidden>🔍</span>\n {noActive ? (\n <span>no active enterprise (cookie unset)</span>\n ) : (\n <>\n <span>\n data ENT #{cookieNum}\n {cookieEnterpriseName ? ` · ${cookieEnterpriseName}` : \"\"}\n </span>\n {hasSelection && (\n <span>\n {mismatch ? \" ⚠ ≠ sel #\" : \" · sel #\"}\n {selectionEnterpriseId}\n </span>\n )}\n </>\n )}\n </div>\n );\n}\n","/**\n * DashboardLayoutSkeleton — loading skeleton for DashboardLayout.\n *\n * Shows a sidebar + content skeleton while auth state is loading.\n * Oplytics dark theme.\n */\nimport { cn } from \"../utils/cn\";\n\nfunction Skeleton({ className }: { className?: string }) {\n return (\n <div className={cn(\"animate-pulse rounded-md bg-[#1E2738]\", className)} />\n );\n}\n\nexport interface DashboardLayoutSkeletonProps {\n className?: string;\n}\n\nexport function DashboardLayoutSkeleton({\n className,\n}: DashboardLayoutSkeletonProps) {\n return (\n <div className={cn(\"flex min-h-screen bg-[#0A0E1A]\", className)}>\n {/* Sidebar skeleton */}\n <div className=\"w-[260px] border-r border-[#1E2738] bg-[#0D1220] p-4 space-y-6\">\n {/* Logo area */}\n <div className=\"flex items-center gap-3 px-2\">\n <Skeleton className=\"h-8 w-8 rounded-md\" />\n <Skeleton className=\"h-4 w-24\" />\n </div>\n\n {/* Menu items */}\n <div className=\"space-y-2 px-2\">\n <Skeleton className=\"h-9 w-full rounded-lg\" />\n <Skeleton className=\"h-9 w-full rounded-lg\" />\n <Skeleton className=\"h-9 w-full rounded-lg\" />\n <Skeleton className=\"h-9 w-full rounded-lg\" />\n </div>\n\n {/* Section divider */}\n <div className=\"px-2\">\n <Skeleton className=\"h-3 w-16 mb-3\" />\n <Skeleton className=\"h-9 w-full rounded-lg\" />\n <Skeleton className=\"h-9 w-full rounded-lg mt-2\" />\n </div>\n\n {/* User profile area at bottom */}\n <div className=\"absolute bottom-4 left-4 right-4\">\n <div className=\"flex items-center gap-3 px-1\">\n <Skeleton className=\"h-8 w-8 rounded-full\" />\n <div className=\"flex-1 space-y-2\">\n <Skeleton className=\"h-3 w-20\" />\n <Skeleton className=\"h-2 w-32\" />\n </div>\n </div>\n </div>\n </div>\n\n {/* Main content skeleton */}\n <div className=\"flex-1 p-6 space-y-4\">\n {/* Page header */}\n <div className=\"flex items-center justify-between\">\n <Skeleton className=\"h-8 w-48 rounded-lg\" />\n <Skeleton className=\"h-9 w-24 rounded-lg\" />\n </div>\n\n {/* Stats cards */}\n <div className=\"grid gap-4 md:grid-cols-2 lg:grid-cols-4\">\n <Skeleton className=\"h-24 rounded-xl\" />\n <Skeleton className=\"h-24 rounded-xl\" />\n <Skeleton className=\"h-24 rounded-xl\" />\n <Skeleton className=\"h-24 rounded-xl\" />\n </div>\n\n {/* Main content area */}\n <Skeleton className=\"h-64 rounded-xl\" />\n\n {/* Table-like area */}\n <div className=\"space-y-2\">\n <Skeleton className=\"h-10 w-full rounded-lg\" />\n <Skeleton className=\"h-10 w-full rounded-lg\" />\n <Skeleton className=\"h-10 w-full rounded-lg\" />\n </div>\n </div>\n </div>\n );\n}\n","/**\n * SharedPageHeader — standard page header for all Oplytics subdomains.\n *\n * Displays: page title, optional subtitle, optional breadcrumbs,\n * optional action buttons, and optional HierarchyNavigator.\n *\n * Oplytics dark theme: #0A0E1A bg, #8C34E9 accent, #E2E8F0 text, #8890A0 muted\n */\nimport { cn } from \"../utils/cn\";\nimport { ChevronLeft } from \"lucide-react\";\nimport type { ReactNode } from \"react\";\n\nexport interface SharedPageHeaderProps {\n /** Page title */\n title: string;\n /** Optional subtitle / description */\n subtitle?: string;\n /** Optional icon to display before the title */\n icon?: ReactNode;\n /** Optional back button handler — shows a back arrow when provided */\n onBack?: () => void;\n /** Optional action buttons to render on the right side */\n actions?: ReactNode;\n /** Optional breadcrumb trail (e.g. HierarchyNavigator) */\n breadcrumbs?: ReactNode;\n /** Whether to show a bottom border (default: true) */\n showBorder?: boolean;\n /** Compact mode — smaller spacing and text (default: false) */\n compact?: boolean;\n /** Additional CSS classes */\n className?: string;\n /** Children rendered below the header row */\n children?: ReactNode;\n}\n\nexport function SharedPageHeader({\n title,\n subtitle,\n icon,\n onBack,\n actions,\n breadcrumbs,\n showBorder = true,\n compact = false,\n className,\n children,\n}: SharedPageHeaderProps) {\n return (\n <div\n className={cn(\n \"w-full\",\n showBorder && \"border-b border-[#1E2738]\",\n compact ? \"px-4 py-3\" : \"px-6 py-4\",\n className\n )}\n >\n {/* Breadcrumbs row */}\n {breadcrumbs && (\n <div className={cn(\"mb-2\", compact && \"mb-1\")}>{breadcrumbs}</div>\n )}\n\n {/* Main header row */}\n <div className=\"flex items-center justify-between gap-4\">\n <div className=\"flex items-center gap-3 min-w-0\">\n {/* Back button */}\n {onBack && (\n <button\n onClick={onBack}\n className={cn(\n \"shrink-0 p-1.5 rounded-md\",\n \"text-[#8890A0] hover:text-[#E2E8F0] hover:bg-[#1E2738]\",\n \"transition-colors cursor-pointer\",\n \"focus-visible:outline-none focus-visible:ring-1 focus-visible:ring-[#8C34E9]\"\n )}\n aria-label=\"Go back\"\n >\n <ChevronLeft className={compact ? \"h-4 w-4\" : \"h-5 w-5\"} />\n </button>\n )}\n\n {/* Icon */}\n {icon && <div className=\"shrink-0 text-[#8C34E9]\">{icon}</div>}\n\n {/* Title + subtitle */}\n <div className=\"min-w-0\">\n <h1\n className={cn(\n \"font-semibold text-[#E2E8F0] truncate\",\n \"font-[Montserrat,sans-serif]\",\n compact ? \"text-lg\" : \"text-xl\"\n )}\n >\n {title}\n </h1>\n {subtitle && (\n <p\n className={cn(\n \"text-[#8890A0] truncate mt-0.5\",\n \"font-[Space_Grotesk,sans-serif]\",\n compact ? \"text-xs\" : \"text-sm\"\n )}\n >\n {subtitle}\n </p>\n )}\n </div>\n </div>\n\n {/* Action buttons */}\n {actions && (\n <div className=\"shrink-0 flex items-center gap-2\">{actions}</div>\n )}\n </div>\n\n {/* Optional children below header */}\n {children && (\n <div className={cn(\"mt-3\", compact && \"mt-2\")}>{children}</div>\n )}\n </div>\n );\n}\n","/**\n * SharedFooter — standard footer for all Oplytics subdomains.\n *\n * Displays: Oplytics branding, service links, legal links, copyright.\n * Consistent across all subdomains.\n *\n * Oplytics dark theme: #0D1220 bg, #1E2738 border, #8890A0 text, #8C34E9 accent\n */\nimport { cn } from \"../utils/cn\";\nimport { platformUrl } from \"../services/platformDomain\";\nimport type { ReactNode } from \"react\";\n\ndeclare const __APP_VERSION__: string;\n\n/* ── Service definitions ── */\n\nexport interface FooterService {\n name: string;\n slug: string;\n /** Local route within the portal (e.g. /services/sqdcp) */\n localRoute: string;\n /** External URL for the subdomain (e.g. https://sqdcp.oplyticsdigital.net) */\n externalUrl?: string;\n}\n\n/** Standard Oplytics service list */\nexport const FOOTER_SERVICES: FooterService[] = [\n {\n name: \"SQDCP\",\n slug: \"sqdcp\",\n localRoute: \"/services/sqdcp\",\n externalUrl: platformUrl(\"sqdcp\"),\n },\n {\n name: \"OEE Manager\",\n slug: \"oee-manager\",\n localRoute: \"/services/oee-manager\",\n externalUrl: platformUrl(\"oeemanager\"),\n },\n {\n name: \"Policy Deployment\",\n slug: \"policy-deployment\",\n localRoute: \"/services/policy-deployment\",\n externalUrl: platformUrl(\"policy\"),\n },\n {\n name: \"Action Manager\",\n slug: \"action-manager\",\n localRoute: \"/services/action-manager\",\n externalUrl: platformUrl(\"actionmanager\"),\n },\n {\n name: \"Safety Manager\",\n slug: \"safety-manager\",\n localRoute: \"/services/safety-manager\",\n },\n {\n name: \"Connect\",\n slug: \"connect\",\n localRoute: \"/services/connect\",\n externalUrl: platformUrl(\"connect\"),\n },\n];\n\n/* ── Footer props ── */\n\nexport interface SharedFooterProps {\n /** Override the default service list */\n services?: FooterService[];\n /** Show pricing link (default: true) */\n showPricing?: boolean;\n /** Show sign-in link (default: true) */\n showSignIn?: boolean;\n /** Handler for service link clicks — receives the service */\n onServiceClick?: (service: FooterService, e: React.MouseEvent) => void;\n /** Handler for pricing link click */\n onPricingClick?: (e: React.MouseEvent) => void;\n /** Handler for sign-in link click */\n onSignInClick?: (e: React.MouseEvent) => void;\n /** Additional content to render in the footer */\n children?: ReactNode;\n /** CSS class for the footer container */\n className?: string;\n /** Whether to use external URLs (subdomain links) or local routes */\n useExternalUrls?: boolean;\n /** Current year override (default: auto) */\n year?: number;\n}\n\n/* ── Component ── */\n\nexport function SharedFooter({\n services = FOOTER_SERVICES,\n showPricing = true,\n showSignIn = true,\n onServiceClick,\n onPricingClick,\n onSignInClick,\n children,\n className,\n useExternalUrls = false,\n year,\n}: SharedFooterProps) {\n const currentYear = year ?? new Date().getFullYear();\n\n return (\n <footer\n className={cn(\n \"w-full border-t border-[#1E2738]\",\n \"bg-[#0D1220] text-[#8890A0]\",\n \"font-[Space_Grotesk,sans-serif]\",\n className\n )}\n >\n <div className=\"max-w-7xl mx-auto px-6 py-10\">\n {/* Top section: Logo + columns */}\n <div className=\"grid grid-cols-1 md:grid-cols-4 gap-8 mb-8\">\n {/* Brand column */}\n <div className=\"md:col-span-1\">\n <div className=\"flex items-center gap-2 mb-3\">\n <svg\n className=\"w-7 h-7 shrink-0\"\n viewBox=\"0 0 120 120\"\n role=\"img\"\n aria-label=\"Oplytics\"\n >\n <defs>\n <linearGradient\n id=\"oplytics-footer-mark\"\n x1=\"0\"\n y1=\"0\"\n x2=\"1\"\n y2=\"1\"\n >\n <stop offset=\"0\" stopColor=\"#8C34E9\" />\n <stop offset=\"1\" stopColor=\"#5B1FA6\" />\n </linearGradient>\n </defs>\n <circle\n cx=\"60\"\n cy=\"60\"\n r=\"58\"\n fill=\"url(#oplytics-footer-mark)\"\n />\n <g fill=\"none\" stroke=\"#0A0E1A\" strokeWidth=\"8\">\n <circle cx=\"60\" cy=\"60\" r=\"34\" />\n <circle cx=\"60\" cy=\"60\" r=\"17\" />\n </g>\n <circle cx=\"77\" cy=\"43\" r=\"9\" fill=\"#1DB8CE\" />\n </svg>\n <span className=\"text-[#E2E8F0] font-semibold text-sm font-[Montserrat,sans-serif]\">\n Oplytics.digital\n </span>\n </div>\n <p className=\"text-xs text-[#596475] leading-relaxed\">\n Operational intelligence platform for manufacturing excellence.\n </p>\n </div>\n\n {/* Services column */}\n <div>\n <h4 className=\"text-[#E2E8F0] font-medium text-xs uppercase tracking-wider mb-3 font-[Montserrat,sans-serif]\">\n Services\n </h4>\n <ul className=\"space-y-2\">\n {services.map(service => (\n <li key={service.slug}>\n <a\n href={\n useExternalUrls && service.externalUrl\n ? service.externalUrl\n : service.localRoute\n }\n onClick={\n onServiceClick\n ? e => onServiceClick(service, e)\n : undefined\n }\n className=\"text-xs text-[#8890A0] hover:text-[#E2E8F0] transition-colors\"\n >\n {service.name}\n </a>\n </li>\n ))}\n </ul>\n </div>\n\n {/* Company column */}\n <div>\n <h4 className=\"text-[#E2E8F0] font-medium text-xs uppercase tracking-wider mb-3 font-[Montserrat,sans-serif]\">\n Company\n </h4>\n <ul className=\"space-y-2\">\n {showPricing && (\n <li>\n <a\n href=\"/pricing\"\n onClick={onPricingClick}\n className=\"text-xs text-[#8890A0] hover:text-[#E2E8F0] transition-colors\"\n >\n Pricing\n </a>\n </li>\n )}\n <li>\n <a\n href=\"/about\"\n className=\"text-xs text-[#8890A0] hover:text-[#E2E8F0] transition-colors\"\n >\n About\n </a>\n </li>\n <li>\n <a\n href=\"/contact\"\n className=\"text-xs text-[#8890A0] hover:text-[#E2E8F0] transition-colors\"\n >\n Contact\n </a>\n </li>\n </ul>\n </div>\n\n {/* Legal column */}\n <div>\n <h4 className=\"text-[#E2E8F0] font-medium text-xs uppercase tracking-wider mb-3 font-[Montserrat,sans-serif]\">\n Legal\n </h4>\n <ul className=\"space-y-2\">\n <li>\n <a\n href=\"/privacy\"\n className=\"text-xs text-[#8890A0] hover:text-[#E2E8F0] transition-colors\"\n >\n Privacy Policy\n </a>\n </li>\n <li>\n <a\n href=\"/terms\"\n className=\"text-xs text-[#8890A0] hover:text-[#E2E8F0] transition-colors\"\n >\n Terms of Service\n </a>\n </li>\n </ul>\n {showSignIn && (\n <div className=\"mt-4\">\n <a\n href=\"/login\"\n onClick={onSignInClick}\n className=\"text-xs text-[#8C34E9] hover:text-[#A855F7] transition-colors font-medium\"\n >\n Sign In\n </a>\n </div>\n )}\n </div>\n </div>\n\n {/* Custom content */}\n {children}\n\n {/* Bottom bar */}\n <div className=\"pt-6 border-t border-[#1E2738] flex flex-col sm:flex-row items-center justify-between gap-3\">\n <p className=\"text-xs text-[#596475]\">\n &copy; {currentYear} Oplytics.digital. All rights reserved.\n </p>\n <p className=\"text-xs text-[#3E4A5C]\">\n Built for manufacturing excellence\n </p>\n {typeof __APP_VERSION__ !== \"undefined\" && (\n <p className=\"text-xs text-[#3E4A5C]\">\n Platform v{__APP_VERSION__}\n </p>\n )}\n </div>\n </div>\n </footer>\n );\n}\n","/**\n * ServiceFooter — slim status bar for all Oplytics subdomain services.\n *\n * ~36px horizontal strip: [Logo + Tagline] [Health Monitor] [Copyright + Version]\n * Health monitor is visible only when showHealthMonitor is true (typically platform_admin).\n *\n * Oplytics dark theme: #0D1220 bg, #1E2738 border, #596475/#3E4A5C text, #8C34E9 accent\n */\nimport { cn } from \"../utils/cn\";\n\ndeclare const __APP_VERSION__: string;\ndeclare const __BUILD_DATE__: string;\ndeclare const __COMMIT_HASH__: string;\n\nexport interface ServiceFooterProps {\n /** Enterprise ID for health monitor */\n enterpriseId?: number | null;\n /** Enterprise display name */\n enterpriseName?: string;\n /** Current user's role */\n userRole?: string;\n /** Current user's email */\n userEmail?: string;\n /** Deployment environment */\n environment?: \"production\" | \"staging\" | \"development\";\n /** Build version / commit hash */\n buildVersion?: string;\n /**\n * Build/deploy timestamp — when the currently-served bundle was built.\n * ISO string (e.g. \"2026-07-09T07:37:31Z\"). Falls back to the build-time\n * __BUILD_DATE__ constant. Rendered as a short date+time so you can tell at\n * a glance whether the deployed code is the latest (root-cause aid).\n */\n buildDate?: string;\n /** Short commit hash of the deployed build (e.g. \"c3af23f\"). Falls back to __COMMIT_HASH__. */\n commitHash?: string;\n /** Show health monitor strip (default: false) */\n showHealthMonitor?: boolean;\n /** CSS class for the footer container */\n className?: string;\n}\n\n/** Format an ISO build timestamp as a compact \"9 Jul 07:37\" (UTC) for the footer. */\nfunction formatBuildDate(iso?: string): string | undefined {\n if (!iso) return undefined;\n const d = new Date(iso);\n if (Number.isNaN(d.getTime())) return undefined;\n const day = d.getUTCDate();\n const month = d.toLocaleString(\"en-GB\", { month: \"short\", timeZone: \"UTC\" });\n const hh = String(d.getUTCHours()).padStart(2, \"0\");\n const mm = String(d.getUTCMinutes()).padStart(2, \"0\");\n return `${day} ${month} ${hh}:${mm}Z`;\n}\n\nconst ENV_LABELS: Record<string, { label: string; color: string }> = {\n production: { label: \"prod\", color: \"#10b981\" },\n staging: { label: \"stg\", color: \"#f59e0b\" },\n development: { label: \"dev\", color: \"#8C34E9\" },\n};\n\nexport function ServiceFooter({\n enterpriseId,\n enterpriseName,\n userRole,\n userEmail,\n environment,\n buildVersion,\n buildDate,\n commitHash,\n showHealthMonitor = false,\n className,\n}: ServiceFooterProps) {\n const currentYear = new Date().getFullYear();\n const env = environment ? ENV_LABELS[environment] : null;\n const version =\n buildVersion ??\n (typeof __APP_VERSION__ !== \"undefined\" ? __APP_VERSION__ : undefined);\n const commit =\n commitHash ??\n (typeof __COMMIT_HASH__ !== \"undefined\" ? __COMMIT_HASH__ : undefined);\n const builtAt = formatBuildDate(\n buildDate ??\n (typeof __BUILD_DATE__ !== \"undefined\" ? __BUILD_DATE__ : undefined)\n );\n // A single \"build stamp\" combining version + commit + build date, e.g.\n // \"v.0.9.2 · c3af23f · 9 Jul 07:37Z\". Any missing piece is simply omitted.\n const buildStamp = [version && `v.${version}`, commit, builtAt]\n .filter(Boolean)\n .join(\" · \");\n\n return (\n <footer\n className={cn(\n \"w-full border-t border-[#1E2738] bg-[#0D1220]\",\n \"flex items-center justify-between px-4\",\n \"h-9 min-h-[36px] shrink-0\",\n \"font-[Montserrat,sans-serif]\",\n className\n )}\n >\n {/* Left: Logo + Tagline */}\n <div className=\"flex items-center gap-2 min-w-0\">\n <svg\n className=\"w-5 h-5 shrink-0\"\n viewBox=\"0 0 120 120\"\n role=\"img\"\n aria-label=\"Oplytics\"\n >\n <defs>\n <linearGradient\n id=\"oplytics-service-footer-mark\"\n x1=\"0\"\n y1=\"0\"\n x2=\"1\"\n y2=\"1\"\n >\n <stop offset=\"0\" stopColor=\"#8C34E9\" />\n <stop offset=\"1\" stopColor=\"#5B1FA6\" />\n </linearGradient>\n </defs>\n <circle\n cx=\"60\"\n cy=\"60\"\n r=\"58\"\n fill=\"url(#oplytics-service-footer-mark)\"\n />\n <g fill=\"none\" stroke=\"#0A0E1A\" strokeWidth=\"9\">\n <circle cx=\"60\" cy=\"60\" r=\"33\" />\n <circle cx=\"60\" cy=\"60\" r=\"14\" />\n </g>\n <circle cx=\"79\" cy=\"41\" r=\"11\" fill=\"#1DB8CE\" />\n </svg>\n <span className=\"text-[10px] text-[#596475] whitespace-nowrap shell-hidden shell-sm:inline\">\n Operational Excellence. One Digital Platform.\n </span>\n </div>\n\n {/* Center: Health Monitor (admin only) */}\n {showHealthMonitor && (\n <div className=\"flex items-center gap-1.5 text-[10px] text-[#3E4A5C] min-w-0 overflow-hidden\">\n {enterpriseName && (\n <>\n <span className=\"whitespace-nowrap\">\n <span className=\"text-[#596475]\">{enterpriseName}</span>\n {enterpriseId != null && (\n <span className=\"text-[#3E4A5C]\"> ({enterpriseId})</span>\n )}\n </span>\n <Separator />\n </>\n )}\n {userEmail && (\n <>\n <span className=\"whitespace-nowrap text-[#596475]\">\n {userEmail}\n </span>\n {userRole && (\n <span className=\"text-[#3E4A5C]\"> ({userRole})</span>\n )}\n <Separator />\n </>\n )}\n {env && (\n <>\n <span className=\"whitespace-nowrap\">\n ENV:{\" \"}\n <span style={{ color: env.color }} className=\"font-semibold\">\n {env.label}\n </span>\n </span>\n <Separator />\n </>\n )}\n {buildStamp && (\n <span\n className=\"whitespace-nowrap text-[#3E4A5C] font-mono\"\n title=\"Deployed build\"\n >\n {buildStamp}\n </span>\n )}\n </div>\n )}\n\n {/* Right: Copyright + build stamp (when health monitor hidden) */}\n <div className=\"flex items-center gap-2 text-[10px] text-[#3E4A5C] whitespace-nowrap shrink-0\">\n <span>&copy; {currentYear} Oplytics.digital</span>\n {!showHealthMonitor && buildStamp && (\n <>\n <Separator />\n <span className=\"font-mono\" title=\"Deployed build\">\n {buildStamp}\n </span>\n </>\n )}\n </div>\n </footer>\n );\n}\n\nfunction Separator() {\n return (\n <span className=\"text-[#1E2738] select-none\" aria-hidden>\n |\n </span>\n );\n}\n","/**\n * createServiceLayout — Factory function that generates a complete DashboardLayout\n * for any Oplytics subdomain from a SharedSidebarConfig.\n *\n * This is the primary API for subdomains. Instead of each subdomain maintaining\n * its own 200-350 line DashboardLayout, they call:\n *\n * const SQDCPLayout = createServiceLayout({ serviceName: \"SQDCP\", ... });\n *\n * And get a fully-featured layout with:\n * - Resizable sidebar with all standard features\n * - SharedPageHeader integration\n * - ReportingToolbar integration (optional)\n * - HierarchyProvider wrapping (optional)\n * - Auth gate with loading skeleton + sign-in fallback (optional)\n * - User footer with logout dropdown\n *\n * @module shared/components/createServiceLayout\n */\n\nimport React from \"react\";\nimport type { SharedSidebarConfig, MenuSection } from \"./SharedSidebar\";\nimport {\n isAdminRole,\n getInitials,\n isMenuItemActive,\n useSidebarResize,\n} from \"./SharedSidebar\";\n\n/* ── Service Layout Configuration ── */\n\nexport interface ServiceLayoutConfig extends SharedSidebarConfig {\n /** Show SharedPageHeader above content (default: true) */\n showPageHeader?: boolean;\n /** SharedPageHeader props — passed through when showPageHeader is true */\n pageHeaderProps?: {\n showHierarchy?: boolean;\n hierarchyMaxDepth?: number;\n showSidebarTrigger?: boolean;\n };\n /** Show ReportingToolbar in the header (default: false) */\n showReportingToolbar?: boolean;\n /** Module name passed to ReportingToolbar */\n reportingModuleName?: string;\n /** Wrap layout in HierarchyProvider (default: false) */\n wrapHierarchyProvider?: boolean;\n /** Show auth gate — loading skeleton + sign-in fallback (default: true) */\n showAuthGate?: boolean;\n /** Report submit handler */\n onReportSubmit?: (report: any) => Promise<void> | void;\n /** Feedback submit handler */\n onFeedbackSubmit?: (feedback: any) => Promise<void> | void;\n}\n\n/**\n * Creates a service-specific layout component from configuration.\n *\n * NOTE: This is a blueprint/factory specification. The actual React component\n * is assembled by each subdomain using their local UI primitives (Sidebar,\n * SidebarProvider, etc.) since these are not shared across subdomains yet.\n *\n * When subdomain consolidation (#311) is complete, this factory will directly\n * render the shared UI primitives. Until then, subdomains use this config\n * to standardise their DashboardLayout implementations.\n *\n * @example\n * ```tsx\n * // In SQDCP's DashboardLayout.tsx:\n * import { sqdcpLayoutConfig } from \"./sqdcp-config\";\n * // Use sqdcpLayoutConfig.menuSections, .backLink, etc. to build the layout\n * ```\n */\nexport function defineServiceLayout(\n config: ServiceLayoutConfig\n): ServiceLayoutConfig {\n return {\n defaultWidth: 260,\n minWidth: 200,\n maxWidth: 480,\n showPageHeader: true,\n showReportingToolbar: false,\n wrapHierarchyProvider: false,\n showAuthGate: true,\n ...config,\n storageKeyPrefix:\n config.storageKeyPrefix ||\n config.serviceName.toLowerCase().replace(/\\s+/g, \"-\"),\n };\n}\n\n/* ── Pre-built Service Configurations ── */\n\n// These are the canonical configurations for each subdomain.\n// Subdomains should import and use these instead of defining their own.\n\nexport { isAdminRole, getInitials, isMenuItemActive, useSidebarResize };\n","/**\n * Canonical Service Layout Configurations for all Oplytics subdomains.\n *\n * Each subdomain imports its config from here and uses it to build its\n * DashboardLayout. This ensures consistency across all services while\n * allowing per-service customisation (menu items, features, etc.).\n *\n * When subdomain consolidation (#311) is complete, these configs will\n * drive the shared createServiceLayout factory directly.\n *\n * @module shared/components/serviceConfigs\n */\n\nimport type { ServiceLayoutConfig } from \"./createServiceLayout\";\nimport { portalUrl } from \"../services/platformDomain\";\n\n/* ── Icon placeholder types ── */\n// Icons are imported locally by each subdomain from lucide-react.\n// These configs use string identifiers that map to icon components.\n\nexport interface MenuItemConfig {\n iconName: string;\n label: string;\n path: string;\n}\n\nexport interface MenuSectionConfig {\n label?: string;\n items: MenuItemConfig[];\n adminOnly?: boolean;\n}\n\nexport interface ServiceConfig {\n serviceName: string;\n serviceAbbreviation: string;\n serviceIconName: string;\n menuSections: MenuSectionConfig[];\n backLink?: {\n label: string;\n path: string;\n };\n showPageHeader: boolean;\n showReportingToolbar: boolean;\n reportingModuleName?: string;\n wrapHierarchyProvider: boolean;\n showAuthGate: boolean;\n storageKeyPrefix: string;\n defaultWidth: number;\n minWidth: number;\n maxWidth: number;\n}\n\n/* ── SQDCP ── */\n\nexport const sqdcpConfig: ServiceConfig = {\n serviceName: \"SQDCP\",\n serviceAbbreviation: \"S\",\n serviceIconName: \"BarChart3\",\n menuSections: [\n {\n items: [\n { iconName: \"LayoutDashboard\", label: \"Dashboard\", path: \"/\" },\n { iconName: \"PenLine\", label: \"Data Entry\", path: \"/entry\" },\n {\n iconName: \"ClipboardList\",\n label: \"Action Tracker\",\n path: \"/actions\",\n },\n { iconName: \"FileText\", label: \"Reports\", path: \"/reports\" },\n { iconName: \"Settings\", label: \"Admin\", path: \"/admin\" },\n ],\n },\n ],\n showPageHeader: true,\n showReportingToolbar: true,\n reportingModuleName: \"SQDCP\",\n wrapHierarchyProvider: false,\n showAuthGate: false,\n storageKeyPrefix: \"sqdcp-sidebar\",\n defaultWidth: 260,\n minWidth: 200,\n maxWidth: 480,\n};\n\n/* ── OEE Manager ── */\n\nexport const oeeManagerConfig: ServiceConfig = {\n serviceName: \"OEE Manager\",\n serviceAbbreviation: \"o\",\n serviceIconName: \"BarChart3\",\n menuSections: [\n {\n items: [\n { iconName: \"BarChart3\", label: \"Dashboard\", path: \"/\" },\n { iconName: \"Database\", label: \"Data Input\", path: \"/data-input\" },\n { iconName: \"Clock\", label: \"Downtime\", path: \"/downtime\" },\n { iconName: \"Settings\", label: \"Settings\", path: \"/settings\" },\n ],\n },\n ],\n backLink: {\n label: \"Back to Portal\",\n path: portalUrl(),\n },\n showPageHeader: true,\n showReportingToolbar: true,\n reportingModuleName: \"OEE Enterprise Manager\",\n wrapHierarchyProvider: false,\n showAuthGate: false,\n storageKeyPrefix: \"oee-sidebar\",\n defaultWidth: 240,\n minWidth: 200,\n maxWidth: 400,\n};\n\n/* ── Action Manager ── */\n\nexport const actionManagerConfig: ServiceConfig = {\n serviceName: \"Action Manager\",\n serviceAbbreviation: \"A\",\n serviceIconName: \"LayoutDashboard\",\n menuSections: [\n {\n items: [\n { iconName: \"LayoutDashboard\", label: \"Dashboard\", path: \"/\" },\n { iconName: \"Users\", label: \"Teams\", path: \"/teams\" },\n ],\n },\n ],\n showPageHeader: true,\n showReportingToolbar: false,\n reportingModuleName: \"Action Manager\",\n wrapHierarchyProvider: false,\n showAuthGate: true,\n storageKeyPrefix: \"actionmanager-sidebar\",\n defaultWidth: 280,\n minWidth: 200,\n maxWidth: 480,\n};\n\n/* ── Business Hub ── */\n\nexport const businessHubConfig: ServiceConfig = {\n serviceName: \"Business Hub\",\n serviceAbbreviation: \"B\",\n serviceIconName: \"LayoutDashboard\",\n menuSections: [\n {\n items: [\n { iconName: \"LayoutDashboard\", label: \"Dashboard\", path: \"/\" },\n { iconName: \"Users\", label: \"Analytics\", path: \"/analytics\" },\n ],\n },\n ],\n showPageHeader: true,\n showReportingToolbar: false,\n reportingModuleName: \"Business Hub\",\n wrapHierarchyProvider: false,\n showAuthGate: true,\n storageKeyPrefix: \"businesshub-sidebar\",\n defaultWidth: 280,\n minWidth: 200,\n maxWidth: 480,\n};\n\n/* ── Policy Deployment ── */\n\nexport const policyDeploymentConfig: ServiceConfig = {\n serviceName: \"Policy Deployment\",\n serviceAbbreviation: \"PD\",\n serviceIconName: \"FileStack\",\n menuSections: [\n {\n label: \"Analysis\",\n items: [\n {\n iconName: \"LayoutGrid\",\n label: \"Dashboard\",\n path: \"/app/policy-deployment\",\n },\n {\n iconName: \"Grid3X3\",\n label: \"X-Matrix\",\n path: \"/app/policy-deployment/xmatrix\",\n },\n {\n iconName: \"BarChart3\",\n label: \"Bowling Chart\",\n path: \"/app/policy-deployment/bowling\",\n },\n {\n iconName: \"FolderKanban\",\n label: \"Action Plans\",\n path: \"/app/policy-deployment/actions\",\n },\n {\n iconName: \"GitBranchPlus\",\n label: \"Catchball\",\n path: \"/app/policy-deployment/catchball\",\n },\n {\n iconName: \"Target\",\n label: \"Deployments\",\n path: \"/app/policy-deployment/deployments\",\n },\n ],\n },\n {\n label: \"Administration\",\n adminOnly: true,\n items: [\n {\n iconName: \"Settings\",\n label: \"Manage Policy\",\n path: \"/app/policy-deployment/manage\",\n },\n {\n iconName: \"Plug\",\n label: \"Integrations\",\n path: \"/app/policy-deployment/integrations\",\n },\n ],\n },\n ],\n backLink: {\n label: \"Service Hub\",\n path: \"/app\",\n },\n showPageHeader: true,\n showReportingToolbar: true,\n reportingModuleName: \"Policy Deployment\",\n wrapHierarchyProvider: true,\n showAuthGate: true,\n storageKeyPrefix: \"policy-sidebar\",\n defaultWidth: 260,\n minWidth: 200,\n maxWidth: 480,\n};\n\n/* ── All configs indexed by service key ── */\n\nexport const SERVICE_CONFIGS = {\n sqdcp: sqdcpConfig,\n oeeManager: oeeManagerConfig,\n actionManager: actionManagerConfig,\n businessHub: businessHubConfig,\n policyDeployment: policyDeploymentConfig,\n} as const;\n\nexport type ServiceKey = keyof typeof SERVICE_CONFIGS;\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAyBA,SAA+B,WAAW,QAAQ,gBAAgB;AA6ElE,IAAM,cAAc;AAAA,EAClB;AAAA,EAC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A,QACR;AAAA,MACF;AAAA,IACF;AAAA,EACF;AAAA,EACA,UAAU;AAAA,IACR,OAAO;AAAA,IACP,MAAM;AAAA,EACR;AAAA,EACA,gBAAgB;AAAA,EAChB,sBAAsB;AAAA,EACtB,qBAAqB;AAAA,EACrB,uBAAuB;AAAA,EACvB,cAAc;AAAA,EACd,kBAAkB;AAAA,EAClB,cAAc;AAAA,EACd,UAAU;AAAA,EACV,UAAU;AACZ;AAIO,IAAM,kBAAkB;AAAA,EAC7B,OAAO;AAAA,EACP,YAAY;AAAA,EACZ,eAAe;AAAA,EACf,aAAa;AAAA,EACb,kBAAkB;AACpB;","names":["ExternalLink","jsx","jsxs","useEffect","useState","Fragment","jsx","jsxs","useState","useEffect","Fragment","jsx","jsxs","portalUrl","ExternalLink","jsx","jsxs","jsx","jsxs","jsx","jsxs","Fragment","jsx","jsxs","formatBuildDate"]}