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