vesant-sdk 1.8.0-dev.31d63f0 → 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
@@ -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,18 @@ 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 and of their status. On by default. When on, a `manual`
276
+ * request always returns a link — an already verified customer included.
277
+ * When off, it answers `kyc_required: false` with reason
278
+ * `KYC_NOT_REQUIRED_TRIGGER_DISABLED`; hide your Verification option in
279
+ * that case.
280
+ */
281
+ manual: boolean;
282
+ /** Hold sensitive profile changes (name, DOB, address) behind KYC. */
283
+ account_sensitive_action?: AccountSensitiveActionTrigger;
253
284
  }
254
285
  interface KycSkipOptions {
255
286
  /** Let a `manual` trigger be skipped (`can_skip` on the submit-link response). */
@@ -417,8 +448,9 @@ interface UpdateKycStatusRequest {
417
448
  }
418
449
  /**
419
450
  * 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).
451
+ * the tenant's KYC verification trigger preferences (`manual` to the Manual
452
+ * KYC Verification toggle), except `login` (only for an expired identity
453
+ * document).
422
454
  */
423
455
  type KycTriggerEvent = 'onboarding' | 'first_withdrawal' | 'first_purchase'
424
456
  /** Aliases of `first_withdrawal` / `first_purchase` — same tenant toggles. */
@@ -429,7 +461,16 @@ type KycTriggerEvent = 'onboarding' | 'first_withdrawal' | 'first_purchase'
429
461
  * (asked, skippable — "Remind me later"), or verified with a valid document
430
462
  * (not asked). One call covers every customer.
431
463
  */
432
- | 'login';
464
+ | 'login'
465
+ /**
466
+ * The customer changed their name, date of birth or address and
467
+ * `updateProfile` answered `202` with `kyc_required: true`. Required — not
468
+ * skippable — while Vesant holds a pending change for the customer; not
469
+ * required when nothing is held or the tenant switched the trigger off.
470
+ * The verification is seeded with the requested identity and, on approval,
471
+ * releases the held change. See the `profile_change` webhook.
472
+ */
473
+ | 'profile_change';
433
474
  /**
434
475
  * Why verification is — or is not — being asked for. Codes are stable;
435
476
  * `message` is display-ready text you can show the customer as-is.
@@ -453,10 +494,14 @@ type KycRequestReasonCode =
453
494
  | 'KYC_REQUIRED_ID_EXPIRED'
454
495
  /** Verification was explicitly requested by the tenant. */
455
496
  | 'KYC_REQUIRED_MANUAL'
497
+ /** Required before a held name / date of birth / address change is applied. */
498
+ | 'KYC_REQUIRED_PROFILE_CHANGE'
456
499
  /** Not required — the customer already has an accepted verification. */
457
500
  | 'KYC_NOT_REQUIRED_ALREADY_VERIFIED'
458
501
  /** Not required — the tenant has this trigger event switched off. */
459
- | 'KYC_NOT_REQUIRED_TRIGGER_DISABLED';
502
+ | 'KYC_NOT_REQUIRED_TRIGGER_DISABLED'
503
+ /** Not required — `profile_change` was sent but Vesant holds no pending change for the customer. */
504
+ | 'KYC_NOT_REQUIRED_NO_PENDING_CHANGE';
460
505
  interface RequestKycSubmitLinkRequest {
461
506
  /** User ID to generate KYC submission link for */
462
507
  user_id: string;
@@ -467,8 +512,12 @@ interface RequestKycSubmitLinkRequest {
467
512
  /**
468
513
  * Event that triggered the KYC request. The tenant's KYC verification
469
514
  * 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"
515
+ * (`kyc_required` in the response). "manual" — the customer starting
516
+ * verification themselves — is governed by the tenant's Manual KYC
517
+ * Verification toggle (on by default): when on it always returns a link,
518
+ * even for an already verified customer, and honors the
519
+ * allow-skip-on-manual option (`can_skip`); when off it answers
520
+ * `kyc_required: false` with `KYC_NOT_REQUIRED_TRIGGER_DISABLED`. "login"
472
521
  * answers for any customer state — never verified (asked, not skippable),
473
522
  * document expired (asked, skippable so you can offer "Remind me later"),
474
523
  * or verified and valid (not asked) — so a platform that gates entry on KYC
@@ -593,7 +642,8 @@ interface RequestKycSubmitLinkResponse {
593
642
  * Whether the user may skip verification. `true` for
594
643
  * `trigger_event: "manual"` when the tenant enables allow-skip-on-manual,
595
644
  * for `"login"` when an expired identity document triggered the request
596
- * (offer "Remind me later"), and when the customer is already verified.
645
+ * (offer "Remind me later"), and when the customer is already verified
646
+ * (except on `"manual"`, which always issues a link while enabled).
597
647
  * Always `false` at `"withdrawal"` / `"purchase"` — that is where a
598
648
  * postponed re-verification becomes mandatory.
599
649
  */
@@ -641,6 +691,79 @@ interface KycDocumentExpiredCallbackEvent {
641
691
  * signature-verified, parsed payload to {@link KycDocumentExpiredCallbackEvent}.
642
692
  */
643
693
  declare function isKycDocumentExpiredCallbackEvent(value: unknown): value is KycDocumentExpiredCallbackEvent;
694
+ /** Sensitive profile field held behind KYC by On Account Sensitive Action. */
695
+ type ProfileChangeField = 'full_name' | 'date_of_birth' | 'residential_address';
696
+ /** How a held profile change ended. */
697
+ type ProfileChangeStatus = 'approved' | 'rejected' | 'expired';
698
+ /**
699
+ * Reactions a verification fired, mirrored from the tenant's KYC alert
700
+ * configuration. Vesant holds no account state on your platform: these flags
701
+ * tell you what the tenant configured, they do not do it. Present on the
702
+ * `kyc` status callback only when a rule with reactions matched — today the
703
+ * On Account Sensitive Action rules.
704
+ */
705
+ interface KycCallbackReactions {
706
+ /** The alert rules that fired, e.g. `["profile_change_name"]`. */
707
+ events: string[];
708
+ trigger_alert: boolean;
709
+ block: boolean;
710
+ freeze_account: boolean;
711
+ /** Set when `freeze_account` is true: the tenant's default freeze window. */
712
+ freeze_duration_minutes?: number;
713
+ enforce_logout: boolean;
714
+ }
715
+ /**
716
+ * Body POSTed to your `callback_url` when a held sensitive profile change is
717
+ * settled. Signed with `X-Webhook-Signature: sha256=<hex>` (HMAC-SHA256 of the
718
+ * raw body), like every other Vesant callback.
719
+ *
720
+ * Sent once per held change: `approved` after the customer's `profile_change`
721
+ * verification was accepted and the verified values were written to the
722
+ * profile; `rejected` after it was declined and the profile was left as it
723
+ * was; `expired` when no verification arrived within the hold window (seven
724
+ * days by default). On `rejected`, show the customer `declined_reasons` — this
725
+ * is the "KYC decline message" for the change.
726
+ */
727
+ interface ProfileChangeCallbackEvent {
728
+ /** Always `"profile_change"` — dispatch on this. */
729
+ event: 'profile_change';
730
+ /** Your customer identifier (the `user_id` you supplied). */
731
+ reference: string;
732
+ /** The pending change id returned by `updateProfile`. */
733
+ resource_id: string;
734
+ status: ProfileChangeStatus;
735
+ /** First decline message, `rejected` only. */
736
+ declined_reason?: string;
737
+ /** Structured decline, `rejected` only. */
738
+ declined_reasons?: Reason[];
739
+ data: {
740
+ customer_id: string;
741
+ profile_id: string;
742
+ pending_change_id: string;
743
+ /** The verification that settled the change; empty if it expired unverified. */
744
+ kyc_id: string;
745
+ changed_fields: ProfileChangeField[];
746
+ /** What the customer asked for. */
747
+ requested_values: Partial<Record<ProfileChangeField, string>>;
748
+ /** What the profile held before the change. */
749
+ previous_values: Partial<Record<ProfileChangeField, string>>;
750
+ /**
751
+ * What the document verified, `approved` only. The verified values are
752
+ * what was written to the profile — when they differ from
753
+ * `requested_values` (`values_match: false`) the document wins and a
754
+ * review alert is raised in the Vesant console.
755
+ */
756
+ verified_values?: Partial<Record<ProfileChangeField, string>>;
757
+ values_match?: boolean | null;
758
+ expires_at: string;
759
+ resolved_at?: string | null;
760
+ };
761
+ }
762
+ /**
763
+ * Type guard for the held-profile-change webhook. Narrows an already
764
+ * signature-verified, parsed payload to {@link ProfileChangeCallbackEvent}.
765
+ */
766
+ declare function isProfileChangeCallbackEvent(value: unknown): value is ProfileChangeCallbackEvent;
644
767
  /** Device class detected by the SDK (purely client-side — server doesn't care). */
645
768
  type EventBasedFaceVerificationDeviceType = 'mobile' | 'desktop';
646
769
  interface CreateEventBasedFaceVerificationSessionResponse {
@@ -1145,15 +1268,20 @@ declare class KycClient extends BaseClient {
1145
1268
  */
1146
1269
  submitVerification(request: DocumentVerificationRequest, requestOptions?: RequestOptions): Promise<DocumentVerificationResponse>;
1147
1270
  /**
1148
- * Get a KYC request by ID
1271
+ * Get a KYC record by ID
1272
+ *
1273
+ * Works with your tenant API key. Each entry in `proofs` carries a
1274
+ * short-lived `link` for downloading that document, and `reference` holds
1275
+ * your own customer reference (the `forward_reference`).
1149
1276
  *
1150
- * @param id - KYC request ID
1151
- * @returns KYC request details including proofs and alerts
1277
+ * @param id - KYC record ID (the `kyc_id` returned by `requestKycSubmitLink`)
1278
+ * @returns KYC record including proofs (with download links) and alerts
1152
1279
  *
1153
1280
  * @example
1154
1281
  * ```typescript
1155
1282
  * const kyc = await client.getKycRequest("550e8400-e29b-41d4-a716-446655440000");
1156
1283
  * console.log(`Status: ${kyc.status}, ID Verified: ${kyc.id_verified}`);
1284
+ * kyc.proofs?.forEach(proof => console.log(`${proof.type}: ${proof.link}`));
1157
1285
  * ```
1158
1286
  */
1159
1287
  getKycRequest(id: string): Promise<KycRequest>;
@@ -1172,6 +1300,10 @@ declare class KycClient extends BaseClient {
1172
1300
  * );
1173
1301
  * console.log(`Found ${requests.total} pending requests`);
1174
1302
  * ```
1303
+ *
1304
+ * @remarks Console session only. This endpoint accepts a Vesant console
1305
+ * (dashboard login) token, not a tenant API key; called with an API key it
1306
+ * fails with `AuthenticationError` or a permission error.
1175
1307
  */
1176
1308
  listKycRequests(filters?: KycRequestFilters, pagination?: PaginationParams): Promise<KycRequestListResponse>;
1177
1309
  /**
@@ -1195,6 +1327,10 @@ declare class KycClient extends BaseClient {
1195
1327
  * reason: "Document expired"
1196
1328
  * });
1197
1329
  * ```
1330
+ *
1331
+ * @remarks Console session only. This endpoint accepts a Vesant console
1332
+ * (dashboard login) token, not a tenant API key; called with an API key it
1333
+ * fails with `AuthenticationError` or a permission error.
1198
1334
  */
1199
1335
  updateKycStatus(request: UpdateKycStatusRequest): Promise<void>;
1200
1336
  /**
@@ -1219,14 +1355,18 @@ declare class KycClient extends BaseClient {
1219
1355
  /**
1220
1356
  * Get downloadable URLs for KYC proofs/documents
1221
1357
  *
1222
- * @param kycId - KYC request ID
1223
- * @returns Array of proof download URLs with expiration
1358
+ * Derived from the `proofs` of `getKycRequest`: the platform attaches a
1359
+ * short-lived download link to every proof on the KYC record, so no
1360
+ * separate endpoint is needed. Proofs without a link are omitted.
1361
+ *
1362
+ * @param kycId - KYC record ID
1363
+ * @returns Array of proof download URLs
1224
1364
  *
1225
1365
  * @example
1226
1366
  * ```typescript
1227
1367
  * const proofs = await client.getProofDownloadURLs("550e8400-e29b-41d4-a716-446655440000");
1228
1368
  * proofs.forEach(proof => {
1229
- * console.log(`${proof.type}: ${proof.url} (expires: ${proof.expires_at})`);
1369
+ * console.log(`${proof.type}: ${proof.url}`);
1230
1370
  * });
1231
1371
  * ```
1232
1372
  */
@@ -1247,6 +1387,10 @@ declare class KycClient extends BaseClient {
1247
1387
  * console.log(`Total: ${overview.total}, Pending: ${overview.pending}`);
1248
1388
  * console.log(`Approved: ${overview.approved}, Rejected: ${overview.rejected}`);
1249
1389
  * ```
1390
+ *
1391
+ * @remarks Console session only. This endpoint accepts a Vesant console
1392
+ * (dashboard login) token, not a tenant API key; called with an API key it
1393
+ * fails with `AuthenticationError` or a permission error.
1250
1394
  */
1251
1395
  getOverview(fromDate?: string, toDate?: string): Promise<KycOverview>;
1252
1396
  /**
@@ -1254,6 +1398,10 @@ declare class KycClient extends BaseClient {
1254
1398
  *
1255
1399
  * @param alertId - Alert ID
1256
1400
  * @returns Alert details
1401
+ *
1402
+ * @remarks Console session only. This endpoint accepts a Vesant console
1403
+ * (dashboard login) token, not a tenant API key; called with an API key it
1404
+ * fails with `AuthenticationError` or a permission error.
1257
1405
  */
1258
1406
  getAlert(alertId: string): Promise<KycAlert>;
1259
1407
  /**
@@ -1275,6 +1423,10 @@ declare class KycClient extends BaseClient {
1275
1423
  * );
1276
1424
  * console.log(`Found ${alerts.total} alerts`);
1277
1425
  * ```
1426
+ *
1427
+ * @remarks Console session only. This endpoint accepts a Vesant console
1428
+ * (dashboard login) token, not a tenant API key; called with an API key it
1429
+ * fails with `AuthenticationError` or a permission error.
1278
1430
  */
1279
1431
  listAlerts(filters?: KycAlertFilters, pagination?: PaginationParams): Promise<KycAlertListResponse>;
1280
1432
  /**
@@ -1304,6 +1456,10 @@ declare class KycClient extends BaseClient {
1304
1456
  * reason: "Requires senior review - suspicious documents"
1305
1457
  * });
1306
1458
  * ```
1459
+ *
1460
+ * @remarks Console session only. This endpoint accepts a Vesant console
1461
+ * (dashboard login) token, not a tenant API key; called with an API key it
1462
+ * fails with `AuthenticationError` or a permission error.
1307
1463
  */
1308
1464
  updateAlert(alertId: string, update: UpdateKycAlertRequest): Promise<void>;
1309
1465
  /**
@@ -1317,6 +1473,10 @@ declare class KycClient extends BaseClient {
1317
1473
  * console.log(`Face verification required: ${prefs.is_face_verification_required}`);
1318
1474
  * console.log(`Required documents: ${prefs.required_document_count}`);
1319
1475
  * ```
1476
+ *
1477
+ * @remarks Console session only. This endpoint accepts a Vesant console
1478
+ * (dashboard login) token, not a tenant API key; called with an API key it
1479
+ * fails with `AuthenticationError` or a permission error.
1320
1480
  */
1321
1481
  getPreferences(): Promise<KycPreferences>;
1322
1482
  /**
@@ -1415,4 +1575,4 @@ declare class KycClient extends BaseClient {
1415
1575
  createCustomerProfile(profile: CreateProfileRequest): Promise<CustomerProfile>;
1416
1576
  }
1417
1577
 
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 };
1578
+ 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
@@ -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