strapi-plugin-magic-sessionmanager 4.8.0 → 4.9.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 (72) hide show
  1. package/CHANGELOG.md +83 -5
  2. package/README.md +379 -641
  3. package/dist/admin/Analytics-B6d-39Qh.js +420 -0
  4. package/dist/admin/Analytics-DxOWXHn8.mjs +418 -0
  5. package/dist/admin/App-ZsSGj7n8.mjs +1894 -0
  6. package/dist/admin/App-mRFV50K6.js +1896 -0
  7. package/dist/admin/License-BE6UQ_V3.mjs +443 -0
  8. package/dist/admin/License-DXt2oi6u.js +443 -0
  9. package/dist/admin/OnlineUsersWidget-CFvM3Vbp.js +273 -0
  10. package/dist/admin/OnlineUsersWidget-_tJ6aeWl.mjs +254 -0
  11. package/dist/admin/SectionCard-BlWv8CRt.js +54 -0
  12. package/dist/admin/SectionCard-D51bv4Hi.mjs +55 -0
  13. package/dist/admin/Settings-BUc12TP5.js +3570 -0
  14. package/dist/admin/Settings-dtW7cjTX.mjs +3568 -0
  15. package/dist/admin/de-BFKoGEVT.js +544 -0
  16. package/dist/admin/de-j0oZH9Pz.mjs +544 -0
  17. package/dist/admin/en-UY4Tb5tE.mjs +544 -0
  18. package/dist/admin/en-s7Ksdkcg.js +544 -0
  19. package/dist/admin/es-07OGMe_5.js +544 -0
  20. package/dist/admin/es-DGBcZwQy.mjs +544 -0
  21. package/dist/admin/fr-B6-DWhGO.mjs +544 -0
  22. package/dist/admin/fr-ETj_2UBY.js +544 -0
  23. package/dist/admin/index-C_SyRULc.mjs +1750 -0
  24. package/dist/admin/index-D4kEnXSp.js +1751 -0
  25. package/dist/admin/index.js +1 -1
  26. package/dist/admin/index.mjs +2 -2
  27. package/dist/admin/maskSensitiveValue-BWcSjow7.js +9 -0
  28. package/dist/admin/maskSensitiveValue-lLRhN_S7.mjs +10 -0
  29. package/dist/admin/pt-C7PwrQtV.js +544 -0
  30. package/dist/admin/pt-YMRLm9gx.mjs +544 -0
  31. package/dist/server/index.js +1092 -463
  32. package/dist/server/index.mjs +1092 -463
  33. package/package.json +10 -1
  34. package/pics/analytics.png +0 -0
  35. package/pics/dashboard-dark.png +0 -0
  36. package/pics/dashboard.png +0 -0
  37. package/pics/dashboardsessionmodal.png +0 -0
  38. package/pics/mobile-dashboard.png +0 -0
  39. package/pics/mobile-session.png +0 -0
  40. package/pics/sessioninfopanel.png +0 -0
  41. package/pics/settings1.png +0 -0
  42. package/pics/settings2.png +0 -0
  43. package/pics/widget.png +0 -0
  44. package/scripts/geoip-updater.cjs +35 -24
  45. package/dist/admin/Analytics-CaRlu5ad.js +0 -332
  46. package/dist/admin/Analytics-THqDbNX0.mjs +0 -330
  47. package/dist/admin/App-AbZwLHtF.js +0 -1263
  48. package/dist/admin/App-hSh7guii.mjs +0 -1261
  49. package/dist/admin/FormField-C8kIT2NE.mjs +0 -59
  50. package/dist/admin/FormField-b5KBvkrj.js +0 -60
  51. package/dist/admin/License-BXBVwUVu.mjs +0 -299
  52. package/dist/admin/License-CABdPwnd.js +0 -301
  53. package/dist/admin/OnlineUsersWidget-BnWFj9IM.mjs +0 -230
  54. package/dist/admin/OnlineUsersWidget-CPFAACSb.js +0 -230
  55. package/dist/admin/PluginPageLayout-BPFMcgrx.mjs +0 -42
  56. package/dist/admin/PluginPageLayout-DmNzMdqu.js +0 -43
  57. package/dist/admin/Settings-B4DNdeKx.js +0 -2152
  58. package/dist/admin/Settings-C4RsJosh.mjs +0 -2150
  59. package/dist/admin/de-AwIFTd9i.mjs +0 -450
  60. package/dist/admin/de-D23nmqnl.js +0 -450
  61. package/dist/admin/en-C5iYQ0mC.js +0 -450
  62. package/dist/admin/en-D6QEGeRh.mjs +0 -450
  63. package/dist/admin/es-CIXnsG-p.js +0 -435
  64. package/dist/admin/es-CnFfVdKw.mjs +0 -435
  65. package/dist/admin/fr-BglXE-W4.js +0 -435
  66. package/dist/admin/fr-DefoR7uH.mjs +0 -435
  67. package/dist/admin/index-BFVITQ-o.mjs +0 -624
  68. package/dist/admin/index-DlMm-NyK.js +0 -625
  69. package/dist/admin/maskSensitiveValue-1uGWmrfG.mjs +0 -20
  70. package/dist/admin/maskSensitiveValue-B9vhxPad.js +0 -19
  71. package/dist/admin/pt-J5sf7jiY.js +0 -435
  72. package/dist/admin/pt-TODwvNQA.mjs +0 -435
@@ -1,1263 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const react = require("react");
5
- const reactIntl = require("react-intl");
6
- const admin = require("@strapi/strapi/admin");
7
- const styled = require("styled-components");
8
- const index = require("./index-DlMm-NyK.js");
9
- const designSystem = require("@strapi/design-system");
10
- const icons = require("@strapi/icons");
11
- const PluginPageLayout = require("./PluginPageLayout-DmNzMdqu.js");
12
- const FormField = require("./FormField-b5KBvkrj.js");
13
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
14
- const styled__default = /* @__PURE__ */ _interopDefault(styled);
15
- const theme = {
16
- spacing: {
17
- xs: "4px",
18
- sm: "8px",
19
- md: "16px",
20
- lg: "24px",
21
- xl: "32px"
22
- }
23
- };
24
- function paginateSessions(sessions = [], currentPage = 1, pageSize = 25) {
25
- const items = Array.isArray(sessions) ? sessions : [];
26
- const requestedSize = Number(pageSize);
27
- const normalizedSize = Number.isFinite(requestedSize) && requestedSize > 0 ? Math.floor(requestedSize) : 1;
28
- const total = items.length;
29
- const pageCount = Math.max(1, Math.ceil(total / normalizedSize));
30
- const requestedPage = Number(currentPage);
31
- const page = Math.min(
32
- pageCount,
33
- Math.max(1, Number.isFinite(requestedPage) ? Math.floor(requestedPage) : 1)
34
- );
35
- const offset = (page - 1) * normalizedSize;
36
- return {
37
- items: items.slice(offset, offset + normalizedSize),
38
- page,
39
- pageCount,
40
- startIndex: total === 0 ? 0 : offset + 1,
41
- endIndex: Math.min(total, offset + normalizedSize),
42
- total
43
- };
44
- }
45
- const CSV_HEADERS = [
46
- "ID",
47
- "Status",
48
- "User Email",
49
- "Username",
50
- "Device",
51
- "Browser",
52
- "OS",
53
- "IP Address",
54
- "Login Time",
55
- "Last Active",
56
- "Logout Time",
57
- "Minutes Idle"
58
- ];
59
- const escapeCsvValue = (value) => `"${String(value ?? "").replace(/"/g, '""')}"`;
60
- function buildSessionCsv(sessions, { unavailableValue, getDeviceInfo, getSessionStatus }) {
61
- const rows = Array.isArray(sessions) ? sessions : [];
62
- const csvRows = rows.map((session) => {
63
- const deviceInfo = getDeviceInfo(session, unavailableValue);
64
- return [
65
- session.id,
66
- getSessionStatus(session),
67
- session.user?.email || "",
68
- session.user?.username || "",
69
- deviceInfo.device,
70
- deviceInfo.browser,
71
- deviceInfo.os,
72
- session.ipAddress || unavailableValue,
73
- new Date(session.loginTime).toISOString(),
74
- new Date(session.lastActive || session.loginTime).toISOString(),
75
- session.logoutTime ? new Date(session.logoutTime).toISOString() : "",
76
- session.minutesSinceActive
77
- ];
78
- });
79
- return [
80
- CSV_HEADERS.map(escapeCsvValue).join(","),
81
- ...csvRows.map((row) => row.map(escapeCsvValue).join(","))
82
- ].join("\n");
83
- }
84
- function buildSessionJson(sessions, {
85
- filterStatus,
86
- totalSessions,
87
- exportedAt,
88
- unavailableValue,
89
- getDeviceInfo,
90
- getSessionStatus
91
- }) {
92
- const rows = Array.isArray(sessions) ? sessions : [];
93
- const exportData = {
94
- exportedAt,
95
- filter: filterStatus,
96
- totalSessions,
97
- exportedSessions: rows.length,
98
- sessions: rows.map((session) => {
99
- const deviceInfo = getDeviceInfo(session, unavailableValue);
100
- return {
101
- id: session.id,
102
- status: getSessionStatus(session),
103
- user: {
104
- id: session.user?.documentId || session.user?.id,
105
- email: session.user?.email,
106
- username: session.user?.username
107
- },
108
- device: {
109
- type: deviceInfo.device,
110
- browser: deviceInfo.browser,
111
- browserVersion: deviceInfo.browserVersion,
112
- os: deviceInfo.os
113
- },
114
- ipAddress: session.ipAddress || unavailableValue,
115
- loginTime: session.loginTime,
116
- lastActive: session.lastActive,
117
- logoutTime: session.logoutTime,
118
- minutesSinceActive: session.minutesSinceActive,
119
- isActive: session.isActive,
120
- isTrulyActive: session.isTrulyActive
121
- };
122
- })
123
- };
124
- return JSON.stringify(exportData, null, 2);
125
- }
126
- const BROWSER_VERSION_PATTERNS = [
127
- /\bEdg(?:A|iOS)?\/([\d.]+)/i,
128
- /\bOPR\/([\d.]+)/i,
129
- /\b(?:Chrome|CriOS)\/([\d.]+)/i,
130
- /\bFirefox\/([\d.]+)/i,
131
- /\bVersion\/([\d.]+).*Safari/i
132
- ];
133
- function getBrowserVersionFromUserAgent(userAgent) {
134
- if (typeof userAgent !== "string" || !userAgent.trim() || userAgent.trim().toLowerCase() === "unknown") {
135
- return "";
136
- }
137
- for (const pattern of BROWSER_VERSION_PATTERNS) {
138
- const match = userAgent.match(pattern);
139
- if (match?.[1]) return match[1];
140
- }
141
- return "";
142
- }
143
- function formatSessionDateTime(value, locale, fallback) {
144
- if (value === null || value === void 0 || value === "") return fallback;
145
- const date = value instanceof Date ? value : new Date(value);
146
- if (!Number.isFinite(date.getTime())) return fallback;
147
- const options = { dateStyle: "medium", timeStyle: "short" };
148
- try {
149
- return new Intl.DateTimeFormat(locale || "en", options).format(date);
150
- } catch {
151
- return new Intl.DateTimeFormat("en", options).format(date);
152
- }
153
- }
154
- const TwoColumnGrid = styled__default.default.div`
155
- display: grid;
156
- grid-template-columns: repeat(2, minmax(0, 1fr));
157
- gap: 24px;
158
- min-width: 0;
159
-
160
- & > * {
161
- min-width: 0;
162
- }
163
-
164
- @media (max-width: 767px) {
165
- grid-template-columns: minmax(0, 1fr);
166
- }
167
- `;
168
- const Section = styled__default.default(designSystem.Box)`
169
- min-width: 0;
170
- margin-bottom: 24px;
171
- `;
172
- const DetailsList = styled__default.default.dl`
173
- display: grid;
174
- grid-template-columns: repeat(2, minmax(0, 1fr));
175
- column-gap: 24px;
176
- row-gap: 0;
177
- width: 100%;
178
- min-width: 0;
179
- margin: 8px 0 0;
180
-
181
- @media (max-width: 519px) {
182
- grid-template-columns: minmax(0, 1fr);
183
- }
184
- `;
185
- const DetailItem = styled__default.default.div`
186
- display: flex;
187
- flex-direction: column;
188
- gap: 4px;
189
- min-width: 0;
190
- padding: 10px 0 12px;
191
- border-bottom: 1px solid ${(props) => props.theme.colors.neutral150};
192
- `;
193
- const DetailLabel = styled__default.default(designSystem.Typography)`
194
- display: block;
195
- width: 100%;
196
- min-width: 0;
197
- margin: 0;
198
- font-size: 12px;
199
- line-height: 1.5;
200
- font-weight: 600;
201
- text-wrap: pretty;
202
- `;
203
- const DetailValue = styled__default.default(designSystem.Typography)`
204
- display: block;
205
- width: 100%;
206
- min-width: 0;
207
- margin: 0;
208
- font-size: 14px;
209
- line-height: 1.5;
210
- overflow-wrap: anywhere;
211
- word-break: break-word;
212
- `;
213
- const ModalActions = styled__default.default(designSystem.Flex)`
214
- width: 100%;
215
- min-width: 0;
216
- gap: 12px;
217
- flex-wrap: wrap;
218
-
219
- @media (max-width: 519px) {
220
- flex-direction: column;
221
- align-items: stretch;
222
-
223
- & > button {
224
- width: 100%;
225
- }
226
- }
227
- `;
228
- const getStoredGeoData = (session) => {
229
- let geoLocation = session?.geoLocation;
230
- if (typeof geoLocation === "string") {
231
- try {
232
- geoLocation = JSON.parse(geoLocation);
233
- } catch {
234
- geoLocation = null;
235
- }
236
- }
237
- if (!geoLocation || typeof geoLocation !== "object") return null;
238
- if (!geoLocation.country && !geoLocation.country_code && !geoLocation.city && !geoLocation.timezone) return null;
239
- const hasSecurityScore = typeof session.securityScore === "number";
240
- return {
241
- country_flag: geoLocation.country_flag || "",
242
- country: geoLocation.country || geoLocation.country_code || null,
243
- city: geoLocation.city || null,
244
- timezone: geoLocation.timezone || null,
245
- securityScore: hasSecurityScore ? session.securityScore : null,
246
- riskLevel: hasSecurityScore ? session.securityScore < 50 ? "High" : "Low" : null,
247
- isVpn: typeof geoLocation.isVpn === "boolean" ? geoLocation.isVpn : null,
248
- isProxy: typeof geoLocation.isProxy === "boolean" ? geoLocation.isProxy : null
249
- };
250
- };
251
- const getSessionDeviceInfo$1 = (session, unavailableValue) => {
252
- const normalize = (value) => typeof value === "string" && value.trim() && value.trim().toLowerCase() !== "unknown" ? value.trim() : "";
253
- const userAgent = typeof session?.userAgent === "string" ? session.userAgent.trim() : "";
254
- if (userAgent && userAgent.toLowerCase() !== "unknown") {
255
- const parsed = index.parseUserAgent(userAgent);
256
- const device = normalize(parsed.device);
257
- return {
258
- device: device || unavailableValue,
259
- browser: normalize(parsed.browser) || unavailableValue,
260
- browserVersion: getBrowserVersionFromUserAgent(userAgent) || normalize(session?.browserVersion),
261
- os: normalize(parsed.os) || unavailableValue,
262
- hasDeviceType: Boolean(device)
263
- };
264
- }
265
- const deviceName = normalize(session?.deviceName);
266
- const deviceType = normalize(session?.deviceType);
267
- const browserName = normalize(session?.browserName);
268
- const osName = normalize(session?.osName);
269
- return {
270
- device: deviceName || deviceType || unavailableValue,
271
- browser: browserName || unavailableValue,
272
- browserVersion: normalize(session?.browserVersion),
273
- os: osName || unavailableValue,
274
- hasDeviceType: Boolean(deviceType)
275
- };
276
- };
277
- const SessionDetailModal = ({ session, onClose, onSessionTerminated }) => {
278
- const { formatMessage, locale } = reactIntl.useIntl();
279
- const { get, post } = admin.useFetchClient();
280
- const { toggleNotification } = admin.useNotification();
281
- const [terminating, setTerminating] = react.useState(false);
282
- const [showUserAgent, setShowUserAgent] = react.useState(false);
283
- const [geoData, setGeoData] = react.useState(null);
284
- const [geoLoading, setGeoLoading] = react.useState(false);
285
- const t = (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
286
- const unavailableValue = t("modal.user.na", "Unavailable");
287
- react.useEffect(() => {
288
- let cancelled = false;
289
- const ipAddress = session?.ipAddress;
290
- const storedGeoData = getStoredGeoData(session);
291
- if (storedGeoData) {
292
- setGeoData(storedGeoData);
293
- setGeoLoading(false);
294
- return () => {
295
- cancelled = true;
296
- };
297
- }
298
- if (!ipAddress) {
299
- setGeoData(null);
300
- setGeoLoading(false);
301
- return () => {
302
- cancelled = true;
303
- };
304
- }
305
- const fetchGeolocationData = async () => {
306
- setGeoData(null);
307
- setGeoLoading(true);
308
- try {
309
- const { data } = await get(`/${index.pluginId}/geolocation/${encodeURIComponent(ipAddress)}`);
310
- if (!cancelled) {
311
- setGeoData(data.data);
312
- }
313
- } catch (err) {
314
- index.logSafeAdminError("sessionDetails.geolocation", err);
315
- if (!cancelled) {
316
- setGeoData(null);
317
- }
318
- } finally {
319
- if (!cancelled) {
320
- setGeoLoading(false);
321
- }
322
- }
323
- };
324
- fetchGeolocationData();
325
- return () => {
326
- cancelled = true;
327
- };
328
- }, [get, session]);
329
- if (!session) return null;
330
- const deviceInfo = getSessionDeviceInfo$1(session, unavailableValue);
331
- const sessionStatus = index.getSessionStatus(session);
332
- const statusVariant = {
333
- active: "success",
334
- idle: "warning",
335
- loggedout: "neutral",
336
- terminated: "neutral"
337
- }[sessionStatus] || "neutral";
338
- const statusLabel = {
339
- active: t("modal.status.online", "Active"),
340
- idle: t("modal.status.idle", "Idle"),
341
- loggedout: t("modal.status.loggedOut", "Logged out"),
342
- terminated: t("modal.status.terminated", "Terminated")
343
- }[sessionStatus] || t("modal.status.terminated", "Terminated");
344
- const securityData = geoData || {
345
- country_flag: "",
346
- country: unavailableValue,
347
- city: unavailableValue,
348
- timezone: unavailableValue,
349
- securityScore: null,
350
- riskLevel: null,
351
- isVpn: null,
352
- isProxy: null
353
- };
354
- const getDeviceIcon = (deviceType) => {
355
- if (deviceType === "Mobile" || deviceType === "Tablet") return icons.Phone;
356
- if (deviceType === "Desktop" || deviceType === "Laptop") return icons.Monitor;
357
- return icons.Server;
358
- };
359
- const DeviceIcon = deviceInfo.hasDeviceType ? getDeviceIcon(deviceInfo.device) : icons.Information;
360
- const handleTerminate = async () => {
361
- if (!confirm(t("modal.confirm.terminate", "Are you sure you want to terminate this session?"))) {
362
- return;
363
- }
364
- setTerminating(true);
365
- try {
366
- await post(`/${index.pluginId}/sessions/${session.id}/terminate`);
367
- toggleNotification({
368
- type: "success",
369
- message: t("notifications.success.terminated", "Session terminated successfully")
370
- });
371
- onSessionTerminated();
372
- onClose();
373
- } catch (err) {
374
- index.logSafeAdminError("sessionDetails.terminate", err);
375
- toggleNotification({
376
- type: "danger",
377
- message: t("notifications.error.terminate", "Failed to terminate session")
378
- });
379
- } finally {
380
- setTerminating(false);
381
- }
382
- };
383
- const DetailField = ({ label, value }) => /* @__PURE__ */ jsxRuntime.jsxs(DetailItem, { children: [
384
- /* @__PURE__ */ jsxRuntime.jsx(DetailLabel, { variant: "pi", textColor: "neutral600", tag: "dt", children: label }),
385
- /* @__PURE__ */ jsxRuntime.jsx(DetailValue, { variant: "omega", textColor: "neutral800", tag: "dd", children: value })
386
- ] });
387
- const browserValue = [deviceInfo.browser, deviceInfo.browserVersion].filter(Boolean).join(" ") || unavailableValue;
388
- const idleMinutes = session.minutesSinceActive;
389
- const idleTimeValue = idleMinutes !== null && idleMinutes !== void 0 && Number.isFinite(Number(idleMinutes)) ? t("modal.timeline.minutes", "{minutes} min", { minutes: Number(idleMinutes) }) : unavailableValue;
390
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Root, { open: true, onOpenChange: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(
391
- designSystem.Modal.Content,
392
- {
393
- style: {
394
- width: "min(900px, calc(100vw - 24px))",
395
- maxHeight: "calc(100vh - 24px)",
396
- display: "flex",
397
- flexDirection: "column"
398
- },
399
- children: [
400
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 3, alignItems: "center", style: { minWidth: 0 }, children: [
401
- /* @__PURE__ */ jsxRuntime.jsx(
402
- designSystem.Box,
403
- {
404
- padding: 2,
405
- background: "neutral100",
406
- hasRadius: true,
407
- style: { display: "flex", alignItems: "center", justifyContent: "center" },
408
- children: /* @__PURE__ */ jsxRuntime.jsx(DeviceIcon, { width: "24px", height: "24px" })
409
- }
410
- ),
411
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", style: { minWidth: 0 }, children: [
412
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", fontWeight: "bold", style: { overflowWrap: "anywhere" }, children: t("modal.title", "Session Details") }),
413
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", style: { overflowWrap: "anywhere" }, children: t("modal.id", "ID: {id}", { id: session.id }) })
414
- ] })
415
- ] }) }),
416
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { style: { overflowY: "auto", minHeight: 0 }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: { initial: 3, small: 5 }, style: { minWidth: 0 }, children: [
417
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-start", style: { marginBottom: "24px" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { variant: statusVariant, size: "M", children: statusLabel }) }),
418
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, { style: { marginBottom: "24px" } }),
419
- /* @__PURE__ */ jsxRuntime.jsxs(TwoColumnGrid, { children: [
420
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
421
- /* @__PURE__ */ jsxRuntime.jsxs(Section, { children: [
422
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", fontWeight: "semiBold", textColor: "neutral800", tag: "h2", style: { marginBottom: "8px" }, children: t("modal.section.user", "User") }),
423
- /* @__PURE__ */ jsxRuntime.jsxs(DetailsList, { children: [
424
- /* @__PURE__ */ jsxRuntime.jsx(DetailField, { label: t("modal.user.username", "Username"), value: session.user?.username || unavailableValue }),
425
- /* @__PURE__ */ jsxRuntime.jsx(DetailField, { label: t("modal.user.email", "Email"), value: session.user?.email || unavailableValue }),
426
- /* @__PURE__ */ jsxRuntime.jsx(DetailField, { label: t("modal.user.id", "User ID"), value: session.user?.documentId || session.user?.id || unavailableValue })
427
- ] })
428
- ] }),
429
- /* @__PURE__ */ jsxRuntime.jsxs(Section, { children: [
430
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", fontWeight: "semiBold", textColor: "neutral800", tag: "h2", style: { marginBottom: "8px" }, children: t("modal.section.device", "Device") }),
431
- /* @__PURE__ */ jsxRuntime.jsxs(DetailsList, { children: [
432
- /* @__PURE__ */ jsxRuntime.jsx(DetailField, { label: t("modal.device.device", "Device"), value: deviceInfo.device }),
433
- /* @__PURE__ */ jsxRuntime.jsx(DetailField, { label: t("modal.device.browser", "Browser"), value: browserValue }),
434
- /* @__PURE__ */ jsxRuntime.jsx(DetailField, { label: t("modal.device.os", "OS"), value: deviceInfo.os }),
435
- /* @__PURE__ */ jsxRuntime.jsx(DetailField, { label: t("modal.device.ip", "IP"), value: session.ipAddress || unavailableValue })
436
- ] })
437
- ] })
438
- ] }),
439
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(Section, { children: [
440
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", fontWeight: "semiBold", textColor: "neutral800", tag: "h2", style: { marginBottom: "8px" }, children: t("modal.section.timeline", "Timeline") }),
441
- /* @__PURE__ */ jsxRuntime.jsxs(DetailsList, { children: [
442
- /* @__PURE__ */ jsxRuntime.jsx(
443
- DetailField,
444
- {
445
- label: t("modal.timeline.login", "Login"),
446
- value: formatSessionDateTime(session.loginTime, locale, unavailableValue)
447
- }
448
- ),
449
- /* @__PURE__ */ jsxRuntime.jsx(
450
- DetailField,
451
- {
452
- label: t("modal.timeline.lastActive", "Last Active"),
453
- value: formatSessionDateTime(session.lastActive || session.loginTime, locale, unavailableValue)
454
- }
455
- ),
456
- /* @__PURE__ */ jsxRuntime.jsx(DetailField, { label: t("modal.timeline.idleTime", "Idle Time"), value: idleTimeValue }),
457
- session.logoutTime && /* @__PURE__ */ jsxRuntime.jsx(
458
- DetailField,
459
- {
460
- label: t("modal.timeline.logout", "Logout"),
461
- value: formatSessionDateTime(session.logoutTime, locale, unavailableValue)
462
- }
463
- )
464
- ] })
465
- ] }) })
466
- ] }),
467
- /* @__PURE__ */ jsxRuntime.jsxs(Section, { children: [
468
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", fontWeight: "semiBold", textColor: "neutral800", tag: "h2", style: { marginBottom: "8px" }, children: t("modal.section.security", "Location and Security") }),
469
- geoLoading ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { padding: 4, style: { textAlign: "center" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t("modal.security.loading", "Loading location data...") }) }) : /* @__PURE__ */ jsxRuntime.jsxs(DetailsList, { children: [
470
- /* @__PURE__ */ jsxRuntime.jsx(
471
- DetailField,
472
- {
473
- label: t("modal.security.country", "Country"),
474
- value: [securityData.country_flag, securityData.country].filter(Boolean).join(" ") || unavailableValue
475
- }
476
- ),
477
- /* @__PURE__ */ jsxRuntime.jsx(DetailField, { label: t("modal.security.city", "City"), value: securityData.city || unavailableValue }),
478
- /* @__PURE__ */ jsxRuntime.jsx(DetailField, { label: t("modal.security.timezone", "Timezone"), value: securityData.timezone || unavailableValue }),
479
- /* @__PURE__ */ jsxRuntime.jsx(
480
- DetailField,
481
- {
482
- label: t("modal.security.score", "Security"),
483
- value: typeof securityData.securityScore === "number" ? `${securityData.securityScore}/100 (${securityData.riskLevel || unavailableValue})` : unavailableValue
484
- }
485
- ),
486
- /* @__PURE__ */ jsxRuntime.jsx(
487
- DetailField,
488
- {
489
- label: t("modal.security.vpn", "VPN"),
490
- value: typeof securityData.isVpn === "boolean" ? securityData.isVpn ? t("modal.security.vpnWarning", "Yes") : t("modal.security.no", "No") : unavailableValue
491
- }
492
- ),
493
- /* @__PURE__ */ jsxRuntime.jsx(
494
- DetailField,
495
- {
496
- label: t("modal.security.proxy", "Proxy"),
497
- value: typeof securityData.isProxy === "boolean" ? securityData.isProxy ? t("modal.security.vpnWarning", "Yes") : t("modal.security.no", "No") : unavailableValue
498
- }
499
- )
500
- ] })
501
- ] }),
502
- /* @__PURE__ */ jsxRuntime.jsxs(Section, { children: [
503
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", style: { marginBottom: "12px", minWidth: 0, flexWrap: "wrap", gap: "8px" }, children: [
504
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", fontWeight: "semiBold", textColor: "neutral800", tag: "h2", children: t("modal.section.technical", "Technical Details") }),
505
- /* @__PURE__ */ jsxRuntime.jsx(
506
- designSystem.Button,
507
- {
508
- variant: "tertiary",
509
- size: "S",
510
- onClick: () => setShowUserAgent(!showUserAgent),
511
- "aria-expanded": showUserAgent,
512
- "aria-controls": "session-user-agent-details",
513
- children: showUserAgent ? t("modal.technical.hide", "Hide Details") : t("modal.technical.show", "Show Details")
514
- }
515
- )
516
- ] }),
517
- /* @__PURE__ */ jsxRuntime.jsx("div", { id: "session-user-agent-details", hidden: !showUserAgent, children: showUserAgent && /* @__PURE__ */ jsxRuntime.jsx(
518
- designSystem.Box,
519
- {
520
- padding: 3,
521
- background: "neutral100",
522
- hasRadius: true,
523
- style: {
524
- fontFamily: "monospace",
525
- fontSize: "12px",
526
- lineHeight: 1.5,
527
- overflowWrap: "anywhere",
528
- maxHeight: "min(16rem, 30vh)",
529
- overflow: "auto",
530
- marginTop: "8px"
531
- },
532
- children: /* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { variant: "pi", textColor: "neutral600", tag: "p", children: typeof session.userAgent === "string" && session.userAgent.trim() && session.userAgent.trim().toLowerCase() !== "unknown" ? session.userAgent : unavailableValue })
533
- }
534
- ) })
535
- ] })
536
- ] }) }),
537
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs(ModalActions, { justifyContent: "space-between", children: [
538
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", onClick: onClose, children: t("modal.actions.close", "Close") }),
539
- /* @__PURE__ */ jsxRuntime.jsx(
540
- designSystem.Button,
541
- {
542
- variant: "danger-light",
543
- onClick: handleTerminate,
544
- disabled: !session.isActive || terminating,
545
- loading: terminating,
546
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {}),
547
- children: t("modal.actions.terminate", "Terminate Session")
548
- }
549
- )
550
- ] }) })
551
- ]
552
- }
553
- ) });
554
- };
555
- const breakpoints = {
556
- mobile: "768px"
557
- };
558
- const getSessionDeviceInfo = (session, unavailableValue) => {
559
- const normalize = (value) => typeof value === "string" && value.trim() && value.trim().toLowerCase() !== "unknown" ? value.trim() : "";
560
- const userAgent = typeof session?.userAgent === "string" ? session.userAgent.trim() : "";
561
- if (userAgent && userAgent.toLowerCase() !== "unknown") {
562
- const parsed = index.parseUserAgent(userAgent);
563
- const device = normalize(parsed.device);
564
- return {
565
- device: device || unavailableValue,
566
- browser: normalize(parsed.browser) || unavailableValue,
567
- browserVersion: "",
568
- os: normalize(parsed.os) || unavailableValue,
569
- hasDeviceType: Boolean(device)
570
- };
571
- }
572
- const deviceName = normalize(session?.deviceName);
573
- const deviceType = normalize(session?.deviceType);
574
- const browserName = normalize(session?.browserName);
575
- const osName = normalize(session?.osName);
576
- return {
577
- device: deviceName || deviceType || unavailableValue,
578
- browser: browserName || unavailableValue,
579
- browserVersion: "",
580
- os: osName || unavailableValue,
581
- hasDeviceType: Boolean(deviceType)
582
- };
583
- };
584
- const getStatusPresentation = (status, translate) => {
585
- const labels = {
586
- active: ["success", "homepage.status.active", "Active"],
587
- idle: ["warning", "homepage.status.idle", "Idle"],
588
- loggedout: ["neutral", "homepage.status.loggedOut", "Logged Out"],
589
- terminated: ["neutral", "homepage.status.terminated", "Terminated"]
590
- };
591
- const [variant, id, fallback] = labels[status] || labels.terminated;
592
- return { variant, label: translate(id, fallback) };
593
- };
594
- const StatsGrid = styled__default.default.div`
595
- display: grid;
596
- grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
597
- gap: ${theme.spacing.md};
598
- width: 100%;
599
- min-width: 0;
600
- margin-bottom: ${theme.spacing.lg};
601
- `;
602
- const StatCard = styled__default.default.div`
603
- background: ${(p) => p.theme.colors.neutral0};
604
- border: 1px solid ${(p) => p.theme.colors.neutral150};
605
- border-top: 3px solid ${(p) => p.theme.colors.primary600};
606
- border-radius: 4px;
607
- min-width: 0;
608
- padding: ${theme.spacing.md};
609
- display: flex;
610
- flex-direction: column;
611
- align-items: flex-start;
612
- gap: 4px;
613
- min-height: 112px;
614
- `;
615
- const StatIcon = styled__default.default.div`
616
- width: 36px;
617
- height: 36px;
618
- border-radius: 4px;
619
- display: flex;
620
- align-items: center;
621
- justify-content: center;
622
- background: ${(p) => p.theme.colors.primary100};
623
- color: ${(p) => p.theme.colors.primary600};
624
- margin-bottom: ${theme.spacing.sm};
625
-
626
- svg {
627
- width: 20px;
628
- height: 20px;
629
- }
630
- `;
631
- const DataTable = styled__default.default.div`
632
- background: ${(p) => p.theme.colors.neutral0};
633
- border-radius: 4px;
634
- overflow: auto;
635
- border: 1px solid ${(p) => p.theme.colors.neutral150};
636
- min-width: 0;
637
- max-width: 100%;
638
- margin-bottom: ${theme.spacing.xl};
639
- `;
640
- const FilterBar = styled__default.default.div`
641
- display: grid;
642
- grid-template-columns: repeat(3, minmax(0, 1fr));
643
- align-items: start;
644
- background: ${(p) => p.theme.colors.neutral0};
645
- padding: ${theme.spacing.md} ${theme.spacing.lg};
646
- border-radius: 4px;
647
- margin-bottom: ${theme.spacing.lg};
648
- border: 1px solid ${(p) => p.theme.colors.neutral150};
649
- gap: ${theme.spacing.md};
650
- min-width: 0;
651
-
652
- @media screen and (max-width: ${breakpoints.mobile}) {
653
- grid-template-columns: minmax(0, 1fr);
654
- padding: ${theme.spacing.md};
655
- }
656
- `;
657
- const ActionButtons = styled__default.default.div`
658
- display: flex;
659
- gap: ${theme.spacing.xs};
660
- justify-content: flex-end;
661
- `;
662
- const DesktopSessionTable = styled__default.default.div`
663
- display: block;
664
- min-width: 0;
665
-
666
- @media screen and (max-width: ${breakpoints.mobile}) {
667
- display: none;
668
- }
669
- `;
670
- const MobileSessionCards = styled__default.default.div`
671
- display: none;
672
- min-width: 0;
673
-
674
- @media screen and (max-width: ${breakpoints.mobile}) {
675
- display: flex;
676
- flex-direction: column;
677
- gap: ${theme.spacing.md};
678
- margin-bottom: ${theme.spacing.lg};
679
- }
680
- `;
681
- const MobileSessionCard = styled__default.default.div`
682
- background: ${(p) => p.theme.colors.neutral0};
683
- min-width: 0;
684
- border: 1px solid ${(p) => p.theme.colors.neutral150};
685
- border-radius: 4px;
686
- overflow-wrap: anywhere;
687
- padding: ${theme.spacing.md};
688
- `;
689
- const HomePage = () => {
690
- const { formatMessage } = reactIntl.useIntl();
691
- const { get, post, del } = admin.useFetchClient();
692
- const { toggleNotification } = admin.useNotification();
693
- const t = (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
694
- const unavailableValue = t("homepage.user.unknown", "Unavailable");
695
- const [sessions, setSessions] = react.useState([]);
696
- const [loading, setLoading] = react.useState(true);
697
- const [loadError, setLoadError] = react.useState(null);
698
- const [filterStatus, setFilterStatus] = react.useState(index.DEFAULT_SESSION_FILTER);
699
- const [entriesPerPage, setEntriesPerPage] = react.useState("25");
700
- const [currentPage, setCurrentPage] = react.useState(1);
701
- const [searchQuery, setSearchQuery] = react.useState("");
702
- const [selectedSession, setSelectedSession] = react.useState(null);
703
- const [showDetailModal, setShowDetailModal] = react.useState(false);
704
- const [terminatingSessionId, setTerminatingSessionId] = react.useState(null);
705
- const [deletingSessionId, setDeletingSessionId] = react.useState(null);
706
- react.useEffect(() => {
707
- fetchSessions();
708
- const interval = setInterval(() => {
709
- if (!showDetailModal) {
710
- fetchSessions();
711
- }
712
- }, 10 * 60 * 1e3);
713
- return () => clearInterval(interval);
714
- }, [showDetailModal]);
715
- const fetchSessions = async () => {
716
- setLoading(true);
717
- setLoadError(null);
718
- try {
719
- const { data } = await get(`/${index.pluginId}/sessions`);
720
- setSessions(data.data || []);
721
- } catch (err) {
722
- setLoadError(t("homepage.error.load", "Session data could not be loaded. Try again."));
723
- index.logSafeAdminError("dashboard.loadSessions", err);
724
- } finally {
725
- setLoading(false);
726
- }
727
- };
728
- const handleTerminateSession = async (sessionId) => {
729
- if (terminatingSessionId || deletingSessionId) return;
730
- if (!confirm(t("homepage.confirm.terminate", "Are you sure you want to terminate this session?\n\nThis will set isActive to false (user will be logged out)."))) {
731
- return;
732
- }
733
- setTerminatingSessionId(sessionId);
734
- try {
735
- await post(`/${index.pluginId}/sessions/${sessionId}/terminate`);
736
- await fetchSessions();
737
- toggleNotification({
738
- type: "success",
739
- message: t("notifications.success.terminated", "Session terminated successfully")
740
- });
741
- } catch (err) {
742
- index.logSafeAdminError("dashboard.terminateSession", err);
743
- toggleNotification({
744
- type: "danger",
745
- message: t("notifications.error.terminate", "Failed to terminate session")
746
- });
747
- } finally {
748
- setTerminatingSessionId(null);
749
- }
750
- };
751
- const handleDeleteSession = async (sessionId) => {
752
- if (terminatingSessionId || deletingSessionId) return;
753
- if (!confirm(t(
754
- "homepage.confirm.delete",
755
- "Remove this session's details? Any unexpired access token remains blocked until it expires."
756
- ))) {
757
- return;
758
- }
759
- setDeletingSessionId(sessionId);
760
- try {
761
- await del(`/${index.pluginId}/sessions/${sessionId}`);
762
- await fetchSessions();
763
- toggleNotification({
764
- type: "success",
765
- message: t("notifications.success.deleted", "Session details removed. Token revocation remains until expiry.")
766
- });
767
- } catch (err) {
768
- index.logSafeAdminError("dashboard.deleteSession", err);
769
- toggleNotification({
770
- type: "danger",
771
- message: t("notifications.error.delete", "Failed to delete session")
772
- });
773
- } finally {
774
- setDeletingSessionId(null);
775
- }
776
- };
777
- const handleExportCSV = () => {
778
- try {
779
- const csvContent = buildSessionCsv(filteredSessions, {
780
- unavailableValue,
781
- getDeviceInfo: getSessionDeviceInfo,
782
- getSessionStatus: index.getSessionStatus
783
- });
784
- const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8;" });
785
- const link = document.createElement("a");
786
- link.href = URL.createObjectURL(blob);
787
- link.download = `sessions-export-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.csv`;
788
- link.click();
789
- toggleNotification({
790
- type: "success",
791
- message: t("notifications.success.exported", "Exported {count} sessions to {format}", { count: filteredSessions.length, format: "CSV" })
792
- });
793
- } catch (err) {
794
- index.logSafeAdminError("dashboard.exportCsv", err);
795
- toggleNotification({
796
- type: "danger",
797
- message: t("notifications.error.export", "Failed to export sessions")
798
- });
799
- }
800
- };
801
- const handleExportJSON = () => {
802
- try {
803
- const jsonContent = buildSessionJson(filteredSessions, {
804
- filterStatus,
805
- totalSessions: sessions.length,
806
- exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
807
- unavailableValue,
808
- getDeviceInfo: getSessionDeviceInfo,
809
- getSessionStatus: index.getSessionStatus
810
- });
811
- const blob = new Blob([jsonContent], { type: "application/json" });
812
- const link = document.createElement("a");
813
- link.href = URL.createObjectURL(blob);
814
- link.download = `sessions-export-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.json`;
815
- link.click();
816
- toggleNotification({
817
- type: "success",
818
- message: t("notifications.success.exported", "Exported {count} sessions to {format}", { count: filteredSessions.length, format: "JSON" })
819
- });
820
- } catch (err) {
821
- index.logSafeAdminError("dashboard.exportJson", err);
822
- toggleNotification({
823
- type: "danger",
824
- message: t("notifications.error.export", "Failed to export sessions")
825
- });
826
- }
827
- };
828
- const getDeviceIcon = (deviceType) => {
829
- if (deviceType === "Mobile" || deviceType === "Tablet") return icons.Phone;
830
- if (deviceType === "Desktop" || deviceType === "Laptop") return icons.Monitor;
831
- return icons.Server;
832
- };
833
- const activeSessions = sessions.filter((s) => s.isActive && s.isTrulyActive);
834
- const idleSessions = sessions.filter((s) => index.getSessionStatus(s) === "idle");
835
- const loggedOutSessions = sessions.filter((s) => index.getSessionStatus(s) === "loggedout");
836
- const terminatedSessions = sessions.filter((s) => index.getSessionStatus(s) === "terminated");
837
- const handleSessionClick = (session) => {
838
- setSelectedSession(session);
839
- setShowDetailModal(true);
840
- };
841
- const handleModalClose = () => {
842
- setShowDetailModal(false);
843
- setSelectedSession(null);
844
- };
845
- const handleSessionTerminated = () => {
846
- fetchSessions();
847
- };
848
- const filteredSessions = index.filterSessionsByStatus(sessions, filterStatus).filter((session) => {
849
- if (searchQuery) {
850
- const query = searchQuery.toLowerCase();
851
- const matchesUser = session.user?.email?.toLowerCase().includes(query) || session.user?.username?.toLowerCase().includes(query);
852
- const matchesIp = session.ipAddress?.toLowerCase().includes(query);
853
- const deviceInfo = getSessionDeviceInfo(session, unavailableValue);
854
- const matchesDevice = deviceInfo.device?.toLowerCase().includes(query) || deviceInfo.browser?.toLowerCase().includes(query) || deviceInfo.os?.toLowerCase().includes(query);
855
- return matchesUser || matchesIp || matchesDevice;
856
- }
857
- return true;
858
- });
859
- const pageResult = paginateSessions(filteredSessions, currentPage, entriesPerPage);
860
- const exportActions = filteredSessions.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", children: [
861
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleExportCSV, startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Download, {}), variant: "secondary", children: t("homepage.export.csv", "Export CSV") }),
862
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { onClick: handleExportJSON, startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Download, {}), variant: "secondary", children: t("homepage.export.json", "Export JSON") })
863
- ] }) : null;
864
- return /* @__PURE__ */ jsxRuntime.jsx(
865
- PluginPageLayout.PluginPageLayout,
866
- {
867
- headingId: "magic-sessionmanager-dashboard-title",
868
- title: t("homepage.title", "Session Manager"),
869
- subtitle: t("homepage.subtitle", "Monitor and manage end-user sessions"),
870
- primaryAction: exportActions,
871
- children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { style: { width: "100%", minWidth: 0 }, children: [
872
- !loading && loadError ? /* @__PURE__ */ jsxRuntime.jsx(
873
- designSystem.Alert,
874
- {
875
- variant: "danger",
876
- title: t("homepage.error.title", "Unable to load sessions"),
877
- closeLabel: t("common.close", "Close"),
878
- action: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { size: "S", variant: "secondary", onClick: fetchSessions, children: t("common.retry", "Retry") }),
879
- children: /* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { variant: "pi", textColor: "neutral700", tag: "span", children: loadError })
880
- }
881
- ) : null,
882
- /* @__PURE__ */ jsxRuntime.jsxs(StatsGrid, { children: [
883
- /* @__PURE__ */ jsxRuntime.jsxs(StatCard, { children: [
884
- /* @__PURE__ */ jsxRuntime.jsx(StatIcon, { "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(icons.Check, {}) }),
885
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "semiBold", tag: "p", style: { margin: 0 }, children: activeSessions.length }),
886
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", tag: "p", style: { margin: 0 }, children: t("homepage.stats.active", "Active") })
887
- ] }),
888
- /* @__PURE__ */ jsxRuntime.jsxs(StatCard, { children: [
889
- /* @__PURE__ */ jsxRuntime.jsx(StatIcon, { "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(icons.Clock, {}) }),
890
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "semiBold", tag: "p", style: { margin: 0 }, children: idleSessions.length }),
891
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", tag: "p", style: { margin: 0 }, children: t("homepage.stats.idle", "Idle") })
892
- ] }),
893
- /* @__PURE__ */ jsxRuntime.jsxs(StatCard, { children: [
894
- /* @__PURE__ */ jsxRuntime.jsx(StatIcon, { "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {}) }),
895
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "semiBold", tag: "p", style: { margin: 0 }, children: loggedOutSessions.length }),
896
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", tag: "p", style: { margin: 0 }, children: t("homepage.stats.loggedOut", "Logged Out") })
897
- ] }),
898
- /* @__PURE__ */ jsxRuntime.jsxs(StatCard, { children: [
899
- /* @__PURE__ */ jsxRuntime.jsx(StatIcon, { "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {}) }),
900
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "semiBold", tag: "p", style: { margin: 0 }, children: terminatedSessions.length }),
901
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", tag: "p", style: { margin: 0 }, children: t("homepage.stats.terminated", "Terminated") })
902
- ] }),
903
- /* @__PURE__ */ jsxRuntime.jsxs(StatCard, { children: [
904
- /* @__PURE__ */ jsxRuntime.jsx(StatIcon, { "aria-hidden": "true", children: /* @__PURE__ */ jsxRuntime.jsx(icons.User, {}) }),
905
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", fontWeight: "semiBold", tag: "p", style: { margin: 0 }, children: sessions.length }),
906
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", tag: "p", style: { margin: 0 }, children: t("homepage.stats.total", "Total") })
907
- ] })
908
- ] }),
909
- loading && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", padding: 8, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { children: t("homepage.loading", "Loading sessions...") }) }),
910
- !loading && sessions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
911
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { marginBottom: theme.spacing.md }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "delta", textColor: "neutral700", style: { marginBottom: theme.spacing.md }, children: t("homepage.allSessions", "All Sessions") }) }),
912
- /* @__PURE__ */ jsxRuntime.jsxs(FilterBar, { children: [
913
- /* @__PURE__ */ jsxRuntime.jsx(
914
- FormField.FormField,
915
- {
916
- id: "session-search",
917
- name: "sessionSearch",
918
- label: t("homepage.search.label", "Search sessions"),
919
- description: t("homepage.search.hint", "Search end-user sessions by username, email, IP address, or device."),
920
- children: /* @__PURE__ */ jsxRuntime.jsx(
921
- designSystem.TextInput,
922
- {
923
- value: searchQuery,
924
- onChange: (e) => {
925
- setSearchQuery(e.target.value);
926
- setCurrentPage(1);
927
- },
928
- placeholder: t("homepage.search.placeholder", "Search by user, IP address, or device..."),
929
- startAction: /* @__PURE__ */ jsxRuntime.jsx(icons.Search, {})
930
- }
931
- )
932
- }
933
- ),
934
- /* @__PURE__ */ jsxRuntime.jsx(
935
- FormField.FormField,
936
- {
937
- id: "session-status-filter",
938
- name: "sessionStatus",
939
- label: t("homepage.filter.label", "Filter sessions by status"),
940
- description: t("homepage.filter.hint", "Limit the list to sessions with this status."),
941
- children: /* @__PURE__ */ jsxRuntime.jsxs(
942
- designSystem.SingleSelect,
943
- {
944
- value: filterStatus,
945
- onChange: (value) => {
946
- setFilterStatus(value);
947
- setCurrentPage(1);
948
- },
949
- size: "S",
950
- children: [
951
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "all", children: t("homepage.filter.all", "All Sessions") }),
952
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "active", children: t("homepage.filter.active", "Currently active") }),
953
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "idle", children: t("homepage.filter.idle", "Inactive") }),
954
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "loggedout", children: t("homepage.filter.loggedout", "Logged Out") }),
955
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "terminated", children: t("homepage.filter.terminated", "Terminated") })
956
- ]
957
- }
958
- )
959
- }
960
- ),
961
- /* @__PURE__ */ jsxRuntime.jsx(
962
- FormField.FormField,
963
- {
964
- id: "sessions-per-page",
965
- name: "sessionsPerPage",
966
- label: t("homepage.entries.label", "Sessions per page"),
967
- description: t("homepage.entries.hint", "Choose how many sessions appear on each page."),
968
- children: /* @__PURE__ */ jsxRuntime.jsxs(
969
- designSystem.SingleSelect,
970
- {
971
- value: entriesPerPage,
972
- onChange: (value) => {
973
- setEntriesPerPage(value);
974
- setCurrentPage(1);
975
- },
976
- size: "S",
977
- children: [
978
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "10", children: t("homepage.entries.10", "10 entries") }),
979
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "25", children: t("homepage.entries.25", "25 entries") }),
980
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "50", children: t("homepage.entries.50", "50 entries") }),
981
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "100", children: t("homepage.entries.100", "100 entries") })
982
- ]
983
- }
984
- )
985
- }
986
- )
987
- ] }),
988
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { marginBottom: theme.spacing.md }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: searchQuery ? t(
989
- "homepage.pagination.filteredRange",
990
- 'Showing {start}-{end} of {count} matching sessions (filtered by "{query}")',
991
- { start: pageResult.startIndex, end: pageResult.endIndex, count: pageResult.total, query: searchQuery }
992
- ) : t(
993
- "homepage.pagination.range",
994
- "Showing {start}-{end} of {count} sessions",
995
- { start: pageResult.startIndex, end: pageResult.endIndex, count: pageResult.total }
996
- ) }) }),
997
- filteredSessions.length > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
998
- /* @__PURE__ */ jsxRuntime.jsx(DesktopSessionTable, { children: /* @__PURE__ */ jsxRuntime.jsx(DataTable, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { style: { minWidth: 1024 }, children: [
999
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
1000
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: t("homepage.table.status", "Status") }),
1001
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: t("homepage.table.user", "User") }),
1002
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: t("homepage.table.device", "Device") }),
1003
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: t("homepage.table.ipAddress", "IP Address") }),
1004
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: t("homepage.table.loginTime", "Login Time") }),
1005
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: t("homepage.table.lastActive", "Last Active") }),
1006
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: t("homepage.table.actions", "Actions") })
1007
- ] }) }),
1008
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: pageResult.items.map((session) => {
1009
- const deviceInfo = getSessionDeviceInfo(session, unavailableValue);
1010
- const DeviceIcon = getDeviceIcon(deviceInfo.device);
1011
- const sessionStatus = index.getSessionStatus(session);
1012
- const config = getStatusPresentation(sessionStatus, t);
1013
- return /* @__PURE__ */ jsxRuntime.jsxs(
1014
- designSystem.Tr,
1015
- {
1016
- tabIndex: 0,
1017
- style: { cursor: "pointer" },
1018
- "aria-label": `${config.label}: ${session.user?.email || session.user?.username || t("homepage.user.unknown", "Unknown")}`,
1019
- onClick: () => handleSessionClick(session),
1020
- onKeyDown: (event) => {
1021
- if (event.target !== event.currentTarget) return;
1022
- if (event.key === "Enter" || event.key === " ") {
1023
- event.preventDefault();
1024
- handleSessionClick(session);
1025
- }
1026
- },
1027
- children: [
1028
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { variant: config.variant, size: "S", children: config.label }) }),
1029
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", children: [
1030
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "semiBold", ellipsis: true, children: session.user?.username || session.user?.email || t("homepage.user.unknown", "Unknown") }),
1031
- session.user?.email && session.user?.username && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", ellipsis: true, children: session.user.email })
1032
- ] }) }),
1033
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, children: [
1034
- deviceInfo.hasDeviceType && /* @__PURE__ */ jsxRuntime.jsx(DeviceIcon, { width: "18px", height: "18px" }),
1035
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", children: [
1036
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", children: deviceInfo.device }),
1037
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: [
1038
- deviceInfo.browser,
1039
- " on ",
1040
- deviceInfo.os
1041
- ] })
1042
- ] })
1043
- ] }) }),
1044
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", style: { fontFamily: "monospace" }, children: session.ipAddress || unavailableValue }) }),
1045
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral700", children: new Date(session.loginTime).toLocaleString() }) }),
1046
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", children: [
1047
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral700", children: new Date(session.lastActive || session.loginTime).toLocaleString() }),
1048
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: sessionStatus === "active" ? "success600" : "neutral500", children: t("homepage.time.minAgo", "{minutes} min ago", { minutes: session.minutesSinceActive }) })
1049
- ] }) }),
1050
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxRuntime.jsxs(ActionButtons, { className: "action-buttons", children: [
1051
- /* @__PURE__ */ jsxRuntime.jsx(
1052
- designSystem.Button,
1053
- {
1054
- size: "S",
1055
- variant: "tertiary",
1056
- "aria-label": `${t("homepage.actions.viewDetails", "View Details")}: ${session.user?.email || session.user?.username || ""}`,
1057
- onClick: (e) => {
1058
- e.stopPropagation();
1059
- handleSessionClick(session);
1060
- },
1061
- title: t("homepage.actions.viewDetails", "View Details"),
1062
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Eye, {})
1063
- }
1064
- ),
1065
- /* @__PURE__ */ jsxRuntime.jsx(
1066
- designSystem.Button,
1067
- {
1068
- size: "S",
1069
- variant: "danger-light",
1070
- "aria-label": `${t("homepage.actions.terminate", "Terminate (Logout)")}: ${session.user?.email || session.user?.username || ""}`,
1071
- onClick: (e) => {
1072
- e.stopPropagation();
1073
- handleTerminateSession(session.id);
1074
- },
1075
- loading: terminatingSessionId === session.id,
1076
- disabled: !session.isActive || Boolean(terminatingSessionId) || Boolean(deletingSessionId),
1077
- title: session.isActive ? t("homepage.actions.terminate", "Terminate (Logout)") : t("homepage.actions.alreadyInactive", "Already inactive"),
1078
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {})
1079
- }
1080
- ),
1081
- /* @__PURE__ */ jsxRuntime.jsx(
1082
- designSystem.Button,
1083
- {
1084
- size: "S",
1085
- variant: "danger-light",
1086
- "aria-label": t("homepage.actions.deletePermanently", "Remove session details"),
1087
- onClick: (e) => {
1088
- e.stopPropagation();
1089
- handleDeleteSession(session.id);
1090
- },
1091
- loading: deletingSessionId === session.id,
1092
- disabled: Boolean(terminatingSessionId) || Boolean(deletingSessionId),
1093
- title: t("homepage.actions.deletePermanently", "Remove Session Details"),
1094
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {})
1095
- }
1096
- )
1097
- ] }) })
1098
- ]
1099
- },
1100
- session.id
1101
- );
1102
- }) })
1103
- ] }) }) }),
1104
- /* @__PURE__ */ jsxRuntime.jsx(MobileSessionCards, { "aria-label": t("homepage.mobileList.label", "Session results"), children: pageResult.items.map((session) => {
1105
- const deviceInfo = getSessionDeviceInfo(session, unavailableValue);
1106
- const DeviceIcon = getDeviceIcon(deviceInfo.device);
1107
- const presentation = getStatusPresentation(index.getSessionStatus(session), t);
1108
- const userLabel = session.user?.username || session.user?.email || t("homepage.user.unknown", "Unknown");
1109
- return /* @__PURE__ */ jsxRuntime.jsxs(MobileSessionCard, { children: [
1110
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", gap: 2, wrap: "wrap", children: [
1111
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { variant: presentation.variant, size: "S", children: presentation.label }),
1112
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: new Date(session.lastActive || session.loginTime).toLocaleString() })
1113
- ] }),
1114
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { marginTop: 3, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
1115
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "epsilon", fontWeight: "semiBold", children: userLabel }),
1116
- session.user?.email && session.user?.username ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: session.user.email }) : null
1117
- ] }) }),
1118
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 1, marginTop: 3, children: [
1119
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", children: [
1120
- deviceInfo.hasDeviceType ? /* @__PURE__ */ jsxRuntime.jsx(DeviceIcon, { "aria-hidden": "true" }) : null,
1121
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral700", children: [
1122
- deviceInfo.device,
1123
- " · ",
1124
- deviceInfo.browser,
1125
- " on ",
1126
- deviceInfo.os
1127
- ] })
1128
- ] }),
1129
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: [
1130
- t("homepage.table.ipAddress", "IP Address"),
1131
- ": ",
1132
- session.ipAddress || unavailableValue
1133
- ] }),
1134
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: [
1135
- t("homepage.table.loginTime", "Login Time"),
1136
- ": ",
1137
- new Date(session.loginTime).toLocaleString()
1138
- ] }),
1139
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t("homepage.time.minAgo", "{minutes} min ago", {
1140
- minutes: Number.isFinite(session.minutesSinceActive) ? session.minutesSinceActive : unavailableValue
1141
- }) })
1142
- ] }),
1143
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", marginTop: 4, children: [
1144
- /* @__PURE__ */ jsxRuntime.jsx(
1145
- designSystem.Button,
1146
- {
1147
- size: "S",
1148
- variant: "tertiary",
1149
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Eye, {}),
1150
- onClick: () => handleSessionClick(session),
1151
- "aria-label": `${t("homepage.actions.viewDetails", "View Details")}: ${userLabel}`,
1152
- children: t("homepage.actions.viewDetails", "View Details")
1153
- }
1154
- ),
1155
- /* @__PURE__ */ jsxRuntime.jsx(
1156
- designSystem.Button,
1157
- {
1158
- size: "S",
1159
- variant: "danger-light",
1160
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {}),
1161
- onClick: () => handleTerminateSession(session.id),
1162
- loading: terminatingSessionId === session.id,
1163
- disabled: !session.isActive || Boolean(terminatingSessionId) || Boolean(deletingSessionId),
1164
- children: t("homepage.actions.terminate", "Terminate")
1165
- }
1166
- ),
1167
- /* @__PURE__ */ jsxRuntime.jsx(
1168
- designSystem.Button,
1169
- {
1170
- size: "S",
1171
- variant: "tertiary",
1172
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {}),
1173
- onClick: () => handleDeleteSession(session.id),
1174
- loading: deletingSessionId === session.id,
1175
- disabled: Boolean(terminatingSessionId) || Boolean(deletingSessionId),
1176
- children: t("homepage.actions.deletePermanently", "Remove Session Details")
1177
- }
1178
- )
1179
- ] })
1180
- ] }, session.id);
1181
- }) }),
1182
- pageResult.pageCount > 1 && /* @__PURE__ */ jsxRuntime.jsx("nav", { "aria-label": t("homepage.pagination.label", "Session pages"), children: /* @__PURE__ */ jsxRuntime.jsxs(
1183
- designSystem.Flex,
1184
- {
1185
- justifyContent: "space-between",
1186
- alignItems: "center",
1187
- gap: 3,
1188
- wrap: "wrap",
1189
- style: { marginTop: theme.spacing.md },
1190
- children: [
1191
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", "aria-live": "polite", children: t("homepage.pagination.page", "Page {page} of {pages}", {
1192
- page: pageResult.page,
1193
- pages: pageResult.pageCount
1194
- }) }),
1195
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
1196
- /* @__PURE__ */ jsxRuntime.jsx(
1197
- designSystem.Button,
1198
- {
1199
- variant: "tertiary",
1200
- size: "S",
1201
- disabled: pageResult.page <= 1,
1202
- onClick: () => setCurrentPage(pageResult.page - 1),
1203
- children: t("homepage.pagination.previous", "Previous")
1204
- }
1205
- ),
1206
- /* @__PURE__ */ jsxRuntime.jsx(
1207
- designSystem.Button,
1208
- {
1209
- variant: "tertiary",
1210
- size: "S",
1211
- disabled: pageResult.page >= pageResult.pageCount,
1212
- onClick: () => setCurrentPage(pageResult.page + 1),
1213
- children: t("homepage.pagination.next", "Next")
1214
- }
1215
- )
1216
- ] })
1217
- ]
1218
- }
1219
- ) })
1220
- ] }) : /* @__PURE__ */ jsxRuntime.jsx(
1221
- designSystem.EmptyStateLayout,
1222
- {
1223
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Search, { "aria-hidden": "true" }),
1224
- content: /* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { variant: "pi", textColor: "neutral700", tag: "span", children: t("homepage.noResults.description", "Try adjusting your search or status filter.") }),
1225
- action: /* @__PURE__ */ jsxRuntime.jsx(
1226
- designSystem.Button,
1227
- {
1228
- variant: "secondary",
1229
- onClick: () => {
1230
- setSearchQuery("");
1231
- setFilterStatus(index.DEFAULT_SESSION_FILTER);
1232
- setCurrentPage(1);
1233
- },
1234
- children: t("homepage.noResults.reset", "Clear filters")
1235
- }
1236
- )
1237
- }
1238
- )
1239
- ] }),
1240
- !loading && sessions.length === 0 && !loadError && /* @__PURE__ */ jsxRuntime.jsx(
1241
- designSystem.EmptyStateLayout,
1242
- {
1243
- icon: /* @__PURE__ */ jsxRuntime.jsx(icons.Monitor, { "aria-hidden": "true" }),
1244
- content: /* @__PURE__ */ jsxRuntime.jsx(index.ReadableText, { variant: "pi", textColor: "neutral700", tag: "span", children: t("homepage.empty.description", "Sessions will appear here when end users log in.") })
1245
- }
1246
- ),
1247
- showDetailModal && selectedSession && /* @__PURE__ */ jsxRuntime.jsx(
1248
- SessionDetailModal,
1249
- {
1250
- session: selectedSession,
1251
- onClose: handleModalClose,
1252
- onSessionTerminated: handleSessionTerminated
1253
- }
1254
- )
1255
- ] })
1256
- }
1257
- );
1258
- };
1259
- const LicenseGuard = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
1260
- const App = () => {
1261
- return /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Protect, { permissions: index.pluginPermissions.access, children: /* @__PURE__ */ jsxRuntime.jsx(LicenseGuard, { children: /* @__PURE__ */ jsxRuntime.jsx(HomePage, {}) }) });
1262
- };
1263
- exports.default = App;