@contentgrowth/content-auth 0.3.0 → 0.3.1

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.
@@ -1,21 +1,10 @@
1
1
  import {
2
2
  authClient
3
3
  } from "./chunk-NKDKDBM2.js";
4
- import {
5
- __require
6
- } from "./chunk-R5U7XKVJ.js";
7
4
 
8
5
  // src/frontend/components/AuthForm.tsx
9
6
  import { useState, useRef, useEffect } from "react";
10
7
  import { Fragment, jsx, jsxs } from "react/jsx-runtime";
11
- var TurnstileComponent = null;
12
- var useTurnstile = false;
13
- try {
14
- const turnstileModule = __require("@marsidev/react-turnstile");
15
- TurnstileComponent = turnstileModule.Turnstile;
16
- useTurnstile = true;
17
- } catch (e) {
18
- }
19
8
  var AuthForm = ({
20
9
  client = authClient,
21
10
  onSuccess,
@@ -41,12 +30,16 @@ var AuthForm = ({
41
30
  const [error, setError] = useState(null);
42
31
  const [turnstileToken, setTurnstileToken] = useState(null);
43
32
  const turnstileRef = useRef(null);
33
+ const [TurnstileComponent, setTurnstileComponent] = useState(null);
44
34
  const [mounted, setMounted] = useState(false);
45
35
  useEffect(() => {
46
36
  setMounted(true);
47
37
  setIsLogin(view !== "signup");
48
- }, [view]);
49
- const turnstileEnabled = turnstileSiteKey && useTurnstile && TurnstileComponent;
38
+ if (turnstileSiteKey) {
39
+ import("@marsidev/react-turnstile").then((module) => setTurnstileComponent(() => module.Turnstile)).catch(() => setTurnstileComponent(null));
40
+ }
41
+ }, [view, turnstileSiteKey]);
42
+ const turnstileEnabled = turnstileSiteKey && TurnstileComponent;
50
43
  const turnstileRequired = turnstileEnabled && !isLogin;
51
44
  const canSubmit = !turnstileRequired || !!turnstileToken;
52
45
  const handleTurnstileSuccess = (token) => {
@@ -7,7 +7,7 @@ import {
7
7
  PasswordChanger,
8
8
  ProfileEditor,
9
9
  ResetPasswordForm
10
- } from "../chunk-XL5CRGGU.js";
10
+ } from "../chunk-6MYNRK2N.js";
11
11
  import {
12
12
  authClient,
13
13
  createClient
package/dist/index.js CHANGED
@@ -19,7 +19,7 @@ import {
19
19
  PasswordChanger,
20
20
  ProfileEditor,
21
21
  ResetPasswordForm
22
- } from "./chunk-XL5CRGGU.js";
22
+ } from "./chunk-6MYNRK2N.js";
23
23
  import {
24
24
  authClient,
25
25
  createClient
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@contentgrowth/content-auth",
3
- "version": "0.3.0",
3
+ "version": "0.3.1",
4
4
  "description": "Better Auth wrapper with UI components for Cloudflare Workers & Pages. Includes Turnstile bot protection and email normalization.",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -50,9 +50,9 @@
50
50
  "author": "Content Growth",
51
51
  "license": "MIT",
52
52
  "peerDependencies": {
53
+ "@marsidev/react-turnstile": ">=0.5.0",
53
54
  "react": ">=18.2.0",
54
- "react-dom": ">=18.2.0",
55
- "@marsidev/react-turnstile": ">=0.5.0"
55
+ "react-dom": ">=18.2.0"
56
56
  },
57
57
  "peerDependenciesMeta": {
58
58
  "@marsidev/react-turnstile": {
@@ -67,6 +67,7 @@
67
67
  },
68
68
  "devDependencies": {
69
69
  "@cloudflare/workers-types": "^4.20251231.0",
70
+ "@marsidev/react-turnstile": "^1.4.1",
70
71
  "@types/node": "^25.0.3",
71
72
  "@types/react": "^19.2.7",
72
73
  "@types/react-dom": "^19.2.3",