strapi-plugin-magic-sessionmanager 4.18.0 → 4.19.1

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 (31) hide show
  1. package/CHANGELOG.md +38 -0
  2. package/README.md +37 -35
  3. package/dist/admin/{Analytics-C8fV6LDV.js → Analytics-BElmzyNJ.js} +1 -1
  4. package/dist/admin/{Analytics-CBspdl1I.mjs → Analytics-BqFlgLnN.mjs} +1 -1
  5. package/dist/admin/{App-PLwqaRSQ.mjs → App-0thsC_P9.mjs} +1188 -170
  6. package/dist/admin/{App-D92MTQmn.js → App-D_J2eeEG.js} +1216 -198
  7. package/dist/admin/{OnlineUsersWidget-CwfBJdIX.mjs → OnlineUsersWidget-BgJ1ws-5.mjs} +1 -1
  8. package/dist/admin/{OnlineUsersWidget-CiKapC1B.js → OnlineUsersWidget-DMZBwqdY.js} +1 -1
  9. package/dist/admin/{Settings-Duil_4jv.js → Settings-FOkui_ke.js} +40 -270
  10. package/dist/admin/{Settings-CMgL-Aub.mjs → Settings-QN3Mu4AQ.mjs} +2 -232
  11. package/dist/admin/{de-CnInuvMY.js → de-CEyi4lpp.js} +66 -4
  12. package/dist/admin/{de-D2BqfY1f.mjs → de-uGKSKVYD.mjs} +66 -4
  13. package/dist/admin/{en-KnmmYHTF.js → en-CSXeJYKy.js} +66 -4
  14. package/dist/admin/{en-BPy208we.mjs → en-Yu7tfwqx.mjs} +66 -4
  15. package/dist/admin/{es-D1NGCAJK.js → es-BrKqXhAU.js} +66 -4
  16. package/dist/admin/{es-B4VNeT0A.mjs → es-iNG9Amf9.mjs} +66 -4
  17. package/dist/admin/{fr-AwhLN1BC.mjs → fr-CaFICHlf.mjs} +66 -4
  18. package/dist/admin/{fr-D1KNyogi.js → fr-DKZNfdlH.js} +66 -4
  19. package/dist/admin/{index-Bnt0Jq6O.js → index-DEYtqPc3.js} +9 -9
  20. package/dist/admin/{index-BmnC2BPs.mjs → index-h-ksmM8A.mjs} +9 -9
  21. package/dist/admin/index.js +1 -1
  22. package/dist/admin/index.mjs +1 -1
  23. package/dist/admin/{pt-D6m1TijL.mjs → pt-Bz2hWVrq.mjs} +66 -4
  24. package/dist/admin/{pt-EKThRXPY.js → pt-IEagyVDL.js} +66 -4
  25. package/dist/admin/settingsTabs-D02CuEvs.mjs +433 -0
  26. package/dist/admin/settingsTabs-N4TFn-mw.js +432 -0
  27. package/dist/server/index.js +41 -8
  28. package/dist/server/index.mjs +41 -8
  29. package/package.json +1 -1
  30. package/dist/admin/dashboardModel-BhUonEqc.mjs +0 -189
  31. package/dist/admin/dashboardModel-sksvIc1c.js +0 -188
@@ -9,9 +9,8 @@ const designSystem = require("@strapi/design-system");
9
9
  const icons = require("@strapi/icons");
10
10
  const symbols = require("@strapi/icons/symbols");
11
11
  const styled = require("styled-components");
12
- const index = require("./index-Bnt0Jq6O.js");
13
- const dashboardModel = require("./dashboardModel-sksvIc1c.js");
14
- const SectionCard = require("./SectionCard-BlWv8CRt.js");
12
+ const index = require("./index-DEYtqPc3.js");
13
+ const settingsTabs = require("./settingsTabs-N4TFn-mw.js");
15
14
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
16
15
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
17
16
  const EndReason = ({ session, reason, variant = "omega", textColor = "neutral800" }) => {
@@ -289,7 +288,7 @@ function normalizeGeoData(geo, fallback = {}) {
289
288
  const city = index.presentText(geo.city);
290
289
  const timezone = index.presentText(geo.timezone);
291
290
  if (!country && !city && !timezone) return null;
292
- const riskSource = dashboardModel.isRiskSource(geo.riskSource) ? geo.riskSource : null;
291
+ const riskSource = settingsTabs.isRiskSource(geo.riskSource) ? geo.riskSource : null;
293
292
  const rawScore = typeof geo.securityScore === "number" ? geo.securityScore : fallback?.securityScore;
294
293
  const securityScore = riskSource && typeof rawScore === "number" && Number.isFinite(rawScore) ? rawScore : null;
295
294
  return {
@@ -380,8 +379,8 @@ const SessionDetailModal = ({ session, now, onClose, onCloseAutoFocus, onEndSess
380
379
  const userAgent = index.presentText(session.userAgent);
381
380
  const sessionId = index.presentText(session.id);
382
381
  const ipAddress = index.presentText(session.ipAddress);
383
- const user = dashboardModel.getSessionUserLabels(session);
384
- const userEditPath = dashboardModel.getUserEditPath(session);
382
+ const user = settingsTabs.getSessionUserLabels(session);
383
+ const userEditPath = settingsTabs.getUserEditPath(session);
385
384
  const storedGeo = getStoredGeoData(session);
386
385
  const liveGeo = lookup.status === "ok" ? lookup.geo : null;
387
386
  const geo = liveGeo || storedGeo;
@@ -613,7 +612,7 @@ const SessionDetailModal = ({ session, now, onClose, onCloseAutoFocus, onEndSess
613
612
  "modal.security.riskUnavailableNote",
614
613
  "Needs a risk data source. Location data alone cannot tell VPNs, proxies or Tor apart, so no score was calculated."
615
614
  ) }),
616
- /* @__PURE__ */ jsxRuntime.jsx(TargetLink, { tag: reactRouterDom.NavLink, to: dashboardModel.RISK_SETTINGS_PATH, children: t("modal.security.riskSetup", "Set up risk data") })
615
+ /* @__PURE__ */ jsxRuntime.jsx(TargetLink, { tag: reactRouterDom.NavLink, to: settingsTabs.RISK_SETTINGS_PATH, children: t("modal.security.riskSetup", "Set up risk data") })
617
616
  ] }) : null,
618
617
  lookupControls
619
618
  ] }),
@@ -756,9 +755,9 @@ const isolateActionKeys = (event) => {
756
755
  /** @type {Node} */
757
756
  event.target
758
757
  );
759
- if (!dashboardModel.shouldIsolateActionKey(event.key, fromInsideGroup)) return;
758
+ if (!settingsTabs.shouldIsolateActionKey(event.key, fromInsideGroup)) return;
760
759
  event.stopPropagation();
761
- if (dashboardModel.shouldRedispatchEscape(event.key, fromInsideGroup)) {
760
+ if (settingsTabs.shouldRedispatchEscape(event.key, fromInsideGroup)) {
762
761
  const { ownerDocument } = event.currentTarget;
763
762
  ownerDocument.dispatchEvent(
764
763
  new KeyboardEvent("keydown", { key: "Escape", bubbles: true, cancelable: true })
@@ -806,7 +805,7 @@ const SessionActions = ({
806
805
  const t = (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
807
806
  const [deleteOpen, setDeleteOpen] = react.useState(false);
808
807
  const moreRef = react.useRef(null);
809
- const user = dashboardModel.getSessionUserLabels(session).accessible;
808
+ const user = settingsTabs.getSessionUserLabels(session).accessible;
810
809
  const canEnd = session.isActive === true;
811
810
  const device = deviceSummary(session) || deviceTypeLabel(session);
812
811
  const copy = getConfirmationCopy(t, { user, device, isOpen: canEnd });
@@ -833,7 +832,7 @@ const SessionActions = ({
833
832
  );
834
833
  const endKey = `end-${session.id}-${canEnd ? "open" : "ended"}`;
835
834
  if (layout === "table") {
836
- return /* @__PURE__ */ jsxRuntime.jsxs(dashboardModel.RowActions, { onKeyDown: isolateActionKeys, onClick: (event) => event.stopPropagation(), children: [
835
+ return /* @__PURE__ */ jsxRuntime.jsxs(settingsTabs.RowActions, { onKeyDown: isolateActionKeys, onClick: (event) => event.stopPropagation(), children: [
837
836
  /* @__PURE__ */ jsxRuntime.jsx(
838
837
  designSystem.IconButton,
839
838
  {
@@ -974,7 +973,7 @@ const SessionTable = ({
974
973
  return /* @__PURE__ */ jsxRuntime.jsxs(
975
974
  designSystem.Table,
976
975
  {
977
- colCount: compact ? dashboardModel.DASHBOARD_COMPACT_TABLE_COLUMNS : dashboardModel.DASHBOARD_TABLE_COLUMNS,
976
+ colCount: compact ? settingsTabs.DASHBOARD_COMPACT_TABLE_COLUMNS : settingsTabs.DASHBOARD_TABLE_COLUMNS,
978
977
  rowCount: sessions.length + 1,
979
978
  "aria-labelledby": labelledBy,
980
979
  "aria-busy": busy,
@@ -989,7 +988,7 @@ const SessionTable = ({
989
988
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: t("homepage.table.actions", "Actions") }) })
990
989
  ] }) }),
991
990
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: sessions.map((session) => {
992
- const user = dashboardModel.getSessionUserLabels(session);
991
+ const user = settingsTabs.getSessionUserLabels(session);
993
992
  return /* @__PURE__ */ jsxRuntime.jsxs(
994
993
  designSystem.Tr,
995
994
  {
@@ -1065,7 +1064,7 @@ const SessionCardList = ({
1065
1064
  mutationPending,
1066
1065
  getFocusFallback
1067
1066
  }) => /* @__PURE__ */ jsxRuntime.jsx(CardList, { "aria-labelledby": labelledBy, "aria-busy": busy, children: sessions.map((session) => {
1068
- const user = dashboardModel.getSessionUserLabels(session);
1067
+ const user = settingsTabs.getSessionUserLabels(session);
1069
1068
  return /* @__PURE__ */ jsxRuntime.jsx(
1070
1069
  designSystem.Box,
1071
1070
  {
@@ -1201,12 +1200,12 @@ const Legend = styled__default.default.ul`
1201
1200
  const HowSessionsWork = () => {
1202
1201
  const { formatMessage } = reactIntl.useIntl();
1203
1202
  const t = (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
1204
- const [open, setOpen] = react.useState(() => dashboardModel.readDisclosureOpen(dashboardModel.getBrowserStorage()));
1203
+ const [open, setOpen] = react.useState(() => settingsTabs.readDisclosureOpen(settingsTabs.getBrowserStorage()));
1205
1204
  const contentId = `how-sessions-work-${react.useId().replace(/:/g, "")}`;
1206
1205
  const toggle = () => {
1207
1206
  setOpen((previous) => {
1208
1207
  const next = !previous;
1209
- dashboardModel.writeDisclosureOpen(dashboardModel.getBrowserStorage(), next);
1208
+ settingsTabs.writeDisclosureOpen(settingsTabs.getBrowserStorage(), next);
1210
1209
  return next;
1211
1210
  });
1212
1211
  };
@@ -1678,7 +1677,7 @@ const UntrackedSessionsNotice = ({ stats, onChanged, fallbackFocusRef }) => {
1678
1677
  const CLOCK_TICK_MS = 30 * 1e3;
1679
1678
  const ANALYTICS_PATH = `/settings/${index.pluginId}/analytics`;
1680
1679
  const CONFIGURATION_PATH = `/settings/${index.pluginId}/general`;
1681
- const PaginationTargets$1 = styled__default.default.div`
1680
+ const PaginationTargets$2 = styled__default.default.div`
1682
1681
  nav a {
1683
1682
  min-width: 3.2rem;
1684
1683
  }
@@ -1707,10 +1706,10 @@ const HomePage = () => {
1707
1706
  const { toggleNotification } = StrapiAdmin.useNotification();
1708
1707
  const formatters = index.useSessionFormatters();
1709
1708
  const { isBelowSmall, isBelowMedium, isBelowLarge } = useBreakpoint();
1710
- const [listWidthRef, listWidth] = dashboardModel.useElementWidth();
1709
+ const [listWidthRef, listWidth] = settingsTabs.useElementWidth();
1711
1710
  const [{ query }, setQuery] = StrapiAdmin.useQueryParams();
1712
1711
  const t = (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
1713
- const dashboard = dashboardModel.parseDashboardQuery(query);
1712
+ const dashboard = settingsTabs.parseDashboardQuery(query);
1714
1713
  const [sessions, setSessions] = react.useState([]);
1715
1714
  const [pagination, setPagination] = react.useState({ total: 0, pageCount: 1 });
1716
1715
  const [stats, setStats] = react.useState(EMPTY_SESSION_STATS);
@@ -1787,7 +1786,7 @@ const HomePage = () => {
1787
1786
  if (showDetailModal || mutationPending) return void 0;
1788
1787
  const interval = setInterval(() => {
1789
1788
  fetchSessions();
1790
- }, dashboardModel.AUTO_REFRESH_INTERVAL_MS);
1789
+ }, settingsTabs.AUTO_REFRESH_INTERVAL_MS);
1791
1790
  return () => clearInterval(interval);
1792
1791
  }, [showDetailModal, mutationPending, fetchSessions]);
1793
1792
  const handleTerminateSession = async (session) => {
@@ -1804,7 +1803,7 @@ const HomePage = () => {
1804
1803
  });
1805
1804
  } catch (err) {
1806
1805
  index.logSafeAdminError("dashboard.terminateSession", err);
1807
- if (dashboardModel.getErrorStatus(err) === 404) {
1806
+ if (settingsTabs.getErrorStatus(err) === 404) {
1808
1807
  await fetchSessions();
1809
1808
  toggleNotification({
1810
1809
  type: "warning",
@@ -1844,7 +1843,7 @@ const HomePage = () => {
1844
1843
  });
1845
1844
  } catch (err) {
1846
1845
  index.logSafeAdminError("dashboard.deleteSession", err);
1847
- if (dashboardModel.getErrorStatus(err) === 404) {
1846
+ if (settingsTabs.getErrorStatus(err) === 404) {
1848
1847
  await fetchSessions();
1849
1848
  toggleNotification({
1850
1849
  type: "warning",
@@ -1900,7 +1899,7 @@ const HomePage = () => {
1900
1899
  if (format === "csv") {
1901
1900
  const csvContent = buildSessionCsv(rows, {
1902
1901
  unavailableValue: "",
1903
- getDeviceInfo: dashboardModel.getExportDeviceInfo,
1902
+ getDeviceInfo: settingsTabs.getExportDeviceInfo,
1904
1903
  getSessionStatus: index.getSessionStatus
1905
1904
  });
1906
1905
  downloadFile(csvContent, "text/csv;charset=utf-8;", "csv");
@@ -1910,7 +1909,7 @@ const HomePage = () => {
1910
1909
  totalSessions: stats.total,
1911
1910
  exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
1912
1911
  unavailableValue: "",
1913
- getDeviceInfo: dashboardModel.getExportDeviceInfo,
1912
+ getDeviceInfo: settingsTabs.getExportDeviceInfo,
1914
1913
  getSessionStatus: index.getSessionStatus,
1915
1914
  truncated: capped
1916
1915
  });
@@ -1952,7 +1951,7 @@ const HomePage = () => {
1952
1951
  const getFocusFallback = react.useCallback(
1953
1952
  (sessionId) => ({
1954
1953
  get current() {
1955
- const targetId = dashboardModel.pickFocusSessionId(
1954
+ const targetId = settingsTabs.pickFocusSessionId(
1956
1955
  mutationSnapshotRef.current,
1957
1956
  visibleIdsRef.current,
1958
1957
  sessionId
@@ -1983,7 +1982,7 @@ const HomePage = () => {
1983
1982
  };
1984
1983
  const handleSearch = react.useCallback(
1985
1984
  (value) => {
1986
- setQuery({ search: dashboardModel.encodeSearchQuery(value), _q: void 0, page: "1" }, "push", true);
1985
+ setQuery({ search: settingsTabs.encodeSearchQuery(value), _q: void 0, page: "1" }, "push", true);
1987
1986
  },
1988
1987
  [setQuery]
1989
1988
  );
@@ -1994,7 +1993,7 @@ const HomePage = () => {
1994
1993
  const showSessionData = !loading && hasData;
1995
1994
  const showToolbar = showSessionData && stats.total > 0;
1996
1995
  const canExport = showSessionData && pageResult.total > 0 && !exporting;
1997
- const filtersActive = dashboardModel.hasActiveFilters(dashboard);
1996
+ const filtersActive = settingsTabs.hasActiveFilters(dashboard);
1998
1997
  const exportValues = { count: Math.min(pageResult.total, MAX_EXPORT_ROWS) };
1999
1998
  const exportMenu = /* @__PURE__ */ jsxRuntime.jsxs(
2000
1999
  designSystem.SimpleMenu,
@@ -2245,17 +2244,17 @@ const HomePage = () => {
2245
2244
  SessionTable,
2246
2245
  {
2247
2246
  ...listProps,
2248
- compact: dashboardModel.shouldUseCompactTable(listWidth, isBelowLarge)
2247
+ compact: settingsTabs.shouldUseCompactTable(listWidth, isBelowLarge)
2249
2248
  }
2250
2249
  ),
2251
- /* @__PURE__ */ jsxRuntime.jsx(PaginationTargets$1, { children: /* @__PURE__ */ jsxRuntime.jsxs(
2250
+ /* @__PURE__ */ jsxRuntime.jsx(PaginationTargets$2, { children: /* @__PURE__ */ jsxRuntime.jsxs(
2252
2251
  StrapiAdmin.Pagination.Root,
2253
2252
  {
2254
2253
  pageCount: pageResult.pageCount,
2255
2254
  total: pageResult.total,
2256
- defaultPageSize: Number(dashboardModel.DEFAULT_PAGE_SIZE),
2255
+ defaultPageSize: Number(settingsTabs.DEFAULT_PAGE_SIZE),
2257
2256
  children: [
2258
- /* @__PURE__ */ jsxRuntime.jsx(StrapiAdmin.Pagination.PageSize, { options: [...dashboardModel.PAGE_SIZE_OPTIONS] }),
2257
+ /* @__PURE__ */ jsxRuntime.jsx(StrapiAdmin.Pagination.PageSize, { options: [...settingsTabs.PAGE_SIZE_OPTIONS] }),
2259
2258
  /* @__PURE__ */ jsxRuntime.jsx(StrapiAdmin.Pagination.Links, {})
2260
2259
  ]
2261
2260
  }
@@ -2445,16 +2444,16 @@ function withEventAdminNames(row, placeholderName) {
2445
2444
  }
2446
2445
  const HIGHLIGHT_BADGE = { backgroundColor: "primary100", textColor: "neutral800" };
2447
2446
  const keepActionKeys = (event) => {
2448
- if (dashboardModel.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
2447
+ if (settingsTabs.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
2449
2448
  };
2450
2449
  const SHRINKING_ADMIN_CELL = { maxWidth: 0, width: "34%" };
2451
2450
  const SHRINKING_ROLES_CELL = { maxWidth: 0, width: "22%" };
2452
- const useT$3 = () => {
2451
+ const useT$4 = () => {
2453
2452
  const { formatMessage } = reactIntl.useIntl();
2454
2453
  return (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
2455
2454
  };
2456
2455
  const AdminIdentity = ({ admin }) => {
2457
- const t = useT$3();
2456
+ const t = useT$4();
2458
2457
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, minWidth: 0, children: [
2459
2458
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", minWidth: 0, children: [
2460
2459
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -2474,13 +2473,13 @@ const AdminIdentity = ({ admin }) => {
2474
2473
  ] });
2475
2474
  };
2476
2475
  const AdminRoles = ({ admin }) => {
2477
- const t = useT$3();
2476
+ const t = useT$4();
2478
2477
  const names = (admin.roles || []).map((role) => role.name).filter(Boolean);
2479
2478
  const text = admin.rolesHidden ? t("adminPanel.roles.hidden", "Hidden (needs “Read” on Roles)") : names.length ? names.join(", ") : t("adminPanel.roles.none", "No role");
2480
2479
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", ellipsis: true, title: text, children: text });
2481
2480
  };
2482
2481
  const AdminStatus = ({ admin }) => {
2483
- const t = useT$3();
2482
+ const t = useT$4();
2484
2483
  const status = getAdminStatusPresentation(admin);
2485
2484
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, "data-admin-status": status.key, children: [
2486
2485
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...index.getBadgeColors(status.tone), children: t(status.label.messageId, status.label.defaultMessage) }),
@@ -2495,7 +2494,7 @@ const AdminTable = ({
2495
2494
  onSignOutEverywhere,
2496
2495
  busy
2497
2496
  }) => {
2498
- const t = useT$3();
2497
+ const t = useT$4();
2499
2498
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { background: "neutral0", hasRadius: true, shadow: "tableShadow", "data-admin-table": "", children: /* @__PURE__ */ jsxRuntime.jsxs(
2500
2499
  designSystem.Table,
2501
2500
  {
@@ -2516,7 +2515,7 @@ const AdminTable = ({
2516
2515
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { style: SHRINKING_ROLES_CELL, children: /* @__PURE__ */ jsxRuntime.jsx(AdminRoles, { admin }) }),
2517
2516
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(AdminStatus, { admin }) }),
2518
2517
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(LastActive, { value: admin.lastActiveAt }) }),
2519
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(dashboardModel.RowActions, { onKeyDown: keepActionKeys, children: [
2518
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(settingsTabs.RowActions, { onKeyDown: keepActionKeys, children: [
2520
2519
  /* @__PURE__ */ jsxRuntime.jsx(
2521
2520
  designSystem.IconButton,
2522
2521
  {
@@ -2549,7 +2548,7 @@ const AdminTable = ({
2549
2548
  ) });
2550
2549
  };
2551
2550
  const AdminCardList = ({ admins, labelledBy, canRevoke, onView, onSignOutEverywhere }) => {
2552
- const t = useT$3();
2551
+ const t = useT$4();
2553
2552
  return /* @__PURE__ */ jsxRuntime.jsx(
2554
2553
  designSystem.Flex,
2555
2554
  {
@@ -2618,6 +2617,7 @@ const AdminCardList = ({ admins, labelledBy, canRevoke, onView, onSignOutEverywh
2618
2617
  );
2619
2618
  };
2620
2619
  const SIGN_IN_FILTER_OPTIONS = Object.freeze(["all", "succeeded", "failed", "signed-out"]);
2620
+ const ALL_ADMINS_FILTER_OPTIONS = Object.freeze([...SIGN_IN_FILTER_OPTIONS, "changes"]);
2621
2621
  const ACTIVITY_ACTION_OPTIONS = Object.freeze([
2622
2622
  "all",
2623
2623
  "view",
@@ -2641,7 +2641,7 @@ function buildSignInParams(filters, now) {
2641
2641
  const params = {
2642
2642
  page: filters.page || 1,
2643
2643
  pageSize: filters.pageSize || EVENT_PAGE_SIZE,
2644
- event: SIGN_IN_FILTER_OPTIONS.includes(filters.event) ? filters.event : "all"
2644
+ event: ALL_ADMINS_FILTER_OPTIONS.includes(filters.event) ? filters.event : "all"
2645
2645
  };
2646
2646
  if (filters.adminId) params.adminId = String(filters.adminId);
2647
2647
  const from = periodStart(filters.period || "all", now);
@@ -2675,12 +2675,20 @@ const FAILURE_REASONS = Object.freeze({
2675
2675
  login_not_allowed: message("adminPanel.activity.reason.notAllowed", "Sign-in is not allowed"),
2676
2676
  rate_limited: message("adminPanel.activity.reason.rateLimited", "Too many attempts")
2677
2677
  });
2678
+ const appUserEvent = (key, tone, icon, messageId, defaultMessage) => ({
2679
+ key,
2680
+ tone,
2681
+ icon,
2682
+ label: message(messageId, defaultMessage),
2683
+ detail: null
2684
+ });
2678
2685
  function getSignInEventPresentation(row) {
2679
2686
  switch (row?.event) {
2680
2687
  case "admin.sign-in":
2681
2688
  return {
2682
2689
  key: "sign-in",
2683
2690
  tone: "success",
2691
+ icon: "signIn",
2684
2692
  label: message("adminPanel.activity.event.signIn", "Signed in"),
2685
2693
  detail: row.reason === "registration" ? message("adminPanel.activity.reason.registration", "First sign-in after registration") : row.reason === "password_reset" ? message(
2686
2694
  "adminPanel.activity.reason.passwordReset",
@@ -2690,14 +2698,16 @@ function getSignInEventPresentation(row) {
2690
2698
  case "admin.sign-in.failed":
2691
2699
  return {
2692
2700
  key: "failed",
2693
- tone: "warning",
2701
+ tone: "danger",
2702
+ icon: "failed",
2694
2703
  label: message("adminPanel.activity.event.failed", "Sign-in failed"),
2695
2704
  detail: FAILURE_REASONS[row.reason] || null
2696
2705
  };
2697
2706
  case "admin.lockout":
2698
2707
  return {
2699
2708
  key: "lockout",
2700
- tone: "warning",
2709
+ tone: "danger",
2710
+ icon: "lockout",
2701
2711
  label: message("adminPanel.activity.event.lockout", "Locked out"),
2702
2712
  detail: FAILURE_REASONS.rate_limited
2703
2713
  };
@@ -2705,20 +2715,150 @@ function getSignInEventPresentation(row) {
2705
2715
  return {
2706
2716
  key: "sign-out",
2707
2717
  tone: "neutral",
2718
+ icon: "signOut",
2708
2719
  label: message("adminPanel.activity.event.signOut", "Signed out"),
2709
2720
  detail: null
2710
2721
  };
2711
2722
  case "admin.session.revoked":
2712
2723
  return {
2713
2724
  key: "revoked",
2714
- tone: "neutral",
2725
+ tone: "warning",
2726
+ icon: "revoked",
2715
2727
  label: message("adminPanel.activity.event.revoked", "Signed out by an admin"),
2716
2728
  detail: row.scope === "one_browser" ? message("adminPanel.activity.scope.oneBrowser", "One browser") : message("adminPanel.activity.scope.everywhere", "Every browser")
2717
2729
  };
2730
+ case "settings.updated":
2731
+ return {
2732
+ key: "settings",
2733
+ tone: "secondary",
2734
+ icon: "settings",
2735
+ label: message("adminPanel.activity.event.settings", "Settings changed"),
2736
+ detail: row.change?.viaToken ? message("adminPanel.activity.via.token", "With an admin API token") : null
2737
+ };
2738
+ case "security-log.read":
2739
+ return {
2740
+ key: "log-read",
2741
+ tone: "secondary",
2742
+ icon: "logRead",
2743
+ label: message("adminPanel.activity.event.logRead", "Log read with an API token"),
2744
+ detail: row.read?.list === "content" ? row.read?.exported ? message(
2745
+ "adminPanel.activity.read.contentExport",
2746
+ "Content Manager activity exported"
2747
+ ) : message("adminPanel.activity.read.content", "Content Manager activity listed") : row.read?.exported ? message("adminPanel.activity.read.signInsExport", "Sign-in history exported") : message("adminPanel.activity.read.signIns", "Sign-in history listed")
2748
+ };
2749
+ case "security-log.retention.purged":
2750
+ return {
2751
+ key: "purged",
2752
+ tone: "neutral",
2753
+ icon: "purged",
2754
+ label: message("adminPanel.activity.event.purged", "Old events deleted"),
2755
+ detail: null
2756
+ };
2757
+ // App-user events (4.17 / 4.18). The admin lists of this view do not return them
2758
+ // today; they get their own label and colour so any list that does shows them clearly.
2759
+ case "user.sign-in.failed":
2760
+ return appUserEvent(
2761
+ "user-failed",
2762
+ "danger",
2763
+ "failed",
2764
+ "adminPanel.activity.event.userFailed",
2765
+ "App user sign-in failed"
2766
+ );
2767
+ case "user.sign-in.refused":
2768
+ return appUserEvent(
2769
+ "user-refused",
2770
+ "danger",
2771
+ "refused",
2772
+ "adminPanel.activity.event.userRefused",
2773
+ "App user sign-in refused"
2774
+ );
2775
+ case "user.lockout":
2776
+ return appUserEvent(
2777
+ "user-lockout",
2778
+ "danger",
2779
+ "lockout",
2780
+ "adminPanel.activity.event.userLockout",
2781
+ "App user locked out"
2782
+ );
2783
+ case "user.lockout.lifted":
2784
+ return appUserEvent(
2785
+ "user-unlock",
2786
+ "secondary",
2787
+ "unlock",
2788
+ "adminPanel.activity.event.userUnlock",
2789
+ "Lockout lifted"
2790
+ );
2791
+ case "user.session.limit":
2792
+ return appUserEvent(
2793
+ "user-limit",
2794
+ "warning",
2795
+ "limit",
2796
+ "adminPanel.activity.event.userLimit",
2797
+ "Session limit reached"
2798
+ );
2799
+ case "user.password-change.ended-others":
2800
+ return appUserEvent(
2801
+ "user-password",
2802
+ "warning",
2803
+ "password",
2804
+ "adminPanel.activity.event.userPassword",
2805
+ "Signed out after a password change"
2806
+ );
2807
+ case "user.sign-in.new-device":
2808
+ return appUserEvent(
2809
+ "user-device",
2810
+ "secondary",
2811
+ "device",
2812
+ "adminPanel.activity.event.userNewDevice",
2813
+ "Sign-in from a new device"
2814
+ );
2815
+ case "user.sign-in.impossible-travel":
2816
+ return appUserEvent(
2817
+ "user-travel",
2818
+ "danger",
2819
+ "travel",
2820
+ "adminPanel.activity.event.userTravel",
2821
+ "Impossible travel"
2822
+ );
2823
+ case "user.not-me":
2824
+ return appUserEvent(
2825
+ "user-not-me",
2826
+ "danger",
2827
+ "notMe",
2828
+ "adminPanel.activity.event.userNotMe",
2829
+ 'Reported as "This wasn’t me"'
2830
+ );
2831
+ case "user.data.exported":
2832
+ return appUserEvent(
2833
+ "user-export",
2834
+ "secondary",
2835
+ "export",
2836
+ "adminPanel.activity.event.userExport",
2837
+ "Personal data exported"
2838
+ );
2718
2839
  default:
2840
+ if (typeof row?.event === "string" && row.event.startsWith("impersonation.")) {
2841
+ return appUserEvent(
2842
+ "impersonation",
2843
+ "warning",
2844
+ "impersonation",
2845
+ "adminPanel.activity.event.impersonation",
2846
+ "Impersonation"
2847
+ );
2848
+ }
2849
+ if (typeof row?.event === "string" && row.event.startsWith("webhook.")) {
2850
+ return appUserEvent(
2851
+ "webhook",
2852
+ "neutral",
2853
+ "webhook",
2854
+ "adminPanel.activity.event.webhook",
2855
+ "Webhook delivery"
2856
+ );
2857
+ }
2719
2858
  return {
2720
2859
  key: "other",
2721
2860
  tone: "neutral",
2861
+ icon: "other",
2722
2862
  label: message("adminPanel.activity.event.other", "Security event"),
2723
2863
  detail: null
2724
2864
  };
@@ -2745,6 +2885,63 @@ function getSessionStatePresentation(session) {
2745
2885
  return null;
2746
2886
  }
2747
2887
  }
2888
+ const RECENT_EVENT_LIMIT = 8;
2889
+ const ACTIVITY_PAGE_SIZE_OPTIONS = Object.freeze(["10", "20", "50", "100"]);
2890
+ const EVENT_TABLE_MIN_WIDTH = Object.freeze({ withAdmin: 800, withoutAdmin: 740 });
2891
+ const EVENT_TABLE_FULL_WIDTH = 1e3;
2892
+ function getEventListLayout(width, { showAdmin = false } = {}) {
2893
+ if (!width) return "full";
2894
+ const min = showAdmin ? EVENT_TABLE_MIN_WIDTH.withAdmin : EVENT_TABLE_MIN_WIDTH.withoutAdmin;
2895
+ if (width < min) return "stacked";
2896
+ return width >= EVENT_TABLE_FULL_WIDTH ? "full" : "table";
2897
+ }
2898
+ function getEventPlace(row) {
2899
+ return [row?.location?.city, row?.location?.country].filter(Boolean).join(", ");
2900
+ }
2901
+ function parseActivityPageQuery(query) {
2902
+ const source = query || {};
2903
+ const event = ALL_ADMINS_FILTER_OPTIONS.includes(String(source.event)) ? String(source.event) : "all";
2904
+ const period = PERIOD_OPTIONS.includes(String(source.period)) ? String(source.period) : "30";
2905
+ const adminId = /^[1-9][0-9]{0,11}$/.test(String(source.adminId ?? "")) ? Number(source.adminId) : null;
2906
+ const page = Number.parseInt(String(source.page ?? ""), 10);
2907
+ const pageSize = String(source.pageSize ?? "");
2908
+ return {
2909
+ event,
2910
+ period,
2911
+ adminId,
2912
+ page: Number.isInteger(page) && page > 0 ? page : 1,
2913
+ pageSize: ACTIVITY_PAGE_SIZE_OPTIONS.includes(pageSize) ? Number(pageSize) : EVENT_PAGE_SIZE
2914
+ };
2915
+ }
2916
+ function hasActivityPageFilters(view) {
2917
+ return view.event !== "all" || view.period !== "30" || view.adminId !== null;
2918
+ }
2919
+ function groupChangedSettings(keys) {
2920
+ const list = Array.isArray(keys) ? keys.filter((key) => typeof key === "string" && key) : [];
2921
+ const byTab = /* @__PURE__ */ new Map();
2922
+ const unknown = [];
2923
+ const seen = /* @__PURE__ */ new Set();
2924
+ for (const key of list) {
2925
+ const tab = settingsTabs.SETTINGS_TAB_IDS.find((id) => settingsTabs.SETTINGS_TAB_FIELDS[id]?.includes(key));
2926
+ const entry = settingsTabs.SETTINGS_FIELD_LABELS[key];
2927
+ if (!tab || !entry) {
2928
+ if (!seen.has(`raw:${key}`)) unknown.push({ key, label: null });
2929
+ seen.add(`raw:${key}`);
2930
+ continue;
2931
+ }
2932
+ if (seen.has(`label:${entry[0]}`)) continue;
2933
+ seen.add(`label:${entry[0]}`);
2934
+ if (!byTab.has(tab)) byTab.set(tab, []);
2935
+ byTab.get(tab).push({ key, label: message(entry[0], entry[1]) });
2936
+ }
2937
+ const groups = settingsTabs.SETTINGS_TAB_IDS.filter((tab) => byTab.has(tab)).map((tab) => ({
2938
+ tab,
2939
+ label: message(settingsTabs.SETTINGS_TAB_LABELS[tab][0], settingsTabs.SETTINGS_TAB_LABELS[tab][1]),
2940
+ fields: byTab.get(tab)
2941
+ }));
2942
+ if (unknown.length) groups.push({ tab: null, label: null, fields: unknown });
2943
+ return groups;
2944
+ }
2748
2945
  const ACTIVITY_ACTION_LABELS = Object.freeze({
2749
2946
  all: message("adminPanel.activity.action.all", "All actions"),
2750
2947
  view: message("adminPanel.activity.action.view", "Opened"),
@@ -2837,38 +3034,205 @@ function buildActivityCsv(rows) {
2837
3034
  ])
2838
3035
  );
2839
3036
  }
2840
- const useT$2 = () => {
3037
+ const settingsGroupText = (t, group) => {
3038
+ const fields = group.fields.map(
3039
+ (field) => field.label ? t(field.label.messageId, field.label.defaultMessage) : field.key
3040
+ ).join(", ");
3041
+ return group.label ? t("adminPanel.activity.settingsGroup", "{tab}: {fields}", {
3042
+ tab: t(group.label.messageId, group.label.defaultMessage),
3043
+ fields
3044
+ }) : fields;
3045
+ };
3046
+ const changedSettingsText = (t, keys, { limit } = {}) => {
3047
+ const groups = groupChangedSettings(keys);
3048
+ const total = groups.reduce((sum, group) => sum + group.fields.length, 0);
3049
+ if (!total) return "";
3050
+ let budget = limit && limit > 0 ? limit : total;
3051
+ const shown = [];
3052
+ for (const group of groups) {
3053
+ if (budget <= 0) break;
3054
+ shown.push({ ...group, fields: group.fields.slice(0, budget) });
3055
+ budget -= Math.min(budget, group.fields.length);
3056
+ }
3057
+ const named = shown.reduce((sum, group) => sum + group.fields.length, 0);
3058
+ const text = shown.map((group) => settingsGroupText(t, group)).join(" · ");
3059
+ return named < total ? t("adminPanel.activity.settingsMore", "{names} and {count, number} more", {
3060
+ names: text,
3061
+ count: total - named
3062
+ }) : text;
3063
+ };
3064
+ const changedSettingsLines = (t, keys) => groupChangedSettings(keys).map((group) => settingsGroupText(t, group));
3065
+ const noAdminText = (t, row) => row?.event === "security-log.retention.purged" ? t("adminPanel.activity.system", "System") : t("adminPanel.activity.unknownAccount", "Unknown account");
3066
+ const deviceText = (t, row) => {
3067
+ if (row.browser && row.os) {
3068
+ return t("adminPanel.activity.browserOnOs", "{browser} on {os}", {
3069
+ browser: row.browser,
3070
+ os: row.os
3071
+ });
3072
+ }
3073
+ return row.browser || row.os || "";
3074
+ };
3075
+ const ipText = (t, row) => {
3076
+ if (!row.ipAddress) return "";
3077
+ return row.ipAnonymized ? t("adminPanel.activity.ipAnonymized", "{ip} (anonymised)", { ip: row.ipAddress }) : row.ipAddress;
3078
+ };
3079
+ const eventDetailText = (t, row, presentation, withActor) => {
3080
+ const parts = [];
3081
+ if (presentation.detail) {
3082
+ parts.push(t(presentation.detail.messageId, presentation.detail.defaultMessage));
3083
+ }
3084
+ if (Number.isInteger(row.attempts) && row.attempts > 1) {
3085
+ parts.push(
3086
+ t(
3087
+ "adminPanel.activity.attempts",
3088
+ "{count, plural, one {# attempt} other {# attempts}} within 5 minutes",
3089
+ { count: row.attempts }
3090
+ )
3091
+ );
3092
+ }
3093
+ const changed = changedSettingsText(t, row.change?.keys, { limit: 3 });
3094
+ if (changed) parts.push(changed);
3095
+ if (Number.isInteger(row.purge?.count)) {
3096
+ parts.push(
3097
+ Number.isInteger(row.purge?.retentionDays) ? t(
3098
+ "adminPanel.activity.purgedDetail",
3099
+ "{count, plural, one {# event} other {# events}}, older than {days, plural, one {# day} other {# days}}",
3100
+ { count: row.purge.count, days: row.purge.retentionDays }
3101
+ ) : t("adminPanel.activity.purgedCount", "{count, plural, one {# event} other {# events}}", {
3102
+ count: row.purge.count
3103
+ })
3104
+ );
3105
+ }
3106
+ if (withActor && row.actor?.name) {
3107
+ parts.push(t("adminPanel.activity.byAdmin", "by {name}", { name: row.actor.name }));
3108
+ }
3109
+ return parts.join(" · ");
3110
+ };
3111
+ const contentTypeText = (row) => [row.contentType?.name, row.entry?.locale].filter(Boolean).join(" · ");
3112
+ const useT$3 = () => {
2841
3113
  const { formatMessage } = reactIntl.useIntl();
2842
3114
  return (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
2843
3115
  };
2844
- const TargetTextButton = styled__default.default(designSystem.TextButton)`
3116
+ const SHORT_DATE = Object.freeze({ dateStyle: "medium", timeStyle: "short" });
3117
+ const FULL_DATE = Object.freeze({ dateStyle: "full", timeStyle: "medium" });
3118
+ const EVENT_ICONS = Object.freeze({
3119
+ signIn: icons.CheckCircle,
3120
+ failed: icons.CrossCircle,
3121
+ lockout: icons.Lock,
3122
+ signOut: icons.SignOut,
3123
+ revoked: icons.Shield,
3124
+ settings: icons.Cog,
3125
+ logRead: icons.Key,
3126
+ purged: icons.Trash,
3127
+ refused: icons.CrossCircle,
3128
+ unlock: icons.Lock,
3129
+ limit: icons.Stack,
3130
+ password: icons.Key,
3131
+ device: icons.Monitor,
3132
+ travel: icons.Earth,
3133
+ notMe: icons.WarningCircle,
3134
+ export: icons.Download,
3135
+ impersonation: icons.User,
3136
+ webhook: icons.Webhooks,
3137
+ other: icons.Information
3138
+ });
3139
+ const ICON_FILL = Object.freeze({
3140
+ success: "success600",
3141
+ danger: "danger600",
3142
+ warning: "warning700",
3143
+ secondary: "secondary600",
3144
+ neutral: "neutral600"
3145
+ });
3146
+ const stopCellKeys = (event) => {
3147
+ if (event.key === "Enter" || event.key === " " || event.key === "Spacebar") {
3148
+ event.stopPropagation();
3149
+ }
3150
+ };
3151
+ const ClickableRow = styled__default.default(designSystem.Tr)`
3152
+ cursor: pointer;
3153
+ `;
3154
+ const WrapCell = styled__default.default(designSystem.Td)`
3155
+ white-space: normal;
3156
+ `;
3157
+ const NoWrap = styled__default.default.span`
3158
+ white-space: nowrap;
3159
+ `;
3160
+ const NameButton = styled__default.default(designSystem.TextButton)`
2845
3161
  min-height: 3.2rem;
3162
+ text-align: start;
2846
3163
  `;
2847
- const EventItem = ({ children, id, kind }) => /* @__PURE__ */ jsxRuntime.jsx(
2848
- designSystem.Box,
2849
- {
2850
- tag: "li",
2851
- background: "neutral0",
2852
- borderColor: "neutral150",
2853
- hasRadius: true,
2854
- padding: 3,
2855
- "data-event-row": kind,
2856
- "data-event-id": id,
2857
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, minWidth: 0, children })
3164
+ const StackedList = styled__default.default.ul`
3165
+ margin: 0;
3166
+ padding: 0;
3167
+ list-style: none;
3168
+ border: 1px solid ${({ theme }) => theme.colors.neutral150};
3169
+ border-radius: ${({ theme }) => theme.borderRadius};
3170
+ background: ${({ theme }) => theme.colors.neutral0};
3171
+ min-width: 0;
3172
+
3173
+ & > li + li {
3174
+ border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
2858
3175
  }
2859
- );
2860
- const AdminName = ({ admin, onOpenAdmin }) => {
2861
- const t = useT$2();
3176
+ `;
3177
+ const StackedItem = styled__default.default.li`
3178
+ cursor: pointer;
3179
+ min-width: 0;
3180
+ `;
3181
+ const BreakAnywhere = styled__default.default(designSystem.Typography)`
3182
+ overflow-wrap: anywhere;
3183
+ `;
3184
+ const getEventBadgeColors = (tone) => tone === "danger" ? { backgroundColor: "danger100", textColor: "danger700" } : index.getBadgeColors(tone);
3185
+ const EventBadge = ({ presentation, nowrap = false }) => {
3186
+ const t = useT$3();
3187
+ const Icon = EVENT_ICONS[presentation.icon] || icons.Information;
3188
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", shrink: 0, "data-event-kind": presentation.key, children: [
3189
+ /* @__PURE__ */ jsxRuntime.jsx(
3190
+ Icon,
3191
+ {
3192
+ "aria-hidden": "true",
3193
+ focusable: "false",
3194
+ width: "1.6rem",
3195
+ height: "1.6rem",
3196
+ fill: ICON_FILL[presentation.tone] || ICON_FILL.neutral
3197
+ }
3198
+ ),
3199
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...getEventBadgeColors(presentation.tone), "data-event-tone": presentation.tone, children: nowrap ? /* @__PURE__ */ jsxRuntime.jsx(NoWrap, { children: t(presentation.label.messageId, presentation.label.defaultMessage) }) : t(presentation.label.messageId, presentation.label.defaultMessage) })
3200
+ ] });
3201
+ };
3202
+ const EventTime = ({ value, compact = false }) => {
3203
+ const { formatDate, formatRelativeTime } = index.useSessionFormatters();
3204
+ const date = index.toValidDate(value);
3205
+ if (!date) return /* @__PURE__ */ jsxRuntime.jsx(index.MissingValue, { variant: "omega" });
3206
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, children: [
3207
+ /* @__PURE__ */ jsxRuntime.jsx(
3208
+ designSystem.Typography,
3209
+ {
3210
+ tag: "time",
3211
+ dateTime: date.toISOString(),
3212
+ variant: compact ? "pi" : "omega",
3213
+ textColor: "neutral800",
3214
+ children: /* @__PURE__ */ jsxRuntime.jsx(NoWrap, { children: formatRelativeTime(date) })
3215
+ }
3216
+ ),
3217
+ compact ? null : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: /* @__PURE__ */ jsxRuntime.jsx(NoWrap, { children: formatDate(date, SHORT_DATE) }) })
3218
+ ] });
3219
+ };
3220
+ const AdminName = ({ admin, row, onOpenAdmin }) => {
3221
+ const t = useT$3();
2862
3222
  if (!admin) {
2863
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", textColor: "neutral800", children: t("adminPanel.activity.unknownAccount", "Unknown account") });
3223
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: onOpenAdmin ? "pi" : "omega", textColor: "neutral600", children: noAdminText(t, row) });
2864
3224
  }
2865
3225
  if (!onOpenAdmin) {
2866
3226
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", textColor: "neutral800", children: admin.name });
2867
3227
  }
2868
3228
  return /* @__PURE__ */ jsxRuntime.jsx(
2869
- TargetTextButton,
3229
+ NameButton,
2870
3230
  {
2871
- onClick: (event) => onOpenAdmin(admin, event.currentTarget),
3231
+ onClick: (event) => {
3232
+ event.stopPropagation();
3233
+ onOpenAdmin(admin, event.currentTarget);
3234
+ },
3235
+ onKeyDown: stopCellKeys,
2872
3236
  "aria-label": t("adminPanel.activity.openAdmin", "Open the details of {name}", {
2873
3237
  name: admin.name
2874
3238
  }),
@@ -2876,84 +3240,529 @@ const AdminName = ({ admin, onOpenAdmin }) => {
2876
3240
  }
2877
3241
  );
2878
3242
  };
2879
- const SignInEventRow = ({ row, showAdmin = false, onOpenAdmin }) => {
2880
- const t = useT$2();
2881
- const event = getSignInEventPresentation(row);
2882
- const session = getSessionStatePresentation(row.session);
2883
- const facts = [];
2884
- if (row.ipAddress) {
2885
- facts.push(
2886
- row.ipAnonymized ? t("adminPanel.activity.ipAnonymized", "{ip} (anonymised)", { ip: row.ipAddress }) : row.ipAddress
3243
+ const SignInDetails = ({ row }) => {
3244
+ const t = useT$3();
3245
+ const ip = ipText(t, row);
3246
+ const second = [getEventPlace(row), deviceText(t, row)].filter(Boolean).join(" · ");
3247
+ if (!ip && !second) return /* @__PURE__ */ jsxRuntime.jsx(index.MissingValue, { variant: "omega" });
3248
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, children: [
3249
+ ip ? /* @__PURE__ */ jsxRuntime.jsx(BreakAnywhere, { variant: "omega", textColor: "neutral800", children: ip }) : null,
3250
+ second ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: second }) : null
3251
+ ] });
3252
+ };
3253
+ const SessionState = ({ row }) => {
3254
+ const t = useT$3();
3255
+ const { formatRelativeTime } = index.useSessionFormatters();
3256
+ const state = getSessionStatePresentation(row.session);
3257
+ if (!state) return /* @__PURE__ */ jsxRuntime.jsx(index.MissingValue, { variant: "omega" });
3258
+ const endedAt = index.toValidDate(row.session?.endedAt);
3259
+ const second = [
3260
+ endedAt ? formatRelativeTime(endedAt) : "",
3261
+ row.session?.endedBy?.name ? t("adminPanel.activity.byAdmin", "by {name}", { name: row.session.endedBy.name }) : ""
3262
+ ].filter(Boolean).join(" · ");
3263
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, children: [
3264
+ /* @__PURE__ */ jsxRuntime.jsx(
3265
+ designSystem.Typography,
3266
+ {
3267
+ variant: "omega",
3268
+ fontWeight: state.tone === "success" ? "semiBold" : void 0,
3269
+ textColor: state.tone === "success" ? "success600" : "neutral800",
3270
+ "data-session-state": row.session?.state,
3271
+ children: t(state.label.messageId, state.label.defaultMessage)
3272
+ }
3273
+ ),
3274
+ second ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: second }) : null
3275
+ ] });
3276
+ };
3277
+ const HeaderCell = ({ children, hidden = false }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: hidden ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", textColor: "neutral600", children }) });
3278
+ const DetailsButton = ({ label, onOpen }) => /* @__PURE__ */ jsxRuntime.jsx(
3279
+ designSystem.IconButton,
3280
+ {
3281
+ variant: "ghost",
3282
+ label,
3283
+ withTooltip: false,
3284
+ onClick: (event) => {
3285
+ event.stopPropagation();
3286
+ onOpen(event.currentTarget);
3287
+ },
3288
+ onKeyDown: stopCellKeys,
3289
+ "data-event-details": "",
3290
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.Eye, {})
3291
+ }
3292
+ );
3293
+ const ActivityEntry = ({ row }) => {
3294
+ const t = useT$3();
3295
+ const path = getEntryPath(row);
3296
+ const name = row.entry?.count !== null && row.entry?.count !== void 0 ? t("adminPanel.activity.entries", "{count, plural, one {# entry} other {# entries}}", {
3297
+ count: row.entry.count
3298
+ }) : row.entry?.title || row.entry?.documentId || row.contentType?.name || "";
3299
+ if (!name) return /* @__PURE__ */ jsxRuntime.jsx(index.MissingValue, { variant: "omega" });
3300
+ if (!path) {
3301
+ return /* @__PURE__ */ jsxRuntime.jsx(BreakAnywhere, { variant: "omega", textColor: "neutral800", children: name });
3302
+ }
3303
+ return /* @__PURE__ */ jsxRuntime.jsx(
3304
+ index.TargetLink,
3305
+ {
3306
+ tag: reactRouterDom.Link,
3307
+ to: path,
3308
+ onClick: (event) => event.stopPropagation(),
3309
+ onKeyDown: stopCellKeys,
3310
+ "aria-label": t("adminPanel.activity.openEntry", "Open {entry} in the Content Manager", {
3311
+ entry: name
3312
+ }),
3313
+ children: name
3314
+ }
3315
+ );
3316
+ };
3317
+ const EventDetailsModal = ({ title, items, footerAction, onClose, onCloseAutoFocus }) => {
3318
+ const t = useT$3();
3319
+ return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Root, { open: true, onOpenChange: (open) => open ? null : onClose(), children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Content, { onCloseAutoFocus, "aria-describedby": void 0, children: [
3320
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { closeLabel: t("common.close", "Close"), children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Title, { children: title }) }),
3321
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { background: "neutral100", hasRadius: true, padding: { initial: 4, medium: 6 }, children: /* @__PURE__ */ jsxRuntime.jsx(index.PropertyList, { columns: 2, items }) }) }),
3322
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Footer, { children: [
3323
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Close, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", children: t("common.close", "Close") }) }),
3324
+ footerAction || null
3325
+ ] })
3326
+ ] }) });
3327
+ };
3328
+ const useEventDetails = () => {
3329
+ const [selected, setSelected] = react.useState(null);
3330
+ const [opener, setOpener] = react.useState(null);
3331
+ const [container, setContainer] = react.useState(null);
3332
+ return {
3333
+ selected,
3334
+ setContainer,
3335
+ open: (row, trigger) => {
3336
+ const button = trigger?.matches?.("[data-event-details]") ? trigger : trigger?.querySelector?.("[data-event-details]");
3337
+ setOpener(button || null);
3338
+ setSelected(row);
3339
+ },
3340
+ close: () => setSelected(null),
3341
+ onCloseAutoFocus: (event) => index.restoreDialogFocus(event, opener, container)
3342
+ };
3343
+ };
3344
+ const signInDetails = (t, formatDate, row) => {
3345
+ const presentation = getSignInEventPresentation(row);
3346
+ const label = t(presentation.label.messageId, presentation.label.defaultMessage);
3347
+ const state = getSessionStatePresentation(row.session);
3348
+ const revoked = presentation.key === "revoked";
3349
+ const adminName = row.admin?.name || noAdminText(t, row);
3350
+ const items = [
3351
+ {
3352
+ id: "event",
3353
+ label: t("adminPanel.activity.column.event", "Event"),
3354
+ render: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, children: [
3355
+ /* @__PURE__ */ jsxRuntime.jsx(EventBadge, { presentation }),
3356
+ presentation.detail ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t(presentation.detail.messageId, presentation.detail.defaultMessage) }) : null
3357
+ ] })
3358
+ },
3359
+ {
3360
+ id: "time",
3361
+ label: t("adminPanel.activity.details.exactTime", "Exact time"),
3362
+ value: row.at ? formatDate(row.at, FULL_DATE) : null
3363
+ },
3364
+ { id: "admin", label: t("adminPanel.activity.column.admin", "Admin"), value: adminName }
3365
+ ];
3366
+ if (revoked) {
3367
+ items.push(
3368
+ {
3369
+ id: "actor",
3370
+ label: t("adminPanel.activity.column.doneBy", "Done by"),
3371
+ value: row.actor?.name || null
3372
+ },
3373
+ {
3374
+ id: "scope",
3375
+ label: t("adminPanel.activity.details.signedOutOf", "Signed out of"),
3376
+ value: Number.isInteger(row.sessionsEnded) && row.sessionsEnded >= 0 ? t(
3377
+ "adminPanel.activity.details.scopeCount",
3378
+ "{scope} ({count, plural, =0 {no open session} one {# session ended} other {# sessions ended}})",
3379
+ {
3380
+ scope: t(presentation.detail.messageId, presentation.detail.defaultMessage),
3381
+ count: row.sessionsEnded
3382
+ }
3383
+ ) : t(presentation.detail.messageId, presentation.detail.defaultMessage)
3384
+ }
2887
3385
  );
2888
3386
  }
2889
- const place = [row.location?.city, row.location?.country].filter(Boolean).join(", ");
2890
- if (place) facts.push(place);
2891
- if (row.browser && row.os) {
2892
- facts.push(
2893
- t("adminPanel.activity.browserOnOs", "{browser} on {os}", {
2894
- browser: row.browser,
2895
- os: row.os
2896
- })
3387
+ if (state) {
3388
+ const endedAt = index.toValidDate(row.session?.endedAt);
3389
+ items.push({
3390
+ id: "session",
3391
+ label: t("adminPanel.activity.column.session", "Session"),
3392
+ value: [
3393
+ t(state.label.messageId, state.label.defaultMessage),
3394
+ endedAt ? formatDate(endedAt, SHORT_DATE) : "",
3395
+ row.session?.endedBy?.name ? t("adminPanel.activity.byAdmin", "by {name}", { name: row.session.endedBy.name }) : ""
3396
+ ].filter(Boolean).join(" · ")
3397
+ });
3398
+ }
3399
+ if (row.change) {
3400
+ const lines = changedSettingsLines(t, row.change.keys);
3401
+ items.push({
3402
+ id: "settings",
3403
+ label: t("adminPanel.activity.details.changedSettings", "Changed settings"),
3404
+ ...lines.length ? {
3405
+ render: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, "data-changed-settings": "", children: lines.map((line) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", children: line }, line)) })
3406
+ } : { value: null },
3407
+ fullWidth: true
3408
+ });
3409
+ }
3410
+ if (row.purge) {
3411
+ items.push(
3412
+ {
3413
+ id: "purged",
3414
+ label: t("adminPanel.activity.details.deleted", "Deleted events"),
3415
+ value: Number.isInteger(row.purge.count) ? row.purge.count : null
3416
+ },
3417
+ {
3418
+ id: "retention",
3419
+ label: t("adminPanel.activity.details.retention", "Kept for"),
3420
+ value: Number.isInteger(row.purge.retentionDays) ? t("adminPanel.duration.days", "{count, plural, one {# day} other {# days}}", {
3421
+ count: row.purge.retentionDays
3422
+ }) : null
3423
+ }
2897
3424
  );
2898
- } else if (row.browser || row.os) {
2899
- facts.push(row.browser || row.os);
2900
3425
  }
2901
- if (row.actor)
2902
- facts.push(t("adminPanel.activity.byAdmin", "by {name}", { name: row.actor.name }));
2903
3426
  if (Number.isInteger(row.attempts) && row.attempts > 1) {
2904
- facts.push(
2905
- t(
2906
- "adminPanel.activity.attempts",
2907
- "{count, plural, one {# attempt} other {# attempts}} within 5 minutes",
2908
- { count: row.attempts }
2909
- )
2910
- );
3427
+ items.push({
3428
+ id: "attempts",
3429
+ label: t("adminPanel.activity.details.attempts", "Attempts"),
3430
+ value: row.attempts
3431
+ });
2911
3432
  }
2912
- return /* @__PURE__ */ jsxRuntime.jsxs(EventItem, { id: row.id, kind: event.key, children: [
2913
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", alignItems: "center", justifyContent: "space-between", children: [
2914
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", alignItems: "center", minWidth: 0, children: [
2915
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...index.getBadgeColors(event.tone), children: t(event.label.messageId, event.label.defaultMessage) }),
2916
- showAdmin ? /* @__PURE__ */ jsxRuntime.jsx(AdminName, { admin: row.admin, onOpenAdmin }) : null,
2917
- event.detail ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t(event.detail.messageId, event.detail.defaultMessage) }) : null
2918
- ] }),
2919
- /* @__PURE__ */ jsxRuntime.jsx(LastActive, { value: row.at })
2920
- ] }),
2921
- facts.length ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", style: { overflowWrap: "anywhere" }, children: facts.join(" · ") }) : null,
2922
- session ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", alignItems: "center", children: [
2923
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...index.getBadgeColors(session.tone), children: t(session.label.messageId, session.label.defaultMessage) }),
2924
- row.session?.endedAt ? /* @__PURE__ */ jsxRuntime.jsx(LastActive, { value: row.session.endedAt }) : null
2925
- ] }) : null
2926
- ] });
3433
+ items.push(
3434
+ {
3435
+ id: "ip",
3436
+ label: t("adminPanel.activity.details.ip", "IP address"),
3437
+ value: ipText(t, row) || null,
3438
+ kind: "id"
3439
+ },
3440
+ {
3441
+ id: "place",
3442
+ label: t("adminPanel.activity.details.location", "Location"),
3443
+ value: getEventPlace(row) || null
3444
+ },
3445
+ {
3446
+ id: "browser",
3447
+ label: t("adminPanel.activity.details.browser", "Browser"),
3448
+ value: row.browser || null
3449
+ },
3450
+ {
3451
+ id: "os",
3452
+ label: t("adminPanel.activity.details.os", "Operating system"),
3453
+ value: row.os || null
3454
+ },
3455
+ {
3456
+ id: "userAgent",
3457
+ label: t("adminPanel.activity.details.userAgent", "User agent"),
3458
+ value: row.userAgent || null,
3459
+ kind: "id",
3460
+ fullWidth: true
3461
+ },
3462
+ {
3463
+ id: "eventId",
3464
+ label: t("adminPanel.activity.details.eventId", "Event ID"),
3465
+ value: row.id,
3466
+ kind: "id"
3467
+ }
3468
+ );
3469
+ const title = row.admin?.name ? t("adminPanel.activity.details.title", "{event}: {name}", { event: label, name: adminName }) : label;
3470
+ const logEvent = ["settings", "log-read", "purged"].includes(presentation.key);
3471
+ const deviceFields = /* @__PURE__ */ new Set(["ip", "place", "browser", "os", "userAgent"]);
3472
+ return {
3473
+ title,
3474
+ items: logEvent ? items.filter(
3475
+ (item) => !deviceFields.has(item.id) || item.value !== null && item.value !== ""
3476
+ ) : items
3477
+ };
2927
3478
  };
2928
- const ActivityEventRow = ({ row, showAdmin = false, onOpenAdmin }) => {
2929
- const t = useT$2();
3479
+ const activityDetails = (t, formatDate, row) => {
2930
3480
  const label = ACTIVITY_ACTION_LABELS[row.action] || ACTIVITY_ACTION_LABELS.view;
2931
- const path = getEntryPath(row);
2932
- const entryName = row.entry?.count !== null && row.entry?.count !== void 0 ? t("adminPanel.activity.entries", "{count, plural, one {# entry} other {# entries}}", {
2933
- count: row.entry.count
2934
- }) : row.entry?.title || row.entry?.documentId || row.contentType?.name || "";
2935
- const facts = [row.contentType?.name];
2936
- if (row.entry?.locale) facts.push(row.entry.locale);
2937
- return /* @__PURE__ */ jsxRuntime.jsxs(EventItem, { id: row.id, kind: row.action, children: [
2938
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", alignItems: "center", justifyContent: "space-between", children: [
2939
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", alignItems: "center", minWidth: 0, children: [
2940
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...index.getBadgeColors(getActivityTone(row.action)), children: t(label.messageId, label.defaultMessage) }),
2941
- showAdmin ? /* @__PURE__ */ jsxRuntime.jsx(AdminName, { admin: row.admin, onOpenAdmin }) : null
2942
- ] }),
2943
- /* @__PURE__ */ jsxRuntime.jsx(LastActive, { value: row.at })
2944
- ] }),
2945
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { minWidth: 0, style: { overflowWrap: "anywhere" }, children: path ? /* @__PURE__ */ jsxRuntime.jsx(
2946
- index.TargetLink,
3481
+ const action = t(label.messageId, label.defaultMessage);
3482
+ return {
3483
+ title: row.entry?.title ? t("adminPanel.activity.details.title", "{event}: {name}", {
3484
+ event: action,
3485
+ name: row.entry.title
3486
+ }) : action,
3487
+ items: [
2947
3488
  {
2948
- tag: reactRouterDom.Link,
2949
- to: path,
2950
- "aria-label": t("adminPanel.activity.openEntry", "Open {entry} in the Content Manager", {
2951
- entry: entryName
2952
- }),
2953
- children: entryName
3489
+ id: "action",
3490
+ label: t("adminPanel.activity.column.action", "Action"),
3491
+ render: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { ...index.getBadgeColors(getActivityTone(row.action)), children: action })
3492
+ },
3493
+ {
3494
+ id: "time",
3495
+ label: t("adminPanel.activity.details.exactTime", "Exact time"),
3496
+ value: row.at ? formatDate(row.at, FULL_DATE) : null
3497
+ },
3498
+ {
3499
+ id: "entry",
3500
+ label: t("adminPanel.activity.column.entry", "Entry"),
3501
+ render: /* @__PURE__ */ jsxRuntime.jsx(ActivityEntry, { row })
3502
+ },
3503
+ {
3504
+ id: "admin",
3505
+ label: t("adminPanel.activity.column.admin", "Admin"),
3506
+ value: row.admin?.name || null
3507
+ },
3508
+ {
3509
+ id: "type",
3510
+ label: t("adminPanel.activity.column.contentType", "Content type"),
3511
+ value: row.contentType?.name || null
3512
+ },
3513
+ {
3514
+ id: "uid",
3515
+ label: t("adminPanel.activity.details.uid", "Content type UID"),
3516
+ value: row.contentType?.uid || null,
3517
+ kind: "id"
3518
+ },
3519
+ {
3520
+ id: "documentId",
3521
+ label: t("adminPanel.activity.details.documentId", "Document ID"),
3522
+ value: row.entry?.documentId || null,
3523
+ kind: "id"
3524
+ },
3525
+ {
3526
+ id: "locale",
3527
+ label: t("adminPanel.activity.details.locale", "Locale"),
3528
+ value: row.entry?.locale || null
3529
+ },
3530
+ {
3531
+ id: "eventId",
3532
+ label: t("adminPanel.activity.details.eventId", "Event ID"),
3533
+ value: row.id,
3534
+ kind: "id"
2954
3535
  }
2955
- ) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", children: entryName }) }),
2956
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: facts.filter(Boolean).join(" · ") })
3536
+ ]
3537
+ };
3538
+ };
3539
+ const SignInEventTable = ({
3540
+ rows,
3541
+ label,
3542
+ showAdmin = false,
3543
+ onOpenAdmin,
3544
+ detailsAction,
3545
+ busy = false
3546
+ }) => {
3547
+ const t = useT$3();
3548
+ const { formatDate, formatRelativeTime } = index.useSessionFormatters();
3549
+ const [measureRef, width] = settingsTabs.useElementWidth();
3550
+ const {
3551
+ selected,
3552
+ open: openDetails,
3553
+ close: closeDetails,
3554
+ onCloseAutoFocus,
3555
+ setContainer
3556
+ } = useEventDetails();
3557
+ const layout = getEventListLayout(width, { showAdmin });
3558
+ const showDoneBy = layout === "full";
3559
+ const detailsLabel = (row, presentation) => t("adminPanel.activity.details.open", "Details of {event}, {time}", {
3560
+ event: t(presentation.label.messageId, presentation.label.defaultMessage),
3561
+ time: formatRelativeTime(row.at)
3562
+ });
3563
+ let list;
3564
+ if (layout === "stacked") {
3565
+ list = /* @__PURE__ */ jsxRuntime.jsx(StackedList, { "aria-label": label, "data-event-list": "stacked", children: rows.map((row) => {
3566
+ const presentation = getSignInEventPresentation(row);
3567
+ const state = getSessionStatePresentation(row.session);
3568
+ const second = [
3569
+ eventDetailText(t, row, presentation, true),
3570
+ ipText(t, row),
3571
+ getEventPlace(row),
3572
+ deviceText(t, row),
3573
+ state ? t(state.label.messageId, state.label.defaultMessage) : ""
3574
+ ].filter(Boolean).join(" · ");
3575
+ return /* @__PURE__ */ jsxRuntime.jsx(
3576
+ StackedItem,
3577
+ {
3578
+ "data-event-row": presentation.key,
3579
+ "data-event-id": row.id,
3580
+ onClick: (event) => openDetails(row, event.currentTarget),
3581
+ children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, padding: 3, minWidth: 0, children: [
3582
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", alignItems: "center", minWidth: 0, children: [
3583
+ /* @__PURE__ */ jsxRuntime.jsx(EventBadge, { presentation }),
3584
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 1, alignItems: "center", marginLeft: "auto", children: [
3585
+ /* @__PURE__ */ jsxRuntime.jsx(EventTime, { value: row.at, compact: true }),
3586
+ /* @__PURE__ */ jsxRuntime.jsx(
3587
+ DetailsButton,
3588
+ {
3589
+ label: detailsLabel(row, presentation),
3590
+ onOpen: (trigger) => openDetails(row, trigger)
3591
+ }
3592
+ )
3593
+ ] })
3594
+ ] }),
3595
+ showAdmin ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { minWidth: 0, children: /* @__PURE__ */ jsxRuntime.jsx(AdminName, { admin: row.admin, row, onOpenAdmin }) }) : null,
3596
+ second ? /* @__PURE__ */ jsxRuntime.jsx(BreakAnywhere, { variant: "pi", textColor: "neutral600", children: second }) : null
3597
+ ] })
3598
+ },
3599
+ row.id
3600
+ );
3601
+ }) });
3602
+ } else {
3603
+ const colCount = 5 + (showAdmin ? 1 : 0) + (showDoneBy ? 1 : 0);
3604
+ list = /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { background: "neutral0", hasRadius: true, shadow: "tableShadow", "data-event-list": layout, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { colCount, rowCount: rows.length + 1, "aria-label": label, "aria-busy": busy, children: [
3605
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
3606
+ /* @__PURE__ */ jsxRuntime.jsx(HeaderCell, { children: t("adminPanel.activity.column.time", "Time") }),
3607
+ /* @__PURE__ */ jsxRuntime.jsx(HeaderCell, { children: t("adminPanel.activity.column.event", "Event") }),
3608
+ showAdmin ? /* @__PURE__ */ jsxRuntime.jsx(HeaderCell, { children: t("adminPanel.activity.column.admin", "Admin") }) : null,
3609
+ /* @__PURE__ */ jsxRuntime.jsx(HeaderCell, { children: t("adminPanel.activity.column.details", "IP address and device") }),
3610
+ /* @__PURE__ */ jsxRuntime.jsx(HeaderCell, { children: t("adminPanel.activity.column.session", "Session") }),
3611
+ showDoneBy ? /* @__PURE__ */ jsxRuntime.jsx(HeaderCell, { children: t("adminPanel.activity.column.doneBy", "Done by") }) : null,
3612
+ /* @__PURE__ */ jsxRuntime.jsx(HeaderCell, { hidden: true, children: t("adminPanel.table.actions", "Actions") })
3613
+ ] }) }),
3614
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: rows.map((row) => {
3615
+ const presentation = getSignInEventPresentation(row);
3616
+ const eventDetail = eventDetailText(t, row, presentation, !showDoneBy);
3617
+ return /* @__PURE__ */ jsxRuntime.jsxs(
3618
+ ClickableRow,
3619
+ {
3620
+ "data-event-row": presentation.key,
3621
+ "data-event-id": row.id,
3622
+ onClick: (event) => openDetails(row, event.currentTarget),
3623
+ children: [
3624
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(EventTime, { value: row.at }) }),
3625
+ /* @__PURE__ */ jsxRuntime.jsx(WrapCell, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, children: [
3626
+ /* @__PURE__ */ jsxRuntime.jsx(EventBadge, { presentation, nowrap: true }),
3627
+ eventDetail ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: eventDetail }) : null
3628
+ ] }) }),
3629
+ showAdmin ? /* @__PURE__ */ jsxRuntime.jsx(WrapCell, { children: /* @__PURE__ */ jsxRuntime.jsx(AdminName, { admin: row.admin, row, onOpenAdmin }) }) : null,
3630
+ /* @__PURE__ */ jsxRuntime.jsx(WrapCell, { children: /* @__PURE__ */ jsxRuntime.jsx(SignInDetails, { row }) }),
3631
+ /* @__PURE__ */ jsxRuntime.jsx(WrapCell, { children: /* @__PURE__ */ jsxRuntime.jsx(SessionState, { row }) }),
3632
+ showDoneBy ? /* @__PURE__ */ jsxRuntime.jsx(WrapCell, { children: row.actor?.name ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", children: row.actor.name }) : /* @__PURE__ */ jsxRuntime.jsx(index.MissingValue, { variant: "omega" }) }) : null,
3633
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", gap: 1, onKeyDown: stopCellKeys, children: /* @__PURE__ */ jsxRuntime.jsx(
3634
+ DetailsButton,
3635
+ {
3636
+ label: detailsLabel(row, presentation),
3637
+ onOpen: (trigger) => openDetails(row, trigger)
3638
+ }
3639
+ ) }) })
3640
+ ]
3641
+ },
3642
+ row.id
3643
+ );
3644
+ }) })
3645
+ ] }) });
3646
+ }
3647
+ const content = selected ? signInDetails(t, formatDate, selected) : null;
3648
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { ref: measureRef, minWidth: 0, width: "100%", children: [
3649
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { ref: setContainer, tabIndex: -1, minWidth: 0, children: list }),
3650
+ content ? /* @__PURE__ */ jsxRuntime.jsx(
3651
+ EventDetailsModal,
3652
+ {
3653
+ title: content.title,
3654
+ items: content.items,
3655
+ footerAction: detailsAction ? detailsAction(selected, closeDetails) : null,
3656
+ onClose: closeDetails,
3657
+ onCloseAutoFocus
3658
+ }
3659
+ ) : null
3660
+ ] });
3661
+ };
3662
+ const ActivityEventTable = ({ rows, label, showAdmin = false, busy = false }) => {
3663
+ const t = useT$3();
3664
+ const { formatDate, formatRelativeTime } = index.useSessionFormatters();
3665
+ const [measureRef, width] = settingsTabs.useElementWidth();
3666
+ const {
3667
+ selected,
3668
+ open: openDetails,
3669
+ close: closeDetails,
3670
+ onCloseAutoFocus,
3671
+ setContainer
3672
+ } = useEventDetails();
3673
+ const layout = getEventListLayout(width, { showAdmin });
3674
+ const actionOf = (row) => {
3675
+ const entry = ACTIVITY_ACTION_LABELS[row.action] || ACTIVITY_ACTION_LABELS.view;
3676
+ return t(entry.messageId, entry.defaultMessage);
3677
+ };
3678
+ const detailsLabel = (row) => t("adminPanel.activity.details.open", "Details of {event}, {time}", {
3679
+ event: actionOf(row),
3680
+ time: formatRelativeTime(row.at)
3681
+ });
3682
+ const badge = (row) => /* @__PURE__ */ jsxRuntime.jsx(
3683
+ designSystem.Badge,
3684
+ {
3685
+ ...index.getBadgeColors(getActivityTone(row.action)),
3686
+ "data-event-tone": getActivityTone(row.action),
3687
+ children: actionOf(row)
3688
+ }
3689
+ );
3690
+ let list;
3691
+ if (layout === "stacked") {
3692
+ list = /* @__PURE__ */ jsxRuntime.jsx(StackedList, { "aria-label": label, "data-event-list": "stacked", children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(
3693
+ StackedItem,
3694
+ {
3695
+ "data-event-row": row.action,
3696
+ "data-event-id": row.id,
3697
+ onClick: (event) => openDetails(row, event.currentTarget),
3698
+ children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, padding: 3, minWidth: 0, children: [
3699
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", alignItems: "center", minWidth: 0, children: [
3700
+ badge(row),
3701
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 1, alignItems: "center", marginLeft: "auto", children: [
3702
+ /* @__PURE__ */ jsxRuntime.jsx(EventTime, { value: row.at, compact: true }),
3703
+ /* @__PURE__ */ jsxRuntime.jsx(
3704
+ DetailsButton,
3705
+ {
3706
+ label: detailsLabel(row),
3707
+ onOpen: (trigger) => openDetails(row, trigger)
3708
+ }
3709
+ )
3710
+ ] })
3711
+ ] }),
3712
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { minWidth: 0, children: /* @__PURE__ */ jsxRuntime.jsx(ActivityEntry, { row }) }),
3713
+ contentTypeText(row) || showAdmin && row.admin?.name ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: [contentTypeText(row), showAdmin ? row.admin?.name : ""].filter(Boolean).join(" · ") }) : null
3714
+ ] })
3715
+ },
3716
+ row.id
3717
+ )) });
3718
+ } else {
3719
+ const colCount = 5 + (showAdmin ? 1 : 0);
3720
+ list = /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { background: "neutral0", hasRadius: true, shadow: "tableShadow", "data-event-list": layout, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { colCount, rowCount: rows.length + 1, "aria-label": label, "aria-busy": busy, children: [
3721
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
3722
+ /* @__PURE__ */ jsxRuntime.jsx(HeaderCell, { children: t("adminPanel.activity.column.time", "Time") }),
3723
+ /* @__PURE__ */ jsxRuntime.jsx(HeaderCell, { children: t("adminPanel.activity.column.action", "Action") }),
3724
+ /* @__PURE__ */ jsxRuntime.jsx(HeaderCell, { children: t("adminPanel.activity.column.entry", "Entry") }),
3725
+ /* @__PURE__ */ jsxRuntime.jsx(HeaderCell, { children: t("adminPanel.activity.column.contentType", "Content type") }),
3726
+ showAdmin ? /* @__PURE__ */ jsxRuntime.jsx(HeaderCell, { children: t("adminPanel.activity.column.admin", "Admin") }) : null,
3727
+ /* @__PURE__ */ jsxRuntime.jsx(HeaderCell, { hidden: true, children: t("adminPanel.table.actions", "Actions") })
3728
+ ] }) }),
3729
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsxs(
3730
+ ClickableRow,
3731
+ {
3732
+ "data-event-row": row.action,
3733
+ "data-event-id": row.id,
3734
+ onClick: (event) => openDetails(row, event.currentTarget),
3735
+ children: [
3736
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(EventTime, { value: row.at }) }),
3737
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: badge(row) }),
3738
+ /* @__PURE__ */ jsxRuntime.jsx(WrapCell, { children: /* @__PURE__ */ jsxRuntime.jsx(ActivityEntry, { row }) }),
3739
+ /* @__PURE__ */ jsxRuntime.jsx(WrapCell, { children: contentTypeText(row) ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", children: contentTypeText(row) }) : /* @__PURE__ */ jsxRuntime.jsx(index.MissingValue, { variant: "omega" }) }),
3740
+ showAdmin ? /* @__PURE__ */ jsxRuntime.jsx(WrapCell, { children: /* @__PURE__ */ jsxRuntime.jsx(AdminName, { admin: row.admin }) }) : null,
3741
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", gap: 1, onKeyDown: stopCellKeys, children: /* @__PURE__ */ jsxRuntime.jsx(
3742
+ DetailsButton,
3743
+ {
3744
+ label: detailsLabel(row),
3745
+ onOpen: (trigger) => openDetails(row, trigger)
3746
+ }
3747
+ ) }) })
3748
+ ]
3749
+ },
3750
+ row.id
3751
+ )) })
3752
+ ] }) });
3753
+ }
3754
+ const content = selected ? activityDetails(t, formatDate, selected) : null;
3755
+ return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { ref: measureRef, minWidth: 0, width: "100%", children: [
3756
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { ref: setContainer, tabIndex: -1, minWidth: 0, children: list }),
3757
+ content ? /* @__PURE__ */ jsxRuntime.jsx(
3758
+ EventDetailsModal,
3759
+ {
3760
+ title: content.title,
3761
+ items: content.items,
3762
+ onClose: closeDetails,
3763
+ onCloseAutoFocus
3764
+ }
3765
+ ) : null
2957
3766
  ] });
2958
3767
  };
2959
3768
  function useEventList({ path, params, logKey }) {
@@ -2982,18 +3791,19 @@ function useEventList({ path, params, logKey }) {
2982
3791
  const [error, setError] = react.useState(false);
2983
3792
  const requestRef = react.useRef(0);
2984
3793
  const key = JSON.stringify(params);
3794
+ const firstPage = Number(params?.page) > 0 ? Number(params.page) : 1;
2985
3795
  const load = react.useCallback(
2986
3796
  async (nextPage) => {
2987
3797
  const requestId = requestRef.current + 1;
2988
3798
  requestRef.current = requestId;
2989
- if (nextPage === 1) setLoading(true);
3799
+ if (nextPage === firstPage) setLoading(true);
2990
3800
  else setLoadingMore(true);
2991
3801
  try {
2992
3802
  const response = await get(path, { params: { ...JSON.parse(key), page: nextPage } });
2993
3803
  if (requestId !== requestRef.current) return;
2994
3804
  const body = response?.data || {};
2995
3805
  const data = fillNames(Array.isArray(body.data) ? body.data : []);
2996
- setRows((current) => nextPage === 1 ? data : [...current, ...data]);
3806
+ setRows((current) => nextPage === firstPage ? data : [...current, ...data]);
2997
3807
  setMeta(body.meta || null);
2998
3808
  setPage(nextPage);
2999
3809
  setError(false);
@@ -3008,14 +3818,14 @@ function useEventList({ path, params, logKey }) {
3008
3818
  }
3009
3819
  }
3010
3820
  },
3011
- [get, path, key, logKey, fillNames]
3821
+ [get, path, key, logKey, fillNames, firstPage]
3012
3822
  );
3013
3823
  react.useEffect(() => {
3014
- load(1);
3824
+ load(firstPage);
3015
3825
  return () => {
3016
3826
  requestRef.current += 1;
3017
3827
  };
3018
- }, [load]);
3828
+ }, [load, firstPage]);
3019
3829
  const pagination = meta?.pagination;
3020
3830
  const hasMore = Boolean(pagination && page < pagination.pageCount);
3021
3831
  const exportAll = react.useCallback(async () => {
@@ -3043,7 +3853,7 @@ function useEventList({ path, params, logKey }) {
3043
3853
  error,
3044
3854
  hasMore,
3045
3855
  loadMore: () => load(page + 1),
3046
- reload: () => load(1),
3856
+ reload: () => load(firstPage),
3047
3857
  exportAll
3048
3858
  };
3049
3859
  }
@@ -3057,12 +3867,13 @@ function downloadCsv(content, name) {
3057
3867
  window.setTimeout(() => URL.revokeObjectURL(url), 0);
3058
3868
  }
3059
3869
  const ADMIN_ACTIVITY_SETTINGS_PATH = `/settings/${index.pluginId}/general?tab=admin-activity`;
3060
- const useT$1 = () => {
3870
+ const ADMIN_ACTIVITY_PAGE_PATH = `/plugins/${index.pluginId}/admin-panel/activity`;
3871
+ const useT$2 = () => {
3061
3872
  const { formatMessage } = reactIntl.useIntl();
3062
3873
  return (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
3063
3874
  };
3064
3875
  const PeriodSelect = ({ value, onChange }) => {
3065
- const t = useT$1();
3876
+ const t = useT$2();
3066
3877
  const labels = {
3067
3878
  1: t("adminPanel.activity.period.day", "Last 24 hours"),
3068
3879
  7: t("adminPanel.activity.period.week", "Last 7 days"),
@@ -3082,18 +3893,19 @@ const PeriodSelect = ({ value, onChange }) => {
3082
3893
  );
3083
3894
  };
3084
3895
  const FilterSlot = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", minWidth: 0, flex: "1 1 18rem", children });
3896
+ const EmptyText = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", "data-event-empty": "", children });
3085
3897
  const EventList = ({
3086
3898
  filters,
3087
3899
  notice,
3088
3900
  list,
3089
- listLabel,
3090
- emptyText,
3091
- renderRow,
3901
+ empty,
3902
+ renderList,
3092
3903
  toCsv: toCsv2,
3093
3904
  fileName,
3094
- exportLabel
3905
+ exportLabel,
3906
+ footer
3095
3907
  }) => {
3096
- const t = useT$1();
3908
+ const t = useT$2();
3097
3909
  const { toggleNotification } = StrapiAdmin.useNotification();
3098
3910
  const [exporting, setExporting] = react.useState(false);
3099
3911
  const total = list.meta?.pagination?.total ?? 0;
@@ -3151,24 +3963,13 @@ const EventList = ({
3151
3963
  children: t("adminPanel.activity.error", "The events could not be loaded.")
3152
3964
  }
3153
3965
  ) : null,
3154
- !list.loading && !list.error && list.rows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", "data-event-empty": "", children: emptyText }) : null,
3155
- list.rows.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
3156
- designSystem.Flex,
3157
- {
3158
- tag: "ul",
3159
- direction: "column",
3160
- alignItems: "stretch",
3161
- gap: 2,
3162
- width: "100%",
3163
- "aria-label": listLabel,
3164
- children: list.rows.map((row) => renderRow(row))
3165
- }
3166
- ) : null,
3167
- list.hasMore ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", onClick: list.loadMore, loading: list.loadingMore, children: t("adminPanel.activity.showMore", "Show more") }) }) : null
3966
+ !list.loading && !list.error && list.rows.length === 0 ? empty : null,
3967
+ list.rows.length > 0 ? renderList(list.rows) : null,
3968
+ footer !== void 0 ? list.rows.length > 0 ? footer : null : list.hasMore ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", onClick: list.loadMore, loading: list.loadingMore, children: t("adminPanel.activity.showMore", "Show more") }) }) : null
3168
3969
  ] });
3169
3970
  };
3170
3971
  const RecordingOff = ({ children }) => {
3171
- const t = useT$1();
3972
+ const t = useT$2();
3172
3973
  return /* @__PURE__ */ jsxRuntime.jsx(
3173
3974
  index.PersistentAlert,
3174
3975
  {
@@ -3179,7 +3980,7 @@ const RecordingOff = ({ children }) => {
3179
3980
  );
3180
3981
  };
3181
3982
  const SignInHistoryPanel = ({ admin }) => {
3182
- const t = useT$1();
3983
+ const t = useT$2();
3183
3984
  const [event, setEvent] = react.useState("all");
3184
3985
  const [period, setPeriod] = react.useState("30");
3185
3986
  const params = react.useMemo(
@@ -3219,11 +4020,17 @@ const SignInHistoryPanel = ({ admin }) => {
3219
4020
  "adminPanel.activity.signIns.off",
3220
4021
  "Sign-in history is turned off. New sign-ins are not recorded."
3221
4022
  ) }) : null,
3222
- listLabel: t("adminPanel.activity.signIns.listLabel", "Sign-in history of {name}", {
3223
- name: admin.name
3224
- }),
3225
- emptyText: t("adminPanel.activity.signIns.empty", "No sign-in events in this period."),
3226
- renderRow: (row) => /* @__PURE__ */ jsxRuntime.jsx(SignInEventRow, { row }, row.id),
4023
+ empty: /* @__PURE__ */ jsxRuntime.jsx(EmptyText, { children: t("adminPanel.activity.signIns.empty", "No sign-in events in this period.") }),
4024
+ renderList: (rows) => /* @__PURE__ */ jsxRuntime.jsx(
4025
+ SignInEventTable,
4026
+ {
4027
+ rows,
4028
+ busy: list.loading,
4029
+ label: t("adminPanel.activity.signIns.listLabel", "Sign-in history of {name}", {
4030
+ name: admin.name
4031
+ })
4032
+ }
4033
+ ),
3227
4034
  toCsv: buildSignInCsv,
3228
4035
  fileName: "admin-sign-in-history",
3229
4036
  exportLabel: t(
@@ -3237,7 +4044,7 @@ const SignInHistoryPanel = ({ admin }) => {
3237
4044
  );
3238
4045
  };
3239
4046
  const ContentActivityPanel = ({ admin }) => {
3240
- const t = useT$1();
4047
+ const t = useT$2();
3241
4048
  const [action, setAction] = react.useState("all");
3242
4049
  const [contentType, setContentType] = react.useState("all");
3243
4050
  const [period, setPeriod] = react.useState("30");
@@ -3300,14 +4107,17 @@ const ContentActivityPanel = ({ admin }) => {
3300
4107
  /* @__PURE__ */ jsxRuntime.jsx(FilterSlot, { children: /* @__PURE__ */ jsxRuntime.jsx(PeriodSelect, { value: period, onChange: setPeriod }) })
3301
4108
  ] }),
3302
4109
  notice,
3303
- listLabel: t("adminPanel.activity.content.listLabel", "Content Manager activity of {name}", {
3304
- name: admin.name
3305
- }),
3306
- emptyText: t(
3307
- "adminPanel.activity.content.empty",
3308
- "No Content Manager activity in this period."
4110
+ empty: /* @__PURE__ */ jsxRuntime.jsx(EmptyText, { children: t("adminPanel.activity.content.empty", "No Content Manager activity in this period.") }),
4111
+ renderList: (rows) => /* @__PURE__ */ jsxRuntime.jsx(
4112
+ ActivityEventTable,
4113
+ {
4114
+ rows,
4115
+ busy: list.loading,
4116
+ label: t("adminPanel.activity.content.listLabel", "Content Manager activity of {name}", {
4117
+ name: admin.name
4118
+ })
4119
+ }
3309
4120
  ),
3310
- renderRow: (row) => /* @__PURE__ */ jsxRuntime.jsx(ActivityEventRow, { row }, row.id),
3311
4121
  toCsv: buildActivityCsv,
3312
4122
  fileName: "admin-content-activity",
3313
4123
  exportLabel: t(
@@ -3319,24 +4129,48 @@ const ContentActivityPanel = ({ admin }) => {
3319
4129
  );
3320
4130
  };
3321
4131
  const RecentSignInActivity = ({ onOpenAdmin }) => {
3322
- const t = useT$1();
3323
- const params = react.useMemo(() => buildSignInParams({ pageSize: 5 }), []);
4132
+ const t = useT$2();
4133
+ const headingId = `recent-sign-in-activity-${react.useId().replace(/:/g, "")}`;
4134
+ const params = react.useMemo(() => buildSignInParams({ pageSize: RECENT_EVENT_LIMIT }), []);
3324
4135
  const list = useEventList({
3325
4136
  path: `/${index.pluginId}/admin-activity/sign-ins`,
3326
4137
  params,
3327
4138
  logKey: "adminPanel.activity.recent"
3328
4139
  });
3329
4140
  if (list.meta?.recording && !list.meta.recording.signIns) return null;
4141
+ const title = t("adminPanel.activity.recent.title", "Recent security activity");
3330
4142
  return /* @__PURE__ */ jsxRuntime.jsxs(
3331
- SectionCard.SectionCard,
4143
+ designSystem.Flex,
3332
4144
  {
3333
- title: t("adminPanel.activity.recent.title", "Recent sign-in activity"),
3334
- subtitle: t(
3335
- "adminPanel.activity.recent.subtitle",
3336
- "The latest sign-ins, failed attempts and sign-outs of all admins. Open an admin for their full history."
3337
- ),
4145
+ tag: "section",
4146
+ "aria-labelledby": headingId,
4147
+ direction: "column",
4148
+ alignItems: "stretch",
4149
+ gap: 4,
4150
+ minWidth: 0,
4151
+ "data-recent-activity": "",
3338
4152
  children: [
3339
- list.loading ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", padding: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { small: true, children: t("adminPanel.activity.loading", "Loading events") }) }) : null,
4153
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "flex-end", gap: 4, wrap: "wrap", children: [
4154
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, flex: "1 1 32rem", children: [
4155
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id: headingId, variant: "delta", tag: "h2", textColor: "neutral800", children: title }),
4156
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t(
4157
+ "adminPanel.activity.recent.subtitle",
4158
+ "The latest sign-ins, failed attempts, sign-outs and settings changes of all admins. Select an event for its details."
4159
+ ) })
4160
+ ] }),
4161
+ /* @__PURE__ */ jsxRuntime.jsx(
4162
+ designSystem.LinkButton,
4163
+ {
4164
+ tag: reactRouterDom.Link,
4165
+ to: ADMIN_ACTIVITY_PAGE_PATH,
4166
+ variant: "tertiary",
4167
+ endIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowRight, {}),
4168
+ "data-show-all-activity": "",
4169
+ children: t("adminPanel.activity.recent.showAll", "Show all")
4170
+ }
4171
+ )
4172
+ ] }),
4173
+ list.loading && list.rows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", padding: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { small: true, children: t("adminPanel.activity.loading", "Loading events") }) }) : null,
3340
4174
  !list.loading && list.error ? /* @__PURE__ */ jsxRuntime.jsx(
3341
4175
  index.PersistentAlert,
3342
4176
  {
@@ -3345,17 +4179,15 @@ const RecentSignInActivity = ({ onOpenAdmin }) => {
3345
4179
  children: t("adminPanel.activity.error", "The events could not be loaded.")
3346
4180
  }
3347
4181
  ) : null,
3348
- !list.loading && !list.error && list.rows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", children: t("adminPanel.activity.recent.empty", "No sign-in events yet.") }) : null,
4182
+ !list.loading && !list.error && list.rows.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", children: t("adminPanel.activity.recent.empty", "No events recorded yet.") }) : null,
3349
4183
  list.rows.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(
3350
- designSystem.Flex,
4184
+ SignInEventTable,
3351
4185
  {
3352
- tag: "ul",
3353
- direction: "column",
3354
- alignItems: "stretch",
3355
- gap: 2,
3356
- width: "100%",
3357
- "aria-label": t("adminPanel.activity.recent.title", "Recent sign-in activity"),
3358
- children: list.rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(SignInEventRow, { row, showAdmin: true, onOpenAdmin }, row.id))
4186
+ rows: list.rows,
4187
+ label: title,
4188
+ showAdmin: true,
4189
+ onOpenAdmin,
4190
+ busy: list.loading
3359
4191
  }
3360
4192
  ) : null
3361
4193
  ]
@@ -3379,7 +4211,7 @@ const DialogTabLabel = styled__default.default.span`
3379
4211
  font-size: ${({ theme }) => theme.fontSizes[2]};
3380
4212
  `;
3381
4213
  const ADMIN_DIALOG_TABS = Object.freeze(["sessions", "history", "activity"]);
3382
- const useT = () => {
4214
+ const useT$1 = () => {
3383
4215
  const { formatMessage } = reactIntl.useIntl();
3384
4216
  return (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
3385
4217
  };
@@ -3389,7 +4221,7 @@ const DateValue = ({ value }) => {
3389
4221
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "time", dateTime: value, variant: "omega", textColor: "neutral800", children: formatDate(value) });
3390
4222
  };
3391
4223
  const SessionCard = ({ session, admin, canSignOut, onSignOut }) => {
3392
- const t = useT();
4224
+ const t = useT$1();
3393
4225
  const device = session.device || t("adminPanel.session.unknownDevice", "Unknown browser");
3394
4226
  return /* @__PURE__ */ jsxRuntime.jsx(
3395
4227
  designSystem.Box,
@@ -3467,7 +4299,7 @@ const AdminSessionsModal = ({
3467
4299
  canViewActivity = false,
3468
4300
  initialTab = "sessions"
3469
4301
  }) => {
3470
- const t = useT();
4302
+ const t = useT$1();
3471
4303
  const [tab, setTab] = react.useState(ADMIN_DIALOG_TABS.includes(initialTab) ? initialTab : "sessions");
3472
4304
  const canSignOut = canRevoke && admin.account === "active" && !admin.protectedReason;
3473
4305
  const settingsPath = `/settings/users/${admin.id}`;
@@ -3575,7 +4407,7 @@ const AdminSessionsModal = ({
3575
4407
  ] }) });
3576
4408
  };
3577
4409
  const SETTINGS_USERS_PATH = "/settings/users";
3578
- const PaginationTargets = styled__default.default.div`
4410
+ const PaginationTargets$1 = styled__default.default.div`
3579
4411
  nav a {
3580
4412
  min-width: 3.2rem;
3581
4413
  }
@@ -3726,7 +4558,7 @@ const AdminPanelPage = () => {
3726
4558
  setQuery({ filter: filter === "all" ? void 0 : filter, page: "1" });
3727
4559
  };
3728
4560
  const handleSearch = react.useCallback(
3729
- (value) => setQuery({ search: dashboardModel.encodeSearchQuery(value), page: "1" }, "push", true),
4561
+ (value) => setQuery({ search: settingsTabs.encodeSearchQuery(value), page: "1" }, "push", true),
3730
4562
  [setQuery]
3731
4563
  );
3732
4564
  const handleClearFilters = () => {
@@ -3769,10 +4601,10 @@ const AdminPanelPage = () => {
3769
4601
  index.logSafeAdminError("adminPanel.signOut", err);
3770
4602
  const message2 = getSignOutErrorMessage(err);
3771
4603
  toggleNotification({
3772
- type: dashboardModel.getErrorStatus(err) === 404 ? "warning" : "danger",
4604
+ type: settingsTabs.getErrorStatus(err) === 404 ? "warning" : "danger",
3773
4605
  message: t(message2.messageId, message2.defaultMessage)
3774
4606
  });
3775
- if (dashboardModel.getErrorStatus(err) === 404) {
4607
+ if (settingsTabs.getErrorStatus(err) === 404) {
3776
4608
  await Promise.all([fetchAdmins(), selected ? fetchDialogSessions(selected) : null]);
3777
4609
  return;
3778
4610
  }
@@ -4046,7 +4878,7 @@ const AdminPanelPage = () => {
4046
4878
  ] }),
4047
4879
  admins.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
4048
4880
  isBelowMedium ? /* @__PURE__ */ jsxRuntime.jsx(AdminCardList, { ...listProps }) : /* @__PURE__ */ jsxRuntime.jsx(AdminTable, { ...listProps }),
4049
- /* @__PURE__ */ jsxRuntime.jsx(PaginationTargets, { children: /* @__PURE__ */ jsxRuntime.jsxs(
4881
+ /* @__PURE__ */ jsxRuntime.jsx(PaginationTargets$1, { children: /* @__PURE__ */ jsxRuntime.jsxs(
4050
4882
  StrapiAdmin.Pagination.Root,
4051
4883
  {
4052
4884
  pageCount: pagination.pageCount,
@@ -4112,6 +4944,185 @@ const AdminPanelPage = () => {
4112
4944
  }
4113
4945
  );
4114
4946
  };
4947
+ const PaginationTargets = styled__default.default.div`
4948
+ nav a {
4949
+ min-width: 3.2rem;
4950
+ }
4951
+
4952
+ & > div {
4953
+ flex-wrap: wrap;
4954
+ gap: ${({ theme }) => theme.spaces[2]} ${({ theme }) => theme.spaces[4]};
4955
+ }
4956
+
4957
+ & > div > div > span {
4958
+ white-space: nowrap;
4959
+ }
4960
+ `;
4961
+ const useT = () => {
4962
+ const { formatMessage } = reactIntl.useIntl();
4963
+ return (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
4964
+ };
4965
+ const AdminActivityPage = () => {
4966
+ const t = useT();
4967
+ const [{ query }, setQuery] = StrapiAdmin.useQueryParams();
4968
+ const view = parseActivityPageQuery(query);
4969
+ const captionRef = react.useRef(null);
4970
+ const params = react.useMemo(
4971
+ () => buildSignInParams({
4972
+ adminId: view.adminId ?? void 0,
4973
+ event: view.event,
4974
+ period: view.period,
4975
+ page: view.page,
4976
+ pageSize: view.pageSize
4977
+ }),
4978
+ [view.adminId, view.event, view.period, view.page, view.pageSize]
4979
+ );
4980
+ const list = useEventList({
4981
+ path: `/${index.pluginId}/admin-activity/sign-ins`,
4982
+ params,
4983
+ logKey: "adminPanel.activity.page"
4984
+ });
4985
+ const pagination = list.meta?.pagination || { pageCount: 1, total: 0 };
4986
+ react.useEffect(() => {
4987
+ if (!list.loading && list.meta && view.page > pagination.pageCount) {
4988
+ setQuery({ page: String(pagination.pageCount) }, "push", true);
4989
+ }
4990
+ }, [list.loading, list.meta, view.page, pagination.pageCount, setQuery]);
4991
+ const recording = list.meta?.recording;
4992
+ const filtered = hasActivityPageFilters(view);
4993
+ const adminName = view.adminId !== null ? list.rows.find((row) => row.admin?.id === view.adminId)?.admin?.name || t("adminPanel.identity.placeholder", "Admin #{id}", { id: view.adminId }) : null;
4994
+ const setFilters = (next) => setQuery({ ...next, page: "1" });
4995
+ const clearFilters = () => {
4996
+ setQuery({ event: void 0, period: void 0, adminId: void 0, page: "1" });
4997
+ captionRef.current?.focus();
4998
+ };
4999
+ const labels = {
5000
+ all: t("adminPanel.activity.filter.allEvents", "All events"),
5001
+ succeeded: t("adminPanel.activity.filter.succeeded", "Sign-ins"),
5002
+ failed: t("adminPanel.activity.filter.failed", "Failed and locked out"),
5003
+ "signed-out": t("adminPanel.activity.filter.signedOut", "Sign-outs"),
5004
+ changes: t("adminPanel.activity.filter.changes", "Settings and log access")
5005
+ };
5006
+ const title = t("adminPanel.activity.page.title", "Security activity");
5007
+ const total = pagination.total;
5008
+ return /* @__PURE__ */ jsxRuntime.jsx(
5009
+ index.PageShell,
5010
+ {
5011
+ headingId: "magic-sessionmanager-admin-activity-title",
5012
+ title,
5013
+ subtitle: t(
5014
+ "adminPanel.activity.page.subtitle",
5015
+ "Sign-ins, failed attempts, lockouts and sign-outs of every admin, plus settings changes, reads of this log with an API token and retention runs. Newest first."
5016
+ ),
5017
+ navigationAction: /* @__PURE__ */ jsxRuntime.jsx(StrapiAdmin.BackButton, { fallback: SESSION_VIEW_PATHS.admins }),
5018
+ children: /* @__PURE__ */ jsxRuntime.jsx(
5019
+ EventList,
5020
+ {
5021
+ list,
5022
+ filters: /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
5023
+ /* @__PURE__ */ jsxRuntime.jsx(FilterSlot, { children: /* @__PURE__ */ jsxRuntime.jsx(
5024
+ designSystem.SingleSelect,
5025
+ {
5026
+ size: "S",
5027
+ "aria-label": t("adminPanel.activity.filter.event", "Event"),
5028
+ value: view.event,
5029
+ onChange: (next) => setFilters({ event: String(next) === "all" ? void 0 : String(next) }),
5030
+ children: ALL_ADMINS_FILTER_OPTIONS.map((option) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: option, children: labels[option] }, option))
5031
+ }
5032
+ ) }),
5033
+ /* @__PURE__ */ jsxRuntime.jsx(FilterSlot, { children: /* @__PURE__ */ jsxRuntime.jsx(
5034
+ PeriodSelect,
5035
+ {
5036
+ value: view.period,
5037
+ onChange: (next) => setFilters({ period: next === "30" ? void 0 : next })
5038
+ }
5039
+ ) }),
5040
+ view.adminId !== null ? /* @__PURE__ */ jsxRuntime.jsx(
5041
+ designSystem.Tag,
5042
+ {
5043
+ icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, { "aria-hidden": "true" }),
5044
+ label: t("adminPanel.activity.page.removeAdmin", "Show all admins again"),
5045
+ onClick: () => setFilters({ adminId: void 0 }),
5046
+ "data-admin-filter": view.adminId,
5047
+ children: t("adminPanel.activity.page.adminFilter", "Admin: {name}", { name: adminName })
5048
+ }
5049
+ ) : null
5050
+ ] }),
5051
+ notice: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
5052
+ recording && !recording.signIns ? /* @__PURE__ */ jsxRuntime.jsx(RecordingOff, { children: t(
5053
+ "adminPanel.activity.signIns.off",
5054
+ "Sign-in history is turned off. New sign-ins are not recorded."
5055
+ ) }) : null,
5056
+ /* @__PURE__ */ jsxRuntime.jsx(
5057
+ designSystem.Typography,
5058
+ {
5059
+ ref: captionRef,
5060
+ tabIndex: -1,
5061
+ variant: "pi",
5062
+ textColor: "neutral600",
5063
+ "aria-live": "polite",
5064
+ "data-activity-caption": "",
5065
+ children: t(
5066
+ "adminPanel.activity.page.caption",
5067
+ "{total, plural, =0 {No events} one {# event} other {# events}}",
5068
+ { total }
5069
+ )
5070
+ }
5071
+ )
5072
+ ] }),
5073
+ empty: /* @__PURE__ */ jsxRuntime.jsx(
5074
+ designSystem.EmptyStateLayout,
5075
+ {
5076
+ icon: /* @__PURE__ */ jsxRuntime.jsx(symbols.EmptyDocuments, { width: "16rem", height: "8.8rem", "aria-hidden": "true" }),
5077
+ content: filtered ? t("adminPanel.activity.page.noResults", "No events match these filters.") : t("adminPanel.activity.recent.empty", "No events recorded yet."),
5078
+ action: filtered ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", onClick: clearFilters, children: t("adminPanel.noResults.reset", "Clear filters") }) : null
5079
+ }
5080
+ ),
5081
+ renderList: (rows) => /* @__PURE__ */ jsxRuntime.jsx(
5082
+ SignInEventTable,
5083
+ {
5084
+ rows,
5085
+ label: title,
5086
+ showAdmin: true,
5087
+ busy: list.loading,
5088
+ detailsAction: (row, close) => row.admin && row.admin.id !== view.adminId ? /* @__PURE__ */ jsxRuntime.jsx(
5089
+ designSystem.Button,
5090
+ {
5091
+ variant: "secondary",
5092
+ onClick: () => {
5093
+ close();
5094
+ setFilters({ adminId: String(row.admin.id) });
5095
+ },
5096
+ children: t("adminPanel.activity.page.onlyAdmin", "Show only events of {name}", {
5097
+ name: row.admin.name
5098
+ })
5099
+ }
5100
+ ) : null
5101
+ }
5102
+ ),
5103
+ toCsv: buildSignInCsv,
5104
+ fileName: "admin-security-activity",
5105
+ exportLabel: t(
5106
+ "adminPanel.activity.page.export",
5107
+ "Export the security activity with these filters as CSV"
5108
+ ),
5109
+ footer: /* @__PURE__ */ jsxRuntime.jsx(PaginationTargets, { children: /* @__PURE__ */ jsxRuntime.jsxs(
5110
+ StrapiAdmin.Pagination.Root,
5111
+ {
5112
+ pageCount: pagination.pageCount,
5113
+ total: pagination.total,
5114
+ defaultPageSize: EVENT_PAGE_SIZE,
5115
+ children: [
5116
+ /* @__PURE__ */ jsxRuntime.jsx(StrapiAdmin.Pagination.PageSize, { options: [...ACTIVITY_PAGE_SIZE_OPTIONS] }),
5117
+ /* @__PURE__ */ jsxRuntime.jsx(StrapiAdmin.Pagination.Links, {})
5118
+ ]
5119
+ }
5120
+ ) })
5121
+ }
5122
+ )
5123
+ }
5124
+ );
5125
+ };
4115
5126
  const App = () => {
4116
5127
  return /* @__PURE__ */ jsxRuntime.jsx(StrapiAdmin.Page.Protect, { permissions: index.pluginPermissions.access, children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
4117
5128
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(HomePage, {}) }),
@@ -4122,6 +5133,13 @@ const App = () => {
4122
5133
  element: /* @__PURE__ */ jsxRuntime.jsx(StrapiAdmin.Page.Protect, { permissions: index.pluginPermissions.adminSessionsRead, children: /* @__PURE__ */ jsxRuntime.jsx(AdminPanelPage, {}) })
4123
5134
  }
4124
5135
  ),
5136
+ /* @__PURE__ */ jsxRuntime.jsx(
5137
+ reactRouterDom.Route,
5138
+ {
5139
+ path: "admin-panel/activity",
5140
+ element: /* @__PURE__ */ jsxRuntime.jsx(StrapiAdmin.Page.Protect, { permissions: index.pluginPermissions.adminSessionsRead, children: /* @__PURE__ */ jsxRuntime.jsx(StrapiAdmin.Page.Protect, { permissions: index.pluginPermissions.adminActivityRead, children: /* @__PURE__ */ jsxRuntime.jsx(AdminActivityPage, {}) }) })
5141
+ }
5142
+ ),
4125
5143
  /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "*", element: /* @__PURE__ */ jsxRuntime.jsx(HomePage, {}) })
4126
5144
  ] }) });
4127
5145
  };