@elevasis/sdk 1.21.0 → 1.22.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cli.cjs +1239 -173
- package/dist/index.d.ts +1752 -464
- package/dist/index.js +3477 -143
- package/dist/node/index.d.ts +1 -0
- package/dist/node/index.js +19 -1
- package/dist/test-utils/index.d.ts +1188 -127
- package/dist/test-utils/index.js +3359 -152
- package/dist/worker/index.js +3148 -80
- package/package.json +2 -2
- package/reference/claude-config/hooks/post-edit-validate.mjs +98 -98
- package/reference/claude-config/hooks/scaffold-registry-reminder.mjs +188 -188
- package/reference/claude-config/hooks/tool-failure-recovery.mjs +73 -73
- package/reference/claude-config/registries/graph-skills.json +4 -4
- package/reference/claude-config/registries/knowledge-flags.json +0 -2
- package/reference/claude-config/rules/active-change-index.md +80 -80
- package/reference/claude-config/rules/agent-start-here.md +277 -277
- package/reference/claude-config/rules/deployment.md +57 -57
- package/reference/claude-config/rules/error-handling.md +56 -56
- package/reference/claude-config/rules/execution.md +40 -40
- package/reference/claude-config/rules/frontend.md +4 -4
- package/reference/claude-config/rules/observability.md +31 -31
- package/reference/claude-config/rules/operations.md +29 -17
- package/reference/claude-config/rules/organization-model.md +113 -81
- package/reference/claude-config/rules/organization-os.md +115 -113
- package/reference/claude-config/rules/package-taxonomy.md +33 -33
- package/reference/claude-config/rules/platform.md +42 -42
- package/reference/claude-config/rules/shared-types.md +49 -46
- package/reference/claude-config/rules/task-tracking.md +47 -47
- package/reference/claude-config/rules/ui.md +200 -200
- package/reference/claude-config/rules/vibe.md +235 -235
- package/reference/claude-config/scripts/statusline-command.js +18 -18
- package/reference/claude-config/settings.json +34 -34
- package/reference/claude-config/skills/deploy/{SKILL.md → skill.md} +156 -156
- package/reference/claude-config/skills/dsp/SKILL.md +66 -66
- package/reference/claude-config/skills/elevasis/SKILL.md +235 -235
- package/reference/claude-config/skills/explore/SKILL.md +6 -6
- package/reference/claude-config/skills/git-sync/SKILL.md +126 -126
- package/reference/claude-config/skills/knowledge/SKILL.md +314 -299
- package/reference/claude-config/skills/knowledge/operations/codify-level-a.md +100 -100
- package/reference/claude-config/skills/knowledge/operations/codify-level-b.md +159 -159
- package/reference/claude-config/skills/knowledge/operations/customers.md +109 -109
- package/reference/claude-config/skills/knowledge/operations/features.md +76 -76
- package/reference/claude-config/skills/knowledge/operations/goals.md +118 -118
- package/reference/claude-config/skills/knowledge/operations/identity.md +93 -93
- package/reference/claude-config/skills/knowledge/operations/labels.md +94 -94
- package/reference/claude-config/skills/knowledge/operations/offerings.md +109 -109
- package/reference/claude-config/skills/knowledge/operations/roles.md +99 -99
- package/reference/claude-config/skills/knowledge/operations/techStack.md +30 -30
- package/reference/claude-config/skills/project/SKILL.md +1088 -1088
- package/reference/claude-config/skills/run-ui/SKILL.md +73 -73
- package/reference/claude-config/skills/save/SKILL.md +3 -3
- package/reference/claude-config/skills/setup/SKILL.md +275 -275
- package/reference/claude-config/skills/status/SKILL.md +59 -59
- package/reference/claude-config/skills/submit-request/SKILL.md +180 -180
- package/reference/claude-config/skills/sync/SKILL.md +47 -47
- package/reference/claude-config/skills/tutorial/SKILL.md +259 -259
- package/reference/claude-config/skills/tutorial/progress-template.md +74 -74
- package/reference/claude-config/skills/tutorial/technical.md +1303 -1303
- package/reference/claude-config/skills/tutorial/vibe-coder.md +890 -890
- package/reference/claude-config/sync-notes/2026-04-22-git-sync-and-sync-notes.md +27 -27
- package/reference/claude-config/sync-notes/2026-04-22-lead-gen-deliverability-removal.md +30 -30
- package/reference/claude-config/sync-notes/2026-04-24-test-utils-and-template-tests.md +73 -73
- package/reference/claude-config/sync-notes/2026-04-24-ui-consolidation-and-sdk-cli-train.md +86 -86
- package/reference/claude-config/sync-notes/2026-04-25-auth-role-system-and-settings-roles.md +55 -55
- package/reference/claude-config/sync-notes/2026-04-27-crm-hitl-action-layer-cutover.md +97 -97
- package/reference/claude-config/sync-notes/2026-04-27-lead-gen-substrate-train.md +112 -112
- package/reference/claude-config/sync-notes/2026-04-29-crm-state-and-lead-gen-processing-status.md +93 -93
- package/reference/claude-config/sync-notes/2026-05-02-crm-ownership-next-action.md +58 -58
- package/reference/claude-config/sync-notes/2026-05-02-template-hardcode-workos-config.md +56 -56
- package/reference/claude-config/sync-notes/2026-05-04-elevasis-workspace.md +71 -71
- package/reference/claude-config/sync-notes/2026-05-04-knowledge-bundle.md +83 -83
- package/reference/claude-config/sync-notes/2026-05-04-template-skills-run-ui-and-tutorial.md +59 -59
- package/reference/claude-config/sync-notes/2026-05-05-list-builder.md +42 -42
- package/reference/claude-config/sync-notes/2026-05-06-crm-spine.md +60 -60
- package/reference/claude-config/sync-notes/2026-05-06-sdk-changes-release-train.md +37 -37
- package/reference/claude-config/sync-notes/2026-05-07-sdk-changes-release-train.md +34 -34
- package/reference/claude-config/sync-notes/2026-05-08-resource-governance-scaffold-guidance.md +38 -38
- package/reference/claude-config/sync-notes/2026-05-09-clients-domain.md +32 -32
- package/reference/claude-config/sync-notes/2026-05-09-command-system.md +33 -33
- package/reference/claude-config/sync-notes/2026-05-09-resource-governance-and-misc.md +69 -69
- package/reference/claude-config/sync-notes/2026-05-12-sdk-ready-release-train.md +30 -30
- package/reference/claude-config/sync-notes/2026-05-14-organization-model-ontology-refactor.md +45 -0
- package/reference/claude-config/sync-notes/README.md +43 -43
- package/reference/cli.mdx +808 -808
- package/reference/concepts.mdx +146 -146
- package/reference/deployment/api.mdx +297 -297
- package/reference/deployment/command-center.mdx +209 -209
- package/reference/deployment/index.mdx +195 -195
- package/reference/deployment/provided-features.mdx +107 -107
- package/reference/deployment/ui-execution.mdx +250 -250
- package/reference/examples/organization-model.ts +171 -84
- package/reference/framework/agent.mdx +156 -156
- package/reference/framework/index.mdx +195 -195
- package/reference/framework/interaction-guidance.mdx +182 -182
- package/reference/framework/memory.mdx +326 -326
- package/reference/framework/project-structure.mdx +282 -282
- package/reference/framework/tutorial-system.mdx +135 -135
- package/reference/getting-started.mdx +142 -142
- package/reference/index.mdx +106 -106
- package/reference/packages/core/src/README.md +14 -14
- package/reference/packages/core/src/business/README.md +2 -2
- package/reference/packages/core/src/knowledge/README.md +32 -32
- package/reference/packages/core/src/organization-model/README.md +149 -149
- package/reference/packages/core/src/test-utils/README.md +37 -37
- package/reference/packages/ui/src/api/README.md +18 -18
- package/reference/packages/ui/src/app/README.md +24 -24
- package/reference/packages/ui/src/auth/README.md +18 -18
- package/reference/packages/ui/src/components/README.md +24 -24
- package/reference/packages/ui/src/execution/README.md +16 -16
- package/reference/packages/ui/src/features/README.md +28 -28
- package/reference/packages/ui/src/graph/README.md +16 -16
- package/reference/packages/ui/src/hooks/README.md +23 -23
- package/reference/packages/ui/src/initialization/README.md +19 -19
- package/reference/packages/ui/src/knowledge/README.md +31 -31
- package/reference/packages/ui/src/organization/README.md +18 -18
- package/reference/packages/ui/src/profile/README.md +19 -19
- package/reference/packages/ui/src/provider/README.md +32 -32
- package/reference/packages/ui/src/router/README.md +18 -18
- package/reference/packages/ui/src/sse/README.md +13 -13
- package/reference/packages/ui/src/test-utils/README.md +7 -7
- package/reference/packages/ui/src/theme/README.md +23 -23
- package/reference/packages/ui/src/theme/presets/README.md +19 -19
- package/reference/packages/ui/src/types/README.md +16 -16
- package/reference/packages/ui/src/utils/README.md +18 -18
- package/reference/packages/ui/src/zustand/README.md +18 -18
- package/reference/platform-tools/adapters-integration.mdx +301 -301
- package/reference/platform-tools/adapters-platform.mdx +553 -553
- package/reference/platform-tools/index.mdx +217 -217
- package/reference/platform-tools/type-safety.mdx +82 -82
- package/reference/resources/index.mdx +349 -349
- package/reference/resources/patterns.mdx +449 -449
- package/reference/resources/types.mdx +116 -116
- package/reference/roadmap.mdx +165 -165
- package/reference/runtime.mdx +173 -173
- package/reference/scaffold/core/organization-graph.mdx +110 -90
- package/reference/scaffold/core/organization-model.mdx +225 -213
- package/reference/scaffold/index.mdx +67 -67
- package/reference/scaffold/operations/propagation-pipeline.md +77 -77
- package/reference/scaffold/operations/scaffold-maintenance.md +12 -12
- package/reference/scaffold/operations/workflow-recipes.md +138 -138
- package/reference/scaffold/recipes/add-a-feature.md +307 -85
- package/reference/scaffold/recipes/add-a-resource.md +137 -103
- package/reference/scaffold/recipes/customize-knowledge-browser.md +5 -5
- package/reference/scaffold/recipes/customize-organization-model.md +275 -138
- package/reference/scaffold/recipes/extend-a-base-entity.md +8 -8
- package/reference/scaffold/recipes/extend-crm.md +3 -3
- package/reference/scaffold/recipes/extend-lead-gen.md +394 -394
- package/reference/scaffold/recipes/gate-by-feature-or-admin.md +118 -118
- package/reference/scaffold/recipes/index.md +46 -46
- package/reference/scaffold/recipes/query-the-knowledge-graph.md +197 -170
- package/reference/scaffold/reference/contracts.md +2136 -2093
- package/reference/scaffold/reference/glossary.md +76 -76
- package/reference/scaffold/ui/composition-extensibility.mdx +233 -233
- package/reference/scaffold/ui/customization.md +243 -243
- package/reference/scaffold/ui/feature-flags-and-gating.md +46 -46
- package/reference/scaffold/ui/feature-shell.mdx +72 -72
- package/reference/scaffold/ui/recipes.md +221 -214
- package/reference/spine/spine-primer.md +96 -96
- package/reference/templates/index.mdx +47 -47
- package/reference/troubleshooting.mdx +223 -223
|
@@ -1,200 +1,200 @@
|
|
|
1
|
-
---
|
|
2
|
-
description: UI shell, route structure, auth flow, API access, and template customization points for the ui/ surface
|
|
3
|
-
paths:
|
|
4
|
-
- ui/**
|
|
5
|
-
---
|
|
6
|
-
|
|
7
|
-
# UI Features
|
|
8
|
-
|
|
9
|
-
**Status:** Stable
|
|
10
|
-
|
|
11
|
-
## App Shell Overview
|
|
12
|
-
|
|
13
|
-
The template frontend is a React 19 + TanStack Router app that composes a local dashboard shell with published System modules from `@elevasis/ui`.
|
|
14
|
-
|
|
15
|
-
The main join points are:
|
|
16
|
-
|
|
17
|
-
- `ui/src/main.tsx` -- boots the app with `ElevasisUIProvider`, query client, theme config, WorkOS AuthKit, notifications, and the generated route tree
|
|
18
|
-
- `ui/src/routes/__root.tsx` -- composes the authenticated shell with `ElevasisSystemsProvider`, published System modules, app-local dashboard nav, shell runtime dependencies, and `SystemShell`
|
|
19
|
-
- `ui/src/config/nav-items.ts` -- keeps the host-local dashboard entry separate from the published feature manifests
|
|
20
|
-
- `core/config/organization-model.ts` -- is the template's semantic source of truth, adapting `@elevasis/core/organization-model` into the preserved branding, dashboard label, quick-access, System labels, resource descriptors, and shell helpers
|
|
21
|
-
|
|
22
|
-
Published System modules mounted by the template shell:
|
|
23
|
-
|
|
24
|
-
- `lead-gen`
|
|
25
|
-
- `crm`
|
|
26
|
-
- `delivery` at `/projects`
|
|
27
|
-
- `operations`
|
|
28
|
-
- `monitoring`
|
|
29
|
-
- `settings`
|
|
30
|
-
|
|
31
|
-
Important distinction:
|
|
32
|
-
|
|
33
|
-
- shared modules gate on current org-model System keys such as `sales.lead-gen` and `projects`
|
|
34
|
-
- template routes and local nav may still use legacy aliases such as `crm`, `lead-gen`, and `projects`
|
|
35
|
-
- `core/config/organization-model.ts` and `ui/src/lib/hooks/useFeatureAccess.ts` are the bridge between those two vocabularies
|
|
36
|
-
|
|
37
|
-
Dashboard remains a host-local route at `/`, not a shared feature manifest.
|
|
38
|
-
|
|
39
|
-
This template should be treated as the downstream reference implementation for this composition:
|
|
40
|
-
|
|
41
|
-
-
|
|
42
|
-
- `ui/src/config/nav-items.ts` preserves the host-local dashboard entry instead of pushing that concern into shared manifests
|
|
43
|
-
- `ui/src/routes/__root.tsx` threads `canonicalOrganizationModel` from
|
|
44
|
-
- host-local customizations still stay local: dashboard remains app-owned nav, branding stays in app config, and quick-access/dashboard UX stays in the template app
|
|
45
|
-
|
|
46
|
-
## Auth and Initialization
|
|
47
|
-
|
|
48
|
-
The app uses WorkOS AuthKit through `ElevasisUIProvider`. Authentication is enforced by the local `ProtectedRoute` wrapper in `ui/src/features/auth/ProtectedRoute.tsx`.
|
|
49
|
-
|
|
50
|
-
**Sign-in flow:**
|
|
51
|
-
|
|
52
|
-
1. Unauthenticated user hits a protected route -- `ProtectedRoute` redirects to `/login?returnTo=<path>`
|
|
53
|
-
2. `/login` renders a sign-in card; user clicks Sign In, triggering `signIn({ returnTo })` from `useAuth()`
|
|
54
|
-
3. User authenticates on the WorkOS-hosted sign-in page
|
|
55
|
-
4. WorkOS redirects back to `/auth-redirect` -- `ui/src/routes/auth-redirect.tsx` waits for auth to complete, then navigates to the requested path or `/`
|
|
56
|
-
5. User lands on the home page, fully authenticated
|
|
57
|
-
|
|
58
|
-
**Route protection:**
|
|
59
|
-
|
|
60
|
-
Wrap protected route components with the local `ProtectedRoute` from `@/features/auth`, which adds the full-screen loader and delegates to the shared guard from `@elevasis/ui/auth`:
|
|
61
|
-
|
|
62
|
-
```tsx
|
|
63
|
-
import { ProtectedRoute } from '@/features/auth'
|
|
64
|
-
|
|
65
|
-
function HomePageGuarded() {
|
|
66
|
-
return (
|
|
67
|
-
<ProtectedRoute>
|
|
68
|
-
<HomePage />
|
|
69
|
-
</ProtectedRoute>
|
|
70
|
-
)
|
|
71
|
-
}
|
|
72
|
-
```
|
|
73
|
-
|
|
74
|
-
**Initialization state:**
|
|
75
|
-
|
|
76
|
-
Use `useInitialization()` from `@elevasis/ui/initialization` anywhere inside the app to read aggregated auth + org readiness:
|
|
77
|
-
|
|
78
|
-
```ts
|
|
79
|
-
const { allReady, userReady, isInitializing, error, retry, profile } = useInitialization()
|
|
80
|
-
```
|
|
81
|
-
|
|
82
|
-
**Organization context:**
|
|
83
|
-
|
|
84
|
-
Use `useOrganization()` from `@elevasis/ui/organization` to access org-scoped IDs and memberships:
|
|
85
|
-
|
|
86
|
-
```ts
|
|
87
|
-
const { currentWorkOSOrganizationId, currentSupabaseOrganizationId, memberships, switchOrganization } = useOrganization()
|
|
88
|
-
```
|
|
89
|
-
|
|
90
|
-
## API and Streaming
|
|
91
|
-
|
|
92
|
-
Use `useApiClient()` from `@/lib/hooks/useApiClient` in route components and feature hooks:
|
|
93
|
-
|
|
94
|
-
```ts
|
|
95
|
-
const { apiRequest, isOrganizationReady } = useApiClient()
|
|
96
|
-
const data = await apiRequest('/executions', { method: 'GET' })
|
|
97
|
-
```
|
|
98
|
-
|
|
99
|
-
The template also re-exports `useApiClientContext()` and the shared API client types from `@/lib/hooks/useApiClient`.
|
|
100
|
-
|
|
101
|
-
For real-time updates, feature surfaces use the local singleton wrapper:
|
|
102
|
-
|
|
103
|
-
```ts
|
|
104
|
-
import { sseConnectionManager } from '@/lib/sse/SSEConnectionManager'
|
|
105
|
-
```
|
|
106
|
-
|
|
107
|
-
**WorkOS config:**
|
|
108
|
-
|
|
109
|
-
WorkOS `clientId`, `redirectUri`, and `signoutUri` are hardcoded in `ui/src/config/workos.ts` -- no UI env vars are required to run the template. Edit that file if a fork needs a different WorkOS client. The dev server runs on port `4300` with Vite `strictPort: true`, so a second `pnpm -C ui dev` on the same machine fails fast instead of drifting.
|
|
110
|
-
|
|
111
|
-
The API URL is centralized in `ui/src/lib/constants/api.ts`. In the current template it is hard-coded to `https://api.elevasis.io`, so if the bootstrap is repointed to another API target, that file is the source of truth.
|
|
112
|
-
|
|
113
|
-
## Route Structure
|
|
114
|
-
|
|
115
|
-
Current top-level app sections:
|
|
116
|
-
|
|
117
|
-
- `/` -- host-local dashboard entrypoint with quick links derived from `organizationModel.navigation.quickAccessSurfaceIds`
|
|
118
|
-
- `/lead-gen/*` -- lead generation pages (`lists`, `companies`, `contacts`)
|
|
119
|
-
- `/crm/*` -- CRM overview, pipeline, and deals
|
|
120
|
-
- `/projects/*` -- delivery feature pages (projects, milestones, tasks, notes)
|
|
121
|
-
- `/operations/*` -- operations overview, resources, command queue, command view, sessions, task scheduler
|
|
122
|
-
- `/monitoring/*` -- execution logs, execution health, activity log, cost analytics, notifications
|
|
123
|
-
- `/settings/*` -- account, organization, credentials, API keys, deployments, webhooks, and appearance
|
|
124
|
-
- `/login` and `/auth-redirect` -- auth entry/callback routes
|
|
125
|
-
|
|
126
|
-
Section guards currently follow this pattern:
|
|
127
|
-
|
|
128
|
-
- `ProtectedRoute` for all authenticated sections
|
|
129
|
-
- `SystemGuard` on sections that should hard-stop when a System is disabled: `crm`, `lead-gen`, `projects`, `operations`, and `monitoring`
|
|
130
|
-
- provider-level shell gating for shared System nav and sub-shell behavior
|
|
131
|
-
|
|
132
|
-
The app shell in `__root.tsx` derives visible nav from `shellModel.systems` and `getSidebarLinks()`, filters admin-only entries locally using the signed-in profile, and passes `canonicalOrganizationModel` into `ElevasisSystemsProvider` so shared nav labels, paths, and graph runtime behavior resolve from the same
|
|
133
|
-
|
|
134
|
-
## Dashboard and Feature Areas
|
|
135
|
-
|
|
136
|
-
**Dashboard**
|
|
137
|
-
|
|
138
|
-
`ui/src/features/dashboard/components/Dashboard.tsx` is intentionally lightweight. It acts as the host-owned landing page and renders quick access cards for the most important organization surfaces instead of duplicating the shared operations overview.
|
|
139
|
-
|
|
140
|
-
**Operations**
|
|
141
|
-
|
|
142
|
-
The operations area is the richest shared shell in the template. It includes:
|
|
143
|
-
|
|
144
|
-
- resource inventory and detail pages
|
|
145
|
-
- command queue and command view
|
|
146
|
-
- sessions screens
|
|
147
|
-
- the shared operations overview at `/operations/`
|
|
148
|
-
|
|
149
|
-
**Monitoring**
|
|
150
|
-
|
|
151
|
-
Monitoring is scaffolded as a shared feature area with route files for:
|
|
152
|
-
|
|
153
|
-
- activity log
|
|
154
|
-
- cost analytics
|
|
155
|
-
- execution health
|
|
156
|
-
- execution logs
|
|
157
|
-
- notifications
|
|
158
|
-
|
|
159
|
-
## Customization Points
|
|
160
|
-
|
|
161
|
-
The main template-owned customization surfaces are:
|
|
162
|
-
|
|
163
|
-
- `ui/src/config/app-config.ts` -- brand name, logos, and app version
|
|
164
|
-
- `ui/src/config/theme.ts` -- theme presets and defaults
|
|
165
|
-
- `ui/src/config/background.tsx` -- shared background treatment
|
|
166
|
-
- `ui/src/config/loader.tsx` -- global loader element
|
|
167
|
-
- `ui/src/config/nav-items.ts` -- app-local nav entries, including the preserved dashboard/home entry
|
|
168
|
-
- `core/config/organization-model.ts` -- product labels, System availability, resource descriptors, semantic surfaces, canonical-to-legacy surface aliases, and quick-access behavior
|
|
169
|
-
- `ui/src/config/README.md` -- the deeper guide for those config files
|
|
170
|
-
|
|
171
|
-
## Customizing System Sidebars
|
|
172
|
-
|
|
173
|
-
The template demonstrates one override pattern in `ui/src/routes/__root.tsx`: it extends `CRM_ITEMS` with a template-owned Reports link and replaces `crmManifest` with `customCrmManifest` in the System module array. The backing route lives at `ui/src/routes/crm/reports.tsx` -- delete both the nav item and the route if you don't need them.
|
|
174
|
-
|
|
175
|
-
Two customization layers are available for every shared System sidebar:
|
|
176
|
-
|
|
177
|
-
1. **Nav-item shortcut (`items` prop)** -- when you just need to swap or extend the nav array, spread the published items constant and pass the result to `*SidebarMiddle`. The template's CRM customization uses this path.
|
|
178
|
-
|
|
179
|
-
```tsx
|
|
180
|
-
import { crmManifest, CrmSidebar, CrmSidebarMiddle, CRM_ITEMS } from '@elevasis/ui/features/crm'
|
|
181
|
-
import type { NavItem } from '@elevasis/ui/layout'
|
|
182
|
-
|
|
183
|
-
const customItems: NavItem[] = [...CRM_ITEMS, { label: 'Reports', to: '/crm/reports', icon: IconFileText, exact: false }]
|
|
184
|
-
const CustomCrmSidebar = () => <CrmSidebar><CrmSidebarMiddle items={customItems} /></CrmSidebar>
|
|
185
|
-
const customCrmManifest = { ...crmManifest, sidebar: CustomCrmSidebar }
|
|
186
|
-
```
|
|
187
|
-
|
|
188
|
-
2. **Compose-primitives (structural changes)** -- when you need to inject panels, reorder sections, or add a new section, drop down to `CrmSidebarTop` + `SubshellNavList` + `SubshellSidebarSection` + published panels (`MyTasksPanel`, `QuickCreateActions`) and compose your own Middle.
|
|
189
|
-
|
|
190
|
-
`manifest.sidebar` accepts any component, so arbitrary customization is always available. The `items` prop is an abstraction barrier for the common case, not a limit.
|
|
191
|
-
|
|
192
|
-
See `node_modules/@elevasis/sdk/reference/scaffold/ui/customization.md` for the decision tree, page-wrapping pattern, and delivery's three-section variant. For broader CRM extension work across pages, hooks, actions, workflows, and org-model boundaries, start with `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-crm.md`. For broader lead-gen extension work across pages, hooks, list/member state, artifacts, workflows, and org-model boundaries, start with `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-lead-gen.md`. See `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md` for `NavItem`, `SystemModule`, CRM platform primitives, Lead Gen platform primitives, and related TypeScript shapes.
|
|
193
|
-
|
|
194
|
-
For CRM deal action buttons, read `node_modules/@elevasis/sdk/reference/scaffold/recipes/customize-crm-actions.md` before changing `crmActions`, `DealDetailPage`, `DealDrawer`, or custom workflow buttons. Start with the shared `crmActions` provider path for action visibility, labels, ordering, and render-time configuration. In v1, platform-known/default action endpoint behavior is server-constrained; use project-owned UI that calls the workflow directly when a custom key sits outside that server-dispatched set.
|
|
195
|
-
|
|
196
|
-
## Notes
|
|
197
|
-
|
|
198
|
-
- `ui/src/routeTree.gen.ts` is generated by TanStack Router tooling. Do not hand-edit it.
|
|
199
|
-
- The template ships a broad route surface so downstream projects can trim or reshape features without having to re-derive the shared shell contract from scratch.
|
|
200
|
-
- For package-export discovery, glob `node_modules/@elevasis/sdk/reference/` or `node_modules/@repo/ui/dist/` for the current SDK/UI package surface.
|
|
1
|
+
---
|
|
2
|
+
description: UI shell, route structure, auth flow, API access, and template customization points for the ui/ surface
|
|
3
|
+
paths:
|
|
4
|
+
- ui/**
|
|
5
|
+
---
|
|
6
|
+
|
|
7
|
+
# UI Features
|
|
8
|
+
|
|
9
|
+
**Status:** Stable
|
|
10
|
+
|
|
11
|
+
## App Shell Overview
|
|
12
|
+
|
|
13
|
+
The template frontend is a React 19 + TanStack Router app that composes a local dashboard shell with published System modules from `@elevasis/ui`.
|
|
14
|
+
|
|
15
|
+
The main join points are:
|
|
16
|
+
|
|
17
|
+
- `ui/src/main.tsx` -- boots the app with `ElevasisUIProvider`, query client, theme config, WorkOS AuthKit, notifications, and the generated route tree
|
|
18
|
+
- `ui/src/routes/__root.tsx` -- composes the authenticated shell with `ElevasisSystemsProvider`, published System modules, app-local dashboard nav, shell runtime dependencies, and `SystemShell`
|
|
19
|
+
- `ui/src/config/nav-items.ts` -- keeps the host-local dashboard entry separate from the published feature manifests
|
|
20
|
+
- `core/config/organization-model.ts` -- is the template's semantic source of truth, adapting `@elevasis/core/organization-model` into the preserved branding, dashboard label, quick-access, System labels, resource descriptors, and shell helpers
|
|
21
|
+
|
|
22
|
+
Published System modules mounted by the template shell:
|
|
23
|
+
|
|
24
|
+
- `lead-gen`
|
|
25
|
+
- `crm`
|
|
26
|
+
- `delivery` at `/projects`
|
|
27
|
+
- `operations`
|
|
28
|
+
- `monitoring`
|
|
29
|
+
- `settings`
|
|
30
|
+
|
|
31
|
+
Important distinction:
|
|
32
|
+
|
|
33
|
+
- shared modules gate on current org-model System keys such as `sales.lead-gen` and `projects`
|
|
34
|
+
- template routes and local nav may still use legacy aliases such as `crm`, `lead-gen`, and `projects`
|
|
35
|
+
- `core/config/organization-model.ts` and `ui/src/lib/hooks/useFeatureAccess.ts` are the bridge between those two vocabularies
|
|
36
|
+
|
|
37
|
+
Dashboard remains a host-local route at `/`, not a shared feature manifest.
|
|
38
|
+
|
|
39
|
+
This template should be treated as the downstream reference implementation for this composition:
|
|
40
|
+
|
|
41
|
+
- `core/config/organization-model.ts` owns the organization/runtime semantics
|
|
42
|
+
- `ui/src/config/nav-items.ts` preserves the host-local dashboard entry instead of pushing that concern into shared manifests
|
|
43
|
+
- `ui/src/routes/__root.tsx` threads `canonicalOrganizationModel` from `@core/config/organization-model` into `ElevasisSystemsProvider` so the shared shell/runtime uses the same semantic source of truth as the local template helpers
|
|
44
|
+
- host-local customizations still stay local: dashboard remains app-owned nav, branding stays in app config, and quick-access/dashboard UX stays in the template app
|
|
45
|
+
|
|
46
|
+
## Auth and Initialization
|
|
47
|
+
|
|
48
|
+
The app uses WorkOS AuthKit through `ElevasisUIProvider`. Authentication is enforced by the local `ProtectedRoute` wrapper in `ui/src/features/auth/ProtectedRoute.tsx`.
|
|
49
|
+
|
|
50
|
+
**Sign-in flow:**
|
|
51
|
+
|
|
52
|
+
1. Unauthenticated user hits a protected route -- `ProtectedRoute` redirects to `/login?returnTo=<path>`
|
|
53
|
+
2. `/login` renders a sign-in card; user clicks Sign In, triggering `signIn({ returnTo })` from `useAuth()`
|
|
54
|
+
3. User authenticates on the WorkOS-hosted sign-in page
|
|
55
|
+
4. WorkOS redirects back to `/auth-redirect` -- `ui/src/routes/auth-redirect.tsx` waits for auth to complete, then navigates to the requested path or `/`
|
|
56
|
+
5. User lands on the home page, fully authenticated
|
|
57
|
+
|
|
58
|
+
**Route protection:**
|
|
59
|
+
|
|
60
|
+
Wrap protected route components with the local `ProtectedRoute` from `@/features/auth`, which adds the full-screen loader and delegates to the shared guard from `@elevasis/ui/auth`:
|
|
61
|
+
|
|
62
|
+
```tsx
|
|
63
|
+
import { ProtectedRoute } from '@/features/auth'
|
|
64
|
+
|
|
65
|
+
function HomePageGuarded() {
|
|
66
|
+
return (
|
|
67
|
+
<ProtectedRoute>
|
|
68
|
+
<HomePage />
|
|
69
|
+
</ProtectedRoute>
|
|
70
|
+
)
|
|
71
|
+
}
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
**Initialization state:**
|
|
75
|
+
|
|
76
|
+
Use `useInitialization()` from `@elevasis/ui/initialization` anywhere inside the app to read aggregated auth + org readiness:
|
|
77
|
+
|
|
78
|
+
```ts
|
|
79
|
+
const { allReady, userReady, isInitializing, error, retry, profile } = useInitialization()
|
|
80
|
+
```
|
|
81
|
+
|
|
82
|
+
**Organization context:**
|
|
83
|
+
|
|
84
|
+
Use `useOrganization()` from `@elevasis/ui/organization` to access org-scoped IDs and memberships:
|
|
85
|
+
|
|
86
|
+
```ts
|
|
87
|
+
const { currentWorkOSOrganizationId, currentSupabaseOrganizationId, memberships, switchOrganization } = useOrganization()
|
|
88
|
+
```
|
|
89
|
+
|
|
90
|
+
## API and Streaming
|
|
91
|
+
|
|
92
|
+
Use `useApiClient()` from `@/lib/hooks/useApiClient` in route components and feature hooks:
|
|
93
|
+
|
|
94
|
+
```ts
|
|
95
|
+
const { apiRequest, isOrganizationReady } = useApiClient()
|
|
96
|
+
const data = await apiRequest('/executions', { method: 'GET' })
|
|
97
|
+
```
|
|
98
|
+
|
|
99
|
+
The template also re-exports `useApiClientContext()` and the shared API client types from `@/lib/hooks/useApiClient`.
|
|
100
|
+
|
|
101
|
+
For real-time updates, feature surfaces use the local singleton wrapper:
|
|
102
|
+
|
|
103
|
+
```ts
|
|
104
|
+
import { sseConnectionManager } from '@/lib/sse/SSEConnectionManager'
|
|
105
|
+
```
|
|
106
|
+
|
|
107
|
+
**WorkOS config:**
|
|
108
|
+
|
|
109
|
+
WorkOS `clientId`, `redirectUri`, and `signoutUri` are hardcoded in `ui/src/config/workos.ts` -- no UI env vars are required to run the template. Edit that file if a fork needs a different WorkOS client. The dev server runs on port `4300` with Vite `strictPort: true`, so a second `pnpm -C ui dev` on the same machine fails fast instead of drifting.
|
|
110
|
+
|
|
111
|
+
The API URL is centralized in `ui/src/lib/constants/api.ts`. In the current template it is hard-coded to `https://api.elevasis.io`, so if the bootstrap is repointed to another API target, that file is the source of truth.
|
|
112
|
+
|
|
113
|
+
## Route Structure
|
|
114
|
+
|
|
115
|
+
Current top-level app sections:
|
|
116
|
+
|
|
117
|
+
- `/` -- host-local dashboard entrypoint with quick links derived from `organizationModel.navigation.quickAccessSurfaceIds`
|
|
118
|
+
- `/lead-gen/*` -- lead generation pages (`lists`, `companies`, `contacts`)
|
|
119
|
+
- `/crm/*` -- CRM overview, pipeline, and deals
|
|
120
|
+
- `/projects/*` -- delivery feature pages (projects, milestones, tasks, notes)
|
|
121
|
+
- `/operations/*` -- operations overview, resources, command queue, command view, sessions, task scheduler
|
|
122
|
+
- `/monitoring/*` -- execution logs, execution health, activity log, cost analytics, notifications
|
|
123
|
+
- `/settings/*` -- account, organization, credentials, API keys, deployments, webhooks, and appearance
|
|
124
|
+
- `/login` and `/auth-redirect` -- auth entry/callback routes
|
|
125
|
+
|
|
126
|
+
Section guards currently follow this pattern:
|
|
127
|
+
|
|
128
|
+
- `ProtectedRoute` for all authenticated sections
|
|
129
|
+
- `SystemGuard` on sections that should hard-stop when a System is disabled: `crm`, `lead-gen`, `projects`, `operations`, and `monitoring`
|
|
130
|
+
- provider-level shell gating for shared System nav and sub-shell behavior
|
|
131
|
+
|
|
132
|
+
The app shell in `__root.tsx` derives visible nav from `shellModel.systems` and `getSidebarLinks()`, filters admin-only entries locally using the signed-in profile, and passes `canonicalOrganizationModel` into `ElevasisSystemsProvider` so shared nav labels, paths, and graph runtime behavior resolve from the same organization-model semantic source.
|
|
133
|
+
|
|
134
|
+
## Dashboard and Feature Areas
|
|
135
|
+
|
|
136
|
+
**Dashboard**
|
|
137
|
+
|
|
138
|
+
`ui/src/features/dashboard/components/Dashboard.tsx` is intentionally lightweight. It acts as the host-owned landing page and renders quick access cards for the most important organization surfaces instead of duplicating the shared operations overview.
|
|
139
|
+
|
|
140
|
+
**Operations**
|
|
141
|
+
|
|
142
|
+
The operations area is the richest shared shell in the template. It includes:
|
|
143
|
+
|
|
144
|
+
- resource inventory and detail pages
|
|
145
|
+
- command queue and command view
|
|
146
|
+
- sessions screens
|
|
147
|
+
- the shared operations overview at `/operations/`
|
|
148
|
+
|
|
149
|
+
**Monitoring**
|
|
150
|
+
|
|
151
|
+
Monitoring is scaffolded as a shared feature area with route files for:
|
|
152
|
+
|
|
153
|
+
- activity log
|
|
154
|
+
- cost analytics
|
|
155
|
+
- execution health
|
|
156
|
+
- execution logs
|
|
157
|
+
- notifications
|
|
158
|
+
|
|
159
|
+
## Customization Points
|
|
160
|
+
|
|
161
|
+
The main template-owned customization surfaces are:
|
|
162
|
+
|
|
163
|
+
- `ui/src/config/app-config.ts` -- brand name, logos, and app version
|
|
164
|
+
- `ui/src/config/theme.ts` -- theme presets and defaults
|
|
165
|
+
- `ui/src/config/background.tsx` -- shared background treatment
|
|
166
|
+
- `ui/src/config/loader.tsx` -- global loader element
|
|
167
|
+
- `ui/src/config/nav-items.ts` -- app-local nav entries, including the preserved dashboard/home entry
|
|
168
|
+
- `core/config/organization-model.ts` -- product labels, System availability, resource descriptors, semantic surfaces, canonical-to-legacy surface aliases, and quick-access behavior
|
|
169
|
+
- `ui/src/config/README.md` -- the deeper guide for those config files
|
|
170
|
+
|
|
171
|
+
## Customizing System Sidebars
|
|
172
|
+
|
|
173
|
+
The template demonstrates one override pattern in `ui/src/routes/__root.tsx`: it extends `CRM_ITEMS` with a template-owned Reports link and replaces `crmManifest` with `customCrmManifest` in the System module array. The backing route lives at `ui/src/routes/crm/reports.tsx` -- delete both the nav item and the route if you don't need them.
|
|
174
|
+
|
|
175
|
+
Two customization layers are available for every shared System sidebar:
|
|
176
|
+
|
|
177
|
+
1. **Nav-item shortcut (`items` prop)** -- when you just need to swap or extend the nav array, spread the published items constant and pass the result to `*SidebarMiddle`. The template's CRM customization uses this path.
|
|
178
|
+
|
|
179
|
+
```tsx
|
|
180
|
+
import { crmManifest, CrmSidebar, CrmSidebarMiddle, CRM_ITEMS } from '@elevasis/ui/features/crm'
|
|
181
|
+
import type { NavItem } from '@elevasis/ui/layout'
|
|
182
|
+
|
|
183
|
+
const customItems: NavItem[] = [...CRM_ITEMS, { label: 'Reports', to: '/crm/reports', icon: IconFileText, exact: false }]
|
|
184
|
+
const CustomCrmSidebar = () => <CrmSidebar><CrmSidebarMiddle items={customItems} /></CrmSidebar>
|
|
185
|
+
const customCrmManifest = { ...crmManifest, sidebar: CustomCrmSidebar }
|
|
186
|
+
```
|
|
187
|
+
|
|
188
|
+
2. **Compose-primitives (structural changes)** -- when you need to inject panels, reorder sections, or add a new section, drop down to `CrmSidebarTop` + `SubshellNavList` + `SubshellSidebarSection` + published panels (`MyTasksPanel`, `QuickCreateActions`) and compose your own Middle.
|
|
189
|
+
|
|
190
|
+
`manifest.sidebar` accepts any component, so arbitrary customization is always available. The `items` prop is an abstraction barrier for the common case, not a limit.
|
|
191
|
+
|
|
192
|
+
See `node_modules/@elevasis/sdk/reference/scaffold/ui/customization.md` for the decision tree, page-wrapping pattern, and delivery's three-section variant. For broader CRM extension work across pages, hooks, actions, workflows, and org-model boundaries, start with `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-crm.md`. For broader lead-gen extension work across pages, hooks, list/member state, artifacts, workflows, and org-model boundaries, start with `node_modules/@elevasis/sdk/reference/scaffold/recipes/extend-lead-gen.md`. See `node_modules/@elevasis/sdk/reference/scaffold/reference/contracts.md` for `NavItem`, `SystemModule`, CRM platform primitives, Lead Gen platform primitives, and related TypeScript shapes.
|
|
193
|
+
|
|
194
|
+
For CRM deal action buttons, read `node_modules/@elevasis/sdk/reference/scaffold/recipes/customize-crm-actions.md` before changing `crmActions`, `DealDetailPage`, `DealDrawer`, or custom workflow buttons. Start with the shared `crmActions` provider path for action visibility, labels, ordering, and render-time configuration. In v1, platform-known/default action endpoint behavior is server-constrained; use project-owned UI that calls the workflow directly when a custom key sits outside that server-dispatched set.
|
|
195
|
+
|
|
196
|
+
## Notes
|
|
197
|
+
|
|
198
|
+
- `ui/src/routeTree.gen.ts` is generated by TanStack Router tooling. Do not hand-edit it.
|
|
199
|
+
- The template ships a broad route surface so downstream projects can trim or reshape features without having to re-derive the shared shell contract from scratch.
|
|
200
|
+
- For package-export discovery, glob `node_modules/@elevasis/sdk/reference/` or `node_modules/@repo/ui/dist/` for the current SDK/UI package surface.
|