astra-sdk-web 1.1.23 → 1.1.25

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.
@@ -4,6 +4,8 @@ import { useNavigate } from 'react-router-dom';
4
4
  import { FACEMESH_TESSELATION, FACEMESH_FACE_OVAL, FACEMESH_LEFT_EYE, FACEMESH_RIGHT_EYE, FACEMESH_LIPS, FaceMesh } from '@mediapipe/face_mesh';
5
5
  import { drawConnectors, drawLandmarks } from '@mediapipe/drawing_utils';
6
6
  import { QRCodeSVG } from 'qrcode.react';
7
+ import { ToastContainer, toast } from 'react-toastify';
8
+ import 'react-toastify/dist/ReactToastify.css';
7
9
 
8
10
  // src/components/KycFlow.tsx
9
11
 
@@ -1405,7 +1407,7 @@ function FaceScanModal({ onComplete }) {
1405
1407
  const navigate = useNavigate();
1406
1408
  const { apiService } = useKycContext();
1407
1409
  const [sessionError, setSessionError] = useState(null);
1408
- const [toast, setToast] = useState(null);
1410
+ const [toast2, setToast] = useState(null);
1409
1411
  const [showRetryButton, setShowRetryButton] = useState(false);
1410
1412
  const [isRetrying, setIsRetrying] = useState(false);
1411
1413
  const [kycCompleted, setKycCompleted] = useState(false);
@@ -1596,11 +1598,11 @@ function FaceScanModal({ onComplete }) {
1596
1598
  ] }) }) });
1597
1599
  }
1598
1600
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1599
- toast && /* @__PURE__ */ jsx(
1601
+ toast2 && /* @__PURE__ */ jsx(
1600
1602
  Toast,
1601
1603
  {
1602
- message: toast.message,
1603
- type: toast.type,
1604
+ message: toast2.message,
1605
+ type: toast2.type,
1604
1606
  onClose: () => setToast(null),
1605
1607
  duration: 6e3
1606
1608
  }
@@ -1766,25 +1768,29 @@ function QRCodePage({ onClose, mobileBaseUrl = "https://kyc-sdk-stage.astraproto
1766
1768
  };
1767
1769
  const handleCheckResult = async () => {
1768
1770
  if (!apiBaseUrl || !sessionId || !serverKey) {
1769
- alert("Missing configuration to check KYC result.");
1771
+ toast.error("Missing configuration to check KYC result.");
1770
1772
  return;
1771
1773
  }
1772
1774
  try {
1773
1775
  const svc = new KycApiService({ apiBaseUrl, sessionId, serverKey });
1774
1776
  const payload = await svc.getResult();
1775
- const first = Array.isArray(payload?.data) && payload.data.length > 0 ? payload.data[0] : null;
1776
- if (first && first.kyc_status === "verified" && first.redirect_url) {
1777
- window.location.href = first.redirect_url;
1778
- return;
1777
+ const first = Array.isArray(payload?.data) ? payload.data.length > 0 ? payload.data[0] : null : payload?.data || null;
1778
+ if (first && (first.kyc_status === "verified" || first.kyc_status === "success")) {
1779
+ const redirect = first.redirect_url || first.redirectUrl || null;
1780
+ if (redirect) {
1781
+ window.location.href = redirect;
1782
+ return;
1783
+ }
1779
1784
  }
1780
- alert("Please complete your KYC first.");
1785
+ toast.warn("Please complete your KYC first.");
1781
1786
  } catch (error) {
1782
1787
  const msg = error?.message || "Result fetch failed";
1783
1788
  console.error("getResult:error", msg);
1784
- alert(`Result fetch failed: ${msg}`);
1789
+ toast.error(`Result fetch failed: ${msg}`);
1785
1790
  }
1786
1791
  };
1787
1792
  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: [
1793
+ /* @__PURE__ */ jsx(ToastContainer, { position: "top-right" }),
1788
1794
  /* @__PURE__ */ jsx("div", { className: "absolute inset-0 opacity-10", style: {
1789
1795
  backgroundImage: `radial-gradient(circle at 2px 2px, rgba(255,255,255,0.15) 1px, transparent 0)`,
1790
1796
  backgroundSize: "40px 40px"