vesant-sdk 1.4.1 → 1.4.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.
Files changed (61) hide show
  1. package/dist/{client-DoczGA6L.d.ts → client-BlAt791q.d.ts} +12 -1
  2. package/dist/{client-DzElM7u-.d.mts → client-CY41e2Z_.d.mts} +4 -8
  3. package/dist/{client-DzElM7u-.d.ts → client-CY41e2Z_.d.ts} +4 -8
  4. package/dist/{client-B6fUFAUM.d.mts → client-oo_3-0YW.d.mts} +12 -1
  5. package/dist/compliance/index.d.mts +3 -3
  6. package/dist/compliance/index.d.ts +3 -3
  7. package/dist/compliance/index.js +39 -18
  8. package/dist/compliance/index.js.map +1 -1
  9. package/dist/compliance/index.mjs +39 -18
  10. package/dist/compliance/index.mjs.map +1 -1
  11. package/dist/decisions/index.d.mts +1 -1
  12. package/dist/decisions/index.d.ts +1 -1
  13. package/dist/decisions/index.js +2 -10
  14. package/dist/decisions/index.js.map +1 -1
  15. package/dist/decisions/index.mjs +2 -10
  16. package/dist/decisions/index.mjs.map +1 -1
  17. package/dist/geolocation/index.d.mts +3 -3
  18. package/dist/geolocation/index.d.ts +3 -3
  19. package/dist/geolocation/index.js +34 -16
  20. package/dist/geolocation/index.js.map +1 -1
  21. package/dist/geolocation/index.mjs +34 -16
  22. package/dist/geolocation/index.mjs.map +1 -1
  23. package/dist/index.d.mts +4 -4
  24. package/dist/index.d.ts +4 -4
  25. package/dist/index.js +41 -19
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +41 -19
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/kyc/core.d.mts +1 -1
  30. package/dist/kyc/core.d.ts +1 -1
  31. package/dist/kyc/core.js +4 -11
  32. package/dist/kyc/core.js.map +1 -1
  33. package/dist/kyc/core.mjs +4 -11
  34. package/dist/kyc/core.mjs.map +1 -1
  35. package/dist/kyc/index.d.mts +3 -1
  36. package/dist/kyc/index.d.ts +3 -1
  37. package/dist/kyc/index.js +4 -11
  38. package/dist/kyc/index.js.map +1 -1
  39. package/dist/kyc/index.mjs +4 -11
  40. package/dist/kyc/index.mjs.map +1 -1
  41. package/dist/react.d.mts +2 -2
  42. package/dist/react.d.ts +2 -2
  43. package/dist/react.js +1 -1
  44. package/dist/react.js.map +1 -1
  45. package/dist/react.mjs +1 -1
  46. package/dist/react.mjs.map +1 -1
  47. package/dist/risk-profile/index.d.mts +1 -1
  48. package/dist/risk-profile/index.d.ts +1 -1
  49. package/dist/risk-profile/index.js +2 -10
  50. package/dist/risk-profile/index.js.map +1 -1
  51. package/dist/risk-profile/index.mjs +2 -10
  52. package/dist/risk-profile/index.mjs.map +1 -1
  53. package/dist/scores/index.d.mts +1 -1
  54. package/dist/scores/index.d.ts +1 -1
  55. package/dist/scores/index.js +2 -10
  56. package/dist/scores/index.js.map +1 -1
  57. package/dist/scores/index.mjs +2 -10
  58. package/dist/scores/index.mjs.map +1 -1
  59. package/dist/webhooks/index.d.mts +1 -0
  60. package/dist/webhooks/index.d.ts +1 -0
  61. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -241,7 +241,7 @@ var noopLogger = {
241
241
  };
242
242
 
243
243
  // src/core/version.ts
244
- var SDK_VERSION = "1.4.0";
244
+ var SDK_VERSION = "1.4.1";
245
245
 
246
246
  // src/shared/browser-utils.ts
247
247
  function generateUUID() {
@@ -335,12 +335,6 @@ var BaseClient = class {
335
335
  interceptors: this.interceptors,
336
336
  logger: this.logger
337
337
  };
338
- if (this.config.environment === "sandbox" && this.config.apiKey?.startsWith("pk_live_")) {
339
- this.logger.warn("Production API key used with sandbox environment. Use your sandbox API key (sk_sandbox_) instead.");
340
- }
341
- if (this.config.environment !== "sandbox" && this.config.apiKey?.startsWith("sk_sandbox_")) {
342
- this.logger.warn("Sandbox API key used with production environment. Use your production API key (pk_live_) instead.");
343
- }
344
338
  if (config.circuitBreaker) {
345
339
  this.circuitBreaker = new CircuitBreaker(config.circuitBreaker);
346
340
  }
@@ -364,9 +358,7 @@ var BaseClient = class {
364
358
  error.requestId = requestId;
365
359
  throw error;
366
360
  }
367
- const DEFAULT_SANDBOX_URL = "https://sandbox-api.vesant.ai";
368
- const resolvedBaseURL = this.config.environment === "sandbox" ? this.config.sandboxBaseURL || DEFAULT_SANDBOX_URL : serviceURL || this.config.baseURL;
369
- const url = `${serviceURL || resolvedBaseURL}${endpoint}`;
361
+ const url = `${serviceURL || this.config.baseURL}${endpoint}`;
370
362
  const headers = {
371
363
  "Content-Type": "application/json",
372
364
  "X-Tenant-ID": this.config.tenantId,
@@ -878,7 +870,8 @@ var GeolocationClient = class extends BaseClient {
878
870
  retries: 3,
879
871
  // Default retry count for geolocation calls
880
872
  debug: config.debug,
881
- logger: config.logger
873
+ logger: config.logger,
874
+ environment: config.environment
882
875
  };
883
876
  super(baseConfig);
884
877
  }
@@ -972,6 +965,32 @@ var GeolocationClient = class extends BaseClient {
972
965
  }
973
966
  return config;
974
967
  }
968
+ /**
969
+ * Fetch the signing key from the dedicated authenticated endpoint.
970
+ *
971
+ * Falls back to getGPSConfig() for backward compatibility with older servers
972
+ * that don't expose `/api/v1/geo/signing-key`.
973
+ *
974
+ * @returns The signing key string, or undefined if unavailable
975
+ */
976
+ async fetchSigningKey(requestOptions) {
977
+ try {
978
+ const response = await this.requestWithRetry(
979
+ "/api/v1/geo/signing-key",
980
+ void 0,
981
+ void 0,
982
+ void 0,
983
+ requestOptions
984
+ );
985
+ if (response.signing_key) {
986
+ this.cachedSigningKey = response.signing_key;
987
+ return response.signing_key;
988
+ }
989
+ } catch {
990
+ }
991
+ const config = await this.getGPSConfig(requestOptions);
992
+ return config.signing_key;
993
+ }
975
994
  // ============================================================================
976
995
  // CipherText Validation
977
996
  // ============================================================================
@@ -1252,11 +1271,10 @@ var GeolocationClient = class extends BaseClient {
1252
1271
  let signingKey = this.cachedSigningKey;
1253
1272
  let resolvedGpsConfig = gpsConfig;
1254
1273
  if (!signingKey) {
1255
- const config = await this.getGPSConfig();
1256
- signingKey = config.signing_key;
1257
- if (!resolvedGpsConfig) {
1258
- resolvedGpsConfig = config;
1259
- }
1274
+ signingKey = await this.fetchSigningKey();
1275
+ }
1276
+ if (!resolvedGpsConfig) {
1277
+ resolvedGpsConfig = await this.getGPSConfig();
1260
1278
  }
1261
1279
  return generateCipherText(
1262
1280
  { ...options, signingKey: signingKey || void 0 },
@@ -1426,6 +1444,7 @@ var ComplianceClient = class {
1426
1444
  autoCreateProfiles: config.autoCreateProfiles !== false,
1427
1445
  // default true
1428
1446
  syncMode: config.syncMode || "sync",
1447
+ environment: config.environment,
1429
1448
  interceptors,
1430
1449
  logger: this.logger
1431
1450
  };
@@ -1436,7 +1455,8 @@ var ComplianceClient = class {
1436
1455
  headers: this.config.headers,
1437
1456
  timeout: this.config.timeout,
1438
1457
  debug: this.config.debug,
1439
- logger: this.logger
1458
+ logger: this.logger,
1459
+ environment: this.config.environment
1440
1460
  });
1441
1461
  this.riskClient = new RiskProfileClient({
1442
1462
  baseURL: this.config.baseURL,
@@ -1446,7 +1466,8 @@ var ComplianceClient = class {
1446
1466
  timeout: this.config.timeout,
1447
1467
  debug: this.config.debug,
1448
1468
  interceptors,
1449
- logger: this.logger
1469
+ logger: this.logger,
1470
+ environment: this.config.environment
1450
1471
  });
1451
1472
  this.currencyRates = DEFAULT_CURRENCY_RATES;
1452
1473
  }
@@ -2256,7 +2277,8 @@ var KycClient = class extends BaseClient {
2256
2277
  timeout: config.timeout,
2257
2278
  retries: 3,
2258
2279
  // Default retry count for KYC calls
2259
- debug: config.debug
2280
+ debug: config.debug,
2281
+ environment: config.environment
2260
2282
  };
2261
2283
  super(baseConfig);
2262
2284
  this.userId = config.userId;