# Customer Intelligence (Lumen Halo): prompt.md (v1.0.0)

- id: `lumen-customer-intelligence` · version 1.0.0 · block · pro (All-Access)
- category: App screens
- build: Base UI (one set of files; its dependencies follow the build)
- install (this build): `npx shadcn@latest add @beautiful-ui-pro/lumen-customer-intelligence`
- npm dependencies: none
- registry dependencies: utils, @beautiful-ui/lumen-badge, @beautiful-ui/lumen-customer-swarm, @beautiful-ui-pro/lumen-trend, @beautiful-ui-pro/lumen-approval-flow, @beautiful-ui-pro/lumen-data-explorer, @beautiful-ui-pro/lumen-date-compare, @beautiful-ui-pro/lumen-detail-drawer, @beautiful-ui-pro/lumen-evidence-panel, @beautiful-ui-pro/lumen-filter-bar, @beautiful-ui-pro/lumen-insight-rail, @beautiful-ui-pro/lumen-metric-header, @beautiful-ui-pro/lumen-recommendation, @beautiful-ui/lumen-state-panel, https://beautiful-ui.dev/r/lumen-foundation.json
- docs: https://beautiful-ui.dev/components/lumen-customer-intelligence
- The install command carries everything this item needs (files, CSS, tokens, npm and registry dependencies). Prefer it to copying source by hand.

Lumen's reference workspace: see a decline, compare periods, inspect the population, isolate a segment, open the affected customers and review the recommended action. One list of customers with weekly MRR feeds the metric header, the trend, the swarm, the table and the insights, so filters, the date range and selections move every number together. Loading, empty, error and partial data in words; phones stack it.

## Build it
- Stack: React 19 (`ref` is a plain prop), TypeScript, Tailwind CSS v4 utilities, a shadcn-initialised project with the `@/*` alias.
- Packages: none beyond React.
- Files: `components/ui/lumen/workspaces/customer-intelligence.tsx`; shared code: `lib/beautiful-ui/lumen/customer-intelligence-model.ts`, `lib/beautiful-ui/lumen/customer-intelligence-sample.ts`, `lib/beautiful-ui/lumen/customer-swarm-sample.ts`.
- Registry dependencies, installed with it automatically: shadcn `utils` (cn), `lumen-badge`, `lumen-customer-swarm`, `lumen-trend`, `lumen-approval-flow`, `lumen-data-explorer`, `lumen-date-compare`, `lumen-detail-drawer`, `lumen-evidence-panel`, `lumen-filter-bar`, `lumen-insight-rail`, `lumen-metric-header`, `lumen-recommendation`, `lumen-state-panel`, `lumen-foundation`.
- Builds: one set of files for both, but its dependencies come in Base UI and Radix builds. Install the one that matches the project (see Install): a free item's bare URL installs the Base UI build of it and its dependencies.
- Exports to keep: `CustomerIntelligence`, and every exported type.
- CSS: the install merges this item's rules (the registry `css` field) into your global stylesheet, in `@layer components`, and adds the lumen foundation (tokens, keyframes, motion levels) once. Nothing to import by hand.
- Re-running `add` (or `--overwrite`) re-applies those rules: put overrides in your own CSS, never in the installed rules.
- Tokens: retheme with the `--lumen-*` custom properties (`--lumen-accent`, `--lumen-accent-text`, `--lumen-bad`, `--lumen-bad-text`, `--lumen-focus`, `--lumen-good`, `--lumen-good-text`, `--lumen-hairline`, `--lumen-ink`, `--lumen-muted-ink`, `--lumen-series-1`, `--lumen-series-2`, `--lumen-series-3`, `--lumen-series-4`, `--lumen-series-5`, `--lumen-series-6`, `--lumen-warn`, `--lumen-warn-text`); this item's CSS also reads `--lumen-font-mono`, `--lumen-font-sans`, `--lumen-radius-k`. Never add Tailwind colour classes inside the component.

```tsx
import { CustomerIntelligence } from "@/components/ui/lumen/workspaces/customer-intelligence";
```

## Parts

| Part | data-slot | What it is for |
|---|---|---|
| `CustomerIntelligence` | — | The whole workspace, linked through one Coordination provider. |

## Sound
- Keep every `data-slot` and `data-sound` attribute: the sound layer reads them.
- Installing this item adds no audio. Nothing plays until the app mounts `GlassSoundProvider` once (install: `npx shadcn@latest add https://beautiful-ui.dev/r/glass-sound.json`, import from `@/components/beautiful-ui/glass-sound`); `GlassSoundToggle` is its mute control. Without a provider the audio engine never loads.

## Match the original
- Read `components/ui/lumen/workspaces/customer-intelligence.tsx` as the reference implementation before changing or recreating anything, and match it: sizes, colours per theme, motion timings, copy and behaviour.
- If you deviate (a prop you can't honour, a style you changed, a dependency you swapped), say so in your reply, part by part.
- Keep the accessibility contract, the keyboard map and the motion levels listed below.

## Use it when
- customer intelligence, customer analytics dashboard, retention analysis, at-risk customers, SaaS customer health, account analytics workspace, Lumen
- A starting point for a customer analytics screen that links charts, table, detail and AI actions
- Seeing how Lumen's controls, charts and insight pieces work together

### Not when
- A single chart or table: install that piece on its own
- Data without a per-customer history: the header, trend and insights need weekly values

## Mistakes
- Align every customer's history with weeks; a missing week is a gap, not a zero
- Store the decision flows on your server so approvers see them

## Usage

```tsx
import { CustomerIntelligence } from "@/components/ui/lumen/workspaces/customer-intelligence";

// Works as is on the sample; pass your customers with weekly MRR:
<CustomerIntelligence customers={customers} weeks={weeks} today="2026-09-27" actor={me} reviewers={team} onExecute={runPlaybook} />
```

## Props

| Prop | Type | Default | What it does |
|---|---|---|---|
| `customers / weeks` | `CiCustomer[] / string[]` | `Lumen's 300 sample customers, 53 weeks` | Each customer: id, name, plan, region, mrr, seats, tenure, health, owner, renews and history (MRR per week, aligned with weeks). |
| `today / event` | `string / { date, label }` |  | The date presets' today, and a dated event to mark on the trend and cite as evidence. |
| `actor / reviewers / onExecute` | `Actor / Actor[] / (action) => void \| Promise` |  | Who decides, who can approve, and how a recommended action runs. |
| `mode / onRetry` | `"ready" \| "loading" \| "error" \| "empty" / () => void` |  | Show a state (your app derives it from its request); retry runs from the error state. |
| `planLabel / title` | `(plan) => string / ReactNode` |  | How plan keys read, and the heading. |

Full docs: https://beautiful-ui.dev/components/lumen-customer-intelligence

## Customising
- Colours: set the `--lumen-*` tokens on `:root`, or on a container with the `lumen-scope` class to retheme one area. Add the `lumen-inherit` class to follow your shadcn palette instead (`--chart-N`, `--destructive`).
- Dark mode follows the `.dark` class on an ancestor (the shadcn and next-themes convention).
- Update later by re-running the install with `--overwrite` (review the diff if you edited it). Changelog: https://beautiful-ui.dev/r/changelog.json

## Keyboard

| Keys | Action |
|---|---|
| Tab | Move between the date range, filters, metrics, charts, table and rail |
| ← / → | Metrics, trend points and swarm customers, inside each surface |
| Enter | Open a customer or an insight |

## Motion inventory

| Interaction | What moves |
|---|---|
| Metric | The trend's playhead sweeps the new metric |
| Selection | The table narrows to the selected customers |

## Accessibility contract (preserve when editing)
- One heading for the workspace; each surface keeps its own labelled region, keyboard model and data table
- Selections made in the swarm or by an insight are said in the table's heading, with a button to show everyone again
- States (loading, empty, filtered to nothing, error, partial) are said in words with their next step

## Install

```bash
npx shadcn@latest add @beautiful-ui-pro/lumen-customer-intelligence
```

Pro item: needs the `@beautiful-ui-pro` registry in `components.json` and `BEAUTIFUL_UI_TOKEN` in `.env.local` (https://beautiful-ui.dev/account). Setup: https://beautiful-ui.dev/docs/pro. Your components.json `style` picks the build: radix-*, new-york and default get Radix, base-* gets Base UI.

## Credits
- Built on shadcn/ui (https://ui.shadcn.com)

The lumen foundation (the tokens listed above, keyframes and motion levels) installs once with the first component; its CSS is public at https://beautiful-ui.dev/r/lumen-foundation.json.
