astra-sdk-web 1.1.3 → 1.1.4

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.
@@ -1551,17 +1551,19 @@ function MobileRoute({ onClose, onNavigate } = {}) {
1551
1551
  return /* @__PURE__ */ jsxRuntime.jsx(FaceScanModal_default, { onClose: handleClose, onComplete: handleComplete });
1552
1552
  }
1553
1553
  var MobileRoute_default = MobileRoute;
1554
- function QRCodePage({ onClose, onNavigate } = {}) {
1554
+ function QRCodePage({ onClose, onNavigate, mobileBaseUrl = "https://astra-sdk-rebuild.vercel.app", sessionId } = {}) {
1555
1555
  const [qrUrl, setQrUrl] = React.useState("");
1556
1556
  const [copied, setCopied] = React.useState(false);
1557
1557
  React.useEffect(() => {
1558
- const currentUrl = window.location.origin;
1559
1558
  const searchParams = new URLSearchParams(window.location.search);
1559
+ if (sessionId) {
1560
+ searchParams.set("sessionId", sessionId);
1561
+ }
1560
1562
  const mobileRoute = "/mobileroute";
1561
1563
  const queryString = searchParams.toString();
1562
- const fullUrl = `${currentUrl}${mobileRoute}${queryString ? `?${queryString}` : ""}`;
1564
+ const fullUrl = `${mobileBaseUrl}${mobileRoute}${queryString ? `?${queryString}` : ""}`;
1563
1565
  setQrUrl(fullUrl);
1564
- }, []);
1566
+ }, [mobileBaseUrl, sessionId]);
1565
1567
  const handleCopyUrl = async () => {
1566
1568
  if (qrUrl) {
1567
1569
  try {
@@ -1581,62 +1583,68 @@ function QRCodePage({ onClose, onNavigate } = {}) {
1581
1583
  const handleRefresh = () => {
1582
1584
  window.location.reload();
1583
1585
  };
1584
- return /* @__PURE__ */ jsxRuntime.jsx("div", { className: "fixed inset-0 flex items-center justify-center bg-black p-4 sm:p-6 md:p-8 z-[1000]", children: /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative bg-[rgba(20,20,20,0.95)] rounded-2xl p-5 sm:p-6 md:p-7 max-w-[450px] w-full h-[80vh] flex flex-col text-center shadow-[0_8px_32px_rgba(0,0,0,0.5)]", children: [
1585
- /* @__PURE__ */ jsxRuntime.jsx(
1586
- "button",
1587
- {
1588
- className: "absolute top-5 right-5 bg-transparent border-none text-white cursor-pointer p-2 flex items-center justify-center rounded transition-colors hover:bg-white/10 active:bg-white/20",
1589
- onClick: handleClose,
1590
- "aria-label": "Close",
1591
- children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1592
- /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1593
- /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1594
- ] })
1595
- }
1596
- ),
1597
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-3 sm:gap-4 flex-1 overflow-y-auto custom__scrollbar", children: [
1598
- /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "m-0 text-white text-xl sm:text-2xl font-semibold leading-tight", children: "Continue on Mobile" }),
1599
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "m-0 text-white text-sm sm:text-base opacity-90 leading-relaxed", children: "Scan this QR on your phone to capture your face and document" }),
1600
- qrUrl && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center items-center p-3 sm:p-4 bg-white rounded-xl border-2 border-white", children: /* @__PURE__ */ jsxRuntime.jsx(
1601
- qrcode_react.QRCodeSVG,
1602
- {
1603
- value: qrUrl,
1604
- size: 180,
1605
- level: "H",
1606
- includeMargin: true,
1607
- bgColor: "transparent",
1608
- fgColor: "#000000"
1609
- }
1610
- ) }),
1611
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full text-left mt-auto", children: [
1612
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "m-0 mb-2 text-white text-xs sm:text-sm opacity-80", children: "Or open:" }),
1613
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col sm:flex-row items-start sm:items-center gap-2 p-2 sm:p-3 bg-white/10 rounded-lg border border-white/20", children: [
1614
- /* @__PURE__ */ jsxRuntime.jsx("code", { className: "flex-1 text-white text-xs sm:text-sm break-all text-left m-0 font-mono", children: qrUrl }),
1615
- /* @__PURE__ */ jsxRuntime.jsx(
1616
- "button",
1617
- {
1618
- className: "bg-transparent border-none text-white cursor-pointer p-1.5 flex items-center justify-center rounded transition-colors flex-shrink-0 hover:bg-white/10 active:bg-white/20 self-end sm:self-auto",
1619
- onClick: handleCopyUrl,
1620
- "aria-label": "Copy URL",
1621
- title: copied ? "Copied!" : "Copy URL",
1622
- children: copied ? /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "20 6 9 17 4 12" }) }) : /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1623
- /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
1624
- /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
1625
- ] })
1626
- }
1627
- )
1628
- ] })
1629
- ] }),
1586
+ 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: [
1587
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 opacity-10", style: {
1588
+ backgroundImage: `radial-gradient(circle at 2px 2px, rgba(255,255,255,0.15) 1px, transparent 0)`,
1589
+ backgroundSize: "40px 40px"
1590
+ } }),
1591
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "relative bg-[rgba(20,20,20,0.95)] backdrop-blur-sm rounded-2xl p-5 sm:p-6 md:p-7 max-w-[450px] w-full h-[80vh] flex flex-col text-center shadow-[0_8px_32px_rgba(0,0,0,0.5)] border border-white/10", children: [
1630
1592
  /* @__PURE__ */ jsxRuntime.jsx(
1631
1593
  "button",
1632
1594
  {
1633
- className: "w-full py-3 sm:py-4 px-6 bg-gradient-to-r from-[#FF842D] to-[#FF2D55] border-none rounded-lg text-white text-sm sm:text-base font-semibold cursor-pointer transition-all hover:-translate-y-0.5 hover:shadow-[0_4px_12px_rgba(255,107,53,0.4)] active:translate-y-0",
1634
- onClick: handleRefresh,
1635
- children: "I've completed on mobile - Refresh"
1595
+ className: "absolute top-5 right-5 bg-transparent border-none text-white cursor-pointer p-2 flex items-center justify-center rounded transition-colors hover:bg-white/10 active:bg-white/20",
1596
+ onClick: handleClose,
1597
+ "aria-label": "Close",
1598
+ children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1599
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1600
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1601
+ ] })
1636
1602
  }
1637
- )
1603
+ ),
1604
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-3 sm:gap-4 flex-1 overflow-y-auto custom__scrollbar", children: [
1605
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "m-0 text-white text-xl sm:text-2xl font-semibold leading-tight", children: "Continue on Mobile" }),
1606
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "m-0 text-white text-sm sm:text-base opacity-90 leading-relaxed", children: "Scan this QR on your phone to capture your face and document" }),
1607
+ qrUrl && /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex justify-center items-center p-3 sm:p-4 bg-white rounded-xl border-2 border-white", children: /* @__PURE__ */ jsxRuntime.jsx(
1608
+ qrcode_react.QRCodeSVG,
1609
+ {
1610
+ value: qrUrl,
1611
+ size: 180,
1612
+ level: "H",
1613
+ includeMargin: true,
1614
+ bgColor: "transparent",
1615
+ fgColor: "#000000"
1616
+ }
1617
+ ) }),
1618
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full text-left mt-auto", children: [
1619
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "m-0 mb-2 text-white text-xs sm:text-sm opacity-80", children: "Or open:" }),
1620
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col sm:flex-row items-start sm:items-center gap-2 p-2 sm:p-3 bg-white/10 rounded-lg border border-white/20", children: [
1621
+ /* @__PURE__ */ jsxRuntime.jsx("code", { className: "flex-1 text-white text-xs sm:text-sm break-all text-left m-0 font-mono", children: qrUrl }),
1622
+ /* @__PURE__ */ jsxRuntime.jsx(
1623
+ "button",
1624
+ {
1625
+ className: "bg-transparent border-none text-white cursor-pointer p-1.5 flex items-center justify-center rounded transition-colors flex-shrink-0 hover:bg-white/10 active:bg-white/20 self-end sm:self-auto",
1626
+ onClick: handleCopyUrl,
1627
+ "aria-label": "Copy URL",
1628
+ title: copied ? "Copied!" : "Copy URL",
1629
+ children: copied ? /* @__PURE__ */ jsxRuntime.jsx("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: /* @__PURE__ */ jsxRuntime.jsx("polyline", { points: "20 6 9 17 4 12" }) }) : /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1630
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
1631
+ /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M5 15H4a2 2 0 0 1-2-2V4a2 2 0 0 1 2-2h9a2 2 0 0 1 2 2v1" })
1632
+ ] })
1633
+ }
1634
+ )
1635
+ ] })
1636
+ ] }),
1637
+ /* @__PURE__ */ jsxRuntime.jsx(
1638
+ "button",
1639
+ {
1640
+ className: "w-full py-3 sm:py-4 px-6 bg-gradient-to-r from-[#FF842D] to-[#FF2D55] border-none rounded-lg text-white text-sm sm:text-base font-semibold cursor-pointer transition-all hover:-translate-y-0.5 hover:shadow-[0_4px_12px_rgba(255,107,53,0.4)] active:translate-y-0",
1641
+ onClick: handleRefresh,
1642
+ children: "I've completed on mobile - Refresh"
1643
+ }
1644
+ )
1645
+ ] })
1638
1646
  ] })
1639
- ] }) });
1647
+ ] });
1640
1648
  }
1641
1649
  var QRCodePage_default = QRCodePage;
1642
1650
  var KycFlow = ({
@@ -1645,7 +1653,8 @@ var KycFlow = ({
1645
1653
  serverKey,
1646
1654
  deviceType,
1647
1655
  startAtQr = true,
1648
- onClose
1656
+ onClose,
1657
+ mobileBaseUrl = "https://astra-sdk-rebuild.vercel.app"
1649
1658
  }) => {
1650
1659
  const [currentView, setCurrentView] = React.useState(startAtQr ? "qr" : "mobileroute");
1651
1660
  const handleNavigate = (view) => {
@@ -1663,7 +1672,15 @@ var KycFlow = ({
1663
1672
  sessionId,
1664
1673
  serverKey,
1665
1674
  deviceType,
1666
- children: currentView === "qr" ? /* @__PURE__ */ jsxRuntime.jsx(QRCodePage_default, { onClose: handleClose, onNavigate: handleNavigate }) : /* @__PURE__ */ jsxRuntime.jsx(MobileRoute_default, { onClose: handleClose, onNavigate: handleNavigate })
1675
+ children: currentView === "qr" ? /* @__PURE__ */ jsxRuntime.jsx(
1676
+ QRCodePage_default,
1677
+ {
1678
+ onClose: handleClose,
1679
+ onNavigate: handleNavigate,
1680
+ mobileBaseUrl,
1681
+ sessionId
1682
+ }
1683
+ ) : /* @__PURE__ */ jsxRuntime.jsx(MobileRoute_default, { onClose: handleClose, onNavigate: handleNavigate })
1667
1684
  }
1668
1685
  );
1669
1686
  };