@mindfulauth/core 2.0.0-beta.9 → 3.0.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.
Files changed (47) hide show
  1. package/dist/authScripts/ForgotPasswordScript.astro +64 -0
  2. package/dist/authScripts/LoginScript.astro +209 -0
  3. package/dist/authScripts/MagicLoginScript.astro +62 -0
  4. package/dist/authScripts/MagicRegisterScript.astro +73 -0
  5. package/dist/authScripts/MainScript.astro +236 -0
  6. package/dist/authScripts/RegisterPasswordScript.astro +118 -0
  7. package/dist/authScripts/ResendVerificationScript.astro +51 -0
  8. package/dist/authScripts/ResetPasswordScript.astro +155 -0
  9. package/dist/authScripts/SecurityScript.astro +449 -0
  10. package/dist/authScripts/TurnstileInit.astro +112 -0
  11. package/dist/authScripts/VerifyEmailScript.astro +72 -0
  12. package/dist/authScripts/VerifyMagicLinkScript.astro +195 -0
  13. package/dist/authScripts/index.d.ts +13 -0
  14. package/dist/authScripts/index.d.ts.map +1 -0
  15. package/dist/authScripts/index.js +15 -0
  16. package/dist/components/MAuthEmailInput.astro +12 -0
  17. package/dist/components/MAuthForm.astro +10 -0
  18. package/dist/components/MAuthMessage.astro +8 -0
  19. package/dist/components/MAuthNameInput.astro +11 -0
  20. package/dist/components/MAuthPasswordChangePending.astro +8 -0
  21. package/dist/components/MAuthPasswordInput.astro +12 -0
  22. package/dist/components/MAuthSubmitButton.astro +8 -0
  23. package/dist/components/MAuthTurnstile.astro +11 -0
  24. package/dist/components/MAuthTwoFACodeInput.astro +13 -0
  25. package/dist/components/MAuthTwoFASection.astro +11 -0
  26. package/dist/components/index.d.ts +11 -0
  27. package/dist/components/index.d.ts.map +1 -0
  28. package/dist/components/index.js +13 -0
  29. package/dist/core/auth-handler.d.ts.map +1 -1
  30. package/dist/core/auth-handler.js +2 -6
  31. package/dist/core/auth.d.ts +1 -1
  32. package/dist/core/auth.d.ts.map +1 -1
  33. package/dist/core/auth.js +1 -1
  34. package/dist/core/config.d.ts +1 -2
  35. package/dist/core/config.d.ts.map +1 -1
  36. package/dist/core/config.js +6 -5
  37. package/dist/core/csp.d.ts +2 -2
  38. package/dist/core/csp.js +3 -3
  39. package/dist/core/index.d.ts +5 -7
  40. package/dist/core/index.d.ts.map +1 -1
  41. package/dist/core/index.js +11 -9
  42. package/dist/core/middleware.js +3 -3
  43. package/dist/core/types.d.ts +0 -5
  44. package/dist/core/types.d.ts.map +1 -1
  45. package/dist/layouts/MAuthProtected.astro +56 -0
  46. package/dist/layouts/MAuthPublic.astro +68 -0
  47. package/package.json +17 -12
@@ -0,0 +1,56 @@
1
+ ---
2
+ // Layout for protected pages (dashboard, security settings, etc.)
3
+ //
4
+ // IMPORTANT: This layout must be used on all pages inside [memberid] routes.
5
+ // The middleware enforces authentication. Pair this with ProtectedLayout for
6
+ // navigation and styling.
7
+ //
8
+ // Usage:
9
+ // import MAuthProtected from "@mindfulauth/core/layouts/MAuthProtected.astro";
10
+ // import ProtectedLayout from "@/layouts/ProtectedLayout.astro";
11
+ // <MAuthProtected title="Page Title" scripts={['MAuthSecurityScript']}>
12
+ // <ProtectedLayout>
13
+ // <p>Your content here</p>
14
+ // </ProtectedLayout>
15
+ // </MAuthProtected>
16
+ //
17
+ // Note: Component aliases located in mindfulauth/components/ via @mindfulauth/core/components/*
18
+ //
19
+ import { MAuthMainScript, MAuthSecurityScript } from "../authScripts";
20
+
21
+ type ScriptName = keyof typeof scriptMap;
22
+
23
+ const scriptMap = {
24
+ MAuthSecurityScript: MAuthSecurityScript,
25
+ } as const;
26
+
27
+ interface Props {
28
+ title: string;
29
+ description?: string;
30
+ scripts?: ScriptName[];
31
+ }
32
+
33
+ const { title, description = "Secure Portal", scripts = [] } = Astro.props;
34
+ ---
35
+
36
+ <!doctype html>
37
+ <html lang="en">
38
+ <head>
39
+ <meta charset="UTF-8" />
40
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
41
+ <meta name="description" content={description} />
42
+ <title>{title}</title>
43
+ <MAuthMainScript />
44
+ </head>
45
+ <body>
46
+ <slot />
47
+
48
+ {
49
+ // DO NOT DELETE: Dynamically render scripts based on the scripts prop.
50
+ scripts.map((scriptName) => {
51
+ const Component = scriptMap[scriptName];
52
+ return <Component />;
53
+ })
54
+ }
55
+ </body>
56
+ </html>
@@ -0,0 +1,68 @@
1
+ ---
2
+ // Layout for public authentication pages (login, register, etc.)
3
+ // Component aliases: mindfulauth/components/ via @mindfulauth/core/components/*
4
+ import {
5
+ MAuthMainScript,
6
+ MAuthTurnstileInit,
7
+ MAuthLoginScript,
8
+ MAuthRegisterPasswordScript,
9
+ MAuthForgotPasswordScript,
10
+ MAuthMagicLoginScript,
11
+ MAuthMagicRegisterScript,
12
+ MAuthResendVerificationScript,
13
+ MAuthResetPasswordScript,
14
+ MAuthVerifyEmailScript,
15
+ MAuthVerifyMagicLinkScript,
16
+ } from "../authScripts";
17
+
18
+ type ScriptName = keyof typeof scriptMap;
19
+
20
+ const scriptMap = {
21
+ MAuthTurnstileInit: MAuthTurnstileInit,
22
+ MAuthLoginScript: MAuthLoginScript,
23
+ MAuthRegisterPasswordScript: MAuthRegisterPasswordScript,
24
+ MAuthForgotPasswordScript: MAuthForgotPasswordScript,
25
+ MAuthMagicLoginScript: MAuthMagicLoginScript,
26
+ MAuthMagicRegisterScript: MAuthMagicRegisterScript,
27
+ MAuthResendVerificationScript: MAuthResendVerificationScript,
28
+ MAuthResetPasswordScript: MAuthResetPasswordScript,
29
+ MAuthVerifyEmailScript: MAuthVerifyEmailScript,
30
+ MAuthVerifyMagicLinkScript: MAuthVerifyMagicLinkScript,
31
+ } as const;
32
+
33
+ interface Props {
34
+ title: string;
35
+ description?: string;
36
+ scripts?: ScriptName[];
37
+ }
38
+
39
+ const { title, description = "Secure Portal", scripts = [] } = Astro.props;
40
+ ---
41
+
42
+ <!doctype html>
43
+ <html lang="en">
44
+ <head>
45
+ <meta charset="UTF-8" />
46
+ <meta name="viewport" content="width=device-width, initial-scale=1.0" />
47
+ <meta name="description" content={description} />
48
+ <title>{title}</title>
49
+
50
+ <MAuthMainScript />
51
+ <script
52
+ is:inline
53
+ src="https://challenges.cloudflare.com/turnstile/v0/api.js"
54
+ ></script>
55
+ </head>
56
+ <body>
57
+ <slot />
58
+
59
+ {
60
+ // DO NOT DELETE: Dynamically render requested auth scripts based on the page type.
61
+ // scriptMap maps script names to their Astro components. Each page passes specific scripts it needs.
62
+ scripts.map((scriptName) => {
63
+ const Component = scriptMap[scriptName];
64
+ return <Component />;
65
+ })
66
+ }
67
+ </body>
68
+ </html>
package/package.json CHANGED
@@ -1,20 +1,25 @@
1
1
  {
2
2
  "name": "@mindfulauth/core",
3
- "version": "2.0.0-beta.9",
3
+ "version": "3.0.0",
4
4
  "description": "Mindful Auth core authentication library for Astro 6",
5
5
  "type": "module",
6
- "main": "./dist/core/index.js",
7
- "types": "./dist/core/index.d.ts",
6
+ "sideEffects": false,
8
7
  "exports": {
9
8
  ".": {
10
9
  "types": "./dist/core/index.d.ts",
11
10
  "import": "./dist/core/index.js"
12
11
  },
13
- "./astro": {
14
- "types": "./dist/astro/index.d.ts",
15
- "import": "./dist/astro/index.js"
12
+ "./authScripts": {
13
+ "types": "./dist/authScripts/index.d.ts",
14
+ "import": "./dist/authScripts/index.js"
16
15
  },
17
- "./astro/*.astro": "./dist/astro/*.astro",
16
+ "./authScripts/*.astro": "./dist/authScripts/*.astro",
17
+ "./components": {
18
+ "types": "./dist/components/index.d.ts",
19
+ "import": "./dist/components/index.js"
20
+ },
21
+ "./components/*.astro": "./dist/components/*.astro",
22
+ "./layouts/*.astro": "./dist/layouts/*.astro",
18
23
  "./middleware": {
19
24
  "types": "./dist/core/middleware.d.ts",
20
25
  "import": "./dist/core/middleware.js"
@@ -37,7 +42,7 @@
37
42
  "README.md"
38
43
  ],
39
44
  "scripts": {
40
- "build": "tsc && cp src/astro/*.astro dist/astro/",
45
+ "build": "tsc && mkdir -p dist/authScripts dist/components dist/layouts && cp src/authScripts/*.astro dist/authScripts/ && cp src/components/*.astro dist/components/ && cp src/layouts/*.astro dist/layouts/",
41
46
  "dev": "tsc --watch",
42
47
  "prepublishOnly": "npm run build"
43
48
  },
@@ -51,12 +56,12 @@
51
56
  "author": "Mindful Auth",
52
57
  "license": "MIT",
53
58
  "peerDependencies": {
54
- "astro": "^6.0.0-beta.20"
59
+ "astro": "^6.0.1"
55
60
  },
56
61
  "devDependencies": {
57
- "@cloudflare/workers-types": "^4.20260307.1",
58
- "@types/node": "^25.3.5",
59
- "astro": "^6.0.0-beta.20",
62
+ "@cloudflare/workers-types": "^4.20260313.1",
63
+ "@types/node": "^25.5.0",
64
+ "astro": "^6.0.4",
60
65
  "typescript": "^5.9.3"
61
66
  }
62
67
  }