@atzentis/auth-react 0.0.14 → 0.0.15
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/dist/index.d.ts +300 -29
- package/dist/index.js +1783 -301
- package/dist/index.js.map +1 -1
- package/dist/server.d.ts +48 -0
- package/dist/server.js +24 -0
- package/dist/server.js.map +1 -0
- package/package.json +6 -2
package/dist/server.d.ts
ADDED
|
@@ -0,0 +1,48 @@
|
|
|
1
|
+
type AuthViewPath = "/sign-in" | "/sign-up" | "/forgot-password" | "/reset-password" | "/verify-email" | "/email-otp" | "/recover-account" | "/two-factor";
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Default path mapping for AuthView component.
|
|
5
|
+
* Maps logical auth flow paths to actual URL paths.
|
|
6
|
+
*
|
|
7
|
+
* @example
|
|
8
|
+
* // Use in Next.js App Router:
|
|
9
|
+
* <AuthView pathname={pathname} paths={authViewPaths} />
|
|
10
|
+
*
|
|
11
|
+
* // Override specific paths:
|
|
12
|
+
* <AuthView
|
|
13
|
+
* pathname={pathname}
|
|
14
|
+
* paths={{ ...authViewPaths, "/sign-in": "/login" }}
|
|
15
|
+
* />
|
|
16
|
+
*/
|
|
17
|
+
declare const authViewPaths: Record<AuthViewPath, string>;
|
|
18
|
+
|
|
19
|
+
/**
|
|
20
|
+
* Generate static params for Next.js `generateStaticParams()`.
|
|
21
|
+
* Returns an array of `{ slug: string[] }` for all auth view paths.
|
|
22
|
+
*
|
|
23
|
+
* @example
|
|
24
|
+
* // app/auth/[...slug]/page.tsx
|
|
25
|
+
* import { generateAuthViewParams } from "@atzentis/auth-react/server";
|
|
26
|
+
*
|
|
27
|
+
* export function generateStaticParams() {
|
|
28
|
+
* return generateAuthViewParams();
|
|
29
|
+
* }
|
|
30
|
+
*
|
|
31
|
+
* @example
|
|
32
|
+
* // app/(auth)/[...slug]/page.tsx
|
|
33
|
+
* export default function AuthPage({ params, searchParams }) {
|
|
34
|
+
* const pathname = `/${params.slug?.join("/") || ""}`;
|
|
35
|
+
* return (
|
|
36
|
+
* <AuthView
|
|
37
|
+
* pathname={pathname}
|
|
38
|
+
* searchParams={searchParams}
|
|
39
|
+
* redirectUrl="/dashboard"
|
|
40
|
+
* />
|
|
41
|
+
* );
|
|
42
|
+
* }
|
|
43
|
+
*/
|
|
44
|
+
declare function generateAuthViewParams(): Array<{
|
|
45
|
+
slug: string[];
|
|
46
|
+
}>;
|
|
47
|
+
|
|
48
|
+
export { type AuthViewPath, authViewPaths, generateAuthViewParams };
|
package/dist/server.js
ADDED
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
// src/components/auth/auth-view-paths.ts
|
|
2
|
+
var authViewPaths = {
|
|
3
|
+
"/sign-in": "/sign-in",
|
|
4
|
+
"/sign-up": "/sign-up",
|
|
5
|
+
"/forgot-password": "/forgot-password",
|
|
6
|
+
"/reset-password": "/reset-password",
|
|
7
|
+
"/verify-email": "/verify-email",
|
|
8
|
+
"/email-otp": "/email-otp",
|
|
9
|
+
"/recover-account": "/recover-account",
|
|
10
|
+
"/two-factor": "/two-factor"
|
|
11
|
+
};
|
|
12
|
+
|
|
13
|
+
// src/server.ts
|
|
14
|
+
function generateAuthViewParams() {
|
|
15
|
+
const values = Object.values(authViewPaths);
|
|
16
|
+
return values.map((path) => ({
|
|
17
|
+
// Remove leading slash and split by "/"
|
|
18
|
+
slug: path.replace(/^\//, "").split("/")
|
|
19
|
+
}));
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
export { authViewPaths, generateAuthViewParams };
|
|
23
|
+
//# sourceMappingURL=server.js.map
|
|
24
|
+
//# sourceMappingURL=server.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/components/auth/auth-view-paths.ts","../src/server.ts"],"names":[],"mappings":";AAgBO,IAAM,aAAA,GAA8C;AAAA,EACzD,UAAA,EAAY,UAAA;AAAA,EACZ,UAAA,EAAY,UAAA;AAAA,EACZ,kBAAA,EAAoB,kBAAA;AAAA,EACpB,iBAAA,EAAmB,iBAAA;AAAA,EACnB,eAAA,EAAiB,eAAA;AAAA,EACjB,YAAA,EAAc,YAAA;AAAA,EACd,kBAAA,EAAoB,kBAAA;AAAA,EACpB,aAAA,EAAe;AACjB;;;ACQO,SAAS,sBAAA,GAAoD;AAElE,EAAA,MAAM,MAAA,GAAS,MAAA,CAAO,MAAA,CAAO,aAAa,CAAA;AAE1C,EAAA,OAAO,MAAA,CAAO,GAAA,CAAI,CAAC,IAAA,MAAU;AAAA;AAAA,IAE3B,MAAM,IAAA,CAAK,OAAA,CAAQ,OAAO,EAAE,CAAA,CAAE,MAAM,GAAG;AAAA,GACzC,CAAE,CAAA;AACJ","file":"server.js","sourcesContent":["import type { AuthViewPath } from \"../../types/components\";\n\n/**\n * Default path mapping for AuthView component.\n * Maps logical auth flow paths to actual URL paths.\n *\n * @example\n * // Use in Next.js App Router:\n * <AuthView pathname={pathname} paths={authViewPaths} />\n *\n * // Override specific paths:\n * <AuthView\n * pathname={pathname}\n * paths={{ ...authViewPaths, \"/sign-in\": \"/login\" }}\n * />\n */\nexport const authViewPaths: Record<AuthViewPath, string> = {\n \"/sign-in\": \"/sign-in\",\n \"/sign-up\": \"/sign-up\",\n \"/forgot-password\": \"/forgot-password\",\n \"/reset-password\": \"/reset-password\",\n \"/verify-email\": \"/verify-email\",\n \"/email-otp\": \"/email-otp\",\n \"/recover-account\": \"/recover-account\",\n \"/two-factor\": \"/two-factor\",\n};\n","// Server-side utilities for @atzentis/auth-react\n// Use this entry point in Next.js generateStaticParams() or similar server-side code\n\nimport { authViewPaths } from \"./components/auth/auth-view-paths\";\n\nexport { authViewPaths } from \"./components/auth/auth-view-paths\";\nexport type { AuthViewPath } from \"./types/components\";\n\n/**\n * Generate static params for Next.js `generateStaticParams()`.\n * Returns an array of `{ slug: string[] }` for all auth view paths.\n *\n * @example\n * // app/auth/[...slug]/page.tsx\n * import { generateAuthViewParams } from \"@atzentis/auth-react/server\";\n *\n * export function generateStaticParams() {\n * return generateAuthViewParams();\n * }\n *\n * @example\n * // app/(auth)/[...slug]/page.tsx\n * export default function AuthPage({ params, searchParams }) {\n * const pathname = `/${params.slug?.join(\"/\") || \"\"}`;\n * return (\n * <AuthView\n * pathname={pathname}\n * searchParams={searchParams}\n * redirectUrl=\"/dashboard\"\n * />\n * );\n * }\n */\nexport function generateAuthViewParams(): Array<{ slug: string[] }> {\n // Use static import since we're in ESM\n const values = Object.values(authViewPaths);\n\n return values.map((path) => ({\n // Remove leading slash and split by \"/\"\n slug: path.replace(/^\\//, \"\").split(\"/\"),\n }));\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@atzentis/auth-react",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.15",
|
|
4
4
|
"description": "Atzentis Auth React — hooks and components for auth.atzentis.com",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"atzentis",
|
|
@@ -25,6 +25,10 @@
|
|
|
25
25
|
".": {
|
|
26
26
|
"import": "./dist/index.js",
|
|
27
27
|
"types": "./dist/index.d.ts"
|
|
28
|
+
},
|
|
29
|
+
"./server": {
|
|
30
|
+
"import": "./dist/server.js",
|
|
31
|
+
"types": "./dist/server.d.ts"
|
|
28
32
|
}
|
|
29
33
|
},
|
|
30
34
|
"sideEffects": false,
|
|
@@ -37,7 +41,7 @@
|
|
|
37
41
|
"@hookform/resolvers": "^3.9.0",
|
|
38
42
|
"react-hook-form": "^7.53.0",
|
|
39
43
|
"zod": "^3.23.0",
|
|
40
|
-
"@atzentis/auth-sdk": "0.0.
|
|
44
|
+
"@atzentis/auth-sdk": "0.0.15"
|
|
41
45
|
},
|
|
42
46
|
"peerDependencies": {
|
|
43
47
|
"@atzentis/ui-shadcn": ">=0.1.0",
|