vesant-sdk 1.7.1 → 1.7.2-dev.03a9c84
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 +4 -0
- package/dist/{client-D23KhWeh.d.mts → client-5q4whhGu.d.mts} +1 -1
- package/dist/{client-fy3trF2K.d.ts → client-BaUekQT8.d.ts} +32 -10
- package/dist/{client-B3DCAHlg.d.ts → client-DUHC-68_.d.ts} +1 -1
- package/dist/{client-BwXMQA2a.d.mts → client-XDEhh9VN.d.mts} +32 -10
- package/dist/compliance/index.d.mts +2 -2
- package/dist/compliance/index.d.ts +2 -2
- package/dist/compliance/index.js +40 -2
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +40 -2
- package/dist/compliance/index.mjs.map +1 -1
- package/dist/decisions/index.js +1 -1
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisions/index.mjs +1 -1
- 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 +40 -2
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +40 -2
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index.d.mts +4 -4
- package/dist/index.d.ts +4 -4
- package/dist/index.js +114 -31
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +114 -32
- package/dist/index.mjs.map +1 -1
- package/dist/kyc/core.d.mts +1 -1
- package/dist/kyc/core.d.ts +1 -1
- package/dist/kyc/core.js +75 -30
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +75 -31
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +316 -60
- package/dist/kyc/index.d.ts +316 -60
- package/dist/kyc/index.js +75 -30
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +75 -31
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +126 -48
- package/dist/react.d.ts +126 -48
- package/dist/react.js +255 -36
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +253 -37
- package/dist/react.mjs.map +1 -1
- package/dist/risk-profile/index.js +1 -1
- package/dist/risk-profile/index.js.map +1 -1
- package/dist/risk-profile/index.mjs +1 -1
- package/dist/risk-profile/index.mjs.map +1 -1
- package/dist/scores/index.js +1 -1
- package/dist/scores/index.js.map +1 -1
- package/dist/scores/index.mjs +1 -1
- package/dist/scores/index.mjs.map +1 -1
- package/dist/tax/index.js +1 -1
- package/dist/tax/index.js.map +1 -1
- package/dist/tax/index.mjs +1 -1
- package/dist/tax/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/kyc/index.d.mts
CHANGED
|
@@ -23,6 +23,8 @@ type KycAlertType = 'kyc' | 'fraud';
|
|
|
23
23
|
type DocumentType = 'id_card' | 'driving_license' | 'passport';
|
|
24
24
|
type ProofType = 'document' | 'document_two' | 'face' | 'address' | 'additional_document';
|
|
25
25
|
type SupportedDocumentType = 'id_card' | 'passport' | 'driving_license';
|
|
26
|
+
/** Document types a tenant can accept as proof of address. */
|
|
27
|
+
type SupportedAddressDocumentType = 'id_card' | 'passport' | 'driving_license' | 'utility_bill' | 'bank_statement' | 'rent_agreement' | 'employer_letter' | 'insurance_agreement' | 'tax_bill' | 'envelope' | 'cpr_smart_card_reader_copy' | 'property_tax' | 'lease_agreement' | 'insurance_card' | 'permanent_residence_permit' | 'credit_card_statement' | 'insurance_policy' | 'e_commerce_receipt' | 'bank_letter_receipt' | 'birth_certificate' | 'salary_slip';
|
|
26
28
|
interface KycRequest {
|
|
27
29
|
id: string;
|
|
28
30
|
reference: string;
|
|
@@ -34,6 +36,35 @@ interface KycRequest {
|
|
|
34
36
|
dob?: string;
|
|
35
37
|
full_address?: string;
|
|
36
38
|
email?: string;
|
|
39
|
+
gender?: string;
|
|
40
|
+
height?: string;
|
|
41
|
+
country?: string;
|
|
42
|
+
country_code?: string;
|
|
43
|
+
nationality?: string;
|
|
44
|
+
authority?: string;
|
|
45
|
+
document_type?: string;
|
|
46
|
+
document_number?: string;
|
|
47
|
+
personal_number?: string;
|
|
48
|
+
place_of_birth?: string;
|
|
49
|
+
issue_date?: string;
|
|
50
|
+
expiry_date?: string;
|
|
51
|
+
age?: number;
|
|
52
|
+
document_two_type?: string;
|
|
53
|
+
document_two_number?: string;
|
|
54
|
+
document_two_first_name?: string;
|
|
55
|
+
document_two_middle_name?: string;
|
|
56
|
+
document_two_last_name?: string;
|
|
57
|
+
document_two_dob?: string;
|
|
58
|
+
document_two_gender?: string;
|
|
59
|
+
document_two_height?: string;
|
|
60
|
+
document_two_country?: string;
|
|
61
|
+
document_two_country_code?: string;
|
|
62
|
+
document_two_nationality?: string;
|
|
63
|
+
document_two_authority?: string;
|
|
64
|
+
document_two_personal_number?: string;
|
|
65
|
+
document_two_place_of_birth?: string;
|
|
66
|
+
document_two_issue_date?: string;
|
|
67
|
+
document_two_expiry_date?: string;
|
|
37
68
|
id_verified: boolean;
|
|
38
69
|
address_verified: boolean;
|
|
39
70
|
face_verified: boolean;
|
|
@@ -41,8 +72,13 @@ interface KycRequest {
|
|
|
41
72
|
status: KycStatus;
|
|
42
73
|
location?: string;
|
|
43
74
|
identity_hash?: string;
|
|
75
|
+
/** True when verification could not run because of an internal failure. */
|
|
76
|
+
is_internal_error?: boolean;
|
|
77
|
+
/** The `trigger_event` the submit link was requested with. */
|
|
78
|
+
event?: string;
|
|
44
79
|
required_document_count: number;
|
|
45
80
|
supported_document_types?: SupportedDocumentType[];
|
|
81
|
+
supported_address_document_types?: SupportedAddressDocumentType[];
|
|
46
82
|
is_id_verification_required: boolean;
|
|
47
83
|
is_face_verification_required: boolean;
|
|
48
84
|
is_address_verification_required: boolean;
|
|
@@ -188,27 +224,70 @@ interface EventBasedFaceVerificationTriggers {
|
|
|
188
224
|
account_balance_transfer: boolean;
|
|
189
225
|
}
|
|
190
226
|
/**
|
|
191
|
-
*
|
|
192
|
-
*
|
|
193
|
-
* `enforce_logout
|
|
194
|
-
*
|
|
227
|
+
* Retry budget for Event-Based Face Verification. This is the only field the
|
|
228
|
+
* platform stores here; the reactions taken when the budget is exhausted
|
|
229
|
+
* (`trigger_alert`, `enforce_logout`, `freeze_account`, `block`,
|
|
230
|
+
* `freeze_duration_minutes`) come from the tenant's per-event KYC alert
|
|
231
|
+
* configuration and are reported on
|
|
232
|
+
* {@link EventBasedFaceVerificationReactionResult}.
|
|
195
233
|
*/
|
|
196
234
|
interface EventBasedFaceVerificationReactions {
|
|
197
235
|
/** Retries after the first attempt; total submissions = this + 1. */
|
|
198
236
|
max_retry_attempts: number;
|
|
199
|
-
trigger_alert
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
237
|
+
/** @deprecated Never populated; read `data.trigger_alert` on the callback instead. */
|
|
238
|
+
trigger_alert?: boolean;
|
|
239
|
+
/** @deprecated Never populated; read `data.enforce_logout` on the callback instead. */
|
|
240
|
+
enforce_logout?: boolean;
|
|
241
|
+
/** @deprecated Never populated; read `data.freeze_account` on the callback instead. */
|
|
242
|
+
freeze_account?: boolean;
|
|
243
|
+
/** @deprecated Never populated; read `data.freeze_duration_minutes` on the callback instead. */
|
|
244
|
+
freeze_duration_minutes?: number;
|
|
245
|
+
}
|
|
246
|
+
/** Per-event toggles that decide when a submit-link request requires KYC. */
|
|
247
|
+
interface KycVerificationTriggers {
|
|
248
|
+
onboarding: boolean;
|
|
249
|
+
first_withdrawal: boolean;
|
|
250
|
+
first_purchase: boolean;
|
|
251
|
+
/** Re-trigger verification once the customer's identity document has expired. */
|
|
252
|
+
auto_trigger_on_id_expiration: boolean;
|
|
253
|
+
}
|
|
254
|
+
interface KycSkipOptions {
|
|
255
|
+
/** Let a `manual` trigger be skipped (`can_skip` on the submit-link response). */
|
|
256
|
+
allow_skip_on_manual: boolean;
|
|
257
|
+
}
|
|
258
|
+
/** Tenant-defined reasons available to reviewers for a given resource. */
|
|
259
|
+
interface KycOtherReason {
|
|
260
|
+
resource: string;
|
|
261
|
+
reasons: string[];
|
|
262
|
+
}
|
|
263
|
+
/** Disclosure text shown to the customer on the hosted submission page. */
|
|
264
|
+
interface KycDisclosureConsent {
|
|
265
|
+
data_collected: string[];
|
|
266
|
+
data_usage: string[];
|
|
267
|
+
data_sharing: {
|
|
268
|
+
third_party_providers: boolean;
|
|
269
|
+
regulatory_authorities: boolean;
|
|
270
|
+
internal_systems: boolean;
|
|
271
|
+
provider_names?: string[];
|
|
272
|
+
};
|
|
273
|
+
data_retention_period: string;
|
|
274
|
+
customer_rights: {
|
|
275
|
+
can_access: boolean;
|
|
276
|
+
can_correct: boolean;
|
|
277
|
+
can_delete: boolean;
|
|
278
|
+
contact_info?: string;
|
|
279
|
+
};
|
|
203
280
|
}
|
|
204
281
|
interface KycPreferences {
|
|
205
282
|
id: string;
|
|
206
283
|
tenant_id: string;
|
|
207
284
|
approve_kyc_reasons: string[];
|
|
285
|
+
other_reasons?: KycOtherReason[];
|
|
208
286
|
is_document_verification_required: boolean;
|
|
209
287
|
is_face_verification_required: boolean;
|
|
210
288
|
is_address_verification_required: boolean;
|
|
211
289
|
is_age_verification_required: boolean;
|
|
290
|
+
is_duplicate_verification_required?: boolean;
|
|
212
291
|
/** Master switch for the Event-Based Face Verification feature. */
|
|
213
292
|
is_reuse_kyc_enabled?: boolean;
|
|
214
293
|
min_age: number;
|
|
@@ -218,13 +297,34 @@ interface KycPreferences {
|
|
|
218
297
|
high_risk_score: number;
|
|
219
298
|
medium_risk_score: number;
|
|
220
299
|
supported_document_types: SupportedDocumentType[];
|
|
300
|
+
supported_address_document_types?: SupportedAddressDocumentType[];
|
|
301
|
+
/** Tenant-level callback URL used when a submit-link request passes none. */
|
|
302
|
+
callback_url?: string;
|
|
303
|
+
address_fuzzy_match?: boolean;
|
|
304
|
+
document_fuzzy_match?: boolean;
|
|
305
|
+
document_translate?: boolean;
|
|
306
|
+
decline_on_single_step?: boolean;
|
|
307
|
+
allow_warnings?: boolean;
|
|
308
|
+
backside_proof_required?: boolean;
|
|
309
|
+
document_two_backside_proof_required?: boolean;
|
|
310
|
+
verification_mode?: string;
|
|
311
|
+
document_upload_option?: boolean;
|
|
312
|
+
disclosure_consent?: KycDisclosureConsent;
|
|
313
|
+
/** Per-event toggles for document verification (`requestKycSubmitLink`). */
|
|
314
|
+
kyc_triggers?: KycVerificationTriggers;
|
|
315
|
+
kyc_skip_options?: KycSkipOptions;
|
|
221
316
|
/** Per-event triggers for Event-Based Face Verification. */
|
|
222
317
|
reuse_kyc_triggers?: EventBasedFaceVerificationTriggers;
|
|
223
|
-
/** Retry
|
|
318
|
+
/** Retry budget for Event-Based Face Verification. */
|
|
224
319
|
reuse_kyc_reactions?: EventBasedFaceVerificationReactions;
|
|
225
320
|
created_at: string;
|
|
226
321
|
updated_at: string;
|
|
227
322
|
}
|
|
323
|
+
/**
|
|
324
|
+
* @deprecated KYC preferences are managed in the Vesant console; the platform
|
|
325
|
+
* exposes no update operation to the SDK, so `updatePreferences` always fails.
|
|
326
|
+
* This type will be removed in a future release.
|
|
327
|
+
*/
|
|
228
328
|
interface UpdateKycPreferencesRequest {
|
|
229
329
|
reasons?: string[];
|
|
230
330
|
is_document_verification_required?: boolean;
|
|
@@ -306,15 +406,57 @@ interface DocumentVerificationResponse {
|
|
|
306
406
|
message?: string;
|
|
307
407
|
}
|
|
308
408
|
interface UpdateKycStatusRequest {
|
|
309
|
-
/**
|
|
409
|
+
/** Provider reference or KYC ID */
|
|
310
410
|
reference: string;
|
|
311
411
|
/** Target status */
|
|
312
412
|
status: KycStatus;
|
|
313
413
|
/** Acceptance/decline reason */
|
|
314
414
|
reason?: string;
|
|
315
|
-
/**
|
|
415
|
+
/** Provider warnings data */
|
|
316
416
|
warnings?: Record<string, Record<string, string>>;
|
|
317
417
|
}
|
|
418
|
+
/**
|
|
419
|
+
* 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).
|
|
422
|
+
*/
|
|
423
|
+
type KycTriggerEvent = 'onboarding' | 'first_withdrawal' | 'first_purchase'
|
|
424
|
+
/** Aliases of `first_withdrawal` / `first_purchase` — same tenant toggles. */
|
|
425
|
+
| 'withdrawal' | 'purchase' | 'manual'
|
|
426
|
+
/**
|
|
427
|
+
* The customer is signing in. Answers for any state: never verified (asked,
|
|
428
|
+
* not skippable, per the tenant's onboarding policy), document expired
|
|
429
|
+
* (asked, skippable — "Remind me later"), or verified with a valid document
|
|
430
|
+
* (not asked). One call covers every customer.
|
|
431
|
+
*/
|
|
432
|
+
| 'login';
|
|
433
|
+
/**
|
|
434
|
+
* Why verification is — or is not — being asked for. Codes are stable;
|
|
435
|
+
* `message` is display-ready text you can show the customer as-is.
|
|
436
|
+
*/
|
|
437
|
+
interface KycRequestReason {
|
|
438
|
+
code: KycRequestReasonCode | (string & Record<string, never>);
|
|
439
|
+
message: string;
|
|
440
|
+
}
|
|
441
|
+
/**
|
|
442
|
+
* Reason codes returned by `requestKycSubmitLink`. Treat unrecognised codes
|
|
443
|
+
* as "verification required" and fall back to `message` for display.
|
|
444
|
+
*/
|
|
445
|
+
type KycRequestReasonCode =
|
|
446
|
+
/** Required to complete registration. */
|
|
447
|
+
'KYC_REQUIRED_ONBOARDING'
|
|
448
|
+
/** Required before the customer's first withdrawal. */
|
|
449
|
+
| 'KYC_REQUIRED_FIRST_WITHDRAWAL'
|
|
450
|
+
/** Required before the customer's first purchase. */
|
|
451
|
+
| 'KYC_REQUIRED_FIRST_PURCHASE'
|
|
452
|
+
/** The customer's identity document has expired and must be re-verified. */
|
|
453
|
+
| 'KYC_REQUIRED_ID_EXPIRED'
|
|
454
|
+
/** Verification was explicitly requested by the tenant. */
|
|
455
|
+
| 'KYC_REQUIRED_MANUAL'
|
|
456
|
+
/** Not required — the customer already has an accepted verification. */
|
|
457
|
+
| 'KYC_NOT_REQUIRED_ALREADY_VERIFIED'
|
|
458
|
+
/** Not required — the tenant has this trigger event switched off. */
|
|
459
|
+
| 'KYC_NOT_REQUIRED_TRIGGER_DISABLED';
|
|
318
460
|
interface RequestKycSubmitLinkRequest {
|
|
319
461
|
/** User ID to generate KYC submission link for */
|
|
320
462
|
user_id: string;
|
|
@@ -323,14 +465,20 @@ interface RequestKycSubmitLinkRequest {
|
|
|
323
465
|
/** URL to receive callback notifications via POST request when KYC status changes (optional) */
|
|
324
466
|
callback_url?: string;
|
|
325
467
|
/**
|
|
326
|
-
* Event that triggered the KYC request.
|
|
327
|
-
*
|
|
328
|
-
*
|
|
329
|
-
*
|
|
330
|
-
*
|
|
468
|
+
* Event that triggered the KYC request. The tenant's KYC verification
|
|
469
|
+
* 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"
|
|
472
|
+
* answers for any customer state — never verified (asked, not skippable),
|
|
473
|
+
* document expired (asked, skippable so you can offer "Remind me later"),
|
|
474
|
+
* or verified and valid (not asked) — so a platform that gates entry on KYC
|
|
475
|
+
* needs only this one call at sign-in. The same expired document is *not*
|
|
476
|
+
* skippable on withdrawal / purchase events: it is enforced on
|
|
477
|
+
* "first_withdrawal", "withdrawal", "first_purchase" and "purchase" alike,
|
|
478
|
+
* so keep sending whichever of those you already send.
|
|
331
479
|
* Omitted or unknown values default to KYC required with no skip.
|
|
332
480
|
*/
|
|
333
|
-
trigger_event?: string;
|
|
481
|
+
trigger_event?: KycTriggerEvent | (string & Record<string, never>);
|
|
334
482
|
/**
|
|
335
483
|
* Registered customer identity data (optional). Seeds the customer's risk
|
|
336
484
|
* profile so document verification can cross-check the submitted document
|
|
@@ -442,12 +590,57 @@ interface RequestKycSubmitLinkResponse {
|
|
|
442
590
|
*/
|
|
443
591
|
kyc_required: boolean;
|
|
444
592
|
/**
|
|
445
|
-
* Whether the user may skip verification.
|
|
593
|
+
* Whether the user may skip verification. `true` for
|
|
446
594
|
* `trigger_event: "manual"` when the tenant enables allow-skip-on-manual,
|
|
447
|
-
*
|
|
595
|
+
* for `"login"` when an expired identity document triggered the request
|
|
596
|
+
* (offer "Remind me later"), and when the customer is already verified.
|
|
597
|
+
* Always `false` at `"withdrawal"` / `"purchase"` — that is where a
|
|
598
|
+
* postponed re-verification becomes mandatory.
|
|
448
599
|
*/
|
|
449
600
|
can_skip: boolean;
|
|
601
|
+
/**
|
|
602
|
+
* Why verification is — or is not — being asked for. Use `reason.code` to
|
|
603
|
+
* branch (for example `KYC_REQUIRED_ID_EXPIRED` warrants a different prompt
|
|
604
|
+
* than a first-time verification) and `reason.message` for display.
|
|
605
|
+
*/
|
|
606
|
+
reason?: KycRequestReason;
|
|
450
607
|
}
|
|
608
|
+
/**
|
|
609
|
+
* Body POSTed to your `callback_url` when a customer's identity document
|
|
610
|
+
* passes its expiry date. Signed with `X-Webhook-Signature: sha256=<hex>`
|
|
611
|
+
* (HMAC-SHA256 of the raw body), like every other Vesant callback.
|
|
612
|
+
*
|
|
613
|
+
* An expiry happens on a **date**, not on a customer action, so this webhook
|
|
614
|
+
* is the only signal for it — nothing the customer does triggers it. Delivered
|
|
615
|
+
* once per customer, when the document first becomes expired.
|
|
616
|
+
*
|
|
617
|
+
* It is sent regardless of the tenant's auto-trigger-on-ID-expiration setting:
|
|
618
|
+
* that setting governs whether verification is *enforced*, not whether you are
|
|
619
|
+
* *told*.
|
|
620
|
+
*/
|
|
621
|
+
interface KycDocumentExpiredCallbackEvent {
|
|
622
|
+
/** Always `"kyc_document_expired"` — dispatch on this. */
|
|
623
|
+
event: 'kyc_document_expired';
|
|
624
|
+
/** Your customer identifier (the `user_id` you supplied). */
|
|
625
|
+
reference: string;
|
|
626
|
+
/** The customer's risk-profile ID. */
|
|
627
|
+
resource_id: string;
|
|
628
|
+
/**
|
|
629
|
+
* Always `"expired"`. Describes the document — not the customer's KYC
|
|
630
|
+
* status, which remains `accepted` until they re-verify.
|
|
631
|
+
*/
|
|
632
|
+
status: 'expired';
|
|
633
|
+
data: {
|
|
634
|
+
customer_id: string;
|
|
635
|
+
/** The document's expiry date (ISO 8601 `YYYY-MM-DD`). */
|
|
636
|
+
id_expiry_date: string;
|
|
637
|
+
};
|
|
638
|
+
}
|
|
639
|
+
/**
|
|
640
|
+
* Type guard for the identity-document expiry webhook. Narrows an already
|
|
641
|
+
* signature-verified, parsed payload to {@link KycDocumentExpiredCallbackEvent}.
|
|
642
|
+
*/
|
|
643
|
+
declare function isKycDocumentExpiredCallbackEvent(value: unknown): value is KycDocumentExpiredCallbackEvent;
|
|
451
644
|
/** Device class detected by the SDK (purely client-side — server doesn't care). */
|
|
452
645
|
type EventBasedFaceVerificationDeviceType = 'mobile' | 'desktop';
|
|
453
646
|
interface CreateEventBasedFaceVerificationSessionResponse {
|
|
@@ -478,6 +671,13 @@ interface CreateEventBasedFaceVerificationSessionResponse {
|
|
|
478
671
|
* (`reuse_kyc_reactions.max_retry_attempts + 1`).
|
|
479
672
|
*/
|
|
480
673
|
max_attempts: number;
|
|
674
|
+
/**
|
|
675
|
+
* Hosted verification journey URL. When present, the capture runs on a
|
|
676
|
+
* hosted page (embedded by `FaceCaptureModal` in an iframe) instead of the
|
|
677
|
+
* SDK's local camera; the verdict is read via the session status poll.
|
|
678
|
+
* Absent when the platform runs the local-capture flow.
|
|
679
|
+
*/
|
|
680
|
+
verification_url?: string;
|
|
481
681
|
}
|
|
482
682
|
/**
|
|
483
683
|
* Reaction outcome returned on every face-submit callback. Tenant apps
|
|
@@ -517,18 +717,23 @@ interface EventBasedFaceVerificationCallback {
|
|
|
517
717
|
block?: boolean;
|
|
518
718
|
/** Names the event/verification that triggered the block. Omitted when not blocked. */
|
|
519
719
|
block_reason?: string;
|
|
520
|
-
/**
|
|
720
|
+
/**
|
|
721
|
+
* Structured decline reasons. Returned by
|
|
722
|
+
* `getEventBasedFaceVerificationSessionStatus`; the submit response and the
|
|
723
|
+
* webhook carry {@link declined_reason} only.
|
|
724
|
+
*/
|
|
521
725
|
declined_reasons?: Reason[];
|
|
522
|
-
/**
|
|
726
|
+
/** Decline text. Present on the submit response, the webhook, and status lookups. */
|
|
523
727
|
declined_reason?: string;
|
|
524
728
|
/** @deprecated Use structured reasons. */
|
|
525
729
|
warnings?: Record<string, Record<string, string>>;
|
|
526
730
|
data: EventBasedFaceVerificationReactionResult;
|
|
527
731
|
}
|
|
528
732
|
/**
|
|
529
|
-
* Server-side handoff
|
|
530
|
-
*
|
|
531
|
-
*
|
|
733
|
+
* Server-side handoff state backed by the normal KYC Redis store (15-minute
|
|
734
|
+
* cache TTL). Event-Based Face Verification remains valid for 10 minutes;
|
|
735
|
+
* this cache does not extend that session. Desktop clients poll it to detect
|
|
736
|
+
* when a mobile device has attached to the same token via QR.
|
|
532
737
|
*/
|
|
533
738
|
interface KycHandoffSession {
|
|
534
739
|
document: string;
|
|
@@ -551,7 +756,9 @@ interface CheckKycStatusRequest {
|
|
|
551
756
|
/**
|
|
552
757
|
* Response from checkKycStatus. Always returns the same shape.
|
|
553
758
|
*
|
|
554
|
-
* `additional_data` is `null`
|
|
759
|
+
* `additional_data` is absent or `null` while `status` is `'awaiting_kyc'` or
|
|
760
|
+
* `'pending'` — the key is omitted on a newly created record, so guard with a
|
|
761
|
+
* truthiness check (`if (result.additional_data)`), never `!== null`.
|
|
555
762
|
* Otherwise it contains the full KYC record including document details,
|
|
556
763
|
* proofs, and the customer's risk profile.
|
|
557
764
|
*
|
|
@@ -568,27 +775,39 @@ interface CheckKycStatusResponse {
|
|
|
568
775
|
address_verified: boolean;
|
|
569
776
|
face_verified: boolean;
|
|
570
777
|
age_verified: boolean;
|
|
571
|
-
/**
|
|
778
|
+
/**
|
|
779
|
+
* Structured decline reasons. The platform currently returns these only on
|
|
780
|
+
* the full record: read `additional_data.declined_reasons` and fall back to
|
|
781
|
+
* {@link declined_reason}. This top-level field is reserved and not populated.
|
|
782
|
+
*/
|
|
572
783
|
declined_reasons?: Reason[];
|
|
573
|
-
/**
|
|
784
|
+
/**
|
|
785
|
+
* Structured, non-blocking warnings. Currently returned only as
|
|
786
|
+
* `additional_data.warning_reasons`; this top-level field is not populated.
|
|
787
|
+
*/
|
|
574
788
|
warning_reasons?: Reason[];
|
|
575
|
-
/**
|
|
789
|
+
/** Comma-joined decline text. Always present on a declined response. */
|
|
576
790
|
declined_reason?: string;
|
|
577
|
-
/**
|
|
791
|
+
/** Legacy decline code; prefer the `code` on `additional_data.declined_reasons`. */
|
|
578
792
|
declined_code?: KycDeclinedCode;
|
|
579
793
|
other_reason?: string;
|
|
580
794
|
accepted_reason?: string;
|
|
581
|
-
/**
|
|
795
|
+
/** Legacy warning map; prefer `additional_data.warning_reasons`. */
|
|
582
796
|
warnings?: Record<string, Record<string, string>>;
|
|
583
797
|
required_document_count: number;
|
|
584
798
|
supported_document_types?: SupportedDocumentType[];
|
|
799
|
+
supported_address_document_types?: SupportedAddressDocumentType[];
|
|
585
800
|
is_id_verification_required: boolean;
|
|
586
801
|
is_face_verification_required: boolean;
|
|
587
802
|
is_address_verification_required: boolean;
|
|
588
803
|
is_age_verification_required: boolean;
|
|
589
804
|
created_at: string;
|
|
590
|
-
/**
|
|
591
|
-
|
|
805
|
+
/**
|
|
806
|
+
* Full KYC record with document details, proofs, and risk profile. Absent or
|
|
807
|
+
* `null` while status is 'awaiting_kyc' or 'pending': the key is omitted on
|
|
808
|
+
* a newly created record, so check truthiness rather than comparing to null.
|
|
809
|
+
*/
|
|
810
|
+
additional_data?: KycRequest | null;
|
|
592
811
|
/** Present when status is 'awaiting_kyc': whether the submit link has expired (request a new one when true). */
|
|
593
812
|
link_expired?: boolean;
|
|
594
813
|
/** Present when status is 'awaiting_kyc': the submit link's expiry time (RFC 3339). */
|
|
@@ -710,6 +929,7 @@ interface UseKycOverviewResult extends BaseHookState {
|
|
|
710
929
|
}
|
|
711
930
|
interface UseKycPreferencesResult extends BaseHookState {
|
|
712
931
|
preferences: KycPreferences | null;
|
|
932
|
+
/** @deprecated The platform exposes no preference-update operation; this call always fails. */
|
|
713
933
|
updatePreferences: (update: UpdateKycPreferencesRequest) => Promise<void>;
|
|
714
934
|
refresh: () => Promise<void>;
|
|
715
935
|
}
|
|
@@ -728,8 +948,9 @@ interface UseKycPreferencesResult extends BaseHookState {
|
|
|
728
948
|
* - Automatic timeout management
|
|
729
949
|
* - Debug logging
|
|
730
950
|
*
|
|
731
|
-
*
|
|
732
|
-
*
|
|
951
|
+
* Read calls use requestWithRetry() to ride out transient failures.
|
|
952
|
+
* Calls that create or bill something (submit link, document submit,
|
|
953
|
+
* face session, face submit, hosted journey retry) are made exactly once.
|
|
733
954
|
*/
|
|
734
955
|
declare class KycClient extends BaseClient {
|
|
735
956
|
private userId?;
|
|
@@ -752,19 +973,27 @@ declare class KycClient extends BaseClient {
|
|
|
752
973
|
*
|
|
753
974
|
* Generates a link that the user can visit to submit their KYC documents.
|
|
754
975
|
*
|
|
976
|
+
* Pass the `trigger_event` that matches the user action so the tenant's
|
|
977
|
+
* trigger preferences decide whether verification is required; inspect
|
|
978
|
+
* `kyc_required` and `reason` on the response before redirecting.
|
|
979
|
+
*
|
|
755
980
|
* Optionally pass the customer's registered identity data as
|
|
756
981
|
* `customer_data` (same shape as the geolocation `customer_data` block).
|
|
757
982
|
* It seeds the customer's risk profile so document verification can
|
|
758
983
|
* cross-check the submitted document against trusted reference data;
|
|
759
984
|
* fields never overwrite data already on the profile.
|
|
760
985
|
*
|
|
761
|
-
*
|
|
762
|
-
*
|
|
986
|
+
* The call is made once and is not retried: each request creates a new
|
|
987
|
+
* KYC record and link, so a retry after a timeout would leave duplicates.
|
|
988
|
+
*
|
|
989
|
+
* @param request - Request containing the user ID, trigger event, optional redirect URL, optional callback URL (receives POST requests), and optional customer identity data
|
|
990
|
+
* @returns Response containing the redirect link, KYC ID, `kyc_required`, `can_skip` and `reason`
|
|
763
991
|
*
|
|
764
992
|
* @example
|
|
765
993
|
* ```typescript
|
|
766
994
|
* const result = await client.requestKycSubmitLink({
|
|
767
995
|
* user_id: "user_123",
|
|
996
|
+
* trigger_event: "onboarding",
|
|
768
997
|
* redirect_url: "https://merchant.com/kyc-complete", // optional
|
|
769
998
|
* callback_url: "https://merchant.com/api/kyc-webhook", // optional - receives POST requests on status change
|
|
770
999
|
* customer_data: { // optional - seeds the risk profile for document cross-checks
|
|
@@ -777,6 +1006,7 @@ declare class KycClient extends BaseClient {
|
|
|
777
1006
|
* }
|
|
778
1007
|
* });
|
|
779
1008
|
*
|
|
1009
|
+
* if (!result.kyc_required) return proceed();
|
|
780
1010
|
* console.log(`Redirect user to: ${result.link}`);
|
|
781
1011
|
* console.log(`KYC ID: ${result.kyc_id}`);
|
|
782
1012
|
* ```
|
|
@@ -786,10 +1016,9 @@ declare class KycClient extends BaseClient {
|
|
|
786
1016
|
* Create a Event-Based Face Verification session.
|
|
787
1017
|
*
|
|
788
1018
|
* Inspect the response before showing UI:
|
|
789
|
-
* - `is_required === false` → skip face
|
|
790
|
-
* - `
|
|
791
|
-
*
|
|
792
|
-
* - `device_type === 'mobile'` → open the face capture modal directly.
|
|
1019
|
+
* - `is_required === false` → skip face verification; `reason` explains why.
|
|
1020
|
+
* - `verification_url` present → embed the hosted journey and poll status.
|
|
1021
|
+
* - `verification_url` absent → use the local camera / QR fallback.
|
|
793
1022
|
*
|
|
794
1023
|
* @param request - Reference, customer_id, event, amount (for threshold events), optional URLs.
|
|
795
1024
|
*/
|
|
@@ -797,9 +1026,9 @@ declare class KycClient extends BaseClient {
|
|
|
797
1026
|
/**
|
|
798
1027
|
* Submit a real-time face capture for an active Event-Based Face Verification session.
|
|
799
1028
|
*
|
|
800
|
-
*
|
|
801
|
-
*
|
|
802
|
-
*
|
|
1029
|
+
* Works from any device: the platform does not inspect the User-Agent.
|
|
1030
|
+
* `FaceCaptureModal` decides between direct capture and the QR handoff
|
|
1031
|
+
* on the client; custom UIs may submit from desktop or mobile alike.
|
|
803
1032
|
*
|
|
804
1033
|
* The `data` field on the response carries `retries_remaining`,
|
|
805
1034
|
* `retry_limit_exceeded`, and the reaction flags (`enforce_logout`,
|
|
@@ -819,11 +1048,22 @@ declare class KycClient extends BaseClient {
|
|
|
819
1048
|
* @param token - The session token returned by `createEventBasedFaceVerificationSession`.
|
|
820
1049
|
*/
|
|
821
1050
|
getEventBasedFaceVerificationSessionStatus(token: string): Promise<EventBasedFaceVerificationCallback>;
|
|
1051
|
+
/**
|
|
1052
|
+
* Mint a fresh hosted verification journey for the next attempt on an
|
|
1053
|
+
* active session whose previous hosted-journey attempt was declined.
|
|
1054
|
+
* Only valid while the session is active and attempts remain; the
|
|
1055
|
+
* response carries the new `verification_url` to embed. Used internally
|
|
1056
|
+
* by `FaceCaptureModal`'s Try Again flow in hosted-journey mode.
|
|
1057
|
+
*
|
|
1058
|
+
* @param token - The session token returned by `createEventBasedFaceVerificationSession`.
|
|
1059
|
+
*/
|
|
1060
|
+
retryEventBasedFaceVerificationJourney(token: string): Promise<CreateEventBasedFaceVerificationSessionResponse>;
|
|
822
1061
|
/**
|
|
823
1062
|
* Fetch the Redis-backed handoff session for a token. Same backing
|
|
824
|
-
* store as normal KYC (`kyc:session:<token>`, 15-minute TTL).
|
|
825
|
-
*
|
|
826
|
-
*
|
|
1063
|
+
* store as normal KYC (`kyc:session:<token>`, 15-minute TTL). The
|
|
1064
|
+
* Event-Based Face Verification database session still expires after
|
|
1065
|
+
* 10 minutes. Desktop callers poll `mobile_connected` to detect when a
|
|
1066
|
+
* mobile device has scanned the QR and attached.
|
|
827
1067
|
*
|
|
828
1068
|
* @param token - The session token returned by `createEventBasedFaceVerificationSession`.
|
|
829
1069
|
*/
|
|
@@ -843,25 +1083,30 @@ declare class KycClient extends BaseClient {
|
|
|
843
1083
|
* Check KYC status for a user
|
|
844
1084
|
*
|
|
845
1085
|
* Returns the current KYC status:
|
|
846
|
-
* - "
|
|
847
|
-
* - "
|
|
848
|
-
* - "
|
|
849
|
-
* -
|
|
1086
|
+
* - "accepted" / "review.pending" → verified (limited access while under review)
|
|
1087
|
+
* - "pending" → documents submitted, verification running: keep polling
|
|
1088
|
+
* - "awaiting_kyc" → nothing submitted yet; check `link_expired` before
|
|
1089
|
+
* re-surfacing or re-requesting the link. Never treat as in progress.
|
|
1090
|
+
* - "declined" → show `additional_data.declined_reasons` (fallback
|
|
1091
|
+
* `declined_reason`) with a retry option
|
|
850
1092
|
*
|
|
851
|
-
* @param request - Request containing user_id and
|
|
852
|
-
* @returns Response with
|
|
1093
|
+
* @param request - Request containing user_id and kyc_id
|
|
1094
|
+
* @returns Response with status, verification flags and, once terminal, the full record in `additional_data`
|
|
853
1095
|
*
|
|
854
1096
|
* @example
|
|
855
1097
|
* ```typescript
|
|
856
1098
|
* const result = await client.checkKycStatus({
|
|
857
1099
|
* user_id: "user_123",
|
|
858
|
-
*
|
|
1100
|
+
* kyc_id: "550e8400-e29b-41d4-a716-446655440000"
|
|
859
1101
|
* });
|
|
860
1102
|
*
|
|
861
|
-
* if (result.
|
|
862
|
-
* //
|
|
863
|
-
* } else if (result.
|
|
1103
|
+
* if (result.status === 'accepted' || result.status === 'review.pending') {
|
|
1104
|
+
* // Grant access
|
|
1105
|
+
* } else if (result.status === 'declined') {
|
|
1106
|
+
* const reasons = result.additional_data?.declined_reasons;
|
|
864
1107
|
* // Show error + retry option
|
|
1108
|
+
* } else if (result.status === 'awaiting_kyc') {
|
|
1109
|
+
* // Prompt to verify; request a new link when result.link_expired is true
|
|
865
1110
|
* } else {
|
|
866
1111
|
* // Keep polling
|
|
867
1112
|
* }
|
|
@@ -871,7 +1116,9 @@ declare class KycClient extends BaseClient {
|
|
|
871
1116
|
/**
|
|
872
1117
|
* Submit a document verification request with OCR
|
|
873
1118
|
*
|
|
874
|
-
*
|
|
1119
|
+
* The call is made once and is not retried: every submission is processed
|
|
1120
|
+
* and billed, and the platform does not replay this route from an
|
|
1121
|
+
* idempotency key. Retry explicitly if the request fails.
|
|
875
1122
|
*
|
|
876
1123
|
* @param request - Document verification request with documents and customer info
|
|
877
1124
|
* @returns Verification response with status and reference
|
|
@@ -936,14 +1183,14 @@ declare class KycClient extends BaseClient {
|
|
|
936
1183
|
* ```typescript
|
|
937
1184
|
* // Accept a KYC request
|
|
938
1185
|
* await client.updateKycStatus({
|
|
939
|
-
* reference: "
|
|
1186
|
+
* reference: "kyc-ref-123",
|
|
940
1187
|
* status: "accepted",
|
|
941
1188
|
* reason: "All documents verified successfully"
|
|
942
1189
|
* });
|
|
943
1190
|
*
|
|
944
1191
|
* // Decline a KYC request
|
|
945
1192
|
* await client.updateKycStatus({
|
|
946
|
-
* reference: "
|
|
1193
|
+
* reference: "kyc-ref-456",
|
|
947
1194
|
* status: "declined",
|
|
948
1195
|
* reason: "Document expired"
|
|
949
1196
|
* });
|
|
@@ -953,6 +1200,10 @@ declare class KycClient extends BaseClient {
|
|
|
953
1200
|
/**
|
|
954
1201
|
* Request additional documents from customer
|
|
955
1202
|
*
|
|
1203
|
+
* @deprecated The platform does not expose this operation; the call always
|
|
1204
|
+
* fails. Request additional documents from the Vesant console instead.
|
|
1205
|
+
* This method will be removed in a future release.
|
|
1206
|
+
*
|
|
956
1207
|
* @param request - Request with KYC ID and document types needed
|
|
957
1208
|
*
|
|
958
1209
|
* @example
|
|
@@ -1071,6 +1322,11 @@ declare class KycClient extends BaseClient {
|
|
|
1071
1322
|
/**
|
|
1072
1323
|
* Update KYC preferences for the tenant
|
|
1073
1324
|
*
|
|
1325
|
+
* @deprecated KYC preferences are managed in the Vesant console; the
|
|
1326
|
+
* platform exposes no update operation to the SDK, so this call always
|
|
1327
|
+
* fails. Use `getPreferences()` to read them. This method will be removed
|
|
1328
|
+
* in a future release.
|
|
1329
|
+
*
|
|
1074
1330
|
* @param update - Fields to update
|
|
1075
1331
|
* @returns Updated preferences
|
|
1076
1332
|
*
|
|
@@ -1159,4 +1415,4 @@ declare class KycClient extends BaseClient {
|
|
|
1159
1415
|
createCustomerProfile(profile: CreateProfileRequest): Promise<CustomerProfile>;
|
|
1160
1416
|
}
|
|
1161
1417
|
|
|
1162
|
-
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 KycHandoffSession, type KycOverview, type KycPagination, type KycPreferences, type KycRequest, type KycRequestFilters, type KycRequestListResponse, type KycStatus, type Name, PaginationParams, type Proof, type ProofDownloadURL, type ProofType, type RequestAdditionalDocumentsRequest, type RequestKycSubmitLinkRequest, type RequestKycSubmitLinkResponse, RiskLevel, type SubmitEventBasedFaceVerificationSessionRequest, type SubmittedDocument, 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 };
|
|
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 };
|