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