@odla-ai/chapter 0.21.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -8,7 +8,7 @@ email. The host still builds the public pages, routing, and brand presentation;
8
8
  Chapter supplies their application mechanics.
9
9
 
10
10
  ```sh
11
- npm i --save-exact @odla-ai/chapter@0.21.0
11
+ npm i --save-exact @odla-ai/chapter@0.22.0
12
12
  ```
13
13
 
14
14
  > **Agentic experiment.** Built and maintained by AI agents from bounded runbooks
@@ -365,10 +365,76 @@ The default chapter console deliberately has only three top-level workspaces:
365
365
  Connections, Access, and Sharing record tabs when those capabilities apply.
366
366
  - **Settings** — Calendar and Email page tabs.
367
367
 
368
- Use `chrome="editorial"` (the default), `chrome="none"` when the host supplies
369
- its own site header, or `renderHeader` for a fully custom header. The deprecated
370
- `chrome="topbar"` and `sections` APIs remain available for migration, but do
371
- not add operational detail back to the global site navigation.
368
+ The default `chrome="embedded"` assumes the host supplies the site header.
369
+ Use `chrome="standalone"` for Chapter's packaged masthead or `renderHeader` for
370
+ a custom header rendered inside the Chapter theme boundary. `editorial`,
371
+ `none`, `topbar`, and `sections` remain compatibility APIs. Do not add
372
+ operational detail back to the global site navigation.
373
+
374
+ Only the active workspace, page tab, and record tab mount their content.
375
+ Inactive operational panels therefore do not fetch, subscribe, or run effects.
376
+ Their native anchors remain in the document, so every level is still
377
+ reloadable and participates in browser back/forward navigation.
378
+
379
+ #### Preserve an existing People structure
380
+
381
+ The responsive state and data loading belong to `@odla-ai/crm`; the branded
382
+ summary, master rail, record heading, and specialized panels can remain
383
+ host-owned:
384
+
385
+ ```tsx
386
+ const people = collectionSection({
387
+ crm: chapter.crm,
388
+ type: "person",
389
+ lifecycle: true,
390
+ renderSummary: ({ query }) => (
391
+ <PeopleSummary total={query.page?.total ?? 0} />
392
+ ),
393
+ renderMaster: ({ defaultMaster }) => (
394
+ <PeopleRail>{defaultMaster}</PeopleRail>
395
+ ),
396
+ renderDetailHeader: ({ detail }) => (
397
+ <RecordHeading record={detail.record} />
398
+ ),
399
+ extendRecordTabs: (tabs, context) => replaceRecordPanels(tabs, context),
400
+ });
401
+ ```
402
+
403
+ `renderMaster` receives the loaded query, selection helpers, native record-link
404
+ builder, and `defaultMaster`, so a host may wrap the standard list or replace
405
+ its presentation without taking over fetching. `extendRecordTabs` supports
406
+ per-record `visible` and `disabled` predicates. Hidden panels do not mount.
407
+
408
+ For `lifecycle: true`, Chapter routes stage transitions through the
409
+ application-authoritative approve/refund/manual-transition endpoints and
410
+ requires that adapter. A custom operational collection can pass
411
+ `lifecycleAdapter`; generic CRM collections continue to use the CRM mutation.
412
+
413
+ #### Adapt existing authentication routes
414
+
415
+ An existing site does not need to rename its config or current-user endpoints:
416
+
417
+ ```tsx
418
+ <ChapterAdmin
419
+ chapter={chapter}
420
+ auth={{
421
+ configPath: "/api/auth/config",
422
+ mapConfig: (body) => ({
423
+ publishableKey: typeof body.publishableKey === "string"
424
+ ? body.publishableKey
425
+ : null,
426
+ }),
427
+ mapCurrentUser: (body) => ({
428
+ ...body,
429
+ authorized: body.role === "admin" || body.superAdmin === true,
430
+ }),
431
+ }}
432
+ />
433
+ ```
434
+
435
+ `loadConfig` and `loadCurrentUser` may replace fetching entirely. The normalized
436
+ current-user object is also available to workspace renderers for presentation
437
+ decisions; server authorization remains authoritative.
372
438
 
373
439
  When upgrading a flat console:
374
440
 
@@ -377,11 +443,14 @@ When upgrading a flat console:
377
443
  2. Remove top-level Billing, Email, Calendar, or collection links that duplicate
378
444
  the standard nested tabs.
379
445
  3. Replace `sections` with `workspaces`, or omit it to accept the defaults.
380
- 4. Remove host-owned record drawers and compose extra operations with
381
- `collectionSection` or CRM `extendRecordTabs`.
382
- 5. Change generated links to `adminRouteHref`; keep legacy query/path URLs only
446
+ 4. Move host-owned summaries, master rails, and record headings into
447
+ `collectionSection` render slots; compose specialized operations with
448
+ `extendRecordTabs`.
449
+ 5. Connect application-backed stage changes through `lifecycleAdapter`; never
450
+ replace an operational transition with a raw CRM stage write.
451
+ 6. Change generated links to `adminRouteHref`; keep legacy query/path URLs only
383
452
  as inbound compatibility links.
384
- 6. Verify refresh, back/forward navigation, keyboard tab behavior, mobile
453
+ 7. Verify refresh, back/forward navigation, keyboard tab behavior, mobile
385
454
  list/detail switching, and brand containment before deleting old routes.
386
455
 
387
456
  ## Adopting into an existing site
@@ -513,7 +582,7 @@ These bite silently — a smoke test won't catch them:
513
582
  invitation mail. Importing the full `@odla-ai/chapter/ui` barrel pulls the admin
514
583
  half, so prefer the narrower entry.
515
584
  - **Known-good application set** (installs clean, no flags):
516
- `@odla-ai/chapter` 0.21.0, `@odla-ai/ui` 0.11.0, `@odla-ai/crm` 0.2.0,
585
+ `@odla-ai/chapter` 0.22.0, `@odla-ai/ui` 0.12.0, `@odla-ai/crm` 0.3.0,
517
586
  `@odla-ai/db` 0.6.6,
518
587
  `@odla-ai/calendar` 0.2.0, `@odla-ai/email` 0.3.1,
519
588
  `@odla-ai/auth-clerk` 0.4.0, `@odla-ai/o11y` 2.2.2, `jose` 6.2.3, React