@molecule/app-ui-react 3.0.3 → 3.0.4

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-29T17:16:41.257Z
6
+ Generated: 2026-10-31T10:03:55.469Z
7
7
  -->
8
8
 
9
9
  # @molecule/app-ui-react
@@ -1346,9 +1346,9 @@ interface AuthGuardProps {
1346
1346
  */
1347
1347
  loadingDefault?: string
1348
1348
  /**
1349
- * Path to redirect to when the user is not authenticated. Defaults to
1350
- * `'/login'`. The current `useLocation()` is preserved as `state.from`
1351
- * for post-login restoration.
1349
+ * Path to redirect to when `useAuth().status` is `'unauthenticated'`.
1350
+ * Defaults to `'/login'`. The current `useLocation()` is preserved as
1351
+ * `state.from` for post-login restoration.
1352
1352
  */
1353
1353
  loginPath?: string
1354
1354
  /**
@@ -2144,15 +2144,18 @@ Route-element guard for authenticated sections of a React Router tree.
2144
2144
 
2145
2145
  - While `useAuth().status` is `'loading'` (no session decision yet), renders the
2146
2146
  `loadingFallback` (or the default `<div data-mol-id="auth-guard-loading">{t('common.loading')}</div>`).
2147
- - If the user is not authenticated, redirects to `loginPath` carrying
2147
+ - If the status is `'unauthenticated'`, redirects to `loginPath` carrying
2148
2148
  the attempted location in `state.from` for post-login restoration.
2149
2149
  - Otherwise renders `children` (or `<Outlet />` if none).
2150
2150
 
2151
2151
  The guard reads `status`, not `initialized`: a stored token AND user make the
2152
2152
  FIRST render `'authenticated'`, so a protected page paints immediately instead
2153
2153
  of waiting for the background verification (`validateSession()`) or a
2154
- current-user round trip. `'unavailable'` (a stored session the server could not
2155
- confirm) counts as signed in — the page renders and the API decides.
2154
+ current-user round trip. `'unavailable'` (a retained candidate the server could
2155
+ not confirm) still renders the page and lets the API decide. It is not a
2156
+ confirmed-session boolean: `isAuthenticated` can be false and `user` can be null
2157
+ while a token/cookie-only candidate is unavailable, so never redirect on the
2158
+ boolean or require a profile in this state.
2156
2159
 
2157
2160
  The default loading tag carries `data-mol-id="auth-guard-loading"`
2158
2161
  so AI agents and e2e tests can target it reliably. When the caller
@@ -27,9 +27,9 @@ export interface AuthGuardProps {
27
27
  */
28
28
  loadingDefault?: string;
29
29
  /**
30
- * Path to redirect to when the user is not authenticated. Defaults to
31
- * `'/login'`. The current `useLocation()` is preserved as `state.from`
32
- * for post-login restoration.
30
+ * Path to redirect to when `useAuth().status` is `'unauthenticated'`.
31
+ * Defaults to `'/login'`. The current `useLocation()` is preserved as
32
+ * `state.from` for post-login restoration.
33
33
  */
34
34
  loginPath?: string;
35
35
  /**
@@ -51,15 +51,18 @@ export interface AuthGuardProps {
51
51
  *
52
52
  * - While `useAuth().status` is `'loading'` (no session decision yet), renders the
53
53
  * `loadingFallback` (or the default `<div data-mol-id="auth-guard-loading">{t('common.loading')}</div>`).
54
- * - If the user is not authenticated, redirects to `loginPath` carrying
54
+ * - If the status is `'unauthenticated'`, redirects to `loginPath` carrying
55
55
  * the attempted location in `state.from` for post-login restoration.
56
56
  * - Otherwise renders `children` (or `<Outlet />` if none).
57
57
  *
58
58
  * The guard reads `status`, not `initialized`: a stored token AND user make the
59
59
  * FIRST render `'authenticated'`, so a protected page paints immediately instead
60
60
  * of waiting for the background verification (`validateSession()`) or a
61
- * current-user round trip. `'unavailable'` (a stored session the server could not
62
- * confirm) counts as signed in — the page renders and the API decides.
61
+ * current-user round trip. `'unavailable'` (a retained candidate the server could
62
+ * not confirm) still renders the page and lets the API decide. It is not a
63
+ * confirmed-session boolean: `isAuthenticated` can be false and `user` can be null
64
+ * while a token/cookie-only candidate is unavailable, so never redirect on the
65
+ * boolean or require a profile in this state.
63
66
  *
64
67
  * The default loading tag carries `data-mol-id="auth-guard-loading"`
65
68
  * so AI agents and e2e tests can target it reliably. When the caller
@@ -1 +1 @@
1
- {"version":3,"file":"AuthGuard.d.ts","sourceRoot":"","sources":["../../src/components/AuthGuard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAA;AAKzD;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,SAAS,CAAA;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,wBAAgB,SAAS,CAAC,EACxB,eAAe,EACf,UAA6B,EAC7B,cAA6B,EAC7B,SAAoB,EACpB,eAAe,EACf,QAAQ,GACT,GAAE,cAAmB,GAAG,SAAS,CA2BjC"}
1
+ {"version":3,"file":"AuthGuard.d.ts","sourceRoot":"","sources":["../../src/components/AuthGuard.tsx"],"names":[],"mappings":"AAAA,OAAO,EAAE,KAAK,SAAS,EAAqB,MAAM,OAAO,CAAA;AAKzD;;;;;;;GAOG;AACH,MAAM,WAAW,cAAc;IAC7B;;;;;OAKG;IACH,eAAe,CAAC,EAAE,SAAS,CAAA;IAC3B;;;OAGG;IACH,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB;;;;OAIG;IACH,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB;;;;OAIG;IACH,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB;;;;;;OAMG;IACH,eAAe,CAAC,EAAE,MAAM,IAAI,CAAA;IAC5B;;;OAGG;IACH,QAAQ,CAAC,EAAE,SAAS,CAAA;CACrB;AAED;;;;;;;;;;;;;;;;;;;;;;;;GAwBG;AACH,wBAAgB,SAAS,CAAC,EACxB,eAAe,EACf,UAA6B,EAC7B,cAA6B,EAC7B,SAAoB,EACpB,eAAe,EACf,QAAQ,GACT,GAAE,cAAmB,GAAG,SAAS,CA2BjC"}
@@ -7,15 +7,18 @@ import { useAuth, useTranslation } from '@molecule/app-react';
7
7
  *
8
8
  * - While `useAuth().status` is `'loading'` (no session decision yet), renders the
9
9
  * `loadingFallback` (or the default `<div data-mol-id="auth-guard-loading">{t('common.loading')}</div>`).
10
- * - If the user is not authenticated, redirects to `loginPath` carrying
10
+ * - If the status is `'unauthenticated'`, redirects to `loginPath` carrying
11
11
  * the attempted location in `state.from` for post-login restoration.
12
12
  * - Otherwise renders `children` (or `<Outlet />` if none).
13
13
  *
14
14
  * The guard reads `status`, not `initialized`: a stored token AND user make the
15
15
  * FIRST render `'authenticated'`, so a protected page paints immediately instead
16
16
  * of waiting for the background verification (`validateSession()`) or a
17
- * current-user round trip. `'unavailable'` (a stored session the server could not
18
- * confirm) counts as signed in — the page renders and the API decides.
17
+ * current-user round trip. `'unavailable'` (a retained candidate the server could
18
+ * not confirm) still renders the page and lets the API decide. It is not a
19
+ * confirmed-session boolean: `isAuthenticated` can be false and `user` can be null
20
+ * while a token/cookie-only candidate is unavailable, so never redirect on the
21
+ * boolean or require a profile in this state.
19
22
  *
20
23
  * The default loading tag carries `data-mol-id="auth-guard-loading"`
21
24
  * so AI agents and e2e tests can target it reliably. When the caller
@@ -40,7 +43,7 @@ export function AuthGuard({ loadingFallback, loadingKey = 'common.loading', load
40
43
  if (status === 'loading') {
41
44
  return (loadingFallback ?? (_jsx("div", { "data-mol-id": "auth-guard-loading", children: t(loadingKey, {}, { defaultValue: loadingDefault }) })));
42
45
  }
43
- if (!isAuthenticated) {
46
+ if (status === 'unauthenticated') {
44
47
  return _jsx(Navigate, { to: loginPath, state: { from: location }, replace: true });
45
48
  }
46
49
  return _jsx(_Fragment, { children: children ?? _jsx(Outlet, {}) });
@@ -1 +1 @@
1
- {"version":3,"file":"AuthGuard.js","sourceRoot":"","sources":["../../src/components/AuthGuard.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAkB,SAAS,EAAE,MAAM,EAAE,MAAM,OAAO,CAAA;AACzD,OAAO,EAAE,QAAQ,EAAE,MAAM,EAAE,WAAW,EAAE,MAAM,cAAc,CAAA;AAE5D,OAAO,EAAE,OAAO,EAAE,cAAc,EAAE,MAAM,qBAAqB,CAAA;AAkD7D;;;;;;;;;;;;;;;;;;;;;GAqBG;AACH,MAAM,UAAU,SAAS,CAAC,EACxB,eAAe,EACf,UAAU,GAAG,gBAAgB,EAC7B,cAAc,GAAG,YAAY,EAC7B,SAAS,GAAG,QAAQ,EACpB,eAAe,EACf,QAAQ,MACU,EAAE;IACpB,MAAM,EAAE,eAAe,EAAE,MAAM,EAAE,GAAG,OAAO,EAAE,CAAA;IAC7C,MAAM,EAAE,CAAC,EAAE,GAAG,cAAc,EAAE,CAAA;IAC9B,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;IAC9B,MAAM,WAAW,GAAG,MAAM,CAAC,KAAK,CAAC,CAAA;IAEjC,SAAS,CAAC,GAAG,EAAE;QACb,IAAI,CAAC,eAAe;YAAE,OAAM;QAC5B,IAAI,eAAe,IAAI,CAAC,WAAW,CAAC,OAAO,EAAE,CAAC;YAC5C,eAAe,EAAE,CAAA;QACnB,CAAC;QACD,WAAW,CAAC,OAAO,GAAG,eAAe,CAAA;IACvC,CAAC,EAAE,CAAC,eAAe,EAAE,eAAe,CAAC,CAAC,CAAA;IAEtC,IAAI,MAAM,KAAK,SAAS,EAAE,CAAC;QACzB,OAAO,CACL,eAAe,IAAI,CACjB,6BAAiB,oBAAoB,YAClC,CAAC,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC,GAChD,CACP,CACF,CAAA;IACH,CAAC;IACD,IAAI,CAAC,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QACzB,OAAO,CACL,eAAe,IAAI,CACjB,6BAAiB,oBAAoB,YAClC,CAAC,CAAC,UAAU,EAAE,EAAE,EAAE,EAAE,YAAY,EAAE,cAAc,EAAE,CAAC,GAChD,CACP,CACF,CAAA;IACH,CAAC;IACD,IAAI,MAAM,KAAK,iBAAiB,EAAE,CAAC;QACjC,OAAO,KAAC,QAAQ,IAAC,EAAE,EAAE,SAAS,EAAE,KAAK,EAAE,EAAE,IAAI,EAAE,QAAQ,EAAE,EAAE,OAAO,SAAG,CAAA;IACvE,CAAC;IACD,OAAO,4BAAG,QAAQ,IAAI,KAAC,MAAM,KAAG,GAAI,CAAA;AACtC,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@molecule/app-ui-react",
3
- "version": "3.0.3",
3
+ "version": "3.0.4",
4
4
  "description": "React UI components for molecule.dev",
5
5
  "type": "module",
6
6
  "sideEffects": false,
@@ -42,9 +42,9 @@
42
42
  "react-router": "^7.0.0 || ^8.0.0"
43
43
  },
44
44
  "devDependencies": {
45
- "@molecule/app-i18n": "1.1.1",
45
+ "@molecule/app-i18n": "1.1.2",
46
46
  "@molecule/app-icons": "1.0.3",
47
- "@molecule/app-react": "3.0.2",
47
+ "@molecule/app-react": "3.1.0",
48
48
  "@testing-library/react": "16.3.3",
49
49
  "@types/node": "26.6.5",
50
50
  "@types/react": "19.3.0",