@firecms/user_management 3.0.0-canary.183 → 3.0.0-canary.186

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,
@@ -1366,7 +1362,7 @@
1366
1362
  return t11;
1367
1363
  }
1368
1364
  const RolesView = React.memo(function RolesView2(t0) {
1369
- const $ = reactCompilerRuntime.c(23);
1365
+ const $ = reactCompilerRuntime.c(13);
1370
1366
  const {
1371
1367
  children
1372
1368
  } = t0;
@@ -1375,9 +1371,6 @@
1375
1371
  } = core.useNavigationController();
1376
1372
  const [dialogOpen, setDialogOpen] = React.useState(false);
1377
1373
  const [selectedRole, setSelectedRole] = React.useState();
1378
- const {
1379
- canEditRoles
1380
- } = useUserManagement();
1381
1374
  let t1;
1382
1375
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
1383
1376
  t1 = (user) => {
@@ -1407,78 +1400,47 @@
1407
1400
  } else {
1408
1401
  t3 = $[2];
1409
1402
  }
1410
- const t4 = !canEditRoles ? "Update plans to customise roles" : void 0;
1411
- const t5 = !canEditRoles;
1412
- let t6;
1413
- let t7;
1403
+ let t4;
1404
+ let t5;
1414
1405
  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: [
1406
+ t4 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
1434
1407
  t3,
1435
- /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { asChild: true, title: t4, children: t8 })
1408
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "large", startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), onClick: () => setDialogOpen(true), children: "Add role" })
1436
1409
  ] });
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;
1410
+ t5 = /* @__PURE__ */ jsxRuntime.jsx(RolesTable, { onRoleClicked, editable: true });
1411
+ $[3] = t4;
1412
+ $[4] = t5;
1449
1413
  } else {
1450
- t11 = $[11];
1414
+ t4 = $[3];
1415
+ t5 = $[4];
1451
1416
  }
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;
1417
+ const t6 = selectedRole?.id ?? "new";
1418
+ let t7;
1419
+ if ($[5] !== collections || $[6] !== dialogOpen || $[7] !== selectedRole || $[8] !== t6) {
1420
+ t7 = /* @__PURE__ */ jsxRuntime.jsx(RolesDetailsForm, { open: dialogOpen, role: selectedRole, editable: true, collections, handleClose }, t6);
1421
+ $[5] = collections;
1422
+ $[6] = dialogOpen;
1423
+ $[7] = selectedRole;
1424
+ $[8] = t6;
1425
+ $[9] = t7;
1462
1426
  } else {
1463
- t13 = $[17];
1427
+ t7 = $[9];
1464
1428
  }
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: [
1429
+ let t8;
1430
+ if ($[10] !== children || $[11] !== t7) {
1431
+ t8 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
1468
1432
  children,
1469
- t9,
1470
- t11,
1471
- t13
1433
+ t4,
1434
+ t5,
1435
+ t7
1472
1436
  ] });
1473
- $[18] = children;
1474
- $[19] = t11;
1475
- $[20] = t13;
1476
- $[21] = t9;
1477
- $[22] = t14;
1437
+ $[10] = children;
1438
+ $[11] = t7;
1439
+ $[12] = t8;
1478
1440
  } else {
1479
- t14 = $[22];
1441
+ t8 = $[12];
1480
1442
  }
1481
- return t14;
1443
+ return t8;
1482
1444
  });
1483
1445
  const UserYupSchema = Yup__namespace.object().shape({
1484
1446
  displayName: Yup__namespace.string().required("Required"),
@@ -2019,17 +1981,13 @@
2019
1981
  return /* @__PURE__ */ jsxRuntime.jsx(RoleChip, { role: userRole }, userRole?.id);
2020
1982
  }
2021
1983
  const UsersView = function UsersView2(t0) {
2022
- const $ = reactCompilerRuntime.c(16);
1984
+ const $ = reactCompilerRuntime.c(12);
2023
1985
  const {
2024
1986
  children
2025
1987
  } = t0;
2026
1988
  const [dialogOpen, setDialogOpen] = React.useState();
2027
1989
  const [selectedUser, setSelectedUser] = React.useState();
2028
- const {
2029
- users,
2030
- usersLimit
2031
- } = useUserManagement();
2032
- const reachedUsersLimit = usersLimit !== void 0 && users && users.length >= usersLimit;
1990
+ useUserManagement();
2033
1991
  let t1;
2034
1992
  if ($[0] === Symbol.for("react.memo_cache_sentinel")) {
2035
1993
  t1 = (user) => {
@@ -2062,60 +2020,44 @@
2062
2020
  let t4;
2063
2021
  let t5;
2064
2022
  if ($[3] === Symbol.for("react.memo_cache_sentinel")) {
2065
- t4 = /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {});
2066
- t5 = () => setDialogOpen(true);
2023
+ t4 = /* @__PURE__ */ jsxRuntime.jsxs("div", { className: "flex items-center mt-12", children: [
2024
+ t3,
2025
+ /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { size: "large", startIcon: /* @__PURE__ */ jsxRuntime.jsx(ui.AddIcon, {}), onClick: () => setDialogOpen(true), children: "Add user" })
2026
+ ] });
2027
+ t5 = /* @__PURE__ */ jsxRuntime.jsx(UsersTable, { onUserClicked });
2067
2028
  $[3] = t4;
2068
2029
  $[4] = t5;
2069
2030
  } else {
2070
2031
  t4 = $[3];
2071
2032
  t5 = $[4];
2072
2033
  }
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;
2034
+ const t6 = selectedUser?.uid ?? "new";
2035
+ const t7 = dialogOpen ?? false;
2036
+ let t8;
2037
+ if ($[5] !== selectedUser || $[6] !== t6 || $[7] !== t7) {
2038
+ t8 = /* @__PURE__ */ jsxRuntime.jsx(UserDetailsForm, { open: t7, user: selectedUser, handleClose }, t6);
2039
+ $[5] = selectedUser;
2080
2040
  $[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
2041
  $[7] = t7;
2042
+ $[8] = t8;
2088
2043
  } 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];
2044
+ t8 = $[8];
2102
2045
  }
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: [
2046
+ let t9;
2047
+ if ($[9] !== children || $[10] !== t8) {
2048
+ t9 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Container, { className: "w-full flex flex-col py-4 gap-4", maxWidth: "6xl", children: [
2106
2049
  children,
2107
- t6,
2108
- t7,
2109
- t10
2050
+ t4,
2051
+ t5,
2052
+ t8
2110
2053
  ] });
2111
- $[12] = children;
2112
- $[13] = t10;
2113
- $[14] = t6;
2114
- $[15] = t11;
2054
+ $[9] = children;
2055
+ $[10] = t8;
2056
+ $[11] = t9;
2115
2057
  } else {
2116
- t11 = $[15];
2058
+ t9 = $[11];
2117
2059
  }
2118
- return t11;
2060
+ return t9;
2119
2061
  };
2120
2062
  function useUserManagementPlugin(t0) {
2121
2063
  const $ = reactCompilerRuntime.c(12);