strapi-plugin-oidc 1.0.3 → 1.0.5

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.
@@ -7,7 +7,7 @@ const react = require("react");
7
7
  const designSystem = require("@strapi/design-system");
8
8
  const icons = require("@strapi/icons");
9
9
  const reactIntl = require("react-intl");
10
- const index = require("./index-C0GkDnGG.js");
10
+ const index = require("./index-B525UaV3.js");
11
11
  const en = require("./en-jFPbEFeK.js");
12
12
  const styled = require("styled-components");
13
13
  const _interopDefault = (e) => e && e.__esModule ? e : { default: e };
@@ -28,19 +28,22 @@ function Role({ oidcRoles, roles, onChangeRole }) {
28
28
  {
29
29
  withTags: true,
30
30
  placeholder: formatMessage(getTrad("roles.placeholder")),
31
- value: oidcRole["role"] ? oidcRole["role"].map((r) => r.toString()) : [],
31
+ value: oidcRole.role ? oidcRole.role.map((r) => String(r)) : [],
32
32
  onChange: (value) => {
33
33
  if (value && value.length > 0) {
34
- onChangeRole(value, oidcRole["oauth_type"]);
34
+ onChangeRole(value, oidcRole.oauth_type);
35
35
  }
36
36
  },
37
- children: roles.map((role) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.MultiSelectOption, { value: role.id.toString(), children: role.name }, role.id))
37
+ children: roles.map((role) => /* @__PURE__ */ jsxRuntime.jsx(designSystem.MultiSelectOption, { value: String(role.id), children: role.name }, role.id))
38
38
  }
39
- ) }, oidcRole["oauth_type"])) })
39
+ ) }, oidcRole.oauth_type)) })
40
40
  ] });
41
41
  }
42
42
  const CustomTable = styled__default.default(designSystem.Table)`
43
- th, td, th span, td span {
43
+ th,
44
+ td,
45
+ th span,
46
+ td span {
44
47
  font-size: 1.3rem !important;
45
48
  }
46
49
  `;
@@ -54,7 +57,15 @@ const LocalizedDate = ({ date }) => {
54
57
  minute: "2-digit"
55
58
  }).format(new Date(date));
56
59
  };
57
- function Whitelist({ users, roles, oidcRoles = [], useWhitelist, loading, onSave, onDelete }) {
60
+ function Whitelist({
61
+ users,
62
+ roles,
63
+ oidcRoles = [],
64
+ useWhitelist,
65
+ loading,
66
+ onSave,
67
+ onDelete
68
+ }) {
58
69
  const [email, setEmail] = react.useState("");
59
70
  const [selectedRoles, setSelectedRoles] = react.useState([]);
60
71
  const [page, setPage] = react.useState(1);
@@ -65,9 +76,7 @@ function Whitelist({ users, roles, oidcRoles = [], useWhitelist, loading, onSave
65
76
  const onSaveEmail = react.useCallback(async () => {
66
77
  const emailText = email.trim();
67
78
  if (users.some((user) => user.email === emailText)) {
68
- alert(
69
- formatMessage(getTrad("whitelist.error.unique"))
70
- );
79
+ alert(formatMessage(getTrad("whitelist.error.unique")));
71
80
  } else {
72
81
  await onSave(emailText, selectedRoles);
73
82
  setEmail("");
@@ -126,61 +135,103 @@ function Whitelist({ users, roles, oidcRoles = [], useWhitelist, loading, onSave
126
135
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Th, { style: { paddingRight: 0 }, children: " " })
127
136
  ] }) }),
128
137
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Tbody, { children: users.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(getTrad("whitelist.table.empty")) }) }) }) }) : paginatedUsers.map((user, index2) => {
129
- let userRolesNames = (user.roles || []).map((roleId) => {
130
- const r = roles.find((ro) => ro.id.toString() === roleId.toString());
138
+ const getRoleNames = (roleIds) => roleIds.map((roleId) => {
139
+ const r = roles.find((ro) => String(ro.id) === String(roleId));
131
140
  return r ? r.name : roleId;
132
141
  }).join(", ");
142
+ let userRolesNames = getRoleNames(user.roles || []);
133
143
  if (!userRolesNames) {
134
144
  const defaultRolesIds = oidcRoles.reduce((acc, oidc) => {
135
- if (oidc.role) {
136
- acc.push(...oidc.role);
137
- }
145
+ if (oidc.role) acc.push(...oidc.role);
138
146
  return acc;
139
147
  }, []);
140
- userRolesNames = defaultRolesIds.map((roleId) => {
141
- const r = roles.find((ro) => ro.id.toString() === roleId.toString());
142
- return r ? r.name : roleId;
143
- }).join(", ");
148
+ userRolesNames = getRoleNames(defaultRolesIds);
144
149
  }
145
150
  return /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Tr, { children: [
146
151
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: index2 + 1 + (page - 1) * PAGE_SIZE }),
147
152
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: user.email }),
148
153
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: userRolesNames || "-" }),
149
154
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { children: /* @__PURE__ */ jsxRuntime.jsx(LocalizedDate, { date: user.createdAt }) }),
150
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { style: { paddingRight: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "flex-end", onClick: (e) => e.stopPropagation(), style: { width: "100%" }, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Root, { children: [
151
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.IconButton, { label: formatMessage(getTrad("whitelist.delete.label")), withTooltip: false, children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {}) }) }),
152
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
153
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: formatMessage(getTrad("whitelist.delete.title")) }),
154
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { icon: /* @__PURE__ */ jsxRuntime.jsx(icons.WarningCircle, { fill: "danger600" }), children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "center", gap: 2, children: [
155
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id: "confirm-description", children: formatMessage(getTrad("whitelist.delete.description")) }) }),
156
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", children: user.email }) }),
157
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", marginTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: formatMessage(getTrad("whitelist.delete.note")) }) })
158
- ] }) }),
159
- /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Footer, { children: [
160
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { fullWidth: true, variant: "tertiary", children: formatMessage(getTrad("page.cancel")) }) }),
161
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Action, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { fullWidth: true, variant: "danger-light", onClick: () => onDelete(user.email), children: formatMessage(getTrad("page.ok")) }) })
155
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Td, { style: { paddingRight: 0 }, children: /* @__PURE__ */ jsxRuntime.jsx(
156
+ designSystem.Flex,
157
+ {
158
+ justifyContent: "flex-end",
159
+ onClick: (e) => e.stopPropagation(),
160
+ style: { width: "100%" },
161
+ children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Root, { children: [
162
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Trigger, { children: /* @__PURE__ */ jsxRuntime.jsx(
163
+ designSystem.IconButton,
164
+ {
165
+ label: formatMessage(getTrad("whitelist.delete.label")),
166
+ withTooltip: false,
167
+ children: /* @__PURE__ */ jsxRuntime.jsx(icons.Trash, {})
168
+ }
169
+ ) }),
170
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Content, { children: [
171
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Header, { children: formatMessage(getTrad("whitelist.delete.title")) }),
172
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Body, { icon: /* @__PURE__ */ jsxRuntime.jsx(icons.WarningCircle, { fill: "danger600" }), children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "center", gap: 2, children: [
173
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { id: "confirm-description", children: formatMessage(getTrad("whitelist.delete.description")) }) }),
174
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "omega", fontWeight: "bold", children: user.email }) }),
175
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Flex, { justifyContent: "center", marginTop: 2, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", textColor: "neutral600", children: formatMessage(getTrad("whitelist.delete.note")) }) })
176
+ ] }) }),
177
+ /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Dialog.Footer, { children: [
178
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Cancel, { children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Button, { fullWidth: true, variant: "tertiary", children: formatMessage(getTrad("page.cancel")) }) }),
179
+ /* @__PURE__ */ jsxRuntime.jsx(designSystem.Dialog.Action, { children: /* @__PURE__ */ jsxRuntime.jsx(
180
+ designSystem.Button,
181
+ {
182
+ fullWidth: true,
183
+ variant: "danger-light",
184
+ onClick: () => onDelete(user.email),
185
+ children: formatMessage(getTrad("page.ok"))
186
+ }
187
+ ) })
188
+ ] })
189
+ ] })
162
190
  ] })
163
- ] })
164
- ] }) }) })
191
+ }
192
+ ) })
165
193
  ] }, user.email);
166
194
  }) })
167
195
  ] }),
168
196
  pageCount > 1 && /* @__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: [
169
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.PreviousLink, { href: "#", onClick: (e) => {
170
- e.preventDefault();
171
- setPage((p) => Math.max(1, p - 1));
172
- }, children: "Go to previous page" }),
173
- Array.from({ length: pageCount }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsxs(designSystem.PageLink, { number: i + 1, href: "#", onClick: (e) => {
174
- e.preventDefault();
175
- setPage(i + 1);
176
- }, children: [
177
- "Go to page ",
197
+ /* @__PURE__ */ jsxRuntime.jsx(
198
+ designSystem.PreviousLink,
199
+ {
200
+ href: "#",
201
+ onClick: (e) => {
202
+ e.preventDefault();
203
+ setPage((p) => Math.max(1, p - 1));
204
+ },
205
+ children: "Go to previous page"
206
+ }
207
+ ),
208
+ Array.from({ length: pageCount }).map((_, i) => /* @__PURE__ */ jsxRuntime.jsxs(
209
+ designSystem.PageLink,
210
+ {
211
+ number: i + 1,
212
+ href: "#",
213
+ onClick: (e) => {
214
+ e.preventDefault();
215
+ setPage(i + 1);
216
+ },
217
+ children: [
218
+ "Go to page ",
219
+ i + 1
220
+ ]
221
+ },
178
222
  i + 1
179
- ] }, i + 1)),
180
- /* @__PURE__ */ jsxRuntime.jsx(designSystem.NextLink, { href: "#", onClick: (e) => {
181
- e.preventDefault();
182
- setPage((p) => Math.min(pageCount, p + 1));
183
- }, children: "Go to next page" })
223
+ )),
224
+ /* @__PURE__ */ jsxRuntime.jsx(
225
+ designSystem.NextLink,
226
+ {
227
+ href: "#",
228
+ onClick: (e) => {
229
+ e.preventDefault();
230
+ setPage((p) => Math.min(pageCount, p + 1));
231
+ },
232
+ children: "Go to next page"
233
+ }
234
+ )
184
235
  ] }) }) })
185
236
  ] }) });
186
237
  }
@@ -301,9 +352,12 @@ function CustomSwitch({ checked, onChange, label, disabled }) {
301
352
  label && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "pi", fontWeight: "bold", textColor: disabled ? "neutral500" : "neutral800", children: label })
302
353
  ] });
303
354
  }
304
- function HomePage$1() {
305
- const { formatMessage } = reactIntl.useIntl();
355
+ function useOidcSettings() {
356
+ const { get, put } = admin.useFetchClient();
306
357
  const [loading, setLoading] = react.useState(false);
358
+ const [showSuccess, setSuccess] = react.useState(false);
359
+ const [showError, setError] = react.useState(false);
360
+ const [showMatched, setMatched] = react.useState(0);
307
361
  const [initialOidcRoles, setInitialOIDCRoles] = react.useState([]);
308
362
  const [oidcRoles, setOIDCRoles] = react.useState([]);
309
363
  const [roles, setRoles] = react.useState([]);
@@ -313,10 +367,6 @@ function HomePage$1() {
313
367
  const [enforceOIDC, setEnforceOIDC] = react.useState(false);
314
368
  const [initialUsers, setInitialUsers] = react.useState([]);
315
369
  const [users, setUsers] = react.useState([]);
316
- const [showSuccess, setSuccess] = react.useState(false);
317
- const [showError, setError] = react.useState(false);
318
- const [showMatched, setMatched] = react.useState(0);
319
- const { get, put, post, del } = admin.useFetchClient();
320
370
  react.useEffect(() => {
321
371
  get(`/strapi-plugin-oidc/oidc-roles`).then((response) => {
322
372
  setOIDCRoles(response.data);
@@ -333,22 +383,34 @@ function HomePage$1() {
333
383
  setEnforceOIDC(response.data.enforceOIDC);
334
384
  setInitialEnforceOIDC(response.data.enforceOIDC);
335
385
  });
336
- }, [setOIDCRoles, setRoles]);
386
+ }, [get]);
337
387
  const onChangeRole = (values, oidcId) => {
338
- for (const oidcRole of oidcRoles) {
339
- if (oidcRole["oauth_type"] === oidcId) {
340
- oidcRole["role"] = values;
341
- }
342
- }
343
- setOIDCRoles(oidcRoles.slice());
388
+ const updatedRoles = oidcRoles.map(
389
+ (role) => role.oauth_type === oidcId ? { ...role, role: values } : role
390
+ );
391
+ setOIDCRoles(updatedRoles);
392
+ };
393
+ const onRegisterWhitelist = async (email, selectedRoles) => {
394
+ const newUser = { email, roles: selectedRoles, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
395
+ setUsers([...users, newUser]);
396
+ };
397
+ const onDeleteWhitelist = async (email) => {
398
+ setUsers(users.filter((u) => u.email !== email));
399
+ };
400
+ const onToggleWhitelist = (e) => {
401
+ setUseWhitelist(e.target.checked);
344
402
  };
403
+ const onToggleEnforce = (e) => {
404
+ setEnforceOIDC(e.target.checked);
405
+ };
406
+ const isDirty = useWhitelist !== initialUseWhitelist || enforceOIDC !== initialEnforceOIDC || JSON.stringify(oidcRoles) !== JSON.stringify(initialOidcRoles) || JSON.stringify(users) !== JSON.stringify(initialUsers);
345
407
  const onSaveAll = async () => {
346
408
  setLoading(true);
347
409
  try {
348
410
  await put("/strapi-plugin-oidc/oidc-roles", {
349
411
  roles: oidcRoles.map((role) => ({
350
- "oauth_type": role["oauth_type"],
351
- role: role["role"]
412
+ oauth_type: role.oauth_type,
413
+ role: role.role
352
414
  }))
353
415
  });
354
416
  await put("/strapi-plugin-oidc/whitelist/settings", {
@@ -365,43 +427,51 @@ function HomePage$1() {
365
427
  setUsers(getResponse.data.whitelistUsers);
366
428
  setInitialUsers(JSON.parse(JSON.stringify(getResponse.data.whitelistUsers)));
367
429
  });
368
- if (syncResponse.data && syncResponse.data.matchedExistingUsersCount > 0) {
430
+ if (syncResponse.data?.matchedExistingUsersCount > 0) {
369
431
  setMatched(syncResponse.data.matchedExistingUsersCount);
370
- setTimeout(() => {
371
- setMatched(0);
372
- }, 3e3);
432
+ setTimeout(() => setMatched(0), 3e3);
373
433
  } else {
374
434
  setSuccess(true);
375
- setTimeout(() => {
376
- setSuccess(false);
377
- }, 3e3);
435
+ setTimeout(() => setSuccess(false), 3e3);
378
436
  }
379
437
  } catch (e) {
380
438
  console.error(e);
381
439
  setError(true);
382
- setTimeout(() => {
383
- setError(false);
384
- }, 3e3);
440
+ setTimeout(() => setError(false), 3e3);
385
441
  } finally {
386
442
  setLoading(false);
387
443
  }
388
444
  };
389
- const onRegisterWhitelist = async (email, selectedRoles) => {
390
- const newUser = { email, roles: selectedRoles, createdAt: (/* @__PURE__ */ new Date()).toISOString() };
391
- setUsers([...users, newUser]);
392
- };
393
- const onDeleteWhitelist = async (email) => {
394
- setUsers(users.filter((u) => u.email !== email));
395
- };
396
- const onToggleWhitelist = (e) => {
397
- const newValue = e.target.checked;
398
- setUseWhitelist(newValue);
399
- };
400
- const onToggleEnforce = (e) => {
401
- const newValue = e.target.checked;
402
- setEnforceOIDC(newValue);
445
+ return {
446
+ state: {
447
+ loading,
448
+ showSuccess,
449
+ showError,
450
+ showMatched,
451
+ oidcRoles,
452
+ roles,
453
+ useWhitelist,
454
+ enforceOIDC,
455
+ initialEnforceOIDC,
456
+ users,
457
+ isDirty
458
+ },
459
+ actions: {
460
+ setSuccess,
461
+ setError,
462
+ setMatched,
463
+ onChangeRole,
464
+ onRegisterWhitelist,
465
+ onDeleteWhitelist,
466
+ onToggleWhitelist,
467
+ onToggleEnforce,
468
+ onSaveAll
469
+ }
403
470
  };
404
- const isDirty = useWhitelist !== initialUseWhitelist || enforceOIDC !== initialEnforceOIDC || JSON.stringify(oidcRoles) !== JSON.stringify(initialOidcRoles) || JSON.stringify(users) !== JSON.stringify(initialUsers);
471
+ }
472
+ function HomePage$1() {
473
+ const { formatMessage } = reactIntl.useIntl();
474
+ const { state, actions } = useOidcSettings();
405
475
  return /* @__PURE__ */ jsxRuntime.jsxs(admin.Page.Protect, { permissions: [{ action: "plugin::strapi-plugin-oidc.read", subject: null }], children: [
406
476
  /* @__PURE__ */ jsxRuntime.jsx(
407
477
  admin.Layouts.Header,
@@ -410,18 +480,18 @@ function HomePage$1() {
410
480
  subtitle: formatMessage(getTrad("page.title"))
411
481
  }
412
482
  ),
413
- showSuccess && /* @__PURE__ */ jsxRuntime.jsx(SuccessAlertMessage, { onClose: () => setSuccess(false) }),
414
- showError && /* @__PURE__ */ jsxRuntime.jsx(ErrorAlertMessage, { onClose: () => setError(false) }),
415
- showMatched > 0 && /* @__PURE__ */ jsxRuntime.jsx(MatchedUserAlertMessage, { count: showMatched, onClose: () => setMatched(0) }),
483
+ state.showSuccess && /* @__PURE__ */ jsxRuntime.jsx(SuccessAlertMessage, { onClose: () => actions.setSuccess(false) }),
484
+ state.showError && /* @__PURE__ */ jsxRuntime.jsx(ErrorAlertMessage, { onClose: () => actions.setError(false) }),
485
+ state.showMatched > 0 && /* @__PURE__ */ jsxRuntime.jsx(MatchedUserAlertMessage, { count: state.showMatched, onClose: () => actions.setMatched(0) }),
416
486
  /* @__PURE__ */ jsxRuntime.jsx(admin.Layouts.Content, { children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { direction: "column", alignItems: "stretch", gap: 6, children: [
417
487
  /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Box, { background: "neutral0", hasRadius: true, shadow: "filterShadow", padding: 6, children: [
418
488
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { paddingBottom: 4, children: /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { variant: "beta", tag: "h2", children: formatMessage(getTrad("roles.title")) }) }),
419
489
  /* @__PURE__ */ jsxRuntime.jsx(
420
490
  Role,
421
491
  {
422
- roles,
423
- oidcRoles,
424
- onChangeRole
492
+ roles: state.roles,
493
+ oidcRoles: state.oidcRoles,
494
+ onChangeRole: actions.onChangeRole
425
495
  }
426
496
  )
427
497
  ] }),
@@ -431,22 +501,22 @@ function HomePage$1() {
431
501
  /* @__PURE__ */ jsxRuntime.jsx(
432
502
  CustomSwitch,
433
503
  {
434
- checked: useWhitelist,
435
- onChange: onToggleWhitelist,
436
- label: useWhitelist ? formatMessage(getTrad("whitelist.toggle.enabled")) : formatMessage(getTrad("whitelist.toggle.disabled"))
504
+ checked: state.useWhitelist,
505
+ onChange: actions.onToggleWhitelist,
506
+ label: state.useWhitelist ? formatMessage(getTrad("whitelist.toggle.enabled")) : formatMessage(getTrad("whitelist.toggle.disabled"))
437
507
  }
438
508
  )
439
509
  ] }),
440
510
  /* @__PURE__ */ jsxRuntime.jsx(
441
511
  Whitelist,
442
512
  {
443
- loading,
444
- users,
445
- roles,
446
- oidcRoles,
447
- useWhitelist,
448
- onSave: onRegisterWhitelist,
449
- onDelete: onDeleteWhitelist
513
+ loading: state.loading,
514
+ users: state.users,
515
+ roles: state.roles,
516
+ oidcRoles: state.oidcRoles,
517
+ useWhitelist: state.useWhitelist,
518
+ onSave: actions.onRegisterWhitelist,
519
+ onDelete: actions.onDeleteWhitelist
450
520
  }
451
521
  )
452
522
  ] }),
@@ -456,14 +526,14 @@ function HomePage$1() {
456
526
  /* @__PURE__ */ jsxRuntime.jsx(
457
527
  CustomSwitch,
458
528
  {
459
- checked: enforceOIDC,
460
- onChange: onToggleEnforce,
461
- disabled: useWhitelist && users.length === 0,
462
- label: enforceOIDC ? formatMessage(getTrad("enforce.toggle.enabled")) : formatMessage(getTrad("enforce.toggle.disabled"))
529
+ checked: state.enforceOIDC,
530
+ onChange: actions.onToggleEnforce,
531
+ disabled: state.useWhitelist && state.users.length === 0,
532
+ label: state.enforceOIDC ? formatMessage(getTrad("enforce.toggle.enabled")) : formatMessage(getTrad("enforce.toggle.disabled"))
463
533
  }
464
534
  )
465
535
  ] }),
466
- enforceOIDC && enforceOIDC !== initialEnforceOIDC && /* @__PURE__ */ jsxRuntime.jsx(designSystem.Box, { background: "danger100", padding: 3, hasRadius: true, children: /* @__PURE__ */ jsxRuntime.jsxs(designSystem.Flex, { gap: 3, alignItems: "center", children: [
536
+ 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: [
467
537
  /* @__PURE__ */ jsxRuntime.jsx(icons.WarningCircle, { fill: "danger600" }),
468
538
  /* @__PURE__ */ jsxRuntime.jsx(designSystem.Typography, { textColor: "danger600", children: formatMessage(getTrad("enforce.warning")) })
469
539
  ] }) })
@@ -472,9 +542,9 @@ function HomePage$1() {
472
542
  designSystem.Button,
473
543
  {
474
544
  size: "L",
475
- onClick: onSaveAll,
476
- disabled: !isDirty || loading,
477
- loading,
545
+ onClick: actions.onSaveAll,
546
+ disabled: !state.isDirty || state.loading,
547
+ loading: state.loading,
478
548
  children: formatMessage(getTrad("page.save"))
479
549
  }
480
550
  ) })
@@ -1,4 +1,4 @@
1
1
  "use strict";
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
- const index = require("./index-C0GkDnGG.js");
3
+ const index = require("./index-B525UaV3.js");
4
4
  exports.default = index.index;
@@ -1,4 +1,4 @@
1
- import { i } from "./index-BuuCScSN.mjs";
1
+ import { i } from "./index-D3AvxXlB.mjs";
2
2
  export {
3
3
  i as default
4
4
  };