@hcaptcha/react-hcaptcha 1.12.1 → 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 CHANGED
@@ -138,6 +138,7 @@ return <HCaptcha ref={captchaRef} onLoad={onLoad} sitekey={sitekey} {...props} /
138
138
  |`imghost`|String|No|`-`|See enterprise docs.|
139
139
  |`reportapi`|String|No|`-`|See enterprise docs.|
140
140
  |`sentry`|Boolean|No|`true`|See enterprise docs.|
141
+ |`userJourneys`|Boolean|No|`false`|See enterprise docs.|
141
142
  |`secureApi`|Boolean|No|`-`|See enterprise docs.|
142
143
  |`scriptSource`|String|No|`-`|See enterprise docs.|
143
144
  | `cleanup` | Boolean | No | `true` | Remove script tag after setup.|
@@ -153,6 +154,7 @@ return <HCaptcha ref={captchaRef} onLoad={onLoad} sitekey={sitekey} {...props} /
153
154
  |`onVerify`|`token, eKey`|When challenge is completed. The response `token` and an `eKey` (session id) are passed along.|
154
155
  |`onExpire`|-|When the current token expires.|
155
156
  |`onLoad`|-|When the hCaptcha API loads.|
157
+ |`onReady`|-|When the hCaptcha is ready to be used.|
156
158
  |`onOpen`|-|When the user display of a challenge starts.|
157
159
  |`onClose`|-|When the user dismisses a challenge.|
158
160
  |`onChalExpired`|-|When the user display of a challenge times out with no answer.|
@@ -204,6 +206,12 @@ To resolve this, update the version of the Sentry client you are including on yo
204
206
  You can avoid this issue by setting the `sentry` prop to `false`.
205
207
 
206
208
 
209
+ ### Handling SDK Errors
210
+
211
+ If the JS SDK fails to load, the `onError` callback will be invoked with `script-error` argument.
212
+
213
+ This will be rare, but could happen in the event you are testing offline, or have enabled a firewall that does not allow outbound connections to the asset hosts hCaptcha uses.
214
+
207
215
  ---
208
216
  ### Contributing
209
217
 
package/dist/esm/index.js CHANGED
@@ -122,7 +122,8 @@ var HCaptcha = /*#__PURE__*/function (_React$Component) {
122
122
  scriptSource = _this$props.scriptSource,
123
123
  secureApi = _this$props.secureApi,
124
124
  _this$props$cleanup = _this$props.cleanup,
125
- cleanup = _this$props$cleanup === void 0 ? true : _this$props$cleanup;
125
+ cleanup = _this$props$cleanup === void 0 ? true : _this$props$cleanup,
126
+ userJourneys = _this$props.userJourneys;
126
127
  var mountParams = {
127
128
  render: 'explicit',
128
129
  apihost: apihost,
@@ -139,7 +140,8 @@ var HCaptcha = /*#__PURE__*/function (_React$Component) {
139
140
  scriptLocation: scriptLocation,
140
141
  scriptSource: scriptSource,
141
142
  secureApi: secureApi,
142
- cleanup: cleanup
143
+ cleanup: cleanup,
144
+ uj: userJourneys !== undefined ? userJourneys : false
143
145
  };
144
146
  hCaptchaLoader(mountParams).then(this.handleOnLoad, this.handleError)["catch"](this.handleError);
145
147
  this.apiScriptRequested = true;
package/dist/index.js CHANGED
@@ -149,7 +149,8 @@ var HCaptcha = /*#__PURE__*/function (_React$Component) {
149
149
  scriptSource = _this$props.scriptSource,
150
150
  secureApi = _this$props.secureApi,
151
151
  _this$props$cleanup = _this$props.cleanup,
152
- cleanup = _this$props$cleanup === void 0 ? true : _this$props$cleanup;
152
+ cleanup = _this$props$cleanup === void 0 ? true : _this$props$cleanup,
153
+ userJourneys = _this$props.userJourneys;
153
154
  var mountParams = {
154
155
  render: 'explicit',
155
156
  apihost: apihost,
@@ -166,7 +167,8 @@ var HCaptcha = /*#__PURE__*/function (_React$Component) {
166
167
  scriptLocation: scriptLocation,
167
168
  scriptSource: scriptSource,
168
169
  secureApi: secureApi,
169
- cleanup: cleanup
170
+ cleanup: cleanup,
171
+ uj: userJourneys !== undefined ? userJourneys : false
170
172
  };
171
173
  (0, _loader.hCaptchaLoader)(mountParams).then(this.handleOnLoad, this.handleError)["catch"](this.handleError);
172
174
  this.apiScriptRequested = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hcaptcha/react-hcaptcha",
3
- "version": "1.12.1",
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.1"
63
+ "@hcaptcha/loader": "^2.2.0"
64
64
  }
65
65
  }
package/src/index.js CHANGED
@@ -130,7 +130,9 @@ class HCaptcha extends React.Component {
130
130
  scriptSource,
131
131
  secureApi,
132
132
  cleanup = true,
133
+ userJourneys,
133
134
  } = this.props;
135
+
134
136
  const mountParams = {
135
137
  render: 'explicit',
136
138
  apihost,
@@ -147,9 +149,10 @@ class HCaptcha extends React.Component {
147
149
  scriptLocation,
148
150
  scriptSource,
149
151
  secureApi,
150
- cleanup
152
+ cleanup,
153
+ uj: userJourneys !== undefined ? userJourneys : false,
151
154
  };
152
-
155
+
153
156
  hCaptchaLoader(mountParams)
154
157
  .then(this.handleOnLoad, this.handleError)
155
158
  .catch(this.handleError);
@@ -166,7 +169,7 @@ class HCaptcha extends React.Component {
166
169
  // • API is not ready
167
170
  // • Component has already been mounted
168
171
  if (!isApiReady || captchaId) return;
169
-
172
+
170
173
  const renderParams = Object.assign({
171
174
  "open-callback" : this.handleOpen,
172
175
  "close-callback" : this.handleClose,
package/types/index.d.ts CHANGED
@@ -31,6 +31,7 @@ interface HCaptchaProps {
31
31
  loadAsync?: boolean;
32
32
  scriptLocation?: HTMLElement | null;
33
33
  sentry?: boolean;
34
+ userJourneys?: boolean;
34
35
  cleanup?: boolean;
35
36
  custom?: boolean;
36
37
  secureApi?: boolean;