idmission-web-sdk 2.2.50 → 2.2.52

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.
Files changed (35) hide show
  1. package/dist/components/CompositeWizard.d.ts.map +1 -1
  2. package/dist/components/customer_flows/VideoIdValidation.d.ts +2 -0
  3. package/dist/components/customer_flows/VideoIdValidation.d.ts.map +1 -1
  4. package/dist/components/id_capture/DocumentDetectionModelProvider.d.ts +2 -1
  5. package/dist/components/id_capture/DocumentDetectionModelProvider.d.ts.map +1 -1
  6. package/dist/components/id_capture/FocusModelProvider.d.ts +2 -1
  7. package/dist/components/id_capture/FocusModelProvider.d.ts.map +1 -1
  8. package/dist/components/video_id/Action.d.ts +2 -0
  9. package/dist/components/video_id/Action.d.ts.map +1 -0
  10. package/dist/components/video_id/IdVideoCapture.d.ts +5 -3
  11. package/dist/components/video_id/IdVideoCapture.d.ts.map +1 -1
  12. package/dist/components/video_id/IdVideoCaptureGuides.d.ts +5 -4
  13. package/dist/components/video_id/IdVideoCaptureGuides.d.ts.map +1 -1
  14. package/dist/components/video_id/IdVideoCaptureWizard.d.ts +2 -1
  15. package/dist/components/video_id/IdVideoCaptureWizard.d.ts.map +1 -1
  16. package/dist/lib/locales/es/translation.d.ts +1 -0
  17. package/dist/lib/locales/es/translation.d.ts.map +1 -1
  18. package/dist/lib/locales/index.d.ts +1 -0
  19. package/dist/lib/locales/index.d.ts.map +1 -1
  20. package/dist/lib/models/DocumentDetection.d.ts +2 -1
  21. package/dist/lib/models/DocumentDetection.d.ts.map +1 -1
  22. package/dist/lib/models/Focus.d.ts +2 -1
  23. package/dist/lib/models/Focus.d.ts.map +1 -1
  24. package/dist/sdk2.cjs.development.js +334 -285
  25. package/dist/sdk2.cjs.development.js.map +1 -1
  26. package/dist/sdk2.cjs.production.js +1 -1
  27. package/dist/sdk2.cjs.production.js.map +1 -1
  28. package/dist/sdk2.esm.js +334 -285
  29. package/dist/sdk2.esm.js.map +1 -1
  30. package/dist/sdk2.umd.development.js +334 -285
  31. package/dist/sdk2.umd.development.js.map +1 -1
  32. package/dist/sdk2.umd.production.js +1 -1
  33. package/dist/sdk2.umd.production.js.map +1 -1
  34. package/dist/version.d.ts +1 -1
  35. package/package.json +3 -3
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.50';
206
+ var webSdkVersion = '2.2.52';
207
207
 
208
208
  function getPlatform() {
209
209
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -2271,18 +2271,21 @@ function useLoadFocusModel(_a) {
2271
2271
  _c = _a.modelLoadTimeoutMs,
2272
2272
  modelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
2273
2273
  onModelError = _a.onModelError,
2274
- videoRef = _a.videoRef;
2275
- var _d = useState(false),
2276
- ready = _d[0],
2277
- setReady = _d[1];
2278
- var _e = useState(0),
2279
- modelDownloadProgress = _e[0],
2280
- setModelDownloadProgress = _e[1];
2281
- var _f = useState(null),
2282
- modelError = _f[0],
2283
- setModelError = _f[1];
2274
+ videoRef = _a.videoRef,
2275
+ _d = _a.shouldLoadModels,
2276
+ shouldLoadModels = _d === void 0 ? true : _d;
2277
+ var _e = useState(false),
2278
+ ready = _e[0],
2279
+ setReady = _e[1];
2280
+ var _f = useState(0),
2281
+ modelDownloadProgress = _f[0],
2282
+ setModelDownloadProgress = _f[1];
2283
+ var _g = useState(null),
2284
+ modelError = _g[0],
2285
+ setModelError = _g[1];
2284
2286
  useEffect(function loadModel() {
2285
2287
  var _this = this;
2288
+ if (!shouldLoadModels) return;
2286
2289
  setReady(false);
2287
2290
  function handleDownloadProgress(event) {
2288
2291
  setModelDownloadProgress(progressToPercentage(event.detail));
@@ -2320,7 +2323,7 @@ function useLoadFocusModel(_a) {
2320
2323
  clearTimeout(modelLoadTimeout);
2321
2324
  document.removeEventListener('idmission.preloadProgress.focus', handleDownloadProgress);
2322
2325
  };
2323
- }, [modelPath, modelLoadTimeoutMs, videoRef]);
2326
+ }, [modelPath, modelLoadTimeoutMs, videoRef, shouldLoadModels]);
2324
2327
  useEffect(function handleModelError() {
2325
2328
  modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
2326
2329
  }, [modelError, onModelError]);
@@ -2903,25 +2906,28 @@ function closeDocumentDetector() {
2903
2906
  detectorSettings = null;
2904
2907
  }
2905
2908
  function useLoadDocumentDetector(_a) {
2906
- var _b = _a.modelPath,
2907
- modelPath = _b === void 0 ? defaultDocumentDetectorModelPath : _b,
2908
- _c = _a.modelLoadTimeoutMs,
2909
- modelLoadTimeoutMs = _c === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _c,
2910
- _d = _a.scoreThreshold,
2911
- scoreThreshold = _d === void 0 ? defaultDocumentDetectionScoreThreshold : _d,
2909
+ var _b = _a.shouldLoadModels,
2910
+ shouldLoadModels = _b === void 0 ? true : _b,
2911
+ _c = _a.modelPath,
2912
+ modelPath = _c === void 0 ? defaultDocumentDetectorModelPath : _c,
2913
+ _d = _a.modelLoadTimeoutMs,
2914
+ modelLoadTimeoutMs = _d === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _d,
2915
+ _e = _a.scoreThreshold,
2916
+ scoreThreshold = _e === void 0 ? defaultDocumentDetectionScoreThreshold : _e,
2912
2917
  onModelError = _a.onModelError,
2913
2918
  videoRef = _a.videoRef;
2914
- var _e = useState(false),
2915
- ready = _e[0],
2916
- setReady = _e[1];
2917
- var _f = useState(0),
2918
- modelDownloadProgress = _f[0],
2919
- setModelDownloadProgress = _f[1];
2920
- var _g = useState(null),
2921
- modelError = _g[0],
2922
- setModelError = _g[1];
2919
+ var _f = useState(false),
2920
+ ready = _f[0],
2921
+ setReady = _f[1];
2922
+ var _g = useState(0),
2923
+ modelDownloadProgress = _g[0],
2924
+ setModelDownloadProgress = _g[1];
2925
+ var _h = useState(null),
2926
+ modelError = _h[0],
2927
+ setModelError = _h[1];
2923
2928
  useEffect(function loadModel() {
2924
2929
  var _this = this;
2930
+ if (!shouldLoadModels) return;
2925
2931
  setReady(false);
2926
2932
  function handleDownloadProgress(event) {
2927
2933
  setModelDownloadProgress(progressToPercentage(event.detail));
@@ -2959,7 +2965,7 @@ function useLoadDocumentDetector(_a) {
2959
2965
  clearTimeout(modelLoadTimeout);
2960
2966
  document.removeEventListener('idmission.preloadProgress.documentDetection', handleDownloadProgress);
2961
2967
  };
2962
- }, [modelLoadTimeoutMs, modelPath, scoreThreshold, videoRef]);
2968
+ }, [shouldLoadModels, modelLoadTimeoutMs, modelPath, scoreThreshold, videoRef]);
2963
2969
  useEffect(function handleModelError() {
2964
2970
  modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
2965
2971
  }, [modelError, onModelError]);
@@ -3762,38 +3768,41 @@ function DocumentDetectionModelProvider(_a) {
3762
3768
  documentDetectionModelScoreThreshold = _f === void 0 ? defaultDocumentDetectionScoreThreshold : _f,
3763
3769
  _g = _a.documentDetectionModelLoadTimeoutMs,
3764
3770
  documentDetectionModelLoadTimeoutMs = _g === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _g,
3765
- onDocumentDetectionModelError = _a.onDocumentDetectionModelError;
3766
- var _h = useCameraStore(),
3767
- videoRef = _h.videoRef,
3768
- videoLoaded = _h.videoLoaded,
3769
- cameraReady = _h.cameraReady;
3771
+ onDocumentDetectionModelError = _a.onDocumentDetectionModelError,
3772
+ _h = _a.shouldLoadModels,
3773
+ shouldLoadModels = _h === void 0 ? true : _h;
3774
+ var _j = useCameraStore(),
3775
+ videoRef = _j.videoRef,
3776
+ videoLoaded = _j.videoLoaded,
3777
+ cameraReady = _j.cameraReady;
3770
3778
  var lastPredictionCanvas = useRef(null);
3771
3779
  var onPredictionHandler = useRef();
3772
- var _j = useState({}),
3773
- documentDetectionThresholds = _j[0],
3774
- setDocumentDetectionThresholds = _j[1];
3775
- var _k = useState(defaultDocumentDetectionBoundaries),
3776
- documentDetectionBoundaries = _k[0],
3777
- setDocumentDetectionBoundaries = _k[1];
3778
- var _l = useState(0),
3779
- timesAllZero = _l[0],
3780
- setTimesAllZero = _l[1];
3780
+ var _k = useState({}),
3781
+ documentDetectionThresholds = _k[0],
3782
+ setDocumentDetectionThresholds = _k[1];
3783
+ var _l = useState(defaultDocumentDetectionBoundaries),
3784
+ documentDetectionBoundaries = _l[0],
3785
+ setDocumentDetectionBoundaries = _l[1];
3781
3786
  var _m = useState(0),
3782
- canvasKey = _m[0],
3783
- setCanvasKey = _m[1];
3787
+ timesAllZero = _m[0],
3788
+ setTimesAllZero = _m[1];
3789
+ var _o = useState(0),
3790
+ canvasKey = _o[0],
3791
+ setCanvasKey = _o[1];
3784
3792
  var stopDetection = useRef(0);
3785
- var _o = useLoadDocumentDetector({
3793
+ var _p = useLoadDocumentDetector({
3786
3794
  modelPath: documentDetectionModelPath,
3787
3795
  modelLoadTimeoutMs: documentDetectionModelLoadTimeoutMs,
3788
3796
  scoreThreshold: documentDetectionModelScoreThreshold,
3789
3797
  onModelError: onDocumentDetectionModelError,
3790
- videoRef: videoRef
3798
+ videoRef: videoRef,
3799
+ shouldLoadModels: shouldLoadModels
3791
3800
  }),
3792
- ready = _o.ready,
3793
- modelDownloadProgress = _o.modelDownloadProgress,
3794
- modelError = _o.modelError,
3795
- setModelError = _o.setModelError;
3796
- var _p = useFrameLoop(useCallback(function (frameId, timeRunning) {
3801
+ ready = _p.ready,
3802
+ modelDownloadProgress = _p.modelDownloadProgress,
3803
+ modelError = _p.modelError,
3804
+ setModelError = _p.setModelError;
3805
+ var _q = useFrameLoop(useCallback(function (frameId, timeRunning) {
3797
3806
  return __awaiter(_this, void 0, void 0, function () {
3798
3807
  var stopDetectionAtStart, vw, vh, ctx, prediction, processedPrediction;
3799
3808
  var _a;
@@ -3836,8 +3845,8 @@ function DocumentDetectionModelProvider(_a) {
3836
3845
  throttleMs: throttleMs,
3837
3846
  autoStart: autoStart
3838
3847
  }),
3839
- start = _p.start,
3840
- stop = _p.stop;
3848
+ start = _q.start,
3849
+ stop = _q.stop;
3841
3850
  useEffect(function setErrorIfAllZero() {
3842
3851
  if (timesAllZero >= 2) {
3843
3852
  setModelError(new Error('model is returning all zeroes'));
@@ -3898,22 +3907,25 @@ function FocusModelProvider(_a) {
3898
3907
  focusModelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
3899
3908
  onFocusModelError = _a.onFocusModelError,
3900
3909
  _d = _a.showCanvases,
3901
- showCanvases = _d === void 0 ? false : _d;
3910
+ showCanvases = _d === void 0 ? false : _d,
3911
+ _e = _a.shouldLoadModels,
3912
+ shouldLoadModels = _e === void 0 ? true : _e;
3902
3913
  var cropCanvas = useRef(null);
3903
3914
  var rotateCanvas = useRef(null);
3904
- var _e = useState({}),
3905
- focusThresholds = _e[0],
3906
- setFocusThresholds = _e[1];
3915
+ var _f = useState({}),
3916
+ focusThresholds = _f[0],
3917
+ setFocusThresholds = _f[1];
3907
3918
  var videoRef = useCameraStore().videoRef;
3908
- var _f = useLoadFocusModel({
3919
+ var _g = useLoadFocusModel({
3909
3920
  modelPath: focusModelPath,
3910
3921
  modelLoadTimeoutMs: focusModelLoadTimeoutMs,
3911
3922
  onModelError: onFocusModelError,
3912
- videoRef: videoRef
3923
+ videoRef: videoRef,
3924
+ shouldLoadModels: shouldLoadModels
3913
3925
  }),
3914
- ready = _f.ready,
3915
- modelDownloadProgress = _f.modelDownloadProgress,
3916
- modelError = _f.modelError;
3926
+ ready = _g.ready,
3927
+ modelDownloadProgress = _g.modelDownloadProgress,
3928
+ modelError = _g.modelError;
3917
3929
  var makeFocusPrediction = useCallback(function (imageData, box) {
3918
3930
  if (!ready) return null;
3919
3931
  var prediction = makeFocusModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, box);
@@ -4873,6 +4885,7 @@ var esTranslation = {
4873
4885
  'Performing facial recognition, please hold still...': 'Realizando el reconocimiento facial, por favor no te muevas',
4874
4886
  'Display the front of your ID card...': 'Hay que mostrar el frente de la identificación...',
4875
4887
  'Display the back of your ID card...': 'Hay que mostrar el reverso de la identificación...',
4888
+ 'Display the ID page of your passport...': 'Hay que mostrar el página de datos del pasaporte...',
4876
4889
  'Please move your face to the center...': 'Por favor, hay que mover la cabeza hacia el centro...',
4877
4890
  'Searching for ID card...': 'Localizando la identificación...',
4878
4891
  'Please read the following text aloud': 'Hay que leer el siguiente texto en voz alta',
@@ -11704,7 +11717,7 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
11704
11717
  idCardGuideBorderWidth = _a.idCardGuideBorderWidth,
11705
11718
  idCardGuideBorderColor = _a.idCardGuideBorderColor,
11706
11719
  idCardCaptureProgress = _a.idCardCaptureProgress,
11707
- _3 = _a.idCardCaptureGuideImages,
11720
+ _3 = _a.idCaptureGuideImages,
11708
11721
  userSuppliedImages = _3 === void 0 ? defaultIdCaptureGuideImages : _3,
11709
11722
  _4 = _a.classNames,
11710
11723
  classNames = _4 === void 0 ? {} : _4,
@@ -11716,10 +11729,11 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
11716
11729
  var verbiage = useTranslations(rawVerbiage, {
11717
11730
  idFrontInstructionText: 'Display the front of your ID card...',
11718
11731
  idBackInstructionText: 'Display the back of your ID card...',
11732
+ passportInstructionText: 'Display the ID page of your passport...',
11719
11733
  flipIdInstructionText: 'Please flip your ID card...',
11720
11734
  verifyLivenessInstructionText: 'Performing facial recognition, please hold still...'
11721
11735
  });
11722
- var instructionText = requestedAction === 'VERIFY_LIVENESS' ? verbiage.verifyLivenessInstructionText : requestedAction === 'SHOW_ID_FRONT' ? verbiage.idFrontInstructionText : requestedAction === 'FLIP_ID' ? verbiage.flipIdInstructionText : verbiage.idBackInstructionText;
11736
+ var instructionText = requestedAction === 'VERIFY_LIVENESS' ? verbiage.verifyLivenessInstructionText : requestedAction === 'SHOW_PASSPORT' ? verbiage.passportInstructionText : requestedAction === 'SHOW_ID_FRONT' ? verbiage.idFrontInstructionText : requestedAction === 'FLIP_ID' ? verbiage.flipIdInstructionText : verbiage.idBackInstructionText;
11723
11737
  var theme = useTheme();
11724
11738
  if (faceGuideBorderWidth === undefined) faceGuideBorderWidth = (_d = (_c = (_b = theme.idVideoCapture) === null || _b === void 0 ? void 0 : _b.faceGuides) === null || _c === void 0 ? void 0 : _c.borderWidth) !== null && _d !== void 0 ? _d : 5;
11725
11739
  if (faceGuideBorderColor === undefined) faceGuideBorderColor = (_j = satisfied ? (_f = (_e = theme.idVideoCapture) === null || _e === void 0 ? void 0 : _e.faceGuides) === null || _f === void 0 ? void 0 : _f.satisfiedColor : (_h = (_g = theme.idVideoCapture) === null || _g === void 0 ? void 0 : _g.faceGuides) === null || _h === void 0 ? void 0 : _h.unsatisfiedColor) !== null && _j !== void 0 ? _j : '#D6DCE7';
@@ -11784,7 +11798,7 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
11784
11798
  className: classNames.idCardGuideImage,
11785
11799
  "$isMirrored": !isRearFacing,
11786
11800
  style: idCardImageStyle,
11787
- src: requestedAction === 'SHOW_ID_BACK' ? idCaptureGuideImages.landscape.SHOW_ID_BACK.url : idCaptureGuideImages.landscape.SHOW_ID_FRONT.url,
11801
+ src: requestedAction === 'SHOW_PASSPORT' ? idCaptureGuideImages.landscape.SHOW_PASSPORT.url : requestedAction === 'SHOW_ID_BACK' ? idCaptureGuideImages.landscape.SHOW_ID_BACK.url : idCaptureGuideImages.landscape.SHOW_ID_FRONT.url,
11788
11802
  onLoad: onImageLoaded
11789
11803
  })), requestedAction === 'FLIP_ID' && ( /*#__PURE__*/React__default.createElement(IdVideoCaptureFlipIdPrompt, {
11790
11804
  idCaptureGuideImages: idCaptureGuideImages,
@@ -11919,7 +11933,7 @@ var defaultVideoIdCaptureThresholds = {
11919
11933
  detection: {
11920
11934
  idCardFront: 0.4,
11921
11935
  idCardBack: 0.5,
11922
- passport: 1
11936
+ passport: 0.3
11923
11937
  },
11924
11938
  focus: {
11925
11939
  idCardFront: {
@@ -11937,7 +11951,8 @@ var defaultVideoIdCaptureThresholds = {
11937
11951
  },
11938
11952
  goodFrames: {
11939
11953
  idCardFront: 1,
11940
- idCardBack: 1
11954
+ idCardBack: 1,
11955
+ passport: 1
11941
11956
  },
11942
11957
  flipShortcutThreshold: 0.7
11943
11958
  };
@@ -11951,91 +11966,93 @@ var IdVideoCapture = function IdVideoCapture(_a) {
11951
11966
  onExitCapture = _a.onExitCapture,
11952
11967
  _w = _a.idCaptureModelsEnabled,
11953
11968
  idCaptureModelsEnabled = _w === void 0 ? true : _w,
11954
- _x = _a.idCardCaptureGuideImages,
11955
- idCardCaptureGuideImages = _x === void 0 ? defaultIdCaptureGuideImages : _x,
11956
- _y = _a.idCardFrontDelay,
11957
- idCardFrontDelay = _y === void 0 ? 1000 : _y,
11958
- _z = _a.videoIdCaptureThresholds,
11959
- videoIdCaptureThresholds = _z === void 0 ? defaultVideoIdCaptureThresholds : _z,
11960
- _0 = _a.skipShowIdCardBack,
11961
- skipShowIdCardBack = _0 === void 0 ? false : _0,
11962
- _1 = _a.captureCountdownSeconds,
11963
- captureCountdownSeconds = _1 === void 0 ? 3 : _1,
11969
+ _x = _a.idDocumentType,
11970
+ idDocumentType = _x === void 0 ? 'idCard' : _x,
11971
+ _y = _a.idCaptureGuideImages,
11972
+ idCaptureGuideImages = _y === void 0 ? defaultIdCaptureGuideImages : _y,
11973
+ _z = _a.idCardFrontDelay,
11974
+ idCardFrontDelay = _z === void 0 ? 1000 : _z,
11975
+ _0 = _a.videoIdCaptureThresholds,
11976
+ videoIdCaptureThresholds = _0 === void 0 ? defaultVideoIdCaptureThresholds : _0,
11977
+ _1 = _a.skipShowIdCardBack,
11978
+ skipShowIdCardBack = _1 === void 0 ? false : _1,
11979
+ _2 = _a.captureCountdownSeconds,
11980
+ captureCountdownSeconds = _2 === void 0 ? 3 : _2,
11964
11981
  readTextPrompt = _a.readTextPrompt,
11965
- _2 = _a.readTextTimeoutDurationMs,
11966
- readTextTimeoutDurationMs = _2 === void 0 ? 15000 : _2,
11967
- _3 = _a.readTextMinReadingMs,
11968
- readTextMinReadingMs = _3 === void 0 ? 10000 : _3,
11969
- _4 = _a.disableFaceDetectionWhileAudioCapture,
11970
- disableFaceDetectionWhileAudioCapture = _4 === void 0 ? false : _4,
11971
- _5 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
11972
- disableFaceDetectionWhileAudioCaptureMsDelay = _5 === void 0 ? 2000 : _5,
11973
- _6 = _a.mergeAVStreams,
11974
- mergeAVStreams = _6 === void 0 ? false : _6,
11975
- _7 = _a.classNames,
11976
- classNames = _7 === void 0 ? {} : _7,
11977
- _8 = _a.colors,
11978
- colors = _8 === void 0 ? {} : _8,
11979
- _9 = _a.verbiage,
11980
- rawVerbiage = _9 === void 0 ? {} : _9,
11981
- _10 = _a.debugMode,
11982
- debugMode = _10 === void 0 ? false : _10;
11983
- var _11 = useResizeObserver(),
11984
- ref = _11.ref,
11985
- _12 = _11.width,
11986
- width = _12 === void 0 ? 1 : _12,
11987
- _13 = _11.height,
11988
- height = _13 === void 0 ? 1 : _13;
11989
- var _14 = useCameraStore(),
11990
- camera = _14.camera,
11991
- videoRef = _14.videoRef,
11992
- videoLoaded = _14.videoLoaded,
11993
- cameraReady = _14.cameraReady,
11994
- microphoneReady = _14.microphoneReady,
11995
- audioStream = _14.audioStream,
11996
- isRearFacing = _14.isRearFacing,
11997
- releaseCameraAccess = _14.releaseCameraAccess;
11998
- var _15 = useState([]),
11999
- detectedObjects = _15[0],
12000
- setDetectedObjects = _15[1];
12001
- var _16 = useState(null),
12002
- face = _16[0],
12003
- setFace = _16[1];
12004
- var _17 = useContext(IdCaptureModelsContext),
12005
- idModelsReady = _17.ready,
12006
- startIdModels = _17.start,
12007
- stopIdModels = _17.stop,
12008
- onIdPredictionMade = _17.onPredictionMade,
12009
- setThresholds = _17.setThresholds,
12010
- setDocumentDetectionBoundaries = _17.setDocumentDetectionBoundaries,
12011
- bestFrameDetails = _17.bestFrameDetails,
12012
- resetBestFrame = _17.resetBestFrame,
12013
- idModelError = _17.modelError;
12014
- var _18 = useState(null),
12015
- videoStartsAt = _18[0],
12016
- setVideoStartsAt = _18[1];
12017
- var _19 = useContext(SubmissionContext),
12018
- setIdCaptureVideoAudioStartsAt = _19.setIdCaptureVideoAudioStartsAt,
12019
- setExpectedAudioText = _19.setExpectedAudioText;
12020
- var _20 = useContext(SelfieGuidanceModelsContext),
12021
- startSelfieGuidance = _20.start,
12022
- stopSelfieGuidance = _20.stop,
12023
- onSelfiePredictionMade = _20.onPredictionMade,
12024
- selfieModelError = _20.error;
12025
- var _21 = useVideoRecorder(camera, audioStream, mergeAVStreams),
12026
- isRecordingVideo = _21.isRecordingVideo,
12027
- startRecordingVideo = _21.startRecordingVideo,
12028
- startRecordingAudio = _21.startRecordingAudio,
12029
- stopRecordingVideo = _21.stopRecordingVideo,
12030
- stopRecordingAudio = _21.stopRecordingAudio,
12031
- videoRecordingUnintentionallyStopped = _21.videoRecordingUnintentionallyStopped,
12032
- audioRecordingUnintentionallyStopped = _21.audioRecordingUnintentionallyStopped,
12033
- videoUrl = _21.videoUrl,
12034
- audioUrl = _21.audioUrl;
11982
+ _3 = _a.readTextTimeoutDurationMs,
11983
+ readTextTimeoutDurationMs = _3 === void 0 ? 15000 : _3,
11984
+ _4 = _a.readTextMinReadingMs,
11985
+ readTextMinReadingMs = _4 === void 0 ? 10000 : _4,
11986
+ _5 = _a.disableFaceDetectionWhileAudioCapture,
11987
+ disableFaceDetectionWhileAudioCapture = _5 === void 0 ? false : _5,
11988
+ _6 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
11989
+ disableFaceDetectionWhileAudioCaptureMsDelay = _6 === void 0 ? 2000 : _6,
11990
+ _7 = _a.mergeAVStreams,
11991
+ mergeAVStreams = _7 === void 0 ? false : _7,
11992
+ _8 = _a.classNames,
11993
+ classNames = _8 === void 0 ? {} : _8,
11994
+ _9 = _a.colors,
11995
+ colors = _9 === void 0 ? {} : _9,
11996
+ _10 = _a.verbiage,
11997
+ rawVerbiage = _10 === void 0 ? {} : _10,
11998
+ _11 = _a.debugMode,
11999
+ debugMode = _11 === void 0 ? false : _11;
12000
+ var _12 = useResizeObserver(),
12001
+ ref = _12.ref,
12002
+ _13 = _12.width,
12003
+ width = _13 === void 0 ? 1 : _13,
12004
+ _14 = _12.height,
12005
+ height = _14 === void 0 ? 1 : _14;
12006
+ var _15 = useCameraStore(),
12007
+ camera = _15.camera,
12008
+ videoRef = _15.videoRef,
12009
+ videoLoaded = _15.videoLoaded,
12010
+ cameraReady = _15.cameraReady,
12011
+ microphoneReady = _15.microphoneReady,
12012
+ audioStream = _15.audioStream,
12013
+ isRearFacing = _15.isRearFacing,
12014
+ releaseCameraAccess = _15.releaseCameraAccess;
12015
+ var _16 = useState([]),
12016
+ detectedObjects = _16[0],
12017
+ setDetectedObjects = _16[1];
12018
+ var _17 = useState(null),
12019
+ face = _17[0],
12020
+ setFace = _17[1];
12021
+ var _18 = useContext(IdCaptureModelsContext),
12022
+ idModelsReady = _18.ready,
12023
+ startIdModels = _18.start,
12024
+ stopIdModels = _18.stop,
12025
+ onIdPredictionMade = _18.onPredictionMade,
12026
+ setThresholds = _18.setThresholds,
12027
+ setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
12028
+ bestFrameDetails = _18.bestFrameDetails,
12029
+ resetBestFrame = _18.resetBestFrame,
12030
+ idModelError = _18.modelError;
12031
+ var _19 = useState(null),
12032
+ videoStartsAt = _19[0],
12033
+ setVideoStartsAt = _19[1];
12034
+ var _20 = useContext(SubmissionContext),
12035
+ setIdCaptureVideoAudioStartsAt = _20.setIdCaptureVideoAudioStartsAt,
12036
+ setExpectedAudioText = _20.setExpectedAudioText;
12037
+ var _21 = useContext(SelfieGuidanceModelsContext),
12038
+ startSelfieGuidance = _21.start,
12039
+ stopSelfieGuidance = _21.stop,
12040
+ onSelfiePredictionMade = _21.onPredictionMade,
12041
+ selfieModelError = _21.error;
12042
+ var _22 = useVideoRecorder(camera, audioStream, mergeAVStreams),
12043
+ isRecordingVideo = _22.isRecordingVideo,
12044
+ startRecordingVideo = _22.startRecordingVideo,
12045
+ startRecordingAudio = _22.startRecordingAudio,
12046
+ stopRecordingVideo = _22.stopRecordingVideo,
12047
+ stopRecordingAudio = _22.stopRecordingAudio,
12048
+ videoRecordingUnintentionallyStopped = _22.videoRecordingUnintentionallyStopped,
12049
+ audioRecordingUnintentionallyStopped = _22.audioRecordingUnintentionallyStopped,
12050
+ videoUrl = _22.videoUrl,
12051
+ audioUrl = _22.audioUrl;
12035
12052
  var countdownTimeoutRef = useRef(undefined);
12036
- var _22 = useState(-1),
12037
- countdownRemaining = _22[0],
12038
- setCountdownRemaining = _22[1];
12053
+ var _23 = useState(-1),
12054
+ countdownRemaining = _23[0],
12055
+ setCountdownRemaining = _23[1];
12039
12056
  useEffect(function () {
12040
12057
  if (!isRecordingVideo && !videoUrl) {
12041
12058
  startRecordingVideo();
@@ -12055,9 +12072,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12055
12072
  onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
12056
12073
  }
12057
12074
  }, [audioRecordingUnintentionallyStopped, microphoneReady, onRecordingFailed, readTextPrompt, videoRecordingUnintentionallyStopped]);
12058
- var _23 = useState('SHOW_ID_FRONT'),
12059
- requestedAction = _23[0],
12060
- setRequestedAction = _23[1];
12075
+ var _24 = useState(idDocumentType === 'idCard' ? 'SHOW_ID_FRONT' : 'SHOW_PASSPORT'),
12076
+ requestedAction = _24[0],
12077
+ setRequestedAction = _24[1];
12061
12078
  var shouldRunIdModels = idCaptureModelsEnabled && videoLoaded && cameraReady && idModelsReady && !idModelError && requestedAction !== 'READ_TEXT' && (!readTextPrompt || microphoneReady);
12062
12079
  useEffect(function startModelsWhenCapturing() {
12063
12080
  if (!shouldRunIdModels) return;
@@ -12066,9 +12083,25 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12066
12083
  return stopIdModels();
12067
12084
  };
12068
12085
  }, [shouldRunIdModels, startIdModels, stopIdModels]);
12086
+ var adjustedThresholds = useMemo(function () {
12087
+ if (idDocumentType === 'idCard') {
12088
+ return _assign(_assign({}, videoIdCaptureThresholds), {
12089
+ detection: _assign(_assign({}, videoIdCaptureThresholds.detection), {
12090
+ passport: 1
12091
+ })
12092
+ });
12093
+ } else {
12094
+ return _assign(_assign({}, videoIdCaptureThresholds), {
12095
+ detection: _assign(_assign({}, videoIdCaptureThresholds.detection), {
12096
+ idCardFront: 1,
12097
+ idCardBack: 1
12098
+ })
12099
+ });
12100
+ }
12101
+ }, [idDocumentType, videoIdCaptureThresholds]);
12069
12102
  useEffect(function () {
12070
- setThresholds(videoIdCaptureThresholds);
12071
- }, [requestedAction, setThresholds, videoIdCaptureThresholds]);
12103
+ setThresholds(adjustedThresholds);
12104
+ }, [requestedAction, setThresholds, adjustedThresholds]);
12072
12105
  useEffect(function () {
12073
12106
  setDocumentDetectionBoundaries({
12074
12107
  top: 20,
@@ -12077,19 +12110,19 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12077
12110
  bottom: 0
12078
12111
  });
12079
12112
  }, [setDocumentDetectionBoundaries]);
12080
- var _24 = useState(0),
12081
- currentDetectionScore = _24[0],
12082
- setCurrentDetectionScore = _24[1];
12083
- var _25 = useState('none'),
12084
- currentDetectedDocumentType = _25[0],
12085
- setCurrentDetectedDocumentType = _25[1];
12086
- var _26 = useState(0),
12087
- currentFocusScore = _26[0],
12088
- setCurrentFocusScore = _26[1];
12113
+ var _25 = useState(0),
12114
+ currentDetectionScore = _25[0],
12115
+ setCurrentDetectionScore = _25[1];
12116
+ var _26 = useState('none'),
12117
+ currentDetectedDocumentType = _26[0],
12118
+ setCurrentDetectedDocumentType = _26[1];
12089
12119
  var _27 = useState(0),
12090
- goodFramesCount = _27[0],
12091
- setGoodFramesCount = _27[1];
12092
- var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? videoIdCaptureThresholds.goodFrames.idCardFront : videoIdCaptureThresholds.goodFrames.idCardBack;
12120
+ currentFocusScore = _27[0],
12121
+ setCurrentFocusScore = _27[1];
12122
+ var _28 = useState(0),
12123
+ goodFramesCount = _28[0],
12124
+ setGoodFramesCount = _28[1];
12125
+ var goodFramesThreshold = requestedAction === 'SHOW_PASSPORT' ? adjustedThresholds.goodFrames.passport : requestedAction === 'SHOW_ID_FRONT' ? adjustedThresholds.goodFrames.idCardFront : adjustedThresholds.goodFrames.idCardBack;
12093
12126
  var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
12094
12127
  useEffect(function () {
12095
12128
  if (!idCaptureModelsEnabled || idModelError) return;
@@ -12098,9 +12131,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12098
12131
  setCurrentDetectionScore(prediction.detectionScore);
12099
12132
  setCurrentDetectedDocumentType(prediction.detectedDocumentType);
12100
12133
  setCurrentFocusScore(prediction.focusScore);
12101
- var detectionThresholdMet = requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
12134
+ var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
12102
12135
  var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
12103
- var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= videoIdCaptureThresholds.flipShortcutThreshold;
12136
+ var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= adjustedThresholds.flipShortcutThreshold;
12104
12137
  if (shouldShortcutFlipAnimation) {
12105
12138
  return setRequestedAction('SHOW_ID_BACK');
12106
12139
  }
@@ -12108,16 +12141,16 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12108
12141
  return n + 1;
12109
12142
  } : 0);
12110
12143
  });
12111
- }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, videoIdCaptureThresholds.flipShortcutThreshold]);
12112
- var _28 = useState(null),
12113
- idFrontCaptureStartedAt = _28[0],
12114
- setFirstGoodFrameTime = _28[1];
12144
+ }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, adjustedThresholds.flipShortcutThreshold]);
12145
+ var _29 = useState(null),
12146
+ idFrontCaptureStartedAt = _29[0],
12147
+ setFirstGoodFrameTime = _29[1];
12115
12148
  useEffect(function () {
12116
12149
  if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
12117
12150
  }, [goodFramesCount]);
12118
- var delaySatisfied = requestedAction !== 'SHOW_ID_FRONT' || idFrontCaptureStartedAt !== null && new Date().getTime() > idFrontCaptureStartedAt + idCardFrontDelay;
12151
+ var delaySatisfied = !['SHOW_ID_FRONT', 'SHOW_PASSPORT'].includes(requestedAction) || idFrontCaptureStartedAt !== null && new Date().getTime() > idFrontCaptureStartedAt + idCardFrontDelay;
12119
12152
  var translatedText = useVerbiage(readTextPrompt, '');
12120
- var onIdBackCaptureComplete = useCallback(function () {
12153
+ var onIdCaptureComplete = useCallback(function () {
12121
12154
  var _a;
12122
12155
  if (translatedText) {
12123
12156
  setRequestedAction('READ_TEXT');
@@ -12132,16 +12165,16 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12132
12165
  var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
12133
12166
  var faceBox = face === null || face === void 0 ? void 0 : face.box;
12134
12167
  var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
12135
- var _29 = useState(),
12136
- countdownStartedAt = _29[0],
12137
- setCountdownStartedAt = _29[1];
12168
+ var _30 = useState(),
12169
+ countdownStartedAt = _30[0],
12170
+ setCountdownStartedAt = _30[1];
12138
12171
  var photoCanvas = useRef(null);
12139
12172
  var frameLock = useRef(false);
12140
12173
  var captureFrame = useCallback(function () {
12141
12174
  return __awaiter(void 0, void 0, void 0, function () {
12142
- var frameBase64;
12143
- return __generator(this, function (_a) {
12144
- switch (_a.label) {
12175
+ var frameBase64, _a;
12176
+ return __generator(this, function (_b) {
12177
+ switch (_b.label) {
12145
12178
  case 0:
12146
12179
  if (frameLock.current) return [2 /*return*/];
12147
12180
  frameLock.current = true;
@@ -12151,23 +12184,25 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12151
12184
  frameLock.current = false;
12152
12185
  return [2 /*return*/];
12153
12186
  }
12154
- _a.label = 1;
12187
+ _b.label = 1;
12155
12188
  case 1:
12156
- _a.trys.push([1,, 7, 8]);
12189
+ _b.trys.push([1,, 7, 8]);
12157
12190
  if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 5];
12158
12191
  if (onIdFrontImageCaptured) {
12159
12192
  onIdFrontImageCaptured(frameBase64);
12160
12193
  }
12161
12194
  if (!skipShowIdCardBack) return [3 /*break*/, 4];
12162
- if (!(skipShowIdCardBack === true)) return [3 /*break*/, 2];
12163
- return [2 /*return*/, onIdBackCaptureComplete()];
12164
- case 2:
12195
+ _a = skipShowIdCardBack === true;
12196
+ if (_a) return [3 /*break*/, 3];
12165
12197
  return [4 /*yield*/, skipShowIdCardBack()];
12198
+ case 2:
12199
+ _a = _b.sent();
12200
+ _b.label = 3;
12166
12201
  case 3:
12167
- if (_a.sent()) {
12168
- return [2 /*return*/, onIdBackCaptureComplete()];
12202
+ if (_a) {
12203
+ return [2 /*return*/, onIdCaptureComplete()];
12169
12204
  }
12170
- _a.label = 4;
12205
+ _b.label = 4;
12171
12206
  case 4:
12172
12207
  setRequestedAction('FLIP_ID');
12173
12208
  return [3 /*break*/, 6];
@@ -12176,9 +12211,14 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12176
12211
  if (onIdBackImageCaptured) {
12177
12212
  onIdBackImageCaptured(frameBase64);
12178
12213
  }
12179
- onIdBackCaptureComplete();
12214
+ onIdCaptureComplete();
12215
+ } else if (requestedAction == 'SHOW_PASSPORT') {
12216
+ if (onIdFrontImageCaptured) {
12217
+ onIdFrontImageCaptured(frameBase64);
12218
+ }
12219
+ onIdCaptureComplete();
12180
12220
  }
12181
- _a.label = 6;
12221
+ _b.label = 6;
12182
12222
  case 6:
12183
12223
  return [3 /*break*/, 8];
12184
12224
  case 7:
@@ -12198,7 +12238,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12198
12238
  }
12199
12239
  });
12200
12240
  });
12201
- }, [onIdBackCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
12241
+ }, [onIdCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
12202
12242
  var isFlipping = requestedAction === 'FLIP_ID';
12203
12243
  useEffect(function () {
12204
12244
  if (!isFlipping) return;
@@ -12257,9 +12297,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12257
12297
  stopSelfieGuidance();
12258
12298
  };
12259
12299
  }, [startSelfieGuidance, stopSelfieGuidance]);
12260
- var _30 = useState(0),
12261
- numFramesWithoutFaces = _30[0],
12262
- setNumFramesWithoutFaces = _30[1];
12300
+ var _31 = useState(0),
12301
+ numFramesWithoutFaces = _31[0],
12302
+ setNumFramesWithoutFaces = _31[1];
12263
12303
  onSelfiePredictionMade(useThrottledCallback(useCallback(function (_a) {
12264
12304
  var face = _a.face;
12265
12305
  if (selfieModelError) return;
@@ -12275,12 +12315,12 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12275
12315
  }
12276
12316
  }, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
12277
12317
  var theme = useTheme();
12278
- var _31 = useTranslations(rawVerbiage, {
12318
+ var _32 = useTranslations(rawVerbiage, {
12279
12319
  faceNotCenteredText: 'Please move your face to the center...',
12280
12320
  captureBtnText: 'Capture'
12281
12321
  }),
12282
- captureBtnText = _31.captureBtnText,
12283
- faceNotCenteredText = _31.faceNotCenteredText;
12322
+ captureBtnText = _32.captureBtnText,
12323
+ faceNotCenteredText = _32.faceNotCenteredText;
12284
12324
  var debugScalingDetails = useDebugScalingDetails({
12285
12325
  enabled: debugMode,
12286
12326
  pageWidth: width,
@@ -12288,7 +12328,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12288
12328
  videoWidth: (_g = (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.videoWidth) !== null && _g !== void 0 ? _g : 0,
12289
12329
  videoHeight: (_j = (_h = videoRef.current) === null || _h === void 0 ? void 0 : _h.videoHeight) !== null && _j !== void 0 ? _j : 0
12290
12330
  });
12291
- var capturingId = ['SHOW_ID_FRONT', 'SHOW_ID_BACK'].includes(requestedAction);
12331
+ var capturingId = ['SHOW_ID_FRONT', 'SHOW_ID_BACK', 'SHOW_PASSPORT'].includes(requestedAction);
12292
12332
  var guidanceText = !faceCentered ? faceNotCenteredText : undefined;
12293
12333
  return /*#__PURE__*/React__default.createElement(PageContainer, {
12294
12334
  ref: ref,
@@ -12309,8 +12349,8 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12309
12349
  requestedAction: requestedAction,
12310
12350
  satisfied: satisfied,
12311
12351
  idCardGuideStatus: countdownStartedAt ? 'capturing' : 'ready',
12312
- idCardCaptureProgress: !!countdownStartedAt ? 1 : 0,
12313
- idCardCaptureGuideImages: idCardCaptureGuideImages,
12352
+ idCardCaptureProgress: countdownStartedAt ? 1 : 0,
12353
+ idCaptureGuideImages: idCaptureGuideImages,
12314
12354
  faceGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor,
12315
12355
  idCardGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor
12316
12356
  }), debugMode && capturingId && ( /*#__PURE__*/React__default.createElement(React__default.Fragment, null, /*#__PURE__*/React__default.createElement(ObjectDetectionDebugOverlayDiv, {
@@ -12505,49 +12545,51 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12505
12545
  idCaptureLoadingOverlayMode = _t === void 0 ? 'default' : _t,
12506
12546
  customOverlayContent = _a.customOverlayContent,
12507
12547
  onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
12508
- _u = _a.idCaptureGuideType,
12509
- idCaptureGuideType = _u === void 0 ? 'fit' : _u,
12510
- _v = _a.idCaptureGuideImages,
12511
- idCaptureGuideImages = _v === void 0 ? defaultIdCaptureGuideImages : _v,
12512
- _w = _a.idCapturePortraitGuidesOnMobile,
12513
- idCapturePortraitGuidesOnMobile = _w === void 0 ? true : _w,
12514
- _x = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
12515
- idCaptureRotateLoadingOverlayImageWhenPortrait = _x === void 0 ? true : _x,
12516
- _y = _a.idCaptureModelLoadTimeoutMs,
12517
- idCaptureModelLoadTimeoutMs = _y === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _y,
12518
- _z = _a.faceLivenessLoadingOverlayMode,
12519
- faceLivenessLoadingOverlayMode = _z === void 0 ? 'default' : _z,
12520
- _0 = _a.disableFaceDetectionWhileAudioCapture,
12521
- disableFaceDetectionWhileAudioCapture = _0 === void 0 ? true : _0,
12522
- _1 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
12523
- disableFaceDetectionWhileAudioCaptureMsDelay = _1 === void 0 ? 2000 : _1,
12524
- _2 = _a.silentFallback,
12525
- silentFallback = _2 === void 0 ? false : _2,
12526
- _3 = _a.mergeAVStreams,
12527
- mergeAVStreams = _3 === void 0 ? false : _3,
12528
- _4 = _a.assets,
12529
- assets = _4 === void 0 ? {} : _4,
12530
- _5 = _a.classNames,
12531
- classNames = _5 === void 0 ? {} : _5,
12532
- _6 = _a.colors,
12533
- colors = _6 === void 0 ? {} : _6,
12534
- _7 = _a.verbiage,
12535
- verbiage = _7 === void 0 ? {} : _7,
12536
- _8 = _a.debugMode,
12537
- debugMode = _8 === void 0 ? false : _8;
12538
- var _9 = useContext(SubmissionContext),
12539
- submissionStatus = _9.submissionStatus,
12540
- idCaptureVideoUrl = _9.idCaptureVideoUrl,
12541
- idCaptureVideoAudioUrl = _9.idCaptureVideoAudioUrl,
12542
- idCaptureVideoIdFrontImage = _9.idCaptureVideoIdFrontImage,
12543
- idCaptureVideoIdBackImage = _9.idCaptureVideoIdBackImage,
12544
- setIdCaptureVideoUrl = _9.setIdCaptureVideoUrl,
12545
- setIdCaptureVideoIdFrontImage = _9.setIdCaptureVideoIdFrontImage,
12546
- setIdCaptureVideoIdBackImage = _9.setIdCaptureVideoIdBackImage,
12547
- setIdCaptureVideoAudioUrl = _9.setIdCaptureVideoAudioUrl;
12548
- var _10 = useState('CAPTURING_ID'),
12549
- captureState = _10[0],
12550
- setCaptureState = _10[1];
12548
+ _u = _a.idDocumentType,
12549
+ idDocumentType = _u === void 0 ? 'idCard' : _u,
12550
+ _v = _a.idCaptureGuideType,
12551
+ idCaptureGuideType = _v === void 0 ? 'fit' : _v,
12552
+ _w = _a.idCaptureGuideImages,
12553
+ idCaptureGuideImages = _w === void 0 ? defaultIdCaptureGuideImages : _w,
12554
+ _x = _a.idCapturePortraitGuidesOnMobile,
12555
+ idCapturePortraitGuidesOnMobile = _x === void 0 ? true : _x,
12556
+ _y = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
12557
+ idCaptureRotateLoadingOverlayImageWhenPortrait = _y === void 0 ? true : _y,
12558
+ _z = _a.idCaptureModelLoadTimeoutMs,
12559
+ idCaptureModelLoadTimeoutMs = _z === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _z,
12560
+ _0 = _a.faceLivenessLoadingOverlayMode,
12561
+ faceLivenessLoadingOverlayMode = _0 === void 0 ? 'default' : _0,
12562
+ _1 = _a.disableFaceDetectionWhileAudioCapture,
12563
+ disableFaceDetectionWhileAudioCapture = _1 === void 0 ? true : _1,
12564
+ _2 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
12565
+ disableFaceDetectionWhileAudioCaptureMsDelay = _2 === void 0 ? 2000 : _2,
12566
+ _3 = _a.silentFallback,
12567
+ silentFallback = _3 === void 0 ? false : _3,
12568
+ _4 = _a.mergeAVStreams,
12569
+ mergeAVStreams = _4 === void 0 ? false : _4,
12570
+ _5 = _a.assets,
12571
+ assets = _5 === void 0 ? {} : _5,
12572
+ _6 = _a.classNames,
12573
+ classNames = _6 === void 0 ? {} : _6,
12574
+ _7 = _a.colors,
12575
+ colors = _7 === void 0 ? {} : _7,
12576
+ _8 = _a.verbiage,
12577
+ verbiage = _8 === void 0 ? {} : _8,
12578
+ _9 = _a.debugMode,
12579
+ debugMode = _9 === void 0 ? false : _9;
12580
+ var _10 = useContext(SubmissionContext),
12581
+ submissionStatus = _10.submissionStatus,
12582
+ idCaptureVideoUrl = _10.idCaptureVideoUrl,
12583
+ idCaptureVideoAudioUrl = _10.idCaptureVideoAudioUrl,
12584
+ idCaptureVideoIdFrontImage = _10.idCaptureVideoIdFrontImage,
12585
+ idCaptureVideoIdBackImage = _10.idCaptureVideoIdBackImage,
12586
+ setIdCaptureVideoUrl = _10.setIdCaptureVideoUrl,
12587
+ setIdCaptureVideoIdFrontImage = _10.setIdCaptureVideoIdFrontImage,
12588
+ setIdCaptureVideoIdBackImage = _10.setIdCaptureVideoIdBackImage,
12589
+ setIdCaptureVideoAudioUrl = _10.setIdCaptureVideoAudioUrl;
12590
+ var _11 = useState('CAPTURING_ID'),
12591
+ captureState = _11[0],
12592
+ setCaptureState = _11[1];
12551
12593
  useEffect(function () {
12552
12594
  if (skipIdCapture && captureState === 'CAPTURING_ID') setCaptureState('CHECKING_LIVENESS');
12553
12595
  }, [captureState, skipIdCapture]);
@@ -12578,9 +12620,9 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12578
12620
  var onVideoCaptureFaceNotDetected = useCallback(function () {
12579
12621
  setCaptureState('CHECKING_LIVENESS');
12580
12622
  }, []);
12581
- var _11 = useState(0),
12582
- attempt = _11[0],
12583
- setAttempt = _11[1];
12623
+ var _12 = useState(0),
12624
+ attempt = _12[0],
12625
+ setAttempt = _12[1];
12584
12626
  var userSuppliedExitAfterFailure = onExitAfterFailure !== null && onExitAfterFailure !== void 0 ? onExitAfterFailure : faceLivenessProps.onExitAfterFailure;
12585
12627
  var onFaceCaptureExitAfterFailure = useCallback(function (resp, req) {
12586
12628
  userSuppliedExitAfterFailure === null || userSuppliedExitAfterFailure === void 0 ? void 0 : userSuppliedExitAfterFailure(resp, req);
@@ -12615,7 +12657,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12615
12657
  var _b, _c, _d, _e;
12616
12658
  var status = _a.status;
12617
12659
  return /*#__PURE__*/React__default.createElement(IdVideoCaptureGuides, {
12618
- idCardCaptureGuideImages: idCaptureGuideImages,
12660
+ idCaptureGuideImages: idCaptureGuideImages,
12619
12661
  classNames: (_b = classNames.idVideoCapture) === null || _b === void 0 ? void 0 : _b.guides,
12620
12662
  verbiage: (_c = verbiage.idVideoCapture) === null || _c === void 0 ? void 0 : _c.guides,
12621
12663
  requestedAction: "VERIFY_LIVENESS",
@@ -12675,6 +12717,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12675
12717
  guideType: idCaptureGuideType,
12676
12718
  portraitGuidesOnMobile: idCapturePortraitGuidesOnMobile,
12677
12719
  rotateLoadingOverlayImageWhenPortrait: idCaptureRotateLoadingOverlayImageWhenPortrait,
12720
+ captureRequirement: idDocumentType,
12678
12721
  debugMode: debugMode
12679
12722
  }))));
12680
12723
  case 'CHECKING_LIVENESS':
@@ -12711,7 +12754,8 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12711
12754
  onRecordingFailed: onRecordingFailed,
12712
12755
  onExitCapture: handleExitCapture,
12713
12756
  idCaptureModelsEnabled: idCaptureModelsEnabled,
12714
- idCardCaptureGuideImages: idCaptureGuideImages,
12757
+ idCaptureGuideImages: idCaptureGuideImages,
12758
+ idDocumentType: idDocumentType,
12715
12759
  videoIdCaptureThresholds: videoIdCaptureThresholds,
12716
12760
  skipShowIdCardBack: skipShowIdCardBack,
12717
12761
  disableFaceDetectionWhileAudioCapture: disableFaceDetectionWhileAudioCapture,
@@ -12878,9 +12922,11 @@ function CompositeWizard(_a) {
12878
12922
  case 'IdCapture':
12879
12923
  return /*#__PURE__*/React__default.createElement(CameraStoreProvider, {
12880
12924
  onCameraAccessDenied: onCameraAccessDenied,
12881
- onMicrophoneAccessDenied: onMicrophoneAccessDenied
12925
+ onMicrophoneAccessDenied: onMicrophoneAccessDenied,
12926
+ requestAccessAutomatically: !(idCaptureProps === null || idCaptureProps === void 0 ? void 0 : idCaptureProps.forceFallbackMode)
12882
12927
  }, /*#__PURE__*/React__default.createElement(IdCaptureModelsProvider, {
12883
12928
  autoStart: false,
12929
+ shouldLoadModels: !(idCaptureProps === null || idCaptureProps === void 0 ? void 0 : idCaptureProps.forceFallbackMode),
12884
12930
  documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
12885
12931
  focusModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.focusModelUrl) !== null && _f !== void 0 ? _f : '',
12886
12932
  onModelError: idCaptureProps.onModelError,
@@ -15250,40 +15296,42 @@ var VideoIdValidation = function VideoIdValidation(_a) {
15250
15296
  _p = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
15251
15297
  idCaptureRotateLoadingOverlayImageWhenPortrait = _p === void 0 ? true : _p,
15252
15298
  idCardForFaceMatch = _a.idCardForFaceMatch,
15253
- _q = _a.faceLivenessLoadingOverlayMode,
15254
- faceLivenessLoadingOverlayMode = _q === void 0 ? 'default' : _q,
15255
- _r = _a.disableFaceDetectionWhileAudioCapture,
15256
- disableFaceDetectionWhileAudioCapture = _r === void 0 ? false : _r,
15257
- _s = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
15258
- disableFaceDetectionWhileAudioCaptureMsDelay = _s === void 0 ? 2000 : _s,
15259
- _t = _a.silentFallback,
15260
- silentFallback = _t === void 0 ? false : _t,
15261
- _u = _a.mergeAVStreams,
15262
- mergeAVStreams = _u === void 0 ? false : _u,
15263
- _v = _a.matchOnly,
15264
- matchOnly = _v === void 0 ? false : _v,
15265
- _w = _a.theme,
15266
- theme = _w === void 0 ? 'default' : _w,
15267
- _x = _a.assets,
15268
- assets = _x === void 0 ? {} : _x,
15269
- _y = _a.classNames,
15270
- classNames = _y === void 0 ? {} : _y,
15271
- _z = _a.colors,
15272
- colors = _z === void 0 ? {} : _z,
15273
- _0 = _a.verbiage,
15274
- verbiage = _0 === void 0 ? {} : _0,
15275
- _1 = _a.captureSignature,
15276
- captureSignature = _1 === void 0 ? false : _1,
15277
- _2 = _a.captureSignatureVideo,
15278
- captureSignatureVideo = _2 === void 0 ? false : _2,
15279
- _3 = _a.captureAdditionalDocuments,
15280
- captureAdditionalDocuments = _3 === void 0 ? [] : _3,
15281
- _4 = _a.geolocationEnabled,
15282
- geolocationEnabled = _4 === void 0 ? true : _4,
15283
- _5 = _a.geolocationRequired,
15284
- geolocationRequired = _5 === void 0 ? false : _5,
15285
- _6 = _a.debugMode,
15286
- debugMode = _6 === void 0 ? false : _6;
15299
+ _q = _a.idDocumentType,
15300
+ idDocumentType = _q === void 0 ? 'idCard' : _q,
15301
+ _r = _a.faceLivenessLoadingOverlayMode,
15302
+ faceLivenessLoadingOverlayMode = _r === void 0 ? 'default' : _r,
15303
+ _s = _a.disableFaceDetectionWhileAudioCapture,
15304
+ disableFaceDetectionWhileAudioCapture = _s === void 0 ? false : _s,
15305
+ _t = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
15306
+ disableFaceDetectionWhileAudioCaptureMsDelay = _t === void 0 ? 2000 : _t,
15307
+ _u = _a.silentFallback,
15308
+ silentFallback = _u === void 0 ? false : _u,
15309
+ _v = _a.mergeAVStreams,
15310
+ mergeAVStreams = _v === void 0 ? false : _v,
15311
+ _w = _a.matchOnly,
15312
+ matchOnly = _w === void 0 ? false : _w,
15313
+ _x = _a.theme,
15314
+ theme = _x === void 0 ? 'default' : _x,
15315
+ _y = _a.assets,
15316
+ assets = _y === void 0 ? {} : _y,
15317
+ _z = _a.classNames,
15318
+ classNames = _z === void 0 ? {} : _z,
15319
+ _0 = _a.colors,
15320
+ colors = _0 === void 0 ? {} : _0,
15321
+ _1 = _a.verbiage,
15322
+ verbiage = _1 === void 0 ? {} : _1,
15323
+ _2 = _a.captureSignature,
15324
+ captureSignature = _2 === void 0 ? false : _2,
15325
+ _3 = _a.captureSignatureVideo,
15326
+ captureSignatureVideo = _3 === void 0 ? false : _3,
15327
+ _4 = _a.captureAdditionalDocuments,
15328
+ captureAdditionalDocuments = _4 === void 0 ? [] : _4,
15329
+ _5 = _a.geolocationEnabled,
15330
+ geolocationEnabled = _5 === void 0 ? true : _5,
15331
+ _6 = _a.geolocationRequired,
15332
+ geolocationRequired = _6 === void 0 ? false : _6,
15333
+ _7 = _a.debugMode,
15334
+ debugMode = _7 === void 0 ? false : _7;
15287
15335
  useLanguage(lang);
15288
15336
  useDebugLogging(debugMode);
15289
15337
  var videoIdCaptureProps = useMemo(function () {
@@ -15304,6 +15352,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
15304
15352
  idCaptureLoadingOverlayMode: idCaptureLoadingOverlayMode,
15305
15353
  customOverlayContent: customOverlayContent,
15306
15354
  onLoadingOverlayDismissed: onLoadingOverlayDismissed,
15355
+ idDocumentType: idDocumentType,
15307
15356
  idCaptureGuideType: idCaptureGuideType,
15308
15357
  idCaptureGuideImages: idCaptureGuideImages,
15309
15358
  idCapturePortraitGuidesOnMobile: idCapturePortraitGuidesOnMobile,
@@ -15319,7 +15368,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
15319
15368
  verbiage: verbiage,
15320
15369
  debugMode: debugMode
15321
15370
  };
15322
- }, [idCaptureProps, faceLivenessProps, idCaptureModelsEnabled, videoIdCaptureThresholds, readTextPrompt, readTextTimeoutDurationMs, readTextMinReadingMs, onExitCapture, onExitAfterFailure, onUserCancel, skipSuccessScreen, skipIdCapture, skipShowIdCardBack, idCaptureLoadingOverlayMode, customOverlayContent, onLoadingOverlayDismissed, idCaptureGuideType, idCaptureGuideImages, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, faceLivenessLoadingOverlayMode, disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, silentFallback, mergeAVStreams, assets, classNames, colors, verbiage, debugMode]);
15371
+ }, [idCaptureProps, faceLivenessProps, idCaptureModelsEnabled, videoIdCaptureThresholds, readTextPrompt, readTextTimeoutDurationMs, readTextMinReadingMs, onExitCapture, onExitAfterFailure, onUserCancel, skipSuccessScreen, skipIdCapture, skipShowIdCardBack, idCaptureLoadingOverlayMode, customOverlayContent, onLoadingOverlayDismissed, idDocumentType, idCaptureGuideType, idCaptureGuideImages, idCapturePortraitGuidesOnMobile, idCaptureRotateLoadingOverlayImageWhenPortrait, faceLivenessLoadingOverlayMode, disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, silentFallback, mergeAVStreams, assets, classNames, colors, verbiage, debugMode]);
15323
15372
  var additionalDocumentCaptureProps = useMemo(function () {
15324
15373
  return {
15325
15374
  documents: captureAdditionalDocuments,