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/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
|
-
*
|
|
674
|
-
*
|
|
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.
|
|
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,
|
|
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
|
|
708
|
-
* - `
|
|
709
|
-
*
|
|
710
|
-
* - `device_type === 'mobile'` → open the face capture modal directly.
|
|
716
|
+
* - `is_required === false` → skip face verification; `reason` explains why.
|
|
717
|
+
* - `verification_url` present → embed 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
|
-
*
|
|
725
|
-
*
|
|
726
|
-
*
|
|
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).
|
|
760
|
-
*
|
|
761
|
-
*
|
|
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
|
-
* - "
|
|
791
|
-
* - "
|
|
792
|
-
* - "
|
|
793
|
-
* -
|
|
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
|
|
796
|
-
* @returns Response with
|
|
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
|
-
*
|
|
829
|
+
* kyc_id: "550e8400-e29b-41d4-a716-446655440000"
|
|
803
830
|
* });
|
|
804
831
|
*
|
|
805
|
-
* if (result.
|
|
806
|
-
* //
|
|
807
|
-
* } else if (result.
|
|
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
|
-
*
|
|
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.
|
|
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,
|
|
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: "
|
|
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: "
|
|
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
|