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.
- package/dist/{client-B3DCAHlg.d.ts → client-4oLoc31v.d.ts} +2 -2
- package/dist/{client-fy3trF2K.d.ts → client-BaUekQT8.d.ts} +32 -10
- package/dist/{client-D23KhWeh.d.mts → client-CJI8VO1i.d.mts} +2 -2
- package/dist/{client-BwXMQA2a.d.mts → client-XDEhh9VN.d.mts} +32 -10
- package/dist/compliance/index.d.mts +3 -3
- package/dist/compliance/index.d.ts +3 -3
- package/dist/compliance/index.js +59 -5
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +59 -5
- package/dist/compliance/index.mjs.map +1 -1
- package/dist/decisions/index.js +1 -1
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisions/index.mjs +1 -1
- 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 +40 -2
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +40 -2
- 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 +70 -5
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +68 -6
- 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 +5 -1
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +5 -2
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +103 -4
- package/dist/kyc/index.d.ts +103 -4
- package/dist/kyc/index.js +5 -1
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +5 -2
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +17 -4
- package/dist/react.d.ts +17 -4
- package/dist/react.js +23 -11
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +23 -11
- 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 +19 -3
- package/dist/risk-profile/index.js.map +1 -1
- package/dist/risk-profile/index.mjs +19 -4
- package/dist/risk-profile/index.mjs.map +1 -1
- package/dist/scores/index.js +1 -1
- package/dist/scores/index.js.map +1 -1
- package/dist/scores/index.mjs +1 -1
- package/dist/scores/index.mjs.map +1 -1
- package/dist/tax/index.js +1 -1
- package/dist/tax/index.js.map +1 -1
- package/dist/tax/index.mjs +1 -1
- package/dist/tax/index.mjs.map +1 -1
- package/dist/{types-UGyDl1fd.d.ts → types-1kI4SsKB.d.ts} +44 -1
- package/dist/{types-BOFaMQxI.d.mts → types-DfbnIaW_.d.mts} +44 -1
- 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
|
@@ -310,7 +310,7 @@ function createConsoleLogger() {
|
|
|
310
310
|
}
|
|
311
311
|
|
|
312
312
|
// src/core/version.ts
|
|
313
|
-
var SDK_VERSION = "1.
|
|
313
|
+
var SDK_VERSION = "1.8.0";
|
|
314
314
|
|
|
315
315
|
// src/shared/browser-utils.ts
|
|
316
316
|
function generateUUID() {
|
|
@@ -967,6 +967,7 @@ async function generateCipherText(options, config) {
|
|
|
967
967
|
}
|
|
968
968
|
|
|
969
969
|
// src/geolocation/client.ts
|
|
970
|
+
var DEFAULT_GPS_CONFIG_TTL_MS = 5 * 60 * 1e3;
|
|
970
971
|
var GeolocationClient = class extends BaseClient {
|
|
971
972
|
constructor(config) {
|
|
972
973
|
const baseConfig = {
|
|
@@ -982,6 +983,8 @@ var GeolocationClient = class extends BaseClient {
|
|
|
982
983
|
environment: config.environment
|
|
983
984
|
};
|
|
984
985
|
super(baseConfig);
|
|
986
|
+
this.gpsConfigCache = null;
|
|
987
|
+
this.gpsConfigTtlMs = config.gpsConfigTtlMs ?? DEFAULT_GPS_CONFIG_TTL_MS;
|
|
985
988
|
}
|
|
986
989
|
// ============================================================================
|
|
987
990
|
// IP Verification & Compliance
|
|
@@ -1067,7 +1070,42 @@ var GeolocationClient = class extends BaseClient {
|
|
|
1067
1070
|
* ```
|
|
1068
1071
|
*/
|
|
1069
1072
|
async getGPSConfig(requestOptions) {
|
|
1070
|
-
|
|
1073
|
+
const cached = this.gpsConfigCache;
|
|
1074
|
+
if (cached && cached.expiresAt > Date.now()) {
|
|
1075
|
+
return cached.value;
|
|
1076
|
+
}
|
|
1077
|
+
return this.refreshGPSConfig(requestOptions);
|
|
1078
|
+
}
|
|
1079
|
+
/**
|
|
1080
|
+
* Re-read the tenant's GPS requirement configuration, ignoring any copy held
|
|
1081
|
+
* from an earlier read.
|
|
1082
|
+
*
|
|
1083
|
+
* These requirements are edited in the compliance console while your
|
|
1084
|
+
* application is running. `getGPSConfig` reuses a fetched copy for a short
|
|
1085
|
+
* period so a long-lived session does not call the API on every event; call
|
|
1086
|
+
* this when you need a change to take effect immediately — for example right
|
|
1087
|
+
* after an administrator saves new settings.
|
|
1088
|
+
*
|
|
1089
|
+
* @returns The current GPS requirement config per event type
|
|
1090
|
+
*
|
|
1091
|
+
* @example
|
|
1092
|
+
* ```typescript
|
|
1093
|
+
* const config = await client.refreshGPSConfig();
|
|
1094
|
+
* if (config.require_gps.login) {
|
|
1095
|
+
* // GPS is now required for login
|
|
1096
|
+
* }
|
|
1097
|
+
* ```
|
|
1098
|
+
*/
|
|
1099
|
+
async refreshGPSConfig(requestOptions) {
|
|
1100
|
+
const value = await this.requestWithRetry(
|
|
1101
|
+
"/api/v1/geo/config",
|
|
1102
|
+
void 0,
|
|
1103
|
+
void 0,
|
|
1104
|
+
void 0,
|
|
1105
|
+
requestOptions
|
|
1106
|
+
);
|
|
1107
|
+
this.gpsConfigCache = { value, expiresAt: Date.now() + this.gpsConfigTtlMs };
|
|
1108
|
+
return value;
|
|
1071
1109
|
}
|
|
1072
1110
|
/**
|
|
1073
1111
|
* Mint a short-lived, single-use device-signals nonce.
|
|
@@ -1484,17 +1522,27 @@ var RiskProfileClient = class extends BaseClient {
|
|
|
1484
1522
|
/**
|
|
1485
1523
|
* Update customer profile
|
|
1486
1524
|
*
|
|
1525
|
+
* Omitted fields keep their stored values. When the tenant has the
|
|
1526
|
+
* **On Account Sensitive Action** KYC trigger enabled and the update changes
|
|
1527
|
+
* the customer's name, date of birth or residential address, Vesant applies
|
|
1528
|
+
* the other fields, holds the sensitive ones and answers `202` with a
|
|
1529
|
+
* {@link ProfileUpdateHeldResponse} instead of the profile. Narrow with
|
|
1530
|
+
* {@link isProfileUpdateHeld}, then request a `profile_change` submit link.
|
|
1531
|
+
*
|
|
1487
1532
|
* @param profileId - Profile UUID
|
|
1488
1533
|
* @param updates - Fields to update
|
|
1489
|
-
* @returns Updated customer profile
|
|
1534
|
+
* @returns Updated customer profile, or the held change
|
|
1490
1535
|
*
|
|
1491
1536
|
* @example
|
|
1492
1537
|
* ```typescript
|
|
1493
|
-
* const
|
|
1538
|
+
* const result = await client.updateProfile(profileId, {
|
|
1494
1539
|
* location: 'New York, USA',
|
|
1495
1540
|
* location_compliance: 'compliant',
|
|
1496
1541
|
* last_recorded_activity: new Date().toISOString()
|
|
1497
1542
|
* });
|
|
1543
|
+
* if (isProfileUpdateHeld(result)) {
|
|
1544
|
+
* // name / DOB / address held: start KYC with trigger_event 'profile_change'
|
|
1545
|
+
* }
|
|
1498
1546
|
* ```
|
|
1499
1547
|
*/
|
|
1500
1548
|
async updateProfile(profileId, updates, requestOptions) {
|
|
@@ -1534,6 +1582,11 @@ var RiskProfileClient = class extends BaseClient {
|
|
|
1534
1582
|
}
|
|
1535
1583
|
};
|
|
1536
1584
|
|
|
1585
|
+
// src/risk-profile/types.ts
|
|
1586
|
+
function isProfileUpdateHeld(result) {
|
|
1587
|
+
return typeof result === "object" && result !== null && result.status === "kyc_required" && result.kyc_required === true;
|
|
1588
|
+
}
|
|
1589
|
+
|
|
1537
1590
|
// src/compliance/types.ts
|
|
1538
1591
|
var DEFAULT_CURRENCY_RATES = {
|
|
1539
1592
|
USD: 1,
|
|
@@ -1989,11 +2042,12 @@ var ComplianceClient = class {
|
|
|
1989
2042
|
if (profileResult) {
|
|
1990
2043
|
profile = profileResult;
|
|
1991
2044
|
if (!isBlocked && this.shouldUpdateProfile(profile, geoVerification.location.city)) {
|
|
1992
|
-
|
|
2045
|
+
const updated = await this.riskClient.updateProfile(profile.id, {
|
|
1993
2046
|
last_recorded_activity: (/* @__PURE__ */ new Date()).toISOString(),
|
|
1994
2047
|
location: `${geoVerification.location.city}, ${geoVerification.location.country}`,
|
|
1995
2048
|
location_compliance: geoVerification.is_compliant ? "compliant" : "non-compliant"
|
|
1996
2049
|
}, requestOptions);
|
|
2050
|
+
profile = isProfileUpdateHeld(updated) ? updated.profile : updated;
|
|
1997
2051
|
}
|
|
1998
2052
|
} else {
|
|
1999
2053
|
if (this.config.autoCreateProfiles && this.config.debug) {
|