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.d.mts CHANGED
@@ -1,7 +1,7 @@
1
- import { D as DeviceFingerprintRequest, G as GeolocationClient, i as CipherTextOptions, l as CipherTextResult, Y as UseGeolocationOptions, Z as UseGeolocationResult, _ as UseLocationCaptureOptions, $ as UseLocationCaptureResult, a0 as UseLocationRequestsOptions, a1 as UseLocationRequestsResult } from './client-BwXMQA2a.mjs';
2
- import { e as LoginVerificationResponse, L as LoginVerificationRequest, f as RegistrationVerificationResponse, R as RegistrationVerificationRequest, h as TransactionVerificationResponse, g as TransactionVerificationRequest, C as ComplianceClient } from './client-D23KhWeh.mjs';
1
+ import { D as DeviceFingerprintRequest, G as GeolocationClient, i as CipherTextOptions, l as CipherTextResult, Y as UseGeolocationOptions, Z as UseGeolocationResult, _ as UseLocationCaptureOptions, $ as UseLocationCaptureResult, a0 as UseLocationRequestsOptions, a1 as UseLocationRequestsResult } from './client-XDEhh9VN.mjs';
2
+ import { e as LoginVerificationResponse, L as LoginVerificationRequest, f as RegistrationVerificationResponse, R as RegistrationVerificationRequest, h as TransactionVerificationResponse, g as TransactionVerificationRequest, C as ComplianceClient } from './client-CJI8VO1i.mjs';
3
3
  import { RiskProfileClient } from './risk-profile/index.mjs';
4
- import { C as CustomerProfile } from './types-BOFaMQxI.mjs';
4
+ import { C as CustomerProfile, j as UpdateProfileResult } from './types-DfbnIaW_.mjs';
5
5
  import { CreateEventBasedFaceVerificationSessionResponse, EventBasedFaceVerificationCallback, KycClient, CreateEventBasedFaceVerificationSessionRequest, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult } from './kyc/index.mjs';
6
6
  import React$1 from 'react';
7
7
  import './client-q9fN8Hhf.mjs';
@@ -64,6 +64,12 @@ declare function createDeviceFingerprint(): DeviceFingerprintRequest;
64
64
  /**
65
65
  * React hook for generating cipherText
66
66
  *
67
+ * The tenant's GPS requirements are read from the client before each generation.
68
+ * The client reuses a fetched copy for a short period, so this does not add a
69
+ * request per event, and a requirement changed in the compliance console takes
70
+ * effect without reloading the page. Call `refreshConfig` to apply a change
71
+ * immediately.
72
+ *
67
73
  * @example
68
74
  * ```tsx
69
75
  * function LoginForm() {
@@ -80,6 +86,7 @@ declare function createDeviceFingerprint(): DeviceFingerprintRequest;
80
86
  */
81
87
  declare function useCipherText(client?: GeolocationClient): {
82
88
  generate: (options: CipherTextOptions) => Promise<CipherTextResult | null>;
89
+ refreshConfig: () => Promise<void>;
83
90
  configLoading: boolean;
84
91
  configError: Error | null;
85
92
  };
@@ -214,7 +221,13 @@ interface UseCustomerProfileResult {
214
221
  loading: boolean;
215
222
  error: Error | null;
216
223
  fetchProfile: () => Promise<CustomerProfile>;
217
- updateProfile: (updates: Partial<CustomerProfile>) => Promise<CustomerProfile>;
224
+ /**
225
+ * Update the loaded profile. Resolves to the updated profile, or to a
226
+ * `ProfileUpdateHeldResponse` when the tenant holds a name / date of birth /
227
+ * address change behind KYC — narrow with `isProfileUpdateHeld`. The hook's
228
+ * `profile` state is updated either way (with the profile as stored).
229
+ */
230
+ updateProfile: (updates: Partial<CustomerProfile>) => Promise<UpdateProfileResult>;
218
231
  refresh: () => Promise<CustomerProfile>;
219
232
  }
220
233
  /**
package/dist/react.d.ts CHANGED
@@ -1,7 +1,7 @@
1
- import { D as DeviceFingerprintRequest, G as GeolocationClient, i as CipherTextOptions, l as CipherTextResult, Y as UseGeolocationOptions, Z as UseGeolocationResult, _ as UseLocationCaptureOptions, $ as UseLocationCaptureResult, a0 as UseLocationRequestsOptions, a1 as UseLocationRequestsResult } from './client-fy3trF2K.js';
2
- import { e as LoginVerificationResponse, L as LoginVerificationRequest, f as RegistrationVerificationResponse, R as RegistrationVerificationRequest, h as TransactionVerificationResponse, g as TransactionVerificationRequest, C as ComplianceClient } from './client-B3DCAHlg.js';
1
+ import { D as DeviceFingerprintRequest, G as GeolocationClient, i as CipherTextOptions, l as CipherTextResult, Y as UseGeolocationOptions, Z as UseGeolocationResult, _ as UseLocationCaptureOptions, $ as UseLocationCaptureResult, a0 as UseLocationRequestsOptions, a1 as UseLocationRequestsResult } from './client-BaUekQT8.js';
2
+ import { e as LoginVerificationResponse, L as LoginVerificationRequest, f as RegistrationVerificationResponse, R as RegistrationVerificationRequest, h as TransactionVerificationResponse, g as TransactionVerificationRequest, C as ComplianceClient } from './client-4oLoc31v.js';
3
3
  import { RiskProfileClient } from './risk-profile/index.js';
4
- import { C as CustomerProfile } from './types-UGyDl1fd.js';
4
+ import { C as CustomerProfile, j as UpdateProfileResult } from './types-1kI4SsKB.js';
5
5
  import { CreateEventBasedFaceVerificationSessionResponse, EventBasedFaceVerificationCallback, KycClient, CreateEventBasedFaceVerificationSessionRequest, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult } from './kyc/index.js';
6
6
  import React$1 from 'react';
7
7
  import './client-q9fN8Hhf.js';
@@ -64,6 +64,12 @@ declare function createDeviceFingerprint(): DeviceFingerprintRequest;
64
64
  /**
65
65
  * React hook for generating cipherText
66
66
  *
67
+ * The tenant's GPS requirements are read from the client before each generation.
68
+ * The client reuses a fetched copy for a short period, so this does not add a
69
+ * request per event, and a requirement changed in the compliance console takes
70
+ * effect without reloading the page. Call `refreshConfig` to apply a change
71
+ * immediately.
72
+ *
67
73
  * @example
68
74
  * ```tsx
69
75
  * function LoginForm() {
@@ -80,6 +86,7 @@ declare function createDeviceFingerprint(): DeviceFingerprintRequest;
80
86
  */
81
87
  declare function useCipherText(client?: GeolocationClient): {
82
88
  generate: (options: CipherTextOptions) => Promise<CipherTextResult | null>;
89
+ refreshConfig: () => Promise<void>;
83
90
  configLoading: boolean;
84
91
  configError: Error | null;
85
92
  };
@@ -214,7 +221,13 @@ interface UseCustomerProfileResult {
214
221
  loading: boolean;
215
222
  error: Error | null;
216
223
  fetchProfile: () => Promise<CustomerProfile>;
217
- updateProfile: (updates: Partial<CustomerProfile>) => Promise<CustomerProfile>;
224
+ /**
225
+ * Update the loaded profile. Resolves to the updated profile, or to a
226
+ * `ProfileUpdateHeldResponse` when the tenant holds a name / date of birth /
227
+ * address change behind KYC — narrow with `isProfileUpdateHeld`. The hook's
228
+ * `profile` state is updated either way (with the profile as stored).
229
+ */
230
+ updateProfile: (updates: Partial<CustomerProfile>) => Promise<UpdateProfileResult>;
218
231
  refresh: () => Promise<CustomerProfile>;
219
232
  }
220
233
  /**
package/dist/react.js CHANGED
@@ -10,7 +10,7 @@ var React__default = /*#__PURE__*/_interopDefault(React);
10
10
  // src/geolocation/hooks.ts
11
11
 
12
12
  // src/core/version.ts
13
- var SDK_VERSION = "1.7.2";
13
+ var SDK_VERSION = "1.8.0";
14
14
 
15
15
  // src/core/errors.ts
16
16
  var VesantError = class _VesantError extends Error {
@@ -429,14 +429,11 @@ function useCipherText(client) {
429
429
  const [configLoading, setConfigLoading] = React.useState(!!client);
430
430
  const [configError, setConfigError] = React.useState(null);
431
431
  const configRef = React.useRef(void 0);
432
- const configPromiseRef = React.useRef(null);
433
432
  React.useEffect(() => {
434
433
  if (!client) return;
435
434
  let cancelled = false;
436
435
  setConfigLoading(true);
437
- const promise = client.getGPSConfig();
438
- configPromiseRef.current = promise;
439
- promise.then((cfg) => {
436
+ client.getGPSConfig().then((cfg) => {
440
437
  if (!cancelled) {
441
438
  configRef.current = cfg;
442
439
  setConfigLoading(false);
@@ -451,13 +448,21 @@ function useCipherText(client) {
451
448
  cancelled = true;
452
449
  };
453
450
  }, [client]);
451
+ const refreshConfig = React.useCallback(async () => {
452
+ if (!client) return;
453
+ try {
454
+ configRef.current = await client.refreshGPSConfig();
455
+ setConfigError(null);
456
+ } catch (error) {
457
+ setConfigError(error instanceof Error ? error : new Error("Failed to refresh GPS config"));
458
+ }
459
+ }, [client]);
454
460
  const generate = React.useCallback(
455
461
  async (options) => {
456
462
  try {
457
- if (configPromiseRef.current) {
463
+ if (client) {
458
464
  try {
459
- const cfg = await configPromiseRef.current;
460
- configRef.current = cfg;
465
+ configRef.current = await client.getGPSConfig();
461
466
  } catch {
462
467
  }
463
468
  }
@@ -467,9 +472,9 @@ function useCipherText(client) {
467
472
  return null;
468
473
  }
469
474
  },
470
- []
475
+ [client]
471
476
  );
472
- return { generate, configLoading, configError };
477
+ return { generate, refreshConfig, configLoading, configError };
473
478
  }
474
479
  function useLocationRequests(client, options = {}) {
475
480
  const [requests, setRequests] = React.useState([]);
@@ -866,6 +871,13 @@ function useTransactionVerification(client, options = {}) {
866
871
  verifyTransaction
867
872
  };
868
873
  }
874
+
875
+ // src/risk-profile/types.ts
876
+ function isProfileUpdateHeld(result) {
877
+ return typeof result === "object" && result !== null && result.status === "kyc_required" && result.kyc_required === true;
878
+ }
879
+
880
+ // src/risk-profile/hooks.ts
869
881
  function useCustomerProfile(client, customerId, options = {}) {
870
882
  const [profile, setProfile] = React.useState(null);
871
883
  const [loading, setLoading] = React.useState(false);
@@ -894,7 +906,7 @@ function useCustomerProfile(client, customerId, options = {}) {
894
906
  setError(null);
895
907
  try {
896
908
  const updated = await client.updateProfile(profileRef.current.id, updates);
897
- setProfile(updated);
909
+ setProfile(isProfileUpdateHeld(updated) ? updated.profile : updated);
898
910
  return updated;
899
911
  } catch (err) {
900
912
  const error2 = err instanceof Error ? err : new Error("Failed to update profile");