vesant-sdk 1.7.1-dev.afc5a32 → 1.7.1-dev.c2ac5a5

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 (42) hide show
  1. package/README.md +4 -0
  2. package/dist/{client-D23KhWeh.d.mts → client-5q4whhGu.d.mts} +1 -1
  3. package/dist/{client-fy3trF2K.d.ts → client-BaUekQT8.d.ts} +32 -10
  4. package/dist/{client-B3DCAHlg.d.ts → client-DUHC-68_.d.ts} +1 -1
  5. package/dist/{client-BwXMQA2a.d.mts → client-XDEhh9VN.d.mts} +32 -10
  6. package/dist/compliance/index.d.mts +2 -2
  7. package/dist/compliance/index.d.ts +2 -2
  8. package/dist/compliance/index.js +39 -1
  9. package/dist/compliance/index.js.map +1 -1
  10. package/dist/compliance/index.mjs +39 -1
  11. package/dist/compliance/index.mjs.map +1 -1
  12. package/dist/geolocation/index.d.mts +2 -2
  13. package/dist/geolocation/index.d.ts +2 -2
  14. package/dist/geolocation/index.js +39 -1
  15. package/dist/geolocation/index.js.map +1 -1
  16. package/dist/geolocation/index.mjs +39 -1
  17. package/dist/geolocation/index.mjs.map +1 -1
  18. package/dist/index.d.mts +3 -3
  19. package/dist/index.d.ts +3 -3
  20. package/dist/index.js +86 -23
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.mjs +86 -23
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/kyc/core.d.mts +1 -1
  25. package/dist/kyc/core.d.ts +1 -1
  26. package/dist/kyc/core.js +47 -22
  27. package/dist/kyc/core.js.map +1 -1
  28. package/dist/kyc/core.mjs +47 -22
  29. package/dist/kyc/core.mjs.map +1 -1
  30. package/dist/kyc/index.d.mts +178 -39
  31. package/dist/kyc/index.d.ts +178 -39
  32. package/dist/kyc/index.js +47 -22
  33. package/dist/kyc/index.js.map +1 -1
  34. package/dist/kyc/index.mjs +47 -22
  35. package/dist/kyc/index.mjs.map +1 -1
  36. package/dist/react.d.mts +126 -48
  37. package/dist/react.d.ts +126 -48
  38. package/dist/react.js +131 -20
  39. package/dist/react.js.map +1 -1
  40. package/dist/react.mjs +129 -21
  41. package/dist/react.mjs.map +1 -1
  42. package/package.json +1 -1
@@ -662,19 +662,27 @@ var KycClient = class extends BaseClient {
662
662
  *
663
663
  * Generates a link that the user can visit to submit their KYC documents.
664
664
  *
665
+ * Pass the `trigger_event` that matches the user action so the tenant's
666
+ * trigger preferences decide whether verification is required; inspect
667
+ * `kyc_required` and `reason` on the response before redirecting.
668
+ *
665
669
  * Optionally pass the customer's registered identity data as
666
670
  * `customer_data` (same shape as the geolocation `customer_data` block).
667
671
  * It seeds the customer's risk profile so document verification can
668
672
  * cross-check the submitted document against trusted reference data;
669
673
  * fields never overwrite data already on the profile.
670
674
  *
671
- * @param request - Request containing the user ID, optional redirect URL, optional callback URL (receives POST requests), and optional customer identity data
672
- * @returns Response containing the redirect link and KYC ID
675
+ * The call is made once and is not retried: each request creates a new
676
+ * KYC record and link, so a retry after a timeout would leave duplicates.
677
+ *
678
+ * @param request - Request containing the user ID, trigger event, optional redirect URL, optional callback URL (receives POST requests), and optional customer identity data
679
+ * @returns Response containing the redirect link, KYC ID, `kyc_required`, `can_skip` and `reason`
673
680
  *
674
681
  * @example
675
682
  * ```typescript
676
683
  * const result = await client.requestKycSubmitLink({
677
684
  * user_id: "user_123",
685
+ * trigger_event: "onboarding",
678
686
  * redirect_url: "https://merchant.com/kyc-complete", // optional
679
687
  * callback_url: "https://merchant.com/api/kyc-webhook", // optional - receives POST requests on status change
680
688
  * customer_data: { // optional - seeds the risk profile for document cross-checks
@@ -687,16 +695,17 @@ var KycClient = class extends BaseClient {
687
695
  * }
688
696
  * });
689
697
  *
698
+ * if (!result.kyc_required) return proceed();
690
699
  * console.log(`Redirect user to: ${result.link}`);
691
700
  * console.log(`KYC ID: ${result.kyc_id}`);
692
701
  * ```
693
702
  */
694
703
  async requestKycSubmitLink(request, requestOptions) {
695
- return this.requestWithRetry("/api/v1/kyc/request", {
704
+ return this.request("/api/v1/kyc/request", {
696
705
  method: "POST",
697
706
  body: JSON.stringify(request),
698
707
  headers: this.getUserHeaders()
699
- }, void 0, void 0, requestOptions);
708
+ }, void 0, requestOptions);
700
709
  }
701
710
  /**
702
711
  * Create a Event-Based Face Verification session.
@@ -718,9 +727,9 @@ var KycClient = class extends BaseClient {
718
727
  /**
719
728
  * Submit a real-time face capture for an active Event-Based Face Verification session.
720
729
  *
721
- * **Mobile-only.** The server rejects desktop User-Agents with HTTP
722
- * 400 (`face capture must be completed on a mobile device`). Use the
723
- * QR handoff from `createEventBasedFaceVerificationSession` for desktop callers.
730
+ * Works from any device: the platform does not inspect the User-Agent.
731
+ * `FaceCaptureModal` decides between direct capture and the QR handoff
732
+ * on the client; custom UIs may submit from desktop or mobile alike.
724
733
  *
725
734
  * The `data` field on the response carries `retries_remaining`,
726
735
  * `retry_limit_exceeded`, and the reaction flags (`enforce_logout`,
@@ -801,25 +810,30 @@ var KycClient = class extends BaseClient {
801
810
  * Check KYC status for a user
802
811
  *
803
812
  * Returns the current KYC status:
804
- * - "complete" → KYC verified, show "Continue to Login"
805
- * - "processing" → Under review, show "Continue to Login"
806
- * - "failed" / "declined" → Show error + retry option
807
- * - "pending" / "in_progress" → Keep polling
813
+ * - "accepted" / "review.pending" → verified (limited access while under review)
814
+ * - "pending" → documents submitted, verification running: keep polling
815
+ * - "awaiting_kyc" → nothing submitted yet; check `link_expired` before
816
+ * re-surfacing or re-requesting the link. Never treat as in progress.
817
+ * - "declined" → show `additional_data.declined_reasons` (fallback
818
+ * `declined_reason`) with a retry option
808
819
  *
809
- * @param request - Request containing user_id and token
810
- * @returns Response with kyc_status and message (reason)
820
+ * @param request - Request containing user_id and kyc_id
821
+ * @returns Response with status, verification flags and, once terminal, the full record in `additional_data`
811
822
  *
812
823
  * @example
813
824
  * ```typescript
814
825
  * const result = await client.checkKycStatus({
815
826
  * user_id: "user_123",
816
- * token: "auth_token_xyz"
827
+ * kyc_id: "550e8400-e29b-41d4-a716-446655440000"
817
828
  * });
818
829
  *
819
- * if (result.kyc_status === 'complete') {
820
- * // Show "Continue to Login"
821
- * } else if (result.kyc_status === 'failed' || result.kyc_status === 'declined') {
830
+ * if (result.status === 'accepted' || result.status === 'review.pending') {
831
+ * // Grant access
832
+ * } else if (result.status === 'declined') {
833
+ * const reasons = result.additional_data?.declined_reasons;
822
834
  * // Show error + retry option
835
+ * } else if (result.status === 'awaiting_kyc') {
836
+ * // Prompt to verify; request a new link when result.link_expired is true
823
837
  * } else {
824
838
  * // Keep polling
825
839
  * }
@@ -841,7 +855,9 @@ var KycClient = class extends BaseClient {
841
855
  /**
842
856
  * Submit a document verification request with OCR
843
857
  *
844
- * Uses requestWithRetry() for automatic retry on transient failures.
858
+ * The call is made once and is not retried: every submission is processed
859
+ * and billed, and the platform does not replay this route from an
860
+ * idempotency key. Retry explicitly if the request fails.
845
861
  *
846
862
  * @param request - Document verification request with documents and customer info
847
863
  * @returns Verification response with status and reference
@@ -867,11 +883,11 @@ var KycClient = class extends BaseClient {
867
883
  * ```
868
884
  */
869
885
  async submitVerification(request, requestOptions) {
870
- return this.requestWithRetry("/api/v1/kyc/submit", {
886
+ return this.request("/api/v1/kyc/submit", {
871
887
  method: "POST",
872
888
  body: JSON.stringify(request),
873
889
  headers: this.getUserHeaders()
874
- }, void 0, void 0, requestOptions);
890
+ }, void 0, requestOptions);
875
891
  }
876
892
  /**
877
893
  * Get a KYC request by ID
@@ -928,14 +944,14 @@ var KycClient = class extends BaseClient {
928
944
  * ```typescript
929
945
  * // Accept a KYC request
930
946
  * await client.updateKycStatus({
931
- * reference: "shufti_ref_123",
947
+ * reference: "kyc-ref-123",
932
948
  * status: "accepted",
933
949
  * reason: "All documents verified successfully"
934
950
  * });
935
951
  *
936
952
  * // Decline a KYC request
937
953
  * await client.updateKycStatus({
938
- * reference: "shufti_ref_456",
954
+ * reference: "kyc-ref-456",
939
955
  * status: "declined",
940
956
  * reason: "Document expired"
941
957
  * });
@@ -951,6 +967,10 @@ var KycClient = class extends BaseClient {
951
967
  /**
952
968
  * Request additional documents from customer
953
969
  *
970
+ * @deprecated The platform does not expose this operation; the call always
971
+ * fails. Request additional documents from the Vesant console instead.
972
+ * This method will be removed in a future release.
973
+ *
954
974
  * @param request - Request with KYC ID and document types needed
955
975
  *
956
976
  * @example
@@ -1123,6 +1143,11 @@ var KycClient = class extends BaseClient {
1123
1143
  /**
1124
1144
  * Update KYC preferences for the tenant
1125
1145
  *
1146
+ * @deprecated KYC preferences are managed in the Vesant console; the
1147
+ * platform exposes no update operation to the SDK, so this call always
1148
+ * fails. Use `getPreferences()` to read them. This method will be removed
1149
+ * in a future release.
1150
+ *
1126
1151
  * @param update - Fields to update
1127
1152
  * @returns Updated preferences
1128
1153
  *