vesant-sdk 1.6.6 → 1.7.0-dev.972b614
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 +14 -4
- package/dist/{client-ePzhQKp9.d.mts → client-BolQlL5e.d.mts} +1 -1
- package/dist/{client-ePzhQKp9.d.ts → client-BolQlL5e.d.ts} +1 -1
- package/dist/client-C3DCmGe9.d.ts +436 -0
- package/dist/{client-C_A7QLcB.d.ts → client-DMIRx7Tu.d.mts} +5 -3
- package/dist/{client-BlCxjbY2.d.mts → client-DoMSYMMR.d.ts} +5 -3
- package/dist/client-ZNdnpWe7.d.mts +436 -0
- package/dist/compliance/index.d.mts +25 -429
- package/dist/compliance/index.d.ts +25 -429
- package/dist/compliance/index.js +187 -103
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +187 -104
- package/dist/compliance/index.mjs.map +1 -1
- package/dist/decisions/index.d.mts +2 -2
- package/dist/decisions/index.d.ts +2 -2
- 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 +4 -4
- package/dist/geolocation/index.d.ts +4 -4
- package/dist/geolocation/index.js +7 -24
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +7 -24
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index.d.mts +12 -70
- package/dist/index.d.ts +12 -70
- package/dist/index.js +297 -295
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +296 -294
- package/dist/index.mjs.map +1 -1
- package/dist/kyc/core.d.mts +4 -4
- package/dist/kyc/core.d.ts +4 -4
- package/dist/kyc/core.js +81 -26
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +81 -27
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +274 -50
- package/dist/kyc/index.d.ts +274 -50
- package/dist/kyc/index.js +81 -26
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +81 -27
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +46 -9
- package/dist/react.d.ts +46 -9
- package/dist/react.js +882 -276
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +881 -275
- package/dist/react.mjs.map +1 -1
- package/dist/risk-profile/index.d.mts +4 -4
- package/dist/risk-profile/index.d.ts +4 -4
- 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.d.mts +2 -2
- package/dist/scores/index.d.ts +2 -2
- 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.d.mts +6 -41
- package/dist/tax/index.d.ts +6 -41
- package/dist/tax/index.js +1 -36
- package/dist/tax/index.js.map +1 -1
- package/dist/tax/index.mjs +1 -36
- package/dist/tax/index.mjs.map +1 -1
- package/dist/{types-1RzYeSal.d.mts → types-BOFaMQxI.d.mts} +2 -2
- package/dist/{types-B4Ezqo7V.d.mts → types-CBQRNL-l.d.mts} +14 -1
- package/dist/{types-B4Ezqo7V.d.ts → types-CBQRNL-l.d.ts} +14 -1
- package/dist/{types-X5Md_dD_.d.ts → types-UGyDl1fd.d.ts} +2 -2
- package/dist/webhooks/index.d.mts +189 -2
- package/dist/webhooks/index.d.ts +189 -2
- package/dist/webhooks/index.js +49 -7
- package/dist/webhooks/index.js.map +1 -1
- package/dist/webhooks/index.mjs +49 -7
- package/dist/webhooks/index.mjs.map +1 -1
- package/package.json +16 -13
- package/dist/fraud/index.d.mts +0 -80
- package/dist/fraud/index.d.ts +0 -80
- package/dist/fraud/index.js +0 -606
- package/dist/fraud/index.js.map +0 -1
- package/dist/fraud/index.mjs +0 -604
- package/dist/fraud/index.mjs.map +0 -1
- package/dist/index-B04H4xfJ.d.mts +0 -320
- package/dist/index-CItMPmLL.d.ts +0 -320
package/dist/kyc/index.d.ts
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import { B as BaseClient } from '../client-
|
|
1
|
+
import { P as ProfileFilters, b as ProfileListResponse, C as CustomerProfile, a as CreateProfileRequest } from '../types-UGyDl1fd.js';
|
|
2
|
+
import { c as Reason, R as RiskLevel, P as PaginationParams } from '../types-CBQRNL-l.js';
|
|
3
|
+
import { B as BaseClient } from '../client-BolQlL5e.js';
|
|
4
4
|
|
|
5
5
|
/**
|
|
6
6
|
* TypeScript type definitions for Vesant KYC Service API
|
|
@@ -12,12 +12,13 @@ import { B as BaseClient } from '../client-ePzhQKp9.js';
|
|
|
12
12
|
*/
|
|
13
13
|
|
|
14
14
|
type KycStatus = 'pending' | 'accepted' | 'declined' | 'review.pending' | 'unknown';
|
|
15
|
+
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
|
+
declare const KYC_DECLINED_DESCRIPTIONS: Record<KycDeclinedCode, string>;
|
|
15
17
|
type KycAlertStatus = 'pending' | 'in_progress' | 'resolved' | 'closed' | 'escalated';
|
|
16
18
|
type KycAlertType = 'kyc' | 'fraud';
|
|
17
19
|
type DocumentType = 'id_card' | 'driving_license' | 'passport';
|
|
18
20
|
type ProofType = 'document' | 'document_two' | 'face' | 'address' | 'additional_document';
|
|
19
21
|
type SupportedDocumentType = 'id_card' | 'passport' | 'driving_license';
|
|
20
|
-
type KycTriggerEvent = 'onboarding' | 'first_withdrawal' | 'first_purchase' | 'manual' | 'withdrawal' | 'purchase';
|
|
21
22
|
interface KycRequest {
|
|
22
23
|
id: string;
|
|
23
24
|
reference: string;
|
|
@@ -44,9 +45,17 @@ interface KycRequest {
|
|
|
44
45
|
is_age_verification_required: boolean;
|
|
45
46
|
callback_url: string;
|
|
46
47
|
redirect_url?: string;
|
|
48
|
+
/** Structured decline reasons. Present when status is `declined`. */
|
|
49
|
+
declined_reasons?: Reason[];
|
|
50
|
+
/** Structured, non-blocking warnings. */
|
|
51
|
+
warning_reasons?: Reason[];
|
|
52
|
+
/** @deprecated Use {@link declined_reasons}. Comma-joined message text. */
|
|
47
53
|
declined_reason?: string;
|
|
54
|
+
/** @deprecated Use the `code` on {@link declined_reasons}. */
|
|
55
|
+
declined_code?: KycDeclinedCode;
|
|
48
56
|
accepted_reason?: string;
|
|
49
57
|
other_reason?: string;
|
|
58
|
+
/** @deprecated Use {@link warning_reasons}. */
|
|
50
59
|
warnings?: Record<string, Record<string, string>>;
|
|
51
60
|
proofs?: Proof[];
|
|
52
61
|
alerts?: KycAlert[];
|
|
@@ -117,6 +126,65 @@ interface UpdateKycAlertRequest {
|
|
|
117
126
|
alert_type?: KycAlertType;
|
|
118
127
|
status?: KycAlertStatus;
|
|
119
128
|
}
|
|
129
|
+
/**
|
|
130
|
+
* Threshold-gated trigger for transaction events. Each rule is
|
|
131
|
+
* self-contained — there is no umbrella flag.
|
|
132
|
+
*
|
|
133
|
+
* - `enabled=false` → event blocked.
|
|
134
|
+
* - `enabled=true`, `threshold=0` (or null/omitted) → every event of this
|
|
135
|
+
* type triggers Event-Based Face Verification, regardless of amount.
|
|
136
|
+
* - `enabled=true`, `threshold>0` → only amounts `>= threshold` trigger.
|
|
137
|
+
*/
|
|
138
|
+
interface EventBasedFaceVerificationThresholdTrigger {
|
|
139
|
+
enabled: boolean;
|
|
140
|
+
/** USD threshold; 0 / null / omitted means "any amount". */
|
|
141
|
+
threshold: number;
|
|
142
|
+
}
|
|
143
|
+
/**
|
|
144
|
+
* Rate-of-occurrence trigger (used by `high_frequency_betting`). The
|
|
145
|
+
* tenant tells the server how many events have happened over how many
|
|
146
|
+
* minutes via the request body (`event_count`, `event_window_minutes`);
|
|
147
|
+
* the server triggers when `event_count >= count` AND
|
|
148
|
+
* `event_window_minutes <= window_minutes`. Either bound of 0 means
|
|
149
|
+
* "don't enforce that bound".
|
|
150
|
+
*/
|
|
151
|
+
interface EventBasedFaceVerificationFrequencyTrigger {
|
|
152
|
+
enabled: boolean;
|
|
153
|
+
/** Minimum number of events; 0 / null / omitted means "any count". */
|
|
154
|
+
count: number;
|
|
155
|
+
/** Maximum lookback window in minutes; 0 / null / omitted means "any window". */
|
|
156
|
+
window_minutes: number;
|
|
157
|
+
}
|
|
158
|
+
/** Events that can trigger Event-Based Face Verification for a tenant. */
|
|
159
|
+
interface EventBasedFaceVerificationTriggers {
|
|
160
|
+
login: boolean;
|
|
161
|
+
password_change: boolean;
|
|
162
|
+
name_change: boolean;
|
|
163
|
+
phone_number_change: boolean;
|
|
164
|
+
two_factor_auth_change: boolean;
|
|
165
|
+
new_device_or_location: boolean;
|
|
166
|
+
device_fingerprint_change: boolean;
|
|
167
|
+
payment_method_change: boolean;
|
|
168
|
+
deposit: EventBasedFaceVerificationThresholdTrigger;
|
|
169
|
+
withdrawal: EventBasedFaceVerificationThresholdTrigger;
|
|
170
|
+
large_bet_placement: EventBasedFaceVerificationThresholdTrigger;
|
|
171
|
+
high_frequency_betting: EventBasedFaceVerificationFrequencyTrigger;
|
|
172
|
+
account_balance_transfer: boolean;
|
|
173
|
+
}
|
|
174
|
+
/**
|
|
175
|
+
* Reactions taken when a customer exhausts the Event-Based Face Verification retry limit.
|
|
176
|
+
* `trigger_alert` is enforced by the server (creates a KYC alert);
|
|
177
|
+
* `enforce_logout` and `freeze_account` are forwarded to the tenant app
|
|
178
|
+
* via the callback `data` field for it to enforce.
|
|
179
|
+
*/
|
|
180
|
+
interface EventBasedFaceVerificationReactions {
|
|
181
|
+
/** Retries after the first attempt; total submissions = this + 1. */
|
|
182
|
+
max_retry_attempts: number;
|
|
183
|
+
trigger_alert: boolean;
|
|
184
|
+
enforce_logout: boolean;
|
|
185
|
+
freeze_account: boolean;
|
|
186
|
+
freeze_duration_minutes: number;
|
|
187
|
+
}
|
|
120
188
|
interface KycPreferences {
|
|
121
189
|
id: string;
|
|
122
190
|
tenant_id: string;
|
|
@@ -125,6 +193,8 @@ interface KycPreferences {
|
|
|
125
193
|
is_face_verification_required: boolean;
|
|
126
194
|
is_address_verification_required: boolean;
|
|
127
195
|
is_age_verification_required: boolean;
|
|
196
|
+
/** Master switch for the Event-Based Face Verification feature. */
|
|
197
|
+
is_reuse_kyc_enabled?: boolean;
|
|
128
198
|
min_age: number;
|
|
129
199
|
max_age: number;
|
|
130
200
|
required_document_count: number;
|
|
@@ -132,6 +202,10 @@ interface KycPreferences {
|
|
|
132
202
|
high_risk_score: number;
|
|
133
203
|
medium_risk_score: number;
|
|
134
204
|
supported_document_types: SupportedDocumentType[];
|
|
205
|
+
/** Per-event triggers for Event-Based Face Verification. */
|
|
206
|
+
reuse_kyc_triggers?: EventBasedFaceVerificationTriggers;
|
|
207
|
+
/** Retry / reaction policy for Event-Based Face Verification. */
|
|
208
|
+
reuse_kyc_reactions?: EventBasedFaceVerificationReactions;
|
|
135
209
|
created_at: string;
|
|
136
210
|
updated_at: string;
|
|
137
211
|
}
|
|
@@ -141,6 +215,7 @@ interface UpdateKycPreferencesRequest {
|
|
|
141
215
|
is_face_verification_required?: boolean;
|
|
142
216
|
is_address_verification_required?: boolean;
|
|
143
217
|
is_age_verification_required?: boolean;
|
|
218
|
+
is_reuse_kyc_enabled?: boolean;
|
|
144
219
|
min_age?: number;
|
|
145
220
|
max_age?: number;
|
|
146
221
|
required_document_count?: number;
|
|
@@ -148,6 +223,10 @@ interface UpdateKycPreferencesRequest {
|
|
|
148
223
|
high_risk_score?: number;
|
|
149
224
|
medium_risk_score?: number;
|
|
150
225
|
supported_document_types?: SupportedDocumentType[];
|
|
226
|
+
/** Partial update — only the events present here are changed. */
|
|
227
|
+
reuse_kyc_triggers?: Partial<EventBasedFaceVerificationTriggers>;
|
|
228
|
+
/** Partial update — only the keys present here are changed. */
|
|
229
|
+
reuse_kyc_reactions?: Partial<EventBasedFaceVerificationReactions>;
|
|
151
230
|
}
|
|
152
231
|
interface Name {
|
|
153
232
|
first_name?: string;
|
|
@@ -223,27 +302,61 @@ interface UpdateKycStatusRequest {
|
|
|
223
302
|
interface RequestKycSubmitLinkRequest {
|
|
224
303
|
/** User ID to generate KYC submission link for */
|
|
225
304
|
user_id: string;
|
|
226
|
-
/** URL to redirect user after KYC submission */
|
|
227
|
-
redirect_url
|
|
228
|
-
/** URL to receive callback notifications via POST request when KYC status changes */
|
|
229
|
-
callback_url
|
|
230
|
-
/** Event that triggered the KYC request */
|
|
231
|
-
trigger_event
|
|
305
|
+
/** URL to redirect user after KYC submission (optional) */
|
|
306
|
+
redirect_url?: string;
|
|
307
|
+
/** URL to receive callback notifications via POST request when KYC status changes (optional) */
|
|
308
|
+
callback_url?: string;
|
|
309
|
+
/** Event that triggered the KYC request (e.g. "onboarding", "login", "transaction") */
|
|
310
|
+
trigger_event?: string;
|
|
232
311
|
}
|
|
233
|
-
|
|
312
|
+
/**
|
|
313
|
+
* Trigger events that can request Event-Based Face Verification.
|
|
314
|
+
*
|
|
315
|
+
* Account-sensitive: any sensitive change to the account profile.
|
|
316
|
+
* Transaction events: covered by the per-event rules in
|
|
317
|
+
* `EventBasedFaceVerificationTriggers` (`deposit`, `withdrawal`, `large_bet_placement`,
|
|
318
|
+
* `high_frequency_betting`, `account_balance_transfer`).
|
|
319
|
+
*/
|
|
320
|
+
type EventBasedFaceVerificationEvent = 'login' | 'password_change' | 'name_change' | 'phone_number_change' | 'two_factor_auth_change' | 'new_device_or_location' | 'device_fingerprint_change' | 'payment_method_change' | 'deposit' | 'withdrawal' | 'large_bet_placement' | 'high_frequency_betting' | 'account_balance_transfer';
|
|
321
|
+
interface CreateEventBasedFaceVerificationSessionRequest {
|
|
234
322
|
/** Unique reference for the KYC session (e.g., customer ID or transaction ID) */
|
|
235
323
|
reference: string;
|
|
236
|
-
/**
|
|
324
|
+
/** Customer ID to associate with the KYC session */
|
|
237
325
|
customer_id: string;
|
|
238
|
-
/**
|
|
239
|
-
|
|
326
|
+
/**
|
|
327
|
+
* The triggering event. One of the `EventBasedFaceVerificationEvent` union members.
|
|
328
|
+
* Required — when empty, the server falls through to the unknown-event
|
|
329
|
+
* passthrough and allows the request silently.
|
|
330
|
+
*/
|
|
331
|
+
event: EventBasedFaceVerificationEvent;
|
|
332
|
+
/**
|
|
333
|
+
* USD amount associated with the event. Required for threshold-gated
|
|
334
|
+
* events (`deposit`, `withdrawal`, `large_bet_placement`); ignored for
|
|
335
|
+
* everything else. Missing/zero with a non-zero threshold blocks the
|
|
336
|
+
* session.
|
|
337
|
+
*/
|
|
338
|
+
amount?: number;
|
|
339
|
+
/**
|
|
340
|
+
* Number of qualifying events the customer has performed in the
|
|
341
|
+
* window described by `event_window_minutes`. Required for
|
|
342
|
+
* frequency-gated events (`high_frequency_betting`); ignored for
|
|
343
|
+
* everything else.
|
|
344
|
+
*/
|
|
345
|
+
event_count?: number;
|
|
346
|
+
/**
|
|
347
|
+
* Lookback window (in minutes) the tenant counted `event_count` over.
|
|
348
|
+
* Required for frequency-gated events alongside `event_count`. A
|
|
349
|
+
* window larger than the tenant's configured `window_minutes`
|
|
350
|
+
* implies a slower rate than "high frequency" and blocks the session.
|
|
351
|
+
*/
|
|
352
|
+
event_window_minutes?: number;
|
|
240
353
|
/** URL to redirect user after validate the facial submission (optional) */
|
|
241
354
|
redirect_url?: string;
|
|
242
|
-
/** URL to receive callback notifications via POST request when
|
|
355
|
+
/** URL to receive callback notifications via POST request when Event-Based Face Verification status changes (optional) */
|
|
243
356
|
callback_url?: string;
|
|
244
357
|
}
|
|
245
|
-
interface
|
|
246
|
-
/**
|
|
358
|
+
interface SubmitEventBasedFaceVerificationSessionRequest {
|
|
359
|
+
/** Event-Based Face Verification session token generated from createEventBasedFaceVerificationSession */
|
|
247
360
|
token: string;
|
|
248
361
|
/** Base64 encoded face image or selfie for verification */
|
|
249
362
|
proof: string;
|
|
@@ -251,22 +364,94 @@ interface SubmitReuseKycSessionRequest {
|
|
|
251
364
|
reference?: string;
|
|
252
365
|
}
|
|
253
366
|
interface RequestKycSubmitLinkResponse {
|
|
254
|
-
/** Whether KYC is required for this user */
|
|
255
|
-
kyc_required: boolean;
|
|
256
|
-
/** Whether the user can skip KYC */
|
|
257
|
-
can_skip: boolean;
|
|
258
367
|
/** Generated KYC submission redirect URL */
|
|
259
|
-
link
|
|
368
|
+
link: string;
|
|
260
369
|
/** KYC request ID */
|
|
261
|
-
kyc_id
|
|
370
|
+
kyc_id: string;
|
|
262
371
|
}
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
|
|
266
|
-
/**
|
|
372
|
+
/** Device class detected by the SDK (purely client-side — server doesn't care). */
|
|
373
|
+
type EventBasedFaceVerificationDeviceType = 'mobile' | 'desktop';
|
|
374
|
+
interface CreateEventBasedFaceVerificationSessionResponse {
|
|
375
|
+
/** Event-Based Face Verification session reference (echo of the request reference) */
|
|
267
376
|
reference: string;
|
|
268
|
-
/**
|
|
377
|
+
/** Generated Event-Based Face Verification session token, valid 10 minutes */
|
|
378
|
+
token: string;
|
|
379
|
+
/**
|
|
380
|
+
* Empty string when Event-Based Face Verification is required. When `is_required` is
|
|
381
|
+
* false, this contains the human-readable reason (e.g. feature
|
|
382
|
+
* disabled, threshold not met, customer has no prior KYC).
|
|
383
|
+
*/
|
|
384
|
+
reason: string;
|
|
385
|
+
/** Whether the caller must complete the face capture before proceeding */
|
|
269
386
|
is_required: boolean;
|
|
387
|
+
/**
|
|
388
|
+
* Public HTTPS handoff URL the SDK encodes into a QR code on desktop.
|
|
389
|
+
* The mobile device scans it, lands on the tenant frontend's
|
|
390
|
+
* /reuse-kyc-submit page, and completes the face capture there. Empty
|
|
391
|
+
* when the server has no `BASE_URL_FRONTEND` configured — the SDK
|
|
392
|
+
* falls back to building its own URL in that case.
|
|
393
|
+
*/
|
|
394
|
+
link: string;
|
|
395
|
+
/** Failed face-capture attempts so far on this session. 0 on a fresh session. */
|
|
396
|
+
attempts: number;
|
|
397
|
+
/**
|
|
398
|
+
* Total submissions permitted before reactions fire
|
|
399
|
+
* (`reuse_kyc_reactions.max_retry_attempts + 1`).
|
|
400
|
+
*/
|
|
401
|
+
max_attempts: number;
|
|
402
|
+
}
|
|
403
|
+
/**
|
|
404
|
+
* Reaction outcome returned on every face-submit callback. Tenant apps
|
|
405
|
+
* use this to decide whether to allow another retry, end the session,
|
|
406
|
+
* or freeze the account. Reaction flags are only populated when
|
|
407
|
+
* `retry_limit_exceeded` is true.
|
|
408
|
+
*/
|
|
409
|
+
interface EventBasedFaceVerificationReactionResult {
|
|
410
|
+
/** Submissions the customer still has before the retry limit fires. */
|
|
411
|
+
retries_remaining: number;
|
|
412
|
+
/** True once the latest failed attempt exhausts the retry policy. */
|
|
413
|
+
retry_limit_exceeded: boolean;
|
|
414
|
+
trigger_alert: boolean;
|
|
415
|
+
enforce_logout: boolean;
|
|
416
|
+
freeze_account: boolean;
|
|
417
|
+
freeze_duration_minutes: number;
|
|
418
|
+
/** Set when an alert was raised on the dashboard. */
|
|
419
|
+
alert_id?: string;
|
|
420
|
+
}
|
|
421
|
+
/**
|
|
422
|
+
* Shape of the webhook body POSTed to `callback_url` after a Event-Based Face Verification
|
|
423
|
+
* submission completes (also returned synchronously from
|
|
424
|
+
* `submitEventBasedFaceVerificationSession`).
|
|
425
|
+
*/
|
|
426
|
+
interface EventBasedFaceVerificationCallback {
|
|
427
|
+
event: 'reuse_kyc';
|
|
428
|
+
reference: string;
|
|
429
|
+
resource_id: string;
|
|
430
|
+
status: KycStatus;
|
|
431
|
+
/** Structured decline reasons. */
|
|
432
|
+
declined_reasons?: Reason[];
|
|
433
|
+
/** @deprecated Use {@link declined_reasons}. */
|
|
434
|
+
declined_reason?: string;
|
|
435
|
+
/** @deprecated Use structured reasons. */
|
|
436
|
+
warnings?: Record<string, Record<string, string>>;
|
|
437
|
+
data: EventBasedFaceVerificationReactionResult;
|
|
438
|
+
}
|
|
439
|
+
/**
|
|
440
|
+
* Server-side handoff session backed by Redis (TTL: 15 minutes). Shared
|
|
441
|
+
* with the normal KYC mobile/desktop handoff. Desktop clients poll this
|
|
442
|
+
* to detect when a mobile device has attached to the same token via QR.
|
|
443
|
+
*/
|
|
444
|
+
interface KycHandoffSession {
|
|
445
|
+
document: string;
|
|
446
|
+
document_backside: string;
|
|
447
|
+
document_two: string;
|
|
448
|
+
document_two_backside: string;
|
|
449
|
+
address: string;
|
|
450
|
+
face: string;
|
|
451
|
+
/** True after a mobile device hits PUT /api/v1/kyc/session/connect. */
|
|
452
|
+
mobile_connected: boolean;
|
|
453
|
+
/** True after the (normal-KYC) document submission completes; unused for Event-Based Face Verification. */
|
|
454
|
+
is_submitted: boolean;
|
|
270
455
|
}
|
|
271
456
|
interface CheckKycStatusRequest {
|
|
272
457
|
/** User ID to check KYC status for */
|
|
@@ -289,9 +474,17 @@ interface CheckKycStatusResponse {
|
|
|
289
474
|
address_verified: boolean;
|
|
290
475
|
face_verified: boolean;
|
|
291
476
|
age_verified: boolean;
|
|
477
|
+
/** Structured decline reasons. Present when status is `declined`. */
|
|
478
|
+
declined_reasons?: Reason[];
|
|
479
|
+
/** Structured, non-blocking warnings. */
|
|
480
|
+
warning_reasons?: Reason[];
|
|
481
|
+
/** @deprecated Use {@link declined_reasons}. */
|
|
292
482
|
declined_reason?: string;
|
|
483
|
+
/** @deprecated Use the `code` on {@link declined_reasons}. */
|
|
484
|
+
declined_code?: KycDeclinedCode;
|
|
293
485
|
other_reason?: string;
|
|
294
486
|
accepted_reason?: string;
|
|
487
|
+
/** @deprecated Use {@link warning_reasons}. */
|
|
295
488
|
warnings?: Record<string, Record<string, string>>;
|
|
296
489
|
required_document_count: number;
|
|
297
490
|
supported_document_types?: SupportedDocumentType[];
|
|
@@ -461,44 +654,75 @@ declare class KycClient extends BaseClient {
|
|
|
461
654
|
*
|
|
462
655
|
* Generates a link that the user can visit to submit their KYC documents.
|
|
463
656
|
*
|
|
464
|
-
* @param request - Request containing the user ID, redirect URL, callback URL
|
|
465
|
-
* @returns Response containing
|
|
657
|
+
* @param request - Request containing the user ID, optional redirect URL, and optional callback URL (receives POST requests)
|
|
658
|
+
* @returns Response containing the redirect link and KYC ID
|
|
466
659
|
*
|
|
467
660
|
* @example
|
|
468
661
|
* ```typescript
|
|
469
662
|
* const result = await client.requestKycSubmitLink({
|
|
470
663
|
* user_id: "user_123",
|
|
471
|
-
* redirect_url: "https://merchant.com/kyc-complete",
|
|
472
|
-
* callback_url: "https://merchant.com/api/kyc-webhook"
|
|
473
|
-
* trigger_event: "onboarding"
|
|
664
|
+
* redirect_url: "https://merchant.com/kyc-complete", // optional
|
|
665
|
+
* callback_url: "https://merchant.com/api/kyc-webhook" // optional - receives POST requests on status change
|
|
474
666
|
* });
|
|
475
667
|
*
|
|
476
|
-
*
|
|
477
|
-
*
|
|
478
|
-
* } else if (result.can_skip) {
|
|
479
|
-
* console.log("KYC not required, user can proceed");
|
|
480
|
-
* }
|
|
668
|
+
* console.log(`Redirect user to: ${result.link}`);
|
|
669
|
+
* console.log(`KYC ID: ${result.kyc_id}`);
|
|
481
670
|
* ```
|
|
482
671
|
*/
|
|
483
672
|
requestKycSubmitLink(request: RequestKycSubmitLinkRequest): Promise<RequestKycSubmitLinkResponse>;
|
|
484
673
|
/**
|
|
485
|
-
* Create a
|
|
674
|
+
* Create a Event-Based Face Verification session.
|
|
675
|
+
*
|
|
676
|
+
* Inspect the response before showing UI:
|
|
677
|
+
* - `is_required === false` → skip face capture; `reason` explains why.
|
|
678
|
+
* - `device_type === 'desktop'` → render `qr_payload` as a QR; the
|
|
679
|
+
* mobile device picks up the session via the connect endpoint.
|
|
680
|
+
* - `device_type === 'mobile'` → open the face capture modal directly.
|
|
486
681
|
*
|
|
487
|
-
* @param request -
|
|
682
|
+
* @param request - Reference, customer_id, event, amount (for threshold events), optional URLs.
|
|
488
683
|
*/
|
|
489
|
-
|
|
684
|
+
createEventBasedFaceVerificationSession(request: CreateEventBasedFaceVerificationSessionRequest): Promise<CreateEventBasedFaceVerificationSessionResponse>;
|
|
490
685
|
/**
|
|
491
|
-
* Submit a
|
|
686
|
+
* Submit a real-time face capture for an active Event-Based Face Verification session.
|
|
492
687
|
*
|
|
493
|
-
*
|
|
688
|
+
* **Mobile-only.** The server rejects desktop User-Agents with HTTP
|
|
689
|
+
* 400 (`face capture must be completed on a mobile device`). Use the
|
|
690
|
+
* QR handoff from `createEventBasedFaceVerificationSession` for desktop callers.
|
|
691
|
+
*
|
|
692
|
+
* The `data` field on the response carries `retries_remaining`,
|
|
693
|
+
* `retry_limit_exceeded`, and the reaction flags (`enforce_logout`,
|
|
694
|
+
* `freeze_account`, etc.) so the tenant app can act on a final failure.
|
|
695
|
+
*
|
|
696
|
+
* @param request - Token from `createEventBasedFaceVerificationSession`, plus the base64 selfie.
|
|
494
697
|
*/
|
|
495
|
-
|
|
698
|
+
submitEventBasedFaceVerificationSession(request: SubmitEventBasedFaceVerificationSessionRequest): Promise<EventBasedFaceVerificationCallback>;
|
|
496
699
|
/**
|
|
497
|
-
*
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
|
|
700
|
+
* Look up the current state of a Event-Based Face Verification session by its forward
|
|
701
|
+
* reference. Useful for desktop pollers waiting on the mobile handoff.
|
|
702
|
+
*
|
|
703
|
+
* @param reference - The reference used when the session was created.
|
|
704
|
+
*/
|
|
705
|
+
getEventBasedFaceVerificationSessionStatus(reference: string): Promise<EventBasedFaceVerificationCallback>;
|
|
706
|
+
/**
|
|
707
|
+
* Fetch the Redis-backed handoff session for a token. Same backing
|
|
708
|
+
* store as normal KYC (`kyc:session:<token>`, 15-minute TTL). Desktop
|
|
709
|
+
* callers poll `mobile_connected` to detect when a mobile device has
|
|
710
|
+
* scanned the QR and attached.
|
|
711
|
+
*
|
|
712
|
+
* @param token - The session token returned by `createEventBasedFaceVerificationSession`.
|
|
713
|
+
*/
|
|
714
|
+
getHandoffSession(token: string): Promise<KycHandoffSession>;
|
|
715
|
+
/**
|
|
716
|
+
* Attach a mobile device to a desktop-initiated session. The mobile
|
|
717
|
+
* client calls this after scanning the QR code. The desktop poller
|
|
718
|
+
* sees `mobile_connected: true` on the next `getHandoffSession`.
|
|
719
|
+
*
|
|
720
|
+
* @param token - The session token transferred via the QR payload.
|
|
721
|
+
* @param isDisconnect - Pass true to release the session (default false).
|
|
722
|
+
*/
|
|
723
|
+
connectMobileSession(token: string, isDisconnect?: boolean): Promise<{
|
|
724
|
+
mobile_connected: boolean;
|
|
725
|
+
}>;
|
|
502
726
|
/**
|
|
503
727
|
* Check KYC status for a user
|
|
504
728
|
*
|
|
@@ -819,4 +1043,4 @@ declare class KycClient extends BaseClient {
|
|
|
819
1043
|
createCustomerProfile(profile: CreateProfileRequest): Promise<CustomerProfile>;
|
|
820
1044
|
}
|
|
821
1045
|
|
|
822
|
-
export { type CheckKycStatusRequest, type CheckKycStatusResponse, CreateProfileRequest as CreateCustomerProfileRequest, type
|
|
1046
|
+
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 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 };
|
package/dist/kyc/index.js
CHANGED
|
@@ -216,7 +216,7 @@ function createConsoleLogger() {
|
|
|
216
216
|
}
|
|
217
217
|
|
|
218
218
|
// src/core/version.ts
|
|
219
|
-
var SDK_VERSION = "1.
|
|
219
|
+
var SDK_VERSION = "1.7.0";
|
|
220
220
|
|
|
221
221
|
// src/shared/browser-utils.ts
|
|
222
222
|
function generateUUID() {
|
|
@@ -603,23 +603,19 @@ var KycClient = class extends BaseClient {
|
|
|
603
603
|
*
|
|
604
604
|
* Generates a link that the user can visit to submit their KYC documents.
|
|
605
605
|
*
|
|
606
|
-
* @param request - Request containing the user ID, redirect URL, callback URL
|
|
607
|
-
* @returns Response containing
|
|
606
|
+
* @param request - Request containing the user ID, optional redirect URL, and optional callback URL (receives POST requests)
|
|
607
|
+
* @returns Response containing the redirect link and KYC ID
|
|
608
608
|
*
|
|
609
609
|
* @example
|
|
610
610
|
* ```typescript
|
|
611
611
|
* const result = await client.requestKycSubmitLink({
|
|
612
612
|
* user_id: "user_123",
|
|
613
|
-
* redirect_url: "https://merchant.com/kyc-complete",
|
|
614
|
-
* callback_url: "https://merchant.com/api/kyc-webhook"
|
|
615
|
-
* trigger_event: "onboarding"
|
|
613
|
+
* redirect_url: "https://merchant.com/kyc-complete", // optional
|
|
614
|
+
* callback_url: "https://merchant.com/api/kyc-webhook" // optional - receives POST requests on status change
|
|
616
615
|
* });
|
|
617
616
|
*
|
|
618
|
-
*
|
|
619
|
-
*
|
|
620
|
-
* } else if (result.can_skip) {
|
|
621
|
-
* console.log("KYC not required, user can proceed");
|
|
622
|
-
* }
|
|
617
|
+
* console.log(`Redirect user to: ${result.link}`);
|
|
618
|
+
* console.log(`KYC ID: ${result.kyc_id}`);
|
|
623
619
|
* ```
|
|
624
620
|
*/
|
|
625
621
|
async requestKycSubmitLink(request) {
|
|
@@ -630,40 +626,84 @@ var KycClient = class extends BaseClient {
|
|
|
630
626
|
});
|
|
631
627
|
}
|
|
632
628
|
/**
|
|
633
|
-
* Create a
|
|
629
|
+
* Create a Event-Based Face Verification session.
|
|
630
|
+
*
|
|
631
|
+
* Inspect the response before showing UI:
|
|
632
|
+
* - `is_required === false` → skip face capture; `reason` explains why.
|
|
633
|
+
* - `device_type === 'desktop'` → render `qr_payload` as a QR; the
|
|
634
|
+
* mobile device picks up the session via the connect endpoint.
|
|
635
|
+
* - `device_type === 'mobile'` → open the face capture modal directly.
|
|
634
636
|
*
|
|
635
|
-
* @param request -
|
|
637
|
+
* @param request - Reference, customer_id, event, amount (for threshold events), optional URLs.
|
|
636
638
|
*/
|
|
637
|
-
async
|
|
638
|
-
return this.
|
|
639
|
+
async createEventBasedFaceVerificationSession(request) {
|
|
640
|
+
return this.request("/api/v1/kyc/face/session", {
|
|
639
641
|
method: "POST",
|
|
640
642
|
body: JSON.stringify(request),
|
|
641
643
|
headers: this.getUserHeaders()
|
|
642
644
|
});
|
|
643
645
|
}
|
|
644
646
|
/**
|
|
645
|
-
* Submit a
|
|
647
|
+
* Submit a real-time face capture for an active Event-Based Face Verification session.
|
|
648
|
+
*
|
|
649
|
+
* **Mobile-only.** The server rejects desktop User-Agents with HTTP
|
|
650
|
+
* 400 (`face capture must be completed on a mobile device`). Use the
|
|
651
|
+
* QR handoff from `createEventBasedFaceVerificationSession` for desktop callers.
|
|
646
652
|
*
|
|
647
|
-
*
|
|
653
|
+
* The `data` field on the response carries `retries_remaining`,
|
|
654
|
+
* `retry_limit_exceeded`, and the reaction flags (`enforce_logout`,
|
|
655
|
+
* `freeze_account`, etc.) so the tenant app can act on a final failure.
|
|
656
|
+
*
|
|
657
|
+
* @param request - Token from `createEventBasedFaceVerificationSession`, plus the base64 selfie.
|
|
648
658
|
*/
|
|
649
|
-
async
|
|
650
|
-
return this.
|
|
659
|
+
async submitEventBasedFaceVerificationSession(request) {
|
|
660
|
+
return this.request("/api/v1/kyc/face/submit", {
|
|
651
661
|
method: "POST",
|
|
652
662
|
body: JSON.stringify(request),
|
|
653
663
|
headers: this.getUserHeaders()
|
|
654
664
|
});
|
|
655
665
|
}
|
|
656
666
|
/**
|
|
657
|
-
*
|
|
658
|
-
*
|
|
659
|
-
*
|
|
660
|
-
*
|
|
661
|
-
|
|
667
|
+
* Look up the current state of a Event-Based Face Verification session by its forward
|
|
668
|
+
* reference. Useful for desktop pollers waiting on the mobile handoff.
|
|
669
|
+
*
|
|
670
|
+
* @param reference - The reference used when the session was created.
|
|
671
|
+
*/
|
|
672
|
+
async getEventBasedFaceVerificationSessionStatus(reference) {
|
|
662
673
|
return this.requestWithRetry(`/api/v1/kyc/face/verify/${encodeURIComponent(reference)}`, {
|
|
663
674
|
method: "GET",
|
|
664
675
|
headers: this.getUserHeaders()
|
|
665
676
|
});
|
|
666
677
|
}
|
|
678
|
+
/**
|
|
679
|
+
* Fetch the Redis-backed handoff session for a token. Same backing
|
|
680
|
+
* store as normal KYC (`kyc:session:<token>`, 15-minute TTL). Desktop
|
|
681
|
+
* callers poll `mobile_connected` to detect when a mobile device has
|
|
682
|
+
* scanned the QR and attached.
|
|
683
|
+
*
|
|
684
|
+
* @param token - The session token returned by `createEventBasedFaceVerificationSession`.
|
|
685
|
+
*/
|
|
686
|
+
async getHandoffSession(token) {
|
|
687
|
+
return this.request(
|
|
688
|
+
`/api/v1/kyc/session${this.buildQueryString({ token })}`,
|
|
689
|
+
{ headers: this.getUserHeaders() }
|
|
690
|
+
);
|
|
691
|
+
}
|
|
692
|
+
/**
|
|
693
|
+
* Attach a mobile device to a desktop-initiated session. The mobile
|
|
694
|
+
* client calls this after scanning the QR code. The desktop poller
|
|
695
|
+
* sees `mobile_connected: true` on the next `getHandoffSession`.
|
|
696
|
+
*
|
|
697
|
+
* @param token - The session token transferred via the QR payload.
|
|
698
|
+
* @param isDisconnect - Pass true to release the session (default false).
|
|
699
|
+
*/
|
|
700
|
+
async connectMobileSession(token, isDisconnect = false) {
|
|
701
|
+
return this.request("/api/v1/kyc/session/connect", {
|
|
702
|
+
method: "PUT",
|
|
703
|
+
body: JSON.stringify({ token, is_disconnect: isDisconnect }),
|
|
704
|
+
headers: this.getUserHeaders()
|
|
705
|
+
});
|
|
706
|
+
}
|
|
667
707
|
/**
|
|
668
708
|
* Check KYC status for a user
|
|
669
709
|
*
|
|
@@ -1022,8 +1062,9 @@ var KycClient = class extends BaseClient {
|
|
|
1022
1062
|
*/
|
|
1023
1063
|
async riskProfileRequest(path, options = {}) {
|
|
1024
1064
|
if (!this.riskProfileBaseURL) {
|
|
1025
|
-
throw new
|
|
1026
|
-
"Risk Profile Service URL not configured. Please provide riskProfileBaseURL in KycClientConfig."
|
|
1065
|
+
throw new ValidationError(
|
|
1066
|
+
"Risk Profile Service URL not configured. Please provide riskProfileBaseURL in KycClientConfig.",
|
|
1067
|
+
["riskProfileBaseURL"]
|
|
1027
1068
|
);
|
|
1028
1069
|
}
|
|
1029
1070
|
return this.request(path, {
|
|
@@ -1135,6 +1176,20 @@ var KycClient = class extends BaseClient {
|
|
|
1135
1176
|
// ============================================================================
|
|
1136
1177
|
};
|
|
1137
1178
|
|
|
1179
|
+
// src/kyc/types.ts
|
|
1180
|
+
var KYC_DECLINED_DESCRIPTIONS = {
|
|
1181
|
+
KYC_DOCUMENT_EXPIRED: "The submitted document has expired",
|
|
1182
|
+
KYC_DOCUMENT_INVALID: "The submitted document could not be verified",
|
|
1183
|
+
KYC_FACE_MISMATCH: "Face verification did not match the identity document",
|
|
1184
|
+
KYC_AGE_REQUIREMENT: "Age requirement not met",
|
|
1185
|
+
KYC_DUPLICATE_IDENTITY: "This identity has already been verified under another account",
|
|
1186
|
+
KYC_ADDRESS_MISMATCH: "Address verification failed",
|
|
1187
|
+
KYC_NAME_MISMATCH: "Name on document does not match the registered name",
|
|
1188
|
+
KYC_PROVIDER_REJECTED: "Identity verification was rejected by the verification provider",
|
|
1189
|
+
KYC_DECLINED: "Identity verification was declined"
|
|
1190
|
+
};
|
|
1191
|
+
|
|
1192
|
+
exports.KYC_DECLINED_DESCRIPTIONS = KYC_DECLINED_DESCRIPTIONS;
|
|
1138
1193
|
exports.KycClient = KycClient;
|
|
1139
1194
|
//# sourceMappingURL=index.js.map
|
|
1140
1195
|
//# sourceMappingURL=index.js.map
|