vesant-sdk 1.4.0 → 1.4.2

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 +34 -16
  8. package/dist/compliance/index.js.map +1 -1
  9. package/dist/compliance/index.mjs +34 -16
  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 +36 -17
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +36 -17
  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
@@ -1,4 +1,4 @@
1
- import { L as Logger, B as BaseClient, R as RequestOptions } from './client-DzElM7u-.js';
1
+ import { L as Logger, B as BaseClient, R as RequestOptions } from './client-CY41e2Z_.js';
2
2
  import { P as PaginationParams } from './types-DZHongaK.js';
3
3
 
4
4
  interface DeviceFingerprintRequest {
@@ -472,6 +472,8 @@ interface GeolocationClientConfig {
472
472
  debug?: boolean;
473
473
  /** Custom logger instance */
474
474
  logger?: Logger;
475
+ /** Environment mode - 'sandbox' uses isolated sandbox data */
476
+ environment?: 'production' | 'sandbox';
475
477
  }
476
478
  interface UseGeolocationOptions {
477
479
  /** Auto-detect and verify user's IP on mount */
@@ -804,6 +806,15 @@ declare class GeolocationClient extends BaseClient {
804
806
  * ```
805
807
  */
806
808
  getGPSConfig(requestOptions?: RequestOptions): Promise<GeolocationConfigResponse>;
809
+ /**
810
+ * Fetch the signing key from the dedicated authenticated endpoint.
811
+ *
812
+ * Falls back to getGPSConfig() for backward compatibility with older servers
813
+ * that don't expose `/api/v1/geo/signing-key`.
814
+ *
815
+ * @returns The signing key string, or undefined if unavailable
816
+ */
817
+ fetchSigningKey(requestOptions?: RequestOptions): Promise<string | undefined>;
807
818
  /**
808
819
  * Validate a cipherText generated by the frontend SDK
809
820
  *
@@ -92,10 +92,8 @@ interface BaseClientConfig {
92
92
  interceptors?: RequestInterceptor[];
93
93
  /** Custom logger instance */
94
94
  logger?: Logger;
95
- /** Environment mode (default: 'production') */
95
+ /** Environment mode (default: 'production'). When 'sandbox', adds X-Sandbox header to all requests for data isolation. */
96
96
  environment?: 'production' | 'sandbox';
97
- /** Base URL to use in sandbox mode */
98
- sandboxBaseURL?: string;
99
97
  /** Circuit breaker configuration */
100
98
  circuitBreaker?: CircuitBreakerConfig;
101
99
  /** Enable rate limit header tracking (default: false) */
@@ -124,19 +122,17 @@ interface CGSConfig {
124
122
  interceptors?: RequestInterceptor[];
125
123
  /** Custom logger instance */
126
124
  logger?: Logger;
127
- /** Environment mode (default: 'production') */
125
+ /** Environment mode (default: 'production'). When 'sandbox', adds X-Sandbox header to all requests for data isolation. */
128
126
  environment?: 'production' | 'sandbox';
129
- /** Base URL to use in sandbox mode */
130
- sandboxBaseURL?: string;
131
127
  /** Circuit breaker configuration */
132
128
  circuitBreaker?: CircuitBreakerConfig;
133
129
  /** Enable rate limit header tracking (default: false) */
134
130
  enableRateLimitTracking?: boolean;
135
131
  }
136
132
  /** CGSConfig with core fields required, enterprise features remain optional */
137
- type RequiredCGSConfig = Required<Pick<CGSConfig, 'baseURL' | 'tenantId' | 'apiKey' | 'headers' | 'timeout' | 'retries' | 'debug' | 'autoCreateProfiles' | 'syncMode' | 'interceptors' | 'logger'>> & Pick<CGSConfig, 'environment' | 'sandboxBaseURL' | 'circuitBreaker' | 'enableRateLimitTracking'>;
133
+ type RequiredCGSConfig = Required<Pick<CGSConfig, 'baseURL' | 'tenantId' | 'apiKey' | 'headers' | 'timeout' | 'retries' | 'debug' | 'autoCreateProfiles' | 'syncMode' | 'interceptors' | 'logger'>> & Pick<CGSConfig, 'environment' | 'circuitBreaker' | 'enableRateLimitTracking'>;
138
134
  /** BaseClientConfig with core fields required, enterprise features remain optional */
139
- type RequiredBaseClientConfig = Required<Pick<BaseClientConfig, 'baseURL' | 'tenantId' | 'apiKey' | 'headers' | 'timeout' | 'retries' | 'debug' | 'interceptors' | 'logger'>> & Pick<BaseClientConfig, 'environment' | 'sandboxBaseURL' | 'circuitBreaker' | 'enableRateLimitTracking'>;
135
+ type RequiredBaseClientConfig = Required<Pick<BaseClientConfig, 'baseURL' | 'tenantId' | 'apiKey' | 'headers' | 'timeout' | 'retries' | 'debug' | 'interceptors' | 'logger'>> & Pick<BaseClientConfig, 'environment' | 'circuitBreaker' | 'enableRateLimitTracking'>;
140
136
 
141
137
  /**
142
138
  * Rate limit tracking from API response headers.
@@ -92,10 +92,8 @@ interface BaseClientConfig {
92
92
  interceptors?: RequestInterceptor[];
93
93
  /** Custom logger instance */
94
94
  logger?: Logger;
95
- /** Environment mode (default: 'production') */
95
+ /** Environment mode (default: 'production'). When 'sandbox', adds X-Sandbox header to all requests for data isolation. */
96
96
  environment?: 'production' | 'sandbox';
97
- /** Base URL to use in sandbox mode */
98
- sandboxBaseURL?: string;
99
97
  /** Circuit breaker configuration */
100
98
  circuitBreaker?: CircuitBreakerConfig;
101
99
  /** Enable rate limit header tracking (default: false) */
@@ -124,19 +122,17 @@ interface CGSConfig {
124
122
  interceptors?: RequestInterceptor[];
125
123
  /** Custom logger instance */
126
124
  logger?: Logger;
127
- /** Environment mode (default: 'production') */
125
+ /** Environment mode (default: 'production'). When 'sandbox', adds X-Sandbox header to all requests for data isolation. */
128
126
  environment?: 'production' | 'sandbox';
129
- /** Base URL to use in sandbox mode */
130
- sandboxBaseURL?: string;
131
127
  /** Circuit breaker configuration */
132
128
  circuitBreaker?: CircuitBreakerConfig;
133
129
  /** Enable rate limit header tracking (default: false) */
134
130
  enableRateLimitTracking?: boolean;
135
131
  }
136
132
  /** CGSConfig with core fields required, enterprise features remain optional */
137
- type RequiredCGSConfig = Required<Pick<CGSConfig, 'baseURL' | 'tenantId' | 'apiKey' | 'headers' | 'timeout' | 'retries' | 'debug' | 'autoCreateProfiles' | 'syncMode' | 'interceptors' | 'logger'>> & Pick<CGSConfig, 'environment' | 'sandboxBaseURL' | 'circuitBreaker' | 'enableRateLimitTracking'>;
133
+ type RequiredCGSConfig = Required<Pick<CGSConfig, 'baseURL' | 'tenantId' | 'apiKey' | 'headers' | 'timeout' | 'retries' | 'debug' | 'autoCreateProfiles' | 'syncMode' | 'interceptors' | 'logger'>> & Pick<CGSConfig, 'environment' | 'circuitBreaker' | 'enableRateLimitTracking'>;
138
134
  /** BaseClientConfig with core fields required, enterprise features remain optional */
139
- type RequiredBaseClientConfig = Required<Pick<BaseClientConfig, 'baseURL' | 'tenantId' | 'apiKey' | 'headers' | 'timeout' | 'retries' | 'debug' | 'interceptors' | 'logger'>> & Pick<BaseClientConfig, 'environment' | 'sandboxBaseURL' | 'circuitBreaker' | 'enableRateLimitTracking'>;
135
+ type RequiredBaseClientConfig = Required<Pick<BaseClientConfig, 'baseURL' | 'tenantId' | 'apiKey' | 'headers' | 'timeout' | 'retries' | 'debug' | 'interceptors' | 'logger'>> & Pick<BaseClientConfig, 'environment' | 'circuitBreaker' | 'enableRateLimitTracking'>;
140
136
 
141
137
  /**
142
138
  * Rate limit tracking from API response headers.
@@ -1,4 +1,4 @@
1
- import { L as Logger, B as BaseClient, R as RequestOptions } from './client-DzElM7u-.mjs';
1
+ import { L as Logger, B as BaseClient, R as RequestOptions } from './client-CY41e2Z_.mjs';
2
2
  import { P as PaginationParams } from './types-DZHongaK.mjs';
3
3
 
4
4
  interface DeviceFingerprintRequest {
@@ -472,6 +472,8 @@ interface GeolocationClientConfig {
472
472
  debug?: boolean;
473
473
  /** Custom logger instance */
474
474
  logger?: Logger;
475
+ /** Environment mode - 'sandbox' uses isolated sandbox data */
476
+ environment?: 'production' | 'sandbox';
475
477
  }
476
478
  interface UseGeolocationOptions {
477
479
  /** Auto-detect and verify user's IP on mount */
@@ -804,6 +806,15 @@ declare class GeolocationClient extends BaseClient {
804
806
  * ```
805
807
  */
806
808
  getGPSConfig(requestOptions?: RequestOptions): Promise<GeolocationConfigResponse>;
809
+ /**
810
+ * Fetch the signing key from the dedicated authenticated endpoint.
811
+ *
812
+ * Falls back to getGPSConfig() for backward compatibility with older servers
813
+ * that don't expose `/api/v1/geo/signing-key`.
814
+ *
815
+ * @returns The signing key string, or undefined if unavailable
816
+ */
817
+ fetchSigningKey(requestOptions?: RequestOptions): Promise<string | undefined>;
807
818
  /**
808
819
  * Validate a cipherText generated by the frontend SDK
809
820
  *
@@ -1,7 +1,7 @@
1
- import { D as DeviceFingerprintRequest, L as LocationVerification, P as LocationRequest, G as GeolocationClient, S as LocationRequestFilters, T as LocationRequestListResponse } from '../client-B6fUFAUM.mjs';
2
- export { Q as CreateLocationRequestRequest, Y as LocationCaptureRequest, _ as LocationCaptureResponse, O as LocationRequestChannel, R as LocationRequestResult, N as LocationRequestStatus, Z as LocationShareInfo, W as ResendLocationRequestRequest } from '../client-B6fUFAUM.mjs';
1
+ import { D as DeviceFingerprintRequest, L as LocationVerification, P as LocationRequest, G as GeolocationClient, S as LocationRequestFilters, T as LocationRequestListResponse } from '../client-oo_3-0YW.mjs';
2
+ export { Q as CreateLocationRequestRequest, Y as LocationCaptureRequest, _ as LocationCaptureResponse, O as LocationRequestChannel, R as LocationRequestResult, N as LocationRequestStatus, Z as LocationShareInfo, W as ResendLocationRequestRequest } from '../client-oo_3-0YW.mjs';
3
3
  import { RiskProfileClient } from '../risk-profile/index.mjs';
4
- import { c as CGSConfig, R as RequestOptions } from '../client-DzElM7u-.mjs';
4
+ import { c as CGSConfig, R as RequestOptions } from '../client-CY41e2Z_.mjs';
5
5
  import { C as CustomerProfile } from '../types-jaLuzruy.mjs';
6
6
  import { E as EntityType, P as PaginationParams } from '../types-DZHongaK.mjs';
7
7
 
@@ -1,7 +1,7 @@
1
- import { D as DeviceFingerprintRequest, L as LocationVerification, P as LocationRequest, G as GeolocationClient, S as LocationRequestFilters, T as LocationRequestListResponse } from '../client-DoczGA6L.js';
2
- export { Q as CreateLocationRequestRequest, Y as LocationCaptureRequest, _ as LocationCaptureResponse, O as LocationRequestChannel, R as LocationRequestResult, N as LocationRequestStatus, Z as LocationShareInfo, W as ResendLocationRequestRequest } from '../client-DoczGA6L.js';
1
+ import { D as DeviceFingerprintRequest, L as LocationVerification, P as LocationRequest, G as GeolocationClient, S as LocationRequestFilters, T as LocationRequestListResponse } from '../client-BlAt791q.js';
2
+ export { Q as CreateLocationRequestRequest, Y as LocationCaptureRequest, _ as LocationCaptureResponse, O as LocationRequestChannel, R as LocationRequestResult, N as LocationRequestStatus, Z as LocationShareInfo, W as ResendLocationRequestRequest } from '../client-BlAt791q.js';
3
3
  import { RiskProfileClient } from '../risk-profile/index.js';
4
- import { c as CGSConfig, R as RequestOptions } from '../client-DzElM7u-.js';
4
+ import { c as CGSConfig, R as RequestOptions } from '../client-CY41e2Z_.js';
5
5
  import { C as CustomerProfile } from '../types-DLC7Sfy5.js';
6
6
  import { E as EntityType, P as PaginationParams } from '../types-DZHongaK.js';
7
7
 
@@ -224,7 +224,7 @@ function createConsoleLogger() {
224
224
  }
225
225
 
226
226
  // src/core/version.ts
227
- var SDK_VERSION = "1.4.0";
227
+ var SDK_VERSION = "1.4.1";
228
228
 
229
229
  // src/shared/browser-utils.ts
230
230
  function generateUUID() {
@@ -318,12 +318,6 @@ var BaseClient = class {
318
318
  interceptors: this.interceptors,
319
319
  logger: this.logger
320
320
  };
321
- if (this.config.environment === "sandbox" && this.config.apiKey?.startsWith("pk_live_")) {
322
- this.logger.warn("Production API key used with sandbox environment. Use your sandbox API key (sk_sandbox_) instead.");
323
- }
324
- if (this.config.environment !== "sandbox" && this.config.apiKey?.startsWith("sk_sandbox_")) {
325
- this.logger.warn("Sandbox API key used with production environment. Use your production API key (pk_live_) instead.");
326
- }
327
321
  if (config.circuitBreaker) {
328
322
  this.circuitBreaker = new CircuitBreaker(config.circuitBreaker);
329
323
  }
@@ -347,9 +341,7 @@ var BaseClient = class {
347
341
  error.requestId = requestId;
348
342
  throw error;
349
343
  }
350
- const DEFAULT_SANDBOX_URL = "https://sandbox-api.vesant.ai";
351
- const resolvedBaseURL = this.config.environment === "sandbox" ? this.config.sandboxBaseURL || DEFAULT_SANDBOX_URL : serviceURL || this.config.baseURL;
352
- const url = `${serviceURL || resolvedBaseURL}${endpoint}`;
344
+ const url = `${serviceURL || this.config.baseURL}${endpoint}`;
353
345
  const headers = {
354
346
  "Content-Type": "application/json",
355
347
  "X-Tenant-ID": this.config.tenantId,
@@ -794,7 +786,8 @@ var GeolocationClient = class extends BaseClient {
794
786
  retries: 3,
795
787
  // Default retry count for geolocation calls
796
788
  debug: config.debug,
797
- logger: config.logger
789
+ logger: config.logger,
790
+ environment: config.environment
798
791
  };
799
792
  super(baseConfig);
800
793
  }
@@ -888,6 +881,32 @@ var GeolocationClient = class extends BaseClient {
888
881
  }
889
882
  return config;
890
883
  }
884
+ /**
885
+ * Fetch the signing key from the dedicated authenticated endpoint.
886
+ *
887
+ * Falls back to getGPSConfig() for backward compatibility with older servers
888
+ * that don't expose `/api/v1/geo/signing-key`.
889
+ *
890
+ * @returns The signing key string, or undefined if unavailable
891
+ */
892
+ async fetchSigningKey(requestOptions) {
893
+ try {
894
+ const response = await this.requestWithRetry(
895
+ "/api/v1/geo/signing-key",
896
+ void 0,
897
+ void 0,
898
+ void 0,
899
+ requestOptions
900
+ );
901
+ if (response.signing_key) {
902
+ this.cachedSigningKey = response.signing_key;
903
+ return response.signing_key;
904
+ }
905
+ } catch {
906
+ }
907
+ const config = await this.getGPSConfig(requestOptions);
908
+ return config.signing_key;
909
+ }
891
910
  // ============================================================================
892
911
  // CipherText Validation
893
912
  // ============================================================================
@@ -1168,11 +1187,10 @@ var GeolocationClient = class extends BaseClient {
1168
1187
  let signingKey = this.cachedSigningKey;
1169
1188
  let resolvedGpsConfig = gpsConfig;
1170
1189
  if (!signingKey) {
1171
- const config = await this.getGPSConfig();
1172
- signingKey = config.signing_key;
1173
- if (!resolvedGpsConfig) {
1174
- resolvedGpsConfig = config;
1175
- }
1190
+ signingKey = await this.fetchSigningKey();
1191
+ }
1192
+ if (!resolvedGpsConfig) {
1193
+ resolvedGpsConfig = await this.getGPSConfig();
1176
1194
  }
1177
1195
  return generateCipherText(
1178
1196
  { ...options, signingKey: signingKey || void 0 },