thecore-auth 0.0.61 → 0.0.63
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/thecore-auth.cjs.js +10 -10
- package/dist/thecore-auth.esm.js +39 -35
- package/package.json +1 -1
package/dist/thecore-auth.esm.js
CHANGED
|
@@ -63,7 +63,7 @@ function se() {
|
|
|
63
63
|
return "Profiler";
|
|
64
64
|
case L:
|
|
65
65
|
return "StrictMode";
|
|
66
|
-
case
|
|
66
|
+
case H:
|
|
67
67
|
return "Suspense";
|
|
68
68
|
case x:
|
|
69
69
|
return "SuspenseList";
|
|
@@ -224,10 +224,10 @@ function se() {
|
|
|
224
224
|
);
|
|
225
225
|
var d = Q.DetermineComponentFrameRoot(), m = d[0], Z = d[1];
|
|
226
226
|
if (m && Z) {
|
|
227
|
-
var
|
|
227
|
+
var N = m.split(`
|
|
228
228
|
`), U = Z.split(`
|
|
229
229
|
`);
|
|
230
|
-
for (d = i = 0; i <
|
|
230
|
+
for (d = i = 0; i < N.length && !N[i].includes(
|
|
231
231
|
"DetermineComponentFrameRoot"
|
|
232
232
|
); )
|
|
233
233
|
i++;
|
|
@@ -235,16 +235,16 @@ function se() {
|
|
|
235
235
|
"DetermineComponentFrameRoot"
|
|
236
236
|
); )
|
|
237
237
|
d++;
|
|
238
|
-
if (i ===
|
|
239
|
-
for (i =
|
|
238
|
+
if (i === N.length || d === U.length)
|
|
239
|
+
for (i = N.length - 1, d = U.length - 1; 1 <= i && 0 <= d && N[i] !== U[d]; )
|
|
240
240
|
d--;
|
|
241
241
|
for (; 1 <= i && 0 <= d; i--, d--)
|
|
242
|
-
if (
|
|
242
|
+
if (N[i] !== U[d]) {
|
|
243
243
|
if (i !== 1 || d !== 1)
|
|
244
244
|
do
|
|
245
|
-
if (i--, d--, 0 > d ||
|
|
245
|
+
if (i--, d--, 0 > d || N[i] !== U[d]) {
|
|
246
246
|
var aA = `
|
|
247
|
-
` +
|
|
247
|
+
` + N[i].replace(
|
|
248
248
|
" at new ",
|
|
249
249
|
" at "
|
|
250
250
|
);
|
|
@@ -257,7 +257,7 @@ function se() {
|
|
|
257
257
|
} finally {
|
|
258
258
|
BA = !1, y.H = B, g(), Error.prepareStackTrace = s;
|
|
259
259
|
}
|
|
260
|
-
return
|
|
260
|
+
return N = (N = e ? e.displayName || e.name : "") ? p(N) : "", typeof e == "function" && vA.set(e, N), N;
|
|
261
261
|
}
|
|
262
262
|
function l(e) {
|
|
263
263
|
if (e == null) return "";
|
|
@@ -270,7 +270,7 @@ function se() {
|
|
|
270
270
|
}
|
|
271
271
|
if (typeof e == "string") return p(e);
|
|
272
272
|
switch (e) {
|
|
273
|
-
case
|
|
273
|
+
case H:
|
|
274
274
|
return p("Suspense");
|
|
275
275
|
case x:
|
|
276
276
|
return p("SuspenseList");
|
|
@@ -294,7 +294,7 @@ function se() {
|
|
|
294
294
|
var e = y.A;
|
|
295
295
|
return e === null ? null : e.getOwner();
|
|
296
296
|
}
|
|
297
|
-
function
|
|
297
|
+
function P(e) {
|
|
298
298
|
if (zA.call(e, "key")) {
|
|
299
299
|
var c = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
300
300
|
if (c && c.isReactWarning) return !1;
|
|
@@ -342,7 +342,7 @@ function se() {
|
|
|
342
342
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
343
343
|
}
|
|
344
344
|
function I(e, c, s, B, Q, i) {
|
|
345
|
-
if (typeof e == "string" || typeof e == "function" || e === R || e === tA || e === L || e ===
|
|
345
|
+
if (typeof e == "string" || typeof e == "function" || e === R || e === tA || e === L || e === H || e === x || e === rA || typeof e == "object" && e !== null && (e.$$typeof === S || e.$$typeof === V || e.$$typeof === W || e.$$typeof === oA || e.$$typeof === w || e.$$typeof === Ae || e.getModuleId !== void 0)) {
|
|
346
346
|
var d = c.children;
|
|
347
347
|
if (d !== void 0)
|
|
348
348
|
if (B)
|
|
@@ -363,8 +363,8 @@ function se() {
|
|
|
363
363
|
);
|
|
364
364
|
if (zA.call(c, "key")) {
|
|
365
365
|
d = t(e);
|
|
366
|
-
var m = Object.keys(c).filter(function(
|
|
367
|
-
return
|
|
366
|
+
var m = Object.keys(c).filter(function(N) {
|
|
367
|
+
return N !== "key";
|
|
368
368
|
});
|
|
369
369
|
B = 0 < m.length ? "{key: someKey, " + m.join(": ..., ") + ": ...}" : "{key: someKey}", IA[d + B] || (m = 0 < m.length ? "{" + m.join(": ..., ") + ": ...}" : "{}", console.error(
|
|
370
370
|
`A props object containing a "key" prop is being spread into JSX:
|
|
@@ -379,7 +379,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
379
379
|
d
|
|
380
380
|
), IA[d + B] = !0);
|
|
381
381
|
}
|
|
382
|
-
if (d = null, s !== void 0 && (r(s), d = "" + s),
|
|
382
|
+
if (d = null, s !== void 0 && (r(s), d = "" + s), P(c) && (r(c.key), d = "" + c.key), "key" in c) {
|
|
383
383
|
s = {};
|
|
384
384
|
for (var Z in c)
|
|
385
385
|
Z !== "key" && (s[Z] = c[Z]);
|
|
@@ -430,7 +430,7 @@ Check the render method of \`` + s + "`."), c || (e = t(e)) && (c = `
|
|
|
430
430
|
|
|
431
431
|
Check the top-level render call using <` + e + ">."), c;
|
|
432
432
|
}
|
|
433
|
-
var G = Y, E = Symbol.for("react.transitional.element"), eA = Symbol.for("react.portal"), R = Symbol.for("react.fragment"), L = Symbol.for("react.strict_mode"), tA = Symbol.for("react.profiler"), oA = Symbol.for("react.consumer"), W = Symbol.for("react.context"), w = Symbol.for("react.forward_ref"),
|
|
433
|
+
var G = Y, E = Symbol.for("react.transitional.element"), eA = Symbol.for("react.portal"), R = Symbol.for("react.fragment"), L = Symbol.for("react.strict_mode"), tA = Symbol.for("react.profiler"), oA = Symbol.for("react.consumer"), W = Symbol.for("react.context"), w = Symbol.for("react.forward_ref"), H = Symbol.for("react.suspense"), x = Symbol.for("react.suspense_list"), V = Symbol.for("react.memo"), S = Symbol.for("react.lazy"), rA = Symbol.for("react.offscreen"), CA = Symbol.iterator, $A = Symbol.for("react.client.reference"), y = G.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, zA = Object.prototype.hasOwnProperty, T = Object.assign, Ae = Symbol.for("react.client.reference"), lA = Array.isArray, nA = 0, EA, QA, HA, NA, PA, bA, VA;
|
|
434
434
|
a.__reactDisabledLog = !0;
|
|
435
435
|
var uA, qA, BA = !1, vA = new (typeof WeakMap == "function" ? WeakMap : Map)(), ee = Symbol.for("react.client.reference"), XA, jA = {}, IA = {}, xA = {};
|
|
436
436
|
sA.Fragment = R, sA.jsx = function(e, c, s, B, Q) {
|
|
@@ -537,12 +537,12 @@ const dA = async (t, o, r) => {
|
|
|
537
537
|
console.error(a);
|
|
538
538
|
}
|
|
539
539
|
}, WA = k(), Le = ({ children: t }) => {
|
|
540
|
-
const { heartbeatEndpoint: o, firstPrivatePath: r, infiniteSession: a, timeDeducted: f, authenticatedEndpoint: g, autoLogin: p, autoLoginEmail: O, autoLoginPassword: l } = $(), { setIsLoading: u } = DA(), { setShowAlert:
|
|
540
|
+
const { heartbeatEndpoint: o, firstPrivatePath: r, infiniteSession: a, timeDeducted: f, authenticatedEndpoint: g, autoLogin: p, autoLoginEmail: O, autoLoginPassword: l } = $(), { setIsLoading: u } = DA(), { setShowAlert: P, setMessageAlert: q, setTypeAlert: X } = AA(), j = YA(), [I, z] = D(null), [C, v] = D(), [b, G] = D(), [E, eA] = D(), R = async (w = null, H) => {
|
|
541
541
|
w && w.preventDefault();
|
|
542
542
|
try {
|
|
543
|
-
u(!0),
|
|
544
|
-
const V = await (await dA(
|
|
545
|
-
auth:
|
|
543
|
+
u(!0), P(!1);
|
|
544
|
+
const V = await (await dA(P, X, q)).post(g, {
|
|
545
|
+
auth: H
|
|
546
546
|
}), S = V.data.id, rA = V.headers.token;
|
|
547
547
|
rA && (localStorage.setItem("accessToken", rA), localStorage.setItem("id", S), z(!0), v(rA), j(`${r}${S}`));
|
|
548
548
|
} catch (x) {
|
|
@@ -552,7 +552,7 @@ const dA = async (t, o, r) => {
|
|
|
552
552
|
localStorage.removeItem("accessToken"), localStorage.removeItem("id"), z(!1), v(null);
|
|
553
553
|
}, tA = async () => {
|
|
554
554
|
try {
|
|
555
|
-
const w = localStorage.getItem("accessToken"), V = (await (await dA(
|
|
555
|
+
const w = localStorage.getItem("accessToken"), V = (await (await dA(P, X, q)).get(
|
|
556
556
|
`${o}`,
|
|
557
557
|
{ headers: {
|
|
558
558
|
Authorization: w
|
|
@@ -565,7 +565,7 @@ const dA = async (t, o, r) => {
|
|
|
565
565
|
}, oA = () => {
|
|
566
566
|
if (!C)
|
|
567
567
|
return;
|
|
568
|
-
const
|
|
568
|
+
const H = te(C).exp, x = Math.floor(Date.now() / 1e3), V = (H - x) * 1e3;
|
|
569
569
|
eA(V), G(V - f);
|
|
570
570
|
};
|
|
571
571
|
K(() => {
|
|
@@ -576,7 +576,8 @@ const dA = async (t, o, r) => {
|
|
|
576
576
|
return;
|
|
577
577
|
}
|
|
578
578
|
}, []), K(() => {
|
|
579
|
-
|
|
579
|
+
const w = localStorage.getItem("accessToken");
|
|
580
|
+
p && !w && R(null, {
|
|
580
581
|
email: O,
|
|
581
582
|
password: l
|
|
582
583
|
});
|
|
@@ -586,11 +587,11 @@ const dA = async (t, o, r) => {
|
|
|
586
587
|
a && C && b && (w = setInterval(() => {
|
|
587
588
|
tA();
|
|
588
589
|
}, b));
|
|
589
|
-
let
|
|
590
|
-
return !a && C && E && (
|
|
591
|
-
L(),
|
|
590
|
+
let H;
|
|
591
|
+
return !a && C && E && (H = setTimeout(() => {
|
|
592
|
+
L(), P(!0), X("danger"), q("Sessione scaduta");
|
|
592
593
|
}, E)), () => {
|
|
593
|
-
w && clearInterval(w),
|
|
594
|
+
w && clearInterval(w), H && clearTimeout(H);
|
|
594
595
|
};
|
|
595
596
|
}, [C, b]);
|
|
596
597
|
const W = {
|
|
@@ -624,14 +625,14 @@ Esempio:
|
|
|
624
625
|
const { login: o } = iA(), { clearLoginFormOnError: r } = $(), a = {
|
|
625
626
|
email: "",
|
|
626
627
|
password: ""
|
|
627
|
-
}, [f, g] = D("Accedi"), [p, O] = D("Email"), [l, u] = D("email"), [
|
|
628
|
+
}, [f, g] = D("Accedi"), [p, O] = D("Email"), [l, u] = D("email"), [P, q] = D("example@example.it"), [X, j] = D("Accedi"), [I, z] = D(a), [C, v] = D(), [b, G] = D(), [E, eA] = D(), [R, L] = D(), W = {
|
|
628
629
|
title: f,
|
|
629
630
|
setTitle: g,
|
|
630
631
|
label: p,
|
|
631
632
|
setLabel: O,
|
|
632
633
|
type: l,
|
|
633
634
|
setType: u,
|
|
634
|
-
placeholder:
|
|
635
|
+
placeholder: P,
|
|
635
636
|
setPlaceholder: q,
|
|
636
637
|
buttonText: X,
|
|
637
638
|
setButtonText: j,
|
|
@@ -645,8 +646,8 @@ Esempio:
|
|
|
645
646
|
setStyleContainerLogo: eA,
|
|
646
647
|
styleLogo: R,
|
|
647
648
|
setStyleLogo: L,
|
|
648
|
-
changeData: (w,
|
|
649
|
-
z((x) => ({ ...x, [w]:
|
|
649
|
+
changeData: (w, H) => {
|
|
650
|
+
z((x) => ({ ...x, [w]: H }));
|
|
650
651
|
},
|
|
651
652
|
handleLogin: (w) => {
|
|
652
653
|
o(w, I), r && z(a);
|
|
@@ -813,7 +814,7 @@ const Ee = (t) => /* @__PURE__ */ A.createElement("svg", { xmlns: "http://www.w3
|
|
|
813
814
|
focusRing: "focus:ring-warning-progress",
|
|
814
815
|
progressColor: "bg-warning-progress"
|
|
815
816
|
}
|
|
816
|
-
}, { bgColor: l, textColor: u, buttonBg:
|
|
817
|
+
}, { bgColor: l, textColor: u, buttonBg: P, hoverBg: q, focusRing: X, progressColor: j } = O[a], I = (C) => {
|
|
817
818
|
switch (C) {
|
|
818
819
|
case "danger":
|
|
819
820
|
return /* @__PURE__ */ n.jsx(Ee, { className: "w-[20px] h-[20px]" });
|
|
@@ -847,7 +848,7 @@ const Ee = (t) => /* @__PURE__ */ A.createElement("svg", { xmlns: "http://www.w3
|
|
|
847
848
|
"button",
|
|
848
849
|
{
|
|
849
850
|
type: "button",
|
|
850
|
-
className: `ms-auto ${
|
|
851
|
+
className: `ms-auto ${P} rounded-lg focus:ring-2 ${X} p-1.5 ${q} inline-flex items-center justify-center h-8 w-8 cursor-pointer`,
|
|
851
852
|
title: "Close",
|
|
852
853
|
onClick: z,
|
|
853
854
|
children: /* @__PURE__ */ n.jsx(Ce, { className: "text-xl" })
|
|
@@ -936,7 +937,7 @@ const Ee = (t) => /* @__PURE__ */ A.createElement("svg", { xmlns: "http://www.w3
|
|
|
936
937
|
!t && !f && (o(!0), r("danger"), a("Non sei autorizzato"));
|
|
937
938
|
}, []), t === null ? null : t ? /* @__PURE__ */ n.jsx(yA, {}) : /* @__PURE__ */ n.jsx(oe, { to: "/" });
|
|
938
939
|
}, Xe = () => {
|
|
939
|
-
const { id: t } = re(), { logout: o, setCurrentToken: r } = iA(), { usersEndpoint: a } = $(), { setIsLoading: f } = DA(), { setShowAlert: g, setTypeAlert: p, setMessageAlert: O } = AA(), [l, u] = D({}), [
|
|
940
|
+
const { id: t } = re(), { logout: o, setCurrentToken: r } = iA(), { usersEndpoint: a } = $(), { setIsLoading: f } = DA(), { setShowAlert: g, setTypeAlert: p, setMessageAlert: O } = AA(), [l, u] = D({}), [P, q] = D(null), [X, j] = D(!1), I = async () => {
|
|
940
941
|
try {
|
|
941
942
|
f(!0);
|
|
942
943
|
const v = localStorage.getItem("accessToken");
|
|
@@ -1002,7 +1003,7 @@ const Ee = (t) => /* @__PURE__ */ A.createElement("svg", { xmlns: "http://www.w3
|
|
|
1002
1003
|
children: "Lista degli utenti"
|
|
1003
1004
|
}
|
|
1004
1005
|
) }),
|
|
1005
|
-
/* @__PURE__ */ n.jsx("div", { className: "flex justify-center items-center", children:
|
|
1006
|
+
/* @__PURE__ */ n.jsx("div", { className: "flex justify-center items-center", children: P && /* @__PURE__ */ n.jsx("ul", { children: P.map((v) => /* @__PURE__ */ n.jsxs("li", { className: "text-xl my-4", children: [
|
|
1006
1007
|
v.id,
|
|
1007
1008
|
" - ",
|
|
1008
1009
|
v.email
|
|
@@ -1055,6 +1056,9 @@ export {
|
|
|
1055
1056
|
Me as RouteProvider,
|
|
1056
1057
|
ke as Routes,
|
|
1057
1058
|
dA as fetchAxiosConfig,
|
|
1059
|
+
AA as useAlert,
|
|
1060
|
+
iA as useAuth,
|
|
1061
|
+
$ as useConfig,
|
|
1058
1062
|
DA as useLoading,
|
|
1059
1063
|
_e as useLocation,
|
|
1060
1064
|
JA as useLoginForm,
|