🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

@captchafox/react

Package Overview
Dependencies
Maintainers
2
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@captchafox/react - npm Package Compare versions

Comparing version

to
1.9.0

21

dist/index.js

@@ -99,2 +99,4 @@ "use client";

const executeTimeout = useRef();
const scriptErrorListener = useRef();
const hasScriptError = useRef(false);
useImperativeHandle(

@@ -127,2 +129,5 @@ ref,

execute: () => __async(void 0, null, function* () {
if (hasScriptError.current) {
return Promise.reject(new RetryError());
}
if (!isApiReady() || !widgetId) {

@@ -149,3 +154,5 @@ return waitAndExecute();

useEffect(() => {
return () => clearTimeout(executeTimeout.current);
return () => {
clearEvents();
};
}, []);

@@ -165,3 +172,6 @@ useEffect(() => {

})).catch((err) => {
var _a;
onError == null ? void 0 : onError(err);
hasScriptError.current = true;
(_a = scriptErrorListener.current) == null ? void 0 : _a.call(scriptErrorListener);
console.error("[CaptchaFox] Could not load script:", err);

@@ -171,4 +181,11 @@ });

}, [containerRef, sitekey, lang, mode]);
const clearEvents = () => {
clearTimeout(executeTimeout.current);
};
const waitAndExecute = () => {
return new Promise((resolve, reject) => {
scriptErrorListener.current = () => {
clearEvents();
reject(new RetryError());
};
executeTimeout.current = setTimeout(() => {

@@ -178,3 +195,3 @@ reject(new TimeoutError("Execute timed out"));

onReady.current = (id) => {
clearTimeout(executeTimeout.current);
clearEvents();
window.captchafox.execute(id).then(resolve).catch((error) => {

@@ -181,0 +198,0 @@ const errorType = getErrorType(error);

2

package.json
{
"name": "@captchafox/react",
"version": "1.8.0",
"version": "1.9.0",
"main": "./dist/index.cjs",

@@ -5,0 +5,0 @@ "module": "./dist/index.js",

Sorry, the diff of this file is not supported yet