idmission-web-sdk 2.2.45 → 2.2.46

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/dist/sdk2.esm.js CHANGED
@@ -203,7 +203,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
203
203
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
204
204
  };
205
205
 
206
- var webSdkVersion = '2.2.45';
206
+ var webSdkVersion = '2.2.46';
207
207
 
208
208
  function getPlatform() {
209
209
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -3368,7 +3368,7 @@ var createCameraStore = function createCameraStore(config) {
3368
3368
  },
3369
3369
  requestCameraAccess: function requestCameraAccess() {
3370
3370
  return __awaiter(this, void 0, void 0, function () {
3371
- var _a, videoRef, releaseCameraAccess, preferFrontFacingCamera, preferIphoneContinuityCamera, iphoneContinuityCameraDenied, availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, constraints, stream_1, e_1, iphoneContinuityCameraAvailable_1, handleStreamEnded_1, videoTrack_1, camera_1, e_3;
3371
+ var _a, videoRef, releaseCameraAccess, preferFrontFacingCamera, preferIphoneContinuityCamera, iphoneContinuityCameraDenied, availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, constraints, stream_1, e_1, handleStreamEnded_1, videoTrack_1, camera_1, e_3;
3372
3372
  var _b, _c, _d;
3373
3373
  return __generator(this, function (_e) {
3374
3374
  switch (_e.label) {
@@ -3497,9 +3497,8 @@ var createCameraStore = function createCameraStore(config) {
3497
3497
  throw new Error('failed to open camera');
3498
3498
  }
3499
3499
  debug('camera access granted with constraints', constraints);
3500
- iphoneContinuityCameraAvailable_1 = get().iphoneContinuityCameraAvailable;
3501
3500
  handleStreamEnded_1 = function handleStreamEnded_1() {
3502
- if (iphoneContinuityCameraAvailable_1 && preferIphoneContinuityCamera) {
3501
+ if (preferIphoneContinuityCamera && get().iphoneContinuityCameraAvailable) {
3503
3502
  debug('someone unplugged the continuity camera');
3504
3503
  set({
3505
3504
  videoStream: null,
@@ -3525,9 +3524,9 @@ var createCameraStore = function createCameraStore(config) {
3525
3524
  videoTrack_1 = stream_1.getVideoTracks()[0];
3526
3525
  videoTrack_1.onended = handleStreamEnded_1;
3527
3526
  camera_1 = obtainCameraAccess(stream_1, selectedCamera.label, videoRef.current);
3528
- // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
3529
- // when the camera access is being requested. This delay is a workaround for that.
3530
3527
  setTimeout(function () {
3528
+ // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
3529
+ // when the camera access is being requested. This delay is a workaround for that.
3531
3530
  videoTrack_1.onmute = handleStreamEnded_1;
3532
3531
  set({
3533
3532
  camera: camera_1,
@@ -3599,20 +3598,19 @@ var createCameraStore = function createCameraStore(config) {
3599
3598
  microphoneReady: true,
3600
3599
  microphoneAccessDenied: false
3601
3600
  });
3602
- stream_2.getAudioTracks().forEach(function (track) {
3603
- track.onended = function () {
3604
- return set({
3605
- microphoneReady: false,
3606
- microphoneAccessDenied: true
3607
- });
3608
- };
3609
- track.onmute = function () {
3610
- return set({
3611
- microphoneReady: false,
3612
- microphoneAccessDenied: true
3613
- });
3614
- };
3615
- });
3601
+ var track = stream_2.getAudioTracks()[0];
3602
+ track.onended = function () {
3603
+ return set({
3604
+ microphoneReady: false,
3605
+ microphoneAccessDenied: true
3606
+ });
3607
+ };
3608
+ track.onmute = function () {
3609
+ return set({
3610
+ microphoneReady: false,
3611
+ microphoneAccessDenied: true
3612
+ });
3613
+ };
3616
3614
  }, 500);
3617
3615
  return [3 /*break*/, 4];
3618
3616
  case 3:
@@ -3646,9 +3644,6 @@ var createCameraStore = function createCameraStore(config) {
3646
3644
  if (config.requestAccessAutomatically) {
3647
3645
  void store.getState().requestCameraAccess();
3648
3646
  }
3649
- if (config.requireMicrophoneAccess) {
3650
- void store.getState().requestMicrophoneAccess();
3651
- }
3652
3647
  return _assign(_assign({}, store), {
3653
3648
  destroy: function destroy() {
3654
3649
  store.getState().releaseCameraAccess();
@@ -3697,6 +3692,15 @@ function CameraStoreProvider(_a) {
3697
3692
  (_c = store.current) === null || _c === void 0 ? void 0 : _c.getState().requestCameraAccess();
3698
3693
  }
3699
3694
  }, [preferFrontFacingCamera, preferIphoneContinuityCamera]);
3695
+ useEffect(function () {
3696
+ var _a;
3697
+ if (!requireMicrophoneAccess) return;
3698
+ (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState().requestMicrophoneAccess();
3699
+ return function () {
3700
+ var _a;
3701
+ return (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState().releaseMicrophoneAccess();
3702
+ };
3703
+ }, [requireMicrophoneAccess]);
3700
3704
  useEffect(function () {
3701
3705
  return function () {
3702
3706
  var _a;
@@ -12046,10 +12050,10 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12046
12050
  }
12047
12051
  }, [audioUrl, isRecordingVideo, mergeAVStreams, onComplete, readTextPrompt, releaseCameraAccess, startRecordingVideo, videoUrl]);
12048
12052
  useEffect(function () {
12049
- if (videoRecordingUnintentionallyStopped || audioRecordingUnintentionallyStopped) {
12053
+ if (videoRecordingUnintentionallyStopped || audioRecordingUnintentionallyStopped || !!readTextPrompt && !microphoneReady) {
12050
12054
  onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
12051
12055
  }
12052
- }, [audioRecordingUnintentionallyStopped, onRecordingFailed, videoRecordingUnintentionallyStopped]);
12056
+ }, [audioRecordingUnintentionallyStopped, microphoneReady, onRecordingFailed, readTextPrompt, videoRecordingUnintentionallyStopped]);
12053
12057
  var _23 = useState('SHOW_ID_FRONT'),
12054
12058
  requestedAction = _23[0],
12055
12059
  setRequestedAction = _23[1];
@@ -12058,7 +12062,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12058
12062
  if (!shouldRunIdModels) return;
12059
12063
  startIdModels();
12060
12064
  return function () {
12061
- stopIdModels();
12065
+ return stopIdModels();
12062
12066
  };
12063
12067
  }, [shouldRunIdModels, startIdModels, stopIdModels]);
12064
12068
  useEffect(function () {
@@ -12284,8 +12288,6 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12284
12288
  videoHeight: (_j = (_h = videoRef.current) === null || _h === void 0 ? void 0 : _h.videoHeight) !== null && _j !== void 0 ? _j : 0
12285
12289
  });
12286
12290
  var capturingId = ['SHOW_ID_FRONT', 'SHOW_ID_BACK'].includes(requestedAction);
12287
- // const searchingForIdCard =
12288
- // idCaptureModelsEnabled && capturingId && !goodFramesThresholdMet
12289
12291
  var guidanceText = !faceCentered ? faceNotCenteredText : undefined;
12290
12292
  return /*#__PURE__*/React__default.createElement(PageContainer, {
12291
12293
  ref: ref,
@@ -12338,7 +12340,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12338
12340
  }, /*#__PURE__*/React__default.createElement(CaptureButton, {
12339
12341
  finished: true,
12340
12342
  onClick: function onClick() {
12341
- setCountdownStartedAt(new Date());
12343
+ return setCountdownStartedAt(new Date());
12342
12344
  },
12343
12345
  disabled: !!countdownStartedAt || frameLock.current,
12344
12346
  className: classNames.captureBtn