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/astra-sdk.es.js
CHANGED
|
@@ -1603,6 +1603,17 @@ function Toast({ message, type = "info", duration = 5e3, onClose }) {
|
|
|
1603
1603
|
}
|
|
1604
1604
|
);
|
|
1605
1605
|
}
|
|
1606
|
+
function ToastContainer({ toasts, onRemove }) {
|
|
1607
|
+
return /* @__PURE__ */ jsx("div", { className: "fixed top-4 right-4 z-[10000] flex flex-col gap-2", children: toasts.map((toast) => /* @__PURE__ */ jsx(
|
|
1608
|
+
Toast,
|
|
1609
|
+
{
|
|
1610
|
+
message: toast.message,
|
|
1611
|
+
type: toast.type,
|
|
1612
|
+
onClose: () => onRemove(toast.id)
|
|
1613
|
+
},
|
|
1614
|
+
toast.id
|
|
1615
|
+
)) });
|
|
1616
|
+
}
|
|
1606
1617
|
function FaceScanModal({ onComplete }) {
|
|
1607
1618
|
const faceCanvasRef = useRef(null);
|
|
1608
1619
|
const navigate = useNavigate();
|
|
@@ -1935,6 +1946,14 @@ var MobileRoute_default = MobileRoute;
|
|
|
1935
1946
|
function QRCodePage({ onClose, mobileBaseUrl = "https://kyc-sdk-stage.astraprotocol.com", sessionId, apiBaseUrl, serverKey } = {}) {
|
|
1936
1947
|
const [qrUrl, setQrUrl] = useState("");
|
|
1937
1948
|
const [copied, setCopied] = useState(false);
|
|
1949
|
+
const [toasts, setToasts] = useState([]);
|
|
1950
|
+
const addToast = (message, type = "info") => {
|
|
1951
|
+
const id = `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
1952
|
+
setToasts((prev) => [...prev, { id, message, type }]);
|
|
1953
|
+
};
|
|
1954
|
+
const removeToast = (id) => {
|
|
1955
|
+
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
1956
|
+
};
|
|
1938
1957
|
useEffect(() => {
|
|
1939
1958
|
const searchParams = new URLSearchParams(window.location.search);
|
|
1940
1959
|
if (sessionId) {
|
|
@@ -1969,25 +1988,26 @@ function QRCodePage({ onClose, mobileBaseUrl = "https://kyc-sdk-stage.astraproto
|
|
|
1969
1988
|
};
|
|
1970
1989
|
const handleCheckResult = async () => {
|
|
1971
1990
|
if (!apiBaseUrl || !sessionId || !serverKey) {
|
|
1972
|
-
|
|
1991
|
+
addToast("Missing configuration to check KYC result.", "error");
|
|
1973
1992
|
return;
|
|
1974
1993
|
}
|
|
1975
1994
|
try {
|
|
1976
1995
|
const svc = new KycApiService({ apiBaseUrl, sessionId, serverKey });
|
|
1977
1996
|
const payload = await svc.getResult();
|
|
1978
1997
|
const first = Array.isArray(payload?.data) && payload.data.length > 0 ? payload.data[0] : null;
|
|
1979
|
-
if (first && first.kyc_status === "verified"
|
|
1998
|
+
if (first && first.kyc_status === "verified") {
|
|
1980
1999
|
window.location.href = "https://astra-pro-business.astraprotocol.com/pricing-plans";
|
|
1981
2000
|
return;
|
|
1982
2001
|
}
|
|
1983
|
-
|
|
2002
|
+
addToast("Please complete your KYC first.", "warning");
|
|
1984
2003
|
} catch (error) {
|
|
1985
2004
|
const msg = error?.message || "Result fetch failed";
|
|
1986
2005
|
console.error("getResult:error", msg);
|
|
1987
|
-
|
|
2006
|
+
addToast(`Result fetch failed: ${msg}`, "error");
|
|
1988
2007
|
}
|
|
1989
2008
|
};
|
|
1990
2009
|
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: [
|
|
2010
|
+
/* @__PURE__ */ jsx(ToastContainer, { toasts, onRemove: removeToast }),
|
|
1991
2011
|
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 opacity-10", style: {
|
|
1992
2012
|
backgroundImage: `radial-gradient(circle at 2px 2px, rgba(255,255,255,0.15) 1px, transparent 0)`,
|
|
1993
2013
|
backgroundSize: "40px 40px"
|