vesant-sdk 1.8.0-dev.d4d3b0d → 1.8.0-dev.d8b25c5

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 (50) hide show
  1. package/README.md +1 -3
  2. package/dist/compliance/index.js +7 -6
  3. package/dist/compliance/index.js.map +1 -1
  4. package/dist/compliance/index.mjs +7 -6
  5. package/dist/compliance/index.mjs.map +1 -1
  6. package/dist/decisions/index.js +7 -6
  7. package/dist/decisions/index.js.map +1 -1
  8. package/dist/decisions/index.mjs +7 -6
  9. package/dist/decisions/index.mjs.map +1 -1
  10. package/dist/geolocation/index.js +7 -6
  11. package/dist/geolocation/index.js.map +1 -1
  12. package/dist/geolocation/index.mjs +7 -6
  13. package/dist/geolocation/index.mjs.map +1 -1
  14. package/dist/index.d.mts +1 -1
  15. package/dist/index.d.ts +1 -1
  16. package/dist/index.js +10 -182
  17. package/dist/index.js.map +1 -1
  18. package/dist/index.mjs +10 -182
  19. package/dist/index.mjs.map +1 -1
  20. package/dist/kyc/core.d.mts +1 -1
  21. package/dist/kyc/core.d.ts +1 -1
  22. package/dist/kyc/core.js +10 -182
  23. package/dist/kyc/core.js.map +1 -1
  24. package/dist/kyc/core.mjs +10 -182
  25. package/dist/kyc/core.mjs.map +1 -1
  26. package/dist/kyc/index.d.mts +4 -204
  27. package/dist/kyc/index.d.ts +4 -204
  28. package/dist/kyc/index.js +10 -182
  29. package/dist/kyc/index.js.map +1 -1
  30. package/dist/kyc/index.mjs +10 -182
  31. package/dist/kyc/index.mjs.map +1 -1
  32. package/dist/react.d.mts +4 -120
  33. package/dist/react.d.ts +4 -120
  34. package/dist/react.js +0 -185
  35. package/dist/react.js.map +1 -1
  36. package/dist/react.mjs +1 -183
  37. package/dist/react.mjs.map +1 -1
  38. package/dist/risk-profile/index.js +7 -6
  39. package/dist/risk-profile/index.js.map +1 -1
  40. package/dist/risk-profile/index.mjs +7 -6
  41. package/dist/risk-profile/index.mjs.map +1 -1
  42. package/dist/scores/index.js +7 -6
  43. package/dist/scores/index.js.map +1 -1
  44. package/dist/scores/index.mjs +7 -6
  45. package/dist/scores/index.mjs.map +1 -1
  46. package/dist/tax/index.js +7 -6
  47. package/dist/tax/index.js.map +1 -1
  48. package/dist/tax/index.mjs +7 -6
  49. package/dist/tax/index.mjs.map +1 -1
  50. 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
  *
@@ -3407,9 +3295,8 @@ var KycClient = class extends BaseClient {
3407
3295
  * console.log(`Found ${alerts.total} alerts`);
3408
3296
  * ```
3409
3297
  *
3410
- * @remarks Console session only. This endpoint accepts a Vesant console
3411
- * (dashboard login) token, not a tenant API key; called with an API key it
3412
- * fails with `AuthenticationError` or a permission error.
3298
+ * @remarks Works with a tenant API key and returns the alerts raised for
3299
+ * your tenant's customers.
3413
3300
  */
3414
3301
  async listAlerts(filters, pagination) {
3415
3302
  const params = {};
@@ -3429,74 +3316,15 @@ var KycClient = class extends BaseClient {
3429
3316
  `/api/v1/kyc/alerts${this.buildQueryString(params)}`
3430
3317
  );
3431
3318
  }
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
3319
  // ============================================================================
3472
3320
  // KYC Preferences
3473
3321
  // ============================================================================
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
3322
  /**
3494
3323
  * Update KYC preferences for the tenant
3495
3324
  *
3496
3325
  * @deprecated KYC preferences are managed in the Vesant console; the
3497
3326
  * 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.
3327
+ * fails. This method will be removed in a future release.
3500
3328
  *
3501
3329
  * @param update - Fields to update
3502
3330
  * @returns Updated preferences