vesant-sdk 1.8.0-dev.32e3a40 → 1.8.0-dev.394d6eb

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 (58) hide show
  1. package/README.md +0 -2
  2. package/dist/{client-4oLoc31v.d.ts → client-BPALLldd.d.ts} +1 -1
  3. package/dist/{client-CJI8VO1i.d.mts → client-_OhkfnyJ.d.mts} +1 -1
  4. package/dist/compliance/index.d.mts +2 -2
  5. package/dist/compliance/index.d.ts +2 -2
  6. package/dist/compliance/index.js +7 -6
  7. package/dist/compliance/index.js.map +1 -1
  8. package/dist/compliance/index.mjs +7 -6
  9. package/dist/compliance/index.mjs.map +1 -1
  10. package/dist/decisions/index.js +7 -6
  11. package/dist/decisions/index.js.map +1 -1
  12. package/dist/decisions/index.mjs +7 -6
  13. package/dist/decisions/index.mjs.map +1 -1
  14. package/dist/geolocation/index.js +7 -6
  15. package/dist/geolocation/index.js.map +1 -1
  16. package/dist/geolocation/index.mjs +7 -6
  17. package/dist/geolocation/index.mjs.map +1 -1
  18. package/dist/index.d.mts +3 -3
  19. package/dist/index.d.ts +3 -3
  20. package/dist/index.js +12 -179
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.mjs +12 -180
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/kyc/core.d.mts +2 -2
  25. package/dist/kyc/core.d.ts +2 -2
  26. package/dist/kyc/core.js +12 -179
  27. package/dist/kyc/core.js.map +1 -1
  28. package/dist/kyc/core.mjs +12 -180
  29. package/dist/kyc/core.mjs.map +1 -1
  30. package/dist/kyc/index.d.mts +69 -228
  31. package/dist/kyc/index.d.ts +69 -228
  32. package/dist/kyc/index.js +12 -179
  33. package/dist/kyc/index.js.map +1 -1
  34. package/dist/kyc/index.mjs +12 -180
  35. package/dist/kyc/index.mjs.map +1 -1
  36. package/dist/react.d.mts +6 -122
  37. package/dist/react.d.ts +6 -122
  38. package/dist/react.js +0 -185
  39. package/dist/react.js.map +1 -1
  40. package/dist/react.mjs +1 -183
  41. package/dist/react.mjs.map +1 -1
  42. package/dist/risk-profile/index.d.mts +2 -2
  43. package/dist/risk-profile/index.d.ts +2 -2
  44. package/dist/risk-profile/index.js +7 -6
  45. package/dist/risk-profile/index.js.map +1 -1
  46. package/dist/risk-profile/index.mjs +7 -6
  47. package/dist/risk-profile/index.mjs.map +1 -1
  48. package/dist/scores/index.js +7 -6
  49. package/dist/scores/index.js.map +1 -1
  50. package/dist/scores/index.mjs +7 -6
  51. package/dist/scores/index.mjs.map +1 -1
  52. package/dist/tax/index.js +7 -6
  53. package/dist/tax/index.js.map +1 -1
  54. package/dist/tax/index.mjs +7 -6
  55. package/dist/tax/index.mjs.map +1 -1
  56. package/dist/{types-DfbnIaW_.d.mts → types-DbvVph_0.d.mts} +1 -1
  57. package/dist/{types-1kI4SsKB.d.ts → types-qXamJr2q.d.ts} +1 -1
  58. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -631,19 +631,20 @@ var BaseClient = class {
631
631
  * Handle error responses from API
632
632
  */
633
633
  handleErrorResponse(status, data, requestId) {
634
- const message = data.error || data.message || `HTTP ${status}`;
634
+ const structured = data.error && typeof data.error === "object" && !Array.isArray(data.error) ? data.error : void 0;
635
+ const message = typeof data.error === "string" && data.error || typeof structured?.message === "string" && structured.message || typeof data.message === "string" && data.message || `HTTP ${status}`;
635
636
  const createError = () => {
636
637
  switch (status) {
637
638
  case 400:
638
- return new VesantError(message, "BAD_REQUEST", 400);
639
+ return new VesantError(message, "BAD_REQUEST", 400, structured);
639
640
  case 401:
640
641
  return new AuthenticationError(message);
641
642
  case 403:
642
- return new VesantError(message, "FORBIDDEN", 403);
643
+ return new VesantError(message, "FORBIDDEN", 403, structured);
643
644
  case 404:
644
- return new VesantError(message, "NOT_FOUND", 404);
645
+ return new VesantError(message, "NOT_FOUND", 404, structured);
645
646
  case 409:
646
- return new VesantError(message, "DUPLICATE_PROFILE", 409);
647
+ return new VesantError(message, "DUPLICATE_PROFILE", 409, structured);
647
648
  case 429: {
648
649
  const retryAfter = data.retry_after || data.retryAfter;
649
650
  return new RateLimitError(retryAfter);
@@ -654,7 +655,7 @@ var BaseClient = class {
654
655
  case 504:
655
656
  return new ServiceUnavailableError(message);
656
657
  default:
657
- return new VesantError(message, "UNKNOWN_ERROR", status);
658
+ return new VesantError(message, "UNKNOWN_ERROR", status, structured);
658
659
  }
659
660
  };
660
661
  const error = createError();
@@ -3224,74 +3225,6 @@ var KycClient = class extends BaseClient {
3224
3225
  headers: this.getUserHeaders()
3225
3226
  });
3226
3227
  }
3227
- /**
3228
- * List KYC requests with filters and pagination
3229
- *
3230
- * @param filters - Optional filters (status, search, date range)
3231
- * @param pagination - Optional pagination (page, page_size)
3232
- * @returns Paginated list of KYC requests
3233
- *
3234
- * @example
3235
- * ```typescript
3236
- * const requests = await client.listKycRequests(
3237
- * { status: "pending", search: "john" },
3238
- * { page: 1, page_size: 20 }
3239
- * );
3240
- * console.log(`Found ${requests.total} pending requests`);
3241
- * ```
3242
- *
3243
- * @remarks Console session only. This endpoint accepts a Vesant console
3244
- * (dashboard login) token, not a tenant API key; called with an API key it
3245
- * fails with `AuthenticationError` or a permission error.
3246
- */
3247
- async listKycRequests(filters, pagination) {
3248
- const params = {};
3249
- if (filters) {
3250
- addFilterParam(params, "status", filters.status);
3251
- addSimpleParams(params, filters, ["search", "fromDate", "toDate", "sortBy", "order"]);
3252
- }
3253
- if (pagination) {
3254
- if (pagination.page) params.page = pagination.page;
3255
- if (pagination.page_size) params.limit = pagination.page_size;
3256
- }
3257
- return this.request(
3258
- `/api/v1/kyc/requests${this.buildQueryString(params)}`,
3259
- { headers: this.getUserHeaders() }
3260
- );
3261
- }
3262
- /**
3263
- * Update KYC request status (accept/decline)
3264
- *
3265
- * @param request - Status update request with reference, status, and reason
3266
- *
3267
- * @example
3268
- * ```typescript
3269
- * // Accept a KYC request
3270
- * await client.updateKycStatus({
3271
- * reference: "kyc-ref-123",
3272
- * status: "accepted",
3273
- * reason: "All documents verified successfully"
3274
- * });
3275
- *
3276
- * // Decline a KYC request
3277
- * await client.updateKycStatus({
3278
- * reference: "kyc-ref-456",
3279
- * status: "declined",
3280
- * reason: "Document expired"
3281
- * });
3282
- * ```
3283
- *
3284
- * @remarks Console session only. This endpoint accepts a Vesant console
3285
- * (dashboard login) token, not a tenant API key; called with an API key it
3286
- * fails with `AuthenticationError` or a permission error.
3287
- */
3288
- async updateKycStatus(request) {
3289
- await this.request("/api/v1/kyc/status", {
3290
- method: "PUT",
3291
- body: JSON.stringify(request),
3292
- headers: this.getUserHeaders()
3293
- });
3294
- }
3295
3228
  /**
3296
3229
  * Request additional documents from customer
3297
3230
  *
@@ -3340,53 +3273,8 @@ var KycClient = class extends BaseClient {
3340
3273
  return (kyc.proofs ?? []).filter((proof) => typeof proof.link === "string" && proof.link !== "").map((proof) => ({ id: proof.id, type: proof.type, url: proof.link }));
3341
3274
  }
3342
3275
  // ============================================================================
3343
- // KYC Overview & Statistics
3344
- // ============================================================================
3345
- /**
3346
- * Get KYC overview statistics
3347
- *
3348
- * @param fromDate - Optional start date (ISO 8601)
3349
- * @param toDate - Optional end date (ISO 8601)
3350
- * @returns KYC statistics including counts by status
3351
- *
3352
- * @example
3353
- * ```typescript
3354
- * const overview = await client.getOverview(
3355
- * "2024-01-01T00:00:00Z",
3356
- * "2024-12-31T23:59:59Z"
3357
- * );
3358
- * console.log(`Total: ${overview.total}, Pending: ${overview.pending}`);
3359
- * console.log(`Approved: ${overview.approved}, Rejected: ${overview.rejected}`);
3360
- * ```
3361
- *
3362
- * @remarks Console session only. This endpoint accepts a Vesant console
3363
- * (dashboard login) token, not a tenant API key; called with an API key it
3364
- * fails with `AuthenticationError` or a permission error.
3365
- */
3366
- async getOverview(fromDate, toDate) {
3367
- const params = {};
3368
- if (fromDate) params.fromDate = fromDate;
3369
- if (toDate) params.toDate = toDate;
3370
- return this.request(
3371
- `/api/v1/kyc/overview${this.buildQueryString(params)}`
3372
- );
3373
- }
3374
- // ============================================================================
3375
3276
  // Alert Management
3376
3277
  // ============================================================================
3377
- /**
3378
- * Get a KYC alert by ID
3379
- *
3380
- * @param alertId - Alert ID
3381
- * @returns Alert details
3382
- *
3383
- * @remarks Console session only. This endpoint accepts a Vesant console
3384
- * (dashboard login) token, not a tenant API key; called with an API key it
3385
- * fails with `AuthenticationError` or a permission error.
3386
- */
3387
- async getAlert(alertId) {
3388
- return this.request(`/api/v1/kyc/alerts/${alertId}`);
3389
- }
3390
3278
  /**
3391
3279
  * List KYC alerts with filters and pagination
3392
3280
  *
@@ -3429,74 +3317,15 @@ var KycClient = class extends BaseClient {
3429
3317
  `/api/v1/kyc/alerts${this.buildQueryString(params)}`
3430
3318
  );
3431
3319
  }
3432
- /**
3433
- * Update a KYC alert
3434
- *
3435
- * @param alertId - Alert ID
3436
- * @param update - Fields to update (status, assigned_for, reason, alert_type)
3437
- *
3438
- * @example
3439
- * ```typescript
3440
- * // Assign an alert
3441
- * await client.updateAlert("alert_123", {
3442
- * assigned_for: "analyst_user_id",
3443
- * status: "in_progress"
3444
- * });
3445
- *
3446
- * // Resolve an alert
3447
- * await client.updateAlert("alert_123", {
3448
- * status: "resolved",
3449
- * reason: "Customer verified via phone call"
3450
- * });
3451
- *
3452
- * // Escalate an alert
3453
- * await client.updateAlert("alert_123", {
3454
- * status: "escalated",
3455
- * assigned_for: "manager_user_id",
3456
- * reason: "Requires senior review - suspicious documents"
3457
- * });
3458
- * ```
3459
- *
3460
- * @remarks Console session only. This endpoint accepts a Vesant console
3461
- * (dashboard login) token, not a tenant API key; called with an API key it
3462
- * fails with `AuthenticationError` or a permission error.
3463
- */
3464
- async updateAlert(alertId, update) {
3465
- await this.request(`/api/v1/kyc/alerts/${alertId}`, {
3466
- method: "PUT",
3467
- body: JSON.stringify(update),
3468
- headers: this.getUserHeaders()
3469
- });
3470
- }
3471
3320
  // ============================================================================
3472
3321
  // KYC Preferences
3473
3322
  // ============================================================================
3474
- /**
3475
- * Get KYC preferences for the tenant
3476
- *
3477
- * @returns KYC preferences configuration
3478
- *
3479
- * @example
3480
- * ```typescript
3481
- * const prefs = await client.getPreferences();
3482
- * console.log(`Face verification required: ${prefs.is_face_verification_required}`);
3483
- * console.log(`Required documents: ${prefs.required_document_count}`);
3484
- * ```
3485
- *
3486
- * @remarks Console session only. This endpoint accepts a Vesant console
3487
- * (dashboard login) token, not a tenant API key; called with an API key it
3488
- * fails with `AuthenticationError` or a permission error.
3489
- */
3490
- async getPreferences() {
3491
- return this.request("/api/v1/kyc/preferences");
3492
- }
3493
3323
  /**
3494
3324
  * Update KYC preferences for the tenant
3495
3325
  *
3496
3326
  * @deprecated KYC preferences are managed in the Vesant console; the
3497
3327
  * platform exposes no update operation to the SDK, so this call always
3498
- * fails. Use `getPreferences()` to read them. This method will be removed
3499
- * in a future release.
3328
+ * fails. This method will be removed in a future release.
3500
3329
  *
3501
3330
  * @param update - Fields to update
3502
3331
  * @returns Updated preferences
@@ -3659,6 +3488,9 @@ var KYC_DECLINED_DESCRIPTIONS = {
3659
3488
  function isKycDocumentExpiredCallbackEvent(value) {
3660
3489
  return typeof value === "object" && value !== null && value.event === "kyc_document_expired";
3661
3490
  }
3491
+ function isKycStatusCallbackEvent(value) {
3492
+ return typeof value === "object" && value !== null && value.event === "kyc";
3493
+ }
3662
3494
  function isProfileChangeCallbackEvent(value) {
3663
3495
  return typeof value === "object" && value !== null && value.event === "profile_change";
3664
3496
  }
@@ -3956,6 +3788,6 @@ function isAmlBlockCallbackEvent(value) {
3956
3788
  return typeof value === "object" && value !== null && value.event === "aml" && value.block === true;
3957
3789
  }
3958
3790
 
3959
- export { AuthenticationError, BaseClient, CGSError, CircuitBreaker, CircuitBreakerOpenError, ComplianceBlockedError, ComplianceClient, ComplianceError, DEFAULT_CURRENCY_RATES, GeolocationClient, InMemoryDedupStore, KYC_DECLINED_DESCRIPTIONS, KycClient, NetworkError, RateLimitError, RateLimitTracker, RefreshingTokenProvider, RiskProfileClient, SDK_VERSION, ServiceUnavailableError, StaticApiKeyProvider, TaxClient, TimeoutError, ValidationError, VesantError, WebhookHandler, assessGpsIntegrity, collectAll, collectDeviceSignals, createConsoleLogger, createNextWebhookHandler, createWebhookMiddleware, decodeCipherText, generateCipherText, gpsIntegrityInputFromPosition, isAmlBlockCallbackEvent, isCipherTextExpired, isKycDocumentExpiredCallbackEvent, isProfileChangeCallbackEvent, isProfileUpdateHeld, noopLogger, paginate, probeGeolocationPermission, sdkReasons, verifyWebhookSignature };
3791
+ export { AuthenticationError, BaseClient, CGSError, CircuitBreaker, CircuitBreakerOpenError, ComplianceBlockedError, ComplianceClient, ComplianceError, DEFAULT_CURRENCY_RATES, GeolocationClient, InMemoryDedupStore, KYC_DECLINED_DESCRIPTIONS, KycClient, NetworkError, RateLimitError, RateLimitTracker, RefreshingTokenProvider, RiskProfileClient, SDK_VERSION, ServiceUnavailableError, StaticApiKeyProvider, TaxClient, TimeoutError, ValidationError, VesantError, WebhookHandler, assessGpsIntegrity, collectAll, collectDeviceSignals, createConsoleLogger, createNextWebhookHandler, createWebhookMiddleware, decodeCipherText, generateCipherText, gpsIntegrityInputFromPosition, isAmlBlockCallbackEvent, isCipherTextExpired, isKycDocumentExpiredCallbackEvent, isKycStatusCallbackEvent, isProfileChangeCallbackEvent, isProfileUpdateHeld, noopLogger, paginate, probeGeolocationPermission, sdkReasons, verifyWebhookSignature };
3960
3792
  //# sourceMappingURL=index.mjs.map
3961
3793
  //# sourceMappingURL=index.mjs.map