@neofaceid/web-sdk 1.9.2 → 1.10.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.
@@ -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
  }
@@ -1134,8 +1134,65 @@ class NeoFaceError extends Error {
1134
1134
  this.type = type;
1135
1135
  }
1136
1136
  }
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";
1137
+ const __vite_import_meta_env__ = {};
1138
+ const ENVIRONMENT_URLS = {
1139
+ development: "http://localhost:8000",
1140
+ sandbox: "https://sandbox-core.neofaceid.com",
1141
+ production: "https://core.neofaceid.com.br"
1142
+ };
1143
+ let globalConfig = {
1144
+ baseUrl: ENVIRONMENT_URLS.sandbox,
1145
+ // Default para sandbox
1146
+ applicationToken: null,
1147
+ environment: "sandbox",
1148
+ initialized: false
1149
+ };
1150
+ function init(options = {}) {
1151
+ const { environment, baseUrl, applicationToken } = options;
1152
+ if (baseUrl) {
1153
+ globalConfig.baseUrl = baseUrl;
1154
+ globalConfig.environment = "custom";
1155
+ } else if (environment) {
1156
+ if (!ENVIRONMENT_URLS[environment]) {
1157
+ console.warn(`[NeoFaceID SDK] Ambiente '${environment}' não reconhecido. Usando 'sandbox'.`);
1158
+ globalConfig.baseUrl = ENVIRONMENT_URLS.sandbox;
1159
+ globalConfig.environment = "sandbox";
1160
+ } else {
1161
+ globalConfig.baseUrl = ENVIRONMENT_URLS[environment];
1162
+ globalConfig.environment = environment;
1163
+ }
1164
+ } else {
1165
+ const envUrl = typeof import.meta !== "undefined" && (__vite_import_meta_env__ == null ? void 0 : __vite_import_meta_env__.VITE_API_BASE_URL);
1166
+ if (envUrl) {
1167
+ globalConfig.baseUrl = envUrl;
1168
+ globalConfig.environment = "custom";
1169
+ }
1170
+ }
1171
+ if (applicationToken) {
1172
+ globalConfig.applicationToken = applicationToken;
1173
+ }
1174
+ globalConfig.initialized = true;
1175
+ console.log(`[NeoFaceID SDK] Inicializado - Ambiente: ${globalConfig.environment}, URL: ${globalConfig.baseUrl}`);
1176
+ }
1177
+ function getBaseUrl() {
1178
+ if (!globalConfig.initialized) {
1179
+ console.warn("[NeoFaceID SDK] SDK não foi inicializado. Usando configuração padrão (sandbox).");
1180
+ }
1181
+ return globalConfig.baseUrl;
1182
+ }
1183
+ function getApplicationToken() {
1184
+ return globalConfig.applicationToken;
1185
+ }
1186
+ function getEnvironment() {
1187
+ return globalConfig.environment;
1188
+ }
1189
+ function isInitialized() {
1190
+ return globalConfig.initialized;
1191
+ }
1192
+ function getConfig() {
1193
+ return { ...globalConfig };
1194
+ }
1195
+ const getApiBaseUrl = () => getBaseUrl();
1139
1196
  const REQUEST_TIMEOUT = 1e4;
1140
1197
  const ensureSecureContext = () => {
1141
1198
  const isLocalhost = window.location.hostname === "localhost" || window.location.hostname === "127.0.0.1" || window.location.hostname === "";
@@ -1225,7 +1282,7 @@ const validateToken = async (applicationToken) => {
1225
1282
  ensureSecureContext();
1226
1283
  const controller = createTimeoutController();
1227
1284
  try {
1228
- const response = await fetch(`${API_BASE_URL}/api/v1/auth/application/validate_token/`, {
1285
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/auth/application/validate_token/`, {
1229
1286
  method: "POST",
1230
1287
  headers: {
1231
1288
  "Content-Type": "application/json",
@@ -1250,7 +1307,7 @@ const getOnboardingDetails = async (applicationToken, onboardingToken) => {
1250
1307
  const controller = createTimeoutController();
1251
1308
  try {
1252
1309
  const response = await fetch(
1253
- `${API_BASE_URL}/api/v1/onboardings/${encodeURIComponent(onboardingToken)}/`,
1310
+ `${getApiBaseUrl()}/api/v1/onboardings/${encodeURIComponent(onboardingToken)}/`,
1254
1311
  {
1255
1312
  method: "GET",
1256
1313
  headers: {
@@ -1288,7 +1345,7 @@ const validateOnboardingToken = async (applicationToken, onboardingToken) => {
1288
1345
  const controller = createTimeoutController();
1289
1346
  try {
1290
1347
  const response = await fetch(
1291
- `${API_BASE_URL}/api/v1/onboardings/${encodeURIComponent(onboardingToken)}/`,
1348
+ `${getApiBaseUrl()}/api/v1/onboardings/${encodeURIComponent(onboardingToken)}/`,
1292
1349
  {
1293
1350
  method: "GET",
1294
1351
  headers: {
@@ -1331,7 +1388,7 @@ const completeOnboarding = async (applicationToken, onboardingToken, faceImage,
1331
1388
  formData.append("face_image", compressedFace, "face.jpg");
1332
1389
  formData.append("document_image", compressedDocument, "document.jpg");
1333
1390
  const response = await fetch(
1334
- `${API_BASE_URL}/api/v1/onboardings/${encodeURIComponent(onboardingToken)}/complete`,
1391
+ `${getApiBaseUrl()}/api/v1/onboardings/${encodeURIComponent(onboardingToken)}/complete`,
1335
1392
  {
1336
1393
  method: "POST",
1337
1394
  headers: {
@@ -1408,7 +1465,7 @@ const completeOnboardingWithData = async (applicationToken, onboardingToken, per
1408
1465
  formData.append("email", personData.email);
1409
1466
  }
1410
1467
  const response = await fetch(
1411
- `${API_BASE_URL}/api/v1/onboardings/${encodeURIComponent(onboardingToken)}/complete`,
1468
+ `${getApiBaseUrl()}/api/v1/onboardings/${encodeURIComponent(onboardingToken)}/complete`,
1412
1469
  {
1413
1470
  method: "POST",
1414
1471
  headers: {
@@ -1462,7 +1519,7 @@ const recognize = async (image, applicationToken) => {
1462
1519
  try {
1463
1520
  const formData = new FormData();
1464
1521
  formData.append("face_frames", compressedImage);
1465
- const response = await fetch(`${API_BASE_URL}/api/v1/external/recognition/face/`, {
1522
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/external/recognition/face/`, {
1466
1523
  method: "POST",
1467
1524
  headers: {
1468
1525
  "X-App-Token": applicationToken
@@ -1507,7 +1564,7 @@ const loginWithBiometric$1 = async (image, applicationToken) => {
1507
1564
  const base64Image = btoa(
1508
1565
  new Uint8Array(arrayBuffer).reduce((data2, byte) => data2 + String.fromCharCode(byte), "")
1509
1566
  );
1510
- const response = await fetch(`${API_BASE_URL}/api/v1/login/donor/face/`, {
1567
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/login/donor/face/`, {
1511
1568
  method: "POST",
1512
1569
  headers: {
1513
1570
  "Content-Type": "application/json",
@@ -1569,7 +1626,7 @@ const recognizeBiometric = async (image, applicationToken, livenessCheck = true,
1569
1626
  formData.append("face_frames", compressedImage);
1570
1627
  formData.append("liveness_check", livenessCheck.toString());
1571
1628
  formData.append("confidence_threshold", confidenceThreshold.toString());
1572
- const response = await fetch(`${API_BASE_URL}/api/v1/external/recognition/biometric/`, {
1629
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/external/recognition/biometric/`, {
1573
1630
  method: "POST",
1574
1631
  headers: {
1575
1632
  "X-App-Token": applicationToken
@@ -1608,7 +1665,7 @@ const simpleIdentification = async (documentType, documentNumber, applicationTok
1608
1665
  ensureSecureContext();
1609
1666
  const controller = createTimeoutController();
1610
1667
  try {
1611
- const response = await fetch(`${API_BASE_URL}/api/v1/external/recognition/simple/`, {
1668
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/external/recognition/simple/`, {
1612
1669
  method: "POST",
1613
1670
  headers: {
1614
1671
  "Content-Type": "application/json",
@@ -1674,7 +1731,7 @@ const recognizeByPurpose = async (image, applicationToken, purpose, confidenceTh
1674
1731
  if (signature) {
1675
1732
  requestBody.signature = signature;
1676
1733
  }
1677
- const response = await fetch(`${API_BASE_URL}/api/v1/external/recognition/purpose/`, {
1734
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/external/recognition/purpose/`, {
1678
1735
  method: "POST",
1679
1736
  headers: {
1680
1737
  "Content-Type": "application/json",
@@ -1755,7 +1812,7 @@ const registerPersonWithoutFace = async (personData, applicationToken, options)
1755
1812
  type: (options == null ? void 0 : options.documentType) || "RG"
1756
1813
  }];
1757
1814
  }
1758
- const response = await fetch(`${API_BASE_URL}/api/v1/signup/donor/`, {
1815
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/signup/donor/`, {
1759
1816
  method: "POST",
1760
1817
  headers: {
1761
1818
  "Content-Type": "application/json",
@@ -1849,7 +1906,7 @@ const registerPersonWithBiometric = async (personData, facePhotos, applicationTo
1849
1906
  type: (options == null ? void 0 : options.documentType) || "RG"
1850
1907
  }];
1851
1908
  }
1852
- const response = await fetch(`${API_BASE_URL}/api/v1/signup/donor/`, {
1909
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/signup/donor/`, {
1853
1910
  method: "POST",
1854
1911
  headers: {
1855
1912
  "Content-Type": "application/json",
@@ -1935,7 +1992,7 @@ const loginWithEmail = async (email, password, applicationToken) => {
1935
1992
  ensureSecureContext();
1936
1993
  const controller = createTimeoutController();
1937
1994
  try {
1938
- const response = await fetch(`${API_BASE_URL}/api/v1/auth/login/`, {
1995
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/auth/login/`, {
1939
1996
  method: "POST",
1940
1997
  headers: {
1941
1998
  "Content-Type": "application/json",
@@ -1992,7 +2049,7 @@ const identifyPerson = async (image, applicationToken) => {
1992
2049
  reader.readAsDataURL(compressedImage);
1993
2050
  });
1994
2051
  try {
1995
- const response = await fetch(`${API_BASE_URL}/api/v1/external/recognition/face/`, {
2052
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/external/recognition/face/`, {
1996
2053
  method: "POST",
1997
2054
  headers: {
1998
2055
  "Content-Type": "application/json",
@@ -2069,7 +2126,7 @@ const registerBiometric = async (personId, faceImage, applicationToken) => {
2069
2126
  reader.readAsDataURL(compressedImage);
2070
2127
  });
2071
2128
  try {
2072
- const response = await fetch(`${API_BASE_URL}/api/v1/identity-data/`, {
2129
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/identity-data/`, {
2073
2130
  method: "POST",
2074
2131
  headers: {
2075
2132
  "Content-Type": "application/json",
@@ -2129,7 +2186,7 @@ const registerApplication = async (jwtToken, consumerId, applicationData) => {
2129
2186
  ensureSecureContext();
2130
2187
  const controller = createTimeoutController();
2131
2188
  try {
2132
- const response = await fetch(`${API_BASE_URL}/api/v1/applications/`, {
2189
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/applications/`, {
2133
2190
  method: "POST",
2134
2191
  headers: {
2135
2192
  "Content-Type": "application/json",
@@ -2284,7 +2341,7 @@ const pollTaskStatus = async (taskId, applicationToken, options = {}) => {
2284
2341
  while (attempts < maxAttempts) {
2285
2342
  attempts++;
2286
2343
  try {
2287
- const response = await fetch(`${API_BASE_URL}/api/v1/tasks/status/?task_id=${taskId}`, {
2344
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/tasks/status/?task_id=${taskId}`, {
2288
2345
  method: "GET",
2289
2346
  headers: {
2290
2347
  Accept: "application/json",
@@ -2328,7 +2385,7 @@ const startProofOfLife = async (videoBase64, applicationToken) => {
2328
2385
  ensureSecureContext();
2329
2386
  const controller = createTimeoutController();
2330
2387
  try {
2331
- const response = await fetch(`${API_BASE_URL}/api/v1/auth/recognition/face/external/`, {
2388
+ const response = await fetch(`${getApiBaseUrl()}/api/v1/auth/recognition/face/external/`, {
2332
2389
  method: "POST",
2333
2390
  headers: {
2334
2391
  "Content-Type": "application/json",
@@ -5711,8 +5768,8 @@ const biometricDetection = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.
5711
5768
  initializeBiometricDetection,
5712
5769
  isAdvancedDetectionAvailable
5713
5770
  }, Symbol.toStringTag, { value: "Module" }));
5714
- const VERSION = "1.9.2";
5715
- const RELEASE_DATE = "2026-01-20";
5771
+ const VERSION = "1.10.0";
5772
+ const RELEASE_DATE = "2026-01-21";
5716
5773
  class OnboardingCaptureModal {
5717
5774
  constructor(options) {
5718
5775
  __publicField(this, "overlay", null);
@@ -5930,7 +5987,6 @@ const startOnboarding = async (options) => {
5930
5987
  onError(new NeoFaceError(message, ErrorType.UNKNOWN));
5931
5988
  }
5932
5989
  };
5933
- const __vite_import_meta_env__ = {};
5934
5990
  class NeoFaceID {
5935
5991
  /**
5936
5992
  * Creates a new NeoFaceID instance
@@ -5943,7 +5999,7 @@ class NeoFaceID {
5943
5999
  __publicField(this, "signature");
5944
6000
  __publicField(this, "sessionData");
5945
6001
  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";
6002
+ this.baseUrl = config.baseUrl || getBaseUrl();
5947
6003
  this.signature = config.signature;
5948
6004
  this.sessionData = config.sessionData;
5949
6005
  if (this.signature && !this.validateSignatureFormat(this.signature)) {
@@ -7436,6 +7492,7 @@ export {
7436
7492
  BiometricRegistrationModal,
7437
7493
  BiometricStatusOverlay,
7438
7494
  DocumentCaptureModal,
7495
+ ENVIRONMENT_URLS,
7439
7496
  EmailPasswordModal,
7440
7497
  ErrorType,
7441
7498
  FaceCaptureModal,
@@ -7450,9 +7507,15 @@ export {
7450
7507
  completeOnboarding,
7451
7508
  completeOnboardingWithData,
7452
7509
  detectBiometricType,
7510
+ getApplicationToken,
7511
+ getBaseUrl,
7512
+ getConfig,
7513
+ getEnvironment,
7453
7514
  identifyPerson,
7515
+ init,
7454
7516
  initializeBiometricDetection,
7455
7517
  isAdvancedDetectionAvailable,
7518
+ isInitialized,
7456
7519
  loginWithBiometric$1 as loginWithBiometric,
7457
7520
  loginWithEmail,
7458
7521
  preloadFaceDetectionModels,