@neofaceid/web-sdk 1.35.0 → 1.35.1

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/index.d.ts CHANGED
@@ -1634,7 +1634,7 @@ export declare const validateToken: (applicationToken: string) => Promise<boolea
1634
1634
  * MINOR: Incrementado quando adicionamos funcionalidades mantendo compatibilidade
1635
1635
  * PATCH: Incrementado quando corrigimos bugs mantendo compatibilidade
1636
1636
  */
1637
- export declare const VERSION = "1.35.0";
1637
+ export declare const VERSION = "1.35.1";
1638
1638
 
1639
1639
  /**
1640
1640
  * Executa `fn(sessionId)`. Se o servidor devolver 410 (sessão consumida/expirada),
@@ -10866,7 +10866,7 @@ const biometricDetection = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.
10866
10866
  initializeBiometricDetection,
10867
10867
  isAdvancedDetectionAvailable
10868
10868
  }, Symbol.toStringTag, { value: "Module" }));
10869
- const VERSION = "1.35.0";
10869
+ const VERSION = "1.35.1";
10870
10870
  const RELEASE_DATE = "2026-09-02";
10871
10871
  let cachedSession = null;
10872
10872
  function getCachedCaptureSession() {
@@ -10894,7 +10894,9 @@ async function openCaptureSession({
10894
10894
  "Content-Type": "application/json",
10895
10895
  "X-App-Token": applicationToken
10896
10896
  },
10897
- body: JSON.stringify({ purpose })
10897
+ // NEO-424 · backend real aceita apenas valores em UPPERCASE
10898
+ // (`AUTHORIZATION`, `LOGIN`, `ONBOARDING`, …). API pública mantém lowercase.
10899
+ body: JSON.stringify({ purpose: String(purpose).toUpperCase() })
10898
10900
  });
10899
10901
  } catch (err) {
10900
10902
  const message = err instanceof Error ? err.message : "Erro de rede";
@@ -10912,16 +10914,20 @@ async function openCaptureSession({
10912
10914
  const raw = await response.json().catch(() => null);
10913
10915
  const payload = (raw == null ? void 0 : raw.data) ?? raw;
10914
10916
  const sessionId = payload == null ? void 0 : payload.session_id;
10915
- const expiresAt = payload == null ? void 0 : payload.expires_at;
10916
- if (!sessionId || !expiresAt) {
10917
+ if (!sessionId) {
10917
10918
  throw new NeoFaceError(
10918
- "Resposta inválida ao abrir sessão de captura (campos ausentes)",
10919
+ "Resposta inválida ao abrir sessão de captura (session_id ausente)",
10919
10920
  ErrorType.API_ERROR
10920
10921
  );
10921
10922
  }
10923
+ const expiresAt = typeof (payload == null ? void 0 : payload.expires_at) === "string" && payload.expires_at.length > 0 ? payload.expires_at : deriveExpiresAt(payload == null ? void 0 : payload.expires_in);
10922
10924
  cachedSession = { session_id: sessionId, expires_at: expiresAt };
10923
10925
  return cachedSession;
10924
10926
  }
10927
+ function deriveExpiresAt(expiresIn) {
10928
+ const seconds = typeof expiresIn === "number" && Number.isFinite(expiresIn) ? expiresIn : 0;
10929
+ return new Date(Date.now() + seconds * 1e3).toISOString();
10930
+ }
10925
10931
  async function withCaptureSession(params, fn) {
10926
10932
  const session = cachedSession ?? await openCaptureSession(params);
10927
10933
  try {