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
@@ -234,7 +234,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
234
234
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
235
235
  };
236
236
 
237
- var webSdkVersion = '2.2.50';
237
+ var webSdkVersion = '2.2.52';
238
238
 
239
239
  function getPlatform() {
240
240
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -2302,18 +2302,21 @@ function useLoadFocusModel(_a) {
2302
2302
  _c = _a.modelLoadTimeoutMs,
2303
2303
  modelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
2304
2304
  onModelError = _a.onModelError,
2305
- videoRef = _a.videoRef;
2306
- var _d = React.useState(false),
2307
- ready = _d[0],
2308
- setReady = _d[1];
2309
- var _e = React.useState(0),
2310
- modelDownloadProgress = _e[0],
2311
- setModelDownloadProgress = _e[1];
2312
- var _f = React.useState(null),
2313
- modelError = _f[0],
2314
- setModelError = _f[1];
2305
+ videoRef = _a.videoRef,
2306
+ _d = _a.shouldLoadModels,
2307
+ shouldLoadModels = _d === void 0 ? true : _d;
2308
+ var _e = React.useState(false),
2309
+ ready = _e[0],
2310
+ setReady = _e[1];
2311
+ var _f = React.useState(0),
2312
+ modelDownloadProgress = _f[0],
2313
+ setModelDownloadProgress = _f[1];
2314
+ var _g = React.useState(null),
2315
+ modelError = _g[0],
2316
+ setModelError = _g[1];
2315
2317
  React.useEffect(function loadModel() {
2316
2318
  var _this = this;
2319
+ if (!shouldLoadModels) return;
2317
2320
  setReady(false);
2318
2321
  function handleDownloadProgress(event) {
2319
2322
  setModelDownloadProgress(progressToPercentage(event.detail));
@@ -2351,7 +2354,7 @@ function useLoadFocusModel(_a) {
2351
2354
  clearTimeout(modelLoadTimeout);
2352
2355
  document.removeEventListener('idmission.preloadProgress.focus', handleDownloadProgress);
2353
2356
  };
2354
- }, [modelPath, modelLoadTimeoutMs, videoRef]);
2357
+ }, [modelPath, modelLoadTimeoutMs, videoRef, shouldLoadModels]);
2355
2358
  React.useEffect(function handleModelError() {
2356
2359
  modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
2357
2360
  }, [modelError, onModelError]);
@@ -2934,25 +2937,28 @@ function closeDocumentDetector() {
2934
2937
  detectorSettings = null;
2935
2938
  }
2936
2939
  function useLoadDocumentDetector(_a) {
2937
- var _b = _a.modelPath,
2938
- modelPath = _b === void 0 ? defaultDocumentDetectorModelPath : _b,
2939
- _c = _a.modelLoadTimeoutMs,
2940
- modelLoadTimeoutMs = _c === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _c,
2941
- _d = _a.scoreThreshold,
2942
- scoreThreshold = _d === void 0 ? defaultDocumentDetectionScoreThreshold : _d,
2940
+ var _b = _a.shouldLoadModels,
2941
+ shouldLoadModels = _b === void 0 ? true : _b,
2942
+ _c = _a.modelPath,
2943
+ modelPath = _c === void 0 ? defaultDocumentDetectorModelPath : _c,
2944
+ _d = _a.modelLoadTimeoutMs,
2945
+ modelLoadTimeoutMs = _d === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _d,
2946
+ _e = _a.scoreThreshold,
2947
+ scoreThreshold = _e === void 0 ? defaultDocumentDetectionScoreThreshold : _e,
2943
2948
  onModelError = _a.onModelError,
2944
2949
  videoRef = _a.videoRef;
2945
- var _e = React.useState(false),
2946
- ready = _e[0],
2947
- setReady = _e[1];
2948
- var _f = React.useState(0),
2949
- modelDownloadProgress = _f[0],
2950
- setModelDownloadProgress = _f[1];
2951
- var _g = React.useState(null),
2952
- modelError = _g[0],
2953
- setModelError = _g[1];
2950
+ var _f = React.useState(false),
2951
+ ready = _f[0],
2952
+ setReady = _f[1];
2953
+ var _g = React.useState(0),
2954
+ modelDownloadProgress = _g[0],
2955
+ setModelDownloadProgress = _g[1];
2956
+ var _h = React.useState(null),
2957
+ modelError = _h[0],
2958
+ setModelError = _h[1];
2954
2959
  React.useEffect(function loadModel() {
2955
2960
  var _this = this;
2961
+ if (!shouldLoadModels) return;
2956
2962
  setReady(false);
2957
2963
  function handleDownloadProgress(event) {
2958
2964
  setModelDownloadProgress(progressToPercentage(event.detail));
@@ -2990,7 +2996,7 @@ function useLoadDocumentDetector(_a) {
2990
2996
  clearTimeout(modelLoadTimeout);
2991
2997
  document.removeEventListener('idmission.preloadProgress.documentDetection', handleDownloadProgress);
2992
2998
  };
2993
- }, [modelLoadTimeoutMs, modelPath, scoreThreshold, videoRef]);
2999
+ }, [shouldLoadModels, modelLoadTimeoutMs, modelPath, scoreThreshold, videoRef]);
2994
3000
  React.useEffect(function handleModelError() {
2995
3001
  modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
2996
3002
  }, [modelError, onModelError]);
@@ -3793,38 +3799,41 @@ function DocumentDetectionModelProvider(_a) {
3793
3799
  documentDetectionModelScoreThreshold = _f === void 0 ? defaultDocumentDetectionScoreThreshold : _f,
3794
3800
  _g = _a.documentDetectionModelLoadTimeoutMs,
3795
3801
  documentDetectionModelLoadTimeoutMs = _g === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _g,
3796
- onDocumentDetectionModelError = _a.onDocumentDetectionModelError;
3797
- var _h = useCameraStore(),
3798
- videoRef = _h.videoRef,
3799
- videoLoaded = _h.videoLoaded,
3800
- cameraReady = _h.cameraReady;
3802
+ onDocumentDetectionModelError = _a.onDocumentDetectionModelError,
3803
+ _h = _a.shouldLoadModels,
3804
+ shouldLoadModels = _h === void 0 ? true : _h;
3805
+ var _j = useCameraStore(),
3806
+ videoRef = _j.videoRef,
3807
+ videoLoaded = _j.videoLoaded,
3808
+ cameraReady = _j.cameraReady;
3801
3809
  var lastPredictionCanvas = React.useRef(null);
3802
3810
  var onPredictionHandler = React.useRef();
3803
- var _j = React.useState({}),
3804
- documentDetectionThresholds = _j[0],
3805
- setDocumentDetectionThresholds = _j[1];
3806
- var _k = React.useState(defaultDocumentDetectionBoundaries),
3807
- documentDetectionBoundaries = _k[0],
3808
- setDocumentDetectionBoundaries = _k[1];
3809
- var _l = React.useState(0),
3810
- timesAllZero = _l[0],
3811
- setTimesAllZero = _l[1];
3811
+ var _k = React.useState({}),
3812
+ documentDetectionThresholds = _k[0],
3813
+ setDocumentDetectionThresholds = _k[1];
3814
+ var _l = React.useState(defaultDocumentDetectionBoundaries),
3815
+ documentDetectionBoundaries = _l[0],
3816
+ setDocumentDetectionBoundaries = _l[1];
3812
3817
  var _m = React.useState(0),
3813
- canvasKey = _m[0],
3814
- setCanvasKey = _m[1];
3818
+ timesAllZero = _m[0],
3819
+ setTimesAllZero = _m[1];
3820
+ var _o = React.useState(0),
3821
+ canvasKey = _o[0],
3822
+ setCanvasKey = _o[1];
3815
3823
  var stopDetection = React.useRef(0);
3816
- var _o = useLoadDocumentDetector({
3824
+ var _p = useLoadDocumentDetector({
3817
3825
  modelPath: documentDetectionModelPath,
3818
3826
  modelLoadTimeoutMs: documentDetectionModelLoadTimeoutMs,
3819
3827
  scoreThreshold: documentDetectionModelScoreThreshold,
3820
3828
  onModelError: onDocumentDetectionModelError,
3821
- videoRef: videoRef
3829
+ videoRef: videoRef,
3830
+ shouldLoadModels: shouldLoadModels
3822
3831
  }),
3823
- ready = _o.ready,
3824
- modelDownloadProgress = _o.modelDownloadProgress,
3825
- modelError = _o.modelError,
3826
- setModelError = _o.setModelError;
3827
- var _p = useFrameLoop(React.useCallback(function (frameId, timeRunning) {
3832
+ ready = _p.ready,
3833
+ modelDownloadProgress = _p.modelDownloadProgress,
3834
+ modelError = _p.modelError,
3835
+ setModelError = _p.setModelError;
3836
+ var _q = useFrameLoop(React.useCallback(function (frameId, timeRunning) {
3828
3837
  return __awaiter(_this, void 0, void 0, function () {
3829
3838
  var stopDetectionAtStart, vw, vh, ctx, prediction, processedPrediction;
3830
3839
  var _a;
@@ -3867,8 +3876,8 @@ function DocumentDetectionModelProvider(_a) {
3867
3876
  throttleMs: throttleMs,
3868
3877
  autoStart: autoStart
3869
3878
  }),
3870
- start = _p.start,
3871
- stop = _p.stop;
3879
+ start = _q.start,
3880
+ stop = _q.stop;
3872
3881
  React.useEffect(function setErrorIfAllZero() {
3873
3882
  if (timesAllZero >= 2) {
3874
3883
  setModelError(new Error('model is returning all zeroes'));
@@ -3929,22 +3938,25 @@ function FocusModelProvider(_a) {
3929
3938
  focusModelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
3930
3939
  onFocusModelError = _a.onFocusModelError,
3931
3940
  _d = _a.showCanvases,
3932
- showCanvases = _d === void 0 ? false : _d;
3941
+ showCanvases = _d === void 0 ? false : _d,
3942
+ _e = _a.shouldLoadModels,
3943
+ shouldLoadModels = _e === void 0 ? true : _e;
3933
3944
  var cropCanvas = React.useRef(null);
3934
3945
  var rotateCanvas = React.useRef(null);
3935
- var _e = React.useState({}),
3936
- focusThresholds = _e[0],
3937
- setFocusThresholds = _e[1];
3946
+ var _f = React.useState({}),
3947
+ focusThresholds = _f[0],
3948
+ setFocusThresholds = _f[1];
3938
3949
  var videoRef = useCameraStore().videoRef;
3939
- var _f = useLoadFocusModel({
3950
+ var _g = useLoadFocusModel({
3940
3951
  modelPath: focusModelPath,
3941
3952
  modelLoadTimeoutMs: focusModelLoadTimeoutMs,
3942
3953
  onModelError: onFocusModelError,
3943
- videoRef: videoRef
3954
+ videoRef: videoRef,
3955
+ shouldLoadModels: shouldLoadModels
3944
3956
  }),
3945
- ready = _f.ready,
3946
- modelDownloadProgress = _f.modelDownloadProgress,
3947
- modelError = _f.modelError;
3957
+ ready = _g.ready,
3958
+ modelDownloadProgress = _g.modelDownloadProgress,
3959
+ modelError = _g.modelError;
3948
3960
  var makeFocusPrediction = React.useCallback(function (imageData, box) {
3949
3961
  if (!ready) return null;
3950
3962
  var prediction = makeFocusModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, box);
@@ -4904,6 +4916,7 @@ var esTranslation = {
4904
4916
  'Performing facial recognition, please hold still...': 'Realizando el reconocimiento facial, por favor no te muevas',
4905
4917
  'Display the front of your ID card...': 'Hay que mostrar el frente de la identificación...',
4906
4918
  'Display the back of your ID card...': 'Hay que mostrar el reverso de la identificación...',
4919
+ 'Display the ID page of your passport...': 'Hay que mostrar el página de datos del pasaporte...',
4907
4920
  'Please move your face to the center...': 'Por favor, hay que mover la cabeza hacia el centro...',
4908
4921
  'Searching for ID card...': 'Localizando la identificación...',
4909
4922
  'Please read the following text aloud': 'Hay que leer el siguiente texto en voz alta',
@@ -11735,7 +11748,7 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
11735
11748
  idCardGuideBorderWidth = _a.idCardGuideBorderWidth,
11736
11749
  idCardGuideBorderColor = _a.idCardGuideBorderColor,
11737
11750
  idCardCaptureProgress = _a.idCardCaptureProgress,
11738
- _3 = _a.idCardCaptureGuideImages,
11751
+ _3 = _a.idCaptureGuideImages,
11739
11752
  userSuppliedImages = _3 === void 0 ? defaultIdCaptureGuideImages : _3,
11740
11753
  _4 = _a.classNames,
11741
11754
  classNames = _4 === void 0 ? {} : _4,
@@ -11747,10 +11760,11 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
11747
11760
  var verbiage = useTranslations(rawVerbiage, {
11748
11761
  idFrontInstructionText: 'Display the front of your ID card...',
11749
11762
  idBackInstructionText: 'Display the back of your ID card...',
11763
+ passportInstructionText: 'Display the ID page of your passport...',
11750
11764
  flipIdInstructionText: 'Please flip your ID card...',
11751
11765
  verifyLivenessInstructionText: 'Performing facial recognition, please hold still...'
11752
11766
  });
11753
- var instructionText = requestedAction === 'VERIFY_LIVENESS' ? verbiage.verifyLivenessInstructionText : requestedAction === 'SHOW_ID_FRONT' ? verbiage.idFrontInstructionText : requestedAction === 'FLIP_ID' ? verbiage.flipIdInstructionText : verbiage.idBackInstructionText;
11767
+ 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;
11754
11768
  var theme = styled.useTheme();
11755
11769
  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;
11756
11770
  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';
@@ -11815,7 +11829,7 @@ var IdVideoCaptureGuides = function IdVideoCaptureGuides(_a) {
11815
11829
  className: classNames.idCardGuideImage,
11816
11830
  "$isMirrored": !isRearFacing,
11817
11831
  style: idCardImageStyle,
11818
- src: requestedAction === 'SHOW_ID_BACK' ? idCaptureGuideImages.landscape.SHOW_ID_BACK.url : idCaptureGuideImages.landscape.SHOW_ID_FRONT.url,
11832
+ 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,
11819
11833
  onLoad: onImageLoaded
11820
11834
  })), requestedAction === 'FLIP_ID' && ( /*#__PURE__*/React__namespace.default.createElement(IdVideoCaptureFlipIdPrompt, {
11821
11835
  idCaptureGuideImages: idCaptureGuideImages,
@@ -11950,7 +11964,7 @@ var defaultVideoIdCaptureThresholds = {
11950
11964
  detection: {
11951
11965
  idCardFront: 0.4,
11952
11966
  idCardBack: 0.5,
11953
- passport: 1
11967
+ passport: 0.3
11954
11968
  },
11955
11969
  focus: {
11956
11970
  idCardFront: {
@@ -11968,7 +11982,8 @@ var defaultVideoIdCaptureThresholds = {
11968
11982
  },
11969
11983
  goodFrames: {
11970
11984
  idCardFront: 1,
11971
- idCardBack: 1
11985
+ idCardBack: 1,
11986
+ passport: 1
11972
11987
  },
11973
11988
  flipShortcutThreshold: 0.7
11974
11989
  };
@@ -11982,91 +11997,93 @@ var IdVideoCapture = function IdVideoCapture(_a) {
11982
11997
  onExitCapture = _a.onExitCapture,
11983
11998
  _w = _a.idCaptureModelsEnabled,
11984
11999
  idCaptureModelsEnabled = _w === void 0 ? true : _w,
11985
- _x = _a.idCardCaptureGuideImages,
11986
- idCardCaptureGuideImages = _x === void 0 ? defaultIdCaptureGuideImages : _x,
11987
- _y = _a.idCardFrontDelay,
11988
- idCardFrontDelay = _y === void 0 ? 1000 : _y,
11989
- _z = _a.videoIdCaptureThresholds,
11990
- videoIdCaptureThresholds = _z === void 0 ? defaultVideoIdCaptureThresholds : _z,
11991
- _0 = _a.skipShowIdCardBack,
11992
- skipShowIdCardBack = _0 === void 0 ? false : _0,
11993
- _1 = _a.captureCountdownSeconds,
11994
- captureCountdownSeconds = _1 === void 0 ? 3 : _1,
12000
+ _x = _a.idDocumentType,
12001
+ idDocumentType = _x === void 0 ? 'idCard' : _x,
12002
+ _y = _a.idCaptureGuideImages,
12003
+ idCaptureGuideImages = _y === void 0 ? defaultIdCaptureGuideImages : _y,
12004
+ _z = _a.idCardFrontDelay,
12005
+ idCardFrontDelay = _z === void 0 ? 1000 : _z,
12006
+ _0 = _a.videoIdCaptureThresholds,
12007
+ videoIdCaptureThresholds = _0 === void 0 ? defaultVideoIdCaptureThresholds : _0,
12008
+ _1 = _a.skipShowIdCardBack,
12009
+ skipShowIdCardBack = _1 === void 0 ? false : _1,
12010
+ _2 = _a.captureCountdownSeconds,
12011
+ captureCountdownSeconds = _2 === void 0 ? 3 : _2,
11995
12012
  readTextPrompt = _a.readTextPrompt,
11996
- _2 = _a.readTextTimeoutDurationMs,
11997
- readTextTimeoutDurationMs = _2 === void 0 ? 15000 : _2,
11998
- _3 = _a.readTextMinReadingMs,
11999
- readTextMinReadingMs = _3 === void 0 ? 10000 : _3,
12000
- _4 = _a.disableFaceDetectionWhileAudioCapture,
12001
- disableFaceDetectionWhileAudioCapture = _4 === void 0 ? false : _4,
12002
- _5 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
12003
- disableFaceDetectionWhileAudioCaptureMsDelay = _5 === void 0 ? 2000 : _5,
12004
- _6 = _a.mergeAVStreams,
12005
- mergeAVStreams = _6 === void 0 ? false : _6,
12006
- _7 = _a.classNames,
12007
- classNames = _7 === void 0 ? {} : _7,
12008
- _8 = _a.colors,
12009
- colors = _8 === void 0 ? {} : _8,
12010
- _9 = _a.verbiage,
12011
- rawVerbiage = _9 === void 0 ? {} : _9,
12012
- _10 = _a.debugMode,
12013
- debugMode = _10 === void 0 ? false : _10;
12014
- var _11 = useResizeObserver__default.default(),
12015
- ref = _11.ref,
12016
- _12 = _11.width,
12017
- width = _12 === void 0 ? 1 : _12,
12018
- _13 = _11.height,
12019
- height = _13 === void 0 ? 1 : _13;
12020
- var _14 = useCameraStore(),
12021
- camera = _14.camera,
12022
- videoRef = _14.videoRef,
12023
- videoLoaded = _14.videoLoaded,
12024
- cameraReady = _14.cameraReady,
12025
- microphoneReady = _14.microphoneReady,
12026
- audioStream = _14.audioStream,
12027
- isRearFacing = _14.isRearFacing,
12028
- releaseCameraAccess = _14.releaseCameraAccess;
12029
- var _15 = React.useState([]),
12030
- detectedObjects = _15[0],
12031
- setDetectedObjects = _15[1];
12032
- var _16 = React.useState(null),
12033
- face = _16[0],
12034
- setFace = _16[1];
12035
- var _17 = React.useContext(IdCaptureModelsContext),
12036
- idModelsReady = _17.ready,
12037
- startIdModels = _17.start,
12038
- stopIdModels = _17.stop,
12039
- onIdPredictionMade = _17.onPredictionMade,
12040
- setThresholds = _17.setThresholds,
12041
- setDocumentDetectionBoundaries = _17.setDocumentDetectionBoundaries,
12042
- bestFrameDetails = _17.bestFrameDetails,
12043
- resetBestFrame = _17.resetBestFrame,
12044
- idModelError = _17.modelError;
12045
- var _18 = React.useState(null),
12046
- videoStartsAt = _18[0],
12047
- setVideoStartsAt = _18[1];
12048
- var _19 = React.useContext(SubmissionContext),
12049
- setIdCaptureVideoAudioStartsAt = _19.setIdCaptureVideoAudioStartsAt,
12050
- setExpectedAudioText = _19.setExpectedAudioText;
12051
- var _20 = React.useContext(SelfieGuidanceModelsContext),
12052
- startSelfieGuidance = _20.start,
12053
- stopSelfieGuidance = _20.stop,
12054
- onSelfiePredictionMade = _20.onPredictionMade,
12055
- selfieModelError = _20.error;
12056
- var _21 = useVideoRecorder(camera, audioStream, mergeAVStreams),
12057
- isRecordingVideo = _21.isRecordingVideo,
12058
- startRecordingVideo = _21.startRecordingVideo,
12059
- startRecordingAudio = _21.startRecordingAudio,
12060
- stopRecordingVideo = _21.stopRecordingVideo,
12061
- stopRecordingAudio = _21.stopRecordingAudio,
12062
- videoRecordingUnintentionallyStopped = _21.videoRecordingUnintentionallyStopped,
12063
- audioRecordingUnintentionallyStopped = _21.audioRecordingUnintentionallyStopped,
12064
- videoUrl = _21.videoUrl,
12065
- audioUrl = _21.audioUrl;
12013
+ _3 = _a.readTextTimeoutDurationMs,
12014
+ readTextTimeoutDurationMs = _3 === void 0 ? 15000 : _3,
12015
+ _4 = _a.readTextMinReadingMs,
12016
+ readTextMinReadingMs = _4 === void 0 ? 10000 : _4,
12017
+ _5 = _a.disableFaceDetectionWhileAudioCapture,
12018
+ disableFaceDetectionWhileAudioCapture = _5 === void 0 ? false : _5,
12019
+ _6 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
12020
+ disableFaceDetectionWhileAudioCaptureMsDelay = _6 === void 0 ? 2000 : _6,
12021
+ _7 = _a.mergeAVStreams,
12022
+ mergeAVStreams = _7 === void 0 ? false : _7,
12023
+ _8 = _a.classNames,
12024
+ classNames = _8 === void 0 ? {} : _8,
12025
+ _9 = _a.colors,
12026
+ colors = _9 === void 0 ? {} : _9,
12027
+ _10 = _a.verbiage,
12028
+ rawVerbiage = _10 === void 0 ? {} : _10,
12029
+ _11 = _a.debugMode,
12030
+ debugMode = _11 === void 0 ? false : _11;
12031
+ var _12 = useResizeObserver__default.default(),
12032
+ ref = _12.ref,
12033
+ _13 = _12.width,
12034
+ width = _13 === void 0 ? 1 : _13,
12035
+ _14 = _12.height,
12036
+ height = _14 === void 0 ? 1 : _14;
12037
+ var _15 = useCameraStore(),
12038
+ camera = _15.camera,
12039
+ videoRef = _15.videoRef,
12040
+ videoLoaded = _15.videoLoaded,
12041
+ cameraReady = _15.cameraReady,
12042
+ microphoneReady = _15.microphoneReady,
12043
+ audioStream = _15.audioStream,
12044
+ isRearFacing = _15.isRearFacing,
12045
+ releaseCameraAccess = _15.releaseCameraAccess;
12046
+ var _16 = React.useState([]),
12047
+ detectedObjects = _16[0],
12048
+ setDetectedObjects = _16[1];
12049
+ var _17 = React.useState(null),
12050
+ face = _17[0],
12051
+ setFace = _17[1];
12052
+ var _18 = React.useContext(IdCaptureModelsContext),
12053
+ idModelsReady = _18.ready,
12054
+ startIdModels = _18.start,
12055
+ stopIdModels = _18.stop,
12056
+ onIdPredictionMade = _18.onPredictionMade,
12057
+ setThresholds = _18.setThresholds,
12058
+ setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
12059
+ bestFrameDetails = _18.bestFrameDetails,
12060
+ resetBestFrame = _18.resetBestFrame,
12061
+ idModelError = _18.modelError;
12062
+ var _19 = React.useState(null),
12063
+ videoStartsAt = _19[0],
12064
+ setVideoStartsAt = _19[1];
12065
+ var _20 = React.useContext(SubmissionContext),
12066
+ setIdCaptureVideoAudioStartsAt = _20.setIdCaptureVideoAudioStartsAt,
12067
+ setExpectedAudioText = _20.setExpectedAudioText;
12068
+ var _21 = React.useContext(SelfieGuidanceModelsContext),
12069
+ startSelfieGuidance = _21.start,
12070
+ stopSelfieGuidance = _21.stop,
12071
+ onSelfiePredictionMade = _21.onPredictionMade,
12072
+ selfieModelError = _21.error;
12073
+ var _22 = useVideoRecorder(camera, audioStream, mergeAVStreams),
12074
+ isRecordingVideo = _22.isRecordingVideo,
12075
+ startRecordingVideo = _22.startRecordingVideo,
12076
+ startRecordingAudio = _22.startRecordingAudio,
12077
+ stopRecordingVideo = _22.stopRecordingVideo,
12078
+ stopRecordingAudio = _22.stopRecordingAudio,
12079
+ videoRecordingUnintentionallyStopped = _22.videoRecordingUnintentionallyStopped,
12080
+ audioRecordingUnintentionallyStopped = _22.audioRecordingUnintentionallyStopped,
12081
+ videoUrl = _22.videoUrl,
12082
+ audioUrl = _22.audioUrl;
12066
12083
  var countdownTimeoutRef = React.useRef(undefined);
12067
- var _22 = React.useState(-1),
12068
- countdownRemaining = _22[0],
12069
- setCountdownRemaining = _22[1];
12084
+ var _23 = React.useState(-1),
12085
+ countdownRemaining = _23[0],
12086
+ setCountdownRemaining = _23[1];
12070
12087
  React.useEffect(function () {
12071
12088
  if (!isRecordingVideo && !videoUrl) {
12072
12089
  startRecordingVideo();
@@ -12086,9 +12103,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12086
12103
  onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
12087
12104
  }
12088
12105
  }, [audioRecordingUnintentionallyStopped, microphoneReady, onRecordingFailed, readTextPrompt, videoRecordingUnintentionallyStopped]);
12089
- var _23 = React.useState('SHOW_ID_FRONT'),
12090
- requestedAction = _23[0],
12091
- setRequestedAction = _23[1];
12106
+ var _24 = React.useState(idDocumentType === 'idCard' ? 'SHOW_ID_FRONT' : 'SHOW_PASSPORT'),
12107
+ requestedAction = _24[0],
12108
+ setRequestedAction = _24[1];
12092
12109
  var shouldRunIdModels = idCaptureModelsEnabled && videoLoaded && cameraReady && idModelsReady && !idModelError && requestedAction !== 'READ_TEXT' && (!readTextPrompt || microphoneReady);
12093
12110
  React.useEffect(function startModelsWhenCapturing() {
12094
12111
  if (!shouldRunIdModels) return;
@@ -12097,9 +12114,25 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12097
12114
  return stopIdModels();
12098
12115
  };
12099
12116
  }, [shouldRunIdModels, startIdModels, stopIdModels]);
12117
+ var adjustedThresholds = React.useMemo(function () {
12118
+ if (idDocumentType === 'idCard') {
12119
+ return _assign(_assign({}, videoIdCaptureThresholds), {
12120
+ detection: _assign(_assign({}, videoIdCaptureThresholds.detection), {
12121
+ passport: 1
12122
+ })
12123
+ });
12124
+ } else {
12125
+ return _assign(_assign({}, videoIdCaptureThresholds), {
12126
+ detection: _assign(_assign({}, videoIdCaptureThresholds.detection), {
12127
+ idCardFront: 1,
12128
+ idCardBack: 1
12129
+ })
12130
+ });
12131
+ }
12132
+ }, [idDocumentType, videoIdCaptureThresholds]);
12100
12133
  React.useEffect(function () {
12101
- setThresholds(videoIdCaptureThresholds);
12102
- }, [requestedAction, setThresholds, videoIdCaptureThresholds]);
12134
+ setThresholds(adjustedThresholds);
12135
+ }, [requestedAction, setThresholds, adjustedThresholds]);
12103
12136
  React.useEffect(function () {
12104
12137
  setDocumentDetectionBoundaries({
12105
12138
  top: 20,
@@ -12108,19 +12141,19 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12108
12141
  bottom: 0
12109
12142
  });
12110
12143
  }, [setDocumentDetectionBoundaries]);
12111
- var _24 = React.useState(0),
12112
- currentDetectionScore = _24[0],
12113
- setCurrentDetectionScore = _24[1];
12114
- var _25 = React.useState('none'),
12115
- currentDetectedDocumentType = _25[0],
12116
- setCurrentDetectedDocumentType = _25[1];
12117
- var _26 = React.useState(0),
12118
- currentFocusScore = _26[0],
12119
- setCurrentFocusScore = _26[1];
12144
+ var _25 = React.useState(0),
12145
+ currentDetectionScore = _25[0],
12146
+ setCurrentDetectionScore = _25[1];
12147
+ var _26 = React.useState('none'),
12148
+ currentDetectedDocumentType = _26[0],
12149
+ setCurrentDetectedDocumentType = _26[1];
12120
12150
  var _27 = React.useState(0),
12121
- goodFramesCount = _27[0],
12122
- setGoodFramesCount = _27[1];
12123
- var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? videoIdCaptureThresholds.goodFrames.idCardFront : videoIdCaptureThresholds.goodFrames.idCardBack;
12151
+ currentFocusScore = _27[0],
12152
+ setCurrentFocusScore = _27[1];
12153
+ var _28 = React.useState(0),
12154
+ goodFramesCount = _28[0],
12155
+ setGoodFramesCount = _28[1];
12156
+ var goodFramesThreshold = requestedAction === 'SHOW_PASSPORT' ? adjustedThresholds.goodFrames.passport : requestedAction === 'SHOW_ID_FRONT' ? adjustedThresholds.goodFrames.idCardFront : adjustedThresholds.goodFrames.idCardBack;
12124
12157
  var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
12125
12158
  React.useEffect(function () {
12126
12159
  if (!idCaptureModelsEnabled || idModelError) return;
@@ -12129,9 +12162,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12129
12162
  setCurrentDetectionScore(prediction.detectionScore);
12130
12163
  setCurrentDetectedDocumentType(prediction.detectedDocumentType);
12131
12164
  setCurrentFocusScore(prediction.focusScore);
12132
- var detectionThresholdMet = requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
12165
+ var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
12133
12166
  var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
12134
- var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= videoIdCaptureThresholds.flipShortcutThreshold;
12167
+ var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= adjustedThresholds.flipShortcutThreshold;
12135
12168
  if (shouldShortcutFlipAnimation) {
12136
12169
  return setRequestedAction('SHOW_ID_BACK');
12137
12170
  }
@@ -12139,16 +12172,16 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12139
12172
  return n + 1;
12140
12173
  } : 0);
12141
12174
  });
12142
- }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, videoIdCaptureThresholds.flipShortcutThreshold]);
12143
- var _28 = React.useState(null),
12144
- idFrontCaptureStartedAt = _28[0],
12145
- setFirstGoodFrameTime = _28[1];
12175
+ }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, adjustedThresholds.flipShortcutThreshold]);
12176
+ var _29 = React.useState(null),
12177
+ idFrontCaptureStartedAt = _29[0],
12178
+ setFirstGoodFrameTime = _29[1];
12146
12179
  React.useEffect(function () {
12147
12180
  if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
12148
12181
  }, [goodFramesCount]);
12149
- var delaySatisfied = requestedAction !== 'SHOW_ID_FRONT' || idFrontCaptureStartedAt !== null && new Date().getTime() > idFrontCaptureStartedAt + idCardFrontDelay;
12182
+ var delaySatisfied = !['SHOW_ID_FRONT', 'SHOW_PASSPORT'].includes(requestedAction) || idFrontCaptureStartedAt !== null && new Date().getTime() > idFrontCaptureStartedAt + idCardFrontDelay;
12150
12183
  var translatedText = useVerbiage(readTextPrompt, '');
12151
- var onIdBackCaptureComplete = React.useCallback(function () {
12184
+ var onIdCaptureComplete = React.useCallback(function () {
12152
12185
  var _a;
12153
12186
  if (translatedText) {
12154
12187
  setRequestedAction('READ_TEXT');
@@ -12163,16 +12196,16 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12163
12196
  var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
12164
12197
  var faceBox = face === null || face === void 0 ? void 0 : face.box;
12165
12198
  var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
12166
- var _29 = React.useState(),
12167
- countdownStartedAt = _29[0],
12168
- setCountdownStartedAt = _29[1];
12199
+ var _30 = React.useState(),
12200
+ countdownStartedAt = _30[0],
12201
+ setCountdownStartedAt = _30[1];
12169
12202
  var photoCanvas = React.useRef(null);
12170
12203
  var frameLock = React.useRef(false);
12171
12204
  var captureFrame = React.useCallback(function () {
12172
12205
  return __awaiter(void 0, void 0, void 0, function () {
12173
- var frameBase64;
12174
- return __generator(this, function (_a) {
12175
- switch (_a.label) {
12206
+ var frameBase64, _a;
12207
+ return __generator(this, function (_b) {
12208
+ switch (_b.label) {
12176
12209
  case 0:
12177
12210
  if (frameLock.current) return [2 /*return*/];
12178
12211
  frameLock.current = true;
@@ -12182,23 +12215,25 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12182
12215
  frameLock.current = false;
12183
12216
  return [2 /*return*/];
12184
12217
  }
12185
- _a.label = 1;
12218
+ _b.label = 1;
12186
12219
  case 1:
12187
- _a.trys.push([1,, 7, 8]);
12220
+ _b.trys.push([1,, 7, 8]);
12188
12221
  if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 5];
12189
12222
  if (onIdFrontImageCaptured) {
12190
12223
  onIdFrontImageCaptured(frameBase64);
12191
12224
  }
12192
12225
  if (!skipShowIdCardBack) return [3 /*break*/, 4];
12193
- if (!(skipShowIdCardBack === true)) return [3 /*break*/, 2];
12194
- return [2 /*return*/, onIdBackCaptureComplete()];
12195
- case 2:
12226
+ _a = skipShowIdCardBack === true;
12227
+ if (_a) return [3 /*break*/, 3];
12196
12228
  return [4 /*yield*/, skipShowIdCardBack()];
12229
+ case 2:
12230
+ _a = _b.sent();
12231
+ _b.label = 3;
12197
12232
  case 3:
12198
- if (_a.sent()) {
12199
- return [2 /*return*/, onIdBackCaptureComplete()];
12233
+ if (_a) {
12234
+ return [2 /*return*/, onIdCaptureComplete()];
12200
12235
  }
12201
- _a.label = 4;
12236
+ _b.label = 4;
12202
12237
  case 4:
12203
12238
  setRequestedAction('FLIP_ID');
12204
12239
  return [3 /*break*/, 6];
@@ -12207,9 +12242,14 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12207
12242
  if (onIdBackImageCaptured) {
12208
12243
  onIdBackImageCaptured(frameBase64);
12209
12244
  }
12210
- onIdBackCaptureComplete();
12245
+ onIdCaptureComplete();
12246
+ } else if (requestedAction == 'SHOW_PASSPORT') {
12247
+ if (onIdFrontImageCaptured) {
12248
+ onIdFrontImageCaptured(frameBase64);
12249
+ }
12250
+ onIdCaptureComplete();
12211
12251
  }
12212
- _a.label = 6;
12252
+ _b.label = 6;
12213
12253
  case 6:
12214
12254
  return [3 /*break*/, 8];
12215
12255
  case 7:
@@ -12229,7 +12269,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12229
12269
  }
12230
12270
  });
12231
12271
  });
12232
- }, [onIdBackCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
12272
+ }, [onIdCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
12233
12273
  var isFlipping = requestedAction === 'FLIP_ID';
12234
12274
  React.useEffect(function () {
12235
12275
  if (!isFlipping) return;
@@ -12288,9 +12328,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12288
12328
  stopSelfieGuidance();
12289
12329
  };
12290
12330
  }, [startSelfieGuidance, stopSelfieGuidance]);
12291
- var _30 = React.useState(0),
12292
- numFramesWithoutFaces = _30[0],
12293
- setNumFramesWithoutFaces = _30[1];
12331
+ var _31 = React.useState(0),
12332
+ numFramesWithoutFaces = _31[0],
12333
+ setNumFramesWithoutFaces = _31[1];
12294
12334
  onSelfiePredictionMade(useDebounce.useThrottledCallback(React.useCallback(function (_a) {
12295
12335
  var face = _a.face;
12296
12336
  if (selfieModelError) return;
@@ -12306,12 +12346,12 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12306
12346
  }
12307
12347
  }, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
12308
12348
  var theme = styled.useTheme();
12309
- var _31 = useTranslations(rawVerbiage, {
12349
+ var _32 = useTranslations(rawVerbiage, {
12310
12350
  faceNotCenteredText: 'Please move your face to the center...',
12311
12351
  captureBtnText: 'Capture'
12312
12352
  }),
12313
- captureBtnText = _31.captureBtnText,
12314
- faceNotCenteredText = _31.faceNotCenteredText;
12353
+ captureBtnText = _32.captureBtnText,
12354
+ faceNotCenteredText = _32.faceNotCenteredText;
12315
12355
  var debugScalingDetails = useDebugScalingDetails({
12316
12356
  enabled: debugMode,
12317
12357
  pageWidth: width,
@@ -12319,7 +12359,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12319
12359
  videoWidth: (_g = (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.videoWidth) !== null && _g !== void 0 ? _g : 0,
12320
12360
  videoHeight: (_j = (_h = videoRef.current) === null || _h === void 0 ? void 0 : _h.videoHeight) !== null && _j !== void 0 ? _j : 0
12321
12361
  });
12322
- var capturingId = ['SHOW_ID_FRONT', 'SHOW_ID_BACK'].includes(requestedAction);
12362
+ var capturingId = ['SHOW_ID_FRONT', 'SHOW_ID_BACK', 'SHOW_PASSPORT'].includes(requestedAction);
12323
12363
  var guidanceText = !faceCentered ? faceNotCenteredText : undefined;
12324
12364
  return /*#__PURE__*/React__namespace.default.createElement(PageContainer, {
12325
12365
  ref: ref,
@@ -12340,8 +12380,8 @@ var IdVideoCapture = function IdVideoCapture(_a) {
12340
12380
  requestedAction: requestedAction,
12341
12381
  satisfied: satisfied,
12342
12382
  idCardGuideStatus: countdownStartedAt ? 'capturing' : 'ready',
12343
- idCardCaptureProgress: !!countdownStartedAt ? 1 : 0,
12344
- idCardCaptureGuideImages: idCardCaptureGuideImages,
12383
+ idCardCaptureProgress: countdownStartedAt ? 1 : 0,
12384
+ idCaptureGuideImages: idCaptureGuideImages,
12345
12385
  faceGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor,
12346
12386
  idCardGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor
12347
12387
  }), debugMode && capturingId && ( /*#__PURE__*/React__namespace.default.createElement(React__namespace.default.Fragment, null, /*#__PURE__*/React__namespace.default.createElement(ObjectDetectionDebugOverlayDiv, {
@@ -12536,49 +12576,51 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12536
12576
  idCaptureLoadingOverlayMode = _t === void 0 ? 'default' : _t,
12537
12577
  customOverlayContent = _a.customOverlayContent,
12538
12578
  onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
12539
- _u = _a.idCaptureGuideType,
12540
- idCaptureGuideType = _u === void 0 ? 'fit' : _u,
12541
- _v = _a.idCaptureGuideImages,
12542
- idCaptureGuideImages = _v === void 0 ? defaultIdCaptureGuideImages : _v,
12543
- _w = _a.idCapturePortraitGuidesOnMobile,
12544
- idCapturePortraitGuidesOnMobile = _w === void 0 ? true : _w,
12545
- _x = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
12546
- idCaptureRotateLoadingOverlayImageWhenPortrait = _x === void 0 ? true : _x,
12547
- _y = _a.idCaptureModelLoadTimeoutMs,
12548
- idCaptureModelLoadTimeoutMs = _y === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _y,
12549
- _z = _a.faceLivenessLoadingOverlayMode,
12550
- faceLivenessLoadingOverlayMode = _z === void 0 ? 'default' : _z,
12551
- _0 = _a.disableFaceDetectionWhileAudioCapture,
12552
- disableFaceDetectionWhileAudioCapture = _0 === void 0 ? true : _0,
12553
- _1 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
12554
- disableFaceDetectionWhileAudioCaptureMsDelay = _1 === void 0 ? 2000 : _1,
12555
- _2 = _a.silentFallback,
12556
- silentFallback = _2 === void 0 ? false : _2,
12557
- _3 = _a.mergeAVStreams,
12558
- mergeAVStreams = _3 === void 0 ? false : _3,
12559
- _4 = _a.assets,
12560
- assets = _4 === void 0 ? {} : _4,
12561
- _5 = _a.classNames,
12562
- classNames = _5 === void 0 ? {} : _5,
12563
- _6 = _a.colors,
12564
- colors = _6 === void 0 ? {} : _6,
12565
- _7 = _a.verbiage,
12566
- verbiage = _7 === void 0 ? {} : _7,
12567
- _8 = _a.debugMode,
12568
- debugMode = _8 === void 0 ? false : _8;
12569
- var _9 = React.useContext(SubmissionContext),
12570
- submissionStatus = _9.submissionStatus,
12571
- idCaptureVideoUrl = _9.idCaptureVideoUrl,
12572
- idCaptureVideoAudioUrl = _9.idCaptureVideoAudioUrl,
12573
- idCaptureVideoIdFrontImage = _9.idCaptureVideoIdFrontImage,
12574
- idCaptureVideoIdBackImage = _9.idCaptureVideoIdBackImage,
12575
- setIdCaptureVideoUrl = _9.setIdCaptureVideoUrl,
12576
- setIdCaptureVideoIdFrontImage = _9.setIdCaptureVideoIdFrontImage,
12577
- setIdCaptureVideoIdBackImage = _9.setIdCaptureVideoIdBackImage,
12578
- setIdCaptureVideoAudioUrl = _9.setIdCaptureVideoAudioUrl;
12579
- var _10 = React.useState('CAPTURING_ID'),
12580
- captureState = _10[0],
12581
- setCaptureState = _10[1];
12579
+ _u = _a.idDocumentType,
12580
+ idDocumentType = _u === void 0 ? 'idCard' : _u,
12581
+ _v = _a.idCaptureGuideType,
12582
+ idCaptureGuideType = _v === void 0 ? 'fit' : _v,
12583
+ _w = _a.idCaptureGuideImages,
12584
+ idCaptureGuideImages = _w === void 0 ? defaultIdCaptureGuideImages : _w,
12585
+ _x = _a.idCapturePortraitGuidesOnMobile,
12586
+ idCapturePortraitGuidesOnMobile = _x === void 0 ? true : _x,
12587
+ _y = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
12588
+ idCaptureRotateLoadingOverlayImageWhenPortrait = _y === void 0 ? true : _y,
12589
+ _z = _a.idCaptureModelLoadTimeoutMs,
12590
+ idCaptureModelLoadTimeoutMs = _z === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _z,
12591
+ _0 = _a.faceLivenessLoadingOverlayMode,
12592
+ faceLivenessLoadingOverlayMode = _0 === void 0 ? 'default' : _0,
12593
+ _1 = _a.disableFaceDetectionWhileAudioCapture,
12594
+ disableFaceDetectionWhileAudioCapture = _1 === void 0 ? true : _1,
12595
+ _2 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
12596
+ disableFaceDetectionWhileAudioCaptureMsDelay = _2 === void 0 ? 2000 : _2,
12597
+ _3 = _a.silentFallback,
12598
+ silentFallback = _3 === void 0 ? false : _3,
12599
+ _4 = _a.mergeAVStreams,
12600
+ mergeAVStreams = _4 === void 0 ? false : _4,
12601
+ _5 = _a.assets,
12602
+ assets = _5 === void 0 ? {} : _5,
12603
+ _6 = _a.classNames,
12604
+ classNames = _6 === void 0 ? {} : _6,
12605
+ _7 = _a.colors,
12606
+ colors = _7 === void 0 ? {} : _7,
12607
+ _8 = _a.verbiage,
12608
+ verbiage = _8 === void 0 ? {} : _8,
12609
+ _9 = _a.debugMode,
12610
+ debugMode = _9 === void 0 ? false : _9;
12611
+ var _10 = React.useContext(SubmissionContext),
12612
+ submissionStatus = _10.submissionStatus,
12613
+ idCaptureVideoUrl = _10.idCaptureVideoUrl,
12614
+ idCaptureVideoAudioUrl = _10.idCaptureVideoAudioUrl,
12615
+ idCaptureVideoIdFrontImage = _10.idCaptureVideoIdFrontImage,
12616
+ idCaptureVideoIdBackImage = _10.idCaptureVideoIdBackImage,
12617
+ setIdCaptureVideoUrl = _10.setIdCaptureVideoUrl,
12618
+ setIdCaptureVideoIdFrontImage = _10.setIdCaptureVideoIdFrontImage,
12619
+ setIdCaptureVideoIdBackImage = _10.setIdCaptureVideoIdBackImage,
12620
+ setIdCaptureVideoAudioUrl = _10.setIdCaptureVideoAudioUrl;
12621
+ var _11 = React.useState('CAPTURING_ID'),
12622
+ captureState = _11[0],
12623
+ setCaptureState = _11[1];
12582
12624
  React.useEffect(function () {
12583
12625
  if (skipIdCapture && captureState === 'CAPTURING_ID') setCaptureState('CHECKING_LIVENESS');
12584
12626
  }, [captureState, skipIdCapture]);
@@ -12609,9 +12651,9 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12609
12651
  var onVideoCaptureFaceNotDetected = React.useCallback(function () {
12610
12652
  setCaptureState('CHECKING_LIVENESS');
12611
12653
  }, []);
12612
- var _11 = React.useState(0),
12613
- attempt = _11[0],
12614
- setAttempt = _11[1];
12654
+ var _12 = React.useState(0),
12655
+ attempt = _12[0],
12656
+ setAttempt = _12[1];
12615
12657
  var userSuppliedExitAfterFailure = onExitAfterFailure !== null && onExitAfterFailure !== void 0 ? onExitAfterFailure : faceLivenessProps.onExitAfterFailure;
12616
12658
  var onFaceCaptureExitAfterFailure = React.useCallback(function (resp, req) {
12617
12659
  userSuppliedExitAfterFailure === null || userSuppliedExitAfterFailure === void 0 ? void 0 : userSuppliedExitAfterFailure(resp, req);
@@ -12646,7 +12688,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12646
12688
  var _b, _c, _d, _e;
12647
12689
  var status = _a.status;
12648
12690
  return /*#__PURE__*/React__namespace.default.createElement(IdVideoCaptureGuides, {
12649
- idCardCaptureGuideImages: idCaptureGuideImages,
12691
+ idCaptureGuideImages: idCaptureGuideImages,
12650
12692
  classNames: (_b = classNames.idVideoCapture) === null || _b === void 0 ? void 0 : _b.guides,
12651
12693
  verbiage: (_c = verbiage.idVideoCapture) === null || _c === void 0 ? void 0 : _c.guides,
12652
12694
  requestedAction: "VERIFY_LIVENESS",
@@ -12706,6 +12748,7 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12706
12748
  guideType: idCaptureGuideType,
12707
12749
  portraitGuidesOnMobile: idCapturePortraitGuidesOnMobile,
12708
12750
  rotateLoadingOverlayImageWhenPortrait: idCaptureRotateLoadingOverlayImageWhenPortrait,
12751
+ captureRequirement: idDocumentType,
12709
12752
  debugMode: debugMode
12710
12753
  }))));
12711
12754
  case 'CHECKING_LIVENESS':
@@ -12742,7 +12785,8 @@ var VideoIdWizard = function VideoIdWizard(_a) {
12742
12785
  onRecordingFailed: onRecordingFailed,
12743
12786
  onExitCapture: handleExitCapture,
12744
12787
  idCaptureModelsEnabled: idCaptureModelsEnabled,
12745
- idCardCaptureGuideImages: idCaptureGuideImages,
12788
+ idCaptureGuideImages: idCaptureGuideImages,
12789
+ idDocumentType: idDocumentType,
12746
12790
  videoIdCaptureThresholds: videoIdCaptureThresholds,
12747
12791
  skipShowIdCardBack: skipShowIdCardBack,
12748
12792
  disableFaceDetectionWhileAudioCapture: disableFaceDetectionWhileAudioCapture,
@@ -12909,9 +12953,11 @@ function CompositeWizard(_a) {
12909
12953
  case 'IdCapture':
12910
12954
  return /*#__PURE__*/React__namespace.default.createElement(CameraStoreProvider, {
12911
12955
  onCameraAccessDenied: onCameraAccessDenied,
12912
- onMicrophoneAccessDenied: onMicrophoneAccessDenied
12956
+ onMicrophoneAccessDenied: onMicrophoneAccessDenied,
12957
+ requestAccessAutomatically: !(idCaptureProps === null || idCaptureProps === void 0 ? void 0 : idCaptureProps.forceFallbackMode)
12913
12958
  }, /*#__PURE__*/React__namespace.default.createElement(IdCaptureModelsProvider, {
12914
12959
  autoStart: false,
12960
+ shouldLoadModels: !(idCaptureProps === null || idCaptureProps === void 0 ? void 0 : idCaptureProps.forceFallbackMode),
12915
12961
  documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
12916
12962
  focusModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.focusModelUrl) !== null && _f !== void 0 ? _f : '',
12917
12963
  onModelError: idCaptureProps.onModelError,
@@ -15281,40 +15327,42 @@ var VideoIdValidation = function VideoIdValidation(_a) {
15281
15327
  _p = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
15282
15328
  idCaptureRotateLoadingOverlayImageWhenPortrait = _p === void 0 ? true : _p,
15283
15329
  idCardForFaceMatch = _a.idCardForFaceMatch,
15284
- _q = _a.faceLivenessLoadingOverlayMode,
15285
- faceLivenessLoadingOverlayMode = _q === void 0 ? 'default' : _q,
15286
- _r = _a.disableFaceDetectionWhileAudioCapture,
15287
- disableFaceDetectionWhileAudioCapture = _r === void 0 ? false : _r,
15288
- _s = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
15289
- disableFaceDetectionWhileAudioCaptureMsDelay = _s === void 0 ? 2000 : _s,
15290
- _t = _a.silentFallback,
15291
- silentFallback = _t === void 0 ? false : _t,
15292
- _u = _a.mergeAVStreams,
15293
- mergeAVStreams = _u === void 0 ? false : _u,
15294
- _v = _a.matchOnly,
15295
- matchOnly = _v === void 0 ? false : _v,
15296
- _w = _a.theme,
15297
- theme = _w === void 0 ? 'default' : _w,
15298
- _x = _a.assets,
15299
- assets = _x === void 0 ? {} : _x,
15300
- _y = _a.classNames,
15301
- classNames = _y === void 0 ? {} : _y,
15302
- _z = _a.colors,
15303
- colors = _z === void 0 ? {} : _z,
15304
- _0 = _a.verbiage,
15305
- verbiage = _0 === void 0 ? {} : _0,
15306
- _1 = _a.captureSignature,
15307
- captureSignature = _1 === void 0 ? false : _1,
15308
- _2 = _a.captureSignatureVideo,
15309
- captureSignatureVideo = _2 === void 0 ? false : _2,
15310
- _3 = _a.captureAdditionalDocuments,
15311
- captureAdditionalDocuments = _3 === void 0 ? [] : _3,
15312
- _4 = _a.geolocationEnabled,
15313
- geolocationEnabled = _4 === void 0 ? true : _4,
15314
- _5 = _a.geolocationRequired,
15315
- geolocationRequired = _5 === void 0 ? false : _5,
15316
- _6 = _a.debugMode,
15317
- debugMode = _6 === void 0 ? false : _6;
15330
+ _q = _a.idDocumentType,
15331
+ idDocumentType = _q === void 0 ? 'idCard' : _q,
15332
+ _r = _a.faceLivenessLoadingOverlayMode,
15333
+ faceLivenessLoadingOverlayMode = _r === void 0 ? 'default' : _r,
15334
+ _s = _a.disableFaceDetectionWhileAudioCapture,
15335
+ disableFaceDetectionWhileAudioCapture = _s === void 0 ? false : _s,
15336
+ _t = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
15337
+ disableFaceDetectionWhileAudioCaptureMsDelay = _t === void 0 ? 2000 : _t,
15338
+ _u = _a.silentFallback,
15339
+ silentFallback = _u === void 0 ? false : _u,
15340
+ _v = _a.mergeAVStreams,
15341
+ mergeAVStreams = _v === void 0 ? false : _v,
15342
+ _w = _a.matchOnly,
15343
+ matchOnly = _w === void 0 ? false : _w,
15344
+ _x = _a.theme,
15345
+ theme = _x === void 0 ? 'default' : _x,
15346
+ _y = _a.assets,
15347
+ assets = _y === void 0 ? {} : _y,
15348
+ _z = _a.classNames,
15349
+ classNames = _z === void 0 ? {} : _z,
15350
+ _0 = _a.colors,
15351
+ colors = _0 === void 0 ? {} : _0,
15352
+ _1 = _a.verbiage,
15353
+ verbiage = _1 === void 0 ? {} : _1,
15354
+ _2 = _a.captureSignature,
15355
+ captureSignature = _2 === void 0 ? false : _2,
15356
+ _3 = _a.captureSignatureVideo,
15357
+ captureSignatureVideo = _3 === void 0 ? false : _3,
15358
+ _4 = _a.captureAdditionalDocuments,
15359
+ captureAdditionalDocuments = _4 === void 0 ? [] : _4,
15360
+ _5 = _a.geolocationEnabled,
15361
+ geolocationEnabled = _5 === void 0 ? true : _5,
15362
+ _6 = _a.geolocationRequired,
15363
+ geolocationRequired = _6 === void 0 ? false : _6,
15364
+ _7 = _a.debugMode,
15365
+ debugMode = _7 === void 0 ? false : _7;
15318
15366
  useLanguage(lang);
15319
15367
  useDebugLogging(debugMode);
15320
15368
  var videoIdCaptureProps = React.useMemo(function () {
@@ -15335,6 +15383,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
15335
15383
  idCaptureLoadingOverlayMode: idCaptureLoadingOverlayMode,
15336
15384
  customOverlayContent: customOverlayContent,
15337
15385
  onLoadingOverlayDismissed: onLoadingOverlayDismissed,
15386
+ idDocumentType: idDocumentType,
15338
15387
  idCaptureGuideType: idCaptureGuideType,
15339
15388
  idCaptureGuideImages: idCaptureGuideImages,
15340
15389
  idCapturePortraitGuidesOnMobile: idCapturePortraitGuidesOnMobile,
@@ -15350,7 +15399,7 @@ var VideoIdValidation = function VideoIdValidation(_a) {
15350
15399
  verbiage: verbiage,
15351
15400
  debugMode: debugMode
15352
15401
  };
15353
- }, [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]);
15402
+ }, [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]);
15354
15403
  var additionalDocumentCaptureProps = React.useMemo(function () {
15355
15404
  return {
15356
15405
  documents: captureAdditionalDocuments,