vesant-sdk 2.0.0-dev.76771da → 2.0.0-dev.b7fc6ce
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/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +54 -10
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +54 -10
- 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 +54 -10
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +54 -10
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +230 -19
- package/dist/kyc/index.d.ts +230 -19
- package/dist/kyc/index.js +54 -10
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +54 -10
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +37 -2
- package/dist/react.d.ts +37 -2
- package/dist/react.js +603 -272
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +603 -272
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/kyc/index.d.mts
CHANGED
|
@@ -119,6 +119,65 @@ interface UpdateKycAlertRequest {
|
|
|
119
119
|
alert_type?: KycAlertType;
|
|
120
120
|
status?: KycAlertStatus;
|
|
121
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Threshold-gated trigger for transaction events. Each rule is
|
|
124
|
+
* self-contained — there is no umbrella flag.
|
|
125
|
+
*
|
|
126
|
+
* - `enabled=false` → event blocked.
|
|
127
|
+
* - `enabled=true`, `threshold=0` (or null/omitted) → every event of this
|
|
128
|
+
* type triggers Re-Use KYC, regardless of amount.
|
|
129
|
+
* - `enabled=true`, `threshold>0` → only amounts `>= threshold` trigger.
|
|
130
|
+
*/
|
|
131
|
+
interface ReuseKycThresholdTrigger {
|
|
132
|
+
enabled: boolean;
|
|
133
|
+
/** USD threshold; 0 / null / omitted means "any amount". */
|
|
134
|
+
threshold: number;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Rate-of-occurrence trigger (used by `high_frequency_betting`). The
|
|
138
|
+
* tenant tells the server how many events have happened over how many
|
|
139
|
+
* minutes via the request body (`event_count`, `event_window_minutes`);
|
|
140
|
+
* the server triggers when `event_count >= count` AND
|
|
141
|
+
* `event_window_minutes <= window_minutes`. Either bound of 0 means
|
|
142
|
+
* "don't enforce that bound".
|
|
143
|
+
*/
|
|
144
|
+
interface ReuseKycFrequencyTrigger {
|
|
145
|
+
enabled: boolean;
|
|
146
|
+
/** Minimum number of events; 0 / null / omitted means "any count". */
|
|
147
|
+
count: number;
|
|
148
|
+
/** Maximum lookback window in minutes; 0 / null / omitted means "any window". */
|
|
149
|
+
window_minutes: number;
|
|
150
|
+
}
|
|
151
|
+
/** Events that can trigger Re-Use KYC for a tenant. */
|
|
152
|
+
interface ReuseKycTriggers {
|
|
153
|
+
login: boolean;
|
|
154
|
+
password_change: boolean;
|
|
155
|
+
name_change: boolean;
|
|
156
|
+
phone_number_change: boolean;
|
|
157
|
+
two_factor_auth_change: boolean;
|
|
158
|
+
new_device_or_location: boolean;
|
|
159
|
+
device_fingerprint_change: boolean;
|
|
160
|
+
payment_method_change: boolean;
|
|
161
|
+
deposit: ReuseKycThresholdTrigger;
|
|
162
|
+
withdrawal: ReuseKycThresholdTrigger;
|
|
163
|
+
large_bet_placement: ReuseKycThresholdTrigger;
|
|
164
|
+
high_frequency_betting: ReuseKycFrequencyTrigger;
|
|
165
|
+
account_balance_transfer: boolean;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Reactions taken when a customer exhausts the Re-Use KYC retry limit.
|
|
169
|
+
* `trigger_alert` is enforced by the server (creates a KYC alert);
|
|
170
|
+
* `enforce_logout` and `freeze_account` are forwarded to the tenant app
|
|
171
|
+
* via the callback `data` field for it to enforce.
|
|
172
|
+
*/
|
|
173
|
+
interface ReuseKycReactions {
|
|
174
|
+
/** Retries after the first attempt; total submissions = this + 1. */
|
|
175
|
+
max_retry_attempts: number;
|
|
176
|
+
trigger_alert: boolean;
|
|
177
|
+
enforce_logout: boolean;
|
|
178
|
+
freeze_account: boolean;
|
|
179
|
+
freeze_duration_minutes: number;
|
|
180
|
+
}
|
|
122
181
|
interface KycPreferences {
|
|
123
182
|
id: string;
|
|
124
183
|
tenant_id: string;
|
|
@@ -127,6 +186,8 @@ interface KycPreferences {
|
|
|
127
186
|
is_face_verification_required: boolean;
|
|
128
187
|
is_address_verification_required: boolean;
|
|
129
188
|
is_age_verification_required: boolean;
|
|
189
|
+
/** Master switch for the Re-Use KYC feature. */
|
|
190
|
+
is_reuse_kyc_enabled?: boolean;
|
|
130
191
|
min_age: number;
|
|
131
192
|
max_age: number;
|
|
132
193
|
required_document_count: number;
|
|
@@ -134,6 +195,10 @@ interface KycPreferences {
|
|
|
134
195
|
high_risk_score: number;
|
|
135
196
|
medium_risk_score: number;
|
|
136
197
|
supported_document_types: SupportedDocumentType[];
|
|
198
|
+
/** Per-event triggers for Re-Use KYC. */
|
|
199
|
+
reuse_kyc_triggers?: ReuseKycTriggers;
|
|
200
|
+
/** Retry / reaction policy for Re-Use KYC. */
|
|
201
|
+
reuse_kyc_reactions?: ReuseKycReactions;
|
|
137
202
|
created_at: string;
|
|
138
203
|
updated_at: string;
|
|
139
204
|
}
|
|
@@ -143,6 +208,7 @@ interface UpdateKycPreferencesRequest {
|
|
|
143
208
|
is_face_verification_required?: boolean;
|
|
144
209
|
is_address_verification_required?: boolean;
|
|
145
210
|
is_age_verification_required?: boolean;
|
|
211
|
+
is_reuse_kyc_enabled?: boolean;
|
|
146
212
|
min_age?: number;
|
|
147
213
|
max_age?: number;
|
|
148
214
|
required_document_count?: number;
|
|
@@ -150,6 +216,10 @@ interface UpdateKycPreferencesRequest {
|
|
|
150
216
|
high_risk_score?: number;
|
|
151
217
|
medium_risk_score?: number;
|
|
152
218
|
supported_document_types?: SupportedDocumentType[];
|
|
219
|
+
/** Partial update — only the events present here are changed. */
|
|
220
|
+
reuse_kyc_triggers?: Partial<ReuseKycTriggers>;
|
|
221
|
+
/** Partial update — only the keys present here are changed. */
|
|
222
|
+
reuse_kyc_reactions?: Partial<ReuseKycReactions>;
|
|
153
223
|
}
|
|
154
224
|
interface Name {
|
|
155
225
|
first_name?: string;
|
|
@@ -232,20 +302,54 @@ interface RequestKycSubmitLinkRequest {
|
|
|
232
302
|
/** Event that triggered the KYC request (e.g. "onboarding", "login", "transaction") */
|
|
233
303
|
trigger_event?: string;
|
|
234
304
|
}
|
|
305
|
+
/**
|
|
306
|
+
* Trigger events that can request Re-Use KYC.
|
|
307
|
+
*
|
|
308
|
+
* Account-sensitive: any sensitive change to the account profile.
|
|
309
|
+
* Transaction events: covered by the per-event rules in
|
|
310
|
+
* `ReuseKycTriggers` (`deposit`, `withdrawal`, `large_bet_placement`,
|
|
311
|
+
* `high_frequency_betting`, `account_balance_transfer`).
|
|
312
|
+
*/
|
|
313
|
+
type ReuseKycEvent = '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';
|
|
235
314
|
interface CreateReuseKycSessionRequest {
|
|
236
315
|
/** Unique reference for the KYC session (e.g., customer ID or transaction ID) */
|
|
237
316
|
reference: string;
|
|
238
|
-
/**
|
|
317
|
+
/** Customer ID to associate with the KYC session */
|
|
239
318
|
customer_id: string;
|
|
240
|
-
/**
|
|
241
|
-
|
|
319
|
+
/**
|
|
320
|
+
* The triggering event. One of the `ReuseKycEvent` union members.
|
|
321
|
+
* Required — when empty, the server falls through to the unknown-event
|
|
322
|
+
* passthrough and allows the request silently.
|
|
323
|
+
*/
|
|
324
|
+
event: ReuseKycEvent;
|
|
325
|
+
/**
|
|
326
|
+
* USD amount associated with the event. Required for threshold-gated
|
|
327
|
+
* events (`deposit`, `withdrawal`, `large_bet_placement`); ignored for
|
|
328
|
+
* everything else. Missing/zero with a non-zero threshold blocks the
|
|
329
|
+
* session.
|
|
330
|
+
*/
|
|
331
|
+
amount?: number;
|
|
332
|
+
/**
|
|
333
|
+
* Number of qualifying events the customer has performed in the
|
|
334
|
+
* window described by `event_window_minutes`. Required for
|
|
335
|
+
* frequency-gated events (`high_frequency_betting`); ignored for
|
|
336
|
+
* everything else.
|
|
337
|
+
*/
|
|
338
|
+
event_count?: number;
|
|
339
|
+
/**
|
|
340
|
+
* Lookback window (in minutes) the tenant counted `event_count` over.
|
|
341
|
+
* Required for frequency-gated events alongside `event_count`. A
|
|
342
|
+
* window larger than the tenant's configured `window_minutes`
|
|
343
|
+
* implies a slower rate than "high frequency" and blocks the session.
|
|
344
|
+
*/
|
|
345
|
+
event_window_minutes?: number;
|
|
242
346
|
/** URL to redirect user after validate the facial submission (optional) */
|
|
243
347
|
redirect_url?: string;
|
|
244
348
|
/** URL to receive callback notifications via POST request when reuse KYC status changes (optional) */
|
|
245
349
|
callback_url?: string;
|
|
246
350
|
}
|
|
247
351
|
interface SubmitReuseKycSessionRequest {
|
|
248
|
-
/** Reuse KYC session token generated from
|
|
352
|
+
/** Reuse KYC session token generated from createReuseKycSession */
|
|
249
353
|
token: string;
|
|
250
354
|
/** Base64 encoded face image or selfie for verification */
|
|
251
355
|
proof: string;
|
|
@@ -258,13 +362,85 @@ interface RequestKycSubmitLinkResponse {
|
|
|
258
362
|
/** KYC request ID */
|
|
259
363
|
kyc_id: string;
|
|
260
364
|
}
|
|
365
|
+
/** Device class detected by the SDK (purely client-side — server doesn't care). */
|
|
366
|
+
type ReuseKycDeviceType = 'mobile' | 'desktop';
|
|
261
367
|
interface CreateReuseKycSessionResponse {
|
|
262
|
-
/**
|
|
263
|
-
token: string;
|
|
264
|
-
/** reuse KYC session reference */
|
|
368
|
+
/** Reuse KYC session reference (echo of the request reference) */
|
|
265
369
|
reference: string;
|
|
266
|
-
/**
|
|
370
|
+
/** Generated reuse KYC session token, valid 10 minutes */
|
|
371
|
+
token: string;
|
|
372
|
+
/**
|
|
373
|
+
* Empty string when Re-Use KYC is required. When `is_required` is
|
|
374
|
+
* false, this contains the human-readable reason (e.g. feature
|
|
375
|
+
* disabled, threshold not met, customer has no prior KYC).
|
|
376
|
+
*/
|
|
377
|
+
reason: string;
|
|
378
|
+
/** Whether the caller must complete the face capture before proceeding */
|
|
267
379
|
is_required: boolean;
|
|
380
|
+
/**
|
|
381
|
+
* Public HTTPS handoff URL the SDK encodes into a QR code on desktop.
|
|
382
|
+
* The mobile device scans it, lands on the tenant frontend's
|
|
383
|
+
* /reuse-kyc-submit page, and completes the face capture there. Empty
|
|
384
|
+
* when the server has no `BASE_URL_FRONTEND` configured — the SDK
|
|
385
|
+
* falls back to building its own URL in that case.
|
|
386
|
+
*/
|
|
387
|
+
link: string;
|
|
388
|
+
/** Failed face-capture attempts so far on this session. 0 on a fresh session. */
|
|
389
|
+
attempts: number;
|
|
390
|
+
/**
|
|
391
|
+
* Total submissions permitted before reactions fire
|
|
392
|
+
* (`reuse_kyc_reactions.max_retry_attempts + 1`).
|
|
393
|
+
*/
|
|
394
|
+
max_attempts: number;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Reaction outcome returned on every face-submit callback. Tenant apps
|
|
398
|
+
* use this to decide whether to allow another retry, end the session,
|
|
399
|
+
* or freeze the account. Reaction flags are only populated when
|
|
400
|
+
* `retry_limit_exceeded` is true.
|
|
401
|
+
*/
|
|
402
|
+
interface ReuseKycReactionResult {
|
|
403
|
+
/** Submissions the customer still has before the retry limit fires. */
|
|
404
|
+
retries_remaining: number;
|
|
405
|
+
/** True once the latest failed attempt exhausts the retry policy. */
|
|
406
|
+
retry_limit_exceeded: boolean;
|
|
407
|
+
trigger_alert: boolean;
|
|
408
|
+
enforce_logout: boolean;
|
|
409
|
+
freeze_account: boolean;
|
|
410
|
+
freeze_duration_minutes: number;
|
|
411
|
+
/** Set when an alert was raised on the dashboard. */
|
|
412
|
+
alert_id?: string;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Shape of the webhook body POSTed to `callback_url` after a Re-Use KYC
|
|
416
|
+
* submission completes (also returned synchronously from
|
|
417
|
+
* `submitReuseKycSession`).
|
|
418
|
+
*/
|
|
419
|
+
interface ReuseKycCallback {
|
|
420
|
+
event: 'reuse_kyc';
|
|
421
|
+
reference: string;
|
|
422
|
+
resource_id: string;
|
|
423
|
+
status: KycStatus;
|
|
424
|
+
declined_reason?: string;
|
|
425
|
+
warnings?: Record<string, Record<string, string>>;
|
|
426
|
+
data: ReuseKycReactionResult;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Server-side handoff session backed by Redis (TTL: 15 minutes). Shared
|
|
430
|
+
* with the normal KYC mobile/desktop handoff. Desktop clients poll this
|
|
431
|
+
* to detect when a mobile device has attached to the same token via QR.
|
|
432
|
+
*/
|
|
433
|
+
interface KycHandoffSession {
|
|
434
|
+
document: string;
|
|
435
|
+
document_backside: string;
|
|
436
|
+
document_two: string;
|
|
437
|
+
document_two_backside: string;
|
|
438
|
+
address: string;
|
|
439
|
+
face: string;
|
|
440
|
+
/** True after a mobile device hits PUT /api/v1/kyc/session/connect. */
|
|
441
|
+
mobile_connected: boolean;
|
|
442
|
+
/** True after the (normal-KYC) document submission completes; unused for Re-Use KYC. */
|
|
443
|
+
is_submitted: boolean;
|
|
268
444
|
}
|
|
269
445
|
interface CheckKycStatusRequest {
|
|
270
446
|
/** User ID to check KYC status for */
|
|
@@ -477,23 +653,58 @@ declare class KycClient extends BaseClient {
|
|
|
477
653
|
*/
|
|
478
654
|
requestKycSubmitLink(request: RequestKycSubmitLinkRequest): Promise<RequestKycSubmitLinkResponse>;
|
|
479
655
|
/**
|
|
480
|
-
* Create a
|
|
656
|
+
* Create a Re-Use KYC session.
|
|
481
657
|
*
|
|
482
|
-
*
|
|
658
|
+
* Inspect the response before showing UI:
|
|
659
|
+
* - `is_required === false` → skip face capture; `reason` explains why.
|
|
660
|
+
* - `device_type === 'desktop'` → render `qr_payload` as a QR; the
|
|
661
|
+
* mobile device picks up the session via the connect endpoint.
|
|
662
|
+
* - `device_type === 'mobile'` → open the face capture modal directly.
|
|
663
|
+
*
|
|
664
|
+
* @param request - Reference, customer_id, event, amount (for threshold events), optional URLs.
|
|
483
665
|
*/
|
|
484
666
|
createReuseKycSession(request: CreateReuseKycSessionRequest): Promise<CreateReuseKycSessionResponse>;
|
|
485
667
|
/**
|
|
486
|
-
* Submit a
|
|
668
|
+
* Submit a real-time face capture for an active Re-Use KYC session.
|
|
669
|
+
*
|
|
670
|
+
* **Mobile-only.** The server rejects desktop User-Agents with HTTP
|
|
671
|
+
* 400 (`face capture must be completed on a mobile device`). Use the
|
|
672
|
+
* QR handoff from `createReuseKycSession` for desktop callers.
|
|
487
673
|
*
|
|
488
|
-
*
|
|
674
|
+
* The `data` field on the response carries `retries_remaining`,
|
|
675
|
+
* `retry_limit_exceeded`, and the reaction flags (`enforce_logout`,
|
|
676
|
+
* `freeze_account`, etc.) so the tenant app can act on a final failure.
|
|
677
|
+
*
|
|
678
|
+
* @param request - Token from `createReuseKycSession`, plus the base64 selfie.
|
|
489
679
|
*/
|
|
490
|
-
submitReuseKycSession(request: SubmitReuseKycSessionRequest): Promise<
|
|
680
|
+
submitReuseKycSession(request: SubmitReuseKycSessionRequest): Promise<ReuseKycCallback>;
|
|
491
681
|
/**
|
|
492
|
-
*
|
|
493
|
-
*
|
|
494
|
-
*
|
|
495
|
-
*
|
|
496
|
-
|
|
682
|
+
* Look up the current state of a Re-Use KYC session by its forward
|
|
683
|
+
* reference. Useful for desktop pollers waiting on the mobile handoff.
|
|
684
|
+
*
|
|
685
|
+
* @param reference - The reference used when the session was created.
|
|
686
|
+
*/
|
|
687
|
+
getReuseKycSessionStatus(reference: string): Promise<ReuseKycCallback>;
|
|
688
|
+
/**
|
|
689
|
+
* Fetch the Redis-backed handoff session for a token. Same backing
|
|
690
|
+
* store as normal KYC (`kyc:session:<token>`, 15-minute TTL). Desktop
|
|
691
|
+
* callers poll `mobile_connected` to detect when a mobile device has
|
|
692
|
+
* scanned the QR and attached.
|
|
693
|
+
*
|
|
694
|
+
* @param token - The session token returned by `createReuseKycSession`.
|
|
695
|
+
*/
|
|
696
|
+
getHandoffSession(token: string): Promise<KycHandoffSession>;
|
|
697
|
+
/**
|
|
698
|
+
* Attach a mobile device to a desktop-initiated session. The mobile
|
|
699
|
+
* client calls this after scanning the QR code. The desktop poller
|
|
700
|
+
* sees `mobile_connected: true` on the next `getHandoffSession`.
|
|
701
|
+
*
|
|
702
|
+
* @param token - The session token transferred via the QR payload.
|
|
703
|
+
* @param isDisconnect - Pass true to release the session (default false).
|
|
704
|
+
*/
|
|
705
|
+
connectMobileSession(token: string, isDisconnect?: boolean): Promise<{
|
|
706
|
+
mobile_connected: boolean;
|
|
707
|
+
}>;
|
|
497
708
|
/**
|
|
498
709
|
* Check KYC status for a user
|
|
499
710
|
*
|
|
@@ -814,4 +1025,4 @@ declare class KycClient extends BaseClient {
|
|
|
814
1025
|
createCustomerProfile(profile: CreateProfileRequest): Promise<CustomerProfile>;
|
|
815
1026
|
}
|
|
816
1027
|
|
|
817
|
-
export { type CheckKycStatusRequest, type CheckKycStatusResponse, CreateProfileRequest as CreateCustomerProfileRequest, type CreateReuseKycSessionRequest, type CreateReuseKycSessionResponse, CustomerProfile, ProfileFilters as CustomerProfileFilters, ProfileListResponse as CustomerProfileListResponse, type DocumentType, type DocumentVerificationRequest, type DocumentVerificationResponse, type FaceProof, KYC_DECLINED_DESCRIPTIONS, type KycAlert, type KycAlertFilters, type KycAlertListResponse, type KycAlertStatus, type KycAlertType, KycClient, type KycClientConfig, type KycCustomerProfile, type KycDeclinedCode, 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 SubmitReuseKycSessionRequest, 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 };
|
|
1028
|
+
export { type CheckKycStatusRequest, type CheckKycStatusResponse, CreateProfileRequest as CreateCustomerProfileRequest, type CreateReuseKycSessionRequest, type CreateReuseKycSessionResponse, CustomerProfile, ProfileFilters as CustomerProfileFilters, ProfileListResponse as CustomerProfileListResponse, type DocumentType, type DocumentVerificationRequest, type DocumentVerificationResponse, 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, type ReuseKycCallback, type ReuseKycDeviceType, type ReuseKycEvent, type ReuseKycFrequencyTrigger, type ReuseKycReactionResult, type ReuseKycReactions, type ReuseKycThresholdTrigger, type ReuseKycTriggers, RiskLevel, type SubmitReuseKycSessionRequest, 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.d.ts
CHANGED
|
@@ -119,6 +119,65 @@ interface UpdateKycAlertRequest {
|
|
|
119
119
|
alert_type?: KycAlertType;
|
|
120
120
|
status?: KycAlertStatus;
|
|
121
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Threshold-gated trigger for transaction events. Each rule is
|
|
124
|
+
* self-contained — there is no umbrella flag.
|
|
125
|
+
*
|
|
126
|
+
* - `enabled=false` → event blocked.
|
|
127
|
+
* - `enabled=true`, `threshold=0` (or null/omitted) → every event of this
|
|
128
|
+
* type triggers Re-Use KYC, regardless of amount.
|
|
129
|
+
* - `enabled=true`, `threshold>0` → only amounts `>= threshold` trigger.
|
|
130
|
+
*/
|
|
131
|
+
interface ReuseKycThresholdTrigger {
|
|
132
|
+
enabled: boolean;
|
|
133
|
+
/** USD threshold; 0 / null / omitted means "any amount". */
|
|
134
|
+
threshold: number;
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Rate-of-occurrence trigger (used by `high_frequency_betting`). The
|
|
138
|
+
* tenant tells the server how many events have happened over how many
|
|
139
|
+
* minutes via the request body (`event_count`, `event_window_minutes`);
|
|
140
|
+
* the server triggers when `event_count >= count` AND
|
|
141
|
+
* `event_window_minutes <= window_minutes`. Either bound of 0 means
|
|
142
|
+
* "don't enforce that bound".
|
|
143
|
+
*/
|
|
144
|
+
interface ReuseKycFrequencyTrigger {
|
|
145
|
+
enabled: boolean;
|
|
146
|
+
/** Minimum number of events; 0 / null / omitted means "any count". */
|
|
147
|
+
count: number;
|
|
148
|
+
/** Maximum lookback window in minutes; 0 / null / omitted means "any window". */
|
|
149
|
+
window_minutes: number;
|
|
150
|
+
}
|
|
151
|
+
/** Events that can trigger Re-Use KYC for a tenant. */
|
|
152
|
+
interface ReuseKycTriggers {
|
|
153
|
+
login: boolean;
|
|
154
|
+
password_change: boolean;
|
|
155
|
+
name_change: boolean;
|
|
156
|
+
phone_number_change: boolean;
|
|
157
|
+
two_factor_auth_change: boolean;
|
|
158
|
+
new_device_or_location: boolean;
|
|
159
|
+
device_fingerprint_change: boolean;
|
|
160
|
+
payment_method_change: boolean;
|
|
161
|
+
deposit: ReuseKycThresholdTrigger;
|
|
162
|
+
withdrawal: ReuseKycThresholdTrigger;
|
|
163
|
+
large_bet_placement: ReuseKycThresholdTrigger;
|
|
164
|
+
high_frequency_betting: ReuseKycFrequencyTrigger;
|
|
165
|
+
account_balance_transfer: boolean;
|
|
166
|
+
}
|
|
167
|
+
/**
|
|
168
|
+
* Reactions taken when a customer exhausts the Re-Use KYC retry limit.
|
|
169
|
+
* `trigger_alert` is enforced by the server (creates a KYC alert);
|
|
170
|
+
* `enforce_logout` and `freeze_account` are forwarded to the tenant app
|
|
171
|
+
* via the callback `data` field for it to enforce.
|
|
172
|
+
*/
|
|
173
|
+
interface ReuseKycReactions {
|
|
174
|
+
/** Retries after the first attempt; total submissions = this + 1. */
|
|
175
|
+
max_retry_attempts: number;
|
|
176
|
+
trigger_alert: boolean;
|
|
177
|
+
enforce_logout: boolean;
|
|
178
|
+
freeze_account: boolean;
|
|
179
|
+
freeze_duration_minutes: number;
|
|
180
|
+
}
|
|
122
181
|
interface KycPreferences {
|
|
123
182
|
id: string;
|
|
124
183
|
tenant_id: string;
|
|
@@ -127,6 +186,8 @@ interface KycPreferences {
|
|
|
127
186
|
is_face_verification_required: boolean;
|
|
128
187
|
is_address_verification_required: boolean;
|
|
129
188
|
is_age_verification_required: boolean;
|
|
189
|
+
/** Master switch for the Re-Use KYC feature. */
|
|
190
|
+
is_reuse_kyc_enabled?: boolean;
|
|
130
191
|
min_age: number;
|
|
131
192
|
max_age: number;
|
|
132
193
|
required_document_count: number;
|
|
@@ -134,6 +195,10 @@ interface KycPreferences {
|
|
|
134
195
|
high_risk_score: number;
|
|
135
196
|
medium_risk_score: number;
|
|
136
197
|
supported_document_types: SupportedDocumentType[];
|
|
198
|
+
/** Per-event triggers for Re-Use KYC. */
|
|
199
|
+
reuse_kyc_triggers?: ReuseKycTriggers;
|
|
200
|
+
/** Retry / reaction policy for Re-Use KYC. */
|
|
201
|
+
reuse_kyc_reactions?: ReuseKycReactions;
|
|
137
202
|
created_at: string;
|
|
138
203
|
updated_at: string;
|
|
139
204
|
}
|
|
@@ -143,6 +208,7 @@ interface UpdateKycPreferencesRequest {
|
|
|
143
208
|
is_face_verification_required?: boolean;
|
|
144
209
|
is_address_verification_required?: boolean;
|
|
145
210
|
is_age_verification_required?: boolean;
|
|
211
|
+
is_reuse_kyc_enabled?: boolean;
|
|
146
212
|
min_age?: number;
|
|
147
213
|
max_age?: number;
|
|
148
214
|
required_document_count?: number;
|
|
@@ -150,6 +216,10 @@ interface UpdateKycPreferencesRequest {
|
|
|
150
216
|
high_risk_score?: number;
|
|
151
217
|
medium_risk_score?: number;
|
|
152
218
|
supported_document_types?: SupportedDocumentType[];
|
|
219
|
+
/** Partial update — only the events present here are changed. */
|
|
220
|
+
reuse_kyc_triggers?: Partial<ReuseKycTriggers>;
|
|
221
|
+
/** Partial update — only the keys present here are changed. */
|
|
222
|
+
reuse_kyc_reactions?: Partial<ReuseKycReactions>;
|
|
153
223
|
}
|
|
154
224
|
interface Name {
|
|
155
225
|
first_name?: string;
|
|
@@ -232,20 +302,54 @@ interface RequestKycSubmitLinkRequest {
|
|
|
232
302
|
/** Event that triggered the KYC request (e.g. "onboarding", "login", "transaction") */
|
|
233
303
|
trigger_event?: string;
|
|
234
304
|
}
|
|
305
|
+
/**
|
|
306
|
+
* Trigger events that can request Re-Use KYC.
|
|
307
|
+
*
|
|
308
|
+
* Account-sensitive: any sensitive change to the account profile.
|
|
309
|
+
* Transaction events: covered by the per-event rules in
|
|
310
|
+
* `ReuseKycTriggers` (`deposit`, `withdrawal`, `large_bet_placement`,
|
|
311
|
+
* `high_frequency_betting`, `account_balance_transfer`).
|
|
312
|
+
*/
|
|
313
|
+
type ReuseKycEvent = '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';
|
|
235
314
|
interface CreateReuseKycSessionRequest {
|
|
236
315
|
/** Unique reference for the KYC session (e.g., customer ID or transaction ID) */
|
|
237
316
|
reference: string;
|
|
238
|
-
/**
|
|
317
|
+
/** Customer ID to associate with the KYC session */
|
|
239
318
|
customer_id: string;
|
|
240
|
-
/**
|
|
241
|
-
|
|
319
|
+
/**
|
|
320
|
+
* The triggering event. One of the `ReuseKycEvent` union members.
|
|
321
|
+
* Required — when empty, the server falls through to the unknown-event
|
|
322
|
+
* passthrough and allows the request silently.
|
|
323
|
+
*/
|
|
324
|
+
event: ReuseKycEvent;
|
|
325
|
+
/**
|
|
326
|
+
* USD amount associated with the event. Required for threshold-gated
|
|
327
|
+
* events (`deposit`, `withdrawal`, `large_bet_placement`); ignored for
|
|
328
|
+
* everything else. Missing/zero with a non-zero threshold blocks the
|
|
329
|
+
* session.
|
|
330
|
+
*/
|
|
331
|
+
amount?: number;
|
|
332
|
+
/**
|
|
333
|
+
* Number of qualifying events the customer has performed in the
|
|
334
|
+
* window described by `event_window_minutes`. Required for
|
|
335
|
+
* frequency-gated events (`high_frequency_betting`); ignored for
|
|
336
|
+
* everything else.
|
|
337
|
+
*/
|
|
338
|
+
event_count?: number;
|
|
339
|
+
/**
|
|
340
|
+
* Lookback window (in minutes) the tenant counted `event_count` over.
|
|
341
|
+
* Required for frequency-gated events alongside `event_count`. A
|
|
342
|
+
* window larger than the tenant's configured `window_minutes`
|
|
343
|
+
* implies a slower rate than "high frequency" and blocks the session.
|
|
344
|
+
*/
|
|
345
|
+
event_window_minutes?: number;
|
|
242
346
|
/** URL to redirect user after validate the facial submission (optional) */
|
|
243
347
|
redirect_url?: string;
|
|
244
348
|
/** URL to receive callback notifications via POST request when reuse KYC status changes (optional) */
|
|
245
349
|
callback_url?: string;
|
|
246
350
|
}
|
|
247
351
|
interface SubmitReuseKycSessionRequest {
|
|
248
|
-
/** Reuse KYC session token generated from
|
|
352
|
+
/** Reuse KYC session token generated from createReuseKycSession */
|
|
249
353
|
token: string;
|
|
250
354
|
/** Base64 encoded face image or selfie for verification */
|
|
251
355
|
proof: string;
|
|
@@ -258,13 +362,85 @@ interface RequestKycSubmitLinkResponse {
|
|
|
258
362
|
/** KYC request ID */
|
|
259
363
|
kyc_id: string;
|
|
260
364
|
}
|
|
365
|
+
/** Device class detected by the SDK (purely client-side — server doesn't care). */
|
|
366
|
+
type ReuseKycDeviceType = 'mobile' | 'desktop';
|
|
261
367
|
interface CreateReuseKycSessionResponse {
|
|
262
|
-
/**
|
|
263
|
-
token: string;
|
|
264
|
-
/** reuse KYC session reference */
|
|
368
|
+
/** Reuse KYC session reference (echo of the request reference) */
|
|
265
369
|
reference: string;
|
|
266
|
-
/**
|
|
370
|
+
/** Generated reuse KYC session token, valid 10 minutes */
|
|
371
|
+
token: string;
|
|
372
|
+
/**
|
|
373
|
+
* Empty string when Re-Use KYC is required. When `is_required` is
|
|
374
|
+
* false, this contains the human-readable reason (e.g. feature
|
|
375
|
+
* disabled, threshold not met, customer has no prior KYC).
|
|
376
|
+
*/
|
|
377
|
+
reason: string;
|
|
378
|
+
/** Whether the caller must complete the face capture before proceeding */
|
|
267
379
|
is_required: boolean;
|
|
380
|
+
/**
|
|
381
|
+
* Public HTTPS handoff URL the SDK encodes into a QR code on desktop.
|
|
382
|
+
* The mobile device scans it, lands on the tenant frontend's
|
|
383
|
+
* /reuse-kyc-submit page, and completes the face capture there. Empty
|
|
384
|
+
* when the server has no `BASE_URL_FRONTEND` configured — the SDK
|
|
385
|
+
* falls back to building its own URL in that case.
|
|
386
|
+
*/
|
|
387
|
+
link: string;
|
|
388
|
+
/** Failed face-capture attempts so far on this session. 0 on a fresh session. */
|
|
389
|
+
attempts: number;
|
|
390
|
+
/**
|
|
391
|
+
* Total submissions permitted before reactions fire
|
|
392
|
+
* (`reuse_kyc_reactions.max_retry_attempts + 1`).
|
|
393
|
+
*/
|
|
394
|
+
max_attempts: number;
|
|
395
|
+
}
|
|
396
|
+
/**
|
|
397
|
+
* Reaction outcome returned on every face-submit callback. Tenant apps
|
|
398
|
+
* use this to decide whether to allow another retry, end the session,
|
|
399
|
+
* or freeze the account. Reaction flags are only populated when
|
|
400
|
+
* `retry_limit_exceeded` is true.
|
|
401
|
+
*/
|
|
402
|
+
interface ReuseKycReactionResult {
|
|
403
|
+
/** Submissions the customer still has before the retry limit fires. */
|
|
404
|
+
retries_remaining: number;
|
|
405
|
+
/** True once the latest failed attempt exhausts the retry policy. */
|
|
406
|
+
retry_limit_exceeded: boolean;
|
|
407
|
+
trigger_alert: boolean;
|
|
408
|
+
enforce_logout: boolean;
|
|
409
|
+
freeze_account: boolean;
|
|
410
|
+
freeze_duration_minutes: number;
|
|
411
|
+
/** Set when an alert was raised on the dashboard. */
|
|
412
|
+
alert_id?: string;
|
|
413
|
+
}
|
|
414
|
+
/**
|
|
415
|
+
* Shape of the webhook body POSTed to `callback_url` after a Re-Use KYC
|
|
416
|
+
* submission completes (also returned synchronously from
|
|
417
|
+
* `submitReuseKycSession`).
|
|
418
|
+
*/
|
|
419
|
+
interface ReuseKycCallback {
|
|
420
|
+
event: 'reuse_kyc';
|
|
421
|
+
reference: string;
|
|
422
|
+
resource_id: string;
|
|
423
|
+
status: KycStatus;
|
|
424
|
+
declined_reason?: string;
|
|
425
|
+
warnings?: Record<string, Record<string, string>>;
|
|
426
|
+
data: ReuseKycReactionResult;
|
|
427
|
+
}
|
|
428
|
+
/**
|
|
429
|
+
* Server-side handoff session backed by Redis (TTL: 15 minutes). Shared
|
|
430
|
+
* with the normal KYC mobile/desktop handoff. Desktop clients poll this
|
|
431
|
+
* to detect when a mobile device has attached to the same token via QR.
|
|
432
|
+
*/
|
|
433
|
+
interface KycHandoffSession {
|
|
434
|
+
document: string;
|
|
435
|
+
document_backside: string;
|
|
436
|
+
document_two: string;
|
|
437
|
+
document_two_backside: string;
|
|
438
|
+
address: string;
|
|
439
|
+
face: string;
|
|
440
|
+
/** True after a mobile device hits PUT /api/v1/kyc/session/connect. */
|
|
441
|
+
mobile_connected: boolean;
|
|
442
|
+
/** True after the (normal-KYC) document submission completes; unused for Re-Use KYC. */
|
|
443
|
+
is_submitted: boolean;
|
|
268
444
|
}
|
|
269
445
|
interface CheckKycStatusRequest {
|
|
270
446
|
/** User ID to check KYC status for */
|
|
@@ -477,23 +653,58 @@ declare class KycClient extends BaseClient {
|
|
|
477
653
|
*/
|
|
478
654
|
requestKycSubmitLink(request: RequestKycSubmitLinkRequest): Promise<RequestKycSubmitLinkResponse>;
|
|
479
655
|
/**
|
|
480
|
-
* Create a
|
|
656
|
+
* Create a Re-Use KYC session.
|
|
481
657
|
*
|
|
482
|
-
*
|
|
658
|
+
* Inspect the response before showing UI:
|
|
659
|
+
* - `is_required === false` → skip face capture; `reason` explains why.
|
|
660
|
+
* - `device_type === 'desktop'` → render `qr_payload` as a QR; the
|
|
661
|
+
* mobile device picks up the session via the connect endpoint.
|
|
662
|
+
* - `device_type === 'mobile'` → open the face capture modal directly.
|
|
663
|
+
*
|
|
664
|
+
* @param request - Reference, customer_id, event, amount (for threshold events), optional URLs.
|
|
483
665
|
*/
|
|
484
666
|
createReuseKycSession(request: CreateReuseKycSessionRequest): Promise<CreateReuseKycSessionResponse>;
|
|
485
667
|
/**
|
|
486
|
-
* Submit a
|
|
668
|
+
* Submit a real-time face capture for an active Re-Use KYC session.
|
|
669
|
+
*
|
|
670
|
+
* **Mobile-only.** The server rejects desktop User-Agents with HTTP
|
|
671
|
+
* 400 (`face capture must be completed on a mobile device`). Use the
|
|
672
|
+
* QR handoff from `createReuseKycSession` for desktop callers.
|
|
487
673
|
*
|
|
488
|
-
*
|
|
674
|
+
* The `data` field on the response carries `retries_remaining`,
|
|
675
|
+
* `retry_limit_exceeded`, and the reaction flags (`enforce_logout`,
|
|
676
|
+
* `freeze_account`, etc.) so the tenant app can act on a final failure.
|
|
677
|
+
*
|
|
678
|
+
* @param request - Token from `createReuseKycSession`, plus the base64 selfie.
|
|
489
679
|
*/
|
|
490
|
-
submitReuseKycSession(request: SubmitReuseKycSessionRequest): Promise<
|
|
680
|
+
submitReuseKycSession(request: SubmitReuseKycSessionRequest): Promise<ReuseKycCallback>;
|
|
491
681
|
/**
|
|
492
|
-
*
|
|
493
|
-
*
|
|
494
|
-
*
|
|
495
|
-
*
|
|
496
|
-
|
|
682
|
+
* Look up the current state of a Re-Use KYC session by its forward
|
|
683
|
+
* reference. Useful for desktop pollers waiting on the mobile handoff.
|
|
684
|
+
*
|
|
685
|
+
* @param reference - The reference used when the session was created.
|
|
686
|
+
*/
|
|
687
|
+
getReuseKycSessionStatus(reference: string): Promise<ReuseKycCallback>;
|
|
688
|
+
/**
|
|
689
|
+
* Fetch the Redis-backed handoff session for a token. Same backing
|
|
690
|
+
* store as normal KYC (`kyc:session:<token>`, 15-minute TTL). Desktop
|
|
691
|
+
* callers poll `mobile_connected` to detect when a mobile device has
|
|
692
|
+
* scanned the QR and attached.
|
|
693
|
+
*
|
|
694
|
+
* @param token - The session token returned by `createReuseKycSession`.
|
|
695
|
+
*/
|
|
696
|
+
getHandoffSession(token: string): Promise<KycHandoffSession>;
|
|
697
|
+
/**
|
|
698
|
+
* Attach a mobile device to a desktop-initiated session. The mobile
|
|
699
|
+
* client calls this after scanning the QR code. The desktop poller
|
|
700
|
+
* sees `mobile_connected: true` on the next `getHandoffSession`.
|
|
701
|
+
*
|
|
702
|
+
* @param token - The session token transferred via the QR payload.
|
|
703
|
+
* @param isDisconnect - Pass true to release the session (default false).
|
|
704
|
+
*/
|
|
705
|
+
connectMobileSession(token: string, isDisconnect?: boolean): Promise<{
|
|
706
|
+
mobile_connected: boolean;
|
|
707
|
+
}>;
|
|
497
708
|
/**
|
|
498
709
|
* Check KYC status for a user
|
|
499
710
|
*
|
|
@@ -814,4 +1025,4 @@ declare class KycClient extends BaseClient {
|
|
|
814
1025
|
createCustomerProfile(profile: CreateProfileRequest): Promise<CustomerProfile>;
|
|
815
1026
|
}
|
|
816
1027
|
|
|
817
|
-
export { type CheckKycStatusRequest, type CheckKycStatusResponse, CreateProfileRequest as CreateCustomerProfileRequest, type CreateReuseKycSessionRequest, type CreateReuseKycSessionResponse, CustomerProfile, ProfileFilters as CustomerProfileFilters, ProfileListResponse as CustomerProfileListResponse, type DocumentType, type DocumentVerificationRequest, type DocumentVerificationResponse, type FaceProof, KYC_DECLINED_DESCRIPTIONS, type KycAlert, type KycAlertFilters, type KycAlertListResponse, type KycAlertStatus, type KycAlertType, KycClient, type KycClientConfig, type KycCustomerProfile, type KycDeclinedCode, 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 SubmitReuseKycSessionRequest, 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 };
|
|
1028
|
+
export { type CheckKycStatusRequest, type CheckKycStatusResponse, CreateProfileRequest as CreateCustomerProfileRequest, type CreateReuseKycSessionRequest, type CreateReuseKycSessionResponse, CustomerProfile, ProfileFilters as CustomerProfileFilters, ProfileListResponse as CustomerProfileListResponse, type DocumentType, type DocumentVerificationRequest, type DocumentVerificationResponse, 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, type ReuseKycCallback, type ReuseKycDeviceType, type ReuseKycEvent, type ReuseKycFrequencyTrigger, type ReuseKycReactionResult, type ReuseKycReactions, type ReuseKycThresholdTrigger, type ReuseKycTriggers, RiskLevel, type SubmitReuseKycSessionRequest, 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 };
|