astra-sdk-web 1.1.1 → 1.1.3
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/astra-sdk.cjs.js +18 -23
- package/dist/astra-sdk.cjs.js.map +1 -1
- package/dist/astra-sdk.es.js +19 -24
- package/dist/astra-sdk.es.js.map +1 -1
- package/dist/components.cjs.js +18 -23
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +19 -24
- package/dist/components.es.js.map +1 -1
- package/package.json +1 -1
- package/src/components/KycFlow.tsx +20 -9
- package/src/pages/MobileRoute.tsx +5 -9
- package/src/pages/QRCodePage.tsx +7 -14
package/dist/components.es.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import React, { createContext, useState, useEffect, useRef, useContext, useCallback } from 'react';
|
|
2
2
|
import { jsx, jsxs } from 'react/jsx-runtime';
|
|
3
|
-
import {
|
|
3
|
+
import { useNavigate } from 'react-router-dom';
|
|
4
4
|
import { FACEMESH_TESSELATION, FACEMESH_FACE_OVAL, FACEMESH_LEFT_EYE, FACEMESH_RIGHT_EYE, FACEMESH_LIPS, FaceMesh } from '@mediapipe/face_mesh';
|
|
5
5
|
import { drawConnectors, drawLandmarks } from '@mediapipe/drawing_utils';
|
|
6
6
|
import { QRCodeSVG } from 'qrcode.react';
|
|
@@ -1319,19 +1319,16 @@ function FaceScanModal({ onComplete }) {
|
|
|
1319
1319
|
] }) });
|
|
1320
1320
|
}
|
|
1321
1321
|
var FaceScanModal_default = FaceScanModal;
|
|
1322
|
-
function MobileRoute({ onClose } = {}) {
|
|
1323
|
-
const navigate = useNavigate();
|
|
1322
|
+
function MobileRoute({ onClose, onNavigate } = {}) {
|
|
1324
1323
|
useEffect(() => {
|
|
1325
|
-
if (!isMobileDevice()) {
|
|
1326
|
-
|
|
1324
|
+
if (!isMobileDevice() && onNavigate) {
|
|
1325
|
+
onNavigate("qr");
|
|
1327
1326
|
return;
|
|
1328
1327
|
}
|
|
1329
|
-
}, [
|
|
1328
|
+
}, [onNavigate]);
|
|
1330
1329
|
const handleClose = () => {
|
|
1331
1330
|
if (onClose) {
|
|
1332
1331
|
onClose();
|
|
1333
|
-
} else {
|
|
1334
|
-
navigate(-1);
|
|
1335
1332
|
}
|
|
1336
1333
|
};
|
|
1337
1334
|
const handleComplete = (capturedImage) => {
|
|
@@ -1343,22 +1340,17 @@ function MobileRoute({ onClose } = {}) {
|
|
|
1343
1340
|
return /* @__PURE__ */ jsx(FaceScanModal_default, { onClose: handleClose, onComplete: handleComplete });
|
|
1344
1341
|
}
|
|
1345
1342
|
var MobileRoute_default = MobileRoute;
|
|
1346
|
-
function QRCodePage({ onClose } = {}) {
|
|
1347
|
-
const [searchParams] = useSearchParams();
|
|
1348
|
-
const navigate = useNavigate();
|
|
1343
|
+
function QRCodePage({ onClose, onNavigate } = {}) {
|
|
1349
1344
|
const [qrUrl, setQrUrl] = useState("");
|
|
1350
1345
|
const [copied, setCopied] = useState(false);
|
|
1351
1346
|
useEffect(() => {
|
|
1352
1347
|
const currentUrl = window.location.origin;
|
|
1353
|
-
const
|
|
1354
|
-
searchParams.forEach((value, key) => {
|
|
1355
|
-
params[key] = value;
|
|
1356
|
-
});
|
|
1348
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
1357
1349
|
const mobileRoute = "/mobileroute";
|
|
1358
|
-
const queryString =
|
|
1350
|
+
const queryString = searchParams.toString();
|
|
1359
1351
|
const fullUrl = `${currentUrl}${mobileRoute}${queryString ? `?${queryString}` : ""}`;
|
|
1360
1352
|
setQrUrl(fullUrl);
|
|
1361
|
-
}, [
|
|
1353
|
+
}, []);
|
|
1362
1354
|
const handleCopyUrl = async () => {
|
|
1363
1355
|
if (qrUrl) {
|
|
1364
1356
|
try {
|
|
@@ -1373,8 +1365,6 @@ function QRCodePage({ onClose } = {}) {
|
|
|
1373
1365
|
const handleClose = () => {
|
|
1374
1366
|
if (onClose) {
|
|
1375
1367
|
onClose();
|
|
1376
|
-
} else {
|
|
1377
|
-
navigate(-1);
|
|
1378
1368
|
}
|
|
1379
1369
|
};
|
|
1380
1370
|
const handleRefresh = () => {
|
|
@@ -1446,6 +1436,15 @@ var KycFlow = ({
|
|
|
1446
1436
|
startAtQr = true,
|
|
1447
1437
|
onClose
|
|
1448
1438
|
}) => {
|
|
1439
|
+
const [currentView, setCurrentView] = useState(startAtQr ? "qr" : "mobileroute");
|
|
1440
|
+
const handleNavigate = (view) => {
|
|
1441
|
+
setCurrentView(view);
|
|
1442
|
+
};
|
|
1443
|
+
const handleClose = () => {
|
|
1444
|
+
if (onClose) {
|
|
1445
|
+
onClose();
|
|
1446
|
+
}
|
|
1447
|
+
};
|
|
1449
1448
|
return /* @__PURE__ */ jsx(
|
|
1450
1449
|
KycProvider,
|
|
1451
1450
|
{
|
|
@@ -1453,11 +1452,7 @@ var KycFlow = ({
|
|
|
1453
1452
|
sessionId,
|
|
1454
1453
|
serverKey,
|
|
1455
1454
|
deviceType,
|
|
1456
|
-
children: /* @__PURE__ */ jsx(
|
|
1457
|
-
/* @__PURE__ */ jsx(Route, { path: "/", element: /* @__PURE__ */ jsx(Navigate, { to: startAtQr ? "/qr" : "/mobileroute", replace: true }) }),
|
|
1458
|
-
/* @__PURE__ */ jsx(Route, { path: "/qr", element: /* @__PURE__ */ jsx(QRCodePage_default, { onClose }) }),
|
|
1459
|
-
/* @__PURE__ */ jsx(Route, { path: "/mobileroute", element: /* @__PURE__ */ jsx(MobileRoute_default, { onClose }) })
|
|
1460
|
-
] }) })
|
|
1455
|
+
children: currentView === "qr" ? /* @__PURE__ */ jsx(QRCodePage_default, { onClose: handleClose, onNavigate: handleNavigate }) : /* @__PURE__ */ jsx(MobileRoute_default, { onClose: handleClose, onNavigate: handleNavigate })
|
|
1461
1456
|
}
|
|
1462
1457
|
);
|
|
1463
1458
|
};
|