idmission-web-sdk 2.1.5 → 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.
@@ -19,6 +19,7 @@ export type IdVideoCaptureClassNames = {
19
19
  countdown?: string;
20
20
  captureBtnContainer?: string;
21
21
  captureBtn?: string;
22
+ exitCaptureBtn?: string;
22
23
  };
23
24
  export type IdVideoCaptureColors = {
24
25
  guidesSatisfiedColor?: string;
@@ -47,6 +48,7 @@ export type IdVideoCaptureProps = {
47
48
  onIdBackImageCaptured?: (imageUrl: string) => void;
48
49
  onFaceNotDetected?: () => void;
49
50
  onRecordingFailed?: () => void;
51
+ onExitCapture?: () => void;
50
52
  idCaptureModelsEnabled?: boolean;
51
53
  videoIdCaptureThresholds?: VideoIdCaptureThresholds;
52
54
  idCardFrontDelay?: number;
@@ -64,4 +66,4 @@ export type IdVideoCaptureProps = {
64
66
  verbiage?: IdVideoCaptureVerbiage;
65
67
  debugMode?: boolean;
66
68
  };
67
- export declare const IdVideoCapture: ({ onComplete, onIdFrontImageCaptured, onIdBackImageCaptured, onFaceNotDetected, onRecordingFailed, idCaptureModelsEnabled, idCardFrontDelay, videoIdCaptureThresholds, skipShowIdCardBack, captureCountdownSeconds, readTextPrompt, readTextTimeoutDurationMs, readTextMinReadingMs, disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, mergeAVStreams, assets, classNames, colors, verbiage: rawVerbiage, debugMode, }: IdVideoCaptureProps) => ReactElement;
69
+ export declare const IdVideoCapture: ({ onComplete, onIdFrontImageCaptured, onIdBackImageCaptured, onFaceNotDetected, onRecordingFailed, onExitCapture, idCaptureModelsEnabled, idCardFrontDelay, videoIdCaptureThresholds, skipShowIdCardBack, captureCountdownSeconds, readTextPrompt, readTextTimeoutDurationMs, readTextMinReadingMs, disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, mergeAVStreams, assets, classNames, colors, verbiage: rawVerbiage, debugMode, }: IdVideoCaptureProps) => ReactElement;
@@ -49,7 +49,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
49
49
  var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
50
50
  var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
51
51
 
52
- var webSdkVersion = '2.1.5';
52
+ var webSdkVersion = '2.1.7';
53
53
 
54
54
  function getPlatform() {
55
55
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -2493,11 +2493,11 @@ function waitForVideoReady(videoRef, checkEveryMs) {
2493
2493
  checkEveryMs = 100;
2494
2494
  }
2495
2495
  return new Promise(function (resolve) {
2496
- var _a;
2497
- if (((_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) === 4) return resolve();
2496
+ var _a, _b;
2497
+ if (((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) !== null && _b !== void 0 ? _b : 0) >= 2) return resolve();
2498
2498
  var interval = setInterval(function () {
2499
- var _a;
2500
- if (((_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) === 4) {
2499
+ var _a, _b;
2500
+ if (((_b = (_a = videoRef.current) === null || _a === void 0 ? void 0 : _a.readyState) !== null && _b !== void 0 ? _b : 0) >= 2) {
2501
2501
  clearInterval(interval);
2502
2502
  resolve();
2503
2503
  }
@@ -7315,6 +7315,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
7315
7315
  dispatch = _8[1];
7316
7316
  var _9 = React.useContext(CameraStateContext),
7317
7317
  cameraAccessDenied = _9.cameraAccessDenied,
7318
+ requestCameraAccess = _9.requestCameraAccess,
7318
7319
  releaseCameraAccess = _9.releaseCameraAccess;
7319
7320
  var _10 = React.useState(false),
7320
7321
  overlayDismissed = _10[0],
@@ -7425,6 +7426,7 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
7425
7426
  attempt = _13[0],
7426
7427
  setAttempt = _13[1];
7427
7428
  var onExit = React.useCallback(function () {
7429
+ releaseCameraAccess();
7428
7430
  setOverlayDismissed(false);
7429
7431
  setAttempt(function (n) {
7430
7432
  return n + 1;
@@ -7433,7 +7435,8 @@ var IdCaptureWizard = function IdCaptureWizard(_a) {
7433
7435
  type: 'resetWizard'
7434
7436
  });
7435
7437
  onExitCapture === null || onExitCapture === void 0 ? void 0 : onExitCapture();
7436
- }, [dispatch, onExitCapture]);
7438
+ requestCameraAccess();
7439
+ }, [dispatch, onExitCapture, releaseCameraAccess]);
7437
7440
  React.useEffect(function () {
7438
7441
  if (submissionStatus !== SubmissionStatus.READY) {
7439
7442
  releaseCameraAccessOnExit && releaseCameraAccess();
@@ -9150,6 +9153,7 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
9150
9153
  logSelfieCaptureAttempt = _s.logSelfieCaptureAttempt;
9151
9154
  var _t = React.useContext(CameraStateContext),
9152
9155
  cameraAccessDenied = _t.cameraAccessDenied,
9156
+ requestCameraAccess = _t.requestCameraAccess,
9153
9157
  releaseCameraAccess = _t.releaseCameraAccess;
9154
9158
  var _u = React.useState(''),
9155
9159
  faceCropImageUrl = _u[0],
@@ -9221,8 +9225,22 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
9221
9225
  return n + 1;
9222
9226
  });
9223
9227
  setCaptureState('LOADING');
9228
+ releaseCameraAccess();
9224
9229
  onExitCapture === null || onExitCapture === void 0 ? void 0 : onExitCapture();
9225
- }, [onExitCapture]);
9230
+ requestCameraAccess();
9231
+ }, [onExitCapture, releaseCameraAccess, requestCameraAccess]);
9232
+ var onRetryCallback = React.useCallback(function () {
9233
+ logCaptureMetadata();
9234
+ setAttempt(function (n) {
9235
+ return n + 1;
9236
+ });
9237
+ setRetryCount(function (n) {
9238
+ return n + 1;
9239
+ });
9240
+ setCaptureState('LOADING');
9241
+ releaseCameraAccess();
9242
+ requestCameraAccess();
9243
+ }, [logCaptureMetadata, releaseCameraAccess, requestCameraAccess]);
9226
9244
  var onDoneCallback = React.useCallback(function () {
9227
9245
  logCaptureMetadata();
9228
9246
  releaseCameraAccessOnExit && releaseCameraAccess();
@@ -9268,10 +9286,7 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
9268
9286
  colors: colors.success,
9269
9287
  verbiage: verbiage.success,
9270
9288
  onDoneClick: onDoneCallback,
9271
- onRetryClick: function onRetryClick() {
9272
- logCaptureMetadata();
9273
- setCaptureState('CAPTURING');
9274
- }
9289
+ onRetryClick: onRetryCallback
9275
9290
  });
9276
9291
  case 'FAILED':
9277
9292
  return /*#__PURE__*/React__default['default'].createElement(FaceLivenessFailure, {
@@ -9281,13 +9296,7 @@ var FaceLivenessWizard = function FaceLivenessWizard(_a) {
9281
9296
  colors: colors.failure,
9282
9297
  verbiage: verbiage.failure,
9283
9298
  canRetry: maxRetries > -1 && retryCount < maxRetries,
9284
- onRetryClick: function onRetryClick() {
9285
- logCaptureMetadata();
9286
- setRetryCount(function (c) {
9287
- return c + 1;
9288
- });
9289
- setCaptureState('CAPTURING');
9290
- },
9299
+ onRetryClick: onRetryCallback,
9291
9300
  onExitClick: function onExitClick() {
9292
9301
  releaseCameraAccessOnExit && releaseCameraAccess();
9293
9302
  setTimeout(function () {
@@ -10056,16 +10065,19 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
10056
10065
  setSignatureData = _k.setSignatureData,
10057
10066
  setSignatureVideoUrl = _k.setSignatureVideoUrl,
10058
10067
  logSelfieCaptureAttempt = _k.logSelfieCaptureAttempt;
10059
- var cameraAccessDenied = React.useContext(CameraStateContext).cameraAccessDenied;
10060
- var _l = React.useState('LOADING'),
10061
- captureState = _l[0],
10062
- setCaptureState = _l[1];
10068
+ var _l = React.useContext(CameraStateContext),
10069
+ cameraAccessDenied = _l.cameraAccessDenied,
10070
+ requestCameraAccess = _l.requestCameraAccess,
10071
+ releaseCameraAccess = _l.releaseCameraAccess;
10072
+ var _m = React.useState('LOADING'),
10073
+ captureState = _m[0],
10074
+ setCaptureState = _m[1];
10063
10075
  var operationStartedAt = React.useRef();
10064
10076
  var captureStartedAt = React.useRef();
10065
10077
  var captureEndedAt = React.useRef();
10066
- var _m = React.useContext(SelfieGuidanceModelsContext),
10067
- start = _m.start,
10068
- stop = _m.stop;
10078
+ var _o = React.useContext(SelfieGuidanceModelsContext),
10079
+ start = _o.start,
10080
+ stop = _o.stop;
10069
10081
  React.useEffect(function () {
10070
10082
  operationStartedAt.current = new Date();
10071
10083
  }, []);
@@ -10122,16 +10134,18 @@ var VideoSignatureWizard = function VideoSignatureWizard(_a) {
10122
10134
  var onSignatureCaptureFacesNotDetected = React.useCallback(function () {
10123
10135
  setCaptureState('CHECKING_LIVENESS');
10124
10136
  }, []);
10125
- var _o = React.useState(0),
10126
- attempt = _o[0],
10127
- setAttempt = _o[1];
10137
+ var _p = React.useState(0),
10138
+ attempt = _p[0],
10139
+ setAttempt = _p[1];
10128
10140
  var onExit = React.useCallback(function () {
10141
+ releaseCameraAccess();
10129
10142
  setAttempt(function (n) {
10130
10143
  return n + 1;
10131
10144
  });
10132
10145
  setCaptureState('LOADING');
10133
10146
  onExitCapture === null || onExitCapture === void 0 ? void 0 : onExitCapture();
10134
- }, [onExitCapture]);
10147
+ requestCameraAccess();
10148
+ }, [onExitCapture, releaseCameraAccess, requestCameraAccess]);
10135
10149
  var onRetry = React.useCallback(function () {
10136
10150
  onRetryClicked === null || onRetryClicked === void 0 ? void 0 : onRetryClicked();
10137
10151
  onExit();
@@ -10506,6 +10520,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
10506
10520
  onIdBackImageCaptured = _a.onIdBackImageCaptured,
10507
10521
  onFaceNotDetected = _a.onFaceNotDetected,
10508
10522
  onRecordingFailed = _a.onRecordingFailed,
10523
+ onExitCapture = _a.onExitCapture,
10509
10524
  _w = _a.idCaptureModelsEnabled,
10510
10525
  idCaptureModelsEnabled = _w === void 0 ? true : _w,
10511
10526
  _x = _a.idCardFrontDelay,
@@ -10886,7 +10901,10 @@ var IdVideoCapture = function IdVideoCapture(_a) {
10886
10901
  },
10887
10902
  disabled: !!countdownStartedAt || frameLock.current,
10888
10903
  className: classNames.captureBtn
10889
- }, captureBtnText))));
10904
+ }, captureBtnText))), /*#__PURE__*/React__default['default'].createElement(ExitCaptureButton, {
10905
+ onClick: onExitCapture,
10906
+ className: classNames.exitCaptureBtn
10907
+ }));
10890
10908
  };
10891
10909
  var CountdownContainer = styled__default['default'].div(templateObject_1$5 || (templateObject_1$5 = tslib.__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"])));
10892
10910
  var Countdown = styled__default['default'].div(templateObject_2$5 || (templateObject_2$5 = tslib.__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"])));
@@ -11139,13 +11157,19 @@ var VideoIdWizard = function VideoIdWizard(_a) {
11139
11157
  });
11140
11158
  setCaptureState('CHECKING_LIVENESS');
11141
11159
  }, []);
11160
+ var handleExitCapture = React.useCallback(function () {
11161
+ setAttempt(function (n) {
11162
+ return n + 1;
11163
+ });
11164
+ onExitCapture === null || onExitCapture === void 0 ? void 0 : onExitCapture();
11165
+ }, [onExitCapture]);
11142
11166
  if (submissionStatus === SubmissionStatus.SUBMITTING) {
11143
11167
  return /*#__PURE__*/React__default['default'].createElement(PageContainer, {
11144
11168
  className: "flex"
11145
11169
  }, /*#__PURE__*/React__default['default'].createElement(Spinner, null));
11146
11170
  }
11147
11171
  return /*#__PURE__*/React__default['default'].createElement(CameraProvider, {
11148
- key: isCapturingId ? 'id-camera' : 'selfie-camera',
11172
+ key: "".concat(isCapturingId ? 'id' : 'selfie', "-camera-").concat(attempt),
11149
11173
  preferContinuityCamera: isCapturingId,
11150
11174
  preferFrontFacingCamera: !isCapturingId,
11151
11175
  requireMicrophoneAccess: !isCapturingId && !!readTextPrompt,
@@ -11181,7 +11205,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
11181
11205
  colors: colors.idCapture,
11182
11206
  verbiage: verbiage.idCapture,
11183
11207
  onSuccess: onIdCaptureSuccess,
11184
- onExitCapture: onExitCapture,
11208
+ onExitCapture: handleExitCapture,
11185
11209
  onUserCancel: onUserCancel,
11186
11210
  skipSuccessScreen: true,
11187
11211
  releaseCameraAccessOnExit: false,
@@ -11197,7 +11221,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
11197
11221
  silentFallback: silentFallback
11198
11222
  }, faceLivenessProps, {
11199
11223
  onComplete: onFaceCaptureSuccess,
11200
- onExitCapture: onExitCapture,
11224
+ onExitCapture: handleExitCapture,
11201
11225
  onExitAfterFailure: onFaceCaptureExitAfterFailure,
11202
11226
  onUserCancel: onUserCancel,
11203
11227
  skipSuccessScreen: true,
@@ -11217,6 +11241,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
11217
11241
  onIdBackImageCaptured: setIdCaptureVideoIdBackImage,
11218
11242
  onFaceNotDetected: onVideoCaptureFaceNotDetected,
11219
11243
  onRecordingFailed: onRecordingFailed,
11244
+ onExitCapture: handleExitCapture,
11220
11245
  idCaptureModelsEnabled: idCaptureModelsEnabled,
11221
11246
  videoIdCaptureThresholds: videoIdCaptureThresholds,
11222
11247
  skipShowIdCardBack: skipShowIdCardBack,