idmission-web-sdk 2.2.51 → 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.
@@ -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.51';
214
+ var webSdkVersion = '2.2.52';
215
215
 
216
216
  function getPlatform() {
217
217
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -11095,6 +11095,7 @@
11095
11095
  'Performing facial recognition, please hold still...': 'Realizando el reconocimiento facial, por favor no te muevas',
11096
11096
  'Display the front of your ID card...': 'Hay que mostrar el frente de la identificación...',
11097
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...',
11098
11099
  'Please move your face to the center...': 'Por favor, hay que mover la cabeza hacia el centro...',
11099
11100
  'Searching for ID card...': 'Localizando la identificación...',
11100
11101
  'Please read the following text aloud': 'Hay que leer el siguiente texto en voz alta',
@@ -21558,7 +21559,7 @@
21558
21559
  idCardGuideBorderWidth = _a.idCardGuideBorderWidth,
21559
21560
  idCardGuideBorderColor = _a.idCardGuideBorderColor,
21560
21561
  idCardCaptureProgress = _a.idCardCaptureProgress,
21561
- _3 = _a.idCardCaptureGuideImages,
21562
+ _3 = _a.idCaptureGuideImages,
21562
21563
  userSuppliedImages = _3 === void 0 ? defaultIdCaptureGuideImages : _3,
21563
21564
  _4 = _a.classNames,
21564
21565
  classNames = _4 === void 0 ? {} : _4,
@@ -21570,10 +21571,11 @@
21570
21571
  var verbiage = useTranslations(rawVerbiage, {
21571
21572
  idFrontInstructionText: 'Display the front of your ID card...',
21572
21573
  idBackInstructionText: 'Display the back of your ID card...',
21574
+ passportInstructionText: 'Display the ID page of your passport...',
21573
21575
  flipIdInstructionText: 'Please flip your ID card...',
21574
21576
  verifyLivenessInstructionText: 'Performing facial recognition, please hold still...'
21575
21577
  });
21576
- 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;
21577
21579
  var theme = styled.useTheme();
21578
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;
21579
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';
@@ -21638,7 +21640,7 @@
21638
21640
  className: classNames.idCardGuideImage,
21639
21641
  "$isMirrored": !isRearFacing,
21640
21642
  style: idCardImageStyle,
21641
- 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,
21642
21644
  onLoad: onImageLoaded
21643
21645
  })), requestedAction === 'FLIP_ID' && ( /*#__PURE__*/React.createElement(IdVideoCaptureFlipIdPrompt, {
21644
21646
  idCaptureGuideImages: idCaptureGuideImages,
@@ -21773,7 +21775,7 @@
21773
21775
  detection: {
21774
21776
  idCardFront: 0.4,
21775
21777
  idCardBack: 0.5,
21776
- passport: 1
21778
+ passport: 0.3
21777
21779
  },
21778
21780
  focus: {
21779
21781
  idCardFront: {
@@ -21791,7 +21793,8 @@
21791
21793
  },
21792
21794
  goodFrames: {
21793
21795
  idCardFront: 1,
21794
- idCardBack: 1
21796
+ idCardBack: 1,
21797
+ passport: 1
21795
21798
  },
21796
21799
  flipShortcutThreshold: 0.7
21797
21800
  };
@@ -21805,91 +21808,93 @@
21805
21808
  onExitCapture = _a.onExitCapture,
21806
21809
  _w = _a.idCaptureModelsEnabled,
21807
21810
  idCaptureModelsEnabled = _w === void 0 ? true : _w,
21808
- _x = _a.idCardCaptureGuideImages,
21809
- idCardCaptureGuideImages = _x === void 0 ? defaultIdCaptureGuideImages : _x,
21810
- _y = _a.idCardFrontDelay,
21811
- idCardFrontDelay = _y === void 0 ? 1000 : _y,
21812
- _z = _a.videoIdCaptureThresholds,
21813
- videoIdCaptureThresholds = _z === void 0 ? defaultVideoIdCaptureThresholds : _z,
21814
- _0 = _a.skipShowIdCardBack,
21815
- skipShowIdCardBack = _0 === void 0 ? false : _0,
21816
- _1 = _a.captureCountdownSeconds,
21817
- 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,
21818
21823
  readTextPrompt = _a.readTextPrompt,
21819
- _2 = _a.readTextTimeoutDurationMs,
21820
- readTextTimeoutDurationMs = _2 === void 0 ? 15000 : _2,
21821
- _3 = _a.readTextMinReadingMs,
21822
- readTextMinReadingMs = _3 === void 0 ? 10000 : _3,
21823
- _4 = _a.disableFaceDetectionWhileAudioCapture,
21824
- disableFaceDetectionWhileAudioCapture = _4 === void 0 ? false : _4,
21825
- _5 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
21826
- disableFaceDetectionWhileAudioCaptureMsDelay = _5 === void 0 ? 2000 : _5,
21827
- _6 = _a.mergeAVStreams,
21828
- mergeAVStreams = _6 === void 0 ? false : _6,
21829
- _7 = _a.classNames,
21830
- classNames = _7 === void 0 ? {} : _7,
21831
- _8 = _a.colors,
21832
- colors = _8 === void 0 ? {} : _8,
21833
- _9 = _a.verbiage,
21834
- rawVerbiage = _9 === void 0 ? {} : _9,
21835
- _10 = _a.debugMode,
21836
- debugMode = _10 === void 0 ? false : _10;
21837
- var _11 = useResizeObserver(),
21838
- ref = _11.ref,
21839
- _12 = _11.width,
21840
- width = _12 === void 0 ? 1 : _12,
21841
- _13 = _11.height,
21842
- height = _13 === void 0 ? 1 : _13;
21843
- var _14 = useCameraStore(),
21844
- camera = _14.camera,
21845
- videoRef = _14.videoRef,
21846
- videoLoaded = _14.videoLoaded,
21847
- cameraReady = _14.cameraReady,
21848
- microphoneReady = _14.microphoneReady,
21849
- audioStream = _14.audioStream,
21850
- isRearFacing = _14.isRearFacing,
21851
- releaseCameraAccess = _14.releaseCameraAccess;
21852
- var _15 = React.useState([]),
21853
- detectedObjects = _15[0],
21854
- setDetectedObjects = _15[1];
21855
- var _16 = React.useState(null),
21856
- face = _16[0],
21857
- setFace = _16[1];
21858
- var _17 = React.useContext(IdCaptureModelsContext),
21859
- idModelsReady = _17.ready,
21860
- startIdModels = _17.start,
21861
- stopIdModels = _17.stop,
21862
- onIdPredictionMade = _17.onPredictionMade,
21863
- setThresholds = _17.setThresholds,
21864
- setDocumentDetectionBoundaries = _17.setDocumentDetectionBoundaries,
21865
- bestFrameDetails = _17.bestFrameDetails,
21866
- resetBestFrame = _17.resetBestFrame,
21867
- idModelError = _17.modelError;
21868
- var _18 = React.useState(null),
21869
- videoStartsAt = _18[0],
21870
- setVideoStartsAt = _18[1];
21871
- var _19 = React.useContext(SubmissionContext),
21872
- setIdCaptureVideoAudioStartsAt = _19.setIdCaptureVideoAudioStartsAt,
21873
- setExpectedAudioText = _19.setExpectedAudioText;
21874
- var _20 = React.useContext(SelfieGuidanceModelsContext),
21875
- startSelfieGuidance = _20.start,
21876
- stopSelfieGuidance = _20.stop,
21877
- onSelfiePredictionMade = _20.onPredictionMade,
21878
- selfieModelError = _20.error;
21879
- var _21 = useVideoRecorder(camera, audioStream, mergeAVStreams),
21880
- isRecordingVideo = _21.isRecordingVideo,
21881
- startRecordingVideo = _21.startRecordingVideo,
21882
- startRecordingAudio = _21.startRecordingAudio,
21883
- stopRecordingVideo = _21.stopRecordingVideo,
21884
- stopRecordingAudio = _21.stopRecordingAudio,
21885
- videoRecordingUnintentionallyStopped = _21.videoRecordingUnintentionallyStopped,
21886
- audioRecordingUnintentionallyStopped = _21.audioRecordingUnintentionallyStopped,
21887
- videoUrl = _21.videoUrl,
21888
- 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;
21889
21894
  var countdownTimeoutRef = React.useRef(undefined);
21890
- var _22 = React.useState(-1),
21891
- countdownRemaining = _22[0],
21892
- setCountdownRemaining = _22[1];
21895
+ var _23 = React.useState(-1),
21896
+ countdownRemaining = _23[0],
21897
+ setCountdownRemaining = _23[1];
21893
21898
  React.useEffect(function () {
21894
21899
  if (!isRecordingVideo && !videoUrl) {
21895
21900
  startRecordingVideo();
@@ -21909,9 +21914,9 @@
21909
21914
  onRecordingFailed === null || onRecordingFailed === void 0 ? void 0 : onRecordingFailed();
21910
21915
  }
21911
21916
  }, [audioRecordingUnintentionallyStopped, microphoneReady, onRecordingFailed, readTextPrompt, videoRecordingUnintentionallyStopped]);
21912
- var _23 = React.useState('SHOW_ID_FRONT'),
21913
- requestedAction = _23[0],
21914
- setRequestedAction = _23[1];
21917
+ var _24 = React.useState(idDocumentType === 'idCard' ? 'SHOW_ID_FRONT' : 'SHOW_PASSPORT'),
21918
+ requestedAction = _24[0],
21919
+ setRequestedAction = _24[1];
21915
21920
  var shouldRunIdModels = idCaptureModelsEnabled && videoLoaded && cameraReady && idModelsReady && !idModelError && requestedAction !== 'READ_TEXT' && (!readTextPrompt || microphoneReady);
21916
21921
  React.useEffect(function startModelsWhenCapturing() {
21917
21922
  if (!shouldRunIdModels) return;
@@ -21920,9 +21925,25 @@
21920
21925
  return stopIdModels();
21921
21926
  };
21922
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]);
21923
21944
  React.useEffect(function () {
21924
- setThresholds(videoIdCaptureThresholds);
21925
- }, [requestedAction, setThresholds, videoIdCaptureThresholds]);
21945
+ setThresholds(adjustedThresholds);
21946
+ }, [requestedAction, setThresholds, adjustedThresholds]);
21926
21947
  React.useEffect(function () {
21927
21948
  setDocumentDetectionBoundaries({
21928
21949
  top: 20,
@@ -21931,19 +21952,19 @@
21931
21952
  bottom: 0
21932
21953
  });
21933
21954
  }, [setDocumentDetectionBoundaries]);
21934
- var _24 = React.useState(0),
21935
- currentDetectionScore = _24[0],
21936
- setCurrentDetectionScore = _24[1];
21937
- var _25 = React.useState('none'),
21938
- currentDetectedDocumentType = _25[0],
21939
- setCurrentDetectedDocumentType = _25[1];
21940
- var _26 = React.useState(0),
21941
- currentFocusScore = _26[0],
21942
- 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];
21943
21961
  var _27 = React.useState(0),
21944
- goodFramesCount = _27[0],
21945
- setGoodFramesCount = _27[1];
21946
- 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;
21947
21968
  var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
21948
21969
  React.useEffect(function () {
21949
21970
  if (!idCaptureModelsEnabled || idModelError) return;
@@ -21952,9 +21973,9 @@
21952
21973
  setCurrentDetectionScore(prediction.detectionScore);
21953
21974
  setCurrentDetectedDocumentType(prediction.detectedDocumentType);
21954
21975
  setCurrentFocusScore(prediction.focusScore);
21955
- 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;
21956
21977
  var isGoodFrame = detectionThresholdMet && prediction.focusThresholdMet;
21957
- var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= videoIdCaptureThresholds.flipShortcutThreshold;
21978
+ var shouldShortcutFlipAnimation = requestedAction === 'FLIP_ID' && isGoodFrame && prediction.idCardBackDetectionScore >= adjustedThresholds.flipShortcutThreshold;
21958
21979
  if (shouldShortcutFlipAnimation) {
21959
21980
  return setRequestedAction('SHOW_ID_BACK');
21960
21981
  }
@@ -21962,16 +21983,16 @@
21962
21983
  return n + 1;
21963
21984
  } : 0);
21964
21985
  });
21965
- }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, videoIdCaptureThresholds.flipShortcutThreshold]);
21966
- var _28 = React.useState(null),
21967
- idFrontCaptureStartedAt = _28[0],
21968
- setFirstGoodFrameTime = _28[1];
21986
+ }, [idCaptureModelsEnabled, onIdPredictionMade, idModelError, requestedAction, adjustedThresholds.flipShortcutThreshold]);
21987
+ var _29 = React.useState(null),
21988
+ idFrontCaptureStartedAt = _29[0],
21989
+ setFirstGoodFrameTime = _29[1];
21969
21990
  React.useEffect(function () {
21970
21991
  if (goodFramesCount === 1) setFirstGoodFrameTime(new Date().getTime());
21971
21992
  }, [goodFramesCount]);
21972
- 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;
21973
21994
  var translatedText = useVerbiage(readTextPrompt, '');
21974
- var onIdBackCaptureComplete = React.useCallback(function () {
21995
+ var onIdCaptureComplete = React.useCallback(function () {
21975
21996
  var _a;
21976
21997
  if (translatedText) {
21977
21998
  setRequestedAction('READ_TEXT');
@@ -21986,16 +22007,16 @@
21986
22007
  var frameHeight = (_e = (_d = videoRef.current) === null || _d === void 0 ? void 0 : _d.videoHeight) !== null && _e !== void 0 ? _e : 0;
21987
22008
  var faceBox = face === null || face === void 0 ? void 0 : face.box;
21988
22009
  var faceCentered = !faceBox || !frameWidth || faceBox.xMin > frameWidth * edgeBoundary && faceBox.yMin > frameHeight * edgeBoundary && faceBox.xMax < frameWidth * (1 - edgeBoundary) && faceBox.yMax < frameHeight * (1 - edgeBoundary);
21989
- var _29 = React.useState(),
21990
- countdownStartedAt = _29[0],
21991
- setCountdownStartedAt = _29[1];
22010
+ var _30 = React.useState(),
22011
+ countdownStartedAt = _30[0],
22012
+ setCountdownStartedAt = _30[1];
21992
22013
  var photoCanvas = React.useRef(null);
21993
22014
  var frameLock = React.useRef(false);
21994
22015
  var captureFrame = React.useCallback(function () {
21995
22016
  return __awaiter(void 0, void 0, void 0, function () {
21996
- var frameBase64;
21997
- return __generator(this, function (_a) {
21998
- switch (_a.label) {
22017
+ var frameBase64, _a;
22018
+ return __generator(this, function (_b) {
22019
+ switch (_b.label) {
21999
22020
  case 0:
22000
22021
  if (frameLock.current) return [2 /*return*/];
22001
22022
  frameLock.current = true;
@@ -22005,23 +22026,25 @@
22005
22026
  frameLock.current = false;
22006
22027
  return [2 /*return*/];
22007
22028
  }
22008
- _a.label = 1;
22029
+ _b.label = 1;
22009
22030
  case 1:
22010
- _a.trys.push([1,, 7, 8]);
22031
+ _b.trys.push([1,, 7, 8]);
22011
22032
  if (!(requestedAction == 'SHOW_ID_FRONT')) return [3 /*break*/, 5];
22012
22033
  if (onIdFrontImageCaptured) {
22013
22034
  onIdFrontImageCaptured(frameBase64);
22014
22035
  }
22015
22036
  if (!skipShowIdCardBack) return [3 /*break*/, 4];
22016
- if (!(skipShowIdCardBack === true)) return [3 /*break*/, 2];
22017
- return [2 /*return*/, onIdBackCaptureComplete()];
22018
- case 2:
22037
+ _a = skipShowIdCardBack === true;
22038
+ if (_a) return [3 /*break*/, 3];
22019
22039
  return [4 /*yield*/, skipShowIdCardBack()];
22040
+ case 2:
22041
+ _a = _b.sent();
22042
+ _b.label = 3;
22020
22043
  case 3:
22021
- if (_a.sent()) {
22022
- return [2 /*return*/, onIdBackCaptureComplete()];
22044
+ if (_a) {
22045
+ return [2 /*return*/, onIdCaptureComplete()];
22023
22046
  }
22024
- _a.label = 4;
22047
+ _b.label = 4;
22025
22048
  case 4:
22026
22049
  setRequestedAction('FLIP_ID');
22027
22050
  return [3 /*break*/, 6];
@@ -22030,9 +22053,14 @@
22030
22053
  if (onIdBackImageCaptured) {
22031
22054
  onIdBackImageCaptured(frameBase64);
22032
22055
  }
22033
- onIdBackCaptureComplete();
22056
+ onIdCaptureComplete();
22057
+ } else if (requestedAction == 'SHOW_PASSPORT') {
22058
+ if (onIdFrontImageCaptured) {
22059
+ onIdFrontImageCaptured(frameBase64);
22060
+ }
22061
+ onIdCaptureComplete();
22034
22062
  }
22035
- _a.label = 6;
22063
+ _b.label = 6;
22036
22064
  case 6:
22037
22065
  return [3 /*break*/, 8];
22038
22066
  case 7:
@@ -22052,7 +22080,7 @@
22052
22080
  }
22053
22081
  });
22054
22082
  });
22055
- }, [onIdBackCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
22083
+ }, [onIdCaptureComplete, onIdBackImageCaptured, onIdFrontImageCaptured, requestedAction, resetBestFrame, skipShowIdCardBack, videoRef]);
22056
22084
  var isFlipping = requestedAction === 'FLIP_ID';
22057
22085
  React.useEffect(function () {
22058
22086
  if (!isFlipping) return;
@@ -22111,9 +22139,9 @@
22111
22139
  stopSelfieGuidance();
22112
22140
  };
22113
22141
  }, [startSelfieGuidance, stopSelfieGuidance]);
22114
- var _30 = React.useState(0),
22115
- numFramesWithoutFaces = _30[0],
22116
- setNumFramesWithoutFaces = _30[1];
22142
+ var _31 = React.useState(0),
22143
+ numFramesWithoutFaces = _31[0],
22144
+ setNumFramesWithoutFaces = _31[1];
22117
22145
  onSelfiePredictionMade(f(React.useCallback(function (_a) {
22118
22146
  var face = _a.face;
22119
22147
  if (selfieModelError) return;
@@ -22129,12 +22157,12 @@
22129
22157
  }
22130
22158
  }, [disableFaceDetectionWhileAudioCapture, disableFaceDetectionWhileAudioCaptureMsDelay, numFramesWithoutFaces, onFaceNotDetected, timeoutStartedAt]);
22131
22159
  var theme = styled.useTheme();
22132
- var _31 = useTranslations(rawVerbiage, {
22160
+ var _32 = useTranslations(rawVerbiage, {
22133
22161
  faceNotCenteredText: 'Please move your face to the center...',
22134
22162
  captureBtnText: 'Capture'
22135
22163
  }),
22136
- captureBtnText = _31.captureBtnText,
22137
- faceNotCenteredText = _31.faceNotCenteredText;
22164
+ captureBtnText = _32.captureBtnText,
22165
+ faceNotCenteredText = _32.faceNotCenteredText;
22138
22166
  var debugScalingDetails = useDebugScalingDetails({
22139
22167
  enabled: debugMode,
22140
22168
  pageWidth: width,
@@ -22142,7 +22170,7 @@
22142
22170
  videoWidth: (_g = (_f = videoRef.current) === null || _f === void 0 ? void 0 : _f.videoWidth) !== null && _g !== void 0 ? _g : 0,
22143
22171
  videoHeight: (_j = (_h = videoRef.current) === null || _h === void 0 ? void 0 : _h.videoHeight) !== null && _j !== void 0 ? _j : 0
22144
22172
  });
22145
- var capturingId = ['SHOW_ID_FRONT', 'SHOW_ID_BACK'].includes(requestedAction);
22173
+ var capturingId = ['SHOW_ID_FRONT', 'SHOW_ID_BACK', 'SHOW_PASSPORT'].includes(requestedAction);
22146
22174
  var guidanceText = !faceCentered ? faceNotCenteredText : undefined;
22147
22175
  return /*#__PURE__*/React.createElement(PageContainer, {
22148
22176
  ref: ref,
@@ -22163,8 +22191,8 @@
22163
22191
  requestedAction: requestedAction,
22164
22192
  satisfied: satisfied,
22165
22193
  idCardGuideStatus: countdownStartedAt ? 'capturing' : 'ready',
22166
- idCardCaptureProgress: !!countdownStartedAt ? 1 : 0,
22167
- idCardCaptureGuideImages: idCardCaptureGuideImages,
22194
+ idCardCaptureProgress: countdownStartedAt ? 1 : 0,
22195
+ idCaptureGuideImages: idCaptureGuideImages,
22168
22196
  faceGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor,
22169
22197
  idCardGuideBorderColor: satisfied ? colors.guidesSatisfiedColor : colors.guidesUnsatisfiedColor
22170
22198
  }), debugMode && capturingId && ( /*#__PURE__*/React.createElement(React.Fragment, null, /*#__PURE__*/React.createElement(ObjectDetectionDebugOverlayDiv, {
@@ -22359,49 +22387,51 @@
22359
22387
  idCaptureLoadingOverlayMode = _t === void 0 ? 'default' : _t,
22360
22388
  customOverlayContent = _a.customOverlayContent,
22361
22389
  onLoadingOverlayDismissed = _a.onLoadingOverlayDismissed,
22362
- _u = _a.idCaptureGuideType,
22363
- idCaptureGuideType = _u === void 0 ? 'fit' : _u,
22364
- _v = _a.idCaptureGuideImages,
22365
- idCaptureGuideImages = _v === void 0 ? defaultIdCaptureGuideImages : _v,
22366
- _w = _a.idCapturePortraitGuidesOnMobile,
22367
- idCapturePortraitGuidesOnMobile = _w === void 0 ? true : _w,
22368
- _x = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
22369
- idCaptureRotateLoadingOverlayImageWhenPortrait = _x === void 0 ? true : _x,
22370
- _y = _a.idCaptureModelLoadTimeoutMs,
22371
- idCaptureModelLoadTimeoutMs = _y === void 0 ? defaultDocumentDetectionModelLoadTimeoutMs : _y,
22372
- _z = _a.faceLivenessLoadingOverlayMode,
22373
- faceLivenessLoadingOverlayMode = _z === void 0 ? 'default' : _z,
22374
- _0 = _a.disableFaceDetectionWhileAudioCapture,
22375
- disableFaceDetectionWhileAudioCapture = _0 === void 0 ? true : _0,
22376
- _1 = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
22377
- disableFaceDetectionWhileAudioCaptureMsDelay = _1 === void 0 ? 2000 : _1,
22378
- _2 = _a.silentFallback,
22379
- silentFallback = _2 === void 0 ? false : _2,
22380
- _3 = _a.mergeAVStreams,
22381
- mergeAVStreams = _3 === void 0 ? false : _3,
22382
- _4 = _a.assets,
22383
- assets = _4 === void 0 ? {} : _4,
22384
- _5 = _a.classNames,
22385
- classNames = _5 === void 0 ? {} : _5,
22386
- _6 = _a.colors,
22387
- colors = _6 === void 0 ? {} : _6,
22388
- _7 = _a.verbiage,
22389
- verbiage = _7 === void 0 ? {} : _7,
22390
- _8 = _a.debugMode,
22391
- debugMode = _8 === void 0 ? false : _8;
22392
- var _9 = React.useContext(SubmissionContext),
22393
- submissionStatus = _9.submissionStatus,
22394
- idCaptureVideoUrl = _9.idCaptureVideoUrl,
22395
- idCaptureVideoAudioUrl = _9.idCaptureVideoAudioUrl,
22396
- idCaptureVideoIdFrontImage = _9.idCaptureVideoIdFrontImage,
22397
- idCaptureVideoIdBackImage = _9.idCaptureVideoIdBackImage,
22398
- setIdCaptureVideoUrl = _9.setIdCaptureVideoUrl,
22399
- setIdCaptureVideoIdFrontImage = _9.setIdCaptureVideoIdFrontImage,
22400
- setIdCaptureVideoIdBackImage = _9.setIdCaptureVideoIdBackImage,
22401
- setIdCaptureVideoAudioUrl = _9.setIdCaptureVideoAudioUrl;
22402
- var _10 = React.useState('CAPTURING_ID'),
22403
- captureState = _10[0],
22404
- 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];
22405
22435
  React.useEffect(function () {
22406
22436
  if (skipIdCapture && captureState === 'CAPTURING_ID') setCaptureState('CHECKING_LIVENESS');
22407
22437
  }, [captureState, skipIdCapture]);
@@ -22432,9 +22462,9 @@
22432
22462
  var onVideoCaptureFaceNotDetected = React.useCallback(function () {
22433
22463
  setCaptureState('CHECKING_LIVENESS');
22434
22464
  }, []);
22435
- var _11 = React.useState(0),
22436
- attempt = _11[0],
22437
- setAttempt = _11[1];
22465
+ var _12 = React.useState(0),
22466
+ attempt = _12[0],
22467
+ setAttempt = _12[1];
22438
22468
  var userSuppliedExitAfterFailure = onExitAfterFailure !== null && onExitAfterFailure !== void 0 ? onExitAfterFailure : faceLivenessProps.onExitAfterFailure;
22439
22469
  var onFaceCaptureExitAfterFailure = React.useCallback(function (resp, req) {
22440
22470
  userSuppliedExitAfterFailure === null || userSuppliedExitAfterFailure === void 0 ? void 0 : userSuppliedExitAfterFailure(resp, req);
@@ -22469,7 +22499,7 @@
22469
22499
  var _b, _c, _d, _e;
22470
22500
  var status = _a.status;
22471
22501
  return /*#__PURE__*/React.createElement(IdVideoCaptureGuides, {
22472
- idCardCaptureGuideImages: idCaptureGuideImages,
22502
+ idCaptureGuideImages: idCaptureGuideImages,
22473
22503
  classNames: (_b = classNames.idVideoCapture) === null || _b === void 0 ? void 0 : _b.guides,
22474
22504
  verbiage: (_c = verbiage.idVideoCapture) === null || _c === void 0 ? void 0 : _c.guides,
22475
22505
  requestedAction: "VERIFY_LIVENESS",
@@ -22529,6 +22559,7 @@
22529
22559
  guideType: idCaptureGuideType,
22530
22560
  portraitGuidesOnMobile: idCapturePortraitGuidesOnMobile,
22531
22561
  rotateLoadingOverlayImageWhenPortrait: idCaptureRotateLoadingOverlayImageWhenPortrait,
22562
+ captureRequirement: idDocumentType,
22532
22563
  debugMode: debugMode
22533
22564
  }))));
22534
22565
  case 'CHECKING_LIVENESS':
@@ -22565,7 +22596,8 @@
22565
22596
  onRecordingFailed: onRecordingFailed,
22566
22597
  onExitCapture: handleExitCapture,
22567
22598
  idCaptureModelsEnabled: idCaptureModelsEnabled,
22568
- idCardCaptureGuideImages: idCaptureGuideImages,
22599
+ idCaptureGuideImages: idCaptureGuideImages,
22600
+ idDocumentType: idDocumentType,
22569
22601
  videoIdCaptureThresholds: videoIdCaptureThresholds,
22570
22602
  skipShowIdCardBack: skipShowIdCardBack,
22571
22603
  disableFaceDetectionWhileAudioCapture: disableFaceDetectionWhileAudioCapture,
@@ -25106,40 +25138,42 @@
25106
25138
  _p = _a.idCaptureRotateLoadingOverlayImageWhenPortrait,
25107
25139
  idCaptureRotateLoadingOverlayImageWhenPortrait = _p === void 0 ? true : _p,
25108
25140
  idCardForFaceMatch = _a.idCardForFaceMatch,
25109
- _q = _a.faceLivenessLoadingOverlayMode,
25110
- faceLivenessLoadingOverlayMode = _q === void 0 ? 'default' : _q,
25111
- _r = _a.disableFaceDetectionWhileAudioCapture,
25112
- disableFaceDetectionWhileAudioCapture = _r === void 0 ? false : _r,
25113
- _s = _a.disableFaceDetectionWhileAudioCaptureMsDelay,
25114
- disableFaceDetectionWhileAudioCaptureMsDelay = _s === void 0 ? 2000 : _s,
25115
- _t = _a.silentFallback,
25116
- silentFallback = _t === void 0 ? false : _t,
25117
- _u = _a.mergeAVStreams,
25118
- mergeAVStreams = _u === void 0 ? false : _u,
25119
- _v = _a.matchOnly,
25120
- matchOnly = _v === void 0 ? false : _v,
25121
- _w = _a.theme,
25122
- theme = _w === void 0 ? 'default' : _w,
25123
- _x = _a.assets,
25124
- assets = _x === void 0 ? {} : _x,
25125
- _y = _a.classNames,
25126
- classNames = _y === void 0 ? {} : _y,
25127
- _z = _a.colors,
25128
- colors = _z === void 0 ? {} : _z,
25129
- _0 = _a.verbiage,
25130
- verbiage = _0 === void 0 ? {} : _0,
25131
- _1 = _a.captureSignature,
25132
- captureSignature = _1 === void 0 ? false : _1,
25133
- _2 = _a.captureSignatureVideo,
25134
- captureSignatureVideo = _2 === void 0 ? false : _2,
25135
- _3 = _a.captureAdditionalDocuments,
25136
- captureAdditionalDocuments = _3 === void 0 ? [] : _3,
25137
- _4 = _a.geolocationEnabled,
25138
- geolocationEnabled = _4 === void 0 ? true : _4,
25139
- _5 = _a.geolocationRequired,
25140
- geolocationRequired = _5 === void 0 ? false : _5,
25141
- _6 = _a.debugMode,
25142
- 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;
25143
25177
  useLanguage(lang);
25144
25178
  useDebugLogging(debugMode);
25145
25179
  var videoIdCaptureProps = React.useMemo(function () {
@@ -25160,6 +25194,7 @@
25160
25194
  idCaptureLoadingOverlayMode: idCaptureLoadingOverlayMode,
25161
25195
  customOverlayContent: customOverlayContent,
25162
25196
  onLoadingOverlayDismissed: onLoadingOverlayDismissed,
25197
+ idDocumentType: idDocumentType,
25163
25198
  idCaptureGuideType: idCaptureGuideType,
25164
25199
  idCaptureGuideImages: idCaptureGuideImages,
25165
25200
  idCapturePortraitGuidesOnMobile: idCapturePortraitGuidesOnMobile,
@@ -25175,7 +25210,7 @@
25175
25210
  verbiage: verbiage,
25176
25211
  debugMode: debugMode
25177
25212
  };
25178
- }, [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]);
25179
25214
  var additionalDocumentCaptureProps = React.useMemo(function () {
25180
25215
  return {
25181
25216
  documents: captureAdditionalDocuments,