@brendanbank/atrium-host-bundle-utils 0.15.1 → 0.15.3

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
@@ -79,7 +79,7 @@ function CommissionsPage() {
79
79
  function App() {
80
80
  return (
81
81
  <QueryClientProvider client={hostQueryClient}>
82
- <AtriumProvider apiBase="/api">
82
+ <AtriumProvider>
83
83
  <CommissionsPage />
84
84
  </AtriumProvider>
85
85
  </QueryClientProvider>
@@ -87,10 +87,13 @@ function App() {
87
87
  }
88
88
  ```
89
89
 
90
- `<AtriumProvider>` reads from your existing `<QueryClientProvider>`
91
- by default — no second QueryClient. Pass `client={hostQueryClient}`
92
- to wrap one inline; pass `fetchUserContext={...}` to inject a custom
93
- fetcher (useful for tests or hosts that want axios-shaped retry).
90
+ The hooks fetch atrium's fixed same-origin `/users/me/context`
91
+ endpoint — no path is configurable, since a host bundle loads inside
92
+ atrium's SPA and hits the same origin. `<AtriumProvider>` reads from
93
+ your existing `<QueryClientProvider>` by default — no second
94
+ QueryClient. Pass `client={hostQueryClient}` to wrap one inline; pass
95
+ `fetchUserContext={...}` to inject a custom fetcher (useful for tests
96
+ or hosts that want axios-shaped retry).
94
97
 
95
98
  ## Versioning
96
99
 
@@ -4,9 +4,13 @@
4
4
  * One TanStack Query subscription serves the whole host tree:
5
5
  * `useMe()` fetches `/users/me/context` once and shares the result
6
6
  * with every `usePerm()`, `useRole()`, and `useUserContext()` caller.
7
- * The hooks read the API base URL from `<AtriumProvider>` (default
8
- * `'/api'`) so a host serving its bundle on a different prefix can
9
- * point them at the right origin without forking the package.
7
+ *
8
+ * The endpoint path is fixed by atrium — it's mounted at the SPA root
9
+ * by `app.include_router(me_context_router)` and served from the same
10
+ * origin as the bundle. There's no `apiBase` prop because there's
11
+ * nothing for the host to configure: a host bundle that loads inside
12
+ * atrium's SPA fetches a same-origin relative path. Hosts that want
13
+ * to layer their own retry / headers / mock can pass `fetchUserContext`.
10
14
  *
11
15
  * The hooks reuse the host's enclosing `<QueryClientProvider>` if one
12
16
  * is already mounted; pass `client={hostQueryClient}` to
@@ -21,14 +25,9 @@ import type { UserContext } from '@brendanbank/atrium-host-types';
21
25
  export type { UserContext } from '@brendanbank/atrium-host-types';
22
26
  export { __atrium_t__ } from '../i18n';
23
27
  interface AtriumContextValue {
24
- apiBase: string;
25
28
  fetchUserContext: () => Promise<UserContext | null>;
26
29
  }
27
30
  export interface AtriumProviderProps {
28
- /** API base URL the hooks prefix on every fetch. Default `'/api'` —
29
- * matches atrium's convention of mounting the API behind `/api/*`
30
- * on the same origin as the SPA. */
31
- apiBase?: string;
32
31
  /** Optional TanStack QueryClient. When supplied the provider wraps
33
32
  * children in a `<QueryClientProvider>`; otherwise the hooks
34
33
  * inherit the caller's enclosing one. Use this only when the host
@@ -41,11 +40,11 @@ export interface AtriumProviderProps {
41
40
  fetchUserContext?: () => Promise<UserContext | null>;
42
41
  children: ReactNode;
43
42
  }
44
- /** Provider that supplies `apiBase` and (optionally) a QueryClient
45
- * to the atrium hooks below. Hosts that already wrap their tree in
46
- * `<QueryClientProvider>` can omit `client` — the hooks use the
43
+ /** Provider that supplies the atrium hooks below with their fetcher
44
+ * and (optionally) a QueryClient. Hosts that already wrap their tree
45
+ * in `<QueryClientProvider>` can omit `client` — the hooks use the
47
46
  * caller's existing QueryClient. */
48
- export declare function AtriumProvider({ apiBase, client, fetchUserContext, children, }: AtriumProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<AtriumContextValue | null>> | import("react").FunctionComponentElement<import("@tanstack/react-query").QueryClientProviderProps>;
47
+ export declare function AtriumProvider({ client, fetchUserContext, children, }: AtriumProviderProps): import("react").FunctionComponentElement<import("react").ProviderProps<AtriumContextValue | null>> | import("react").FunctionComponentElement<import("@tanstack/react-query").QueryClientProviderProps>;
49
48
  /** Stable cache key for the `/users/me/context` query. Exported so
50
49
  * hosts can `queryClient.invalidateQueries({ queryKey: ME_QUERY_KEY })`
51
50
  * after a flow that changed the user's roles or permissions. */
@@ -84,4 +83,49 @@ export declare function usePerm(): (code: string) => boolean;
84
83
  /** Convenience: does the signed-in user hold the named role? Returns
85
84
  * `false` while loading and when signed out, mirroring `usePerm`. */
86
85
  export declare function useRole(code: string): boolean;
86
+ /** Snapshot of atrium's current router location, mirrored on
87
+ * `window.location`. The fields match react-router's `Location` shape
88
+ * so a host already familiar with `useLocation()` reads the same
89
+ * contract here. */
90
+ export type AtriumLocation = {
91
+ pathname: string;
92
+ search: string;
93
+ hash: string;
94
+ };
95
+ /** Subscribe to atrium's react-router location changes from inside a
96
+ * host bundle's React tree. Returns `{ pathname, search, hash }`
97
+ * mirroring `window.location`, and re-renders the calling component
98
+ * whenever atrium navigates — including in-place navigations
99
+ * (`navigate('/?focus=booking:42')` while already on `/`) where the
100
+ * host's wrapper element doesn't remount.
101
+ *
102
+ * Bridges the `atrium:locationchange` CustomEvent atrium dispatches
103
+ * on `window` through `useSyncExternalStore`, so multiple subscribers
104
+ * in the same tree share one event listener and the snapshot is
105
+ * referentially stable when nothing changed.
106
+ *
107
+ * ```tsx
108
+ * function FocusDrawer() {
109
+ * const { search } = useAtriumLocation();
110
+ * const focus = new URLSearchParams(search).get('focus');
111
+ * return focus ? <BookingDetail id={focus} /> : null;
112
+ * }
113
+ * ```
114
+ *
115
+ * Hosts that don't use React (or want to handle navigation outside a
116
+ * component) can subscribe directly:
117
+ * `window.addEventListener('atrium:locationchange', e => …)`. The
118
+ * event's `detail` carries the same `{pathname, search, hash}` shape.
119
+ *
120
+ * Available on atrium 0.15.3+. On older atrium images the hook still
121
+ * works but only reflects the initial `window.location` — the SPA
122
+ * doesn't dispatch the event, so in-place navigations won't trigger
123
+ * updates. Hosts that need to support pre-0.15.3 atrium can read
124
+ * `window.__ATRIUM_VERSION__` and fall back to `useLocation()` from a
125
+ * wrapper that remounts on route swaps. */
126
+ export declare function useAtriumLocation(): AtriumLocation;
127
+ /** Test-only: drop the cached snapshot so the next `getSnapshot` reads
128
+ * `window.location` fresh. Production code never calls this — the
129
+ * cache is updated by the event subscription. */
130
+ export declare function __resetAtriumLocationCacheForTests(): void;
87
131
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAGA;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EAML,KAAK,SAAS,EACf,MAAM,OAAO,CAAC;AACf,OAAO,EAGL,KAAK,WAAW,EAChB,KAAK,cAAc,EACpB,MAAM,uBAAuB,CAAC;AAE/B,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAElE,YAAY,EAAE,WAAW,EAAE,MAAM,gCAAgC,CAAC;AAClE,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAEvC,UAAU,kBAAkB;IAC1B,OAAO,EAAE,MAAM,CAAC;IAChB,gBAAgB,EAAE,MAAM,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;CACrD;AAqBD,MAAM,WAAW,mBAAmB;IAClC;;yCAEqC;IACrC,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB;;;kDAG8C;IAC9C,MAAM,CAAC,EAAE,WAAW,CAAC;IACrB;;;sBAGkB;IAClB,gBAAgB,CAAC,EAAE,MAAM,OAAO,CAAC,WAAW,GAAG,IAAI,CAAC,CAAC;IACrD,QAAQ,EAAE,SAAS,CAAC;CACrB;AAED;;;qCAGqC;AACrC,wBAAgB,cAAc,CAAC,EAC7B,OAA0B,EAC1B,MAAM,EACN,gBAAgB,EAChB,QAAQ,GACT,EAAE,mBAAmB,2MAYrB;AAED;;iEAEiE;AACjE,eAAO,MAAM,YAAY,2BAA4B,CAAC;AAsBtD;;;;;;;;8BAQ8B;AAC9B,wBAAgB,KAAK,IAAI,cAAc,CAAC,WAAW,GAAG,IAAI,CAAC,CAQ1D;AAED;;iBAEiB;AACjB,wBAAgB,cAAc,IAAI,cAAc,CAAC,WAAW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,CAEnE;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,OAAO,IAAI,CAAC,IAAI,EAAE,MAAM,KAAK,OAAO,CAMnD;AAED;sEACsE;AACtE,wBAAgB,OAAO,CAAC,IAAI,EAAE,MAAM,GAAG,OAAO,CAG7C;AAED;;;qBAGqB;AACrB,MAAM,MAAM,cAAc,GAAG;IAC3B,QAAQ,EAAE,MAAM,CAAC;IACjB,MAAM,EAAE,MAAM,CAAC;IACf,IAAI,EAAE,MAAM,CAAC;CACd,CAAC;AA4DF;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4CA8B4C;AAC5C,wBAAgB,iBAAiB,IAAI,cAAc,CAMlD;AAED;;kDAEkD;AAClD,wBAAgB,kCAAkC,IAAI,IAAI,CAEzD"}
@@ -6,9 +6,13 @@
6
6
  * One TanStack Query subscription serves the whole host tree:
7
7
  * `useMe()` fetches `/users/me/context` once and shares the result
8
8
  * with every `usePerm()`, `useRole()`, and `useUserContext()` caller.
9
- * The hooks read the API base URL from `<AtriumProvider>` (default
10
- * `'/api'`) so a host serving its bundle on a different prefix can
11
- * point them at the right origin without forking the package.
9
+ *
10
+ * The endpoint path is fixed by atrium — it's mounted at the SPA root
11
+ * by `app.include_router(me_context_router)` and served from the same
12
+ * origin as the bundle. There's no `apiBase` prop because there's
13
+ * nothing for the host to configure: a host bundle that loads inside
14
+ * atrium's SPA fetches a same-origin relative path. Hosts that want
15
+ * to layer their own retry / headers / mock can pass `fetchUserContext`.
12
16
  *
13
17
  * The hooks reuse the host's enclosing `<QueryClientProvider>` if one
14
18
  * is already mounted; pass `client={hostQueryClient}` to
@@ -17,12 +21,12 @@
17
21
  * intended state — atrium clears its cache on logout via `qc.clear()`,
18
22
  * and a shared client would lose host queries the user still wants.
19
23
  */
20
- import { createContext, createElement, useCallback, useContext, useMemo, } from 'react';
24
+ import { createContext, createElement, useCallback, useContext, useMemo, useSyncExternalStore, } from 'react';
21
25
  import { QueryClientProvider, useQuery, } from '@tanstack/react-query';
22
26
  export { __atrium_t__ } from '../i18n';
23
- const DEFAULT_API_BASE = '/api';
24
- async function defaultFetchUserContext(apiBase) {
25
- const res = await fetch(`${apiBase}/users/me/context`, {
27
+ const ME_CONTEXT_PATH = '/users/me/context';
28
+ async function defaultFetchUserContext() {
29
+ const res = await fetch(ME_CONTEXT_PATH, {
26
30
  credentials: 'include',
27
31
  headers: { Accept: 'application/json' },
28
32
  });
@@ -30,20 +34,17 @@ async function defaultFetchUserContext(apiBase) {
30
34
  return null;
31
35
  if (!res.ok) {
32
36
  const body = await res.text().catch(() => '');
33
- throw new Error(`/users/me/context: ${res.status} ${body}`.trim());
37
+ throw new Error(`${ME_CONTEXT_PATH}: ${res.status} ${body}`.trim());
34
38
  }
35
39
  return (await res.json());
36
40
  }
37
41
  const AtriumContext = createContext(null);
38
- /** Provider that supplies `apiBase` and (optionally) a QueryClient
39
- * to the atrium hooks below. Hosts that already wrap their tree in
40
- * `<QueryClientProvider>` can omit `client` — the hooks use the
42
+ /** Provider that supplies the atrium hooks below with their fetcher
43
+ * and (optionally) a QueryClient. Hosts that already wrap their tree
44
+ * in `<QueryClientProvider>` can omit `client` — the hooks use the
41
45
  * caller's existing QueryClient. */
42
- export function AtriumProvider({ apiBase = DEFAULT_API_BASE, client, fetchUserContext, children, }) {
43
- const value = useMemo(() => {
44
- const fetcher = fetchUserContext ?? (() => defaultFetchUserContext(apiBase));
45
- return { apiBase, fetchUserContext: fetcher };
46
- }, [apiBase, fetchUserContext]);
46
+ export function AtriumProvider({ client, fetchUserContext, children, }) {
47
+ const value = useMemo(() => ({ fetchUserContext: fetchUserContext ?? defaultFetchUserContext }), [fetchUserContext]);
47
48
  const inner = createElement(AtriumContext.Provider, { value }, children);
48
49
  if (client) {
49
50
  return createElement(QueryClientProvider, { client }, inner);
@@ -56,15 +57,12 @@ export function AtriumProvider({ apiBase = DEFAULT_API_BASE, client, fetchUserCo
56
57
  export const ME_QUERY_KEY = ['atrium', 'me'];
57
58
  // Module-level fallback so hooks work without an explicit
58
59
  // `<AtriumProvider>` — convenient for hosts that don't need to
59
- // override the API base or the fetcher. Lazily-allocated so the
60
- // import has no side effects.
60
+ // override the fetcher. Lazily-allocated so the import has no side
61
+ // effects.
61
62
  let DEFAULT_CTX = null;
62
63
  function defaultCtx() {
63
64
  if (!DEFAULT_CTX) {
64
- DEFAULT_CTX = {
65
- apiBase: DEFAULT_API_BASE,
66
- fetchUserContext: () => defaultFetchUserContext(DEFAULT_API_BASE),
67
- };
65
+ DEFAULT_CTX = { fetchUserContext: defaultFetchUserContext };
68
66
  }
69
67
  return DEFAULT_CTX;
70
68
  }
@@ -122,4 +120,97 @@ export function useRole(code) {
122
120
  const { data: me } = useMe();
123
121
  return (me?.roles ?? []).includes(code);
124
122
  }
123
+ const ATRIUM_LOCATION_EVENT = 'atrium:locationchange';
124
+ const SSR_LOCATION = {
125
+ pathname: '/',
126
+ search: '',
127
+ hash: '',
128
+ };
129
+ // Module-level cache so `useSyncExternalStore.getSnapshot` returns a
130
+ // referentially-stable object across renders — re-creating it every
131
+ // call would cause React to tear-loop the subscriber. The cache is
132
+ // refreshed only when an `atrium:locationchange` event lands or, on
133
+ // the first read, lazily from `window.location`.
134
+ let cachedLocation = null;
135
+ function readWindowLocation() {
136
+ if (typeof window === 'undefined')
137
+ return SSR_LOCATION;
138
+ return {
139
+ pathname: window.location.pathname,
140
+ search: window.location.search,
141
+ hash: window.location.hash,
142
+ };
143
+ }
144
+ function getLocationSnapshot() {
145
+ if (cachedLocation === null)
146
+ cachedLocation = readWindowLocation();
147
+ return cachedLocation;
148
+ }
149
+ function getServerLocationSnapshot() {
150
+ return SSR_LOCATION;
151
+ }
152
+ function subscribeLocation(onChange) {
153
+ if (typeof window === 'undefined')
154
+ return () => { };
155
+ const handler = (e) => {
156
+ const detail = e
157
+ .detail;
158
+ if (detail &&
159
+ typeof detail.pathname === 'string' &&
160
+ typeof detail.search === 'string' &&
161
+ typeof detail.hash === 'string') {
162
+ cachedLocation = {
163
+ pathname: detail.pathname,
164
+ search: detail.search,
165
+ hash: detail.hash,
166
+ };
167
+ }
168
+ else {
169
+ cachedLocation = readWindowLocation();
170
+ }
171
+ onChange();
172
+ };
173
+ window.addEventListener(ATRIUM_LOCATION_EVENT, handler);
174
+ return () => window.removeEventListener(ATRIUM_LOCATION_EVENT, handler);
175
+ }
176
+ /** Subscribe to atrium's react-router location changes from inside a
177
+ * host bundle's React tree. Returns `{ pathname, search, hash }`
178
+ * mirroring `window.location`, and re-renders the calling component
179
+ * whenever atrium navigates — including in-place navigations
180
+ * (`navigate('/?focus=booking:42')` while already on `/`) where the
181
+ * host's wrapper element doesn't remount.
182
+ *
183
+ * Bridges the `atrium:locationchange` CustomEvent atrium dispatches
184
+ * on `window` through `useSyncExternalStore`, so multiple subscribers
185
+ * in the same tree share one event listener and the snapshot is
186
+ * referentially stable when nothing changed.
187
+ *
188
+ * ```tsx
189
+ * function FocusDrawer() {
190
+ * const { search } = useAtriumLocation();
191
+ * const focus = new URLSearchParams(search).get('focus');
192
+ * return focus ? <BookingDetail id={focus} /> : null;
193
+ * }
194
+ * ```
195
+ *
196
+ * Hosts that don't use React (or want to handle navigation outside a
197
+ * component) can subscribe directly:
198
+ * `window.addEventListener('atrium:locationchange', e => …)`. The
199
+ * event's `detail` carries the same `{pathname, search, hash}` shape.
200
+ *
201
+ * Available on atrium 0.15.3+. On older atrium images the hook still
202
+ * works but only reflects the initial `window.location` — the SPA
203
+ * doesn't dispatch the event, so in-place navigations won't trigger
204
+ * updates. Hosts that need to support pre-0.15.3 atrium can read
205
+ * `window.__ATRIUM_VERSION__` and fall back to `useLocation()` from a
206
+ * wrapper that remounts on route swaps. */
207
+ export function useAtriumLocation() {
208
+ return useSyncExternalStore(subscribeLocation, getLocationSnapshot, getServerLocationSnapshot);
209
+ }
210
+ /** Test-only: drop the cached snapshot so the next `getSnapshot` reads
211
+ * `window.location` fresh. Production code never calls this — the
212
+ * cache is updated by the event subscription. */
213
+ export function __resetAtriumLocationCacheForTests() {
214
+ cachedLocation = null;
215
+ }
125
216
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/react/index.ts"],"names":[],"mappings":"AAAA,kCAAkC;AAClC,wCAAwC;AAExC;;;;;;;;;;;;;;;;GAgBG;AACH,OAAO,EACL,aAAa,EACb,aAAa,EACb,WAAW,EACX,UAAU,EACV,OAAO,GAER,MAAM,OAAO,CAAC;AACf,OAAO,EACL,mBAAmB,EACnB,QAAQ,GAGT,MAAM,uBAAuB,CAAC;AAK/B,OAAO,EAAE,YAAY,EAAE,MAAM,SAAS,CAAC;AAOvC,MAAM,gBAAgB,GAAG,MAAM,CAAC;AAEhC,KAAK,UAAU,uBAAuB,CACpC,OAAe;IAEf,MAAM,GAAG,GAAG,MAAM,KAAK,CAAC,GAAG,OAAO,mBAAmB,EAAE;QACrD,WAAW,EAAE,SAAS;QACtB,OAAO,EAAE,EAAE,MAAM,EAAE,kBAAkB,EAAE;KACxC,CAAC,CAAC;IACH,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG;QAAE,OAAO,IAAI,CAAC;IAC1D,IAAI,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC;QACZ,MAAM,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,EAAE,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,CAAC,CAAC;QAC9C,MAAM,IAAI,KAAK,CAAC,sBAAsB,GAAG,CAAC,MAAM,IAAI,IAAI,EAAE,CAAC,IAAI,EAAE,CAAC,CAAC;IACrE,CAAC;IACD,OAAO,CAAC,MAAM,GAAG,CAAC,IAAI,EAAE,CAAgB,CAAC;AAC3C,CAAC;AAED,MAAM,aAAa,GAAG,aAAa,CAA4B,IAAI,CAAC,CAAC;AAoBrE;;;qCAGqC;AACrC,MAAM,UAAU,cAAc,CAAC,EAC7B,OAAO,GAAG,gBAAgB,EAC1B,MAAM,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cAAc,GAAG,kBAAkB,EAAE,CAAC;QACxC,CAAC;QACD,QAAQ,EAAE,CAAC;IACb,CAAC,CAAC;IACF,MAAM,CAAC,gBAAgB,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;IACxD,OAAO,GAAG,EAAE,CAAC,MAAM,CAAC,mBAAmB,CAAC,qBAAqB,EAAE,OAAO,CAAC,CAAC;AAC1E,CAAC;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;4CA8B4C;AAC5C,MAAM,UAAU,iBAAiB;IAC/B,OAAO,oBAAoB,CACzB,iBAAiB,EACjB,mBAAmB,EACnB,yBAAyB,CAC1B,CAAC;AACJ,CAAC;AAED;;kDAEkD;AAClD,MAAM,UAAU,kCAAkC;IAChD,cAAc,GAAG,IAAI,CAAC;AACxB,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@brendanbank/atrium-host-bundle-utils",
3
- "version": "0.15.1",
3
+ "version": "0.15.3",
4
4
  "description": "Runtime helpers, Vite preset, and React hooks for atrium host bundles. Wraps the dual-tree mount pattern, the host-bundle Vite library config, and the /users/me/context hook so a host's main.tsx is ~10 lines of registration calls.",
5
5
  "license": "BSD-2-Clause",
6
6
  "type": "module",
@@ -25,7 +25,7 @@
25
25
  }
26
26
  },
27
27
  "dependencies": {
28
- "@brendanbank/atrium-host-types": "0.15.1"
28
+ "@brendanbank/atrium-host-types": "0.15.3"
29
29
  },
30
30
  "peerDependencies": {
31
31
  "@tanstack/react-query": "^5.0.0",