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,1481 +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-Duc7cR_d.js");
9
- const designSystem = require("@strapi/design-system");
10
- const icons = require("@strapi/icons");
11
- const sessionStatus = require("./sessionStatus-D_fWEzgj.js");
12
- const StyledButtons = require("./StyledButtons-DDuxnYz8.js");
13
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
14
- const styled__default = /* @__PURE__ */ _interopDefault(styled);
15
- const theme = {
16
- shadows: {
17
- sm: "0 1px 3px 0 rgba(0, 0, 0, 0.1), 0 1px 2px -1px rgba(0, 0, 0, 0.1)",
18
- xl: "0 20px 25px -5px rgba(0, 0, 0, 0.1), 0 8px 10px -6px rgba(0, 0, 0, 0.1)"
19
- },
20
- transitions: {
21
- fast: "150ms cubic-bezier(0.4, 0, 0.2, 1)",
22
- normal: "300ms cubic-bezier(0.4, 0, 0.2, 1)",
23
- slow: "500ms cubic-bezier(0.4, 0, 0.2, 1)"
24
- },
25
- spacing: {
26
- xs: "4px",
27
- sm: "8px",
28
- md: "16px",
29
- lg: "24px",
30
- xl: "32px",
31
- "2xl": "48px"
32
- },
33
- borderRadius: {
34
- md: "8px",
35
- lg: "12px",
36
- xl: "16px"
37
- }
38
- };
39
- const TwoColumnGrid = styled__default.default.div`
40
- display: grid;
41
- grid-template-columns: 1fr 1fr;
42
- gap: 24px;
43
-
44
- @media (max-width: 768px) {
45
- grid-template-columns: 1fr;
46
- }
47
- `;
48
- const SectionTitle = styled__default.default(designSystem.Typography)`
49
- text-transform: uppercase;
50
- letter-spacing: 0.5px;
51
- font-size: 11px;
52
- font-weight: 700;
53
- color: var(--colors-neutral800);
54
- margin-bottom: 16px;
55
- padding-bottom: 8px;
56
- border-bottom: 2px solid rgba(128, 128, 128, 0.2);
57
- display: block;
58
- `;
59
- const Section = styled__default.default(designSystem.Box)`
60
- margin-bottom: 24px;
61
- `;
62
- const ModalStatusBadge = styled__default.default.span`
63
- display: inline-flex;
64
- align-items: center;
65
- gap: 8px;
66
- padding: 10px 24px;
67
- border-radius: 24px;
68
- font-size: 14px;
69
- font-weight: 700;
70
- letter-spacing: 0.5px;
71
- text-transform: uppercase;
72
-
73
- ${(props) => props.$online && `
74
- background: linear-gradient(135deg, rgba(22, 163, 74, 0.12) 0%, rgba(34, 197, 94, 0.3) 100%);
75
- color: var(--colors-success600, #166534);
76
- border: 2px solid rgba(34, 197, 94, 0.3);
77
- box-shadow: 0 4px 12px rgba(34, 197, 94, 0.2);
78
- `}
79
-
80
- ${(props) => !props.$online && `
81
- background: linear-gradient(135deg, rgba(128, 128, 128, 0.08) 0%, rgba(128, 128, 128, 0.2) 100%);
82
- color: var(--colors-neutral600);
83
- border: 2px solid rgba(128, 128, 128, 0.2);
84
- box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
85
- `}
86
- `;
87
- const StatusDot$1 = styled__default.default.span`
88
- width: 10px;
89
- height: 10px;
90
- border-radius: 50%;
91
-
92
- ${(props) => props.$online && `
93
- background: var(--colors-success600, #22C55E);
94
- box-shadow: 0 0 8px rgba(34, 197, 94, 0.6);
95
- animation: pulse-green 2s ease-in-out infinite;
96
- `}
97
-
98
- ${(props) => !props.$online && `
99
- background: var(--colors-neutral500);
100
- `}
101
-
102
- @keyframes pulse-green {
103
- 0%, 100% { opacity: 1; transform: scale(1); }
104
- 50% { opacity: 0.7; transform: scale(1.15); }
105
- }
106
- `;
107
- const getStoredGeoData = (session) => {
108
- let geoLocation = session?.geoLocation;
109
- if (typeof geoLocation === "string") {
110
- try {
111
- geoLocation = JSON.parse(geoLocation);
112
- } catch {
113
- geoLocation = null;
114
- }
115
- }
116
- if (!geoLocation || typeof geoLocation !== "object") return null;
117
- if (!geoLocation.country && !geoLocation.country_code && !geoLocation.city) return null;
118
- return {
119
- country_flag: geoLocation.country_flag || "",
120
- country: geoLocation.country || geoLocation.country_code || "Unknown",
121
- city: geoLocation.city || "Unknown",
122
- timezone: geoLocation.timezone || "Unknown",
123
- securityScore: typeof session.securityScore === "number" ? session.securityScore : 100,
124
- riskLevel: typeof session.securityScore === "number" && session.securityScore < 50 ? "High" : "Low",
125
- isVpn: false,
126
- isProxy: false
127
- };
128
- };
129
- const SessionDetailModal = ({ session, onClose, onSessionTerminated }) => {
130
- const { formatMessage } = reactIntl.useIntl();
131
- const { get, post } = admin.useFetchClient();
132
- const { toggleNotification } = admin.useNotification();
133
- const [terminating, setTerminating] = react.useState(false);
134
- const [showUserAgent, setShowUserAgent] = react.useState(false);
135
- const [geoData, setGeoData] = react.useState(null);
136
- const [geoLoading, setGeoLoading] = react.useState(false);
137
- const t = (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
138
- react.useEffect(() => {
139
- let cancelled = false;
140
- const ipAddress = session?.ipAddress;
141
- const storedGeoData = getStoredGeoData(session);
142
- if (!ipAddress) {
143
- setGeoData(null);
144
- setGeoLoading(false);
145
- return () => {
146
- cancelled = true;
147
- };
148
- }
149
- if (storedGeoData) {
150
- setGeoData(storedGeoData);
151
- setGeoLoading(false);
152
- return () => {
153
- cancelled = true;
154
- };
155
- }
156
- const fetchGeolocationData = async () => {
157
- setGeoData(null);
158
- setGeoLoading(true);
159
- try {
160
- const { data } = await get(`/${index.pluginId}/geolocation/${encodeURIComponent(ipAddress)}`);
161
- if (!cancelled) {
162
- setGeoData(data.data);
163
- }
164
- } catch (err) {
165
- console.error("[SessionDetailModal] Error fetching geolocation:", err);
166
- if (!cancelled) {
167
- setGeoData({
168
- country_flag: "",
169
- country: "Unknown",
170
- city: "Unknown",
171
- timezone: "Unknown",
172
- securityScore: 50,
173
- riskLevel: "Unknown",
174
- isVpn: false,
175
- isProxy: false
176
- });
177
- }
178
- } finally {
179
- if (!cancelled) {
180
- setGeoLoading(false);
181
- }
182
- }
183
- };
184
- fetchGeolocationData();
185
- return () => {
186
- cancelled = true;
187
- };
188
- }, [get, session]);
189
- if (!session) return null;
190
- const deviceInfo = index.parseUserAgent(session.userAgent);
191
- const isOnline = session.isTrulyActive;
192
- const securityData = geoData || {
193
- country_flag: "",
194
- country: "Loading...",
195
- city: "Loading...",
196
- timezone: "Loading...",
197
- securityScore: 0,
198
- riskLevel: "Unknown",
199
- isVpn: false,
200
- isProxy: false
201
- };
202
- const getDeviceIcon = (deviceType) => {
203
- if (deviceType === "Mobile" || deviceType === "Tablet") return icons.Phone;
204
- if (deviceType === "Desktop" || deviceType === "Laptop") return icons.Monitor;
205
- return icons.Server;
206
- };
207
- const DeviceIcon = getDeviceIcon(deviceInfo.device);
208
- const handleTerminate = async () => {
209
- if (!confirm(t("modal.confirm.terminate", "Are you sure you want to terminate this session?"))) {
210
- return;
211
- }
212
- setTerminating(true);
213
- try {
214
- await post(`/${index.pluginId}/sessions/${session.id}/terminate`);
215
- toggleNotification({
216
- type: "success",
217
- message: t("notifications.success.terminated", "Session terminated successfully")
218
- });
219
- onSessionTerminated();
220
- onClose();
221
- } catch (err) {
222
- console.error("[SessionDetailModal] Error:", err);
223
- toggleNotification({
224
- type: "danger",
225
- message: t("notifications.error.terminate", "Failed to terminate session")
226
- });
227
- } finally {
228
- setTerminating(false);
229
- }
230
- };
231
- const DetailRow = ({ label, value, icon: Icon, compact }) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 3, alignItems: "flex-start", style: { marginBottom: compact ? "12px" : "16px" }, children: [
232
- Icon && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: {
233
- width: "36px",
234
- height: "36px",
235
- display: "flex",
236
- alignItems: "center",
237
- justifyContent: "center",
238
- background: "var(--colors-neutral100)",
239
- borderRadius: "8px",
240
- flexShrink: 0
241
- }, children: /* @__PURE__ */ jsxRuntime.jsx(Icon, { width: "18px", height: "18px" }) }),
242
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", style: { flex: 1, minWidth: 0 }, children: [
243
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", style: { fontSize: "11px", fontWeight: "600", marginBottom: "4px" }, children: label }),
244
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", style: { fontSize: "14px", fontWeight: "500" }, children: value })
245
- ] })
246
- ] });
247
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Root, { open: true, onOpenChange: onClose, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Modal.Content, { style: { maxWidth: "900px" }, children: [
248
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Header, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 3, alignItems: "center", children: [
249
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: {
250
- width: "48px",
251
- height: "48px",
252
- borderRadius: "12px",
253
- background: isOnline ? "rgba(22, 163, 74, 0.12)" : "var(--colors-neutral100)",
254
- display: "flex",
255
- alignItems: "center",
256
- justifyContent: "center"
257
- }, children: /* @__PURE__ */ jsxRuntime.jsx(DeviceIcon, { width: "24px", height: "24px" }) }),
258
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", children: [
259
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", fontWeight: "bold", children: t("modal.title", "Session Details") }),
260
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: t("modal.id", "ID: {id}", { id: session.id }) })
261
- ] })
262
- ] }) }),
263
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Body, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { padding: 6, children: [
264
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", style: { marginBottom: "24px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(ModalStatusBadge, { $online: isOnline, children: [
265
- /* @__PURE__ */ jsxRuntime.jsx(StatusDot$1, { $online: isOnline }),
266
- isOnline ? t("modal.status.online", "ONLINE") : t("modal.status.offline", "OFFLINE")
267
- ] }) }),
268
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, { style: { marginBottom: "24px" } }),
269
- /* @__PURE__ */ jsxRuntime.jsxs(TwoColumnGrid, { children: [
270
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
271
- /* @__PURE__ */ jsxRuntime.jsxs(Section, { children: [
272
- /* @__PURE__ */ jsxRuntime.jsx(SectionTitle, { children: t("modal.section.user", "User") }),
273
- /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { compact: true, icon: icons.Check, label: t("modal.user.username", "Username"), value: session.user?.username || t("modal.user.na", "N/A") }),
274
- /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { compact: true, icon: icons.Information, label: t("modal.user.email", "Email"), value: session.user?.email || t("modal.user.na", "N/A") }),
275
- /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { compact: true, icon: icons.Information, label: t("modal.user.id", "User ID"), value: session.user?.documentId || session.user?.id || t("modal.user.na", "N/A") })
276
- ] }),
277
- /* @__PURE__ */ jsxRuntime.jsxs(Section, { children: [
278
- /* @__PURE__ */ jsxRuntime.jsx(SectionTitle, { children: t("modal.section.device", "Device") }),
279
- /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { compact: true, icon: DeviceIcon, label: t("modal.device.device", "Device"), value: deviceInfo.device }),
280
- /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { compact: true, icon: icons.Monitor, label: t("modal.device.browser", "Browser"), value: `${deviceInfo.browser} ${deviceInfo.browserVersion || ""}` }),
281
- /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { compact: true, icon: icons.Server, label: t("modal.device.os", "OS"), value: deviceInfo.os }),
282
- /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { compact: true, icon: icons.Information, label: t("modal.device.ip", "IP"), value: session.ipAddress })
283
- ] })
284
- ] }),
285
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsxs(Section, { children: [
286
- /* @__PURE__ */ jsxRuntime.jsx(SectionTitle, { children: t("modal.section.timeline", "Timeline") }),
287
- /* @__PURE__ */ jsxRuntime.jsx(
288
- DetailRow,
289
- {
290
- compact: true,
291
- icon: icons.Clock,
292
- label: t("modal.timeline.login", "Login"),
293
- value: new Date(session.loginTime).toLocaleString("de-DE", {
294
- day: "2-digit",
295
- month: "short",
296
- hour: "2-digit",
297
- minute: "2-digit"
298
- })
299
- }
300
- ),
301
- /* @__PURE__ */ jsxRuntime.jsx(
302
- DetailRow,
303
- {
304
- compact: true,
305
- icon: icons.Clock,
306
- label: t("modal.timeline.lastActive", "Last Active"),
307
- value: new Date(session.lastActive || session.loginTime).toLocaleString("de-DE", {
308
- day: "2-digit",
309
- month: "short",
310
- hour: "2-digit",
311
- minute: "2-digit"
312
- })
313
- }
314
- ),
315
- /* @__PURE__ */ jsxRuntime.jsx(
316
- DetailRow,
317
- {
318
- compact: true,
319
- icon: icons.Clock,
320
- label: t("modal.timeline.idleTime", "Idle Time"),
321
- value: t("modal.timeline.minutes", "{minutes} min", { minutes: session.minutesSinceActive })
322
- }
323
- ),
324
- session.logoutTime && /* @__PURE__ */ jsxRuntime.jsx(
325
- DetailRow,
326
- {
327
- compact: true,
328
- icon: icons.Cross,
329
- label: t("modal.timeline.logout", "Logout"),
330
- value: new Date(session.logoutTime).toLocaleString("de-DE", {
331
- day: "2-digit",
332
- month: "short",
333
- hour: "2-digit",
334
- minute: "2-digit"
335
- })
336
- }
337
- )
338
- ] }) })
339
- ] }),
340
- /* @__PURE__ */ jsxRuntime.jsxs(Section, { children: [
341
- /* @__PURE__ */ jsxRuntime.jsx(SectionTitle, { children: t("modal.section.security", "Location and Security") }),
342
- 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(TwoColumnGrid, { children: [
343
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
344
- /* @__PURE__ */ jsxRuntime.jsx(
345
- DetailRow,
346
- {
347
- compact: true,
348
- icon: icons.Earth,
349
- label: t("modal.security.country", "Country"),
350
- value: `${securityData.country_flag || ""} ${securityData.country}`.trim()
351
- }
352
- ),
353
- /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { compact: true, icon: icons.Earth, label: t("modal.security.city", "City"), value: securityData.city }),
354
- /* @__PURE__ */ jsxRuntime.jsx(DetailRow, { compact: true, icon: icons.Clock, label: t("modal.security.timezone", "Timezone"), value: securityData.timezone })
355
- ] }),
356
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
357
- /* @__PURE__ */ jsxRuntime.jsx(
358
- DetailRow,
359
- {
360
- compact: true,
361
- icon: icons.Shield,
362
- label: t("modal.security.score", "Security"),
363
- value: `${securityData.securityScore}/100 (${securityData.riskLevel})`
364
- }
365
- ),
366
- /* @__PURE__ */ jsxRuntime.jsx(
367
- DetailRow,
368
- {
369
- compact: true,
370
- icon: icons.Shield,
371
- label: t("modal.security.vpn", "VPN"),
372
- value: securityData.isVpn ? t("modal.security.vpnWarning", "[WARNING] Yes") : t("modal.security.no", "No")
373
- }
374
- ),
375
- /* @__PURE__ */ jsxRuntime.jsx(
376
- DetailRow,
377
- {
378
- compact: true,
379
- icon: icons.Shield,
380
- label: t("modal.security.proxy", "Proxy"),
381
- value: securityData.isProxy ? t("modal.security.vpnWarning", "[WARNING] Yes") : t("modal.security.no", "No")
382
- }
383
- )
384
- ] })
385
- ] })
386
- ] }),
387
- /* @__PURE__ */ jsxRuntime.jsxs(Section, { children: [
388
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", style: { marginBottom: "12px" }, children: [
389
- /* @__PURE__ */ jsxRuntime.jsx(SectionTitle, { style: { marginBottom: 0, paddingBottom: 0, border: "none" }, children: t("modal.section.technical", "Technical Details") }),
390
- /* @__PURE__ */ jsxRuntime.jsx(
391
- StyledButtons.ShowHideButton,
392
- {
393
- size: "S",
394
- onClick: () => setShowUserAgent(!showUserAgent),
395
- children: showUserAgent ? t("modal.technical.hide", "Hide Details") : t("modal.technical.show", "Show Details")
396
- }
397
- )
398
- ] }),
399
- showUserAgent && /* @__PURE__ */ jsxRuntime.jsx(
400
- designSystem.Box,
401
- {
402
- padding: 3,
403
- background: "neutral100",
404
- hasRadius: true,
405
- style: {
406
- fontFamily: "monospace",
407
- fontSize: "10px",
408
- wordBreak: "break-all",
409
- maxHeight: "80px",
410
- overflow: "auto",
411
- marginTop: "8px",
412
- animation: "fadeIn 0.3s ease-in-out"
413
- },
414
- children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", style: { lineHeight: "1.6" }, children: session.userAgent })
415
- }
416
- )
417
- ] })
418
- ] }) }),
419
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Modal.Footer, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", style: { width: "100%" }, children: [
420
- /* @__PURE__ */ jsxRuntime.jsx(StyledButtons.TertiaryButton, { onClick: onClose, children: t("modal.actions.close", "Close") }),
421
- /* @__PURE__ */ jsxRuntime.jsx(
422
- StyledButtons.DangerButton,
423
- {
424
- onClick: handleTerminate,
425
- disabled: !session.isActive || terminating,
426
- loading: terminating,
427
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {}),
428
- children: t("modal.actions.terminate", "Terminate Session")
429
- }
430
- )
431
- ] }) })
432
- ] }) });
433
- };
434
- const fadeIn = styled.keyframes`
435
- from { opacity: 0; transform: translateY(10px); }
436
- to { opacity: 1; transform: translateY(0); }
437
- `;
438
- const shimmer = styled.keyframes`
439
- 0% { background-position: -200% 0; }
440
- 100% { background-position: 200% 0; }
441
- `;
442
- const float = styled.keyframes`
443
- 0%, 100% { transform: translateY(0px); }
444
- 50% { transform: translateY(-5px); }
445
- `;
446
- const pulse = styled.keyframes`
447
- 0%, 100% { opacity: 1; }
448
- 50% { opacity: 0.5; }
449
- `;
450
- const FloatingEmoji = styled__default.default.div`
451
- position: absolute;
452
- bottom: 40px;
453
- right: 40px;
454
- font-size: 72px;
455
- opacity: 0.08;
456
- ${styled.css`animation: ${float} 4s ease-in-out infinite;`}
457
- `;
458
- const breakpoints = {
459
- mobile: "768px"
460
- };
461
- const Container = styled__default.default(designSystem.Box)`
462
- ${styled.css`animation: ${fadeIn} ${theme.transitions.slow};`}
463
- min-height: 100vh;
464
- max-width: 1440px;
465
- margin: 0 auto;
466
- padding: ${theme.spacing.xl} ${theme.spacing.lg} 0;
467
-
468
- @media screen and (max-width: ${breakpoints.mobile}) {
469
- padding: 16px 12px 0;
470
- }
471
- `;
472
- const Header = styled__default.default(designSystem.Box)`
473
- background: linear-gradient(135deg,
474
- ${"var(--colors-primary600, #0284C7)"} 0%,
475
- ${"#9333EA"} 100%
476
- );
477
- border-radius: ${theme.borderRadius.xl};
478
- padding: ${theme.spacing.xl} ${theme.spacing["2xl"]};
479
- margin-bottom: ${theme.spacing.xl};
480
- position: relative;
481
- overflow: hidden;
482
- box-shadow: ${theme.shadows.xl};
483
-
484
- @media screen and (max-width: ${breakpoints.mobile}) {
485
- padding: 24px 20px;
486
- border-radius: 12px;
487
- }
488
-
489
- &::before {
490
- content: '';
491
- position: absolute;
492
- top: 0;
493
- left: -100%;
494
- width: 200%;
495
- height: 100%;
496
- background: linear-gradient(
497
- 90deg,
498
- transparent,
499
- rgba(255, 255, 255, 0.15),
500
- transparent
501
- );
502
- ${styled.css`animation: ${shimmer} 3s infinite;`}
503
- }
504
-
505
- &::after {
506
- content: '';
507
- position: absolute;
508
- top: 0;
509
- right: 0;
510
- width: 100%;
511
- height: 100%;
512
- background-image: radial-gradient(circle at 20% 80%, transparent 50%, rgba(255, 255, 255, 0.1) 50%);
513
- background-size: 15px 15px;
514
- opacity: 0.3;
515
- }
516
- `;
517
- const HeaderContent = styled__default.default(designSystem.Flex)`
518
- position: relative;
519
- z-index: 1;
520
- `;
521
- const Title = styled__default.default(designSystem.Typography)`
522
- color: white;
523
- font-size: 2rem;
524
- font-weight: 700;
525
- letter-spacing: -0.025em;
526
- text-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
527
- display: flex;
528
- align-items: center;
529
- gap: ${theme.spacing.sm};
530
-
531
- svg {
532
- width: 28px;
533
- height: 28px;
534
- ${styled.css`animation: ${float} 3s ease-in-out infinite;`}
535
- }
536
-
537
- @media screen and (max-width: ${breakpoints.mobile}) {
538
- font-size: 1.5rem;
539
-
540
- svg {
541
- width: 22px;
542
- height: 22px;
543
- }
544
- }
545
- `;
546
- const Subtitle = styled__default.default(designSystem.Typography)`
547
- color: rgba(255, 255, 255, 0.95);
548
- font-size: 0.95rem;
549
- font-weight: 400;
550
- margin-top: ${theme.spacing.xs};
551
- letter-spacing: 0.01em;
552
-
553
- @media screen and (max-width: ${breakpoints.mobile}) {
554
- font-size: 0.85rem;
555
- }
556
- `;
557
- const StatsGrid = styled__default.default.div`
558
- margin-bottom: ${theme.spacing.xl};
559
- display: grid;
560
- grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
561
- gap: ${theme.spacing.lg};
562
- justify-content: center;
563
- max-width: 1200px;
564
- margin-left: auto;
565
- margin-right: auto;
566
-
567
- @media screen and (max-width: ${breakpoints.mobile}) {
568
- grid-template-columns: repeat(2, 1fr);
569
- gap: 12px;
570
- margin-bottom: 24px;
571
- }
572
- `;
573
- const StatCard = styled__default.default(designSystem.Box)`
574
- background: ${(p) => p.theme.colors.neutral0};
575
- border-radius: ${theme.borderRadius.lg};
576
- padding: 28px ${theme.spacing.lg};
577
- position: relative;
578
- overflow: hidden;
579
- transition: all ${theme.transitions.normal};
580
- ${styled.css`animation: ${fadeIn} ${theme.transitions.slow} backwards;`}
581
- animation-delay: ${(props) => props.$delay || "0s"};
582
- box-shadow: ${theme.shadows.sm};
583
- border: 1px solid rgba(128, 128, 128, 0.2);
584
- min-width: 200px;
585
- flex: 1;
586
- text-align: center;
587
- display: flex;
588
- flex-direction: column;
589
- align-items: center;
590
- justify-content: center;
591
-
592
- @media screen and (max-width: ${breakpoints.mobile}) {
593
- min-width: unset;
594
- padding: 20px 12px;
595
-
596
- &:hover {
597
- transform: none;
598
- }
599
- }
600
-
601
- &:hover {
602
- transform: translateY(-6px);
603
- box-shadow: ${theme.shadows.xl};
604
- border-color: ${(props) => props.$color || "var(--colors-primary600, #0284C7)"};
605
-
606
- .stat-icon {
607
- transform: scale(1.15) rotate(5deg);
608
- }
609
-
610
- .stat-value {
611
- transform: scale(1.08);
612
- color: ${(props) => props.$color || "var(--colors-primary600, #0284C7)"};
613
- }
614
- }
615
- `;
616
- const StatIcon = styled__default.default(designSystem.Box)`
617
- width: 68px;
618
- height: 68px;
619
- border-radius: ${theme.borderRadius.lg};
620
- display: flex;
621
- align-items: center;
622
- justify-content: center;
623
- background: ${(props) => props.$bg || "rgba(2, 132, 199, 0.12)"};
624
- transition: all ${theme.transitions.normal};
625
- margin: 0 auto 20px;
626
- box-shadow: ${theme.shadows.sm};
627
-
628
- svg {
629
- width: 34px;
630
- height: 34px;
631
- color: ${(props) => props.$color || "var(--colors-primary600, #0284C7)"};
632
- }
633
-
634
- @media screen and (max-width: ${breakpoints.mobile}) {
635
- width: 48px;
636
- height: 48px;
637
- margin-bottom: 12px;
638
-
639
- svg {
640
- width: 24px;
641
- height: 24px;
642
- }
643
- }
644
- `;
645
- const StatValue = styled__default.default(designSystem.Typography)`
646
- font-size: 2.75rem;
647
- font-weight: 700;
648
- color: var(--colors-neutral800);
649
- line-height: 1;
650
- margin-bottom: 10px;
651
- transition: all ${theme.transitions.normal};
652
- text-align: center;
653
-
654
- @media screen and (max-width: ${breakpoints.mobile}) {
655
- font-size: 2rem;
656
- margin-bottom: 6px;
657
- }
658
- `;
659
- const StatLabel = styled__default.default(designSystem.Typography)`
660
- font-size: 0.95rem;
661
- color: var(--colors-neutral600);
662
- font-weight: 500;
663
- letter-spacing: 0.025em;
664
- text-align: center;
665
-
666
- @media screen and (max-width: ${breakpoints.mobile}) {
667
- font-size: 0.8rem;
668
- }
669
- `;
670
- const DataTable = styled__default.default(designSystem.Box)`
671
- background: ${(p) => p.theme.colors.neutral0};
672
- border-radius: ${theme.borderRadius.lg};
673
- overflow: hidden;
674
- box-shadow: ${theme.shadows.sm};
675
- border: 1px solid rgba(128, 128, 128, 0.2);
676
- margin-bottom: ${theme.spacing.xl};
677
- `;
678
- const StyledTable = styled__default.default(designSystem.Table)`
679
- thead {
680
- background: var(--colors-neutral100);
681
- border-bottom: 2px solid rgba(128, 128, 128, 0.2);
682
-
683
- th {
684
- font-weight: 600;
685
- color: var(--colors-neutral800);
686
- font-size: 0.875rem;
687
- text-transform: uppercase;
688
- letter-spacing: 0.025em;
689
- padding: ${theme.spacing.lg} ${theme.spacing.lg};
690
- }
691
- }
692
-
693
- tbody tr {
694
- transition: all ${theme.transitions.fast};
695
- border-bottom: 1px solid rgba(128, 128, 128, 0.15);
696
-
697
- &:last-child {
698
- border-bottom: none;
699
- }
700
-
701
- &:hover {
702
- background: rgba(2, 132, 199, 0.12);
703
-
704
- .action-buttons {
705
- opacity: 1;
706
- }
707
- }
708
-
709
- td {
710
- padding: ${theme.spacing.lg} ${theme.spacing.lg};
711
- color: var(--colors-neutral800);
712
- vertical-align: middle;
713
- }
714
- }
715
- `;
716
- styled__default.default.div`
717
- width: 10px;
718
- height: 10px;
719
- border-radius: 50%;
720
- background: ${(props) => props.$online ? "var(--colors-success600, #22C55E)" : "rgba(128, 128, 128, 0.4)"};
721
- display: inline-block;
722
- margin-right: 8px;
723
- ${styled.css`animation: ${(props) => props.$online ? pulse : "none"} 2s ease-in-out infinite;`}
724
- `;
725
- const FilterBar = styled__default.default(designSystem.Flex)`
726
- background: ${(p) => p.theme.colors.neutral0};
727
- padding: ${theme.spacing.md} ${theme.spacing.lg};
728
- border-radius: ${theme.borderRadius.lg};
729
- margin-bottom: ${theme.spacing.lg};
730
- box-shadow: ${theme.shadows.sm};
731
- border: 1px solid rgba(128, 128, 128, 0.2);
732
- gap: ${theme.spacing.md};
733
- align-items: center;
734
- `;
735
- const SearchInputWrapper = styled__default.default.div`
736
- position: relative;
737
- flex: 1;
738
- display: flex;
739
- align-items: center;
740
- `;
741
- const SearchIcon = styled__default.default(icons.Search)`
742
- position: absolute;
743
- left: 12px;
744
- width: 16px;
745
- height: 16px;
746
- color: var(--colors-neutral600);
747
- pointer-events: none;
748
- `;
749
- const StyledSearchInput = styled__default.default.input`
750
- width: 100%;
751
- padding: ${theme.spacing.sm} ${theme.spacing.sm} ${theme.spacing.sm} 36px;
752
- border: 1px solid rgba(128, 128, 128, 0.2);
753
- border-radius: ${theme.borderRadius.md};
754
- font-size: 0.875rem;
755
- transition: all ${theme.transitions.fast};
756
- background: ${(p) => p.theme.colors.neutral0};
757
- color: var(--colors-neutral800);
758
-
759
- &:focus {
760
- outline: none;
761
- border-color: var(--colors-primary600, #0284C7);
762
- box-shadow: 0 0 0 3px rgba(2, 132, 199, 0.12);
763
- }
764
-
765
- &::placeholder {
766
- color: var(--colors-neutral500);
767
- }
768
- `;
769
- const ActionButtons = styled__default.default(designSystem.Flex)`
770
- opacity: 0.85;
771
- transition: all ${theme.transitions.fast};
772
- gap: 8px;
773
- justify-content: flex-end;
774
- `;
775
- const StatusBadge = styled__default.default.span`
776
- display: inline-flex;
777
- align-items: center;
778
- gap: 6px;
779
- padding: 6px 12px;
780
- border-radius: 20px;
781
- font-size: 12px;
782
- font-weight: 600;
783
- letter-spacing: 0.3px;
784
- text-transform: uppercase;
785
- transition: all 0.2s ease;
786
-
787
- ${(props) => props.$status === "active" && `
788
- background: linear-gradient(135deg, rgba(22, 163, 74, 0.12) 0%, rgba(34, 197, 94, 0.3) 100%);
789
- color: var(--colors-success700, #15803D);
790
- border: 1px solid rgba(34, 197, 94, 0.3);
791
- `}
792
-
793
- ${(props) => props.$status === "idle" && `
794
- background: linear-gradient(135deg, rgba(234, 179, 8, 0.12) 0%, rgba(234, 179, 8, 0.4) 100%);
795
- color: var(--colors-warning600, #A16207);
796
- border: 1px solid rgba(234, 179, 8, 0.4);
797
- `}
798
-
799
- ${(props) => props.$status === "loggedout" && `
800
- background: linear-gradient(135deg, rgba(220, 38, 38, 0.12) 0%, rgba(239, 68, 68, 0.4) 100%);
801
- color: var(--colors-danger600, #B91C1C);
802
- border: 1px solid rgba(239, 68, 68, 0.4);
803
- `}
804
-
805
- ${(props) => props.$status === "terminated" && `
806
- background: linear-gradient(135deg, var(--colors-neutral100) 0%, rgba(128, 128, 128, 0.2) 100%);
807
- color: var(--colors-neutral600);
808
- border: 1px solid rgba(128, 128, 128, 0.2);
809
- `}
810
- `;
811
- const StatusDot = styled__default.default.span`
812
- width: 8px;
813
- height: 8px;
814
- border-radius: 50%;
815
- flex-shrink: 0;
816
-
817
- ${(props) => props.$status === "active" && `
818
- background: var(--colors-success600, #22C55E);
819
- box-shadow: 0 0 6px rgba(34, 197, 94, 0.6);
820
- animation: pulse-green 2s ease-in-out infinite;
821
- `}
822
-
823
- ${(props) => props.$status === "idle" && `
824
- background: var(--colors-warning600, #F59E0B);
825
- `}
826
-
827
- ${(props) => props.$status === "loggedout" && `
828
- background: var(--colors-danger600, #EF4444);
829
- `}
830
-
831
- ${(props) => props.$status === "terminated" && `
832
- background: var(--colors-neutral500);
833
- `}
834
-
835
- @keyframes pulse-green {
836
- 0%, 100% { opacity: 1; transform: scale(1); }
837
- 50% { opacity: 0.7; transform: scale(1.1); }
838
- }
839
- `;
840
- const ClickableRow = styled__default.default(designSystem.Tr)`
841
- cursor: pointer;
842
-
843
- &:hover {
844
- background: rgba(2, 132, 199, 0.12) !important;
845
- }
846
- `;
847
- styled__default.default(designSystem.Box)`
848
- background: ${(p) => p.theme.colors.neutral0};
849
- border-radius: ${theme.borderRadius.xl};
850
- border: 2px dashed rgba(128, 128, 128, 0.3);
851
- padding: 80px 32px;
852
- text-align: center;
853
- position: relative;
854
- overflow: hidden;
855
- min-height: 400px;
856
- display: flex;
857
- align-items: center;
858
- justify-content: center;
859
- `;
860
- styled__default.default.div`
861
- position: absolute;
862
- top: 0;
863
- left: 0;
864
- right: 0;
865
- bottom: 0;
866
- background: linear-gradient(135deg, ${"rgba(2, 132, 199, 0.06)"} 0%, ${"rgba(147, 51, 234, 0.06)"} 100%);
867
- opacity: 0.3;
868
- z-index: 0;
869
- `;
870
- const HomePage = () => {
871
- const { formatMessage } = reactIntl.useIntl();
872
- const { get, post, del } = admin.useFetchClient();
873
- const { toggleNotification } = admin.useNotification();
874
- const t = (id, defaultMessage, values) => formatMessage({ id: index.getTranslation(id), defaultMessage }, values);
875
- const [sessions, setSessions] = react.useState([]);
876
- const [loading, setLoading] = react.useState(true);
877
- const [filterStatus, setFilterStatus] = react.useState("active");
878
- const [entriesPerPage, setEntriesPerPage] = react.useState("25");
879
- const [searchQuery, setSearchQuery] = react.useState("");
880
- const [selectedSession, setSelectedSession] = react.useState(null);
881
- const [showDetailModal, setShowDetailModal] = react.useState(false);
882
- react.useEffect(() => {
883
- fetchSessions();
884
- const interval = setInterval(() => {
885
- if (!showDetailModal) {
886
- fetchSessions();
887
- }
888
- }, 10 * 60 * 1e3);
889
- return () => clearInterval(interval);
890
- }, [showDetailModal]);
891
- const fetchSessions = async () => {
892
- setLoading(true);
893
- try {
894
- const { data } = await get(`/${index.pluginId}/sessions`);
895
- setSessions(data.data || []);
896
- } catch (err) {
897
- console.error("[SessionManager] Error fetching sessions:", err);
898
- } finally {
899
- setLoading(false);
900
- }
901
- };
902
- const handleTerminateSession = async (sessionId) => {
903
- 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)."))) {
904
- return;
905
- }
906
- try {
907
- await post(`/${index.pluginId}/sessions/${sessionId}/terminate`);
908
- fetchSessions();
909
- } catch (err) {
910
- console.error("[SessionManager] Error terminating session:", err);
911
- }
912
- };
913
- const handleDeleteSession = async (sessionId) => {
914
- if (!confirm(t("homepage.confirm.delete", "[WARNING] This will PERMANENTLY delete this session from the database!\n\nThis action cannot be undone.\n\nAre you sure?"))) {
915
- return;
916
- }
917
- try {
918
- await del(`/${index.pluginId}/sessions/${sessionId}`);
919
- fetchSessions();
920
- toggleNotification({
921
- type: "success",
922
- message: t("notifications.success.deleted", "Session permanently deleted")
923
- });
924
- } catch (err) {
925
- console.error("[SessionManager] Error deleting session:", err);
926
- toggleNotification({
927
- type: "danger",
928
- message: t("notifications.error.delete", "Failed to delete session")
929
- });
930
- }
931
- };
932
- const handleExportCSV = () => {
933
- try {
934
- const headers = ["ID", "Status", "User Email", "Username", "Device", "Browser", "OS", "IP Address", "Login Time", "Last Active", "Logout Time", "Minutes Idle"];
935
- const escapeCsvValue = (value) => `"${String(value ?? "").replace(/"/g, '""')}"`;
936
- const rows = filteredSessions.map((session) => {
937
- const deviceInfo = index.parseUserAgent(session.userAgent);
938
- const status = sessionStatus.getSessionStatus(session);
939
- return [
940
- session.id,
941
- status,
942
- session.user?.email || "",
943
- session.user?.username || "",
944
- deviceInfo.device,
945
- deviceInfo.browser,
946
- deviceInfo.os,
947
- session.ipAddress,
948
- new Date(session.loginTime).toISOString(),
949
- new Date(session.lastActive || session.loginTime).toISOString(),
950
- session.logoutTime ? new Date(session.logoutTime).toISOString() : "",
951
- session.minutesSinceActive
952
- ];
953
- });
954
- const csvContent = [
955
- headers.map(escapeCsvValue).join(","),
956
- ...rows.map((row) => row.map(escapeCsvValue).join(","))
957
- ].join("\n");
958
- const blob = new Blob([csvContent], { type: "text/csv;charset=utf-8;" });
959
- const link = document.createElement("a");
960
- link.href = URL.createObjectURL(blob);
961
- link.download = `sessions-export-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.csv`;
962
- link.click();
963
- toggleNotification({
964
- type: "success",
965
- message: t("notifications.success.exported", "Exported {count} sessions to {format}", { count: filteredSessions.length, format: "CSV" })
966
- });
967
- } catch (err) {
968
- console.error("[SessionManager] Export error:", err);
969
- toggleNotification({
970
- type: "danger",
971
- message: t("notifications.error.export", "Failed to export sessions")
972
- });
973
- }
974
- };
975
- const handleExportJSON = () => {
976
- try {
977
- const exportData = {
978
- exportedAt: (/* @__PURE__ */ new Date()).toISOString(),
979
- filter: filterStatus,
980
- totalSessions: sessions.length,
981
- exportedSessions: filteredSessions.length,
982
- sessions: filteredSessions.map((session) => {
983
- const deviceInfo = index.parseUserAgent(session.userAgent);
984
- return {
985
- id: session.id,
986
- status: sessionStatus.getSessionStatus(session),
987
- user: {
988
- id: session.user?.documentId || session.user?.id,
989
- email: session.user?.email,
990
- username: session.user?.username
991
- },
992
- device: {
993
- type: deviceInfo.device,
994
- browser: deviceInfo.browser,
995
- browserVersion: deviceInfo.browserVersion,
996
- os: deviceInfo.os
997
- },
998
- ipAddress: session.ipAddress,
999
- loginTime: session.loginTime,
1000
- lastActive: session.lastActive,
1001
- logoutTime: session.logoutTime,
1002
- minutesSinceActive: session.minutesSinceActive,
1003
- isActive: session.isActive,
1004
- isTrulyActive: session.isTrulyActive
1005
- };
1006
- })
1007
- };
1008
- const blob = new Blob([JSON.stringify(exportData, null, 2)], { type: "application/json" });
1009
- const link = document.createElement("a");
1010
- link.href = URL.createObjectURL(blob);
1011
- link.download = `sessions-export-${(/* @__PURE__ */ new Date()).toISOString().split("T")[0]}.json`;
1012
- link.click();
1013
- toggleNotification({
1014
- type: "success",
1015
- message: t("notifications.success.exported", "Exported {count} sessions to {format}", { count: filteredSessions.length, format: "JSON" })
1016
- });
1017
- } catch (err) {
1018
- console.error("[SessionManager] Export error:", err);
1019
- toggleNotification({
1020
- type: "danger",
1021
- message: t("notifications.error.export", "Failed to export sessions")
1022
- });
1023
- }
1024
- };
1025
- const getDeviceIcon = (deviceType) => {
1026
- if (deviceType === "Mobile" || deviceType === "Tablet") return icons.Phone;
1027
- if (deviceType === "Desktop" || deviceType === "Laptop") return icons.Monitor;
1028
- return icons.Server;
1029
- };
1030
- const activeSessions = sessions.filter((s) => s.isActive && s.isTrulyActive);
1031
- const idleSessions = sessions.filter((s) => sessionStatus.getSessionStatus(s) === "idle");
1032
- const loggedOutSessions = sessions.filter((s) => sessionStatus.getSessionStatus(s) === "loggedout");
1033
- const terminatedSessions = sessions.filter((s) => sessionStatus.getSessionStatus(s) === "terminated");
1034
- const handleSessionClick = (session) => {
1035
- setSelectedSession(session);
1036
- setShowDetailModal(true);
1037
- };
1038
- const handleModalClose = () => {
1039
- setShowDetailModal(false);
1040
- setSelectedSession(null);
1041
- };
1042
- const handleSessionTerminated = () => {
1043
- fetchSessions();
1044
- };
1045
- const filteredSessions = sessions.filter((session) => {
1046
- const sessionStatus$1 = sessionStatus.getSessionStatus(session);
1047
- if (filterStatus === "active" && sessionStatus$1 !== "active") return false;
1048
- if (filterStatus === "idle" && sessionStatus$1 !== "idle") return false;
1049
- if (filterStatus === "loggedout" && sessionStatus$1 !== "loggedout") return false;
1050
- if (filterStatus === "terminated" && sessionStatus$1 !== "terminated") return false;
1051
- if (searchQuery) {
1052
- const query = searchQuery.toLowerCase();
1053
- const matchesUser = session.user?.email?.toLowerCase().includes(query) || session.user?.username?.toLowerCase().includes(query);
1054
- const matchesIp = session.ipAddress?.toLowerCase().includes(query);
1055
- const deviceInfo = index.parseUserAgent(session.userAgent);
1056
- const matchesDevice = deviceInfo.device?.toLowerCase().includes(query) || deviceInfo.browser?.toLowerCase().includes(query) || deviceInfo.os?.toLowerCase().includes(query);
1057
- return matchesUser || matchesIp || matchesDevice;
1058
- }
1059
- return true;
1060
- }).slice(0, parseInt(entriesPerPage));
1061
- return /* @__PURE__ */ jsxRuntime.jsxs(Container, { padding: 8, children: [
1062
- /* @__PURE__ */ jsxRuntime.jsx(Header, { children: /* @__PURE__ */ jsxRuntime.jsxs(HeaderContent, { justifyContent: "space-between", alignItems: "center", children: [
1063
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 2, children: [
1064
- /* @__PURE__ */ jsxRuntime.jsxs(Title, { children: [
1065
- /* @__PURE__ */ jsxRuntime.jsx(icons.Monitor, {}),
1066
- " ",
1067
- t("homepage.title", "Session Manager")
1068
- ] }),
1069
- /* @__PURE__ */ jsxRuntime.jsx(Subtitle, { children: t("homepage.subtitle", "Monitor and manage user sessions in real-time") })
1070
- ] }),
1071
- filteredSessions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
1072
- /* @__PURE__ */ jsxRuntime.jsx(
1073
- designSystem.Button,
1074
- {
1075
- onClick: handleExportCSV,
1076
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Download, {}),
1077
- size: "M",
1078
- variant: "secondary",
1079
- style: {
1080
- backgroundColor: "rgba(255,255,255,0.2)",
1081
- color: "white",
1082
- border: "1px solid rgba(255,255,255,0.3)",
1083
- fontWeight: "600"
1084
- },
1085
- children: t("homepage.export.csv", "Export CSV")
1086
- }
1087
- ),
1088
- /* @__PURE__ */ jsxRuntime.jsx(
1089
- designSystem.Button,
1090
- {
1091
- onClick: handleExportJSON,
1092
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Download, {}),
1093
- size: "M",
1094
- variant: "secondary",
1095
- style: {
1096
- backgroundColor: "rgba(255,255,255,0.2)",
1097
- color: "white",
1098
- border: "1px solid rgba(255,255,255,0.3)",
1099
- fontWeight: "600"
1100
- },
1101
- children: t("homepage.export.json", "Export JSON")
1102
- }
1103
- )
1104
- ] })
1105
- ] }) }),
1106
- /* @__PURE__ */ jsxRuntime.jsxs(StatsGrid, { children: [
1107
- /* @__PURE__ */ jsxRuntime.jsxs(StatCard, { $delay: "0.1s", $color: "var(--colors-success600, #22C55E)", children: [
1108
- /* @__PURE__ */ jsxRuntime.jsx(StatIcon, { className: "stat-icon", $bg: "rgba(22, 163, 74, 0.12)", $color: "var(--colors-success600, #16A34A)", children: /* @__PURE__ */ jsxRuntime.jsx(icons.Check, {}) }),
1109
- /* @__PURE__ */ jsxRuntime.jsx(StatValue, { className: "stat-value", children: activeSessions.length }),
1110
- /* @__PURE__ */ jsxRuntime.jsx(StatLabel, { children: t("homepage.stats.active", "Active") })
1111
- ] }),
1112
- /* @__PURE__ */ jsxRuntime.jsxs(StatCard, { $delay: "0.2s", $color: "var(--colors-warning600, #F59E0B)", children: [
1113
- /* @__PURE__ */ jsxRuntime.jsx(StatIcon, { className: "stat-icon", $bg: "rgba(234, 179, 8, 0.12)", $color: "var(--colors-warning600, #D97706)", children: /* @__PURE__ */ jsxRuntime.jsx(icons.Clock, {}) }),
1114
- /* @__PURE__ */ jsxRuntime.jsx(StatValue, { className: "stat-value", children: idleSessions.length }),
1115
- /* @__PURE__ */ jsxRuntime.jsx(StatLabel, { children: t("homepage.stats.idle", "Idle") })
1116
- ] }),
1117
- /* @__PURE__ */ jsxRuntime.jsxs(StatCard, { $delay: "0.3s", $color: "var(--colors-danger600, #EF4444)", children: [
1118
- /* @__PURE__ */ jsxRuntime.jsx(StatIcon, { className: "stat-icon", $bg: "rgba(220, 38, 38, 0.12)", $color: "var(--colors-danger600, #DC2626)", children: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {}) }),
1119
- /* @__PURE__ */ jsxRuntime.jsx(StatValue, { className: "stat-value", children: loggedOutSessions.length }),
1120
- /* @__PURE__ */ jsxRuntime.jsx(StatLabel, { children: t("homepage.stats.loggedOut", "Logged Out") })
1121
- ] }),
1122
- /* @__PURE__ */ jsxRuntime.jsxs(StatCard, { $delay: "0.4s", $color: "var(--colors-neutral600)", children: [
1123
- /* @__PURE__ */ jsxRuntime.jsx(StatIcon, { className: "stat-icon", $bg: "var(--colors-neutral100)", $color: "var(--colors-neutral600)", children: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {}) }),
1124
- /* @__PURE__ */ jsxRuntime.jsx(StatValue, { className: "stat-value", children: terminatedSessions.length }),
1125
- /* @__PURE__ */ jsxRuntime.jsx(StatLabel, { children: t("homepage.stats.terminated", "Terminated") })
1126
- ] }),
1127
- /* @__PURE__ */ jsxRuntime.jsxs(StatCard, { $delay: "0.5s", $color: "#A855F7", children: [
1128
- /* @__PURE__ */ jsxRuntime.jsx(StatIcon, { className: "stat-icon", $bg: "rgba(147, 51, 234, 0.12)", $color: "#9333EA", children: /* @__PURE__ */ jsxRuntime.jsx(icons.User, {}) }),
1129
- /* @__PURE__ */ jsxRuntime.jsx(StatValue, { className: "stat-value", children: sessions.length }),
1130
- /* @__PURE__ */ jsxRuntime.jsx(StatLabel, { children: t("homepage.stats.total", "Total") })
1131
- ] })
1132
- ] }),
1133
- loading && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", padding: 8, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { children: t("homepage.loading", "Loading sessions...") }) }),
1134
- !loading && sessions.length > 0 && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
1135
- /* @__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") }) }),
1136
- /* @__PURE__ */ jsxRuntime.jsxs(FilterBar, { children: [
1137
- /* @__PURE__ */ jsxRuntime.jsxs(SearchInputWrapper, { children: [
1138
- /* @__PURE__ */ jsxRuntime.jsx(SearchIcon, {}),
1139
- /* @__PURE__ */ jsxRuntime.jsx(
1140
- StyledSearchInput,
1141
- {
1142
- value: searchQuery,
1143
- onChange: (e) => setSearchQuery(e.target.value),
1144
- placeholder: t("homepage.search.placeholder", "Search by user, IP address, or device..."),
1145
- type: "text"
1146
- }
1147
- )
1148
- ] }),
1149
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { minWidth: "180px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
1150
- designSystem.SingleSelect,
1151
- {
1152
- value: filterStatus,
1153
- onChange: setFilterStatus,
1154
- placeholder: "Filter",
1155
- size: "S",
1156
- children: [
1157
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "all", children: t("homepage.filter.all", "All Sessions") }),
1158
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "active", children: t("homepage.filter.active", "Currently active") }),
1159
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "idle", children: t("homepage.filter.idle", "Inactive") }),
1160
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "loggedout", children: t("homepage.filter.loggedout", "Logged Out") }),
1161
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "terminated", children: t("homepage.filter.terminated", "Terminated") })
1162
- ]
1163
- }
1164
- ) }),
1165
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { minWidth: "130px" }, children: /* @__PURE__ */ jsxRuntime.jsxs(
1166
- designSystem.SingleSelect,
1167
- {
1168
- value: entriesPerPage,
1169
- onChange: setEntriesPerPage,
1170
- placeholder: "Entries",
1171
- size: "S",
1172
- children: [
1173
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "10", children: t("homepage.entries.10", "10 entries") }),
1174
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "25", children: t("homepage.entries.25", "25 entries") }),
1175
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "50", children: t("homepage.entries.50", "50 entries") }),
1176
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: "100", children: t("homepage.entries.100", "100 entries") })
1177
- ]
1178
- }
1179
- ) })
1180
- ] }),
1181
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { marginBottom: theme.spacing.md }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: searchQuery ? t("homepage.showingFiltered", 'Showing {count} of {total} sessions (filtered by "{query}")', { count: filteredSessions.length, total: sessions.length, query: searchQuery }) : t("homepage.showing", "Showing {count} of {total} sessions", { count: filteredSessions.length, total: sessions.length }) }) }),
1182
- filteredSessions.length > 0 ? /* @__PURE__ */ jsxRuntime.jsx(DataTable, { children: /* @__PURE__ */ jsxRuntime.jsxs(StyledTable, { children: [
1183
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
1184
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: t("homepage.table.status", "Status") }),
1185
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: t("homepage.table.user", "User") }),
1186
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: t("homepage.table.device", "Device") }),
1187
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: t("homepage.table.ipAddress", "IP Address") }),
1188
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: t("homepage.table.loginTime", "Login Time") }),
1189
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: t("homepage.table.lastActive", "Last Active") }),
1190
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: t("homepage.table.actions", "Actions") })
1191
- ] }) }),
1192
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: filteredSessions.map((session) => {
1193
- const deviceInfo = index.parseUserAgent(session.userAgent);
1194
- const DeviceIcon = getDeviceIcon(deviceInfo.device);
1195
- const sessionStatus$1 = sessionStatus.getSessionStatus(session);
1196
- const statusConfig = {
1197
- active: {
1198
- bg: "rgba(22, 163, 74, 0.06)",
1199
- badgeColor: "success600",
1200
- label: t("homepage.status.active", "Active"),
1201
- indicator: true
1202
- },
1203
- idle: {
1204
- bg: "rgba(234, 179, 8, 0.06)",
1205
- badgeColor: "warning600",
1206
- label: t("homepage.status.idle", "Idle"),
1207
- indicator: false
1208
- },
1209
- loggedout: {
1210
- bg: "rgba(220, 38, 38, 0.06)",
1211
- badgeColor: "danger600",
1212
- label: t("homepage.status.loggedOut", "Logged Out"),
1213
- indicator: false,
1214
- opacity: 0.7
1215
- },
1216
- terminated: {
1217
- bg: "var(--colors-neutral100)",
1218
- badgeColor: "neutral600",
1219
- label: t("homepage.status.terminated", "Terminated"),
1220
- indicator: false,
1221
- opacity: 0.6
1222
- }
1223
- };
1224
- const config = statusConfig[sessionStatus$1];
1225
- return /* @__PURE__ */ jsxRuntime.jsxs(
1226
- ClickableRow,
1227
- {
1228
- onClick: () => handleSessionClick(session),
1229
- style: {
1230
- background: config.bg,
1231
- opacity: config.opacity || 1
1232
- },
1233
- children: [
1234
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(StatusBadge, { $status: sessionStatus$1, children: [
1235
- /* @__PURE__ */ jsxRuntime.jsx(StatusDot, { $status: sessionStatus$1 }),
1236
- config.label
1237
- ] }) }),
1238
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", children: [
1239
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { fontWeight: "semiBold", ellipsis: true, children: session.user?.username || session.user?.email || t("homepage.user.unknown", "Unknown") }),
1240
- session.user?.email && session.user?.username && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", ellipsis: true, children: session.user.email })
1241
- ] }) }),
1242
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 2, children: [
1243
- /* @__PURE__ */ jsxRuntime.jsx(DeviceIcon, { width: "18px", height: "18px" }),
1244
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", children: [
1245
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "semiBold", children: deviceInfo.device }),
1246
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: [
1247
- deviceInfo.browser,
1248
- " on ",
1249
- deviceInfo.os
1250
- ] })
1251
- ] })
1252
- ] }) }),
1253
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", style: { fontFamily: "monospace" }, children: session.ipAddress }) }),
1254
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral700", children: new Date(session.loginTime).toLocaleString() }) }),
1255
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", children: [
1256
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral700", children: new Date(session.lastActive || session.loginTime).toLocaleString() }),
1257
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: sessionStatus$1 === "active" ? "success600" : "neutral500", children: t("homepage.time.minAgo", "{minutes} min ago", { minutes: session.minutesSinceActive }) })
1258
- ] }) }),
1259
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { onClick: (e) => e.stopPropagation(), children: /* @__PURE__ */ jsxRuntime.jsxs(ActionButtons, { className: "action-buttons", children: [
1260
- /* @__PURE__ */ jsxRuntime.jsx(
1261
- StyledButtons.IconButtonPrimary,
1262
- {
1263
- onClick: (e) => {
1264
- e.stopPropagation();
1265
- handleSessionClick(session);
1266
- },
1267
- title: t("homepage.actions.viewDetails", "View Details"),
1268
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Eye, {})
1269
- }
1270
- ),
1271
- /* @__PURE__ */ jsxRuntime.jsx(
1272
- StyledButtons.IconButtonWarning,
1273
- {
1274
- onClick: (e) => {
1275
- e.stopPropagation();
1276
- handleTerminateSession(session.id);
1277
- },
1278
- disabled: sessionStatus$1 !== "active" && sessionStatus$1 !== "idle",
1279
- title: session.isActive ? t("homepage.actions.terminate", "Terminate (Logout)") : t("homepage.actions.alreadyInactive", "Already inactive"),
1280
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Cross, {})
1281
- }
1282
- ),
1283
- /* @__PURE__ */ jsxRuntime.jsx(
1284
- StyledButtons.IconButtonDanger,
1285
- {
1286
- onClick: (e) => {
1287
- e.stopPropagation();
1288
- handleDeleteSession(session.id);
1289
- },
1290
- title: t("homepage.actions.deletePermanently", "Delete Permanently"),
1291
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {})
1292
- }
1293
- )
1294
- ] }) })
1295
- ]
1296
- },
1297
- session.id
1298
- );
1299
- }) })
1300
- ] }) }) : (
1301
- /* No results found */
1302
- /* @__PURE__ */ jsxRuntime.jsxs(
1303
- designSystem.Box,
1304
- {
1305
- background: "neutral0",
1306
- style: {
1307
- borderRadius: theme.borderRadius.xl,
1308
- border: "2px dashed rgba(128, 128, 128, 0.2)",
1309
- padding: "60px 32px",
1310
- textAlign: "center",
1311
- position: "relative",
1312
- overflow: "hidden",
1313
- minHeight: "300px",
1314
- display: "flex",
1315
- alignItems: "center",
1316
- justifyContent: "center"
1317
- },
1318
- children: [
1319
- /* @__PURE__ */ jsxRuntime.jsx(
1320
- designSystem.Box,
1321
- {
1322
- style: {
1323
- position: "absolute",
1324
- top: 0,
1325
- left: 0,
1326
- right: 0,
1327
- bottom: 0,
1328
- background: `linear-gradient(135deg, ${"rgba(2, 132, 199, 0.06)"} 0%, ${"rgba(147, 51, 234, 0.06)"} 100%)`,
1329
- opacity: 0.3,
1330
- zIndex: 0
1331
- }
1332
- }
1333
- ),
1334
- /* @__PURE__ */ jsxRuntime.jsx(FloatingEmoji, { children: "🔍" }),
1335
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "center", gap: 4, style: { position: "relative", zIndex: 1 }, children: [
1336
- /* @__PURE__ */ jsxRuntime.jsx(
1337
- designSystem.Box,
1338
- {
1339
- style: {
1340
- width: "100px",
1341
- height: "100px",
1342
- borderRadius: "50%",
1343
- background: `linear-gradient(135deg, ${"rgba(2, 132, 199, 0.12)"} 0%, ${"rgba(147, 51, 234, 0.12)"} 100%)`,
1344
- display: "flex",
1345
- alignItems: "center",
1346
- justifyContent: "center",
1347
- boxShadow: theme.shadows.xl
1348
- },
1349
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Search, { style: { width: "50px", height: "50px", color: "var(--colors-primary600, #0284C7)" } })
1350
- }
1351
- ),
1352
- /* @__PURE__ */ jsxRuntime.jsx(
1353
- designSystem.Typography,
1354
- {
1355
- variant: "alpha",
1356
- textColor: "neutral800",
1357
- style: {
1358
- fontSize: "1.5rem",
1359
- fontWeight: "700",
1360
- marginBottom: "4px"
1361
- },
1362
- children: t("homepage.noResults.title", "No sessions found")
1363
- }
1364
- ),
1365
- /* @__PURE__ */ jsxRuntime.jsx(
1366
- designSystem.Typography,
1367
- {
1368
- variant: "omega",
1369
- textColor: "neutral600",
1370
- style: {
1371
- fontSize: "1rem",
1372
- maxWidth: "400px",
1373
- lineHeight: "1.6"
1374
- },
1375
- children: t("homepage.noResults.description", "Try adjusting your search query or filters to find sessions")
1376
- }
1377
- )
1378
- ] })
1379
- ]
1380
- }
1381
- )
1382
- )
1383
- ] }),
1384
- !loading && sessions.length === 0 && /* @__PURE__ */ jsxRuntime.jsxs(
1385
- designSystem.Box,
1386
- {
1387
- background: "neutral0",
1388
- style: {
1389
- borderRadius: theme.borderRadius.xl,
1390
- border: "2px dashed rgba(128, 128, 128, 0.2)",
1391
- padding: "80px 32px",
1392
- textAlign: "center",
1393
- position: "relative",
1394
- overflow: "hidden",
1395
- minHeight: "400px",
1396
- display: "flex",
1397
- alignItems: "center",
1398
- justifyContent: "center"
1399
- },
1400
- children: [
1401
- /* @__PURE__ */ jsxRuntime.jsx(
1402
- designSystem.Box,
1403
- {
1404
- style: {
1405
- position: "absolute",
1406
- top: 0,
1407
- left: 0,
1408
- right: 0,
1409
- bottom: 0,
1410
- background: `linear-gradient(135deg, ${"rgba(2, 132, 199, 0.06)"} 0%, ${"rgba(147, 51, 234, 0.06)"} 100%)`,
1411
- opacity: 0.3,
1412
- zIndex: 0
1413
- }
1414
- }
1415
- ),
1416
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "center", gap: 6, style: { position: "relative", zIndex: 1 }, children: [
1417
- /* @__PURE__ */ jsxRuntime.jsx(
1418
- designSystem.Box,
1419
- {
1420
- style: {
1421
- width: "120px",
1422
- height: "120px",
1423
- borderRadius: "50%",
1424
- background: `linear-gradient(135deg, ${"rgba(2, 132, 199, 0.12)"} 0%, ${"rgba(147, 51, 234, 0.12)"} 100%)`,
1425
- display: "flex",
1426
- alignItems: "center",
1427
- justifyContent: "center",
1428
- boxShadow: theme.shadows.xl
1429
- },
1430
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Monitor, { style: { width: "60px", height: "60px", color: "var(--colors-primary600, #0284C7)" } })
1431
- }
1432
- ),
1433
- /* @__PURE__ */ jsxRuntime.jsx(
1434
- designSystem.Typography,
1435
- {
1436
- variant: "alpha",
1437
- textColor: "neutral800",
1438
- style: {
1439
- fontSize: "1.75rem",
1440
- fontWeight: "700",
1441
- marginBottom: "8px"
1442
- },
1443
- children: t("homepage.empty.title", "No sessions yet")
1444
- }
1445
- ),
1446
- /* @__PURE__ */ jsxRuntime.jsx(
1447
- designSystem.Typography,
1448
- {
1449
- variant: "omega",
1450
- textColor: "neutral600",
1451
- style: {
1452
- fontSize: "1rem",
1453
- maxWidth: "500px",
1454
- lineHeight: "1.6"
1455
- },
1456
- children: t("homepage.empty.description", "Sessions will appear here when users log in to your application")
1457
- }
1458
- )
1459
- ] })
1460
- ]
1461
- }
1462
- ),
1463
- showDetailModal && selectedSession && /* @__PURE__ */ jsxRuntime.jsx(
1464
- SessionDetailModal,
1465
- {
1466
- session: selectedSession,
1467
- onClose: handleModalClose,
1468
- onSessionTerminated: handleSessionTerminated
1469
- }
1470
- )
1471
- ] });
1472
- };
1473
- const LicenseGuard = ({ children }) => /* @__PURE__ */ jsxRuntime.jsx(jsxRuntime.Fragment, { children });
1474
- const pluginId = "magic-sessionmanager";
1475
- const pluginPermissions = {
1476
- access: [{ action: `plugin::${pluginId}.access`, subject: null }]
1477
- };
1478
- const App = () => {
1479
- return /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Protect, { permissions: pluginPermissions.access, children: /* @__PURE__ */ jsxRuntime.jsx(LicenseGuard, { children: /* @__PURE__ */ jsxRuntime.jsx(HomePage, {}) }) });
1480
- };
1481
- exports.default = App;