vesant-sdk 1.7.2 → 1.8.0-dev.00f6233
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.
- package/README.md +3 -3
- package/dist/{client-B3DCAHlg.d.ts → client-BPALLldd.d.ts} +2 -2
- package/dist/{client-fy3trF2K.d.ts → client-BaUekQT8.d.ts} +32 -10
- package/dist/{client-BwXMQA2a.d.mts → client-XDEhh9VN.d.mts} +32 -10
- package/dist/{client-D23KhWeh.d.mts → client-_OhkfnyJ.d.mts} +2 -2
- package/dist/compliance/index.d.mts +3 -3
- package/dist/compliance/index.d.ts +3 -3
- package/dist/compliance/index.js +66 -11
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +66 -11
- package/dist/compliance/index.mjs.map +1 -1
- package/dist/decisions/index.js +8 -7
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisions/index.mjs +8 -7
- package/dist/decisions/index.mjs.map +1 -1
- package/dist/geolocation/index.d.mts +2 -2
- package/dist/geolocation/index.d.ts +2 -2
- package/dist/geolocation/index.js +47 -8
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +47 -8
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/{index-DSDgS09k.d.ts → index-BosFSGan.d.ts} +57 -2
- package/dist/{index-C3zUKydT.d.mts → index-C49a7fg2.d.mts} +57 -2
- package/dist/index.d.mts +6 -6
- package/dist/index.d.ts +6 -6
- package/dist/index.js +104 -169
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +101 -170
- package/dist/index.mjs.map +1 -1
- package/dist/kyc/core.d.mts +2 -2
- package/dist/kyc/core.d.ts +2 -2
- package/dist/kyc/core.js +39 -165
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +38 -166
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +219 -218
- package/dist/kyc/index.d.ts +219 -218
- package/dist/kyc/index.js +39 -165
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +38 -166
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +24 -115
- package/dist/react.d.ts +24 -115
- package/dist/react.js +23 -196
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +24 -194
- package/dist/react.mjs.map +1 -1
- package/dist/risk-profile/index.d.mts +16 -6
- package/dist/risk-profile/index.d.ts +16 -6
- package/dist/risk-profile/index.js +26 -9
- package/dist/risk-profile/index.js.map +1 -1
- package/dist/risk-profile/index.mjs +26 -10
- package/dist/risk-profile/index.mjs.map +1 -1
- package/dist/scores/index.js +8 -7
- package/dist/scores/index.js.map +1 -1
- package/dist/scores/index.mjs +8 -7
- package/dist/scores/index.mjs.map +1 -1
- package/dist/tax/index.d.mts +1 -1
- package/dist/tax/index.d.ts +1 -1
- package/dist/tax/index.js +8 -7
- package/dist/tax/index.js.map +1 -1
- package/dist/tax/index.mjs +8 -7
- package/dist/tax/index.mjs.map +1 -1
- package/dist/{types-BOFaMQxI.d.mts → types-DbvVph_0.d.mts} +45 -2
- package/dist/{types-UGyDl1fd.d.ts → types-qXamJr2q.d.ts} +45 -2
- package/dist/webhooks/index.d.mts +1 -1
- package/dist/webhooks/index.d.ts +1 -1
- package/dist/webhooks/index.js +6 -0
- package/dist/webhooks/index.js.map +1 -1
- package/dist/webhooks/index.mjs +6 -1
- package/dist/webhooks/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/kyc/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { C as CustomerProfile, P as ProfileFilters, b as ProfileListResponse, a as CreateProfileRequest } from '../types-qXamJr2q.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
|
|
|
@@ -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'
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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;
|
|
@@ -172,12 +177,6 @@ interface KycAlertListResponse {
|
|
|
172
177
|
alerts: KycAlert[];
|
|
173
178
|
pagination: KycPagination;
|
|
174
179
|
}
|
|
175
|
-
interface UpdateKycAlertRequest {
|
|
176
|
-
assigned_for?: string;
|
|
177
|
-
reason?: string;
|
|
178
|
-
alert_type?: KycAlertType;
|
|
179
|
-
status?: KycAlertStatus;
|
|
180
|
-
}
|
|
181
180
|
/**
|
|
182
181
|
* Threshold-gated trigger for transaction events. Each rule is
|
|
183
182
|
* self-contained — there is no umbrella flag.
|
|
@@ -243,6 +242,17 @@ interface EventBasedFaceVerificationReactions {
|
|
|
243
242
|
/** @deprecated Never populated; read `data.freeze_duration_minutes` on the callback instead. */
|
|
244
243
|
freeze_duration_minutes?: number;
|
|
245
244
|
}
|
|
245
|
+
/**
|
|
246
|
+
* On Account Sensitive Action: hold a change to the customer's name, date of
|
|
247
|
+
* birth or residential address behind a full KYC verification. Configured in
|
|
248
|
+
* the Vesant console; off by default. See {@link ProfileUpdateHeldResponse}.
|
|
249
|
+
*/
|
|
250
|
+
interface AccountSensitiveActionTrigger {
|
|
251
|
+
enabled: boolean;
|
|
252
|
+
full_name: boolean;
|
|
253
|
+
date_of_birth: boolean;
|
|
254
|
+
residential_address: boolean;
|
|
255
|
+
}
|
|
246
256
|
/** Per-event toggles that decide when a submit-link request requires KYC. */
|
|
247
257
|
interface KycVerificationTriggers {
|
|
248
258
|
onboarding: boolean;
|
|
@@ -250,6 +260,18 @@ interface KycVerificationTriggers {
|
|
|
250
260
|
first_purchase: boolean;
|
|
251
261
|
/** Re-trigger verification once the customer's identity document has expired. */
|
|
252
262
|
auto_trigger_on_id_expiration: boolean;
|
|
263
|
+
/**
|
|
264
|
+
* Manual KYC Verification: whether customers may start a verification
|
|
265
|
+
* themselves (`trigger_event: "manual"`), independent of the event
|
|
266
|
+
* triggers and of their status. On by default. When on, a `manual`
|
|
267
|
+
* request always returns a link — an already verified customer included.
|
|
268
|
+
* When off, it answers `kyc_required: false` with reason
|
|
269
|
+
* `KYC_NOT_REQUIRED_TRIGGER_DISABLED`; hide your Verification option in
|
|
270
|
+
* that case.
|
|
271
|
+
*/
|
|
272
|
+
manual: boolean;
|
|
273
|
+
/** Hold sensitive profile changes (name, DOB, address) behind KYC. */
|
|
274
|
+
account_sensitive_action?: AccountSensitiveActionTrigger;
|
|
253
275
|
}
|
|
254
276
|
interface KycSkipOptions {
|
|
255
277
|
/** Let a `manual` trigger be skipped (`can_skip` on the submit-link response). */
|
|
@@ -405,20 +427,11 @@ interface DocumentVerificationResponse {
|
|
|
405
427
|
verification_url?: string;
|
|
406
428
|
message?: string;
|
|
407
429
|
}
|
|
408
|
-
interface UpdateKycStatusRequest {
|
|
409
|
-
/** Provider reference or KYC ID */
|
|
410
|
-
reference: string;
|
|
411
|
-
/** Target status */
|
|
412
|
-
status: KycStatus;
|
|
413
|
-
/** Acceptance/decline reason */
|
|
414
|
-
reason?: string;
|
|
415
|
-
/** Provider warnings data */
|
|
416
|
-
warnings?: Record<string, Record<string, string>>;
|
|
417
|
-
}
|
|
418
430
|
/**
|
|
419
431
|
* Events that can trigger a KYC request. Each maps to a per-event toggle in
|
|
420
|
-
* the tenant's KYC verification trigger preferences
|
|
421
|
-
*
|
|
432
|
+
* the tenant's KYC verification trigger preferences (`manual` to the Manual
|
|
433
|
+
* KYC Verification toggle), except `login` (only for an expired identity
|
|
434
|
+
* document).
|
|
422
435
|
*/
|
|
423
436
|
type KycTriggerEvent = 'onboarding' | 'first_withdrawal' | 'first_purchase'
|
|
424
437
|
/** Aliases of `first_withdrawal` / `first_purchase` — same tenant toggles. */
|
|
@@ -429,7 +442,16 @@ type KycTriggerEvent = 'onboarding' | 'first_withdrawal' | 'first_purchase'
|
|
|
429
442
|
* (asked, skippable — "Remind me later"), or verified with a valid document
|
|
430
443
|
* (not asked). One call covers every customer.
|
|
431
444
|
*/
|
|
432
|
-
| 'login'
|
|
445
|
+
| 'login'
|
|
446
|
+
/**
|
|
447
|
+
* The customer changed their name, date of birth or address and
|
|
448
|
+
* `updateProfile` answered `202` with `kyc_required: true`. Required — not
|
|
449
|
+
* skippable — while Vesant holds a pending change for the customer; not
|
|
450
|
+
* required when nothing is held or the tenant switched the trigger off.
|
|
451
|
+
* The verification is seeded with the requested identity and, on approval,
|
|
452
|
+
* releases the held change. See the `profile_change` webhook.
|
|
453
|
+
*/
|
|
454
|
+
| 'profile_change';
|
|
433
455
|
/**
|
|
434
456
|
* Why verification is — or is not — being asked for. Codes are stable;
|
|
435
457
|
* `message` is display-ready text you can show the customer as-is.
|
|
@@ -453,10 +475,14 @@ type KycRequestReasonCode =
|
|
|
453
475
|
| 'KYC_REQUIRED_ID_EXPIRED'
|
|
454
476
|
/** Verification was explicitly requested by the tenant. */
|
|
455
477
|
| 'KYC_REQUIRED_MANUAL'
|
|
478
|
+
/** Required before a held name / date of birth / address change is applied. */
|
|
479
|
+
| 'KYC_REQUIRED_PROFILE_CHANGE'
|
|
456
480
|
/** Not required — the customer already has an accepted verification. */
|
|
457
481
|
| 'KYC_NOT_REQUIRED_ALREADY_VERIFIED'
|
|
458
482
|
/** Not required — the tenant has this trigger event switched off. */
|
|
459
|
-
| 'KYC_NOT_REQUIRED_TRIGGER_DISABLED'
|
|
483
|
+
| 'KYC_NOT_REQUIRED_TRIGGER_DISABLED'
|
|
484
|
+
/** Not required — `profile_change` was sent but Vesant holds no pending change for the customer. */
|
|
485
|
+
| 'KYC_NOT_REQUIRED_NO_PENDING_CHANGE';
|
|
460
486
|
interface RequestKycSubmitLinkRequest {
|
|
461
487
|
/** User ID to generate KYC submission link for */
|
|
462
488
|
user_id: string;
|
|
@@ -467,8 +493,12 @@ interface RequestKycSubmitLinkRequest {
|
|
|
467
493
|
/**
|
|
468
494
|
* Event that triggered the KYC request. The tenant's KYC verification
|
|
469
495
|
* trigger preferences decide, per event, whether KYC is required
|
|
470
|
-
* (`kyc_required` in the response). "manual"
|
|
471
|
-
*
|
|
496
|
+
* (`kyc_required` in the response). "manual" — the customer starting
|
|
497
|
+
* verification themselves — is governed by the tenant's Manual KYC
|
|
498
|
+
* Verification toggle (on by default): when on it always returns a link,
|
|
499
|
+
* even for an already verified customer, and honors the
|
|
500
|
+
* allow-skip-on-manual option (`can_skip`); when off it answers
|
|
501
|
+
* `kyc_required: false` with `KYC_NOT_REQUIRED_TRIGGER_DISABLED`. "login"
|
|
472
502
|
* answers for any customer state — never verified (asked, not skippable),
|
|
473
503
|
* document expired (asked, skippable so you can offer "Remind me later"),
|
|
474
504
|
* or verified and valid (not asked) — so a platform that gates entry on KYC
|
|
@@ -593,7 +623,8 @@ interface RequestKycSubmitLinkResponse {
|
|
|
593
623
|
* Whether the user may skip verification. `true` for
|
|
594
624
|
* `trigger_event: "manual"` when the tenant enables allow-skip-on-manual,
|
|
595
625
|
* for `"login"` when an expired identity document triggered the request
|
|
596
|
-
* (offer "Remind me later"), and when the customer is already verified
|
|
626
|
+
* (offer "Remind me later"), and when the customer is already verified
|
|
627
|
+
* (except on `"manual"`, which always issues a link while enabled).
|
|
597
628
|
* Always `false` at `"withdrawal"` / `"purchase"` — that is where a
|
|
598
629
|
* postponed re-verification becomes mandatory.
|
|
599
630
|
*/
|
|
@@ -614,9 +645,9 @@ interface RequestKycSubmitLinkResponse {
|
|
|
614
645
|
* is the only signal for it — nothing the customer does triggers it. Delivered
|
|
615
646
|
* once per customer, when the document first becomes expired.
|
|
616
647
|
*
|
|
617
|
-
* It is sent
|
|
618
|
-
*
|
|
619
|
-
*
|
|
648
|
+
* It is sent only while the tenant's auto-trigger-on-ID-expiration setting is
|
|
649
|
+
* enabled; with the setting off the document is still flagged as expired, but
|
|
650
|
+
* no webhook is sent.
|
|
620
651
|
*/
|
|
621
652
|
interface KycDocumentExpiredCallbackEvent {
|
|
622
653
|
/** Always `"kyc_document_expired"` — dispatch on this. */
|
|
@@ -641,6 +672,118 @@ interface KycDocumentExpiredCallbackEvent {
|
|
|
641
672
|
* signature-verified, parsed payload to {@link KycDocumentExpiredCallbackEvent}.
|
|
642
673
|
*/
|
|
643
674
|
declare function isKycDocumentExpiredCallbackEvent(value: unknown): value is KycDocumentExpiredCallbackEvent;
|
|
675
|
+
/** Sensitive profile field held behind KYC by On Account Sensitive Action. */
|
|
676
|
+
type ProfileChangeField = 'full_name' | 'date_of_birth' | 'residential_address';
|
|
677
|
+
/** How a held profile change ended. */
|
|
678
|
+
type ProfileChangeStatus = 'approved' | 'rejected' | 'expired';
|
|
679
|
+
/**
|
|
680
|
+
* Reactions a verification fired, mirrored from the tenant's KYC alert
|
|
681
|
+
* configuration. Vesant holds no account state on your platform: these flags
|
|
682
|
+
* tell you what the tenant configured, they do not do it. Present on the
|
|
683
|
+
* `kyc` status callback only when a rule with reactions matched — today the
|
|
684
|
+
* On Account Sensitive Action rules.
|
|
685
|
+
*/
|
|
686
|
+
interface KycCallbackReactions {
|
|
687
|
+
/** The alert rules that fired, e.g. `["profile_change_name"]`. */
|
|
688
|
+
events: string[];
|
|
689
|
+
trigger_alert: boolean;
|
|
690
|
+
block: boolean;
|
|
691
|
+
freeze_account: boolean;
|
|
692
|
+
/** Set when `freeze_account` is true: the freeze window the tenant set for the rules that fired. */
|
|
693
|
+
freeze_duration_minutes?: number;
|
|
694
|
+
enforce_logout: boolean;
|
|
695
|
+
}
|
|
696
|
+
/**
|
|
697
|
+
* Body POSTed to your KYC `callback_url` whenever a document verification
|
|
698
|
+
* reaches an outcome (`accepted`, `declined`, `review.pending`). This is a flat
|
|
699
|
+
* callback, not a platform event envelope: there is no `event_type`, `id` or
|
|
700
|
+
* `timestamp`, so it cannot go through `WebhookHandler`. Verify it with
|
|
701
|
+
* `verifyWebhookSignature`, narrow it with {@link isKycStatusCallbackEvent},
|
|
702
|
+
* and deduplicate on `resource_id` + `status` yourself.
|
|
703
|
+
*/
|
|
704
|
+
interface KycStatusCallbackEvent {
|
|
705
|
+
/** Always `"kyc"` — dispatch on this. */
|
|
706
|
+
event: 'kyc';
|
|
707
|
+
/** The verification reference (your customer identifier). */
|
|
708
|
+
reference: string;
|
|
709
|
+
/** Vesant KYC record ID (`kyc_id`). */
|
|
710
|
+
resource_id: string;
|
|
711
|
+
/** Verification outcome. `awaiting_kyc` / `pending` are never sent. */
|
|
712
|
+
status: 'accepted' | 'declined' | 'review.pending';
|
|
713
|
+
/**
|
|
714
|
+
* `true` when your app should block the triggering action. Set when a
|
|
715
|
+
* failed verification matched a per-event alert rule with the `block`
|
|
716
|
+
* reaction. Sticky once set on the record. Omitted when `false`.
|
|
717
|
+
*/
|
|
718
|
+
block?: boolean;
|
|
719
|
+
/** The event that triggered the block; omitted when not blocked. */
|
|
720
|
+
block_reason?: string;
|
|
721
|
+
/** Comma-joined decline text; the structured list is `data.declined_reasons`. */
|
|
722
|
+
declined_reason?: string;
|
|
723
|
+
/** @deprecated Legacy category → message map; use `data.warning_reasons`. */
|
|
724
|
+
warnings?: Record<string, Record<string, string>>;
|
|
725
|
+
/** Present only when a rule with reactions matched (On Account Sensitive Action). */
|
|
726
|
+
reactions?: KycCallbackReactions;
|
|
727
|
+
/** The full KYC record, with `risk_profile` and proof download links. */
|
|
728
|
+
data: KycRequest;
|
|
729
|
+
}
|
|
730
|
+
/**
|
|
731
|
+
* Type guard for the KYC status callback. Narrows an already
|
|
732
|
+
* signature-verified, parsed payload to {@link KycStatusCallbackEvent}.
|
|
733
|
+
*/
|
|
734
|
+
declare function isKycStatusCallbackEvent(value: unknown): value is KycStatusCallbackEvent;
|
|
735
|
+
/**
|
|
736
|
+
* Body POSTed to your `callback_url` when a held sensitive profile change is
|
|
737
|
+
* settled. Signed with `X-Webhook-Signature: sha256=<hex>` (HMAC-SHA256 of the
|
|
738
|
+
* raw body), like every other Vesant callback.
|
|
739
|
+
*
|
|
740
|
+
* Sent once per held change: `approved` after the customer's `profile_change`
|
|
741
|
+
* verification was accepted and the verified values were written to the
|
|
742
|
+
* profile; `rejected` after it was declined and the profile was left as it
|
|
743
|
+
* was; `expired` when no verification arrived within the hold window (seven
|
|
744
|
+
* days by default). On `rejected`, show the customer `declined_reasons` — this
|
|
745
|
+
* is the "KYC decline message" for the change.
|
|
746
|
+
*/
|
|
747
|
+
interface ProfileChangeCallbackEvent {
|
|
748
|
+
/** Always `"profile_change"` — dispatch on this. */
|
|
749
|
+
event: 'profile_change';
|
|
750
|
+
/** Your customer identifier (the `user_id` you supplied). */
|
|
751
|
+
reference: string;
|
|
752
|
+
/** The pending change id returned by `updateProfile`. */
|
|
753
|
+
resource_id: string;
|
|
754
|
+
status: ProfileChangeStatus;
|
|
755
|
+
/** First decline message, `rejected` only. */
|
|
756
|
+
declined_reason?: string;
|
|
757
|
+
/** Structured decline, `rejected` only. */
|
|
758
|
+
declined_reasons?: Reason[];
|
|
759
|
+
data: {
|
|
760
|
+
customer_id: string;
|
|
761
|
+
profile_id: string;
|
|
762
|
+
pending_change_id: string;
|
|
763
|
+
/** The verification that settled the change; empty if it expired unverified. */
|
|
764
|
+
kyc_id: string;
|
|
765
|
+
changed_fields: ProfileChangeField[];
|
|
766
|
+
/** What the customer asked for. */
|
|
767
|
+
requested_values: Partial<Record<ProfileChangeField, string>>;
|
|
768
|
+
/** What the profile held before the change. */
|
|
769
|
+
previous_values: Partial<Record<ProfileChangeField, string>>;
|
|
770
|
+
/**
|
|
771
|
+
* What the document verified, `approved` only. The verified values are
|
|
772
|
+
* what was written to the profile — when they differ from
|
|
773
|
+
* `requested_values` (`values_match: false`) the document wins and a
|
|
774
|
+
* review alert is raised in the Vesant console.
|
|
775
|
+
*/
|
|
776
|
+
verified_values?: Partial<Record<ProfileChangeField, string>>;
|
|
777
|
+
values_match?: boolean | null;
|
|
778
|
+
expires_at: string;
|
|
779
|
+
resolved_at?: string | null;
|
|
780
|
+
};
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* Type guard for the held-profile-change webhook. Narrows an already
|
|
784
|
+
* signature-verified, parsed payload to {@link ProfileChangeCallbackEvent}.
|
|
785
|
+
*/
|
|
786
|
+
declare function isProfileChangeCallbackEvent(value: unknown): value is ProfileChangeCallbackEvent;
|
|
644
787
|
/** Device class detected by the SDK (purely client-side — server doesn't care). */
|
|
645
788
|
type EventBasedFaceVerificationDeviceType = 'mobile' | 'desktop';
|
|
646
789
|
interface CreateEventBasedFaceVerificationSessionResponse {
|
|
@@ -696,7 +839,11 @@ interface EventBasedFaceVerificationReactionResult {
|
|
|
696
839
|
/** Tenant app should block the action/account when true. */
|
|
697
840
|
block: boolean;
|
|
698
841
|
freeze_duration_minutes: number;
|
|
699
|
-
/**
|
|
842
|
+
/**
|
|
843
|
+
* Reserved. The dashboard alert is raised after the submit response and
|
|
844
|
+
* the webhook have been built, so neither carries the alert id today;
|
|
845
|
+
* read it from `listAlerts()` / the console instead.
|
|
846
|
+
*/
|
|
700
847
|
alert_id?: string;
|
|
701
848
|
}
|
|
702
849
|
/**
|
|
@@ -710,12 +857,12 @@ interface EventBasedFaceVerificationCallback {
|
|
|
710
857
|
resource_id: string;
|
|
711
858
|
status: KycStatus;
|
|
712
859
|
/**
|
|
713
|
-
*
|
|
714
|
-
*
|
|
715
|
-
*
|
|
860
|
+
* Reserved and not populated on face verification callbacks: the block
|
|
861
|
+
* decision is `data.block`. Only the document-KYC `kyc` callback sets a
|
|
862
|
+
* top-level `block`.
|
|
716
863
|
*/
|
|
717
864
|
block?: boolean;
|
|
718
|
-
/**
|
|
865
|
+
/** Reserved and not populated; see `data.block`. */
|
|
719
866
|
block_reason?: string;
|
|
720
867
|
/**
|
|
721
868
|
* Structured decline reasons. Returned by
|
|
@@ -821,38 +968,12 @@ interface RequestAdditionalDocumentsRequest {
|
|
|
821
968
|
/** Message to customer */
|
|
822
969
|
message?: string;
|
|
823
970
|
}
|
|
824
|
-
interface KycOverview {
|
|
825
|
-
total: number;
|
|
826
|
-
pending: number;
|
|
827
|
-
approved: number;
|
|
828
|
-
high_risk: number;
|
|
829
|
-
rejected: number;
|
|
830
|
-
id_verified: number;
|
|
831
|
-
address_verified: number;
|
|
832
|
-
face_verified: number;
|
|
833
|
-
rejections: number;
|
|
834
|
-
total_alerts: number;
|
|
835
|
-
pending_alerts: number;
|
|
836
|
-
resolved_alerts: number;
|
|
837
|
-
}
|
|
838
|
-
interface KycRequestFilters {
|
|
839
|
-
status?: KycStatus | KycStatus[];
|
|
840
|
-
search?: string;
|
|
841
|
-
fromDate?: string;
|
|
842
|
-
toDate?: string;
|
|
843
|
-
sortBy?: string;
|
|
844
|
-
order?: 'ASC' | 'DESC';
|
|
845
|
-
}
|
|
846
971
|
interface KycPagination {
|
|
847
972
|
limit: number;
|
|
848
973
|
page: number;
|
|
849
974
|
total: number;
|
|
850
975
|
totalPages: number;
|
|
851
976
|
}
|
|
852
|
-
interface KycRequestListResponse {
|
|
853
|
-
data: KycRequest[];
|
|
854
|
-
pagination: KycPagination;
|
|
855
|
-
}
|
|
856
977
|
|
|
857
978
|
interface KycClientConfig {
|
|
858
979
|
/** Base URL of the KYC Service API (e.g., "http://localhost:8088") */
|
|
@@ -901,36 +1022,11 @@ interface UseKycSubmissionResult extends BaseHookState {
|
|
|
901
1022
|
submission: DocumentVerificationResponse | null;
|
|
902
1023
|
reset: () => void;
|
|
903
1024
|
}
|
|
904
|
-
type UseKycRequestsOptions = BaseListOptions<KycRequestFilters>;
|
|
905
|
-
interface UseKycRequestsResult extends BaseHookState {
|
|
906
|
-
requests: KycRequest[];
|
|
907
|
-
pagination: KycPagination | null;
|
|
908
|
-
fetchRequests: (filters?: KycRequestFilters, pagination?: PaginationParams) => Promise<void>;
|
|
909
|
-
getRequest: (id: string) => Promise<KycRequest>;
|
|
910
|
-
updateStatus: (reference: string, status: KycStatus, reason?: string) => Promise<void>;
|
|
911
|
-
refresh: () => Promise<void>;
|
|
912
|
-
}
|
|
913
1025
|
type UseKycAlertsOptions = BaseListOptions<KycAlertFilters>;
|
|
914
1026
|
interface UseKycAlertsResult extends BaseHookState {
|
|
915
1027
|
alerts: KycAlert[];
|
|
916
1028
|
pagination: KycPagination | null;
|
|
917
1029
|
fetchAlerts: (filters?: KycAlertFilters, pagination?: PaginationParams) => Promise<void>;
|
|
918
|
-
getAlert: (id: string) => Promise<KycAlert>;
|
|
919
|
-
updateAlert: (id: string, update: UpdateKycAlertRequest) => Promise<void>;
|
|
920
|
-
refresh: () => Promise<void>;
|
|
921
|
-
}
|
|
922
|
-
interface UseKycOverviewOptions extends BaseAutoFetchOptions {
|
|
923
|
-
fromDate?: string;
|
|
924
|
-
toDate?: string;
|
|
925
|
-
}
|
|
926
|
-
interface UseKycOverviewResult extends BaseHookState {
|
|
927
|
-
overview: KycOverview | null;
|
|
928
|
-
refresh: (fromDate?: string, toDate?: string) => Promise<void>;
|
|
929
|
-
}
|
|
930
|
-
interface UseKycPreferencesResult extends BaseHookState {
|
|
931
|
-
preferences: KycPreferences | null;
|
|
932
|
-
/** @deprecated The platform exposes no preference-update operation; this call always fails. */
|
|
933
|
-
updatePreferences: (update: UpdateKycPreferencesRequest) => Promise<void>;
|
|
934
1030
|
refresh: () => Promise<void>;
|
|
935
1031
|
}
|
|
936
1032
|
|
|
@@ -1145,58 +1241,23 @@ declare class KycClient extends BaseClient {
|
|
|
1145
1241
|
*/
|
|
1146
1242
|
submitVerification(request: DocumentVerificationRequest, requestOptions?: RequestOptions): Promise<DocumentVerificationResponse>;
|
|
1147
1243
|
/**
|
|
1148
|
-
* Get a KYC
|
|
1244
|
+
* Get a KYC record by ID
|
|
1149
1245
|
*
|
|
1150
|
-
*
|
|
1151
|
-
*
|
|
1246
|
+
* Works with your tenant API key. Each entry in `proofs` carries a
|
|
1247
|
+
* short-lived `link` for downloading that document, and `reference` holds
|
|
1248
|
+
* your own customer reference (the `forward_reference`).
|
|
1249
|
+
*
|
|
1250
|
+
* @param id - KYC record ID (the `kyc_id` returned by `requestKycSubmitLink`)
|
|
1251
|
+
* @returns KYC record including proofs (with download links) and alerts
|
|
1152
1252
|
*
|
|
1153
1253
|
* @example
|
|
1154
1254
|
* ```typescript
|
|
1155
1255
|
* const kyc = await client.getKycRequest("550e8400-e29b-41d4-a716-446655440000");
|
|
1156
1256
|
* console.log(`Status: ${kyc.status}, ID Verified: ${kyc.id_verified}`);
|
|
1257
|
+
* kyc.proofs?.forEach(proof => console.log(`${proof.type}: ${proof.link}`));
|
|
1157
1258
|
* ```
|
|
1158
1259
|
*/
|
|
1159
1260
|
getKycRequest(id: string): Promise<KycRequest>;
|
|
1160
|
-
/**
|
|
1161
|
-
* List KYC requests with filters and pagination
|
|
1162
|
-
*
|
|
1163
|
-
* @param filters - Optional filters (status, search, date range)
|
|
1164
|
-
* @param pagination - Optional pagination (page, page_size)
|
|
1165
|
-
* @returns Paginated list of KYC requests
|
|
1166
|
-
*
|
|
1167
|
-
* @example
|
|
1168
|
-
* ```typescript
|
|
1169
|
-
* const requests = await client.listKycRequests(
|
|
1170
|
-
* { status: "pending", search: "john" },
|
|
1171
|
-
* { page: 1, page_size: 20 }
|
|
1172
|
-
* );
|
|
1173
|
-
* console.log(`Found ${requests.total} pending requests`);
|
|
1174
|
-
* ```
|
|
1175
|
-
*/
|
|
1176
|
-
listKycRequests(filters?: KycRequestFilters, pagination?: PaginationParams): Promise<KycRequestListResponse>;
|
|
1177
|
-
/**
|
|
1178
|
-
* Update KYC request status (accept/decline)
|
|
1179
|
-
*
|
|
1180
|
-
* @param request - Status update request with reference, status, and reason
|
|
1181
|
-
*
|
|
1182
|
-
* @example
|
|
1183
|
-
* ```typescript
|
|
1184
|
-
* // Accept a KYC request
|
|
1185
|
-
* await client.updateKycStatus({
|
|
1186
|
-
* reference: "kyc-ref-123",
|
|
1187
|
-
* status: "accepted",
|
|
1188
|
-
* reason: "All documents verified successfully"
|
|
1189
|
-
* });
|
|
1190
|
-
*
|
|
1191
|
-
* // Decline a KYC request
|
|
1192
|
-
* await client.updateKycStatus({
|
|
1193
|
-
* reference: "kyc-ref-456",
|
|
1194
|
-
* status: "declined",
|
|
1195
|
-
* reason: "Document expired"
|
|
1196
|
-
* });
|
|
1197
|
-
* ```
|
|
1198
|
-
*/
|
|
1199
|
-
updateKycStatus(request: UpdateKycStatusRequest): Promise<void>;
|
|
1200
1261
|
/**
|
|
1201
1262
|
* Request additional documents from customer
|
|
1202
1263
|
*
|
|
@@ -1219,43 +1280,22 @@ declare class KycClient extends BaseClient {
|
|
|
1219
1280
|
/**
|
|
1220
1281
|
* Get downloadable URLs for KYC proofs/documents
|
|
1221
1282
|
*
|
|
1222
|
-
*
|
|
1223
|
-
*
|
|
1283
|
+
* Derived from the `proofs` of `getKycRequest`: the platform attaches a
|
|
1284
|
+
* short-lived download link to every proof on the KYC record, so no
|
|
1285
|
+
* separate endpoint is needed. Proofs without a link are omitted.
|
|
1286
|
+
*
|
|
1287
|
+
* @param kycId - KYC record ID
|
|
1288
|
+
* @returns Array of proof download URLs
|
|
1224
1289
|
*
|
|
1225
1290
|
* @example
|
|
1226
1291
|
* ```typescript
|
|
1227
1292
|
* const proofs = await client.getProofDownloadURLs("550e8400-e29b-41d4-a716-446655440000");
|
|
1228
1293
|
* proofs.forEach(proof => {
|
|
1229
|
-
* console.log(`${proof.type}: ${proof.url}
|
|
1294
|
+
* console.log(`${proof.type}: ${proof.url}`);
|
|
1230
1295
|
* });
|
|
1231
1296
|
* ```
|
|
1232
1297
|
*/
|
|
1233
1298
|
getProofDownloadURLs(kycId: string): Promise<ProofDownloadURL[]>;
|
|
1234
|
-
/**
|
|
1235
|
-
* Get KYC overview statistics
|
|
1236
|
-
*
|
|
1237
|
-
* @param fromDate - Optional start date (ISO 8601)
|
|
1238
|
-
* @param toDate - Optional end date (ISO 8601)
|
|
1239
|
-
* @returns KYC statistics including counts by status
|
|
1240
|
-
*
|
|
1241
|
-
* @example
|
|
1242
|
-
* ```typescript
|
|
1243
|
-
* const overview = await client.getOverview(
|
|
1244
|
-
* "2024-01-01T00:00:00Z",
|
|
1245
|
-
* "2024-12-31T23:59:59Z"
|
|
1246
|
-
* );
|
|
1247
|
-
* console.log(`Total: ${overview.total}, Pending: ${overview.pending}`);
|
|
1248
|
-
* console.log(`Approved: ${overview.approved}, Rejected: ${overview.rejected}`);
|
|
1249
|
-
* ```
|
|
1250
|
-
*/
|
|
1251
|
-
getOverview(fromDate?: string, toDate?: string): Promise<KycOverview>;
|
|
1252
|
-
/**
|
|
1253
|
-
* Get a KYC alert by ID
|
|
1254
|
-
*
|
|
1255
|
-
* @param alertId - Alert ID
|
|
1256
|
-
* @returns Alert details
|
|
1257
|
-
*/
|
|
1258
|
-
getAlert(alertId: string): Promise<KycAlert>;
|
|
1259
1299
|
/**
|
|
1260
1300
|
* List KYC alerts with filters and pagination
|
|
1261
1301
|
*
|
|
@@ -1275,57 +1315,18 @@ declare class KycClient extends BaseClient {
|
|
|
1275
1315
|
* );
|
|
1276
1316
|
* console.log(`Found ${alerts.total} alerts`);
|
|
1277
1317
|
* ```
|
|
1278
|
-
*/
|
|
1279
|
-
listAlerts(filters?: KycAlertFilters, pagination?: PaginationParams): Promise<KycAlertListResponse>;
|
|
1280
|
-
/**
|
|
1281
|
-
* Update a KYC alert
|
|
1282
|
-
*
|
|
1283
|
-
* @param alertId - Alert ID
|
|
1284
|
-
* @param update - Fields to update (status, assigned_for, reason, alert_type)
|
|
1285
|
-
*
|
|
1286
|
-
* @example
|
|
1287
|
-
* ```typescript
|
|
1288
|
-
* // Assign an alert
|
|
1289
|
-
* await client.updateAlert("alert_123", {
|
|
1290
|
-
* assigned_for: "analyst_user_id",
|
|
1291
|
-
* status: "in_progress"
|
|
1292
|
-
* });
|
|
1293
|
-
*
|
|
1294
|
-
* // Resolve an alert
|
|
1295
|
-
* await client.updateAlert("alert_123", {
|
|
1296
|
-
* status: "resolved",
|
|
1297
|
-
* reason: "Customer verified via phone call"
|
|
1298
|
-
* });
|
|
1299
|
-
*
|
|
1300
|
-
* // Escalate an alert
|
|
1301
|
-
* await client.updateAlert("alert_123", {
|
|
1302
|
-
* status: "escalated",
|
|
1303
|
-
* assigned_for: "manager_user_id",
|
|
1304
|
-
* reason: "Requires senior review - suspicious documents"
|
|
1305
|
-
* });
|
|
1306
|
-
* ```
|
|
1307
|
-
*/
|
|
1308
|
-
updateAlert(alertId: string, update: UpdateKycAlertRequest): Promise<void>;
|
|
1309
|
-
/**
|
|
1310
|
-
* Get KYC preferences for the tenant
|
|
1311
|
-
*
|
|
1312
|
-
* @returns KYC preferences configuration
|
|
1313
1318
|
*
|
|
1314
|
-
* @
|
|
1315
|
-
*
|
|
1316
|
-
*
|
|
1317
|
-
* console.log(`Face verification required: ${prefs.is_face_verification_required}`);
|
|
1318
|
-
* console.log(`Required documents: ${prefs.required_document_count}`);
|
|
1319
|
-
* ```
|
|
1319
|
+
* @remarks Console session only. This endpoint accepts a Vesant console
|
|
1320
|
+
* (dashboard login) token, not a tenant API key; called with an API key it
|
|
1321
|
+
* fails with `AuthenticationError` or a permission error.
|
|
1320
1322
|
*/
|
|
1321
|
-
|
|
1323
|
+
listAlerts(filters?: KycAlertFilters, pagination?: PaginationParams): Promise<KycAlertListResponse>;
|
|
1322
1324
|
/**
|
|
1323
1325
|
* Update KYC preferences for the tenant
|
|
1324
1326
|
*
|
|
1325
1327
|
* @deprecated KYC preferences are managed in the Vesant console; the
|
|
1326
1328
|
* platform exposes no update operation to the SDK, so this call always
|
|
1327
|
-
* fails.
|
|
1328
|
-
* in a future release.
|
|
1329
|
+
* fails. This method will be removed in a future release.
|
|
1329
1330
|
*
|
|
1330
1331
|
* @param update - Fields to update
|
|
1331
1332
|
* @returns Updated preferences
|
|
@@ -1415,4 +1416,4 @@ declare class KycClient extends BaseClient {
|
|
|
1415
1416
|
createCustomerProfile(profile: CreateProfileRequest): Promise<CustomerProfile>;
|
|
1416
1417
|
}
|
|
1417
1418
|
|
|
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
|
|
1419
|
+
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 KycPagination, type KycPreferences, type KycRequest, 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 UpdateKycPreferencesRequest, type UseKycAlertsOptions, type UseKycAlertsResult, type UseKycSubmissionOptions, type UseKycSubmissionResult, isKycDocumentExpiredCallbackEvent, isKycStatusCallbackEvent, isProfileChangeCallbackEvent };
|