@neofaceid/web-sdk 1.42.2 → 1.42.3

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
@@ -2032,7 +2032,7 @@ export declare const validateToken: (applicationToken: string) => Promise<boolea
2032
2032
  * MINOR: Incrementado quando adicionamos funcionalidades mantendo compatibilidade
2033
2033
  * PATCH: Incrementado quando corrigimos bugs mantendo compatibilidade
2034
2034
  */
2035
- export declare const VERSION = "1.42.2";
2035
+ export declare const VERSION = "1.42.3";
2036
2036
 
2037
2037
  /**
2038
2038
  * Executa `fn(sessionId)`. Se o servidor devolver 410 (sessão consumida/expirada),
@@ -6083,7 +6083,11 @@ const recordFaceVideo = async (options = {}) => {
6083
6083
  const pollTaskStatus = async (taskId, applicationToken, options = {}) => {
6084
6084
  var _a2, _b, _c, _d, _e, _f, _g, _h, _i, _j;
6085
6085
  const { maxAttempts = 60, intervalMs = 1e3, onStatusChange } = options;
6086
+ const wait = () => new Promise((resolve) => {
6087
+ setTimeout(resolve, intervalMs);
6088
+ });
6086
6089
  let attempts = 0;
6090
+ let lastTransient = "";
6087
6091
  while (attempts < maxAttempts) {
6088
6092
  attempts++;
6089
6093
  try {
@@ -6094,8 +6098,22 @@ const pollTaskStatus = async (taskId, applicationToken, options = {}) => {
6094
6098
  "X-App-Token": applicationToken
6095
6099
  }
6096
6100
  });
6101
+ if (response.status === 404) {
6102
+ throw new NeoFaceError(
6103
+ "Não foi possível recuperar o andamento deste processo. Ele pode já ter sido concluído há algum tempo, ou nunca ter existido.",
6104
+ ErrorType.NOT_FOUND
6105
+ );
6106
+ }
6107
+ if (response.status >= 500) {
6108
+ lastTransient = `HTTP ${response.status}`;
6109
+ await wait();
6110
+ continue;
6111
+ }
6112
+ if (response.status === 401 || response.status === 403) {
6113
+ throw new NeoFaceError("Invalid application token", ErrorType.INVALID_TOKEN);
6114
+ }
6097
6115
  if (!response.ok) {
6098
- throw new NeoFaceError(`Task status check failed: ${response.status}`, ErrorType.NETWORK);
6116
+ throw new NeoFaceError(`Task status check failed: ${response.status}`, ErrorType.API_ERROR);
6099
6117
  }
6100
6118
  const data = await response.json();
6101
6119
  const status = ((_a2 = data.data) == null ? void 0 : _a2.status) || "unknown";
@@ -6117,18 +6135,19 @@ const pollTaskStatus = async (taskId, applicationToken, options = {}) => {
6117
6135
  const reason = ((_h = (_g = data.data) == null ? void 0 : _g.result) == null ? void 0 : _h.message) || ((_i = data.data) == null ? void 0 : _i.error) || ((_j = data.data) == null ? void 0 : _j.message) || data.message || "Task failed";
6118
6136
  throw new NeoFaceError(reason, ErrorType.RECOGNITION_FAILED);
6119
6137
  }
6120
- await new Promise((resolve) => setTimeout(resolve, intervalMs));
6138
+ await wait();
6121
6139
  } catch (error) {
6122
6140
  if (error instanceof NeoFaceError) {
6123
6141
  throw error;
6124
6142
  }
6125
- throw new NeoFaceError(
6126
- `Polling error: ${error instanceof Error ? error.message : "Unknown error"}`,
6127
- ErrorType.NETWORK
6128
- );
6143
+ lastTransient = error instanceof Error ? error.message : "erro desconhecido";
6144
+ await wait();
6129
6145
  }
6130
6146
  }
6131
- throw new NeoFaceError("Task status polling timed out", ErrorType.NETWORK);
6147
+ throw new NeoFaceError(
6148
+ lastTransient ? `Task status polling timed out (última falha transitória: ${lastTransient})` : "Task status polling timed out",
6149
+ ErrorType.NETWORK
6150
+ );
6132
6151
  };
6133
6152
  const startProofOfLife = async (videoBase64, applicationToken) => {
6134
6153
  var _a2;
@@ -8867,7 +8886,7 @@ function BiometricRegistrationModal({
8867
8886
  /* @__PURE__ */ jsx("canvas", { ref: canvasRef })
8868
8887
  ] });
8869
8888
  }
8870
- const VERSION = "1.42.2";
8889
+ const VERSION = "1.42.3";
8871
8890
  const RELEASE_DATE = "2026-09-14";
8872
8891
  const CONSENT_TRAIL_STORAGE_KEY = "neoface_consent_trail_v1";
8873
8892
  const CONSENT_TRAIL_MAX_LIMIT = 100;