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/{client-D23KhWeh.d.mts → client-5q4whhGu.d.mts} +1 -1
- package/dist/{client-fy3trF2K.d.ts → client-BaUekQT8.d.ts} +32 -10
- package/dist/{client-B3DCAHlg.d.ts → client-DUHC-68_.d.ts} +1 -1
- package/dist/{client-BwXMQA2a.d.mts → client-XDEhh9VN.d.mts} +32 -10
- package/dist/compliance/index.d.mts +2 -2
- package/dist/compliance/index.d.ts +2 -2
- package/dist/compliance/index.js +39 -1
- package/dist/compliance/index.js.map +1 -1
- package/dist/compliance/index.mjs +39 -1
- package/dist/compliance/index.mjs.map +1 -1
- package/dist/geolocation/index.d.mts +2 -2
- package/dist/geolocation/index.d.ts +2 -2
- package/dist/geolocation/index.js +39 -1
- package/dist/geolocation/index.js.map +1 -1
- package/dist/geolocation/index.mjs +39 -1
- package/dist/geolocation/index.mjs.map +1 -1
- package/dist/index.d.mts +2 -2
- package/dist/index.d.ts +2 -2
- package/dist/index.js +39 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +39 -1
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +9 -2
- package/dist/react.d.ts +9 -2
- package/dist/react.js +31 -11
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +31 -11
- package/dist/react.mjs.map +1 -1
- package/package.json +1 -1
package/dist/react.mjs
CHANGED
|
@@ -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
|
-
|
|
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 (
|
|
457
|
+
if (client) {
|
|
452
458
|
try {
|
|
453
|
-
|
|
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([]);
|
|
@@ -1017,9 +1022,14 @@ function retryTarget(hasHostedJourney) {
|
|
|
1017
1022
|
function modalMaxWidth(hasHostedJourney) {
|
|
1018
1023
|
return hasHostedJourney ? 680 : 448;
|
|
1019
1024
|
}
|
|
1025
|
+
function resultForModalClose(stageKind, result) {
|
|
1026
|
+
const terminal = stageKind === "accepted" || stageKind === "declined" || stageKind === "max_attempts";
|
|
1027
|
+
return terminal && result !== void 0 ? result : null;
|
|
1028
|
+
}
|
|
1020
1029
|
|
|
1021
1030
|
// src/kyc/FaceCaptureModal.tsx
|
|
1022
1031
|
var MOBILE_UA = /Mobi|Android|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i;
|
|
1032
|
+
var ACCEPTED_AUTO_CLOSE_MS = 1200;
|
|
1023
1033
|
var LIVENESS_MESSAGES = [
|
|
1024
1034
|
"Position your face inside the oval",
|
|
1025
1035
|
"Make sure your face is well lit",
|
|
@@ -1316,12 +1326,22 @@ function FaceCaptureModal({
|
|
|
1316
1326
|
}, 3e3);
|
|
1317
1327
|
return () => clearInterval(interval);
|
|
1318
1328
|
}, [captureMode]);
|
|
1319
|
-
const close = (result) => {
|
|
1329
|
+
const close = useCallback((result) => {
|
|
1320
1330
|
cancelledRef.current = true;
|
|
1321
1331
|
if (result === null && onCancel) {
|
|
1322
1332
|
onCancel();
|
|
1323
1333
|
}
|
|
1324
1334
|
onComplete(result);
|
|
1335
|
+
}, [onCancel, onComplete]);
|
|
1336
|
+
useEffect(() => {
|
|
1337
|
+
if (stage.kind !== "accepted") return;
|
|
1338
|
+
const result = stage.result;
|
|
1339
|
+
const timer = setTimeout(() => close(result), ACCEPTED_AUTO_CLOSE_MS);
|
|
1340
|
+
return () => clearTimeout(timer);
|
|
1341
|
+
}, [close, stage]);
|
|
1342
|
+
const handleHeaderClose = () => {
|
|
1343
|
+
const result = "result" in stage ? stage.result : void 0;
|
|
1344
|
+
close(resultForModalClose(stage.kind, result));
|
|
1325
1345
|
};
|
|
1326
1346
|
const renderChoose = () => /* @__PURE__ */ React.createElement("div", { style: contentStyle }, /* @__PURE__ */ React.createElement("div", { style: visualGuideContainerStyle }, /* @__PURE__ */ React.createElement("div", { style: visualGuideStyle }, /* @__PURE__ */ React.createElement("div", { style: circleStyle }, /* @__PURE__ */ React.createElement("img", { src: Camera, alt: "", width: 48, height: 48 })))), /* @__PURE__ */ React.createElement("p", { style: subtitleStyle }, "How would you like to verify?"), /* @__PURE__ */ React.createElement("div", { style: buttonsContainerStyle }, /* @__PURE__ */ React.createElement(
|
|
1327
1347
|
"button",
|
|
@@ -1427,7 +1447,7 @@ function FaceCaptureModal({
|
|
|
1427
1447
|
return /* @__PURE__ */ React.createElement(React.Fragment, null, /* @__PURE__ */ React.createElement("style", null, keyframes), /* @__PURE__ */ React.createElement("div", { style: overlayStyle }, /* @__PURE__ */ React.createElement("div", { style: { ...modalStyle, maxWidth: modalMaxWidth(journeyMode) } }, /* @__PURE__ */ React.createElement("div", { style: headerStyle }, /* @__PURE__ */ React.createElement(
|
|
1428
1448
|
"button",
|
|
1429
1449
|
{
|
|
1430
|
-
onClick:
|
|
1450
|
+
onClick: handleHeaderClose,
|
|
1431
1451
|
style: closeButtonStyle,
|
|
1432
1452
|
"aria-label": "Close"
|
|
1433
1453
|
},
|