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.
- package/CHANGELOG.md +20 -0
- package/README.md +17 -38
- package/dist/admin/Analytics-CaRlu5ad.js +332 -0
- package/dist/admin/Analytics-THqDbNX0.mjs +330 -0
- package/dist/admin/App-AbZwLHtF.js +1263 -0
- package/dist/admin/App-hSh7guii.mjs +1261 -0
- package/dist/admin/FormField-C8kIT2NE.mjs +59 -0
- package/dist/admin/FormField-b5KBvkrj.js +60 -0
- package/dist/admin/License-BXBVwUVu.mjs +299 -0
- package/dist/admin/License-CABdPwnd.js +301 -0
- package/dist/admin/OnlineUsersWidget-BnWFj9IM.mjs +230 -0
- package/dist/admin/OnlineUsersWidget-CPFAACSb.js +230 -0
- package/dist/admin/PluginPageLayout-BPFMcgrx.mjs +42 -0
- package/dist/admin/PluginPageLayout-DmNzMdqu.js +43 -0
- package/dist/admin/Settings-B4DNdeKx.js +2152 -0
- package/dist/admin/Settings-C4RsJosh.mjs +2150 -0
- package/dist/admin/{de-JBE-iylO.mjs → de-AwIFTd9i.mjs} +154 -20
- package/dist/admin/{de-BnqGCokx.js → de-D23nmqnl.js} +154 -20
- package/dist/admin/{en-BRmVwd8-.js → en-C5iYQ0mC.js} +155 -21
- package/dist/admin/{en-kQWtdEai.mjs → en-D6QEGeRh.mjs} +155 -21
- package/dist/admin/{es-CH691xcL.js → es-CIXnsG-p.js} +154 -20
- package/dist/admin/{es-DOQvBxih.mjs → es-CnFfVdKw.mjs} +154 -20
- package/dist/admin/{fr-CLExO0w_.js → fr-BglXE-W4.js} +154 -20
- package/dist/admin/{fr-CmfCpepX.mjs → fr-DefoR7uH.mjs} +154 -20
- package/dist/admin/index-BFVITQ-o.mjs +624 -0
- package/dist/admin/{index-Duc7cR_d.js → index-DlMm-NyK.js} +261 -188
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/maskSensitiveValue-1uGWmrfG.mjs +20 -0
- package/dist/admin/maskSensitiveValue-B9vhxPad.js +19 -0
- package/dist/admin/{pt-BJ_F0yNi.js → pt-J5sf7jiY.js} +154 -20
- package/dist/admin/{pt-BSzZdyAH.mjs → pt-TODwvNQA.mjs} +154 -20
- package/dist/server/index.js +4396 -7820
- package/dist/server/index.mjs +4396 -7820
- package/package.json +21 -19
- package/scripts/geoip-updater.cjs +234 -15
- 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/index-B_lFjUAg.mjs +0 -551
- package/dist/admin/sessionStatus-D_fWEzgj.js +0 -11
- package/dist/admin/sessionStatus-kwggjEMw.mjs +0 -12
|
@@ -0,0 +1,330 @@
|
|
|
1
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useEffect } from "react";
|
|
3
|
+
import { useIntl } from "react-intl";
|
|
4
|
+
import { useFetchClient } from "@strapi/strapi/admin";
|
|
5
|
+
import styled from "styled-components";
|
|
6
|
+
import { Loader, Alert, Button, Typography, Flex, Box, Badge, EmptyStateLayout } from "@strapi/design-system";
|
|
7
|
+
import { ChartBubble, User, Clock, Monitor } from "@strapi/icons";
|
|
8
|
+
import { g as getSessionStatus, p as pluginId, l as logSafeAdminError, R as ReadableText, a as getTranslation } from "./index-BFVITQ-o.mjs";
|
|
9
|
+
import { P as PluginPageLayout } from "./PluginPageLayout-BPFMcgrx.mjs";
|
|
10
|
+
function increment(target, key) {
|
|
11
|
+
target[key] = (target[key] || 0) + 1;
|
|
12
|
+
}
|
|
13
|
+
function getUserKey(session) {
|
|
14
|
+
return session?.user?.documentId || session?.user?.id || session?.user?.email || session?.user?.username || null;
|
|
15
|
+
}
|
|
16
|
+
function getDurationMinutes(session, now) {
|
|
17
|
+
const start = Date.parse(session?.loginTime);
|
|
18
|
+
if (!Number.isFinite(start)) return null;
|
|
19
|
+
const endValue = session.logoutTime || session.lastActive;
|
|
20
|
+
const end = endValue ? Date.parse(endValue) : now;
|
|
21
|
+
if (!Number.isFinite(end)) return null;
|
|
22
|
+
return Math.max(0, Math.floor((end - start) / 6e4));
|
|
23
|
+
}
|
|
24
|
+
function computeSessionAnalytics(sessions = [], { now = Date.now() } = {}) {
|
|
25
|
+
const dayAgo = now - 24 * 60 * 60 * 1e3;
|
|
26
|
+
const weekAgo = now - 7 * 24 * 60 * 60 * 1e3;
|
|
27
|
+
const devices = {};
|
|
28
|
+
const browsers = {};
|
|
29
|
+
const operatingSystems = {};
|
|
30
|
+
const loginHours = Array(24).fill(0);
|
|
31
|
+
const uniqueUsers = /* @__PURE__ */ new Set();
|
|
32
|
+
const uniqueIPs = /* @__PURE__ */ new Set();
|
|
33
|
+
const durations = [];
|
|
34
|
+
let todayLogins = 0;
|
|
35
|
+
let weekLogins = 0;
|
|
36
|
+
let loggedOut = 0;
|
|
37
|
+
let terminated = 0;
|
|
38
|
+
for (const session of sessions) {
|
|
39
|
+
const ua = String(session?.userAgent || "").toLowerCase();
|
|
40
|
+
const loginTime = Date.parse(session?.loginTime);
|
|
41
|
+
if (Number.isFinite(loginTime)) {
|
|
42
|
+
if (loginTime > dayAgo) todayLogins++;
|
|
43
|
+
if (loginTime > weekAgo) weekLogins++;
|
|
44
|
+
loginHours[new Date(loginTime).getHours()]++;
|
|
45
|
+
}
|
|
46
|
+
if (ua.includes("tablet") || ua.includes("ipad") || ua.includes("android") && !ua.includes("mobile")) {
|
|
47
|
+
increment(devices, "Tablet");
|
|
48
|
+
} else if (ua.includes("mobile") || ua.includes("android") || ua.includes("iphone")) {
|
|
49
|
+
increment(devices, "Mobile");
|
|
50
|
+
} else {
|
|
51
|
+
increment(devices, "Desktop");
|
|
52
|
+
}
|
|
53
|
+
if (ua.includes("edg")) increment(browsers, "Edge");
|
|
54
|
+
else if (ua.includes("chrome")) increment(browsers, "Chrome");
|
|
55
|
+
else if (ua.includes("firefox")) increment(browsers, "Firefox");
|
|
56
|
+
else if (ua.includes("safari")) increment(browsers, "Safari");
|
|
57
|
+
else if (ua.includes("postman") || ua.includes("curl")) increment(browsers, "API Client");
|
|
58
|
+
else increment(browsers, "Other");
|
|
59
|
+
if (ua.includes("android")) increment(operatingSystems, "Android");
|
|
60
|
+
else if (ua.includes("ios") || ua.includes("iphone") || ua.includes("ipad")) increment(operatingSystems, "iOS");
|
|
61
|
+
else if (ua.includes("windows") || ua.includes("win32") || ua.includes("win64")) increment(operatingSystems, "Windows");
|
|
62
|
+
else if (ua.includes("mac") || ua.includes("darwin")) increment(operatingSystems, "macOS");
|
|
63
|
+
else if (ua.includes("linux")) increment(operatingSystems, "Linux");
|
|
64
|
+
else increment(operatingSystems, "Other");
|
|
65
|
+
const userKey = getUserKey(session);
|
|
66
|
+
if (userKey) uniqueUsers.add(userKey);
|
|
67
|
+
if (session?.ipAddress) uniqueIPs.add(session.ipAddress);
|
|
68
|
+
const status = getSessionStatus(session);
|
|
69
|
+
if (status === "loggedout") loggedOut++;
|
|
70
|
+
else if (!session?.isActive && status === "terminated") terminated++;
|
|
71
|
+
const duration = getDurationMinutes(session, now);
|
|
72
|
+
if (duration !== null) durations.push(duration);
|
|
73
|
+
}
|
|
74
|
+
const mobileCount = (devices.Mobile || 0) + (devices.Tablet || 0);
|
|
75
|
+
return {
|
|
76
|
+
totalSessions: sessions.length,
|
|
77
|
+
activeSessions: sessions.filter((session) => session?.isActive && session?.isTrulyActive).length,
|
|
78
|
+
todayLogins,
|
|
79
|
+
weekLogins,
|
|
80
|
+
devices,
|
|
81
|
+
browsers,
|
|
82
|
+
operatingSystems,
|
|
83
|
+
loginHours,
|
|
84
|
+
peakHour: loginHours.indexOf(Math.max(...loginHours)),
|
|
85
|
+
uniqueUsers: uniqueUsers.size,
|
|
86
|
+
uniqueIPs: uniqueIPs.size,
|
|
87
|
+
loggedOut,
|
|
88
|
+
terminated,
|
|
89
|
+
mobileRatio: sessions.length > 0 ? Math.round(mobileCount / sessions.length * 100) : 0,
|
|
90
|
+
avgSessionDuration: durations.length > 0 ? Math.floor(durations.reduce((sum, duration) => sum + duration, 0) / durations.length) : 0
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
const Container = styled(Box)`
|
|
94
|
+
width: 100%;
|
|
95
|
+
min-width: 0;
|
|
96
|
+
`;
|
|
97
|
+
const StatsGrid = styled.div`
|
|
98
|
+
display: grid;
|
|
99
|
+
grid-template-columns: repeat(auto-fit, minmax(min(100%, 10rem), 1fr));
|
|
100
|
+
gap: 12px;
|
|
101
|
+
min-width: 0;
|
|
102
|
+
margin-bottom: 16px;
|
|
103
|
+
`;
|
|
104
|
+
const StatCard = styled(Box)`
|
|
105
|
+
background: ${(p) => p.theme.colors.neutral0};
|
|
106
|
+
border: 1px solid ${(p) => p.theme.colors.neutral150};
|
|
107
|
+
border-top: 3px solid ${(p) => p.theme.colors.primary600};
|
|
108
|
+
border-radius: 4px;
|
|
109
|
+
min-width: 0;
|
|
110
|
+
padding: 16px;
|
|
111
|
+
display: flex;
|
|
112
|
+
flex-direction: column;
|
|
113
|
+
align-items: flex-start;
|
|
114
|
+
gap: 4px;
|
|
115
|
+
|
|
116
|
+
&& > p {
|
|
117
|
+
max-width: none;
|
|
118
|
+
margin: 0;
|
|
119
|
+
line-height: 1.25;
|
|
120
|
+
}
|
|
121
|
+
|
|
122
|
+
&& > p + p {
|
|
123
|
+
margin-block-start: 0;
|
|
124
|
+
}
|
|
125
|
+
`;
|
|
126
|
+
const StatIcon = styled(Box)`
|
|
127
|
+
width: 36px;
|
|
128
|
+
height: 36px;
|
|
129
|
+
border-radius: 4px;
|
|
130
|
+
display: flex;
|
|
131
|
+
align-items: center;
|
|
132
|
+
justify-content: center;
|
|
133
|
+
background: ${(p) => p.theme.colors.primary100};
|
|
134
|
+
color: ${(p) => p.theme.colors.primary600};
|
|
135
|
+
margin-bottom: 8px;
|
|
136
|
+
|
|
137
|
+
svg {
|
|
138
|
+
width: 20px;
|
|
139
|
+
height: 20px;
|
|
140
|
+
}
|
|
141
|
+
`;
|
|
142
|
+
const ChartCard = styled(Box)`
|
|
143
|
+
background: ${(p) => p.theme.colors.neutral0};
|
|
144
|
+
border-radius: 4px;
|
|
145
|
+
border: 1px solid ${(p) => p.theme.colors.neutral150};
|
|
146
|
+
min-width: 0;
|
|
147
|
+
padding: 20px;
|
|
148
|
+
`;
|
|
149
|
+
const BarChart = styled.div`
|
|
150
|
+
display: flex;
|
|
151
|
+
flex-direction: column;
|
|
152
|
+
gap: 12px;
|
|
153
|
+
min-width: 0;
|
|
154
|
+
`;
|
|
155
|
+
const BarRow = styled.div`
|
|
156
|
+
display: flex;
|
|
157
|
+
align-items: center;
|
|
158
|
+
gap: 12px;
|
|
159
|
+
min-width: 0;
|
|
160
|
+
`;
|
|
161
|
+
const BarContainer = styled.div`
|
|
162
|
+
flex: 1;
|
|
163
|
+
min-width: 0;
|
|
164
|
+
height: 28px;
|
|
165
|
+
background: ${(p) => p.theme.colors.neutral100};
|
|
166
|
+
border-radius: 4px;
|
|
167
|
+
overflow: hidden;
|
|
168
|
+
position: relative;
|
|
169
|
+
`;
|
|
170
|
+
const BarFill = styled.div`
|
|
171
|
+
height: 100%;
|
|
172
|
+
width: ${(props) => `${Math.max(0, Math.min(100, props.$percentage || 0))}%`};
|
|
173
|
+
background: ${(p) => p.theme.colors.primary600};
|
|
174
|
+
border-radius: 4px;
|
|
175
|
+
`;
|
|
176
|
+
const LoadingOverlay = styled(Flex)`
|
|
177
|
+
min-height: 240px;
|
|
178
|
+
align-items: center;
|
|
179
|
+
justify-content: center;
|
|
180
|
+
`;
|
|
181
|
+
const AnalyticsPage = () => {
|
|
182
|
+
const { formatMessage } = useIntl();
|
|
183
|
+
const { get } = useFetchClient();
|
|
184
|
+
const t = (id, defaultMessage, values) => formatMessage({ id: getTranslation(id), defaultMessage }, values);
|
|
185
|
+
const [loading, setLoading] = useState(true);
|
|
186
|
+
const [analytics, setAnalytics] = useState(null);
|
|
187
|
+
const [loadError, setLoadError] = useState(false);
|
|
188
|
+
useEffect(() => {
|
|
189
|
+
fetchAnalytics();
|
|
190
|
+
}, []);
|
|
191
|
+
const fetchAnalytics = async () => {
|
|
192
|
+
setLoading(true);
|
|
193
|
+
setLoadError(false);
|
|
194
|
+
try {
|
|
195
|
+
const { data } = await get(`/${pluginId}/sessions`);
|
|
196
|
+
const sessions = data.data || [];
|
|
197
|
+
setAnalytics(computeSessionAnalytics(sessions));
|
|
198
|
+
} catch (err) {
|
|
199
|
+
setLoadError(true);
|
|
200
|
+
logSafeAdminError("analytics.load", err);
|
|
201
|
+
} finally {
|
|
202
|
+
setLoading(false);
|
|
203
|
+
}
|
|
204
|
+
};
|
|
205
|
+
if (loading) {
|
|
206
|
+
return /* @__PURE__ */ jsx(
|
|
207
|
+
PluginPageLayout,
|
|
208
|
+
{
|
|
209
|
+
headingId: "magic-sessionmanager-analytics-title",
|
|
210
|
+
title: t("analytics.title", "Session Analytics"),
|
|
211
|
+
subtitle: t("analytics.subtitle", "Session activity and device trends"),
|
|
212
|
+
children: /* @__PURE__ */ jsx(LoadingOverlay, { children: /* @__PURE__ */ jsx(Loader, { children: t("analytics.loading", "Loading analytics data...") }) })
|
|
213
|
+
}
|
|
214
|
+
);
|
|
215
|
+
}
|
|
216
|
+
if (loadError) {
|
|
217
|
+
return /* @__PURE__ */ jsx(
|
|
218
|
+
PluginPageLayout,
|
|
219
|
+
{
|
|
220
|
+
headingId: "magic-sessionmanager-analytics-title",
|
|
221
|
+
title: t("analytics.title", "Session Analytics"),
|
|
222
|
+
subtitle: t("analytics.subtitle", "Session activity and device trends"),
|
|
223
|
+
children: /* @__PURE__ */ jsx(
|
|
224
|
+
Alert,
|
|
225
|
+
{
|
|
226
|
+
variant: "danger",
|
|
227
|
+
title: t("analytics.error.title", "Analytics could not be loaded"),
|
|
228
|
+
closeLabel: t("common.close", "Close"),
|
|
229
|
+
action: /* @__PURE__ */ jsx(Button, { variant: "secondary", onClick: fetchAnalytics, children: t("common.retry", "Retry") }),
|
|
230
|
+
children: /* @__PURE__ */ jsx(ReadableText, { variant: "pi", textColor: "neutral700", tag: "span", children: t("analytics.error.description", "Try again. If the problem continues, check session API access and permissions.") })
|
|
231
|
+
}
|
|
232
|
+
)
|
|
233
|
+
}
|
|
234
|
+
);
|
|
235
|
+
}
|
|
236
|
+
const maxDevices = Math.max(...Object.values(analytics?.devices || {}), 1);
|
|
237
|
+
const maxBrowsers = Math.max(...Object.values(analytics?.browsers || {}), 1);
|
|
238
|
+
const hasSessions = Number(analytics?.totalSessions) > 0;
|
|
239
|
+
return /* @__PURE__ */ jsx(
|
|
240
|
+
PluginPageLayout,
|
|
241
|
+
{
|
|
242
|
+
headingId: "magic-sessionmanager-analytics-title",
|
|
243
|
+
title: t("analytics.title", "Session Analytics"),
|
|
244
|
+
subtitle: t("analytics.subtitle", "Session activity and device trends"),
|
|
245
|
+
children: /* @__PURE__ */ jsxs(Container, { children: [
|
|
246
|
+
/* @__PURE__ */ jsxs(StatsGrid, { children: [
|
|
247
|
+
/* @__PURE__ */ jsxs(StatCard, { padding: 4, background: "neutral0", children: [
|
|
248
|
+
/* @__PURE__ */ jsx(StatIcon, { "aria-hidden": "true", children: /* @__PURE__ */ jsx(ChartBubble, {}) }),
|
|
249
|
+
/* @__PURE__ */ jsx(Typography, { variant: "delta", fontWeight: "semiBold", tag: "p", children: analytics?.totalSessions || 0 }),
|
|
250
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", tag: "p", children: t("analytics.stats.total", "Total sessions") })
|
|
251
|
+
] }),
|
|
252
|
+
/* @__PURE__ */ jsxs(StatCard, { padding: 4, background: "neutral0", children: [
|
|
253
|
+
/* @__PURE__ */ jsx(StatIcon, { "aria-hidden": "true", children: /* @__PURE__ */ jsx(User, {}) }),
|
|
254
|
+
/* @__PURE__ */ jsx(Typography, { variant: "delta", fontWeight: "semiBold", tag: "p", children: analytics?.activeSessions || 0 }),
|
|
255
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", tag: "p", children: t("analytics.stats.active", "Online now") })
|
|
256
|
+
] }),
|
|
257
|
+
/* @__PURE__ */ jsxs(StatCard, { padding: 4, background: "neutral0", children: [
|
|
258
|
+
/* @__PURE__ */ jsx(StatIcon, { "aria-hidden": "true", children: /* @__PURE__ */ jsx(Clock, {}) }),
|
|
259
|
+
/* @__PURE__ */ jsx(Typography, { variant: "delta", fontWeight: "semiBold", tag: "p", children: analytics?.todayLogins || 0 }),
|
|
260
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", tag: "p", children: t("analytics.stats.today", "Logins today") })
|
|
261
|
+
] }),
|
|
262
|
+
/* @__PURE__ */ jsxs(StatCard, { padding: 4, background: "neutral0", children: [
|
|
263
|
+
/* @__PURE__ */ jsx(StatIcon, { "aria-hidden": "true", children: /* @__PURE__ */ jsx(Clock, {}) }),
|
|
264
|
+
/* @__PURE__ */ jsx(Typography, { variant: "delta", fontWeight: "semiBold", tag: "p", children: analytics?.weekLogins || 0 }),
|
|
265
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", tag: "p", children: t("analytics.stats.week", "Logins this week") })
|
|
266
|
+
] })
|
|
267
|
+
] }),
|
|
268
|
+
hasSessions ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
269
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 4, wrap: "wrap", style: { marginBottom: "28px" }, children: [
|
|
270
|
+
/* @__PURE__ */ jsx(Box, { style: { flex: "1 1 320px", minWidth: 0 }, children: /* @__PURE__ */ jsxs(ChartCard, { children: [
|
|
271
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", style: { marginBottom: 16 }, children: [
|
|
272
|
+
/* @__PURE__ */ jsx(Monitor, {}),
|
|
273
|
+
/* @__PURE__ */ jsx(Typography, { variant: "epsilon", fontWeight: "semiBold", tag: "h2", children: t("analytics.devices.title", "Devices") })
|
|
274
|
+
] }),
|
|
275
|
+
/* @__PURE__ */ jsx(BarChart, { children: analytics?.devices && Object.entries(analytics.devices).sort(([, a], [, b]) => b - a).map(([device, count]) => /* @__PURE__ */ jsxs(BarRow, { children: [
|
|
276
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral700", style: { flex: "0 0 96px", minWidth: 0, overflowWrap: "anywhere" }, children: device }),
|
|
277
|
+
/* @__PURE__ */ jsxs(BarContainer, { children: [
|
|
278
|
+
/* @__PURE__ */ jsx(
|
|
279
|
+
BarFill,
|
|
280
|
+
{
|
|
281
|
+
$percentage: count / maxDevices * 100
|
|
282
|
+
}
|
|
283
|
+
),
|
|
284
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "semiBold", textColor: "neutral800", style: { position: "absolute", top: "50%", right: 8, transform: "translateY(-50%)", fontVariantNumeric: "tabular-nums" }, children: count })
|
|
285
|
+
] })
|
|
286
|
+
] }, device)) })
|
|
287
|
+
] }) }),
|
|
288
|
+
/* @__PURE__ */ jsx(Box, { style: { flex: "1 1 320px", minWidth: 0 }, children: /* @__PURE__ */ jsxs(ChartCard, { children: [
|
|
289
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", style: { marginBottom: 16 }, children: [
|
|
290
|
+
/* @__PURE__ */ jsx(Monitor, {}),
|
|
291
|
+
/* @__PURE__ */ jsx(Typography, { variant: "epsilon", fontWeight: "semiBold", tag: "h2", children: t("analytics.browsers.title", "Browsers") })
|
|
292
|
+
] }),
|
|
293
|
+
/* @__PURE__ */ jsx(BarChart, { children: analytics?.browsers && Object.entries(analytics.browsers).sort(([, a], [, b]) => b - a).map(([browser, count]) => /* @__PURE__ */ jsxs(BarRow, { children: [
|
|
294
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral700", style: { flex: "0 0 96px", minWidth: 0, overflowWrap: "anywhere" }, children: browser }),
|
|
295
|
+
/* @__PURE__ */ jsxs(BarContainer, { children: [
|
|
296
|
+
/* @__PURE__ */ jsx(
|
|
297
|
+
BarFill,
|
|
298
|
+
{
|
|
299
|
+
$percentage: count / maxBrowsers * 100
|
|
300
|
+
}
|
|
301
|
+
),
|
|
302
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", fontWeight: "semiBold", textColor: "neutral800", style: { position: "absolute", top: "50%", right: 8, transform: "translateY(-50%)", fontVariantNumeric: "tabular-nums" }, children: count })
|
|
303
|
+
] })
|
|
304
|
+
] }, browser)) })
|
|
305
|
+
] }) })
|
|
306
|
+
] }),
|
|
307
|
+
/* @__PURE__ */ jsxs(ChartCard, { children: [
|
|
308
|
+
/* @__PURE__ */ jsxs(Flex, { alignItems: "center", justifyContent: "space-between", children: [
|
|
309
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", children: [
|
|
310
|
+
/* @__PURE__ */ jsx(Clock, {}),
|
|
311
|
+
/* @__PURE__ */ jsx(Typography, { variant: "epsilon", fontWeight: "semiBold", tag: "h2", children: t("analytics.duration.title", "Average session duration") })
|
|
312
|
+
] }),
|
|
313
|
+
/* @__PURE__ */ jsx(Badge, { variant: "primary", size: "M", children: t("analytics.duration.minutes", "{count} min", { count: analytics?.avgSessionDuration || 0 }) })
|
|
314
|
+
] }),
|
|
315
|
+
analytics?.avgSessionDuration > 0 && /* @__PURE__ */ jsx(Box, { marginTop: 4, padding: 4, background: "neutral100", hasRadius: true, children: /* @__PURE__ */ jsx(ReadableText, { variant: "pi", textColor: "neutral700", tag: "p", children: t("analytics.duration.description", "Average time between login and last activity. Higher values can indicate idle or abandoned sessions.") }) })
|
|
316
|
+
] })
|
|
317
|
+
] }) : /* @__PURE__ */ jsx(
|
|
318
|
+
EmptyStateLayout,
|
|
319
|
+
{
|
|
320
|
+
icon: /* @__PURE__ */ jsx(ChartBubble, { "aria-hidden": "true" }),
|
|
321
|
+
content: t("analytics.empty", "Session analytics will appear here after end users sign in.")
|
|
322
|
+
}
|
|
323
|
+
)
|
|
324
|
+
] })
|
|
325
|
+
}
|
|
326
|
+
);
|
|
327
|
+
};
|
|
328
|
+
export {
|
|
329
|
+
AnalyticsPage as default
|
|
330
|
+
};
|