strapi-plugin-oidc 1.6.6 → 1.7.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.
@@ -1,971 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
3
- const jsxRuntime = require("react/jsx-runtime");
4
- const reactRouterDom = require("react-router-dom");
5
- const admin = require("@strapi/strapi/admin");
6
- const react = require("react");
7
- const designSystem = require("@strapi/design-system");
8
- const icons = require("@strapi/icons");
9
- const reactIntl = require("react-intl");
10
- const index = require("./index-DVjS4hOr.js");
11
- const styled = require("styled-components");
12
- const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
13
- const styled__default = /* @__PURE__ */ _interopDefault(styled);
14
- function Role({ oidcRoles, roles, onChangeRole }) {
15
- const { formatMessage } = reactIntl.useIntl();
16
- return /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
17
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "p", variant: "omega", textColor: "neutral600", marginBottom: 4, children: formatMessage(index.getTrad("roles.notes")) }),
18
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 4, marginBottom: 4, children: oidcRoles.map((oidcRole) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
19
- designSystem.MultiSelect,
20
- {
21
- withTags: true,
22
- placeholder: formatMessage(index.getTrad("roles.placeholder")),
23
- value: oidcRole.role ? oidcRole.role.map((r) => String(r)) : [],
24
- onChange: (value) => {
25
- if (value && value.length > 0) onChangeRole(value, oidcRole.oauth_type);
26
- },
27
- children: roles.map((role) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.MultiSelectOption, { value: String(role.id), children: role.name }, role.id))
28
- }
29
- ) }, oidcRole.oauth_type)) })
30
- ] });
31
- }
32
- function LocalizedDate({
33
- date,
34
- options
35
- }) {
36
- const userLocale = navigator.language || "en-US";
37
- return new Intl.DateTimeFormat(userLocale, {
38
- year: "numeric",
39
- month: "short",
40
- day: "numeric",
41
- hour: "2-digit",
42
- minute: "2-digit",
43
- ...options
44
- }).format(new Date(date));
45
- }
46
- const CustomTable = styled__default.default(designSystem.Table)`
47
- th,
48
- td,
49
- th span,
50
- td span {
51
- font-size: 1.3rem !important;
52
- }
53
- `;
54
- function ConfirmDialog({
55
- trigger,
56
- title,
57
- body,
58
- confirmLabel,
59
- onConfirm,
60
- confirmVariant = "danger"
61
- }) {
62
- const { formatMessage } = reactIntl.useIntl();
63
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Root, { children: [
64
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Trigger, { children: trigger }),
65
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
66
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: title }),
67
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { icon: /* @__PURE__ */ jsxRuntime.jsx(icons.WarningCircle, { fill: "danger600" }), children: body }),
68
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Footer, { children: [
69
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { fullWidth: true, variant: "tertiary", children: formatMessage(index.getTrad("page.cancel")) }) }),
70
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Action, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { fullWidth: true, variant: confirmVariant, onClick: onConfirm, children: confirmLabel }) })
71
- ] })
72
- ] })
73
- ] });
74
- }
75
- function TablePagination({ page, pageCount, onPageChange }) {
76
- const { formatMessage } = reactIntl.useIntl();
77
- if (pageCount <= 1) return null;
78
- const handleClick = (e, num) => {
79
- e.preventDefault();
80
- onPageChange(num);
81
- };
82
- const pageLink = (num) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.PageLink, { number: num, href: "#", onClick: (e) => handleClick(e, num), children: formatMessage(index.getTrad("pagination.page"), { page: num }) }, num);
83
- const Ellipsis = () => /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", paddingLeft: 2, paddingRight: 2, children: "…" });
84
- let pages;
85
- if (pageCount <= 10) {
86
- pages = Array.from({ length: pageCount }, (_, i) => pageLink(i + 1));
87
- } else if (page <= 6) {
88
- pages = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
89
- Array.from({ length: 9 }, (_, i) => pageLink(i + 1)),
90
- /* @__PURE__ */ jsxRuntime.jsx(Ellipsis, {}),
91
- pageLink(pageCount)
92
- ] });
93
- } else if (page >= pageCount - 5) {
94
- pages = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
95
- pageLink(1),
96
- /* @__PURE__ */ jsxRuntime.jsx(Ellipsis, {}),
97
- Array.from({ length: 9 }, (_, i) => pageLink(pageCount - 8 + i))
98
- ] });
99
- } else {
100
- pages = /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
101
- pageLink(1),
102
- /* @__PURE__ */ jsxRuntime.jsx(Ellipsis, {}),
103
- Array.from({ length: 7 }, (_, i) => pageLink(page - 3 + i)),
104
- /* @__PURE__ */ jsxRuntime.jsx(Ellipsis, {}),
105
- pageLink(pageCount)
106
- ] });
107
- }
108
- return /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingTop: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Pagination, { activePage: page, pageCount, children: [
109
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.PreviousLink, { href: "#", onClick: (e) => handleClick(e, Math.max(1, page - 1)), children: formatMessage(index.getTrad("pagination.previous")) }),
110
- pages,
111
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.NextLink, { href: "#", onClick: (e) => handleClick(e, Math.min(pageCount, page + 1)), children: formatMessage(index.getTrad("pagination.next")) })
112
- ] }) }) });
113
- }
114
- const PAGE_SIZE$1 = 10;
115
- const EMAIL_REGEX = /^[^\s@]+@[^\s@]+\.[^\s@]+$/;
116
- function Whitelist({
117
- users,
118
- useWhitelist,
119
- loading,
120
- onSave,
121
- onDelete,
122
- onDeleteAll,
123
- onImport,
124
- onExport
125
- }) {
126
- const [email, setEmail] = react.useState("");
127
- const [page, setPage] = react.useState(1);
128
- const { formatMessage } = reactIntl.useIntl();
129
- const { toggleNotification } = admin.useNotification();
130
- const fileInputRef = react.useRef(null);
131
- const pageCount = Math.ceil(users.length / PAGE_SIZE$1) || 1;
132
- const paginatedUsers = users.slice((page - 1) * PAGE_SIZE$1, page * PAGE_SIZE$1);
133
- const onSaveEmail = react.useCallback(() => {
134
- const emailText = email.trim();
135
- if (users.some((user) => user.email === emailText)) {
136
- toggleNotification({
137
- type: "warning",
138
- message: formatMessage(index.getTrad("whitelist.error.unique"))
139
- });
140
- } else {
141
- onSave(emailText);
142
- setEmail("");
143
- }
144
- }, [email, users, onSave, formatMessage, toggleNotification]);
145
- const handleImport = react.useCallback(
146
- async (e) => {
147
- const file = e.target.files?.[0];
148
- if (!fileInputRef.current || !file) return;
149
- fileInputRef.current.value = "";
150
- try {
151
- const text = await file.text();
152
- const parsed = JSON.parse(text);
153
- if (!Array.isArray(parsed)) throw new Error();
154
- const emails = parsed.filter((item) => item?.email).map(
155
- (item) => String(item.email).trim().toLowerCase()
156
- ).filter((email2) => EMAIL_REGEX.test(email2));
157
- const count = await onImport(emails);
158
- if (count === 0) {
159
- toggleNotification({
160
- type: "info",
161
- message: formatMessage(index.getTrad("whitelist.import.none"))
162
- });
163
- } else {
164
- toggleNotification({
165
- type: "success",
166
- message: formatMessage(index.getTrad("whitelist.import.success"), { count })
167
- });
168
- }
169
- } catch {
170
- toggleNotification({
171
- type: "warning",
172
- message: formatMessage(index.getTrad("whitelist.import.error"))
173
- });
174
- }
175
- },
176
- [onImport, formatMessage, toggleNotification]
177
- );
178
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
179
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { tag: "p", variant: "omega", textColor: "neutral600", marginBottom: 4, children: formatMessage(index.getTrad("whitelist.description")) }),
180
- useWhitelist && /* @__PURE__ */ jsxRuntime.jsxs(jsxRuntime.Fragment, { children: [
181
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", marginBottom: 4, children: [
182
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: formatMessage(index.getTrad("whitelist.count"), { count: users.length }) }),
183
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
184
- /* @__PURE__ */ jsxRuntime.jsx(
185
- designSystem.Button,
186
- {
187
- size: "S",
188
- variant: "tertiary",
189
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Download, {}),
190
- onClick: onExport,
191
- disabled: users.length === 0,
192
- children: formatMessage(index.getTrad("whitelist.export"))
193
- }
194
- ),
195
- /* @__PURE__ */ jsxRuntime.jsx(
196
- designSystem.Button,
197
- {
198
- size: "S",
199
- variant: "tertiary",
200
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Upload, {}),
201
- onClick: () => fileInputRef.current?.click(),
202
- children: formatMessage(index.getTrad("whitelist.import"))
203
- }
204
- ),
205
- /* @__PURE__ */ jsxRuntime.jsx(
206
- "input",
207
- {
208
- ref: fileInputRef,
209
- type: "file",
210
- accept: ".json,application/json",
211
- style: { display: "none" },
212
- onChange: handleImport
213
- }
214
- ),
215
- users.length > 0 && /* @__PURE__ */ jsxRuntime.jsx(
216
- ConfirmDialog,
217
- {
218
- trigger: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { size: "S", variant: "danger-light", startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {}), children: formatMessage(index.getTrad("whitelist.delete.all.label")) }),
219
- title: formatMessage(index.getTrad("whitelist.delete.all.title")),
220
- body: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", textAlign: "center", children: formatMessage(index.getTrad("whitelist.delete.all.description"), {
221
- count: users.length
222
- }) }) }),
223
- confirmLabel: formatMessage(index.getTrad("whitelist.delete.all.label")),
224
- onConfirm: onDeleteAll
225
- }
226
- )
227
- ] })
228
- ] }),
229
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 4, marginTop: 5, marginBottom: 5, alignItems: "flex-start", children: [
230
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { style: { flex: 1 }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Field.Root, { children: /* @__PURE__ */ jsxRuntime.jsx(
231
- designSystem.Field.Input,
232
- {
233
- type: "text",
234
- disabled: loading,
235
- value: email,
236
- hasError: Boolean(email && !EMAIL_REGEX.test(email)),
237
- onChange: (e) => setEmail(e.currentTarget.value),
238
- placeholder: formatMessage(index.getTrad("whitelist.email.placeholder"))
239
- }
240
- ) }) }),
241
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { children: /* @__PURE__ */ jsxRuntime.jsx(
242
- designSystem.Button,
243
- {
244
- size: "L",
245
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Plus, {}),
246
- disabled: loading || email.trim() === "" || !EMAIL_REGEX.test(email),
247
- loading,
248
- onClick: onSaveEmail,
249
- children: formatMessage(index.getTrad("page.add"))
250
- }
251
- ) })
252
- ] }),
253
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Divider, {}),
254
- /* @__PURE__ */ jsxRuntime.jsxs(CustomTable, { colCount: 4, rowCount: users.length, children: [
255
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
256
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: formatMessage(index.getTrad("whitelist.table.no")) }),
257
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: formatMessage(index.getTrad("whitelist.table.email")) }),
258
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: formatMessage(index.getTrad("whitelist.table.created")) }),
259
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { style: { paddingRight: 0 }, children: " " })
260
- ] }) }),
261
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: users.length === 0 ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tr, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { colSpan: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatMessage(index.getTrad("whitelist.table.empty")) }) }) }) }) : paginatedUsers.map((user, index$1) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
262
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: index$1 + 1 + (page - 1) * PAGE_SIZE$1 }),
263
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: user.email }),
264
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(LocalizedDate, { date: user.createdAt, options: { month: "long" } }) }),
265
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { style: { paddingRight: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(
266
- designSystem.Flex,
267
- {
268
- justifyContent: "flex-end",
269
- onClick: (e) => e.stopPropagation(),
270
- style: { width: "100%" },
271
- children: /* @__PURE__ */ jsxRuntime.jsx(
272
- ConfirmDialog,
273
- {
274
- trigger: /* @__PURE__ */ jsxRuntime.jsx(
275
- designSystem.IconButton,
276
- {
277
- label: formatMessage(index.getTrad("whitelist.delete.label")),
278
- withTooltip: false,
279
- children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {})
280
- }
281
- ),
282
- title: formatMessage(index.getTrad("whitelist.delete.title")),
283
- body: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "center", gap: 2, children: [
284
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id: "confirm-description", children: formatMessage(index.getTrad("whitelist.delete.description")) }) }),
285
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", children: user.email }) }),
286
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", marginTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: formatMessage(index.getTrad("whitelist.delete.note")) }) })
287
- ] }),
288
- confirmLabel: formatMessage(index.getTrad("page.ok")),
289
- onConfirm: () => onDelete(user.email),
290
- confirmVariant: "danger-light"
291
- }
292
- )
293
- }
294
- ) })
295
- ] }, user.email)) })
296
- ] }),
297
- /* @__PURE__ */ jsxRuntime.jsx(TablePagination, { page, pageCount, onPageChange: setPage })
298
- ] })
299
- ] });
300
- }
301
- const PAGE_SIZE = 10;
302
- const DETAILS_TEXT_STYLE = {
303
- display: "block",
304
- overflow: "hidden",
305
- textOverflow: "ellipsis",
306
- whiteSpace: "nowrap",
307
- maxWidth: "180px",
308
- cursor: "help"
309
- };
310
- function AuditLog() {
311
- const { formatMessage } = reactIntl.useIntl();
312
- const { get, del } = admin.useFetchClient();
313
- const { toggleNotification } = admin.useNotification();
314
- const [records, setRecords] = react.useState([]);
315
- const [pagination, setPagination] = react.useState({
316
- page: 1,
317
- pageSize: PAGE_SIZE,
318
- total: 0,
319
- pageCount: 1
320
- });
321
- const [page, setPage] = react.useState(1);
322
- const [loading, setLoading] = react.useState(false);
323
- const fetchLogs = react.useCallback(
324
- async (p) => {
325
- setLoading(true);
326
- try {
327
- const response = await get(
328
- `/strapi-plugin-oidc/audit-logs?page=${p}&pageSize=${PAGE_SIZE}`
329
- );
330
- setRecords(response.data.results ?? []);
331
- setPagination(
332
- response.data.pagination ?? { page: p, pageSize: PAGE_SIZE, total: 0, pageCount: 1 }
333
- );
334
- } catch {
335
- setRecords([]);
336
- } finally {
337
- setLoading(false);
338
- }
339
- },
340
- [get]
341
- );
342
- react.useEffect(() => {
343
- fetchLogs(page);
344
- }, [fetchLogs, page]);
345
- const handleClearAll = async () => {
346
- try {
347
- await del("/strapi-plugin-oidc/audit-logs");
348
- toggleNotification({
349
- type: "success",
350
- message: formatMessage(index.getTrad("auditlog.clear.success"))
351
- });
352
- fetchLogs(1);
353
- } catch {
354
- toggleNotification({
355
- type: "danger",
356
- message: formatMessage(index.getTrad("auditlog.clear.error"))
357
- });
358
- }
359
- };
360
- const handleExport = async () => {
361
- try {
362
- const cookieMatch = document.cookie.match(/(?:^|;\s*)jwtToken=([^;]+)/);
363
- const token = cookieMatch ? decodeURIComponent(cookieMatch[1]) : "";
364
- const response = await fetch("/strapi-plugin-oidc/audit-logs/export", {
365
- headers: { Authorization: `Bearer ${token}` }
366
- });
367
- if (!response.ok) {
368
- toggleNotification({
369
- type: "danger",
370
- message: formatMessage(index.getTrad("auditlog.export.error"))
371
- });
372
- return;
373
- }
374
- const blob = await response.blob();
375
- const url = URL.createObjectURL(blob);
376
- const a = document.createElement("a");
377
- a.href = url;
378
- a.download = `oidc-audit-log-${(/* @__PURE__ */ new Date()).toISOString().slice(0, 10)}.ndjson`;
379
- a.click();
380
- URL.revokeObjectURL(url);
381
- } catch {
382
- toggleNotification({
383
- type: "danger",
384
- message: formatMessage(index.getTrad("auditlog.export.error"))
385
- });
386
- }
387
- };
388
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { children: [
389
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", alignItems: "center", marginBottom: 4, children: [
390
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: [
391
- pagination.total,
392
- " ",
393
- pagination.total === 1 ? "entry" : "entries"
394
- ] }),
395
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, children: [
396
- /* @__PURE__ */ jsxRuntime.jsx(
397
- designSystem.Button,
398
- {
399
- size: "S",
400
- variant: "tertiary",
401
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Download, {}),
402
- onClick: handleExport,
403
- disabled: pagination.total === 0,
404
- children: formatMessage(index.getTrad("auditlog.export"))
405
- }
406
- ),
407
- /* @__PURE__ */ jsxRuntime.jsx(
408
- ConfirmDialog,
409
- {
410
- trigger: /* @__PURE__ */ jsxRuntime.jsx(
411
- designSystem.Button,
412
- {
413
- size: "S",
414
- variant: "danger-light",
415
- startIcon: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {}),
416
- disabled: pagination.total === 0,
417
- children: formatMessage(index.getTrad("auditlog.clear"))
418
- }
419
- ),
420
- title: formatMessage(index.getTrad("auditlog.clear.title")),
421
- body: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral800", textAlign: "center", children: formatMessage(index.getTrad("auditlog.clear.description"), {
422
- count: pagination.total
423
- }) }) }),
424
- confirmLabel: formatMessage(index.getTrad("auditlog.clear")),
425
- onConfirm: handleClearAll
426
- }
427
- )
428
- ] })
429
- ] }),
430
- /* @__PURE__ */ jsxRuntime.jsxs(CustomTable, { colCount: 5, rowCount: records.length, children: [
431
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Thead, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
432
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: formatMessage(index.getTrad("auditlog.table.timestamp")) }),
433
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: formatMessage(index.getTrad("auditlog.table.action")) }),
434
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: formatMessage(index.getTrad("auditlog.table.email")) }),
435
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: formatMessage(index.getTrad("auditlog.table.ip")) }),
436
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { children: formatMessage(index.getTrad("auditlog.table.details")) })
437
- ] }) }),
438
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tbody, { children: [
439
- loading && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tr, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatMessage(index.getTrad("auditlog.loading")) }) }) }) }),
440
- !loading && records.length === 0 && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tr, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { colSpan: 5, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", padding: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "neutral600", children: formatMessage(index.getTrad("auditlog.table.empty")) }) }) }) }),
441
- !loading && records.map((record) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
442
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: /* @__PURE__ */ jsxRuntime.jsx(LocalizedDate, { date: record.createdAt, options: { second: "2-digit" } }) }) }),
443
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 2, alignItems: "center", children: [
444
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: record.action }),
445
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { label: formatMessage(index.getTrad(`auditlog.action.${record.action}`)), children: /* @__PURE__ */ jsxRuntime.jsx(
446
- icons.Information,
447
- {
448
- "aria-hidden": true,
449
- style: { cursor: "help" },
450
- width: "1.4rem",
451
- height: "1.4rem",
452
- fill: "primary600"
453
- }
454
- ) })
455
- ] }) }),
456
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: record.email ?? "—" }) }),
457
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", children: record.ip ?? "—" }) }),
458
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { style: { maxWidth: "200px" }, children: record.details ? /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tooltip, { label: record.details, side: "top", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", style: DETAILS_TEXT_STYLE, children: record.details }) }) : /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", textColor: "neutral600", children: "—" }) })
459
- ] }, record.id))
460
- ] })
461
- ] }),
462
- /* @__PURE__ */ jsxRuntime.jsx(TablePagination, { page, pageCount: pagination.pageCount, onPageChange: setPage })
463
- ] });
464
- }
465
- const AlertMessage = styled__default.default.div`
466
- position: fixed;
467
- left: 50%;
468
- transform: translateX(-50%);
469
- top: 2.875rem;
470
- z-index: 10;
471
- width: 31.25rem;
472
- `;
473
- function SuccessAlertMessage({ onClose }) {
474
- const { formatMessage } = reactIntl.useIntl();
475
- return /* @__PURE__ */ jsxRuntime.jsx(AlertMessage, { children: /* @__PURE__ */ jsxRuntime.jsx(
476
- designSystem.Alert,
477
- {
478
- title: formatMessage(index.getTrad("alert.title.success")),
479
- variant: "success",
480
- closeLabel: "",
481
- onClose,
482
- children: formatMessage(index.getTrad("page.save.success"))
483
- }
484
- ) });
485
- }
486
- function ErrorAlertMessage({ onClose }) {
487
- const { formatMessage } = reactIntl.useIntl();
488
- return /* @__PURE__ */ jsxRuntime.jsx(AlertMessage, { children: /* @__PURE__ */ jsxRuntime.jsx(
489
- designSystem.Alert,
490
- {
491
- title: formatMessage(index.getTrad("alert.title.error")),
492
- variant: "danger",
493
- closeLabel: "",
494
- onClose,
495
- children: formatMessage(index.getTrad("page.save.error"))
496
- }
497
- ) });
498
- }
499
- const SwitchContainer = styled__default.default.label`
500
- position: relative;
501
- display: inline-block;
502
- width: 40px;
503
- height: 24px;
504
- cursor: ${({ $disabled }) => $disabled ? "not-allowed" : "pointer"};
505
- opacity: ${({ $disabled }) => $disabled ? 0.5 : 1};
506
- `;
507
- const SwitchInput = styled__default.default.input`
508
- opacity: 0;
509
- width: 0;
510
- height: 0;
511
-
512
- &:checked + span {
513
- background-color: ${({ theme }) => theme.colors.primary600};
514
- }
515
-
516
- &:focus + span {
517
- box-shadow: 0 0 1px ${({ theme }) => theme.colors.primary600};
518
- }
519
-
520
- &:checked + span:before {
521
- transform: translateX(16px);
522
- }
523
-
524
- &:disabled + span {
525
- pointer-events: none;
526
- }
527
- `;
528
- const SwitchSlider = styled__default.default.span`
529
- position: absolute;
530
- cursor: inherit;
531
- top: 0;
532
- left: 0;
533
- right: 0;
534
- bottom: 0;
535
- background-color: ${({ theme }) => theme.colors.neutral300};
536
- transition: 0.4s;
537
- border-radius: 24px;
538
-
539
- &:before {
540
- position: absolute;
541
- content: "";
542
- height: 18px;
543
- width: 18px;
544
- left: 3px;
545
- bottom: 3px;
546
- background-color: white;
547
- transition: 0.4s;
548
- border-radius: 50%;
549
- }
550
- `;
551
- function CustomSwitch({ checked, onChange, label, disabled }) {
552
- return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 3, children: [
553
- /* @__PURE__ */ jsxRuntime.jsxs(SwitchContainer, { $disabled: disabled, children: [
554
- /* @__PURE__ */ jsxRuntime.jsx(
555
- SwitchInput,
556
- {
557
- type: "checkbox",
558
- checked,
559
- onChange,
560
- disabled
561
- }
562
- ),
563
- /* @__PURE__ */ jsxRuntime.jsx(SwitchSlider, {})
564
- ] }),
565
- label && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", textColor: disabled ? "neutral500" : "neutral800", children: label })
566
- ] });
567
- }
568
- function formatDatetimeForFilename(date) {
569
- const year = date.getFullYear();
570
- const month = String(date.getMonth() + 1).padStart(2, "0");
571
- const day = String(date.getDate()).padStart(2, "0");
572
- const hours = String(date.getHours()).padStart(2, "0");
573
- const minutes = String(date.getMinutes()).padStart(2, "0");
574
- const seconds = String(date.getSeconds()).padStart(2, "0");
575
- return `${year}${month}${day}_${hours}${minutes}${seconds}`;
576
- }
577
- function downloadJson(basename, data) {
578
- const datetime = formatDatetimeForFilename(/* @__PURE__ */ new Date());
579
- const blob = new Blob([JSON.stringify(data, null, 2)], { type: "application/json" });
580
- const url = URL.createObjectURL(blob);
581
- const a = document.createElement("a");
582
- a.href = url;
583
- a.download = `${basename}-${datetime}.json`;
584
- a.click();
585
- URL.revokeObjectURL(url);
586
- }
587
- const initialState = {
588
- current: {
589
- oidcRoles: [],
590
- users: [],
591
- useWhitelist: false,
592
- enforceOIDC: false
593
- },
594
- initial: {
595
- oidcRoles: [],
596
- users: [],
597
- useWhitelist: false,
598
- enforceOIDC: false
599
- },
600
- roles: [],
601
- enforceOIDCConfig: null,
602
- auditLogEnabled: true,
603
- loading: false,
604
- showSuccess: false,
605
- showError: false
606
- };
607
- function reducer(state, action) {
608
- switch (action.type) {
609
- case "hydrate/roles":
610
- return { ...state, roles: action.roles };
611
- case "hydrate/oidcRoles": {
612
- const snapshot = { oidcRoles: action.oidcRoles };
613
- return {
614
- ...state,
615
- current: { ...state.current, ...snapshot },
616
- initial: { ...state.initial, ...snapshot }
617
- };
618
- }
619
- case "hydrate/whitelist": {
620
- const snapshot = {
621
- oidcRoles: action.snapshot.oidcRoles ?? state.current.oidcRoles,
622
- users: action.snapshot.users ?? state.current.users,
623
- useWhitelist: action.snapshot.useWhitelist ?? state.current.useWhitelist,
624
- enforceOIDC: action.snapshot.enforceOIDC ?? state.current.enforceOIDC
625
- };
626
- return {
627
- ...state,
628
- current: snapshot,
629
- initial: structuredClone(snapshot),
630
- enforceOIDCConfig: action.enforceOIDCConfig,
631
- auditLogEnabled: action.auditLogEnabled
632
- };
633
- }
634
- case "patch/oidcRole":
635
- return {
636
- ...state,
637
- current: {
638
- ...state.current,
639
- oidcRoles: state.current.oidcRoles.map(
640
- (role) => role.oauth_type === action.oidcId ? { ...role, role: action.values } : role
641
- )
642
- }
643
- };
644
- case "user/add":
645
- return {
646
- ...state,
647
- current: {
648
- ...state.current,
649
- users: [
650
- ...state.current.users,
651
- { email: action.email, createdAt: (/* @__PURE__ */ new Date()).toISOString() }
652
- ]
653
- }
654
- };
655
- case "user/delete": {
656
- const updatedUsers = state.current.users.filter((u) => u.email !== action.email);
657
- const updated = { users: updatedUsers };
658
- let enforceOIDC = state.current.enforceOIDC;
659
- if (state.current.useWhitelist && updatedUsers.length === 0) {
660
- enforceOIDC = false;
661
- }
662
- return {
663
- ...state,
664
- current: { ...state.current, ...updated, enforceOIDC }
665
- };
666
- }
667
- case "users/clear": {
668
- const updated = { users: [] };
669
- let enforceOIDC = state.current.enforceOIDC;
670
- if (state.current.useWhitelist) {
671
- enforceOIDC = false;
672
- }
673
- return {
674
- ...state,
675
- current: { ...state.current, ...updated, enforceOIDC }
676
- };
677
- }
678
- case "users/replace":
679
- return {
680
- ...state,
681
- current: { ...state.current, users: action.users }
682
- };
683
- case "toggle/useWhitelist": {
684
- const useWhitelist = action.value;
685
- let enforceOIDC = state.current.enforceOIDC;
686
- if (useWhitelist && state.current.users.length === 0) {
687
- enforceOIDC = false;
688
- }
689
- return {
690
- ...state,
691
- current: { ...state.current, useWhitelist, enforceOIDC }
692
- };
693
- }
694
- case "toggle/enforceOIDC":
695
- return {
696
- ...state,
697
- current: { ...state.current, enforceOIDC: action.value }
698
- };
699
- case "commit":
700
- return {
701
- ...state,
702
- initial: structuredClone(
703
- action.snapshot ? { ...state.current, ...action.snapshot } : state.current
704
- )
705
- };
706
- case "loading":
707
- return { ...state, loading: action.value };
708
- case "flash/success":
709
- return { ...state, showSuccess: true };
710
- case "flash/error":
711
- return { ...state, showError: true };
712
- case "flash/clear":
713
- return {
714
- ...state,
715
- showSuccess: action.kind === "success" ? false : state.showSuccess,
716
- showError: action.kind === "error" ? false : state.showError
717
- };
718
- default:
719
- return state;
720
- }
721
- }
722
- function isDirtyPrimitive(a, b) {
723
- return a !== b;
724
- }
725
- function isDirtyArray(a, b) {
726
- return JSON.stringify(a) !== JSON.stringify(b);
727
- }
728
- function useOidcSettings() {
729
- const { get, put, post } = admin.useFetchClient();
730
- const [state, dispatch] = react.useReducer(reducer, initialState);
731
- react.useEffect(() => {
732
- get(`/strapi-plugin-oidc/oidc-roles`).then((response) => {
733
- dispatch({ type: "hydrate/oidcRoles", oidcRoles: response.data });
734
- });
735
- get(`/admin/roles`).then((response) => {
736
- dispatch({ type: "hydrate/roles", roles: response.data.data });
737
- });
738
- get("/strapi-plugin-oidc/whitelist").then((response) => {
739
- const data = response.data;
740
- dispatch({
741
- type: "hydrate/whitelist",
742
- snapshot: {
743
- users: data.whitelistUsers,
744
- useWhitelist: data.useWhitelist,
745
- enforceOIDC: data.enforceOIDC
746
- },
747
- enforceOIDCConfig: data.enforceOIDCConfig ?? null,
748
- auditLogEnabled: data.auditLogEnabled ?? true
749
- });
750
- });
751
- }, [get]);
752
- const onChangeRole = react.useCallback((values, oidcId) => {
753
- dispatch({ type: "patch/oidcRole", oidcId, values });
754
- }, []);
755
- const onRegisterWhitelist = react.useCallback((email) => {
756
- dispatch({ type: "user/add", email });
757
- }, []);
758
- const onDeleteWhitelist = react.useCallback((email) => {
759
- dispatch({ type: "user/delete", email });
760
- }, []);
761
- const onDeleteAll = react.useCallback(() => {
762
- dispatch({ type: "users/clear" });
763
- }, []);
764
- const onImport = react.useCallback(
765
- async (emails) => {
766
- const response = await post("/strapi-plugin-oidc/whitelist/import", {
767
- users: emails.map((e) => ({ email: e }))
768
- });
769
- const refreshed = await get("/strapi-plugin-oidc/whitelist");
770
- dispatch({ type: "users/replace", users: refreshed.data.whitelistUsers });
771
- dispatch({ type: "commit" });
772
- return response.data.importedCount;
773
- },
774
- [post, get]
775
- );
776
- const onExport = react.useCallback(async () => {
777
- const response = await get("/strapi-plugin-oidc/whitelist/export");
778
- const data = response.data;
779
- downloadJson("strapi-oidc-whitelist", data);
780
- }, [get]);
781
- const onToggleWhitelist = react.useCallback((e) => {
782
- dispatch({ type: "toggle/useWhitelist", value: e.target.checked });
783
- }, []);
784
- const onToggleEnforce = react.useCallback((e) => {
785
- dispatch({ type: "toggle/enforceOIDC", value: e.target.checked });
786
- }, []);
787
- const isDirty = react.useMemo(
788
- () => isDirtyPrimitive(state.current.useWhitelist, state.initial.useWhitelist) || isDirtyPrimitive(state.current.enforceOIDC, state.initial.enforceOIDC) || isDirtyArray(state.current.oidcRoles, state.initial.oidcRoles) || isDirtyArray(state.current.users, state.initial.users),
789
- [state.current, state.initial]
790
- );
791
- const onSaveAll = react.useCallback(async () => {
792
- dispatch({ type: "loading", value: true });
793
- try {
794
- await Promise.all([
795
- put("/strapi-plugin-oidc/oidc-roles", {
796
- roles: state.current.oidcRoles.map((role) => ({
797
- oauth_type: role.oauth_type,
798
- role: role.role
799
- }))
800
- }),
801
- put("/strapi-plugin-oidc/whitelist/sync", {
802
- users: state.current.users.map((u) => ({ email: u.email }))
803
- }),
804
- put("/strapi-plugin-oidc/whitelist/settings", {
805
- useWhitelist: state.current.useWhitelist,
806
- enforceOIDC: state.current.enforceOIDC
807
- })
808
- ]);
809
- dispatch({ type: "commit" });
810
- const getResponse = await get("/strapi-plugin-oidc/whitelist");
811
- const data = getResponse.data;
812
- dispatch({
813
- type: "hydrate/whitelist",
814
- snapshot: {
815
- users: data.whitelistUsers,
816
- useWhitelist: data.useWhitelist,
817
- enforceOIDC: data.enforceOIDC
818
- },
819
- enforceOIDCConfig: data.enforceOIDCConfig ?? null,
820
- auditLogEnabled: data.auditLogEnabled ?? true
821
- });
822
- dispatch({ type: "flash/success" });
823
- setTimeout(() => dispatch({ type: "flash/clear", kind: "success" }), 3e3);
824
- } catch (e) {
825
- console.error(e);
826
- dispatch({ type: "flash/error" });
827
- setTimeout(() => dispatch({ type: "flash/clear", kind: "error" }), 3e3);
828
- } finally {
829
- dispatch({ type: "loading", value: false });
830
- }
831
- }, [put, get, state.current]);
832
- return {
833
- state: {
834
- loading: state.loading,
835
- showSuccess: state.showSuccess,
836
- showError: state.showError,
837
- oidcRoles: state.current.oidcRoles,
838
- roles: state.roles,
839
- useWhitelist: state.current.useWhitelist,
840
- enforceOIDC: state.current.enforceOIDC,
841
- enforceOIDCConfig: state.enforceOIDCConfig,
842
- initialEnforceOIDC: state.initial.enforceOIDC,
843
- users: state.current.users,
844
- isDirty,
845
- auditLogEnabled: state.auditLogEnabled
846
- },
847
- actions: {
848
- setSuccess: (val) => dispatch({ type: val ? "flash/success" : "flash/clear", kind: "success" }),
849
- setError: (val) => dispatch({ type: val ? "flash/error" : "flash/clear", kind: "error" }),
850
- onChangeRole,
851
- onRegisterWhitelist,
852
- onDeleteWhitelist,
853
- onDeleteAll,
854
- onImport,
855
- onExport,
856
- onToggleWhitelist,
857
- onToggleEnforce,
858
- onSaveAll
859
- }
860
- };
861
- }
862
- function HomePage$1() {
863
- const { formatMessage } = reactIntl.useIntl();
864
- const { state, actions } = useOidcSettings();
865
- const blocker = reactRouterDom.useBlocker(state.isDirty);
866
- return /* @__PURE__ */ jsxRuntime.jsxs(admin.Page.Protect, { permissions: [{ action: "plugin::strapi-plugin-oidc.read", subject: null }], children: [
867
- /* @__PURE__ */ jsxRuntime.jsx(
868
- admin.Layouts.Header,
869
- {
870
- title: formatMessage(index.getTrad("page.title.oidc")),
871
- subtitle: formatMessage(index.getTrad("page.title"))
872
- }
873
- ),
874
- state.showSuccess && /* @__PURE__ */ jsxRuntime.jsx(SuccessAlertMessage, { onClose: () => actions.setSuccess(false) }),
875
- state.showError && /* @__PURE__ */ jsxRuntime.jsx(ErrorAlertMessage, { onClose: () => actions.setError(false) }),
876
- /* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
877
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { background: "neutral0", hasRadius: true, shadow: "filterShadow", padding: 6, children: [
878
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", children: formatMessage(index.getTrad("roles.title")) }) }),
879
- /* @__PURE__ */ jsxRuntime.jsx(
880
- Role,
881
- {
882
- roles: state.roles,
883
- oidcRoles: state.oidcRoles,
884
- onChangeRole: actions.onChangeRole
885
- }
886
- )
887
- ] }),
888
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { background: "neutral0", hasRadius: true, shadow: "filterShadow", padding: 6, children: [
889
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { justifyContent: "space-between", paddingBottom: 4, children: [
890
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", children: formatMessage(index.getTrad("whitelist.title")) }),
891
- /* @__PURE__ */ jsxRuntime.jsx(
892
- CustomSwitch,
893
- {
894
- checked: state.useWhitelist,
895
- onChange: actions.onToggleWhitelist,
896
- label: state.useWhitelist ? formatMessage(index.getTrad("whitelist.toggle.enabled")) : formatMessage(index.getTrad("whitelist.toggle.disabled"))
897
- }
898
- )
899
- ] }),
900
- /* @__PURE__ */ jsxRuntime.jsx(
901
- Whitelist,
902
- {
903
- loading: state.loading,
904
- users: state.users,
905
- useWhitelist: state.useWhitelist,
906
- onSave: actions.onRegisterWhitelist,
907
- onDelete: actions.onDeleteWhitelist,
908
- onDeleteAll: actions.onDeleteAll,
909
- onImport: actions.onImport,
910
- onExport: actions.onExport
911
- }
912
- )
913
- ] }),
914
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { background: "neutral0", hasRadius: true, shadow: "filterShadow", padding: 6, children: [
915
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 6, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", children: formatMessage(index.getTrad("login.settings.title")) }) }),
916
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 2, children: [
917
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { alignItems: "center", gap: 3, wrap: "wrap", children: [
918
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", style: { minWidth: "280px" }, children: formatMessage(index.getTrad("enforce.title")) }),
919
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { minWidth: "160px", children: /* @__PURE__ */ jsxRuntime.jsx(
920
- CustomSwitch,
921
- {
922
- checked: state.enforceOIDC,
923
- onChange: actions.onToggleEnforce,
924
- disabled: state.enforceOIDCConfig !== null || state.useWhitelist && state.users.length === 0,
925
- label: state.enforceOIDC ? formatMessage(index.getTrad("enforce.toggle.enabled")) : formatMessage(index.getTrad("enforce.toggle.disabled"))
926
- }
927
- ) })
928
- ] }),
929
- state.enforceOIDCConfig !== null && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { background: "primary100", padding: 3, hasRadius: true, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 3, alignItems: "center", children: [
930
- /* @__PURE__ */ jsxRuntime.jsx(icons.Information, { fill: "primary600" }),
931
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "primary600", children: formatMessage(index.getTrad("enforce.config.info")) })
932
- ] }) }),
933
- state.enforceOIDCConfig === null && state.enforceOIDC && state.enforceOIDC !== state.initialEnforceOIDC && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { background: "danger100", padding: 3, hasRadius: true, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 3, alignItems: "center", children: [
934
- /* @__PURE__ */ jsxRuntime.jsx(icons.WarningCircle, { fill: "danger600" }),
935
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", children: formatMessage(index.getTrad("enforce.warning")) })
936
- ] }) })
937
- ] })
938
- ] }),
939
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", children: /* @__PURE__ */ jsxRuntime.jsx(
940
- designSystem.Button,
941
- {
942
- size: "L",
943
- onClick: actions.onSaveAll,
944
- disabled: !state.isDirty || state.loading,
945
- loading: state.loading,
946
- children: formatMessage(index.getTrad("page.save"))
947
- }
948
- ) }),
949
- state.auditLogEnabled && /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { background: "neutral0", hasRadius: true, shadow: "filterShadow", padding: 6, children: [
950
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", children: formatMessage(index.getTrad("auditlog.title")) }) }),
951
- /* @__PURE__ */ jsxRuntime.jsx(AuditLog, {})
952
- ] })
953
- ] }) }),
954
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Root, { open: blocker.state === "blocked", children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
955
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: formatMessage(index.getTrad("unsaved.title")) }),
956
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { children: formatMessage(index.getTrad("unsaved.description")) }),
957
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Footer, { children: [
958
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "tertiary", onClick: () => blocker.reset?.(), children: formatMessage(index.getTrad("unsaved.cancel")) }) }),
959
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Action, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { variant: "danger", onClick: () => blocker.proceed?.(), children: formatMessage(index.getTrad("unsaved.confirm")) }) })
960
- ] })
961
- ] }) })
962
- ] });
963
- }
964
- const HomePage = react.memo(HomePage$1);
965
- function App() {
966
- return /* @__PURE__ */ jsxRuntime.jsx("div", { children: /* @__PURE__ */ jsxRuntime.jsxs(reactRouterDom.Routes, { children: [
967
- /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { index: true, element: /* @__PURE__ */ jsxRuntime.jsx(HomePage, {}) }),
968
- /* @__PURE__ */ jsxRuntime.jsx(reactRouterDom.Route, { path: "*", element: /* @__PURE__ */ jsxRuntime.jsx(admin.Page.Error, {}) })
969
- ] }) });
970
- }
971
- exports.default = App;