vesant-sdk 1.7.1-dev.a461ee2 → 1.7.1-dev.a6a3bb0

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.
package/dist/react.d.mts CHANGED
@@ -1,5 +1,5 @@
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-5q4whhGu.mjs';
3
3
  import { RiskProfileClient } from './risk-profile/index.mjs';
4
4
  import { C as CustomerProfile } from './types-BOFaMQxI.mjs';
5
5
  import { KycClient, CreateEventBasedFaceVerificationSessionRequest, CreateEventBasedFaceVerificationSessionResponse, EventBasedFaceVerificationCallback, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult } from './kyc/index.mjs';
@@ -63,6 +63,12 @@ declare function createDeviceFingerprint(): DeviceFingerprintRequest;
63
63
  /**
64
64
  * React hook for generating cipherText
65
65
  *
66
+ * The tenant's GPS requirements are read from the client before each generation.
67
+ * The client reuses a fetched copy for a short period, so this does not add a
68
+ * request per event, and a requirement changed in the compliance console takes
69
+ * effect without reloading the page. Call `refreshConfig` to apply a change
70
+ * immediately.
71
+ *
66
72
  * @example
67
73
  * ```tsx
68
74
  * function LoginForm() {
@@ -79,6 +85,7 @@ declare function createDeviceFingerprint(): DeviceFingerprintRequest;
79
85
  */
80
86
  declare function useCipherText(client?: GeolocationClient): {
81
87
  generate: (options: CipherTextOptions) => Promise<CipherTextResult | null>;
88
+ refreshConfig: () => Promise<void>;
82
89
  configLoading: boolean;
83
90
  configError: Error | null;
84
91
  };
package/dist/react.d.ts CHANGED
@@ -1,5 +1,5 @@
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-DUHC-68_.js';
3
3
  import { RiskProfileClient } from './risk-profile/index.js';
4
4
  import { C as CustomerProfile } from './types-UGyDl1fd.js';
5
5
  import { KycClient, CreateEventBasedFaceVerificationSessionRequest, CreateEventBasedFaceVerificationSessionResponse, EventBasedFaceVerificationCallback, UseKycAlertsOptions, UseKycAlertsResult, UseKycOverviewOptions, UseKycOverviewResult, UseKycPreferencesResult, UseKycRequestsOptions, UseKycRequestsResult, UseKycSubmissionOptions, UseKycSubmissionResult } from './kyc/index.js';
@@ -63,6 +63,12 @@ declare function createDeviceFingerprint(): DeviceFingerprintRequest;
63
63
  /**
64
64
  * React hook for generating cipherText
65
65
  *
66
+ * The tenant's GPS requirements are read from the client before each generation.
67
+ * The client reuses a fetched copy for a short period, so this does not add a
68
+ * request per event, and a requirement changed in the compliance console takes
69
+ * effect without reloading the page. Call `refreshConfig` to apply a change
70
+ * immediately.
71
+ *
66
72
  * @example
67
73
  * ```tsx
68
74
  * function LoginForm() {
@@ -79,6 +85,7 @@ declare function createDeviceFingerprint(): DeviceFingerprintRequest;
79
85
  */
80
86
  declare function useCipherText(client?: GeolocationClient): {
81
87
  generate: (options: CipherTextOptions) => Promise<CipherTextResult | null>;
88
+ refreshConfig: () => Promise<void>;
82
89
  configLoading: boolean;
83
90
  configError: Error | null;
84
91
  };
package/dist/react.js CHANGED
@@ -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([]);
@@ -1023,9 +1028,14 @@ function retryTarget(hasHostedJourney) {
1023
1028
  function modalMaxWidth(hasHostedJourney) {
1024
1029
  return hasHostedJourney ? 680 : 448;
1025
1030
  }
1031
+ function resultForModalClose(stageKind, result) {
1032
+ const terminal = stageKind === "accepted" || stageKind === "declined" || stageKind === "max_attempts";
1033
+ return terminal && result !== void 0 ? result : null;
1034
+ }
1026
1035
 
1027
1036
  // src/kyc/FaceCaptureModal.tsx
1028
1037
  var MOBILE_UA = /Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i;
1038
+ var ACCEPTED_AUTO_CLOSE_MS = 1200;
1029
1039
  var LIVENESS_MESSAGES = [
1030
1040
  "Position your face inside the oval",
1031
1041
  "Make sure your face is well lit",
@@ -1322,12 +1332,22 @@ function FaceCaptureModal({
1322
1332
  }, 3e3);
1323
1333
  return () => clearInterval(interval);
1324
1334
  }, [captureMode]);
1325
- const close = (result) => {
1335
+ const close = React.useCallback((result) => {
1326
1336
  cancelledRef.current = true;
1327
1337
  if (result === null && onCancel) {
1328
1338
  onCancel();
1329
1339
  }
1330
1340
  onComplete(result);
1341
+ }, [onCancel, onComplete]);
1342
+ React.useEffect(() => {
1343
+ if (stage.kind !== "accepted") return;
1344
+ const result = stage.result;
1345
+ const timer = setTimeout(() => close(result), ACCEPTED_AUTO_CLOSE_MS);
1346
+ return () => clearTimeout(timer);
1347
+ }, [close, stage]);
1348
+ const handleHeaderClose = () => {
1349
+ const result = "result" in stage ? stage.result : void 0;
1350
+ close(resultForModalClose(stage.kind, result));
1331
1351
  };
1332
1352
  const renderChoose = () => /* @__PURE__ */ React__default.default.createElement("div", { style: contentStyle }, /* @__PURE__ */ React__default.default.createElement("div", { style: visualGuideContainerStyle }, /* @__PURE__ */ React__default.default.createElement("div", { style: visualGuideStyle }, /* @__PURE__ */ React__default.default.createElement("div", { style: circleStyle }, /* @__PURE__ */ React__default.default.createElement("img", { src: Camera, alt: "", width: 48, height: 48 })))), /* @__PURE__ */ React__default.default.createElement("p", { style: subtitleStyle }, "How would you like to verify?"), /* @__PURE__ */ React__default.default.createElement("div", { style: buttonsContainerStyle }, /* @__PURE__ */ React__default.default.createElement(
1333
1353
  "button",
@@ -1433,7 +1453,7 @@ function FaceCaptureModal({
1433
1453
  return /* @__PURE__ */ React__default.default.createElement(React__default.default.Fragment, null, /* @__PURE__ */ React__default.default.createElement("style", null, keyframes), /* @__PURE__ */ React__default.default.createElement("div", { style: overlayStyle }, /* @__PURE__ */ React__default.default.createElement("div", { style: { ...modalStyle, maxWidth: modalMaxWidth(journeyMode) } }, /* @__PURE__ */ React__default.default.createElement("div", { style: headerStyle }, /* @__PURE__ */ React__default.default.createElement(
1434
1454
  "button",
1435
1455
  {
1436
- onClick: () => close(null),
1456
+ onClick: handleHeaderClose,
1437
1457
  style: closeButtonStyle,
1438
1458
  "aria-label": "Close"
1439
1459
  },