astra-sdk-web 1.1.2 → 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/astra-sdk.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';
|
|
@@ -1522,19 +1522,16 @@ function FaceScanModal({ onComplete }) {
|
|
|
1522
1522
|
] }) });
|
|
1523
1523
|
}
|
|
1524
1524
|
var FaceScanModal_default = FaceScanModal;
|
|
1525
|
-
function MobileRoute({ onClose } = {}) {
|
|
1526
|
-
const navigate = useNavigate();
|
|
1525
|
+
function MobileRoute({ onClose, onNavigate } = {}) {
|
|
1527
1526
|
useEffect(() => {
|
|
1528
|
-
if (!isMobileDevice()) {
|
|
1529
|
-
|
|
1527
|
+
if (!isMobileDevice() && onNavigate) {
|
|
1528
|
+
onNavigate("qr");
|
|
1530
1529
|
return;
|
|
1531
1530
|
}
|
|
1532
|
-
}, [
|
|
1531
|
+
}, [onNavigate]);
|
|
1533
1532
|
const handleClose = () => {
|
|
1534
1533
|
if (onClose) {
|
|
1535
1534
|
onClose();
|
|
1536
|
-
} else {
|
|
1537
|
-
navigate(-1);
|
|
1538
1535
|
}
|
|
1539
1536
|
};
|
|
1540
1537
|
const handleComplete = (capturedImage) => {
|
|
@@ -1546,22 +1543,17 @@ function MobileRoute({ onClose } = {}) {
|
|
|
1546
1543
|
return /* @__PURE__ */ jsx(FaceScanModal_default, { onClose: handleClose, onComplete: handleComplete });
|
|
1547
1544
|
}
|
|
1548
1545
|
var MobileRoute_default = MobileRoute;
|
|
1549
|
-
function QRCodePage({ onClose } = {}) {
|
|
1550
|
-
const [searchParams] = useSearchParams();
|
|
1551
|
-
const navigate = useNavigate();
|
|
1546
|
+
function QRCodePage({ onClose, onNavigate } = {}) {
|
|
1552
1547
|
const [qrUrl, setQrUrl] = useState("");
|
|
1553
1548
|
const [copied, setCopied] = useState(false);
|
|
1554
1549
|
useEffect(() => {
|
|
1555
1550
|
const currentUrl = window.location.origin;
|
|
1556
|
-
const
|
|
1557
|
-
searchParams.forEach((value, key) => {
|
|
1558
|
-
params[key] = value;
|
|
1559
|
-
});
|
|
1551
|
+
const searchParams = new URLSearchParams(window.location.search);
|
|
1560
1552
|
const mobileRoute = "/mobileroute";
|
|
1561
|
-
const queryString =
|
|
1553
|
+
const queryString = searchParams.toString();
|
|
1562
1554
|
const fullUrl = `${currentUrl}${mobileRoute}${queryString ? `?${queryString}` : ""}`;
|
|
1563
1555
|
setQrUrl(fullUrl);
|
|
1564
|
-
}, [
|
|
1556
|
+
}, []);
|
|
1565
1557
|
const handleCopyUrl = async () => {
|
|
1566
1558
|
if (qrUrl) {
|
|
1567
1559
|
try {
|
|
@@ -1576,8 +1568,6 @@ function QRCodePage({ onClose } = {}) {
|
|
|
1576
1568
|
const handleClose = () => {
|
|
1577
1569
|
if (onClose) {
|
|
1578
1570
|
onClose();
|
|
1579
|
-
} else {
|
|
1580
|
-
navigate(-1);
|
|
1581
1571
|
}
|
|
1582
1572
|
};
|
|
1583
1573
|
const handleRefresh = () => {
|
|
@@ -1649,6 +1639,15 @@ var KycFlow = ({
|
|
|
1649
1639
|
startAtQr = true,
|
|
1650
1640
|
onClose
|
|
1651
1641
|
}) => {
|
|
1642
|
+
const [currentView, setCurrentView] = useState(startAtQr ? "qr" : "mobileroute");
|
|
1643
|
+
const handleNavigate = (view) => {
|
|
1644
|
+
setCurrentView(view);
|
|
1645
|
+
};
|
|
1646
|
+
const handleClose = () => {
|
|
1647
|
+
if (onClose) {
|
|
1648
|
+
onClose();
|
|
1649
|
+
}
|
|
1650
|
+
};
|
|
1652
1651
|
return /* @__PURE__ */ jsx(
|
|
1653
1652
|
KycProvider,
|
|
1654
1653
|
{
|
|
@@ -1656,11 +1655,7 @@ var KycFlow = ({
|
|
|
1656
1655
|
sessionId,
|
|
1657
1656
|
serverKey,
|
|
1658
1657
|
deviceType,
|
|
1659
|
-
children: /* @__PURE__ */ jsx(
|
|
1660
|
-
/* @__PURE__ */ jsx(Route, { path: "/", element: /* @__PURE__ */ jsx(Navigate, { to: startAtQr ? "/qr" : "/mobileroute", replace: true }) }),
|
|
1661
|
-
/* @__PURE__ */ jsx(Route, { path: "/qr", element: /* @__PURE__ */ jsx(QRCodePage_default, { onClose }) }),
|
|
1662
|
-
/* @__PURE__ */ jsx(Route, { path: "/mobileroute", element: /* @__PURE__ */ jsx(MobileRoute_default, { onClose }) })
|
|
1663
|
-
] }) })
|
|
1658
|
+
children: currentView === "qr" ? /* @__PURE__ */ jsx(QRCodePage_default, { onClose: handleClose, onNavigate: handleNavigate }) : /* @__PURE__ */ jsx(MobileRoute_default, { onClose: handleClose, onNavigate: handleNavigate })
|
|
1664
1659
|
}
|
|
1665
1660
|
);
|
|
1666
1661
|
};
|