vesant-sdk 1.4.3 → 1.4.5
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 +25 -23
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +25 -23
- package/dist/compliance/index.mjs.map +1 -1
- package/dist/decisions/index.js +13 -2
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisions/index.mjs +13 -2
- package/dist/decisions/index.mjs.map +1 -1
- package/dist/geolocation/index.js +13 -2
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +13 -2
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +25 -23
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +25 -23
- package/dist/index.mjs.map +1 -1
- package/dist/kyc/core.js +13 -2
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +13 -2
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.js +13 -2
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +13 -2
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.js +1 -1
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +1 -1
- package/dist/react.mjs.map +1 -1
- package/dist/risk-profile/index.d.mts +0 -4
- package/dist/risk-profile/index.d.ts +0 -4
- package/dist/risk-profile/index.js +25 -23
- package/dist/risk-profile/index.js.map +1 -1
- package/dist/risk-profile/index.mjs +25 -23
- package/dist/risk-profile/index.mjs.map +1 -1
- package/dist/scores/index.js +13 -2
- package/dist/scores/index.js.map +1 -1
- package/dist/scores/index.mjs +13 -2
- package/dist/scores/index.mjs.map +1 -1
- package/package.json +1 -1
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.4.
|
|
242
|
+
var SDK_VERSION = "1.4.5";
|
|
243
243
|
|
|
244
244
|
// src/shared/browser-utils.ts
|
|
245
245
|
function generateUUID() {
|
|
@@ -323,9 +323,20 @@ var BaseClient = class {
|
|
|
323
323
|
}
|
|
324
324
|
this.interceptors = config.interceptors || [];
|
|
325
325
|
this.logger = config.logger || createConsoleLogger();
|
|
326
|
+
let environment = config.environment;
|
|
327
|
+
const apiKey = config.apiKey || "";
|
|
328
|
+
if (apiKey.startsWith("pk_test_")) {
|
|
329
|
+
if (environment === "production") {
|
|
330
|
+
this.logger.warn('Sandbox API key (pk_test_*) used with environment: "production" \u2014 overriding to "sandbox"');
|
|
331
|
+
}
|
|
332
|
+
environment = "sandbox";
|
|
333
|
+
} else if (apiKey.startsWith("pk_live_") && environment === "sandbox") {
|
|
334
|
+
this.logger.warn('Production API key (pk_live_*) used with environment: "sandbox" \u2014 the X-Sandbox header will be sent for backward compatibility');
|
|
335
|
+
}
|
|
326
336
|
this.config = {
|
|
327
337
|
...config,
|
|
328
|
-
apiKey
|
|
338
|
+
apiKey,
|
|
339
|
+
environment,
|
|
329
340
|
headers: config.headers || {},
|
|
330
341
|
timeout: config.timeout || 1e4,
|
|
331
342
|
retries: config.retries || 3,
|
|
@@ -1332,16 +1343,19 @@ var RiskProfileClient = class extends BaseClient {
|
|
|
1332
1343
|
* ```
|
|
1333
1344
|
*/
|
|
1334
1345
|
async getProfile(customerId, requestOptions) {
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
|
|
1341
|
-
|
|
1342
|
-
|
|
1346
|
+
try {
|
|
1347
|
+
return await this.request(
|
|
1348
|
+
`/api/v1/profiles?customer_id=${encodeURIComponent(customerId)}`,
|
|
1349
|
+
void 0,
|
|
1350
|
+
void 0,
|
|
1351
|
+
requestOptions
|
|
1352
|
+
);
|
|
1353
|
+
} catch (error) {
|
|
1354
|
+
if (error instanceof CGSError && (error.statusCode === 404 || error.code === "NOT_FOUND")) {
|
|
1355
|
+
throw new CGSError(`Profile not found for customer ID: ${customerId}`, "NOT_FOUND", 404);
|
|
1356
|
+
}
|
|
1357
|
+
throw error;
|
|
1343
1358
|
}
|
|
1344
|
-
return profile;
|
|
1345
1359
|
}
|
|
1346
1360
|
/**
|
|
1347
1361
|
* Update customer profile
|
|
@@ -1394,18 +1408,6 @@ var RiskProfileClient = class extends BaseClient {
|
|
|
1394
1408
|
throw error;
|
|
1395
1409
|
}
|
|
1396
1410
|
}
|
|
1397
|
-
/**
|
|
1398
|
-
* Query profiles with filters (internal helper for getProfile)
|
|
1399
|
-
*/
|
|
1400
|
-
async queryProfiles(filters = {}, requestOptions) {
|
|
1401
|
-
const queryString = this.buildQueryString(filters);
|
|
1402
|
-
return this.request(
|
|
1403
|
-
`/api/v1/risk-dashboard/profiles${queryString}`,
|
|
1404
|
-
void 0,
|
|
1405
|
-
void 0,
|
|
1406
|
-
requestOptions
|
|
1407
|
-
);
|
|
1408
|
-
}
|
|
1409
1411
|
};
|
|
1410
1412
|
|
|
1411
1413
|
// src/compliance/types.ts
|