vesant-sdk 1.7.1-dev.8d808aa → 1.7.1-dev.ae38980

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.
@@ -315,6 +315,48 @@ interface UpdateKycStatusRequest {
315
315
  /** Shufti warnings data */
316
316
  warnings?: Record<string, Record<string, string>>;
317
317
  }
318
+ /**
319
+ * Events that can trigger a KYC request. Each maps to a per-event toggle in
320
+ * the tenant's KYC verification trigger preferences, except `manual` (always
321
+ * required) and `login` (only for an expired identity document).
322
+ */
323
+ type KycTriggerEvent = 'onboarding' | 'first_withdrawal' | 'first_purchase'
324
+ /** Aliases of `first_withdrawal` / `first_purchase` — same tenant toggles. */
325
+ | 'withdrawal' | 'purchase' | 'manual'
326
+ /**
327
+ * The customer is signing in. Answers for any state: never verified (asked,
328
+ * not skippable, per the tenant's onboarding policy), document expired
329
+ * (asked, skippable — "Remind me later"), or verified with a valid document
330
+ * (not asked). One call covers every customer.
331
+ */
332
+ | 'login';
333
+ /**
334
+ * Why verification is — or is not — being asked for. Codes are stable;
335
+ * `message` is display-ready text you can show the customer as-is.
336
+ */
337
+ interface KycRequestReason {
338
+ code: KycRequestReasonCode | (string & Record<string, never>);
339
+ message: string;
340
+ }
341
+ /**
342
+ * Reason codes returned by `requestKycSubmitLink`. Treat unrecognised codes
343
+ * as "verification required" and fall back to `message` for display.
344
+ */
345
+ type KycRequestReasonCode =
346
+ /** Required to complete registration. */
347
+ 'KYC_REQUIRED_ONBOARDING'
348
+ /** Required before the customer's first withdrawal. */
349
+ | 'KYC_REQUIRED_FIRST_WITHDRAWAL'
350
+ /** Required before the customer's first purchase. */
351
+ | 'KYC_REQUIRED_FIRST_PURCHASE'
352
+ /** The customer's identity document has expired and must be re-verified. */
353
+ | 'KYC_REQUIRED_ID_EXPIRED'
354
+ /** Verification was explicitly requested by the tenant. */
355
+ | 'KYC_REQUIRED_MANUAL'
356
+ /** Not required — the customer already has an accepted verification. */
357
+ | 'KYC_NOT_REQUIRED_ALREADY_VERIFIED'
358
+ /** Not required — the tenant has this trigger event switched off. */
359
+ | 'KYC_NOT_REQUIRED_TRIGGER_DISABLED';
318
360
  interface RequestKycSubmitLinkRequest {
319
361
  /** User ID to generate KYC submission link for */
320
362
  user_id: string;
@@ -323,14 +365,20 @@ interface RequestKycSubmitLinkRequest {
323
365
  /** URL to receive callback notifications via POST request when KYC status changes (optional) */
324
366
  callback_url?: string;
325
367
  /**
326
- * Event that triggered the KYC request. Valid values: "onboarding",
327
- * "first_withdrawal", "first_purchase", "manual". The tenant's KYC
328
- * verification trigger preferences decide, per event, whether KYC is
329
- * required (`kyc_required` in the response). "manual" always requires
330
- * KYC and honors the tenant's allow-skip-on-manual option (`can_skip`).
368
+ * Event that triggered the KYC request. The tenant's KYC verification
369
+ * trigger preferences decide, per event, whether KYC is required
370
+ * (`kyc_required` in the response). "manual" always requires KYC and
371
+ * honors the tenant's allow-skip-on-manual option (`can_skip`). "login"
372
+ * answers for any customer state never verified (asked, not skippable),
373
+ * document expired (asked, skippable so you can offer "Remind me later"),
374
+ * or verified and valid (not asked) — so a platform that gates entry on KYC
375
+ * needs only this one call at sign-in. The same expired document is *not*
376
+ * skippable on withdrawal / purchase events: it is enforced on
377
+ * "first_withdrawal", "withdrawal", "first_purchase" and "purchase" alike,
378
+ * so keep sending whichever of those you already send.
331
379
  * Omitted or unknown values default to KYC required with no skip.
332
380
  */
333
- trigger_event?: string;
381
+ trigger_event?: KycTriggerEvent | (string & Record<string, never>);
334
382
  /**
335
383
  * Registered customer identity data (optional). Seeds the customer's risk
336
384
  * profile so document verification can cross-check the submitted document
@@ -442,12 +490,57 @@ interface RequestKycSubmitLinkResponse {
442
490
  */
443
491
  kyc_required: boolean;
444
492
  /**
445
- * Whether the user may skip verification. Only `true` for
493
+ * Whether the user may skip verification. `true` for
446
494
  * `trigger_event: "manual"` when the tenant enables allow-skip-on-manual,
447
- * or when the customer is already verified.
495
+ * for `"login"` when an expired identity document triggered the request
496
+ * (offer "Remind me later"), and when the customer is already verified.
497
+ * Always `false` at `"withdrawal"` / `"purchase"` — that is where a
498
+ * postponed re-verification becomes mandatory.
448
499
  */
449
500
  can_skip: boolean;
501
+ /**
502
+ * Why verification is — or is not — being asked for. Use `reason.code` to
503
+ * branch (for example `KYC_REQUIRED_ID_EXPIRED` warrants a different prompt
504
+ * than a first-time verification) and `reason.message` for display.
505
+ */
506
+ reason?: KycRequestReason;
450
507
  }
508
+ /**
509
+ * Body POSTed to your `callback_url` when a customer's identity document
510
+ * passes its expiry date. Signed with `X-Webhook-Signature: sha256=<hex>`
511
+ * (HMAC-SHA256 of the raw body), like every other Vesant callback.
512
+ *
513
+ * An expiry happens on a **date**, not on a customer action, so this webhook
514
+ * is the only signal for it — nothing the customer does triggers it. Delivered
515
+ * once per customer, when the document first becomes expired.
516
+ *
517
+ * It is sent regardless of the tenant's auto-trigger-on-ID-expiration setting:
518
+ * that setting governs whether verification is *enforced*, not whether you are
519
+ * *told*.
520
+ */
521
+ interface KycDocumentExpiredCallbackEvent {
522
+ /** Always `"kyc_document_expired"` — dispatch on this. */
523
+ event: 'kyc_document_expired';
524
+ /** Your customer identifier (the `user_id` you supplied). */
525
+ reference: string;
526
+ /** The customer's risk-profile ID. */
527
+ resource_id: string;
528
+ /**
529
+ * Always `"expired"`. Describes the document — not the customer's KYC
530
+ * status, which remains `accepted` until they re-verify.
531
+ */
532
+ status: 'expired';
533
+ data: {
534
+ customer_id: string;
535
+ /** The document's expiry date (ISO 8601 `YYYY-MM-DD`). */
536
+ id_expiry_date: string;
537
+ };
538
+ }
539
+ /**
540
+ * Type guard for the identity-document expiry webhook. Narrows an already
541
+ * signature-verified, parsed payload to {@link KycDocumentExpiredCallbackEvent}.
542
+ */
543
+ declare function isKycDocumentExpiredCallbackEvent(value: unknown): value is KycDocumentExpiredCallbackEvent;
451
544
  /** Device class detected by the SDK (purely client-side — server doesn't care). */
452
545
  type EventBasedFaceVerificationDeviceType = 'mobile' | 'desktop';
453
546
  interface CreateEventBasedFaceVerificationSessionResponse {
@@ -1159,4 +1252,4 @@ declare class KycClient extends BaseClient {
1159
1252
  createCustomerProfile(profile: CreateProfileRequest): Promise<CustomerProfile>;
1160
1253
  }
1161
1254
 
1162
- export { type CheckKycStatusRequest, type CheckKycStatusResponse, CreateProfileRequest as CreateCustomerProfileRequest, type CreateEventBasedFaceVerificationSessionRequest, type CreateEventBasedFaceVerificationSessionResponse, CustomerProfile, ProfileFilters as CustomerProfileFilters, ProfileListResponse as CustomerProfileListResponse, type DocumentType, type DocumentVerificationRequest, type DocumentVerificationResponse, type EventBasedFaceVerificationCallback, type EventBasedFaceVerificationDeviceType, type EventBasedFaceVerificationEvent, type EventBasedFaceVerificationFrequencyTrigger, type EventBasedFaceVerificationReactionResult, type EventBasedFaceVerificationReactions, type EventBasedFaceVerificationThresholdTrigger, type EventBasedFaceVerificationTriggers, type FaceProof, KYC_DECLINED_DESCRIPTIONS, type KycAlert, type KycAlertFilters, type KycAlertListResponse, type KycAlertStatus, type KycAlertType, KycClient, type KycClientConfig, type KycCustomerData, type KycCustomerProfile, type KycDeclinedCode, type KycHandoffSession, type KycOverview, type KycPagination, type KycPreferences, type KycRequest, type KycRequestFilters, type KycRequestListResponse, type KycStatus, type Name, PaginationParams, type Proof, type ProofDownloadURL, type ProofType, type RequestAdditionalDocumentsRequest, type RequestKycSubmitLinkRequest, type RequestKycSubmitLinkResponse, RiskLevel, type SubmitEventBasedFaceVerificationSessionRequest, type SubmittedDocument, type SupportedDocumentType, type UpdateKycAlertRequest, type UpdateKycPreferencesRequest, type UpdateKycStatusRequest, type UseKycAlertsOptions, type UseKycAlertsResult, type UseKycOverviewOptions, type UseKycOverviewResult, type UseKycPreferencesResult, type UseKycRequestsOptions, type UseKycRequestsResult, type UseKycSubmissionOptions, type UseKycSubmissionResult };
1255
+ export { type CheckKycStatusRequest, type CheckKycStatusResponse, CreateProfileRequest as CreateCustomerProfileRequest, type CreateEventBasedFaceVerificationSessionRequest, type CreateEventBasedFaceVerificationSessionResponse, CustomerProfile, ProfileFilters as CustomerProfileFilters, ProfileListResponse as CustomerProfileListResponse, type DocumentType, type DocumentVerificationRequest, type DocumentVerificationResponse, type EventBasedFaceVerificationCallback, type EventBasedFaceVerificationDeviceType, type EventBasedFaceVerificationEvent, type EventBasedFaceVerificationFrequencyTrigger, type EventBasedFaceVerificationReactionResult, type EventBasedFaceVerificationReactions, type EventBasedFaceVerificationThresholdTrigger, type EventBasedFaceVerificationTriggers, type FaceProof, KYC_DECLINED_DESCRIPTIONS, type KycAlert, type KycAlertFilters, type KycAlertListResponse, type KycAlertStatus, type KycAlertType, KycClient, type KycClientConfig, type KycCustomerData, type KycCustomerProfile, type KycDeclinedCode, type KycDocumentExpiredCallbackEvent, type KycHandoffSession, type KycOverview, type KycPagination, type KycPreferences, type KycRequest, type KycRequestFilters, type KycRequestListResponse, type KycRequestReason, type KycRequestReasonCode, type KycStatus, type KycTriggerEvent, 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, isKycDocumentExpiredCallbackEvent };
@@ -315,6 +315,48 @@ interface UpdateKycStatusRequest {
315
315
  /** Shufti warnings data */
316
316
  warnings?: Record<string, Record<string, string>>;
317
317
  }
318
+ /**
319
+ * Events that can trigger a KYC request. Each maps to a per-event toggle in
320
+ * the tenant's KYC verification trigger preferences, except `manual` (always
321
+ * required) and `login` (only for an expired identity document).
322
+ */
323
+ type KycTriggerEvent = 'onboarding' | 'first_withdrawal' | 'first_purchase'
324
+ /** Aliases of `first_withdrawal` / `first_purchase` — same tenant toggles. */
325
+ | 'withdrawal' | 'purchase' | 'manual'
326
+ /**
327
+ * The customer is signing in. Answers for any state: never verified (asked,
328
+ * not skippable, per the tenant's onboarding policy), document expired
329
+ * (asked, skippable — "Remind me later"), or verified with a valid document
330
+ * (not asked). One call covers every customer.
331
+ */
332
+ | 'login';
333
+ /**
334
+ * Why verification is — or is not — being asked for. Codes are stable;
335
+ * `message` is display-ready text you can show the customer as-is.
336
+ */
337
+ interface KycRequestReason {
338
+ code: KycRequestReasonCode | (string & Record<string, never>);
339
+ message: string;
340
+ }
341
+ /**
342
+ * Reason codes returned by `requestKycSubmitLink`. Treat unrecognised codes
343
+ * as "verification required" and fall back to `message` for display.
344
+ */
345
+ type KycRequestReasonCode =
346
+ /** Required to complete registration. */
347
+ 'KYC_REQUIRED_ONBOARDING'
348
+ /** Required before the customer's first withdrawal. */
349
+ | 'KYC_REQUIRED_FIRST_WITHDRAWAL'
350
+ /** Required before the customer's first purchase. */
351
+ | 'KYC_REQUIRED_FIRST_PURCHASE'
352
+ /** The customer's identity document has expired and must be re-verified. */
353
+ | 'KYC_REQUIRED_ID_EXPIRED'
354
+ /** Verification was explicitly requested by the tenant. */
355
+ | 'KYC_REQUIRED_MANUAL'
356
+ /** Not required — the customer already has an accepted verification. */
357
+ | 'KYC_NOT_REQUIRED_ALREADY_VERIFIED'
358
+ /** Not required — the tenant has this trigger event switched off. */
359
+ | 'KYC_NOT_REQUIRED_TRIGGER_DISABLED';
318
360
  interface RequestKycSubmitLinkRequest {
319
361
  /** User ID to generate KYC submission link for */
320
362
  user_id: string;
@@ -323,14 +365,20 @@ interface RequestKycSubmitLinkRequest {
323
365
  /** URL to receive callback notifications via POST request when KYC status changes (optional) */
324
366
  callback_url?: string;
325
367
  /**
326
- * Event that triggered the KYC request. Valid values: "onboarding",
327
- * "first_withdrawal", "first_purchase", "manual". The tenant's KYC
328
- * verification trigger preferences decide, per event, whether KYC is
329
- * required (`kyc_required` in the response). "manual" always requires
330
- * KYC and honors the tenant's allow-skip-on-manual option (`can_skip`).
368
+ * Event that triggered the KYC request. The tenant's KYC verification
369
+ * trigger preferences decide, per event, whether KYC is required
370
+ * (`kyc_required` in the response). "manual" always requires KYC and
371
+ * honors the tenant's allow-skip-on-manual option (`can_skip`). "login"
372
+ * answers for any customer state never verified (asked, not skippable),
373
+ * document expired (asked, skippable so you can offer "Remind me later"),
374
+ * or verified and valid (not asked) — so a platform that gates entry on KYC
375
+ * needs only this one call at sign-in. The same expired document is *not*
376
+ * skippable on withdrawal / purchase events: it is enforced on
377
+ * "first_withdrawal", "withdrawal", "first_purchase" and "purchase" alike,
378
+ * so keep sending whichever of those you already send.
331
379
  * Omitted or unknown values default to KYC required with no skip.
332
380
  */
333
- trigger_event?: string;
381
+ trigger_event?: KycTriggerEvent | (string & Record<string, never>);
334
382
  /**
335
383
  * Registered customer identity data (optional). Seeds the customer's risk
336
384
  * profile so document verification can cross-check the submitted document
@@ -442,12 +490,57 @@ interface RequestKycSubmitLinkResponse {
442
490
  */
443
491
  kyc_required: boolean;
444
492
  /**
445
- * Whether the user may skip verification. Only `true` for
493
+ * Whether the user may skip verification. `true` for
446
494
  * `trigger_event: "manual"` when the tenant enables allow-skip-on-manual,
447
- * or when the customer is already verified.
495
+ * for `"login"` when an expired identity document triggered the request
496
+ * (offer "Remind me later"), and when the customer is already verified.
497
+ * Always `false` at `"withdrawal"` / `"purchase"` — that is where a
498
+ * postponed re-verification becomes mandatory.
448
499
  */
449
500
  can_skip: boolean;
501
+ /**
502
+ * Why verification is — or is not — being asked for. Use `reason.code` to
503
+ * branch (for example `KYC_REQUIRED_ID_EXPIRED` warrants a different prompt
504
+ * than a first-time verification) and `reason.message` for display.
505
+ */
506
+ reason?: KycRequestReason;
450
507
  }
508
+ /**
509
+ * Body POSTed to your `callback_url` when a customer's identity document
510
+ * passes its expiry date. Signed with `X-Webhook-Signature: sha256=<hex>`
511
+ * (HMAC-SHA256 of the raw body), like every other Vesant callback.
512
+ *
513
+ * An expiry happens on a **date**, not on a customer action, so this webhook
514
+ * is the only signal for it — nothing the customer does triggers it. Delivered
515
+ * once per customer, when the document first becomes expired.
516
+ *
517
+ * It is sent regardless of the tenant's auto-trigger-on-ID-expiration setting:
518
+ * that setting governs whether verification is *enforced*, not whether you are
519
+ * *told*.
520
+ */
521
+ interface KycDocumentExpiredCallbackEvent {
522
+ /** Always `"kyc_document_expired"` — dispatch on this. */
523
+ event: 'kyc_document_expired';
524
+ /** Your customer identifier (the `user_id` you supplied). */
525
+ reference: string;
526
+ /** The customer's risk-profile ID. */
527
+ resource_id: string;
528
+ /**
529
+ * Always `"expired"`. Describes the document — not the customer's KYC
530
+ * status, which remains `accepted` until they re-verify.
531
+ */
532
+ status: 'expired';
533
+ data: {
534
+ customer_id: string;
535
+ /** The document's expiry date (ISO 8601 `YYYY-MM-DD`). */
536
+ id_expiry_date: string;
537
+ };
538
+ }
539
+ /**
540
+ * Type guard for the identity-document expiry webhook. Narrows an already
541
+ * signature-verified, parsed payload to {@link KycDocumentExpiredCallbackEvent}.
542
+ */
543
+ declare function isKycDocumentExpiredCallbackEvent(value: unknown): value is KycDocumentExpiredCallbackEvent;
451
544
  /** Device class detected by the SDK (purely client-side — server doesn't care). */
452
545
  type EventBasedFaceVerificationDeviceType = 'mobile' | 'desktop';
453
546
  interface CreateEventBasedFaceVerificationSessionResponse {
@@ -1159,4 +1252,4 @@ declare class KycClient extends BaseClient {
1159
1252
  createCustomerProfile(profile: CreateProfileRequest): Promise<CustomerProfile>;
1160
1253
  }
1161
1254
 
1162
- export { type CheckKycStatusRequest, type CheckKycStatusResponse, CreateProfileRequest as CreateCustomerProfileRequest, type CreateEventBasedFaceVerificationSessionRequest, type CreateEventBasedFaceVerificationSessionResponse, CustomerProfile, ProfileFilters as CustomerProfileFilters, ProfileListResponse as CustomerProfileListResponse, type DocumentType, type DocumentVerificationRequest, type DocumentVerificationResponse, type EventBasedFaceVerificationCallback, type EventBasedFaceVerificationDeviceType, type EventBasedFaceVerificationEvent, type EventBasedFaceVerificationFrequencyTrigger, type EventBasedFaceVerificationReactionResult, type EventBasedFaceVerificationReactions, type EventBasedFaceVerificationThresholdTrigger, type EventBasedFaceVerificationTriggers, type FaceProof, KYC_DECLINED_DESCRIPTIONS, type KycAlert, type KycAlertFilters, type KycAlertListResponse, type KycAlertStatus, type KycAlertType, KycClient, type KycClientConfig, type KycCustomerData, type KycCustomerProfile, type KycDeclinedCode, type KycHandoffSession, type KycOverview, type KycPagination, type KycPreferences, type KycRequest, type KycRequestFilters, type KycRequestListResponse, type KycStatus, type Name, PaginationParams, type Proof, type ProofDownloadURL, type ProofType, type RequestAdditionalDocumentsRequest, type RequestKycSubmitLinkRequest, type RequestKycSubmitLinkResponse, RiskLevel, type SubmitEventBasedFaceVerificationSessionRequest, type SubmittedDocument, type SupportedDocumentType, type UpdateKycAlertRequest, type UpdateKycPreferencesRequest, type UpdateKycStatusRequest, type UseKycAlertsOptions, type UseKycAlertsResult, type UseKycOverviewOptions, type UseKycOverviewResult, type UseKycPreferencesResult, type UseKycRequestsOptions, type UseKycRequestsResult, type UseKycSubmissionOptions, type UseKycSubmissionResult };
1255
+ export { type CheckKycStatusRequest, type CheckKycStatusResponse, CreateProfileRequest as CreateCustomerProfileRequest, type CreateEventBasedFaceVerificationSessionRequest, type CreateEventBasedFaceVerificationSessionResponse, CustomerProfile, ProfileFilters as CustomerProfileFilters, ProfileListResponse as CustomerProfileListResponse, type DocumentType, type DocumentVerificationRequest, type DocumentVerificationResponse, type EventBasedFaceVerificationCallback, type EventBasedFaceVerificationDeviceType, type EventBasedFaceVerificationEvent, type EventBasedFaceVerificationFrequencyTrigger, type EventBasedFaceVerificationReactionResult, type EventBasedFaceVerificationReactions, type EventBasedFaceVerificationThresholdTrigger, type EventBasedFaceVerificationTriggers, type FaceProof, KYC_DECLINED_DESCRIPTIONS, type KycAlert, type KycAlertFilters, type KycAlertListResponse, type KycAlertStatus, type KycAlertType, KycClient, type KycClientConfig, type KycCustomerData, type KycCustomerProfile, type KycDeclinedCode, type KycDocumentExpiredCallbackEvent, type KycHandoffSession, type KycOverview, type KycPagination, type KycPreferences, type KycRequest, type KycRequestFilters, type KycRequestListResponse, type KycRequestReason, type KycRequestReasonCode, type KycStatus, type KycTriggerEvent, 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, isKycDocumentExpiredCallbackEvent };
package/dist/kyc/index.js CHANGED
@@ -1267,8 +1267,12 @@ var KYC_DECLINED_DESCRIPTIONS = {
1267
1267
  KYC_PROVIDER_REJECTED: "Identity verification was rejected by the verification provider",
1268
1268
  KYC_DECLINED: "Identity verification was declined"
1269
1269
  };
1270
+ function isKycDocumentExpiredCallbackEvent(value) {
1271
+ return typeof value === "object" && value !== null && value.event === "kyc_document_expired";
1272
+ }
1270
1273
 
1271
1274
  exports.KYC_DECLINED_DESCRIPTIONS = KYC_DECLINED_DESCRIPTIONS;
1272
1275
  exports.KycClient = KycClient;
1276
+ exports.isKycDocumentExpiredCallbackEvent = isKycDocumentExpiredCallbackEvent;
1273
1277
  //# sourceMappingURL=index.js.map
1274
1278
  //# sourceMappingURL=index.js.map