vesant-sdk 1.6.5 → 1.6.6-next.ac58d2b

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 (82) hide show
  1. package/README.md +10 -0
  2. package/dist/{client-ePzhQKp9.d.mts → client-BolQlL5e.d.mts} +1 -1
  3. package/dist/{client-ePzhQKp9.d.ts → client-BolQlL5e.d.ts} +1 -1
  4. package/dist/{client-BlCxjbY2.d.mts → client-D6PE3pcB.d.mts} +2 -2
  5. package/dist/{client-C_A7QLcB.d.ts → client-DPtiuQvW.d.ts} +2 -2
  6. package/dist/compliance/index.d.mts +4 -4
  7. package/dist/compliance/index.d.ts +4 -4
  8. package/dist/compliance/index.js +10 -25
  9. package/dist/compliance/index.js.map +1 -1
  10. package/dist/compliance/index.mjs +10 -25
  11. package/dist/compliance/index.mjs.map +1 -1
  12. package/dist/decisions/index.d.mts +1 -1
  13. package/dist/decisions/index.d.ts +1 -1
  14. package/dist/decisions/index.js +1 -1
  15. package/dist/decisions/index.js.map +1 -1
  16. package/dist/decisions/index.mjs +1 -1
  17. package/dist/decisions/index.mjs.map +1 -1
  18. package/dist/geolocation/index.d.mts +3 -3
  19. package/dist/geolocation/index.d.ts +3 -3
  20. package/dist/geolocation/index.js +6 -24
  21. package/dist/geolocation/index.js.map +1 -1
  22. package/dist/geolocation/index.mjs +6 -24
  23. package/dist/geolocation/index.mjs.map +1 -1
  24. package/dist/index.d.mts +9 -68
  25. package/dist/index.d.ts +9 -68
  26. package/dist/index.js +49 -204
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +50 -203
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/kyc/core.d.mts +3 -3
  31. package/dist/kyc/core.d.ts +3 -3
  32. package/dist/kyc/core.js +10 -13
  33. package/dist/kyc/core.js.map +1 -1
  34. package/dist/kyc/core.mjs +10 -13
  35. package/dist/kyc/core.mjs.map +1 -1
  36. package/dist/kyc/index.d.mts +15 -26
  37. package/dist/kyc/index.d.ts +15 -26
  38. package/dist/kyc/index.js +10 -13
  39. package/dist/kyc/index.js.map +1 -1
  40. package/dist/kyc/index.mjs +10 -13
  41. package/dist/kyc/index.mjs.map +1 -1
  42. package/dist/react.d.mts +5 -5
  43. package/dist/react.d.ts +5 -5
  44. package/dist/react.js +18 -5
  45. package/dist/react.js.map +1 -1
  46. package/dist/react.mjs +18 -5
  47. package/dist/react.mjs.map +1 -1
  48. package/dist/risk-profile/index.d.mts +3 -3
  49. package/dist/risk-profile/index.d.ts +3 -3
  50. package/dist/risk-profile/index.js +1 -1
  51. package/dist/risk-profile/index.js.map +1 -1
  52. package/dist/risk-profile/index.mjs +1 -1
  53. package/dist/risk-profile/index.mjs.map +1 -1
  54. package/dist/scores/index.d.mts +1 -1
  55. package/dist/scores/index.d.ts +1 -1
  56. package/dist/scores/index.js +1 -1
  57. package/dist/scores/index.js.map +1 -1
  58. package/dist/scores/index.mjs +1 -1
  59. package/dist/scores/index.mjs.map +1 -1
  60. package/dist/tax/index.d.mts +6 -41
  61. package/dist/tax/index.d.ts +6 -41
  62. package/dist/tax/index.js +1 -36
  63. package/dist/tax/index.js.map +1 -1
  64. package/dist/tax/index.mjs +1 -36
  65. package/dist/tax/index.mjs.map +1 -1
  66. package/dist/{types-1RzYeSal.d.mts → types-DGDVnogO.d.mts} +1 -1
  67. package/dist/{types-X5Md_dD_.d.ts → types-_YQdS3Ax.d.ts} +1 -1
  68. package/dist/webhooks/index.d.mts +181 -2
  69. package/dist/webhooks/index.d.ts +181 -2
  70. package/dist/webhooks/index.js +49 -7
  71. package/dist/webhooks/index.js.map +1 -1
  72. package/dist/webhooks/index.mjs +49 -7
  73. package/dist/webhooks/index.mjs.map +1 -1
  74. package/package.json +16 -13
  75. package/dist/fraud/index.d.mts +0 -80
  76. package/dist/fraud/index.d.ts +0 -80
  77. package/dist/fraud/index.js +0 -606
  78. package/dist/fraud/index.js.map +0 -1
  79. package/dist/fraud/index.mjs +0 -604
  80. package/dist/fraud/index.mjs.map +0 -1
  81. package/dist/index-B04H4xfJ.d.mts +0 -320
  82. package/dist/index-CItMPmLL.d.ts +0 -320
package/README.md CHANGED
@@ -27,6 +27,16 @@ yarn add vesant-sdk
27
27
  pnpm add vesant-sdk
28
28
  ```
29
29
 
30
+ ### Fraud scoring
31
+
32
+ Fraud event scoring uses a separate package (not a `vesant-sdk` subpath export):
33
+
34
+ ```bash
35
+ npm install @vesant-sdk/fraud
36
+ ```
37
+
38
+ See [Fraud integration guide](./docs/guides/fraud-integration.md).
39
+
30
40
  ## Quick Start
31
41
 
32
42
  ### Initialize the SDK
@@ -237,4 +237,4 @@ declare abstract class BaseClient {
237
237
  }>;
238
238
  }
239
239
 
240
- export { BaseClient as B, type CircuitBreakerConfig as C, type Logger as L, type RequestOptions as R, type VesantConfig as V, type BaseClientConfig as a, type RequestInterceptor as b, type RequiredVesantConfig as c, type CGSConfig as d, type RequiredCGSConfig as e, type RequiredBaseClientConfig as f, type CircuitBreakerState as g, type CircuitBreakerStatus as h, CircuitBreaker as i, type RateLimitStatus as j, RateLimitTracker as k };
240
+ export { BaseClient as B, type CGSConfig as C, type Logger as L, type RequestOptions as R, type VesantConfig as V, type BaseClientConfig as a, CircuitBreaker as b, type CircuitBreakerConfig as c, type CircuitBreakerState as d, type CircuitBreakerStatus as e, type RateLimitStatus as f, RateLimitTracker as g, type RequestInterceptor as h, type RequiredBaseClientConfig as i, type RequiredCGSConfig as j, type RequiredVesantConfig as k };
@@ -237,4 +237,4 @@ declare abstract class BaseClient {
237
237
  }>;
238
238
  }
239
239
 
240
- export { BaseClient as B, type CircuitBreakerConfig as C, type Logger as L, type RequestOptions as R, type VesantConfig as V, type BaseClientConfig as a, type RequestInterceptor as b, type RequiredVesantConfig as c, type CGSConfig as d, type RequiredCGSConfig as e, type RequiredBaseClientConfig as f, type CircuitBreakerState as g, type CircuitBreakerStatus as h, CircuitBreaker as i, type RateLimitStatus as j, RateLimitTracker as k };
240
+ export { BaseClient as B, type CGSConfig as C, type Logger as L, type RequestOptions as R, type VesantConfig as V, type BaseClientConfig as a, CircuitBreaker as b, type CircuitBreakerConfig as c, type CircuitBreakerState as d, type CircuitBreakerStatus as e, type RateLimitStatus as f, RateLimitTracker as g, type RequestInterceptor as h, type RequiredBaseClientConfig as i, type RequiredCGSConfig as j, type RequiredVesantConfig as k };
@@ -1,4 +1,4 @@
1
- import { L as Logger, B as BaseClient, R as RequestOptions } from './client-ePzhQKp9.mjs';
1
+ import { L as Logger, B as BaseClient, R as RequestOptions } from './client-BolQlL5e.mjs';
2
2
  import { P as PaginationParams } from './types-B4Ezqo7V.mjs';
3
3
 
4
4
  interface DeviceFingerprintRequest {
@@ -1016,4 +1016,4 @@ declare class GeolocationClient extends BaseClient {
1016
1016
  generateCipherText(options: Omit<CipherTextOptions, 'apiKey' | 'signingKey'>, gpsConfig?: GeolocationConfigResponse): Promise<CipherTextResult>;
1017
1017
  }
1018
1018
 
1019
- export { type UseLocationRequestsOptions as $, type AlertStatus as A, type APIError as B, type CipherTextPayload as C, type DeviceFingerprintRequest as D, type GeolocationConfigResponse as E, type GeolocationClientConfig as F, GeolocationClient as G, type UseGeolocationOptions as H, type UseGeolocationResult as I, type JurisdictionConfig as J, type UseAlertsOptions as K, type LocationVerification as L, type UseAlertsResult as M, type LocationRequestStatus as N, type LocationRequestChannel as O, type LocationRequest as P, type CreateLocationRequestRequest as Q, type LocationRequestResult as R, type LocationRequestFilters as S, type LocationRequestListResponse as T, type UpdateJurisdictionRequest as U, type ValidateCipherTextRequest as V, type ResendLocationRequestRequest as W, type WiFiNetwork as X, type LocationCaptureRequest as Y, type LocationShareInfo as Z, type LocationCaptureResponse as _, type CipherTextReason as a, type UseLocationRequestsResult as a0, type UseLocationCaptureOptions as a1, type UseLocationCaptureResult as a2, type CipherTextOptions as b, type CipherTextResult as c, type DecryptedCipherText as d, type CipherTextCustomerData as e, type ValidateCipherTextResponse as f, type VerifyIPRequest as g, type GeoIPResult as h, type GeofenceEvaluation as i, type DeviceFingerprint as j, type DeviceTrustResult as k, type ComplianceCheckResponse as l, type AlertSeverity as m, type AlertType as n, type GeolocationAlert as o, type AlertFilters as p, type AlertListResponse as q, type DashboardMetrics as r, type CreateJurisdictionRequest as s, type GeofenceRuleType as t, type GeofenceAction as u, type GeofenceRule as v, type CreateGeofenceRuleRequest as w, type UpdateGeofenceRuleRequest as x, type UpdateDeviceTrustRequest as y, type GeolocationRecord as z };
1019
+ export { type ValidateCipherTextRequest as $, type APIError as A, type LocationCaptureResponse as B, type CipherTextCustomerData as C, type DashboardMetrics as D, type LocationRequest as E, type LocationRequestChannel as F, type GeoIPResult as G, type LocationRequestFilters as H, type LocationRequestListResponse as I, type JurisdictionConfig as J, type LocationRequestResult as K, type LocationCaptureRequest as L, type LocationRequestStatus as M, type LocationShareInfo as N, type LocationVerification as O, type UpdateGeofenceRuleRequest as P, type UpdateJurisdictionRequest as Q, type ResendLocationRequestRequest as R, type UseAlertsOptions as S, type UseAlertsResult as T, type UpdateDeviceTrustRequest as U, type UseGeolocationOptions as V, type UseGeolocationResult as W, type UseLocationCaptureOptions as X, type UseLocationCaptureResult as Y, type UseLocationRequestsOptions as Z, type UseLocationRequestsResult as _, type AlertFilters as a, type ValidateCipherTextResponse as a0, type VerifyIPRequest as a1, type WiFiNetwork as a2, type AlertListResponse as b, type AlertSeverity as c, type AlertStatus as d, type AlertType as e, type CipherTextOptions as f, type CipherTextPayload as g, type CipherTextReason as h, type CipherTextResult as i, type ComplianceCheckResponse as j, type CreateGeofenceRuleRequest as k, type CreateJurisdictionRequest as l, type CreateLocationRequestRequest as m, type DecryptedCipherText as n, type DeviceFingerprint as o, type DeviceFingerprintRequest as p, type DeviceTrustResult as q, type GeofenceAction as r, type GeofenceEvaluation as s, type GeofenceRule as t, type GeofenceRuleType as u, type GeolocationAlert as v, GeolocationClient as w, type GeolocationClientConfig as x, type GeolocationConfigResponse as y, type GeolocationRecord as z };
@@ -1,4 +1,4 @@
1
- import { L as Logger, B as BaseClient, R as RequestOptions } from './client-ePzhQKp9.js';
1
+ import { L as Logger, B as BaseClient, R as RequestOptions } from './client-BolQlL5e.js';
2
2
  import { P as PaginationParams } from './types-B4Ezqo7V.js';
3
3
 
4
4
  interface DeviceFingerprintRequest {
@@ -1016,4 +1016,4 @@ declare class GeolocationClient extends BaseClient {
1016
1016
  generateCipherText(options: Omit<CipherTextOptions, 'apiKey' | 'signingKey'>, gpsConfig?: GeolocationConfigResponse): Promise<CipherTextResult>;
1017
1017
  }
1018
1018
 
1019
- export { type UseLocationRequestsOptions as $, type AlertStatus as A, type APIError as B, type CipherTextPayload as C, type DeviceFingerprintRequest as D, type GeolocationConfigResponse as E, type GeolocationClientConfig as F, GeolocationClient as G, type UseGeolocationOptions as H, type UseGeolocationResult as I, type JurisdictionConfig as J, type UseAlertsOptions as K, type LocationVerification as L, type UseAlertsResult as M, type LocationRequestStatus as N, type LocationRequestChannel as O, type LocationRequest as P, type CreateLocationRequestRequest as Q, type LocationRequestResult as R, type LocationRequestFilters as S, type LocationRequestListResponse as T, type UpdateJurisdictionRequest as U, type ValidateCipherTextRequest as V, type ResendLocationRequestRequest as W, type WiFiNetwork as X, type LocationCaptureRequest as Y, type LocationShareInfo as Z, type LocationCaptureResponse as _, type CipherTextReason as a, type UseLocationRequestsResult as a0, type UseLocationCaptureOptions as a1, type UseLocationCaptureResult as a2, type CipherTextOptions as b, type CipherTextResult as c, type DecryptedCipherText as d, type CipherTextCustomerData as e, type ValidateCipherTextResponse as f, type VerifyIPRequest as g, type GeoIPResult as h, type GeofenceEvaluation as i, type DeviceFingerprint as j, type DeviceTrustResult as k, type ComplianceCheckResponse as l, type AlertSeverity as m, type AlertType as n, type GeolocationAlert as o, type AlertFilters as p, type AlertListResponse as q, type DashboardMetrics as r, type CreateJurisdictionRequest as s, type GeofenceRuleType as t, type GeofenceAction as u, type GeofenceRule as v, type CreateGeofenceRuleRequest as w, type UpdateGeofenceRuleRequest as x, type UpdateDeviceTrustRequest as y, type GeolocationRecord as z };
1019
+ export { type ValidateCipherTextRequest as $, type APIError as A, type LocationCaptureResponse as B, type CipherTextCustomerData as C, type DashboardMetrics as D, type LocationRequest as E, type LocationRequestChannel as F, type GeoIPResult as G, type LocationRequestFilters as H, type LocationRequestListResponse as I, type JurisdictionConfig as J, type LocationRequestResult as K, type LocationCaptureRequest as L, type LocationRequestStatus as M, type LocationShareInfo as N, type LocationVerification as O, type UpdateGeofenceRuleRequest as P, type UpdateJurisdictionRequest as Q, type ResendLocationRequestRequest as R, type UseAlertsOptions as S, type UseAlertsResult as T, type UpdateDeviceTrustRequest as U, type UseGeolocationOptions as V, type UseGeolocationResult as W, type UseLocationCaptureOptions as X, type UseLocationCaptureResult as Y, type UseLocationRequestsOptions as Z, type UseLocationRequestsResult as _, type AlertFilters as a, type ValidateCipherTextResponse as a0, type VerifyIPRequest as a1, type WiFiNetwork as a2, type AlertListResponse as b, type AlertSeverity as c, type AlertStatus as d, type AlertType as e, type CipherTextOptions as f, type CipherTextPayload as g, type CipherTextReason as h, type CipherTextResult as i, type ComplianceCheckResponse as j, type CreateGeofenceRuleRequest as k, type CreateJurisdictionRequest as l, type CreateLocationRequestRequest as m, type DecryptedCipherText as n, type DeviceFingerprint as o, type DeviceFingerprintRequest as p, type DeviceTrustResult as q, type GeofenceAction as r, type GeofenceEvaluation as s, type GeofenceRule as t, type GeofenceRuleType as u, type GeolocationAlert as v, GeolocationClient as w, type GeolocationClientConfig as x, type GeolocationConfigResponse as y, type GeolocationRecord as z };
@@ -1,8 +1,8 @@
1
- import { D as DeviceFingerprintRequest, L as LocationVerification, f as ValidateCipherTextResponse, P as LocationRequest, G as GeolocationClient, S as LocationRequestFilters, T as LocationRequestListResponse } from '../client-BlCxjbY2.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-BlCxjbY2.mjs';
1
+ import { p as DeviceFingerprintRequest, O as LocationVerification, a0 as ValidateCipherTextResponse, E as LocationRequest, w as GeolocationClient, H as LocationRequestFilters, I as LocationRequestListResponse } from '../client-D6PE3pcB.mjs';
2
+ export { m as CreateLocationRequestRequest, L as LocationCaptureRequest, B as LocationCaptureResponse, F as LocationRequestChannel, K as LocationRequestResult, M as LocationRequestStatus, N as LocationShareInfo, R as ResendLocationRequestRequest } from '../client-D6PE3pcB.mjs';
3
3
  import { RiskProfileClient } from '../risk-profile/index.mjs';
4
- import { V as VesantConfig, R as RequestOptions } from '../client-ePzhQKp9.mjs';
5
- import { C as CustomerProfile } from '../types-1RzYeSal.mjs';
4
+ import { V as VesantConfig, R as RequestOptions } from '../client-BolQlL5e.mjs';
5
+ import { a as CustomerProfile } from '../types-DGDVnogO.mjs';
6
6
  import { E as EntityType, P as PaginationParams } from '../types-B4Ezqo7V.mjs';
7
7
 
8
8
  interface RegistrationVerificationRequest {
@@ -1,8 +1,8 @@
1
- import { D as DeviceFingerprintRequest, L as LocationVerification, f as ValidateCipherTextResponse, P as LocationRequest, G as GeolocationClient, S as LocationRequestFilters, T as LocationRequestListResponse } from '../client-C_A7QLcB.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-C_A7QLcB.js';
1
+ import { p as DeviceFingerprintRequest, O as LocationVerification, a0 as ValidateCipherTextResponse, E as LocationRequest, w as GeolocationClient, H as LocationRequestFilters, I as LocationRequestListResponse } from '../client-DPtiuQvW.js';
2
+ export { m as CreateLocationRequestRequest, L as LocationCaptureRequest, B as LocationCaptureResponse, F as LocationRequestChannel, K as LocationRequestResult, M as LocationRequestStatus, N as LocationShareInfo, R as ResendLocationRequestRequest } from '../client-DPtiuQvW.js';
3
3
  import { RiskProfileClient } from '../risk-profile/index.js';
4
- import { V as VesantConfig, R as RequestOptions } from '../client-ePzhQKp9.js';
5
- import { C as CustomerProfile } from '../types-X5Md_dD_.js';
4
+ import { V as VesantConfig, R as RequestOptions } from '../client-BolQlL5e.js';
5
+ import { a as CustomerProfile } from '../types-_YQdS3Ax.js';
6
6
  import { E as EntityType, P as PaginationParams } from '../types-B4Ezqo7V.js';
7
7
 
8
8
  interface RegistrationVerificationRequest {
@@ -224,7 +224,7 @@ function createConsoleLogger() {
224
224
  }
225
225
 
226
226
  // src/core/version.ts
227
- var SDK_VERSION = "1.6.5";
227
+ var SDK_VERSION = "1.6.6";
228
228
 
229
229
  // src/shared/browser-utils.ts
230
230
  function generateUUID() {
@@ -727,7 +727,7 @@ function encodePayload(payload) {
727
727
  } else if (typeof Buffer !== "undefined") {
728
728
  return Buffer.from(json, "utf-8").toString("base64");
729
729
  }
730
- throw new Error("No base64 encoding method available");
730
+ throw new VesantError("No base64 encoding method available", "BASE64_UNAVAILABLE");
731
731
  }
732
732
  async function generateCipherText(options, config) {
733
733
  const warnings = [];
@@ -752,8 +752,9 @@ async function generateCipherText(options, config) {
752
752
  if (location) {
753
753
  locationData = location;
754
754
  } else if (gpsRequiredByConfig) {
755
- throw new Error(
756
- `GPS location is required for ${options.reason} by tenant configuration, but GPS was not available or permission was denied`
755
+ throw new VesantError(
756
+ `GPS location is required for ${options.reason} by tenant configuration, but GPS was not available or permission was denied`,
757
+ "GPS_REQUIRED"
757
758
  );
758
759
  } else {
759
760
  warnings.push("GPS location not available or permission denied");
@@ -847,10 +848,9 @@ var GeolocationClient = class extends BaseClient {
847
848
  if (!request.ip_address?.trim()) {
848
849
  throw new ValidationError("ip_address is required and must be a non-empty string", ["ip_address"]);
849
850
  }
850
- const enrichedRequest = request.device_fingerprint ? request : { ...request, device_fingerprint: collectDeviceFingerprint() };
851
851
  return this.requestWithRetry("/api/v1/geo/verify", {
852
852
  method: "POST",
853
- body: JSON.stringify(enrichedRequest)
853
+ body: JSON.stringify(request)
854
854
  }, void 0, void 0, requestOptions);
855
855
  }
856
856
  /**
@@ -1254,24 +1254,6 @@ var GeolocationClient = class extends BaseClient {
1254
1254
  // Utility Methods (inherited from BaseClient: healthCheck, updateConfig, getConfig, buildQueryString)
1255
1255
  // ============================================================================
1256
1256
  };
1257
- function collectDeviceFingerprint() {
1258
- const deviceId = generateDeviceId();
1259
- const browserInfo = getBrowserInfo();
1260
- const userAgent = typeof navigator !== "undefined" ? navigator.userAgent : "server";
1261
- const platform = typeof navigator !== "undefined" ? navigator.platform || "unknown" : "server";
1262
- return {
1263
- device_id: deviceId,
1264
- user_agent: userAgent,
1265
- platform,
1266
- browser: browserInfo.browser,
1267
- browser_version: browserInfo.browser_version,
1268
- os: browserInfo.os,
1269
- os_version: browserInfo.os_version,
1270
- screen_resolution: typeof screen !== "undefined" ? `${screen.width}x${screen.height}` : void 0,
1271
- language: typeof navigator !== "undefined" ? navigator.language : void 0,
1272
- timezone: Intl?.DateTimeFormat?.()?.resolvedOptions?.()?.timeZone
1273
- };
1274
- }
1275
1257
 
1276
1258
  // src/risk-profile/client.ts
1277
1259
  var RiskProfileClient = class extends BaseClient {
@@ -1588,10 +1570,13 @@ var ComplianceClient = class {
1588
1570
  } catch (error) {
1589
1571
  if (this.config.debug) {
1590
1572
  this.logger.error("Registration verification failed", {
1591
- code: error instanceof Error ? error.code : void 0,
1573
+ code: error instanceof VesantError ? error.code : void 0,
1592
1574
  message: error instanceof Error ? error.message : "Unknown error"
1593
1575
  });
1594
1576
  }
1577
+ if (error instanceof VesantError && error.code === "DUPLICATE_PROFILE") {
1578
+ throw error;
1579
+ }
1595
1580
  throw new ComplianceError(
1596
1581
  "Registration verification failed",
1597
1582
  error instanceof Error ? error.message : void 0,