strapi-plugin-magic-sessionmanager 4.16.1 → 4.17.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 +41 -0
- package/README.md +49 -15
- package/dist/admin/{Analytics-FcRt0X62.mjs → Analytics-B-p2Q7th.mjs} +1 -1
- package/dist/admin/{Analytics-CMR62DiD.js → Analytics-BTIByTUY.js} +1 -1
- package/dist/admin/{App-CmytGbze.js → App-CH6635JB.js} +33 -170
- package/dist/admin/{App-DBieSWB0.mjs → App-DmesuM2g.mjs} +3 -140
- package/dist/admin/{OnlineUsersWidget-zP9Hl_it.mjs → OnlineUsersWidget-CuqeQ0tb.mjs} +1 -1
- package/dist/admin/{OnlineUsersWidget-Lzx9XB74.js → OnlineUsersWidget-TlOp8nie.js} +1 -1
- package/dist/admin/{Settings-CZOPusQK.mjs → Settings-C4IgGBjQ.mjs} +1163 -56
- package/dist/admin/{Settings-1v--SXC0.js → Settings-DtP_H4JS.js} +1167 -60
- package/dist/admin/dashboardModel-0ROcWcB1.mjs +189 -0
- package/dist/admin/dashboardModel-BSJhZdXI.js +188 -0
- package/dist/admin/{de-D3TSA066.mjs → de-BoahnYIP.mjs} +110 -9
- package/dist/admin/{de-y_9mdVT7.js → de-C_ooq6EF.js} +110 -9
- package/dist/admin/{en-CIQB8nfI.js → en-CuUVE2K0.js} +110 -9
- package/dist/admin/{en-B60I97bK.mjs → en-DHme92L-.mjs} +110 -9
- package/dist/admin/{es-CJEL_iGC.mjs → es-CjcTgS9Z.mjs} +110 -9
- package/dist/admin/{es-DHhHzlRY.js → es-lbDNXcQi.js} +110 -9
- package/dist/admin/{fr-BfBK_iuV.mjs → fr-BPwnrSaC.mjs} +110 -9
- package/dist/admin/{fr-D86FTt1w.js → fr-RtypjgGp.js} +110 -9
- package/dist/admin/{index-tt61o2VH.mjs → index-B102RF2H.mjs} +40 -38
- package/dist/admin/{index-CSJJn4qy.js → index-w0OuPYFm.js} +12 -10
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/{pt-BE-FT-L8.js → pt-BMCAKRQ4.js} +110 -9
- package/dist/admin/{pt-C3PSvC7z.mjs → pt-D5FHSP2y.mjs} +110 -9
- package/dist/server/index.js +1519 -78
- package/dist/server/index.mjs +1519 -78
- package/package.json +1 -1
- package/dist/admin/riskData-BVs9GpgD.js +0 -26
- package/dist/admin/riskData-CI1gm2yI.mjs +0 -27
|
@@ -1,14 +1,14 @@
|
|
|
1
1
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
2
2
|
import { useFetchClient, useNotification, useClipboard, useRBAC, useQueryParams, Pagination, Page } from "@strapi/strapi/admin";
|
|
3
3
|
import { NavLink, Link as Link$1, Routes, Route } from "react-router-dom";
|
|
4
|
-
import { useMemo, useState, useEffect, useRef,
|
|
4
|
+
import { useMemo, useState, useEffect, useRef, useId, useCallback, useLayoutEffect } from "react";
|
|
5
5
|
import { useIntl } from "react-intl";
|
|
6
6
|
import { Typography, Flex, Loader, Button, Modal, Accordion, Box, IconButton, Link, SimpleMenu, MenuItem, Grid, Table, Thead, Tr, Th, VisuallyHidden, Tbody, Td, Tooltip, SearchForm, Searchbar, TextButton, SingleSelect, SingleSelectOption, EmptyStateLayout, LinkButton, Badge, Tabs, Dialog } from "@strapi/design-system";
|
|
7
7
|
import { Earth, Duplicate, Cross, Eye, Trash, More, CaretDown, Download, ArrowClockwise, Check, Clock, User, ChartBubble, Cog, SignOut } from "@strapi/icons";
|
|
8
8
|
import { EmptyDocuments } from "@strapi/icons/symbols";
|
|
9
9
|
import styled, { useTheme } from "styled-components";
|
|
10
|
-
import { g as getSessionEndReason, a as getEndReasonPresentation, b as getTranslation, p as presentText,
|
|
11
|
-
import { i as isRiskSource, R as RISK_SETTINGS_PATH } from "./
|
|
10
|
+
import { g as getSessionEndReason, a as getEndReasonPresentation, b as getTranslation, p as presentText, u as useSessionFormatters, c as getSessionStatus, d as getDevicePresentation, i as isNativeOnlySession, e as getSessionEndReasonPresentation, D as DeviceIcon, S as StatusBadge, P as PropertyList, C as ConfirmAction, t as toValidDate, f as pluginId, l as logSafeAdminError, h as PersistentAlert, R as ReadableText, j as pluginPermissions, M as MissingValue, V as ValueOrMissing, k as SESSION_STATES, m as SESSION_STATUS_PRESENTATION, n as isCancelledRequest, o as SESSION_FILTER_OPTIONS, E as END_REASON_FILTER_OPTIONS, q as PageShell, r as StatGrid, s as StatCard, v as restoreDialogFocus, w as requireSessionList, x as getBadgeColors, T as TargetLink$1 } from "./index-B102RF2H.mjs";
|
|
11
|
+
import { i as isRiskSource, g as getSessionUserLabels, a as getUserEditPath, R as RISK_SETTINGS_PATH, b as RowActions, s as shouldIsolateActionKey, c as shouldRedispatchEscape, D as DASHBOARD_COMPACT_TABLE_COLUMNS, d as DASHBOARD_TABLE_COLUMNS, r as readDisclosureOpen, e as getBrowserStorage, w as writeDisclosureOpen, u as useElementWidth, p as parseDashboardQuery, A as AUTO_REFRESH_INTERVAL_MS, f as pickFocusSessionId, h as encodeSearchQuery, j as shouldUseCompactTable, P as PAGE_SIZE_OPTIONS, k as DEFAULT_PAGE_SIZE, l as getExportDeviceInfo, m as getErrorStatus, n as hasActiveFilters } from "./dashboardModel-0ROcWcB1.mjs";
|
|
12
12
|
import { S as SectionCard } from "./SectionCard-D51bv4Hi.mjs";
|
|
13
13
|
const EndReason = ({ session, reason, variant = "omega", textColor = "neutral800" }) => {
|
|
14
14
|
const { formatMessage } = useIntl();
|
|
@@ -21,7 +21,6 @@ const EndReason = ({ session, reason, variant = "omega", textColor = "neutral800
|
|
|
21
21
|
});
|
|
22
22
|
return /* @__PURE__ */ jsx(Typography, { variant, textColor, "data-end-reason": presentation.reason, children: translate(presentation) });
|
|
23
23
|
};
|
|
24
|
-
const RowActions = ({ children, ...props }) => /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", alignItems: "center", gap: 1, "data-row-actions": "", ...props, children });
|
|
25
24
|
const MAX_EXPORT_ROWS = 5e4;
|
|
26
25
|
const EXPORT_BATCH_SIZE = 1e3;
|
|
27
26
|
const EMPTY_SESSION_STATS = Object.freeze({
|
|
@@ -256,23 +255,6 @@ function useBreakpoint() {
|
|
|
256
255
|
isBelowLarge: isBelowBreakpoint(breakpoint, "large")
|
|
257
256
|
};
|
|
258
257
|
}
|
|
259
|
-
function useElementWidth() {
|
|
260
|
-
const [width, setWidth] = useState(0);
|
|
261
|
-
const observerRef = useRef(null);
|
|
262
|
-
const ref = useCallback((node) => {
|
|
263
|
-
observerRef.current?.disconnect();
|
|
264
|
-
observerRef.current = null;
|
|
265
|
-
if (!node || typeof ResizeObserver === "undefined") return;
|
|
266
|
-
const observer = new ResizeObserver((entries) => {
|
|
267
|
-
const next = Math.round(entries[0]?.contentRect?.width || 0);
|
|
268
|
-
setWidth((previous) => previous === next ? previous : next);
|
|
269
|
-
});
|
|
270
|
-
observer.observe(node);
|
|
271
|
-
observerRef.current = observer;
|
|
272
|
-
}, []);
|
|
273
|
-
useEffect(() => () => observerRef.current?.disconnect(), []);
|
|
274
|
-
return [ref, width];
|
|
275
|
-
}
|
|
276
258
|
const RISK_LEVEL_MESSAGES = Object.freeze({
|
|
277
259
|
none: Object.freeze({ messageId: "modal.security.risk.none", defaultMessage: "None" }),
|
|
278
260
|
low: Object.freeze({ messageId: "modal.security.risk.low", defaultMessage: "Low" }),
|
|
@@ -349,125 +331,6 @@ function interpretLookupResult(payload) {
|
|
|
349
331
|
const geo = normalizeGeoData(data);
|
|
350
332
|
return geo ? { status: "ok", geo } : { status: "failed", geo: null };
|
|
351
333
|
}
|
|
352
|
-
const PAGE_SIZE_OPTIONS = Object.freeze(["10", "25", "50", "100"]);
|
|
353
|
-
const DEFAULT_PAGE_SIZE = "25";
|
|
354
|
-
const DASHBOARD_TABLE_COLUMNS = 7;
|
|
355
|
-
const DASHBOARD_COMPACT_TABLE_COLUMNS = 5;
|
|
356
|
-
const AUTO_REFRESH_INTERVAL_MS = 10 * 60 * 1e3;
|
|
357
|
-
const HOW_IT_WORKS_STORAGE_KEY = "magic-sessionmanager.dashboard.howSessionsWork";
|
|
358
|
-
const USER_EDIT_PATH = "/content-manager/collection-types/plugin::users-permissions.user/";
|
|
359
|
-
const readQueryText = (value) => {
|
|
360
|
-
if (typeof value !== "string") return "";
|
|
361
|
-
try {
|
|
362
|
-
return decodeURIComponent(value).trim();
|
|
363
|
-
} catch {
|
|
364
|
-
return value.trim();
|
|
365
|
-
}
|
|
366
|
-
};
|
|
367
|
-
function parseDashboardQuery(query = {}) {
|
|
368
|
-
const source = query || {};
|
|
369
|
-
const page = Number.parseInt(String(source.page ?? "1"), 10);
|
|
370
|
-
const pageSize = PAGE_SIZE_OPTIONS.includes(String(source.pageSize)) ? String(source.pageSize) : DEFAULT_PAGE_SIZE;
|
|
371
|
-
const status = isSessionFilter(source.status) ? (
|
|
372
|
-
/** @type {string} */
|
|
373
|
-
source.status
|
|
374
|
-
) : DEFAULT_SESSION_FILTER;
|
|
375
|
-
const reason = status === "ended" && isEndReasonFilter(source.reason) ? (
|
|
376
|
-
/** @type {string} */
|
|
377
|
-
source.reason
|
|
378
|
-
) : DEFAULT_END_REASON_FILTER;
|
|
379
|
-
const search = readQueryText(source.search) || readQueryText(source._q);
|
|
380
|
-
return { page: Number.isFinite(page) && page >= 1 ? page : 1, pageSize, status, reason, search };
|
|
381
|
-
}
|
|
382
|
-
function encodeSearchQuery(value) {
|
|
383
|
-
const text = typeof value === "string" ? value.trim() : "";
|
|
384
|
-
return text ? encodeURIComponent(text) : void 0;
|
|
385
|
-
}
|
|
386
|
-
function hasActiveFilters(state) {
|
|
387
|
-
if (!state) return false;
|
|
388
|
-
return state.status !== DEFAULT_SESSION_FILTER || Boolean(state.reason) && state.reason !== DEFAULT_END_REASON_FILTER || Boolean(state.search);
|
|
389
|
-
}
|
|
390
|
-
function getSessionUserLabels(session) {
|
|
391
|
-
const username = presentText(session?.user?.username);
|
|
392
|
-
const email = presentText(session?.user?.email);
|
|
393
|
-
const primary = username || email;
|
|
394
|
-
return {
|
|
395
|
-
primary,
|
|
396
|
-
secondary: username && email ? email : "",
|
|
397
|
-
accessible: primary || presentText(session?.id)
|
|
398
|
-
};
|
|
399
|
-
}
|
|
400
|
-
function getUserEditPath(session) {
|
|
401
|
-
const documentId = presentText(session?.user?.documentId);
|
|
402
|
-
return documentId ? `${USER_EDIT_PATH}${encodeURIComponent(documentId)}` : null;
|
|
403
|
-
}
|
|
404
|
-
function getExportDeviceInfo(session, unavailableValue = "") {
|
|
405
|
-
const device = getDevicePresentation(session);
|
|
406
|
-
return {
|
|
407
|
-
device: device.deviceType || unavailableValue,
|
|
408
|
-
browser: device.browser || unavailableValue,
|
|
409
|
-
browserVersion: device.browserVersion || "",
|
|
410
|
-
os: device.os || unavailableValue
|
|
411
|
-
};
|
|
412
|
-
}
|
|
413
|
-
function readDisclosureOpen(storage) {
|
|
414
|
-
try {
|
|
415
|
-
return storage?.getItem(HOW_IT_WORKS_STORAGE_KEY) === "open";
|
|
416
|
-
} catch {
|
|
417
|
-
return false;
|
|
418
|
-
}
|
|
419
|
-
}
|
|
420
|
-
function writeDisclosureOpen(storage, open) {
|
|
421
|
-
try {
|
|
422
|
-
storage?.setItem(HOW_IT_WORKS_STORAGE_KEY, open ? "open" : "closed");
|
|
423
|
-
} catch {
|
|
424
|
-
}
|
|
425
|
-
}
|
|
426
|
-
function getBrowserStorage() {
|
|
427
|
-
try {
|
|
428
|
-
return typeof window !== "undefined" ? window.localStorage : null;
|
|
429
|
-
} catch {
|
|
430
|
-
return null;
|
|
431
|
-
}
|
|
432
|
-
}
|
|
433
|
-
function shouldIsolateActionKey(key, fromInsideGroup) {
|
|
434
|
-
if (!fromInsideGroup) return true;
|
|
435
|
-
return key === "Enter" || key === " " || key === "Spacebar";
|
|
436
|
-
}
|
|
437
|
-
const FULL_TABLE_MIN_WIDTH = 1200;
|
|
438
|
-
function shouldUseCompactTable(listWidth, isBelowLarge) {
|
|
439
|
-
if (isBelowLarge) return true;
|
|
440
|
-
if (!Number.isFinite(listWidth) || listWidth <= 0) return false;
|
|
441
|
-
return listWidth < FULL_TABLE_MIN_WIDTH;
|
|
442
|
-
}
|
|
443
|
-
function shouldRedispatchEscape(key, fromInsideGroup) {
|
|
444
|
-
return !fromInsideGroup && key === "Escape";
|
|
445
|
-
}
|
|
446
|
-
function pickFocusSessionId(previousIds, currentIds, sessionId) {
|
|
447
|
-
const current = Array.isArray(currentIds) ? currentIds.map(String) : [];
|
|
448
|
-
if (current.length === 0) return null;
|
|
449
|
-
const target = String(sessionId);
|
|
450
|
-
if (current.includes(target)) return target;
|
|
451
|
-
const previous = Array.isArray(previousIds) ? previousIds.map(String) : [];
|
|
452
|
-
const index = previous.indexOf(target);
|
|
453
|
-
if (index >= 0) {
|
|
454
|
-
for (let next = index + 1; next < previous.length; next += 1) {
|
|
455
|
-
if (current.includes(previous[next])) return previous[next];
|
|
456
|
-
}
|
|
457
|
-
for (let before = index - 1; before >= 0; before -= 1) {
|
|
458
|
-
if (current.includes(previous[before])) return previous[before];
|
|
459
|
-
}
|
|
460
|
-
}
|
|
461
|
-
return current[0];
|
|
462
|
-
}
|
|
463
|
-
function getErrorStatus(error) {
|
|
464
|
-
const err = (
|
|
465
|
-
/** @type {any} */
|
|
466
|
-
error
|
|
467
|
-
);
|
|
468
|
-
const status = err?.status ?? err?.response?.status;
|
|
469
|
-
return typeof status === "number" ? status : null;
|
|
470
|
-
}
|
|
471
334
|
const TargetLink = styled(Link)`
|
|
472
335
|
min-height: 3.2rem;
|
|
473
336
|
display: inline-flex;
|
|
@@ -6,7 +6,7 @@ import { Flex, Loader, Button, Box, Typography } from "@strapi/design-system";
|
|
|
6
6
|
import { User, Lightning, Clock, Lock, WarningCircle } from "@strapi/icons";
|
|
7
7
|
import * as StrapiAdmin from "@strapi/strapi/admin";
|
|
8
8
|
import { useFetchClient } from "@strapi/strapi/admin";
|
|
9
|
-
import {
|
|
9
|
+
import { l as logSafeAdminError, n as isCancelledRequest, b as getTranslation, R as ReadableText, M as MissingValue } from "./index-B102RF2H.mjs";
|
|
10
10
|
function normalizeUserCounts(response) {
|
|
11
11
|
const totalUsers = response?.data?.totalUsers;
|
|
12
12
|
const blockedUsers = response?.data?.blockedUsers;
|
|
@@ -7,7 +7,7 @@ const styled = require("styled-components");
|
|
|
7
7
|
const designSystem = require("@strapi/design-system");
|
|
8
8
|
const icons = require("@strapi/icons");
|
|
9
9
|
const StrapiAdmin = require("@strapi/strapi/admin");
|
|
10
|
-
const index = require("./index-
|
|
10
|
+
const index = require("./index-w0OuPYFm.js");
|
|
11
11
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
12
12
|
function _interopNamespace(e) {
|
|
13
13
|
if (e && e.__esModule) return e;
|