@molecule/app-react 1.6.6 → 1.6.7

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
@@ -3,7 +3,7 @@ AUTO-GENERATED — DO NOT EDIT THIS FILE.
3
3
  Generated by `mlcl sync-docs` from the package's src/index.ts JSDoc + mlcl/registry.json.
4
4
  Edits here are overwritten on the next commit (molecule's pre-commit hook regenerates).
5
5
  To change this document, edit the module-level JSDoc in src/index.ts.
6
- Generated: 2026-10-18T20:37:04.919Z
6
+ Generated: 2026-10-19T22:40:47.087Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-react
@@ -121,183 +121,169 @@ Provides login/logout/register flows, token management, profile
121
121
  updates, and auth state subscription.
122
122
 
123
123
  ```typescript
124
- interface AuthClient<
125
- T = UserProfile,
126
- TRegister extends Record<string, unknown> = Record<never, never>,
127
- > {
128
- /**
129
- * Returns the current authentication state snapshot.
130
- */
131
- getState(): AuthState<T>
132
- /**
133
- * Returns whether the user is currently authenticated.
134
- */
135
- isAuthenticated(): boolean
136
- /**
137
- * Gets the current user.
138
- */
139
- getUser(): T | null
140
- /**
141
- * Updates the cached user object (state + persistent storage) without
142
- * hitting the network. Intended for local refreshes after a per-app
143
- * mutation (e.g., the user just PATCHed their own profile and the
144
- * server returned the canonical row). Does NOT change tokens.
145
- *
146
- * This does not sign the client in: `authenticated` and `status` are
147
- * unchanged, so an anonymous client stays anonymous. Use
148
- * {@link login} / {@link register} for a credential exchange, or
149
- * {@link setSession} when the token was issued outside the client.
150
- */
151
- setUser(user: T | null): void
152
- /**
153
- * Gets the current access token.
154
- */
155
- getAccessToken(): string | null
156
- /**
157
- * Stores the access token in the configured token storage adapter (in a
158
- * browser, Web Storage; `'memory'` where no browser store exists). Use this
159
- * to seed the token after an out-of-band exchange (e.g. the OAuth
160
- * code→token redirect) instead of writing to `localStorage` directly,
161
- * which would violate the storage contract and make a stored bearer token
162
- * JS-readable (XSS-exfiltratable). Pass `null` to clear it.
163
- *
164
- * This changes token storage only; it does not sign the client in
165
- * (`authenticated` and `status` are unchanged). Use {@link login} /
166
- * {@link register} for a credential exchange, or call {@link setSession}
167
- * with the token and the user to establish an already-issued session.
168
- */
169
- setAccessToken(token: string | null): void
170
- /**
171
- * Adopts a session an out-of-band exchange already established: stores the
172
- * access token (and the refresh token when given), caches the user, and
173
- * sets the COMPLETE state — `initialized`, `authenticated`, `status:
174
- * 'authenticated'`, no error — in one update, with one subscriber
175
- * notification. Every hook reading the shared client sees the user as
176
- * signed in immediately.
177
- *
178
- * This is the way to seed an OAuth/custom sign-in. Calling
179
- * {@link setAccessToken} and {@link setUser} instead does NOT sign the
180
- * client in.
181
- */
182
- setSession(session: AuthSessionSeed<T>): void
183
- /**
184
- * Gets the refresh token.
185
- */
186
- getRefreshToken(): string | null
187
- /**
188
- * Logs in with credentials.
189
- */
190
- login(credentials: LoginCredentials): Promise<AuthResult<T>>
191
- /**
192
- * Logs out the current user.
193
- */
194
- logout(): Promise<void>
195
- /**
196
- * Registers a new user. Accepts the base fields plus the app's own fields
197
- * (`TRegister`) at the top level — see {@link RegisterData}.
198
- */
199
- register(data: RegisterData<TRegister>): Promise<AuthResult<T>>
200
- /**
201
- * Refreshes the access token.
202
- */
203
- refresh(): Promise<AuthResult<T>>
204
- /**
205
- * Requests a password reset.
206
- */
207
- requestPasswordReset(data: PasswordResetRequest): Promise<void>
208
- /**
209
- * Confirms a password reset.
210
- */
211
- confirmPasswordReset(data: PasswordResetConfirm): Promise<void>
212
- /**
213
- * Updates the current user's profile.
214
- */
215
- updateProfile(data: Partial<T>): Promise<T>
216
- /**
217
- * Changes the current user's password.
218
- */
219
- changePassword(oldPassword: string, newPassword: string): Promise<void>
220
- /**
221
- * Initializes auth state (e.g., from stored tokens).
222
- *
223
- * With a stored token AND a stored user it marks the session `'authenticated'`
224
- * SYNCHRONOUSLY — before its first `await` — so the first render is the
225
- * signed-in UI and no page waits on a verification round trip. Any check
226
- * (a refresh, the cookie-restore probe) settles behind that render, and only an
227
- * explicit 401/403 ends the session; a network/5xx/404 failure keeps it and
228
- * reports `'unavailable'`. With no stored user the client stays `'loading'`
229
- * until the cookie restore decides.
230
- *
231
- * Do not put this call (or a `/me` request of your own) in front of the first
232
- * render, and do not render a loading screen over a session it just restored:
233
- * `whenRestored()` already resolves as soon as the restore has settled, and the
234
- * HTTP gate built on it holds requests for exactly that window.
235
- */
236
- initialize(): Promise<void>
237
- /**
238
- * Re-checks a restored session against the server, in the background — the
239
- * boot-time validation an app with a stored token needs when a revoked or
240
- * expired token must sign the user out. Call it AFTER the first render
241
- * (`initialize()` restores synchronously from storage; this costs one request).
242
- *
243
- * - The server confirms the user: the session is refreshed and {@link AuthState.status}
244
- * stays `'authenticated'`.
245
- * - The server answers 401 or 403: the token is dead — the stored session is
246
- * cleared and the status becomes `'unauthenticated'`.
247
- * - The server cannot confirm the session — a network failure, a 5xx, or a 404
248
- * from a misconfigured {@link AuthClientConfig.currentUserEndpoint}: the
249
- * session (token AND user) is KEPT and the status becomes `'unavailable'`, so
250
- * the app can retry instead of signing the user out over a bad connection or a
251
- * route that does not exist. The 404 error names `currentUserEndpoint`.
252
- *
253
- * Do not hand-write this beside the client: a parallel token/user store for a
254
- * "validating"/"unavailable" flag is the race this method removes.
255
- *
256
- * Optional: a provider with no restorable session has nothing to validate.
257
- */
258
- validateSession?(): Promise<void>
259
- /**
260
- * Resolves when the session restore started by `initialize()` has settled — the point
261
- * after which the client knows whether this visitor is signed in.
262
- *
263
- * Resolves IMMEDIATELY when no restore is in flight: before `initialize()` is ever
264
- * called, and after it has finished. A restore that failed resolves too (it settled the
265
- * question), so an HTTP client can await this before every request without risking one
266
- * held forever. That is what makes the fetch-before-restore race impossible: a page that
267
- * fetches viewer-dependent data on mount waits here instead of going out anonymously
268
- * (see `setAuthGate` in `@molecule/app-http`).
269
- *
270
- * Optional: a provider that restores no session has nothing to wait for. Without it, an
271
- * HTTP client bonded to that provider sends first-paint requests unauthenticated.
272
- *
273
- * A provider whose restore sends a request THROUGH the gated HTTP client must send that
274
- * request with `skipAuthGate: true` (`RequestConfig` in `@molecule/app-http`): the gate
275
- * waits on this promise, so holding the restore's own request makes the gate wait on
276
- * itself and stalls every request it holds until it times out. `createJWTAuthClient`'s
277
- * restore does not need it — it uses `fetch`, not the bonded client.
278
- */
279
- whenRestored?(): Promise<void>
280
- /**
281
- * Subscribes to auth state changes.
282
- */
283
- subscribe(callback: (state: AuthState<T>) => void): () => void
284
- /**
285
- * Subscribes to auth state changes (alias for subscribe).
286
- */
287
- onAuthChange(callback: (state: AuthState<T>) => void): () => void
288
- /**
289
- * Gets the current access token (alias for getAccessToken).
290
- */
291
- getToken?(): string | null
292
- /**
293
- * Adds an auth event listener.
294
- */
295
- addEventListener(listener: AuthEventListener): () => void
296
- /**
297
- * Destroys the auth client.
298
- */
299
- destroy(): void
300
- }
124
+ interface AuthClient<T = UserProfile, TRegister extends Record<string, unknown> = Record<never, never>> {
125
+ /**
126
+ * Returns the current authentication state snapshot.
127
+ *
128
+ * READING the state starts the client's one session restore when nobody has called
129
+ * {@link initialize} yet — lazily and exactly once, sharing the promise an explicit
130
+ * `initialize()` returns. A hook (`useAuth()`), a subscriber, `isAuthenticated()` and
131
+ * `getUser()` are reads too, so a client whose entry file dropped the template's
132
+ * `authClient.initialize()` line still restores instead of reporting `'loading'`
133
+ * forever.
134
+ */
135
+ getState(): AuthState<T>;
136
+ /**
137
+ * Returns whether the user is currently authenticated.
138
+ */
139
+ isAuthenticated(): boolean;
140
+ /**
141
+ * Gets the current user.
142
+ */
143
+ getUser(): T | null;
144
+ /**
145
+ * Updates the cached user object (state + persistent storage) without
146
+ * hitting the network. Intended for local refreshes after a per-app
147
+ * mutation (e.g., the user just PATCHed their own profile and the
148
+ * server returned the canonical row). Does NOT change tokens.
149
+ *
150
+ * This does not sign the client in: `authenticated` and `status` are
151
+ * unchanged, so an anonymous client stays anonymous. Use
152
+ * {@link login} / {@link register} for a credential exchange, or
153
+ * {@link setSession} when the token was issued outside the client.
154
+ */
155
+ setUser(user: T | null): void;
156
+ /**
157
+ * Gets the current access token.
158
+ */
159
+ getAccessToken(): string | null;
160
+ /**
161
+ * Stores the access token in the configured token storage adapter (in a
162
+ * browser, Web Storage; `'memory'` where no browser store exists). Use this
163
+ * to seed the token after an out-of-band exchange (e.g. the OAuth
164
+ * code→token redirect) instead of writing to `localStorage` directly,
165
+ * which would violate the storage contract and make a stored bearer token
166
+ * JS-readable (XSS-exfiltratable). Pass `null` to clear it.
167
+ *
168
+ * This changes token storage only; it does not sign the client in
169
+ * (`authenticated` and `status` are unchanged). Use {@link login} /
170
+ * {@link register} for a credential exchange, or call {@link setSession}
171
+ * with the token and the user to establish an already-issued session.
172
+ */
173
+ setAccessToken(token: string | null): void;
174
+ /**
175
+ * Adopts a session an out-of-band exchange already established: stores the
176
+ * access token (and the refresh token when given), caches the user, and
177
+ * sets the COMPLETE state — `initialized`, `authenticated`, `status:
178
+ * 'authenticated'`, no error — in one update, with one subscriber
179
+ * notification. Every hook reading the shared client sees the user as
180
+ * signed in immediately.
181
+ *
182
+ * This is the way to seed an OAuth/custom sign-in. Calling
183
+ * {@link setAccessToken} and {@link setUser} instead does NOT sign the
184
+ * client in.
185
+ */
186
+ setSession(session: AuthSessionSeed<T>): void;
187
+ /**
188
+ * Gets the refresh token.
189
+ */
190
+ getRefreshToken(): string | null;
191
+ /**
192
+ * Logs in with credentials.
193
+ */
194
+ login(credentials: LoginCredentials): Promise<AuthResult<T>>;
195
+ /**
196
+ * Logs out the current user.
197
+ */
198
+ logout(): Promise<void>;
199
+ /**
200
+ * Registers a new user. Accepts the base fields plus the app's own fields
201
+ * (`TRegister`) at the top level — see {@link RegisterData}.
202
+ */
203
+ register(data: RegisterData<TRegister>): Promise<AuthResult<T>>;
204
+ /**
205
+ * Refreshes the access token.
206
+ */
207
+ refresh(): Promise<AuthResult<T>>;
208
+ /**
209
+ * Requests a password reset.
210
+ */
211
+ requestPasswordReset(data: PasswordResetRequest): Promise<void>;
212
+ /**
213
+ * Confirms a password reset.
214
+ */
215
+ confirmPasswordReset(data: PasswordResetConfirm): Promise<void>;
216
+ /**
217
+ * Updates the current user's profile.
218
+ */
219
+ updateProfile(data: Partial<T>): Promise<T>;
220
+ /**
221
+ * Changes the current user's password.
222
+ */
223
+ changePassword(oldPassword: string, newPassword: string): Promise<void>;
224
+ /**
225
+ * Initializes auth state (e.g., from stored tokens).
226
+ *
227
+ * LAZY and IDEMPOTENT: the first read of the state ({@link getState},
228
+ * {@link subscribe}, `useAuth()`) starts this same restore when nobody has called
229
+ * `initialize()`, and every later call shares the one promise instead of sending a
230
+ * second request. An app that keeps the template's explicit call behaves exactly as
231
+ * before; an app that loses that line still restores its session.
232
+ *
233
+ * With a stored token AND a stored user it marks the session `'authenticated'`
234
+ * SYNCHRONOUSLY — before its first `await` — so the first render is the
235
+ * signed-in UI and no page waits on a verification round trip. Any check
236
+ * (a refresh, the cookie-restore probe) settles behind that render, and only an
237
+ * explicit 401/403 ends the session; a network/5xx/404 failure keeps it and
238
+ * reports `'unavailable'`. With no stored user the client stays `'loading'`
239
+ * until the cookie restore decides.
240
+ *
241
+ * Do not put this call (or a `/me` request of your own) in front of the first
242
+ * render, and do not render a loading screen over a session it just restored:
243
+ * `whenRestored()` already resolves as soon as the restore has settled, and the
244
+ * HTTP gate built on it holds requests for exactly that window.
245
+ */
246
+ initialize(): Promise<void>;
247
+ /**
248
+ * Re-checks a restored session against the server, in the background — the
249
+ * boot-time validation an app with a stored token needs when a revoked or
250
+ * expired token must sign the user out. Call it AFTER the first render
251
+ * (`initialize()` restores synchronously from storage; this costs one request).
252
+ *
253
+ * - The server confirms the user: the session is refreshed and {@link AuthState.status}
254
+ * stays `'authenticated'`.
255
+ * - The server answers 401 or 403: the token is dead — the stored session is
256
+ * cleared and the status becomes `'unauthenticated'`.
257
+ * - The server cannot confirm the session — a network failure, a 5xx, or a 404
258
+ * from a misconfigured {@link AuthClientConfig.currentUserEndpoint}: the
259
+ * session (token AND user) is KEPT and the status becomes `'unavailable'`, so
260
+ * the app can retry instead of signing the user out over a bad connection or a
261
+ * route that does not exist. The 404 error names `currentUserEndpoint`.
262
+ *
263
+ * Do not hand-write this beside the client: a parallel token/user store for a
264
+ * "validating"/"unavailable" flag is the race this method removes.
265
+ *
266
+ * Optional: a provider with no restorable session has nothing to validate.
267
+ */
268
+ validateSession?(): Promise<void>;
269
+ /**
270
+ * Resolves when the session restore started by `initialize()` has settled — the point
271
+ * after which the client knows whether this visitor is signed in.
272
+ *
273
+ * Resolves IMMEDIATELY when no restore is in flight: before `initialize()` is ever
274
+ * called, and after it has finished. A restore that failed resolves too (it settled the
275
+ * question), so an HTTP client can await this before every request without risking one
276
+ * held forever. That is what makes the fetch-before-restore race impossible: a page that
277
+ * fetches viewer-dependent data on mount waits here instead of going out anonymously
278
+ * (see `setAuthGate` in `@molecule/app-http`).
279
+ *
280
+ * Optional: a provider that restores no session has nothing to wait for. Without it, an
281
+ * HTTP client bonded to that provider sends first-paint requests unauthenticated.
282
+ *
283
+ * A provider whose restore sends a request THROUGH the gated HTTP client must send that
284
+ * request with `skipAuthGate: true` (`RequestConfig` in `@molecule/app-http`): the gate
285
+ * waits on this promise, so holding the restore's own request makes the gate wait on
286
+ // … truncated — the full declaration is in node_modules/@molecule/app-react/dist
301
287
  ```
302
288
 
303
289
  #### `FormController`
@@ -1292,6 +1278,17 @@ interface UseAuthResult<T = unknown> {
1292
1278
  register: AuthClient<T>['register']
1293
1279
  refresh: AuthClient<T>['refresh']
1294
1280
  setUser: AuthClient<T>['setUser']
1281
+ /**
1282
+ * Adopt a session an exchange outside the client already established (an
1283
+ * OAuth code→token redirect, the app's own sign-in endpoint) in ONE update:
1284
+ * the token and user are stored and the hook's consumers see the client as
1285
+ * `authenticated` immediately.
1286
+ *
1287
+ * `setUser` alone does NOT sign the client in, and `setAccessToken` changes
1288
+ * storage only — using those two for a caller-issued session leaves every
1289
+ * `authenticated` read signed out (xr-molecule-flash-m178).
1290
+ */
1291
+ setSession: AuthClient<T>['setSession']
1295
1292
  isAuthenticated: boolean
1296
1293
  isLoading: boolean
1297
1294
  user: T | null
@@ -1736,6 +1733,20 @@ function useAuthClient(): AuthClient<T, Record<never, never>>
1736
1733
 
1737
1734
  Hook for authentication state and actions.
1738
1735
 
1736
+ Pass the app's user type — the SAME type used for the auth client and its
1737
+ config (`createJWTAuthClient<MyUser>`, `AuthClientConfig<MyUser>`) — so
1738
+ `user` and `setSession`/`setUser` are typed for the pages:
1739
+ `useAuth<MyUser>()`.
1740
+
1741
+ For a sign-in the app runs itself (an OAuth redirect, a custom endpoint that
1742
+ already issued the token), call `setSession({ accessToken, user })`: it
1743
+ adopts the token and profile atomically and every consumer of this hook sees
1744
+ `status: 'authenticated'` at once. `setUser` alone does not sign in.
1745
+
1746
+ To create an account, use `const { register } = useAuth<MyUser>()` and
1747
+ `await register({ email, password, name })`. Registration returns the auth
1748
+ client's `AuthResult<MyUser>`; there is no separate `useRegister` hook.
1749
+
1739
1750
  ```typescript
1740
1751
  function useAuth(options?: UseAuthOptions): UseAuthResult<T>
1741
1752
  ```
@@ -2082,6 +2093,10 @@ function useChildLogger(parentName: string, context: Record<string, unknown>): L
2082
2093
  #### `useLogin()`
2083
2094
 
2084
2095
  Hook for login with async state tracking.
2096
+ Registration is available through `const { register } = useAuth()`;
2097
+ call `register({ email, password, name })` to create an account. There is
2098
+ no separate `useRegister` hook. Use `usePromise(register)` when the form
2099
+ needs the same pending/error tracking as this login hook.
2085
2100
 
2086
2101
  ```typescript
2087
2102
  function useLogin(): UseLoginReturn<T>
@@ -2962,6 +2977,13 @@ Peer dependencies:
2962
2977
  "useXProvider must be used within an XProvider" means the matching prop (or individual
2963
2978
  provider component) is missing ABOVE the component that calls the hook — fix the wiring,
2964
2979
  never wrap the hook in try/catch.
2980
+ - **`useAuth().setSession({ accessToken, user })` adopts a caller-issued session.** For a
2981
+ custom sign-in exchange (an OAuth redirect, the app's own endpoint that already returned
2982
+ the token and profile), this stores the token and user and flips the shared client to
2983
+ `authenticated` in ONE update, so every component reading the hook sees the signed-in
2984
+ state immediately. `setUser` alone does not sign in, and `setAccessToken` changes storage
2985
+ only. Type the hook with the app's profile (`useAuth<MyUser>()`) as well as the client
2986
+ and its config, so the session seed and `user` carry the app's own fields.
2965
2987
  - **Locale-reactive text requires the hook.** Inside components always read `t` from
2966
2988
  `useTranslation()` (or `useT()`); it re-renders on `onLocaleChange` — even when
2967
2989
  `addTranslations()` only adds keys for the current locale. Calling the raw `t()` import from
@@ -15,15 +15,29 @@ export declare function useAuthClient<T = unknown>(): AuthClient<T>;
15
15
  /**
16
16
  * Hook for authentication state and actions.
17
17
  *
18
+ * Pass the app's user type — the SAME type used for the auth client and its
19
+ * config (`createJWTAuthClient<MyUser>`, `AuthClientConfig<MyUser>`) — so
20
+ * `user` and `setSession`/`setUser` are typed for the pages:
21
+ * `useAuth<MyUser>()`.
22
+ *
23
+ * For a sign-in the app runs itself (an OAuth redirect, a custom endpoint that
24
+ * already issued the token), call `setSession({ accessToken, user })`: it
25
+ * adopts the token and profile atomically and every consumer of this hook sees
26
+ * `status: 'authenticated'` at once. `setUser` alone does not sign in.
27
+ *
28
+ * To create an account, use `const { register } = useAuth<MyUser>()` and
29
+ * `await register({ email, password, name })`. Registration returns the auth
30
+ * client's `AuthResult<MyUser>`; there is no separate `useRegister` hook.
31
+ *
18
32
  * @param options - Hook options
19
33
  * @returns Auth state and action methods
20
34
  *
21
35
  * @example
22
36
  * ```tsx
23
- * const { user, isAuthenticated, login, logout } = useAuth()
37
+ * const { user, isAuthenticated, login, logout } = useAuth<{ id: string; name?: string }>()
24
38
  *
25
39
  * if (isAuthenticated) {
26
- * return <div>Welcome, {user.name}!</div>
40
+ * return <div>Welcome, {user?.name}!</div>
27
41
  * }
28
42
  * ```
29
43
  */
@@ -1 +1 @@
1
- {"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../src/hooks/useAuth.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,UAAU,EAA6C,MAAM,oBAAoB,CAAA;AAI/F,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhE;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,GAAG,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,CAU1D;AAED;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,aAAa,CAAC,CAAC,CAAC,CAqE/E;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,GAAG,OAAO,KAAK,CAAC,GAAG,IAAI,CAG/C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAG5C"}
1
+ {"version":3,"file":"useAuth.d.ts","sourceRoot":"","sources":["../../src/hooks/useAuth.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EACV,UAAU,EAKX,MAAM,oBAAoB,CAAA;AAI3B,OAAO,KAAK,EAAE,cAAc,EAAE,aAAa,EAAE,MAAM,aAAa,CAAA;AAEhE;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,CAAC,GAAG,OAAO,KAAK,UAAU,CAAC,CAAC,CAAC,CAU1D;AAED;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA4BG;AACH,wBAAgB,OAAO,CAAC,CAAC,GAAG,OAAO,EAAE,OAAO,CAAC,EAAE,cAAc,GAAG,aAAa,CAAC,CAAC,CAAC,CA2E/E;AAED;;;;GAIG;AACH,wBAAgB,OAAO,CAAC,CAAC,GAAG,OAAO,KAAK,CAAC,GAAG,IAAI,CAG/C;AAED;;;;GAIG;AACH,wBAAgB,kBAAkB,IAAI,OAAO,CAG5C"}
@@ -24,15 +24,29 @@ export function useAuthClient() {
24
24
  /**
25
25
  * Hook for authentication state and actions.
26
26
  *
27
+ * Pass the app's user type — the SAME type used for the auth client and its
28
+ * config (`createJWTAuthClient<MyUser>`, `AuthClientConfig<MyUser>`) — so
29
+ * `user` and `setSession`/`setUser` are typed for the pages:
30
+ * `useAuth<MyUser>()`.
31
+ *
32
+ * For a sign-in the app runs itself (an OAuth redirect, a custom endpoint that
33
+ * already issued the token), call `setSession({ accessToken, user })`: it
34
+ * adopts the token and profile atomically and every consumer of this hook sees
35
+ * `status: 'authenticated'` at once. `setUser` alone does not sign in.
36
+ *
37
+ * To create an account, use `const { register } = useAuth<MyUser>()` and
38
+ * `await register({ email, password, name })`. Registration returns the auth
39
+ * client's `AuthResult<MyUser>`; there is no separate `useRegister` hook.
40
+ *
27
41
  * @param options - Hook options
28
42
  * @returns Auth state and action methods
29
43
  *
30
44
  * @example
31
45
  * ```tsx
32
- * const { user, isAuthenticated, login, logout } = useAuth()
46
+ * const { user, isAuthenticated, login, logout } = useAuth<{ id: string; name?: string }>()
33
47
  *
34
48
  * if (isAuthenticated) {
35
- * return <div>Welcome, {user.name}!</div>
49
+ * return <div>Welcome, {user?.name}!</div>
36
50
  * }
37
51
  * ```
38
52
  */
@@ -74,6 +88,7 @@ export function useAuth(options) {
74
88
  const register = useCallback((data) => client.register(data), [client]);
75
89
  const refresh = useCallback(() => client.refresh(), [client]);
76
90
  const setUser = useCallback((user) => client.setUser(user), [client]);
91
+ const setSession = useCallback((session) => client.setSession(session), [client]);
77
92
  return {
78
93
  // The single value to render from. A stored token AND user make it
79
94
  // `'authenticated'` on the FIRST render (the client restores synchronously);
@@ -85,6 +100,7 @@ export function useAuth(options) {
85
100
  register,
86
101
  refresh,
87
102
  setUser,
103
+ setSession,
88
104
  isAuthenticated: state.authenticated,
89
105
  isLoading: state.loading,
90
106
  user: state.user,
@@ -1 +1 @@
1
- {"version":3,"file":"useAuth.js","sourceRoot":"","sources":["../../src/hooks/useAuth.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,UAAU,EAAE,SAAS,EAAE,MAAM,EAAE,o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MAAM;QACpB,KAAK;QACL,KAAK;QACL,MAAM;QACN,QAAQ;QACR,OAAO;QACP,OAAO;QACP,UAAU;QACV,eAAe,EAAE,KAAK,CAAC,aAAa;QACpC,SAAS,EAAE,KAAK,CAAC,OAAO;QACxB,IAAI,EAAE,KAAK,CAAC,IAAI;KACjB,CAAA;AACH,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,OAAO;IACrB,MAAM,EAAE,IAAI,EAAE,GAAG,OAAO,EAAK,CAAA;IAC7B,OAAO,IAAI,CAAA;AACb,CAAC;AAED;;;;GAIG;AACH,MAAM,UAAU,kBAAkB;IAChC,MAAM,EAAE,eAAe,EAAE,GAAG,OAAO,EAAE,CAAA;IACrC,OAAO,eAAe,CAAA;AACxB,CAAC"}
@@ -17,6 +17,10 @@ export interface UseLoginReturn<T = unknown> {
17
17
  }
18
18
  /**
19
19
  * Hook for login with async state tracking.
20
+ * Registration is available through `const { register } = useAuth()`;
21
+ * call `register({ email, password, name })` to create an account. There is
22
+ * no separate `useRegister` hook. Use `usePromise(register)` when the form
23
+ * needs the same pending/error tracking as this login hook.
20
24
  *
21
25
  * @returns Login state and action
22
26
  *
@@ -1 +1 @@
1
- {"version":3,"file":"useLogin.d.ts","sourceRoot":"","sources":["../../src/hooks/useLogin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGtE,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAElE;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,OAAO;IACzC,MAAM,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IAChD,KAAK,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IAC9C,KAAK,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IAC9C,KAAK,EAAE,CAAC,WAAW,EAAE,gBAAgB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;IAChE,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAED;;;;;;;;;;;;;;;GAeG;AACH,wBAAgB,QAAQ,CAAC,CAAC,GAAG,OAAO,KAAK,cAAc,CAAC,CAAC,CAAC,CAiBzD"}
1
+ {"version":3,"file":"useLogin.d.ts","sourceRoot":"","sources":["../../src/hooks/useLogin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAIH,OAAO,KAAK,EAAE,UAAU,EAAE,gBAAgB,EAAE,MAAM,oBAAoB,CAAA;AAGtE,OAAO,EAAc,KAAK,eAAe,EAAE,MAAM,iBAAiB,CAAA;AAElE;;GAEG;AACH,MAAM,WAAW,cAAc,CAAC,CAAC,GAAG,OAAO;IACzC,MAAM,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,QAAQ,CAAC,CAAA;IAChD,KAAK,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IAC9C,KAAK,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAC,OAAO,CAAC,CAAA;IAC9C,KAAK,EAAE,CAAC,WAAW,EAAE,gBAAgB,KAAK,OAAO,CAAC,UAAU,CAAC,CAAC,CAAC,CAAC,CAAA;IAChE,KAAK,EAAE,MAAM,IAAI,CAAA;CAClB;AAED;;;;;;;;;;;;;;;;;;;GAmBG;AACH,wBAAgB,QAAQ,CAAC,CAAC,GAAG,OAAO,KAAK,cAAc,CAAC,CAAC,CAAC,CAiBzD"}
@@ -8,6 +8,10 @@ import { useAuthClient } from './useAuth.js';
8
8
  import { usePromise } from './usePromise.js';
9
9
  /**
10
10
  * Hook for login with async state tracking.
11
+ * Registration is available through `const { register } = useAuth()`;
12
+ * call `register({ email, password, name })` to create an account. There is
13
+ * no separate `useRegister` hook. Use `usePromise(register)` when the form
14
+ * needs the same pending/error tracking as this login hook.
11
15
  *
12
16
  * @returns Login state and action
13
17
  *
@@ -1 +1 @@
1
- {"version":3,"file":"useLogin.js","sourceRoot":"","sources":["../../src/hooks/useLogin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAInC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAwB,MAAM,iBAAiB,CAAA;AAalE;;;;;;;;;;;;;;;GAeG;AACH,MAAM,UAAU,QAAQ;IACtB,MAAM,MAAM,GAAG,aAAa,EAAK,CAAA;IAEjC,MAAM,OAAO,GAAG,WAAW,CACzB,CAAC,WAA6B,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,EAC5D,CAAC,MAAM,CAAC,CACT,CAAA;IAED,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;IAEzC,OAAO;QACL,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,KAAK,EAAE,IAAI;QACX,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAA;AACH,CAAC"}
1
+ {"version":3,"file":"useLogin.js","sourceRoot":"","sources":["../../src/hooks/useLogin.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,EAAE,WAAW,EAAE,MAAM,OAAO,CAAA;AAInC,OAAO,EAAE,aAAa,EAAE,MAAM,cAAc,CAAA;AAC5C,OAAO,EAAE,UAAU,EAAwB,MAAM,iBAAiB,CAAA;AAalE;;;;;;;;;;;;;;;;;;;GAmBG;AACH,MAAM,UAAU,QAAQ;IACtB,MAAM,MAAM,GAAG,aAAa,EAAK,CAAA;IAEjC,MAAM,OAAO,GAAG,WAAW,CACzB,CAAC,WAA6B,EAAE,EAAE,CAAC,MAAM,CAAC,KAAK,CAAC,WAAW,CAAC,EAC5D,CAAC,MAAM,CAAC,CACT,CAAA;IAED,MAAM,CAAC,KAAK,EAAE,IAAI,CAAC,GAAG,UAAU,CAAC,OAAO,CAAC,CAAA;IAEzC,OAAO;QACL,MAAM,EAAE,KAAK,CAAC,MAAM;QACpB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,KAAK,EAAE,KAAK,CAAC,KAAK;QAClB,KAAK,EAAE,IAAI;QACX,KAAK,EAAE,KAAK,CAAC,KAAK;KACnB,CAAA;AACH,CAAC"}
package/dist/index.d.ts CHANGED
@@ -56,6 +56,13 @@
56
56
  * "useXProvider must be used within an XProvider" means the matching prop (or individual
57
57
  * provider component) is missing ABOVE the component that calls the hook — fix the wiring,
58
58
  * never wrap the hook in try/catch.
59
+ * - **`useAuth().setSession({ accessToken, user })` adopts a caller-issued session.** For a
60
+ * custom sign-in exchange (an OAuth redirect, the app's own endpoint that already returned
61
+ * the token and profile), this stores the token and user and flips the shared client to
62
+ * `authenticated` in ONE update, so every component reading the hook sees the signed-in
63
+ * state immediately. `setUser` alone does not sign in, and `setAccessToken` changes storage
64
+ * only. Type the hook with the app's profile (`useAuth<MyUser>()`) as well as the client
65
+ * and its config, so the session seed and `user` carry the app's own fields.
59
66
  * - **Locale-reactive text requires the hook.** Inside components always read `t` from
60
67
  * `useTranslation()` (or `useT()`); it re-renders on `onLocaleChange` — even when
61
68
  * `addTranslations()` only adds keys for the current locale. Calling the raw `t()` import from
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+FG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsGG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
package/dist/index.js CHANGED
@@ -56,6 +56,13 @@
56
56
  * "useXProvider must be used within an XProvider" means the matching prop (or individual
57
57
  * provider component) is missing ABOVE the component that calls the hook — fix the wiring,
58
58
  * never wrap the hook in try/catch.
59
+ * - **`useAuth().setSession({ accessToken, user })` adopts a caller-issued session.** For a
60
+ * custom sign-in exchange (an OAuth redirect, the app's own endpoint that already returned
61
+ * the token and profile), this stores the token and user and flips the shared client to
62
+ * `authenticated` in ONE update, so every component reading the hook sees the signed-in
63
+ * state immediately. `setUser` alone does not sign in, and `setAccessToken` changes storage
64
+ * only. Type the hook with the app's profile (`useAuth<MyUser>()`) as well as the client
65
+ * and its config, so the session seed and `user` carry the app's own fields.
59
66
  * - **Locale-reactive text requires the hook.** Inside components always read `t` from
60
67
  * `useTranslation()` (or `useT()`); it re-renders on `onLocaleChange` — even when
61
68
  * `addTranslations()` only adds keys for the current locale. Calling the raw `t()` import from
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA+FG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAsGG;AAEH,cAAc,qBAAqB,CAAA;AACnC,cAAc,eAAe,CAAA;AAC7B,cAAc,kBAAkB,CAAA;AAChC,cAAc,gBAAgB,CAAA;AAC9B,cAAc,YAAY,CAAA"}
package/dist/types.d.ts CHANGED
@@ -146,6 +146,17 @@ export interface UseAuthResult<T = unknown> {
146
146
  register: AuthClient<T>['register'];
147
147
  refresh: AuthClient<T>['refresh'];
148
148
  setUser: AuthClient<T>['setUser'];
149
+ /**
150
+ * Adopt a session an exchange outside the client already established (an
151
+ * OAuth code→token redirect, the app's own sign-in endpoint) in ONE update:
152
+ * the token and user are stored and the hook's consumers see the client as
153
+ * `authenticated` immediately.
154
+ *
155
+ * `setUser` alone does NOT sign the client in, and `setAccessToken` changes
156
+ * storage only — using those two for a caller-issued session leaves every
157
+ * `authenticated` read signed out (xr-molecule-flash-m178).
158
+ */
159
+ setSession: AuthClient<T>['setSession'];
149
160
  isAuthenticated: boolean;
150
161
  isLoading: boolean;
151
162
  user: T | null;
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAEtC,OAAO,KAAK,EACV,mBAAmB,EACnB,cAAc,EACd,WAAW,EACX,YAAY,EACZ,eAAe,EAChB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EAAE,UAAU,EAAE,SAAS,EAAE,M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K,IAAI,CAAA;IAC9B,WAAW,EAAE,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,KAAK,IAAI,CAAA;IACxD,WAAW,EAAE,CAAC,QAAQ,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,KAAK,MAAM,IAAI,CAAA;CAC3E;AAED;;GAEG;AACH,MAAM,WAAW,gBAAgB;IAC/B,KAAK,EAAE,YAAY,CAAA;IACnB,MAAM,EAAE,CAAC,GAAG,EAAE,MAAM,KAAK,IAAI,CAAA;IAC7B,OAAO,EAAE,MAAM,IAAI,CAAA;IACnB,SAAS,EAAE,CAAC,MAAM,EAAE,WAAW,KAAK,IAAI,CAAA;IACxC,YAAY,EAAE,MAAM,IAAI,CAAA;IACxB;;;;;;OAMG;IACH,gBAAgB,EAAE,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,OAAO,KAAK,IAAI,CAAA;IAC5D,6EAA6E;IAC7E,IAAI,EAAE,MAAM,IAAI,CAAA;IAChB,4EAA4E;IAC5E,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAMD,YAAY,EACV,UAAU,EACV,SAAS,EACT,cAAc,EACd,WAAW,EACX,UAAU,EACV,MAAM,EACN,YAAY,EACZ,KAAK,EACL,WAAW,EACX,KAAK,GACN,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-react",
3
- "version": "1.6.6",
3
+ "version": "1.6.7",
4
4
  "description": "React framework bindings for molecule.dev",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
@@ -59,7 +59,7 @@
59
59
  },
60
60
  "devDependencies": {
61
61
  "@molecule/app-ai-models": "1.4.0",
62
- "@molecule/app-bonds-default-react": "1.1.3",
62
+ "@molecule/app-bonds-default-react": "1.1.4",
63
63
  "@molecule/app-i18n": "1.0.3",
64
64
  "@testing-library/dom": "10.4.1",
65
65
  "@testing-library/react": "16.3.2",