idmission-web-sdk 2.2.9 → 2.2.11

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.
@@ -211,7 +211,7 @@
211
211
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
212
212
  };
213
213
 
214
- var webSdkVersion = '2.2.9';
214
+ var webSdkVersion = '2.2.11';
215
215
 
216
216
  function getPlatform() {
217
217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -18653,7 +18653,9 @@
18653
18653
  var _b, _c, _d, _e;
18654
18654
  var onCapture = _a.onCapture,
18655
18655
  onSuccess = _a.onSuccess,
18656
+ onFailure = _a.onFailure,
18656
18657
  onTimeout = _a.onTimeout,
18658
+ onDenied = _a.onDenied,
18657
18659
  onExit = _a.onExit,
18658
18660
  _f = _a.timeoutDurationMs,
18659
18661
  timeoutDurationMs = _f === void 0 ? 15000 : _f,
@@ -18764,14 +18766,12 @@
18764
18766
  return [4 /*yield*/, dataUrlToBase64(imageUrl)];
18765
18767
  case 2:
18766
18768
  imageData = _b.sent();
18767
- return [4 /*yield*/, checkLiveness(imageData)
18768
- // todo: JN - this feels dirty and is the reason for the todo around line 83 - but is necessary to handle fallback liveness validation
18769
- ];
18769
+ return [4 /*yield*/, checkLiveness(imageData)];
18770
18770
  case 3:
18771
18771
  response = _b.sent();
18772
- // todo: JN - this feels dirty and is the reason for the todo around line 83 - but is necessary to handle fallback liveness validation
18773
18772
  if (((_a = response === null || response === void 0 ? void 0 : response.resultData) === null || _a === void 0 ? void 0 : _a.verificationResult) !== 'Live Face Detected') {
18774
- onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout();
18773
+ onFailure === null || onFailure === void 0 ? void 0 : onFailure();
18774
+ onDenied === null || onDenied === void 0 ? void 0 : onDenied();
18775
18775
  }
18776
18776
  dispatch({
18777
18777
  type: 'livenessChecked',
@@ -18795,7 +18795,7 @@
18795
18795
  }
18796
18796
  });
18797
18797
  });
18798
- }, [checkLiveness, onTimeout]);
18798
+ }, [checkLiveness, onFailure, onDenied]);
18799
18799
  React.useEffect(function () {
18800
18800
  if (state.requestState === 'FAILED' || state.requestState === 'ERROR') {
18801
18801
  setTimeout(function () {
@@ -18812,10 +18812,15 @@
18812
18812
  if (modelError) return;
18813
18813
  var allowedFailures = 2;
18814
18814
  if (state.timesLivenessCheckFailed > allowedFailures) {
18815
- onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout();
18816
- }
18817
- }, [modelError, onTimeout, state.timesLivenessCheckFailed]);
18818
- useTimeout(timeoutDurationMs, onTimeout, state.requestState === 'PASSED' || !!modelError, state.requestState === 'IN_PROGRESS');
18815
+ onFailure === null || onFailure === void 0 ? void 0 : onFailure();
18816
+ onDenied === null || onDenied === void 0 ? void 0 : onDenied();
18817
+ }
18818
+ }, [modelError, onFailure, onDenied, state.timesLivenessCheckFailed]);
18819
+ var callOnTimeoutHooks = React.useCallback(function () {
18820
+ onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout();
18821
+ onDenied === null || onDenied === void 0 ? void 0 : onDenied();
18822
+ }, [onDenied, onTimeout]);
18823
+ useTimeout(timeoutDurationMs, callOnTimeoutHooks, state.requestState === 'PASSED' || !!modelError, state.requestState === 'IN_PROGRESS');
18819
18824
  var verbiage = useTranslations(rawVerbiage, {
18820
18825
  guidanceLivenessCheckFailedText: 'Could not verify your face.',
18821
18826
  guidanceLivenessCheckErrorText: 'An error occurred while verifying your face.',
@@ -19303,7 +19308,9 @@
19303
19308
  var _b, _c, _d;
19304
19309
  var onComplete = _a.onComplete,
19305
19310
  onSuccess = _a.onSuccess,
19311
+ onFailure = _a.onFailure,
19306
19312
  onTimeout = _a.onTimeout,
19313
+ onDenied = _a.onDenied,
19307
19314
  onExitCapture = _a.onExitCapture,
19308
19315
  onExitAfterFailure = _a.onExitAfterFailure,
19309
19316
  onUserCancel = _a.onUserCancel,
@@ -19401,11 +19408,18 @@
19401
19408
  });
19402
19409
  });
19403
19410
  }, [onSuccess, setSelfieImage, livenessCheckRequest, submissionResponse]);
19404
- // todo: JN - how this is being used, it would make sense to rename the prop as well, but that would be a breaking change - discuss
19405
- var onFailureOrTimeout = React.useCallback(function () {
19411
+ var onFailureCallback = React.useCallback(function () {
19412
+ return __awaiter(void 0, void 0, void 0, function () {
19413
+ return __generator(this, function (_a) {
19414
+ onFailure === null || onFailure === void 0 ? void 0 : onFailure(submissionResponse, livenessCheckRequest);
19415
+ return [2 /*return*/];
19416
+ });
19417
+ });
19418
+ }, [livenessCheckRequest, onFailure, submissionResponse]);
19419
+ var onDeniedCallback = React.useCallback(function () {
19406
19420
  setCaptureState('FAILED');
19407
- onTimeout === null || onTimeout === void 0 ? void 0 : onTimeout(submissionResponse, livenessCheckRequest);
19408
- }, [onTimeout, livenessCheckRequest, submissionResponse]);
19421
+ onDenied === null || onDenied === void 0 ? void 0 : onDenied(submissionResponse, livenessCheckRequest);
19422
+ }, [onDenied, submissionResponse, livenessCheckRequest]);
19409
19423
  var _y = React.useState(0),
19410
19424
  attempt = _y[0],
19411
19425
  setAttempt = _y[1];
@@ -19466,7 +19480,9 @@
19466
19480
  key: "capture".concat(attempt),
19467
19481
  onCapture: onCapture,
19468
19482
  onSuccess: onSuccessCallback,
19469
- onTimeout: onFailureOrTimeout,
19483
+ onFailure: onFailureCallback,
19484
+ onTimeout: onTimeout,
19485
+ onDenied: onDeniedCallback,
19470
19486
  onExit: onExitCallback,
19471
19487
  timeoutDurationMs: timeoutDurationMs,
19472
19488
  silentFallback: silentFallback,
@@ -23143,7 +23159,7 @@
23143
23159
  skipSuccessScreen: skipSuccessScreen,
23144
23160
  onComplete: onComplete,
23145
23161
  onSuccess: onApproved,
23146
- onTimeout: onDenied,
23162
+ onDenied: onDenied,
23147
23163
  onExitCapture: onExitCapture,
23148
23164
  onExitAfterFailure: onExitAfterFailure,
23149
23165
  onModelError: onModelError,
@@ -23321,7 +23337,7 @@
23321
23337
  loadingOverlayMode: faceLivenessLoadingOverlayMode,
23322
23338
  timeoutDurationMs: faceLivenessTimeoutDurationMs,
23323
23339
  modelLoadTimeoutMs: selfieCaptureModelLoadTimeoutMs,
23324
- onTimeout: onDenied,
23340
+ onDenied: onDenied,
23325
23341
  onExitCapture: onExitCapture,
23326
23342
  onExitAfterFailure: onExitAfterFailure,
23327
23343
  onUserCancel: onUserCancel,