Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

react-google-recaptcha-hook

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-google-recaptcha-hook - npm Package Compare versions

Comparing version 0.0.3 to 0.1.0

2

dist/react-google-recaptcha-hook.cjs.js

@@ -1,1 +0,1 @@

"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var r=require("react");const s=()=>{var c;typeof window.grecaptcha=="undefined"&&((c=window.___grecaptcha_cfg)!=null||(window.___grecaptcha_cfg={fns:[]}),window.grecaptcha={ready:e=>{window.___grecaptcha_cfg.fns.push(e)}})},d=()=>new Promise(c=>{s(),window.grecaptcha.ready(()=>c(window.grecaptcha))}),l=(c,e)=>{const t=e!=null&&e.language?`&hl=${e.language}`:"",n=e!=null&&e.enterprise?"enterprise.js":"api.js";return`https://www.${e!=null&&e.recaptchaNet?"recaptcha.net":"google.com"}/recaptcha/${n}?render=${c}${t}`},w=(c,e)=>{const t=r.useCallback(()=>{if(document.getElementById(c))return;const a=document.createElement("script");a.async=!0,a.type="text/javascript",a.src=l(c,e),a.id=c,document.getElementsByTagName("head")[0].appendChild(a)},[]),n=r.useCallback(async a=>{var h;const g=await d();return(h=g.execute)==null?void 0:h.call(g,c,{action:a})},[]),u=r.useRef(!1);return r.useEffect(()=>{u.current||(u.current=!0,t())},[t]),{executeGoogleRecaptcha:n,load:t}};exports.generateGrecaptchaSrc=l;exports.getGrecaptcha=d;exports.initGrecaptcha=s;exports.useGoogleReCaptcha=w;
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});var r=require("react");const s=()=>{var c;typeof window.grecaptcha=="undefined"&&((c=window.___grecaptcha_cfg)!=null||(window.___grecaptcha_cfg={fns:[]}),window.grecaptcha={ready:e=>{window.___grecaptcha_cfg.fns.push(e)}})},d=()=>new Promise(c=>{s(),window.grecaptcha.ready(()=>c(window.grecaptcha))}),l=(c,e)=>{const t=e!=null&&e.language?`&hl=${e.language}`:"",n=e!=null&&e.enterprise?"enterprise.js":"api.js";return`https://www.${e!=null&&e.recaptchaNet?"recaptcha.net":"google.com"}/recaptcha/${n}?render=${c}${t}`},w=(c,e)=>{const t=r.useCallback(()=>{if(document.getElementById(c))return;const a=document.createElement("script");a.async=!0,a.type="text/javascript",a.src=l(c,e),a.id=c,document.getElementsByTagName("head")[0].appendChild(a)},[]),n=r.useCallback(async a=>{var h;const g=await d();return(h=g.execute)==null?void 0:h.call(g,c,{action:a})},[]),u=r.useRef(!1);return r.useEffect(()=>{u.current||(u.current=!0,t())},[t]),{executeGoogleReCaptcha:n,load:t}};exports.generateGrecaptchaSrc=l;exports.getGrecaptcha=d;exports.initGrecaptcha=s;exports.useGoogleReCaptcha=w;

@@ -36,3 +36,3 @@ import { useCallback, useRef, useEffect } from "react";

}, []);
const executeGoogleRecaptcha = useCallback(async (action) => {
const executeGoogleReCaptcha = useCallback(async (action) => {
var _a;

@@ -49,4 +49,4 @@ const grecaptcha = await getGrecaptcha();

}, [load]);
return { executeGoogleRecaptcha, load };
return { executeGoogleReCaptcha, load };
};
export { generateGrecaptchaSrc, getGrecaptcha, initGrecaptcha, useGoogleReCaptcha };

@@ -20,3 +20,3 @@ {

"license": "MIT",
"version": "0.0.3",
"version": "0.1.0",
"files": [

@@ -23,0 +23,0 @@ "dist",

@@ -23,3 +23,3 @@ > **Warning**

enterprise: `${BOOLEAN}`, // optional, true if you want use enterprise edition
recaptchaNet: `${BOOLEAN}`, // optional, true if you want use recapcha.net instead of google.com
recaptchaNet: `${BOOLEAN}`, // optional, true if you want use recaptcha.net instead of google.com
});

@@ -26,0 +26,0 @@

@@ -32,3 +32,3 @@ declare global {

}) => {
executeGoogleRecaptcha: (action: string) => Promise<string | undefined>;
executeGoogleReCaptcha: (action: string) => Promise<string | undefined>;
load: () => void;

@@ -35,0 +35,0 @@ };

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc