vesant-sdk 1.6.6-next.ac58d2b → 1.7.0-dev.059da4f

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.
Files changed (72) hide show
  1. package/README.md +4 -4
  2. package/dist/client-C3DCmGe9.d.ts +436 -0
  3. package/dist/{client-D6PE3pcB.d.mts → client-DMIRx7Tu.d.mts} +4 -2
  4. package/dist/{client-DPtiuQvW.d.ts → client-DoMSYMMR.d.ts} +4 -2
  5. package/dist/client-ZNdnpWe7.d.mts +436 -0
  6. package/dist/compliance/index.d.mts +25 -429
  7. package/dist/compliance/index.d.ts +25 -429
  8. package/dist/compliance/index.js +181 -79
  9. package/dist/compliance/index.js.map +1 -1
  10. package/dist/compliance/index.mjs +181 -80
  11. package/dist/compliance/index.mjs.map +1 -1
  12. package/dist/decisions/index.d.mts +1 -1
  13. package/dist/decisions/index.d.ts +1 -1
  14. package/dist/decisions/index.js +1 -1
  15. package/dist/decisions/index.js.map +1 -1
  16. package/dist/decisions/index.mjs +1 -1
  17. package/dist/decisions/index.mjs.map +1 -1
  18. package/dist/geolocation/index.d.mts +3 -3
  19. package/dist/geolocation/index.d.ts +3 -3
  20. package/dist/geolocation/index.js +2 -1
  21. package/dist/geolocation/index.js.map +1 -1
  22. package/dist/geolocation/index.mjs +2 -1
  23. package/dist/geolocation/index.mjs.map +1 -1
  24. package/dist/index.d.mts +9 -8
  25. package/dist/index.d.ts +9 -8
  26. package/dist/index.js +269 -93
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +268 -94
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/kyc/core.d.mts +3 -3
  31. package/dist/kyc/core.d.ts +3 -3
  32. package/dist/kyc/core.js +77 -15
  33. package/dist/kyc/core.js.map +1 -1
  34. package/dist/kyc/core.mjs +77 -16
  35. package/dist/kyc/core.mjs.map +1 -1
  36. package/dist/kyc/index.d.mts +267 -26
  37. package/dist/kyc/index.d.ts +267 -26
  38. package/dist/kyc/index.js +77 -15
  39. package/dist/kyc/index.js.map +1 -1
  40. package/dist/kyc/index.mjs +77 -16
  41. package/dist/kyc/index.mjs.map +1 -1
  42. package/dist/react.d.mts +45 -8
  43. package/dist/react.d.ts +45 -8
  44. package/dist/react.js +874 -272
  45. package/dist/react.js.map +1 -1
  46. package/dist/react.mjs +873 -271
  47. package/dist/react.mjs.map +1 -1
  48. package/dist/risk-profile/index.d.mts +3 -3
  49. package/dist/risk-profile/index.d.ts +3 -3
  50. package/dist/risk-profile/index.js +1 -1
  51. package/dist/risk-profile/index.js.map +1 -1
  52. package/dist/risk-profile/index.mjs +1 -1
  53. package/dist/risk-profile/index.mjs.map +1 -1
  54. package/dist/scores/index.d.mts +1 -1
  55. package/dist/scores/index.d.ts +1 -1
  56. package/dist/scores/index.js +1 -1
  57. package/dist/scores/index.js.map +1 -1
  58. package/dist/scores/index.mjs +1 -1
  59. package/dist/scores/index.mjs.map +1 -1
  60. package/dist/tax/index.d.mts +41 -1
  61. package/dist/tax/index.d.ts +41 -1
  62. package/dist/tax/index.js +13 -1
  63. package/dist/tax/index.js.map +1 -1
  64. package/dist/tax/index.mjs +13 -1
  65. package/dist/tax/index.mjs.map +1 -1
  66. package/dist/{types-DGDVnogO.d.mts → types-BOFaMQxI.d.mts} +2 -2
  67. package/dist/{types-B4Ezqo7V.d.mts → types-CBQRNL-l.d.mts} +14 -1
  68. package/dist/{types-B4Ezqo7V.d.ts → types-CBQRNL-l.d.ts} +14 -1
  69. package/dist/{types-_YQdS3Ax.d.ts → types-UGyDl1fd.d.ts} +2 -2
  70. package/dist/webhooks/index.d.mts +12 -4
  71. package/dist/webhooks/index.d.ts +12 -4
  72. package/package.json +1 -1
@@ -1,5 +1,5 @@
1
- import { P as ProfileFilters, b as ProfileListResponse, a as CustomerProfile, C as CreateProfileRequest } from '../types-_YQdS3Ax.js';
2
- import { R as RiskLevel, P as PaginationParams } from '../types-B4Ezqo7V.js';
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
3
  import { B as BaseClient } from '../client-BolQlL5e.js';
4
4
 
5
5
  /**
@@ -12,6 +12,8 @@ import { B as BaseClient } from '../client-BolQlL5e.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';
@@ -43,9 +45,17 @@ interface KycRequest {
43
45
  is_age_verification_required: boolean;
44
46
  callback_url: string;
45
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. */
46
53
  declined_reason?: string;
54
+ /** @deprecated Use the `code` on {@link declined_reasons}. */
55
+ declined_code?: KycDeclinedCode;
47
56
  accepted_reason?: string;
48
57
  other_reason?: string;
58
+ /** @deprecated Use {@link warning_reasons}. */
49
59
  warnings?: Record<string, Record<string, string>>;
50
60
  proofs?: Proof[];
51
61
  alerts?: KycAlert[];
@@ -116,6 +126,65 @@ interface UpdateKycAlertRequest {
116
126
  alert_type?: KycAlertType;
117
127
  status?: KycAlertStatus;
118
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
+ }
119
188
  interface KycPreferences {
120
189
  id: string;
121
190
  tenant_id: string;
@@ -124,6 +193,8 @@ interface KycPreferences {
124
193
  is_face_verification_required: boolean;
125
194
  is_address_verification_required: boolean;
126
195
  is_age_verification_required: boolean;
196
+ /** Master switch for the Event-Based Face Verification feature. */
197
+ is_reuse_kyc_enabled?: boolean;
127
198
  min_age: number;
128
199
  max_age: number;
129
200
  required_document_count: number;
@@ -131,6 +202,10 @@ interface KycPreferences {
131
202
  high_risk_score: number;
132
203
  medium_risk_score: number;
133
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;
134
209
  created_at: string;
135
210
  updated_at: string;
136
211
  }
@@ -140,6 +215,7 @@ interface UpdateKycPreferencesRequest {
140
215
  is_face_verification_required?: boolean;
141
216
  is_address_verification_required?: boolean;
142
217
  is_age_verification_required?: boolean;
218
+ is_reuse_kyc_enabled?: boolean;
143
219
  min_age?: number;
144
220
  max_age?: number;
145
221
  required_document_count?: number;
@@ -147,6 +223,10 @@ interface UpdateKycPreferencesRequest {
147
223
  high_risk_score?: number;
148
224
  medium_risk_score?: number;
149
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>;
150
230
  }
151
231
  interface Name {
152
232
  first_name?: string;
@@ -226,21 +306,57 @@ interface RequestKycSubmitLinkRequest {
226
306
  redirect_url?: string;
227
307
  /** URL to receive callback notifications via POST request when KYC status changes (optional) */
228
308
  callback_url?: string;
309
+ /** Event that triggered the KYC request (e.g. "onboarding", "login", "transaction") */
310
+ trigger_event?: string;
229
311
  }
230
- interface CreateReuseKycSessionRequest {
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 {
231
322
  /** Unique reference for the KYC session (e.g., customer ID or transaction ID) */
232
323
  reference: string;
233
- /** customer ID to associate with the KYC session */
324
+ /** Customer ID to associate with the KYC session */
234
325
  customer_id: string;
235
- /** where the re-use-kyc using 'login' | 'transactions' */
236
- path?: string;
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;
237
353
  /** URL to redirect user after validate the facial submission (optional) */
238
354
  redirect_url?: string;
239
- /** URL to receive callback notifications via POST request when reuse KYC status changes (optional) */
355
+ /** URL to receive callback notifications via POST request when Event-Based Face Verification status changes (optional) */
240
356
  callback_url?: string;
241
357
  }
242
- interface SubmitReuseKycSessionRequest {
243
- /** Reuse KYC session token generated from createReUseKycSession endpoint */
358
+ interface SubmitEventBasedFaceVerificationSessionRequest {
359
+ /** Event-Based Face Verification session token generated from createEventBasedFaceVerificationSession */
244
360
  token: string;
245
361
  /** Base64 encoded face image or selfie for verification */
246
362
  proof: string;
@@ -253,13 +369,91 @@ interface RequestKycSubmitLinkResponse {
253
369
  /** KYC request ID */
254
370
  kyc_id: string;
255
371
  }
256
- interface CreateReuseKycSessionResponse {
257
- /** Generated reuse KYC session token, valid X minutes */
258
- token: string;
259
- /** reuse KYC session reference */
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) */
260
376
  reference: string;
261
- /** re-use-kyc required for the action or not */
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 */
262
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
+ /** Tenant app should block the action/account when true. */
418
+ block: boolean;
419
+ freeze_duration_minutes: number;
420
+ /** Set when an alert was raised on the dashboard. */
421
+ alert_id?: string;
422
+ }
423
+ /**
424
+ * Shape of the webhook body POSTed to `callback_url` after a Event-Based Face Verification
425
+ * submission completes (also returned synchronously from
426
+ * `submitEventBasedFaceVerificationSession`).
427
+ */
428
+ interface EventBasedFaceVerificationCallback {
429
+ event: 'reuse_kyc';
430
+ reference: string;
431
+ resource_id: string;
432
+ status: KycStatus;
433
+ /** Structured decline reasons. */
434
+ declined_reasons?: Reason[];
435
+ /** @deprecated Use {@link declined_reasons}. */
436
+ declined_reason?: string;
437
+ /** @deprecated Use structured reasons. */
438
+ warnings?: Record<string, Record<string, string>>;
439
+ data: EventBasedFaceVerificationReactionResult;
440
+ }
441
+ /**
442
+ * Server-side handoff session backed by Redis (TTL: 15 minutes). Shared
443
+ * with the normal KYC mobile/desktop handoff. Desktop clients poll this
444
+ * to detect when a mobile device has attached to the same token via QR.
445
+ */
446
+ interface KycHandoffSession {
447
+ document: string;
448
+ document_backside: string;
449
+ document_two: string;
450
+ document_two_backside: string;
451
+ address: string;
452
+ face: string;
453
+ /** True after a mobile device hits PUT /api/v1/kyc/session/connect. */
454
+ mobile_connected: boolean;
455
+ /** True after the (normal-KYC) document submission completes; unused for Event-Based Face Verification. */
456
+ is_submitted: boolean;
263
457
  }
264
458
  interface CheckKycStatusRequest {
265
459
  /** User ID to check KYC status for */
@@ -282,9 +476,17 @@ interface CheckKycStatusResponse {
282
476
  address_verified: boolean;
283
477
  face_verified: boolean;
284
478
  age_verified: boolean;
479
+ /** Structured decline reasons. Present when status is `declined`. */
480
+ declined_reasons?: Reason[];
481
+ /** Structured, non-blocking warnings. */
482
+ warning_reasons?: Reason[];
483
+ /** @deprecated Use {@link declined_reasons}. */
285
484
  declined_reason?: string;
485
+ /** @deprecated Use the `code` on {@link declined_reasons}. */
486
+ declined_code?: KycDeclinedCode;
286
487
  other_reason?: string;
287
488
  accepted_reason?: string;
489
+ /** @deprecated Use {@link warning_reasons}. */
288
490
  warnings?: Record<string, Record<string, string>>;
289
491
  required_document_count: number;
290
492
  supported_document_types?: SupportedDocumentType[];
@@ -471,23 +673,62 @@ declare class KycClient extends BaseClient {
471
673
  */
472
674
  requestKycSubmitLink(request: RequestKycSubmitLinkRequest): Promise<RequestKycSubmitLinkResponse>;
473
675
  /**
474
- * Create a reuse KYC session for validate a user with existing KYC verification
676
+ * Create a Event-Based Face Verification session.
677
+ *
678
+ * Inspect the response before showing UI:
679
+ * - `is_required === false` → skip face capture; `reason` explains why.
680
+ * - `device_type === 'desktop'` → render `qr_payload` as a QR; the
681
+ * mobile device picks up the session via the connect endpoint.
682
+ * - `device_type === 'mobile'` → open the face capture modal directly.
475
683
  *
476
- * @param request - Request containing the reference, customer_id, optional redirect URL, and callback URL (receives POST requests)
684
+ * @param request - Reference, customer_id, event, amount (for threshold events), optional URLs.
477
685
  */
478
- createReuseKycSession(request: CreateReuseKycSessionRequest): Promise<CreateReuseKycSessionResponse>;
686
+ createEventBasedFaceVerificationSession(request: CreateEventBasedFaceVerificationSessionRequest): Promise<CreateEventBasedFaceVerificationSessionResponse>;
479
687
  /**
480
- * Submit a reuse KYC session for validate a user with existing KYC verification
688
+ * Submit a real-time face capture for an active Event-Based Face Verification session.
689
+ *
690
+ * **Mobile-only.** The server rejects desktop User-Agents with HTTP
691
+ * 400 (`face capture must be completed on a mobile device`). Use the
692
+ * QR handoff from `createEventBasedFaceVerificationSession` for desktop callers.
693
+ *
694
+ * The `data` field on the response carries `retries_remaining`,
695
+ * `retry_limit_exceeded`, and the reaction flags (`enforce_logout`,
696
+ * `freeze_account`, etc.) so the tenant app can act on a final failure.
481
697
  *
482
- * @param request - Request containing the reference, token and proof (receives POST requests)
698
+ * @param request - Token from `createEventBasedFaceVerificationSession`, plus the base64 selfie.
483
699
  */
484
- submitReuseKycSession(request: SubmitReuseKycSessionRequest): Promise<CheckKycStatusResponse>;
700
+ submitEventBasedFaceVerificationSession(request: SubmitEventBasedFaceVerificationSessionRequest): Promise<EventBasedFaceVerificationCallback>;
485
701
  /**
486
- * Check reuse KYC session status for a reference
487
- * @param reference - The unique reference used for the reuse KYC session (e.g., customer ID or transaction ID)
488
- * @returns Response with kyc_status and message (reason)
489
- * **/
490
- getReuseKycSessionStatus(reference: string): Promise<CheckKycStatusResponse>;
702
+ * Look up the current state of a Event-Based Face Verification session by its
703
+ * session token. Useful for desktop pollers waiting on the mobile handoff.
704
+ *
705
+ * The lookup is scoped by the unguessable, server-issued session token (not
706
+ * the enumerable forward reference): the endpoint is public/unauthenticated,
707
+ * and scoping by the token is what prevents cross-tenant status reads.
708
+ *
709
+ * @param token - The session token returned by `createEventBasedFaceVerificationSession`.
710
+ */
711
+ getEventBasedFaceVerificationSessionStatus(token: string): Promise<EventBasedFaceVerificationCallback>;
712
+ /**
713
+ * Fetch the Redis-backed handoff session for a token. Same backing
714
+ * store as normal KYC (`kyc:session:<token>`, 15-minute TTL). Desktop
715
+ * callers poll `mobile_connected` to detect when a mobile device has
716
+ * scanned the QR and attached.
717
+ *
718
+ * @param token - The session token returned by `createEventBasedFaceVerificationSession`.
719
+ */
720
+ getHandoffSession(token: string): Promise<KycHandoffSession>;
721
+ /**
722
+ * Attach a mobile device to a desktop-initiated session. The mobile
723
+ * client calls this after scanning the QR code. The desktop poller
724
+ * sees `mobile_connected: true` on the next `getHandoffSession`.
725
+ *
726
+ * @param token - The session token transferred via the QR payload.
727
+ * @param isDisconnect - Pass true to release the session (default false).
728
+ */
729
+ connectMobileSession(token: string, isDisconnect?: boolean): Promise<{
730
+ mobile_connected: boolean;
731
+ }>;
491
732
  /**
492
733
  * Check KYC status for a user
493
734
  *
@@ -808,4 +1049,4 @@ declare class KycClient extends BaseClient {
808
1049
  createCustomerProfile(profile: CreateProfileRequest): Promise<CustomerProfile>;
809
1050
  }
810
1051
 
811
- 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, type KycAlert, type KycAlertFilters, type KycAlertListResponse, type KycAlertStatus, type KycAlertType, KycClient, type KycClientConfig, type KycCustomerProfile, 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 };
1052
+ 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.6.6";
219
+ var SDK_VERSION = "1.7.0";
220
220
 
221
221
  // src/shared/browser-utils.ts
222
222
  function generateUUID() {
@@ -626,40 +626,88 @@ var KycClient = class extends BaseClient {
626
626
  });
627
627
  }
628
628
  /**
629
- * Create a reuse KYC session for validate a user with existing KYC verification
629
+ * Create a Event-Based Face Verification session.
630
630
  *
631
- * @param request - Request containing the reference, customer_id, optional redirect URL, and callback URL (receives POST requests)
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.
636
+ *
637
+ * @param request - Reference, customer_id, event, amount (for threshold events), optional URLs.
632
638
  */
633
- async createReuseKycSession(request) {
634
- return this.requestWithRetry("/api/v1/kyc/face/session", {
639
+ async createEventBasedFaceVerificationSession(request) {
640
+ return this.request("/api/v1/kyc/face/session", {
635
641
  method: "POST",
636
642
  body: JSON.stringify(request),
637
643
  headers: this.getUserHeaders()
638
644
  });
639
645
  }
640
646
  /**
641
- * Submit a reuse KYC session for validate a user with existing KYC verification
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.
652
+ *
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.
642
656
  *
643
- * @param request - Request containing the reference, token and proof (receives POST requests)
657
+ * @param request - Token from `createEventBasedFaceVerificationSession`, plus the base64 selfie.
644
658
  */
645
- async submitReuseKycSession(request) {
646
- return this.requestWithRetry("/api/v1/kyc/face/submit", {
659
+ async submitEventBasedFaceVerificationSession(request) {
660
+ return this.request("/api/v1/kyc/face/submit", {
647
661
  method: "POST",
648
662
  body: JSON.stringify(request),
649
663
  headers: this.getUserHeaders()
650
664
  });
651
665
  }
652
666
  /**
653
- * Check reuse KYC session status for a reference
654
- * @param reference - The unique reference used for the reuse KYC session (e.g., customer ID or transaction ID)
655
- * @returns Response with kyc_status and message (reason)
656
- * **/
657
- async getReuseKycSessionStatus(reference) {
658
- return this.requestWithRetry(`/api/v1/kyc/face/verify/${encodeURIComponent(reference)}`, {
667
+ * Look up the current state of a Event-Based Face Verification session by its
668
+ * session token. Useful for desktop pollers waiting on the mobile handoff.
669
+ *
670
+ * The lookup is scoped by the unguessable, server-issued session token (not
671
+ * the enumerable forward reference): the endpoint is public/unauthenticated,
672
+ * and scoping by the token is what prevents cross-tenant status reads.
673
+ *
674
+ * @param token - The session token returned by `createEventBasedFaceVerificationSession`.
675
+ */
676
+ async getEventBasedFaceVerificationSessionStatus(token) {
677
+ return this.requestWithRetry(`/api/v1/kyc/face/verify/${encodeURIComponent(token)}`, {
659
678
  method: "GET",
660
679
  headers: this.getUserHeaders()
661
680
  });
662
681
  }
682
+ /**
683
+ * Fetch the Redis-backed handoff session for a token. Same backing
684
+ * store as normal KYC (`kyc:session:<token>`, 15-minute TTL). Desktop
685
+ * callers poll `mobile_connected` to detect when a mobile device has
686
+ * scanned the QR and attached.
687
+ *
688
+ * @param token - The session token returned by `createEventBasedFaceVerificationSession`.
689
+ */
690
+ async getHandoffSession(token) {
691
+ return this.request(
692
+ `/api/v1/kyc/session${this.buildQueryString({ token })}`,
693
+ { headers: this.getUserHeaders() }
694
+ );
695
+ }
696
+ /**
697
+ * Attach a mobile device to a desktop-initiated session. The mobile
698
+ * client calls this after scanning the QR code. The desktop poller
699
+ * sees `mobile_connected: true` on the next `getHandoffSession`.
700
+ *
701
+ * @param token - The session token transferred via the QR payload.
702
+ * @param isDisconnect - Pass true to release the session (default false).
703
+ */
704
+ async connectMobileSession(token, isDisconnect = false) {
705
+ return this.request("/api/v1/kyc/session/connect", {
706
+ method: "PUT",
707
+ body: JSON.stringify({ token, is_disconnect: isDisconnect }),
708
+ headers: this.getUserHeaders()
709
+ });
710
+ }
663
711
  /**
664
712
  * Check KYC status for a user
665
713
  *
@@ -1132,6 +1180,20 @@ var KycClient = class extends BaseClient {
1132
1180
  // ============================================================================
1133
1181
  };
1134
1182
 
1183
+ // src/kyc/types.ts
1184
+ var KYC_DECLINED_DESCRIPTIONS = {
1185
+ KYC_DOCUMENT_EXPIRED: "The submitted document has expired",
1186
+ KYC_DOCUMENT_INVALID: "The submitted document could not be verified",
1187
+ KYC_FACE_MISMATCH: "Face verification did not match the identity document",
1188
+ KYC_AGE_REQUIREMENT: "Age requirement not met",
1189
+ KYC_DUPLICATE_IDENTITY: "This identity has already been verified under another account",
1190
+ KYC_ADDRESS_MISMATCH: "Address verification failed",
1191
+ KYC_NAME_MISMATCH: "Name on document does not match the registered name",
1192
+ KYC_PROVIDER_REJECTED: "Identity verification was rejected by the verification provider",
1193
+ KYC_DECLINED: "Identity verification was declined"
1194
+ };
1195
+
1196
+ exports.KYC_DECLINED_DESCRIPTIONS = KYC_DECLINED_DESCRIPTIONS;
1135
1197
  exports.KycClient = KycClient;
1136
1198
  //# sourceMappingURL=index.js.map
1137
1199
  //# sourceMappingURL=index.js.map