astra-sdk-web 1.1.21 → 1.1.23
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 +5 -25
- package/dist/astra-sdk.cjs.js.map +1 -1
- package/dist/astra-sdk.es.js +5 -25
- package/dist/astra-sdk.es.js.map +1 -1
- package/dist/components.cjs.js +5 -25
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +5 -25
- package/dist/components.es.js.map +1 -1
- package/package.json +1 -1
- package/src/pages/QRCodePage.tsx +5 -17
package/dist/components.es.js
CHANGED
|
@@ -1400,17 +1400,6 @@ function Toast({ message, type = "info", duration = 5e3, onClose }) {
|
|
|
1400
1400
|
}
|
|
1401
1401
|
);
|
|
1402
1402
|
}
|
|
1403
|
-
function ToastContainer({ toasts, onRemove }) {
|
|
1404
|
-
return /* @__PURE__ */ jsx("div", { className: "fixed top-4 right-4 z-[10000] flex flex-col gap-2", children: toasts.map((toast) => /* @__PURE__ */ jsx(
|
|
1405
|
-
Toast,
|
|
1406
|
-
{
|
|
1407
|
-
message: toast.message,
|
|
1408
|
-
type: toast.type,
|
|
1409
|
-
onClose: () => onRemove(toast.id)
|
|
1410
|
-
},
|
|
1411
|
-
toast.id
|
|
1412
|
-
)) });
|
|
1413
|
-
}
|
|
1414
1403
|
function FaceScanModal({ onComplete }) {
|
|
1415
1404
|
const faceCanvasRef = useRef(null);
|
|
1416
1405
|
const navigate = useNavigate();
|
|
@@ -1743,14 +1732,6 @@ var MobileRoute_default = MobileRoute;
|
|
|
1743
1732
|
function QRCodePage({ onClose, mobileBaseUrl = "https://kyc-sdk-stage.astraprotocol.com", sessionId, apiBaseUrl, serverKey } = {}) {
|
|
1744
1733
|
const [qrUrl, setQrUrl] = useState("");
|
|
1745
1734
|
const [copied, setCopied] = useState(false);
|
|
1746
|
-
const [toasts, setToasts] = useState([]);
|
|
1747
|
-
const addToast = (message, type = "info") => {
|
|
1748
|
-
const id = `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
1749
|
-
setToasts((prev) => [...prev, { id, message, type }]);
|
|
1750
|
-
};
|
|
1751
|
-
const removeToast = (id) => {
|
|
1752
|
-
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
1753
|
-
};
|
|
1754
1735
|
useEffect(() => {
|
|
1755
1736
|
const searchParams = new URLSearchParams(window.location.search);
|
|
1756
1737
|
if (sessionId) {
|
|
@@ -1785,26 +1766,25 @@ function QRCodePage({ onClose, mobileBaseUrl = "https://kyc-sdk-stage.astraproto
|
|
|
1785
1766
|
};
|
|
1786
1767
|
const handleCheckResult = async () => {
|
|
1787
1768
|
if (!apiBaseUrl || !sessionId || !serverKey) {
|
|
1788
|
-
|
|
1769
|
+
alert("Missing configuration to check KYC result.");
|
|
1789
1770
|
return;
|
|
1790
1771
|
}
|
|
1791
1772
|
try {
|
|
1792
1773
|
const svc = new KycApiService({ apiBaseUrl, sessionId, serverKey });
|
|
1793
1774
|
const payload = await svc.getResult();
|
|
1794
1775
|
const first = Array.isArray(payload?.data) && payload.data.length > 0 ? payload.data[0] : null;
|
|
1795
|
-
if (first && first.kyc_status === "verified") {
|
|
1796
|
-
window.location.href =
|
|
1776
|
+
if (first && first.kyc_status === "verified" && first.redirect_url) {
|
|
1777
|
+
window.location.href = first.redirect_url;
|
|
1797
1778
|
return;
|
|
1798
1779
|
}
|
|
1799
|
-
|
|
1780
|
+
alert("Please complete your KYC first.");
|
|
1800
1781
|
} catch (error) {
|
|
1801
1782
|
const msg = error?.message || "Result fetch failed";
|
|
1802
1783
|
console.error("getResult:error", msg);
|
|
1803
|
-
|
|
1784
|
+
alert(`Result fetch failed: ${msg}`);
|
|
1804
1785
|
}
|
|
1805
1786
|
};
|
|
1806
1787
|
return /* @__PURE__ */ jsxs("div", { className: "fixed inset-0 flex items-center justify-center bg-gradient-to-br from-gray-900 via-gray-800 to-black p-4 sm:p-6 md:p-8 z-[1000]", children: [
|
|
1807
|
-
/* @__PURE__ */ jsx(ToastContainer, { toasts, onRemove: removeToast }),
|
|
1808
1788
|
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 opacity-10", style: {
|
|
1809
1789
|
backgroundImage: `radial-gradient(circle at 2px 2px, rgba(255,255,255,0.15) 1px, transparent 0)`,
|
|
1810
1790
|
backgroundSize: "40px 40px"
|