@neofaceid/web-sdk 1.9.2 → 1.11.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.
@@ -219,9 +219,9 @@ function requireReactJsxRuntime_development() {
219
219
  case REACT_LAZY_TYPE: {
220
220
  var lazyComponent = type;
221
221
  var payload = lazyComponent._payload;
222
- var init = lazyComponent._init;
222
+ var init2 = lazyComponent._init;
223
223
  try {
224
- return getComponentNameFromType(init(payload));
224
+ return getComponentNameFromType(init2(payload));
225
225
  } catch (x) {
226
226
  return null;
227
227
  }
@@ -469,9 +469,9 @@ function requireReactJsxRuntime_development() {
469
469
  case REACT_LAZY_TYPE: {
470
470
  var lazyComponent = type;
471
471
  var payload = lazyComponent._payload;
472
- var init = lazyComponent._init;
472
+ var init2 = lazyComponent._init;
473
473
  try {
474
- return describeUnknownElementTypeFrameInDEV(init(payload), source, ownerFn);
474
+ return describeUnknownElementTypeFrameInDEV(init2(payload), source, ownerFn);
475
475
  } catch (x) {
476
476
  }
477
477
  }
@@ -1124,7 +1124,7 @@ var ErrorType = /* @__PURE__ */ ((ErrorType2) => {
1124
1124
  class NeoFaceError extends Error {
1125
1125
  /**
1126
1126
  * Constrói um erro do SDK com mensagem e tipo categórico.
1127
- * @param message Mensagem descritiva do erro
1127
+ * @param message Mensagem descritiva do erro (pode ser técnica)
1128
1128
  * @param type Tipo categórico do erro
1129
1129
  */
1130
1130
  constructor(message, type) {
@@ -1133,9 +1133,95 @@ class NeoFaceError extends Error {
1133
1133
  this.name = type;
1134
1134
  this.type = type;
1135
1135
  }
1136
+ /**
1137
+ * Retorna uma mensagem amigável para o usuário final, ocultando termos técnicos.
1138
+ */
1139
+ getFriendlyMessage() {
1140
+ if (/[áéíóúãõç]/i.test(this.message)) {
1141
+ return this.message;
1142
+ }
1143
+ switch (this.type) {
1144
+ case "NetworkError":
1145
+ if (this.message.includes("timeout")) return "A conexão demorou muito. Tente novamente.";
1146
+ return "Não foi possível conectar ao servidor. Verifique sua internet.";
1147
+ case "InvalidTokenError":
1148
+ return "Falha na autenticação do aplicativo. Entre em contato com o suporte.";
1149
+ case "CameraError":
1150
+ case "NoCameraError":
1151
+ return "Não conseguimos acessar sua câmera. Verifique as permissões do navegador.";
1152
+ case "LoginFailedError":
1153
+ case "RecognitionFailedError":
1154
+ return "Não foi possível reconhecer seu rosto. Tente se posicionar em um local mais iluminado.";
1155
+ case "ValidationError":
1156
+ return "Dados inválidos ou rosto não detectado corretamente.";
1157
+ case "ApiError":
1158
+ if (this.message.includes("400")) return "Requisição inválida. Tente novamente.";
1159
+ if (this.message.includes("500")) return "Ocorreu um erro interno no sistema. Tente mais tarde.";
1160
+ return "O serviço encontrou um problema inesperado.";
1161
+ default:
1162
+ return "Ocorreu um erro inesperado. Por favor, tente novamente.";
1163
+ }
1164
+ }
1136
1165
  }
1137
- const __vite_import_meta_env__$1 = {};
1138
- const API_BASE_URL = (__vite_import_meta_env__$1 == null ? void 0 : __vite_import_meta_env__$1.VITE_API_BASE_URL) || "https://sandbox-core.neofaceid.com";
1166
+ const __vite_import_meta_env__ = {};
1167
+ const ENVIRONMENT_URLS = {
1168
+ development: "http://localhost:8000",
1169
+ sandbox: "https://sandbox-core.neofaceid.com",
1170
+ production: "https://core.neofaceid.com.br"
1171
+ };
1172
+ let globalConfig = {
1173
+ baseUrl: ENVIRONMENT_URLS.sandbox,
1174
+ // Default para sandbox
1175
+ applicationToken: null,
1176
+ environment: "sandbox",
1177
+ initialized: false
1178
+ };
1179
+ function init(options = {}) {
1180
+ const { environment, baseUrl, applicationToken } = options;
1181
+ if (baseUrl) {
1182
+ globalConfig.baseUrl = baseUrl;
1183
+ globalConfig.environment = "custom";
1184
+ } else if (environment) {
1185
+ if (!ENVIRONMENT_URLS[environment]) {
1186
+ console.warn(`[NeoFaceID SDK] Ambiente '${environment}' não reconhecido. Usando 'sandbox'.`);
1187
+ globalConfig.baseUrl = ENVIRONMENT_URLS.sandbox;
1188
+ globalConfig.environment = "sandbox";
1189
+ } else {
1190
+ globalConfig.baseUrl = ENVIRONMENT_URLS[environment];
1191
+ globalConfig.environment = environment;
1192
+ }
1193
+ } else {
1194
+ const envUrl = typeof import.meta !== "undefined" && (__vite_import_meta_env__ == null ? void 0 : __vite_import_meta_env__.VITE_API_BASE_URL);
1195
+ if (envUrl) {
1196
+ globalConfig.baseUrl = envUrl;
1197
+ globalConfig.environment = "custom";
1198
+ }
1199
+ }
1200
+ if (applicationToken) {
1201
+ globalConfig.applicationToken = applicationToken;
1202
+ }
1203
+ globalConfig.initialized = true;
1204
+ console.log(`[NeoFaceID SDK] Inicializado - Ambiente: ${globalConfig.environment}, URL: ${globalConfig.baseUrl}`);
1205
+ }
1206
+ function getBaseUrl() {
1207
+ if (!globalConfig.initialized) {
1208
+ console.warn("[NeoFaceID SDK] SDK não foi inicializado. Usando configuração padrão (sandbox).");
1209
+ }
1210
+ return globalConfig.baseUrl;
1211
+ }
1212
+ function getApplicationToken() {
1213
+ return globalConfig.applicationToken;
1214
+ }
1215
+ function getEnvironment() {
1216
+ return globalConfig.environment;
1217
+ }
1218
+ function isInitialized() {
1219
+ return globalConfig.initialized;
1220
+ }
1221
+ function getConfig() {
1222
+ return { ...globalConfig };
1223
+ }
1224
+ const getApiBaseUrl = () => getBaseUrl();
1139
1225
  const REQUEST_TIMEOUT = 1e4;
1140
1226
  const ensureSecureContext = () => {
1141
1227
  const isLocalhost = window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname === "";
@@ -1225,7 +1311,7 @@ const validateToken = async (applicationToken) => {
1225
1311
  ensureSecureContext();
1226
1312
  const controller = createTimeoutController();
1227
1313
  try {
1228
- const response = await fetch(`${API_BASE_URL}/api/v1/auth/application/validate_token/`, {
1314
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/auth/application/validate_token/`, {
1229
1315
  method: "POST",
1230
1316
  headers: {
1231
1317
  "Content-Type": "application/json",
@@ -1234,15 +1320,18 @@ const validateToken = async (applicationToken) => {
1234
1320
  body: JSON.stringify({}),
1235
1321
  signal: controller.signal
1236
1322
  });
1323
+ if (!response.ok) {
1324
+ throw new NeoFaceError(`API Error ${response.status}`, ErrorType.INVALID_TOKEN);
1325
+ }
1237
1326
  return response.ok;
1238
1327
  } catch (error) {
1239
1328
  if (error instanceof Error) {
1240
1329
  if (error.name === "AbortError") {
1241
- throw new NeoFaceError("Request timed out", ErrorType.NETWORK_ERROR);
1330
+ throw new NeoFaceError("Request timeout", ErrorType.NETWORK_ERROR);
1242
1331
  }
1243
1332
  throw new NeoFaceError(error.message, ErrorType.NETWORK_ERROR);
1244
1333
  }
1245
- throw new NeoFaceError("Unknown error occurred", ErrorType.NETWORK_ERROR);
1334
+ throw new NeoFaceError("Unknown error", ErrorType.NETWORK_ERROR);
1246
1335
  }
1247
1336
  };
1248
1337
  const getOnboardingDetails = async (applicationToken, onboardingToken) => {
@@ -1250,7 +1339,7 @@ const getOnboardingDetails = async (applicationToken, onboardingToken) => {
1250
1339
  const controller = createTimeoutController();
1251
1340
  try {
1252
1341
  const response = await fetch(
1253
- `${API_BASE_URL}/api/v1/onboardings/${encodeURIComponent(onboardingToken)}/`,
1342
+ `${getApiBaseUrl()}/api/v1/onboardings/${encodeURIComponent(onboardingToken)}/`,
1254
1343
  {
1255
1344
  method: "GET",
1256
1345
  headers: {
@@ -1288,7 +1377,7 @@ const validateOnboardingToken = async (applicationToken, onboardingToken) => {
1288
1377
  const controller = createTimeoutController();
1289
1378
  try {
1290
1379
  const response = await fetch(
1291
- `${API_BASE_URL}/api/v1/onboardings/${encodeURIComponent(onboardingToken)}/`,
1380
+ `${getApiBaseUrl()}/api/v1/onboardings/${encodeURIComponent(onboardingToken)}/`,
1292
1381
  {
1293
1382
  method: "GET",
1294
1383
  headers: {
@@ -1331,7 +1420,7 @@ const completeOnboarding = async (applicationToken, onboardingToken, faceImage,
1331
1420
  formData.append("face_image", compressedFace, "face.jpg");
1332
1421
  formData.append("document_image", compressedDocument, "document.jpg");
1333
1422
  const response = await fetch(
1334
- `${API_BASE_URL}/api/v1/onboardings/${encodeURIComponent(onboardingToken)}/complete`,
1423
+ `${getApiBaseUrl()}/api/v1/onboardings/${encodeURIComponent(onboardingToken)}/complete`,
1335
1424
  {
1336
1425
  method: "POST",
1337
1426
  headers: {
@@ -1408,7 +1497,7 @@ const completeOnboardingWithData = async (applicationToken, onboardingToken, per
1408
1497
  formData.append("email", personData.email);
1409
1498
  }
1410
1499
  const response = await fetch(
1411
- `${API_BASE_URL}/api/v1/onboardings/${encodeURIComponent(onboardingToken)}/complete`,
1500
+ `${getApiBaseUrl()}/api/v1/onboardings/${encodeURIComponent(onboardingToken)}/complete`,
1412
1501
  {
1413
1502
  method: "POST",
1414
1503
  headers: {
@@ -1462,7 +1551,7 @@ const recognize = async (image, applicationToken) => {
1462
1551
  try {
1463
1552
  const formData = new FormData();
1464
1553
  formData.append("face_frames", compressedImage);
1465
- const response = await fetch(`${API_BASE_URL}/api/v1/external/recognition/face/`, {
1554
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/external/recognition/face/`, {
1466
1555
  method: "POST",
1467
1556
  headers: {
1468
1557
  "X-App-Token": applicationToken
@@ -1497,7 +1586,7 @@ const recognize = async (image, applicationToken) => {
1497
1586
  throw new NeoFaceError("Unknown error occurred", ErrorType.NETWORK_ERROR);
1498
1587
  }
1499
1588
  };
1500
- const loginWithBiometric$1 = async (image, applicationToken) => {
1589
+ const loginWithBiometric = async (image, applicationToken) => {
1501
1590
  var _a, _b, _c, _d, _e;
1502
1591
  ensureSecureContext();
1503
1592
  const controller = createTimeoutController();
@@ -1507,7 +1596,7 @@ const loginWithBiometric$1 = async (image, applicationToken) => {
1507
1596
  const base64Image = btoa(
1508
1597
  new Uint8Array(arrayBuffer).reduce((data2, byte) => data2 + String.fromCharCode(byte), "")
1509
1598
  );
1510
- const response = await fetch(`${API_BASE_URL}/api/v1/login/donor/face/`, {
1599
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/login/donor/face/`, {
1511
1600
  method: "POST",
1512
1601
  headers: {
1513
1602
  "Content-Type": "application/json",
@@ -1521,9 +1610,12 @@ const loginWithBiometric$1 = async (image, applicationToken) => {
1521
1610
  });
1522
1611
  if (!response.ok) {
1523
1612
  if (response.status === 401 || response.status === 403) {
1524
- throw new NeoFaceError("Invalid or expired application token", ErrorType.INVALID_TOKEN);
1613
+ throw new NeoFaceError("Invalid application token", ErrorType.INVALID_TOKEN);
1525
1614
  }
1526
- throw new NeoFaceError(`Server returned status ${response.status}`, ErrorType.NETWORK);
1615
+ if (response.status >= 500) {
1616
+ throw new NeoFaceError(`Server Error ${response.status}`, ErrorType.API_ERROR);
1617
+ }
1618
+ throw new NeoFaceError(`API Error ${response.status}`, ErrorType.API_ERROR);
1527
1619
  }
1528
1620
  const data = await response.json();
1529
1621
  if (!data.success) {
@@ -1569,7 +1661,7 @@ const recognizeBiometric = async (image, applicationToken, livenessCheck = true,
1569
1661
  formData.append("face_frames", compressedImage);
1570
1662
  formData.append("liveness_check", livenessCheck.toString());
1571
1663
  formData.append("confidence_threshold", confidenceThreshold.toString());
1572
- const response = await fetch(`${API_BASE_URL}/api/v1/external/recognition/biometric/`, {
1664
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/external/recognition/biometric/`, {
1573
1665
  method: "POST",
1574
1666
  headers: {
1575
1667
  "X-App-Token": applicationToken
@@ -1608,7 +1700,7 @@ const simpleIdentification = async (documentType, documentNumber, applicationTok
1608
1700
  ensureSecureContext();
1609
1701
  const controller = createTimeoutController();
1610
1702
  try {
1611
- const response = await fetch(`${API_BASE_URL}/api/v1/external/recognition/simple/`, {
1703
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/external/recognition/simple/`, {
1612
1704
  method: "POST",
1613
1705
  headers: {
1614
1706
  "Content-Type": "application/json",
@@ -1674,7 +1766,7 @@ const recognizeByPurpose = async (image, applicationToken, purpose, confidenceTh
1674
1766
  if (signature) {
1675
1767
  requestBody.signature = signature;
1676
1768
  }
1677
- const response = await fetch(`${API_BASE_URL}/api/v1/external/recognition/purpose/`, {
1769
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/external/recognition/purpose/`, {
1678
1770
  method: "POST",
1679
1771
  headers: {
1680
1772
  "Content-Type": "application/json",
@@ -1755,7 +1847,7 @@ const registerPersonWithoutFace = async (personData, applicationToken, options)
1755
1847
  type: (options == null ? void 0 : options.documentType) || "RG"
1756
1848
  }];
1757
1849
  }
1758
- const response = await fetch(`${API_BASE_URL}/api/v1/signup/donor/`, {
1850
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/signup/donor/`, {
1759
1851
  method: "POST",
1760
1852
  headers: {
1761
1853
  "Content-Type": "application/json",
@@ -1849,7 +1941,7 @@ const registerPersonWithBiometric = async (personData, facePhotos, applicationTo
1849
1941
  type: (options == null ? void 0 : options.documentType) || "RG"
1850
1942
  }];
1851
1943
  }
1852
- const response = await fetch(`${API_BASE_URL}/api/v1/signup/donor/`, {
1944
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/signup/donor/`, {
1853
1945
  method: "POST",
1854
1946
  headers: {
1855
1947
  "Content-Type": "application/json",
@@ -1935,7 +2027,7 @@ const loginWithEmail = async (email, password, applicationToken) => {
1935
2027
  ensureSecureContext();
1936
2028
  const controller = createTimeoutController();
1937
2029
  try {
1938
- const response = await fetch(`${API_BASE_URL}/api/v1/auth/login/`, {
2030
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/auth/login/`, {
1939
2031
  method: "POST",
1940
2032
  headers: {
1941
2033
  "Content-Type": "application/json",
@@ -1946,9 +2038,9 @@ const loginWithEmail = async (email, password, applicationToken) => {
1946
2038
  });
1947
2039
  if (!response.ok) {
1948
2040
  if (response.status === 401 || response.status === 403) {
1949
- throw new NeoFaceError("Invalid credentials or application token", ErrorType.INVALID_TOKEN);
2041
+ throw new NeoFaceError("Email ou senha inválidos", ErrorType.INVALID_TOKEN);
1950
2042
  }
1951
- throw new NeoFaceError(`Server returned status ${response.status}`, ErrorType.NETWORK);
2043
+ throw new NeoFaceError(`API Error ${response.status}`, ErrorType.API_ERROR);
1952
2044
  }
1953
2045
  const data = await response.json();
1954
2046
  return {
@@ -1992,7 +2084,7 @@ const identifyPerson = async (image, applicationToken) => {
1992
2084
  reader.readAsDataURL(compressedImage);
1993
2085
  });
1994
2086
  try {
1995
- const response = await fetch(`${API_BASE_URL}/api/v1/external/recognition/face/`, {
2087
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/external/recognition/face/`, {
1996
2088
  method: "POST",
1997
2089
  headers: {
1998
2090
  "Content-Type": "application/json",
@@ -2069,7 +2161,7 @@ const registerBiometric = async (personId, faceImage, applicationToken) => {
2069
2161
  reader.readAsDataURL(compressedImage);
2070
2162
  });
2071
2163
  try {
2072
- const response = await fetch(`${API_BASE_URL}/api/v1/identity-data/`, {
2164
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/identity-data/`, {
2073
2165
  method: "POST",
2074
2166
  headers: {
2075
2167
  "Content-Type": "application/json",
@@ -2129,7 +2221,7 @@ const registerApplication = async (jwtToken, consumerId, applicationData) => {
2129
2221
  ensureSecureContext();
2130
2222
  const controller = createTimeoutController();
2131
2223
  try {
2132
- const response = await fetch(`${API_BASE_URL}/api/v1/applications/`, {
2224
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/applications/`, {
2133
2225
  method: "POST",
2134
2226
  headers: {
2135
2227
  "Content-Type": "application/json",
@@ -2284,7 +2376,7 @@ const pollTaskStatus = async (taskId, applicationToken, options = {}) => {
2284
2376
  while (attempts < maxAttempts) {
2285
2377
  attempts++;
2286
2378
  try {
2287
- const response = await fetch(`${API_BASE_URL}/api/v1/tasks/status/?task_id=${taskId}`, {
2379
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/tasks/status/?task_id=${taskId}`, {
2288
2380
  method: "GET",
2289
2381
  headers: {
2290
2382
  Accept: "application/json",
@@ -2328,7 +2420,7 @@ const startProofOfLife = async (videoBase64, applicationToken) => {
2328
2420
  ensureSecureContext();
2329
2421
  const controller = createTimeoutController();
2330
2422
  try {
2331
- const response = await fetch(`${API_BASE_URL}/api/v1/auth/recognition/face/external/`, {
2423
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/auth/recognition/face/external/`, {
2332
2424
  method: "POST",
2333
2425
  headers: {
2334
2426
  "Content-Type": "application/json",
@@ -3791,7 +3883,7 @@ function BiometricRegistrationModal({
3791
3883
  /* @__PURE__ */ jsxRuntimeExports.jsx("canvas", { ref: canvasRef })
3792
3884
  ] });
3793
3885
  }
3794
- let BiometricCaptureModal$1 = class BiometricCaptureModal2 {
3886
+ class BiometricCaptureModal {
3795
3887
  constructor(options) {
3796
3888
  __publicField(this, "modal", null);
3797
3889
  __publicField(this, "video", null);
@@ -4285,7 +4377,7 @@ let BiometricCaptureModal$1 = class BiometricCaptureModal2 {
4285
4377
  `;
4286
4378
  document.head.appendChild(style);
4287
4379
  }
4288
- };
4380
+ }
4289
4381
  class BiometricStatusOverlay {
4290
4382
  constructor() {
4291
4383
  __publicField(this, "container", null);
@@ -4309,43 +4401,21 @@ class BiometricStatusOverlay {
4309
4401
  opacity: 1;
4310
4402
  }
4311
4403
  50% {
4312
- transform: scale(1.1);
4404
+ transform: scale(1.05);
4313
4405
  opacity: 0.9;
4314
4406
  }
4315
4407
  }
4316
4408
 
4317
- @keyframes neofaceid-checkmark {
4318
- 0% {
4319
- stroke-dashoffset: 100;
4320
- opacity: 0;
4321
- }
4322
- 50% {
4323
- opacity: 1;
4324
- }
4325
- 100% {
4326
- stroke-dashoffset: 0;
4327
- opacity: 1;
4328
- }
4409
+ @keyframes neofaceid-scaleIn {
4410
+ 0% { transform: scale(0); opacity: 0; }
4411
+ 50% { transform: scale(1.1); }
4412
+ 100% { transform: scale(1); opacity: 1; }
4329
4413
  }
4330
4414
 
4331
4415
  @keyframes neofaceid-errorShake {
4332
- 0%, 100% { transform: translateX(0) scale(1); }
4333
- 10%, 30%, 50%, 70%, 90% { transform: translateX(-4px) scale(1); }
4334
- 20%, 40%, 60%, 80% { transform: translateX(4px) scale(1); }
4335
- }
4336
-
4337
- @keyframes neofaceid-scaleIn {
4338
- 0% {
4339
- transform: scale(0);
4340
- opacity: 0;
4341
- }
4342
- 50% {
4343
- transform: scale(1.1);
4344
- }
4345
- 100% {
4346
- transform: scale(1);
4347
- opacity: 1;
4348
- }
4416
+ 0%, 100% { transform: translateX(0); }
4417
+ 10%, 30%, 50%, 70%, 90% { transform: translateX(-4px); }
4418
+ 20%, 40%, 60%, 80% { transform: translateX(4px); }
4349
4419
  }
4350
4420
 
4351
4421
  .neofaceid-overlay-container {
@@ -4360,6 +4430,7 @@ class BiometricStatusOverlay {
4360
4430
  z-index: 10000;
4361
4431
  pointer-events: none;
4362
4432
  animation: neofaceid-fadeIn 0.3s ease-out;
4433
+ font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
4363
4434
  }
4364
4435
 
4365
4436
  .neofaceid-overlay-container.fade-out {
@@ -4375,10 +4446,10 @@ class BiometricStatusOverlay {
4375
4446
  pointer-events: auto;
4376
4447
  }
4377
4448
 
4378
- .neofaceid-logo-wrapper {
4449
+ .neofaceid-visual-wrapper {
4379
4450
  position: relative;
4380
- width: 120px;
4381
- height: 120px;
4451
+ width: 100px;
4452
+ height: 100px;
4382
4453
  display: flex;
4383
4454
  align-items: center;
4384
4455
  justify-content: center;
@@ -4388,13 +4459,57 @@ class BiometricStatusOverlay {
4388
4459
  width: 80px;
4389
4460
  height: 80px;
4390
4461
  object-fit: contain;
4462
+ transition: all 0.5s ease;
4391
4463
  filter: drop-shadow(0 4px 12px rgba(124, 58, 237, 0.3));
4392
4464
  }
4393
4465
 
4466
+ /* Cores por estado */
4467
+ .neofaceid-state-preparing .neofaceid-logo { filter: drop-shadow(0 0 15px rgba(124, 58, 237, 0.4)); }
4468
+ .neofaceid-state-detecting .neofaceid-logo { filter: hue-rotate(180deg) drop-shadow(0 0 15px rgba(59, 130, 246, 0.6)); }
4469
+ .neofaceid-state-capturing .neofaceid-logo { filter: hue-rotate(45deg) drop-shadow(0 0 15px rgba(245, 158, 11, 0.6)); }
4470
+ .neofaceid-state-verifying .neofaceid-logo { filter: hue-rotate(90deg) drop-shadow(0 0 15px rgba(34, 197, 94, 0.6)); }
4471
+
4394
4472
  .neofaceid-logo.pulsing {
4395
4473
  animation: neofaceid-pulse 2s ease-in-out infinite;
4396
4474
  }
4397
4475
 
4476
+ @keyframes neofaceid-dots {
4477
+ 0%, 20% { opacity: 0; transform: translateY(0); }
4478
+ 50% { opacity: 1; transform: translateY(-2px); }
4479
+ 80%, 100% { opacity: 0; transform: translateY(0); }
4480
+ }
4481
+
4482
+ .neofaceid-status-text {
4483
+ font-size: 15px;
4484
+ font-weight: 500;
4485
+ color: #ffffff;
4486
+ text-align: center;
4487
+ padding: 10px 24px;
4488
+ background: rgba(15, 23, 42, 0.8);
4489
+ backdrop-filter: blur(8px);
4490
+ border-radius: 100px;
4491
+ box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
4492
+ border: 1px solid rgba(255, 255, 255, 0.1);
4493
+ text-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
4494
+ animation: neofaceid-fadeIn 0.3s ease-out;
4495
+ display: flex;
4496
+ align-items: center;
4497
+ gap: 2px;
4498
+ }
4499
+
4500
+ .neofaceid-dots {
4501
+ display: inline-flex;
4502
+ margin-left: 2px;
4503
+ }
4504
+
4505
+ .neofaceid-dot {
4506
+ animation: neofaceid-dots 1.5s infinite;
4507
+ opacity: 0;
4508
+ }
4509
+
4510
+ .neofaceid-dot:nth-child(2) { animation-delay: 0.2s; }
4511
+ .neofaceid-dot:nth-child(3) { animation-delay: 0.4s; }
4512
+
4398
4513
  .neofaceid-status-icon {
4399
4514
  position: absolute;
4400
4515
  inset: 0;
@@ -4404,42 +4519,50 @@ class BiometricStatusOverlay {
4404
4519
  }
4405
4520
 
4406
4521
  .neofaceid-success-icon {
4407
- width: 60px;
4408
- height: 60px;
4522
+ width: 80px;
4523
+ height: 80px;
4409
4524
  color: #10b981;
4410
- animation: neofaceid-scaleIn 0.6s ease-out;
4525
+ animation: neofaceid-scaleIn 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
4411
4526
  }
4412
4527
 
4413
4528
  .neofaceid-error-icon {
4414
- width: 60px;
4415
- height: 60px;
4529
+ width: 80px;
4530
+ height: 80px;
4416
4531
  color: #ef4444;
4417
- animation: neofaceid-errorShake 0.5s ease-out, neofaceid-scaleIn 0.4s ease-out;
4418
- }
4419
-
4420
- @media (max-width: 640px) {
4421
- .neofaceid-logo-wrapper {
4422
- width: 100px;
4423
- height: 100px;
4424
- }
4425
-
4426
- .neofaceid-logo {
4427
- width: 70px;
4428
- height: 70px;
4429
- }
4532
+ animation: neofaceid-errorShake 0.5s linear, neofaceid-scaleIn 0.4s ease-out;
4430
4533
  }
4431
4534
  `;
4432
4535
  }
4536
+ getStatusText() {
4537
+ switch (this.currentStatus) {
4538
+ case "preparing":
4539
+ return "Iniciando câmera";
4540
+ case "detecting":
4541
+ return "Posicione seu rosto";
4542
+ case "capturing":
4543
+ return "Capturando";
4544
+ case "verifying":
4545
+ return "Verificando identidade";
4546
+ case "success":
4547
+ return "Identificado!";
4548
+ case "error":
4549
+ return "Falha na identificação";
4550
+ default:
4551
+ return "";
4552
+ }
4553
+ }
4433
4554
  renderContent() {
4434
- const isPulsing = this.currentStatus === "verifying";
4435
- const showLogo = this.currentStatus === "preparing" || this.currentStatus === "verifying";
4555
+ const isPulsing = ["detecting", "verifying"].includes(this.currentStatus);
4556
+ const showLogo = !["success", "error"].includes(this.currentStatus);
4436
4557
  const showSuccess = this.currentStatus === "success";
4437
4558
  const showError = this.currentStatus === "error";
4559
+ const statusText = this.getStatusText();
4560
+ const showDots = ["preparing", "detecting", "capturing", "verifying"].includes(this.currentStatus);
4438
4561
  return `
4439
4562
  <style>${this.getStyles()}</style>
4440
- <div class="neofaceid-overlay-container">
4563
+ <div class="neofaceid-overlay-container neofaceid-state-${this.currentStatus}">
4441
4564
  <div class="neofaceid-overlay-content">
4442
- <div class="neofaceid-logo-wrapper">
4565
+ <div class="neofaceid-visual-wrapper">
4443
4566
  ${showLogo ? `
4444
4567
  <img
4445
4568
  src="/logo-icone-no-background.png"
@@ -4467,13 +4590,22 @@ class BiometricStatusOverlay {
4467
4590
  </div>
4468
4591
  ` : ""}
4469
4592
  </div>
4593
+
4594
+ ${statusText ? `
4595
+ <div class="neofaceid-status-text">
4596
+ ${statusText}${showDots ? `
4597
+ <span class="neofaceid-dots">
4598
+ <span class="neofaceid-dot">.</span>
4599
+ <span class="neofaceid-dot">.</span>
4600
+ <span class="neofaceid-dot">.</span>
4601
+ </span>
4602
+ ` : ""}
4603
+ </div>
4604
+ ` : ""}
4470
4605
  </div>
4471
4606
  </div>
4472
4607
  `;
4473
4608
  }
4474
- /**
4475
- * Cria e exibe o overlay
4476
- */
4477
4609
  show(status = "preparing") {
4478
4610
  if (this.container) {
4479
4611
  this.updateStatus(status);
@@ -4485,18 +4617,12 @@ class BiometricStatusOverlay {
4485
4617
  this.container.innerHTML = this.renderContent();
4486
4618
  document.body.appendChild(this.container);
4487
4619
  }
4488
- /**
4489
- * Atualiza o status do overlay
4490
- */
4491
4620
  updateStatus(status) {
4492
4621
  this.currentStatus = status;
4493
4622
  if (this.container) {
4494
4623
  this.container.innerHTML = this.renderContent();
4495
4624
  }
4496
4625
  }
4497
- /**
4498
- * Fecha e remove o overlay
4499
- */
4500
4626
  close() {
4501
4627
  if (this.container) {
4502
4628
  const overlayElement = this.container.querySelector(".neofaceid-overlay-container");
@@ -4675,7 +4801,7 @@ function FallbackPromptComponent({
4675
4801
  )
4676
4802
  ] }) }),
4677
4803
  /* @__PURE__ */ jsxRuntimeExports.jsx("h3", { className: "neofaceid-fallback-title", children: "Não foi possível reconhecer" }),
4678
- /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "neofaceid-fallback-message", children: (error == null ? void 0 : error.message) || "Não conseguimos reconhecer sua face. Tente novamente ou use email e senha." }),
4804
+ /* @__PURE__ */ jsxRuntimeExports.jsx("p", { className: "neofaceid-fallback-message", children: (error == null ? void 0 : error.getFriendlyMessage()) || "Não conseguimos reconhecer sua face. Tente novamente ou use email e senha." }),
4679
4805
  /* @__PURE__ */ jsxRuntimeExports.jsxs("div", { className: "neofaceid-fallback-actions", children: [
4680
4806
  /* @__PURE__ */ jsxRuntimeExports.jsx(
4681
4807
  "button",
@@ -5215,8 +5341,12 @@ async function detectFaceQuickly(video, maxTime = FACE_DETECTION_TIME, interval
5215
5341
  checkFace();
5216
5342
  });
5217
5343
  }
5218
- async function attemptLogin(applicationToken, overlay, fastMode = false) {
5219
- overlay.updateStatus("verifying");
5344
+ async function attemptLogin(applicationToken, overlay, fastMode = false, isRetry = false) {
5345
+ if (!isRetry) {
5346
+ overlay.updateStatus("preparing");
5347
+ } else {
5348
+ overlay.updateStatus("detecting");
5349
+ }
5220
5350
  const video = document.createElement("video");
5221
5351
  video.style.position = "fixed";
5222
5352
  video.style.top = "-9999px";
@@ -5247,6 +5377,7 @@ async function attemptLogin(applicationToken, overlay, fastMode = false) {
5247
5377
  video.onloadedmetadata = () => resolve(void 0);
5248
5378
  }
5249
5379
  });
5380
+ overlay.updateStatus("detecting");
5250
5381
  await new Promise((resolve) => setTimeout(resolve, CAMERA_STABILITY_DELAY));
5251
5382
  let faceDetected = true;
5252
5383
  if (!fastMode) {
@@ -5261,6 +5392,7 @@ async function attemptLogin(applicationToken, overlay, fastMode = false) {
5261
5392
  }
5262
5393
  throw new NeoFaceError("Rosto não detectado. Posicione seu rosto na frente da câmera.", ErrorType.VALIDATION_ERROR);
5263
5394
  }
5395
+ overlay.updateStatus("capturing");
5264
5396
  const canvas = document.createElement("canvas");
5265
5397
  canvas.width = video.videoWidth;
5266
5398
  canvas.height = video.videoHeight;
@@ -5295,7 +5427,8 @@ async function attemptLogin(applicationToken, overlay, fastMode = false) {
5295
5427
  0.85
5296
5428
  );
5297
5429
  });
5298
- const result = await loginWithBiometric$1(imageBlob, applicationToken);
5430
+ overlay.updateStatus("verifying");
5431
+ const result = await loginWithBiometric(imageBlob, applicationToken);
5299
5432
  if (!result.success) {
5300
5433
  throw new NeoFaceError("Login falhou", ErrorType.LOGIN_FAILED);
5301
5434
  }
@@ -5330,7 +5463,7 @@ async function executeBiometricLoginFlow(options) {
5330
5463
  const tryLogin = async () => {
5331
5464
  try {
5332
5465
  attempts++;
5333
- const result = await attemptLogin(applicationToken, overlay, fastMode);
5466
+ const result = await attemptLogin(applicationToken, overlay, fastMode, attempts > 1);
5334
5467
  overlay.updateStatus("success");
5335
5468
  setTimeout(() => {
5336
5469
  overlay.close();
@@ -5711,8 +5844,8 @@ const biometricDetection = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.
5711
5844
  initializeBiometricDetection,
5712
5845
  isAdvancedDetectionAvailable
5713
5846
  }, Symbol.toStringTag, { value: "Module" }));
5714
- const VERSION = "1.9.2";
5715
- const RELEASE_DATE = "2026-01-20";
5847
+ const VERSION = "1.11.1";
5848
+ const RELEASE_DATE = "2026-02-12";
5716
5849
  class OnboardingCaptureModal {
5717
5850
  constructor(options) {
5718
5851
  __publicField(this, "overlay", null);
@@ -5930,7 +6063,6 @@ const startOnboarding = async (options) => {
5930
6063
  onError(new NeoFaceError(message, ErrorType.UNKNOWN));
5931
6064
  }
5932
6065
  };
5933
- const __vite_import_meta_env__ = {};
5934
6066
  class NeoFaceID {
5935
6067
  /**
5936
6068
  * Creates a new NeoFaceID instance
@@ -5943,7 +6075,7 @@ class NeoFaceID {
5943
6075
  __publicField(this, "signature");
5944
6076
  __publicField(this, "sessionData");
5945
6077
  this.appToken = config.appToken;
5946
- this.baseUrl = config.baseUrl || (__vite_import_meta_env__ == null ? void 0 : __vite_import_meta_env__.VITE_API_BASE_URL) || "https://sandbox-core.neofaceid.com";
6078
+ this.baseUrl = config.baseUrl || getBaseUrl();
5947
6079
  this.signature = config.signature;
5948
6080
  this.sessionData = config.sessionData;
5949
6081
  if (this.signature && !this.validateSignatureFormat(this.signature)) {
@@ -7432,10 +7564,11 @@ function startLivenessCapture(applicationToken, callbacks) {
7432
7564
  });
7433
7565
  }
7434
7566
  export {
7435
- BiometricCaptureModal$1 as BiometricCaptureModal,
7567
+ BiometricCaptureModal,
7436
7568
  BiometricRegistrationModal,
7437
7569
  BiometricStatusOverlay,
7438
7570
  DocumentCaptureModal,
7571
+ ENVIRONMENT_URLS,
7439
7572
  EmailPasswordModal,
7440
7573
  ErrorType,
7441
7574
  FaceCaptureModal,
@@ -7450,10 +7583,16 @@ export {
7450
7583
  completeOnboarding,
7451
7584
  completeOnboardingWithData,
7452
7585
  detectBiometricType,
7586
+ getApplicationToken,
7587
+ getBaseUrl,
7588
+ getConfig,
7589
+ getEnvironment,
7453
7590
  identifyPerson,
7591
+ init,
7454
7592
  initializeBiometricDetection,
7455
7593
  isAdvancedDetectionAvailable,
7456
- loginWithBiometric$1 as loginWithBiometric,
7594
+ isInitialized,
7595
+ loginWithBiometric,
7457
7596
  loginWithEmail,
7458
7597
  preloadFaceDetectionModels,
7459
7598
  recognize,