thecore-auth 0.0.38 → 0.0.40
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 +11 -11
- package/dist/thecore-auth.esm.js +328 -330
- package/package.json +2 -1
package/dist/thecore-auth.esm.js
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import z, { createContext as
|
|
1
|
+
import z, { createContext as de, useState as P, useContext as ge, useEffect as V } from "react";
|
|
2
2
|
import $t from "jwt-decode";
|
|
3
|
-
import { useNavigate as tt, Outlet as rt, Navigate as
|
|
3
|
+
import { useNavigate as tt, Outlet as rt, Navigate as Ft, useParams as Lt } from "react-router-dom";
|
|
4
4
|
import zt from "axios";
|
|
5
|
-
var
|
|
5
|
+
var le = { exports: {} }, ee = {};
|
|
6
6
|
/**
|
|
7
7
|
* @license React
|
|
8
8
|
* react-jsx-runtime.production.min.js
|
|
@@ -14,19 +14,19 @@ var se = { exports: {} }, Z = {};
|
|
|
14
14
|
*/
|
|
15
15
|
var Ke;
|
|
16
16
|
function Mt() {
|
|
17
|
-
if (Ke) return
|
|
17
|
+
if (Ke) return ee;
|
|
18
18
|
Ke = 1;
|
|
19
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,
|
|
21
|
-
var j, w = {},
|
|
22
|
-
|
|
20
|
+
function v(g, f, m) {
|
|
21
|
+
var j, w = {}, R = null, _ = null;
|
|
22
|
+
m !== void 0 && (R = "" + m), f.key !== void 0 && (R = "" + f.key), f.ref !== void 0 && (_ = f.ref);
|
|
23
23
|
for (j in f) s.call(f, j) && !u.hasOwnProperty(j) && (w[j] = f[j]);
|
|
24
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:
|
|
25
|
+
return { $$typeof: n, type: g, key: R, ref: _, props: w, _owner: c.current };
|
|
26
26
|
}
|
|
27
|
-
return
|
|
27
|
+
return ee.Fragment = o, ee.jsx = v, ee.jsxs = v, ee;
|
|
28
28
|
}
|
|
29
|
-
var
|
|
29
|
+
var te = {};
|
|
30
30
|
/**
|
|
31
31
|
* @license React
|
|
32
32
|
* react-jsx-runtime.development.js
|
|
@@ -39,48 +39,48 @@ var Q = {};
|
|
|
39
39
|
var Ge;
|
|
40
40
|
function Wt() {
|
|
41
41
|
return Ge || (Ge = 1, process.env.NODE_ENV !== "production" && 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"),
|
|
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"), m = Symbol.for("react.suspense"), j = Symbol.for("react.suspense_list"), w = Symbol.for("react.memo"), R = Symbol.for("react.lazy"), _ = Symbol.for("react.offscreen"), I = Symbol.iterator, D = "@@iterator";
|
|
43
|
+
function S(e) {
|
|
44
44
|
if (e === null || typeof e != "object")
|
|
45
45
|
return null;
|
|
46
|
-
var r =
|
|
46
|
+
var r = I && e[I] || e[D];
|
|
47
47
|
return typeof r == "function" ? r : null;
|
|
48
48
|
}
|
|
49
|
-
var
|
|
49
|
+
var b = t.__SECRET_INTERNALS_DO_NOT_USE_OR_YOU_WILL_BE_FIRED;
|
|
50
50
|
function y(e) {
|
|
51
51
|
{
|
|
52
52
|
for (var r = arguments.length, a = new Array(r > 1 ? r - 1 : 0), l = 1; l < r; l++)
|
|
53
53
|
a[l - 1] = arguments[l];
|
|
54
|
-
|
|
54
|
+
$("error", e, a);
|
|
55
55
|
}
|
|
56
56
|
}
|
|
57
|
-
function
|
|
57
|
+
function $(e, r, a) {
|
|
58
58
|
{
|
|
59
|
-
var l =
|
|
60
|
-
|
|
59
|
+
var l = b.ReactDebugCurrentFrame, h = l.getStackAddendum();
|
|
60
|
+
h !== "" && (r += "%s", a = a.concat([h]));
|
|
61
61
|
var x = a.map(function(p) {
|
|
62
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
|
|
67
|
+
var T = !1, Y = !1, X = !1, A = !1, F = !1, M;
|
|
68
68
|
M = Symbol.for("react.module.reference");
|
|
69
|
-
function
|
|
70
|
-
return !!(typeof e == "string" || typeof e == "function" || e === s || e === u ||
|
|
69
|
+
function L(e) {
|
|
70
|
+
return !!(typeof e == "string" || typeof e == "function" || e === s || e === u || F || e === c || e === m || e === j || A || e === _ || T || Y || X || typeof e == "object" && e !== null && (e.$$typeof === R || 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
74
|
e.$$typeof === M || e.getModuleId !== void 0));
|
|
75
75
|
}
|
|
76
|
-
function
|
|
76
|
+
function ne(e, r, a) {
|
|
77
77
|
var l = e.displayName;
|
|
78
78
|
if (l)
|
|
79
79
|
return l;
|
|
80
|
-
var
|
|
81
|
-
return
|
|
80
|
+
var h = r.displayName || r.name || "";
|
|
81
|
+
return h !== "" ? a + "(" + h + ")" : a;
|
|
82
82
|
}
|
|
83
|
-
function
|
|
83
|
+
function q(e) {
|
|
84
84
|
return e.displayName || "Context";
|
|
85
85
|
}
|
|
86
86
|
function W(e) {
|
|
@@ -99,7 +99,7 @@ function Wt() {
|
|
|
99
99
|
return "Profiler";
|
|
100
100
|
case c:
|
|
101
101
|
return "StrictMode";
|
|
102
|
-
case
|
|
102
|
+
case m:
|
|
103
103
|
return "Suspense";
|
|
104
104
|
case j:
|
|
105
105
|
return "SuspenseList";
|
|
@@ -108,17 +108,17 @@ function Wt() {
|
|
|
108
108
|
switch (e.$$typeof) {
|
|
109
109
|
case g:
|
|
110
110
|
var r = e;
|
|
111
|
-
return
|
|
111
|
+
return q(r) + ".Consumer";
|
|
112
112
|
case v:
|
|
113
113
|
var a = e;
|
|
114
|
-
return
|
|
114
|
+
return q(a._context) + ".Provider";
|
|
115
115
|
case f:
|
|
116
|
-
return
|
|
116
|
+
return ne(e, e.render, "ForwardRef");
|
|
117
117
|
case w:
|
|
118
118
|
var l = e.displayName || null;
|
|
119
119
|
return l !== null ? l : W(e.type) || "Memo";
|
|
120
|
-
case
|
|
121
|
-
var
|
|
120
|
+
case R: {
|
|
121
|
+
var h = e, x = h._payload, p = h._init;
|
|
122
122
|
try {
|
|
123
123
|
return W(p(x));
|
|
124
124
|
} catch {
|
|
@@ -128,14 +128,14 @@ function Wt() {
|
|
|
128
128
|
}
|
|
129
129
|
return null;
|
|
130
130
|
}
|
|
131
|
-
var
|
|
131
|
+
var B = Object.assign, Z = 0, Re, Te, _e, 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 (Z === 0) {
|
|
138
|
+
Re = console.log, Te = console.info, _e = 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,74 +152,74 @@ function Wt() {
|
|
|
152
152
|
groupEnd: e
|
|
153
153
|
});
|
|
154
154
|
}
|
|
155
|
-
|
|
155
|
+
Z++;
|
|
156
156
|
}
|
|
157
157
|
}
|
|
158
158
|
function ut() {
|
|
159
159
|
{
|
|
160
|
-
if (
|
|
160
|
+
if (Z--, Z === 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: B({}, e, {
|
|
168
168
|
value: Re
|
|
169
169
|
}),
|
|
170
|
-
info:
|
|
171
|
-
value: _e
|
|
172
|
-
}),
|
|
173
|
-
warn: V({}, e, {
|
|
170
|
+
info: B({}, e, {
|
|
174
171
|
value: Te
|
|
175
172
|
}),
|
|
176
|
-
|
|
173
|
+
warn: B({}, e, {
|
|
174
|
+
value: _e
|
|
175
|
+
}),
|
|
176
|
+
error: B({}, e, {
|
|
177
177
|
value: Se
|
|
178
178
|
}),
|
|
179
|
-
group:
|
|
179
|
+
group: B({}, e, {
|
|
180
180
|
value: Oe
|
|
181
181
|
}),
|
|
182
|
-
groupCollapsed:
|
|
182
|
+
groupCollapsed: B({}, e, {
|
|
183
183
|
value: Pe
|
|
184
184
|
}),
|
|
185
|
-
groupEnd:
|
|
185
|
+
groupEnd: B({}, e, {
|
|
186
186
|
value: ke
|
|
187
187
|
})
|
|
188
188
|
});
|
|
189
189
|
}
|
|
190
|
-
|
|
190
|
+
Z < 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 = b.ReactCurrentDispatcher, he;
|
|
194
|
+
function oe(e, r, a) {
|
|
195
195
|
{
|
|
196
196
|
if (he === void 0)
|
|
197
197
|
try {
|
|
198
198
|
throw Error();
|
|
199
|
-
} catch (
|
|
200
|
-
var l =
|
|
199
|
+
} catch (h) {
|
|
200
|
+
var l = h.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 me = !1,
|
|
207
|
+
var me = !1, ae;
|
|
208
208
|
{
|
|
209
209
|
var ft = typeof WeakMap == "function" ? WeakMap : Map;
|
|
210
|
-
|
|
210
|
+
ae = new ft();
|
|
211
211
|
}
|
|
212
212
|
function Ie(e, r) {
|
|
213
213
|
if (!e || me)
|
|
214
214
|
return "";
|
|
215
215
|
{
|
|
216
|
-
var a =
|
|
216
|
+
var a = ae.get(e);
|
|
217
217
|
if (a !== void 0)
|
|
218
218
|
return a;
|
|
219
219
|
}
|
|
220
220
|
var l;
|
|
221
221
|
me = !0;
|
|
222
|
-
var
|
|
222
|
+
var h = Error.prepareStackTrace;
|
|
223
223
|
Error.prepareStackTrace = void 0;
|
|
224
224
|
var x;
|
|
225
225
|
x = pe.current, pe.current = null, ct();
|
|
@@ -235,50 +235,50 @@ function Wt() {
|
|
|
235
235
|
}), typeof Reflect == "object" && Reflect.construct) {
|
|
236
236
|
try {
|
|
237
237
|
Reflect.construct(p, []);
|
|
238
|
-
} catch (
|
|
239
|
-
l =
|
|
238
|
+
} catch (k) {
|
|
239
|
+
l = k;
|
|
240
240
|
}
|
|
241
241
|
Reflect.construct(e, [], p);
|
|
242
242
|
} else {
|
|
243
243
|
try {
|
|
244
244
|
p.call();
|
|
245
|
-
} catch (
|
|
246
|
-
l =
|
|
245
|
+
} catch (k) {
|
|
246
|
+
l = k;
|
|
247
247
|
}
|
|
248
248
|
e.call(p.prototype);
|
|
249
249
|
}
|
|
250
250
|
} else {
|
|
251
251
|
try {
|
|
252
252
|
throw Error();
|
|
253
|
-
} catch (
|
|
254
|
-
l =
|
|
253
|
+
} catch (k) {
|
|
254
|
+
l = k;
|
|
255
255
|
}
|
|
256
256
|
e();
|
|
257
257
|
}
|
|
258
|
-
} catch (
|
|
259
|
-
if (
|
|
260
|
-
for (var d =
|
|
261
|
-
`),
|
|
262
|
-
`), E = d.length - 1,
|
|
263
|
-
|
|
264
|
-
for (; E >= 1 &&
|
|
265
|
-
if (d[E] !==
|
|
266
|
-
if (E !== 1 ||
|
|
258
|
+
} catch (k) {
|
|
259
|
+
if (k && l && typeof k.stack == "string") {
|
|
260
|
+
for (var d = k.stack.split(`
|
|
261
|
+
`), O = l.stack.split(`
|
|
262
|
+
`), E = d.length - 1, C = O.length - 1; E >= 1 && C >= 0 && d[E] !== O[C]; )
|
|
263
|
+
C--;
|
|
264
|
+
for (; E >= 1 && C >= 0; E--, C--)
|
|
265
|
+
if (d[E] !== O[C]) {
|
|
266
|
+
if (E !== 1 || C !== 1)
|
|
267
267
|
do
|
|
268
|
-
if (E--,
|
|
269
|
-
var
|
|
268
|
+
if (E--, C--, C < 0 || d[E] !== O[C]) {
|
|
269
|
+
var N = `
|
|
270
270
|
` + d[E].replace(" at new ", " at ");
|
|
271
|
-
return e.displayName &&
|
|
271
|
+
return e.displayName && N.includes("<anonymous>") && (N = N.replace("<anonymous>", e.displayName)), typeof e == "function" && ae.set(e, N), N;
|
|
272
272
|
}
|
|
273
|
-
while (E >= 1 &&
|
|
273
|
+
while (E >= 1 && C >= 0);
|
|
274
274
|
break;
|
|
275
275
|
}
|
|
276
276
|
}
|
|
277
277
|
} finally {
|
|
278
|
-
me = !1, pe.current = x, ut(), Error.prepareStackTrace =
|
|
278
|
+
me = !1, pe.current = x, ut(), Error.prepareStackTrace = h;
|
|
279
279
|
}
|
|
280
|
-
var
|
|
281
|
-
return typeof e == "function" &&
|
|
280
|
+
var K = e ? e.displayName || e.name : "", U = K ? oe(K) : "";
|
|
281
|
+
return typeof e == "function" && ae.set(e, U), U;
|
|
282
282
|
}
|
|
283
283
|
function dt(e, r, a) {
|
|
284
284
|
return Ie(e, !1);
|
|
@@ -287,59 +287,59 @@ function Wt() {
|
|
|
287
287
|
var r = e.prototype;
|
|
288
288
|
return !!(r && r.isReactComponent);
|
|
289
289
|
}
|
|
290
|
-
function
|
|
290
|
+
function se(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 oe(e);
|
|
297
297
|
switch (e) {
|
|
298
|
-
case
|
|
299
|
-
return
|
|
298
|
+
case m:
|
|
299
|
+
return oe("Suspense");
|
|
300
300
|
case j:
|
|
301
|
-
return
|
|
301
|
+
return oe("SuspenseList");
|
|
302
302
|
}
|
|
303
303
|
if (typeof e == "object")
|
|
304
304
|
switch (e.$$typeof) {
|
|
305
305
|
case f:
|
|
306
306
|
return dt(e.render);
|
|
307
307
|
case w:
|
|
308
|
-
return
|
|
309
|
-
case
|
|
310
|
-
var l = e,
|
|
308
|
+
return se(e.type, r, a);
|
|
309
|
+
case R: {
|
|
310
|
+
var l = e, h = l._payload, x = l._init;
|
|
311
311
|
try {
|
|
312
|
-
return
|
|
312
|
+
return se(x(h), r, a);
|
|
313
313
|
} catch {
|
|
314
314
|
}
|
|
315
315
|
}
|
|
316
316
|
}
|
|
317
317
|
return "";
|
|
318
318
|
}
|
|
319
|
-
var
|
|
320
|
-
function
|
|
319
|
+
var Q = Object.prototype.hasOwnProperty, Ne = {}, De = b.ReactDebugCurrentFrame;
|
|
320
|
+
function ie(e) {
|
|
321
321
|
if (e) {
|
|
322
|
-
var r = e._owner, a =
|
|
322
|
+
var r = e._owner, a = se(e.type, e._source, r ? r.type : null);
|
|
323
323
|
De.setExtraStackFrame(a);
|
|
324
324
|
} else
|
|
325
325
|
De.setExtraStackFrame(null);
|
|
326
326
|
}
|
|
327
|
-
function vt(e, r, a, l,
|
|
327
|
+
function vt(e, r, a, l, h) {
|
|
328
328
|
{
|
|
329
|
-
var x = Function.call.bind(
|
|
329
|
+
var x = Function.call.bind(Q);
|
|
330
330
|
for (var p in e)
|
|
331
331
|
if (x(e, p)) {
|
|
332
332
|
var d = void 0;
|
|
333
333
|
try {
|
|
334
334
|
if (typeof e[p] != "function") {
|
|
335
|
-
var
|
|
336
|
-
throw
|
|
335
|
+
var O = 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 O.name = "Invariant Violation", O;
|
|
337
337
|
}
|
|
338
338
|
d = e[p](r, p, l, a, null, "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED");
|
|
339
339
|
} catch (E) {
|
|
340
340
|
d = E;
|
|
341
341
|
}
|
|
342
|
-
d && !(d instanceof Error) && (
|
|
342
|
+
d && !(d instanceof Error) && (ie(h), 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), ie(null)), d instanceof Error && !(d.message in Ne) && (Ne[d.message] = !0, ie(h), y("Failed %s type: %s", a, d.message), ie(null));
|
|
343
343
|
}
|
|
344
344
|
}
|
|
345
345
|
}
|
|
@@ -363,18 +363,18 @@ function Wt() {
|
|
|
363
363
|
function $e(e) {
|
|
364
364
|
return "" + e;
|
|
365
365
|
}
|
|
366
|
-
function
|
|
366
|
+
function Fe(e) {
|
|
367
367
|
if (mt(e))
|
|
368
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
|
|
370
|
+
var Le = b.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 (Q.call(e, "ref")) {
|
|
378
378
|
var r = Object.getOwnPropertyDescriptor(e, "ref").get;
|
|
379
379
|
if (r && r.isReactWarning)
|
|
380
380
|
return !1;
|
|
@@ -382,7 +382,7 @@ function Wt() {
|
|
|
382
382
|
return e.ref !== void 0;
|
|
383
383
|
}
|
|
384
384
|
function yt(e) {
|
|
385
|
-
if (
|
|
385
|
+
if (Q.call(e, "key")) {
|
|
386
386
|
var r = Object.getOwnPropertyDescriptor(e, "key").get;
|
|
387
387
|
if (r && r.isReactWarning)
|
|
388
388
|
return !1;
|
|
@@ -390,7 +390,7 @@ function Wt() {
|
|
|
390
390
|
return e.key !== void 0;
|
|
391
391
|
}
|
|
392
392
|
function jt(e, r) {
|
|
393
|
-
typeof e.ref == "string" &&
|
|
393
|
+
typeof e.ref == "string" && Le.current;
|
|
394
394
|
}
|
|
395
395
|
function wt(e, r) {
|
|
396
396
|
{
|
|
@@ -414,7 +414,7 @@ function Wt() {
|
|
|
414
414
|
});
|
|
415
415
|
}
|
|
416
416
|
}
|
|
417
|
-
var Ct = function(e, r, a, l,
|
|
417
|
+
var Ct = function(e, r, a, l, h, x, p) {
|
|
418
418
|
var d = {
|
|
419
419
|
// This tag allows us to uniquely identify this as a React Element
|
|
420
420
|
$$typeof: n,
|
|
@@ -440,31 +440,31 @@ function Wt() {
|
|
|
440
440
|
configurable: !1,
|
|
441
441
|
enumerable: !1,
|
|
442
442
|
writable: !1,
|
|
443
|
-
value:
|
|
443
|
+
value: h
|
|
444
444
|
}), Object.freeze && (Object.freeze(d.props), Object.freeze(d)), d;
|
|
445
445
|
};
|
|
446
|
-
function Rt(e, r, a, l,
|
|
446
|
+
function Rt(e, r, a, l, h) {
|
|
447
447
|
{
|
|
448
|
-
var x, p = {}, d = null,
|
|
449
|
-
a !== void 0 && (
|
|
448
|
+
var x, p = {}, d = null, O = null;
|
|
449
|
+
a !== void 0 && (Fe(a), d = "" + a), yt(r) && (Fe(r.key), d = "" + r.key), xt(r) && (O = r.ref, jt(r, h));
|
|
450
450
|
for (x in r)
|
|
451
|
-
|
|
451
|
+
Q.call(r, x) && !bt.hasOwnProperty(x) && (p[x] = r[x]);
|
|
452
452
|
if (e && e.defaultProps) {
|
|
453
453
|
var E = e.defaultProps;
|
|
454
454
|
for (x in E)
|
|
455
455
|
p[x] === void 0 && (p[x] = E[x]);
|
|
456
456
|
}
|
|
457
|
-
if (d ||
|
|
458
|
-
var
|
|
459
|
-
d && wt(p,
|
|
457
|
+
if (d || O) {
|
|
458
|
+
var C = typeof e == "function" ? e.displayName || e.name || "Unknown" : e;
|
|
459
|
+
d && wt(p, C), O && Et(p, C);
|
|
460
460
|
}
|
|
461
|
-
return Ct(e, d,
|
|
461
|
+
return Ct(e, d, O, h, l, Le.current, p);
|
|
462
462
|
}
|
|
463
463
|
}
|
|
464
|
-
var xe =
|
|
465
|
-
function
|
|
464
|
+
var xe = b.ReactCurrentOwner, We = b.ReactDebugCurrentFrame;
|
|
465
|
+
function J(e) {
|
|
466
466
|
if (e) {
|
|
467
|
-
var r = e._owner, a =
|
|
467
|
+
var r = e._owner, a = se(e.type, e._source, r ? r.type : null);
|
|
468
468
|
We.setExtraStackFrame(a);
|
|
469
469
|
} else
|
|
470
470
|
We.setExtraStackFrame(null);
|
|
@@ -474,7 +474,7 @@ function Wt() {
|
|
|
474
474
|
function je(e) {
|
|
475
475
|
return typeof e == "object" && e !== null && e.$$typeof === n;
|
|
476
476
|
}
|
|
477
|
-
function
|
|
477
|
+
function Be() {
|
|
478
478
|
{
|
|
479
479
|
if (xe.current) {
|
|
480
480
|
var e = W(xe.current.type);
|
|
@@ -486,13 +486,13 @@ Check the render method of \`` + e + "`.";
|
|
|
486
486
|
return "";
|
|
487
487
|
}
|
|
488
488
|
}
|
|
489
|
-
function
|
|
489
|
+
function Tt(e) {
|
|
490
490
|
return "";
|
|
491
491
|
}
|
|
492
|
-
var
|
|
493
|
-
function
|
|
492
|
+
var Ue = {};
|
|
493
|
+
function _t(e) {
|
|
494
494
|
{
|
|
495
|
-
var r =
|
|
495
|
+
var r = Be();
|
|
496
496
|
if (!r) {
|
|
497
497
|
var a = typeof e == "string" ? e : e.displayName || e.name;
|
|
498
498
|
a && (r = `
|
|
@@ -502,17 +502,17 @@ Check the top-level render call using <` + a + ">.");
|
|
|
502
502
|
return r;
|
|
503
503
|
}
|
|
504
504
|
}
|
|
505
|
-
function
|
|
505
|
+
function Ve(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 a =
|
|
511
|
-
if (
|
|
510
|
+
var a = _t(r);
|
|
511
|
+
if (Ue[a])
|
|
512
512
|
return;
|
|
513
|
-
|
|
513
|
+
Ue[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) + "."),
|
|
515
|
+
e && e._owner && e._owner !== xe.current && (l = " It was passed a child from " + W(e._owner.type) + "."), J(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), J(null);
|
|
516
516
|
}
|
|
517
517
|
}
|
|
518
518
|
function Ye(e, r) {
|
|
@@ -522,15 +522,15 @@ Check the top-level render call using <` + a + ">.");
|
|
|
522
522
|
if (be(e))
|
|
523
523
|
for (var a = 0; a < e.length; a++) {
|
|
524
524
|
var l = e[a];
|
|
525
|
-
je(l) &&
|
|
525
|
+
je(l) && Ve(l, r);
|
|
526
526
|
}
|
|
527
527
|
else if (je(e))
|
|
528
528
|
e._store && (e._store.validated = !0);
|
|
529
529
|
else if (e) {
|
|
530
|
-
var
|
|
531
|
-
if (typeof
|
|
532
|
-
for (var x =
|
|
533
|
-
je(p.value) &&
|
|
530
|
+
var h = S(e);
|
|
531
|
+
if (typeof h == "function" && h !== e.entries)
|
|
532
|
+
for (var x = h.call(e), p; !(p = x.next()).done; )
|
|
533
|
+
je(p.value) && Ve(p.value, r);
|
|
534
534
|
}
|
|
535
535
|
}
|
|
536
536
|
}
|
|
@@ -553,8 +553,8 @@ Check the top-level render call using <` + a + ">.");
|
|
|
553
553
|
vt(a, e.props, "prop", l, e);
|
|
554
554
|
} else if (r.PropTypes !== void 0 && !ye) {
|
|
555
555
|
ye = !0;
|
|
556
|
-
var
|
|
557
|
-
y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?",
|
|
556
|
+
var h = W(r);
|
|
557
|
+
y("Component %s declared `PropTypes` instead of `propTypes`. Did you misspell the property assignment?", h || "Unknown");
|
|
558
558
|
}
|
|
559
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
|
}
|
|
@@ -564,56 +564,56 @@ Check the top-level render call using <` + a + ">.");
|
|
|
564
564
|
for (var r = Object.keys(e.props), a = 0; a < r.length; a++) {
|
|
565
565
|
var l = r[a];
|
|
566
566
|
if (l !== "children" && l !== "key") {
|
|
567
|
-
|
|
567
|
+
J(e), y("Invalid prop `%s` supplied to `React.Fragment`. React.Fragment can only have `key` and `children` props.", l), J(null);
|
|
568
568
|
break;
|
|
569
569
|
}
|
|
570
570
|
}
|
|
571
|
-
e.ref !== null && (
|
|
571
|
+
e.ref !== null && (J(e), y("Invalid attribute `ref` supplied to `React.Fragment`."), J(null));
|
|
572
572
|
}
|
|
573
573
|
}
|
|
574
574
|
var qe = {};
|
|
575
|
-
function Je(e, r, a, l,
|
|
575
|
+
function Je(e, r, a, l, h, x) {
|
|
576
576
|
{
|
|
577
|
-
var p =
|
|
577
|
+
var p = L(e);
|
|
578
578
|
if (!p) {
|
|
579
579
|
var d = "";
|
|
580
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
|
|
582
|
-
|
|
581
|
+
var O = Tt();
|
|
582
|
+
O ? d += O : d += Be();
|
|
583
583
|
var E;
|
|
584
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
|
|
587
|
-
if (
|
|
588
|
-
return
|
|
586
|
+
var C = Rt(e, r, a, h, x);
|
|
587
|
+
if (C == null)
|
|
588
|
+
return C;
|
|
589
589
|
if (p) {
|
|
590
|
-
var
|
|
591
|
-
if (
|
|
590
|
+
var N = r.children;
|
|
591
|
+
if (N !== void 0)
|
|
592
592
|
if (l)
|
|
593
|
-
if (be(
|
|
594
|
-
for (var
|
|
595
|
-
Ye(
|
|
596
|
-
Object.freeze && Object.freeze(
|
|
593
|
+
if (be(N)) {
|
|
594
|
+
for (var K = 0; K < N.length; K++)
|
|
595
|
+
Ye(N[K], e);
|
|
596
|
+
Object.freeze && Object.freeze(N);
|
|
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
|
-
Ye(
|
|
600
|
+
Ye(N, e);
|
|
601
601
|
}
|
|
602
|
-
if (
|
|
603
|
-
var
|
|
602
|
+
if (Q.call(r, "key")) {
|
|
603
|
+
var U = W(e), k = Object.keys(r).filter(function(Dt) {
|
|
604
604
|
return Dt !== "key";
|
|
605
|
-
}), we =
|
|
606
|
-
if (!qe[
|
|
607
|
-
var Nt =
|
|
605
|
+
}), we = k.length > 0 ? "{key: someKey, " + k.join(": ..., ") + ": ...}" : "{key: someKey}";
|
|
606
|
+
if (!qe[U + we]) {
|
|
607
|
+
var Nt = k.length > 0 ? "{" + k.join(": ..., ") + ": ...}" : "{}";
|
|
608
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} />`, we,
|
|
613
|
+
<%s key={someKey} {...props} />`, we, U, Nt, U), qe[U + we] = !0;
|
|
614
614
|
}
|
|
615
615
|
}
|
|
616
|
-
return e === s ? Ot(
|
|
616
|
+
return e === s ? Ot(C) : St(C), C;
|
|
617
617
|
}
|
|
618
618
|
}
|
|
619
619
|
function Pt(e, r, a) {
|
|
@@ -623,26 +623,26 @@ React keys must be passed directly to JSX without using spread:
|
|
|
623
623
|
return Je(e, r, a, !1);
|
|
624
624
|
}
|
|
625
625
|
var At = kt, It = Pt;
|
|
626
|
-
|
|
627
|
-
}()),
|
|
626
|
+
te.Fragment = s, te.jsx = At, te.jsxs = It;
|
|
627
|
+
}()), te;
|
|
628
628
|
}
|
|
629
629
|
var He;
|
|
630
|
-
function
|
|
631
|
-
return He || (He = 1, process.env.NODE_ENV === "production" ?
|
|
630
|
+
function Bt() {
|
|
631
|
+
return He || (He = 1, process.env.NODE_ENV === "production" ? le.exports = Mt() : le.exports = Wt()), le.exports;
|
|
632
632
|
}
|
|
633
|
-
var i =
|
|
634
|
-
const nt =
|
|
635
|
-
const [n, o] =
|
|
633
|
+
var i = Bt();
|
|
634
|
+
const nt = de(), cr = ({ children: t }) => {
|
|
635
|
+
const [n, o] = P(!1);
|
|
636
636
|
return /* @__PURE__ */ i.jsx(nt.Provider, { value: { isLoading: n, setIsLoading: o }, children: t });
|
|
637
637
|
}, Ee = () => {
|
|
638
|
-
const t =
|
|
638
|
+
const t = ge(nt);
|
|
639
639
|
if (t === void 0) throw new Error("Non puoi settare il loading");
|
|
640
640
|
return t;
|
|
641
|
-
},
|
|
641
|
+
}, Ut = ({ errorMessage: t, errorShow: n }) => /* @__PURE__ */ i.jsx("section", { className: n ? "" : "hidden", children: /* @__PURE__ */ i.jsxs("div", { className: "container mx-auto", children: [
|
|
642
642
|
/* @__PURE__ */ i.jsx("h1", { className: "text-center text-8xl my-12", children: "Errore" }),
|
|
643
643
|
/* @__PURE__ */ i.jsx("pre", { className: "text-xl", children: t })
|
|
644
|
-
] }) }), ot =
|
|
645
|
-
const [n, o] =
|
|
644
|
+
] }) }), ot = de(), ur = ({ children: t }) => {
|
|
645
|
+
const [n, o] = P({}), [s, c] = P(!1), u = `Creare un file config.json in public per il corretto funzionamento
|
|
646
646
|
Esempio di config.json:
|
|
647
647
|
|
|
648
648
|
{
|
|
@@ -667,15 +667,15 @@ Esempio di config.json:
|
|
|
667
667
|
console.error(g), c(!0);
|
|
668
668
|
}
|
|
669
669
|
};
|
|
670
|
-
return
|
|
670
|
+
return V(() => {
|
|
671
671
|
v();
|
|
672
|
-
}, []), Object.keys(n).length === 0 ? /* @__PURE__ */ i.jsx(
|
|
673
|
-
},
|
|
674
|
-
const t =
|
|
672
|
+
}, []), Object.keys(n).length === 0 ? /* @__PURE__ */ i.jsx(Ut, { errorShow: s, errorMessage: u }) : /* @__PURE__ */ i.jsx(ot.Provider, { value: n, children: t });
|
|
673
|
+
}, ve = () => {
|
|
674
|
+
const t = ge(ot);
|
|
675
675
|
if (t === void 0) throw new Error("Non puoi leggere i config");
|
|
676
676
|
return t;
|
|
677
|
-
}, at =
|
|
678
|
-
const [n, o] =
|
|
677
|
+
}, at = de(), fr = ({ children: t }) => {
|
|
678
|
+
const [n, o] = P(!1), [s, c] = P(), [u, v] = P(), g = {
|
|
679
679
|
showAlert: n,
|
|
680
680
|
setShowAlert: o,
|
|
681
681
|
typeAlert: s,
|
|
@@ -684,26 +684,26 @@ Esempio di config.json:
|
|
|
684
684
|
setMessageAlert: v
|
|
685
685
|
};
|
|
686
686
|
return /* @__PURE__ */ i.jsx(at.Provider, { value: g, children: t });
|
|
687
|
-
},
|
|
688
|
-
const t =
|
|
687
|
+
}, H = () => {
|
|
688
|
+
const t = ge(at);
|
|
689
689
|
if (t === void 0) throw new Error("Non puoi modificare l'alert");
|
|
690
690
|
return t;
|
|
691
691
|
};
|
|
692
|
-
let
|
|
693
|
-
const
|
|
694
|
-
if (
|
|
692
|
+
let G;
|
|
693
|
+
const ce = async (t, n, o) => {
|
|
694
|
+
if (G) return G;
|
|
695
695
|
try {
|
|
696
696
|
const c = await (await fetch("/config.json")).json(), u = c.baseUri, { unauthorized: v, notFound: g, defaultMessage: f } = c.axiosErrors;
|
|
697
|
-
return
|
|
697
|
+
return G = zt.create({
|
|
698
698
|
baseURL: u,
|
|
699
699
|
timeout: 5e3
|
|
700
|
-
}),
|
|
701
|
-
(
|
|
702
|
-
),
|
|
703
|
-
(
|
|
704
|
-
(
|
|
705
|
-
if (
|
|
706
|
-
switch (t(!0), n("danger"),
|
|
700
|
+
}), G.interceptors.request.use(
|
|
701
|
+
(m) => m
|
|
702
|
+
), G.interceptors.response.use(
|
|
703
|
+
(m) => m,
|
|
704
|
+
(m) => {
|
|
705
|
+
if (m.response)
|
|
706
|
+
switch (t(!0), n("danger"), m.response.status) {
|
|
707
707
|
case 401:
|
|
708
708
|
localStorage.removeItem("accessToken"), o(v);
|
|
709
709
|
break;
|
|
@@ -711,83 +711,83 @@ const ie = async (t, n, o) => {
|
|
|
711
711
|
o(g);
|
|
712
712
|
break;
|
|
713
713
|
default:
|
|
714
|
-
o(`${f} ${
|
|
714
|
+
o(`${f} ${m.response.status} ${m.response.data.error}`);
|
|
715
715
|
}
|
|
716
|
-
return Promise.reject(
|
|
716
|
+
return Promise.reject(m);
|
|
717
717
|
}
|
|
718
|
-
),
|
|
718
|
+
), G;
|
|
719
719
|
} catch (s) {
|
|
720
720
|
console.error(s);
|
|
721
721
|
}
|
|
722
|
-
}, st =
|
|
723
|
-
const { heartbeatEndpoint: n, infiniteSession: o, timeDeducted: s, authenticatedEndpoint: c } =
|
|
722
|
+
}, st = de(), dr = ({ children: t }) => {
|
|
723
|
+
const { heartbeatEndpoint: n, infiniteSession: o, timeDeducted: s, authenticatedEndpoint: c } = ve(), { setIsLoading: u } = Ee(), { setShowAlert: v, setMessageAlert: g, setTypeAlert: f } = H(), m = tt(), [j, w] = P(null), [R, _] = P(), [I, D] = P(), [S, b] = P(), y = async (A, F) => {
|
|
724
724
|
A.preventDefault();
|
|
725
725
|
try {
|
|
726
726
|
u(!0), v(!1);
|
|
727
|
-
const
|
|
728
|
-
auth:
|
|
729
|
-
}),
|
|
730
|
-
|
|
727
|
+
const L = await (await ce(v, f, g)).post(c, {
|
|
728
|
+
auth: F
|
|
729
|
+
}), ne = L.data.id, q = L.headers.token;
|
|
730
|
+
q && (localStorage.setItem("accessToken", q), localStorage.setItem("id", ne), w(!0), _(q), m(`/dashboard/${ne}`));
|
|
731
731
|
} catch (M) {
|
|
732
732
|
console.error(M), u(!1);
|
|
733
733
|
}
|
|
734
|
-
},
|
|
734
|
+
}, $ = () => {
|
|
735
735
|
localStorage.removeItem("accessToken"), localStorage.removeItem("id"), w(!1), _(null);
|
|
736
|
-
},
|
|
736
|
+
}, T = async () => {
|
|
737
737
|
try {
|
|
738
|
-
const A = localStorage.getItem("accessToken"),
|
|
738
|
+
const A = localStorage.getItem("accessToken"), L = (await (await ce(v, f, g)).get(
|
|
739
739
|
`${n}`,
|
|
740
740
|
{ headers: {
|
|
741
741
|
Authorization: A
|
|
742
742
|
} }
|
|
743
743
|
)).headers.token;
|
|
744
|
-
localStorage.setItem("accessToken",
|
|
744
|
+
localStorage.setItem("accessToken", L), _(L);
|
|
745
745
|
} catch (A) {
|
|
746
|
-
console.error(A),
|
|
746
|
+
console.error(A), $();
|
|
747
747
|
}
|
|
748
|
-
},
|
|
749
|
-
if (!
|
|
748
|
+
}, Y = () => {
|
|
749
|
+
if (!R)
|
|
750
750
|
return;
|
|
751
|
-
const
|
|
752
|
-
|
|
751
|
+
const F = $t(R).exp, M = Math.floor(Date.now() / 1e3), L = (F - M) * 1e3;
|
|
752
|
+
b(L), D(L - s);
|
|
753
753
|
};
|
|
754
|
-
|
|
754
|
+
V(() => {
|
|
755
755
|
if (localStorage.getItem("accessToken"))
|
|
756
756
|
w(!0);
|
|
757
757
|
else {
|
|
758
758
|
w(!1);
|
|
759
759
|
return;
|
|
760
760
|
}
|
|
761
|
-
}, []),
|
|
762
|
-
|
|
761
|
+
}, []), V(() => {
|
|
762
|
+
Y();
|
|
763
763
|
let A;
|
|
764
|
-
o &&
|
|
765
|
-
|
|
766
|
-
},
|
|
767
|
-
let
|
|
768
|
-
return !o &&
|
|
769
|
-
|
|
770
|
-
},
|
|
771
|
-
A && clearInterval(A),
|
|
764
|
+
o && R && I && (A = setInterval(() => {
|
|
765
|
+
T();
|
|
766
|
+
}, I));
|
|
767
|
+
let F;
|
|
768
|
+
return !o && R && S && (F = setTimeout(() => {
|
|
769
|
+
$(), v(!0), f("danger"), g("Sessione scaduta");
|
|
770
|
+
}, S)), () => {
|
|
771
|
+
A && clearInterval(A), F && clearTimeout(F);
|
|
772
772
|
};
|
|
773
|
-
}, [
|
|
774
|
-
const
|
|
773
|
+
}, [R, I]);
|
|
774
|
+
const X = {
|
|
775
775
|
isAuthenticated: j,
|
|
776
776
|
setIsAuthenticated: w,
|
|
777
777
|
login: y,
|
|
778
|
-
logout:
|
|
778
|
+
logout: $,
|
|
779
779
|
setCurrentToken: _
|
|
780
780
|
};
|
|
781
|
-
return /* @__PURE__ */ i.jsx(st.Provider, { value:
|
|
781
|
+
return /* @__PURE__ */ i.jsx(st.Provider, { value: X, children: t });
|
|
782
782
|
}, Ce = () => {
|
|
783
|
-
const t =
|
|
783
|
+
const t = ge(st);
|
|
784
784
|
if (t === void 0) throw new Error("Non sei dentro al Auth Provider");
|
|
785
785
|
return t;
|
|
786
786
|
}, gr = () => {
|
|
787
|
-
const { isAuthenticated: t } = Ce(), { setShowAlert: n, setTypeAlert: o, setMessageAlert: s } =
|
|
788
|
-
return
|
|
787
|
+
const { isAuthenticated: t } = Ce(), { setShowAlert: n, setTypeAlert: o, setMessageAlert: s } = H(), c = localStorage.getItem("accessToken");
|
|
788
|
+
return V(() => {
|
|
789
789
|
!t && !c && (n(!0), o("danger"), s("Non sei autorizzato"));
|
|
790
|
-
}, []), t === null ? null : t ? /* @__PURE__ */ i.jsx(rt, {}) : /* @__PURE__ */ i.jsx(
|
|
790
|
+
}, []), t === null ? null : t ? /* @__PURE__ */ i.jsx(rt, {}) : /* @__PURE__ */ i.jsx(Ft, { to: "/" });
|
|
791
791
|
};
|
|
792
792
|
var it = {
|
|
793
793
|
color: void 0,
|
|
@@ -795,7 +795,7 @@ var it = {
|
|
|
795
795
|
className: void 0,
|
|
796
796
|
style: void 0,
|
|
797
797
|
attr: void 0
|
|
798
|
-
}, Xe = z.createContext && /* @__PURE__ */ z.createContext(it),
|
|
798
|
+
}, Xe = z.createContext && /* @__PURE__ */ z.createContext(it), Vt = ["attr", "size", "title"];
|
|
799
799
|
function Yt(t, n) {
|
|
800
800
|
if (t == null) return {};
|
|
801
801
|
var o = qt(t, n), s, c;
|
|
@@ -816,15 +816,15 @@ function qt(t, n) {
|
|
|
816
816
|
}
|
|
817
817
|
return o;
|
|
818
818
|
}
|
|
819
|
-
function
|
|
820
|
-
return
|
|
819
|
+
function ue() {
|
|
820
|
+
return ue = Object.assign ? Object.assign.bind() : function(t) {
|
|
821
821
|
for (var n = 1; n < arguments.length; n++) {
|
|
822
822
|
var o = arguments[n];
|
|
823
823
|
for (var s in o)
|
|
824
824
|
Object.prototype.hasOwnProperty.call(o, s) && (t[s] = o[s]);
|
|
825
825
|
}
|
|
826
826
|
return t;
|
|
827
|
-
},
|
|
827
|
+
}, ue.apply(this, arguments);
|
|
828
828
|
}
|
|
829
829
|
function Ze(t, n) {
|
|
830
830
|
var o = Object.keys(t);
|
|
@@ -836,7 +836,7 @@ function Ze(t, n) {
|
|
|
836
836
|
}
|
|
837
837
|
return o;
|
|
838
838
|
}
|
|
839
|
-
function
|
|
839
|
+
function fe(t) {
|
|
840
840
|
for (var n = 1; n < arguments.length; n++) {
|
|
841
841
|
var o = arguments[n] != null ? arguments[n] : {};
|
|
842
842
|
n % 2 ? Ze(Object(o), !0).forEach(function(s) {
|
|
@@ -865,13 +865,13 @@ function Gt(t, n) {
|
|
|
865
865
|
return (n === "string" ? String : Number)(t);
|
|
866
866
|
}
|
|
867
867
|
function lt(t) {
|
|
868
|
-
return t && t.map((n, o) => /* @__PURE__ */ z.createElement(n.tag,
|
|
868
|
+
return t && t.map((n, o) => /* @__PURE__ */ z.createElement(n.tag, fe({
|
|
869
869
|
key: o
|
|
870
870
|
}, n.attr), lt(n.child)));
|
|
871
871
|
}
|
|
872
|
-
function
|
|
873
|
-
return (n) => /* @__PURE__ */ z.createElement(Ht,
|
|
874
|
-
attr:
|
|
872
|
+
function re(t) {
|
|
873
|
+
return (n) => /* @__PURE__ */ z.createElement(Ht, ue({
|
|
874
|
+
attr: fe({}, t.attr)
|
|
875
875
|
}, n), lt(t.child));
|
|
876
876
|
}
|
|
877
877
|
function Ht(t) {
|
|
@@ -880,14 +880,14 @@ function Ht(t) {
|
|
|
880
880
|
attr: s,
|
|
881
881
|
size: c,
|
|
882
882
|
title: u
|
|
883
|
-
} = t, v = Yt(t,
|
|
884
|
-
return o.className && (f = o.className), t.className && (f = (f ? f + " " : "") + t.className), /* @__PURE__ */ z.createElement("svg",
|
|
883
|
+
} = t, v = Yt(t, Vt), g = c || o.size || "1em", f;
|
|
884
|
+
return o.className && (f = o.className), t.className && (f = (f ? f + " " : "") + t.className), /* @__PURE__ */ z.createElement("svg", ue({
|
|
885
885
|
stroke: "currentColor",
|
|
886
886
|
fill: "currentColor",
|
|
887
887
|
strokeWidth: "0"
|
|
888
888
|
}, o.attr, s, v, {
|
|
889
889
|
className: f,
|
|
890
|
-
style:
|
|
890
|
+
style: fe(fe({
|
|
891
891
|
color: t.color || o.color
|
|
892
892
|
}, o.style), t.style),
|
|
893
893
|
height: g,
|
|
@@ -898,26 +898,26 @@ function Ht(t) {
|
|
|
898
898
|
return Xe !== void 0 ? /* @__PURE__ */ z.createElement(Xe.Consumer, null, (o) => n(o)) : n(it);
|
|
899
899
|
}
|
|
900
900
|
function Xt(t) {
|
|
901
|
-
return
|
|
901
|
+
return re({ 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);
|
|
902
902
|
}
|
|
903
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
904
|
/* @__PURE__ */ i.jsx(Xt, { className: "text-[20rem] relative animate-spin text-white" }),
|
|
905
905
|
/* @__PURE__ */ i.jsx("p", { className: "text-white text-2xl select-none absolute", children: "Loading..." })
|
|
906
906
|
] });
|
|
907
907
|
function Qt(t) {
|
|
908
|
-
return
|
|
908
|
+
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);
|
|
909
909
|
}
|
|
910
910
|
function er(t) {
|
|
911
|
-
return
|
|
911
|
+
return re({ 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);
|
|
912
912
|
}
|
|
913
913
|
function tr(t) {
|
|
914
|
-
return
|
|
914
|
+
return re({ 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
915
|
}
|
|
916
916
|
function rr(t) {
|
|
917
|
-
return
|
|
917
|
+
return re({ 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);
|
|
918
918
|
}
|
|
919
919
|
const nr = () => {
|
|
920
|
-
const { showAlert: t, setShowAlert: n, messageAlert: o, typeAlert: s } =
|
|
920
|
+
const { showAlert: t, setShowAlert: n, messageAlert: o, typeAlert: s } = H(), { alertTimeout: c } = ve(), [u, v] = P(0), g = {
|
|
921
921
|
danger: {
|
|
922
922
|
bgColor: "bg-red-50",
|
|
923
923
|
textColor: "text-red-700",
|
|
@@ -942,8 +942,8 @@ const nr = () => {
|
|
|
942
942
|
focusRing: "focus:ring-green-400",
|
|
943
943
|
progressColor: "bg-green-400"
|
|
944
944
|
}
|
|
945
|
-
}, { bgColor: f, textColor:
|
|
946
|
-
switch (
|
|
945
|
+
}, { bgColor: f, textColor: m, buttonBg: j, hoverBg: w, focusRing: R, progressColor: _ } = g[s], I = (S) => {
|
|
946
|
+
switch (S) {
|
|
947
947
|
case "danger":
|
|
948
948
|
return /* @__PURE__ */ i.jsx(tr, { className: "text-xl" });
|
|
949
949
|
case "info":
|
|
@@ -951,38 +951,38 @@ const nr = () => {
|
|
|
951
951
|
case "success":
|
|
952
952
|
return /* @__PURE__ */ i.jsx(rr, { className: "text-xl" });
|
|
953
953
|
}
|
|
954
|
-
},
|
|
954
|
+
}, D = () => {
|
|
955
955
|
n(!t);
|
|
956
956
|
};
|
|
957
|
-
return
|
|
958
|
-
let
|
|
957
|
+
return V(() => {
|
|
958
|
+
let S;
|
|
959
959
|
const y = 100 / (c / 100);
|
|
960
|
-
|
|
961
|
-
v((
|
|
960
|
+
S = setInterval(() => {
|
|
961
|
+
v((T) => T >= 100 ? (clearInterval(S), 100) : T + y);
|
|
962
962
|
}, 100);
|
|
963
|
-
const
|
|
964
|
-
|
|
963
|
+
const $ = setTimeout(() => {
|
|
964
|
+
D();
|
|
965
965
|
}, c);
|
|
966
966
|
return () => {
|
|
967
|
-
clearTimeout(
|
|
967
|
+
clearTimeout($), clearInterval(S);
|
|
968
968
|
};
|
|
969
|
-
}, []), /* @__PURE__ */ i.jsxs("div", { className: `flex items-center p-4 pt-6 ${
|
|
969
|
+
}, []), /* @__PURE__ */ i.jsxs("div", { className: `flex items-center p-4 pt-6 ${m} rounded-lg ${f} mx-auto fixed top-[calc(100vh-100px)] right-10`, role: "alert", children: [
|
|
970
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
|
-
|
|
971
|
+
I(s),
|
|
972
972
|
/* @__PURE__ */ i.jsx("div", { className: "px-4 text-sm font-medium", children: o }),
|
|
973
973
|
/* @__PURE__ */ i.jsx(
|
|
974
974
|
"button",
|
|
975
975
|
{
|
|
976
976
|
type: "button",
|
|
977
|
-
className: `ms-auto ${j} rounded-lg focus:ring-2 ${
|
|
977
|
+
className: `ms-auto ${j} rounded-lg focus:ring-2 ${R} p-1.5 ${w} inline-flex items-center justify-center h-8 w-8 cursor-pointer`,
|
|
978
978
|
title: "Close",
|
|
979
|
-
onClick:
|
|
979
|
+
onClick: D,
|
|
980
980
|
children: /* @__PURE__ */ i.jsx(Qt, { className: "text-xl" })
|
|
981
981
|
}
|
|
982
982
|
)
|
|
983
983
|
] });
|
|
984
984
|
}, vr = () => {
|
|
985
|
-
const { isLoading: t } = Ee(), { showAlert: n } =
|
|
985
|
+
const { isLoading: t } = Ee(), { showAlert: n } = H();
|
|
986
986
|
return /* @__PURE__ */ i.jsxs(i.Fragment, { children: [
|
|
987
987
|
t && /* @__PURE__ */ i.jsx(Zt, {}),
|
|
988
988
|
/* @__PURE__ */ i.jsxs("main", { className: t ? "hidden" : "", children: [
|
|
@@ -1033,8 +1033,8 @@ const nr = () => {
|
|
|
1033
1033
|
inputId: "user-email",
|
|
1034
1034
|
inputPlaceholder: s.placeholder,
|
|
1035
1035
|
inputValue: o ? v[o] : v.email,
|
|
1036
|
-
inputChange: (
|
|
1037
|
-
g(o || "email",
|
|
1036
|
+
inputChange: (m) => {
|
|
1037
|
+
g(o || "email", m.target.value);
|
|
1038
1038
|
}
|
|
1039
1039
|
}
|
|
1040
1040
|
)
|
|
@@ -1048,111 +1048,109 @@ const nr = () => {
|
|
|
1048
1048
|
inputId: "password",
|
|
1049
1049
|
inputPlaceholder: "Password",
|
|
1050
1050
|
inputValue: v.password,
|
|
1051
|
-
inputChange: (
|
|
1052
|
-
g("password",
|
|
1051
|
+
inputChange: (m) => {
|
|
1052
|
+
g("password", m.target.value);
|
|
1053
1053
|
}
|
|
1054
1054
|
}
|
|
1055
1055
|
)
|
|
1056
1056
|
] }),
|
|
1057
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 cursor-pointer ${u.size} ${u.rounded}`, children: u.text }) })
|
|
1058
1058
|
] });
|
|
1059
|
-
}, pr = (t) => {
|
|
1060
|
-
const {
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1080
|
-
|
|
1081
|
-
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1085
|
-
|
|
1086
|
-
|
|
1087
|
-
|
|
1088
|
-
}
|
|
1089
|
-
} = t, { login: v } = Ce(), { setShowAlert: g, setTypeAlert: f, setMessageAlert: b } = G(), { clearLoginFormOnError: j } = de(), w = tt(), C = {
|
|
1059
|
+
}, pr = ({ formStyle: t, userData: n, userInput: o, title: s, buttonStyle: c }) => {
|
|
1060
|
+
const u = {
|
|
1061
|
+
size: "w-[800px]",
|
|
1062
|
+
bgColor: "bg-slate-50",
|
|
1063
|
+
rounded: "rounded-lg",
|
|
1064
|
+
shadow: "shadow-lg",
|
|
1065
|
+
...t
|
|
1066
|
+
}, v = {
|
|
1067
|
+
label: "Email",
|
|
1068
|
+
type: "email",
|
|
1069
|
+
placeholder: "email@email.it",
|
|
1070
|
+
...o
|
|
1071
|
+
}, g = {
|
|
1072
|
+
text: "Login",
|
|
1073
|
+
size: "text-4xl",
|
|
1074
|
+
position: "text-center",
|
|
1075
|
+
spacing: "my-12",
|
|
1076
|
+
...s
|
|
1077
|
+
}, f = {
|
|
1078
|
+
position: "justify-center",
|
|
1079
|
+
spacing: "my-12",
|
|
1080
|
+
color: "bg-blue-500",
|
|
1081
|
+
hoverColor: "hover:bg-blue-700",
|
|
1082
|
+
textColor: "text-white",
|
|
1083
|
+
size: "py-2 px-4",
|
|
1084
|
+
rounded: "rounded-full",
|
|
1085
|
+
text: "Login",
|
|
1086
|
+
...c
|
|
1087
|
+
}, { login: m } = Ce(), { setShowAlert: j, setTypeAlert: w, setMessageAlert: R } = H(), { clearLoginFormOnError: _ } = ve(), I = tt(), D = {
|
|
1090
1088
|
email: "",
|
|
1091
1089
|
password: ""
|
|
1092
|
-
}, [
|
|
1093
|
-
|
|
1094
|
-
},
|
|
1095
|
-
|
|
1090
|
+
}, [S, b] = P(D), y = (T, Y) => {
|
|
1091
|
+
b((X) => ({ ...X, [T]: Y }));
|
|
1092
|
+
}, $ = (T) => {
|
|
1093
|
+
m(T, S), _ && b(D);
|
|
1096
1094
|
};
|
|
1097
|
-
return
|
|
1098
|
-
const
|
|
1099
|
-
localStorage.getItem("accessToken") &&
|
|
1095
|
+
return V(() => {
|
|
1096
|
+
const T = localStorage.getItem("id");
|
|
1097
|
+
localStorage.getItem("accessToken") && T && (I(`/dashboard/${T}`), j(!0), w("info"), R("Sei già loggato"));
|
|
1100
1098
|
}, []), /* @__PURE__ */ i.jsx("section", { children: /* @__PURE__ */ i.jsx("div", { className: "container mx-auto flex items-center justify-center h-screen", children: /* @__PURE__ */ i.jsx(
|
|
1101
1099
|
or,
|
|
1102
1100
|
{
|
|
1103
|
-
submitForm:
|
|
1104
|
-
formData:
|
|
1105
|
-
changeValue:
|
|
1106
|
-
formStyle:
|
|
1107
|
-
userData:
|
|
1108
|
-
userInput:
|
|
1109
|
-
title:
|
|
1110
|
-
buttonStyle:
|
|
1101
|
+
submitForm: $,
|
|
1102
|
+
formData: S,
|
|
1103
|
+
changeValue: y,
|
|
1104
|
+
formStyle: u,
|
|
1105
|
+
userData: n,
|
|
1106
|
+
userInput: v,
|
|
1107
|
+
title: g,
|
|
1108
|
+
buttonStyle: f
|
|
1111
1109
|
}
|
|
1112
1110
|
) }) });
|
|
1113
1111
|
}, hr = () => {
|
|
1114
|
-
const { id: t } =
|
|
1112
|
+
const { id: t } = Lt(), { logout: n, setCurrentToken: o } = Ce(), { usersEndpoint: s } = ve(), { setIsLoading: c } = Ee(), { setShowAlert: u, setTypeAlert: v, setMessageAlert: g } = H(), [f, m] = P({}), [j, w] = P(null), [R, _] = P(!1), I = async () => {
|
|
1115
1113
|
try {
|
|
1116
1114
|
c(!0);
|
|
1117
|
-
const
|
|
1118
|
-
if (!
|
|
1115
|
+
const b = localStorage.getItem("accessToken");
|
|
1116
|
+
if (!b) {
|
|
1119
1117
|
n(), u(!0), v("danger"), g("Sessione scaduta");
|
|
1120
1118
|
return;
|
|
1121
1119
|
}
|
|
1122
|
-
o(
|
|
1123
|
-
const
|
|
1120
|
+
o(b);
|
|
1121
|
+
const T = (await (await ce(u, v, g)).get(
|
|
1124
1122
|
`${s}${t}`,
|
|
1125
1123
|
{ headers: {
|
|
1126
|
-
Authorization:
|
|
1124
|
+
Authorization: b
|
|
1127
1125
|
} }
|
|
1128
1126
|
)).data;
|
|
1129
|
-
|
|
1130
|
-
} catch (
|
|
1131
|
-
console.error(
|
|
1127
|
+
m(T), c(!1);
|
|
1128
|
+
} catch (b) {
|
|
1129
|
+
console.error(b), c(!1), n();
|
|
1132
1130
|
}
|
|
1133
|
-
},
|
|
1131
|
+
}, D = async () => {
|
|
1134
1132
|
try {
|
|
1135
1133
|
_(!0);
|
|
1136
|
-
const
|
|
1137
|
-
if (!
|
|
1134
|
+
const b = localStorage.getItem("accessToken");
|
|
1135
|
+
if (!b) {
|
|
1138
1136
|
n(), u(!0), v("danger"), g("Sessione scaduta");
|
|
1139
1137
|
return;
|
|
1140
1138
|
}
|
|
1141
|
-
const
|
|
1139
|
+
const T = (await (await ce(u, v, g)).get(
|
|
1142
1140
|
`${s}`,
|
|
1143
1141
|
{ headers: {
|
|
1144
|
-
Authorization:
|
|
1142
|
+
Authorization: b
|
|
1145
1143
|
} }
|
|
1146
1144
|
)).data;
|
|
1147
|
-
w(
|
|
1148
|
-
} catch (
|
|
1149
|
-
console.error(
|
|
1145
|
+
w(T), T && _(!1);
|
|
1146
|
+
} catch (b) {
|
|
1147
|
+
console.error(b), c(!1), b.status === 401 && n(), _(!1);
|
|
1150
1148
|
}
|
|
1151
|
-
},
|
|
1149
|
+
}, S = () => {
|
|
1152
1150
|
n(), u(!0), v("info"), g("Hai effettuato il logout");
|
|
1153
1151
|
};
|
|
1154
|
-
return
|
|
1155
|
-
|
|
1152
|
+
return V(() => {
|
|
1153
|
+
I();
|
|
1156
1154
|
}, []), /* @__PURE__ */ i.jsx("section", { children: /* @__PURE__ */ i.jsxs("div", { className: "container mx-auto py-8", children: [
|
|
1157
1155
|
/* @__PURE__ */ i.jsxs("div", { className: "flex items-center justify-center gap-8 h-20", children: [
|
|
1158
1156
|
/* @__PURE__ */ i.jsxs("h1", { className: "text-4xl text-center text-slate-800", children: [
|
|
@@ -1162,7 +1160,7 @@ const nr = () => {
|
|
|
1162
1160
|
/* @__PURE__ */ i.jsx(
|
|
1163
1161
|
"button",
|
|
1164
1162
|
{
|
|
1165
|
-
onClick:
|
|
1163
|
+
onClick: S,
|
|
1166
1164
|
className: "bg-red-500 hover:bg-red-700 text-white font-bold py-2 px-4 rounded-full cursor-pointer",
|
|
1167
1165
|
children: "Logout"
|
|
1168
1166
|
}
|
|
@@ -1171,17 +1169,17 @@ const nr = () => {
|
|
|
1171
1169
|
/* @__PURE__ */ i.jsx("div", { className: "flex justify-center items-center my-12", children: /* @__PURE__ */ i.jsx(
|
|
1172
1170
|
"button",
|
|
1173
1171
|
{
|
|
1174
|
-
onClick:
|
|
1172
|
+
onClick: D,
|
|
1175
1173
|
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",
|
|
1176
|
-
disabled:
|
|
1174
|
+
disabled: R,
|
|
1177
1175
|
children: "Lista degli utenti"
|
|
1178
1176
|
}
|
|
1179
1177
|
) }),
|
|
1180
|
-
/* @__PURE__ */ i.jsx("div", { className: "flex justify-center items-center", children: j && /* @__PURE__ */ i.jsx("ul", { children: j.map((
|
|
1181
|
-
|
|
1178
|
+
/* @__PURE__ */ i.jsx("div", { className: "flex justify-center items-center", children: j && /* @__PURE__ */ i.jsx("ul", { children: j.map((b) => /* @__PURE__ */ i.jsxs("li", { className: "text-xl my-4", children: [
|
|
1179
|
+
b.id,
|
|
1182
1180
|
" - ",
|
|
1183
|
-
|
|
1184
|
-
] }, `user-${
|
|
1181
|
+
b.email
|
|
1182
|
+
] }, `user-${b.id}`)) }) })
|
|
1185
1183
|
] }) });
|
|
1186
1184
|
};
|
|
1187
1185
|
export {
|
|
@@ -1192,12 +1190,12 @@ export {
|
|
|
1192
1190
|
ur as ConfigProvider,
|
|
1193
1191
|
hr as Dashboard,
|
|
1194
1192
|
vr as DefaultLayout,
|
|
1195
|
-
|
|
1193
|
+
Ut as ErrorPage,
|
|
1196
1194
|
Qe as Input,
|
|
1197
1195
|
et as InputLabel,
|
|
1198
1196
|
Zt as Loading,
|
|
1199
1197
|
cr as LoadingProvider,
|
|
1200
1198
|
pr as Login,
|
|
1201
1199
|
or as LoginForm,
|
|
1202
|
-
|
|
1200
|
+
ce as fetchAxiosConfig
|
|
1203
1201
|
};
|