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.
@@ -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.45';
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_1, 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
9627
  handleStreamEnded_1 = function handleStreamEnded_1() {
9629
- if (iphoneContinuityCameraAvailable_1 && preferIphoneContinuityCamera) {
9628
+ if (preferIphoneContinuityCamera && get().iphoneContinuityCameraAvailable) {
9630
9629
  debug('someone unplugged the continuity camera');
9631
9630
  set({
9632
9631
  videoStream: null,
@@ -9652,9 +9651,9 @@
9652
9651
  videoTrack_1 = stream_1.getVideoTracks()[0];
9653
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 () {
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.
9658
9657
  videoTrack_1.onmute = handleStreamEnded_1;
9659
9658
  set({
9660
9659
  camera: camera_1,
@@ -9726,20 +9725,19 @@
9726
9725
  microphoneReady: true,
9727
9726
  microphoneAccessDenied: false
9728
9727
  });
9729
- stream_2.getAudioTracks().forEach(function (track) {
9730
- track.onended = function () {
9731
- return set({
9732
- microphoneReady: false,
9733
- microphoneAccessDenied: true
9734
- });
9735
- };
9736
- track.onmute = function () {
9737
- return set({
9738
- microphoneReady: false,
9739
- microphoneAccessDenied: true
9740
- });
9741
- };
9742
- });
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
+ };
9743
9741
  }, 500);
9744
9742
  return [3 /*break*/, 4];
9745
9743
  case 3:
@@ -9773,9 +9771,6 @@
9773
9771
  if (config.requestAccessAutomatically) {
9774
9772
  void store.getState().requestCameraAccess();
9775
9773
  }
9776
- if (config.requireMicrophoneAccess) {
9777
- void store.getState().requestMicrophoneAccess();
9778
- }
9779
9774
  return _assign(_assign({}, store), {
9780
9775
  destroy: function destroy() {
9781
9776
  store.getState().releaseCameraAccess();
@@ -9824,6 +9819,15 @@
9824
9819
  (_c = store.current) === null || _c === void 0 ? void 0 : _c.getState().requestCameraAccess();
9825
9820
  }
9826
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]);
9827
9831
  React.useEffect(function () {
9828
9832
  return function () {
9829
9833
  var _a;
@@ -21879,10 +21883,10 @@
21879
21883
  }
21880
21884
  }, [audioUrl, isRecordingVideo, mergeAVStreams, onComplete, readTextPrompt, releaseCameraAccess, startRecordingVideo, videoUrl]);
21881
21885
  React.useEffect(function () {
21882
- if (videoRecordingUnintentionallyStopped || audioRecordingUnintentionallyStopped) {
21886
+ if (videoRecordingUnintentionallyStopped || audioRecordingUnintentionallyStopped || !!readTextPrompt && !microphoneReady) {
21883
21887
  onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
21884
21888
  }
21885
- }, [audioRecordingUnintentionallyStopped, onRecordingFailed, videoRecordingUnintentionallyStopped]);
21889
+ }, [audioRecordingUnintentionallyStopped, microphoneReady, onRecordingFailed, readTextPrompt, videoRecordingUnintentionallyStopped]);
21886
21890
  var _23 = React.useState('SHOW_ID_FRONT'),
21887
21891
  requestedAction = _23[0],
21888
21892
  setRequestedAction = _23[1];
@@ -21891,7 +21895,7 @@
21891
21895
  if (!shouldRunIdModels) return;
21892
21896
  startIdModels();
21893
21897
  return function () {
21894
- stopIdModels();
21898
+ return stopIdModels();
21895
21899
  };
21896
21900
  }, [shouldRunIdModels, startIdModels, stopIdModels]);
21897
21901
  React.useEffect(function () {
@@ -22117,8 +22121,6 @@
22117
22121
  videoHeight: (_j = (_h = videoRef.current) === null || _h === void 0 ? void 0 : _h.videoHeight) !== null && _j !== void 0 ? _j : 0
22118
22122
  });
22119
22123
  var capturingId = ['SHOW_ID_FRONT', 'SHOW_ID_BACK'].includes(requestedAction);
22120
- // const searchingForIdCard =
22121
- // idCaptureModelsEnabled && capturingId && !goodFramesThresholdMet
22122
22124
  var guidanceText = !faceCentered ? faceNotCenteredText : undefined;
22123
22125
  return /*#__PURE__*/React.createElement(PageContainer, {
22124
22126
  ref: ref,
@@ -22171,7 +22173,7 @@
22171
22173
  }, /*#__PURE__*/React.createElement(CaptureButton, {
22172
22174
  finished: true,
22173
22175
  onClick: function onClick() {
22174
- setCountdownStartedAt(new Date());
22176
+ return setCountdownStartedAt(new Date());
22175
22177
  },
22176
22178
  disabled: !!countdownStartedAt || frameLock.current,
22177
22179
  className: classNames.captureBtn