vesant-sdk 1.6.6 → 1.7.0-dev.254dc8c
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 +14 -4
- package/dist/{client-ePzhQKp9.d.mts → client-BolQlL5e.d.mts} +1 -1
- package/dist/{client-ePzhQKp9.d.ts → client-BolQlL5e.d.ts} +1 -1
- package/dist/client-C3DCmGe9.d.ts +436 -0
- package/dist/{client-C_A7QLcB.d.ts → client-DMIRx7Tu.d.mts} +5 -3
- package/dist/{client-BlCxjbY2.d.mts → client-DoMSYMMR.d.ts} +5 -3
- package/dist/client-ZNdnpWe7.d.mts +436 -0
- package/dist/compliance/index.d.mts +25 -429
- package/dist/compliance/index.d.ts +25 -429
- package/dist/compliance/index.js +187 -103
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +187 -104
- package/dist/compliance/index.mjs.map +1 -1
- package/dist/decisions/index.d.mts +2 -2
- package/dist/decisions/index.d.ts +2 -2
- package/dist/decisions/index.js +1 -1
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisions/index.mjs +1 -1
- package/dist/decisions/index.mjs.map +1 -1
- package/dist/geolocation/index.d.mts +4 -4
- package/dist/geolocation/index.d.ts +4 -4
- package/dist/geolocation/index.js +7 -24
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +7 -24
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index.d.mts +12 -70
- package/dist/index.d.ts +12 -70
- package/dist/index.js +302 -296
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +301 -295
- package/dist/index.mjs.map +1 -1
- package/dist/kyc/core.d.mts +4 -4
- package/dist/kyc/core.d.ts +4 -4
- package/dist/kyc/core.js +86 -27
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +86 -28
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +280 -50
- package/dist/kyc/index.d.ts +280 -50
- package/dist/kyc/index.js +86 -27
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +86 -28
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +46 -9
- package/dist/react.d.ts +46 -9
- package/dist/react.js +891 -276
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +890 -275
- package/dist/react.mjs.map +1 -1
- package/dist/risk-profile/index.d.mts +4 -4
- package/dist/risk-profile/index.d.ts +4 -4
- package/dist/risk-profile/index.js +1 -1
- package/dist/risk-profile/index.js.map +1 -1
- package/dist/risk-profile/index.mjs +1 -1
- package/dist/risk-profile/index.mjs.map +1 -1
- package/dist/scores/index.d.mts +2 -2
- package/dist/scores/index.d.ts +2 -2
- package/dist/scores/index.js +1 -1
- package/dist/scores/index.js.map +1 -1
- package/dist/scores/index.mjs +1 -1
- package/dist/scores/index.mjs.map +1 -1
- package/dist/tax/index.d.mts +6 -41
- package/dist/tax/index.d.ts +6 -41
- package/dist/tax/index.js +1 -36
- package/dist/tax/index.js.map +1 -1
- package/dist/tax/index.mjs +1 -36
- package/dist/tax/index.mjs.map +1 -1
- package/dist/{types-1RzYeSal.d.mts → types-BOFaMQxI.d.mts} +2 -2
- package/dist/{types-B4Ezqo7V.d.mts → types-CBQRNL-l.d.mts} +14 -1
- package/dist/{types-B4Ezqo7V.d.ts → types-CBQRNL-l.d.ts} +14 -1
- package/dist/{types-X5Md_dD_.d.ts → types-UGyDl1fd.d.ts} +2 -2
- package/dist/webhooks/index.d.mts +189 -2
- package/dist/webhooks/index.d.ts +189 -2
- package/dist/webhooks/index.js +49 -7
- package/dist/webhooks/index.js.map +1 -1
- package/dist/webhooks/index.mjs +49 -7
- package/dist/webhooks/index.mjs.map +1 -1
- package/package.json +16 -13
- package/dist/fraud/index.d.mts +0 -80
- package/dist/fraud/index.d.ts +0 -80
- package/dist/fraud/index.js +0 -606
- package/dist/fraud/index.js.map +0 -1
- package/dist/fraud/index.mjs +0 -604
- package/dist/fraud/index.mjs.map +0 -1
- package/dist/index-B04H4xfJ.d.mts +0 -320
- package/dist/index-CItMPmLL.d.ts +0 -320
package/dist/kyc/index.mjs
CHANGED
|
@@ -214,7 +214,7 @@ function createConsoleLogger() {
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
// src/core/version.ts
|
|
217
|
-
var SDK_VERSION = "1.
|
|
217
|
+
var SDK_VERSION = "1.7.0";
|
|
218
218
|
|
|
219
219
|
// src/shared/browser-utils.ts
|
|
220
220
|
function generateUUID() {
|
|
@@ -601,23 +601,19 @@ var KycClient = class extends BaseClient {
|
|
|
601
601
|
*
|
|
602
602
|
* Generates a link that the user can visit to submit their KYC documents.
|
|
603
603
|
*
|
|
604
|
-
* @param request - Request containing the user ID, redirect URL, callback URL
|
|
605
|
-
* @returns Response containing
|
|
604
|
+
* @param request - Request containing the user ID, optional redirect URL, and optional callback URL (receives POST requests)
|
|
605
|
+
* @returns Response containing the redirect link and KYC ID
|
|
606
606
|
*
|
|
607
607
|
* @example
|
|
608
608
|
* ```typescript
|
|
609
609
|
* const result = await client.requestKycSubmitLink({
|
|
610
610
|
* user_id: "user_123",
|
|
611
|
-
* redirect_url: "https://merchant.com/kyc-complete",
|
|
612
|
-
* callback_url: "https://merchant.com/api/kyc-webhook"
|
|
613
|
-
* trigger_event: "onboarding"
|
|
611
|
+
* redirect_url: "https://merchant.com/kyc-complete", // optional
|
|
612
|
+
* callback_url: "https://merchant.com/api/kyc-webhook" // optional - receives POST requests on status change
|
|
614
613
|
* });
|
|
615
614
|
*
|
|
616
|
-
*
|
|
617
|
-
*
|
|
618
|
-
* } else if (result.can_skip) {
|
|
619
|
-
* console.log("KYC not required, user can proceed");
|
|
620
|
-
* }
|
|
615
|
+
* console.log(`Redirect user to: ${result.link}`);
|
|
616
|
+
* console.log(`KYC ID: ${result.kyc_id}`);
|
|
621
617
|
* ```
|
|
622
618
|
*/
|
|
623
619
|
async requestKycSubmitLink(request) {
|
|
@@ -628,40 +624,88 @@ var KycClient = class extends BaseClient {
|
|
|
628
624
|
});
|
|
629
625
|
}
|
|
630
626
|
/**
|
|
631
|
-
* Create a
|
|
627
|
+
* Create a Event-Based Face Verification session.
|
|
628
|
+
*
|
|
629
|
+
* Inspect the response before showing UI:
|
|
630
|
+
* - `is_required === false` → skip face capture; `reason` explains why.
|
|
631
|
+
* - `device_type === 'desktop'` → render `qr_payload` as a QR; the
|
|
632
|
+
* mobile device picks up the session via the connect endpoint.
|
|
633
|
+
* - `device_type === 'mobile'` → open the face capture modal directly.
|
|
632
634
|
*
|
|
633
|
-
* @param request -
|
|
635
|
+
* @param request - Reference, customer_id, event, amount (for threshold events), optional URLs.
|
|
634
636
|
*/
|
|
635
|
-
async
|
|
636
|
-
return this.
|
|
637
|
+
async createEventBasedFaceVerificationSession(request) {
|
|
638
|
+
return this.request("/api/v1/kyc/face/session", {
|
|
637
639
|
method: "POST",
|
|
638
640
|
body: JSON.stringify(request),
|
|
639
641
|
headers: this.getUserHeaders()
|
|
640
642
|
});
|
|
641
643
|
}
|
|
642
644
|
/**
|
|
643
|
-
* Submit a
|
|
645
|
+
* Submit a real-time face capture for an active Event-Based Face Verification session.
|
|
646
|
+
*
|
|
647
|
+
* **Mobile-only.** The server rejects desktop User-Agents with HTTP
|
|
648
|
+
* 400 (`face capture must be completed on a mobile device`). Use the
|
|
649
|
+
* QR handoff from `createEventBasedFaceVerificationSession` for desktop callers.
|
|
644
650
|
*
|
|
645
|
-
*
|
|
651
|
+
* The `data` field on the response carries `retries_remaining`,
|
|
652
|
+
* `retry_limit_exceeded`, and the reaction flags (`enforce_logout`,
|
|
653
|
+
* `freeze_account`, etc.) so the tenant app can act on a final failure.
|
|
654
|
+
*
|
|
655
|
+
* @param request - Token from `createEventBasedFaceVerificationSession`, plus the base64 selfie.
|
|
646
656
|
*/
|
|
647
|
-
async
|
|
648
|
-
return this.
|
|
657
|
+
async submitEventBasedFaceVerificationSession(request) {
|
|
658
|
+
return this.request("/api/v1/kyc/face/submit", {
|
|
649
659
|
method: "POST",
|
|
650
660
|
body: JSON.stringify(request),
|
|
651
661
|
headers: this.getUserHeaders()
|
|
652
662
|
});
|
|
653
663
|
}
|
|
654
664
|
/**
|
|
655
|
-
*
|
|
656
|
-
*
|
|
657
|
-
*
|
|
658
|
-
*
|
|
659
|
-
|
|
660
|
-
|
|
665
|
+
* Look up the current state of a Event-Based Face Verification session by its
|
|
666
|
+
* session token. Useful for desktop pollers waiting on the mobile handoff.
|
|
667
|
+
*
|
|
668
|
+
* The lookup is scoped by the unguessable, server-issued session token (not
|
|
669
|
+
* the enumerable forward reference): the endpoint is public/unauthenticated,
|
|
670
|
+
* and scoping by the token is what prevents cross-tenant status reads.
|
|
671
|
+
*
|
|
672
|
+
* @param token - The session token returned by `createEventBasedFaceVerificationSession`.
|
|
673
|
+
*/
|
|
674
|
+
async getEventBasedFaceVerificationSessionStatus(token) {
|
|
675
|
+
return this.requestWithRetry(`/api/v1/kyc/face/verify/${encodeURIComponent(token)}`, {
|
|
661
676
|
method: "GET",
|
|
662
677
|
headers: this.getUserHeaders()
|
|
663
678
|
});
|
|
664
679
|
}
|
|
680
|
+
/**
|
|
681
|
+
* Fetch the Redis-backed handoff session for a token. Same backing
|
|
682
|
+
* store as normal KYC (`kyc:session:<token>`, 15-minute TTL). Desktop
|
|
683
|
+
* callers poll `mobile_connected` to detect when a mobile device has
|
|
684
|
+
* scanned the QR and attached.
|
|
685
|
+
*
|
|
686
|
+
* @param token - The session token returned by `createEventBasedFaceVerificationSession`.
|
|
687
|
+
*/
|
|
688
|
+
async getHandoffSession(token) {
|
|
689
|
+
return this.request(
|
|
690
|
+
`/api/v1/kyc/session${this.buildQueryString({ token })}`,
|
|
691
|
+
{ headers: this.getUserHeaders() }
|
|
692
|
+
);
|
|
693
|
+
}
|
|
694
|
+
/**
|
|
695
|
+
* Attach a mobile device to a desktop-initiated session. The mobile
|
|
696
|
+
* client calls this after scanning the QR code. The desktop poller
|
|
697
|
+
* sees `mobile_connected: true` on the next `getHandoffSession`.
|
|
698
|
+
*
|
|
699
|
+
* @param token - The session token transferred via the QR payload.
|
|
700
|
+
* @param isDisconnect - Pass true to release the session (default false).
|
|
701
|
+
*/
|
|
702
|
+
async connectMobileSession(token, isDisconnect = false) {
|
|
703
|
+
return this.request("/api/v1/kyc/session/connect", {
|
|
704
|
+
method: "PUT",
|
|
705
|
+
body: JSON.stringify({ token, is_disconnect: isDisconnect }),
|
|
706
|
+
headers: this.getUserHeaders()
|
|
707
|
+
});
|
|
708
|
+
}
|
|
665
709
|
/**
|
|
666
710
|
* Check KYC status for a user
|
|
667
711
|
*
|
|
@@ -1020,8 +1064,9 @@ var KycClient = class extends BaseClient {
|
|
|
1020
1064
|
*/
|
|
1021
1065
|
async riskProfileRequest(path, options = {}) {
|
|
1022
1066
|
if (!this.riskProfileBaseURL) {
|
|
1023
|
-
throw new
|
|
1024
|
-
"Risk Profile Service URL not configured. Please provide riskProfileBaseURL in KycClientConfig."
|
|
1067
|
+
throw new ValidationError(
|
|
1068
|
+
"Risk Profile Service URL not configured. Please provide riskProfileBaseURL in KycClientConfig.",
|
|
1069
|
+
["riskProfileBaseURL"]
|
|
1025
1070
|
);
|
|
1026
1071
|
}
|
|
1027
1072
|
return this.request(path, {
|
|
@@ -1133,6 +1178,19 @@ var KycClient = class extends BaseClient {
|
|
|
1133
1178
|
// ============================================================================
|
|
1134
1179
|
};
|
|
1135
1180
|
|
|
1136
|
-
|
|
1181
|
+
// src/kyc/types.ts
|
|
1182
|
+
var KYC_DECLINED_DESCRIPTIONS = {
|
|
1183
|
+
KYC_DOCUMENT_EXPIRED: "The submitted document has expired",
|
|
1184
|
+
KYC_DOCUMENT_INVALID: "The submitted document could not be verified",
|
|
1185
|
+
KYC_FACE_MISMATCH: "Face verification did not match the identity document",
|
|
1186
|
+
KYC_AGE_REQUIREMENT: "Age requirement not met",
|
|
1187
|
+
KYC_DUPLICATE_IDENTITY: "This identity has already been verified under another account",
|
|
1188
|
+
KYC_ADDRESS_MISMATCH: "Address verification failed",
|
|
1189
|
+
KYC_NAME_MISMATCH: "Name on document does not match the registered name",
|
|
1190
|
+
KYC_PROVIDER_REJECTED: "Identity verification was rejected by the verification provider",
|
|
1191
|
+
KYC_DECLINED: "Identity verification was declined"
|
|
1192
|
+
};
|
|
1193
|
+
|
|
1194
|
+
export { KYC_DECLINED_DESCRIPTIONS, KycClient };
|
|
1137
1195
|
//# sourceMappingURL=index.mjs.map
|
|
1138
1196
|
//# sourceMappingURL=index.mjs.map
|