Skip to content

Open-source manufacturing ERP, MES and QMS. Quoting, MRP, inventory, shop floor, quality and lot/serial traceability on one Postgres schema, with a REST API and MCP server. Self-host or use Carbon Cloud.

Revamp onboarding (#962)

Sid7a631d6d1b8d
diff --git a/apps/erp/app/components/Layout/Navigation/PrimaryNavigation.tsx b/apps/erp/app/components/Layout/Navigation/PrimaryNavigation.tsx
index d94ede41b8..5cb930cbe0 100644
--- a/apps/erp/app/components/Layout/Navigation/PrimaryNavigation.tsx
+++ b/apps/erp/app/components/Layout/Navigation/PrimaryNavigation.tsx
@@ -17,6 +17,7 @@ import { forwardRef, memo, useEffect } from "react";
import { LuSettings2 } from "react-icons/lu";
import { Link, useMatches } from "react-router";
import { useModules, useOptimisticLocation, useSettingsModule } from "~/hooks";
+import { useImplementationNavItem } from "~/hooks/useImplementationNavItem";
import type { Authenticated, NavItem } from "~/types";
import { HiddenModulesPopover } from "./HiddenModulesPopover";
import { NavigationEditBar } from "./NavigationEditBar";
@@ -29,6 +30,7 @@ const PrimaryNavigation = () => {
const currentModule = getModule(location.pathname);
const links = useModules();
const settingsModule = useSettingsModule();
+ const implementationNav = useImplementationNavItem();
const matchedModules = useMatches().reduce((acc, match) => {
const handle = match.handle as { module?: string } | undefined;
@@ -75,6 +77,14 @@ const PrimaryNavigation = () => {
className="flex flex-col justify-between h-full px-2"
>
<VStack spacing={1}>
+ {!editMode.isEditing && implementationNav ? (
+ <NavigationIconLink
+ link={implementationNav}
+ isActive={currentModule === "get-started"}
+ isOpen={isOpen}
+ onClick={navigationPanel.onClose}
+ />
+ ) : null}
{editMode.isEditing ? (
<DndContext
sensors={sensors}
@@ -226,6 +236,12 @@ const NavigationIconLink = forwardRef<
>
<link.icon className={cn(...iconClasses)} />
+ {link.tag ? (
+ <span className="absolute top-1 right-1 min-w-4 h-4 px-1 rounded-full bg-primary text-primary-foreground text-[10px] font-medium leading-4 text-center tabular-nums">
+ {link.tag}
+ </span>
+ ) : null}
+
<span
aria-hidden={isOpen || undefined}
className={cn(
diff --git a/apps/erp/app/components/MeshGradientBackground.tsx b/apps/erp/app/components/MeshGradientBackground.tsx
new file mode 100644
index 0000000000..f0942a58bd
--- /dev/null
+++ b/apps/erp/app/components/MeshGradientBackground.tsx
@@ -0,0 +1,107 @@
+import { cn, useMode } from "@carbon/react";
+import { MeshGradient } from "@paper-design/shaders-react";
+import { useEffect, useState } from "react";
+import { useTheme } from "~/hooks/useTheme";
+
+// Theme-aware Paper Shaders mesh-gradient backdrop. Used behind the onboarding
+// flow and the Implementation Hub so both share the same soft, animated canvas.
+const meshColorsByTheme: Record<
+ string,
+ {
+ light: [string, string, string, string];
+ dark: [string, string, string, string];
+ }
+> = {
+ zinc: {
+ light: ["#c2c2c9", "#e4e4e9", "#fafafb", "#d2d2d9"],
+ dark: ["#18181b", "#000000", "#0D0D0D", "#050505"]
+ },
+ neutral: {
+ light: ["#c7c3bf", "#e6e3df", "#faf9f8", "#d6d2cd"],
+ dark: ["#1c1917", "#000000", "#0D0D0D", "#050505"]
+ },
+ red: {
+ light: ["#fda4af", "#ffdce0", "#fff5f6", "#fec5cb"],
+ dark: ["#2d0a0a", "#000000", "#0D0D0D", "#050505"]
+ },
+ orange: {
+ light: ["#fdba74", "#ffe2c2", "#fff7ee", "#ffd2a3"],
+ dark: ["#2d1a0a", "#000000", "#0D0D0D", "#050505"]
+ },
+ yellow: {
+ light: ["#fcd34d", "#fdeba8", "#fffbe6", "#fde17f"],
+ dark: ["#2d2a0a", "#000000", "#0D0D0D", "#050505"]
+ },
+ green: {
+ light: ["#6ee7b7", "#b9efd3", "#ecfdf4", "#9eeecb"],
+ dark: ["#023225", "#000000", "#0D0D0D", "#050505"]
+ },
+ blue: {
+ light: ["#dfe9fc", "#f2f6fd", "#fdfdfe", "#eaf0fb"],
+ dark: ["#0a1a2d", "#000000", "#0D0D0D", "#050505"]
+ },
+ violet: {
+ light: ["#a78bfa", "#d8ccfe", "#f1edfe", "#c6b4fd"],
+ dark: ["#1e0a2d", "#000000", "#0D0D0D", "#050505"]
+ }
+};
+
+export function getMeshColors(theme: string, mode: string) {
+ const colors = meshColorsByTheme[theme] ?? meshColorsByTheme.blue;
+ return mode === "light" ? colors.light : colors.dark;
+}
+
+export function getMeshBackgroundGradient(theme: string, mode: string) {
+ const colors = getMeshColors(theme, mode);
+ return `linear-gradient(to bottom right, ${colors[1]} 35.67%, ${colors[0]} 88.95%)`;
+}
+
+// Absolute-positioned background layer. Parent must be `relative`; render real
+// content as a sibling with `relative z-10` on top.
+export function MeshGradientBackground({
+ className,
+ theme: themeOverride
+}: {
+ className?: string;
+ // Force a fixed palette (e.g. "blue") instead of the company theme. The
+ // Implementation Hub uses this so it always shows the same blue/white mesh as
+ // the signup onboarding flow, regardless of the company's chosen theme.
+ theme?: string;
+}) {
+ const mode = useMode();
+ const serverTheme = useTheme();
+ const [theme, setTheme] = useState(serverTheme);
+
+ useEffect(() => {
+ setTheme(serverTheme);
+ }, [serverTheme]);
+
+ // The onboarding theme step dispatches this to preview themes live.
+ useEffect(() => {
+ const handler = (e: Event) => {
+ setTheme((e as CustomEvent<string>).detail);
+ };
+ window.addEventListener("onboarding-theme-change", handler);
+ return () => window.removeEventListener("onboarding-theme-change", handler);
+ }, []);
+
+ const activeTheme = themeOverride ?? theme;
+
+ return (
+ <div
+ className={cn("absolute inset-0 overflow-hidden", className)}
+ style={{ background: getMeshBackgroundGradient(activeTheme, mode) }}
+ >
+ <MeshGradient
+ speed={1}
+ colors={getMeshColors(activeTheme, mode)}
+ distortion={0.8}
+ swirl={0.1}
+ grainMixer={0}
+ grainOverlay={0}
+ className="absolute inset-0 w-full h-full"
+ style={{ height: "100%", width: "100%" }}
+ />
+ </div>
+ );
+}
diff --git a/apps/erp/app/hooks/useCustomerPreview.tsx b/apps/erp/app/hooks/useCustomerPreview.tsx
new file mode 100644
index 0000000000..7ff20822f5
--- /dev/null
+++ b/apps/erp/app/hooks/useCustomerPreview.tsx
@@ -0,0 +1,36 @@
+import { useSyncExternalStore } from "react";
+
+// Customer preview lets an internal Carbon user render the hub as the customer
+// sees it — carbon-only pages hidden, carbon-owned fields locked. Persisted in
+// sessionStorage so it survives navigation + reloads within the tab/session
+// (scoped to that session, not leaked across tabs or restarts).
+const KEY = "carbon:hub:previewAsCustomer";
+// sessionStorage fires no `storage` event in the same tab, so the setter
+// broadcasts this custom event to sync every live hook instance.
+const EVENT = "carbon:hub:previewAsCustomer";
+
+function read(): boolean {
+ if (typeof window === "undefined") return false;
+ return window.sessionStorage.getItem(KEY) === "1";
+}
+
+function subscribe(onChange: () => void): () => void {
+ window.addEventListener(EVENT, onChange);
+ window.addEventListener("storage", onChange);
+ return () => {
+ window.removeEventListener(EVENT, onChange);
+ window.removeEventListener("storage", onChange);
+ };
+}
+
+export function useCustomerPreview(): boolean {
+ // Server snapshot is always false — preview is a client-only, internal-only view.
+ return useSyncExternalStore(subscribe, read, () => false);
+}
+
+export function setCustomerPreview(on: boolean): void {
+ if (typeof window === "undefined") return;
+ if (on) window.sessionStorage.setItem(KEY, "1");
+ else window.sessionStorage.removeItem(KEY);
+ window.dispatchEvent(new Event(EVENT));
+}
diff --git a/apps/erp/app/hooks/useHubDismissed.tsx b/apps/erp/app/hooks/useHubDismissed.tsx
new file mode 100644
index 0000000000..09462702cc
--- /dev/null
+++ b/apps/erp/app/hooks/useHubDismissed.tsx
@@ -0,0 +1,29 @@
+import { useCallback, useState } from "react";
+
+// Per-user, per-browser dismissal of the home-screen hub card. The full hub stays
+// reachable from the nav — this only hides the home hijack (mirrors how the
+// training panel tracks dismissals). Not shared state, so it lives in localStorage.
+const storageKey = (companyId: string) =>
+ `implementationHubDismissed:${companyId}`;
+
+export function useHubDismissed(companyId: string): [boolean, () => void] {
+ const [dismissed, setDismissed] = useState<boolean>(() => {
+ if (typeof window === "undefined") return false;
+ try {
+ return window.localStorage.getItem(storageKey(companyId)) === "1";
+ } catch {
+ return false;
+ }
+ });
+
+ const dismiss = useCallback(() => {
+ try {
+ window.localStorage.setItem(storageKey(companyId), "1");
+ } catch {
+ // ignore (private mode / storage disabled)
+ }
+ setDismissed(true);
+ }, [companyId]);
+
+ return [dismissed, dismiss];
+}
diff --git a/apps/erp/app/hooks/useImplementationNavItem.tsx b/apps/erp/app/hooks/useImplementationNavItem.tsx
new file mode 100644
index 0000000000..256befc68c
--- /dev/null
+++ b/apps/erp/app/hooks/useImplementationNavItem.tsx
@@ -0,0 +1,78 @@
+import {
+ type CheckStateRow,
+ gatesDone,
+ type HubStatus,
+ labelForTier,
+ type Signals,
+ SPINE,
+ spineForTier,
+ stateMap,
+ type Tier
+} from "@carbon/onboarding";
+import { useRouteData } from "@carbon/react";
+import { LuRocket } from "react-icons/lu";
+import type { Authenticated, NavItem } from "~/types";
+import { path } from "~/utils/path";
+
+const NO_SIGNALS = {
+ hasItems: false,
+ hasMakeMethod: false,
+ hasJob: false,
+ hasSalesOrder: false,
+ hasTrackedEntity: false
+};
+
+type AppLayoutData = {
+ implementationHub: { tier: Tier; status: HubStatus } | null;
+ implementationCheckStates: CheckStateRow[];
+ implementationSignals: Signals | null;
+};
+
+const isFinished = (status: HubStatus) =>
+ status === "complete" || status === "archived";
+
+// Shared reader: the enrolled hub (a row only exists once Carbon enrolls a
+// company), or null. Both nav entries below key off this.
+function useHub() {
+ return (
+ useRouteData<AppLayoutData>(path.to.authenticatedRoot)?.implementationHub ??
+ null
+ );
+}
+
+// The pinned "Get Started" primary-nav entry with a remaining-gates badge. Shown
+// while a hub is still in progress; gone once it's finished (see reopen entry).
+export function useImplementationNavItem(): Authenticated<NavItem> | null {
+ const data = useRouteData<AppLayoutData>(path.to.authenticatedRoot);
+ const hub = data?.implementationHub;
+ if (!hub || isFinished(hub.status)) return null;
+
+ const spine = spineForTier(SPINE, hub.tier);
+ const done = gatesDone(
+ spine,
+ stateMap(data?.implementationCheckStates ?? []),
+ data?.implementationSignals ?? NO_SIGNALS
+ );
+ const remaining = spine.length - done;
+
+ return {
+ name: labelForTier(hub.tier),
+ to: path.to.getStarted,
+ icon: LuRocket,
+ tag: remaining > 0 ? remaining : undefined
+ };
+}
+
+// The quiet "reopen" entry for a finished hub — once onboarding is wrapped up the
+// pinned item is gone, so this keeps the hub reachable (Settings → Company).
+// Null for unenrolled or still-in-progress hubs.
+export function useImplementationReopenItem(): Authenticated<NavItem> | null {
+ const hub = useHub();
+ if (!hub || !isFinished(hub.status)) return null;
+
+ return {
+ name: labelForTier(hub.tier),
+ to: path.to.getStarted,
+ icon: LuRocket
+ };
+}
diff --git a/apps/erp/app/hooks/useImplementationRealtime.tsx b/apps/erp/app/hooks/useImplementationRealtime.tsx
new file mode 100644
index 0000000000..ddfd622efb
--- /dev/null
+++ b/apps/erp/app/hooks/useImplementationRealtime.tsx
@@ -0,0 +1,58 @@
+import { useRealtimeChannel } from "@carbon/react";
+import { useRevalidator } from "react-router";
+
+// Live-sync the Implementation Hub both directions: any change by Carbon staff or
+// the customer's own users re-runs the hub loaders for every open client. Reuses
+// the shared realtime channel infra (auth + reconnect handled there).
+export function useImplementationRealtime(companyId: string) {
+ const revalidator = useRevalidator();
+
+ useRealtimeChannel({
+ topic: `implementation:${companyId}`,
+ dependencies: [companyId],
+ setup(channel) {
+ const onChange = () => revalidator.revalidate();
+ return channel
+ .on(
+ "postgres_changes",
+ {
+ event: "*",
+ schema: "public",
+ table: "implementationHub",
+ filter: `id=eq.${companyId}`
+ },
+ onChange
+ )
+ .on(
+ "postgres_changes",
+ {
+ event: "*",
+ schema: "public",
+ table: "implementationCheckState",
+ filter: `companyId=eq.${companyId}`
+ },
+ onChange
+ )
+ .on(
+ "postgres_changes",
+ {
+ event: "*",
+ schema: "public",
+ table: "implementationFieldValue",
+ filter: `companyId=eq.${companyId}`
+ },
+ onChange
+ )
+ .on(
+ "postgres_changes",
+ {
+ event: "*",
+ schema: "public",
+ table: "implementationRow",
+ filter: `companyId=eq.${companyId}`
+ },
+ onChange
+ );
+ }
+ });
+}
diff --git a/apps/erp/app/hooks/useImplementationSubmodules.tsx b/apps/erp/app/hooks/useImplementationSubmodules.tsx
new file mode 100644
index 0000000000..d59f177f98
--- /dev/null
+++ b/apps/erp/app/hooks/useImplementationSubmodules.tsx
@@ -0,0 +1,79 @@
+import {
+ EMPTY_EXCLUSIONS,
+ type HubExclusions,
+ isPageVisible,
+ PAGE_GROUP_LABEL,
+ PAGE_GROUP_ORDER,
+ REGISTRY,
+ type Tier
+} from "@carbon/onboarding";
+import { useRouteData } from "@carbon/react";
+import type { ReactNode } from "react";
+import {
+ LuClipboardCheck,
+ LuClipboardList,
+ LuDatabase,
+ LuFileText,
+ LuFlagTriangleRight,
+ LuGraduationCap,
+ LuHandshake,
+ LuLayoutDashboard,
+ LuListChecks,
+ LuRocket,
+ LuSettings,
+ LuSwords,
+ LuUsers
+} from "react-icons/lu";
+import { useCustomerPreview } from "~/hooks/useCustomerPreview";
+import { useFlags } from "~/hooks/useFlags";
+import type { AuthenticatedRouteGroup } from "~/types";
+import { path } from "~/utils/path";
+
+const ICON: Record<string, ReactNode> = {
+ start: <LuRocket />,
+ team: <LuUsers />,
+ "how-we-work": <LuHandshake />,
+ scope: <LuFileText />,
+ roles: <LuUsers />,
+ value: <LuLayoutDashboard />,
+ plan: <LuListChecks />,
+ board: <LuClipboardList />,
+ setup: <LuClipboardCheck />,
+ data: <LuDatabase />,
+ requirements: <LuFileText />,
+ "go-live": <LuFlagTriangleRight />,
+ training: <LuGraduationCap />,
+ controls: <LuSettings />,
+ positioning: <LuSwords />
+};
+
+// Grouped secondary sidebar for /x/get-started, built from the package's page
+// registry. Carbon-only pages are filtered out for non-internal users.
+export function useImplementationSubmodules() {
+ const { isInternal } = useFlags();
+ const previewingAsCustomer = useCustomerPreview();
+ // When an internal user previews as the customer, hide carbon-only pages.
+ const effectiveInternal = isInternal && !previewingAsCustomer;
+ const data = useRouteData<{
+ hub?: { exclusions?: HubExclusions; tier?: Tier };
+ }>(path.to.getStarted);
+ const exclusions = data?.hub?.exclusions ?? EMPTY_EXCLUSIONS;
+ const tier = data?.hub?.tier;
+
+ const groups: AuthenticatedRouteGroup[] = PAGE_GROUP_ORDER.map((group) => ({
+ name: PAGE_GROUP_LABEL[group],
+ routes: REGISTRY.filter((p) => p.group === group)
+ .filter((p) => isPageVisible(p, exclusions, effectiveInternal, tier))
+ .sort((a, b) => a.order - b.order)
+ .map((p) => ({
+ name: p.navLabel,
+ to:
+ p.slug === "start"
+ ? path.to.getStarted
+ : path.to.getStartedPage(p.slug),
+ icon: ICON[p.slug]
+ }))
+ })).filter((group) => group.routes.length > 0);
+
+ return { groups };
+}
diff --git a/apps/erp/app/root.tsx b/apps/erp/app/root.tsx
index 2c5904266b..892bb535bb 100644
--- a/apps/erp/app/root.tsx
+++ b/apps/erp/app/root.tsx
@@ -18,7 +18,7 @@ import {
} from "@carbon/react";
import type { Theme } from "@carbon/utils";
import { getPreferenceHeaders, modeValidator, themes } from "@carbon/utils";
-import { Trans, useLingui } from "@lingui/react/macro";
+import { Trans } from "@lingui/react/macro";
import { I18nProvider } from "@react-aria/i18n";
import { QueryClient } from "@tanstack/react-query";
import { Analytics } from "@vercel/analytics/react";
@@ -92,10 +92,10 @@ export const links: LinksFunction = () => {
];
};
-export const meta: MetaFunction = () => {
+export const meta: MetaFunction = ({ error }) => {
return [
{
- title: "Carbon"
+ title: error ? "Carbon | Error" : "Carbon"
}
];
};
@@ -191,13 +191,11 @@ export async function action({ request }: ActionFunctionArgs) {
export function Document({
children,
- title = "Carbon",
lang = "en",
mode = "light",
theme = "zinc"
}: {
children: React.ReactNode;
- title?: string;
lang?: string;
mode?: "light" | "dark";
theme?: string;
@@ -243,7 +241,6 @@ export function Document({
content="width=device-width, initial-scale=1, maximum-scale=1"
/>
<Meta />
- <title>{title}</title>
<Links />
</head>
<body className="h-full bg-background antialiased selection:bg-primary/10 selection:text-primary">
@@ -318,7 +315,6 @@ export function ErrorBoundary({ error }: Route.ErrorBoundaryProps) {
}
function ErrorBoundaryContent({ error }: { error: unknown }) {
- const { t } = useLingui();
const message = isRouteErrorResponse(error)
? (error.data.message ?? error.data)
: error instanceof Error
@@ -326,7 +322,7 @@ function ErrorBoundaryContent({ error }: { error: unknown }) {
: String(error);
return (
- <Document title={t`Error!`}>
+ <Document>
<div className="light">
<div className="flex flex-col w-full h-screen items-center justify-center space-y-4 ">
<img
diff --git a/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json b/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json
index b90c42a969..4a88ed0196 100644
--- a/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json
+++ b/apps/erp/app/routes/api+/mcp+/lib/tool-metadata.json
@@ -1,5 +1,5 @@
{
- "generated": "2026-06-26T12:06:37.782Z",
+ "generated": "2026-06-26T23:06:34.350Z",
"totalTools": 1219,
"modules": 15,
"tools": [
diff --git a/apps/erp/app/routes/onboarding+/_layout.tsx b/apps/erp/app/routes/onboarding+/_layout.tsx
index 1332b10eb0..853d650c2d 100644
--- a/apps/erp/app/routes/onboarding+/_layout.tsx
+++ b/apps/erp/app/routes/onboarding+/_layout.tsx
@@ -1,16 +1,14 @@
import { CarbonEdition } from "@carbon/auth";
import { requirePermissions } from "@carbon/auth/auth.server";
-import { TooltipProvider, useMode } from "@carbon/react";
+import { TooltipProvider } from "@carbon/react";
import { getStripeCustomerByCompanyId } from "@carbon/stripe/stripe.server";
import { Edition, isInternalEmail } from "@carbon/utils";
-import { MeshGradient } from "@paper-design/shaders-react";
-import { useEffect, useState } from "react";
import type {
LoaderFunctionArgs,
ShouldRevalidateFunction
} from "react-router";
import { Outlet, redirect } from "react-router";
-import { useTheme } from "~/hooks/useTheme";
+import { MeshGradientBackground } from "~/components/MeshGradientBackground";
import { getLocationsList } from "~/modules/resources";
import { getCompany } from "~/modules/settings";
import { onboardingSequence, path } from "~/utils/path";
@@ -72,95 +70,11 @@ export async function loader({ request }: LoaderFunctionArgs) {
};
}
-const meshColorsByTheme: Record<
- string,
- {
- light: [string, string, string, string];
- dark: [string, string, string, string];
- }
-> = {
- zinc: {
- light: ["#d4d4d8", "#f4f4f5", "#ffffff", "#e4e4e7"],
- dark: ["#18181b", "#000000", "#0D0D0D", "#050505"]
- },
- neutral: {
- light: ["#d6d3d1", "#f5f5f4", "#ffffff", "#e7e5e4"],
- dark: ["#1c1917", "#000000", "#0D0D0D", "#050505"]
- },
- red: {
- light: ["#fecdd3", "#fff1f2", "#ffffff", "#ffe4e6"],
- dark: ["#2d0a0a", "#000000", "#0D0D0D", "#050505"]
- },
- orange: {
- light: ["#fed7aa", "#fff7ed", "#ffffff", "#ffedd5"],
- dark: ["#2d1a0a", "#000000", "#0D0D0D", "#050505"]
- },
- yellow: {
- light: ["#fde68a", "#fefce8", "#ffffff", "#fef9c3"],
- dark: ["#2d2a0a", "#000000", "#0D0D0D", "#050505"]
- },
- green: {
- light: ["#a7f3d0", "#ecfdf5", "#ffffff", "#d1fae5"],
- dark: ["#023225", "#000000", "#0D0D0D", "#050505"]
- },
- blue: {
- light: ["#bdcdff", "#f7f5ff", "#ffffff", "#e6f3ff"],
- dark: ["#0a1a2d", "#000000", "#0D0D0D", "#050505"]
- },
- violet: {
- light: ["#c4b5fd", "#f5f3ff", "#ffffff", "#ede9fe"],
- dark: ["#1e0a2d", "#000000", "#0D0D0D", "#050505"]
- }
-};
-
-function getMeshColors(theme: string, mode: string) {
- const colors = meshColorsByTheme[theme] ?? meshColorsByTheme.blue;
- return mode === "light" ? colors.light : colors.dark;
-}
-
-function getBackgroundGradient(theme: string, mode: string) {
- const colors = getMeshColors(theme, mode);
- return `linear-gradient(to bottom right, ${colors[1]} 35.67%, ${colors[0]} 88.95%)`;
-}
-
export default function OnboardingLayout() {
- const mode = useMode();
- const serverTheme = useTheme();
- const [theme, setTheme] = useState(serverTheme);
-
- useEffect(() => {
- setTheme(serverTheme);
- }, [serverTheme]);
-
- useEffect(() => {
- const handler = (e: Event) => {
- setTheme((e as CustomEvent<string>).detail);
- };
- window.addEventListener("onboarding-theme-change", handler);
- return () => window.removeEventListener("onboarding-theme-change", handler);
- }, []);
-
- const meshGradientColors = getMeshColors(theme, mode);
- const backgroundGradient = getBackgroundGradient(theme, mode);
-
return (
<TooltipProvider>
<div className="relative h-screen w-screen">
- <div
- className="absolute inset-0"
- style={{ background: backgroundGradient }}
- >
- <MeshGradient
- speed={1}
- colors={meshGradientColors}
- distortion={0.8}
- swirl={0.1}
- grainMixer={0}
- grainOverlay={0}
- className="absolute inset-0 w-full h-full"
- style={{ height: "100%", width: "100%" }}
- />
- </div>
+ <MeshGradientBackground />
<div className="relative z-10 flex h-full w-full items-center justify-center p-4">
<Outlet />
</div>
diff --git a/apps/erp/app/routes/x+/_index.tsx b/apps/erp/app/routes/x+/_index.tsx
index 2134eb2541..639de1f95c 100644
--- a/apps/erp/app/routes/x+/_index.tsx
+++ b/apps/erp/app/routes/x+/_index.tsx
@@ -1,12 +1,97 @@
-import { cn } from "@carbon/react";
+import { requirePermissions } from "@carbon/auth/auth.server";
+import {
+ type CheckStateRow,
+ gatesDone,
+ type HubStatus,
+ labelForTier,
+ nextAction,
+ type Signals,
+ SPINE,
+ spineForTier,
+ stateMap,
+ type Tier
+} from "@carbon/onboarding";
+import {
+ detectImplementationSignals,
+ getImplementationCheckStates,
+ getImplementationHub
+} from "@carbon/onboarding/server";
+import { OnboardingHubSummary } from "@carbon/onboarding/ui";
+import { Button, cn, useRouteData } from "@carbon/react";
+import { isInternalEmail } from "@carbon/utils";
import { getLocalTimeZone } from "@internationalized/date";
import { useLocale } from "@react-aria/i18n";
import type { ComponentProps } from "react";
import { useMemo } from "react";
-import { Link } from "react-router";
+import type { LoaderFunctionArgs } from "react-router";
+import { Link, redirect, useFetcher } from "react-router";
import { Greeting } from "~/components/Greeting";
-import { useModules } from "~/hooks";
+import { useModules, useUser } from "~/hooks";
+import { useFlags } from "~/hooks/useFlags";
+import { useHubDismissed } from "~/hooks/useHubDismissed";
import type { Authenticated, NavItem } from "~/types";
+import { path } from "~/utils/path";
+
+// The onboarding hub is internal-only and, while it's active (not yet finished),
+// it replaces the home page — so an internal user lands straight in it until
+// every checkpoint is done.
+export async function loader({ request }: LoaderFunctionArgs) {
+ const { client, companyId, email } = await requirePermissions(request, {});
+ if (isInternalEmail(email)) {
+ const hub = await getImplementationHub(client, companyId);
+ const status = hub.data?.status;
+ if (hub.data && status !== "complete" && status !== "archived") {
+ const [states, signals] = await Promise.all([
+ getImplementationCheckStates(client, companyId),
+ detectImplementationSignals(client, companyId)
+ ]);
+ const spine = spineForTier(SPINE, hub.data.tier);
+ const done = gatesDone(spine, stateMap(states.data ?? []), signals);
+ if (done < spine.length) throw redirect(path.to.getStarted);
+ }
+ }
+ return null;
+}
+
+const NO_SIGNALS: Signals = {
+ hasItems: false,
+ hasMakeMethod: false,
+ hasJob: false,
+ hasSalesOrder: false,
+ hasTrackedEntity: false
+};
+
+function useImplementationSummary() {
+ const data = useRouteData<{
+ implementationHub: { tier: Tier; status: HubStatus } | null;
+ implementationCheckStates: CheckStateRow[];
+ implementationSignals: Signals | null;
+ }>(path.to.authenticatedRoot);
+ const { company } = useUser();
+ const [dismissed, dismiss] = useHubDismissed(company.id);
+
+ const hub = data?.implementationHub;
+ // Shown only to enrolled companies — a hub row exists once Carbon enrolls them.
+ if (!hub || hub.status === "complete" || hub.status === "archived") {
+ return null;
+ }
+ const map = stateMap(data?.implementationCheckStates ?? []);
+ const signals = data?.implementationSignals ?? NO_SIGNALS;
+ const spine = spineForTier(SPINE, hub.tier);
+ const done = gatesDone(spine, map, signals);
+ const total = spine.length;
+ // Auto-hide once everything's done, or once the user dismissed it.
+ if (done === total || dismissed) return null;
+
+ const next = nextAction(spine, map, signals);
+ return {
+ label: labelForTier(hub.tier),
+ done,
+ total,
+ nextLabel: next?.title,
+ dismiss
+ };
+}
export default function AppIndexRoute() {
const modules = useModules();
@@ -21,11 +106,61 @@ export default function AppIndexRoute() {
}),
[locale]
);
+ const implementation = useImplementationSummary();
+ const layout = useRouteData<{ implementationHub: unknown | null }>(
+ path.to.authenticatedRoot
+ );
+ const { isInternal } = useFlags();
+ const enrollFetcher = useFetcher();
+ const canEnroll = isInternal && !layout?.implementationHub;
+
return (
<div className="p-8 w-full h-full bg-muted">
<Greeting size="h3" />
<Subheading>{formatter.format(date)}</Subheading>
<Hr />
+ {implementation ? (
+ <OnboardingHubSummary
+ label={implementation.label}
+ done={implementation.done}
+ total={implementation.total}
+ nextLabel={implementation.nextLabel}
+ onDismiss={implementation.dismiss}
+ action={
+ <Button asChild>
+ <Link to={path.to.getStarted} prefetch="intent">
+ Open
+ </Link>
+ </Button>
+ }
+ />
+ ) : null}
+ {canEnroll ? (
+ <enrollFetcher.Form
+ method="post"
+ action={path.to.getStartedEnroll}
+ className="mb-6"
+ >
+ <div className="rounded-2xl border border-dashed bg-card shadow-button-base p-6 flex items-center gap-5">
+ <div className="flex-1 min-w-0">
+ <h3 className="text-base font-semibold tracking-tight">
+ Enroll this company in the Implementation Hub
+ </h3>
+ <p className="text-sm text-muted-foreground mt-1">
+ Carbon-only · creates the hub for the current company so you can
+ preview it.
+ </p>
+ </div>
+ <Button
+ type="submit"
+ isLoading={enrollFetcher.state !== "idle"}
+ isDisabled={enrollFetcher.state !== "idle"}
+ >
+ Enroll
+ </Button>
+ </div>
+ </enrollFetcher.Form>
+ ) : null}
<div className="grid grid-cols-[repeat(auto-fill,minmax(min(100%,300px),1fr))] gap-6 mb-8">
{modules
.filter((mod) => mod.key !== "settings")
diff --git a/apps/erp/app/routes/x+/_layout.tsx b/apps/erp/app/routes/x+/_layout.tsx
index f7fa53cda4..a730cec546 100644
--- a/apps/erp/app/routes/x+/_layout.tsx
+++ b/apps/erp/app/routes/x+/_layout.tsx
@@ -12,6 +12,11 @@ import {
updateCompanySession
} from "@carbon/auth/session.server";
import { isAuditLogEnabled } from "@carbon/database/audit";
+import {
+ detectImplementationSignals,
+ getImplementationCheckStates,
+ getImplementationHub
+} from "@carbon/onboarding/server";
import type { PrintingSettings } from "@carbon/printing";
import { getPrinterRoutes } from "@carbon/printing";
import { PrintingProvider } from "@carbon/printing/ui";
@@ -73,6 +78,7 @@ export const shouldRevalidate: ShouldRevalidateFunction = ({
currentUrl.pathname.startsWith("/x/users") ||
currentUrl.pathname.startsWith("/refresh-session") ||
currentUrl.pathname.startsWith("/x/acknowledge") ||
+ currentUrl.pathname.startsWith("/x/get-started") ||
currentUrl.pathname.startsWith("/x/shared/views")
) {
return true;
@@ -117,7 +123,9 @@ export async function loader({ request }: LoaderFunctionArgs) {
defaults,
auditLogEnabled,
modulePreferences,
- printerRoutes
+ printerRoutes,
+ implementationHub,
+ implementationCheckStates
] = await Promise.all([
getCompanies(client, userId),
getEmployeeCompanies(client, userId),
@@ -132,7 +140,9 @@ export async function loader({ request }: LoaderFunctionArgs) {
getUserDefaults(client, userId, companyId),
isAuditLogEnabled(client, companyId),
getModulePreferences(client, userId, companyId),
- getPrinterRoutes(client, companyId)
+ getPrinterRoutes(client, companyId),
+ getImplementationHub(client, companyId),
+ getImplementationCheckStates(client, companyId)
]);
if (!claims || user.error || !user.data || !groups.data) {
@@ -188,6 +198,12 @@ export async function loader({ request }: LoaderFunctionArgs) {
throw redirect(path.to.onboarding.root);
}
+ // Only probe product signals when the company is actually enrolled, so the
+ // home card + nav badge count gates the same way the hub page does.
+ const implementationSignals = implementationHub.data
+ ? await detectImplementationSignals(client, companyId)
+ : null;
+
return data({
session: {
accessToken,
@@ -209,6 +225,9 @@ export async function loader({ request }: LoaderFunctionArgs) {
modulePreferences: modulePreferences.data ?? [],
savedViews: savedViews.data ?? [],
printerRoutes: printerRoutes.data ?? [],
+ implementationHub: implementationHub.data ?? null,
+ implementationCheckStates: implementationCheckStates.data ?? [],
+ implementationSignals,
supplierApprovalRequired: isApprovalRequired(client, "supplier", companyId),
openClockEntry: companySettings.data?.timeCardEnabled
? getOpenClockEntry(client, userId, companyId)
diff --git a/apps/erp/app/routes/x+/get-started+/$slug.tsx b/apps/erp/app/routes/x+/get-started+/$slug.tsx
new file mode 100644
index 0000000000..0440991bd5
--- /dev/null
+++ b/apps/erp/app/routes/x+/get-started+/$slug.tsx
@@ -0,0 +1,11 @@
+import { pageBySlug } from "@carbon/onboarding";
+import { PlaceholderPage } from "@carbon/onboarding/ui";
+import { useParams } from "react-router";
+
+// Catch-all for hub pages not yet built (everything past Start Here in P1).
+// A real route file (e.g. plan.tsx) takes precedence as each page ships.
+export default function GetStartedPlaceholderRoute() {
+ const { slug } = useParams();
+ const page = slug ? pageBySlug(slug) : undefined;
+ return <PlaceholderPage title={page?.title ?? "Implementation Hub"} />;
+}
diff --git a/apps/erp/app/routes/x+/get-started+/_index.tsx b/apps/erp/app/routes/x+/get-started+/_index.tsx
new file mode 100644
index 0000000000..b88e88b538
--- /dev/null
+++ b/apps/erp/app/routes/x+/get-started+/_index.tsx
@@ -0,0 +1,163 @@
+import { planAnchorId, SUPPORT_BOOKING_URL } from "@carbon/onboarding";
+import { OnboardingHub } from "@carbon/onboarding/ui";
+import {
+ Button,
+ Modal,
+ ModalContent,
+ ModalDescription,
+ ModalFooter,
+ ModalHeader,
+ ModalTitle
+} from "@carbon/react";
+import { useEffect, useRef, useState } from "react";
+import Confetti from "react-confetti";
+import { createPortal } from "react-dom";
+import { useFetcher, useLocation, useNavigate } from "react-router";
+import { useUser } from "~/hooks";
+import { path } from "~/utils/path";
+import { trainingConfig } from "~/utils/training";
+
+// Each nested product step opens where you do it. "Set up your data" lands on
+// the Setup Map — the configuration checklist that deep-links each ERP screen —
+// rather than jumping straight into one screen.
+const PRODUCT_PATH: Record<string, string> = {
+ "prod:configure-data": path.to.getStartedPage("setup"),
+ "prod:configure-bom": path.to.parts,
+ "prod:configure-builtins": path.to.production,
+ "prod:purchase-make": path.to.jobs,
+ "prod:serialize-sell": path.to.salesOrders
+};
+
+// Hub state comes from <HubProvider> in the layout. This route only injects the
+// Carbon-app routing + video resolution the package can't reach.
+export default function GetStartedStartRoute() {
+ const { company } = useUser();
+ const navigate = useNavigate();
+ const location = useLocation();
+ const [celebrate, setCelebrate] = useState(false);
+ const [exitOpen, setExitOpen] = useState(false);
+ // Viewport size for the full-screen canvas (window is undefined during SSR).
+ const [size, setSize] = useState({ width: 0, height: 0 });
+ useEffect(() => {
+ const update = () =>
+ setSize({ width: window.innerWidth, height: window.innerHeight });
+ update();
+ window.addEventListener("resize", update);
+ return () => window.removeEventListener("resize", update);
+ }, []);
+
+ // Celebrate when the layout routes here right after the final checkpoint
+ // clears (it passes `justCompleted`). Cleared from history so a refresh or
+ // back-nav doesn't replay the confetti.
+ const justCompleted = (location.state as { justCompleted?: boolean } | null)
+ ?.justCompleted;
+ useEffect(() => {
+ if (justCompleted) {
+ setCelebrate(true);
+ navigate(".", { replace: true, state: {} });
+ }
+ }, [justCompleted, navigate]);
+
+ // Also fire if the final gate flips while the user is already on this screen.
+ const onComplete = () => {
+ setCelebrate(true);
+ };
+
+ // Exiting writes status="complete" through the state action, then sends the
+ // customer to the (now un-hijacked) app home. A dedicated fetcher lets us wait
+ // for the write to land before navigating away and unmounting this route.
+ const exitFetcher = useFetcher<{ success?: boolean }>();
+ const exitingRef = useRef(false);
+ const confirmExit = () => {
+ exitingRef.current = true;
+ exitFetcher.submit(
+ { intent: "setStatus", status: "complete" },
+ { method: "post", action: path.to.getStartedState }
+ );
+ };
+ useEffect(() => {
+ if (
+ exitingRef.current &&
+ exitFetcher.state === "idle" &&
+ exitFetcher.data &&
+ exitFetcher.data.success !== false
+ ) {
+ exitingRef.current = false;
+ setExitOpen(false);
+ navigate(path.to.authenticatedRoot);
+ }
+ }, [exitFetcher.state, exitFetcher.data, navigate]);
+
+ const exiting = exitFetcher.state !== "idle";
+
+ return (
+ <>
+ {celebrate && size.width > 0
+ ? createPortal(
+ // Portal to <body>: the get-started layout has overflow-hidden +
+ // transformed ancestors that would clip/contain a fixed canvas.
+ <Confetti
+ width={size.width}
+ height={size.height}
+ recycle={false}
+ numberOfPieces={500}
+ gravity={0.25}
+ style={{ position: "fixed", inset: 0, zIndex: 9999 }}
+ onConfettiComplete={(confetti) => {
+ confetti?.reset();
+ setCelebrate(false);
+ }}
+ />,
+ document.body
+ )
+ : null}
+ <OnboardingHub
+ companyName={company.name}
+ onComplete={onComplete}
+ onExit={() => setExitOpen(true)}
+ onContactExpert={() =>
+ window.open(SUPPORT_BOOKING_URL, "_blank", "noopener,noreferrer")
+ }
+ onOpenProduct={(key) =>
+ navigate(PRODUCT_PATH[key] ?? path.to.getStarted)
+ }
+ onOpenPage={(slug) => navigate(path.to.getStartedPage(slug))}
+ onOpenInPlan={(stepKey) =>
+ navigate(`${path.to.getStartedPage("plan")}#${planAnchorId(stepKey)}`)
+ }
+ resolveVideoUrl={(videoKey) => {
+ const video = trainingConfig[videoKey];
+ return video?.academyUrl ?? video?.videoUrl;
+ }}
+ />
+
+ <Modal open={exitOpen} onOpenChange={setExitOpen}>
+ <ModalContent>
+ <ModalHeader>
+ <ModalTitle>Finish onboarding?</ModalTitle>
+ <ModalDescription>
+ Every phase is done. The home screen goes back to normal — you can
+ reopen this hub anytime from the nav.
+ </ModalDescription>
+ </ModalHeader>
+ <ModalFooter>
+ <Button
+ variant="secondary"
+ onClick={() => setExitOpen(false)}
+ isDisabled={exiting}
+ >
+ Not yet
+ </Button>
+ <Button
+ onClick={confirmExit}
+ isLoading={exiting}
+ isDisabled={exiting}
+ >
+ Finish onboarding
+ </Button>
+ </ModalFooter>
+ </ModalContent>
+ </Modal>
+ </>
+ );
+}
diff --git a/apps/erp/app/routes/x+/get-started+/_layout.tsx b/apps/erp/app/routes/x+/get-started+/_layout.tsx
new file mode 100644
index 0000000000..5fa999057d
--- /dev/null
+++ b/apps/erp/app/routes/x+/get-started+/_layout.tsx
@@ -0,0 +1,290 @@
+import { requirePermissions } from "@carbon/auth/auth.server";
+import {
+ EMPTY_EXCLUSIONS,
+ gatesDone,
+ type HubContacts,
+ type HubExclusions,
+ type ImplementationRowData,
+ SPINE,
+ spineForTier,
+ stateMap
+} from "@carbon/onboarding";
+import {
+ detectImplementationSignals,
+ getImplementationCheckStates,
+ getImplementationFieldValues,
+ getImplementationHub,
+ getImplementationRows
+} from "@carbon/onboarding/server";
+import {
+ type HubData,
+ type HubFlags,
+ type HubMutation,
+ HubProvider,
+ toFormFields
+} from "@carbon/onboarding/ui";
+import { msg } from "@lingui/core/macro";
+import { useCallback, useEffect, useMemo, useRef } from "react";
+import type { LoaderFunctionArgs, MetaFunction } from "react-router";
+import {
+ Outlet,
+ redirect,
+ useFetcher,
+ useLoaderData,
+ useLocation,
+ useNavigate
+} from "react-router";
+import { GroupedContentSidebar } from "~/components/Layout";
+import { CollapsibleSidebarProvider } from "~/components/Layout/Navigation";
+import { MeshGradientBackground } from "~/components/MeshGradientBackground";
+import { useUser } from "~/hooks";
+import {
+ setCustomerPreview,
+ useCustomerPreview
+} from "~/hooks/useCustomerPreview";
+import { useFlags } from "~/hooks/useFlags";
+import { useImplementationRealtime } from "~/hooks/useImplementationRealtime";
+import { useImplementationSubmodules } from "~/hooks/useImplementationSubmodules";
+import type { Handle } from "~/utils/handle";
+import { path } from "~/utils/path";
+import { trainingConfig } from "~/utils/training";
+
+export const meta: MetaFunction = () => {
+ return [{ title: "Carbon | Get Started" }];
+};
+
+// Deep links from the Setup Map: each setup row's stable key → the ERP screen
+// where you configure that thing. Keys without a screen are simply omitted (the
+// row renders as plain text). Add an entry here when a new setup row needs a link.
+const SETUP_SCREEN_PATHS: Record<string, string> = {
+ company: path.to.company,
+ "document-templates": path.to.documentTemplates,
+ logos: path.to.logos,
+ printing: path.to.printingSettings,
+ sequences: path.to.sequences,
+ "custom-fields": path.to.customFields,
+ integrations: path.to.integrations,
+ "approval-rules": path.to.approvalRules,
+ locations: path.to.locations,
+ "work-centers": path.to.workCenters,
+ processes: path.to.processes,
+ training: path.to.abilities,
+ "failure-modes": path.to.failureModes,
+ employees: path.to.employeeAccounts,
+ departments: path.to.departments,
+ shifts: path.to.shifts,
+ holidays: path.to.holidays,
+ attributes: path.to.attributes,
+ "employee-types": path.to.employeeTypes,
+ groups: path.to.groups,
+ units: path.to.uoms,
+ parts: path.to.parts,
+ materials: path.to.materials,
+ tools: path.to.tools,
+ consumables: path.to.consumables,
+ "material-dimensions": path.to.materialDimensions,
+ "material-types": path.to.materialTypes,
+ "material-substances": path.to.materialSubstances,
+ "material-shapes": path.to.materialForms,
+ "material-grades": path.to.materialGrades,
+ "material-finishes": path.to.materialFinishes,
+ customers: path.to.customers,
+ "customer-types": path.to.customerTypes,
+ "customer-statuses": path.to.customerStatuses,
+ "price-lists": path.to.salesPriceList,
+ "pricing-rules": path.to.salesPricingRules,
+ "no-quote-reasons": path.to.noQuoteReasons,
+ suppliers: path.to.suppliers,
+ "supplier-types": path.to.supplierTypes,
+ "item-groups": path.to.itemPostingGroups,
+ "accounting-dimensions": path.to.dimensions,
+ "storage-units": path.to.storageUnits,
+ "storage-types": path.to.storageTypes,
+ "storage-rules": path.to.storageRules,
+ "shipping-methods": path.to.shippingMethods,
+ "chart-of-accounts": path.to.chartOfAccounts,
+ "default-accounts": path.to.accountingDefaults,
+ "cost-centers": path.to.costCenters,
+ "payment-terms": path.to.paymentTerms,
+ "exchange-rates": path.to.exchangeRates,
+ "fiscal-year": path.to.fiscalYears,
+ "asset-classes": path.to.assetClasses,
+ "scrap-reasons": path.to.scrapReasons,
+ "maintenance-schedules": path.to.maintenanceSchedules
+};
+
+const resolveScreenUrl = (appKey: string): string | undefined =>
+ SETUP_SCREEN_PATHS[appKey];
+
+// Resolve a training video key (on a nested product step) to a watch URL, via
+// the ERP trainingConfig — prefers the Academy course, falls back to the video.
+const resolveVideoUrl = (videoKey: string): string | undefined => {
+ const video = trainingConfig[videoKey];
+ return video?.academyUrl ?? video?.videoUrl;
+};
+
+export const handle: Handle = {
+ breadcrumb: msg`Get Started`,
+ to: path.to.getStarted
+};
+
+export async function loader({ request }: LoaderFunctionArgs) {
+ const { client, companyId } = await requirePermissions(request, {});
+
+ const hub = await getImplementationHub(client, companyId);
+ // Only enrolled companies have a hub row — others never reach this surface.
+ // Enrollment is the gate (manual today; Cloud auto-enroll later), not staff.
+ if (!hub.data) {
+ throw redirect(path.to.authenticatedRoot);
+ }
+
+ const [checkStates, fieldValues, rows, signals] = await Promise.all([
+ getImplementationCheckStates(client, companyId),
+ getImplementationFieldValues(client, companyId),
+ getImplementationRows(client, companyId),
+ detectImplementationSignals(client, companyId)
+ ]);
+
+ return {
+ hub: hub.data,
+ checkStates: checkStates.data ?? [],
+ fieldValues: fieldValues.data ?? [],
+ rows: rows.data ?? [],
+ signals
+ };
+}
+
+export default function GetStartedLayout() {
+ const { company } = useUser();
+ const { isInternal } = useFlags();
+ const previewingAsCustomer = useCustomerPreview();
+ useImplementationRealtime(company.id);
+ const { groups } = useImplementationSubmodules();
+
+ const loaderData = useLoaderData<typeof loader>();
+ const fetcher = useFetcher();
+ const navigate = useNavigate();
+ const location = useLocation();
+
+ // When the customer clears the final checkpoint anywhere (typically the Plan),
+ // send them to the command center so they land on the confetti + the exit
+ // dialog. Session-only: the ref seeds from the current value so a reload while
+ // already complete doesn't re-fire, and an exited hub (status "complete") is
+ // skipped entirely.
+ const spine = spineForTier(SPINE, loaderData.hub.tier);
+ const allPhasesDone =
+ spine.length > 0 &&
+ gatesDone(spine, stateMap(loaderData.checkStates), loaderData.signals) ===
+ spine.length;
+ const wasAllDone = useRef(allPhasesDone);
+ useEffect(() => {
+ if (
+ allPhasesDone &&
+ !wasAllDone.current &&
+ loaderData.hub.status !== "complete" &&
+ location.pathname !== path.to.getStarted
+ ) {
+ navigate(path.to.getStarted, { state: { justCompleted: true } });
+ }
+ wasAllDone.current = allPhasesDone;
+ }, [allPhasesDone, loaderData.hub.status, location.pathname, navigate]);
+
+ // The hub's single write path: every mutation submits to the /state action,
+ // which persists + revalidates the loader (server stays the source of truth).
+ const dispatch = useCallback(
+ (m: HubMutation) =>
+ fetcher.submit(toFormFields(m), {
+ method: "post",
+ action: path.to.getStartedState
+ }),
+ [fetcher]
+ );
+
+ const hubData = useMemo<HubData>(
+ () => ({
+ tier: loaderData.hub.tier,
+ status: loaderData.hub.status,
+ exclusions:
+ (loaderData.hub.exclusions as unknown as HubExclusions) ??
+ EMPTY_EXCLUSIONS,
+ contacts: (loaderData.hub.contacts as unknown as HubContacts) ?? {},
+ checkStates: loaderData.checkStates,
+ fieldValues: loaderData.fieldValues,
+ rows: loaderData.rows as unknown as ImplementationRowData[],
+ signals: loaderData.signals
+ }),
+ [loaderData]
+ );
+
+ const flags = useMemo<HubFlags>(
+ () => ({
+ isInternal,
+ previewing: previewingAsCustomer,
+ canEdit: isInternal && !previewingAsCustomer
+ }),
+ [isInternal, previewingAsCustomer]
+ );
+
+ return (
+ <CollapsibleSidebarProvider>
+ <div className="grid grid-cols-[auto_1fr] grid-rows-[minmax(0,1fr)] w-full h-full overflow-hidden">
+ <GroupedContentSidebar groups={groups} exactMatch />
+ <div className="relative min-w-0 overflow-hidden">
+ <MeshGradientBackground theme="blue" />
+ <div className="relative z-10 h-full overflow-y-auto">
+ {isInternal ? (
+ <PreviewBar previewing={previewingAsCustomer} />
+ ) : null}
+ <div className="p-8">
+ <HubProvider
+ data={hubData}
+ flags={flags}
+ dispatch={dispatch}
+ resolveScreenUrl={resolveScreenUrl}
+ resolveVideoUrl={resolveVideoUrl}
+ >
+ <Outlet />
+ </HubProvider>
+ </div>
+ </div>
+ </div>
+ </div>
+ </CollapsibleSidebarProvider>
+ );
+}
+
+// Internal-only bar: enter or exit the customer preview. State lives in
+// sessionStorage (useCustomerPreview), so toggling is a button, not navigation —
+// it persists across pages + reloads without a URL param.
+function PreviewBar({ previewing }: { previewing: boolean }) {
+ if (previewing) {
+ return (
+ <div className="sticky top-0 z-20 flex items-center gap-3 px-8 py-2 bg-amber-500/15 border-b border-amber-500/20 text-sm backdrop-blur-sm">
+ <span className="text-amber-700 dark:text-amber-400 font-medium">
+ Customer preview
+ </span>
+ <span className="text-muted-foreground">
+ Internal pages and locked fields are hidden.
+ </span>
+ <button
+ type="button"
+ onClick={() => setCustomerPreview(false)}
+ className="ml-auto font-medium text-amber-700 dark:text-amber-400 hover:underline"
+ >
+ Exit preview
+ </button>
+ </div>
+ );
+ }
+ return (
+ <div className="sticky top-0 z-20 flex items-center justify-end px-8 py-2">
+ <button
+ type="button"
+ onClick={() => setCustomerPreview(true)}
+ className="text-xs font-medium text-muted-foreground hover:text-foreground rounded-full border bg-card px-3 py-1 shadow-button-base"
+ >
+ Preview as customer
+ </button>
+ </div>
+ );
+}
diff --git a/apps/erp/app/routes/x+/get-started+/board.tsx b/apps/erp/app/routes/x+/get-started+/board.tsx
new file mode 100644
index 0000000000..b4a8170a6e
--- /dev/null
+++ b/apps/erp/app/routes/x+/get-started+/board.tsx
@@ -0,0 +1,8 @@
+import { redirect } from "react-router";
+import { path } from "~/utils/path";
+
+// The board is now a view of the combined Plan & Board page. Keep this path
+// working (old links, bookmarks) by redirecting to the board view.
+export function loader() {
+ return redirect(`${path.to.getStartedPage("plan")}?view=board`);
+}
diff --git a/apps/erp/app/routes/x+/get-started+/controls.tsx b/apps/erp/app/routes/x+/get-started+/controls.tsx
new file mode 100644
index 0000000000..9cf8085121
--- /dev/null
+++ b/apps/erp/app/routes/x+/get-started+/controls.tsx
@@ -0,0 +1,24 @@
+import { requirePermissions } from "@carbon/auth/auth.server";
+import { SetupControls } from "@carbon/onboarding/ui";
+import type { LoaderFunctionArgs } from "react-router";
+import { redirect } from "react-router";
+import { path } from "~/utils/path";
+
+const INTERNAL_DOMAINS = ["@carbon.us.org", "@carbon.ms"];
+
+// Carbon-only page: hard-gate non-internal users server-side. State + mutations
+// come from <HubProvider> in the layout.
+export async function loader({ request }: LoaderFunctionArgs) {
+ const { email } = await requirePermissions(request, {});
+ const isInternal = INTERNAL_DOMAINS.some((domain) =>
+ email.toLowerCase().trim().endsWith(domain)
+ );
+ if (!isInternal) {
+ throw redirect(path.to.getStarted);
+ }
+ return null;
+}
+
+export default function GetStartedControlsRoute() {
+ return <SetupControls />;
+}
diff --git a/apps/erp/app/routes/x+/get-started+/data.tsx b/apps/erp/app/routes/x+/get-started+/data.tsx
new file mode 100644
index 0000000000..c41a2aec47
--- /dev/null
+++ b/apps/erp/app/routes/x+/get-started+/data.tsx
@@ -0,0 +1,7 @@
+import { DataMigrationView } from "@carbon/onboarding/ui";
+
+// State, flags, and mutations come from <HubProvider> in the layout — the view
+// reads them via hub hooks, so the route is just the mount point.
+export default function GetStartedDataRoute() {
+ return <DataMigrationView />;
+}
diff --git a/apps/erp/app/routes/x+/get-started+/enroll.tsx b/apps/erp/app/routes/x+/get-started+/enroll.tsx
new file mode 100644
index 0000000000..9562101f8d
--- /dev/null
+++ b/apps/erp/app/routes/x+/get-started+/enroll.tsx
@@ -0,0 +1,46 @@
+import { assertIsPost, error } from "@carbon/auth";
+import { requirePermissions } from "@carbon/auth/auth.server";
+import { getCarbonServiceRole } from "@carbon/auth/client.server";
+import { flash } from "@carbon/auth/session.server";
+import { enrollImplementation } from "@carbon/onboarding/server";
+import type { ActionFunctionArgs } from "react-router";
+import { data, redirect } from "react-router";
+import { path } from "~/utils/path";
+
+const INTERNAL_DOMAINS = ["@carbon.us.org", "@carbon.ms"];
+
+// Internal-only: enroll the CURRENT company into the Implementation Hub so staff
+// can flip an existing company without creating a fresh signup. New Cloud
+// signups enroll automatically (onboarding+/company.tsx).
+export async function action({ request }: ActionFunctionArgs) {
+ assertIsPost(request);
+ const { companyId, userId, email } = await requirePermissions(request, {});
+
+ const isInternal = INTERNAL_DOMAINS.some((domain) =>
+ email.toLowerCase().trim().endsWith(domain)
+ );
+ if (!isInternal) {
+ return data(
+ { success: false },
+ await flash(
+ request,
+ error(new Error("forbidden"), "Only Carbon staff can enroll a company")
+ )
+ );
+ }
+
+ const serviceRole = getCarbonServiceRole();
+ const result = await enrollImplementation(serviceRole, {
+ companyId,
+ userId,
+ tier: "self_serve"
+ });
+ if (result.error) {
+ return data(
+ { success: false },
+ await flash(request, error(result.error, "Failed to enroll company"))
+ );
+ }
+
+ throw redirect(path.to.getStarted);
+}
diff --git a/apps/erp/app/routes/x+/get-started+/go-live.tsx b/apps/erp/app/routes/x+/get-started+/go-live.tsx
new file mode 100644
index 0000000000..42d2041f00
--- /dev/null
+++ b/apps/erp/app/routes/x+/get-started+/go-live.tsx
@@ -0,0 +1,6 @@
+import { GoLiveView } from "@carbon/onboarding/ui";
+
+// State, flags, and mutations come from <HubProvider> in the layout.
+export default function GetStartedGoLiveRoute() {
+ return <GoLiveView />;
+}
diff --git a/apps/erp/app/routes/x+/get-started+/how-we-work.tsx b/apps/erp/app/routes/x+/get-started+/how-we-work.tsx
new file mode 100644
index 0000000000..7a629ebdcb
--- /dev/null
+++ b/apps/erp/app/routes/x+/get-started+/how-we-work.tsx
@@ -0,0 +1,5 @@
+import { HowWeWorkView } from "@carbon/onboarding/ui";
+
+export default function GetStartedHowWeWorkRoute() {
+ return <HowWeWorkView />;
+}
diff --git a/apps/erp/app/routes/x+/get-started+/plan.tsx b/apps/erp/app/routes/x+/get-started+/plan.tsx
new file mode 100644
index 0000000000..d9c931d954
--- /dev/null
+++ b/apps/erp/app/routes/x+/get-started+/plan.tsx
@@ -0,0 +1,74 @@
+import { BoardTable, PlanView } from "@carbon/onboarding/ui";
+import { cn } from "@carbon/react";
+import { useEffect } from "react";
+import { LuClipboardList, LuListChecks } from "react-icons/lu";
+import { useLocation, useSearchParams } from "react-router";
+
+const VIEWS = [
+ { key: "plan", label: "Plan", icon: <LuListChecks /> },
+ { key: "board", label: "Board", icon: <LuClipboardList /> }
+] as const;
+
+// Plan and Board are two views of the same tasks (status is shared state, no
+// drift). One route hosts both; `?view=board` switches. The hub's "View in
+// project plan" deep-links here with no param, so Plan stays the default.
+// State + mutations come from <HubProvider> in the layout.
+export default function GetStartedPlanRoute() {
+ const { hash } = useLocation();
+ const [searchParams, setSearchParams] = useSearchParams();
+ const view = searchParams.get("view") === "board" ? "board" : "plan";
+
+ // Scroll to (and briefly highlight) the step card linked from the hub. Plan
+ // view only — the anchors live on the plan cards.
+ useEffect(() => {
+ if (view !== "plan" || !hash) return;
+ const el = document.getElementById(hash.slice(1));
+ if (!el) return;
+ el.scrollIntoView({ behavior: "smooth", block: "start" });
+ el.classList.add("ring-2", "ring-primary");
+ const t = setTimeout(
+ () => el.classList.remove("ring-2", "ring-primary"),
+ 1600
+ );
+ return () => clearTimeout(t);
+ }, [hash, view]);
+
+ const selectView = (next: (typeof VIEWS)[number]["key"]) => {
+ setSearchParams(
+ (prev) => {
+ if (next === "plan") prev.delete("view");
+ else prev.set("view", next);
+ return prev;
+ },
+ { replace: true, preventScrollReset: true }
+ );
+ };
+
+ return (
+ <div className="flex flex-col gap-6">
+ <div className="w-full max-w-4xl mx-auto flex justify-center">
+ <div className="inline-flex items-center gap-1 rounded-full border bg-card p-1 shadow-button-base">
+ {VIEWS.map((v) => (
+ <button
+ key={v.key}
+ type="button"
+ onClick={() => selectView(v.key)}
+ aria-pressed={view === v.key}
+ className={cn(
+ "inline-flex items-center gap-1.5 rounded-full px-4 py-1.5 text-sm font-medium transition-colors active:scale-[0.97]",
+ view === v.key
+ ? "bg-primary text-primary-foreground shadow-button-base"
+ : "text-muted-foreground hover:text-foreground"
+ )}
+ >
+ {v.icon}
+ {v.label}
+ </button>
+ ))}
+ </div>
+ </div>
+
+ {view === "plan" ? <PlanView /> : <BoardTable />}
+ </div>
+ );
+}
diff --git a/apps/erp/app/routes/x+/get-started+/positioning.tsx b/apps/erp/app/routes/x+/get-started+/positioning.tsx
new file mode 100644
index 0000000000..273b411dd4
--- /dev/null
+++ b/apps/erp/app/routes/x+/get-started+/positioning.tsx
@@ -0,0 +1,19 @@
+import { requirePermissions } from "@carbon/auth/auth.server";
+import { PositioningView } from "@carbon/onboarding/ui";
+import { isInternalEmail } from "@carbon/utils";
+import type { LoaderFunctionArgs } from "react-router";
+import { redirect } from "react-router";
+import { path } from "~/utils/path";
+
+// Carbon-only positioning page — hard-gate non-internal users server-side.
+export async function loader({ request }: LoaderFunctionArgs) {
+ const { email } = await requirePermissions(request, {});
+ if (!isInternalEmail(email)) {
+ throw redirect(path.to.getStarted);
+ }
+ return null;
+}
+
+export default function GetStartedPositioningRoute() {
+ return <PositioningView />;
+}
diff --git a/apps/erp/app/routes/x+/get-started+/requirements.tsx b/apps/erp/app/routes/x+/get-started+/requirements.tsx
new file mode 100644
index 0000000000..140929cee4
--- /dev/null
+++ b/apps/erp/app/routes/x+/get-started+/requirements.tsx
@@ -0,0 +1,6 @@
+import { RequirementsView } from "@carbon/onboarding/ui";
+
+// State, flags, and mutations come from <HubProvider> in the layout.
+export default function GetStartedRequirementsRoute() {
+ return <RequirementsView />;
+}
diff --git a/apps/erp/app/routes/x+/get-started+/roles.tsx b/apps/erp/app/routes/x+/get-started+/roles.tsx
new file mode 100644
index 0000000000..fcbe00fad9
--- /dev/null
+++ b/apps/erp/app/routes/x+/get-started+/roles.tsx
@@ -0,0 +1,5 @@
+import { RolesView } from "@carbon/onboarding/ui";
+
+export default function GetStartedRolesRoute() {
+ return <RolesView />;
+}
diff --git a/apps/erp/app/routes/x+/get-started+/scope.tsx b/apps/erp/app/routes/x+/get-started+/scope.tsx
new file mode 100644
index 0000000000..3e133d81ea
--- /dev/null
+++ b/apps/erp/app/routes/x+/get-started+/scope.tsx
@@ -0,0 +1,6 @@
+import { ScopeView } from "@carbon/onboarding/ui";
+
+// State, flags, and mutations come from <HubProvider> in the layout.
+export default function GetStartedScopeRoute() {
+ return <ScopeView />;
+}
diff --git a/apps/erp/app/routes/x+/get-started+/setup.tsx b/apps/erp/app/routes/x+/get-started+/setup.tsx
new file mode 100644
index 0000000000..add4270cde
--- /dev/null
+++ b/apps/erp/app/routes/x+/get-started+/setup.tsx
@@ -0,0 +1,6 @@
+import { SetupMapView } from "@carbon/onboarding/ui";
+
+// State, flags, and mutations come from <HubProvider> in the layout.
+export default function GetStartedSetupRoute() {
+ return <SetupMapView />;
+}
diff --git a/apps/erp/app/routes/x+/get-started+/state.tsx b/apps/erp/app/routes/x+/get-started+/state.tsx
new file mode 100644
index 0000000000..04a3229c63
--- /dev/null
+++ b/apps/erp/app/routes/x+/get-started+/state.tsx
@@ -0,0 +1,166 @@
+import { assertIsPost, error } from "@carbon/auth";
+import { requirePermissions } from "@carbon/auth/auth.server";
+import { flash } from "@carbon/auth/session.server";
+import { validationError, validator } from "@carbon/form";
+import { stateActionValidator } from "@carbon/onboarding";
+import {
+ deleteImplementationRow,
+ insertImplementationRow,
+ updateImplementationHub,
+ updateImplementationRow,
+ upsertCheckState,
+ upsertFieldValue
+} from "@carbon/onboarding/server";
+import { isInternalEmail } from "@carbon/utils";
+import type { ActionFunctionArgs } from "react-router";
+import { data } from "react-router";
+
+// Single action endpoint for every hub state mutation. Toggles + customer/shared
+// fields + custom rows + finishing (setStatus) are open to any company employee;
+// structural edits (tier/exclusions/contacts) require an internal Carbon user.
+export async function action({ request }: ActionFunctionArgs) {
+ assertIsPost(request);
+ const { client, companyId, userId, email } = await requirePermissions(
+ request,
+ {}
+ );
+
+ const validation = await validator(stateActionValidator).validate(
+ await request.formData()
+ );
+ if (validation.error) {
+ return validationError(validation.error);
+ }
+
+ const a = validation.data;
+ const isInternal = isInternalEmail(email);
+
+ const fail = async (e: unknown) =>
+ data(
+ { success: false },
+ await flash(request, error(e, "Failed to update"))
+ );
+
+ switch (a.intent) {
+ case "setCheck": {
+ const result = await upsertCheckState(client, {
+ companyId,
+ itemKey: a.itemKey,
+ kind: a.kind,
+ value: a.value,
+ userId
+ });
+ if (result.error) return fail(result.error);
+ break;
+ }
+ case "setField": {
+ // All fill-in fields are currently Carbon-owned. When customer-owned
+ // fields are added, gate per the field's ownership instead of isInternal.
+ if (!isInternal) {
+ return data(
+ { success: false },
+ await flash(
+ request,
+ error(
+ new Error("forbidden"),
+ "Only Carbon staff can edit this field"
+ )
+ )
+ );
+ }
+ const result = await upsertFieldValue(client, {
+ companyId,
+ fieldKey: a.fieldKey,
+ value: a.value,
+ userId
+ });
+ if (result.error) return fail(result.error);
+ break;
+ }
+ case "addRow": {
+ // Adding/removing rows is a Carbon-staff tailoring action; updating a
+ // row (e.g. a status toggle) stays open to any employee.
+ if (!isInternal) {
+ return data(
+ { success: false },
+ await flash(
+ request,
+ error(new Error("forbidden"), "Only Carbon staff can add rows")
+ )
+ );
+ }
+ const result = await insertImplementationRow(client, {
+ companyId,
+ collection: a.collection,
+ payload: JSON.parse(a.payload),
+ userId
+ });
+ if (result.error) return fail(result.error);
+ break;
+ }
+ case "updateRow": {
+ const result = await updateImplementationRow(client, {
+ id: a.rowId,
+ companyId,
+ payload: JSON.parse(a.payload),
+ userId
+ });
+ if (result.error) return fail(result.error);
+ break;
+ }
+ case "deleteRow": {
+ if (!isInternal) {
+ return data(
+ { success: false },
+ await flash(
+ request,
+ error(new Error("forbidden"), "Only Carbon staff can delete rows")
+ )
+ );
+ }
+ const result = await deleteImplementationRow(client, {
+ id: a.rowId,
+ companyId
+ });
+ if (result.error) return fail(result.error);
+ break;
+ }
+ case "setStatus": {
+ // Finishing (or reopening) the hub is the customer's own action on their
+ // own hub — open to any company member, unlike the structural edits below.
+ const result = await updateImplementationHub(client, companyId, {
+ status: a.status,
+ userId
+ });
+ if (result.error) return fail(result.error);
+ break;
+ }
+ case "setExclusions":
+ case "setTier":
+ case "setContacts": {
+ if (!isInternal) {
+ return data(
+ { success: false },
+ await flash(
+ request,
+ error(
+ new Error("forbidden"),
+ "Only Carbon staff can change this setting"
+ )
+ )
+ );
+ }
+ const patch =
+ a.intent === "setExclusions"
+ ? { exclusions: JSON.parse(a.exclusions), userId }
+ : a.intent === "setTier"
+ ? { tier: a.tier, userId }
+ : { contacts: JSON.parse(a.contacts), userId };
+ const result = await updateImplementationHub(client, companyId, patch);
+ if (result.error) return fail(result.error);
+ break;
+ }
+ }
+
+ return data({ success: true });
+}
diff --git a/apps/erp/app/routes/x+/get-started+/team.tsx b/apps/erp/app/routes/x+/get-started+/team.tsx
new file mode 100644
index 0000000000..9c939b090c
--- /dev/null
+++ b/apps/erp/app/routes/x+/get-started+/team.tsx
@@ -0,0 +1,6 @@
+import { TeamView } from "@carbon/onboarding/ui";
+
+// State, flags, and mutations come from <HubProvider> in the layout.
+export default function GetStartedTeamRoute() {
+ return <TeamView />;
+}
diff --git a/apps/erp/app/routes/x+/get-started+/training.tsx b/apps/erp/app/routes/x+/get-started+/training.tsx
new file mode 100644
index 0000000000..2660df47cc
--- /dev/null
+++ b/apps/erp/app/routes/x+/get-started+/training.tsx
@@ -0,0 +1,6 @@
+import { TrainingView } from "@carbon/onboarding/ui";
+
+// State, flags, and mutations come from <HubProvider> in the layout.
+export default function GetStartedTrainingRoute() {
+ return <TrainingView />;
+}
diff --git a/apps/erp/app/routes/x+/get-started+/value.tsx b/apps/erp/app/routes/x+/get-started+/value.tsx
new file mode 100644
index 0000000000..50afdcd2ca
--- /dev/null
+++ b/apps/erp/app/routes/x+/get-started+/value.tsx
@@ -0,0 +1,6 @@
+import { ValueView } from "@carbon/onboarding/ui";
+
+// State, flags, and mutations come from <HubProvider> in the layout.
+export default function GetStartedValueRoute() {
+ return <ValueView />;
+}
diff --git a/apps/erp/app/routes/x+/settings+/company.tsx b/apps/erp/app/routes/x+/settings+/company.tsx
index 7943fb91c9..e6213b009d 100644
--- a/apps/erp/app/routes/x+/settings+/company.tsx
+++ b/apps/erp/app/routes/x+/settings+/company.tsx
@@ -19,10 +19,11 @@ import {
} from "@carbon/react";
import { msg } from "@lingui/core/macro";
import { Trans, useLingui } from "@lingui/react/macro";
-import { LuKeySquare } from "react-icons/lu";
+import { LuKeySquare, LuRocket } from "react-icons/lu";
import type { ActionFunctionArgs } from "react-router";
-import { data } from "react-router";
+import { data, Link } from "react-router";
import { useRouteData } from "~/hooks";
+import { useImplementationReopenItem } from "~/hooks/useImplementationNavItem";
import type { Company as CompanyType } from "~/modules/settings";
import {
CompanyForm,
@@ -73,6 +74,10 @@ export default function Company() {
const company = routeData?.company;
if (!company) throw new Error("Company not found");
+ // Buried reopen entry for a finished implementation hub — only present once the
+ // company was enrolled and onboarding was wrapped up (status complete/archived).
+ const reopenHub = useImplementationReopenItem();
+
const initialValues = {
name: company.name,
taxId: company.taxId ?? undefined,
@@ -121,12 +126,31 @@ export default function Company() {
</HStack>
<Card>
<CardHeader>
- <CardTitle>
- <Trans>Basic Information</Trans>
- </CardTitle>
- <CardDescription>
- <Trans>This information will be used on document headers</Trans>
- </CardDescription>
+ <div className="flex items-start justify-between gap-3">
+ <div className="flex flex-col gap-1.5">
+ <CardTitle>
+ <Trans>Basic Information</Trans>
+ </CardTitle>
+ <CardDescription>
+ <Trans>
+ This information will be used on document headers
+ </Trans>
+ </CardDescription>
+ </div>
+ {reopenHub ? (
+ <Button
+ asChild
+ variant="secondary"
+ size="sm"
+ leftIcon={<LuRocket />}
+ className="shrink-0"
+ >
+ <Link to={reopenHub.to}>
+ <Trans>Go to implementation hub</Trans>
+ </Link>
+ </Button>
+ ) : null}
+ </div>
</CardHeader>
<CardContent>
{/* @ts-ignore */}
diff --git a/apps/erp/app/utils/path.ts b/apps/erp/app/utils/path.ts
index 9155816e51..53989b46a5 100644
--- a/apps/erp/app/utils/path.ts
+++ b/apps/erp/app/utils/path.ts
@@ -577,6 +577,10 @@ export const path = {
generatePath(`${x}/settings/company/switch/${companyId}`),
backups: `${x}/settings/backups`,
companies: `${x}/settings/companies`,
+ getStarted: `${x}/get-started`,
+ getStartedPage: (slug: string) => generatePath(`${x}/get-started/${slug}`),
+ getStartedState: `${x}/get-started/state`,
+ getStartedEnroll: `${x}/get-started/enroll`,
completeTrainingAssignment: (id: string) =>
generatePath(`${share}/training/${id}`),
configurationParameter: (itemId: string) =>
diff --git a/apps/erp/app/utils/training.ts b/apps/erp/app/utils/training.ts
index 01b0ccec71..81bf2c7b90 100644
--- a/apps/erp/app/utils/training.ts
+++ b/apps/erp/app/utils/training.ts
@@ -65,6 +65,15 @@ export const trainingConfig: Record<string, TrainingVideo> = {
videoType: "loom",
academyUrl: "https://learn.carbon.ms/course/buying/purchasing-basics"
},
+ bom: {
+ title: "Bill of Materials in Carbon",
+ description:
+ "Learn how to bring a bill of materials into Carbon and structure it for manufacturing.",
+ videoUrl:
+ "https://www.loom.com/share/acad6206adde4d1185e83f57393f36e9?sid=3cec60b1-91e3-454b-a6dd-f08fe1035ef2",
+ videoType: "loom",
+ academyUrl: "https://learn.carbon.ms/lesson/bill-of-materials"
+ },
parts: {
title: "Parts & Materials in Carbon",
description:
diff --git a/apps/erp/package.json b/apps/erp/package.json
index fa4a44f1ee..418a9daad5 100644
--- a/apps/erp/package.json
+++ b/apps/erp/package.json
@@ -23,6 +23,7 @@
"@carbon/lib": "workspace:*",
"@carbon/locale": "workspace:*",
"@carbon/notifications": "workspace:*",
+ "@carbon/onboarding": "workspace:*",
"@carbon/printing": "workspace:*",
"@carbon/react": "workspace:*",
"@carbon/stripe": "workspace:*",
@@ -99,6 +100,7 @@
"posthog-js": "catalog:",
"react": "catalog:",
"react-colorful": "5.6.1",
+ "react-confetti": "^6.4.0",
"react-confetti-explosion": "3.0.3",
"react-csv": "2.2.2",
"react-dom": "catalog:",
diff --git a/packages/database/src/types.ts b/packages/database/src/types.ts
index 72e7e1f612..2822f42df6 100644
--- a/packages/database/src/types.ts
+++ b/packages/database/src/types.ts
@@ -11659,6 +11659,590 @@ export type Database = {
},
]
}
+ implementationCheckState: {
+ Row: {
+ companyId: string
+ createdAt: string
+ createdBy: string
+ id: string
+ itemKey: string
+ kind: Database["public"]["Enums"]["implementationStateKind"]
+ updatedAt: string | null
+ updatedBy: string | null
+ value: string
+ }
+ Insert: {
+ companyId: string
+ createdAt?: string
+ createdBy: string
+ id?: string
+ itemKey: string
+ kind: Database["public"]["Enums"]["implementationStateKind"]
+ updatedAt?: string | null
+ updatedBy?: string | null
+ value: string
+ }
+ Update: {
+ companyId?: string
+ createdAt?: string
+ createdBy?: string
+ id?: string
+ itemKey?: string
+ kind?: Database["public"]["Enums"]["implementationStateKind"]
+ updatedAt?: string | null
+ updatedBy?: string | null
+ value?: string
+ }
+ Relationships: [
+ {
+ foreignKeyName: "implementationCheckState_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "companies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "company"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "customFieldTables"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "integrations"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ ]
+ }
+ implementationFieldValue: {
+ Row: {
+ companyId: string
+ createdAt: string
+ createdBy: string
+ fieldKey: string
+ id: string
+ updatedAt: string | null
+ updatedBy: string | null
+ value: string
+ }
+ Insert: {
+ companyId: string
+ createdAt?: string
+ createdBy: string
+ fieldKey: string
+ id?: string
+ updatedAt?: string | null
+ updatedBy?: string | null
+ value: string
+ }
+ Update: {
+ companyId?: string
+ createdAt?: string
+ createdBy?: string
+ fieldKey?: string
+ id?: string
+ updatedAt?: string | null
+ updatedBy?: string | null
+ value?: string
+ }
+ Relationships: [
+ {
+ foreignKeyName: "implementationFieldValue_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "companies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "company"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "customFieldTables"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "integrations"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ ]
+ }
+ implementationHub: {
+ Row: {
+ contacts: Json
+ createdAt: string
+ createdBy: string
+ exclusions: Json
+ id: string
+ signedAt: string | null
+ signedBy: string | null
+ status: Database["public"]["Enums"]["implementationStatus"]
+ templateKey: string
+ templateVersion: number
+ tier: Database["public"]["Enums"]["implementationTier"]
+ updatedAt: string | null
+ updatedBy: string | null
+ }
+ Insert: {
+ contacts?: Json
+ createdAt?: string
+ createdBy: string
+ exclusions?: Json
+ id: string
+ signedAt?: string | null
+ signedBy?: string | null
+ status?: Database["public"]["Enums"]["implementationStatus"]
+ templateKey?: string
+ templateVersion?: number
+ tier?: Database["public"]["Enums"]["implementationTier"]
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Update: {
+ contacts?: Json
+ createdAt?: string
+ createdBy?: string
+ exclusions?: Json
+ id?: string
+ signedAt?: string | null
+ signedBy?: string | null
+ status?: Database["public"]["Enums"]["implementationStatus"]
+ templateKey?: string
+ templateVersion?: number
+ tier?: Database["public"]["Enums"]["implementationTier"]
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Relationships: [
+ {
+ foreignKeyName: "implementationHub_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ {
+ foreignKeyName: "implementationHub_id_fkey"
+ columns: ["id"]
+ isOneToOne: true
+ referencedRelation: "companies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_id_fkey"
+ columns: ["id"]
+ isOneToOne: true
+ referencedRelation: "company"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_id_fkey"
+ columns: ["id"]
+ isOneToOne: true
+ referencedRelation: "customFieldTables"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "implementationHub_id_fkey"
+ columns: ["id"]
+ isOneToOne: true
+ referencedRelation: "integrations"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "implementationHub_signedBy_fkey"
+ columns: ["signedBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_signedBy_fkey"
+ columns: ["signedBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_signedBy_fkey"
+ columns: ["signedBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_signedBy_fkey"
+ columns: ["signedBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_signedBy_fkey"
+ columns: ["signedBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ {
+ foreignKeyName: "implementationHub_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ ]
+ }
+ implementationRow: {
+ Row: {
+ collection: string
+ companyId: string
+ createdAt: string
+ createdBy: string
+ id: string
+ payload: Json
+ sortOrder: number
+ updatedAt: string | null
+ updatedBy: string | null
+ }
+ Insert: {
+ collection: string
+ companyId: string
+ createdAt?: string
+ createdBy: string
+ id?: string
+ payload?: Json
+ sortOrder?: number
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Update: {
+ collection?: string
+ companyId?: string
+ createdAt?: string
+ createdBy?: string
+ id?: string
+ payload?: Json
+ sortOrder?: number
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Relationships: [
+ {
+ foreignKeyName: "implementationRow_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "companies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationRow_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "company"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationRow_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "customFieldTables"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "implementationRow_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "integrations"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "implementationRow_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationRow_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationRow_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationRow_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationRow_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ {
+ foreignKeyName: "implementationRow_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationRow_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationRow_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationRow_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationRow_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ ]
+ }
inboundInspection: {
Row: {
acceptanceNumber: number
@@ -60799,14 +61383,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["invoiceCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["invoiceCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -67106,6 +67690,20 @@ export type Database = {
glAccountClass: "Asset" | "Liability" | "Equity" | "Revenue" | "Expense"
glConsolidatedRate: "Average" | "Current" | "Historical"
glIncomeBalance: "Balance Sheet" | "Income Statement"
+ implementationStateKind:
+ | "gate"
+ | "task"
+ | "check"
+ | "scopeFlag"
+ | "productStep"
+ | "fmt"
+ implementationStatus:
+ | "tailoring"
+ | "shared"
+ | "active"
+ | "complete"
+ | "archived"
+ implementationTier: "self_serve" | "guided" | "enterprise"
inboundInspectionSampleStatus: "Pending" | "Passed" | "Failed"
inboundInspectionStatus:
| "Pending"
@@ -68399,6 +68997,22 @@ export const Constants = {
glAccountClass: ["Asset", "Liability", "Equity", "Revenue", "Expense"],
glConsolidatedRate: ["Average", "Current", "Historical"],
glIncomeBalance: ["Balance Sheet", "Income Statement"],
+ implementationStateKind: [
+ "gate",
+ "task",
+ "check",
+ "scopeFlag",
+ "productStep",
+ "fmt",
+ ],
+ implementationStatus: [
+ "tailoring",
+ "shared",
+ "active",
+ "complete",
+ "archived",
+ ],
+ implementationTier: ["self_serve", "guided", "enterprise"],
inboundInspectionSampleStatus: ["Pending", "Passed", "Failed"],
inboundInspectionStatus: [
"Pending",
diff --git a/packages/database/supabase/functions/lib/types.ts b/packages/database/supabase/functions/lib/types.ts
index 72e7e1f612..2822f42df6 100644
--- a/packages/database/supabase/functions/lib/types.ts
+++ b/packages/database/supabase/functions/lib/types.ts
@@ -11659,6 +11659,590 @@ export type Database = {
},
]
}
+ implementationCheckState: {
+ Row: {
+ companyId: string
+ createdAt: string
+ createdBy: string
+ id: string
+ itemKey: string
+ kind: Database["public"]["Enums"]["implementationStateKind"]
+ updatedAt: string | null
+ updatedBy: string | null
+ value: string
+ }
+ Insert: {
+ companyId: string
+ createdAt?: string
+ createdBy: string
+ id?: string
+ itemKey: string
+ kind: Database["public"]["Enums"]["implementationStateKind"]
+ updatedAt?: string | null
+ updatedBy?: string | null
+ value: string
+ }
+ Update: {
+ companyId?: string
+ createdAt?: string
+ createdBy?: string
+ id?: string
+ itemKey?: string
+ kind?: Database["public"]["Enums"]["implementationStateKind"]
+ updatedAt?: string | null
+ updatedBy?: string | null
+ value?: string
+ }
+ Relationships: [
+ {
+ foreignKeyName: "implementationCheckState_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "companies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "company"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "customFieldTables"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "integrations"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationCheckState_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ ]
+ }
+ implementationFieldValue: {
+ Row: {
+ companyId: string
+ createdAt: string
+ createdBy: string
+ fieldKey: string
+ id: string
+ updatedAt: string | null
+ updatedBy: string | null
+ value: string
+ }
+ Insert: {
+ companyId: string
+ createdAt?: string
+ createdBy: string
+ fieldKey: string
+ id?: string
+ updatedAt?: string | null
+ updatedBy?: string | null
+ value: string
+ }
+ Update: {
+ companyId?: string
+ createdAt?: string
+ createdBy?: string
+ fieldKey?: string
+ id?: string
+ updatedAt?: string | null
+ updatedBy?: string | null
+ value?: string
+ }
+ Relationships: [
+ {
+ foreignKeyName: "implementationFieldValue_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "companies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "company"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "customFieldTables"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "integrations"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationFieldValue_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ ]
+ }
+ implementationHub: {
+ Row: {
+ contacts: Json
+ createdAt: string
+ createdBy: string
+ exclusions: Json
+ id: string
+ signedAt: string | null
+ signedBy: string | null
+ status: Database["public"]["Enums"]["implementationStatus"]
+ templateKey: string
+ templateVersion: number
+ tier: Database["public"]["Enums"]["implementationTier"]
+ updatedAt: string | null
+ updatedBy: string | null
+ }
+ Insert: {
+ contacts?: Json
+ createdAt?: string
+ createdBy: string
+ exclusions?: Json
+ id: string
+ signedAt?: string | null
+ signedBy?: string | null
+ status?: Database["public"]["Enums"]["implementationStatus"]
+ templateKey?: string
+ templateVersion?: number
+ tier?: Database["public"]["Enums"]["implementationTier"]
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Update: {
+ contacts?: Json
+ createdAt?: string
+ createdBy?: string
+ exclusions?: Json
+ id?: string
+ signedAt?: string | null
+ signedBy?: string | null
+ status?: Database["public"]["Enums"]["implementationStatus"]
+ templateKey?: string
+ templateVersion?: number
+ tier?: Database["public"]["Enums"]["implementationTier"]
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Relationships: [
+ {
+ foreignKeyName: "implementationHub_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ {
+ foreignKeyName: "implementationHub_id_fkey"
+ columns: ["id"]
+ isOneToOne: true
+ referencedRelation: "companies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_id_fkey"
+ columns: ["id"]
+ isOneToOne: true
+ referencedRelation: "company"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_id_fkey"
+ columns: ["id"]
+ isOneToOne: true
+ referencedRelation: "customFieldTables"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "implementationHub_id_fkey"
+ columns: ["id"]
+ isOneToOne: true
+ referencedRelation: "integrations"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "implementationHub_signedBy_fkey"
+ columns: ["signedBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_signedBy_fkey"
+ columns: ["signedBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_signedBy_fkey"
+ columns: ["signedBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_signedBy_fkey"
+ columns: ["signedBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_signedBy_fkey"
+ columns: ["signedBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ {
+ foreignKeyName: "implementationHub_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationHub_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ ]
+ }
+ implementationRow: {
+ Row: {
+ collection: string
+ companyId: string
+ createdAt: string
+ createdBy: string
+ id: string
+ payload: Json
+ sortOrder: number
+ updatedAt: string | null
+ updatedBy: string | null
+ }
+ Insert: {
+ collection: string
+ companyId: string
+ createdAt?: string
+ createdBy: string
+ id?: string
+ payload?: Json
+ sortOrder?: number
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Update: {
+ collection?: string
+ companyId?: string
+ createdAt?: string
+ createdBy?: string
+ id?: string
+ payload?: Json
+ sortOrder?: number
+ updatedAt?: string | null
+ updatedBy?: string | null
+ }
+ Relationships: [
+ {
+ foreignKeyName: "implementationRow_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "companies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationRow_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "company"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationRow_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "customFieldTables"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "implementationRow_companyId_fkey"
+ columns: ["companyId"]
+ isOneToOne: false
+ referencedRelation: "integrations"
+ referencedColumns: ["companyId"]
+ },
+ {
+ foreignKeyName: "implementationRow_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationRow_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationRow_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationRow_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationRow_createdBy_fkey"
+ columns: ["createdBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ {
+ foreignKeyName: "implementationRow_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employees"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationRow_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeesAcrossCompanies"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationRow_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "employeeSummary"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationRow_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "user"
+ referencedColumns: ["id"]
+ },
+ {
+ foreignKeyName: "implementationRow_updatedBy_fkey"
+ columns: ["updatedBy"]
+ isOneToOne: false
+ referencedRelation: "userDefaults"
+ referencedColumns: ["userId"]
+ },
+ ]
+ }
inboundInspection: {
Row: {
acceptanceNumber: number
@@ -60799,14 +61383,14 @@ export type Database = {
Relationships: [
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["customerCountryCode"]
+ columns: ["invoiceCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
},
{
foreignKeyName: "address_countryCode_fkey"
- columns: ["invoiceCountryCode"]
+ columns: ["customerCountryCode"]
isOneToOne: false
referencedRelation: "country"
referencedColumns: ["alpha2"]
@@ -67106,6 +67690,20 @@ export type Database = {
glAccountClass: "Asset" | "Liability" | "Equity" | "Revenue" | "Expense"
glConsolidatedRate: "Average" | "Current" | "Historical"
glIncomeBalance: "Balance Sheet" | "Income Statement"
+ implementationStateKind:
+ | "gate"
+ | "task"
+ | "check"
+ | "scopeFlag"
+ | "productStep"
+ | "fmt"
+ implementationStatus:
+ | "tailoring"
+ | "shared"
+ | "active"
+ | "complete"
+ | "archived"
+ implementationTier: "self_serve" | "guided" | "enterprise"
inboundInspectionSampleStatus: "Pending" | "Passed" | "Failed"
inboundInspectionStatus:
| "Pending"
@@ -68399,6 +68997,22 @@ export const Constants = {
glAccountClass: ["Asset", "Liability", "Equity", "Revenue", "Expense"],
glConsolidatedRate: ["Average", "Current", "Historical"],
glIncomeBalance: ["Balance Sheet", "Income Statement"],
+ implementationStateKind: [
+ "gate",
+ "task",
+ "check",
+ "scopeFlag",
+ "productStep",
+ "fmt",
+ ],
+ implementationStatus: [
+ "tailoring",
+ "shared",
+ "active",
+ "complete",
+ "archived",
+ ],
+ implementationTier: ["self_serve", "guided", "enterprise"],
inboundInspectionSampleStatus: ["Pending", "Passed", "Failed"],
inboundInspectionStatus: [
"Pending",
diff --git a/packages/database/supabase/migrations/20260624140312_implementation-hub.sql b/packages/database/supabase/migrations/20260624140312_implementation-hub.sql
new file mode 100644
index 0000000000..5cee701e56
--- /dev/null
+++ b/packages/database/supabase/migrations/20260624140312_implementation-hub.sql
@@ -0,0 +1,194 @@
+-- Implementation Hub — per-company guided implementation workspace.
+-- Content/templates live in code (@carbon/onboarding); these tables hold only
+-- the per-company editable/stateful layer: hub config, toggles, fill-in values,
+-- and custom rows. Internal-vs-customer edit rights are enforced in-app via
+-- isInternal + field ownership; RLS just gates company-employee access.
+
+CREATE TYPE "implementationTier" AS ENUM ('self_serve', 'guided', 'enterprise');
+CREATE TYPE "implementationStatus" AS ENUM ('tailoring', 'shared', 'active', 'complete', 'archived');
+CREATE TYPE "implementationStateKind" AS ENUM ('gate', 'task', 'check', 'scopeFlag', 'productStep', 'fmt');
+
+-- 1:1 satellite of company (PK = company.id, like companySettings / companyPlan)
+CREATE TABLE "implementationHub" (
+ "id" TEXT NOT NULL,
+ "templateKey" TEXT NOT NULL DEFAULT 'standard',
+ "templateVersion" INTEGER NOT NULL DEFAULT 1,
+ "tier" "implementationTier" NOT NULL DEFAULT 'self_serve',
+ "status" "implementationStatus" NOT NULL DEFAULT 'tailoring',
+ "exclusions" JSONB NOT NULL DEFAULT '{"modules":[],"pages":[],"sections":[]}',
+ "contacts" JSONB NOT NULL DEFAULT '{}',
+ "signedAt" TIMESTAMP WITH TIME ZONE,
+ "signedBy" TEXT REFERENCES "user"("id"),
+
+ "createdBy" TEXT NOT NULL REFERENCES "user"("id"),
+ "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
+ "updatedBy" TEXT REFERENCES "user"("id"),
+ "updatedAt" TIMESTAMP WITH TIME ZONE,
+
+ CONSTRAINT "implementationHub_pkey" PRIMARY KEY ("id"),
+ CONSTRAINT "implementationHub_id_fkey" FOREIGN KEY ("id") REFERENCES "company"("id") ON DELETE CASCADE
+);
+
+CREATE INDEX "implementationHub_createdBy_idx" ON "implementationHub" ("createdBy");
+
+ALTER TABLE "public"."implementationHub" ENABLE ROW LEVEL SECURITY;
+
+CREATE POLICY "SELECT" ON "public"."implementationHub"
+FOR SELECT USING (
+ "id" = ANY ((SELECT get_companies_with_employee_role())::text[])
+);
+
+CREATE POLICY "INSERT" ON "public"."implementationHub"
+FOR INSERT WITH CHECK (
+ "id" = ANY ((SELECT get_companies_with_employee_permission('settings_create'))::text[])
+);
+
+-- Any company employee may write the hub row; structural edits (tier/exclusions/
+-- contacts) are gated in-app by isInternal.
+CREATE POLICY "UPDATE" ON "public"."implementationHub"
+FOR UPDATE USING (
+ "id" = ANY ((SELECT get_companies_with_employee_role())::text[])
+);
+
+CREATE POLICY "DELETE" ON "public"."implementationHub"
+FOR DELETE USING (
+ "id" = ANY ((SELECT get_companies_with_employee_permission('settings_delete'))::text[])
+);
+
+-- Per-key toggle/completion layer (the prototype's state.el). Upsert by
+-- (companyId, itemKey).
+CREATE TABLE "implementationCheckState" (
+ "id" TEXT NOT NULL DEFAULT id(),
+ "companyId" TEXT NOT NULL,
+ "itemKey" TEXT NOT NULL,
+ "kind" "implementationStateKind" NOT NULL,
+ "value" TEXT NOT NULL,
+
+ "createdBy" TEXT NOT NULL REFERENCES "user"("id"),
+ "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
+ "updatedBy" TEXT REFERENCES "user"("id"),
+ "updatedAt" TIMESTAMP WITH TIME ZONE,
+
+ PRIMARY KEY ("id", "companyId"),
+ FOREIGN KEY ("companyId") REFERENCES "company"("id") ON DELETE CASCADE
+);
+
+CREATE INDEX "implementationCheckState_companyId_idx" ON "implementationCheckState" ("companyId");
+CREATE INDEX "implementationCheckState_createdBy_idx" ON "implementationCheckState" ("createdBy");
+ALTER TABLE "implementationCheckState" ADD CONSTRAINT "implementationCheckState_companyId_itemKey_key"
+ UNIQUE ("companyId", "itemKey");
+
+ALTER TABLE "public"."implementationCheckState" ENABLE ROW LEVEL SECURITY;
+
+CREATE POLICY "SELECT" ON "public"."implementationCheckState"
+FOR SELECT USING (
+ "companyId" = ANY ((SELECT get_companies_with_employee_role())::text[])
+);
+
+CREATE POLICY "INSERT" ON "public"."implementationCheckState"
+FOR INSERT WITH CHECK (
+ "companyId" = ANY ((SELECT get_companies_with_employee_role())::text[])
+);
+
+CREATE POLICY "UPDATE" ON "public"."implementationCheckState"
+FOR UPDATE USING (
+ "companyId" = ANY ((SELECT get_companies_with_employee_role())::text[])
+);
+
+CREATE POLICY "DELETE" ON "public"."implementationCheckState"
+FOR DELETE USING (
+ "companyId" = ANY ((SELECT get_companies_with_employee_permission('settings_delete'))::text[])
+);
+
+-- Per-key fill-in / chip overrides (the prototype's state.el["txt:*"]).
+CREATE TABLE "implementationFieldValue" (
+ "id" TEXT NOT NULL DEFAULT id(),
+ "companyId" TEXT NOT NULL,
+ "fieldKey" TEXT NOT NULL,
+ "value" TEXT NOT NULL,
+
+ "createdBy" TEXT NOT NULL REFERENCES "user"("id"),
+ "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
+ "updatedBy" TEXT REFERENCES "user"("id"),
+ "updatedAt" TIMESTAMP WITH TIME ZONE,
+
+ PRIMARY KEY ("id", "companyId"),
+ FOREIGN KEY ("companyId") REFERENCES "company"("id") ON DELETE CASCADE
+);
+
+CREATE INDEX "implementationFieldValue_companyId_idx" ON "implementationFieldValue" ("companyId");
+CREATE INDEX "implementationFieldValue_createdBy_idx" ON "implementationFieldValue" ("createdBy");
+ALTER TABLE "implementationFieldValue" ADD CONSTRAINT "implementationFieldValue_companyId_fieldKey_key"
+ UNIQUE ("companyId", "fieldKey");
+
+ALTER TABLE "public"."implementationFieldValue" ENABLE ROW LEVEL SECURITY;
+
+CREATE POLICY "SELECT" ON "public"."implementationFieldValue"
+FOR SELECT USING (
+ "companyId" = ANY ((SELECT get_companies_with_employee_role())::text[])
+);
+
+CREATE POLICY "INSERT" ON "public"."implementationFieldValue"
+FOR INSERT WITH CHECK (
+ "companyId" = ANY ((SELECT get_companies_with_employee_role())::text[])
+);
+
+CREATE POLICY "UPDATE" ON "public"."implementationFieldValue"
+FOR UPDATE USING (
+ "companyId" = ANY ((SELECT get_companies_with_employee_role())::text[])
+);
+
+CREATE POLICY "DELETE" ON "public"."implementationFieldValue"
+FOR DELETE USING (
+ "companyId" = ANY ((SELECT get_companies_with_employee_permission('settings_delete'))::text[])
+);
+
+-- Staff/customer "+ Add a row" custom rows (the prototype's state.added).
+CREATE TABLE "implementationRow" (
+ "id" TEXT NOT NULL DEFAULT id(),
+ "companyId" TEXT NOT NULL,
+ "collection" TEXT NOT NULL,
+ "payload" JSONB NOT NULL DEFAULT '{}',
+ "sortOrder" DOUBLE PRECISION NOT NULL DEFAULT 0,
+
+ "createdBy" TEXT NOT NULL REFERENCES "user"("id"),
+ "createdAt" TIMESTAMP WITH TIME ZONE NOT NULL DEFAULT NOW(),
+ "updatedBy" TEXT REFERENCES "user"("id"),
+ "updatedAt" TIMESTAMP WITH TIME ZONE,
+
+ PRIMARY KEY ("id", "companyId"),
+ FOREIGN KEY ("companyId") REFERENCES "company"("id") ON DELETE CASCADE
+);
+
+CREATE INDEX "implementationRow_companyId_idx" ON "implementationRow" ("companyId");
+CREATE INDEX "implementationRow_createdBy_idx" ON "implementationRow" ("createdBy");
+
+ALTER TABLE "public"."implementationRow" ENABLE ROW LEVEL SECURITY;
+
+CREATE POLICY "SELECT" ON "public"."implementationRow"
+FOR SELECT USING (
+ "companyId" = ANY ((SELECT get_companies_with_employee_role())::text[])
+);
+
+CREATE POLICY "INSERT" ON "public"."implementationRow"
+FOR INSERT WITH CHECK (
+ "companyId" = ANY ((SELECT get_companies_with_employee_role())::text[])
+);
+
+CREATE POLICY "UPDATE" ON "public"."implementationRow"
+FOR UPDATE USING (
+ "companyId" = ANY ((SELECT get_companies_with_employee_role())::text[])
+);
+
+CREATE POLICY "DELETE" ON "public"."implementationRow"
+FOR DELETE USING (
+ "companyId" = ANY ((SELECT get_companies_with_employee_role())::text[])
+);
+
+-- Surface all four tables over realtime so staff edits and customer toggles
+-- propagate live both directions (client revalidates on event; default replica
+-- identity / primary key is enough — no payload columns are read).
+ALTER PUBLICATION supabase_realtime ADD TABLE "implementationHub";
+ALTER PUBLICATION supabase_realtime ADD TABLE "implementationCheckState";
+ALTER PUBLICATION supabase_realtime ADD TABLE "implementationFieldValue";
+ALTER PUBLICATION supabase_realtime ADD TABLE "implementationRow";
diff --git a/packages/dev/src/services/migrations.ts b/packages/dev/src/services/migrations.ts
index 8f75bf91c4..09fd7c8836 100644
--- a/packages/dev/src/services/migrations.ts
+++ b/packages/dev/src/services/migrations.ts
@@ -139,25 +139,19 @@ export async function applyMigrations(
// Retry up to 3 times on deadlock — background services (PostgREST,
// Realtime) hold catalog locks that race with CREATE POLICY / ALTER TABLE.
const MAX_RETRIES = 3;
- let r: Awaited<ReturnType<typeof execa>>;
- for (let attempt = 1; attempt <= MAX_RETRIES; attempt++) {
- r = await execa("supabase", args, {
- cwd,
- reject: false,
- preferLocal: true
- });
- if (r.exitCode === 0) break;
+ const execOpts = { cwd, reject: false, preferLocal: true };
+ // Inferred from the call so `r` is the string-encoded result (not execa's
+ // buffer overload) and is definitely assigned after the loop.
+ let r = await execa("supabase", args, execOpts);
+ for (let attempt = 1; attempt < MAX_RETRIES && r.exitCode !== 0; attempt++) {
const output = `${r.stderr ?? ""}\n${r.stdout ?? ""}`;
- if (/deadlock detected/i.test(output) && attempt < MAX_RETRIES) {
- log.warn(
- `deadlock during migration (attempt ${attempt}/${MAX_RETRIES}) — retrying in 3s`
- );
- await sleep(3000);
- continue;
- }
- break;
+ if (!/deadlock detected/i.test(output)) break;
+ log.warn(
+ `deadlock during migration (attempt ${attempt}/${MAX_RETRIES}) — retrying in 3s`
+ );
+ await sleep(3000);
+ r = await execa("supabase", args, execOpts);
}
- // @ts-expect-error — r is always assigned after the loop
if (r.exitCode !== 0) {
const output = `${r.stderr ?? ""}\n${r.stdout ?? ""}`;
// Auto-repair: DB has migration versions not present locally (stale from
diff --git a/packages/locale/locales/de/erp.po b/packages/locale/locales/de/erp.po
index 1aa992cefc..768a2073fd 100644
--- a/packages/locale/locales/de/erp.po
+++ b/packages/locale/locales/de/erp.po
@@ -3919,9 +3919,6 @@ msgstr "Fehler beim Entfernen des Modells aus der Bestellzeile"
msgid "Error validating serial number"
msgstr "Fehler beim Validieren der Seriennummer"
-msgid "Error!"
-msgstr "Fehler!"
-
msgid "Escalation"
msgstr "Eskalation"
@@ -4656,6 +4653,9 @@ msgstr "Generierte IDs sind aktiviert"
msgid "Get Method"
msgstr "Methode abrufen"
+msgid "Get Started"
+msgstr ""
+
msgid "GL Account"
msgstr "Sachkonto"
@@ -4770,6 +4770,9 @@ msgstr "GL-Ausgabenkonto für Käufe ohne Bestandsaufnahme (Verbrauchsmaterialie
msgid "GL liability account credited for sales tax collected from customers."
msgstr "GL-Haftungskonto für Umsatzsteuer, die von Kunden eingezogen wird."
+msgid "Go to implementation hub"
+msgstr ""
+
#. placeholder {0}: user.firstName
msgid "Good afternoon, {0}"
msgstr "Guten Nachmittag, {0}"
diff --git a/packages/locale/locales/en/erp.po b/packages/locale/locales/en/erp.po
index e16e467df8..cf5320d4a9 100644
--- a/packages/locale/locales/en/erp.po
+++ b/packages/locale/locales/en/erp.po
@@ -3919,9 +3919,6 @@ msgstr "Error removing model from sales order line"
msgid "Error validating serial number"
msgstr "Error validating serial number"
-msgid "Error!"
-msgstr "Error!"
-
msgid "Escalation"
msgstr "Escalation"
@@ -4656,6 +4653,9 @@ msgstr "Generated IDs are enabled"
msgid "Get Method"
msgstr "Get Method"
+msgid "Get Started"
+msgstr "Get Started"
+
msgid "GL Account"
msgstr "GL Account"
@@ -4770,6 +4770,9 @@ msgstr "GL expense account for non-inventory purchases (supplies, services)."
msgid "GL liability account credited for sales tax collected from customers."
msgstr "GL liability account credited for sales tax collected from customers."
+msgid "Go to implementation hub"
+msgstr "Go to implementation hub"
+
#. placeholder {0}: user.firstName
msgid "Good afternoon, {0}"
msgstr "Good afternoon, {0}"
diff --git a/packages/locale/locales/es/erp.po b/packages/locale/locales/es/erp.po
index 72ebcc9e33..622bbb112f 100644
--- a/packages/locale/locales/es/erp.po
+++ b/packages/locale/locales/es/erp.po
@@ -3919,9 +3919,6 @@ msgstr "Error al eliminar el modelo de la línea de orden de venta"
msgid "Error validating serial number"
msgstr "Error validando número de serie"
-msgid "Error!"
-msgstr "¡Error!"
-
msgid "Escalation"
msgstr "Escalada"
@@ -4656,6 +4653,9 @@ msgstr "Los IDs generados están habilitados"
msgid "Get Method"
msgstr "Obtener Método"
+msgid "Get Started"
+msgstr ""
+
msgid "GL Account"
msgstr "Cuenta Contable"
@@ -4770,6 +4770,9 @@ msgstr "Cuenta GL de gastos para compras que no son de inventario (suministros,
msgid "GL liability account credited for sales tax collected from customers."
msgstr "Cuenta GL de pasivos acreditada por impuesto a las ventas cobrado de los clientes."
+msgid "Go to implementation hub"
+msgstr ""
+
#. placeholder {0}: user.firstName
msgid "Good afternoon, {0}"
msgstr "Buenas tardes, {0}"
diff --git a/packages/locale/locales/fr/erp.po b/packages/locale/locales/fr/erp.po
index 49014e46c8..981e822813 100644
--- a/packages/locale/locales/fr/erp.po
+++ b/packages/locale/locales/fr/erp.po
@@ -3919,9 +3919,6 @@ msgstr "Erreur lors de la suppression du modèle de la ligne de commande client"
msgid "Error validating serial number"
msgstr "Erreur lors de la validation du numéro de série"
-msgid "Error!"
-msgstr "Erreur !"
-
msgid "Escalation"
msgstr "Escalade"
@@ -4656,6 +4653,9 @@ msgstr "Les IDs générés sont activés"
msgid "Get Method"
msgstr "Obtenir la méthode"
+msgid "Get Started"
+msgstr ""
+
msgid "GL Account"
msgstr "Compte GL"
@@ -4770,6 +4770,9 @@ msgstr "Compte GL de dépenses pour les achats non inventoriables (fournitures,
msgid "GL liability account credited for sales tax collected from customers."
msgstr "Compte GL de passif crédité pour la taxe de vente collectée auprès des clients."
+msgid "Go to implementation hub"
+msgstr ""
+
#. placeholder {0}: user.firstName
msgid "Good afternoon, {0}"
msgstr "Bon après-midi, {0}"
diff --git a/packages/locale/locales/hi/erp.po b/packages/locale/locales/hi/erp.po
index 0a212876c6..f40ec89e35 100644
--- a/packages/locale/locales/hi/erp.po
+++ b/packages/locale/locales/hi/erp.po
@@ -3919,9 +3919,6 @@ msgstr "बिक्रय आदेश लाइन से मॉडल हट
msgid "Error validating serial number"
msgstr "सीरियल नंबर को मान्य करने में त्रुटि"
-msgid "Error!"
-msgstr "त्रुटि!"
-
msgid "Escalation"
msgstr "संवर्धन"
@@ -4656,6 +4653,9 @@ msgstr "जेनरेट की गई आईडी सक्षम हैं"
msgid "Get Method"
msgstr "विधि प्राप्त करें"
+msgid "Get Started"
+msgstr ""
+
msgid "GL Account"
msgstr "जीएल खाता"
@@ -4770,6 +4770,9 @@ msgstr "गैर-इन्वेंटरी खरीद के लिए GL
msgid "GL liability account credited for sales tax collected from customers."
msgstr "ग्राहकों से एकत्र किए गए बिक्री कर के लिए GL देयता खाता।"
+msgid "Go to implementation hub"
+msgstr ""
+
#. placeholder {0}: user.firstName
msgid "Good afternoon, {0}"
msgstr "शुभ दोपहर, {0}"
diff --git a/packages/locale/locales/it/erp.po b/packages/locale/locales/it/erp.po
index 04892b7a59..78949a19ca 100644
--- a/packages/locale/locales/it/erp.po
+++ b/packages/locale/locales/it/erp.po
@@ -3919,9 +3919,6 @@ msgstr "Errore nella rimozione del modello dalla riga dell'ordine di vendita"
msgid "Error validating serial number"
msgstr "Errore durante la convalida del numero di serie"
-msgid "Error!"
-msgstr "Errore!"
-
msgid "Escalation"
msgstr "Escalation"
@@ -4656,6 +4653,9 @@ msgstr "Gli ID generati sono abilitati"
msgid "Get Method"
msgstr "Ottieni Metodo"
+msgid "Get Started"
+msgstr ""
+
msgid "GL Account"
msgstr "Conto Contabile"
@@ -4770,6 +4770,9 @@ msgstr "Conto GL di spesa per acquisti non di magazzino (forniture, servizi)."
msgid "GL liability account credited for sales tax collected from customers."
msgstr "Conto GL di passività accreditato per l'IVA riscossa dai clienti."
+msgid "Go to implementation hub"
+msgstr ""
+
#. placeholder {0}: user.firstName
msgid "Good afternoon, {0}"
msgstr "Buongiorno, {0}"
diff --git a/packages/locale/locales/ja/erp.po b/packages/locale/locales/ja/erp.po
index 1475eb2d54..9ede023526 100644
--- a/packages/locale/locales/ja/erp.po
+++ b/packages/locale/locales/ja/erp.po
@@ -3919,9 +3919,6 @@ msgstr "販売注文行からモデルを削除するエラー"
msgid "Error validating serial number"
msgstr "シリアル番号の検証エラー"
-msgid "Error!"
-msgstr "エラー!"
-
msgid "Escalation"
msgstr "エスカレーション"
@@ -4656,6 +4653,9 @@ msgstr "生成されたIDが有効です"
msgid "Get Method"
msgstr "メソッドを取得"
+msgid "Get Started"
+msgstr ""
+
msgid "GL Account"
msgstr "GLアカウント"
@@ -4770,6 +4770,9 @@ msgstr "非インベントリ購入(用品、サービス)のためのGL支
msgid "GL liability account credited for sales tax collected from customers."
msgstr "顧客から徴収された売上税についてクレジットされるGL負債勘定。"
+msgid "Go to implementation hub"
+msgstr ""
+
#. placeholder {0}: user.firstName
msgid "Good afternoon, {0}"
msgstr "こんにちは、{0}"
diff --git a/packages/locale/locales/pl/erp.po b/packages/locale/locales/pl/erp.po
index 4f570eb685..31701b5687 100644
--- a/packages/locale/locales/pl/erp.po
+++ b/packages/locale/locales/pl/erp.po
@@ -3919,9 +3919,6 @@ msgstr "Błąd podczas usuwania modelu z linii zamówienia sprzedaży"
msgid "Error validating serial number"
msgstr "Błąd podczas walidacji numeru seryjnego"
-msgid "Error!"
-msgstr "Błąd!"
-
msgid "Escalation"
msgstr "Eskalacja"
@@ -4656,6 +4653,9 @@ msgstr "Wygenerowane identyfikatory są włączone"
msgid "Get Method"
msgstr "Pobierz metodę"
+msgid "Get Started"
+msgstr ""
+
msgid "GL Account"
msgstr "Konto księgi głównej"
@@ -4770,6 +4770,9 @@ msgstr "Konto GL wydatków dla zakupów spoza zapasów (materiały, usługi)."
msgid "GL liability account credited for sales tax collected from customers."
msgstr "Konto GL zobowiązań kredytowane dla podatku od sprzedaży pobranego od klientów."
+msgid "Go to implementation hub"
+msgstr ""
+
#. placeholder {0}: user.firstName
msgid "Good afternoon, {0}"
msgstr "Dobry wieczór, {0}"
diff --git a/packages/locale/locales/pt/erp.po b/packages/locale/locales/pt/erp.po
index aed4994409..bb8d042317 100644
--- a/packages/locale/locales/pt/erp.po
+++ b/packages/locale/locales/pt/erp.po
@@ -3919,9 +3919,6 @@ msgstr "Erro ao remover modelo da linha de pedido de venda"
msgid "Error validating serial number"
msgstr "Erro ao validar número de série"
-msgid "Error!"
-msgstr "Erro!"
-
msgid "Escalation"
msgstr "Escalação"
@@ -4656,6 +4653,9 @@ msgstr "IDs gerados estão ativados"
msgid "Get Method"
msgstr "Obter Método"
+msgid "Get Started"
+msgstr ""
+
msgid "GL Account"
msgstr "Conta Contábil"
@@ -4770,6 +4770,9 @@ msgstr "Conta GL de despesa para compras fora do inventário (suprimentos, servi
msgid "GL liability account credited for sales tax collected from customers."
msgstr "Conta GL de passivo creditada para imposto sobre vendas cobrado de clientes."
+msgid "Go to implementation hub"
+msgstr ""
+
#. placeholder {0}: user.firstName
msgid "Good afternoon, {0}"
msgstr "Boa tarde, {0}"
diff --git a/packages/locale/locales/ru/erp.po b/packages/locale/locales/ru/erp.po
index eafc4804b4..7cd7be83f1 100644
--- a/packages/locale/locales/ru/erp.po
+++ b/packages/locale/locales/ru/erp.po
@@ -3919,9 +3919,6 @@ msgstr "Ошибка при удалении модели из строки за
msgid "Error validating serial number"
msgstr "Ошибка при проверке серийного номера"
-msgid "Error!"
-msgstr "Ошибка!"
-
msgid "Escalation"
msgstr "Эскалация"
@@ -4656,6 +4653,9 @@ msgstr "Сгенерированные ID включены"
msgid "Get Method"
msgstr "Получить метод"
+msgid "Get Started"
+msgstr ""
+
msgid "GL Account"
msgstr "Счет ГЛ"
@@ -4770,6 +4770,9 @@ msgstr "Счет GL расходов для покупок, не входящи
msgid "GL liability account credited for sales tax collected from customers."
msgstr "Счет GL обязательств, кредитуемый по налогу с продаж, собранному у клиентов."
+msgid "Go to implementation hub"
+msgstr ""
+
#. placeholder {0}: user.firstName
msgid "Good afternoon, {0}"
msgstr "Добрый день, {0}"
diff --git a/packages/locale/locales/tr/erp.po b/packages/locale/locales/tr/erp.po
index 6e82dd1cb2..c866c149c3 100644
--- a/packages/locale/locales/tr/erp.po
+++ b/packages/locale/locales/tr/erp.po
@@ -3919,9 +3919,6 @@ msgstr "Satır satış siparişinden model kaldırma hatası"
msgid "Error validating serial number"
msgstr "Seri numarası doğrulama hatası"
-msgid "Error!"
-msgstr "Hata!"
-
msgid "Escalation"
msgstr "Yükseltme"
@@ -4656,6 +4653,9 @@ msgstr "Oluşturulan Kimlikler etkinleştirilmiş"
msgid "Get Method"
msgstr "Yöntemi Al"
+msgid "Get Started"
+msgstr ""
+
msgid "GL Account"
msgstr "BÜTÇE HESABI"
@@ -4770,6 +4770,9 @@ msgstr "Stok dışı satın almalar (malzemeleri, hizmetleri) için GL gider hes
msgid "GL liability account credited for sales tax collected from customers."
msgstr "Müşterilerden toplanan satış vergisi için alacaklandırılan GL yükümlülük hesabı."
+msgid "Go to implementation hub"
+msgstr ""
+
#. placeholder {0}: user.firstName
msgid "Good afternoon, {0}"
msgstr "İyi öğleden sonra, {0}"
diff --git a/packages/locale/locales/zh/erp.po b/packages/locale/locales/zh/erp.po
index 2a8fc2ead7..eebe048fe1 100644
--- a/packages/locale/locales/zh/erp.po
+++ b/packages/locale/locales/zh/erp.po
@@ -3919,9 +3919,6 @@ msgstr "从销售订单行中删除模型时出错"
msgid "Error validating serial number"
msgstr "验证序列号时出错"
-msgid "Error!"
-msgstr "错误!"
-
msgid "Escalation"
msgstr "升级"
@@ -4656,6 +4653,9 @@ msgstr "生成的ID已启用"
msgid "Get Method"
msgstr "获取方法"
+msgid "Get Started"
+msgstr ""
+
msgid "GL Account"
msgstr "总账账户"
@@ -4770,6 +4770,9 @@ msgstr "非库存购买(用品、服务)的GL支出账户。"
msgid "GL liability account credited for sales tax collected from customers."
msgstr "从客户征收的销售税的GL负债账户。"
+msgid "Go to implementation hub"
+msgstr ""
+
#. placeholder {0}: user.firstName
msgid "Good afternoon, {0}"
msgstr "下午好,{0}"
diff --git a/packages/onboarding/EXTENDING.md b/packages/onboarding/EXTENDING.md
new file mode 100644
index 0000000000..536b04284c
--- /dev/null
+++ b/packages/onboarding/EXTENDING.md
@@ -0,0 +1,105 @@
+# Extending the Implementation Hub
+
+The hub grows on **two axes**. Keep them separate in your head:
+
+1. **Template** (code, all customers) — the blueprint in `src/content/*`. Edit a
+ registry, every company gets it.
+2. **Per-customer** (DB, runtime) — overrides a company's Carbon staff layer on
+ top: exclusions, fill-in field values, custom rows, tier. These live in
+ Postgres and resolve in the store, never in code.
+
+## Architecture in one breath
+
+```
+content/* → the template (pure data: pages, steps, rows, copy, registries)
+logic/* → pure functions over template + saved state (visibility, keys, overlay)
+server.ts → Supabase reads/writes (loader + /state action call these)
+ui/state/* → the zustand store: a SERVER-DRIVEN mirror of loader data + a
+ dispatch that round-trips every write to the /state action
+ui/primitives/* → composable building blocks (Section, StatusToggle, …)
+ui/*View.tsx → presentational; read the store via hooks, never take data props
+```
+
+The store is **not** a client cache. The React Router loader is the source of
+truth; the store mirrors it and re-hydrates on every revalidation. Writes go
+`useHubActions()` → `dispatch` → `/state` action → Supabase → realtime
+revalidate → loader → store. No optimistic local state.
+
+## Recipe: add a custom-row surface (per-customer)
+
+A list Carbon staff can extend per company (like "Data Migration → Added for
+this customer").
+
+1. **`content/collections.ts`** — add an entry: `addLabel`, `emptyText`,
+ `newPayload()`, and `flag` if rows toggle a single boolean.
+2. **server `/state` action** — already accepts any `collection` string; nothing
+ to change unless the write needs special gating.
+3. **In your view** — render it:
+ ```tsx
+ <CustomRowSection collection="yourKey">
+ {(row) => <YourRow row={row} />}
+ </CustomRowSection>
+ ```
+ `CustomRowSection` reads rows + canEdit from the store and wires Add to
+ `newPayload()` for you. Your row body reads `useCanEdit()` / `useCheckMap()` /
+ `useHubActions()` and persists per-row status with a `flagKey`/`checkKey`.
+
+## Recipe: add an editable fill-in field (per-customer)
+
+1. Pick a stable `fieldKey` (e.g. `"plan.goLiveTarget"`). Add its default to the
+ relevant `content/*` template.
+2. Render `<EditableField fieldKey=… value={fieldMap.get(key)} defaultValue=…
+ onSave={…} />` (or `<EditableInput>` for a bare input).
+3. Persist with `useHubActions().setField(key, value)`. The server already gates
+ `setField` to internal staff; widen there if a customer-owned field is added.
+
+## Recipe: deep-link a row to an ERP screen
+
+The package can't import the ERP's `path.to`, so screen links are injected. The
+Setup Map links each row to where you configure that thing:
+
+1. Each setup row already has a stable `key`. Map it to a screen in
+ `apps/erp/app/routes/x+/get-started+/_layout.tsx` → `SETUP_SCREEN_PATHS`
+ (`"<row-key>": path.to.<screen>`). Keys with no entry render as plain text.
+2. The layout passes `resolveScreenUrl` into `<HubProvider>`; any view reads it
+ via `useResolveScreenUrl()` and renders a link when it returns a URL. Reuse
+ this same hook to deep-link rows on any other surface.
+
+## Recipe: add a page (template)
+
+1. **`content/registry.ts`** — add a `PageDef` (slug, group, order, nav label,
+ tiers/moduleTags for visibility). The sidebar (`useImplementationSubmodules`)
+ builds itself from this — no nav edit.
+2. **`content/copy.ts`** — add `PAGE_COPY[slug]` (`title`, `lead`).
+3. **`ui/YourView.tsx`** — build it from primitives + store hooks; export from
+ `ui/index.ts`.
+4. **`apps/erp/app/routes/x+/get-started+/<slug>.tsx`** — a one-liner route:
+ `export default () => <YourView />` (the layout's `<HubProvider>` feeds it).
+ Carbon-only pages add a server `isInternal` redirect in their loader.
+
+## Recipe: add a nested product step (template)
+
+Add a `NestedProductStep` to the relevant `SPINE` step in `content/spine.ts`. If
+it auto-detects from real Carbon data, add a `DetectSignal` to `types.ts` and a
+probe in `server.ts:detectImplementationSignals`. Gate status overlay
+(`logic/overlay.ts`) handles the rest.
+
+## Conventions
+
+- **Keys are forever.** Build them with the helpers in `logic/keys.ts`
+ (`gateKey`, `flagKey`, `checkKey`, …); never hand-format a key string.
+- **Colours/labels** for owners + statuses live in `ui/primitives/tokens.ts`.
+ Don't re-declare them in a view.
+- **Copy** customers read belongs in `content/copy.ts`, not in JSX.
+- **`canEdit` is UX only.** The `/state` server action is the real authority on
+ who may write — never trust the client flag for a security decision.
+- **Visibility** (tier / module-exclusion) goes through `logic/visibility.ts`
+ (`isPageVisible`, `filterByModule`). Don't re-implement the filter inline.
+
+## Migration status
+
+Fully on the store + primitives + copy: Data Migration, Setup Map, Requirements.
+Token maps centralized in: Roles, Board. The remaining views (Scope, Value,
+Plan, Go-Live, Training, Team, Controls, OnboardingHub) still take props from
+their routes — migrate them with the recipes above as they're next touched.
+```
diff --git a/packages/onboarding/package.json b/packages/onboarding/package.json
new file mode 100644
index 0000000000..2de64131f0
--- /dev/null
+++ b/packages/onboarding/package.json
@@ -0,0 +1,39 @@
+{
+ "name": "@carbon/onboarding",
+ "version": "0.0.0",
+ "type": "module",
+ "private": true,
+ "sideEffects": false,
+ "exports": {
+ ".": "./src/index.ts",
+ "./server": "./src/server.ts",
+ "./ui": "./src/ui/index.ts"
+ },
+ "dependencies": {
+ "@carbon/database": "workspace:*",
+ "@carbon/form": "workspace:*",
+ "@carbon/react": "workspace:*",
+ "@carbon/utils": "workspace:*",
+ "@internationalized/date": "catalog:",
+ "@supabase/supabase-js": "catalog:",
+ "react": "catalog:",
+ "react-icons": "catalog:",
+ "zod": "catalog:",
+ "zustand": "catalog:"
+ },
+ "devDependencies": {
+ "@carbon/config": "workspace:*",
+ "@types/react": "catalog:",
+ "rimraf": "catalog:",
+ "tsup": "catalog:",
+ "typescript": "catalog:",
+ "vitest": "catalog:"
+ },
+ "scripts": {
+ "clean": "rimraf .turbo node_modules dist",
+ "dev": "tsup --watch",
+ "lint": "biome lint --write ",
+ "test": "vitest run",
+ "typecheck": "tsgo --noEmit"
+ }
+}
diff --git a/packages/onboarding/src/content/board.ts b/packages/onboarding/src/content/board.ts
new file mode 100644
index 0000000000..2e010d26f9
--- /dev/null
+++ b/packages/onboarding/src/content/board.ts
@@ -0,0 +1,123 @@
+import type { BoardTask } from "../types";
+
+// Starter Project Board tasks, grouped under the six spine steps. Keys match the
+// prototype's boardKeys. Each task's status lives in implementationCheckState
+// (kind "task", itemKey = taskKey(key)); the Plan page derives its checklist
+// from the same rows.
+export const BOARD_TASKS: BoardTask[] = [
+ {
+ key: "kickoff",
+ label: "Agree who owns what and set a working rhythm",
+ stepKey: "gate:discovery",
+ owner: "shared"
+ },
+ {
+ key: "process-mapped",
+ label: "Walk your current process, systems, and data",
+ stepKey: "gate:discovery",
+ owner: "shared"
+ },
+ {
+ key: "scope-signed",
+ label: "Confirm and sign the scope",
+ stepKey: "gate:discovery",
+ owner: "shared"
+ },
+ {
+ key: "sites-users",
+ label: "Set up sites, users, and roles",
+ stepKey: "gate:configure",
+ owner: "carbon"
+ },
+ {
+ key: "parts-boms",
+ label: "Load parts, BOMs, Bill of Process, and costing",
+ stepKey: "gate:configure",
+ owner: "carbon"
+ },
+ {
+ key: "cto-options",
+ label: "Configure-to-order options and pricing",
+ stepKey: "gate:configure",
+ owner: "carbon"
+ },
+ {
+ key: "purchase-planning",
+ label: "Turn on automated purchase planning",
+ stepKey: "gate:configure",
+ owner: "carbon"
+ },
+ {
+ key: "shopfloor-stations",
+ label: "Set up the shop-floor app and stations",
+ stepKey: "gate:configure",
+ owner: "carbon"
+ },
+ {
+ key: "integrations",
+ label: "Build any net-new integrations or customizations",
+ stepKey: "gate:configure",
+ owner: "carbon",
+ // Paid-tier only — self-serve uses standard cloud Carbon, no custom build
+ // (mirrors the gated prod:configure-netnew spine step).
+ tiers: ["guided", "enterprise"]
+ },
+ {
+ key: "hosting",
+ label: "Stand up hosting (cloud or self-hosted)",
+ stepKey: "gate:configure",
+ owner: "carbon",
+ // Paid-tier only — self-serve is managed cloud, nothing to stand up
+ // (mirrors the gated prod:configure-hosting spine step).
+ tiers: ["guided", "enterprise"]
+ },
+ {
+ key: "data-loaded",
+ label: "Pull, map, and load your data",
+ stepKey: "gate:migrate",
+ owner: "carbon",
+ // Paid-tier only — self-serve has no data-migration gate (see spine).
+ tiers: ["guided", "enterprise"]
+ },
+ {
+ key: "data-validated",
+ label: "Validate a sample and approve the migrated data",
+ stepKey: "gate:migrate",
+ owner: "you",
+ tiers: ["guided", "enterprise"]
+ },
+ {
+ key: "training-materials",
+ label: "Build role-based training materials",
+ stepKey: "gate:train",
+ owner: "carbon"
+ },
+ {
+ key: "champions-trained",
+ label: "Run hands-on sessions and sign off your team",
+ stepKey: "gate:train",
+ owner: "you"
+ },
+ {
+ key: "acceptance-passed",
+ label: "Run the acceptance checklist to a pass",
+ stepKey: "gate:acceptance",
+ owner: "shared",
+ // Paid-tier only — self-serve has no formal acceptance gate (see spine).
+ tiers: ["guided", "enterprise"]
+ },
+ {
+ key: "cutover",
+ label: "Cut over to Carbon and freeze the old system",
+ stepKey: "gate:golive",
+ owner: "shared"
+ },
+ {
+ key: "hypercare",
+ label: "Hypercare: intense support for the first weeks",
+ stepKey: "gate:golive",
+ owner: "shared",
+ // Paid-tier only — self-serve has no Carbon team for post-launch hypercare.
+ tiers: ["guided", "enterprise"]
+ }
+];
diff --git a/packages/onboarding/src/content/collections.ts b/packages/onboarding/src/content/collections.ts
new file mode 100644
index 0000000000..aec9e033e4
--- /dev/null
+++ b/packages/onboarding/src/content/collections.ts
@@ -0,0 +1,62 @@
+// Registry of the custom-row surfaces — the per-customer "Added for this
+// customer" lists Carbon staff can extend on top of the template. One entry here
+// gives a surface its add-button label, empty-state copy, and the default
+// payload for a new row. The server persists these as `implementationRow` keyed
+// by `collection`; the matching server branch already accepts any collection
+// string, so adding a surface is: add an entry here + render it with
+// <CustomRowSection collection="…"> + a render-prop row body.
+
+export interface CollectionDef {
+ collection: string;
+ addLabel: string;
+ emptyText: string;
+ // Binary status-toggle labels for surfaces whose rows flip a single flag
+ // (validated / configured / in-scope). Multi-status surfaces (board) and
+ // checkbox surfaces (golive) leave this unset.
+ flag?: { active: string; inactive: string };
+ // Default cells for a freshly added row. A function so each call is a fresh
+ // object (no shared-reference surprises).
+ newPayload: () => Record<string, unknown>;
+}
+
+export const COLLECTIONS = {
+ board: {
+ collection: "board",
+ addLabel: "Add a task",
+ emptyText: "No custom tasks yet. Add deal-specific work here.",
+ newPayload: () => ({ label: "New task", owner: "shared", status: "todo" })
+ },
+ data: {
+ collection: "data",
+ addLabel: "Add a row",
+ emptyText:
+ "No extra data sets yet. Add anything specific to this customer.",
+ flag: { active: "Validated", inactive: "Not yet" },
+ newPayload: () => ({ object: "New data set", today: "" })
+ },
+ setup: {
+ collection: "setup",
+ addLabel: "Add a row",
+ emptyText:
+ "No extra setup items yet. Add anything specific to this customer.",
+ flag: { active: "Configured", inactive: "Not yet" },
+ newPayload: () => ({ object: "New setup item", today: "" })
+ },
+ requirement: {
+ collection: "requirement",
+ addLabel: "Add a requirement",
+ emptyText:
+ "No extra requirements yet. Add anything specific to this customer.",
+ flag: { active: "In scope", inactive: "Out" },
+ newPayload: () => ({ requirement: "New requirement" })
+ },
+ golive: {
+ collection: "golive",
+ addLabel: "Add a step",
+ emptyText:
+ "No extra cutover steps yet. Add anything specific to this customer.",
+ newPayload: () => ({ label: "New cutover step" })
+ }
+} satisfies Record<string, CollectionDef>;
+
+export type CollectionKey = keyof typeof COLLECTIONS;
diff --git a/packages/onboarding/src/content/copy.ts b/packages/onboarding/src/content/copy.ts
new file mode 100644
index 0000000000..1a41cf34b0
--- /dev/null
+++ b/packages/onboarding/src/content/copy.ts
@@ -0,0 +1,71 @@
+// Customer-facing copy, lifted out of the view components so it lives in the
+// editable content layer (a non-engineer can tweak wording here without touching
+// JSX). PAGE_COPY drives each page's H1 + intro; UI_TEXT holds the small shared
+// strings the surfaces share. Per-page section titles still live in their views
+// for now — move them here as the need to re-word them arises.
+
+export interface PageCopy {
+ title: string;
+ // Optional: some pages compose a dynamic lead in the view (e.g. Plan's
+ // step count) and only take the title from here.
+ lead?: string;
+}
+
+export const PAGE_COPY = {
+ scope: {
+ title: "Scope Summary",
+ lead: "Read this through. When it's right, sign off at the bottom. It's the statement your commercial agreement points to, with no prices or legal terms here."
+ },
+ roles: {
+ title: "Roles & Responsibilities",
+ lead: "Who does what, across the six steps. Your side is highlighted up top. Own it well and the project moves."
+ },
+ board: {
+ title: "Project Board",
+ lead: "Every task for the project, grouped by step. If it isn't on the board, it isn't happening. Click a status to cycle it."
+ },
+ setup: {
+ title: "Setup Map",
+ lead: "The master data to set up when first configuring Carbon, grouped by module. Mark each one configured as you go."
+ },
+ data: {
+ title: "Data Migration Map",
+ lead: "Your job here: check a real sample of each row, then mark it validated. Foundation data loads first, then master records, then open transactions at cutover."
+ },
+ requirements: {
+ title: "Requirements & Process Map",
+ lead: "Walk each area with your champion and toggle anything out of scope. Codes read Module.Area.Number (ACC.GL.01 = Accounting, General Ledger, item 1)."
+ },
+ "go-live": {
+ title: "Go-Live & Acceptance",
+ lead: "On cutover day, work the checklist below in order. Acceptance tests come from your in-scope requirements. Support details are at the bottom."
+ },
+ value: {
+ title: "Value Snapshot",
+ lead: "What changes when you move to Carbon, and roughly what it's worth. Estimates, not a forecast."
+ },
+ plan: {
+ title: "Project Plan & Timeline"
+ // lead composed in the view (includes the dynamic step count).
+ },
+ training: {
+ title: "Training Plan",
+ lead: "Who gets trained on what, in what format. Your part: protect the hands-on session time on your champions' calendars early. It's what slips most when shops get busy."
+ },
+ team: {
+ title: "Your Project Team",
+ lead: "The people on the Carbon side who will run your implementation, and how to reach them."
+ }
+} satisfies Record<string, PageCopy>;
+
+export const UI_TEXT = {
+ // Header on the per-customer custom-row sections.
+ addedForCustomer: "Added for this customer",
+ // Badge shown to Carbon staff on editable / internal-only surfaces.
+ carbonOnly: "Carbon-only",
+ // Note under a Carbon-owned fill-in field the customer sees but can't edit.
+ carbonOnlyLockedField: "Carbon-only · the customer sees this text, locked.",
+ // Note under the Value Snapshot's editable metrics.
+ carbonOnlyValueNote:
+ "Carbon-only · fill in real targets for this customer. They see the values, locked."
+} as const;
diff --git a/packages/onboarding/src/content/data.ts b/packages/onboarding/src/content/data.ts
new file mode 100644
index 0000000000..96f3648cff
--- /dev/null
+++ b/packages/onboarding/src/content/data.ts
@@ -0,0 +1,134 @@
+import type { Mod } from "../types";
+
+export interface DataRow {
+ key: string; // stable, for the "validated" flag state
+ object: string;
+ today: string; // "what you call it today" hint
+ moduleTags?: Mod[];
+}
+
+export interface DataGroup {
+ n: number;
+ title: string;
+ desc: string;
+ rows: DataRow[];
+}
+
+// Three load groups, in order: foundation first, then master records, then open
+// transactions last (at cutover, so they're current). Module-tagged rows drop
+// out when their modules are excluded.
+export const DATA_GROUPS: DataGroup[] = [
+ {
+ n: 1,
+ title: "Foundation",
+ desc: "The reference data everything else hangs off. Loads first.",
+ rows: [
+ {
+ key: "sites",
+ object: "Sites & locations",
+ today: "Plants, warehouses"
+ },
+ {
+ key: "coa",
+ object: "Chart of accounts",
+ today: "Your GL accounts",
+ moduleTags: ["acc"]
+ },
+ {
+ key: "tax",
+ object: "Currencies & tax",
+ today: "Tax codes, rates",
+ moduleTags: ["acc"]
+ },
+ { key: "uom", object: "Units of measure", today: "Each, lb, ft…" },
+ { key: "roles", object: "User roles", today: "Who can do what" },
+ {
+ key: "workcenters",
+ object: "Work centers",
+ today: "Machines, cells, stations",
+ moduleTags: ["prd"]
+ }
+ ]
+ },
+ {
+ n: 2,
+ title: "Master records",
+ desc: "The catalog you run on. Loads once foundation is in.",
+ rows: [
+ { key: "parts", object: "Parts & items", today: "Your part numbers" },
+ {
+ key: "boms",
+ object: "BOMs",
+ today: "Bills of material",
+ moduleTags: ["itm"]
+ },
+ {
+ key: "routings",
+ object: "Bill of Process",
+ today: "Operations / steps",
+ moduleTags: ["itm"]
+ },
+ {
+ key: "customers",
+ object: "Customers",
+ today: "Your customer list",
+ moduleTags: ["sal"]
+ },
+ {
+ key: "suppliers",
+ object: "Suppliers",
+ today: "Your vendor list",
+ moduleTags: ["pur"]
+ },
+ {
+ key: "pricelists",
+ object: "Price lists",
+ today: "Customer pricing",
+ moduleTags: ["sal"]
+ }
+ ]
+ },
+ {
+ n: 3,
+ title: "Open transactions",
+ desc: "Loaded last, right at cutover, so balances are current.",
+ rows: [
+ {
+ key: "open-so",
+ object: "Open sales orders",
+ today: "Unshipped orders",
+ moduleTags: ["sal"]
+ },
+ {
+ key: "open-po",
+ object: "Open purchase orders",
+ today: "Unreceived POs",
+ moduleTags: ["pur"]
+ },
+ {
+ key: "open-jobs",
+ object: "Open jobs",
+ today: "Work in progress",
+ moduleTags: ["prd"]
+ },
+ {
+ key: "inventory",
+ object: "Inventory balances",
+ today: "On-hand counts",
+ moduleTags: ["inv"]
+ },
+ {
+ key: "ar",
+ object: "Open AR",
+ today: "Money owed to you",
+ moduleTags: ["acc"]
+ },
+ {
+ key: "ap",
+ object: "Open AP",
+ today: "Money you owe",
+ moduleTags: ["acc"]
+ }
+ ]
+ }
+];
diff --git a/packages/onboarding/src/content/golive.ts b/packages/onboarding/src/content/golive.ts
new file mode 100644
index 0000000000..c641aaa469
--- /dev/null
+++ b/packages/onboarding/src/content/golive.ts
@@ -0,0 +1,56 @@
+import type { Tier } from "../types";
+
+export interface CutoverStep {
+ key: string;
+ label: string;
+}
+
+// Cutover-day checklist, run in order. Each is checkable (kind "check").
+export const CUTOVER_STEPS: CutoverStep[] = [
+ { key: "freeze", label: "Freeze the old system, no new transactions" },
+ {
+ key: "load-open",
+ label: "Load open transactions (orders, POs, inventory, balances)"
+ },
+ {
+ key: "verify-balances",
+ label: "Verify inventory and financial balances tie out"
+ },
+ { key: "smoke-test", label: "Smoke-test the core daily flows end to end" },
+ { key: "switch-users", label: "Switch users over and confirm access" },
+ { key: "go-decision", label: "Make the final go / no-go call" }
+];
+
+export const HYPERCARE: string[] = [
+ "Hands-on, fast-response support for the first 3–4 weeks",
+ "Daily check-ins while your team finds its feet on the live system",
+ "We triage and fix issues fast while your team settles in",
+ "Done when day-to-day runs without us in the room"
+];
+
+export interface SupportChannel {
+ key: string; // stable key for the per-company detail override
+ channel: string;
+ detail: string; // default; overridable per company via `golive.support.<key>`
+ // Tiers this channel applies to. Omitted => all tiers. The shared hypercare
+ // channel is paid-only — self-serve has no Carbon team behind it.
+ tiers?: Tier[];
+}
+
+export const SUPPORT_CHANNELS: SupportChannel[] = [
+ {
+ key: "shared",
+ channel: "Shared channel",
+ detail: "Real-time questions during hypercare",
+ tiers: ["guided", "enterprise"]
+ },
+ {
+ key: "docs",
+ channel: "Docs & videos",
+ detail: "Self-serve reference at docs.carbon.ms"
+ },
+ { key: "support", channel: "Product support", detail: "Bugs and changes" }
+];
+
+// Default hypercare window copy; overridable per company via `golive.hypercareWeeks`.
+export const HYPERCARE_WEEKS_DEFAULT = "the first 3 to 4 weeks";
diff --git a/packages/onboarding/src/content/howwework.ts b/packages/onboarding/src/content/howwework.ts
new file mode 100644
index 0000000000..85557b3cde
--- /dev/null
+++ b/packages/onboarding/src/content/howwework.ts
@@ -0,0 +1,47 @@
+export interface CadenceItem {
+ key: string; // stable key for the per-company `what` override
+ cadence: string;
+ what: string; // default; overridable per company via `howWeWork.cadence.<key>`
+}
+
+export const CADENCE: CadenceItem[] = [
+ {
+ key: "weekly",
+ cadence: "Weekly",
+ what: "Status call: progress, blockers, what's next"
+ },
+ {
+ key: "as-needed",
+ cadence: "As needed",
+ what: "Working sessions on configuration and data"
+ },
+ {
+ key: "gate",
+ cadence: "At each gate",
+ what: "Sign-off review before moving to the next step"
+ }
+];
+
+export interface EscalationStep {
+ n: number;
+ title: string;
+ body: string;
+}
+
+export const ESCALATION: EscalationStep[] = [
+ {
+ n: 1,
+ title: "Raise it at the weekly status call",
+ body: "Most things get caught and resolved here. Name it plainly."
+ },
+ {
+ n: 2,
+ title: "Owner + date on the Project Board",
+ body: "If it's blocking or a date is at risk, it gets an owner and is tracked."
+ },
+ {
+ n: 3,
+ title: "Escalate to the project leads",
+ body: "If it can't wait for the next call, the leads on both sides decide."
+ }
+];
diff --git a/packages/onboarding/src/content/index.ts b/packages/onboarding/src/content/index.ts
new file mode 100644
index 0000000000..6ef5a19622
--- /dev/null
+++ b/packages/onboarding/src/content/index.ts
@@ -0,0 +1,19 @@
+// Code-owned template content. A hub row pins its lineage via templateKey +
+// templateVersion; bump TEMPLATE_VERSION when the structure changes materially.
+export const TEMPLATE_KEY = "standard";
+export const TEMPLATE_VERSION = 1;
+
+export * from "./board";
+export * from "./collections";
+export * from "./copy";
+export * from "./golive";
+export * from "./howwework";
+export * from "./positioning";
+export * from "./registry";
+export * from "./requirements";
+export * from "./roles";
+export * from "./scope";
+export * from "./spine";
+export * from "./support";
+export * from "./team";
+export * from "./value";
diff --git a/packages/onboarding/src/content/positioning.ts b/packages/onboarding/src/content/positioning.ts
new file mode 100644
index 0000000000..554378724f
--- /dev/null
+++ b/packages/onboarding/src/content/positioning.ts
@@ -0,0 +1,35 @@
+export interface VsPoint {
+ lead: string;
+ body: string;
+}
+
+// Internal positioning reference (Carbon-only page).
+export const OTHER_STRENGTHS: VsPoint[] = [
+ {
+ lead: "Rigor and reassurance",
+ body: "A heavy, structured methodology that big, cautious buyers expect."
+ },
+ {
+ lead: "Breadth of legacy modules",
+ body: "Decades of niche features for edge-case industries."
+ },
+ {
+ lead: "Brand safety",
+ body: '"Nobody got fired for buying it." An incumbent comfort factor.'
+ }
+];
+
+export const CARBON_STRENGTHS: VsPoint[] = [
+ {
+ lead: "Simplicity and speed",
+ body: "Live in weeks, not quarters. Most of the product is already built."
+ },
+ {
+ lead: "Ownership",
+ body: "Open source and extensible; you're not locked in."
+ },
+ {
+ lead: "Modern, connected core",
+ body: "One database from quote to cash, with AI-assisted setup and migration."
+ }
+];
diff --git a/packages/onboarding/src/content/registry.ts b/packages/onboarding/src/content/registry.ts
new file mode 100644
index 0000000000..172df25fb8
--- /dev/null
+++ b/packages/onboarding/src/content/registry.ts
@@ -0,0 +1,156 @@
+import type { HubExclusions, PageDef } from "../types";
+
+// The hub's page list + sidebar structure (the prototype's REG array). `slug`
+// matches the route filename under apps/erp/app/routes/x+/get-started+/.
+// `order` is authoritative; numbering in the UI is derived, not stored.
+export const REGISTRY: PageDef[] = [
+ {
+ slug: "start",
+ navLabel: "Start Here",
+ title: "Start Here",
+ group: "get-started",
+ order: 0
+ },
+ {
+ slug: "team",
+ navLabel: "Your Project Team",
+ title: "Your Project Team",
+ group: "get-started",
+ order: 1,
+ tiers: ["guided", "enterprise"]
+ },
+ {
+ slug: "how-we-work",
+ navLabel: "How We Work",
+ title: "How We Work Together",
+ group: "get-started",
+ order: 2,
+ tiers: ["guided", "enterprise"]
+ },
+ {
+ slug: "scope",
+ navLabel: "Scope Summary",
+ title: "Scope Summary",
+ group: "align",
+ order: 3
+ },
+ {
+ slug: "roles",
+ navLabel: "Roles",
+ title: "Roles and Responsibilities",
+ group: "align",
+ order: 4,
+ // Paid-tier only — self-serve has no Carbon team, so there are no shared
+ // roles/responsibilities to divide.
+ tiers: ["guided", "enterprise"]
+ },
+ {
+ slug: "value",
+ navLabel: "Value Snapshot",
+ title: "Value Snapshot",
+ group: "align",
+ order: 5,
+ optional: true
+ },
+ {
+ // Plan + Board are one page now, switched via a view toggle (?view=board).
+ slug: "plan",
+ navLabel: "Plan & Board",
+ title: "Project Plan & Board",
+ group: "plan",
+ order: 6,
+ key: true
+ },
+ {
+ slug: "requirements",
+ navLabel: "Requirements",
+ title: "Requirements and Process Map",
+ group: "plan",
+ order: 7,
+ // Paid-tier only — self-serve customers configure directly rather than going
+ // through a formal requirements/process-mapping exercise.
+ tiers: ["guided", "enterprise"]
+ },
+ {
+ slug: "setup",
+ navLabel: "Setup Map",
+ title: "Setup Map",
+ group: "configure",
+ order: 8
+ },
+ {
+ slug: "data",
+ navLabel: "Data Migration",
+ title: "Data Migration Map",
+ group: "configure",
+ order: 9,
+ // Paid-tier only — self-serve customers bring no data to migrate.
+ tiers: ["guided", "enterprise"]
+ },
+ {
+ slug: "training",
+ navLabel: "Training Plan",
+ title: "Training Plan",
+ group: "launch",
+ order: 10
+ },
+ {
+ slug: "go-live",
+ navLabel: "Go-Live",
+ title: "Go-Live and Acceptance",
+ group: "launch",
+ order: 11
+ },
+ {
+ slug: "controls",
+ navLabel: "Setup & Controls",
+ title: "Setup & Controls",
+ group: "carbon-only",
+ order: 12,
+ carbonOnly: true
+ },
+ {
+ slug: "positioning",
+ navLabel: "Others vs Carbon",
+ title: "Others vs Carbon",
+ group: "carbon-only",
+ order: 13,
+ carbonOnly: true
+ }
+];
+
+export const PAGE_GROUP_LABEL: Record<PageDef["group"], string> = {
+ "get-started": "Get started",
+ align: "Align on scope",
+ plan: "Plan the work",
+ configure: "Configure Carbon",
+ launch: "Train & go live",
+ "carbon-only": "Carbon only"
+};
+
+export const PAGE_GROUP_ORDER: PageDef["group"][] = [
+ "get-started",
+ "align",
+ "plan",
+ "configure",
+ "launch",
+ "carbon-only"
+];
+
+export function pageBySlug(slug: string): PageDef | undefined {
+ return REGISTRY.find((p) => p.slug === slug);
+}
+
+// Optional sections (sub-page blocks a customer may not need). Canonical list —
+// the Setup & Controls toggles and the default-exclusions seed both read it.
+export const OPTIONAL_SECTIONS: { key: string; label: string }[] = [
+ { key: "risks", label: "Risks (on the Project Board)" }
+];
+
+// New hubs start with every optional page and section excluded — a Carbon admin
+// opts them back in per customer from Setup & Controls. Modules stay all-in.
+export const DEFAULT_EXCLUSIONS: HubExclusions = {
+ modules: [],
+ pages: REGISTRY.filter((p) => p.optional).map((p) => p.slug),
+ sections: OPTIONAL_SECTIONS.map((s) => s.key)
+};
diff --git a/packages/onboarding/src/content/requirements.ts b/packages/onboarding/src/content/requirements.ts
new file mode 100644
index 0000000000..f702f9778f
--- /dev/null
+++ b/packages/onboarding/src/content/requirements.ts
@@ -0,0 +1,246 @@
+import type { Mod } from "../types";
+
+export interface ReqRow {
+ code: string; // Module.Area.Number, e.g. SAL.QT.01
+ requirement: string;
+}
+
+export interface ReqArea {
+ code: string;
+ name: string;
+ rows: ReqRow[];
+}
+
+export interface ReqModule {
+ mod: Mod;
+ code: string;
+ name: string;
+ areas: ReqArea[];
+}
+
+// The requirements backbone: 27 rows across the seven Carbon modules
+// (order per RESTRUCTURE_SPEC). Excluded modules drop their whole section.
+export const REQUIREMENTS: ReqModule[] = [
+ {
+ mod: "sal",
+ code: "SAL",
+ name: "Sales",
+ areas: [
+ {
+ code: "SAL.QT",
+ name: "Quoting, Orders, Configure-to-Order",
+ rows: [
+ {
+ code: "SAL.QT.01",
+ requirement:
+ "Build quotes pulling live part, cost, and Bill of Process data"
+ },
+ {
+ code: "SAL.QT.02",
+ requirement: "Convert a quote to a sales order with no re-keying"
+ },
+ {
+ code: "SAL.QT.03",
+ requirement:
+ "Configure-to-order: pick options and price automatically"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ mod: "pur",
+ code: "PUR",
+ name: "Purchasing",
+ areas: [
+ {
+ code: "PUR.PO",
+ name: "Purchase Orders and Planning",
+ rows: [
+ {
+ code: "PUR.PO.01",
+ requirement: "Create and approve purchase orders"
+ },
+ {
+ code: "PUR.PO.02",
+ requirement: "Auto-suggest purchases from demand and reorder points"
+ },
+ {
+ code: "PUR.PO.03",
+ requirement: "Receive against a PO and update inventory"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ mod: "inv",
+ code: "INV",
+ name: "Inventory",
+ areas: [
+ {
+ code: "INV.IC",
+ name: "Inventory Control",
+ rows: [
+ {
+ code: "INV.IC.01",
+ requirement: "Track real-time inventory by location and bin"
+ },
+ {
+ code: "INV.IC.02",
+ requirement: "Cycle count and adjust with an audit trail"
+ },
+ {
+ code: "INV.IC.03",
+ requirement:
+ "Show one inventory number the floor and office both trust"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ mod: "itm",
+ code: "ITM",
+ name: "Items",
+ areas: [
+ {
+ code: "ITM.IM",
+ name: "Item Master and Make Methods",
+ rows: [
+ {
+ code: "ITM.IM.01",
+ requirement: "Maintain a single part and item master"
+ },
+ {
+ code: "ITM.IM.02",
+ requirement:
+ "Define multi-level BOMs and Bill of Process (make methods)"
+ }
+ ]
+ },
+ {
+ code: "ITM.ENG",
+ name: "Engineering Changes and CAD",
+ rows: [
+ {
+ code: "ITM.ENG.01",
+ requirement: "Control design changes with revisions / ECOs"
+ },
+ {
+ code: "ITM.ENG.02",
+ requirement: "Native CAD integration (for example Onshape)"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ mod: "prd",
+ code: "PRD",
+ name: "Production",
+ areas: [
+ {
+ code: "PRD.MES",
+ name: "Shop Floor and Scheduling",
+ rows: [
+ {
+ code: "PRD.SF.01",
+ requirement:
+ "Run the floor on tablets: clock labor, report progress, see instructions"
+ },
+ {
+ code: "PRD.SC.01",
+ requirement: "Schedule jobs against work-center capacity"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ mod: "qms",
+ code: "QMS",
+ name: "Quality",
+ areas: [
+ {
+ code: "QMS",
+ name: "Inspections, Nonconformance, CAPA",
+ rows: [
+ {
+ code: "QMS.INS.01",
+ requirement: "Record inspections tied to a part and a job"
+ },
+ {
+ code: "QMS.NCR.01",
+ requirement: "Log nonconformances and drive a CAPA"
+ },
+ {
+ code: "QMS.NOT.01",
+ requirement: "Automate quality flags and notifications"
+ }
+ ]
+ }
+ ]
+ },
+ {
+ mod: "acc",
+ code: "ACC",
+ name: "Accounting",
+ areas: [
+ {
+ code: "ACC.GL",
+ name: "General Ledger",
+ rows: [
+ {
+ code: "ACC.GL.01",
+ requirement:
+ "Post journal entries with proper account and description codes"
+ },
+ {
+ code: "ACC.GL.02",
+ requirement: "Handle recurring and reversing journal entries"
+ },
+ {
+ code: "ACC.GL.03",
+ requirement:
+ "Track transactions by segment (cost center, project, service line)"
+ },
+ {
+ code: "ACC.GL.04",
+ requirement: "Run month-end close and standard reconciliations"
+ }
+ ]
+ },
+ {
+ code: "ACC.AR",
+ name: "Accounts Receivable",
+ rows: [
+ {
+ code: "ACC.AR.01",
+ requirement: "Generate and send customer invoices"
+ },
+ { code: "ACC.AR.02", requirement: "Apply payments and track aging" },
+ {
+ code: "ACC.AR.03",
+ requirement: "Tie shipments through to an invoice with no re-keying"
+ }
+ ]
+ },
+ {
+ code: "ACC.AP",
+ name: "Accounts Payable",
+ rows: [
+ {
+ code: "ACC.AP.01",
+ requirement:
+ "Enter and approve vendor bills against a PO (three-way match)"
+ },
+ {
+ code: "ACC.AP.02",
+ requirement: "Run payment batches and track aging"
+ }
+ ]
+ }
+ ]
+ }
+];
diff --git a/packages/onboarding/src/content/roles.ts b/packages/onboarding/src/content/roles.ts
new file mode 100644
index 0000000000..3131df32cd
--- /dev/null
+++ b/packages/onboarding/src/content/roles.ts
@@ -0,0 +1,90 @@
+import type { Owner } from "../types";
+
+export interface RoleLine {
+ label: string;
+ owner: Owner;
+}
+
+export interface RolesStep {
+ stepKey: string;
+ title: string;
+ lines: RoleLine[];
+}
+
+// Ours/Yours/Shared split per step (the prototype's roles matrix). Drives the
+// Roles & Responsibilities page.
+export const ROLES: RolesStep[] = [
+ {
+ stepKey: "gate:discovery",
+ title: "Discovery",
+ lines: [
+ { owner: "carbon", label: "Map your current process, systems, and data" },
+ { owner: "you", label: "Provide process knowledge and inputs" },
+ {
+ owner: "you",
+ label: "Name an internal project owner with decision authority"
+ },
+ { owner: "you", label: "Commit a champion user for each area" },
+ { owner: "shared", label: "Confirm and sign the scope" }
+ ]
+ },
+ {
+ stepKey: "gate:configure",
+ title: "Configure",
+ lines: [
+ {
+ owner: "carbon",
+ label:
+ "Configure sites, work centers, Bill of Process, BOMs, costing, roles"
+ },
+ {
+ owner: "you",
+ label: "Set up your own data with import tools and LLM help"
+ },
+ { owner: "carbon", label: "Build integrations and customizations" },
+ { owner: "carbon", label: "Host, secure, and back up the platform" }
+ ]
+ },
+ {
+ stepKey: "gate:migrate",
+ title: "Migrate data",
+ lines: [
+ { owner: "carbon", label: "Pull, map, and load your data" },
+ { owner: "you", label: "Clean and approve the migrated data" }
+ ]
+ },
+ {
+ stepKey: "gate:train",
+ title: "Train",
+ lines: [
+ {
+ owner: "carbon",
+ label: "Build tailored, role-based training materials"
+ },
+ { owner: "carbon", label: "Run hands-on sessions with your champions" },
+ { owner: "you", label: "Protect training time and attend" },
+ {
+ owner: "you",
+ label: "Train the rest of your team (after train-the-trainer)"
+ }
+ ]
+ },
+ {
+ stepKey: "gate:acceptance",
+ title: "Acceptance",
+ lines: [
+ { owner: "shared", label: "Run acceptance testing" },
+ { owner: "shared", label: "Make the go / no-go decision" }
+ ]
+ },
+ {
+ stepKey: "gate:golive",
+ title: "Go-Live",
+ lines: [
+ { owner: "carbon", label: "Cutover support" },
+ { owner: "you", label: "Protect the go-live date" },
+ { owner: "shared", label: "Hypercare in the first weeks" },
+ { owner: "carbon", label: "Product issues during hypercare" }
+ ]
+ }
+];
diff --git a/packages/onboarding/src/content/scope.ts b/packages/onboarding/src/content/scope.ts
new file mode 100644
index 0000000000..483d092755
--- /dev/null
+++ b/packages/onboarding/src/content/scope.ts
@@ -0,0 +1,94 @@
+import type { Mod, Tier } from "../types";
+
+export interface ScopeItem {
+ label: string;
+ moduleTags?: Mod[];
+ // Tiers this line applies to. Omitted => all tiers. Self-serve has no Carbon-run
+ // migration or formal acceptance, so those lines are paid-only.
+ tiers?: Tier[];
+}
+
+// In-scope capabilities. Module-tagged rows drop out (and surface under
+// "out of scope") when their modules are excluded in Setup & Controls.
+export const SCOPE_IN: ScopeItem[] = [
+ { label: "Accounting: GL, AR, AP, and month-end close", moduleTags: ["acc"] },
+ {
+ label: "Inventory and purchasing, with automated planning",
+ moduleTags: ["inv", "pur"]
+ },
+ { label: "Sales, quoting, and configure-to-order", moduleTags: ["sal"] },
+ {
+ label:
+ "Items: item master, BOMs, Bill of Process, engineering changes, CAD",
+ moduleTags: ["itm"]
+ },
+ { label: "Production: shop-floor app and scheduling", moduleTags: ["prd"] },
+ { label: "Quality: inspections, nonconformance, CAPA", moduleTags: ["qms"] },
+ {
+ label: "Data migration of the items on the Data Migration Map",
+ tiers: ["guided", "enterprise"]
+ },
+ {
+ label: "Loading your own data with Carbon's import tools",
+ tiers: ["self_serve"]
+ },
+ { label: "Training your team via the Academy and in-app guides" },
+ {
+ label: "Go-live and acceptance sign-off",
+ tiers: ["guided", "enterprise"]
+ },
+ { label: "Going live on Carbon", tiers: ["self_serve"] }
+];
+
+export const SCOPE_OUT: string[] = [
+ "Anything not explicitly listed in scope above",
+ "Custom development beyond what's listed",
+ "Integrations not named here",
+ "Historical data older than what's on the Data Migration Map"
+];
+
+const SCOPE_OUT_SELF_SERVE: string[] = [
+ "Anything not explicitly listed in scope above",
+ "Custom development, integrations, or self-hosting",
+ "A Carbon-run data migration — you load your own data",
+ "A formal acceptance / sign-off phase"
+];
+
+export function scopeOutForTier(tier: Tier): string[] {
+ return tier === "self_serve" ? SCOPE_OUT_SELF_SERVE : SCOPE_OUT;
+}
+
+export const SCOPE_ASSUMPTIONS: string[] = [
+ "You name a project owner with decision authority",
+ "Champion users are available for training and data validation",
+ "Your source data is accessible and reasonably clean",
+ "Go-live timing holds if each gate is cleared on schedule"
+];
+
+const SCOPE_ASSUMPTIONS_SELF_SERVE: string[] = [
+ "You're setting Carbon up yourself, at your own pace",
+ "Your team can free up time to learn Carbon and load your data",
+ "Your data is accessible and reasonably clean",
+ "Standard cloud Carbon fits how your shop runs"
+];
+
+export function scopeAssumptionsForTier(tier: Tier): string[] {
+ return tier === "self_serve"
+ ? SCOPE_ASSUMPTIONS_SELF_SERVE
+ : SCOPE_ASSUMPTIONS;
+}
+
+// "How we know we're done" copy, by tier. Self-serve has no acceptance/sign-off.
+export function scopeDoneForTier(tier: Tier): string {
+ return tier === "self_serve"
+ ? "Carbon is configured the way your shop runs, your data is loaded, and your team is confident using it. When that's true, you're ready to go live."
+ : "The system passes every in-scope acceptance test in your configured system, with your data; the data is validated; and you sign off. Then go-live.";
+}
+
+export const SCOPE_GOAL_DEFAULT =
+ "Get live on Carbon: one system running quoting, purchasing, the shop floor, inventory, and finance, replacing the current tools.";
+
+// Self-serve page intro — no commercial agreement / legal sign-off, unlike the
+// paid lead in PAGE_COPY.scope.
+export const SCOPE_LEAD_SELF_SERVE =
+ "Read this through — what Carbon will and won't do for your setup. When it looks right, mark it agreed below.";
diff --git a/packages/onboarding/src/content/setup.ts b/packages/onboarding/src/content/setup.ts
new file mode 100644
index 0000000000..1e3c9aba49
--- /dev/null
+++ b/packages/onboarding/src/content/setup.ts
@@ -0,0 +1,397 @@
+import type { Mod } from "../types";
+
+export interface SetupRow {
+ key: string; // stable, for the "configured" flag state
+ object: string; // the thing to set up (grounded in Carbon's nav labels)
+ detail: string; // short "what it is" hint
+ moduleTags?: Mod[];
+}
+
+export interface SetupGroup {
+ n: number;
+ title: string; // a Carbon module
+ desc: string;
+ rows: SetupRow[];
+}
+
+// The first-run configuration map, grouped by Carbon module. Every master /
+// reference / config entity a new shop sets up before transacting, labelled as
+// it appears in that module's navigation. Transactional documents (orders,
+// receipts, timecards…) and runtime admin (billing, API keys, webhooks, audit
+// logs) are intentionally excluded. Module-tagged rows drop out when their
+// module is excluded, so an excluded module's group disappears.
+export const SETUP_GROUPS: SetupGroup[] = [
+ {
+ n: 1,
+ title: "Settings",
+ desc: "Company identity, documents, and system defaults.",
+ rows: [
+ {
+ key: "company",
+ object: "Company",
+ detail: "Your legal name, addresses, branding, and document defaults"
+ },
+ {
+ key: "document-templates",
+ object: "Document Templates",
+ detail: "How your quotes, orders, and invoices look when they go out"
+ },
+ {
+ key: "logos",
+ object: "Logos",
+ detail: "The logos shown on your printed and emailed documents"
+ },
+ {
+ key: "printing",
+ object: "Printing",
+ detail: "The label and document printers your shop prints to"
+ },
+ {
+ key: "sequences",
+ object: "Sequences",
+ detail: "Auto-numbering formats for orders, jobs, parts, and more"
+ },
+ {
+ key: "custom-fields",
+ object: "Custom Fields",
+ detail: "Extra fields to capture data Carbon doesn't track by default"
+ },
+ {
+ key: "integrations",
+ object: "Integrations",
+ detail: "Connect the outside tools your shop already runs on"
+ },
+ {
+ key: "approval-rules",
+ object: "Approval Rules",
+ detail: "Who has to approve quotes, orders, and purchases — and when"
+ }
+ ]
+ },
+ {
+ n: 2,
+ title: "Resources",
+ desc: "Where and how you make things.",
+ rows: [
+ {
+ key: "locations",
+ object: "Locations",
+ detail:
+ "The plants, warehouses, and sites where your work and stock live"
+ },
+ {
+ key: "work-centers",
+ object: "Work Centers",
+ detail: "The machines, cells, and stations your work runs through",
+ moduleTags: ["prd"]
+ },
+ {
+ key: "processes",
+ object: "Processes",
+ detail: "The operations and steps your parts move through",
+ moduleTags: ["prd"]
+ },
+ {
+ key: "training",
+ object: "Training",
+ detail: "The skills and abilities you track for your people"
+ },
+ {
+ key: "failure-modes",
+ object: "Failure Modes",
+ detail:
+ "The ways equipment fails, for maintenance and quality tracking",
+ moduleTags: ["prd"]
+ },
+ {
+ key: "maintenance-schedules",
+ object: "Maintenance Schedules",
+ detail: "Preventive maintenance schedules for your equipment",
+ moduleTags: ["prd"]
+ }
+ ]
+ },
+ {
+ n: 3,
+ title: "People",
+ desc: "Your team, structure, and access.",
+ rows: [
+ {
+ key: "employees",
+ object: "Employees",
+ detail: "The people on your team and their access to Carbon"
+ },
+ {
+ key: "departments",
+ object: "Departments",
+ detail: "How your team is organized into departments"
+ },
+ {
+ key: "shifts",
+ object: "Shifts",
+ detail: "The working hours and calendars that drive scheduling"
+ },
+ {
+ key: "holidays",
+ object: "Holidays",
+ detail: "Non-working days that scheduling and capacity respect"
+ },
+ {
+ key: "attributes",
+ object: "Attributes",
+ detail: "Custom attributes you track against your people"
+ },
+ {
+ key: "employee-types",
+ object: "Employee Types",
+ detail: "Roles that set default permissions for new employees"
+ },
+ {
+ key: "groups",
+ object: "Groups",
+ detail: "Permission groups for granting access in bulk"
+ }
+ ]
+ },
+ {
+ n: 4,
+ title: "Items",
+ desc: "Parts, materials, and how you classify them.",
+ rows: [
+ {
+ key: "units",
+ object: "Units",
+ detail: "The units of measure you buy, stock, and sell in",
+ moduleTags: ["itm"]
+ },
+ {
+ key: "item-groups",
+ object: "Item Groups",
+ detail: "How items roll up for posting and reporting",
+ moduleTags: ["itm"]
+ },
+ {
+ key: "parts",
+ object: "Parts",
+ detail: "Your part numbers and the item master behind them",
+ moduleTags: ["itm"]
+ },
+ {
+ key: "materials",
+ object: "Materials",
+ detail: "The raw stock and material master you buy and consume",
+ moduleTags: ["itm"]
+ },
+ {
+ key: "tools",
+ object: "Tools",
+ detail: "The tooling and fixtures your operations rely on",
+ moduleTags: ["itm"]
+ },
+ {
+ key: "consumables",
+ object: "Consumables",
+ detail: "The shop supplies and consumables you keep on hand",
+ moduleTags: ["itm"]
+ },
+ {
+ key: "material-substances",
+ object: "Substances",
+ detail: "The substances your materials are made of",
+ moduleTags: ["itm"]
+ },
+ {
+ key: "material-shapes",
+ object: "Shapes",
+ detail: "The forms and shapes your raw materials come in",
+ moduleTags: ["itm"]
+ },
+ {
+ key: "material-grades",
+ object: "Grades",
+ detail: "The grades that classify your materials",
+ moduleTags: ["itm"]
+ },
+ {
+ key: "material-finishes",
+ object: "Finishes",
+ detail: "The surface finishes available on your materials",
+ moduleTags: ["itm"]
+ },
+ {
+ key: "material-dimensions",
+ object: "Dimensions",
+ detail: "The standard dimensions your materials are stocked in",
+ moduleTags: ["itm"]
+ },
+ {
+ key: "material-types",
+ object: "Material Types",
+ detail: "The material types you organize your stock by",
+ moduleTags: ["itm"]
+ }
+ ]
+ },
+ {
+ n: 5,
+ title: "Sales",
+ desc: "Who you sell to and at what price.",
+ rows: [
+ {
+ key: "customers",
+ object: "Customers",
+ detail: "The customers you sell and ship to",
+ moduleTags: ["sal"]
+ },
+ {
+ key: "customer-types",
+ object: "Customer Types",
+ detail: "Segments that drive customer pricing and terms",
+ moduleTags: ["sal"]
+ },
+ {
+ key: "customer-statuses",
+ object: "Customer Statuses",
+ detail: "The lifecycle stages you track customers through",
+ moduleTags: ["sal"]
+ },
+ {
+ key: "price-lists",
+ object: "Price Lists",
+ detail: "Your customer-facing price lists",
+ moduleTags: ["sal"]
+ },
+ {
+ key: "pricing-rules",
+ object: "Pricing Rules",
+ detail:
+ "Rules that adjust prices automatically by quantity or customer",
+ moduleTags: ["sal"]
+ },
+ {
+ key: "no-quote-reasons",
+ object: "No Quote Reasons",
+ detail: "The reasons you record when you decline an RFQ",
+ moduleTags: ["sal"]
+ }
+ ]
+ },
+ {
+ n: 6,
+ title: "Purchasing",
+ desc: "Who you buy from.",
+ rows: [
+ {
+ key: "suppliers",
+ object: "Suppliers",
+ detail: "The suppliers and vendors you buy from",
+ moduleTags: ["pur"]
+ },
+ {
+ key: "supplier-types",
+ object: "Supplier Types",
+ detail: "The categories you group your suppliers into",
+ moduleTags: ["pur"]
+ }
+ ]
+ },
+ {
+ n: 7,
+ title: "Inventory",
+ desc: "Where stock lives and how it ships.",
+ rows: [
+ {
+ key: "storage-units",
+ object: "Storage Units",
+ detail: "The shelves and bins where stock physically sits",
+ moduleTags: ["inv"]
+ },
+ {
+ key: "storage-types",
+ object: "Storage Types",
+ detail: "Categories that classify how stock is stored",
+ moduleTags: ["inv"]
+ },
+ {
+ key: "storage-rules",
+ object: "Storage Rules",
+ detail: "Rules that decide where each item gets stored",
+ moduleTags: ["inv"]
+ },
+ {
+ key: "shipping-methods",
+ object: "Shipping Methods",
+ detail: "The carriers and methods you ship orders with",
+ moduleTags: ["inv"]
+ }
+ ]
+ },
+ {
+ n: 8,
+ title: "Accounting",
+ desc: "Your books and how money flows.",
+ rows: [
+ {
+ key: "chart-of-accounts",
+ object: "Chart of Accounts",
+ detail: "Your general-ledger accounts and their structure",
+ moduleTags: ["acc"]
+ },
+ {
+ key: "default-accounts",
+ object: "Default Accounts",
+ detail: "The accounts Carbon posts to automatically",
+ moduleTags: ["acc"]
+ },
+ {
+ key: "cost-centers",
+ object: "Cost Centers",
+ detail: "The buckets you track costs against",
+ moduleTags: ["acc"]
+ },
+ {
+ key: "accounting-dimensions",
+ object: "Dimensions",
+ detail: "Extra tags for slicing your GL reporting",
+ moduleTags: ["acc"]
+ },
+ {
+ key: "payment-terms",
+ object: "Payment Terms",
+ detail: "Payment terms like Net 30 or due on receipt",
+ moduleTags: ["acc"]
+ },
+ {
+ key: "exchange-rates",
+ object: "Exchange Rates",
+ detail: "The currencies you trade in and their rates",
+ moduleTags: ["acc"]
+ },
+ {
+ key: "fiscal-year",
+ object: "Fiscal Year",
+ detail: "Your fiscal year and its accounting periods",
+ moduleTags: ["acc"]
+ },
+ {
+ key: "asset-classes",
+ object: "Asset Classes",
+ detail: "The categories your fixed assets fall into",
+ moduleTags: ["acc"]
+ }
+ ]
+ },
+ {
+ n: 9,
+ title: "Production",
+ desc: "Shop-floor configuration.",
+ rows: [
+ {
+ key: "scrap-reasons",
+ object: "Scrap Reasons",
+ detail: "The reasons you record when parts get scrapped",
+ moduleTags: ["prd"]
+ }
+ ]
+ }
+];
diff --git a/packages/onboarding/src/content/spine.ts b/packages/onboarding/src/content/spine.ts
new file mode 100644
index 0000000000..d638530e98
--- /dev/null
+++ b/packages/onboarding/src/content/spine.ts
@@ -0,0 +1,147 @@
+import type { StepDef } from "../types";
+
+// The six "path to live" steps. Each ends at exactly one gate (1:1). Product
+// "do-this-in-Carbon" actions are nested inside Configure + Acceptance and
+// auto-detect against real Carbon data (decision: nest product steps inside).
+//
+// Stable keys are baked in (NOT document-order) so template edits never corrupt
+// persisted state.
+export const SPINE: StepDef[] = [
+ {
+ key: "gate:discovery",
+ n: 1,
+ title: "Discovery",
+ gate: "Scope signed",
+ owner: "shared",
+ timing: "Weeks 1 to 2",
+ refSlug: "scope",
+ gantt: { color: "#8A93A3", startWeek: 0, weeks: 2 },
+ // Paid-tier only — self-serve has no scoping/discovery phase; they configure
+ // directly.
+ tiers: ["guided", "enterprise"],
+ desc: "Confirm how your shop runs and lock the scope."
+ },
+ {
+ key: "gate:configure",
+ n: 2,
+ title: "Configure",
+ gate: "System configured",
+ owner: "carbon",
+ timing: "Weeks 2 to 5",
+ // The Setup Map is the configuration checklist this gate works through; it
+ // deep-links each item to its ERP screen.
+ refSlug: "setup",
+ gantt: { color: "#2FA350", startWeek: 1, weeks: 4 },
+ desc: "Set Carbon up around how your shop runs: sites, parts, BOMs, Bill of Process, and the flows you use.",
+ nested: [
+ {
+ key: "prod:configure-data",
+ label: "Set up your resources and settings",
+ detail:
+ "Sites, locations, work centers, users, suppliers, and your company settings — the foundation everything else builds on. Start from ready-made templates.",
+ cta: "Open the Setup Map",
+ detect: null
+ },
+ {
+ key: "prod:configure-bom",
+ label: "Import your BOM",
+ detail:
+ "Bring in your parts, BOMs, Bill of Process, and costing — with Carbon's import tools, CSV, or LLM help.",
+ docsUrl: "https://docs.carbon.ms/docs/reference/items",
+ videoKey: "bom",
+ detect: "hasItems"
+ },
+ {
+ key: "prod:configure-builtins",
+ label: "Turn on the built-in pieces",
+ detail:
+ "Configure-to-order, automated purchase planning, the shop-floor app.",
+ docsUrl: "https://docs.carbon.ms/docs/reference/methods",
+ detect: null
+ },
+ {
+ key: "prod:configure-netnew",
+ label: "Build any net-new work",
+ detail:
+ "An integration or a custom change — the small slice that's actually custom.",
+ detect: null,
+ tiers: ["guided", "enterprise"]
+ },
+ {
+ key: "prod:configure-hosting",
+ label: "Stand up hosting",
+ detail: "Cloud, or your self-hosted environment.",
+ detect: null,
+ tiers: ["guided", "enterprise"]
+ }
+ ]
+ },
+ {
+ key: "gate:migrate",
+ n: 3,
+ title: "Migrate data",
+ gate: "Data validated",
+ owner: "shared",
+ timing: "Weeks 4 to 6",
+ refSlug: "data",
+ gantt: { color: "#1574E0", startWeek: 3, weeks: 3 },
+ desc: "Your real data is loaded and you have checked a sample and approved it.",
+ // Paid-tier only — self-serve customers bring no data to migrate.
+ tiers: ["guided", "enterprise"]
+ },
+ {
+ key: "gate:train",
+ n: 4,
+ title: "Train",
+ gate: "Team trained",
+ owner: "you",
+ timing: "Weeks 5 to 7",
+ refSlug: "training",
+ gantt: { color: "#5B6EE1", startWeek: 4, weeks: 3 },
+ desc: "Your team leads learn Carbon first using the in-app guides and Academy, then bring everyone else up to speed."
+ },
+ {
+ key: "gate:acceptance",
+ n: 5,
+ title: "Acceptance",
+ gate: "Acceptance passed",
+ owner: "shared",
+ timing: "Weeks 7 to 8",
+ refSlug: "go-live",
+ gantt: { color: "#0E9C8A", startWeek: 6, weeks: 2 },
+ desc: "Every in-scope test passes in your configured system, with your data.",
+ // Paid-tier only — self-serve has no formal acceptance/sign-off gate.
+ tiers: ["guided", "enterprise"],
+ nested: [
+ {
+ key: "prod:purchase-make",
+ label: "Purchase & manufacture from MRP",
+ detail: "Convert MRP suggestions into purchase orders and jobs.",
+ docsUrl: "https://docs.carbon.ms/docs/reference/jobs",
+ videoKey: "jobs",
+ detect: "hasJob"
+ },
+ {
+ key: "prod:serialize-sell",
+ label: "Serialize & sell your parts",
+ detail: "Track serial/lot numbers and fulfil sales orders.",
+ docsUrl: "https://docs.carbon.ms/docs/reference/sales-orders",
+ videoKey: "salesOrders",
+ detect: "hasSalesOrder"
+ }
+ ]
+ },
+ {
+ key: "gate:golive",
+ n: 6,
+ title: "Go-Live",
+ gate: "Live on Carbon",
+ owner: "shared",
+ timing: "Week 8 cutover",
+ refSlug: "go-live",
+ gantt: { color: "#1659B2", startWeek: 7, weeks: 1 },
+ desc: "Cut over, freeze the old system, and confirm you're live on Carbon."
+ }
+];
+
+export const GATE_COUNT = SPINE.length;
diff --git a/packages/onboarding/src/content/support.ts b/packages/onboarding/src/content/support.ts
new file mode 100644
index 0000000000..d0da7b7b37
--- /dev/null
+++ b/packages/onboarding/src/content/support.ts
@@ -0,0 +1,13 @@
+// Guided-implementation upsell, shown on self-serve command centers, plus the
+// booking link it points at. Single source so the copy and URL live in one place
+// (the ERP route reads SUPPORT_BOOKING_URL to open the scheduler).
+export const SUPPORT_BOOKING_URL =
+ "https://calendly.com/chase-carbon-introduction/30min?month=2026-06";
+
+export const GUIDED_UPSELL = {
+ eyebrow: "Guided implementation",
+ heading: "Go live right the first time — with our team alongside you",
+ body: "You drive it; we make sure it's done right. Expert eyes on your setup, data, and go-live.",
+ points: ["Expert guidance", "In the loop together", "Set up the right way"],
+ cta: "Book a call with Carbon"
+};
diff --git a/packages/onboarding/src/content/team.ts b/packages/onboarding/src/content/team.ts
new file mode 100644
index 0000000000..922299cd67
--- /dev/null
+++ b/packages/onboarding/src/content/team.ts
@@ -0,0 +1,21 @@
+export interface TeamRole {
+ role: string;
+ owns: string;
+}
+
+// Generic Carbon-side roles. Names are filled per-customer via Setup & Controls
+// contacts; this is the template shape.
+export const TEAM_ROLES: TeamRole[] = [
+ {
+ role: "Implementation Lead",
+ owns: "Your project end to end: the plan, the gates, and go-live"
+ },
+ {
+ role: "Solutions Engineer",
+ owns: "Configuration, data migration, and any integrations"
+ },
+ {
+ role: "Support",
+ owns: "Day-to-day questions and hypercare after launch"
+ }
+];
diff --git a/packages/onboarding/src/content/training.ts b/packages/onboarding/src/content/training.ts
new file mode 100644
index 0000000000..5455abb52b
--- /dev/null
+++ b/packages/onboarding/src/content/training.ts
@@ -0,0 +1,155 @@
+import type { Mod } from "../types";
+
+export interface TrainingCourse {
+ key: string; // stable, for the format toggle state
+ course: string;
+ audience: string;
+ format: "Self-paced" | "Hands-on";
+ length: string;
+ // trainingConfig key (ERP) → resolved to an Academy course / video URL via
+ // useResolveVideoUrl. Omitted when no matching Academy content exists yet.
+ videoKey?: string;
+}
+
+export interface TrainingTrack {
+ title: string;
+ moduleTags?: Mod[];
+ courses: TrainingCourse[];
+}
+
+// Train-the-trainer plan by module. Module-tagged tracks drop out when excluded.
+export const TRAINING_TRACKS: TrainingTrack[] = [
+ {
+ title: "Foundation (everyone)",
+ courses: [
+ {
+ key: "found-1",
+ course: "Getting around Carbon",
+ audience: "All users",
+ format: "Self-paced",
+ length: "2h"
+ },
+ {
+ key: "found-2",
+ course: "How your shop's process maps to Carbon",
+ audience: "Champions",
+ format: "Hands-on",
+ length: "2h"
+ }
+ ]
+ },
+ {
+ title: "Sales & Quoting",
+ moduleTags: ["sal"],
+ courses: [
+ {
+ key: "sal-1",
+ course: "Quoting and sales orders",
+ audience: "Sales, Estimator",
+ format: "Hands-on",
+ length: "3h",
+ videoKey: "quotes"
+ },
+ {
+ key: "sal-2",
+ course: "Configure-to-order",
+ audience: "Sales",
+ format: "Hands-on",
+ length: "2h",
+ videoKey: "quotes"
+ }
+ ]
+ },
+ {
+ title: "Purchasing & Inventory",
+ moduleTags: ["pur", "inv"],
+ courses: [
+ {
+ key: "pur-1",
+ course: "Purchasing and auto-planning",
+ audience: "Buyer, Planner",
+ format: "Hands-on",
+ length: "3h",
+ videoKey: "purchaseOrders"
+ },
+ {
+ key: "inv-1",
+ course: "Inventory control and counts",
+ audience: "Warehouse, Ops",
+ format: "Hands-on",
+ length: "3h",
+ videoKey: "inventory"
+ }
+ ]
+ },
+ {
+ title: "Items & Production",
+ moduleTags: ["itm", "prd"],
+ courses: [
+ {
+ key: "itm-1",
+ course: "Item master, BOMs and Bill of Process",
+ audience: "Engineering",
+ format: "Hands-on",
+ length: "4h",
+ videoKey: "bom"
+ },
+ {
+ key: "itm-2",
+ course: "Engineering changes and CAD",
+ audience: "Engineering",
+ format: "Hands-on",
+ length: "3h"
+ },
+ {
+ key: "prd-1",
+ course: "Shop-floor app and scheduling",
+ audience: "Shop Floor leads, Planner",
+ format: "Hands-on",
+ length: "3h",
+ videoKey: "jobs"
+ }
+ ]
+ },
+ {
+ title: "Quality",
+ moduleTags: ["qms"],
+ courses: [
+ {
+ key: "qms-1",
+ course: "Inspections, nonconformance, and CAPA",
+ audience: "Quality",
+ format: "Hands-on",
+ length: "3h",
+ videoKey: "quality"
+ }
+ ]
+ },
+ {
+ title: "Accounting",
+ moduleTags: ["acc"],
+ courses: [
+ {
+ key: "acc-1",
+ course: "General Ledger and month-end close",
+ audience: "Controller, Accountant",
+ format: "Hands-on",
+ length: "4h"
+ },
+ {
+ key: "acc-2",
+ course: "Accounts Receivable",
+ audience: "AR Clerk",
+ format: "Hands-on",
+ length: "3h"
+ },
+ {
+ key: "acc-3",
+ course: "Accounts Payable",
+ audience: "AP Clerk",
+ format: "Hands-on",
+ length: "3h"
+ }
+ ]
+ }
+];
diff --git a/packages/onboarding/src/content/value.ts b/packages/onboarding/src/content/value.ts
new file mode 100644
index 0000000000..cb37fc37c3
--- /dev/null
+++ b/packages/onboarding/src/content/value.ts
@@ -0,0 +1,49 @@
+// value content
+
+// Headline numbers Carbon fills in per deal (fieldKey-backed, customer-locked).
+// Default text reads as a prompt until staff set a real figure.
+export interface ValueMetric {
+ key: string; // base fieldKey; ".value" + ".label" are the two fill-ins
+ value: string;
+ label: string;
+}
+
+export const VALUE_METRICS: ValueMetric[] = [
+ { key: "value.metric1", value: "Set a target", label: "Lead time" },
+ { key: "value.metric2", value: "Set a target", label: "On-time delivery" },
+ { key: "value.metric3", value: "Set a target", label: "Inventory accuracy" }
+];
+
+export const VALUE_PROBLEMS: string[] = [
+ "Data scattered across spreadsheets and disconnected tools",
+ "No single, trusted number for inventory or job status",
+ "Re-keying between quoting, the floor, and finance",
+ "Hard to see true cost or margin on a job"
+];
+
+export const VALUE_GOALS: string[] = [
+ "One system from quote to cash",
+ "Real-time inventory and shop-floor visibility",
+ "Less manual work, fewer errors",
+ "Room to grow without bolting on more tools"
+];
+
+export interface ValuePoint {
+ title: string;
+ body: string;
+}
+
+export const VALUE_POINTS: ValuePoint[] = [
+ {
+ title: "Less manual work",
+ body: "Data flows through once instead of being re-keyed and reconciled across tools."
+ },
+ {
+ title: "One set of numbers",
+ body: "The floor and the office read the same inventory and cost figures."
+ },
+ {
+ title: "Easier to extend",
+ body: "Add the next capability on the same system instead of buying another tool."
+ }
+];
diff --git a/packages/onboarding/src/index.ts b/packages/onboarding/src/index.ts
new file mode 100644
index 0000000000..12d972a8f7
--- /dev/null
+++ b/packages/onboarding/src/index.ts
@@ -0,0 +1,8 @@
+// @carbon/onboarding — Implementation Hub blueprint + pure logic (client-safe).
+// Server-only DB helpers live at "@carbon/onboarding/server"; presentational
+// React lives at "@carbon/onboarding/ui" (added once the migration is applied).
+
+export * from "./content";
+export * from "./logic";
+export * from "./models";
+export * from "./types";
diff --git a/packages/onboarding/src/logic/board.ts b/packages/onboarding/src/logic/board.ts
new file mode 100644
index 0000000000..b9b5b00a82
--- /dev/null
+++ b/packages/onboarding/src/logic/board.ts
@@ -0,0 +1,31 @@
+import type { BoardTask, TaskValue, Tier } from "../types";
+import { taskKey } from "./keys";
+
+// Drop tasks that don't apply to this tier (omitted `tiers` => all tiers), so a
+// self-serve plan/board never shows paid-only work like hypercare.
+export function boardTasksForTier(tasks: BoardTask[], tier: Tier): BoardTask[] {
+ return tasks.filter((t) => !t.tiers || t.tiers.includes(tier));
+}
+
+// The status of a board task from stored state (default "todo"). Plan-page
+// bullets derive from these same values, so Board ↔ Plan can never drift.
+export function taskStatus(
+ task: BoardTask,
+ states: Map<string, string>
+): TaskValue {
+ return (states.get(taskKey(task.key)) as TaskValue) ?? "todo";
+}
+
+export function tasksForStep(tasks: BoardTask[], stepKey: string): BoardTask[] {
+ return tasks.filter((t) => t.stepKey === stepKey);
+}
+
+export function stepTaskProgress(
+ tasks: BoardTask[],
+ stepKey: string,
+ states: Map<string, string>
+): { done: number; total: number } {
+ const stepTasks = tasksForStep(tasks, stepKey);
+ const done = stepTasks.filter((t) => taskStatus(t, states) === "done").length;
+ return { done, total: stepTasks.length };
+}
diff --git a/packages/onboarding/src/logic/guide.ts b/packages/onboarding/src/logic/guide.ts
new file mode 100644
index 0000000000..1a2f7a5e98
--- /dev/null
+++ b/packages/onboarding/src/logic/guide.ts
@@ -0,0 +1,63 @@
+import { pageBySlug } from "../content/registry";
+import type { NestedProductStep, StepDef } from "../types";
+import {
+ effectiveGateStatus,
+ effectiveProductStatus,
+ type Signals
+} from "./overlay";
+
+// The single next thing to do — drives the guided "Next step" surface so the hub
+// points at one action instead of listing everything.
+export interface NextAction {
+ gateKey: string;
+ gateTitle: string;
+ gateNumber: number;
+ title: string; // the action to take
+ detail?: string;
+ refSlug: string; // hub page that backs this gate
+ refTitle: string; // that page's nav label (for the CTA)
+ // Present when the next thing is a product action you do inside Carbon:
+ productStep?: NestedProductStep;
+}
+
+export function nextAction(
+ spine: StepDef[],
+ states: Map<string, string>,
+ signals: Signals
+): NextAction | null {
+ for (const step of spine) {
+ if (effectiveGateStatus(step, states, signals) === "done") continue;
+
+ const refTitle = pageBySlug(step.refSlug)?.navLabel ?? step.title;
+
+ // First incomplete gate. Prefer its first incomplete embedded product step.
+ const nextProduct = (step.nested ?? []).find(
+ (n) => effectiveProductStatus(n, states, signals) !== "done"
+ );
+
+ if (nextProduct) {
+ return {
+ gateKey: step.key,
+ gateTitle: step.title,
+ gateNumber: step.n,
+ title: nextProduct.label,
+ detail: nextProduct.detail,
+ refSlug: step.refSlug,
+ refTitle,
+ productStep: nextProduct
+ };
+ }
+
+ return {
+ gateKey: step.key,
+ gateTitle: step.title,
+ gateNumber: step.n,
+ title: step.title,
+ detail: step.desc,
+ refSlug: step.refSlug,
+ refTitle
+ };
+ }
+
+ return null; // everything done
+}
diff --git a/packages/onboarding/src/logic/index.ts b/packages/onboarding/src/logic/index.ts
new file mode 100644
index 0000000000..3abd7314d4
--- /dev/null
+++ b/packages/onboarding/src/logic/index.ts
@@ -0,0 +1,7 @@
+export * from "./board";
+export * from "./guide";
+export * from "./keys";
+export * from "./labels";
+export * from "./overlay";
+export * from "./timeline";
+export * from "./visibility";
diff --git a/packages/onboarding/src/logic/keys.ts b/packages/onboarding/src/logic/keys.ts
new file mode 100644
index 0000000000..b9a4f2416b
--- /dev/null
+++ b/packages/onboarding/src/logic/keys.ts
@@ -0,0 +1,17 @@
+// Stable string keys for persisted state (implementationCheckState.itemKey /
+// implementationFieldValue.fieldKey). Baked into content templates so adding or
+// reordering template nodes never reassigns a saved key.
+
+export const gateKey = (slug: string) => `gate:${slug}`;
+export const productStepKey = (slug: string) => `prod:${slug}`;
+export const taskKey = (boardKey: string) => `task:${boardKey}`;
+export const flagKey = (reqCode: string) => `flag:${reqCode}`;
+export const checkKey = (page: string, n: number | string) =>
+ `check:${page}.${n}`;
+export const fmtKey = (trackRow: string) => `fmt:${trackRow}`;
+export const fieldTextKey = (fieldKey: string) => `txt:${fieldKey}`;
+
+// DOM anchor id for a spine step's card in the Plan view. Colons aren't valid in
+// a URL fragment target lookup, so swap them for hyphens (gate:configure → gate-configure).
+export const planAnchorId = (stepKey: string) =>
+ `plan-${stepKey.replace(/:/g, "-")}`;
diff --git a/packages/onboarding/src/logic/labels.ts b/packages/onboarding/src/logic/labels.ts
new file mode 100644
index 0000000000..afa41478a1
--- /dev/null
+++ b/packages/onboarding/src/logic/labels.ts
@@ -0,0 +1,28 @@
+import type { Owner, StepDef, Tier } from "../types";
+
+// The hub surface label adapts by tier: self-serve sees "Get Started", paying
+// tiers see "Implementation" (matches Chase's onboarding-vs-implementation split).
+export function labelForTier(tier: Tier): string {
+ return tier === "self_serve" ? "Get Started" : "Implementation";
+}
+
+// Resolve an owner for a tier. In self-serve there's no Carbon team — the
+// customer does everything alone — so BOTH Carbon-led and shared ownership
+// collapse to "You". Guided/enterprise keep the authored owner.
+export function ownerForTier(owner: Owner, tier: Tier): Owner {
+ if (tier === "self_serve" && owner !== "you") return "you";
+ return owner;
+}
+
+// Who owns a step, adapted by tier (see ownerForTier).
+export function ownerForStep(step: StepDef, tier: Tier): Owner {
+ return ownerForTier(step.owner, tier);
+}
+
+// Past tense of an owner's lead role, for "{timing} · {…}" lines. Avoids the
+// ungrammatical "You leads" the bare label produced.
+export function ownerLeadLabel(owner: Owner): string {
+ if (owner === "you") return "You lead";
+ if (owner === "carbon") return "Carbon leads";
+ return "Carbon + you";
+}
diff --git a/packages/onboarding/src/logic/overlay.ts b/packages/onboarding/src/logic/overlay.ts
new file mode 100644
index 0000000000..255d107690
--- /dev/null
+++ b/packages/onboarding/src/logic/overlay.ts
@@ -0,0 +1,101 @@
+import type {
+ CheckStateRow,
+ DetectSignal,
+ GateValue,
+ NestedProductStep,
+ StepDef,
+ Tier
+} from "../types";
+
+// Resolve a spine for a tier: drop nested product steps that don't apply to the
+// tier (e.g. net-new work + hosting are paid-tier only). Filtering at the source
+// keeps gate status, progress counts, and the "next step" all consistent —
+// excluded steps never count toward a self-serve gate.
+export function nestedForTier(step: StepDef, tier: Tier): NestedProductStep[] {
+ return (step.nested ?? []).filter((n) => !n.tiers || n.tiers.includes(tier));
+}
+
+export function spineForTier(spine: StepDef[], tier: Tier): StepDef[] {
+ return spine
+ .filter((step) => !step.tiers || step.tiers.includes(tier))
+ .map((step, i) => ({
+ // Renumber by position so dropping a gate (e.g. Acceptance for self-serve)
+ // leaves no gap in the displayed 1..N sequence.
+ ...step,
+ n: i + 1,
+ ...(step.nested ? { nested: nestedForTier(step, tier) } : {})
+ }));
+}
+
+// Auto-detected signals from real Carbon data (computed server-side, never
+// persisted). Manual overrides in checkState always win.
+export type Signals = Record<DetectSignal, boolean>;
+
+export function stateMap(rows: CheckStateRow[]): Map<string, string> {
+ return new Map(rows.map((r) => [r.itemKey, r.value]));
+}
+
+// Resolve a fill-in field's value: the per-company override if present, else the
+// code template's default.
+export function fieldMap(
+ rows: { fieldKey: string; value: string }[]
+): Map<string, string> {
+ return new Map(rows.map((r) => [r.fieldKey, r.value]));
+}
+
+// A nested product step is done if its manual override says so, else if its
+// detection signal fires. `detect: null` (e.g. MRP) is manual-only.
+export function effectiveProductStatus(
+ step: NestedProductStep,
+ states: Map<string, string>,
+ signals: Signals
+): GateValue {
+ const manual = states.get(step.key) as GateValue | undefined;
+ if (manual) return manual;
+ if (step.detect && signals[step.detect]) return "done";
+ return "todo";
+}
+
+// Gate status resolution. An EXPLICIT manual value (set by clicking the gate)
+// wins both ways — it can force a gate done, or force it back to todo even when
+// every nested step auto-detects as done. Without that, a gate fed by an
+// auto-detected step (e.g. `hasItems`) could never be un-checked. Only when no
+// manual value is stored does the gate derive from its nested product steps:
+// all done => done, some done => in progress, else todo. This keeps auto-advance
+// working for untouched gates while letting a human override stick.
+export function effectiveGateStatus(
+ step: StepDef,
+ states: Map<string, string>,
+ signals: Signals
+): GateValue {
+ const manual = states.get(step.key) as GateValue | undefined;
+ if (manual) return manual;
+
+ const nested = step.nested ?? [];
+ if (nested.length > 0) {
+ const doneCount = nested.filter(
+ (n) => effectiveProductStatus(n, states, signals) === "done"
+ ).length;
+ if (doneCount === nested.length) return "done";
+ if (doneCount > 0) return "prog";
+ }
+
+ return "todo";
+}
+
+export function gatesDone(
+ steps: StepDef[],
+ states: Map<string, string>,
+ signals: Signals
+): number {
+ return steps.filter((s) => effectiveGateStatus(s, states, signals) === "done")
+ .length;
+}
+
+export function gatesRemaining(
+ steps: StepDef[],
+ states: Map<string, string>,
+ signals: Signals
+): number {
+ return steps.length - gatesDone(steps, states, signals);
+}
diff --git a/packages/onboarding/src/logic/timeline.ts b/packages/onboarding/src/logic/timeline.ts
new file mode 100644
index 0000000000..35d12a479a
--- /dev/null
+++ b/packages/onboarding/src/logic/timeline.ts
@@ -0,0 +1,184 @@
+import type { StepDef } from "../types";
+
+// Resolves the Plan Gantt's geometry from per-company config. The template gives
+// each gate a default week offset (`gantt.startWeek`/`weeks`); a per-company
+// `plan.startDate` anchors those to real calendar dates, and a per-gate override
+// (`plan.<stepKey>.gateDate`) moves a gate's date — which then drives its bar's
+// right edge and the overall window. No start date set => relative "W1..Wn"
+// mode (no calendar), so the chart still renders before anyone tailors it.
+
+const MS_PER_WEEK = 7 * 24 * 60 * 60 * 1000;
+const MONTHS = [
+ "Jan",
+ "Feb",
+ "Mar",
+ "Apr",
+ "May",
+ "Jun",
+ "Jul",
+ "Aug",
+ "Sep",
+ "Oct",
+ "Nov",
+ "Dec"
+];
+
+export const PLAN_START_KEY = "plan.startDate";
+export const gateDateKey = (stepKey: string) => `plan.${stepKey}.gateDate`;
+// Per-company duration override (weeks) for a phase. Falls back to the template's
+// `gantt.weeks`. Edited in Setup & Controls; consumed by the Plan timeline.
+export const phaseWeeksKey = (stepKey: string) => `plan.${stepKey}.weeks`;
+
+// Resolve a phase's effective duration in weeks: the per-company override if it's
+// a positive number, else the template default.
+export function effectivePhaseWeeks(
+ step: StepDef,
+ fields: Map<string, string>
+): number {
+ const override = Number(fields.get(phaseWeeksKey(step.key)));
+ return Number.isFinite(override) && override > 0
+ ? override
+ : (step.gantt?.weeks ?? 0);
+}
+
+// Parse a `YYYY-MM-DD` field value to a midday-UTC Date (midday avoids DST/tz
+// rollovers shifting the day). Returns null for empty/malformed input.
+export function parseDate(value: string | undefined): Date | null {
+ if (!value) return null;
+ const m = /^(\d{4})-(\d{2})-(\d{2})$/.exec(value.trim());
+ if (!m) return null;
+ const [, y, mo, day] = m;
+ const d = new Date(Date.UTC(Number(y), Number(mo) - 1, Number(day), 12));
+ return Number.isNaN(d.getTime()) ? null : d;
+}
+
+export function formatDate(d: Date): string {
+ return `${MONTHS[d.getUTCMonth()]} ${d.getUTCDate()}`;
+}
+
+// `YYYY-MM-DD` for a native <input type="date"> value.
+export function toISODate(d: Date): string {
+ return d.toISOString().slice(0, 10);
+}
+
+const addWeeks = (d: Date, weeks: number) =>
+ new Date(d.getTime() + weeks * MS_PER_WEEK);
+const weeksBetween = (a: Date, b: Date) =>
+ (b.getTime() - a.getTime()) / MS_PER_WEEK;
+
+export interface TimelineBar {
+ key: string;
+ n: number;
+ title: string;
+ gate: string;
+ color: string;
+ startPct: number; // bar left edge, % of the window
+ widthPct: number; // bar width, % of the window
+ gatePct: number; // gate marker, % of the window (bar right edge)
+ timing: string; // display label under the bar
+ gateDate: Date | null; // resolved gate date (null in relative mode)
+ gateDateKey: string; // fieldKey to edit this gate's date
+ gateDateValue: string | undefined; // the raw override, if any
+}
+
+export interface Timeline {
+ hasDates: boolean;
+ startKey: string;
+ startValue: string | undefined;
+ totalWeeks: number;
+ ticks: { label: string; leftPct: number; dim?: boolean }[];
+ bars: TimelineBar[];
+}
+
+// Pure: (tier-filtered steps, field overrides) -> render-ready geometry.
+export function resolveTimeline(
+ steps: StepDef[],
+ fields: Map<string, string>
+): Timeline {
+ const geo = steps.filter((s) => s.gantt);
+
+ // Anchor on the project start date; failing that, back-compute it from a set
+ // go-live target so picking *just* the go-live date still lays out the whole
+ // timeline (start = go-live − the go-live step's end week).
+ let start = parseDate(fields.get(PLAN_START_KEY));
+ if (!start) {
+ const golive = geo.find((s) => s.key === "gate:golive");
+ const goliveDate = parseDate(fields.get(gateDateKey("gate:golive")));
+ if (golive?.gantt && goliveDate) {
+ start = addWeeks(
+ goliveDate,
+ -(golive.gantt.startWeek + effectivePhaseWeeks(golive, fields))
+ );
+ }
+ }
+
+ // First pass: resolve each gate's start/end in WEEKS from the project start.
+ // In date mode an override can push a gate past its template week.
+ const resolved = geo.map((s) => {
+ const g = s.gantt!;
+ const startWeek = g.startWeek;
+ const weeksRaw = Number(fields.get(phaseWeeksKey(s.key)));
+ const weeksOverridden = Number.isFinite(weeksRaw) && weeksRaw > 0;
+ const defaultEndWeek = g.startWeek + effectivePhaseWeeks(s, fields);
+ const overrideValue = fields.get(gateDateKey(s.key));
+ let endWeek = defaultEndWeek;
+ let gateDate: Date | null = null;
+ if (start) {
+ const resolvedGate =
+ parseDate(overrideValue) ?? addWeeks(start, defaultEndWeek);
+ gateDate = resolvedGate;
+ // Clamp so a gate can't land before its bar starts.
+ endWeek = Math.max(startWeek + 0.25, weeksBetween(start, resolvedGate));
+ }
+ return { s, startWeek, endWeek, gateDate, overrideValue, weeksOverridden };
+ });
+
+ const maxWeek = resolved.reduce((m, r) => Math.max(m, r.endWeek), 8);
+ // Round the window up to a whole week so the ruler ends on a tick.
+ const totalWeeks = Math.max(8, Math.ceil(maxWeek));
+
+ const bars: TimelineBar[] = resolved.map(
+ ({ s, startWeek, endWeek, gateDate, overrideValue, weeksOverridden }) => {
+ const startPct = (startWeek / totalWeeks) * 100;
+ const gatePct = (endWeek / totalWeeks) * 100;
+ const startDate = start ? addWeeks(start, startWeek) : null;
+ return {
+ key: s.key,
+ n: s.n,
+ title: s.title,
+ gate: s.gate,
+ color: s.gantt!.color,
+ startPct,
+ widthPct: Math.max(gatePct - startPct, 1.5),
+ gatePct,
+ // Calendar range when anchored; else the curated template label, unless a
+ // staff duration override means that label is now stale — then derive it.
+ timing:
+ start && startDate && gateDate
+ ? `${formatDate(startDate)} – ${formatDate(gateDate)}`
+ : weeksOverridden
+ ? `Weeks ${Math.round(startWeek) + 1} to ${Math.round(endWeek)}`
+ : s.timing,
+ gateDate,
+ gateDateKey: gateDateKey(s.key),
+ gateDateValue: overrideValue
+ };
+ }
+ );
+
+ // Weekly ruler ticks. Calendar dates when anchored, else "W1..Wn".
+ const ticks = Array.from({ length: totalWeeks + 1 }, (_, w) => ({
+ label: start ? formatDate(addWeeks(start, w)) : `W${w + 1}`,
+ leftPct: (w / totalWeeks) * 100,
+ dim: w === totalWeeks
+ })).filter((_, w) => w < totalWeeks || start != null);
+
+ return {
+ hasDates: start != null,
+ startKey: PLAN_START_KEY,
+ startValue: fields.get(PLAN_START_KEY),
+ totalWeeks,
+ ticks,
+ bars
+ };
+}
diff --git a/packages/onboarding/src/logic/visibility.ts b/packages/onboarding/src/logic/visibility.ts
new file mode 100644
index 0000000000..0809f986c3
--- /dev/null
+++ b/packages/onboarding/src/logic/visibility.ts
@@ -0,0 +1,48 @@
+import type { HubExclusions, Mod, PageDef, Tier } from "../types";
+
+// Server-side visibility filter (mirrors the prototype's client exclusion engine,
+// moved to the backend so "exclude Accounting" is real and shared). A node is
+// hidden only when EVERY one of its module tags is excluded.
+export function isModuleExcluded(
+ tags: Mod[] | undefined,
+ excludedModules: Mod[]
+): boolean {
+ if (!tags || tags.length === 0) return false;
+ return tags.every((t) => excludedModules.includes(t));
+}
+
+// Drop every node whose module tags are all excluded. Centralizes the
+// `items.filter(i => !isModuleExcluded(i.moduleTags, ...))` that the Setup,
+// Data, Requirements, and Scope views each re-implemented inline.
+export function filterByModule<T extends { moduleTags?: Mod[] }>(
+ items: T[],
+ excludedModules: Mod[]
+): T[] {
+ return items.filter((i) => !isModuleExcluded(i.moduleTags, excludedModules));
+}
+
+export function isPageVisible(
+ page: PageDef,
+ exclusions: HubExclusions,
+ isInternal: boolean,
+ tier?: Tier
+): boolean {
+ if (page.carbonOnly && !isInternal) return false;
+ if (page.tiers && tier && !page.tiers.includes(tier)) return false;
+ if (exclusions.pages.includes(page.slug)) return false;
+ if (isModuleExcluded(page.moduleTags, exclusions.modules)) return false;
+ return true;
+}
+
+export function isSectionVisible(
+ sectionKey: string,
+ exclusions: HubExclusions
+): boolean {
+ return !exclusions.sections.includes(sectionKey);
+}
+
+export const EMPTY_EXCLUSIONS: HubExclusions = {
+ modules: [],
+ pages: [],
+ sections: []
+};
diff --git a/packages/onboarding/src/models.ts b/packages/onboarding/src/models.ts
new file mode 100644
index 0000000000..199d10320b
--- /dev/null
+++ b/packages/onboarding/src/models.ts
@@ -0,0 +1,83 @@
+import { z } from "zod";
+
+// Validators for the editable layer. Plain zod (no zod-form-data) so the package
+// stays framework-agnostic; ERP route actions wrap these with `validator(...)`.
+
+export const tierValidator = z.enum(["self_serve", "guided", "enterprise"]);
+
+export const hubStatusValidator = z.enum([
+ "tailoring",
+ "shared",
+ "active",
+ "complete",
+ "archived"
+]);
+
+export const stateKindValidator = z.enum([
+ "gate",
+ "task",
+ "check",
+ "scopeFlag",
+ "productStep",
+ "fmt"
+]);
+
+export const moduleValidator = z.enum([
+ "sal",
+ "pur",
+ "inv",
+ "itm",
+ "prd",
+ "qms",
+ "acc"
+]);
+
+export const exclusionsValidator = z.object({
+ modules: z.array(moduleValidator).default([]),
+ pages: z.array(z.string()).default([]),
+ sections: z.array(z.string()).default([])
+});
+
+export const contactsValidator = z.object({
+ pocUserId: z.string().optional(),
+ owner: z.string().optional(),
+ champion: z.string().optional()
+});
+
+// The /x/get-started/state.toggle action payload, discriminated by intent.
+export const stateActionValidator = z.discriminatedUnion("intent", [
+ z.object({
+ intent: z.literal("setCheck"),
+ itemKey: z.string().min(1),
+ kind: stateKindValidator,
+ value: z.string().min(1)
+ }),
+ z.object({
+ intent: z.literal("setField"),
+ fieldKey: z.string().min(1),
+ value: z.string()
+ }),
+ z.object({
+ intent: z.literal("addRow"),
+ collection: z.string().min(1),
+ payload: z.string() // JSON-encoded cells
+ }),
+ z.object({
+ intent: z.literal("updateRow"),
+ rowId: z.string().min(1),
+ payload: z.string()
+ }),
+ z.object({ intent: z.literal("deleteRow"), rowId: z.string().min(1) }),
+ z.object({
+ intent: z.literal("setExclusions"),
+ exclusions: z.string() // JSON-encoded HubExclusions
+ }),
+ z.object({ intent: z.literal("setTier"), tier: tierValidator }),
+ z.object({ intent: z.literal("setStatus"), status: hubStatusValidator }),
+ z.object({
+ intent: z.literal("setContacts"),
+ contacts: z.string() // JSON-encoded HubContacts
+ })
+]);
+
+export type StateAction = z.infer<typeof stateActionValidator>;
diff --git a/packages/onboarding/src/server.ts b/packages/onboarding/src/server.ts
new file mode 100644
index 0000000000..fe93b54992
--- /dev/null
+++ b/packages/onboarding/src/server.ts
@@ -0,0 +1,228 @@
+// Server-only DB helpers for the Implementation Hub. Each takes the supabase
+// client as its first arg and returns the raw { data, error } (does not throw),
+// matching Carbon's service convention. The enrollment + structural writes are
+// authorized at the route (isInternal / requirePermissions); RLS is the backstop.
+import type { Database } from "@carbon/database";
+import type { SupabaseClient } from "@supabase/supabase-js";
+import { DEFAULT_EXCLUSIONS, TEMPLATE_KEY, TEMPLATE_VERSION } from "./content";
+import type { Signals } from "./logic";
+import type {
+ HubContacts,
+ HubExclusions,
+ HubStatus,
+ StateKind,
+ Tier
+} from "./types";
+
+type Client = SupabaseClient<Database>;
+
+export function getImplementationHub(client: Client, companyId: string) {
+ return client
+ .from("implementationHub")
+ .select("*")
+ .eq("id", companyId)
+ .maybeSingle();
+}
+
+export function getImplementationCheckStates(
+ client: Client,
+ companyId: string
+) {
+ return client
+ .from("implementationCheckState")
+ .select("itemKey, kind, value")
+ .eq("companyId", companyId);
+}
+
+export function getImplementationFieldValues(
+ client: Client,
+ companyId: string
+) {
+ return client
+ .from("implementationFieldValue")
+ .select("fieldKey, value")
+ .eq("companyId", companyId);
+}
+
+export function getImplementationRows(client: Client, companyId: string) {
+ return client
+ .from("implementationRow")
+ .select("id, collection, payload, sortOrder")
+ .eq("companyId", companyId)
+ .order("sortOrder", { ascending: true });
+}
+
+// Cheap existence probes that back the nested product steps' auto-detection.
+// Never persisted — overlaid on stored manual state at read time.
+export async function detectImplementationSignals(
+ client: Client,
+ companyId: string
+): Promise<Signals> {
+ const probe = (
+ table: "item" | "makeMethod" | "job" | "salesOrder" | "trackedEntity"
+ ) => client.from(table).select("id").eq("companyId", companyId).limit(1);
+
+ const [items, methods, jobs, orders, tracked] = await Promise.all([
+ probe("item"),
+ probe("makeMethod"),
+ probe("job"),
+ probe("salesOrder"),
+ probe("trackedEntity")
+ ]);
+
+ return {
+ hasItems: !!items.data?.length,
+ hasMakeMethod: !!methods.data?.length,
+ hasJob: !!jobs.data?.length,
+ hasSalesOrder: !!orders.data?.length,
+ hasTrackedEntity: !!tracked.data?.length
+ };
+}
+
+export function enrollImplementation(
+ client: Client,
+ args: { companyId: string; userId: string; tier?: Tier }
+) {
+ return client
+ .from("implementationHub")
+ .insert({
+ id: args.companyId,
+ tier: args.tier ?? "self_serve",
+ status: "tailoring",
+ templateKey: TEMPLATE_KEY,
+ templateVersion: TEMPLATE_VERSION,
+ // New hubs start with all optional pages/sections excluded; Carbon opts
+ // them back in per customer from Setup & Controls.
+ exclusions: DEFAULT_EXCLUSIONS,
+ createdBy: args.userId
+ } as never)
+ .select("id")
+ .single();
+}
+
+export function upsertCheckState(
+ client: Client,
+ args: {
+ companyId: string;
+ itemKey: string;
+ kind: StateKind;
+ value: string;
+ userId: string;
+ }
+) {
+ return client
+ .from("implementationCheckState")
+ .upsert(
+ {
+ companyId: args.companyId,
+ itemKey: args.itemKey,
+ kind: args.kind,
+ value: args.value,
+ createdBy: args.userId,
+ updatedBy: args.userId,
+ updatedAt: new Date().toISOString()
+ },
+ { onConflict: "companyId, itemKey" }
+ )
+ .select("id")
+ .single();
+}
+
+export function upsertFieldValue(
+ client: Client,
+ args: { companyId: string; fieldKey: string; value: string; userId: string }
+) {
+ return client
+ .from("implementationFieldValue")
+ .upsert(
+ {
+ companyId: args.companyId,
+ fieldKey: args.fieldKey,
+ value: args.value,
+ createdBy: args.userId,
+ updatedBy: args.userId,
+ updatedAt: new Date().toISOString()
+ },
+ { onConflict: "companyId, fieldKey" }
+ )
+ .select("id")
+ .single();
+}
+
+export function insertImplementationRow(
+ client: Client,
+ args: {
+ companyId: string;
+ collection: string;
+ payload: unknown;
+ sortOrder?: number;
+ userId: string;
+ }
+) {
+ return client
+ .from("implementationRow")
+ .insert({
+ companyId: args.companyId,
+ collection: args.collection,
+ payload: args.payload as never,
+ sortOrder: args.sortOrder ?? 0,
+ createdBy: args.userId
+ })
+ .select("id")
+ .single();
+}
+
+export function updateImplementationRow(
+ client: Client,
+ args: {
+ id: string;
+ companyId: string;
+ payload: unknown;
+ userId: string;
+ }
+) {
+ return client
+ .from("implementationRow")
+ .update({
+ payload: args.payload as never,
+ updatedBy: args.userId,
+ updatedAt: new Date().toISOString()
+ })
+ .eq("id", args.id)
+ .eq("companyId", args.companyId);
+}
+
+export function deleteImplementationRow(
+ client: Client,
+ args: { id: string; companyId: string }
+) {
+ return client
+ .from("implementationRow")
+ .delete()
+ .eq("id", args.id)
+ .eq("companyId", args.companyId);
+}
+
+export function updateImplementationHub(
+ client: Client,
+ companyId: string,
+ patch: {
+ tier?: Tier;
+ status?: HubStatus;
+ exclusions?: HubExclusions;
+ contacts?: HubContacts;
+ signedAt?: string | null;
+ signedBy?: string | null;
+ userId: string;
+ }
+) {
+ const { userId, ...rest } = patch;
+ return client
+ .from("implementationHub")
+ .update({
+ ...rest,
+ updatedBy: userId,
+ updatedAt: new Date().toISOString()
+ } as never)
+ .eq("id", companyId);
+}
diff --git a/packages/onboarding/src/types.ts b/packages/onboarding/src/types.ts
new file mode 100644
index 0000000000..2796b3231c
--- /dev/null
+++ b/packages/onboarding/src/types.ts
@@ -0,0 +1,213 @@
+// Shared types for the Implementation Hub. App-agnostic: no Supabase/React
+// Router imports here so the content templates + pure logic stay portable.
+
+// The seven functional areas == Carbon's real modules (see RESTRUCTURE_SPEC).
+export type Mod = "sal" | "pur" | "inv" | "itm" | "prd" | "qms" | "acc";
+
+export const MODULES: readonly Mod[] = [
+ "sal",
+ "pur",
+ "inv",
+ "itm",
+ "prd",
+ "qms",
+ "acc"
+];
+
+export const MODULE_NAME: Record<Mod, string> = {
+ sal: "Sales",
+ pur: "Purchasing",
+ inv: "Inventory",
+ itm: "Items",
+ prd: "Production",
+ qms: "Quality",
+ acc: "Accounting"
+};
+
+export type Owner = "carbon" | "you" | "shared";
+export type Tier = "self_serve" | "guided" | "enterprise";
+export type HubStatus =
+ | "tailoring"
+ | "shared"
+ | "active"
+ | "complete"
+ | "archived";
+// Sidebar groups, ordered to mirror the customer's journey: orient → agree on
+// the work → plan it → configure Carbon → train + launch → (internal tools).
+export type PageGroup =
+ | "get-started"
+ | "align"
+ | "plan"
+ | "configure"
+ | "launch"
+ | "carbon-only";
+
+// Kinds persisted in implementationCheckState.kind.
+export type StateKind =
+ | "gate"
+ | "task"
+ | "check"
+ | "scopeFlag"
+ | "productStep"
+ | "fmt";
+
+export type GateValue = "todo" | "prog" | "done";
+export type TaskValue = "todo" | "prog" | "blocked" | "done";
+
+// The signal a nested product step auto-detects against. `null` => manual only
+// (e.g. "run MRP" has no cheap persisted signal).
+export type DetectSignal =
+ | "hasItems"
+ | "hasMakeMethod"
+ | "hasJob"
+ | "hasSalesOrder"
+ | "hasTrackedEntity";
+export type Detect = DetectSignal | null;
+
+// A product "do-this-in-Carbon" action nested inside a services step.
+export interface NestedProductStep {
+ key: string; // stable, e.g. "prod:import-bom"
+ label: string;
+ detail?: string;
+ docsUrl?: string;
+ videoKey?: string; // resolved against the ERP trainingConfig
+ // CTA label on the "Next step" card. Defaults to "Open in Carbon"; override
+ // when the step opens a hub page rather than an app screen.
+ cta?: string;
+ detect: Detect;
+ // Tiers this step applies to. Omitted => all tiers. Self-serve customers
+ // don't do net-new work or stand up their own hosting, so those steps are
+ // scoped to the paid tiers and never count toward a self-serve gate.
+ tiers?: Tier[];
+}
+
+// Geometry for a step's bar on the "Timeline at a glance" Gantt. The gate marker
+// sits at the bar's right edge; `color` is the gate's swatch.
+export interface GanttBar {
+ color: string;
+ // Template geometry in WEEKS from project start. The default dates derive from
+ // these + the per-company `plan.startDate`; a per-gate date override then
+ // recomputes the bar (see logic/timeline.ts). `startWeek` 0 = project start.
+ startWeek: number;
+ weeks: number;
+}
+
+export interface StepDef {
+ key: string; // stable, e.g. "gate:discovery"
+ n: number; // 1-based position; renumbered per tier by spineForTier
+ title: string;
+ gate: string; // "Scope signed"
+ owner: Owner;
+ timing: string;
+ refSlug: string; // page slug the gate references
+ desc?: string;
+ nested?: NestedProductStep[];
+ gantt?: GanttBar; // bar position on the timeline gantt
+ // Tiers this gate applies to. Omitted => all tiers. e.g. the Acceptance gate
+ // is paid-only — self-serve has no formal sign-off step.
+ tiers?: Tier[];
+}
+
+// A hub page (sidebar entry + content surface).
+export interface PageDef {
+ slug: string; // matches the route filename, e.g. "how-we-work"
+ navLabel: string;
+ title: string;
+ group: PageGroup;
+ order: number;
+ optional?: boolean; // excludable whole page (e.g. Value Snapshot)
+ carbonOnly?: boolean; // never shown to customers
+ // Tiers this page applies to. Omitted => all tiers. e.g. Data Migration is
+ // paid-tier only and is hidden for self-serve.
+ tiers?: Tier[];
+ key?: boolean; // "most important" marker
+ moduleTags?: Mod[];
+ trainingKey?: string;
+ docsUrl?: string;
+}
+
+// A fill-in field; ownership drives who may write it (enforced server-side).
+export interface FieldDef {
+ key: string; // stable, e.g. "scope.goal"
+ label: string;
+ ownership: Owner;
+ dataType: "text" | "date" | "money" | "number" | "email";
+ defaultValue: string;
+}
+
+// Per-company hub config (implementationHub.exclusions + contacts JSONB).
+export interface HubExclusions {
+ modules: Mod[];
+ pages: string[];
+ sections: string[];
+}
+
+export interface HubContacts {
+ pocUserId?: string;
+ owner?: string;
+ champion?: string;
+}
+
+// Minimal shape of a persisted toggle row — kept here so the pure logic does
+// not depend on the generated Supabase types.
+export interface CheckStateRow {
+ itemKey: string;
+ kind: StateKind;
+ value: string;
+}
+
+// A per-company fill-in override (implementationFieldValue).
+export interface FieldValueRow {
+ fieldKey: string;
+ value: string;
+}
+
+// A per-company custom row (implementationRow) — staff-added tasks/risks/etc.
+export interface ImplementationRowData {
+ id: string;
+ collection: string;
+ payload: Record<string, unknown>;
+ sortOrder: number;
+}
+
+// Payload shape for a custom Board task.
+export interface CustomTaskPayload {
+ label: string;
+ owner: Owner;
+ status: TaskValue;
+}
+
+// Payload shape for a custom Data Migration / Setup row. "validated" /
+// "configured" is tracked separately as a scopeFlag keyed by the row id (like the
+// template rows). `url` is an optional deep link — Setup rows can point at a
+// screen the way template rows do.
+export interface CustomDataPayload {
+ object: string;
+ today: string;
+ url?: string;
+}
+
+// Payload shape for a custom Requirements row. "in scope" is tracked separately
+// as a scopeFlag keyed by the row id (like the template requirements).
+export interface CustomRequirementPayload {
+ requirement: string;
+}
+
+// Payload shape for a custom Go-Live cutover step. "done" is tracked separately
+// as a check keyed by the row id (like the template cutover steps).
+export interface CustomGoLivePayload {
+ label: string;
+}
+
+// A Project Board task. Grouped under a spine step; its completion is the
+// shared source of truth that the Plan page's checklist derives from (toggling
+// in either place updates the same `task` check state — no drift).
+export interface BoardTask {
+ key: string; // stable board key (taskKey(key) => itemKey)
+ label: string;
+ stepKey: string; // a SPINE step key, e.g. "gate:configure"
+ owner: Owner;
+ // Tiers this task applies to. Omitted => all tiers. e.g. hypercare is paid-tier
+ // only — self-serve has no Carbon team providing post-launch support.
+ tiers?: Tier[];
+}
diff --git a/packages/onboarding/src/ui/BoardTable.tsx b/packages/onboarding/src/ui/BoardTable.tsx
new file mode 100644
index 0000000000..53e17b8524
--- /dev/null
+++ b/packages/onboarding/src/ui/BoardTable.tsx
@@ -0,0 +1,260 @@
+import { Button, cn, IconButton } from "@carbon/react";
+import { LuPlus, LuTrash } from "react-icons/lu";
+import { COLLECTIONS, PAGE_COPY } from "../content";
+import { BOARD_TASKS } from "../content/board";
+import { SPINE } from "../content/spine";
+import {
+ boardTasksForTier,
+ ownerForTier,
+ spineForTier,
+ taskKey,
+ taskStatus,
+ tasksForStep
+} from "../logic";
+import type {
+ CustomTaskPayload,
+ ImplementationRowData,
+ Owner,
+ TaskValue
+} from "../types";
+import { ProgressPill } from "./ProgressPill";
+import {
+ EditableInput,
+ OWNER_TOKENS,
+ PageHeader,
+ TASK_STATUS_TOKENS
+} from "./primitives";
+import {
+ useCanEdit,
+ useCheckMap,
+ useHubActions,
+ useRows,
+ useTier
+} from "./state";
+
+const TASK_ORDER: TaskValue[] = ["todo", "prog", "blocked", "done"];
+const NEXT_TASK: Record<TaskValue, TaskValue> = {
+ todo: "prog",
+ prog: "blocked",
+ blocked: "done",
+ done: "todo"
+};
+const NEXT_OWNER: Record<Owner, Owner> = {
+ carbon: "you",
+ you: "shared",
+ shared: "carbon"
+};
+
+// The single task list for the whole project, grouped by the six steps. Status
+// is the shared source of truth the Plan page derives from. Carbon staff can add
+// deal-specific tasks below.
+export function BoardTable() {
+ const map = useCheckMap();
+ const tier = useTier();
+ const canEdit = useCanEdit();
+ const customTasks = useRows("board");
+ const { setCheck, addRow } = useHubActions();
+
+ const steps = spineForTier(SPINE, tier);
+ const tasks = boardTasksForTier(BOARD_TASKS, tier);
+ const orderedTasks = steps.flatMap((s) => tasksForStep(tasks, s.key));
+ const tasksDone = orderedTasks.filter(
+ (t) => taskStatus(t, map) === "done"
+ ).length;
+ const nextTask = orderedTasks.find((t) => taskStatus(t, map) !== "done");
+
+ return (
+ <div className="w-full max-w-4xl mx-auto flex flex-col gap-6">
+ <PageHeader
+ title={PAGE_COPY.board.title}
+ lead={PAGE_COPY.board.lead}
+ aside={
+ <ProgressPill
+ done={tasksDone}
+ total={orderedTasks.length}
+ label="tasks"
+ />
+ }
+ />
+
+ {nextTask ? (
+ <div className="rounded-xl border border-primary/30 bg-primary/5 px-4 py-2.5 text-sm flex items-center gap-2 flex-wrap">
+ <span className="text-xxs uppercase tracking-wide font-medium text-primary">
+ Next task
+ </span>
+ <span className="font-medium">{nextTask.label}</span>
+ </div>
+ ) : null}
+
+ <div className="rounded-2xl border bg-card shadow-button-base overflow-hidden">
+ {steps.map((step) => {
+ const stepTasks = tasksForStep(tasks, step.key);
+ if (stepTasks.length === 0) return null;
+ return (
+ <section key={step.key}>
+ <div className="px-5 py-2 border-y first:border-t-0">
+ <span className="text-xxs uppercase tracking-wide font-medium text-muted-foreground">
+ {step.n} · {step.title}
+ </span>
+ </div>
+ <ul>
+ {stepTasks.map((task) => {
+ const status = taskStatus(task, map);
+ const pill = TASK_STATUS_TOKENS[status];
+ return (
+ <li
+ key={task.key}
+ className="flex items-center gap-4 px-5 py-3 border-b last:border-b-0"
+ >
+ <span
+ className={cn(
+ "flex-1 min-w-0 text-sm",
+ status === "done" &&
+ "line-through text-muted-foreground"
+ )}
+ >
+ {task.label}
+ </span>
+ {tier !== "self_serve" ? (
+ <span className="text-xxs uppercase tracking-wide rounded px-1.5 py-0.5 border text-muted-foreground font-medium shrink-0">
+ {OWNER_TOKENS[ownerForTier(task.owner, tier)].label}
+ </span>
+ ) : null}
+ <button
+ type="button"
+ title="Click to change status"
+ onClick={() =>
+ setCheck(taskKey(task.key), "task", NEXT_TASK[status])
+ }
+ className={cn(
+ "shrink-0 inline-flex items-center gap-1.5 rounded-full pl-2 pr-2.5 py-1 text-xs font-medium active:scale-[0.96] transition-transform",
+ pill.cls
+ )}
+ >
+ <span
+ className={cn("size-1.5 rounded-full", pill.dot)}
+ />
+ {pill.label}
+ </button>
+ </li>
+ );
+ })}
+ </ul>
+ </section>
+ );
+ })}
+ </div>
+
+ {customTasks.length || canEdit ? (
+ <div className="rounded-2xl border bg-card shadow-button-base overflow-hidden">
+ <div className="px-5 py-2 border-b flex items-center justify-between">
+ <span className="text-xxs uppercase tracking-wide font-medium text-muted-foreground">
+ Added for this customer
+ </span>
+ {canEdit ? (
+ <span className="text-xxs text-muted-foreground">
+ Carbon-only
+ </span>
+ ) : null}
+ </div>
+ {customTasks.length ? (
+ <ul>
+ {customTasks.map((row) => (
+ <CustomTaskRow key={row.id} row={row} />
+ ))}
+ </ul>
+ ) : (
+ <div className="px-5 py-4 text-sm text-muted-foreground">
+ {COLLECTIONS.board.emptyText}
+ </div>
+ )}
+ {canEdit ? (
+ <div className="px-5 py-3 border-t">
+ <Button
+ variant="secondary"
+ size="sm"
+ leftIcon={<LuPlus />}
+ onClick={() => addRow("board", COLLECTIONS.board.newPayload())}
+ >
+ {COLLECTIONS.board.addLabel}
+ </Button>
+ </div>
+ ) : null}
+ </div>
+ ) : null}
+ </div>
+ );
+}
+
+function CustomTaskRow({ row }: { row: ImplementationRowData }) {
+ const canEdit = useCanEdit();
+ const { updateRow, deleteRow } = useHubActions();
+
+ const payload: CustomTaskPayload = {
+ label: typeof row.payload.label === "string" ? row.payload.label : "",
+ owner: (row.payload.owner as Owner) ?? "shared",
+ status: (row.payload.status as TaskValue) ?? "todo"
+ };
+ const pill = TASK_STATUS_TOKENS[payload.status];
+
+ return (
+ <li className="flex items-center gap-3 px-5 py-3 border-b last:border-b-0">
+ {canEdit ? (
+ <EditableInput
+ value={payload.label}
+ placeholder="Task"
+ className="flex-1 min-w-0"
+ onCommit={(label) => updateRow(row.id, { ...payload, label })}
+ />
+ ) : (
+ <span
+ className={cn(
+ "flex-1 min-w-0 text-sm",
+ payload.status === "done" && "line-through text-muted-foreground"
+ )}
+ >
+ {payload.label}
+ </span>
+ )}
+ <button
+ type="button"
+ disabled={!canEdit}
+ onClick={() =>
+ updateRow(row.id, { ...payload, owner: NEXT_OWNER[payload.owner] })
+ }
+ className={cn(
+ "text-xxs uppercase tracking-wide rounded px-1.5 py-0.5 border text-muted-foreground font-medium shrink-0",
+ canEdit && "hover:bg-accent"
+ )}
+ >
+ {OWNER_TOKENS[payload.owner].label}
+ </button>
+ <button
+ type="button"
+ title="Click to change status"
+ onClick={() =>
+ updateRow(row.id, { ...payload, status: NEXT_TASK[payload.status] })
+ }
+ className={cn(
+ "shrink-0 inline-flex items-center gap-1.5 rounded-full pl-2 pr-2.5 py-1 text-xs font-medium active:scale-[0.96] transition-transform",
+ pill.cls
+ )}
+ >
+ <span className={cn("size-1.5 rounded-full", pill.dot)} />
+ {pill.label}
+ </button>
+ {canEdit ? (
+ <IconButton
+ aria-label="Delete task"
+ icon={<LuTrash />}
+ variant="ghost"
+ size="sm"
+ className="text-muted-foreground shrink-0"
+ onClick={() => deleteRow(row.id)}
+ />
+ ) : null}
+ </li>
+ );
+}
+
+export { TASK_ORDER };
diff --git a/packages/onboarding/src/ui/DataMigrationView.tsx b/packages/onboarding/src/ui/DataMigrationView.tsx
new file mode 100644
index 0000000000..52157e6186
--- /dev/null
+++ b/packages/onboarding/src/ui/DataMigrationView.tsx
@@ -0,0 +1,168 @@
+import { IconButton } from "@carbon/react";
+import { useEffect, useState } from "react";
+import { LuTrash } from "react-icons/lu";
+import { COLLECTIONS, PAGE_COPY } from "../content";
+import { DATA_GROUPS } from "../content/data";
+import { filterByModule, flagKey } from "../logic";
+import type { CustomDataPayload, ImplementationRowData } from "../types";
+import { ProgressPill } from "./ProgressPill";
+import {
+ CustomRowSection,
+ EditableInput,
+ PageHeader,
+ Section,
+ SectionList,
+ StatusToggle
+} from "./primitives";
+import { useCanEdit, useCheckMap, useExclusions, useHubActions } from "./state";
+
+const DEF = COLLECTIONS.data;
+const FLAG = DEF.flag!;
+
+// Per-company key for a data row's "validated" flag (template rows key off their
+// stable `key`, custom rows off their row id).
+const validatedKey = (id: string) => flagKey(`data.${id}`);
+
+export function DataMigrationView() {
+ const exclusions = useExclusions();
+ const map = useCheckMap();
+ const { toggleFlag } = useHubActions();
+
+ const visibleRows = DATA_GROUPS.flatMap((g) =>
+ filterByModule(g.rows, exclusions.modules)
+ );
+ const validated = visibleRows.filter(
+ (r) => map.get(validatedKey(r.key)) === "1"
+ ).length;
+
+ return (
+ <div className="w-full max-w-3xl mx-auto flex flex-col gap-6">
+ <PageHeader
+ title={PAGE_COPY.data.title}
+ lead={PAGE_COPY.data.lead}
+ aside={
+ <ProgressPill
+ done={validated}
+ total={visibleRows.length}
+ label="validated"
+ />
+ }
+ />
+
+ {DATA_GROUPS.map((group) => {
+ const rows = filterByModule(group.rows, exclusions.modules);
+ if (rows.length === 0) return null;
+ return (
+ <Section
+ key={group.n}
+ number={group.n}
+ title={group.title}
+ subtitle={group.desc}
+ >
+ <SectionList>
+ {rows.map((row) => {
+ const key = validatedKey(row.key);
+ return (
+ <li
+ key={row.key}
+ className="flex items-center gap-4 px-5 py-3"
+ >
+ <div className="flex-1 min-w-0">
+ <div className="text-sm font-medium">{row.object}</div>
+ <div className="text-xs text-muted-foreground">
+ Today: {row.today}
+ </div>
+ </div>
+ <StatusToggle
+ active={map.get(key) === "1"}
+ activeLabel={FLAG.active}
+ inactiveLabel={FLAG.inactive}
+ onToggle={() =>
+ toggleFlag(key, "scopeFlag", map.get(key) !== "1")
+ }
+ />
+ </li>
+ );
+ })}
+ </SectionList>
+ </Section>
+ );
+ })}
+
+ <CustomRowSection collection="data">
+ {(row) => <CustomDataRow row={row} />}
+ </CustomRowSection>
+ </div>
+ );
+}
+
+function CustomDataRow({ row }: { row: ImplementationRowData }) {
+ const canEdit = useCanEdit();
+ const map = useCheckMap();
+ const { toggleFlag, updateRow, deleteRow } = useHubActions();
+
+ const payload: CustomDataPayload = {
+ object: typeof row.payload.object === "string" ? row.payload.object : "",
+ today: typeof row.payload.today === "string" ? row.payload.today : ""
+ };
+ const key = validatedKey(row.id);
+ const validated = map.get(key) === "1";
+
+ // Mirror both cells locally so committing one always sends the other's live
+ // value (never a stale server copy that could revert an in-flight edit).
+ const [object, setObject] = useState(payload.object);
+ const [today, setToday] = useState(payload.today);
+ useEffect(() => setObject(payload.object), [payload.object]);
+ useEffect(() => setToday(payload.today), [payload.today]);
+
+ return (
+ <li className="flex items-center gap-4 px-5 py-3">
+ <div className="flex-1 min-w-0 flex flex-col gap-1">
+ {canEdit ? (
+ <>
+ <EditableInput
+ value={object}
+ placeholder="What data"
+ onCommit={(next) => {
+ setObject(next);
+ updateRow(row.id, { object: next, today });
+ }}
+ />
+ <EditableInput
+ value={today}
+ placeholder="Where it lives today"
+ variant="muted"
+ onCommit={(next) => {
+ setToday(next);
+ updateRow(row.id, { object, today: next });
+ }}
+ />
+ </>
+ ) : (
+ <>
+ <div className="text-sm font-medium">{payload.object}</div>
+ <div className="text-xs text-muted-foreground">
+ Today: {payload.today}
+ </div>
+ </>
+ )}
+ </div>
+ <StatusToggle
+ active={validated}
+ activeLabel={FLAG.active}
+ inactiveLabel={FLAG.inactive}
+ onToggle={() => toggleFlag(key, "scopeFlag", !validated)}
+ />
+ {canEdit ? (
+ <IconButton
+ aria-label="Delete row"
+ icon={<LuTrash />}
+ variant="ghost"
+ size="sm"
+ className="text-muted-foreground shrink-0"
+ onClick={() => deleteRow(row.id)}
+ />
+ ) : null}
+ </li>
+ );
+}
diff --git a/packages/onboarding/src/ui/EditableField.tsx b/packages/onboarding/src/ui/EditableField.tsx
new file mode 100644
index 0000000000..590f8f4ea9
--- /dev/null
+++ b/packages/onboarding/src/ui/EditableField.tsx
@@ -0,0 +1,84 @@
+import { cn, Input, Textarea } from "@carbon/react";
+import { useEffect, useRef, useState } from "react";
+import { useCanEdit, useHubActions } from "./state";
+
+// A fill-in field: editable by Carbon staff, read-only for the customer. The
+// value is the per-company override (fieldValue) or the code default. Saves on
+// blur via the hub store — this is how a hub gets tailored per account. canEdit
+// and the save path come from the store, so callers pass only the field itself.
+export function EditableField({
+ fieldKey,
+ value,
+ defaultValue,
+ multiline,
+ placeholder,
+ className
+}: {
+ fieldKey: string;
+ value: string | undefined; // the override, if any
+ defaultValue: string;
+ multiline?: boolean;
+ placeholder?: string;
+ className?: string;
+}) {
+ const canEdit = useCanEdit();
+ const { setField } = useHubActions();
+ const resolved = value ?? defaultValue;
+ const [draft, setDraft] = useState(resolved);
+ const focused = useRef(false);
+
+ // Keep in sync when realtime / another editor changes the value — but not
+ // while focused, so a concurrent revalidation can't clobber live typing.
+ // biome-ignore lint/correctness/useExhaustiveDependencies: reset on external value change only
+ useEffect(() => {
+ if (!focused.current) setDraft(resolved);
+ }, [value, defaultValue]);
+
+ if (!canEdit) {
+ return <span className={className}>{resolved || placeholder}</span>;
+ }
+
+ const commit = () => {
+ focused.current = false;
+ if (draft !== resolved) setField(fieldKey, draft);
+ };
+
+ const fieldClass = cn(
+ "w-full rounded-lg border border-dashed border-primary/40 bg-primary/[0.03] px-2.5 py-1.5 text-sm outline-none transition-colors",
+ "hover:border-primary/60 focus:border-primary focus:ring-2 focus:ring-primary/20",
+ className
+ );
+
+ if (multiline) {
+ return (
+ <Textarea
+ value={draft}
+ placeholder={placeholder}
+ onChange={(e) => setDraft(e.target.value)}
+ onFocus={() => {
+ focused.current = true;
+ }}
+ onBlur={commit}
+ rows={2}
+ className={cn(fieldClass, "resize-none leading-relaxed")}
+ />
+ );
+ }
+
+ return (
+ <Input
+ type="text"
+ value={draft}
+ placeholder={placeholder}
+ onChange={(e) => setDraft(e.target.value)}
+ onFocus={() => {
+ focused.current = true;
+ }}
+ onBlur={commit}
+ onKeyDown={(e) => {
+ if (e.key === "Enter") (e.target as HTMLInputElement).blur();
+ }}
+ className={fieldClass}
+ />
+ );
+}
diff --git a/packages/onboarding/src/ui/GanttChart.tsx b/packages/onboarding/src/ui/GanttChart.tsx
new file mode 100644
index 0000000000..34429e78b4
--- /dev/null
+++ b/packages/onboarding/src/ui/GanttChart.tsx
@@ -0,0 +1,158 @@
+import { cn } from "@carbon/react";
+import { formatDate, resolveTimeline, type TimelineBar } from "../logic";
+import type { StepDef } from "../types";
+import { useCanEdit, useFieldMap } from "./state";
+
+const LABEL_COL = "w-44"; // 176px — matches the grid overlay's left offset
+
+// "Timeline at a glance": a read-only step-level Gantt. Its geometry is resolved
+// per company from config edited in Setup & Controls (project start, phase
+// durations, go-live target) — this view only displays it. Bars overlap on
+// purpose and each ends at a checkpoint marker at the bar's right edge, repeated
+// in the legend with its date. Steps are already tier-filtered by the caller.
+export function GanttChart({ steps }: { steps: StepDef[] }) {
+ const fields = useFieldMap();
+ const canEdit = useCanEdit();
+ const timeline = resolveTimeline(steps, fields);
+
+ if (timeline.bars.length === 0) return null;
+
+ return (
+ <div className="rounded-2xl border bg-card shadow-button-base p-5 sm:p-6 overflow-x-auto">
+ <div className="min-w-[620px]">
+ {!timeline.hasDates ? (
+ <div className="flex items-center justify-end mb-3">
+ <span className="text-xxs text-muted-foreground">
+ {canEdit
+ ? "Relative timeline · dates set in Setup & Controls"
+ : "Relative timeline · dates to be confirmed"}
+ </span>
+ </div>
+ ) : null}
+
+ {/* Week ruler */}
+ <div className="flex items-end mb-2">
+ <div className={cn("shrink-0", LABEL_COL)} />
+ <div className="relative flex-1 h-4">
+ {timeline.ticks.map((t) => (
+ <span
+ key={t.label + t.leftPct}
+ style={{ left: `${t.leftPct}%` }}
+ className={cn(
+ "absolute -translate-x-1/2 text-[10px] font-medium tabular-nums",
+ t.dim ? "text-muted-foreground/60" : "text-muted-foreground"
+ )}
+ >
+ {t.label}
+ </span>
+ ))}
+ </div>
+ </div>
+
+ <div className="relative">
+ {/* Week grid lines, behind the rows */}
+ <div className="absolute left-44 right-0 top-0 bottom-0 pointer-events-none">
+ {timeline.ticks.slice(1).map((t) => (
+ <span
+ key={t.leftPct}
+ style={{ left: `${t.leftPct}%` }}
+ className="absolute top-0 bottom-0 w-px bg-border/70"
+ />
+ ))}
+ </div>
+
+ {/* Phase-end checkpoint markers */}
+ <div className="flex items-start h-7">
+ <div
+ className={cn(
+ "shrink-0 pr-4 pt-1 text-[9.5px] uppercase tracking-wider text-muted-foreground",
+ LABEL_COL
+ )}
+ >
+ Checkpoints
+ </div>
+ <div className="relative flex-1 h-full">
+ {timeline.bars.map((b) => (
+ <div
+ key={b.key}
+ style={{ left: `${b.gatePct}%`, backgroundColor: b.color }}
+ className="absolute top-0 -translate-x-1/2 size-5 rounded-full border-2 border-card text-white shadow flex items-center justify-center text-[10px] font-semibold tabular-nums"
+ title={
+ b.gateDate
+ ? `${b.gate} · ${formatDate(b.gateDate)}`
+ : b.gate
+ }
+ >
+ {b.n}
+ </div>
+ ))}
+ </div>
+ </div>
+
+ {/* Bars */}
+ {timeline.bars.map((b) => (
+ <div key={b.key} className="flex items-center h-9">
+ <div
+ className={cn(
+ "shrink-0 pr-4 flex items-start gap-2",
+ LABEL_COL
+ )}
+ >
+ <span
+ style={{ backgroundColor: b.color }}
+ className="shrink-0 size-2.5 rounded-[3px] mt-1"
+ />
+ <div className="min-w-0">
+ <div className="text-[13px] font-semibold leading-tight tracking-tight truncate">
+ {b.title}
+ </div>
+ <div className="text-[10px] text-muted-foreground tabular-nums mt-0.5">
+ {b.timing}
+ </div>
+ </div>
+ </div>
+ <div className="relative flex-1 h-full">
+ <div
+ style={{
+ left: `${b.startPct}%`,
+ width: `${b.widthPct}%`,
+ backgroundColor: b.color
+ }}
+ className="absolute top-1.5 bottom-1.5 rounded-md shadow-sm"
+ />
+ </div>
+ </div>
+ ))}
+ </div>
+
+ {/* Legend: checkpoint number → name, with its date */}
+ <div className="mt-4 pt-4 border-t grid grid-cols-1 sm:grid-cols-2 gap-x-6 gap-y-2.5">
+ {timeline.bars.map((b) => (
+ <GateLegendRow key={b.key} bar={b} />
+ ))}
+ </div>
+ </div>
+ </div>
+ );
+}
+
+function GateLegendRow({ bar }: { bar: TimelineBar }) {
+ return (
+ <div className="flex items-center gap-2.5">
+ <span
+ style={{ backgroundColor: bar.color }}
+ className="shrink-0 inline-flex items-center justify-center size-[18px] rounded-full text-white text-[10px] font-semibold tabular-nums"
+ >
+ {bar.n}
+ </span>
+ <span className="text-[13px] leading-snug flex-1 min-w-0 truncate">
+ {bar.gate}
+ </span>
+ {bar.gateDate ? (
+ <span className="shrink-0 text-[11px] font-medium text-muted-foreground tabular-nums">
+ {formatDate(bar.gateDate)}
+ </span>
+ ) : null}
+ </div>
+ );
+}
diff --git a/packages/onboarding/src/ui/GoLiveView.tsx b/packages/onboarding/src/ui/GoLiveView.tsx
new file mode 100644
index 0000000000..52104c565f
--- /dev/null
+++ b/packages/onboarding/src/ui/GoLiveView.tsx
@@ -0,0 +1,211 @@
+import { Button, cn, IconButton } from "@carbon/react";
+import { LuCheck, LuPlus, LuTrash } from "react-icons/lu";
+import { COLLECTIONS, PAGE_COPY } from "../content";
+import {
+ CUTOVER_STEPS,
+ HYPERCARE,
+ HYPERCARE_WEEKS_DEFAULT,
+ SUPPORT_CHANNELS
+} from "../content/golive";
+import { checkKey } from "../logic";
+import type { ImplementationRowData } from "../types";
+import { EditableField } from "./EditableField";
+import { ProgressPill } from "./ProgressPill";
+import {
+ EditableInput,
+ PageHeader,
+ Panel,
+ Section,
+ SectionList
+} from "./primitives";
+import {
+ useCanEdit,
+ useCheckMap,
+ useFieldMap,
+ useHubActions,
+ useRows,
+ useTier
+} from "./state";
+
+const cutoverKey = (id: string) => checkKey("cutover", id);
+
+export function GoLiveView() {
+ const map = useCheckMap();
+ const fields = useFieldMap();
+ const tier = useTier();
+ const canEdit = useCanEdit();
+ const customSteps = useRows("golive");
+ const { setCheck, addRow } = useHubActions();
+
+ const cutoverDone = CUTOVER_STEPS.filter(
+ (s) => map.get(cutoverKey(s.key)) === "1"
+ ).length;
+ const supportChannels = SUPPORT_CHANNELS.filter(
+ (c) => !c.tiers || c.tiers.includes(tier)
+ );
+
+ return (
+ <div className="w-full max-w-3xl mx-auto flex flex-col gap-6">
+ <PageHeader
+ title={PAGE_COPY["go-live"].title}
+ lead={PAGE_COPY["go-live"].lead}
+ aside={
+ <ProgressPill
+ done={cutoverDone}
+ total={CUTOVER_STEPS.length}
+ label="cutover"
+ />
+ }
+ />
+
+ <Section title="Cutover checklist">
+ <SectionList>
+ {CUTOVER_STEPS.map((step) => {
+ const key = cutoverKey(step.key);
+ const done = map.get(key) === "1";
+ return (
+ <li key={step.key}>
+ <button
+ type="button"
+ onClick={() => setCheck(key, "check", done ? "0" : "1")}
+ className="w-full flex items-center gap-3 px-5 py-3 text-left hover:bg-muted/40 transition-colors"
+ >
+ <CutoverBox done={done} />
+ <span
+ className={cn(
+ "text-sm",
+ done && "line-through text-muted-foreground"
+ )}
+ >
+ {step.label}
+ </span>
+ </button>
+ </li>
+ );
+ })}
+ {customSteps.map((row) => (
+ <CustomCutoverRow key={row.id} row={row} />
+ ))}
+ </SectionList>
+ {canEdit ? (
+ <div className="px-5 py-3 border-t">
+ <Button
+ variant="secondary"
+ size="sm"
+ leftIcon={<LuPlus />}
+ onClick={() => addRow("golive", COLLECTIONS.golive.newPayload())}
+ >
+ {COLLECTIONS.golive.addLabel}
+ </Button>
+ </div>
+ ) : null}
+ </Section>
+
+ {tier !== "self_serve" ? (
+ <Panel title="Hypercare">
+ <div className="flex items-center gap-2 mb-3 text-sm">
+ <span className="text-muted-foreground shrink-0">Window:</span>
+ <EditableField
+ fieldKey="golive.hypercareWeeks"
+ value={fields.get("golive.hypercareWeeks")}
+ defaultValue={HYPERCARE_WEEKS_DEFAULT}
+ placeholder="e.g. the first 3 to 4 weeks"
+ className="font-medium max-w-[260px]"
+ />
+ </div>
+ <ul className="flex flex-col gap-2">
+ {HYPERCARE.map((h) => (
+ <li key={h} className="flex items-start gap-2.5 text-sm">
+ <span className="shrink-0 mt-1.5 size-1.5 rounded-full bg-emerald-500" />
+ {h}
+ </li>
+ ))}
+ </ul>
+ </Panel>
+ ) : null}
+
+ <Panel title="How to reach us">
+ <ul className="divide-y -my-2">
+ {supportChannels.map((s) => (
+ <li key={s.key} className="flex items-center gap-3 py-2.5">
+ <span className="text-sm font-medium w-36 shrink-0">
+ {s.channel}
+ </span>
+ <EditableField
+ fieldKey={`golive.support.${s.key}`}
+ value={fields.get(`golive.support.${s.key}`)}
+ defaultValue={s.detail}
+ className="text-sm text-muted-foreground flex-1"
+ />
+ </li>
+ ))}
+ </ul>
+ </Panel>
+ </div>
+ );
+}
+
+function CutoverBox({ done }: { done: boolean }) {
+ return (
+ <span
+ className={cn(
+ "shrink-0 size-5 rounded border flex items-center justify-center transition-colors",
+ done
+ ? "bg-emerald-500 border-emerald-500 text-white"
+ : "bg-card border-input"
+ )}
+ >
+ {done ? <LuCheck className="size-3" /> : null}
+ </span>
+ );
+}
+
+function CustomCutoverRow({ row }: { row: ImplementationRowData }) {
+ const map = useCheckMap();
+ const canEdit = useCanEdit();
+ const { setCheck, updateRow, deleteRow } = useHubActions();
+
+ const label = typeof row.payload.label === "string" ? row.payload.label : "";
+ const key = cutoverKey(row.id);
+ const done = map.get(key) === "1";
+
+ return (
+ <li className="flex items-center gap-3 px-5 py-3">
+ <button
+ type="button"
+ aria-label={done ? "Mark not done" : "Mark done"}
+ onClick={() => setCheck(key, "check", done ? "0" : "1")}
+ className="shrink-0 active:scale-[0.96]"
+ >
+ <CutoverBox done={done} />
+ </button>
+ {canEdit ? (
+ <EditableInput
+ value={label}
+ placeholder="Cutover step"
+ className="flex-1 min-w-0"
+ onCommit={(next) => updateRow(row.id, { label: next })}
+ />
+ ) : (
+ <span
+ className={cn(
+ "flex-1 text-sm",
+ done && "line-through text-muted-foreground"
+ )}
+ >
+ {label}
+ </span>
+ )}
+ {canEdit ? (
+ <IconButton
+ aria-label="Delete step"
+ icon={<LuTrash />}
+ variant="ghost"
+ size="sm"
+ className="text-muted-foreground shrink-0"
+ onClick={() => deleteRow(row.id)}
+ />
+ ) : null}
+ </li>
+ );
+}
diff --git a/packages/onboarding/src/ui/GuidedUpsellCard.tsx b/packages/onboarding/src/ui/GuidedUpsellCard.tsx
new file mode 100644
index 0000000000..f24bd434dc
--- /dev/null
+++ b/packages/onboarding/src/ui/GuidedUpsellCard.tsx
@@ -0,0 +1,49 @@
+import { Button } from "@carbon/react";
+import { LuArrowRight, LuCheck, LuSparkles } from "react-icons/lu";
+import { GUIDED_UPSELL } from "../content";
+
+// Self-serve upsell for the Guided tier. Rendered by the command center only when
+// the hub is self-serve and the ERP route wires `onContactExpert` (opens the
+// booking link). Copy lives in content/support.ts.
+export function GuidedUpsellCard({
+ onContactExpert
+}: {
+ onContactExpert: () => void;
+}) {
+ return (
+ <section className="rounded-2xl border border-blue-500/30 bg-blue-500/[0.04] shadow-button-base p-6 flex items-start gap-4">
+ <div className="shrink-0 size-11 rounded-2xl bg-blue-500/10 border border-blue-500/20 flex items-center justify-center text-blue-600 dark:text-blue-400">
+ <LuSparkles className="text-xl" />
+ </div>
+ <div className="flex-1 min-w-0">
+ <div className="text-xxs uppercase tracking-wide font-medium text-blue-600 dark:text-blue-400">
+ {GUIDED_UPSELL.eyebrow}
+ </div>
+ <div className="text-base font-semibold tracking-tight mt-0.5 text-balance">
+ {GUIDED_UPSELL.heading}
+ </div>
+ <p className="text-sm text-muted-foreground mt-1 text-pretty">
+ {GUIDED_UPSELL.body}
+ </p>
+ <ul className="mt-3 flex flex-wrap gap-x-4 gap-y-1.5">
+ {GUIDED_UPSELL.points.map((point) => (
+ <li
+ key={point}
+ className="flex items-center gap-1.5 text-xs text-muted-foreground"
+ >
+ <LuCheck className="size-3.5 shrink-0 text-blue-600 dark:text-blue-400" />
+ {point}
+ </li>
+ ))}
+ </ul>
+ <Button
+ className="mt-4"
+ onClick={onContactExpert}
+ rightIcon={<LuArrowRight />}
+ >
+ {GUIDED_UPSELL.cta}
+ </Button>
+ </div>
+ </section>
+ );
+}
diff --git a/packages/onboarding/src/ui/HowWeWorkView.tsx b/packages/onboarding/src/ui/HowWeWorkView.tsx
new file mode 100644
index 0000000000..b6512fc318
--- /dev/null
+++ b/packages/onboarding/src/ui/HowWeWorkView.tsx
@@ -0,0 +1,70 @@
+import { CADENCE, ESCALATION } from "../content/howwework";
+import { EditableField } from "./EditableField";
+import { useFieldMap } from "./state";
+
+export function HowWeWorkView() {
+ const fields = useFieldMap();
+ return (
+ <div className="w-full max-w-3xl mx-auto flex flex-col gap-6">
+ <header className="flex flex-col gap-2">
+ <h1 className="text-2xl font-semibold tracking-tight">
+ How We Work Together
+ </h1>
+ <p className="text-sm text-muted-foreground max-w-2xl text-pretty">
+ How we stay aligned and how issues get resolved. Your part: show up to
+ the weekly call and raise blockers early, before they become delays.
+ </p>
+ </header>
+
+ <section className="rounded-2xl border bg-card shadow-button-base overflow-hidden">
+ <div className="px-5 py-3 border-b">
+ <span className="text-sm font-semibold">Meeting cadence</span>
+ </div>
+ <ul className="divide-y">
+ {CADENCE.map((c) => (
+ <li key={c.key} className="flex items-center gap-4 px-5 py-3">
+ <span className="text-sm font-medium w-28 shrink-0">
+ {c.cadence}
+ </span>
+ <EditableField
+ fieldKey={`howWeWork.cadence.${c.key}`}
+ value={fields.get(`howWeWork.cadence.${c.key}`)}
+ defaultValue={c.what}
+ className="text-sm text-muted-foreground flex-1"
+ />
+ </li>
+ ))}
+ </ul>
+ </section>
+
+ <section className="rounded-2xl border bg-card shadow-button-base p-5">
+ <h2 className="text-sm font-semibold mb-4">
+ If something is off track
+ </h2>
+ <ol className="flex flex-col gap-4">
+ {ESCALATION.map((step) => (
+ <li key={step.n} className="flex items-start gap-3">
+ <span className="shrink-0 size-6 rounded-lg border bg-background flex items-center justify-center text-xs font-semibold tabular-nums">
+ {step.n}
+ </span>
+ <div>
+ <div className="text-sm font-medium">{step.title}</div>
+ <div className="text-sm text-muted-foreground mt-0.5">
+ {step.body}
+ </div>
+ </div>
+ </li>
+ ))}
+ </ol>
+ </section>
+
+ <div className="rounded-2xl border-l-2 border-l-primary bg-muted/30 px-5 py-4">
+ <p className="text-sm text-muted-foreground">
+ <span className="font-medium text-foreground">The principle:</span>{" "}
+ raise it early and raise it plainly. A problem named in week 2 is a
+ small fix; the same problem at go-live is a delay.
+ </p>
+ </div>
+ </div>
+ );
+}
diff --git a/packages/onboarding/src/ui/OnboardingHub.tsx b/packages/onboarding/src/ui/OnboardingHub.tsx
new file mode 100644
index 0000000000..93a75a5f33
--- /dev/null
+++ b/packages/onboarding/src/ui/OnboardingHub.tsx
@@ -0,0 +1,408 @@
+import { Button, cn } from "@carbon/react";
+import { useEffect, useRef } from "react";
+import {
+ LuArrowRight,
+ LuArrowUpRight,
+ LuCheck,
+ LuCircleHelp,
+ LuPartyPopper,
+ LuPlay,
+ LuRocket
+} from "react-icons/lu";
+import { SPINE } from "../content/spine";
+import {
+ effectiveGateStatus,
+ effectiveProductStatus,
+ gatesDone,
+ type NextAction,
+ nextAction,
+ ownerForStep,
+ type Signals,
+ spineForTier
+} from "../logic";
+import type { GateValue, StepDef, Tier } from "../types";
+import { GuidedUpsellCard } from "./GuidedUpsellCard";
+import { OWNER_TOKENS } from "./primitives";
+import { useCheckMap, useSignals, useTier } from "./state";
+
+// Carbon-app routing + video resolution are injected by the ERP route (they use
+// `path.to` / trainingConfig). Hub state comes from the store.
+type OnboardingHubProps = {
+ companyName?: string;
+ resolveVideoUrl?: (videoKey: string) => string | undefined;
+ // Navigate to the real Carbon screen for a product step, or to a hub page.
+ onOpenProduct: (productKey: string) => void;
+ onOpenPage: (slug: string) => void;
+ // Jump to the matching step card in the Plan view (by spine step key).
+ onOpenInPlan: (stepKey: string) => void;
+ // Fired once each time every gate flips to done (the celebration trigger). The
+ // ERP route owns the confetti so the package needs no animation dep.
+ onComplete?: () => void;
+ // Finish + leave the implementation hub (ERP opens the exit dialog). Shown on
+ // the completion card once every phase is done.
+ onExit?: () => void;
+ // Book a call with Carbon (Calendly). When provided on a self-serve hub, the
+ // Guided-implementation upsell card is shown.
+ onContactExpert?: () => void;
+};
+
+export function OnboardingHub({
+ companyName,
+ resolveVideoUrl,
+ onOpenProduct,
+ onOpenPage,
+ onOpenInPlan,
+ onComplete,
+ onExit,
+ onContactExpert
+}: OnboardingHubProps) {
+ const tier = useTier();
+ const map = useCheckMap();
+ const signals = useSignals();
+ const spine = spineForTier(SPINE, tier);
+
+ const done = gatesDone(spine, map, signals);
+ const total = spine.length;
+ const remaining = total - done;
+ const next = nextAction(spine, map, signals);
+
+ // Fire onComplete only on a live transition into "all done" within this mount.
+ // The ref seeds from the current value, so an already-complete hub (reload or
+ // revisit) does NOT re-celebrate — the post-completion navigation carries its
+ // own celebrate flag instead (see the ERP route).
+ const isComplete = total > 0 && done === total;
+ const wasComplete = useRef(isComplete);
+ useEffect(() => {
+ if (isComplete && !wasComplete.current) onComplete?.();
+ wasComplete.current = isComplete;
+ }, [isComplete, onComplete]);
+
+ const stateText =
+ done === total
+ ? "Live on Carbon"
+ : done === 0
+ ? `${total} phases to go live`
+ : `${remaining} ${remaining === 1 ? "phase" : "phases"} left`;
+
+ return (
+ <div className="w-full max-w-3xl mx-auto flex flex-col gap-6">
+ <header className="flex flex-col items-center text-center gap-3 pt-2">
+ <div className="size-14 rounded-2xl bg-primary/10 border border-primary/20 flex items-center justify-center mb-1">
+ <LuRocket className="text-2xl text-primary" />
+ </div>
+ <h1 className="text-3xl font-semibold tracking-tight text-balance">
+ {companyName ? `Welcome, ${companyName}` : "Getting set up"}
+ </h1>
+ <p className="text-base text-muted-foreground max-w-xl text-pretty">
+ {total} phases to get your shop live on Carbon. Each one ends at a
+ checkpoint. You and the Carbon team work from the same view.
+ </p>
+ </header>
+
+ {next ? (
+ <NextStepCard
+ action={next}
+ onOpenProduct={onOpenProduct}
+ onOpenPage={onOpenPage}
+ resolveVideoUrl={resolveVideoUrl}
+ />
+ ) : null}
+
+ {done === total ? (
+ <div className="rounded-2xl border border-emerald-500/30 bg-emerald-500/5 shadow-button-base p-6 flex items-center gap-4 motion-safe:animate-in motion-safe:fade-in-50 motion-safe:zoom-in-95 motion-safe:duration-500">
+ <div className="shrink-0 size-12 rounded-2xl bg-emerald-500/15 flex items-center justify-center">
+ <LuPartyPopper className="text-2xl text-emerald-600 dark:text-emerald-400" />
+ </div>
+ <div className="flex-1 min-w-0">
+ <div className="text-lg font-semibold tracking-tight">
+ You're live on Carbon
+ </div>
+ <p className="text-sm text-muted-foreground mt-0.5">
+ All {total} phases are done. Nice work — your team is up and
+ running.
+ </p>
+ </div>
+ {onExit ? (
+ <Button variant="primary" className="shrink-0" onClick={onExit}>
+ Finish onboarding
+ </Button>
+ ) : null}
+ </div>
+ ) : null}
+
+ <div className="rounded-2xl border bg-card shadow-button-base overflow-hidden">
+ <div className="flex items-end justify-between gap-4 flex-wrap p-6 pb-4 border-b">
+ <div className="text-2xl font-semibold tracking-tight">
+ <span className="text-primary tabular-nums">{done}</span> of {total}{" "}
+ phases complete
+ </div>
+ <span className="inline-flex items-center gap-2 text-sm font-medium text-muted-foreground">
+ <span
+ className={cn(
+ "size-2 rounded-full",
+ done === total ? "bg-emerald-500" : "bg-primary"
+ )}
+ />
+ {stateText}
+ </span>
+ </div>
+
+ <div className="flex gap-1.5 px-6 py-4">
+ {spine.map((step) => {
+ const st = effectiveGateStatus(step, map, signals);
+ return (
+ <div
+ key={step.key}
+ className={cn(
+ "flex-1 h-2.5 rounded-full transition-colors",
+ st === "done"
+ ? "bg-emerald-500"
+ : st === "prog"
+ ? "bg-primary"
+ : "bg-border"
+ )}
+ />
+ );
+ })}
+ </div>
+
+ <ul className="divide-y">
+ {spine.map((step) => (
+ <GateRow
+ key={step.key}
+ step={step}
+ tier={tier}
+ status={effectiveGateStatus(step, map, signals)}
+ map={map}
+ signals={signals}
+ onOpenInPlan={onOpenInPlan}
+ />
+ ))}
+ </ul>
+ </div>
+
+ {tier === "self_serve" && onContactExpert ? (
+ <GuidedUpsellCard onContactExpert={onContactExpert} />
+ ) : null}
+ </div>
+ );
+}
+
+// The guided focal point: the one thing to do next, with a CTA into the real
+// Carbon screen (or the hub page that backs the gate).
+function NextStepCard({
+ action,
+ onOpenProduct,
+ onOpenPage,
+ resolveVideoUrl
+}: {
+ action: NextAction;
+ onOpenProduct: (productKey: string) => void;
+ onOpenPage: (slug: string) => void;
+ resolveVideoUrl?: (videoKey: string) => string | undefined;
+}) {
+ const product = action.productStep;
+ const videoUrl = product?.videoKey
+ ? resolveVideoUrl?.(product.videoKey)
+ : undefined;
+
+ return (
+ <div className="rounded-2xl border border-primary/30 bg-primary/5 shadow-button-base p-5 flex items-start gap-4 motion-safe:animate-in motion-safe:fade-in-50 motion-safe:slide-in-from-bottom-2 motion-safe:duration-300">
+ <div className="shrink-0 size-9 rounded-xl bg-primary/15 flex items-center justify-center text-sm font-semibold tabular-nums text-primary">
+ {action.gateNumber}
+ </div>
+ <div className="flex-1 min-w-0">
+ <div className="text-xxs uppercase tracking-wide font-medium text-primary">
+ Next step
+ </div>
+ <div className="text-base font-semibold tracking-tight mt-0.5">
+ {action.title}
+ </div>
+ {action.detail ? (
+ <p className="text-sm text-muted-foreground mt-1">{action.detail}</p>
+ ) : null}
+ <div className="flex items-center gap-2 mt-3 flex-wrap">
+ {product ? (
+ <Button
+ leftIcon={<LuArrowRight />}
+ onClick={() => onOpenProduct(product.key)}
+ >
+ {product.cta ?? "Open in Carbon"}
+ </Button>
+ ) : (
+ <Button
+ leftIcon={<LuArrowRight />}
+ onClick={() => onOpenPage(action.refSlug)}
+ >
+ {`Go to ${action.refTitle}`}
+ </Button>
+ )}
+ {videoUrl ? (
+ <Button
+ variant="secondary"
+ size="sm"
+ leftIcon={<LuPlay />}
+ onClick={() => window.open(videoUrl, "_blank", "noopener")}
+ >
+ Watch
+ </Button>
+ ) : null}
+ {product?.docsUrl ? (
+ <Button
+ variant="secondary"
+ size="sm"
+ leftIcon={<LuArrowUpRight />}
+ onClick={() =>
+ window.open(product.docsUrl, "_blank", "noopener,noreferrer")
+ }
+ >
+ Docs
+ </Button>
+ ) : null}
+ </div>
+ </div>
+ </div>
+ );
+}
+
+// A flat gate row. No inline accordion — the per-step breakdown lives in the
+// Project Plan, so clicking the row jumps to that step's plan card. The status
+// box is display-only here: gates are completed in the plan (by ticking tasks or
+// the gate itself), and this command center reflects that state.
+function GateRow({
+ step,
+ tier,
+ status,
+ map,
+ signals,
+ onOpenInPlan
+}: {
+ step: StepDef;
+ tier: Tier;
+ status: GateValue;
+ map: Map<string, string>;
+ signals: Signals;
+ onOpenInPlan: (stepKey: string) => void;
+}) {
+ const nested = step.nested ?? [];
+ const nestedDone = nested.filter(
+ (n) => effectiveProductStatus(n, map, signals) === "done"
+ ).length;
+
+ return (
+ <li className="p-5 pl-6 transition-colors hover:bg-primary/[0.02]">
+ <div className="flex items-start gap-4">
+ <button
+ type="button"
+ onClick={() => onOpenInPlan(step.key)}
+ aria-label={`${step.title} · ${status}. Update this in the project plan.`}
+ title="Update this in the project plan"
+ className="shrink-0 rounded-md"
+ >
+ <StatusBox status={status} interactive={false} ariaLabel="" />
+ </button>
+ <button
+ type="button"
+ onClick={() => onOpenInPlan(step.key)}
+ className="flex-1 min-w-0 text-left group"
+ >
+ <div className="flex items-center gap-2 flex-wrap">
+ <span
+ className={cn(
+ "text-sm font-semibold transition-colors group-hover:text-primary",
+ status === "done" && "text-muted-foreground"
+ )}
+ >
+ {step.n} · {step.title}
+ </span>
+ <span className="text-xxs uppercase tracking-wide rounded px-1.5 py-0.5 border text-muted-foreground font-medium">
+ Checkpoint: {step.gate}
+ </span>
+ {nested.length ? (
+ <span className="text-xxs text-muted-foreground tabular-nums">
+ {nestedDone}/{nested.length} done
+ </span>
+ ) : null}
+ {tier !== "self_serve" ? (
+ <span className="text-xxs uppercase tracking-wide rounded px-1.5 py-0.5 border text-muted-foreground font-medium ml-auto">
+ {OWNER_TOKENS[ownerForStep(step, tier)].label}
+ </span>
+ ) : null}
+ <LuArrowRight
+ className={cn(
+ "size-4 shrink-0 text-muted-foreground/50 transition group-hover:translate-x-0.5 group-hover:text-primary",
+ tier === "self_serve" && "ml-auto"
+ )}
+ />
+ </div>
+ {step.desc ? (
+ <p className="text-sm text-muted-foreground mt-1">{step.desc}</p>
+ ) : null}
+ <span className="text-xxs font-medium text-muted-foreground/80 mt-2 inline-block transition-colors group-hover:text-primary">
+ View in project plan
+ </span>
+ </button>
+ </div>
+ </li>
+ );
+}
+
+function StatusBox({
+ status,
+ small,
+ ariaLabel,
+ onClick,
+ interactive = true
+}: {
+ status: GateValue;
+ small?: boolean;
+ ariaLabel: string;
+ onClick?: () => void;
+ interactive?: boolean;
+}) {
+ const boxClass = cn(
+ "shrink-0 flex items-center justify-center rounded-md border transition-colors",
+ small ? "size-5 mt-0.5" : "size-6 mt-0.5",
+ interactive && "active:scale-[0.96]",
+ status === "done"
+ ? "bg-emerald-500 border-emerald-500 text-white"
+ : status === "prog"
+ ? "border-primary text-primary bg-primary/10"
+ : cn(
+ "bg-card border-input text-transparent",
+ interactive && "hover:border-primary"
+ )
+ );
+
+ const content =
+ status === "done" ? (
+ <LuCheck className={small ? "size-3" : "size-3.5"} />
+ ) : status === "prog" ? (
+ <span
+ className={cn("rounded-full bg-primary", small ? "size-1.5" : "size-2")}
+ />
+ ) : (
+ <LuCircleHelp className="size-0" />
+ );
+
+ // Derived gates (those with nested steps) are not manual checkboxes — they
+ // reflect their steps, so render a non-interactive indicator instead.
+ if (!interactive) {
+ return (
+ <span aria-label={ariaLabel} title={ariaLabel} className={boxClass}>
+ {content}
+ </span>
+ );
+ }
+
+ return (
+ <button
+ type="button"
+ aria-label={ariaLabel}
+ onClick={onClick}
+ className={boxClass}
+ >
+ {content}
+ </button>
+ );
+}
diff --git a/packages/onboarding/src/ui/OnboardingHubSummary.tsx b/packages/onboarding/src/ui/OnboardingHubSummary.tsx
new file mode 100644
index 0000000000..6c7e8844bd
--- /dev/null
+++ b/packages/onboarding/src/ui/OnboardingHubSummary.tsx
@@ -0,0 +1,69 @@
+import { cn, IconButton } from "@carbon/react";
+import type { ReactNode } from "react";
+import { LuRocket, LuX } from "react-icons/lu";
+
+type OnboardingHubSummaryProps = {
+ label: string;
+ done: number;
+ total: number;
+ // The single next thing to do (drives the home-screen hand-holding).
+ nextLabel?: string;
+ // The CTA (app supplies a react-router <Link> wrapped in a Button for SPA nav).
+ action: ReactNode;
+ // Hide the home card (per-user). The hub stays reachable from the nav.
+ onDismiss?: () => void;
+};
+
+// Compact card shown on the ERP home screen while a hub is active, pointing at
+// the next step and linking into the full hub.
+export function OnboardingHubSummary({
+ label,
+ done,
+ total,
+ nextLabel,
+ action,
+ onDismiss
+}: OnboardingHubSummaryProps) {
+ const pct = total > 0 ? Math.round((done / total) * 100) : 0;
+ return (
+ <div className="relative rounded-2xl border bg-gradient-to-bl from-card from-50% to-background shadow-button-base p-6 pr-12 flex items-center gap-5 mb-6">
+ <div className="shrink-0 size-12 rounded-xl border flex items-center justify-center">
+ <LuRocket className="text-xl text-primary" />
+ </div>
+ <div className="flex-1 min-w-0">
+ <div className="flex items-center gap-2">
+ <h3 className="text-base font-semibold tracking-tight">{label}</h3>
+ <span className="text-sm text-muted-foreground tabular-nums">
+ {done}/{total} steps
+ </span>
+ </div>
+ <div className="mt-2 h-2 w-full max-w-md rounded-full bg-muted overflow-hidden">
+ <div
+ className={cn(
+ "h-full rounded-full transition-[width] duration-500",
+ done === total ? "bg-emerald-500" : "bg-primary"
+ )}
+ style={{ width: `${pct}%` }}
+ />
+ </div>
+ {nextLabel ? (
+ <p className="mt-2 text-sm text-muted-foreground truncate">
+ Next:{" "}
+ <span className="text-foreground font-medium">{nextLabel}</span>
+ </p>
+ ) : null}
+ </div>
+ <div className="shrink-0">{action}</div>
+ {onDismiss ? (
+ <IconButton
+ aria-label="Hide"
+ icon={<LuX />}
+ variant="ghost"
+ size="sm"
+ onClick={onDismiss}
+ className="absolute top-2 right-2 text-muted-foreground"
+ />
+ ) : null}
+ </div>
+ );
+}
diff --git a/packages/onboarding/src/ui/PlaceholderPage.tsx b/packages/onboarding/src/ui/PlaceholderPage.tsx
new file mode 100644
index 0000000000..1e73ae78aa
--- /dev/null
+++ b/packages/onboarding/src/ui/PlaceholderPage.tsx
@@ -0,0 +1,19 @@
+import { LuHardHat } from "react-icons/lu";
+
+// Stub content for hub pages not yet built (everything beyond Start Here in P1).
+// The full IA shows in the sidebar; each page lands here until its real route
+// is implemented (P2–P4).
+export function PlaceholderPage({ title }: { title: string }) {
+ return (
+ <div className="w-full h-full flex flex-col items-center justify-center text-center gap-3 p-8">
+ <div className="size-12 rounded-xl border flex items-center justify-center">
+ <LuHardHat className="text-xl text-muted-foreground" />
+ </div>
+ <h1 className="text-2xl font-semibold tracking-tight">{title}</h1>
+ <p className="text-sm text-muted-foreground max-w-sm text-pretty">
+ This page of your Implementation Hub is being built. Start from the
+ command center while we finish it.
+ </p>
+ </div>
+ );
+}
diff --git a/packages/onboarding/src/ui/PlanView.tsx b/packages/onboarding/src/ui/PlanView.tsx
new file mode 100644
index 0000000000..934c773c41
--- /dev/null
+++ b/packages/onboarding/src/ui/PlanView.tsx
@@ -0,0 +1,327 @@
+import { cn } from "@carbon/react";
+import { type ReactNode, useEffect, useRef } from "react";
+import {
+ LuArrowUpRight,
+ LuCalendarClock,
+ LuCheck,
+ LuFileText,
+ LuPlay
+} from "react-icons/lu";
+import { PAGE_COPY } from "../content";
+import { BOARD_TASKS } from "../content/board";
+import { SPINE } from "../content/spine";
+import {
+ boardTasksForTier,
+ effectiveGateStatus,
+ formatDate,
+ ownerForStep,
+ ownerLeadLabel,
+ planAnchorId,
+ resolveTimeline,
+ spineForTier,
+ stepTaskProgress,
+ taskKey,
+ taskStatus,
+ tasksForStep
+} from "../logic";
+import type { BoardTask, GateValue, StateKind, StepDef, Tier } from "../types";
+import { GanttChart } from "./GanttChart";
+import { ProgressPill } from "./ProgressPill";
+import { PageHeader } from "./primitives";
+import {
+ useCheckMap,
+ useFieldMap,
+ useHubActions,
+ useResolveVideoUrl,
+ useSignals,
+ useTier
+} from "./state";
+
+// The phases as cards. Each card's checklist is the phase's Project Board tasks;
+// ticking one here writes the same task state the board reads (no drift).
+// Read-only re: dates — the timeline is configured in Setup & Controls.
+export function PlanView() {
+ const map = useCheckMap();
+ const fields = useFieldMap();
+ const tier = useTier();
+ const signals = useSignals();
+ const { setCheck, setGate } = useHubActions();
+ const steps = spineForTier(SPINE, tier);
+ const tasks = boardTasksForTier(BOARD_TASKS, tier);
+ const tasksDone = tasks.filter((t) => taskStatus(t, map) === "done").length;
+
+ // Target go-live = the resolved Go-Live checkpoint date (from the schedule set
+ // in Setup & Controls). Display only; null until a project start/go-live is set.
+ const timeline = resolveTimeline(steps, fields);
+ const goLiveDate =
+ timeline.bars.find((b) => b.key === "gate:golive")?.gateDate ?? null;
+
+ return (
+ <div className="w-full max-w-3xl mx-auto flex flex-col gap-6">
+ <PageHeader
+ title={PAGE_COPY.plan.title}
+ lead={`The ${steps.length} phases to go live, each ending at a checkpoint. Tick a task here and it updates on the Project Board too.`}
+ aside={
+ <ProgressPill done={tasksDone} total={tasks.length} label="tasks" />
+ }
+ />
+
+ {goLiveDate ? (
+ <div className="rounded-xl border bg-card shadow-button-base px-4 py-3 flex items-center gap-3">
+ <LuCalendarClock className="shrink-0 text-primary" />
+ <span className="text-xxs uppercase tracking-wide font-medium text-muted-foreground shrink-0">
+ Target go-live
+ </span>
+ <span className="text-sm font-medium">{formatDate(goLiveDate)}</span>
+ </div>
+ ) : null}
+
+ <GanttChart steps={steps} />
+
+ <div className="flex flex-col gap-4">
+ {steps.map((step) => (
+ <PhaseCard
+ key={step.key}
+ step={step}
+ tier={tier}
+ stepTasks={tasksForStep(tasks, step.key)}
+ map={map}
+ gateStatus={effectiveGateStatus(step, map, signals)}
+ progress={stepTaskProgress(tasks, step.key, map)}
+ onToggleTask={setCheck}
+ onToggleGate={setGate}
+ />
+ ))}
+ </div>
+ </div>
+ );
+}
+
+function PhaseCard({
+ step,
+ tier,
+ stepTasks,
+ map,
+ gateStatus,
+ progress,
+ onToggleTask,
+ onToggleGate
+}: {
+ step: StepDef;
+ tier: Tier;
+ stepTasks: BoardTask[];
+ map: Map<string, string>;
+ gateStatus: GateValue;
+ progress: { done: number; total: number };
+ onToggleTask: (itemKey: string, kind: StateKind, value: string) => void;
+ onToggleGate: (key: string, next: GateValue) => void;
+}) {
+ const { done, total } = progress;
+ const allDone = total > 0 && done === total;
+ const gatePassed = gateStatus === "done";
+
+ // Auto-pass the checkpoint when its tasks all complete — one-way, on the
+ // incomplete→complete transition (and on mount if already complete, so the
+ // screenshot case self-heals). The ref guard means a manual reopen sticks
+ // instead of being re-passed every render.
+ const wasAllDone = useRef(false);
+ useEffect(() => {
+ if (allDone && !wasAllDone.current && gateStatus !== "done") {
+ onToggleGate(step.key, "done");
+ }
+ wasAllDone.current = allDone;
+ }, [allDone, gateStatus, step.key, onToggleGate]);
+
+ return (
+ <div
+ id={planAnchorId(step.key)}
+ className="rounded-2xl border bg-card shadow-button-base overflow-hidden scroll-mt-6"
+ >
+ <div className="p-5 pb-4">
+ <div className="flex items-start gap-4">
+ <span className="shrink-0 size-9 rounded-xl border bg-background flex items-center justify-center text-sm font-semibold tabular-nums">
+ {step.n}
+ </span>
+ <div className="flex-1 min-w-0">
+ <div className="flex items-center gap-2 flex-wrap">
+ <span className="text-base font-semibold tracking-tight">
+ {step.title}
+ </span>
+ <span className="text-xxs uppercase tracking-wide rounded px-1.5 py-0.5 border text-muted-foreground font-medium">
+ Checkpoint: {step.gate}
+ </span>
+ </div>
+ <div className="text-xs text-muted-foreground mt-1">
+ {step.timing}
+ {tier !== "self_serve"
+ ? ` · ${ownerLeadLabel(ownerForStep(step, tier))}`
+ : null}
+ </div>
+ </div>
+ {total > 0 ? (
+ <span
+ className={cn(
+ "shrink-0 text-xxs font-medium rounded px-1.5 py-0.5 tabular-nums",
+ allDone
+ ? "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400"
+ : "border text-muted-foreground"
+ )}
+ >
+ {done} / {total} done
+ </span>
+ ) : null}
+ </div>
+
+ {step.desc ? (
+ <p className="text-sm text-muted-foreground mt-3">{step.desc}</p>
+ ) : null}
+
+ <PhaseResources step={step} />
+
+ {stepTasks.length ? (
+ <ul className="mt-4 flex flex-col gap-1">
+ {stepTasks.map((task) => {
+ const isDone = taskStatus(task, map) === "done";
+ return (
+ <li key={task.key}>
+ <button
+ type="button"
+ onClick={() =>
+ onToggleTask(
+ taskKey(task.key),
+ "task",
+ isDone ? "todo" : "done"
+ )
+ }
+ className="w-full flex items-start gap-3 rounded-lg px-2 py-1.5 text-left hover:bg-muted/50 transition-colors"
+ >
+ <span
+ className={cn(
+ "shrink-0 mt-0.5 size-4 rounded border flex items-center justify-center transition-colors",
+ isDone
+ ? "bg-emerald-500 border-emerald-500 text-white"
+ : "bg-card border-input"
+ )}
+ >
+ {isDone ? <LuCheck className="size-3" /> : null}
+ </span>
+ <span
+ className={cn(
+ "text-sm",
+ isDone && "line-through text-muted-foreground"
+ )}
+ >
+ {task.label}
+ </span>
+ </button>
+ </li>
+ );
+ })}
+ </ul>
+ ) : null}
+ </div>
+
+ <div
+ className={cn(
+ "px-5 py-3 border-t text-xs flex items-center gap-3 transition-colors",
+ gatePassed ? "bg-emerald-500/5" : "bg-card"
+ )}
+ >
+ <div className="min-w-0 flex-1">
+ <span className="text-muted-foreground">Checkpoint · </span>
+ <span className="font-medium">{step.gate}</span>
+ </div>
+ <button
+ type="button"
+ onClick={() => onToggleGate(step.key, gatePassed ? "todo" : "done")}
+ className={cn(
+ "shrink-0 inline-flex items-center gap-1.5 rounded-md px-2.5 py-1 text-xxs font-medium transition-colors active:scale-[0.97]",
+ gatePassed
+ ? "text-emerald-600 dark:text-emerald-400 hover:bg-emerald-500/10"
+ : "border bg-card hover:border-primary hover:text-primary"
+ )}
+ >
+ {gatePassed ? (
+ <>
+ <LuCheck className="size-3" />
+ Passed · reopen
+ </>
+ ) : (
+ "Mark checkpoint passed"
+ )}
+ </button>
+ </div>
+ </div>
+ );
+}
+
+// Docs + video links for a phase, pulled from its nested product steps. Videos
+// resolve through the ERP-injected trainingConfig (useResolveVideoUrl); a step
+// with neither a doc nor a resolvable video is dropped.
+function PhaseResources({ step }: { step: StepDef }) {
+ const resolveVideoUrl = useResolveVideoUrl();
+ const items = (step.nested ?? [])
+ .map((n) => ({
+ key: n.key,
+ label: n.label,
+ docsUrl: n.docsUrl,
+ videoUrl: n.videoKey ? resolveVideoUrl(n.videoKey) : undefined
+ }))
+ .filter((r) => r.docsUrl || r.videoUrl);
+
+ if (items.length === 0) return null;
+
+ return (
+ <div className="mt-4 flex flex-col gap-1.5">
+ <div className="text-xxs uppercase tracking-wide font-medium text-muted-foreground">
+ Learn
+ </div>
+ {items.map((r) => (
+ <div key={r.key} className="flex items-center gap-2 text-xs">
+ <span className="flex-1 min-w-0 truncate text-muted-foreground">
+ {r.label}
+ </span>
+ {r.docsUrl ? (
+ <ResourceLink
+ href={r.docsUrl}
+ icon={<LuFileText className="size-3" />}
+ >
+ Docs
+ </ResourceLink>
+ ) : null}
+ {r.videoUrl ? (
+ <ResourceLink
+ href={r.videoUrl}
+ icon={<LuPlay className="size-3" />}
+ >
+ Video
+ </ResourceLink>
+ ) : null}
+ </div>
+ ))}
+ </div>
+ );
+}
+
+function ResourceLink({
+ href,
+ icon,
+ children
+}: {
+ href: string;
+ icon: ReactNode;
+ children: ReactNode;
+}) {
+ return (
+ <a
+ href={href}
+ target="_blank"
+ rel="noreferrer"
+ className="shrink-0 inline-flex items-center gap-1 rounded-md border px-1.5 py-0.5 font-medium text-muted-foreground hover:text-primary hover:border-primary/40 transition-colors"
+ >
+ {icon}
+ {children}
+ <LuArrowUpRight className="size-3 opacity-60" />
+ </a>
+ );
+}
diff --git a/packages/onboarding/src/ui/PositioningView.tsx b/packages/onboarding/src/ui/PositioningView.tsx
new file mode 100644
index 0000000000..c5581ae79f
--- /dev/null
+++ b/packages/onboarding/src/ui/PositioningView.tsx
@@ -0,0 +1,72 @@
+import {
+ CARBON_STRENGTHS,
+ OTHER_STRENGTHS,
+ type VsPoint
+} from "../content/positioning";
+
+export function PositioningView() {
+ return (
+ <div className="w-full max-w-3xl mx-auto flex flex-col gap-6">
+ <div className="inline-flex items-center gap-2 self-start rounded-full bg-red-500/10 px-3 py-1 text-xs font-medium text-red-600 dark:text-red-400">
+ <span className="size-1.5 rounded-full bg-red-500" />
+ Internal only · not for customers
+ </div>
+
+ <header className="flex flex-col gap-2">
+ <h1 className="text-2xl font-semibold tracking-tight">
+ Others vs Carbon
+ </h1>
+ <p className="text-sm text-muted-foreground max-w-2xl text-pretty">
+ Internal reference for where each tool is stronger. Use it to set
+ expectations honestly, not to oversell.
+ </p>
+ </header>
+
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
+ <VsColumn
+ title="What others do better"
+ tone="red"
+ points={OTHER_STRENGTHS}
+ />
+ <VsColumn
+ title="What Carbon does better"
+ tone="blue"
+ points={CARBON_STRENGTHS}
+ />
+ </div>
+ </div>
+ );
+}
+
+function VsColumn({
+ title,
+ tone,
+ points
+}: {
+ title: string;
+ tone: "red" | "blue";
+ points: VsPoint[];
+}) {
+ return (
+ <section className="rounded-2xl border bg-card shadow-button-base p-5">
+ <h2 className="text-sm font-semibold mb-4 flex items-center gap-2">
+ <span
+ className={
+ tone === "red"
+ ? "size-2 rounded-full bg-red-500"
+ : "size-2 rounded-full bg-blue-500"
+ }
+ />
+ {title}
+ </h2>
+ <div className="flex flex-col gap-4">
+ {points.map((p) => (
+ <div key={p.lead}>
+ <div className="text-sm font-medium">{p.lead}</div>
+ <div className="text-sm text-muted-foreground mt-0.5">{p.body}</div>
+ </div>
+ ))}
+ </div>
+ </section>
+ );
+}
diff --git a/packages/onboarding/src/ui/ProgressPill.tsx b/packages/onboarding/src/ui/ProgressPill.tsx
new file mode 100644
index 0000000000..2778aeb161
--- /dev/null
+++ b/packages/onboarding/src/ui/ProgressPill.tsx
@@ -0,0 +1,34 @@
+import { cn } from "@carbon/react";
+
+// Small per-page progress chip so every working page shows where you are at a
+// glance (orientation + motivation), the way the command center does.
+export function ProgressPill({
+ done,
+ total,
+ label
+}: {
+ done: number;
+ total: number;
+ label: string;
+}) {
+ if (total === 0) return null;
+ const allDone = done === total;
+ return (
+ <span
+ className={cn(
+ "shrink-0 inline-flex items-center gap-1.5 rounded-full px-2.5 py-1 text-xs font-medium tabular-nums whitespace-nowrap",
+ allDone
+ ? "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400"
+ : "border text-muted-foreground"
+ )}
+ >
+ <span
+ className={cn(
+ "size-1.5 rounded-full",
+ allDone ? "bg-emerald-500" : "bg-primary"
+ )}
+ />
+ {done}/{total} {label}
+ </span>
+ );
+}
diff --git a/packages/onboarding/src/ui/RequirementsView.tsx b/packages/onboarding/src/ui/RequirementsView.tsx
new file mode 100644
index 0000000000..5c9c87ee2f
--- /dev/null
+++ b/packages/onboarding/src/ui/RequirementsView.tsx
@@ -0,0 +1,160 @@
+import { cn, IconButton } from "@carbon/react";
+import { LuTrash } from "react-icons/lu";
+import { COLLECTIONS, PAGE_COPY, REQUIREMENTS } from "../content";
+import { flagKey } from "../logic";
+import type { ImplementationRowData } from "../types";
+import { ProgressPill } from "./ProgressPill";
+import {
+ CustomRowSection,
+ EditableInput,
+ PageHeader,
+ Section,
+ SectionList,
+ StatusToggle
+} from "./primitives";
+import { useCanEdit, useCheckMap, useExclusions, useHubActions } from "./state";
+
+const FLAG = COLLECTIONS.requirement.flag!;
+
+// A requirement is in scope unless explicitly toggled off (default "1").
+const isInScope = (map: Map<string, string>, key: string) =>
+ (map.get(key) ?? "1") === "1";
+
+export function RequirementsView() {
+ const exclusions = useExclusions();
+ const map = useCheckMap();
+ const { toggleFlag } = useHubActions();
+
+ const modules = REQUIREMENTS.filter(
+ (m) => !exclusions.modules.includes(m.mod)
+ );
+ const rows = modules.flatMap((m) => m.areas.flatMap((a) => a.rows));
+ const inScope = rows.filter((r) => isInScope(map, flagKey(r.code))).length;
+
+ return (
+ <div className="w-full max-w-3xl mx-auto flex flex-col gap-6">
+ <PageHeader
+ title={PAGE_COPY.requirements.title}
+ lead={PAGE_COPY.requirements.lead}
+ aside={
+ <ProgressPill done={inScope} total={rows.length} label="in scope" />
+ }
+ />
+
+ {modules.map((module) => (
+ <Section
+ key={module.code}
+ title={
+ <span className="flex items-center gap-2">
+ <span className="text-xs font-mono font-semibold rounded bg-foreground text-background px-1.5 py-0.5">
+ {module.code}
+ </span>
+ {module.name}
+ </span>
+ }
+ >
+ {module.areas.map((area) => (
+ <div key={area.code}>
+ <div className="px-5 pt-3 pb-1 flex items-baseline gap-2">
+ <span className="text-xs font-mono text-blue-600 dark:text-blue-400">
+ {area.code}
+ </span>
+ <span className="text-xs font-medium text-muted-foreground">
+ {area.name}
+ </span>
+ </div>
+ <SectionList>
+ {area.rows.map((row) => {
+ const key = flagKey(row.code);
+ const inScope = isInScope(map, key);
+ return (
+ <li
+ key={row.code}
+ className="flex items-center gap-4 px-5 py-2.5"
+ >
+ <span className="text-xxs font-mono text-muted-foreground shrink-0 w-20">
+ {row.code}
+ </span>
+ <span
+ className={cn(
+ "flex-1 text-sm",
+ !inScope && "text-muted-foreground line-through"
+ )}
+ >
+ {row.requirement}
+ </span>
+ <StatusToggle
+ active={inScope}
+ activeLabel={FLAG.active}
+ inactiveLabel={FLAG.inactive}
+ withIcon={false}
+ onToggle={() => toggleFlag(key, "scopeFlag", !inScope)}
+ />
+ </li>
+ );
+ })}
+ </SectionList>
+ </div>
+ ))}
+ </Section>
+ ))}
+
+ <CustomRowSection collection="requirement">
+ {(row) => <CustomRequirementRow row={row} />}
+ </CustomRowSection>
+ </div>
+ );
+}
+
+function CustomRequirementRow({ row }: { row: ImplementationRowData }) {
+ const canEdit = useCanEdit();
+ const map = useCheckMap();
+ const { toggleFlag, updateRow, deleteRow } = useHubActions();
+
+ const requirement =
+ typeof row.payload.requirement === "string" ? row.payload.requirement : "";
+ const key = flagKey(row.id);
+ const inScope = isInScope(map, key);
+
+ return (
+ <li className="flex items-center gap-4 px-5 py-2.5">
+ <span className="text-xxs font-mono text-muted-foreground shrink-0 w-20">
+ CUSTOM
+ </span>
+ {canEdit ? (
+ <EditableInput
+ value={requirement}
+ placeholder="Requirement"
+ className="flex-1 min-w-0 text-sm font-normal"
+ onCommit={(next) => updateRow(row.id, { requirement: next })}
+ />
+ ) : (
+ <span
+ className={cn(
+ "flex-1 text-sm",
+ !inScope && "text-muted-foreground line-through"
+ )}
+ >
+ {requirement}
+ </span>
+ )}
+ <StatusToggle
+ active={inScope}
+ activeLabel={FLAG.active}
+ inactiveLabel={FLAG.inactive}
+ withIcon={false}
+ onToggle={() => toggleFlag(key, "scopeFlag", !inScope)}
+ />
+ {canEdit ? (
+ <IconButton
+ aria-label="Delete requirement"
+ icon={<LuTrash />}
+ variant="ghost"
+ size="sm"
+ className="text-muted-foreground shrink-0"
+ onClick={() => deleteRow(row.id)}
+ />
+ ) : null}
+ </li>
+ );
+}
diff --git a/packages/onboarding/src/ui/RolesView.tsx b/packages/onboarding/src/ui/RolesView.tsx
new file mode 100644
index 0000000000..68b5d9fcfd
--- /dev/null
+++ b/packages/onboarding/src/ui/RolesView.tsx
@@ -0,0 +1,98 @@
+import { cn } from "@carbon/react";
+import { PAGE_COPY } from "../content";
+import { ROLES } from "../content/roles";
+import type { Owner } from "../types";
+import { OWNER_TOKENS } from "./primitives";
+
+export function RolesView() {
+ const yourItems = ROLES.flatMap((s) =>
+ s.lines
+ .filter((l) => l.owner === "you")
+ .map((l) => ({ step: s.title, label: l.label }))
+ );
+
+ return (
+ <div className="w-full max-w-3xl mx-auto flex flex-col gap-6">
+ <header className="flex flex-col gap-2">
+ <h1 className="text-2xl font-semibold tracking-tight">
+ {PAGE_COPY.roles.title}
+ </h1>
+ <p className="text-sm text-muted-foreground max-w-2xl text-pretty">
+ {PAGE_COPY.roles.lead}
+ </p>
+ <div className="flex items-center gap-4 mt-1">
+ {(Object.keys(OWNER_TOKENS) as Owner[]).map((o) => (
+ <span
+ key={o}
+ className="inline-flex items-center gap-1.5 text-xs text-muted-foreground"
+ >
+ <span
+ className={cn("size-2 rounded-full", OWNER_TOKENS[o].dot)}
+ />
+ {OWNER_TOKENS[o].label}
+ </span>
+ ))}
+ </div>
+ </header>
+
+ <section className="rounded-2xl border border-emerald-500/30 bg-emerald-500/5 shadow-button-base p-5">
+ <h2 className="text-sm font-semibold mb-3 flex items-center gap-2">
+ <span className="size-2 rounded-full bg-emerald-500" />
+ What you need to do
+ </h2>
+ <ul className="flex flex-col gap-2">
+ {yourItems.map((item) => (
+ <li key={item.label} className="flex items-start gap-2.5 text-sm">
+ <span className="shrink-0 mt-1.5 size-1.5 rounded-full bg-emerald-500" />
+ <span className="flex-1">{item.label}</span>
+ <span className="text-xxs uppercase tracking-wide text-muted-foreground shrink-0 pt-0.5">
+ {item.step}
+ </span>
+ </li>
+ ))}
+ </ul>
+ <p className="text-xs text-muted-foreground mt-3">
+ The customers who go live fastest own these well. The full ours/yours
+ split is below.
+ </p>
+ </section>
+
+ <div className="flex flex-col gap-4">
+ {ROLES.map((step) => (
+ <div
+ key={step.stepKey}
+ className="rounded-2xl border bg-card shadow-button-base overflow-hidden"
+ >
+ <div className="px-5 py-3 border-b">
+ <span className="text-sm font-semibold">{step.title}</span>
+ </div>
+ <ul className="divide-y">
+ {step.lines.map((line) => (
+ <li
+ key={line.label}
+ className="flex items-center gap-3 px-5 py-3"
+ >
+ <span className="flex-1 text-sm">{line.label}</span>
+ <span
+ className={cn(
+ "shrink-0 inline-flex items-center gap-1.5 rounded-full pl-2 pr-2.5 py-0.5 text-xs font-medium",
+ OWNER_TOKENS[line.owner].cls
+ )}
+ >
+ <span
+ className={cn(
+ "size-1.5 rounded-full",
+ OWNER_TOKENS[line.owner].dot
+ )}
+ />
+ {OWNER_TOKENS[line.owner].label}
+ </span>
+ </li>
+ ))}
+ </ul>
+ </div>
+ ))}
+ </div>
+ </div>
+ );
+}
diff --git a/packages/onboarding/src/ui/ScopeView.tsx b/packages/onboarding/src/ui/ScopeView.tsx
new file mode 100644
index 0000000000..e359449d0e
--- /dev/null
+++ b/packages/onboarding/src/ui/ScopeView.tsx
@@ -0,0 +1,156 @@
+import { Button, cn } from "@carbon/react";
+import { LuCheck, LuX } from "react-icons/lu";
+import { PAGE_COPY, UI_TEXT } from "../content";
+import {
+ SCOPE_GOAL_DEFAULT,
+ SCOPE_IN,
+ SCOPE_LEAD_SELF_SERVE,
+ scopeAssumptionsForTier,
+ scopeDoneForTier,
+ scopeOutForTier
+} from "../content/scope";
+import { filterByModule, gateKey } from "../logic";
+import { MODULE_NAME, MODULES } from "../types";
+import { EditableField } from "./EditableField";
+import { PageHeader, Panel } from "./primitives";
+import {
+ useCanEdit,
+ useCheckMap,
+ useExclusions,
+ useFieldMap,
+ useHubActions,
+ useTier
+} from "./state";
+
+export function ScopeView() {
+ const canEdit = useCanEdit();
+ const map = useCheckMap();
+ const tier = useTier();
+ const exclusions = useExclusions();
+ const fields = useFieldMap();
+ const { setGate } = useHubActions();
+
+ const agreed = map.get(gateKey("discovery")) === "done";
+ const inScope = filterByModule(
+ SCOPE_IN.filter((i) => !i.tiers || i.tiers.includes(tier)),
+ exclusions.modules
+ );
+ const excludedModuleNotes = MODULES.filter((m) =>
+ exclusions.modules.includes(m)
+ ).map((m) => `${MODULE_NAME[m]} (excluded for this customer)`);
+
+ return (
+ <div className="w-full max-w-3xl mx-auto flex flex-col gap-6">
+ <PageHeader
+ title={PAGE_COPY.scope.title}
+ lead={
+ tier === "self_serve" ? SCOPE_LEAD_SELF_SERVE : PAGE_COPY.scope.lead
+ }
+ />
+
+ <Panel title="The goal">
+ <EditableField
+ fieldKey="scope.goal"
+ value={fields.get("scope.goal")}
+ defaultValue={SCOPE_GOAL_DEFAULT}
+ multiline
+ className="leading-relaxed"
+ />
+ {canEdit ? (
+ <p className="text-xxs text-muted-foreground mt-2">
+ {UI_TEXT.carbonOnlyLockedField}
+ </p>
+ ) : null}
+ </Panel>
+
+ <Panel title="What's in scope">
+ <ul className="flex flex-col gap-2">
+ {inScope.map((item) => (
+ <li key={item.label} className="flex items-start gap-2.5 text-sm">
+ <span className="shrink-0 mt-0.5 size-4 rounded flex items-center justify-center bg-emerald-500/10 text-emerald-600 dark:text-emerald-400">
+ <LuCheck className="size-3" />
+ </span>
+ {item.label}
+ </li>
+ ))}
+ </ul>
+ </Panel>
+
+ <Panel title="What's out of scope">
+ <ul className="flex flex-col gap-2">
+ {[...scopeOutForTier(tier), ...excludedModuleNotes].map((label) => (
+ <li
+ key={label}
+ className="flex items-start gap-2.5 text-sm text-muted-foreground"
+ >
+ <span className="shrink-0 mt-0.5 size-4 rounded flex items-center justify-center border text-muted-foreground">
+ <LuX className="size-3" />
+ </span>
+ {label}
+ </li>
+ ))}
+ </ul>
+ </Panel>
+
+ <Panel title="What we're assuming">
+ <ul className="flex flex-col gap-2">
+ {scopeAssumptionsForTier(tier).map((label) => (
+ <li key={label} className="flex items-start gap-2.5 text-sm">
+ <span className="shrink-0 mt-1.5 size-1.5 rounded-full bg-muted-foreground/50" />
+ {label}
+ </li>
+ ))}
+ </ul>
+ </Panel>
+
+ <Panel title="How we know we're done">
+ <p className="text-sm leading-relaxed text-muted-foreground">
+ {scopeDoneForTier(tier)}
+ </p>
+ </Panel>
+
+ <section
+ className={cn(
+ "rounded-2xl border p-5 shadow-button-base",
+ agreed
+ ? "border-emerald-500/30 bg-emerald-500/5"
+ : "border-primary/30 bg-primary/5"
+ )}
+ >
+ {agreed ? (
+ <div className="flex items-center gap-3">
+ <span className="shrink-0 size-9 rounded-xl bg-emerald-500/15 flex items-center justify-center text-emerald-600 dark:text-emerald-400">
+ <LuCheck />
+ </span>
+ <div className="flex-1 min-w-0">
+ <div className="text-sm font-semibold">Scope agreed</div>
+ <div className="text-xs text-muted-foreground">
+ This completes the Discovery step.
+ </div>
+ </div>
+ <Button
+ variant="secondary"
+ size="sm"
+ onClick={() => setGate(gateKey("discovery"), "todo")}
+ >
+ Undo
+ </Button>
+ </div>
+ ) : (
+ <div className="flex items-center gap-4">
+ <div className="flex-1 min-w-0">
+ <div className="text-sm font-semibold">Agree on the scope</div>
+ <p className="text-xs text-muted-foreground mt-0.5">
+ When this looks right, mark it agreed. That completes the
+ Discovery step on your command center.
+ </p>
+ </div>
+ <Button onClick={() => setGate(gateKey("discovery"), "done")}>
+ Mark scope as agreed
+ </Button>
+ </div>
+ )}
+ </section>
+ </div>
+ );
+}
diff --git a/packages/onboarding/src/ui/SetupControls.tsx b/packages/onboarding/src/ui/SetupControls.tsx
new file mode 100644
index 0000000000..6b209c8b14
--- /dev/null
+++ b/packages/onboarding/src/ui/SetupControls.tsx
@@ -0,0 +1,362 @@
+import { Button, cn, DatePicker, Input } from "@carbon/react";
+import { useEffect, useState } from "react";
+import { OPTIONAL_SECTIONS, REGISTRY, SPINE } from "../content";
+import {
+ gateDateKey,
+ PLAN_START_KEY,
+ phaseWeeksKey,
+ spineForTier
+} from "../logic";
+import type { Mod, StepDef, Tier } from "../types";
+import { MODULE_NAME, MODULES } from "../types";
+import { toCalendarDate } from "./date";
+import {
+ useContacts,
+ useExclusions,
+ useFieldMap,
+ useHubActions,
+ useTier
+} from "./state";
+
+const GOLIVE_DATE_KEY = gateDateKey("gate:golive");
+
+const TIERS: { value: Tier; label: string; hint: string }[] = [
+ {
+ value: "self_serve",
+ label: "Self-serve",
+ hint: "Customer follows it alone"
+ },
+ { value: "guided", label: "Guided", hint: "Activation fee · we advise" },
+ { value: "enterprise", label: "Enterprise", hint: "Custom SOW · we manage" }
+];
+
+// Carbon-only: tailor a customer's hub. Module/page/section toggles drive the
+// server-side visibility filter; tier relabels the hub; contacts fill across it.
+export function SetupControls() {
+ const tier = useTier();
+ const exclusions = useExclusions();
+ const contacts = useContacts();
+ const fields = useFieldMap();
+ const { setTier, setExclusions, setContacts, setField } = useHubActions();
+
+ const [owner, setOwner] = useState(contacts.owner ?? "");
+ const [champion, setChampion] = useState(contacts.champion ?? "");
+
+ const toggleIn = (list: string[], key: string) =>
+ list.includes(key) ? list.filter((k) => k !== key) : [...list, key];
+
+ const optionalPages = REGISTRY.filter((p) => p.optional);
+
+ return (
+ <div className="w-full max-w-2xl mx-auto flex flex-col gap-6">
+ <header className="flex flex-col gap-2">
+ <div className="flex items-center gap-2">
+ <h1 className="text-2xl font-semibold tracking-tight">
+ Setup & Controls
+ </h1>
+ <span className="text-xxs uppercase tracking-wide rounded px-1.5 py-0.5 bg-blue-500/10 text-blue-600 dark:text-blue-400 font-medium">
+ Carbon only
+ </span>
+ </div>
+ <p className="text-sm text-muted-foreground max-w-xl text-pretty">
+ Tailor this hub for the customer. Changes apply live for everyone
+ viewing it. Never shown to the customer here.
+ </p>
+ </header>
+
+ <Card
+ title="Engagement tier"
+ subtitle="Relabels the hub and frames the deal."
+ >
+ <div className="grid grid-cols-1 sm:grid-cols-3 gap-2">
+ {TIERS.map((t) => (
+ <button
+ key={t.value}
+ type="button"
+ onClick={() => setTier(t.value)}
+ className={cn(
+ "rounded-xl border p-3 text-left transition-colors active:scale-[0.98]",
+ tier === t.value
+ ? "border-primary bg-primary/5 ring-1 ring-primary"
+ : "hover:bg-muted/50"
+ )}
+ >
+ <div className="text-sm font-semibold">{t.label}</div>
+ <div className="text-xs text-muted-foreground mt-0.5">
+ {t.hint}
+ </div>
+ </button>
+ ))}
+ </div>
+ </Card>
+
+ <Card
+ title="Schedule"
+ subtitle="Anchors the Plan timeline to real dates. Leave blank for a relative, week-numbered timeline. Setting either one fills in the rest."
+ >
+ <div className="flex flex-col sm:flex-row gap-3 sm:gap-6">
+ <DateRow
+ label="Project start"
+ value={fields.get(PLAN_START_KEY)}
+ onChange={(v) => setField(PLAN_START_KEY, v)}
+ />
+ <DateRow
+ label="Target go-live"
+ value={fields.get(GOLIVE_DATE_KEY)}
+ onChange={(v) => setField(GOLIVE_DATE_KEY, v)}
+ />
+ </div>
+ </Card>
+
+ <Card
+ title="Phase durations"
+ subtitle="How long each phase runs, in weeks. Drives the Plan timeline; leave blank to use the default."
+ >
+ <div className="flex flex-col gap-2">
+ {spineForTier(SPINE, tier).map((step) => (
+ <PhaseDurationRow
+ key={step.key}
+ step={step}
+ value={fields.get(phaseWeeksKey(step.key))}
+ onCommit={(weeks) => setField(phaseWeeksKey(step.key), weeks)}
+ />
+ ))}
+ </div>
+ </Card>
+
+ <Card
+ title="Modules in scope"
+ subtitle="Switch a module off to remove it everywhere: Requirements, Data, Training, Scope."
+ >
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-2">
+ {MODULES.map((m: Mod) => {
+ const included = !exclusions.modules.includes(m);
+ return (
+ <ToggleRow
+ key={m}
+ label={MODULE_NAME[m]}
+ on={included}
+ onToggle={() =>
+ setExclusions({
+ ...exclusions,
+ modules: toggleIn(exclusions.modules, m) as Mod[]
+ })
+ }
+ />
+ );
+ })}
+ </div>
+ </Card>
+
+ {optionalPages.length || OPTIONAL_SECTIONS.length ? (
+ <Card
+ title="Optional pages & sections"
+ subtitle="Drop whole pages or sections a customer doesn't need."
+ >
+ <div className="flex flex-col gap-2">
+ {optionalPages.map((p) => (
+ <ToggleRow
+ key={p.slug}
+ label={p.navLabel}
+ badge="Page"
+ on={!exclusions.pages.includes(p.slug)}
+ onToggle={() =>
+ setExclusions({
+ ...exclusions,
+ pages: toggleIn(exclusions.pages, p.slug)
+ })
+ }
+ />
+ ))}
+ {OPTIONAL_SECTIONS.map((s) => (
+ <ToggleRow
+ key={s.key}
+ label={s.label}
+ badge="Section"
+ on={!exclusions.sections.includes(s.key)}
+ onToggle={() =>
+ setExclusions({
+ ...exclusions,
+ sections: toggleIn(exclusions.sections, s.key)
+ })
+ }
+ />
+ ))}
+ </div>
+ </Card>
+ ) : null}
+
+ {tier !== "self_serve" ? (
+ <Card
+ title="Customer contacts"
+ subtitle="Names fill in wherever those roles are referenced across the hub."
+ >
+ <div className="flex flex-col gap-3">
+ <Field
+ label="Project owner"
+ value={owner}
+ onChange={setOwner}
+ placeholder="e.g. Jane Smith"
+ />
+ <Field
+ label="Champion(s)"
+ value={champion}
+ onChange={setChampion}
+ placeholder="e.g. Marco + the area leads"
+ />
+ <div>
+ <Button
+ onClick={() => setContacts({ ...contacts, owner, champion })}
+ >
+ Save contacts
+ </Button>
+ </div>
+ </div>
+ </Card>
+ ) : null}
+ </div>
+ );
+}
+
+function Card({
+ title,
+ subtitle,
+ children
+}: {
+ title: string;
+ subtitle?: string;
+ children: React.ReactNode;
+}) {
+ return (
+ <section className="rounded-2xl border bg-card shadow-button-base p-5">
+ <h2 className="text-sm font-semibold">{title}</h2>
+ {subtitle ? (
+ <p className="text-xs text-muted-foreground mt-1 mb-4 max-w-xl">
+ {subtitle}
+ </p>
+ ) : (
+ <div className="mb-4" />
+ )}
+ {children}
+ </section>
+ );
+}
+
+function PhaseDurationRow({
+ step,
+ value,
+ onCommit
+}: {
+ step: StepDef;
+ value: string | undefined;
+ onCommit: (weeks: string) => void;
+}) {
+ const [weeks, setWeeks] = useState(value ?? "");
+ // Re-sync if the server value changes underneath (realtime / revalidate).
+ useEffect(() => setWeeks(value ?? ""), [value]);
+
+ return (
+ <div className="flex items-center gap-3 rounded-lg border px-3 py-2">
+ <span className="shrink-0 size-6 rounded-lg border bg-background flex items-center justify-center text-xs font-semibold tabular-nums">
+ {step.n}
+ </span>
+ <div className="flex-1 min-w-0">
+ <div className="text-sm font-medium">{step.title}</div>
+ <div className="text-xs text-muted-foreground truncate">
+ {step.gate}
+ </div>
+ </div>
+ <div className="flex items-center gap-1.5 shrink-0">
+ <Input
+ type="number"
+ min={1}
+ step={1}
+ value={weeks}
+ placeholder={String(step.gantt?.weeks ?? "")}
+ onChange={(e) => setWeeks(e.target.value)}
+ onBlur={() => {
+ if (weeks !== (value ?? "")) onCommit(weeks);
+ }}
+ className="w-16 tabular-nums text-right"
+ />
+ <span className="text-xs text-muted-foreground">wks</span>
+ </div>
+ </div>
+ );
+}
+
+function ToggleRow({
+ label,
+ badge,
+ on,
+ onToggle
+}: {
+ label: string;
+ badge?: string;
+ on: boolean;
+ onToggle: () => void;
+}) {
+ return (
+ <div
+ className={cn(
+ "flex items-center gap-3 rounded-lg border px-3 py-2",
+ !on && "opacity-60 bg-muted/40"
+ )}
+ >
+ <span className="flex-1 text-sm font-medium">{label}</span>
+ {badge ? (
+ <span className="text-xxs uppercase tracking-wide rounded px-1.5 py-0.5 border text-muted-foreground font-medium">
+ {badge}
+ </span>
+ ) : null}
+ <Button variant={on ? "secondary" : "ghost"} size="sm" onClick={onToggle}>
+ {on ? "Included" : "Excluded"}
+ </Button>
+ </div>
+ );
+}
+
+function DateRow({
+ label,
+ value,
+ onChange
+}: {
+ label: string;
+ value: string | undefined;
+ onChange: (iso: string) => void;
+}) {
+ return (
+ <label className="flex flex-col gap-1 flex-1 min-w-0">
+ <span className="text-xs font-medium text-muted-foreground">{label}</span>
+ <DatePicker
+ aria-label={label}
+ value={toCalendarDate(value)}
+ onChange={(d) => onChange(d ? d.toString() : "")}
+ />
+ </label>
+ );
+}
+
+function Field({
+ label,
+ value,
+ onChange,
+ placeholder
+}: {
+ label: string;
+ value: string;
+ onChange: (v: string) => void;
+ placeholder?: string;
+}) {
+ return (
+ <label className="flex flex-col gap-1">
+ <span className="text-xs font-medium text-muted-foreground">{label}</span>
+ <Input
+ type="text"
+ value={value}
+ placeholder={placeholder}
+ onChange={(e) => onChange(e.target.value)}
+ />
+ </label>
+ );
+}
diff --git a/packages/onboarding/src/ui/SetupMapView.tsx b/packages/onboarding/src/ui/SetupMapView.tsx
new file mode 100644
index 0000000000..5112d1d35c
--- /dev/null
+++ b/packages/onboarding/src/ui/SetupMapView.tsx
@@ -0,0 +1,210 @@
+import { IconButton } from "@carbon/react";
+import { useEffect, useState } from "react";
+import { LuArrowUpRight, LuTrash } from "react-icons/lu";
+import { COLLECTIONS, PAGE_COPY } from "../content";
+import { SETUP_GROUPS } from "../content/setup";
+import { filterByModule, flagKey } from "../logic";
+import type { CustomDataPayload, ImplementationRowData } from "../types";
+import { ProgressPill } from "./ProgressPill";
+import {
+ CustomRowSection,
+ EditableInput,
+ PageHeader,
+ Section,
+ SectionList,
+ StatusToggle
+} from "./primitives";
+import {
+ useCanEdit,
+ useCheckMap,
+ useExclusions,
+ useHubActions,
+ useResolveScreenUrl
+} from "./state";
+
+const DEF = COLLECTIONS.setup;
+const FLAG = DEF.flag!;
+
+const configuredKey = (id: string) => flagKey(`setup.${id}`);
+
+export function SetupMapView() {
+ const exclusions = useExclusions();
+ const map = useCheckMap();
+ const { toggleFlag } = useHubActions();
+ const resolveScreenUrl = useResolveScreenUrl();
+
+ const visibleRows = SETUP_GROUPS.flatMap((g) =>
+ filterByModule(g.rows, exclusions.modules)
+ );
+ const configured = visibleRows.filter(
+ (r) => map.get(configuredKey(r.key)) === "1"
+ ).length;
+
+ return (
+ <div className="w-full max-w-3xl mx-auto flex flex-col gap-6">
+ <PageHeader
+ title={PAGE_COPY.setup.title}
+ lead={PAGE_COPY.setup.lead}
+ aside={
+ <ProgressPill
+ done={configured}
+ total={visibleRows.length}
+ label="configured"
+ />
+ }
+ />
+
+ {SETUP_GROUPS.map((group) => {
+ const rows = filterByModule(group.rows, exclusions.modules);
+ if (rows.length === 0) return null;
+ return (
+ <Section
+ key={group.n}
+ number={group.n}
+ title={group.title}
+ subtitle={group.desc}
+ >
+ <SectionList>
+ {rows.map((row) => {
+ const key = configuredKey(row.key);
+ const url = resolveScreenUrl(row.key);
+ return (
+ <li
+ key={row.key}
+ className="flex items-center gap-4 px-5 py-3"
+ >
+ <div className="flex-1 min-w-0">
+ {url ? (
+ <a
+ href={url}
+ className="group inline-flex items-center gap-1 text-sm font-medium hover:text-primary transition-colors"
+ >
+ {row.object}
+ <LuArrowUpRight className="size-3.5 shrink-0 text-muted-foreground/50 transition group-hover:text-primary group-hover:translate-x-0.5 group-hover:-translate-y-0.5" />
+ </a>
+ ) : (
+ <div className="text-sm font-medium">{row.object}</div>
+ )}
+ <div className="text-xs text-muted-foreground">
+ {row.detail}
+ </div>
+ </div>
+ <StatusToggle
+ active={map.get(key) === "1"}
+ activeLabel={FLAG.active}
+ inactiveLabel={FLAG.inactive}
+ onToggle={() =>
+ toggleFlag(key, "scopeFlag", map.get(key) !== "1")
+ }
+ />
+ </li>
+ );
+ })}
+ </SectionList>
+ </Section>
+ );
+ })}
+
+ <CustomRowSection collection="setup">
+ {(row) => <CustomSetupRow row={row} />}
+ </CustomRowSection>
+ </div>
+ );
+}
+
+function CustomSetupRow({ row }: { row: ImplementationRowData }) {
+ const canEdit = useCanEdit();
+ const map = useCheckMap();
+ const { toggleFlag, updateRow, deleteRow } = useHubActions();
+
+ const payload: CustomDataPayload = {
+ object: typeof row.payload.object === "string" ? row.payload.object : "",
+ today: typeof row.payload.today === "string" ? row.payload.today : "",
+ url: typeof row.payload.url === "string" ? row.payload.url : undefined
+ };
+ const key = configuredKey(row.id);
+ const configured = map.get(key) === "1";
+
+ const [object, setObject] = useState(payload.object);
+ const [today, setToday] = useState(payload.today);
+ const [url, setUrl] = useState(payload.url ?? "");
+ useEffect(() => setObject(payload.object), [payload.object]);
+ useEffect(() => setToday(payload.today), [payload.today]);
+ useEffect(() => setUrl(payload.url ?? ""), [payload.url]);
+
+ // Merge all three cells on every commit (never send a stale sibling). An empty
+ // URL is dropped so the row falls back to plain text.
+ const commit = (next: Partial<CustomDataPayload>) => {
+ const merged = { object, today, url: url || undefined, ...next };
+ if (!merged.url) merged.url = undefined;
+ updateRow(row.id, merged);
+ };
+
+ return (
+ <li className="flex items-center gap-4 px-5 py-3">
+ <div className="flex-1 min-w-0 flex flex-col gap-1">
+ {canEdit ? (
+ <>
+ <EditableInput
+ value={object}
+ placeholder="What to set up"
+ onCommit={(next) => {
+ setObject(next);
+ commit({ object: next });
+ }}
+ />
+ <EditableInput
+ value={today}
+ placeholder="What it is"
+ variant="muted"
+ onCommit={(next) => {
+ setToday(next);
+ commit({ today: next });
+ }}
+ />
+ <EditableInput
+ value={url}
+ placeholder="Link (optional) — e.g. /x/settings/…"
+ variant="muted"
+ onCommit={(next) => {
+ setUrl(next);
+ commit({ url: next || undefined });
+ }}
+ />
+ </>
+ ) : (
+ <>
+ {payload.url ? (
+ <a
+ href={payload.url}
+ className="group inline-flex items-center gap-1 text-sm font-medium hover:text-primary transition-colors"
+ >
+ {payload.object}
+ <LuArrowUpRight className="size-3.5 shrink-0 text-muted-foreground/50 transition group-hover:text-primary group-hover:translate-x-0.5 group-hover:-translate-y-0.5" />
+ </a>
+ ) : (
+ <div className="text-sm font-medium">{payload.object}</div>
+ )}
+ <div className="text-xs text-muted-foreground">{payload.today}</div>
+ </>
+ )}
+ </div>
+ <StatusToggle
+ active={configured}
+ activeLabel={FLAG.active}
+ inactiveLabel={FLAG.inactive}
+ onToggle={() => toggleFlag(key, "scopeFlag", !configured)}
+ />
+ {canEdit ? (
+ <IconButton
+ aria-label="Delete row"
+ icon={<LuTrash />}
+ variant="ghost"
+ size="sm"
+ className="text-muted-foreground shrink-0"
+ onClick={() => deleteRow(row.id)}
+ />
+ ) : null}
+ </li>
+ );
+}
diff --git a/packages/onboarding/src/ui/TeamView.tsx b/packages/onboarding/src/ui/TeamView.tsx
new file mode 100644
index 0000000000..8c05ec7075
--- /dev/null
+++ b/packages/onboarding/src/ui/TeamView.tsx
@@ -0,0 +1,47 @@
+import { LuUser } from "react-icons/lu";
+import { PAGE_COPY } from "../content";
+import { TEAM_ROLES } from "../content/team";
+import { PageHeader } from "./primitives";
+import { useContacts } from "./state";
+
+export function TeamView() {
+ const contacts = useContacts();
+
+ return (
+ <div className="w-full max-w-3xl mx-auto flex flex-col gap-6">
+ <PageHeader title={PAGE_COPY.team.title} lead={PAGE_COPY.team.lead} />
+
+ <div className="rounded-2xl border border-primary/20 bg-primary/5 p-5">
+ <div className="text-xs font-medium uppercase tracking-wide text-primary mb-1">
+ Your main point of contact
+ </div>
+ <p className="text-sm">
+ Start with{" "}
+ <span className="font-semibold">
+ {contacts.owner ?? "your Implementation Lead"}
+ </span>{" "}
+ for anything. They'll pull in the right person.
+ </p>
+ </div>
+
+ <div className="flex flex-col gap-3">
+ {TEAM_ROLES.map((member) => (
+ <div
+ key={member.role}
+ className="rounded-2xl border bg-card shadow-button-base p-5 flex items-start gap-4"
+ >
+ <span className="shrink-0 size-10 rounded-full border bg-background flex items-center justify-center">
+ <LuUser className="text-muted-foreground" />
+ </span>
+ <div>
+ <div className="text-sm font-semibold">{member.role}</div>
+ <div className="text-sm text-muted-foreground mt-0.5">
+ Owns: {member.owns}
+ </div>
+ </div>
+ </div>
+ ))}
+ </div>
+ </div>
+ );
+}
diff --git a/packages/onboarding/src/ui/TrainingView.tsx b/packages/onboarding/src/ui/TrainingView.tsx
new file mode 100644
index 0000000000..5904153d22
--- /dev/null
+++ b/packages/onboarding/src/ui/TrainingView.tsx
@@ -0,0 +1,112 @@
+import { cn } from "@carbon/react";
+import { LuArrowUpRight } from "react-icons/lu";
+import { PAGE_COPY } from "../content";
+import { TRAINING_TRACKS } from "../content/training";
+import { fmtKey, isModuleExcluded } from "../logic";
+import { EditableField } from "./EditableField";
+import { PageHeader, Section, SectionList } from "./primitives";
+import {
+ useCheckMap,
+ useExclusions,
+ useFieldMap,
+ useHubActions,
+ useResolveVideoUrl
+} from "./state";
+
+type Format = "Self-paced" | "Hands-on";
+const FORMATS: Format[] = ["Self-paced", "Hands-on"];
+
+export function TrainingView() {
+ const exclusions = useExclusions();
+ const map = useCheckMap();
+ const fields = useFieldMap();
+ const { setCheck } = useHubActions();
+ const resolveVideoUrl = useResolveVideoUrl();
+
+ const visibleTracks = TRAINING_TRACKS.filter(
+ (track) => !isModuleExcluded(track.moduleTags, exclusions.modules)
+ );
+
+ return (
+ <div className="w-full max-w-3xl mx-auto flex flex-col gap-6">
+ <PageHeader
+ title={PAGE_COPY.training.title}
+ lead={PAGE_COPY.training.lead}
+ />
+
+ {visibleTracks.map((track, i) => {
+ const count = track.courses.length;
+ return (
+ <Section
+ key={track.title}
+ number={i + 1}
+ title={track.title}
+ subtitle={`${count} course${count === 1 ? "" : "s"}`}
+ >
+ <SectionList>
+ {track.courses.map((course) => {
+ const key = fmtKey(course.key);
+ const format = (map.get(key) as Format) ?? course.format;
+ const videoUrl = course.videoKey
+ ? resolveVideoUrl(course.videoKey)
+ : undefined;
+ return (
+ <li
+ key={course.key}
+ className="flex items-center gap-4 px-5 py-3"
+ >
+ <div className="flex-1 min-w-0">
+ {videoUrl ? (
+ <a
+ href={videoUrl}
+ target="_blank"
+ rel="noopener noreferrer"
+ className="group inline-flex items-center gap-1 text-sm font-medium hover:text-primary transition-colors"
+ >
+ {course.course}
+ <LuArrowUpRight className="size-3.5 shrink-0 text-muted-foreground/50 transition group-hover:text-primary group-hover:translate-x-0.5 group-hover:-translate-y-0.5" />
+ </a>
+ ) : (
+ <div className="text-sm font-medium">
+ {course.course}
+ </div>
+ )}
+ <div className="text-xs text-muted-foreground flex items-center gap-1">
+ <span className="shrink-0">{course.audience} ·</span>
+ <EditableField
+ fieldKey={`training.${course.key}.length`}
+ value={fields.get(`training.${course.key}.length`)}
+ defaultValue={course.length}
+ placeholder="e.g. 2h"
+ className="text-xs max-w-[90px]"
+ />
+ </div>
+ </div>
+ <div className="shrink-0 inline-flex items-center gap-0.5 rounded-full border bg-background p-0.5">
+ {FORMATS.map((f) => (
+ <button
+ key={f}
+ type="button"
+ onClick={() => setCheck(key, "fmt", f)}
+ aria-pressed={format === f}
+ className={cn(
+ "rounded-full px-2.5 py-0.5 text-xs font-medium transition-colors active:scale-[0.96]",
+ format === f
+ ? "bg-card text-foreground shadow-button-base"
+ : "text-muted-foreground hover:text-foreground"
+ )}
+ >
+ {f}
+ </button>
+ ))}
+ </div>
+ </li>
+ );
+ })}
+ </SectionList>
+ </Section>
+ );
+ })}
+ </div>
+ );
+}
diff --git a/packages/onboarding/src/ui/ValueView.tsx b/packages/onboarding/src/ui/ValueView.tsx
new file mode 100644
index 0000000000..cd37825b96
--- /dev/null
+++ b/packages/onboarding/src/ui/ValueView.tsx
@@ -0,0 +1,102 @@
+import { LuArrowRight } from "react-icons/lu";
+import { PAGE_COPY, UI_TEXT } from "../content";
+import {
+ VALUE_GOALS,
+ VALUE_METRICS,
+ VALUE_POINTS,
+ VALUE_PROBLEMS
+} from "../content/value";
+import { EditableField } from "./EditableField";
+import { PageHeader, Panel } from "./primitives";
+import { useCanEdit, useFieldMap } from "./state";
+
+export function ValueView() {
+ const canEdit = useCanEdit();
+ const fields = useFieldMap();
+
+ return (
+ <div className="w-full max-w-3xl mx-auto flex flex-col gap-6">
+ <PageHeader
+ title={
+ <span className="flex items-center gap-2">
+ {PAGE_COPY.value.title}
+ {canEdit ? (
+ <span className="text-xxs uppercase tracking-wide rounded px-1.5 py-0.5 border text-muted-foreground font-medium">
+ Optional
+ </span>
+ ) : null}
+ </span>
+ }
+ lead={PAGE_COPY.value.lead}
+ />
+
+ <section className="grid grid-cols-1 sm:grid-cols-3 gap-4">
+ {VALUE_METRICS.map((metric) => (
+ <div
+ key={metric.key}
+ className="rounded-2xl border bg-card shadow-button-base p-5 flex flex-col gap-1"
+ >
+ <EditableField
+ fieldKey={`${metric.key}.value`}
+ value={fields.get(`${metric.key}.value`)}
+ defaultValue={metric.value}
+ placeholder="Target"
+ className="text-xl font-semibold tracking-tight"
+ />
+ <EditableField
+ fieldKey={`${metric.key}.label`}
+ value={fields.get(`${metric.key}.label`)}
+ defaultValue={metric.label}
+ placeholder="Metric"
+ className="text-xs text-muted-foreground"
+ />
+ </div>
+ ))}
+ </section>
+ {canEdit ? (
+ <p className="text-xxs text-muted-foreground -mt-3">
+ {UI_TEXT.carbonOnlyValueNote}
+ </p>
+ ) : null}
+
+ <div className="grid grid-cols-1 sm:grid-cols-2 gap-4">
+ <Panel title="Where you are today">
+ <ul className="flex flex-col gap-2">
+ {VALUE_PROBLEMS.map((p) => (
+ <li key={p} className="flex items-start gap-2.5 text-sm">
+ <span className="shrink-0 mt-1.5 size-1.5 rounded-full bg-red-500/70" />
+ {p}
+ </li>
+ ))}
+ </ul>
+ </Panel>
+ <Panel title="Where you want to grow">
+ <ul className="flex flex-col gap-2">
+ {VALUE_GOALS.map((g) => (
+ <li key={g} className="flex items-start gap-2.5 text-sm">
+ <span className="shrink-0 mt-1.5 size-1.5 rounded-full bg-emerald-500" />
+ {g}
+ </li>
+ ))}
+ </ul>
+ </Panel>
+ </div>
+
+ <Panel title="What changes day to day">
+ <div className="flex flex-col gap-4">
+ {VALUE_POINTS.map((v) => (
+ <div key={v.title} className="flex items-start gap-3">
+ <LuArrowRight className="shrink-0 mt-0.5 text-primary" />
+ <div>
+ <div className="text-sm font-medium">{v.title}</div>
+ <div className="text-sm text-muted-foreground mt-0.5">
+ {v.body}
+ </div>
+ </div>
+ </div>
+ ))}
+ </div>
+ </Panel>
+ </div>
+ );
+}
diff --git a/packages/onboarding/src/ui/date.ts b/packages/onboarding/src/ui/date.ts
new file mode 100644
index 0000000000..6f8b7766af
--- /dev/null
+++ b/packages/onboarding/src/ui/date.ts
@@ -0,0 +1,14 @@
+import { type CalendarDate, parseDate } from "@internationalized/date";
+
+// Stored field values are `YYYY-MM-DD`; the Carbon DatePicker speaks CalendarDate.
+// Returns undefined for empty/malformed input so the picker shows no selection.
+export function toCalendarDate(
+ value: string | undefined
+): CalendarDate | undefined {
+ if (!value || !/^\d{4}-\d{2}-\d{2}$/.test(value)) return undefined;
+ try {
+ return parseDate(value);
+ } catch {
+ return undefined;
+ }
+}
diff --git a/packages/onboarding/src/ui/index.ts b/packages/onboarding/src/ui/index.ts
new file mode 100644
index 0000000000..1816692a6f
--- /dev/null
+++ b/packages/onboarding/src/ui/index.ts
@@ -0,0 +1,22 @@
+export { BoardTable } from "./BoardTable";
+export { DataMigrationView } from "./DataMigrationView";
+export { EditableField } from "./EditableField";
+export { GanttChart } from "./GanttChart";
+export { GoLiveView } from "./GoLiveView";
+export { HowWeWorkView } from "./HowWeWorkView";
+export { OnboardingHub } from "./OnboardingHub";
+export { OnboardingHubSummary } from "./OnboardingHubSummary";
+export { PlaceholderPage } from "./PlaceholderPage";
+export { PlanView } from "./PlanView";
+export { PositioningView } from "./PositioningView";
+export { ProgressPill } from "./ProgressPill";
+export * from "./primitives";
+export { RequirementsView } from "./RequirementsView";
+export { RolesView } from "./RolesView";
+export { ScopeView } from "./ScopeView";
+export { SetupControls } from "./SetupControls";
+export { SetupMapView } from "./SetupMapView";
+export * from "./state";
+export { TeamView } from "./TeamView";
+export { TrainingView } from "./TrainingView";
+export { ValueView } from "./ValueView";
diff --git a/packages/onboarding/src/ui/primitives/CustomRowSection.tsx b/packages/onboarding/src/ui/primitives/CustomRowSection.tsx
new file mode 100644
index 0000000000..95b4e6327c
--- /dev/null
+++ b/packages/onboarding/src/ui/primitives/CustomRowSection.tsx
@@ -0,0 +1,69 @@
+// The "Added for this customer" block, config-driven by the collection registry.
+// It reads its own rows + canEdit from the store and wires Add straight to the
+// registry's `newPayload`, so a surface just declares a render body for one row:
+//
+// <CustomRowSection collection="data">
+// {(row) => <MyRow row={row} />}
+// </CustomRowSection>
+//
+// Hidden entirely when there are no custom rows and the viewer can't edit.
+
+import { Button } from "@carbon/react";
+import { Fragment, type ReactNode } from "react";
+import { LuPlus } from "react-icons/lu";
+import { COLLECTIONS, type CollectionKey, UI_TEXT } from "../../content";
+import type { ImplementationRowData } from "../../types";
+import { useCanEdit, useHubActions, useRows } from "../state";
+import { Section, SectionList } from "./Section";
+
+export function CustomRowSection({
+ collection,
+ children
+}: {
+ collection: CollectionKey;
+ children: (row: ImplementationRowData) => ReactNode;
+}) {
+ const def = COLLECTIONS[collection];
+ const canEdit = useCanEdit();
+ const rows = useRows(collection);
+ const { addRow } = useHubActions();
+
+ if (rows.length === 0 && !canEdit) return null;
+
+ return (
+ <Section
+ title={UI_TEXT.addedForCustomer}
+ aside={
+ canEdit ? (
+ <span className="text-xxs text-muted-foreground">
+ {UI_TEXT.carbonOnly}
+ </span>
+ ) : null
+ }
+ >
+ {rows.length > 0 ? (
+ <SectionList>
+ {rows.map((row) => (
+ <Fragment key={row.id}>{children(row)}</Fragment>
+ ))}
+ </SectionList>
+ ) : (
+ <div className="px-5 py-4 text-sm text-muted-foreground">
+ {def.emptyText}
+ </div>
+ )}
+ {canEdit ? (
+ <div className="px-5 py-3 border-t">
+ <Button
+ variant="secondary"
+ size="sm"
+ leftIcon={<LuPlus />}
+ onClick={() => addRow(collection, def.newPayload())}
+ >
+ {def.addLabel}
+ </Button>
+ </div>
+ ) : null}
+ </Section>
+ );
+}
diff --git a/packages/onboarding/src/ui/primitives/EditableInput.tsx b/packages/onboarding/src/ui/primitives/EditableInput.tsx
new file mode 100644
index 0000000000..92e9f58b9f
--- /dev/null
+++ b/packages/onboarding/src/ui/primitives/EditableInput.tsx
@@ -0,0 +1,49 @@
+// Dashed inline input with save-on-blur, built on @carbon/react's <Input>. Holds
+// a local draft so typing is smooth, commits only when the value changed, and
+// re-syncs to the server value if it updates underneath (realtime / revalidate)
+// — but never while focused, so a concurrent update can't clobber live typing.
+
+import { cn, Input } from "@carbon/react";
+import { useEffect, useRef, useState } from "react";
+
+export function EditableInput({
+ value,
+ placeholder,
+ onCommit,
+ variant = "primary",
+ className
+}: {
+ value: string;
+ placeholder?: string;
+ onCommit: (next: string) => void;
+ variant?: "primary" | "muted";
+ className?: string;
+}) {
+ const [draft, setDraft] = useState(value);
+ const focused = useRef(false);
+ useEffect(() => {
+ if (!focused.current) setDraft(value);
+ }, [value]);
+
+ return (
+ <Input
+ value={draft}
+ placeholder={placeholder}
+ onChange={(e) => setDraft(e.target.value)}
+ onFocus={() => {
+ focused.current = true;
+ }}
+ onBlur={() => {
+ focused.current = false;
+ if (draft !== value) onCommit(draft);
+ }}
+ className={cn(
+ "border-dashed bg-primary/[0.03] focus:ring-2 focus:ring-primary/20",
+ variant === "primary"
+ ? "border-primary/40 font-medium"
+ : "border-primary/30 text-xs text-muted-foreground",
+ className
+ )}
+ />
+ );
+}
diff --git a/packages/onboarding/src/ui/primitives/PageHeader.tsx b/packages/onboarding/src/ui/primitives/PageHeader.tsx
new file mode 100644
index 0000000000..28308b1c24
--- /dev/null
+++ b/packages/onboarding/src/ui/primitives/PageHeader.tsx
@@ -0,0 +1,29 @@
+// The page title block every hub surface opens with: H1 + intro lead, optional
+// right-aligned aside (usually a <ProgressPill>). Feed `title`/`lead` from
+// PAGE_COPY so the wording lives in the content layer.
+
+import type { ReactNode } from "react";
+
+export function PageHeader({
+ title,
+ lead,
+ aside
+}: {
+ title: ReactNode;
+ lead?: ReactNode;
+ aside?: ReactNode;
+}) {
+ return (
+ <header className="flex items-start justify-between gap-4">
+ <div className="flex flex-col gap-2">
+ <h1 className="text-2xl font-semibold tracking-tight">{title}</h1>
+ {lead != null ? (
+ <p className="text-sm text-muted-foreground max-w-2xl text-pretty">
+ {lead}
+ </p>
+ ) : null}
+ </div>
+ {aside != null ? <div className="shrink-0">{aside}</div> : null}
+ </header>
+ );
+}
diff --git a/packages/onboarding/src/ui/primitives/Section.tsx b/packages/onboarding/src/ui/primitives/Section.tsx
new file mode 100644
index 0000000000..d675f61f25
--- /dev/null
+++ b/packages/onboarding/src/ui/primitives/Section.tsx
@@ -0,0 +1,97 @@
+// Card-shell + list primitives. The hub's surfaces are all "titled card wrapping
+// a divided list"; this replaces ~15 copy-pasted `rounded-2xl border bg-card …`
+// blocks. Compose: <Section title aside><SectionList>{rows}</SectionList></Section>.
+
+import { cn } from "@carbon/react";
+import type { ReactNode } from "react";
+
+export function Section({
+ title,
+ number,
+ subtitle,
+ aside,
+ children,
+ className
+}: {
+ title?: ReactNode;
+ number?: number | string;
+ subtitle?: ReactNode;
+ aside?: ReactNode;
+ children: ReactNode;
+ className?: string;
+}) {
+ const hasHeader = title != null || aside != null;
+ return (
+ <section
+ className={cn(
+ "rounded-2xl border bg-card shadow-button-base overflow-hidden",
+ className
+ )}
+ >
+ {hasHeader ? (
+ <div className="px-5 py-3 border-b flex items-start justify-between gap-3">
+ <div className="flex items-start gap-3 min-w-0">
+ {number != null ? (
+ <span className="shrink-0 size-6 rounded-lg border bg-background flex items-center justify-center text-xs font-semibold tabular-nums">
+ {number}
+ </span>
+ ) : null}
+ <div className="min-w-0">
+ {title != null ? (
+ <div className="text-sm font-semibold">{title}</div>
+ ) : null}
+ {subtitle != null ? (
+ <div className="text-xs text-muted-foreground">{subtitle}</div>
+ ) : null}
+ </div>
+ </div>
+ {aside != null ? <div className="shrink-0">{aside}</div> : null}
+ </div>
+ ) : null}
+ {children}
+ </section>
+ );
+}
+
+export function SectionList({
+ children,
+ className
+}: {
+ children: ReactNode;
+ className?: string;
+}) {
+ return <ul className={cn("divide-y", className)}>{children}</ul>;
+}
+
+// The other card idiom: a padded card with an inline heading (no header bar, no
+// divided list). Used for prose/summary blocks (Scope sections, support, etc.).
+export function Panel({
+ title,
+ aside,
+ children,
+ className
+}: {
+ title?: ReactNode;
+ aside?: ReactNode;
+ children: ReactNode;
+ className?: string;
+}) {
+ return (
+ <section
+ className={cn(
+ "rounded-2xl border bg-card shadow-button-base p-5",
+ className
+ )}
+ >
+ {title != null || aside != null ? (
+ <div className="flex items-start justify-between gap-3 mb-3">
+ {title != null ? (
+ <h2 className="text-sm font-semibold">{title}</h2>
+ ) : null}
+ {aside != null ? <div className="shrink-0">{aside}</div> : null}
+ </div>
+ ) : null}
+ {children}
+ </section>
+ );
+}
diff --git a/packages/onboarding/src/ui/primitives/StatusToggle.tsx b/packages/onboarding/src/ui/primitives/StatusToggle.tsx
new file mode 100644
index 0000000000..93d14e13ee
--- /dev/null
+++ b/packages/onboarding/src/ui/primitives/StatusToggle.tsx
@@ -0,0 +1,46 @@
+// Binary status pill button (validated / in-scope / done toggles). Active =
+// emerald, inactive = muted. `withIcon` shows a check when active (the
+// "Validated / Not yet" style); off gives the compact "In scope / Out" style.
+
+import { cn } from "@carbon/react";
+import { LuCheck } from "react-icons/lu";
+
+export function StatusToggle({
+ active,
+ activeLabel,
+ inactiveLabel,
+ onToggle,
+ withIcon = true,
+ className
+}: {
+ active: boolean;
+ activeLabel: string;
+ inactiveLabel: string;
+ onToggle: () => void;
+ withIcon?: boolean;
+ className?: string;
+}) {
+ return (
+ <button
+ type="button"
+ onClick={onToggle}
+ className={cn(
+ "shrink-0 inline-flex items-center gap-1.5 rounded-full text-xs font-medium active:scale-[0.96] transition-transform",
+ withIcon ? "pl-2 pr-2.5 py-1" : "px-2.5 py-0.5",
+ active
+ ? "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400"
+ : "border text-muted-foreground",
+ className
+ )}
+ >
+ {withIcon ? (
+ active ? (
+ <LuCheck className="size-3" />
+ ) : (
+ <span className="size-1.5 rounded-full bg-muted-foreground/50" />
+ )
+ ) : null}
+ {active ? activeLabel : inactiveLabel}
+ </button>
+ );
+}
diff --git a/packages/onboarding/src/ui/primitives/index.ts b/packages/onboarding/src/ui/primitives/index.ts
new file mode 100644
index 0000000000..3754de9c86
--- /dev/null
+++ b/packages/onboarding/src/ui/primitives/index.ts
@@ -0,0 +1,6 @@
+export * from "./CustomRowSection";
+export * from "./EditableInput";
+export * from "./PageHeader";
+export * from "./Section";
+export * from "./StatusToggle";
+export * from "./tokens";
diff --git a/packages/onboarding/src/ui/primitives/tokens.ts b/packages/onboarding/src/ui/primitives/tokens.ts
new file mode 100644
index 0000000000..2372d79197
--- /dev/null
+++ b/packages/onboarding/src/ui/primitives/tokens.ts
@@ -0,0 +1,60 @@
+// Canonical visual tokens for owners and statuses. Single source so a colour or
+// label change lands everywhere at once (previously these maps were re-declared
+// in RolesView, BoardTable, etc.). Adding an owner/status = one entry here.
+
+import type { Owner, TaskValue } from "../../types";
+
+export interface OwnerToken {
+ label: string;
+ // pill background + text
+ cls: string;
+ // accompanying dot
+ dot: string;
+}
+
+export const OWNER_TOKENS: Record<Owner, OwnerToken> = {
+ carbon: {
+ label: "Carbon",
+ cls: "bg-blue-500/10 text-blue-600 dark:text-blue-400",
+ dot: "bg-blue-500"
+ },
+ you: {
+ label: "You",
+ cls: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400",
+ dot: "bg-emerald-500"
+ },
+ shared: {
+ label: "Shared",
+ cls: "border text-muted-foreground",
+ dot: "bg-muted-foreground"
+ }
+};
+
+export interface StatusToken {
+ label: string;
+ cls: string;
+ dot: string;
+}
+
+export const TASK_STATUS_TOKENS: Record<TaskValue, StatusToken> = {
+ todo: {
+ label: "Not started",
+ dot: "bg-muted-foreground/50",
+ cls: "border text-muted-foreground"
+ },
+ prog: {
+ label: "In progress",
+ dot: "bg-blue-500",
+ cls: "bg-blue-500/10 text-blue-600 dark:text-blue-400"
+ },
+ blocked: {
+ label: "Blocked",
+ dot: "bg-red-500",
+ cls: "bg-red-500/10 text-red-600 dark:text-red-400"
+ },
+ done: {
+ label: "Done",
+ dot: "bg-emerald-500",
+ cls: "bg-emerald-500/10 text-emerald-600 dark:text-emerald-400"
+ }
+};
diff --git a/packages/onboarding/src/ui/state/HubProvider.tsx b/packages/onboarding/src/ui/state/HubProvider.tsx
new file mode 100644
index 0000000000..1f59af166b
--- /dev/null
+++ b/packages/onboarding/src/ui/state/HubProvider.tsx
@@ -0,0 +1,142 @@
+// Provider + selector hooks for the hub store. The provider owns one store
+// instance and re-hydrates it from loader data on every change; everything below
+// it reads via hooks, so no view needs `states`/`fieldValues`/`canEdit` props.
+
+import {
+ createContext,
+ type ReactNode,
+ useContext,
+ useEffect,
+ useMemo,
+ useRef
+} from "react";
+import { useStore } from "zustand";
+import type {
+ GateValue,
+ HubContacts,
+ HubExclusions,
+ HubStatus,
+ StateKind,
+ Tier
+} from "../../types";
+import {
+ createHubStore,
+ type HubData,
+ type HubFlags,
+ type HubState,
+ type HubStore,
+ type ResolveScreenUrl
+} from "./hubStore";
+import type { HubMutation } from "./mutations";
+
+const noScreenUrl: ResolveScreenUrl = () => undefined;
+
+const HubContext = createContext<HubStore | null>(null);
+
+export function HubProvider({
+ data,
+ flags,
+ dispatch,
+ resolveScreenUrl = noScreenUrl,
+ resolveVideoUrl = noScreenUrl,
+ children
+}: {
+ data: HubData;
+ flags: HubFlags;
+ dispatch: (m: HubMutation) => void;
+ resolveScreenUrl?: ResolveScreenUrl;
+ resolveVideoUrl?: ResolveScreenUrl;
+ children: ReactNode;
+}) {
+ const storeRef = useRef<HubStore | null>(null);
+ if (storeRef.current === null) {
+ storeRef.current = createHubStore({ ...data, ...flags });
+ storeRef.current
+ .getState()
+ .setData(data, flags, dispatch, resolveScreenUrl, resolveVideoUrl);
+ }
+
+ // Re-hydrate from the loader whenever it revalidates (e.g. after a mutation or
+ // a realtime ping). The store mirrors the server; it never diverges from it.
+ useEffect(() => {
+ storeRef.current
+ ?.getState()
+ .setData(data, flags, dispatch, resolveScreenUrl, resolveVideoUrl);
+ }, [data, flags, dispatch, resolveScreenUrl, resolveVideoUrl]);
+
+ return (
+ <HubContext.Provider value={storeRef.current}>
+ {children}
+ </HubContext.Provider>
+ );
+}
+
+function useHubStoreApi(): HubStore {
+ const store = useContext(HubContext);
+ if (!store) {
+ throw new Error("Hub hooks must be used within <HubProvider>");
+ }
+ return store;
+}
+
+// Generic selector hook. Prefer the named hooks below; reach for this for ad-hoc
+// slices. Keep selectors returning primitives or stable refs (see useRows).
+export function useHub<T>(selector: (s: HubState) => T): T {
+ return useStore(useHubStoreApi(), selector);
+}
+
+export const useCanEdit = () => useHub((s) => s.canEdit);
+export const usePreviewing = () => useHub((s) => s.previewing);
+export const useIsInternal = () => useHub((s) => s.isInternal);
+export const useTier = () => useHub((s) => s.tier);
+export const useHubStatus = () => useHub((s) => s.status);
+export const useExclusions = () => useHub((s) => s.exclusions);
+export const useContacts = () => useHub((s) => s.contacts);
+export const useSignals = () => useHub((s) => s.signals);
+export const useCheckMap = () => useHub((s) => s.checkMap);
+export const useFieldMap = () => useHub((s) => s.fieldMap);
+// Resolve a deep link to the ERP screen for a stable screen key (or undefined).
+export const useResolveScreenUrl = () => useHub((s) => s.resolveScreenUrl);
+// Resolve a training video key to a watch URL (or undefined).
+export const useResolveVideoUrl = () => useHub((s) => s.resolveVideoUrl);
+
+// Custom rows for one collection. Selects the stable `rows` ref and filters in a
+// memo so the selector never returns a fresh array (which would thrash useStore).
+export function useRows(collection: string) {
+ const rows = useHub((s) => s.rows);
+ return useMemo(
+ () => rows.filter((r) => r.collection === collection),
+ [rows, collection]
+ );
+}
+
+// Typed write helpers over the raw dispatch. Every call is a server round-trip.
+export function useHubActions() {
+ const dispatch = useHub((s) => s.dispatch);
+ return useMemo(
+ () => ({
+ setCheck: (itemKey: string, kind: StateKind, value: string) =>
+ dispatch({ intent: "setCheck", itemKey, kind, value }),
+ // Boolean flag toggles (scopeFlag / check) persist as "1" | "0".
+ toggleFlag: (itemKey: string, kind: StateKind, on: boolean) =>
+ dispatch({ intent: "setCheck", itemKey, kind, value: on ? "1" : "0" }),
+ setGate: (itemKey: string, value: GateValue) =>
+ dispatch({ intent: "setCheck", itemKey, kind: "gate", value }),
+ setField: (fieldKey: string, value: string) =>
+ dispatch({ intent: "setField", fieldKey, value }),
+ addRow: (collection: string, payload: Record<string, unknown>) =>
+ dispatch({ intent: "addRow", collection, payload }),
+ updateRow: (rowId: string, payload: Record<string, unknown>) =>
+ dispatch({ intent: "updateRow", rowId, payload }),
+ deleteRow: (rowId: string) => dispatch({ intent: "deleteRow", rowId }),
+ setExclusions: (exclusions: HubExclusions) =>
+ dispatch({ intent: "setExclusions", exclusions }),
+ setTier: (tier: Tier) => dispatch({ intent: "setTier", tier }),
+ setStatus: (status: HubStatus) =>
+ dispatch({ intent: "setStatus", status }),
+ setContacts: (contacts: HubContacts) =>
+ dispatch({ intent: "setContacts", contacts })
+ }),
+ [dispatch]
+ );
+}
diff --git a/packages/onboarding/src/ui/state/hubStore.ts b/packages/onboarding/src/ui/state/hubStore.ts
new file mode 100644
index 0000000000..95ea15ab21
--- /dev/null
+++ b/packages/onboarding/src/ui/state/hubStore.ts
@@ -0,0 +1,120 @@
+// The hub store — a SERVER-DRIVEN distribution layer, not a client state owner.
+//
+// The React Router loader is the single source of truth. Each render the provider
+// hydrates this store from fresh loader data (`setData`). Components read slices
+// via selector hooks (so a change to one slice doesn't re-render every consumer)
+// and write ONLY through `dispatch`, which round-trips to the `/state` server
+// action; Supabase Realtime then revalidates the loader and the cycle repeats.
+// There is no optimistic local mutation and no client-owned domain state here —
+// `setData` is the only writer of business fields, and only the provider calls it.
+//
+// `checkMap` / `fieldMap` are cheap derived lookups rebuilt on hydration so view
+// components do O(1) reads instead of each rebuilding a Map per render.
+
+import { createStore } from "zustand/vanilla";
+import {
+ EMPTY_EXCLUSIONS,
+ fieldMap,
+ type Signals,
+ stateMap
+} from "../../logic";
+import type {
+ CheckStateRow,
+ FieldValueRow,
+ HubContacts,
+ HubExclusions,
+ HubStatus,
+ ImplementationRowData,
+ Tier
+} from "../../types";
+import type { HubMutation } from "./mutations";
+
+// The per-company server data the hub renders from (all loader-sourced).
+export interface HubData {
+ tier: Tier;
+ status: HubStatus;
+ exclusions: HubExclusions;
+ checkStates: CheckStateRow[];
+ fieldValues: FieldValueRow[];
+ rows: ImplementationRowData[];
+ contacts: HubContacts;
+ signals: Signals;
+}
+
+// Viewer context. `canEdit` is UX-only (show/hide controls); the server action is
+// the real authority on who may write — never trust this for security.
+export interface HubFlags {
+ isInternal: boolean;
+ previewing: boolean;
+ canEdit: boolean;
+}
+
+// App-routing injection. The package can't reach the ERP's `path.to`, so the
+// route layer supplies a resolver mapping a stable screen key (e.g. a setup
+// row's key) to a URL. Views render a deep link only when this returns a URL.
+export type ResolveScreenUrl = (appKey: string) => string | undefined;
+
+export interface HubState extends HubData, HubFlags {
+ checkMap: Map<string, string>;
+ fieldMap: Map<string, string>;
+ dispatch: (m: HubMutation) => void;
+ resolveScreenUrl: ResolveScreenUrl;
+ // Resolve a training video key to a watch URL (academy or video), via the ERP
+ // trainingConfig the route injects. Same shape as resolveScreenUrl.
+ resolveVideoUrl: ResolveScreenUrl;
+ // Provider-only: re-hydrate the whole store from the latest loader snapshot.
+ setData: (
+ data: HubData,
+ flags: HubFlags,
+ dispatch: (m: HubMutation) => void,
+ resolveScreenUrl: ResolveScreenUrl,
+ resolveVideoUrl: ResolveScreenUrl
+ ) => void;
+}
+
+export type HubStore = ReturnType<typeof createHubStore>;
+
+const EMPTY_SIGNALS: Signals = {
+ hasItems: false,
+ hasMakeMethod: false,
+ hasJob: false,
+ hasSalesOrder: false,
+ hasTrackedEntity: false
+};
+
+export const HUB_INITIAL: HubData & HubFlags = {
+ tier: "self_serve",
+ status: "tailoring",
+ exclusions: EMPTY_EXCLUSIONS,
+ checkStates: [],
+ fieldValues: [],
+ rows: [],
+ contacts: {},
+ signals: EMPTY_SIGNALS,
+ isInternal: false,
+ previewing: false,
+ canEdit: false
+};
+
+export function createHubStore(initial: Partial<HubData & HubFlags> = {}) {
+ const seed = { ...HUB_INITIAL, ...initial };
+ return createStore<HubState>()((set) => ({
+ ...seed,
+ checkMap: stateMap(seed.checkStates),
+ fieldMap: fieldMap(seed.fieldValues),
+ // Real dispatch + resolvers are injected by the provider via setData on mount.
+ dispatch: () => undefined,
+ resolveScreenUrl: () => undefined,
+ resolveVideoUrl: () => undefined,
+ setData: (data, flags, dispatch, resolveScreenUrl, resolveVideoUrl) =>
+ set({
+ ...data,
+ ...flags,
+ checkMap: stateMap(data.checkStates),
+ fieldMap: fieldMap(data.fieldValues),
+ dispatch,
+ resolveScreenUrl,
+ resolveVideoUrl
+ })
+ }));
+}
diff --git a/packages/onboarding/src/ui/state/index.ts b/packages/onboarding/src/ui/state/index.ts
new file mode 100644
index 0000000000..a918401805
--- /dev/null
+++ b/packages/onboarding/src/ui/state/index.ts
@@ -0,0 +1,3 @@
+export * from "./HubProvider";
+export * from "./hubStore";
+export * from "./mutations";
diff --git a/packages/onboarding/src/ui/state/mutations.ts b/packages/onboarding/src/ui/state/mutations.ts
new file mode 100644
index 0000000000..00657b978f
--- /dev/null
+++ b/packages/onboarding/src/ui/state/mutations.ts
@@ -0,0 +1,66 @@
+// The hub's write contract. One typed union for every persisted mutation, plus a
+// pure mapper to the FormData fields the `/x/get-started/state` action validates
+// (see `stateActionValidator` in ../../models). Framework-agnostic: no React
+// Router here. The ERP layout builds a single `dispatch` from `useFetcher` +
+// `toFormFields`, so payload shaping (intent strings, JSON encoding) lives in ONE
+// place instead of being copy-pasted into every route file.
+//
+// To add a mutation: add a variant here, a `case` in `toFormFields`, a matching
+// branch in the server action, and (optionally) a wrapper in `useHubActions`.
+
+import type {
+ HubContacts,
+ HubExclusions,
+ HubStatus,
+ StateKind,
+ Tier
+} from "../../types";
+
+export type HubMutation =
+ | { intent: "setCheck"; itemKey: string; kind: StateKind; value: string }
+ | { intent: "setField"; fieldKey: string; value: string }
+ | { intent: "addRow"; collection: string; payload: Record<string, unknown> }
+ | { intent: "updateRow"; rowId: string; payload: Record<string, unknown> }
+ | { intent: "deleteRow"; rowId: string }
+ | { intent: "setExclusions"; exclusions: HubExclusions }
+ | { intent: "setTier"; tier: Tier }
+ | { intent: "setStatus"; status: HubStatus }
+ | { intent: "setContacts"; contacts: HubContacts };
+
+// Shape a mutation into flat string fields for FormData submission. JSON-encodes
+// the structured payloads exactly as the server validator expects to parse them.
+export function toFormFields(m: HubMutation): Record<string, string> {
+ switch (m.intent) {
+ case "setCheck":
+ return {
+ intent: m.intent,
+ itemKey: m.itemKey,
+ kind: m.kind,
+ value: m.value
+ };
+ case "setField":
+ return { intent: m.intent, fieldKey: m.fieldKey, value: m.value };
+ case "addRow":
+ return {
+ intent: m.intent,
+ collection: m.collection,
+ payload: JSON.stringify(m.payload)
+ };
+ case "updateRow":
+ return {
+ intent: m.intent,
+ rowId: m.rowId,
+ payload: JSON.stringify(m.payload)
+ };
+ case "deleteRow":
+ return { intent: m.intent, rowId: m.rowId };
+ case "setExclusions":
+ return { intent: m.intent, exclusions: JSON.stringify(m.exclusions) };
+ case "setTier":
+ return { intent: m.intent, tier: m.tier };
+ case "setStatus":
+ return { intent: m.intent, status: m.status };
+ case "setContacts":
+ return { intent: m.intent, contacts: JSON.stringify(m.contacts) };
+ }
+}
diff --git a/packages/onboarding/tsconfig.json b/packages/onboarding/tsconfig.json
new file mode 100644
index 0000000000..8cee9135d1
--- /dev/null
+++ b/packages/onboarding/tsconfig.json
@@ -0,0 +1,5 @@
+{
+ "extends": "@carbon/config/tsconfig/react-library.json",
+ "include": ["src"],
+ "exclude": ["dist", "build", "node_modules"]
+}
diff --git a/packages/onboarding/vitest.config.ts b/packages/onboarding/vitest.config.ts
new file mode 100644
index 0000000000..9a3c27eaed
--- /dev/null
+++ b/packages/onboarding/vitest.config.ts
@@ -0,0 +1 @@
+export { default } from "@carbon/config/vitest";
diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml
index 97ce0f7acd..4f0a8ab355 100644
--- a/pnpm-lock.yaml
+++ b/pnpm-lock.yaml
@@ -587,6 +587,9 @@ importers:
'@carbon/notifications':
specifier: workspace:*
version: link:../../packages/notifications
+ '@carbon/onboarding':
+ specifier: workspace:*
+ version: link:../../packages/onboarding
'@carbon/printing':
specifier: workspace:*
version: link:../../packages/printing
@@ -815,6 +818,9 @@ importers:
react-colorful:
specifier: 5.6.1
+ react-confetti:
+ specifier: ^6.4.0
+ version: 6.4.0([email protected])
react-confetti-explosion:
specifier: 3.0.3
@@ -2627,6 +2633,58 @@ importers:
specifier: 'catalog:'
version: 5.8.3
+ packages/onboarding:
+ dependencies:
+ '@carbon/database':
+ specifier: workspace:*
+ version: link:../database
+ '@carbon/form':
+ specifier: workspace:*
+ version: link:../form
+ '@carbon/react':
+ specifier: workspace:*
+ version: link:../react
+ '@carbon/utils':
+ specifier: workspace:*
+ version: link:../utils
+ '@internationalized/date':
+ specifier: 'catalog:'
+ version: 3.12.0
+ '@supabase/supabase-js':
+ specifier: 'catalog:'
+ version: 2.80.0
+ react:
+ specifier: 18.3.1
+ version: 18.3.1
+ react-icons:
+ specifier: 'catalog:'
+ version: 5.6.0([email protected])
+ zod:
+ specifier: 'catalog:'
+ version: 3.25.76
+ zustand:
+ specifier: 'catalog:'
+ devDependencies:
+ '@carbon/config':
+ specifier: workspace:*
+ version: link:../config
+ '@types/react':
+ specifier: 18.3.28
+ version: 18.3.28
+ rimraf:
+ specifier: 'catalog:'
+ version: 5.0.10
+ tsup:
+ specifier: 'catalog:'
+ typescript:
+ specifier: 'catalog:'
+ version: 5.8.3
+ vitest:
+ specifier: 'catalog:'
+
packages/printing:
dependencies:
'@carbon/kv':
@@ -13234,6 +13292,12 @@ packages:
react: 18.3.1
react-dom: 18.3.1
+ resolution: {integrity: sha512-5MdGUcqxrTU26I2EU7ltkWPwxvucQTuqMm8dUz72z2YMqTD6s9vMcDUysk7n9jnC+lXuCPeJJ7Knf98VEYE9Rg==}
+ engines: {node: '>=16'}
+ peerDependencies:
+ react: 18.3.1
+
resolution: {integrity: sha512-M7fJZ3IWFaIHcZEkoFOnkjdiUFmwd8d+gTh2bpqMOcnxy/0Gsykw4dsL4QBiKsxcGow6tETUa4NAUcmJF+/nfw==}
@@ -14343,6 +14407,9 @@ packages:
resolution: {integrity: sha512-+v2QJey7ZUeUiuigkU+uFfklvNUyPI2VO2vBpMYJA+a1hKFLFiKtUYlRHdb3P9CrAvMzi0upbjI4WT+zKtqkBg==}
hasBin: true
+ resolution: {integrity: sha512-PZBtLYcCLtEcjL14Fzb1gSxPBeL7nWvGhO5ZFPGqziCcr8uvHp0NDmdjBchp6KHL+tExcg0m3NISmKxhU394dA==}
+
resolution: {integrity: sha512-t0rzBq87m3fVcduHDUFhKmyyX+9eo6WQjZvf51Ea/M0Q7+T374Jp1aUiyUl0GKxp8M/OETVHSDvmkyPgvX+X2w==}
engines: {node: '>=10'}
@@ -26539,6 +26606,11 @@ snapshots:
react: 18.3.1
react-dom: 18.3.1([email protected])
+ dependencies:
+ react: 18.3.1
+ tween-functions: 1.2.0
+
dependencies:
css-styled: 1.0.8
@@ -27998,6 +28070,8 @@ snapshots:
'@turbo/windows-64': 2.9.6
'@turbo/windows-arm64': 2.9.6
+