astra-sdk-web 1.1.23 → 1.1.24

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.
@@ -8,6 +8,8 @@ var reactRouterDom = require('react-router-dom');
8
8
  var face_mesh = require('@mediapipe/face_mesh');
9
9
  var drawing_utils = require('@mediapipe/drawing_utils');
10
10
  var qrcode_react = require('qrcode.react');
11
+ var reactToastify = require('react-toastify');
12
+ require('react-toastify/dist/ReactToastify.css');
11
13
 
12
14
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
13
15
 
@@ -1616,7 +1618,7 @@ function FaceScanModal({ onComplete }) {
1616
1618
  const navigate = reactRouterDom.useNavigate();
1617
1619
  const { apiService } = useKycContext();
1618
1620
  const [sessionError, setSessionError] = React.useState(null);
1619
- const [toast, setToast] = React.useState(null);
1621
+ const [toast2, setToast] = React.useState(null);
1620
1622
  const [showRetryButton, setShowRetryButton] = React.useState(false);
1621
1623
  const [isRetrying, setIsRetrying] = React.useState(false);
1622
1624
  const [kycCompleted, setKycCompleted] = React.useState(false);
@@ -1807,11 +1809,11 @@ function FaceScanModal({ onComplete }) {
1807
1809
  ] }) }) });
1808
1810
  }
1809
1811
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1810
- toast && /* @__PURE__ */ jsxRuntime.jsx(
1812
+ toast2 && /* @__PURE__ */ jsxRuntime.jsx(
1811
1813
  Toast,
1812
1814
  {
1813
- message: toast.message,
1814
- type: toast.type,
1815
+ message: toast2.message,
1816
+ type: toast2.type,
1815
1817
  onClose: () => setToast(null),
1816
1818
  duration: 6e3
1817
1819
  }
@@ -1977,25 +1979,29 @@ function QRCodePage({ onClose, mobileBaseUrl = "https://kyc-sdk-stage.astraproto
1977
1979
  };
1978
1980
  const handleCheckResult = async () => {
1979
1981
  if (!apiBaseUrl || !sessionId || !serverKey) {
1980
- alert("Missing configuration to check KYC result.");
1982
+ reactToastify.toast.error("Missing configuration to check KYC result.");
1981
1983
  return;
1982
1984
  }
1983
1985
  try {
1984
1986
  const svc = new KycApiService({ apiBaseUrl, sessionId, serverKey });
1985
1987
  const payload = await svc.getResult();
1986
- const first = Array.isArray(payload?.data) && payload.data.length > 0 ? payload.data[0] : null;
1987
- if (first && first.kyc_status === "verified" && first.redirect_url) {
1988
- window.location.href = first.redirect_url;
1989
- return;
1988
+ const first = Array.isArray(payload?.data) ? payload.data.length > 0 ? payload.data[0] : null : payload?.data || null;
1989
+ if (first && (first.kyc_status === "verified" || first.kyc_status === "success")) {
1990
+ const redirect = first.redirect_url || first.redirectUrl || null;
1991
+ if (redirect) {
1992
+ window.location.href = redirect;
1993
+ return;
1994
+ }
1990
1995
  }
1991
- alert("Please complete your KYC first.");
1996
+ reactToastify.toast.warn("Please complete your KYC first.");
1992
1997
  } catch (error) {
1993
1998
  const msg = error?.message || "Result fetch failed";
1994
1999
  console.error("getResult:error", msg);
1995
- alert(`Result fetch failed: ${msg}`);
2000
+ reactToastify.toast.error(`Result fetch failed: ${msg}`);
1996
2001
  }
1997
2002
  };
1998
2003
  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: [
2004
+ /* @__PURE__ */ jsxRuntime.jsx(reactToastify.ToastContainer, { position: "top-right" }),
1999
2005
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 opacity-10", style: {
2000
2006
  backgroundImage: `radial-gradient(circle at 2px 2px, rgba(255,255,255,0.15) 1px, transparent 0)`,
2001
2007
  backgroundSize: "40px 40px"