@aifeatures/react 0.1.7 → 0.1.8

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.cjs CHANGED
@@ -37,7 +37,6 @@ function AifeaturesCaptcha({
37
37
  className
38
38
  }) {
39
39
  const [sitekey, setSitekey] = (0, import_react.useState)(null);
40
- const [token, setToken] = (0, import_react.useState)("");
41
40
  const [isLoading, setIsLoading] = (0, import_react.useState)(true);
42
41
  (0, import_react.useEffect)(() => {
43
42
  setIsLoading(true);
@@ -48,34 +47,19 @@ function AifeaturesCaptcha({
48
47
  setIsLoading(false);
49
48
  });
50
49
  }, [formId, apiUrl]);
51
- const handleSuccess = (newToken) => {
52
- setToken(newToken);
53
- onVerify?.(newToken);
54
- };
55
- const handleError = () => {
56
- setToken("");
57
- onError?.();
58
- };
59
- const handleExpire = () => {
60
- setToken("");
61
- onError?.();
62
- };
63
- if (isLoading) {
64
- return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "hidden", name: "aifeatures-captcha-token", value: "" });
50
+ if (isLoading || !sitekey) {
51
+ return null;
65
52
  }
66
- return /* @__PURE__ */ (0, import_jsx_runtime.jsxs)("div", { className, children: [
67
- /* @__PURE__ */ (0, import_jsx_runtime.jsx)("input", { type: "hidden", name: "aifeatures-captcha-token", value: token }),
68
- sitekey && /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
69
- import_react_turnstile.Turnstile,
70
- {
71
- siteKey: sitekey,
72
- onSuccess: handleSuccess,
73
- onError: handleError,
74
- onExpire: handleExpire,
75
- options: { theme: "light" }
76
- }
77
- )
78
- ] });
53
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { className, children: /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
54
+ import_react_turnstile.Turnstile,
55
+ {
56
+ siteKey: sitekey,
57
+ onSuccess: onVerify,
58
+ onError,
59
+ onExpire: onError,
60
+ options: { theme: "light" }
61
+ }
62
+ ) });
79
63
  }
80
64
  // Annotate the CommonJS export names for ESM import in node:
81
65
  0 && (module.exports = {
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/index.ts","../src/AifeaturesCaptcha.tsx"],"sourcesContent":["export { AifeaturesCaptcha } from './AifeaturesCaptcha';\nexport type { AifeaturesCaptchaProps } from './AifeaturesCaptcha';\n","import { useState, useEffect } from 'react';\nimport { Turnstile } from '@marsidev/react-turnstile';\n\nexport interface AifeaturesCaptchaProps {\n /** Form ID from aifeatures - used to fetch the Turnstile sitekey */\n formId: string;\n /** Base URL for the aifeatures API (defaults to https://aifeatures.dev) */\n apiUrl?: string;\n /** Called when CAPTCHA verification succeeds */\n onVerify?: (token: string) => void;\n /** Called when CAPTCHA verification fails or expires */\n onError?: () => void;\n /** Additional class name for the container */\n className?: string;\n}\n\ninterface FormConfig {\n id: string;\n name: string;\n endpoint_url: string;\n turnstile_sitekey: string | null;\n}\n\n/**\n * A CAPTCHA component that handles Turnstile verification for aifeatures forms.\n *\n * Drop this into any form to add CAPTCHA protection. It renders:\n * - A hidden input field named \"cf-turnstile-response\" with the verification token\n * - The Turnstile widget (only if CAPTCHA is enabled for the form)\n *\n * @example\n * ```tsx\n * <form action={`https://aifeatures.dev/f/${formId}`} method=\"POST\">\n * <input name=\"email\" type=\"email\" required />\n * <textarea name=\"message\" />\n * <AifeaturesCaptcha formId={formId} />\n * <button type=\"submit\">Send</button>\n * </form>\n * ```\n */\nexport function AifeaturesCaptcha({\n formId,\n apiUrl = 'https://aifeatures.dev',\n onVerify,\n onError,\n className,\n}: AifeaturesCaptchaProps) {\n const [sitekey, setSitekey] = useState<string | null>(null);\n const [token, setToken] = useState('');\n const [isLoading, setIsLoading] = useState(true);\n\n useEffect(() => {\n setIsLoading(true);\n fetch(`${apiUrl}/f/${formId}/config`)\n .then((r) => r.json())\n .then((config: FormConfig) => {\n setSitekey(config.turnstile_sitekey);\n setIsLoading(false);\n })\n .catch(() => {\n setIsLoading(false);\n });\n }, [formId, apiUrl]);\n\n const handleSuccess = (newToken: string) => {\n setToken(newToken);\n onVerify?.(newToken);\n };\n\n const handleError = () => {\n setToken('');\n onError?.();\n };\n\n const handleExpire = () => {\n setToken('');\n onError?.();\n };\n\n // Don't render anything while loading or if CAPTCHA is disabled\n if (isLoading) {\n return <input type=\"hidden\" name=\"aifeatures-captcha-token\" value=\"\" />;\n }\n\n return (\n <div className={className}>\n <input type=\"hidden\" name=\"aifeatures-captcha-token\" value={token} />\n {sitekey && (\n <Turnstile\n siteKey={sitekey}\n onSuccess={handleSuccess}\n onError={handleError}\n onExpire={handleExpire}\n options={{ theme: 'light' }}\n />\n )}\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAoC;AACpC,6BAA0B;AAgFf;AAzCJ,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AACF,GAA2B;AACzB,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAwB,IAAI;AAC1D,QAAM,CAAC,OAAO,QAAQ,QAAI,uBAAS,EAAE;AACrC,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,IAAI;AAE/C,8BAAU,MAAM;AACd,iBAAa,IAAI;AACjB,UAAM,GAAG,MAAM,MAAM,MAAM,SAAS,EACjC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,EACpB,KAAK,CAAC,WAAuB;AAC5B,iBAAW,OAAO,iBAAiB;AACnC,mBAAa,KAAK;AAAA,IACpB,CAAC,EACA,MAAM,MAAM;AACX,mBAAa,KAAK;AAAA,IACpB,CAAC;AAAA,EACL,GAAG,CAAC,QAAQ,MAAM,CAAC;AAEnB,QAAM,gBAAgB,CAAC,aAAqB;AAC1C,aAAS,QAAQ;AACjB,eAAW,QAAQ;AAAA,EACrB;AAEA,QAAM,cAAc,MAAM;AACxB,aAAS,EAAE;AACX,cAAU;AAAA,EACZ;AAEA,QAAM,eAAe,MAAM;AACzB,aAAS,EAAE;AACX,cAAU;AAAA,EACZ;AAGA,MAAI,WAAW;AACb,WAAO,4CAAC,WAAM,MAAK,UAAS,MAAK,4BAA2B,OAAM,IAAG;AAAA,EACvE;AAEA,SACE,6CAAC,SAAI,WACH;AAAA,gDAAC,WAAM,MAAK,UAAS,MAAK,4BAA2B,OAAO,OAAO;AAAA,IAClE,WACC;AAAA,MAAC;AAAA;AAAA,QACC,SAAS;AAAA,QACT,WAAW;AAAA,QACX,SAAS;AAAA,QACT,UAAU;AAAA,QACV,SAAS,EAAE,OAAO,QAAQ;AAAA;AAAA,IAC5B;AAAA,KAEJ;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../src/index.ts","../src/AifeaturesCaptcha.tsx"],"sourcesContent":["export { AifeaturesCaptcha } from './AifeaturesCaptcha';\nexport type { AifeaturesCaptchaProps } from './AifeaturesCaptcha';\n","import { useState, useEffect } from 'react';\nimport { Turnstile } from '@marsidev/react-turnstile';\n\nexport interface AifeaturesCaptchaProps {\n /** Form ID from aifeatures - used to fetch the Turnstile sitekey */\n formId: string;\n /** Base URL for the aifeatures API (defaults to https://aifeatures.dev) */\n apiUrl?: string;\n /** Called when CAPTCHA verification succeeds */\n onVerify?: (token: string) => void;\n /** Called when CAPTCHA verification fails or expires */\n onError?: () => void;\n /** Additional class name for the container */\n className?: string;\n}\n\ninterface FormConfig {\n id: string;\n name: string;\n endpoint_url: string;\n turnstile_sitekey: string | null;\n}\n\n/**\n * A CAPTCHA component that handles Turnstile verification for aifeatures forms.\n *\n * Drop this into any form to add CAPTCHA protection. The Turnstile widget\n * automatically adds a hidden `cf-turnstile-response` input to the form.\n *\n * @example\n * ```tsx\n * <form action={`https://aifeatures.dev/f/${formId}`} method=\"POST\">\n * <input name=\"email\" type=\"email\" required />\n * <textarea name=\"message\" />\n * <AifeaturesCaptcha formId={formId} />\n * <button type=\"submit\">Send</button>\n * </form>\n * ```\n */\nexport function AifeaturesCaptcha({\n formId,\n apiUrl = 'https://aifeatures.dev',\n onVerify,\n onError,\n className,\n}: AifeaturesCaptchaProps) {\n const [sitekey, setSitekey] = useState<string | null>(null);\n const [isLoading, setIsLoading] = useState(true);\n\n useEffect(() => {\n setIsLoading(true);\n fetch(`${apiUrl}/f/${formId}/config`)\n .then((r) => r.json())\n .then((config: FormConfig) => {\n setSitekey(config.turnstile_sitekey);\n setIsLoading(false);\n })\n .catch(() => {\n setIsLoading(false);\n });\n }, [formId, apiUrl]);\n\n if (isLoading || !sitekey) {\n return null;\n }\n\n return (\n <div className={className}>\n <Turnstile\n siteKey={sitekey}\n onSuccess={onVerify}\n onError={onError}\n onExpire={onError}\n options={{ theme: 'light' }}\n />\n </div>\n );\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA;AAAA;AAAA;AAAA;AAAA;;;ACAA,mBAAoC;AACpC,6BAA0B;AAmEpB;AA7BC,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AACF,GAA2B;AACzB,QAAM,CAAC,SAAS,UAAU,QAAI,uBAAwB,IAAI;AAC1D,QAAM,CAAC,WAAW,YAAY,QAAI,uBAAS,IAAI;AAE/C,8BAAU,MAAM;AACd,iBAAa,IAAI;AACjB,UAAM,GAAG,MAAM,MAAM,MAAM,SAAS,EACjC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,EACpB,KAAK,CAAC,WAAuB;AAC5B,iBAAW,OAAO,iBAAiB;AACnC,mBAAa,KAAK;AAAA,IACpB,CAAC,EACA,MAAM,MAAM;AACX,mBAAa,KAAK;AAAA,IACpB,CAAC;AAAA,EACL,GAAG,CAAC,QAAQ,MAAM,CAAC;AAEnB,MAAI,aAAa,CAAC,SAAS;AACzB,WAAO;AAAA,EACT;AAEA,SACE,4CAAC,SAAI,WACH;AAAA,IAAC;AAAA;AAAA,MACC,SAAS;AAAA,MACT,WAAW;AAAA,MACX;AAAA,MACA,UAAU;AAAA,MACV,SAAS,EAAE,OAAO,QAAQ;AAAA;AAAA,EAC5B,GACF;AAEJ;","names":[]}
package/dist/index.d.cts CHANGED
@@ -15,9 +15,8 @@ interface AifeaturesCaptchaProps {
15
15
  /**
16
16
  * A CAPTCHA component that handles Turnstile verification for aifeatures forms.
17
17
  *
18
- * Drop this into any form to add CAPTCHA protection. It renders:
19
- * - A hidden input field named "cf-turnstile-response" with the verification token
20
- * - The Turnstile widget (only if CAPTCHA is enabled for the form)
18
+ * Drop this into any form to add CAPTCHA protection. The Turnstile widget
19
+ * automatically adds a hidden `cf-turnstile-response` input to the form.
21
20
  *
22
21
  * @example
23
22
  * ```tsx
@@ -29,6 +28,6 @@ interface AifeaturesCaptchaProps {
29
28
  * </form>
30
29
  * ```
31
30
  */
32
- declare function AifeaturesCaptcha({ formId, apiUrl, onVerify, onError, className, }: AifeaturesCaptchaProps): react_jsx_runtime.JSX.Element;
31
+ declare function AifeaturesCaptcha({ formId, apiUrl, onVerify, onError, className, }: AifeaturesCaptchaProps): react_jsx_runtime.JSX.Element | null;
33
32
 
34
33
  export { AifeaturesCaptcha, type AifeaturesCaptchaProps };
package/dist/index.d.ts CHANGED
@@ -15,9 +15,8 @@ interface AifeaturesCaptchaProps {
15
15
  /**
16
16
  * A CAPTCHA component that handles Turnstile verification for aifeatures forms.
17
17
  *
18
- * Drop this into any form to add CAPTCHA protection. It renders:
19
- * - A hidden input field named "cf-turnstile-response" with the verification token
20
- * - The Turnstile widget (only if CAPTCHA is enabled for the form)
18
+ * Drop this into any form to add CAPTCHA protection. The Turnstile widget
19
+ * automatically adds a hidden `cf-turnstile-response` input to the form.
21
20
  *
22
21
  * @example
23
22
  * ```tsx
@@ -29,6 +28,6 @@ interface AifeaturesCaptchaProps {
29
28
  * </form>
30
29
  * ```
31
30
  */
32
- declare function AifeaturesCaptcha({ formId, apiUrl, onVerify, onError, className, }: AifeaturesCaptchaProps): react_jsx_runtime.JSX.Element;
31
+ declare function AifeaturesCaptcha({ formId, apiUrl, onVerify, onError, className, }: AifeaturesCaptchaProps): react_jsx_runtime.JSX.Element | null;
33
32
 
34
33
  export { AifeaturesCaptcha, type AifeaturesCaptchaProps };
package/dist/index.js CHANGED
@@ -3,7 +3,7 @@
3
3
  // src/AifeaturesCaptcha.tsx
4
4
  import { useState, useEffect } from "react";
5
5
  import { Turnstile } from "@marsidev/react-turnstile";
6
- import { jsx, jsxs } from "react/jsx-runtime";
6
+ import { jsx } from "react/jsx-runtime";
7
7
  function AifeaturesCaptcha({
8
8
  formId,
9
9
  apiUrl = "https://aifeatures.dev",
@@ -12,7 +12,6 @@ function AifeaturesCaptcha({
12
12
  className
13
13
  }) {
14
14
  const [sitekey, setSitekey] = useState(null);
15
- const [token, setToken] = useState("");
16
15
  const [isLoading, setIsLoading] = useState(true);
17
16
  useEffect(() => {
18
17
  setIsLoading(true);
@@ -23,34 +22,19 @@ function AifeaturesCaptcha({
23
22
  setIsLoading(false);
24
23
  });
25
24
  }, [formId, apiUrl]);
26
- const handleSuccess = (newToken) => {
27
- setToken(newToken);
28
- onVerify?.(newToken);
29
- };
30
- const handleError = () => {
31
- setToken("");
32
- onError?.();
33
- };
34
- const handleExpire = () => {
35
- setToken("");
36
- onError?.();
37
- };
38
- if (isLoading) {
39
- return /* @__PURE__ */ jsx("input", { type: "hidden", name: "aifeatures-captcha-token", value: "" });
25
+ if (isLoading || !sitekey) {
26
+ return null;
40
27
  }
41
- return /* @__PURE__ */ jsxs("div", { className, children: [
42
- /* @__PURE__ */ jsx("input", { type: "hidden", name: "aifeatures-captcha-token", value: token }),
43
- sitekey && /* @__PURE__ */ jsx(
44
- Turnstile,
45
- {
46
- siteKey: sitekey,
47
- onSuccess: handleSuccess,
48
- onError: handleError,
49
- onExpire: handleExpire,
50
- options: { theme: "light" }
51
- }
52
- )
53
- ] });
28
+ return /* @__PURE__ */ jsx("div", { className, children: /* @__PURE__ */ jsx(
29
+ Turnstile,
30
+ {
31
+ siteKey: sitekey,
32
+ onSuccess: onVerify,
33
+ onError,
34
+ onExpire: onError,
35
+ options: { theme: "light" }
36
+ }
37
+ ) });
54
38
  }
55
39
  export {
56
40
  AifeaturesCaptcha
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"sources":["../src/AifeaturesCaptcha.tsx"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { Turnstile } from '@marsidev/react-turnstile';\n\nexport interface AifeaturesCaptchaProps {\n /** Form ID from aifeatures - used to fetch the Turnstile sitekey */\n formId: string;\n /** Base URL for the aifeatures API (defaults to https://aifeatures.dev) */\n apiUrl?: string;\n /** Called when CAPTCHA verification succeeds */\n onVerify?: (token: string) => void;\n /** Called when CAPTCHA verification fails or expires */\n onError?: () => void;\n /** Additional class name for the container */\n className?: string;\n}\n\ninterface FormConfig {\n id: string;\n name: string;\n endpoint_url: string;\n turnstile_sitekey: string | null;\n}\n\n/**\n * A CAPTCHA component that handles Turnstile verification for aifeatures forms.\n *\n * Drop this into any form to add CAPTCHA protection. It renders:\n * - A hidden input field named \"cf-turnstile-response\" with the verification token\n * - The Turnstile widget (only if CAPTCHA is enabled for the form)\n *\n * @example\n * ```tsx\n * <form action={`https://aifeatures.dev/f/${formId}`} method=\"POST\">\n * <input name=\"email\" type=\"email\" required />\n * <textarea name=\"message\" />\n * <AifeaturesCaptcha formId={formId} />\n * <button type=\"submit\">Send</button>\n * </form>\n * ```\n */\nexport function AifeaturesCaptcha({\n formId,\n apiUrl = 'https://aifeatures.dev',\n onVerify,\n onError,\n className,\n}: AifeaturesCaptchaProps) {\n const [sitekey, setSitekey] = useState<string | null>(null);\n const [token, setToken] = useState('');\n const [isLoading, setIsLoading] = useState(true);\n\n useEffect(() => {\n setIsLoading(true);\n fetch(`${apiUrl}/f/${formId}/config`)\n .then((r) => r.json())\n .then((config: FormConfig) => {\n setSitekey(config.turnstile_sitekey);\n setIsLoading(false);\n })\n .catch(() => {\n setIsLoading(false);\n });\n }, [formId, apiUrl]);\n\n const handleSuccess = (newToken: string) => {\n setToken(newToken);\n onVerify?.(newToken);\n };\n\n const handleError = () => {\n setToken('');\n onError?.();\n };\n\n const handleExpire = () => {\n setToken('');\n onError?.();\n };\n\n // Don't render anything while loading or if CAPTCHA is disabled\n if (isLoading) {\n return <input type=\"hidden\" name=\"aifeatures-captcha-token\" value=\"\" />;\n }\n\n return (\n <div className={className}>\n <input type=\"hidden\" name=\"aifeatures-captcha-token\" value={token} />\n {sitekey && (\n <Turnstile\n siteKey={sitekey}\n onSuccess={handleSuccess}\n onError={handleError}\n onExpire={handleExpire}\n options={{ theme: 'light' }}\n />\n )}\n </div>\n );\n}\n"],"mappings":";;;AAAA,SAAS,UAAU,iBAAiB;AACpC,SAAS,iBAAiB;AAgFf,cAIP,YAJO;AAzCJ,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AACF,GAA2B;AACzB,QAAM,CAAC,SAAS,UAAU,IAAI,SAAwB,IAAI;AAC1D,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAS,EAAE;AACrC,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAE/C,YAAU,MAAM;AACd,iBAAa,IAAI;AACjB,UAAM,GAAG,MAAM,MAAM,MAAM,SAAS,EACjC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,EACpB,KAAK,CAAC,WAAuB;AAC5B,iBAAW,OAAO,iBAAiB;AACnC,mBAAa,KAAK;AAAA,IACpB,CAAC,EACA,MAAM,MAAM;AACX,mBAAa,KAAK;AAAA,IACpB,CAAC;AAAA,EACL,GAAG,CAAC,QAAQ,MAAM,CAAC;AAEnB,QAAM,gBAAgB,CAAC,aAAqB;AAC1C,aAAS,QAAQ;AACjB,eAAW,QAAQ;AAAA,EACrB;AAEA,QAAM,cAAc,MAAM;AACxB,aAAS,EAAE;AACX,cAAU;AAAA,EACZ;AAEA,QAAM,eAAe,MAAM;AACzB,aAAS,EAAE;AACX,cAAU;AAAA,EACZ;AAGA,MAAI,WAAW;AACb,WAAO,oBAAC,WAAM,MAAK,UAAS,MAAK,4BAA2B,OAAM,IAAG;AAAA,EACvE;AAEA,SACE,qBAAC,SAAI,WACH;AAAA,wBAAC,WAAM,MAAK,UAAS,MAAK,4BAA2B,OAAO,OAAO;AAAA,IAClE,WACC;AAAA,MAAC;AAAA;AAAA,QACC,SAAS;AAAA,QACT,WAAW;AAAA,QACX,SAAS;AAAA,QACT,UAAU;AAAA,QACV,SAAS,EAAE,OAAO,QAAQ;AAAA;AAAA,IAC5B;AAAA,KAEJ;AAEJ;","names":[]}
1
+ {"version":3,"sources":["../src/AifeaturesCaptcha.tsx"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { Turnstile } from '@marsidev/react-turnstile';\n\nexport interface AifeaturesCaptchaProps {\n /** Form ID from aifeatures - used to fetch the Turnstile sitekey */\n formId: string;\n /** Base URL for the aifeatures API (defaults to https://aifeatures.dev) */\n apiUrl?: string;\n /** Called when CAPTCHA verification succeeds */\n onVerify?: (token: string) => void;\n /** Called when CAPTCHA verification fails or expires */\n onError?: () => void;\n /** Additional class name for the container */\n className?: string;\n}\n\ninterface FormConfig {\n id: string;\n name: string;\n endpoint_url: string;\n turnstile_sitekey: string | null;\n}\n\n/**\n * A CAPTCHA component that handles Turnstile verification for aifeatures forms.\n *\n * Drop this into any form to add CAPTCHA protection. The Turnstile widget\n * automatically adds a hidden `cf-turnstile-response` input to the form.\n *\n * @example\n * ```tsx\n * <form action={`https://aifeatures.dev/f/${formId}`} method=\"POST\">\n * <input name=\"email\" type=\"email\" required />\n * <textarea name=\"message\" />\n * <AifeaturesCaptcha formId={formId} />\n * <button type=\"submit\">Send</button>\n * </form>\n * ```\n */\nexport function AifeaturesCaptcha({\n formId,\n apiUrl = 'https://aifeatures.dev',\n onVerify,\n onError,\n className,\n}: AifeaturesCaptchaProps) {\n const [sitekey, setSitekey] = useState<string | null>(null);\n const [isLoading, setIsLoading] = useState(true);\n\n useEffect(() => {\n setIsLoading(true);\n fetch(`${apiUrl}/f/${formId}/config`)\n .then((r) => r.json())\n .then((config: FormConfig) => {\n setSitekey(config.turnstile_sitekey);\n setIsLoading(false);\n })\n .catch(() => {\n setIsLoading(false);\n });\n }, [formId, apiUrl]);\n\n if (isLoading || !sitekey) {\n return null;\n }\n\n return (\n <div className={className}>\n <Turnstile\n siteKey={sitekey}\n onSuccess={onVerify}\n onError={onError}\n onExpire={onError}\n options={{ theme: 'light' }}\n />\n </div>\n );\n}\n"],"mappings":";;;AAAA,SAAS,UAAU,iBAAiB;AACpC,SAAS,iBAAiB;AAmEpB;AA7BC,SAAS,kBAAkB;AAAA,EAChC;AAAA,EACA,SAAS;AAAA,EACT;AAAA,EACA;AAAA,EACA;AACF,GAA2B;AACzB,QAAM,CAAC,SAAS,UAAU,IAAI,SAAwB,IAAI;AAC1D,QAAM,CAAC,WAAW,YAAY,IAAI,SAAS,IAAI;AAE/C,YAAU,MAAM;AACd,iBAAa,IAAI;AACjB,UAAM,GAAG,MAAM,MAAM,MAAM,SAAS,EACjC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,EACpB,KAAK,CAAC,WAAuB;AAC5B,iBAAW,OAAO,iBAAiB;AACnC,mBAAa,KAAK;AAAA,IACpB,CAAC,EACA,MAAM,MAAM;AACX,mBAAa,KAAK;AAAA,IACpB,CAAC;AAAA,EACL,GAAG,CAAC,QAAQ,MAAM,CAAC;AAEnB,MAAI,aAAa,CAAC,SAAS;AACzB,WAAO;AAAA,EACT;AAEA,SACE,oBAAC,SAAI,WACH;AAAA,IAAC;AAAA;AAAA,MACC,SAAS;AAAA,MACT,WAAW;AAAA,MACX;AAAA,MACA,UAAU;AAAA,MACV,SAAS,EAAE,OAAO,QAAQ;AAAA;AAAA,EAC5B,GACF;AAEJ;","names":[]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@aifeatures/react",
3
- "version": "0.1.7",
3
+ "version": "0.1.8",
4
4
  "description": "React CAPTCHA component for aifeatures forms using Cloudflare Turnstile",
5
5
  "type": "module",
6
6
  "main": "./dist/index.cjs",