vesant-sdk 1.7.2-dev.617dd44 → 1.7.2-dev.9ef17db

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 +113 -30
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.mjs +113 -31
  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 +74 -29
  27. package/dist/kyc/core.js.map +1 -1
  28. package/dist/kyc/core.mjs +74 -30
  29. package/dist/kyc/core.mjs.map +1 -1
  30. package/dist/kyc/index.d.mts +334 -65
  31. package/dist/kyc/index.d.ts +334 -65
  32. package/dist/kyc/index.js +74 -29
  33. package/dist/kyc/index.js.map +1 -1
  34. package/dist/kyc/index.mjs +74 -30
  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 +257 -35
  39. package/dist/react.js.map +1 -1
  40. package/dist/react.mjs +255 -36
  41. package/dist/react.mjs.map +1 -1
  42. package/package.json +1 -1
package/dist/kyc/index.js CHANGED
@@ -664,19 +664,27 @@ var KycClient = class extends BaseClient {
664
664
  *
665
665
  * Generates a link that the user can visit to submit their KYC documents.
666
666
  *
667
+ * Pass the `trigger_event` that matches the user action so the tenant's
668
+ * trigger preferences decide whether verification is required; inspect
669
+ * `kyc_required` and `reason` on the response before redirecting.
670
+ *
667
671
  * Optionally pass the customer's registered identity data as
668
672
  * `customer_data` (same shape as the geolocation `customer_data` block).
669
673
  * It seeds the customer's risk profile so document verification can
670
674
  * cross-check the submitted document against trusted reference data;
671
675
  * fields never overwrite data already on the profile.
672
676
  *
673
- * @param request - Request containing the user ID, optional redirect URL, optional callback URL (receives POST requests), and optional customer identity data
674
- * @returns Response containing the redirect link and KYC ID
677
+ * The call is made once and is not retried: each request creates a new
678
+ * KYC record and link, so a retry after a timeout would leave duplicates.
679
+ *
680
+ * @param request - Request containing the user ID, trigger event, optional redirect URL, optional callback URL (receives POST requests), and optional customer identity data
681
+ * @returns Response containing the redirect link, KYC ID, `kyc_required`, `can_skip` and `reason`
675
682
  *
676
683
  * @example
677
684
  * ```typescript
678
685
  * const result = await client.requestKycSubmitLink({
679
686
  * user_id: "user_123",
687
+ * trigger_event: "onboarding",
680
688
  * redirect_url: "https://merchant.com/kyc-complete", // optional
681
689
  * callback_url: "https://merchant.com/api/kyc-webhook", // optional - receives POST requests on status change
682
690
  * customer_data: { // optional - seeds the risk profile for document cross-checks
@@ -689,25 +697,25 @@ var KycClient = class extends BaseClient {
689
697
  * }
690
698
  * });
691
699
  *
700
+ * if (!result.kyc_required) return proceed();
692
701
  * console.log(`Redirect user to: ${result.link}`);
693
702
  * console.log(`KYC ID: ${result.kyc_id}`);
694
703
  * ```
695
704
  */
696
705
  async requestKycSubmitLink(request, requestOptions) {
697
- return this.requestWithRetry("/api/v1/kyc/request", {
706
+ return this.request("/api/v1/kyc/request", {
698
707
  method: "POST",
699
708
  body: JSON.stringify(request),
700
709
  headers: this.getUserHeaders()
701
- }, void 0, void 0, requestOptions);
710
+ }, void 0, requestOptions);
702
711
  }
703
712
  /**
704
713
  * Create a Event-Based Face Verification session.
705
714
  *
706
715
  * Inspect the response before showing UI:
707
- * - `is_required === false` → skip face capture; `reason` explains why.
708
- * - `device_type === 'desktop'` render `qr_payload` as a QR; the
709
- * mobile device picks up the session via the connect endpoint.
710
- * - `device_type === 'mobile'` → open the face capture modal directly.
716
+ * - `is_required === false` → skip face verification; `reason` explains why.
717
+ * - `verification_url` presentembed the hosted journey and poll status.
718
+ * - `verification_url` absent → use the local camera / QR fallback.
711
719
  *
712
720
  * @param request - Reference, customer_id, event, amount (for threshold events), optional URLs.
713
721
  */
@@ -721,9 +729,9 @@ var KycClient = class extends BaseClient {
721
729
  /**
722
730
  * Submit a real-time face capture for an active Event-Based Face Verification session.
723
731
  *
724
- * **Mobile-only.** The server rejects desktop User-Agents with HTTP
725
- * 400 (`face capture must be completed on a mobile device`). Use the
726
- * QR handoff from `createEventBasedFaceVerificationSession` for desktop callers.
732
+ * Works from any device: the platform does not inspect the User-Agent.
733
+ * `FaceCaptureModal` decides between direct capture and the QR handoff
734
+ * on the client; custom UIs may submit from desktop or mobile alike.
727
735
  *
728
736
  * The `data` field on the response carries `retries_remaining`,
729
737
  * `retry_limit_exceeded`, and the reaction flags (`enforce_logout`,
@@ -754,11 +762,28 @@ var KycClient = class extends BaseClient {
754
762
  headers: this.getUserHeaders()
755
763
  });
756
764
  }
765
+ /**
766
+ * Mint a fresh hosted verification journey for the next attempt on an
767
+ * active session whose previous hosted-journey attempt was declined.
768
+ * Only valid while the session is active and attempts remain; the
769
+ * response carries the new `verification_url` to embed. Used internally
770
+ * by `FaceCaptureModal`'s Try Again flow in hosted-journey mode.
771
+ *
772
+ * @param token - The session token returned by `createEventBasedFaceVerificationSession`.
773
+ */
774
+ async retryEventBasedFaceVerificationJourney(token) {
775
+ return this.request("/api/v1/kyc/face/onsite/journey", {
776
+ method: "POST",
777
+ body: JSON.stringify({ token }),
778
+ headers: this.getUserHeaders()
779
+ });
780
+ }
757
781
  /**
758
782
  * Fetch the Redis-backed handoff session for a token. Same backing
759
- * store as normal KYC (`kyc:session:<token>`, 15-minute TTL). Desktop
760
- * callers poll `mobile_connected` to detect when a mobile device has
761
- * scanned the QR and attached.
783
+ * store as normal KYC (`kyc:session:<token>`, 15-minute TTL). The
784
+ * Event-Based Face Verification database session still expires after
785
+ * 10 minutes. Desktop callers poll `mobile_connected` to detect when a
786
+ * mobile device has scanned the QR and attached.
762
787
  *
763
788
  * @param token - The session token returned by `createEventBasedFaceVerificationSession`.
764
789
  */
@@ -787,25 +812,30 @@ var KycClient = class extends BaseClient {
787
812
  * Check KYC status for a user
788
813
  *
789
814
  * Returns the current KYC status:
790
- * - "complete" → KYC verified, show "Continue to Login"
791
- * - "processing" → Under review, show "Continue to Login"
792
- * - "failed" / "declined" Show error + retry option
793
- * - "pending" / "in_progress" Keep polling
815
+ * - "accepted" / "review.pending" → verified (limited access while under review)
816
+ * - "pending" → documents submitted, verification running: keep polling
817
+ * - "awaiting_kyc" nothing submitted yet; check `link_expired` before
818
+ * re-surfacing or re-requesting the link. Never treat as in progress.
819
+ * - "declined" → show `additional_data.declined_reasons` (fallback
820
+ * `declined_reason`) with a retry option
794
821
  *
795
- * @param request - Request containing user_id and token
796
- * @returns Response with kyc_status and message (reason)
822
+ * @param request - Request containing user_id and kyc_id
823
+ * @returns Response with status, verification flags and, once terminal, the full record in `additional_data`
797
824
  *
798
825
  * @example
799
826
  * ```typescript
800
827
  * const result = await client.checkKycStatus({
801
828
  * user_id: "user_123",
802
- * token: "auth_token_xyz"
829
+ * kyc_id: "550e8400-e29b-41d4-a716-446655440000"
803
830
  * });
804
831
  *
805
- * if (result.kyc_status === 'complete') {
806
- * // Show "Continue to Login"
807
- * } else if (result.kyc_status === 'failed' || result.kyc_status === 'declined') {
832
+ * if (result.status === 'accepted' || result.status === 'review.pending') {
833
+ * // Grant access
834
+ * } else if (result.status === 'declined') {
835
+ * const reasons = result.additional_data?.declined_reasons;
808
836
  * // Show error + retry option
837
+ * } else if (result.status === 'awaiting_kyc') {
838
+ * // Prompt to verify; request a new link when result.link_expired is true
809
839
  * } else {
810
840
  * // Keep polling
811
841
  * }
@@ -827,7 +857,9 @@ var KycClient = class extends BaseClient {
827
857
  /**
828
858
  * Submit a document verification request with OCR
829
859
  *
830
- * Uses requestWithRetry() for automatic retry on transient failures.
860
+ * The call is made once and is not retried: every submission is processed
861
+ * and billed, and the platform does not replay this route from an
862
+ * idempotency key. Retry explicitly if the request fails.
831
863
  *
832
864
  * @param request - Document verification request with documents and customer info
833
865
  * @returns Verification response with status and reference
@@ -853,11 +885,11 @@ var KycClient = class extends BaseClient {
853
885
  * ```
854
886
  */
855
887
  async submitVerification(request, requestOptions) {
856
- return this.requestWithRetry("/api/v1/kyc/submit", {
888
+ return this.request("/api/v1/kyc/submit", {
857
889
  method: "POST",
858
890
  body: JSON.stringify(request),
859
891
  headers: this.getUserHeaders()
860
- }, void 0, void 0, requestOptions);
892
+ }, void 0, requestOptions);
861
893
  }
862
894
  /**
863
895
  * Get a KYC request by ID
@@ -914,14 +946,14 @@ var KycClient = class extends BaseClient {
914
946
  * ```typescript
915
947
  * // Accept a KYC request
916
948
  * await client.updateKycStatus({
917
- * reference: "shufti_ref_123",
949
+ * reference: "kyc-ref-123",
918
950
  * status: "accepted",
919
951
  * reason: "All documents verified successfully"
920
952
  * });
921
953
  *
922
954
  * // Decline a KYC request
923
955
  * await client.updateKycStatus({
924
- * reference: "shufti_ref_456",
956
+ * reference: "kyc-ref-456",
925
957
  * status: "declined",
926
958
  * reason: "Document expired"
927
959
  * });
@@ -937,6 +969,10 @@ var KycClient = class extends BaseClient {
937
969
  /**
938
970
  * Request additional documents from customer
939
971
  *
972
+ * @deprecated The platform does not expose this operation; the call always
973
+ * fails. Request additional documents from the Vesant console instead.
974
+ * This method will be removed in a future release.
975
+ *
940
976
  * @param request - Request with KYC ID and document types needed
941
977
  *
942
978
  * @example
@@ -1109,6 +1145,11 @@ var KycClient = class extends BaseClient {
1109
1145
  /**
1110
1146
  * Update KYC preferences for the tenant
1111
1147
  *
1148
+ * @deprecated KYC preferences are managed in the Vesant console; the
1149
+ * platform exposes no update operation to the SDK, so this call always
1150
+ * fails. Use `getPreferences()` to read them. This method will be removed
1151
+ * in a future release.
1152
+ *
1112
1153
  * @param update - Fields to update
1113
1154
  * @returns Updated preferences
1114
1155
  *
@@ -1267,8 +1308,12 @@ var KYC_DECLINED_DESCRIPTIONS = {
1267
1308
  KYC_PROVIDER_REJECTED: "Identity verification was rejected by the verification provider",
1268
1309
  KYC_DECLINED: "Identity verification was declined"
1269
1310
  };
1311
+ function isKycDocumentExpiredCallbackEvent(value) {
1312
+ return typeof value === "object" && value !== null && value.event === "kyc_document_expired";
1313
+ }
1270
1314
 
1271
1315
  exports.KYC_DECLINED_DESCRIPTIONS = KYC_DECLINED_DESCRIPTIONS;
1272
1316
  exports.KycClient = KycClient;
1317
+ exports.isKycDocumentExpiredCallbackEvent = isKycDocumentExpiredCallbackEvent;
1273
1318
  //# sourceMappingURL=index.js.map
1274
1319
  //# sourceMappingURL=index.js.map