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.
@@ -1346,17 +1346,19 @@ function MobileRoute({ onClose, onNavigate } = {}) {
1346
1346
  return /* @__PURE__ */ jsxRuntime.jsx(FaceScanModal_default, { onClose: handleClose, onComplete: handleComplete });
1347
1347
  }
1348
1348
  var MobileRoute_default = MobileRoute;
1349
- function QRCodePage({ onClose, onNavigate } = {}) {
1349
+ function QRCodePage({ onClose, onNavigate, mobileBaseUrl = "https://astra-sdk-rebuild.vercel.app", sessionId } = {}) {
1350
1350
  const [qrUrl, setQrUrl] = React.useState("");
1351
1351
  const [copied, setCopied] = React.useState(false);
1352
1352
  React.useEffect(() => {
1353
- const currentUrl = window.location.origin;
1354
1353
  const searchParams = new URLSearchParams(window.location.search);
1354
+ if (sessionId) {
1355
+ searchParams.set("sessionId", sessionId);
1356
+ }
1355
1357
  const mobileRoute = "/mobileroute";
1356
1358
  const queryString = searchParams.toString();
1357
- const fullUrl = `${currentUrl}${mobileRoute}${queryString ? `?${queryString}` : ""}`;
1359
+ const fullUrl = `${mobileBaseUrl}${mobileRoute}${queryString ? `?${queryString}` : ""}`;
1358
1360
  setQrUrl(fullUrl);
1359
- }, []);
1361
+ }, [mobileBaseUrl, sessionId]);
1360
1362
  const handleCopyUrl = async () => {
1361
1363
  if (qrUrl) {
1362
1364
  try {
@@ -1376,62 +1378,68 @@ function QRCodePage({ onClose, onNavigate } = {}) {
1376
1378
  const handleRefresh = () => {
1377
1379
  window.location.reload();
1378
1380
  };
1379
- 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: [
1380
- /* @__PURE__ */ jsxRuntime.jsx(
1381
- "button",
1382
- {
1383
- 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",
1384
- onClick: handleClose,
1385
- "aria-label": "Close",
1386
- children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1387
- /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1388
- /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1389
- ] })
1390
- }
1391
- ),
1392
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-3 sm:gap-4 flex-1 overflow-y-auto custom__scrollbar", children: [
1393
- /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "m-0 text-white text-xl sm:text-2xl font-semibold leading-tight", children: "Continue on Mobile" }),
1394
- /* @__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" }),
1395
- 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(
1396
- qrcode_react.QRCodeSVG,
1397
- {
1398
- value: qrUrl,
1399
- size: 180,
1400
- level: "H",
1401
- includeMargin: true,
1402
- bgColor: "transparent",
1403
- fgColor: "#000000"
1404
- }
1405
- ) }),
1406
- /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full text-left mt-auto", children: [
1407
- /* @__PURE__ */ jsxRuntime.jsx("p", { className: "m-0 mb-2 text-white text-xs sm:text-sm opacity-80", children: "Or open:" }),
1408
- /* @__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: [
1409
- /* @__PURE__ */ jsxRuntime.jsx("code", { className: "flex-1 text-white text-xs sm:text-sm break-all text-left m-0 font-mono", children: qrUrl }),
1410
- /* @__PURE__ */ jsxRuntime.jsx(
1411
- "button",
1412
- {
1413
- 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",
1414
- onClick: handleCopyUrl,
1415
- "aria-label": "Copy URL",
1416
- title: copied ? "Copied!" : "Copy URL",
1417
- 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: [
1418
- /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
1419
- /* @__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" })
1420
- ] })
1421
- }
1422
- )
1423
- ] })
1424
- ] }),
1381
+ 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: [
1382
+ /* @__PURE__ */ jsxRuntime.jsx("div", { className: "absolute inset-0 opacity-10", style: {
1383
+ backgroundImage: `radial-gradient(circle at 2px 2px, rgba(255,255,255,0.15) 1px, transparent 0)`,
1384
+ backgroundSize: "40px 40px"
1385
+ } }),
1386
+ /* @__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: [
1425
1387
  /* @__PURE__ */ jsxRuntime.jsx(
1426
1388
  "button",
1427
1389
  {
1428
- 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",
1429
- onClick: handleRefresh,
1430
- children: "I've completed on mobile - Refresh"
1390
+ 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",
1391
+ onClick: handleClose,
1392
+ "aria-label": "Close",
1393
+ children: /* @__PURE__ */ jsxRuntime.jsxs("svg", { width: "24", height: "24", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", strokeWidth: "2", children: [
1394
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "18", y1: "6", x2: "6", y2: "18" }),
1395
+ /* @__PURE__ */ jsxRuntime.jsx("line", { x1: "6", y1: "6", x2: "18", y2: "18" })
1396
+ ] })
1431
1397
  }
1432
- )
1398
+ ),
1399
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex flex-col items-center gap-3 sm:gap-4 flex-1 overflow-y-auto custom__scrollbar", children: [
1400
+ /* @__PURE__ */ jsxRuntime.jsx("h1", { className: "m-0 text-white text-xl sm:text-2xl font-semibold leading-tight", children: "Continue on Mobile" }),
1401
+ /* @__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" }),
1402
+ 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(
1403
+ qrcode_react.QRCodeSVG,
1404
+ {
1405
+ value: qrUrl,
1406
+ size: 180,
1407
+ level: "H",
1408
+ includeMargin: true,
1409
+ bgColor: "transparent",
1410
+ fgColor: "#000000"
1411
+ }
1412
+ ) }),
1413
+ /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "w-full text-left mt-auto", children: [
1414
+ /* @__PURE__ */ jsxRuntime.jsx("p", { className: "m-0 mb-2 text-white text-xs sm:text-sm opacity-80", children: "Or open:" }),
1415
+ /* @__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: [
1416
+ /* @__PURE__ */ jsxRuntime.jsx("code", { className: "flex-1 text-white text-xs sm:text-sm break-all text-left m-0 font-mono", children: qrUrl }),
1417
+ /* @__PURE__ */ jsxRuntime.jsx(
1418
+ "button",
1419
+ {
1420
+ 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",
1421
+ onClick: handleCopyUrl,
1422
+ "aria-label": "Copy URL",
1423
+ title: copied ? "Copied!" : "Copy URL",
1424
+ 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: [
1425
+ /* @__PURE__ */ jsxRuntime.jsx("rect", { x: "9", y: "9", width: "13", height: "13", rx: "2", ry: "2" }),
1426
+ /* @__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" })
1427
+ ] })
1428
+ }
1429
+ )
1430
+ ] })
1431
+ ] }),
1432
+ /* @__PURE__ */ jsxRuntime.jsx(
1433
+ "button",
1434
+ {
1435
+ 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",
1436
+ onClick: handleRefresh,
1437
+ children: "I've completed on mobile - Refresh"
1438
+ }
1439
+ )
1440
+ ] })
1433
1441
  ] })
1434
- ] }) });
1442
+ ] });
1435
1443
  }
1436
1444
  var QRCodePage_default = QRCodePage;
1437
1445
  var KycFlow = ({
@@ -1440,7 +1448,8 @@ var KycFlow = ({
1440
1448
  serverKey,
1441
1449
  deviceType,
1442
1450
  startAtQr = true,
1443
- onClose
1451
+ onClose,
1452
+ mobileBaseUrl = "https://astra-sdk-rebuild.vercel.app"
1444
1453
  }) => {
1445
1454
  const [currentView, setCurrentView] = React.useState(startAtQr ? "qr" : "mobileroute");
1446
1455
  const handleNavigate = (view) => {
@@ -1458,7 +1467,15 @@ var KycFlow = ({
1458
1467
  sessionId,
1459
1468
  serverKey,
1460
1469
  deviceType,
1461
- children: currentView === "qr" ? /* @__PURE__ */ jsxRuntime.jsx(QRCodePage_default, { onClose: handleClose, onNavigate: handleNavigate }) : /* @__PURE__ */ jsxRuntime.jsx(MobileRoute_default, { onClose: handleClose, onNavigate: handleNavigate })
1470
+ children: currentView === "qr" ? /* @__PURE__ */ jsxRuntime.jsx(
1471
+ QRCodePage_default,
1472
+ {
1473
+ onClose: handleClose,
1474
+ onNavigate: handleNavigate,
1475
+ mobileBaseUrl,
1476
+ sessionId
1477
+ }
1478
+ ) : /* @__PURE__ */ jsxRuntime.jsx(MobileRoute_default, { onClose: handleClose, onNavigate: handleNavigate })
1462
1479
  }
1463
1480
  );
1464
1481
  };