vesant-sdk 1.7.2-dev.617dd44 → 1.7.2-dev.846d9c3
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 +39 -1
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +39 -1
- package/dist/compliance/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 +39 -1
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +39 -1
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +113 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +113 -31
- 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 +74 -29
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +74 -30
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +334 -65
- package/dist/kyc/index.d.ts +334 -65
- package/dist/kyc/index.js +74 -29
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +74 -30
- 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 +257 -35
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +255 -36
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/kyc/index.d.ts
CHANGED
|
@@ -11,7 +11,11 @@ import { B as BaseClient, R as RequestOptions } from '../client-q9fN8Hhf.js';
|
|
|
11
11
|
* - services/kyc-service/internal/handler/
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
|
-
type KycStatus =
|
|
14
|
+
type KycStatus =
|
|
15
|
+
/** Submit link issued but the customer has not submitted documents yet — not "in progress". */
|
|
16
|
+
'awaiting_kyc'
|
|
17
|
+
/** Documents submitted, verification in progress. */
|
|
18
|
+
| 'pending' | 'accepted' | 'declined' | 'review.pending' | 'unknown';
|
|
15
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';
|
|
16
20
|
declare const KYC_DECLINED_DESCRIPTIONS: Record<KycDeclinedCode, string>;
|
|
17
21
|
type KycAlertStatus = 'pending' | 'in_progress' | 'resolved' | 'closed' | 'escalated';
|
|
@@ -19,6 +23,8 @@ type KycAlertType = 'kyc' | 'fraud';
|
|
|
19
23
|
type DocumentType = 'id_card' | 'driving_license' | 'passport';
|
|
20
24
|
type ProofType = 'document' | 'document_two' | 'face' | 'address' | 'additional_document';
|
|
21
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';
|
|
22
28
|
interface KycRequest {
|
|
23
29
|
id: string;
|
|
24
30
|
reference: string;
|
|
@@ -30,6 +36,35 @@ interface KycRequest {
|
|
|
30
36
|
dob?: string;
|
|
31
37
|
full_address?: string;
|
|
32
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;
|
|
33
68
|
id_verified: boolean;
|
|
34
69
|
address_verified: boolean;
|
|
35
70
|
face_verified: boolean;
|
|
@@ -37,8 +72,13 @@ interface KycRequest {
|
|
|
37
72
|
status: KycStatus;
|
|
38
73
|
location?: string;
|
|
39
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;
|
|
40
79
|
required_document_count: number;
|
|
41
80
|
supported_document_types?: SupportedDocumentType[];
|
|
81
|
+
supported_address_document_types?: SupportedAddressDocumentType[];
|
|
42
82
|
is_id_verification_required: boolean;
|
|
43
83
|
is_face_verification_required: boolean;
|
|
44
84
|
is_address_verification_required: boolean;
|
|
@@ -184,27 +224,70 @@ interface EventBasedFaceVerificationTriggers {
|
|
|
184
224
|
account_balance_transfer: boolean;
|
|
185
225
|
}
|
|
186
226
|
/**
|
|
187
|
-
*
|
|
188
|
-
*
|
|
189
|
-
* `enforce_logout
|
|
190
|
-
*
|
|
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}.
|
|
191
233
|
*/
|
|
192
234
|
interface EventBasedFaceVerificationReactions {
|
|
193
235
|
/** Retries after the first attempt; total submissions = this + 1. */
|
|
194
236
|
max_retry_attempts: number;
|
|
195
|
-
trigger_alert
|
|
196
|
-
|
|
197
|
-
|
|
198
|
-
|
|
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
|
+
};
|
|
199
280
|
}
|
|
200
281
|
interface KycPreferences {
|
|
201
282
|
id: string;
|
|
202
283
|
tenant_id: string;
|
|
203
284
|
approve_kyc_reasons: string[];
|
|
285
|
+
other_reasons?: KycOtherReason[];
|
|
204
286
|
is_document_verification_required: boolean;
|
|
205
287
|
is_face_verification_required: boolean;
|
|
206
288
|
is_address_verification_required: boolean;
|
|
207
289
|
is_age_verification_required: boolean;
|
|
290
|
+
is_duplicate_verification_required?: boolean;
|
|
208
291
|
/** Master switch for the Event-Based Face Verification feature. */
|
|
209
292
|
is_reuse_kyc_enabled?: boolean;
|
|
210
293
|
min_age: number;
|
|
@@ -214,13 +297,34 @@ interface KycPreferences {
|
|
|
214
297
|
high_risk_score: number;
|
|
215
298
|
medium_risk_score: number;
|
|
216
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;
|
|
217
316
|
/** Per-event triggers for Event-Based Face Verification. */
|
|
218
317
|
reuse_kyc_triggers?: EventBasedFaceVerificationTriggers;
|
|
219
|
-
/** Retry
|
|
318
|
+
/** Retry budget for Event-Based Face Verification. */
|
|
220
319
|
reuse_kyc_reactions?: EventBasedFaceVerificationReactions;
|
|
221
320
|
created_at: string;
|
|
222
321
|
updated_at: string;
|
|
223
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
|
+
*/
|
|
224
328
|
interface UpdateKycPreferencesRequest {
|
|
225
329
|
reasons?: string[];
|
|
226
330
|
is_document_verification_required?: boolean;
|
|
@@ -302,15 +406,57 @@ interface DocumentVerificationResponse {
|
|
|
302
406
|
message?: string;
|
|
303
407
|
}
|
|
304
408
|
interface UpdateKycStatusRequest {
|
|
305
|
-
/**
|
|
409
|
+
/** Provider reference or KYC ID */
|
|
306
410
|
reference: string;
|
|
307
411
|
/** Target status */
|
|
308
412
|
status: KycStatus;
|
|
309
413
|
/** Acceptance/decline reason */
|
|
310
414
|
reason?: string;
|
|
311
|
-
/**
|
|
415
|
+
/** Provider warnings data */
|
|
312
416
|
warnings?: Record<string, Record<string, string>>;
|
|
313
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';
|
|
314
460
|
interface RequestKycSubmitLinkRequest {
|
|
315
461
|
/** User ID to generate KYC submission link for */
|
|
316
462
|
user_id: string;
|
|
@@ -319,14 +465,20 @@ interface RequestKycSubmitLinkRequest {
|
|
|
319
465
|
/** URL to receive callback notifications via POST request when KYC status changes (optional) */
|
|
320
466
|
callback_url?: string;
|
|
321
467
|
/**
|
|
322
|
-
* Event that triggered the KYC request.
|
|
323
|
-
*
|
|
324
|
-
*
|
|
325
|
-
*
|
|
326
|
-
*
|
|
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.
|
|
327
479
|
* Omitted or unknown values default to KYC required with no skip.
|
|
328
480
|
*/
|
|
329
|
-
trigger_event?: string;
|
|
481
|
+
trigger_event?: KycTriggerEvent | (string & Record<string, never>);
|
|
330
482
|
/**
|
|
331
483
|
* Registered customer identity data (optional). Seeds the customer's risk
|
|
332
484
|
* profile so document verification can cross-check the submitted document
|
|
@@ -438,12 +590,57 @@ interface RequestKycSubmitLinkResponse {
|
|
|
438
590
|
*/
|
|
439
591
|
kyc_required: boolean;
|
|
440
592
|
/**
|
|
441
|
-
* Whether the user may skip verification.
|
|
593
|
+
* Whether the user may skip verification. `true` for
|
|
442
594
|
* `trigger_event: "manual"` when the tenant enables allow-skip-on-manual,
|
|
443
|
-
*
|
|
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.
|
|
444
599
|
*/
|
|
445
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;
|
|
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
|
+
};
|
|
446
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;
|
|
447
644
|
/** Device class detected by the SDK (purely client-side — server doesn't care). */
|
|
448
645
|
type EventBasedFaceVerificationDeviceType = 'mobile' | 'desktop';
|
|
449
646
|
interface CreateEventBasedFaceVerificationSessionResponse {
|
|
@@ -474,6 +671,13 @@ interface CreateEventBasedFaceVerificationSessionResponse {
|
|
|
474
671
|
* (`reuse_kyc_reactions.max_retry_attempts + 1`).
|
|
475
672
|
*/
|
|
476
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;
|
|
477
681
|
}
|
|
478
682
|
/**
|
|
479
683
|
* Reaction outcome returned on every face-submit callback. Tenant apps
|
|
@@ -513,18 +717,23 @@ interface EventBasedFaceVerificationCallback {
|
|
|
513
717
|
block?: boolean;
|
|
514
718
|
/** Names the event/verification that triggered the block. Omitted when not blocked. */
|
|
515
719
|
block_reason?: string;
|
|
516
|
-
/**
|
|
720
|
+
/**
|
|
721
|
+
* Structured decline reasons. Returned by
|
|
722
|
+
* `getEventBasedFaceVerificationSessionStatus`; the submit response and the
|
|
723
|
+
* webhook carry {@link declined_reason} only.
|
|
724
|
+
*/
|
|
517
725
|
declined_reasons?: Reason[];
|
|
518
|
-
/**
|
|
726
|
+
/** Decline text. Present on the submit response, the webhook, and status lookups. */
|
|
519
727
|
declined_reason?: string;
|
|
520
728
|
/** @deprecated Use structured reasons. */
|
|
521
729
|
warnings?: Record<string, Record<string, string>>;
|
|
522
730
|
data: EventBasedFaceVerificationReactionResult;
|
|
523
731
|
}
|
|
524
732
|
/**
|
|
525
|
-
* Server-side handoff
|
|
526
|
-
*
|
|
527
|
-
*
|
|
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.
|
|
528
737
|
*/
|
|
529
738
|
interface KycHandoffSession {
|
|
530
739
|
document: string;
|
|
@@ -539,17 +748,24 @@ interface KycHandoffSession {
|
|
|
539
748
|
is_submitted: boolean;
|
|
540
749
|
}
|
|
541
750
|
interface CheckKycStatusRequest {
|
|
542
|
-
/**
|
|
751
|
+
/** Customer identifier. Sent for context only — the lookup is by kyc_id. */
|
|
543
752
|
user_id: string;
|
|
544
|
-
/**
|
|
753
|
+
/** The KYC request ID returned by requestKycSubmitLink; drives the status lookup. */
|
|
545
754
|
kyc_id: string;
|
|
546
755
|
}
|
|
547
756
|
/**
|
|
548
757
|
* Response from checkKycStatus. Always returns the same shape.
|
|
549
758
|
*
|
|
550
|
-
* `additional_data` is `null`
|
|
551
|
-
*
|
|
552
|
-
*
|
|
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`.
|
|
762
|
+
* Otherwise it contains the full KYC record including document details,
|
|
763
|
+
* proofs, and the customer's risk profile.
|
|
764
|
+
*
|
|
765
|
+
* `status === 'awaiting_kyc'` means the submit link was issued but the
|
|
766
|
+
* customer has not submitted documents — treat it as "not started", never as
|
|
767
|
+
* "in progress". Check `link_expired`: `false` → re-surface the existing
|
|
768
|
+
* link; `true` → request a fresh one via `requestKycSubmitLink`.
|
|
553
769
|
*/
|
|
554
770
|
interface CheckKycStatusResponse {
|
|
555
771
|
id: string;
|
|
@@ -559,27 +775,43 @@ interface CheckKycStatusResponse {
|
|
|
559
775
|
address_verified: boolean;
|
|
560
776
|
face_verified: boolean;
|
|
561
777
|
age_verified: boolean;
|
|
562
|
-
/**
|
|
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
|
+
*/
|
|
563
783
|
declined_reasons?: Reason[];
|
|
564
|
-
/**
|
|
784
|
+
/**
|
|
785
|
+
* Structured, non-blocking warnings. Currently returned only as
|
|
786
|
+
* `additional_data.warning_reasons`; this top-level field is not populated.
|
|
787
|
+
*/
|
|
565
788
|
warning_reasons?: Reason[];
|
|
566
|
-
/**
|
|
789
|
+
/** Comma-joined decline text. Always present on a declined response. */
|
|
567
790
|
declined_reason?: string;
|
|
568
|
-
/**
|
|
791
|
+
/** Legacy decline code; prefer the `code` on `additional_data.declined_reasons`. */
|
|
569
792
|
declined_code?: KycDeclinedCode;
|
|
570
793
|
other_reason?: string;
|
|
571
794
|
accepted_reason?: string;
|
|
572
|
-
/**
|
|
795
|
+
/** Legacy warning map; prefer `additional_data.warning_reasons`. */
|
|
573
796
|
warnings?: Record<string, Record<string, string>>;
|
|
574
797
|
required_document_count: number;
|
|
575
798
|
supported_document_types?: SupportedDocumentType[];
|
|
799
|
+
supported_address_document_types?: SupportedAddressDocumentType[];
|
|
576
800
|
is_id_verification_required: boolean;
|
|
577
801
|
is_face_verification_required: boolean;
|
|
578
802
|
is_address_verification_required: boolean;
|
|
579
803
|
is_age_verification_required: boolean;
|
|
580
804
|
created_at: string;
|
|
581
|
-
/**
|
|
582
|
-
|
|
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;
|
|
811
|
+
/** Present when status is 'awaiting_kyc': whether the submit link has expired (request a new one when true). */
|
|
812
|
+
link_expired?: boolean;
|
|
813
|
+
/** Present when status is 'awaiting_kyc': the submit link's expiry time (RFC 3339). */
|
|
814
|
+
link_expires_at?: string;
|
|
583
815
|
}
|
|
584
816
|
interface RequestAdditionalDocumentsRequest {
|
|
585
817
|
/** KYC request ID */
|
|
@@ -697,6 +929,7 @@ interface UseKycOverviewResult extends BaseHookState {
|
|
|
697
929
|
}
|
|
698
930
|
interface UseKycPreferencesResult extends BaseHookState {
|
|
699
931
|
preferences: KycPreferences | null;
|
|
932
|
+
/** @deprecated The platform exposes no preference-update operation; this call always fails. */
|
|
700
933
|
updatePreferences: (update: UpdateKycPreferencesRequest) => Promise<void>;
|
|
701
934
|
refresh: () => Promise<void>;
|
|
702
935
|
}
|
|
@@ -715,8 +948,9 @@ interface UseKycPreferencesResult extends BaseHookState {
|
|
|
715
948
|
* - Automatic timeout management
|
|
716
949
|
* - Debug logging
|
|
717
950
|
*
|
|
718
|
-
*
|
|
719
|
-
*
|
|
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.
|
|
720
954
|
*/
|
|
721
955
|
declare class KycClient extends BaseClient {
|
|
722
956
|
private userId?;
|
|
@@ -739,19 +973,27 @@ declare class KycClient extends BaseClient {
|
|
|
739
973
|
*
|
|
740
974
|
* Generates a link that the user can visit to submit their KYC documents.
|
|
741
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
|
+
*
|
|
742
980
|
* Optionally pass the customer's registered identity data as
|
|
743
981
|
* `customer_data` (same shape as the geolocation `customer_data` block).
|
|
744
982
|
* It seeds the customer's risk profile so document verification can
|
|
745
983
|
* cross-check the submitted document against trusted reference data;
|
|
746
984
|
* fields never overwrite data already on the profile.
|
|
747
985
|
*
|
|
748
|
-
*
|
|
749
|
-
*
|
|
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`
|
|
750
991
|
*
|
|
751
992
|
* @example
|
|
752
993
|
* ```typescript
|
|
753
994
|
* const result = await client.requestKycSubmitLink({
|
|
754
995
|
* user_id: "user_123",
|
|
996
|
+
* trigger_event: "onboarding",
|
|
755
997
|
* redirect_url: "https://merchant.com/kyc-complete", // optional
|
|
756
998
|
* callback_url: "https://merchant.com/api/kyc-webhook", // optional - receives POST requests on status change
|
|
757
999
|
* customer_data: { // optional - seeds the risk profile for document cross-checks
|
|
@@ -764,6 +1006,7 @@ declare class KycClient extends BaseClient {
|
|
|
764
1006
|
* }
|
|
765
1007
|
* });
|
|
766
1008
|
*
|
|
1009
|
+
* if (!result.kyc_required) return proceed();
|
|
767
1010
|
* console.log(`Redirect user to: ${result.link}`);
|
|
768
1011
|
* console.log(`KYC ID: ${result.kyc_id}`);
|
|
769
1012
|
* ```
|
|
@@ -773,10 +1016,9 @@ declare class KycClient extends BaseClient {
|
|
|
773
1016
|
* Create a Event-Based Face Verification session.
|
|
774
1017
|
*
|
|
775
1018
|
* Inspect the response before showing UI:
|
|
776
|
-
* - `is_required === false` → skip face
|
|
777
|
-
* - `
|
|
778
|
-
*
|
|
779
|
-
* - `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.
|
|
780
1022
|
*
|
|
781
1023
|
* @param request - Reference, customer_id, event, amount (for threshold events), optional URLs.
|
|
782
1024
|
*/
|
|
@@ -784,9 +1026,9 @@ declare class KycClient extends BaseClient {
|
|
|
784
1026
|
/**
|
|
785
1027
|
* Submit a real-time face capture for an active Event-Based Face Verification session.
|
|
786
1028
|
*
|
|
787
|
-
*
|
|
788
|
-
*
|
|
789
|
-
*
|
|
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.
|
|
790
1032
|
*
|
|
791
1033
|
* The `data` field on the response carries `retries_remaining`,
|
|
792
1034
|
* `retry_limit_exceeded`, and the reaction flags (`enforce_logout`,
|
|
@@ -806,11 +1048,22 @@ declare class KycClient extends BaseClient {
|
|
|
806
1048
|
* @param token - The session token returned by `createEventBasedFaceVerificationSession`.
|
|
807
1049
|
*/
|
|
808
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>;
|
|
809
1061
|
/**
|
|
810
1062
|
* Fetch the Redis-backed handoff session for a token. Same backing
|
|
811
|
-
* store as normal KYC (`kyc:session:<token>`, 15-minute TTL).
|
|
812
|
-
*
|
|
813
|
-
*
|
|
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.
|
|
814
1067
|
*
|
|
815
1068
|
* @param token - The session token returned by `createEventBasedFaceVerificationSession`.
|
|
816
1069
|
*/
|
|
@@ -830,25 +1083,30 @@ declare class KycClient extends BaseClient {
|
|
|
830
1083
|
* Check KYC status for a user
|
|
831
1084
|
*
|
|
832
1085
|
* Returns the current KYC status:
|
|
833
|
-
* - "
|
|
834
|
-
* - "
|
|
835
|
-
* - "
|
|
836
|
-
* -
|
|
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
|
|
837
1092
|
*
|
|
838
|
-
* @param request - Request containing user_id and
|
|
839
|
-
* @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`
|
|
840
1095
|
*
|
|
841
1096
|
* @example
|
|
842
1097
|
* ```typescript
|
|
843
1098
|
* const result = await client.checkKycStatus({
|
|
844
1099
|
* user_id: "user_123",
|
|
845
|
-
*
|
|
1100
|
+
* kyc_id: "550e8400-e29b-41d4-a716-446655440000"
|
|
846
1101
|
* });
|
|
847
1102
|
*
|
|
848
|
-
* if (result.
|
|
849
|
-
* //
|
|
850
|
-
* } 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;
|
|
851
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
|
|
852
1110
|
* } else {
|
|
853
1111
|
* // Keep polling
|
|
854
1112
|
* }
|
|
@@ -858,7 +1116,9 @@ declare class KycClient extends BaseClient {
|
|
|
858
1116
|
/**
|
|
859
1117
|
* Submit a document verification request with OCR
|
|
860
1118
|
*
|
|
861
|
-
*
|
|
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.
|
|
862
1122
|
*
|
|
863
1123
|
* @param request - Document verification request with documents and customer info
|
|
864
1124
|
* @returns Verification response with status and reference
|
|
@@ -923,14 +1183,14 @@ declare class KycClient extends BaseClient {
|
|
|
923
1183
|
* ```typescript
|
|
924
1184
|
* // Accept a KYC request
|
|
925
1185
|
* await client.updateKycStatus({
|
|
926
|
-
* reference: "
|
|
1186
|
+
* reference: "kyc-ref-123",
|
|
927
1187
|
* status: "accepted",
|
|
928
1188
|
* reason: "All documents verified successfully"
|
|
929
1189
|
* });
|
|
930
1190
|
*
|
|
931
1191
|
* // Decline a KYC request
|
|
932
1192
|
* await client.updateKycStatus({
|
|
933
|
-
* reference: "
|
|
1193
|
+
* reference: "kyc-ref-456",
|
|
934
1194
|
* status: "declined",
|
|
935
1195
|
* reason: "Document expired"
|
|
936
1196
|
* });
|
|
@@ -940,6 +1200,10 @@ declare class KycClient extends BaseClient {
|
|
|
940
1200
|
/**
|
|
941
1201
|
* Request additional documents from customer
|
|
942
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
|
+
*
|
|
943
1207
|
* @param request - Request with KYC ID and document types needed
|
|
944
1208
|
*
|
|
945
1209
|
* @example
|
|
@@ -1058,6 +1322,11 @@ declare class KycClient extends BaseClient {
|
|
|
1058
1322
|
/**
|
|
1059
1323
|
* Update KYC preferences for the tenant
|
|
1060
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
|
+
*
|
|
1061
1330
|
* @param update - Fields to update
|
|
1062
1331
|
* @returns Updated preferences
|
|
1063
1332
|
*
|
|
@@ -1146,4 +1415,4 @@ declare class KycClient extends BaseClient {
|
|
|
1146
1415
|
createCustomerProfile(profile: CreateProfileRequest): Promise<CustomerProfile>;
|
|
1147
1416
|
}
|
|
1148
1417
|
|
|
1149
|
-
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 };
|