diff --git a/README.md b/README.md index c10dee8..c5b5d87 100644 --- a/README.md +++ b/README.md @@ -138,6 +138,7 @@ return
diff --git a/src/index.js b/src/index.js index f454261..8700852 100644 --- a/src/index.js +++ b/src/index.js @@ -130,6 +130,7 @@ class HCaptcha extends React.Component { scriptSource, secureApi, cleanup = true, + userJourneys, } = this.props; const mountParams = { render: 'explicit', @@ -147,7 +148,8 @@ class HCaptcha extends React.Component { scriptLocation, scriptSource, secureApi, - cleanup + cleanup, + userJourneys }; hCaptchaLoader(mountParams) @@ -167,6 +169,11 @@ class HCaptcha extends React.Component { // • Component has already been mounted if (!isApiReady || captchaId) return; + // It is needed to pass only the props that hCaptcha supports + // React are able to receive userJourneys as prop but hCaptcha not + // hcaptcha expects to have only "uj" parameter to enable user journeys + const { userJourneys, ...basicProps } = this.props; + const renderParams = Object.assign({ "open-callback" : this.handleOpen, "close-callback" : this.handleClose, @@ -174,9 +181,10 @@ class HCaptcha extends React.Component { "chalexpired-callback": this.handleChallengeExpired, "expired-callback" : this.handleExpire, "callback" : this.handleSubmit, - }, this.props, { + }, basicProps, { hl: this.props.hl || this.props.languageOverride, - languageOverride: undefined + languageOverride: undefined, + uj: userJourneys !== undefined ? userJourneys : false, }); const hcaptcha = this._hcaptcha; diff --git a/types/index.d.ts b/types/index.d.ts index f105ef4..71accde 100644 --- a/types/index.d.ts +++ b/types/index.d.ts @@ -31,6 +31,7 @@ interface HCaptchaProps { loadAsync?: boolean; scriptLocation?: HTMLElement | null; sentry?: boolean; + userJourneys?: boolean; cleanup?: boolean; custom?: boolean; secureApi?: boolean;