@asteby/metacore-auth 6.0.0 → 7.1.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
@@ -99,3 +99,24 @@ export function SignInRoute() {
99
99
  - **Factory, not singleton** — `createApiClient` avoids baking env vars into the library. The host app wires token / language / branch getters.
100
100
  - **Pages are brand-less** — accept `brandName`, `logo`, `showcase`, `headerSlot`, `footerSlot` so each app supplies its own identity.
101
101
  - **`onSubmit` delegated** — pages don't assume endpoints, toasts, or navigation. The caller owns the network layer.
102
+
103
+ ## `AuthProvider` / `useAuth` are deprecated
104
+
105
+ Both exports remain in the public API for back-compat, but they are now thin wrappers over `useAuthStore`:
106
+
107
+ - `AuthProvider` is a `Fragment` that, on mount, optionally seeds the store with an `initialUser` / `initialAccessToken` (SSR / hydration use-case). It owns no local state and renders no Context.
108
+ - `useAuth()` projects the store's `AuthUser` down to the legacy `{ user, login, logout, isAuthenticated }` shape. `login` / `logout` mutate the same store, so `useAuth()` and `useAuthStore` cannot diverge.
109
+
110
+ **Prefer `useAuthStore` directly in new code:**
111
+
112
+ ```ts
113
+ // Reading
114
+ const user = useAuthStore((state) => state.auth.user)
115
+
116
+ // Writing
117
+ useAuthStore.getState().auth.setUser(fullUser)
118
+ useAuthStore.getState().auth.setAccessToken(token)
119
+ useAuthStore.getState().auth.reset() // clears both user & token
120
+ ```
121
+
122
+ The legacy hook is kept indefinitely; it's free of cost now that it's a read-through. The deprecation is purely a "prefer the typed, fully-featured surface" hint — not a removal timeline.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,7 @@
1
1
  export { useAuthStore, AUTH_STORAGE_KEYS } from './store';
2
2
  export type { AuthUser, AuthState } from './store';
3
3
  export { AuthProvider, useAuth } from './provider';
4
- export type { AuthProviderProps } from './provider';
4
+ export type { AuthProviderProps, LegacyAuthUser } from './provider';
5
5
  export { createApiClient } from './api-client';
6
6
  export type { CreateApiClientOptions, ApiClient } from './api-client';
7
7
  export { createAuthGuard } from './guards';
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AACzD,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAGlD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAClD,YAAY,EAAE,iBAAiB,EAAE,MAAM,YAAY,CAAA;AAGnD,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,YAAY,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAGrE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,YAAY,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAGtD,cAAc,SAAS,CAAA;AAGvB,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AACzD,YAAY,EAAE,QAAQ,EAAE,SAAS,EAAE,MAAM,SAAS,CAAA;AAIlD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAClD,YAAY,EAAE,iBAAiB,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AAGnE,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAC9C,YAAY,EAAE,sBAAsB,EAAE,SAAS,EAAE,MAAM,cAAc,CAAA;AAGrE,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAC1C,YAAY,EAAE,sBAAsB,EAAE,MAAM,UAAU,CAAA;AAGtD,cAAc,SAAS,CAAA;AAGvB,cAAc,cAAc,CAAA"}
package/dist/index.js CHANGED
@@ -1,6 +1,7 @@
1
1
  // Store
2
2
  export { useAuthStore, AUTH_STORAGE_KEYS } from './store';
3
- // Provider
3
+ // Provider — thin wrapper around the store, kept for back-compat.
4
+ // New code should consume `useAuthStore` directly.
4
5
  export { AuthProvider, useAuth } from './provider';
5
6
  // API client factory
6
7
  export { createApiClient } from './api-client';
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAGzD,WAAW;AACX,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAGlD,qBAAqB;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9C,eAAe;AACf,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG1C,QAAQ;AACR,cAAc,SAAS,CAAA;AAEvB,aAAa;AACb,cAAc,cAAc,CAAA"}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,QAAQ;AACR,OAAO,EAAE,YAAY,EAAE,iBAAiB,EAAE,MAAM,SAAS,CAAA;AAGzD,kEAAkE;AAClE,mDAAmD;AACnD,OAAO,EAAE,YAAY,EAAE,OAAO,EAAE,MAAM,YAAY,CAAA;AAGlD,qBAAqB;AACrB,OAAO,EAAE,eAAe,EAAE,MAAM,cAAc,CAAA;AAG9C,eAAe;AACf,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA;AAG1C,QAAQ;AACR,cAAc,SAAS,CAAA;AAEvB,aAAa;AACb,cAAc,cAAc,CAAA"}
@@ -1,21 +1,26 @@
1
1
  import type { ReactNode } from 'react';
2
- interface User {
2
+ import { type AuthUser } from './store';
3
+ /**
4
+ * Lightweight legacy user shape returned by {@link useAuth}.
5
+ *
6
+ * This is a strict subset of {@link AuthUser} kept for backwards-compatibility
7
+ * with consumers written against the original Context-based AuthProvider. New
8
+ * code should consume {@link AuthUser} via `useAuthStore` directly.
9
+ */
10
+ export interface LegacyAuthUser {
3
11
  name: string;
4
12
  email: string;
5
13
  role: string;
6
14
  avatar: string;
7
15
  }
8
- interface AuthContextType {
9
- user: User | null;
10
- login: (email: string, role: string) => void;
11
- logout: () => void;
12
- isAuthenticated: boolean;
13
- }
14
16
  export interface AuthProviderProps {
15
17
  children: ReactNode;
16
18
  /**
17
19
  * localStorage key used to persist the lightweight user object.
18
- * Default: `saas_user`
20
+ *
21
+ * @deprecated The canonical store now manages persistence under
22
+ * `AUTH_STORAGE_KEYS.USER_STORAGE` / `AUTH_STORAGE_KEYS.ACCESS_TOKEN`. This
23
+ * prop is kept as a no-op for source compatibility.
19
24
  */
20
25
  storageKey?: string;
21
26
  /**
@@ -23,13 +28,58 @@ export interface AuthProviderProps {
23
28
  */
24
29
  signInPath?: string;
25
30
  /**
26
- * Default avatar URL injected into the lightweight user returned by
27
- * `login(email, role)`. Apps can override per-use by calling
28
- * `useAuthStore().setUser()` directly with the full user payload.
31
+ * Default avatar URL injected into the lightweight user produced by the
32
+ * legacy `login(email, role)` helper.
29
33
  */
30
34
  defaultAvatar?: string;
35
+ /**
36
+ * Optional initial user to seed the store with on mount. Useful for SSR /
37
+ * hydration scenarios where the host knows the user before the store has
38
+ * had a chance to read from `localStorage`. Once seeded, all subsequent
39
+ * state lives in the zustand store.
40
+ */
41
+ initialUser?: AuthUser | null;
42
+ /**
43
+ * Optional initial access token to seed the store with on mount. Same
44
+ * SSR/hydration use-case as {@link initialUser}.
45
+ */
46
+ initialAccessToken?: string;
31
47
  }
32
- export declare function AuthProvider({ children, storageKey, signInPath, defaultAvatar, }: AuthProviderProps): import("react/jsx-runtime").JSX.Element;
33
- export declare function useAuth(): AuthContextType;
34
- export {};
48
+ /**
49
+ * Thin wrapper that forwards an optional initial user/token into
50
+ * {@link useAuthStore} on mount. **All state lives in the zustand store** —
51
+ * the provider holds no local state and renders no Context.
52
+ *
53
+ * @deprecated Use `useAuthStore` directly. `AuthProvider` is retained for
54
+ * back-compat and for SSR / initial-state injection. The matching legacy
55
+ * `useAuth` hook reads from the same store, so mounting the provider is
56
+ * purely optional for new code.
57
+ */
58
+ export declare function AuthProvider({ children, initialUser, initialAccessToken, storageKey: _storageKey, }: AuthProviderProps): import("react/jsx-runtime").JSX.Element;
59
+ /**
60
+ * Legacy auth hook. Reads from the canonical {@link useAuthStore} and exposes
61
+ * the original `{ user, login, logout, isAuthenticated }` shape so that
62
+ * consumers written against the pre-store API keep working.
63
+ *
64
+ * Behavioural notes for back-compat:
65
+ * - `user` is projected down to the {@link LegacyAuthUser} subset.
66
+ * - `login(email, role)` builds a minimal user and writes it to the store via
67
+ * `auth.setUser(...)`. Apps that need the full {@link AuthUser} should
68
+ * call `useAuthStore.getState().auth.setUser(fullUser)` themselves.
69
+ * - `logout()` calls `auth.reset()` (which clears both user and token) and
70
+ * navigates to {@link AuthProviderProps.signInPath} (defaults to `/sign-in`).
71
+ *
72
+ * @deprecated Prefer `useAuthStore(state => state.auth.user)` (or the full
73
+ * `auth` slice) for new code. This hook will continue to work — it's a
74
+ * read-through to the same store — but the canonical type is {@link AuthUser}.
75
+ */
76
+ export declare function useAuth(options?: {
77
+ signInPath?: string;
78
+ defaultAvatar?: string;
79
+ }): {
80
+ user: LegacyAuthUser | null;
81
+ login: (email: string, role: string) => void;
82
+ logout: () => void;
83
+ isAuthenticated: boolean;
84
+ };
35
85
  //# sourceMappingURL=provider.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,OAAO,CAAA;AAGtC,UAAU,IAAI;IACZ,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,MAAM,CAAA;IACZ,MAAM,EAAE,MAAM,CAAA;CACf;AAED,UAAU,eAAe;IACvB,IAAI,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;AACH,wBAAgB,YAAY,CAAC,EAC3B,QAAQ,EACR,WAAW,EACX,kBAAkB,EAIlB,UAAU,EAAE,WAAW,GACxB,EAAE,iBAAiB,2CAiBnB;AAED;;;;;;;;;;;;;;;;GAgBG;AACH,wBAAgB,OAAO,CAAC,OAAO,GAAE;IAAE,UAAU,CAAC,EAAE,MAAM,CAAC;IAAC,aAAa,CAAC,EAAE,MAAM,CAAA;CAAO;;mBAc7D,MAAM,QAAQ,MAAM;;;EAuB3C"}
package/dist/provider.js CHANGED
@@ -1,48 +1,86 @@
1
- import { jsx as _jsx } from "react/jsx-runtime";
2
- import { createContext, useContext, useEffect, useState } from 'react';
1
+ import { Fragment as _Fragment, jsx as _jsx } from "react/jsx-runtime";
2
+ import { useEffect, useRef } from 'react';
3
3
  import { useNavigate } from '@tanstack/react-router';
4
- const AuthContext = createContext(undefined);
5
- export function AuthProvider({ children, storageKey = 'saas_user', signInPath = '/sign-in', defaultAvatar = '', }) {
6
- const navigate = useNavigate();
7
- const [user, setUser] = useState(null);
8
- // Load user from localStorage on mount (simple persistence)
4
+ import { useAuthStore } from './store';
5
+ /**
6
+ * Thin wrapper that forwards an optional initial user/token into
7
+ * {@link useAuthStore} on mount. **All state lives in the zustand store** —
8
+ * the provider holds no local state and renders no Context.
9
+ *
10
+ * @deprecated Use `useAuthStore` directly. `AuthProvider` is retained for
11
+ * back-compat and for SSR / initial-state injection. The matching legacy
12
+ * `useAuth` hook reads from the same store, so mounting the provider is
13
+ * purely optional for new code.
14
+ */
15
+ export function AuthProvider({ children, initialUser, initialAccessToken,
16
+ // storageKey is intentionally accepted but unused: kept in the signature
17
+ // so existing consumers don't break, and so editors still surface it as a
18
+ // prop with a deprecation hint via JSDoc.
19
+ storageKey: _storageKey, }) {
20
+ const seededRef = useRef(false);
9
21
  useEffect(() => {
10
- const storedUser = localStorage.getItem(storageKey);
11
- if (storedUser) {
12
- try {
13
- setUser(JSON.parse(storedUser));
14
- }
15
- catch (e) {
16
- console.error('Failed to parse user from storage', e);
17
- }
22
+ if (seededRef.current)
23
+ return;
24
+ seededRef.current = true;
25
+ const { auth } = useAuthStore.getState();
26
+ if (initialUser !== undefined && auth.user == null) {
27
+ auth.setUser(initialUser);
28
+ }
29
+ if (initialAccessToken && !auth.accessToken) {
30
+ auth.setAccessToken(initialAccessToken);
18
31
  }
19
- }, [storageKey]);
32
+ }, [initialUser, initialAccessToken]);
33
+ return _jsx(_Fragment, { children: children });
34
+ }
35
+ /**
36
+ * Legacy auth hook. Reads from the canonical {@link useAuthStore} and exposes
37
+ * the original `{ user, login, logout, isAuthenticated }` shape so that
38
+ * consumers written against the pre-store API keep working.
39
+ *
40
+ * Behavioural notes for back-compat:
41
+ * - `user` is projected down to the {@link LegacyAuthUser} subset.
42
+ * - `login(email, role)` builds a minimal user and writes it to the store via
43
+ * `auth.setUser(...)`. Apps that need the full {@link AuthUser} should
44
+ * call `useAuthStore.getState().auth.setUser(fullUser)` themselves.
45
+ * - `logout()` calls `auth.reset()` (which clears both user and token) and
46
+ * navigates to {@link AuthProviderProps.signInPath} (defaults to `/sign-in`).
47
+ *
48
+ * @deprecated Prefer `useAuthStore(state => state.auth.user)` (or the full
49
+ * `auth` slice) for new code. This hook will continue to work — it's a
50
+ * read-through to the same store — but the canonical type is {@link AuthUser}.
51
+ */
52
+ export function useAuth(options = {}) {
53
+ const { signInPath = '/sign-in', defaultAvatar = '' } = options;
54
+ const navigate = useNavigate();
55
+ const user = useAuthStore((state) => state.auth.user);
56
+ const legacyUser = user
57
+ ? {
58
+ name: user.name,
59
+ email: user.email,
60
+ role: user.role,
61
+ avatar: user.avatar ?? defaultAvatar,
62
+ }
63
+ : null;
20
64
  const login = (email, role) => {
21
65
  const emailLocal = email.split('@')[0] ?? email;
22
- const newUser = {
66
+ const next = {
67
+ id: '',
23
68
  name: emailLocal,
24
69
  email,
25
70
  role,
26
71
  avatar: defaultAvatar,
27
72
  };
28
- setUser(newUser);
29
- localStorage.setItem(storageKey, JSON.stringify(newUser));
73
+ useAuthStore.getState().auth.setUser(next);
30
74
  };
31
75
  const logout = () => {
32
- setUser(null);
33
- localStorage.removeItem(storageKey);
34
- localStorage.removeItem('auth-storage');
35
- // Note: host app is expected to have `signInPath` in its route tree; cast to any
36
- // so we don't require callers to register a literal type here.
76
+ useAuthStore.getState().auth.reset();
37
77
  navigate({ to: signInPath });
38
78
  };
39
- return (_jsx(AuthContext.Provider, { value: { user, login, logout, isAuthenticated: !!user }, children: children }));
40
- }
41
- export function useAuth() {
42
- const context = useContext(AuthContext);
43
- if (context === undefined) {
44
- throw new Error('useAuth must be used within an AuthProvider');
45
- }
46
- return context;
79
+ return {
80
+ user: legacyUser,
81
+ login,
82
+ logout,
83
+ isAuthenticated: !!user,
84
+ };
47
85
  }
48
86
  //# sourceMappingURL=provider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"provider.js","sourceRoot":"","sources":["../src/provider.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,aAAa,EAAE,UAAU,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAA;AAEtE,OAAO,EAAE,WAAW,EAAE,MAAM,wBAAwB,CAAA;AAgBpD,MAAM,WAAW,GAAG,aAAa,CAA8B,SAAS,CAAC,CAAA;AAqBzE,MAAM,UAAU,YAAY,CAAC,EAC3B,QAAQ,EACR,UAAU,GAAG,WAAW,EACxB,UAAU,GAAG,UAAU,EACvB,aAAa,GAAG,EAAE,GACA;IAClB,MAAM,QAAQ,GAAG,WAAW,EAAE,CAAA;IAC9B,MAAM,CAAC,IAAI,EAAE,OAAO,CAAC,GAAG,QAAQ,CAAc,IAAI,CAAC,CAAA;IAEnD,4DAA4D;IAC5D,SAAS,CAAC,GAAG,EAAE;QACb,MAAM,UAAU,GAAG,YAAY,CAAC,OAAO,CAAC,UAAU,CAAC,CAAA;QACnD,IAAI,UAAU,EAAE,CAAC;YACf,IAAI,CAAC;gBACH,OAAO,CAAC,IAAI,CAAC,KAAK,CAAC,UAAU,CAAS,C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W,EAAE,CAAA;IAC9B,MAAM,IAAI,GAAG,YAAY,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAA;IAErD,MAAM,UAAU,GAA0B,IAAI;QAC5C,CAAC,CAAC;YACE,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,KAAK,EAAE,IAAI,CAAC,KAAK;YACjB,IAAI,EAAE,IAAI,CAAC,IAAI;YACf,MAAM,EAAE,IAAI,CAAC,MAAM,IAAI,aAAa;SACrC;QACH,CAAC,CAAC,IAAI,CAAA;IAER,MAAM,KAAK,GAAG,CAAC,KAAa,EAAE,IAAY,EAAE,EAAE;QAC5C,MAAM,UAAU,GAAG,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,IAAI,KAAK,CAAA;QAC/C,MAAM,IAAI,GAAa;YACrB,EAAE,EAAE,EAAE;YACN,IAAI,EAAE,UAAU;YAChB,KAAK;YACL,IAAI;YACJ,MAAM,EAAE,aAAa;SACtB,CAAA;QACD,YAAY,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,CAAA;IAC5C,CAAC,CAAA;IAED,MAAM,MAAM,GAAG,GAAG,EAAE;QAClB,YAAY,CAAC,QAAQ,EAAE,CAAC,IAAI,CAAC,KAAK,EAAE,CAAA;QACpC,QAAQ,CAAC,EAAE,EAAE,EAAE,UAAmB,EAAE,CAAC,CAAA;IACvC,CAAC,CAAA;IAED,OAAO;QACL,IAAI,EAAE,UAAU;QAChB,KAAK;QACL,MAAM;QACN,eAAe,EAAE,CAAC,CAAC,IAAI;KACxB,CAAA;AACH,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@asteby/metacore-auth",
3
- "version": "6.0.0",
3
+ "version": "7.1.0",
4
4
  "description": "Metacore auth kit — Zustand store, API client factory, login/signup/forgot pages, guards for TanStack Router",
5
5
  "license": "Apache-2.0",
6
6
  "repository": {
@@ -63,7 +63,7 @@
63
63
  "@tanstack/react-router": ">=1.100",
64
64
  "framer-motion": ">=10",
65
65
  "zustand": ">=5",
66
- "@asteby/metacore-ui": "^0.7.0"
66
+ "@asteby/metacore-ui": "^2.0.0"
67
67
  },
68
68
  "peerDependenciesMeta": {
69
69
  "framer-motion": {
@@ -71,9 +71,9 @@
71
71
  }
72
72
  },
73
73
  "dependencies": {
74
- "@hookform/resolvers": "^3.9.0",
74
+ "@hookform/resolvers": "^5.0.0",
75
75
  "axios": "^1.7.7",
76
- "lucide-react": "^0.460.0",
76
+ "lucide-react": "^1.0.0",
77
77
  "react-hook-form": "^7.72.0",
78
78
  "zod": "^4.3.0"
79
79
  },
@@ -84,9 +84,10 @@
84
84
  "framer-motion": "^12.0.0",
85
85
  "react": "^19.2.4",
86
86
  "react-dom": "^19.2.4",
87
- "typescript": "^5.6.0",
87
+ "typescript": "^6.0.0",
88
+ "vitest": "^4.0.0",
88
89
  "zustand": "^5.0.0",
89
- "@asteby/metacore-ui": "0.7.0"
90
+ "@asteby/metacore-ui": "2.0.0"
90
91
  },
91
92
  "publishConfig": {
92
93
  "access": "public"
@@ -95,6 +96,7 @@
95
96
  "build": "tsc -p tsconfig.json",
96
97
  "dev": "tsc -w -p tsconfig.json",
97
98
  "typecheck": "tsc -p tsconfig.json --noEmit",
99
+ "test": "vitest run",
98
100
  "clean": "rm -rf dist"
99
101
  }
100
102
  }