strapi-plugin-magic-sessionmanager 4.14.1 → 4.14.3

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.
package/CHANGELOG.md CHANGED
@@ -1,3 +1,35 @@
1
+ ## [4.14.3](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.14.2...v4.14.3) (2026-11-24)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * **admin:** space row actions like Strapi's own tables ([#32](https://github.com/Schero94/Magic-Sessionmanager/issues/32)) ([1c5cadc](https://github.com/Schero94/Magic-Sessionmanager/commit/1c5cadcc3d1f71c689b0ebc5741442744c33efe0))
7
+
8
+
9
+ ### Fixed
10
+
11
+ * **Row actions are spaced like Strapi's own tables.** In the Admin panel table the "View sessions" (eye) and red "Sign out everywhere" buttons, and in the App users table the "View details", "End session" and "More actions" buttons, were joined into one segmented `IconButtonGroup` and looked stuck together. They are separate actions, so they now sit 4 px apart in a right-aligned `Flex` (`gap={1}`), the layout Strapi uses in Settings > Webhooks and Settings > Users. Every other action group of the plugin already used a gap and is unchanged.
12
+
13
+ ### Tests
14
+
15
+ * `npm run test:admin`: the row actions of both tables render as a flex row with a 4 px gap (fails with the old `IconButtonGroup`).
16
+
17
+ ## [4.14.2](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.14.1...v4.14.2) (2026-11-18)
18
+
19
+
20
+ ### Bug Fixes
21
+
22
+ * **admin:** keep loads working when a component mounts again ([#24](https://github.com/Schero94/Magic-Sessionmanager/issues/24)) ([4a18a47](https://github.com/Schero94/Magic-Sessionmanager/commit/4a18a473c21aeb4ae0a5671f55456ce2b0abefcc))
23
+
24
+
25
+ ### Fixed
26
+
27
+ * The Online users widget, the Analytics page and the Configuration page no longer show "could not be loaded" after the component is mounted a second time. `useFetchClient` aborts the requests of an unmounted component; the widget and the Analytics page then skipped their next load because the aborted one still counted as running, and the Configuration page set the error of the aborted load after the next load had started. React StrictMode mounts every component twice in development, and React 19 and a future StrictMode admin do the same. Each load now belongs to one mount: an aborted or outdated load sets no state.
28
+
29
+ ### Tests
30
+
31
+ * `npm run test:admin`: StrictMode tests for every admin entry point (no duplicate requests, no leaked timers, listeners, connections or observers after unmount, no console errors or warnings), also run against React 19 in an informational CI job.
32
+
1
33
  ## [4.14.1](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.14.0...v4.14.1) (2026-11-18)
2
34
 
3
35
 
package/README.md CHANGED
@@ -51,6 +51,7 @@ Live docs: [https://schero94.github.io/Magic-Sessionmanager/](https://schero94.g
51
51
  - [Contributing](#contributing)
52
52
  - [Maintenance status](#maintenance-status)
53
53
  - [Languages](#languages)
54
+ - [Showcase your company](#showcase-your-company)
54
55
  - [License](#license)
55
56
 
56
57
  ---
@@ -250,7 +251,7 @@ Two links: **Configuration** and **Analytics**.
250
251
 
251
252
  | Item | Supported |
252
253
  | -------------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
253
- | Strapi | 5.50.0 and later 5.x (`@strapi/strapi` peer range `^5.50.0`). Tested in CI on 5.50.0 (floor) and 5.62.0 (acceptance host). Strapi 5.0 to 5.49 are not supported, see [Upgrading › Strapi older than 5.50](#strapi-older-than-550). |
254
+ | Strapi | 5.50.0 and later 5.x (`@strapi/strapi` peer range `^5.50.0`). Tested in CI on 5.50.0 (floor) and 5.63.0 (acceptance host). Strapi 5.0 to 5.49 are not supported, see [Upgrading › Strapi older than 5.50](#strapi-older-than-550). |
254
255
  | Node.js | `^22.22.2 \|\| >=24.15.0` (`engines.node`) |
255
256
  | Users & Permissions | `jwtManagement: 'refresh'` and `'legacy-support'` |
256
257
  | Homepage widget | Included (Strapi's widgets API exists since 5.13). |
@@ -960,6 +961,7 @@ Version 4.0.0 moved to Strapi 5 and its Document Service API. Upgrade Strapi its
960
961
  ```bash
961
962
  npm ci --legacy-peer-deps
962
963
  npm test # node --test tests/*.test.js tests/*.test.mjs
964
+ npm run test:admin # admin entry points in React.StrictMode (jsdom, fake network)
963
965
  npm run test:concurrency # 8 processes on one database (SQLite; PostgreSQL with MSM_TEST_PG_URL)
964
966
  npm run test:ts:front
965
967
  npm run test:ts:back
@@ -968,6 +970,8 @@ npm run verify
968
970
  npm run verify:runtime
969
971
  ```
970
972
 
973
+ `npm run test:admin` renders every admin entry point (the session dashboard and the admin panel sessions view with their dialogs, the Configuration and Analytics settings pages, the Online users widget and the Content Manager side panel) inside `React.StrictMode` with the providers of the Strapi admin, in jsdom with a fake network. It fails on a mutation sent twice, a read repeated without aborting the first one, an interval, listener, connection or observer left after unmount, and any console error or warning. A separate CI job runs the same tests against React 19 for information only: the plugin's peer range is React 18, like the Strapi 5 admin.
974
+
971
975
  HTTP integration tests need Strapi host dependencies: set `SESSION_HTTP_STRAPI_NODE_MODULES` to the `node_modules` of a Strapi 5 host; without it they skip with a message. This repository's own `node_modules` works (its devDependencies include Strapi 5.62 and Users & Permissions), which is what CI uses:
972
976
 
973
977
  ```bash
@@ -990,14 +994,14 @@ Releases use Conventional Commits and semantic-release on Node.js 22 with npm Tr
990
994
  Issues and pull requests are welcome.
991
995
 
992
996
  - Bugs and feature ideas: [open an issue](https://github.com/Schero94/Magic-Sessionmanager/issues/new/choose) (templates included). Questions: [Discussions](https://github.com/Schero94/Magic-Sessionmanager/discussions).
993
- - Pull requests: branch from `main`, write a failing test first, and use Conventional Commits (`fix:`, `feat:`, `docs:`; a breaking change needs a `BREAKING CHANGE:` footer). Before you push, run `npm run lint`, `npm run format:check`, `npm test`, both type checks and `npm run build && npm run verify`.
997
+ - Pull requests: branch from `main`, write a failing test first, and use Conventional Commits (`fix:`, `feat:`, `docs:`; a breaking change needs a `BREAKING CHANGE:` footer). Before you push, run `npm run lint`, `npm run format:check`, `npm test`, `npm run test:admin`, both type checks and `npm run build && npm run verify`.
994
998
  - Use synthetic data only in tests, screenshots and issues: `*.example.test` addresses and IP addresses from `203.0.113.0/24`. Never paste real tokens.
995
999
 
996
1000
  ---
997
1001
 
998
1002
  ## Maintenance status
999
1003
 
1000
- Actively maintained for the Strapi 5 line. Releases are cut by semantic-release from `main` using Conventional Commits and published to npm with npm Trusted Publishing (GitHub OIDC). Dependabot proposes weekly dependency updates; patch and minor updates are merged only after lint, tests, both type checks, build and `verify` pass.
1004
+ Actively maintained for the Strapi 5 line. Releases are cut by semantic-release from `main` using Conventional Commits and published to npm with npm Trusted Publishing (GitHub OIDC). Dependabot proposes weekly dependency updates. See [Dependency updates and the auto-merge gate](#dependency-updates-and-the-auto-merge-gate).
1001
1005
 
1002
1006
  Dependency advisories (checked 2026-11-17, Strapi 5.62.0 dev baseline): `npm audit --omit=dev` on the plugin lockfile reports 5 high findings. All of them are one advisory in the Strapi 5 core dependency chain, picomatch [GHSA-fc5q-39xc-vjpf](https://github.com/advisories/GHSA-fc5q-39xc-vjpf) through `@strapi/utils` > `preferred-pm` > `find-yarn-workspace-root2` > `micromatch`. The plugin cannot fix findings in that chain; the forced npm fix would downgrade to Strapi 4, so it is not applied. They clear when Strapi ships an updated `@strapi/utils`.
1003
1007
 
@@ -1007,12 +1011,36 @@ Report bugs at https://github.com/Schero94/Magic-Sessionmanager/issues.
1007
1011
 
1008
1012
  ---
1009
1013
 
1014
+ ### Dependency updates and the auto-merge gate
1015
+
1016
+ Dependabot proposes updates weekly, after a cooldown (7 days, 14 for majors). `.github/workflows/dependency-auto-merge.yml` handles its pull requests with the rules in `.github/scripts/dependency-gate.mjs`. The script is the same in every Magic plugin repository; its unit tests run with `node --test .github/scripts/dependency-gate.test.mjs` and in CI.
1017
+
1018
+ - **Merged automatically** (squash merge by `github-actions`): an explicit patch or minor update, after the repository's own checks pass, the gate finds nothing below, and every other check on the PR head commit has finished green: every CI job and matrix entry (for example Node versions, peer floor, React 19 StrictMode) and CodeQL where present. The merge is bound to that exact commit (`--match-head-commit`).
1019
+ - **Held for review** (label `needs-review` plus a comment with the reasons, never merged automatically) when:
1020
+ - a changed package's `engines.node` no longer covers a Node version this plugin supports, or its `peerDependencies` no longer match the installed tree or this plugin's peer floor;
1021
+ - the PR body or release notes mention a breaking change;
1022
+ - the published surface changes: the `npm pack` file list (content hashes ignored), `exports`, `peerDependencies`, `engines`, or the exports of the built entry files;
1023
+ - a runtime dependency on 0.x gets a minor bump;
1024
+ - dependency review reports a vulnerability of moderate or higher, or a license outside the allowlist (MIT, MIT-0, ISC, BSD, Apache-2.0, 0BSD, BlueOak-1.0.0, CC0-1.0, Unlicense, Python-2.0, Zlib; MPL-2.0 and CC-BY for development dependencies only);
1025
+ - `npm audit signatures` reports a missing or invalid registry signature or provenance attestation;
1026
+ - the lockfile adds a package with an install script, more than 15 packages that are new to the tree, or a package that does not resolve from `registry.npmjs.org`;
1027
+ - a check fails, or the CI does not finish within 75 minutes.
1028
+ - **Major updates** get the `major-update` label and a comment; a person reads the changelog and merges by hand.
1029
+
1030
+ The gate script runs from the default branch and reads lockfiles and reports as data; it never runs code from the pull request. Only the surface job installs (without lifecycle scripts) and builds the pull request, with a read-only token. Merges made with `GITHUB_TOKEN` do not start `release.yml`, so a dependency update ships with the next regular release.
1031
+
1010
1032
  ## Languages
1011
1033
 
1012
1034
  The admin interface is available in English, German (formal "Sie"), French, Spanish and Portuguese, and follows the Strapi admin language. Dates use the admin locale.
1013
1035
 
1014
1036
  ---
1015
1037
 
1038
+ ## Showcase your company
1039
+
1040
+ Using Magic Session Manager in production? [Add your company](https://github.com/Schero94/Magic-Sessionmanager/issues/new?template=showcase.yml) to the "Used by" section of the [documentation site](https://schero94.github.io/Magic-Sessionmanager/#used-by). The form asks for the company name, the website, a logo (PNG, JPEG or WebP, uploaded to the issue) and an optional one-line description.
1041
+
1042
+ A maintainer reviews every request and approves it with the `showcase-approved` label. `.github/workflows/showcase.yml` then validates the issue with `.github/scripts/showcase.mjs`, converts the logo to a WebP of at most 320 x 160 pixels and opens a `docs:` pull request that changes `docs/site/showcase.json`. The logo appears on the site after that pull request is merged. Website links carry `rel="ugc noopener"`. To remove an entry, open an issue that names the company; a maintainer then applies the `showcase-remove` label.
1043
+
1016
1044
  ## License
1017
1045
 
1018
1046
  MIT License. Copyright © 2025 Schero D. See [LICENSE](https://github.com/Schero94/Magic-Sessionmanager/blob/main/LICENSE).
@@ -7,7 +7,7 @@ import styled from "styled-components";
7
7
  import { Typography, Flex, LinkButton, Button, EmptyStateLayout, VisuallyHidden } from "@strapi/design-system";
8
8
  import { ArrowClockwise, ChartBubble, User, Clock, Calendar } from "@strapi/icons";
9
9
  import { EmptyDocuments } from "@strapi/icons/symbols";
10
- import { K as normalizeDeviceType, u as useSessionFormatters, l as pluginId, m as logSafeAdminError, n as PersistentAlert, R as ReadableText, w as PageShell, x as StatGrid, y as StatCard, G as EqualGrid, b as getTranslation, L as getDeviceTypeMessage } from "./index-BcQdNWzu.mjs";
10
+ import { K as normalizeDeviceType, u as useSessionFormatters, l as pluginId, s as isCancelledRequest, m as logSafeAdminError, n as PersistentAlert, R as ReadableText, w as PageShell, x as StatGrid, y as StatCard, G as EqualGrid, b as getTranslation, L as getDeviceTypeMessage } from "./index-MOJkFXcZ.mjs";
11
11
  import { S as SectionCard } from "./SectionCard-D51bv4Hi.mjs";
12
12
  const ANALYTICS_UNKNOWN_KEY = "unknown";
13
13
  const VERSION_TOKEN = /^v?\d[\w.]*$/i;
@@ -174,23 +174,29 @@ const AnalyticsPage = () => {
174
174
  const [updatedAt, setUpdatedAt] = useState(null);
175
175
  const [loadError, setLoadError] = useState(false);
176
176
  const [forbidden, setForbidden] = useState(false);
177
- const requestPendingRef = useRef(false);
177
+ const requestPendingRef = useRef(null);
178
178
  const fetchAnalytics = useCallback(async () => {
179
179
  if (requestPendingRef.current) return;
180
- requestPendingRef.current = true;
180
+ const request = {};
181
+ requestPendingRef.current = request;
182
+ const isCurrent = () => requestPendingRef.current === request;
181
183
  try {
182
184
  const { data } = await get(`/${pluginId}/sessions/analytics`);
185
+ if (!isCurrent()) return;
183
186
  setAnalytics(analyticsFromServer(data));
184
187
  setUpdatedAt(Date.now());
185
188
  setLoadError(false);
186
189
  } catch (err) {
190
+ if (!isCurrent() || isCancelledRequest(err)) return;
187
191
  logSafeAdminError("analytics.load", err);
188
192
  if (isForbidden(err)) setForbidden(true);
189
193
  setLoadError(true);
190
194
  } finally {
191
- requestPendingRef.current = false;
192
- setRefreshing(false);
193
- setLoading(false);
195
+ if (isCurrent()) {
196
+ requestPendingRef.current = null;
197
+ setRefreshing(false);
198
+ setLoading(false);
199
+ }
194
200
  }
195
201
  }, [get]);
196
202
  const handleRefresh = () => {
@@ -200,6 +206,9 @@ const AnalyticsPage = () => {
200
206
  };
201
207
  useEffect(() => {
202
208
  void fetchAnalytics();
209
+ return () => {
210
+ requestPendingRef.current = null;
211
+ };
203
212
  }, [fetchAnalytics]);
204
213
  if (loading) {
205
214
  return /* @__PURE__ */ jsx(Page.Loading, {});
@@ -9,7 +9,7 @@ const styled = require("styled-components");
9
9
  const designSystem = require("@strapi/design-system");
10
10
  const icons = require("@strapi/icons");
11
11
  const symbols = require("@strapi/icons/symbols");
12
- const index = require("./index-BBZNey0n.js");
12
+ const index = require("./index-1KmiZSfy.js");
13
13
  const SectionCard = require("./SectionCard-BlWv8CRt.js");
14
14
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
15
15
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
@@ -178,23 +178,29 @@ const AnalyticsPage = () => {
178
178
  const [updatedAt, setUpdatedAt] = react.useState(null);
179
179
  const [loadError, setLoadError] = react.useState(false);
180
180
  const [forbidden, setForbidden] = react.useState(false);
181
- const requestPendingRef = react.useRef(false);
181
+ const requestPendingRef = react.useRef(null);
182
182
  const fetchAnalytics = react.useCallback(async () => {
183
183
  if (requestPendingRef.current) return;
184
- requestPendingRef.current = true;
184
+ const request = {};
185
+ requestPendingRef.current = request;
186
+ const isCurrent = () => requestPendingRef.current === request;
185
187
  try {
186
188
  const { data } = await get(`/${index.pluginId}/sessions/analytics`);
189
+ if (!isCurrent()) return;
187
190
  setAnalytics(analyticsFromServer(data));
188
191
  setUpdatedAt(Date.now());
189
192
  setLoadError(false);
190
193
  } catch (err) {
194
+ if (!isCurrent() || index.isCancelledRequest(err)) return;
191
195
  index.logSafeAdminError("analytics.load", err);
192
196
  if (isForbidden(err)) setForbidden(true);
193
197
  setLoadError(true);
194
198
  } finally {
195
- requestPendingRef.current = false;
196
- setRefreshing(false);
197
- setLoading(false);
199
+ if (isCurrent()) {
200
+ requestPendingRef.current = null;
201
+ setRefreshing(false);
202
+ setLoading(false);
203
+ }
198
204
  }
199
205
  }, [get]);
200
206
  const handleRefresh = () => {
@@ -204,6 +210,9 @@ const AnalyticsPage = () => {
204
210
  };
205
211
  react.useEffect(() => {
206
212
  void fetchAnalytics();
213
+ return () => {
214
+ requestPendingRef.current = null;
215
+ };
207
216
  }, [fetchAnalytics]);
208
217
  if (loading) {
209
218
  return /* @__PURE__ */ jsxRuntime.jsx(StrapiAdmin.Page.Loading, {});
@@ -3,11 +3,11 @@ import { useFetchClient, useNotification, useClipboard, useRBAC, useQueryParams,
3
3
  import { NavLink, Link as Link$1, Routes, Route } from "react-router-dom";
4
4
  import { useMemo, useState, useEffect, useRef, useCallback, useId, useLayoutEffect } from "react";
5
5
  import { useIntl } from "react-intl";
6
- import { Typography, Flex, Loader, Button, Modal, Accordion, Box, IconButton, Link, IconButtonGroup, SimpleMenu, MenuItem, Grid, Table, Thead, Tr, Th, VisuallyHidden, Tbody, Td, Tooltip, SearchForm, Searchbar, TextButton, SingleSelect, SingleSelectOption, EmptyStateLayout, LinkButton, Badge, Dialog } from "@strapi/design-system";
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, Dialog } from "@strapi/design-system";
7
7
  import { Earth, Duplicate, Cross, Eye, Trash, More, CaretDown, Download, ArrowClockwise, Check, Clock, User, ChartBubble, Cog, SignOut } from "@strapi/icons";
8
8
  import { EmptyDocuments } from "@strapi/icons/symbols";
9
9
  import styled, { useTheme } from "styled-components";
10
- import { g as getSessionEndReason, a as getEndReasonPresentation, b as getTranslation, p as presentText, i as isSessionFilter, D as DEFAULT_SESSION_FILTER, c as isEndReasonFilter, d as DEFAULT_END_REASON_FILTER, e as getDevicePresentation, u as useSessionFormatters, f as getSessionStatus, h as isNativeOnlySession, j as getSessionEndReasonPresentation, k as DeviceIcon, S as StatusBadge, P as PropertyList, C as ConfirmAction, t as toValidDate, l as pluginId, m as logSafeAdminError, n as PersistentAlert, R as ReadableText, o as pluginPermissions, M as MissingValue, V as ValueOrMissing, q as SESSION_STATES, r as SESSION_STATUS_PRESENTATION, s as isCancelledRequest, v as SESSION_FILTER_OPTIONS, E as END_REASON_FILTER_OPTIONS, w as PageShell, x as StatGrid, y as StatCard, z as restoreDialogFocus, A as requireSessionList, B as getBadgeColors } from "./index-BcQdNWzu.mjs";
10
+ import { g as getSessionEndReason, a as getEndReasonPresentation, b as getTranslation, p as presentText, i as isSessionFilter, D as DEFAULT_SESSION_FILTER, c as isEndReasonFilter, d as DEFAULT_END_REASON_FILTER, e as getDevicePresentation, u as useSessionFormatters, f as getSessionStatus, h as isNativeOnlySession, j as getSessionEndReasonPresentation, k as DeviceIcon, S as StatusBadge, P as PropertyList, C as ConfirmAction, t as toValidDate, l as pluginId, m as logSafeAdminError, n as PersistentAlert, R as ReadableText, o as pluginPermissions, M as MissingValue, V as ValueOrMissing, q as SESSION_STATES, r as SESSION_STATUS_PRESENTATION, s as isCancelledRequest, v as SESSION_FILTER_OPTIONS, E as END_REASON_FILTER_OPTIONS, w as PageShell, x as StatGrid, y as StatCard, z as restoreDialogFocus, A as requireSessionList, B as getBadgeColors } from "./index-MOJkFXcZ.mjs";
11
11
  const EndReason = ({ session, reason, variant = "omega", textColor = "neutral800" }) => {
12
12
  const { formatMessage } = useIntl();
13
13
  const key = reason || getSessionEndReason(session);
@@ -19,6 +19,7 @@ const EndReason = ({ session, reason, variant = "omega", textColor = "neutral800
19
19
  });
20
20
  return /* @__PURE__ */ jsx(Typography, { variant, textColor, "data-end-reason": presentation.reason, children: translate(presentation) });
21
21
  };
22
+ const RowActions = ({ children, ...props }) => /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", alignItems: "center", gap: 1, "data-row-actions": "", ...props, children });
22
23
  const MAX_EXPORT_ROWS = 5e4;
23
24
  const EXPORT_BATCH_SIZE = 1e3;
24
25
  const EMPTY_SESSION_STATS = Object.freeze({
@@ -931,7 +932,7 @@ const SessionActions = ({
931
932
  );
932
933
  const endKey = `end-${session.id}-${canEnd ? "open" : "ended"}`;
933
934
  if (layout === "table") {
934
- return /* @__PURE__ */ jsxs(IconButtonGroup, { onKeyDown: isolateActionKeys, onClick: (event) => event.stopPropagation(), children: [
935
+ return /* @__PURE__ */ jsxs(RowActions, { onKeyDown: isolateActionKeys, onClick: (event) => event.stopPropagation(), children: [
935
936
  /* @__PURE__ */ jsx(
936
937
  IconButton,
937
938
  {
@@ -2592,7 +2593,7 @@ const AdminTable = ({
2592
2593
  /* @__PURE__ */ jsx(Td, { style: SHRINKING_ROLES_CELL, children: /* @__PURE__ */ jsx(AdminRoles, { admin }) }),
2593
2594
  /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(AdminStatus, { admin }) }),
2594
2595
  /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(LastActive, { value: admin.lastActiveAt }) }),
2595
- /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxs(IconButtonGroup, { children: [
2596
+ /* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(RowActions, { children: [
2596
2597
  /* @__PURE__ */ jsx(
2597
2598
  IconButton,
2598
2599
  {
@@ -2618,7 +2619,7 @@ const AdminTable = ({
2618
2619
  children: /* @__PURE__ */ jsx(SignOut, {})
2619
2620
  }
2620
2621
  ) : null
2621
- ] }) }) })
2622
+ ] }) })
2622
2623
  ] }, admin.id)) })
2623
2624
  ]
2624
2625
  }
@@ -9,7 +9,7 @@ const designSystem = require("@strapi/design-system");
9
9
  const icons = require("@strapi/icons");
10
10
  const symbols = require("@strapi/icons/symbols");
11
11
  const styled = require("styled-components");
12
- const index = require("./index-BBZNey0n.js");
12
+ const index = require("./index-1KmiZSfy.js");
13
13
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
14
14
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
15
15
  const EndReason = ({ session, reason, variant = "omega", textColor = "neutral800" }) => {
@@ -23,6 +23,7 @@ const EndReason = ({ session, reason, variant = "omega", textColor = "neutral800
23
23
  });
24
24
  return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant, textColor, "data-end-reason": presentation.reason, children: translate(presentation) });
25
25
  };
26
+ const RowActions = ({ children, ...props }) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", alignItems: "center", gap: 1, "data-row-actions": "", ...props, children });
26
27
  const MAX_EXPORT_ROWS = 5e4;
27
28
  const EXPORT_BATCH_SIZE = 1e3;
28
29
  const EMPTY_SESSION_STATS = Object.freeze({
@@ -935,7 +936,7 @@ const SessionActions = ({
935
936
  );
936
937
  const endKey = `end-${session.id}-${canEnd ? "open" : "ended"}`;
937
938
  if (layout === "table") {
938
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.IconButtonGroup, { onKeyDown: isolateActionKeys, onClick: (event) => event.stopPropagation(), children: [
939
+ return /* @__PURE__ */ jsxRuntime.jsxs(RowActions, { onKeyDown: isolateActionKeys, onClick: (event) => event.stopPropagation(), children: [
939
940
  /* @__PURE__ */ jsxRuntime.jsx(
940
941
  designSystem.IconButton,
941
942
  {
@@ -2596,7 +2597,7 @@ const AdminTable = ({
2596
2597
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { style: SHRINKING_ROLES_CELL, children: /* @__PURE__ */ jsxRuntime.jsx(AdminRoles, { admin }) }),
2597
2598
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(AdminStatus, { admin }) }),
2598
2599
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(LastActive, { value: admin.lastActiveAt }) }),
2599
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.IconButtonGroup, { children: [
2600
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(RowActions, { children: [
2600
2601
  /* @__PURE__ */ jsxRuntime.jsx(
2601
2602
  designSystem.IconButton,
2602
2603
  {
@@ -2622,7 +2623,7 @@ const AdminTable = ({
2622
2623
  children: /* @__PURE__ */ jsxRuntime.jsx(icons.SignOut, {})
2623
2624
  }
2624
2625
  ) : null
2625
- ] }) }) })
2626
+ ] }) })
2626
2627
  ] }, admin.id)) })
2627
2628
  ]
2628
2629
  }
@@ -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 { m as logSafeAdminError, s as isCancelledRequest, b as getTranslation, R as ReadableText, M as MissingValue } from "./index-BcQdNWzu.mjs";
9
+ import { m as logSafeAdminError, s as isCancelledRequest, b as getTranslation, R as ReadableText, M as MissingValue } from "./index-MOJkFXcZ.mjs";
10
10
  function normalizeUserCounts(response) {
11
11
  const totalUsers = response?.data?.totalUsers;
12
12
  const blockedUsers = response?.data?.blockedUsers;
@@ -134,16 +134,19 @@ const OnlineUsersWidget = () => {
134
134
  const [userCounts, setUserCounts] = useState(null);
135
135
  const [loading, setLoading] = useState(true);
136
136
  const [loadError, setLoadError] = useState(false);
137
- const requestInProgress = useRef(false);
137
+ const requestInProgress = useRef(null);
138
138
  const fetchStats = useCallback(
139
139
  async ({ showLoading = true } = {}) => {
140
140
  if (requestInProgress.current) return;
141
- requestInProgress.current = true;
141
+ const request = {};
142
+ requestInProgress.current = request;
143
+ const isCurrent = () => requestInProgress.current === request;
142
144
  try {
143
145
  const [sessionResult, countResult] = await Promise.allSettled([
144
146
  get("/magic-sessionmanager/sessions/stats"),
145
147
  get("/magic-sessionmanager/users/stats")
146
148
  ]);
149
+ if (!isCurrent()) return;
147
150
  if (sessionResult.status === "rejected") throw sessionResult.reason;
148
151
  setStats(widgetStatsFromCounts(sessionResult.value?.data));
149
152
  setLoadError(false);
@@ -158,12 +161,14 @@ const OnlineUsersWidget = () => {
158
161
  if (showLoading) setUserCounts(null);
159
162
  }
160
163
  } catch (error) {
161
- if (isCancelledRequest(error)) return;
164
+ if (!isCurrent() || isCancelledRequest(error)) return;
162
165
  logSafeAdminError("onlineUsers.loadSessions", error);
163
166
  if (showLoading) setLoadError(true);
164
167
  } finally {
165
- if (showLoading) setLoading(false);
166
- requestInProgress.current = false;
168
+ if (isCurrent()) {
169
+ if (showLoading) setLoading(false);
170
+ requestInProgress.current = null;
171
+ }
167
172
  }
168
173
  },
169
174
  [get]
@@ -173,7 +178,10 @@ const OnlineUsersWidget = () => {
173
178
  const interval = setInterval(() => {
174
179
  void fetchStats({ showLoading: false });
175
180
  }, REFRESH_INTERVAL_MS);
176
- return () => clearInterval(interval);
181
+ return () => {
182
+ clearInterval(interval);
183
+ requestInProgress.current = null;
184
+ };
177
185
  }, [fetchStats]);
178
186
  if (loading) {
179
187
  return /* @__PURE__ */ jsx(LoadingState, { label: t("widget.loading", "Loading online users") });
@@ -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-BBZNey0n.js");
10
+ const index = require("./index-1KmiZSfy.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;
@@ -155,16 +155,19 @@ const OnlineUsersWidget = () => {
155
155
  const [userCounts, setUserCounts] = react.useState(null);
156
156
  const [loading, setLoading] = react.useState(true);
157
157
  const [loadError, setLoadError] = react.useState(false);
158
- const requestInProgress = react.useRef(false);
158
+ const requestInProgress = react.useRef(null);
159
159
  const fetchStats = react.useCallback(
160
160
  async ({ showLoading = true } = {}) => {
161
161
  if (requestInProgress.current) return;
162
- requestInProgress.current = true;
162
+ const request = {};
163
+ requestInProgress.current = request;
164
+ const isCurrent = () => requestInProgress.current === request;
163
165
  try {
164
166
  const [sessionResult, countResult] = await Promise.allSettled([
165
167
  get("/magic-sessionmanager/sessions/stats"),
166
168
  get("/magic-sessionmanager/users/stats")
167
169
  ]);
170
+ if (!isCurrent()) return;
168
171
  if (sessionResult.status === "rejected") throw sessionResult.reason;
169
172
  setStats(widgetStatsFromCounts(sessionResult.value?.data));
170
173
  setLoadError(false);
@@ -179,12 +182,14 @@ const OnlineUsersWidget = () => {
179
182
  if (showLoading) setUserCounts(null);
180
183
  }
181
184
  } catch (error) {
182
- if (index.isCancelledRequest(error)) return;
185
+ if (!isCurrent() || index.isCancelledRequest(error)) return;
183
186
  index.logSafeAdminError("onlineUsers.loadSessions", error);
184
187
  if (showLoading) setLoadError(true);
185
188
  } finally {
186
- if (showLoading) setLoading(false);
187
- requestInProgress.current = false;
189
+ if (isCurrent()) {
190
+ if (showLoading) setLoading(false);
191
+ requestInProgress.current = null;
192
+ }
188
193
  }
189
194
  },
190
195
  [get]
@@ -194,7 +199,10 @@ const OnlineUsersWidget = () => {
194
199
  const interval = setInterval(() => {
195
200
  void fetchStats({ showLoading: false });
196
201
  }, REFRESH_INTERVAL_MS);
197
- return () => clearInterval(interval);
202
+ return () => {
203
+ clearInterval(interval);
204
+ requestInProgress.current = null;
205
+ };
198
206
  }, [fetchStats]);
199
207
  if (loading) {
200
208
  return /* @__PURE__ */ jsxRuntime.jsx(LoadingState, { label: t("widget.loading", "Loading online users") });
@@ -4,7 +4,7 @@ import { Field, Typography, Switch, Box, TextInput, Flex, Button, Link, SingleSe
4
4
  import { ConfirmDialog, useNotification, useFetchClient, useQueryParams, Page, Form, Blocker, useForm } from "@strapi/strapi/admin";
5
5
  import { EyeStriked, Eye, Key, Duplicate, Cross, Plus, Trash, Check } from "@strapi/icons";
6
6
  import styled from "styled-components";
7
- import { F as ReadableParagraphs, b as getTranslation, m as logSafeAdminError, R as ReadableText, G as EqualGrid, n as PersistentAlert, P as PropertyList, H as formatSessionDate, C as ConfirmAction, I as refocusIfLost, l as pluginId, J as requireSuccessfulMutation, w as PageShell } from "./index-BcQdNWzu.mjs";
7
+ import { F as ReadableParagraphs, b as getTranslation, m as logSafeAdminError, R as ReadableText, G as EqualGrid, n as PersistentAlert, P as PropertyList, H as formatSessionDate, C as ConfirmAction, I as refocusIfLost, l as pluginId, s as isCancelledRequest, J as requireSuccessfulMutation, w as PageShell } from "./index-MOJkFXcZ.mjs";
8
8
  import { useIntl } from "react-intl";
9
9
  import { S as SectionCard } from "./SectionCard-D51bv4Hi.mjs";
10
10
  const SETTINGS_TAB_IDS = Object.freeze([
@@ -3107,6 +3107,7 @@ function useSettingsForm() {
3107
3107
  const settingsRef = useRef(settings);
3108
3108
  const savedSettingsRef = useRef(savedSettings);
3109
3109
  const revisionRef = useRef(null);
3110
+ const loadRequestRef = useRef(0);
3110
3111
  useLayoutEffect(() => {
3111
3112
  settingsRef.current = settings;
3112
3113
  savedSettingsRef.current = savedSettings;
@@ -3149,10 +3150,13 @@ function useSettingsForm() {
3149
3150
  }
3150
3151
  }, [get]);
3151
3152
  const fetchSettings = useCallback(async () => {
3153
+ const request = loadRequestRef.current + 1;
3154
+ loadRequestRef.current = request;
3152
3155
  setLoading(true);
3153
3156
  setLoadError(false);
3154
3157
  try {
3155
3158
  const response = await get(`/${pluginId}/settings`);
3159
+ if (request !== loadRequestRef.current) return;
3156
3160
  if (!response?.data?.settings || typeof response.data.settings !== "object" || Array.isArray(response.data.settings)) {
3157
3161
  throw new Error("Invalid settings response");
3158
3162
  }
@@ -3162,10 +3166,11 @@ function useSettingsForm() {
3162
3166
  setSavedSettings(nextSettings);
3163
3167
  await fetchGeoIpStatus();
3164
3168
  } catch (err) {
3169
+ if (request !== loadRequestRef.current || isCancelledRequest(err)) return;
3165
3170
  logSafeAdminError("settings.load", err);
3166
3171
  setLoadError(true);
3167
3172
  } finally {
3168
- setLoading(false);
3173
+ if (request === loadRequestRef.current) setLoading(false);
3169
3174
  }
3170
3175
  }, [get, fetchGeoIpStatus]);
3171
3176
  const fetchSettingsRef = useRef(fetchSettings);
@@ -6,7 +6,7 @@ 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-BBZNey0n.js");
9
+ const index = require("./index-1KmiZSfy.js");
10
10
  const reactIntl = require("react-intl");
11
11
  const SectionCard = require("./SectionCard-BlWv8CRt.js");
12
12
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
@@ -3111,6 +3111,7 @@ function useSettingsForm() {
3111
3111
  const settingsRef = react.useRef(settings);
3112
3112
  const savedSettingsRef = react.useRef(savedSettings);
3113
3113
  const revisionRef = react.useRef(null);
3114
+ const loadRequestRef = react.useRef(0);
3114
3115
  react.useLayoutEffect(() => {
3115
3116
  settingsRef.current = settings;
3116
3117
  savedSettingsRef.current = savedSettings;
@@ -3153,10 +3154,13 @@ function useSettingsForm() {
3153
3154
  }
3154
3155
  }, [get]);
3155
3156
  const fetchSettings = react.useCallback(async () => {
3157
+ const request = loadRequestRef.current + 1;
3158
+ loadRequestRef.current = request;
3156
3159
  setLoading(true);
3157
3160
  setLoadError(false);
3158
3161
  try {
3159
3162
  const response = await get(`/${index.pluginId}/settings`);
3163
+ if (request !== loadRequestRef.current) return;
3160
3164
  if (!response?.data?.settings || typeof response.data.settings !== "object" || Array.isArray(response.data.settings)) {
3161
3165
  throw new Error("Invalid settings response");
3162
3166
  }
@@ -3166,10 +3170,11 @@ function useSettingsForm() {
3166
3170
  setSavedSettings(nextSettings);
3167
3171
  await fetchGeoIpStatus();
3168
3172
  } catch (err) {
3173
+ if (request !== loadRequestRef.current || index.isCancelledRequest(err)) return;
3169
3174
  index.logSafeAdminError("settings.load", err);
3170
3175
  setLoadError(true);
3171
3176
  } finally {
3172
- setLoading(false);
3177
+ if (request === loadRequestRef.current) setLoading(false);
3173
3178
  }
3174
3179
  }, [get, fetchGeoIpStatus]);
3175
3180
  const fetchSettingsRef = react.useRef(fetchSettings);
@@ -1582,7 +1582,7 @@ const index = {
1582
1582
  id: `${pluginId}.plugin.name`,
1583
1583
  defaultMessage: pluginPkg.strapi.displayName
1584
1584
  },
1585
- Component: () => Promise.resolve().then(() => require("./App-DcxqQfMT.js")),
1585
+ Component: () => Promise.resolve().then(() => require("./App-UlRrLKcx.js")),
1586
1586
  permissions: pluginPermissions$1
1587
1587
  });
1588
1588
  app.addSettingsLink(
@@ -1598,7 +1598,7 @@ const index = {
1598
1598
  },
1599
1599
  id: "general",
1600
1600
  to: `${pluginId}/general`,
1601
- Component: () => Promise.resolve().then(() => require("./Settings-XdBlPves.js")),
1601
+ Component: () => Promise.resolve().then(() => require("./Settings-DVhW9XHB.js")),
1602
1602
  permissions: pluginPermissions$1
1603
1603
  },
1604
1604
  {
@@ -1608,7 +1608,7 @@ const index = {
1608
1608
  },
1609
1609
  id: "analytics",
1610
1610
  to: `${pluginId}/analytics`,
1611
- Component: () => Promise.resolve().then(() => require("./Analytics-DSG3shUY.js")),
1611
+ Component: () => Promise.resolve().then(() => require("./Analytics-DSpn7W5A.js")),
1612
1612
  permissions: pluginPermissions$1
1613
1613
  }
1614
1614
  ]
@@ -1634,7 +1634,7 @@ const index = {
1634
1634
  href: `/plugins/${pluginId}`
1635
1635
  },
1636
1636
  component: async () => {
1637
- const component = await Promise.resolve().then(() => require("./OnlineUsersWidget-CCTnV-aE.js"));
1637
+ const component = await Promise.resolve().then(() => require("./OnlineUsersWidget-GFcYyZ9L.js"));
1638
1638
  return component.default;
1639
1639
  },
1640
1640
  id: "online-users-widget",
@@ -1579,7 +1579,7 @@ const index = {
1579
1579
  id: `${pluginId}.plugin.name`,
1580
1580
  defaultMessage: pluginPkg.strapi.displayName
1581
1581
  },
1582
- Component: () => import("./App-BRj2qIUs.mjs"),
1582
+ Component: () => import("./App-BBne8xI6.mjs"),
1583
1583
  permissions: pluginPermissions$1
1584
1584
  });
1585
1585
  app.addSettingsLink(
@@ -1595,7 +1595,7 @@ const index = {
1595
1595
  },
1596
1596
  id: "general",
1597
1597
  to: `${pluginId}/general`,
1598
- Component: () => import("./Settings-BNPO9cXS.mjs"),
1598
+ Component: () => import("./Settings-BbUNvjno.mjs"),
1599
1599
  permissions: pluginPermissions$1
1600
1600
  },
1601
1601
  {
@@ -1605,7 +1605,7 @@ const index = {
1605
1605
  },
1606
1606
  id: "analytics",
1607
1607
  to: `${pluginId}/analytics`,
1608
- Component: () => import("./Analytics-oW2QbDj4.mjs"),
1608
+ Component: () => import("./Analytics-CFEgpg-G.mjs"),
1609
1609
  permissions: pluginPermissions$1
1610
1610
  }
1611
1611
  ]
@@ -1631,7 +1631,7 @@ const index = {
1631
1631
  href: `/plugins/${pluginId}`
1632
1632
  },
1633
1633
  component: async () => {
1634
- const component = await import("./OnlineUsersWidget-wxDYyK5v.mjs");
1634
+ const component = await import("./OnlineUsersWidget-C3YMTEGD.mjs");
1635
1635
  return component.default;
1636
1636
  },
1637
1637
  id: "online-users-widget",
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const index = require("./index-BBZNey0n.js");
3
+ const index = require("./index-1KmiZSfy.js");
4
4
  exports.default = index.index;
@@ -1,4 +1,4 @@
1
- import { N } from "./index-BcQdNWzu.mjs";
1
+ import { N } from "./index-MOJkFXcZ.mjs";
2
2
  export {
3
3
  N as default
4
4
  };
package/package.json CHANGED
@@ -1,5 +1,5 @@
1
1
  {
2
- "version": "4.14.1",
2
+ "version": "4.14.3",
3
3
  "keywords": [
4
4
  "strapi",
5
5
  "strapi-plugin",
@@ -50,6 +50,7 @@
50
50
  "scripts": {
51
51
  "clean": "node -e \"require('fs').rmSync('dist', { recursive: true, force: true })\"",
52
52
  "test": "node --test tests/*.test.js tests/*.test.mjs",
53
+ "test:admin": "node --import ./tests/admin/harness/setup.mjs --test \"tests/admin/*.test.jsx\"",
53
54
  "test:concurrency": "node scripts/concurrency/run.mjs",
54
55
  "test:ts:front": "tsc --noEmit --allowJs --jsx react-jsx --moduleResolution bundler --module esnext -p admin/jsconfig.json",
55
56
  "test:ts:back": "tsc --noEmit --allowJs --moduleResolution node --module commonjs -p server/jsconfig.json",
@@ -80,15 +81,16 @@
80
81
  "@semantic-release/release-notes-generator": "^14.1.1",
81
82
  "@strapi/design-system": "^2.3.1",
82
83
  "@strapi/icons": "^2.3.1",
83
- "@strapi/plugin-users-permissions": "^5.62.0",
84
+ "@strapi/plugin-users-permissions": "^5.63.0",
84
85
  "@strapi/sdk-plugin": "^6.1.1",
85
- "@strapi/strapi": "^5.62.0",
86
+ "@strapi/strapi": "^5.63.0",
86
87
  "better-sqlite3": "^13.0.3",
87
88
  "esbuild": "^0.28.2",
88
89
  "eslint": "^10.14.0",
89
90
  "eslint-config-prettier": "^10.1.8",
90
91
  "eslint-plugin-react-hooks": "^7.1.1",
91
92
  "globals": "^17.14.0",
93
+ "jsdom": "^31.0.1",
92
94
  "pg": "^8.23.1",
93
95
  "prettier": "^3.9.10",
94
96
  "react": "^18.3.1",