react-recaptcha-x
Advanced tools
Comparing version 1.1.13 to 1.1.14
@@ -69,3 +69,3 @@ # Contributing to react-recaptcha-x | ||
1. [nodejs](https://nodejs.org/en/) 10.x.x LTS | ||
1. [nodejs](https://nodejs.org/en/) 16.x.x LTS | ||
@@ -72,0 +72,0 @@ ### Development Setup |
@@ -0,1 +1,9 @@ | ||
## [1.1.14](https://github.com/antokara/react-recaptcha-x/compare/v1.1.13...v1.1.14) (2022-09-18) | ||
### Bug Fixes | ||
* **npm audit:** resolve all issues ([72c7e0c](https://github.com/antokara/react-recaptcha-x/commit/72c7e0c2897573ef26e31e9c5554ffa8c67966c5)) | ||
* **npm-packages:** upgrade ([4c288ac](https://github.com/antokara/react-recaptcha-x/commit/4c288aca971cb55ff4b76766050de4271554d2fc)) | ||
## [1.1.13](https://github.com/antokara/react-recaptcha-x/compare/v1.1.12...v1.1.13) (2021-07-07) | ||
@@ -2,0 +10,0 @@ |
@@ -1,1 +0,1 @@ | ||
(()=>{"use strict";var e={411:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Context=void 0;const r=o(297).createContext({siteKeyV2:"",siteKeyV3:"",loaded:!1});t.Context=r},644:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ReCaptchaProvider=void 0;const r=o(297),n=o(411);class a extends r.Component{constructor(e){super(e),this.state={loaded:!1},this.onLoadHandler=this.onLoadHandler.bind(this)}componentDidMount(){const{siteKeyV3:e="explicit",langCode:t="",hideV3Badge:o=!1}=this.props,r="react-recaptcha-v3-v2-script";if(null===document.querySelector(`script[data-id="${r}"]`)){window.GoogleReCaptcha_onload=this.onLoadHandler;const o=document.createElement("script");o.setAttribute("data-id",r),o.setAttribute("src",`https://www.google.com/recaptcha/api.js?render=${e}&onload=GoogleReCaptcha_onload&hl=${t}`),o.setAttribute("async","true"),o.setAttribute("defer","true"),document.body.appendChild(o)}else window.GoogleReCaptcha_onload?window.GoogleReCaptcha_onload=this.onLoadHandler:this.setState({loaded:!0});const n="react-recaptcha-v3-v2-style";if(o&&null===document.querySelector(`style[data-id="${n}"]`)){const e=document.createElement("style");e.innerHTML=".grecaptcha-badge{display: none;}",e.setAttribute("data-id",n),document.body.appendChild(e)}}componentWillUnmount(){window.GoogleReCaptcha_onload&&(window.GoogleReCaptcha_onload=()=>{delete window.GoogleReCaptcha_onload})}render(){const{children:e,siteKeyV3:t,siteKeyV2:o}=this.props,{loaded:a}=this.state,i={siteKeyV2:o,siteKeyV3:t,loaded:a};return r.createElement(n.Context.Provider,{value:i},e)}onLoadHandler(){delete window.GoogleReCaptcha_onload,this.setState({loaded:!0})}}t.ReCaptchaProvider=a},432:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.withContext=void 0;const r=o(297),n=o(411);t.withContext=e=>class extends r.Component{render(){return r.createElement(n.Context.Consumer,null,((e,t)=>o=>r.createElement(e,Object.assign({},t,{providerContext:o})))(e,this.props))}}},160:(e,t)=>{var o;Object.defineProperty(t,"__esModule",{value:!0}),t.ESize=void 0,function(e){e.Normal="normal",e.Compact="compact"}(o||(o={})),t.ESize=o},362:(e,t)=>{var o;Object.defineProperty(t,"__esModule",{value:!0}),t.ETheme=void 0,function(e){e.Light="light",e.Dark="dark"}(o||(o={})),t.ETheme=o},276:function(e,t,o){var r=this&&this.__rest||function(e,t){var o={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(o[r[n]]=e[r[n]])}return o};Object.defineProperty(t,"__esModule",{value:!0}),t.ReCaptchaV2=void 0;const n=o(297),a=o(160),i=o(362);class s extends n.Component{constructor(e){super(e);const{siteKeyV2:t}=this.props.providerContext;if(!t)throw new Error('The prop "siteKeyV2" must be set on the ReCaptchaProvider before using the ReCaptchaV2 component');this.state={ref:n.createRef(),widgetId:void 0,token:void 0,expired:!1,error:!1},this.successCallback=this.successCallback.bind(this),this.expiredCallback=this.expiredCallback.bind(this),this.errorCallback=this.errorCallback.bind(this),this.shouldRenderWidget=this.shouldRenderWidget.bind(this)}componentDidUpdate(){this.shouldRenderWidget(this.state.ref,this.props)}componentDidMount(){this.shouldRenderWidget(this.state.ref,this.props)}shouldRenderWidget(e,t){const{loaded:o,siteKeyV2:r}=t.providerContext,{theme:n,size:a,tabindex:i}=t,{widgetId:s}=this.state;void 0===s&&o&&e.current&&r&&this.setState({expired:!1,error:!1,widgetId:grecaptcha.render(e.current,{sitekey:r,callback:this.successCallback,"expired-callback":this.expiredCallback,"error-callback":this.errorCallback,theme:n,size:a,tabindex:i})})}render(){const{ref:e}=this.state,t=this.props,{theme:o,callback:a,size:i,tabindex:s,providerContext:c}=t,d=r(t,["theme","callback","size","tabindex","providerContext"]);return n.createElement("div",Object.assign({ref:e},d))}successCallback(e){const{callback:t}=this.props;this.setState({token:e,expired:!1,error:!1},(()=>{t(e)}))}expiredCallback(){const{callback:e}=this.props;this.setState({expired:!0},(()=>{e(!1)}))}errorCallback(){const{callback:e}=this.props;this.setState({error:!0},(()=>{e(new Error)}))}}t.ReCaptchaV2=s,s.defaultProps={theme:i.ETheme.Light,size:a.ESize.Normal,tabindex:0}},327:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ReCaptchaV2=void 0;const r=o(432),n=o(276),a=r.withContext(n.ReCaptchaV2);t.ReCaptchaV2=a},831:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ReCaptchaV3=void 0;const r=o(297);class n extends r.Component{constructor(e){super(e),this.unMounting=!1;const{siteKeyV3:t}=this.props.providerContext;if(!t)throw new Error('The prop "siteKeyV3" must be set on the ReCaptchaProvider before using the ReCaptchaV3 component');this.state={token:void 0,retrieving:!1},this.getToken=this.getToken.bind(this)}componentDidMount(){this.getToken()}componentDidUpdate(e){const{loaded:t}=this.props.providerContext;e.providerContext.loaded!==t&&t&&this.getToken()}render(){return!1}componentWillUnmount(){this.unMounting=!0}getToken(){const{loaded:e,siteKeyV3:t}=this.props.providerContext,{retrieving:o}=this.state,{action:r,callback:n}=this.props;e&&!o&&t&&this.setState({token:void 0,retrieving:!0},(()=>{n(),grecaptcha.execute(t,{action:r}).then((e=>{this.unMounting||this.setState({token:e,retrieving:!1},(()=>{n(e,this.getToken)}))}))}))}}t.ReCaptchaV3=n},24:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ReCaptchaV3=void 0;const r=o(432),n=o(831),a=r.withContext(n.ReCaptchaV3);t.ReCaptchaV3=a},297:e=>{e.exports=require("react")}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,o),a.exports}var r={};(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.ReCaptchaV3=e.ReCaptchaV2=e.ReCaptchaProvider=e.EReCaptchaV2Size=e.EReCaptchaV2Theme=void 0;const t=o(644);Object.defineProperty(e,"ReCaptchaProvider",{enumerable:!0,get:function(){return t.ReCaptchaProvider}});const n=o(160);Object.defineProperty(e,"EReCaptchaV2Size",{enumerable:!0,get:function(){return n.ESize}});const a=o(362);Object.defineProperty(e,"EReCaptchaV2Theme",{enumerable:!0,get:function(){return a.ETheme}});const i=o(327);Object.defineProperty(e,"ReCaptchaV2",{enumerable:!0,get:function(){return i.ReCaptchaV2}});const s=o(24);Object.defineProperty(e,"ReCaptchaV3",{enumerable:!0,get:function(){return s.ReCaptchaV3}})})(),module.exports=r})(); | ||
(()=>{"use strict";var e={411:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.Context=void 0;const r=o(689).createContext({siteKeyV2:"",siteKeyV3:"",loaded:!1});t.Context=r},644:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ReCaptchaProvider=void 0;const r=o(689),n=o(411);class a extends r.Component{constructor(e){super(e),this.state={loaded:!1},this.onLoadHandler=this.onLoadHandler.bind(this)}componentDidMount(){const{siteKeyV3:e="explicit",langCode:t="",hideV3Badge:o=!1}=this.props,r="react-recaptcha-v3-v2-script";if(null===document.querySelector(`script[data-id="${r}"]`)){window.GoogleReCaptcha_onload=this.onLoadHandler;const o=document.createElement("script");o.setAttribute("data-id",r),o.setAttribute("src",`https://www.google.com/recaptcha/api.js?render=${e}&onload=GoogleReCaptcha_onload&hl=${t}`),o.setAttribute("async","true"),o.setAttribute("defer","true"),document.body.appendChild(o)}else window.GoogleReCaptcha_onload?window.GoogleReCaptcha_onload=this.onLoadHandler:this.setState({loaded:!0});const n="react-recaptcha-v3-v2-style";if(o&&null===document.querySelector(`style[data-id="${n}"]`)){const e=document.createElement("style");e.innerHTML=".grecaptcha-badge{display: none;}",e.setAttribute("data-id",n),document.body.appendChild(e)}}componentWillUnmount(){window.GoogleReCaptcha_onload&&(window.GoogleReCaptcha_onload=()=>{delete window.GoogleReCaptcha_onload})}render(){const{children:e,siteKeyV3:t,siteKeyV2:o}=this.props,{loaded:a}=this.state,i={siteKeyV2:o,siteKeyV3:t,loaded:a};return r.createElement(n.Context.Provider,{value:i},e)}onLoadHandler(){delete window.GoogleReCaptcha_onload,this.setState({loaded:!0})}}t.ReCaptchaProvider=a},432:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.withContext=void 0;const r=o(689),n=o(411);t.withContext=e=>class extends r.Component{render(){return r.createElement(n.Context.Consumer,null,((e,t)=>o=>r.createElement(e,Object.assign({},t,{providerContext:o})))(e,this.props))}}},160:(e,t)=>{var o;Object.defineProperty(t,"__esModule",{value:!0}),t.ESize=void 0,function(e){e.Normal="normal",e.Compact="compact"}(o||(o={})),t.ESize=o},362:(e,t)=>{var o;Object.defineProperty(t,"__esModule",{value:!0}),t.ETheme=void 0,function(e){e.Light="light",e.Dark="dark"}(o||(o={})),t.ETheme=o},276:function(e,t,o){var r=this&&this.__rest||function(e,t){var o={};for(var r in e)Object.prototype.hasOwnProperty.call(e,r)&&t.indexOf(r)<0&&(o[r]=e[r]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(r=Object.getOwnPropertySymbols(e);n<r.length;n++)t.indexOf(r[n])<0&&Object.prototype.propertyIsEnumerable.call(e,r[n])&&(o[r[n]]=e[r[n]])}return o};Object.defineProperty(t,"__esModule",{value:!0}),t.ReCaptchaV2=void 0;const n=o(689),a=o(160),i=o(362);class s extends n.Component{constructor(e){super(e);const{siteKeyV2:t}=this.props.providerContext;if(!t)throw new Error('The prop "siteKeyV2" must be set on the ReCaptchaProvider before using the ReCaptchaV2 component');this.state={ref:n.createRef(),widgetId:void 0,token:void 0,expired:!1,error:!1},this.successCallback=this.successCallback.bind(this),this.expiredCallback=this.expiredCallback.bind(this),this.errorCallback=this.errorCallback.bind(this),this.shouldRenderWidget=this.shouldRenderWidget.bind(this)}componentDidUpdate(){this.shouldRenderWidget(this.state.ref,this.props)}componentDidMount(){this.shouldRenderWidget(this.state.ref,this.props)}shouldRenderWidget(e,t){const{loaded:o,siteKeyV2:r}=t.providerContext,{theme:n,size:a,tabindex:i}=t,{widgetId:s}=this.state;void 0===s&&o&&e.current&&r&&this.setState({expired:!1,error:!1,widgetId:grecaptcha.render(e.current,{sitekey:r,callback:this.successCallback,"expired-callback":this.expiredCallback,"error-callback":this.errorCallback,theme:n,size:a,tabindex:i})})}render(){const{ref:e}=this.state,t=this.props,{theme:o,callback:a,size:i,tabindex:s,providerContext:c}=t,d=r(t,["theme","callback","size","tabindex","providerContext"]);return n.createElement("div",Object.assign({ref:e},d))}successCallback(e){const{callback:t}=this.props;this.setState({token:e,expired:!1,error:!1},(()=>{t(e)}))}expiredCallback(){const{callback:e}=this.props;this.setState({expired:!0},(()=>{e(!1)}))}errorCallback(){const{callback:e}=this.props;this.setState({error:!0},(()=>{e(new Error)}))}}t.ReCaptchaV2=s,s.defaultProps={theme:i.ETheme.Light,size:a.ESize.Normal,tabindex:0}},327:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ReCaptchaV2=void 0;const r=o(432),n=o(276),a=(0,r.withContext)(n.ReCaptchaV2);t.ReCaptchaV2=a},831:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ReCaptchaV3=void 0;const r=o(689);class n extends r.Component{constructor(e){super(e),this.unMounting=!1;const{siteKeyV3:t}=this.props.providerContext;if(!t)throw new Error('The prop "siteKeyV3" must be set on the ReCaptchaProvider before using the ReCaptchaV3 component');this.state={token:void 0,retrieving:!1},this.getToken=this.getToken.bind(this)}componentDidMount(){this.getToken()}componentDidUpdate(e){const{loaded:t}=this.props.providerContext;e.providerContext.loaded!==t&&t&&this.getToken()}render(){return!1}componentWillUnmount(){this.unMounting=!0}getToken(){const{loaded:e,siteKeyV3:t}=this.props.providerContext,{retrieving:o}=this.state,{action:r,callback:n}=this.props;e&&!o&&t&&this.setState({token:void 0,retrieving:!0},(()=>{n(),grecaptcha.execute(t,{action:r}).then((e=>{this.unMounting||this.setState({token:e,retrieving:!1},(()=>{n(e,this.getToken)}))}))}))}}t.ReCaptchaV3=n},24:(e,t,o)=>{Object.defineProperty(t,"__esModule",{value:!0}),t.ReCaptchaV3=void 0;const r=o(432),n=o(831),a=(0,r.withContext)(n.ReCaptchaV3);t.ReCaptchaV3=a},689:e=>{e.exports=require("react")}},t={};function o(r){var n=t[r];if(void 0!==n)return n.exports;var a=t[r]={exports:{}};return e[r].call(a.exports,a,a.exports,o),a.exports}var r={};(()=>{var e=r;Object.defineProperty(e,"__esModule",{value:!0}),e.ReCaptchaV3=e.ReCaptchaV2=e.ReCaptchaProvider=e.EReCaptchaV2Size=e.EReCaptchaV2Theme=void 0;const t=o(644);Object.defineProperty(e,"ReCaptchaProvider",{enumerable:!0,get:function(){return t.ReCaptchaProvider}});const n=o(160);Object.defineProperty(e,"EReCaptchaV2Size",{enumerable:!0,get:function(){return n.ESize}});const a=o(362);Object.defineProperty(e,"EReCaptchaV2Theme",{enumerable:!0,get:function(){return a.ETheme}});const i=o(327);Object.defineProperty(e,"ReCaptchaV2",{enumerable:!0,get:function(){return i.ReCaptchaV2}});const s=o(24);Object.defineProperty(e,"ReCaptchaV3",{enumerable:!0,get:function(){return s.ReCaptchaV3}})})(),module.exports=r})(); |
@@ -1,2 +0,2 @@ | ||
const { pathsToModuleNameMapper } = require('ts-jest/utils'); | ||
const { pathsToModuleNameMapper } = require('ts-jest'); | ||
const { compilerOptions } = require('./tsconfig'); | ||
@@ -10,3 +10,5 @@ | ||
}), | ||
testURL: 'http://localhost', | ||
testEnvironmentOptions:{ | ||
url: 'http://localhost' | ||
}, | ||
coverageDirectory: '<rootDir>/reports/coverage', | ||
@@ -13,0 +15,0 @@ collectCoverageFrom: ['<rootDir>/src/**/*.{ts,tsx}'], |
{ | ||
"name": "react-recaptcha-x", | ||
"version": "1.1.13", | ||
"version": "1.1.14", | ||
"description": "a React component for Google's reCAPTCHA v3 and v2 (checkbox) component", | ||
@@ -46,32 +46,33 @@ "main": "./dist/index.js", | ||
"devDependencies": { | ||
"@commitlint/cli": "^12.1.4", | ||
"@commitlint/config-conventional": "^12.1.4", | ||
"@semantic-release/changelog": "^5.0.1", | ||
"@semantic-release/git": "^9.0.0", | ||
"@semantic-release/github": "^7.2.3", | ||
"@semantic-release/npm": "^7.1.3", | ||
"@testing-library/dom": "^8.0.0", | ||
"@testing-library/jest-dom": "^5.14.1", | ||
"@testing-library/react": "^12.0.0", | ||
"@types/jest": "^26.0.24", | ||
"@types/react": "^17.0.11", | ||
"@types/react-dom": "^17.0.8", | ||
"@typescript-eslint/eslint-plugin": "^4.28.2", | ||
"@typescript-eslint/parser": "^4.28.2", | ||
"coveralls": "^3.1.0", | ||
"eslint": "^7.30.0", | ||
"jest": "^27.0.5", | ||
"prettier": "^2.3.2", | ||
"react": "17.0.2", | ||
"react-dom": "^17.0.2", | ||
"semantic-release": "^17.4.4", | ||
"ts-jest": "^27.0.3", | ||
"ts-loader": "^9.2.3", | ||
"tsconfig-replace-paths": "^0.0.5", | ||
"typescript": "^4.3.5", | ||
"webpack": "^5.43.0", | ||
"webpack-cli": "^4.7.2" | ||
"@commitlint/cli": "^17.1.2", | ||
"@commitlint/config-conventional": "^17.1.0", | ||
"@semantic-release/changelog": "^6.0.1", | ||
"@semantic-release/git": "^10.0.1", | ||
"@semantic-release/github": "^8.0.6", | ||
"@semantic-release/npm": "^9.0.1", | ||
"@testing-library/dom": "^8.18.0", | ||
"@testing-library/jest-dom": "^5.16.5", | ||
"@testing-library/react": "^13.4.0", | ||
"@types/jest": "^29.0.3", | ||
"@types/react": "^18.0.20", | ||
"@types/react-dom": "^18.0.6", | ||
"@typescript-eslint/eslint-plugin": "^5.37.0", | ||
"@typescript-eslint/parser": "^5.37.0", | ||
"coveralls": "^3.1.1", | ||
"eslint": "^8.23.1", | ||
"jest": "^29.0.3", | ||
"jest-environment-jsdom": "^29.0.3", | ||
"prettier": "^2.7.1", | ||
"react": "18.2.0", | ||
"react-dom": "^18.2.0", | ||
"semantic-release": "^19.0.5", | ||
"ts-jest": "^29.0.1", | ||
"ts-loader": "^9.3.1", | ||
"tsconfig-replace-paths": "^0.0.11", | ||
"typescript": "^4.8.3", | ||
"webpack": "^5.74.0", | ||
"webpack-cli": "^4.10.0" | ||
}, | ||
"peerDependencies": { | ||
"react": "^16.6.0 || ^17.0.0" | ||
"react": "^16.6.0 || ^17.0.0 || ^18.0.0" | ||
}, | ||
@@ -78,0 +79,0 @@ "prettier": { |
@@ -48,3 +48,3 @@ # react-recaptcha-x | ||
1. [React 16.6.0+ or 17.x](https://reactjs.org/) | ||
1. [React 16.6.0+, 17.x or 18.x](https://reactjs.org/) | ||
1. reCAPTCHA v2 / v3 site key(s), which you can get from [here](https://www.google.com/recaptcha) | ||
@@ -51,0 +51,0 @@ |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
136673
349
28