@firecms/user_management 3.0.1 → 3.1.0-canary.7d91b7c
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/components/roles/RolesDetailsForm.d.ts +7 -10
- package/dist/components/users/UserDetailsForm.d.ts +9 -13
- package/dist/index.es.js +26 -18
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js +25 -17
- package/dist/index.umd.js.map +1 -1
- package/package.json +9 -9
- package/src/components/roles/RolesDetailsForm.tsx +0 -2
- package/src/components/roles/RolesTable.tsx +1 -1
- package/src/components/users/UserDetailsForm.tsx +0 -2
- package/src/components/users/UsersTable.tsx +56 -42
- package/src/hooks/useBuildUserManagement.tsx +13 -5
- package/src/useUserManagementPlugin.tsx +1 -1
package/dist/index.umd.js
CHANGED
|
@@ -360,11 +360,17 @@
|
|
|
360
360
|
}
|
|
361
361
|
const mgmtUser_0 = users.find((u_3) => u_3.email?.toLowerCase() === user_3?.email?.toLowerCase());
|
|
362
362
|
if (mgmtUser_0) {
|
|
363
|
-
|
|
364
|
-
|
|
363
|
+
const needsUidUpdate = mgmtUser_0.uid !== user_3.uid;
|
|
364
|
+
const needsPhotoUpdate = user_3.photoURL && mgmtUser_0.photoURL !== user_3.photoURL;
|
|
365
|
+
if (needsUidUpdate || needsPhotoUpdate) {
|
|
366
|
+
const updateReason = needsUidUpdate ? "uid" : "photoURL";
|
|
367
|
+
console.debug(`User ${updateReason} has changed, updating user in user management system`);
|
|
365
368
|
saveUser({
|
|
366
369
|
...mgmtUser_0,
|
|
367
|
-
uid: user_3.uid
|
|
370
|
+
uid: user_3.uid,
|
|
371
|
+
...needsPhotoUpdate ? {
|
|
372
|
+
photoURL: user_3.photoURL
|
|
373
|
+
} : {}
|
|
368
374
|
}).then(() => {
|
|
369
375
|
console.debug("User updated in user management system", mgmtUser_0);
|
|
370
376
|
}).catch((e_4) => {
|
|
@@ -1122,7 +1128,7 @@
|
|
|
1122
1128
|
}
|
|
1123
1129
|
let t80;
|
|
1124
1130
|
if ($[144] !== handleClose) {
|
|
1125
|
-
t80 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "text",
|
|
1131
|
+
t80 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "text", onClick: () => {
|
|
1126
1132
|
handleClose();
|
|
1127
1133
|
}, children: "Cancel" });
|
|
1128
1134
|
$[144] = handleClose;
|
|
@@ -1134,7 +1140,7 @@
|
|
|
1134
1140
|
const t82 = isNewRole ? "Create role" : "Update";
|
|
1135
1141
|
let t83;
|
|
1136
1142
|
if ($[146] !== isSubmitting || $[147] !== t81 || $[148] !== t82) {
|
|
1137
|
-
t83 = /* @__PURE__ */ jsxRuntime.jsx(ui.LoadingButton, { variant: "filled",
|
|
1143
|
+
t83 = /* @__PURE__ */ jsxRuntime.jsx(ui.LoadingButton, { variant: "filled", type: "submit", disabled: t81, loading: isSubmitting, children: t82 });
|
|
1138
1144
|
$[146] = isSubmitting;
|
|
1139
1145
|
$[147] = t81;
|
|
1140
1146
|
$[148] = t82;
|
|
@@ -1307,7 +1313,7 @@
|
|
|
1307
1313
|
if ($[5] !== allowDefaultRolesCreation || $[6] !== roles || $[7] !== saveRole) {
|
|
1308
1314
|
t3 = (!roles || roles.length === 0) && /* @__PURE__ */ jsxRuntime.jsx(ui.TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { colspan: 4, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.CenteredView, { className: "flex flex-col gap-4 my-8 items-center", children: [
|
|
1309
1315
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", children: "You don't have any roles yet." }),
|
|
1310
|
-
allowDefaultRolesCreation && /* @__PURE__ */ jsxRuntime.jsx(ui.Button, {
|
|
1316
|
+
allowDefaultRolesCreation && /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick: () => {
|
|
1311
1317
|
DEFAULT_ROLES.forEach((role_0) => {
|
|
1312
1318
|
saveRole(role_0);
|
|
1313
1319
|
});
|
|
@@ -1733,7 +1739,7 @@
|
|
|
1733
1739
|
}
|
|
1734
1740
|
let t25;
|
|
1735
1741
|
if ($[53] !== handleClose) {
|
|
1736
|
-
t25 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "text",
|
|
1742
|
+
t25 = /* @__PURE__ */ jsxRuntime.jsx(ui.Button, { variant: "text", onClick: () => {
|
|
1737
1743
|
handleClose();
|
|
1738
1744
|
}, children: "Cancel" });
|
|
1739
1745
|
$[53] = handleClose;
|
|
@@ -1745,7 +1751,7 @@
|
|
|
1745
1751
|
const t27 = isNewUser ? "Create user" : "Update";
|
|
1746
1752
|
let t28;
|
|
1747
1753
|
if ($[55] !== isSubmitting || $[56] !== t26 || $[57] !== t27) {
|
|
1748
|
-
t28 = /* @__PURE__ */ jsxRuntime.jsx(ui.LoadingButton, { variant: "filled",
|
|
1754
|
+
t28 = /* @__PURE__ */ jsxRuntime.jsx(ui.LoadingButton, { variant: "filled", type: "submit", disabled: t26, loading: isSubmitting, children: t27 });
|
|
1749
1755
|
$[55] = isSubmitting;
|
|
1750
1756
|
$[56] = t26;
|
|
1751
1757
|
$[57] = t27;
|
|
@@ -1844,11 +1850,12 @@
|
|
|
1844
1850
|
let t1;
|
|
1845
1851
|
if ($[0] === /* @__PURE__ */ Symbol.for("react.memo_cache_sentinel")) {
|
|
1846
1852
|
t1 = /* @__PURE__ */ jsxRuntime.jsxs(ui.TableHeader, { children: [
|
|
1847
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "
|
|
1853
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "w-12" }),
|
|
1848
1854
|
/* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: "Email" }),
|
|
1849
1855
|
/* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: "Name" }),
|
|
1850
1856
|
/* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: "Roles" }),
|
|
1851
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: "Created on" })
|
|
1857
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: "Created on" }),
|
|
1858
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "w-12" })
|
|
1852
1859
|
] });
|
|
1853
1860
|
$[0] = t1;
|
|
1854
1861
|
} else {
|
|
@@ -1864,14 +1871,15 @@
|
|
|
1864
1871
|
return /* @__PURE__ */ jsxRuntime.jsxs(ui.TableRow, { onClick: () => {
|
|
1865
1872
|
onUserClicked(user);
|
|
1866
1873
|
}, children: [
|
|
1867
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "w-
|
|
1868
|
-
event.stopPropagation();
|
|
1869
|
-
return setUserToBeDeleted(user);
|
|
1870
|
-
}, children: /* @__PURE__ */ jsxRuntime.jsx(ui.DeleteIcon, {}) }) }) }),
|
|
1874
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "w-12", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Avatar, { src: user.photoURL ?? void 0, outerClassName: "w-8 h-8 min-w-8 min-h-8 p-0", className: "text-sm", hover: false, children: user.displayName ? user.displayName[0].toUpperCase() : user.email ? user.email[0].toUpperCase() : "U" }) }),
|
|
1871
1875
|
/* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: user.email }),
|
|
1872
1876
|
/* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "font-medium align-left", children: user.displayName }),
|
|
1873
1877
|
/* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "align-left", children: userRoles ? /* @__PURE__ */ jsxRuntime.jsx("div", { className: "flex flex-wrap gap-2", children: userRoles.map(_temp$1) }) : null }),
|
|
1874
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: formattedDate })
|
|
1878
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { children: formattedDate }),
|
|
1879
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { className: "w-12", children: /* @__PURE__ */ jsxRuntime.jsx(ui.Tooltip, { asChild: true, title: "Delete this user", children: /* @__PURE__ */ jsxRuntime.jsx(ui.IconButton, { size: "smallest", onClick: (event) => {
|
|
1880
|
+
event.stopPropagation();
|
|
1881
|
+
return setUserToBeDeleted(user);
|
|
1882
|
+
}, children: /* @__PURE__ */ jsxRuntime.jsx(ui.DeleteIcon, { size: "small" }) }) }) })
|
|
1875
1883
|
] }, "row_" + user.uid);
|
|
1876
1884
|
});
|
|
1877
1885
|
$[1] = dateFormat;
|
|
@@ -1886,7 +1894,7 @@
|
|
|
1886
1894
|
if ($[6] !== authController || $[7] !== saveUser || $[8] !== snackbarController || $[9] !== users) {
|
|
1887
1895
|
t3 = (!users || users.length === 0) && /* @__PURE__ */ jsxRuntime.jsx(ui.TableRow, { children: /* @__PURE__ */ jsxRuntime.jsx(ui.TableCell, { colspan: 6, children: /* @__PURE__ */ jsxRuntime.jsxs(ui.CenteredView, { className: "flex flex-col gap-4 my-8 items-center", children: [
|
|
1888
1896
|
/* @__PURE__ */ jsxRuntime.jsx(ui.Typography, { variant: "label", children: "There are no users yet" }),
|
|
1889
|
-
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, {
|
|
1897
|
+
/* @__PURE__ */ jsxRuntime.jsx(ui.Button, { onClick: () => {
|
|
1890
1898
|
if (!authController.user?.uid) {
|
|
1891
1899
|
throw Error("UsersTable, authController misconfiguration");
|
|
1892
1900
|
}
|
|
@@ -2254,7 +2262,7 @@
|
|
|
2254
2262
|
t5 = /* @__PURE__ */ jsxRuntime.jsxs(ui.Paper, { className: "my-4 flex flex-col px-4 py-6 bg-white dark:bg-surface-accent-800 gap-2", children: [
|
|
2255
2263
|
t1,
|
|
2256
2264
|
t2,
|
|
2257
|
-
/* @__PURE__ */ jsxRuntime.jsxs(ui.Button, {
|
|
2265
|
+
/* @__PURE__ */ jsxRuntime.jsxs(ui.Button, { onClick: t3, children: [
|
|
2258
2266
|
t4,
|
|
2259
2267
|
buttonLabel
|
|
2260
2268
|
] })
|