@firecms/user_management 3.0.0-beta.11 → 3.0.0-beta.12

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.umd.js CHANGED
@@ -159,8 +159,6 @@
159
159
  dataSourceDelegate,
160
160
  usersPath = "__FIRECMS/config/users",
161
161
  rolesPath = "__FIRECMS/config/roles",
162
- usersLimit,
163
- canEditRoles = true,
164
162
  allowDefaultRolesCreation,
165
163
  includeCollectionConfigPermissions
166
164
  }) {
@@ -361,10 +359,8 @@
361
359
  rolesError,
362
360
  deleteUser,
363
361
  deleteRole,
364
- usersLimit,
365
362
  usersError,
366
363
  isAdmin,
367
- canEditRoles: canEditRoles === void 0 ? true : canEditRoles,
368
364
  allowDefaultRolesCreation: allowDefaultRolesCreation === void 0 ? true : allowDefaultRolesCreation,
369
365
  includeCollectionConfigPermissions: Boolean(includeCollectionConfigPermissions),
370
366
  collectionPermissions,
@@ -463,7 +459,6 @@
463
459
  });
464
460
  function canRoleBeEdited(loggedUser) {
465
461
  const loggedUserIsAdmin = loggedUser.roles?.map((r) => r.id).includes("admin");
466
- console.log("loggedUserIsAdmin", loggedUser);
467
462
  if (!loggedUserIsAdmin) {
468
463
  throw new Error("Only admins can edit roles");
469
464
  }
@@ -1366,7 +1361,7 @@
1366
1361
  return t11;
1367
1362
  }
1368
1363
  const RolesView = React.memo(function RolesView2(t0) {
1369
- const $ = reactCompilerRuntime.c(23);
1364
+ const $ = reactCompilerRuntime.c(13);
1370
1365
  const {
1371
1366
  children
1372
1367
  } = t0;
@@ -1375,9 +1370,6 @@
1375
1370
  } = core.useNavigationController();
1376
1371
  const [dialogOpen, setDialogOpen] = React.useState(false);
1377
1372
  const [selectedRole, setSelectedRole] = React.useState();
1378
- const {
1379
- canEditRoles
1380
- } = useUserManagement();
1381
1373
  let t1;
1382
1374
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1383
1375
  t1 = (user) => {
@@ -1407,78 +1399,47 @@
1407
1399
  } else {
1408
1400
  t3 = $[2];
1409
1401
  }
1410
- const t4 = !canEditRoles ? "Update plans to customise roles" : void 0;
1411
- const t5 = !canEditRoles;
1412
- let t6;
1413
- let t7;
1402
+ let t4;
1403
+ let t5;
1414
1404
  if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
1415
- t6 = /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {});
1416
- t7 = () => setDialogOpen(true);
1417
- $[3] = t6;
1418
- $[4] = t7;
1419
- } else {
1420
- t6 = $[3];
1421
- t7 = $[4];
1422
- }
1423
- let t8;
1424
- if ($[5] !== t5) {
1425
- t8 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "large", disabled: t5, startIcon: t6, onClick: t7, children: "Add role" });
1426
- $[5] = t5;
1427
- $[6] = t8;
1428
- } else {
1429
- t8 = $[6];
1430
- }
1431
- let t9;
1432
- if ($[7] !== t4 || $[8] !== t8) {
1433
- t9 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
1405
+ t4 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
1434
1406
  t3,
1435
- /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { asChild: true, title: t4, children: t8 })
1407
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "large", startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), onClick: () => setDialogOpen(true), children: "Add role" })
1436
1408
  ] });
1437
- $[7] = t4;
1438
- $[8] = t8;
1439
- $[9] = t9;
1440
- } else {
1441
- t9 = $[9];
1442
- }
1443
- const t10 = Boolean(canEditRoles);
1444
- let t11;
1445
- if ($[10] !== t10) {
1446
- t11 = /* @__PURE__ */ jsxRuntime.jsx(RolesTable, { onRoleClicked, editable: t10 });
1447
- $[10] = t10;
1448
- $[11] = t11;
1409
+ t5 = /* @__PURE__ */ jsxRuntime.jsx(RolesTable, { onRoleClicked, editable: true });
1410
+ $[3] = t4;
1411
+ $[4] = t5;
1449
1412
  } else {
1450
- t11 = $[11];
1413
+ t4 = $[3];
1414
+ t5 = $[4];
1451
1415
  }
1452
- const t12 = selectedRole?.id ?? "new";
1453
- let t13;
1454
- if ($[12] !== canEditRoles || $[13] !== collections || $[14] !== dialogOpen || $[15] !== selectedRole || $[16] !== t12) {
1455
- t13 = /* @__PURE__ */ jsxRuntime.jsx(RolesDetailsForm, { open: dialogOpen, role: selectedRole, editable: canEditRoles, collections, handleClose }, t12);
1456
- $[12] = canEditRoles;
1457
- $[13] = collections;
1458
- $[14] = dialogOpen;
1459
- $[15] = selectedRole;
1460
- $[16] = t12;
1461
- $[17] = t13;
1416
+ const t6 = selectedRole?.id ?? "new";
1417
+ let t7;
1418
+ if ($[5] !== collections || $[6] !== dialogOpen || $[7] !== selectedRole || $[8] !== t6) {
1419
+ t7 = /* @__PURE__ */ jsxRuntime.jsx(RolesDetailsForm, { open: dialogOpen, role: selectedRole, editable: true, collections, handleClose }, t6);
1420
+ $[5] = collections;
1421
+ $[6] = dialogOpen;
1422
+ $[7] = selectedRole;
1423
+ $[8] = t6;
1424
+ $[9] = t7;
1462
1425
  } else {
1463
- t13 = $[17];
1426
+ t7 = $[9];
1464
1427
  }
1465
- let t14;
1466
- if ($[18] !== children || $[19] !== t11 || $[20] !== t13 || $[21] !== t9) {
1467
- t14 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
1428
+ let t8;
1429
+ if ($[10] !== children || $[11] !== t7) {
1430
+ t8 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
1468
1431
  children,
1469
- t9,
1470
- t11,
1471
- t13
1432
+ t4,
1433
+ t5,
1434
+ t7
1472
1435
  ] });
1473
- $[18] = children;
1474
- $[19] = t11;
1475
- $[20] = t13;
1476
- $[21] = t9;
1477
- $[22] = t14;
1436
+ $[10] = children;
1437
+ $[11] = t7;
1438
+ $[12] = t8;
1478
1439
  } else {
1479
- t14 = $[22];
1440
+ t8 = $[12];
1480
1441
  }
1481
- return t14;
1442
+ return t8;
1482
1443
  });
1483
1444
  const UserYupSchema = Yup__namespace.object().shape({
1484
1445
  displayName: Yup__namespace.string().required("Required"),
@@ -2019,17 +1980,13 @@
2019
1980
  return /* @__PURE__ */ jsxRuntime.jsx(RoleChip, { role: userRole }, userRole?.id);
2020
1981
  }
2021
1982
  const UsersView = function UsersView2(t0) {
2022
- const $ = reactCompilerRuntime.c(16);
1983
+ const $ = reactCompilerRuntime.c(12);
2023
1984
  const {
2024
1985
  children
2025
1986
  } = t0;
2026
1987
  const [dialogOpen, setDialogOpen] = React.useState();
2027
1988
  const [selectedUser, setSelectedUser] = React.useState();
2028
- const {
2029
- users,
2030
- usersLimit
2031
- } = useUserManagement();
2032
- const reachedUsersLimit = usersLimit !== void 0 && users && users.length >= usersLimit;
1989
+ useUserManagement();
2033
1990
  let t1;
2034
1991
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2035
1992
  t1 = (user) => {
@@ -2062,60 +2019,44 @@
2062
2019
  let t4;
2063
2020
  let t5;
2064
2021
  if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
2065
- t4 = /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {});
2066
- t5 = () => setDialogOpen(true);
2022
+ t4 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
2023
+ t3,
2024
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "large", startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), onClick: () => setDialogOpen(true), children: "Add user" })
2025
+ ] });
2026
+ t5 = /* @__PURE__ */ jsxRuntime.jsx(UsersTable, { onUserClicked });
2067
2027
  $[3] = t4;
2068
2028
  $[4] = t5;
2069
2029
  } else {
2070
2030
  t4 = $[3];
2071
2031
  t5 = $[4];
2072
2032
  }
2073
- let t6;
2074
- if ($[5] !== reachedUsersLimit) {
2075
- t6 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
2076
- t3,
2077
- /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "large", disabled: reachedUsersLimit, startIcon: t4, onClick: t5, children: "Add user" })
2078
- ] });
2079
- $[5] = reachedUsersLimit;
2033
+ const t6 = selectedUser?.uid ?? "new";
2034
+ const t7 = dialogOpen ?? false;
2035
+ let t8;
2036
+ if ($[5] !== selectedUser || $[6] !== t6 || $[7] !== t7) {
2037
+ t8 = /* @__PURE__ */ jsxRuntime.jsx(UserDetailsForm, { open: t7, user: selectedUser, handleClose }, t6);
2038
+ $[5] = selectedUser;
2080
2039
  $[6] = t6;
2081
- } else {
2082
- t6 = $[6];
2083
- }
2084
- let t7;
2085
- if ($[7] === Symbol.for("react.memo_cache_sentinel")) {
2086
- t7 = /* @__PURE__ */ jsxRuntime.jsx(UsersTable, { onUserClicked });
2087
2040
  $[7] = t7;
2041
+ $[8] = t8;
2088
2042
  } else {
2089
- t7 = $[7];
2090
- }
2091
- const t8 = selectedUser?.uid ?? "new";
2092
- const t9 = dialogOpen ?? false;
2093
- let t10;
2094
- if ($[8] !== selectedUser || $[9] !== t8 || $[10] !== t9) {
2095
- t10 = /* @__PURE__ */ jsxRuntime.jsx(UserDetailsForm, { open: t9, user: selectedUser, handleClose }, t8);
2096
- $[8] = selectedUser;
2097
- $[9] = t8;
2098
- $[10] = t9;
2099
- $[11] = t10;
2100
- } else {
2101
- t10 = $[11];
2043
+ t8 = $[8];
2102
2044
  }
2103
- let t11;
2104
- if ($[12] !== children || $[13] !== t10 || $[14] !== t6) {
2105
- t11 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
2045
+ let t9;
2046
+ if ($[9] !== children || $[10] !== t8) {
2047
+ t9 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
2106
2048
  children,
2107
- t6,
2108
- t7,
2109
- t10
2049
+ t4,
2050
+ t5,
2051
+ t8
2110
2052
  ] });
2111
- $[12] = children;
2112
- $[13] = t10;
2113
- $[14] = t6;
2114
- $[15] = t11;
2053
+ $[9] = children;
2054
+ $[10] = t8;
2055
+ $[11] = t9;
2115
2056
  } else {
2116
- t11 = $[15];
2057
+ t9 = $[11];
2117
2058
  }
2118
- return t11;
2059
+ return t9;
2119
2060
  };
2120
2061
  function useUserManagementPlugin(t0) {
2121
2062
  const $ = reactCompilerRuntime.c(12);