strapi-plugin-magic-sessionmanager 4.11.0 → 4.12.0

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.
Files changed (27) hide show
  1. package/CHANGELOG.md +49 -1
  2. package/README.md +24 -15
  3. package/dist/admin/{Analytics-D56O8Q6e.mjs → Analytics-C_c24Uzq.mjs} +45 -75
  4. package/dist/admin/{Analytics-CBHeWeGn.js → Analytics-lP0-RsVd.js} +45 -75
  5. package/dist/admin/{App-EDIkLJdb.mjs → App-DCyNPn1k.mjs} +161 -117
  6. package/dist/admin/{App-D4cBPwB_.js → App-miWDdmdX.js} +161 -117
  7. package/dist/admin/{OnlineUsersWidget-BF2R2YIy.js → OnlineUsersWidget-C6b7e4jb.js} +18 -26
  8. package/dist/admin/{OnlineUsersWidget-MwUutkKQ.mjs → OnlineUsersWidget-C6wlwENC.mjs} +18 -26
  9. package/dist/admin/{Settings-CMzEF8EH.js → Settings-D9zyn5xn.js} +1 -1
  10. package/dist/admin/{Settings-bLMyi0BN.mjs → Settings-DssYw2W4.mjs} +1 -1
  11. package/dist/admin/{de-CxfuTF6C.mjs → de--yNl7MPl.mjs} +4 -6
  12. package/dist/admin/{de-DVNTHmSo.js → de-DjPEATFf.js} +4 -6
  13. package/dist/admin/{en-BcPIlQYL.mjs → en-5U7g51cH.mjs} +4 -6
  14. package/dist/admin/{en-BuVXIcHA.js → en-BoO12UQw.js} +4 -6
  15. package/dist/admin/{es-DxHpaNA1.mjs → es-BJR-zCXL.mjs} +4 -6
  16. package/dist/admin/{es-CEteHmBO.js → es-BLpEuycJ.js} +4 -6
  17. package/dist/admin/{fr-BMd2-wW7.js → fr-BE828R9Q.js} +4 -6
  18. package/dist/admin/{fr-Dw43lHg7.mjs → fr-CeeCYQCs.mjs} +4 -6
  19. package/dist/admin/{index-DvNfekoR.js → index-CfQOMZVX.js} +9 -46
  20. package/dist/admin/{index-qa6Qnfkc.mjs → index-rbxJZcLv.mjs} +35 -72
  21. package/dist/admin/index.js +1 -1
  22. package/dist/admin/index.mjs +2 -2
  23. package/dist/admin/{pt-BvO63p01.js → pt-BWEFiuvo.js} +4 -6
  24. package/dist/admin/{pt-7jnxDSX-.mjs → pt-CorrU3yG.mjs} +4 -6
  25. package/dist/server/index.js +789 -36
  26. package/dist/server/index.mjs +789 -36
  27. package/package.json +1 -1
@@ -7,7 +7,7 @@ import { Typography, Flex, Loader, Button, Modal, Accordion, Box, IconButton, Li
7
7
  import { Earth, Duplicate, Cross, Eye, Trash, More, CaretDown, Download, ArrowClockwise, Check, Clock, User, ChartBubble, Cog } from "@strapi/icons";
8
8
  import { EmptyDocuments } from "@strapi/icons/symbols";
9
9
  import styled, { useTheme } from "styled-components";
10
- import { g as getSessionEndReason, a as getEndReasonPresentation, b as getTranslation, p as presentText, i as isSessionFilter, D as DEFAULT_SESSION_FILTER, c as isEndReasonFilter, d as DEFAULT_END_REASON_FILTER, e as getSessionState, f as getDevicePresentation, u as useSessionFormatters, h as getSessionStatus, j as isNativeOnlySession, k as getSessionEndReasonPresentation, l as DeviceIcon, S as StatusBadge, P as PropertyList, C as ConfirmAction, t as toValidDate, m as pluginId, n as logSafeAdminError, o as PersistentAlert, R as ReadableText, M as MissingValue, V as ValueOrMissing, q as SESSION_STATES, r as SESSION_STATUS_PRESENTATION, s as requireSessionList, v as isCancelledRequest, w as filterSessionsBySearch, x as filterSessionsByStatus, y as SESSION_FILTER_OPTIONS, E as END_REASON_FILTER_OPTIONS, z as PageShell, A as StatGrid, B as StatCard, F as restoreDialogFocus, G as pluginPermissions } from "./index-qa6Qnfkc.mjs";
10
+ import { g as getSessionEndReason, a as getEndReasonPresentation, b as getTranslation, p as presentText, i as isSessionFilter, D as DEFAULT_SESSION_FILTER, c as isEndReasonFilter, d as DEFAULT_END_REASON_FILTER, e as getDevicePresentation, u as useSessionFormatters, f as getSessionStatus, h as isNativeOnlySession, j as getSessionEndReasonPresentation, k as DeviceIcon, S as StatusBadge, P as PropertyList, C as ConfirmAction, t as toValidDate, l as pluginId, m as logSafeAdminError, n as PersistentAlert, R as ReadableText, M as MissingValue, V as ValueOrMissing, o as SESSION_STATES, q as SESSION_STATUS_PRESENTATION, r as isCancelledRequest, s as SESSION_FILTER_OPTIONS, E as END_REASON_FILTER_OPTIONS, v as PageShell, w as StatGrid, x as StatCard, y as restoreDialogFocus, z as requireSessionList, A as pluginPermissions } from "./index-rbxJZcLv.mjs";
11
11
  const EndReason = ({ session, reason, variant = "omega", textColor = "neutral800" }) => {
12
12
  const { formatMessage } = useIntl();
13
13
  const key = reason || getSessionEndReason(session);
@@ -19,27 +19,71 @@ const EndReason = ({ session, reason, variant = "omega", textColor = "neutral800
19
19
  });
20
20
  return /* @__PURE__ */ jsx(Typography, { variant, textColor, "data-end-reason": presentation.reason, children: translate(presentation) });
21
21
  };
22
- function paginateSessions(sessions = [], currentPage = 1, pageSize = 25) {
23
- const items = Array.isArray(sessions) ? sessions : [];
24
- const requestedSize = Number(pageSize);
25
- const normalizedSize = Number.isFinite(requestedSize) && requestedSize > 0 ? Math.floor(requestedSize) : 1;
26
- const total = items.length;
27
- const pageCount = Math.max(1, Math.ceil(total / normalizedSize));
28
- const requestedPage = Number(currentPage);
29
- const page = Math.min(
30
- pageCount,
31
- Math.max(1, Number.isFinite(requestedPage) ? Math.floor(requestedPage) : 1)
22
+ const MAX_EXPORT_ROWS = 5e4;
23
+ const EXPORT_BATCH_SIZE = 1e3;
24
+ const EMPTY_SESSION_STATS = Object.freeze({
25
+ total: 0,
26
+ open: 0,
27
+ active: 0,
28
+ idle: 0,
29
+ ended: 0,
30
+ loggedOut: 0,
31
+ timedOut: 0,
32
+ otherReasons: 0,
33
+ usersOnline: 0,
34
+ nativeOnly: 0
35
+ });
36
+ function filterParams(query) {
37
+ const params = {};
38
+ if (query.status && query.status !== "all") params.status = query.status;
39
+ if (query.status === "ended" && query.reason && query.reason !== "all") {
40
+ params.reason = query.reason;
41
+ }
42
+ const search = typeof query.search === "string" ? query.search.trim().slice(0, 100) : "";
43
+ if (search) params.search = search;
44
+ return params;
45
+ }
46
+ function buildListParams(query) {
47
+ return {
48
+ page: String(Math.max(1, Number(query.page) || 1)),
49
+ pageSize: String(query.pageSize),
50
+ ...filterParams(query)
51
+ };
52
+ }
53
+ function buildExportParams(query, cursor) {
54
+ return {
55
+ limit: String(EXPORT_BATCH_SIZE),
56
+ ...filterParams(query),
57
+ ...cursor ? { cursor } : {}
58
+ };
59
+ }
60
+ const isCount = (value) => Number.isInteger(value) && value >= 0;
61
+ function readSessionPage(payload) {
62
+ const body = (
63
+ /** @type {any} */
64
+ payload
32
65
  );
33
- const offset = (page - 1) * normalizedSize;
66
+ const pagination = body?.meta?.pagination;
67
+ if (!Array.isArray(body?.data) || !isCount(pagination?.total) || !isCount(pagination?.pageCount)) {
68
+ throw new Error("Invalid session page response");
69
+ }
34
70
  return {
35
- items: items.slice(offset, offset + normalizedSize),
36
- page,
37
- pageCount,
38
- startIndex: total === 0 ? 0 : offset + 1,
39
- endIndex: Math.min(total, offset + normalizedSize),
40
- total
71
+ rows: body.data,
72
+ pagination: { total: pagination.total, pageCount: Math.max(1, pagination.pageCount) }
41
73
  };
42
74
  }
75
+ function readSessionStats(payload) {
76
+ const data = (
77
+ /** @type {any} */
78
+ payload?.data
79
+ );
80
+ const stats = { ...EMPTY_SESSION_STATS };
81
+ for (const key of Object.keys(EMPTY_SESSION_STATS)) {
82
+ if (!isCount(data?.[key])) throw new Error("Invalid session statistics response");
83
+ stats[key] = data[key];
84
+ }
85
+ return stats;
86
+ }
43
87
  const CSV_HEADERS = Object.freeze([
44
88
  "ID",
45
89
  "Status",
@@ -55,7 +99,12 @@ const CSV_HEADERS = Object.freeze([
55
99
  "Minutes Idle",
56
100
  "End Reason"
57
101
  ]);
58
- const escapeCsvValue = (value) => `"${String(value ?? "").replace(/"/g, '""')}"`;
102
+ const FORMULA_START = /^[=+\-@\t\r]/;
103
+ const escapeCsvValue = (value) => {
104
+ const text = String(value ?? "");
105
+ const safe = typeof value === "string" && FORMULA_START.test(text) ? `'${text}` : text;
106
+ return `"${safe.replace(/"/g, '""')}"`;
107
+ };
59
108
  function toIsoTimestamp(value) {
60
109
  if (value === null || value === void 0 || value === "") return "";
61
110
  const date = value instanceof Date ? value : new Date(
@@ -326,39 +375,6 @@ function hasActiveFilters(state) {
326
375
  if (!state) return false;
327
376
  return state.status !== DEFAULT_SESSION_FILTER || Boolean(state.reason) && state.reason !== DEFAULT_END_REASON_FILTER || Boolean(state.search);
328
377
  }
329
- const getUserKey = (session) => {
330
- const user = session?.user;
331
- return presentText(user?.documentId) || presentText(user?.id) || presentText(user?.email);
332
- };
333
- function getSessionStats(sessions) {
334
- const rows = Array.isArray(sessions) ? sessions : [];
335
- const stats = {
336
- active: 0,
337
- idle: 0,
338
- ended: 0,
339
- total: rows.length,
340
- usersOnline: 0,
341
- loggedOut: 0,
342
- timedOut: 0,
343
- otherReasons: 0
344
- };
345
- const onlineUsers = /* @__PURE__ */ new Set();
346
- for (const session of rows) {
347
- const state = getSessionState(session);
348
- stats[state] += 1;
349
- if (state === "active") {
350
- const key = getUserKey(session);
351
- if (key) onlineUsers.add(key);
352
- } else if (state === "ended") {
353
- const reason = getSessionEndReason(session);
354
- if (reason === "logout") stats.loggedOut += 1;
355
- else if (reason === "idle") stats.timedOut += 1;
356
- else stats.otherReasons += 1;
357
- }
358
- }
359
- stats.usersOnline = onlineUsers.size;
360
- return stats;
361
- }
362
378
  function getSessionUserLabels(session) {
363
379
  const username = presentText(session?.user?.username);
364
380
  const email = presentText(session?.user?.email);
@@ -1294,7 +1310,6 @@ const HowSessionsWork = () => {
1294
1310
  )
1295
1311
  ] });
1296
1312
  };
1297
- const LOADED_SESSIONS_LIMIT = 1e3;
1298
1313
  const CLOCK_TICK_MS = 30 * 1e3;
1299
1314
  const ANALYTICS_PATH = `/settings/${pluginId}/analytics`;
1300
1315
  const CONFIGURATION_PATH = `/settings/${pluginId}/general`;
@@ -1332,7 +1347,9 @@ const HomePage = () => {
1332
1347
  const t = (id, defaultMessage, values) => formatMessage({ id: getTranslation(id), defaultMessage }, values);
1333
1348
  const dashboard = parseDashboardQuery(query);
1334
1349
  const [sessions, setSessions] = useState([]);
1335
- const [truncated, setTruncated] = useState(false);
1350
+ const [pagination, setPagination] = useState({ total: 0, pageCount: 1 });
1351
+ const [stats, setStats] = useState(EMPTY_SESSION_STATS);
1352
+ const [exporting, setExporting] = useState(false);
1336
1353
  const [loading, setLoading] = useState(true);
1337
1354
  const [refreshing, setRefreshing] = useState(false);
1338
1355
  const [loadError, setLoadError] = useState(false);
@@ -1352,6 +1369,16 @@ const HomePage = () => {
1352
1369
  const mutationSnapshotRef = useRef([]);
1353
1370
  const listHeadingId = `session-list-caption-${useId().replace(/:/g, "")}`;
1354
1371
  const mutationPending = Boolean(terminatingSessionId || deletingSessionId);
1372
+ const listQuery = useMemo(
1373
+ () => ({
1374
+ page: dashboard.page,
1375
+ pageSize: dashboard.pageSize,
1376
+ status: dashboard.status,
1377
+ reason: dashboard.reason,
1378
+ search: dashboard.search
1379
+ }),
1380
+ [dashboard.page, dashboard.pageSize, dashboard.status, dashboard.reason, dashboard.search]
1381
+ );
1355
1382
  useEffect(() => {
1356
1383
  const timer = setInterval(() => setNow(Date.now()), CLOCK_TICK_MS);
1357
1384
  return () => clearInterval(timer);
@@ -1362,11 +1389,16 @@ const HomePage = () => {
1362
1389
  if (hasLoadedRef.current) setRefreshing(true);
1363
1390
  else setLoading(true);
1364
1391
  try {
1365
- const { data } = await get(`/${pluginId}/sessions`);
1366
- const list = requireSessionList(data);
1392
+ const [listResponse, statsResponse] = await Promise.all([
1393
+ get(`/${pluginId}/sessions`, { params: buildListParams(listQuery) }),
1394
+ get(`/${pluginId}/sessions/stats`)
1395
+ ]);
1396
+ const page = readSessionPage(listResponse.data);
1397
+ const nextStats = readSessionStats(statsResponse.data);
1367
1398
  if (requestId !== requestIdRef.current) return;
1368
- setSessions(list);
1369
- setTruncated(data?.meta?.truncated === true);
1399
+ setSessions(page.rows);
1400
+ setPagination(page.pagination);
1401
+ setStats(nextStats);
1370
1402
  setLoadError(false);
1371
1403
  setHasData(true);
1372
1404
  setLastUpdated(Date.now());
@@ -1382,7 +1414,7 @@ const HomePage = () => {
1382
1414
  setRefreshing(false);
1383
1415
  }
1384
1416
  }
1385
- }, [get]);
1417
+ }, [get, listQuery]);
1386
1418
  useEffect(() => {
1387
1419
  fetchSessions();
1388
1420
  }, [fetchSessions]);
@@ -1470,53 +1502,74 @@ const HomePage = () => {
1470
1502
  setDeletingSessionId(null);
1471
1503
  }
1472
1504
  };
1473
- const filteredSessions = useMemo(
1474
- () => filterSessionsBySearch(
1475
- filterSessionsByStatus(sessions, dashboard.status, dashboard.reason),
1476
- dashboard.search,
1477
- formatters.deviceTypeLabel
1478
- ),
1479
- [sessions, dashboard.status, dashboard.reason, dashboard.search, formatters]
1480
- );
1481
- const pageResult = paginateSessions(filteredSessions, dashboard.page, dashboard.pageSize);
1505
+ const pageSize = Number(dashboard.pageSize);
1506
+ const pageResult = {
1507
+ items: sessions,
1508
+ total: pagination.total,
1509
+ pageCount: pagination.pageCount,
1510
+ startIndex: pagination.total > 0 ? (dashboard.page - 1) * pageSize + 1 : 0,
1511
+ endIndex: pagination.total > 0 ? (dashboard.page - 1) * pageSize + sessions.length : 0
1512
+ };
1482
1513
  const visibleIds = pageResult.items.map((session) => String(session.id));
1483
1514
  useLayoutEffect(() => {
1484
1515
  visibleIdsRef.current = visibleIds;
1485
1516
  });
1486
- const handleExportCSV = () => {
1487
- try {
1488
- const csvContent = buildSessionCsv(filteredSessions, {
1489
- unavailableValue: "",
1490
- getDeviceInfo: getExportDeviceInfo,
1491
- getSessionStatus
1517
+ const fetchExportRows = async () => {
1518
+ const rows = [];
1519
+ let cursor = null;
1520
+ do {
1521
+ const { data } = await get(`/${pluginId}/sessions/export`, {
1522
+ params: buildExportParams(listQuery, cursor)
1492
1523
  });
1493
- downloadFile(csvContent, "text/csv;charset=utf-8;", "csv");
1494
- } catch (err) {
1495
- logSafeAdminError("dashboard.exportCsv", err);
1496
- toggleNotification({
1497
- type: "danger",
1498
- message: t("notifications.error.exportFailed", "The export could not be created.")
1499
- });
1500
- }
1524
+ rows.push(...requireSessionList(data));
1525
+ cursor = typeof data?.meta?.nextCursor === "string" ? data.meta.nextCursor : null;
1526
+ } while (cursor && rows.length < MAX_EXPORT_ROWS);
1527
+ const capped = rows.length > MAX_EXPORT_ROWS || Boolean(cursor) && rows.length >= MAX_EXPORT_ROWS;
1528
+ return { rows: rows.slice(0, MAX_EXPORT_ROWS), capped };
1501
1529
  };
1502
- const handleExportJSON = () => {
1530
+ const handleExport = async (format) => {
1531
+ if (exporting) return;
1532
+ setExporting(true);
1503
1533
  try {
1504
- const jsonContent = buildSessionJson(filteredSessions, {
1505
- filterStatus: dashboard.status,
1506
- totalSessions: sessions.length,
1507
- exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
1508
- unavailableValue: "",
1509
- getDeviceInfo: getExportDeviceInfo,
1510
- getSessionStatus,
1511
- truncated
1512
- });
1513
- downloadFile(jsonContent, "application/json", "json");
1534
+ const { rows, capped } = await fetchExportRows();
1535
+ if (format === "csv") {
1536
+ const csvContent = buildSessionCsv(rows, {
1537
+ unavailableValue: "",
1538
+ getDeviceInfo: getExportDeviceInfo,
1539
+ getSessionStatus
1540
+ });
1541
+ downloadFile(csvContent, "text/csv;charset=utf-8;", "csv");
1542
+ } else {
1543
+ const jsonContent = buildSessionJson(rows, {
1544
+ filterStatus: dashboard.status,
1545
+ totalSessions: stats.total,
1546
+ exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
1547
+ unavailableValue: "",
1548
+ getDeviceInfo: getExportDeviceInfo,
1549
+ getSessionStatus,
1550
+ truncated: capped
1551
+ });
1552
+ downloadFile(jsonContent, "application/json", "json");
1553
+ }
1554
+ if (capped) {
1555
+ toggleNotification({
1556
+ type: "warning",
1557
+ message: t(
1558
+ "homepage.export.capped",
1559
+ "The export contains the newest {limit, number} sessions. Narrow the filter to export the rest.",
1560
+ { limit: MAX_EXPORT_ROWS }
1561
+ )
1562
+ });
1563
+ }
1514
1564
  } catch (err) {
1515
- logSafeAdminError("dashboard.exportJson", err);
1565
+ if (isCancelledRequest(err)) return;
1566
+ logSafeAdminError(format === "csv" ? "dashboard.exportCsv" : "dashboard.exportJson", err);
1516
1567
  toggleNotification({
1517
1568
  type: "danger",
1518
1569
  message: t("notifications.error.exportFailed", "The export could not be created.")
1519
1570
  });
1571
+ } finally {
1572
+ setExporting(false);
1520
1573
  }
1521
1574
  };
1522
1575
  const handleSessionClick = (session, opener) => {
@@ -1551,10 +1604,10 @@ const HomePage = () => {
1551
1604
  []
1552
1605
  );
1553
1606
  useEffect(() => {
1554
- if (!loading && dashboard.page > pageResult.pageCount) {
1607
+ if (!loading && !refreshing && dashboard.page > pageResult.pageCount) {
1555
1608
  setQuery({ page: String(pageResult.pageCount) }, "push", true);
1556
1609
  }
1557
- }, [loading, dashboard.page, pageResult.pageCount, setQuery]);
1610
+ }, [loading, refreshing, dashboard.page, pageResult.pageCount, setQuery]);
1558
1611
  const handleStatusChange = (value) => {
1559
1612
  const status = String(value);
1560
1613
  setQuery({ status: status === "all" ? void 0 : status, reason: void 0, page: "1" });
@@ -1573,12 +1626,11 @@ const HomePage = () => {
1573
1626
  setQuery({ search: void 0, _q: void 0, status: void 0, reason: void 0, page: "1" });
1574
1627
  listHeadingRef.current?.focus();
1575
1628
  };
1576
- const stats = getSessionStats(sessions);
1577
1629
  const showSessionData = !loading && hasData;
1578
- const showToolbar = showSessionData && sessions.length > 0;
1579
- const canExport = showSessionData && filteredSessions.length > 0;
1630
+ const showToolbar = showSessionData && stats.total > 0;
1631
+ const canExport = showSessionData && pageResult.total > 0 && !exporting;
1580
1632
  const filtersActive = hasActiveFilters(dashboard);
1581
- const exportValues = { count: filteredSessions.length, limit: LOADED_SESSIONS_LIMIT };
1633
+ const exportValues = { count: Math.min(pageResult.total, MAX_EXPORT_ROWS) };
1582
1634
  const exportMenu = /* @__PURE__ */ jsxs(
1583
1635
  SimpleMenu,
1584
1636
  {
@@ -1587,20 +1639,12 @@ const HomePage = () => {
1587
1639
  startIcon: /* @__PURE__ */ jsx(Download, {}),
1588
1640
  disabled: !canExport,
1589
1641
  children: [
1590
- /* @__PURE__ */ jsx(MenuItem, { onSelect: handleExportCSV, children: truncated ? t(
1591
- "homepage.export.csvTruncated",
1592
- "{count, plural, one {Export # session as CSV} other {Export # sessions as CSV}} (latest {limit, number} sessions only)",
1593
- exportValues
1594
- ) : t(
1642
+ /* @__PURE__ */ jsx(MenuItem, { onSelect: () => void handleExport("csv"), children: t(
1595
1643
  "homepage.export.csv",
1596
1644
  "{count, plural, one {Export # session as CSV} other {Export # sessions as CSV}}",
1597
1645
  exportValues
1598
1646
  ) }),
1599
- /* @__PURE__ */ jsx(MenuItem, { onSelect: handleExportJSON, children: truncated ? t(
1600
- "homepage.export.jsonTruncated",
1601
- "{count, plural, one {Export # session as JSON} other {Export # sessions as JSON}} (latest {limit, number} sessions only)",
1602
- exportValues
1603
- ) : t(
1647
+ /* @__PURE__ */ jsx(MenuItem, { onSelect: () => void handleExport("json"), children: t(
1604
1648
  "homepage.export.json",
1605
1649
  "{count, plural, one {Export # session as JSON} other {Export # sessions as JSON}}",
1606
1650
  exportValues
@@ -1732,13 +1776,13 @@ const HomePage = () => {
1732
1776
  children: /* @__PURE__ */ jsx(ReadableText, { variant: "omega", textColor: "neutral800", tag: "span", children: t("homepage.error.load", "Sessions could not be loaded.") })
1733
1777
  }
1734
1778
  ) : null,
1735
- showSessionData && truncated ? /* @__PURE__ */ jsx(PersistentAlert, { variant: "default", closeLabel: t("common.close", "Close"), children: /* @__PURE__ */ jsx(ReadableText, { variant: "pi", textColor: "neutral700", tag: "span", children: t(
1736
- "homepage.truncated.body",
1737
- "Only the latest {limit, number} sessions are loaded. Counts, filters and exports cover these sessions only.",
1738
- { limit: LOADED_SESSIONS_LIMIT }
1779
+ showSessionData && stats.nativeOnly > 0 ? /* @__PURE__ */ jsx(PersistentAlert, { variant: "default", closeLabel: t("common.close", "Close"), children: /* @__PURE__ */ jsx(ReadableText, { variant: "pi", textColor: "neutral700", tag: "span", children: t(
1780
+ "homepage.nativeOnly.body",
1781
+ "{count, plural, one {# open Strapi session has} other {# open Strapi sessions have}} no session details from this plugin. They are listed on each user’s session panel, not in this list.",
1782
+ { count: stats.nativeOnly }
1739
1783
  ) }) }) : null,
1740
1784
  loading ? /* @__PURE__ */ jsx(Flex, { justifyContent: "center", padding: 8, children: /* @__PURE__ */ jsx(Loader, { children: t("homepage.loading", "Loading sessions") }) }) : null,
1741
- showSessionData && sessions.length > 0 ? /* @__PURE__ */ jsx(HowSessionsWork, {}) : null,
1785
+ showSessionData && stats.total > 0 ? /* @__PURE__ */ jsx(HowSessionsWork, {}) : null,
1742
1786
  showSessionData && /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
1743
1787
  /* @__PURE__ */ jsx(VisuallyHidden, { children: /* @__PURE__ */ jsx(Typography, { tag: "h2", children: t("homepage.stats.label", "Session statistics") }) }),
1744
1788
  /* @__PURE__ */ jsxs(StatGrid, { label: t("homepage.stats.label", "Session statistics"), children: [
@@ -1827,7 +1871,7 @@ const HomePage = () => {
1827
1871
  ),
1828
1872
  lastUpdatedLine
1829
1873
  ] }),
1830
- filteredSessions.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
1874
+ pageResult.total > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
1831
1875
  isBelowMedium ? /* @__PURE__ */ jsx(SessionCardList, { ...listProps }) : /* @__PURE__ */ jsx(
1832
1876
  SessionTable,
1833
1877
  {
@@ -1859,7 +1903,7 @@ const HomePage = () => {
1859
1903
  }
1860
1904
  )
1861
1905
  ] }),
1862
- showSessionData && sessions.length === 0 && /* @__PURE__ */ jsx(
1906
+ showSessionData && stats.total === 0 && /* @__PURE__ */ jsx(
1863
1907
  EmptyStateLayout,
1864
1908
  {
1865
1909
  icon: /* @__PURE__ */ jsx(EmptyDocuments, { width: "16rem", height: "8.8rem", "aria-hidden": "true" }),