astra-sdk-web 1.1.20 → 1.1.21
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 +24 -4
- package/dist/astra-sdk.cjs.js.map +1 -1
- package/dist/astra-sdk.es.js +24 -4
- package/dist/astra-sdk.es.js.map +1 -1
- package/dist/components.cjs.js +24 -4
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +24 -4
- package/dist/components.es.js.map +1 -1
- package/package.json +1 -1
- package/src/pages/QRCodePage.tsx +16 -4
package/dist/components.es.js
CHANGED
|
@@ -1400,6 +1400,17 @@ 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
|
+
}
|
|
1403
1414
|
function FaceScanModal({ onComplete }) {
|
|
1404
1415
|
const faceCanvasRef = useRef(null);
|
|
1405
1416
|
const navigate = useNavigate();
|
|
@@ -1732,6 +1743,14 @@ var MobileRoute_default = MobileRoute;
|
|
|
1732
1743
|
function QRCodePage({ onClose, mobileBaseUrl = "https://kyc-sdk-stage.astraprotocol.com", sessionId, apiBaseUrl, serverKey } = {}) {
|
|
1733
1744
|
const [qrUrl, setQrUrl] = useState("");
|
|
1734
1745
|
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
|
+
};
|
|
1735
1754
|
useEffect(() => {
|
|
1736
1755
|
const searchParams = new URLSearchParams(window.location.search);
|
|
1737
1756
|
if (sessionId) {
|
|
@@ -1766,25 +1785,26 @@ function QRCodePage({ onClose, mobileBaseUrl = "https://kyc-sdk-stage.astraproto
|
|
|
1766
1785
|
};
|
|
1767
1786
|
const handleCheckResult = async () => {
|
|
1768
1787
|
if (!apiBaseUrl || !sessionId || !serverKey) {
|
|
1769
|
-
|
|
1788
|
+
addToast("Missing configuration to check KYC result.", "error");
|
|
1770
1789
|
return;
|
|
1771
1790
|
}
|
|
1772
1791
|
try {
|
|
1773
1792
|
const svc = new KycApiService({ apiBaseUrl, sessionId, serverKey });
|
|
1774
1793
|
const payload = await svc.getResult();
|
|
1775
1794
|
const first = Array.isArray(payload?.data) && payload.data.length > 0 ? payload.data[0] : null;
|
|
1776
|
-
if (first && first.kyc_status === "verified"
|
|
1795
|
+
if (first && first.kyc_status === "verified") {
|
|
1777
1796
|
window.location.href = "https://astra-pro-business.astraprotocol.com/pricing-plans";
|
|
1778
1797
|
return;
|
|
1779
1798
|
}
|
|
1780
|
-
|
|
1799
|
+
addToast("Please complete your KYC first.", "warning");
|
|
1781
1800
|
} catch (error) {
|
|
1782
1801
|
const msg = error?.message || "Result fetch failed";
|
|
1783
1802
|
console.error("getResult:error", msg);
|
|
1784
|
-
|
|
1803
|
+
addToast(`Result fetch failed: ${msg}`, "error");
|
|
1785
1804
|
}
|
|
1786
1805
|
};
|
|
1787
1806
|
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 }),
|
|
1788
1808
|
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 opacity-10", style: {
|
|
1789
1809
|
backgroundImage: `radial-gradient(circle at 2px 2px, rgba(255,255,255,0.15) 1px, transparent 0)`,
|
|
1790
1810
|
backgroundSize: "40px 40px"
|