vesant-sdk 1.7.0-dev.7d59b3e → 1.7.0-dev.8afce7f
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-DoMSYMMR.d.ts → client-0NOPDnT0.d.ts} +29 -26
- package/dist/{client-DMIRx7Tu.d.mts → client-CvWNRwwg.d.mts} +29 -26
- package/dist/{client-ZNdnpWe7.d.mts → client-Dps40EtF.d.mts} +2 -2
- package/dist/{client-C3DCmGe9.d.ts → client-SMxqod4j.d.ts} +2 -2
- package/dist/{client-BolQlL5e.d.mts → client-q9fN8Hhf.d.mts} +103 -1
- package/dist/{client-BolQlL5e.d.ts → client-q9fN8Hhf.d.ts} +103 -1
- package/dist/compliance/index.d.mts +3 -3
- package/dist/compliance/index.d.ts +3 -3
- package/dist/compliance/index.js +126 -21
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +126 -21
- package/dist/compliance/index.mjs.map +1 -1
- package/dist/decisions/index.d.mts +1 -1
- package/dist/decisions/index.d.ts +1 -1
- package/dist/decisions/index.js +61 -6
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisions/index.mjs +61 -6
- package/dist/decisions/index.mjs.map +1 -1
- package/dist/geolocation/index.d.mts +59 -4
- package/dist/geolocation/index.d.ts +59 -4
- package/dist/geolocation/index.js +129 -18
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +127 -19
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index.d.mts +7 -7
- package/dist/index.d.ts +7 -7
- package/dist/index.js +209 -36
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +205 -37
- 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 +87 -18
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +87 -18
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +110 -13
- package/dist/kyc/index.d.ts +110 -13
- package/dist/kyc/index.js +87 -18
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +87 -18
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +9 -3
- package/dist/react.d.ts +9 -3
- package/dist/react.js +180 -77
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +180 -77
- package/dist/react.mjs.map +1 -1
- package/dist/risk-profile/index.d.mts +1 -1
- package/dist/risk-profile/index.d.ts +1 -1
- package/dist/risk-profile/index.js +61 -6
- package/dist/risk-profile/index.js.map +1 -1
- package/dist/risk-profile/index.mjs +61 -6
- package/dist/risk-profile/index.mjs.map +1 -1
- package/dist/scores/index.d.mts +1 -1
- package/dist/scores/index.d.ts +1 -1
- package/dist/scores/index.js +61 -6
- package/dist/scores/index.js.map +1 -1
- package/dist/scores/index.mjs +61 -6
- package/dist/scores/index.mjs.map +1 -1
- package/dist/tax/index.d.mts +20 -3
- package/dist/tax/index.d.ts +20 -3
- package/dist/tax/index.js +70 -9
- package/dist/tax/index.js.map +1 -1
- package/dist/tax/index.mjs +70 -9
- package/dist/tax/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.js
CHANGED
|
@@ -1,5 +1,61 @@
|
|
|
1
1
|
'use strict';
|
|
2
2
|
|
|
3
|
+
// src/core/auth.ts
|
|
4
|
+
var StaticApiKeyProvider = class {
|
|
5
|
+
constructor(apiKey) {
|
|
6
|
+
this.apiKey = apiKey;
|
|
7
|
+
}
|
|
8
|
+
async getCredential() {
|
|
9
|
+
return this.apiKey ? { scheme: "Bearer", token: this.apiKey } : null;
|
|
10
|
+
}
|
|
11
|
+
canRefresh() {
|
|
12
|
+
return false;
|
|
13
|
+
}
|
|
14
|
+
};
|
|
15
|
+
var RefreshingTokenProvider = class {
|
|
16
|
+
constructor(opts) {
|
|
17
|
+
this.opts = opts;
|
|
18
|
+
this.cached = null;
|
|
19
|
+
this.inFlight = null;
|
|
20
|
+
this.skewMs = opts.skewMs ?? 3e4;
|
|
21
|
+
this.scheme = opts.scheme ?? "Bearer";
|
|
22
|
+
this.now = opts.now ?? (() => Date.now());
|
|
23
|
+
}
|
|
24
|
+
canRefresh() {
|
|
25
|
+
return true;
|
|
26
|
+
}
|
|
27
|
+
async getCredential(ctx) {
|
|
28
|
+
const forceRefresh = ctx?.forceRefresh ?? false;
|
|
29
|
+
if (!forceRefresh && this.cached && !this.isExpiring(this.cached)) {
|
|
30
|
+
return { scheme: this.scheme, token: this.cached.token };
|
|
31
|
+
}
|
|
32
|
+
const fresh = await this.refresh();
|
|
33
|
+
return { scheme: this.scheme, token: fresh.token };
|
|
34
|
+
}
|
|
35
|
+
isExpiring(token) {
|
|
36
|
+
if (token.expiresAt === void 0) {
|
|
37
|
+
return false;
|
|
38
|
+
}
|
|
39
|
+
return this.now() >= token.expiresAt - this.skewMs;
|
|
40
|
+
}
|
|
41
|
+
refresh() {
|
|
42
|
+
if (this.inFlight) {
|
|
43
|
+
return this.inFlight;
|
|
44
|
+
}
|
|
45
|
+
this.inFlight = (async () => {
|
|
46
|
+
try {
|
|
47
|
+
const fresh = await this.opts.fetchToken();
|
|
48
|
+
this.cached = fresh;
|
|
49
|
+
this.opts.onRotate?.({ expiresAt: fresh.expiresAt });
|
|
50
|
+
return fresh;
|
|
51
|
+
} finally {
|
|
52
|
+
this.inFlight = null;
|
|
53
|
+
}
|
|
54
|
+
})();
|
|
55
|
+
return this.inFlight;
|
|
56
|
+
}
|
|
57
|
+
};
|
|
58
|
+
|
|
3
59
|
// src/core/errors.ts
|
|
4
60
|
var VesantError = class _VesantError extends Error {
|
|
5
61
|
constructor(message, code, statusCode, details) {
|
|
@@ -347,6 +403,7 @@ var BaseClient = class {
|
|
|
347
403
|
interceptors: this.interceptors,
|
|
348
404
|
logger: this.logger
|
|
349
405
|
};
|
|
406
|
+
this.authProvider = config.authProvider ?? (apiKey ? new StaticApiKeyProvider(apiKey) : void 0);
|
|
350
407
|
if (config.circuitBreaker) {
|
|
351
408
|
this.circuitBreaker = new CircuitBreaker(config.circuitBreaker);
|
|
352
409
|
}
|
|
@@ -354,6 +411,19 @@ var BaseClient = class {
|
|
|
354
411
|
this.rateLimitTracker = new RateLimitTracker();
|
|
355
412
|
}
|
|
356
413
|
}
|
|
414
|
+
/**
|
|
415
|
+
* Resolve the Idempotency-Key for a request. Mutating methods (POST/PUT/PATCH)
|
|
416
|
+
* get the caller-supplied key or a freshly minted UUID; non-mutating methods get
|
|
417
|
+
* none. requestWithRetry resolves this once and injects it so every retry reuses
|
|
418
|
+
* one key (letting the server dedup replays); a direct request() resolves per call.
|
|
419
|
+
*/
|
|
420
|
+
resolveIdempotencyKey(method, requestOptions) {
|
|
421
|
+
const isMutating = ["POST", "PUT", "PATCH"].includes((method || "GET").toUpperCase());
|
|
422
|
+
if (!isMutating) {
|
|
423
|
+
return void 0;
|
|
424
|
+
}
|
|
425
|
+
return requestOptions?.idempotencyKey ?? generateUUID();
|
|
426
|
+
}
|
|
357
427
|
/**
|
|
358
428
|
* Make an HTTP request with timeout and error handling
|
|
359
429
|
*/
|
|
@@ -379,15 +449,20 @@ var BaseClient = class {
|
|
|
379
449
|
...this.config.headers,
|
|
380
450
|
...options.headers || {}
|
|
381
451
|
};
|
|
382
|
-
|
|
383
|
-
|
|
452
|
+
const credential = await this.authProvider?.getCredential({
|
|
453
|
+
tenantId: this.config.tenantId,
|
|
454
|
+
requestId
|
|
455
|
+
});
|
|
456
|
+
if (credential) {
|
|
457
|
+
headers["Authorization"] = `${credential.scheme ?? "Bearer"} ${credential.token}`;
|
|
384
458
|
}
|
|
385
459
|
if (this.config.environment === "sandbox") {
|
|
386
460
|
headers["X-Sandbox"] = "true";
|
|
387
461
|
}
|
|
388
462
|
const method = (options.method || "GET").toUpperCase();
|
|
389
|
-
|
|
390
|
-
|
|
463
|
+
const idempotencyKey = this.resolveIdempotencyKey(method, requestOptions);
|
|
464
|
+
if (idempotencyKey) {
|
|
465
|
+
headers["Idempotency-Key"] = idempotencyKey;
|
|
391
466
|
}
|
|
392
467
|
const controller = new AbortController();
|
|
393
468
|
const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
|
|
@@ -408,10 +483,28 @@ var BaseClient = class {
|
|
|
408
483
|
if (this.config.debug) {
|
|
409
484
|
this.logger.debug(`${finalOptions.method || "GET"} ${endpoint}`);
|
|
410
485
|
}
|
|
411
|
-
|
|
486
|
+
let response = await fetch(url, {
|
|
412
487
|
...finalOptions,
|
|
413
488
|
signal: controller.signal
|
|
414
489
|
});
|
|
490
|
+
if (response.status === 401 && this.authProvider?.canRefresh?.()) {
|
|
491
|
+
const refreshed = await this.authProvider.getCredential({
|
|
492
|
+
tenantId: this.config.tenantId,
|
|
493
|
+
requestId,
|
|
494
|
+
forceRefresh: true
|
|
495
|
+
});
|
|
496
|
+
if (refreshed) {
|
|
497
|
+
this.config.onCredentialRotated?.({ reason: "unauthorized" });
|
|
498
|
+
finalOptions = {
|
|
499
|
+
...finalOptions,
|
|
500
|
+
headers: {
|
|
501
|
+
...finalOptions.headers,
|
|
502
|
+
Authorization: `${refreshed.scheme ?? "Bearer"} ${refreshed.token}`
|
|
503
|
+
}
|
|
504
|
+
};
|
|
505
|
+
response = await fetch(url, { ...finalOptions, signal: controller.signal });
|
|
506
|
+
}
|
|
507
|
+
}
|
|
415
508
|
clearTimeout(timeoutId);
|
|
416
509
|
if (this.rateLimitTracker) {
|
|
417
510
|
this.rateLimitTracker.updateFromHeaders(response.headers);
|
|
@@ -500,9 +593,11 @@ var BaseClient = class {
|
|
|
500
593
|
*/
|
|
501
594
|
async requestWithRetry(endpoint, options = {}, serviceURL, retries = this.config.retries, requestOptions) {
|
|
502
595
|
let lastError;
|
|
596
|
+
const idempotencyKey = this.resolveIdempotencyKey(options.method || "GET", requestOptions);
|
|
597
|
+
const attemptOptions = idempotencyKey ? { ...requestOptions, idempotencyKey } : requestOptions;
|
|
503
598
|
for (let attempt = 0; attempt <= retries; attempt++) {
|
|
504
599
|
try {
|
|
505
|
-
return await this.request(endpoint, options, serviceURL,
|
|
600
|
+
return await this.request(endpoint, options, serviceURL, attemptOptions);
|
|
506
601
|
} catch (error) {
|
|
507
602
|
lastError = error instanceof Error ? error : new Error("Unknown error");
|
|
508
603
|
if (requestOptions?.signal?.aborted) {
|
|
@@ -599,6 +694,9 @@ var BaseClient = class {
|
|
|
599
694
|
if (config.interceptors) {
|
|
600
695
|
this.interceptors = config.interceptors;
|
|
601
696
|
}
|
|
697
|
+
if (config.authProvider !== void 0 || config.apiKey !== void 0) {
|
|
698
|
+
this.authProvider = this.config.authProvider ?? (this.config.apiKey ? new StaticApiKeyProvider(this.config.apiKey) : void 0);
|
|
699
|
+
}
|
|
602
700
|
}
|
|
603
701
|
/**
|
|
604
702
|
* Get current configuration (readonly)
|
|
@@ -669,6 +767,61 @@ function constantTimeEqual(a, b) {
|
|
|
669
767
|
return result === 0;
|
|
670
768
|
}
|
|
671
769
|
|
|
770
|
+
// src/geolocation/integrity.ts
|
|
771
|
+
var isNil = (v) => v === null || v === void 0;
|
|
772
|
+
function assessGpsIntegrity(input, opts = {}) {
|
|
773
|
+
const flags = [];
|
|
774
|
+
const now = opts.now ?? (() => Date.now());
|
|
775
|
+
const maxAgeMs = opts.maxAgeMs ?? 6e4;
|
|
776
|
+
const minAccuracy = opts.minAccuracyMeters ?? 1;
|
|
777
|
+
const { accuracy, altitude, altitudeAccuracy, heading, speed, timestamp } = input;
|
|
778
|
+
if (isNil(accuracy)) {
|
|
779
|
+
flags.push("accuracy_missing");
|
|
780
|
+
} else if (accuracy === 0) {
|
|
781
|
+
flags.push("accuracy_zero");
|
|
782
|
+
} else if (accuracy < minAccuracy) {
|
|
783
|
+
flags.push("accuracy_implausibly_small");
|
|
784
|
+
}
|
|
785
|
+
const hasMotion = !isNil(heading) || !isNil(speed);
|
|
786
|
+
if (hasMotion && (isNil(accuracy) || accuracy === 0)) {
|
|
787
|
+
flags.push("motion_without_accuracy");
|
|
788
|
+
}
|
|
789
|
+
if (!isNil(altitude) && isNil(altitudeAccuracy)) {
|
|
790
|
+
flags.push("altitude_without_accuracy");
|
|
791
|
+
}
|
|
792
|
+
if (timestamp !== void 0 && now() - timestamp > maxAgeMs) {
|
|
793
|
+
flags.push("stale_timestamp");
|
|
794
|
+
}
|
|
795
|
+
if (opts.permissionState === "denied" || opts.permissionState === "prompt") {
|
|
796
|
+
flags.push(`permission_${opts.permissionState}`);
|
|
797
|
+
}
|
|
798
|
+
return { suspicious: flags.length > 0, flags };
|
|
799
|
+
}
|
|
800
|
+
function gpsIntegrityInputFromPosition(position) {
|
|
801
|
+
const c = position.coords;
|
|
802
|
+
return {
|
|
803
|
+
latitude: c.latitude,
|
|
804
|
+
longitude: c.longitude,
|
|
805
|
+
accuracy: c.accuracy,
|
|
806
|
+
altitude: c.altitude,
|
|
807
|
+
altitudeAccuracy: c.altitudeAccuracy,
|
|
808
|
+
heading: c.heading,
|
|
809
|
+
speed: c.speed,
|
|
810
|
+
timestamp: position.timestamp
|
|
811
|
+
};
|
|
812
|
+
}
|
|
813
|
+
async function probeGeolocationPermission() {
|
|
814
|
+
try {
|
|
815
|
+
if (typeof navigator === "undefined" || !navigator.permissions?.query) {
|
|
816
|
+
return "unavailable";
|
|
817
|
+
}
|
|
818
|
+
const status = await navigator.permissions.query({ name: "geolocation" });
|
|
819
|
+
return status.state;
|
|
820
|
+
} catch {
|
|
821
|
+
return "unavailable";
|
|
822
|
+
}
|
|
823
|
+
}
|
|
824
|
+
|
|
672
825
|
// src/geolocation/ciphertext.ts
|
|
673
826
|
var CIPHER_TEXT_EXPIRY_MINUTES = 5;
|
|
674
827
|
async function computeHMAC(key, message) {
|
|
@@ -721,6 +874,7 @@ async function requestGPSLocation(timeout = 1e4, highAccuracy = true) {
|
|
|
721
874
|
if (typeof navigator === "undefined" || !navigator.geolocation) {
|
|
722
875
|
return null;
|
|
723
876
|
}
|
|
877
|
+
const permissionState = await probeGeolocationPermission();
|
|
724
878
|
return new Promise((resolve) => {
|
|
725
879
|
navigator.geolocation.getCurrentPosition(
|
|
726
880
|
(position) => {
|
|
@@ -737,6 +891,7 @@ async function requestGPSLocation(timeout = 1e4, highAccuracy = true) {
|
|
|
737
891
|
resolve(null);
|
|
738
892
|
return;
|
|
739
893
|
}
|
|
894
|
+
const { flags } = assessGpsIntegrity(gpsIntegrityInputFromPosition(position), { permissionState });
|
|
740
895
|
resolve({
|
|
741
896
|
latitude,
|
|
742
897
|
longitude,
|
|
@@ -745,7 +900,8 @@ async function requestGPSLocation(timeout = 1e4, highAccuracy = true) {
|
|
|
745
900
|
altitude_accuracy: position.coords.altitudeAccuracy ?? void 0,
|
|
746
901
|
heading: position.coords.heading ?? void 0,
|
|
747
902
|
speed: position.coords.speed ?? void 0,
|
|
748
|
-
timestamp: position.timestamp
|
|
903
|
+
timestamp: position.timestamp,
|
|
904
|
+
integrity_flags: flags.length ? flags : void 0
|
|
749
905
|
});
|
|
750
906
|
},
|
|
751
907
|
() => {
|
|
@@ -812,6 +968,9 @@ async function generateCipherText(options, config) {
|
|
|
812
968
|
);
|
|
813
969
|
if (location) {
|
|
814
970
|
locationData = location;
|
|
971
|
+
if (location.integrity_flags?.length) {
|
|
972
|
+
warnings.push(`GPS integrity flags (advisory): ${location.integrity_flags.join(", ")}`);
|
|
973
|
+
}
|
|
815
974
|
} else if (gpsRequiredByConfig) {
|
|
816
975
|
throw new VesantError(
|
|
817
976
|
`GPS location is required for ${options.reason} by tenant configuration, but GPS was not available or permission was denied`,
|
|
@@ -931,8 +1090,8 @@ var GeolocationClient = class extends BaseClient {
|
|
|
931
1090
|
* ```
|
|
932
1091
|
*/
|
|
933
1092
|
async verifyIP(request, requestOptions) {
|
|
934
|
-
if (!request.ip_address
|
|
935
|
-
throw new ValidationError("ip_address
|
|
1093
|
+
if (request.ip_address !== void 0 && !request.ip_address.trim()) {
|
|
1094
|
+
throw new ValidationError("ip_address, when provided, must be a non-empty string", ["ip_address"]);
|
|
936
1095
|
}
|
|
937
1096
|
return this.requestWithRetry("/api/v1/geo/verify", {
|
|
938
1097
|
method: "POST",
|
|
@@ -1282,20 +1441,12 @@ var GeolocationClient = class extends BaseClient {
|
|
|
1282
1441
|
*
|
|
1283
1442
|
* @example
|
|
1284
1443
|
* ```typescript
|
|
1285
|
-
* //
|
|
1444
|
+
* // GPS (the web SDK is GPS + IP only; the server handles the IP fallback)
|
|
1286
1445
|
* const result = await client.captureLocation(token, {
|
|
1287
1446
|
* latitude: 37.7749,
|
|
1288
1447
|
* longitude: -122.4194,
|
|
1289
1448
|
* accuracy: 10
|
|
1290
1449
|
* });
|
|
1291
|
-
*
|
|
1292
|
-
* // Using WiFi positioning (fallback)
|
|
1293
|
-
* const result = await client.captureLocation(token, {
|
|
1294
|
-
* wifi_networks: [
|
|
1295
|
-
* { macAddress: "00:11:22:33:44:55", signalStrength: -50 },
|
|
1296
|
-
* { macAddress: "AA:BB:CC:DD:EE:FF", signalStrength: -70 }
|
|
1297
|
-
* ]
|
|
1298
|
-
* });
|
|
1299
1450
|
* ```
|
|
1300
1451
|
*/
|
|
1301
1452
|
async captureLocation(token, capture, requestOptions) {
|
|
@@ -1800,9 +1951,6 @@ var ComplianceClient = class {
|
|
|
1800
1951
|
if (cipherTextResult.risk?.is_blocked) {
|
|
1801
1952
|
blockReasons.push(...cipherTextResult.risk.block_reasons_structured ?? []);
|
|
1802
1953
|
}
|
|
1803
|
-
if (cipherTextResult.risk?.location_mismatch) {
|
|
1804
|
-
blockReasons.push(sdkReasons.gpsIPMismatch());
|
|
1805
|
-
}
|
|
1806
1954
|
}
|
|
1807
1955
|
if (geoVerification.gps_required && !cipherTextResult) {
|
|
1808
1956
|
blockReasons.push(sdkReasons.gpsRequired());
|
|
@@ -2712,7 +2860,13 @@ var KycClient = class extends BaseClient {
|
|
|
2712
2860
|
*
|
|
2713
2861
|
* Generates a link that the user can visit to submit their KYC documents.
|
|
2714
2862
|
*
|
|
2715
|
-
*
|
|
2863
|
+
* Optionally pass the customer's registered identity data as
|
|
2864
|
+
* `customer_data` (same shape as the geolocation `customer_data` block).
|
|
2865
|
+
* It seeds the customer's risk profile so document verification can
|
|
2866
|
+
* cross-check the submitted document against trusted reference data;
|
|
2867
|
+
* fields never overwrite data already on the profile.
|
|
2868
|
+
*
|
|
2869
|
+
* @param request - Request containing the user ID, optional redirect URL, optional callback URL (receives POST requests), and optional customer identity data
|
|
2716
2870
|
* @returns Response containing the redirect link and KYC ID
|
|
2717
2871
|
*
|
|
2718
2872
|
* @example
|
|
@@ -2720,19 +2874,27 @@ var KycClient = class extends BaseClient {
|
|
|
2720
2874
|
* const result = await client.requestKycSubmitLink({
|
|
2721
2875
|
* user_id: "user_123",
|
|
2722
2876
|
* redirect_url: "https://merchant.com/kyc-complete", // optional
|
|
2723
|
-
* callback_url: "https://merchant.com/api/kyc-webhook" // optional - receives POST requests on status change
|
|
2877
|
+
* callback_url: "https://merchant.com/api/kyc-webhook", // optional - receives POST requests on status change
|
|
2878
|
+
* customer_data: { // optional - seeds the risk profile for document cross-checks
|
|
2879
|
+
* full_name: "John Doe",
|
|
2880
|
+
* date_of_birth: "1999-06-02", // ISO 8601
|
|
2881
|
+
* email: "john@example.com",
|
|
2882
|
+
* phone: "+94771234567",
|
|
2883
|
+
* address: "12 Main St, Colombo", // used for address verification
|
|
2884
|
+
* country: "LK"
|
|
2885
|
+
* }
|
|
2724
2886
|
* });
|
|
2725
2887
|
*
|
|
2726
2888
|
* console.log(`Redirect user to: ${result.link}`);
|
|
2727
2889
|
* console.log(`KYC ID: ${result.kyc_id}`);
|
|
2728
2890
|
* ```
|
|
2729
2891
|
*/
|
|
2730
|
-
async requestKycSubmitLink(request) {
|
|
2892
|
+
async requestKycSubmitLink(request, requestOptions) {
|
|
2731
2893
|
return this.requestWithRetry("/api/v1/kyc/request", {
|
|
2732
2894
|
method: "POST",
|
|
2733
2895
|
body: JSON.stringify(request),
|
|
2734
2896
|
headers: this.getUserHeaders()
|
|
2735
|
-
});
|
|
2897
|
+
}, void 0, void 0, requestOptions);
|
|
2736
2898
|
}
|
|
2737
2899
|
/**
|
|
2738
2900
|
* Create a Event-Based Face Verification session.
|
|
@@ -2765,12 +2927,12 @@ var KycClient = class extends BaseClient {
|
|
|
2765
2927
|
*
|
|
2766
2928
|
* @param request - Token from `createEventBasedFaceVerificationSession`, plus the base64 selfie.
|
|
2767
2929
|
*/
|
|
2768
|
-
async submitEventBasedFaceVerificationSession(request) {
|
|
2930
|
+
async submitEventBasedFaceVerificationSession(request, requestOptions) {
|
|
2769
2931
|
return this.request("/api/v1/kyc/face/submit", {
|
|
2770
2932
|
method: "POST",
|
|
2771
2933
|
body: JSON.stringify(request),
|
|
2772
2934
|
headers: this.getUserHeaders()
|
|
2773
|
-
});
|
|
2935
|
+
}, void 0, requestOptions);
|
|
2774
2936
|
}
|
|
2775
2937
|
/**
|
|
2776
2938
|
* Look up the current state of a Event-Based Face Verification session by its
|
|
@@ -2869,7 +3031,7 @@ var KycClient = class extends BaseClient {
|
|
|
2869
3031
|
* @example
|
|
2870
3032
|
* ```typescript
|
|
2871
3033
|
* const result = await client.submitVerification({
|
|
2872
|
-
* reference: "
|
|
3034
|
+
* reference: "4d2aff34-ab86-422d-992e-50b1234a5b67",
|
|
2873
3035
|
* email: "customer@example.com",
|
|
2874
3036
|
* country: "US",
|
|
2875
3037
|
* document: {
|
|
@@ -2886,12 +3048,12 @@ var KycClient = class extends BaseClient {
|
|
|
2886
3048
|
* console.log(`Verification submitted: ${result.reference}`);
|
|
2887
3049
|
* ```
|
|
2888
3050
|
*/
|
|
2889
|
-
async submitVerification(request) {
|
|
3051
|
+
async submitVerification(request, requestOptions) {
|
|
2890
3052
|
return this.requestWithRetry("/api/v1/kyc/submit", {
|
|
2891
3053
|
method: "POST",
|
|
2892
3054
|
body: JSON.stringify(request),
|
|
2893
3055
|
headers: this.getUserHeaders()
|
|
2894
|
-
});
|
|
3056
|
+
}, void 0, void 0, requestOptions);
|
|
2895
3057
|
}
|
|
2896
3058
|
/**
|
|
2897
3059
|
* Get a KYC request by ID
|
|
@@ -2901,7 +3063,7 @@ var KycClient = class extends BaseClient {
|
|
|
2901
3063
|
*
|
|
2902
3064
|
* @example
|
|
2903
3065
|
* ```typescript
|
|
2904
|
-
* const kyc = await client.getKycRequest("
|
|
3066
|
+
* const kyc = await client.getKycRequest("550e8400-e29b-41d4-a716-446655440000");
|
|
2905
3067
|
* console.log(`Status: ${kyc.status}, ID Verified: ${kyc.id_verified}`);
|
|
2906
3068
|
* ```
|
|
2907
3069
|
*/
|
|
@@ -2976,7 +3138,7 @@ var KycClient = class extends BaseClient {
|
|
|
2976
3138
|
* @example
|
|
2977
3139
|
* ```typescript
|
|
2978
3140
|
* await client.requestAdditionalDocuments({
|
|
2979
|
-
* id: "
|
|
3141
|
+
* id: "550e8400-e29b-41d4-a716-446655440000",
|
|
2980
3142
|
* document_types: ["address", "document_two"],
|
|
2981
3143
|
* message: "Please provide proof of address and secondary ID"
|
|
2982
3144
|
* });
|
|
@@ -2997,7 +3159,7 @@ var KycClient = class extends BaseClient {
|
|
|
2997
3159
|
*
|
|
2998
3160
|
* @example
|
|
2999
3161
|
* ```typescript
|
|
3000
|
-
* const proofs = await client.getProofDownloadURLs("
|
|
3162
|
+
* const proofs = await client.getProofDownloadURLs("550e8400-e29b-41d4-a716-446655440000");
|
|
3001
3163
|
* proofs.forEach(proof => {
|
|
3002
3164
|
* console.log(`${proof.type}: ${proof.url} (expires: ${proof.expires_at})`);
|
|
3003
3165
|
* });
|
|
@@ -3331,10 +3493,13 @@ var TaxClient = class extends BaseClient {
|
|
|
3331
3493
|
{ method: "POST" }
|
|
3332
3494
|
);
|
|
3333
3495
|
}
|
|
3334
|
-
async checkTINStatus(customerID) {
|
|
3496
|
+
async checkTINStatus(customerID, requestOptions) {
|
|
3335
3497
|
return this.requestWithRetry(
|
|
3336
3498
|
`/api/v1/tax/customer-tax-profiles/${customerID}/check-tin`,
|
|
3337
|
-
{ method: "POST" }
|
|
3499
|
+
{ method: "POST" },
|
|
3500
|
+
void 0,
|
|
3501
|
+
void 0,
|
|
3502
|
+
requestOptions
|
|
3338
3503
|
);
|
|
3339
3504
|
}
|
|
3340
3505
|
async reRequestTaxForm(customerID, input) {
|
|
@@ -3357,7 +3522,7 @@ var TaxClient = class extends BaseClient {
|
|
|
3357
3522
|
}
|
|
3358
3523
|
async getCustomerDocuments(customerID) {
|
|
3359
3524
|
return this.request(
|
|
3360
|
-
`/api/v1/
|
|
3525
|
+
`/api/v1/tm/customer-tax-profiles/${customerID}/documents`
|
|
3361
3526
|
);
|
|
3362
3527
|
}
|
|
3363
3528
|
async downloadTaxForm(customerID, requestOptions) {
|
|
@@ -3382,6 +3547,9 @@ var TaxClient = class extends BaseClient {
|
|
|
3382
3547
|
});
|
|
3383
3548
|
return res.version;
|
|
3384
3549
|
}
|
|
3550
|
+
async runReminders() {
|
|
3551
|
+
return this.request("/api/v1/tax/reminders/run", { method: "POST" });
|
|
3552
|
+
}
|
|
3385
3553
|
async getComplianceStats(filters) {
|
|
3386
3554
|
const params = {};
|
|
3387
3555
|
if (filters?.time_range) params.time_range = filters.time_range;
|
|
@@ -3591,21 +3759,26 @@ exports.KycClient = KycClient;
|
|
|
3591
3759
|
exports.NetworkError = NetworkError;
|
|
3592
3760
|
exports.RateLimitError = RateLimitError;
|
|
3593
3761
|
exports.RateLimitTracker = RateLimitTracker;
|
|
3762
|
+
exports.RefreshingTokenProvider = RefreshingTokenProvider;
|
|
3594
3763
|
exports.RiskProfileClient = RiskProfileClient;
|
|
3595
3764
|
exports.SDK_VERSION = SDK_VERSION;
|
|
3596
3765
|
exports.ServiceUnavailableError = ServiceUnavailableError;
|
|
3766
|
+
exports.StaticApiKeyProvider = StaticApiKeyProvider;
|
|
3597
3767
|
exports.TaxClient = TaxClient;
|
|
3598
3768
|
exports.TimeoutError = TimeoutError;
|
|
3599
3769
|
exports.ValidationError = ValidationError;
|
|
3600
3770
|
exports.VesantError = VesantError;
|
|
3601
3771
|
exports.WebhookHandler = WebhookHandler;
|
|
3772
|
+
exports.assessGpsIntegrity = assessGpsIntegrity;
|
|
3602
3773
|
exports.createConsoleLogger = createConsoleLogger;
|
|
3603
3774
|
exports.createNextWebhookHandler = createNextWebhookHandler;
|
|
3604
3775
|
exports.createWebhookMiddleware = createWebhookMiddleware;
|
|
3605
3776
|
exports.decodeCipherText = decodeCipherText;
|
|
3606
3777
|
exports.generateCipherText = generateCipherText;
|
|
3778
|
+
exports.gpsIntegrityInputFromPosition = gpsIntegrityInputFromPosition;
|
|
3607
3779
|
exports.isCipherTextExpired = isCipherTextExpired;
|
|
3608
3780
|
exports.noopLogger = noopLogger;
|
|
3781
|
+
exports.probeGeolocationPermission = probeGeolocationPermission;
|
|
3609
3782
|
exports.sdkReasons = sdkReasons;
|
|
3610
3783
|
exports.verifyWebhookSignature = verifyWebhookSignature;
|
|
3611
3784
|
//# sourceMappingURL=index.js.map
|