@brendanbank/atrium-host-types 0.16.1 → 0.18.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
@@ -32,8 +32,8 @@ your `.npmrc`, delete it — npmjs.org is the default registry.
32
32
 
33
33
  ## Versioning
34
34
 
35
- The package version tracks atrium's image version. Pin `^0.16` for
36
- "compatible with atrium 0.16.x"; bump together with the atrium image
35
+ The package version tracks atrium's image version. Pin `^0.18` for
36
+ "compatible with atrium 0.18.x"; bump together with the atrium image
37
37
  to pick up new registry slots. New slots land as **optional** members
38
38
  on `AtriumRegistry` first so a host that hasn't bumped yet still
39
39
  type-checks.
package/dist/index.d.ts CHANGED
@@ -44,6 +44,33 @@ export interface AdminUserRow {
44
44
  role_ids: number[];
45
45
  roles: string[];
46
46
  }
47
+ /** Detail payload of the ``atrium:userchange`` window CustomEvent
48
+ * atrium dispatches whenever the signed-in user identity changes —
49
+ * login, logout, logout-all, impersonation start/stop, same-tab
50
+ * re-login as a different user. ``previous`` and ``current`` are user
51
+ * ids; ``null`` means signed out (or, for ``previous``, transitioning
52
+ * out of the signed-out state). ``nonce`` is a monotonic per-event
53
+ * counter. The event does NOT fire on first identity observation
54
+ * after a page load (the user has not changed).
55
+ *
56
+ * Available since atrium 0.18. The canonical use is host bundles
57
+ * clearing their own QueryClient cache when the user changes — atrium
58
+ * clears its own cache via ``qc.clear()`` on logout, but a host bundle
59
+ * runs a separate QueryClient (by design — see
60
+ * ``@brendanbank/atrium-host-bundle-utils/react``) and needs an
61
+ * external signal:
62
+ *
63
+ * ```ts
64
+ * window.addEventListener('atrium:userchange', () => {
65
+ * hostQueryClient.clear();
66
+ * });
67
+ * ```
68
+ */
69
+ export interface AtriumUserChangeDetail {
70
+ previous: number | null;
71
+ current: number | null;
72
+ nonce: number;
73
+ }
47
74
  /** A single notification row as the SPA sees it. `kind` is host-defined;
48
75
  * `payload` is opaque JSON. `read_at` is null until the user clears the
49
76
  * bell; `created_at` is the server-side timestamp. */
@@ -107,6 +134,13 @@ export interface NavItem {
107
134
  * Notifications and Admin. Available since atrium 0.16. */
108
135
  order?: number;
109
136
  }
137
+ /** Sidebar bucket an admin tab lives in. `admin` is the default and
138
+ * groups every atrium-shipped admin surface plus host admin tooling.
139
+ * `settings` is a parallel sibling group above Admin reserved for
140
+ * application-level preferences — atrium ships zero items here, so
141
+ * the Settings parent hides entirely until a host registers into it.
142
+ * Available since atrium 0.17. */
143
+ export type AdminSection = 'admin' | 'settings';
110
144
  export interface AdminTab {
111
145
  key: string;
112
146
  label: string;
@@ -114,17 +148,22 @@ export interface AdminTab {
114
148
  /** Permission code; the tab is hidden for users without it. Omit to
115
149
  * show the tab to every viewer with admin access. */
116
150
  perm?: string;
151
+ /** Sidebar bucket. Default `'admin'`. Set `'settings'` to push a
152
+ * host-app preference page into the Settings group instead.
153
+ * Available since atrium 0.17. */
154
+ section?: AdminSection;
117
155
  /** Returns a fresh element each time the tab is selected. Strongly
118
156
  * preferred — see `RouteEntry.render`. Exactly one of `render` /
119
157
  * `element` must be supplied. */
120
158
  render?: () => ReactElement;
121
159
  /** @deprecated Pass `render: () => element` instead. */
122
160
  element?: ReactElement;
123
- /** Optional sort key. Lower values render further left. Items
124
- * without `order` keep registration order, sorted **after** every
125
- * item that has one. Atrium's built-in tabs use 100..900 in steps
126
- * of 100; a host tab with `order: 750` would slot between Email
127
- * templates (700) and Reminders (800). Available since atrium 0.16. */
161
+ /** Optional sort key. Lower values render higher in the sidebar
162
+ * group. Items without `order` keep registration order, sorted
163
+ * **after** every item that has one. Atrium's built-in admin tabs
164
+ * use 100..900 in steps of 100; a host tab with `order: 750`
165
+ * would slot between Email templates (700) and Reminders (800).
166
+ * Available since atrium 0.16. */
128
167
  order?: number;
129
168
  }
130
169
  /** Insertion slot inside `ProfilePage`'s vertical card stack. Default
@@ -188,6 +227,13 @@ export interface AtriumRegistry {
188
227
  registerRoute: (route: RouteEntry) => void;
189
228
  registerNavItem: (item: NavItem) => void;
190
229
  registerAdminTab: (tab: AdminTab) => void;
230
+ /** Relocate one of atrium's built-in admin tabs into a different
231
+ * sidebar group, and optionally re-rank it within that group. Pass
232
+ * the tab's stable atrium key (e.g. `'branding'`, `'emails'`,
233
+ * `'outbox'`, `'reminders'`, `'translations'`); the perm gate the
234
+ * built-in already declares is preserved. Available since atrium
235
+ * 0.17. */
236
+ setBuiltinAdminTabSection?: (key: string, section: AdminSection, order?: number) => void;
191
237
  registerProfileItem: (item: ProfileItem) => void;
192
238
  registerNotificationKind: (renderer: NotificationKindRenderer) => void;
193
239
  registerLocale: (overlay: LocaleOverlay) => void;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brendanbank/atrium-host-types",
3
- "version": "0.16.1",
3
+ "version": "0.18.0",
4
4
  "description": "TypeScript declarations for the atrium host-extension contract: AtriumRegistry, UserContext, AdminUserRow, AtriumNotification, AtriumEvent. Source-of-truth shapes a host bundle types against, kept in sync with atrium's published image major.minor.",
5
5
  "license": "BSD-2-Clause",
6
6
  "type": "module",