strapi-plugin-magic-sessionmanager 4.22.0 → 4.23.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 +80 -0
- package/README.md +163 -119
- package/dist/admin/ActiveImpersonationsCard-CbyOAlrL.mjs +396 -0
- package/dist/admin/ActiveImpersonationsCard-D1CVmV-w.js +395 -0
- package/dist/admin/{Analytics-WbCUmkQQ.mjs → Analytics-DGAHD19E.mjs} +1 -1
- package/dist/admin/{Analytics-DeDLGiCe.js → Analytics-_WA68oHb.js} +1 -1
- package/dist/admin/{App-Bkv-W0Sv.js → App-CfhAQ17e.js} +304 -104
- package/dist/admin/{App-C4bihk2K.mjs → App-VB66H73A.mjs} +276 -76
- package/dist/admin/ImpersonationTabBanner-B6Ps5-oe.mjs +244 -0
- package/dist/admin/ImpersonationTabBanner-DdwXNmh4.js +244 -0
- package/dist/admin/{OnlineUsersWidget-q0Z6nbbO.mjs → OnlineUsersWidget-2u-fYMb7.mjs} +1 -1
- package/dist/admin/{OnlineUsersWidget-CSvNe2rC.js → OnlineUsersWidget-CmBqFLAA.js} +1 -1
- package/dist/admin/{Settings-xokFI5LO.js → Settings-BBs2FDp7.js} +87 -266
- package/dist/admin/{Settings-avD0DbXP.mjs → Settings-CKDNGJhl.mjs} +79 -258
- package/dist/admin/{de-BQlEdBMr.mjs → de-CK-HuY41.mjs} +48 -7
- package/dist/admin/{de-HcJ19LKI.js → de-CSRQPn6F.js} +48 -7
- package/dist/admin/{en-DI-98CPM.js → en-DCtAgGEa.js} +48 -7
- package/dist/admin/{en-DzuXWL1W.mjs → en-KZ5ajaAR.mjs} +48 -7
- package/dist/admin/{es-BfyED9YI.mjs → es-B7k8taWV.mjs} +48 -7
- package/dist/admin/{es-Cm0Eklav.js → es-CKT00l4K.js} +48 -7
- package/dist/admin/{fr-C3nzszsI.js → fr-B2EdBFSb.js} +48 -7
- package/dist/admin/{fr-CzFNGWq0.mjs → fr-Q2gmYqCn.mjs} +48 -7
- package/dist/admin/{index-6zc5D8eb.mjs → index-BPbs1GyP.mjs} +386 -61
- package/dist/admin/{index-Dk5Jqe5U.js → index-Cho0XGZ1.js} +340 -15
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/admin/{pt-BPZ6chPT.js → pt-CcMUcqDy.js} +48 -7
- package/dist/admin/{pt-DmyQnGI_.mjs → pt-CmxZTaf2.mjs} +48 -7
- package/dist/admin/useBreakpoint-CoBfu0Ov.js +62 -0
- package/dist/admin/useBreakpoint-CuyIc2qy.mjs +63 -0
- package/dist/server/index.js +1809 -400
- package/dist/server/index.mjs +1809 -400
- package/package.json +9 -4
- package/dist/admin/dashboardModel-BBNRgcEr.mjs +0 -170
- package/dist/admin/dashboardModel-D4389iIV.js +0 -169
|
@@ -0,0 +1,396 @@
|
|
|
1
|
+
import { jsx, jsxs } from "react/jsx-runtime";
|
|
2
|
+
import { useState, useRef, useCallback, useEffect } from "react";
|
|
3
|
+
import { Flex, Loader, Button, EmptyStateLayout, Box, Table, Thead, Tr, Th, Typography, VisuallyHidden, Tbody, Td, Badge, IconButton } from "@strapi/design-system";
|
|
4
|
+
import { ArrowClockwise, SignOut } from "@strapi/icons";
|
|
5
|
+
import { EmptyPermissions } from "@strapi/icons/symbols";
|
|
6
|
+
import { useFetchClient, useNotification } from "@strapi/strapi/admin";
|
|
7
|
+
import { aK as isSessionFilter, aL as DEFAULT_SESSION_FILTER, aM as isEndReasonFilter, aN as DEFAULT_END_REASON_FILTER, d as getDevicePresentation, p as presentText, a1 as useSettingsTranslate, u as useSessionFormatters, L as useElementWidth, F as isCancelledRequest, l as logSafeAdminError, f as pluginId, h as PersistentAlert, C as ConfirmAction } from "./index-BPbs1GyP.mjs";
|
|
8
|
+
import { S as SectionCard } from "./SectionCard-D51bv4Hi.mjs";
|
|
9
|
+
import "react-intl";
|
|
10
|
+
const RowActions = ({ children, ...props }) => /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", alignItems: "center", gap: 1, "data-row-actions": "", ...props, children });
|
|
11
|
+
const RISK_SOURCES = Object.freeze(["anonymous-ip", "asn-heuristic"]);
|
|
12
|
+
const RISK_SETTINGS_PATH = "/settings/magic-sessionmanager/general?tab=location-data";
|
|
13
|
+
const isRiskSource = (value) => RISK_SOURCES.includes(
|
|
14
|
+
/** @type {string} */
|
|
15
|
+
value
|
|
16
|
+
);
|
|
17
|
+
function getRiskAvailability(geoIpStatus) {
|
|
18
|
+
const risk = geoIpStatus?.risk;
|
|
19
|
+
if (!risk || typeof risk !== "object" || typeof risk.available !== "boolean") {
|
|
20
|
+
return { state: "unknown", source: null };
|
|
21
|
+
}
|
|
22
|
+
if (risk.available && isRiskSource(risk.source)) {
|
|
23
|
+
return { state: "available", source: risk.source };
|
|
24
|
+
}
|
|
25
|
+
return { state: "missing", source: null };
|
|
26
|
+
}
|
|
27
|
+
function riskDependentControl(saved, state) {
|
|
28
|
+
if (state !== "missing")
|
|
29
|
+
return { checked: Boolean(saved), disabled: false, savedOnButInactive: false };
|
|
30
|
+
return { checked: false, disabled: true, savedOnButInactive: Boolean(saved) };
|
|
31
|
+
}
|
|
32
|
+
const PAGE_SIZE_OPTIONS = Object.freeze(["10", "25", "50", "100"]);
|
|
33
|
+
const DEFAULT_PAGE_SIZE = "25";
|
|
34
|
+
const DASHBOARD_TABLE_COLUMNS = 7;
|
|
35
|
+
const DASHBOARD_COMPACT_TABLE_COLUMNS = 5;
|
|
36
|
+
const AUTO_REFRESH_INTERVAL_MS = 10 * 60 * 1e3;
|
|
37
|
+
const HOW_IT_WORKS_STORAGE_KEY = "magic-sessionmanager.dashboard.howSessionsWork";
|
|
38
|
+
const USER_EDIT_PATH = "/content-manager/collection-types/plugin::users-permissions.user/";
|
|
39
|
+
const readQueryText = (value) => {
|
|
40
|
+
if (typeof value !== "string") return "";
|
|
41
|
+
try {
|
|
42
|
+
return decodeURIComponent(value).trim();
|
|
43
|
+
} catch {
|
|
44
|
+
return value.trim();
|
|
45
|
+
}
|
|
46
|
+
};
|
|
47
|
+
function parseDashboardQuery(query = {}) {
|
|
48
|
+
const source = query || {};
|
|
49
|
+
const page = Number.parseInt(String(source.page ?? "1"), 10);
|
|
50
|
+
const pageSize = PAGE_SIZE_OPTIONS.includes(String(source.pageSize)) ? String(source.pageSize) : DEFAULT_PAGE_SIZE;
|
|
51
|
+
const status = isSessionFilter(source.status) ? (
|
|
52
|
+
/** @type {string} */
|
|
53
|
+
source.status
|
|
54
|
+
) : DEFAULT_SESSION_FILTER;
|
|
55
|
+
const reason = status === "ended" && isEndReasonFilter(source.reason) ? (
|
|
56
|
+
/** @type {string} */
|
|
57
|
+
source.reason
|
|
58
|
+
) : DEFAULT_END_REASON_FILTER;
|
|
59
|
+
const search = readQueryText(source.search) || readQueryText(source._q);
|
|
60
|
+
return { page: Number.isFinite(page) && page >= 1 ? page : 1, pageSize, status, reason, search };
|
|
61
|
+
}
|
|
62
|
+
function encodeSearchQuery(value) {
|
|
63
|
+
const text = typeof value === "string" ? value.trim() : "";
|
|
64
|
+
return text ? encodeURIComponent(text) : void 0;
|
|
65
|
+
}
|
|
66
|
+
function hasActiveFilters(state) {
|
|
67
|
+
if (!state) return false;
|
|
68
|
+
return state.status !== DEFAULT_SESSION_FILTER || Boolean(state.reason) && state.reason !== DEFAULT_END_REASON_FILTER || Boolean(state.search);
|
|
69
|
+
}
|
|
70
|
+
function getSessionUserLabels(session) {
|
|
71
|
+
const username = presentText(session?.user?.username);
|
|
72
|
+
const email = presentText(session?.user?.email);
|
|
73
|
+
const primary = username || email;
|
|
74
|
+
return {
|
|
75
|
+
primary,
|
|
76
|
+
secondary: username && email ? email : "",
|
|
77
|
+
accessible: primary || presentText(session?.id)
|
|
78
|
+
};
|
|
79
|
+
}
|
|
80
|
+
function getUserEditPath(session) {
|
|
81
|
+
const documentId = presentText(session?.user?.documentId);
|
|
82
|
+
return documentId ? `${USER_EDIT_PATH}${encodeURIComponent(documentId)}` : null;
|
|
83
|
+
}
|
|
84
|
+
function getExportDeviceInfo(session, unavailableValue = "") {
|
|
85
|
+
const device = getDevicePresentation(session);
|
|
86
|
+
return {
|
|
87
|
+
device: device.deviceType || unavailableValue,
|
|
88
|
+
browser: device.browser || unavailableValue,
|
|
89
|
+
browserVersion: device.browserVersion || "",
|
|
90
|
+
os: device.os || unavailableValue
|
|
91
|
+
};
|
|
92
|
+
}
|
|
93
|
+
function readDisclosureOpen(storage) {
|
|
94
|
+
try {
|
|
95
|
+
return storage?.getItem(HOW_IT_WORKS_STORAGE_KEY) === "open";
|
|
96
|
+
} catch {
|
|
97
|
+
return false;
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function writeDisclosureOpen(storage, open) {
|
|
101
|
+
try {
|
|
102
|
+
storage?.setItem(HOW_IT_WORKS_STORAGE_KEY, open ? "open" : "closed");
|
|
103
|
+
} catch {
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
function getBrowserStorage() {
|
|
107
|
+
try {
|
|
108
|
+
return typeof window !== "undefined" ? window.localStorage : null;
|
|
109
|
+
} catch {
|
|
110
|
+
return null;
|
|
111
|
+
}
|
|
112
|
+
}
|
|
113
|
+
function shouldIsolateActionKey(key, fromInsideGroup) {
|
|
114
|
+
if (!fromInsideGroup) return true;
|
|
115
|
+
return key === "Enter" || key === " " || key === "Spacebar";
|
|
116
|
+
}
|
|
117
|
+
const FULL_TABLE_MIN_WIDTH = 1200;
|
|
118
|
+
function shouldUseCompactTable(listWidth, isBelowLarge) {
|
|
119
|
+
if (isBelowLarge) return true;
|
|
120
|
+
if (!Number.isFinite(listWidth) || listWidth <= 0) return false;
|
|
121
|
+
return listWidth < FULL_TABLE_MIN_WIDTH;
|
|
122
|
+
}
|
|
123
|
+
function shouldRedispatchEscape(key, fromInsideGroup) {
|
|
124
|
+
return !fromInsideGroup && key === "Escape";
|
|
125
|
+
}
|
|
126
|
+
function pickFocusSessionId(previousIds, currentIds, sessionId) {
|
|
127
|
+
const current = Array.isArray(currentIds) ? currentIds.map(String) : [];
|
|
128
|
+
if (current.length === 0) return null;
|
|
129
|
+
const target = String(sessionId);
|
|
130
|
+
if (current.includes(target)) return target;
|
|
131
|
+
const previous = Array.isArray(previousIds) ? previousIds.map(String) : [];
|
|
132
|
+
const index = previous.indexOf(target);
|
|
133
|
+
if (index >= 0) {
|
|
134
|
+
for (let next = index + 1; next < previous.length; next += 1) {
|
|
135
|
+
if (current.includes(previous[next])) return previous[next];
|
|
136
|
+
}
|
|
137
|
+
for (let before = index - 1; before >= 0; before -= 1) {
|
|
138
|
+
if (current.includes(previous[before])) return previous[before];
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
return current[0];
|
|
142
|
+
}
|
|
143
|
+
function getErrorStatus(error) {
|
|
144
|
+
const err = (
|
|
145
|
+
/** @type {any} */
|
|
146
|
+
error
|
|
147
|
+
);
|
|
148
|
+
const status = err?.status ?? err?.response?.status;
|
|
149
|
+
return typeof status === "number" ? status : null;
|
|
150
|
+
}
|
|
151
|
+
const TABLE_MIN_WIDTH = 720;
|
|
152
|
+
const keepActionKeys = (event) => {
|
|
153
|
+
if (shouldIsolateActionKey(event.key, true)) event.stopPropagation();
|
|
154
|
+
};
|
|
155
|
+
const ActiveImpersonationsCard = () => {
|
|
156
|
+
const { t } = useSettingsTranslate();
|
|
157
|
+
const { get, post } = useFetchClient();
|
|
158
|
+
const { toggleNotification } = useNotification();
|
|
159
|
+
const { formatDate } = useSessionFormatters();
|
|
160
|
+
const [widthRef, width] = useElementWidth();
|
|
161
|
+
const [rows, setRows] = useState(null);
|
|
162
|
+
const [error, setError] = useState(false);
|
|
163
|
+
const [refreshing, setRefreshing] = useState(false);
|
|
164
|
+
const refreshRef = useRef(null);
|
|
165
|
+
const requestRef = useRef(0);
|
|
166
|
+
const apply = useCallback(async (request, pending) => {
|
|
167
|
+
try {
|
|
168
|
+
const { data } = await pending;
|
|
169
|
+
if (request !== requestRef.current) return;
|
|
170
|
+
if (!Array.isArray(data?.data)) throw new Error("Invalid impersonation list");
|
|
171
|
+
setRows(data.data);
|
|
172
|
+
setError(false);
|
|
173
|
+
} catch (err) {
|
|
174
|
+
if (isCancelledRequest(err) || request !== requestRef.current) return;
|
|
175
|
+
logSafeAdminError("impersonation.list", err);
|
|
176
|
+
setError(true);
|
|
177
|
+
} finally {
|
|
178
|
+
if (request === requestRef.current) setRefreshing(false);
|
|
179
|
+
}
|
|
180
|
+
}, []);
|
|
181
|
+
const load = useCallback(() => {
|
|
182
|
+
const request = ++requestRef.current;
|
|
183
|
+
setRefreshing(true);
|
|
184
|
+
return apply(request, get(`/${pluginId}/impersonation/active`));
|
|
185
|
+
}, [apply, get]);
|
|
186
|
+
useEffect(() => {
|
|
187
|
+
apply(++requestRef.current, get(`/${pluginId}/impersonation/active`));
|
|
188
|
+
}, [apply, get]);
|
|
189
|
+
const end = async (row) => {
|
|
190
|
+
try {
|
|
191
|
+
await post(`/${pluginId}/impersonation/${row.id}/end`, {});
|
|
192
|
+
toggleNotification({
|
|
193
|
+
type: "success",
|
|
194
|
+
message: t("impersonation.ended", "Impersonation ended.")
|
|
195
|
+
});
|
|
196
|
+
} catch (err) {
|
|
197
|
+
logSafeAdminError("impersonation.end", err);
|
|
198
|
+
toggleNotification({
|
|
199
|
+
type: "danger",
|
|
200
|
+
message: t("impersonation.error.end", "The impersonation could not be ended.")
|
|
201
|
+
});
|
|
202
|
+
throw err;
|
|
203
|
+
} finally {
|
|
204
|
+
await load();
|
|
205
|
+
}
|
|
206
|
+
};
|
|
207
|
+
const endAction = (row) => /* @__PURE__ */ jsx(
|
|
208
|
+
ConfirmAction,
|
|
209
|
+
{
|
|
210
|
+
fallbackFocusRef: refreshRef,
|
|
211
|
+
title: t("impersonation.confirm.title", "End the impersonation of {user}?", {
|
|
212
|
+
user: label(row)
|
|
213
|
+
}),
|
|
214
|
+
body: t(
|
|
215
|
+
"impersonation.confirm.body",
|
|
216
|
+
"The short-lived sign-in stops working at once. This is recorded in the security log."
|
|
217
|
+
),
|
|
218
|
+
confirmLabel: t("impersonation.end", "End impersonation"),
|
|
219
|
+
onConfirm: () => end(row),
|
|
220
|
+
trigger: /* @__PURE__ */ jsx(
|
|
221
|
+
IconButton,
|
|
222
|
+
{
|
|
223
|
+
variant: "ghost",
|
|
224
|
+
label: t("impersonation.endLabel", "End impersonation of {user}", {
|
|
225
|
+
user: label(row)
|
|
226
|
+
}),
|
|
227
|
+
children: /* @__PURE__ */ jsx(SignOut, {})
|
|
228
|
+
}
|
|
229
|
+
)
|
|
230
|
+
},
|
|
231
|
+
row.id
|
|
232
|
+
);
|
|
233
|
+
const label = (row) => row.targetLabel || (row.targetType === "admin" ? t("impersonation.list.adminFallback", "Admin #{id}", { id: row.targetId }) : row.targetId);
|
|
234
|
+
const kind = (row) => {
|
|
235
|
+
if (row.targetType !== "admin") return null;
|
|
236
|
+
if (row.handoff === "admin-session") {
|
|
237
|
+
return /* @__PURE__ */ jsx(
|
|
238
|
+
Badge,
|
|
239
|
+
{
|
|
240
|
+
backgroundColor: row.allowChanges ? "danger100" : "primary100",
|
|
241
|
+
textColor: "neutral800",
|
|
242
|
+
children: row.allowChanges ? t("impersonation.list.kind.adminChanges", "Admin, signed in, changes allowed") : t("impersonation.list.kind.adminSignedIn", "Admin, signed in, read-only")
|
|
243
|
+
}
|
|
244
|
+
);
|
|
245
|
+
}
|
|
246
|
+
return /* @__PURE__ */ jsx(Badge, { backgroundColor: "primary100", textColor: "neutral800", children: t("impersonation.list.kind.admin", "Admin, view only") });
|
|
247
|
+
};
|
|
248
|
+
const time = (iso) => /* @__PURE__ */ jsx(Typography, { tag: "time", dateTime: iso, variant: "omega", textColor: "neutral800", children: formatDate(iso, { hour: "2-digit", minute: "2-digit" }) });
|
|
249
|
+
const startedBy = (row) => row.startedByYou ? t("impersonation.list.you", "You") : row.actorLabel || "—";
|
|
250
|
+
let content;
|
|
251
|
+
if (rows === null && !error) {
|
|
252
|
+
content = /* @__PURE__ */ jsx(Flex, { justifyContent: "center", padding: 6, children: /* @__PURE__ */ jsx(Loader, { small: true, children: t("impersonation.list.loading", "Loading impersonations…") }) });
|
|
253
|
+
} else if (error && rows === null) {
|
|
254
|
+
content = /* @__PURE__ */ jsx(
|
|
255
|
+
PersistentAlert,
|
|
256
|
+
{
|
|
257
|
+
variant: "danger",
|
|
258
|
+
closeLabel: t("common.close", "Close"),
|
|
259
|
+
title: t("impersonation.list.error", "Impersonations could not be loaded."),
|
|
260
|
+
action: /* @__PURE__ */ jsx(Button, { variant: "tertiary", onClick: load, children: t("common.tryAgain", "Try again") }),
|
|
261
|
+
children: t(
|
|
262
|
+
"impersonation.list.errorBody",
|
|
263
|
+
"Running impersonations still end on time; only this list is missing."
|
|
264
|
+
)
|
|
265
|
+
}
|
|
266
|
+
);
|
|
267
|
+
} else if (rows.length === 0) {
|
|
268
|
+
content = /* @__PURE__ */ jsx(
|
|
269
|
+
EmptyStateLayout,
|
|
270
|
+
{
|
|
271
|
+
icon: /* @__PURE__ */ jsx(EmptyPermissions, { width: "16rem", height: "8rem" }),
|
|
272
|
+
content: t(
|
|
273
|
+
"impersonation.list.empty",
|
|
274
|
+
"No impersonation is running. Start one from a user’s entry in the Content Manager."
|
|
275
|
+
)
|
|
276
|
+
}
|
|
277
|
+
);
|
|
278
|
+
} else if (width === 0 || width >= TABLE_MIN_WIDTH) {
|
|
279
|
+
content = /* @__PURE__ */ jsx(Box, { hasRadius: true, borderColor: "neutral150", "data-impersonations-table": "", children: /* @__PURE__ */ jsxs(Table, { colCount: 5, rowCount: rows.length + 1, "aria-busy": refreshing, children: [
|
|
280
|
+
/* @__PURE__ */ jsx(Thead, { children: /* @__PURE__ */ jsxs(Tr, { children: [
|
|
281
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children: t("impersonation.list.col.user", "User") }) }),
|
|
282
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children: t("impersonation.list.col.startedBy", "Started by") }) }),
|
|
283
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children: t("impersonation.list.col.reason", "Reason") }) }),
|
|
284
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", children: t("impersonation.list.col.ends", "Ends") }) }),
|
|
285
|
+
/* @__PURE__ */ jsx(Th, { children: /* @__PURE__ */ jsx(VisuallyHidden, { children: t("impersonation.list.col.actions", "Actions") }) })
|
|
286
|
+
] }) }),
|
|
287
|
+
/* @__PURE__ */ jsx(Tbody, { children: rows.map((row) => /* @__PURE__ */ jsxs(Tr, { "data-impersonation-row": "", children: [
|
|
288
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", alignItems: "center", children: [
|
|
289
|
+
/* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", fontWeight: "semiBold", children: label(row) }),
|
|
290
|
+
kind(row)
|
|
291
|
+
] }) }),
|
|
292
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", children: startedBy(row) }) }),
|
|
293
|
+
/* @__PURE__ */ jsx(Td, { style: { maxWidth: 0, width: "40%" }, children: /* @__PURE__ */ jsx(
|
|
294
|
+
Typography,
|
|
295
|
+
{
|
|
296
|
+
variant: "omega",
|
|
297
|
+
textColor: "neutral800",
|
|
298
|
+
tag: "p",
|
|
299
|
+
style: { overflowWrap: "anywhere" },
|
|
300
|
+
children: row.reason
|
|
301
|
+
}
|
|
302
|
+
) }),
|
|
303
|
+
/* @__PURE__ */ jsx(Td, { children: time(row.expiresAt) }),
|
|
304
|
+
/* @__PURE__ */ jsx(Td, { children: /* @__PURE__ */ jsx(RowActions, { onKeyDown: keepActionKeys, children: endAction(row) }) })
|
|
305
|
+
] }, row.id)) })
|
|
306
|
+
] }) });
|
|
307
|
+
} else {
|
|
308
|
+
content = /* @__PURE__ */ jsx(Flex, { direction: "column", alignItems: "stretch", gap: 2, tag: "ul", "data-impersonations-list": "", children: rows.map((row) => /* @__PURE__ */ jsx(Box, { tag: "li", padding: 4, hasRadius: true, borderColor: "neutral150", children: /* @__PURE__ */ jsxs(Flex, { justifyContent: "space-between", alignItems: "flex-start", gap: 3, children: [
|
|
309
|
+
/* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, children: [
|
|
310
|
+
/* @__PURE__ */ jsxs(Flex, { gap: 2, wrap: "wrap", alignItems: "center", children: [
|
|
311
|
+
/* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", fontWeight: "semiBold", children: label(row) }),
|
|
312
|
+
kind(row)
|
|
313
|
+
] }),
|
|
314
|
+
/* @__PURE__ */ jsx(
|
|
315
|
+
Typography,
|
|
316
|
+
{
|
|
317
|
+
variant: "pi",
|
|
318
|
+
textColor: "neutral800",
|
|
319
|
+
tag: "p",
|
|
320
|
+
style: { overflowWrap: "anywhere" },
|
|
321
|
+
children: row.reason
|
|
322
|
+
}
|
|
323
|
+
),
|
|
324
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral600", children: t("impersonation.list.summary", "{admin}, until {time}", {
|
|
325
|
+
admin: startedBy(row),
|
|
326
|
+
time: formatDate(row.expiresAt, { hour: "2-digit", minute: "2-digit" })
|
|
327
|
+
}) })
|
|
328
|
+
] }),
|
|
329
|
+
/* @__PURE__ */ jsx(RowActions, { onKeyDown: keepActionKeys, children: endAction(row) })
|
|
330
|
+
] }) }, row.id)) });
|
|
331
|
+
}
|
|
332
|
+
return /* @__PURE__ */ jsx(
|
|
333
|
+
SectionCard,
|
|
334
|
+
{
|
|
335
|
+
id: "active-impersonations",
|
|
336
|
+
title: t("impersonation.list.title", "Active impersonations"),
|
|
337
|
+
subtitle: t(
|
|
338
|
+
"impersonation.list.intro",
|
|
339
|
+
"Each one ends by itself at the time shown. End stops it at once."
|
|
340
|
+
),
|
|
341
|
+
action: /* @__PURE__ */ jsx(
|
|
342
|
+
Button,
|
|
343
|
+
{
|
|
344
|
+
ref: refreshRef,
|
|
345
|
+
variant: "tertiary",
|
|
346
|
+
startIcon: /* @__PURE__ */ jsx(ArrowClockwise, {}),
|
|
347
|
+
onClick: load,
|
|
348
|
+
loading: refreshing && rows !== null,
|
|
349
|
+
children: t("impersonation.list.refresh", "Refresh")
|
|
350
|
+
}
|
|
351
|
+
),
|
|
352
|
+
children: /* @__PURE__ */ jsxs("div", { ref: widthRef, "aria-live": "polite", children: [
|
|
353
|
+
error && rows !== null ? /* @__PURE__ */ jsx(Box, { paddingBottom: 3, children: /* @__PURE__ */ jsx(
|
|
354
|
+
PersistentAlert,
|
|
355
|
+
{
|
|
356
|
+
variant: "warning",
|
|
357
|
+
closeLabel: t("common.close", "Close"),
|
|
358
|
+
title: t("impersonation.list.refreshErrorTitle", "Not refreshed"),
|
|
359
|
+
children: t(
|
|
360
|
+
"impersonation.list.refreshError",
|
|
361
|
+
"The list could not be refreshed. It shows the last known impersonations."
|
|
362
|
+
)
|
|
363
|
+
}
|
|
364
|
+
) }) : null,
|
|
365
|
+
content
|
|
366
|
+
] })
|
|
367
|
+
}
|
|
368
|
+
);
|
|
369
|
+
};
|
|
370
|
+
export {
|
|
371
|
+
AUTO_REFRESH_INTERVAL_MS as A,
|
|
372
|
+
DASHBOARD_COMPACT_TABLE_COLUMNS as D,
|
|
373
|
+
PAGE_SIZE_OPTIONS as P,
|
|
374
|
+
RISK_SETTINGS_PATH as R,
|
|
375
|
+
getUserEditPath as a,
|
|
376
|
+
RowActions as b,
|
|
377
|
+
shouldRedispatchEscape as c,
|
|
378
|
+
DASHBOARD_TABLE_COLUMNS as d,
|
|
379
|
+
getBrowserStorage as e,
|
|
380
|
+
pickFocusSessionId as f,
|
|
381
|
+
getSessionUserLabels as g,
|
|
382
|
+
encodeSearchQuery as h,
|
|
383
|
+
isRiskSource as i,
|
|
384
|
+
shouldUseCompactTable as j,
|
|
385
|
+
DEFAULT_PAGE_SIZE as k,
|
|
386
|
+
getExportDeviceInfo as l,
|
|
387
|
+
getErrorStatus as m,
|
|
388
|
+
hasActiveFilters as n,
|
|
389
|
+
ActiveImpersonationsCard as o,
|
|
390
|
+
parseDashboardQuery as p,
|
|
391
|
+
getRiskAvailability as q,
|
|
392
|
+
readDisclosureOpen as r,
|
|
393
|
+
shouldIsolateActionKey as s,
|
|
394
|
+
riskDependentControl as t,
|
|
395
|
+
writeDisclosureOpen as w
|
|
396
|
+
};
|