vesant-sdk 1.3.0 → 1.4.0
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/compliance/index.js +23 -4
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +23 -4
- package/dist/compliance/index.mjs.map +1 -1
- package/dist/decisions/index.js +10 -3
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisions/index.mjs +10 -3
- package/dist/decisions/index.mjs.map +1 -1
- package/dist/geolocation/index.js +23 -4
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +23 -4
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +58 -4
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +58 -4
- package/dist/index.mjs.map +1 -1
- package/dist/kyc/core.d.mts +1 -1
- package/dist/kyc/core.d.ts +1 -1
- package/dist/kyc/core.js +45 -3
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +45 -3
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +43 -1
- package/dist/kyc/index.d.ts +43 -1
- package/dist/kyc/index.js +45 -3
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +45 -3
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +5 -2
- package/dist/react.d.ts +5 -2
- package/dist/react.js +441 -102
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +342 -8
- package/dist/react.mjs.map +1 -1
- package/dist/risk-profile/index.js +10 -3
- package/dist/risk-profile/index.js.map +1 -1
- package/dist/risk-profile/index.mjs +10 -3
- package/dist/risk-profile/index.mjs.map +1 -1
- package/dist/scores/index.js +10 -3
- package/dist/scores/index.js.map +1 -1
- package/dist/scores/index.mjs +10 -3
- package/dist/scores/index.mjs.map +1 -1
- package/package.json +10 -2
package/dist/index.mjs
CHANGED
|
@@ -239,7 +239,7 @@ var noopLogger = {
|
|
|
239
239
|
};
|
|
240
240
|
|
|
241
241
|
// src/core/version.ts
|
|
242
|
-
var SDK_VERSION = "1.
|
|
242
|
+
var SDK_VERSION = "1.4.0";
|
|
243
243
|
|
|
244
244
|
// src/shared/browser-utils.ts
|
|
245
245
|
function generateUUID() {
|
|
@@ -333,6 +333,12 @@ var BaseClient = class {
|
|
|
333
333
|
interceptors: this.interceptors,
|
|
334
334
|
logger: this.logger
|
|
335
335
|
};
|
|
336
|
+
if (this.config.environment === "sandbox" && this.config.apiKey?.startsWith("pk_live_")) {
|
|
337
|
+
this.logger.warn("Production API key used with sandbox environment. Use your sandbox API key (sk_sandbox_) instead.");
|
|
338
|
+
}
|
|
339
|
+
if (this.config.environment !== "sandbox" && this.config.apiKey?.startsWith("sk_sandbox_")) {
|
|
340
|
+
this.logger.warn("Sandbox API key used with production environment. Use your production API key (pk_live_) instead.");
|
|
341
|
+
}
|
|
336
342
|
if (config.circuitBreaker) {
|
|
337
343
|
this.circuitBreaker = new CircuitBreaker(config.circuitBreaker);
|
|
338
344
|
}
|
|
@@ -356,8 +362,9 @@ var BaseClient = class {
|
|
|
356
362
|
error.requestId = requestId;
|
|
357
363
|
throw error;
|
|
358
364
|
}
|
|
359
|
-
const
|
|
360
|
-
const
|
|
365
|
+
const DEFAULT_SANDBOX_URL = "https://sandbox-api.vesant.ai";
|
|
366
|
+
const resolvedBaseURL = this.config.environment === "sandbox" ? this.config.sandboxBaseURL || DEFAULT_SANDBOX_URL : serviceURL || this.config.baseURL;
|
|
367
|
+
const url = `${serviceURL || resolvedBaseURL}${endpoint}`;
|
|
361
368
|
const headers = {
|
|
362
369
|
"Content-Type": "application/json",
|
|
363
370
|
"X-Tenant-ID": this.config.tenantId,
|
|
@@ -767,9 +774,13 @@ function encodePayload(payload) {
|
|
|
767
774
|
async function generateCipherText(options, config) {
|
|
768
775
|
const warnings = [];
|
|
769
776
|
let requestLocation = options.requestLocation ?? false;
|
|
777
|
+
let gpsRequiredByConfig = false;
|
|
770
778
|
if (config?.require_gps) {
|
|
771
779
|
const reason = options.reason;
|
|
772
780
|
if (reason === "login" && config.require_gps.login || reason === "registration" && config.require_gps.registration || reason === "transaction" && config.require_gps.transaction) {
|
|
781
|
+
if (!requestLocation) {
|
|
782
|
+
gpsRequiredByConfig = true;
|
|
783
|
+
}
|
|
773
784
|
requestLocation = true;
|
|
774
785
|
}
|
|
775
786
|
}
|
|
@@ -782,6 +793,10 @@ async function generateCipherText(options, config) {
|
|
|
782
793
|
);
|
|
783
794
|
if (location) {
|
|
784
795
|
locationData = location;
|
|
796
|
+
} else if (gpsRequiredByConfig) {
|
|
797
|
+
throw new Error(
|
|
798
|
+
`GPS location is required for ${options.reason} by tenant configuration, but GPS was not available or permission was denied`
|
|
799
|
+
);
|
|
785
800
|
} else {
|
|
786
801
|
warnings.push("GPS location not available or permission denied");
|
|
787
802
|
}
|
|
@@ -1233,13 +1248,17 @@ var GeolocationClient = class extends BaseClient {
|
|
|
1233
1248
|
*/
|
|
1234
1249
|
async generateCipherText(options, gpsConfig) {
|
|
1235
1250
|
let signingKey = this.cachedSigningKey;
|
|
1251
|
+
let resolvedGpsConfig = gpsConfig;
|
|
1236
1252
|
if (!signingKey) {
|
|
1237
1253
|
const config = await this.getGPSConfig();
|
|
1238
1254
|
signingKey = config.signing_key;
|
|
1255
|
+
if (!resolvedGpsConfig) {
|
|
1256
|
+
resolvedGpsConfig = config;
|
|
1257
|
+
}
|
|
1239
1258
|
}
|
|
1240
1259
|
return generateCipherText(
|
|
1241
1260
|
{ ...options, signingKey: signingKey || void 0 },
|
|
1242
|
-
|
|
1261
|
+
resolvedGpsConfig
|
|
1243
1262
|
);
|
|
1244
1263
|
}
|
|
1245
1264
|
// ============================================================================
|
|
@@ -2293,6 +2312,41 @@ var KycClient = class extends BaseClient {
|
|
|
2293
2312
|
headers: this.getUserHeaders()
|
|
2294
2313
|
});
|
|
2295
2314
|
}
|
|
2315
|
+
/**
|
|
2316
|
+
* Create a reuse KYC session for validate a user with existing KYC verification
|
|
2317
|
+
*
|
|
2318
|
+
* @param request - Request containing the reference, customer_id, optional redirect URL, and callback URL (receives POST requests)
|
|
2319
|
+
*/
|
|
2320
|
+
async createReuseKycSession(request) {
|
|
2321
|
+
return this.requestWithRetry("/api/v1/kyc/face/session", {
|
|
2322
|
+
method: "POST",
|
|
2323
|
+
body: JSON.stringify(request),
|
|
2324
|
+
headers: this.getUserHeaders()
|
|
2325
|
+
});
|
|
2326
|
+
}
|
|
2327
|
+
/**
|
|
2328
|
+
* Submit a reuse KYC session for validate a user with existing KYC verification
|
|
2329
|
+
*
|
|
2330
|
+
* @param request - Request containing the reference, token and proof (receives POST requests)
|
|
2331
|
+
*/
|
|
2332
|
+
async submitReuseKycSession(request) {
|
|
2333
|
+
return this.requestWithRetry("/api/v1/kyc/face/submit", {
|
|
2334
|
+
method: "POST",
|
|
2335
|
+
body: JSON.stringify(request),
|
|
2336
|
+
headers: this.getUserHeaders()
|
|
2337
|
+
});
|
|
2338
|
+
}
|
|
2339
|
+
/**
|
|
2340
|
+
* Check reuse KYC session status for a reference
|
|
2341
|
+
* @param reference - The unique reference used for the reuse KYC session (e.g., customer ID or transaction ID)
|
|
2342
|
+
* @returns Response with kyc_status and message (reason)
|
|
2343
|
+
* **/
|
|
2344
|
+
async getReuseKycSessionStatus(reference) {
|
|
2345
|
+
return this.requestWithRetry(`/api/v1/kyc/face/verify/${encodeURIComponent(reference)}`, {
|
|
2346
|
+
method: "GET",
|
|
2347
|
+
headers: this.getUserHeaders()
|
|
2348
|
+
});
|
|
2349
|
+
}
|
|
2296
2350
|
/**
|
|
2297
2351
|
* Check KYC status for a user
|
|
2298
2352
|
*
|