thecore-auth 0.0.36 → 0.0.37
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 +27 -10
- package/dist/thecore-auth.esm.js +576 -541
- package/package.json +1 -1
package/dist/thecore-auth.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import
|
|
2
|
-
import
|
|
1
|
+
import z, { createContext as ue, useState as S, useContext as fe, useEffect as U } from "react";
|
|
2
|
+
import $t from "jwt-decode";
|
|
3
3
|
import { useNavigate as tt, Outlet as rt, Navigate as Lt, useParams as Ft } from "react-router-dom";
|
|
4
|
-
import
|
|
5
|
-
var
|
|
4
|
+
import zt from "axios";
|
|
5
|
+
var se = { exports: {} }, Z = {};
|
|
6
6
|
/**
|
|
7
7
|
* @license React
|
|
8
8
|
* react-jsx-runtime.production.min.js
|
|
@@ -13,20 +13,20 @@ var le = { exports: {} }, ee = {};
|
|
|
13
13
|
* LICENSE file in the root directory of this source tree.
|
|
14
14
|
*/
|
|
15
15
|
var Ke;
|
|
16
|
-
function
|
|
17
|
-
if (Ke) return
|
|
16
|
+
function Mt() {
|
|
17
|
+
if (Ke) return Z;
|
|
18
18
|
Ke = 1;
|
|
19
|
-
var t =
|
|
20
|
-
function
|
|
21
|
-
var
|
|
22
|
-
|
|
23
|
-
for (
|
|
24
|
-
if (
|
|
25
|
-
return { $$typeof: n, type:
|
|
19
|
+
var t = z, n = Symbol.for("react.element"), o = Symbol.for("react.fragment"), s = Object.prototype.hasOwnProperty, c = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED.ReactCurrentOwner, u = { key: !0, ref: !0, __self: !0, __source: !0 };
|
|
20
|
+
function v(g, f, b) {
|
|
21
|
+
var j, w = {}, C = null, _ = null;
|
|
22
|
+
b !== void 0 && (C = "" + b), f.key !== void 0 && (C = "" + f.key), f.ref !== void 0 && (_ = f.ref);
|
|
23
|
+
for (j in f) s.call(f, j) && !u.hasOwnProperty(j) && (w[j] = f[j]);
|
|
24
|
+
if (g && g.defaultProps) for (j in f = g.defaultProps, f) w[j] === void 0 && (w[j] = f[j]);
|
|
25
|
+
return { $$typeof: n, type: g, key: C, ref: _, props: w, _owner: c.current };
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return Z.Fragment = o, Z.jsx = v, Z.jsxs = v, Z;
|
|
28
28
|
}
|
|
29
|
-
var
|
|
29
|
+
var Q = {};
|
|
30
30
|
/**
|
|
31
31
|
* @license React
|
|
32
32
|
* react-jsx-runtime.development.js
|
|
@@ -39,88 +39,88 @@ var te = {};
|
|
|
39
39
|
var Ge;
|
|
40
40
|
function Wt() {
|
|
41
41
|
return Ge || (Ge = 1, process.env.NODE_ENV !== "production" && function() {
|
|
42
|
-
var t =
|
|
43
|
-
function
|
|
42
|
+
var t = z, n = Symbol.for("react.element"), o = Symbol.for("react.portal"), s = Symbol.for("react.fragment"), c = Symbol.for("react.strict_mode"), u = Symbol.for("react.profiler"), v = Symbol.for("react.provider"), g = Symbol.for("react.context"), f = Symbol.for("react.forward_ref"), b = Symbol.for("react.suspense"), j = Symbol.for("react.suspense_list"), w = Symbol.for("react.memo"), C = Symbol.for("react.lazy"), _ = Symbol.for("react.offscreen"), k = Symbol.iterator, $ = "@@iterator";
|
|
43
|
+
function O(e) {
|
|
44
44
|
if (e === null || typeof e != "object")
|
|
45
45
|
return null;
|
|
46
|
-
var r =
|
|
46
|
+
var r = k && e[k] || e[$];
|
|
47
47
|
return typeof r == "function" ? r : null;
|
|
48
48
|
}
|
|
49
|
-
var
|
|
50
|
-
function
|
|
49
|
+
var h = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
50
|
+
function y(e) {
|
|
51
51
|
{
|
|
52
|
-
for (var r = arguments.length,
|
|
53
|
-
|
|
54
|
-
|
|
52
|
+
for (var r = arguments.length, a = new Array(r > 1 ? r - 1 : 0), l = 1; l < r; l++)
|
|
53
|
+
a[l - 1] = arguments[l];
|
|
54
|
+
N("error", e, a);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function N(e, r, a) {
|
|
58
58
|
{
|
|
59
|
-
var l =
|
|
60
|
-
m !== "" && (r += "%s",
|
|
61
|
-
var x =
|
|
62
|
-
return String(
|
|
59
|
+
var l = h.ReactDebugCurrentFrame, m = l.getStackAddendum();
|
|
60
|
+
m !== "" && (r += "%s", a = a.concat([m]));
|
|
61
|
+
var x = a.map(function(p) {
|
|
62
|
+
return String(p);
|
|
63
63
|
});
|
|
64
64
|
x.unshift("Warning: " + r), Function.prototype.apply.call(console[e], console, x);
|
|
65
65
|
}
|
|
66
66
|
}
|
|
67
|
-
var
|
|
68
|
-
|
|
67
|
+
var D = !1, ge = !1, ve = !1, A = !1, L = !1, M;
|
|
68
|
+
M = Symbol.for("react.module.reference");
|
|
69
69
|
function F(e) {
|
|
70
|
-
return !!(typeof e == "string" || typeof e == "function" || e === s || e ===
|
|
70
|
+
return !!(typeof e == "string" || typeof e == "function" || e === s || e === u || L || e === c || e === b || e === j || A || e === _ || D || ge || ve || typeof e == "object" && e !== null && (e.$$typeof === C || e.$$typeof === w || e.$$typeof === v || e.$$typeof === g || e.$$typeof === f || // This needs to include all possible module reference object
|
|
71
71
|
// types supported by any Flight configuration anywhere since
|
|
72
72
|
// we don't know which Flight build this will end up being used
|
|
73
73
|
// with.
|
|
74
|
-
e.$$typeof ===
|
|
74
|
+
e.$$typeof === M || e.getModuleId !== void 0));
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function te(e, r, a) {
|
|
77
77
|
var l = e.displayName;
|
|
78
78
|
if (l)
|
|
79
79
|
return l;
|
|
80
80
|
var m = r.displayName || r.name || "";
|
|
81
|
-
return m !== "" ?
|
|
81
|
+
return m !== "" ? a + "(" + m + ")" : a;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function Y(e) {
|
|
84
84
|
return e.displayName || "Context";
|
|
85
85
|
}
|
|
86
86
|
function W(e) {
|
|
87
87
|
if (e == null)
|
|
88
88
|
return null;
|
|
89
|
-
if (typeof e.tag == "number" &&
|
|
89
|
+
if (typeof e.tag == "number" && y("Received an unexpected object in getComponentNameFromType(). This is likely a bug in React. Please file an issue."), typeof e == "function")
|
|
90
90
|
return e.displayName || e.name || null;
|
|
91
91
|
if (typeof e == "string")
|
|
92
92
|
return e;
|
|
93
93
|
switch (e) {
|
|
94
94
|
case s:
|
|
95
95
|
return "Fragment";
|
|
96
|
-
case
|
|
96
|
+
case o:
|
|
97
97
|
return "Portal";
|
|
98
|
-
case g:
|
|
99
|
-
return "Profiler";
|
|
100
98
|
case u:
|
|
99
|
+
return "Profiler";
|
|
100
|
+
case c:
|
|
101
101
|
return "StrictMode";
|
|
102
|
-
case
|
|
102
|
+
case b:
|
|
103
103
|
return "Suspense";
|
|
104
|
-
case
|
|
104
|
+
case j:
|
|
105
105
|
return "SuspenseList";
|
|
106
106
|
}
|
|
107
107
|
if (typeof e == "object")
|
|
108
108
|
switch (e.$$typeof) {
|
|
109
|
-
case
|
|
109
|
+
case g:
|
|
110
110
|
var r = e;
|
|
111
|
-
return
|
|
112
|
-
case
|
|
113
|
-
var
|
|
114
|
-
return
|
|
115
|
-
case
|
|
116
|
-
return
|
|
117
|
-
case
|
|
111
|
+
return Y(r) + ".Consumer";
|
|
112
|
+
case v:
|
|
113
|
+
var a = e;
|
|
114
|
+
return Y(a._context) + ".Provider";
|
|
115
|
+
case f:
|
|
116
|
+
return te(e, e.render, "ForwardRef");
|
|
117
|
+
case w:
|
|
118
118
|
var l = e.displayName || null;
|
|
119
119
|
return l !== null ? l : W(e.type) || "Memo";
|
|
120
|
-
case
|
|
121
|
-
var m = e, x = m._payload,
|
|
120
|
+
case C: {
|
|
121
|
+
var m = e, x = m._payload, p = m._init;
|
|
122
122
|
try {
|
|
123
|
-
return W(
|
|
123
|
+
return W(p(x));
|
|
124
124
|
} catch {
|
|
125
125
|
return null;
|
|
126
126
|
}
|
|
@@ -128,14 +128,14 @@ function Wt() {
|
|
|
128
128
|
}
|
|
129
129
|
return null;
|
|
130
130
|
}
|
|
131
|
-
var
|
|
131
|
+
var V = Object.assign, H = 0, Re, _e, Te, Se, Oe, Pe, ke;
|
|
132
132
|
function Ae() {
|
|
133
133
|
}
|
|
134
134
|
Ae.__reactDisabledLog = !0;
|
|
135
135
|
function ct() {
|
|
136
136
|
{
|
|
137
|
-
if (
|
|
138
|
-
Re = console.log,
|
|
137
|
+
if (H === 0) {
|
|
138
|
+
Re = console.log, _e = console.info, Te = console.warn, Se = console.error, Oe = console.group, Pe = console.groupCollapsed, ke = console.groupEnd;
|
|
139
139
|
var e = {
|
|
140
140
|
configurable: !0,
|
|
141
141
|
enumerable: !0,
|
|
@@ -152,194 +152,194 @@ function Wt() {
|
|
|
152
152
|
groupEnd: e
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
H++;
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
function ut() {
|
|
159
159
|
{
|
|
160
|
-
if (
|
|
160
|
+
if (H--, H === 0) {
|
|
161
161
|
var e = {
|
|
162
162
|
configurable: !0,
|
|
163
163
|
enumerable: !0,
|
|
164
164
|
writable: !0
|
|
165
165
|
};
|
|
166
166
|
Object.defineProperties(console, {
|
|
167
|
-
log:
|
|
167
|
+
log: V({}, e, {
|
|
168
168
|
value: Re
|
|
169
169
|
}),
|
|
170
|
-
info:
|
|
171
|
-
value: Te
|
|
172
|
-
}),
|
|
173
|
-
warn: B({}, e, {
|
|
170
|
+
info: V({}, e, {
|
|
174
171
|
value: _e
|
|
175
172
|
}),
|
|
176
|
-
|
|
177
|
-
value:
|
|
173
|
+
warn: V({}, e, {
|
|
174
|
+
value: Te
|
|
178
175
|
}),
|
|
179
|
-
|
|
180
|
-
value:
|
|
176
|
+
error: V({}, e, {
|
|
177
|
+
value: Se
|
|
181
178
|
}),
|
|
182
|
-
|
|
179
|
+
group: V({}, e, {
|
|
183
180
|
value: Oe
|
|
184
181
|
}),
|
|
185
|
-
|
|
182
|
+
groupCollapsed: V({}, e, {
|
|
183
|
+
value: Pe
|
|
184
|
+
}),
|
|
185
|
+
groupEnd: V({}, e, {
|
|
186
186
|
value: ke
|
|
187
187
|
})
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
|
-
|
|
190
|
+
H < 0 && y("disabledDepth fell below zero. This is a bug in React. Please file an issue.");
|
|
191
191
|
}
|
|
192
192
|
}
|
|
193
|
-
var pe =
|
|
194
|
-
function
|
|
193
|
+
var pe = h.ReactCurrentDispatcher, he;
|
|
194
|
+
function re(e, r, a) {
|
|
195
195
|
{
|
|
196
|
-
if (
|
|
196
|
+
if (he === void 0)
|
|
197
197
|
try {
|
|
198
198
|
throw Error();
|
|
199
199
|
} catch (m) {
|
|
200
200
|
var l = m.stack.trim().match(/\n( *(at )?)/);
|
|
201
|
-
|
|
201
|
+
he = l && l[1] || "";
|
|
202
202
|
}
|
|
203
203
|
return `
|
|
204
|
-
` +
|
|
204
|
+
` + he + e;
|
|
205
205
|
}
|
|
206
206
|
}
|
|
207
|
-
var
|
|
207
|
+
var me = !1, ne;
|
|
208
208
|
{
|
|
209
209
|
var ft = typeof WeakMap == "function" ? WeakMap : Map;
|
|
210
|
-
|
|
210
|
+
ne = new ft();
|
|
211
211
|
}
|
|
212
212
|
function Ie(e, r) {
|
|
213
|
-
if (!e ||
|
|
213
|
+
if (!e || me)
|
|
214
214
|
return "";
|
|
215
215
|
{
|
|
216
|
-
var
|
|
217
|
-
if (
|
|
218
|
-
return
|
|
216
|
+
var a = ne.get(e);
|
|
217
|
+
if (a !== void 0)
|
|
218
|
+
return a;
|
|
219
219
|
}
|
|
220
220
|
var l;
|
|
221
|
-
|
|
221
|
+
me = !0;
|
|
222
222
|
var m = Error.prepareStackTrace;
|
|
223
223
|
Error.prepareStackTrace = void 0;
|
|
224
224
|
var x;
|
|
225
225
|
x = pe.current, pe.current = null, ct();
|
|
226
226
|
try {
|
|
227
227
|
if (r) {
|
|
228
|
-
var
|
|
228
|
+
var p = function() {
|
|
229
229
|
throw Error();
|
|
230
230
|
};
|
|
231
|
-
if (Object.defineProperty(
|
|
231
|
+
if (Object.defineProperty(p.prototype, "props", {
|
|
232
232
|
set: function() {
|
|
233
233
|
throw Error();
|
|
234
234
|
}
|
|
235
235
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
236
236
|
try {
|
|
237
|
-
Reflect.construct(
|
|
238
|
-
} catch (
|
|
239
|
-
l =
|
|
237
|
+
Reflect.construct(p, []);
|
|
238
|
+
} catch (P) {
|
|
239
|
+
l = P;
|
|
240
240
|
}
|
|
241
|
-
Reflect.construct(e, [],
|
|
241
|
+
Reflect.construct(e, [], p);
|
|
242
242
|
} else {
|
|
243
243
|
try {
|
|
244
|
-
|
|
245
|
-
} catch (
|
|
246
|
-
l =
|
|
244
|
+
p.call();
|
|
245
|
+
} catch (P) {
|
|
246
|
+
l = P;
|
|
247
247
|
}
|
|
248
|
-
e.call(
|
|
248
|
+
e.call(p.prototype);
|
|
249
249
|
}
|
|
250
250
|
} else {
|
|
251
251
|
try {
|
|
252
252
|
throw Error();
|
|
253
|
-
} catch (
|
|
254
|
-
l =
|
|
253
|
+
} catch (P) {
|
|
254
|
+
l = P;
|
|
255
255
|
}
|
|
256
256
|
e();
|
|
257
257
|
}
|
|
258
|
-
} catch (
|
|
259
|
-
if (
|
|
260
|
-
for (var
|
|
261
|
-
`),
|
|
262
|
-
`),
|
|
258
|
+
} catch (P) {
|
|
259
|
+
if (P && l && typeof P.stack == "string") {
|
|
260
|
+
for (var d = P.stack.split(`
|
|
261
|
+
`), T = l.stack.split(`
|
|
262
|
+
`), E = d.length - 1, R = T.length - 1; E >= 1 && R >= 0 && d[E] !== T[R]; )
|
|
263
263
|
R--;
|
|
264
|
-
for (;
|
|
265
|
-
if (
|
|
266
|
-
if (
|
|
264
|
+
for (; E >= 1 && R >= 0; E--, R--)
|
|
265
|
+
if (d[E] !== T[R]) {
|
|
266
|
+
if (E !== 1 || R !== 1)
|
|
267
267
|
do
|
|
268
|
-
if (
|
|
269
|
-
var
|
|
270
|
-
` +
|
|
271
|
-
return e.displayName &&
|
|
268
|
+
if (E--, R--, R < 0 || d[E] !== T[R]) {
|
|
269
|
+
var I = `
|
|
270
|
+
` + d[E].replace(" at new ", " at ");
|
|
271
|
+
return e.displayName && I.includes("<anonymous>") && (I = I.replace("<anonymous>", e.displayName)), typeof e == "function" && ne.set(e, I), I;
|
|
272
272
|
}
|
|
273
|
-
while (
|
|
273
|
+
while (E >= 1 && R >= 0);
|
|
274
274
|
break;
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
} finally {
|
|
278
|
-
|
|
278
|
+
me = !1, pe.current = x, ut(), Error.prepareStackTrace = m;
|
|
279
279
|
}
|
|
280
|
-
var J = e ? e.displayName || e.name : "",
|
|
281
|
-
return typeof e == "function" &&
|
|
280
|
+
var J = e ? e.displayName || e.name : "", B = J ? re(J) : "";
|
|
281
|
+
return typeof e == "function" && ne.set(e, B), B;
|
|
282
282
|
}
|
|
283
|
-
function dt(e, r,
|
|
283
|
+
function dt(e, r, a) {
|
|
284
284
|
return Ie(e, !1);
|
|
285
285
|
}
|
|
286
286
|
function gt(e) {
|
|
287
287
|
var r = e.prototype;
|
|
288
288
|
return !!(r && r.isReactComponent);
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function oe(e, r, a) {
|
|
291
291
|
if (e == null)
|
|
292
292
|
return "";
|
|
293
293
|
if (typeof e == "function")
|
|
294
294
|
return Ie(e, gt(e));
|
|
295
295
|
if (typeof e == "string")
|
|
296
|
-
return
|
|
296
|
+
return re(e);
|
|
297
297
|
switch (e) {
|
|
298
|
-
case
|
|
299
|
-
return
|
|
300
|
-
case
|
|
301
|
-
return
|
|
298
|
+
case b:
|
|
299
|
+
return re("Suspense");
|
|
300
|
+
case j:
|
|
301
|
+
return re("SuspenseList");
|
|
302
302
|
}
|
|
303
303
|
if (typeof e == "object")
|
|
304
304
|
switch (e.$$typeof) {
|
|
305
|
-
case
|
|
305
|
+
case f:
|
|
306
306
|
return dt(e.render);
|
|
307
|
-
case
|
|
308
|
-
return
|
|
309
|
-
case
|
|
307
|
+
case w:
|
|
308
|
+
return oe(e.type, r, a);
|
|
309
|
+
case C: {
|
|
310
310
|
var l = e, m = l._payload, x = l._init;
|
|
311
311
|
try {
|
|
312
|
-
return
|
|
312
|
+
return oe(x(m), r, a);
|
|
313
313
|
} catch {
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
return "";
|
|
318
318
|
}
|
|
319
|
-
var
|
|
320
|
-
function
|
|
319
|
+
var X = Object.prototype.hasOwnProperty, Ne = {}, De = h.ReactDebugCurrentFrame;
|
|
320
|
+
function ae(e) {
|
|
321
321
|
if (e) {
|
|
322
|
-
var r = e._owner,
|
|
323
|
-
|
|
322
|
+
var r = e._owner, a = oe(e.type, e._source, r ? r.type : null);
|
|
323
|
+
De.setExtraStackFrame(a);
|
|
324
324
|
} else
|
|
325
|
-
|
|
325
|
+
De.setExtraStackFrame(null);
|
|
326
326
|
}
|
|
327
|
-
function vt(e, r,
|
|
327
|
+
function vt(e, r, a, l, m) {
|
|
328
328
|
{
|
|
329
|
-
var x = Function.call.bind(
|
|
330
|
-
for (var
|
|
331
|
-
if (x(e,
|
|
332
|
-
var
|
|
329
|
+
var x = Function.call.bind(X);
|
|
330
|
+
for (var p in e)
|
|
331
|
+
if (x(e, p)) {
|
|
332
|
+
var d = void 0;
|
|
333
333
|
try {
|
|
334
|
-
if (typeof e[
|
|
335
|
-
var
|
|
336
|
-
throw
|
|
334
|
+
if (typeof e[p] != "function") {
|
|
335
|
+
var T = Error((l || "React class") + ": " + a + " type `" + p + "` is invalid; it must be a function, usually from the `prop-types` package, but received `" + typeof e[p] + "`.This often happens because of typos such as `PropTypes.function` instead of `PropTypes.func`.");
|
|
336
|
+
throw T.name = "Invariant Violation", T;
|
|
337
337
|
}
|
|
338
|
-
|
|
339
|
-
} catch (
|
|
340
|
-
|
|
338
|
+
d = e[p](r, p, l, a, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
339
|
+
} catch (E) {
|
|
340
|
+
d = E;
|
|
341
341
|
}
|
|
342
|
-
|
|
342
|
+
d && !(d instanceof Error) && (ae(m), y("%s: type specification of %s `%s` is invalid; the type checker function must return `null` or an `Error` but returned a %s. You may have forgotten to pass an argument to the type checker creator (arrayOf, instanceOf, objectOf, oneOf, oneOfType, and shape all require an argument).", l || "React class", a, p, typeof d), ae(null)), d instanceof Error && !(d.message in Ne) && (Ne[d.message] = !0, ae(m), y("Failed %s type: %s", a, d.message), ae(null));
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
}
|
|
@@ -347,34 +347,34 @@ function Wt() {
|
|
|
347
347
|
function be(e) {
|
|
348
348
|
return pt(e);
|
|
349
349
|
}
|
|
350
|
-
function
|
|
350
|
+
function ht(e) {
|
|
351
351
|
{
|
|
352
|
-
var r = typeof Symbol == "function" && Symbol.toStringTag,
|
|
353
|
-
return
|
|
352
|
+
var r = typeof Symbol == "function" && Symbol.toStringTag, a = r && e[Symbol.toStringTag] || e.constructor.name || "Object";
|
|
353
|
+
return a;
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
|
-
function
|
|
356
|
+
function mt(e) {
|
|
357
357
|
try {
|
|
358
|
-
return
|
|
358
|
+
return $e(e), !1;
|
|
359
359
|
} catch {
|
|
360
360
|
return !0;
|
|
361
361
|
}
|
|
362
362
|
}
|
|
363
|
-
function
|
|
363
|
+
function $e(e) {
|
|
364
364
|
return "" + e;
|
|
365
365
|
}
|
|
366
366
|
function Le(e) {
|
|
367
|
-
if (
|
|
368
|
-
return
|
|
367
|
+
if (mt(e))
|
|
368
|
+
return y("The provided key is an unsupported type %s. This value must be coerced to a string before before using it here.", ht(e)), $e(e);
|
|
369
369
|
}
|
|
370
|
-
var Fe =
|
|
370
|
+
var Fe = h.ReactCurrentOwner, bt = {
|
|
371
371
|
key: !0,
|
|
372
372
|
ref: !0,
|
|
373
373
|
__self: !0,
|
|
374
374
|
__source: !0
|
|
375
|
-
},
|
|
375
|
+
}, ze, Me;
|
|
376
376
|
function xt(e) {
|
|
377
|
-
if (
|
|
377
|
+
if (X.call(e, "ref")) {
|
|
378
378
|
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
379
379
|
if (r && r.isReactWarning)
|
|
380
380
|
return !1;
|
|
@@ -382,99 +382,99 @@ function Wt() {
|
|
|
382
382
|
return e.ref !== void 0;
|
|
383
383
|
}
|
|
384
384
|
function yt(e) {
|
|
385
|
-
if (
|
|
385
|
+
if (X.call(e, "key")) {
|
|
386
386
|
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
387
387
|
if (r && r.isReactWarning)
|
|
388
388
|
return !1;
|
|
389
389
|
}
|
|
390
390
|
return e.key !== void 0;
|
|
391
391
|
}
|
|
392
|
-
function
|
|
392
|
+
function jt(e, r) {
|
|
393
393
|
typeof e.ref == "string" && Fe.current;
|
|
394
394
|
}
|
|
395
|
-
function
|
|
395
|
+
function wt(e, r) {
|
|
396
396
|
{
|
|
397
|
-
var
|
|
398
|
-
|
|
397
|
+
var a = function() {
|
|
398
|
+
ze || (ze = !0, y("%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://reactjs.org/link/special-props)", r));
|
|
399
399
|
};
|
|
400
|
-
|
|
401
|
-
get:
|
|
400
|
+
a.isReactWarning = !0, Object.defineProperty(e, "key", {
|
|
401
|
+
get: a,
|
|
402
402
|
configurable: !0
|
|
403
403
|
});
|
|
404
404
|
}
|
|
405
405
|
}
|
|
406
406
|
function Et(e, r) {
|
|
407
407
|
{
|
|
408
|
-
var
|
|
409
|
-
|
|
408
|
+
var a = function() {
|
|
409
|
+
Me || (Me = !0, y("%s: `ref` 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://reactjs.org/link/special-props)", r));
|
|
410
410
|
};
|
|
411
|
-
|
|
412
|
-
get:
|
|
411
|
+
a.isReactWarning = !0, Object.defineProperty(e, "ref", {
|
|
412
|
+
get: a,
|
|
413
413
|
configurable: !0
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
|
-
var Ct = function(e, r,
|
|
418
|
-
var
|
|
417
|
+
var Ct = function(e, r, a, l, m, x, p) {
|
|
418
|
+
var d = {
|
|
419
419
|
// This tag allows us to uniquely identify this as a React Element
|
|
420
420
|
$$typeof: n,
|
|
421
421
|
// Built-in properties that belong on the element
|
|
422
422
|
type: e,
|
|
423
423
|
key: r,
|
|
424
|
-
ref:
|
|
425
|
-
props:
|
|
424
|
+
ref: a,
|
|
425
|
+
props: p,
|
|
426
426
|
// Record the component responsible for creating this element.
|
|
427
427
|
_owner: x
|
|
428
428
|
};
|
|
429
|
-
return
|
|
429
|
+
return d._store = {}, Object.defineProperty(d._store, "validated", {
|
|
430
430
|
configurable: !1,
|
|
431
431
|
enumerable: !1,
|
|
432
432
|
writable: !0,
|
|
433
433
|
value: !1
|
|
434
|
-
}), Object.defineProperty(
|
|
434
|
+
}), Object.defineProperty(d, "_self", {
|
|
435
435
|
configurable: !1,
|
|
436
436
|
enumerable: !1,
|
|
437
437
|
writable: !1,
|
|
438
438
|
value: l
|
|
439
|
-
}), Object.defineProperty(
|
|
439
|
+
}), Object.defineProperty(d, "_source", {
|
|
440
440
|
configurable: !1,
|
|
441
441
|
enumerable: !1,
|
|
442
442
|
writable: !1,
|
|
443
443
|
value: m
|
|
444
|
-
}), Object.freeze && (Object.freeze(
|
|
444
|
+
}), Object.freeze && (Object.freeze(d.props), Object.freeze(d)), d;
|
|
445
445
|
};
|
|
446
|
-
function Rt(e, r,
|
|
446
|
+
function Rt(e, r, a, l, m) {
|
|
447
447
|
{
|
|
448
|
-
var x,
|
|
449
|
-
|
|
448
|
+
var x, p = {}, d = null, T = null;
|
|
449
|
+
a !== void 0 && (Le(a), d = "" + a), yt(r) && (Le(r.key), d = "" + r.key), xt(r) && (T = r.ref, jt(r, m));
|
|
450
450
|
for (x in r)
|
|
451
|
-
|
|
451
|
+
X.call(r, x) && !bt.hasOwnProperty(x) && (p[x] = r[x]);
|
|
452
452
|
if (e && e.defaultProps) {
|
|
453
|
-
var
|
|
454
|
-
for (x in
|
|
455
|
-
|
|
453
|
+
var E = e.defaultProps;
|
|
454
|
+
for (x in E)
|
|
455
|
+
p[x] === void 0 && (p[x] = E[x]);
|
|
456
456
|
}
|
|
457
|
-
if (
|
|
457
|
+
if (d || T) {
|
|
458
458
|
var R = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
459
|
-
|
|
459
|
+
d && wt(p, R), T && Et(p, R);
|
|
460
460
|
}
|
|
461
|
-
return Ct(e,
|
|
461
|
+
return Ct(e, d, T, m, l, Fe.current, p);
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
|
-
var xe =
|
|
464
|
+
var xe = h.ReactCurrentOwner, We = h.ReactDebugCurrentFrame;
|
|
465
465
|
function q(e) {
|
|
466
466
|
if (e) {
|
|
467
|
-
var r = e._owner,
|
|
468
|
-
We.setExtraStackFrame(
|
|
467
|
+
var r = e._owner, a = oe(e.type, e._source, r ? r.type : null);
|
|
468
|
+
We.setExtraStackFrame(a);
|
|
469
469
|
} else
|
|
470
470
|
We.setExtraStackFrame(null);
|
|
471
471
|
}
|
|
472
472
|
var ye;
|
|
473
473
|
ye = !1;
|
|
474
|
-
function
|
|
474
|
+
function je(e) {
|
|
475
475
|
return typeof e == "object" && e !== null && e.$$typeof === n;
|
|
476
476
|
}
|
|
477
|
-
function
|
|
477
|
+
function Ve() {
|
|
478
478
|
{
|
|
479
479
|
if (xe.current) {
|
|
480
480
|
var e = W(xe.current.type);
|
|
@@ -486,51 +486,51 @@ Check the render method of \`` + e + "`.";
|
|
|
486
486
|
return "";
|
|
487
487
|
}
|
|
488
488
|
}
|
|
489
|
-
function
|
|
489
|
+
function _t(e) {
|
|
490
490
|
return "";
|
|
491
491
|
}
|
|
492
|
-
var
|
|
493
|
-
function
|
|
492
|
+
var Be = {};
|
|
493
|
+
function Tt(e) {
|
|
494
494
|
{
|
|
495
|
-
var r =
|
|
495
|
+
var r = Ve();
|
|
496
496
|
if (!r) {
|
|
497
|
-
var
|
|
498
|
-
|
|
497
|
+
var a = typeof e == "string" ? e : e.displayName || e.name;
|
|
498
|
+
a && (r = `
|
|
499
499
|
|
|
500
|
-
Check the top-level render call using <` +
|
|
500
|
+
Check the top-level render call using <` + a + ">.");
|
|
501
501
|
}
|
|
502
502
|
return r;
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
|
-
function
|
|
505
|
+
function Ue(e, r) {
|
|
506
506
|
{
|
|
507
507
|
if (!e._store || e._store.validated || e.key != null)
|
|
508
508
|
return;
|
|
509
509
|
e._store.validated = !0;
|
|
510
|
-
var
|
|
511
|
-
if (
|
|
510
|
+
var a = Tt(r);
|
|
511
|
+
if (Be[a])
|
|
512
512
|
return;
|
|
513
|
-
|
|
513
|
+
Be[a] = !0;
|
|
514
514
|
var l = "";
|
|
515
|
-
e && e._owner && e._owner !== xe.current && (l = " It was passed a child from " + W(e._owner.type) + "."), q(e),
|
|
515
|
+
e && e._owner && e._owner !== xe.current && (l = " It was passed a child from " + W(e._owner.type) + "."), q(e), y('Each child in a list should have a unique "key" prop.%s%s See https://reactjs.org/link/warning-keys for more information.', a, l), q(null);
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
|
-
function
|
|
518
|
+
function Ye(e, r) {
|
|
519
519
|
{
|
|
520
520
|
if (typeof e != "object")
|
|
521
521
|
return;
|
|
522
522
|
if (be(e))
|
|
523
|
-
for (var
|
|
524
|
-
var l = e[
|
|
525
|
-
|
|
523
|
+
for (var a = 0; a < e.length; a++) {
|
|
524
|
+
var l = e[a];
|
|
525
|
+
je(l) && Ue(l, r);
|
|
526
526
|
}
|
|
527
|
-
else if (
|
|
527
|
+
else if (je(e))
|
|
528
528
|
e._store && (e._store.validated = !0);
|
|
529
529
|
else if (e) {
|
|
530
|
-
var m =
|
|
530
|
+
var m = O(e);
|
|
531
531
|
if (typeof m == "function" && m !== e.entries)
|
|
532
|
-
for (var x = m.call(e),
|
|
533
|
-
|
|
532
|
+
for (var x = m.call(e), p; !(p = x.next()).done; )
|
|
533
|
+
je(p.value) && Ue(p.value, r);
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
536
|
}
|
|
@@ -539,234 +539,254 @@ Check the top-level render call using <` + o + ">.");
|
|
|
539
539
|
var r = e.type;
|
|
540
540
|
if (r == null || typeof r == "string")
|
|
541
541
|
return;
|
|
542
|
-
var
|
|
542
|
+
var a;
|
|
543
543
|
if (typeof r == "function")
|
|
544
|
-
|
|
545
|
-
else if (typeof r == "object" && (r.$$typeof ===
|
|
544
|
+
a = r.propTypes;
|
|
545
|
+
else if (typeof r == "object" && (r.$$typeof === f || // Note: Memo only checks outer props here.
|
|
546
546
|
// Inner props are checked in the reconciler.
|
|
547
|
-
r.$$typeof ===
|
|
548
|
-
|
|
547
|
+
r.$$typeof === w))
|
|
548
|
+
a = r.propTypes;
|
|
549
549
|
else
|
|
550
550
|
return;
|
|
551
|
-
if (
|
|
551
|
+
if (a) {
|
|
552
552
|
var l = W(r);
|
|
553
|
-
vt(
|
|
553
|
+
vt(a, e.props, "prop", l, e);
|
|
554
554
|
} else if (r.PropTypes !== void 0 && !ye) {
|
|
555
555
|
ye = !0;
|
|
556
556
|
var m = W(r);
|
|
557
|
-
|
|
557
|
+
y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", m || "Unknown");
|
|
558
558
|
}
|
|
559
|
-
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved &&
|
|
559
|
+
typeof r.getDefaultProps == "function" && !r.getDefaultProps.isReactClassApproved && y("getDefaultProps is only used on classic React.createClass definitions. Use a static property named `defaultProps` instead.");
|
|
560
560
|
}
|
|
561
561
|
}
|
|
562
|
-
function
|
|
562
|
+
function Ot(e) {
|
|
563
563
|
{
|
|
564
|
-
for (var r = Object.keys(e.props),
|
|
565
|
-
var l = r[
|
|
564
|
+
for (var r = Object.keys(e.props), a = 0; a < r.length; a++) {
|
|
565
|
+
var l = r[a];
|
|
566
566
|
if (l !== "children" && l !== "key") {
|
|
567
|
-
q(e),
|
|
567
|
+
q(e), y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", l), q(null);
|
|
568
568
|
break;
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
|
-
e.ref !== null && (q(e),
|
|
571
|
+
e.ref !== null && (q(e), y("Invalid attribute `ref` supplied to `React.Fragment`."), q(null));
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
574
|
var qe = {};
|
|
575
|
-
function Je(e, r,
|
|
575
|
+
function Je(e, r, a, l, m, x) {
|
|
576
576
|
{
|
|
577
|
-
var
|
|
578
|
-
if (!
|
|
579
|
-
var
|
|
580
|
-
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (
|
|
581
|
-
var
|
|
582
|
-
|
|
583
|
-
var
|
|
584
|
-
e === null ?
|
|
577
|
+
var p = F(e);
|
|
578
|
+
if (!p) {
|
|
579
|
+
var d = "";
|
|
580
|
+
(e === void 0 || typeof e == "object" && e !== null && Object.keys(e).length === 0) && (d += " You likely forgot to export your component from the file it's defined in, or you might have mixed up default and named imports.");
|
|
581
|
+
var T = _t();
|
|
582
|
+
T ? d += T : d += Ve();
|
|
583
|
+
var E;
|
|
584
|
+
e === null ? E = "null" : be(e) ? E = "array" : e !== void 0 && e.$$typeof === n ? (E = "<" + (W(e.type) || "Unknown") + " />", d = " Did you accidentally export a JSX literal instead of a component?") : E = typeof e, y("React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: %s.%s", E, d);
|
|
585
585
|
}
|
|
586
|
-
var R = Rt(e, r,
|
|
586
|
+
var R = Rt(e, r, a, m, x);
|
|
587
587
|
if (R == null)
|
|
588
588
|
return R;
|
|
589
|
-
if (
|
|
590
|
-
var
|
|
591
|
-
if (
|
|
589
|
+
if (p) {
|
|
590
|
+
var I = r.children;
|
|
591
|
+
if (I !== void 0)
|
|
592
592
|
if (l)
|
|
593
|
-
if (be(
|
|
594
|
-
for (var J = 0; J <
|
|
595
|
-
|
|
596
|
-
Object.freeze && Object.freeze(
|
|
593
|
+
if (be(I)) {
|
|
594
|
+
for (var J = 0; J < I.length; J++)
|
|
595
|
+
Ye(I[J], e);
|
|
596
|
+
Object.freeze && Object.freeze(I);
|
|
597
597
|
} else
|
|
598
|
-
|
|
598
|
+
y("React.jsx: Static children should always be an array. You are likely explicitly calling React.jsxs or React.jsxDEV. Use the Babel transform instead.");
|
|
599
599
|
else
|
|
600
|
-
|
|
600
|
+
Ye(I, e);
|
|
601
601
|
}
|
|
602
|
-
if (
|
|
603
|
-
var
|
|
604
|
-
return
|
|
605
|
-
}),
|
|
606
|
-
if (!qe[
|
|
607
|
-
var Nt =
|
|
608
|
-
|
|
602
|
+
if (X.call(r, "key")) {
|
|
603
|
+
var B = W(e), P = Object.keys(r).filter(function(Dt) {
|
|
604
|
+
return Dt !== "key";
|
|
605
|
+
}), we = P.length > 0 ? "{key: someKey, " + P.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
606
|
+
if (!qe[B + we]) {
|
|
607
|
+
var Nt = P.length > 0 ? "{" + P.join(": ..., ") + ": ...}" : "{}";
|
|
608
|
+
y(`A props object containing a "key" prop is being spread into JSX:
|
|
609
609
|
let props = %s;
|
|
610
610
|
<%s {...props} />
|
|
611
611
|
React keys must be passed directly to JSX without using spread:
|
|
612
612
|
let props = %s;
|
|
613
|
-
<%s key={someKey} {...props} />`,
|
|
613
|
+
<%s key={someKey} {...props} />`, we, B, Nt, B), qe[B + we] = !0;
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
|
-
return e === s ?
|
|
616
|
+
return e === s ? Ot(R) : St(R), R;
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
|
-
function
|
|
620
|
-
return Je(e, r,
|
|
619
|
+
function Pt(e, r, a) {
|
|
620
|
+
return Je(e, r, a, !0);
|
|
621
621
|
}
|
|
622
|
-
function kt(e, r,
|
|
623
|
-
return Je(e, r,
|
|
622
|
+
function kt(e, r, a) {
|
|
623
|
+
return Je(e, r, a, !1);
|
|
624
624
|
}
|
|
625
|
-
var At = kt, It =
|
|
626
|
-
|
|
627
|
-
}()),
|
|
625
|
+
var At = kt, It = Pt;
|
|
626
|
+
Q.Fragment = s, Q.jsx = At, Q.jsxs = It;
|
|
627
|
+
}()), Q;
|
|
628
628
|
}
|
|
629
629
|
var He;
|
|
630
|
-
function
|
|
631
|
-
return He || (He = 1, process.env.NODE_ENV === "production" ?
|
|
630
|
+
function Vt() {
|
|
631
|
+
return He || (He = 1, process.env.NODE_ENV === "production" ? se.exports = Mt() : se.exports = Wt()), se.exports;
|
|
632
632
|
}
|
|
633
|
-
var i =
|
|
634
|
-
const nt =
|
|
635
|
-
const [n,
|
|
636
|
-
return /* @__PURE__ */ i.jsx(nt.Provider, { value: { isLoading: n, setIsLoading:
|
|
633
|
+
var i = Vt();
|
|
634
|
+
const nt = ue(), cr = ({ children: t }) => {
|
|
635
|
+
const [n, o] = S(!1);
|
|
636
|
+
return /* @__PURE__ */ i.jsx(nt.Provider, { value: { isLoading: n, setIsLoading: o }, children: t });
|
|
637
637
|
}, Ee = () => {
|
|
638
|
-
const t =
|
|
638
|
+
const t = fe(nt);
|
|
639
639
|
if (t === void 0) throw new Error("Non puoi settare il loading");
|
|
640
640
|
return t;
|
|
641
|
-
},
|
|
642
|
-
|
|
641
|
+
}, Bt = ({ errorMessage: t, errorShow: n }) => /* @__PURE__ */ i.jsx("section", { className: n ? "" : "hidden", children: /* @__PURE__ */ i.jsxs("div", { className: "container mx-auto", children: [
|
|
642
|
+
/* @__PURE__ */ i.jsx("h1", { className: "text-center text-8xl my-12", children: "Errore" }),
|
|
643
|
+
/* @__PURE__ */ i.jsx("pre", { className: "text-xl", children: t })
|
|
644
|
+
] }) }), ot = ue(), ur = ({ children: t }) => {
|
|
645
|
+
const [n, o] = S({}), [s, c] = S(!1), u = `Creare un file config.json in public per il correto funzionamento
|
|
646
|
+
Esempio di config.json:
|
|
647
|
+
|
|
648
|
+
{
|
|
649
|
+
"baseUri": "",
|
|
650
|
+
"authenticatedEndpoint": "",
|
|
651
|
+
"usersEndpoint": "",
|
|
652
|
+
"heartbeatEndpoint": "",
|
|
653
|
+
"infiniteSession": ,
|
|
654
|
+
"timeDeducted": ,
|
|
655
|
+
"alertTimeout": ,
|
|
656
|
+
"axiosErrors": {
|
|
657
|
+
"unauthorized":"",
|
|
658
|
+
"notFound": "",
|
|
659
|
+
"defaultMessage": ""
|
|
660
|
+
},
|
|
661
|
+
"clearLoginFormOnError":
|
|
662
|
+
}`, v = async () => {
|
|
643
663
|
try {
|
|
644
|
-
const
|
|
645
|
-
|
|
646
|
-
} catch (
|
|
647
|
-
console.error(
|
|
664
|
+
const f = await (await fetch("/config.json")).json();
|
|
665
|
+
o(f);
|
|
666
|
+
} catch (g) {
|
|
667
|
+
console.error(g), c(!0);
|
|
648
668
|
}
|
|
649
669
|
};
|
|
650
|
-
return
|
|
651
|
-
|
|
652
|
-
}, []), Object.keys(n).length === 0 ?
|
|
653
|
-
},
|
|
654
|
-
const t =
|
|
670
|
+
return U(() => {
|
|
671
|
+
v();
|
|
672
|
+
}, []), Object.keys(n).length === 0 ? /* @__PURE__ */ i.jsx(Bt, { errorShow: s, errorMessage: u }) : /* @__PURE__ */ i.jsx(ot.Provider, { value: n, children: t });
|
|
673
|
+
}, de = () => {
|
|
674
|
+
const t = fe(ot);
|
|
655
675
|
if (t === void 0) throw new Error("Non puoi leggere i config");
|
|
656
676
|
return t;
|
|
657
|
-
},
|
|
658
|
-
const [n,
|
|
677
|
+
}, at = ue(), fr = ({ children: t }) => {
|
|
678
|
+
const [n, o] = S(!1), [s, c] = S(), [u, v] = S(), g = {
|
|
659
679
|
showAlert: n,
|
|
660
|
-
setShowAlert:
|
|
680
|
+
setShowAlert: o,
|
|
661
681
|
typeAlert: s,
|
|
662
|
-
setTypeAlert:
|
|
663
|
-
messageAlert:
|
|
664
|
-
setMessageAlert:
|
|
682
|
+
setTypeAlert: c,
|
|
683
|
+
messageAlert: u,
|
|
684
|
+
setMessageAlert: v
|
|
665
685
|
};
|
|
666
|
-
return /* @__PURE__ */ i.jsx(
|
|
686
|
+
return /* @__PURE__ */ i.jsx(at.Provider, { value: g, children: t });
|
|
667
687
|
}, G = () => {
|
|
668
|
-
const t =
|
|
688
|
+
const t = fe(at);
|
|
669
689
|
if (t === void 0) throw new Error("Non puoi modificare l'alert");
|
|
670
690
|
return t;
|
|
671
691
|
};
|
|
672
692
|
let K;
|
|
673
|
-
const
|
|
693
|
+
const ie = async (t, n, o) => {
|
|
674
694
|
if (K) return K;
|
|
675
695
|
try {
|
|
676
|
-
const
|
|
677
|
-
return K =
|
|
678
|
-
baseURL:
|
|
696
|
+
const c = await (await fetch("/config.json")).json(), u = c.baseUri, { unauthorized: v, notFound: g, defaultMessage: f } = c.axiosErrors;
|
|
697
|
+
return K = zt.create({
|
|
698
|
+
baseURL: u,
|
|
679
699
|
timeout: 3e3
|
|
680
700
|
}), K.interceptors.request.use(
|
|
681
|
-
(
|
|
701
|
+
(b) => b
|
|
682
702
|
), K.interceptors.response.use(
|
|
683
|
-
(
|
|
684
|
-
(
|
|
685
|
-
if (
|
|
686
|
-
switch (t(!0), n("danger"),
|
|
703
|
+
(b) => b,
|
|
704
|
+
(b) => {
|
|
705
|
+
if (b.response)
|
|
706
|
+
switch (t(!0), n("danger"), b.response.status) {
|
|
687
707
|
case 401:
|
|
688
|
-
localStorage.removeItem("accessToken"),
|
|
708
|
+
localStorage.removeItem("accessToken"), o(v);
|
|
689
709
|
break;
|
|
690
710
|
case 404:
|
|
691
|
-
|
|
711
|
+
o(g);
|
|
692
712
|
break;
|
|
693
713
|
default:
|
|
694
|
-
|
|
714
|
+
o(`${f} ${b.response.status} ${b.response.data.error}`);
|
|
695
715
|
}
|
|
696
|
-
return Promise.reject(
|
|
716
|
+
return Promise.reject(b);
|
|
697
717
|
}
|
|
698
718
|
), K;
|
|
699
719
|
} catch (s) {
|
|
700
720
|
console.error(s);
|
|
701
721
|
}
|
|
702
|
-
}, st =
|
|
703
|
-
const { heartbeatEndpoint: n, infiniteSession:
|
|
704
|
-
|
|
722
|
+
}, st = ue(), dr = ({ children: t }) => {
|
|
723
|
+
const { heartbeatEndpoint: n, infiniteSession: o, timeDeducted: s, authenticatedEndpoint: c } = de(), { setIsLoading: u } = Ee(), { setShowAlert: v, setMessageAlert: g, setTypeAlert: f } = G(), b = tt(), [j, w] = S(null), [C, _] = S(), [k, $] = S(), [O, h] = S(), y = async (A, L) => {
|
|
724
|
+
A.preventDefault();
|
|
705
725
|
try {
|
|
706
|
-
|
|
707
|
-
const F = await (await
|
|
708
|
-
auth:
|
|
709
|
-
}),
|
|
710
|
-
|
|
711
|
-
} catch (
|
|
712
|
-
console.error(
|
|
726
|
+
u(!0), v(!1);
|
|
727
|
+
const F = await (await ie(v, f, g)).post(c, {
|
|
728
|
+
auth: L
|
|
729
|
+
}), te = F.data.id, Y = F.headers.token;
|
|
730
|
+
Y && (localStorage.setItem("accessToken", Y), localStorage.setItem("id", te), w(!0), _(Y), b(`/dashboard/${te}`));
|
|
731
|
+
} catch (M) {
|
|
732
|
+
console.error(M), u(!1);
|
|
713
733
|
}
|
|
714
|
-
},
|
|
715
|
-
localStorage.removeItem("accessToken"), localStorage.removeItem("id"),
|
|
716
|
-
},
|
|
734
|
+
}, N = () => {
|
|
735
|
+
localStorage.removeItem("accessToken"), localStorage.removeItem("id"), w(!1), _(null);
|
|
736
|
+
}, D = async () => {
|
|
717
737
|
try {
|
|
718
|
-
const
|
|
738
|
+
const A = localStorage.getItem("accessToken"), F = (await (await ie(v, f, g)).get(
|
|
719
739
|
`${n}`,
|
|
720
740
|
{ headers: {
|
|
721
|
-
Authorization:
|
|
741
|
+
Authorization: A
|
|
722
742
|
} }
|
|
723
743
|
)).headers.token;
|
|
724
|
-
localStorage.setItem("accessToken", F),
|
|
725
|
-
} catch (
|
|
726
|
-
console.error(
|
|
744
|
+
localStorage.setItem("accessToken", F), _(F);
|
|
745
|
+
} catch (A) {
|
|
746
|
+
console.error(A), N();
|
|
727
747
|
}
|
|
728
|
-
},
|
|
729
|
-
if (!
|
|
748
|
+
}, ge = () => {
|
|
749
|
+
if (!C)
|
|
730
750
|
return;
|
|
731
|
-
const
|
|
732
|
-
|
|
751
|
+
const L = $t(C).exp, M = Math.floor(Date.now() / 1e3), F = (L - M) * 1e3;
|
|
752
|
+
h(F), $(F - s);
|
|
733
753
|
};
|
|
734
|
-
|
|
754
|
+
U(() => {
|
|
735
755
|
if (localStorage.getItem("accessToken"))
|
|
736
|
-
|
|
756
|
+
w(!0);
|
|
737
757
|
else {
|
|
738
|
-
|
|
758
|
+
w(!1);
|
|
739
759
|
return;
|
|
740
760
|
}
|
|
741
|
-
}, []),
|
|
742
|
-
|
|
743
|
-
let
|
|
744
|
-
|
|
745
|
-
|
|
746
|
-
},
|
|
747
|
-
let
|
|
748
|
-
return !
|
|
749
|
-
|
|
750
|
-
},
|
|
751
|
-
|
|
761
|
+
}, []), U(() => {
|
|
762
|
+
ge();
|
|
763
|
+
let A;
|
|
764
|
+
o && C && k && (A = setInterval(() => {
|
|
765
|
+
D();
|
|
766
|
+
}, k));
|
|
767
|
+
let L;
|
|
768
|
+
return !o && C && O && (L = setTimeout(() => {
|
|
769
|
+
N(), v(!0), f("danger"), g("Sessione scaduta");
|
|
770
|
+
}, O)), () => {
|
|
771
|
+
A && clearInterval(A), L && clearTimeout(L);
|
|
752
772
|
};
|
|
753
|
-
}, [
|
|
754
|
-
const
|
|
755
|
-
isAuthenticated:
|
|
756
|
-
setIsAuthenticated:
|
|
757
|
-
login:
|
|
758
|
-
logout:
|
|
759
|
-
setCurrentToken:
|
|
773
|
+
}, [C, k]);
|
|
774
|
+
const ve = {
|
|
775
|
+
isAuthenticated: j,
|
|
776
|
+
setIsAuthenticated: w,
|
|
777
|
+
login: y,
|
|
778
|
+
logout: N,
|
|
779
|
+
setCurrentToken: _
|
|
760
780
|
};
|
|
761
|
-
return /* @__PURE__ */ i.jsx(st.Provider, { value:
|
|
781
|
+
return /* @__PURE__ */ i.jsx(st.Provider, { value: ve, children: t });
|
|
762
782
|
}, Ce = () => {
|
|
763
|
-
const t =
|
|
783
|
+
const t = fe(st);
|
|
764
784
|
if (t === void 0) throw new Error("Non sei dentro al Auth Provider");
|
|
765
785
|
return t;
|
|
766
|
-
},
|
|
767
|
-
const { isAuthenticated: t } = Ce(), { setShowAlert: n, setTypeAlert:
|
|
768
|
-
return
|
|
769
|
-
!t && !
|
|
786
|
+
}, gr = () => {
|
|
787
|
+
const { isAuthenticated: t } = Ce(), { setShowAlert: n, setTypeAlert: o, setMessageAlert: s } = G(), c = localStorage.getItem("accessToken");
|
|
788
|
+
return U(() => {
|
|
789
|
+
!t && !c && (n(!0), o("danger"), s("Non sei autorizzato"));
|
|
770
790
|
}, []), t === null ? null : t ? /* @__PURE__ */ i.jsx(rt, {}) : /* @__PURE__ */ i.jsx(Lt, { to: "/" });
|
|
771
791
|
};
|
|
772
792
|
var it = {
|
|
@@ -775,129 +795,129 @@ var it = {
|
|
|
775
795
|
className: void 0,
|
|
776
796
|
style: void 0,
|
|
777
797
|
attr: void 0
|
|
778
|
-
}, Xe =
|
|
798
|
+
}, Xe = z.createContext && /* @__PURE__ */ z.createContext(it), Ut = ["attr", "size", "title"];
|
|
779
799
|
function Yt(t, n) {
|
|
780
800
|
if (t == null) return {};
|
|
781
|
-
var
|
|
801
|
+
var o = qt(t, n), s, c;
|
|
782
802
|
if (Object.getOwnPropertySymbols) {
|
|
783
|
-
var
|
|
784
|
-
for (
|
|
785
|
-
s =
|
|
803
|
+
var u = Object.getOwnPropertySymbols(t);
|
|
804
|
+
for (c = 0; c < u.length; c++)
|
|
805
|
+
s = u[c], !(n.indexOf(s) >= 0) && Object.prototype.propertyIsEnumerable.call(t, s) && (o[s] = t[s]);
|
|
786
806
|
}
|
|
787
|
-
return
|
|
807
|
+
return o;
|
|
788
808
|
}
|
|
789
|
-
function
|
|
809
|
+
function qt(t, n) {
|
|
790
810
|
if (t == null) return {};
|
|
791
|
-
var
|
|
811
|
+
var o = {};
|
|
792
812
|
for (var s in t)
|
|
793
813
|
if (Object.prototype.hasOwnProperty.call(t, s)) {
|
|
794
814
|
if (n.indexOf(s) >= 0) continue;
|
|
795
|
-
|
|
815
|
+
o[s] = t[s];
|
|
796
816
|
}
|
|
797
|
-
return
|
|
817
|
+
return o;
|
|
798
818
|
}
|
|
799
|
-
function
|
|
800
|
-
return
|
|
819
|
+
function le() {
|
|
820
|
+
return le = Object.assign ? Object.assign.bind() : function(t) {
|
|
801
821
|
for (var n = 1; n < arguments.length; n++) {
|
|
802
|
-
var
|
|
803
|
-
for (var s in
|
|
804
|
-
Object.prototype.hasOwnProperty.call(
|
|
822
|
+
var o = arguments[n];
|
|
823
|
+
for (var s in o)
|
|
824
|
+
Object.prototype.hasOwnProperty.call(o, s) && (t[s] = o[s]);
|
|
805
825
|
}
|
|
806
826
|
return t;
|
|
807
|
-
},
|
|
827
|
+
}, le.apply(this, arguments);
|
|
808
828
|
}
|
|
809
829
|
function Ze(t, n) {
|
|
810
|
-
var
|
|
830
|
+
var o = Object.keys(t);
|
|
811
831
|
if (Object.getOwnPropertySymbols) {
|
|
812
832
|
var s = Object.getOwnPropertySymbols(t);
|
|
813
|
-
n && (s = s.filter(function(
|
|
814
|
-
return Object.getOwnPropertyDescriptor(t,
|
|
815
|
-
})),
|
|
833
|
+
n && (s = s.filter(function(c) {
|
|
834
|
+
return Object.getOwnPropertyDescriptor(t, c).enumerable;
|
|
835
|
+
})), o.push.apply(o, s);
|
|
816
836
|
}
|
|
817
|
-
return
|
|
837
|
+
return o;
|
|
818
838
|
}
|
|
819
|
-
function
|
|
839
|
+
function ce(t) {
|
|
820
840
|
for (var n = 1; n < arguments.length; n++) {
|
|
821
|
-
var
|
|
822
|
-
n % 2 ? Ze(Object(
|
|
823
|
-
|
|
824
|
-
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(
|
|
825
|
-
Object.defineProperty(t, s, Object.getOwnPropertyDescriptor(
|
|
841
|
+
var o = arguments[n] != null ? arguments[n] : {};
|
|
842
|
+
n % 2 ? Ze(Object(o), !0).forEach(function(s) {
|
|
843
|
+
Jt(t, s, o[s]);
|
|
844
|
+
}) : Object.getOwnPropertyDescriptors ? Object.defineProperties(t, Object.getOwnPropertyDescriptors(o)) : Ze(Object(o)).forEach(function(s) {
|
|
845
|
+
Object.defineProperty(t, s, Object.getOwnPropertyDescriptor(o, s));
|
|
826
846
|
});
|
|
827
847
|
}
|
|
828
848
|
return t;
|
|
829
849
|
}
|
|
830
|
-
function
|
|
831
|
-
return n =
|
|
850
|
+
function Jt(t, n, o) {
|
|
851
|
+
return n = Kt(n), n in t ? Object.defineProperty(t, n, { value: o, enumerable: !0, configurable: !0, writable: !0 }) : t[n] = o, t;
|
|
832
852
|
}
|
|
833
|
-
function
|
|
834
|
-
var n =
|
|
853
|
+
function Kt(t) {
|
|
854
|
+
var n = Gt(t, "string");
|
|
835
855
|
return typeof n == "symbol" ? n : n + "";
|
|
836
856
|
}
|
|
837
|
-
function
|
|
857
|
+
function Gt(t, n) {
|
|
838
858
|
if (typeof t != "object" || !t) return t;
|
|
839
|
-
var
|
|
840
|
-
if (
|
|
841
|
-
var s =
|
|
859
|
+
var o = t[Symbol.toPrimitive];
|
|
860
|
+
if (o !== void 0) {
|
|
861
|
+
var s = o.call(t, n || "default");
|
|
842
862
|
if (typeof s != "object") return s;
|
|
843
863
|
throw new TypeError("@@toPrimitive must return a primitive value.");
|
|
844
864
|
}
|
|
845
865
|
return (n === "string" ? String : Number)(t);
|
|
846
866
|
}
|
|
847
867
|
function lt(t) {
|
|
848
|
-
return t && t.map((n,
|
|
849
|
-
key:
|
|
868
|
+
return t && t.map((n, o) => /* @__PURE__ */ z.createElement(n.tag, ce({
|
|
869
|
+
key: o
|
|
850
870
|
}, n.attr), lt(n.child)));
|
|
851
871
|
}
|
|
852
|
-
function
|
|
853
|
-
return (n) => /* @__PURE__ */
|
|
854
|
-
attr:
|
|
872
|
+
function ee(t) {
|
|
873
|
+
return (n) => /* @__PURE__ */ z.createElement(Ht, le({
|
|
874
|
+
attr: ce({}, t.attr)
|
|
855
875
|
}, n), lt(t.child));
|
|
856
876
|
}
|
|
857
|
-
function
|
|
858
|
-
var n = (
|
|
877
|
+
function Ht(t) {
|
|
878
|
+
var n = (o) => {
|
|
859
879
|
var {
|
|
860
880
|
attr: s,
|
|
861
|
-
size:
|
|
862
|
-
title:
|
|
863
|
-
} = t,
|
|
864
|
-
return
|
|
881
|
+
size: c,
|
|
882
|
+
title: u
|
|
883
|
+
} = t, v = Yt(t, Ut), g = c || o.size || "1em", f;
|
|
884
|
+
return o.className && (f = o.className), t.className && (f = (f ? f + " " : "") + t.className), /* @__PURE__ */ z.createElement("svg", le({
|
|
865
885
|
stroke: "currentColor",
|
|
866
886
|
fill: "currentColor",
|
|
867
887
|
strokeWidth: "0"
|
|
868
|
-
},
|
|
869
|
-
className:
|
|
870
|
-
style:
|
|
871
|
-
color: t.color ||
|
|
872
|
-
},
|
|
873
|
-
height:
|
|
874
|
-
width:
|
|
888
|
+
}, o.attr, s, v, {
|
|
889
|
+
className: f,
|
|
890
|
+
style: ce(ce({
|
|
891
|
+
color: t.color || o.color
|
|
892
|
+
}, o.style), t.style),
|
|
893
|
+
height: g,
|
|
894
|
+
width: g,
|
|
875
895
|
xmlns: "http://www.w3.org/2000/svg"
|
|
876
|
-
}),
|
|
896
|
+
}), u && /* @__PURE__ */ z.createElement("title", null, u), t.children);
|
|
877
897
|
};
|
|
878
|
-
return Xe !== void 0 ? /* @__PURE__ */
|
|
898
|
+
return Xe !== void 0 ? /* @__PURE__ */ z.createElement(Xe.Consumer, null, (o) => n(o)) : n(it);
|
|
879
899
|
}
|
|
880
|
-
function
|
|
881
|
-
return
|
|
900
|
+
function Xt(t) {
|
|
901
|
+
return ee({ tag: "svg", attr: { version: "1.1", viewBox: "0 0 16 16" }, child: [{ tag: "path", attr: { d: "M8 0c-4.355 0-7.898 3.481-7.998 7.812 0.092-3.779 2.966-6.812 6.498-6.812 3.59 0 6.5 3.134 6.5 7 0 0.828 0.672 1.5 1.5 1.5s1.5-0.672 1.5-1.5c0-4.418-3.582-8-8-8zM8 16c4.355 0 7.898-3.481 7.998-7.812-0.092 3.779-2.966 6.812-6.498 6.812-3.59 0-6.5-3.134-6.5-7 0-0.828-0.672-1.5-1.5-1.5s-1.5 0.672-1.5 1.5c0 4.418 3.582 8 8 8z" }, child: [] }] })(t);
|
|
882
902
|
}
|
|
883
|
-
const
|
|
884
|
-
/* @__PURE__ */ i.jsx(
|
|
903
|
+
const Zt = () => /* @__PURE__ */ i.jsxs("div", { className: "fixed top-0 bottom-0 left-0 right-0 flex items-center justify-center bg-[#00000080]", children: [
|
|
904
|
+
/* @__PURE__ */ i.jsx(Xt, { className: "text-[20rem] relative animate-spin text-white" }),
|
|
885
905
|
/* @__PURE__ */ i.jsx("p", { className: "text-white text-2xl select-none absolute", children: "Loading..." })
|
|
886
906
|
] });
|
|
887
|
-
function Zt(t) {
|
|
888
|
-
return re({ 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: [] }] })(t);
|
|
889
|
-
}
|
|
890
907
|
function Qt(t) {
|
|
891
|
-
return
|
|
908
|
+
return ee({ 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: [] }] })(t);
|
|
892
909
|
}
|
|
893
910
|
function er(t) {
|
|
894
|
-
return
|
|
911
|
+
return ee({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M512 64C264.6 64 64 264.6 64 512s200.6 448 448 448 448-200.6 448-448S759.4 64 512 64zm32 664c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V456c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v272zm-32-344a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z" }, child: [] }] })(t);
|
|
895
912
|
}
|
|
896
913
|
function tr(t) {
|
|
897
|
-
return
|
|
914
|
+
return ee({ tag: "svg", attr: { viewBox: "0 0 1024 1024" }, child: [{ tag: "path", attr: { d: "M955.7 856l-416-720c-6.2-10.7-16.9-16-27.7-16s-21.6 5.3-27.7 16l-416 720C56 877.4 71.4 904 96 904h832c24.6 0 40-26.6 27.7-48zM480 416c0-4.4 3.6-8 8-8h48c4.4 0 8 3.6 8 8v184c0 4.4-3.6 8-8 8h-48c-4.4 0-8-3.6-8-8V416zm32 352a48.01 48.01 0 0 1 0-96 48.01 48.01 0 0 1 0 96z" }, child: [] }] })(t);
|
|
915
|
+
}
|
|
916
|
+
function rr(t) {
|
|
917
|
+
return ee({ 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: [] }] })(t);
|
|
898
918
|
}
|
|
899
|
-
const
|
|
900
|
-
const { showAlert: t, setShowAlert: n, messageAlert:
|
|
919
|
+
const nr = () => {
|
|
920
|
+
const { showAlert: t, setShowAlert: n, messageAlert: o, typeAlert: s } = G(), { alertTimeout: c } = de(), [u, v] = S(0), g = {
|
|
901
921
|
danger: {
|
|
902
922
|
bgColor: "bg-red-50",
|
|
903
923
|
textColor: "text-red-700",
|
|
@@ -922,119 +942,99 @@ const rr = () => {
|
|
|
922
942
|
focusRing: "focus:ring-green-400",
|
|
923
943
|
progressColor: "bg-green-400"
|
|
924
944
|
}
|
|
925
|
-
}, { bgColor:
|
|
926
|
-
switch (
|
|
945
|
+
}, { bgColor: f, textColor: b, buttonBg: j, hoverBg: w, focusRing: C, progressColor: _ } = g[s], k = (O) => {
|
|
946
|
+
switch (O) {
|
|
927
947
|
case "danger":
|
|
928
|
-
return /* @__PURE__ */ i.jsx(
|
|
948
|
+
return /* @__PURE__ */ i.jsx(tr, { className: "text-xl" });
|
|
929
949
|
case "info":
|
|
930
|
-
return /* @__PURE__ */ i.jsx(
|
|
950
|
+
return /* @__PURE__ */ i.jsx(er, { className: "text-xl" });
|
|
931
951
|
case "success":
|
|
932
|
-
return /* @__PURE__ */ i.jsx(
|
|
952
|
+
return /* @__PURE__ */ i.jsx(rr, { className: "text-xl" });
|
|
933
953
|
}
|
|
934
|
-
},
|
|
954
|
+
}, $ = () => {
|
|
935
955
|
n(!t);
|
|
936
956
|
};
|
|
937
|
-
return
|
|
938
|
-
let
|
|
939
|
-
const
|
|
940
|
-
|
|
941
|
-
|
|
957
|
+
return U(() => {
|
|
958
|
+
let O;
|
|
959
|
+
const y = 100 / (c / 100);
|
|
960
|
+
O = setInterval(() => {
|
|
961
|
+
v((D) => D >= 100 ? (clearInterval(O), 100) : D + y);
|
|
942
962
|
}, 100);
|
|
943
|
-
const
|
|
944
|
-
|
|
945
|
-
},
|
|
963
|
+
const N = setTimeout(() => {
|
|
964
|
+
$();
|
|
965
|
+
}, c);
|
|
946
966
|
return () => {
|
|
947
|
-
clearTimeout(
|
|
967
|
+
clearTimeout(N), clearInterval(O);
|
|
948
968
|
};
|
|
949
|
-
}, []), /* @__PURE__ */ i.jsxs("div", { className: `flex items-center p-4 pt-6 ${
|
|
950
|
-
/* @__PURE__ */ i.jsx("div", { className: "w-full bg-gray-200 rounded-t-lg overflow-hidden h-2.5 dark:bg-gray-700 absolute top-0 left-0 right-0", children: /* @__PURE__ */ i.jsx("div", { className: `${
|
|
951
|
-
|
|
952
|
-
/* @__PURE__ */ i.jsx("div", { className: "px-4 text-sm font-medium", children:
|
|
969
|
+
}, []), /* @__PURE__ */ i.jsxs("div", { className: `flex items-center p-4 pt-6 ${b} rounded-lg ${f} mx-auto fixed top-[calc(100vh-100px)] right-10`, role: "alert", children: [
|
|
970
|
+
/* @__PURE__ */ i.jsx("div", { className: "w-full bg-gray-200 rounded-t-lg overflow-hidden h-2.5 dark:bg-gray-700 absolute top-0 left-0 right-0", children: /* @__PURE__ */ i.jsx("div", { className: `${_} h-2.5 rounded-t-lg`, style: { width: `${u}%` } }) }),
|
|
971
|
+
k(s),
|
|
972
|
+
/* @__PURE__ */ i.jsx("div", { className: "px-4 text-sm font-medium", children: o }),
|
|
953
973
|
/* @__PURE__ */ i.jsx(
|
|
954
974
|
"button",
|
|
955
975
|
{
|
|
956
976
|
type: "button",
|
|
957
|
-
className: `ms-auto ${
|
|
977
|
+
className: `ms-auto ${j} rounded-lg focus:ring-2 ${C} p-1.5 ${w} inline-flex items-center justify-center h-8 w-8`,
|
|
958
978
|
title: "Close",
|
|
959
|
-
onClick:
|
|
960
|
-
children: /* @__PURE__ */ i.jsx(
|
|
979
|
+
onClick: $,
|
|
980
|
+
children: /* @__PURE__ */ i.jsx(Qt, { className: "text-xl" })
|
|
961
981
|
}
|
|
962
982
|
)
|
|
963
983
|
] });
|
|
964
|
-
},
|
|
984
|
+
}, vr = () => {
|
|
965
985
|
const { isLoading: t } = Ee(), { showAlert: n } = G();
|
|
966
986
|
return /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
|
|
967
|
-
t && /* @__PURE__ */ i.jsx(
|
|
987
|
+
t && /* @__PURE__ */ i.jsx(Zt, {}),
|
|
968
988
|
/* @__PURE__ */ i.jsxs("main", { className: t ? "hidden" : "", children: [
|
|
969
|
-
n && /* @__PURE__ */ i.jsx(
|
|
989
|
+
n && /* @__PURE__ */ i.jsx(nr, {}),
|
|
970
990
|
/* @__PURE__ */ i.jsx(rt, {})
|
|
971
991
|
] })
|
|
972
992
|
] });
|
|
973
993
|
}, Qe = (t) => {
|
|
974
994
|
const {
|
|
975
995
|
inputType: n,
|
|
976
|
-
inputId:
|
|
996
|
+
inputId: o,
|
|
977
997
|
inputPlaceholder: s,
|
|
978
|
-
inputRequired:
|
|
979
|
-
inputValue:
|
|
980
|
-
inputChange:
|
|
981
|
-
} = t,
|
|
998
|
+
inputRequired: c,
|
|
999
|
+
inputValue: u,
|
|
1000
|
+
inputChange: v
|
|
1001
|
+
} = t, f = ["text", "email", "password", "search", "tel", "url"].includes(n) ? n : "text";
|
|
982
1002
|
return /* @__PURE__ */ i.jsx(
|
|
983
1003
|
"input",
|
|
984
1004
|
{
|
|
985
|
-
type:
|
|
986
|
-
id:
|
|
1005
|
+
type: f,
|
|
1006
|
+
id: o,
|
|
987
1007
|
className: "bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5",
|
|
988
1008
|
placeholder: s,
|
|
989
|
-
required:
|
|
990
|
-
value:
|
|
991
|
-
onChange:
|
|
1009
|
+
required: c ?? !0,
|
|
1010
|
+
value: u,
|
|
1011
|
+
onChange: v
|
|
992
1012
|
}
|
|
993
1013
|
);
|
|
994
|
-
}, et = ({ label: t, labelId: n, labelStyle:
|
|
1014
|
+
}, et = ({ label: t, labelId: n, labelStyle: o }) => /* @__PURE__ */ i.jsx("label", { htmlFor: n, className: `${o ?? "block mb-2 text-sm font-medium text-gray-900"}`, children: t }), or = (t) => {
|
|
995
1015
|
const {
|
|
996
|
-
|
|
997
|
-
|
|
998
|
-
|
|
999
|
-
|
|
1000
|
-
|
|
1001
|
-
|
|
1002
|
-
|
|
1003
|
-
|
|
1004
|
-
formShadow: v = "shadow-lg",
|
|
1005
|
-
// Input email/username
|
|
1006
|
-
userData: c,
|
|
1007
|
-
userLabel: y = "Email",
|
|
1008
|
-
userType: w = "email",
|
|
1009
|
-
userPlaceholder: h = "email@email.it",
|
|
1010
|
-
// Titolo
|
|
1011
|
-
formTitle: E = "Login",
|
|
1012
|
-
titleSize: T = "text-4xl",
|
|
1013
|
-
titlePosition: N = "text-center",
|
|
1014
|
-
titleSpacing: L = "my-12",
|
|
1015
|
-
// Bottone
|
|
1016
|
-
buttonPosition: P = "justify-center",
|
|
1017
|
-
buttonSpacing: b = "my-12",
|
|
1018
|
-
buttonColor: j = "bg-blue-500",
|
|
1019
|
-
buttonHoverColor: D = "hoverbg-blue-700",
|
|
1020
|
-
buttonTextColor: I = "text-white",
|
|
1021
|
-
buttonSize: H = "py-2 px-4",
|
|
1022
|
-
buttonRounded: X = "rounded-full",
|
|
1023
|
-
buttonText: _ = "Login"
|
|
1016
|
+
formStyle: n,
|
|
1017
|
+
userData: o,
|
|
1018
|
+
userInput: s,
|
|
1019
|
+
title: c,
|
|
1020
|
+
buttonStyle: u,
|
|
1021
|
+
formData: v,
|
|
1022
|
+
changeValue: g,
|
|
1023
|
+
submitForm: f
|
|
1024
1024
|
} = t;
|
|
1025
|
-
return /* @__PURE__ */ i.jsxs("form", { onSubmit:
|
|
1026
|
-
/* @__PURE__ */ i.jsx("h1", { className: `${
|
|
1025
|
+
return /* @__PURE__ */ i.jsxs("form", { onSubmit: f, className: `${n.size} ${n.rounded} ${n.shadow} ${n.bgColor}`, children: [
|
|
1026
|
+
/* @__PURE__ */ i.jsx("h1", { className: `${c.size} ${c.position} ${c.spacing}`, children: c.text }),
|
|
1027
1027
|
/* @__PURE__ */ i.jsxs("div", { className: "flex justify-center flex-col gap-1 my-4 w-1/2 mx-auto", children: [
|
|
1028
|
-
/* @__PURE__ */ i.jsx(et, { labelId: "user-email", label:
|
|
1028
|
+
/* @__PURE__ */ i.jsx(et, { labelId: "user-email", label: s.label }),
|
|
1029
1029
|
/* @__PURE__ */ i.jsx(
|
|
1030
1030
|
Qe,
|
|
1031
1031
|
{
|
|
1032
|
-
inputType:
|
|
1032
|
+
inputType: s.label,
|
|
1033
1033
|
inputId: "user-email",
|
|
1034
|
-
inputPlaceholder:
|
|
1035
|
-
inputValue:
|
|
1036
|
-
inputChange: (
|
|
1037
|
-
|
|
1034
|
+
inputPlaceholder: s.placeholder,
|
|
1035
|
+
inputValue: o ? v[o] : v.email,
|
|
1036
|
+
inputChange: (b) => {
|
|
1037
|
+
g(o || "email", b.target.value);
|
|
1038
1038
|
}
|
|
1039
1039
|
}
|
|
1040
1040
|
)
|
|
@@ -1047,88 +1047,122 @@ const rr = () => {
|
|
|
1047
1047
|
inputType: "password",
|
|
1048
1048
|
inputId: "password",
|
|
1049
1049
|
inputPlaceholder: "Password",
|
|
1050
|
-
inputValue:
|
|
1051
|
-
inputChange: (
|
|
1052
|
-
|
|
1050
|
+
inputValue: v.password,
|
|
1051
|
+
inputChange: (b) => {
|
|
1052
|
+
g("password", b.target.value);
|
|
1053
1053
|
}
|
|
1054
1054
|
}
|
|
1055
1055
|
)
|
|
1056
1056
|
] }),
|
|
1057
|
-
/* @__PURE__ */ i.jsx("div", { className: `flex ${
|
|
1057
|
+
/* @__PURE__ */ i.jsx("div", { className: `flex ${u.position} items-center ${u.spacing}`, children: /* @__PURE__ */ i.jsx("button", { className: `${u.color} ${u.hoverColor} ${u.textColor} font-bold ${u.size} ${u.rounded}`, children: u.text }) })
|
|
1058
1058
|
] });
|
|
1059
|
-
},
|
|
1060
|
-
const {
|
|
1059
|
+
}, pr = (t) => {
|
|
1060
|
+
const {
|
|
1061
|
+
formStyle: n = {
|
|
1062
|
+
size: "w-[800px]",
|
|
1063
|
+
bgColor: "bg-slate-50",
|
|
1064
|
+
rounded: "rounded-lg",
|
|
1065
|
+
shadow: "shadow-lg"
|
|
1066
|
+
},
|
|
1067
|
+
userData: o,
|
|
1068
|
+
userInput: s = {
|
|
1069
|
+
label: "Email",
|
|
1070
|
+
type: "email",
|
|
1071
|
+
placeholder: "email@email.it"
|
|
1072
|
+
},
|
|
1073
|
+
title: c = {
|
|
1074
|
+
text: "Login",
|
|
1075
|
+
size: "text-4xl",
|
|
1076
|
+
position: "text-center",
|
|
1077
|
+
spacing: "my-12"
|
|
1078
|
+
},
|
|
1079
|
+
buttonStyle: u = {
|
|
1080
|
+
position: "justify-center",
|
|
1081
|
+
spacing: "my-12",
|
|
1082
|
+
color: "bg-blue-500",
|
|
1083
|
+
hoverColor: "hover:bg-blue-700",
|
|
1084
|
+
textColor: "text-white",
|
|
1085
|
+
size: "py-2 px-4",
|
|
1086
|
+
rounded: "rounded-full",
|
|
1087
|
+
text: "Login"
|
|
1088
|
+
}
|
|
1089
|
+
} = t, { login: v } = Ce(), { setShowAlert: g, setTypeAlert: f, setMessageAlert: b } = G(), { clearLoginFormOnError: j } = de(), w = tt(), C = {
|
|
1061
1090
|
email: "",
|
|
1062
1091
|
password: ""
|
|
1063
|
-
}, [
|
|
1064
|
-
|
|
1065
|
-
},
|
|
1066
|
-
|
|
1092
|
+
}, [_, k] = S(C), $ = (h, y) => {
|
|
1093
|
+
k((N) => ({ ...N, [h]: y }));
|
|
1094
|
+
}, O = (h) => {
|
|
1095
|
+
v(h, _), j && k(C);
|
|
1067
1096
|
};
|
|
1068
|
-
return
|
|
1097
|
+
return U(() => {
|
|
1069
1098
|
const h = localStorage.getItem("id");
|
|
1070
|
-
localStorage.getItem("accessToken") && h && (
|
|
1099
|
+
localStorage.getItem("accessToken") && h && (w(`/dashboard/${h}`), g(!0), f("info"), b("Sei già loggato"));
|
|
1071
1100
|
}, []), /* @__PURE__ */ i.jsx("section", { children: /* @__PURE__ */ i.jsx("div", { className: "container mx-auto flex items-center justify-center h-screen", children: /* @__PURE__ */ i.jsx(
|
|
1072
|
-
|
|
1101
|
+
or,
|
|
1073
1102
|
{
|
|
1074
|
-
submitForm:
|
|
1075
|
-
formData:
|
|
1076
|
-
changeValue:
|
|
1103
|
+
submitForm: O,
|
|
1104
|
+
formData: _,
|
|
1105
|
+
changeValue: $,
|
|
1106
|
+
formStyle: n,
|
|
1107
|
+
userData: o,
|
|
1108
|
+
userInput: s,
|
|
1109
|
+
title: c,
|
|
1110
|
+
buttonStyle: u
|
|
1077
1111
|
}
|
|
1078
1112
|
) }) });
|
|
1079
|
-
},
|
|
1080
|
-
const { id: t } = Ft(), { logout: n, setCurrentToken:
|
|
1113
|
+
}, hr = () => {
|
|
1114
|
+
const { id: t } = Ft(), { logout: n, setCurrentToken: o } = Ce(), { usersEndpoint: s } = de(), { setIsLoading: c } = Ee(), { setShowAlert: u, setTypeAlert: v, setMessageAlert: g } = G(), [f, b] = S({}), [j, w] = S(null), [C, _] = S(!1), k = async () => {
|
|
1081
1115
|
try {
|
|
1082
|
-
|
|
1083
|
-
const
|
|
1084
|
-
if (!
|
|
1085
|
-
n(),
|
|
1116
|
+
c(!0);
|
|
1117
|
+
const h = localStorage.getItem("accessToken");
|
|
1118
|
+
if (!h) {
|
|
1119
|
+
n(), u(!0), v("danger"), g("Sessione scaduta");
|
|
1086
1120
|
return;
|
|
1087
1121
|
}
|
|
1088
|
-
|
|
1089
|
-
const
|
|
1122
|
+
o(h);
|
|
1123
|
+
const D = (await (await ie(u, v, g)).get(
|
|
1090
1124
|
`${s}${t}`,
|
|
1091
1125
|
{ headers: {
|
|
1092
|
-
Authorization:
|
|
1126
|
+
Authorization: h
|
|
1093
1127
|
} }
|
|
1094
1128
|
)).data;
|
|
1095
|
-
|
|
1096
|
-
} catch (
|
|
1097
|
-
console.error(
|
|
1129
|
+
b(D), c(!1);
|
|
1130
|
+
} catch (h) {
|
|
1131
|
+
console.error(h), c(!1), n();
|
|
1098
1132
|
}
|
|
1099
|
-
},
|
|
1133
|
+
}, $ = async () => {
|
|
1100
1134
|
try {
|
|
1101
|
-
|
|
1102
|
-
const
|
|
1103
|
-
if (!
|
|
1104
|
-
n(),
|
|
1135
|
+
_(!0);
|
|
1136
|
+
const h = localStorage.getItem("accessToken");
|
|
1137
|
+
if (!h) {
|
|
1138
|
+
n(), u(!0), v("danger"), g("Sessione scaduta");
|
|
1105
1139
|
return;
|
|
1106
1140
|
}
|
|
1107
|
-
const
|
|
1141
|
+
const D = (await (await ie(u, v, g)).get(
|
|
1108
1142
|
`${s}`,
|
|
1109
1143
|
{ headers: {
|
|
1110
|
-
Authorization:
|
|
1144
|
+
Authorization: h
|
|
1111
1145
|
} }
|
|
1112
1146
|
)).data;
|
|
1113
|
-
|
|
1114
|
-
} catch (
|
|
1115
|
-
console.error(
|
|
1147
|
+
w(D), D && _(!1);
|
|
1148
|
+
} catch (h) {
|
|
1149
|
+
console.error(h), c(!1), h.status === 401 && n(), _(!1);
|
|
1116
1150
|
}
|
|
1117
|
-
},
|
|
1118
|
-
n(),
|
|
1151
|
+
}, O = () => {
|
|
1152
|
+
n(), u(!0), v("info"), g("Hai effettuato il logout");
|
|
1119
1153
|
};
|
|
1120
|
-
return
|
|
1121
|
-
|
|
1154
|
+
return U(() => {
|
|
1155
|
+
k();
|
|
1122
1156
|
}, []), /* @__PURE__ */ i.jsx("section", { children: /* @__PURE__ */ i.jsxs("div", { className: "container mx-auto py-8", children: [
|
|
1123
1157
|
/* @__PURE__ */ i.jsxs("div", { className: "flex items-center justify-center gap-8 h-20", children: [
|
|
1124
1158
|
/* @__PURE__ */ i.jsxs("h1", { className: "text-4xl text-center text-slate-800", children: [
|
|
1125
1159
|
"Email: ",
|
|
1126
|
-
|
|
1160
|
+
f.email
|
|
1127
1161
|
] }),
|
|
1128
1162
|
/* @__PURE__ */ i.jsx(
|
|
1129
1163
|
"button",
|
|
1130
1164
|
{
|
|
1131
|
-
onClick:
|
|
1165
|
+
onClick: O,
|
|
1132
1166
|
className: "bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded-full",
|
|
1133
1167
|
children: "Logout"
|
|
1134
1168
|
}
|
|
@@ -1137,32 +1171,33 @@ const rr = () => {
|
|
|
1137
1171
|
/* @__PURE__ */ i.jsx("div", { className: "flex justify-center items-center my-12", children: /* @__PURE__ */ i.jsx(
|
|
1138
1172
|
"button",
|
|
1139
1173
|
{
|
|
1140
|
-
onClick:
|
|
1174
|
+
onClick: $,
|
|
1141
1175
|
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",
|
|
1142
|
-
disabled:
|
|
1176
|
+
disabled: C,
|
|
1143
1177
|
children: "Lista degli utenti"
|
|
1144
1178
|
}
|
|
1145
1179
|
) }),
|
|
1146
|
-
/* @__PURE__ */ i.jsx("div", { className: "flex justify-center items-center", children:
|
|
1147
|
-
|
|
1180
|
+
/* @__PURE__ */ i.jsx("div", { className: "flex justify-center items-center", children: j && /* @__PURE__ */ i.jsx("ul", { children: j.map((h) => /* @__PURE__ */ i.jsxs("li", { className: "text-xl my-4", children: [
|
|
1181
|
+
h.id,
|
|
1148
1182
|
" - ",
|
|
1149
|
-
|
|
1150
|
-
] }, `user-${
|
|
1183
|
+
h.email
|
|
1184
|
+
] }, `user-${h.id}`)) }) })
|
|
1151
1185
|
] }) });
|
|
1152
1186
|
};
|
|
1153
1187
|
export {
|
|
1154
|
-
|
|
1155
|
-
|
|
1156
|
-
|
|
1157
|
-
|
|
1158
|
-
|
|
1159
|
-
|
|
1160
|
-
|
|
1188
|
+
nr as Alert,
|
|
1189
|
+
fr as AlertProvider,
|
|
1190
|
+
gr as AuthPage,
|
|
1191
|
+
dr as AuthProvider,
|
|
1192
|
+
ur as ConfigProvider,
|
|
1193
|
+
hr as Dashboard,
|
|
1194
|
+
vr as DefaultLayout,
|
|
1195
|
+
Bt as ErrorPage,
|
|
1161
1196
|
Qe as Input,
|
|
1162
1197
|
et as InputLabel,
|
|
1163
|
-
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
|
|
1167
|
-
|
|
1198
|
+
Zt as Loading,
|
|
1199
|
+
cr as LoadingProvider,
|
|
1200
|
+
pr as Login,
|
|
1201
|
+
or as LoginForm,
|
|
1202
|
+
ie as fetchAxiosConfig
|
|
1168
1203
|
};
|