vesant-sdk 1.6.6-next.ac58d2b → 2.0.0-dev.40d1c39

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 +4 -4
  2. package/dist/client-BJ87_Vv5.d.ts +430 -0
  3. package/dist/{client-DPtiuQvW.d.ts → client-Bvp-f05-.d.ts} +6 -6
  4. package/dist/{client-D6PE3pcB.d.mts → client-CIEa7xYG.d.mts} +6 -6
  5. package/dist/client-IAOGCBfm.d.mts +430 -0
  6. package/dist/compliance/index.d.mts +25 -429
  7. package/dist/compliance/index.d.ts +25 -429
  8. package/dist/compliance/index.js +131 -34
  9. package/dist/compliance/index.js.map +1 -1
  10. package/dist/compliance/index.mjs +131 -35
  11. package/dist/compliance/index.mjs.map +1 -1
  12. package/dist/decisions/index.d.mts +1 -1
  13. package/dist/decisions/index.d.ts +1 -1
  14. package/dist/decisions/index.js +1 -1
  15. package/dist/decisions/index.js.map +1 -1
  16. package/dist/decisions/index.mjs +1 -1
  17. package/dist/decisions/index.mjs.map +1 -1
  18. package/dist/geolocation/index.d.mts +3 -3
  19. package/dist/geolocation/index.d.ts +3 -3
  20. package/dist/geolocation/index.js +1 -1
  21. package/dist/geolocation/index.js.map +1 -1
  22. package/dist/geolocation/index.mjs +1 -1
  23. package/dist/geolocation/index.mjs.map +1 -1
  24. package/dist/index.d.mts +10 -8
  25. package/dist/index.d.ts +10 -8
  26. package/dist/index.js +145 -34
  27. package/dist/index.js.map +1 -1
  28. package/dist/index.mjs +144 -35
  29. package/dist/index.mjs.map +1 -1
  30. package/dist/kyc/core.d.mts +3 -3
  31. package/dist/kyc/core.d.ts +3 -3
  32. package/dist/kyc/core.js +15 -1
  33. package/dist/kyc/core.js.map +1 -1
  34. package/dist/kyc/core.mjs +15 -2
  35. package/dist/kyc/core.mjs.map +1 -1
  36. package/dist/kyc/index.d.mts +7 -3
  37. package/dist/kyc/index.d.ts +7 -3
  38. package/dist/kyc/index.js +15 -1
  39. package/dist/kyc/index.js.map +1 -1
  40. package/dist/kyc/index.mjs +15 -2
  41. package/dist/kyc/index.mjs.map +1 -1
  42. package/dist/react.d.mts +4 -4
  43. package/dist/react.d.ts +4 -4
  44. package/dist/react.js +1 -1
  45. package/dist/react.js.map +1 -1
  46. package/dist/react.mjs +1 -1
  47. package/dist/react.mjs.map +1 -1
  48. package/dist/risk-profile/index.d.mts +3 -3
  49. package/dist/risk-profile/index.d.ts +3 -3
  50. package/dist/risk-profile/index.js +1 -1
  51. package/dist/risk-profile/index.js.map +1 -1
  52. package/dist/risk-profile/index.mjs +1 -1
  53. package/dist/risk-profile/index.mjs.map +1 -1
  54. package/dist/scores/index.d.mts +1 -1
  55. package/dist/scores/index.d.ts +1 -1
  56. package/dist/scores/index.js +1 -1
  57. package/dist/scores/index.js.map +1 -1
  58. package/dist/scores/index.mjs +1 -1
  59. package/dist/scores/index.mjs.map +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-_YQdS3Ax.d.ts → types-2utj53GK.d.ts} +2 -2
  65. package/dist/{types-DGDVnogO.d.mts → types-C4Zx0d_u.d.mts} +2 -2
  66. package/dist/{types-B4Ezqo7V.d.mts → types-QUCWam16.d.mts} +7 -1
  67. package/dist/{types-B4Ezqo7V.d.ts → types-QUCWam16.d.ts} +7 -1
  68. package/dist/webhooks/index.d.mts +1 -1
  69. package/dist/webhooks/index.d.ts +1 -1
  70. package/dist/webhooks/index.js.map +1 -1
  71. package/dist/webhooks/index.mjs.map +1 -1
  72. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -242,7 +242,7 @@ var noopLogger = {
242
242
  };
243
243
 
244
244
  // src/core/version.ts
245
- var SDK_VERSION = "1.6.6";
245
+ var SDK_VERSION = "2.0.0";
246
246
 
247
247
  // src/shared/browser-utils.ts
248
248
  function generateUUID() {
@@ -1456,6 +1456,81 @@ var RiskProfileClient = class extends BaseClient {
1456
1456
  }
1457
1457
  };
1458
1458
 
1459
+ // src/compliance/block-reasons.ts
1460
+ var sdkReasons = {
1461
+ // Jurisdiction
1462
+ jurisdictionBlocked: (country, countryISO) => ({
1463
+ code: "JURISDICTION_BLOCKED",
1464
+ message: "Access from a blocked jurisdiction",
1465
+ metadata: { country, country_iso: countryISO }
1466
+ }),
1467
+ jurisdictionNonCompliant: () => ({
1468
+ code: "JURISDICTION_NON_COMPLIANT",
1469
+ message: "Location does not meet compliance requirements"
1470
+ }),
1471
+ jurisdictionRegistrationDenied: () => ({
1472
+ code: "JURISDICTION_REGISTRATION_DENIED",
1473
+ message: "Registration is not permitted in this jurisdiction"
1474
+ }),
1475
+ jurisdictionRestricted: () => ({
1476
+ code: "JURISDICTION_RESTRICTED",
1477
+ message: "Access from a restricted jurisdiction"
1478
+ }),
1479
+ // Risk
1480
+ riskCriticalLevel: () => ({
1481
+ code: "RISK_CRITICAL_LEVEL",
1482
+ message: "Risk assessment reached critical threshold"
1483
+ }),
1484
+ accountSuspended: () => ({
1485
+ code: "RISK_ACCOUNT_SUSPENDED",
1486
+ message: "Customer account is suspended"
1487
+ }),
1488
+ sanctionsMatch: () => ({
1489
+ code: "RISK_SANCTIONS_MATCH",
1490
+ message: "Customer profile matched against sanctions list"
1491
+ }),
1492
+ riskHighLocation: () => ({
1493
+ code: "RISK_HIGH_LOCATION",
1494
+ message: "High-risk geographic location"
1495
+ }),
1496
+ riskHighCustomer: () => ({
1497
+ code: "RISK_HIGH_CUSTOMER",
1498
+ message: "Customer flagged as high risk"
1499
+ }),
1500
+ // Device
1501
+ ciphertextInvalid: () => ({
1502
+ code: "DEVICE_CIPHERTEXT_INVALID",
1503
+ message: "Device verification payload failed validation"
1504
+ }),
1505
+ gpsIPMismatch: () => ({
1506
+ code: "DEVICE_GPS_IP_MISMATCH",
1507
+ message: "GPS location does not match IP-derived location"
1508
+ }),
1509
+ gpsRequired: () => ({
1510
+ code: "DEVICE_GPS_REQUIRED",
1511
+ message: "GPS verification is required but was not provided"
1512
+ }),
1513
+ // Transaction
1514
+ transactionHighAmount: (amount, currency, threshold) => ({
1515
+ code: "TRANSACTION_HIGH_AMOUNT",
1516
+ message: "Transaction amount exceeds high-value threshold",
1517
+ metadata: { amount, currency, threshold }
1518
+ }),
1519
+ transactionElevatedAmount: (amount, currency, threshold) => ({
1520
+ code: "TRANSACTION_ELEVATED_AMOUNT",
1521
+ message: "Transaction amount exceeds elevated-value threshold",
1522
+ metadata: { amount, currency, threshold }
1523
+ }),
1524
+ transactionJurisdictionLimit: () => ({
1525
+ code: "TRANSACTION_JURISDICTION_LIMIT",
1526
+ message: "Transaction amount exceeds jurisdiction limit"
1527
+ }),
1528
+ anonymizationDetected: () => ({
1529
+ code: "NETWORK_ANONYMIZER_DETECTED",
1530
+ message: "Anonymization tool detected"
1531
+ })
1532
+ };
1533
+
1459
1534
  // src/compliance/types.ts
1460
1535
  var DEFAULT_CURRENCY_RATES = {
1461
1536
  USD: 1,
@@ -1688,23 +1763,23 @@ var ComplianceClient = class {
1688
1763
  blockReasons.push(...geoVerification.risk_reasons ?? []);
1689
1764
  }
1690
1765
  if (!geoVerification.is_compliant) {
1691
- if (!blockReasons.includes("non_compliant_jurisdiction")) {
1692
- blockReasons.push("non_compliant_jurisdiction");
1766
+ if (!blockReasons.some((r) => r.code === "JURISDICTION_NON_COMPLIANT")) {
1767
+ blockReasons.push(sdkReasons.jurisdictionNonCompliant());
1693
1768
  }
1694
1769
  }
1695
1770
  const jurisdiction = geoVerification.jurisdiction;
1696
1771
  if (jurisdiction) {
1697
1772
  if (jurisdiction.allow_registration === false) {
1698
- blockReasons.push("registration_not_allowed_in_jurisdiction");
1773
+ blockReasons.push(sdkReasons.jurisdictionRegistrationDenied());
1699
1774
  }
1700
1775
  if (jurisdiction.status === "blocked" || jurisdiction.status === "sanctioned") {
1701
- if (!blockReasons.includes("blocked_jurisdiction")) {
1702
- blockReasons.push("blocked_jurisdiction");
1776
+ if (!blockReasons.some((r) => r.code === "JURISDICTION_BLOCKED")) {
1777
+ blockReasons.push(sdkReasons.jurisdictionBlocked(jurisdiction.country_name ?? "", jurisdiction.country_iso ?? ""));
1703
1778
  }
1704
1779
  }
1705
1780
  if (jurisdiction.status === "restricted" && jurisdiction.allow_registration === false) {
1706
- if (!blockReasons.includes("restricted_jurisdiction_no_registration")) {
1707
- blockReasons.push("restricted_jurisdiction_no_registration");
1781
+ if (!blockReasons.some((r) => r.code === "JURISDICTION_RESTRICTED")) {
1782
+ blockReasons.push(sdkReasons.jurisdictionRestricted());
1708
1783
  }
1709
1784
  }
1710
1785
  }
@@ -1712,25 +1787,30 @@ var ComplianceClient = class {
1712
1787
  blockReasons.push(...geoVerification.geofence_evaluation.reasons ?? []);
1713
1788
  }
1714
1789
  if (geoVerification.risk_level === "critical") {
1715
- if (!blockReasons.includes("critical_risk_level")) {
1716
- blockReasons.push("critical_risk_level");
1790
+ if (!blockReasons.some((r) => r.code === "RISK_CRITICAL_LEVEL")) {
1791
+ blockReasons.push(sdkReasons.riskCriticalLevel());
1717
1792
  }
1718
1793
  }
1719
1794
  if (cipherTextResult) {
1720
1795
  if (!cipherTextResult.valid) {
1721
- blockReasons.push("ciphertext_validation_failed");
1796
+ blockReasons.push(sdkReasons.ciphertextInvalid());
1722
1797
  }
1723
1798
  if (cipherTextResult.risk?.is_blocked) {
1724
1799
  blockReasons.push(...cipherTextResult.risk.block_reasons || []);
1725
1800
  }
1726
1801
  if (cipherTextResult.risk?.location_mismatch) {
1727
- blockReasons.push("gps_ip_location_mismatch");
1802
+ blockReasons.push(sdkReasons.gpsIPMismatch());
1728
1803
  }
1729
1804
  }
1730
1805
  if (geoVerification.gps_required && !cipherTextResult) {
1731
- blockReasons.push("gps_verification_required");
1806
+ blockReasons.push(sdkReasons.gpsRequired());
1732
1807
  }
1733
- return [...new Set(blockReasons)];
1808
+ const seen = /* @__PURE__ */ new Set();
1809
+ return blockReasons.filter((r) => {
1810
+ if (seen.has(r.code)) return false;
1811
+ seen.add(r.code);
1812
+ return true;
1813
+ });
1734
1814
  }
1735
1815
  /**
1736
1816
  * Validate registration request has all required fields
@@ -2114,7 +2194,7 @@ var ComplianceClient = class {
2114
2194
  const blockReasons = [...geoVerification.risk_reasons ?? []];
2115
2195
  if (cipherTextResult) {
2116
2196
  if (!cipherTextResult.valid) {
2117
- blockReasons.push("ciphertext_validation_failed");
2197
+ blockReasons.push(sdkReasons.ciphertextInvalid());
2118
2198
  }
2119
2199
  if (cipherTextResult.risk?.is_blocked) {
2120
2200
  blockReasons.push(...cipherTextResult.risk.block_reasons || []);
@@ -2122,12 +2202,18 @@ var ComplianceClient = class {
2122
2202
  }
2123
2203
  const gpsBlocked = geoVerification.gps_required && !cipherTextResult;
2124
2204
  if (gpsBlocked) {
2125
- blockReasons.push("gps_verification_required");
2205
+ blockReasons.push(sdkReasons.gpsRequired());
2126
2206
  }
2207
+ const seen = /* @__PURE__ */ new Set();
2208
+ const dedupedBlockReasons = blockReasons.filter((r) => {
2209
+ if (seen.has(r.code)) return false;
2210
+ seen.add(r.code);
2211
+ return true;
2212
+ });
2127
2213
  return {
2128
2214
  allowed: geoVerification.is_compliant && !geoVerification.is_blocked && !cipherTextBlocked && !gpsBlocked,
2129
2215
  geolocation: geoVerification,
2130
- blockReasons: [...new Set(blockReasons)],
2216
+ blockReasons: dedupedBlockReasons,
2131
2217
  processingTime: Date.now() - startTime,
2132
2218
  cipherTextValidation: cipherTextResult
2133
2219
  };
@@ -2230,31 +2316,31 @@ var ComplianceClient = class {
2230
2316
  const normalizedAmount = this.normalizeToUSD(amount, currency);
2231
2317
  if (normalizedAmount > 1e4) {
2232
2318
  riskScore += 30;
2233
- factors.push("high_transaction_amount");
2319
+ factors.push(sdkReasons.transactionHighAmount(normalizedAmount, currency, 1e4));
2234
2320
  } else if (normalizedAmount > 5e3) {
2235
2321
  riskScore += 15;
2236
- factors.push("elevated_transaction_amount");
2322
+ factors.push(sdkReasons.transactionElevatedAmount(normalizedAmount, currency, 5e3));
2237
2323
  }
2238
2324
  riskScore += geoVerification.risk_score * 0.4;
2239
2325
  if (geoVerification.risk_level === "high" || geoVerification.risk_level === "critical") {
2240
- factors.push("high_risk_location");
2326
+ factors.push(sdkReasons.riskHighLocation());
2241
2327
  }
2242
2328
  riskScore += profile.risk_score * 0.3;
2243
2329
  if (profile.risk_category === "high" || profile.risk_category === "critical") {
2244
- factors.push("high_risk_customer");
2330
+ factors.push(sdkReasons.riskHighCustomer());
2245
2331
  }
2246
2332
  if (geoVerification.location.is_vpn || geoVerification.location.is_proxy) {
2247
2333
  riskScore += 20;
2248
- factors.push("anonymization_detected");
2334
+ factors.push(sdkReasons.anonymizationDetected());
2249
2335
  }
2250
2336
  if (profile.customer_status === "suspended") {
2251
2337
  riskScore += 50;
2252
- factors.push("account_suspended");
2338
+ factors.push(sdkReasons.accountSuspended());
2253
2339
  }
2254
2340
  if (cipherTextResult) {
2255
2341
  if (cipherTextResult.risk?.location_mismatch) {
2256
2342
  riskScore += 20;
2257
- factors.push("gps_ip_location_mismatch");
2343
+ factors.push(sdkReasons.gpsIPMismatch());
2258
2344
  }
2259
2345
  if (cipherTextResult.risk?.score) {
2260
2346
  riskScore += cipherTextResult.risk.score * 0.2;
@@ -2292,48 +2378,58 @@ var ComplianceClient = class {
2292
2378
  }
2293
2379
  if (profile) {
2294
2380
  if (profile.customer_status === "suspended") {
2295
- reasons.push("account_suspended");
2381
+ reasons.push(sdkReasons.accountSuspended());
2296
2382
  }
2297
2383
  if (profile.has_sanctions) {
2298
- reasons.push("sanctions_match");
2384
+ reasons.push(sdkReasons.sanctionsMatch());
2299
2385
  }
2300
2386
  }
2301
2387
  if (cipherTextResult) {
2302
2388
  if (!cipherTextResult.valid) {
2303
- reasons.push("ciphertext_validation_failed");
2389
+ reasons.push(sdkReasons.ciphertextInvalid());
2304
2390
  }
2305
2391
  if (cipherTextResult.risk?.is_blocked) {
2306
2392
  reasons.push(...cipherTextResult.risk.block_reasons || []);
2307
2393
  }
2308
2394
  }
2309
2395
  if (geoVerification.gps_required && !cipherTextResult) {
2310
- reasons.push("gps_verification_required");
2396
+ reasons.push(sdkReasons.gpsRequired());
2311
2397
  }
2312
- return [...new Set(reasons)];
2398
+ const seen = /* @__PURE__ */ new Set();
2399
+ return reasons.filter((r) => {
2400
+ if (seen.has(r.code)) return false;
2401
+ seen.add(r.code);
2402
+ return true;
2403
+ });
2313
2404
  }
2314
2405
  getTransactionBlockReasons(geoVerification, transactionRisk, jurisdictionAllowed, cipherTextResult) {
2315
2406
  const reasons = [];
2316
2407
  if (!geoVerification.is_compliant) {
2317
- reasons.push("non_compliant_jurisdiction");
2408
+ reasons.push(sdkReasons.jurisdictionNonCompliant());
2318
2409
  }
2319
2410
  if (!jurisdictionAllowed) {
2320
- reasons.push("exceeds_jurisdiction_limit");
2411
+ reasons.push(sdkReasons.transactionJurisdictionLimit());
2321
2412
  }
2322
2413
  if (!transactionRisk.allowed) {
2323
2414
  reasons.push(...transactionRisk.factors);
2324
2415
  }
2325
2416
  if (cipherTextResult) {
2326
2417
  if (!cipherTextResult.valid) {
2327
- reasons.push("ciphertext_validation_failed");
2418
+ reasons.push(sdkReasons.ciphertextInvalid());
2328
2419
  }
2329
2420
  if (cipherTextResult.risk?.is_blocked) {
2330
2421
  reasons.push(...cipherTextResult.risk.block_reasons || []);
2331
2422
  }
2332
2423
  }
2333
2424
  if (geoVerification.gps_required && !cipherTextResult) {
2334
- reasons.push("gps_verification_required");
2425
+ reasons.push(sdkReasons.gpsRequired());
2335
2426
  }
2336
- return [...new Set(reasons)];
2427
+ const seen = /* @__PURE__ */ new Set();
2428
+ return reasons.filter((r) => {
2429
+ if (seen.has(r.code)) return false;
2430
+ seen.add(r.code);
2431
+ return true;
2432
+ });
2337
2433
  }
2338
2434
  // ============================================================================
2339
2435
  // Location Request Methods
@@ -3140,6 +3236,19 @@ var KycClient = class extends BaseClient {
3140
3236
  // ============================================================================
3141
3237
  };
3142
3238
 
3239
+ // src/kyc/types.ts
3240
+ var KYC_DECLINED_DESCRIPTIONS = {
3241
+ KYC_DOCUMENT_EXPIRED: "The submitted document has expired",
3242
+ KYC_DOCUMENT_INVALID: "The submitted document could not be verified",
3243
+ KYC_FACE_MISMATCH: "Face verification did not match the identity document",
3244
+ KYC_AGE_REQUIREMENT: "Age requirement not met",
3245
+ KYC_DUPLICATE_IDENTITY: "This identity has already been verified under another account",
3246
+ KYC_ADDRESS_MISMATCH: "Address verification failed",
3247
+ KYC_NAME_MISMATCH: "Name on document does not match the registered name",
3248
+ KYC_PROVIDER_REJECTED: "Identity verification was rejected by the verification provider",
3249
+ KYC_DECLINED: "Identity verification was declined"
3250
+ };
3251
+
3143
3252
  // src/tax/client.ts
3144
3253
  var TaxClient = class extends BaseClient {
3145
3254
  constructor(config) {
@@ -3424,6 +3533,7 @@ exports.ComplianceClient = ComplianceClient;
3424
3533
  exports.ComplianceError = ComplianceError;
3425
3534
  exports.DEFAULT_CURRENCY_RATES = DEFAULT_CURRENCY_RATES;
3426
3535
  exports.GeolocationClient = GeolocationClient;
3536
+ exports.KYC_DECLINED_DESCRIPTIONS = KYC_DECLINED_DESCRIPTIONS;
3427
3537
  exports.KycClient = KycClient;
3428
3538
  exports.NetworkError = NetworkError;
3429
3539
  exports.RateLimitError = RateLimitError;
@@ -3443,6 +3553,7 @@ exports.decodeCipherText = decodeCipherText;
3443
3553
  exports.generateCipherText = generateCipherText;
3444
3554
  exports.isCipherTextExpired = isCipherTextExpired;
3445
3555
  exports.noopLogger = noopLogger;
3556
+ exports.sdkReasons = sdkReasons;
3446
3557
  exports.verifyWebhookSignature = verifyWebhookSignature;
3447
3558
  //# sourceMappingURL=index.js.map
3448
3559
  //# sourceMappingURL=index.js.map