idmission-web-sdk 2.3.115 → 2.3.116

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.
package/dist/sdk2.esm.js CHANGED
@@ -7,7 +7,7 @@ import { createPortal } from 'react-dom';
7
7
  import { useTranslation, initReactI18next } from 'react-i18next';
8
8
  import { Upload } from 'tus-js-client';
9
9
  import SparkMD5 from 'spark-md5';
10
- import { ImageSegmenter, FilesetResolver, ObjectDetector, ImageClassifier } from '@mediapipe/tasks-vision';
10
+ import { ImageSegmenter, FilesetResolver, ObjectDetector, ImageClassifier, FaceDetector } from '@mediapipe/tasks-vision';
11
11
  import { useStore, createStore, create } from 'zustand';
12
12
  import LanguageDetector from 'i18next-browser-languagedetector';
13
13
  import i18n from 'i18next';
@@ -205,7 +205,7 @@ typeof SuppressedError === "function" ? SuppressedError : function (error, suppr
205
205
  return e.name = "SuppressedError", e.error = error, e.suppressed = suppressed, e;
206
206
  };
207
207
 
208
- var webSdkVersion = '2.3.115';
208
+ var webSdkVersion = '2.3.116';
209
209
 
210
210
  function getPlatform() {
211
211
  // eslint-disable-next-line @typescript-eslint/ban-ts-comment
@@ -2348,8 +2348,8 @@ function giveUpAfter(maxTime) {
2348
2348
 
2349
2349
  var DEFAULT_CDN_URL = 'https://websdk-cdn-dev.idmission.com/assets';
2350
2350
 
2351
- var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20251018_121234.tflite");
2352
- var defaultDocumentDetectorModelHash = 'cTLjb4g6H+a+RHnLaYrvVF8050qv/Ox04rMtxFXBDR6Xv8Pv+X//hsaO3K3jNPog';
2351
+ var defaultDocumentDetectorModelPath = "".concat(DEFAULT_CDN_URL, "/models/DocumentDetector/DocumentDetector-20250815_115859.tflite");
2352
+ var defaultDocumentDetectorModelHash = '64LSaO2ctQsTkGJoZ6Et4v2KH28Fz1ettgkxD+qFg6frxY7ufL9l/lkjw2ljX2cR';
2353
2353
 
2354
2354
  var defaultFocusModelPath = "".concat(DEFAULT_CDN_URL, "/models/Focus/Focus-20241008_102708.tflite");
2355
2355
  var defaultFocusModelHash = 'HTJNLB7QybtPXIIyUI9oNqW40vE5bgSV5V24R1wXLQHknNEVOSyDQDo/QzRgJ8jb';
@@ -2666,8 +2666,8 @@ var documentTypeDisplayNames = {
2666
2666
  singlePage: 'Single page',
2667
2667
  none: 'None'
2668
2668
  };
2669
- var detector = null;
2670
- var detectorSettings = null;
2669
+ var detector$1 = null;
2670
+ var detectorSettings$1 = null;
2671
2671
  function loadDocumentDetector() {
2672
2672
  return __awaiter(this, arguments, void 0, function (modelAssetPath, scoreThreshold) {
2673
2673
  var _a, _b;
@@ -2680,7 +2680,7 @@ function loadDocumentDetector() {
2680
2680
  return __generator(this, function (_c) {
2681
2681
  switch (_c.label) {
2682
2682
  case 0:
2683
- if (detector && (detectorSettings === null || detectorSettings === void 0 ? void 0 : detectorSettings.modelAssetPath) === modelAssetPath && (detectorSettings === null || detectorSettings === void 0 ? void 0 : detectorSettings.scoreThreshold) === scoreThreshold) return [2 /*return*/, detector];
2683
+ if (detector$1 && (detectorSettings$1 === null || detectorSettings$1 === void 0 ? void 0 : detectorSettings$1.modelAssetPath) === modelAssetPath && (detectorSettings$1 === null || detectorSettings$1 === void 0 ? void 0 : detectorSettings$1.scoreThreshold) === scoreThreshold) return [2 /*return*/, detector$1];
2684
2684
  closeDocumentDetector();
2685
2685
  return [4 /*yield*/, preloadDocumentDetectorDependencies()];
2686
2686
  case 1:
@@ -2701,20 +2701,20 @@ function loadDocumentDetector() {
2701
2701
  runningMode: 'VIDEO'
2702
2702
  }])];
2703
2703
  case 3:
2704
- detector = _c.sent();
2705
- detectorSettings = {
2704
+ detector$1 = _c.sent();
2705
+ detectorSettings$1 = {
2706
2706
  modelAssetPath: modelAssetPath,
2707
2707
  scoreThreshold: scoreThreshold
2708
2708
  };
2709
- return [2 /*return*/, detector];
2709
+ return [2 /*return*/, detector$1];
2710
2710
  }
2711
2711
  });
2712
2712
  });
2713
2713
  }
2714
2714
  function closeDocumentDetector() {
2715
- detector === null || detector === void 0 ? void 0 : detector.close();
2716
- detector = null;
2717
- detectorSettings = null;
2715
+ detector$1 === null || detector$1 === void 0 ? void 0 : detector$1.close();
2716
+ detector$1 = null;
2717
+ detectorSettings$1 = null;
2718
2718
  }
2719
2719
  function useLoadDocumentDetector(_a) {
2720
2720
  var _b = _a.shouldLoadModels,
@@ -2815,12 +2815,12 @@ function makeDocumentDetectorPrediction(frame) {
2815
2815
  return __awaiter(this, void 0, void 0, function () {
2816
2816
  var startedAt, prediction, time, frameWidth, frameHeight;
2817
2817
  return __generator(this, function (_a) {
2818
- if (!detector) return [2 /*return*/, null];
2818
+ if (!detector$1) return [2 /*return*/, null];
2819
2819
  startedAt = performance.now();
2820
2820
  // Detectors can throw errors, for example when using custom URLs that
2821
2821
  // contain a model that doesn't provide the expected output.
2822
2822
  try {
2823
- prediction = detector.detectForVideo(frame, performance.now());
2823
+ prediction = detector$1.detectForVideo(frame, performance.now());
2824
2824
  time = performance.now() - startedAt;
2825
2825
  frameWidth = frame.width;
2826
2826
  frameHeight = frame.height;
@@ -6800,7 +6800,6 @@ function SelfieCaptureFaceKeypoint(_a) {
6800
6800
  scaledHeight = _c.scaledHeight,
6801
6801
  xOffset = _c.xOffset,
6802
6802
  yOffset = _c.yOffset;
6803
- if (!point) return /*#__PURE__*/React__default.createElement(React__default.Fragment, null);
6804
6803
  var left, top;
6805
6804
  if (horizontal) {
6806
6805
  left = point.x / videoWidth * scaledWidth - xOffset;
@@ -11875,6 +11874,136 @@ var FaceCaptureGuideOverlay = function FaceCaptureGuideOverlay(_a) {
11875
11874
  var templateObject_1$n, templateObject_2$l;
11876
11875
 
11877
11876
  var defaultSelfieCaptureModelLoadTimeoutMs = 45000;
11877
+ var detector = null;
11878
+ var detectorSettings = null;
11879
+ function loadFaceDetector() {
11880
+ return __awaiter(this, arguments, void 0, function (modelAssetPath) {
11881
+ var _a, _b;
11882
+ if (modelAssetPath === void 0) {
11883
+ modelAssetPath = defaultFaceDetectorModelPath;
11884
+ }
11885
+ return __generator(this, function (_c) {
11886
+ switch (_c.label) {
11887
+ case 0:
11888
+ if (detector && (detectorSettings === null || detectorSettings === void 0 ? void 0 : detectorSettings.modelAssetPath) === modelAssetPath) return [2 /*return*/, detector];
11889
+ closeFaceDetector();
11890
+ return [4 /*yield*/, preloadFaceDetectorDependencies()];
11891
+ case 1:
11892
+ _c.sent();
11893
+ if (modelCapabilities.delegate === 'NONE') {
11894
+ throw new Error('No available delegate for face detector.');
11895
+ }
11896
+ _b = (_a = FaceDetector).createFromOptions;
11897
+ return [4 /*yield*/, FilesetResolver.forVisionTasks(visionTasksBasePath)];
11898
+ case 2:
11899
+ return [4 /*yield*/, _b.apply(_a, [_c.sent(), {
11900
+ // canvas: document.createElement('canvas'),
11901
+ baseOptions: {
11902
+ modelAssetPath: modelAssetPath,
11903
+ delegate: modelCapabilities.delegate
11904
+ },
11905
+ runningMode: 'VIDEO'
11906
+ }])];
11907
+ case 3:
11908
+ detector = _c.sent();
11909
+ detectorSettings = {
11910
+ modelAssetPath: modelAssetPath
11911
+ };
11912
+ return [2 /*return*/, detector];
11913
+ }
11914
+ });
11915
+ });
11916
+ }
11917
+ function closeFaceDetector() {
11918
+ detector === null || detector === void 0 ? void 0 : detector.close();
11919
+ detector = null;
11920
+ detectorSettings = null;
11921
+ }
11922
+ function useLoadFaceDetector(_a) {
11923
+ var onModelError = _a.onModelError,
11924
+ _b = _a.modelLoadTimeoutMs,
11925
+ modelLoadTimeoutMs = _b === void 0 ? defaultSelfieCaptureModelLoadTimeoutMs : _b,
11926
+ videoRef = _a.videoRef;
11927
+ var _c = useState('not-started'),
11928
+ modelLoadState = _c[0],
11929
+ setModelLoadState = _c[1];
11930
+ var _d = useState(0),
11931
+ modelDownloadProgress = _d[0],
11932
+ setModelDownloadProgress = _d[1];
11933
+ var _e = useState(null),
11934
+ modelWarmingStartedAt = _e[0],
11935
+ setModelWarmingStartedAt = _e[1];
11936
+ var _f = useState(null),
11937
+ modelError = _f[0],
11938
+ setModelError = _f[1];
11939
+ useEffect(function loadModel() {
11940
+ var _this = this;
11941
+ setModelLoadState('downloading');
11942
+ setModelWarmingStartedAt(null);
11943
+ var modelLoadTimeout = setTimeout(function () {
11944
+ setModelError(new Error('Model loading time limit exceeded.'));
11945
+ }, modelLoadTimeoutMs);
11946
+ function handleDownloadProgress(event) {
11947
+ setModelDownloadProgress(progressToPercentage(event.detail));
11948
+ }
11949
+ document.addEventListener('idmission.preloadProgress.faceDetection', handleDownloadProgress);
11950
+ var cancelVideoReady = function cancelVideoReady() {};
11951
+ loadFaceDetector().then(function (model) {
11952
+ return __awaiter(_this, void 0, void 0, function () {
11953
+ var _a, videoReady, cancel, cancelled;
11954
+ return __generator(this, function (_b) {
11955
+ switch (_b.label) {
11956
+ case 0:
11957
+ setModelDownloadProgress(100);
11958
+ clearTimeout(modelLoadTimeout);
11959
+ setModelLoadState('warming');
11960
+ setModelWarmingStartedAt(performance.now());
11961
+ return [4 /*yield*/, testFaceDetectionAgainstKnownImage(model)];
11962
+ case 1:
11963
+ _b.sent();
11964
+ _a = waitForVideoReady(videoRef), videoReady = _a[0], cancel = _a[1];
11965
+ cancelled = false;
11966
+ cancelVideoReady = function cancelVideoReady() {
11967
+ cancelled = true;
11968
+ cancel();
11969
+ };
11970
+ return [4 /*yield*/, videoReady];
11971
+ case 2:
11972
+ _b.sent();
11973
+ if (cancelled) return [2 /*return*/];
11974
+ model.detectForVideo(videoRef.current, performance.now());
11975
+ setModelLoadState('ready');
11976
+ return [2 /*return*/];
11977
+ }
11978
+ });
11979
+ });
11980
+ })["catch"](function (e) {
11981
+ setModelError(e);
11982
+ setModelLoadState('error');
11983
+ })["finally"](function () {
11984
+ clearTimeout(modelLoadTimeout);
11985
+ });
11986
+ return function () {
11987
+ log('unloading face detection model');
11988
+ cancelVideoReady();
11989
+ closeFaceDetector();
11990
+ clearTimeout(modelLoadTimeout);
11991
+ document.removeEventListener('idmission.preloadProgress.faceDetection', handleDownloadProgress);
11992
+ };
11993
+ }, [modelLoadTimeoutMs, videoRef]);
11994
+ useEffect(function handleModelError() {
11995
+ if (modelError) onModelError === null || onModelError === void 0 ? void 0 : onModelError(modelError);
11996
+ }, [modelError, onModelError]);
11997
+ return useMemo(function () {
11998
+ return {
11999
+ ready: modelLoadState === 'ready',
12000
+ modelLoadState: modelLoadState,
12001
+ modelDownloadProgress: modelDownloadProgress,
12002
+ modelWarmingStartedAt: modelWarmingStartedAt,
12003
+ modelError: modelError
12004
+ };
12005
+ }, [modelLoadState, modelDownloadProgress, modelWarmingStartedAt, modelError]);
12006
+ }
11878
12007
  var lastFaceDetectionAt = 0;
11879
12008
  var lastFaceDetectionTime = 0;
11880
12009
  function setLastFaceDetectionAt(time) {
@@ -11924,68 +12053,24 @@ function trackFace(face, framesNeeded, frameWidth, frameHeight) {
11924
12053
  if (lastNNosePairs.length > framesNeeded - 1) lastNNosePairs.length = framesNeeded - 1;
11925
12054
  }
11926
12055
  }
11927
- function isFaceDetection(detection) {
11928
- return detection.boundingBox && detection.categories.some(function (c) {
11929
- return c.categoryName === 'Primary face' || c.categoryName === 'Secondary face';
12056
+ function makeFaceDetectorPrediction(imageData) {
12057
+ if (!detector) return null;
12058
+ var prediction = detector.detectForVideo(imageData, performance.now());
12059
+ var faces = prediction.detections.map(function (d) {
12060
+ return {
12061
+ box: convertBoundingBox(d.boundingBox),
12062
+ keypoints: d.keypoints.map(function (k) {
12063
+ var _a;
12064
+ return _assign(_assign({}, k), {
12065
+ x: k.x * imageData.width,
12066
+ y: k.y * imageData.height,
12067
+ name: (_a = k.label) !== null && _a !== void 0 ? _a : ''
12068
+ });
12069
+ })
12070
+ };
11930
12071
  });
11931
- }
11932
- function isNoseDetection(detection) {
11933
- return detection.categories.some(function (c) {
11934
- return c.categoryName === 'Nose';
11935
- });
11936
- }
11937
- function makeFacePredictionWithDocumentDetector(frame) {
11938
- return __awaiter(this, void 0, void 0, function () {
11939
- var prediction, faceDetections, noseDetections, _i, _a, detection, faces, _b, faceDetections_1, d, faceBox, nose, _c, noseDetections_1, n, noseBox, cX, cY;
11940
- return __generator(this, function (_d) {
11941
- switch (_d.label) {
11942
- case 0:
11943
- return [4 /*yield*/, makeDocumentDetectorPrediction(frame)];
11944
- case 1:
11945
- prediction = _d.sent();
11946
- if (!prediction) return [2 /*return*/, null];
11947
- faceDetections = [];
11948
- noseDetections = [];
11949
- for (_i = 0, _a = prediction.detections; _i < _a.length; _i++) {
11950
- detection = _a[_i];
11951
- if (isNoseDetection(detection)) {
11952
- noseDetections.push(detection);
11953
- } else if (isFaceDetection(detection)) {
11954
- faceDetections.push(detection);
11955
- }
11956
- }
11957
- faces = [];
11958
- for (_b = 0, faceDetections_1 = faceDetections; _b < faceDetections_1.length; _b++) {
11959
- d = faceDetections_1[_b];
11960
- faceBox = d.boundingBox;
11961
- if (!faceBox) continue;
11962
- nose = null;
11963
- for (_c = 0, noseDetections_1 = noseDetections; _c < noseDetections_1.length; _c++) {
11964
- n = noseDetections_1[_c];
11965
- noseBox = n.boundingBox;
11966
- if (!noseBox) continue;
11967
- cX = noseBox.originX + noseBox.width / 2;
11968
- cY = noseBox.originY + noseBox.height / 2;
11969
- if (cX >= faceBox.originX && cX <= faceBox.originX + faceBox.width && cY >= faceBox.originY && cY <= faceBox.originY + faceBox.height) {
11970
- nose = {
11971
- x: cX,
11972
- y: cY,
11973
- name: 'nose'
11974
- };
11975
- break;
11976
- }
11977
- }
11978
- faces.push({
11979
- box: convertBoundingBox(d.boundingBox),
11980
- keypoints: [null, null, nose, null, null]
11981
- });
11982
- }
11983
- debug('faces', faces);
11984
- return [2 /*return*/, _assign(_assign({}, prediction), {
11985
- faces: faces
11986
- })];
11987
- }
11988
- });
12072
+ return _assign(_assign({}, prediction), {
12073
+ faces: faces
11989
12074
  });
11990
12075
  }
11991
12076
  function processFaceDetectorPrediction(_a) {
@@ -12013,9 +12098,13 @@ function processFaceDetectorPrediction(_a) {
12013
12098
  // this represents the edge that the centroid of the face should not cross -- 12.5% of video width
12014
12099
  yCentroidBoundary = _h === void 0 ? 0.125 : _h,
12015
12100
  // this represents the edge that the centroid of the face should not cross -- 12.5% of video height
12016
- _j = _a.noseTrackingThreshold,
12101
+ _j = _a.foreheadRatio,
12017
12102
  // this represents the edge that the centroid of the face should not cross -- 12.5% of video height
12018
- noseTrackingThreshold = _j === void 0 ? 0.2 : _j,
12103
+ foreheadRatio = _j === void 0 ? 0.275 : _j,
12104
+ // we found that the bounding box ends at the brow and misses the forehead. this ratio represents how much we should extend the box to include the forehead.
12105
+ _k = _a.noseTrackingThreshold,
12106
+ // we found that the bounding box ends at the brow and misses the forehead. this ratio represents how much we should extend the box to include the forehead.
12107
+ noseTrackingThreshold = _k === void 0 ? 0.2 : _k,
12019
12108
  // this represents the maximum distance that the nose can be from the center of the face box -- 20% of the face box width or height
12020
12109
  minCaptureBrightnessThreshold = _a.minCaptureBrightnessThreshold,
12021
12110
  minCaptureRangeThreshold = _a.minCaptureRangeThreshold,
@@ -12042,10 +12131,10 @@ function processFaceDetectorPrediction(_a) {
12042
12131
  var frameCX = videoWidth / 2;
12043
12132
  var frameCY = videoHeight / 2;
12044
12133
  // calculate head bounding box, with forehead extension
12045
- // const foreheadSize = face.box.height * foreheadRatio
12134
+ var foreheadSize = face.box.height * foreheadRatio;
12046
12135
  var headXMin = face.box.xMin;
12047
12136
  var headXMax = face.box.xMax;
12048
- var headYMin = face.box.yMin; // - foreheadSize
12137
+ var headYMin = face.box.yMin - foreheadSize;
12049
12138
  var headYMax = face.box.yMax;
12050
12139
  // calculate head centroids
12051
12140
  var headCX = (headXMin + headXMax) / 2;
@@ -12101,6 +12190,26 @@ function processFaceDetectorPrediction(_a) {
12101
12190
  faceVisibilityTooLow: faceVisibilityTooLow
12102
12191
  };
12103
12192
  }
12193
+ function testFaceDetectionAgainstKnownImage(detector) {
12194
+ return new Promise(function (resolve, reject) {
12195
+ var img = new Image();
12196
+ img.crossOrigin = 'anonymous';
12197
+ img.onload = function () {
12198
+ var prediction = detector.detectForVideo(img, performance.now());
12199
+ if (prediction.detections.length > 0) {
12200
+ debug('face detection test result', prediction.detections);
12201
+ resolve(void 0);
12202
+ } else {
12203
+ warn('face detection test failed');
12204
+ reject(new Error('testFaceDetectionAgainstKnownImage failed to predict'));
12205
+ }
12206
+ };
12207
+ img.onerror = function () {
12208
+ return reject(new Error('testFaceDetectionAgainstKnownImage failed to load image'));
12209
+ };
12210
+ img.src = "".concat(DEFAULT_CDN_URL, "/head-test.jpg");
12211
+ });
12212
+ }
12104
12213
 
12105
12214
  function detectBrightnessAndContrast(frame, brightnessAverager) {
12106
12215
  var ctx = frame.getContext('2d');
@@ -12252,27 +12361,16 @@ function SelfieGuidanceModelsProvider(_a) {
12252
12361
  var canvasRef = useRef(null);
12253
12362
  var onPredictionHandler = useRef();
12254
12363
  var addToAverage = useRunningAvg(5).addToAverage;
12255
- var _f = useLoadDocumentDetector({
12256
- videoRef: videoRef,
12364
+ var _f = useLoadFaceDetector({
12257
12365
  onModelError: onModelError,
12258
- modelLoadTimeoutMs: modelLoadTimeoutMs
12366
+ modelLoadTimeoutMs: modelLoadTimeoutMs,
12367
+ videoRef: videoRef
12259
12368
  }),
12260
12369
  ready = _f.ready,
12261
12370
  modelLoadState = _f.modelLoadState,
12262
12371
  modelDownloadProgress = _f.modelDownloadProgress,
12263
12372
  modelWarmingStartedAt = _f.modelWarmingStartedAt,
12264
12373
  modelError = _f.modelError;
12265
- // const {
12266
- // ready,
12267
- // modelLoadState,
12268
- // modelDownloadProgress,
12269
- // modelWarmingStartedAt,
12270
- // modelError,
12271
- // } = useLoadFaceDetector({
12272
- // onModelError,
12273
- // modelLoadTimeoutMs,
12274
- // videoRef,
12275
- // })
12276
12374
  var _g = useFrameLoop(useCallback(function () {
12277
12375
  return __awaiter(_this, void 0, void 0, function () {
12278
12376
  var vw, vh, ctx, thresholdsProvided, brightnessResults, brightness, range, variance, prediction, processed, e_1;
@@ -12286,21 +12384,19 @@ function SelfieGuidanceModelsProvider(_a) {
12286
12384
  ctx = canvasRef.current.getContext('2d');
12287
12385
  canvasRef.current.width = vw;
12288
12386
  canvasRef.current.height = vh;
12289
- if (!(ctx && videoRef.current.readyState === 4)) return [3 /*break*/, 5];
12387
+ if (!(ctx && videoRef.current.readyState === 4)) return [3 /*break*/, 4];
12290
12388
  ctx.translate(vw, 0);
12291
12389
  ctx.scale(-1, 1);
12292
12390
  ctx.drawImage(videoRef.current, 0, 0, vw, vh);
12293
12391
  _c.label = 1;
12294
12392
  case 1:
12295
- _c.trys.push([1, 4,, 5]);
12393
+ _c.trys.push([1, 3,, 4]);
12296
12394
  thresholdsProvided = minCaptureBrightnessThreshold !== undefined || minCaptureRangeThreshold !== undefined || minCaptureVarianceThreshold !== undefined;
12297
12395
  brightnessResults = thresholdsProvided ? detectBrightnessAndContrast(canvasRef.current, addToAverage) : undefined;
12298
12396
  brightness = brightnessResults === null || brightnessResults === void 0 ? void 0 : brightnessResults.brightness;
12299
12397
  range = brightnessResults === null || brightnessResults === void 0 ? void 0 : brightnessResults.range;
12300
12398
  variance = brightnessResults === null || brightnessResults === void 0 ? void 0 : brightnessResults.variance;
12301
- return [4 /*yield*/, makeFacePredictionWithDocumentDetector(canvasRef.current)];
12302
- case 2:
12303
- prediction = _c.sent();
12399
+ prediction = makeFaceDetectorPrediction(canvasRef.current);
12304
12400
  processed = processFaceDetectorPrediction({
12305
12401
  faces: (_a = prediction === null || prediction === void 0 ? void 0 : prediction.faces) !== null && _a !== void 0 ? _a : [],
12306
12402
  videoWidth: vw,
@@ -12316,15 +12412,15 @@ function SelfieGuidanceModelsProvider(_a) {
12316
12412
  setLastFaceDetectionAt(new Date().getTime());
12317
12413
  // setLastPrediction(processed)
12318
12414
  return [4 /*yield*/, (_b = onPredictionHandler.current) === null || _b === void 0 ? void 0 : _b.call(onPredictionHandler, processed)];
12319
- case 3:
12415
+ case 2:
12320
12416
  // setLastPrediction(processed)
12321
12417
  _c.sent();
12322
- return [3 /*break*/, 5];
12323
- case 4:
12418
+ return [3 /*break*/, 4];
12419
+ case 3:
12324
12420
  e_1 = _c.sent();
12325
12421
  error('caught face detection error', e_1);
12326
- return [3 /*break*/, 5];
12327
- case 5:
12422
+ return [3 /*break*/, 4];
12423
+ case 4:
12328
12424
  return [2 /*return*/];
12329
12425
  }
12330
12426
  });
@@ -14861,8 +14957,7 @@ function VideoSignatureCaptureComponent(_a, ref) {
14861
14957
  var rightEdge = videoWidth * (1 - headTrackingBoundaryPercentage);
14862
14958
  var topEdge = videoHeight * headTrackingBoundaryPercentage;
14863
14959
  var bottomEdge = videoHeight * (1 - headTrackingBoundaryPercentage);
14864
- var nose = face === null || face === void 0 ? void 0 : face.keypoints[2];
14865
- var nearBoundary = !!face && !!nose && (headTrackingBoundaryType === 'nose' ? nose.x < leftEdge || nose.x > rightEdge || nose.y < topEdge || nose.y > bottomEdge : (face === null || face === void 0 ? void 0 : face.box.xMin) < leftEdge || (face === null || face === void 0 ? void 0 : face.box.xMax) > rightEdge || (face === null || face === void 0 ? void 0 : face.box.yMin) < topEdge || (face === null || face === void 0 ? void 0 : face.box.yMax) > bottomEdge);
14960
+ var nearBoundary = !!face && (headTrackingBoundaryType === 'nose' ? face.keypoints[2].x < leftEdge || face.keypoints[2].x > rightEdge || face.keypoints[2].y < topEdge || face.keypoints[2].y > bottomEdge : (face === null || face === void 0 ? void 0 : face.box.xMin) < leftEdge || (face === null || face === void 0 ? void 0 : face.box.xMax) > rightEdge || (face === null || face === void 0 ? void 0 : face.box.yMin) < topEdge || (face === null || face === void 0 ? void 0 : face.box.yMax) > bottomEdge);
14866
14961
  setLastFace(face);
14867
14962
  setHeadTrackingSatisfied(!!face && !nearBoundary);
14868
14963
  setNumFramesWithoutFaces(face ? 0 : function (n) {