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
@@ -211,7 +211,7 @@
211
211
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
212
212
  };
213
213
 
214
- var webSdkVersion = '2.2.50';
214
+ var webSdkVersion = '2.2.52';
215
215
 
216
216
  function getPlatform() {
217
217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -8344,18 +8344,21 @@
8344
8344
  _c = _a.modelLoadTimeoutMs,
8345
8345
  modelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
8346
8346
  onModelError = _a.onModelError,
8347
- videoRef = _a.videoRef;
8348
- var _d = React.useState(false),
8349
- ready = _d[0],
8350
- setReady = _d[1];
8351
- var _e = React.useState(0),
8352
- modelDownloadProgress = _e[0],
8353
- setModelDownloadProgress = _e[1];
8354
- var _f = React.useState(null),
8355
- modelError = _f[0],
8356
- setModelError = _f[1];
8347
+ videoRef = _a.videoRef,
8348
+ _d = _a.shouldLoadModels,
8349
+ shouldLoadModels = _d === void 0 ? true : _d;
8350
+ var _e = React.useState(false),
8351
+ ready = _e[0],
8352
+ setReady = _e[1];
8353
+ var _f = React.useState(0),
8354
+ modelDownloadProgress = _f[0],
8355
+ setModelDownloadProgress = _f[1];
8356
+ var _g = React.useState(null),
8357
+ modelError = _g[0],
8358
+ setModelError = _g[1];
8357
8359
  React.useEffect(function loadModel() {
8358
8360
  var _this = this;
8361
+ if (!shouldLoadModels) return;
8359
8362
  setReady(false);
8360
8363
  function handleDownloadProgress(event) {
8361
8364
  setModelDownloadProgress(progressToPercentage(event.detail));
@@ -8393,7 +8396,7 @@
8393
8396
  clearTimeout(modelLoadTimeout);
8394
8397
  document.removeEventListener('idmission.preloadProgress.focus', handleDownloadProgress);
8395
8398
  };
8396
- }, [modelPath, modelLoadTimeoutMs, videoRef]);
8399
+ }, [modelPath, modelLoadTimeoutMs, videoRef, shouldLoadModels]);
8397
8400
  React.useEffect(function handleModelError() {
8398
8401
  modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
8399
8402
  }, [modelError, onModelError]);
@@ -8976,25 +8979,28 @@
8976
8979
  detectorSettings = null;
8977
8980
  }
8978
8981
  function useLoadDocumentDetector(_a) {
8979
- var _b = _a.modelPath,
8980
- modelPath = _b === void 0 ? defaultDocumentDetectorModelPath : _b,
8981
- _c = _a.modelLoadTimeoutMs,
8982
- modelLoadTimeoutMs = _c === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _c,
8983
- _d = _a.scoreThreshold,
8984
- scoreThreshold = _d === void 0 ? defaultDocumentDetectionScoreThreshold : _d,
8982
+ var _b = _a.shouldLoadModels,
8983
+ shouldLoadModels = _b === void 0 ? true : _b,
8984
+ _c = _a.modelPath,
8985
+ modelPath = _c === void 0 ? defaultDocumentDetectorModelPath : _c,
8986
+ _d = _a.modelLoadTimeoutMs,
8987
+ modelLoadTimeoutMs = _d === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _d,
8988
+ _e = _a.scoreThreshold,
8989
+ scoreThreshold = _e === void 0 ? defaultDocumentDetectionScoreThreshold : _e,
8985
8990
  onModelError = _a.onModelError,
8986
8991
  videoRef = _a.videoRef;
8987
- var _e = React.useState(false),
8988
- ready = _e[0],
8989
- setReady = _e[1];
8990
- var _f = React.useState(0),
8991
- modelDownloadProgress = _f[0],
8992
- setModelDownloadProgress = _f[1];
8993
- var _g = React.useState(null),
8994
- modelError = _g[0],
8995
- setModelError = _g[1];
8992
+ var _f = React.useState(false),
8993
+ ready = _f[0],
8994
+ setReady = _f[1];
8995
+ var _g = React.useState(0),
8996
+ modelDownloadProgress = _g[0],
8997
+ setModelDownloadProgress = _g[1];
8998
+ var _h = React.useState(null),
8999
+ modelError = _h[0],
9000
+ setModelError = _h[1];
8996
9001
  React.useEffect(function loadModel() {
8997
9002
  var _this = this;
9003
+ if (!shouldLoadModels) return;
8998
9004
  setReady(false);
8999
9005
  function handleDownloadProgress(event) {
9000
9006
  setModelDownloadProgress(progressToPercentage(event.detail));
@@ -9032,7 +9038,7 @@
9032
9038
  clearTimeout(modelLoadTimeout);
9033
9039
  document.removeEventListener('idmission.preloadProgress.documentDetection', handleDownloadProgress);
9034
9040
  };
9035
- }, [modelLoadTimeoutMs, modelPath, scoreThreshold, videoRef]);
9041
+ }, [shouldLoadModels, modelLoadTimeoutMs, modelPath, scoreThreshold, videoRef]);
9036
9042
  React.useEffect(function handleModelError() {
9037
9043
  modelError && (onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError));
9038
9044
  }, [modelError, onModelError]);
@@ -9889,38 +9895,41 @@
9889
9895
  documentDetectionModelScoreThreshold = _f === void 0 ? defaultDocumentDetectionScoreThreshold : _f,
9890
9896
  _g = _a.documentDetectionModelLoadTimeoutMs,
9891
9897
  documentDetectionModelLoadTimeoutMs = _g === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _g,
9892
- onDocumentDetectionModelError = _a.onDocumentDetectionModelError;
9893
- var _h = useCameraStore(),
9894
- videoRef = _h.videoRef,
9895
- videoLoaded = _h.videoLoaded,
9896
- cameraReady = _h.cameraReady;
9898
+ onDocumentDetectionModelError = _a.onDocumentDetectionModelError,
9899
+ _h = _a.shouldLoadModels,
9900
+ shouldLoadModels = _h === void 0 ? true : _h;
9901
+ var _j = useCameraStore(),
9902
+ videoRef = _j.videoRef,
9903
+ videoLoaded = _j.videoLoaded,
9904
+ cameraReady = _j.cameraReady;
9897
9905
  var lastPredictionCanvas = React.useRef(null);
9898
9906
  var onPredictionHandler = React.useRef();
9899
- var _j = React.useState({}),
9900
- documentDetectionThresholds = _j[0],
9901
- setDocumentDetectionThresholds = _j[1];
9902
- var _k = React.useState(defaultDocumentDetectionBoundaries),
9903
- documentDetectionBoundaries = _k[0],
9904
- setDocumentDetectionBoundaries = _k[1];
9905
- var _l = React.useState(0),
9906
- timesAllZero = _l[0],
9907
- setTimesAllZero = _l[1];
9907
+ var _k = React.useState({}),
9908
+ documentDetectionThresholds = _k[0],
9909
+ setDocumentDetectionThresholds = _k[1];
9910
+ var _l = React.useState(defaultDocumentDetectionBoundaries),
9911
+ documentDetectionBoundaries = _l[0],
9912
+ setDocumentDetectionBoundaries = _l[1];
9908
9913
  var _m = React.useState(0),
9909
- canvasKey = _m[0],
9910
- setCanvasKey = _m[1];
9914
+ timesAllZero = _m[0],
9915
+ setTimesAllZero = _m[1];
9916
+ var _o = React.useState(0),
9917
+ canvasKey = _o[0],
9918
+ setCanvasKey = _o[1];
9911
9919
  var stopDetection = React.useRef(0);
9912
- var _o = useLoadDocumentDetector({
9920
+ var _p = useLoadDocumentDetector({
9913
9921
  modelPath: documentDetectionModelPath,
9914
9922
  modelLoadTimeoutMs: documentDetectionModelLoadTimeoutMs,
9915
9923
  scoreThreshold: documentDetectionModelScoreThreshold,
9916
9924
  onModelError: onDocumentDetectionModelError,
9917
- videoRef: videoRef
9925
+ videoRef: videoRef,
9926
+ shouldLoadModels: shouldLoadModels
9918
9927
  }),
9919
- ready = _o.ready,
9920
- modelDownloadProgress = _o.modelDownloadProgress,
9921
- modelError = _o.modelError,
9922
- setModelError = _o.setModelError;
9923
- var _p = useFrameLoop(React.useCallback(function (frameId, timeRunning) {
9928
+ ready = _p.ready,
9929
+ modelDownloadProgress = _p.modelDownloadProgress,
9930
+ modelError = _p.modelError,
9931
+ setModelError = _p.setModelError;
9932
+ var _q = useFrameLoop(React.useCallback(function (frameId, timeRunning) {
9924
9933
  return __awaiter(_this, void 0, void 0, function () {
9925
9934
  var stopDetectionAtStart, vw, vh, ctx, prediction, processedPrediction;
9926
9935
  var _a;
@@ -9963,8 +9972,8 @@
9963
9972
  throttleMs: throttleMs,
9964
9973
  autoStart: autoStart
9965
9974
  }),
9966
- start = _p.start,
9967
- stop = _p.stop;
9975
+ start = _q.start,
9976
+ stop = _q.stop;
9968
9977
  React.useEffect(function setErrorIfAllZero() {
9969
9978
  if (timesAllZero >= 2) {
9970
9979
  setModelError(new Error('model is returning all zeroes'));
@@ -10025,22 +10034,25 @@
10025
10034
  focusModelLoadTimeoutMs = _c === void 0 ? defaultFocusModelLoadTimeoutMs : _c,
10026
10035
  onFocusModelError = _a.onFocusModelError,
10027
10036
  _d = _a.showCanvases,
10028
- showCanvases = _d === void 0 ? false : _d;
10037
+ showCanvases = _d === void 0 ? false : _d,
10038
+ _e = _a.shouldLoadModels,
10039
+ shouldLoadModels = _e === void 0 ? true : _e;
10029
10040
  var cropCanvas = React.useRef(null);
10030
10041
  var rotateCanvas = React.useRef(null);
10031
- var _e = React.useState({}),
10032
- focusThresholds = _e[0],
10033
- setFocusThresholds = _e[1];
10042
+ var _f = React.useState({}),
10043
+ focusThresholds = _f[0],
10044
+ setFocusThresholds = _f[1];
10034
10045
  var videoRef = useCameraStore().videoRef;
10035
- var _f = useLoadFocusModel({
10046
+ var _g = useLoadFocusModel({
10036
10047
  modelPath: focusModelPath,
10037
10048
  modelLoadTimeoutMs: focusModelLoadTimeoutMs,
10038
10049
  onModelError: onFocusModelError,
10039
- videoRef: videoRef
10050
+ videoRef: videoRef,
10051
+ shouldLoadModels: shouldLoadModels
10040
10052
  }),
10041
- ready = _f.ready,
10042
- modelDownloadProgress = _f.modelDownloadProgress,
10043
- modelError = _f.modelError;
10053
+ ready = _g.ready,
10054
+ modelDownloadProgress = _g.modelDownloadProgress,
10055
+ modelError = _g.modelError;
10044
10056
  var makeFocusPrediction = React.useCallback(function (imageData, box) {
10045
10057
  if (!ready) return null;
10046
10058
  var prediction = makeFocusModelPrediction(imageData, cropCanvas.current, rotateCanvas.current, box);
@@ -11083,6 +11095,7 @@
11083
11095
  'Performing facial recognition, please hold still...': 'Realizando el reconocimiento facial, por favor no te muevas',
11084
11096
  'Display the front of your ID card...': 'Hay que mostrar el frente de la identificación...',
11085
11097
  'Display the back of your ID card...': 'Hay que mostrar el reverso de la identificación...',
11098
+ 'Display the ID page of your passport...': 'Hay que mostrar el página de datos del pasaporte...',
11086
11099
  'Please move your face to the center...': 'Por favor, hay que mover la cabeza hacia el centro...',
11087
11100
  'Searching for ID card...': 'Localizando la identificación...',
11088
11101
  'Please read the following text aloud': 'Hay que leer el siguiente texto en voz alta',
@@ -21546,7 +21559,7 @@
21546
21559
  idCardGuideBorderWidth = _a.idCardGuideBorderWidth,
21547
21560
  idCardGuideBorderColor = _a.idCardGuideBorderColor,
21548
21561
  idCardCaptureProgress = _a.idCardCaptureProgress,
21549
- _3 = _a.idCardCaptureGuideImages,
21562
+ _3 = _a.idCaptureGuideImages,
21550
21563
  userSuppliedImages = _3 === void 0 ? defaultIdCaptureGuideImages : _3,
21551
21564
  _4 = _a.classNames,
21552
21565
  classNames = _4 === void 0 ? {} : _4,
@@ -21558,10 +21571,11 @@
21558
21571
  var verbiage = useTranslations(rawVerbiage, {
21559
21572
  idFrontInstructionText: 'Display the front of your ID card...',
21560
21573
  idBackInstructionText: 'Display the back of your ID card...',
21574
+ passportInstructionText: 'Display the ID page of your passport...',
21561
21575
  flipIdInstructionText: 'Please flip your ID card...',
21562
21576
  verifyLivenessInstructionText: 'Performing facial recognition, please hold still...'
21563
21577
  });
21564
- var instructionText = requestedAction === 'VERIFY_LIVENESS' ? verbiage.verifyLivenessInstructionText : requestedAction === 'SHOW_ID_FRONT' ? verbiage.idFrontInstructionText : requestedAction === 'FLIP_ID' ? verbiage.flipIdInstructionText : verbiage.idBackInstructionText;
21578
+ 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;
21565
21579
  var theme = styled.useTheme();
21566
21580
  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;
21567
21581
  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';
@@ -21626,7 +21640,7 @@
21626
21640
  className: classNames.idCardGuideImage,
21627
21641
  "$isMirrored": !isRearFacing,
21628
21642
  style: idCardImageStyle,
21629
- src: requestedAction === 'SHOW_ID_BACK' ? idCaptureGuideImages.landscape.SHOW_ID_BACK.url : idCaptureGuideImages.landscape.SHOW_ID_FRONT.url,
21643
+ 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,
21630
21644
  onLoad: onImageLoaded
21631
21645
  })), requestedAction === 'FLIP_ID' && ( /*#__PURE__*/React.createElement(IdVideoCaptureFlipIdPrompt, {
21632
21646
  idCaptureGuideImages: idCaptureGuideImages,
@@ -21761,7 +21775,7 @@
21761
21775
  detection: {
21762
21776
  idCardFront: 0.4,
21763
21777
  idCardBack: 0.5,
21764
- passport: 1
21778
+ passport: 0.3
21765
21779
  },
21766
21780
  focus: {
21767
21781
  idCardFront: {
@@ -21779,7 +21793,8 @@
21779
21793
  },
21780
21794
  goodFrames: {
21781
21795
  idCardFront: 1,
21782
- idCardBack: 1
21796
+ idCardBack: 1,
21797
+ passport: 1
21783
21798
  },
21784
21799
  flipShortcutThreshold: 0.7
21785
21800
  };
@@ -21793,91 +21808,93 @@
21793
21808
  onExitCapture = _a.onExitCapture,
21794
21809
  _w = _a.idCaptureModelsEnabled,
21795
21810
  idCaptureModelsEnabled = _w === void 0 ? true : _w,
21796
- _x = _a.idCardCaptureGuideImages,
21797
- idCardCaptureGuideImages = _x === void 0 ? defaultIdCaptureGuideImages : _x,
21798
- _y = _a.idCardFrontDelay,
21799
- idCardFrontDelay = _y === void 0 ? 1000 : _y,
21800
- _z = _a.videoIdCaptureThresholds,
21801
- videoIdCaptureThresholds = _z === void 0 ? defaultVideoIdCaptureThresholds : _z,
21802
- _0 = _a.skipShowIdCardBack,
21803
- skipShowIdCardBack = _0 === void 0 ? false : _0,
21804
- _1 = _a.captureCountdownSeconds,
21805
- captureCountdownSeconds = _1 === void 0 ? 3 : _1,
21811
+ _x = _a.idDocumentType,
21812
+ idDocumentType = _x === void 0 ? 'idCard' : _x,
21813
+ _y = _a.idCaptureGuideImages,
21814
+ idCaptureGuideImages = _y === void 0 ? defaultIdCaptureGuideImages : _y,
21815
+ _z = _a.idCardFrontDelay,
21816
+ idCardFrontDelay = _z === void 0 ? 1000 : _z,
21817
+ _0 = _a.videoIdCaptureThresholds,
21818
+ videoIdCaptureThresholds = _0 === void 0 ? defaultVideoIdCaptureThresholds : _0,
21819
+ _1 = _a.skipShowIdCardBack,
21820
+ skipShowIdCardBack = _1 === void 0 ? false : _1,
21821
+ _2 = _a.captureCountdownSeconds,
21822
+ captureCountdownSeconds = _2 === void 0 ? 3 : _2,
21806
21823
  readTextPrompt = _a.readTextPrompt,
21807
- _2 = _a.readTextTimeoutDurationMs,
21808
- readTextTimeoutDurationMs = _2 === void 0 ? 15000 : _2,
21809
- _3 = _a.readTextMinReadingMs,
21810
- readTextMinReadingMs = _3 === void 0 ? 10000 : _3,
21811
- _4 = _a.disableFaceDetectionWhileAudioCapture,
21812
- disableFaceDetectionWhileAudioCapture = _4 === void 0 ? false : _4,
21813
- _5 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
21814
- disableFaceDetectionWhileAudioCaptureMsDelay = _5 === void 0 ? 2000 : _5,
21815
- _6 = _a.mergeAVStreams,
21816
- mergeAVStreams = _6 === void 0 ? false : _6,
21817
- _7 = _a.classNames,
21818
- classNames = _7 === void 0 ? {} : _7,
21819
- _8 = _a.colors,
21820
- colors = _8 === void 0 ? {} : _8,
21821
- _9 = _a.verbiage,
21822
- rawVerbiage = _9 === void 0 ? {} : _9,
21823
- _10 = _a.debugMode,
21824
- debugMode = _10 === void 0 ? false : _10;
21825
- var _11 = useResizeObserver(),
21826
- ref = _11.ref,
21827
- _12 = _11.width,
21828
- width = _12 === void 0 ? 1 : _12,
21829
- _13 = _11.height,
21830
- height = _13 === void 0 ? 1 : _13;
21831
- var _14 = useCameraStore(),
21832
- camera = _14.camera,
21833
- videoRef = _14.videoRef,
21834
- videoLoaded = _14.videoLoaded,
21835
- cameraReady = _14.cameraReady,
21836
- microphoneReady = _14.microphoneReady,
21837
- audioStream = _14.audioStream,
21838
- isRearFacing = _14.isRearFacing,
21839
- releaseCameraAccess = _14.releaseCameraAccess;
21840
- var _15 = React.useState([]),
21841
- detectedObjects = _15[0],
21842
- setDetectedObjects = _15[1];
21843
- var _16 = React.useState(null),
21844
- face = _16[0],
21845
- setFace = _16[1];
21846
- var _17 = React.useContext(IdCaptureModelsContext),
21847
- idModelsReady = _17.ready,
21848
- startIdModels = _17.start,
21849
- stopIdModels = _17.stop,
21850
- onIdPredictionMade = _17.onPredictionMade,
21851
- setThresholds = _17.setThresholds,
21852
- setDocumentDetectionBoundaries = _17.setDocumentDetectionBoundaries,
21853
- bestFrameDetails = _17.bestFrameDetails,
21854
- resetBestFrame = _17.resetBestFrame,
21855
- idModelError = _17.modelError;
21856
- var _18 = React.useState(null),
21857
- videoStartsAt = _18[0],
21858
- setVideoStartsAt = _18[1];
21859
- var _19 = React.useContext(SubmissionContext),
21860
- setIdCaptureVideoAudioStartsAt = _19.setIdCaptureVideoAudioStartsAt,
21861
- setExpectedAudioText = _19.setExpectedAudioText;
21862
- var _20 = React.useContext(SelfieGuidanceModelsContext),
21863
- startSelfieGuidance = _20.start,
21864
- stopSelfieGuidance = _20.stop,
21865
- onSelfiePredictionMade = _20.onPredictionMade,
21866
- selfieModelError = _20.error;
21867
- var _21 = useVideoRecorder(camera, audioStream, mergeAVStreams),
21868
- isRecordingVideo = _21.isRecordingVideo,
21869
- startRecordingVideo = _21.startRecordingVideo,
21870
- startRecordingAudio = _21.startRecordingAudio,
21871
- stopRecordingVideo = _21.stopRecordingVideo,
21872
- stopRecordingAudio = _21.stopRecordingAudio,
21873
- videoRecordingUnintentionallyStopped = _21.videoRecordingUnintentionallyStopped,
21874
- audioRecordingUnintentionallyStopped = _21.audioRecordingUnintentionallyStopped,
21875
- videoUrl = _21.videoUrl,
21876
- audioUrl = _21.audioUrl;
21824
+ _3 = _a.readTextTimeoutDurationMs,
21825
+ readTextTimeoutDurationMs = _3 === void 0 ? 15000 : _3,
21826
+ _4 = _a.readTextMinReadingMs,
21827
+ readTextMinReadingMs = _4 === void 0 ? 10000 : _4,
21828
+ _5 = _a.disableFaceDetectionWhileAudioCapture,
21829
+ disableFaceDetectionWhileAudioCapture = _5 === void 0 ? false : _5,
21830
+ _6 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
21831
+ disableFaceDetectionWhileAudioCaptureMsDelay = _6 === void 0 ? 2000 : _6,
21832
+ _7 = _a.mergeAVStreams,
21833
+ mergeAVStreams = _7 === void 0 ? false : _7,
21834
+ _8 = _a.classNames,
21835
+ classNames = _8 === void 0 ? {} : _8,
21836
+ _9 = _a.colors,
21837
+ colors = _9 === void 0 ? {} : _9,
21838
+ _10 = _a.verbiage,
21839
+ rawVerbiage = _10 === void 0 ? {} : _10,
21840
+ _11 = _a.debugMode,
21841
+ debugMode = _11 === void 0 ? false : _11;
21842
+ var _12 = useResizeObserver(),
21843
+ ref = _12.ref,
21844
+ _13 = _12.width,
21845
+ width = _13 === void 0 ? 1 : _13,
21846
+ _14 = _12.height,
21847
+ height = _14 === void 0 ? 1 : _14;
21848
+ var _15 = useCameraStore(),
21849
+ camera = _15.camera,
21850
+ videoRef = _15.videoRef,
21851
+ videoLoaded = _15.videoLoaded,
21852
+ cameraReady = _15.cameraReady,
21853
+ microphoneReady = _15.microphoneReady,
21854
+ audioStream = _15.audioStream,
21855
+ isRearFacing = _15.isRearFacing,
21856
+ releaseCameraAccess = _15.releaseCameraAccess;
21857
+ var _16 = React.useState([]),
21858
+ detectedObjects = _16[0],
21859
+ setDetectedObjects = _16[1];
21860
+ var _17 = React.useState(null),
21861
+ face = _17[0],
21862
+ setFace = _17[1];
21863
+ var _18 = React.useContext(IdCaptureModelsContext),
21864
+ idModelsReady = _18.ready,
21865
+ startIdModels = _18.start,
21866
+ stopIdModels = _18.stop,
21867
+ onIdPredictionMade = _18.onPredictionMade,
21868
+ setThresholds = _18.setThresholds,
21869
+ setDocumentDetectionBoundaries = _18.setDocumentDetectionBoundaries,
21870
+ bestFrameDetails = _18.bestFrameDetails,
21871
+ resetBestFrame = _18.resetBestFrame,
21872
+ idModelError = _18.modelError;
21873
+ var _19 = React.useState(null),
21874
+ videoStartsAt = _19[0],
21875
+ setVideoStartsAt = _19[1];
21876
+ var _20 = React.useContext(SubmissionContext),
21877
+ setIdCaptureVideoAudioStartsAt = _20.setIdCaptureVideoAudioStartsAt,
21878
+ setExpectedAudioText = _20.setExpectedAudioText;
21879
+ var _21 = React.useContext(SelfieGuidanceModelsContext),
21880
+ startSelfieGuidance = _21.start,
21881
+ stopSelfieGuidance = _21.stop,
21882
+ onSelfiePredictionMade = _21.onPredictionMade,
21883
+ selfieModelError = _21.error;
21884
+ var _22 = useVideoRecorder(camera, audioStream, mergeAVStreams),
21885
+ isRecordingVideo = _22.isRecordingVideo,
21886
+ startRecordingVideo = _22.startRecordingVideo,
21887
+ startRecordingAudio = _22.startRecordingAudio,
21888
+ stopRecordingVideo = _22.stopRecordingVideo,
21889
+ stopRecordingAudio = _22.stopRecordingAudio,
21890
+ videoRecordingUnintentionallyStopped = _22.videoRecordingUnintentionallyStopped,
21891
+ audioRecordingUnintentionallyStopped = _22.audioRecordingUnintentionallyStopped,
21892
+ videoUrl = _22.videoUrl,
21893
+ audioUrl = _22.audioUrl;
21877
21894
  var countdownTimeoutRef = React.useRef(undefined);
21878
- var _22 = React.useState(-1),
21879
- countdownRemaining = _22[0],
21880
- setCountdownRemaining = _22[1];
21895
+ var _23 = React.useState(-1),
21896
+ countdownRemaining = _23[0],
21897
+ setCountdownRemaining = _23[1];
21881
21898
  React.useEffect(function () {
21882
21899
  if (!isRecordingVideo && !videoUrl) {
21883
21900
  startRecordingVideo();
@@ -21897,9 +21914,9 @@
21897
21914
  onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
21898
21915
  }
21899
21916
  }, [audioRecordingUnintentionallyStopped, microphoneReady, onRecordingFailed, readTextPrompt, videoRecordingUnintentionallyStopped]);
21900
- var _23 = React.useState('SHOW_ID_FRONT'),
21901
- requestedAction = _23[0],
21902
- setRequestedAction = _23[1];
21917
+ var _24 = React.useState(idDocumentType === 'idCard' ? 'SHOW_ID_FRONT' : 'SHOW_PASSPORT'),
21918
+ requestedAction = _24[0],
21919
+ setRequestedAction = _24[1];
21903
21920
  var shouldRunIdModels = idCaptureModelsEnabled && videoLoaded && cameraReady && idModelsReady && !idModelError && requestedAction !== 'READ_TEXT' && (!readTextPrompt || microphoneReady);
21904
21921
  React.useEffect(function startModelsWhenCapturing() {
21905
21922
  if (!shouldRunIdModels) return;
@@ -21908,9 +21925,25 @@
21908
21925
  return stopIdModels();
21909
21926
  };
21910
21927
  }, [shouldRunIdModels, startIdModels, stopIdModels]);
21928
+ var adjustedThresholds = React.useMemo(function () {
21929
+ if (idDocumentType === 'idCard') {
21930
+ return _assign(_assign({}, videoIdCaptureThresholds), {
21931
+ detection: _assign(_assign({}, videoIdCaptureThresholds.detection), {
21932
+ passport: 1
21933
+ })
21934
+ });
21935
+ } else {
21936
+ return _assign(_assign({}, videoIdCaptureThresholds), {
21937
+ detection: _assign(_assign({}, videoIdCaptureThresholds.detection), {
21938
+ idCardFront: 1,
21939
+ idCardBack: 1
21940
+ })
21941
+ });
21942
+ }
21943
+ }, [idDocumentType, videoIdCaptureThresholds]);
21911
21944
  React.useEffect(function () {
21912
- setThresholds(videoIdCaptureThresholds);
21913
- }, [requestedAction, setThresholds, videoIdCaptureThresholds]);
21945
+ setThresholds(adjustedThresholds);
21946
+ }, [requestedAction, setThresholds, adjustedThresholds]);
21914
21947
  React.useEffect(function () {
21915
21948
  setDocumentDetectionBoundaries({
21916
21949
  top: 20,
@@ -21919,19 +21952,19 @@
21919
21952
  bottom: 0
21920
21953
  });
21921
21954
  }, [setDocumentDetectionBoundaries]);
21922
- var _24 = React.useState(0),
21923
- currentDetectionScore = _24[0],
21924
- setCurrentDetectionScore = _24[1];
21925
- var _25 = React.useState('none'),
21926
- currentDetectedDocumentType = _25[0],
21927
- setCurrentDetectedDocumentType = _25[1];
21928
- var _26 = React.useState(0),
21929
- currentFocusScore = _26[0],
21930
- setCurrentFocusScore = _26[1];
21955
+ var _25 = React.useState(0),
21956
+ currentDetectionScore = _25[0],
21957
+ setCurrentDetectionScore = _25[1];
21958
+ var _26 = React.useState('none'),
21959
+ currentDetectedDocumentType = _26[0],
21960
+ setCurrentDetectedDocumentType = _26[1];
21931
21961
  var _27 = React.useState(0),
21932
- goodFramesCount = _27[0],
21933
- setGoodFramesCount = _27[1];
21934
- var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? videoIdCaptureThresholds.goodFrames.idCardFront : videoIdCaptureThresholds.goodFrames.idCardBack;
21962
+ currentFocusScore = _27[0],
21963
+ setCurrentFocusScore = _27[1];
21964
+ var _28 = React.useState(0),
21965
+ goodFramesCount = _28[0],
21966
+ setGoodFramesCount = _28[1];
21967
+ var goodFramesThreshold = requestedAction === 'SHOW_PASSPORT' ? adjustedThresholds.goodFrames.passport : requestedAction === 'SHOW_ID_FRONT' ? adjustedThresholds.goodFrames.idCardFront : adjustedThresholds.goodFrames.idCardBack;
21935
21968
  var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
21936
21969
  React.useEffect(function () {
21937
21970
  if (!idCaptureModelsEnabled || idModelError) return;
@@ -21940,9 +21973,9 @@
21940
21973
  setCurrentDetectionScore(prediction.detectionScore);
21941
21974
  setCurrentDetectedDocumentType(prediction.detectedDocumentType);
21942
21975
  setCurrentFocusScore(prediction.focusScore);
21943
- var detectionThresholdMet = requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
21976
+ var detectionThresholdMet = requestedAction === 'SHOW_PASSPORT' ? prediction.passportDetectionThresholdMet : requestedAction === 'SHOW_ID_FRONT' ? prediction.idCardFrontDetectionThresholdMet : prediction.idCardBackDetectionThresholdMet;
21944
21977
  var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
21945
- var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= videoIdCaptureThresholds.flipShortcutThreshold;
21978
+ var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= adjustedThresholds.flipShortcutThreshold;
21946
21979
  if (shouldShortcutFlipAnimation) {
21947
21980
  return setRequestedAction('SHOW_ID_BACK');
21948
21981
  }
@@ -21950,16 +21983,16 @@
21950
21983
  return n + 1;
21951
21984
  } : 0);
21952
21985
  });
21953
- }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, videoIdCaptureThresholds.flipShortcutThreshold]);
21954
- var _28 = React.useState(null),
21955
- idFrontCaptureStartedAt = _28[0],
21956
- setFirstGoodFrameTime = _28[1];
21986
+ }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, adjustedThresholds.flipShortcutThreshold]);
21987
+ var _29 = React.useState(null),
21988
+ idFrontCaptureStartedAt = _29[0],
21989
+ setFirstGoodFrameTime = _29[1];
21957
21990
  React.useEffect(function () {
21958
21991
  if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
21959
21992
  }, [goodFramesCount]);
21960
- var delaySatisfied = requestedAction !== 'SHOW_ID_FRONT' || idFrontCaptureStartedAt !== null && new Date().getTime() > idFrontCaptureStartedAt + idCardFrontDelay;
21993
+ var delaySatisfied = !['SHOW_ID_FRONT', 'SHOW_PASSPORT'].includes(requestedAction) || idFrontCaptureStartedAt !== null && new Date().getTime() > idFrontCaptureStartedAt + idCardFrontDelay;
21961
21994
  var translatedText = useVerbiage(readTextPrompt, '');
21962
- var onIdBackCaptureComplete = React.useCallback(function () {
21995
+ var onIdCaptureComplete = React.useCallback(function () {
21963
21996
  var _a;
21964
21997
  if (translatedText) {
21965
21998
  setRequestedAction('READ_TEXT');
@@ -21974,16 +22007,16 @@
21974
22007
  var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
21975
22008
  var faceBox = face === null || face === void 0 ? void 0 : face.box;
21976
22009
  var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
21977
- var _29 = React.useState(),
21978
- countdownStartedAt = _29[0],
21979
- setCountdownStartedAt = _29[1];
22010
+ var _30 = React.useState(),
22011
+ countdownStartedAt = _30[0],
22012
+ setCountdownStartedAt = _30[1];
21980
22013
  var photoCanvas = React.useRef(null);
21981
22014
  var frameLock = React.useRef(false);
21982
22015
  var captureFrame = React.useCallback(function () {
21983
22016
  return __awaiter(void 0, void 0, void 0, function () {
21984
- var frameBase64;
21985
- return __generator(this, function (_a) {
21986
- switch (_a.label) {
22017
+ var frameBase64, _a;
22018
+ return __generator(this, function (_b) {
22019
+ switch (_b.label) {
21987
22020
  case 0:
21988
22021
  if (frameLock.current) return [2 /*return*/];
21989
22022
  frameLock.current = true;
@@ -21993,23 +22026,25 @@
21993
22026
  frameLock.current = false;
21994
22027
  return [2 /*return*/];
21995
22028
  }
21996
- _a.label = 1;
22029
+ _b.label = 1;
21997
22030
  case 1:
21998
- _a.trys.push([1,, 7, 8]);
22031
+ _b.trys.push([1,, 7, 8]);
21999
22032
  if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 5];
22000
22033
  if (onIdFrontImageCaptured) {
22001
22034
  onIdFrontImageCaptured(frameBase64);
22002
22035
  }
22003
22036
  if (!skipShowIdCardBack) return [3 /*break*/, 4];
22004
- if (!(skipShowIdCardBack === true)) return [3 /*break*/, 2];
22005
- return [2 /*return*/, onIdBackCaptureComplete()];
22006
- case 2:
22037
+ _a = skipShowIdCardBack === true;
22038
+ if (_a) return [3 /*break*/, 3];
22007
22039
  return [4 /*yield*/, skipShowIdCardBack()];
22040
+ case 2:
22041
+ _a = _b.sent();
22042
+ _b.label = 3;
22008
22043
  case 3:
22009
- if (_a.sent()) {
22010
- return [2 /*return*/, onIdBackCaptureComplete()];
22044
+ if (_a) {
22045
+ return [2 /*return*/, onIdCaptureComplete()];
22011
22046
  }
22012
- _a.label = 4;
22047
+ _b.label = 4;
22013
22048
  case 4:
22014
22049
  setRequestedAction('FLIP_ID');
22015
22050
  return [3 /*break*/, 6];
@@ -22018,9 +22053,14 @@
22018
22053
  if (onIdBackImageCaptured) {
22019
22054
  onIdBackImageCaptured(frameBase64);
22020
22055
  }
22021
- onIdBackCaptureComplete();
22056
+ onIdCaptureComplete();
22057
+ } else if (requestedAction == 'SHOW_PASSPORT') {
22058
+ if (onIdFrontImageCaptured) {
22059
+ onIdFrontImageCaptured(frameBase64);
22060
+ }
22061
+ onIdCaptureComplete();
22022
22062
  }
22023
- _a.label = 6;
22063
+ _b.label = 6;
22024
22064
  case 6:
22025
22065
  return [3 /*break*/, 8];
22026
22066
  case 7:
@@ -22040,7 +22080,7 @@
22040
22080
  }
22041
22081
  });
22042
22082
  });
22043
- }, [onIdBackCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
22083
+ }, [onIdCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
22044
22084
  var isFlipping = requestedAction === 'FLIP_ID';
22045
22085
  React.useEffect(function () {
22046
22086
  if (!isFlipping) return;
@@ -22099,9 +22139,9 @@
22099
22139
  stopSelfieGuidance();
22100
22140
  };
22101
22141
  }, [startSelfieGuidance, stopSelfieGuidance]);
22102
- var _30 = React.useState(0),
22103
- numFramesWithoutFaces = _30[0],
22104
- setNumFramesWithoutFaces = _30[1];
22142
+ var _31 = React.useState(0),
22143
+ numFramesWithoutFaces = _31[0],
22144
+ setNumFramesWithoutFaces = _31[1];
22105
22145
  onSelfiePredictionMade(f(React.useCallback(function (_a) {
22106
22146
  var face = _a.face;
22107
22147
  if (selfieModelError) return;
@@ -22117,12 +22157,12 @@
22117
22157
  }
22118
22158
  }, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
22119
22159
  var theme = styled.useTheme();
22120
- var _31 = useTranslations(rawVerbiage, {
22160
+ var _32 = useTranslations(rawVerbiage, {
22121
22161
  faceNotCenteredText: 'Please move your face to the center...',
22122
22162
  captureBtnText: 'Capture'
22123
22163
  }),
22124
- captureBtnText = _31.captureBtnText,
22125
- faceNotCenteredText = _31.faceNotCenteredText;
22164
+ captureBtnText = _32.captureBtnText,
22165
+ faceNotCenteredText = _32.faceNotCenteredText;
22126
22166
  var debugScalingDetails = useDebugScalingDetails({
22127
22167
  enabled: debugMode,
22128
22168
  pageWidth: width,
@@ -22130,7 +22170,7 @@
22130
22170
  videoWidth: (_g = (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.videoWidth) !== null && _g !== void 0 ? _g : 0,
22131
22171
  videoHeight: (_j = (_h = videoRef.current) === null || _h === void 0 ? void 0 : _h.videoHeight) !== null && _j !== void 0 ? _j : 0
22132
22172
  });
22133
- var capturingId = ['SHOW_ID_FRONT', 'SHOW_ID_BACK'].includes(requestedAction);
22173
+ var capturingId = ['SHOW_ID_FRONT', 'SHOW_ID_BACK', 'SHOW_PASSPORT'].includes(requestedAction);
22134
22174
  var guidanceText = !faceCentered ? faceNotCenteredText : undefined;
22135
22175
  return /*#__PURE__*/React.createElement(PageContainer, {
22136
22176
  ref: ref,
@@ -22151,8 +22191,8 @@
22151
22191
  requestedAction: requestedAction,
22152
22192
  satisfied: satisfied,
22153
22193
  idCardGuideStatus: countdownStartedAt ? 'capturing' : 'ready',
22154
- idCardCaptureProgress: !!countdownStartedAt ? 1 : 0,
22155
- idCardCaptureGuideImages: idCardCaptureGuideImages,
22194
+ idCardCaptureProgress: countdownStartedAt ? 1 : 0,
22195
+ idCaptureGuideImages: idCaptureGuideImages,
22156
22196
  faceGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor,
22157
22197
  idCardGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor
22158
22198
  }), debugMode && capturingId && ( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ObjectDetectionDebugOverlayDiv, {
@@ -22347,49 +22387,51 @@
22347
22387
  idCaptureLoadingOverlayMode = _t === void 0 ? 'default' : _t,
22348
22388
  customOverlayContent = _a.customOverlayContent,
22349
22389
  onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
22350
- _u = _a.idCaptureGuideType,
22351
- idCaptureGuideType = _u === void 0 ? 'fit' : _u,
22352
- _v = _a.idCaptureGuideImages,
22353
- idCaptureGuideImages = _v === void 0 ? defaultIdCaptureGuideImages : _v,
22354
- _w = _a.idCapturePortraitGuidesOnMobile,
22355
- idCapturePortraitGuidesOnMobile = _w === void 0 ? true : _w,
22356
- _x = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
22357
- idCaptureRotateLoadingOverlayImageWhenPortrait = _x === void 0 ? true : _x,
22358
- _y = _a.idCaptureModelLoadTimeoutMs,
22359
- idCaptureModelLoadTimeoutMs = _y === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _y,
22360
- _z = _a.faceLivenessLoadingOverlayMode,
22361
- faceLivenessLoadingOverlayMode = _z === void 0 ? 'default' : _z,
22362
- _0 = _a.disableFaceDetectionWhileAudioCapture,
22363
- disableFaceDetectionWhileAudioCapture = _0 === void 0 ? true : _0,
22364
- _1 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
22365
- disableFaceDetectionWhileAudioCaptureMsDelay = _1 === void 0 ? 2000 : _1,
22366
- _2 = _a.silentFallback,
22367
- silentFallback = _2 === void 0 ? false : _2,
22368
- _3 = _a.mergeAVStreams,
22369
- mergeAVStreams = _3 === void 0 ? false : _3,
22370
- _4 = _a.assets,
22371
- assets = _4 === void 0 ? {} : _4,
22372
- _5 = _a.classNames,
22373
- classNames = _5 === void 0 ? {} : _5,
22374
- _6 = _a.colors,
22375
- colors = _6 === void 0 ? {} : _6,
22376
- _7 = _a.verbiage,
22377
- verbiage = _7 === void 0 ? {} : _7,
22378
- _8 = _a.debugMode,
22379
- debugMode = _8 === void 0 ? false : _8;
22380
- var _9 = React.useContext(SubmissionContext),
22381
- submissionStatus = _9.submissionStatus,
22382
- idCaptureVideoUrl = _9.idCaptureVideoUrl,
22383
- idCaptureVideoAudioUrl = _9.idCaptureVideoAudioUrl,
22384
- idCaptureVideoIdFrontImage = _9.idCaptureVideoIdFrontImage,
22385
- idCaptureVideoIdBackImage = _9.idCaptureVideoIdBackImage,
22386
- setIdCaptureVideoUrl = _9.setIdCaptureVideoUrl,
22387
- setIdCaptureVideoIdFrontImage = _9.setIdCaptureVideoIdFrontImage,
22388
- setIdCaptureVideoIdBackImage = _9.setIdCaptureVideoIdBackImage,
22389
- setIdCaptureVideoAudioUrl = _9.setIdCaptureVideoAudioUrl;
22390
- var _10 = React.useState('CAPTURING_ID'),
22391
- captureState = _10[0],
22392
- setCaptureState = _10[1];
22390
+ _u = _a.idDocumentType,
22391
+ idDocumentType = _u === void 0 ? 'idCard' : _u,
22392
+ _v = _a.idCaptureGuideType,
22393
+ idCaptureGuideType = _v === void 0 ? 'fit' : _v,
22394
+ _w = _a.idCaptureGuideImages,
22395
+ idCaptureGuideImages = _w === void 0 ? defaultIdCaptureGuideImages : _w,
22396
+ _x = _a.idCapturePortraitGuidesOnMobile,
22397
+ idCapturePortraitGuidesOnMobile = _x === void 0 ? true : _x,
22398
+ _y = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
22399
+ idCaptureRotateLoadingOverlayImageWhenPortrait = _y === void 0 ? true : _y,
22400
+ _z = _a.idCaptureModelLoadTimeoutMs,
22401
+ idCaptureModelLoadTimeoutMs = _z === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _z,
22402
+ _0 = _a.faceLivenessLoadingOverlayMode,
22403
+ faceLivenessLoadingOverlayMode = _0 === void 0 ? 'default' : _0,
22404
+ _1 = _a.disableFaceDetectionWhileAudioCapture,
22405
+ disableFaceDetectionWhileAudioCapture = _1 === void 0 ? true : _1,
22406
+ _2 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
22407
+ disableFaceDetectionWhileAudioCaptureMsDelay = _2 === void 0 ? 2000 : _2,
22408
+ _3 = _a.silentFallback,
22409
+ silentFallback = _3 === void 0 ? false : _3,
22410
+ _4 = _a.mergeAVStreams,
22411
+ mergeAVStreams = _4 === void 0 ? false : _4,
22412
+ _5 = _a.assets,
22413
+ assets = _5 === void 0 ? {} : _5,
22414
+ _6 = _a.classNames,
22415
+ classNames = _6 === void 0 ? {} : _6,
22416
+ _7 = _a.colors,
22417
+ colors = _7 === void 0 ? {} : _7,
22418
+ _8 = _a.verbiage,
22419
+ verbiage = _8 === void 0 ? {} : _8,
22420
+ _9 = _a.debugMode,
22421
+ debugMode = _9 === void 0 ? false : _9;
22422
+ var _10 = React.useContext(SubmissionContext),
22423
+ submissionStatus = _10.submissionStatus,
22424
+ idCaptureVideoUrl = _10.idCaptureVideoUrl,
22425
+ idCaptureVideoAudioUrl = _10.idCaptureVideoAudioUrl,
22426
+ idCaptureVideoIdFrontImage = _10.idCaptureVideoIdFrontImage,
22427
+ idCaptureVideoIdBackImage = _10.idCaptureVideoIdBackImage,
22428
+ setIdCaptureVideoUrl = _10.setIdCaptureVideoUrl,
22429
+ setIdCaptureVideoIdFrontImage = _10.setIdCaptureVideoIdFrontImage,
22430
+ setIdCaptureVideoIdBackImage = _10.setIdCaptureVideoIdBackImage,
22431
+ setIdCaptureVideoAudioUrl = _10.setIdCaptureVideoAudioUrl;
22432
+ var _11 = React.useState('CAPTURING_ID'),
22433
+ captureState = _11[0],
22434
+ setCaptureState = _11[1];
22393
22435
  React.useEffect(function () {
22394
22436
  if (skipIdCapture && captureState === 'CAPTURING_ID') setCaptureState('CHECKING_LIVENESS');
22395
22437
  }, [captureState, skipIdCapture]);
@@ -22420,9 +22462,9 @@
22420
22462
  var onVideoCaptureFaceNotDetected = React.useCallback(function () {
22421
22463
  setCaptureState('CHECKING_LIVENESS');
22422
22464
  }, []);
22423
- var _11 = React.useState(0),
22424
- attempt = _11[0],
22425
- setAttempt = _11[1];
22465
+ var _12 = React.useState(0),
22466
+ attempt = _12[0],
22467
+ setAttempt = _12[1];
22426
22468
  var userSuppliedExitAfterFailure = onExitAfterFailure !== null && onExitAfterFailure !== void 0 ? onExitAfterFailure : faceLivenessProps.onExitAfterFailure;
22427
22469
  var onFaceCaptureExitAfterFailure = React.useCallback(function (resp, req) {
22428
22470
  userSuppliedExitAfterFailure === null || userSuppliedExitAfterFailure === void 0 ? void 0 : userSuppliedExitAfterFailure(resp, req);
@@ -22457,7 +22499,7 @@
22457
22499
  var _b, _c, _d, _e;
22458
22500
  var status = _a.status;
22459
22501
  return /*#__PURE__*/React.createElement(IdVideoCaptureGuides, {
22460
- idCardCaptureGuideImages: idCaptureGuideImages,
22502
+ idCaptureGuideImages: idCaptureGuideImages,
22461
22503
  classNames: (_b = classNames.idVideoCapture) === null || _b === void 0 ? void 0 : _b.guides,
22462
22504
  verbiage: (_c = verbiage.idVideoCapture) === null || _c === void 0 ? void 0 : _c.guides,
22463
22505
  requestedAction: "VERIFY_LIVENESS",
@@ -22517,6 +22559,7 @@
22517
22559
  guideType: idCaptureGuideType,
22518
22560
  portraitGuidesOnMobile: idCapturePortraitGuidesOnMobile,
22519
22561
  rotateLoadingOverlayImageWhenPortrait: idCaptureRotateLoadingOverlayImageWhenPortrait,
22562
+ captureRequirement: idDocumentType,
22520
22563
  debugMode: debugMode
22521
22564
  }))));
22522
22565
  case 'CHECKING_LIVENESS':
@@ -22553,7 +22596,8 @@
22553
22596
  onRecordingFailed: onRecordingFailed,
22554
22597
  onExitCapture: handleExitCapture,
22555
22598
  idCaptureModelsEnabled: idCaptureModelsEnabled,
22556
- idCardCaptureGuideImages: idCaptureGuideImages,
22599
+ idCaptureGuideImages: idCaptureGuideImages,
22600
+ idDocumentType: idDocumentType,
22557
22601
  videoIdCaptureThresholds: videoIdCaptureThresholds,
22558
22602
  skipShowIdCardBack: skipShowIdCardBack,
22559
22603
  disableFaceDetectionWhileAudioCapture: disableFaceDetectionWhileAudioCapture,
@@ -22720,9 +22764,11 @@
22720
22764
  case 'IdCapture':
22721
22765
  return /*#__PURE__*/React.createElement(CameraStoreProvider, {
22722
22766
  onCameraAccessDenied: onCameraAccessDenied,
22723
- onMicrophoneAccessDenied: onMicrophoneAccessDenied
22767
+ onMicrophoneAccessDenied: onMicrophoneAccessDenied,
22768
+ requestAccessAutomatically: !(idCaptureProps === null || idCaptureProps === void 0 ? void 0 : idCaptureProps.forceFallbackMode)
22724
22769
  }, /*#__PURE__*/React.createElement(IdCaptureModelsProvider, {
22725
22770
  autoStart: false,
22771
+ shouldLoadModels: !(idCaptureProps === null || idCaptureProps === void 0 ? void 0 : idCaptureProps.forceFallbackMode),
22726
22772
  documentDetectionModelUrl: (_d = (_c = idCaptureProps.assets) === null || _c === void 0 ? void 0 : _c.documentDetectionModelUrl) !== null && _d !== void 0 ? _d : '',
22727
22773
  focusModelUrl: (_f = (_e = idCaptureProps.assets) === null || _e === void 0 ? void 0 : _e.focusModelUrl) !== null && _f !== void 0 ? _f : '',
22728
22774
  onModelError: idCaptureProps.onModelError,
@@ -25092,40 +25138,42 @@
25092
25138
  _p = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
25093
25139
  idCaptureRotateLoadingOverlayImageWhenPortrait = _p === void 0 ? true : _p,
25094
25140
  idCardForFaceMatch = _a.idCardForFaceMatch,
25095
- _q = _a.faceLivenessLoadingOverlayMode,
25096
- faceLivenessLoadingOverlayMode = _q === void 0 ? 'default' : _q,
25097
- _r = _a.disableFaceDetectionWhileAudioCapture,
25098
- disableFaceDetectionWhileAudioCapture = _r === void 0 ? false : _r,
25099
- _s = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
25100
- disableFaceDetectionWhileAudioCaptureMsDelay = _s === void 0 ? 2000 : _s,
25101
- _t = _a.silentFallback,
25102
- silentFallback = _t === void 0 ? false : _t,
25103
- _u = _a.mergeAVStreams,
25104
- mergeAVStreams = _u === void 0 ? false : _u,
25105
- _v = _a.matchOnly,
25106
- matchOnly = _v === void 0 ? false : _v,
25107
- _w = _a.theme,
25108
- theme = _w === void 0 ? 'default' : _w,
25109
- _x = _a.assets,
25110
- assets = _x === void 0 ? {} : _x,
25111
- _y = _a.classNames,
25112
- classNames = _y === void 0 ? {} : _y,
25113
- _z = _a.colors,
25114
- colors = _z === void 0 ? {} : _z,
25115
- _0 = _a.verbiage,
25116
- verbiage = _0 === void 0 ? {} : _0,
25117
- _1 = _a.captureSignature,
25118
- captureSignature = _1 === void 0 ? false : _1,
25119
- _2 = _a.captureSignatureVideo,
25120
- captureSignatureVideo = _2 === void 0 ? false : _2,
25121
- _3 = _a.captureAdditionalDocuments,
25122
- captureAdditionalDocuments = _3 === void 0 ? [] : _3,
25123
- _4 = _a.geolocationEnabled,
25124
- geolocationEnabled = _4 === void 0 ? true : _4,
25125
- _5 = _a.geolocationRequired,
25126
- geolocationRequired = _5 === void 0 ? false : _5,
25127
- _6 = _a.debugMode,
25128
- debugMode = _6 === void 0 ? false : _6;
25141
+ _q = _a.idDocumentType,
25142
+ idDocumentType = _q === void 0 ? 'idCard' : _q,
25143
+ _r = _a.faceLivenessLoadingOverlayMode,
25144
+ faceLivenessLoadingOverlayMode = _r === void 0 ? 'default' : _r,
25145
+ _s = _a.disableFaceDetectionWhileAudioCapture,
25146
+ disableFaceDetectionWhileAudioCapture = _s === void 0 ? false : _s,
25147
+ _t = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
25148
+ disableFaceDetectionWhileAudioCaptureMsDelay = _t === void 0 ? 2000 : _t,
25149
+ _u = _a.silentFallback,
25150
+ silentFallback = _u === void 0 ? false : _u,
25151
+ _v = _a.mergeAVStreams,
25152
+ mergeAVStreams = _v === void 0 ? false : _v,
25153
+ _w = _a.matchOnly,
25154
+ matchOnly = _w === void 0 ? false : _w,
25155
+ _x = _a.theme,
25156
+ theme = _x === void 0 ? 'default' : _x,
25157
+ _y = _a.assets,
25158
+ assets = _y === void 0 ? {} : _y,
25159
+ _z = _a.classNames,
25160
+ classNames = _z === void 0 ? {} : _z,
25161
+ _0 = _a.colors,
25162
+ colors = _0 === void 0 ? {} : _0,
25163
+ _1 = _a.verbiage,
25164
+ verbiage = _1 === void 0 ? {} : _1,
25165
+ _2 = _a.captureSignature,
25166
+ captureSignature = _2 === void 0 ? false : _2,
25167
+ _3 = _a.captureSignatureVideo,
25168
+ captureSignatureVideo = _3 === void 0 ? false : _3,
25169
+ _4 = _a.captureAdditionalDocuments,
25170
+ captureAdditionalDocuments = _4 === void 0 ? [] : _4,
25171
+ _5 = _a.geolocationEnabled,
25172
+ geolocationEnabled = _5 === void 0 ? true : _5,
25173
+ _6 = _a.geolocationRequired,
25174
+ geolocationRequired = _6 === void 0 ? false : _6,
25175
+ _7 = _a.debugMode,
25176
+ debugMode = _7 === void 0 ? false : _7;
25129
25177
  useLanguage(lang);
25130
25178
  useDebugLogging(debugMode);
25131
25179
  var videoIdCaptureProps = React.useMemo(function () {
@@ -25146,6 +25194,7 @@
25146
25194
  idCaptureLoadingOverlayMode: idCaptureLoadingOverlayMode,
25147
25195
  customOverlayContent: customOverlayContent,
25148
25196
  onLoadingOverlayDismissed: onLoadingOverlayDismissed,
25197
+ idDocumentType: idDocumentType,
25149
25198
  idCaptureGuideType: idCaptureGuideType,
25150
25199
  idCaptureGuideImages: idCaptureGuideImages,
25151
25200
  idCapturePortraitGuidesOnMobile: idCapturePortraitGuidesOnMobile,
@@ -25161,7 +25210,7 @@
25161
25210
  verbiage: verbiage,
25162
25211
  debugMode: debugMode
25163
25212
  };
25164
- }, [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]);
25213
+ }, [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]);
25165
25214
  var additionalDocumentCaptureProps = React.useMemo(function () {
25166
25215
  return {
25167
25216
  documents: captureAdditionalDocuments,