vesant-sdk 1.6.0 → 1.6.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.
Files changed (65) hide show
  1. package/dist/{client-C4g596fI.d.mts → client-DW1Xiz6a.d.mts} +2 -2
  2. package/dist/{client-Bd9a5o0C.d.ts → client-eLbtPRkh.d.ts} +2 -2
  3. package/dist/{client-CIon-bGS.d.mts → client-ePzhQKp9.d.mts} +2 -0
  4. package/dist/{client-CIon-bGS.d.ts → client-ePzhQKp9.d.ts} +2 -0
  5. package/dist/compliance/index.d.mts +5 -5
  6. package/dist/compliance/index.d.ts +5 -5
  7. package/dist/compliance/index.js +25 -7
  8. package/dist/compliance/index.js.map +1 -1
  9. package/dist/compliance/index.mjs +25 -7
  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 +14 -1
  14. package/dist/decisions/index.js.map +1 -1
  15. package/dist/decisions/index.mjs +14 -1
  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 +14 -1
  20. package/dist/geolocation/index.js.map +1 -1
  21. package/dist/geolocation/index.mjs +14 -1
  22. package/dist/geolocation/index.mjs.map +1 -1
  23. package/dist/index.d.mts +6 -376
  24. package/dist/index.d.ts +6 -376
  25. package/dist/index.js +92 -216
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +92 -216
  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 +14 -1
  32. package/dist/kyc/core.js.map +1 -1
  33. package/dist/kyc/core.mjs +14 -1
  34. package/dist/kyc/core.mjs.map +1 -1
  35. package/dist/kyc/index.d.mts +1 -1
  36. package/dist/kyc/index.d.ts +1 -1
  37. package/dist/kyc/index.js +14 -1
  38. package/dist/kyc/index.js.map +1 -1
  39. package/dist/kyc/index.mjs +14 -1
  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 +14 -1
  50. package/dist/risk-profile/index.js.map +1 -1
  51. package/dist/risk-profile/index.mjs +14 -1
  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 +14 -1
  56. package/dist/scores/index.js.map +1 -1
  57. package/dist/scores/index.mjs +14 -1
  58. package/dist/scores/index.mjs.map +1 -1
  59. package/dist/tax/index.d.mts +256 -0
  60. package/dist/tax/index.d.ts +256 -0
  61. package/dist/tax/index.js +652 -0
  62. package/dist/tax/index.js.map +1 -0
  63. package/dist/tax/index.mjs +650 -0
  64. package/dist/tax/index.mjs.map +1 -0
  65. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { L as Logger, B as BaseClient, R as RequestOptions } from './client-CIon-bGS.mjs';
1
+ import { L as Logger, B as BaseClient, R as RequestOptions } from './client-ePzhQKp9.mjs';
2
2
  import { P as PaginationParams } from './types-B4Ezqo7V.mjs';
3
3
 
4
4
  interface DeviceFingerprintRequest {
@@ -1010,4 +1010,4 @@ declare class GeolocationClient extends BaseClient {
1010
1010
  generateCipherText(options: Omit<CipherTextOptions, 'apiKey' | 'signingKey'>, gpsConfig?: GeolocationConfigResponse): Promise<CipherTextResult>;
1011
1011
  }
1012
1012
 
1013
- export { type WiFiNetwork as $, type AlertStatus as A, type GeofenceAction as B, type CipherTextOptions as C, type DeviceFingerprintRequest as D, type GeofenceRule as E, type CreateGeofenceRuleRequest as F, GeolocationClient as G, type UpdateGeofenceRuleRequest as H, type UpdateDeviceTrustRequest as I, type JurisdictionConfig as J, type GeolocationRecord as K, type LocationVerification as L, type APIError as M, type GeolocationConfigResponse as N, type GeolocationClientConfig as O, type UseAlertsOptions as P, type UseAlertsResult as Q, type LocationRequestStatus as R, type LocationRequestChannel as S, type LocationRequest as T, type UseGeolocationOptions as U, type ValidateCipherTextRequest as V, type CreateLocationRequestRequest as W, type LocationRequestResult as X, type LocationRequestFilters as Y, type LocationRequestListResponse as Z, type ResendLocationRequestRequest as _, type UseGeolocationResult as a, type LocationCaptureRequest as a0, type LocationShareInfo as a1, type LocationCaptureResponse as a2, type UseLocationRequestsOptions as b, type UseLocationRequestsResult as c, type UseLocationCaptureOptions as d, type UseLocationCaptureResult as e, type CipherTextResult as f, type CipherTextPayload as g, type CipherTextReason as h, type DecryptedCipherText as i, type CipherTextCustomerData as j, type ValidateCipherTextResponse as k, type VerifyIPRequest as l, type GeoIPResult as m, type GeofenceEvaluation as n, type DeviceFingerprint as o, type DeviceTrustResult as p, type ComplianceCheckResponse as q, type AlertSeverity as r, type AlertType as s, type GeolocationAlert as t, type AlertFilters as u, type AlertListResponse as v, type DashboardMetrics as w, type CreateJurisdictionRequest as x, type UpdateJurisdictionRequest as y, type GeofenceRuleType as z };
1013
+ 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 };
@@ -1,4 +1,4 @@
1
- import { L as Logger, B as BaseClient, R as RequestOptions } from './client-CIon-bGS.js';
1
+ import { L as Logger, B as BaseClient, R as RequestOptions } from './client-ePzhQKp9.js';
2
2
  import { P as PaginationParams } from './types-B4Ezqo7V.js';
3
3
 
4
4
  interface DeviceFingerprintRequest {
@@ -1010,4 +1010,4 @@ declare class GeolocationClient extends BaseClient {
1010
1010
  generateCipherText(options: Omit<CipherTextOptions, 'apiKey' | 'signingKey'>, gpsConfig?: GeolocationConfigResponse): Promise<CipherTextResult>;
1011
1011
  }
1012
1012
 
1013
- export { type WiFiNetwork as $, type AlertStatus as A, type GeofenceAction as B, type CipherTextOptions as C, type DeviceFingerprintRequest as D, type GeofenceRule as E, type CreateGeofenceRuleRequest as F, GeolocationClient as G, type UpdateGeofenceRuleRequest as H, type UpdateDeviceTrustRequest as I, type JurisdictionConfig as J, type GeolocationRecord as K, type LocationVerification as L, type APIError as M, type GeolocationConfigResponse as N, type GeolocationClientConfig as O, type UseAlertsOptions as P, type UseAlertsResult as Q, type LocationRequestStatus as R, type LocationRequestChannel as S, type LocationRequest as T, type UseGeolocationOptions as U, type ValidateCipherTextRequest as V, type CreateLocationRequestRequest as W, type LocationRequestResult as X, type LocationRequestFilters as Y, type LocationRequestListResponse as Z, type ResendLocationRequestRequest as _, type UseGeolocationResult as a, type LocationCaptureRequest as a0, type LocationShareInfo as a1, type LocationCaptureResponse as a2, type UseLocationRequestsOptions as b, type UseLocationRequestsResult as c, type UseLocationCaptureOptions as d, type UseLocationCaptureResult as e, type CipherTextResult as f, type CipherTextPayload as g, type CipherTextReason as h, type DecryptedCipherText as i, type CipherTextCustomerData as j, type ValidateCipherTextResponse as k, type VerifyIPRequest as l, type GeoIPResult as m, type GeofenceEvaluation as n, type DeviceFingerprint as o, type DeviceTrustResult as p, type ComplianceCheckResponse as q, type AlertSeverity as r, type AlertType as s, type GeolocationAlert as t, type AlertFilters as u, type AlertListResponse as v, type DashboardMetrics as w, type CreateJurisdictionRequest as x, type UpdateJurisdictionRequest as y, type GeofenceRuleType as z };
1013
+ 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 };
@@ -64,6 +64,8 @@ interface RequestOptions {
64
64
  signal?: AbortSignal;
65
65
  /** Idempotency key for POST/PUT/PATCH requests */
66
66
  idempotencyKey?: string;
67
+ /** Response type — defaults to 'json'. Use 'arraybuffer' for binary downloads (PDF, etc.) */
68
+ responseType?: 'json' | 'arraybuffer';
67
69
  }
68
70
  interface RequestInterceptor {
69
71
  /** Called before each request. Can modify headers or options. */
@@ -64,6 +64,8 @@ interface RequestOptions {
64
64
  signal?: AbortSignal;
65
65
  /** Idempotency key for POST/PUT/PATCH requests */
66
66
  idempotencyKey?: string;
67
+ /** Response type — defaults to 'json'. Use 'arraybuffer' for binary downloads (PDF, etc.) */
68
+ responseType?: 'json' | 'arraybuffer';
67
69
  }
68
70
  interface RequestInterceptor {
69
71
  /** Called before each request. Can modify headers or options. */
@@ -1,7 +1,7 @@
1
- import { D as DeviceFingerprintRequest, L as LocationVerification, k as ValidateCipherTextResponse, T as LocationRequest, G as GeolocationClient, Y as LocationRequestFilters, Z as LocationRequestListResponse } from '../client-C4g596fI.mjs';
2
- export { W as CreateLocationRequestRequest, a0 as LocationCaptureRequest, a2 as LocationCaptureResponse, S as LocationRequestChannel, X as LocationRequestResult, R as LocationRequestStatus, a1 as LocationShareInfo, _ as ResendLocationRequestRequest } from '../client-C4g596fI.mjs';
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-DW1Xiz6a.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-DW1Xiz6a.mjs';
3
3
  import { RiskProfileClient } from '../risk-profile/index.mjs';
4
- import { V as VesantConfig, R as RequestOptions } from '../client-CIon-bGS.mjs';
4
+ import { V as VesantConfig, R as RequestOptions } from '../client-ePzhQKp9.mjs';
5
5
  import { C as CustomerProfile } from '../types-1RzYeSal.mjs';
6
6
  import { E as EntityType, P as PaginationParams } from '../types-B4Ezqo7V.mjs';
7
7
 
@@ -38,7 +38,7 @@ interface LoginVerificationRequest {
38
38
  interface LoginVerificationResponse {
39
39
  allowed: boolean;
40
40
  geolocation: LocationVerification;
41
- profile: CustomerProfile;
41
+ profile: CustomerProfile | null;
42
42
  requiresStepUp: boolean;
43
43
  blockReasons: string[];
44
44
  processingTime: number;
@@ -57,7 +57,7 @@ interface TransactionVerificationRequest {
57
57
  interface TransactionVerificationResponse {
58
58
  allowed: boolean;
59
59
  geolocation: LocationVerification;
60
- profile: CustomerProfile;
60
+ profile: CustomerProfile | null;
61
61
  transactionRisk: TransactionRiskResult;
62
62
  requiresApproval: boolean;
63
63
  blockReasons: string[];
@@ -1,7 +1,7 @@
1
- import { D as DeviceFingerprintRequest, L as LocationVerification, k as ValidateCipherTextResponse, T as LocationRequest, G as GeolocationClient, Y as LocationRequestFilters, Z as LocationRequestListResponse } from '../client-Bd9a5o0C.js';
2
- export { W as CreateLocationRequestRequest, a0 as LocationCaptureRequest, a2 as LocationCaptureResponse, S as LocationRequestChannel, X as LocationRequestResult, R as LocationRequestStatus, a1 as LocationShareInfo, _ as ResendLocationRequestRequest } from '../client-Bd9a5o0C.js';
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-eLbtPRkh.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-eLbtPRkh.js';
3
3
  import { RiskProfileClient } from '../risk-profile/index.js';
4
- import { V as VesantConfig, R as RequestOptions } from '../client-CIon-bGS.js';
4
+ import { V as VesantConfig, R as RequestOptions } from '../client-ePzhQKp9.js';
5
5
  import { C as CustomerProfile } from '../types-X5Md_dD_.js';
6
6
  import { E as EntityType, P as PaginationParams } from '../types-B4Ezqo7V.js';
7
7
 
@@ -38,7 +38,7 @@ interface LoginVerificationRequest {
38
38
  interface LoginVerificationResponse {
39
39
  allowed: boolean;
40
40
  geolocation: LocationVerification;
41
- profile: CustomerProfile;
41
+ profile: CustomerProfile | null;
42
42
  requiresStepUp: boolean;
43
43
  blockReasons: string[];
44
44
  processingTime: number;
@@ -57,7 +57,7 @@ interface TransactionVerificationRequest {
57
57
  interface TransactionVerificationResponse {
58
58
  allowed: boolean;
59
59
  geolocation: LocationVerification;
60
- profile: CustomerProfile;
60
+ profile: CustomerProfile | null;
61
61
  transactionRisk: TransactionRiskResult;
62
62
  requiresApproval: boolean;
63
63
  blockReasons: string[];
@@ -224,7 +224,7 @@ function createConsoleLogger() {
224
224
  }
225
225
 
226
226
  // src/core/version.ts
227
- var SDK_VERSION = "1.6.0";
227
+ var SDK_VERSION = "1.6.1";
228
228
 
229
229
  // src/shared/browser-utils.ts
230
230
  function generateUUID() {
@@ -398,6 +398,19 @@ var BaseClient = class {
398
398
  if (this.rateLimitTracker) {
399
399
  this.rateLimitTracker.updateFromHeaders(response.headers);
400
400
  }
401
+ if (requestOptions?.responseType === "arraybuffer") {
402
+ if (!response.ok) {
403
+ let errData = {};
404
+ try {
405
+ errData = await response.json();
406
+ } catch {
407
+ }
408
+ this.handleErrorResponse(response.status, errData, requestId);
409
+ }
410
+ this.circuitBreaker?.onSuccess();
411
+ const buffer = await response.arrayBuffer();
412
+ return buffer;
413
+ }
401
414
  let data;
402
415
  try {
403
416
  data = await response.json();
@@ -1739,7 +1752,7 @@ var ComplianceClient = class {
1739
1752
  }, requestOptions),
1740
1753
  this.riskClient.getProfile(request.customerId, requestOptions).catch(() => null)
1741
1754
  ]);
1742
- const loginBlockReasons = this.getBlockReasons(geoVerification, profileResult || {}, cipherTextResult);
1755
+ const loginBlockReasons = this.getBlockReasons(geoVerification, profileResult, cipherTextResult);
1743
1756
  const isBlocked = !geoVerification.is_compliant || geoVerification.is_blocked || !!cipherTextResult?.risk?.is_blocked || cipherTextResult?.valid === false || geoVerification.gps_required && !cipherTextResult;
1744
1757
  if (isBlocked && !profileResult) {
1745
1758
  return {
@@ -1858,6 +1871,9 @@ var ComplianceClient = class {
1858
1871
  cipherTextValidation: cipherTextResult
1859
1872
  };
1860
1873
  }
1874
+ if (!profileResult) {
1875
+ throw new ComplianceError("Customer profile not found", request.customerId);
1876
+ }
1861
1877
  const profile = profileResult;
1862
1878
  const transactionRisk = this.calculateTransactionRisk(
1863
1879
  request.amount,
@@ -2070,11 +2086,13 @@ var ComplianceClient = class {
2070
2086
  if (geoVerification.is_blocked) {
2071
2087
  reasons.push(...geoVerification.risk_reasons);
2072
2088
  }
2073
- if (profile.customer_status === "suspended") {
2074
- reasons.push("account_suspended");
2075
- }
2076
- if (profile.has_sanctions) {
2077
- reasons.push("sanctions_match");
2089
+ if (profile) {
2090
+ if (profile.customer_status === "suspended") {
2091
+ reasons.push("account_suspended");
2092
+ }
2093
+ if (profile.has_sanctions) {
2094
+ reasons.push("sanctions_match");
2095
+ }
2078
2096
  }
2079
2097
  if (cipherTextResult) {
2080
2098
  if (!cipherTextResult.valid) {