strapi-plugin-magic-sessionmanager 4.19.1 → 4.21.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 +38 -0
- package/README.md +189 -35
- package/dist/admin/{Analytics-BElmzyNJ.js → Analytics-BqdZIBV4.js} +1 -1
- package/dist/admin/{Analytics-BqFlgLnN.mjs → Analytics-C-OLLzoB.mjs} +1 -1
- package/dist/admin/{App-0thsC_P9.mjs → App-BswHmNQT.mjs} +338 -4
- package/dist/admin/{App-D_J2eeEG.js → App-Cx9v6n_7.js} +337 -3
- package/dist/admin/{OnlineUsersWidget-DMZBwqdY.js → OnlineUsersWidget-BRmQPPp9.js} +1 -1
- package/dist/admin/{OnlineUsersWidget-BgJ1ws-5.mjs → OnlineUsersWidget-Dusgjc1d.mjs} +1 -1
- package/dist/admin/{Settings-FOkui_ke.js → Settings-DWGuf_Z3.js} +288 -65
- package/dist/admin/{Settings-QN3Mu4AQ.mjs → Settings-DZyQheUS.mjs} +258 -35
- package/dist/admin/{de-CEyi4lpp.js → de-24TPqzG6.js} +94 -1
- package/dist/admin/{de-uGKSKVYD.mjs → de-DUnrmFWk.mjs} +94 -1
- package/dist/admin/{en-CSXeJYKy.js → en-8mBSkWOF.js} +94 -1
- package/dist/admin/{en-Yu7tfwqx.mjs → en-D8J__tyF.mjs} +94 -1
- package/dist/admin/{es-iNG9Amf9.mjs → es-BgpgWdk0.mjs} +94 -1
- package/dist/admin/{es-BrKqXhAU.js → es-ChUKey-Q.js} +94 -1
- package/dist/admin/{fr-DKZNfdlH.js → fr-DE_CWmgq.js} +94 -1
- package/dist/admin/{fr-CaFICHlf.mjs → fr-k1MHYKJo.mjs} +94 -1
- package/dist/admin/{index-DEYtqPc3.js → index-Ceh3Q1Ki.js} +622 -46
- package/dist/admin/{index-h-ksmM8A.mjs → index-meLDPPwt.mjs} +638 -62
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/admin/{pt-IEagyVDL.js → pt-BjqU5ioB.js} +94 -1
- package/dist/admin/{pt-Bz2hWVrq.mjs → pt-DPO4DmDc.mjs} +94 -1
- package/dist/admin/{settingsTabs-D02CuEvs.mjs → settingsTabs-C1q5iMMw.mjs} +5 -1
- package/dist/admin/{settingsTabs-N4TFn-mw.js → settingsTabs-CfquZuKH.js} +5 -1
- package/dist/server/index.js +1965 -15
- package/dist/server/index.mjs +1965 -15
- package/package.json +1 -1
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import { useRef, useEffect, forwardRef, useId, Children, useCallback, useMemo, useState } from "react";
|
|
1
|
+
import { useRef, useEffect, forwardRef, useId, Children, useCallback, useMemo, useState, useSyncExternalStore } from "react";
|
|
2
2
|
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
3
|
-
import { Monitor, CheckCircle, WarningCircle, Information, Server, Code, Phone, SignOut, Lock } from "@strapi/icons";
|
|
3
|
+
import { Monitor, CheckCircle, WarningCircle, Information, Server, Code, Phone, ExternalLink, Duplicate, SignOut, User, Lock } from "@strapi/icons";
|
|
4
4
|
import { useIntl } from "react-intl";
|
|
5
5
|
import { NavLink } from "react-router-dom";
|
|
6
|
-
import { Typography, Flex, Box, Grid, VisuallyHidden, Badge, Tooltip, Dialog, Button, Link, Loader } from "@strapi/design-system";
|
|
7
|
-
import { Page, Layouts, ConfirmDialog,
|
|
6
|
+
import { Typography, Flex, Box, Grid, VisuallyHidden, Badge, Tooltip, Dialog, Button, Link, Modal, Field, Textarea, SingleSelect, SingleSelectOption, Checkbox, TextInput, Loader } from "@strapi/design-system";
|
|
7
|
+
import { Page, Layouts, ConfirmDialog, useFetchClient, useNotification, useRBAC, useForm } from "@strapi/strapi/admin";
|
|
8
8
|
import styled, { css } from "styled-components";
|
|
9
9
|
const strapi = { "name": "magic-sessionmanager", "displayName": "Magic Sessionmanager" };
|
|
10
10
|
const pluginPkg = {
|
|
@@ -1049,6 +1049,612 @@ const ActionStack = styled.div`
|
|
|
1049
1049
|
text-align: center;
|
|
1050
1050
|
}
|
|
1051
1051
|
`;
|
|
1052
|
+
const pluginPermissions = {
|
|
1053
|
+
access: [{ action: `plugin::${pluginId}.access`, subject: null }],
|
|
1054
|
+
/** Strapi admin panel sessions (view). The server also requires `access`. */
|
|
1055
|
+
adminSessionsRead: [{ action: `plugin::${pluginId}.admin-sessions.read`, subject: null }],
|
|
1056
|
+
/** Signing admins out. The server also requires `access` and `admin-sessions.read`. */
|
|
1057
|
+
adminSessionsRevoke: [{ action: `plugin::${pluginId}.admin-sessions.revoke`, subject: null }],
|
|
1058
|
+
/** Admin sign-in history and Content Manager activity. The server also requires `access` and `admin-sessions.read`. */
|
|
1059
|
+
adminActivityRead: [{ action: `plugin::${pluginId}.admin-activity.read`, subject: null }],
|
|
1060
|
+
/**
|
|
1061
|
+
* Protected settings (4.17): location lookup, webhooks and the security log.
|
|
1062
|
+
* The server also requires `access` (and `admin-activity.read` for the log).
|
|
1063
|
+
*/
|
|
1064
|
+
settingsUpdate: [{ action: `plugin::${pluginId}.settings.update`, subject: null }],
|
|
1065
|
+
/** Lifting a sign-in lock. The server also requires `access`. */
|
|
1066
|
+
lockoutsUnlock: [{ action: `plugin::${pluginId}.lockouts.unlock`, subject: null }],
|
|
1067
|
+
/**
|
|
1068
|
+
* Impersonating app users (4.20): start, list and end. The server also
|
|
1069
|
+
* requires `access` and the Impersonation switch.
|
|
1070
|
+
*/
|
|
1071
|
+
impersonateUsers: [{ action: `plugin::${pluginId}.impersonate.users`, subject: null }],
|
|
1072
|
+
/**
|
|
1073
|
+
* "View as admin" (4.20): the read-only permission preview of another
|
|
1074
|
+
* admin. The server also requires `access`, the switch and the
|
|
1075
|
+
* anti-escalation rules.
|
|
1076
|
+
*/
|
|
1077
|
+
impersonateAdmins: [{ action: `plugin::${pluginId}.impersonate.admins`, subject: null }]
|
|
1078
|
+
};
|
|
1079
|
+
const SAFE_SCOPE = /^[A-Za-z0-9_.:-]{1,48}$/;
|
|
1080
|
+
const CANCEL_NAMES = /* @__PURE__ */ new Set(["AbortError", "TimeoutError", "CanceledError"]);
|
|
1081
|
+
function safeGet(value, key) {
|
|
1082
|
+
try {
|
|
1083
|
+
return value && typeof value === "object" ? value[key] : void 0;
|
|
1084
|
+
} catch {
|
|
1085
|
+
return void 0;
|
|
1086
|
+
}
|
|
1087
|
+
}
|
|
1088
|
+
function isCancelledRequest(error) {
|
|
1089
|
+
const name2 = safeGet(error, "name");
|
|
1090
|
+
return typeof name2 === "string" && CANCEL_NAMES.has(name2);
|
|
1091
|
+
}
|
|
1092
|
+
function logSafeAdminError(scope, error) {
|
|
1093
|
+
if (isCancelledRequest(error)) return;
|
|
1094
|
+
const safeScope = typeof scope === "string" && SAFE_SCOPE.test(scope) ? scope : "admin";
|
|
1095
|
+
const directStatus = safeGet(error, "status");
|
|
1096
|
+
const status = Number.isInteger(directStatus) ? directStatus : safeGet(safeGet(error, "response"), "status");
|
|
1097
|
+
const statusSuffix = Number.isInteger(status) && status >= 400 && status <= 599 ? ` (HTTP ${status})` : "";
|
|
1098
|
+
console.warn(`[${safeScope}] Request failed${statusSuffix}`);
|
|
1099
|
+
}
|
|
1100
|
+
function useSettingsTranslate() {
|
|
1101
|
+
const { formatMessage, locale } = useIntl();
|
|
1102
|
+
const t = useCallback(
|
|
1103
|
+
(id, defaultMessage, values) => formatMessage({ id: getTranslation(id), defaultMessage }, values),
|
|
1104
|
+
[formatMessage]
|
|
1105
|
+
);
|
|
1106
|
+
const tError = useCallback(
|
|
1107
|
+
(descriptor) => descriptor ? t(descriptor.messageId, descriptor.defaultMessage, descriptor.values) : void 0,
|
|
1108
|
+
[t]
|
|
1109
|
+
);
|
|
1110
|
+
return { t, tError, locale };
|
|
1111
|
+
}
|
|
1112
|
+
async function copyText(value, clipboard = globalThis.navigator?.clipboard) {
|
|
1113
|
+
if (typeof value !== "string") {
|
|
1114
|
+
throw new TypeError("clipboard_value_must_be_text");
|
|
1115
|
+
}
|
|
1116
|
+
if (!clipboard || typeof clipboard.writeText !== "function") {
|
|
1117
|
+
throw new Error("clipboard_unavailable");
|
|
1118
|
+
}
|
|
1119
|
+
await clipboard.writeText(value);
|
|
1120
|
+
}
|
|
1121
|
+
const USER_IMPERSONATION_DURATIONS = Object.freeze([15, 30, 60]);
|
|
1122
|
+
const DEFAULT_IMPERSONATION_MINUTES = 15;
|
|
1123
|
+
const REASON_MIN = 3;
|
|
1124
|
+
const REASON_MAX = 255;
|
|
1125
|
+
function validateReason(value) {
|
|
1126
|
+
const clean = typeof value === "string" ? value.replace(/\s+/g, " ").trim() : "";
|
|
1127
|
+
if (clean.length < REASON_MIN) {
|
|
1128
|
+
return {
|
|
1129
|
+
messageId: "impersonation.reason.tooShort",
|
|
1130
|
+
defaultMessage: "Enter a reason of at least {min} characters.",
|
|
1131
|
+
values: { min: REASON_MIN }
|
|
1132
|
+
};
|
|
1133
|
+
}
|
|
1134
|
+
if (clean.length > REASON_MAX) {
|
|
1135
|
+
return {
|
|
1136
|
+
messageId: "impersonation.reason.tooLong",
|
|
1137
|
+
defaultMessage: "Use at most {max} characters.",
|
|
1138
|
+
values: { max: REASON_MAX }
|
|
1139
|
+
};
|
|
1140
|
+
}
|
|
1141
|
+
return null;
|
|
1142
|
+
}
|
|
1143
|
+
function secondsUntil(iso, now = Date.now()) {
|
|
1144
|
+
const end = Date.parse(String(iso ?? ""));
|
|
1145
|
+
if (!Number.isFinite(end)) return 0;
|
|
1146
|
+
return Math.max(0, Math.floor((end - now) / 1e3));
|
|
1147
|
+
}
|
|
1148
|
+
function formatClock(seconds) {
|
|
1149
|
+
const total = Math.max(0, Math.floor(Number(seconds) || 0));
|
|
1150
|
+
const hours = Math.floor(total / 3600);
|
|
1151
|
+
const minutes = Math.floor(total % 3600 / 60);
|
|
1152
|
+
const rest = String(total % 60).padStart(2, "0");
|
|
1153
|
+
return hours > 0 ? `${hours}:${String(minutes).padStart(2, "0")}:${rest}` : `${minutes}:${rest}`;
|
|
1154
|
+
}
|
|
1155
|
+
function submitFrontendHandoff(doc, handoff) {
|
|
1156
|
+
if (!doc || !handoff || typeof handoff.url !== "string" || typeof handoff.code !== "string") {
|
|
1157
|
+
return false;
|
|
1158
|
+
}
|
|
1159
|
+
let url;
|
|
1160
|
+
try {
|
|
1161
|
+
url = new URL(handoff.url);
|
|
1162
|
+
} catch {
|
|
1163
|
+
return false;
|
|
1164
|
+
}
|
|
1165
|
+
if (url.protocol !== "https:" && url.protocol !== "http:") return false;
|
|
1166
|
+
const form = doc.createElement("form");
|
|
1167
|
+
form.method = "POST";
|
|
1168
|
+
form.action = url.toString();
|
|
1169
|
+
form.target = "_blank";
|
|
1170
|
+
form.rel = "noopener noreferrer";
|
|
1171
|
+
form.style.display = "none";
|
|
1172
|
+
const input = doc.createElement("input");
|
|
1173
|
+
input.type = "hidden";
|
|
1174
|
+
input.name = typeof handoff.field === "string" && handoff.field ? handoff.field : "code";
|
|
1175
|
+
input.value = handoff.code;
|
|
1176
|
+
form.appendChild(input);
|
|
1177
|
+
doc.body.appendChild(form);
|
|
1178
|
+
try {
|
|
1179
|
+
form.submit();
|
|
1180
|
+
} finally {
|
|
1181
|
+
form.remove();
|
|
1182
|
+
}
|
|
1183
|
+
return true;
|
|
1184
|
+
}
|
|
1185
|
+
const dialogs = /* @__PURE__ */ new Map();
|
|
1186
|
+
const mounted = /* @__PURE__ */ new Map();
|
|
1187
|
+
const listeners = /* @__PURE__ */ new Set();
|
|
1188
|
+
const notify = () => {
|
|
1189
|
+
for (const listener of listeners) listener();
|
|
1190
|
+
};
|
|
1191
|
+
function subscribeImpersonationDialogs(listener) {
|
|
1192
|
+
listeners.add(listener);
|
|
1193
|
+
return () => listeners.delete(listener);
|
|
1194
|
+
}
|
|
1195
|
+
function getImpersonationDialog(key) {
|
|
1196
|
+
return dialogs.get(key) || null;
|
|
1197
|
+
}
|
|
1198
|
+
function registerImpersonationPanel(key, instance) {
|
|
1199
|
+
const list = [...mounted.get(key) || [], instance];
|
|
1200
|
+
mounted.set(key, list);
|
|
1201
|
+
const dialog = dialogs.get(key);
|
|
1202
|
+
if (dialog && (!dialog.owner || !list.includes(dialog.owner))) {
|
|
1203
|
+
dialogs.set(key, { ...dialog, owner: instance });
|
|
1204
|
+
notify();
|
|
1205
|
+
}
|
|
1206
|
+
return () => {
|
|
1207
|
+
const rest = (mounted.get(key) || []).filter((id) => id !== instance);
|
|
1208
|
+
if (rest.length) mounted.set(key, rest);
|
|
1209
|
+
else mounted.delete(key);
|
|
1210
|
+
const current = dialogs.get(key);
|
|
1211
|
+
if (current && current.owner === instance) {
|
|
1212
|
+
dialogs.set(key, { ...current, owner: rest[rest.length - 1] || null });
|
|
1213
|
+
notify();
|
|
1214
|
+
}
|
|
1215
|
+
};
|
|
1216
|
+
}
|
|
1217
|
+
function openImpersonationDialog(key, instance) {
|
|
1218
|
+
dialogs.set(key, { open: true, owner: instance, draft: {} });
|
|
1219
|
+
notify();
|
|
1220
|
+
}
|
|
1221
|
+
function saveImpersonationDraft(key, draft) {
|
|
1222
|
+
const current = dialogs.get(key);
|
|
1223
|
+
if (current) dialogs.set(key, { ...current, draft });
|
|
1224
|
+
}
|
|
1225
|
+
function closeImpersonationDialog(key) {
|
|
1226
|
+
if (dialogs.delete(key)) notify();
|
|
1227
|
+
}
|
|
1228
|
+
const REFUSALS = Object.freeze({
|
|
1229
|
+
disabled: ["impersonation.error.disabled", "Impersonation is turned off in the settings."],
|
|
1230
|
+
"already-active": [
|
|
1231
|
+
"impersonation.error.alreadyActive",
|
|
1232
|
+
"An impersonation of this user is already running. End it first."
|
|
1233
|
+
],
|
|
1234
|
+
blocked: ["impersonation.error.blocked", "Blocked accounts cannot be impersonated."],
|
|
1235
|
+
"api-token": ["impersonation.error.apiToken", "API tokens cannot impersonate."]
|
|
1236
|
+
});
|
|
1237
|
+
function useSecondsLeft(expiresAt) {
|
|
1238
|
+
const [now, setNow] = useState(() => Date.now());
|
|
1239
|
+
useEffect(() => {
|
|
1240
|
+
if (!expiresAt) return void 0;
|
|
1241
|
+
const timer = window.setInterval(() => setNow(Date.now()), 1e3);
|
|
1242
|
+
return () => window.clearInterval(timer);
|
|
1243
|
+
}, [expiresAt]);
|
|
1244
|
+
return secondsUntil(expiresAt, now);
|
|
1245
|
+
}
|
|
1246
|
+
const SecretField = ({ label, value, name: name2 }) => {
|
|
1247
|
+
const { t } = useSettingsTranslate();
|
|
1248
|
+
const { toggleNotification } = useNotification();
|
|
1249
|
+
const copy = async () => {
|
|
1250
|
+
try {
|
|
1251
|
+
await copyText(value);
|
|
1252
|
+
toggleNotification({
|
|
1253
|
+
type: "success",
|
|
1254
|
+
message: t("impersonation.result.copied", "Copied to the clipboard.")
|
|
1255
|
+
});
|
|
1256
|
+
} catch {
|
|
1257
|
+
toggleNotification({
|
|
1258
|
+
type: "warning",
|
|
1259
|
+
message: t(
|
|
1260
|
+
"impersonation.result.copyFailed",
|
|
1261
|
+
"Copying failed. Select the text and copy it yourself."
|
|
1262
|
+
)
|
|
1263
|
+
});
|
|
1264
|
+
}
|
|
1265
|
+
};
|
|
1266
|
+
return /* @__PURE__ */ jsxs(Field.Root, { name: name2, children: [
|
|
1267
|
+
/* @__PURE__ */ jsx(Field.Label, { children: label }),
|
|
1268
|
+
/* @__PURE__ */ jsx(
|
|
1269
|
+
TextInput,
|
|
1270
|
+
{
|
|
1271
|
+
value,
|
|
1272
|
+
readOnly: true,
|
|
1273
|
+
onFocus: (event) => event.target.select(),
|
|
1274
|
+
endAction: /* @__PURE__ */ jsx(
|
|
1275
|
+
Field.Action,
|
|
1276
|
+
{
|
|
1277
|
+
label: t("impersonation.result.copy", "Copy {name}", { name: label }),
|
|
1278
|
+
onClick: copy,
|
|
1279
|
+
children: /* @__PURE__ */ jsx(Duplicate, {})
|
|
1280
|
+
}
|
|
1281
|
+
)
|
|
1282
|
+
}
|
|
1283
|
+
)
|
|
1284
|
+
] });
|
|
1285
|
+
};
|
|
1286
|
+
const ImpersonateUserModal = ({
|
|
1287
|
+
open,
|
|
1288
|
+
onOpenChange,
|
|
1289
|
+
onCloseAutoFocus,
|
|
1290
|
+
user,
|
|
1291
|
+
status,
|
|
1292
|
+
onChanged
|
|
1293
|
+
}) => {
|
|
1294
|
+
const { t, tError } = useSettingsTranslate();
|
|
1295
|
+
const { post } = useFetchClient();
|
|
1296
|
+
const { toggleNotification } = useNotification();
|
|
1297
|
+
const notifyHintId = useId();
|
|
1298
|
+
const [saved] = useState(() => getImpersonationDialog(user.documentId)?.draft || {});
|
|
1299
|
+
const [reason, setReason] = useState(saved.reason ?? "");
|
|
1300
|
+
const [minutes, setMinutes] = useState(saved.minutes ?? DEFAULT_IMPERSONATION_MINUTES);
|
|
1301
|
+
const [notifyUser, setNotifyUser] = useState(saved.notifyUser === true);
|
|
1302
|
+
const [touched, setTouched] = useState(false);
|
|
1303
|
+
const [pending, setPending] = useState(null);
|
|
1304
|
+
const [failure, setFailure] = useState(null);
|
|
1305
|
+
const [result, setResult] = useState(saved.result ?? null);
|
|
1306
|
+
useEffect(() => {
|
|
1307
|
+
if (!open) return;
|
|
1308
|
+
saveImpersonationDraft(user.documentId, { reason, minutes, notifyUser, result });
|
|
1309
|
+
}, [open, user.documentId, reason, minutes, notifyUser, result]);
|
|
1310
|
+
const secondsLeft = useSecondsLeft(result?.impersonation?.expiresAt || null);
|
|
1311
|
+
const durations = Array.isArray(status?.durations) ? status.durations : USER_IMPERSONATION_DURATIONS;
|
|
1312
|
+
const reasonError = validateReason(reason);
|
|
1313
|
+
const showReasonError = touched && reasonError;
|
|
1314
|
+
const start = async () => {
|
|
1315
|
+
setTouched(true);
|
|
1316
|
+
if (reasonError) return;
|
|
1317
|
+
setPending("start");
|
|
1318
|
+
setFailure(null);
|
|
1319
|
+
try {
|
|
1320
|
+
const { data } = await post(
|
|
1321
|
+
`/${pluginId}/impersonation/users/${encodeURIComponent(user.documentId)}`,
|
|
1322
|
+
{ reason: reason.trim(), durationMinutes: minutes, notifyUser }
|
|
1323
|
+
);
|
|
1324
|
+
setResult(data?.data || null);
|
|
1325
|
+
onChanged?.();
|
|
1326
|
+
} catch (err) {
|
|
1327
|
+
if (isCancelledRequest(err)) return;
|
|
1328
|
+
const response = err?.response;
|
|
1329
|
+
const reasonCode = response?.data?.error?.details?.reason;
|
|
1330
|
+
if (response?.status === 429) {
|
|
1331
|
+
setFailure(
|
|
1332
|
+
t(
|
|
1333
|
+
"impersonation.error.rateLimited",
|
|
1334
|
+
"Too many impersonations were started. Try again in a few minutes."
|
|
1335
|
+
)
|
|
1336
|
+
);
|
|
1337
|
+
} else if (REFUSALS[reasonCode]) {
|
|
1338
|
+
setFailure(t(...REFUSALS[reasonCode]));
|
|
1339
|
+
} else {
|
|
1340
|
+
logSafeAdminError("impersonation.start", err);
|
|
1341
|
+
setFailure(t("impersonation.error.start", "The impersonation could not be started."));
|
|
1342
|
+
}
|
|
1343
|
+
} finally {
|
|
1344
|
+
setPending(null);
|
|
1345
|
+
}
|
|
1346
|
+
};
|
|
1347
|
+
const end = async () => {
|
|
1348
|
+
if (!result?.impersonation?.id) return;
|
|
1349
|
+
setPending("end");
|
|
1350
|
+
try {
|
|
1351
|
+
await post(`/${pluginId}/impersonation/${result.impersonation.id}/end`, {});
|
|
1352
|
+
toggleNotification({
|
|
1353
|
+
type: "success",
|
|
1354
|
+
message: t("impersonation.ended", "Impersonation ended.")
|
|
1355
|
+
});
|
|
1356
|
+
onChanged?.();
|
|
1357
|
+
onOpenChange(false);
|
|
1358
|
+
} catch (err) {
|
|
1359
|
+
logSafeAdminError("impersonation.end", err);
|
|
1360
|
+
toggleNotification({
|
|
1361
|
+
type: "danger",
|
|
1362
|
+
message: t("impersonation.error.end", "The impersonation could not be ended.")
|
|
1363
|
+
});
|
|
1364
|
+
} finally {
|
|
1365
|
+
setPending(null);
|
|
1366
|
+
}
|
|
1367
|
+
};
|
|
1368
|
+
const openFrontend = () => {
|
|
1369
|
+
setFailure(null);
|
|
1370
|
+
const onViolation = (event) => {
|
|
1371
|
+
if (String(event?.violatedDirective || "").startsWith("form-action")) {
|
|
1372
|
+
setFailure(
|
|
1373
|
+
t(
|
|
1374
|
+
"impersonation.error.csp",
|
|
1375
|
+
"Your Strapi security settings block sending the sign-in to {origin}. Add this origin to form-action of the Content-Security-Policy (see the README), then start again.",
|
|
1376
|
+
{ origin: status?.frontendOrigin || "" }
|
|
1377
|
+
)
|
|
1378
|
+
);
|
|
1379
|
+
}
|
|
1380
|
+
};
|
|
1381
|
+
document.addEventListener("securitypolicyviolation", onViolation);
|
|
1382
|
+
window.setTimeout(
|
|
1383
|
+
() => document.removeEventListener("securitypolicyviolation", onViolation),
|
|
1384
|
+
3e3
|
|
1385
|
+
);
|
|
1386
|
+
if (!submitFrontendHandoff(document, result?.handoff)) {
|
|
1387
|
+
setFailure(t("impersonation.error.frontend", "The frontend could not be opened."));
|
|
1388
|
+
}
|
|
1389
|
+
};
|
|
1390
|
+
const handoff = result?.handoff;
|
|
1391
|
+
const clock = formatClock(secondsLeft);
|
|
1392
|
+
return /* @__PURE__ */ jsx(Modal.Root, { open, onOpenChange, children: /* @__PURE__ */ jsxs(Modal.Content, { onCloseAutoFocus, "aria-describedby": void 0, children: [
|
|
1393
|
+
/* @__PURE__ */ jsx(Modal.Header, { closeLabel: t("common.close", "Close"), children: /* @__PURE__ */ jsx(Modal.Title, { children: result ? t("impersonation.result.title", "Impersonating {user}", { user: user.label }) : t("impersonation.modal.title", "Impersonate {user}", { user: user.label }) }) }),
|
|
1394
|
+
/* @__PURE__ */ jsx(Modal.Body, { children: /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 4, children: [
|
|
1395
|
+
failure ? /* @__PURE__ */ jsx(PersistentAlert, { variant: "danger", closeLabel: t("common.close", "Close"), children: failure }) : null,
|
|
1396
|
+
!result ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1397
|
+
/* @__PURE__ */ jsx(ReadableText, { variant: "omega", textColor: "neutral800", tag: "p", children: t(
|
|
1398
|
+
"impersonation.modal.intro",
|
|
1399
|
+
"You get a short-lived sign-in as this user to reproduce a problem. Password, email address, account and sessions cannot be changed with it. It is recorded in the security log."
|
|
1400
|
+
) }),
|
|
1401
|
+
/* @__PURE__ */ jsxs(
|
|
1402
|
+
Field.Root,
|
|
1403
|
+
{
|
|
1404
|
+
name: "reason",
|
|
1405
|
+
required: true,
|
|
1406
|
+
error: showReasonError ? tError(reasonError) : void 0,
|
|
1407
|
+
hint: t(
|
|
1408
|
+
"impersonation.reason.hint",
|
|
1409
|
+
"Stored in the security log and, if you email the user, shown to them."
|
|
1410
|
+
),
|
|
1411
|
+
children: [
|
|
1412
|
+
/* @__PURE__ */ jsx(Field.Label, { children: t("impersonation.reason.label", "Reason") }),
|
|
1413
|
+
/* @__PURE__ */ jsx(
|
|
1414
|
+
Textarea,
|
|
1415
|
+
{
|
|
1416
|
+
value: reason,
|
|
1417
|
+
maxLength: REASON_MAX,
|
|
1418
|
+
placeholder: t("impersonation.reason.placeholder", "For example: ticket 4711"),
|
|
1419
|
+
onChange: (event) => setReason(event.target.value),
|
|
1420
|
+
onBlur: () => setTouched(true)
|
|
1421
|
+
}
|
|
1422
|
+
),
|
|
1423
|
+
/* @__PURE__ */ jsx(Field.Hint, {}),
|
|
1424
|
+
/* @__PURE__ */ jsx(Field.Error, {})
|
|
1425
|
+
]
|
|
1426
|
+
}
|
|
1427
|
+
),
|
|
1428
|
+
/* @__PURE__ */ jsxs(Field.Root, { name: "durationMinutes", children: [
|
|
1429
|
+
/* @__PURE__ */ jsx(Field.Label, { children: t("impersonation.duration.label", "Duration") }),
|
|
1430
|
+
/* @__PURE__ */ jsx(
|
|
1431
|
+
SingleSelect,
|
|
1432
|
+
{
|
|
1433
|
+
value: String(minutes),
|
|
1434
|
+
onChange: (value) => setMinutes(Number(value)),
|
|
1435
|
+
children: durations.map((value) => /* @__PURE__ */ jsx(SingleSelectOption, { value: String(value), children: t(
|
|
1436
|
+
"impersonation.duration.minutes",
|
|
1437
|
+
"{count, plural, one {# minute} other {# minutes}}",
|
|
1438
|
+
{
|
|
1439
|
+
count: value
|
|
1440
|
+
}
|
|
1441
|
+
) }, value))
|
|
1442
|
+
}
|
|
1443
|
+
)
|
|
1444
|
+
] }),
|
|
1445
|
+
/* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 1, children: [
|
|
1446
|
+
/* @__PURE__ */ jsx(
|
|
1447
|
+
Checkbox,
|
|
1448
|
+
{
|
|
1449
|
+
checked: notifyUser,
|
|
1450
|
+
"aria-describedby": notifyHintId,
|
|
1451
|
+
onCheckedChange: (checked) => setNotifyUser(checked === true),
|
|
1452
|
+
children: t(
|
|
1453
|
+
"impersonation.notify.label",
|
|
1454
|
+
"Email the user that their account was opened"
|
|
1455
|
+
)
|
|
1456
|
+
}
|
|
1457
|
+
),
|
|
1458
|
+
/* @__PURE__ */ jsx(Typography, { id: notifyHintId, variant: "pi", textColor: "neutral600", children: t(
|
|
1459
|
+
"impersonation.notify.hint",
|
|
1460
|
+
"Sent through Strapi’s email plugin, with the reason and the duration."
|
|
1461
|
+
) })
|
|
1462
|
+
] })
|
|
1463
|
+
] }) : null,
|
|
1464
|
+
handoff?.type === "frontend" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1465
|
+
/* @__PURE__ */ jsx(PersistentAlert, { variant: "default", closeLabel: t("common.close", "Close"), children: t(
|
|
1466
|
+
"impersonation.result.frontendBody",
|
|
1467
|
+
"Open {origin} within one minute. The sign-in link works once and is sent without appearing in the address bar.",
|
|
1468
|
+
{ origin: status?.frontendOrigin || "" }
|
|
1469
|
+
) }),
|
|
1470
|
+
/* @__PURE__ */ jsx(Box, { children: /* @__PURE__ */ jsx(Button, { startIcon: /* @__PURE__ */ jsx(ExternalLink, {}), onClick: openFrontend, children: t("impersonation.result.openFrontend", "Open frontend") }) })
|
|
1471
|
+
] }) : null,
|
|
1472
|
+
handoff?.type === "token" ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1473
|
+
/* @__PURE__ */ jsx(PersistentAlert, { variant: "warning", closeLabel: t("common.close", "Close"), children: t(
|
|
1474
|
+
"impersonation.result.tokenBody",
|
|
1475
|
+
"Shown only once. Anyone who has this token acts as {user} until it ends. Do not store or share it.",
|
|
1476
|
+
{ user: user.label }
|
|
1477
|
+
) }),
|
|
1478
|
+
/* @__PURE__ */ jsx(
|
|
1479
|
+
SecretField,
|
|
1480
|
+
{
|
|
1481
|
+
name: "jwt",
|
|
1482
|
+
label: t("impersonation.result.accessToken", "Access token"),
|
|
1483
|
+
value: handoff.jwt
|
|
1484
|
+
}
|
|
1485
|
+
),
|
|
1486
|
+
handoff.refreshToken ? /* @__PURE__ */ jsx(
|
|
1487
|
+
SecretField,
|
|
1488
|
+
{
|
|
1489
|
+
name: "refreshToken",
|
|
1490
|
+
label: t("impersonation.result.refreshToken", "Refresh token"),
|
|
1491
|
+
value: handoff.refreshToken
|
|
1492
|
+
}
|
|
1493
|
+
) : null
|
|
1494
|
+
] }) : null,
|
|
1495
|
+
result ? /* @__PURE__ */ jsx(Typography, { variant: "omega", textColor: "neutral800", tag: "p", "aria-live": "polite", children: t("impersonation.result.endsIn", "Ends in {time}.", { time: clock }) }) : null
|
|
1496
|
+
] }) }),
|
|
1497
|
+
/* @__PURE__ */ jsx(Modal.Footer, { children: result ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1498
|
+
/* @__PURE__ */ jsx(Button, { variant: "danger-light", onClick: end, loading: pending === "end", children: t("impersonation.end", "End impersonation") }),
|
|
1499
|
+
/* @__PURE__ */ jsx(Modal.Close, { children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", children: t("impersonation.result.done", "Done") }) })
|
|
1500
|
+
] }) : /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1501
|
+
/* @__PURE__ */ jsx(Modal.Close, { children: /* @__PURE__ */ jsx(Button, { variant: "tertiary", children: t("common.cancel", "Cancel") }) }),
|
|
1502
|
+
/* @__PURE__ */ jsx(Button, { onClick: start, loading: pending === "start", children: t("impersonation.start", "Start impersonation") })
|
|
1503
|
+
] }) })
|
|
1504
|
+
] }) });
|
|
1505
|
+
};
|
|
1506
|
+
const focusVisibleTrigger = (documentId, fallback) => {
|
|
1507
|
+
const candidates = [
|
|
1508
|
+
...document.querySelectorAll(
|
|
1509
|
+
`[data-impersonation-trigger="${globalThis.CSS?.escape ? globalThis.CSS.escape(documentId) : documentId}"]`
|
|
1510
|
+
)
|
|
1511
|
+
];
|
|
1512
|
+
const visible = candidates.find((node) => node.getClientRects().length > 0);
|
|
1513
|
+
(visible || fallback)?.focus?.();
|
|
1514
|
+
};
|
|
1515
|
+
const ImpersonationPanelSection = ({ documentId, userLabel }) => {
|
|
1516
|
+
const { t } = useSettingsTranslate();
|
|
1517
|
+
const { get, post } = useFetchClient();
|
|
1518
|
+
const { toggleNotification } = useNotification();
|
|
1519
|
+
const { formatDate } = useSessionFormatters();
|
|
1520
|
+
const {
|
|
1521
|
+
isLoading,
|
|
1522
|
+
allowedActions: { canUsers }
|
|
1523
|
+
} = useRBAC(pluginPermissions.impersonateUsers);
|
|
1524
|
+
const [status, setStatus] = useState(null);
|
|
1525
|
+
const [active, setActive] = useState(null);
|
|
1526
|
+
const instance = useId();
|
|
1527
|
+
const dialog = useSyncExternalStore(
|
|
1528
|
+
subscribeImpersonationDialogs,
|
|
1529
|
+
() => getImpersonationDialog(documentId)
|
|
1530
|
+
);
|
|
1531
|
+
const open = dialog?.open === true && dialog.owner === instance;
|
|
1532
|
+
useEffect(() => registerImpersonationPanel(documentId, instance), [documentId, instance]);
|
|
1533
|
+
const triggerRef = useRef(null);
|
|
1534
|
+
const endTriggerRef = useRef(null);
|
|
1535
|
+
const requestRef = useRef(0);
|
|
1536
|
+
const apply = useCallback(
|
|
1537
|
+
async (request, pending) => {
|
|
1538
|
+
try {
|
|
1539
|
+
const [statusResponse, listResponse] = await pending;
|
|
1540
|
+
if (request !== requestRef.current) return;
|
|
1541
|
+
setStatus(statusResponse?.data?.data || null);
|
|
1542
|
+
const rows = Array.isArray(listResponse?.data?.data) ? listResponse.data.data : [];
|
|
1543
|
+
setActive(
|
|
1544
|
+
rows.find((row) => row.targetType === "user" && row.targetId === documentId) || null
|
|
1545
|
+
);
|
|
1546
|
+
} catch (err) {
|
|
1547
|
+
if (isCancelledRequest(err) || request !== requestRef.current) return;
|
|
1548
|
+
logSafeAdminError("impersonation.panel", err);
|
|
1549
|
+
setStatus(null);
|
|
1550
|
+
}
|
|
1551
|
+
},
|
|
1552
|
+
[documentId]
|
|
1553
|
+
);
|
|
1554
|
+
const fetchState = useCallback(
|
|
1555
|
+
() => Promise.all([
|
|
1556
|
+
get(`/${pluginId}/impersonation/status`),
|
|
1557
|
+
get(`/${pluginId}/impersonation/active`)
|
|
1558
|
+
]),
|
|
1559
|
+
[get]
|
|
1560
|
+
);
|
|
1561
|
+
const load = useCallback(() => apply(++requestRef.current, fetchState()), [apply, fetchState]);
|
|
1562
|
+
useEffect(() => {
|
|
1563
|
+
if (isLoading || !canUsers || !documentId) return;
|
|
1564
|
+
apply(++requestRef.current, fetchState());
|
|
1565
|
+
}, [apply, canUsers, documentId, fetchState, isLoading]);
|
|
1566
|
+
if (isLoading || !canUsers || !status?.enabled) return null;
|
|
1567
|
+
const end = async () => {
|
|
1568
|
+
try {
|
|
1569
|
+
await post(`/${pluginId}/impersonation/${active.id}/end`, {});
|
|
1570
|
+
toggleNotification({
|
|
1571
|
+
type: "success",
|
|
1572
|
+
message: t("impersonation.ended", "Impersonation ended.")
|
|
1573
|
+
});
|
|
1574
|
+
} catch (err) {
|
|
1575
|
+
logSafeAdminError("impersonation.end", err);
|
|
1576
|
+
toggleNotification({
|
|
1577
|
+
type: "danger",
|
|
1578
|
+
message: t("impersonation.error.end", "The impersonation could not be ended.")
|
|
1579
|
+
});
|
|
1580
|
+
throw err;
|
|
1581
|
+
} finally {
|
|
1582
|
+
await load();
|
|
1583
|
+
}
|
|
1584
|
+
};
|
|
1585
|
+
return /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, "data-panel-impersonation": "", children: [
|
|
1586
|
+
/* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", tag: "h3", children: t("impersonation.panel.title", "Impersonation") }),
|
|
1587
|
+
active ? /* @__PURE__ */ jsxs(Fragment, { children: [
|
|
1588
|
+
/* @__PURE__ */ jsx(Typography, { variant: "pi", textColor: "neutral800", tag: "p", children: t("impersonation.panel.running", "Running until {time}.", {
|
|
1589
|
+
time: formatDate(active.expiresAt, { hour: "2-digit", minute: "2-digit" })
|
|
1590
|
+
}) }),
|
|
1591
|
+
/* @__PURE__ */ jsx(
|
|
1592
|
+
ConfirmAction,
|
|
1593
|
+
{
|
|
1594
|
+
title: t("impersonation.confirm.title", "End the impersonation of {user}?", {
|
|
1595
|
+
user: userLabel
|
|
1596
|
+
}),
|
|
1597
|
+
body: t(
|
|
1598
|
+
"impersonation.confirm.body",
|
|
1599
|
+
"The short-lived sign-in stops working at once. This is recorded in the security log."
|
|
1600
|
+
),
|
|
1601
|
+
confirmLabel: t("impersonation.end", "End impersonation"),
|
|
1602
|
+
onConfirm: end,
|
|
1603
|
+
fallbackFocusRef: triggerRef,
|
|
1604
|
+
trigger: /* @__PURE__ */ jsx(
|
|
1605
|
+
Button,
|
|
1606
|
+
{
|
|
1607
|
+
ref: endTriggerRef,
|
|
1608
|
+
"data-impersonation-trigger": documentId,
|
|
1609
|
+
fullWidth: true,
|
|
1610
|
+
size: "S",
|
|
1611
|
+
variant: "danger-light",
|
|
1612
|
+
startIcon: /* @__PURE__ */ jsx(SignOut, { "aria-hidden": true, focusable: false }),
|
|
1613
|
+
type: "button",
|
|
1614
|
+
children: t("impersonation.end", "End impersonation")
|
|
1615
|
+
}
|
|
1616
|
+
)
|
|
1617
|
+
}
|
|
1618
|
+
)
|
|
1619
|
+
] }) : /* @__PURE__ */ jsx(
|
|
1620
|
+
Button,
|
|
1621
|
+
{
|
|
1622
|
+
ref: triggerRef,
|
|
1623
|
+
"data-impersonation-trigger": documentId,
|
|
1624
|
+
fullWidth: true,
|
|
1625
|
+
size: "S",
|
|
1626
|
+
variant: "secondary",
|
|
1627
|
+
startIcon: /* @__PURE__ */ jsx(User, { "aria-hidden": true, focusable: false }),
|
|
1628
|
+
onClick: () => openImpersonationDialog(documentId, instance),
|
|
1629
|
+
type: "button",
|
|
1630
|
+
children: t("impersonation.panel.start", "Impersonate…")
|
|
1631
|
+
}
|
|
1632
|
+
),
|
|
1633
|
+
open ? /* @__PURE__ */ jsx(
|
|
1634
|
+
ImpersonateUserModal,
|
|
1635
|
+
{
|
|
1636
|
+
open: true,
|
|
1637
|
+
onOpenChange: (next) => {
|
|
1638
|
+
if (!next) {
|
|
1639
|
+
closeImpersonationDialog(documentId);
|
|
1640
|
+
load();
|
|
1641
|
+
window.setTimeout(
|
|
1642
|
+
() => focusVisibleTrigger(documentId, triggerRef.current || endTriggerRef.current),
|
|
1643
|
+
0
|
|
1644
|
+
);
|
|
1645
|
+
}
|
|
1646
|
+
},
|
|
1647
|
+
onCloseAutoFocus: (event) => {
|
|
1648
|
+
event.preventDefault();
|
|
1649
|
+
focusVisibleTrigger(documentId, triggerRef.current || endTriggerRef.current);
|
|
1650
|
+
},
|
|
1651
|
+
user: { documentId, label: userLabel },
|
|
1652
|
+
status,
|
|
1653
|
+
onChanged: load
|
|
1654
|
+
}
|
|
1655
|
+
) : null
|
|
1656
|
+
] });
|
|
1657
|
+
};
|
|
1052
1658
|
function requireSessionList(payload) {
|
|
1053
1659
|
if (!Array.isArray(payload?.data)) throw new Error("Invalid session response");
|
|
1054
1660
|
return payload.data;
|
|
@@ -1138,43 +1744,6 @@ function applyBlockedFormSync(plan, form) {
|
|
|
1138
1744
|
}
|
|
1139
1745
|
return false;
|
|
1140
1746
|
}
|
|
1141
|
-
const pluginPermissions = {
|
|
1142
|
-
access: [{ action: `plugin::${pluginId}.access`, subject: null }],
|
|
1143
|
-
/** Strapi admin panel sessions (view). The server also requires `access`. */
|
|
1144
|
-
adminSessionsRead: [{ action: `plugin::${pluginId}.admin-sessions.read`, subject: null }],
|
|
1145
|
-
/** Signing admins out. The server also requires `access` and `admin-sessions.read`. */
|
|
1146
|
-
adminSessionsRevoke: [{ action: `plugin::${pluginId}.admin-sessions.revoke`, subject: null }],
|
|
1147
|
-
/** Admin sign-in history and Content Manager activity. The server also requires `access` and `admin-sessions.read`. */
|
|
1148
|
-
adminActivityRead: [{ action: `plugin::${pluginId}.admin-activity.read`, subject: null }],
|
|
1149
|
-
/**
|
|
1150
|
-
* Protected settings (4.17): location lookup, webhooks and the security log.
|
|
1151
|
-
* The server also requires `access` (and `admin-activity.read` for the log).
|
|
1152
|
-
*/
|
|
1153
|
-
settingsUpdate: [{ action: `plugin::${pluginId}.settings.update`, subject: null }],
|
|
1154
|
-
/** Lifting a sign-in lock. The server also requires `access`. */
|
|
1155
|
-
lockoutsUnlock: [{ action: `plugin::${pluginId}.lockouts.unlock`, subject: null }]
|
|
1156
|
-
};
|
|
1157
|
-
const SAFE_SCOPE = /^[A-Za-z0-9_.:-]{1,48}$/;
|
|
1158
|
-
const CANCEL_NAMES = /* @__PURE__ */ new Set(["AbortError", "TimeoutError", "CanceledError"]);
|
|
1159
|
-
function safeGet(value, key) {
|
|
1160
|
-
try {
|
|
1161
|
-
return value && typeof value === "object" ? value[key] : void 0;
|
|
1162
|
-
} catch {
|
|
1163
|
-
return void 0;
|
|
1164
|
-
}
|
|
1165
|
-
}
|
|
1166
|
-
function isCancelledRequest(error) {
|
|
1167
|
-
const name2 = safeGet(error, "name");
|
|
1168
|
-
return typeof name2 === "string" && CANCEL_NAMES.has(name2);
|
|
1169
|
-
}
|
|
1170
|
-
function logSafeAdminError(scope, error) {
|
|
1171
|
-
if (isCancelledRequest(error)) return;
|
|
1172
|
-
const safeScope = typeof scope === "string" && SAFE_SCOPE.test(scope) ? scope : "admin";
|
|
1173
|
-
const directStatus = safeGet(error, "status");
|
|
1174
|
-
const status = Number.isInteger(directStatus) ? directStatus : safeGet(safeGet(error, "response"), "status");
|
|
1175
|
-
const statusSuffix = Number.isInteger(status) && status >= 400 && status <= 599 ? ` (HTTP ${status})` : "";
|
|
1176
|
-
console.warn(`[${safeScope}] Request failed${statusSuffix}`);
|
|
1177
|
-
}
|
|
1178
1747
|
const FORM_CONSUMER = "MagicSessionManagerPanel";
|
|
1179
1748
|
const PanelSessionCard = ({ session, t }) => {
|
|
1180
1749
|
const { formatDate, formatRelativeTime, translate } = useSessionFormatters();
|
|
@@ -1541,6 +2110,7 @@ const SessionInfoPanel = ({ documentId, model, document: document2 }) => {
|
|
|
1541
2110
|
"End all sessions lets the user sign in again. Block user also prevents new sign-ins."
|
|
1542
2111
|
) })
|
|
1543
2112
|
] }),
|
|
2113
|
+
userId ? /* @__PURE__ */ jsx(ImpersonationPanelSection, { documentId: String(userId), userLabel }) : null,
|
|
1544
2114
|
loading ? null : /* @__PURE__ */ jsxs(Flex, { direction: "column", alignItems: "stretch", gap: 2, "data-panel-sessions": "", children: [
|
|
1545
2115
|
/* @__PURE__ */ jsx(Typography, { variant: "sigma", textColor: "neutral600", tag: "h3", children: t("panel.sessions.openTitle", "Open sessions") }),
|
|
1546
2116
|
visible.length > 0 ? /* @__PURE__ */ jsx(
|
|
@@ -1588,7 +2158,7 @@ const index = {
|
|
|
1588
2158
|
id: `${pluginId}.plugin.name`,
|
|
1589
2159
|
defaultMessage: pluginPkg.strapi.displayName
|
|
1590
2160
|
},
|
|
1591
|
-
Component: () => import("./App-
|
|
2161
|
+
Component: () => import("./App-BswHmNQT.mjs"),
|
|
1592
2162
|
permissions: pluginPermissions$1
|
|
1593
2163
|
});
|
|
1594
2164
|
app.addSettingsLink(
|
|
@@ -1604,7 +2174,7 @@ const index = {
|
|
|
1604
2174
|
},
|
|
1605
2175
|
id: "general",
|
|
1606
2176
|
to: `${pluginId}/general`,
|
|
1607
|
-
Component: () => import("./Settings-
|
|
2177
|
+
Component: () => import("./Settings-DZyQheUS.mjs"),
|
|
1608
2178
|
permissions: pluginPermissions$1
|
|
1609
2179
|
},
|
|
1610
2180
|
{
|
|
@@ -1614,7 +2184,7 @@ const index = {
|
|
|
1614
2184
|
},
|
|
1615
2185
|
id: "analytics",
|
|
1616
2186
|
to: `${pluginId}/analytics`,
|
|
1617
|
-
Component: () => import("./Analytics-
|
|
2187
|
+
Component: () => import("./Analytics-C-OLLzoB.mjs"),
|
|
1618
2188
|
permissions: pluginPermissions$1
|
|
1619
2189
|
}
|
|
1620
2190
|
]
|
|
@@ -1640,7 +2210,7 @@ const index = {
|
|
|
1640
2210
|
href: `/plugins/${pluginId}`
|
|
1641
2211
|
},
|
|
1642
2212
|
component: async () => {
|
|
1643
|
-
const component = await import("./OnlineUsersWidget-
|
|
2213
|
+
const component = await import("./OnlineUsersWidget-Dusgjc1d.mjs");
|
|
1644
2214
|
return component.default;
|
|
1645
2215
|
},
|
|
1646
2216
|
id: "online-users-widget",
|
|
@@ -1661,11 +2231,11 @@ const index = {
|
|
|
1661
2231
|
},
|
|
1662
2232
|
async registerTrads({ locales }) {
|
|
1663
2233
|
const importedTrads = {
|
|
1664
|
-
en: () => import("./en-
|
|
1665
|
-
de: () => import("./de-
|
|
1666
|
-
es: () => import("./es-
|
|
1667
|
-
fr: () => import("./fr-
|
|
1668
|
-
pt: () => import("./pt-
|
|
2234
|
+
en: () => import("./en-D8J__tyF.mjs"),
|
|
2235
|
+
de: () => import("./de-DUnrmFWk.mjs"),
|
|
2236
|
+
es: () => import("./es-BgpgWdk0.mjs"),
|
|
2237
|
+
fr: () => import("./fr-k1MHYKJo.mjs"),
|
|
2238
|
+
pt: () => import("./pt-DPO4DmDc.mjs")
|
|
1669
2239
|
};
|
|
1670
2240
|
const translatedLanguages = Object.keys(importedTrads).filter((lang) => locales.includes(lang));
|
|
1671
2241
|
const translations = await Promise.all(
|
|
@@ -1683,25 +2253,31 @@ const index = {
|
|
|
1683
2253
|
}
|
|
1684
2254
|
};
|
|
1685
2255
|
export {
|
|
1686
|
-
|
|
1687
|
-
|
|
2256
|
+
validateReason as A,
|
|
2257
|
+
REASON_MAX as B,
|
|
1688
2258
|
ConfirmAction as C,
|
|
1689
2259
|
DeviceIcon as D,
|
|
1690
2260
|
END_REASON_FILTER_OPTIONS as E,
|
|
1691
|
-
|
|
1692
|
-
|
|
1693
|
-
|
|
1694
|
-
|
|
1695
|
-
|
|
1696
|
-
|
|
1697
|
-
|
|
2261
|
+
formatClock as F,
|
|
2262
|
+
ReadableParagraphs as G,
|
|
2263
|
+
EqualGrid as H,
|
|
2264
|
+
formatSessionDate as I,
|
|
2265
|
+
refocusIfLost as J,
|
|
2266
|
+
copyText as K,
|
|
2267
|
+
requireSuccessfulMutation as L,
|
|
1698
2268
|
MissingValue as M,
|
|
1699
|
-
|
|
2269
|
+
isSessionFilter as N,
|
|
2270
|
+
DEFAULT_SESSION_FILTER as O,
|
|
1700
2271
|
PropertyList as P,
|
|
2272
|
+
isEndReasonFilter as Q,
|
|
1701
2273
|
ReadableText as R,
|
|
1702
2274
|
StatusBadge as S,
|
|
1703
2275
|
TargetLink as T,
|
|
2276
|
+
DEFAULT_END_REASON_FILTER as U,
|
|
1704
2277
|
ValueOrMissing as V,
|
|
2278
|
+
normalizeDeviceType as W,
|
|
2279
|
+
getDeviceTypeMessage as X,
|
|
2280
|
+
index as Y,
|
|
1705
2281
|
getEndReasonPresentation as a,
|
|
1706
2282
|
getTranslation as b,
|
|
1707
2283
|
getSessionStatus as c,
|
|
@@ -1726,6 +2302,6 @@ export {
|
|
|
1726
2302
|
restoreDialogFocus as v,
|
|
1727
2303
|
requireSessionList as w,
|
|
1728
2304
|
getBadgeColors as x,
|
|
1729
|
-
|
|
1730
|
-
|
|
2305
|
+
useSettingsTranslate as y,
|
|
2306
|
+
useSecondsLeft as z
|
|
1731
2307
|
};
|