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.
@@ -6,6 +6,8 @@ var reactRouterDom = require('react-router-dom');
6
6
  var face_mesh = require('@mediapipe/face_mesh');
7
7
  var drawing_utils = require('@mediapipe/drawing_utils');
8
8
  var qrcode_react = require('qrcode.react');
9
+ var reactToastify = require('react-toastify');
10
+ require('react-toastify/dist/ReactToastify.css');
9
11
 
10
12
  function _interopDefault (e) { return e && e.__esModule ? e : { default: e }; }
11
13
 
@@ -1411,7 +1413,7 @@ function FaceScanModal({ onComplete }) {
1411
1413
  const navigate = reactRouterDom.useNavigate();
1412
1414
  const { apiService } = useKycContext();
1413
1415
  const [sessionError, setSessionError] = React.useState(null);
1414
- const [toast, setToast] = React.useState(null);
1416
+ const [toast2, setToast] = React.useState(null);
1415
1417
  const [showRetryButton, setShowRetryButton] = React.useState(false);
1416
1418
  const [isRetrying, setIsRetrying] = React.useState(false);
1417
1419
  const [kycCompleted, setKycCompleted] = React.useState(false);
@@ -1602,11 +1604,11 @@ function FaceScanModal({ onComplete }) {
1602
1604
  ] }) }) });
1603
1605
  }
1604
1606
  return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
1605
- toast && /* @__PURE__ */ jsxRuntime.jsx(
1607
+ toast2 && /* @__PURE__ */ jsxRuntime.jsx(
1606
1608
  Toast,
1607
1609
  {
1608
- message: toast.message,
1609
- type: toast.type,
1610
+ message: toast2.message,
1611
+ type: toast2.type,
1610
1612
  onClose: () => setToast(null),
1611
1613
  duration: 6e3
1612
1614
  }
@@ -1772,25 +1774,29 @@ function QRCodePage({ onClose, mobileBaseUrl = "https://kyc-sdk-stage.astraproto
1772
1774
  };
1773
1775
  const handleCheckResult = async () => {
1774
1776
  if (!apiBaseUrl || !sessionId || !serverKey) {
1775
- alert("Missing configuration to check KYC result.");
1777
+ reactToastify.toast.error("Missing configuration to check KYC result.");
1776
1778
  return;
1777
1779
  }
1778
1780
  try {
1779
1781
  const svc = new KycApiService({ apiBaseUrl, sessionId, serverKey });
1780
1782
  const payload = await svc.getResult();
1781
- const first = Array.isArray(payload?.data) && payload.data.length > 0 ? payload.data[0] : null;
1782
- if (first && first.kyc_status === "verified" && first.redirect_url) {
1783
- window.location.href = first.redirect_url;
1784
- return;
1783
+ const first = Array.isArray(payload?.data) ? payload.data.length > 0 ? payload.data[0] : null : payload?.data || null;
1784
+ if (first && (first.kyc_status === "verified" || first.kyc_status === "success")) {
1785
+ const redirect = first.redirect_url || first.redirectUrl || null;
1786
+ if (redirect) {
1787
+ window.location.href = redirect;
1788
+ return;
1789
+ }
1785
1790
  }
1786
- alert("Please complete your KYC first.");
1791
+ reactToastify.toast.warn("Please complete your KYC first.");
1787
1792
  } catch (error) {
1788
1793
  const msg = error?.message || "Result fetch failed";
1789
1794
  console.error("getResult:error", msg);
1790
- alert(`Result fetch failed: ${msg}`);
1795
+ reactToastify.toast.error(`Result fetch failed: ${msg}`);
1791
1796
  }
1792
1797
  };
1793
1798
  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: [
1799
+ /* @__PURE__ */ jsxRuntime.jsx(reactToastify.ToastContainer, { position: "top-right" }),
1794
1800
  /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 opacity-10", style: {
1795
1801
  backgroundImage: `radial-gradient(circle at 2px 2px, rgba(255,255,255,0.15) 1px, transparent 0)`,
1796
1802
  backgroundSize: "40px 40px"