idmission-web-sdk 2.2.44 → 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.
@@ -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.44';
214
+ var webSdkVersion = '2.2.46';
215
215
 
216
216
  function getPlatform() {
217
217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -9495,7 +9495,7 @@
9495
9495
  },
9496
9496
  requestCameraAccess: function requestCameraAccess() {
9497
9497
  return __awaiter(this, void 0, void 0, function () {
9498
- var _a, videoRef, releaseCameraAccess, preferFrontFacingCamera, preferIphoneContinuityCamera, iphoneContinuityCameraDenied, availableCameras, selectedCamera, platform_1, iphoneContinuityCamera, constraints, stream_1, e_1, iphoneContinuityCameraAvailable_1, handleStreamEnded, videoTrack_1, camera_1, e_3;
9498
+ 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;
9499
9499
  var _b, _c, _d;
9500
9500
  return __generator(this, function (_e) {
9501
9501
  switch (_e.label) {
@@ -9624,9 +9624,8 @@
9624
9624
  throw new Error('failed to open camera');
9625
9625
  }
9626
9626
  debug('camera access granted with constraints', constraints);
9627
- iphoneContinuityCameraAvailable_1 = get().iphoneContinuityCameraAvailable;
9628
- handleStreamEnded = function handleStreamEnded() {
9629
- if (iphoneContinuityCameraAvailable_1 && preferIphoneContinuityCamera) {
9627
+ handleStreamEnded_1 = function handleStreamEnded_1() {
9628
+ if (preferIphoneContinuityCamera && get().iphoneContinuityCameraAvailable) {
9630
9629
  debug('someone unplugged the continuity camera');
9631
9630
  set({
9632
9631
  videoStream: null,
@@ -9648,19 +9647,14 @@
9648
9647
  });
9649
9648
  }
9650
9649
  };
9651
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleStreamEnded);
9650
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleStreamEnded_1);
9652
9651
  videoTrack_1 = stream_1.getVideoTracks()[0];
9653
- videoTrack_1.onended = handleStreamEnded;
9652
+ videoTrack_1.onended = handleStreamEnded_1;
9654
9653
  camera_1 = obtainCameraAccess(stream_1, selectedCamera.label, videoRef.current);
9655
- // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
9656
- // when the camera access is being requested. This delay is a workaround for that.
9657
9654
  setTimeout(function () {
9658
- videoTrack_1.onmute = function () {
9659
- set({
9660
- cameraAccessDenied: true,
9661
- cameraReady: false
9662
- });
9663
- };
9655
+ // iOS 17 has a strange behavior where the video track flickers between muted and unmuted
9656
+ // when the camera access is being requested. This delay is a workaround for that.
9657
+ videoTrack_1.onmute = handleStreamEnded_1;
9664
9658
  set({
9665
9659
  camera: camera_1,
9666
9660
  cameraReady: true,
@@ -9731,20 +9725,19 @@
9731
9725
  microphoneReady: true,
9732
9726
  microphoneAccessDenied: false
9733
9727
  });
9734
- stream_2.getAudioTracks().forEach(function (track) {
9735
- track.onended = function () {
9736
- return set({
9737
- microphoneReady: false,
9738
- microphoneAccessDenied: true
9739
- });
9740
- };
9741
- track.onmute = function () {
9742
- return set({
9743
- microphoneReady: false,
9744
- microphoneAccessDenied: true
9745
- });
9746
- };
9747
- });
9728
+ var track = stream_2.getAudioTracks()[0];
9729
+ track.onended = function () {
9730
+ return set({
9731
+ microphoneReady: false,
9732
+ microphoneAccessDenied: true
9733
+ });
9734
+ };
9735
+ track.onmute = function () {
9736
+ return set({
9737
+ microphoneReady: false,
9738
+ microphoneAccessDenied: true
9739
+ });
9740
+ };
9748
9741
  }, 500);
9749
9742
  return [3 /*break*/, 4];
9750
9743
  case 3:
@@ -9778,9 +9771,6 @@
9778
9771
  if (config.requestAccessAutomatically) {
9779
9772
  void store.getState().requestCameraAccess();
9780
9773
  }
9781
- if (config.requireMicrophoneAccess) {
9782
- void store.getState().requestMicrophoneAccess();
9783
- }
9784
9774
  return _assign(_assign({}, store), {
9785
9775
  destroy: function destroy() {
9786
9776
  store.getState().releaseCameraAccess();
@@ -9829,6 +9819,15 @@
9829
9819
  (_c = store.current) === null || _c === void 0 ? void 0 : _c.getState().requestCameraAccess();
9830
9820
  }
9831
9821
  }, [preferFrontFacingCamera, preferIphoneContinuityCamera]);
9822
+ React.useEffect(function () {
9823
+ var _a;
9824
+ if (!requireMicrophoneAccess) return;
9825
+ (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState().requestMicrophoneAccess();
9826
+ return function () {
9827
+ var _a;
9828
+ return (_a = store.current) === null || _a === void 0 ? void 0 : _a.getState().releaseMicrophoneAccess();
9829
+ };
9830
+ }, [requireMicrophoneAccess]);
9832
9831
  React.useEffect(function () {
9833
9832
  return function () {
9834
9833
  var _a;
@@ -21884,10 +21883,10 @@
21884
21883
  }
21885
21884
  }, [audioUrl, isRecordingVideo, mergeAVStreams, onComplete, readTextPrompt, releaseCameraAccess, startRecordingVideo, videoUrl]);
21886
21885
  React.useEffect(function () {
21887
- if (videoRecordingUnintentionallyStopped || audioRecordingUnintentionallyStopped) {
21886
+ if (videoRecordingUnintentionallyStopped || audioRecordingUnintentionallyStopped || !!readTextPrompt && !microphoneReady) {
21888
21887
  onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
21889
21888
  }
21890
- }, [audioRecordingUnintentionallyStopped, onRecordingFailed, videoRecordingUnintentionallyStopped]);
21889
+ }, [audioRecordingUnintentionallyStopped, microphoneReady, onRecordingFailed, readTextPrompt, videoRecordingUnintentionallyStopped]);
21891
21890
  var _23 = React.useState('SHOW_ID_FRONT'),
21892
21891
  requestedAction = _23[0],
21893
21892
  setRequestedAction = _23[1];
@@ -21896,7 +21895,7 @@
21896
21895
  if (!shouldRunIdModels) return;
21897
21896
  startIdModels();
21898
21897
  return function () {
21899
- stopIdModels();
21898
+ return stopIdModels();
21900
21899
  };
21901
21900
  }, [shouldRunIdModels, startIdModels, stopIdModels]);
21902
21901
  React.useEffect(function () {
@@ -22122,8 +22121,6 @@
22122
22121
  videoHeight: (_j = (_h = videoRef.current) === null || _h === void 0 ? void 0 : _h.videoHeight) !== null && _j !== void 0 ? _j : 0
22123
22122
  });
22124
22123
  var capturingId = ['SHOW_ID_FRONT', 'SHOW_ID_BACK'].includes(requestedAction);
22125
- // const searchingForIdCard =
22126
- // idCaptureModelsEnabled && capturingId && !goodFramesThresholdMet
22127
22124
  var guidanceText = !faceCentered ? faceNotCenteredText : undefined;
22128
22125
  return /*#__PURE__*/React.createElement(PageContainer, {
22129
22126
  ref: ref,
@@ -22176,7 +22173,7 @@
22176
22173
  }, /*#__PURE__*/React.createElement(CaptureButton, {
22177
22174
  finished: true,
22178
22175
  onClick: function onClick() {
22179
- setCountdownStartedAt(new Date());
22176
+ return setCountdownStartedAt(new Date());
22180
22177
  },
22181
22178
  disabled: !!countdownStartedAt || frameLock.current,
22182
22179
  className: classNames.captureBtn