@neofaceid/web-sdk 1.21.0 → 1.23.0

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.
@@ -3430,16 +3430,14 @@ const CALIBRATION = {
3430
3430
  CAPTURE_HOLD_TIME: 1500,
3431
3431
  DETECTION_INTERVAL: 150,
3432
3432
  // Um pouco mais rápido para melhor resposta
3433
- MIN_FACE_WIDTH: 160,
3434
- // Rosto deve ocupar boa parte do oval (era ~120 implícito)
3435
- MAX_FACE_WIDTH: 280,
3436
- // Evita rosto "colado" na câmera
3437
- CENTER_X_THRESHOLD: 0.15,
3438
- // Rosto deve estar centralizado (desvio max 15%)
3439
- CENTER_Y_THRESHOLD: 0.2,
3440
- // Rosto deve estar centralizado verticalmente
3433
+ MIN_FACE_PERCENT: 0.35,
3434
+ // Rosto deve ocupar pelo menos 35% da largura do vídeo
3435
+ MAX_FACE_PERCENT: 0.65,
3436
+ // Rosto pode ocupar até 65% da largura do vídeo
3437
+ CENTER_X_THRESHOLD: 0.18,
3438
+ // Ligeiramente mais tolerante na centralização
3439
+ CENTER_Y_THRESHOLD: 0.22,
3441
3440
  STEP_TIMEOUT: 2e4
3442
- // 20 segundos para realizar cada movimento
3443
3441
  };
3444
3442
  function BiometricRegistrationModal({
3445
3443
  personData,
@@ -3537,9 +3535,14 @@ function BiometricRegistrationModal({
3537
3535
  return null;
3538
3536
  }
3539
3537
  };
3540
- const checkFacePosition = (box, videoWidth, videoHeight) => {
3541
- if (box.width < CALIBRATION.MIN_FACE_WIDTH) return "too-far";
3542
- if (box.width > CALIBRATION.MAX_FACE_WIDTH) return "too-close";
3538
+ const checkFacePosition = (detection) => {
3539
+ if (!detection || !videoRef.current) return "not-detected";
3540
+ const { box } = detection.detection;
3541
+ const videoWidth = videoRef.current.videoWidth || 640;
3542
+ const videoHeight = videoRef.current.videoHeight || 480;
3543
+ const faceWidthRatio = box.width / videoWidth;
3544
+ if (faceWidthRatio < CALIBRATION.MIN_FACE_PERCENT) return "too-far";
3545
+ if (faceWidthRatio > CALIBRATION.MAX_FACE_PERCENT) return "too-close";
3543
3546
  const faceCenterX = box.x + box.width / 2;
3544
3547
  const faceCenterY = box.y + box.height / 2;
3545
3548
  const deviationX = Math.abs(faceCenterX - videoWidth / 2) / videoWidth;
@@ -3769,13 +3772,10 @@ function BiometricRegistrationModal({
3769
3772
  const hasFace = !!detection;
3770
3773
  setFaceDetected(hasFace);
3771
3774
  if (hasFace && detection.detection) {
3772
- const video2 = videoRef.current;
3773
- const positionStatus = checkFacePosition(
3774
- detection.detection.box,
3775
- video2.videoWidth,
3776
- video2.videoHeight
3777
- );
3778
- setFaceDistance(positionStatus);
3775
+ const positionStatus = checkFacePosition(detection);
3776
+ if (positionStatus !== "not-detected") {
3777
+ setFaceDistance(positionStatus);
3778
+ }
3779
3779
  if (positionStatus !== "ok") {
3780
3780
  manageHoldAndCapture(false);
3781
3781
  requestAnimationFrame(detectFace2);
@@ -6902,7 +6902,7 @@ const biometricDetection = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.
6902
6902
  initializeBiometricDetection,
6903
6903
  isAdvancedDetectionAvailable
6904
6904
  }, Symbol.toStringTag, { value: "Module" }));
6905
- const VERSION = "1.21.0";
6905
+ const VERSION = "1.23.0";
6906
6906
  const RELEASE_DATE = "2026-03-13";
6907
6907
  class OnboardingCaptureModal {
6908
6908
  constructor(options) {