vesant-sdk 1.7.2-next.ec7157c → 1.8.0-dev.00f6233
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.
- package/README.md +7 -3
- package/dist/{client-B3DCAHlg.d.ts → client-BPALLldd.d.ts} +2 -2
- package/dist/{client-fy3trF2K.d.ts → client-BaUekQT8.d.ts} +32 -10
- package/dist/{client-BwXMQA2a.d.mts → client-XDEhh9VN.d.mts} +32 -10
- package/dist/{client-D23KhWeh.d.mts → client-_OhkfnyJ.d.mts} +2 -2
- package/dist/compliance/index.d.mts +3 -3
- package/dist/compliance/index.d.ts +3 -3
- package/dist/compliance/index.js +66 -11
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +66 -11
- package/dist/compliance/index.mjs.map +1 -1
- package/dist/decisions/index.js +8 -7
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisions/index.mjs +8 -7
- package/dist/decisions/index.mjs.map +1 -1
- package/dist/geolocation/index.d.mts +2 -2
- package/dist/geolocation/index.d.ts +2 -2
- package/dist/geolocation/index.js +47 -8
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +47 -8
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/{index-DSDgS09k.d.ts → index-BosFSGan.d.ts} +57 -2
- package/dist/{index-C3zUKydT.d.mts → index-C49a7fg2.d.mts} +57 -2
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +174 -194
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +170 -195
- package/dist/index.mjs.map +1 -1
- package/dist/kyc/core.d.mts +2 -2
- package/dist/kyc/core.d.ts +2 -2
- package/dist/kyc/core.js +109 -190
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +107 -191
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +533 -263
- package/dist/kyc/index.d.ts +533 -263
- package/dist/kyc/index.js +109 -190
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +107 -191
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +125 -145
- package/dist/react.d.ts +125 -145
- package/dist/react.js +266 -222
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +264 -220
- package/dist/react.mjs.map +1 -1
- package/dist/risk-profile/index.d.mts +16 -6
- package/dist/risk-profile/index.d.ts +16 -6
- package/dist/risk-profile/index.js +26 -9
- package/dist/risk-profile/index.js.map +1 -1
- package/dist/risk-profile/index.mjs +26 -10
- package/dist/risk-profile/index.mjs.map +1 -1
- package/dist/scores/index.js +8 -7
- package/dist/scores/index.js.map +1 -1
- package/dist/scores/index.mjs +8 -7
- package/dist/scores/index.mjs.map +1 -1
- package/dist/tax/index.d.mts +1 -1
- package/dist/tax/index.d.ts +1 -1
- package/dist/tax/index.js +8 -7
- package/dist/tax/index.js.map +1 -1
- package/dist/tax/index.mjs +8 -7
- package/dist/tax/index.mjs.map +1 -1
- package/dist/{types-BOFaMQxI.d.mts → types-DbvVph_0.d.mts} +45 -2
- package/dist/{types-UGyDl1fd.d.ts → types-qXamJr2q.d.ts} +45 -2
- package/dist/webhooks/index.d.mts +1 -1
- package/dist/webhooks/index.d.ts +1 -1
- package/dist/webhooks/index.js +6 -0
- package/dist/webhooks/index.js.map +1 -1
- package/dist/webhooks/index.mjs +6 -1
- package/dist/webhooks/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -352,9 +352,13 @@ interface ComplianceClientConfig {
|
|
|
352
352
|
| `requestKycSubmitLink(request)` | Generate a KYC submission link |
|
|
353
353
|
| `checkKycStatus(request)` | Check KYC verification status |
|
|
354
354
|
| `submitVerification(request)` | Submit document verification |
|
|
355
|
-
| `
|
|
356
|
-
| `
|
|
357
|
-
| `listAlerts(filters)` | List KYC alerts |
|
|
355
|
+
| `getKycRequest(id)` | Get a KYC record with proof download links |
|
|
356
|
+
| `getProofDownloadURLs(id)` | Download links for a record's proofs |
|
|
357
|
+
| `listAlerts(filters)` | List KYC alerts (console session only) |
|
|
358
|
+
| `createEventBasedFaceVerificationSession(request)` | Start a face re-verification session (backend) |
|
|
359
|
+
| `submitEventBasedFaceVerificationSession(request)` | Submit a face capture for a session |
|
|
360
|
+
| `getEventBasedFaceVerificationSessionStatus(token)` | Look up a session's current result |
|
|
361
|
+
| `retryEventBasedFaceVerificationJourney(token)` | Mint the next hosted journey after a decline |
|
|
358
362
|
|
|
359
363
|
## Documentation
|
|
360
364
|
|
|
@@ -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-
|
|
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-
|
|
4
|
+
import { C as CustomerProfile } from './types-qXamJr2q.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
|
*
|
|
@@ -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-
|
|
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-
|
|
4
|
+
import { C as CustomerProfile } from './types-DbvVph_0.mjs';
|
|
5
5
|
import { E as EntityType, B as BlockReason, P as PaginationParams } from './types-CBQRNL-l.mjs';
|
|
6
6
|
|
|
7
7
|
interface RegistrationVerificationRequest {
|
|
@@ -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-
|
|
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-
|
|
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-_OhkfnyJ.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-
|
|
6
|
+
import '../types-DbvVph_0.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-
|
|
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-
|
|
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-BPALLldd.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-
|
|
6
|
+
import '../types-qXamJr2q.js';
|
|
7
7
|
|
|
8
8
|
declare const sdkReasons: {
|
|
9
9
|
jurisdictionBlocked: (country: string, countryISO: string) => BlockReason;
|
package/dist/compliance/index.js
CHANGED
|
@@ -312,7 +312,7 @@ function createConsoleLogger() {
|
|
|
312
312
|
}
|
|
313
313
|
|
|
314
314
|
// src/core/version.ts
|
|
315
|
-
var SDK_VERSION = "1.
|
|
315
|
+
var SDK_VERSION = "1.8.0";
|
|
316
316
|
|
|
317
317
|
// src/shared/browser-utils.ts
|
|
318
318
|
function generateUUID() {
|
|
@@ -647,19 +647,20 @@ var BaseClient = class {
|
|
|
647
647
|
* Handle error responses from API
|
|
648
648
|
*/
|
|
649
649
|
handleErrorResponse(status, data, requestId) {
|
|
650
|
-
const
|
|
650
|
+
const structured = data.error && typeof data.error === "object" && !Array.isArray(data.error) ? data.error : void 0;
|
|
651
|
+
const message = typeof data.error === "string" && data.error || typeof structured?.message === "string" && structured.message || typeof data.message === "string" && data.message || `HTTP ${status}`;
|
|
651
652
|
const createError = () => {
|
|
652
653
|
switch (status) {
|
|
653
654
|
case 400:
|
|
654
|
-
return new VesantError(message, "BAD_REQUEST", 400);
|
|
655
|
+
return new VesantError(message, "BAD_REQUEST", 400, structured);
|
|
655
656
|
case 401:
|
|
656
657
|
return new AuthenticationError(message);
|
|
657
658
|
case 403:
|
|
658
|
-
return new VesantError(message, "FORBIDDEN", 403);
|
|
659
|
+
return new VesantError(message, "FORBIDDEN", 403, structured);
|
|
659
660
|
case 404:
|
|
660
|
-
return new VesantError(message, "NOT_FOUND", 404);
|
|
661
|
+
return new VesantError(message, "NOT_FOUND", 404, structured);
|
|
661
662
|
case 409:
|
|
662
|
-
return new VesantError(message, "DUPLICATE_PROFILE", 409);
|
|
663
|
+
return new VesantError(message, "DUPLICATE_PROFILE", 409, structured);
|
|
663
664
|
case 429: {
|
|
664
665
|
const retryAfter = data.retry_after || data.retryAfter;
|
|
665
666
|
return new RateLimitError(retryAfter);
|
|
@@ -670,7 +671,7 @@ var BaseClient = class {
|
|
|
670
671
|
case 504:
|
|
671
672
|
return new ServiceUnavailableError(message);
|
|
672
673
|
default:
|
|
673
|
-
return new VesantError(message, "UNKNOWN_ERROR", status);
|
|
674
|
+
return new VesantError(message, "UNKNOWN_ERROR", status, structured);
|
|
674
675
|
}
|
|
675
676
|
};
|
|
676
677
|
const error = createError();
|
|
@@ -969,6 +970,7 @@ async function generateCipherText(options, config) {
|
|
|
969
970
|
}
|
|
970
971
|
|
|
971
972
|
// src/geolocation/client.ts
|
|
973
|
+
var DEFAULT_GPS_CONFIG_TTL_MS = 5 * 60 * 1e3;
|
|
972
974
|
var GeolocationClient = class extends BaseClient {
|
|
973
975
|
constructor(config) {
|
|
974
976
|
const baseConfig = {
|
|
@@ -984,6 +986,8 @@ var GeolocationClient = class extends BaseClient {
|
|
|
984
986
|
environment: config.environment
|
|
985
987
|
};
|
|
986
988
|
super(baseConfig);
|
|
989
|
+
this.gpsConfigCache = null;
|
|
990
|
+
this.gpsConfigTtlMs = config.gpsConfigTtlMs ?? DEFAULT_GPS_CONFIG_TTL_MS;
|
|
987
991
|
}
|
|
988
992
|
// ============================================================================
|
|
989
993
|
// IP Verification & Compliance
|
|
@@ -1069,7 +1073,42 @@ var GeolocationClient = class extends BaseClient {
|
|
|
1069
1073
|
* ```
|
|
1070
1074
|
*/
|
|
1071
1075
|
async getGPSConfig(requestOptions) {
|
|
1072
|
-
|
|
1076
|
+
const cached = this.gpsConfigCache;
|
|
1077
|
+
if (cached && cached.expiresAt > Date.now()) {
|
|
1078
|
+
return cached.value;
|
|
1079
|
+
}
|
|
1080
|
+
return this.refreshGPSConfig(requestOptions);
|
|
1081
|
+
}
|
|
1082
|
+
/**
|
|
1083
|
+
* Re-read the tenant's GPS requirement configuration, ignoring any copy held
|
|
1084
|
+
* from an earlier read.
|
|
1085
|
+
*
|
|
1086
|
+
* These requirements are edited in the compliance console while your
|
|
1087
|
+
* application is running. `getGPSConfig` reuses a fetched copy for a short
|
|
1088
|
+
* period so a long-lived session does not call the API on every event; call
|
|
1089
|
+
* this when you need a change to take effect immediately — for example right
|
|
1090
|
+
* after an administrator saves new settings.
|
|
1091
|
+
*
|
|
1092
|
+
* @returns The current GPS requirement config per event type
|
|
1093
|
+
*
|
|
1094
|
+
* @example
|
|
1095
|
+
* ```typescript
|
|
1096
|
+
* const config = await client.refreshGPSConfig();
|
|
1097
|
+
* if (config.require_gps.login) {
|
|
1098
|
+
* // GPS is now required for login
|
|
1099
|
+
* }
|
|
1100
|
+
* ```
|
|
1101
|
+
*/
|
|
1102
|
+
async refreshGPSConfig(requestOptions) {
|
|
1103
|
+
const value = await this.requestWithRetry(
|
|
1104
|
+
"/api/v1/geo/config",
|
|
1105
|
+
void 0,
|
|
1106
|
+
void 0,
|
|
1107
|
+
void 0,
|
|
1108
|
+
requestOptions
|
|
1109
|
+
);
|
|
1110
|
+
this.gpsConfigCache = { value, expiresAt: Date.now() + this.gpsConfigTtlMs };
|
|
1111
|
+
return value;
|
|
1073
1112
|
}
|
|
1074
1113
|
/**
|
|
1075
1114
|
* Mint a short-lived, single-use device-signals nonce.
|
|
@@ -1486,17 +1525,27 @@ var RiskProfileClient = class extends BaseClient {
|
|
|
1486
1525
|
/**
|
|
1487
1526
|
* Update customer profile
|
|
1488
1527
|
*
|
|
1528
|
+
* Omitted fields keep their stored values. When the tenant has the
|
|
1529
|
+
* **On Account Sensitive Action** KYC trigger enabled and the update changes
|
|
1530
|
+
* the customer's name, date of birth or residential address, Vesant applies
|
|
1531
|
+
* the other fields, holds the sensitive ones and answers `202` with a
|
|
1532
|
+
* {@link ProfileUpdateHeldResponse} instead of the profile. Narrow with
|
|
1533
|
+
* {@link isProfileUpdateHeld}, then request a `profile_change` submit link.
|
|
1534
|
+
*
|
|
1489
1535
|
* @param profileId - Profile UUID
|
|
1490
1536
|
* @param updates - Fields to update
|
|
1491
|
-
* @returns Updated customer profile
|
|
1537
|
+
* @returns Updated customer profile, or the held change
|
|
1492
1538
|
*
|
|
1493
1539
|
* @example
|
|
1494
1540
|
* ```typescript
|
|
1495
|
-
* const
|
|
1541
|
+
* const result = await client.updateProfile(profileId, {
|
|
1496
1542
|
* location: 'New York, USA',
|
|
1497
1543
|
* location_compliance: 'compliant',
|
|
1498
1544
|
* last_recorded_activity: new Date().toISOString()
|
|
1499
1545
|
* });
|
|
1546
|
+
* if (isProfileUpdateHeld(result)) {
|
|
1547
|
+
* // name / DOB / address held: start KYC with trigger_event 'profile_change'
|
|
1548
|
+
* }
|
|
1500
1549
|
* ```
|
|
1501
1550
|
*/
|
|
1502
1551
|
async updateProfile(profileId, updates, requestOptions) {
|
|
@@ -1536,6 +1585,11 @@ var RiskProfileClient = class extends BaseClient {
|
|
|
1536
1585
|
}
|
|
1537
1586
|
};
|
|
1538
1587
|
|
|
1588
|
+
// src/risk-profile/types.ts
|
|
1589
|
+
function isProfileUpdateHeld(result) {
|
|
1590
|
+
return typeof result === "object" && result !== null && result.status === "kyc_required" && result.kyc_required === true;
|
|
1591
|
+
}
|
|
1592
|
+
|
|
1539
1593
|
// src/compliance/types.ts
|
|
1540
1594
|
var DEFAULT_CURRENCY_RATES = {
|
|
1541
1595
|
USD: 1,
|
|
@@ -1991,11 +2045,12 @@ var ComplianceClient = class {
|
|
|
1991
2045
|
if (profileResult) {
|
|
1992
2046
|
profile = profileResult;
|
|
1993
2047
|
if (!isBlocked && this.shouldUpdateProfile(profile, geoVerification.location.city)) {
|
|
1994
|
-
|
|
2048
|
+
const updated = await this.riskClient.updateProfile(profile.id, {
|
|
1995
2049
|
last_recorded_activity: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1996
2050
|
location: `${geoVerification.location.city}, ${geoVerification.location.country}`,
|
|
1997
2051
|
location_compliance: geoVerification.is_compliant ? "compliant" : "non-compliant"
|
|
1998
2052
|
}, requestOptions);
|
|
2053
|
+
profile = isProfileUpdateHeld(updated) ? updated.profile : updated;
|
|
1999
2054
|
}
|
|
2000
2055
|
} else {
|
|
2001
2056
|
if (this.config.autoCreateProfiles && this.config.debug) {
|