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
@@ -1,15 +1,14 @@
1
1
  import { jsx, jsxs, Fragment } from "react/jsx-runtime";
2
- import { useFetchClient, useNotification, useClipboard, useRBAC, useQueryParams, Pagination, Page } from "@strapi/strapi/admin";
2
+ import { useFetchClient, useNotification, useClipboard, useRBAC, useQueryParams, Pagination, BackButton, Page } from "@strapi/strapi/admin";
3
3
  import { NavLink, Link as Link$1, Routes, Route } from "react-router-dom";
4
4
  import { useMemo, useState, useEffect, useRef, useId, useCallback, useLayoutEffect } from "react";
5
5
  import { useIntl } from "react-intl";
6
- import { Typography, Flex, Loader, Button, Modal, Accordion, Box, IconButton, Link, SimpleMenu, MenuItem, Grid, Table, Thead, Tr, Th, VisuallyHidden, Tbody, Td, Tooltip, SearchForm, Searchbar, TextButton, SingleSelect, SingleSelectOption, EmptyStateLayout, LinkButton, Badge, Tabs, Dialog } from "@strapi/design-system";
7
- import { Earth, Duplicate, Cross, Eye, Trash, More, CaretDown, Download, ArrowClockwise, Check, Clock, User, ChartBubble, Cog, SignOut } from "@strapi/icons";
6
+ import { Typography, Flex, Loader, Button, Modal, Accordion, Box, IconButton, Link, SimpleMenu, MenuItem, Grid, Table, Thead, Tr, Th, VisuallyHidden, Tbody, Td, Tooltip, SearchForm, Searchbar, TextButton, SingleSelect, SingleSelectOption, EmptyStateLayout, LinkButton, Badge, Tabs, Dialog, Tag } from "@strapi/design-system";
7
+ import { Earth, Duplicate, Cross, Eye, Trash, More, CaretDown, Download, ArrowClockwise, Check, Clock, User, ChartBubble, Cog, SignOut, Information, Webhooks, WarningCircle, Monitor, Key, Stack, Lock, CrossCircle, Shield, CheckCircle, ArrowRight } from "@strapi/icons";
8
8
  import { EmptyDocuments } from "@strapi/icons/symbols";
9
9
  import styled, { useTheme } from "styled-components";
10
- import { g as getSessionEndReason, a as getEndReasonPresentation, b as getTranslation, p as presentText, u as useSessionFormatters, c as getSessionStatus, d as getDevicePresentation, i as isNativeOnlySession, e as getSessionEndReasonPresentation, D as DeviceIcon, S as StatusBadge, P as PropertyList, C as ConfirmAction, t as toValidDate, f as pluginId, l as logSafeAdminError, h as PersistentAlert, R as ReadableText, j as pluginPermissions, M as MissingValue, V as ValueOrMissing, k as SESSION_STATES, m as SESSION_STATUS_PRESENTATION, n as isCancelledRequest, o as SESSION_FILTER_OPTIONS, E as END_REASON_FILTER_OPTIONS, q as PageShell, r as StatGrid, s as StatCard, v as restoreDialogFocus, w as requireSessionList, x as getBadgeColors, T as TargetLink$1 } from "./index-BmnC2BPs.mjs";
11
- import { i as isRiskSource, g as getSessionUserLabels, a as getUserEditPath, R as RISK_SETTINGS_PATH, b as RowActions, s as shouldIsolateActionKey, c as shouldRedispatchEscape, D as DASHBOARD_COMPACT_TABLE_COLUMNS, d as DASHBOARD_TABLE_COLUMNS, r as readDisclosureOpen, e as getBrowserStorage, w as writeDisclosureOpen, u as useElementWidth, p as parseDashboardQuery, A as AUTO_REFRESH_INTERVAL_MS, f as pickFocusSessionId, h as encodeSearchQuery, j as shouldUseCompactTable, P as PAGE_SIZE_OPTIONS, k as DEFAULT_PAGE_SIZE, l as getExportDeviceInfo, m as getErrorStatus, n as hasActiveFilters } from "./dashboardModel-BhUonEqc.mjs";
12
- import { S as SectionCard } from "./SectionCard-D51bv4Hi.mjs";
10
+ import { g as getSessionEndReason, a as getEndReasonPresentation, b as getTranslation, p as presentText, u as useSessionFormatters, c as getSessionStatus, d as getDevicePresentation, i as isNativeOnlySession, e as getSessionEndReasonPresentation, D as DeviceIcon, S as StatusBadge, P as PropertyList, C as ConfirmAction, t as toValidDate, f as pluginId, l as logSafeAdminError, h as PersistentAlert, R as ReadableText, j as pluginPermissions, M as MissingValue, V as ValueOrMissing, k as SESSION_STATES, m as SESSION_STATUS_PRESENTATION, n as isCancelledRequest, o as SESSION_FILTER_OPTIONS, E as END_REASON_FILTER_OPTIONS, q as PageShell, r as StatGrid, s as StatCard, v as restoreDialogFocus, w as requireSessionList, x as getBadgeColors, T as TargetLink$1 } from "./index-h-ksmM8A.mjs";
11
+ import { i as isRiskSource, g as getSessionUserLabels, a as getUserEditPath, R as RISK_SETTINGS_PATH, b as RowActions, s as shouldIsolateActionKey, c as shouldRedispatchEscape, D as DASHBOARD_COMPACT_TABLE_COLUMNS, d as DASHBOARD_TABLE_COLUMNS, r as readDisclosureOpen, e as getBrowserStorage, w as writeDisclosureOpen, u as useElementWidth, p as parseDashboardQuery, A as AUTO_REFRESH_INTERVAL_MS, f as pickFocusSessionId, h as encodeSearchQuery, j as shouldUseCompactTable, P as PAGE_SIZE_OPTIONS, k as DEFAULT_PAGE_SIZE, l as getExportDeviceInfo, m as getErrorStatus, n as hasActiveFilters, S as SETTINGS_TAB_IDS, o as SETTINGS_TAB_FIELDS, q as SETTINGS_FIELD_LABELS, t as SETTINGS_TAB_LABELS } from "./settingsTabs-D02CuEvs.mjs";
13
12
  const EndReason = ({ session, reason, variant = "omega", textColor = "neutral800" }) => {
14
13
  const { formatMessage } = useIntl();
15
14
  const key = reason || getSessionEndReason(session);
@@ -1674,7 +1673,7 @@ const UntrackedSessionsNotice = ({ stats, onChanged, fallbackFocusRef }) => {
1674
1673
  const CLOCK_TICK_MS = 30 * 1e3;
1675
1674
  const ANALYTICS_PATH = `/settings/${pluginId}/analytics`;
1676
1675
  const CONFIGURATION_PATH = `/settings/${pluginId}/general`;
1677
- const PaginationTargets$1 = styled.div`
1676
+ const PaginationTargets$2 = styled.div`
1678
1677
  nav a {
1679
1678
  min-width: 3.2rem;
1680
1679
  }
@@ -2244,7 +2243,7 @@ const HomePage = () => {
2244
2243
  compact: shouldUseCompactTable(listWidth, isBelowLarge)
2245
2244
  }
2246
2245
  ),
2247
- /* @__PURE__ */ jsx(PaginationTargets$1, { children: /* @__PURE__ */ jsxs(
2246
+ /* @__PURE__ */ jsx(PaginationTargets$2, { children: /* @__PURE__ */ jsxs(
2248
2247
  Pagination.Root,
2249
2248
  {
2250
2249
  pageCount: pageResult.pageCount,
@@ -2445,12 +2444,12 @@ const keepActionKeys = (event) => {
2445
2444
  };
2446
2445
  const SHRINKING_ADMIN_CELL = { maxWidth: 0, width: "34%" };
2447
2446
  const SHRINKING_ROLES_CELL = { maxWidth: 0, width: "22%" };
2448
- const useT$3 = () => {
2447
+ const useT$4 = () => {
2449
2448
  const { formatMessage } = useIntl();
2450
2449
  return (id, defaultMessage, values) => formatMessage({ id: getTranslation(id), defaultMessage }, values);
2451
2450
  };
2452
2451
  const AdminIdentity = ({ admin }) => {
2453
- const t = useT$3();
2452
+ const t = useT$4();
2454
2453
  return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, minWidth: 0, children: [
2455
2454
  /* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", minWidth: 0, children: [
2456
2455
  /* @__PURE__ */ jsx(
@@ -2470,13 +2469,13 @@ const AdminIdentity = ({ admin }) => {
2470
2469
  ] });
2471
2470
  };
2472
2471
  const AdminRoles = ({ admin }) => {
2473
- const t = useT$3();
2472
+ const t = useT$4();
2474
2473
  const names = (admin.roles || []).map((role) => role.name).filter(Boolean);
2475
2474
  const text = admin.rolesHidden ? t("adminPanel.roles.hidden", "Hidden (needs “Read” on Roles)") : names.length ? names.join(", ") : t("adminPanel.roles.none", "No role");
2476
2475
  return /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", ellipsis: true, title: text, children: text });
2477
2476
  };
2478
2477
  const AdminStatus = ({ admin }) => {
2479
- const t = useT$3();
2478
+ const t = useT$4();
2480
2479
  const status = getAdminStatusPresentation(admin);
2481
2480
  return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 1, "data-admin-status": status.key, children: [
2482
2481
  /* @__PURE__ */ jsx(Badge, { ...getBadgeColors(status.tone), children: t(status.label.messageId, status.label.defaultMessage) }),
@@ -2491,7 +2490,7 @@ const AdminTable = ({
2491
2490
  onSignOutEverywhere,
2492
2491
  busy
2493
2492
  }) => {
2494
- const t = useT$3();
2493
+ const t = useT$4();
2495
2494
  return /* @__PURE__ */ jsx(Box, { background: "neutral0", hasRadius: true, shadow: "tableShadow", "data-admin-table": "", children: /* @__PURE__ */ jsxs(
2496
2495
  Table,
2497
2496
  {
@@ -2545,7 +2544,7 @@ const AdminTable = ({
2545
2544
  ) });
2546
2545
  };
2547
2546
  const AdminCardList = ({ admins, labelledBy, canRevoke, onView, onSignOutEverywhere }) => {
2548
- const t = useT$3();
2547
+ const t = useT$4();
2549
2548
  return /* @__PURE__ */ jsx(
2550
2549
  Flex,
2551
2550
  {
@@ -2614,6 +2613,7 @@ const AdminCardList = ({ admins, labelledBy, canRevoke, onView, onSignOutEverywh
2614
2613
  );
2615
2614
  };
2616
2615
  const SIGN_IN_FILTER_OPTIONS = Object.freeze(["all", "succeeded", "failed", "signed-out"]);
2616
+ const ALL_ADMINS_FILTER_OPTIONS = Object.freeze([...SIGN_IN_FILTER_OPTIONS, "changes"]);
2617
2617
  const ACTIVITY_ACTION_OPTIONS = Object.freeze([
2618
2618
  "all",
2619
2619
  "view",
@@ -2637,7 +2637,7 @@ function buildSignInParams(filters, now) {
2637
2637
  const params = {
2638
2638
  page: filters.page || 1,
2639
2639
  pageSize: filters.pageSize || EVENT_PAGE_SIZE,
2640
- event: SIGN_IN_FILTER_OPTIONS.includes(filters.event) ? filters.event : "all"
2640
+ event: ALL_ADMINS_FILTER_OPTIONS.includes(filters.event) ? filters.event : "all"
2641
2641
  };
2642
2642
  if (filters.adminId) params.adminId = String(filters.adminId);
2643
2643
  const from = periodStart(filters.period || "all", now);
@@ -2671,12 +2671,20 @@ const FAILURE_REASONS = Object.freeze({
2671
2671
  login_not_allowed: message("adminPanel.activity.reason.notAllowed", "Sign-in is not allowed"),
2672
2672
  rate_limited: message("adminPanel.activity.reason.rateLimited", "Too many attempts")
2673
2673
  });
2674
+ const appUserEvent = (key, tone, icon, messageId, defaultMessage) => ({
2675
+ key,
2676
+ tone,
2677
+ icon,
2678
+ label: message(messageId, defaultMessage),
2679
+ detail: null
2680
+ });
2674
2681
  function getSignInEventPresentation(row) {
2675
2682
  switch (row?.event) {
2676
2683
  case "admin.sign-in":
2677
2684
  return {
2678
2685
  key: "sign-in",
2679
2686
  tone: "success",
2687
+ icon: "signIn",
2680
2688
  label: message("adminPanel.activity.event.signIn", "Signed in"),
2681
2689
  detail: row.reason === "registration" ? message("adminPanel.activity.reason.registration", "First sign-in after registration") : row.reason === "password_reset" ? message(
2682
2690
  "adminPanel.activity.reason.passwordReset",
@@ -2686,14 +2694,16 @@ function getSignInEventPresentation(row) {
2686
2694
  case "admin.sign-in.failed":
2687
2695
  return {
2688
2696
  key: "failed",
2689
- tone: "warning",
2697
+ tone: "danger",
2698
+ icon: "failed",
2690
2699
  label: message("adminPanel.activity.event.failed", "Sign-in failed"),
2691
2700
  detail: FAILURE_REASONS[row.reason] || null
2692
2701
  };
2693
2702
  case "admin.lockout":
2694
2703
  return {
2695
2704
  key: "lockout",
2696
- tone: "warning",
2705
+ tone: "danger",
2706
+ icon: "lockout",
2697
2707
  label: message("adminPanel.activity.event.lockout", "Locked out"),
2698
2708
  detail: FAILURE_REASONS.rate_limited
2699
2709
  };
@@ -2701,20 +2711,150 @@ function getSignInEventPresentation(row) {
2701
2711
  return {
2702
2712
  key: "sign-out",
2703
2713
  tone: "neutral",
2714
+ icon: "signOut",
2704
2715
  label: message("adminPanel.activity.event.signOut", "Signed out"),
2705
2716
  detail: null
2706
2717
  };
2707
2718
  case "admin.session.revoked":
2708
2719
  return {
2709
2720
  key: "revoked",
2710
- tone: "neutral",
2721
+ tone: "warning",
2722
+ icon: "revoked",
2711
2723
  label: message("adminPanel.activity.event.revoked", "Signed out by an admin"),
2712
2724
  detail: row.scope === "one_browser" ? message("adminPanel.activity.scope.oneBrowser", "One browser") : message("adminPanel.activity.scope.everywhere", "Every browser")
2713
2725
  };
2726
+ case "settings.updated":
2727
+ return {
2728
+ key: "settings",
2729
+ tone: "secondary",
2730
+ icon: "settings",
2731
+ label: message("adminPanel.activity.event.settings", "Settings changed"),
2732
+ detail: row.change?.viaToken ? message("adminPanel.activity.via.token", "With an admin API token") : null
2733
+ };
2734
+ case "security-log.read":
2735
+ return {
2736
+ key: "log-read",
2737
+ tone: "secondary",
2738
+ icon: "logRead",
2739
+ label: message("adminPanel.activity.event.logRead", "Log read with an API token"),
2740
+ detail: row.read?.list === "content" ? row.read?.exported ? message(
2741
+ "adminPanel.activity.read.contentExport",
2742
+ "Content Manager activity exported"
2743
+ ) : 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")
2744
+ };
2745
+ case "security-log.retention.purged":
2746
+ return {
2747
+ key: "purged",
2748
+ tone: "neutral",
2749
+ icon: "purged",
2750
+ label: message("adminPanel.activity.event.purged", "Old events deleted"),
2751
+ detail: null
2752
+ };
2753
+ // App-user events (4.17 / 4.18). The admin lists of this view do not return them
2754
+ // today; they get their own label and colour so any list that does shows them clearly.
2755
+ case "user.sign-in.failed":
2756
+ return appUserEvent(
2757
+ "user-failed",
2758
+ "danger",
2759
+ "failed",
2760
+ "adminPanel.activity.event.userFailed",
2761
+ "App user sign-in failed"
2762
+ );
2763
+ case "user.sign-in.refused":
2764
+ return appUserEvent(
2765
+ "user-refused",
2766
+ "danger",
2767
+ "refused",
2768
+ "adminPanel.activity.event.userRefused",
2769
+ "App user sign-in refused"
2770
+ );
2771
+ case "user.lockout":
2772
+ return appUserEvent(
2773
+ "user-lockout",
2774
+ "danger",
2775
+ "lockout",
2776
+ "adminPanel.activity.event.userLockout",
2777
+ "App user locked out"
2778
+ );
2779
+ case "user.lockout.lifted":
2780
+ return appUserEvent(
2781
+ "user-unlock",
2782
+ "secondary",
2783
+ "unlock",
2784
+ "adminPanel.activity.event.userUnlock",
2785
+ "Lockout lifted"
2786
+ );
2787
+ case "user.session.limit":
2788
+ return appUserEvent(
2789
+ "user-limit",
2790
+ "warning",
2791
+ "limit",
2792
+ "adminPanel.activity.event.userLimit",
2793
+ "Session limit reached"
2794
+ );
2795
+ case "user.password-change.ended-others":
2796
+ return appUserEvent(
2797
+ "user-password",
2798
+ "warning",
2799
+ "password",
2800
+ "adminPanel.activity.event.userPassword",
2801
+ "Signed out after a password change"
2802
+ );
2803
+ case "user.sign-in.new-device":
2804
+ return appUserEvent(
2805
+ "user-device",
2806
+ "secondary",
2807
+ "device",
2808
+ "adminPanel.activity.event.userNewDevice",
2809
+ "Sign-in from a new device"
2810
+ );
2811
+ case "user.sign-in.impossible-travel":
2812
+ return appUserEvent(
2813
+ "user-travel",
2814
+ "danger",
2815
+ "travel",
2816
+ "adminPanel.activity.event.userTravel",
2817
+ "Impossible travel"
2818
+ );
2819
+ case "user.not-me":
2820
+ return appUserEvent(
2821
+ "user-not-me",
2822
+ "danger",
2823
+ "notMe",
2824
+ "adminPanel.activity.event.userNotMe",
2825
+ 'Reported as "This wasn’t me"'
2826
+ );
2827
+ case "user.data.exported":
2828
+ return appUserEvent(
2829
+ "user-export",
2830
+ "secondary",
2831
+ "export",
2832
+ "adminPanel.activity.event.userExport",
2833
+ "Personal data exported"
2834
+ );
2714
2835
  default:
2836
+ if (typeof row?.event === "string" && row.event.startsWith("impersonation.")) {
2837
+ return appUserEvent(
2838
+ "impersonation",
2839
+ "warning",
2840
+ "impersonation",
2841
+ "adminPanel.activity.event.impersonation",
2842
+ "Impersonation"
2843
+ );
2844
+ }
2845
+ if (typeof row?.event === "string" && row.event.startsWith("webhook.")) {
2846
+ return appUserEvent(
2847
+ "webhook",
2848
+ "neutral",
2849
+ "webhook",
2850
+ "adminPanel.activity.event.webhook",
2851
+ "Webhook delivery"
2852
+ );
2853
+ }
2715
2854
  return {
2716
2855
  key: "other",
2717
2856
  tone: "neutral",
2857
+ icon: "other",
2718
2858
  label: message("adminPanel.activity.event.other", "Security event"),
2719
2859
  detail: null
2720
2860
  };
@@ -2741,6 +2881,63 @@ function getSessionStatePresentation(session) {
2741
2881
  return null;
2742
2882
  }
2743
2883
  }
2884
+ const RECENT_EVENT_LIMIT = 8;
2885
+ const ACTIVITY_PAGE_SIZE_OPTIONS = Object.freeze(["10", "20", "50", "100"]);
2886
+ const EVENT_TABLE_MIN_WIDTH = Object.freeze({ withAdmin: 800, withoutAdmin: 740 });
2887
+ const EVENT_TABLE_FULL_WIDTH = 1e3;
2888
+ function getEventListLayout(width, { showAdmin = false } = {}) {
2889
+ if (!width) return "full";
2890
+ const min = showAdmin ? EVENT_TABLE_MIN_WIDTH.withAdmin : EVENT_TABLE_MIN_WIDTH.withoutAdmin;
2891
+ if (width < min) return "stacked";
2892
+ return width >= EVENT_TABLE_FULL_WIDTH ? "full" : "table";
2893
+ }
2894
+ function getEventPlace(row) {
2895
+ return [row?.location?.city, row?.location?.country].filter(Boolean).join(", ");
2896
+ }
2897
+ function parseActivityPageQuery(query) {
2898
+ const source = query || {};
2899
+ const event = ALL_ADMINS_FILTER_OPTIONS.includes(String(source.event)) ? String(source.event) : "all";
2900
+ const period = PERIOD_OPTIONS.includes(String(source.period)) ? String(source.period) : "30";
2901
+ const adminId = /^[1-9][0-9]{0,11}$/.test(String(source.adminId ?? "")) ? Number(source.adminId) : null;
2902
+ const page = Number.parseInt(String(source.page ?? ""), 10);
2903
+ const pageSize = String(source.pageSize ?? "");
2904
+ return {
2905
+ event,
2906
+ period,
2907
+ adminId,
2908
+ page: Number.isInteger(page) && page > 0 ? page : 1,
2909
+ pageSize: ACTIVITY_PAGE_SIZE_OPTIONS.includes(pageSize) ? Number(pageSize) : EVENT_PAGE_SIZE
2910
+ };
2911
+ }
2912
+ function hasActivityPageFilters(view) {
2913
+ return view.event !== "all" || view.period !== "30" || view.adminId !== null;
2914
+ }
2915
+ function groupChangedSettings(keys) {
2916
+ const list = Array.isArray(keys) ? keys.filter((key) => typeof key === "string" && key) : [];
2917
+ const byTab = /* @__PURE__ */ new Map();
2918
+ const unknown = [];
2919
+ const seen = /* @__PURE__ */ new Set();
2920
+ for (const key of list) {
2921
+ const tab = SETTINGS_TAB_IDS.find((id) => SETTINGS_TAB_FIELDS[id]?.includes(key));
2922
+ const entry = SETTINGS_FIELD_LABELS[key];
2923
+ if (!tab || !entry) {
2924
+ if (!seen.has(`raw:${key}`)) unknown.push({ key, label: null });
2925
+ seen.add(`raw:${key}`);
2926
+ continue;
2927
+ }
2928
+ if (seen.has(`label:${entry[0]}`)) continue;
2929
+ seen.add(`label:${entry[0]}`);
2930
+ if (!byTab.has(tab)) byTab.set(tab, []);
2931
+ byTab.get(tab).push({ key, label: message(entry[0], entry[1]) });
2932
+ }
2933
+ const groups = SETTINGS_TAB_IDS.filter((tab) => byTab.has(tab)).map((tab) => ({
2934
+ tab,
2935
+ label: message(SETTINGS_TAB_LABELS[tab][0], SETTINGS_TAB_LABELS[tab][1]),
2936
+ fields: byTab.get(tab)
2937
+ }));
2938
+ if (unknown.length) groups.push({ tab: null, label: null, fields: unknown });
2939
+ return groups;
2940
+ }
2744
2941
  const ACTIVITY_ACTION_LABELS = Object.freeze({
2745
2942
  all: message("adminPanel.activity.action.all", "All actions"),
2746
2943
  view: message("adminPanel.activity.action.view", "Opened"),
@@ -2833,38 +3030,205 @@ function buildActivityCsv(rows) {
2833
3030
  ])
2834
3031
  );
2835
3032
  }
2836
- const useT$2 = () => {
3033
+ const settingsGroupText = (t, group) => {
3034
+ const fields = group.fields.map(
3035
+ (field) => field.label ? t(field.label.messageId, field.label.defaultMessage) : field.key
3036
+ ).join(", ");
3037
+ return group.label ? t("adminPanel.activity.settingsGroup", "{tab}: {fields}", {
3038
+ tab: t(group.label.messageId, group.label.defaultMessage),
3039
+ fields
3040
+ }) : fields;
3041
+ };
3042
+ const changedSettingsText = (t, keys, { limit } = {}) => {
3043
+ const groups = groupChangedSettings(keys);
3044
+ const total = groups.reduce((sum, group) => sum + group.fields.length, 0);
3045
+ if (!total) return "";
3046
+ let budget = limit && limit > 0 ? limit : total;
3047
+ const shown = [];
3048
+ for (const group of groups) {
3049
+ if (budget <= 0) break;
3050
+ shown.push({ ...group, fields: group.fields.slice(0, budget) });
3051
+ budget -= Math.min(budget, group.fields.length);
3052
+ }
3053
+ const named = shown.reduce((sum, group) => sum + group.fields.length, 0);
3054
+ const text = shown.map((group) => settingsGroupText(t, group)).join(" · ");
3055
+ return named < total ? t("adminPanel.activity.settingsMore", "{names} and {count, number} more", {
3056
+ names: text,
3057
+ count: total - named
3058
+ }) : text;
3059
+ };
3060
+ const changedSettingsLines = (t, keys) => groupChangedSettings(keys).map((group) => settingsGroupText(t, group));
3061
+ const noAdminText = (t, row) => row?.event === "security-log.retention.purged" ? t("adminPanel.activity.system", "System") : t("adminPanel.activity.unknownAccount", "Unknown account");
3062
+ const deviceText = (t, row) => {
3063
+ if (row.browser && row.os) {
3064
+ return t("adminPanel.activity.browserOnOs", "{browser} on {os}", {
3065
+ browser: row.browser,
3066
+ os: row.os
3067
+ });
3068
+ }
3069
+ return row.browser || row.os || "";
3070
+ };
3071
+ const ipText = (t, row) => {
3072
+ if (!row.ipAddress) return "";
3073
+ return row.ipAnonymized ? t("adminPanel.activity.ipAnonymized", "{ip} (anonymised)", { ip: row.ipAddress }) : row.ipAddress;
3074
+ };
3075
+ const eventDetailText = (t, row, presentation, withActor) => {
3076
+ const parts = [];
3077
+ if (presentation.detail) {
3078
+ parts.push(t(presentation.detail.messageId, presentation.detail.defaultMessage));
3079
+ }
3080
+ if (Number.isInteger(row.attempts) && row.attempts > 1) {
3081
+ parts.push(
3082
+ t(
3083
+ "adminPanel.activity.attempts",
3084
+ "{count, plural, one {# attempt} other {# attempts}} within 5 minutes",
3085
+ { count: row.attempts }
3086
+ )
3087
+ );
3088
+ }
3089
+ const changed = changedSettingsText(t, row.change?.keys, { limit: 3 });
3090
+ if (changed) parts.push(changed);
3091
+ if (Number.isInteger(row.purge?.count)) {
3092
+ parts.push(
3093
+ Number.isInteger(row.purge?.retentionDays) ? t(
3094
+ "adminPanel.activity.purgedDetail",
3095
+ "{count, plural, one {# event} other {# events}}, older than {days, plural, one {# day} other {# days}}",
3096
+ { count: row.purge.count, days: row.purge.retentionDays }
3097
+ ) : t("adminPanel.activity.purgedCount", "{count, plural, one {# event} other {# events}}", {
3098
+ count: row.purge.count
3099
+ })
3100
+ );
3101
+ }
3102
+ if (withActor && row.actor?.name) {
3103
+ parts.push(t("adminPanel.activity.byAdmin", "by {name}", { name: row.actor.name }));
3104
+ }
3105
+ return parts.join(" · ");
3106
+ };
3107
+ const contentTypeText = (row) => [row.contentType?.name, row.entry?.locale].filter(Boolean).join(" · ");
3108
+ const useT$3 = () => {
2837
3109
  const { formatMessage } = useIntl();
2838
3110
  return (id, defaultMessage, values) => formatMessage({ id: getTranslation(id), defaultMessage }, values);
2839
3111
  };
2840
- const TargetTextButton = styled(TextButton)`
3112
+ const SHORT_DATE = Object.freeze({ dateStyle: "medium", timeStyle: "short" });
3113
+ const FULL_DATE = Object.freeze({ dateStyle: "full", timeStyle: "medium" });
3114
+ const EVENT_ICONS = Object.freeze({
3115
+ signIn: CheckCircle,
3116
+ failed: CrossCircle,
3117
+ lockout: Lock,
3118
+ signOut: SignOut,
3119
+ revoked: Shield,
3120
+ settings: Cog,
3121
+ logRead: Key,
3122
+ purged: Trash,
3123
+ refused: CrossCircle,
3124
+ unlock: Lock,
3125
+ limit: Stack,
3126
+ password: Key,
3127
+ device: Monitor,
3128
+ travel: Earth,
3129
+ notMe: WarningCircle,
3130
+ export: Download,
3131
+ impersonation: User,
3132
+ webhook: Webhooks,
3133
+ other: Information
3134
+ });
3135
+ const ICON_FILL = Object.freeze({
3136
+ success: "success600",
3137
+ danger: "danger600",
3138
+ warning: "warning700",
3139
+ secondary: "secondary600",
3140
+ neutral: "neutral600"
3141
+ });
3142
+ const stopCellKeys = (event) => {
3143
+ if (event.key === "Enter" || event.key === " " || event.key === "Spacebar") {
3144
+ event.stopPropagation();
3145
+ }
3146
+ };
3147
+ const ClickableRow = styled(Tr)`
3148
+ cursor: pointer;
3149
+ `;
3150
+ const WrapCell = styled(Td)`
3151
+ white-space: normal;
3152
+ `;
3153
+ const NoWrap = styled.span`
3154
+ white-space: nowrap;
3155
+ `;
3156
+ const NameButton = styled(TextButton)`
2841
3157
  min-height: 3.2rem;
3158
+ text-align: start;
2842
3159
  `;
2843
- const EventItem = ({ children, id, kind }) => /* @__PURE__ */ jsx(
2844
- Box,
2845
- {
2846
- tag: "li",
2847
- background: "neutral0",
2848
- borderColor: "neutral150",
2849
- hasRadius: true,
2850
- padding: 3,
2851
- "data-event-row": kind,
2852
- "data-event-id": id,
2853
- children: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 1, minWidth: 0, children })
3160
+ const StackedList = styled.ul`
3161
+ margin: 0;
3162
+ padding: 0;
3163
+ list-style: none;
3164
+ border: 1px solid ${({ theme }) => theme.colors.neutral150};
3165
+ border-radius: ${({ theme }) => theme.borderRadius};
3166
+ background: ${({ theme }) => theme.colors.neutral0};
3167
+ min-width: 0;
3168
+
3169
+ & > li + li {
3170
+ border-top: 1px solid ${({ theme }) => theme.colors.neutral150};
2854
3171
  }
2855
- );
2856
- const AdminName = ({ admin, onOpenAdmin }) => {
2857
- const t = useT$2();
3172
+ `;
3173
+ const StackedItem = styled.li`
3174
+ cursor: pointer;
3175
+ min-width: 0;
3176
+ `;
3177
+ const BreakAnywhere = styled(Typography)`
3178
+ overflow-wrap: anywhere;
3179
+ `;
3180
+ const getEventBadgeColors = (tone) => tone === "danger" ? { backgroundColor: "danger100", textColor: "danger700" } : getBadgeColors(tone);
3181
+ const EventBadge = ({ presentation, nowrap = false }) => {
3182
+ const t = useT$3();
3183
+ const Icon = EVENT_ICONS[presentation.icon] || Information;
3184
+ return /* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", shrink: 0, "data-event-kind": presentation.key, children: [
3185
+ /* @__PURE__ */ jsx(
3186
+ Icon,
3187
+ {
3188
+ "aria-hidden": "true",
3189
+ focusable: "false",
3190
+ width: "1.6rem",
3191
+ height: "1.6rem",
3192
+ fill: ICON_FILL[presentation.tone] || ICON_FILL.neutral
3193
+ }
3194
+ ),
3195
+ /* @__PURE__ */ jsx(Badge, { ...getEventBadgeColors(presentation.tone), "data-event-tone": presentation.tone, children: nowrap ? /* @__PURE__ */ jsx(NoWrap, { children: t(presentation.label.messageId, presentation.label.defaultMessage) }) : t(presentation.label.messageId, presentation.label.defaultMessage) })
3196
+ ] });
3197
+ };
3198
+ const EventTime = ({ value, compact = false }) => {
3199
+ const { formatDate, formatRelativeTime } = useSessionFormatters();
3200
+ const date = toValidDate(value);
3201
+ if (!date) return /* @__PURE__ */ jsx(MissingValue, { variant: "omega" });
3202
+ return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, children: [
3203
+ /* @__PURE__ */ jsx(
3204
+ Typography,
3205
+ {
3206
+ tag: "time",
3207
+ dateTime: date.toISOString(),
3208
+ variant: compact ? "pi" : "omega",
3209
+ textColor: "neutral800",
3210
+ children: /* @__PURE__ */ jsx(NoWrap, { children: formatRelativeTime(date) })
3211
+ }
3212
+ ),
3213
+ compact ? null : /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: /* @__PURE__ */ jsx(NoWrap, { children: formatDate(date, SHORT_DATE) }) })
3214
+ ] });
3215
+ };
3216
+ const AdminName = ({ admin, row, onOpenAdmin }) => {
3217
+ const t = useT$3();
2858
3218
  if (!admin) {
2859
- return /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", textColor: "neutral800", children: t("adminPanel.activity.unknownAccount", "Unknown account") });
3219
+ return /* @__PURE__ */ jsx(Typography, { variant: onOpenAdmin ? "pi" : "omega", textColor: "neutral600", children: noAdminText(t, row) });
2860
3220
  }
2861
3221
  if (!onOpenAdmin) {
2862
3222
  return /* @__PURE__ */ jsx(Typography, { variant: "omega", fontWeight: "semiBold", textColor: "neutral800", children: admin.name });
2863
3223
  }
2864
3224
  return /* @__PURE__ */ jsx(
2865
- TargetTextButton,
3225
+ NameButton,
2866
3226
  {
2867
- onClick: (event) => onOpenAdmin(admin, event.currentTarget),
3227
+ onClick: (event) => {
3228
+ event.stopPropagation();
3229
+ onOpenAdmin(admin, event.currentTarget);
3230
+ },
3231
+ onKeyDown: stopCellKeys,
2868
3232
  "aria-label": t("adminPanel.activity.openAdmin", "Open the details of {name}", {
2869
3233
  name: admin.name
2870
3234
  }),
@@ -2872,84 +3236,529 @@ const AdminName = ({ admin, onOpenAdmin }) => {
2872
3236
  }
2873
3237
  );
2874
3238
  };
2875
- const SignInEventRow = ({ row, showAdmin = false, onOpenAdmin }) => {
2876
- const t = useT$2();
2877
- const event = getSignInEventPresentation(row);
2878
- const session = getSessionStatePresentation(row.session);
2879
- const facts = [];
2880
- if (row.ipAddress) {
2881
- facts.push(
2882
- row.ipAnonymized ? t("adminPanel.activity.ipAnonymized", "{ip} (anonymised)", { ip: row.ipAddress }) : row.ipAddress
3239
+ const SignInDetails = ({ row }) => {
3240
+ const t = useT$3();
3241
+ const ip = ipText(t, row);
3242
+ const second = [getEventPlace(row), deviceText(t, row)].filter(Boolean).join(" · ");
3243
+ if (!ip && !second) return /* @__PURE__ */ jsx(MissingValue, { variant: "omega" });
3244
+ return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, children: [
3245
+ ip ? /* @__PURE__ */ jsx(BreakAnywhere, { variant: "omega", textColor: "neutral800", children: ip }) : null,
3246
+ second ? /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: second }) : null
3247
+ ] });
3248
+ };
3249
+ const SessionState = ({ row }) => {
3250
+ const t = useT$3();
3251
+ const { formatRelativeTime } = useSessionFormatters();
3252
+ const state = getSessionStatePresentation(row.session);
3253
+ if (!state) return /* @__PURE__ */ jsx(MissingValue, { variant: "omega" });
3254
+ const endedAt = toValidDate(row.session?.endedAt);
3255
+ const second = [
3256
+ endedAt ? formatRelativeTime(endedAt) : "",
3257
+ row.session?.endedBy?.name ? t("adminPanel.activity.byAdmin", "by {name}", { name: row.session.endedBy.name }) : ""
3258
+ ].filter(Boolean).join(" · ");
3259
+ return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, children: [
3260
+ /* @__PURE__ */ jsx(
3261
+ Typography,
3262
+ {
3263
+ variant: "omega",
3264
+ fontWeight: state.tone === "success" ? "semiBold" : void 0,
3265
+ textColor: state.tone === "success" ? "success600" : "neutral800",
3266
+ "data-session-state": row.session?.state,
3267
+ children: t(state.label.messageId, state.label.defaultMessage)
3268
+ }
3269
+ ),
3270
+ second ? /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: second }) : null
3271
+ ] });
3272
+ };
3273
+ const HeaderCell = ({ children, hidden = false }) => /* @__PURE__ */ jsx(Th, { children: hidden ? /* @__PURE__ */ jsx(VisuallyHidden, { children }) : /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children }) });
3274
+ const DetailsButton = ({ label, onOpen }) => /* @__PURE__ */ jsx(
3275
+ IconButton,
3276
+ {
3277
+ variant: "ghost",
3278
+ label,
3279
+ withTooltip: false,
3280
+ onClick: (event) => {
3281
+ event.stopPropagation();
3282
+ onOpen(event.currentTarget);
3283
+ },
3284
+ onKeyDown: stopCellKeys,
3285
+ "data-event-details": "",
3286
+ children: /* @__PURE__ */ jsx(Eye, {})
3287
+ }
3288
+ );
3289
+ const ActivityEntry = ({ row }) => {
3290
+ const t = useT$3();
3291
+ const path = getEntryPath(row);
3292
+ const name = row.entry?.count !== null && row.entry?.count !== void 0 ? t("adminPanel.activity.entries", "{count, plural, one {# entry} other {# entries}}", {
3293
+ count: row.entry.count
3294
+ }) : row.entry?.title || row.entry?.documentId || row.contentType?.name || "";
3295
+ if (!name) return /* @__PURE__ */ jsx(MissingValue, { variant: "omega" });
3296
+ if (!path) {
3297
+ return /* @__PURE__ */ jsx(BreakAnywhere, { variant: "omega", textColor: "neutral800", children: name });
3298
+ }
3299
+ return /* @__PURE__ */ jsx(
3300
+ TargetLink$1,
3301
+ {
3302
+ tag: Link$1,
3303
+ to: path,
3304
+ onClick: (event) => event.stopPropagation(),
3305
+ onKeyDown: stopCellKeys,
3306
+ "aria-label": t("adminPanel.activity.openEntry", "Open {entry} in the Content Manager", {
3307
+ entry: name
3308
+ }),
3309
+ children: name
3310
+ }
3311
+ );
3312
+ };
3313
+ const EventDetailsModal = ({ title, items, footerAction, onClose, onCloseAutoFocus }) => {
3314
+ const t = useT$3();
3315
+ return /* @__PURE__ */ jsx(Modal.Root, { open: true, onOpenChange: (open) => open ? null : onClose(), children: /* @__PURE__ */ jsxs(Modal.Content, { onCloseAutoFocus, "aria-describedby": void 0, children: [
3316
+ /* @__PURE__ */ jsx(Modal.Header, { closeLabel: t("common.close", "Close"), children: /* @__PURE__ */ jsx(Modal.Title, { children: title }) }),
3317
+ /* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsx(Box, { background: "neutral100", hasRadius: true, padding: { initial: 4, medium: 6 }, children: /* @__PURE__ */ jsx(PropertyList, { columns: 2, items }) }) }),
3318
+ /* @__PURE__ */ jsxs(Modal.Footer, { children: [
3319
+ /* @__PURE__ */ jsx(Modal.Close, { children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", children: t("common.close", "Close") }) }),
3320
+ footerAction || null
3321
+ ] })
3322
+ ] }) });
3323
+ };
3324
+ const useEventDetails = () => {
3325
+ const [selected, setSelected] = useState(null);
3326
+ const [opener, setOpener] = useState(null);
3327
+ const [container, setContainer] = useState(null);
3328
+ return {
3329
+ selected,
3330
+ setContainer,
3331
+ open: (row, trigger) => {
3332
+ const button = trigger?.matches?.("[data-event-details]") ? trigger : trigger?.querySelector?.("[data-event-details]");
3333
+ setOpener(button || null);
3334
+ setSelected(row);
3335
+ },
3336
+ close: () => setSelected(null),
3337
+ onCloseAutoFocus: (event) => restoreDialogFocus(event, opener, container)
3338
+ };
3339
+ };
3340
+ const signInDetails = (t, formatDate, row) => {
3341
+ const presentation = getSignInEventPresentation(row);
3342
+ const label = t(presentation.label.messageId, presentation.label.defaultMessage);
3343
+ const state = getSessionStatePresentation(row.session);
3344
+ const revoked = presentation.key === "revoked";
3345
+ const adminName = row.admin?.name || noAdminText(t, row);
3346
+ const items = [
3347
+ {
3348
+ id: "event",
3349
+ label: t("adminPanel.activity.column.event", "Event"),
3350
+ render: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 1, children: [
3351
+ /* @__PURE__ */ jsx(EventBadge, { presentation }),
3352
+ presentation.detail ? /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: t(presentation.detail.messageId, presentation.detail.defaultMessage) }) : null
3353
+ ] })
3354
+ },
3355
+ {
3356
+ id: "time",
3357
+ label: t("adminPanel.activity.details.exactTime", "Exact time"),
3358
+ value: row.at ? formatDate(row.at, FULL_DATE) : null
3359
+ },
3360
+ { id: "admin", label: t("adminPanel.activity.column.admin", "Admin"), value: adminName }
3361
+ ];
3362
+ if (revoked) {
3363
+ items.push(
3364
+ {
3365
+ id: "actor",
3366
+ label: t("adminPanel.activity.column.doneBy", "Done by"),
3367
+ value: row.actor?.name || null
3368
+ },
3369
+ {
3370
+ id: "scope",
3371
+ label: t("adminPanel.activity.details.signedOutOf", "Signed out of"),
3372
+ value: Number.isInteger(row.sessionsEnded) && row.sessionsEnded >= 0 ? t(
3373
+ "adminPanel.activity.details.scopeCount",
3374
+ "{scope} ({count, plural, =0 {no open session} one {# session ended} other {# sessions ended}})",
3375
+ {
3376
+ scope: t(presentation.detail.messageId, presentation.detail.defaultMessage),
3377
+ count: row.sessionsEnded
3378
+ }
3379
+ ) : t(presentation.detail.messageId, presentation.detail.defaultMessage)
3380
+ }
2883
3381
  );
2884
3382
  }
2885
- const place = [row.location?.city, row.location?.country].filter(Boolean).join(", ");
2886
- if (place) facts.push(place);
2887
- if (row.browser && row.os) {
2888
- facts.push(
2889
- t("adminPanel.activity.browserOnOs", "{browser} on {os}", {
2890
- browser: row.browser,
2891
- os: row.os
2892
- })
3383
+ if (state) {
3384
+ const endedAt = toValidDate(row.session?.endedAt);
3385
+ items.push({
3386
+ id: "session",
3387
+ label: t("adminPanel.activity.column.session", "Session"),
3388
+ value: [
3389
+ t(state.label.messageId, state.label.defaultMessage),
3390
+ endedAt ? formatDate(endedAt, SHORT_DATE) : "",
3391
+ row.session?.endedBy?.name ? t("adminPanel.activity.byAdmin", "by {name}", { name: row.session.endedBy.name }) : ""
3392
+ ].filter(Boolean).join(" · ")
3393
+ });
3394
+ }
3395
+ if (row.change) {
3396
+ const lines = changedSettingsLines(t, row.change.keys);
3397
+ items.push({
3398
+ id: "settings",
3399
+ label: t("adminPanel.activity.details.changedSettings", "Changed settings"),
3400
+ ...lines.length ? {
3401
+ render: /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "flex-start", gap: 1, "data-changed-settings": "", children: lines.map((line) => /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", children: line }, line)) })
3402
+ } : { value: null },
3403
+ fullWidth: true
3404
+ });
3405
+ }
3406
+ if (row.purge) {
3407
+ items.push(
3408
+ {
3409
+ id: "purged",
3410
+ label: t("adminPanel.activity.details.deleted", "Deleted events"),
3411
+ value: Number.isInteger(row.purge.count) ? row.purge.count : null
3412
+ },
3413
+ {
3414
+ id: "retention",
3415
+ label: t("adminPanel.activity.details.retention", "Kept for"),
3416
+ value: Number.isInteger(row.purge.retentionDays) ? t("adminPanel.duration.days", "{count, plural, one {# day} other {# days}}", {
3417
+ count: row.purge.retentionDays
3418
+ }) : null
3419
+ }
2893
3420
  );
2894
- } else if (row.browser || row.os) {
2895
- facts.push(row.browser || row.os);
2896
3421
  }
2897
- if (row.actor)
2898
- facts.push(t("adminPanel.activity.byAdmin", "by {name}", { name: row.actor.name }));
2899
3422
  if (Number.isInteger(row.attempts) && row.attempts > 1) {
2900
- facts.push(
2901
- t(
2902
- "adminPanel.activity.attempts",
2903
- "{count, plural, one {# attempt} other {# attempts}} within 5 minutes",
2904
- { count: row.attempts }
2905
- )
2906
- );
3423
+ items.push({
3424
+ id: "attempts",
3425
+ label: t("adminPanel.activity.details.attempts", "Attempts"),
3426
+ value: row.attempts
3427
+ });
2907
3428
  }
2908
- return /* @__PURE__ */ jsxs(EventItem, { id: row.id, kind: event.key, children: [
2909
- /* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", alignItems: "center", justifyContent: "space-between", children: [
2910
- /* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", alignItems: "center", minWidth: 0, children: [
2911
- /* @__PURE__ */ jsx(Badge, { ...getBadgeColors(event.tone), children: t(event.label.messageId, event.label.defaultMessage) }),
2912
- showAdmin ? /* @__PURE__ */ jsx(AdminName, { admin: row.admin, onOpenAdmin }) : null,
2913
- event.detail ? /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: t(event.detail.messageId, event.detail.defaultMessage) }) : null
2914
- ] }),
2915
- /* @__PURE__ */ jsx(LastActive, { value: row.at })
2916
- ] }),
2917
- facts.length ? /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", style: { overflowWrap: "anywhere" }, children: facts.join(" · ") }) : null,
2918
- session ? /* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", alignItems: "center", children: [
2919
- /* @__PURE__ */ jsx(Badge, { ...getBadgeColors(session.tone), children: t(session.label.messageId, session.label.defaultMessage) }),
2920
- row.session?.endedAt ? /* @__PURE__ */ jsx(LastActive, { value: row.session.endedAt }) : null
2921
- ] }) : null
2922
- ] });
3429
+ items.push(
3430
+ {
3431
+ id: "ip",
3432
+ label: t("adminPanel.activity.details.ip", "IP address"),
3433
+ value: ipText(t, row) || null,
3434
+ kind: "id"
3435
+ },
3436
+ {
3437
+ id: "place",
3438
+ label: t("adminPanel.activity.details.location", "Location"),
3439
+ value: getEventPlace(row) || null
3440
+ },
3441
+ {
3442
+ id: "browser",
3443
+ label: t("adminPanel.activity.details.browser", "Browser"),
3444
+ value: row.browser || null
3445
+ },
3446
+ {
3447
+ id: "os",
3448
+ label: t("adminPanel.activity.details.os", "Operating system"),
3449
+ value: row.os || null
3450
+ },
3451
+ {
3452
+ id: "userAgent",
3453
+ label: t("adminPanel.activity.details.userAgent", "User agent"),
3454
+ value: row.userAgent || null,
3455
+ kind: "id",
3456
+ fullWidth: true
3457
+ },
3458
+ {
3459
+ id: "eventId",
3460
+ label: t("adminPanel.activity.details.eventId", "Event ID"),
3461
+ value: row.id,
3462
+ kind: "id"
3463
+ }
3464
+ );
3465
+ const title = row.admin?.name ? t("adminPanel.activity.details.title", "{event}: {name}", { event: label, name: adminName }) : label;
3466
+ const logEvent = ["settings", "log-read", "purged"].includes(presentation.key);
3467
+ const deviceFields = /* @__PURE__ */ new Set(["ip", "place", "browser", "os", "userAgent"]);
3468
+ return {
3469
+ title,
3470
+ items: logEvent ? items.filter(
3471
+ (item) => !deviceFields.has(item.id) || item.value !== null && item.value !== ""
3472
+ ) : items
3473
+ };
2923
3474
  };
2924
- const ActivityEventRow = ({ row, showAdmin = false, onOpenAdmin }) => {
2925
- const t = useT$2();
3475
+ const activityDetails = (t, formatDate, row) => {
2926
3476
  const label = ACTIVITY_ACTION_LABELS[row.action] || ACTIVITY_ACTION_LABELS.view;
2927
- const path = getEntryPath(row);
2928
- const entryName = row.entry?.count !== null && row.entry?.count !== void 0 ? t("adminPanel.activity.entries", "{count, plural, one {# entry} other {# entries}}", {
2929
- count: row.entry.count
2930
- }) : row.entry?.title || row.entry?.documentId || row.contentType?.name || "";
2931
- const facts = [row.contentType?.name];
2932
- if (row.entry?.locale) facts.push(row.entry.locale);
2933
- return /* @__PURE__ */ jsxs(EventItem, { id: row.id, kind: row.action, children: [
2934
- /* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", alignItems: "center", justifyContent: "space-between", children: [
2935
- /* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", alignItems: "center", minWidth: 0, children: [
2936
- /* @__PURE__ */ jsx(Badge, { ...getBadgeColors(getActivityTone(row.action)), children: t(label.messageId, label.defaultMessage) }),
2937
- showAdmin ? /* @__PURE__ */ jsx(AdminName, { admin: row.admin, onOpenAdmin }) : null
2938
- ] }),
2939
- /* @__PURE__ */ jsx(LastActive, { value: row.at })
2940
- ] }),
2941
- /* @__PURE__ */ jsx(Box, { minWidth: 0, style: { overflowWrap: "anywhere" }, children: path ? /* @__PURE__ */ jsx(
2942
- TargetLink$1,
3477
+ const action = t(label.messageId, label.defaultMessage);
3478
+ return {
3479
+ title: row.entry?.title ? t("adminPanel.activity.details.title", "{event}: {name}", {
3480
+ event: action,
3481
+ name: row.entry.title
3482
+ }) : action,
3483
+ items: [
2943
3484
  {
2944
- tag: Link$1,
2945
- to: path,
2946
- "aria-label": t("adminPanel.activity.openEntry", "Open {entry} in the Content Manager", {
2947
- entry: entryName
2948
- }),
2949
- children: entryName
3485
+ id: "action",
3486
+ label: t("adminPanel.activity.column.action", "Action"),
3487
+ render: /* @__PURE__ */ jsx(Badge, { ...getBadgeColors(getActivityTone(row.action)), children: action })
3488
+ },
3489
+ {
3490
+ id: "time",
3491
+ label: t("adminPanel.activity.details.exactTime", "Exact time"),
3492
+ value: row.at ? formatDate(row.at, FULL_DATE) : null
3493
+ },
3494
+ {
3495
+ id: "entry",
3496
+ label: t("adminPanel.activity.column.entry", "Entry"),
3497
+ render: /* @__PURE__ */ jsx(ActivityEntry, { row })
3498
+ },
3499
+ {
3500
+ id: "admin",
3501
+ label: t("adminPanel.activity.column.admin", "Admin"),
3502
+ value: row.admin?.name || null
3503
+ },
3504
+ {
3505
+ id: "type",
3506
+ label: t("adminPanel.activity.column.contentType", "Content type"),
3507
+ value: row.contentType?.name || null
3508
+ },
3509
+ {
3510
+ id: "uid",
3511
+ label: t("adminPanel.activity.details.uid", "Content type UID"),
3512
+ value: row.contentType?.uid || null,
3513
+ kind: "id"
3514
+ },
3515
+ {
3516
+ id: "documentId",
3517
+ label: t("adminPanel.activity.details.documentId", "Document ID"),
3518
+ value: row.entry?.documentId || null,
3519
+ kind: "id"
3520
+ },
3521
+ {
3522
+ id: "locale",
3523
+ label: t("adminPanel.activity.details.locale", "Locale"),
3524
+ value: row.entry?.locale || null
3525
+ },
3526
+ {
3527
+ id: "eventId",
3528
+ label: t("adminPanel.activity.details.eventId", "Event ID"),
3529
+ value: row.id,
3530
+ kind: "id"
2950
3531
  }
2951
- ) : /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", children: entryName }) }),
2952
- /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: facts.filter(Boolean).join(" · ") })
3532
+ ]
3533
+ };
3534
+ };
3535
+ const SignInEventTable = ({
3536
+ rows,
3537
+ label,
3538
+ showAdmin = false,
3539
+ onOpenAdmin,
3540
+ detailsAction,
3541
+ busy = false
3542
+ }) => {
3543
+ const t = useT$3();
3544
+ const { formatDate, formatRelativeTime } = useSessionFormatters();
3545
+ const [measureRef, width] = useElementWidth();
3546
+ const {
3547
+ selected,
3548
+ open: openDetails,
3549
+ close: closeDetails,
3550
+ onCloseAutoFocus,
3551
+ setContainer
3552
+ } = useEventDetails();
3553
+ const layout = getEventListLayout(width, { showAdmin });
3554
+ const showDoneBy = layout === "full";
3555
+ const detailsLabel = (row, presentation) => t("adminPanel.activity.details.open", "Details of {event}, {time}", {
3556
+ event: t(presentation.label.messageId, presentation.label.defaultMessage),
3557
+ time: formatRelativeTime(row.at)
3558
+ });
3559
+ let list;
3560
+ if (layout === "stacked") {
3561
+ list = /* @__PURE__ */ jsx(StackedList, { "aria-label": label, "data-event-list": "stacked", children: rows.map((row) => {
3562
+ const presentation = getSignInEventPresentation(row);
3563
+ const state = getSessionStatePresentation(row.session);
3564
+ const second = [
3565
+ eventDetailText(t, row, presentation, true),
3566
+ ipText(t, row),
3567
+ getEventPlace(row),
3568
+ deviceText(t, row),
3569
+ state ? t(state.label.messageId, state.label.defaultMessage) : ""
3570
+ ].filter(Boolean).join(" · ");
3571
+ return /* @__PURE__ */ jsx(
3572
+ StackedItem,
3573
+ {
3574
+ "data-event-row": presentation.key,
3575
+ "data-event-id": row.id,
3576
+ onClick: (event) => openDetails(row, event.currentTarget),
3577
+ children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, padding: 3, minWidth: 0, children: [
3578
+ /* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", alignItems: "center", minWidth: 0, children: [
3579
+ /* @__PURE__ */ jsx(EventBadge, { presentation }),
3580
+ /* @__PURE__ */ jsxs(Flex, { gap: 1, alignItems: "center", marginLeft: "auto", children: [
3581
+ /* @__PURE__ */ jsx(EventTime, { value: row.at, compact: true }),
3582
+ /* @__PURE__ */ jsx(
3583
+ DetailsButton,
3584
+ {
3585
+ label: detailsLabel(row, presentation),
3586
+ onOpen: (trigger) => openDetails(row, trigger)
3587
+ }
3588
+ )
3589
+ ] })
3590
+ ] }),
3591
+ showAdmin ? /* @__PURE__ */ jsx(Flex, { minWidth: 0, children: /* @__PURE__ */ jsx(AdminName, { admin: row.admin, row, onOpenAdmin }) }) : null,
3592
+ second ? /* @__PURE__ */ jsx(BreakAnywhere, { variant: "pi", textColor: "neutral600", children: second }) : null
3593
+ ] })
3594
+ },
3595
+ row.id
3596
+ );
3597
+ }) });
3598
+ } else {
3599
+ const colCount = 5 + (showAdmin ? 1 : 0) + (showDoneBy ? 1 : 0);
3600
+ list = /* @__PURE__ */ jsx(Box, { background: "neutral0", hasRadius: true, shadow: "tableShadow", "data-event-list": layout, children: /* @__PURE__ */ jsxs(Table, { colCount, rowCount: rows.length + 1, "aria-label": label, "aria-busy": busy, children: [
3601
+ /* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
3602
+ /* @__PURE__ */ jsx(HeaderCell, { children: t("adminPanel.activity.column.time", "Time") }),
3603
+ /* @__PURE__ */ jsx(HeaderCell, { children: t("adminPanel.activity.column.event", "Event") }),
3604
+ showAdmin ? /* @__PURE__ */ jsx(HeaderCell, { children: t("adminPanel.activity.column.admin", "Admin") }) : null,
3605
+ /* @__PURE__ */ jsx(HeaderCell, { children: t("adminPanel.activity.column.details", "IP address and device") }),
3606
+ /* @__PURE__ */ jsx(HeaderCell, { children: t("adminPanel.activity.column.session", "Session") }),
3607
+ showDoneBy ? /* @__PURE__ */ jsx(HeaderCell, { children: t("adminPanel.activity.column.doneBy", "Done by") }) : null,
3608
+ /* @__PURE__ */ jsx(HeaderCell, { hidden: true, children: t("adminPanel.table.actions", "Actions") })
3609
+ ] }) }),
3610
+ /* @__PURE__ */ jsx(Tbody, { children: rows.map((row) => {
3611
+ const presentation = getSignInEventPresentation(row);
3612
+ const eventDetail = eventDetailText(t, row, presentation, !showDoneBy);
3613
+ return /* @__PURE__ */ jsxs(
3614
+ ClickableRow,
3615
+ {
3616
+ "data-event-row": presentation.key,
3617
+ "data-event-id": row.id,
3618
+ onClick: (event) => openDetails(row, event.currentTarget),
3619
+ children: [
3620
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(EventTime, { value: row.at }) }),
3621
+ /* @__PURE__ */ jsx(WrapCell, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, children: [
3622
+ /* @__PURE__ */ jsx(EventBadge, { presentation, nowrap: true }),
3623
+ eventDetail ? /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: eventDetail }) : null
3624
+ ] }) }),
3625
+ showAdmin ? /* @__PURE__ */ jsx(WrapCell, { children: /* @__PURE__ */ jsx(AdminName, { admin: row.admin, row, onOpenAdmin }) }) : null,
3626
+ /* @__PURE__ */ jsx(WrapCell, { children: /* @__PURE__ */ jsx(SignInDetails, { row }) }),
3627
+ /* @__PURE__ */ jsx(WrapCell, { children: /* @__PURE__ */ jsx(SessionState, { row }) }),
3628
+ showDoneBy ? /* @__PURE__ */ jsx(WrapCell, { children: row.actor?.name ? /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", children: row.actor.name }) : /* @__PURE__ */ jsx(MissingValue, { variant: "omega" }) }) : null,
3629
+ /* @__PURE__ */ jsx(Td, { onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", gap: 1, onKeyDown: stopCellKeys, children: /* @__PURE__ */ jsx(
3630
+ DetailsButton,
3631
+ {
3632
+ label: detailsLabel(row, presentation),
3633
+ onOpen: (trigger) => openDetails(row, trigger)
3634
+ }
3635
+ ) }) })
3636
+ ]
3637
+ },
3638
+ row.id
3639
+ );
3640
+ }) })
3641
+ ] }) });
3642
+ }
3643
+ const content = selected ? signInDetails(t, formatDate, selected) : null;
3644
+ return /* @__PURE__ */ jsxs(Box, { ref: measureRef, minWidth: 0, width: "100%", children: [
3645
+ /* @__PURE__ */ jsx(Box, { ref: setContainer, tabIndex: -1, minWidth: 0, children: list }),
3646
+ content ? /* @__PURE__ */ jsx(
3647
+ EventDetailsModal,
3648
+ {
3649
+ title: content.title,
3650
+ items: content.items,
3651
+ footerAction: detailsAction ? detailsAction(selected, closeDetails) : null,
3652
+ onClose: closeDetails,
3653
+ onCloseAutoFocus
3654
+ }
3655
+ ) : null
3656
+ ] });
3657
+ };
3658
+ const ActivityEventTable = ({ rows, label, showAdmin = false, busy = false }) => {
3659
+ const t = useT$3();
3660
+ const { formatDate, formatRelativeTime } = useSessionFormatters();
3661
+ const [measureRef, width] = useElementWidth();
3662
+ const {
3663
+ selected,
3664
+ open: openDetails,
3665
+ close: closeDetails,
3666
+ onCloseAutoFocus,
3667
+ setContainer
3668
+ } = useEventDetails();
3669
+ const layout = getEventListLayout(width, { showAdmin });
3670
+ const actionOf = (row) => {
3671
+ const entry = ACTIVITY_ACTION_LABELS[row.action] || ACTIVITY_ACTION_LABELS.view;
3672
+ return t(entry.messageId, entry.defaultMessage);
3673
+ };
3674
+ const detailsLabel = (row) => t("adminPanel.activity.details.open", "Details of {event}, {time}", {
3675
+ event: actionOf(row),
3676
+ time: formatRelativeTime(row.at)
3677
+ });
3678
+ const badge = (row) => /* @__PURE__ */ jsx(
3679
+ Badge,
3680
+ {
3681
+ ...getBadgeColors(getActivityTone(row.action)),
3682
+ "data-event-tone": getActivityTone(row.action),
3683
+ children: actionOf(row)
3684
+ }
3685
+ );
3686
+ let list;
3687
+ if (layout === "stacked") {
3688
+ list = /* @__PURE__ */ jsx(StackedList, { "aria-label": label, "data-event-list": "stacked", children: rows.map((row) => /* @__PURE__ */ jsx(
3689
+ StackedItem,
3690
+ {
3691
+ "data-event-row": row.action,
3692
+ "data-event-id": row.id,
3693
+ onClick: (event) => openDetails(row, event.currentTarget),
3694
+ children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, padding: 3, minWidth: 0, children: [
3695
+ /* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", alignItems: "center", minWidth: 0, children: [
3696
+ badge(row),
3697
+ /* @__PURE__ */ jsxs(Flex, { gap: 1, alignItems: "center", marginLeft: "auto", children: [
3698
+ /* @__PURE__ */ jsx(EventTime, { value: row.at, compact: true }),
3699
+ /* @__PURE__ */ jsx(
3700
+ DetailsButton,
3701
+ {
3702
+ label: detailsLabel(row),
3703
+ onOpen: (trigger) => openDetails(row, trigger)
3704
+ }
3705
+ )
3706
+ ] })
3707
+ ] }),
3708
+ /* @__PURE__ */ jsx(Flex, { minWidth: 0, children: /* @__PURE__ */ jsx(ActivityEntry, { row }) }),
3709
+ contentTypeText(row) || showAdmin && row.admin?.name ? /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: [contentTypeText(row), showAdmin ? row.admin?.name : ""].filter(Boolean).join(" · ") }) : null
3710
+ ] })
3711
+ },
3712
+ row.id
3713
+ )) });
3714
+ } else {
3715
+ const colCount = 5 + (showAdmin ? 1 : 0);
3716
+ list = /* @__PURE__ */ jsx(Box, { background: "neutral0", hasRadius: true, shadow: "tableShadow", "data-event-list": layout, children: /* @__PURE__ */ jsxs(Table, { colCount, rowCount: rows.length + 1, "aria-label": label, "aria-busy": busy, children: [
3717
+ /* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
3718
+ /* @__PURE__ */ jsx(HeaderCell, { children: t("adminPanel.activity.column.time", "Time") }),
3719
+ /* @__PURE__ */ jsx(HeaderCell, { children: t("adminPanel.activity.column.action", "Action") }),
3720
+ /* @__PURE__ */ jsx(HeaderCell, { children: t("adminPanel.activity.column.entry", "Entry") }),
3721
+ /* @__PURE__ */ jsx(HeaderCell, { children: t("adminPanel.activity.column.contentType", "Content type") }),
3722
+ showAdmin ? /* @__PURE__ */ jsx(HeaderCell, { children: t("adminPanel.activity.column.admin", "Admin") }) : null,
3723
+ /* @__PURE__ */ jsx(HeaderCell, { hidden: true, children: t("adminPanel.table.actions", "Actions") })
3724
+ ] }) }),
3725
+ /* @__PURE__ */ jsx(Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxs(
3726
+ ClickableRow,
3727
+ {
3728
+ "data-event-row": row.action,
3729
+ "data-event-id": row.id,
3730
+ onClick: (event) => openDetails(row, event.currentTarget),
3731
+ children: [
3732
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(EventTime, { value: row.at }) }),
3733
+ /* @__PURE__ */ jsx(Td, { children: badge(row) }),
3734
+ /* @__PURE__ */ jsx(WrapCell, { children: /* @__PURE__ */ jsx(ActivityEntry, { row }) }),
3735
+ /* @__PURE__ */ jsx(WrapCell, { children: contentTypeText(row) ? /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", children: contentTypeText(row) }) : /* @__PURE__ */ jsx(MissingValue, { variant: "omega" }) }),
3736
+ showAdmin ? /* @__PURE__ */ jsx(WrapCell, { children: /* @__PURE__ */ jsx(AdminName, { admin: row.admin }) }) : null,
3737
+ /* @__PURE__ */ jsx(Td, { onClick: (event) => event.stopPropagation(), children: /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", gap: 1, onKeyDown: stopCellKeys, children: /* @__PURE__ */ jsx(
3738
+ DetailsButton,
3739
+ {
3740
+ label: detailsLabel(row),
3741
+ onOpen: (trigger) => openDetails(row, trigger)
3742
+ }
3743
+ ) }) })
3744
+ ]
3745
+ },
3746
+ row.id
3747
+ )) })
3748
+ ] }) });
3749
+ }
3750
+ const content = selected ? activityDetails(t, formatDate, selected) : null;
3751
+ return /* @__PURE__ */ jsxs(Box, { ref: measureRef, minWidth: 0, width: "100%", children: [
3752
+ /* @__PURE__ */ jsx(Box, { ref: setContainer, tabIndex: -1, minWidth: 0, children: list }),
3753
+ content ? /* @__PURE__ */ jsx(
3754
+ EventDetailsModal,
3755
+ {
3756
+ title: content.title,
3757
+ items: content.items,
3758
+ onClose: closeDetails,
3759
+ onCloseAutoFocus
3760
+ }
3761
+ ) : null
2953
3762
  ] });
2954
3763
  };
2955
3764
  function useEventList({ path, params, logKey }) {
@@ -2978,18 +3787,19 @@ function useEventList({ path, params, logKey }) {
2978
3787
  const [error, setError] = useState(false);
2979
3788
  const requestRef = useRef(0);
2980
3789
  const key = JSON.stringify(params);
3790
+ const firstPage = Number(params?.page) > 0 ? Number(params.page) : 1;
2981
3791
  const load = useCallback(
2982
3792
  async (nextPage) => {
2983
3793
  const requestId = requestRef.current + 1;
2984
3794
  requestRef.current = requestId;
2985
- if (nextPage === 1) setLoading(true);
3795
+ if (nextPage === firstPage) setLoading(true);
2986
3796
  else setLoadingMore(true);
2987
3797
  try {
2988
3798
  const response = await get(path, { params: { ...JSON.parse(key), page: nextPage } });
2989
3799
  if (requestId !== requestRef.current) return;
2990
3800
  const body = response?.data || {};
2991
3801
  const data = fillNames(Array.isArray(body.data) ? body.data : []);
2992
- setRows((current) => nextPage === 1 ? data : [...current, ...data]);
3802
+ setRows((current) => nextPage === firstPage ? data : [...current, ...data]);
2993
3803
  setMeta(body.meta || null);
2994
3804
  setPage(nextPage);
2995
3805
  setError(false);
@@ -3004,14 +3814,14 @@ function useEventList({ path, params, logKey }) {
3004
3814
  }
3005
3815
  }
3006
3816
  },
3007
- [get, path, key, logKey, fillNames]
3817
+ [get, path, key, logKey, fillNames, firstPage]
3008
3818
  );
3009
3819
  useEffect(() => {
3010
- load(1);
3820
+ load(firstPage);
3011
3821
  return () => {
3012
3822
  requestRef.current += 1;
3013
3823
  };
3014
- }, [load]);
3824
+ }, [load, firstPage]);
3015
3825
  const pagination = meta?.pagination;
3016
3826
  const hasMore = Boolean(pagination && page < pagination.pageCount);
3017
3827
  const exportAll = useCallback(async () => {
@@ -3039,7 +3849,7 @@ function useEventList({ path, params, logKey }) {
3039
3849
  error,
3040
3850
  hasMore,
3041
3851
  loadMore: () => load(page + 1),
3042
- reload: () => load(1),
3852
+ reload: () => load(firstPage),
3043
3853
  exportAll
3044
3854
  };
3045
3855
  }
@@ -3053,12 +3863,13 @@ function downloadCsv(content, name) {
3053
3863
  window.setTimeout(() => URL.revokeObjectURL(url), 0);
3054
3864
  }
3055
3865
  const ADMIN_ACTIVITY_SETTINGS_PATH = `/settings/${pluginId}/general?tab=admin-activity`;
3056
- const useT$1 = () => {
3866
+ const ADMIN_ACTIVITY_PAGE_PATH = `/plugins/${pluginId}/admin-panel/activity`;
3867
+ const useT$2 = () => {
3057
3868
  const { formatMessage } = useIntl();
3058
3869
  return (id, defaultMessage, values) => formatMessage({ id: getTranslation(id), defaultMessage }, values);
3059
3870
  };
3060
3871
  const PeriodSelect = ({ value, onChange }) => {
3061
- const t = useT$1();
3872
+ const t = useT$2();
3062
3873
  const labels = {
3063
3874
  1: t("adminPanel.activity.period.day", "Last 24 hours"),
3064
3875
  7: t("adminPanel.activity.period.week", "Last 7 days"),
@@ -3078,18 +3889,19 @@ const PeriodSelect = ({ value, onChange }) => {
3078
3889
  );
3079
3890
  };
3080
3891
  const FilterSlot = ({ children }) => /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", minWidth: 0, flex: "1 1 18rem", children });
3892
+ const EmptyText = ({ children }) => /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral600", "data-event-empty": "", children });
3081
3893
  const EventList = ({
3082
3894
  filters,
3083
3895
  notice,
3084
3896
  list,
3085
- listLabel,
3086
- emptyText,
3087
- renderRow,
3897
+ empty,
3898
+ renderList,
3088
3899
  toCsv: toCsv2,
3089
3900
  fileName,
3090
- exportLabel
3901
+ exportLabel,
3902
+ footer
3091
3903
  }) => {
3092
- const t = useT$1();
3904
+ const t = useT$2();
3093
3905
  const { toggleNotification } = useNotification();
3094
3906
  const [exporting, setExporting] = useState(false);
3095
3907
  const total = list.meta?.pagination?.total ?? 0;
@@ -3147,24 +3959,13 @@ const EventList = ({
3147
3959
  children: t("adminPanel.activity.error", "The events could not be loaded.")
3148
3960
  }
3149
3961
  ) : null,
3150
- !list.loading && !list.error && list.rows.length === 0 ? /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral600", "data-event-empty": "", children: emptyText }) : null,
3151
- list.rows.length > 0 ? /* @__PURE__ */ jsx(
3152
- Flex,
3153
- {
3154
- tag: "ul",
3155
- direction: "column",
3156
- alignItems: "stretch",
3157
- gap: 2,
3158
- width: "100%",
3159
- "aria-label": listLabel,
3160
- children: list.rows.map((row) => renderRow(row))
3161
- }
3162
- ) : null,
3163
- list.hasMore ? /* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: list.loadMore, loading: list.loadingMore, children: t("adminPanel.activity.showMore", "Show more") }) }) : null
3962
+ !list.loading && !list.error && list.rows.length === 0 ? empty : null,
3963
+ list.rows.length > 0 ? renderList(list.rows) : null,
3964
+ footer !== void 0 ? list.rows.length > 0 ? footer : null : list.hasMore ? /* @__PURE__ */ jsx(Flex, { justifyContent: "center", children: /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: list.loadMore, loading: list.loadingMore, children: t("adminPanel.activity.showMore", "Show more") }) }) : null
3164
3965
  ] });
3165
3966
  };
3166
3967
  const RecordingOff = ({ children }) => {
3167
- const t = useT$1();
3968
+ const t = useT$2();
3168
3969
  return /* @__PURE__ */ jsx(
3169
3970
  PersistentAlert,
3170
3971
  {
@@ -3175,7 +3976,7 @@ const RecordingOff = ({ children }) => {
3175
3976
  );
3176
3977
  };
3177
3978
  const SignInHistoryPanel = ({ admin }) => {
3178
- const t = useT$1();
3979
+ const t = useT$2();
3179
3980
  const [event, setEvent] = useState("all");
3180
3981
  const [period, setPeriod] = useState("30");
3181
3982
  const params = useMemo(
@@ -3215,11 +4016,17 @@ const SignInHistoryPanel = ({ admin }) => {
3215
4016
  "adminPanel.activity.signIns.off",
3216
4017
  "Sign-in history is turned off. New sign-ins are not recorded."
3217
4018
  ) }) : null,
3218
- listLabel: t("adminPanel.activity.signIns.listLabel", "Sign-in history of {name}", {
3219
- name: admin.name
3220
- }),
3221
- emptyText: t("adminPanel.activity.signIns.empty", "No sign-in events in this period."),
3222
- renderRow: (row) => /* @__PURE__ */ jsx(SignInEventRow, { row }, row.id),
4019
+ empty: /* @__PURE__ */ jsx(EmptyText, { children: t("adminPanel.activity.signIns.empty", "No sign-in events in this period.") }),
4020
+ renderList: (rows) => /* @__PURE__ */ jsx(
4021
+ SignInEventTable,
4022
+ {
4023
+ rows,
4024
+ busy: list.loading,
4025
+ label: t("adminPanel.activity.signIns.listLabel", "Sign-in history of {name}", {
4026
+ name: admin.name
4027
+ })
4028
+ }
4029
+ ),
3223
4030
  toCsv: buildSignInCsv,
3224
4031
  fileName: "admin-sign-in-history",
3225
4032
  exportLabel: t(
@@ -3233,7 +4040,7 @@ const SignInHistoryPanel = ({ admin }) => {
3233
4040
  );
3234
4041
  };
3235
4042
  const ContentActivityPanel = ({ admin }) => {
3236
- const t = useT$1();
4043
+ const t = useT$2();
3237
4044
  const [action, setAction] = useState("all");
3238
4045
  const [contentType, setContentType] = useState("all");
3239
4046
  const [period, setPeriod] = useState("30");
@@ -3296,14 +4103,17 @@ const ContentActivityPanel = ({ admin }) => {
3296
4103
  /* @__PURE__ */ jsx(FilterSlot, { children: /* @__PURE__ */ jsx(PeriodSelect, { value: period, onChange: setPeriod }) })
3297
4104
  ] }),
3298
4105
  notice,
3299
- listLabel: t("adminPanel.activity.content.listLabel", "Content Manager activity of {name}", {
3300
- name: admin.name
3301
- }),
3302
- emptyText: t(
3303
- "adminPanel.activity.content.empty",
3304
- "No Content Manager activity in this period."
4106
+ empty: /* @__PURE__ */ jsx(EmptyText, { children: t("adminPanel.activity.content.empty", "No Content Manager activity in this period.") }),
4107
+ renderList: (rows) => /* @__PURE__ */ jsx(
4108
+ ActivityEventTable,
4109
+ {
4110
+ rows,
4111
+ busy: list.loading,
4112
+ label: t("adminPanel.activity.content.listLabel", "Content Manager activity of {name}", {
4113
+ name: admin.name
4114
+ })
4115
+ }
3305
4116
  ),
3306
- renderRow: (row) => /* @__PURE__ */ jsx(ActivityEventRow, { row }, row.id),
3307
4117
  toCsv: buildActivityCsv,
3308
4118
  fileName: "admin-content-activity",
3309
4119
  exportLabel: t(
@@ -3315,24 +4125,48 @@ const ContentActivityPanel = ({ admin }) => {
3315
4125
  );
3316
4126
  };
3317
4127
  const RecentSignInActivity = ({ onOpenAdmin }) => {
3318
- const t = useT$1();
3319
- const params = useMemo(() => buildSignInParams({ pageSize: 5 }), []);
4128
+ const t = useT$2();
4129
+ const headingId = `recent-sign-in-activity-${useId().replace(/:/g, "")}`;
4130
+ const params = useMemo(() => buildSignInParams({ pageSize: RECENT_EVENT_LIMIT }), []);
3320
4131
  const list = useEventList({
3321
4132
  path: `/${pluginId}/admin-activity/sign-ins`,
3322
4133
  params,
3323
4134
  logKey: "adminPanel.activity.recent"
3324
4135
  });
3325
4136
  if (list.meta?.recording && !list.meta.recording.signIns) return null;
4137
+ const title = t("adminPanel.activity.recent.title", "Recent security activity");
3326
4138
  return /* @__PURE__ */ jsxs(
3327
- SectionCard,
4139
+ Flex,
3328
4140
  {
3329
- title: t("adminPanel.activity.recent.title", "Recent sign-in activity"),
3330
- subtitle: t(
3331
- "adminPanel.activity.recent.subtitle",
3332
- "The latest sign-ins, failed attempts and sign-outs of all admins. Open an admin for their full history."
3333
- ),
4141
+ tag: "section",
4142
+ "aria-labelledby": headingId,
4143
+ direction: "column",
4144
+ alignItems: "stretch",
4145
+ gap: 4,
4146
+ minWidth: 0,
4147
+ "data-recent-activity": "",
3334
4148
  children: [
3335
- list.loading ? /* @__PURE__ */ jsx(Flex, { justifyContent: "center", padding: 2, children: /* @__PURE__ */ jsx(Loader, { small: true, children: t("adminPanel.activity.loading", "Loading events") }) }) : null,
4149
+ /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "flex-end", gap: 4, wrap: "wrap", children: [
4150
+ /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, flex: "1 1 32rem", children: [
4151
+ /* @__PURE__ */ jsx(Typography, { id: headingId, variant: "delta", tag: "h2", textColor: "neutral800", children: title }),
4152
+ /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: t(
4153
+ "adminPanel.activity.recent.subtitle",
4154
+ "The latest sign-ins, failed attempts, sign-outs and settings changes of all admins. Select an event for its details."
4155
+ ) })
4156
+ ] }),
4157
+ /* @__PURE__ */ jsx(
4158
+ LinkButton,
4159
+ {
4160
+ tag: Link$1,
4161
+ to: ADMIN_ACTIVITY_PAGE_PATH,
4162
+ variant: "tertiary",
4163
+ endIcon: /* @__PURE__ */ jsx(ArrowRight, {}),
4164
+ "data-show-all-activity": "",
4165
+ children: t("adminPanel.activity.recent.showAll", "Show all")
4166
+ }
4167
+ )
4168
+ ] }),
4169
+ list.loading && list.rows.length === 0 ? /* @__PURE__ */ jsx(Flex, { justifyContent: "center", padding: 2, children: /* @__PURE__ */ jsx(Loader, { small: true, children: t("adminPanel.activity.loading", "Loading events") }) }) : null,
3336
4170
  !list.loading && list.error ? /* @__PURE__ */ jsx(
3337
4171
  PersistentAlert,
3338
4172
  {
@@ -3341,17 +4175,15 @@ const RecentSignInActivity = ({ onOpenAdmin }) => {
3341
4175
  children: t("adminPanel.activity.error", "The events could not be loaded.")
3342
4176
  }
3343
4177
  ) : null,
3344
- !list.loading && !list.error && list.rows.length === 0 ? /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral600", children: t("adminPanel.activity.recent.empty", "No sign-in events yet.") }) : null,
4178
+ !list.loading && !list.error && list.rows.length === 0 ? /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral600", children: t("adminPanel.activity.recent.empty", "No events recorded yet.") }) : null,
3345
4179
  list.rows.length > 0 ? /* @__PURE__ */ jsx(
3346
- Flex,
4180
+ SignInEventTable,
3347
4181
  {
3348
- tag: "ul",
3349
- direction: "column",
3350
- alignItems: "stretch",
3351
- gap: 2,
3352
- width: "100%",
3353
- "aria-label": t("adminPanel.activity.recent.title", "Recent sign-in activity"),
3354
- children: list.rows.map((row) => /* @__PURE__ */ jsx(SignInEventRow, { row, showAdmin: true, onOpenAdmin }, row.id))
4182
+ rows: list.rows,
4183
+ label: title,
4184
+ showAdmin: true,
4185
+ onOpenAdmin,
4186
+ busy: list.loading
3355
4187
  }
3356
4188
  ) : null
3357
4189
  ]
@@ -3375,7 +4207,7 @@ const DialogTabLabel = styled.span`
3375
4207
  font-size: ${({ theme }) => theme.fontSizes[2]};
3376
4208
  `;
3377
4209
  const ADMIN_DIALOG_TABS = Object.freeze(["sessions", "history", "activity"]);
3378
- const useT = () => {
4210
+ const useT$1 = () => {
3379
4211
  const { formatMessage } = useIntl();
3380
4212
  return (id, defaultMessage, values) => formatMessage({ id: getTranslation(id), defaultMessage }, values);
3381
4213
  };
@@ -3385,7 +4217,7 @@ const DateValue = ({ value }) => {
3385
4217
  return /* @__PURE__ */ jsx(Typography, { tag: "time", dateTime: value, variant: "omega", textColor: "neutral800", children: formatDate(value) });
3386
4218
  };
3387
4219
  const SessionCard = ({ session, admin, canSignOut, onSignOut }) => {
3388
- const t = useT();
4220
+ const t = useT$1();
3389
4221
  const device = session.device || t("adminPanel.session.unknownDevice", "Unknown browser");
3390
4222
  return /* @__PURE__ */ jsx(
3391
4223
  Box,
@@ -3463,7 +4295,7 @@ const AdminSessionsModal = ({
3463
4295
  canViewActivity = false,
3464
4296
  initialTab = "sessions"
3465
4297
  }) => {
3466
- const t = useT();
4298
+ const t = useT$1();
3467
4299
  const [tab, setTab] = useState(ADMIN_DIALOG_TABS.includes(initialTab) ? initialTab : "sessions");
3468
4300
  const canSignOut = canRevoke && admin.account === "active" && !admin.protectedReason;
3469
4301
  const settingsPath = `/settings/users/${admin.id}`;
@@ -3571,7 +4403,7 @@ const AdminSessionsModal = ({
3571
4403
  ] }) });
3572
4404
  };
3573
4405
  const SETTINGS_USERS_PATH = "/settings/users";
3574
- const PaginationTargets = styled.div`
4406
+ const PaginationTargets$1 = styled.div`
3575
4407
  nav a {
3576
4408
  min-width: 3.2rem;
3577
4409
  }
@@ -4042,7 +4874,7 @@ const AdminPanelPage = () => {
4042
4874
  ] }),
4043
4875
  admins.length > 0 ? /* @__PURE__ */ jsxs(Fragment, { children: [
4044
4876
  isBelowMedium ? /* @__PURE__ */ jsx(AdminCardList, { ...listProps }) : /* @__PURE__ */ jsx(AdminTable, { ...listProps }),
4045
- /* @__PURE__ */ jsx(PaginationTargets, { children: /* @__PURE__ */ jsxs(
4877
+ /* @__PURE__ */ jsx(PaginationTargets$1, { children: /* @__PURE__ */ jsxs(
4046
4878
  Pagination.Root,
4047
4879
  {
4048
4880
  pageCount: pagination.pageCount,
@@ -4108,6 +4940,185 @@ const AdminPanelPage = () => {
4108
4940
  }
4109
4941
  );
4110
4942
  };
4943
+ const PaginationTargets = styled.div`
4944
+ nav a {
4945
+ min-width: 3.2rem;
4946
+ }
4947
+
4948
+ & > div {
4949
+ flex-wrap: wrap;
4950
+ gap: ${({ theme }) => theme.spaces[2]} ${({ theme }) => theme.spaces[4]};
4951
+ }
4952
+
4953
+ & > div > div > span {
4954
+ white-space: nowrap;
4955
+ }
4956
+ `;
4957
+ const useT = () => {
4958
+ const { formatMessage } = useIntl();
4959
+ return (id, defaultMessage, values) => formatMessage({ id: getTranslation(id), defaultMessage }, values);
4960
+ };
4961
+ const AdminActivityPage = () => {
4962
+ const t = useT();
4963
+ const [{ query }, setQuery] = useQueryParams();
4964
+ const view = parseActivityPageQuery(query);
4965
+ const captionRef = useRef(null);
4966
+ const params = useMemo(
4967
+ () => buildSignInParams({
4968
+ adminId: view.adminId ?? void 0,
4969
+ event: view.event,
4970
+ period: view.period,
4971
+ page: view.page,
4972
+ pageSize: view.pageSize
4973
+ }),
4974
+ [view.adminId, view.event, view.period, view.page, view.pageSize]
4975
+ );
4976
+ const list = useEventList({
4977
+ path: `/${pluginId}/admin-activity/sign-ins`,
4978
+ params,
4979
+ logKey: "adminPanel.activity.page"
4980
+ });
4981
+ const pagination = list.meta?.pagination || { pageCount: 1, total: 0 };
4982
+ useEffect(() => {
4983
+ if (!list.loading && list.meta && view.page > pagination.pageCount) {
4984
+ setQuery({ page: String(pagination.pageCount) }, "push", true);
4985
+ }
4986
+ }, [list.loading, list.meta, view.page, pagination.pageCount, setQuery]);
4987
+ const recording = list.meta?.recording;
4988
+ const filtered = hasActivityPageFilters(view);
4989
+ 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;
4990
+ const setFilters = (next) => setQuery({ ...next, page: "1" });
4991
+ const clearFilters = () => {
4992
+ setQuery({ event: void 0, period: void 0, adminId: void 0, page: "1" });
4993
+ captionRef.current?.focus();
4994
+ };
4995
+ const labels = {
4996
+ all: t("adminPanel.activity.filter.allEvents", "All events"),
4997
+ succeeded: t("adminPanel.activity.filter.succeeded", "Sign-ins"),
4998
+ failed: t("adminPanel.activity.filter.failed", "Failed and locked out"),
4999
+ "signed-out": t("adminPanel.activity.filter.signedOut", "Sign-outs"),
5000
+ changes: t("adminPanel.activity.filter.changes", "Settings and log access")
5001
+ };
5002
+ const title = t("adminPanel.activity.page.title", "Security activity");
5003
+ const total = pagination.total;
5004
+ return /* @__PURE__ */ jsx(
5005
+ PageShell,
5006
+ {
5007
+ headingId: "magic-sessionmanager-admin-activity-title",
5008
+ title,
5009
+ subtitle: t(
5010
+ "adminPanel.activity.page.subtitle",
5011
+ "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."
5012
+ ),
5013
+ navigationAction: /* @__PURE__ */ jsx(BackButton, { fallback: SESSION_VIEW_PATHS.admins }),
5014
+ children: /* @__PURE__ */ jsx(
5015
+ EventList,
5016
+ {
5017
+ list,
5018
+ filters: /* @__PURE__ */ jsxs(Fragment, { children: [
5019
+ /* @__PURE__ */ jsx(FilterSlot, { children: /* @__PURE__ */ jsx(
5020
+ SingleSelect,
5021
+ {
5022
+ size: "S",
5023
+ "aria-label": t("adminPanel.activity.filter.event", "Event"),
5024
+ value: view.event,
5025
+ onChange: (next) => setFilters({ event: String(next) === "all" ? void 0 : String(next) }),
5026
+ children: ALL_ADMINS_FILTER_OPTIONS.map((option) => /* @__PURE__ */ jsx(SingleSelectOption, { value: option, children: labels[option] }, option))
5027
+ }
5028
+ ) }),
5029
+ /* @__PURE__ */ jsx(FilterSlot, { children: /* @__PURE__ */ jsx(
5030
+ PeriodSelect,
5031
+ {
5032
+ value: view.period,
5033
+ onChange: (next) => setFilters({ period: next === "30" ? void 0 : next })
5034
+ }
5035
+ ) }),
5036
+ view.adminId !== null ? /* @__PURE__ */ jsx(
5037
+ Tag,
5038
+ {
5039
+ icon: /* @__PURE__ */ jsx(Cross, { "aria-hidden": "true" }),
5040
+ label: t("adminPanel.activity.page.removeAdmin", "Show all admins again"),
5041
+ onClick: () => setFilters({ adminId: void 0 }),
5042
+ "data-admin-filter": view.adminId,
5043
+ children: t("adminPanel.activity.page.adminFilter", "Admin: {name}", { name: adminName })
5044
+ }
5045
+ ) : null
5046
+ ] }),
5047
+ notice: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
5048
+ recording && !recording.signIns ? /* @__PURE__ */ jsx(RecordingOff, { children: t(
5049
+ "adminPanel.activity.signIns.off",
5050
+ "Sign-in history is turned off. New sign-ins are not recorded."
5051
+ ) }) : null,
5052
+ /* @__PURE__ */ jsx(
5053
+ Typography,
5054
+ {
5055
+ ref: captionRef,
5056
+ tabIndex: -1,
5057
+ variant: "pi",
5058
+ textColor: "neutral600",
5059
+ "aria-live": "polite",
5060
+ "data-activity-caption": "",
5061
+ children: t(
5062
+ "adminPanel.activity.page.caption",
5063
+ "{total, plural, =0 {No events} one {# event} other {# events}}",
5064
+ { total }
5065
+ )
5066
+ }
5067
+ )
5068
+ ] }),
5069
+ empty: /* @__PURE__ */ jsx(
5070
+ EmptyStateLayout,
5071
+ {
5072
+ icon: /* @__PURE__ */ jsx(EmptyDocuments, { width: "16rem", height: "8.8rem", "aria-hidden": "true" }),
5073
+ content: filtered ? t("adminPanel.activity.page.noResults", "No events match these filters.") : t("adminPanel.activity.recent.empty", "No events recorded yet."),
5074
+ action: filtered ? /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: clearFilters, children: t("adminPanel.noResults.reset", "Clear filters") }) : null
5075
+ }
5076
+ ),
5077
+ renderList: (rows) => /* @__PURE__ */ jsx(
5078
+ SignInEventTable,
5079
+ {
5080
+ rows,
5081
+ label: title,
5082
+ showAdmin: true,
5083
+ busy: list.loading,
5084
+ detailsAction: (row, close) => row.admin && row.admin.id !== view.adminId ? /* @__PURE__ */ jsx(
5085
+ Button,
5086
+ {
5087
+ variant: "secondary",
5088
+ onClick: () => {
5089
+ close();
5090
+ setFilters({ adminId: String(row.admin.id) });
5091
+ },
5092
+ children: t("adminPanel.activity.page.onlyAdmin", "Show only events of {name}", {
5093
+ name: row.admin.name
5094
+ })
5095
+ }
5096
+ ) : null
5097
+ }
5098
+ ),
5099
+ toCsv: buildSignInCsv,
5100
+ fileName: "admin-security-activity",
5101
+ exportLabel: t(
5102
+ "adminPanel.activity.page.export",
5103
+ "Export the security activity with these filters as CSV"
5104
+ ),
5105
+ footer: /* @__PURE__ */ jsx(PaginationTargets, { children: /* @__PURE__ */ jsxs(
5106
+ Pagination.Root,
5107
+ {
5108
+ pageCount: pagination.pageCount,
5109
+ total: pagination.total,
5110
+ defaultPageSize: EVENT_PAGE_SIZE,
5111
+ children: [
5112
+ /* @__PURE__ */ jsx(Pagination.PageSize, { options: [...ACTIVITY_PAGE_SIZE_OPTIONS] }),
5113
+ /* @__PURE__ */ jsx(Pagination.Links, {})
5114
+ ]
5115
+ }
5116
+ ) })
5117
+ }
5118
+ )
5119
+ }
5120
+ );
5121
+ };
4111
5122
  const App = () => {
4112
5123
  return /* @__PURE__ */ jsx(Page.Protect, { permissions: pluginPermissions.access, children: /* @__PURE__ */ jsxs(Routes, { children: [
4113
5124
  /* @__PURE__ */ jsx(Route, { index: true, element: /* @__PURE__ */ jsx(HomePage, {}) }),
@@ -4118,6 +5129,13 @@ const App = () => {
4118
5129
  element: /* @__PURE__ */ jsx(Page.Protect, { permissions: pluginPermissions.adminSessionsRead, children: /* @__PURE__ */ jsx(AdminPanelPage, {}) })
4119
5130
  }
4120
5131
  ),
5132
+ /* @__PURE__ */ jsx(
5133
+ Route,
5134
+ {
5135
+ path: "admin-panel/activity",
5136
+ element: /* @__PURE__ */ jsx(Page.Protect, { permissions: pluginPermissions.adminSessionsRead, children: /* @__PURE__ */ jsx(Page.Protect, { permissions: pluginPermissions.adminActivityRead, children: /* @__PURE__ */ jsx(AdminActivityPage, {}) }) })
5137
+ }
5138
+ ),
4121
5139
  /* @__PURE__ */ jsx(Route, { path: "*", element: /* @__PURE__ */ jsx(HomePage, {}) })
4122
5140
  ] }) });
4123
5141
  };