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

react-recaptcha-x

Package Overview
Dependencies
Maintainers
1
Versions
27
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

react-recaptcha-x - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

14

CHANGELOG.md

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

## [1.1.1](https://github.com/antokara/react-recaptcha-x/compare/v1.1.0...v1.1.1) (2020-02-15)
### Bug Fixes
* **packages:** update npm packages ([4386faa](https://github.com/antokara/react-recaptcha-x/commit/4386faa8743eba4e72a81d5364a34a6c7498a70b))
* **recaptcha provider:** support server side usage ([46caf6f](https://github.com/antokara/react-recaptcha-x/commit/46caf6f122a74ef4ff5b336b818349bf4e1c895b)), closes [#21](https://github.com/antokara/react-recaptcha-x/issues/21)
* **travis ci:** nodejs version ([9e8aeb0](https://github.com/antokara/react-recaptcha-x/commit/9e8aeb0f1778dfb5317ed1d91bbe12cad18be338))
### Performance Improvements
* **package:** improve ts validate script ([8a58af4](https://github.com/antokara/react-recaptcha-x/commit/8a58af4cba4a80260dec92ff03802c703ae1572c))
# [1.1.0](https://github.com/antokara/react-recaptcha-x/compare/v1.0.9...v1.1.0) (2020-01-09)

@@ -2,0 +16,0 @@

2

dist/index.js

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

module.exports=function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=5)}([function(e,t){e.exports=require("react")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(0).createContext({siteKeyV2:"",siteKeyV3:"",loaded:!1});t.Context=o},function(e,t,r){"use strict";var o;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Normal="normal",e.Compact="compact"}(o||(o={})),t.ESize=o},function(e,t,r){"use strict";var o;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Light="light",e.Dark="dark"}(o||(o={})),t.ETheme=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(0),n=r(1);t.withContext=e=>class extends o.Component{render(){return o.createElement(n.Context.Consumer,null,((e,t)=>r=>o.createElement(e,Object.assign({},t,{providerContext:r})))(e,this.props))}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(6);t.ReCaptchaProvider=o.ReCaptchaProvider;const n=r(2);t.EReCaptchaV2Size=n.ESize;const i=r(3);t.EReCaptchaV2Theme=i.ETheme;const a=r(7);t.ReCaptchaV2=a.ReCaptchaV2;const s=r(9);t.ReCaptchaV3=s.ReCaptchaV3},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(0),n=r(1);class i extends o.Component{constructor(e){super(e),this.state={loaded:!1},this.onLoadHandler=this.onLoadHandler.bind(this),window.GoogleReCaptcha_onload=this.onLoadHandler}componentDidMount(){const{siteKeyV3:e="explicit",langCode:t="",hideV3Badge:r=!1}=this.props;if(null===document.querySelector('script[data-id="react-recaptcha-v3-v2-script"]')){const r=document.createElement("script");r.setAttribute("data-id","react-recaptcha-v3-v2-script"),r.setAttribute("src",`https://www.google.com/recaptcha/api.js?render=${e}&onload=GoogleReCaptcha_onload&hl=${t}`),r.setAttribute("async","true"),r.setAttribute("defer","true"),document.body.appendChild(r)}if(r&&null===document.querySelector('style[data-id="react-recaptcha-v3-v2-style"]')){const e=document.createElement("style");e.innerHTML=".grecaptcha-badge{display: none;}",e.setAttribute("data-id","react-recaptcha-v3-v2-style"),document.body.appendChild(e)}}render(){const{children:e,siteKeyV3:t,siteKeyV2:r}=this.props,{loaded:i}=this.state,a={siteKeyV2:r,siteKeyV3:t,loaded:i};return o.createElement(n.Context.Provider,{value:a},e)}onLoadHandler(){delete window.GoogleReCaptcha_onload,this.setState({loaded:!0})}}t.ReCaptchaProvider=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(4),n=r(8),i=o.withContext(n.ReCaptchaV2);t.ReCaptchaV2=i},function(e,t,r){"use strict";var o=this&&this.__rest||function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r};Object.defineProperty(t,"__esModule",{value:!0});const n=r(0),i=r(2),a=r(3);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.checkComponentDidUpdate=this.checkComponentDidUpdate.bind(this)}componentDidUpdate(e){this.checkComponentDidUpdate(this.state.ref,this.props,e)}checkComponentDidUpdate(e,t,r){const{loaded:o,siteKeyV2:n}=t.providerContext,{theme:i,size:a,tabindex:s}=t;r.providerContext.loaded!==o&&o&&e.current&&n&&this.setState({expired:!1,error:!1,widgetId:grecaptcha.render(e.current,{sitekey:n,callback:this.successCallback,"expired-callback":this.expiredCallback,"error-callback":this.errorCallback,theme:i,size:a,tabindex:s})})}render(){const{ref:e}=this.state,t=this.props,{theme:r,callback:i,size:a,tabindex:s,providerContext:c}=t,d=o(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:a.ETheme.Light,size:i.ESize.Normal,tabindex:0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(4),n=r(10),i=o.withContext(n.ReCaptchaV3);t.ReCaptchaV3=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(0);class n extends o.Component{constructor(e){super(e);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),this.getToken()}componentDidUpdate(e){const{loaded:t}=this.props.providerContext;e.providerContext.loaded!==t&&t&&this.getToken()}render(){return!1}getToken(){const{loaded:e,siteKeyV3:t}=this.props.providerContext,{retrieving:r}=this.state,{action:o,callback:n}=this.props;e&&!r&&t&&this.setState({token:void 0,retrieving:!0},()=>{n(),grecaptcha.execute(t,{action:o}).then(e=>{this.setState({token:e,retrieving:!1},()=>{n(e,this.getToken)})})})}}t.ReCaptchaV3=n}]);
module.exports=function(e){var t={};function r(o){if(t[o])return t[o].exports;var n=t[o]={i:o,l:!1,exports:{}};return e[o].call(n.exports,n,n.exports,r),n.l=!0,n.exports}return r.m=e,r.c=t,r.d=function(e,t,o){r.o(e,t)||Object.defineProperty(e,t,{enumerable:!0,get:o})},r.r=function(e){"undefined"!=typeof Symbol&&Symbol.toStringTag&&Object.defineProperty(e,Symbol.toStringTag,{value:"Module"}),Object.defineProperty(e,"__esModule",{value:!0})},r.t=function(e,t){if(1&t&&(e=r(e)),8&t)return e;if(4&t&&"object"==typeof e&&e&&e.__esModule)return e;var o=Object.create(null);if(r.r(o),Object.defineProperty(o,"default",{enumerable:!0,value:e}),2&t&&"string"!=typeof e)for(var n in e)r.d(o,n,function(t){return e[t]}.bind(null,n));return o},r.n=function(e){var t=e&&e.__esModule?function(){return e.default}:function(){return e};return r.d(t,"a",t),t},r.o=function(e,t){return Object.prototype.hasOwnProperty.call(e,t)},r.p="",r(r.s=5)}([function(e,t){e.exports=require("react")},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(0).createContext({siteKeyV2:"",siteKeyV3:"",loaded:!1});t.Context=o},function(e,t,r){"use strict";var o;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Normal="normal",e.Compact="compact"}(o||(o={})),t.ESize=o},function(e,t,r){"use strict";var o;Object.defineProperty(t,"__esModule",{value:!0}),function(e){e.Light="light",e.Dark="dark"}(o||(o={})),t.ETheme=o},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(0),n=r(1);t.withContext=e=>class extends o.Component{render(){return o.createElement(n.Context.Consumer,null,((e,t)=>r=>o.createElement(e,Object.assign({},t,{providerContext:r})))(e,this.props))}}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(6);t.ReCaptchaProvider=o.ReCaptchaProvider;const n=r(2);t.EReCaptchaV2Size=n.ESize;const i=r(3);t.EReCaptchaV2Theme=i.ETheme;const a=r(7);t.ReCaptchaV2=a.ReCaptchaV2;const s=r(9);t.ReCaptchaV3=s.ReCaptchaV3},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(0),n=r(1);class i extends o.Component{constructor(e){super(e),this.state={loaded:!1},this.onLoadHandler=this.onLoadHandler.bind(this)}componentDidMount(){const{siteKeyV3:e="explicit",langCode:t="",hideV3Badge:r=!1}=this.props;window.GoogleReCaptcha_onload=this.onLoadHandler;if(null===document.querySelector('script[data-id="react-recaptcha-v3-v2-script"]')){const r=document.createElement("script");r.setAttribute("data-id","react-recaptcha-v3-v2-script"),r.setAttribute("src",`https://www.google.com/recaptcha/api.js?render=${e}&onload=GoogleReCaptcha_onload&hl=${t}`),r.setAttribute("async","true"),r.setAttribute("defer","true"),document.body.appendChild(r)}if(r&&null===document.querySelector('style[data-id="react-recaptcha-v3-v2-style"]')){const e=document.createElement("style");e.innerHTML=".grecaptcha-badge{display: none;}",e.setAttribute("data-id","react-recaptcha-v3-v2-style"),document.body.appendChild(e)}}render(){const{children:e,siteKeyV3:t,siteKeyV2:r}=this.props,{loaded:i}=this.state,a={siteKeyV2:r,siteKeyV3:t,loaded:i};return o.createElement(n.Context.Provider,{value:a},e)}onLoadHandler(){delete window.GoogleReCaptcha_onload,this.setState({loaded:!0})}}t.ReCaptchaProvider=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(4),n=r(8),i=o.withContext(n.ReCaptchaV2);t.ReCaptchaV2=i},function(e,t,r){"use strict";var o=this&&this.__rest||function(e,t){var r={};for(var o in e)Object.prototype.hasOwnProperty.call(e,o)&&t.indexOf(o)<0&&(r[o]=e[o]);if(null!=e&&"function"==typeof Object.getOwnPropertySymbols){var n=0;for(o=Object.getOwnPropertySymbols(e);n<o.length;n++)t.indexOf(o[n])<0&&Object.prototype.propertyIsEnumerable.call(e,o[n])&&(r[o[n]]=e[o[n]])}return r};Object.defineProperty(t,"__esModule",{value:!0});const n=r(0),i=r(2),a=r(3);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.checkComponentDidUpdate=this.checkComponentDidUpdate.bind(this)}componentDidUpdate(e){this.checkComponentDidUpdate(this.state.ref,this.props,e)}checkComponentDidUpdate(e,t,r){const{loaded:o,siteKeyV2:n}=t.providerContext,{theme:i,size:a,tabindex:s}=t;r.providerContext.loaded!==o&&o&&e.current&&n&&this.setState({expired:!1,error:!1,widgetId:grecaptcha.render(e.current,{sitekey:n,callback:this.successCallback,"expired-callback":this.expiredCallback,"error-callback":this.errorCallback,theme:i,size:a,tabindex:s})})}render(){const{ref:e}=this.state,t=this.props,{theme:r,callback:i,size:a,tabindex:s,providerContext:c}=t,d=o(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:a.ETheme.Light,size:i.ESize.Normal,tabindex:0}},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(4),n=r(10),i=o.withContext(n.ReCaptchaV3);t.ReCaptchaV3=i},function(e,t,r){"use strict";Object.defineProperty(t,"__esModule",{value:!0});const o=r(0);class n extends o.Component{constructor(e){super(e);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),this.getToken()}componentDidUpdate(e){const{loaded:t}=this.props.providerContext;e.providerContext.loaded!==t&&t&&this.getToken()}render(){return!1}getToken(){const{loaded:e,siteKeyV3:t}=this.props.providerContext,{retrieving:r}=this.state,{action:o,callback:n}=this.props;e&&!r&&t&&this.setState({token:void 0,retrieving:!0},()=>{n(),grecaptcha.execute(t,{action:o}).then(e=>{this.setState({token:e,retrieving:!1},()=>{n(e,this.getToken)})})})}}t.ReCaptchaV3=n}]);
{
"name": "react-recaptcha-x",
"version": "1.1.0",
"version": "1.1.1",
"description": "a React component for Google's reCAPTCHA v3 and v2 (checkbox) component",

@@ -18,3 +18,3 @@ "main": "./dist/index.js",

"cl": "commitlint --from=HEAD~1",
"ts:validate": "tsc --outDir /tmp"
"ts:validate": "tsc --noEmit"
},

@@ -47,12 +47,12 @@ "keywords": [

"devDependencies": {
"@commitlint/cli": "^8.3.4",
"@commitlint/cli": "^8.3.5",
"@commitlint/config-conventional": "^8.3.4",
"@semantic-release/changelog": "^3.0.6",
"@semantic-release/git": "^7.0.18",
"@semantic-release/github": "^5.5.5",
"@semantic-release/npm": "^5.3.5",
"@testing-library/dom": "^6.11.0",
"@testing-library/jest-dom": "^4.2.4",
"@semantic-release/changelog": "^5.0.0",
"@semantic-release/git": "^9.0.0",
"@semantic-release/github": "^7.0.3",
"@semantic-release/npm": "^7.0.3",
"@testing-library/dom": "^6.12.2",
"@testing-library/jest-dom": "^5.1.1",
"@testing-library/react": "^9.4.0",
"@types/jest": "^24.0.25",
"@types/jest": "^25.1.2",
"coveralls": "^3.0.9",

@@ -62,16 +62,16 @@ "jest": "^24.9.0",

"react-dom": "^16.12.0",
"semantic-release": "^15.14.0",
"ts-jest": "^24.3.0",
"semantic-release": "^17.0.3",
"ts-jest": "^25.2.0",
"ts-loader": "^6.2.1",
"tscpaths": "0.0.9",
"tslint": "^5.20.1",
"tslint": "^6.0.0",
"tslint-consistent-codestyle": "^1.16.0",
"tslint-microsoft-contrib": "^6.2.0",
"tslint-react": "^4.1.0",
"typescript": "^3.7.4",
"webpack": "^4.41.5",
"webpack-cli": "^3.3.10"
"tslint-react": "^4.2.0",
"typescript": "^3.7.5",
"webpack": "^4.41.6",
"webpack-cli": "^3.3.11"
},
"dependencies": {
"@types/react": "^16.9.17",
"@types/react": "^16.9.19",
"react": "^16.12.0"

@@ -78,0 +78,0 @@ },

@@ -231,3 +231,3 @@ # react-recaptcha-x

1. `$npm start`
1. open browser to `http://locahost:9001`
1. open browser to `http://localhost:9001`

@@ -241,3 +241,3 @@ ### javascript examples setup

1. `$npm start`
1. open browser to `http://locahost:9001`
1. open browser to `http://localhost:9001`

@@ -244,0 +244,0 @@ ## other credits

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