strapi-plugin-magic-sessionmanager 4.7.0 → 4.7.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 (30) hide show
  1. package/CHANGELOG.md +7 -0
  2. package/dist/admin/{Analytics-Dq8PuDhs.mjs → Analytics-CsrpxJwQ.mjs} +86 -69
  3. package/dist/admin/{Analytics-Cw6R2xZn.js → Analytics-D03ZNNMR.js} +86 -69
  4. package/dist/admin/{App-DLR2M3FT.js → App-B2VCS3cz.js} +22 -27
  5. package/dist/admin/{App-BIFTc3mk.mjs → App-qxKnK7G2.mjs} +9 -14
  6. package/dist/admin/{License-W_NPUWIn.mjs → License-ClW7sZLR.mjs} +1 -1
  7. package/dist/admin/{License-BZtjgFol.js → License-fixnQ7wF.js} +1 -1
  8. package/dist/admin/{OnlineUsersWidget-BIbmzgLP.mjs → OnlineUsersWidget-mR_OMiwi.mjs} +1 -2
  9. package/dist/admin/{OnlineUsersWidget-CAdR0MfU.js → OnlineUsersWidget-qb9utPBy.js} +1 -2
  10. package/dist/admin/{Settings-BNu9EAuS.mjs → Settings-U3V4eGMo.mjs} +1 -1
  11. package/dist/admin/{Settings-DWaflQdm.js → Settings-gv2BF54w.js} +1 -1
  12. package/dist/admin/{de-jU7AaYIc.js → de-BnqGCokx.js} +2 -2
  13. package/dist/admin/{de-4pAz-Ihh.mjs → de-JBE-iylO.mjs} +2 -2
  14. package/dist/admin/{en-Tjp9AEhR.js → en-BRmVwd8-.js} +2 -2
  15. package/dist/admin/{en-BI_aBNXG.mjs → en-kQWtdEai.mjs} +2 -2
  16. package/dist/admin/{es-BCgwFZPL.js → es-CH691xcL.js} +2 -2
  17. package/dist/admin/{es-Bp4Uzf5h.mjs → es-DOQvBxih.mjs} +2 -2
  18. package/dist/admin/{fr-Di5zo4wy.js → fr-CLExO0w_.js} +2 -2
  19. package/dist/admin/{fr-B69qIjq2.mjs → fr-CmfCpepX.mjs} +2 -2
  20. package/dist/admin/{index-eSND7TDx.mjs → index-B_lFjUAg.mjs} +15 -15
  21. package/dist/admin/{index-CBS3aqCW.js → index-Duc7cR_d.js} +15 -15
  22. package/dist/admin/index.js +1 -1
  23. package/dist/admin/index.mjs +1 -1
  24. package/dist/admin/{pt-DlGYOi6D.js → pt-BJ_F0yNi.js} +2 -2
  25. package/dist/admin/{pt-Drc-di4D.mjs → pt-BSzZdyAH.mjs} +2 -2
  26. package/dist/admin/sessionStatus-D_fWEzgj.js +11 -0
  27. package/dist/admin/sessionStatus-kwggjEMw.mjs +12 -0
  28. package/dist/server/index.js +558 -301
  29. package/dist/server/index.mjs +558 -301
  30. package/package.json +2 -2
package/CHANGELOG.md CHANGED
@@ -1,3 +1,10 @@
1
+ ## [4.7.1](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.7.0...v4.7.1) (2026-07-10)
2
+
3
+
4
+ ### Bug Fixes
5
+
6
+ * harden session lifecycle and admin analytics ([8f32862](https://github.com/Schero94/Magic-Sessionmanager/commit/8f328626460988b1c75a10e580ad300bc81ccb0b))
7
+
1
8
  # [4.7.0](https://github.com/Schero94/Magic-Sessionmanager/compare/v4.6.4...v4.7.0) (2026-07-09)
2
9
 
3
10
 
@@ -4,7 +4,91 @@ import { useFetchClient } from "@strapi/strapi/admin";
4
4
  import styled, { css, keyframes } from "styled-components";
5
5
  import { Loader, Flex, Box, Badge, Typography } from "@strapi/design-system";
6
6
  import { ChartBubble, User, Clock, Monitor } from "@strapi/icons";
7
- import { a as pluginId } from "./index-eSND7TDx.mjs";
7
+ import { a as pluginId } from "./index-B_lFjUAg.mjs";
8
+ import { g as getSessionStatus } from "./sessionStatus-kwggjEMw.mjs";
9
+ function increment(target, key) {
10
+ target[key] = (target[key] || 0) + 1;
11
+ }
12
+ function getUserKey(session) {
13
+ return session?.user?.documentId || session?.user?.id || session?.user?.email || session?.user?.username || null;
14
+ }
15
+ function getDurationMinutes(session, now) {
16
+ const start = Date.parse(session?.loginTime);
17
+ if (!Number.isFinite(start)) return null;
18
+ const endValue = session.logoutTime || session.lastActive;
19
+ const end = endValue ? Date.parse(endValue) : now;
20
+ if (!Number.isFinite(end)) return null;
21
+ return Math.max(0, Math.floor((end - start) / 6e4));
22
+ }
23
+ function computeSessionAnalytics(sessions = [], { now = Date.now() } = {}) {
24
+ const dayAgo = now - 24 * 60 * 60 * 1e3;
25
+ const weekAgo = now - 7 * 24 * 60 * 60 * 1e3;
26
+ const devices = {};
27
+ const browsers = {};
28
+ const operatingSystems = {};
29
+ const loginHours = Array(24).fill(0);
30
+ const uniqueUsers = /* @__PURE__ */ new Set();
31
+ const uniqueIPs = /* @__PURE__ */ new Set();
32
+ const durations = [];
33
+ let todayLogins = 0;
34
+ let weekLogins = 0;
35
+ let loggedOut = 0;
36
+ let terminated = 0;
37
+ for (const session of sessions) {
38
+ const ua = String(session?.userAgent || "").toLowerCase();
39
+ const loginTime = Date.parse(session?.loginTime);
40
+ if (Number.isFinite(loginTime)) {
41
+ if (loginTime > dayAgo) todayLogins++;
42
+ if (loginTime > weekAgo) weekLogins++;
43
+ loginHours[new Date(loginTime).getHours()]++;
44
+ }
45
+ if (ua.includes("tablet") || ua.includes("ipad") || ua.includes("android") && !ua.includes("mobile")) {
46
+ increment(devices, "Tablet");
47
+ } else if (ua.includes("mobile") || ua.includes("android") || ua.includes("iphone")) {
48
+ increment(devices, "Mobile");
49
+ } else {
50
+ increment(devices, "Desktop");
51
+ }
52
+ if (ua.includes("edg")) increment(browsers, "Edge");
53
+ else if (ua.includes("chrome")) increment(browsers, "Chrome");
54
+ else if (ua.includes("firefox")) increment(browsers, "Firefox");
55
+ else if (ua.includes("safari")) increment(browsers, "Safari");
56
+ else if (ua.includes("postman") || ua.includes("curl")) increment(browsers, "API Client");
57
+ else increment(browsers, "Other");
58
+ if (ua.includes("android")) increment(operatingSystems, "Android");
59
+ else if (ua.includes("ios") || ua.includes("iphone") || ua.includes("ipad")) increment(operatingSystems, "iOS");
60
+ else if (ua.includes("windows") || ua.includes("win32") || ua.includes("win64")) increment(operatingSystems, "Windows");
61
+ else if (ua.includes("mac") || ua.includes("darwin")) increment(operatingSystems, "macOS");
62
+ else if (ua.includes("linux")) increment(operatingSystems, "Linux");
63
+ else increment(operatingSystems, "Other");
64
+ const userKey = getUserKey(session);
65
+ if (userKey) uniqueUsers.add(userKey);
66
+ if (session?.ipAddress) uniqueIPs.add(session.ipAddress);
67
+ const status = getSessionStatus(session);
68
+ if (status === "loggedout") loggedOut++;
69
+ else if (!session?.isActive && status === "terminated") terminated++;
70
+ const duration = getDurationMinutes(session, now);
71
+ if (duration !== null) durations.push(duration);
72
+ }
73
+ const mobileCount = (devices.Mobile || 0) + (devices.Tablet || 0);
74
+ return {
75
+ totalSessions: sessions.length,
76
+ activeSessions: sessions.filter((session) => session?.isActive && session?.isTrulyActive).length,
77
+ todayLogins,
78
+ weekLogins,
79
+ devices,
80
+ browsers,
81
+ operatingSystems,
82
+ loginHours,
83
+ peakHour: loginHours.indexOf(Math.max(...loginHours)),
84
+ uniqueUsers: uniqueUsers.size,
85
+ uniqueIPs: uniqueIPs.size,
86
+ loggedOut,
87
+ terminated,
88
+ mobileRatio: sessions.length > 0 ? Math.round(mobileCount / sessions.length * 100) : 0,
89
+ avgSessionDuration: durations.length > 0 ? Math.floor(durations.reduce((sum, duration) => sum + duration, 0) / durations.length) : 0
90
+ };
91
+ }
8
92
  const theme = {
9
93
  shadows: {
10
94
  sm: "0 1px 3px 0 rgba(0, 0, 0, 0.1)",
@@ -280,74 +364,7 @@ const AnalyticsPage = () => {
280
364
  try {
281
365
  const { data } = await get(`/${pluginId}/sessions`);
282
366
  const sessions = data.data || [];
283
- const now = Date.now();
284
- const dayAgo = now - 24 * 60 * 60 * 1e3;
285
- const weekAgo = now - 7 * 24 * 60 * 60 * 1e3;
286
- const todayLogins = sessions.filter((s) => new Date(s.loginTime).getTime() > dayAgo);
287
- const weekLogins = sessions.filter((s) => new Date(s.loginTime).getTime() > weekAgo);
288
- const devices = {};
289
- const browsers = {};
290
- const operatingSystems = {};
291
- const countries = {};
292
- const loginHours = Array(24).fill(0);
293
- const uniqueUsers = /* @__PURE__ */ new Set();
294
- const uniqueIPs = /* @__PURE__ */ new Set();
295
- sessions.forEach((session) => {
296
- const ua = session.userAgent.toLowerCase();
297
- if (ua.includes("mobile") || ua.includes("android") || ua.includes("iphone")) {
298
- devices["Mobile"] = (devices["Mobile"] || 0) + 1;
299
- } else if (ua.includes("tablet") || ua.includes("ipad")) {
300
- devices["Tablet"] = (devices["Tablet"] || 0) + 1;
301
- } else {
302
- devices["Desktop"] = (devices["Desktop"] || 0) + 1;
303
- }
304
- if (ua.includes("chrome") && !ua.includes("edg")) browsers["Chrome"] = (browsers["Chrome"] || 0) + 1;
305
- else if (ua.includes("firefox")) browsers["Firefox"] = (browsers["Firefox"] || 0) + 1;
306
- else if (ua.includes("safari") && !ua.includes("chrome")) browsers["Safari"] = (browsers["Safari"] || 0) + 1;
307
- else if (ua.includes("edg")) browsers["Edge"] = (browsers["Edge"] || 0) + 1;
308
- else if (ua.includes("postman") || ua.includes("curl")) browsers["API Client"] = (browsers["API Client"] || 0) + 1;
309
- else browsers["Other"] = (browsers["Other"] || 0) + 1;
310
- if (ua.includes("windows") || ua.includes("win32") || ua.includes("win64")) {
311
- operatingSystems["Windows"] = (operatingSystems["Windows"] || 0) + 1;
312
- } else if (ua.includes("mac") || ua.includes("darwin")) {
313
- operatingSystems["macOS"] = (operatingSystems["macOS"] || 0) + 1;
314
- } else if (ua.includes("linux")) {
315
- operatingSystems["Linux"] = (operatingSystems["Linux"] || 0) + 1;
316
- } else if (ua.includes("android")) {
317
- operatingSystems["Android"] = (operatingSystems["Android"] || 0) + 1;
318
- } else if (ua.includes("ios") || ua.includes("iphone") || ua.includes("ipad")) {
319
- operatingSystems["iOS"] = (operatingSystems["iOS"] || 0) + 1;
320
- } else {
321
- operatingSystems["Other"] = (operatingSystems["Other"] || 0) + 1;
322
- }
323
- const loginHour = new Date(session.loginTime).getHours();
324
- loginHours[loginHour]++;
325
- if (session.user?.id) uniqueUsers.add(session.user.id);
326
- if (session.ipAddress) uniqueIPs.add(session.ipAddress);
327
- });
328
- const peakHour = loginHours.indexOf(Math.max(...loginHours));
329
- const loggedOut = sessions.filter((s) => !s.isActive && s.logoutTime).length;
330
- const terminated = sessions.filter((s) => !s.isActive && !s.logoutTime).length;
331
- const mobileCount = (devices["Mobile"] || 0) + (devices["Tablet"] || 0);
332
- const desktopCount = devices["Desktop"] || 0;
333
- const mobileRatio = sessions.length > 0 ? Math.round(mobileCount / sessions.length * 100) : 0;
334
- setAnalytics({
335
- totalSessions: sessions.length,
336
- activeSessions: sessions.filter((s) => s.isActive && s.isTrulyActive).length,
337
- todayLogins: todayLogins.length,
338
- weekLogins: weekLogins.length,
339
- devices,
340
- browsers,
341
- operatingSystems,
342
- loginHours,
343
- peakHour,
344
- uniqueUsers: uniqueUsers.size,
345
- uniqueIPs: uniqueIPs.size,
346
- loggedOut,
347
- terminated,
348
- mobileRatio,
349
- avgSessionDuration: sessions.length > 0 ? Math.floor(sessions.reduce((sum, s) => sum + (s.minutesSinceActive || 0), 0) / sessions.length) : 0
350
- });
367
+ setAnalytics(computeSessionAnalytics(sessions));
351
368
  } catch (err) {
352
369
  console.error("[Analytics] Error:", err);
353
370
  } finally {
@@ -6,9 +6,93 @@ const admin = require("@strapi/strapi/admin");
6
6
  const styled = require("styled-components");
7
7
  const designSystem = require("@strapi/design-system");
8
8
  const icons = require("@strapi/icons");
9
- const index = require("./index-CBS3aqCW.js");
9
+ const index = require("./index-Duc7cR_d.js");
10
+ const sessionStatus = require("./sessionStatus-D_fWEzgj.js");
10
11
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
11
12
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
13
+ function increment(target, key) {
14
+ target[key] = (target[key] || 0) + 1;
15
+ }
16
+ function getUserKey(session) {
17
+ return session?.user?.documentId || session?.user?.id || session?.user?.email || session?.user?.username || null;
18
+ }
19
+ function getDurationMinutes(session, now) {
20
+ const start = Date.parse(session?.loginTime);
21
+ if (!Number.isFinite(start)) return null;
22
+ const endValue = session.logoutTime || session.lastActive;
23
+ const end = endValue ? Date.parse(endValue) : now;
24
+ if (!Number.isFinite(end)) return null;
25
+ return Math.max(0, Math.floor((end - start) / 6e4));
26
+ }
27
+ function computeSessionAnalytics(sessions = [], { now = Date.now() } = {}) {
28
+ const dayAgo = now - 24 * 60 * 60 * 1e3;
29
+ const weekAgo = now - 7 * 24 * 60 * 60 * 1e3;
30
+ const devices = {};
31
+ const browsers = {};
32
+ const operatingSystems = {};
33
+ const loginHours = Array(24).fill(0);
34
+ const uniqueUsers = /* @__PURE__ */ new Set();
35
+ const uniqueIPs = /* @__PURE__ */ new Set();
36
+ const durations = [];
37
+ let todayLogins = 0;
38
+ let weekLogins = 0;
39
+ let loggedOut = 0;
40
+ let terminated = 0;
41
+ for (const session of sessions) {
42
+ const ua = String(session?.userAgent || "").toLowerCase();
43
+ const loginTime = Date.parse(session?.loginTime);
44
+ if (Number.isFinite(loginTime)) {
45
+ if (loginTime > dayAgo) todayLogins++;
46
+ if (loginTime > weekAgo) weekLogins++;
47
+ loginHours[new Date(loginTime).getHours()]++;
48
+ }
49
+ if (ua.includes("tablet") || ua.includes("ipad") || ua.includes("android") && !ua.includes("mobile")) {
50
+ increment(devices, "Tablet");
51
+ } else if (ua.includes("mobile") || ua.includes("android") || ua.includes("iphone")) {
52
+ increment(devices, "Mobile");
53
+ } else {
54
+ increment(devices, "Desktop");
55
+ }
56
+ if (ua.includes("edg")) increment(browsers, "Edge");
57
+ else if (ua.includes("chrome")) increment(browsers, "Chrome");
58
+ else if (ua.includes("firefox")) increment(browsers, "Firefox");
59
+ else if (ua.includes("safari")) increment(browsers, "Safari");
60
+ else if (ua.includes("postman") || ua.includes("curl")) increment(browsers, "API Client");
61
+ else increment(browsers, "Other");
62
+ if (ua.includes("android")) increment(operatingSystems, "Android");
63
+ else if (ua.includes("ios") || ua.includes("iphone") || ua.includes("ipad")) increment(operatingSystems, "iOS");
64
+ else if (ua.includes("windows") || ua.includes("win32") || ua.includes("win64")) increment(operatingSystems, "Windows");
65
+ else if (ua.includes("mac") || ua.includes("darwin")) increment(operatingSystems, "macOS");
66
+ else if (ua.includes("linux")) increment(operatingSystems, "Linux");
67
+ else increment(operatingSystems, "Other");
68
+ const userKey = getUserKey(session);
69
+ if (userKey) uniqueUsers.add(userKey);
70
+ if (session?.ipAddress) uniqueIPs.add(session.ipAddress);
71
+ const status = sessionStatus.getSessionStatus(session);
72
+ if (status === "loggedout") loggedOut++;
73
+ else if (!session?.isActive && status === "terminated") terminated++;
74
+ const duration = getDurationMinutes(session, now);
75
+ if (duration !== null) durations.push(duration);
76
+ }
77
+ const mobileCount = (devices.Mobile || 0) + (devices.Tablet || 0);
78
+ return {
79
+ totalSessions: sessions.length,
80
+ activeSessions: sessions.filter((session) => session?.isActive && session?.isTrulyActive).length,
81
+ todayLogins,
82
+ weekLogins,
83
+ devices,
84
+ browsers,
85
+ operatingSystems,
86
+ loginHours,
87
+ peakHour: loginHours.indexOf(Math.max(...loginHours)),
88
+ uniqueUsers: uniqueUsers.size,
89
+ uniqueIPs: uniqueIPs.size,
90
+ loggedOut,
91
+ terminated,
92
+ mobileRatio: sessions.length > 0 ? Math.round(mobileCount / sessions.length * 100) : 0,
93
+ avgSessionDuration: durations.length > 0 ? Math.floor(durations.reduce((sum, duration) => sum + duration, 0) / durations.length) : 0
94
+ };
95
+ }
12
96
  const theme = {
13
97
  shadows: {
14
98
  sm: "0 1px 3px 0 rgba(0, 0, 0, 0.1)",
@@ -284,74 +368,7 @@ const AnalyticsPage = () => {
284
368
  try {
285
369
  const { data } = await get(`/${index.pluginId}/sessions`);
286
370
  const sessions = data.data || [];
287
- const now = Date.now();
288
- const dayAgo = now - 24 * 60 * 60 * 1e3;
289
- const weekAgo = now - 7 * 24 * 60 * 60 * 1e3;
290
- const todayLogins = sessions.filter((s) => new Date(s.loginTime).getTime() > dayAgo);
291
- const weekLogins = sessions.filter((s) => new Date(s.loginTime).getTime() > weekAgo);
292
- const devices = {};
293
- const browsers = {};
294
- const operatingSystems = {};
295
- const countries = {};
296
- const loginHours = Array(24).fill(0);
297
- const uniqueUsers = /* @__PURE__ */ new Set();
298
- const uniqueIPs = /* @__PURE__ */ new Set();
299
- sessions.forEach((session) => {
300
- const ua = session.userAgent.toLowerCase();
301
- if (ua.includes("mobile") || ua.includes("android") || ua.includes("iphone")) {
302
- devices["Mobile"] = (devices["Mobile"] || 0) + 1;
303
- } else if (ua.includes("tablet") || ua.includes("ipad")) {
304
- devices["Tablet"] = (devices["Tablet"] || 0) + 1;
305
- } else {
306
- devices["Desktop"] = (devices["Desktop"] || 0) + 1;
307
- }
308
- if (ua.includes("chrome") && !ua.includes("edg")) browsers["Chrome"] = (browsers["Chrome"] || 0) + 1;
309
- else if (ua.includes("firefox")) browsers["Firefox"] = (browsers["Firefox"] || 0) + 1;
310
- else if (ua.includes("safari") && !ua.includes("chrome")) browsers["Safari"] = (browsers["Safari"] || 0) + 1;
311
- else if (ua.includes("edg")) browsers["Edge"] = (browsers["Edge"] || 0) + 1;
312
- else if (ua.includes("postman") || ua.includes("curl")) browsers["API Client"] = (browsers["API Client"] || 0) + 1;
313
- else browsers["Other"] = (browsers["Other"] || 0) + 1;
314
- if (ua.includes("windows") || ua.includes("win32") || ua.includes("win64")) {
315
- operatingSystems["Windows"] = (operatingSystems["Windows"] || 0) + 1;
316
- } else if (ua.includes("mac") || ua.includes("darwin")) {
317
- operatingSystems["macOS"] = (operatingSystems["macOS"] || 0) + 1;
318
- } else if (ua.includes("linux")) {
319
- operatingSystems["Linux"] = (operatingSystems["Linux"] || 0) + 1;
320
- } else if (ua.includes("android")) {
321
- operatingSystems["Android"] = (operatingSystems["Android"] || 0) + 1;
322
- } else if (ua.includes("ios") || ua.includes("iphone") || ua.includes("ipad")) {
323
- operatingSystems["iOS"] = (operatingSystems["iOS"] || 0) + 1;
324
- } else {
325
- operatingSystems["Other"] = (operatingSystems["Other"] || 0) + 1;
326
- }
327
- const loginHour = new Date(session.loginTime).getHours();
328
- loginHours[loginHour]++;
329
- if (session.user?.id) uniqueUsers.add(session.user.id);
330
- if (session.ipAddress) uniqueIPs.add(session.ipAddress);
331
- });
332
- const peakHour = loginHours.indexOf(Math.max(...loginHours));
333
- const loggedOut = sessions.filter((s) => !s.isActive && s.logoutTime).length;
334
- const terminated = sessions.filter((s) => !s.isActive && !s.logoutTime).length;
335
- const mobileCount = (devices["Mobile"] || 0) + (devices["Tablet"] || 0);
336
- const desktopCount = devices["Desktop"] || 0;
337
- const mobileRatio = sessions.length > 0 ? Math.round(mobileCount / sessions.length * 100) : 0;
338
- setAnalytics({
339
- totalSessions: sessions.length,
340
- activeSessions: sessions.filter((s) => s.isActive && s.isTrulyActive).length,
341
- todayLogins: todayLogins.length,
342
- weekLogins: weekLogins.length,
343
- devices,
344
- browsers,
345
- operatingSystems,
346
- loginHours,
347
- peakHour,
348
- uniqueUsers: uniqueUsers.size,
349
- uniqueIPs: uniqueIPs.size,
350
- loggedOut,
351
- terminated,
352
- mobileRatio,
353
- avgSessionDuration: sessions.length > 0 ? Math.floor(sessions.reduce((sum, s) => sum + (s.minutesSinceActive || 0), 0) / sessions.length) : 0
354
- });
371
+ setAnalytics(computeSessionAnalytics(sessions));
355
372
  } catch (err) {
356
373
  console.error("[Analytics] Error:", err);
357
374
  } finally {
@@ -5,9 +5,10 @@ const react = require("react");
5
5
  const reactIntl = require("react-intl");
6
6
  const admin = require("@strapi/strapi/admin");
7
7
  const styled = require("styled-components");
8
- const index = require("./index-CBS3aqCW.js");
8
+ const index = require("./index-Duc7cR_d.js");
9
9
  const designSystem = require("@strapi/design-system");
10
10
  const icons = require("@strapi/icons");
11
+ const sessionStatus = require("./sessionStatus-D_fWEzgj.js");
11
12
  const StyledButtons = require("./StyledButtons-DDuxnYz8.js");
12
13
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
13
14
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
@@ -271,7 +272,7 @@ const SessionDetailModal = ({ session, onClose, onSessionTerminated }) => {
271
272
  /* @__PURE__ */ jsxRuntime.jsx(SectionTitle, { children: t("modal.section.user", "User") }),
272
273
  /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { compact: true, icon: icons.Check, label: t("modal.user.username", "Username"), value: session.user?.username || t("modal.user.na", "N/A") }),
273
274
  /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { compact: true, icon: icons.Information, label: t("modal.user.email", "Email"), value: session.user?.email || t("modal.user.na", "N/A") }),
274
- /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { compact: true, icon: icons.Information, label: t("modal.user.id", "User ID"), value: session.user?.id || t("modal.user.na", "N/A") })
275
+ /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { compact: true, icon: icons.Information, label: t("modal.user.id", "User ID"), value: session.user?.documentId || session.user?.id || t("modal.user.na", "N/A") })
275
276
  ] }),
276
277
  /* @__PURE__ */ jsxRuntime.jsxs(Section, { children: [
277
278
  /* @__PURE__ */ jsxRuntime.jsx(SectionTitle, { children: t("modal.section.device", "Device") }),
@@ -934,7 +935,7 @@ const HomePage = () => {
934
935
  const escapeCsvValue = (value) => `"${String(value ?? "").replace(/"/g, '""')}"`;
935
936
  const rows = filteredSessions.map((session) => {
936
937
  const deviceInfo = index.parseUserAgent(session.userAgent);
937
- const status = getSessionStatus(session);
938
+ const status = sessionStatus.getSessionStatus(session);
938
939
  return [
939
940
  session.id,
940
941
  status,
@@ -982,9 +983,9 @@ const HomePage = () => {
982
983
  const deviceInfo = index.parseUserAgent(session.userAgent);
983
984
  return {
984
985
  id: session.id,
985
- status: getSessionStatus(session),
986
+ status: sessionStatus.getSessionStatus(session),
986
987
  user: {
987
- id: session.user?.id,
988
+ id: session.user?.documentId || session.user?.id,
988
989
  email: session.user?.email,
989
990
  username: session.user?.username
990
991
  },
@@ -1027,9 +1028,9 @@ const HomePage = () => {
1027
1028
  return icons.Server;
1028
1029
  };
1029
1030
  const activeSessions = sessions.filter((s) => s.isActive && s.isTrulyActive);
1030
- const idleSessions = sessions.filter((s) => s.isActive && !s.isTrulyActive);
1031
- const loggedOutSessions = sessions.filter((s) => !s.isActive && s.logoutTime);
1032
- const terminatedSessions = sessions.filter((s) => !s.isActive && !s.logoutTime);
1031
+ const idleSessions = sessions.filter((s) => sessionStatus.getSessionStatus(s) === "idle");
1032
+ const loggedOutSessions = sessions.filter((s) => sessionStatus.getSessionStatus(s) === "loggedout");
1033
+ const terminatedSessions = sessions.filter((s) => sessionStatus.getSessionStatus(s) === "terminated");
1033
1034
  const handleSessionClick = (session) => {
1034
1035
  setSelectedSession(session);
1035
1036
  setShowDetailModal(true);
@@ -1041,18 +1042,12 @@ const HomePage = () => {
1041
1042
  const handleSessionTerminated = () => {
1042
1043
  fetchSessions();
1043
1044
  };
1044
- const getSessionStatus = (session) => {
1045
- if (!session.isActive) {
1046
- return session.logoutTime ? "loggedout" : "terminated";
1047
- }
1048
- return session.isTrulyActive ? "active" : "idle";
1049
- };
1050
1045
  const filteredSessions = sessions.filter((session) => {
1051
- const sessionStatus = getSessionStatus(session);
1052
- if (filterStatus === "active" && sessionStatus !== "active") return false;
1053
- if (filterStatus === "idle" && sessionStatus !== "idle") return false;
1054
- if (filterStatus === "loggedout" && sessionStatus !== "loggedout") return false;
1055
- if (filterStatus === "terminated" && sessionStatus !== "terminated") return false;
1046
+ const sessionStatus$1 = sessionStatus.getSessionStatus(session);
1047
+ if (filterStatus === "active" && sessionStatus$1 !== "active") return false;
1048
+ if (filterStatus === "idle" && sessionStatus$1 !== "idle") return false;
1049
+ if (filterStatus === "loggedout" && sessionStatus$1 !== "loggedout") return false;
1050
+ if (filterStatus === "terminated" && sessionStatus$1 !== "terminated") return false;
1056
1051
  if (searchQuery) {
1057
1052
  const query = searchQuery.toLowerCase();
1058
1053
  const matchesUser = session.user?.email?.toLowerCase().includes(query) || session.user?.username?.toLowerCase().includes(query);
@@ -1160,8 +1155,8 @@ const HomePage = () => {
1160
1155
  size: "S",
1161
1156
  children: [
1162
1157
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "all", children: t("homepage.filter.all", "All Sessions") }),
1163
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "active", children: t("homepage.filter.active", "Active (less than 15 min)") }),
1164
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "idle", children: t("homepage.filter.idle", "Idle (more than 15 min)") }),
1158
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "active", children: t("homepage.filter.active", "Currently active") }),
1159
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "idle", children: t("homepage.filter.idle", "Inactive") }),
1165
1160
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "loggedout", children: t("homepage.filter.loggedout", "Logged Out") }),
1166
1161
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "terminated", children: t("homepage.filter.terminated", "Terminated") })
1167
1162
  ]
@@ -1197,7 +1192,7 @@ const HomePage = () => {
1197
1192
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: filteredSessions.map((session) => {
1198
1193
  const deviceInfo = index.parseUserAgent(session.userAgent);
1199
1194
  const DeviceIcon = getDeviceIcon(deviceInfo.device);
1200
- const sessionStatus = getSessionStatus(session);
1195
+ const sessionStatus$1 = sessionStatus.getSessionStatus(session);
1201
1196
  const statusConfig = {
1202
1197
  active: {
1203
1198
  bg: "rgba(22, 163, 74, 0.06)",
@@ -1226,7 +1221,7 @@ const HomePage = () => {
1226
1221
  opacity: 0.6
1227
1222
  }
1228
1223
  };
1229
- const config = statusConfig[sessionStatus];
1224
+ const config = statusConfig[sessionStatus$1];
1230
1225
  return /* @__PURE__ */ jsxRuntime.jsxs(
1231
1226
  ClickableRow,
1232
1227
  {
@@ -1236,8 +1231,8 @@ const HomePage = () => {
1236
1231
  opacity: config.opacity || 1
1237
1232
  },
1238
1233
  children: [
1239
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(StatusBadge, { $status: sessionStatus, children: [
1240
- /* @__PURE__ */ jsxRuntime.jsx(StatusDot, { $status: sessionStatus }),
1234
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(StatusBadge, { $status: sessionStatus$1, children: [
1235
+ /* @__PURE__ */ jsxRuntime.jsx(StatusDot, { $status: sessionStatus$1 }),
1241
1236
  config.label
1242
1237
  ] }) }),
1243
1238
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", children: [
@@ -1259,7 +1254,7 @@ const HomePage = () => {
1259
1254
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral700", children: new Date(session.loginTime).toLocaleString() }) }),
1260
1255
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", children: [
1261
1256
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral700", children: new Date(session.lastActive || session.loginTime).toLocaleString() }),
1262
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: sessionStatus === "active" ? "success600" : "neutral500", children: t("homepage.time.minAgo", "{minutes} min ago", { minutes: session.minutesSinceActive }) })
1257
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: sessionStatus$1 === "active" ? "success600" : "neutral500", children: t("homepage.time.minAgo", "{minutes} min ago", { minutes: session.minutesSinceActive }) })
1263
1258
  ] }) }),
1264
1259
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxRuntime.jsxs(ActionButtons, { className: "action-buttons", children: [
1265
1260
  /* @__PURE__ */ jsxRuntime.jsx(
@@ -1280,7 +1275,7 @@ const HomePage = () => {
1280
1275
  e.stopPropagation();
1281
1276
  handleTerminateSession(session.id);
1282
1277
  },
1283
- disabled: sessionStatus !== "active" && sessionStatus !== "idle",
1278
+ disabled: sessionStatus$1 !== "active" && sessionStatus$1 !== "idle",
1284
1279
  title: session.isActive ? t("homepage.actions.terminate", "Terminate (Logout)") : t("homepage.actions.alreadyInactive", "Already inactive"),
1285
1280
  children: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {})
1286
1281
  }
@@ -3,9 +3,10 @@ import { useState, useEffect } from "react";
3
3
  import { useIntl } from "react-intl";
4
4
  import { useFetchClient, useNotification, Page } from "@strapi/strapi/admin";
5
5
  import styled, { css, keyframes } from "styled-components";
6
- import { p as parseUserAgent, a as pluginId$1, g as getTranslation } from "./index-eSND7TDx.mjs";
6
+ import { p as parseUserAgent, a as pluginId$1, g as getTranslation } from "./index-B_lFjUAg.mjs";
7
7
  import { Modal, Flex, Box, Typography, Divider, Button, Loader, SingleSelect, SingleSelectOption, Thead, Tr, Th, Tbody, Td, Table } from "@strapi/design-system";
8
8
  import { Check, Information, Monitor, Server, Clock, Cross, Earth, Shield, Phone, Download, User, Eye, Trash, Search } from "@strapi/icons";
9
+ import { g as getSessionStatus } from "./sessionStatus-kwggjEMw.mjs";
9
10
  import { S as ShowHideButton, T as TertiaryButton, D as DangerButton, I as IconButtonPrimary, a as IconButtonWarning, b as IconButtonDanger } from "./StyledButtons-Cz8oYhmc.mjs";
10
11
  const theme = {
11
12
  shadows: {
@@ -267,7 +268,7 @@ const SessionDetailModal = ({ session, onClose, onSessionTerminated }) => {
267
268
  /* @__PURE__ */ jsx(SectionTitle, { children: t("modal.section.user", "User") }),
268
269
  /* @__PURE__ */ jsx(DetailRow, { compact: true, icon: Check, label: t("modal.user.username", "Username"), value: session.user?.username || t("modal.user.na", "N/A") }),
269
270
  /* @__PURE__ */ jsx(DetailRow, { compact: true, icon: Information, label: t("modal.user.email", "Email"), value: session.user?.email || t("modal.user.na", "N/A") }),
270
- /* @__PURE__ */ jsx(DetailRow, { compact: true, icon: Information, label: t("modal.user.id", "User ID"), value: session.user?.id || t("modal.user.na", "N/A") })
271
+ /* @__PURE__ */ jsx(DetailRow, { compact: true, icon: Information, label: t("modal.user.id", "User ID"), value: session.user?.documentId || session.user?.id || t("modal.user.na", "N/A") })
271
272
  ] }),
272
273
  /* @__PURE__ */ jsxs(Section, { children: [
273
274
  /* @__PURE__ */ jsx(SectionTitle, { children: t("modal.section.device", "Device") }),
@@ -980,7 +981,7 @@ const HomePage = () => {
980
981
  id: session.id,
981
982
  status: getSessionStatus(session),
982
983
  user: {
983
- id: session.user?.id,
984
+ id: session.user?.documentId || session.user?.id,
984
985
  email: session.user?.email,
985
986
  username: session.user?.username
986
987
  },
@@ -1023,9 +1024,9 @@ const HomePage = () => {
1023
1024
  return Server;
1024
1025
  };
1025
1026
  const activeSessions = sessions.filter((s) => s.isActive && s.isTrulyActive);
1026
- const idleSessions = sessions.filter((s) => s.isActive && !s.isTrulyActive);
1027
- const loggedOutSessions = sessions.filter((s) => !s.isActive && s.logoutTime);
1028
- const terminatedSessions = sessions.filter((s) => !s.isActive && !s.logoutTime);
1027
+ const idleSessions = sessions.filter((s) => getSessionStatus(s) === "idle");
1028
+ const loggedOutSessions = sessions.filter((s) => getSessionStatus(s) === "loggedout");
1029
+ const terminatedSessions = sessions.filter((s) => getSessionStatus(s) === "terminated");
1029
1030
  const handleSessionClick = (session) => {
1030
1031
  setSelectedSession(session);
1031
1032
  setShowDetailModal(true);
@@ -1037,12 +1038,6 @@ const HomePage = () => {
1037
1038
  const handleSessionTerminated = () => {
1038
1039
  fetchSessions();
1039
1040
  };
1040
- const getSessionStatus = (session) => {
1041
- if (!session.isActive) {
1042
- return session.logoutTime ? "loggedout" : "terminated";
1043
- }
1044
- return session.isTrulyActive ? "active" : "idle";
1045
- };
1046
1041
  const filteredSessions = sessions.filter((session) => {
1047
1042
  const sessionStatus = getSessionStatus(session);
1048
1043
  if (filterStatus === "active" && sessionStatus !== "active") return false;
@@ -1156,8 +1151,8 @@ const HomePage = () => {
1156
1151
  size: "S",
1157
1152
  children: [
1158
1153
  /* @__PURE__ */ jsx(SingleSelectOption, { value: "all", children: t("homepage.filter.all", "All Sessions") }),
1159
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "active", children: t("homepage.filter.active", "Active (less than 15 min)") }),
1160
- /* @__PURE__ */ jsx(SingleSelectOption, { value: "idle", children: t("homepage.filter.idle", "Idle (more than 15 min)") }),
1154
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "active", children: t("homepage.filter.active", "Currently active") }),
1155
+ /* @__PURE__ */ jsx(SingleSelectOption, { value: "idle", children: t("homepage.filter.idle", "Inactive") }),
1161
1156
  /* @__PURE__ */ jsx(SingleSelectOption, { value: "loggedout", children: t("homepage.filter.loggedout", "Logged Out") }),
1162
1157
  /* @__PURE__ */ jsx(SingleSelectOption, { value: "terminated", children: t("homepage.filter.terminated", "Terminated") })
1163
1158
  ]
@@ -4,7 +4,7 @@ import { Loader, Box, Alert, Flex, Typography, Button, Badge, Accordion } from "
4
4
  import { useFetchClient, useNotification } from "@strapi/strapi/admin";
5
5
  import { ArrowClockwise, Duplicate, Download, User, Shield, Sparkle, ChartBubble } from "@strapi/icons";
6
6
  import styled, { css, keyframes } from "styled-components";
7
- import { a as pluginId } from "./index-eSND7TDx.mjs";
7
+ import { a as pluginId } from "./index-B_lFjUAg.mjs";
8
8
  const theme = {
9
9
  borderRadius: { lg: "12px" }
10
10
  };
@@ -6,7 +6,7 @@ const designSystem = require("@strapi/design-system");
6
6
  const admin = require("@strapi/strapi/admin");
7
7
  const icons = require("@strapi/icons");
8
8
  const styled = require("styled-components");
9
- const index = require("./index-CBS3aqCW.js");
9
+ const index = require("./index-Duc7cR_d.js");
10
10
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
11
11
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
12
12
  const theme = {
@@ -4,7 +4,7 @@ import { useIntl } from "react-intl";
4
4
  import { Box, Typography, Flex, Grid } from "@strapi/design-system";
5
5
  import { Check, Cross, Clock, User } from "@strapi/icons";
6
6
  import { useFetchClient } from "@strapi/strapi/admin";
7
- import { g as getTranslation } from "./index-eSND7TDx.mjs";
7
+ import { g as getTranslation } from "./index-B_lFjUAg.mjs";
8
8
  function getSessionUserKey(session) {
9
9
  return session?.user?.documentId || session?.user?.id || session?.user?.email || session?.user?.username || null;
10
10
  }
@@ -31,7 +31,6 @@ function computeOnlineUserStats(sessions, {
31
31
  last15min.add(userKey);
32
32
  last30min.add(userKey);
33
33
  } else if (timeSinceActive < thirtyMin) {
34
- last15min.add(userKey);
35
34
  last30min.add(userKey);
36
35
  }
37
36
  }
@@ -6,7 +6,7 @@ const reactIntl = require("react-intl");
6
6
  const designSystem = require("@strapi/design-system");
7
7
  const icons = require("@strapi/icons");
8
8
  const admin = require("@strapi/strapi/admin");
9
- const index = require("./index-CBS3aqCW.js");
9
+ const index = require("./index-Duc7cR_d.js");
10
10
  function getSessionUserKey(session) {
11
11
  return session?.user?.documentId || session?.user?.id || session?.user?.email || session?.user?.username || null;
12
12
  }
@@ -33,7 +33,6 @@ function computeOnlineUserStats(sessions, {
33
33
  last15min.add(userKey);
34
34
  last30min.add(userKey);
35
35
  } else if (timeSinceActive < thirtyMin) {
36
- last15min.add(userKey);
37
36
  last30min.add(userKey);
38
37
  }
39
38
  }
@@ -5,7 +5,7 @@ import { Flex, Loader, Typography, Button, Box, Accordion, Grid, SingleSelect, S
5
5
  import { useFetchClient, useNotification } from "@strapi/strapi/admin";
6
6
  import { Check, Cog, Trash, Shield, Code, Duplicate, Clock, Mail } from "@strapi/icons";
7
7
  import styled, { css, keyframes } from "styled-components";
8
- import { a as pluginId, g as getTranslation } from "./index-eSND7TDx.mjs";
8
+ import { a as pluginId, g as getTranslation } from "./index-B_lFjUAg.mjs";
9
9
  import { D as DangerButton, S as ShowHideButton, G as GradientButton, C as CopyButton, T as TertiaryButton, c as SecondaryButton } from "./StyledButtons-Cz8oYhmc.mjs";
10
10
  const COUNTRIES = [
11
11
  { code: "DE", name: "Germany", flag: "🇩🇪" },
@@ -7,7 +7,7 @@ const designSystem = require("@strapi/design-system");
7
7
  const admin = require("@strapi/strapi/admin");
8
8
  const icons = require("@strapi/icons");
9
9
  const styled = require("styled-components");
10
- const index = require("./index-CBS3aqCW.js");
10
+ const index = require("./index-Duc7cR_d.js");
11
11
  const StyledButtons = require("./StyledButtons-DDuxnYz8.js");
12
12
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
13
13
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
@@ -41,8 +41,8 @@ const de = {
41
41
  "homepage.allSessions": "Alle Sitzungen",
42
42
  "homepage.search.placeholder": "Nach Benutzer, IP-Adresse oder Gerät suchen...",
43
43
  "homepage.filter.all": "Alle Sitzungen",
44
- "homepage.filter.active": "Aktiv (weniger als 15 Min)",
45
- "homepage.filter.idle": "Inaktiv (mehr als 15 Min)",
44
+ "homepage.filter.active": "Derzeit aktiv",
45
+ "homepage.filter.idle": "Inaktiv",
46
46
  "homepage.filter.loggedout": "Abgemeldet",
47
47
  "homepage.filter.terminated": "Beendet",
48
48
  "homepage.entries.10": "10 Einträge",