magic-editor-x 2.3.1 → 2.4.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.
Files changed (84) hide show
  1. package/CHANGELOG.md +74 -0
  2. package/README.md +299 -142
  3. package/dist/admin/AuditPage-C2u6z4aN.js +381 -0
  4. package/dist/admin/AuditPage-guB0SiGS.mjs +381 -0
  5. package/dist/admin/{ConfigurationPage-CFP3lp9p.js → ConfigurationPage-D6uya-J1.js} +228 -13
  6. package/dist/admin/{ConfigurationPage-CYGDLjM7.mjs → ConfigurationPage-DiEpF1Rr.mjs} +222 -7
  7. package/dist/admin/ConfirmAction-CUhpngYU.js +71 -0
  8. package/dist/admin/ConfirmAction-CZjpduc3.mjs +72 -0
  9. package/dist/admin/{CustomBlocksPage-B5Q33N-s.mjs → CustomBlocksPage-Byt10-6c.mjs} +6 -4
  10. package/dist/admin/{CustomBlocksPage-DzPOSpfn.js → CustomBlocksPage-DP3h_wNd.js} +21 -19
  11. package/dist/admin/MentionsWidget-C2OCAmqq.js +227 -0
  12. package/dist/admin/MentionsWidget-sMkM9mHX.mjs +225 -0
  13. package/dist/admin/{TemplatesPage-BVkgafCK.js → TemplatesPage-DrSJdteI.js} +313 -17
  14. package/dist/admin/{TemplatesPage-4A8JNO_Z.mjs → TemplatesPage-Yp4OqFE2.mjs} +305 -9
  15. package/dist/admin/{ConfirmAction-DuQwvRYi.mjs → api-2ZRpHM3d.mjs} +19 -70
  16. package/dist/admin/{ConfirmAction-zLuIFj8t.js → api-bix9RLLI.js} +19 -70
  17. package/dist/admin/auditText-DIIYVR6k.mjs +110 -0
  18. package/dist/admin/auditText-DUhWu2Nx.js +109 -0
  19. package/dist/admin/comments-C7P41lan.js +86 -0
  20. package/dist/admin/comments-hfIbLQNO.mjs +87 -0
  21. package/dist/admin/{de-BMY2LBaa.mjs → de-BNPIGqhs.mjs} +41 -2
  22. package/dist/admin/{de-2Ie5jy7j.js → de-BhhGss1l.js} +41 -2
  23. package/dist/admin/{de-DOiGaTNX.mjs → de-CKz6CG3V.mjs} +191 -5
  24. package/dist/admin/{de-C3AsGauQ.js → de-CbBDnXeT.js} +140 -1
  25. package/dist/admin/{de-BUS1hUw0.mjs → de-DiCZrmH8.mjs} +140 -1
  26. package/dist/admin/{de-B1X46JJZ.js → de-zcV8D7nt.js} +191 -5
  27. package/dist/admin/{en-Ah-Cw0Wd.js → en-B9ApE1y1.js} +41 -2
  28. package/dist/admin/{en-CDg_18Bt.js → en-BMWhILnj.js} +191 -5
  29. package/dist/admin/{en-BkEjpC3i.js → en-CpehF0Kv.js} +140 -1
  30. package/dist/admin/{en-GCzgS9Aw.mjs → en-DCPMqFIa.mjs} +140 -1
  31. package/dist/admin/{en-CU6UzV4g.mjs → en-cYzqbASF.mjs} +191 -5
  32. package/dist/admin/{en-CvFiqti2.mjs → en-gFLeK9Ng.mjs} +41 -2
  33. package/dist/admin/{es-DbKHZz5l.mjs → es-BmwBgEgz.mjs} +41 -2
  34. package/dist/admin/{es-Cr8JH85N.js → es-C0W31rl8.js} +41 -2
  35. package/dist/admin/{es-BCpJmUEM.js → es-CQPh8PXw.js} +191 -5
  36. package/dist/admin/{es-C4pEnDRv.js → es-CawpzwyC.js} +140 -1
  37. package/dist/admin/{es-DHBBZKl2.mjs → es-Chs37IBR.mjs} +140 -1
  38. package/dist/admin/{es-BmfffNM2.mjs → es-DCamt1ek.mjs} +191 -5
  39. package/dist/admin/{fr-DQJ_7aq5.mjs → fr-CMWBNE5D.mjs} +41 -2
  40. package/dist/admin/{fr-C2aLSwEu.js → fr-COOsqexl.js} +140 -1
  41. package/dist/admin/{fr-Dvq4xk2e.mjs → fr-Dp5-XP29.mjs} +140 -1
  42. package/dist/admin/{fr-ZcN0yM_2.js → fr-DpC44Ol8.js} +191 -5
  43. package/dist/admin/{fr-OJ4VW1kh.js → fr-iGeIfEcU.js} +41 -2
  44. package/dist/admin/{fr-DZd2XJP6.mjs → fr-oW0t8bT5.mjs} +191 -5
  45. package/dist/admin/{index-DQVE0ymw.js → index-64wc26Bl.js} +17467 -10369
  46. package/dist/admin/{index-k8_a5o1A.mjs → index-BVjf1gVC.mjs} +13786 -6687
  47. package/dist/admin/{index-DR8sHkTk.js → index-D6Z7i8ba.js} +1003 -53
  48. package/dist/admin/{index-My6FjjHB.mjs → index-D_Fv8Non.mjs} +1032 -82
  49. package/dist/admin/index.js +2 -1
  50. package/dist/admin/index.mjs +3 -2
  51. package/dist/admin/math-CIQ4Z_mY.mjs +47 -0
  52. package/dist/admin/math-vsK_06ZR.js +49 -0
  53. package/dist/admin/{pt-D0I0_JYs.js → pt-BHmXk2d9.js} +41 -2
  54. package/dist/admin/{pt-CImqDnLB.js → pt-Bo0Pm_Pt.js} +191 -5
  55. package/dist/admin/{pt-CilDggGF.mjs → pt-DALDvfBn.mjs} +140 -1
  56. package/dist/admin/{pt-BSLzA17U.mjs → pt-DFNgZ5_k.mjs} +41 -2
  57. package/dist/admin/{pt-DX0OAIoL.js → pt-DXy7G1x7.js} +140 -1
  58. package/dist/admin/{pt-C3UdeIpd.mjs → pt-uGpfRQLC.mjs} +191 -5
  59. package/dist/admin/{useT-DNphiBQR.js → useT-BXJLIPN4.js} +1 -1
  60. package/dist/admin/{useT-Cmg1jwwG.mjs → useT-CLPhBmBC.mjs} +1 -1
  61. package/dist/blocks/index.d.mts +2 -0
  62. package/dist/blocks/index.d.ts +2 -0
  63. package/dist/blocks/index.js +13 -2
  64. package/dist/blocks/index.mjs +13 -2
  65. package/dist/math/index.d.mts +27 -0
  66. package/dist/math/index.d.ts +27 -0
  67. package/dist/math/index.js +164 -0
  68. package/dist/math/index.mjs +134 -0
  69. package/dist/react/index.js +673 -91
  70. package/dist/react/index.mjs +673 -91
  71. package/dist/render/index.d.mts +26 -0
  72. package/dist/render/index.d.ts +26 -0
  73. package/dist/render/index.js +779 -106
  74. package/dist/render/index.mjs +779 -106
  75. package/dist/server/index.js +10419 -4103
  76. package/dist/server/index.mjs +10419 -4103
  77. package/dist/vue/index.js +673 -91
  78. package/dist/vue/index.mjs +673 -91
  79. package/package.json +8 -2
  80. package/schema/magic-editor-x.schema.json +127 -2
  81. package/types/blocks.d.ts +2 -0
  82. package/types/index.d.ts +42 -0
  83. package/types/math.d.ts +27 -0
  84. package/types/render.d.ts +26 -0
@@ -0,0 +1,381 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
+ const jsxRuntime = require("react/jsx-runtime");
4
+ const ReactNamespace = require("react");
5
+ const reactIntl = require("react-intl");
6
+ const designSystem = require("@strapi/design-system");
7
+ const icons = require("@strapi/icons");
8
+ const admin = require("@strapi/strapi/admin");
9
+ const index = require("./index-D6Z7i8ba.js");
10
+ const api = require("./api-bix9RLLI.js");
11
+ const useT = require("./useT-BXJLIPN4.js");
12
+ const useBreakpoint = require("./useBreakpoint-D30eNTkF.js");
13
+ const auditText = require("./auditText-DUhWu2Nx.js");
14
+ const ALL = "__all__";
15
+ const UID_PATTERN = /^(api|plugin)::[a-z0-9-]{1,60}\.[a-z0-9-]{1,60}$/;
16
+ const DOCUMENT_ID_PATTERN = /^[a-z0-9]{1,64}$/;
17
+ const DATE_PATTERN = /^\d{4}-\d{2}-\d{2}$/;
18
+ const FILTER_KEYS = ["event", "actor", "uid", "documentId", "from", "to"];
19
+ const readFilters = (query) => {
20
+ const text = (key) => typeof query[key] === "string" ? query[key] : "";
21
+ return {
22
+ event: text("event"),
23
+ actor: /^\d{1,10}$/.test(text("actor")) ? text("actor") : "",
24
+ uid: text("uid"),
25
+ documentId: text("documentId"),
26
+ from: DATE_PATTERN.test(text("from")) ? text("from") : "",
27
+ to: DATE_PATTERN.test(text("to")) ? text("to") : ""
28
+ };
29
+ };
30
+ const AuditFilters = ({ t, applied, actors, active, onApply, onReset }) => {
31
+ const [draft, setDraft] = ReactNamespace.useState(applied);
32
+ const uidInvalid = draft.uid !== "" && !UID_PATTERN.test(draft.uid);
33
+ const documentInvalid = draft.documentId !== "" && !DOCUMENT_ID_PATTERN.test(draft.documentId);
34
+ const documentWithoutUid = draft.documentId !== "" && draft.uid === "";
35
+ const rangeInvalid = Boolean(draft.from && draft.to && draft.from > draft.to);
36
+ const canApply = !uidInvalid && !documentInvalid && !documentWithoutUid && !rangeInvalid;
37
+ const apply = (event) => {
38
+ if (event) event.preventDefault();
39
+ if (canApply) onApply(draft);
40
+ };
41
+ const reset = onReset;
42
+ return /* @__PURE__ */ jsxRuntime.jsx(
43
+ useT.SectionCard,
44
+ {
45
+ title: t("settings.audit.filters", "Filters"),
46
+ action: active ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", onClick: reset, children: t("settings.audit.reset", "Reset filters") }) : null,
47
+ children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { tag: "form", onSubmit: apply, noValidate: true, children: [
48
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Grid.Root, { gap: { initial: 4, medium: 6 }, children: [
49
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 4, s: 6, xs: 12, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "event", children: [
50
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("settings.audit.filter.event", "Event") }),
51
+ /* @__PURE__ */ jsxRuntime.jsxs(
52
+ designSystem.SingleSelect,
53
+ {
54
+ value: draft.event || ALL,
55
+ onChange: (value) => setDraft({ ...draft, event: value === ALL ? "" : String(value) }),
56
+ children: [
57
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: ALL, children: t("settings.audit.filter.allEvents", "All events") }),
58
+ Object.keys(auditText.EVENT_LABELS).map((event) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: event, children: auditText.eventLabel(t, event) }, event))
59
+ ]
60
+ }
61
+ )
62
+ ] }) }),
63
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 4, s: 6, xs: 12, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "actor", children: [
64
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("settings.audit.filter.actor", "Changed by") }),
65
+ /* @__PURE__ */ jsxRuntime.jsxs(
66
+ designSystem.SingleSelect,
67
+ {
68
+ value: draft.actor || ALL,
69
+ onChange: (value) => setDraft({ ...draft, actor: value === ALL ? "" : String(value) }),
70
+ children: [
71
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: ALL, children: t("settings.audit.filter.allActors", "Everyone") }),
72
+ actors.map((actor) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.SingleSelectOption, { value: String(actor.id), children: actor.name || t("settings.audit.actor.unnamed", "Admin without a name") }, actor.id))
73
+ ]
74
+ }
75
+ )
76
+ ] }) }),
77
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 4, s: 6, xs: 12, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsxs(
78
+ designSystem.Field.Root,
79
+ {
80
+ name: "uid",
81
+ error: uidInvalid ? t("settings.audit.filter.uidInvalid", "Use a uid such as api::article.article.") : void 0,
82
+ children: [
83
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("settings.audit.filter.uid", "Content type") }),
84
+ /* @__PURE__ */ jsxRuntime.jsx(
85
+ designSystem.TextInput,
86
+ {
87
+ value: draft.uid,
88
+ placeholder: "api::article.article",
89
+ onChange: (event) => setDraft({ ...draft, uid: event.target.value.trim() })
90
+ }
91
+ ),
92
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
93
+ ]
94
+ }
95
+ ) }),
96
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 4, s: 6, xs: 12, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsxs(
97
+ designSystem.Field.Root,
98
+ {
99
+ name: "documentId",
100
+ hint: t("settings.audit.filter.documentHint", "Needs a content type."),
101
+ error: documentInvalid ? t("settings.audit.filter.documentInvalid", "Use lowercase letters and digits only.") : documentWithoutUid ? t("settings.audit.filter.documentHint", "Needs a content type.") : void 0,
102
+ children: [
103
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("settings.audit.filter.document", "Document id") }),
104
+ /* @__PURE__ */ jsxRuntime.jsx(
105
+ designSystem.TextInput,
106
+ {
107
+ value: draft.documentId,
108
+ onChange: (event) => setDraft({ ...draft, documentId: event.target.value.trim() })
109
+ }
110
+ ),
111
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Hint, {}),
112
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
113
+ ]
114
+ }
115
+ ) }),
116
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 4, s: 6, xs: 12, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Field.Root, { name: "from", children: [
117
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("settings.audit.filter.from", "From") }),
118
+ /* @__PURE__ */ jsxRuntime.jsx(
119
+ designSystem.TextInput,
120
+ {
121
+ type: "date",
122
+ value: draft.from,
123
+ onChange: (event) => setDraft({ ...draft, from: event.target.value })
124
+ }
125
+ )
126
+ ] }) }),
127
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Grid.Item, { col: 4, s: 6, xs: 12, direction: "column", alignItems: "stretch", children: /* @__PURE__ */ jsxRuntime.jsxs(
128
+ designSystem.Field.Root,
129
+ {
130
+ name: "to",
131
+ error: rangeInvalid ? t("settings.audit.filter.rangeInvalid", "The end is before the start.") : void 0,
132
+ children: [
133
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Label, { children: t("settings.audit.filter.to", "To") }),
134
+ /* @__PURE__ */ jsxRuntime.jsx(
135
+ designSystem.TextInput,
136
+ {
137
+ type: "date",
138
+ value: draft.to,
139
+ onChange: (event) => setDraft({ ...draft, to: event.target.value })
140
+ }
141
+ ),
142
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Error, {})
143
+ ]
144
+ }
145
+ ) })
146
+ ] }),
147
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { gap: 2, wrap: "wrap", paddingTop: 6, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { type: "submit", startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Filter, {}), disabled: !canApply, children: t("settings.audit.apply", "Apply filters") }) })
148
+ ] })
149
+ }
150
+ );
151
+ };
152
+ const AuditPage = () => {
153
+ const t = useT.useT();
154
+ const { formatDate } = reactIntl.useIntl();
155
+ const { get } = admin.useFetchClient();
156
+ const { isBelowLarge } = useBreakpoint.useBreakpoint();
157
+ const audit = admin.useRBAC(index.PERMISSIONS.auditRead);
158
+ const settings = admin.useRBAC(index.PERMISSIONS.settingsRead);
159
+ const [{ query }, setQuery] = admin.useQueryParams();
160
+ const applied = readFilters(query);
161
+ const page = Math.max(1, Number(query.page) || 1);
162
+ const pageSize = [10, 25, 50, 100].includes(Number(query.pageSize)) ? Number(query.pageSize) : 25;
163
+ const [result, setResult] = ReactNamespace.useState({
164
+ key: null,
165
+ failed: false,
166
+ items: [],
167
+ pagination: null,
168
+ enabled: true
169
+ });
170
+ const [nonce, setNonce] = ReactNamespace.useState(0);
171
+ const [actors, setActors] = ReactNamespace.useState([]);
172
+ const allowed = audit.allowedActions.canRead && settings.allowedActions.canRead;
173
+ const appliedKey = JSON.stringify(applied);
174
+ const requestKey = `${appliedKey}|${page}|${pageSize}|${nonce}`;
175
+ const title = t("settings.audit.title", "Audit trail");
176
+ const state = {
177
+ ...result,
178
+ status: result.key !== requestKey ? "loading" : result.failed ? "error" : "ready"
179
+ };
180
+ const params = { page, pageSize };
181
+ if (applied.event) params.event = applied.event;
182
+ if (applied.actor) params.actor = applied.actor;
183
+ if (UID_PATTERN.test(applied.uid)) params.uid = applied.uid;
184
+ if (params.uid && DOCUMENT_ID_PATTERN.test(applied.documentId)) params.documentId = applied.documentId;
185
+ if (applied.from) params.from = `${applied.from}T00:00:00`;
186
+ if (applied.to) params.to = `${applied.to}T23:59:59`;
187
+ const paramsKey = JSON.stringify(params);
188
+ ReactNamespace.useEffect(() => {
189
+ if (!allowed) return void 0;
190
+ let active2 = true;
191
+ get(api.API.audit, { params: JSON.parse(paramsKey) }).then(
192
+ ({ data }) => {
193
+ if (!active2) return;
194
+ setResult({
195
+ key: requestKey,
196
+ failed: false,
197
+ items: data.data || [],
198
+ pagination: data.meta && data.meta.pagination || null,
199
+ enabled: !(data.meta && data.meta.enabled === false)
200
+ });
201
+ },
202
+ () => {
203
+ if (active2) setResult((current) => ({ ...current, key: requestKey, failed: true }));
204
+ }
205
+ );
206
+ return () => {
207
+ active2 = false;
208
+ };
209
+ }, [allowed, get, paramsKey, requestKey]);
210
+ const load = () => setNonce((value) => value + 1);
211
+ ReactNamespace.useEffect(() => {
212
+ if (!allowed) return;
213
+ get(api.API.auditActors).then(
214
+ ({ data }) => setActors(data.data || []),
215
+ () => setActors([])
216
+ );
217
+ }, [allowed, get]);
218
+ if (audit.isLoading || settings.isLoading) {
219
+ return /* @__PURE__ */ jsxRuntime.jsxs(admin.Page.Main, { children: [
220
+ /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Title, { children: title }),
221
+ /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Loading, {})
222
+ ] });
223
+ }
224
+ if (!allowed) {
225
+ return /* @__PURE__ */ jsxRuntime.jsxs(admin.Page.Main, { children: [
226
+ /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Title, { children: title }),
227
+ /* @__PURE__ */ jsxRuntime.jsx(admin.Page.NoPermissions, {})
228
+ ] });
229
+ }
230
+ const apply = (draft) => {
231
+ const next = { page: 1, pageSize };
232
+ for (const key of FILTER_KEYS) next[key] = draft[key] || void 0;
233
+ setQuery(next);
234
+ };
235
+ const reset = () => {
236
+ const cleared = Object.fromEntries(FILTER_KEYS.map((key) => [key, void 0]));
237
+ setQuery({ ...cleared, page: 1, pageSize });
238
+ };
239
+ const active = FILTER_KEYS.some((key) => applied[key]);
240
+ const when = (value) => formatDate(new Date(value), { dateStyle: "medium", timeStyle: "short" });
241
+ const targetText = (item) => {
242
+ const target = item.target || {};
243
+ if (!target.uid) return t("settings.audit.target.none", "Plugin settings");
244
+ const parts = [target.uid];
245
+ if (target.documentId) parts.push(target.documentId);
246
+ if (target.locale) parts.push(target.locale);
247
+ if (target.field) parts.push(target.field);
248
+ return parts.join(" · ");
249
+ };
250
+ const filters = /* @__PURE__ */ jsxRuntime.jsx(
251
+ AuditFilters,
252
+ {
253
+ t,
254
+ applied,
255
+ actors,
256
+ active,
257
+ onApply: apply,
258
+ onReset: reset
259
+ },
260
+ appliedKey
261
+ );
262
+ let results;
263
+ if (state.status === "error") {
264
+ results = /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 2, children: [
265
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", children: t("settings.audit.error", "The audit trail could not be loaded.") }),
266
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "secondary", startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowClockwise, {}), onClick: load, children: t("settings.retry", "Try again") })
267
+ ] });
268
+ } else if (state.status === "loading" && state.items.length === 0) {
269
+ results = /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", padding: 6, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Loader, { small: true, children: t("settings.audit.loading", "Loading the audit trail") }) });
270
+ } else if (state.items.length === 0) {
271
+ results = /* @__PURE__ */ jsxRuntime.jsx(
272
+ designSystem.EmptyStateLayout,
273
+ {
274
+ content: active ? t("settings.audit.emptyFiltered", "No events match these filters.") : t("settings.audit.empty", "No events recorded yet.")
275
+ }
276
+ );
277
+ } else if (isBelowLarge) {
278
+ results = /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { tag: "ul", direction: "column", alignItems: "stretch", gap: 3, "aria-label": title, children: state.items.map((item) => {
279
+ const summary = auditText.changeSummary(t, item);
280
+ return /* @__PURE__ */ jsxRuntime.jsx(
281
+ designSystem.Box,
282
+ {
283
+ tag: "li",
284
+ padding: 4,
285
+ hasRadius: true,
286
+ borderColor: "neutral200",
287
+ background: "neutral0",
288
+ minWidth: 0,
289
+ children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "flex-start", gap: 1, minWidth: 0, children: [
290
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, wrap: "wrap", children: [
291
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: auditText.eventLabel(t, item.event) }),
292
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: when(item.createdAt) })
293
+ ] }),
294
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral800", children: auditText.actorLabel(t, item.actor) }),
295
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", style: { overflowWrap: "anywhere" }, children: targetText(item) }),
296
+ summary ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral800", style: { overflowWrap: "anywhere" }, children: summary }) : null
297
+ ] })
298
+ },
299
+ item.id
300
+ );
301
+ }) });
302
+ } else {
303
+ results = /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Table, { colCount: 5, rowCount: state.items.length + 1, children: [
304
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
305
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("settings.audit.col.time", "Time") }) }),
306
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("settings.audit.col.event", "Event") }) }),
307
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("settings.audit.col.actor", "Changed by") }) }),
308
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("settings.audit.col.target", "Where") }) }),
309
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "sigma", children: t("settings.audit.col.changes", "Changes") }) })
310
+ ] }) }),
311
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: state.items.map((item) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
312
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: when(item.createdAt) }) }),
313
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Badge, { children: auditText.eventLabel(t, item.event) }) }),
314
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", children: auditText.actorLabel(t, item.actor) }) }),
315
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { style: { whiteSpace: "normal" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", style: { overflowWrap: "anywhere" }, children: targetText(item) }) }),
316
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { style: { whiteSpace: "normal" }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", style: { overflowWrap: "anywhere" }, children: auditText.changeSummary(t, item) }) })
317
+ ] }, item.id)) })
318
+ ] });
319
+ }
320
+ return /* @__PURE__ */ jsxRuntime.jsxs(
321
+ useT.PageShell,
322
+ {
323
+ title,
324
+ subtitle: t(
325
+ "settings.audit.subtitle",
326
+ "Who changed what and when in editor fields, templates, synced blocks, comments, AI actions and settings. Only counts and block ids are kept, never the content."
327
+ ),
328
+ primaryAction: /* @__PURE__ */ jsxRuntime.jsx(
329
+ designSystem.Button,
330
+ {
331
+ variant: "secondary",
332
+ startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.ArrowClockwise, {}),
333
+ onClick: load,
334
+ loading: state.status === "loading",
335
+ children: t("settings.audit.refresh", "Refresh")
336
+ }
337
+ ),
338
+ children: [
339
+ !state.enabled ? /* @__PURE__ */ jsxRuntime.jsx(
340
+ designSystem.Alert,
341
+ {
342
+ variant: "warning",
343
+ closeLabel: t("settings.close", "Close"),
344
+ title: t("settings.audit.offTitle", "Recording is off"),
345
+ children: t(
346
+ "settings.audit.off",
347
+ "The audit trail is turned off in config/plugins.js (audit.enabled). Earlier events are still shown."
348
+ )
349
+ }
350
+ ) : null,
351
+ filters,
352
+ /* @__PURE__ */ jsxRuntime.jsxs(
353
+ useT.SectionCard,
354
+ {
355
+ title: t("settings.audit.results", "Events"),
356
+ subtitle: state.pagination ? t("settings.audit.total", "{total, plural, one {# event} other {# events}}", {
357
+ total: state.pagination.total
358
+ }) : void 0,
359
+ children: [
360
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { "aria-busy": state.status === "loading", "data-mex-audit-results": true, minWidth: 0, children: results }),
361
+ state.pagination && state.pagination.total > 0 ? /* @__PURE__ */ jsxRuntime.jsxs(
362
+ admin.Pagination.Root,
363
+ {
364
+ pageCount: state.pagination.pageCount,
365
+ total: state.pagination.total,
366
+ defaultPageSize: 25,
367
+ children: [
368
+ /* @__PURE__ */ jsxRuntime.jsx(admin.Pagination.PageSize, { options: ["10", "25", "50", "100"] }),
369
+ /* @__PURE__ */ jsxRuntime.jsx(admin.Pagination.Links, {})
370
+ ]
371
+ }
372
+ ) : null
373
+ ]
374
+ }
375
+ )
376
+ ]
377
+ }
378
+ );
379
+ };
380
+ exports.AuditPage = AuditPage;
381
+ exports.default = AuditPage;