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.
Files changed (58) hide show
  1. package/README.md +0 -2
  2. package/dist/{client-4oLoc31v.d.ts → client-BPALLldd.d.ts} +1 -1
  3. package/dist/{client-CJI8VO1i.d.mts → client-_OhkfnyJ.d.mts} +1 -1
  4. package/dist/compliance/index.d.mts +2 -2
  5. package/dist/compliance/index.d.ts +2 -2
  6. package/dist/compliance/index.js +7 -6
  7. package/dist/compliance/index.js.map +1 -1
  8. package/dist/compliance/index.mjs +7 -6
  9. package/dist/compliance/index.mjs.map +1 -1
  10. package/dist/decisions/index.js +7 -6
  11. package/dist/decisions/index.js.map +1 -1
  12. package/dist/decisions/index.mjs +7 -6
  13. package/dist/decisions/index.mjs.map +1 -1
  14. package/dist/geolocation/index.js +7 -6
  15. package/dist/geolocation/index.js.map +1 -1
  16. package/dist/geolocation/index.mjs +7 -6
  17. package/dist/geolocation/index.mjs.map +1 -1
  18. package/dist/index.d.mts +3 -3
  19. package/dist/index.d.ts +3 -3
  20. package/dist/index.js +12 -179
  21. package/dist/index.js.map +1 -1
  22. package/dist/index.mjs +12 -180
  23. package/dist/index.mjs.map +1 -1
  24. package/dist/kyc/core.d.mts +2 -2
  25. package/dist/kyc/core.d.ts +2 -2
  26. package/dist/kyc/core.js +12 -179
  27. package/dist/kyc/core.js.map +1 -1
  28. package/dist/kyc/core.mjs +12 -180
  29. package/dist/kyc/core.mjs.map +1 -1
  30. package/dist/kyc/index.d.mts +69 -228
  31. package/dist/kyc/index.d.ts +69 -228
  32. package/dist/kyc/index.js +12 -179
  33. package/dist/kyc/index.js.map +1 -1
  34. package/dist/kyc/index.mjs +12 -180
  35. package/dist/kyc/index.mjs.map +1 -1
  36. package/dist/react.d.mts +6 -122
  37. package/dist/react.d.ts +6 -122
  38. package/dist/react.js +0 -185
  39. package/dist/react.js.map +1 -1
  40. package/dist/react.mjs +1 -183
  41. package/dist/react.mjs.map +1 -1
  42. package/dist/risk-profile/index.d.mts +2 -2
  43. package/dist/risk-profile/index.d.ts +2 -2
  44. package/dist/risk-profile/index.js +7 -6
  45. package/dist/risk-profile/index.js.map +1 -1
  46. package/dist/risk-profile/index.mjs +7 -6
  47. package/dist/risk-profile/index.mjs.map +1 -1
  48. package/dist/scores/index.js +7 -6
  49. package/dist/scores/index.js.map +1 -1
  50. package/dist/scores/index.mjs +7 -6
  51. package/dist/scores/index.mjs.map +1 -1
  52. package/dist/tax/index.js +7 -6
  53. package/dist/tax/index.js.map +1 -1
  54. package/dist/tax/index.mjs +7 -6
  55. package/dist/tax/index.mjs.map +1 -1
  56. package/dist/{types-DfbnIaW_.d.mts → types-DbvVph_0.d.mts} +1 -1
  57. package/dist/{types-1kI4SsKB.d.ts → types-qXamJr2q.d.ts} +1 -1
  58. package/package.json +1 -1
@@ -1,4 +1,4 @@
1
- export { AccountSensitiveActionTrigger, CheckKycStatusRequest, CheckKycStatusResponse, CreateEventBasedFaceVerificationSessionRequest, CreateEventBasedFaceVerificationSessionResponse, DocumentType, DocumentVerificationRequest, DocumentVerificationResponse, EventBasedFaceVerificationCallback, EventBasedFaceVerificationDeviceType, EventBasedFaceVerificationEvent, EventBasedFaceVerificationFrequencyTrigger, EventBasedFaceVerificationReactionResult, EventBasedFaceVerificationReactions, EventBasedFaceVerificationThresholdTrigger, EventBasedFaceVerificationTriggers, FaceProof, KYC_DECLINED_DESCRIPTIONS, KycAlert, KycAlertFilters, KycAlertListResponse, KycAlertStatus, KycAlertType, KycCallbackReactions, KycClient, KycClientConfig, KycCustomerData, KycCustomerProfile, KycDeclinedCode, KycDisclosureConsent, KycDocumentExpiredCallbackEvent, KycHandoffSession, KycOtherReason, KycOverview, KycPagination, KycPreferences, KycRequest, KycRequestFilters, KycRequestListResponse, KycRequestReason, KycRequestReasonCode, KycSkipOptions, KycStatus, KycTriggerEvent, KycVerificationTriggers, Name, ProfileChangeCallbackEvent, ProfileChangeField, ProfileChangeStatus, Proof, ProofDownloadURL, ProofType, RequestAdditionalDocumentsRequest, RequestKycSubmitLinkRequest, RequestKycSubmitLinkResponse, SubmitEventBasedFaceVerificationSessionRequest, SubmittedDocument, SupportedAddressDocumentType, SupportedDocumentType, UpdateKycAlertRequest, UpdateKycPreferencesRequest, UpdateKycStatusRequest, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult, isKycDocumentExpiredCallbackEvent, isProfileChangeCallbackEvent } from './index.mjs';
2
- export { a as CreateCustomerProfileRequest, C as CustomerProfile, P as CustomerProfileFilters, b as CustomerProfileListResponse } from '../types-DfbnIaW_.mjs';
1
+ export { AccountSensitiveActionTrigger, CheckKycStatusRequest, CheckKycStatusResponse, CreateEventBasedFaceVerificationSessionRequest, CreateEventBasedFaceVerificationSessionResponse, DocumentType, DocumentVerificationRequest, DocumentVerificationResponse, EventBasedFaceVerificationCallback, EventBasedFaceVerificationDeviceType, EventBasedFaceVerificationEvent, EventBasedFaceVerificationFrequencyTrigger, EventBasedFaceVerificationReactionResult, EventBasedFaceVerificationReactions, EventBasedFaceVerificationThresholdTrigger, EventBasedFaceVerificationTriggers, FaceProof, KYC_DECLINED_DESCRIPTIONS, KycAlert, KycAlertFilters, KycAlertListResponse, KycAlertStatus, KycAlertType, KycCallbackReactions, KycClient, KycClientConfig, KycCustomerData, KycCustomerProfile, KycDeclinedCode, KycDisclosureConsent, KycDocumentExpiredCallbackEvent, KycHandoffSession, KycOtherReason, KycPagination, KycPreferences, KycRequest, KycRequestReason, KycRequestReasonCode, KycSkipOptions, KycStatus, KycStatusCallbackEvent, KycTriggerEvent, KycVerificationTriggers, Name, ProfileChangeCallbackEvent, ProfileChangeField, ProfileChangeStatus, Proof, ProofDownloadURL, ProofType, RequestAdditionalDocumentsRequest, RequestKycSubmitLinkRequest, RequestKycSubmitLinkResponse, SubmitEventBasedFaceVerificationSessionRequest, SubmittedDocument, SupportedAddressDocumentType, SupportedDocumentType, UpdateKycPreferencesRequest, UseKycAlertsOptions, UseKycAlertsResult, UseKycSubmissionOptions, UseKycSubmissionResult, isKycDocumentExpiredCallbackEvent, isKycStatusCallbackEvent, isProfileChangeCallbackEvent } from './index.mjs';
2
+ export { a as CreateCustomerProfileRequest, C as CustomerProfile, P as CustomerProfileFilters, b as CustomerProfileListResponse } from '../types-DbvVph_0.mjs';
3
3
  export { P as PaginationParams, R as RiskLevel } from '../types-CBQRNL-l.mjs';
4
4
  import '../client-q9fN8Hhf.mjs';
@@ -1,4 +1,4 @@
1
- export { AccountSensitiveActionTrigger, CheckKycStatusRequest, CheckKycStatusResponse, CreateEventBasedFaceVerificationSessionRequest, CreateEventBasedFaceVerificationSessionResponse, DocumentType, DocumentVerificationRequest, DocumentVerificationResponse, EventBasedFaceVerificationCallback, EventBasedFaceVerificationDeviceType, EventBasedFaceVerificationEvent, EventBasedFaceVerificationFrequencyTrigger, EventBasedFaceVerificationReactionResult, EventBasedFaceVerificationReactions, EventBasedFaceVerificationThresholdTrigger, EventBasedFaceVerificationTriggers, FaceProof, KYC_DECLINED_DESCRIPTIONS, KycAlert, KycAlertFilters, KycAlertListResponse, KycAlertStatus, KycAlertType, KycCallbackReactions, KycClient, KycClientConfig, KycCustomerData, KycCustomerProfile, KycDeclinedCode, KycDisclosureConsent, KycDocumentExpiredCallbackEvent, KycHandoffSession, KycOtherReason, KycOverview, KycPagination, KycPreferences, KycRequest, KycRequestFilters, KycRequestListResponse, KycRequestReason, KycRequestReasonCode, KycSkipOptions, KycStatus, KycTriggerEvent, KycVerificationTriggers, Name, ProfileChangeCallbackEvent, ProfileChangeField, ProfileChangeStatus, Proof, ProofDownloadURL, ProofType, RequestAdditionalDocumentsRequest, RequestKycSubmitLinkRequest, RequestKycSubmitLinkResponse, SubmitEventBasedFaceVerificationSessionRequest, SubmittedDocument, SupportedAddressDocumentType, SupportedDocumentType, UpdateKycAlertRequest, UpdateKycPreferencesRequest, UpdateKycStatusRequest, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult, isKycDocumentExpiredCallbackEvent, isProfileChangeCallbackEvent } from './index.js';
2
- export { a as CreateCustomerProfileRequest, C as CustomerProfile, P as CustomerProfileFilters, b as CustomerProfileListResponse } from '../types-1kI4SsKB.js';
1
+ export { AccountSensitiveActionTrigger, CheckKycStatusRequest, CheckKycStatusResponse, CreateEventBasedFaceVerificationSessionRequest, CreateEventBasedFaceVerificationSessionResponse, DocumentType, DocumentVerificationRequest, DocumentVerificationResponse, EventBasedFaceVerificationCallback, EventBasedFaceVerificationDeviceType, EventBasedFaceVerificationEvent, EventBasedFaceVerificationFrequencyTrigger, EventBasedFaceVerificationReactionResult, EventBasedFaceVerificationReactions, EventBasedFaceVerificationThresholdTrigger, EventBasedFaceVerificationTriggers, FaceProof, KYC_DECLINED_DESCRIPTIONS, KycAlert, KycAlertFilters, KycAlertListResponse, KycAlertStatus, KycAlertType, KycCallbackReactions, KycClient, KycClientConfig, KycCustomerData, KycCustomerProfile, KycDeclinedCode, KycDisclosureConsent, KycDocumentExpiredCallbackEvent, KycHandoffSession, KycOtherReason, KycPagination, KycPreferences, KycRequest, KycRequestReason, KycRequestReasonCode, KycSkipOptions, KycStatus, KycStatusCallbackEvent, KycTriggerEvent, KycVerificationTriggers, Name, ProfileChangeCallbackEvent, ProfileChangeField, ProfileChangeStatus, Proof, ProofDownloadURL, ProofType, RequestAdditionalDocumentsRequest, RequestKycSubmitLinkRequest, RequestKycSubmitLinkResponse, SubmitEventBasedFaceVerificationSessionRequest, SubmittedDocument, SupportedAddressDocumentType, SupportedDocumentType, UpdateKycPreferencesRequest, UseKycAlertsOptions, UseKycAlertsResult, UseKycSubmissionOptions, UseKycSubmissionResult, isKycDocumentExpiredCallbackEvent, isKycStatusCallbackEvent, isProfileChangeCallbackEvent } from './index.js';
2
+ export { a as CreateCustomerProfileRequest, C as CustomerProfile, P as CustomerProfileFilters, b as CustomerProfileListResponse } from '../types-qXamJr2q.js';
3
3
  export { P as PaginationParams, R as RiskLevel } from '../types-CBQRNL-l.js';
4
4
  import '../client-q9fN8Hhf.js';
package/dist/kyc/core.js CHANGED
@@ -507,19 +507,20 @@ var BaseClient = class {
507
507
  * Handle error responses from API
508
508
  */
509
509
  handleErrorResponse(status, data, requestId) {
510
- const message = data.error || data.message || `HTTP ${status}`;
510
+ const structured = data.error && typeof data.error === "object" && !Array.isArray(data.error) ? data.error : void 0;
511
+ const message = typeof data.error === "string" && data.error || typeof structured?.message === "string" && structured.message || typeof data.message === "string" && data.message || `HTTP ${status}`;
511
512
  const createError = () => {
512
513
  switch (status) {
513
514
  case 400:
514
- return new VesantError(message, "BAD_REQUEST", 400);
515
+ return new VesantError(message, "BAD_REQUEST", 400, structured);
515
516
  case 401:
516
517
  return new AuthenticationError(message);
517
518
  case 403:
518
- return new VesantError(message, "FORBIDDEN", 403);
519
+ return new VesantError(message, "FORBIDDEN", 403, structured);
519
520
  case 404:
520
- return new VesantError(message, "NOT_FOUND", 404);
521
+ return new VesantError(message, "NOT_FOUND", 404, structured);
521
522
  case 409:
522
- return new VesantError(message, "DUPLICATE_PROFILE", 409);
523
+ return new VesantError(message, "DUPLICATE_PROFILE", 409, structured);
523
524
  case 429: {
524
525
  const retryAfter = data.retry_after || data.retryAfter;
525
526
  return new RateLimitError(retryAfter);
@@ -530,7 +531,7 @@ var BaseClient = class {
530
531
  case 504:
531
532
  return new ServiceUnavailableError(message);
532
533
  default:
533
- return new VesantError(message, "UNKNOWN_ERROR", status);
534
+ return new VesantError(message, "UNKNOWN_ERROR", status, structured);
534
535
  }
535
536
  };
536
537
  const error = createError();
@@ -913,74 +914,6 @@ var KycClient = class extends BaseClient {
913
914
  headers: this.getUserHeaders()
914
915
  });
915
916
  }
916
- /**
917
- * List KYC requests with filters and pagination
918
- *
919
- * @param filters - Optional filters (status, search, date range)
920
- * @param pagination - Optional pagination (page, page_size)
921
- * @returns Paginated list of KYC requests
922
- *
923
- * @example
924
- * ```typescript
925
- * const requests = await client.listKycRequests(
926
- * { status: "pending", search: "john" },
927
- * { page: 1, page_size: 20 }
928
- * );
929
- * console.log(`Found ${requests.total} pending requests`);
930
- * ```
931
- *
932
- * @remarks Console session only. This endpoint accepts a Vesant console
933
- * (dashboard login) token, not a tenant API key; called with an API key it
934
- * fails with `AuthenticationError` or a permission error.
935
- */
936
- async listKycRequests(filters, pagination) {
937
- const params = {};
938
- if (filters) {
939
- addFilterParam(params, "status", filters.status);
940
- addSimpleParams(params, filters, ["search", "fromDate", "toDate", "sortBy", "order"]);
941
- }
942
- if (pagination) {
943
- if (pagination.page) params.page = pagination.page;
944
- if (pagination.page_size) params.limit = pagination.page_size;
945
- }
946
- return this.request(
947
- `/api/v1/kyc/requests${this.buildQueryString(params)}`,
948
- { headers: this.getUserHeaders() }
949
- );
950
- }
951
- /**
952
- * Update KYC request status (accept/decline)
953
- *
954
- * @param request - Status update request with reference, status, and reason
955
- *
956
- * @example
957
- * ```typescript
958
- * // Accept a KYC request
959
- * await client.updateKycStatus({
960
- * reference: "kyc-ref-123",
961
- * status: "accepted",
962
- * reason: "All documents verified successfully"
963
- * });
964
- *
965
- * // Decline a KYC request
966
- * await client.updateKycStatus({
967
- * reference: "kyc-ref-456",
968
- * status: "declined",
969
- * reason: "Document expired"
970
- * });
971
- * ```
972
- *
973
- * @remarks Console session only. This endpoint accepts a Vesant console
974
- * (dashboard login) token, not a tenant API key; called with an API key it
975
- * fails with `AuthenticationError` or a permission error.
976
- */
977
- async updateKycStatus(request) {
978
- await this.request("/api/v1/kyc/status", {
979
- method: "PUT",
980
- body: JSON.stringify(request),
981
- headers: this.getUserHeaders()
982
- });
983
- }
984
917
  /**
985
918
  * Request additional documents from customer
986
919
  *
@@ -1029,53 +962,8 @@ var KycClient = class extends BaseClient {
1029
962
  return (kyc.proofs ?? []).filter((proof) => typeof proof.link === "string" && proof.link !== "").map((proof) => ({ id: proof.id, type: proof.type, url: proof.link }));
1030
963
  }
1031
964
  // ============================================================================
1032
- // KYC Overview & Statistics
1033
- // ============================================================================
1034
- /**
1035
- * Get KYC overview statistics
1036
- *
1037
- * @param fromDate - Optional start date (ISO 8601)
1038
- * @param toDate - Optional end date (ISO 8601)
1039
- * @returns KYC statistics including counts by status
1040
- *
1041
- * @example
1042
- * ```typescript
1043
- * const overview = await client.getOverview(
1044
- * "2024-01-01T00:00:00Z",
1045
- * "2024-12-31T23:59:59Z"
1046
- * );
1047
- * console.log(`Total: ${overview.total}, Pending: ${overview.pending}`);
1048
- * console.log(`Approved: ${overview.approved}, Rejected: ${overview.rejected}`);
1049
- * ```
1050
- *
1051
- * @remarks Console session only. This endpoint accepts a Vesant console
1052
- * (dashboard login) token, not a tenant API key; called with an API key it
1053
- * fails with `AuthenticationError` or a permission error.
1054
- */
1055
- async getOverview(fromDate, toDate) {
1056
- const params = {};
1057
- if (fromDate) params.fromDate = fromDate;
1058
- if (toDate) params.toDate = toDate;
1059
- return this.request(
1060
- `/api/v1/kyc/overview${this.buildQueryString(params)}`
1061
- );
1062
- }
1063
- // ============================================================================
1064
965
  // Alert Management
1065
966
  // ============================================================================
1066
- /**
1067
- * Get a KYC alert by ID
1068
- *
1069
- * @param alertId - Alert ID
1070
- * @returns Alert details
1071
- *
1072
- * @remarks Console session only. This endpoint accepts a Vesant console
1073
- * (dashboard login) token, not a tenant API key; called with an API key it
1074
- * fails with `AuthenticationError` or a permission error.
1075
- */
1076
- async getAlert(alertId) {
1077
- return this.request(`/api/v1/kyc/alerts/${alertId}`);
1078
- }
1079
967
  /**
1080
968
  * List KYC alerts with filters and pagination
1081
969
  *
@@ -1118,74 +1006,15 @@ var KycClient = class extends BaseClient {
1118
1006
  `/api/v1/kyc/alerts${this.buildQueryString(params)}`
1119
1007
  );
1120
1008
  }
1121
- /**
1122
- * Update a KYC alert
1123
- *
1124
- * @param alertId - Alert ID
1125
- * @param update - Fields to update (status, assigned_for, reason, alert_type)
1126
- *
1127
- * @example
1128
- * ```typescript
1129
- * // Assign an alert
1130
- * await client.updateAlert("alert_123", {
1131
- * assigned_for: "analyst_user_id",
1132
- * status: "in_progress"
1133
- * });
1134
- *
1135
- * // Resolve an alert
1136
- * await client.updateAlert("alert_123", {
1137
- * status: "resolved",
1138
- * reason: "Customer verified via phone call"
1139
- * });
1140
- *
1141
- * // Escalate an alert
1142
- * await client.updateAlert("alert_123", {
1143
- * status: "escalated",
1144
- * assigned_for: "manager_user_id",
1145
- * reason: "Requires senior review - suspicious documents"
1146
- * });
1147
- * ```
1148
- *
1149
- * @remarks Console session only. This endpoint accepts a Vesant console
1150
- * (dashboard login) token, not a tenant API key; called with an API key it
1151
- * fails with `AuthenticationError` or a permission error.
1152
- */
1153
- async updateAlert(alertId, update) {
1154
- await this.request(`/api/v1/kyc/alerts/${alertId}`, {
1155
- method: "PUT",
1156
- body: JSON.stringify(update),
1157
- headers: this.getUserHeaders()
1158
- });
1159
- }
1160
1009
  // ============================================================================
1161
1010
  // KYC Preferences
1162
1011
  // ============================================================================
1163
- /**
1164
- * Get KYC preferences for the tenant
1165
- *
1166
- * @returns KYC preferences configuration
1167
- *
1168
- * @example
1169
- * ```typescript
1170
- * const prefs = await client.getPreferences();
1171
- * console.log(`Face verification required: ${prefs.is_face_verification_required}`);
1172
- * console.log(`Required documents: ${prefs.required_document_count}`);
1173
- * ```
1174
- *
1175
- * @remarks Console session only. This endpoint accepts a Vesant console
1176
- * (dashboard login) token, not a tenant API key; called with an API key it
1177
- * fails with `AuthenticationError` or a permission error.
1178
- */
1179
- async getPreferences() {
1180
- return this.request("/api/v1/kyc/preferences");
1181
- }
1182
1012
  /**
1183
1013
  * Update KYC preferences for the tenant
1184
1014
  *
1185
1015
  * @deprecated KYC preferences are managed in the Vesant console; the
1186
1016
  * platform exposes no update operation to the SDK, so this call always
1187
- * fails. Use `getPreferences()` to read them. This method will be removed
1188
- * in a future release.
1017
+ * fails. This method will be removed in a future release.
1189
1018
  *
1190
1019
  * @param update - Fields to update
1191
1020
  * @returns Updated preferences
@@ -1348,6 +1177,9 @@ var KYC_DECLINED_DESCRIPTIONS = {
1348
1177
  function isKycDocumentExpiredCallbackEvent(value) {
1349
1178
  return typeof value === "object" && value !== null && value.event === "kyc_document_expired";
1350
1179
  }
1180
+ function isKycStatusCallbackEvent(value) {
1181
+ return typeof value === "object" && value !== null && value.event === "kyc";
1182
+ }
1351
1183
  function isProfileChangeCallbackEvent(value) {
1352
1184
  return typeof value === "object" && value !== null && value.event === "profile_change";
1353
1185
  }
@@ -1355,6 +1187,7 @@ function isProfileChangeCallbackEvent(value) {
1355
1187
  exports.KYC_DECLINED_DESCRIPTIONS = KYC_DECLINED_DESCRIPTIONS;
1356
1188
  exports.KycClient = KycClient;
1357
1189
  exports.isKycDocumentExpiredCallbackEvent = isKycDocumentExpiredCallbackEvent;
1190
+ exports.isKycStatusCallbackEvent = isKycStatusCallbackEvent;
1358
1191
  exports.isProfileChangeCallbackEvent = isProfileChangeCallbackEvent;
1359
1192
  //# sourceMappingURL=core.js.map
1360
1193
  //# sourceMappingURL=core.js.map