vesant-sdk 1.8.0-dev.32e3a40 → 1.8.0-dev.394d6eb
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 +0 -2
- package/dist/{client-4oLoc31v.d.ts → client-BPALLldd.d.ts} +1 -1
- package/dist/{client-CJI8VO1i.d.mts → client-_OhkfnyJ.d.mts} +1 -1
- package/dist/compliance/index.d.mts +2 -2
- package/dist/compliance/index.d.ts +2 -2
- package/dist/compliance/index.js +7 -6
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +7 -6
- package/dist/compliance/index.mjs.map +1 -1
- package/dist/decisions/index.js +7 -6
- package/dist/decisions/index.js.map +1 -1
- package/dist/decisions/index.mjs +7 -6
- package/dist/decisions/index.mjs.map +1 -1
- package/dist/geolocation/index.js +7 -6
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +7 -6
- 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 +12 -179
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +12 -180
- package/dist/index.mjs.map +1 -1
- package/dist/kyc/core.d.mts +2 -2
- package/dist/kyc/core.d.ts +2 -2
- package/dist/kyc/core.js +12 -179
- package/dist/kyc/core.js.map +1 -1
- package/dist/kyc/core.mjs +12 -180
- package/dist/kyc/core.mjs.map +1 -1
- package/dist/kyc/index.d.mts +69 -228
- package/dist/kyc/index.d.ts +69 -228
- package/dist/kyc/index.js +12 -179
- package/dist/kyc/index.js.map +1 -1
- package/dist/kyc/index.mjs +12 -180
- package/dist/kyc/index.mjs.map +1 -1
- package/dist/react.d.mts +6 -122
- package/dist/react.d.ts +6 -122
- package/dist/react.js +0 -185
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +1 -183
- package/dist/react.mjs.map +1 -1
- package/dist/risk-profile/index.d.mts +2 -2
- package/dist/risk-profile/index.d.ts +2 -2
- package/dist/risk-profile/index.js +7 -6
- package/dist/risk-profile/index.js.map +1 -1
- package/dist/risk-profile/index.mjs +7 -6
- package/dist/risk-profile/index.mjs.map +1 -1
- package/dist/scores/index.js +7 -6
- package/dist/scores/index.js.map +1 -1
- package/dist/scores/index.mjs +7 -6
- package/dist/scores/index.mjs.map +1 -1
- package/dist/tax/index.js +7 -6
- package/dist/tax/index.js.map +1 -1
- package/dist/tax/index.mjs +7 -6
- package/dist/tax/index.mjs.map +1 -1
- package/dist/{types-DfbnIaW_.d.mts → types-DbvVph_0.d.mts} +1 -1
- package/dist/{types-1kI4SsKB.d.ts → types-qXamJr2q.d.ts} +1 -1
- package/package.json +1 -1
package/dist/kyc/index.mjs
CHANGED
|
@@ -505,19 +505,20 @@ var BaseClient = class {
|
|
|
505
505
|
* Handle error responses from API
|
|
506
506
|
*/
|
|
507
507
|
handleErrorResponse(status, data, requestId) {
|
|
508
|
-
const
|
|
508
|
+
const structured = data.error && typeof data.error === "object" && !Array.isArray(data.error) ? data.error : void 0;
|
|
509
|
+
const message = typeof data.error === "string" && data.error || typeof structured?.message === "string" && structured.message || typeof data.message === "string" && data.message || `HTTP ${status}`;
|
|
509
510
|
const createError = () => {
|
|
510
511
|
switch (status) {
|
|
511
512
|
case 400:
|
|
512
|
-
return new VesantError(message, "BAD_REQUEST", 400);
|
|
513
|
+
return new VesantError(message, "BAD_REQUEST", 400, structured);
|
|
513
514
|
case 401:
|
|
514
515
|
return new AuthenticationError(message);
|
|
515
516
|
case 403:
|
|
516
|
-
return new VesantError(message, "FORBIDDEN", 403);
|
|
517
|
+
return new VesantError(message, "FORBIDDEN", 403, structured);
|
|
517
518
|
case 404:
|
|
518
|
-
return new VesantError(message, "NOT_FOUND", 404);
|
|
519
|
+
return new VesantError(message, "NOT_FOUND", 404, structured);
|
|
519
520
|
case 409:
|
|
520
|
-
return new VesantError(message, "DUPLICATE_PROFILE", 409);
|
|
521
|
+
return new VesantError(message, "DUPLICATE_PROFILE", 409, structured);
|
|
521
522
|
case 429: {
|
|
522
523
|
const retryAfter = data.retry_after || data.retryAfter;
|
|
523
524
|
return new RateLimitError(retryAfter);
|
|
@@ -528,7 +529,7 @@ var BaseClient = class {
|
|
|
528
529
|
case 504:
|
|
529
530
|
return new ServiceUnavailableError(message);
|
|
530
531
|
default:
|
|
531
|
-
return new VesantError(message, "UNKNOWN_ERROR", status);
|
|
532
|
+
return new VesantError(message, "UNKNOWN_ERROR", status, structured);
|
|
532
533
|
}
|
|
533
534
|
};
|
|
534
535
|
const error = createError();
|
|
@@ -911,74 +912,6 @@ var KycClient = class extends BaseClient {
|
|
|
911
912
|
headers: this.getUserHeaders()
|
|
912
913
|
});
|
|
913
914
|
}
|
|
914
|
-
/**
|
|
915
|
-
* List KYC requests with filters and pagination
|
|
916
|
-
*
|
|
917
|
-
* @param filters - Optional filters (status, search, date range)
|
|
918
|
-
* @param pagination - Optional pagination (page, page_size)
|
|
919
|
-
* @returns Paginated list of KYC requests
|
|
920
|
-
*
|
|
921
|
-
* @example
|
|
922
|
-
* ```typescript
|
|
923
|
-
* const requests = await client.listKycRequests(
|
|
924
|
-
* { status: "pending", search: "john" },
|
|
925
|
-
* { page: 1, page_size: 20 }
|
|
926
|
-
* );
|
|
927
|
-
* console.log(`Found ${requests.total} pending requests`);
|
|
928
|
-
* ```
|
|
929
|
-
*
|
|
930
|
-
* @remarks Console session only. This endpoint accepts a Vesant console
|
|
931
|
-
* (dashboard login) token, not a tenant API key; called with an API key it
|
|
932
|
-
* fails with `AuthenticationError` or a permission error.
|
|
933
|
-
*/
|
|
934
|
-
async listKycRequests(filters, pagination) {
|
|
935
|
-
const params = {};
|
|
936
|
-
if (filters) {
|
|
937
|
-
addFilterParam(params, "status", filters.status);
|
|
938
|
-
addSimpleParams(params, filters, ["search", "fromDate", "toDate", "sortBy", "order"]);
|
|
939
|
-
}
|
|
940
|
-
if (pagination) {
|
|
941
|
-
if (pagination.page) params.page = pagination.page;
|
|
942
|
-
if (pagination.page_size) params.limit = pagination.page_size;
|
|
943
|
-
}
|
|
944
|
-
return this.request(
|
|
945
|
-
`/api/v1/kyc/requests${this.buildQueryString(params)}`,
|
|
946
|
-
{ headers: this.getUserHeaders() }
|
|
947
|
-
);
|
|
948
|
-
}
|
|
949
|
-
/**
|
|
950
|
-
* Update KYC request status (accept/decline)
|
|
951
|
-
*
|
|
952
|
-
* @param request - Status update request with reference, status, and reason
|
|
953
|
-
*
|
|
954
|
-
* @example
|
|
955
|
-
* ```typescript
|
|
956
|
-
* // Accept a KYC request
|
|
957
|
-
* await client.updateKycStatus({
|
|
958
|
-
* reference: "kyc-ref-123",
|
|
959
|
-
* status: "accepted",
|
|
960
|
-
* reason: "All documents verified successfully"
|
|
961
|
-
* });
|
|
962
|
-
*
|
|
963
|
-
* // Decline a KYC request
|
|
964
|
-
* await client.updateKycStatus({
|
|
965
|
-
* reference: "kyc-ref-456",
|
|
966
|
-
* status: "declined",
|
|
967
|
-
* reason: "Document expired"
|
|
968
|
-
* });
|
|
969
|
-
* ```
|
|
970
|
-
*
|
|
971
|
-
* @remarks Console session only. This endpoint accepts a Vesant console
|
|
972
|
-
* (dashboard login) token, not a tenant API key; called with an API key it
|
|
973
|
-
* fails with `AuthenticationError` or a permission error.
|
|
974
|
-
*/
|
|
975
|
-
async updateKycStatus(request) {
|
|
976
|
-
await this.request("/api/v1/kyc/status", {
|
|
977
|
-
method: "PUT",
|
|
978
|
-
body: JSON.stringify(request),
|
|
979
|
-
headers: this.getUserHeaders()
|
|
980
|
-
});
|
|
981
|
-
}
|
|
982
915
|
/**
|
|
983
916
|
* Request additional documents from customer
|
|
984
917
|
*
|
|
@@ -1027,53 +960,8 @@ var KycClient = class extends BaseClient {
|
|
|
1027
960
|
return (kyc.proofs ?? []).filter((proof) => typeof proof.link === "string" && proof.link !== "").map((proof) => ({ id: proof.id, type: proof.type, url: proof.link }));
|
|
1028
961
|
}
|
|
1029
962
|
// ============================================================================
|
|
1030
|
-
// KYC Overview & Statistics
|
|
1031
|
-
// ============================================================================
|
|
1032
|
-
/**
|
|
1033
|
-
* Get KYC overview statistics
|
|
1034
|
-
*
|
|
1035
|
-
* @param fromDate - Optional start date (ISO 8601)
|
|
1036
|
-
* @param toDate - Optional end date (ISO 8601)
|
|
1037
|
-
* @returns KYC statistics including counts by status
|
|
1038
|
-
*
|
|
1039
|
-
* @example
|
|
1040
|
-
* ```typescript
|
|
1041
|
-
* const overview = await client.getOverview(
|
|
1042
|
-
* "2024-01-01T00:00:00Z",
|
|
1043
|
-
* "2024-12-31T23:59:59Z"
|
|
1044
|
-
* );
|
|
1045
|
-
* console.log(`Total: ${overview.total}, Pending: ${overview.pending}`);
|
|
1046
|
-
* console.log(`Approved: ${overview.approved}, Rejected: ${overview.rejected}`);
|
|
1047
|
-
* ```
|
|
1048
|
-
*
|
|
1049
|
-
* @remarks Console session only. This endpoint accepts a Vesant console
|
|
1050
|
-
* (dashboard login) token, not a tenant API key; called with an API key it
|
|
1051
|
-
* fails with `AuthenticationError` or a permission error.
|
|
1052
|
-
*/
|
|
1053
|
-
async getOverview(fromDate, toDate) {
|
|
1054
|
-
const params = {};
|
|
1055
|
-
if (fromDate) params.fromDate = fromDate;
|
|
1056
|
-
if (toDate) params.toDate = toDate;
|
|
1057
|
-
return this.request(
|
|
1058
|
-
`/api/v1/kyc/overview${this.buildQueryString(params)}`
|
|
1059
|
-
);
|
|
1060
|
-
}
|
|
1061
|
-
// ============================================================================
|
|
1062
963
|
// Alert Management
|
|
1063
964
|
// ============================================================================
|
|
1064
|
-
/**
|
|
1065
|
-
* Get a KYC alert by ID
|
|
1066
|
-
*
|
|
1067
|
-
* @param alertId - Alert ID
|
|
1068
|
-
* @returns Alert details
|
|
1069
|
-
*
|
|
1070
|
-
* @remarks Console session only. This endpoint accepts a Vesant console
|
|
1071
|
-
* (dashboard login) token, not a tenant API key; called with an API key it
|
|
1072
|
-
* fails with `AuthenticationError` or a permission error.
|
|
1073
|
-
*/
|
|
1074
|
-
async getAlert(alertId) {
|
|
1075
|
-
return this.request(`/api/v1/kyc/alerts/${alertId}`);
|
|
1076
|
-
}
|
|
1077
965
|
/**
|
|
1078
966
|
* List KYC alerts with filters and pagination
|
|
1079
967
|
*
|
|
@@ -1116,74 +1004,15 @@ var KycClient = class extends BaseClient {
|
|
|
1116
1004
|
`/api/v1/kyc/alerts${this.buildQueryString(params)}`
|
|
1117
1005
|
);
|
|
1118
1006
|
}
|
|
1119
|
-
/**
|
|
1120
|
-
* Update a KYC alert
|
|
1121
|
-
*
|
|
1122
|
-
* @param alertId - Alert ID
|
|
1123
|
-
* @param update - Fields to update (status, assigned_for, reason, alert_type)
|
|
1124
|
-
*
|
|
1125
|
-
* @example
|
|
1126
|
-
* ```typescript
|
|
1127
|
-
* // Assign an alert
|
|
1128
|
-
* await client.updateAlert("alert_123", {
|
|
1129
|
-
* assigned_for: "analyst_user_id",
|
|
1130
|
-
* status: "in_progress"
|
|
1131
|
-
* });
|
|
1132
|
-
*
|
|
1133
|
-
* // Resolve an alert
|
|
1134
|
-
* await client.updateAlert("alert_123", {
|
|
1135
|
-
* status: "resolved",
|
|
1136
|
-
* reason: "Customer verified via phone call"
|
|
1137
|
-
* });
|
|
1138
|
-
*
|
|
1139
|
-
* // Escalate an alert
|
|
1140
|
-
* await client.updateAlert("alert_123", {
|
|
1141
|
-
* status: "escalated",
|
|
1142
|
-
* assigned_for: "manager_user_id",
|
|
1143
|
-
* reason: "Requires senior review - suspicious documents"
|
|
1144
|
-
* });
|
|
1145
|
-
* ```
|
|
1146
|
-
*
|
|
1147
|
-
* @remarks Console session only. This endpoint accepts a Vesant console
|
|
1148
|
-
* (dashboard login) token, not a tenant API key; called with an API key it
|
|
1149
|
-
* fails with `AuthenticationError` or a permission error.
|
|
1150
|
-
*/
|
|
1151
|
-
async updateAlert(alertId, update) {
|
|
1152
|
-
await this.request(`/api/v1/kyc/alerts/${alertId}`, {
|
|
1153
|
-
method: "PUT",
|
|
1154
|
-
body: JSON.stringify(update),
|
|
1155
|
-
headers: this.getUserHeaders()
|
|
1156
|
-
});
|
|
1157
|
-
}
|
|
1158
1007
|
// ============================================================================
|
|
1159
1008
|
// KYC Preferences
|
|
1160
1009
|
// ============================================================================
|
|
1161
|
-
/**
|
|
1162
|
-
* Get KYC preferences for the tenant
|
|
1163
|
-
*
|
|
1164
|
-
* @returns KYC preferences configuration
|
|
1165
|
-
*
|
|
1166
|
-
* @example
|
|
1167
|
-
* ```typescript
|
|
1168
|
-
* const prefs = await client.getPreferences();
|
|
1169
|
-
* console.log(`Face verification required: ${prefs.is_face_verification_required}`);
|
|
1170
|
-
* console.log(`Required documents: ${prefs.required_document_count}`);
|
|
1171
|
-
* ```
|
|
1172
|
-
*
|
|
1173
|
-
* @remarks Console session only. This endpoint accepts a Vesant console
|
|
1174
|
-
* (dashboard login) token, not a tenant API key; called with an API key it
|
|
1175
|
-
* fails with `AuthenticationError` or a permission error.
|
|
1176
|
-
*/
|
|
1177
|
-
async getPreferences() {
|
|
1178
|
-
return this.request("/api/v1/kyc/preferences");
|
|
1179
|
-
}
|
|
1180
1010
|
/**
|
|
1181
1011
|
* Update KYC preferences for the tenant
|
|
1182
1012
|
*
|
|
1183
1013
|
* @deprecated KYC preferences are managed in the Vesant console; the
|
|
1184
1014
|
* platform exposes no update operation to the SDK, so this call always
|
|
1185
|
-
* fails.
|
|
1186
|
-
* in a future release.
|
|
1015
|
+
* fails. This method will be removed in a future release.
|
|
1187
1016
|
*
|
|
1188
1017
|
* @param update - Fields to update
|
|
1189
1018
|
* @returns Updated preferences
|
|
@@ -1346,10 +1175,13 @@ var KYC_DECLINED_DESCRIPTIONS = {
|
|
|
1346
1175
|
function isKycDocumentExpiredCallbackEvent(value) {
|
|
1347
1176
|
return typeof value === "object" && value !== null && value.event === "kyc_document_expired";
|
|
1348
1177
|
}
|
|
1178
|
+
function isKycStatusCallbackEvent(value) {
|
|
1179
|
+
return typeof value === "object" && value !== null && value.event === "kyc";
|
|
1180
|
+
}
|
|
1349
1181
|
function isProfileChangeCallbackEvent(value) {
|
|
1350
1182
|
return typeof value === "object" && value !== null && value.event === "profile_change";
|
|
1351
1183
|
}
|
|
1352
1184
|
|
|
1353
|
-
export { KYC_DECLINED_DESCRIPTIONS, KycClient, isKycDocumentExpiredCallbackEvent, isProfileChangeCallbackEvent };
|
|
1185
|
+
export { KYC_DECLINED_DESCRIPTIONS, KycClient, isKycDocumentExpiredCallbackEvent, isKycStatusCallbackEvent, isProfileChangeCallbackEvent };
|
|
1354
1186
|
//# sourceMappingURL=index.mjs.map
|
|
1355
1187
|
//# sourceMappingURL=index.mjs.map
|