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.
@@ -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/sdk/types/index.ts
9
11
  var AstraSDKError = class _AstraSDKError extends Error {
@@ -1608,7 +1610,7 @@ function FaceScanModal({ onComplete }) {
1608
1610
  const navigate = useNavigate();
1609
1611
  const { apiService } = useKycContext();
1610
1612
  const [sessionError, setSessionError] = useState(null);
1611
- const [toast, setToast] = useState(null);
1613
+ const [toast2, setToast] = useState(null);
1612
1614
  const [showRetryButton, setShowRetryButton] = useState(false);
1613
1615
  const [isRetrying, setIsRetrying] = useState(false);
1614
1616
  const [kycCompleted, setKycCompleted] = useState(false);
@@ -1799,11 +1801,11 @@ function FaceScanModal({ onComplete }) {
1799
1801
  ] }) }) });
1800
1802
  }
1801
1803
  return /* @__PURE__ */ jsxs(Fragment, { children: [
1802
- toast && /* @__PURE__ */ jsx(
1804
+ toast2 && /* @__PURE__ */ jsx(
1803
1805
  Toast,
1804
1806
  {
1805
- message: toast.message,
1806
- type: toast.type,
1807
+ message: toast2.message,
1808
+ type: toast2.type,
1807
1809
  onClose: () => setToast(null),
1808
1810
  duration: 6e3
1809
1811
  }
@@ -1969,25 +1971,29 @@ function QRCodePage({ onClose, mobileBaseUrl = "https://kyc-sdk-stage.astraproto
1969
1971
  };
1970
1972
  const handleCheckResult = async () => {
1971
1973
  if (!apiBaseUrl || !sessionId || !serverKey) {
1972
- alert("Missing configuration to check KYC result.");
1974
+ toast.error("Missing configuration to check KYC result.");
1973
1975
  return;
1974
1976
  }
1975
1977
  try {
1976
1978
  const svc = new KycApiService({ apiBaseUrl, sessionId, serverKey });
1977
1979
  const payload = await svc.getResult();
1978
- const first = Array.isArray(payload?.data) && payload.data.length > 0 ? payload.data[0] : null;
1979
- if (first && first.kyc_status === "verified" && first.redirect_url) {
1980
- window.location.href = first.redirect_url;
1981
- return;
1980
+ const first = Array.isArray(payload?.data) ? payload.data.length > 0 ? payload.data[0] : null : payload?.data || null;
1981
+ if (first && (first.kyc_status === "verified" || first.kyc_status === "success")) {
1982
+ const redirect = first.redirect_url || first.redirectUrl || null;
1983
+ if (redirect) {
1984
+ window.location.href = redirect;
1985
+ return;
1986
+ }
1982
1987
  }
1983
- alert("Please complete your KYC first.");
1988
+ toast.warn("Please complete your KYC first.");
1984
1989
  } catch (error) {
1985
1990
  const msg = error?.message || "Result fetch failed";
1986
1991
  console.error("getResult:error", msg);
1987
- alert(`Result fetch failed: ${msg}`);
1992
+ toast.error(`Result fetch failed: ${msg}`);
1988
1993
  }
1989
1994
  };
1990
1995
  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: [
1996
+ /* @__PURE__ */ jsx(ToastContainer, { position: "top-right" }),
1991
1997
  /* @__PURE__ */ jsx("div", { className: "absolute inset-0 opacity-10", style: {
1992
1998
  backgroundImage: `radial-gradient(circle at 2px 2px, rgba(255,255,255,0.15) 1px, transparent 0)`,
1993
1999
  backgroundSize: "40px 40px"