vesant-sdk 1.7.1-dev.301c6df → 1.7.1-dev.328baf7

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 (41) hide show
  1. package/dist/{client-D23KhWeh.d.mts → client-5q4whhGu.d.mts} +1 -1
  2. package/dist/{client-fy3trF2K.d.ts → client-BaUekQT8.d.ts} +32 -10
  3. package/dist/{client-B3DCAHlg.d.ts → client-DUHC-68_.d.ts} +1 -1
  4. package/dist/{client-BwXMQA2a.d.mts → client-XDEhh9VN.d.mts} +32 -10
  5. package/dist/compliance/index.d.mts +2 -2
  6. package/dist/compliance/index.d.ts +2 -2
  7. package/dist/compliance/index.js +39 -1
  8. package/dist/compliance/index.js.map +1 -1
  9. package/dist/compliance/index.mjs +39 -1
  10. package/dist/compliance/index.mjs.map +1 -1
  11. package/dist/geolocation/index.d.mts +2 -2
  12. package/dist/geolocation/index.d.ts +2 -2
  13. package/dist/geolocation/index.js +39 -1
  14. package/dist/geolocation/index.js.map +1 -1
  15. package/dist/geolocation/index.mjs +39 -1
  16. package/dist/geolocation/index.mjs.map +1 -1
  17. package/dist/index.d.mts +3 -3
  18. package/dist/index.d.ts +3 -3
  19. package/dist/index.js +66 -8
  20. package/dist/index.js.map +1 -1
  21. package/dist/index.mjs +66 -9
  22. package/dist/index.mjs.map +1 -1
  23. package/dist/kyc/core.d.mts +1 -1
  24. package/dist/kyc/core.d.ts +1 -1
  25. package/dist/kyc/core.js +27 -7
  26. package/dist/kyc/core.js.map +1 -1
  27. package/dist/kyc/core.mjs +27 -8
  28. package/dist/kyc/core.mjs.map +1 -1
  29. package/dist/kyc/index.d.mts +150 -26
  30. package/dist/kyc/index.d.ts +150 -26
  31. package/dist/kyc/index.js +27 -7
  32. package/dist/kyc/index.js.map +1 -1
  33. package/dist/kyc/index.mjs +27 -8
  34. package/dist/kyc/index.mjs.map +1 -1
  35. package/dist/react.d.mts +9 -2
  36. package/dist/react.d.ts +9 -2
  37. package/dist/react.js +166 -35
  38. package/dist/react.js.map +1 -1
  39. package/dist/react.mjs +166 -35
  40. package/dist/react.mjs.map +1 -1
  41. package/package.json +1 -1
package/dist/index.mjs CHANGED
@@ -1102,6 +1102,7 @@ function isCipherTextExpired(cipherText) {
1102
1102
  }
1103
1103
 
1104
1104
  // src/geolocation/client.ts
1105
+ var DEFAULT_GPS_CONFIG_TTL_MS = 5 * 60 * 1e3;
1105
1106
  var GeolocationClient = class extends BaseClient {
1106
1107
  constructor(config) {
1107
1108
  const baseConfig = {
@@ -1117,6 +1118,8 @@ var GeolocationClient = class extends BaseClient {
1117
1118
  environment: config.environment
1118
1119
  };
1119
1120
  super(baseConfig);
1121
+ this.gpsConfigCache = null;
1122
+ this.gpsConfigTtlMs = config.gpsConfigTtlMs ?? DEFAULT_GPS_CONFIG_TTL_MS;
1120
1123
  }
1121
1124
  // ============================================================================
1122
1125
  // IP Verification & Compliance
@@ -1202,7 +1205,42 @@ var GeolocationClient = class extends BaseClient {
1202
1205
  * ```
1203
1206
  */
1204
1207
  async getGPSConfig(requestOptions) {
1205
- return this.requestWithRetry("/api/v1/geo/config", void 0, void 0, void 0, requestOptions);
1208
+ const cached = this.gpsConfigCache;
1209
+ if (cached && cached.expiresAt > Date.now()) {
1210
+ return cached.value;
1211
+ }
1212
+ return this.refreshGPSConfig(requestOptions);
1213
+ }
1214
+ /**
1215
+ * Re-read the tenant's GPS requirement configuration, ignoring any copy held
1216
+ * from an earlier read.
1217
+ *
1218
+ * These requirements are edited in the compliance console while your
1219
+ * application is running. `getGPSConfig` reuses a fetched copy for a short
1220
+ * period so a long-lived session does not call the API on every event; call
1221
+ * this when you need a change to take effect immediately — for example right
1222
+ * after an administrator saves new settings.
1223
+ *
1224
+ * @returns The current GPS requirement config per event type
1225
+ *
1226
+ * @example
1227
+ * ```typescript
1228
+ * const config = await client.refreshGPSConfig();
1229
+ * if (config.require_gps.login) {
1230
+ * // GPS is now required for login
1231
+ * }
1232
+ * ```
1233
+ */
1234
+ async refreshGPSConfig(requestOptions) {
1235
+ const value = await this.requestWithRetry(
1236
+ "/api/v1/geo/config",
1237
+ void 0,
1238
+ void 0,
1239
+ void 0,
1240
+ requestOptions
1241
+ );
1242
+ this.gpsConfigCache = { value, expiresAt: Date.now() + this.gpsConfigTtlMs };
1243
+ return value;
1206
1244
  }
1207
1245
  /**
1208
1246
  * Mint a short-lived, single-use device-signals nonce.
@@ -2961,10 +2999,9 @@ var KycClient = class extends BaseClient {
2961
2999
  * Create a Event-Based Face Verification session.
2962
3000
  *
2963
3001
  * Inspect the response before showing UI:
2964
- * - `is_required === false` → skip face capture; `reason` explains why.
2965
- * - `device_type === 'desktop'` → render `qr_payload` as a QR; the
2966
- * mobile device picks up the session via the connect endpoint.
2967
- * - `device_type === 'mobile'` → open the face capture modal directly.
3002
+ * - `is_required === false` → skip face verification; `reason` explains why.
3003
+ * - `verification_url` present → embed the hosted journey and poll status.
3004
+ * - `verification_url` absent → use the local camera / QR fallback.
2968
3005
  *
2969
3006
  * @param request - Reference, customer_id, event, amount (for threshold events), optional URLs.
2970
3007
  */
@@ -3011,11 +3048,28 @@ var KycClient = class extends BaseClient {
3011
3048
  headers: this.getUserHeaders()
3012
3049
  });
3013
3050
  }
3051
+ /**
3052
+ * Mint a fresh hosted verification journey for the next attempt on an
3053
+ * active session whose previous hosted-journey attempt was declined.
3054
+ * Only valid while the session is active and attempts remain; the
3055
+ * response carries the new `verification_url` to embed. Used internally
3056
+ * by `FaceCaptureModal`'s Try Again flow in hosted-journey mode.
3057
+ *
3058
+ * @param token - The session token returned by `createEventBasedFaceVerificationSession`.
3059
+ */
3060
+ async retryEventBasedFaceVerificationJourney(token) {
3061
+ return this.request("/api/v1/kyc/face/onsite/journey", {
3062
+ method: "POST",
3063
+ body: JSON.stringify({ token }),
3064
+ headers: this.getUserHeaders()
3065
+ });
3066
+ }
3014
3067
  /**
3015
3068
  * Fetch the Redis-backed handoff session for a token. Same backing
3016
- * store as normal KYC (`kyc:session:<token>`, 15-minute TTL). Desktop
3017
- * callers poll `mobile_connected` to detect when a mobile device has
3018
- * scanned the QR and attached.
3069
+ * store as normal KYC (`kyc:session:<token>`, 15-minute TTL). The
3070
+ * Event-Based Face Verification database session still expires after
3071
+ * 10 minutes. Desktop callers poll `mobile_connected` to detect when a
3072
+ * mobile device has scanned the QR and attached.
3019
3073
  *
3020
3074
  * @param token - The session token returned by `createEventBasedFaceVerificationSession`.
3021
3075
  */
@@ -3524,6 +3578,9 @@ var KYC_DECLINED_DESCRIPTIONS = {
3524
3578
  KYC_PROVIDER_REJECTED: "Identity verification was rejected by the verification provider",
3525
3579
  KYC_DECLINED: "Identity verification was declined"
3526
3580
  };
3581
+ function isKycDocumentExpiredCallbackEvent(value) {
3582
+ return typeof value === "object" && value !== null && value.event === "kyc_document_expired";
3583
+ }
3527
3584
 
3528
3585
  // src/tax/client.ts
3529
3586
  var TaxClient = class extends BaseClient {
@@ -3813,6 +3870,6 @@ function buildHandler(options) {
3813
3870
  return handler;
3814
3871
  }
3815
3872
 
3816
- export { AuthenticationError, BaseClient, CGSError, CircuitBreaker, CircuitBreakerOpenError, ComplianceBlockedError, ComplianceClient, ComplianceError, DEFAULT_CURRENCY_RATES, GeolocationClient, InMemoryDedupStore, KYC_DECLINED_DESCRIPTIONS, KycClient, NetworkError, RateLimitError, RateLimitTracker, RefreshingTokenProvider, RiskProfileClient, SDK_VERSION, ServiceUnavailableError, StaticApiKeyProvider, TaxClient, TimeoutError, ValidationError, VesantError, WebhookHandler, assessGpsIntegrity, collectAll, collectDeviceSignals, createConsoleLogger, createNextWebhookHandler, createWebhookMiddleware, decodeCipherText, generateCipherText, gpsIntegrityInputFromPosition, isCipherTextExpired, noopLogger, paginate, probeGeolocationPermission, sdkReasons, verifyWebhookSignature };
3873
+ export { AuthenticationError, BaseClient, CGSError, CircuitBreaker, CircuitBreakerOpenError, ComplianceBlockedError, ComplianceClient, ComplianceError, DEFAULT_CURRENCY_RATES, GeolocationClient, InMemoryDedupStore, KYC_DECLINED_DESCRIPTIONS, KycClient, NetworkError, RateLimitError, RateLimitTracker, RefreshingTokenProvider, RiskProfileClient, SDK_VERSION, ServiceUnavailableError, StaticApiKeyProvider, TaxClient, TimeoutError, ValidationError, VesantError, WebhookHandler, assessGpsIntegrity, collectAll, collectDeviceSignals, createConsoleLogger, createNextWebhookHandler, createWebhookMiddleware, decodeCipherText, generateCipherText, gpsIntegrityInputFromPosition, isCipherTextExpired, isKycDocumentExpiredCallbackEvent, noopLogger, paginate, probeGeolocationPermission, sdkReasons, verifyWebhookSignature };
3817
3874
  //# sourceMappingURL=index.mjs.map
3818
3875
  //# sourceMappingURL=index.mjs.map