vesant-sdk 1.7.2 → 1.8.0-dev.153299b

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 (69) hide show
  1. package/dist/{client-B3DCAHlg.d.ts → client-4oLoc31v.d.ts} +2 -2
  2. package/dist/{client-fy3trF2K.d.ts → client-BaUekQT8.d.ts} +32 -10
  3. package/dist/{client-D23KhWeh.d.mts → client-CJI8VO1i.d.mts} +2 -2
  4. package/dist/{client-BwXMQA2a.d.mts → client-XDEhh9VN.d.mts} +32 -10
  5. package/dist/compliance/index.d.mts +3 -3
  6. package/dist/compliance/index.d.ts +3 -3
  7. package/dist/compliance/index.js +59 -5
  8. package/dist/compliance/index.js.map +1 -1
  9. package/dist/compliance/index.mjs +59 -5
  10. package/dist/compliance/index.mjs.map +1 -1
  11. package/dist/decisions/index.js +1 -1
  12. package/dist/decisions/index.js.map +1 -1
  13. package/dist/decisions/index.mjs +1 -1
  14. package/dist/decisions/index.mjs.map +1 -1
  15. package/dist/geolocation/index.d.mts +2 -2
  16. package/dist/geolocation/index.d.ts +2 -2
  17. package/dist/geolocation/index.js +40 -2
  18. package/dist/geolocation/index.js.map +1 -1
  19. package/dist/geolocation/index.mjs +40 -2
  20. package/dist/geolocation/index.mjs.map +1 -1
  21. package/dist/{index-DSDgS09k.d.ts → index-BosFSGan.d.ts} +57 -2
  22. package/dist/{index-C3zUKydT.d.mts → index-C49a7fg2.d.mts} +57 -2
  23. package/dist/index.d.mts +6 -6
  24. package/dist/index.d.ts +6 -6
  25. package/dist/index.js +70 -5
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +68 -6
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/kyc/core.d.mts +2 -2
  30. package/dist/kyc/core.d.ts +2 -2
  31. package/dist/kyc/core.js +5 -1
  32. package/dist/kyc/core.js.map +1 -1
  33. package/dist/kyc/core.mjs +5 -2
  34. package/dist/kyc/core.mjs.map +1 -1
  35. package/dist/kyc/index.d.mts +103 -4
  36. package/dist/kyc/index.d.ts +103 -4
  37. package/dist/kyc/index.js +5 -1
  38. package/dist/kyc/index.js.map +1 -1
  39. package/dist/kyc/index.mjs +5 -2
  40. package/dist/kyc/index.mjs.map +1 -1
  41. package/dist/react.d.mts +17 -4
  42. package/dist/react.d.ts +17 -4
  43. package/dist/react.js +23 -11
  44. package/dist/react.js.map +1 -1
  45. package/dist/react.mjs +23 -11
  46. package/dist/react.mjs.map +1 -1
  47. package/dist/risk-profile/index.d.mts +16 -6
  48. package/dist/risk-profile/index.d.ts +16 -6
  49. package/dist/risk-profile/index.js +19 -3
  50. package/dist/risk-profile/index.js.map +1 -1
  51. package/dist/risk-profile/index.mjs +19 -4
  52. package/dist/risk-profile/index.mjs.map +1 -1
  53. package/dist/scores/index.js +1 -1
  54. package/dist/scores/index.js.map +1 -1
  55. package/dist/scores/index.mjs +1 -1
  56. package/dist/scores/index.mjs.map +1 -1
  57. package/dist/tax/index.js +1 -1
  58. package/dist/tax/index.js.map +1 -1
  59. package/dist/tax/index.mjs +1 -1
  60. package/dist/tax/index.mjs.map +1 -1
  61. package/dist/{types-UGyDl1fd.d.ts → types-1kI4SsKB.d.ts} +44 -1
  62. package/dist/{types-BOFaMQxI.d.mts → types-DfbnIaW_.d.mts} +44 -1
  63. package/dist/webhooks/index.d.mts +1 -1
  64. package/dist/webhooks/index.d.ts +1 -1
  65. package/dist/webhooks/index.js +6 -0
  66. package/dist/webhooks/index.js.map +1 -1
  67. package/dist/webhooks/index.mjs +6 -1
  68. package/dist/webhooks/index.mjs.map +1 -1
  69. package/package.json +1 -1
@@ -1,7 +1,7 @@
1
- import { D as DeviceFingerprintRequest, L as LocationVerification, V as ValidateCipherTextResponse, a as LocationRequest, G as GeolocationClient, b as LocationRequestFilters, c as LocationRequestListResponse } from './client-fy3trF2K.js';
1
+ import { D as DeviceFingerprintRequest, L as LocationVerification, V as ValidateCipherTextResponse, a as LocationRequest, G as GeolocationClient, b as LocationRequestFilters, c as LocationRequestListResponse } from './client-BaUekQT8.js';
2
2
  import { RiskProfileClient } from './risk-profile/index.js';
3
3
  import { V as VesantConfig, R as RequestOptions } from './client-q9fN8Hhf.js';
4
- import { C as CustomerProfile } from './types-UGyDl1fd.js';
4
+ import { C as CustomerProfile } from './types-1kI4SsKB.js';
5
5
  import { E as EntityType, B as BlockReason, P as PaginationParams } from './types-CBQRNL-l.js';
6
6
 
7
7
  interface RegistrationVerificationRequest {
@@ -534,6 +534,15 @@ interface GeolocationClientConfig {
534
534
  logger?: Logger;
535
535
  /** Environment mode - 'sandbox' uses isolated sandbox data */
536
536
  environment?: 'production' | 'sandbox';
537
+ /**
538
+ * How long a fetched GPS requirement config is reused before it is read again,
539
+ * in milliseconds (default: 300000, i.e. 5 minutes).
540
+ *
541
+ * These requirements are edited in the compliance console while your
542
+ * application is running, so a lower value makes changes take effect sooner at
543
+ * the cost of more requests. Use `refreshGPSConfig()` to re-read immediately.
544
+ */
545
+ gpsConfigTtlMs?: number;
537
546
  }
538
547
  interface UseGeolocationOptions {
539
548
  /** Auto-detect and verify user's IP on mount */
@@ -786,17 +795,9 @@ interface UseLocationCaptureResult {
786
795
  * Extends BaseClient for consistent retry logic, timeout handling, and error management.
787
796
  */
788
797
 
789
- /**
790
- * GeolocationClient extends BaseClient for:
791
- * - Consistent retry logic with exponential backoff
792
- * - Unified error handling (VesantError, NetworkError, TimeoutError, etc.)
793
- * - Automatic timeout management
794
- * - Debug logging
795
- *
796
- * All geolocation verification calls use requestWithRetry() to handle
797
- * transient failures gracefully.
798
- */
799
798
  declare class GeolocationClient extends BaseClient {
799
+ private readonly gpsConfigTtlMs;
800
+ private gpsConfigCache;
800
801
  constructor(config: GeolocationClientConfig);
801
802
  /**
802
803
  * Verify an IP address and check compliance
@@ -857,6 +858,27 @@ declare class GeolocationClient extends BaseClient {
857
858
  * ```
858
859
  */
859
860
  getGPSConfig(requestOptions?: RequestOptions): Promise<GeolocationConfigResponse>;
861
+ /**
862
+ * Re-read the tenant's GPS requirement configuration, ignoring any copy held
863
+ * from an earlier read.
864
+ *
865
+ * These requirements are edited in the compliance console while your
866
+ * application is running. `getGPSConfig` reuses a fetched copy for a short
867
+ * period so a long-lived session does not call the API on every event; call
868
+ * this when you need a change to take effect immediately — for example right
869
+ * after an administrator saves new settings.
870
+ *
871
+ * @returns The current GPS requirement config per event type
872
+ *
873
+ * @example
874
+ * ```typescript
875
+ * const config = await client.refreshGPSConfig();
876
+ * if (config.require_gps.login) {
877
+ * // GPS is now required for login
878
+ * }
879
+ * ```
880
+ */
881
+ refreshGPSConfig(requestOptions?: RequestOptions): Promise<GeolocationConfigResponse>;
860
882
  /**
861
883
  * Mint a short-lived, single-use device-signals nonce.
862
884
  *
@@ -1,7 +1,7 @@
1
- import { D as DeviceFingerprintRequest, L as LocationVerification, V as ValidateCipherTextResponse, a as LocationRequest, G as GeolocationClient, b as LocationRequestFilters, c as LocationRequestListResponse } from './client-BwXMQA2a.mjs';
1
+ import { D as DeviceFingerprintRequest, L as LocationVerification, V as ValidateCipherTextResponse, a as LocationRequest, G as GeolocationClient, b as LocationRequestFilters, c as LocationRequestListResponse } from './client-XDEhh9VN.mjs';
2
2
  import { RiskProfileClient } from './risk-profile/index.mjs';
3
3
  import { V as VesantConfig, R as RequestOptions } from './client-q9fN8Hhf.mjs';
4
- import { C as CustomerProfile } from './types-BOFaMQxI.mjs';
4
+ import { C as CustomerProfile } from './types-DfbnIaW_.mjs';
5
5
  import { E as EntityType, B as BlockReason, P as PaginationParams } from './types-CBQRNL-l.mjs';
6
6
 
7
7
  interface RegistrationVerificationRequest {
@@ -534,6 +534,15 @@ interface GeolocationClientConfig {
534
534
  logger?: Logger;
535
535
  /** Environment mode - 'sandbox' uses isolated sandbox data */
536
536
  environment?: 'production' | 'sandbox';
537
+ /**
538
+ * How long a fetched GPS requirement config is reused before it is read again,
539
+ * in milliseconds (default: 300000, i.e. 5 minutes).
540
+ *
541
+ * These requirements are edited in the compliance console while your
542
+ * application is running, so a lower value makes changes take effect sooner at
543
+ * the cost of more requests. Use `refreshGPSConfig()` to re-read immediately.
544
+ */
545
+ gpsConfigTtlMs?: number;
537
546
  }
538
547
  interface UseGeolocationOptions {
539
548
  /** Auto-detect and verify user's IP on mount */
@@ -786,17 +795,9 @@ interface UseLocationCaptureResult {
786
795
  * Extends BaseClient for consistent retry logic, timeout handling, and error management.
787
796
  */
788
797
 
789
- /**
790
- * GeolocationClient extends BaseClient for:
791
- * - Consistent retry logic with exponential backoff
792
- * - Unified error handling (VesantError, NetworkError, TimeoutError, etc.)
793
- * - Automatic timeout management
794
- * - Debug logging
795
- *
796
- * All geolocation verification calls use requestWithRetry() to handle
797
- * transient failures gracefully.
798
- */
799
798
  declare class GeolocationClient extends BaseClient {
799
+ private readonly gpsConfigTtlMs;
800
+ private gpsConfigCache;
800
801
  constructor(config: GeolocationClientConfig);
801
802
  /**
802
803
  * Verify an IP address and check compliance
@@ -857,6 +858,27 @@ declare class GeolocationClient extends BaseClient {
857
858
  * ```
858
859
  */
859
860
  getGPSConfig(requestOptions?: RequestOptions): Promise<GeolocationConfigResponse>;
861
+ /**
862
+ * Re-read the tenant's GPS requirement configuration, ignoring any copy held
863
+ * from an earlier read.
864
+ *
865
+ * These requirements are edited in the compliance console while your
866
+ * application is running. `getGPSConfig` reuses a fetched copy for a short
867
+ * period so a long-lived session does not call the API on every event; call
868
+ * this when you need a change to take effect immediately — for example right
869
+ * after an administrator saves new settings.
870
+ *
871
+ * @returns The current GPS requirement config per event type
872
+ *
873
+ * @example
874
+ * ```typescript
875
+ * const config = await client.refreshGPSConfig();
876
+ * if (config.require_gps.login) {
877
+ * // GPS is now required for login
878
+ * }
879
+ * ```
880
+ */
881
+ refreshGPSConfig(requestOptions?: RequestOptions): Promise<GeolocationConfigResponse>;
860
882
  /**
861
883
  * Mint a short-lived, single-use device-signals nonce.
862
884
  *
@@ -1,9 +1,9 @@
1
1
  import { B as BlockReason } from '../types-CBQRNL-l.mjs';
2
- export { C as ComplianceClient, a as ComplianceLocationRequestInput, b as ComplianceLocationRequestResult, c as CurrencyRates, D as DEFAULT_CURRENCY_RATES, E as EventVerificationRequest, d as EventVerificationResponse, L as LoginVerificationRequest, e as LoginVerificationResponse, R as RegistrationVerificationRequest, f as RegistrationVerificationResponse, T as TransactionRiskResult, g as TransactionVerificationRequest, h as TransactionVerificationResponse } from '../client-D23KhWeh.mjs';
3
- export { p as CreateLocationRequestRequest, I as LocationCaptureRequest, K as LocationCaptureResponse, a as LocationRequest, M as LocationRequestChannel, b as LocationRequestFilters, c as LocationRequestListResponse, N as LocationRequestResult, O as LocationRequestStatus, P as LocationShareInfo, R as ResendLocationRequestRequest } from '../client-BwXMQA2a.mjs';
2
+ export { C as ComplianceClient, a as ComplianceLocationRequestInput, b as ComplianceLocationRequestResult, c as CurrencyRates, D as DEFAULT_CURRENCY_RATES, E as EventVerificationRequest, d as EventVerificationResponse, L as LoginVerificationRequest, e as LoginVerificationResponse, R as RegistrationVerificationRequest, f as RegistrationVerificationResponse, T as TransactionRiskResult, g as TransactionVerificationRequest, h as TransactionVerificationResponse } from '../client-CJI8VO1i.mjs';
3
+ export { p as CreateLocationRequestRequest, I as LocationCaptureRequest, K as LocationCaptureResponse, a as LocationRequest, M as LocationRequestChannel, b as LocationRequestFilters, c as LocationRequestListResponse, N as LocationRequestResult, O as LocationRequestStatus, P as LocationShareInfo, R as ResendLocationRequestRequest } from '../client-XDEhh9VN.mjs';
4
4
  import '../risk-profile/index.mjs';
5
5
  import '../client-q9fN8Hhf.mjs';
6
- import '../types-BOFaMQxI.mjs';
6
+ import '../types-DfbnIaW_.mjs';
7
7
 
8
8
  declare const sdkReasons: {
9
9
  jurisdictionBlocked: (country: string, countryISO: string) => BlockReason;
@@ -1,9 +1,9 @@
1
1
  import { B as BlockReason } from '../types-CBQRNL-l.js';
2
- export { C as ComplianceClient, a as ComplianceLocationRequestInput, b as ComplianceLocationRequestResult, c as CurrencyRates, D as DEFAULT_CURRENCY_RATES, E as EventVerificationRequest, d as EventVerificationResponse, L as LoginVerificationRequest, e as LoginVerificationResponse, R as RegistrationVerificationRequest, f as RegistrationVerificationResponse, T as TransactionRiskResult, g as TransactionVerificationRequest, h as TransactionVerificationResponse } from '../client-B3DCAHlg.js';
3
- export { p as CreateLocationRequestRequest, I as LocationCaptureRequest, K as LocationCaptureResponse, a as LocationRequest, M as LocationRequestChannel, b as LocationRequestFilters, c as LocationRequestListResponse, N as LocationRequestResult, O as LocationRequestStatus, P as LocationShareInfo, R as ResendLocationRequestRequest } from '../client-fy3trF2K.js';
2
+ export { C as ComplianceClient, a as ComplianceLocationRequestInput, b as ComplianceLocationRequestResult, c as CurrencyRates, D as DEFAULT_CURRENCY_RATES, E as EventVerificationRequest, d as EventVerificationResponse, L as LoginVerificationRequest, e as LoginVerificationResponse, R as RegistrationVerificationRequest, f as RegistrationVerificationResponse, T as TransactionRiskResult, g as TransactionVerificationRequest, h as TransactionVerificationResponse } from '../client-4oLoc31v.js';
3
+ export { p as CreateLocationRequestRequest, I as LocationCaptureRequest, K as LocationCaptureResponse, a as LocationRequest, M as LocationRequestChannel, b as LocationRequestFilters, c as LocationRequestListResponse, N as LocationRequestResult, O as LocationRequestStatus, P as LocationShareInfo, R as ResendLocationRequestRequest } from '../client-BaUekQT8.js';
4
4
  import '../risk-profile/index.js';
5
5
  import '../client-q9fN8Hhf.js';
6
- import '../types-UGyDl1fd.js';
6
+ import '../types-1kI4SsKB.js';
7
7
 
8
8
  declare const sdkReasons: {
9
9
  jurisdictionBlocked: (country: string, countryISO: string) => BlockReason;
@@ -312,7 +312,7 @@ function createConsoleLogger() {
312
312
  }
313
313
 
314
314
  // src/core/version.ts
315
- var SDK_VERSION = "1.7.2";
315
+ var SDK_VERSION = "1.8.0";
316
316
 
317
317
  // src/shared/browser-utils.ts
318
318
  function generateUUID() {
@@ -969,6 +969,7 @@ async function generateCipherText(options, config) {
969
969
  }
970
970
 
971
971
  // src/geolocation/client.ts
972
+ var DEFAULT_GPS_CONFIG_TTL_MS = 5 * 60 * 1e3;
972
973
  var GeolocationClient = class extends BaseClient {
973
974
  constructor(config) {
974
975
  const baseConfig = {
@@ -984,6 +985,8 @@ var GeolocationClient = class extends BaseClient {
984
985
  environment: config.environment
985
986
  };
986
987
  super(baseConfig);
988
+ this.gpsConfigCache = null;
989
+ this.gpsConfigTtlMs = config.gpsConfigTtlMs ?? DEFAULT_GPS_CONFIG_TTL_MS;
987
990
  }
988
991
  // ============================================================================
989
992
  // IP Verification & Compliance
@@ -1069,7 +1072,42 @@ var GeolocationClient = class extends BaseClient {
1069
1072
  * ```
1070
1073
  */
1071
1074
  async getGPSConfig(requestOptions) {
1072
- return this.requestWithRetry("/api/v1/geo/config", void 0, void 0, void 0, requestOptions);
1075
+ const cached = this.gpsConfigCache;
1076
+ if (cached && cached.expiresAt > Date.now()) {
1077
+ return cached.value;
1078
+ }
1079
+ return this.refreshGPSConfig(requestOptions);
1080
+ }
1081
+ /**
1082
+ * Re-read the tenant's GPS requirement configuration, ignoring any copy held
1083
+ * from an earlier read.
1084
+ *
1085
+ * These requirements are edited in the compliance console while your
1086
+ * application is running. `getGPSConfig` reuses a fetched copy for a short
1087
+ * period so a long-lived session does not call the API on every event; call
1088
+ * this when you need a change to take effect immediately — for example right
1089
+ * after an administrator saves new settings.
1090
+ *
1091
+ * @returns The current GPS requirement config per event type
1092
+ *
1093
+ * @example
1094
+ * ```typescript
1095
+ * const config = await client.refreshGPSConfig();
1096
+ * if (config.require_gps.login) {
1097
+ * // GPS is now required for login
1098
+ * }
1099
+ * ```
1100
+ */
1101
+ async refreshGPSConfig(requestOptions) {
1102
+ const value = await this.requestWithRetry(
1103
+ "/api/v1/geo/config",
1104
+ void 0,
1105
+ void 0,
1106
+ void 0,
1107
+ requestOptions
1108
+ );
1109
+ this.gpsConfigCache = { value, expiresAt: Date.now() + this.gpsConfigTtlMs };
1110
+ return value;
1073
1111
  }
1074
1112
  /**
1075
1113
  * Mint a short-lived, single-use device-signals nonce.
@@ -1486,17 +1524,27 @@ var RiskProfileClient = class extends BaseClient {
1486
1524
  /**
1487
1525
  * Update customer profile
1488
1526
  *
1527
+ * Omitted fields keep their stored values. When the tenant has the
1528
+ * **On Account Sensitive Action** KYC trigger enabled and the update changes
1529
+ * the customer's name, date of birth or residential address, Vesant applies
1530
+ * the other fields, holds the sensitive ones and answers `202` with a
1531
+ * {@link ProfileUpdateHeldResponse} instead of the profile. Narrow with
1532
+ * {@link isProfileUpdateHeld}, then request a `profile_change` submit link.
1533
+ *
1489
1534
  * @param profileId - Profile UUID
1490
1535
  * @param updates - Fields to update
1491
- * @returns Updated customer profile
1536
+ * @returns Updated customer profile, or the held change
1492
1537
  *
1493
1538
  * @example
1494
1539
  * ```typescript
1495
- * const updated = await client.updateProfile(profileId, {
1540
+ * const result = await client.updateProfile(profileId, {
1496
1541
  * location: 'New York, USA',
1497
1542
  * location_compliance: 'compliant',
1498
1543
  * last_recorded_activity: new Date().toISOString()
1499
1544
  * });
1545
+ * if (isProfileUpdateHeld(result)) {
1546
+ * // name / DOB / address held: start KYC with trigger_event 'profile_change'
1547
+ * }
1500
1548
  * ```
1501
1549
  */
1502
1550
  async updateProfile(profileId, updates, requestOptions) {
@@ -1536,6 +1584,11 @@ var RiskProfileClient = class extends BaseClient {
1536
1584
  }
1537
1585
  };
1538
1586
 
1587
+ // src/risk-profile/types.ts
1588
+ function isProfileUpdateHeld(result) {
1589
+ return typeof result === "object" && result !== null && result.status === "kyc_required" && result.kyc_required === true;
1590
+ }
1591
+
1539
1592
  // src/compliance/types.ts
1540
1593
  var DEFAULT_CURRENCY_RATES = {
1541
1594
  USD: 1,
@@ -1991,11 +2044,12 @@ var ComplianceClient = class {
1991
2044
  if (profileResult) {
1992
2045
  profile = profileResult;
1993
2046
  if (!isBlocked && this.shouldUpdateProfile(profile, geoVerification.location.city)) {
1994
- profile = await this.riskClient.updateProfile(profile.id, {
2047
+ const updated = await this.riskClient.updateProfile(profile.id, {
1995
2048
  last_recorded_activity: (/* @__PURE__ */ new Date()).toISOString(),
1996
2049
  location: `${geoVerification.location.city}, ${geoVerification.location.country}`,
1997
2050
  location_compliance: geoVerification.is_compliant ? "compliant" : "non-compliant"
1998
2051
  }, requestOptions);
2052
+ profile = isProfileUpdateHeld(updated) ? updated.profile : updated;
1999
2053
  }
2000
2054
  } else {
2001
2055
  if (this.config.autoCreateProfiles && this.config.debug) {