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.
- package/README.md +4 -0
- package/dist/{client-D23KhWeh.d.mts → client-5q4whhGu.d.mts} +1 -1
- package/dist/{client-fy3trF2K.d.ts → client-BaUekQT8.d.ts} +32 -10
- package/dist/{client-B3DCAHlg.d.ts → client-DUHC-68_.d.ts} +1 -1
- package/dist/{client-BwXMQA2a.d.mts → client-XDEhh9VN.d.mts} +32 -10
- package/dist/compliance/index.d.mts +2 -2
- package/dist/compliance/index.d.ts +2 -2
- package/dist/compliance/index.js +39 -1
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +39 -1
- package/dist/compliance/index.mjs.map +1 -1
- package/dist/geolocation/index.d.mts +2 -2
- package/dist/geolocation/index.d.ts +2 -2
- package/dist/geolocation/index.js +39 -1
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +39 -1
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index.d.mts +3 -3
- package/dist/index.d.ts +3 -3
- package/dist/index.js +113 -30
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +113 -31
- package/dist/index.mjs.map +1 -1
- package/dist/kyc/core.d.mts +1 -1
- package/dist/kyc/core.d.ts +1 -1
- package/dist/kyc/core.js +74 -29
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +74 -30
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +334 -65
- package/dist/kyc/index.d.ts +334 -65
- package/dist/kyc/index.js +74 -29
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +74 -30
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +126 -48
- package/dist/react.d.ts +126 -48
- package/dist/react.js +257 -35
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +255 -36
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/kyc/core.mjs
CHANGED
|
@@ -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
|
-
*
|
|
672
|
-
*
|
|
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,25 +695,25 @@ 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.
|
|
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,
|
|
708
|
+
}, void 0, requestOptions);
|
|
700
709
|
}
|
|
701
710
|
/**
|
|
702
711
|
* Create a Event-Based Face Verification session.
|
|
703
712
|
*
|
|
704
713
|
* Inspect the response before showing UI:
|
|
705
|
-
* - `is_required === false` → skip face
|
|
706
|
-
* - `
|
|
707
|
-
*
|
|
708
|
-
* - `device_type === 'mobile'` → open the face capture modal directly.
|
|
714
|
+
* - `is_required === false` → skip face verification; `reason` explains why.
|
|
715
|
+
* - `verification_url` present → embed the hosted journey and poll status.
|
|
716
|
+
* - `verification_url` absent → use the local camera / QR fallback.
|
|
709
717
|
*
|
|
710
718
|
* @param request - Reference, customer_id, event, amount (for threshold events), optional URLs.
|
|
711
719
|
*/
|
|
@@ -719,9 +727,9 @@ var KycClient = class extends BaseClient {
|
|
|
719
727
|
/**
|
|
720
728
|
* Submit a real-time face capture for an active Event-Based Face Verification session.
|
|
721
729
|
*
|
|
722
|
-
*
|
|
723
|
-
*
|
|
724
|
-
*
|
|
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.
|
|
725
733
|
*
|
|
726
734
|
* The `data` field on the response carries `retries_remaining`,
|
|
727
735
|
* `retry_limit_exceeded`, and the reaction flags (`enforce_logout`,
|
|
@@ -752,11 +760,28 @@ var KycClient = class extends BaseClient {
|
|
|
752
760
|
headers: this.getUserHeaders()
|
|
753
761
|
});
|
|
754
762
|
}
|
|
763
|
+
/**
|
|
764
|
+
* Mint a fresh hosted verification journey for the next attempt on an
|
|
765
|
+
* active session whose previous hosted-journey attempt was declined.
|
|
766
|
+
* Only valid while the session is active and attempts remain; the
|
|
767
|
+
* response carries the new `verification_url` to embed. Used internally
|
|
768
|
+
* by `FaceCaptureModal`'s Try Again flow in hosted-journey mode.
|
|
769
|
+
*
|
|
770
|
+
* @param token - The session token returned by `createEventBasedFaceVerificationSession`.
|
|
771
|
+
*/
|
|
772
|
+
async retryEventBasedFaceVerificationJourney(token) {
|
|
773
|
+
return this.request("/api/v1/kyc/face/onsite/journey", {
|
|
774
|
+
method: "POST",
|
|
775
|
+
body: JSON.stringify({ token }),
|
|
776
|
+
headers: this.getUserHeaders()
|
|
777
|
+
});
|
|
778
|
+
}
|
|
755
779
|
/**
|
|
756
780
|
* Fetch the Redis-backed handoff session for a token. Same backing
|
|
757
|
-
* store as normal KYC (`kyc:session:<token>`, 15-minute TTL).
|
|
758
|
-
*
|
|
759
|
-
*
|
|
781
|
+
* store as normal KYC (`kyc:session:<token>`, 15-minute TTL). The
|
|
782
|
+
* Event-Based Face Verification database session still expires after
|
|
783
|
+
* 10 minutes. Desktop callers poll `mobile_connected` to detect when a
|
|
784
|
+
* mobile device has scanned the QR and attached.
|
|
760
785
|
*
|
|
761
786
|
* @param token - The session token returned by `createEventBasedFaceVerificationSession`.
|
|
762
787
|
*/
|
|
@@ -785,25 +810,30 @@ var KycClient = class extends BaseClient {
|
|
|
785
810
|
* Check KYC status for a user
|
|
786
811
|
*
|
|
787
812
|
* Returns the current KYC status:
|
|
788
|
-
* - "
|
|
789
|
-
* - "
|
|
790
|
-
* - "
|
|
791
|
-
* -
|
|
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
|
|
792
819
|
*
|
|
793
|
-
* @param request - Request containing user_id and
|
|
794
|
-
* @returns Response with
|
|
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`
|
|
795
822
|
*
|
|
796
823
|
* @example
|
|
797
824
|
* ```typescript
|
|
798
825
|
* const result = await client.checkKycStatus({
|
|
799
826
|
* user_id: "user_123",
|
|
800
|
-
*
|
|
827
|
+
* kyc_id: "550e8400-e29b-41d4-a716-446655440000"
|
|
801
828
|
* });
|
|
802
829
|
*
|
|
803
|
-
* if (result.
|
|
804
|
-
* //
|
|
805
|
-
* } else if (result.
|
|
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;
|
|
806
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
|
|
807
837
|
* } else {
|
|
808
838
|
* // Keep polling
|
|
809
839
|
* }
|
|
@@ -825,7 +855,9 @@ var KycClient = class extends BaseClient {
|
|
|
825
855
|
/**
|
|
826
856
|
* Submit a document verification request with OCR
|
|
827
857
|
*
|
|
828
|
-
*
|
|
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.
|
|
829
861
|
*
|
|
830
862
|
* @param request - Document verification request with documents and customer info
|
|
831
863
|
* @returns Verification response with status and reference
|
|
@@ -851,11 +883,11 @@ var KycClient = class extends BaseClient {
|
|
|
851
883
|
* ```
|
|
852
884
|
*/
|
|
853
885
|
async submitVerification(request, requestOptions) {
|
|
854
|
-
return this.
|
|
886
|
+
return this.request("/api/v1/kyc/submit", {
|
|
855
887
|
method: "POST",
|
|
856
888
|
body: JSON.stringify(request),
|
|
857
889
|
headers: this.getUserHeaders()
|
|
858
|
-
}, void 0,
|
|
890
|
+
}, void 0, requestOptions);
|
|
859
891
|
}
|
|
860
892
|
/**
|
|
861
893
|
* Get a KYC request by ID
|
|
@@ -912,14 +944,14 @@ var KycClient = class extends BaseClient {
|
|
|
912
944
|
* ```typescript
|
|
913
945
|
* // Accept a KYC request
|
|
914
946
|
* await client.updateKycStatus({
|
|
915
|
-
* reference: "
|
|
947
|
+
* reference: "kyc-ref-123",
|
|
916
948
|
* status: "accepted",
|
|
917
949
|
* reason: "All documents verified successfully"
|
|
918
950
|
* });
|
|
919
951
|
*
|
|
920
952
|
* // Decline a KYC request
|
|
921
953
|
* await client.updateKycStatus({
|
|
922
|
-
* reference: "
|
|
954
|
+
* reference: "kyc-ref-456",
|
|
923
955
|
* status: "declined",
|
|
924
956
|
* reason: "Document expired"
|
|
925
957
|
* });
|
|
@@ -935,6 +967,10 @@ var KycClient = class extends BaseClient {
|
|
|
935
967
|
/**
|
|
936
968
|
* Request additional documents from customer
|
|
937
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
|
+
*
|
|
938
974
|
* @param request - Request with KYC ID and document types needed
|
|
939
975
|
*
|
|
940
976
|
* @example
|
|
@@ -1107,6 +1143,11 @@ var KycClient = class extends BaseClient {
|
|
|
1107
1143
|
/**
|
|
1108
1144
|
* Update KYC preferences for the tenant
|
|
1109
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
|
+
*
|
|
1110
1151
|
* @param update - Fields to update
|
|
1111
1152
|
* @returns Updated preferences
|
|
1112
1153
|
*
|
|
@@ -1265,7 +1306,10 @@ var KYC_DECLINED_DESCRIPTIONS = {
|
|
|
1265
1306
|
KYC_PROVIDER_REJECTED: "Identity verification was rejected by the verification provider",
|
|
1266
1307
|
KYC_DECLINED: "Identity verification was declined"
|
|
1267
1308
|
};
|
|
1309
|
+
function isKycDocumentExpiredCallbackEvent(value) {
|
|
1310
|
+
return typeof value === "object" && value !== null && value.event === "kyc_document_expired";
|
|
1311
|
+
}
|
|
1268
1312
|
|
|
1269
|
-
export { KYC_DECLINED_DESCRIPTIONS, KycClient };
|
|
1313
|
+
export { KYC_DECLINED_DESCRIPTIONS, KycClient, isKycDocumentExpiredCallbackEvent };
|
|
1270
1314
|
//# sourceMappingURL=core.mjs.map
|
|
1271
1315
|
//# sourceMappingURL=core.mjs.map
|