vesant-sdk 1.7.1-dev.7da3b05 → 1.7.1-dev.807a414
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 +307 -57
- package/dist/kyc/index.d.ts +307 -57
- 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 +254 -35
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +252 -36
- package/dist/react.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;
|
|
@@ -568,20 +773,28 @@ interface CheckKycStatusResponse {
|
|
|
568
773
|
address_verified: boolean;
|
|
569
774
|
face_verified: boolean;
|
|
570
775
|
age_verified: boolean;
|
|
571
|
-
/**
|
|
776
|
+
/**
|
|
777
|
+
* Structured decline reasons. The platform currently returns these only on
|
|
778
|
+
* the full record: read `additional_data.declined_reasons` and fall back to
|
|
779
|
+
* {@link declined_reason}. This top-level field is reserved and not populated.
|
|
780
|
+
*/
|
|
572
781
|
declined_reasons?: Reason[];
|
|
573
|
-
/**
|
|
782
|
+
/**
|
|
783
|
+
* Structured, non-blocking warnings. Currently returned only as
|
|
784
|
+
* `additional_data.warning_reasons`; this top-level field is not populated.
|
|
785
|
+
*/
|
|
574
786
|
warning_reasons?: Reason[];
|
|
575
|
-
/**
|
|
787
|
+
/** Comma-joined decline text. Always present on a declined response. */
|
|
576
788
|
declined_reason?: string;
|
|
577
|
-
/**
|
|
789
|
+
/** Legacy decline code; prefer the `code` on `additional_data.declined_reasons`. */
|
|
578
790
|
declined_code?: KycDeclinedCode;
|
|
579
791
|
other_reason?: string;
|
|
580
792
|
accepted_reason?: string;
|
|
581
|
-
/**
|
|
793
|
+
/** Legacy warning map; prefer `additional_data.warning_reasons`. */
|
|
582
794
|
warnings?: Record<string, Record<string, string>>;
|
|
583
795
|
required_document_count: number;
|
|
584
796
|
supported_document_types?: SupportedDocumentType[];
|
|
797
|
+
supported_address_document_types?: SupportedAddressDocumentType[];
|
|
585
798
|
is_id_verification_required: boolean;
|
|
586
799
|
is_face_verification_required: boolean;
|
|
587
800
|
is_address_verification_required: boolean;
|
|
@@ -710,6 +923,7 @@ interface UseKycOverviewResult extends BaseHookState {
|
|
|
710
923
|
}
|
|
711
924
|
interface UseKycPreferencesResult extends BaseHookState {
|
|
712
925
|
preferences: KycPreferences | null;
|
|
926
|
+
/** @deprecated The platform exposes no preference-update operation; this call always fails. */
|
|
713
927
|
updatePreferences: (update: UpdateKycPreferencesRequest) => Promise<void>;
|
|
714
928
|
refresh: () => Promise<void>;
|
|
715
929
|
}
|
|
@@ -728,8 +942,9 @@ interface UseKycPreferencesResult extends BaseHookState {
|
|
|
728
942
|
* - Automatic timeout management
|
|
729
943
|
* - Debug logging
|
|
730
944
|
*
|
|
731
|
-
*
|
|
732
|
-
*
|
|
945
|
+
* Read calls use requestWithRetry() to ride out transient failures.
|
|
946
|
+
* Calls that create or bill something (submit link, document submit,
|
|
947
|
+
* face session, face submit, hosted journey retry) are made exactly once.
|
|
733
948
|
*/
|
|
734
949
|
declare class KycClient extends BaseClient {
|
|
735
950
|
private userId?;
|
|
@@ -752,19 +967,27 @@ declare class KycClient extends BaseClient {
|
|
|
752
967
|
*
|
|
753
968
|
* Generates a link that the user can visit to submit their KYC documents.
|
|
754
969
|
*
|
|
970
|
+
* Pass the `trigger_event` that matches the user action so the tenant's
|
|
971
|
+
* trigger preferences decide whether verification is required; inspect
|
|
972
|
+
* `kyc_required` and `reason` on the response before redirecting.
|
|
973
|
+
*
|
|
755
974
|
* Optionally pass the customer's registered identity data as
|
|
756
975
|
* `customer_data` (same shape as the geolocation `customer_data` block).
|
|
757
976
|
* It seeds the customer's risk profile so document verification can
|
|
758
977
|
* cross-check the submitted document against trusted reference data;
|
|
759
978
|
* fields never overwrite data already on the profile.
|
|
760
979
|
*
|
|
761
|
-
*
|
|
762
|
-
*
|
|
980
|
+
* The call is made once and is not retried: each request creates a new
|
|
981
|
+
* KYC record and link, so a retry after a timeout would leave duplicates.
|
|
982
|
+
*
|
|
983
|
+
* @param request - Request containing the user ID, trigger event, optional redirect URL, optional callback URL (receives POST requests), and optional customer identity data
|
|
984
|
+
* @returns Response containing the redirect link, KYC ID, `kyc_required`, `can_skip` and `reason`
|
|
763
985
|
*
|
|
764
986
|
* @example
|
|
765
987
|
* ```typescript
|
|
766
988
|
* const result = await client.requestKycSubmitLink({
|
|
767
989
|
* user_id: "user_123",
|
|
990
|
+
* trigger_event: "onboarding",
|
|
768
991
|
* redirect_url: "https://merchant.com/kyc-complete", // optional
|
|
769
992
|
* callback_url: "https://merchant.com/api/kyc-webhook", // optional - receives POST requests on status change
|
|
770
993
|
* customer_data: { // optional - seeds the risk profile for document cross-checks
|
|
@@ -777,6 +1000,7 @@ declare class KycClient extends BaseClient {
|
|
|
777
1000
|
* }
|
|
778
1001
|
* });
|
|
779
1002
|
*
|
|
1003
|
+
* if (!result.kyc_required) return proceed();
|
|
780
1004
|
* console.log(`Redirect user to: ${result.link}`);
|
|
781
1005
|
* console.log(`KYC ID: ${result.kyc_id}`);
|
|
782
1006
|
* ```
|
|
@@ -786,10 +1010,9 @@ declare class KycClient extends BaseClient {
|
|
|
786
1010
|
* Create a Event-Based Face Verification session.
|
|
787
1011
|
*
|
|
788
1012
|
* Inspect the response before showing UI:
|
|
789
|
-
* - `is_required === false` → skip face
|
|
790
|
-
* - `
|
|
791
|
-
*
|
|
792
|
-
* - `device_type === 'mobile'` → open the face capture modal directly.
|
|
1013
|
+
* - `is_required === false` → skip face verification; `reason` explains why.
|
|
1014
|
+
* - `verification_url` present → embed the hosted journey and poll status.
|
|
1015
|
+
* - `verification_url` absent → use the local camera / QR fallback.
|
|
793
1016
|
*
|
|
794
1017
|
* @param request - Reference, customer_id, event, amount (for threshold events), optional URLs.
|
|
795
1018
|
*/
|
|
@@ -797,9 +1020,9 @@ declare class KycClient extends BaseClient {
|
|
|
797
1020
|
/**
|
|
798
1021
|
* Submit a real-time face capture for an active Event-Based Face Verification session.
|
|
799
1022
|
*
|
|
800
|
-
*
|
|
801
|
-
*
|
|
802
|
-
*
|
|
1023
|
+
* Works from any device: the platform does not inspect the User-Agent.
|
|
1024
|
+
* `FaceCaptureModal` decides between direct capture and the QR handoff
|
|
1025
|
+
* on the client; custom UIs may submit from desktop or mobile alike.
|
|
803
1026
|
*
|
|
804
1027
|
* The `data` field on the response carries `retries_remaining`,
|
|
805
1028
|
* `retry_limit_exceeded`, and the reaction flags (`enforce_logout`,
|
|
@@ -819,11 +1042,22 @@ declare class KycClient extends BaseClient {
|
|
|
819
1042
|
* @param token - The session token returned by `createEventBasedFaceVerificationSession`.
|
|
820
1043
|
*/
|
|
821
1044
|
getEventBasedFaceVerificationSessionStatus(token: string): Promise<EventBasedFaceVerificationCallback>;
|
|
1045
|
+
/**
|
|
1046
|
+
* Mint a fresh hosted verification journey for the next attempt on an
|
|
1047
|
+
* active session whose previous hosted-journey attempt was declined.
|
|
1048
|
+
* Only valid while the session is active and attempts remain; the
|
|
1049
|
+
* response carries the new `verification_url` to embed. Used internally
|
|
1050
|
+
* by `FaceCaptureModal`'s Try Again flow in hosted-journey mode.
|
|
1051
|
+
*
|
|
1052
|
+
* @param token - The session token returned by `createEventBasedFaceVerificationSession`.
|
|
1053
|
+
*/
|
|
1054
|
+
retryEventBasedFaceVerificationJourney(token: string): Promise<CreateEventBasedFaceVerificationSessionResponse>;
|
|
822
1055
|
/**
|
|
823
1056
|
* Fetch the Redis-backed handoff session for a token. Same backing
|
|
824
|
-
* store as normal KYC (`kyc:session:<token>`, 15-minute TTL).
|
|
825
|
-
*
|
|
826
|
-
*
|
|
1057
|
+
* store as normal KYC (`kyc:session:<token>`, 15-minute TTL). The
|
|
1058
|
+
* Event-Based Face Verification database session still expires after
|
|
1059
|
+
* 10 minutes. Desktop callers poll `mobile_connected` to detect when a
|
|
1060
|
+
* mobile device has scanned the QR and attached.
|
|
827
1061
|
*
|
|
828
1062
|
* @param token - The session token returned by `createEventBasedFaceVerificationSession`.
|
|
829
1063
|
*/
|
|
@@ -843,25 +1077,30 @@ declare class KycClient extends BaseClient {
|
|
|
843
1077
|
* Check KYC status for a user
|
|
844
1078
|
*
|
|
845
1079
|
* Returns the current KYC status:
|
|
846
|
-
* - "
|
|
847
|
-
* - "
|
|
848
|
-
* - "
|
|
849
|
-
* -
|
|
1080
|
+
* - "accepted" / "review.pending" → verified (limited access while under review)
|
|
1081
|
+
* - "pending" → documents submitted, verification running: keep polling
|
|
1082
|
+
* - "awaiting_kyc" → nothing submitted yet; check `link_expired` before
|
|
1083
|
+
* re-surfacing or re-requesting the link. Never treat as in progress.
|
|
1084
|
+
* - "declined" → show `additional_data.declined_reasons` (fallback
|
|
1085
|
+
* `declined_reason`) with a retry option
|
|
850
1086
|
*
|
|
851
|
-
* @param request - Request containing user_id and
|
|
852
|
-
* @returns Response with
|
|
1087
|
+
* @param request - Request containing user_id and kyc_id
|
|
1088
|
+
* @returns Response with status, verification flags and, once terminal, the full record in `additional_data`
|
|
853
1089
|
*
|
|
854
1090
|
* @example
|
|
855
1091
|
* ```typescript
|
|
856
1092
|
* const result = await client.checkKycStatus({
|
|
857
1093
|
* user_id: "user_123",
|
|
858
|
-
*
|
|
1094
|
+
* kyc_id: "550e8400-e29b-41d4-a716-446655440000"
|
|
859
1095
|
* });
|
|
860
1096
|
*
|
|
861
|
-
* if (result.
|
|
862
|
-
* //
|
|
863
|
-
* } else if (result.
|
|
1097
|
+
* if (result.status === 'accepted' || result.status === 'review.pending') {
|
|
1098
|
+
* // Grant access
|
|
1099
|
+
* } else if (result.status === 'declined') {
|
|
1100
|
+
* const reasons = result.additional_data?.declined_reasons;
|
|
864
1101
|
* // Show error + retry option
|
|
1102
|
+
* } else if (result.status === 'awaiting_kyc') {
|
|
1103
|
+
* // Prompt to verify; request a new link when result.link_expired is true
|
|
865
1104
|
* } else {
|
|
866
1105
|
* // Keep polling
|
|
867
1106
|
* }
|
|
@@ -871,7 +1110,9 @@ declare class KycClient extends BaseClient {
|
|
|
871
1110
|
/**
|
|
872
1111
|
* Submit a document verification request with OCR
|
|
873
1112
|
*
|
|
874
|
-
*
|
|
1113
|
+
* The call is made once and is not retried: every submission is processed
|
|
1114
|
+
* and billed, and the platform does not replay this route from an
|
|
1115
|
+
* idempotency key. Retry explicitly if the request fails.
|
|
875
1116
|
*
|
|
876
1117
|
* @param request - Document verification request with documents and customer info
|
|
877
1118
|
* @returns Verification response with status and reference
|
|
@@ -936,14 +1177,14 @@ declare class KycClient extends BaseClient {
|
|
|
936
1177
|
* ```typescript
|
|
937
1178
|
* // Accept a KYC request
|
|
938
1179
|
* await client.updateKycStatus({
|
|
939
|
-
* reference: "
|
|
1180
|
+
* reference: "kyc-ref-123",
|
|
940
1181
|
* status: "accepted",
|
|
941
1182
|
* reason: "All documents verified successfully"
|
|
942
1183
|
* });
|
|
943
1184
|
*
|
|
944
1185
|
* // Decline a KYC request
|
|
945
1186
|
* await client.updateKycStatus({
|
|
946
|
-
* reference: "
|
|
1187
|
+
* reference: "kyc-ref-456",
|
|
947
1188
|
* status: "declined",
|
|
948
1189
|
* reason: "Document expired"
|
|
949
1190
|
* });
|
|
@@ -953,6 +1194,10 @@ declare class KycClient extends BaseClient {
|
|
|
953
1194
|
/**
|
|
954
1195
|
* Request additional documents from customer
|
|
955
1196
|
*
|
|
1197
|
+
* @deprecated The platform does not expose this operation; the call always
|
|
1198
|
+
* fails. Request additional documents from the Vesant console instead.
|
|
1199
|
+
* This method will be removed in a future release.
|
|
1200
|
+
*
|
|
956
1201
|
* @param request - Request with KYC ID and document types needed
|
|
957
1202
|
*
|
|
958
1203
|
* @example
|
|
@@ -1071,6 +1316,11 @@ declare class KycClient extends BaseClient {
|
|
|
1071
1316
|
/**
|
|
1072
1317
|
* Update KYC preferences for the tenant
|
|
1073
1318
|
*
|
|
1319
|
+
* @deprecated KYC preferences are managed in the Vesant console; the
|
|
1320
|
+
* platform exposes no update operation to the SDK, so this call always
|
|
1321
|
+
* fails. Use `getPreferences()` to read them. This method will be removed
|
|
1322
|
+
* in a future release.
|
|
1323
|
+
*
|
|
1074
1324
|
* @param update - Fields to update
|
|
1075
1325
|
* @returns Updated preferences
|
|
1076
1326
|
*
|
|
@@ -1159,4 +1409,4 @@ declare class KycClient extends BaseClient {
|
|
|
1159
1409
|
createCustomerProfile(profile: CreateProfileRequest): Promise<CustomerProfile>;
|
|
1160
1410
|
}
|
|
1161
1411
|
|
|
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 };
|
|
1412
|
+
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 };
|