strapi-plugin-magic-sessionmanager 4.20.0 → 4.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (33) hide show
  1. package/CHANGELOG.md +62 -0
  2. package/README.md +104 -50
  3. package/dist/admin/{Analytics-B5GnwMtH.js → Analytics-DeDLGiCe.js} +1 -1
  4. package/dist/admin/{Analytics-B-MVQ6dQ.mjs → Analytics-WbCUmkQQ.mjs} +1 -1
  5. package/dist/admin/{App-xBOmg4g9.js → App-Bkv-W0Sv.js} +1640 -2561
  6. package/dist/admin/{App-DzbP5VPQ.mjs → App-C4bihk2K.mjs} +1610 -2531
  7. package/dist/admin/{OnlineUsersWidget-FuPPPCCV.js → OnlineUsersWidget-CSvNe2rC.js} +1 -1
  8. package/dist/admin/{OnlineUsersWidget-Bf3BICmx.mjs → OnlineUsersWidget-q0Z6nbbO.mjs} +1 -1
  9. package/dist/admin/{Settings-hpkloyO6.mjs → Settings-avD0DbXP.mjs} +17 -9
  10. package/dist/admin/{Settings-WRIXHLDa.js → Settings-xokFI5LO.js} +59 -51
  11. package/dist/admin/dashboardModel-BBNRgcEr.mjs +170 -0
  12. package/dist/admin/dashboardModel-D4389iIV.js +169 -0
  13. package/dist/admin/{de-Bzd14FzX.mjs → de-BQlEdBMr.mjs} +104 -4
  14. package/dist/admin/{de-Uqb30N5n.js → de-HcJ19LKI.js} +104 -4
  15. package/dist/admin/{en-CDBcocLk.js → en-DI-98CPM.js} +105 -5
  16. package/dist/admin/{en-DovyVwa5.mjs → en-DzuXWL1W.mjs} +105 -5
  17. package/dist/admin/{es-BygJxl1J.mjs → es-BfyED9YI.mjs} +104 -4
  18. package/dist/admin/{es-DA1X0RPv.js → es-Cm0Eklav.js} +104 -4
  19. package/dist/admin/{fr-CPPA27jW.js → fr-C3nzszsI.js} +104 -4
  20. package/dist/admin/{fr-DONxL73-.mjs → fr-CzFNGWq0.mjs} +104 -4
  21. package/dist/admin/index-6zc5D8eb.mjs +4729 -0
  22. package/dist/admin/index-Dk5Jqe5U.js +4730 -0
  23. package/dist/admin/index.js +1 -1
  24. package/dist/admin/index.mjs +2 -2
  25. package/dist/admin/{pt-BMuwyaan.js → pt-BPZ6chPT.js} +104 -4
  26. package/dist/admin/{pt-D2yGNz2N.mjs → pt-DmyQnGI_.mjs} +104 -4
  27. package/dist/server/index.js +1048 -67
  28. package/dist/server/index.mjs +1048 -67
  29. package/package.json +1 -1
  30. package/dist/admin/index-DsaGGK7x.mjs +0 -2297
  31. package/dist/admin/index-Q_D-5LlE.js +0 -2298
  32. package/dist/admin/settingsTabs--7IsqMdn.mjs +0 -437
  33. package/dist/admin/settingsTabs-Dxlevody.js +0 -436
@@ -7,7 +7,7 @@ const styled = require("styled-components");
7
7
  const designSystem = require("@strapi/design-system");
8
8
  const icons = require("@strapi/icons");
9
9
  const StrapiAdmin = require("@strapi/strapi/admin");
10
- const index = require("./index-Q_D-5LlE.js");
10
+ const index = require("./index-Dk5Jqe5U.js");
11
11
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
12
12
  function _interopNamespace(e) {
13
13
  if (e && e.__esModule) return e;
@@ -6,7 +6,7 @@ import { Flex, Loader, Button, Box, Typography } from "@strapi/design-system";
6
6
  import { User, Lightning, Clock, Lock, WarningCircle } from "@strapi/icons";
7
7
  import * as StrapiAdmin from "@strapi/strapi/admin";
8
8
  import { useFetchClient } from "@strapi/strapi/admin";
9
- import { l as logSafeAdminError, n as isCancelledRequest, b as getTranslation, R as ReadableText, M as MissingValue } from "./index-DsaGGK7x.mjs";
9
+ import { l as logSafeAdminError, F as isCancelledRequest, b as getTranslation, R as ReadableText, M as MissingValue } from "./index-6zc5D8eb.mjs";
10
10
  function normalizeUserCounts(response) {
11
11
  const totalUsers = response?.data?.totalUsers;
12
12
  const blockedUsers = response?.data?.blockedUsers;
@@ -4,10 +4,10 @@ import { Field, Typography, Switch, Box, TextInput, Flex, Button, Link, SingleSe
4
4
  import { useFetchClient, useNotification, useRBAC, ConfirmDialog, useQueryParams, Page, Form, Blocker, useForm } from "@strapi/strapi/admin";
5
5
  import { EyeStriked, Eye, Key, Duplicate, Plus, Pencil, Trash, Lock, ArrowClockwise, Cross, Download, Check, SignOut } from "@strapi/icons";
6
6
  import styled from "styled-components";
7
- import { y as ReadableParagraphs, z as useSettingsTranslate, l as logSafeAdminError, R as ReadableText, f as pluginId, n as isCancelledRequest, h as PersistentAlert, A as EqualGrid, u as useSessionFormatters, j as pluginPermissions, C as ConfirmAction, P as PropertyList, B as formatSessionDate, F as refocusIfLost, G as copyText, H as requireSuccessfulMutation, q as PageShell } from "./index-DsaGGK7x.mjs";
7
+ import { ar as ReadableParagraphs, a1 as useSettingsTranslate, l as logSafeAdminError, as as buildTabSearch, R as ReadableText, at as buildSelectOptions, L as useElementWidth, f as pluginId, F as isCancelledRequest, h as PersistentAlert, au as EqualGrid, av as SELECT_PRESETS, u as useSessionFormatters, j as pluginPermissions, C as ConfirmAction, aw as fieldHasError, ax as usesLocalDatabase, P as PropertyList, ay as formatSessionDate, az as refocusIfLost, aA as getErrorTab, aB as copyText, aC as buildSavePayload, aD as SETTINGS_FIELD_LABELS, aE as requireSuccessfulMutation, aF as getVisibleSettingsTabs, aG as resolveSettingsTab, aH as getRevealScrollDelta, Q as PageShell, aI as SETTINGS_TAB_LABELS } from "./index-6zc5D8eb.mjs";
8
8
  import "react-intl";
9
- import { v as buildTabSearch, x as buildSelectOptions, u as useElementWidth, b as RowActions, s as shouldIsolateActionKey, y as SELECT_PRESETS, z as fieldHasError, B as getRiskAvailability, C as riskDependentControl, E as usesLocalDatabase, F as getErrorTab, G as buildSavePayload, q as SETTINGS_FIELD_LABELS, H as getVisibleSettingsTabs, I as resolveSettingsTab, J as getRevealScrollDelta, t as SETTINGS_TAB_LABELS } from "./settingsTabs--7IsqMdn.mjs";
10
9
  import { S as SectionCard } from "./SectionCard-D51bv4Hi.mjs";
10
+ import { b as RowActions, s as shouldIsolateActionKey, o as getRiskAvailability, q as riskDependentControl } from "./dashboardModel-BBNRgcEr.mjs";
11
11
  import { EmptyPermissions } from "@strapi/icons/symbols";
12
12
  const FieldFrame = styled.div`
13
13
  width: 100%;
@@ -5259,7 +5259,7 @@ const ActiveImpersonationsCard = () => {
5259
5259
  {
5260
5260
  fallbackFocusRef: refreshRef,
5261
5261
  title: t("impersonation.confirm.title", "End the impersonation of {user}?", {
5262
- user: row.targetLabel
5262
+ user: label(row)
5263
5263
  }),
5264
5264
  body: t(
5265
5265
  "impersonation.confirm.body",
@@ -5272,7 +5272,7 @@ const ActiveImpersonationsCard = () => {
5272
5272
  {
5273
5273
  variant: "ghost",
5274
5274
  label: t("impersonation.endLabel", "End impersonation of {user}", {
5275
- user: row.targetLabel
5275
+ user: label(row)
5276
5276
  }),
5277
5277
  children: /* @__PURE__ */ jsx(SignOut, {})
5278
5278
  }
@@ -5280,6 +5280,8 @@ const ActiveImpersonationsCard = () => {
5280
5280
  },
5281
5281
  row.id
5282
5282
  );
5283
+ const label = (row) => row.targetLabel || (row.targetType === "admin" ? t("impersonation.list.adminFallback", "Admin #{id}", { id: row.targetId }) : row.targetId);
5284
+ const kind = (row) => row.targetType === "admin" ? /* @__PURE__ */ jsx(Badge, { backgroundColor: "primary100", textColor: "neutral800", children: t("impersonation.list.kind.admin", "Admin, view only") }) : null;
5283
5285
  const time = (iso) => /* @__PURE__ */ jsx(Typography, { tag: "time", dateTime: iso, variant: "omega", textColor: "neutral800", children: formatDate(iso, { hour: "2-digit", minute: "2-digit" }) });
5284
5286
  const startedBy = (row) => row.startedByYou ? t("impersonation.list.you", "You") : row.actorLabel || "—";
5285
5287
  let content;
@@ -5320,7 +5322,10 @@ const ActiveImpersonationsCard = () => {
5320
5322
  /* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(VisuallyHidden, { children: t("impersonation.list.col.actions", "Actions") }) })
5321
5323
  ] }) }),
5322
5324
  /* @__PURE__ */ jsx(Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxs(Tr, { "data-impersonation-row": "", children: [
5323
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", fontWeight: "semiBold", children: row.targetLabel }) }),
5325
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", alignItems: "center", children: [
5326
+ /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", fontWeight: "semiBold", children: label(row) }),
5327
+ kind(row)
5328
+ ] }) }),
5324
5329
  /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", children: startedBy(row) }) }),
5325
5330
  /* @__PURE__ */ jsx(Td, { style: { maxWidth: 0, width: "40%" }, children: /* @__PURE__ */ jsx(
5326
5331
  Typography,
@@ -5339,7 +5344,10 @@ const ActiveImpersonationsCard = () => {
5339
5344
  } else {
5340
5345
  content = /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 2, tag: "ul", "data-impersonations-list": "", children: rows.map((row) => /* @__PURE__ */ jsx(Box, { tag: "li", padding: 4, hasRadius: true, borderColor: "neutral150", children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "flex-start", gap: 3, children: [
5341
5346
  /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, children: [
5342
- /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", fontWeight: "semiBold", children: row.targetLabel }),
5347
+ /* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", alignItems: "center", children: [
5348
+ /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", fontWeight: "semiBold", children: label(row) }),
5349
+ kind(row)
5350
+ ] }),
5343
5351
  /* @__PURE__ */ jsx(
5344
5352
  Typography,
5345
5353
  {
@@ -5402,8 +5410,8 @@ const ImpersonationTab = ({ form }) => {
5402
5410
  const locked = form.canChangeProtected === false;
5403
5411
  const {
5404
5412
  isLoading,
5405
- allowedActions: { canUsers }
5406
- } = useRBAC(pluginPermissions.impersonateUsers);
5413
+ allowedActions: { canUsers, canAdmins }
5414
+ } = useRBAC([...pluginPermissions.impersonateUsers, ...pluginPermissions.impersonateAdmins]);
5407
5415
  return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
5408
5416
  /* @__PURE__ */ jsx(IntroText, { children: t(
5409
5417
  "settings.impersonation.intro",
@@ -5428,7 +5436,7 @@ const ImpersonationTab = ({ form }) => {
5428
5436
  ) })
5429
5437
  }
5430
5438
  ) }),
5431
- !isLoading && canUsers ? /* @__PURE__ */ jsx(ActiveImpersonationsCard, {}) : null
5439
+ !isLoading && (canUsers || canAdmins) ? /* @__PURE__ */ jsx(ActiveImpersonationsCard, {}) : null
5432
5440
  ] });
5433
5441
  };
5434
5442
  const INITIAL_SETTINGS = { ...SETTINGS_DEFAULTS, emailTemplates: fillMissingTemplates({}) };
@@ -6,10 +6,10 @@ const designSystem = require("@strapi/design-system");
6
6
  const StrapiAdmin = require("@strapi/strapi/admin");
7
7
  const icons = require("@strapi/icons");
8
8
  const styled = require("styled-components");
9
- const index = require("./index-Q_D-5LlE.js");
9
+ const index = require("./index-Dk5Jqe5U.js");
10
10
  require("react-intl");
11
- const settingsTabs = require("./settingsTabs-Dxlevody.js");
12
11
  const SectionCard = require("./SectionCard-BlWv8CRt.js");
12
+ const dashboardModel = require("./dashboardModel-D4389iIV.js");
13
13
  const symbols = require("@strapi/icons/symbols");
14
14
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
15
15
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
@@ -405,7 +405,7 @@ const SettingsTabLink = ({ tab, children }) => {
405
405
  return /* @__PURE__ */ jsxRuntime.jsx(
406
406
  TabLink,
407
407
  {
408
- href: settingsTabs.buildTabSearch(search, tab),
408
+ href: index.buildTabSearch(search, tab),
409
409
  onClick: (event) => {
410
410
  if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0)
411
411
  return;
@@ -488,7 +488,7 @@ const PresetSelect = ({
488
488
  disabled = false
489
489
  }) => {
490
490
  const { custom } = useOptionLabels();
491
- const options = settingsTabs.buildSelectOptions(presets, value);
491
+ const options = index.buildSelectOptions(presets, value);
492
492
  return /* @__PURE__ */ jsxRuntime.jsx(FormField, { id, name, label, description, error, children: /* @__PURE__ */ jsxRuntime.jsx(
493
493
  designSystem.SingleSelect,
494
494
  {
@@ -684,7 +684,7 @@ function sortLocks(locks) {
684
684
  }
685
685
  const TABLE_MIN_WIDTH$2 = 640;
686
686
  const keepActionKeys$2 = (event) => {
687
- if (settingsTabs.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
687
+ if (dashboardModel.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
688
688
  };
689
689
  const EMPTY_DRAFT = Object.freeze({
690
690
  role: "",
@@ -712,7 +712,7 @@ const RoleRulesSection = ({ form }) => {
712
712
  const [showErrors, setShowErrors] = react.useState(false);
713
713
  const addRef = react.useRef(null);
714
714
  const returnFocusRef = react.useRef(null);
715
- const [widthRef, width] = settingsTabs.useElementWidth();
715
+ const [widthRef, width] = index.useElementWidth();
716
716
  react.useEffect(() => {
717
717
  let active = true;
718
718
  get(`/${index.pluginId}/roles`).then(({ data }) => {
@@ -773,7 +773,7 @@ const RoleRulesSection = ({ form }) => {
773
773
  const asTable = width === 0 || width >= TABLE_MIN_WIDTH$2;
774
774
  const actions = (rule) => {
775
775
  const name = roleName(rule.role);
776
- return /* @__PURE__ */ jsxRuntime.jsxs(settingsTabs.RowActions, { onKeyDown: keepActionKeys$2, children: [
776
+ return /* @__PURE__ */ jsxRuntime.jsxs(dashboardModel.RowActions, { onKeyDown: keepActionKeys$2, children: [
777
777
  /* @__PURE__ */ jsxRuntime.jsx(
778
778
  designSystem.IconButton,
779
779
  {
@@ -1044,7 +1044,7 @@ const SessionsTab = ({ form }) => {
1044
1044
  "A session unused for this long becomes idle and ends as 'Timed out' on its next request or at the next idle check. Also decides who counts as online."
1045
1045
  ),
1046
1046
  value: settings.inactivityTimeout,
1047
- presets: settingsTabs.SELECT_PRESETS.inactivityTimeout,
1047
+ presets: index.SELECT_PRESETS.inactivityTimeout,
1048
1048
  format: units.minutes,
1049
1049
  onChange: (value) => handleChange("inactivityTimeout", value)
1050
1050
  }
@@ -1060,7 +1060,7 @@ const SessionsTab = ({ form }) => {
1060
1060
  "Counted from sign-in, regardless of activity. Applied on the session's next request; until then the session can still show as active or idle."
1061
1061
  ),
1062
1062
  value: settings.maxSessionAgeDays,
1063
- presets: settingsTabs.SELECT_PRESETS.maxSessionAgeDays,
1063
+ presets: index.SELECT_PRESETS.maxSessionAgeDays,
1064
1064
  format: units.days,
1065
1065
  onChange: (value) => handleChange("maxSessionAgeDays", value)
1066
1066
  }
@@ -1082,7 +1082,7 @@ const SessionsTab = ({ form }) => {
1082
1082
  "Lower values make 'Last active' and idle detection more precise but write to the database more often."
1083
1083
  ),
1084
1084
  value: settings.lastSeenRateLimit,
1085
- presets: settingsTabs.SELECT_PRESETS.lastSeenRateLimit,
1085
+ presets: index.SELECT_PRESETS.lastSeenRateLimit,
1086
1086
  format: units.seconds,
1087
1087
  onChange: (value) => handleChange("lastSeenRateLimit", value)
1088
1088
  }
@@ -1103,7 +1103,7 @@ const SessionsTab = ({ form }) => {
1103
1103
  "The idle check ends idle sessions as 'Timed out'. It deletes nothing. It also runs once at server start."
1104
1104
  ),
1105
1105
  value: settings.cleanupInterval,
1106
- presets: settingsTabs.SELECT_PRESETS.cleanupInterval,
1106
+ presets: index.SELECT_PRESETS.cleanupInterval,
1107
1107
  format: units.minutes,
1108
1108
  onChange: (value) => handleChange("cleanupInterval", value)
1109
1109
  }
@@ -1190,7 +1190,7 @@ const SessionsTab = ({ form }) => {
1190
1190
  "Accepts a new token for a few seconds while its session record is being created. Only for tokens without a session record. Not used when Strapi's refresh-token mode (jwtManagement: 'refresh') is on."
1191
1191
  ),
1192
1192
  value: settings.sessionCreationGraceMs ?? 5e3,
1193
- presets: settingsTabs.SELECT_PRESETS.sessionCreationGraceMs,
1193
+ presets: index.SELECT_PRESETS.sessionCreationGraceMs,
1194
1194
  format: units.graceMs,
1195
1195
  onChange: (value) => handleChange("sessionCreationGraceMs", value)
1196
1196
  }
@@ -2231,7 +2231,7 @@ function getAdjustedFields(submitted, stored, previous) {
2231
2231
  }
2232
2232
  const TABLE_MIN_WIDTH$1 = 640;
2233
2233
  const keepActionKeys$1 = (event) => {
2234
- if (settingsTabs.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
2234
+ if (dashboardModel.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
2235
2235
  };
2236
2236
  const LockTarget = ({ lock }) => {
2237
2237
  const { t } = index.useSettingsTranslate();
@@ -2293,7 +2293,7 @@ const LockedNowCard = () => {
2293
2293
  isLoading: permissionsLoading,
2294
2294
  allowedActions: { canUnlock }
2295
2295
  } = StrapiAdmin.useRBAC(index.pluginPermissions.lockoutsUnlock);
2296
- const [widthRef, width] = settingsTabs.useElementWidth();
2296
+ const [widthRef, width] = index.useElementWidth();
2297
2297
  const [locks, setLocks] = react.useState(null);
2298
2298
  const [error, setError] = react.useState(false);
2299
2299
  const [refreshing, setRefreshing] = react.useState(false);
@@ -2417,7 +2417,7 @@ const LockedNowCard = () => {
2417
2417
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(KindBadge, { kind: lock.kind }) }),
2418
2418
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", children: lock.failures }) }),
2419
2419
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: ends(lock) }),
2420
- showActions ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(settingsTabs.RowActions, { onKeyDown: keepActionKeys$1, children: unlockAction(lock) }) }) : null
2420
+ showActions ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(dashboardModel.RowActions, { onKeyDown: keepActionKeys$1, children: unlockAction(lock) }) }) : null
2421
2421
  ] }, lock.id)) })
2422
2422
  ] }) });
2423
2423
  } else {
@@ -2440,7 +2440,7 @@ const LockedNowCard = () => {
2440
2440
  }) })
2441
2441
  ] })
2442
2442
  ] }),
2443
- /* @__PURE__ */ jsxRuntime.jsx(settingsTabs.RowActions, { onKeyDown: keepActionKeys$1, children: unlockAction(lock) })
2443
+ /* @__PURE__ */ jsxRuntime.jsx(dashboardModel.RowActions, { onKeyDown: keepActionKeys$1, children: unlockAction(lock) })
2444
2444
  ] })
2445
2445
  },
2446
2446
  lock.id
@@ -2612,7 +2612,7 @@ const ImpossibleTravelCard = ({ form }) => {
2612
2612
  /* @__PURE__ */ jsxRuntime.jsx(
2613
2613
  AdvancedSection,
2614
2614
  {
2615
- hasError: settingsTabs.fieldHasError(errors, "impossibleTravelSpeedKmh") || settingsTabs.fieldHasError(errors, "impossibleTravelMinDistanceKm"),
2615
+ hasError: index.fieldHasError(errors, "impossibleTravelSpeedKmh") || index.fieldHasError(errors, "impossibleTravelMinDistanceKm"),
2616
2616
  disabled: !enabled,
2617
2617
  children: /* @__PURE__ */ jsxRuntime.jsxs(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: [
2618
2618
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -3117,8 +3117,8 @@ const LoginProtectionTab = ({ form }) => {
3117
3117
  const lookupOff = !settings.enableGeolocation;
3118
3118
  const locked = form.canChangeProtected === false;
3119
3119
  const policyLocked = locked;
3120
- const risk = settingsTabs.getRiskAvailability(form.geoIp.status);
3121
- const reject = settingsTabs.riskDependentControl(settings.blockSuspiciousSessions, risk.state);
3120
+ const risk = dashboardModel.getRiskAvailability(form.geoIp.status);
3121
+ const reject = dashboardModel.riskDependentControl(settings.blockSuspiciousSessions, risk.state);
3122
3122
  const autoStillRejects = reject.savedOnButInactive && (settings.geoLookupFailureMode || "auto") === "auto";
3123
3123
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
3124
3124
  /* @__PURE__ */ jsxRuntime.jsx(IntroText, { children: t(
@@ -3297,7 +3297,7 @@ const LoginProtectionTab = ({ form }) => {
3297
3297
  AdvancedSection,
3298
3298
  {
3299
3299
  label: t("settings.config.failed.trusted.section", "Trusted addresses"),
3300
- hasError: settingsTabs.fieldHasError(errors, "lockoutTrustedAddresses"),
3300
+ hasError: index.fieldHasError(errors, "lockoutTrustedAddresses"),
3301
3301
  children: /* @__PURE__ */ jsxRuntime.jsx(TrustedAddressesField, { form, disabled: policyLocked })
3302
3302
  }
3303
3303
  )
@@ -3368,7 +3368,7 @@ const LoginProtectionTab = ({ form }) => {
3368
3368
  children: !lookupOff && reject.disabled ? /* @__PURE__ */ jsxRuntime.jsx(RiskSourceNotice, { savedOn: reject.savedOnButInactive }) : null
3369
3369
  }
3370
3370
  ),
3371
- /* @__PURE__ */ jsxRuntime.jsxs(AdvancedSection, { hasError: settingsTabs.fieldHasError(errors, "geoLookupFailureMode"), children: [
3371
+ /* @__PURE__ */ jsxRuntime.jsxs(AdvancedSection, { hasError: index.fieldHasError(errors, "geoLookupFailureMode"), children: [
3372
3372
  /* @__PURE__ */ jsxRuntime.jsx(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
3373
3373
  FormField,
3374
3374
  {
@@ -3510,7 +3510,7 @@ const GeoIpDatabaseCard = ({ form }) => {
3510
3510
  };
3511
3511
  const lookupOff = !settings.enableGeolocation;
3512
3512
  const locked = form.canChangeProtected === false;
3513
- const localDatabase = settingsTabs.usesLocalDatabase(settings.geoIpProvider);
3513
+ const localDatabase = index.usesLocalDatabase(settings.geoIpProvider);
3514
3514
  const databaseDisabled = lookupOff || !localDatabase;
3515
3515
  const credentialSource = geoIpStatus?.credentialSource;
3516
3516
  const fromEnvironment = credentialSource === "env";
@@ -3727,7 +3727,7 @@ const GeoIpDatabaseCard = ({ form }) => {
3727
3727
  "Save your changes first, so the download uses the current settings."
3728
3728
  ) }) : null
3729
3729
  ] }),
3730
- /* @__PURE__ */ jsxRuntime.jsx(AdvancedSection, { hasError: settingsTabs.fieldHasError(errors, "geoIpDatabasePath"), children: /* @__PURE__ */ jsxRuntime.jsx(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
3730
+ /* @__PURE__ */ jsxRuntime.jsx(AdvancedSection, { hasError: index.fieldHasError(errors, "geoIpDatabasePath"), children: /* @__PURE__ */ jsxRuntime.jsx(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
3731
3731
  FormField,
3732
3732
  {
3733
3733
  id: "geoip-database-filename",
@@ -3830,7 +3830,7 @@ const RiskDataCard = ({ form }) => {
3830
3830
  const { t } = index.useSettingsTranslate();
3831
3831
  const { settings, geoIp } = form;
3832
3832
  const lookupOff = !settings.enableGeolocation;
3833
- const risk = settingsTabs.getRiskAvailability(geoIp.status);
3833
+ const risk = dashboardModel.getRiskAvailability(geoIp.status);
3834
3834
  const sourceLabels = {
3835
3835
  "anonymous-ip": t("settings.config.risk.source.anonymousIp", "Anonymous IP database"),
3836
3836
  "asn-heuristic": t("settings.config.risk.source.asn", "ASN heuristic")
@@ -3897,8 +3897,8 @@ const RiskDataCard = ({ form }) => {
3897
3897
  const LocationDataTab = ({ form }) => {
3898
3898
  const { t } = index.useSettingsTranslate();
3899
3899
  const { settings, handleChange } = form;
3900
- const risk = settingsTabs.getRiskAvailability(form.geoIp.status);
3901
- const scoring = settingsTabs.riskDependentControl(settings.enableSecurityScoring, risk.state);
3900
+ const risk = dashboardModel.getRiskAvailability(form.geoIp.status);
3901
+ const scoring = dashboardModel.riskDependentControl(settings.enableSecurityScoring, risk.state);
3902
3902
  const locked = form.canChangeProtected === false;
3903
3903
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
3904
3904
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
@@ -4719,8 +4719,8 @@ const AlertsTab = ({ form }) => {
4719
4719
  const emailTypesDisabled = lookupOff || !settings.enableEmailAlerts;
4720
4720
  const webhookFieldsDisabled = lookupOff || !settings.enableWebhooks;
4721
4721
  const locked = form.canChangeProtected === false;
4722
- const templateErrors = settingsTabs.fieldHasError(errors, "emailTemplates");
4723
- const risk = settingsTabs.getRiskAvailability(form.geoIp.status);
4722
+ const templateErrors = index.fieldHasError(errors, "emailTemplates");
4723
+ const risk = dashboardModel.getRiskAvailability(form.geoIp.status);
4724
4724
  const emailTypes = [
4725
4725
  {
4726
4726
  field: "alertOnSuspiciousLogin",
@@ -4807,7 +4807,7 @@ const AlertsTab = ({ form }) => {
4807
4807
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", tag: "div", textColor: "neutral800", children: t("settings.config.email.types.label", "Send an email for") }),
4808
4808
  !lookupOff && !settings.enableEmailAlerts ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t("settings.config.requires.emailAlerts", "Requires Send security emails") }) : null,
4809
4809
  /* @__PURE__ */ jsxRuntime.jsx(EmailTypeGrid, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: emailTypes.map(({ field, needsRiskData, needsTravel, hintId, label, hint }) => {
4810
- const control = needsRiskData ? settingsTabs.riskDependentControl(settings[field], risk.state) : { checked: settings[field], disabled: false, savedOnButInactive: false };
4810
+ const control = needsRiskData ? dashboardModel.riskDependentControl(settings[field], risk.state) : { checked: settings[field], disabled: false, savedOnButInactive: false };
4811
4811
  const travelOff = needsTravel && settings.impossibleTravelEnabled !== true;
4812
4812
  const disabled = emailTypesDisabled || control.disabled || travelOff;
4813
4813
  return /* @__PURE__ */ jsxRuntime.jsxs(AlertTypeCell, { checked: control.checked, disabled, children: [
@@ -4995,7 +4995,7 @@ const DataRetentionTab = ({ form }) => {
4995
4995
  "Checked once a day, the first time about 24 hours after the server starts. Open sessions are never deleted by retention. 'Forever' keeps them."
4996
4996
  ),
4997
4997
  value: settings.retentionDays,
4998
- presets: settingsTabs.SELECT_PRESETS.retentionDays,
4998
+ presets: index.SELECT_PRESETS.retentionDays,
4999
4999
  format: units.retentionDays,
5000
5000
  onChange: (value) => handleChange("retentionDays", value)
5001
5001
  }
@@ -5191,7 +5191,7 @@ const AdminActivityTab = ({ form }) => {
5191
5191
  "At least 7 days. Older events are deleted once a day; each deletion is itself recorded. Events of a deleted admin are deleted with the account."
5192
5192
  ),
5193
5193
  value: settings.securityLogRetentionDays,
5194
- presets: settingsTabs.SELECT_PRESETS.securityLogRetentionDays,
5194
+ presets: index.SELECT_PRESETS.securityLogRetentionDays,
5195
5195
  format: units.days,
5196
5196
  disabled: locked,
5197
5197
  onChange: (value) => handleChange("securityLogRetentionDays", value)
@@ -5204,14 +5204,14 @@ const AdminActivityTab = ({ form }) => {
5204
5204
  };
5205
5205
  const TABLE_MIN_WIDTH = 720;
5206
5206
  const keepActionKeys = (event) => {
5207
- if (settingsTabs.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
5207
+ if (dashboardModel.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
5208
5208
  };
5209
5209
  const ActiveImpersonationsCard = () => {
5210
5210
  const { t } = index.useSettingsTranslate();
5211
5211
  const { get, post } = StrapiAdmin.useFetchClient();
5212
5212
  const { toggleNotification } = StrapiAdmin.useNotification();
5213
5213
  const { formatDate } = index.useSessionFormatters();
5214
- const [widthRef, width] = settingsTabs.useElementWidth();
5214
+ const [widthRef, width] = index.useElementWidth();
5215
5215
  const [rows, setRows] = react.useState(null);
5216
5216
  const [error, setError] = react.useState(false);
5217
5217
  const [refreshing, setRefreshing] = react.useState(false);
@@ -5263,7 +5263,7 @@ const ActiveImpersonationsCard = () => {
5263
5263
  {
5264
5264
  fallbackFocusRef: refreshRef,
5265
5265
  title: t("impersonation.confirm.title", "End the impersonation of {user}?", {
5266
- user: row.targetLabel
5266
+ user: label(row)
5267
5267
  }),
5268
5268
  body: t(
5269
5269
  "impersonation.confirm.body",
@@ -5276,7 +5276,7 @@ const ActiveImpersonationsCard = () => {
5276
5276
  {
5277
5277
  variant: "ghost",
5278
5278
  label: t("impersonation.endLabel", "End impersonation of {user}", {
5279
- user: row.targetLabel
5279
+ user: label(row)
5280
5280
  }),
5281
5281
  children: /* @__PURE__ */ jsxRuntime.jsx(icons.SignOut, {})
5282
5282
  }
@@ -5284,6 +5284,8 @@ const ActiveImpersonationsCard = () => {
5284
5284
  },
5285
5285
  row.id
5286
5286
  );
5287
+ const label = (row) => row.targetLabel || (row.targetType === "admin" ? t("impersonation.list.adminFallback", "Admin #{id}", { id: row.targetId }) : row.targetId);
5288
+ const kind = (row) => row.targetType === "admin" ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "primary100", textColor: "neutral800", children: t("impersonation.list.kind.admin", "Admin, view only") }) : null;
5287
5289
  const time = (iso) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "time", dateTime: iso, variant: "omega", textColor: "neutral800", children: formatDate(iso, { hour: "2-digit", minute: "2-digit" }) });
5288
5290
  const startedBy = (row) => row.startedByYou ? t("impersonation.list.you", "You") : row.actorLabel || "—";
5289
5291
  let content;
@@ -5324,7 +5326,10 @@ const ActiveImpersonationsCard = () => {
5324
5326
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.VisuallyHidden, { children: t("impersonation.list.col.actions", "Actions") }) })
5325
5327
  ] }) }),
5326
5328
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { "data-impersonation-row": "", children: [
5327
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", fontWeight: "semiBold", children: row.targetLabel }) }),
5329
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", alignItems: "center", children: [
5330
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", fontWeight: "semiBold", children: label(row) }),
5331
+ kind(row)
5332
+ ] }) }),
5328
5333
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", children: startedBy(row) }) }),
5329
5334
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { style: { maxWidth: 0, width: "40%" }, children: /* @__PURE__ */ jsxRuntime.jsx(
5330
5335
  designSystem.Typography,
@@ -5337,13 +5342,16 @@ const ActiveImpersonationsCard = () => {
5337
5342
  }
5338
5343
  ) }),
5339
5344
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: time(row.expiresAt) }),
5340
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(settingsTabs.RowActions, { onKeyDown: keepActionKeys, children: endAction(row) }) })
5345
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(dashboardModel.RowActions, { onKeyDown: keepActionKeys, children: endAction(row) }) })
5341
5346
  ] }, row.id)) })
5342
5347
  ] }) });
5343
5348
  } else {
5344
5349
  content = /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, tag: "ul", "data-impersonations-list": "", children: rows.map((row) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { tag: "li", padding: 4, hasRadius: true, borderColor: "neutral150", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "flex-start", gap: 3, children: [
5345
5350
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, children: [
5346
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", fontWeight: "semiBold", children: row.targetLabel }),
5351
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", alignItems: "center", children: [
5352
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", fontWeight: "semiBold", children: label(row) }),
5353
+ kind(row)
5354
+ ] }),
5347
5355
  /* @__PURE__ */ jsxRuntime.jsx(
5348
5356
  designSystem.Typography,
5349
5357
  {
@@ -5359,7 +5367,7 @@ const ActiveImpersonationsCard = () => {
5359
5367
  time: formatDate(row.expiresAt, { hour: "2-digit", minute: "2-digit" })
5360
5368
  }) })
5361
5369
  ] }),
5362
- /* @__PURE__ */ jsxRuntime.jsx(settingsTabs.RowActions, { onKeyDown: keepActionKeys, children: endAction(row) })
5370
+ /* @__PURE__ */ jsxRuntime.jsx(dashboardModel.RowActions, { onKeyDown: keepActionKeys, children: endAction(row) })
5363
5371
  ] }) }, row.id)) });
5364
5372
  }
5365
5373
  return /* @__PURE__ */ jsxRuntime.jsx(
@@ -5406,8 +5414,8 @@ const ImpersonationTab = ({ form }) => {
5406
5414
  const locked = form.canChangeProtected === false;
5407
5415
  const {
5408
5416
  isLoading,
5409
- allowedActions: { canUsers }
5410
- } = StrapiAdmin.useRBAC(index.pluginPermissions.impersonateUsers);
5417
+ allowedActions: { canUsers, canAdmins }
5418
+ } = StrapiAdmin.useRBAC([...index.pluginPermissions.impersonateUsers, ...index.pluginPermissions.impersonateAdmins]);
5411
5419
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
5412
5420
  /* @__PURE__ */ jsxRuntime.jsx(IntroText, { children: t(
5413
5421
  "settings.impersonation.intro",
@@ -5432,7 +5440,7 @@ const ImpersonationTab = ({ form }) => {
5432
5440
  ) })
5433
5441
  }
5434
5442
  ) }),
5435
- !isLoading && canUsers ? /* @__PURE__ */ jsxRuntime.jsx(ActiveImpersonationsCard, {}) : null
5443
+ !isLoading && (canUsers || canAdmins) ? /* @__PURE__ */ jsxRuntime.jsx(ActiveImpersonationsCard, {}) : null
5436
5444
  ] });
5437
5445
  };
5438
5446
  const INITIAL_SETTINGS = { ...SETTINGS_DEFAULTS, emailTemplates: fillMissingTemplates({}) };
@@ -5470,7 +5478,7 @@ function useSettingsForm() {
5470
5478
  const hasChanges = !areSettingsEqual(settings, savedSettings);
5471
5479
  const errors = react.useMemo(() => validateSettings(settings), [settings]);
5472
5480
  const errorCount = Object.keys(errors).length;
5473
- const errorTab = settingsTabs.getErrorTab(errors);
5481
+ const errorTab = index.getErrorTab(errors);
5474
5482
  const canSave = hasChanges && errorCount === 0 && !saving;
5475
5483
  const settingsRef = react.useRef(settings);
5476
5484
  const savedSettingsRef = react.useRef(savedSettings);
@@ -5562,7 +5570,7 @@ function useSettingsForm() {
5562
5570
  });
5563
5571
  }, []);
5564
5572
  const handleSave = react.useCallback(async () => {
5565
- const submitted = settingsTabs.buildSavePayload(settingsRef.current, savedSettingsRef.current);
5573
+ const submitted = index.buildSavePayload(settingsRef.current, savedSettingsRef.current);
5566
5574
  const previous = savedSettingsRef.current;
5567
5575
  if (Object.keys(validateSettings(submitted)).length > 0) return false;
5568
5576
  setSaving(true);
@@ -5582,7 +5590,7 @@ function useSettingsForm() {
5582
5590
  setDraftVersion((version) => version + 1);
5583
5591
  const adjustedNames = [
5584
5592
  ...new Set(
5585
- getAdjustedFields(submitted, stored, previous).map((key) => settingsTabs.SETTINGS_FIELD_LABELS[key]).filter(Boolean).map(([id, defaultMessage]) => t(id, defaultMessage))
5593
+ getAdjustedFields(submitted, stored, previous).map((key) => index.SETTINGS_FIELD_LABELS[key]).filter(Boolean).map(([id, defaultMessage]) => t(id, defaultMessage))
5586
5594
  )
5587
5595
  ];
5588
5596
  toggleNotification({
@@ -5819,7 +5827,7 @@ const DraftSync = ({ values }) => {
5819
5827
  const writeTabToAddressBar = (tab) => {
5820
5828
  if (typeof window === "undefined" || !window.history?.replaceState) return;
5821
5829
  const { pathname, search, hash } = window.location;
5822
- const nextSearch = settingsTabs.buildTabSearch(search, tab);
5830
+ const nextSearch = index.buildTabSearch(search, tab);
5823
5831
  if (nextSearch === search) return;
5824
5832
  window.history.replaceState(window.history.state, "", `${pathname}${nextSearch}${hash}`);
5825
5833
  };
@@ -5834,10 +5842,10 @@ const SettingsPage = () => {
5834
5842
  allowedActions: { canUpdate: canChangeProtected }
5835
5843
  } = StrapiAdmin.useRBAC(index.pluginPermissions.settingsUpdate);
5836
5844
  const visibleTabs = react.useMemo(
5837
- () => settingsTabs.getVisibleSettingsTabs(Boolean(canViewAdminActivity)),
5845
+ () => index.getVisibleSettingsTabs(Boolean(canViewAdminActivity)),
5838
5846
  [canViewAdminActivity]
5839
5847
  );
5840
- const requestedTab = settingsTabs.resolveSettingsTab(query?.tab, visibleTabs);
5848
+ const requestedTab = index.resolveSettingsTab(query?.tab, visibleTabs);
5841
5849
  const [activeTab, setActiveTab] = react.useState(requestedTab);
5842
5850
  const [followedTab, setFollowedTab] = react.useState(requestedTab);
5843
5851
  const tabsRef = react.useRef(null);
@@ -5849,7 +5857,7 @@ const SettingsPage = () => {
5849
5857
  const list = tabsRef.current?.querySelector('[role="tablist"]');
5850
5858
  const tab = list?.querySelector('[role="tab"][aria-selected="true"]');
5851
5859
  if (!list || !tab) return;
5852
- const delta = settingsTabs.getRevealScrollDelta(list.getBoundingClientRect(), tab.getBoundingClientRect());
5860
+ const delta = index.getRevealScrollDelta(list.getBoundingClientRect(), tab.getBoundingClientRect());
5853
5861
  if (delta) list.scrollLeft += delta;
5854
5862
  }, [activeTab, form.loading]);
5855
5863
  const focusActiveTab = react.useCallback(() => {
@@ -5866,7 +5874,7 @@ const SettingsPage = () => {
5866
5874
  }, [handleSave, focusActiveTab]);
5867
5875
  const changeTab = react.useCallback(
5868
5876
  (tab) => {
5869
- const next = settingsTabs.resolveSettingsTab(tab, visibleTabs);
5877
+ const next = index.resolveSettingsTab(tab, visibleTabs);
5870
5878
  setActiveTab(next);
5871
5879
  writeTabToAddressBar(next);
5872
5880
  },
@@ -5956,7 +5964,7 @@ const SettingsPage = () => {
5956
5964
  SettingsTabsList,
5957
5965
  {
5958
5966
  "aria-label": t("settings.config.tabs.label", "Configuration sections"),
5959
- children: visibleTabs.map((tab) => /* @__PURE__ */ jsxRuntime.jsx(SettingsTabTrigger, { value: tab, children: /* @__PURE__ */ jsxRuntime.jsx(SettingsTabLabel, { children: t(settingsTabs.SETTINGS_TAB_LABELS[tab][0], settingsTabs.SETTINGS_TAB_LABELS[tab][1]) }) }, tab))
5967
+ children: visibleTabs.map((tab) => /* @__PURE__ */ jsxRuntime.jsx(SettingsTabTrigger, { value: tab, children: /* @__PURE__ */ jsxRuntime.jsx(SettingsTabLabel, { children: t(index.SETTINGS_TAB_LABELS[tab][0], index.SETTINGS_TAB_LABELS[tab][1]) }) }, tab))
5960
5968
  }
5961
5969
  ),
5962
5970
  visibleTabs.map((tab) => {