strapi-plugin-magic-sessionmanager 4.16.0 → 4.16.1
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 +38 -0
- package/README.md +42 -28
- package/dist/admin/{Analytics-me4qzS0I.js → Analytics-CMR62DiD.js} +1 -1
- package/dist/admin/{Analytics-D4gsVwL0.mjs → Analytics-FcRt0X62.mjs} +1 -1
- package/dist/admin/{App-BTG-2Q26.js → App-CmytGbze.js} +80 -15
- package/dist/admin/{App-BJwtFWxl.mjs → App-DBieSWB0.mjs} +80 -15
- package/dist/admin/{OnlineUsersWidget-DYS3Vy1Q.js → OnlineUsersWidget-Lzx9XB74.js} +1 -1
- package/dist/admin/{OnlineUsersWidget-Yd283YDy.mjs → OnlineUsersWidget-zP9Hl_it.mjs} +1 -1
- package/dist/admin/{Settings-TPZ9_75s.js → Settings-1v--SXC0.js} +185 -54
- package/dist/admin/{Settings-DIlvfdjZ.mjs → Settings-CZOPusQK.mjs} +185 -54
- package/dist/admin/{de-DB9ldYwN.mjs → de-D3TSA066.mjs} +17 -3
- package/dist/admin/{de-BuMw1gBJ.js → de-y_9mdVT7.js} +17 -3
- package/dist/admin/{en-BbLMPQB3.mjs → en-B60I97bK.mjs} +17 -3
- package/dist/admin/{en-BqGhOJDy.js → en-CIQB8nfI.js} +17 -3
- package/dist/admin/{es-C5iaiE9G.mjs → es-CJEL_iGC.mjs} +17 -3
- package/dist/admin/{es-BaIeckl9.js → es-DHhHzlRY.js} +17 -3
- package/dist/admin/{fr-BEvBUCwI.mjs → fr-BfBK_iuV.mjs} +17 -3
- package/dist/admin/{fr-D1YKyTex.js → fr-D86FTt1w.js} +17 -3
- package/dist/admin/{index-CgZiLcJ1.js → index-CSJJn4qy.js} +15 -10
- package/dist/admin/{index-DUESEUaO.mjs → index-tt61o2VH.mjs} +15 -10
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +1 -1
- package/dist/admin/{pt-DtnW-s0V.js → pt-BE-FT-L8.js} +17 -3
- package/dist/admin/{pt-DeDih9cR.mjs → pt-C3PSvC7z.mjs} +17 -3
- package/dist/server/index.js +2643 -1800
- package/dist/server/index.mjs +2643 -1800
- package/package.json +1 -1
|
@@ -7,7 +7,7 @@ import { Typography, Flex, Loader, Button, Modal, Accordion, Box, IconButton, Li
|
|
|
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, i as isSessionFilter, D as DEFAULT_SESSION_FILTER, c as isEndReasonFilter, d as DEFAULT_END_REASON_FILTER, e as getDevicePresentation, u as useSessionFormatters, f as getSessionStatus, h as isNativeOnlySession, j as getSessionEndReasonPresentation, k as DeviceIcon, S as StatusBadge, P as PropertyList, C as ConfirmAction, t as toValidDate, l as pluginId, m as logSafeAdminError, n as PersistentAlert, R as ReadableText, o as pluginPermissions, M as MissingValue, V as ValueOrMissing, q as SESSION_STATES, r as SESSION_STATUS_PRESENTATION, s as isCancelledRequest, v as SESSION_FILTER_OPTIONS, E as END_REASON_FILTER_OPTIONS, w as PageShell, x as StatGrid, y as StatCard, z as restoreDialogFocus, A as requireSessionList, B as getBadgeColors, T as TargetLink$1 } from "./index-
|
|
10
|
+
import { g as getSessionEndReason, a as getEndReasonPresentation, b as getTranslation, p as presentText, i as isSessionFilter, D as DEFAULT_SESSION_FILTER, c as isEndReasonFilter, d as DEFAULT_END_REASON_FILTER, e as getDevicePresentation, u as useSessionFormatters, f as getSessionStatus, h as isNativeOnlySession, j as getSessionEndReasonPresentation, k as DeviceIcon, S as StatusBadge, P as PropertyList, C as ConfirmAction, t as toValidDate, l as pluginId, m as logSafeAdminError, n as PersistentAlert, R as ReadableText, o as pluginPermissions, M as MissingValue, V as ValueOrMissing, q as SESSION_STATES, r as SESSION_STATUS_PRESENTATION, s as isCancelledRequest, v as SESSION_FILTER_OPTIONS, E as END_REASON_FILTER_OPTIONS, w as PageShell, x as StatGrid, y as StatCard, z as restoreDialogFocus, A as requireSessionList, B as getBadgeColors, T as TargetLink$1 } from "./index-tt61o2VH.mjs";
|
|
11
11
|
import { i as isRiskSource, R as RISK_SETTINGS_PATH } from "./riskData-CI1gm2yI.mjs";
|
|
12
12
|
import { S as SectionCard } from "./SectionCard-D51bv4Hi.mjs";
|
|
13
13
|
const EndReason = ({ session, reason, variant = "omega", textColor = "neutral800" }) => {
|
|
@@ -107,7 +107,7 @@ const CSV_HEADERS = Object.freeze([
|
|
|
107
107
|
"Minutes Idle",
|
|
108
108
|
"End Reason"
|
|
109
109
|
]);
|
|
110
|
-
const FORMULA_START = /^[=+\-@\t\r]/;
|
|
110
|
+
const FORMULA_START = /^[\s\u00ad\u200b-\u200f\u2060-\u2064\ufeff]*[=+\-@\uff1d\uff0b\uff0d\uff20\t\r\n]/;
|
|
111
111
|
const escapeCsvValue = (value) => {
|
|
112
112
|
const text = String(value ?? "");
|
|
113
113
|
const safe = typeof value === "string" && FORMULA_START.test(text) ? `'${text}` : text;
|
|
@@ -2557,6 +2557,25 @@ function getSignOutErrorMessage(error) {
|
|
|
2557
2557
|
defaultMessage: "The admin could not be signed out. Try again."
|
|
2558
2558
|
};
|
|
2559
2559
|
}
|
|
2560
|
+
function withIdentityPlaceholders(admin, placeholderName, identity) {
|
|
2561
|
+
if (!admin || typeof admin !== "object") return admin;
|
|
2562
|
+
const hidden = !admin.self && !admin.name;
|
|
2563
|
+
return {
|
|
2564
|
+
...admin,
|
|
2565
|
+
name: admin.name || placeholderName(admin.id),
|
|
2566
|
+
identityHidden: hidden,
|
|
2567
|
+
rolesHidden: hidden && identity?.roles === false
|
|
2568
|
+
};
|
|
2569
|
+
}
|
|
2570
|
+
function withEventAdminNames(row, placeholderName) {
|
|
2571
|
+
if (!row || typeof row !== "object") return row;
|
|
2572
|
+
const fill = (admin) => admin && typeof admin === "object" && !admin.name ? { ...admin, name: placeholderName(admin.id), identityHidden: true } : admin;
|
|
2573
|
+
return {
|
|
2574
|
+
...row,
|
|
2575
|
+
...row.admin !== void 0 ? { admin: fill(row.admin) } : {},
|
|
2576
|
+
...row.actor !== void 0 ? { actor: fill(row.actor) } : {}
|
|
2577
|
+
};
|
|
2578
|
+
}
|
|
2560
2579
|
const HIGHLIGHT_BADGE = { backgroundColor: "primary100", textColor: "neutral800" };
|
|
2561
2580
|
const keepActionKeys = (event) => {
|
|
2562
2581
|
if (shouldIsolateActionKey(event.key, true)) event.stopPropagation();
|
|
@@ -2584,13 +2603,13 @@ const AdminIdentity = ({ admin }) => {
|
|
|
2584
2603
|
),
|
|
2585
2604
|
admin.self ? /* @__PURE__ */ jsx(Badge, { ...HIGHLIGHT_BADGE, shrink: 0, children: t("adminPanel.you", "You") }) : null
|
|
2586
2605
|
] }),
|
|
2587
|
-
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", ellipsis: true, title: admin.email, children: admin.email })
|
|
2606
|
+
admin.identityHidden ? /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: t("adminPanel.identity.emailHidden", "Email hidden (needs “Read” on Users)") }) : /* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", ellipsis: true, title: admin.email, children: admin.email })
|
|
2588
2607
|
] });
|
|
2589
2608
|
};
|
|
2590
2609
|
const AdminRoles = ({ admin }) => {
|
|
2591
2610
|
const t = useT$3();
|
|
2592
2611
|
const names = (admin.roles || []).map((role) => role.name).filter(Boolean);
|
|
2593
|
-
const text = names.length ? names.join(", ") : t("adminPanel.roles.none", "No role");
|
|
2612
|
+
const text = admin.rolesHidden ? t("adminPanel.roles.hidden", "Hidden (needs “Read” on Roles)") : names.length ? names.join(", ") : t("adminPanel.roles.none", "No role");
|
|
2594
2613
|
return /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", ellipsis: true, title: text, children: text });
|
|
2595
2614
|
};
|
|
2596
2615
|
const AdminStatus = ({ admin }) => {
|
|
@@ -3014,6 +3033,15 @@ const SignInEventRow = ({ row, showAdmin = false, onOpenAdmin }) => {
|
|
|
3014
3033
|
}
|
|
3015
3034
|
if (row.actor)
|
|
3016
3035
|
facts.push(t("adminPanel.activity.byAdmin", "by {name}", { name: row.actor.name }));
|
|
3036
|
+
if (Number.isInteger(row.attempts) && row.attempts > 1) {
|
|
3037
|
+
facts.push(
|
|
3038
|
+
t(
|
|
3039
|
+
"adminPanel.activity.attempts",
|
|
3040
|
+
"{count, plural, one {# attempt} other {# attempts}} within 5 minutes",
|
|
3041
|
+
{ count: row.attempts }
|
|
3042
|
+
)
|
|
3043
|
+
);
|
|
3044
|
+
}
|
|
3017
3045
|
return /* @__PURE__ */ jsxs(EventItem, { id: row.id, kind: event.key, children: [
|
|
3018
3046
|
/* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", alignItems: "center", justifyContent: "space-between", children: [
|
|
3019
3047
|
/* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", alignItems: "center", minWidth: 0, children: [
|
|
@@ -3063,6 +3091,22 @@ const ActivityEventRow = ({ row, showAdmin = false, onOpenAdmin }) => {
|
|
|
3063
3091
|
};
|
|
3064
3092
|
function useEventList({ path, params, logKey }) {
|
|
3065
3093
|
const { get } = useFetchClient();
|
|
3094
|
+
const { formatMessage } = useIntl();
|
|
3095
|
+
const fillNames = useCallback(
|
|
3096
|
+
(list) => list.map(
|
|
3097
|
+
(row) => withEventAdminNames(
|
|
3098
|
+
row,
|
|
3099
|
+
(id) => formatMessage(
|
|
3100
|
+
{
|
|
3101
|
+
id: getTranslation("adminPanel.identity.placeholder"),
|
|
3102
|
+
defaultMessage: "Admin #{id}"
|
|
3103
|
+
},
|
|
3104
|
+
{ id }
|
|
3105
|
+
)
|
|
3106
|
+
)
|
|
3107
|
+
),
|
|
3108
|
+
[formatMessage]
|
|
3109
|
+
);
|
|
3066
3110
|
const [rows, setRows] = useState([]);
|
|
3067
3111
|
const [meta, setMeta] = useState(null);
|
|
3068
3112
|
const [page, setPage] = useState(1);
|
|
@@ -3081,7 +3125,7 @@ function useEventList({ path, params, logKey }) {
|
|
|
3081
3125
|
const response = await get(path, { params: { ...JSON.parse(key), page: nextPage } });
|
|
3082
3126
|
if (requestId !== requestRef.current) return;
|
|
3083
3127
|
const body = response?.data || {};
|
|
3084
|
-
const data = Array.isArray(body.data) ? body.data : [];
|
|
3128
|
+
const data = fillNames(Array.isArray(body.data) ? body.data : []);
|
|
3085
3129
|
setRows((current) => nextPage === 1 ? data : [...current, ...data]);
|
|
3086
3130
|
setMeta(body.meta || null);
|
|
3087
3131
|
setPage(nextPage);
|
|
@@ -3097,7 +3141,7 @@ function useEventList({ path, params, logKey }) {
|
|
|
3097
3141
|
}
|
|
3098
3142
|
}
|
|
3099
3143
|
},
|
|
3100
|
-
[get, path, key, logKey]
|
|
3144
|
+
[get, path, key, logKey, fillNames]
|
|
3101
3145
|
);
|
|
3102
3146
|
useEffect(() => {
|
|
3103
3147
|
load(1);
|
|
@@ -3116,14 +3160,14 @@ function useEventList({ path, params, logKey }) {
|
|
|
3116
3160
|
});
|
|
3117
3161
|
const body = response?.data || {};
|
|
3118
3162
|
if (!Array.isArray(body.data)) throw new Error("Invalid export response");
|
|
3119
|
-
all.push(...body.data);
|
|
3163
|
+
all.push(...fillNames(body.data));
|
|
3120
3164
|
cursor = typeof body.meta?.nextCursor === "string" ? body.meta.nextCursor : null;
|
|
3121
3165
|
} while (cursor && all.length < MAX_EVENT_EXPORT_ROWS);
|
|
3122
3166
|
return {
|
|
3123
3167
|
rows: all.slice(0, MAX_EVENT_EXPORT_ROWS),
|
|
3124
3168
|
capped: all.length > MAX_EVENT_EXPORT_ROWS || Boolean(cursor)
|
|
3125
3169
|
};
|
|
3126
|
-
}, [get, path, key]);
|
|
3170
|
+
}, [get, path, key, fillNames]);
|
|
3127
3171
|
return {
|
|
3128
3172
|
rows,
|
|
3129
3173
|
meta,
|
|
@@ -3581,8 +3625,8 @@ const AdminSessionsModal = ({
|
|
|
3581
3625
|
{
|
|
3582
3626
|
id: "email",
|
|
3583
3627
|
label: t("adminPanel.dialog.email", "Email"),
|
|
3584
|
-
value: admin.email,
|
|
3585
|
-
kind: "email"
|
|
3628
|
+
value: admin.identityHidden ? t("adminPanel.identity.emailHidden", "Email hidden (needs “Read” on Users)") : admin.email,
|
|
3629
|
+
kind: admin.identityHidden ? void 0 : "email"
|
|
3586
3630
|
},
|
|
3587
3631
|
{
|
|
3588
3632
|
id: "roles",
|
|
@@ -3730,7 +3774,15 @@ const AdminPanelPage = () => {
|
|
|
3730
3774
|
const response = await get(`/${pluginId}/admin-sessions/admins`, { params: listParams });
|
|
3731
3775
|
if (requestId !== requestIdRef.current) return;
|
|
3732
3776
|
const body = response?.data || {};
|
|
3733
|
-
|
|
3777
|
+
const placeholder = (id) => formatMessage(
|
|
3778
|
+
{ id: getTranslation("adminPanel.identity.placeholder"), defaultMessage: "Admin #{id}" },
|
|
3779
|
+
{ id }
|
|
3780
|
+
);
|
|
3781
|
+
setAdmins(
|
|
3782
|
+
(Array.isArray(body.data) ? body.data : []).map(
|
|
3783
|
+
(row) => withIdentityPlaceholders(row, placeholder, body.meta?.identity)
|
|
3784
|
+
)
|
|
3785
|
+
);
|
|
3734
3786
|
setMeta(body.meta || null);
|
|
3735
3787
|
setLoadError(false);
|
|
3736
3788
|
hasLoadedRef.current = true;
|
|
@@ -3744,7 +3796,7 @@ const AdminPanelPage = () => {
|
|
|
3744
3796
|
setRefreshing(false);
|
|
3745
3797
|
}
|
|
3746
3798
|
}
|
|
3747
|
-
}, [get, listParams]);
|
|
3799
|
+
}, [get, listParams, formatMessage]);
|
|
3748
3800
|
useEffect(() => {
|
|
3749
3801
|
fetchAdmins();
|
|
3750
3802
|
}, [fetchAdmins]);
|
|
@@ -3758,7 +3810,20 @@ const AdminPanelPage = () => {
|
|
|
3758
3810
|
if (requestId !== dialogRequestRef.current) return;
|
|
3759
3811
|
const body = response?.data || {};
|
|
3760
3812
|
setDialogSessions(Array.isArray(body.data) ? body.data : []);
|
|
3761
|
-
if (body.meta?.admin)
|
|
3813
|
+
if (body.meta?.admin) {
|
|
3814
|
+
const placeholder = (id) => formatMessage(
|
|
3815
|
+
{
|
|
3816
|
+
id: getTranslation("adminPanel.identity.placeholder"),
|
|
3817
|
+
defaultMessage: "Admin #{id}"
|
|
3818
|
+
},
|
|
3819
|
+
{ id }
|
|
3820
|
+
);
|
|
3821
|
+
setSelected(
|
|
3822
|
+
(current) => current ? withIdentityPlaceholders(body.meta.admin, placeholder, {
|
|
3823
|
+
roles: current.rolesHidden ? false : void 0
|
|
3824
|
+
}) : current
|
|
3825
|
+
);
|
|
3826
|
+
}
|
|
3762
3827
|
setDialogError(false);
|
|
3763
3828
|
} catch (err) {
|
|
3764
3829
|
if (requestId !== dialogRequestRef.current || isCancelledRequest(err)) return;
|
|
@@ -3768,7 +3833,7 @@ const AdminPanelPage = () => {
|
|
|
3768
3833
|
if (requestId === dialogRequestRef.current) setDialogLoading(false);
|
|
3769
3834
|
}
|
|
3770
3835
|
},
|
|
3771
|
-
[get]
|
|
3836
|
+
[get, formatMessage]
|
|
3772
3837
|
);
|
|
3773
3838
|
const openDialog = (admin, trigger, tab = "sessions") => {
|
|
3774
3839
|
openerRef.current = trigger;
|
|
@@ -4053,7 +4118,7 @@ const AdminPanelPage = () => {
|
|
|
4053
4118
|
value: view.search,
|
|
4054
4119
|
onSearch: handleSearch,
|
|
4055
4120
|
label: t("adminPanel.search.label", "Search admins"),
|
|
4056
|
-
placeholder: t("adminPanel.search.placeholder", "Search name or email")
|
|
4121
|
+
placeholder: meta?.identity?.names === false ? t("adminPanel.search.placeholderId", "Search by admin ID") : t("adminPanel.search.placeholder", "Search name or email")
|
|
4057
4122
|
}
|
|
4058
4123
|
) }),
|
|
4059
4124
|
/* @__PURE__ */ jsxs(Flex, { gap: 2, alignItems: "center", shrink: 0, children: [
|
|
@@ -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-CSJJn4qy.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;
|
|
@@ -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 { m as logSafeAdminError, s as isCancelledRequest, b as getTranslation, R as ReadableText, M as MissingValue } from "./index-
|
|
9
|
+
import { m as logSafeAdminError, s as isCancelledRequest, b as getTranslation, R as ReadableText, M as MissingValue } from "./index-tt61o2VH.mjs";
|
|
10
10
|
function normalizeUserCounts(response) {
|
|
11
11
|
const totalUsers = response?.data?.totalUsers;
|
|
12
12
|
const blockedUsers = response?.data?.blockedUsers;
|