vesant-sdk 1.8.0-dev.2b9e28d → 1.8.0-dev.32e3a40

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 (44) hide show
  1. package/README.md +5 -3
  2. package/dist/{client-DUHC-68_.d.ts → client-4oLoc31v.d.ts} +1 -1
  3. package/dist/{client-5q4whhGu.d.mts → client-CJI8VO1i.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 +19 -3
  7. package/dist/compliance/index.js.map +1 -1
  8. package/dist/compliance/index.mjs +19 -3
  9. package/dist/compliance/index.mjs.map +1 -1
  10. package/dist/index.d.mts +3 -3
  11. package/dist/index.d.ts +3 -3
  12. package/dist/index.js +72 -14
  13. package/dist/index.js.map +1 -1
  14. package/dist/index.mjs +71 -15
  15. package/dist/index.mjs.map +1 -1
  16. package/dist/kyc/core.d.mts +2 -2
  17. package/dist/kyc/core.d.ts +2 -2
  18. package/dist/kyc/core.js +52 -11
  19. package/dist/kyc/core.js.map +1 -1
  20. package/dist/kyc/core.mjs +52 -12
  21. package/dist/kyc/core.mjs.map +1 -1
  22. package/dist/kyc/index.d.mts +177 -17
  23. package/dist/kyc/index.d.ts +177 -17
  24. package/dist/kyc/index.js +52 -11
  25. package/dist/kyc/index.js.map +1 -1
  26. package/dist/kyc/index.mjs +52 -12
  27. package/dist/kyc/index.mjs.map +1 -1
  28. package/dist/react.d.mts +21 -3
  29. package/dist/react.d.ts +21 -3
  30. package/dist/react.js +8 -1
  31. package/dist/react.js.map +1 -1
  32. package/dist/react.mjs +8 -1
  33. package/dist/react.mjs.map +1 -1
  34. package/dist/risk-profile/index.d.mts +16 -6
  35. package/dist/risk-profile/index.d.ts +16 -6
  36. package/dist/risk-profile/index.js +18 -2
  37. package/dist/risk-profile/index.js.map +1 -1
  38. package/dist/risk-profile/index.mjs +18 -3
  39. package/dist/risk-profile/index.mjs.map +1 -1
  40. package/dist/tax/index.d.mts +1 -1
  41. package/dist/tax/index.d.ts +1 -1
  42. package/dist/{types-UGyDl1fd.d.ts → types-1kI4SsKB.d.ts} +44 -1
  43. package/dist/{types-BOFaMQxI.d.mts → types-DfbnIaW_.d.mts} +44 -1
  44. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1657,17 +1657,27 @@ var RiskProfileClient = class extends BaseClient {
1657
1657
  /**
1658
1658
  * Update customer profile
1659
1659
  *
1660
+ * Omitted fields keep their stored values. When the tenant has the
1661
+ * **On Account Sensitive Action** KYC trigger enabled and the update changes
1662
+ * the customer's name, date of birth or residential address, Vesant applies
1663
+ * the other fields, holds the sensitive ones and answers `202` with a
1664
+ * {@link ProfileUpdateHeldResponse} instead of the profile. Narrow with
1665
+ * {@link isProfileUpdateHeld}, then request a `profile_change` submit link.
1666
+ *
1660
1667
  * @param profileId - Profile UUID
1661
1668
  * @param updates - Fields to update
1662
- * @returns Updated customer profile
1669
+ * @returns Updated customer profile, or the held change
1663
1670
  *
1664
1671
  * @example
1665
1672
  * ```typescript
1666
- * const updated = await client.updateProfile(profileId, {
1673
+ * const result = await client.updateProfile(profileId, {
1667
1674
  * location: 'New York, USA',
1668
1675
  * location_compliance: 'compliant',
1669
1676
  * last_recorded_activity: new Date().toISOString()
1670
1677
  * });
1678
+ * if (isProfileUpdateHeld(result)) {
1679
+ * // name / DOB / address held: start KYC with trigger_event 'profile_change'
1680
+ * }
1671
1681
  * ```
1672
1682
  */
1673
1683
  async updateProfile(profileId, updates, requestOptions) {
@@ -1707,6 +1717,11 @@ var RiskProfileClient = class extends BaseClient {
1707
1717
  }
1708
1718
  };
1709
1719
 
1720
+ // src/risk-profile/types.ts
1721
+ function isProfileUpdateHeld(result) {
1722
+ return typeof result === "object" && result !== null && result.status === "kyc_required" && result.kyc_required === true;
1723
+ }
1724
+
1710
1725
  // src/compliance/block-reasons.ts
1711
1726
  var sdkReasons = {
1712
1727
  // Jurisdiction
@@ -2237,11 +2252,12 @@ var ComplianceClient = class {
2237
2252
  if (profileResult) {
2238
2253
  profile = profileResult;
2239
2254
  if (!isBlocked && this.shouldUpdateProfile(profile, geoVerification.location.city)) {
2240
- profile = await this.riskClient.updateProfile(profile.id, {
2255
+ const updated = await this.riskClient.updateProfile(profile.id, {
2241
2256
  last_recorded_activity: (/* @__PURE__ */ new Date()).toISOString(),
2242
2257
  location: `${geoVerification.location.city}, ${geoVerification.location.country}`,
2243
2258
  location_compliance: geoVerification.is_compliant ? "compliant" : "non-compliant"
2244
2259
  }, requestOptions);
2260
+ profile = isProfileUpdateHeld(updated) ? updated.profile : updated;
2245
2261
  }
2246
2262
  } else {
2247
2263
  if (this.config.autoCreateProfiles && this.config.debug) {
@@ -3187,19 +3203,26 @@ var KycClient = class extends BaseClient {
3187
3203
  }, void 0, requestOptions);
3188
3204
  }
3189
3205
  /**
3190
- * Get a KYC request by ID
3206
+ * Get a KYC record by ID
3207
+ *
3208
+ * Works with your tenant API key. Each entry in `proofs` carries a
3209
+ * short-lived `link` for downloading that document, and `reference` holds
3210
+ * your own customer reference (the `forward_reference`).
3191
3211
  *
3192
- * @param id - KYC request ID
3193
- * @returns KYC request details including proofs and alerts
3212
+ * @param id - KYC record ID (the `kyc_id` returned by `requestKycSubmitLink`)
3213
+ * @returns KYC record including proofs (with download links) and alerts
3194
3214
  *
3195
3215
  * @example
3196
3216
  * ```typescript
3197
3217
  * const kyc = await client.getKycRequest("550e8400-e29b-41d4-a716-446655440000");
3198
3218
  * console.log(`Status: ${kyc.status}, ID Verified: ${kyc.id_verified}`);
3219
+ * kyc.proofs?.forEach(proof => console.log(`${proof.type}: ${proof.link}`));
3199
3220
  * ```
3200
3221
  */
3201
3222
  async getKycRequest(id) {
3202
- return this.request(`/api/v1/kyc/requests/${id}`);
3223
+ return this.request(`/api/v1/kyc/${encodeURIComponent(id)}`, {
3224
+ headers: this.getUserHeaders()
3225
+ });
3203
3226
  }
3204
3227
  /**
3205
3228
  * List KYC requests with filters and pagination
@@ -3216,6 +3239,10 @@ var KycClient = class extends BaseClient {
3216
3239
  * );
3217
3240
  * console.log(`Found ${requests.total} pending requests`);
3218
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.
3219
3246
  */
3220
3247
  async listKycRequests(filters, pagination) {
3221
3248
  const params = {};
@@ -3253,6 +3280,10 @@ var KycClient = class extends BaseClient {
3253
3280
  * reason: "Document expired"
3254
3281
  * });
3255
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.
3256
3287
  */
3257
3288
  async updateKycStatus(request) {
3258
3289
  await this.request("/api/v1/kyc/status", {
@@ -3289,22 +3320,24 @@ var KycClient = class extends BaseClient {
3289
3320
  /**
3290
3321
  * Get downloadable URLs for KYC proofs/documents
3291
3322
  *
3292
- * @param kycId - KYC request ID
3293
- * @returns Array of proof download URLs with expiration
3323
+ * Derived from the `proofs` of `getKycRequest`: the platform attaches a
3324
+ * short-lived download link to every proof on the KYC record, so no
3325
+ * separate endpoint is needed. Proofs without a link are omitted.
3326
+ *
3327
+ * @param kycId - KYC record ID
3328
+ * @returns Array of proof download URLs
3294
3329
  *
3295
3330
  * @example
3296
3331
  * ```typescript
3297
3332
  * const proofs = await client.getProofDownloadURLs("550e8400-e29b-41d4-a716-446655440000");
3298
3333
  * proofs.forEach(proof => {
3299
- * console.log(`${proof.type}: ${proof.url} (expires: ${proof.expires_at})`);
3334
+ * console.log(`${proof.type}: ${proof.url}`);
3300
3335
  * });
3301
3336
  * ```
3302
3337
  */
3303
3338
  async getProofDownloadURLs(kycId) {
3304
- return this.request(
3305
- `/api/v1/kyc/proofs/${kycId}`,
3306
- { headers: this.getUserHeaders() }
3307
- );
3339
+ const kyc = await this.getKycRequest(kycId);
3340
+ return (kyc.proofs ?? []).filter((proof) => typeof proof.link === "string" && proof.link !== "").map((proof) => ({ id: proof.id, type: proof.type, url: proof.link }));
3308
3341
  }
3309
3342
  // ============================================================================
3310
3343
  // KYC Overview & Statistics
@@ -3325,6 +3358,10 @@ var KycClient = class extends BaseClient {
3325
3358
  * console.log(`Total: ${overview.total}, Pending: ${overview.pending}`);
3326
3359
  * console.log(`Approved: ${overview.approved}, Rejected: ${overview.rejected}`);
3327
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.
3328
3365
  */
3329
3366
  async getOverview(fromDate, toDate) {
3330
3367
  const params = {};
@@ -3342,6 +3379,10 @@ var KycClient = class extends BaseClient {
3342
3379
  *
3343
3380
  * @param alertId - Alert ID
3344
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.
3345
3386
  */
3346
3387
  async getAlert(alertId) {
3347
3388
  return this.request(`/api/v1/kyc/alerts/${alertId}`);
@@ -3365,6 +3406,10 @@ var KycClient = class extends BaseClient {
3365
3406
  * );
3366
3407
  * console.log(`Found ${alerts.total} alerts`);
3367
3408
  * ```
3409
+ *
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.
3368
3413
  */
3369
3414
  async listAlerts(filters, pagination) {
3370
3415
  const params = {};
@@ -3411,6 +3456,10 @@ var KycClient = class extends BaseClient {
3411
3456
  * reason: "Requires senior review - suspicious documents"
3412
3457
  * });
3413
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.
3414
3463
  */
3415
3464
  async updateAlert(alertId, update) {
3416
3465
  await this.request(`/api/v1/kyc/alerts/${alertId}`, {
@@ -3433,6 +3482,10 @@ var KycClient = class extends BaseClient {
3433
3482
  * console.log(`Face verification required: ${prefs.is_face_verification_required}`);
3434
3483
  * console.log(`Required documents: ${prefs.required_document_count}`);
3435
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.
3436
3489
  */
3437
3490
  async getPreferences() {
3438
3491
  return this.request("/api/v1/kyc/preferences");
@@ -3606,6 +3659,9 @@ var KYC_DECLINED_DESCRIPTIONS = {
3606
3659
  function isKycDocumentExpiredCallbackEvent(value) {
3607
3660
  return typeof value === "object" && value !== null && value.event === "kyc_document_expired";
3608
3661
  }
3662
+ function isProfileChangeCallbackEvent(value) {
3663
+ return typeof value === "object" && value !== null && value.event === "profile_change";
3664
+ }
3609
3665
 
3610
3666
  // src/tax/client.ts
3611
3667
  var TaxClient = class extends BaseClient {
@@ -3900,6 +3956,6 @@ function isAmlBlockCallbackEvent(value) {
3900
3956
  return typeof value === "object" && value !== null && value.event === "aml" && value.block === true;
3901
3957
  }
3902
3958
 
3903
- 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, noopLogger, paginate, probeGeolocationPermission, sdkReasons, verifyWebhookSignature };
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 };
3904
3960
  //# sourceMappingURL=index.mjs.map
3905
3961
  //# sourceMappingURL=index.mjs.map