vesant-sdk 1.6.6 → 1.7.0-dev.7d59b3e

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-ePzhQKp9.d.mts → client-BolQlL5e.d.mts} +1 -1
  3. package/dist/{client-ePzhQKp9.d.ts → client-BolQlL5e.d.ts} +1 -1
  4. package/dist/client-C3DCmGe9.d.ts +436 -0
  5. package/dist/{client-C_A7QLcB.d.ts → client-DMIRx7Tu.d.mts} +5 -3
  6. package/dist/{client-BlCxjbY2.d.mts → client-DoMSYMMR.d.ts} +5 -3
  7. package/dist/client-ZNdnpWe7.d.mts +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 +187 -103
  11. package/dist/compliance/index.js.map +1 -1
  12. package/dist/compliance/index.mjs +187 -104
  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 +302 -296
  29. package/dist/index.js.map +1 -1
  30. package/dist/index.mjs +301 -295
  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 +280 -50
  39. package/dist/kyc/index.d.ts +280 -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 +46 -9
  45. package/dist/react.d.ts +46 -9
  46. package/dist/react.js +891 -276
  47. package/dist/react.js.map +1 -1
  48. package/dist/react.mjs +890 -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 +6 -41
  63. package/dist/tax/index.d.ts +6 -41
  64. package/dist/tax/index.js +1 -36
  65. package/dist/tax/index.js.map +1 -1
  66. package/dist/tax/index.mjs +1 -36
  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,4 +1,4 @@
1
- export { CheckKycStatusRequest, CheckKycStatusResponse, CreateReuseKycSessionRequest, CreateReuseKycSessionResponse, DocumentType, DocumentVerificationRequest, DocumentVerificationResponse, FaceProof, KycAlert, KycAlertFilters, KycAlertListResponse, KycAlertStatus, KycAlertType, KycClient, KycClientConfig, KycCustomerProfile, KycOverview, KycPagination, KycPreferences, KycRequest, KycRequestFilters, KycRequestListResponse, KycStatus, KycTriggerEvent, Name, Proof, ProofDownloadURL, ProofType, RequestAdditionalDocumentsRequest, RequestKycSubmitLinkRequest, RequestKycSubmitLinkResponse, SubmitReuseKycSessionRequest, SubmittedDocument, SupportedDocumentType, UpdateKycAlertRequest, UpdateKycPreferencesRequest, UpdateKycStatusRequest, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult } from './index.mjs';
2
- export { P as PaginationParams, R as RiskLevel } from '../types-B4Ezqo7V.mjs';
3
- export { d as CreateCustomerProfileRequest, C as CustomerProfile, e as CustomerProfileFilters, f as CustomerProfileListResponse } from '../types-1RzYeSal.mjs';
4
- import '../client-ePzhQKp9.mjs';
1
+ export { CheckKycStatusRequest, CheckKycStatusResponse, CreateEventBasedFaceVerificationSessionRequest, CreateEventBasedFaceVerificationSessionResponse, DocumentType, DocumentVerificationRequest, DocumentVerificationResponse, EventBasedFaceVerificationCallback, EventBasedFaceVerificationDeviceType, EventBasedFaceVerificationEvent, EventBasedFaceVerificationFrequencyTrigger, EventBasedFaceVerificationReactionResult, EventBasedFaceVerificationReactions, EventBasedFaceVerificationThresholdTrigger, EventBasedFaceVerificationTriggers, FaceProof, KYC_DECLINED_DESCRIPTIONS, KycAlert, KycAlertFilters, KycAlertListResponse, KycAlertStatus, KycAlertType, KycClient, KycClientConfig, KycCustomerProfile, KycDeclinedCode, KycHandoffSession, KycOverview, KycPagination, KycPreferences, KycRequest, KycRequestFilters, KycRequestListResponse, KycStatus, Name, Proof, ProofDownloadURL, ProofType, RequestAdditionalDocumentsRequest, RequestKycSubmitLinkRequest, RequestKycSubmitLinkResponse, SubmitEventBasedFaceVerificationSessionRequest, SubmittedDocument, SupportedDocumentType, UpdateKycAlertRequest, UpdateKycPreferencesRequest, UpdateKycStatusRequest, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult } from './index.mjs';
2
+ export { a as CreateCustomerProfileRequest, C as CustomerProfile, P as CustomerProfileFilters, b as CustomerProfileListResponse } from '../types-BOFaMQxI.mjs';
3
+ export { P as PaginationParams, R as RiskLevel } from '../types-CBQRNL-l.mjs';
4
+ import '../client-BolQlL5e.mjs';
@@ -1,4 +1,4 @@
1
- export { CheckKycStatusRequest, CheckKycStatusResponse, CreateReuseKycSessionRequest, CreateReuseKycSessionResponse, DocumentType, DocumentVerificationRequest, DocumentVerificationResponse, FaceProof, KycAlert, KycAlertFilters, KycAlertListResponse, KycAlertStatus, KycAlertType, KycClient, KycClientConfig, KycCustomerProfile, KycOverview, KycPagination, KycPreferences, KycRequest, KycRequestFilters, KycRequestListResponse, KycStatus, KycTriggerEvent, Name, Proof, ProofDownloadURL, ProofType, RequestAdditionalDocumentsRequest, RequestKycSubmitLinkRequest, RequestKycSubmitLinkResponse, SubmitReuseKycSessionRequest, SubmittedDocument, SupportedDocumentType, UpdateKycAlertRequest, UpdateKycPreferencesRequest, UpdateKycStatusRequest, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult } from './index.js';
2
- export { P as PaginationParams, R as RiskLevel } from '../types-B4Ezqo7V.js';
3
- export { d as CreateCustomerProfileRequest, C as CustomerProfile, e as CustomerProfileFilters, f as CustomerProfileListResponse } from '../types-X5Md_dD_.js';
4
- import '../client-ePzhQKp9.js';
1
+ export { CheckKycStatusRequest, CheckKycStatusResponse, CreateEventBasedFaceVerificationSessionRequest, CreateEventBasedFaceVerificationSessionResponse, DocumentType, DocumentVerificationRequest, DocumentVerificationResponse, EventBasedFaceVerificationCallback, EventBasedFaceVerificationDeviceType, EventBasedFaceVerificationEvent, EventBasedFaceVerificationFrequencyTrigger, EventBasedFaceVerificationReactionResult, EventBasedFaceVerificationReactions, EventBasedFaceVerificationThresholdTrigger, EventBasedFaceVerificationTriggers, FaceProof, KYC_DECLINED_DESCRIPTIONS, KycAlert, KycAlertFilters, KycAlertListResponse, KycAlertStatus, KycAlertType, KycClient, KycClientConfig, KycCustomerProfile, KycDeclinedCode, KycHandoffSession, KycOverview, KycPagination, KycPreferences, KycRequest, KycRequestFilters, KycRequestListResponse, KycStatus, Name, Proof, ProofDownloadURL, ProofType, RequestAdditionalDocumentsRequest, RequestKycSubmitLinkRequest, RequestKycSubmitLinkResponse, SubmitEventBasedFaceVerificationSessionRequest, SubmittedDocument, SupportedDocumentType, UpdateKycAlertRequest, UpdateKycPreferencesRequest, UpdateKycStatusRequest, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult } from './index.js';
2
+ export { a as CreateCustomerProfileRequest, C as CustomerProfile, P as CustomerProfileFilters, b as CustomerProfileListResponse } from '../types-UGyDl1fd.js';
3
+ export { P as PaginationParams, R as RiskLevel } from '../types-CBQRNL-l.js';
4
+ import '../client-BolQlL5e.js';
package/dist/kyc/core.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=core.js.map
1140
1199
  //# sourceMappingURL=core.js.map