vesant-sdk 1.7.0-dev.ab7ff29 → 1.7.0-dev.b2c9ecf
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-BolQlL5e.d.mts → client-6sSaxufk.d.mts} +7 -0
- package/dist/{client-BolQlL5e.d.ts → client-6sSaxufk.d.ts} +7 -0
- package/dist/{client-DoMSYMMR.d.ts → client-B32yBt1b.d.ts} +14 -1
- package/dist/{client-DMIRx7Tu.d.mts → client-BqPVh5jH.d.mts} +14 -1
- package/dist/{client-ZNdnpWe7.d.mts → client-CHPEgasE.d.mts} +2 -2
- package/dist/{client-C3DCmGe9.d.ts → client-pKE_gii_.d.ts} +2 -2
- package/dist/compliance/index.d.mts +3 -3
- package/dist/compliance/index.d.ts +3 -3
- package/dist/compliance/index.js +19 -6
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +19 -6
- 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 +19 -3
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisions/index.mjs +19 -3
- package/dist/decisions/index.mjs.map +1 -1
- package/dist/geolocation/index.d.mts +3 -3
- package/dist/geolocation/index.d.ts +3 -3
- package/dist/geolocation/index.js +19 -3
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +19 -3
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +54 -21
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -21
- 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 +45 -15
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +45 -15
- 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 +45 -15
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +45 -15
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +5 -3
- package/dist/react.d.ts +5 -3
- package/dist/react.js +112 -73
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +112 -73
- 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 +19 -3
- package/dist/risk-profile/index.js.map +1 -1
- package/dist/risk-profile/index.mjs +19 -3
- 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 +19 -3
- package/dist/scores/index.js.map +1 -1
- package/dist/scores/index.mjs +19 -3
- 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 +28 -6
- package/dist/tax/index.js.map +1 -1
- package/dist/tax/index.mjs +28 -6
- package/dist/tax/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -352,6 +352,19 @@ var BaseClient = class {
|
|
|
352
352
|
this.rateLimitTracker = new RateLimitTracker();
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
|
+
/**
|
|
356
|
+
* Resolve the Idempotency-Key for a request. Mutating methods (POST/PUT/PATCH)
|
|
357
|
+
* get the caller-supplied key or a freshly minted UUID; non-mutating methods get
|
|
358
|
+
* none. requestWithRetry resolves this once and injects it so every retry reuses
|
|
359
|
+
* one key (letting the server dedup replays); a direct request() resolves per call.
|
|
360
|
+
*/
|
|
361
|
+
resolveIdempotencyKey(method, requestOptions) {
|
|
362
|
+
const isMutating = ["POST", "PUT", "PATCH"].includes((method || "GET").toUpperCase());
|
|
363
|
+
if (!isMutating) {
|
|
364
|
+
return void 0;
|
|
365
|
+
}
|
|
366
|
+
return requestOptions?.idempotencyKey ?? generateUUID();
|
|
367
|
+
}
|
|
355
368
|
/**
|
|
356
369
|
* Make an HTTP request with timeout and error handling
|
|
357
370
|
*/
|
|
@@ -384,8 +397,9 @@ var BaseClient = class {
|
|
|
384
397
|
headers["X-Sandbox"] = "true";
|
|
385
398
|
}
|
|
386
399
|
const method = (options.method || "GET").toUpperCase();
|
|
387
|
-
|
|
388
|
-
|
|
400
|
+
const idempotencyKey = this.resolveIdempotencyKey(method, requestOptions);
|
|
401
|
+
if (idempotencyKey) {
|
|
402
|
+
headers["Idempotency-Key"] = idempotencyKey;
|
|
389
403
|
}
|
|
390
404
|
const controller = new AbortController();
|
|
391
405
|
const timeoutId = setTimeout(() => controller.abort(), this.config.timeout);
|
|
@@ -498,9 +512,11 @@ var BaseClient = class {
|
|
|
498
512
|
*/
|
|
499
513
|
async requestWithRetry(endpoint, options = {}, serviceURL, retries = this.config.retries, requestOptions) {
|
|
500
514
|
let lastError;
|
|
515
|
+
const idempotencyKey = this.resolveIdempotencyKey(options.method || "GET", requestOptions);
|
|
516
|
+
const attemptOptions = idempotencyKey ? { ...requestOptions, idempotencyKey } : requestOptions;
|
|
501
517
|
for (let attempt = 0; attempt <= retries; attempt++) {
|
|
502
518
|
try {
|
|
503
|
-
return await this.request(endpoint, options, serviceURL,
|
|
519
|
+
return await this.request(endpoint, options, serviceURL, attemptOptions);
|
|
504
520
|
} catch (error) {
|
|
505
521
|
lastError = error instanceof Error ? error : new Error("Unknown error");
|
|
506
522
|
if (requestOptions?.signal?.aborted) {
|
|
@@ -1798,9 +1814,6 @@ var ComplianceClient = class {
|
|
|
1798
1814
|
if (cipherTextResult.risk?.is_blocked) {
|
|
1799
1815
|
blockReasons.push(...cipherTextResult.risk.block_reasons_structured ?? []);
|
|
1800
1816
|
}
|
|
1801
|
-
if (cipherTextResult.risk?.location_mismatch) {
|
|
1802
|
-
blockReasons.push(sdkReasons.gpsIPMismatch());
|
|
1803
|
-
}
|
|
1804
1817
|
}
|
|
1805
1818
|
if (geoVerification.gps_required && !cipherTextResult) {
|
|
1806
1819
|
blockReasons.push(sdkReasons.gpsRequired());
|
|
@@ -2710,7 +2723,13 @@ var KycClient = class extends BaseClient {
|
|
|
2710
2723
|
*
|
|
2711
2724
|
* Generates a link that the user can visit to submit their KYC documents.
|
|
2712
2725
|
*
|
|
2713
|
-
*
|
|
2726
|
+
* Optionally pass the customer's registered identity data as
|
|
2727
|
+
* `customer_data` (same shape as the geolocation `customer_data` block).
|
|
2728
|
+
* It seeds the customer's risk profile so document verification can
|
|
2729
|
+
* cross-check the submitted document against trusted reference data;
|
|
2730
|
+
* fields never overwrite data already on the profile.
|
|
2731
|
+
*
|
|
2732
|
+
* @param request - Request containing the user ID, optional redirect URL, optional callback URL (receives POST requests), and optional customer identity data
|
|
2714
2733
|
* @returns Response containing the redirect link and KYC ID
|
|
2715
2734
|
*
|
|
2716
2735
|
* @example
|
|
@@ -2718,19 +2737,27 @@ var KycClient = class extends BaseClient {
|
|
|
2718
2737
|
* const result = await client.requestKycSubmitLink({
|
|
2719
2738
|
* user_id: "user_123",
|
|
2720
2739
|
* redirect_url: "https://merchant.com/kyc-complete", // optional
|
|
2721
|
-
* callback_url: "https://merchant.com/api/kyc-webhook" // optional - receives POST requests on status change
|
|
2740
|
+
* callback_url: "https://merchant.com/api/kyc-webhook", // optional - receives POST requests on status change
|
|
2741
|
+
* customer_data: { // optional - seeds the risk profile for document cross-checks
|
|
2742
|
+
* full_name: "John Doe",
|
|
2743
|
+
* date_of_birth: "1999-06-02", // ISO 8601
|
|
2744
|
+
* email: "john@example.com",
|
|
2745
|
+
* phone: "+94771234567",
|
|
2746
|
+
* address: "12 Main St, Colombo", // used for address verification
|
|
2747
|
+
* country: "LK"
|
|
2748
|
+
* }
|
|
2722
2749
|
* });
|
|
2723
2750
|
*
|
|
2724
2751
|
* console.log(`Redirect user to: ${result.link}`);
|
|
2725
2752
|
* console.log(`KYC ID: ${result.kyc_id}`);
|
|
2726
2753
|
* ```
|
|
2727
2754
|
*/
|
|
2728
|
-
async requestKycSubmitLink(request) {
|
|
2755
|
+
async requestKycSubmitLink(request, requestOptions) {
|
|
2729
2756
|
return this.requestWithRetry("/api/v1/kyc/request", {
|
|
2730
2757
|
method: "POST",
|
|
2731
2758
|
body: JSON.stringify(request),
|
|
2732
2759
|
headers: this.getUserHeaders()
|
|
2733
|
-
});
|
|
2760
|
+
}, void 0, void 0, requestOptions);
|
|
2734
2761
|
}
|
|
2735
2762
|
/**
|
|
2736
2763
|
* Create a Event-Based Face Verification session.
|
|
@@ -2763,12 +2790,12 @@ var KycClient = class extends BaseClient {
|
|
|
2763
2790
|
*
|
|
2764
2791
|
* @param request - Token from `createEventBasedFaceVerificationSession`, plus the base64 selfie.
|
|
2765
2792
|
*/
|
|
2766
|
-
async submitEventBasedFaceVerificationSession(request) {
|
|
2793
|
+
async submitEventBasedFaceVerificationSession(request, requestOptions) {
|
|
2767
2794
|
return this.request("/api/v1/kyc/face/submit", {
|
|
2768
2795
|
method: "POST",
|
|
2769
2796
|
body: JSON.stringify(request),
|
|
2770
2797
|
headers: this.getUserHeaders()
|
|
2771
|
-
});
|
|
2798
|
+
}, void 0, requestOptions);
|
|
2772
2799
|
}
|
|
2773
2800
|
/**
|
|
2774
2801
|
* Look up the current state of a Event-Based Face Verification session by its
|
|
@@ -2867,7 +2894,7 @@ var KycClient = class extends BaseClient {
|
|
|
2867
2894
|
* @example
|
|
2868
2895
|
* ```typescript
|
|
2869
2896
|
* const result = await client.submitVerification({
|
|
2870
|
-
* reference: "
|
|
2897
|
+
* reference: "4d2aff34-ab86-422d-992e-50b1234a5b67",
|
|
2871
2898
|
* email: "customer@example.com",
|
|
2872
2899
|
* country: "US",
|
|
2873
2900
|
* document: {
|
|
@@ -2884,12 +2911,12 @@ var KycClient = class extends BaseClient {
|
|
|
2884
2911
|
* console.log(`Verification submitted: ${result.reference}`);
|
|
2885
2912
|
* ```
|
|
2886
2913
|
*/
|
|
2887
|
-
async submitVerification(request) {
|
|
2914
|
+
async submitVerification(request, requestOptions) {
|
|
2888
2915
|
return this.requestWithRetry("/api/v1/kyc/submit", {
|
|
2889
2916
|
method: "POST",
|
|
2890
2917
|
body: JSON.stringify(request),
|
|
2891
2918
|
headers: this.getUserHeaders()
|
|
2892
|
-
});
|
|
2919
|
+
}, void 0, void 0, requestOptions);
|
|
2893
2920
|
}
|
|
2894
2921
|
/**
|
|
2895
2922
|
* Get a KYC request by ID
|
|
@@ -2899,7 +2926,7 @@ var KycClient = class extends BaseClient {
|
|
|
2899
2926
|
*
|
|
2900
2927
|
* @example
|
|
2901
2928
|
* ```typescript
|
|
2902
|
-
* const kyc = await client.getKycRequest("
|
|
2929
|
+
* const kyc = await client.getKycRequest("550e8400-e29b-41d4-a716-446655440000");
|
|
2903
2930
|
* console.log(`Status: ${kyc.status}, ID Verified: ${kyc.id_verified}`);
|
|
2904
2931
|
* ```
|
|
2905
2932
|
*/
|
|
@@ -2974,7 +3001,7 @@ var KycClient = class extends BaseClient {
|
|
|
2974
3001
|
* @example
|
|
2975
3002
|
* ```typescript
|
|
2976
3003
|
* await client.requestAdditionalDocuments({
|
|
2977
|
-
* id: "
|
|
3004
|
+
* id: "550e8400-e29b-41d4-a716-446655440000",
|
|
2978
3005
|
* document_types: ["address", "document_two"],
|
|
2979
3006
|
* message: "Please provide proof of address and secondary ID"
|
|
2980
3007
|
* });
|
|
@@ -2995,7 +3022,7 @@ var KycClient = class extends BaseClient {
|
|
|
2995
3022
|
*
|
|
2996
3023
|
* @example
|
|
2997
3024
|
* ```typescript
|
|
2998
|
-
* const proofs = await client.getProofDownloadURLs("
|
|
3025
|
+
* const proofs = await client.getProofDownloadURLs("550e8400-e29b-41d4-a716-446655440000");
|
|
2999
3026
|
* proofs.forEach(proof => {
|
|
3000
3027
|
* console.log(`${proof.type}: ${proof.url} (expires: ${proof.expires_at})`);
|
|
3001
3028
|
* });
|
|
@@ -3329,10 +3356,13 @@ var TaxClient = class extends BaseClient {
|
|
|
3329
3356
|
{ method: "POST" }
|
|
3330
3357
|
);
|
|
3331
3358
|
}
|
|
3332
|
-
async checkTINStatus(customerID) {
|
|
3359
|
+
async checkTINStatus(customerID, requestOptions) {
|
|
3333
3360
|
return this.requestWithRetry(
|
|
3334
3361
|
`/api/v1/tax/customer-tax-profiles/${customerID}/check-tin`,
|
|
3335
|
-
{ method: "POST" }
|
|
3362
|
+
{ method: "POST" },
|
|
3363
|
+
void 0,
|
|
3364
|
+
void 0,
|
|
3365
|
+
requestOptions
|
|
3336
3366
|
);
|
|
3337
3367
|
}
|
|
3338
3368
|
async reRequestTaxForm(customerID, input) {
|
|
@@ -3355,7 +3385,7 @@ var TaxClient = class extends BaseClient {
|
|
|
3355
3385
|
}
|
|
3356
3386
|
async getCustomerDocuments(customerID) {
|
|
3357
3387
|
return this.request(
|
|
3358
|
-
`/api/v1/
|
|
3388
|
+
`/api/v1/tm/customer-tax-profiles/${customerID}/documents`
|
|
3359
3389
|
);
|
|
3360
3390
|
}
|
|
3361
3391
|
async downloadTaxForm(customerID, requestOptions) {
|
|
@@ -3380,6 +3410,9 @@ var TaxClient = class extends BaseClient {
|
|
|
3380
3410
|
});
|
|
3381
3411
|
return res.version;
|
|
3382
3412
|
}
|
|
3413
|
+
async runReminders() {
|
|
3414
|
+
return this.request("/api/v1/tax/reminders/run", { method: "POST" });
|
|
3415
|
+
}
|
|
3383
3416
|
async getComplianceStats(filters) {
|
|
3384
3417
|
const params = {};
|
|
3385
3418
|
if (filters?.time_range) params.time_range = filters.time_range;
|