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.cjs.js
CHANGED
|
@@ -1406,6 +1406,17 @@ function Toast({ message, type = "info", duration = 5e3, onClose }) {
|
|
|
1406
1406
|
}
|
|
1407
1407
|
);
|
|
1408
1408
|
}
|
|
1409
|
+
function ToastContainer({ toasts, onRemove }) {
|
|
1410
|
+
return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "fixed top-4 right-4 z-[10000] flex flex-col gap-2", children: toasts.map((toast) => /* @__PURE__ */ jsxRuntime.jsx(
|
|
1411
|
+
Toast,
|
|
1412
|
+
{
|
|
1413
|
+
message: toast.message,
|
|
1414
|
+
type: toast.type,
|
|
1415
|
+
onClose: () => onRemove(toast.id)
|
|
1416
|
+
},
|
|
1417
|
+
toast.id
|
|
1418
|
+
)) });
|
|
1419
|
+
}
|
|
1409
1420
|
function FaceScanModal({ onComplete }) {
|
|
1410
1421
|
const faceCanvasRef = React.useRef(null);
|
|
1411
1422
|
const navigate = reactRouterDom.useNavigate();
|
|
@@ -1738,6 +1749,14 @@ var MobileRoute_default = MobileRoute;
|
|
|
1738
1749
|
function QRCodePage({ onClose, mobileBaseUrl = "https://kyc-sdk-stage.astraprotocol.com", sessionId, apiBaseUrl, serverKey } = {}) {
|
|
1739
1750
|
const [qrUrl, setQrUrl] = React.useState("");
|
|
1740
1751
|
const [copied, setCopied] = React.useState(false);
|
|
1752
|
+
const [toasts, setToasts] = React.useState([]);
|
|
1753
|
+
const addToast = (message, type = "info") => {
|
|
1754
|
+
const id = `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
1755
|
+
setToasts((prev) => [...prev, { id, message, type }]);
|
|
1756
|
+
};
|
|
1757
|
+
const removeToast = (id) => {
|
|
1758
|
+
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
1759
|
+
};
|
|
1741
1760
|
React.useEffect(() => {
|
|
1742
1761
|
const searchParams = new URLSearchParams(window.location.search);
|
|
1743
1762
|
if (sessionId) {
|
|
@@ -1772,25 +1791,26 @@ function QRCodePage({ onClose, mobileBaseUrl = "https://kyc-sdk-stage.astraproto
|
|
|
1772
1791
|
};
|
|
1773
1792
|
const handleCheckResult = async () => {
|
|
1774
1793
|
if (!apiBaseUrl || !sessionId || !serverKey) {
|
|
1775
|
-
|
|
1794
|
+
addToast("Missing configuration to check KYC result.", "error");
|
|
1776
1795
|
return;
|
|
1777
1796
|
}
|
|
1778
1797
|
try {
|
|
1779
1798
|
const svc = new KycApiService({ apiBaseUrl, sessionId, serverKey });
|
|
1780
1799
|
const payload = await svc.getResult();
|
|
1781
1800
|
const first = Array.isArray(payload?.data) && payload.data.length > 0 ? payload.data[0] : null;
|
|
1782
|
-
if (first && first.kyc_status === "verified"
|
|
1801
|
+
if (first && first.kyc_status === "verified") {
|
|
1783
1802
|
window.location.href = "https://astra-pro-business.astraprotocol.com/pricing-plans";
|
|
1784
1803
|
return;
|
|
1785
1804
|
}
|
|
1786
|
-
|
|
1805
|
+
addToast("Please complete your KYC first.", "warning");
|
|
1787
1806
|
} catch (error) {
|
|
1788
1807
|
const msg = error?.message || "Result fetch failed";
|
|
1789
1808
|
console.error("getResult:error", msg);
|
|
1790
|
-
|
|
1809
|
+
addToast(`Result fetch failed: ${msg}`, "error");
|
|
1791
1810
|
}
|
|
1792
1811
|
};
|
|
1793
1812
|
return /* @__PURE__ */ jsxRuntime.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: [
|
|
1813
|
+
/* @__PURE__ */ jsxRuntime.jsx(ToastContainer, { toasts, onRemove: removeToast }),
|
|
1794
1814
|
/* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 opacity-10", style: {
|
|
1795
1815
|
backgroundImage: `radial-gradient(circle at 2px 2px, rgba(255,255,255,0.15) 1px, transparent 0)`,
|
|
1796
1816
|
backgroundSize: "40px 40px"
|