@firecms/user_management 3.0.0-canary.117 → 3.0.0-canary.118
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
@@ -1,6 +1,6 @@
|
|
1
1
|
(function(global, factory) {
|
2
|
-
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("react-fast-compare"), require("react/jsx-runtime"), require("@firecms/ui"), require("yup"), require("@firecms/
|
3
|
-
})(this, function(exports2, React, equal, jsxRuntime, ui, Yup,
|
2
|
+
typeof exports === "object" && typeof module !== "undefined" ? factory(exports, require("react"), require("react-fast-compare"), require("@firecms/core"), require("react/jsx-runtime"), require("@firecms/ui"), require("yup"), require("@firecms/formex"), require("date-fns"), require("date-fns/locale")) : typeof define === "function" && define.amd ? define(["exports", "react", "react-fast-compare", "@firecms/core", "react/jsx-runtime", "@firecms/ui", "yup", "@firecms/formex", "date-fns", "date-fns/locale"], factory) : (global = typeof globalThis !== "undefined" ? globalThis : global || self, factory(global.FireCMS = {}, global.React, global.equal, global.core, global.jsxRuntime, global.ui, global.Yup, global.formex, global.dateFns, global.locales));
|
3
|
+
})(this, function(exports2, React, equal, core, jsxRuntime, ui, Yup, formex, dateFns, locales) {
|
4
4
|
"use strict";
|
5
5
|
function _interopNamespaceDefault(e) {
|
6
6
|
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
@@ -232,15 +232,19 @@
|
|
232
232
|
const roleIds = user.roles?.map((r) => r.id);
|
233
233
|
const email = user.email?.toLowerCase().trim();
|
234
234
|
if (!email) throw Error("Email is required");
|
235
|
+
const userExists = users.find((u) => u.email?.toLowerCase() === email);
|
235
236
|
const data = {
|
236
237
|
...user,
|
237
|
-
roles: roleIds
|
238
|
+
roles: roleIds ?? []
|
238
239
|
};
|
240
|
+
if (!userExists) {
|
241
|
+
data.created_on = /* @__PURE__ */ new Date();
|
242
|
+
}
|
239
243
|
return dataSourceDelegate.saveEntity({
|
240
244
|
status: "existing",
|
241
245
|
path: usersPath,
|
242
246
|
entityId: email,
|
243
|
-
values: data
|
247
|
+
values: core.removeUndefined(data)
|
244
248
|
}).then(() => user);
|
245
249
|
}, [usersPath, dataSourceDelegate?.initialised]);
|
246
250
|
const saveRole = React.useCallback((role) => {
|
@@ -255,7 +259,7 @@
|
|
255
259
|
status: "existing",
|
256
260
|
path: rolesPath,
|
257
261
|
entityId: id,
|
258
|
-
values: roleData
|
262
|
+
values: core.removeUndefined(roleData)
|
259
263
|
}).then(() => {
|
260
264
|
return;
|
261
265
|
});
|