astra-sdk-web 1.1.21 → 1.1.23
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.
- package/dist/astra-sdk.cjs.js +5 -25
- package/dist/astra-sdk.cjs.js.map +1 -1
- package/dist/astra-sdk.es.js +5 -25
- package/dist/astra-sdk.es.js.map +1 -1
- package/dist/components.cjs.js +5 -25
- package/dist/components.cjs.js.map +1 -1
- package/dist/components.es.js +5 -25
- package/dist/components.es.js.map +1 -1
- package/package.json +1 -1
- package/src/pages/QRCodePage.tsx +5 -17
package/dist/astra-sdk.es.js
CHANGED
|
@@ -1603,17 +1603,6 @@ function Toast({ message, type = "info", duration = 5e3, onClose }) {
|
|
|
1603
1603
|
}
|
|
1604
1604
|
);
|
|
1605
1605
|
}
|
|
1606
|
-
function ToastContainer({ toasts, onRemove }) {
|
|
1607
|
-
return /* @__PURE__ */ jsx("div", { className: "fixed top-4 right-4 z-[10000] flex flex-col gap-2", children: toasts.map((toast) => /* @__PURE__ */ jsx(
|
|
1608
|
-
Toast,
|
|
1609
|
-
{
|
|
1610
|
-
message: toast.message,
|
|
1611
|
-
type: toast.type,
|
|
1612
|
-
onClose: () => onRemove(toast.id)
|
|
1613
|
-
},
|
|
1614
|
-
toast.id
|
|
1615
|
-
)) });
|
|
1616
|
-
}
|
|
1617
1606
|
function FaceScanModal({ onComplete }) {
|
|
1618
1607
|
const faceCanvasRef = useRef(null);
|
|
1619
1608
|
const navigate = useNavigate();
|
|
@@ -1946,14 +1935,6 @@ var MobileRoute_default = MobileRoute;
|
|
|
1946
1935
|
function QRCodePage({ onClose, mobileBaseUrl = "https://kyc-sdk-stage.astraprotocol.com", sessionId, apiBaseUrl, serverKey } = {}) {
|
|
1947
1936
|
const [qrUrl, setQrUrl] = useState("");
|
|
1948
1937
|
const [copied, setCopied] = useState(false);
|
|
1949
|
-
const [toasts, setToasts] = useState([]);
|
|
1950
|
-
const addToast = (message, type = "info") => {
|
|
1951
|
-
const id = `${Date.now()}-${Math.random().toString(36).slice(2, 9)}`;
|
|
1952
|
-
setToasts((prev) => [...prev, { id, message, type }]);
|
|
1953
|
-
};
|
|
1954
|
-
const removeToast = (id) => {
|
|
1955
|
-
setToasts((prev) => prev.filter((t) => t.id !== id));
|
|
1956
|
-
};
|
|
1957
1938
|
useEffect(() => {
|
|
1958
1939
|
const searchParams = new URLSearchParams(window.location.search);
|
|
1959
1940
|
if (sessionId) {
|
|
@@ -1988,26 +1969,25 @@ function QRCodePage({ onClose, mobileBaseUrl = "https://kyc-sdk-stage.astraproto
|
|
|
1988
1969
|
};
|
|
1989
1970
|
const handleCheckResult = async () => {
|
|
1990
1971
|
if (!apiBaseUrl || !sessionId || !serverKey) {
|
|
1991
|
-
|
|
1972
|
+
alert("Missing configuration to check KYC result.");
|
|
1992
1973
|
return;
|
|
1993
1974
|
}
|
|
1994
1975
|
try {
|
|
1995
1976
|
const svc = new KycApiService({ apiBaseUrl, sessionId, serverKey });
|
|
1996
1977
|
const payload = await svc.getResult();
|
|
1997
1978
|
const first = Array.isArray(payload?.data) && payload.data.length > 0 ? payload.data[0] : null;
|
|
1998
|
-
if (first && first.kyc_status === "verified") {
|
|
1999
|
-
window.location.href =
|
|
1979
|
+
if (first && first.kyc_status === "verified" && first.redirect_url) {
|
|
1980
|
+
window.location.href = first.redirect_url;
|
|
2000
1981
|
return;
|
|
2001
1982
|
}
|
|
2002
|
-
|
|
1983
|
+
alert("Please complete your KYC first.");
|
|
2003
1984
|
} catch (error) {
|
|
2004
1985
|
const msg = error?.message || "Result fetch failed";
|
|
2005
1986
|
console.error("getResult:error", msg);
|
|
2006
|
-
|
|
1987
|
+
alert(`Result fetch failed: ${msg}`);
|
|
2007
1988
|
}
|
|
2008
1989
|
};
|
|
2009
1990
|
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: [
|
|
2010
|
-
/* @__PURE__ */ jsx(ToastContainer, { toasts, onRemove: removeToast }),
|
|
2011
1991
|
/* @__PURE__ */ jsx("div", { className: "absolute inset-0 opacity-10", style: {
|
|
2012
1992
|
backgroundImage: `radial-gradient(circle at 2px 2px, rgba(255,255,255,0.15) 1px, transparent 0)`,
|
|
2013
1993
|
backgroundSize: "40px 40px"
|