idmission-web-sdk 1.0.225 → 1.0.227

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.
@@ -27,6 +27,7 @@ export type IdVideoCaptureProps = {
27
27
  onIdFrontImageCaptured?: (imageUrl: string) => void;
28
28
  onIdBackImageCaptured?: (imageUrl: string) => void;
29
29
  onFaceNotDetected?: () => void;
30
+ idCardFrontDelay?: number;
30
31
  idCardFrontDetectionThreshold?: number;
31
32
  idCardBackDetectionThreshold?: number;
32
33
  idCardFrontFocusThreshold?: number;
@@ -42,4 +43,4 @@ export type IdVideoCaptureProps = {
42
43
  verbiage?: IdVideoCaptureVerbiage;
43
44
  debugMode?: boolean;
44
45
  };
45
- export declare const IdVideoCapture: ({ onComplete, onIdFrontImageCaptured, onIdBackImageCaptured, onFaceNotDetected, idCardFrontDetectionThreshold, idCardFrontFocusThreshold, goodIdCardFrontFramesThreshold, idCardBackDetectionThreshold, idCardBackFocusThreshold, goodIdCardBackFramesThreshold, skipShowIdCardBack, readTextPrompt, readTextTimeoutDurationMs, assets, classNames, colors, verbiage: rawVerbiage, debugMode, }: IdVideoCaptureProps) => ReactElement;
46
+ export declare const IdVideoCapture: ({ onComplete, onIdFrontImageCaptured, onIdBackImageCaptured, onFaceNotDetected, idCardFrontDelay, idCardFrontDetectionThreshold, idCardFrontFocusThreshold, goodIdCardFrontFramesThreshold, idCardBackDetectionThreshold, idCardBackFocusThreshold, goodIdCardBackFramesThreshold, skipShowIdCardBack, readTextPrompt, readTextTimeoutDurationMs, assets, classNames, colors, verbiage: rawVerbiage, debugMode, }: IdVideoCaptureProps) => ReactElement;
@@ -49,7 +49,7 @@ var LanguageDetector__default = /*#__PURE__*/_interopDefaultLegacy(LanguageDetec
49
49
  var i18n__default = /*#__PURE__*/_interopDefaultLegacy(i18n);
50
50
  var SignatureCanvas__default = /*#__PURE__*/_interopDefaultLegacy(SignatureCanvas);
51
51
 
52
- var webSdkVersion = '1.0.225';
52
+ var webSdkVersion = '1.0.227';
53
53
 
54
54
  function getPlatform() {
55
55
  if (typeof window === 'undefined') return;
@@ -14153,65 +14153,67 @@ var IdVideoCapture = function IdVideoCapture(_a) {
14153
14153
  onIdFrontImageCaptured = _a.onIdFrontImageCaptured,
14154
14154
  onIdBackImageCaptured = _a.onIdBackImageCaptured,
14155
14155
  onFaceNotDetected = _a.onFaceNotDetected,
14156
- _v = _a.idCardFrontDetectionThreshold,
14157
- idCardFrontDetectionThreshold = _v === void 0 ? 0.6 : _v,
14158
- _w = _a.idCardFrontFocusThreshold,
14159
- idCardFrontFocusThreshold = _w === void 0 ? 0 : _w,
14160
- _x = _a.goodIdCardFrontFramesThreshold,
14161
- goodIdCardFrontFramesThreshold = _x === void 0 ? 3 : _x,
14162
- _y = _a.idCardBackDetectionThreshold,
14163
- idCardBackDetectionThreshold = _y === void 0 ? 0.6 : _y,
14164
- _z = _a.idCardBackFocusThreshold,
14165
- idCardBackFocusThreshold = _z === void 0 ? 0 : _z,
14166
- _0 = _a.goodIdCardBackFramesThreshold,
14167
- goodIdCardBackFramesThreshold = _0 === void 0 ? 3 : _0,
14168
- _1 = _a.skipShowIdCardBack,
14169
- skipShowIdCardBack = _1 === void 0 ? false : _1,
14156
+ _v = _a.idCardFrontDelay,
14157
+ idCardFrontDelay = _v === void 0 ? 1000 : _v,
14158
+ _w = _a.idCardFrontDetectionThreshold,
14159
+ idCardFrontDetectionThreshold = _w === void 0 ? 0.6 : _w,
14160
+ _x = _a.idCardFrontFocusThreshold,
14161
+ idCardFrontFocusThreshold = _x === void 0 ? 0 : _x,
14162
+ _y = _a.goodIdCardFrontFramesThreshold,
14163
+ goodIdCardFrontFramesThreshold = _y === void 0 ? 3 : _y,
14164
+ _z = _a.idCardBackDetectionThreshold,
14165
+ idCardBackDetectionThreshold = _z === void 0 ? 0.6 : _z,
14166
+ _0 = _a.idCardBackFocusThreshold,
14167
+ idCardBackFocusThreshold = _0 === void 0 ? 0 : _0,
14168
+ _1 = _a.goodIdCardBackFramesThreshold,
14169
+ goodIdCardBackFramesThreshold = _1 === void 0 ? 3 : _1,
14170
+ _2 = _a.skipShowIdCardBack,
14171
+ skipShowIdCardBack = _2 === void 0 ? false : _2,
14170
14172
  readTextPrompt = _a.readTextPrompt,
14171
- _2 = _a.readTextTimeoutDurationMs,
14172
- readTextTimeoutDurationMs = _2 === void 0 ? 15000 : _2,
14173
- _3 = _a.assets,
14174
- assets = _3 === void 0 ? {} : _3,
14175
- _4 = _a.classNames,
14176
- classNames = _4 === void 0 ? {} : _4,
14177
- _5 = _a.colors,
14178
- colors = _5 === void 0 ? {} : _5,
14179
- _6 = _a.verbiage,
14180
- rawVerbiage = _6 === void 0 ? {} : _6,
14181
- _7 = _a.debugMode,
14182
- debugMode = _7 === void 0 ? false : _7;
14183
- var _8 = useResizeObserver__default['default'](),
14184
- ref = _8.ref,
14185
- _9 = _8.width,
14186
- width = _9 === void 0 ? 1 : _9,
14187
- _10 = _8.height,
14188
- height = _10 === void 0 ? 1 : _10;
14189
- var _11 = React.useContext(CameraStateContext),
14190
- cameraRef = _11.cameraRef,
14191
- videoRef = _11.videoRef,
14192
- videoLoaded = _11.videoLoaded,
14193
- cameraReady = _11.cameraReady;
14194
- var _12 = React.useState([]),
14195
- detectedObjects = _12[0],
14196
- setDetectedObjects = _12[1];
14173
+ _3 = _a.readTextTimeoutDurationMs,
14174
+ readTextTimeoutDurationMs = _3 === void 0 ? 15000 : _3,
14175
+ _4 = _a.assets,
14176
+ assets = _4 === void 0 ? {} : _4,
14177
+ _5 = _a.classNames,
14178
+ classNames = _5 === void 0 ? {} : _5,
14179
+ _6 = _a.colors,
14180
+ colors = _6 === void 0 ? {} : _6,
14181
+ _7 = _a.verbiage,
14182
+ rawVerbiage = _7 === void 0 ? {} : _7,
14183
+ _8 = _a.debugMode,
14184
+ debugMode = _8 === void 0 ? false : _8;
14185
+ var _9 = useResizeObserver__default['default'](),
14186
+ ref = _9.ref,
14187
+ _10 = _9.width,
14188
+ width = _10 === void 0 ? 1 : _10,
14189
+ _11 = _9.height,
14190
+ height = _11 === void 0 ? 1 : _11;
14191
+ var _12 = React.useContext(CameraStateContext),
14192
+ cameraRef = _12.cameraRef,
14193
+ videoRef = _12.videoRef,
14194
+ videoLoaded = _12.videoLoaded,
14195
+ cameraReady = _12.cameraReady;
14197
14196
  var _13 = React.useState([]),
14198
- faces = _13[0],
14199
- setFaces = _13[1];
14200
- var _14 = React.useContext(IdCaptureModelsContext),
14201
- idModelsReady = _14.ready,
14202
- idModelsWorking = _14.working,
14203
- makeIdPrediction = _14.makePrediction,
14204
- onIdPredictionMade = _14.onPredictionMade,
14205
- setThresholds = _14.setThresholds,
14206
- bestFrameDetectionScore = _14.bestFrameDetectionScore,
14207
- bestFrameFocusScore = _14.bestFrameFocusScore,
14208
- resetBestFrame = _14.resetBestFrame;
14197
+ detectedObjects = _13[0],
14198
+ setDetectedObjects = _13[1];
14199
+ var _14 = React.useState([]),
14200
+ faces = _14[0],
14201
+ setFaces = _14[1];
14202
+ var _15 = React.useContext(IdCaptureModelsContext),
14203
+ idModelsReady = _15.ready,
14204
+ idModelsWorking = _15.working,
14205
+ makeIdPrediction = _15.makePrediction,
14206
+ onIdPredictionMade = _15.onPredictionMade,
14207
+ setThresholds = _15.setThresholds,
14208
+ bestFrameDetectionScore = _15.bestFrameDetectionScore,
14209
+ bestFrameFocusScore = _15.bestFrameFocusScore,
14210
+ resetBestFrame = _15.resetBestFrame;
14209
14211
  var onSelfiePredictionMade = React.useContext(HighPerformanceSelfieGuidanceModelsContext).onPredictionMade;
14210
- var _15 = useVideoRecorder(cameraRef.current),
14211
- isRecording = _15.isRecording,
14212
- startRecording = _15.startRecording,
14213
- stopRecording = _15.stopRecording,
14214
- videoUrl = _15.videoUrl;
14212
+ var _16 = useVideoRecorder(cameraRef.current),
14213
+ isRecording = _16.isRecording,
14214
+ startRecording = _16.startRecording,
14215
+ stopRecording = _16.stopRecording,
14216
+ videoUrl = _16.videoUrl;
14215
14217
  React.useEffect(function () {
14216
14218
  if (!isRecording && !videoUrl) startRecording();
14217
14219
  if (videoUrl) onComplete === null || onComplete === void 0 ? void 0 : onComplete(videoUrl);
@@ -14221,9 +14223,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
14221
14223
  React.useEffect(function () {
14222
14224
  shouldCaptureFrames.current = videoLoaded && cameraReady && idModelsReady;
14223
14225
  }, [cameraReady, idModelsReady, videoLoaded]);
14224
- var _16 = React.useState('SHOW_ID_FRONT'),
14225
- requestedAction = _16[0],
14226
- setRequestedAction = _16[1];
14226
+ var _17 = React.useState('SHOW_ID_FRONT'),
14227
+ requestedAction = _17[0],
14228
+ setRequestedAction = _17[1];
14227
14229
  React.useEffect(function () {
14228
14230
  if (requestedAction !== 'SHOW_ID_FRONT' && requestedAction !== 'SHOW_ID_BACK') return;
14229
14231
  if (!idModelsReady || !cameraReady || !videoLoaded) return;
@@ -14251,15 +14253,23 @@ var IdVideoCapture = function IdVideoCapture(_a) {
14251
14253
  }
14252
14254
  });
14253
14255
  }, [idCardBackDetectionThreshold, idCardBackFocusThreshold, idCardFrontDetectionThreshold, idCardFrontFocusThreshold, requestedAction, setThresholds]);
14254
- var _17 = React.useState(0),
14255
- currentDetectionScore = _17[0],
14256
- setCurrentDetectionScore = _17[1];
14257
- var _18 = React.useState(0),
14258
- currentFocusScore = _18[0],
14259
- setCurrentFocusScore = _18[1];
14256
+ var _18 = React.useState(null),
14257
+ idFrontCaptureStartedAt = _18[0],
14258
+ setIdFrontCaptureStartedAt = _18[1];
14259
+ React.useEffect(function () {
14260
+ if (requestedAction === 'SHOW_ID_FRONT') {
14261
+ setIdFrontCaptureStartedAt(new Date().getTime());
14262
+ }
14263
+ }, [requestedAction]);
14260
14264
  var _19 = React.useState(0),
14261
- goodFramesCount = _19[0],
14262
- setGoodFramesCount = _19[1];
14265
+ currentDetectionScore = _19[0],
14266
+ setCurrentDetectionScore = _19[1];
14267
+ var _20 = React.useState(0),
14268
+ currentFocusScore = _20[0],
14269
+ setCurrentFocusScore = _20[1];
14270
+ var _21 = React.useState(0),
14271
+ goodFramesCount = _21[0],
14272
+ setGoodFramesCount = _21[1];
14263
14273
  var goodFramesThreshold = requestedAction === 'SHOW_ID_FRONT' ? goodIdCardFrontFramesThreshold : goodIdCardBackFramesThreshold;
14264
14274
  var goodFramesThresholdMet = goodFramesCount >= goodFramesThreshold;
14265
14275
  React.useEffect(function () {
@@ -14267,7 +14277,8 @@ var IdVideoCapture = function IdVideoCapture(_a) {
14267
14277
  setDetectedObjects(prediction.detectedObjects);
14268
14278
  setCurrentDetectionScore(prediction.detectionScore);
14269
14279
  setCurrentFocusScore(prediction.focusScore);
14270
- if (prediction.detectionThresholdMet && prediction.focusThresholdMet) {
14280
+ var delaySatisfied = idFrontCaptureStartedAt && new Date().getTime() > idFrontCaptureStartedAt + idCardFrontDelay;
14281
+ if (delaySatisfied && prediction.detectionThresholdMet && prediction.focusThresholdMet) {
14271
14282
  setGoodFramesCount(function (n) {
14272
14283
  return n + 1;
14273
14284
  });
@@ -14275,7 +14286,7 @@ var IdVideoCapture = function IdVideoCapture(_a) {
14275
14286
  setGoodFramesCount(0);
14276
14287
  }
14277
14288
  });
14278
- }, [idCardFrontDetectionThreshold, onIdPredictionMade]);
14289
+ }, [idCardFrontDelay, idCardFrontDetectionThreshold, idFrontCaptureStartedAt, onIdPredictionMade]);
14279
14290
  var captureCanvas = React.useRef(null);
14280
14291
  var captureFrame = React.useCallback(function () {
14281
14292
  if (!captureCanvas.current || !videoRef.current) return;
@@ -14350,9 +14361,9 @@ var IdVideoCapture = function IdVideoCapture(_a) {
14350
14361
  stopRecording();
14351
14362
  }, [stopRecording]);
14352
14363
  var timeoutStartedAt = useTimeout(readTextTimeoutDurationMs, onReadTextTimeout, requestedAction !== 'READ_TEXT', false, requestedAction === 'READ_TEXT').timeoutStartedAt;
14353
- var _20 = React.useState(0),
14354
- numFramesWithoutFaces = _20[0],
14355
- setNumFramesWithoutFaces = _20[1];
14364
+ var _22 = React.useState(0),
14365
+ numFramesWithoutFaces = _22[0],
14366
+ setNumFramesWithoutFaces = _22[1];
14356
14367
  React.useEffect(function () {
14357
14368
  onSelfiePredictionMade(function (faces) {
14358
14369
  setFaces(faces);