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.mjs
CHANGED
|
@@ -1,3 +1,59 @@
|
|
|
1
|
+
// src/core/auth.ts
|
|
2
|
+
var StaticApiKeyProvider = class {
|
|
3
|
+
constructor(apiKey) {
|
|
4
|
+
this.apiKey = apiKey;
|
|
5
|
+
}
|
|
6
|
+
async getCredential() {
|
|
7
|
+
return this.apiKey ? { scheme: "Bearer", token: this.apiKey } : null;
|
|
8
|
+
}
|
|
9
|
+
canRefresh() {
|
|
10
|
+
return false;
|
|
11
|
+
}
|
|
12
|
+
};
|
|
13
|
+
var RefreshingTokenProvider = class {
|
|
14
|
+
constructor(opts) {
|
|
15
|
+
this.opts = opts;
|
|
16
|
+
this.cached = null;
|
|
17
|
+
this.inFlight = null;
|
|
18
|
+
this.skewMs = opts.skewMs ?? 3e4;
|
|
19
|
+
this.scheme = opts.scheme ?? "Bearer";
|
|
20
|
+
this.now = opts.now ?? (() => Date.now());
|
|
21
|
+
}
|
|
22
|
+
canRefresh() {
|
|
23
|
+
return true;
|
|
24
|
+
}
|
|
25
|
+
async getCredential(ctx) {
|
|
26
|
+
const forceRefresh = ctx?.forceRefresh ?? false;
|
|
27
|
+
if (!forceRefresh && this.cached && !this.isExpiring(this.cached)) {
|
|
28
|
+
return { scheme: this.scheme, token: this.cached.token };
|
|
29
|
+
}
|
|
30
|
+
const fresh = await this.refresh();
|
|
31
|
+
return { scheme: this.scheme, token: fresh.token };
|
|
32
|
+
}
|
|
33
|
+
isExpiring(token) {
|
|
34
|
+
if (token.expiresAt === void 0) {
|
|
35
|
+
return false;
|
|
36
|
+
}
|
|
37
|
+
return this.now() >= token.expiresAt - this.skewMs;
|
|
38
|
+
}
|
|
39
|
+
refresh() {
|
|
40
|
+
if (this.inFlight) {
|
|
41
|
+
return this.inFlight;
|
|
42
|
+
}
|
|
43
|
+
this.inFlight = (async () => {
|
|
44
|
+
try {
|
|
45
|
+
const fresh = await this.opts.fetchToken();
|
|
46
|
+
this.cached = fresh;
|
|
47
|
+
this.opts.onRotate?.({ expiresAt: fresh.expiresAt });
|
|
48
|
+
return fresh;
|
|
49
|
+
} finally {
|
|
50
|
+
this.inFlight = null;
|
|
51
|
+
}
|
|
52
|
+
})();
|
|
53
|
+
return this.inFlight;
|
|
54
|
+
}
|
|
55
|
+
};
|
|
56
|
+
|
|
1
57
|
// src/core/errors.ts
|
|
2
58
|
var VesantError = class _VesantError extends Error {
|
|
3
59
|
constructor(message, code, statusCode, details) {
|
|
@@ -345,6 +401,7 @@ var BaseClient = class {
|
|
|
345
401
|
interceptors: this.interceptors,
|
|
346
402
|
logger: this.logger
|
|
347
403
|
};
|
|
404
|
+
this.authProvider = config.authProvider ?? (apiKey ? new StaticApiKeyProvider(apiKey) : void 0);
|
|
348
405
|
if (config.circuitBreaker) {
|
|
349
406
|
this.circuitBreaker = new CircuitBreaker(config.circuitBreaker);
|
|
350
407
|
}
|
|
@@ -352,6 +409,19 @@ var BaseClient = class {
|
|
|
352
409
|
this.rateLimitTracker = new RateLimitTracker();
|
|
353
410
|
}
|
|
354
411
|
}
|
|
412
|
+
/**
|
|
413
|
+
* Resolve the Idempotency-Key for a request. Mutating methods (POST/PUT/PATCH)
|
|
414
|
+
* get the caller-supplied key or a freshly minted UUID; non-mutating methods get
|
|
415
|
+
* none. requestWithRetry resolves this once and injects it so every retry reuses
|
|
416
|
+
* one key (letting the server dedup replays); a direct request() resolves per call.
|
|
417
|
+
*/
|
|
418
|
+
resolveIdempotencyKey(method, requestOptions) {
|
|
419
|
+
const isMutating = ["POST", "PUT", "PATCH"].includes((method || "GET").toUpperCase());
|
|
420
|
+
if (!isMutating) {
|
|
421
|
+
return void 0;
|
|
422
|
+
}
|
|
423
|
+
return requestOptions?.idempotencyKey ?? generateUUID();
|
|
424
|
+
}
|
|
355
425
|
/**
|
|
356
426
|
* Make an HTTP request with timeout and error handling
|
|
357
427
|
*/
|
|
@@ -377,15 +447,20 @@ var BaseClient = class {
|
|
|
377
447
|
...this.config.headers,
|
|
378
448
|
...options.headers || {}
|
|
379
449
|
};
|
|
380
|
-
|
|
381
|
-
|
|
450
|
+
const credential = await this.authProvider?.getCredential({
|
|
451
|
+
tenantId: this.config.tenantId,
|
|
452
|
+
requestId
|
|
453
|
+
});
|
|
454
|
+
if (credential) {
|
|
455
|
+
headers["Authorization"] = `${credential.scheme ?? "Bearer"} ${credential.token}`;
|
|
382
456
|
}
|
|
383
457
|
if (this.config.environment === "sandbox") {
|
|
384
458
|
headers["X-Sandbox"] = "true";
|
|
385
459
|
}
|
|
386
460
|
const method = (options.method || "GET").toUpperCase();
|
|
387
|
-
|
|
388
|
-
|
|
461
|
+
const idempotencyKey = this.resolveIdempotencyKey(method, requestOptions);
|
|
462
|
+
if (idempotencyKey) {
|
|
463
|
+
headers["Idempotency-Key"] = idempotencyKey;
|
|
389
464
|
}
|
|
390
465
|
const controller = new AbortController();
|
|
391
466
|
const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
|
|
@@ -406,10 +481,28 @@ var BaseClient = class {
|
|
|
406
481
|
if (this.config.debug) {
|
|
407
482
|
this.logger.debug(`${finalOptions.method || "GET"} ${endpoint}`);
|
|
408
483
|
}
|
|
409
|
-
|
|
484
|
+
let response = await fetch(url, {
|
|
410
485
|
...finalOptions,
|
|
411
486
|
signal: controller.signal
|
|
412
487
|
});
|
|
488
|
+
if (response.status === 401 && this.authProvider?.canRefresh?.()) {
|
|
489
|
+
const refreshed = await this.authProvider.getCredential({
|
|
490
|
+
tenantId: this.config.tenantId,
|
|
491
|
+
requestId,
|
|
492
|
+
forceRefresh: true
|
|
493
|
+
});
|
|
494
|
+
if (refreshed) {
|
|
495
|
+
this.config.onCredentialRotated?.({ reason: "unauthorized" });
|
|
496
|
+
finalOptions = {
|
|
497
|
+
...finalOptions,
|
|
498
|
+
headers: {
|
|
499
|
+
...finalOptions.headers,
|
|
500
|
+
Authorization: `${refreshed.scheme ?? "Bearer"} ${refreshed.token}`
|
|
501
|
+
}
|
|
502
|
+
};
|
|
503
|
+
response = await fetch(url, { ...finalOptions, signal: controller.signal });
|
|
504
|
+
}
|
|
505
|
+
}
|
|
413
506
|
clearTimeout(timeoutId);
|
|
414
507
|
if (this.rateLimitTracker) {
|
|
415
508
|
this.rateLimitTracker.updateFromHeaders(response.headers);
|
|
@@ -498,9 +591,11 @@ var BaseClient = class {
|
|
|
498
591
|
*/
|
|
499
592
|
async requestWithRetry(endpoint, options = {}, serviceURL, retries = this.config.retries, requestOptions) {
|
|
500
593
|
let lastError;
|
|
594
|
+
const idempotencyKey = this.resolveIdempotencyKey(options.method || "GET", requestOptions);
|
|
595
|
+
const attemptOptions = idempotencyKey ? { ...requestOptions, idempotencyKey } : requestOptions;
|
|
501
596
|
for (let attempt = 0; attempt <= retries; attempt++) {
|
|
502
597
|
try {
|
|
503
|
-
return await this.request(endpoint, options, serviceURL,
|
|
598
|
+
return await this.request(endpoint, options, serviceURL, attemptOptions);
|
|
504
599
|
} catch (error) {
|
|
505
600
|
lastError = error instanceof Error ? error : new Error("Unknown error");
|
|
506
601
|
if (requestOptions?.signal?.aborted) {
|
|
@@ -597,6 +692,9 @@ var BaseClient = class {
|
|
|
597
692
|
if (config.interceptors) {
|
|
598
693
|
this.interceptors = config.interceptors;
|
|
599
694
|
}
|
|
695
|
+
if (config.authProvider !== void 0 || config.apiKey !== void 0) {
|
|
696
|
+
this.authProvider = this.config.authProvider ?? (this.config.apiKey ? new StaticApiKeyProvider(this.config.apiKey) : void 0);
|
|
697
|
+
}
|
|
600
698
|
}
|
|
601
699
|
/**
|
|
602
700
|
* Get current configuration (readonly)
|
|
@@ -667,6 +765,61 @@ function constantTimeEqual(a, b) {
|
|
|
667
765
|
return result === 0;
|
|
668
766
|
}
|
|
669
767
|
|
|
768
|
+
// src/geolocation/integrity.ts
|
|
769
|
+
var isNil = (v) => v === null || v === void 0;
|
|
770
|
+
function assessGpsIntegrity(input, opts = {}) {
|
|
771
|
+
const flags = [];
|
|
772
|
+
const now = opts.now ?? (() => Date.now());
|
|
773
|
+
const maxAgeMs = opts.maxAgeMs ?? 6e4;
|
|
774
|
+
const minAccuracy = opts.minAccuracyMeters ?? 1;
|
|
775
|
+
const { accuracy, altitude, altitudeAccuracy, heading, speed, timestamp } = input;
|
|
776
|
+
if (isNil(accuracy)) {
|
|
777
|
+
flags.push("accuracy_missing");
|
|
778
|
+
} else if (accuracy === 0) {
|
|
779
|
+
flags.push("accuracy_zero");
|
|
780
|
+
} else if (accuracy < minAccuracy) {
|
|
781
|
+
flags.push("accuracy_implausibly_small");
|
|
782
|
+
}
|
|
783
|
+
const hasMotion = !isNil(heading) || !isNil(speed);
|
|
784
|
+
if (hasMotion && (isNil(accuracy) || accuracy === 0)) {
|
|
785
|
+
flags.push("motion_without_accuracy");
|
|
786
|
+
}
|
|
787
|
+
if (!isNil(altitude) && isNil(altitudeAccuracy)) {
|
|
788
|
+
flags.push("altitude_without_accuracy");
|
|
789
|
+
}
|
|
790
|
+
if (timestamp !== void 0 && now() - timestamp > maxAgeMs) {
|
|
791
|
+
flags.push("stale_timestamp");
|
|
792
|
+
}
|
|
793
|
+
if (opts.permissionState === "denied" || opts.permissionState === "prompt") {
|
|
794
|
+
flags.push(`permission_${opts.permissionState}`);
|
|
795
|
+
}
|
|
796
|
+
return { suspicious: flags.length > 0, flags };
|
|
797
|
+
}
|
|
798
|
+
function gpsIntegrityInputFromPosition(position) {
|
|
799
|
+
const c = position.coords;
|
|
800
|
+
return {
|
|
801
|
+
latitude: c.latitude,
|
|
802
|
+
longitude: c.longitude,
|
|
803
|
+
accuracy: c.accuracy,
|
|
804
|
+
altitude: c.altitude,
|
|
805
|
+
altitudeAccuracy: c.altitudeAccuracy,
|
|
806
|
+
heading: c.heading,
|
|
807
|
+
speed: c.speed,
|
|
808
|
+
timestamp: position.timestamp
|
|
809
|
+
};
|
|
810
|
+
}
|
|
811
|
+
async function probeGeolocationPermission() {
|
|
812
|
+
try {
|
|
813
|
+
if (typeof navigator === "undefined" || !navigator.permissions?.query) {
|
|
814
|
+
return "unavailable";
|
|
815
|
+
}
|
|
816
|
+
const status = await navigator.permissions.query({ name: "geolocation" });
|
|
817
|
+
return status.state;
|
|
818
|
+
} catch {
|
|
819
|
+
return "unavailable";
|
|
820
|
+
}
|
|
821
|
+
}
|
|
822
|
+
|
|
670
823
|
// src/geolocation/ciphertext.ts
|
|
671
824
|
var CIPHER_TEXT_EXPIRY_MINUTES = 5;
|
|
672
825
|
async function computeHMAC(key, message) {
|
|
@@ -719,6 +872,7 @@ async function requestGPSLocation(timeout = 1e4, highAccuracy = true) {
|
|
|
719
872
|
if (typeof navigator === "undefined" || !navigator.geolocation) {
|
|
720
873
|
return null;
|
|
721
874
|
}
|
|
875
|
+
const permissionState = await probeGeolocationPermission();
|
|
722
876
|
return new Promise((resolve) => {
|
|
723
877
|
navigator.geolocation.getCurrentPosition(
|
|
724
878
|
(position) => {
|
|
@@ -735,6 +889,7 @@ async function requestGPSLocation(timeout = 1e4, highAccuracy = true) {
|
|
|
735
889
|
resolve(null);
|
|
736
890
|
return;
|
|
737
891
|
}
|
|
892
|
+
const { flags } = assessGpsIntegrity(gpsIntegrityInputFromPosition(position), { permissionState });
|
|
738
893
|
resolve({
|
|
739
894
|
latitude,
|
|
740
895
|
longitude,
|
|
@@ -743,7 +898,8 @@ async function requestGPSLocation(timeout = 1e4, highAccuracy = true) {
|
|
|
743
898
|
altitude_accuracy: position.coords.altitudeAccuracy ?? void 0,
|
|
744
899
|
heading: position.coords.heading ?? void 0,
|
|
745
900
|
speed: position.coords.speed ?? void 0,
|
|
746
|
-
timestamp: position.timestamp
|
|
901
|
+
timestamp: position.timestamp,
|
|
902
|
+
integrity_flags: flags.length ? flags : void 0
|
|
747
903
|
});
|
|
748
904
|
},
|
|
749
905
|
() => {
|
|
@@ -810,6 +966,9 @@ async function generateCipherText(options, config) {
|
|
|
810
966
|
);
|
|
811
967
|
if (location) {
|
|
812
968
|
locationData = location;
|
|
969
|
+
if (location.integrity_flags?.length) {
|
|
970
|
+
warnings.push(`GPS integrity flags (advisory): ${location.integrity_flags.join(", ")}`);
|
|
971
|
+
}
|
|
813
972
|
} else if (gpsRequiredByConfig) {
|
|
814
973
|
throw new VesantError(
|
|
815
974
|
`GPS location is required for ${options.reason} by tenant configuration, but GPS was not available or permission was denied`,
|
|
@@ -929,8 +1088,8 @@ var GeolocationClient = class extends BaseClient {
|
|
|
929
1088
|
* ```
|
|
930
1089
|
*/
|
|
931
1090
|
async verifyIP(request, requestOptions) {
|
|
932
|
-
if (!request.ip_address
|
|
933
|
-
throw new ValidationError("ip_address
|
|
1091
|
+
if (request.ip_address !== void 0 && !request.ip_address.trim()) {
|
|
1092
|
+
throw new ValidationError("ip_address, when provided, must be a non-empty string", ["ip_address"]);
|
|
934
1093
|
}
|
|
935
1094
|
return this.requestWithRetry("/api/v1/geo/verify", {
|
|
936
1095
|
method: "POST",
|
|
@@ -1280,20 +1439,12 @@ var GeolocationClient = class extends BaseClient {
|
|
|
1280
1439
|
*
|
|
1281
1440
|
* @example
|
|
1282
1441
|
* ```typescript
|
|
1283
|
-
* //
|
|
1442
|
+
* // GPS (the web SDK is GPS + IP only; the server handles the IP fallback)
|
|
1284
1443
|
* const result = await client.captureLocation(token, {
|
|
1285
1444
|
* latitude: 37.7749,
|
|
1286
1445
|
* longitude: -122.4194,
|
|
1287
1446
|
* accuracy: 10
|
|
1288
1447
|
* });
|
|
1289
|
-
*
|
|
1290
|
-
* // Using WiFi positioning (fallback)
|
|
1291
|
-
* const result = await client.captureLocation(token, {
|
|
1292
|
-
* wifi_networks: [
|
|
1293
|
-
* { macAddress: "00:11:22:33:44:55", signalStrength: -50 },
|
|
1294
|
-
* { macAddress: "AA:BB:CC:DD:EE:FF", signalStrength: -70 }
|
|
1295
|
-
* ]
|
|
1296
|
-
* });
|
|
1297
1448
|
* ```
|
|
1298
1449
|
*/
|
|
1299
1450
|
async captureLocation(token, capture, requestOptions) {
|
|
@@ -1798,9 +1949,6 @@ var ComplianceClient = class {
|
|
|
1798
1949
|
if (cipherTextResult.risk?.is_blocked) {
|
|
1799
1950
|
blockReasons.push(...cipherTextResult.risk.block_reasons_structured ?? []);
|
|
1800
1951
|
}
|
|
1801
|
-
if (cipherTextResult.risk?.location_mismatch) {
|
|
1802
|
-
blockReasons.push(sdkReasons.gpsIPMismatch());
|
|
1803
|
-
}
|
|
1804
1952
|
}
|
|
1805
1953
|
if (geoVerification.gps_required && !cipherTextResult) {
|
|
1806
1954
|
blockReasons.push(sdkReasons.gpsRequired());
|
|
@@ -2710,7 +2858,13 @@ var KycClient = class extends BaseClient {
|
|
|
2710
2858
|
*
|
|
2711
2859
|
* Generates a link that the user can visit to submit their KYC documents.
|
|
2712
2860
|
*
|
|
2713
|
-
*
|
|
2861
|
+
* Optionally pass the customer's registered identity data as
|
|
2862
|
+
* `customer_data` (same shape as the geolocation `customer_data` block).
|
|
2863
|
+
* It seeds the customer's risk profile so document verification can
|
|
2864
|
+
* cross-check the submitted document against trusted reference data;
|
|
2865
|
+
* fields never overwrite data already on the profile.
|
|
2866
|
+
*
|
|
2867
|
+
* @param request - Request containing the user ID, optional redirect URL, optional callback URL (receives POST requests), and optional customer identity data
|
|
2714
2868
|
* @returns Response containing the redirect link and KYC ID
|
|
2715
2869
|
*
|
|
2716
2870
|
* @example
|
|
@@ -2718,19 +2872,27 @@ var KycClient = class extends BaseClient {
|
|
|
2718
2872
|
* const result = await client.requestKycSubmitLink({
|
|
2719
2873
|
* user_id: "user_123",
|
|
2720
2874
|
* redirect_url: "https://merchant.com/kyc-complete", // optional
|
|
2721
|
-
* callback_url: "https://merchant.com/api/kyc-webhook" // optional - receives POST requests on status change
|
|
2875
|
+
* callback_url: "https://merchant.com/api/kyc-webhook", // optional - receives POST requests on status change
|
|
2876
|
+
* customer_data: { // optional - seeds the risk profile for document cross-checks
|
|
2877
|
+
* full_name: "John Doe",
|
|
2878
|
+
* date_of_birth: "1999-06-02", // ISO 8601
|
|
2879
|
+
* email: "john@example.com",
|
|
2880
|
+
* phone: "+94771234567",
|
|
2881
|
+
* address: "12 Main St, Colombo", // used for address verification
|
|
2882
|
+
* country: "LK"
|
|
2883
|
+
* }
|
|
2722
2884
|
* });
|
|
2723
2885
|
*
|
|
2724
2886
|
* console.log(`Redirect user to: ${result.link}`);
|
|
2725
2887
|
* console.log(`KYC ID: ${result.kyc_id}`);
|
|
2726
2888
|
* ```
|
|
2727
2889
|
*/
|
|
2728
|
-
async requestKycSubmitLink(request) {
|
|
2890
|
+
async requestKycSubmitLink(request, requestOptions) {
|
|
2729
2891
|
return this.requestWithRetry("/api/v1/kyc/request", {
|
|
2730
2892
|
method: "POST",
|
|
2731
2893
|
body: JSON.stringify(request),
|
|
2732
2894
|
headers: this.getUserHeaders()
|
|
2733
|
-
});
|
|
2895
|
+
}, void 0, void 0, requestOptions);
|
|
2734
2896
|
}
|
|
2735
2897
|
/**
|
|
2736
2898
|
* Create a Event-Based Face Verification session.
|
|
@@ -2763,12 +2925,12 @@ var KycClient = class extends BaseClient {
|
|
|
2763
2925
|
*
|
|
2764
2926
|
* @param request - Token from `createEventBasedFaceVerificationSession`, plus the base64 selfie.
|
|
2765
2927
|
*/
|
|
2766
|
-
async submitEventBasedFaceVerificationSession(request) {
|
|
2928
|
+
async submitEventBasedFaceVerificationSession(request, requestOptions) {
|
|
2767
2929
|
return this.request("/api/v1/kyc/face/submit", {
|
|
2768
2930
|
method: "POST",
|
|
2769
2931
|
body: JSON.stringify(request),
|
|
2770
2932
|
headers: this.getUserHeaders()
|
|
2771
|
-
});
|
|
2933
|
+
}, void 0, requestOptions);
|
|
2772
2934
|
}
|
|
2773
2935
|
/**
|
|
2774
2936
|
* Look up the current state of a Event-Based Face Verification session by its
|
|
@@ -2867,7 +3029,7 @@ var KycClient = class extends BaseClient {
|
|
|
2867
3029
|
* @example
|
|
2868
3030
|
* ```typescript
|
|
2869
3031
|
* const result = await client.submitVerification({
|
|
2870
|
-
* reference: "
|
|
3032
|
+
* reference: "4d2aff34-ab86-422d-992e-50b1234a5b67",
|
|
2871
3033
|
* email: "customer@example.com",
|
|
2872
3034
|
* country: "US",
|
|
2873
3035
|
* document: {
|
|
@@ -2884,12 +3046,12 @@ var KycClient = class extends BaseClient {
|
|
|
2884
3046
|
* console.log(`Verification submitted: ${result.reference}`);
|
|
2885
3047
|
* ```
|
|
2886
3048
|
*/
|
|
2887
|
-
async submitVerification(request) {
|
|
3049
|
+
async submitVerification(request, requestOptions) {
|
|
2888
3050
|
return this.requestWithRetry("/api/v1/kyc/submit", {
|
|
2889
3051
|
method: "POST",
|
|
2890
3052
|
body: JSON.stringify(request),
|
|
2891
3053
|
headers: this.getUserHeaders()
|
|
2892
|
-
});
|
|
3054
|
+
}, void 0, void 0, requestOptions);
|
|
2893
3055
|
}
|
|
2894
3056
|
/**
|
|
2895
3057
|
* Get a KYC request by ID
|
|
@@ -2899,7 +3061,7 @@ var KycClient = class extends BaseClient {
|
|
|
2899
3061
|
*
|
|
2900
3062
|
* @example
|
|
2901
3063
|
* ```typescript
|
|
2902
|
-
* const kyc = await client.getKycRequest("
|
|
3064
|
+
* const kyc = await client.getKycRequest("550e8400-e29b-41d4-a716-446655440000");
|
|
2903
3065
|
* console.log(`Status: ${kyc.status}, ID Verified: ${kyc.id_verified}`);
|
|
2904
3066
|
* ```
|
|
2905
3067
|
*/
|
|
@@ -2974,7 +3136,7 @@ var KycClient = class extends BaseClient {
|
|
|
2974
3136
|
* @example
|
|
2975
3137
|
* ```typescript
|
|
2976
3138
|
* await client.requestAdditionalDocuments({
|
|
2977
|
-
* id: "
|
|
3139
|
+
* id: "550e8400-e29b-41d4-a716-446655440000",
|
|
2978
3140
|
* document_types: ["address", "document_two"],
|
|
2979
3141
|
* message: "Please provide proof of address and secondary ID"
|
|
2980
3142
|
* });
|
|
@@ -2995,7 +3157,7 @@ var KycClient = class extends BaseClient {
|
|
|
2995
3157
|
*
|
|
2996
3158
|
* @example
|
|
2997
3159
|
* ```typescript
|
|
2998
|
-
* const proofs = await client.getProofDownloadURLs("
|
|
3160
|
+
* const proofs = await client.getProofDownloadURLs("550e8400-e29b-41d4-a716-446655440000");
|
|
2999
3161
|
* proofs.forEach(proof => {
|
|
3000
3162
|
* console.log(`${proof.type}: ${proof.url} (expires: ${proof.expires_at})`);
|
|
3001
3163
|
* });
|
|
@@ -3329,10 +3491,13 @@ var TaxClient = class extends BaseClient {
|
|
|
3329
3491
|
{ method: "POST" }
|
|
3330
3492
|
);
|
|
3331
3493
|
}
|
|
3332
|
-
async checkTINStatus(customerID) {
|
|
3494
|
+
async checkTINStatus(customerID, requestOptions) {
|
|
3333
3495
|
return this.requestWithRetry(
|
|
3334
3496
|
`/api/v1/tax/customer-tax-profiles/${customerID}/check-tin`,
|
|
3335
|
-
{ method: "POST" }
|
|
3497
|
+
{ method: "POST" },
|
|
3498
|
+
void 0,
|
|
3499
|
+
void 0,
|
|
3500
|
+
requestOptions
|
|
3336
3501
|
);
|
|
3337
3502
|
}
|
|
3338
3503
|
async reRequestTaxForm(customerID, input) {
|
|
@@ -3355,7 +3520,7 @@ var TaxClient = class extends BaseClient {
|
|
|
3355
3520
|
}
|
|
3356
3521
|
async getCustomerDocuments(customerID) {
|
|
3357
3522
|
return this.request(
|
|
3358
|
-
`/api/v1/
|
|
3523
|
+
`/api/v1/tm/customer-tax-profiles/${customerID}/documents`
|
|
3359
3524
|
);
|
|
3360
3525
|
}
|
|
3361
3526
|
async downloadTaxForm(customerID, requestOptions) {
|
|
@@ -3380,6 +3545,9 @@ var TaxClient = class extends BaseClient {
|
|
|
3380
3545
|
});
|
|
3381
3546
|
return res.version;
|
|
3382
3547
|
}
|
|
3548
|
+
async runReminders() {
|
|
3549
|
+
return this.request("/api/v1/tax/reminders/run", { method: "POST" });
|
|
3550
|
+
}
|
|
3383
3551
|
async getComplianceStats(filters) {
|
|
3384
3552
|
const params = {};
|
|
3385
3553
|
if (filters?.time_range) params.time_range = filters.time_range;
|
|
@@ -3574,6 +3742,6 @@ function buildHandler(options) {
|
|
|
3574
3742
|
return handler;
|
|
3575
3743
|
}
|
|
3576
3744
|
|
|
3577
|
-
export { AuthenticationError, BaseClient, CGSError, CircuitBreaker, CircuitBreakerOpenError, ComplianceBlockedError, ComplianceClient, ComplianceError, DEFAULT_CURRENCY_RATES, GeolocationClient, KYC_DECLINED_DESCRIPTIONS, KycClient, NetworkError, RateLimitError, RateLimitTracker, RiskProfileClient, SDK_VERSION, ServiceUnavailableError, TaxClient, TimeoutError, ValidationError, VesantError, WebhookHandler, createConsoleLogger, createNextWebhookHandler, createWebhookMiddleware, decodeCipherText, generateCipherText, isCipherTextExpired, noopLogger, sdkReasons, verifyWebhookSignature };
|
|
3745
|
+
export { AuthenticationError, BaseClient, CGSError, CircuitBreaker, CircuitBreakerOpenError, ComplianceBlockedError, ComplianceClient, ComplianceError, DEFAULT_CURRENCY_RATES, GeolocationClient, KYC_DECLINED_DESCRIPTIONS, KycClient, NetworkError, RateLimitError, RateLimitTracker, RefreshingTokenProvider, RiskProfileClient, SDK_VERSION, ServiceUnavailableError, StaticApiKeyProvider, TaxClient, TimeoutError, ValidationError, VesantError, WebhookHandler, assessGpsIntegrity, createConsoleLogger, createNextWebhookHandler, createWebhookMiddleware, decodeCipherText, generateCipherText, gpsIntegrityInputFromPosition, isCipherTextExpired, noopLogger, probeGeolocationPermission, sdkReasons, verifyWebhookSignature };
|
|
3578
3746
|
//# sourceMappingURL=index.mjs.map
|
|
3579
3747
|
//# sourceMappingURL=index.mjs.map
|