From 7873af2d3784de11eee2cd32680e8fe373005e0e Mon Sep 17 00:00:00 2001 From: wontem <2wontem@gmail.com> Date: Fri, 13 Aug 2021 12:38:10 +0300 Subject: [PATCH 1/3] Add custom parameter --- README.md | 1 + src/index.js | 5 +++-- tests/hcaptcha.spec.js | 12 +++++++++++- 3 files changed, 15 insertions(+), 3 deletions(-) diff --git a/README.md b/README.md index 25acd0b..e81c672 100644 --- a/README.md +++ b/README.md @@ -71,6 +71,7 @@ In these instances, you'll most likely want to use `ref` to handle the callbacks |`imghost`|String|No|`-`|See enterprise docs.| |`reportapi`|String|No|`-`|See enterprise docs.| |`sentry`|String|No|`-`|See enterprise docs.| +|`custom`|Boolean|No|`-`|See enterprise docs.| ### Events diff --git a/src/index.js b/src/index.js index 32ea801..1642b82 100644 --- a/src/index.js +++ b/src/index.js @@ -59,7 +59,7 @@ class HCaptcha extends React.Component { } componentDidMount () { //Once captcha is mounted intialize hCaptcha - hCaptcha - const { apihost, assethost, endpoint, host, imghost, languageOverride:hl, reCaptchaCompat, reportapi, sentry } = this.props; + const { apihost, assethost, endpoint, host, imghost, languageOverride:hl, reCaptchaCompat, reportapi, sentry, custom } = this.props; const { isApiReady } = this.state; if (!isApiReady) { //Check if hCaptcha has already been loaded, if not create script tag and wait to render captcha @@ -75,7 +75,8 @@ class HCaptcha extends React.Component { imghost, recaptchacompat: reCaptchaCompat === false? "off" : null, reportapi, - sentry + sentry, + custom }); } diff --git a/tests/hcaptcha.spec.js b/tests/hcaptcha.spec.js index e7187e9..d88de89 100644 --- a/tests/hcaptcha.spec.js +++ b/tests/hcaptcha.spec.js @@ -284,6 +284,16 @@ describe("hCaptcha", () => { const scripts = document.querySelectorAll("head > script"); expect(scripts.length).toBe(1); - }) + }); + + it("custom parameter should be in script query", () => { + instance = ReactTestUtils.renderIntoDocument(); + + const script = document.querySelector("head > script"); + expect(script.src).toContain("custom=true"); + }); }); }); From a3751e2470a18fb068b5057f1a62864de260ff32 Mon Sep 17 00:00:00 2001 From: wontem <2wontem@gmail.com> Date: Fri, 13 Aug 2021 13:11:40 +0300 Subject: [PATCH 2/3] Bump version --- package-lock.json | 4 ++-- package.json | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/package-lock.json b/package-lock.json index 9cc635a..12a446b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,6 +1,6 @@ { "name": "@hcaptcha/react-hcaptcha", - "version": "0.3.6", + "version": "0.3.7", "lockfileVersion": 1, "requires": true, "dependencies": { @@ -5522,7 +5522,7 @@ }, "readable-stream": { "version": "1.0.34", - "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": { diff --git a/package.json b/package.json index 8abc89a..82810ec 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "@hcaptcha/react-hcaptcha", - "version": "0.3.6", + "version": "0.3.7", "types": "types/index.d.ts", "main": "dist/index.js", "files": [ From dcff54c3e99e123c5d08841ff558351e2e8098ff Mon Sep 17 00:00:00 2001 From: wontem <2wontem@gmail.com> Date: Fri, 13 Aug 2021 13:36:21 +0300 Subject: [PATCH 3/3] Fix lock file --- package-lock.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package-lock.json b/package-lock.json index 12a446b..af5250b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -5522,7 +5522,7 @@ }, "readable-stream": { "version": "1.0.34", - "resolved": "http://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", + "resolved": "https://registry.npmjs.org/readable-stream/-/readable-stream-1.0.34.tgz", "integrity": "sha1-Elgg40vIQtLyqq+v5MKRbuMsFXw=", "dev": true, "requires": {