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
|
@@ -222,7 +222,7 @@ function createConsoleLogger() {
|
|
|
222
222
|
}
|
|
223
223
|
|
|
224
224
|
// src/core/version.ts
|
|
225
|
-
var SDK_VERSION = "1.
|
|
225
|
+
var SDK_VERSION = "1.4.0";
|
|
226
226
|
|
|
227
227
|
// src/shared/browser-utils.ts
|
|
228
228
|
function generateUUID() {
|
|
@@ -316,6 +316,12 @@ var BaseClient = class {
|
|
|
316
316
|
interceptors: this.interceptors,
|
|
317
317
|
logger: this.logger
|
|
318
318
|
};
|
|
319
|
+
if (this.config.environment === "sandbox" && this.config.apiKey?.startsWith("pk_live_")) {
|
|
320
|
+
this.logger.warn("Production API key used with sandbox environment. Use your sandbox API key (sk_sandbox_) instead.");
|
|
321
|
+
}
|
|
322
|
+
if (this.config.environment !== "sandbox" && this.config.apiKey?.startsWith("sk_sandbox_")) {
|
|
323
|
+
this.logger.warn("Sandbox API key used with production environment. Use your production API key (pk_live_) instead.");
|
|
324
|
+
}
|
|
319
325
|
if (config.circuitBreaker) {
|
|
320
326
|
this.circuitBreaker = new CircuitBreaker(config.circuitBreaker);
|
|
321
327
|
}
|
|
@@ -339,8 +345,9 @@ var BaseClient = class {
|
|
|
339
345
|
error.requestId = requestId;
|
|
340
346
|
throw error;
|
|
341
347
|
}
|
|
342
|
-
const
|
|
343
|
-
const
|
|
348
|
+
const DEFAULT_SANDBOX_URL = "https://sandbox-api.vesant.ai";
|
|
349
|
+
const resolvedBaseURL = this.config.environment === "sandbox" ? this.config.sandboxBaseURL || DEFAULT_SANDBOX_URL : serviceURL || this.config.baseURL;
|
|
350
|
+
const url = `${serviceURL || resolvedBaseURL}${endpoint}`;
|
|
344
351
|
const headers = {
|
|
345
352
|
"Content-Type": "application/json",
|
|
346
353
|
"X-Tenant-ID": this.config.tenantId,
|
|
@@ -708,9 +715,13 @@ function encodePayload(payload) {
|
|
|
708
715
|
async function generateCipherText(options, config) {
|
|
709
716
|
const warnings = [];
|
|
710
717
|
let requestLocation = options.requestLocation ?? false;
|
|
718
|
+
let gpsRequiredByConfig = false;
|
|
711
719
|
if (config?.require_gps) {
|
|
712
720
|
const reason = options.reason;
|
|
713
721
|
if (reason === "login" && config.require_gps.login || reason === "registration" && config.require_gps.registration || reason === "transaction" && config.require_gps.transaction) {
|
|
722
|
+
if (!requestLocation) {
|
|
723
|
+
gpsRequiredByConfig = true;
|
|
724
|
+
}
|
|
714
725
|
requestLocation = true;
|
|
715
726
|
}
|
|
716
727
|
}
|
|
@@ -723,6 +734,10 @@ async function generateCipherText(options, config) {
|
|
|
723
734
|
);
|
|
724
735
|
if (location) {
|
|
725
736
|
locationData = location;
|
|
737
|
+
} else if (gpsRequiredByConfig) {
|
|
738
|
+
throw new Error(
|
|
739
|
+
`GPS location is required for ${options.reason} by tenant configuration, but GPS was not available or permission was denied`
|
|
740
|
+
);
|
|
726
741
|
} else {
|
|
727
742
|
warnings.push("GPS location not available or permission denied");
|
|
728
743
|
}
|
|
@@ -1149,13 +1164,17 @@ var GeolocationClient = class extends BaseClient {
|
|
|
1149
1164
|
*/
|
|
1150
1165
|
async generateCipherText(options, gpsConfig) {
|
|
1151
1166
|
let signingKey = this.cachedSigningKey;
|
|
1167
|
+
let resolvedGpsConfig = gpsConfig;
|
|
1152
1168
|
if (!signingKey) {
|
|
1153
1169
|
const config = await this.getGPSConfig();
|
|
1154
1170
|
signingKey = config.signing_key;
|
|
1171
|
+
if (!resolvedGpsConfig) {
|
|
1172
|
+
resolvedGpsConfig = config;
|
|
1173
|
+
}
|
|
1155
1174
|
}
|
|
1156
1175
|
return generateCipherText(
|
|
1157
1176
|
{ ...options, signingKey: signingKey || void 0 },
|
|
1158
|
-
|
|
1177
|
+
resolvedGpsConfig
|
|
1159
1178
|
);
|
|
1160
1179
|
}
|
|
1161
1180
|
// ============================================================================
|