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