@neofaceid/web-sdk 1.19.0 → 1.21.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.
@@ -3436,8 +3436,10 @@ const CALIBRATION = {
3436
3436
  // Evita rosto "colado" na câmera
3437
3437
  CENTER_X_THRESHOLD: 0.15,
3438
3438
  // Rosto deve estar centralizado (desvio max 15%)
3439
- CENTER_Y_THRESHOLD: 0.2
3439
+ CENTER_Y_THRESHOLD: 0.2,
3440
3440
  // Rosto deve estar centralizado verticalmente
3441
+ STEP_TIMEOUT: 2e4
3442
+ // 20 segundos para realizar cada movimento
3441
3443
  };
3442
3444
  function BiometricRegistrationModal({
3443
3445
  personData,
@@ -3455,6 +3457,7 @@ function BiometricRegistrationModal({
3455
3457
  const isCapturingRef = useRef(false);
3456
3458
  const currentStepRef = useRef("center");
3457
3459
  const watchdogTimerRef = useRef(null);
3460
+ const stepTimeoutTimerRef = useRef(null);
3458
3461
  const detectionStartedRef = useRef(false);
3459
3462
  const captureStateRef = useRef(null);
3460
3463
  const [state, dispatch] = useReducer(modalReducer, initialState);
@@ -3482,6 +3485,18 @@ function BiometricRegistrationModal({
3482
3485
  currentStepIndex: state.currentStepIndex,
3483
3486
  capturedPhotos: state.capturedPhotos
3484
3487
  };
3488
+ if (stepTimeoutTimerRef.current) {
3489
+ clearTimeout(stepTimeoutTimerRef.current);
3490
+ }
3491
+ if (state.step !== "complete") {
3492
+ stepTimeoutTimerRef.current = window.setTimeout(() => {
3493
+ dispatch({
3494
+ type: "ERROR",
3495
+ message: "Tempo limite atingido para o movimento. Por favor, tente novamente em um ambiente bem iluminado.",
3496
+ retryable: true
3497
+ });
3498
+ }, CALIBRATION.STEP_TIMEOUT);
3499
+ }
3485
3500
  }
3486
3501
  }, [
3487
3502
  state.status,
@@ -3627,6 +3642,10 @@ function BiometricRegistrationModal({
3627
3642
  clearInterval(progressIntervalRef.current);
3628
3643
  progressIntervalRef.current = null;
3629
3644
  }
3645
+ if (stepTimeoutTimerRef.current) {
3646
+ clearTimeout(stepTimeoutTimerRef.current);
3647
+ stepTimeoutTimerRef.current = null;
3648
+ }
3630
3649
  };
3631
3650
  }, []);
3632
3651
  useEffect(() => {
@@ -3740,8 +3759,10 @@ function BiometricRegistrationModal({
3740
3759
  const detection = await faceapi.detectSingleFace(
3741
3760
  videoRef.current,
3742
3761
  new faceapi.TinyFaceDetectorOptions({
3743
- inputSize: 160,
3744
- scoreThreshold: 0.4
3762
+ inputSize: 224,
3763
+ // Aumentado para detectar rostos menores/mais distantes
3764
+ scoreThreshold: 0.35
3765
+ // Ligeiramente mais sensível
3745
3766
  })
3746
3767
  ).withFaceLandmarks();
3747
3768
  if (!isRunning) return;
@@ -3940,40 +3961,25 @@ function BiometricRegistrationModal({
3940
3961
  const stepProgress = state.stepProgress;
3941
3962
  return /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "liveness-container", children: [
3942
3963
  /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "progress-indicator", children: /* @__PURE__ */ jsxRuntimeExports.jsx("span", { className: "progress-text", children: progress }) }),
3943
- faceDetected && faceDistance !== "ok" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `face-badge ${faceDistance === "not-centered" ? "warning" : "error"}`, children: [
3964
+ faceDetected && faceDistance !== "ok" && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: `status-badge ${faceDistance === "not-centered" ? "warning" : "error"}`, children: [
3944
3965
  faceDistance === "too-far" && "Aproxime-se mais",
3945
- faceDistance === "too-close" && "Rosto muito perto",
3966
+ faceDistance === "too-close" && "Afaste-se um pouco",
3946
3967
  faceDistance === "not-centered" && "Centralize seu rosto"
3947
3968
  ] }),
3948
- /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "video-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsxs(
3969
+ /* @__PURE__ */ jsxRuntimeExports.jsx("div", { className: "video-wrapper", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3949
3970
  "div",
3950
3971
  {
3951
- className: `video-circle ${faceDetected ? "face-detected" : ""} ${stepProgress > 0 ? "capturing" : ""}`,
3952
- children: [
3953
- /* @__PURE__ */ jsxRuntimeExports.jsx(
3954
- "video",
3955
- {
3956
- ref: videoRef,
3957
- className: `video-feed ${cameraReady ? "ready" : ""}`,
3958
- autoPlay: true,
3959
- muted: true,
3960
- playsInline: true
3961
- }
3962
- ),
3963
- faceDetected && /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "face-badge", children: [
3964
- /* @__PURE__ */ jsxRuntimeExports.jsx("svg", { width: "16", height: "16", viewBox: "0 0 20 20", fill: "none", children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3965
- "path",
3966
- {
3967
- d: "M5 10 L8 13 L15 6",
3968
- stroke: "currentColor",
3969
- strokeWidth: "2.5",
3970
- strokeLinecap: "round",
3971
- strokeLinejoin: "round"
3972
- }
3973
- ) }),
3974
- /* @__PURE__ */ jsxRuntimeExports.jsx("span", { children: "Rosto detectado" })
3975
- ] })
3976
- ]
3972
+ className: `video-circle ${faceDetected && faceDistance === "ok" ? "face-detected" : ""} ${stepProgress > 0 ? "capturing" : ""}`,
3973
+ children: /* @__PURE__ */ jsxRuntimeExports.jsx(
3974
+ "video",
3975
+ {
3976
+ ref: videoRef,
3977
+ className: `video-feed ${cameraReady ? "ready" : ""}`,
3978
+ autoPlay: true,
3979
+ muted: true,
3980
+ playsInline: true
3981
+ }
3982
+ )
3977
3983
  }
3978
3984
  ) }),
3979
3985
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "instruction-box", children: [
@@ -4458,11 +4464,14 @@ function BiometricRegistrationModal({
4458
4464
  }
4459
4465
 
4460
4466
  .face-badge {
4467
+ display: none; /* Removido por ser redundante com o oval verde */
4468
+ }
4469
+
4470
+ .status-badge {
4461
4471
  position: absolute;
4462
- top: 20px;
4472
+ top: 72px; /* Logo abaixo do progress-indicator */
4463
4473
  left: 50%;
4464
4474
  transform: translateX(-50%);
4465
- background: rgba(16, 185, 129, 0.95);
4466
4475
  backdrop-filter: blur(10px);
4467
4476
  border-radius: 20px;
4468
4477
  padding: 8px 16px;
@@ -4473,22 +4482,30 @@ function BiometricRegistrationModal({
4473
4482
  font-size: 13px;
4474
4483
  font-weight: 600;
4475
4484
  border: 1px solid rgba(255, 255, 255, 0.3);
4476
- box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
4485
+ box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
4477
4486
  animation: slideDown 0.3s ease-out;
4487
+ z-index: 10;
4488
+ white-space: nowrap;
4478
4489
  }
4479
4490
 
4480
- .face-badge.warning {
4491
+ .status-badge.info {
4492
+ background: rgba(255, 255, 255, 0.15);
4493
+ color: white;
4494
+ border-color: rgba(255, 255, 255, 0.1);
4495
+ }
4496
+
4497
+ .status-badge.warning {
4481
4498
  background: rgba(251, 191, 36, 0.95);
4482
- border: 1px solid rgba(255, 255, 255, 0.3);
4483
- box-shadow: 0 4px 12px rgba(251, 191, 36, 0.3);
4484
4499
  color: #78350f;
4500
+ border-color: rgba(0, 0, 0, 0.1);
4501
+ box-shadow: 0 4px 15px rgba(251, 191, 36, 0.2);
4485
4502
  }
4486
4503
 
4487
- .face-badge.error {
4504
+ .status-badge.error {
4488
4505
  background: rgba(239, 68, 68, 0.95);
4489
- border: 1px solid rgba(255, 255, 255, 0.3);
4490
- box-shadow: 0 4px 12px rgba(239, 68, 68, 0.3);
4491
4506
  color: white;
4507
+ border-color: rgba(255, 255, 255, 0.2);
4508
+ box-shadow: 0 4px 15px rgba(239, 68, 68, 0.2);
4492
4509
  }
4493
4510
 
4494
4511
  .instruction-box {
@@ -6885,7 +6902,7 @@ const biometricDetection = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.
6885
6902
  initializeBiometricDetection,
6886
6903
  isAdvancedDetectionAvailable
6887
6904
  }, Symbol.toStringTag, { value: "Module" }));
6888
- const VERSION = "1.19.0";
6905
+ const VERSION = "1.21.0";
6889
6906
  const RELEASE_DATE = "2026-03-13";
6890
6907
  class OnboardingCaptureModal {
6891
6908
  constructor(options) {