strapi-plugin-magic-sessionmanager 4.21.0 → 4.22.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 +48 -0
- package/README.md +46 -11
- package/dist/admin/{Analytics-BqdZIBV4.js → Analytics-DeDLGiCe.js} +1 -1
- package/dist/admin/{Analytics-C-OLLzoB.mjs → Analytics-WbCUmkQQ.mjs} +1 -1
- package/dist/admin/{App-Cx9v6n_7.js → App-Bkv-W0Sv.js} +1336 -2591
- package/dist/admin/{App-BswHmNQT.mjs → App-C4bihk2K.mjs} +1309 -2564
- package/dist/admin/{OnlineUsersWidget-BRmQPPp9.js → OnlineUsersWidget-CSvNe2rC.js} +1 -1
- package/dist/admin/{OnlineUsersWidget-Dusgjc1d.mjs → OnlineUsersWidget-q0Z6nbbO.mjs} +1 -1
- package/dist/admin/{Settings-DZyQheUS.mjs → Settings-avD0DbXP.mjs} +2 -2
- package/dist/admin/{Settings-DWGuf_Z3.js → Settings-xokFI5LO.js} +44 -44
- package/dist/admin/dashboardModel-BBNRgcEr.mjs +170 -0
- package/dist/admin/dashboardModel-D4389iIV.js +169 -0
- package/dist/admin/{de-DUnrmFWk.mjs → de-BQlEdBMr.mjs} +73 -4
- package/dist/admin/{de-24TPqzG6.js → de-HcJ19LKI.js} +73 -4
- package/dist/admin/{en-8mBSkWOF.js → en-DI-98CPM.js} +74 -5
- package/dist/admin/{en-D8J__tyF.mjs → en-DzuXWL1W.mjs} +74 -5
- package/dist/admin/{es-BgpgWdk0.mjs → es-BfyED9YI.mjs} +73 -4
- package/dist/admin/{es-ChUKey-Q.js → es-Cm0Eklav.js} +73 -4
- package/dist/admin/{fr-DE_CWmgq.js → fr-C3nzszsI.js} +73 -4
- package/dist/admin/{fr-k1MHYKJo.mjs → fr-CzFNGWq0.mjs} +73 -4
- package/dist/admin/index-6zc5D8eb.mjs +4729 -0
- package/dist/admin/index-Dk5Jqe5U.js +4730 -0
- package/dist/admin/index.js +1 -1
- package/dist/admin/index.mjs +2 -2
- package/dist/admin/{pt-BjqU5ioB.js → pt-BPZ6chPT.js} +73 -4
- package/dist/admin/{pt-DPO4DmDc.mjs → pt-DmyQnGI_.mjs} +73 -4
- package/dist/server/index.js +552 -55
- package/dist/server/index.mjs +552 -55
- package/package.json +1 -1
- package/dist/admin/index-Ceh3Q1Ki.js +0 -2308
- package/dist/admin/index-meLDPPwt.mjs +0 -2307
- package/dist/admin/settingsTabs-C1q5iMMw.mjs +0 -437
- package/dist/admin/settingsTabs-CfquZuKH.js +0 -436
|
@@ -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-Dk5Jqe5U.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 { l as logSafeAdminError,
|
|
9
|
+
import { l as logSafeAdminError, F as isCancelledRequest, b as getTranslation, R as ReadableText, M as MissingValue } from "./index-6zc5D8eb.mjs";
|
|
10
10
|
function normalizeUserCounts(response) {
|
|
11
11
|
const totalUsers = response?.data?.totalUsers;
|
|
12
12
|
const blockedUsers = response?.data?.blockedUsers;
|
|
@@ -4,10 +4,10 @@ import { Field, Typography, Switch, Box, TextInput, Flex, Button, Link, SingleSe
|
|
|
4
4
|
import { useFetchClient, useNotification, useRBAC, ConfirmDialog, useQueryParams, Page, Form, Blocker, useForm } from "@strapi/strapi/admin";
|
|
5
5
|
import { EyeStriked, Eye, Key, Duplicate, Plus, Pencil, Trash, Lock, ArrowClockwise, Cross, Download, Check, SignOut } from "@strapi/icons";
|
|
6
6
|
import styled from "styled-components";
|
|
7
|
-
import {
|
|
7
|
+
import { ar as ReadableParagraphs, a1 as useSettingsTranslate, l as logSafeAdminError, as as buildTabSearch, R as ReadableText, at as buildSelectOptions, L as useElementWidth, f as pluginId, F as isCancelledRequest, h as PersistentAlert, au as EqualGrid, av as SELECT_PRESETS, u as useSessionFormatters, j as pluginPermissions, C as ConfirmAction, aw as fieldHasError, ax as usesLocalDatabase, P as PropertyList, ay as formatSessionDate, az as refocusIfLost, aA as getErrorTab, aB as copyText, aC as buildSavePayload, aD as SETTINGS_FIELD_LABELS, aE as requireSuccessfulMutation, aF as getVisibleSettingsTabs, aG as resolveSettingsTab, aH as getRevealScrollDelta, Q as PageShell, aI as SETTINGS_TAB_LABELS } from "./index-6zc5D8eb.mjs";
|
|
8
8
|
import "react-intl";
|
|
9
|
-
import { v as buildTabSearch, x as buildSelectOptions, u as useElementWidth, b as RowActions, s as shouldIsolateActionKey, y as SELECT_PRESETS, z as fieldHasError, B as getRiskAvailability, C as riskDependentControl, E as usesLocalDatabase, F as getErrorTab, G as buildSavePayload, q as SETTINGS_FIELD_LABELS, H as getVisibleSettingsTabs, I as resolveSettingsTab, J as getRevealScrollDelta, t as SETTINGS_TAB_LABELS } from "./settingsTabs-C1q5iMMw.mjs";
|
|
10
9
|
import { S as SectionCard } from "./SectionCard-D51bv4Hi.mjs";
|
|
10
|
+
import { b as RowActions, s as shouldIsolateActionKey, o as getRiskAvailability, q as riskDependentControl } from "./dashboardModel-BBNRgcEr.mjs";
|
|
11
11
|
import { EmptyPermissions } from "@strapi/icons/symbols";
|
|
12
12
|
const FieldFrame = styled.div`
|
|
13
13
|
width: 100%;
|
|
@@ -6,10 +6,10 @@ const designSystem = require("@strapi/design-system");
|
|
|
6
6
|
const StrapiAdmin = require("@strapi/strapi/admin");
|
|
7
7
|
const icons = require("@strapi/icons");
|
|
8
8
|
const styled = require("styled-components");
|
|
9
|
-
const index = require("./index-
|
|
9
|
+
const index = require("./index-Dk5Jqe5U.js");
|
|
10
10
|
require("react-intl");
|
|
11
|
-
const settingsTabs = require("./settingsTabs-CfquZuKH.js");
|
|
12
11
|
const SectionCard = require("./SectionCard-BlWv8CRt.js");
|
|
12
|
+
const dashboardModel = require("./dashboardModel-D4389iIV.js");
|
|
13
13
|
const symbols = require("@strapi/icons/symbols");
|
|
14
14
|
const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
|
|
15
15
|
const styled__default = /* @__PURE__ */ _interopDefault(styled);
|
|
@@ -405,7 +405,7 @@ const SettingsTabLink = ({ tab, children }) => {
|
|
|
405
405
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
406
406
|
TabLink,
|
|
407
407
|
{
|
|
408
|
-
href:
|
|
408
|
+
href: index.buildTabSearch(search, tab),
|
|
409
409
|
onClick: (event) => {
|
|
410
410
|
if (event.metaKey || event.ctrlKey || event.shiftKey || event.altKey || event.button !== 0)
|
|
411
411
|
return;
|
|
@@ -488,7 +488,7 @@ const PresetSelect = ({
|
|
|
488
488
|
disabled = false
|
|
489
489
|
}) => {
|
|
490
490
|
const { custom } = useOptionLabels();
|
|
491
|
-
const options =
|
|
491
|
+
const options = index.buildSelectOptions(presets, value);
|
|
492
492
|
return /* @__PURE__ */ jsxRuntime.jsx(FormField, { id, name, label, description, error, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
493
493
|
designSystem.SingleSelect,
|
|
494
494
|
{
|
|
@@ -684,7 +684,7 @@ function sortLocks(locks) {
|
|
|
684
684
|
}
|
|
685
685
|
const TABLE_MIN_WIDTH$2 = 640;
|
|
686
686
|
const keepActionKeys$2 = (event) => {
|
|
687
|
-
if (
|
|
687
|
+
if (dashboardModel.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
|
|
688
688
|
};
|
|
689
689
|
const EMPTY_DRAFT = Object.freeze({
|
|
690
690
|
role: "",
|
|
@@ -712,7 +712,7 @@ const RoleRulesSection = ({ form }) => {
|
|
|
712
712
|
const [showErrors, setShowErrors] = react.useState(false);
|
|
713
713
|
const addRef = react.useRef(null);
|
|
714
714
|
const returnFocusRef = react.useRef(null);
|
|
715
|
-
const [widthRef, width] =
|
|
715
|
+
const [widthRef, width] = index.useElementWidth();
|
|
716
716
|
react.useEffect(() => {
|
|
717
717
|
let active = true;
|
|
718
718
|
get(`/${index.pluginId}/roles`).then(({ data }) => {
|
|
@@ -773,7 +773,7 @@ const RoleRulesSection = ({ form }) => {
|
|
|
773
773
|
const asTable = width === 0 || width >= TABLE_MIN_WIDTH$2;
|
|
774
774
|
const actions = (rule) => {
|
|
775
775
|
const name = roleName(rule.role);
|
|
776
|
-
return /* @__PURE__ */ jsxRuntime.jsxs(
|
|
776
|
+
return /* @__PURE__ */ jsxRuntime.jsxs(dashboardModel.RowActions, { onKeyDown: keepActionKeys$2, children: [
|
|
777
777
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
778
778
|
designSystem.IconButton,
|
|
779
779
|
{
|
|
@@ -1044,7 +1044,7 @@ const SessionsTab = ({ form }) => {
|
|
|
1044
1044
|
"A session unused for this long becomes idle and ends as 'Timed out' on its next request or at the next idle check. Also decides who counts as online."
|
|
1045
1045
|
),
|
|
1046
1046
|
value: settings.inactivityTimeout,
|
|
1047
|
-
presets:
|
|
1047
|
+
presets: index.SELECT_PRESETS.inactivityTimeout,
|
|
1048
1048
|
format: units.minutes,
|
|
1049
1049
|
onChange: (value) => handleChange("inactivityTimeout", value)
|
|
1050
1050
|
}
|
|
@@ -1060,7 +1060,7 @@ const SessionsTab = ({ form }) => {
|
|
|
1060
1060
|
"Counted from sign-in, regardless of activity. Applied on the session's next request; until then the session can still show as active or idle."
|
|
1061
1061
|
),
|
|
1062
1062
|
value: settings.maxSessionAgeDays,
|
|
1063
|
-
presets:
|
|
1063
|
+
presets: index.SELECT_PRESETS.maxSessionAgeDays,
|
|
1064
1064
|
format: units.days,
|
|
1065
1065
|
onChange: (value) => handleChange("maxSessionAgeDays", value)
|
|
1066
1066
|
}
|
|
@@ -1082,7 +1082,7 @@ const SessionsTab = ({ form }) => {
|
|
|
1082
1082
|
"Lower values make 'Last active' and idle detection more precise but write to the database more often."
|
|
1083
1083
|
),
|
|
1084
1084
|
value: settings.lastSeenRateLimit,
|
|
1085
|
-
presets:
|
|
1085
|
+
presets: index.SELECT_PRESETS.lastSeenRateLimit,
|
|
1086
1086
|
format: units.seconds,
|
|
1087
1087
|
onChange: (value) => handleChange("lastSeenRateLimit", value)
|
|
1088
1088
|
}
|
|
@@ -1103,7 +1103,7 @@ const SessionsTab = ({ form }) => {
|
|
|
1103
1103
|
"The idle check ends idle sessions as 'Timed out'. It deletes nothing. It also runs once at server start."
|
|
1104
1104
|
),
|
|
1105
1105
|
value: settings.cleanupInterval,
|
|
1106
|
-
presets:
|
|
1106
|
+
presets: index.SELECT_PRESETS.cleanupInterval,
|
|
1107
1107
|
format: units.minutes,
|
|
1108
1108
|
onChange: (value) => handleChange("cleanupInterval", value)
|
|
1109
1109
|
}
|
|
@@ -1190,7 +1190,7 @@ const SessionsTab = ({ form }) => {
|
|
|
1190
1190
|
"Accepts a new token for a few seconds while its session record is being created. Only for tokens without a session record. Not used when Strapi's refresh-token mode (jwtManagement: 'refresh') is on."
|
|
1191
1191
|
),
|
|
1192
1192
|
value: settings.sessionCreationGraceMs ?? 5e3,
|
|
1193
|
-
presets:
|
|
1193
|
+
presets: index.SELECT_PRESETS.sessionCreationGraceMs,
|
|
1194
1194
|
format: units.graceMs,
|
|
1195
1195
|
onChange: (value) => handleChange("sessionCreationGraceMs", value)
|
|
1196
1196
|
}
|
|
@@ -2231,7 +2231,7 @@ function getAdjustedFields(submitted, stored, previous) {
|
|
|
2231
2231
|
}
|
|
2232
2232
|
const TABLE_MIN_WIDTH$1 = 640;
|
|
2233
2233
|
const keepActionKeys$1 = (event) => {
|
|
2234
|
-
if (
|
|
2234
|
+
if (dashboardModel.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
|
|
2235
2235
|
};
|
|
2236
2236
|
const LockTarget = ({ lock }) => {
|
|
2237
2237
|
const { t } = index.useSettingsTranslate();
|
|
@@ -2293,7 +2293,7 @@ const LockedNowCard = () => {
|
|
|
2293
2293
|
isLoading: permissionsLoading,
|
|
2294
2294
|
allowedActions: { canUnlock }
|
|
2295
2295
|
} = StrapiAdmin.useRBAC(index.pluginPermissions.lockoutsUnlock);
|
|
2296
|
-
const [widthRef, width] =
|
|
2296
|
+
const [widthRef, width] = index.useElementWidth();
|
|
2297
2297
|
const [locks, setLocks] = react.useState(null);
|
|
2298
2298
|
const [error, setError] = react.useState(false);
|
|
2299
2299
|
const [refreshing, setRefreshing] = react.useState(false);
|
|
@@ -2417,7 +2417,7 @@ const LockedNowCard = () => {
|
|
|
2417
2417
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(KindBadge, { kind: lock.kind }) }),
|
|
2418
2418
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", children: lock.failures }) }),
|
|
2419
2419
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: ends(lock) }),
|
|
2420
|
-
showActions ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
2420
|
+
showActions ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(dashboardModel.RowActions, { onKeyDown: keepActionKeys$1, children: unlockAction(lock) }) }) : null
|
|
2421
2421
|
] }, lock.id)) })
|
|
2422
2422
|
] }) });
|
|
2423
2423
|
} else {
|
|
@@ -2440,7 +2440,7 @@ const LockedNowCard = () => {
|
|
|
2440
2440
|
}) })
|
|
2441
2441
|
] })
|
|
2442
2442
|
] }),
|
|
2443
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2443
|
+
/* @__PURE__ */ jsxRuntime.jsx(dashboardModel.RowActions, { onKeyDown: keepActionKeys$1, children: unlockAction(lock) })
|
|
2444
2444
|
] })
|
|
2445
2445
|
},
|
|
2446
2446
|
lock.id
|
|
@@ -2612,7 +2612,7 @@ const ImpossibleTravelCard = ({ form }) => {
|
|
|
2612
2612
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
2613
2613
|
AdvancedSection,
|
|
2614
2614
|
{
|
|
2615
|
-
hasError:
|
|
2615
|
+
hasError: index.fieldHasError(errors, "impossibleTravelSpeedKmh") || index.fieldHasError(errors, "impossibleTravelMinDistanceKm"),
|
|
2616
2616
|
disabled: !enabled,
|
|
2617
2617
|
children: /* @__PURE__ */ jsxRuntime.jsxs(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: [
|
|
2618
2618
|
/* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -3117,8 +3117,8 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
3117
3117
|
const lookupOff = !settings.enableGeolocation;
|
|
3118
3118
|
const locked = form.canChangeProtected === false;
|
|
3119
3119
|
const policyLocked = locked;
|
|
3120
|
-
const risk =
|
|
3121
|
-
const reject =
|
|
3120
|
+
const risk = dashboardModel.getRiskAvailability(form.geoIp.status);
|
|
3121
|
+
const reject = dashboardModel.riskDependentControl(settings.blockSuspiciousSessions, risk.state);
|
|
3122
3122
|
const autoStillRejects = reject.savedOnButInactive && (settings.geoLookupFailureMode || "auto") === "auto";
|
|
3123
3123
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
3124
3124
|
/* @__PURE__ */ jsxRuntime.jsx(IntroText, { children: t(
|
|
@@ -3297,7 +3297,7 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
3297
3297
|
AdvancedSection,
|
|
3298
3298
|
{
|
|
3299
3299
|
label: t("settings.config.failed.trusted.section", "Trusted addresses"),
|
|
3300
|
-
hasError:
|
|
3300
|
+
hasError: index.fieldHasError(errors, "lockoutTrustedAddresses"),
|
|
3301
3301
|
children: /* @__PURE__ */ jsxRuntime.jsx(TrustedAddressesField, { form, disabled: policyLocked })
|
|
3302
3302
|
}
|
|
3303
3303
|
)
|
|
@@ -3368,7 +3368,7 @@ const LoginProtectionTab = ({ form }) => {
|
|
|
3368
3368
|
children: !lookupOff && reject.disabled ? /* @__PURE__ */ jsxRuntime.jsx(RiskSourceNotice, { savedOn: reject.savedOnButInactive }) : null
|
|
3369
3369
|
}
|
|
3370
3370
|
),
|
|
3371
|
-
/* @__PURE__ */ jsxRuntime.jsxs(AdvancedSection, { hasError:
|
|
3371
|
+
/* @__PURE__ */ jsxRuntime.jsxs(AdvancedSection, { hasError: index.fieldHasError(errors, "geoLookupFailureMode"), children: [
|
|
3372
3372
|
/* @__PURE__ */ jsxRuntime.jsx(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3373
3373
|
FormField,
|
|
3374
3374
|
{
|
|
@@ -3510,7 +3510,7 @@ const GeoIpDatabaseCard = ({ form }) => {
|
|
|
3510
3510
|
};
|
|
3511
3511
|
const lookupOff = !settings.enableGeolocation;
|
|
3512
3512
|
const locked = form.canChangeProtected === false;
|
|
3513
|
-
const localDatabase =
|
|
3513
|
+
const localDatabase = index.usesLocalDatabase(settings.geoIpProvider);
|
|
3514
3514
|
const databaseDisabled = lookupOff || !localDatabase;
|
|
3515
3515
|
const credentialSource = geoIpStatus?.credentialSource;
|
|
3516
3516
|
const fromEnvironment = credentialSource === "env";
|
|
@@ -3727,7 +3727,7 @@ const GeoIpDatabaseCard = ({ form }) => {
|
|
|
3727
3727
|
"Save your changes first, so the download uses the current settings."
|
|
3728
3728
|
) }) : null
|
|
3729
3729
|
] }),
|
|
3730
|
-
/* @__PURE__ */ jsxRuntime.jsx(AdvancedSection, { hasError:
|
|
3730
|
+
/* @__PURE__ */ jsxRuntime.jsx(AdvancedSection, { hasError: index.fieldHasError(errors, "geoIpDatabasePath"), children: /* @__PURE__ */ jsxRuntime.jsx(index.EqualGrid, { columns: 2, stackBelow: "medium", gap: 6, children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
3731
3731
|
FormField,
|
|
3732
3732
|
{
|
|
3733
3733
|
id: "geoip-database-filename",
|
|
@@ -3830,7 +3830,7 @@ const RiskDataCard = ({ form }) => {
|
|
|
3830
3830
|
const { t } = index.useSettingsTranslate();
|
|
3831
3831
|
const { settings, geoIp } = form;
|
|
3832
3832
|
const lookupOff = !settings.enableGeolocation;
|
|
3833
|
-
const risk =
|
|
3833
|
+
const risk = dashboardModel.getRiskAvailability(geoIp.status);
|
|
3834
3834
|
const sourceLabels = {
|
|
3835
3835
|
"anonymous-ip": t("settings.config.risk.source.anonymousIp", "Anonymous IP database"),
|
|
3836
3836
|
"asn-heuristic": t("settings.config.risk.source.asn", "ASN heuristic")
|
|
@@ -3897,8 +3897,8 @@ const RiskDataCard = ({ form }) => {
|
|
|
3897
3897
|
const LocationDataTab = ({ form }) => {
|
|
3898
3898
|
const { t } = index.useSettingsTranslate();
|
|
3899
3899
|
const { settings, handleChange } = form;
|
|
3900
|
-
const risk =
|
|
3901
|
-
const scoring =
|
|
3900
|
+
const risk = dashboardModel.getRiskAvailability(form.geoIp.status);
|
|
3901
|
+
const scoring = dashboardModel.riskDependentControl(settings.enableSecurityScoring, risk.state);
|
|
3902
3902
|
const locked = form.canChangeProtected === false;
|
|
3903
3903
|
return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
|
|
3904
3904
|
/* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
|
|
@@ -4719,8 +4719,8 @@ const AlertsTab = ({ form }) => {
|
|
|
4719
4719
|
const emailTypesDisabled = lookupOff || !settings.enableEmailAlerts;
|
|
4720
4720
|
const webhookFieldsDisabled = lookupOff || !settings.enableWebhooks;
|
|
4721
4721
|
const locked = form.canChangeProtected === false;
|
|
4722
|
-
const templateErrors =
|
|
4723
|
-
const risk =
|
|
4722
|
+
const templateErrors = index.fieldHasError(errors, "emailTemplates");
|
|
4723
|
+
const risk = dashboardModel.getRiskAvailability(form.geoIp.status);
|
|
4724
4724
|
const emailTypes = [
|
|
4725
4725
|
{
|
|
4726
4726
|
field: "alertOnSuspiciousLogin",
|
|
@@ -4807,7 +4807,7 @@ const AlertsTab = ({ form }) => {
|
|
|
4807
4807
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", tag: "div", textColor: "neutral800", children: t("settings.config.email.types.label", "Send an email for") }),
|
|
4808
4808
|
!lookupOff && !settings.enableEmailAlerts ? /* @__PURE__ */ jsxRuntime.jsx(RequiresNotice, { children: t("settings.config.requires.emailAlerts", "Requires Send security emails") }) : null,
|
|
4809
4809
|
/* @__PURE__ */ jsxRuntime.jsx(EmailTypeGrid, { children: /* @__PURE__ */ jsxRuntime.jsx("div", { children: emailTypes.map(({ field, needsRiskData, needsTravel, hintId, label, hint }) => {
|
|
4810
|
-
const control = needsRiskData ?
|
|
4810
|
+
const control = needsRiskData ? dashboardModel.riskDependentControl(settings[field], risk.state) : { checked: settings[field], disabled: false, savedOnButInactive: false };
|
|
4811
4811
|
const travelOff = needsTravel && settings.impossibleTravelEnabled !== true;
|
|
4812
4812
|
const disabled = emailTypesDisabled || control.disabled || travelOff;
|
|
4813
4813
|
return /* @__PURE__ */ jsxRuntime.jsxs(AlertTypeCell, { checked: control.checked, disabled, children: [
|
|
@@ -4995,7 +4995,7 @@ const DataRetentionTab = ({ form }) => {
|
|
|
4995
4995
|
"Checked once a day, the first time about 24 hours after the server starts. Open sessions are never deleted by retention. 'Forever' keeps them."
|
|
4996
4996
|
),
|
|
4997
4997
|
value: settings.retentionDays,
|
|
4998
|
-
presets:
|
|
4998
|
+
presets: index.SELECT_PRESETS.retentionDays,
|
|
4999
4999
|
format: units.retentionDays,
|
|
5000
5000
|
onChange: (value) => handleChange("retentionDays", value)
|
|
5001
5001
|
}
|
|
@@ -5191,7 +5191,7 @@ const AdminActivityTab = ({ form }) => {
|
|
|
5191
5191
|
"At least 7 days. Older events are deleted once a day; each deletion is itself recorded. Events of a deleted admin are deleted with the account."
|
|
5192
5192
|
),
|
|
5193
5193
|
value: settings.securityLogRetentionDays,
|
|
5194
|
-
presets:
|
|
5194
|
+
presets: index.SELECT_PRESETS.securityLogRetentionDays,
|
|
5195
5195
|
format: units.days,
|
|
5196
5196
|
disabled: locked,
|
|
5197
5197
|
onChange: (value) => handleChange("securityLogRetentionDays", value)
|
|
@@ -5204,14 +5204,14 @@ const AdminActivityTab = ({ form }) => {
|
|
|
5204
5204
|
};
|
|
5205
5205
|
const TABLE_MIN_WIDTH = 720;
|
|
5206
5206
|
const keepActionKeys = (event) => {
|
|
5207
|
-
if (
|
|
5207
|
+
if (dashboardModel.shouldIsolateActionKey(event.key, true)) event.stopPropagation();
|
|
5208
5208
|
};
|
|
5209
5209
|
const ActiveImpersonationsCard = () => {
|
|
5210
5210
|
const { t } = index.useSettingsTranslate();
|
|
5211
5211
|
const { get, post } = StrapiAdmin.useFetchClient();
|
|
5212
5212
|
const { toggleNotification } = StrapiAdmin.useNotification();
|
|
5213
5213
|
const { formatDate } = index.useSessionFormatters();
|
|
5214
|
-
const [widthRef, width] =
|
|
5214
|
+
const [widthRef, width] = index.useElementWidth();
|
|
5215
5215
|
const [rows, setRows] = react.useState(null);
|
|
5216
5216
|
const [error, setError] = react.useState(false);
|
|
5217
5217
|
const [refreshing, setRefreshing] = react.useState(false);
|
|
@@ -5342,7 +5342,7 @@ const ActiveImpersonationsCard = () => {
|
|
|
5342
5342
|
}
|
|
5343
5343
|
) }),
|
|
5344
5344
|
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: time(row.expiresAt) }),
|
|
5345
|
-
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(
|
|
5345
|
+
/* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(dashboardModel.RowActions, { onKeyDown: keepActionKeys, children: endAction(row) }) })
|
|
5346
5346
|
] }, row.id)) })
|
|
5347
5347
|
] }) });
|
|
5348
5348
|
} else {
|
|
@@ -5367,7 +5367,7 @@ const ActiveImpersonationsCard = () => {
|
|
|
5367
5367
|
time: formatDate(row.expiresAt, { hour: "2-digit", minute: "2-digit" })
|
|
5368
5368
|
}) })
|
|
5369
5369
|
] }),
|
|
5370
|
-
/* @__PURE__ */ jsxRuntime.jsx(
|
|
5370
|
+
/* @__PURE__ */ jsxRuntime.jsx(dashboardModel.RowActions, { onKeyDown: keepActionKeys, children: endAction(row) })
|
|
5371
5371
|
] }) }, row.id)) });
|
|
5372
5372
|
}
|
|
5373
5373
|
return /* @__PURE__ */ jsxRuntime.jsx(
|
|
@@ -5478,7 +5478,7 @@ function useSettingsForm() {
|
|
|
5478
5478
|
const hasChanges = !areSettingsEqual(settings, savedSettings);
|
|
5479
5479
|
const errors = react.useMemo(() => validateSettings(settings), [settings]);
|
|
5480
5480
|
const errorCount = Object.keys(errors).length;
|
|
5481
|
-
const errorTab =
|
|
5481
|
+
const errorTab = index.getErrorTab(errors);
|
|
5482
5482
|
const canSave = hasChanges && errorCount === 0 && !saving;
|
|
5483
5483
|
const settingsRef = react.useRef(settings);
|
|
5484
5484
|
const savedSettingsRef = react.useRef(savedSettings);
|
|
@@ -5570,7 +5570,7 @@ function useSettingsForm() {
|
|
|
5570
5570
|
});
|
|
5571
5571
|
}, []);
|
|
5572
5572
|
const handleSave = react.useCallback(async () => {
|
|
5573
|
-
const submitted =
|
|
5573
|
+
const submitted = index.buildSavePayload(settingsRef.current, savedSettingsRef.current);
|
|
5574
5574
|
const previous = savedSettingsRef.current;
|
|
5575
5575
|
if (Object.keys(validateSettings(submitted)).length > 0) return false;
|
|
5576
5576
|
setSaving(true);
|
|
@@ -5590,7 +5590,7 @@ function useSettingsForm() {
|
|
|
5590
5590
|
setDraftVersion((version) => version + 1);
|
|
5591
5591
|
const adjustedNames = [
|
|
5592
5592
|
...new Set(
|
|
5593
|
-
getAdjustedFields(submitted, stored, previous).map((key) =>
|
|
5593
|
+
getAdjustedFields(submitted, stored, previous).map((key) => index.SETTINGS_FIELD_LABELS[key]).filter(Boolean).map(([id, defaultMessage]) => t(id, defaultMessage))
|
|
5594
5594
|
)
|
|
5595
5595
|
];
|
|
5596
5596
|
toggleNotification({
|
|
@@ -5827,7 +5827,7 @@ const DraftSync = ({ values }) => {
|
|
|
5827
5827
|
const writeTabToAddressBar = (tab) => {
|
|
5828
5828
|
if (typeof window === "undefined" || !window.history?.replaceState) return;
|
|
5829
5829
|
const { pathname, search, hash } = window.location;
|
|
5830
|
-
const nextSearch =
|
|
5830
|
+
const nextSearch = index.buildTabSearch(search, tab);
|
|
5831
5831
|
if (nextSearch === search) return;
|
|
5832
5832
|
window.history.replaceState(window.history.state, "", `${pathname}${nextSearch}${hash}`);
|
|
5833
5833
|
};
|
|
@@ -5842,10 +5842,10 @@ const SettingsPage = () => {
|
|
|
5842
5842
|
allowedActions: { canUpdate: canChangeProtected }
|
|
5843
5843
|
} = StrapiAdmin.useRBAC(index.pluginPermissions.settingsUpdate);
|
|
5844
5844
|
const visibleTabs = react.useMemo(
|
|
5845
|
-
() =>
|
|
5845
|
+
() => index.getVisibleSettingsTabs(Boolean(canViewAdminActivity)),
|
|
5846
5846
|
[canViewAdminActivity]
|
|
5847
5847
|
);
|
|
5848
|
-
const requestedTab =
|
|
5848
|
+
const requestedTab = index.resolveSettingsTab(query?.tab, visibleTabs);
|
|
5849
5849
|
const [activeTab, setActiveTab] = react.useState(requestedTab);
|
|
5850
5850
|
const [followedTab, setFollowedTab] = react.useState(requestedTab);
|
|
5851
5851
|
const tabsRef = react.useRef(null);
|
|
@@ -5857,7 +5857,7 @@ const SettingsPage = () => {
|
|
|
5857
5857
|
const list = tabsRef.current?.querySelector('[role="tablist"]');
|
|
5858
5858
|
const tab = list?.querySelector('[role="tab"][aria-selected="true"]');
|
|
5859
5859
|
if (!list || !tab) return;
|
|
5860
|
-
const delta =
|
|
5860
|
+
const delta = index.getRevealScrollDelta(list.getBoundingClientRect(), tab.getBoundingClientRect());
|
|
5861
5861
|
if (delta) list.scrollLeft += delta;
|
|
5862
5862
|
}, [activeTab, form.loading]);
|
|
5863
5863
|
const focusActiveTab = react.useCallback(() => {
|
|
@@ -5874,7 +5874,7 @@ const SettingsPage = () => {
|
|
|
5874
5874
|
}, [handleSave, focusActiveTab]);
|
|
5875
5875
|
const changeTab = react.useCallback(
|
|
5876
5876
|
(tab) => {
|
|
5877
|
-
const next =
|
|
5877
|
+
const next = index.resolveSettingsTab(tab, visibleTabs);
|
|
5878
5878
|
setActiveTab(next);
|
|
5879
5879
|
writeTabToAddressBar(next);
|
|
5880
5880
|
},
|
|
@@ -5964,7 +5964,7 @@ const SettingsPage = () => {
|
|
|
5964
5964
|
SettingsTabsList,
|
|
5965
5965
|
{
|
|
5966
5966
|
"aria-label": t("settings.config.tabs.label", "Configuration sections"),
|
|
5967
|
-
children: visibleTabs.map((tab) => /* @__PURE__ */ jsxRuntime.jsx(SettingsTabTrigger, { value: tab, children: /* @__PURE__ */ jsxRuntime.jsx(SettingsTabLabel, { children: t(
|
|
5967
|
+
children: visibleTabs.map((tab) => /* @__PURE__ */ jsxRuntime.jsx(SettingsTabTrigger, { value: tab, children: /* @__PURE__ */ jsxRuntime.jsx(SettingsTabLabel, { children: t(index.SETTINGS_TAB_LABELS[tab][0], index.SETTINGS_TAB_LABELS[tab][1]) }) }, tab))
|
|
5968
5968
|
}
|
|
5969
5969
|
),
|
|
5970
5970
|
visibleTabs.map((tab) => {
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
import { jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Flex } from "@strapi/design-system";
|
|
3
|
+
import { aJ as isSessionFilter, aK as DEFAULT_SESSION_FILTER, aL as isEndReasonFilter, aM as DEFAULT_END_REASON_FILTER, d as getDevicePresentation, p as presentText } from "./index-6zc5D8eb.mjs";
|
|
4
|
+
const RowActions = ({ children, ...props }) => /* @__PURE__ */ jsx(Flex, { justifyContent: "flex-end", alignItems: "center", gap: 1, "data-row-actions": "", ...props, children });
|
|
5
|
+
const RISK_SOURCES = Object.freeze(["anonymous-ip", "asn-heuristic"]);
|
|
6
|
+
const RISK_SETTINGS_PATH = "/settings/magic-sessionmanager/general?tab=location-data";
|
|
7
|
+
const isRiskSource = (value) => RISK_SOURCES.includes(
|
|
8
|
+
/** @type {string} */
|
|
9
|
+
value
|
|
10
|
+
);
|
|
11
|
+
function getRiskAvailability(geoIpStatus) {
|
|
12
|
+
const risk = geoIpStatus?.risk;
|
|
13
|
+
if (!risk || typeof risk !== "object" || typeof risk.available !== "boolean") {
|
|
14
|
+
return { state: "unknown", source: null };
|
|
15
|
+
}
|
|
16
|
+
if (risk.available && isRiskSource(risk.source)) {
|
|
17
|
+
return { state: "available", source: risk.source };
|
|
18
|
+
}
|
|
19
|
+
return { state: "missing", source: null };
|
|
20
|
+
}
|
|
21
|
+
function riskDependentControl(saved, state) {
|
|
22
|
+
if (state !== "missing")
|
|
23
|
+
return { checked: Boolean(saved), disabled: false, savedOnButInactive: false };
|
|
24
|
+
return { checked: false, disabled: true, savedOnButInactive: Boolean(saved) };
|
|
25
|
+
}
|
|
26
|
+
const PAGE_SIZE_OPTIONS = Object.freeze(["10", "25", "50", "100"]);
|
|
27
|
+
const DEFAULT_PAGE_SIZE = "25";
|
|
28
|
+
const DASHBOARD_TABLE_COLUMNS = 7;
|
|
29
|
+
const DASHBOARD_COMPACT_TABLE_COLUMNS = 5;
|
|
30
|
+
const AUTO_REFRESH_INTERVAL_MS = 10 * 60 * 1e3;
|
|
31
|
+
const HOW_IT_WORKS_STORAGE_KEY = "magic-sessionmanager.dashboard.howSessionsWork";
|
|
32
|
+
const USER_EDIT_PATH = "/content-manager/collection-types/plugin::users-permissions.user/";
|
|
33
|
+
const readQueryText = (value) => {
|
|
34
|
+
if (typeof value !== "string") return "";
|
|
35
|
+
try {
|
|
36
|
+
return decodeURIComponent(value).trim();
|
|
37
|
+
} catch {
|
|
38
|
+
return value.trim();
|
|
39
|
+
}
|
|
40
|
+
};
|
|
41
|
+
function parseDashboardQuery(query = {}) {
|
|
42
|
+
const source = query || {};
|
|
43
|
+
const page = Number.parseInt(String(source.page ?? "1"), 10);
|
|
44
|
+
const pageSize = PAGE_SIZE_OPTIONS.includes(String(source.pageSize)) ? String(source.pageSize) : DEFAULT_PAGE_SIZE;
|
|
45
|
+
const status = isSessionFilter(source.status) ? (
|
|
46
|
+
/** @type {string} */
|
|
47
|
+
source.status
|
|
48
|
+
) : DEFAULT_SESSION_FILTER;
|
|
49
|
+
const reason = status === "ended" && isEndReasonFilter(source.reason) ? (
|
|
50
|
+
/** @type {string} */
|
|
51
|
+
source.reason
|
|
52
|
+
) : DEFAULT_END_REASON_FILTER;
|
|
53
|
+
const search = readQueryText(source.search) || readQueryText(source._q);
|
|
54
|
+
return { page: Number.isFinite(page) && page >= 1 ? page : 1, pageSize, status, reason, search };
|
|
55
|
+
}
|
|
56
|
+
function encodeSearchQuery(value) {
|
|
57
|
+
const text = typeof value === "string" ? value.trim() : "";
|
|
58
|
+
return text ? encodeURIComponent(text) : void 0;
|
|
59
|
+
}
|
|
60
|
+
function hasActiveFilters(state) {
|
|
61
|
+
if (!state) return false;
|
|
62
|
+
return state.status !== DEFAULT_SESSION_FILTER || Boolean(state.reason) && state.reason !== DEFAULT_END_REASON_FILTER || Boolean(state.search);
|
|
63
|
+
}
|
|
64
|
+
function getSessionUserLabels(session) {
|
|
65
|
+
const username = presentText(session?.user?.username);
|
|
66
|
+
const email = presentText(session?.user?.email);
|
|
67
|
+
const primary = username || email;
|
|
68
|
+
return {
|
|
69
|
+
primary,
|
|
70
|
+
secondary: username && email ? email : "",
|
|
71
|
+
accessible: primary || presentText(session?.id)
|
|
72
|
+
};
|
|
73
|
+
}
|
|
74
|
+
function getUserEditPath(session) {
|
|
75
|
+
const documentId = presentText(session?.user?.documentId);
|
|
76
|
+
return documentId ? `${USER_EDIT_PATH}${encodeURIComponent(documentId)}` : null;
|
|
77
|
+
}
|
|
78
|
+
function getExportDeviceInfo(session, unavailableValue = "") {
|
|
79
|
+
const device = getDevicePresentation(session);
|
|
80
|
+
return {
|
|
81
|
+
device: device.deviceType || unavailableValue,
|
|
82
|
+
browser: device.browser || unavailableValue,
|
|
83
|
+
browserVersion: device.browserVersion || "",
|
|
84
|
+
os: device.os || unavailableValue
|
|
85
|
+
};
|
|
86
|
+
}
|
|
87
|
+
function readDisclosureOpen(storage) {
|
|
88
|
+
try {
|
|
89
|
+
return storage?.getItem(HOW_IT_WORKS_STORAGE_KEY) === "open";
|
|
90
|
+
} catch {
|
|
91
|
+
return false;
|
|
92
|
+
}
|
|
93
|
+
}
|
|
94
|
+
function writeDisclosureOpen(storage, open) {
|
|
95
|
+
try {
|
|
96
|
+
storage?.setItem(HOW_IT_WORKS_STORAGE_KEY, open ? "open" : "closed");
|
|
97
|
+
} catch {
|
|
98
|
+
}
|
|
99
|
+
}
|
|
100
|
+
function getBrowserStorage() {
|
|
101
|
+
try {
|
|
102
|
+
return typeof window !== "undefined" ? window.localStorage : null;
|
|
103
|
+
} catch {
|
|
104
|
+
return null;
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
function shouldIsolateActionKey(key, fromInsideGroup) {
|
|
108
|
+
if (!fromInsideGroup) return true;
|
|
109
|
+
return key === "Enter" || key === " " || key === "Spacebar";
|
|
110
|
+
}
|
|
111
|
+
const FULL_TABLE_MIN_WIDTH = 1200;
|
|
112
|
+
function shouldUseCompactTable(listWidth, isBelowLarge) {
|
|
113
|
+
if (isBelowLarge) return true;
|
|
114
|
+
if (!Number.isFinite(listWidth) || listWidth <= 0) return false;
|
|
115
|
+
return listWidth < FULL_TABLE_MIN_WIDTH;
|
|
116
|
+
}
|
|
117
|
+
function shouldRedispatchEscape(key, fromInsideGroup) {
|
|
118
|
+
return !fromInsideGroup && key === "Escape";
|
|
119
|
+
}
|
|
120
|
+
function pickFocusSessionId(previousIds, currentIds, sessionId) {
|
|
121
|
+
const current = Array.isArray(currentIds) ? currentIds.map(String) : [];
|
|
122
|
+
if (current.length === 0) return null;
|
|
123
|
+
const target = String(sessionId);
|
|
124
|
+
if (current.includes(target)) return target;
|
|
125
|
+
const previous = Array.isArray(previousIds) ? previousIds.map(String) : [];
|
|
126
|
+
const index = previous.indexOf(target);
|
|
127
|
+
if (index >= 0) {
|
|
128
|
+
for (let next = index + 1; next < previous.length; next += 1) {
|
|
129
|
+
if (current.includes(previous[next])) return previous[next];
|
|
130
|
+
}
|
|
131
|
+
for (let before = index - 1; before >= 0; before -= 1) {
|
|
132
|
+
if (current.includes(previous[before])) return previous[before];
|
|
133
|
+
}
|
|
134
|
+
}
|
|
135
|
+
return current[0];
|
|
136
|
+
}
|
|
137
|
+
function getErrorStatus(error) {
|
|
138
|
+
const err = (
|
|
139
|
+
/** @type {any} */
|
|
140
|
+
error
|
|
141
|
+
);
|
|
142
|
+
const status = err?.status ?? err?.response?.status;
|
|
143
|
+
return typeof status === "number" ? status : null;
|
|
144
|
+
}
|
|
145
|
+
export {
|
|
146
|
+
AUTO_REFRESH_INTERVAL_MS as A,
|
|
147
|
+
DASHBOARD_COMPACT_TABLE_COLUMNS as D,
|
|
148
|
+
PAGE_SIZE_OPTIONS as P,
|
|
149
|
+
RISK_SETTINGS_PATH as R,
|
|
150
|
+
getUserEditPath as a,
|
|
151
|
+
RowActions as b,
|
|
152
|
+
shouldRedispatchEscape as c,
|
|
153
|
+
DASHBOARD_TABLE_COLUMNS as d,
|
|
154
|
+
getBrowserStorage as e,
|
|
155
|
+
pickFocusSessionId as f,
|
|
156
|
+
getSessionUserLabels as g,
|
|
157
|
+
encodeSearchQuery as h,
|
|
158
|
+
isRiskSource as i,
|
|
159
|
+
shouldUseCompactTable as j,
|
|
160
|
+
DEFAULT_PAGE_SIZE as k,
|
|
161
|
+
getExportDeviceInfo as l,
|
|
162
|
+
getErrorStatus as m,
|
|
163
|
+
hasActiveFilters as n,
|
|
164
|
+
getRiskAvailability as o,
|
|
165
|
+
parseDashboardQuery as p,
|
|
166
|
+
riskDependentControl as q,
|
|
167
|
+
readDisclosureOpen as r,
|
|
168
|
+
shouldIsolateActionKey as s,
|
|
169
|
+
writeDisclosureOpen as w
|
|
170
|
+
};
|