vesant-sdk 1.6.6 → 2.0.0-dev.03b7c82
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-BJ87_Vv5.d.ts +430 -0
- 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-BlCxjbY2.d.mts → client-Bvp-f05-.d.ts} +7 -7
- package/dist/{client-C_A7QLcB.d.ts → client-CIEa7xYG.d.mts} +7 -7
- package/dist/client-IAOGCBfm.d.mts +430 -0
- package/dist/compliance/index.d.mts +25 -429
- package/dist/compliance/index.d.ts +25 -429
- package/dist/compliance/index.js +137 -58
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +137 -59
- 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 +6 -24
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +6 -24
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index.d.mts +14 -71
- package/dist/index.d.ts +14 -71
- package/dist/index.js +244 -247
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +243 -246
- 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 +78 -23
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +78 -24
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +267 -44
- package/dist/kyc/index.d.ts +267 -44
- package/dist/kyc/index.js +78 -23
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +78 -24
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +42 -7
- package/dist/react.d.ts +42 -7
- package/dist/react.js +621 -277
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +621 -277
- 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-X5Md_dD_.d.ts → types-2utj53GK.d.ts} +2 -2
- package/dist/{types-1RzYeSal.d.mts → types-C4Zx0d_u.d.mts} +2 -2
- package/dist/{types-B4Ezqo7V.d.mts → types-QUCWam16.d.mts} +7 -1
- package/dist/{types-B4Ezqo7V.d.ts → types-QUCWam16.d.ts} +7 -1
- package/dist/webhooks/index.d.mts +181 -2
- package/dist/webhooks/index.d.ts +181 -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/core.mjs
CHANGED
|
@@ -214,7 +214,7 @@ function createConsoleLogger() {
|
|
|
214
214
|
}
|
|
215
215
|
|
|
216
216
|
// src/core/version.ts
|
|
217
|
-
var SDK_VERSION = "
|
|
217
|
+
var SDK_VERSION = "2.0.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,84 @@ var KycClient = class extends BaseClient {
|
|
|
628
624
|
});
|
|
629
625
|
}
|
|
630
626
|
/**
|
|
631
|
-
* Create a
|
|
627
|
+
* Create a Re-Use KYC 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
637
|
async createReuseKycSession(request) {
|
|
636
|
-
return this.
|
|
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 Re-Use KYC 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 `createReuseKycSession` 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 `createReuseKycSession`, plus the base64 selfie.
|
|
646
656
|
*/
|
|
647
657
|
async submitReuseKycSession(request) {
|
|
648
|
-
return this.
|
|
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
|
-
*
|
|
665
|
+
* Look up the current state of a Re-Use KYC session by its forward
|
|
666
|
+
* reference. Useful for desktop pollers waiting on the mobile handoff.
|
|
667
|
+
*
|
|
668
|
+
* @param reference - The reference used when the session was created.
|
|
669
|
+
*/
|
|
659
670
|
async getReuseKycSessionStatus(reference) {
|
|
660
671
|
return this.requestWithRetry(`/api/v1/kyc/face/verify/${encodeURIComponent(reference)}`, {
|
|
661
672
|
method: "GET",
|
|
662
673
|
headers: this.getUserHeaders()
|
|
663
674
|
});
|
|
664
675
|
}
|
|
676
|
+
/**
|
|
677
|
+
* Fetch the Redis-backed handoff session for a token. Same backing
|
|
678
|
+
* store as normal KYC (`kyc:session:<token>`, 15-minute TTL). Desktop
|
|
679
|
+
* callers poll `mobile_connected` to detect when a mobile device has
|
|
680
|
+
* scanned the QR and attached.
|
|
681
|
+
*
|
|
682
|
+
* @param token - The session token returned by `createReuseKycSession`.
|
|
683
|
+
*/
|
|
684
|
+
async getHandoffSession(token) {
|
|
685
|
+
return this.request(
|
|
686
|
+
`/api/v1/kyc/session${this.buildQueryString({ token })}`,
|
|
687
|
+
{ headers: this.getUserHeaders() }
|
|
688
|
+
);
|
|
689
|
+
}
|
|
690
|
+
/**
|
|
691
|
+
* Attach a mobile device to a desktop-initiated session. The mobile
|
|
692
|
+
* client calls this after scanning the QR code. The desktop poller
|
|
693
|
+
* sees `mobile_connected: true` on the next `getHandoffSession`.
|
|
694
|
+
*
|
|
695
|
+
* @param token - The session token transferred via the QR payload.
|
|
696
|
+
* @param isDisconnect - Pass true to release the session (default false).
|
|
697
|
+
*/
|
|
698
|
+
async connectMobileSession(token, isDisconnect = false) {
|
|
699
|
+
return this.request("/api/v1/kyc/session/connect", {
|
|
700
|
+
method: "PUT",
|
|
701
|
+
body: JSON.stringify({ token, is_disconnect: isDisconnect }),
|
|
702
|
+
headers: this.getUserHeaders()
|
|
703
|
+
});
|
|
704
|
+
}
|
|
665
705
|
/**
|
|
666
706
|
* Check KYC status for a user
|
|
667
707
|
*
|
|
@@ -1020,8 +1060,9 @@ var KycClient = class extends BaseClient {
|
|
|
1020
1060
|
*/
|
|
1021
1061
|
async riskProfileRequest(path, options = {}) {
|
|
1022
1062
|
if (!this.riskProfileBaseURL) {
|
|
1023
|
-
throw new
|
|
1024
|
-
"Risk Profile Service URL not configured. Please provide riskProfileBaseURL in KycClientConfig."
|
|
1063
|
+
throw new ValidationError(
|
|
1064
|
+
"Risk Profile Service URL not configured. Please provide riskProfileBaseURL in KycClientConfig.",
|
|
1065
|
+
["riskProfileBaseURL"]
|
|
1025
1066
|
);
|
|
1026
1067
|
}
|
|
1027
1068
|
return this.request(path, {
|
|
@@ -1133,6 +1174,19 @@ var KycClient = class extends BaseClient {
|
|
|
1133
1174
|
// ============================================================================
|
|
1134
1175
|
};
|
|
1135
1176
|
|
|
1136
|
-
|
|
1177
|
+
// src/kyc/types.ts
|
|
1178
|
+
var KYC_DECLINED_DESCRIPTIONS = {
|
|
1179
|
+
KYC_DOCUMENT_EXPIRED: "The submitted document has expired",
|
|
1180
|
+
KYC_DOCUMENT_INVALID: "The submitted document could not be verified",
|
|
1181
|
+
KYC_FACE_MISMATCH: "Face verification did not match the identity document",
|
|
1182
|
+
KYC_AGE_REQUIREMENT: "Age requirement not met",
|
|
1183
|
+
KYC_DUPLICATE_IDENTITY: "This identity has already been verified under another account",
|
|
1184
|
+
KYC_ADDRESS_MISMATCH: "Address verification failed",
|
|
1185
|
+
KYC_NAME_MISMATCH: "Name on document does not match the registered name",
|
|
1186
|
+
KYC_PROVIDER_REJECTED: "Identity verification was rejected by the verification provider",
|
|
1187
|
+
KYC_DECLINED: "Identity verification was declined"
|
|
1188
|
+
};
|
|
1189
|
+
|
|
1190
|
+
export { KYC_DECLINED_DESCRIPTIONS, KycClient };
|
|
1137
1191
|
//# sourceMappingURL=core.mjs.map
|
|
1138
1192
|
//# sourceMappingURL=core.mjs.map
|