@atzentis/auth-react 0.0.14 → 0.0.16

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.
@@ -0,0 +1,65 @@
1
+ type AccountViewSection = "/account" | "/security" | "/sessions" | "/providers" | "/api-keys" | "/danger";
2
+ type AuthViewPath = "/sign-in" | "/sign-up" | "/forgot-password" | "/reset-password" | "/verify-email" | "/email-otp" | "/recover-account" | "/two-factor";
3
+
4
+ /**
5
+ * Default path mapping for AuthView component.
6
+ * Maps logical auth flow paths to actual URL paths.
7
+ *
8
+ * @example
9
+ * // Use in Next.js App Router:
10
+ * <AuthView pathname={pathname} paths={authViewPaths} />
11
+ *
12
+ * // Override specific paths:
13
+ * <AuthView
14
+ * pathname={pathname}
15
+ * paths={{ ...authViewPaths, "/sign-in": "/login" }}
16
+ * />
17
+ */
18
+ declare const authViewPaths: Record<AuthViewPath, string>;
19
+
20
+ /**
21
+ * Default section mapping for AccountView component.
22
+ * Maps logical settings sections to URL paths.
23
+ *
24
+ * @example
25
+ * // Use in Next.js App Router:
26
+ * <AccountView section={pathname} sections={accountViewSections} />
27
+ *
28
+ * // Override specific sections:
29
+ * <AccountView
30
+ * section={pathname}
31
+ * sections={{ ...accountViewSections, "/account": "/profile" }}
32
+ * />
33
+ */
34
+ declare const accountViewSections: Record<AccountViewSection, string>;
35
+
36
+ /**
37
+ * Generate static params for Next.js `generateStaticParams()`.
38
+ * Returns an array of `{ slug: string[] }` for all auth view paths.
39
+ *
40
+ * @example
41
+ * // app/auth/[...slug]/page.tsx
42
+ * import { generateAuthViewParams } from "@atzentis/auth-react/server";
43
+ *
44
+ * export function generateStaticParams() {
45
+ * return generateAuthViewParams();
46
+ * }
47
+ *
48
+ * @example
49
+ * // app/(auth)/[...slug]/page.tsx
50
+ * export default function AuthPage({ params, searchParams }) {
51
+ * const pathname = `/${params.slug?.join("/") || ""}`;
52
+ * return (
53
+ * <AuthView
54
+ * pathname={pathname}
55
+ * searchParams={searchParams}
56
+ * redirectUrl="/dashboard"
57
+ * />
58
+ * );
59
+ * }
60
+ */
61
+ declare function generateAuthViewParams(): Array<{
62
+ slug: string[];
63
+ }>;
64
+
65
+ export { type AccountViewSection, type AuthViewPath, accountViewSections, authViewPaths, generateAuthViewParams };
package/dist/server.js ADDED
@@ -0,0 +1,34 @@
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/components/settings/account-view-sections.ts
14
+ var accountViewSections = {
15
+ "/account": "/account",
16
+ "/security": "/security",
17
+ "/sessions": "/sessions",
18
+ "/providers": "/providers",
19
+ "/api-keys": "/api-keys",
20
+ "/danger": "/danger"
21
+ };
22
+
23
+ // src/server.ts
24
+ function generateAuthViewParams() {
25
+ const values = Object.values(authViewPaths);
26
+ return values.map((path) => ({
27
+ // Remove leading slash and split by "/"
28
+ slug: path.replace(/^\//, "").split("/")
29
+ }));
30
+ }
31
+
32
+ export { accountViewSections, authViewPaths, generateAuthViewParams };
33
+ //# sourceMappingURL=server.js.map
34
+ //# sourceMappingURL=server.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/components/auth/auth-view-paths.ts","../src/components/settings/account-view-sections.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;;;ACTO,IAAM,mBAAA,GAA0D;AAAA,EACrE,UAAA,EAAY,UAAA;AAAA,EACZ,WAAA,EAAa,WAAA;AAAA,EACb,WAAA,EAAa,WAAA;AAAA,EACb,YAAA,EAAc,YAAA;AAAA,EACd,WAAA,EAAa,WAAA;AAAA,EACb,SAAA,EAAW;AACb;;;ACWO,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","import type { AccountViewSection } from \"../../types/components\";\n\n/**\n * Default section mapping for AccountView component.\n * Maps logical settings sections to URL paths.\n *\n * @example\n * // Use in Next.js App Router:\n * <AccountView section={pathname} sections={accountViewSections} />\n *\n * // Override specific sections:\n * <AccountView\n * section={pathname}\n * sections={{ ...accountViewSections, \"/account\": \"/profile\" }}\n * />\n */\nexport const accountViewSections: Record<AccountViewSection, string> = {\n \"/account\": \"/account\",\n \"/security\": \"/security\",\n \"/sessions\": \"/sessions\",\n \"/providers\": \"/providers\",\n \"/api-keys\": \"/api-keys\",\n \"/danger\": \"/danger\",\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 { accountViewSections } from \"./components/settings/account-view-sections\";\nexport type { AccountViewSection, 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.14",
3
+ "version": "0.0.16",
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.14"
44
+ "@atzentis/auth-sdk": "0.0.16"
41
45
  },
42
46
  "peerDependencies": {
43
47
  "@atzentis/ui-shadcn": ">=0.1.0",