@hcaptcha/react-hcaptcha 1.13.0 → 1.13.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +1 -0
- package/dist/esm/index.js +3 -13
- package/dist/index.js +3 -13
- package/package.json +2 -2
- package/src/index.js +5 -10
package/README.md
CHANGED
|
@@ -154,6 +154,7 @@ return <HCaptcha ref={captchaRef} onLoad={onLoad} sitekey={sitekey} {...props} /
|
|
|
154
154
|
|`onVerify`|`token, eKey`|When challenge is completed. The response `token` and an `eKey` (session id) are passed along.|
|
|
155
155
|
|`onExpire`|-|When the current token expires.|
|
|
156
156
|
|`onLoad`|-|When the hCaptcha API loads.|
|
|
157
|
+
|`onReady`|-|When the hCaptcha is ready to be used.|
|
|
157
158
|
|`onOpen`|-|When the user display of a challenge starts.|
|
|
158
159
|
|`onClose`|-|When the user dismisses a challenge.|
|
|
159
160
|
|`onChalExpired`|-|When the user display of a challenge times out with no answer.|
|
package/dist/esm/index.js
CHANGED
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import _objectWithoutPropertiesLoose from "@babel/runtime/helpers/objectWithoutPropertiesLoose";
|
|
2
1
|
import _assertThisInitialized from "@babel/runtime/helpers/assertThisInitialized";
|
|
3
2
|
import _inheritsLoose from "@babel/runtime/helpers/inheritsLoose";
|
|
4
|
-
var _excluded = ["userJourneys"];
|
|
5
3
|
import * as React from 'react';
|
|
6
4
|
import { hCaptchaLoader } from '@hcaptcha/loader';
|
|
7
5
|
import { getFrame, getMountElement } from './utils.js';
|
|
@@ -143,7 +141,7 @@ var HCaptcha = /*#__PURE__*/function (_React$Component) {
|
|
|
143
141
|
scriptSource: scriptSource,
|
|
144
142
|
secureApi: secureApi,
|
|
145
143
|
cleanup: cleanup,
|
|
146
|
-
userJourneys:
|
|
144
|
+
uj: userJourneys !== undefined ? userJourneys : false
|
|
147
145
|
};
|
|
148
146
|
hCaptchaLoader(mountParams).then(this.handleOnLoad, this.handleError)["catch"](this.handleError);
|
|
149
147
|
this.apiScriptRequested = true;
|
|
@@ -158,13 +156,6 @@ var HCaptcha = /*#__PURE__*/function (_React$Component) {
|
|
|
158
156
|
// • API is not ready
|
|
159
157
|
// • Component has already been mounted
|
|
160
158
|
if (!isApiReady || captchaId) return;
|
|
161
|
-
|
|
162
|
-
// It is needed to pass only the props that hCaptcha supports
|
|
163
|
-
// React are able to receive userJourneys as prop but hCaptcha not
|
|
164
|
-
// hcaptcha expects to have only "uj" parameter to enable user journeys
|
|
165
|
-
var _this$props2 = this.props,
|
|
166
|
-
userJourneys = _this$props2.userJourneys,
|
|
167
|
-
basicProps = _objectWithoutPropertiesLoose(_this$props2, _excluded);
|
|
168
159
|
var renderParams = Object.assign({
|
|
169
160
|
"open-callback": this.handleOpen,
|
|
170
161
|
"close-callback": this.handleClose,
|
|
@@ -172,10 +163,9 @@ var HCaptcha = /*#__PURE__*/function (_React$Component) {
|
|
|
172
163
|
"chalexpired-callback": this.handleChallengeExpired,
|
|
173
164
|
"expired-callback": this.handleExpire,
|
|
174
165
|
"callback": this.handleSubmit
|
|
175
|
-
},
|
|
166
|
+
}, this.props, {
|
|
176
167
|
hl: this.props.hl || this.props.languageOverride,
|
|
177
|
-
languageOverride: undefined
|
|
178
|
-
uj: userJourneys !== undefined ? userJourneys : false
|
|
168
|
+
languageOverride: undefined
|
|
179
169
|
});
|
|
180
170
|
var hcaptcha = this._hcaptcha;
|
|
181
171
|
//Render hCaptcha widget and provide necessary callbacks - hCaptcha
|
package/dist/index.js
CHANGED
|
@@ -7,7 +7,6 @@ Object.defineProperty(exports, "__esModule", {
|
|
|
7
7
|
});
|
|
8
8
|
exports["default"] = void 0;
|
|
9
9
|
var _typeof2 = _interopRequireDefault(require("@babel/runtime/helpers/typeof"));
|
|
10
|
-
var _objectWithoutProperties2 = _interopRequireDefault(require("@babel/runtime/helpers/objectWithoutProperties"));
|
|
11
10
|
var _classCallCheck2 = _interopRequireDefault(require("@babel/runtime/helpers/classCallCheck"));
|
|
12
11
|
var _createClass2 = _interopRequireDefault(require("@babel/runtime/helpers/createClass"));
|
|
13
12
|
var _possibleConstructorReturn2 = _interopRequireDefault(require("@babel/runtime/helpers/possibleConstructorReturn"));
|
|
@@ -17,7 +16,6 @@ var _inherits2 = _interopRequireDefault(require("@babel/runtime/helpers/inherits
|
|
|
17
16
|
var React = _interopRequireWildcard(require("react"));
|
|
18
17
|
var _loader = require("@hcaptcha/loader");
|
|
19
18
|
var _utils = require("./utils.js");
|
|
20
|
-
var _excluded = ["userJourneys"];
|
|
21
19
|
function _getRequireWildcardCache(e) { if ("function" != typeof WeakMap) return null; var r = new WeakMap(), t = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(e) { return e ? t : r; })(e); }
|
|
22
20
|
function _interopRequireWildcard(e, r) { if (!r && e && e.__esModule) return e; if (null === e || "object" != _typeof3(e) && "function" != typeof e) return { "default": e }; var t = _getRequireWildcardCache(r); if (t && t.has(e)) return t.get(e); var n = { __proto__: null }, a = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var u in e) if ("default" !== u && Object.prototype.hasOwnProperty.call(e, u)) { var i = a ? Object.getOwnPropertyDescriptor(e, u) : null; i && (i.get || i.set) ? Object.defineProperty(n, u, i) : n[u] = e[u]; } return n["default"] = e, t && t.set(e, n), n; }
|
|
23
21
|
function _callSuper(t, o, e) { return o = (0, _getPrototypeOf2["default"])(o), (0, _possibleConstructorReturn2["default"])(t, _isNativeReflectConstruct() ? Reflect.construct(o, e || [], (0, _getPrototypeOf2["default"])(t).constructor) : o.apply(t, e)); }
|
|
@@ -170,7 +168,7 @@ var HCaptcha = /*#__PURE__*/function (_React$Component) {
|
|
|
170
168
|
scriptSource: scriptSource,
|
|
171
169
|
secureApi: secureApi,
|
|
172
170
|
cleanup: cleanup,
|
|
173
|
-
userJourneys:
|
|
171
|
+
uj: userJourneys !== undefined ? userJourneys : false
|
|
174
172
|
};
|
|
175
173
|
(0, _loader.hCaptchaLoader)(mountParams).then(this.handleOnLoad, this.handleError)["catch"](this.handleError);
|
|
176
174
|
this.apiScriptRequested = true;
|
|
@@ -187,13 +185,6 @@ var HCaptcha = /*#__PURE__*/function (_React$Component) {
|
|
|
187
185
|
// • API is not ready
|
|
188
186
|
// • Component has already been mounted
|
|
189
187
|
if (!isApiReady || captchaId) return;
|
|
190
|
-
|
|
191
|
-
// It is needed to pass only the props that hCaptcha supports
|
|
192
|
-
// React are able to receive userJourneys as prop but hCaptcha not
|
|
193
|
-
// hcaptcha expects to have only "uj" parameter to enable user journeys
|
|
194
|
-
var _this$props2 = this.props,
|
|
195
|
-
userJourneys = _this$props2.userJourneys,
|
|
196
|
-
basicProps = (0, _objectWithoutProperties2["default"])(_this$props2, _excluded);
|
|
197
188
|
var renderParams = Object.assign({
|
|
198
189
|
"open-callback": this.handleOpen,
|
|
199
190
|
"close-callback": this.handleClose,
|
|
@@ -201,10 +192,9 @@ var HCaptcha = /*#__PURE__*/function (_React$Component) {
|
|
|
201
192
|
"chalexpired-callback": this.handleChallengeExpired,
|
|
202
193
|
"expired-callback": this.handleExpire,
|
|
203
194
|
"callback": this.handleSubmit
|
|
204
|
-
},
|
|
195
|
+
}, this.props, {
|
|
205
196
|
hl: this.props.hl || this.props.languageOverride,
|
|
206
|
-
languageOverride: undefined
|
|
207
|
-
uj: userJourneys !== undefined ? userJourneys : false
|
|
197
|
+
languageOverride: undefined
|
|
208
198
|
});
|
|
209
199
|
var hcaptcha = this._hcaptcha;
|
|
210
200
|
//Render hCaptcha widget and provide necessary callbacks - hCaptcha
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@hcaptcha/react-hcaptcha",
|
|
3
|
-
"version": "1.13.
|
|
3
|
+
"version": "1.13.1",
|
|
4
4
|
"types": "types/index.d.ts",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"module": "dist/esm/index.js",
|
|
@@ -60,6 +60,6 @@
|
|
|
60
60
|
},
|
|
61
61
|
"dependencies": {
|
|
62
62
|
"@babel/runtime": "^7.17.9",
|
|
63
|
-
"@hcaptcha/loader": "^2.0
|
|
63
|
+
"@hcaptcha/loader": "^2.2.0"
|
|
64
64
|
}
|
|
65
65
|
}
|
package/src/index.js
CHANGED
|
@@ -132,6 +132,7 @@ class HCaptcha extends React.Component {
|
|
|
132
132
|
cleanup = true,
|
|
133
133
|
userJourneys,
|
|
134
134
|
} = this.props;
|
|
135
|
+
|
|
135
136
|
const mountParams = {
|
|
136
137
|
render: 'explicit',
|
|
137
138
|
apihost,
|
|
@@ -149,9 +150,9 @@ class HCaptcha extends React.Component {
|
|
|
149
150
|
scriptSource,
|
|
150
151
|
secureApi,
|
|
151
152
|
cleanup,
|
|
152
|
-
userJourneys
|
|
153
|
+
uj: userJourneys !== undefined ? userJourneys : false,
|
|
153
154
|
};
|
|
154
|
-
|
|
155
|
+
|
|
155
156
|
hCaptchaLoader(mountParams)
|
|
156
157
|
.then(this.handleOnLoad, this.handleError)
|
|
157
158
|
.catch(this.handleError);
|
|
@@ -168,11 +169,6 @@ class HCaptcha extends React.Component {
|
|
|
168
169
|
// • API is not ready
|
|
169
170
|
// • Component has already been mounted
|
|
170
171
|
if (!isApiReady || captchaId) return;
|
|
171
|
-
|
|
172
|
-
// It is needed to pass only the props that hCaptcha supports
|
|
173
|
-
// React are able to receive userJourneys as prop but hCaptcha not
|
|
174
|
-
// hcaptcha expects to have only "uj" parameter to enable user journeys
|
|
175
|
-
const { userJourneys, ...basicProps } = this.props;
|
|
176
172
|
|
|
177
173
|
const renderParams = Object.assign({
|
|
178
174
|
"open-callback" : this.handleOpen,
|
|
@@ -181,10 +177,9 @@ class HCaptcha extends React.Component {
|
|
|
181
177
|
"chalexpired-callback": this.handleChallengeExpired,
|
|
182
178
|
"expired-callback" : this.handleExpire,
|
|
183
179
|
"callback" : this.handleSubmit,
|
|
184
|
-
},
|
|
180
|
+
}, this.props, {
|
|
185
181
|
hl: this.props.hl || this.props.languageOverride,
|
|
186
|
-
languageOverride: undefined
|
|
187
|
-
uj: userJourneys !== undefined ? userJourneys : false,
|
|
182
|
+
languageOverride: undefined
|
|
188
183
|
});
|
|
189
184
|
|
|
190
185
|
const hcaptcha = this._hcaptcha;
|