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.
@@ -1611,6 +1611,17 @@ function Toast({ message, type = "info", duration = 5e3, onClose }) {
1611
1611
  }
1612
1612
  );
1613
1613
  }
1614
+ function ToastContainer({ toasts, onRemove }) {
1615
+ 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(
1616
+ Toast,
1617
+ {
1618
+ message: toast.message,
1619
+ type: toast.type,
1620
+ onClose: () => onRemove(toast.id)
1621
+ },
1622
+ toast.id
1623
+ )) });
1624
+ }
1614
1625
  function FaceScanModal({ onComplete }) {
1615
1626
  const faceCanvasRef = React.useRef(null);
1616
1627
  const navigate = reactRouterDom.useNavigate();
@@ -1943,6 +1954,14 @@ var MobileRoute_default = MobileRoute;
1943
1954
  function QRCodePage({ onClose, mobileBaseUrl = "https://kyc-sdk-stage.astraprotocol.com", sessionId, apiBaseUrl, serverKey } = {}) {
1944
1955
  const [qrUrl, setQrUrl] = React.useState("");
1945
1956
  const [copied, setCopied] = React.useState(false);
1957
+ const [toasts, setToasts] = React.useState([]);
1958
+ const addToast = (message, type = "info") => {
1959
+ const id = `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
1960
+ setToasts((prev) => [...prev, { id, message, type }]);
1961
+ };
1962
+ const removeToast = (id) => {
1963
+ setToasts((prev) => prev.filter((t) => t.id !== id));
1964
+ };
1946
1965
  React.useEffect(() => {
1947
1966
  const searchParams = new URLSearchParams(window.location.search);
1948
1967
  if (sessionId) {
@@ -1977,25 +1996,26 @@ function QRCodePage({ onClose, mobileBaseUrl = "https://kyc-sdk-stage.astraproto
1977
1996
  };
1978
1997
  const handleCheckResult = async () => {
1979
1998
  if (!apiBaseUrl || !sessionId || !serverKey) {
1980
- alert("Missing configuration to check KYC result.");
1999
+ addToast("Missing configuration to check KYC result.", "error");
1981
2000
  return;
1982
2001
  }
1983
2002
  try {
1984
2003
  const svc = new KycApiService({ apiBaseUrl, sessionId, serverKey });
1985
2004
  const payload = await svc.getResult();
1986
2005
  const first = Array.isArray(payload?.data) && payload.data.length > 0 ? payload.data[0] : null;
1987
- if (first && first.kyc_status === "verified" && first.redirectUrl) {
2006
+ if (first && first.kyc_status === "verified") {
1988
2007
  window.location.href = "https://astra-pro-business.astraprotocol.com/pricing-plans";
1989
2008
  return;
1990
2009
  }
1991
- alert("Please complete your KYC first.");
2010
+ addToast("Please complete your KYC first.", "warning");
1992
2011
  } catch (error) {
1993
2012
  const msg = error?.message || "Result fetch failed";
1994
2013
  console.error("getResult:error", msg);
1995
- alert(`Result fetch failed: ${msg}`);
2014
+ addToast(`Result fetch failed: ${msg}`, "error");
1996
2015
  }
1997
2016
  };
1998
2017
  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: [
2018
+ /* @__PURE__ */ jsxRuntime.jsx(ToastContainer, { toasts, onRemove: removeToast }),
1999
2019
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 opacity-10", style: {
2000
2020
  backgroundImage: `radial-gradient(circle at 2px 2px, rgba(255,255,255,0.15) 1px, transparent 0)`,
2001
2021
  backgroundSize: "40px 40px"