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.
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.44';
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, 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
- handleStreamEnded = function handleStreamEnded() {
3502
- if (iphoneContinuityCameraAvailable_1 && preferIphoneContinuityCamera) {
3500
+ handleStreamEnded_1 = function handleStreamEnded_1() {
3501
+ if (preferIphoneContinuityCamera && get().iphoneContinuityCameraAvailable) {
3503
3502
  debug('someone unplugged the continuity camera');
3504
3503
  set({
3505
3504
  videoStream: null,
@@ -3521,19 +3520,14 @@ var createCameraStore = function createCameraStore(config) {
3521
3520
  });
3522
3521
  }
3523
3522
  };
3524
- (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleStreamEnded);
3523
+ (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.addEventListener('ended', handleStreamEnded_1);
3525
3524
  videoTrack_1 = stream_1.getVideoTracks()[0];
3526
- videoTrack_1.onended = handleStreamEnded;
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 () {
3531
- videoTrack_1.onmute = function () {
3532
- set({
3533
- cameraAccessDenied: true,
3534
- cameraReady: false
3535
- });
3536
- };
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
+ videoTrack_1.onmute = handleStreamEnded_1;
3537
3531
  set({
3538
3532
  camera: camera_1,
3539
3533
  cameraReady: true,
@@ -3604,20 +3598,19 @@ var createCameraStore = function createCameraStore(config) {
3604
3598
  microphoneReady: true,
3605
3599
  microphoneAccessDenied: false
3606
3600
  });
3607
- stream_2.getAudioTracks().forEach(function (track) {
3608
- track.onended = function () {
3609
- return set({
3610
- microphoneReady: false,
3611
- microphoneAccessDenied: true
3612
- });
3613
- };
3614
- track.onmute = function () {
3615
- return set({
3616
- microphoneReady: false,
3617
- microphoneAccessDenied: true
3618
- });
3619
- };
3620
- });
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
+ };
3621
3614
  }, 500);
3622
3615
  return [3 /*break*/, 4];
3623
3616
  case 3:
@@ -3651,9 +3644,6 @@ var createCameraStore = function createCameraStore(config) {
3651
3644
  if (config.requestAccessAutomatically) {
3652
3645
  void store.getState().requestCameraAccess();
3653
3646
  }
3654
- if (config.requireMicrophoneAccess) {
3655
- void store.getState().requestMicrophoneAccess();
3656
- }
3657
3647
  return _assign(_assign({}, store), {
3658
3648
  destroy: function destroy() {
3659
3649
  store.getState().releaseCameraAccess();
@@ -3702,6 +3692,15 @@ function CameraStoreProvider(_a) {
3702
3692
  (_c = store.current) === null || _c === void 0 ? void 0 : _c.getState().requestCameraAccess();
3703
3693
  }
3704
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]);
3705
3704
  useEffect(function () {
3706
3705
  return function () {
3707
3706
  var _a;
@@ -12051,10 +12050,10 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12051
12050
  }
12052
12051
  }, [audioUrl, isRecordingVideo, mergeAVStreams, onComplete, readTextPrompt, releaseCameraAccess, startRecordingVideo, videoUrl]);
12053
12052
  useEffect(function () {
12054
- if (videoRecordingUnintentionallyStopped || audioRecordingUnintentionallyStopped) {
12053
+ if (videoRecordingUnintentionallyStopped || audioRecordingUnintentionallyStopped || !!readTextPrompt && !microphoneReady) {
12055
12054
  onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
12056
12055
  }
12057
- }, [audioRecordingUnintentionallyStopped, onRecordingFailed, videoRecordingUnintentionallyStopped]);
12056
+ }, [audioRecordingUnintentionallyStopped, microphoneReady, onRecordingFailed, readTextPrompt, videoRecordingUnintentionallyStopped]);
12058
12057
  var _23 = useState('SHOW_ID_FRONT'),
12059
12058
  requestedAction = _23[0],
12060
12059
  setRequestedAction = _23[1];
@@ -12063,7 +12062,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12063
12062
  if (!shouldRunIdModels) return;
12064
12063
  startIdModels();
12065
12064
  return function () {
12066
- stopIdModels();
12065
+ return stopIdModels();
12067
12066
  };
12068
12067
  }, [shouldRunIdModels, startIdModels, stopIdModels]);
12069
12068
  useEffect(function () {
@@ -12289,8 +12288,6 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12289
12288
  videoHeight: (_j = (_h = videoRef.current) === null || _h === void 0 ? void 0 : _h.videoHeight) !== null && _j !== void 0 ? _j : 0
12290
12289
  });
12291
12290
  var capturingId = ['SHOW_ID_FRONT', 'SHOW_ID_BACK'].includes(requestedAction);
12292
- // const searchingForIdCard =
12293
- // idCaptureModelsEnabled && capturingId && !goodFramesThresholdMet
12294
12291
  var guidanceText = !faceCentered ? faceNotCenteredText : undefined;
12295
12292
  return /*#__PURE__*/React__default.createElement(PageContainer, {
12296
12293
  ref: ref,
@@ -12343,7 +12340,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12343
12340
  }, /*#__PURE__*/React__default.createElement(CaptureButton, {
12344
12341
  finished: true,
12345
12342
  onClick: function onClick() {
12346
- setCountdownStartedAt(new Date());
12343
+ return setCountdownStartedAt(new Date());
12347
12344
  },
12348
12345
  disabled: !!countdownStartedAt || frameLock.current,
12349
12346
  className: classNames.captureBtn