vesant-sdk 1.7.2 → 1.8.0-dev.0a33430

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 (72) hide show
  1. package/README.md +5 -3
  2. package/dist/{client-B3DCAHlg.d.ts → client-4oLoc31v.d.ts} +2 -2
  3. package/dist/{client-fy3trF2K.d.ts → client-BaUekQT8.d.ts} +32 -10
  4. package/dist/{client-D23KhWeh.d.mts → client-CJI8VO1i.d.mts} +2 -2
  5. package/dist/{client-BwXMQA2a.d.mts → client-XDEhh9VN.d.mts} +32 -10
  6. package/dist/compliance/index.d.mts +3 -3
  7. package/dist/compliance/index.d.ts +3 -3
  8. package/dist/compliance/index.js +59 -5
  9. package/dist/compliance/index.js.map +1 -1
  10. package/dist/compliance/index.mjs +59 -5
  11. package/dist/compliance/index.mjs.map +1 -1
  12. package/dist/decisions/index.js +1 -1
  13. package/dist/decisions/index.js.map +1 -1
  14. package/dist/decisions/index.mjs +1 -1
  15. package/dist/decisions/index.mjs.map +1 -1
  16. package/dist/geolocation/index.d.mts +2 -2
  17. package/dist/geolocation/index.d.ts +2 -2
  18. package/dist/geolocation/index.js +40 -2
  19. package/dist/geolocation/index.js.map +1 -1
  20. package/dist/geolocation/index.mjs +40 -2
  21. package/dist/geolocation/index.mjs.map +1 -1
  22. package/dist/{index-DSDgS09k.d.ts → index-BosFSGan.d.ts} +57 -2
  23. package/dist/{index-C3zUKydT.d.mts → index-C49a7fg2.d.mts} +57 -2
  24. package/dist/index.d.mts +6 -6
  25. package/dist/index.d.ts +6 -6
  26. package/dist/index.js +118 -16
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +116 -17
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/kyc/core.d.mts +2 -2
  31. package/dist/kyc/core.d.ts +2 -2
  32. package/dist/kyc/core.js +53 -12
  33. package/dist/kyc/core.js.map +1 -1
  34. package/dist/kyc/core.mjs +53 -13
  35. package/dist/kyc/core.mjs.map +1 -1
  36. package/dist/kyc/index.d.mts +172 -16
  37. package/dist/kyc/index.d.ts +172 -16
  38. package/dist/kyc/index.js +53 -12
  39. package/dist/kyc/index.js.map +1 -1
  40. package/dist/kyc/index.mjs +53 -13
  41. package/dist/kyc/index.mjs.map +1 -1
  42. package/dist/react.d.mts +29 -4
  43. package/dist/react.d.ts +29 -4
  44. package/dist/react.js +23 -11
  45. package/dist/react.js.map +1 -1
  46. package/dist/react.mjs +23 -11
  47. package/dist/react.mjs.map +1 -1
  48. package/dist/risk-profile/index.d.mts +16 -6
  49. package/dist/risk-profile/index.d.ts +16 -6
  50. package/dist/risk-profile/index.js +19 -3
  51. package/dist/risk-profile/index.js.map +1 -1
  52. package/dist/risk-profile/index.mjs +19 -4
  53. package/dist/risk-profile/index.mjs.map +1 -1
  54. package/dist/scores/index.js +1 -1
  55. package/dist/scores/index.js.map +1 -1
  56. package/dist/scores/index.mjs +1 -1
  57. package/dist/scores/index.mjs.map +1 -1
  58. package/dist/tax/index.d.mts +1 -1
  59. package/dist/tax/index.d.ts +1 -1
  60. package/dist/tax/index.js +1 -1
  61. package/dist/tax/index.js.map +1 -1
  62. package/dist/tax/index.mjs +1 -1
  63. package/dist/tax/index.mjs.map +1 -1
  64. package/dist/{types-UGyDl1fd.d.ts → types-1kI4SsKB.d.ts} +44 -1
  65. package/dist/{types-BOFaMQxI.d.mts → types-DfbnIaW_.d.mts} +44 -1
  66. package/dist/webhooks/index.d.mts +1 -1
  67. package/dist/webhooks/index.d.ts +1 -1
  68. package/dist/webhooks/index.js +6 -0
  69. package/dist/webhooks/index.js.map +1 -1
  70. package/dist/webhooks/index.mjs +6 -1
  71. package/dist/webhooks/index.mjs.map +1 -1
  72. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- import { P as ProfileFilters, b as ProfileListResponse, C as CustomerProfile, a as CreateProfileRequest } from '../types-UGyDl1fd.js';
1
+ import { P as ProfileFilters, b as ProfileListResponse, C as CustomerProfile, a as CreateProfileRequest } from '../types-1kI4SsKB.js';
2
2
  import { c as Reason, R as RiskLevel, P as PaginationParams } from '../types-CBQRNL-l.js';
3
3
  import { B as BaseClient, R as RequestOptions } from '../client-q9fN8Hhf.js';
4
4
 
@@ -119,14 +119,22 @@ interface Proof {
119
119
  id: string;
120
120
  kyc_id: string;
121
121
  type: ProofType;
122
- document: string;
122
+ /** Storage key. The platform never returns it; use `link` to download. */
123
+ document?: string;
123
124
  document_number?: string;
125
+ /** Document type the customer selected (e.g. `passport`). */
126
+ selected_type?: string;
127
+ /** Short-lived download URL, attached on `getKycRequest`. */
128
+ link?: string;
124
129
  created_at: string;
125
130
  }
126
131
  interface ProofDownloadURL {
132
+ /** Proof ID on the KYC record. */
133
+ id: string;
127
134
  type: ProofType;
128
135
  url: string;
129
- expires_at: string;
136
+ /** Not sent by the platform; the link itself is short-lived. */
137
+ expires_at?: string;
130
138
  }
131
139
  interface KycCustomerProfile {
132
140
  id: string;
@@ -243,6 +251,17 @@ interface EventBasedFaceVerificationReactions {
243
251
  /** @deprecated Never populated; read `data.freeze_duration_minutes` on the callback instead. */
244
252
  freeze_duration_minutes?: number;
245
253
  }
254
+ /**
255
+ * On Account Sensitive Action: hold a change to the customer's name, date of
256
+ * birth or residential address behind a full KYC verification. Configured in
257
+ * the Vesant console; off by default. See {@link ProfileUpdateHeldResponse}.
258
+ */
259
+ interface AccountSensitiveActionTrigger {
260
+ enabled: boolean;
261
+ full_name: boolean;
262
+ date_of_birth: boolean;
263
+ residential_address: boolean;
264
+ }
246
265
  /** Per-event toggles that decide when a submit-link request requires KYC. */
247
266
  interface KycVerificationTriggers {
248
267
  onboarding: boolean;
@@ -250,6 +269,16 @@ interface KycVerificationTriggers {
250
269
  first_purchase: boolean;
251
270
  /** Re-trigger verification once the customer's identity document has expired. */
252
271
  auto_trigger_on_id_expiration: boolean;
272
+ /**
273
+ * Manual KYC Verification: whether customers may start a verification
274
+ * themselves (`trigger_event: "manual"`), independent of the event
275
+ * triggers. On by default. When off, a `manual` request answers
276
+ * `kyc_required: false` with reason `KYC_NOT_REQUIRED_TRIGGER_DISABLED`;
277
+ * hide your Verification option in that case.
278
+ */
279
+ manual: boolean;
280
+ /** Hold sensitive profile changes (name, DOB, address) behind KYC. */
281
+ account_sensitive_action?: AccountSensitiveActionTrigger;
253
282
  }
254
283
  interface KycSkipOptions {
255
284
  /** Let a `manual` trigger be skipped (`can_skip` on the submit-link response). */
@@ -417,8 +446,9 @@ interface UpdateKycStatusRequest {
417
446
  }
418
447
  /**
419
448
  * Events that can trigger a KYC request. Each maps to a per-event toggle in
420
- * the tenant's KYC verification trigger preferences, except `manual` (always
421
- * required) and `login` (only for an expired identity document).
449
+ * the tenant's KYC verification trigger preferences (`manual` to the Manual
450
+ * KYC Verification toggle), except `login` (only for an expired identity
451
+ * document).
422
452
  */
423
453
  type KycTriggerEvent = 'onboarding' | 'first_withdrawal' | 'first_purchase'
424
454
  /** Aliases of `first_withdrawal` / `first_purchase` — same tenant toggles. */
@@ -429,7 +459,16 @@ type KycTriggerEvent = 'onboarding' | 'first_withdrawal' | 'first_purchase'
429
459
  * (asked, skippable — "Remind me later"), or verified with a valid document
430
460
  * (not asked). One call covers every customer.
431
461
  */
432
- | 'login';
462
+ | 'login'
463
+ /**
464
+ * The customer changed their name, date of birth or address and
465
+ * `updateProfile` answered `202` with `kyc_required: true`. Required — not
466
+ * skippable — while Vesant holds a pending change for the customer; not
467
+ * required when nothing is held or the tenant switched the trigger off.
468
+ * The verification is seeded with the requested identity and, on approval,
469
+ * releases the held change. See the `profile_change` webhook.
470
+ */
471
+ | 'profile_change';
433
472
  /**
434
473
  * Why verification is — or is not — being asked for. Codes are stable;
435
474
  * `message` is display-ready text you can show the customer as-is.
@@ -453,10 +492,14 @@ type KycRequestReasonCode =
453
492
  | 'KYC_REQUIRED_ID_EXPIRED'
454
493
  /** Verification was explicitly requested by the tenant. */
455
494
  | 'KYC_REQUIRED_MANUAL'
495
+ /** Required before a held name / date of birth / address change is applied. */
496
+ | 'KYC_REQUIRED_PROFILE_CHANGE'
456
497
  /** Not required — the customer already has an accepted verification. */
457
498
  | 'KYC_NOT_REQUIRED_ALREADY_VERIFIED'
458
499
  /** Not required — the tenant has this trigger event switched off. */
459
- | 'KYC_NOT_REQUIRED_TRIGGER_DISABLED';
500
+ | 'KYC_NOT_REQUIRED_TRIGGER_DISABLED'
501
+ /** Not required — `profile_change` was sent but Vesant holds no pending change for the customer. */
502
+ | 'KYC_NOT_REQUIRED_NO_PENDING_CHANGE';
460
503
  interface RequestKycSubmitLinkRequest {
461
504
  /** User ID to generate KYC submission link for */
462
505
  user_id: string;
@@ -467,8 +510,11 @@ interface RequestKycSubmitLinkRequest {
467
510
  /**
468
511
  * Event that triggered the KYC request. The tenant's KYC verification
469
512
  * trigger preferences decide, per event, whether KYC is required
470
- * (`kyc_required` in the response). "manual" always requires KYC and
471
- * honors the tenant's allow-skip-on-manual option (`can_skip`). "login"
513
+ * (`kyc_required` in the response). "manual" — the customer starting
514
+ * verification themselves — is governed by the tenant's Manual KYC
515
+ * Verification toggle (on by default) and honors the allow-skip-on-manual
516
+ * option (`can_skip`); when the toggle is off it answers `kyc_required:
517
+ * false` with `KYC_NOT_REQUIRED_TRIGGER_DISABLED`. "login"
472
518
  * answers for any customer state — never verified (asked, not skippable),
473
519
  * document expired (asked, skippable so you can offer "Remind me later"),
474
520
  * or verified and valid (not asked) — so a platform that gates entry on KYC
@@ -641,6 +687,79 @@ interface KycDocumentExpiredCallbackEvent {
641
687
  * signature-verified, parsed payload to {@link KycDocumentExpiredCallbackEvent}.
642
688
  */
643
689
  declare function isKycDocumentExpiredCallbackEvent(value: unknown): value is KycDocumentExpiredCallbackEvent;
690
+ /** Sensitive profile field held behind KYC by On Account Sensitive Action. */
691
+ type ProfileChangeField = 'full_name' | 'date_of_birth' | 'residential_address';
692
+ /** How a held profile change ended. */
693
+ type ProfileChangeStatus = 'approved' | 'rejected' | 'expired';
694
+ /**
695
+ * Reactions a verification fired, mirrored from the tenant's KYC alert
696
+ * configuration. Vesant holds no account state on your platform: these flags
697
+ * tell you what the tenant configured, they do not do it. Present on the
698
+ * `kyc` status callback only when a rule with reactions matched — today the
699
+ * On Account Sensitive Action rules.
700
+ */
701
+ interface KycCallbackReactions {
702
+ /** The alert rules that fired, e.g. `["profile_change_name"]`. */
703
+ events: string[];
704
+ trigger_alert: boolean;
705
+ block: boolean;
706
+ freeze_account: boolean;
707
+ /** Set when `freeze_account` is true: the tenant's default freeze window. */
708
+ freeze_duration_minutes?: number;
709
+ enforce_logout: boolean;
710
+ }
711
+ /**
712
+ * Body POSTed to your `callback_url` when a held sensitive profile change is
713
+ * settled. Signed with `X-Webhook-Signature: sha256=<hex>` (HMAC-SHA256 of the
714
+ * raw body), like every other Vesant callback.
715
+ *
716
+ * Sent once per held change: `approved` after the customer's `profile_change`
717
+ * verification was accepted and the verified values were written to the
718
+ * profile; `rejected` after it was declined and the profile was left as it
719
+ * was; `expired` when no verification arrived within the hold window (seven
720
+ * days by default). On `rejected`, show the customer `declined_reasons` — this
721
+ * is the "KYC decline message" for the change.
722
+ */
723
+ interface ProfileChangeCallbackEvent {
724
+ /** Always `"profile_change"` — dispatch on this. */
725
+ event: 'profile_change';
726
+ /** Your customer identifier (the `user_id` you supplied). */
727
+ reference: string;
728
+ /** The pending change id returned by `updateProfile`. */
729
+ resource_id: string;
730
+ status: ProfileChangeStatus;
731
+ /** First decline message, `rejected` only. */
732
+ declined_reason?: string;
733
+ /** Structured decline, `rejected` only. */
734
+ declined_reasons?: Reason[];
735
+ data: {
736
+ customer_id: string;
737
+ profile_id: string;
738
+ pending_change_id: string;
739
+ /** The verification that settled the change; empty if it expired unverified. */
740
+ kyc_id: string;
741
+ changed_fields: ProfileChangeField[];
742
+ /** What the customer asked for. */
743
+ requested_values: Partial<Record<ProfileChangeField, string>>;
744
+ /** What the profile held before the change. */
745
+ previous_values: Partial<Record<ProfileChangeField, string>>;
746
+ /**
747
+ * What the document verified, `approved` only. The verified values are
748
+ * what was written to the profile — when they differ from
749
+ * `requested_values` (`values_match: false`) the document wins and a
750
+ * review alert is raised in the Vesant console.
751
+ */
752
+ verified_values?: Partial<Record<ProfileChangeField, string>>;
753
+ values_match?: boolean | null;
754
+ expires_at: string;
755
+ resolved_at?: string | null;
756
+ };
757
+ }
758
+ /**
759
+ * Type guard for the held-profile-change webhook. Narrows an already
760
+ * signature-verified, parsed payload to {@link ProfileChangeCallbackEvent}.
761
+ */
762
+ declare function isProfileChangeCallbackEvent(value: unknown): value is ProfileChangeCallbackEvent;
644
763
  /** Device class detected by the SDK (purely client-side — server doesn't care). */
645
764
  type EventBasedFaceVerificationDeviceType = 'mobile' | 'desktop';
646
765
  interface CreateEventBasedFaceVerificationSessionResponse {
@@ -1145,15 +1264,20 @@ declare class KycClient extends BaseClient {
1145
1264
  */
1146
1265
  submitVerification(request: DocumentVerificationRequest, requestOptions?: RequestOptions): Promise<DocumentVerificationResponse>;
1147
1266
  /**
1148
- * Get a KYC request by ID
1267
+ * Get a KYC record by ID
1268
+ *
1269
+ * Works with your tenant API key. Each entry in `proofs` carries a
1270
+ * short-lived `link` for downloading that document, and `reference` holds
1271
+ * your own customer reference (the `forward_reference`).
1149
1272
  *
1150
- * @param id - KYC request ID
1151
- * @returns KYC request details including proofs and alerts
1273
+ * @param id - KYC record ID (the `kyc_id` returned by `requestKycSubmitLink`)
1274
+ * @returns KYC record including proofs (with download links) and alerts
1152
1275
  *
1153
1276
  * @example
1154
1277
  * ```typescript
1155
1278
  * const kyc = await client.getKycRequest("550e8400-e29b-41d4-a716-446655440000");
1156
1279
  * console.log(`Status: ${kyc.status}, ID Verified: ${kyc.id_verified}`);
1280
+ * kyc.proofs?.forEach(proof => console.log(`${proof.type}: ${proof.link}`));
1157
1281
  * ```
1158
1282
  */
1159
1283
  getKycRequest(id: string): Promise<KycRequest>;
@@ -1172,6 +1296,10 @@ declare class KycClient extends BaseClient {
1172
1296
  * );
1173
1297
  * console.log(`Found ${requests.total} pending requests`);
1174
1298
  * ```
1299
+ *
1300
+ * @remarks Console session only. This endpoint accepts a Vesant console
1301
+ * (dashboard login) token, not a tenant API key; called with an API key it
1302
+ * fails with `AuthenticationError` or a permission error.
1175
1303
  */
1176
1304
  listKycRequests(filters?: KycRequestFilters, pagination?: PaginationParams): Promise<KycRequestListResponse>;
1177
1305
  /**
@@ -1195,6 +1323,10 @@ declare class KycClient extends BaseClient {
1195
1323
  * reason: "Document expired"
1196
1324
  * });
1197
1325
  * ```
1326
+ *
1327
+ * @remarks Console session only. This endpoint accepts a Vesant console
1328
+ * (dashboard login) token, not a tenant API key; called with an API key it
1329
+ * fails with `AuthenticationError` or a permission error.
1198
1330
  */
1199
1331
  updateKycStatus(request: UpdateKycStatusRequest): Promise<void>;
1200
1332
  /**
@@ -1219,14 +1351,18 @@ declare class KycClient extends BaseClient {
1219
1351
  /**
1220
1352
  * Get downloadable URLs for KYC proofs/documents
1221
1353
  *
1222
- * @param kycId - KYC request ID
1223
- * @returns Array of proof download URLs with expiration
1354
+ * Derived from the `proofs` of `getKycRequest`: the platform attaches a
1355
+ * short-lived download link to every proof on the KYC record, so no
1356
+ * separate endpoint is needed. Proofs without a link are omitted.
1357
+ *
1358
+ * @param kycId - KYC record ID
1359
+ * @returns Array of proof download URLs
1224
1360
  *
1225
1361
  * @example
1226
1362
  * ```typescript
1227
1363
  * const proofs = await client.getProofDownloadURLs("550e8400-e29b-41d4-a716-446655440000");
1228
1364
  * proofs.forEach(proof => {
1229
- * console.log(`${proof.type}: ${proof.url} (expires: ${proof.expires_at})`);
1365
+ * console.log(`${proof.type}: ${proof.url}`);
1230
1366
  * });
1231
1367
  * ```
1232
1368
  */
@@ -1247,6 +1383,10 @@ declare class KycClient extends BaseClient {
1247
1383
  * console.log(`Total: ${overview.total}, Pending: ${overview.pending}`);
1248
1384
  * console.log(`Approved: ${overview.approved}, Rejected: ${overview.rejected}`);
1249
1385
  * ```
1386
+ *
1387
+ * @remarks Console session only. This endpoint accepts a Vesant console
1388
+ * (dashboard login) token, not a tenant API key; called with an API key it
1389
+ * fails with `AuthenticationError` or a permission error.
1250
1390
  */
1251
1391
  getOverview(fromDate?: string, toDate?: string): Promise<KycOverview>;
1252
1392
  /**
@@ -1254,6 +1394,10 @@ declare class KycClient extends BaseClient {
1254
1394
  *
1255
1395
  * @param alertId - Alert ID
1256
1396
  * @returns Alert details
1397
+ *
1398
+ * @remarks Console session only. This endpoint accepts a Vesant console
1399
+ * (dashboard login) token, not a tenant API key; called with an API key it
1400
+ * fails with `AuthenticationError` or a permission error.
1257
1401
  */
1258
1402
  getAlert(alertId: string): Promise<KycAlert>;
1259
1403
  /**
@@ -1275,6 +1419,10 @@ declare class KycClient extends BaseClient {
1275
1419
  * );
1276
1420
  * console.log(`Found ${alerts.total} alerts`);
1277
1421
  * ```
1422
+ *
1423
+ * @remarks Console session only. This endpoint accepts a Vesant console
1424
+ * (dashboard login) token, not a tenant API key; called with an API key it
1425
+ * fails with `AuthenticationError` or a permission error.
1278
1426
  */
1279
1427
  listAlerts(filters?: KycAlertFilters, pagination?: PaginationParams): Promise<KycAlertListResponse>;
1280
1428
  /**
@@ -1304,6 +1452,10 @@ declare class KycClient extends BaseClient {
1304
1452
  * reason: "Requires senior review - suspicious documents"
1305
1453
  * });
1306
1454
  * ```
1455
+ *
1456
+ * @remarks Console session only. This endpoint accepts a Vesant console
1457
+ * (dashboard login) token, not a tenant API key; called with an API key it
1458
+ * fails with `AuthenticationError` or a permission error.
1307
1459
  */
1308
1460
  updateAlert(alertId: string, update: UpdateKycAlertRequest): Promise<void>;
1309
1461
  /**
@@ -1317,6 +1469,10 @@ declare class KycClient extends BaseClient {
1317
1469
  * console.log(`Face verification required: ${prefs.is_face_verification_required}`);
1318
1470
  * console.log(`Required documents: ${prefs.required_document_count}`);
1319
1471
  * ```
1472
+ *
1473
+ * @remarks Console session only. This endpoint accepts a Vesant console
1474
+ * (dashboard login) token, not a tenant API key; called with an API key it
1475
+ * fails with `AuthenticationError` or a permission error.
1320
1476
  */
1321
1477
  getPreferences(): Promise<KycPreferences>;
1322
1478
  /**
@@ -1415,4 +1571,4 @@ declare class KycClient extends BaseClient {
1415
1571
  createCustomerProfile(profile: CreateProfileRequest): Promise<CustomerProfile>;
1416
1572
  }
1417
1573
 
1418
- export { type CheckKycStatusRequest, type CheckKycStatusResponse, CreateProfileRequest as CreateCustomerProfileRequest, type CreateEventBasedFaceVerificationSessionRequest, type CreateEventBasedFaceVerificationSessionResponse, CustomerProfile, ProfileFilters as CustomerProfileFilters, ProfileListResponse as CustomerProfileListResponse, type DocumentType, type DocumentVerificationRequest, type DocumentVerificationResponse, type EventBasedFaceVerificationCallback, type EventBasedFaceVerificationDeviceType, type EventBasedFaceVerificationEvent, type EventBasedFaceVerificationFrequencyTrigger, type EventBasedFaceVerificationReactionResult, type EventBasedFaceVerificationReactions, type EventBasedFaceVerificationThresholdTrigger, type EventBasedFaceVerificationTriggers, type FaceProof, KYC_DECLINED_DESCRIPTIONS, type KycAlert, type KycAlertFilters, type KycAlertListResponse, type KycAlertStatus, type KycAlertType, KycClient, type KycClientConfig, type KycCustomerData, type KycCustomerProfile, type KycDeclinedCode, type KycDisclosureConsent, type KycDocumentExpiredCallbackEvent, type KycHandoffSession, type KycOtherReason, type KycOverview, type KycPagination, type KycPreferences, type KycRequest, type KycRequestFilters, type KycRequestListResponse, type KycRequestReason, type KycRequestReasonCode, type KycSkipOptions, type KycStatus, type KycTriggerEvent, type KycVerificationTriggers, type Name, PaginationParams, type Proof, type ProofDownloadURL, type ProofType, type RequestAdditionalDocumentsRequest, type RequestKycSubmitLinkRequest, type RequestKycSubmitLinkResponse, RiskLevel, type SubmitEventBasedFaceVerificationSessionRequest, type SubmittedDocument, type SupportedAddressDocumentType, type SupportedDocumentType, type UpdateKycAlertRequest, type UpdateKycPreferencesRequest, type UpdateKycStatusRequest, type UseKycAlertsOptions, type UseKycAlertsResult, type UseKycOverviewOptions, type UseKycOverviewResult, type UseKycPreferencesResult, type UseKycRequestsOptions, type UseKycRequestsResult, type UseKycSubmissionOptions, type UseKycSubmissionResult, isKycDocumentExpiredCallbackEvent };
1574
+ export { type AccountSensitiveActionTrigger, type CheckKycStatusRequest, type CheckKycStatusResponse, CreateProfileRequest as CreateCustomerProfileRequest, type CreateEventBasedFaceVerificationSessionRequest, type CreateEventBasedFaceVerificationSessionResponse, CustomerProfile, ProfileFilters as CustomerProfileFilters, ProfileListResponse as CustomerProfileListResponse, type DocumentType, type DocumentVerificationRequest, type DocumentVerificationResponse, type EventBasedFaceVerificationCallback, type EventBasedFaceVerificationDeviceType, type EventBasedFaceVerificationEvent, type EventBasedFaceVerificationFrequencyTrigger, type EventBasedFaceVerificationReactionResult, type EventBasedFaceVerificationReactions, type EventBasedFaceVerificationThresholdTrigger, type EventBasedFaceVerificationTriggers, type FaceProof, KYC_DECLINED_DESCRIPTIONS, type KycAlert, type KycAlertFilters, type KycAlertListResponse, type KycAlertStatus, type KycAlertType, type KycCallbackReactions, KycClient, type KycClientConfig, type KycCustomerData, type KycCustomerProfile, type KycDeclinedCode, type KycDisclosureConsent, type KycDocumentExpiredCallbackEvent, type KycHandoffSession, type KycOtherReason, type KycOverview, type KycPagination, type KycPreferences, type KycRequest, type KycRequestFilters, type KycRequestListResponse, type KycRequestReason, type KycRequestReasonCode, type KycSkipOptions, type KycStatus, type KycTriggerEvent, type KycVerificationTriggers, type Name, PaginationParams, type ProfileChangeCallbackEvent, type ProfileChangeField, type ProfileChangeStatus, type Proof, type ProofDownloadURL, type ProofType, type RequestAdditionalDocumentsRequest, type RequestKycSubmitLinkRequest, type RequestKycSubmitLinkResponse, RiskLevel, type SubmitEventBasedFaceVerificationSessionRequest, type SubmittedDocument, type SupportedAddressDocumentType, type SupportedDocumentType, type UpdateKycAlertRequest, type UpdateKycPreferencesRequest, type UpdateKycStatusRequest, type UseKycAlertsOptions, type UseKycAlertsResult, type UseKycOverviewOptions, type UseKycOverviewResult, type UseKycPreferencesResult, type UseKycRequestsOptions, type UseKycRequestsResult, type UseKycSubmissionOptions, type UseKycSubmissionResult, isKycDocumentExpiredCallbackEvent, isProfileChangeCallbackEvent };
package/dist/kyc/index.js CHANGED
@@ -229,7 +229,7 @@ function createConsoleLogger() {
229
229
  }
230
230
 
231
231
  // src/core/version.ts
232
- var SDK_VERSION = "1.7.2";
232
+ var SDK_VERSION = "1.8.0";
233
233
 
234
234
  // src/shared/browser-utils.ts
235
235
  function generateUUID() {
@@ -892,19 +892,26 @@ var KycClient = class extends BaseClient {
892
892
  }, void 0, requestOptions);
893
893
  }
894
894
  /**
895
- * Get a KYC request by ID
895
+ * Get a KYC record by ID
896
896
  *
897
- * @param id - KYC request ID
898
- * @returns KYC request details including proofs and alerts
897
+ * Works with your tenant API key. Each entry in `proofs` carries a
898
+ * short-lived `link` for downloading that document, and `reference` holds
899
+ * your own customer reference (the `forward_reference`).
900
+ *
901
+ * @param id - KYC record ID (the `kyc_id` returned by `requestKycSubmitLink`)
902
+ * @returns KYC record including proofs (with download links) and alerts
899
903
  *
900
904
  * @example
901
905
  * ```typescript
902
906
  * const kyc = await client.getKycRequest("550e8400-e29b-41d4-a716-446655440000");
903
907
  * console.log(`Status: ${kyc.status}, ID Verified: ${kyc.id_verified}`);
908
+ * kyc.proofs?.forEach(proof => console.log(`${proof.type}: ${proof.link}`));
904
909
  * ```
905
910
  */
906
911
  async getKycRequest(id) {
907
- return this.request(`/api/v1/kyc/requests/${id}`);
912
+ return this.request(`/api/v1/kyc/${encodeURIComponent(id)}`, {
913
+ headers: this.getUserHeaders()
914
+ });
908
915
  }
909
916
  /**
910
917
  * List KYC requests with filters and pagination
@@ -921,6 +928,10 @@ var KycClient = class extends BaseClient {
921
928
  * );
922
929
  * console.log(`Found ${requests.total} pending requests`);
923
930
  * ```
931
+ *
932
+ * @remarks Console session only. This endpoint accepts a Vesant console
933
+ * (dashboard login) token, not a tenant API key; called with an API key it
934
+ * fails with `AuthenticationError` or a permission error.
924
935
  */
925
936
  async listKycRequests(filters, pagination) {
926
937
  const params = {};
@@ -958,6 +969,10 @@ var KycClient = class extends BaseClient {
958
969
  * reason: "Document expired"
959
970
  * });
960
971
  * ```
972
+ *
973
+ * @remarks Console session only. This endpoint accepts a Vesant console
974
+ * (dashboard login) token, not a tenant API key; called with an API key it
975
+ * fails with `AuthenticationError` or a permission error.
961
976
  */
962
977
  async updateKycStatus(request) {
963
978
  await this.request("/api/v1/kyc/status", {
@@ -994,22 +1009,24 @@ var KycClient = class extends BaseClient {
994
1009
  /**
995
1010
  * Get downloadable URLs for KYC proofs/documents
996
1011
  *
997
- * @param kycId - KYC request ID
998
- * @returns Array of proof download URLs with expiration
1012
+ * Derived from the `proofs` of `getKycRequest`: the platform attaches a
1013
+ * short-lived download link to every proof on the KYC record, so no
1014
+ * separate endpoint is needed. Proofs without a link are omitted.
1015
+ *
1016
+ * @param kycId - KYC record ID
1017
+ * @returns Array of proof download URLs
999
1018
  *
1000
1019
  * @example
1001
1020
  * ```typescript
1002
1021
  * const proofs = await client.getProofDownloadURLs("550e8400-e29b-41d4-a716-446655440000");
1003
1022
  * proofs.forEach(proof => {
1004
- * console.log(`${proof.type}: ${proof.url} (expires: ${proof.expires_at})`);
1023
+ * console.log(`${proof.type}: ${proof.url}`);
1005
1024
  * });
1006
1025
  * ```
1007
1026
  */
1008
1027
  async getProofDownloadURLs(kycId) {
1009
- return this.request(
1010
- `/api/v1/kyc/proofs/${kycId}`,
1011
- { headers: this.getUserHeaders() }
1012
- );
1028
+ const kyc = await this.getKycRequest(kycId);
1029
+ return (kyc.proofs ?? []).filter((proof) => typeof proof.link === "string" && proof.link !== "").map((proof) => ({ id: proof.id, type: proof.type, url: proof.link }));
1013
1030
  }
1014
1031
  // ============================================================================
1015
1032
  // KYC Overview & Statistics
@@ -1030,6 +1047,10 @@ var KycClient = class extends BaseClient {
1030
1047
  * console.log(`Total: ${overview.total}, Pending: ${overview.pending}`);
1031
1048
  * console.log(`Approved: ${overview.approved}, Rejected: ${overview.rejected}`);
1032
1049
  * ```
1050
+ *
1051
+ * @remarks Console session only. This endpoint accepts a Vesant console
1052
+ * (dashboard login) token, not a tenant API key; called with an API key it
1053
+ * fails with `AuthenticationError` or a permission error.
1033
1054
  */
1034
1055
  async getOverview(fromDate, toDate) {
1035
1056
  const params = {};
@@ -1047,6 +1068,10 @@ var KycClient = class extends BaseClient {
1047
1068
  *
1048
1069
  * @param alertId - Alert ID
1049
1070
  * @returns Alert details
1071
+ *
1072
+ * @remarks Console session only. This endpoint accepts a Vesant console
1073
+ * (dashboard login) token, not a tenant API key; called with an API key it
1074
+ * fails with `AuthenticationError` or a permission error.
1050
1075
  */
1051
1076
  async getAlert(alertId) {
1052
1077
  return this.request(`/api/v1/kyc/alerts/${alertId}`);
@@ -1070,6 +1095,10 @@ var KycClient = class extends BaseClient {
1070
1095
  * );
1071
1096
  * console.log(`Found ${alerts.total} alerts`);
1072
1097
  * ```
1098
+ *
1099
+ * @remarks Console session only. This endpoint accepts a Vesant console
1100
+ * (dashboard login) token, not a tenant API key; called with an API key it
1101
+ * fails with `AuthenticationError` or a permission error.
1073
1102
  */
1074
1103
  async listAlerts(filters, pagination) {
1075
1104
  const params = {};
@@ -1116,6 +1145,10 @@ var KycClient = class extends BaseClient {
1116
1145
  * reason: "Requires senior review - suspicious documents"
1117
1146
  * });
1118
1147
  * ```
1148
+ *
1149
+ * @remarks Console session only. This endpoint accepts a Vesant console
1150
+ * (dashboard login) token, not a tenant API key; called with an API key it
1151
+ * fails with `AuthenticationError` or a permission error.
1119
1152
  */
1120
1153
  async updateAlert(alertId, update) {
1121
1154
  await this.request(`/api/v1/kyc/alerts/${alertId}`, {
@@ -1138,6 +1171,10 @@ var KycClient = class extends BaseClient {
1138
1171
  * console.log(`Face verification required: ${prefs.is_face_verification_required}`);
1139
1172
  * console.log(`Required documents: ${prefs.required_document_count}`);
1140
1173
  * ```
1174
+ *
1175
+ * @remarks Console session only. This endpoint accepts a Vesant console
1176
+ * (dashboard login) token, not a tenant API key; called with an API key it
1177
+ * fails with `AuthenticationError` or a permission error.
1141
1178
  */
1142
1179
  async getPreferences() {
1143
1180
  return this.request("/api/v1/kyc/preferences");
@@ -1311,9 +1348,13 @@ var KYC_DECLINED_DESCRIPTIONS = {
1311
1348
  function isKycDocumentExpiredCallbackEvent(value) {
1312
1349
  return typeof value === "object" && value !== null && value.event === "kyc_document_expired";
1313
1350
  }
1351
+ function isProfileChangeCallbackEvent(value) {
1352
+ return typeof value === "object" && value !== null && value.event === "profile_change";
1353
+ }
1314
1354
 
1315
1355
  exports.KYC_DECLINED_DESCRIPTIONS = KYC_DECLINED_DESCRIPTIONS;
1316
1356
  exports.KycClient = KycClient;
1317
1357
  exports.isKycDocumentExpiredCallbackEvent = isKycDocumentExpiredCallbackEvent;
1358
+ exports.isProfileChangeCallbackEvent = isProfileChangeCallbackEvent;
1318
1359
  //# sourceMappingURL=index.js.map
1319
1360
  //# sourceMappingURL=index.js.map