strapi-plugin-magic-sessionmanager 4.7.2 → 4.8.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 (52) hide show
  1. package/CHANGELOG.md +20 -0
  2. package/README.md +17 -38
  3. package/dist/admin/Analytics-CaRlu5ad.js +332 -0
  4. package/dist/admin/Analytics-THqDbNX0.mjs +330 -0
  5. package/dist/admin/App-AbZwLHtF.js +1263 -0
  6. package/dist/admin/App-hSh7guii.mjs +1261 -0
  7. package/dist/admin/FormField-C8kIT2NE.mjs +59 -0
  8. package/dist/admin/FormField-b5KBvkrj.js +60 -0
  9. package/dist/admin/License-BXBVwUVu.mjs +299 -0
  10. package/dist/admin/License-CABdPwnd.js +301 -0
  11. package/dist/admin/OnlineUsersWidget-BnWFj9IM.mjs +230 -0
  12. package/dist/admin/OnlineUsersWidget-CPFAACSb.js +230 -0
  13. package/dist/admin/PluginPageLayout-BPFMcgrx.mjs +42 -0
  14. package/dist/admin/PluginPageLayout-DmNzMdqu.js +43 -0
  15. package/dist/admin/Settings-B4DNdeKx.js +2152 -0
  16. package/dist/admin/Settings-C4RsJosh.mjs +2150 -0
  17. package/dist/admin/{de-JBE-iylO.mjs → de-AwIFTd9i.mjs} +154 -20
  18. package/dist/admin/{de-BnqGCokx.js → de-D23nmqnl.js} +154 -20
  19. package/dist/admin/{en-BRmVwd8-.js → en-C5iYQ0mC.js} +155 -21
  20. package/dist/admin/{en-kQWtdEai.mjs → en-D6QEGeRh.mjs} +155 -21
  21. package/dist/admin/{es-CH691xcL.js → es-CIXnsG-p.js} +154 -20
  22. package/dist/admin/{es-DOQvBxih.mjs → es-CnFfVdKw.mjs} +154 -20
  23. package/dist/admin/{fr-CLExO0w_.js → fr-BglXE-W4.js} +154 -20
  24. package/dist/admin/{fr-CmfCpepX.mjs → fr-DefoR7uH.mjs} +154 -20
  25. package/dist/admin/index-BFVITQ-o.mjs +624 -0
  26. package/dist/admin/{index-Duc7cR_d.js → index-DlMm-NyK.js} +261 -188
  27. package/dist/admin/index.js +1 -1
  28. package/dist/admin/index.mjs +1 -1
  29. package/dist/admin/maskSensitiveValue-1uGWmrfG.mjs +20 -0
  30. package/dist/admin/maskSensitiveValue-B9vhxPad.js +19 -0
  31. package/dist/admin/{pt-BJ_F0yNi.js → pt-J5sf7jiY.js} +154 -20
  32. package/dist/admin/{pt-BSzZdyAH.mjs → pt-TODwvNQA.mjs} +154 -20
  33. package/dist/server/index.js +4396 -7820
  34. package/dist/server/index.mjs +4396 -7820
  35. package/package.json +21 -19
  36. package/scripts/geoip-updater.cjs +234 -15
  37. package/scripts/update-geoip-db.mjs +3 -0
  38. package/dist/admin/Analytics-CsrpxJwQ.mjs +0 -497
  39. package/dist/admin/Analytics-D03ZNNMR.js +0 -499
  40. package/dist/admin/App-B2VCS3cz.js +0 -1481
  41. package/dist/admin/App-qxKnK7G2.mjs +0 -1479
  42. package/dist/admin/License-ClW7sZLR.mjs +0 -318
  43. package/dist/admin/License-fixnQ7wF.js +0 -320
  44. package/dist/admin/OnlineUsersWidget-mR_OMiwi.mjs +0 -185
  45. package/dist/admin/OnlineUsersWidget-qb9utPBy.js +0 -185
  46. package/dist/admin/Settings-U3V4eGMo.mjs +0 -2038
  47. package/dist/admin/Settings-gv2BF54w.js +0 -2040
  48. package/dist/admin/StyledButtons-Cz8oYhmc.mjs +0 -418
  49. package/dist/admin/StyledButtons-DDuxnYz8.js +0 -419
  50. package/dist/admin/index-B_lFjUAg.mjs +0 -551
  51. package/dist/admin/sessionStatus-D_fWEzgj.js +0 -11
  52. package/dist/admin/sessionStatus-kwggjEMw.mjs +0 -12
@@ -1,42 +1,26 @@
1
1
  "use strict";
2
2
  const react = require("react");
3
- const admin = require("@strapi/strapi/admin");
4
3
  const jsxRuntime = require("react/jsx-runtime");
5
4
  const reactIntl = require("react-intl");
6
5
  const styled = require("styled-components");
7
6
  const designSystem = require("@strapi/design-system");
8
7
  const icons = require("@strapi/icons");
8
+ const admin = require("@strapi/strapi/admin");
9
9
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
10
10
  const styled__default = /* @__PURE__ */ _interopDefault(styled);
11
11
  const strapi = { "name": "magic-sessionmanager", "displayName": "Magic Sessionmanager" };
12
12
  const pluginPkg = {
13
13
  strapi
14
14
  };
15
- const pluginId = "magic-sessionmanager";
16
- const PLUGIN_ID = pluginId;
15
+ const pluginId$1 = "magic-sessionmanager";
16
+ const PLUGIN_ID = pluginId$1;
17
17
  const Initializer = ({ setPlugin }) => {
18
18
  const ref = react.useRef(setPlugin);
19
- const { get } = admin.useFetchClient();
20
19
  react.useEffect(() => {
21
20
  if (ref.current) {
22
- ref.current(pluginId);
21
+ ref.current(pluginId$1);
23
22
  }
24
23
  }, []);
25
- react.useEffect(() => {
26
- const HEARTBEAT_INTERVAL = 4 * 60 * 1e3;
27
- const heartbeat = async () => {
28
- try {
29
- await get(`/${pluginId}/license/status`);
30
- } catch (error) {
31
- }
32
- };
33
- const initialTimeout = setTimeout(heartbeat, 60 * 1e3);
34
- const interval = setInterval(heartbeat, HEARTBEAT_INTERVAL);
35
- return () => {
36
- clearTimeout(initialTimeout);
37
- clearInterval(interval);
38
- };
39
- }, [get]);
40
24
  return null;
41
25
  };
42
26
  const PluginIcon = () => /* @__PURE__ */ jsxRuntime.jsx("svg", { viewBox: "0 0 32 32", fill: "currentColor", width: "24", height: "24", children: /* @__PURE__ */ jsxRuntime.jsx("path", { d: "M26 5H6a3 3 0 0 0-3 3v14a3 3 0 0 0 3 3h20a3 3 0 0 0 3-3V8a3 3 0 0 0-3-3M20 27h-8a1 1 0 0 0 0 2h8a1 1 0 0 0 0-2" }) });
@@ -102,41 +86,130 @@ const parseUserAgent = (userAgent) => {
102
86
  os
103
87
  };
104
88
  };
89
+ function getSessionStatus(session = {}) {
90
+ if (session.isActive) {
91
+ return session.isTrulyActive ? "active" : "idle";
92
+ }
93
+ if (session.terminationReason === "logout") return "loggedout";
94
+ if (session.terminationReason === "idle") return "idle";
95
+ if (session.terminationReason) return "terminated";
96
+ return session.logoutTime ? "loggedout" : "terminated";
97
+ }
98
+ const DEFAULT_SESSION_FILTER = "all";
99
+ const VALID_SESSION_FILTERS = /* @__PURE__ */ new Set(["all", "active", "idle", "loggedout", "terminated"]);
100
+ function filterSessionsByStatus(sessions, status = DEFAULT_SESSION_FILTER) {
101
+ if (!Array.isArray(sessions) || !VALID_SESSION_FILTERS.has(status)) return [];
102
+ if (status === "all") return sessions;
103
+ return sessions.filter((session) => getSessionStatus(session) === status);
104
+ }
105
+ function getManageableSessions(sessions) {
106
+ if (!Array.isArray(sessions)) return [];
107
+ return sessions.filter((session) => session?.isActive === true);
108
+ }
105
109
  const getTranslation = (id) => `${PLUGIN_ID}.${id}`;
110
+ const pluginId = "magic-sessionmanager";
111
+ const pluginPermissions = {
112
+ access: [{ action: `plugin::${pluginId}.access`, subject: null }]
113
+ };
114
+ const SAFE_SCOPE = /^[A-Za-z0-9_.:-]{1,48}$/;
115
+ function logSafeAdminError(scope, error) {
116
+ const safeScope = typeof scope === "string" && SAFE_SCOPE.test(scope) ? scope : "admin";
117
+ let status;
118
+ try {
119
+ status = error && typeof error === "object" ? error.response?.status : void 0;
120
+ } catch {
121
+ status = void 0;
122
+ }
123
+ const statusSuffix = Number.isInteger(status) && status >= 400 && status <= 599 ? ` (HTTP ${status})` : "";
124
+ console.error(`[${safeScope}] Request failed${statusSuffix}`);
125
+ }
126
+ const paragraphRhythm = styled.css`
127
+ p {
128
+ max-width: 72ch;
129
+ margin-block: 0;
130
+ line-height: 1.6;
131
+ text-wrap: pretty;
132
+ }
133
+
134
+ p + p {
135
+ margin-block-start: 12px;
136
+ }
137
+
138
+ li {
139
+ max-width: 72ch;
140
+ line-height: 1.6;
141
+ text-wrap: pretty;
142
+ }
143
+
144
+ li + li {
145
+ margin-block-start: 6px;
146
+ }
147
+ `;
148
+ const ReadableText = styled__default.default(designSystem.Typography)`
149
+ display: block;
150
+ width: 100%;
151
+ min-width: 0;
152
+ max-width: 72ch;
153
+ margin: 0;
154
+ line-height: 1.6;
155
+ text-wrap: pretty;
156
+
157
+ & + & {
158
+ margin-block-start: 12px;
159
+ }
160
+ `;
161
+ const ParagraphGroup = styled__default.default.div`
162
+ display: block;
163
+ width: 100%;
164
+ min-width: 0;
165
+ `;
166
+ const InlineParagraphGroup = styled__default.default.span`
167
+ display: block;
168
+ width: 100%;
169
+ min-width: 0;
170
+ `;
171
+ const ReadableParagraphs = ({ id, text, ...typographyProps }) => {
172
+ const ParagraphContainer = typographyProps.tag === "span" ? InlineParagraphGroup : ParagraphGroup;
173
+ const paragraphs = String(text ?? "").split(/\n\s*\n/).map((paragraph) => paragraph.trim()).filter(Boolean);
174
+ return /* @__PURE__ */ jsxRuntime.jsx(ParagraphContainer, { id, "data-readable-paragraphs": "", children: paragraphs.map((paragraph, index2) => /* @__PURE__ */ jsxRuntime.jsx(
175
+ ReadableText,
176
+ {
177
+ ...typographyProps,
178
+ tag: typographyProps.tag || "p",
179
+ children: paragraph
180
+ },
181
+ `${id || "readable-paragraph"}-${index2}`
182
+ )) });
183
+ };
106
184
  const PanelContainer = styled__default.default(designSystem.Box)`
107
185
  width: 100%;
186
+ min-width: 0;
187
+
188
+ ${paragraphRhythm}
108
189
  `;
109
190
  const StatusCard = styled__default.default(designSystem.Box)`
110
191
  padding: 20px;
111
- border-radius: 12px;
112
- border: 1px solid ${(props) => props.$isOnline ? "rgba(34, 197, 94, 0.3)" : "rgba(128, 128, 128, 0.2)"};
113
- background: ${(props) => props.$isOnline ? "linear-gradient(135deg, rgba(22, 163, 74, 0.06) 0%, rgba(22, 163, 74, 0.12) 100%)" : "linear-gradient(135deg, rgba(128, 128, 128, 0.04) 0%, rgba(128, 128, 128, 0.08) 100%)"};
114
- transition: all 0.2s ease;
192
+ border-radius: 4px;
193
+ border: 1px solid ${(p) => p.theme.colors.neutral150};
194
+ background: ${(p) => p.theme.colors.neutral0};
115
195
  `;
116
196
  const BlockedWarning = styled__default.default(designSystem.Box)`
117
197
  padding: 16px;
118
- border-radius: 10px;
119
- background: linear-gradient(135deg, rgba(220, 38, 38, 0.06) 0%, rgba(220, 38, 38, 0.12) 100%);
120
- border: 1px solid rgba(239, 68, 68, 0.4);
198
+ border-radius: 4px;
199
+ background: ${(p) => p.theme.colors.danger100};
200
+ border: 1px solid ${(p) => p.theme.colors.danger200};
121
201
  `;
122
202
  const SessionCard = styled__default.default(designSystem.Box)`
123
203
  padding: 16px;
124
204
  background: ${(p) => p.theme.colors.neutral0};
125
- border-radius: 10px;
126
- border: 1px solid rgba(128, 128, 128, 0.2);
127
- box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
128
- transition: all 0.2s ease;
129
-
130
- &:hover {
131
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
132
- border-color: var(--colors-primary600, #0EA5E9);
133
- }
205
+ border-radius: 4px;
206
+ border: 1px solid ${(p) => p.theme.colors.neutral150};
134
207
  `;
135
208
  const EmptyState = styled__default.default(designSystem.Box)`
136
209
  padding: 32px;
137
- background: var(--colors-neutral100);
138
- border-radius: 12px;
139
- border: 2px dashed rgba(128, 128, 128, 0.2);
210
+ background: ${(p) => p.theme.colors.neutral0};
211
+ border-radius: 4px;
212
+ border: 1px solid ${(p) => p.theme.colors.neutral150};
140
213
  text-align: center;
141
214
  `;
142
215
  const EmptyIcon = styled__default.default(designSystem.Box)`
@@ -146,63 +219,9 @@ const EmptyIcon = styled__default.default(designSystem.Box)`
146
219
  display: flex;
147
220
  align-items: center;
148
221
  justify-content: center;
149
- background: rgba(128, 128, 128, 0.2);
222
+ background: ${(p) => p.theme.colors.neutral100};
150
223
  border-radius: 50%;
151
- color: var(--colors-neutral500);
152
- `;
153
- const SectionLabel = styled__default.default(designSystem.Typography)`
154
- text-transform: uppercase;
155
- letter-spacing: 0.5px;
156
- font-size: 11px !important;
157
- font-weight: 700 !important;
158
- color: var(--colors-neutral600);
159
- margin-bottom: 12px;
160
- display: block;
161
- `;
162
- const ActionButton = styled__default.default.button`
163
- width: 100%;
164
- padding: 12px 16px;
165
- border-radius: 8px;
166
- font-size: 14px;
167
- font-weight: 600;
168
- cursor: pointer;
169
- display: flex;
170
- align-items: center;
171
- justify-content: center;
172
- gap: 8px;
173
- transition: all 0.2s ease;
174
-
175
- ${(props) => props.$variant === "danger" && `
176
- background: ${(p) => p.theme.colors.neutral0};
177
- color: var(--colors-danger600, #DC2626);
178
- border: 2px solid var(--colors-danger600, #DC2626);
179
-
180
- &:hover:not(:disabled) {
181
- background: var(--colors-danger600, #DC2626);
182
- color: white;
183
- }
184
- `}
185
-
186
- ${(props) => props.$variant === "success" && `
187
- background: ${(p) => p.theme.colors.neutral0};
188
- color: var(--colors-success600, #16A34A);
189
- border: 2px solid var(--colors-success600, #16A34A);
190
-
191
- &:hover:not(:disabled) {
192
- background: var(--colors-success600, #16A34A);
193
- color: white;
194
- }
195
- `}
196
-
197
- &:disabled {
198
- opacity: 0.5;
199
- cursor: not-allowed;
200
- }
201
-
202
- svg {
203
- width: 16px;
204
- height: 16px;
205
- }
224
+ color: ${(p) => p.theme.colors.neutral500};
206
225
  `;
207
226
  const IconWrapper = styled__default.default(designSystem.Box)`
208
227
  width: 32px;
@@ -210,47 +229,63 @@ const IconWrapper = styled__default.default(designSystem.Box)`
210
229
  display: flex;
211
230
  align-items: center;
212
231
  justify-content: center;
213
- background: var(--colors-neutral100);
232
+ background: ${(p) => p.theme.colors.neutral100};
214
233
  border-radius: 8px;
215
234
  flex-shrink: 0;
216
235
 
217
236
  svg {
218
237
  width: 16px;
219
238
  height: 16px;
220
- color: var(--colors-neutral600);
239
+ color: ${(p) => p.theme.colors.neutral600};
221
240
  }
222
241
  `;
242
+ const MutedIcon = styled__default.default.div`
243
+ display: flex;
244
+ color: ${(p) => p.theme.colors.neutral500};
245
+ `;
223
246
  const SessionInfoPanel = ({ documentId, model, document }) => {
224
247
  const { formatMessage } = reactIntl.useIntl();
248
+ const { allowedActions: { canAccess }, isLoading: permissionsLoading } = admin.useRBAC(pluginPermissions.access);
225
249
  const [sessions, setSessions] = react.useState([]);
226
250
  const [loading, setLoading] = react.useState(true);
251
+ const [loadError, setLoadError] = react.useState(false);
252
+ const [reloadKey, setReloadKey] = react.useState(0);
227
253
  const [isBlocked, setIsBlocked] = react.useState(false);
228
254
  const [actionLoading, setActionLoading] = react.useState(false);
229
255
  const { get, post: postRequest } = admin.useFetchClient();
230
256
  const { toggleNotification } = admin.useNotification();
231
257
  const t = (id, defaultMessage, values) => formatMessage({ id: getTranslation(id), defaultMessage }, values);
258
+ const unavailableValue = t("common.unavailable", "Unavailable");
232
259
  const userId = document?.documentId || documentId;
233
260
  react.useEffect(() => {
234
- if (model !== "plugin::users-permissions.user" || !userId) {
261
+ if (model !== "plugin::users-permissions.user" || !userId || permissionsLoading || !canAccess) {
235
262
  setLoading(false);
236
263
  return;
237
264
  }
265
+ let cancelled = false;
238
266
  const fetchData = async () => {
267
+ setLoading(true);
268
+ setLoadError(false);
239
269
  try {
240
270
  const { data } = await get(`/magic-sessionmanager/user/${userId}/sessions`);
241
- const activeSessions = (data.data || []).filter((s) => s.isTrulyActive);
242
- setSessions(activeSessions);
271
+ if (cancelled) return;
272
+ setSessions(getManageableSessions(data.data || []));
243
273
  setIsBlocked(document?.blocked || false);
244
274
  } catch (err) {
245
- console.error("[SessionInfoPanel] Error:", err);
275
+ if (!cancelled) setLoadError(true);
276
+ logSafeAdminError("userSessions.load", err);
246
277
  } finally {
247
- setLoading(false);
278
+ if (!cancelled) setLoading(false);
248
279
  }
249
280
  };
250
281
  fetchData();
251
- }, [userId, model, document, get]);
282
+ return () => {
283
+ cancelled = true;
284
+ };
285
+ }, [userId, model, document, get, reloadKey, canAccess, permissionsLoading]);
252
286
  const handleLogoutAll = async () => {
253
287
  if (!userId) return;
288
+ if (!confirm(t("panel.confirm.terminateAll", "End all active sessions for this user?"))) return;
254
289
  setActionLoading(true);
255
290
  try {
256
291
  const response = await postRequest(`/magic-sessionmanager/user/${userId}/terminate-all`);
@@ -266,13 +301,15 @@ const SessionInfoPanel = ({ documentId, model, document }) => {
266
301
  type: "warning",
267
302
  message: t("notifications.error.terminateAll", "Failed to terminate sessions")
268
303
  });
269
- console.error("[SessionInfoPanel] Logout all error:", error);
304
+ logSafeAdminError("userSessions.terminateAll", error);
270
305
  } finally {
271
306
  setActionLoading(false);
272
307
  }
273
308
  };
274
309
  const handleToggleBlock = async () => {
275
310
  if (!userId) return;
311
+ const confirmation = isBlocked ? t("panel.confirm.unblockUser", "Unblock this user?") : t("panel.confirm.blockUser", "Block this user and end all active sessions?");
312
+ if (!confirm(confirmation)) return;
276
313
  setActionLoading(true);
277
314
  try {
278
315
  const response = await postRequest(`/magic-sessionmanager/user/${userId}/toggle-block`);
@@ -292,7 +329,7 @@ const SessionInfoPanel = ({ documentId, model, document }) => {
292
329
  type: "warning",
293
330
  message: t("notifications.error.block", "Failed to update user status")
294
331
  });
295
- console.error("[SessionInfoPanel] Toggle block error:", error);
332
+ logSafeAdminError("userSessions.toggleBlock", error);
296
333
  } finally {
297
334
  setActionLoading(false);
298
335
  }
@@ -300,62 +337,90 @@ const SessionInfoPanel = ({ documentId, model, document }) => {
300
337
  const getDeviceIcon = (deviceType) => {
301
338
  if (deviceType === "Mobile" || deviceType === "Tablet") return icons.Phone;
302
339
  if (deviceType === "Desktop" || deviceType === "Laptop") return icons.Monitor;
303
- return icons.Server;
340
+ if (deviceType === "API Client") return icons.Server;
341
+ return icons.Information;
304
342
  };
305
343
  if (model !== "plugin::users-permissions.user") {
306
344
  return null;
307
345
  }
346
+ if (permissionsLoading || !canAccess) {
347
+ return null;
348
+ }
349
+ if (!userId) {
350
+ return {
351
+ title: t("panel.title", "Session Info"),
352
+ content: /* @__PURE__ */ jsxRuntime.jsx(PanelContainer, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(ReadableText, { variant: "pi", textColor: "neutral600", tag: "p", children: t("panel.user.saveBeforeManagingSessions", "Save this user before managing sessions.") }) }) })
353
+ };
354
+ }
308
355
  if (loading) {
309
356
  return {
310
357
  title: t("panel.title", "Session Info"),
311
- content: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, background: "neutral0", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t("panel.loading", "Loading...") }) })
358
+ content: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, background: "neutral0", children: /* @__PURE__ */ jsxRuntime.jsx(ReadableText, { variant: "pi", textColor: "neutral600", tag: "p", children: t("panel.loading", "Loading...") }) })
359
+ };
360
+ }
361
+ if (loadError) {
362
+ return {
363
+ title: t("panel.title", "Session Info"),
364
+ content: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(
365
+ designSystem.Alert,
366
+ {
367
+ variant: "danger",
368
+ title: t("panel.error.title", "Sessions could not be loaded"),
369
+ closeLabel: t("common.close", "Close"),
370
+ action: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { size: "S", variant: "secondary", onClick: () => setReloadKey((key) => key + 1), children: t("common.retry", "Retry") }),
371
+ children: /* @__PURE__ */ jsxRuntime.jsx(ReadableText, { variant: "pi", textColor: "neutral700", tag: "span", children: t("panel.error.description", "Try again. If the problem continues, check permissions for this user.") })
372
+ }
373
+ ) })
312
374
  };
313
375
  }
314
- const isOnline = sessions.length > 0;
376
+ const onlineCount = sessions.filter((session) => getSessionStatus(session) === "active").length;
377
+ const isOnline = onlineCount > 0;
315
378
  return {
316
379
  title: t("panel.title", "Session Info"),
317
380
  content: /* @__PURE__ */ jsxRuntime.jsx(PanelContainer, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 4, alignItems: "stretch", children: [
318
- /* @__PURE__ */ jsxRuntime.jsx(StatusCard, { $isOnline: isOnline, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 3, alignItems: "center", children: [
381
+ /* @__PURE__ */ jsxRuntime.jsx(StatusCard, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 3, alignItems: "center", children: [
382
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { variant: isOnline ? "success" : "neutral", size: "M", children: isOnline ? t("panel.status.active", "Online") : t("panel.status.offline", "Offline") }),
319
383
  /* @__PURE__ */ jsxRuntime.jsx(
320
- designSystem.Badge,
321
- {
322
- backgroundColor: isOnline ? "success600" : "neutral600",
323
- textColor: "neutral0",
324
- size: "M",
325
- style: { fontSize: "12px", padding: "6px 14px", fontWeight: "700" },
326
- children: isOnline ? t("panel.status.active", "ONLINE") : t("panel.status.offline", "OFFLINE")
327
- }
328
- ),
329
- /* @__PURE__ */ jsxRuntime.jsxs(
330
384
  designSystem.Typography,
331
385
  {
332
386
  variant: "omega",
333
387
  fontWeight: "semiBold",
334
388
  textColor: isOnline ? "success700" : "neutral700",
335
- children: [
336
- sessions.length,
337
- " ",
338
- t("panel.sessions.label", "active session"),
339
- sessions.length !== 1 ? "s" : ""
340
- ]
389
+ children: t(
390
+ "panel.sessions.currentCount",
391
+ "{count, plural, one {# current session} other {# current sessions}}",
392
+ { count: sessions.length }
393
+ )
341
394
  }
342
395
  )
343
396
  ] }) }),
344
397
  isBlocked && /* @__PURE__ */ jsxRuntime.jsxs(BlockedWarning, { children: [
345
398
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", textColor: "danger700", children: t("panel.blocked.title", "User is blocked") }),
346
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "danger600", style: { marginTop: "4px" }, children: t("panel.blocked.description", "Authentication disabled") })
399
+ /* @__PURE__ */ jsxRuntime.jsx(ReadableText, { variant: "pi", textColor: "danger600", tag: "p", children: t("panel.blocked.description", "Authentication disabled") })
347
400
  ] }),
348
401
  sessions.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 3, alignItems: "stretch", children: [
349
- /* @__PURE__ */ jsxRuntime.jsx(SectionLabel, { children: t("panel.sessions.title", "Active Sessions") }),
402
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "semiBold", textColor: "neutral600", children: t("panel.sessions.title", "Current Sessions") }),
350
403
  sessions.slice(0, 5).map((session) => {
351
- const deviceInfo = parseUserAgent(session.userAgent);
352
- const DeviceIcon = getDeviceIcon(deviceInfo.device);
404
+ const userAgent = typeof session.userAgent === "string" ? session.userAgent.trim() : "";
405
+ const hasUserAgent = Boolean(userAgent && userAgent.toLowerCase() !== "unknown");
406
+ const parsedDevice = hasUserAgent ? parseUserAgent(userAgent) : null;
407
+ const nativeDeviceType = typeof session.deviceType === "string" && session.deviceType.trim().toLowerCase() !== "unknown" ? session.deviceType.trim() : "";
408
+ const nativeDeviceName = typeof session.deviceName === "string" && session.deviceName.trim().toLowerCase() !== "unknown" ? session.deviceName.trim() : "";
409
+ const availableValue = (value) => typeof value === "string" && value.trim() && value.trim().toLowerCase() !== "unknown" ? value.trim() : "";
410
+ const deviceInfo = {
411
+ device: nativeDeviceName || nativeDeviceType || availableValue(parsedDevice?.device) || unavailableValue,
412
+ browser: availableValue(session.browserName) || availableValue(parsedDevice?.browser) || unavailableValue,
413
+ os: availableValue(session.osName) || availableValue(parsedDevice?.os) || unavailableValue
414
+ };
415
+ const DeviceIcon = getDeviceIcon(nativeDeviceType || parsedDevice?.device);
416
+ const sessionStatus = getSessionStatus(session);
417
+ const isSessionOnline = sessionStatus === "active";
353
418
  return /* @__PURE__ */ jsxRuntime.jsx(SessionCard, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 2, alignItems: "flex-start", children: [
354
419
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", children: [
355
420
  /* @__PURE__ */ jsxRuntime.jsx(IconWrapper, { children: /* @__PURE__ */ jsxRuntime.jsx(DeviceIcon, {}) }),
356
421
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", textColor: "neutral800", children: deviceInfo.device })
357
422
  ] }),
358
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { backgroundColor: "success600", textColor: "neutral0", size: "S", children: t("panel.sessions.active", "Active") }),
423
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { variant: isSessionOnline ? "success" : "warning", size: "S", children: isSessionOnline ? t("panel.sessions.active", "Active") : t("panel.sessions.idle", "Idle") }),
359
424
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: [
360
425
  deviceInfo.browser,
361
426
  " on ",
@@ -363,11 +428,11 @@ const SessionInfoPanel = ({ documentId, model, document }) => {
363
428
  ] }),
364
429
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, {}),
365
430
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", children: [
366
- /* @__PURE__ */ jsxRuntime.jsx(icons.Server, { width: "14px", height: "14px", style: { color: "var(--colors-neutral500)" } }),
367
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: session.ipAddress })
431
+ /* @__PURE__ */ jsxRuntime.jsx(MutedIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(icons.Server, { width: "14px", height: "14px" }) }),
432
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: session.ipAddress || unavailableValue })
368
433
  ] }),
369
434
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", children: [
370
- /* @__PURE__ */ jsxRuntime.jsx(icons.Clock, { width: "14px", height: "14px", style: { color: "var(--colors-neutral500)" } }),
435
+ /* @__PURE__ */ jsxRuntime.jsx(MutedIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(icons.Clock, { width: "14px", height: "14px" }) }),
371
436
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: new Date(session.loginTime).toLocaleString("en-US", {
372
437
  month: "short",
373
438
  day: "numeric",
@@ -387,36 +452,36 @@ const SessionInfoPanel = ({ documentId, model, document }) => {
387
452
  ] }) })
388
453
  ] }) : /* @__PURE__ */ jsxRuntime.jsxs(EmptyState, { children: [
389
454
  /* @__PURE__ */ jsxRuntime.jsx(EmptyIcon, { children: /* @__PURE__ */ jsxRuntime.jsx(icons.User, { width: "24px", height: "24px" }) }),
390
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", textColor: "neutral700", style: { display: "block" }, children: t("panel.empty.title", "No active sessions") }),
391
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral500", style: { display: "block", marginTop: "4px" }, children: t("panel.empty.description", "User has not logged in yet") })
455
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", textColor: "neutral700", style: { display: "block" }, children: t("panel.empty.title", "No current sessions") }),
456
+ /* @__PURE__ */ jsxRuntime.jsx(ReadableText, { variant: "pi", textColor: "neutral500", tag: "p", children: t("panel.empty.description", "User has not logged in yet") })
392
457
  ] }),
393
458
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, {}),
394
459
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", gap: 3, alignItems: "stretch", children: [
395
- /* @__PURE__ */ jsxRuntime.jsx(SectionLabel, { children: t("panel.actions.title", "Actions") }),
396
- /* @__PURE__ */ jsxRuntime.jsxs(
397
- ActionButton,
460
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "semiBold", textColor: "neutral600", children: t("panel.actions.title", "Actions") }),
461
+ /* @__PURE__ */ jsxRuntime.jsx(
462
+ designSystem.Button,
398
463
  {
399
- $variant: "danger",
464
+ fullWidth: true,
465
+ variant: "danger-light",
466
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {}),
400
467
  onClick: handleLogoutAll,
468
+ loading: actionLoading,
401
469
  disabled: actionLoading || sessions.length === 0,
402
470
  type: "button",
403
- children: [
404
- /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {}),
405
- t("panel.actions.terminateAll", "Terminate All Sessions")
406
- ]
471
+ children: t("panel.actions.terminateAll", "Terminate All Sessions")
407
472
  }
408
473
  ),
409
- /* @__PURE__ */ jsxRuntime.jsxs(
410
- ActionButton,
474
+ /* @__PURE__ */ jsxRuntime.jsx(
475
+ designSystem.Button,
411
476
  {
412
- $variant: isBlocked ? "success" : "danger",
477
+ fullWidth: true,
478
+ variant: isBlocked ? "secondary" : "danger-light",
479
+ startIcon: isBlocked ? /* @__PURE__ */ jsxRuntime.jsx(icons.Check, {}) : /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {}),
413
480
  onClick: handleToggleBlock,
481
+ loading: actionLoading,
414
482
  disabled: actionLoading,
415
483
  type: "button",
416
- children: [
417
- isBlocked ? /* @__PURE__ */ jsxRuntime.jsx(icons.Check, {}) : /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {}),
418
- isBlocked ? t("panel.actions.unblockUser", "Unblock User") : t("panel.actions.blockUser", "Block User")
419
- ]
484
+ children: isBlocked ? t("panel.actions.unblockUser", "Unblock User") : t("panel.actions.blockUser", "Block User")
420
485
  }
421
486
  )
422
487
  ] })
@@ -433,58 +498,57 @@ const prefixPluginTranslations = (data, pluginId2) => {
433
498
  const name = pluginPkg.strapi.name;
434
499
  const index = {
435
500
  register(app) {
436
- const pluginPermissions = [{ action: `plugin::${pluginId}.access`, subject: null }];
501
+ const pluginPermissions2 = [{ action: `plugin::${pluginId$1}.access`, subject: null }];
437
502
  app.addMenuLink({
438
- to: `plugins/${pluginId}`,
503
+ to: `plugins/${pluginId$1}`,
439
504
  icon: PluginIcon,
440
505
  intlLabel: {
441
- id: `${pluginId}.plugin.name`,
506
+ id: `${pluginId$1}.plugin.name`,
442
507
  defaultMessage: pluginPkg.strapi.displayName
443
508
  },
444
- Component: () => Promise.resolve().then(() => require("./App-B2VCS3cz.js")),
445
- permissions: pluginPermissions
509
+ Component: () => Promise.resolve().then(() => require("./App-AbZwLHtF.js")),
510
+ permissions: pluginPermissions2
446
511
  });
447
- app.createSettingSection(
512
+ app.addSettingsLink(
448
513
  {
449
- intlLabel: { id: `${pluginId}.settings.section`, defaultMessage: "Sessions" },
450
- id: pluginId,
451
- to: pluginId
514
+ id: pluginId$1,
515
+ intlLabel: { id: `${pluginId$1}.settings.section`, defaultMessage: "Session Manager" }
452
516
  },
453
517
  [
454
518
  {
455
519
  intlLabel: {
456
- id: `${pluginId}.settings.general`,
520
+ id: `${pluginId$1}.settings.general`,
457
521
  defaultMessage: "General"
458
522
  },
459
523
  id: "general",
460
- to: `${pluginId}/general`,
461
- Component: () => Promise.resolve().then(() => require("./Settings-gv2BF54w.js")),
462
- permissions: pluginPermissions
524
+ to: `${pluginId$1}/general`,
525
+ Component: () => Promise.resolve().then(() => require("./Settings-B4DNdeKx.js")),
526
+ permissions: pluginPermissions2
463
527
  },
464
528
  {
465
529
  intlLabel: {
466
- id: `${pluginId}.settings.analytics`,
530
+ id: `${pluginId$1}.settings.analytics`,
467
531
  defaultMessage: "Analytics"
468
532
  },
469
533
  id: "analytics",
470
- to: `${pluginId}/analytics`,
471
- Component: () => Promise.resolve().then(() => require("./Analytics-D03ZNNMR.js")),
472
- permissions: pluginPermissions
534
+ to: `${pluginId$1}/analytics`,
535
+ Component: () => Promise.resolve().then(() => require("./Analytics-CaRlu5ad.js")),
536
+ permissions: pluginPermissions2
473
537
  },
474
538
  {
475
539
  intlLabel: {
476
- id: `${pluginId}.settings.license`,
540
+ id: `${pluginId$1}.settings.license`,
477
541
  defaultMessage: "Activation"
478
542
  },
479
543
  id: "license",
480
- to: `${pluginId}/license`,
481
- Component: () => Promise.resolve().then(() => require("./License-fixnQ7wF.js")),
482
- permissions: pluginPermissions
544
+ to: `${pluginId$1}/license`,
545
+ Component: () => Promise.resolve().then(() => require("./License-CABdPwnd.js")),
546
+ permissions: pluginPermissions2
483
547
  }
484
548
  ]
485
549
  );
486
550
  app.registerPlugin({
487
- id: pluginId,
551
+ id: pluginId$1,
488
552
  initializer: Initializer,
489
553
  isReady: true,
490
554
  name
@@ -493,41 +557,42 @@ const index = {
493
557
  app.widgets.register({
494
558
  icon: PluginIcon,
495
559
  title: {
496
- id: `${pluginId}.widget.online-users.title`,
560
+ id: `${pluginId$1}.widget.online-users.title`,
497
561
  defaultMessage: "Online Users"
498
562
  },
499
563
  component: async () => {
500
- const component = await Promise.resolve().then(() => require("./OnlineUsersWidget-qb9utPBy.js"));
564
+ const component = await Promise.resolve().then(() => require("./OnlineUsersWidget-CPFAACSb.js"));
501
565
  return component.default;
502
566
  },
503
567
  id: "online-users-widget",
504
- pluginId
568
+ pluginId: pluginId$1,
569
+ permissions: pluginPermissions2
505
570
  });
506
- console.log(`[${pluginId}] [SUCCESS] Online Users Widget registered`);
571
+ console.log(`[${pluginId$1}] [SUCCESS] Online Users Widget registered`);
507
572
  }
508
573
  },
509
574
  bootstrap(app) {
510
- console.log(`[${pluginId}] Bootstrapping plugin...`);
575
+ console.log(`[${pluginId$1}] Bootstrapping plugin...`);
511
576
  try {
512
577
  const contentManagerPlugin = app.getPlugin("content-manager");
513
578
  if (contentManagerPlugin && contentManagerPlugin.apis) {
514
- console.log(`[${pluginId}] Injecting SessionInfoPanel into edit view sidebar...`);
579
+ console.log(`[${pluginId$1}] Injecting SessionInfoPanel into edit view sidebar...`);
515
580
  contentManagerPlugin.apis.addEditViewSidePanel([SessionInfoPanel]);
516
- console.log(`[${pluginId}] [SUCCESS] SessionInfoPanel injected successfully`);
581
+ console.log(`[${pluginId$1}] [SUCCESS] SessionInfoPanel injected successfully`);
517
582
  } else {
518
- console.warn(`[${pluginId}] Content Manager plugin or APIs not available`);
583
+ console.warn(`[${pluginId$1}] Content Manager plugin or APIs not available`);
519
584
  }
520
585
  } catch (error) {
521
- console.error(`[${pluginId}] Error injecting SessionInfoPanel:`, error);
586
+ logSafeAdminError("plugin.bootstrap", error);
522
587
  }
523
588
  },
524
589
  async registerTrads({ locales }) {
525
590
  const importedTrads = {
526
- en: () => Promise.resolve().then(() => require("./en-BRmVwd8-.js")),
527
- de: () => Promise.resolve().then(() => require("./de-BnqGCokx.js")),
528
- es: () => Promise.resolve().then(() => require("./es-CH691xcL.js")),
529
- fr: () => Promise.resolve().then(() => require("./fr-CLExO0w_.js")),
530
- pt: () => Promise.resolve().then(() => require("./pt-BJ_F0yNi.js"))
591
+ en: () => Promise.resolve().then(() => require("./en-C5iYQ0mC.js")),
592
+ de: () => Promise.resolve().then(() => require("./de-D23nmqnl.js")),
593
+ es: () => Promise.resolve().then(() => require("./es-CIXnsG-p.js")),
594
+ fr: () => Promise.resolve().then(() => require("./fr-BglXE-W4.js")),
595
+ pt: () => Promise.resolve().then(() => require("./pt-J5sf7jiY.js"))
531
596
  };
532
597
  const translatedLanguages = Object.keys(importedTrads).filter(
533
598
  (lang) => locales.includes(lang)
@@ -535,7 +600,7 @@ const index = {
535
600
  const translations = await Promise.all(
536
601
  translatedLanguages.map(
537
602
  (language) => importedTrads[language]().then(({ default: data }) => ({
538
- data: prefixPluginTranslations(data, pluginId),
603
+ data: prefixPluginTranslations(data, pluginId$1),
539
604
  locale: language
540
605
  })).catch(() => ({
541
606
  data: {},
@@ -546,7 +611,15 @@ const index = {
546
611
  return Promise.resolve(translations);
547
612
  }
548
613
  };
614
+ exports.DEFAULT_SESSION_FILTER = DEFAULT_SESSION_FILTER;
615
+ exports.ReadableParagraphs = ReadableParagraphs;
616
+ exports.ReadableText = ReadableText;
617
+ exports.filterSessionsByStatus = filterSessionsByStatus;
618
+ exports.getSessionStatus = getSessionStatus;
549
619
  exports.getTranslation = getTranslation;
550
620
  exports.index = index;
621
+ exports.logSafeAdminError = logSafeAdminError;
622
+ exports.paragraphRhythm = paragraphRhythm;
551
623
  exports.parseUserAgent = parseUserAgent;
552
- exports.pluginId = pluginId;
624
+ exports.pluginId = pluginId$1;
625
+ exports.pluginPermissions = pluginPermissions;