vesant-sdk 1.7.2 → 1.8.0-dev.153299b

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 (69) hide show
  1. package/dist/{client-B3DCAHlg.d.ts → client-4oLoc31v.d.ts} +2 -2
  2. package/dist/{client-fy3trF2K.d.ts → client-BaUekQT8.d.ts} +32 -10
  3. package/dist/{client-D23KhWeh.d.mts → client-CJI8VO1i.d.mts} +2 -2
  4. package/dist/{client-BwXMQA2a.d.mts → client-XDEhh9VN.d.mts} +32 -10
  5. package/dist/compliance/index.d.mts +3 -3
  6. package/dist/compliance/index.d.ts +3 -3
  7. package/dist/compliance/index.js +59 -5
  8. package/dist/compliance/index.js.map +1 -1
  9. package/dist/compliance/index.mjs +59 -5
  10. package/dist/compliance/index.mjs.map +1 -1
  11. package/dist/decisions/index.js +1 -1
  12. package/dist/decisions/index.js.map +1 -1
  13. package/dist/decisions/index.mjs +1 -1
  14. package/dist/decisions/index.mjs.map +1 -1
  15. package/dist/geolocation/index.d.mts +2 -2
  16. package/dist/geolocation/index.d.ts +2 -2
  17. package/dist/geolocation/index.js +40 -2
  18. package/dist/geolocation/index.js.map +1 -1
  19. package/dist/geolocation/index.mjs +40 -2
  20. package/dist/geolocation/index.mjs.map +1 -1
  21. package/dist/{index-DSDgS09k.d.ts → index-BosFSGan.d.ts} +57 -2
  22. package/dist/{index-C3zUKydT.d.mts → index-C49a7fg2.d.mts} +57 -2
  23. package/dist/index.d.mts +6 -6
  24. package/dist/index.d.ts +6 -6
  25. package/dist/index.js +70 -5
  26. package/dist/index.js.map +1 -1
  27. package/dist/index.mjs +68 -6
  28. package/dist/index.mjs.map +1 -1
  29. package/dist/kyc/core.d.mts +2 -2
  30. package/dist/kyc/core.d.ts +2 -2
  31. package/dist/kyc/core.js +5 -1
  32. package/dist/kyc/core.js.map +1 -1
  33. package/dist/kyc/core.mjs +5 -2
  34. package/dist/kyc/core.mjs.map +1 -1
  35. package/dist/kyc/index.d.mts +103 -4
  36. package/dist/kyc/index.d.ts +103 -4
  37. package/dist/kyc/index.js +5 -1
  38. package/dist/kyc/index.js.map +1 -1
  39. package/dist/kyc/index.mjs +5 -2
  40. package/dist/kyc/index.mjs.map +1 -1
  41. package/dist/react.d.mts +17 -4
  42. package/dist/react.d.ts +17 -4
  43. package/dist/react.js +23 -11
  44. package/dist/react.js.map +1 -1
  45. package/dist/react.mjs +23 -11
  46. package/dist/react.mjs.map +1 -1
  47. package/dist/risk-profile/index.d.mts +16 -6
  48. package/dist/risk-profile/index.d.ts +16 -6
  49. package/dist/risk-profile/index.js +19 -3
  50. package/dist/risk-profile/index.js.map +1 -1
  51. package/dist/risk-profile/index.mjs +19 -4
  52. package/dist/risk-profile/index.mjs.map +1 -1
  53. package/dist/scores/index.js +1 -1
  54. package/dist/scores/index.js.map +1 -1
  55. package/dist/scores/index.mjs +1 -1
  56. package/dist/scores/index.mjs.map +1 -1
  57. package/dist/tax/index.js +1 -1
  58. package/dist/tax/index.js.map +1 -1
  59. package/dist/tax/index.mjs +1 -1
  60. package/dist/tax/index.mjs.map +1 -1
  61. package/dist/{types-UGyDl1fd.d.ts → types-1kI4SsKB.d.ts} +44 -1
  62. package/dist/{types-BOFaMQxI.d.mts → types-DfbnIaW_.d.mts} +44 -1
  63. package/dist/webhooks/index.d.mts +1 -1
  64. package/dist/webhooks/index.d.ts +1 -1
  65. package/dist/webhooks/index.js +6 -0
  66. package/dist/webhooks/index.js.map +1 -1
  67. package/dist/webhooks/index.mjs +6 -1
  68. package/dist/webhooks/index.mjs.map +1 -1
  69. package/package.json +1 -1
package/dist/react.mjs CHANGED
@@ -4,7 +4,7 @@ import { createRoot } from 'react-dom/client';
4
4
  // src/geolocation/hooks.ts
5
5
 
6
6
  // src/core/version.ts
7
- var SDK_VERSION = "1.7.2";
7
+ var SDK_VERSION = "1.8.0";
8
8
 
9
9
  // src/core/errors.ts
10
10
  var VesantError = class _VesantError extends Error {
@@ -423,14 +423,11 @@ function useCipherText(client) {
423
423
  const [configLoading, setConfigLoading] = useState(!!client);
424
424
  const [configError, setConfigError] = useState(null);
425
425
  const configRef = useRef(void 0);
426
- const configPromiseRef = useRef(null);
427
426
  useEffect(() => {
428
427
  if (!client) return;
429
428
  let cancelled = false;
430
429
  setConfigLoading(true);
431
- const promise = client.getGPSConfig();
432
- configPromiseRef.current = promise;
433
- promise.then((cfg) => {
430
+ client.getGPSConfig().then((cfg) => {
434
431
  if (!cancelled) {
435
432
  configRef.current = cfg;
436
433
  setConfigLoading(false);
@@ -445,13 +442,21 @@ function useCipherText(client) {
445
442
  cancelled = true;
446
443
  };
447
444
  }, [client]);
445
+ const refreshConfig = useCallback(async () => {
446
+ if (!client) return;
447
+ try {
448
+ configRef.current = await client.refreshGPSConfig();
449
+ setConfigError(null);
450
+ } catch (error) {
451
+ setConfigError(error instanceof Error ? error : new Error("Failed to refresh GPS config"));
452
+ }
453
+ }, [client]);
448
454
  const generate = useCallback(
449
455
  async (options) => {
450
456
  try {
451
- if (configPromiseRef.current) {
457
+ if (client) {
452
458
  try {
453
- const cfg = await configPromiseRef.current;
454
- configRef.current = cfg;
459
+ configRef.current = await client.getGPSConfig();
455
460
  } catch {
456
461
  }
457
462
  }
@@ -461,9 +466,9 @@ function useCipherText(client) {
461
466
  return null;
462
467
  }
463
468
  },
464
- []
469
+ [client]
465
470
  );
466
- return { generate, configLoading, configError };
471
+ return { generate, refreshConfig, configLoading, configError };
467
472
  }
468
473
  function useLocationRequests(client, options = {}) {
469
474
  const [requests, setRequests] = useState([]);
@@ -860,6 +865,13 @@ function useTransactionVerification(client, options = {}) {
860
865
  verifyTransaction
861
866
  };
862
867
  }
868
+
869
+ // src/risk-profile/types.ts
870
+ function isProfileUpdateHeld(result) {
871
+ return typeof result === "object" && result !== null && result.status === "kyc_required" && result.kyc_required === true;
872
+ }
873
+
874
+ // src/risk-profile/hooks.ts
863
875
  function useCustomerProfile(client, customerId, options = {}) {
864
876
  const [profile, setProfile] = useState(null);
865
877
  const [loading, setLoading] = useState(false);
@@ -888,7 +900,7 @@ function useCustomerProfile(client, customerId, options = {}) {
888
900
  setError(null);
889
901
  try {
890
902
  const updated = await client.updateProfile(profileRef.current.id, updates);
891
- setProfile(updated);
903
+ setProfile(isProfileUpdateHeld(updated) ? updated.profile : updated);
892
904
  return updated;
893
905
  } catch (err) {
894
906
  const error2 = err instanceof Error ? err : new Error("Failed to update profile");