thecore-auth 0.0.95 → 0.0.97
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.css +1 -1
- package/dist/thecore-auth.esm.js +191 -188
- package/package.json +1 -1
package/dist/thecore-auth.esm.js
CHANGED
|
@@ -2,9 +2,9 @@ import * as t from "react";
|
|
|
2
2
|
import H, { createContext as ie, useState as w, useContext as se, useEffect as M } from "react";
|
|
3
3
|
import at from "jwt-decode";
|
|
4
4
|
import { useNavigate as ke, useLocation as Le, matchPath as $e, Outlet as je, Navigate as Je, Routes as lt, Route as Q, useMatch as ct } from "react-router-dom";
|
|
5
|
-
import { BrowserRouter as
|
|
5
|
+
import { BrowserRouter as s0, Link as a0, NavLink as l0, Outlet as c0, Route as f0, Routes as u0, useLocation as d0, useMatch as m0, useNavigate as p0 } from "react-router-dom";
|
|
6
6
|
import ft from "axios";
|
|
7
|
-
import { default as
|
|
7
|
+
import { default as g0 } from "axios";
|
|
8
8
|
var he = { exports: {} }, ue = {};
|
|
9
9
|
/**
|
|
10
10
|
* @license React
|
|
@@ -214,11 +214,11 @@ function dt() {
|
|
|
214
214
|
}
|
|
215
215
|
};
|
|
216
216
|
G.DetermineComponentFrameRoot.displayName = "DetermineComponentFrameRoot";
|
|
217
|
-
var
|
|
217
|
+
var L = Object.getOwnPropertyDescriptor(
|
|
218
218
|
G.DetermineComponentFrameRoot,
|
|
219
219
|
"name"
|
|
220
220
|
);
|
|
221
|
-
|
|
221
|
+
L && L.configurable && Object.defineProperty(
|
|
222
222
|
G.DetermineComponentFrameRoot,
|
|
223
223
|
"name",
|
|
224
224
|
{ value: "DetermineComponentFrameRoot" }
|
|
@@ -228,30 +228,30 @@ function dt() {
|
|
|
228
228
|
var _ = D.split(`
|
|
229
229
|
`), K = oe.split(`
|
|
230
230
|
`);
|
|
231
|
-
for (h =
|
|
231
|
+
for (h = L = 0; L < _.length && !_[L].includes(
|
|
232
232
|
"DetermineComponentFrameRoot"
|
|
233
233
|
); )
|
|
234
|
-
|
|
234
|
+
L++;
|
|
235
235
|
for (; h < K.length && !K[h].includes(
|
|
236
236
|
"DetermineComponentFrameRoot"
|
|
237
237
|
); )
|
|
238
238
|
h++;
|
|
239
|
-
if (
|
|
240
|
-
for (
|
|
239
|
+
if (L === _.length || h === K.length)
|
|
240
|
+
for (L = _.length - 1, h = K.length - 1; 1 <= L && 0 <= h && _[L] !== K[h]; )
|
|
241
241
|
h--;
|
|
242
|
-
for (; 1 <=
|
|
243
|
-
if (_[
|
|
244
|
-
if (
|
|
242
|
+
for (; 1 <= L && 0 <= h; L--, h--)
|
|
243
|
+
if (_[L] !== K[h]) {
|
|
244
|
+
if (L !== 1 || h !== 1)
|
|
245
245
|
do
|
|
246
|
-
if (
|
|
246
|
+
if (L--, h--, 0 > h || _[L] !== K[h]) {
|
|
247
247
|
var fe = `
|
|
248
|
-
` + _[
|
|
248
|
+
` + _[L].replace(
|
|
249
249
|
" at new ",
|
|
250
250
|
" at "
|
|
251
251
|
);
|
|
252
252
|
return e.displayName && fe.includes("<anonymous>") && (fe = fe.replace("<anonymous>", e.displayName)), typeof e == "function" && we.set(e, fe), fe;
|
|
253
253
|
}
|
|
254
|
-
while (1 <=
|
|
254
|
+
while (1 <= L && 0 <= h);
|
|
255
255
|
break;
|
|
256
256
|
}
|
|
257
257
|
}
|
|
@@ -302,7 +302,7 @@ function dt() {
|
|
|
302
302
|
}
|
|
303
303
|
return e.key !== void 0;
|
|
304
304
|
}
|
|
305
|
-
function
|
|
305
|
+
function R(e, c) {
|
|
306
306
|
function f() {
|
|
307
307
|
Me || (Me = !0, console.error(
|
|
308
308
|
"%s: `key` is not a prop. Trying to access it will result in `undefined` being returned. If you need to access the same value within the child component, you should pass it as a different prop. (https://react.dev/link/special-props)",
|
|
@@ -314,22 +314,22 @@ function dt() {
|
|
|
314
314
|
configurable: !0
|
|
315
315
|
});
|
|
316
316
|
}
|
|
317
|
-
function
|
|
317
|
+
function E() {
|
|
318
318
|
var e = r(this.type);
|
|
319
319
|
return ze[e] || (ze[e] = !0, console.error(
|
|
320
320
|
"Accessing element.ref was removed in React 19. ref is now a regular prop. It will be removed from the JSX Element type in a future release."
|
|
321
321
|
)), e = this.props.ref, e !== void 0 ? e : null;
|
|
322
322
|
}
|
|
323
|
-
function d(e, c, f, b, G,
|
|
324
|
-
return f =
|
|
325
|
-
$$typeof:
|
|
323
|
+
function d(e, c, f, b, G, L) {
|
|
324
|
+
return f = L.ref, e = {
|
|
325
|
+
$$typeof: C,
|
|
326
326
|
type: e,
|
|
327
327
|
key: c,
|
|
328
|
-
props:
|
|
328
|
+
props: L,
|
|
329
329
|
_owner: G
|
|
330
330
|
}, (f !== void 0 ? f : null) !== null ? Object.defineProperty(e, "ref", {
|
|
331
331
|
enumerable: !1,
|
|
332
|
-
get:
|
|
332
|
+
get: E
|
|
333
333
|
}) : Object.defineProperty(e, "ref", { enumerable: !1, value: null }), e._store = {}, Object.defineProperty(e._store, "validated", {
|
|
334
334
|
configurable: !1,
|
|
335
335
|
enumerable: !1,
|
|
@@ -342,22 +342,22 @@ function dt() {
|
|
|
342
342
|
value: null
|
|
343
343
|
}), Object.freeze && (Object.freeze(e.props), Object.freeze(e)), e;
|
|
344
344
|
}
|
|
345
|
-
function
|
|
345
|
+
function g(e, c, f, b, G, L) {
|
|
346
346
|
if (typeof e == "string" || typeof e == "function" || e === B || e === q || e === te || e === z || e === F || e === be || typeof e == "object" && e !== null && (e.$$typeof === V || e.$$typeof === $ || e.$$typeof === le || e.$$typeof === re || e.$$typeof === J || e.$$typeof === T || e.getModuleId !== void 0)) {
|
|
347
347
|
var h = c.children;
|
|
348
348
|
if (h !== void 0)
|
|
349
349
|
if (b)
|
|
350
350
|
if (X(h)) {
|
|
351
351
|
for (b = 0; b < h.length; b++)
|
|
352
|
-
|
|
352
|
+
x(h[b], e);
|
|
353
353
|
Object.freeze && Object.freeze(h);
|
|
354
354
|
} else
|
|
355
355
|
console.error(
|
|
356
356
|
"React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead."
|
|
357
357
|
);
|
|
358
|
-
else
|
|
358
|
+
else x(h, e);
|
|
359
359
|
} else
|
|
360
|
-
h = "", (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (h += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."), e === null ? b = "null" : X(e) ? b = "array" : e !== void 0 && e.$$typeof ===
|
|
360
|
+
h = "", (e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (h += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports."), e === null ? b = "null" : X(e) ? b = "array" : e !== void 0 && e.$$typeof === C ? (b = "<" + (r(e.type) || "Unknown") + " />", h = " Did you accidentally export a JSX literal instead of a component?") : b = typeof e, console.error(
|
|
361
361
|
"React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s",
|
|
362
362
|
b,
|
|
363
363
|
h
|
|
@@ -385,12 +385,12 @@ React keys must be passed directly to JSX without using spread:
|
|
|
385
385
|
for (var oe in c)
|
|
386
386
|
oe !== "key" && (f[oe] = c[oe]);
|
|
387
387
|
} else f = c;
|
|
388
|
-
return h &&
|
|
388
|
+
return h && R(
|
|
389
389
|
f,
|
|
390
390
|
typeof e == "function" ? e.displayName || e.name || "Unknown" : e
|
|
391
|
-
), d(e, h,
|
|
391
|
+
), d(e, h, L, G, y(), f);
|
|
392
392
|
}
|
|
393
|
-
function
|
|
393
|
+
function x(e, c) {
|
|
394
394
|
if (typeof e == "object" && e && e.$$typeof !== st) {
|
|
395
395
|
if (X(e))
|
|
396
396
|
for (var f = 0; f < e.length; f++) {
|
|
@@ -405,7 +405,7 @@ React keys must be passed directly to JSX without using spread:
|
|
|
405
405
|
}
|
|
406
406
|
}
|
|
407
407
|
function O(e) {
|
|
408
|
-
return typeof e == "object" && e !== null && e.$$typeof ===
|
|
408
|
+
return typeof e == "object" && e !== null && e.$$typeof === C;
|
|
409
409
|
}
|
|
410
410
|
function j(e, c) {
|
|
411
411
|
if (e._store && !e._store.validated && e.key == null && (e._store.validated = 1, c = S(c), !Fe[c])) {
|
|
@@ -431,13 +431,13 @@ Check the render method of \`` + f + "`."), c || (e = r(e)) && (c = `
|
|
|
431
431
|
|
|
432
432
|
Check the top-level render call using <` + e + ">."), c;
|
|
433
433
|
}
|
|
434
|
-
var
|
|
434
|
+
var P = H, C = Symbol.for("react.transitional.element"), N = Symbol.for("react.portal"), B = Symbol.for("react.fragment"), te = Symbol.for("react.strict_mode"), q = Symbol.for("react.profiler"), re = Symbol.for("react.consumer"), le = Symbol.for("react.context"), J = Symbol.for("react.forward_ref"), z = Symbol.for("react.suspense"), F = Symbol.for("react.suspense_list"), $ = Symbol.for("react.memo"), V = Symbol.for("react.lazy"), be = Symbol.for("react.offscreen"), ce = Symbol.iterator, ye = Symbol.for("react.client.reference"), k = P.__CLIENT_INTERNALS_DO_NOT_USE_OR_WARN_USERS_THEY_CANNOT_UPGRADE, I = Object.prototype.hasOwnProperty, A = Object.assign, T = Symbol.for("react.client.reference"), X = Array.isArray, Y = 0, Pe, Re, Ne, Ge, Te, _e, Ie;
|
|
435
435
|
s.__reactDisabledLog = !0;
|
|
436
436
|
var Ee, Ae, Ce = !1, we = new (typeof WeakMap == "function" ? WeakMap : Map)(), st = Symbol.for("react.client.reference"), Me, ze = {}, Be = {}, Fe = {};
|
|
437
437
|
de.Fragment = B, de.jsx = function(e, c, f, b, G) {
|
|
438
|
-
return
|
|
438
|
+
return g(e, c, f, !1, b, G);
|
|
439
439
|
}, de.jsxs = function(e, c, f, b, G) {
|
|
440
|
-
return
|
|
440
|
+
return g(e, c, f, !0, b, G);
|
|
441
441
|
};
|
|
442
442
|
}()), de;
|
|
443
443
|
}
|
|
@@ -446,7 +446,7 @@ function mt() {
|
|
|
446
446
|
return He || (He = 1, process.env.NODE_ENV === "production" ? he.exports = ut() : he.exports = dt()), he.exports;
|
|
447
447
|
}
|
|
448
448
|
var o = mt();
|
|
449
|
-
const Ve = ie(),
|
|
449
|
+
const Ve = ie(), Yt = ({ children: r }) => {
|
|
450
450
|
const [i, n] = w(!1), [s, a] = w(!1), [l, u] = w({});
|
|
451
451
|
return /* @__PURE__ */ o.jsx(Ve.Provider, { value: { isLoading: i, setIsLoading: n, isLoadingComponent: s, setIsLoadingComponent: a, loadingProps: l, setLoadingProps: u }, children: r });
|
|
452
452
|
}, me = () => {
|
|
@@ -456,7 +456,7 @@ const Ve = ie(), Ht = ({ children: r }) => {
|
|
|
456
456
|
}, pt = ({ errorMessage: r, errorShow: i }) => /* @__PURE__ */ o.jsx("section", { className: i ? "" : "hidden", children: /* @__PURE__ */ o.jsxs("div", { className: "container mx-auto", children: [
|
|
457
457
|
/* @__PURE__ */ o.jsx("h1", { className: "text-center text-8xl my-12", children: "Errore" }),
|
|
458
458
|
/* @__PURE__ */ o.jsx("pre", { className: "text-xl", children: r })
|
|
459
|
-
] }) }), Xe = ie(),
|
|
459
|
+
] }) }), Xe = ie(), Zt = ({ children: r }) => {
|
|
460
460
|
const [i, n] = w({}), [s, a] = w(!1), l = `Creare un file config.json in public per il corretto funzionamento
|
|
461
461
|
Esempio di config.json:
|
|
462
462
|
|
|
@@ -485,60 +485,60 @@ Esempio di config.json:
|
|
|
485
485
|
"isDebug": "",
|
|
486
486
|
"showHeaderButton": ""
|
|
487
487
|
}`, u = () => {
|
|
488
|
-
const d = /* @__PURE__ */ new Date(),
|
|
489
|
-
return `${
|
|
490
|
-
}, m = (d) => new Promise((
|
|
488
|
+
const d = /* @__PURE__ */ new Date(), g = String(d.getDate()).padStart(2, "0"), x = String(d.getMonth() + 1).padStart(2, "0"), O = d.getFullYear(), j = String(d.getHours()).padStart(2, "0"), S = String(d.getMinutes()).padStart(2, "0"), P = String(d.getSeconds()).padStart(2, "0");
|
|
489
|
+
return `${g}/${x}/${O} ${j}:${S}:${P}`;
|
|
490
|
+
}, m = (d) => new Promise((g, x) => {
|
|
491
491
|
const O = indexedDB.open("configDatabase", 1);
|
|
492
492
|
O.onupgradeneeded = (j) => {
|
|
493
493
|
const S = j.target.result;
|
|
494
494
|
S.objectStoreNames.contains(d) || S.createObjectStore(d, { keyPath: "id" });
|
|
495
|
-
}, O.onsuccess = (j) =>
|
|
496
|
-
}), p = async (d,
|
|
497
|
-
let
|
|
495
|
+
}, O.onsuccess = (j) => g(j.target.result), O.onerror = (j) => x(j.target.error);
|
|
496
|
+
}), p = async (d, g) => {
|
|
497
|
+
let x = await m(d);
|
|
498
498
|
return new Promise((O, j) => {
|
|
499
|
-
if (!
|
|
499
|
+
if (!x) {
|
|
500
500
|
j("Errore: DB non disponibile");
|
|
501
501
|
return;
|
|
502
502
|
}
|
|
503
|
-
const S =
|
|
504
|
-
|
|
503
|
+
const S = x == null ? void 0 : x.transaction(d, "readonly"), P = S == null ? void 0 : S.objectStore(d), C = P == null ? void 0 : P.get(g);
|
|
504
|
+
C.onsuccess = () => O(C.result), C.onerror = (N) => j(N.target.error);
|
|
505
505
|
});
|
|
506
|
-
}, y = async (d,
|
|
507
|
-
let
|
|
506
|
+
}, y = async (d, g) => {
|
|
507
|
+
let x = await m(d);
|
|
508
508
|
return new Promise((O, j) => {
|
|
509
|
-
if (!
|
|
509
|
+
if (!x) {
|
|
510
510
|
j("Errore: DB non disponibile");
|
|
511
511
|
return;
|
|
512
512
|
}
|
|
513
|
-
const S =
|
|
514
|
-
|
|
513
|
+
const S = x == null ? void 0 : x.transaction(d, "readwrite"), P = S == null ? void 0 : S.objectStore(d), C = P == null ? void 0 : P.put(g);
|
|
514
|
+
C.onsuccess = () => O(C.result), C.onerror = (N) => j(N.target.error);
|
|
515
515
|
});
|
|
516
516
|
}, v = async (d) => {
|
|
517
|
-
let
|
|
517
|
+
let g = Date.now(), x;
|
|
518
518
|
do
|
|
519
|
-
|
|
520
|
-
while (
|
|
521
|
-
return
|
|
522
|
-
},
|
|
523
|
-
|
|
524
|
-
},
|
|
519
|
+
x = await p(d, g), x && g++;
|
|
520
|
+
while (x);
|
|
521
|
+
return g;
|
|
522
|
+
}, R = async (d, g) => {
|
|
523
|
+
g.id || (g.id = await v(d)), await y(d, g);
|
|
524
|
+
}, E = async () => {
|
|
525
525
|
try {
|
|
526
|
-
const
|
|
526
|
+
const x = {
|
|
527
527
|
...await (await fetch("/config.json")).json(),
|
|
528
528
|
openIndexedDB: m,
|
|
529
529
|
getDataIndexedDB: p,
|
|
530
530
|
setDataIndexedDB: y,
|
|
531
531
|
generateUniqueId: v,
|
|
532
|
-
setDataWithAutoId:
|
|
532
|
+
setDataWithAutoId: R,
|
|
533
533
|
setCurrentDate: u
|
|
534
534
|
};
|
|
535
|
-
n(
|
|
535
|
+
n(x);
|
|
536
536
|
} catch (d) {
|
|
537
537
|
console.error(d), a(!0);
|
|
538
538
|
}
|
|
539
539
|
};
|
|
540
540
|
return M(() => {
|
|
541
|
-
|
|
541
|
+
E();
|
|
542
542
|
}, []), Object.keys(i).length === 0 ? /* @__PURE__ */ o.jsx(pt, { errorShow: s, errorMessage: l }) : /* @__PURE__ */ o.jsx(Xe.Provider, { value: i, children: r });
|
|
543
543
|
}, U = () => {
|
|
544
544
|
const r = se(Xe);
|
|
@@ -656,8 +656,8 @@ function jt(r) {
|
|
|
656
656
|
function St(r) {
|
|
657
657
|
return ae({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M17.47 250.9C88.82 328.1 158 397.6 224.5 485.5c72.3-143.8 146.3-288.1 268.4-444.37L460 26.06C356.9 135.4 276.8 238.9 207.2 361.9c-48.4-43.6-126.62-105.3-174.38-137z" }, child: [] }] })(r);
|
|
658
658
|
}
|
|
659
|
-
const et = ie(),
|
|
660
|
-
const [i, n] = w(!1), [s, a] = w(), [l, u] = w(),
|
|
659
|
+
const et = ie(), Ut = ({ children: r }) => {
|
|
660
|
+
const [i, n] = w(!1), [s, a] = w(), [l, u] = w(), R = {
|
|
661
661
|
showAlert: i,
|
|
662
662
|
setShowAlert: n,
|
|
663
663
|
typeAlert: s,
|
|
@@ -698,8 +698,8 @@ const et = ie(), Zt = ({ children: r }) => {
|
|
|
698
698
|
progressColor: "bg-warning-progress"
|
|
699
699
|
}
|
|
700
700
|
},
|
|
701
|
-
getIcon: (
|
|
702
|
-
switch (
|
|
701
|
+
getIcon: (E) => {
|
|
702
|
+
switch (E) {
|
|
703
703
|
case "danger":
|
|
704
704
|
return /* @__PURE__ */ o.jsx(ht, { className: "w-[20px] h-[20px]" });
|
|
705
705
|
case "info":
|
|
@@ -713,13 +713,13 @@ const et = ie(), Zt = ({ children: r }) => {
|
|
|
713
713
|
closeAlert: () => {
|
|
714
714
|
n(!i);
|
|
715
715
|
},
|
|
716
|
-
activeAlert: (
|
|
716
|
+
activeAlert: (E, d) => {
|
|
717
717
|
n(!1), setTimeout(() => {
|
|
718
|
-
a(
|
|
718
|
+
a(E), u(d), n(!0);
|
|
719
719
|
}, 50);
|
|
720
720
|
}
|
|
721
721
|
};
|
|
722
|
-
return /* @__PURE__ */ o.jsx(et.Provider, { value:
|
|
722
|
+
return /* @__PURE__ */ o.jsx(et.Provider, { value: R, children: r });
|
|
723
723
|
}, ee = () => {
|
|
724
724
|
const r = se(et);
|
|
725
725
|
if (r === void 0) throw new Error("Non puoi modificare l'alert");
|
|
@@ -755,22 +755,22 @@ const Ot = async (r, i, n) => {
|
|
|
755
755
|
} catch (s) {
|
|
756
756
|
console.error(s);
|
|
757
757
|
}
|
|
758
|
-
}, tt = ie(),
|
|
759
|
-
const { heartbeatEndpoint: i, firstPrivatePath: n, infiniteSession: s, timeDeducted: a, authenticatedEndpoint: l, autoLogin: u, autoLoginEmail: m, autoLoginPassword: p, setCurrentDate: y, isDebug: v, backendToken:
|
|
758
|
+
}, tt = ie(), qt = ({ children: r }) => {
|
|
759
|
+
const { heartbeatEndpoint: i, firstPrivatePath: n, infiniteSession: s, timeDeducted: a, authenticatedEndpoint: l, autoLogin: u, autoLoginEmail: m, autoLoginPassword: p, setCurrentDate: y, isDebug: v, backendToken: R } = U(), { setIsLoading: E } = me(), { setShowAlert: d, setMessageAlert: g, setTypeAlert: x, activeAlert: O } = ee(), j = ke(), [S, P] = w(null), [C, N] = w(), [B, te] = w(), [q, re] = w(), [le, J] = w(!1), z = async () => await Ot(d, x, g), F = async (k = null, I) => {
|
|
760
760
|
k && k.preventDefault(), J(!0);
|
|
761
761
|
try {
|
|
762
|
-
|
|
762
|
+
E(!0), d(!1);
|
|
763
763
|
const T = await (await z()).post(l, {
|
|
764
764
|
auth: I
|
|
765
765
|
}), X = T.headers.token, Y = T.data;
|
|
766
|
-
X && (localStorage.setItem("accessToken", X), localStorage.setItem("user", JSON.stringify(Y)),
|
|
766
|
+
X && (localStorage.setItem("accessToken", X), localStorage.setItem("user", JSON.stringify(Y)), P(!0), N(X), j(`${n}${Y.id}`));
|
|
767
767
|
} catch (A) {
|
|
768
768
|
console.error(A);
|
|
769
769
|
} finally {
|
|
770
|
-
J(!1),
|
|
770
|
+
J(!1), E(!1);
|
|
771
771
|
}
|
|
772
772
|
}, $ = () => {
|
|
773
|
-
localStorage.removeItem("accessToken"), localStorage.removeItem("id"), localStorage.removeItem("user"),
|
|
773
|
+
localStorage.removeItem("accessToken"), localStorage.removeItem("id"), localStorage.removeItem("user"), P(!1), N(null);
|
|
774
774
|
}, V = async () => {
|
|
775
775
|
try {
|
|
776
776
|
const k = localStorage.getItem("accessToken"), T = (await (await z()).get(
|
|
@@ -786,9 +786,9 @@ const Ot = async (r, i, n) => {
|
|
|
786
786
|
console.error(k), $();
|
|
787
787
|
}
|
|
788
788
|
}, be = () => {
|
|
789
|
-
if (!
|
|
789
|
+
if (!C)
|
|
790
790
|
return;
|
|
791
|
-
const I = at(
|
|
791
|
+
const I = at(C).exp, A = Math.floor(Date.now() / 1e3), T = (I - A) * 1e3;
|
|
792
792
|
re(T), te(T - a);
|
|
793
793
|
}, ce = async (k) => {
|
|
794
794
|
try {
|
|
@@ -800,39 +800,39 @@ const Ot = async (r, i, n) => {
|
|
|
800
800
|
}
|
|
801
801
|
}
|
|
802
802
|
)).data;
|
|
803
|
-
T && (localStorage.setItem("user", JSON.stringify(T)), localStorage.setItem("accessToken", k),
|
|
803
|
+
T && (localStorage.setItem("user", JSON.stringify(T)), localStorage.setItem("accessToken", k), P(!0), j(`${n}${T.id}`));
|
|
804
804
|
} catch (I) {
|
|
805
805
|
console.error(I);
|
|
806
806
|
}
|
|
807
807
|
};
|
|
808
808
|
M(() => {
|
|
809
809
|
if (localStorage.getItem("accessToken"))
|
|
810
|
-
|
|
810
|
+
P(!0);
|
|
811
811
|
else {
|
|
812
|
-
|
|
812
|
+
P(!1);
|
|
813
813
|
return;
|
|
814
814
|
}
|
|
815
815
|
}, []), M(() => {
|
|
816
|
-
u && ce(
|
|
816
|
+
u && ce(R);
|
|
817
817
|
}, [u]), M(() => {
|
|
818
|
-
S || u && !le && ce(
|
|
818
|
+
S || u && !le && ce(R);
|
|
819
819
|
}, [S]), M(() => {
|
|
820
820
|
if (u) return;
|
|
821
821
|
be();
|
|
822
822
|
let k;
|
|
823
|
-
s &&
|
|
823
|
+
s && C && B && (k = setInterval(() => {
|
|
824
824
|
V();
|
|
825
825
|
}, B));
|
|
826
826
|
let I;
|
|
827
|
-
return !s &&
|
|
827
|
+
return !s && C && q && (I = setTimeout(() => {
|
|
828
828
|
$(), O("danger", "Sessione scaduta");
|
|
829
829
|
}, q)), () => {
|
|
830
830
|
k && clearInterval(k), I && clearTimeout(I);
|
|
831
831
|
};
|
|
832
|
-
}, [
|
|
832
|
+
}, [C, B]);
|
|
833
833
|
const ye = {
|
|
834
834
|
isAuthenticated: S,
|
|
835
|
-
setIsAuthenticated:
|
|
835
|
+
setIsAuthenticated: P,
|
|
836
836
|
login: F,
|
|
837
837
|
logout: $,
|
|
838
838
|
setCurrentToken: N,
|
|
@@ -843,7 +843,7 @@ const Ot = async (r, i, n) => {
|
|
|
843
843
|
const r = se(tt);
|
|
844
844
|
if (r === void 0) throw new Error("Non sei dentro al Auth Provider");
|
|
845
845
|
return r;
|
|
846
|
-
}, rt = ie(),
|
|
846
|
+
}, rt = ie(), Jt = ({ children: r, publicRoutes: i = [], privateRoutes: n = [] }) => /* @__PURE__ */ o.jsx(rt.Provider, { value: { publicRoutes: i, privateRoutes: n }, children: r }), kt = () => {
|
|
847
847
|
const r = se(rt);
|
|
848
848
|
if (r === void 0)
|
|
849
849
|
throw new Error(
|
|
@@ -858,11 +858,11 @@ Esempio:
|
|
|
858
858
|
</RouteProvider>`
|
|
859
859
|
);
|
|
860
860
|
return r;
|
|
861
|
-
}, ot = ie(),
|
|
861
|
+
}, ot = ie(), Vt = ({ children: r }) => {
|
|
862
862
|
const { login: i } = ve(), { clearLoginFormOnError: n } = U(), s = {
|
|
863
863
|
email: "",
|
|
864
864
|
password: ""
|
|
865
|
-
}, [a, l] = w("Accedi"), [u, m] = w("Email"), [p, y] = w("email"), [v,
|
|
865
|
+
}, [a, l] = w("Accedi"), [u, m] = w("Email"), [p, y] = w("email"), [v, R] = w("example@example.it"), [E, d] = w("Accedi"), [g, x] = w(s), [O, j] = w(), [S, P] = w(), [C, N] = w(), [B, te] = w(), [q, re] = w({}), z = {
|
|
866
866
|
overrideStyle: q,
|
|
867
867
|
setOverrideStyle: re,
|
|
868
868
|
title: a,
|
|
@@ -872,24 +872,24 @@ Esempio:
|
|
|
872
872
|
type: p,
|
|
873
873
|
setType: y,
|
|
874
874
|
placeholder: v,
|
|
875
|
-
setPlaceholder:
|
|
876
|
-
buttonText:
|
|
875
|
+
setPlaceholder: R,
|
|
876
|
+
buttonText: E,
|
|
877
877
|
setButtonText: d,
|
|
878
|
-
formData:
|
|
879
|
-
setFormData:
|
|
878
|
+
formData: g,
|
|
879
|
+
setFormData: x,
|
|
880
880
|
LogoImg: O,
|
|
881
881
|
setLogoImg: j,
|
|
882
882
|
styleCardForm: S,
|
|
883
|
-
setStyleCardForm:
|
|
884
|
-
styleContainerLogo:
|
|
883
|
+
setStyleCardForm: P,
|
|
884
|
+
styleContainerLogo: C,
|
|
885
885
|
setStyleContainerLogo: N,
|
|
886
886
|
styleLogo: B,
|
|
887
887
|
setStyleLogo: te,
|
|
888
888
|
changeData: (F, $) => {
|
|
889
|
-
|
|
889
|
+
x((V) => ({ ...V, [F]: $ }));
|
|
890
890
|
},
|
|
891
891
|
handleLogin: (F) => {
|
|
892
|
-
i(F,
|
|
892
|
+
i(F, g), n && x(s);
|
|
893
893
|
}
|
|
894
894
|
};
|
|
895
895
|
return /* @__PURE__ */ o.jsx(ot.Provider, { value: z, children: r });
|
|
@@ -912,18 +912,18 @@ function Pt(r) {
|
|
|
912
912
|
return ae({ tag: "svg", attr: { viewBox: "0 0 15 15", fill: "none" }, child: [{ tag: "path", attr: { fillRule: "evenodd", clipRule: "evenodd", d: "M11.7816 4.03157C12.0062 3.80702 12.0062 3.44295 11.7816 3.2184C11.5571 2.99385 11.193 2.99385 10.9685 3.2184L7.50005 6.68682L4.03164 3.2184C3.80708 2.99385 3.44301 2.99385 3.21846 3.2184C2.99391 3.44295 2.99391 3.80702 3.21846 4.03157L6.68688 7.49999L3.21846 10.9684C2.99391 11.193 2.99391 11.557 3.21846 11.7816C3.44301 12.0061 3.80708 12.0061 4.03164 11.7816L7.50005 8.31316L10.9685 11.7816C11.193 12.0061 11.5571 12.0061 11.7816 11.7816C12.0062 11.557 12.0062 11.193 11.7816 10.9684L8.31322 7.49999L11.7816 4.03157Z", fill: "currentColor" }, child: [] }] })(r);
|
|
913
913
|
}
|
|
914
914
|
const Ue = () => {
|
|
915
|
-
const { messageAlert: r, typeAlert: i, alertConfig: n, getIcon: s, closeAlert: a } = ee(), { alertTimeout: l } = U(), [u, m] = w(0), { bgColor: p, textColor: y, buttonBg: v, hoverBg:
|
|
915
|
+
const { messageAlert: r, typeAlert: i, alertConfig: n, getIcon: s, closeAlert: a } = ee(), { alertTimeout: l } = U(), [u, m] = w(0), { bgColor: p, textColor: y, buttonBg: v, hoverBg: R, focusRing: E, progressColor: d } = n[i];
|
|
916
916
|
return M(() => {
|
|
917
|
-
let
|
|
917
|
+
let g;
|
|
918
918
|
const O = 100 / (l / 100);
|
|
919
|
-
|
|
920
|
-
m((S) => S >= 100 ? (clearInterval(
|
|
919
|
+
g = setInterval(() => {
|
|
920
|
+
m((S) => S >= 100 ? (clearInterval(g), 100) : S + O);
|
|
921
921
|
}, 100);
|
|
922
922
|
const j = setTimeout(() => {
|
|
923
923
|
a();
|
|
924
924
|
}, l);
|
|
925
925
|
return () => {
|
|
926
|
-
clearTimeout(j), clearInterval(
|
|
926
|
+
clearTimeout(j), clearInterval(g);
|
|
927
927
|
};
|
|
928
928
|
}, []), /* @__PURE__ */ o.jsxs("div", { className: `flex items-center p-4 pt-6 ${y} rounded-lg ${p} mx-auto max-sm:min-w-[280px] sm:max-w-1/3 fixed top-[calc(100vh-100px)] sm:right-10 right-1/2 translate-x-1/2 sm:translate-0 z-100`, role: "alert", children: [
|
|
929
929
|
/* @__PURE__ */ o.jsx("div", { className: "w-full bg-gray-200 rounded-t-lg overflow-hidden h-2.5 absolute top-0 left-0 right-0", children: /* @__PURE__ */ o.jsx("div", { className: `${d} h-2.5 rounded-t-lg`, style: { width: `${u}%` } }) }),
|
|
@@ -933,7 +933,7 @@ const Ue = () => {
|
|
|
933
933
|
"button",
|
|
934
934
|
{
|
|
935
935
|
type: "button",
|
|
936
|
-
className: `ms-auto ${v} rounded-lg focus:ring-2 ${
|
|
936
|
+
className: `ms-auto ${v} rounded-lg focus:ring-2 ${E} p-1.5 ${R} inline-flex items-center justify-center h-8 w-8 cursor-pointer`,
|
|
937
937
|
title: "Close",
|
|
938
938
|
onClick: a,
|
|
939
939
|
children: /* @__PURE__ */ o.jsx(Pt, { className: "text-xl" })
|
|
@@ -949,20 +949,20 @@ const Ue = () => {
|
|
|
949
949
|
footerComponent: p = null,
|
|
950
950
|
showFooterOnLogin: y = !1,
|
|
951
951
|
footerExcludedRoutes: v = []
|
|
952
|
-
} = r,
|
|
953
|
-
let
|
|
954
|
-
s.pathname === "/" ?
|
|
955
|
-
const d = v.some((
|
|
956
|
-
let
|
|
957
|
-
return s.pathname === "/" ?
|
|
952
|
+
} = r, R = m.some((x) => $e(x, s.pathname));
|
|
953
|
+
let E;
|
|
954
|
+
s.pathname === "/" ? E = l && u : E = l && !R;
|
|
955
|
+
const d = v.some((x) => $e(x, s.pathname));
|
|
956
|
+
let g;
|
|
957
|
+
return s.pathname === "/" ? g = p && y : g = p && !d, /* @__PURE__ */ o.jsxs(o.Fragment, { children: [
|
|
958
958
|
i && /* @__PURE__ */ o.jsx(Lt, {}),
|
|
959
959
|
n && /* @__PURE__ */ o.jsx(Ue, {}),
|
|
960
|
-
|
|
960
|
+
E && l,
|
|
961
961
|
a ? /* @__PURE__ */ o.jsxs("main", { className: i ? "hidden" : "", children: [
|
|
962
962
|
n && /* @__PURE__ */ o.jsx(Ue, {}),
|
|
963
963
|
/* @__PURE__ */ o.jsx(je, {})
|
|
964
964
|
] }) : /* @__PURE__ */ o.jsx(je, {}),
|
|
965
|
-
|
|
965
|
+
g && p
|
|
966
966
|
] });
|
|
967
967
|
}, Se = (r) => {
|
|
968
968
|
const {
|
|
@@ -976,11 +976,11 @@ const Ue = () => {
|
|
|
976
976
|
inputStyle: p,
|
|
977
977
|
overrideStyle: y,
|
|
978
978
|
disabled: v
|
|
979
|
-
} = r,
|
|
979
|
+
} = r, E = ["text", "email", "password", "search", "tel", "url"].includes(i) ? i : "text";
|
|
980
980
|
return /* @__PURE__ */ o.jsx(
|
|
981
981
|
"input",
|
|
982
982
|
{
|
|
983
|
-
type:
|
|
983
|
+
type: E,
|
|
984
984
|
autoFocus: m,
|
|
985
985
|
id: n,
|
|
986
986
|
className: y || `bg-input-bg border border-input-border text-input-text text-input-placeholder input-rounded focus:ring focus:ring-primary focus:border-primary focus:outline-none focus:shadow-(--shadow-primary-input) block w-full p-input ${p}`,
|
|
@@ -1028,23 +1028,26 @@ const Ue = () => {
|
|
|
1028
1028
|
] }),
|
|
1029
1029
|
/* @__PURE__ */ o.jsx("div", { className: p.containerButton || "flex button-position items-center m-primary-button", children: /* @__PURE__ */ o.jsx("button", { className: p.button || "font-bold cursor-pointer shadow-(--shadow-primary) transition-all duration-200 hover:shadow-(--shadow-primary-hover) active:shadow-(--shadow-primary-active) active:translate-y-[2px] p-primary-button rounded-primary-button bg-primary hover:bg-primary-hover text-primary-text", children: a }) })
|
|
1030
1030
|
] });
|
|
1031
|
-
}, Gt = ({ Logo: r }) => {
|
|
1031
|
+
}, Gt = "0.0.97", Tt = ({ Logo: r }) => {
|
|
1032
1032
|
const { styleCardForm: i, styleContainerLogo: n, styleLogo: s, overrideStyle: a } = nt(), { firstPrivatePath: l } = U(), u = ke();
|
|
1033
1033
|
return M(() => {
|
|
1034
1034
|
const m = JSON.parse(localStorage.getItem("user"));
|
|
1035
1035
|
localStorage.getItem("accessToken") && m.id && u(`${l}${m.id}`);
|
|
1036
|
-
}, []), /* @__PURE__ */ o.
|
|
1037
|
-
/* @__PURE__ */ o.jsx("div", { className:
|
|
1038
|
-
/* @__PURE__ */ o.jsx(
|
|
1039
|
-
|
|
1040
|
-
|
|
1036
|
+
}, []), /* @__PURE__ */ o.jsxs("section", { id: "login-page", children: [
|
|
1037
|
+
/* @__PURE__ */ o.jsx("div", { className: "text-md text-primary absolute top-4 left-4", children: Gt }),
|
|
1038
|
+
/* @__PURE__ */ o.jsx("div", { className: a.container || "container mx-auto flex items-center justify-center h-screen", children: /* @__PURE__ */ o.jsxs("div", { className: a.cardForm || `bg-form card-style card-size flex flex-col sm:flex-row sm:items-center justify-center ${i}`, children: [
|
|
1039
|
+
/* @__PURE__ */ o.jsx("div", { className: a.containerLogo || `basis-1/2 flex items-center justify-center ${n}`, children: r && /* @__PURE__ */ o.jsx(r, { className: a.logo || `login-logo h-full sm:h-auto ${s}` }) }),
|
|
1040
|
+
/* @__PURE__ */ o.jsx(Nt, {})
|
|
1041
|
+
] }) })
|
|
1042
|
+
] });
|
|
1043
|
+
}, _t = () => {
|
|
1041
1044
|
const { isAuthenticated: r } = ve(), { activeAlert: i } = ee(), { autoLogin: n } = U();
|
|
1042
1045
|
return M(() => {
|
|
1043
1046
|
const s = localStorage.getItem("accessToken");
|
|
1044
1047
|
!r && !s && !n && i("danger", "Non sei autorizzato");
|
|
1045
1048
|
}, []), r === null ? null : r ? /* @__PURE__ */ o.jsx(je, {}) : /* @__PURE__ */ o.jsx(Je, { to: "/", replace: !0 });
|
|
1046
|
-
},
|
|
1047
|
-
const { logout: r, setCurrentToken: i, createAxiosInstances: n } = ve(), { usersEndpoint: s } = U(), { setIsLoading: a } = me(), { activeAlert: l } = ee(), [u, m] = w(null), [p, y] = w(!1), v = JSON.parse(localStorage.getItem("user")),
|
|
1049
|
+
}, It = () => {
|
|
1050
|
+
const { logout: r, setCurrentToken: i, createAxiosInstances: n } = ve(), { usersEndpoint: s } = U(), { setIsLoading: a } = me(), { activeAlert: l } = ee(), [u, m] = w(null), [p, y] = w(!1), v = JSON.parse(localStorage.getItem("user")), R = async () => {
|
|
1048
1051
|
try {
|
|
1049
1052
|
y(!0);
|
|
1050
1053
|
const d = localStorage.getItem("accessToken");
|
|
@@ -1066,7 +1069,7 @@ const Ue = () => {
|
|
|
1066
1069
|
} finally {
|
|
1067
1070
|
y(!1);
|
|
1068
1071
|
}
|
|
1069
|
-
},
|
|
1072
|
+
}, E = () => {
|
|
1070
1073
|
r(), l("info", "Hai effettuato il logout");
|
|
1071
1074
|
};
|
|
1072
1075
|
return M(() => {
|
|
@@ -1081,7 +1084,7 @@ const Ue = () => {
|
|
|
1081
1084
|
/* @__PURE__ */ o.jsx(
|
|
1082
1085
|
"button",
|
|
1083
1086
|
{
|
|
1084
|
-
onClick:
|
|
1087
|
+
onClick: E,
|
|
1085
1088
|
className: "bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded-full cursor-pointer shadow-[0_4px_10px_rgba(239,68,68,0.3),0_2px_4px_rgba(239,68,68,0.2)] hover:shadow-[0_6px_14px_rgba(185,28,28,0.4),0_3px_6px_rgba(185,28,28,0.3)] active:shadow-[0_2px_5px_rgba(239,68,68,0.3)] transition-all duration-200 active:translate-y-[2px]",
|
|
1086
1089
|
children: "Logout"
|
|
1087
1090
|
}
|
|
@@ -1090,7 +1093,7 @@ const Ue = () => {
|
|
|
1090
1093
|
/* @__PURE__ */ o.jsx("div", { className: "flex justify-center items-center my-12 gap-8", children: /* @__PURE__ */ o.jsx(
|
|
1091
1094
|
"button",
|
|
1092
1095
|
{
|
|
1093
|
-
onClick:
|
|
1096
|
+
onClick: R,
|
|
1094
1097
|
className: "bg-blue-500 hover:bg-blue-700 text-white font-bold py-2 px-4 rounded-full disabled:bg-blue-300 disabled:text-gray-500 disabled:cursor-not-allowed cursor-pointer transition-all duration-200 active:translate-y-[2px] shadow-[0_4px_10px_rgba(59,130,246,0.3),0_2px_4px_rgba(59,130,246,0.2)] hover:shadow-[0_6px_14px_rgba(29,78,216,0.4),0_3px_6px_rgba(29,78,216,0.3)] active:shadow-[0_2px_5px_rgba(59,130,246,0.3)]",
|
|
1095
1098
|
disabled: p,
|
|
1096
1099
|
children: "Lista degli utenti"
|
|
@@ -1102,7 +1105,7 @@ const Ue = () => {
|
|
|
1102
1105
|
d.email
|
|
1103
1106
|
] }, `user-${d.id}`)) }) })
|
|
1104
1107
|
] }) });
|
|
1105
|
-
},
|
|
1108
|
+
}, At = (r) => /* @__PURE__ */ t.createElement("svg", { width: "108.41262mm", height: "108.41262mm", viewBox: "0 0 108.41262 108.41262", id: "svg1", xmlSpace: "preserve", xmlnsXlink: "http://www.w3.org/1999/xlink", xmlns: "http://www.w3.org/2000/svg", "xmlns:svg": "http://www.w3.org/2000/svg", ...r }, /* @__PURE__ */ t.createElement("defs", { id: "defs1" }, /* @__PURE__ */ t.createElement("linearGradient", { id: "linearGradient27" }, /* @__PURE__ */ t.createElement("stop", { style: {
|
|
1106
1109
|
stopColor: "#ff0000",
|
|
1107
1110
|
stopOpacity: 1
|
|
1108
1111
|
}, offset: 0, id: "stop27" }), /* @__PURE__ */ t.createElement("stop", { style: {
|
|
@@ -1148,20 +1151,20 @@ const Ue = () => {
|
|
|
1148
1151
|
strokeWidth: 0,
|
|
1149
1152
|
strokeOpacity: 1,
|
|
1150
1153
|
paintOrder: "stroke markers fill"
|
|
1151
|
-
}, d: "", id: "path40", transform: "scale(0.26458333)" }))),
|
|
1154
|
+
}, d: "", id: "path40", transform: "scale(0.26458333)" }))), Xt = (r) => {
|
|
1152
1155
|
const { publicRoutes: i, privateRoutes: n } = kt(), { firstPrivatePath: s } = U(), {
|
|
1153
|
-
logoImg: a =
|
|
1156
|
+
logoImg: a = At,
|
|
1154
1157
|
pathImg: l = "./src/assets/MyWarehouse.svg",
|
|
1155
|
-
firstPrivateElement: u = /* @__PURE__ */ o.jsx(
|
|
1158
|
+
firstPrivateElement: u = /* @__PURE__ */ o.jsx(It, {}),
|
|
1156
1159
|
globalLayout: m,
|
|
1157
1160
|
isMain: p,
|
|
1158
1161
|
headerComponent: y,
|
|
1159
1162
|
showHeaderOnLogin: v,
|
|
1160
|
-
headerExcludedRoutes:
|
|
1161
|
-
footerComponent:
|
|
1163
|
+
headerExcludedRoutes: R,
|
|
1164
|
+
footerComponent: E,
|
|
1162
1165
|
showFooterOnLogin: d,
|
|
1163
|
-
footerExcludedRoutes:
|
|
1164
|
-
privateProvider:
|
|
1166
|
+
footerExcludedRoutes: g,
|
|
1167
|
+
privateProvider: x,
|
|
1165
1168
|
customProvider: O
|
|
1166
1169
|
} = r, j = m || /* @__PURE__ */ o.jsx(
|
|
1167
1170
|
Rt,
|
|
@@ -1169,34 +1172,34 @@ const Ue = () => {
|
|
|
1169
1172
|
isMain: p,
|
|
1170
1173
|
headerComponent: y,
|
|
1171
1174
|
showHeaderOnLogin: v,
|
|
1172
|
-
headerExcludedRoutes:
|
|
1173
|
-
footerComponent:
|
|
1175
|
+
headerExcludedRoutes: R,
|
|
1176
|
+
footerComponent: E,
|
|
1174
1177
|
showFooterOnLogin: d,
|
|
1175
|
-
footerExcludedRoutes:
|
|
1178
|
+
footerExcludedRoutes: g
|
|
1176
1179
|
}
|
|
1177
|
-
), S =
|
|
1178
|
-
const
|
|
1179
|
-
l && (
|
|
1180
|
+
), S = x ? H.cloneElement(x, {}, O) : /* @__PURE__ */ o.jsx(_t, { children: O }), P = () => {
|
|
1181
|
+
const C = document.querySelector("link[rel='icon']");
|
|
1182
|
+
l && (C.href = l);
|
|
1180
1183
|
};
|
|
1181
1184
|
return M(() => {
|
|
1182
|
-
|
|
1185
|
+
P();
|
|
1183
1186
|
}, []), /* @__PURE__ */ o.jsx(lt, { children: /* @__PURE__ */ o.jsxs(Q, { element: m === "none" ? null : j, children: [
|
|
1184
1187
|
/* @__PURE__ */ o.jsxs(Q, { path: "/", children: [
|
|
1185
|
-
/* @__PURE__ */ o.jsx(Q, { index: !0, element: /* @__PURE__ */ o.jsx(
|
|
1186
|
-
i.map((
|
|
1188
|
+
/* @__PURE__ */ o.jsx(Q, { index: !0, element: /* @__PURE__ */ o.jsx(Tt, { Logo: a }) }),
|
|
1189
|
+
i.map((C, N) => /* @__PURE__ */ o.jsx(Q, { path: C.path, element: C.element }, `public-${N}`))
|
|
1187
1190
|
] }),
|
|
1188
1191
|
/* @__PURE__ */ o.jsxs(Q, { element: S, children: [
|
|
1189
1192
|
/* @__PURE__ */ o.jsx(Q, { path: `${s ?? "/dashboard/"}:id`, element: u }),
|
|
1190
|
-
n.map((
|
|
1193
|
+
n.map((C, N) => /* @__PURE__ */ o.jsx(Q, { path: C.path, element: C.element }, `private-${N}`))
|
|
1191
1194
|
] })
|
|
1192
1195
|
] }) });
|
|
1193
|
-
},
|
|
1196
|
+
}, Kt = ({ children: r }) => {
|
|
1194
1197
|
var a;
|
|
1195
1198
|
const i = Le(), { activeAlert: n } = ee(), s = JSON.parse(localStorage.getItem("user"));
|
|
1196
1199
|
return M(() => {
|
|
1197
1200
|
(!s || !s.admin) && n("warning", "Non puoi accedere a questa pagina");
|
|
1198
1201
|
}, [s]), !s || !s.admin ? /* @__PURE__ */ o.jsx(Je, { to: ((a = i.state) == null ? void 0 : a.from) || "/", replace: !0 }) : r;
|
|
1199
|
-
},
|
|
1202
|
+
}, Qt = ({ spinner: r = !0, spinnerStyle: i, text: n, textStyle: s, children: a, containerStyle: l, overrideStyle: u = {} }) => /* @__PURE__ */ o.jsxs("div", { className: u.container || `w-full h-full relative flex items-center justify-center ${l}`, children: [
|
|
1200
1203
|
r && /* @__PURE__ */ o.jsx(it, { className: u.spinner || `text-[20rem] animate-spin text-black ${i}` }),
|
|
1201
1204
|
a || /* @__PURE__ */ o.jsx("p", { className: u.text || `text-black text-2xl select-none absolute top-1/2 left-1/2 -translate-x-1/2 -translate-y-1/2 ${s}`, children: n || "Loading..." })
|
|
1202
1205
|
] }), qe = ({ isTag: r = !1, value: i, label: n, placeholder: s, id: a, onChange: l, error: u = null }) => /* @__PURE__ */ o.jsxs("div", { className: `flex items-center justify-center relative ${r ? "gap-4 mb-2" : "gap-1 m-4"}`, children: [
|
|
@@ -1214,7 +1217,7 @@ const Ue = () => {
|
|
|
1214
1217
|
}
|
|
1215
1218
|
),
|
|
1216
1219
|
u && /* @__PURE__ */ o.jsx("p", { className: "text-red-600 text-[13px] absolute bottom-0 left-26 translate-y-[20px]", children: u })
|
|
1217
|
-
] }),
|
|
1220
|
+
] }), e0 = ({ title: r, showTag: i, value: n, tag: s, showButton: a, handleClick: l }) => /* @__PURE__ */ o.jsxs("div", { className: `border border-slate-300 rounded-xl p-2 m-2 shadow-xl transition-all duration-700 transform ${r === "TAG B" ? "delay-200" : "mb-4"} ${i ? "opacity-100 translate-y-0" : "opacity-0 translate-y-10"}`, children: [
|
|
1218
1221
|
/* @__PURE__ */ o.jsx("h2", { className: "text-center mb-2 text-2xl", children: r }),
|
|
1219
1222
|
/* @__PURE__ */ o.jsx(
|
|
1220
1223
|
qe,
|
|
@@ -1246,10 +1249,10 @@ const Ue = () => {
|
|
|
1246
1249
|
}
|
|
1247
1250
|
) })
|
|
1248
1251
|
] });
|
|
1249
|
-
function
|
|
1252
|
+
function Mt(r) {
|
|
1250
1253
|
return ae({ tag: "svg", attr: { viewBox: "0 0 16 16", fill: "currentColor" }, child: [{ tag: "path", attr: { fillRule: "evenodd", clipRule: "evenodd", d: "M11.04 1.33L12.71 3l.29.71v.33h-.5l-.5.5v-.83l-1.67-1.67H10v4H4v-4H2v10h3l-.5 1H2l-1-1v-10l1-1h8.33l.71.29zM7 5h2V2H7v3zm6.5 0L15 6.5l-.02.69-5.5 5.5-.13.12-.37.37-.1.09-3 1.5-.67-.67 1.5-3 .09-.1.37-.37.12-.13 5.5-5.5h.71zm-6.22 7.24l-.52 1 1.04-.48-.52-.52zm.69-1.03l.79.79 5.15-5.15-.79-.79-5.15 5.15z" }, child: [] }] })(r);
|
|
1251
1254
|
}
|
|
1252
|
-
const
|
|
1255
|
+
const t0 = ({ minReadingPower: r, maxReadingPower: i, stepRangePower: n, rangeValue: s, setRangeValue: a, show: l, handleClick: u }) => {
|
|
1253
1256
|
const m = (s - r) / (i - r) * 100;
|
|
1254
1257
|
return /* @__PURE__ */ o.jsxs("div", { className: `border border-slate-300 rounded-xl p-2 m-2 shadow-xl transition-all duration-700 transform ${l ? "opacity-100 translate-y-0" : "opacity-0 translate-y-10"}`, children: [
|
|
1255
1258
|
/* @__PURE__ */ o.jsx("h2", { className: "text-center my-4 text-2xl", children: "Configurazione Potenza" }),
|
|
@@ -1283,12 +1286,12 @@ const e0 = ({ minReadingPower: r, maxReadingPower: i, stepRangePower: n, rangeVa
|
|
|
1283
1286
|
className: "py-2 px-4 flex items-center justify-center gap-1 bg-save-button text-white rounded-lg shadow-md transition duration-200 ease-in-out transform active:translate-y-[2px] cursor-pointer",
|
|
1284
1287
|
children: [
|
|
1285
1288
|
"Salva",
|
|
1286
|
-
/* @__PURE__ */ o.jsx(
|
|
1289
|
+
/* @__PURE__ */ o.jsx(Mt, {})
|
|
1287
1290
|
]
|
|
1288
1291
|
}
|
|
1289
1292
|
) })
|
|
1290
1293
|
] });
|
|
1291
|
-
},
|
|
1294
|
+
}, r0 = ({ show: r, isConfigPage: i, handleSelectFile: n }) => /* @__PURE__ */ o.jsxs("div", { className: `${i ? `${r ? "opacity-100 translate-y-0 delay-200" : "opacity-0 translate-y-10"}` : ""} p-4 text-center transition-all duration-700 transform`, children: [
|
|
1292
1295
|
/* @__PURE__ */ o.jsxs("h2", { className: "text-xl my-4", children: [
|
|
1293
1296
|
"Seleziona il file ",
|
|
1294
1297
|
/* @__PURE__ */ o.jsx("strong", { children: "config.json" }),
|
|
@@ -1296,13 +1299,13 @@ const e0 = ({ minReadingPower: r, maxReadingPower: i, stepRangePower: n, rangeVa
|
|
|
1296
1299
|
] }),
|
|
1297
1300
|
/* @__PURE__ */ o.jsx("button", { onClick: n, className: "my-4 bg-blue-500 text-white px-4 py-2 rounded-lg", children: "Seleziona file" })
|
|
1298
1301
|
] });
|
|
1299
|
-
function
|
|
1302
|
+
function zt(r) {
|
|
1300
1303
|
return ae({ tag: "svg", attr: { viewBox: "0 0 512 512" }, child: [{ tag: "path", attr: { d: "M312 372c-7.7 0-14 6.3-14 14 0 9.9-8.1 18-18 18H94c-9.9 0-18-8.1-18-18V126c0-9.9 8.1-18 18-18h186c9.9 0 18 8.1 18 18 0 7.7 6.3 14 14 14s14-6.3 14-14c0-25.4-20.6-46-46-46H94c-25.4 0-46 20.6-46 46v260c0 25.4 20.6 46 46 46h186c25.4 0 46-20.6 46-46 0-7.7-6.3-14-14-14z" }, child: [] }, { tag: "path", attr: { d: "M372.9 158.1c-2.6-2.6-6.1-4.1-9.9-4.1-3.7 0-7.3 1.4-9.9 4.1-5.5 5.5-5.5 14.3 0 19.8l65.2 64.2H162c-7.7 0-14 6.3-14 14s6.3 14 14 14h256.6L355 334.2c-5.4 5.4-5.4 14.3 0 19.8l.1.1c2.7 2.5 6.2 3.9 9.8 3.9 3.8 0 7.3-1.4 9.9-4.1l82.6-82.4c4.3-4.3 6.5-9.3 6.5-14.7 0-5.3-2.3-10.3-6.5-14.5l-84.5-84.2z" }, child: [] }] })(r);
|
|
1301
1304
|
}
|
|
1302
|
-
function
|
|
1305
|
+
function Bt(r) {
|
|
1303
1306
|
return ae({ tag: "svg", attr: { version: "1.2", baseProfile: "tiny", viewBox: "0 0 24 24" }, child: [{ tag: "path", attr: { d: "M12 9.059v-2.559c0-.256-.098-.512-.293-.708-.195-.195-.451-.292-.707-.292s-.512.097-.707.292l-6.293 6.208 6.293 6.207c.195.195.451.293.707.293s.512-.098.707-.293.293-.452.293-.707v-2.489c2.75.068 5.755.566 8 3.989v-1c0-4.633-3.5-8.443-8-8.941z" }, child: [] }] })(r);
|
|
1304
1307
|
}
|
|
1305
|
-
const
|
|
1308
|
+
const Ft = (r) => /* @__PURE__ */ t.createElement("svg", { width: "108.41262mm", height: "108.41262mm", viewBox: "0 0 108.41262 108.41262", id: "svg1", xmlSpace: "preserve", xmlnsXlink: "http://www.w3.org/1999/xlink", xmlns: "http://www.w3.org/2000/svg", "xmlns:svg": "http://www.w3.org/2000/svg", ...r }, /* @__PURE__ */ t.createElement("defs", { id: "defs1" }, /* @__PURE__ */ t.createElement("linearGradient", { id: "linearGradient27" }, /* @__PURE__ */ t.createElement("stop", { style: {
|
|
1306
1309
|
stopColor: "#ff0000",
|
|
1307
1310
|
stopOpacity: 1
|
|
1308
1311
|
}, offset: 0, id: "stop27" }), /* @__PURE__ */ t.createElement("stop", { style: {
|
|
@@ -1367,30 +1370,30 @@ const Bt = (r) => /* @__PURE__ */ t.createElement("svg", { width: "108.41262mm",
|
|
|
1367
1370
|
strokeWidth: 0,
|
|
1368
1371
|
strokeOpacity: 1,
|
|
1369
1372
|
paintOrder: "stroke markers fill"
|
|
1370
|
-
}, d: "", id: "path40", transform: "scale(0.26458333)" }))),
|
|
1371
|
-
const { logout:
|
|
1372
|
-
|
|
1373
|
-
},
|
|
1374
|
-
return /* @__PURE__ */ o.jsx("header", { className:
|
|
1375
|
-
/* @__PURE__ */ o.jsx("figure", { children: typeof r == "function" ? /* @__PURE__ */ o.jsx(r, { className: "header-logo-size" }) :
|
|
1376
|
-
/* @__PURE__ */ o.jsx("div", { children: /* @__PURE__ */ o.jsx("p", { children: (
|
|
1373
|
+
}, d: "", id: "path40", transform: "scale(0.26458333)" }))), o0 = ({ Logo: r, logo: i }) => {
|
|
1374
|
+
const { logout: n } = ve(), { activeAlert: s } = ee(), { autoLogin: a, configRoutes: l, firstPrivateTitle: u, showHeaderButton: m } = U(), { isLoading: p } = me(), y = Le(), v = ke(), R = () => {
|
|
1375
|
+
n(), s("info", "Hai effettuato il logout");
|
|
1376
|
+
}, E = l.find((g) => g.path === y.pathname), d = ct("home/:id");
|
|
1377
|
+
return /* @__PURE__ */ o.jsx("header", { className: p ? "hidden" : "", children: /* @__PURE__ */ o.jsxs("nav", { className: "header-size flex items-center justify-between px-2 shadow-lg border-b gap-2 border-b-gray-300", children: [
|
|
1378
|
+
/* @__PURE__ */ o.jsx("figure", { children: r && typeof r == "function" ? /* @__PURE__ */ o.jsx(r, { className: "header-logo-size" }) : i ? /* @__PURE__ */ o.jsx("img", { src: i, alt: "Logo", className: "header-logo-size" }) : /* @__PURE__ */ o.jsx(Ft, { className: "header-logo-size" }) }),
|
|
1379
|
+
/* @__PURE__ */ o.jsx("div", { children: /* @__PURE__ */ o.jsx("p", { children: (E == null ? void 0 : E.title) || u }) }),
|
|
1377
1380
|
/* @__PURE__ */ o.jsxs("div", { children: [
|
|
1378
|
-
!
|
|
1381
|
+
!a && d && /* @__PURE__ */ o.jsx(
|
|
1379
1382
|
"button",
|
|
1380
1383
|
{
|
|
1381
1384
|
className: "h-[48px] w-[48px] flex items-center justify-center bg-red-600 text-white rounded-lg shadow-md transition duration-200 ease-in-out transform active:translate-y-[2px] cursor-pointer",
|
|
1382
1385
|
type: "button",
|
|
1383
|
-
onClick:
|
|
1384
|
-
children: /* @__PURE__ */ o.jsx(
|
|
1386
|
+
onClick: R,
|
|
1387
|
+
children: /* @__PURE__ */ o.jsx(zt, { className: "text-4xl w-full" })
|
|
1385
1388
|
}
|
|
1386
1389
|
),
|
|
1387
|
-
!
|
|
1390
|
+
!d && m && /* @__PURE__ */ o.jsx(
|
|
1388
1391
|
"button",
|
|
1389
1392
|
{
|
|
1390
1393
|
className: "h-[48px] w-[48px] flex items-center justify-center bg-sky-600 text-white rounded-lg shadow-md transition duration-200 ease-in-out transform active:translate-y-[2px] cursor-pointer",
|
|
1391
1394
|
type: "button",
|
|
1392
|
-
onClick: () =>
|
|
1393
|
-
children: /* @__PURE__ */ o.jsx(
|
|
1395
|
+
onClick: () => v(-1),
|
|
1396
|
+
children: /* @__PURE__ */ o.jsx(Bt, { className: "text-4xl w-full" })
|
|
1394
1397
|
}
|
|
1395
1398
|
)
|
|
1396
1399
|
] })
|
|
@@ -1398,44 +1401,44 @@ const Bt = (r) => /* @__PURE__ */ t.createElement("svg", { width: "108.41262mm",
|
|
|
1398
1401
|
};
|
|
1399
1402
|
export {
|
|
1400
1403
|
Ue as Alert,
|
|
1401
|
-
|
|
1402
|
-
|
|
1403
|
-
|
|
1404
|
-
|
|
1405
|
-
|
|
1406
|
-
|
|
1407
|
-
|
|
1408
|
-
|
|
1409
|
-
|
|
1410
|
-
|
|
1404
|
+
Ut as AlertProvider,
|
|
1405
|
+
Kt as AuthAdmin,
|
|
1406
|
+
_t as AuthPage,
|
|
1407
|
+
qt as AuthProvider,
|
|
1408
|
+
s0 as BrowserRouter,
|
|
1409
|
+
t0 as CardInputRange,
|
|
1410
|
+
e0 as CardInputTag,
|
|
1411
|
+
r0 as ConfigFileReader,
|
|
1412
|
+
Zt as ConfigProvider,
|
|
1413
|
+
It as Dashboard,
|
|
1411
1414
|
Rt as DefaultLayout,
|
|
1412
1415
|
pt as ErrorPage,
|
|
1413
|
-
|
|
1416
|
+
o0 as Header,
|
|
1414
1417
|
Se as Input,
|
|
1415
1418
|
qe as InputGroup,
|
|
1416
1419
|
Oe as InputLabel,
|
|
1417
|
-
|
|
1420
|
+
a0 as Link,
|
|
1418
1421
|
Lt as Loading,
|
|
1419
|
-
|
|
1420
|
-
|
|
1421
|
-
|
|
1422
|
+
Qt as LoadingComponent,
|
|
1423
|
+
Yt as LoadingProvider,
|
|
1424
|
+
Tt as Login,
|
|
1422
1425
|
Nt as LoginForm,
|
|
1423
|
-
|
|
1424
|
-
|
|
1425
|
-
|
|
1426
|
-
|
|
1427
|
-
|
|
1428
|
-
|
|
1429
|
-
|
|
1430
|
-
|
|
1426
|
+
Vt as LoginFormProvider,
|
|
1427
|
+
l0 as NavLink,
|
|
1428
|
+
c0 as Outlet,
|
|
1429
|
+
Xt as PackageRoutes,
|
|
1430
|
+
f0 as Route,
|
|
1431
|
+
Jt as RouteProvider,
|
|
1432
|
+
u0 as Routes,
|
|
1433
|
+
g0 as axios,
|
|
1431
1434
|
Ot as fetchAxiosConfig,
|
|
1432
1435
|
ee as useAlert,
|
|
1433
1436
|
ve as useAuth,
|
|
1434
1437
|
U as useConfig,
|
|
1435
1438
|
me as useLoading,
|
|
1436
|
-
|
|
1439
|
+
d0 as useLocation,
|
|
1437
1440
|
nt as useLoginForm,
|
|
1438
|
-
|
|
1439
|
-
|
|
1441
|
+
m0 as useMatch,
|
|
1442
|
+
p0 as useNavigate,
|
|
1440
1443
|
kt as useRoutesInjection
|
|
1441
1444
|
};
|