idmission-web-sdk 2.1.6 → 2.1.7

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.
@@ -140,7 +140,7 @@
140
140
  return cooked;
141
141
  }
142
142
 
143
- var webSdkVersion = '2.1.6';
143
+ var webSdkVersion = '2.1.7';
144
144
 
145
145
  function getPlatform() {
146
146
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -3046,11 +3046,11 @@
3046
3046
  checkEveryMs = 100;
3047
3047
  }
3048
3048
  return new Promise(function (resolve) {
3049
- var _a;
3050
- if (((_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) === 4) return resolve();
3049
+ var _a, _b;
3050
+ if (((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) !== null && _b !== void 0 ? _b : 0) >= 2) return resolve();
3051
3051
  var interval = setInterval(function () {
3052
- var _a;
3053
- if (((_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) === 4) {
3052
+ var _a, _b;
3053
+ if (((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) !== null && _b !== void 0 ? _b : 0) >= 2) {
3054
3054
  clearInterval(interval);
3055
3055
  resolve();
3056
3056
  }
@@ -10553,6 +10553,7 @@
10553
10553
  dispatch = _8[1];
10554
10554
  var _9 = React.useContext(CameraStateContext),
10555
10555
  cameraAccessDenied = _9.cameraAccessDenied,
10556
+ requestCameraAccess = _9.requestCameraAccess,
10556
10557
  releaseCameraAccess = _9.releaseCameraAccess;
10557
10558
  var _10 = React.useState(false),
10558
10559
  overlayDismissed = _10[0],
@@ -10663,6 +10664,7 @@
10663
10664
  attempt = _13[0],
10664
10665
  setAttempt = _13[1];
10665
10666
  var onExit = React.useCallback(function () {
10667
+ releaseCameraAccess();
10666
10668
  setOverlayDismissed(false);
10667
10669
  setAttempt(function (n) {
10668
10670
  return n + 1;
@@ -10671,7 +10673,8 @@
10671
10673
  type: 'resetWizard'
10672
10674
  });
10673
10675
  onExitCapture === null || onExitCapture === void 0 ? void 0 : onExitCapture();
10674
- }, [dispatch, onExitCapture]);
10676
+ requestCameraAccess();
10677
+ }, [dispatch, onExitCapture, releaseCameraAccess]);
10675
10678
  React.useEffect(function () {
10676
10679
  if (submissionStatus !== SubmissionStatus.READY) {
10677
10680
  releaseCameraAccessOnExit && releaseCameraAccess();
@@ -12388,6 +12391,7 @@
12388
12391
  logSelfieCaptureAttempt = _s.logSelfieCaptureAttempt;
12389
12392
  var _t = React.useContext(CameraStateContext),
12390
12393
  cameraAccessDenied = _t.cameraAccessDenied,
12394
+ requestCameraAccess = _t.requestCameraAccess,
12391
12395
  releaseCameraAccess = _t.releaseCameraAccess;
12392
12396
  var _u = React.useState(''),
12393
12397
  faceCropImageUrl = _u[0],
@@ -12459,8 +12463,22 @@
12459
12463
  return n + 1;
12460
12464
  });
12461
12465
  setCaptureState('LOADING');
12466
+ releaseCameraAccess();
12462
12467
  onExitCapture === null || onExitCapture === void 0 ? void 0 : onExitCapture();
12463
- }, [onExitCapture]);
12468
+ requestCameraAccess();
12469
+ }, [onExitCapture, releaseCameraAccess, requestCameraAccess]);
12470
+ var onRetryCallback = React.useCallback(function () {
12471
+ logCaptureMetadata();
12472
+ setAttempt(function (n) {
12473
+ return n + 1;
12474
+ });
12475
+ setRetryCount(function (n) {
12476
+ return n + 1;
12477
+ });
12478
+ setCaptureState('LOADING');
12479
+ releaseCameraAccess();
12480
+ requestCameraAccess();
12481
+ }, [logCaptureMetadata, releaseCameraAccess, requestCameraAccess]);
12464
12482
  var onDoneCallback = React.useCallback(function () {
12465
12483
  logCaptureMetadata();
12466
12484
  releaseCameraAccessOnExit && releaseCameraAccess();
@@ -12506,10 +12524,7 @@
12506
12524
  colors: colors.success,
12507
12525
  verbiage: verbiage.success,
12508
12526
  onDoneClick: onDoneCallback,
12509
- onRetryClick: function onRetryClick() {
12510
- logCaptureMetadata();
12511
- setCaptureState('CAPTURING');
12512
- }
12527
+ onRetryClick: onRetryCallback
12513
12528
  });
12514
12529
  case 'FAILED':
12515
12530
  return /*#__PURE__*/React__default['default'].createElement(FaceLivenessFailure, {
@@ -12519,13 +12534,7 @@
12519
12534
  colors: colors.failure,
12520
12535
  verbiage: verbiage.failure,
12521
12536
  canRetry: maxRetries > -1 && retryCount < maxRetries,
12522
- onRetryClick: function onRetryClick() {
12523
- logCaptureMetadata();
12524
- setRetryCount(function (c) {
12525
- return c + 1;
12526
- });
12527
- setCaptureState('CAPTURING');
12528
- },
12537
+ onRetryClick: onRetryCallback,
12529
12538
  onExitClick: function onExitClick() {
12530
12539
  releaseCameraAccessOnExit && releaseCameraAccess();
12531
12540
  setTimeout(function () {
@@ -13914,16 +13923,19 @@
13914
13923
  setSignatureData = _k.setSignatureData,
13915
13924
  setSignatureVideoUrl = _k.setSignatureVideoUrl,
13916
13925
  logSelfieCaptureAttempt = _k.logSelfieCaptureAttempt;
13917
- var cameraAccessDenied = React.useContext(CameraStateContext).cameraAccessDenied;
13918
- var _l = React.useState('LOADING'),
13919
- captureState = _l[0],
13920
- setCaptureState = _l[1];
13926
+ var _l = React.useContext(CameraStateContext),
13927
+ cameraAccessDenied = _l.cameraAccessDenied,
13928
+ requestCameraAccess = _l.requestCameraAccess,
13929
+ releaseCameraAccess = _l.releaseCameraAccess;
13930
+ var _m = React.useState('LOADING'),
13931
+ captureState = _m[0],
13932
+ setCaptureState = _m[1];
13921
13933
  var operationStartedAt = React.useRef();
13922
13934
  var captureStartedAt = React.useRef();
13923
13935
  var captureEndedAt = React.useRef();
13924
- var _m = React.useContext(SelfieGuidanceModelsContext),
13925
- start = _m.start,
13926
- stop = _m.stop;
13936
+ var _o = React.useContext(SelfieGuidanceModelsContext),
13937
+ start = _o.start,
13938
+ stop = _o.stop;
13927
13939
  React.useEffect(function () {
13928
13940
  operationStartedAt.current = new Date();
13929
13941
  }, []);
@@ -13980,16 +13992,18 @@
13980
13992
  var onSignatureCaptureFacesNotDetected = React.useCallback(function () {
13981
13993
  setCaptureState('CHECKING_LIVENESS');
13982
13994
  }, []);
13983
- var _o = React.useState(0),
13984
- attempt = _o[0],
13985
- setAttempt = _o[1];
13995
+ var _p = React.useState(0),
13996
+ attempt = _p[0],
13997
+ setAttempt = _p[1];
13986
13998
  var onExit = React.useCallback(function () {
13999
+ releaseCameraAccess();
13987
14000
  setAttempt(function (n) {
13988
14001
  return n + 1;
13989
14002
  });
13990
14003
  setCaptureState('LOADING');
13991
14004
  onExitCapture === null || onExitCapture === void 0 ? void 0 : onExitCapture();
13992
- }, [onExitCapture]);
14005
+ requestCameraAccess();
14006
+ }, [onExitCapture, releaseCameraAccess, requestCameraAccess]);
13993
14007
  var onRetry = React.useCallback(function () {
13994
14008
  onRetryClicked === null || onRetryClicked === void 0 ? void 0 : onRetryClicked();
13995
14009
  onExit();
@@ -14364,6 +14378,7 @@
14364
14378
  onIdBackImageCaptured = _a.onIdBackImageCaptured,
14365
14379
  onFaceNotDetected = _a.onFaceNotDetected,
14366
14380
  onRecordingFailed = _a.onRecordingFailed,
14381
+ onExitCapture = _a.onExitCapture,
14367
14382
  _w = _a.idCaptureModelsEnabled,
14368
14383
  idCaptureModelsEnabled = _w === void 0 ? true : _w,
14369
14384
  _x = _a.idCardFrontDelay,
@@ -14744,7 +14759,10 @@
14744
14759
  },
14745
14760
  disabled: !!countdownStartedAt || frameLock.current,
14746
14761
  className: classNames.captureBtn
14747
- }, captureBtnText))));
14762
+ }, captureBtnText))), /*#__PURE__*/React__default['default'].createElement(ExitCaptureButton, {
14763
+ onClick: onExitCapture,
14764
+ className: classNames.exitCaptureBtn
14765
+ }));
14748
14766
  };
14749
14767
  var CountdownContainer = styled__default['default'].div(templateObject_1$5 || (templateObject_1$5 = __makeTemplateObject(["\n position: fixed;\n top: 0;\n left: 0;\n width: 100dvw;\n height: 100dvh;\n z-index: 99999;\n display: flex;\n"], ["\n position: fixed;\n top: 0;\n left: 0;\n width: 100dvw;\n height: 100dvh;\n z-index: 99999;\n display: flex;\n"])));
14750
14768
  var Countdown = styled__default['default'].div(templateObject_2$5 || (templateObject_2$5 = __makeTemplateObject(["\n color: white;\n font-size: 64px;\n font-weight: bold;\n margin: auto;\n"], ["\n color: white;\n font-size: 64px;\n font-weight: bold;\n margin: auto;\n"])));
@@ -14997,13 +15015,19 @@
14997
15015
  });
14998
15016
  setCaptureState('CHECKING_LIVENESS');
14999
15017
  }, []);
15018
+ var handleExitCapture = React.useCallback(function () {
15019
+ setAttempt(function (n) {
15020
+ return n + 1;
15021
+ });
15022
+ onExitCapture === null || onExitCapture === void 0 ? void 0 : onExitCapture();
15023
+ }, [onExitCapture]);
15000
15024
  if (submissionStatus === SubmissionStatus.SUBMITTING) {
15001
15025
  return /*#__PURE__*/React__default['default'].createElement(PageContainer, {
15002
15026
  className: "flex"
15003
15027
  }, /*#__PURE__*/React__default['default'].createElement(Spinner$1, null));
15004
15028
  }
15005
15029
  return /*#__PURE__*/React__default['default'].createElement(CameraProvider, {
15006
- key: isCapturingId ? 'id-camera' : 'selfie-camera',
15030
+ key: "".concat(isCapturingId ? 'id' : 'selfie', "-camera-").concat(attempt),
15007
15031
  preferContinuityCamera: isCapturingId,
15008
15032
  preferFrontFacingCamera: !isCapturingId,
15009
15033
  requireMicrophoneAccess: !isCapturingId && !!readTextPrompt,
@@ -15039,7 +15063,7 @@
15039
15063
  colors: colors.idCapture,
15040
15064
  verbiage: verbiage.idCapture,
15041
15065
  onSuccess: onIdCaptureSuccess,
15042
- onExitCapture: onExitCapture,
15066
+ onExitCapture: handleExitCapture,
15043
15067
  onUserCancel: onUserCancel,
15044
15068
  skipSuccessScreen: true,
15045
15069
  releaseCameraAccessOnExit: false,
@@ -15055,7 +15079,7 @@
15055
15079
  silentFallback: silentFallback
15056
15080
  }, faceLivenessProps, {
15057
15081
  onComplete: onFaceCaptureSuccess,
15058
- onExitCapture: onExitCapture,
15082
+ onExitCapture: handleExitCapture,
15059
15083
  onExitAfterFailure: onFaceCaptureExitAfterFailure,
15060
15084
  onUserCancel: onUserCancel,
15061
15085
  skipSuccessScreen: true,
@@ -15075,6 +15099,7 @@
15075
15099
  onIdBackImageCaptured: setIdCaptureVideoIdBackImage,
15076
15100
  onFaceNotDetected: onVideoCaptureFaceNotDetected,
15077
15101
  onRecordingFailed: onRecordingFailed,
15102
+ onExitCapture: handleExitCapture,
15078
15103
  idCaptureModelsEnabled: idCaptureModelsEnabled,
15079
15104
  videoIdCaptureThresholds: videoIdCaptureThresholds,
15080
15105
  skipShowIdCardBack: skipShowIdCardBack,