vesant-sdk 1.8.0-dev.2445740 → 1.8.0-dev.2b393a5

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.
@@ -1,4 +1,4 @@
1
- import { P as ProfileFilters, b as ProfileListResponse, C as CustomerProfile, a as CreateProfileRequest } from '../types-DfbnIaW_.mjs';
1
+ import { C as CustomerProfile, P as ProfileFilters, b as ProfileListResponse, a as CreateProfileRequest } from '../types-DbvVph_0.mjs';
2
2
  import { c as Reason, R as RiskLevel, P as PaginationParams } from '../types-CBQRNL-l.mjs';
3
3
  import { B as BaseClient, R as RequestOptions } from '../client-q9fN8Hhf.mjs';
4
4
 
@@ -15,7 +15,7 @@ type KycStatus =
15
15
  /** Submit link issued but the customer has not submitted documents yet — not "in progress". */
16
16
  'awaiting_kyc'
17
17
  /** Documents submitted, verification in progress. */
18
- | 'pending' | 'accepted' | 'declined' | 'review.pending' | 'unknown';
18
+ | 'pending' | 'accepted' | 'declined' | 'review.pending';
19
19
  type KycDeclinedCode = 'KYC_DOCUMENT_EXPIRED' | 'KYC_DOCUMENT_INVALID' | 'KYC_FACE_MISMATCH' | 'KYC_AGE_REQUIREMENT' | 'KYC_DUPLICATE_IDENTITY' | 'KYC_ADDRESS_MISMATCH' | 'KYC_NAME_MISMATCH' | 'KYC_PROVIDER_REJECTED' | 'KYC_DECLINED';
20
20
  declare const KYC_DECLINED_DESCRIPTIONS: Record<KycDeclinedCode, string>;
21
21
  type KycAlertStatus = 'pending' | 'in_progress' | 'resolved' | 'closed' | 'escalated';
@@ -111,7 +111,8 @@ interface KycRequest {
111
111
  block_reason?: string;
112
112
  proofs?: Proof[];
113
113
  alerts?: KycAlert[];
114
- risk_profile?: KycCustomerProfile;
114
+ /** The customer's risk profile (`risk_category`, `risk_score`, `kyc_status`, ...). */
115
+ risk_profile?: CustomerProfile;
115
116
  created_at: string;
116
117
  updated_at: string;
117
118
  }
@@ -119,30 +120,34 @@ interface Proof {
119
120
  id: string;
120
121
  kyc_id: string;
121
122
  type: ProofType;
122
- document: string;
123
+ /** Storage key. The platform never returns it; use `link` to download. */
124
+ document?: string;
123
125
  document_number?: string;
126
+ /** Document type the customer selected (e.g. `passport`). */
127
+ selected_type?: string;
128
+ /** Short-lived download URL, attached on `getKycRequest`. */
129
+ link?: string;
124
130
  created_at: string;
125
131
  }
126
132
  interface ProofDownloadURL {
133
+ /** Proof ID on the KYC record. */
134
+ id: string;
127
135
  type: ProofType;
128
136
  url: string;
129
- expires_at: string;
130
- }
131
- interface KycCustomerProfile {
132
- id: string;
133
- tenant_id: string;
134
- customer_id: string;
135
- first_name?: string;
136
- last_name?: string;
137
- email?: string;
138
- risk_score: number;
139
- risk_level: RiskLevel;
140
- kyc_status?: string;
141
- pep_status?: boolean;
142
- sanctions_status?: boolean;
143
- created_at: string;
144
- updated_at: string;
137
+ /** Not sent by the platform; the link itself is short-lived. */
138
+ expires_at?: string;
145
139
  }
140
+ /**
141
+ * The customer's risk profile as embedded on a KYC record
142
+ * (`additional_data.risk_profile`). The platform preloads the full
143
+ * `customer_profiles` row, so this is the same shape as
144
+ * {@link CustomerProfile}: read `risk_category` / `risk_score`, `kyc_status`,
145
+ * `is_pep`, `has_sanctions`. There is no `risk_level` field on the wire.
146
+ *
147
+ * @deprecated Use {@link CustomerProfile}; this alias is kept for existing
148
+ * imports and will be removed in a future major.
149
+ */
150
+ type KycCustomerProfile = CustomerProfile;
146
151
  interface KycAlert {
147
152
  id: string;
148
153
  kyc_id: string;
@@ -261,6 +266,16 @@ interface KycVerificationTriggers {
261
266
  first_purchase: boolean;
262
267
  /** Re-trigger verification once the customer's identity document has expired. */
263
268
  auto_trigger_on_id_expiration: boolean;
269
+ /**
270
+ * Manual KYC Verification: whether customers may start a verification
271
+ * themselves (`trigger_event: "manual"`), independent of the event
272
+ * triggers and of their status. On by default. When on, a `manual`
273
+ * request always returns a link — an already verified customer included.
274
+ * When off, it answers `kyc_required: false` with reason
275
+ * `KYC_NOT_REQUIRED_TRIGGER_DISABLED`; hide your Verification option in
276
+ * that case.
277
+ */
278
+ manual: boolean;
264
279
  /** Hold sensitive profile changes (name, DOB, address) behind KYC. */
265
280
  account_sensitive_action?: AccountSensitiveActionTrigger;
266
281
  }
@@ -430,8 +445,9 @@ interface UpdateKycStatusRequest {
430
445
  }
431
446
  /**
432
447
  * Events that can trigger a KYC request. Each maps to a per-event toggle in
433
- * the tenant's KYC verification trigger preferences, except `manual` (always
434
- * required) and `login` (only for an expired identity document).
448
+ * the tenant's KYC verification trigger preferences (`manual` to the Manual
449
+ * KYC Verification toggle), except `login` (only for an expired identity
450
+ * document).
435
451
  */
436
452
  type KycTriggerEvent = 'onboarding' | 'first_withdrawal' | 'first_purchase'
437
453
  /** Aliases of `first_withdrawal` / `first_purchase` — same tenant toggles. */
@@ -493,8 +509,12 @@ interface RequestKycSubmitLinkRequest {
493
509
  /**
494
510
  * Event that triggered the KYC request. The tenant's KYC verification
495
511
  * trigger preferences decide, per event, whether KYC is required
496
- * (`kyc_required` in the response). "manual" always requires KYC and
497
- * honors the tenant's allow-skip-on-manual option (`can_skip`). "login"
512
+ * (`kyc_required` in the response). "manual" — the customer starting
513
+ * verification themselves — is governed by the tenant's Manual KYC
514
+ * Verification toggle (on by default): when on it always returns a link,
515
+ * even for an already verified customer, and honors the
516
+ * allow-skip-on-manual option (`can_skip`); when off it answers
517
+ * `kyc_required: false` with `KYC_NOT_REQUIRED_TRIGGER_DISABLED`. "login"
498
518
  * answers for any customer state — never verified (asked, not skippable),
499
519
  * document expired (asked, skippable so you can offer "Remind me later"),
500
520
  * or verified and valid (not asked) — so a platform that gates entry on KYC
@@ -619,7 +639,8 @@ interface RequestKycSubmitLinkResponse {
619
639
  * Whether the user may skip verification. `true` for
620
640
  * `trigger_event: "manual"` when the tenant enables allow-skip-on-manual,
621
641
  * for `"login"` when an expired identity document triggered the request
622
- * (offer "Remind me later"), and when the customer is already verified.
642
+ * (offer "Remind me later"), and when the customer is already verified
643
+ * (except on `"manual"`, which always issues a link while enabled).
623
644
  * Always `false` at `"withdrawal"` / `"purchase"` — that is where a
624
645
  * postponed re-verification becomes mandatory.
625
646
  */
@@ -640,9 +661,9 @@ interface RequestKycSubmitLinkResponse {
640
661
  * is the only signal for it — nothing the customer does triggers it. Delivered
641
662
  * once per customer, when the document first becomes expired.
642
663
  *
643
- * It is sent regardless of the tenant's auto-trigger-on-ID-expiration setting:
644
- * that setting governs whether verification is *enforced*, not whether you are
645
- * *told*.
664
+ * It is sent only while the tenant's auto-trigger-on-ID-expiration setting is
665
+ * enabled; with the setting off the document is still flagged as expired, but
666
+ * no webhook is sent.
646
667
  */
647
668
  interface KycDocumentExpiredCallbackEvent {
648
669
  /** Always `"kyc_document_expired"` — dispatch on this. */
@@ -684,10 +705,49 @@ interface KycCallbackReactions {
684
705
  trigger_alert: boolean;
685
706
  block: boolean;
686
707
  freeze_account: boolean;
687
- /** Set when `freeze_account` is true: the tenant's default freeze window. */
708
+ /** Set when `freeze_account` is true: the freeze window the tenant set for the rules that fired. */
688
709
  freeze_duration_minutes?: number;
689
710
  enforce_logout: boolean;
690
711
  }
712
+ /**
713
+ * Body POSTed to your KYC `callback_url` whenever a document verification
714
+ * reaches an outcome (`accepted`, `declined`, `review.pending`). This is a flat
715
+ * callback, not a platform event envelope: there is no `event_type`, `id` or
716
+ * `timestamp`, so it cannot go through `WebhookHandler`. Verify it with
717
+ * `verifyWebhookSignature`, narrow it with {@link isKycStatusCallbackEvent},
718
+ * and deduplicate on `resource_id` + `status` yourself.
719
+ */
720
+ interface KycStatusCallbackEvent {
721
+ /** Always `"kyc"` — dispatch on this. */
722
+ event: 'kyc';
723
+ /** The verification reference (your customer identifier). */
724
+ reference: string;
725
+ /** Vesant KYC record ID (`kyc_id`). */
726
+ resource_id: string;
727
+ /** Verification outcome. `awaiting_kyc` / `pending` are never sent. */
728
+ status: 'accepted' | 'declined' | 'review.pending';
729
+ /**
730
+ * `true` when your app should block the triggering action. Set when a
731
+ * failed verification matched a per-event alert rule with the `block`
732
+ * reaction. Sticky once set on the record. Omitted when `false`.
733
+ */
734
+ block?: boolean;
735
+ /** The event that triggered the block; omitted when not blocked. */
736
+ block_reason?: string;
737
+ /** Comma-joined decline text; the structured list is `data.declined_reasons`. */
738
+ declined_reason?: string;
739
+ /** @deprecated Legacy category → message map; use `data.warning_reasons`. */
740
+ warnings?: Record<string, Record<string, string>>;
741
+ /** Present only when a rule with reactions matched (On Account Sensitive Action). */
742
+ reactions?: KycCallbackReactions;
743
+ /** The full KYC record, with `risk_profile` and proof download links. */
744
+ data: KycRequest;
745
+ }
746
+ /**
747
+ * Type guard for the KYC status callback. Narrows an already
748
+ * signature-verified, parsed payload to {@link KycStatusCallbackEvent}.
749
+ */
750
+ declare function isKycStatusCallbackEvent(value: unknown): value is KycStatusCallbackEvent;
691
751
  /**
692
752
  * Body POSTed to your `callback_url` when a held sensitive profile change is
693
753
  * settled. Signed with `X-Webhook-Signature: sha256=<hex>` (HMAC-SHA256 of the
@@ -795,7 +855,11 @@ interface EventBasedFaceVerificationReactionResult {
795
855
  /** Tenant app should block the action/account when true. */
796
856
  block: boolean;
797
857
  freeze_duration_minutes: number;
798
- /** Set when an alert was raised on the dashboard. */
858
+ /**
859
+ * Reserved. The dashboard alert is raised after the submit response and
860
+ * the webhook have been built, so neither carries the alert id today;
861
+ * read it from `listAlerts()` / the console instead.
862
+ */
799
863
  alert_id?: string;
800
864
  }
801
865
  /**
@@ -809,12 +873,12 @@ interface EventBasedFaceVerificationCallback {
809
873
  resource_id: string;
810
874
  status: KycStatus;
811
875
  /**
812
- * True when the tenant app should block the action/account. Mirrors the
813
- * `block` reaction on {@link data} at the top level of the callback so
814
- * consumers can branch without inspecting `data`. Omitted when false.
876
+ * Reserved and not populated on face verification callbacks: the block
877
+ * decision is `data.block`. Only the document-KYC `kyc` callback sets a
878
+ * top-level `block`.
815
879
  */
816
880
  block?: boolean;
817
- /** Names the event/verification that triggered the block. Omitted when not blocked. */
881
+ /** Reserved and not populated; see `data.block`. */
818
882
  block_reason?: string;
819
883
  /**
820
884
  * Structured decline reasons. Returned by
@@ -1244,15 +1308,20 @@ declare class KycClient extends BaseClient {
1244
1308
  */
1245
1309
  submitVerification(request: DocumentVerificationRequest, requestOptions?: RequestOptions): Promise<DocumentVerificationResponse>;
1246
1310
  /**
1247
- * Get a KYC request by ID
1311
+ * Get a KYC record by ID
1312
+ *
1313
+ * Works with your tenant API key. Each entry in `proofs` carries a
1314
+ * short-lived `link` for downloading that document, and `reference` holds
1315
+ * your own customer reference (the `forward_reference`).
1248
1316
  *
1249
- * @param id - KYC request ID
1250
- * @returns KYC request details including proofs and alerts
1317
+ * @param id - KYC record ID (the `kyc_id` returned by `requestKycSubmitLink`)
1318
+ * @returns KYC record including proofs (with download links) and alerts
1251
1319
  *
1252
1320
  * @example
1253
1321
  * ```typescript
1254
1322
  * const kyc = await client.getKycRequest("550e8400-e29b-41d4-a716-446655440000");
1255
1323
  * console.log(`Status: ${kyc.status}, ID Verified: ${kyc.id_verified}`);
1324
+ * kyc.proofs?.forEach(proof => console.log(`${proof.type}: ${proof.link}`));
1256
1325
  * ```
1257
1326
  */
1258
1327
  getKycRequest(id: string): Promise<KycRequest>;
@@ -1271,6 +1340,10 @@ declare class KycClient extends BaseClient {
1271
1340
  * );
1272
1341
  * console.log(`Found ${requests.total} pending requests`);
1273
1342
  * ```
1343
+ *
1344
+ * @remarks Console session only. This endpoint accepts a Vesant console
1345
+ * (dashboard login) token, not a tenant API key; called with an API key it
1346
+ * fails with `AuthenticationError` or a permission error.
1274
1347
  */
1275
1348
  listKycRequests(filters?: KycRequestFilters, pagination?: PaginationParams): Promise<KycRequestListResponse>;
1276
1349
  /**
@@ -1294,6 +1367,10 @@ declare class KycClient extends BaseClient {
1294
1367
  * reason: "Document expired"
1295
1368
  * });
1296
1369
  * ```
1370
+ *
1371
+ * @remarks Console session only. This endpoint accepts a Vesant console
1372
+ * (dashboard login) token, not a tenant API key; called with an API key it
1373
+ * fails with `AuthenticationError` or a permission error.
1297
1374
  */
1298
1375
  updateKycStatus(request: UpdateKycStatusRequest): Promise<void>;
1299
1376
  /**
@@ -1318,14 +1395,18 @@ declare class KycClient extends BaseClient {
1318
1395
  /**
1319
1396
  * Get downloadable URLs for KYC proofs/documents
1320
1397
  *
1321
- * @param kycId - KYC request ID
1322
- * @returns Array of proof download URLs with expiration
1398
+ * Derived from the `proofs` of `getKycRequest`: the platform attaches a
1399
+ * short-lived download link to every proof on the KYC record, so no
1400
+ * separate endpoint is needed. Proofs without a link are omitted.
1401
+ *
1402
+ * @param kycId - KYC record ID
1403
+ * @returns Array of proof download URLs
1323
1404
  *
1324
1405
  * @example
1325
1406
  * ```typescript
1326
1407
  * const proofs = await client.getProofDownloadURLs("550e8400-e29b-41d4-a716-446655440000");
1327
1408
  * proofs.forEach(proof => {
1328
- * console.log(`${proof.type}: ${proof.url} (expires: ${proof.expires_at})`);
1409
+ * console.log(`${proof.type}: ${proof.url}`);
1329
1410
  * });
1330
1411
  * ```
1331
1412
  */
@@ -1346,6 +1427,10 @@ declare class KycClient extends BaseClient {
1346
1427
  * console.log(`Total: ${overview.total}, Pending: ${overview.pending}`);
1347
1428
  * console.log(`Approved: ${overview.approved}, Rejected: ${overview.rejected}`);
1348
1429
  * ```
1430
+ *
1431
+ * @remarks Console session only. This endpoint accepts a Vesant console
1432
+ * (dashboard login) token, not a tenant API key; called with an API key it
1433
+ * fails with `AuthenticationError` or a permission error.
1349
1434
  */
1350
1435
  getOverview(fromDate?: string, toDate?: string): Promise<KycOverview>;
1351
1436
  /**
@@ -1353,6 +1438,10 @@ declare class KycClient extends BaseClient {
1353
1438
  *
1354
1439
  * @param alertId - Alert ID
1355
1440
  * @returns Alert details
1441
+ *
1442
+ * @remarks Console session only. This endpoint accepts a Vesant console
1443
+ * (dashboard login) token, not a tenant API key; called with an API key it
1444
+ * fails with `AuthenticationError` or a permission error.
1356
1445
  */
1357
1446
  getAlert(alertId: string): Promise<KycAlert>;
1358
1447
  /**
@@ -1374,6 +1463,10 @@ declare class KycClient extends BaseClient {
1374
1463
  * );
1375
1464
  * console.log(`Found ${alerts.total} alerts`);
1376
1465
  * ```
1466
+ *
1467
+ * @remarks Console session only. This endpoint accepts a Vesant console
1468
+ * (dashboard login) token, not a tenant API key; called with an API key it
1469
+ * fails with `AuthenticationError` or a permission error.
1377
1470
  */
1378
1471
  listAlerts(filters?: KycAlertFilters, pagination?: PaginationParams): Promise<KycAlertListResponse>;
1379
1472
  /**
@@ -1403,6 +1496,10 @@ declare class KycClient extends BaseClient {
1403
1496
  * reason: "Requires senior review - suspicious documents"
1404
1497
  * });
1405
1498
  * ```
1499
+ *
1500
+ * @remarks Console session only. This endpoint accepts a Vesant console
1501
+ * (dashboard login) token, not a tenant API key; called with an API key it
1502
+ * fails with `AuthenticationError` or a permission error.
1406
1503
  */
1407
1504
  updateAlert(alertId: string, update: UpdateKycAlertRequest): Promise<void>;
1408
1505
  /**
@@ -1416,6 +1513,10 @@ declare class KycClient extends BaseClient {
1416
1513
  * console.log(`Face verification required: ${prefs.is_face_verification_required}`);
1417
1514
  * console.log(`Required documents: ${prefs.required_document_count}`);
1418
1515
  * ```
1516
+ *
1517
+ * @remarks Console session only. This endpoint accepts a Vesant console
1518
+ * (dashboard login) token, not a tenant API key; called with an API key it
1519
+ * fails with `AuthenticationError` or a permission error.
1419
1520
  */
1420
1521
  getPreferences(): Promise<KycPreferences>;
1421
1522
  /**
@@ -1514,4 +1615,4 @@ declare class KycClient extends BaseClient {
1514
1615
  createCustomerProfile(profile: CreateProfileRequest): Promise<CustomerProfile>;
1515
1616
  }
1516
1617
 
1517
- 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 };
1618
+ 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 KycStatusCallbackEvent, 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, isKycStatusCallbackEvent, isProfileChangeCallbackEvent };