@firecms/user_management 3.0.0-canary.75 → 3.0.0-canary.77
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.es.js +12 -24
- package/dist/index.es.js.map +1 -1
- package/dist/index.umd.js.map +1 -1
- package/package.json +13 -13
package/dist/index.es.js
CHANGED
@@ -35,8 +35,7 @@ function We({
|
|
35
35
|
};
|
36
36
|
return n.map((i) => je(i, t.id)).reduce(te, l);
|
37
37
|
}
|
38
|
-
} else
|
39
|
-
return Ye;
|
38
|
+
} else return Ye;
|
40
39
|
}
|
41
40
|
function je(t, r) {
|
42
41
|
const n = {
|
@@ -121,8 +120,7 @@ function Nn({
|
|
121
120
|
roles: E.filter((p) => f.roles?.includes(p.id))
|
122
121
|
})), [b, _] = F.useState(), [z, u] = F.useState(), h = v || w;
|
123
122
|
ce(() => {
|
124
|
-
if (!t || !n)
|
125
|
-
return;
|
123
|
+
if (!t || !n) return;
|
126
124
|
const f = Y(t);
|
127
125
|
return ue(
|
128
126
|
ee(f, n),
|
@@ -143,8 +141,7 @@ function Nn({
|
|
143
141
|
}
|
144
142
|
);
|
145
143
|
}, [t, n]), ce(() => {
|
146
|
-
if (!t || !r)
|
147
|
-
return;
|
144
|
+
if (!t || !r) return;
|
148
145
|
const f = Y(t);
|
149
146
|
return ue(
|
150
147
|
ee(f, r),
|
@@ -166,11 +163,9 @@ function Nn({
|
|
166
163
|
);
|
167
164
|
}, [t, r]);
|
168
165
|
const x = k(async (f) => {
|
169
|
-
if (!t)
|
170
|
-
throw Error("useFirestoreUserManagement Firebase not initialised");
|
166
|
+
if (!t) throw Error("useFirestoreUserManagement Firebase not initialised");
|
171
167
|
const p = Y(t);
|
172
|
-
if (!p || !r)
|
173
|
-
throw Error("useFirestoreUserManagement Firestore not initialised");
|
168
|
+
if (!p || !r) throw Error("useFirestoreUserManagement Firestore not initialised");
|
174
169
|
console.debug("Persisting user", f);
|
175
170
|
const N = f.roles?.map((Ie) => Ie.id), {
|
176
171
|
uid: q,
|
@@ -181,11 +176,9 @@ function Nn({
|
|
181
176
|
};
|
182
177
|
return q ? me(H(p, r, q), de, { merge: !0 }).then(() => f) : Ae(ee(p, r), de).then(() => f);
|
183
178
|
}, [r, t]), D = k((f) => {
|
184
|
-
if (!t)
|
185
|
-
throw Error("useFirestoreUserManagement Firebase not initialised");
|
179
|
+
if (!t) throw Error("useFirestoreUserManagement Firebase not initialised");
|
186
180
|
const p = Y(t);
|
187
|
-
if (!p || !n)
|
188
|
-
throw Error("useFirestoreUserManagement Firestore not initialised");
|
181
|
+
if (!p || !n) throw Error("useFirestoreUserManagement Firestore not initialised");
|
189
182
|
console.debug("Persisting role", f);
|
190
183
|
const {
|
191
184
|
id: N,
|
@@ -193,20 +186,16 @@ function Nn({
|
|
193
186
|
} = f, Z = H(p, n, N);
|
194
187
|
return me(Z, q, { merge: !0 });
|
195
188
|
}, [n, t]), T = k(async (f) => {
|
196
|
-
if (!t)
|
197
|
-
throw Error("useFirestoreUserManagement Firebase not initialised");
|
189
|
+
if (!t) throw Error("useFirestoreUserManagement Firebase not initialised");
|
198
190
|
const p = Y(t);
|
199
|
-
if (!p || !r)
|
200
|
-
throw Error("useFirestoreUserManagement Firestore not initialised");
|
191
|
+
if (!p || !r) throw Error("useFirestoreUserManagement Firestore not initialised");
|
201
192
|
console.debug("Deleting", f);
|
202
193
|
const { uid: N } = f;
|
203
194
|
return he(H(p, r, N));
|
204
195
|
}, [r, t]), o = k((f) => {
|
205
|
-
if (!t)
|
206
|
-
throw Error("useFirestoreUserManagement Firebase not initialised");
|
196
|
+
if (!t) throw Error("useFirestoreUserManagement Firebase not initialised");
|
207
197
|
const p = Y(t);
|
208
|
-
if (!p || !n)
|
209
|
-
throw Error("useFirestoreUserManagement Firestore not initialised");
|
198
|
+
if (!p || !n) throw Error("useFirestoreUserManagement Firestore not initialised");
|
210
199
|
console.debug("Deleting", f);
|
211
200
|
const { id: N } = f, q = H(p, n, N);
|
212
201
|
return he(q);
|
@@ -217,8 +206,7 @@ function Nn({
|
|
217
206
|
collection: f,
|
218
207
|
user: p
|
219
208
|
}), []), $ = k((f) => {
|
220
|
-
if (!y)
|
221
|
-
throw Error("Users not loaded");
|
209
|
+
if (!y) throw Error("Users not loaded");
|
222
210
|
return y.find((N) => N.email?.toLowerCase() === f?.email?.toLowerCase())?.roles;
|
223
211
|
}, [y]), G = k(({ user: f }) => {
|
224
212
|
if (console.debug("Authenticating user", f), h)
|