@atzentis/auth-react 0.0.2 → 0.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.
Files changed (3) hide show
  1. package/LICENSE +21 -0
  2. package/README.md +71 -0
  3. package/package.json +19 -2
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2025 Atzentis
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.
package/README.md ADDED
@@ -0,0 +1,71 @@
1
+ # @atzentis/auth-react
2
+
3
+ React hooks and components for [Atzentis Authentication](https://auth.atzentis.com).
4
+
5
+ ## Installation
6
+
7
+ ```bash
8
+ pnpm add @atzentis/auth-sdk @atzentis/auth-react
9
+ ```
10
+
11
+ ## Quick Start
12
+
13
+ Wrap your app with `AuthProvider`:
14
+
15
+ ```tsx
16
+ import { AuthProvider } from "@atzentis/auth-react";
17
+
18
+ export default function RootLayout({ children }) {
19
+ return (
20
+ <AuthProvider
21
+ apiKey={process.env.NEXT_PUBLIC_AUTH_API_KEY}
22
+ baseUrl="https://auth.atzentis.com"
23
+ >
24
+ {children}
25
+ </AuthProvider>
26
+ );
27
+ }
28
+ ```
29
+
30
+ Use hooks in your components:
31
+
32
+ ```tsx
33
+ import { useAuth, useSession } from "@atzentis/auth-react";
34
+
35
+ function Dashboard() {
36
+ const { login, logout } = useAuth();
37
+ const { session, isLoading } = useSession();
38
+
39
+ if (isLoading) return <Spinner />;
40
+ if (!session) return <button onClick={() => login({ email, password })}>Login</button>;
41
+
42
+ return (
43
+ <div>
44
+ <p>Welcome, {session.user.name}</p>
45
+ <button onClick={logout}>Logout</button>
46
+ </div>
47
+ );
48
+ }
49
+ ```
50
+
51
+ ## Hooks
52
+
53
+ | Hook | Purpose |
54
+ | --- | --- |
55
+ | `useAuth` | Login, signup, logout, loading, error |
56
+ | `useSession` | Current session data |
57
+ | `useUser` | Current user profile |
58
+
59
+ ## Peer Dependencies
60
+
61
+ - `react` >= 18.0.0
62
+ - `react-dom` >= 18.0.0
63
+
64
+ ## Related Packages
65
+
66
+ - [`@atzentis/auth-sdk`](https://www.npmjs.com/package/@atzentis/auth-sdk) - Core SDK (required)
67
+ - [`@atzentis/auth-expo`](https://www.npmjs.com/package/@atzentis/auth-expo) - Expo/React Native bindings
68
+
69
+ ## License
70
+
71
+ MIT
package/package.json CHANGED
@@ -1,6 +1,23 @@
1
1
  {
2
2
  "name": "@atzentis/auth-react",
3
- "version": "0.0.2",
3
+ "version": "0.0.4",
4
+ "description": "Atzentis Auth React — hooks and components for auth.atzentis.com",
5
+ "keywords": [
6
+ "atzentis",
7
+ "auth",
8
+ "react",
9
+ "hooks",
10
+ "authentication",
11
+ "typescript"
12
+ ],
13
+ "license": "MIT",
14
+ "author": "Atzentis <dev@atzentis.com> (https://atzentis.com)",
15
+ "homepage": "https://github.com/atzentis/atzentis-auth-sdk/tree/main/packages/react#readme",
16
+ "repository": {
17
+ "type": "git",
18
+ "url": "git+https://github.com/atzentis/atzentis-auth-sdk.git",
19
+ "directory": "packages/react"
20
+ },
4
21
  "type": "module",
5
22
  "main": "./dist/index.js",
6
23
  "types": "./dist/index.d.ts",
@@ -17,7 +34,7 @@
17
34
  "LICENSE"
18
35
  ],
19
36
  "dependencies": {
20
- "@atzentis/auth-sdk": "0.0.2"
37
+ "@atzentis/auth-sdk": "0.0.4"
21
38
  },
22
39
  "peerDependencies": {
23
40
  "react": ">=18.0.0",