vesant-sdk 1.7.2 → 1.8.0-dev.0a33430

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 (72) hide show
  1. package/README.md +5 -3
  2. package/dist/{client-B3DCAHlg.d.ts → client-4oLoc31v.d.ts} +2 -2
  3. package/dist/{client-fy3trF2K.d.ts → client-BaUekQT8.d.ts} +32 -10
  4. package/dist/{client-D23KhWeh.d.mts → client-CJI8VO1i.d.mts} +2 -2
  5. package/dist/{client-BwXMQA2a.d.mts → client-XDEhh9VN.d.mts} +32 -10
  6. package/dist/compliance/index.d.mts +3 -3
  7. package/dist/compliance/index.d.ts +3 -3
  8. package/dist/compliance/index.js +59 -5
  9. package/dist/compliance/index.js.map +1 -1
  10. package/dist/compliance/index.mjs +59 -5
  11. package/dist/compliance/index.mjs.map +1 -1
  12. package/dist/decisions/index.js +1 -1
  13. package/dist/decisions/index.js.map +1 -1
  14. package/dist/decisions/index.mjs +1 -1
  15. package/dist/decisions/index.mjs.map +1 -1
  16. package/dist/geolocation/index.d.mts +2 -2
  17. package/dist/geolocation/index.d.ts +2 -2
  18. package/dist/geolocation/index.js +40 -2
  19. package/dist/geolocation/index.js.map +1 -1
  20. package/dist/geolocation/index.mjs +40 -2
  21. package/dist/geolocation/index.mjs.map +1 -1
  22. package/dist/{index-DSDgS09k.d.ts → index-BosFSGan.d.ts} +57 -2
  23. package/dist/{index-C3zUKydT.d.mts → index-C49a7fg2.d.mts} +57 -2
  24. package/dist/index.d.mts +6 -6
  25. package/dist/index.d.ts +6 -6
  26. package/dist/index.js +118 -16
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +116 -17
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/kyc/core.d.mts +2 -2
  31. package/dist/kyc/core.d.ts +2 -2
  32. package/dist/kyc/core.js +53 -12
  33. package/dist/kyc/core.js.map +1 -1
  34. package/dist/kyc/core.mjs +53 -13
  35. package/dist/kyc/core.mjs.map +1 -1
  36. package/dist/kyc/index.d.mts +172 -16
  37. package/dist/kyc/index.d.ts +172 -16
  38. package/dist/kyc/index.js +53 -12
  39. package/dist/kyc/index.js.map +1 -1
  40. package/dist/kyc/index.mjs +53 -13
  41. package/dist/kyc/index.mjs.map +1 -1
  42. package/dist/react.d.mts +29 -4
  43. package/dist/react.d.ts +29 -4
  44. package/dist/react.js +23 -11
  45. package/dist/react.js.map +1 -1
  46. package/dist/react.mjs +23 -11
  47. package/dist/react.mjs.map +1 -1
  48. package/dist/risk-profile/index.d.mts +16 -6
  49. package/dist/risk-profile/index.d.ts +16 -6
  50. package/dist/risk-profile/index.js +19 -3
  51. package/dist/risk-profile/index.js.map +1 -1
  52. package/dist/risk-profile/index.mjs +19 -4
  53. package/dist/risk-profile/index.mjs.map +1 -1
  54. package/dist/scores/index.js +1 -1
  55. package/dist/scores/index.js.map +1 -1
  56. package/dist/scores/index.mjs +1 -1
  57. package/dist/scores/index.mjs.map +1 -1
  58. package/dist/tax/index.d.mts +1 -1
  59. package/dist/tax/index.d.ts +1 -1
  60. package/dist/tax/index.js +1 -1
  61. package/dist/tax/index.js.map +1 -1
  62. package/dist/tax/index.mjs +1 -1
  63. package/dist/tax/index.mjs.map +1 -1
  64. package/dist/{types-UGyDl1fd.d.ts → types-1kI4SsKB.d.ts} +44 -1
  65. package/dist/{types-BOFaMQxI.d.mts → types-DfbnIaW_.d.mts} +44 -1
  66. package/dist/webhooks/index.d.mts +1 -1
  67. package/dist/webhooks/index.d.ts +1 -1
  68. package/dist/webhooks/index.js +6 -0
  69. package/dist/webhooks/index.js.map +1 -1
  70. package/dist/webhooks/index.mjs +6 -1
  71. package/dist/webhooks/index.mjs.map +1 -1
  72. package/package.json +1 -1
package/dist/kyc/core.mjs CHANGED
@@ -227,7 +227,7 @@ function createConsoleLogger() {
227
227
  }
228
228
 
229
229
  // src/core/version.ts
230
- var SDK_VERSION = "1.7.2";
230
+ var SDK_VERSION = "1.8.0";
231
231
 
232
232
  // src/shared/browser-utils.ts
233
233
  function generateUUID() {
@@ -890,19 +890,26 @@ var KycClient = class extends BaseClient {
890
890
  }, void 0, requestOptions);
891
891
  }
892
892
  /**
893
- * Get a KYC request by ID
893
+ * Get a KYC record by ID
894
894
  *
895
- * @param id - KYC request ID
896
- * @returns KYC request details including proofs and alerts
895
+ * Works with your tenant API key. Each entry in `proofs` carries a
896
+ * short-lived `link` for downloading that document, and `reference` holds
897
+ * your own customer reference (the `forward_reference`).
898
+ *
899
+ * @param id - KYC record ID (the `kyc_id` returned by `requestKycSubmitLink`)
900
+ * @returns KYC record including proofs (with download links) and alerts
897
901
  *
898
902
  * @example
899
903
  * ```typescript
900
904
  * const kyc = await client.getKycRequest("550e8400-e29b-41d4-a716-446655440000");
901
905
  * console.log(`Status: ${kyc.status}, ID Verified: ${kyc.id_verified}`);
906
+ * kyc.proofs?.forEach(proof => console.log(`${proof.type}: ${proof.link}`));
902
907
  * ```
903
908
  */
904
909
  async getKycRequest(id) {
905
- return this.request(`/api/v1/kyc/requests/${id}`);
910
+ return this.request(`/api/v1/kyc/${encodeURIComponent(id)}`, {
911
+ headers: this.getUserHeaders()
912
+ });
906
913
  }
907
914
  /**
908
915
  * List KYC requests with filters and pagination
@@ -919,6 +926,10 @@ var KycClient = class extends BaseClient {
919
926
  * );
920
927
  * console.log(`Found ${requests.total} pending requests`);
921
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.
922
933
  */
923
934
  async listKycRequests(filters, pagination) {
924
935
  const params = {};
@@ -956,6 +967,10 @@ var KycClient = class extends BaseClient {
956
967
  * reason: "Document expired"
957
968
  * });
958
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.
959
974
  */
960
975
  async updateKycStatus(request) {
961
976
  await this.request("/api/v1/kyc/status", {
@@ -992,22 +1007,24 @@ var KycClient = class extends BaseClient {
992
1007
  /**
993
1008
  * Get downloadable URLs for KYC proofs/documents
994
1009
  *
995
- * @param kycId - KYC request ID
996
- * @returns Array of proof download URLs with expiration
1010
+ * Derived from the `proofs` of `getKycRequest`: the platform attaches a
1011
+ * short-lived download link to every proof on the KYC record, so no
1012
+ * separate endpoint is needed. Proofs without a link are omitted.
1013
+ *
1014
+ * @param kycId - KYC record ID
1015
+ * @returns Array of proof download URLs
997
1016
  *
998
1017
  * @example
999
1018
  * ```typescript
1000
1019
  * const proofs = await client.getProofDownloadURLs("550e8400-e29b-41d4-a716-446655440000");
1001
1020
  * proofs.forEach(proof => {
1002
- * console.log(`${proof.type}: ${proof.url} (expires: ${proof.expires_at})`);
1021
+ * console.log(`${proof.type}: ${proof.url}`);
1003
1022
  * });
1004
1023
  * ```
1005
1024
  */
1006
1025
  async getProofDownloadURLs(kycId) {
1007
- return this.request(
1008
- `/api/v1/kyc/proofs/${kycId}`,
1009
- { headers: this.getUserHeaders() }
1010
- );
1026
+ const kyc = await this.getKycRequest(kycId);
1027
+ return (kyc.proofs ?? []).filter((proof) => typeof proof.link === "string" && proof.link !== "").map((proof) => ({ id: proof.id, type: proof.type, url: proof.link }));
1011
1028
  }
1012
1029
  // ============================================================================
1013
1030
  // KYC Overview & Statistics
@@ -1028,6 +1045,10 @@ var KycClient = class extends BaseClient {
1028
1045
  * console.log(`Total: ${overview.total}, Pending: ${overview.pending}`);
1029
1046
  * console.log(`Approved: ${overview.approved}, Rejected: ${overview.rejected}`);
1030
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.
1031
1052
  */
1032
1053
  async getOverview(fromDate, toDate) {
1033
1054
  const params = {};
@@ -1045,6 +1066,10 @@ var KycClient = class extends BaseClient {
1045
1066
  *
1046
1067
  * @param alertId - Alert ID
1047
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.
1048
1073
  */
1049
1074
  async getAlert(alertId) {
1050
1075
  return this.request(`/api/v1/kyc/alerts/${alertId}`);
@@ -1068,6 +1093,10 @@ var KycClient = class extends BaseClient {
1068
1093
  * );
1069
1094
  * console.log(`Found ${alerts.total} alerts`);
1070
1095
  * ```
1096
+ *
1097
+ * @remarks Console session only. This endpoint accepts a Vesant console
1098
+ * (dashboard login) token, not a tenant API key; called with an API key it
1099
+ * fails with `AuthenticationError` or a permission error.
1071
1100
  */
1072
1101
  async listAlerts(filters, pagination) {
1073
1102
  const params = {};
@@ -1114,6 +1143,10 @@ var KycClient = class extends BaseClient {
1114
1143
  * reason: "Requires senior review - suspicious documents"
1115
1144
  * });
1116
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.
1117
1150
  */
1118
1151
  async updateAlert(alertId, update) {
1119
1152
  await this.request(`/api/v1/kyc/alerts/${alertId}`, {
@@ -1136,6 +1169,10 @@ var KycClient = class extends BaseClient {
1136
1169
  * console.log(`Face verification required: ${prefs.is_face_verification_required}`);
1137
1170
  * console.log(`Required documents: ${prefs.required_document_count}`);
1138
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.
1139
1176
  */
1140
1177
  async getPreferences() {
1141
1178
  return this.request("/api/v1/kyc/preferences");
@@ -1309,7 +1346,10 @@ var KYC_DECLINED_DESCRIPTIONS = {
1309
1346
  function isKycDocumentExpiredCallbackEvent(value) {
1310
1347
  return typeof value === "object" && value !== null && value.event === "kyc_document_expired";
1311
1348
  }
1349
+ function isProfileChangeCallbackEvent(value) {
1350
+ return typeof value === "object" && value !== null && value.event === "profile_change";
1351
+ }
1312
1352
 
1313
- export { KYC_DECLINED_DESCRIPTIONS, KycClient, isKycDocumentExpiredCallbackEvent };
1353
+ export { KYC_DECLINED_DESCRIPTIONS, KycClient, isKycDocumentExpiredCallbackEvent, isProfileChangeCallbackEvent };
1314
1354
  //# sourceMappingURL=core.mjs.map
1315
1355
  //# sourceMappingURL=core.mjs.map