@captchafox/react 1.0.1 → 1.0.2
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/README.md +7 -7
- package/dist/index.js +3 -3
- package/dist/index.mjs +3 -3
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -33,13 +33,13 @@ function Example() {
|
|
|
33
33
|
| **Prop** | **Type** | **Description** | **Required** |
|
|
34
34
|
| -------- | ----------------------- | ------------------------------------------------------------------------------- | ------------ |
|
|
35
35
|
| sitekey | `string` | The sitekey for the widget | ✅ |
|
|
36
|
-
|
|
|
37
|
-
| mode | `inline\|popup\|hidden` | The mode the widget should be displayed in
|
|
38
|
-
| onVerify | `function` | Called with the response token after successful verification
|
|
39
|
-
| onFail | `function` | Called after unsuccessful verification
|
|
40
|
-
| onError | `function` | Called
|
|
41
|
-
| onExpire | `function` | Called
|
|
42
|
-
| onClose | `function` | Called
|
|
36
|
+
| lang | `string` | The language the widget should display. Defaults to automatically detecting it. | |
|
|
37
|
+
| mode | `inline\|popup\|hidden` | The mode the widget should be displayed in . | |
|
|
38
|
+
| onVerify | `function` | Called with the response token after successful verification. | |
|
|
39
|
+
| onFail | `function` | Called after unsuccessful verification. | |
|
|
40
|
+
| onError | `function` | Called when an error occured. | |
|
|
41
|
+
| onExpire | `function` | Called when the challenge expires. | |
|
|
42
|
+
| onClose | `function` | Called when the challenge was closed. | |
|
|
43
43
|
|
|
44
44
|
### Using the verification callback
|
|
45
45
|
|
package/dist/index.js
CHANGED
|
@@ -75,7 +75,7 @@ var isApiReady = () => typeof (window == null ? void 0 : window.captchafox) !==
|
|
|
75
75
|
var import_react = require("react");
|
|
76
76
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
77
77
|
var CaptchaFox = (0, import_react.forwardRef)(
|
|
78
|
-
({ sitekey,
|
|
78
|
+
({ sitekey, lang, mode, className, onError, onVerify, onLoad, onFail, onClose }, ref) => {
|
|
79
79
|
const [containerRef, setContainerRef] = (0, import_react.useState)();
|
|
80
80
|
const [widgetId, setWidgetId] = (0, import_react.useState)();
|
|
81
81
|
const firstRendered = (0, import_react.useRef)(false);
|
|
@@ -121,7 +121,7 @@ var CaptchaFox = (0, import_react.forwardRef)(
|
|
|
121
121
|
if (!containerRef || ((_b = containerRef == null ? void 0 : containerRef.children) == null ? void 0 : _b.length) === 1)
|
|
122
122
|
return;
|
|
123
123
|
const newWidgetId = yield (_c = window.captchafox) == null ? void 0 : _c.render(containerRef, {
|
|
124
|
-
|
|
124
|
+
lang,
|
|
125
125
|
sitekey,
|
|
126
126
|
mode,
|
|
127
127
|
onError,
|
|
@@ -150,7 +150,7 @@ var CaptchaFox = (0, import_react.forwardRef)(
|
|
|
150
150
|
console.error("[CaptchaFox] Could not load script:", err);
|
|
151
151
|
});
|
|
152
152
|
}
|
|
153
|
-
}, [containerRef, sitekey,
|
|
153
|
+
}, [containerRef, sitekey, lang, mode]);
|
|
154
154
|
return /* @__PURE__ */ (0, import_jsx_runtime.jsx)("div", { ref: setContainerRef, id: widgetId, className });
|
|
155
155
|
}
|
|
156
156
|
);
|
package/dist/index.mjs
CHANGED
|
@@ -49,7 +49,7 @@ var isApiReady = () => typeof (window == null ? void 0 : window.captchafox) !==
|
|
|
49
49
|
import { forwardRef, useEffect, useImperativeHandle, useRef, useState } from "react";
|
|
50
50
|
import { jsx } from "react/jsx-runtime";
|
|
51
51
|
var CaptchaFox = forwardRef(
|
|
52
|
-
({ sitekey,
|
|
52
|
+
({ sitekey, lang, mode, className, onError, onVerify, onLoad, onFail, onClose }, ref) => {
|
|
53
53
|
const [containerRef, setContainerRef] = useState();
|
|
54
54
|
const [widgetId, setWidgetId] = useState();
|
|
55
55
|
const firstRendered = useRef(false);
|
|
@@ -95,7 +95,7 @@ var CaptchaFox = forwardRef(
|
|
|
95
95
|
if (!containerRef || ((_b = containerRef == null ? void 0 : containerRef.children) == null ? void 0 : _b.length) === 1)
|
|
96
96
|
return;
|
|
97
97
|
const newWidgetId = yield (_c = window.captchafox) == null ? void 0 : _c.render(containerRef, {
|
|
98
|
-
|
|
98
|
+
lang,
|
|
99
99
|
sitekey,
|
|
100
100
|
mode,
|
|
101
101
|
onError,
|
|
@@ -124,7 +124,7 @@ var CaptchaFox = forwardRef(
|
|
|
124
124
|
console.error("[CaptchaFox] Could not load script:", err);
|
|
125
125
|
});
|
|
126
126
|
}
|
|
127
|
-
}, [containerRef, sitekey,
|
|
127
|
+
}, [containerRef, sitekey, lang, mode]);
|
|
128
128
|
return /* @__PURE__ */ jsx("div", { ref: setContainerRef, id: widgetId, className });
|
|
129
129
|
}
|
|
130
130
|
);
|