vesant-sdk 1.6.6 → 1.7.0-dev.117915b

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 (86) hide show
  1. package/README.md +14 -4
  2. package/dist/client-B0qhE2kr.d.mts +436 -0
  3. package/dist/{client-ePzhQKp9.d.mts → client-BolQlL5e.d.mts} +1 -1
  4. package/dist/{client-ePzhQKp9.d.ts → client-BolQlL5e.d.ts} +1 -1
  5. package/dist/{client-BlCxjbY2.d.mts → client-DF7hlMEz.d.ts} +18 -3
  6. package/dist/{client-C_A7QLcB.d.ts → client-DrjgZoH_.d.mts} +18 -3
  7. package/dist/client-DtH2RLuy.d.ts +436 -0
  8. package/dist/compliance/index.d.mts +25 -429
  9. package/dist/compliance/index.d.ts +25 -429
  10. package/dist/compliance/index.js +186 -105
  11. package/dist/compliance/index.js.map +1 -1
  12. package/dist/compliance/index.mjs +186 -106
  13. package/dist/compliance/index.mjs.map +1 -1
  14. package/dist/decisions/index.d.mts +2 -2
  15. package/dist/decisions/index.d.ts +2 -2
  16. package/dist/decisions/index.js +1 -1
  17. package/dist/decisions/index.js.map +1 -1
  18. package/dist/decisions/index.mjs +1 -1
  19. package/dist/decisions/index.mjs.map +1 -1
  20. package/dist/geolocation/index.d.mts +4 -4
  21. package/dist/geolocation/index.d.ts +4 -4
  22. package/dist/geolocation/index.js +7 -24
  23. package/dist/geolocation/index.js.map +1 -1
  24. package/dist/geolocation/index.mjs +7 -24
  25. package/dist/geolocation/index.mjs.map +1 -1
  26. package/dist/index.d.mts +12 -70
  27. package/dist/index.d.ts +12 -70
  28. package/dist/index.js +305 -299
  29. package/dist/index.js.map +1 -1
  30. package/dist/index.mjs +304 -298
  31. package/dist/index.mjs.map +1 -1
  32. package/dist/kyc/core.d.mts +4 -4
  33. package/dist/kyc/core.d.ts +4 -4
  34. package/dist/kyc/core.js +86 -27
  35. package/dist/kyc/core.js.map +1 -1
  36. package/dist/kyc/core.mjs +86 -28
  37. package/dist/kyc/core.mjs.map +1 -1
  38. package/dist/kyc/index.d.mts +309 -50
  39. package/dist/kyc/index.d.ts +309 -50
  40. package/dist/kyc/index.js +86 -27
  41. package/dist/kyc/index.js.map +1 -1
  42. package/dist/kyc/index.mjs +86 -28
  43. package/dist/kyc/index.mjs.map +1 -1
  44. package/dist/react.d.mts +48 -9
  45. package/dist/react.d.ts +48 -9
  46. package/dist/react.js +930 -276
  47. package/dist/react.js.map +1 -1
  48. package/dist/react.mjs +929 -275
  49. package/dist/react.mjs.map +1 -1
  50. package/dist/risk-profile/index.d.mts +4 -4
  51. package/dist/risk-profile/index.d.ts +4 -4
  52. package/dist/risk-profile/index.js +1 -1
  53. package/dist/risk-profile/index.js.map +1 -1
  54. package/dist/risk-profile/index.mjs +1 -1
  55. package/dist/risk-profile/index.mjs.map +1 -1
  56. package/dist/scores/index.d.mts +2 -2
  57. package/dist/scores/index.d.ts +2 -2
  58. package/dist/scores/index.js +1 -1
  59. package/dist/scores/index.js.map +1 -1
  60. package/dist/scores/index.mjs +1 -1
  61. package/dist/scores/index.mjs.map +1 -1
  62. package/dist/tax/index.d.mts +23 -41
  63. package/dist/tax/index.d.ts +23 -41
  64. package/dist/tax/index.js +5 -37
  65. package/dist/tax/index.js.map +1 -1
  66. package/dist/tax/index.mjs +5 -37
  67. package/dist/tax/index.mjs.map +1 -1
  68. package/dist/{types-1RzYeSal.d.mts → types-BOFaMQxI.d.mts} +2 -2
  69. package/dist/{types-B4Ezqo7V.d.mts → types-CBQRNL-l.d.mts} +14 -1
  70. package/dist/{types-B4Ezqo7V.d.ts → types-CBQRNL-l.d.ts} +14 -1
  71. package/dist/{types-X5Md_dD_.d.ts → types-UGyDl1fd.d.ts} +2 -2
  72. package/dist/webhooks/index.d.mts +189 -2
  73. package/dist/webhooks/index.d.ts +189 -2
  74. package/dist/webhooks/index.js +49 -7
  75. package/dist/webhooks/index.js.map +1 -1
  76. package/dist/webhooks/index.mjs +49 -7
  77. package/dist/webhooks/index.mjs.map +1 -1
  78. package/package.json +16 -13
  79. package/dist/fraud/index.d.mts +0 -80
  80. package/dist/fraud/index.d.ts +0 -80
  81. package/dist/fraud/index.js +0 -606
  82. package/dist/fraud/index.js.map +0 -1
  83. package/dist/fraud/index.mjs +0 -604
  84. package/dist/fraud/index.mjs.map +0 -1
  85. package/dist/index-B04H4xfJ.d.mts +0 -320
  86. package/dist/index-CItMPmLL.d.ts +0 -320
@@ -1,6 +1,6 @@
1
- import { R as RiskLevel, P as PaginationParams } from '../types-B4Ezqo7V.js';
2
- import { e as ProfileFilters, f as ProfileListResponse, C as CustomerProfile, d as CreateProfileRequest } from '../types-X5Md_dD_.js';
3
- import { B as BaseClient } from '../client-ePzhQKp9.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
+ 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,10 +45,30 @@ 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>>;
60
+ /**
61
+ * Tenant app should block onboarding/the action when true. Set when a
62
+ * failed verification matches a per-event KYC alert rule with the `block`
63
+ * reaction; sticky once set (a later non-blocking update won't clear it).
64
+ */
65
+ block: boolean;
66
+ /**
67
+ * Names the configured verification that triggered the block (e.g.
68
+ * `document_verification`, `face_verification`, `address_verification`,
69
+ * `age_verification`). Empty when {@link block} is false.
70
+ */
71
+ block_reason?: string;
51
72
  proofs?: Proof[];
52
73
  alerts?: KycAlert[];
53
74
  risk_profile?: KycCustomerProfile;
@@ -117,6 +138,65 @@ interface UpdateKycAlertRequest {
117
138
  alert_type?: KycAlertType;
118
139
  status?: KycAlertStatus;
119
140
  }
141
+ /**
142
+ * Threshold-gated trigger for transaction events. Each rule is
143
+ * self-contained — there is no umbrella flag.
144
+ *
145
+ * - `enabled=false` → event blocked.
146
+ * - `enabled=true`, `threshold=0` (or null/omitted) → every event of this
147
+ * type triggers Event-Based Face Verification, regardless of amount.
148
+ * - `enabled=true`, `threshold>0` → only amounts `>= threshold` trigger.
149
+ */
150
+ interface EventBasedFaceVerificationThresholdTrigger {
151
+ enabled: boolean;
152
+ /** USD threshold; 0 / null / omitted means "any amount". */
153
+ threshold: number;
154
+ }
155
+ /**
156
+ * Rate-of-occurrence trigger (used by `high_frequency_betting`). The
157
+ * tenant tells the server how many events have happened over how many
158
+ * minutes via the request body (`event_count`, `event_window_minutes`);
159
+ * the server triggers when `event_count >= count` AND
160
+ * `event_window_minutes <= window_minutes`. Either bound of 0 means
161
+ * "don't enforce that bound".
162
+ */
163
+ interface EventBasedFaceVerificationFrequencyTrigger {
164
+ enabled: boolean;
165
+ /** Minimum number of events; 0 / null / omitted means "any count". */
166
+ count: number;
167
+ /** Maximum lookback window in minutes; 0 / null / omitted means "any window". */
168
+ window_minutes: number;
169
+ }
170
+ /** Events that can trigger Event-Based Face Verification for a tenant. */
171
+ interface EventBasedFaceVerificationTriggers {
172
+ login: boolean;
173
+ password_change: boolean;
174
+ name_change: boolean;
175
+ phone_number_change: boolean;
176
+ two_factor_auth_change: boolean;
177
+ new_device_or_location: boolean;
178
+ device_fingerprint_change: boolean;
179
+ payment_method_change: boolean;
180
+ deposit: EventBasedFaceVerificationThresholdTrigger;
181
+ withdrawal: EventBasedFaceVerificationThresholdTrigger;
182
+ large_bet_placement: EventBasedFaceVerificationThresholdTrigger;
183
+ high_frequency_betting: EventBasedFaceVerificationFrequencyTrigger;
184
+ account_balance_transfer: boolean;
185
+ }
186
+ /**
187
+ * Reactions taken when a customer exhausts the Event-Based Face Verification retry limit.
188
+ * `trigger_alert` is enforced by the server (creates a KYC alert);
189
+ * `enforce_logout` and `freeze_account` are forwarded to the tenant app
190
+ * via the callback `data` field for it to enforce.
191
+ */
192
+ interface EventBasedFaceVerificationReactions {
193
+ /** Retries after the first attempt; total submissions = this + 1. */
194
+ max_retry_attempts: number;
195
+ trigger_alert: boolean;
196
+ enforce_logout: boolean;
197
+ freeze_account: boolean;
198
+ freeze_duration_minutes: number;
199
+ }
120
200
  interface KycPreferences {
121
201
  id: string;
122
202
  tenant_id: string;
@@ -125,6 +205,8 @@ interface KycPreferences {
125
205
  is_face_verification_required: boolean;
126
206
  is_address_verification_required: boolean;
127
207
  is_age_verification_required: boolean;
208
+ /** Master switch for the Event-Based Face Verification feature. */
209
+ is_reuse_kyc_enabled?: boolean;
128
210
  min_age: number;
129
211
  max_age: number;
130
212
  required_document_count: number;
@@ -132,6 +214,10 @@ interface KycPreferences {
132
214
  high_risk_score: number;
133
215
  medium_risk_score: number;
134
216
  supported_document_types: SupportedDocumentType[];
217
+ /** Per-event triggers for Event-Based Face Verification. */
218
+ reuse_kyc_triggers?: EventBasedFaceVerificationTriggers;
219
+ /** Retry / reaction policy for Event-Based Face Verification. */
220
+ reuse_kyc_reactions?: EventBasedFaceVerificationReactions;
135
221
  created_at: string;
136
222
  updated_at: string;
137
223
  }
@@ -141,6 +227,7 @@ interface UpdateKycPreferencesRequest {
141
227
  is_face_verification_required?: boolean;
142
228
  is_address_verification_required?: boolean;
143
229
  is_age_verification_required?: boolean;
230
+ is_reuse_kyc_enabled?: boolean;
144
231
  min_age?: number;
145
232
  max_age?: number;
146
233
  required_document_count?: number;
@@ -148,6 +235,10 @@ interface UpdateKycPreferencesRequest {
148
235
  high_risk_score?: number;
149
236
  medium_risk_score?: number;
150
237
  supported_document_types?: SupportedDocumentType[];
238
+ /** Partial update — only the events present here are changed. */
239
+ reuse_kyc_triggers?: Partial<EventBasedFaceVerificationTriggers>;
240
+ /** Partial update — only the keys present here are changed. */
241
+ reuse_kyc_reactions?: Partial<EventBasedFaceVerificationReactions>;
151
242
  }
152
243
  interface Name {
153
244
  first_name?: string;
@@ -223,50 +314,175 @@ interface UpdateKycStatusRequest {
223
314
  interface RequestKycSubmitLinkRequest {
224
315
  /** User ID to generate KYC submission link for */
225
316
  user_id: string;
226
- /** URL to redirect user after KYC submission */
227
- redirect_url: string;
228
- /** URL to receive callback notifications via POST request when KYC status changes */
229
- callback_url: string;
230
- /** Event that triggered the KYC request */
231
- trigger_event: KycTriggerEvent;
317
+ /** URL to redirect user after KYC submission (optional) */
318
+ redirect_url?: string;
319
+ /** URL to receive callback notifications via POST request when KYC status changes (optional) */
320
+ callback_url?: string;
321
+ /** Event that triggered the KYC request (e.g. "onboarding", "login", "transaction") */
322
+ trigger_event?: string;
232
323
  }
233
- interface CreateReuseKycSessionRequest {
324
+ /**
325
+ * Trigger events that can request Event-Based Face Verification.
326
+ *
327
+ * Account-sensitive: any sensitive change to the account profile.
328
+ * Transaction events: covered by the per-event rules in
329
+ * `EventBasedFaceVerificationTriggers` (`deposit`, `withdrawal`, `large_bet_placement`,
330
+ * `high_frequency_betting`, `account_balance_transfer`).
331
+ */
332
+ 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';
333
+ interface CreateEventBasedFaceVerificationSessionRequest {
234
334
  /** Unique reference for the KYC session (e.g., customer ID or transaction ID) */
235
335
  reference: string;
236
- /** customer ID to associate with the KYC session */
336
+ /** Customer ID to associate with the KYC session */
237
337
  customer_id: string;
238
- /** where the re-use-kyc using 'login' | 'transactions' */
239
- path?: string;
338
+ /**
339
+ * The triggering event. One of the `EventBasedFaceVerificationEvent` union members.
340
+ * Required — when empty, the server falls through to the unknown-event
341
+ * passthrough and allows the request silently.
342
+ */
343
+ event: EventBasedFaceVerificationEvent;
344
+ /**
345
+ * USD amount associated with the event. Required for threshold-gated
346
+ * events (`deposit`, `withdrawal`, `large_bet_placement`); ignored for
347
+ * everything else. Missing/zero with a non-zero threshold blocks the
348
+ * session.
349
+ */
350
+ amount?: number;
351
+ /**
352
+ * Number of qualifying events the customer has performed in the
353
+ * window described by `event_window_minutes`. Required for
354
+ * frequency-gated events (`high_frequency_betting`); ignored for
355
+ * everything else.
356
+ */
357
+ event_count?: number;
358
+ /**
359
+ * Lookback window (in minutes) the tenant counted `event_count` over.
360
+ * Required for frequency-gated events alongside `event_count`. A
361
+ * window larger than the tenant's configured `window_minutes`
362
+ * implies a slower rate than "high frequency" and blocks the session.
363
+ */
364
+ event_window_minutes?: number;
240
365
  /** URL to redirect user after validate the facial submission (optional) */
241
366
  redirect_url?: string;
242
- /** URL to receive callback notifications via POST request when reuse KYC status changes (optional) */
367
+ /** URL to receive callback notifications via POST request when Event-Based Face Verification status changes (optional) */
243
368
  callback_url?: string;
244
369
  }
245
- interface SubmitReuseKycSessionRequest {
246
- /** Reuse KYC session token generated from createReUseKycSession endpoint */
370
+ interface SubmitEventBasedFaceVerificationSessionRequest {
371
+ /** Event-Based Face Verification session token generated from createEventBasedFaceVerificationSession */
247
372
  token: string;
248
373
  /** Base64 encoded face image or selfie for verification */
249
374
  proof: string;
250
375
  /** Unique reference for the KYC session (e.g., customer ID or transaction ID) */
251
376
  reference?: string;
377
+ /**
378
+ * Optional capture telemetry (JSON string): the face-detection
379
+ * bounding-box samples recorded in the moments before capture. Attached
380
+ * automatically by `FaceCaptureModal` when in-modal detection is active;
381
+ * omit when building a custom capture UI without detection. Stored
382
+ * verbatim server-side for audit/review — a weak presence signal, not
383
+ * certified anti-spoofing.
384
+ */
385
+ liveness_artifact?: string;
252
386
  }
253
387
  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
388
  /** Generated KYC submission redirect URL */
259
- link?: string;
389
+ link: string;
260
390
  /** KYC request ID */
261
- kyc_id?: string;
391
+ kyc_id: string;
262
392
  }
263
- interface CreateReuseKycSessionResponse {
264
- /** Generated reuse KYC session token, valid X minutes */
265
- token: string;
266
- /** reuse KYC session reference */
393
+ /** Device class detected by the SDK (purely client-side — server doesn't care). */
394
+ type EventBasedFaceVerificationDeviceType = 'mobile' | 'desktop';
395
+ interface CreateEventBasedFaceVerificationSessionResponse {
396
+ /** Event-Based Face Verification session reference (echo of the request reference) */
267
397
  reference: string;
268
- /** re-use-kyc required for the action or not */
398
+ /** Generated Event-Based Face Verification session token, valid 10 minutes */
399
+ token: string;
400
+ /**
401
+ * Empty string when Event-Based Face Verification is required. When `is_required` is
402
+ * false, this contains the human-readable reason (e.g. feature
403
+ * disabled, threshold not met, customer has no prior KYC).
404
+ */
405
+ reason: string;
406
+ /** Whether the caller must complete the face capture before proceeding */
269
407
  is_required: boolean;
408
+ /**
409
+ * Public HTTPS handoff URL the SDK encodes into a QR code on desktop.
410
+ * The mobile device scans it, lands on the tenant frontend's
411
+ * /reuse-kyc-submit page, and completes the face capture there. Empty
412
+ * when the server has no `BASE_URL_FRONTEND` configured — the SDK
413
+ * falls back to building its own URL in that case.
414
+ */
415
+ link: string;
416
+ /** Failed face-capture attempts so far on this session. 0 on a fresh session. */
417
+ attempts: number;
418
+ /**
419
+ * Total submissions permitted before reactions fire
420
+ * (`reuse_kyc_reactions.max_retry_attempts + 1`).
421
+ */
422
+ max_attempts: number;
423
+ }
424
+ /**
425
+ * Reaction outcome returned on every face-submit callback. Tenant apps
426
+ * use this to decide whether to allow another retry, end the session,
427
+ * or freeze the account. Reaction flags are only populated when
428
+ * `retry_limit_exceeded` is true.
429
+ */
430
+ interface EventBasedFaceVerificationReactionResult {
431
+ /** Submissions the customer still has before the retry limit fires. */
432
+ retries_remaining: number;
433
+ /** True once the latest failed attempt exhausts the retry policy. */
434
+ retry_limit_exceeded: boolean;
435
+ trigger_alert: boolean;
436
+ enforce_logout: boolean;
437
+ freeze_account: boolean;
438
+ /** Tenant app should block the action/account when true. */
439
+ block: boolean;
440
+ freeze_duration_minutes: number;
441
+ /** Set when an alert was raised on the dashboard. */
442
+ alert_id?: string;
443
+ }
444
+ /**
445
+ * Shape of the webhook body POSTed to `callback_url` after a Event-Based Face Verification
446
+ * submission completes (also returned synchronously from
447
+ * `submitEventBasedFaceVerificationSession`).
448
+ */
449
+ interface EventBasedFaceVerificationCallback {
450
+ event: 'reuse_kyc';
451
+ reference: string;
452
+ resource_id: string;
453
+ status: KycStatus;
454
+ /**
455
+ * True when the tenant app should block the action/account. Mirrors the
456
+ * `block` reaction on {@link data} at the top level of the callback so
457
+ * consumers can branch without inspecting `data`. Omitted when false.
458
+ */
459
+ block?: boolean;
460
+ /** Names the event/verification that triggered the block. Omitted when not blocked. */
461
+ block_reason?: string;
462
+ /** Structured decline reasons. */
463
+ declined_reasons?: Reason[];
464
+ /** @deprecated Use {@link declined_reasons}. */
465
+ declined_reason?: string;
466
+ /** @deprecated Use structured reasons. */
467
+ warnings?: Record<string, Record<string, string>>;
468
+ data: EventBasedFaceVerificationReactionResult;
469
+ }
470
+ /**
471
+ * Server-side handoff session backed by Redis (TTL: 15 minutes). Shared
472
+ * with the normal KYC mobile/desktop handoff. Desktop clients poll this
473
+ * to detect when a mobile device has attached to the same token via QR.
474
+ */
475
+ interface KycHandoffSession {
476
+ document: string;
477
+ document_backside: string;
478
+ document_two: string;
479
+ document_two_backside: string;
480
+ address: string;
481
+ face: string;
482
+ /** True after a mobile device hits PUT /api/v1/kyc/session/connect. */
483
+ mobile_connected: boolean;
484
+ /** True after the (normal-KYC) document submission completes; unused for Event-Based Face Verification. */
485
+ is_submitted: boolean;
270
486
  }
271
487
  interface CheckKycStatusRequest {
272
488
  /** User ID to check KYC status for */
@@ -289,9 +505,17 @@ interface CheckKycStatusResponse {
289
505
  address_verified: boolean;
290
506
  face_verified: boolean;
291
507
  age_verified: boolean;
508
+ /** Structured decline reasons. Present when status is `declined`. */
509
+ declined_reasons?: Reason[];
510
+ /** Structured, non-blocking warnings. */
511
+ warning_reasons?: Reason[];
512
+ /** @deprecated Use {@link declined_reasons}. */
292
513
  declined_reason?: string;
514
+ /** @deprecated Use the `code` on {@link declined_reasons}. */
515
+ declined_code?: KycDeclinedCode;
293
516
  other_reason?: string;
294
517
  accepted_reason?: string;
518
+ /** @deprecated Use {@link warning_reasons}. */
295
519
  warnings?: Record<string, Record<string, string>>;
296
520
  required_document_count: number;
297
521
  supported_document_types?: SupportedDocumentType[];
@@ -461,44 +685,79 @@ declare class KycClient extends BaseClient {
461
685
  *
462
686
  * Generates a link that the user can visit to submit their KYC documents.
463
687
  *
464
- * @param request - Request containing the user ID, redirect URL, callback URL, and trigger event
465
- * @returns Response containing kyc_required, can_skip, and optionally the redirect link and KYC ID
688
+ * @param request - Request containing the user ID, optional redirect URL, and optional callback URL (receives POST requests)
689
+ * @returns Response containing the redirect link and KYC ID
466
690
  *
467
691
  * @example
468
692
  * ```typescript
469
693
  * const result = await client.requestKycSubmitLink({
470
694
  * 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"
695
+ * redirect_url: "https://merchant.com/kyc-complete", // optional
696
+ * callback_url: "https://merchant.com/api/kyc-webhook" // optional - receives POST requests on status change
474
697
  * });
475
698
  *
476
- * if (result.kyc_required && result.link) {
477
- * console.log(`Redirect user to: ${result.link}`);
478
- * } else if (result.can_skip) {
479
- * console.log("KYC not required, user can proceed");
480
- * }
699
+ * console.log(`Redirect user to: ${result.link}`);
700
+ * console.log(`KYC ID: ${result.kyc_id}`);
481
701
  * ```
482
702
  */
483
703
  requestKycSubmitLink(request: RequestKycSubmitLinkRequest): Promise<RequestKycSubmitLinkResponse>;
484
704
  /**
485
- * Create a reuse KYC session for validate a user with existing KYC verification
705
+ * Create a Event-Based Face Verification session.
706
+ *
707
+ * Inspect the response before showing UI:
708
+ * - `is_required === false` → skip face capture; `reason` explains why.
709
+ * - `device_type === 'desktop'` → render `qr_payload` as a QR; the
710
+ * mobile device picks up the session via the connect endpoint.
711
+ * - `device_type === 'mobile'` → open the face capture modal directly.
486
712
  *
487
- * @param request - Request containing the reference, customer_id, optional redirect URL, and callback URL (receives POST requests)
713
+ * @param request - Reference, customer_id, event, amount (for threshold events), optional URLs.
488
714
  */
489
- createReuseKycSession(request: CreateReuseKycSessionRequest): Promise<CreateReuseKycSessionResponse>;
715
+ createEventBasedFaceVerificationSession(request: CreateEventBasedFaceVerificationSessionRequest): Promise<CreateEventBasedFaceVerificationSessionResponse>;
490
716
  /**
491
- * Submit a reuse KYC session for validate a user with existing KYC verification
717
+ * Submit a real-time face capture for an active Event-Based Face Verification session.
492
718
  *
493
- * @param request - Request containing the reference, token and proof (receives POST requests)
719
+ * **Mobile-only.** The server rejects desktop User-Agents with HTTP
720
+ * 400 (`face capture must be completed on a mobile device`). Use the
721
+ * QR handoff from `createEventBasedFaceVerificationSession` for desktop callers.
722
+ *
723
+ * The `data` field on the response carries `retries_remaining`,
724
+ * `retry_limit_exceeded`, and the reaction flags (`enforce_logout`,
725
+ * `freeze_account`, etc.) so the tenant app can act on a final failure.
726
+ *
727
+ * @param request - Token from `createEventBasedFaceVerificationSession`, plus the base64 selfie.
494
728
  */
495
- submitReuseKycSession(request: SubmitReuseKycSessionRequest): Promise<CheckKycStatusResponse>;
729
+ submitEventBasedFaceVerificationSession(request: SubmitEventBasedFaceVerificationSessionRequest): Promise<EventBasedFaceVerificationCallback>;
496
730
  /**
497
- * Check reuse KYC session status for a reference
498
- * @param reference - The unique reference used for the reuse KYC session (e.g., customer ID or transaction ID)
499
- * @returns Response with kyc_status and message (reason)
500
- * **/
501
- getReuseKycSessionStatus(reference: string): Promise<CheckKycStatusResponse>;
731
+ * Look up the current state of a Event-Based Face Verification session by its
732
+ * session token. Useful for desktop pollers waiting on the mobile handoff.
733
+ *
734
+ * The lookup is scoped by the unguessable, server-issued session token (not
735
+ * the enumerable forward reference): the endpoint is public/unauthenticated,
736
+ * and scoping by the token is what prevents cross-tenant status reads.
737
+ *
738
+ * @param token - The session token returned by `createEventBasedFaceVerificationSession`.
739
+ */
740
+ getEventBasedFaceVerificationSessionStatus(token: string): Promise<EventBasedFaceVerificationCallback>;
741
+ /**
742
+ * Fetch the Redis-backed handoff session for a token. Same backing
743
+ * store as normal KYC (`kyc:session:<token>`, 15-minute TTL). Desktop
744
+ * callers poll `mobile_connected` to detect when a mobile device has
745
+ * scanned the QR and attached.
746
+ *
747
+ * @param token - The session token returned by `createEventBasedFaceVerificationSession`.
748
+ */
749
+ getHandoffSession(token: string): Promise<KycHandoffSession>;
750
+ /**
751
+ * Attach a mobile device to a desktop-initiated session. The mobile
752
+ * client calls this after scanning the QR code. The desktop poller
753
+ * sees `mobile_connected: true` on the next `getHandoffSession`.
754
+ *
755
+ * @param token - The session token transferred via the QR payload.
756
+ * @param isDisconnect - Pass true to release the session (default false).
757
+ */
758
+ connectMobileSession(token: string, isDisconnect?: boolean): Promise<{
759
+ mobile_connected: boolean;
760
+ }>;
502
761
  /**
503
762
  * Check KYC status for a user
504
763
  *
@@ -819,4 +1078,4 @@ declare class KycClient extends BaseClient {
819
1078
  createCustomerProfile(profile: CreateProfileRequest): Promise<CustomerProfile>;
820
1079
  }
821
1080
 
822
- 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 KycTriggerEvent, 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 };
1081
+ 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() {
@@ -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, and trigger event
607
- * @returns Response containing kyc_required, can_skip, and optionally the redirect link and KYC ID
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
- * if (result.kyc_required && result.link) {
619
- * console.log(`Redirect user to: ${result.link}`);
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,88 @@ var KycClient = class extends BaseClient {
630
626
  });
631
627
  }
632
628
  /**
633
- * Create a reuse KYC session for validate a user with existing KYC verification
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 - Request containing the reference, customer_id, optional redirect URL, and callback URL (receives POST requests)
637
+ * @param request - Reference, customer_id, event, amount (for threshold events), optional URLs.
636
638
  */
637
- async createReuseKycSession(request) {
638
- return this.requestWithRetry("/api/v1/kyc/face/session", {
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 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.
646
652
  *
647
- * @param request - Request containing the reference, token and proof (receives POST requests)
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 submitReuseKycSession(request) {
650
- return this.requestWithRetry("/api/v1/kyc/face/submit", {
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
- * Check reuse KYC session status for a reference
658
- * @param reference - The unique reference used for the reuse KYC session (e.g., customer ID or transaction ID)
659
- * @returns Response with kyc_status and message (reason)
660
- * **/
661
- async getReuseKycSessionStatus(reference) {
662
- 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)}`, {
663
678
  method: "GET",
664
679
  headers: this.getUserHeaders()
665
680
  });
666
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
+ }
667
711
  /**
668
712
  * Check KYC status for a user
669
713
  *
@@ -1022,8 +1066,9 @@ var KycClient = class extends BaseClient {
1022
1066
  */
1023
1067
  async riskProfileRequest(path, options = {}) {
1024
1068
  if (!this.riskProfileBaseURL) {
1025
- throw new Error(
1026
- "Risk Profile Service URL not configured. Please provide riskProfileBaseURL in KycClientConfig."
1069
+ throw new ValidationError(
1070
+ "Risk Profile Service URL not configured. Please provide riskProfileBaseURL in KycClientConfig.",
1071
+ ["riskProfileBaseURL"]
1027
1072
  );
1028
1073
  }
1029
1074
  return this.request(path, {
@@ -1135,6 +1180,20 @@ var KycClient = class extends BaseClient {
1135
1180
  // ============================================================================
1136
1181
  };
1137
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;
1138
1197
  exports.KycClient = KycClient;
1139
1198
  //# sourceMappingURL=index.js.map
1140
1199
  //# sourceMappingURL=index.js.map