vesant-sdk 1.6.6 → 2.0.0-dev.03b7c82

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-BJ87_Vv5.d.ts +430 -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-Bvp-f05-.d.ts} +7 -7
  6. package/dist/{client-C_A7QLcB.d.ts → client-CIEa7xYG.d.mts} +7 -7
  7. package/dist/client-IAOGCBfm.d.mts +430 -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 +137 -58
  11. package/dist/compliance/index.js.map +1 -1
  12. package/dist/compliance/index.mjs +137 -59
  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 +6 -24
  23. package/dist/geolocation/index.js.map +1 -1
  24. package/dist/geolocation/index.mjs +6 -24
  25. package/dist/geolocation/index.mjs.map +1 -1
  26. package/dist/index.d.mts +14 -71
  27. package/dist/index.d.ts +14 -71
  28. package/dist/index.js +244 -247
  29. package/dist/index.js.map +1 -1
  30. package/dist/index.mjs +243 -246
  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 +78 -23
  35. package/dist/kyc/core.js.map +1 -1
  36. package/dist/kyc/core.mjs +78 -24
  37. package/dist/kyc/core.mjs.map +1 -1
  38. package/dist/kyc/index.d.mts +267 -44
  39. package/dist/kyc/index.d.ts +267 -44
  40. package/dist/kyc/index.js +78 -23
  41. package/dist/kyc/index.js.map +1 -1
  42. package/dist/kyc/index.mjs +78 -24
  43. package/dist/kyc/index.mjs.map +1 -1
  44. package/dist/react.d.mts +42 -7
  45. package/dist/react.d.ts +42 -7
  46. package/dist/react.js +621 -277
  47. package/dist/react.js.map +1 -1
  48. package/dist/react.mjs +621 -277
  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-X5Md_dD_.d.ts → types-2utj53GK.d.ts} +2 -2
  69. package/dist/{types-1RzYeSal.d.mts → types-C4Zx0d_u.d.mts} +2 -2
  70. package/dist/{types-B4Ezqo7V.d.mts → types-QUCWam16.d.mts} +7 -1
  71. package/dist/{types-B4Ezqo7V.d.ts → types-QUCWam16.d.ts} +7 -1
  72. package/dist/webhooks/index.d.mts +181 -2
  73. package/dist/webhooks/index.d.ts +181 -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, CreateReuseKycSessionRequest, CreateReuseKycSessionResponse, DocumentType, DocumentVerificationRequest, DocumentVerificationResponse, 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, ReuseKycCallback, ReuseKycDeviceType, ReuseKycEvent, ReuseKycFrequencyTrigger, ReuseKycReactionResult, ReuseKycReactions, ReuseKycThresholdTrigger, ReuseKycTriggers, SubmitReuseKycSessionRequest, 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-C4Zx0d_u.mjs';
3
+ export { P as PaginationParams, R as RiskLevel } from '../types-QUCWam16.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, CreateReuseKycSessionRequest, CreateReuseKycSessionResponse, DocumentType, DocumentVerificationRequest, DocumentVerificationResponse, 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, ReuseKycCallback, ReuseKycDeviceType, ReuseKycEvent, ReuseKycFrequencyTrigger, ReuseKycReactionResult, ReuseKycReactions, ReuseKycThresholdTrigger, ReuseKycTriggers, SubmitReuseKycSessionRequest, 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-2utj53GK.js';
3
+ export { P as PaginationParams, R as RiskLevel } from '../types-QUCWam16.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 = "2.0.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,84 @@ 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 Re-Use KYC 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
639
  async createReuseKycSession(request) {
638
- return this.requestWithRetry("/api/v1/kyc/face/session", {
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 Re-Use KYC 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 `createReuseKycSession` 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 `createReuseKycSession`, plus the base64 selfie.
648
658
  */
649
659
  async submitReuseKycSession(request) {
650
- return this.requestWithRetry("/api/v1/kyc/face/submit", {
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
- * **/
667
+ * Look up the current state of a Re-Use KYC session by its forward
668
+ * reference. Useful for desktop pollers waiting on the mobile handoff.
669
+ *
670
+ * @param reference - The reference used when the session was created.
671
+ */
661
672
  async getReuseKycSessionStatus(reference) {
662
673
  return this.requestWithRetry(`/api/v1/kyc/face/verify/${encodeURIComponent(reference)}`, {
663
674
  method: "GET",
664
675
  headers: this.getUserHeaders()
665
676
  });
666
677
  }
678
+ /**
679
+ * Fetch the Redis-backed handoff session for a token. Same backing
680
+ * store as normal KYC (`kyc:session:<token>`, 15-minute TTL). Desktop
681
+ * callers poll `mobile_connected` to detect when a mobile device has
682
+ * scanned the QR and attached.
683
+ *
684
+ * @param token - The session token returned by `createReuseKycSession`.
685
+ */
686
+ async getHandoffSession(token) {
687
+ return this.request(
688
+ `/api/v1/kyc/session${this.buildQueryString({ token })}`,
689
+ { headers: this.getUserHeaders() }
690
+ );
691
+ }
692
+ /**
693
+ * Attach a mobile device to a desktop-initiated session. The mobile
694
+ * client calls this after scanning the QR code. The desktop poller
695
+ * sees `mobile_connected: true` on the next `getHandoffSession`.
696
+ *
697
+ * @param token - The session token transferred via the QR payload.
698
+ * @param isDisconnect - Pass true to release the session (default false).
699
+ */
700
+ async connectMobileSession(token, isDisconnect = false) {
701
+ return this.request("/api/v1/kyc/session/connect", {
702
+ method: "PUT",
703
+ body: JSON.stringify({ token, is_disconnect: isDisconnect }),
704
+ headers: this.getUserHeaders()
705
+ });
706
+ }
667
707
  /**
668
708
  * Check KYC status for a user
669
709
  *
@@ -1022,8 +1062,9 @@ var KycClient = class extends BaseClient {
1022
1062
  */
1023
1063
  async riskProfileRequest(path, options = {}) {
1024
1064
  if (!this.riskProfileBaseURL) {
1025
- throw new Error(
1026
- "Risk Profile Service URL not configured. Please provide riskProfileBaseURL in KycClientConfig."
1065
+ throw new ValidationError(
1066
+ "Risk Profile Service URL not configured. Please provide riskProfileBaseURL in KycClientConfig.",
1067
+ ["riskProfileBaseURL"]
1027
1068
  );
1028
1069
  }
1029
1070
  return this.request(path, {
@@ -1135,6 +1176,20 @@ var KycClient = class extends BaseClient {
1135
1176
  // ============================================================================
1136
1177
  };
1137
1178
 
1179
+ // src/kyc/types.ts
1180
+ var KYC_DECLINED_DESCRIPTIONS = {
1181
+ KYC_DOCUMENT_EXPIRED: "The submitted document has expired",
1182
+ KYC_DOCUMENT_INVALID: "The submitted document could not be verified",
1183
+ KYC_FACE_MISMATCH: "Face verification did not match the identity document",
1184
+ KYC_AGE_REQUIREMENT: "Age requirement not met",
1185
+ KYC_DUPLICATE_IDENTITY: "This identity has already been verified under another account",
1186
+ KYC_ADDRESS_MISMATCH: "Address verification failed",
1187
+ KYC_NAME_MISMATCH: "Name on document does not match the registered name",
1188
+ KYC_PROVIDER_REJECTED: "Identity verification was rejected by the verification provider",
1189
+ KYC_DECLINED: "Identity verification was declined"
1190
+ };
1191
+
1192
+ exports.KYC_DECLINED_DESCRIPTIONS = KYC_DECLINED_DESCRIPTIONS;
1138
1193
  exports.KycClient = KycClient;
1139
1194
  //# sourceMappingURL=core.js.map
1140
1195
  //# sourceMappingURL=core.js.map