@archbase/security 4.0.41 → 4.0.42
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js
CHANGED
|
@@ -1,18 +1,18 @@
|
|
|
1
1
|
import "reflect-metadata";
|
|
2
|
-
import * as
|
|
2
|
+
import * as T from "inversify";
|
|
3
3
|
import { decorate as Bt, injectable as Lt } from "inversify";
|
|
4
|
-
import { compressString as Ot, decompressString as $t, IOCContainer as zt, ARCHBASE_IOC_API_TYPE as
|
|
5
|
-
import
|
|
6
|
-
import { jwtDecode as
|
|
7
|
-
import { jsx as n, jsxs as C, Fragment as
|
|
8
|
-
import it, { useState as p, useEffect as
|
|
4
|
+
import { compressString as Ot, decompressString as $t, IOCContainer as zt, ARCHBASE_IOC_API_TYPE as X, processErrorMessage as ne, IsNotEmpty as Q, IsOptional as ae, IsBoolean as re, IsEmail as jt, getKeyByEnumValue as Qe, useArchbasePasswordRemember as Ft, getI18nextInstance as x, useArchbaseTheme as Vt, resolveArchbasePasswordPolicy as Wt, isEmailValidate as Ht, validateArchbasePassword as Gt, useArchbaseAppContext as Jt } from "@archbase/core";
|
|
5
|
+
import K from "crypto-js";
|
|
6
|
+
import { jwtDecode as Kt } from "jwt-decode";
|
|
7
|
+
import { jsx as n, jsxs as C, Fragment as ie } from "react/jsx-runtime";
|
|
8
|
+
import it, { useState as p, useEffect as Y, createContext as Ve, useMemo as at, useRef as ct, useCallback as Ce, useContext as We } from "react";
|
|
9
9
|
import { BehaviorSubject as Ze } from "rxjs";
|
|
10
|
-
import { ArchbaseRemoteApiService as
|
|
11
|
-
import { v4 as
|
|
12
|
-
import { Card as He, Text as
|
|
10
|
+
import { ArchbaseRemoteApiService as ge, useArchbaseStore as lt } from "@archbase/data";
|
|
11
|
+
import { v4 as Z } from "uuid";
|
|
12
|
+
import { Card as He, Text as j, Divider as Ue, Stack as Ee, TextInput as xe, Button as G, Anchor as et, Group as ue, Select as qt, Tooltip as Yt, Loader as dt, PasswordInput as ze, Checkbox as Xt, Alert as tt, Code as rt, CopyButton as st, SimpleGrid as Qt, useMantineColorScheme as Zt, Box as er, Skeleton as Ie } from "@mantine/core";
|
|
13
13
|
import { useFocusTrap as ut } from "@mantine/hooks";
|
|
14
|
-
import { IconCopy as
|
|
15
|
-
import { ArchbaseQRCode as
|
|
14
|
+
import { IconCopy as tr } from "@tabler/icons-react";
|
|
15
|
+
import { ArchbaseQRCode as rr, ArchbasePasswordStrengthMeter as sr, ArchbaseDialog as ot } from "@archbase/components";
|
|
16
16
|
import { useContainer as De } from "inversify-react";
|
|
17
17
|
class ht {
|
|
18
18
|
id;
|
|
@@ -38,13 +38,13 @@ class pt {
|
|
|
38
38
|
return new pt({});
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
|
-
const
|
|
42
|
-
class
|
|
41
|
+
const le = "YngzI1guK3dGaElFcFY9MywqK3xgPzg/Ojg7eD8xRmg=", Ne = "c1ab58e7-c113-4225-a190-a9e59d1207fc", Be = "6faf6932-a0b5-457b-83b1-8d89ddbd91fd", Le = "602b05c5-ec46-451e-aba6-187e463bc245", Oe = "8b4a7c2d-9e5f-4163-b8a7-3f2c9d8e5a1b";
|
|
42
|
+
class or {
|
|
43
43
|
getUsernameAndPassword() {
|
|
44
44
|
try {
|
|
45
45
|
const e = localStorage.getItem(Be);
|
|
46
46
|
if (e) {
|
|
47
|
-
const t =
|
|
47
|
+
const t = K.AES.decrypt(e, le).toString(K.enc.Utf8), o = atob(t).split(":");
|
|
48
48
|
return { username: o[0], password: o[1], remember: !0 };
|
|
49
49
|
} else
|
|
50
50
|
return null;
|
|
@@ -53,14 +53,14 @@ class tr {
|
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
saveUsernameAndPassword(e, t) {
|
|
56
|
-
const s = btoa(`${e}:${t}`), o =
|
|
56
|
+
const s = btoa(`${e}:${t}`), o = K.AES.encrypt(s, le).toString();
|
|
57
57
|
localStorage.setItem(Be, o);
|
|
58
58
|
}
|
|
59
59
|
getUsername() {
|
|
60
60
|
try {
|
|
61
61
|
const e = localStorage.getItem(Le);
|
|
62
62
|
if (e) {
|
|
63
|
-
const t =
|
|
63
|
+
const t = K.AES.decrypt(e, le).toString(K.enc.Utf8);
|
|
64
64
|
return atob(t);
|
|
65
65
|
} else
|
|
66
66
|
return null;
|
|
@@ -69,7 +69,7 @@ class tr {
|
|
|
69
69
|
}
|
|
70
70
|
}
|
|
71
71
|
saveUsername(e) {
|
|
72
|
-
const t = btoa(e), s =
|
|
72
|
+
const t = btoa(e), s = K.AES.encrypt(t, le).toString();
|
|
73
73
|
localStorage.setItem(Le, s);
|
|
74
74
|
}
|
|
75
75
|
isTokenExpired(e, t = 300) {
|
|
@@ -77,7 +77,7 @@ class tr {
|
|
|
77
77
|
if (!s && !this.getToken())
|
|
78
78
|
return !0;
|
|
79
79
|
try {
|
|
80
|
-
const o =
|
|
80
|
+
const o = Kt(s.access_token);
|
|
81
81
|
if (!o)
|
|
82
82
|
return !0;
|
|
83
83
|
const a = Math.floor(Date.now() / 1e3), c = o.exp;
|
|
@@ -88,8 +88,8 @@ class tr {
|
|
|
88
88
|
}
|
|
89
89
|
saveToken(e) {
|
|
90
90
|
if (e) {
|
|
91
|
-
const t = JSON.stringify(e), s =
|
|
92
|
-
localStorage.setItem(
|
|
91
|
+
const t = JSON.stringify(e), s = K.AES.encrypt(t, le).toString(), o = Ot(s);
|
|
92
|
+
localStorage.setItem(Ne, o);
|
|
93
93
|
} else
|
|
94
94
|
this.clearToken();
|
|
95
95
|
}
|
|
@@ -97,14 +97,14 @@ class tr {
|
|
|
97
97
|
localStorage.removeItem(Be), localStorage.removeItem(Le);
|
|
98
98
|
}
|
|
99
99
|
clearToken() {
|
|
100
|
-
localStorage.removeItem(
|
|
100
|
+
localStorage.removeItem(Ne);
|
|
101
101
|
}
|
|
102
102
|
getToken() {
|
|
103
103
|
try {
|
|
104
|
-
const e = localStorage.getItem(
|
|
104
|
+
const e = localStorage.getItem(Ne);
|
|
105
105
|
if (!e)
|
|
106
106
|
return null;
|
|
107
|
-
const t = $t(e), s =
|
|
107
|
+
const t = $t(e), s = K.AES.decrypt(t, le).toString(K.enc.Utf8);
|
|
108
108
|
return JSON.parse(s);
|
|
109
109
|
} catch {
|
|
110
110
|
return null;
|
|
@@ -112,7 +112,7 @@ class tr {
|
|
|
112
112
|
}
|
|
113
113
|
saveContext(e) {
|
|
114
114
|
try {
|
|
115
|
-
const t =
|
|
115
|
+
const t = K.AES.encrypt(e, le).toString();
|
|
116
116
|
localStorage.setItem(Oe, t);
|
|
117
117
|
} catch (t) {
|
|
118
118
|
console.warn("Erro ao salvar contexto:", t);
|
|
@@ -121,7 +121,7 @@ class tr {
|
|
|
121
121
|
getContext() {
|
|
122
122
|
try {
|
|
123
123
|
const e = localStorage.getItem(Oe);
|
|
124
|
-
return e ?
|
|
124
|
+
return e ? K.AES.decrypt(e, le).toString(K.enc.Utf8) : null;
|
|
125
125
|
} catch {
|
|
126
126
|
return null;
|
|
127
127
|
}
|
|
@@ -130,19 +130,19 @@ class tr {
|
|
|
130
130
|
localStorage.removeItem(Oe);
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
|
-
Bt(Lt(),
|
|
133
|
+
Bt(Lt(), or);
|
|
134
134
|
function ft(r) {
|
|
135
135
|
const t = new Uint8Array(1);
|
|
136
136
|
return window.crypto.getRandomValues(t), t[0] >= Math.floor(256 / r) * r ? ft(r) : t[0] % r;
|
|
137
137
|
}
|
|
138
|
-
function
|
|
138
|
+
function nr(r) {
|
|
139
139
|
let e = "";
|
|
140
140
|
const t = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789";
|
|
141
141
|
for (let s = 0; s < r; s++)
|
|
142
142
|
e += t.charAt(ft(t.length - 1));
|
|
143
143
|
return e;
|
|
144
144
|
}
|
|
145
|
-
async function
|
|
145
|
+
async function ir(r) {
|
|
146
146
|
if (!window.crypto.subtle?.digest)
|
|
147
147
|
throw new Error(
|
|
148
148
|
"The context/environment is not secure, and does not support the 'crypto.subtle' module. See: https://developer.mozilla.org/en-US/docs/Web/API/Crypto/subtle for details"
|
|
@@ -157,16 +157,16 @@ class mt extends Error {
|
|
|
157
157
|
super(s), this.name = "FetchError", this.status = e, this.statusText = t;
|
|
158
158
|
}
|
|
159
159
|
}
|
|
160
|
-
function
|
|
160
|
+
function ar(r) {
|
|
161
161
|
let e = "";
|
|
162
162
|
return Object.entries(r).forEach(([t, s]) => {
|
|
163
163
|
e += (e ? "&" : "") + t + "=" + encodeURIComponent(s);
|
|
164
164
|
}), e;
|
|
165
165
|
}
|
|
166
|
-
async function
|
|
166
|
+
async function cr(r, e) {
|
|
167
167
|
return fetch(r, {
|
|
168
168
|
method: "POST",
|
|
169
|
-
body:
|
|
169
|
+
body: ar(e),
|
|
170
170
|
headers: { "Content-Type": "application/x-www-form-urlencoded" }
|
|
171
171
|
}).then(async (t) => {
|
|
172
172
|
if (!t.ok) {
|
|
@@ -177,9 +177,9 @@ async function nr(r, e) {
|
|
|
177
177
|
});
|
|
178
178
|
}
|
|
179
179
|
const gt = "PKCE_code_verifier", je = "ROCP_auth_state";
|
|
180
|
-
async function
|
|
181
|
-
const t =
|
|
182
|
-
return sessionStorage.setItem(gt, t),
|
|
180
|
+
async function lr(r, e) {
|
|
181
|
+
const t = nr(96);
|
|
182
|
+
return sessionStorage.setItem(gt, t), ir(t).then((s) => {
|
|
183
183
|
const o = new URLSearchParams({
|
|
184
184
|
response_type: "code",
|
|
185
185
|
client_id: r.clientId,
|
|
@@ -193,17 +193,17 @@ async function ir(r, e) {
|
|
|
193
193
|
a && (sessionStorage.setItem(je, a), o.append("state", a)), r?.preLogin && r.preLogin(), window.location.replace(`${r.authorizationEndpoint}?${o.toString()}`);
|
|
194
194
|
});
|
|
195
195
|
}
|
|
196
|
-
function
|
|
196
|
+
function dr(r) {
|
|
197
197
|
return r.access_token !== void 0;
|
|
198
198
|
}
|
|
199
199
|
function yt(r, e) {
|
|
200
|
-
return
|
|
201
|
-
if (
|
|
200
|
+
return cr(r, e).then((t) => t.json().then((s) => {
|
|
201
|
+
if (dr(s))
|
|
202
202
|
return s;
|
|
203
203
|
throw Error(s);
|
|
204
204
|
}));
|
|
205
205
|
}
|
|
206
|
-
const
|
|
206
|
+
const ur = (r) => {
|
|
207
207
|
const t = new URLSearchParams(window.location.search).get("code"), s = window.sessionStorage.getItem(gt);
|
|
208
208
|
if (!t)
|
|
209
209
|
throw Error(`Parâmetro 'código' não encontrado na URL.
|
|
@@ -222,7 +222,7 @@ A autenticação ocorreu?`);
|
|
|
222
222
|
...r.extraAuthParams
|
|
223
223
|
};
|
|
224
224
|
return yt(r.tokenEndpoint, o);
|
|
225
|
-
},
|
|
225
|
+
}, hr = (r) => {
|
|
226
226
|
const { config: e, refreshToken: t } = r, s = {
|
|
227
227
|
grant_type: "refresh_token",
|
|
228
228
|
refresh_token: t,
|
|
@@ -233,34 +233,34 @@ A autenticação ocorreu?`);
|
|
|
233
233
|
};
|
|
234
234
|
return yt(e.tokenEndpoint, s);
|
|
235
235
|
};
|
|
236
|
-
function
|
|
236
|
+
function pr(r, e, t, s, o, a) {
|
|
237
237
|
const c = new URLSearchParams({
|
|
238
238
|
token: t || e,
|
|
239
239
|
token_type_hint: t ? "refresh_token" : "access_token",
|
|
240
240
|
client_id: r.clientId,
|
|
241
241
|
post_logout_redirect_uri: r.logoutRedirect ?? r.redirectUri,
|
|
242
|
-
ui_locales: window.navigator.languages.reduce((i,
|
|
242
|
+
ui_locales: window.navigator.languages.reduce((i, d) => i + " " + d),
|
|
243
243
|
...r.extraLogoutParameters
|
|
244
244
|
});
|
|
245
245
|
s && c.append("id_token_hint", s), o && c.append("state", o), a && c.append("logout_hint", a), window.location.replace(`${r.logoutEndpoint}?${c.toString()}`);
|
|
246
246
|
}
|
|
247
|
-
function
|
|
247
|
+
function fr(r) {
|
|
248
248
|
const e = r.get("state"), t = sessionStorage.getItem(je);
|
|
249
249
|
if (e !== t)
|
|
250
250
|
throw new Error(
|
|
251
251
|
'"state" valor recebido do servidor de autenticação não corresponde à solicitação do cliente. Possível falsificação de solicitação entre sites'
|
|
252
252
|
);
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function de(r, e, t) {
|
|
255
255
|
const s = t === "session" ? sessionStorage : localStorage, [o, a] = p(() => {
|
|
256
256
|
const i = s.getItem(r);
|
|
257
257
|
try {
|
|
258
258
|
return i ? JSON.parse(i) : e;
|
|
259
|
-
} catch (
|
|
259
|
+
} catch (d) {
|
|
260
260
|
return console.warn(
|
|
261
261
|
`Falha ao analisar o valor armazenado para '${r}'.
|
|
262
262
|
Continuando com o valor padrão.
|
|
263
|
-
Error: ${
|
|
263
|
+
Error: ${d.message}`
|
|
264
264
|
), e;
|
|
265
265
|
}
|
|
266
266
|
}), c = (i) => {
|
|
@@ -269,27 +269,27 @@ Error: ${l.message}`
|
|
|
269
269
|
return;
|
|
270
270
|
}
|
|
271
271
|
try {
|
|
272
|
-
const
|
|
273
|
-
a(
|
|
272
|
+
const d = i instanceof Function ? i(o) : i;
|
|
273
|
+
a(d), s.setItem(r, JSON.stringify(d));
|
|
274
274
|
} catch {
|
|
275
275
|
console.log(`Falha ao armazenar valor '${i}' para chave '${r}'`);
|
|
276
276
|
}
|
|
277
277
|
};
|
|
278
|
-
return
|
|
279
|
-
const i = (
|
|
280
|
-
|
|
278
|
+
return Y(() => {
|
|
279
|
+
const i = (d) => {
|
|
280
|
+
d.storageArea === s && d.key === r && a(JSON.parse(d.newValue ?? ""));
|
|
281
281
|
};
|
|
282
282
|
return window.addEventListener("storage", i, !1), () => window.removeEventListener("storage", i, !1);
|
|
283
283
|
}), [o, c];
|
|
284
284
|
}
|
|
285
|
-
const
|
|
285
|
+
const Wr = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
|
|
286
286
|
__proto__: null,
|
|
287
|
-
default:
|
|
287
|
+
default: de
|
|
288
288
|
}, Symbol.toStringTag, { value: "Module" }));
|
|
289
289
|
function Pe(r) {
|
|
290
290
|
return ["", void 0, null].includes(r);
|
|
291
291
|
}
|
|
292
|
-
function
|
|
292
|
+
function mr(r) {
|
|
293
293
|
const {
|
|
294
294
|
autoLogin: e = !0,
|
|
295
295
|
clearURL: t = !0,
|
|
@@ -298,7 +298,7 @@ function hr(r) {
|
|
|
298
298
|
preLogin: a = () => null,
|
|
299
299
|
postLogin: c = () => null,
|
|
300
300
|
onRefreshTokenExpire: i = void 0,
|
|
301
|
-
storage:
|
|
301
|
+
storage: d = "local"
|
|
302
302
|
} = r, y = {
|
|
303
303
|
...r,
|
|
304
304
|
autoLogin: e,
|
|
@@ -308,11 +308,11 @@ function hr(r) {
|
|
|
308
308
|
preLogin: a,
|
|
309
309
|
postLogin: c,
|
|
310
310
|
onRefreshTokenExpire: i,
|
|
311
|
-
storage:
|
|
311
|
+
storage: d
|
|
312
312
|
};
|
|
313
|
-
return
|
|
313
|
+
return gr(y), y;
|
|
314
314
|
}
|
|
315
|
-
function
|
|
315
|
+
function gr(r) {
|
|
316
316
|
if (Pe(r?.clientId))
|
|
317
317
|
throw Error(
|
|
318
318
|
"'clientId' deve ser definido no objeto 'ArchbaseAuthConfig' passado para ArchbaseAuthProvider"
|
|
@@ -337,21 +337,21 @@ function pr(r) {
|
|
|
337
337
|
"Usar 'extraAuthParams' e 'extraTokenParameters' não é recomendado. Eles fazem a mesma coisa e você deve usar apenas 'extraTokenParameters'"
|
|
338
338
|
);
|
|
339
339
|
}
|
|
340
|
-
const
|
|
340
|
+
const fe = 600, pe = (r) => Math.round(Date.now() / 1e3 + r);
|
|
341
341
|
function nt(r) {
|
|
342
342
|
return Math.round(Date.now()) / 1e3 + 30 >= r;
|
|
343
343
|
}
|
|
344
|
-
const
|
|
344
|
+
const yr = [
|
|
345
345
|
"refresh_expires_in",
|
|
346
346
|
// KeyCloak
|
|
347
347
|
"refresh_token_expires_in"
|
|
348
348
|
// Azure AD
|
|
349
349
|
];
|
|
350
|
-
function
|
|
351
|
-
for (const t of
|
|
350
|
+
function wr(r, e) {
|
|
351
|
+
for (const t of yr)
|
|
352
352
|
if (t in e)
|
|
353
353
|
return e[t];
|
|
354
|
-
return e.refresh_token ? r +
|
|
354
|
+
return e.refresh_token ? r + fe : r;
|
|
355
355
|
}
|
|
356
356
|
const Te = (r) => {
|
|
357
357
|
try {
|
|
@@ -368,88 +368,88 @@ const Te = (r) => {
|
|
|
368
368
|
Você pode desativar a decodificação JWT definindo o valor 'decodeToken' como 'falso' na configuração.`
|
|
369
369
|
);
|
|
370
370
|
}
|
|
371
|
-
},
|
|
371
|
+
}, vr = Ve({
|
|
372
372
|
token: "",
|
|
373
373
|
login: () => null,
|
|
374
374
|
logOut: () => null,
|
|
375
375
|
error: null,
|
|
376
376
|
loginInProgress: !1
|
|
377
|
-
}),
|
|
378
|
-
const t = at(() =>
|
|
377
|
+
}), Hr = ({ authConfig: r, children: e }) => {
|
|
378
|
+
const t = at(() => mr(r), [r]), [s, o] = de(
|
|
379
379
|
"ROCP_refreshToken",
|
|
380
380
|
void 0,
|
|
381
381
|
t.storage
|
|
382
|
-
), [a, c] =
|
|
382
|
+
), [a, c] = de(
|
|
383
383
|
"ROCP_refreshTokenExpire",
|
|
384
|
-
|
|
384
|
+
pe(2 * fe),
|
|
385
385
|
t.storage
|
|
386
|
-
), [i,
|
|
386
|
+
), [i, d] = de("ROCP_token", "", t.storage), [y, S] = de(
|
|
387
387
|
"ROCP_tokenExpire",
|
|
388
|
-
fe
|
|
388
|
+
pe(fe),
|
|
389
389
|
t.storage
|
|
390
|
-
), [
|
|
390
|
+
), [h, U] = de(
|
|
391
391
|
"ROCP_idToken",
|
|
392
392
|
void 0,
|
|
393
393
|
t.storage
|
|
394
|
-
), [A,
|
|
394
|
+
), [A, v] = de(
|
|
395
395
|
"ROCP_loginInProgress",
|
|
396
396
|
!1,
|
|
397
397
|
t.storage
|
|
398
|
-
), [
|
|
398
|
+
), [E, I] = de(
|
|
399
399
|
"ROCP_refreshInProgress",
|
|
400
400
|
!1,
|
|
401
401
|
t.storage
|
|
402
|
-
), [
|
|
403
|
-
let
|
|
404
|
-
function
|
|
405
|
-
o(void 0),
|
|
406
|
-
}
|
|
407
|
-
function O(
|
|
408
|
-
|
|
409
|
-
}
|
|
410
|
-
function
|
|
411
|
-
|
|
412
|
-
let
|
|
413
|
-
|
|
414
|
-
`O estado de login aprovado deve ser do tipo 'string'. Recebido'${
|
|
415
|
-
),
|
|
416
|
-
console.error(
|
|
402
|
+
), [M, L] = p(), [V, _] = p(), [b, m] = p(null);
|
|
403
|
+
let R;
|
|
404
|
+
function W() {
|
|
405
|
+
o(void 0), d(""), S(pe(fe)), c(pe(fe)), U(void 0), L(void 0), _(void 0), v(!1);
|
|
406
|
+
}
|
|
407
|
+
function O(g, w) {
|
|
408
|
+
W(), m(null), t?.logoutEndpoint && pr(t, i, s, h, g, w);
|
|
409
|
+
}
|
|
410
|
+
function N(g) {
|
|
411
|
+
W(), v(!0);
|
|
412
|
+
let w = g;
|
|
413
|
+
g && typeof g != "string" && (console.warn(
|
|
414
|
+
`O estado de login aprovado deve ser do tipo 'string'. Recebido'${g}'. Ignorando o valor...`
|
|
415
|
+
), w = void 0), lr(t, w).catch((J) => {
|
|
416
|
+
console.error(J), m(J.message), v(!1);
|
|
417
417
|
});
|
|
418
418
|
}
|
|
419
|
-
function
|
|
420
|
-
|
|
421
|
-
const
|
|
422
|
-
|
|
423
|
-
const
|
|
424
|
-
c(
|
|
419
|
+
function P(g) {
|
|
420
|
+
d(g.access_token), o(g.refresh_token);
|
|
421
|
+
const w = t.tokenExpiresIn ?? g.expires_in ?? fe;
|
|
422
|
+
S(pe(w));
|
|
423
|
+
const J = t.refreshTokenExpiresIn ?? wr(w, g);
|
|
424
|
+
c(pe(J)), U(g.id_token);
|
|
425
425
|
try {
|
|
426
|
-
|
|
427
|
-
} catch (
|
|
428
|
-
console.warn(`Falha ao decodificar idToken: ${
|
|
426
|
+
g.id_token && _(Te(g.id_token));
|
|
427
|
+
} catch (H) {
|
|
428
|
+
console.warn(`Falha ao decodificar idToken: ${H.message}`);
|
|
429
429
|
}
|
|
430
430
|
try {
|
|
431
|
-
t.decodeToken &&
|
|
432
|
-
} catch (
|
|
433
|
-
console.warn(`Falha ao decodificar o token de acesso: ${
|
|
431
|
+
t.decodeToken && L(Te(g.access_token));
|
|
432
|
+
} catch (H) {
|
|
433
|
+
console.warn(`Falha ao decodificar o token de acesso: ${H.message}`);
|
|
434
434
|
}
|
|
435
435
|
}
|
|
436
|
-
function
|
|
437
|
-
return
|
|
436
|
+
function ee(g = !1) {
|
|
437
|
+
return g || !t.onRefreshTokenExpire ? N() : t.onRefreshTokenExpire({ login: N });
|
|
438
438
|
}
|
|
439
|
-
function
|
|
440
|
-
if (i && nt(y) && !(
|
|
439
|
+
function te(g = !1) {
|
|
440
|
+
if (i && nt(y) && !(E && !g)) {
|
|
441
441
|
if (nt(a))
|
|
442
|
-
return
|
|
442
|
+
return ee(g);
|
|
443
443
|
if (s) {
|
|
444
|
-
|
|
445
|
-
if (
|
|
446
|
-
if (
|
|
447
|
-
return
|
|
448
|
-
console.error(
|
|
444
|
+
I(!0), hr({ config: t, refreshToken: s }).then((w) => P(w)).catch((w) => {
|
|
445
|
+
if (w instanceof mt) {
|
|
446
|
+
if (w.status === 400)
|
|
447
|
+
return ee(g);
|
|
448
|
+
console.error(w), m(w.message), g && N();
|
|
449
449
|
} else
|
|
450
|
-
|
|
450
|
+
w instanceof Error && (console.error(w), m(w.message), g && N());
|
|
451
451
|
}).finally(() => {
|
|
452
|
-
|
|
452
|
+
I(!1);
|
|
453
453
|
});
|
|
454
454
|
return;
|
|
455
455
|
}
|
|
@@ -458,50 +458,50 @@ const Te = (r) => {
|
|
|
458
458
|
);
|
|
459
459
|
}
|
|
460
460
|
}
|
|
461
|
-
|
|
462
|
-
const
|
|
463
|
-
return
|
|
461
|
+
Y(() => (R = setInterval(() => te(), 1e4), () => clearInterval(R)), [i, s, a, y]);
|
|
462
|
+
const se = ct(!1);
|
|
463
|
+
return Y(() => {
|
|
464
464
|
if (A) {
|
|
465
|
-
const
|
|
466
|
-
if (!
|
|
467
|
-
const
|
|
468
|
-
console.error(
|
|
465
|
+
const g = new URLSearchParams(window.location.search);
|
|
466
|
+
if (!g.get("code")) {
|
|
467
|
+
const w = g.get("error_description") || "Estado de autorização inválido. Atualizar a página pode resolver o problema.";
|
|
468
|
+
console.error(w), m(w), O();
|
|
469
469
|
return;
|
|
470
470
|
}
|
|
471
|
-
if (!
|
|
472
|
-
|
|
471
|
+
if (!se.current) {
|
|
472
|
+
se.current = !0;
|
|
473
473
|
try {
|
|
474
|
-
|
|
475
|
-
} catch (
|
|
476
|
-
console.error(
|
|
474
|
+
fr(g);
|
|
475
|
+
} catch (w) {
|
|
476
|
+
console.error(w), m(w.message);
|
|
477
477
|
}
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
}).catch((
|
|
481
|
-
console.error(
|
|
478
|
+
ur(t).then((w) => {
|
|
479
|
+
P(w), t?.postLogin && t.postLogin();
|
|
480
|
+
}).catch((w) => {
|
|
481
|
+
console.error(w), m(w.message);
|
|
482
482
|
}).finally(() => {
|
|
483
|
-
t.clearURL && window.history.replaceState(null, "", window.location.pathname),
|
|
483
|
+
t.clearURL && window.history.replaceState(null, "", window.location.pathname), v(!1);
|
|
484
484
|
});
|
|
485
485
|
}
|
|
486
486
|
return;
|
|
487
487
|
}
|
|
488
488
|
if (!i && t.autoLogin)
|
|
489
|
-
return
|
|
489
|
+
return N();
|
|
490
490
|
try {
|
|
491
|
-
|
|
492
|
-
} catch (
|
|
493
|
-
console.warn(`Falha ao decodificar idToken: ${
|
|
491
|
+
h && _(Te(h));
|
|
492
|
+
} catch (g) {
|
|
493
|
+
console.warn(`Falha ao decodificar idToken: ${g.message}`);
|
|
494
494
|
}
|
|
495
495
|
try {
|
|
496
|
-
t.decodeToken &&
|
|
497
|
-
} catch (
|
|
498
|
-
console.warn(`Falha ao decodificar o token de acesso: ${
|
|
496
|
+
t.decodeToken && L(Te(i));
|
|
497
|
+
} catch (g) {
|
|
498
|
+
console.warn(`Falha ao decodificar o token de acesso: ${g.message}`);
|
|
499
499
|
}
|
|
500
|
-
|
|
500
|
+
te(!0);
|
|
501
501
|
}, []), /* @__PURE__ */ n(
|
|
502
|
-
|
|
502
|
+
vr.Provider,
|
|
503
503
|
{
|
|
504
|
-
value: { token: i, tokenData:
|
|
504
|
+
value: { token: i, tokenData: M, idToken: h, idTokenData: V, login: N, logOut: O, error: b, loginInProgress: A },
|
|
505
505
|
children: e
|
|
506
506
|
}
|
|
507
507
|
);
|
|
@@ -515,7 +515,7 @@ class wt {
|
|
|
515
515
|
error;
|
|
516
516
|
isAdmin;
|
|
517
517
|
constructor(e, t, s) {
|
|
518
|
-
this.resourceService = zt.getContainer().get(
|
|
518
|
+
this.resourceService = zt.getContainer().get(X.Resource), this.resource = { resourceName: e, resourceDescription: t }, this.alreadyApplied = !1, this.actions = [], this.permissions = [], this.error = "", this.isAdmin = s;
|
|
519
519
|
}
|
|
520
520
|
registerAction(e, t) {
|
|
521
521
|
!this.alreadyApplied && this.actions.findIndex((s) => s.actionName === e) < 0 && this.actions.push({ actionName: e, actionDescription: t });
|
|
@@ -524,7 +524,7 @@ class wt {
|
|
|
524
524
|
this.alreadyApplied || (this.alreadyApplied = !0, this.resourceService.registerResource({ resource: this.resource, actions: this.actions }).then((t) => {
|
|
525
525
|
this.permissions = t.permissions, this.error = "", e && e();
|
|
526
526
|
}).catch((t) => {
|
|
527
|
-
this.alreadyApplied = !1, this.error =
|
|
527
|
+
this.alreadyApplied = !1, this.error = ne(t);
|
|
528
528
|
}));
|
|
529
529
|
}
|
|
530
530
|
hasPermission(e) {
|
|
@@ -586,7 +586,7 @@ class wt {
|
|
|
586
586
|
return [...this.actions];
|
|
587
587
|
}
|
|
588
588
|
}
|
|
589
|
-
class
|
|
589
|
+
class q {
|
|
590
590
|
static instance;
|
|
591
591
|
_currentTenant = new Ze(null);
|
|
592
592
|
_availableTenants = new Ze([]);
|
|
@@ -600,7 +600,7 @@ class J {
|
|
|
600
600
|
}
|
|
601
601
|
}
|
|
602
602
|
static getInstance() {
|
|
603
|
-
return
|
|
603
|
+
return q.instance || (q.instance = new q()), q.instance;
|
|
604
604
|
}
|
|
605
605
|
get currentTenant$() {
|
|
606
606
|
return this._currentTenant.asObservable();
|
|
@@ -629,14 +629,14 @@ class J {
|
|
|
629
629
|
return t && (e["X-TENANT-ID"] = t.id), e;
|
|
630
630
|
}
|
|
631
631
|
}
|
|
632
|
-
function
|
|
633
|
-
return
|
|
632
|
+
function Gr() {
|
|
633
|
+
return q.getInstance();
|
|
634
634
|
}
|
|
635
|
-
var
|
|
635
|
+
var me = /* @__PURE__ */ ((r) => (r.USER = "user", r.PROFILE = "profile", r.GROUP = "group", r))(me || {}), br = Object.defineProperty, k = (r, e, t, s) => {
|
|
636
636
|
for (var o = void 0, a = r.length - 1, c; a >= 0; a--)
|
|
637
637
|
(c = r[a]) && (o = c(e, t, o) || o);
|
|
638
|
-
return o &&
|
|
639
|
-
},
|
|
638
|
+
return o && br(e, t, o), o;
|
|
639
|
+
}, Ar = /* @__PURE__ */ ((r) => (r.VIEW = "VIEW", r.API = "API", r))(Ar || {});
|
|
640
640
|
const vt = class bt {
|
|
641
641
|
id;
|
|
642
642
|
code;
|
|
@@ -648,15 +648,15 @@ const vt = class bt {
|
|
|
648
648
|
description;
|
|
649
649
|
intervals;
|
|
650
650
|
constructor(e) {
|
|
651
|
-
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.description = e.description || "", this.intervals = e.intervals ? e.intervals.map((t) => new
|
|
651
|
+
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.description = e.description || "", this.intervals = e.intervals ? e.intervals.map((t) => new Er(t)) : [];
|
|
652
652
|
}
|
|
653
653
|
static newInstance = () => new bt({
|
|
654
|
-
id:
|
|
654
|
+
id: Z(),
|
|
655
655
|
intervals: []
|
|
656
656
|
});
|
|
657
657
|
};
|
|
658
658
|
k([
|
|
659
|
-
|
|
659
|
+
Q({
|
|
660
660
|
message: "archbase:Informe a descrição do cronograma de acesso"
|
|
661
661
|
})
|
|
662
662
|
], vt.prototype, "description");
|
|
@@ -677,27 +677,27 @@ const _e = class Et {
|
|
|
677
677
|
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.accessSchedule = e.accessSchedule ? new At(e.accessSchedule) : void 0, this.dayOfWeek = e.dayOfWeek || 0, this.startTime = e.startTime || "", this.endTime = e.endTime || "";
|
|
678
678
|
}
|
|
679
679
|
static newInstance = () => new Et({
|
|
680
|
-
id:
|
|
680
|
+
id: Z(),
|
|
681
681
|
dayOfWeek: (/* @__PURE__ */ new Date()).getDay(),
|
|
682
682
|
startTime: "08:00",
|
|
683
683
|
endTime: "17:00"
|
|
684
684
|
});
|
|
685
685
|
};
|
|
686
686
|
k([
|
|
687
|
-
|
|
687
|
+
ae()
|
|
688
688
|
], _e.prototype, "accessSchedule");
|
|
689
689
|
k([
|
|
690
|
-
|
|
690
|
+
Q({
|
|
691
691
|
message: "archbase:Informe a hora de início"
|
|
692
692
|
})
|
|
693
693
|
], _e.prototype, "startTime");
|
|
694
694
|
k([
|
|
695
|
-
|
|
695
|
+
Q({
|
|
696
696
|
message: "archbase:Informe a hora de término"
|
|
697
697
|
})
|
|
698
698
|
], _e.prototype, "endTime");
|
|
699
|
-
let
|
|
700
|
-
class
|
|
699
|
+
let Er = _e;
|
|
700
|
+
class ye {
|
|
701
701
|
id;
|
|
702
702
|
code;
|
|
703
703
|
version;
|
|
@@ -713,19 +713,19 @@ class we {
|
|
|
713
713
|
}
|
|
714
714
|
}
|
|
715
715
|
k([
|
|
716
|
-
|
|
716
|
+
Q({
|
|
717
717
|
message: "archbase:Informe o nome"
|
|
718
718
|
})
|
|
719
|
-
],
|
|
719
|
+
], ye.prototype, "name");
|
|
720
720
|
k([
|
|
721
|
-
|
|
721
|
+
Q({
|
|
722
722
|
message: "archbase:Informe a descrição"
|
|
723
723
|
})
|
|
724
|
-
],
|
|
724
|
+
], ye.prototype, "description");
|
|
725
725
|
k([
|
|
726
|
-
|
|
727
|
-
],
|
|
728
|
-
const
|
|
726
|
+
ae()
|
|
727
|
+
], ye.prototype, "actions");
|
|
728
|
+
const we = class xt {
|
|
729
729
|
id;
|
|
730
730
|
code;
|
|
731
731
|
version;
|
|
@@ -744,41 +744,41 @@ const ve = class xt {
|
|
|
744
744
|
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.name = e.name || "", this.description = e.description || "", this.resource = e.resource ? new St(e.resource) : void 0, this.category = e.category || "", this.active = e.active || !1, this.actionVersion = e.actionVersion || "", this.isNewAction = e.isNewAction || !1;
|
|
745
745
|
}
|
|
746
746
|
static newInstance = () => new xt({
|
|
747
|
-
id:
|
|
747
|
+
id: Z(),
|
|
748
748
|
active: !0,
|
|
749
749
|
isNewAction: !0
|
|
750
750
|
});
|
|
751
751
|
};
|
|
752
752
|
k([
|
|
753
|
-
|
|
753
|
+
Q({
|
|
754
754
|
message: "archbase:Informe o nome para a ação"
|
|
755
755
|
})
|
|
756
|
-
],
|
|
756
|
+
], we.prototype, "name");
|
|
757
757
|
k([
|
|
758
|
-
|
|
758
|
+
Q({
|
|
759
759
|
message: "archbase:Informe a descrição para a ação"
|
|
760
760
|
})
|
|
761
|
-
],
|
|
761
|
+
], we.prototype, "description");
|
|
762
762
|
k([
|
|
763
|
-
|
|
764
|
-
],
|
|
763
|
+
ae()
|
|
764
|
+
], we.prototype, "resource");
|
|
765
765
|
k([
|
|
766
|
-
|
|
766
|
+
Q({
|
|
767
767
|
message: "archbase:Informe a categoria para a ação"
|
|
768
768
|
})
|
|
769
|
-
],
|
|
769
|
+
], we.prototype, "category");
|
|
770
770
|
k([
|
|
771
|
-
|
|
772
|
-
],
|
|
773
|
-
let
|
|
774
|
-
class ke extends
|
|
771
|
+
re()
|
|
772
|
+
], we.prototype, "active");
|
|
773
|
+
let xr = we;
|
|
774
|
+
class ke extends ye {
|
|
775
775
|
type;
|
|
776
776
|
isNewProfile;
|
|
777
777
|
constructor(e) {
|
|
778
|
-
super(e), this.type =
|
|
778
|
+
super(e), this.type = me.PROFILE, this.isNewProfile = e.isNewProfile || !1;
|
|
779
779
|
}
|
|
780
780
|
static newInstance = () => new ke({
|
|
781
|
-
id:
|
|
781
|
+
id: Z(),
|
|
782
782
|
isNewProfile: !0
|
|
783
783
|
});
|
|
784
784
|
}
|
|
@@ -795,18 +795,18 @@ class Ge {
|
|
|
795
795
|
this.id = e.id, this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.group = e.group ? new Se(e.group) : void 0;
|
|
796
796
|
}
|
|
797
797
|
static newInstance = (e) => new Ge({
|
|
798
|
-
id:
|
|
798
|
+
id: Z(),
|
|
799
799
|
group: e
|
|
800
800
|
});
|
|
801
801
|
}
|
|
802
|
-
class Se extends
|
|
802
|
+
class Se extends ye {
|
|
803
803
|
type;
|
|
804
804
|
isNewGroup;
|
|
805
805
|
constructor(e) {
|
|
806
|
-
super(e), this.type =
|
|
806
|
+
super(e), this.type = me.GROUP, this.isNewGroup = e.isNewGroup || !1;
|
|
807
807
|
}
|
|
808
808
|
static newInstance = () => new Se({
|
|
809
|
-
id:
|
|
809
|
+
id: Z(),
|
|
810
810
|
isNewGroup: !0
|
|
811
811
|
});
|
|
812
812
|
}
|
|
@@ -828,27 +828,27 @@ const Re = class kt {
|
|
|
828
828
|
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.name = e.name || "", this.description = e.description || "", this.actions = e.actions || [], this.active = e.active || !1, this.type = e.type || "VIEW", this.isNewResource = e.isNewResource || !1;
|
|
829
829
|
}
|
|
830
830
|
static newInstance = () => new kt({
|
|
831
|
-
id:
|
|
831
|
+
id: Z(),
|
|
832
832
|
actions: [],
|
|
833
833
|
active: !0,
|
|
834
834
|
isNewResource: !0
|
|
835
835
|
});
|
|
836
836
|
};
|
|
837
837
|
k([
|
|
838
|
-
|
|
838
|
+
Q({
|
|
839
839
|
message: "archbase:Informe o nome para o recurso"
|
|
840
840
|
})
|
|
841
841
|
], Re.prototype, "name");
|
|
842
842
|
k([
|
|
843
|
-
|
|
843
|
+
Q({
|
|
844
844
|
message: "archbase:Informe a descrição para o recurso"
|
|
845
845
|
})
|
|
846
846
|
], Re.prototype, "description");
|
|
847
847
|
k([
|
|
848
|
-
|
|
848
|
+
re()
|
|
849
849
|
], Re.prototype, "active");
|
|
850
850
|
let St = Re;
|
|
851
|
-
const
|
|
851
|
+
const F = class Ct extends ye {
|
|
852
852
|
userName;
|
|
853
853
|
password;
|
|
854
854
|
changePasswordOnNextLogin;
|
|
@@ -869,10 +869,10 @@ const V = class Ct extends we {
|
|
|
869
869
|
type;
|
|
870
870
|
isNewUser;
|
|
871
871
|
constructor(e) {
|
|
872
|
-
super(e), this.type =
|
|
872
|
+
super(e), this.type = me.USER, this.userName = e.userName || "", this.password = e.password || "", this.changePasswordOnNextLogin = e.changePasswordOnNextLogin || !1, this.allowPasswordChange = e.allowPasswordChange || !1, this.allowMultipleLogins = e.allowMultipleLogins || !1, this.passwordNeverExpires = e.passwordNeverExpires || !1, this.passwordChangedAt = e.passwordChangedAt || void 0, this.accountDeactivated = e.accountDeactivated || !1, this.accountLocked = e.accountLocked || !1, this.unlimitedAccessHours = e.unlimitedAccessHours || !1, this.isAdministrator = e.isAdministrator || !1, this.accessSchedule = e.accessSchedule ? new At(e.accessSchedule) : void 0, this.groups = e.groups ? e.groups.map((t) => new Ge(t)) : [], this.profile = e.profile ? new ke(e.profile) : void 0, this.email = e.email || "", this.avatar = e.avatar || void 0, this.isNewUser = e.isNewUser || !1, this.nickname = e.nickname;
|
|
873
873
|
}
|
|
874
874
|
static newInstance = () => new Ct({
|
|
875
|
-
id:
|
|
875
|
+
id: Z(),
|
|
876
876
|
userName: "",
|
|
877
877
|
password: "",
|
|
878
878
|
groups: [],
|
|
@@ -884,46 +884,46 @@ const V = class Ct extends we {
|
|
|
884
884
|
});
|
|
885
885
|
};
|
|
886
886
|
k([
|
|
887
|
-
|
|
887
|
+
Q({
|
|
888
888
|
message: "archbase:Informe o nome de usuário"
|
|
889
889
|
})
|
|
890
|
-
],
|
|
890
|
+
], F.prototype, "userName");
|
|
891
891
|
k([
|
|
892
|
-
|
|
893
|
-
],
|
|
892
|
+
re()
|
|
893
|
+
], F.prototype, "changePasswordOnNextLogin");
|
|
894
894
|
k([
|
|
895
|
-
|
|
896
|
-
],
|
|
895
|
+
re()
|
|
896
|
+
], F.prototype, "allowPasswordChange");
|
|
897
897
|
k([
|
|
898
|
-
|
|
899
|
-
],
|
|
898
|
+
re()
|
|
899
|
+
], F.prototype, "allowMultipleLogins");
|
|
900
900
|
k([
|
|
901
|
-
|
|
902
|
-
],
|
|
901
|
+
re()
|
|
902
|
+
], F.prototype, "passwordNeverExpires");
|
|
903
903
|
k([
|
|
904
|
-
|
|
905
|
-
],
|
|
904
|
+
ae()
|
|
905
|
+
], F.prototype, "passwordChangedAt");
|
|
906
906
|
k([
|
|
907
|
-
|
|
908
|
-
],
|
|
907
|
+
re()
|
|
908
|
+
], F.prototype, "accountDeactivated");
|
|
909
909
|
k([
|
|
910
|
-
|
|
911
|
-
],
|
|
910
|
+
re()
|
|
911
|
+
], F.prototype, "accountLocked");
|
|
912
912
|
k([
|
|
913
|
-
|
|
914
|
-
],
|
|
913
|
+
re()
|
|
914
|
+
], F.prototype, "unlimitedAccessHours");
|
|
915
915
|
k([
|
|
916
|
-
|
|
917
|
-
],
|
|
916
|
+
re()
|
|
917
|
+
], F.prototype, "isAdministrator");
|
|
918
918
|
k([
|
|
919
|
-
|
|
920
|
-
],
|
|
919
|
+
ae()
|
|
920
|
+
], F.prototype, "accessSchedule");
|
|
921
921
|
k([
|
|
922
|
-
|
|
923
|
-
],
|
|
922
|
+
ae()
|
|
923
|
+
], F.prototype, "groups");
|
|
924
924
|
k([
|
|
925
|
-
|
|
926
|
-
],
|
|
925
|
+
ae()
|
|
926
|
+
], F.prototype, "profile");
|
|
927
927
|
k([
|
|
928
928
|
jt(
|
|
929
929
|
{},
|
|
@@ -931,8 +931,8 @@ k([
|
|
|
931
931
|
message: "archbase:Informe um email válido"
|
|
932
932
|
}
|
|
933
933
|
)
|
|
934
|
-
],
|
|
935
|
-
let
|
|
934
|
+
], F.prototype, "email");
|
|
935
|
+
let Me = F;
|
|
936
936
|
const Je = class Fe {
|
|
937
937
|
id;
|
|
938
938
|
code;
|
|
@@ -947,7 +947,7 @@ const Je = class Fe {
|
|
|
947
947
|
companyId;
|
|
948
948
|
projectId;
|
|
949
949
|
constructor(e) {
|
|
950
|
-
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.security = e.security ? Fe.createDtoFromJson(e.security) : void 0, this.action = e.action ? new
|
|
950
|
+
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.security = e.security ? Fe.createDtoFromJson(e.security) : void 0, this.action = e.action ? new xr(e.action) : void 0, this.tenantId = e.tenantId || "", this.companyId = e.companyId || "", this.projectId = e.projectId || "";
|
|
951
951
|
}
|
|
952
952
|
static createDtoFromJson(e) {
|
|
953
953
|
switch (e.type) {
|
|
@@ -956,25 +956,25 @@ const Je = class Fe {
|
|
|
956
956
|
case "group":
|
|
957
957
|
return new Se(e);
|
|
958
958
|
case "user":
|
|
959
|
-
return new
|
|
959
|
+
return new Me(e);
|
|
960
960
|
default:
|
|
961
961
|
throw new Error("Unknown DTO type");
|
|
962
962
|
}
|
|
963
963
|
}
|
|
964
964
|
static newInstance = () => new Fe({
|
|
965
|
-
id:
|
|
965
|
+
id: Z(),
|
|
966
966
|
tenantId: "",
|
|
967
967
|
companyId: "",
|
|
968
968
|
projectId: ""
|
|
969
969
|
});
|
|
970
970
|
};
|
|
971
971
|
k([
|
|
972
|
-
|
|
972
|
+
ae()
|
|
973
973
|
], Je.prototype, "security");
|
|
974
974
|
k([
|
|
975
|
-
|
|
975
|
+
ae()
|
|
976
976
|
], Je.prototype, "action");
|
|
977
|
-
let
|
|
977
|
+
let Jr = Je;
|
|
978
978
|
class Ke {
|
|
979
979
|
id;
|
|
980
980
|
code;
|
|
@@ -993,10 +993,10 @@ class Ke {
|
|
|
993
993
|
activated;
|
|
994
994
|
isNovoToken;
|
|
995
995
|
constructor(e) {
|
|
996
|
-
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.tenantId = e.tenantId || "", this.user = e.user ? new
|
|
996
|
+
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || "", this.updateEntityDate = e.updateEntityDate || "", this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.tenantId = e.tenantId || "", this.user = e.user ? new Me(e.user) : void 0, this.name = e.name || "", this.description = e.description || "", this.token = e.token || "", this.expirationDate = e.expirationDate, this.revoked = e.revoked, this.activated = e.activated || !1;
|
|
997
997
|
}
|
|
998
998
|
static newInstance = () => new Ke({
|
|
999
|
-
id:
|
|
999
|
+
id: Z()
|
|
1000
1000
|
});
|
|
1001
1001
|
}
|
|
1002
1002
|
class qe {
|
|
@@ -1016,23 +1016,23 @@ class qe {
|
|
|
1016
1016
|
user;
|
|
1017
1017
|
isNewAccessToken;
|
|
1018
1018
|
constructor(e) {
|
|
1019
|
-
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.token = e.token || "", this.tokenType = e.tokenType || void 0, this.user = e.user ? new
|
|
1019
|
+
this.id = e.id || "", this.code = e.code || "", this.version = e.version || 0, this.createEntityDate = e.createEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.updateEntityDate = e.updateEntityDate || (/* @__PURE__ */ new Date()).toISOString(), this.createdByUser = e.createdByUser || "", this.lastModifiedByUser = e.lastModifiedByUser || "", this.token = e.token || "", this.tokenType = e.tokenType || void 0, this.user = e.user ? new Me(e.user) : void 0, this.revoked = e.revoked || !1, this.expired = e.expired || !1, this.expirationTime = e.expirationTime || 0, this.expirationDate = e.expirationDate || "", this.isNewAccessToken = e.isNewAccessToken || !1;
|
|
1020
1020
|
}
|
|
1021
1021
|
static newInstance = () => new qe({
|
|
1022
|
-
id:
|
|
1022
|
+
id: Z(),
|
|
1023
1023
|
active: !0,
|
|
1024
1024
|
isNewAccessToken: !0
|
|
1025
1025
|
});
|
|
1026
1026
|
}
|
|
1027
|
-
class It extends
|
|
1027
|
+
class It extends ge {
|
|
1028
1028
|
constructor(e) {
|
|
1029
1029
|
super(e);
|
|
1030
1030
|
}
|
|
1031
1031
|
configureHeaders() {
|
|
1032
|
-
return
|
|
1032
|
+
return q.getInstance().getHeaders();
|
|
1033
1033
|
}
|
|
1034
1034
|
transform(e) {
|
|
1035
|
-
return new
|
|
1035
|
+
return new Me(e);
|
|
1036
1036
|
}
|
|
1037
1037
|
getEndpoint() {
|
|
1038
1038
|
return "/api/v1/user";
|
|
@@ -1051,14 +1051,14 @@ class It extends ye {
|
|
|
1051
1051
|
return this.transform(t);
|
|
1052
1052
|
}
|
|
1053
1053
|
}
|
|
1054
|
-
|
|
1055
|
-
|
|
1056
|
-
class Pt extends
|
|
1054
|
+
T.decorate(T.inject(X.ApiClient), It, 0);
|
|
1055
|
+
T.decorate(T.injectable(), It);
|
|
1056
|
+
class Pt extends ge {
|
|
1057
1057
|
constructor(e) {
|
|
1058
1058
|
super(e);
|
|
1059
1059
|
}
|
|
1060
1060
|
configureHeaders() {
|
|
1061
|
-
return
|
|
1061
|
+
return q.getInstance().getHeaders();
|
|
1062
1062
|
}
|
|
1063
1063
|
transform(e) {
|
|
1064
1064
|
return new Se(e);
|
|
@@ -1073,14 +1073,14 @@ class Pt extends ye {
|
|
|
1073
1073
|
return e.isNewGroup;
|
|
1074
1074
|
}
|
|
1075
1075
|
}
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
class Tt extends
|
|
1076
|
+
T.decorate(T.inject(X.ApiClient), Pt, 0);
|
|
1077
|
+
T.decorate(T.injectable(), Pt);
|
|
1078
|
+
class Tt extends ge {
|
|
1079
1079
|
constructor(e) {
|
|
1080
1080
|
super(e);
|
|
1081
1081
|
}
|
|
1082
1082
|
configureHeaders() {
|
|
1083
|
-
return
|
|
1083
|
+
return q.getInstance().getHeaders();
|
|
1084
1084
|
}
|
|
1085
1085
|
transform(e) {
|
|
1086
1086
|
return new ke(e);
|
|
@@ -1095,14 +1095,14 @@ class Tt extends ye {
|
|
|
1095
1095
|
return e.isNewProfile;
|
|
1096
1096
|
}
|
|
1097
1097
|
}
|
|
1098
|
-
|
|
1099
|
-
|
|
1100
|
-
class Ut extends
|
|
1098
|
+
T.decorate(T.inject(X.ApiClient), Tt, 0);
|
|
1099
|
+
T.decorate(T.injectable(), Tt);
|
|
1100
|
+
class Ut extends ge {
|
|
1101
1101
|
constructor(e) {
|
|
1102
1102
|
super(e);
|
|
1103
1103
|
}
|
|
1104
1104
|
configureHeaders() {
|
|
1105
|
-
return
|
|
1105
|
+
return q.getInstance().getHeaders();
|
|
1106
1106
|
}
|
|
1107
1107
|
transform(e) {
|
|
1108
1108
|
return new Ke(e);
|
|
@@ -1132,14 +1132,14 @@ class Ut extends ye {
|
|
|
1132
1132
|
);
|
|
1133
1133
|
}
|
|
1134
1134
|
}
|
|
1135
|
-
|
|
1136
|
-
|
|
1137
|
-
class Dt extends
|
|
1135
|
+
T.decorate(T.inject(X.ApiClient), Ut, 0);
|
|
1136
|
+
T.decorate(T.injectable(), Ut);
|
|
1137
|
+
class Dt extends ge {
|
|
1138
1138
|
constructor(e) {
|
|
1139
1139
|
super(e);
|
|
1140
1140
|
}
|
|
1141
1141
|
configureHeaders() {
|
|
1142
|
-
return
|
|
1142
|
+
return q.getInstance().getHeaders();
|
|
1143
1143
|
}
|
|
1144
1144
|
transform(e) {
|
|
1145
1145
|
return new qe(e);
|
|
@@ -1161,14 +1161,14 @@ class Dt extends ye {
|
|
|
1161
1161
|
);
|
|
1162
1162
|
}
|
|
1163
1163
|
}
|
|
1164
|
-
|
|
1165
|
-
|
|
1166
|
-
class _t extends
|
|
1164
|
+
T.decorate(T.inject(X.ApiClient), Dt, 0);
|
|
1165
|
+
T.decorate(T.injectable(), Dt);
|
|
1166
|
+
class _t extends ge {
|
|
1167
1167
|
constructor(e) {
|
|
1168
1168
|
super(e);
|
|
1169
1169
|
}
|
|
1170
1170
|
configureHeaders() {
|
|
1171
|
-
return
|
|
1171
|
+
return q.getInstance().getHeaders();
|
|
1172
1172
|
}
|
|
1173
1173
|
transform(e) {
|
|
1174
1174
|
return new St(e);
|
|
@@ -1195,7 +1195,7 @@ class _t extends ye {
|
|
|
1195
1195
|
!1,
|
|
1196
1196
|
{
|
|
1197
1197
|
params: {
|
|
1198
|
-
type: Qe(
|
|
1198
|
+
type: Qe(me, t)
|
|
1199
1199
|
}
|
|
1200
1200
|
}
|
|
1201
1201
|
);
|
|
@@ -1206,7 +1206,7 @@ class _t extends ye {
|
|
|
1206
1206
|
{
|
|
1207
1207
|
securityId: e,
|
|
1208
1208
|
actionId: t,
|
|
1209
|
-
type: Qe(
|
|
1209
|
+
type: Qe(me, s)
|
|
1210
1210
|
},
|
|
1211
1211
|
this.configureHeaders()
|
|
1212
1212
|
);
|
|
@@ -1225,9 +1225,9 @@ class _t extends ye {
|
|
|
1225
1225
|
);
|
|
1226
1226
|
}
|
|
1227
1227
|
}
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
function
|
|
1228
|
+
T.decorate(T.inject(X.ApiClient), _t, 0);
|
|
1229
|
+
T.decorate(T.injectable(), _t);
|
|
1230
|
+
function Kr({
|
|
1231
1231
|
onLogin: r,
|
|
1232
1232
|
error: e,
|
|
1233
1233
|
onClickForgotPassword: t,
|
|
@@ -1236,57 +1236,57 @@ function Hr({
|
|
|
1236
1236
|
afterInputs: a,
|
|
1237
1237
|
showMockUsersSelector: c = !1,
|
|
1238
1238
|
mockUsers: i = [],
|
|
1239
|
-
mockUsersGroupMap:
|
|
1239
|
+
mockUsersGroupMap: d,
|
|
1240
1240
|
options: y = {},
|
|
1241
|
-
onChangeUsername:
|
|
1242
|
-
disabledLogin:
|
|
1243
|
-
isCheckingUsername:
|
|
1241
|
+
onChangeUsername: S,
|
|
1242
|
+
disabledLogin: h = !1,
|
|
1243
|
+
isCheckingUsername: U = !1,
|
|
1244
1244
|
showSignIn: A = !0,
|
|
1245
|
-
mfaRequired:
|
|
1246
|
-
onVerifyMfa:
|
|
1247
|
-
mfaError:
|
|
1248
|
-
onCancelMfa:
|
|
1249
|
-
isVerifyingMfa:
|
|
1245
|
+
mfaRequired: v = !1,
|
|
1246
|
+
onVerifyMfa: E,
|
|
1247
|
+
mfaError: I,
|
|
1248
|
+
onCancelMfa: M,
|
|
1249
|
+
isVerifyingMfa: L = !1
|
|
1250
1250
|
}) {
|
|
1251
|
-
const
|
|
1252
|
-
username:
|
|
1251
|
+
const V = ut(), {
|
|
1252
|
+
username: _,
|
|
1253
1253
|
password: b,
|
|
1254
|
-
rememberMe:
|
|
1255
|
-
clearRememberMe:
|
|
1256
|
-
} = Ft(), [
|
|
1257
|
-
|
|
1258
|
-
|
|
1259
|
-
}, [e]),
|
|
1260
|
-
|
|
1261
|
-
}, [
|
|
1262
|
-
const
|
|
1263
|
-
|
|
1264
|
-
},
|
|
1265
|
-
|
|
1266
|
-
},
|
|
1267
|
-
const
|
|
1268
|
-
|
|
1269
|
-
},
|
|
1270
|
-
if (!
|
|
1271
|
-
return i.map((
|
|
1272
|
-
value:
|
|
1273
|
-
label:
|
|
1254
|
+
rememberMe: m,
|
|
1255
|
+
clearRememberMe: R
|
|
1256
|
+
} = Ft(), [W, O] = p(_), [N, P] = p(b), [ee, te] = p(m), [se, g] = p(!1), [w, J] = p(null), [H, ve] = p("");
|
|
1257
|
+
Y(() => {
|
|
1258
|
+
g(!!e);
|
|
1259
|
+
}, [e]), Y(() => {
|
|
1260
|
+
_ !== W && (O(_), S?.(_)), b !== N && P(b), m !== ee && te(m);
|
|
1261
|
+
}, [_, b, m]);
|
|
1262
|
+
const he = () => {
|
|
1263
|
+
g(!1);
|
|
1264
|
+
}, B = () => {
|
|
1265
|
+
W && N && r(W, N, ee).finally(() => g(!0));
|
|
1266
|
+
}, ce = () => {
|
|
1267
|
+
const l = H.trim();
|
|
1268
|
+
l && E && E(l);
|
|
1269
|
+
}, oe = () => {
|
|
1270
|
+
if (!d)
|
|
1271
|
+
return i.map((f) => ({
|
|
1272
|
+
value: f.email,
|
|
1273
|
+
label: f.email
|
|
1274
1274
|
}));
|
|
1275
|
-
const
|
|
1276
|
-
const
|
|
1277
|
-
return
|
|
1278
|
-
value:
|
|
1279
|
-
label:
|
|
1280
|
-
})),
|
|
1275
|
+
const l = i.reduce((f, D) => {
|
|
1276
|
+
const z = d[D.type];
|
|
1277
|
+
return z && (f[z] || (f[z] = []), f[z].push({
|
|
1278
|
+
value: D.email,
|
|
1279
|
+
label: D.email
|
|
1280
|
+
})), f;
|
|
1281
1281
|
}, {});
|
|
1282
|
-
return Object.entries(
|
|
1283
|
-
group:
|
|
1284
|
-
items:
|
|
1282
|
+
return Object.entries(l).map(([f, D]) => ({
|
|
1283
|
+
group: f,
|
|
1284
|
+
items: D
|
|
1285
1285
|
}));
|
|
1286
|
-
},
|
|
1287
|
-
if (
|
|
1288
|
-
const
|
|
1289
|
-
|
|
1286
|
+
}, be = () => {
|
|
1287
|
+
if (w) {
|
|
1288
|
+
const l = i.find((f) => f.email === w);
|
|
1289
|
+
l && (O(l.email), P(l.password), he());
|
|
1290
1290
|
}
|
|
1291
1291
|
}, u = {
|
|
1292
1292
|
withBorder: !0,
|
|
@@ -1302,11 +1302,11 @@ function Hr({
|
|
|
1302
1302
|
{
|
|
1303
1303
|
...u,
|
|
1304
1304
|
pos: "relative",
|
|
1305
|
-
ref:
|
|
1305
|
+
ref: V,
|
|
1306
1306
|
children: [
|
|
1307
|
-
A && /* @__PURE__ */ C(
|
|
1307
|
+
A && /* @__PURE__ */ C(ie, { children: [
|
|
1308
1308
|
/* @__PURE__ */ n(
|
|
1309
|
-
|
|
1309
|
+
j,
|
|
1310
1310
|
{
|
|
1311
1311
|
c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
|
|
1312
1312
|
fw: 800,
|
|
@@ -1319,10 +1319,10 @@ function Hr({
|
|
|
1319
1319
|
/* @__PURE__ */ n(Ue, { m: "md" })
|
|
1320
1320
|
] }),
|
|
1321
1321
|
y?.customContentBefore,
|
|
1322
|
-
|
|
1322
|
+
v && /* @__PURE__ */ C(Ee, { gap: "md", children: [
|
|
1323
1323
|
/* @__PURE__ */ C("div", { children: [
|
|
1324
|
-
/* @__PURE__ */ n(
|
|
1325
|
-
/* @__PURE__ */ n(
|
|
1324
|
+
/* @__PURE__ */ n(j, { fw: 700, fz: "lg", children: x().t("archbase:mfa.title", "Verificação em duas etapas") }),
|
|
1325
|
+
/* @__PURE__ */ n(j, { c: "dimmed", fz: "sm", children: x().t(
|
|
1326
1326
|
"archbase:mfa.subtitle",
|
|
1327
1327
|
"Digite o código do seu aplicativo autenticador (ou um código de recuperação)."
|
|
1328
1328
|
) })
|
|
@@ -1332,26 +1332,26 @@ function Hr({
|
|
|
1332
1332
|
{
|
|
1333
1333
|
label: x().t("archbase:mfa.code", "Código de verificação"),
|
|
1334
1334
|
placeholder: "000000",
|
|
1335
|
-
value:
|
|
1335
|
+
value: H,
|
|
1336
1336
|
autoFocus: !0,
|
|
1337
|
-
onChange: (
|
|
1338
|
-
onKeyDown: (
|
|
1339
|
-
|
|
1337
|
+
onChange: (l) => ve(l.currentTarget.value),
|
|
1338
|
+
onKeyDown: (l) => {
|
|
1339
|
+
l.key === "Enter" && ce();
|
|
1340
1340
|
}
|
|
1341
1341
|
}
|
|
1342
1342
|
),
|
|
1343
|
-
|
|
1343
|
+
I && /* @__PURE__ */ n(j, { c: "red", fz: "sm", children: I }),
|
|
1344
1344
|
/* @__PURE__ */ n(
|
|
1345
|
-
|
|
1345
|
+
G,
|
|
1346
1346
|
{
|
|
1347
1347
|
fullWidth: !0,
|
|
1348
|
-
disabled: !
|
|
1349
|
-
loading:
|
|
1350
|
-
onClick:
|
|
1348
|
+
disabled: !H.trim() || L,
|
|
1349
|
+
loading: L,
|
|
1350
|
+
onClick: ce,
|
|
1351
1351
|
children: x().t("archbase:mfa.verify", "Verificar")
|
|
1352
1352
|
}
|
|
1353
1353
|
),
|
|
1354
|
-
|
|
1354
|
+
M && /* @__PURE__ */ n(
|
|
1355
1355
|
et,
|
|
1356
1356
|
{
|
|
1357
1357
|
component: "button",
|
|
@@ -1359,35 +1359,35 @@ function Hr({
|
|
|
1359
1359
|
fz: 14,
|
|
1360
1360
|
ta: "center",
|
|
1361
1361
|
styles: { root: { cursor: "pointer" } },
|
|
1362
|
-
onClick:
|
|
1362
|
+
onClick: M,
|
|
1363
1363
|
children: x().t("archbase:mfa.back", "Voltar ao login")
|
|
1364
1364
|
}
|
|
1365
1365
|
)
|
|
1366
1366
|
] }),
|
|
1367
|
-
!
|
|
1368
|
-
c && /* @__PURE__ */ C(
|
|
1369
|
-
/* @__PURE__ */ C(
|
|
1367
|
+
!v && /* @__PURE__ */ C(ie, { children: [
|
|
1368
|
+
c && /* @__PURE__ */ C(ie, { children: [
|
|
1369
|
+
/* @__PURE__ */ C(ue, { gap: "sm", mb: "md", children: [
|
|
1370
1370
|
/* @__PURE__ */ n(
|
|
1371
|
-
|
|
1371
|
+
qt,
|
|
1372
1372
|
{
|
|
1373
1373
|
placeholder: "Selecione um usuário mock",
|
|
1374
|
-
data:
|
|
1375
|
-
value:
|
|
1376
|
-
onChange: (
|
|
1374
|
+
data: oe(),
|
|
1375
|
+
value: w,
|
|
1376
|
+
onChange: (l) => J(l ?? ""),
|
|
1377
1377
|
searchable: !0,
|
|
1378
1378
|
clearable: !0,
|
|
1379
1379
|
style: { flexGrow: 1 }
|
|
1380
1380
|
}
|
|
1381
1381
|
),
|
|
1382
|
-
/* @__PURE__ */ n(
|
|
1383
|
-
|
|
1382
|
+
/* @__PURE__ */ n(Yt, { label: "Aplicar", children: /* @__PURE__ */ n(
|
|
1383
|
+
G,
|
|
1384
1384
|
{
|
|
1385
1385
|
variant: "light",
|
|
1386
1386
|
size: "sm",
|
|
1387
|
-
onClick:
|
|
1388
|
-
disabled: !
|
|
1387
|
+
onClick: be,
|
|
1388
|
+
disabled: !w,
|
|
1389
1389
|
"aria-label": "Aplicar usuário mock selecionado",
|
|
1390
|
-
children: /* @__PURE__ */ n(
|
|
1390
|
+
children: /* @__PURE__ */ n(tr, { size: 16 })
|
|
1391
1391
|
}
|
|
1392
1392
|
) })
|
|
1393
1393
|
] }),
|
|
@@ -1398,11 +1398,11 @@ function Hr({
|
|
|
1398
1398
|
{
|
|
1399
1399
|
label: s,
|
|
1400
1400
|
placeholder: o ?? x().t("archbase:usuario@email.com"),
|
|
1401
|
-
rightSection:
|
|
1402
|
-
value:
|
|
1401
|
+
rightSection: U ? /* @__PURE__ */ n(dt, { size: "xs" }) : null,
|
|
1402
|
+
value: W || "",
|
|
1403
1403
|
required: !0,
|
|
1404
|
-
onChange: (
|
|
1405
|
-
O(
|
|
1404
|
+
onChange: (l) => {
|
|
1405
|
+
O(l.currentTarget.value), S?.(l.currentTarget.value), he();
|
|
1406
1406
|
}
|
|
1407
1407
|
}
|
|
1408
1408
|
),
|
|
@@ -1411,23 +1411,23 @@ function Hr({
|
|
|
1411
1411
|
{
|
|
1412
1412
|
label: x().t("archbase:Password"),
|
|
1413
1413
|
placeholder: x().t("archbase:Sua senha"),
|
|
1414
|
-
onChange: (
|
|
1415
|
-
|
|
1414
|
+
onChange: (l) => {
|
|
1415
|
+
P(l.currentTarget.value), he();
|
|
1416
1416
|
},
|
|
1417
|
-
value:
|
|
1417
|
+
value: N || "",
|
|
1418
1418
|
required: !0,
|
|
1419
1419
|
mt: "md"
|
|
1420
1420
|
}
|
|
1421
1421
|
),
|
|
1422
|
-
/* @__PURE__ */ C(
|
|
1422
|
+
/* @__PURE__ */ C(ue, { justify: "space-between", mt: "md", children: [
|
|
1423
1423
|
/* @__PURE__ */ n(
|
|
1424
|
-
|
|
1424
|
+
Xt,
|
|
1425
1425
|
{
|
|
1426
1426
|
label: x().t("archbase:Lembre-me"),
|
|
1427
|
-
checked:
|
|
1428
|
-
onChange: (
|
|
1429
|
-
const
|
|
1430
|
-
|
|
1427
|
+
checked: ee,
|
|
1428
|
+
onChange: (l) => {
|
|
1429
|
+
const f = l.currentTarget.checked;
|
|
1430
|
+
te(f), f || R();
|
|
1431
1431
|
}
|
|
1432
1432
|
}
|
|
1433
1433
|
),
|
|
@@ -1446,89 +1446,89 @@ function Hr({
|
|
|
1446
1446
|
] }),
|
|
1447
1447
|
y?.afterInputs || a,
|
|
1448
1448
|
/* @__PURE__ */ n(
|
|
1449
|
-
|
|
1449
|
+
G,
|
|
1450
1450
|
{
|
|
1451
|
-
disabled: !
|
|
1451
|
+
disabled: !N || !W || h,
|
|
1452
1452
|
fullWidth: !0,
|
|
1453
1453
|
mt: "xl",
|
|
1454
|
-
onClick:
|
|
1454
|
+
onClick: B,
|
|
1455
1455
|
children: x().t("archbase:signIn")
|
|
1456
1456
|
}
|
|
1457
1457
|
)
|
|
1458
1458
|
] }),
|
|
1459
1459
|
y?.customContentAfter,
|
|
1460
|
-
|
|
1460
|
+
se && e && /* @__PURE__ */ n(j, { c: "red", mt: "sm", children: e })
|
|
1461
1461
|
]
|
|
1462
1462
|
}
|
|
1463
1463
|
);
|
|
1464
1464
|
}
|
|
1465
1465
|
const $ = (r, e) => x().t(r, e);
|
|
1466
|
-
function
|
|
1466
|
+
function qr({
|
|
1467
1467
|
enabled: r,
|
|
1468
1468
|
onSetup: e,
|
|
1469
1469
|
onEnable: t,
|
|
1470
1470
|
onDisable: s,
|
|
1471
1471
|
onStatusChange: o
|
|
1472
1472
|
}) {
|
|
1473
|
-
const [a, c] = p("idle"), [i,
|
|
1474
|
-
|
|
1473
|
+
const [a, c] = p("idle"), [i, d] = p(null), [y, S] = p(""), [h, U] = p([]), [A, v] = p(!1), [E, I] = p(null), M = async () => {
|
|
1474
|
+
v(!0), I(null);
|
|
1475
1475
|
try {
|
|
1476
1476
|
const b = await e();
|
|
1477
|
-
|
|
1477
|
+
d(b), S(""), c("setup");
|
|
1478
1478
|
} catch (b) {
|
|
1479
|
-
|
|
1479
|
+
I(b?.message || String(b));
|
|
1480
1480
|
} finally {
|
|
1481
|
-
|
|
1481
|
+
v(!1);
|
|
1482
1482
|
}
|
|
1483
|
-
},
|
|
1483
|
+
}, L = async () => {
|
|
1484
1484
|
const b = y.trim();
|
|
1485
1485
|
if (b) {
|
|
1486
|
-
|
|
1486
|
+
v(!0), I(null);
|
|
1487
1487
|
try {
|
|
1488
|
-
const
|
|
1489
|
-
|
|
1490
|
-
} catch (
|
|
1491
|
-
|
|
1488
|
+
const m = await t(b);
|
|
1489
|
+
U(m), c("recovery"), o?.(!0);
|
|
1490
|
+
} catch (m) {
|
|
1491
|
+
I(m?.message || String(m));
|
|
1492
1492
|
} finally {
|
|
1493
|
-
|
|
1493
|
+
v(!1);
|
|
1494
1494
|
}
|
|
1495
1495
|
}
|
|
1496
|
-
},
|
|
1497
|
-
|
|
1496
|
+
}, V = async () => {
|
|
1497
|
+
v(!0), I(null);
|
|
1498
1498
|
try {
|
|
1499
|
-
await s(),
|
|
1499
|
+
await s(), d(null), U([]), c("idle"), o?.(!1);
|
|
1500
1500
|
} catch (b) {
|
|
1501
|
-
|
|
1501
|
+
I(b?.message || String(b));
|
|
1502
1502
|
} finally {
|
|
1503
|
-
|
|
1503
|
+
v(!1);
|
|
1504
1504
|
}
|
|
1505
|
-
},
|
|
1506
|
-
|
|
1505
|
+
}, _ = () => {
|
|
1506
|
+
U([]), d(null), S(""), c("idle");
|
|
1507
1507
|
};
|
|
1508
1508
|
return /* @__PURE__ */ n(He, { withBorder: !0, radius: "md", p: "lg", children: /* @__PURE__ */ C(Ee, { gap: "md", children: [
|
|
1509
1509
|
/* @__PURE__ */ C("div", { children: [
|
|
1510
|
-
/* @__PURE__ */ n(
|
|
1511
|
-
/* @__PURE__ */ n(
|
|
1510
|
+
/* @__PURE__ */ n(j, { fw: 700, fz: "lg", children: $("archbase:mfa.setup.title", "Autenticação em duas etapas (MFA)") }),
|
|
1511
|
+
/* @__PURE__ */ n(j, { c: "dimmed", fz: "sm", children: $(
|
|
1512
1512
|
"archbase:mfa.setup.subtitle",
|
|
1513
1513
|
"Proteja o acesso exigindo um código do seu aplicativo autenticador no login."
|
|
1514
1514
|
) })
|
|
1515
1515
|
] }),
|
|
1516
|
-
|
|
1517
|
-
r && a === "idle" && /* @__PURE__ */ C(
|
|
1518
|
-
/* @__PURE__ */ n(
|
|
1519
|
-
/* @__PURE__ */ n(
|
|
1516
|
+
E && /* @__PURE__ */ n(tt, { color: "red", children: E }),
|
|
1517
|
+
r && a === "idle" && /* @__PURE__ */ C(ue, { justify: "space-between", children: [
|
|
1518
|
+
/* @__PURE__ */ n(j, { c: "teal", fw: 600, children: $("archbase:mfa.setup.active", "MFA ativo") }),
|
|
1519
|
+
/* @__PURE__ */ n(G, { color: "red", variant: "light", loading: A, onClick: V, children: $("archbase:mfa.setup.disable", "Desativar") })
|
|
1520
1520
|
] }),
|
|
1521
|
-
!r && a === "idle" && /* @__PURE__ */ n(
|
|
1521
|
+
!r && a === "idle" && /* @__PURE__ */ n(G, { loading: A, onClick: M, children: $("archbase:mfa.setup.enable", "Ativar MFA") }),
|
|
1522
1522
|
a === "setup" && i && /* @__PURE__ */ C(Ee, { gap: "sm", align: "center", children: [
|
|
1523
|
-
/* @__PURE__ */ n(
|
|
1523
|
+
/* @__PURE__ */ n(j, { fz: "sm", ta: "center", children: $(
|
|
1524
1524
|
"archbase:mfa.setup.scan",
|
|
1525
1525
|
"Escaneie o QR Code no seu app autenticador (Google Authenticator, Authy…):"
|
|
1526
1526
|
) }),
|
|
1527
|
-
/* @__PURE__ */ n(
|
|
1528
|
-
/* @__PURE__ */ n(
|
|
1529
|
-
/* @__PURE__ */ C(
|
|
1527
|
+
/* @__PURE__ */ n(rr, { value: i.provisioningUri, size: 180, level: "M" }),
|
|
1528
|
+
/* @__PURE__ */ n(j, { fz: "xs", c: "dimmed", ta: "center", children: $("archbase:mfa.setup.manual", "Ou informe o código manualmente:") }),
|
|
1529
|
+
/* @__PURE__ */ C(ue, { gap: "xs", children: [
|
|
1530
1530
|
/* @__PURE__ */ n(rt, { children: i.secret }),
|
|
1531
|
-
/* @__PURE__ */ n(st, { value: i.secret, children: ({ copied: b, copy:
|
|
1531
|
+
/* @__PURE__ */ n(st, { value: i.secret, children: ({ copied: b, copy: m }) => /* @__PURE__ */ n(G, { size: "xs", variant: "subtle", onClick: m, children: b ? $("archbase:mfa.setup.copied", "Copiado") : $("archbase:mfa.setup.copy", "Copiar") }) })
|
|
1532
1532
|
] }),
|
|
1533
1533
|
/* @__PURE__ */ n(
|
|
1534
1534
|
xe,
|
|
@@ -1537,15 +1537,15 @@ function Gr({
|
|
|
1537
1537
|
label: $("archbase:mfa.setup.confirmCode", "Digite o código gerado para confirmar"),
|
|
1538
1538
|
placeholder: "000000",
|
|
1539
1539
|
value: y,
|
|
1540
|
-
onChange: (b) =>
|
|
1540
|
+
onChange: (b) => S(b.currentTarget.value),
|
|
1541
1541
|
onKeyDown: (b) => {
|
|
1542
|
-
b.key === "Enter" &&
|
|
1542
|
+
b.key === "Enter" && L();
|
|
1543
1543
|
}
|
|
1544
1544
|
}
|
|
1545
1545
|
),
|
|
1546
|
-
/* @__PURE__ */ C(
|
|
1547
|
-
/* @__PURE__ */ n(
|
|
1548
|
-
/* @__PURE__ */ n(
|
|
1546
|
+
/* @__PURE__ */ C(ue, { w: "100%", justify: "flex-end", children: [
|
|
1547
|
+
/* @__PURE__ */ n(G, { variant: "default", onClick: _, disabled: A, children: $("archbase:mfa.setup.cancel", "Cancelar") }),
|
|
1548
|
+
/* @__PURE__ */ n(G, { onClick: L, loading: A, disabled: !y.trim(), children: $("archbase:mfa.setup.confirm", "Confirmar e ativar") })
|
|
1549
1549
|
] })
|
|
1550
1550
|
] }),
|
|
1551
1551
|
a === "recovery" && /* @__PURE__ */ C(Ee, { gap: "sm", children: [
|
|
@@ -1553,59 +1553,59 @@ function Gr({
|
|
|
1553
1553
|
"archbase:mfa.setup.recoveryWarning",
|
|
1554
1554
|
"Guarde estes códigos de recuperação em local seguro. Cada um funciona uma única vez e permite entrar se você perder o acesso ao app autenticador. Eles não serão exibidos novamente."
|
|
1555
1555
|
) }),
|
|
1556
|
-
/* @__PURE__ */ n(
|
|
1557
|
-
/* @__PURE__ */ C(
|
|
1558
|
-
/* @__PURE__ */ n(st, { value:
|
|
1559
|
-
`), children: ({ copied: b, copy:
|
|
1560
|
-
/* @__PURE__ */ n(
|
|
1556
|
+
/* @__PURE__ */ n(Qt, { cols: 2, spacing: "xs", children: h.map((b) => /* @__PURE__ */ n(rt, { fz: "sm", children: b }, b)) }),
|
|
1557
|
+
/* @__PURE__ */ C(ue, { justify: "space-between", children: [
|
|
1558
|
+
/* @__PURE__ */ n(st, { value: h.join(`
|
|
1559
|
+
`), children: ({ copied: b, copy: m }) => /* @__PURE__ */ n(G, { variant: "subtle", onClick: m, children: b ? $("archbase:mfa.setup.copied", "Copiado") : $("archbase:mfa.setup.copyAll", "Copiar todos") }) }),
|
|
1560
|
+
/* @__PURE__ */ n(G, { onClick: _, children: $("archbase:mfa.setup.done", "Guardei os códigos") })
|
|
1561
1561
|
] })
|
|
1562
1562
|
] })
|
|
1563
1563
|
] }) });
|
|
1564
1564
|
}
|
|
1565
|
-
const
|
|
1565
|
+
const kr = {
|
|
1566
1566
|
position: "relative",
|
|
1567
1567
|
width: "90%",
|
|
1568
1568
|
maxWidth: 400,
|
|
1569
1569
|
padding: 30,
|
|
1570
1570
|
marginTop: 30
|
|
1571
1571
|
};
|
|
1572
|
-
function
|
|
1573
|
-
const
|
|
1574
|
-
async function
|
|
1575
|
-
|
|
1576
|
-
ot.showSuccess(`${x().t("archbase:Um e-mail com instruções para redefinir sua senha foi enviado. Verifique sua caixa de entrada.")}`),
|
|
1572
|
+
function Yr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClickBackToLogin: s, validatePassword: o, validateToken: a, initialEmail: c = "", description: i, style: d, passwordPolicy: y, showPasswordRequirements: S = !0 }) {
|
|
1573
|
+
const h = ut(), U = Vt(), { colorScheme: A } = Zt(), [v, E] = p(r ?? ""), [I, M] = p(c), [L, V] = p(""), [_, b] = p(""), [m, R] = p(""), [W, O] = p(!1), [N, P] = p(""), [ee, te] = p(""), [se, g] = p(""), [w, J] = p(""), H = Wt(y);
|
|
1574
|
+
async function ve(B) {
|
|
1575
|
+
B && (Ht(B) ? await e(B).then(() => {
|
|
1576
|
+
ot.showSuccess(`${x().t("archbase:Um e-mail com instruções para redefinir sua senha foi enviado. Verifique sua caixa de entrada.")}`), O(!0);
|
|
1577
1577
|
}).catch(() => {
|
|
1578
|
-
}) :
|
|
1578
|
+
}) : P(`${x().t("archbase:Email inválido")}`));
|
|
1579
1579
|
}
|
|
1580
|
-
async function
|
|
1581
|
-
if (
|
|
1582
|
-
let
|
|
1583
|
-
a && (
|
|
1584
|
-
ot.showSuccess(`${x().t("archbase:Senha redefinida com sucesso.")}`), s(),
|
|
1580
|
+
async function he(B, ce, oe, be) {
|
|
1581
|
+
if (B && ce && oe) {
|
|
1582
|
+
let u = "", l = "", f = "";
|
|
1583
|
+
a && (u = a(ce), te(u)), H && (l = Gt(oe, H).error ?? ""), !l && o && (l = o(oe)), g(l), oe !== be && (f = `${x().t("archbase:A nova senha e a confirmação devem ser iguais.")}`, J(f)), !l && !u && !f && await t(B, ce, oe).then(() => {
|
|
1584
|
+
ot.showSuccess(`${x().t("archbase:Senha redefinida com sucesso.")}`), s(), O(!1);
|
|
1585
1585
|
}).catch(() => {
|
|
1586
|
-
|
|
1586
|
+
E(r || `${x().t("archbase:Erro ao redefinir senha.")}`);
|
|
1587
1587
|
});
|
|
1588
1588
|
}
|
|
1589
1589
|
}
|
|
1590
|
-
return
|
|
1591
|
-
r &&
|
|
1592
|
-
}, [r]),
|
|
1593
|
-
|
|
1594
|
-
}, [
|
|
1590
|
+
return Y(() => {
|
|
1591
|
+
r && E(r);
|
|
1592
|
+
}, [r]), Y(() => {
|
|
1593
|
+
E("");
|
|
1594
|
+
}, [I, L, _, m]), /* @__PURE__ */ C(
|
|
1595
1595
|
He,
|
|
1596
1596
|
{
|
|
1597
1597
|
withBorder: !0,
|
|
1598
1598
|
shadow: "md",
|
|
1599
1599
|
radius: "md",
|
|
1600
|
-
ref:
|
|
1600
|
+
ref: h,
|
|
1601
1601
|
style: {
|
|
1602
|
-
...
|
|
1603
|
-
...
|
|
1602
|
+
...kr,
|
|
1603
|
+
...d
|
|
1604
1604
|
},
|
|
1605
1605
|
children: [
|
|
1606
|
-
|
|
1606
|
+
W ? /* @__PURE__ */ C(ie, { children: [
|
|
1607
1607
|
/* @__PURE__ */ n(
|
|
1608
|
-
|
|
1608
|
+
j,
|
|
1609
1609
|
{
|
|
1610
1610
|
c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
|
|
1611
1611
|
fw: 800,
|
|
@@ -1621,12 +1621,12 @@ function Jr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
|
|
|
1621
1621
|
{
|
|
1622
1622
|
label: x().t("archbase:Código de segurança"),
|
|
1623
1623
|
placeholder: `${x().t("archbase:Código enviado no seu e-mail")}`,
|
|
1624
|
-
value:
|
|
1624
|
+
value: L || "",
|
|
1625
1625
|
required: !0,
|
|
1626
|
-
onChange: (
|
|
1627
|
-
|
|
1626
|
+
onChange: (B) => {
|
|
1627
|
+
V(B.currentTarget.value), te("");
|
|
1628
1628
|
},
|
|
1629
|
-
error:
|
|
1629
|
+
error: ee
|
|
1630
1630
|
}
|
|
1631
1631
|
),
|
|
1632
1632
|
/* @__PURE__ */ n(
|
|
@@ -1634,12 +1634,20 @@ function Jr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
|
|
|
1634
1634
|
{
|
|
1635
1635
|
label: x().t("archbase:Nova senha"),
|
|
1636
1636
|
placeholder: x().t("archbase:Nova senha"),
|
|
1637
|
-
onChange: (
|
|
1638
|
-
|
|
1637
|
+
onChange: (B) => {
|
|
1638
|
+
b(B.currentTarget.value), g(""), J("");
|
|
1639
1639
|
},
|
|
1640
|
-
value:
|
|
1640
|
+
value: _,
|
|
1641
1641
|
required: !0,
|
|
1642
|
-
error:
|
|
1642
|
+
error: se
|
|
1643
|
+
}
|
|
1644
|
+
),
|
|
1645
|
+
H && /* @__PURE__ */ n(
|
|
1646
|
+
sr,
|
|
1647
|
+
{
|
|
1648
|
+
value: _,
|
|
1649
|
+
policy: H,
|
|
1650
|
+
showRequirements: S
|
|
1643
1651
|
}
|
|
1644
1652
|
),
|
|
1645
1653
|
/* @__PURE__ */ n(
|
|
@@ -1647,39 +1655,39 @@ function Jr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
|
|
|
1647
1655
|
{
|
|
1648
1656
|
label: x().t("archbase:Confirmar senha"),
|
|
1649
1657
|
placeholder: x().t("archbase:Confirmar senha"),
|
|
1650
|
-
onChange: (
|
|
1651
|
-
|
|
1658
|
+
onChange: (B) => {
|
|
1659
|
+
R(B.currentTarget.value), J("");
|
|
1652
1660
|
},
|
|
1653
|
-
value:
|
|
1661
|
+
value: m || "",
|
|
1654
1662
|
required: !0,
|
|
1655
|
-
error:
|
|
1663
|
+
error: w
|
|
1656
1664
|
}
|
|
1657
1665
|
),
|
|
1658
1666
|
/* @__PURE__ */ n(
|
|
1659
|
-
|
|
1667
|
+
G,
|
|
1660
1668
|
{
|
|
1661
|
-
disabled: !
|
|
1669
|
+
disabled: !I || !L || !_ || !m,
|
|
1662
1670
|
mt: "md",
|
|
1663
1671
|
fullWidth: !0,
|
|
1664
|
-
onClick: () =>
|
|
1672
|
+
onClick: () => he(I, L, _, m),
|
|
1665
1673
|
children: `${x().t("archbase:Redefinir senha")}`
|
|
1666
1674
|
}
|
|
1667
1675
|
),
|
|
1668
1676
|
/* @__PURE__ */ n(
|
|
1669
|
-
|
|
1677
|
+
G,
|
|
1670
1678
|
{
|
|
1671
1679
|
mt: "6px",
|
|
1672
1680
|
fullWidth: !0,
|
|
1673
|
-
color:
|
|
1681
|
+
color: A === "dark" ? U.colors.dark[4] : U.colors.gray[7],
|
|
1674
1682
|
onClick: () => {
|
|
1675
|
-
|
|
1683
|
+
N || O(!1);
|
|
1676
1684
|
},
|
|
1677
1685
|
children: `${x().t("archbase:Voltar")}`
|
|
1678
1686
|
}
|
|
1679
1687
|
)
|
|
1680
|
-
] }) : /* @__PURE__ */ C(
|
|
1688
|
+
] }) : /* @__PURE__ */ C(ie, { children: [
|
|
1681
1689
|
/* @__PURE__ */ n(
|
|
1682
|
-
|
|
1690
|
+
j,
|
|
1683
1691
|
{
|
|
1684
1692
|
c: "light-dark(var(--mantine-color-black), var(--mantine-color-white))",
|
|
1685
1693
|
fw: 800,
|
|
@@ -1689,261 +1697,261 @@ function Jr({ error: r, onSendResetPasswordEmail: e, onResetPassword: t, onClick
|
|
|
1689
1697
|
children: x().t("archbase:Redefinir senha")
|
|
1690
1698
|
}
|
|
1691
1699
|
),
|
|
1692
|
-
/* @__PURE__ */ n(
|
|
1700
|
+
/* @__PURE__ */ n(j, { c: "dimmed", fz: 14, style: { textAlign: "justify" }, children: i }),
|
|
1693
1701
|
/* @__PURE__ */ n(Ue, { m: "md" }),
|
|
1694
1702
|
/* @__PURE__ */ n(
|
|
1695
1703
|
xe,
|
|
1696
1704
|
{
|
|
1697
1705
|
label: "Email",
|
|
1698
1706
|
placeholder: `${x().t("archbase:usuario@email.com")}`,
|
|
1699
|
-
value:
|
|
1707
|
+
value: I || "",
|
|
1700
1708
|
required: !0,
|
|
1701
|
-
onChange: (
|
|
1702
|
-
|
|
1709
|
+
onChange: (B) => {
|
|
1710
|
+
M(B.currentTarget.value), P("");
|
|
1703
1711
|
},
|
|
1704
|
-
error:
|
|
1712
|
+
error: N
|
|
1705
1713
|
}
|
|
1706
1714
|
),
|
|
1707
1715
|
/* @__PURE__ */ n(
|
|
1708
|
-
|
|
1716
|
+
G,
|
|
1709
1717
|
{
|
|
1710
|
-
disabled: !
|
|
1718
|
+
disabled: !I,
|
|
1711
1719
|
mt: "md",
|
|
1712
1720
|
fullWidth: !0,
|
|
1713
|
-
onClick: () =>
|
|
1721
|
+
onClick: () => ve(I),
|
|
1714
1722
|
children: `${x().t("archbase:Enviar")}`
|
|
1715
1723
|
}
|
|
1716
1724
|
),
|
|
1717
1725
|
/* @__PURE__ */ n(
|
|
1718
|
-
|
|
1726
|
+
G,
|
|
1719
1727
|
{
|
|
1720
1728
|
mt: "6px",
|
|
1721
1729
|
fullWidth: !0,
|
|
1722
|
-
color:
|
|
1730
|
+
color: A === "dark" ? U.colors.dark[4] : U.colors.gray[7],
|
|
1723
1731
|
onClick: () => s && s(),
|
|
1724
1732
|
children: `${x().t("archbase:Voltar")}`
|
|
1725
1733
|
}
|
|
1726
1734
|
)
|
|
1727
1735
|
] }),
|
|
1728
|
-
|
|
1736
|
+
v ? /* @__PURE__ */ n(j, { c: "red", style: { textAlign: "justify" }, children: v }) : null
|
|
1729
1737
|
]
|
|
1730
1738
|
}
|
|
1731
1739
|
);
|
|
1732
1740
|
}
|
|
1733
|
-
const
|
|
1734
|
-
const s = lt(Rt), o =
|
|
1741
|
+
const Sr = () => Jt().user, Rt = "archbaseSecurityManagerStore", Xr = ({ resourceName: r, resourceDescription: e, enableSecurity: t = !0 }) => {
|
|
1742
|
+
const s = lt(Rt), o = Sr(), a = o?.isAdmin ?? !1, c = o?.id, i = ct(c), d = at(() => {
|
|
1735
1743
|
if (!t)
|
|
1736
1744
|
return null;
|
|
1737
1745
|
const y = c ? `${r}_${c}` : r;
|
|
1738
1746
|
if (s && s.existsValue(y)) {
|
|
1739
|
-
const
|
|
1740
|
-
if (
|
|
1741
|
-
return
|
|
1747
|
+
const h = s.getValue(y);
|
|
1748
|
+
if (h && h.isAdmin === a)
|
|
1749
|
+
return h;
|
|
1742
1750
|
}
|
|
1743
|
-
const
|
|
1744
|
-
return s && c && s.setValue(y,
|
|
1751
|
+
const S = new wt(r, e, a);
|
|
1752
|
+
return s && c && s.setValue(y, S), S;
|
|
1745
1753
|
}, [t, r, e, a, c]);
|
|
1746
|
-
return
|
|
1754
|
+
return Y(() => {
|
|
1747
1755
|
i.current = c;
|
|
1748
|
-
}, [c]), { securityManager:
|
|
1756
|
+
}, [c]), { securityManager: d };
|
|
1749
1757
|
};
|
|
1750
1758
|
function $e(r) {
|
|
1751
1759
|
const e = r?.response?.data ?? r?.data ?? r;
|
|
1752
1760
|
return e?.error === "CREDENTIALS_EXPIRED" || e?.requirePasswordChange === !0;
|
|
1753
1761
|
}
|
|
1754
|
-
const
|
|
1762
|
+
const Qr = ({
|
|
1755
1763
|
checkIntervalTokenHasExpired: r = 3e4,
|
|
1756
1764
|
// Verificar a 30 segundos
|
|
1757
1765
|
expirationThresholdOfToken: e = 300
|
|
1758
1766
|
// Antecipar em 5 minutos
|
|
1759
1767
|
}) => {
|
|
1760
1768
|
const t = De(
|
|
1761
|
-
(u) => u.get(
|
|
1769
|
+
(u) => u.get(X.TokenManager)
|
|
1762
1770
|
), s = De(
|
|
1763
|
-
(u) => u.get(
|
|
1764
|
-
), [o, a] = p(null), [c, i] = p(!1), [
|
|
1771
|
+
(u) => u.get(X.Authenticator)
|
|
1772
|
+
), [o, a] = p(null), [c, i] = p(!1), [d, y] = p(!0), [S, h] = p(!1), [U, A] = p(!1), [v, E] = p(""), [I, M] = p(""), [L, V] = p(null), [_, b] = p(!1), [m, R] = p(!1), [W, O] = p(null), N = lt(Rt), P = {
|
|
1765
1773
|
hasContextualLogin: typeof s.loginWithContext == "function",
|
|
1766
1774
|
hasFlexibleLogin: typeof s.loginFlexible == "function",
|
|
1767
1775
|
hasSocialLogin: typeof s.loginSocial == "function",
|
|
1768
1776
|
hasRegistration: typeof s.register == "function",
|
|
1769
1777
|
hasContextSupport: typeof t.saveContext == "function"
|
|
1770
1778
|
};
|
|
1771
|
-
|
|
1779
|
+
Y(() => {
|
|
1772
1780
|
const u = t.getUsername();
|
|
1773
|
-
if (u && u != "" &&
|
|
1774
|
-
const
|
|
1775
|
-
if (
|
|
1781
|
+
if (u && u != "" && M(u), P.hasContextSupport && t.getContext) {
|
|
1782
|
+
const f = t.getContext();
|
|
1783
|
+
if (f)
|
|
1776
1784
|
try {
|
|
1777
|
-
const
|
|
1778
|
-
|
|
1779
|
-
} catch (
|
|
1780
|
-
console.warn("Erro ao carregar contexto salvo:",
|
|
1785
|
+
const D = typeof f == "string" ? JSON.parse(f) : f;
|
|
1786
|
+
V(D);
|
|
1787
|
+
} catch (D) {
|
|
1788
|
+
console.warn("Erro ao carregar contexto salvo:", D);
|
|
1781
1789
|
}
|
|
1782
1790
|
}
|
|
1783
|
-
const
|
|
1784
|
-
|
|
1791
|
+
const l = t.getToken();
|
|
1792
|
+
l && (h(!0), E(""), A(!1), a(l)), y(!1);
|
|
1785
1793
|
}, []);
|
|
1786
|
-
const
|
|
1787
|
-
A(!1),
|
|
1788
|
-
},
|
|
1789
|
-
|
|
1790
|
-
},
|
|
1791
|
-
i(!1),
|
|
1792
|
-
},
|
|
1794
|
+
const ee = () => {
|
|
1795
|
+
A(!1), E("");
|
|
1796
|
+
}, te = () => {
|
|
1797
|
+
R(!1);
|
|
1798
|
+
}, se = (u) => {
|
|
1799
|
+
i(!1), h(!1), t.clearToken(), u && t.clearUsernameAndPassword(), P.hasContextSupport && t.clearContext && t.clearContext(), M(""), V(null), E(""), A(!1), R(!1), N.clearAllValues();
|
|
1800
|
+
}, g = async (u, l, f) => {
|
|
1793
1801
|
try {
|
|
1794
|
-
i(!0),
|
|
1795
|
-
const
|
|
1796
|
-
t.saveToken(
|
|
1797
|
-
} catch (
|
|
1798
|
-
i(!1),
|
|
1802
|
+
i(!0), h(!1);
|
|
1803
|
+
const D = await s.login(u, l);
|
|
1804
|
+
t.saveToken(D), f && t.saveUsernameAndPassword(u, l), t.saveUsername(u), M(u), a(D), i(!1), h(!0);
|
|
1805
|
+
} catch (D) {
|
|
1806
|
+
i(!1), h(!1), $e(D) && (M(u), R(!0)), E(ne(D)), A(!0);
|
|
1799
1807
|
}
|
|
1800
|
-
},
|
|
1801
|
-
if (!
|
|
1808
|
+
}, w = async (u, l = !1) => {
|
|
1809
|
+
if (!P.hasContextualLogin || !s.loginWithContext)
|
|
1802
1810
|
throw new Error("Login contextual não suportado por esta implementação do ArchbaseAuthenticator");
|
|
1803
1811
|
try {
|
|
1804
|
-
i(!0),
|
|
1805
|
-
const { context:
|
|
1806
|
-
if (
|
|
1807
|
-
O(
|
|
1812
|
+
i(!0), h(!1);
|
|
1813
|
+
const { context: f, user: D, ...z } = await s.loginWithContext(u);
|
|
1814
|
+
if (z.mfa_required) {
|
|
1815
|
+
O(z.challenge_token ?? null), b(!0), M(u.email), i(!1);
|
|
1808
1816
|
return;
|
|
1809
1817
|
}
|
|
1810
1818
|
const Ae = {
|
|
1811
1819
|
scope: "",
|
|
1812
|
-
ext_expires_in:
|
|
1813
|
-
...
|
|
1820
|
+
ext_expires_in: z.expires_in,
|
|
1821
|
+
...z
|
|
1814
1822
|
};
|
|
1815
|
-
t.saveToken(Ae),
|
|
1816
|
-
} catch (
|
|
1817
|
-
throw i(!1),
|
|
1823
|
+
t.saveToken(Ae), l ? t.saveUsernameAndPassword(u.email, u.password) : t.clearUsernameAndPassword(), t.saveUsername(u.email), P.hasContextSupport && t.saveContext && f && (t.saveContext(JSON.stringify(f)), V(f)), M(u.email), a(Ae), i(!1), h(!0);
|
|
1824
|
+
} catch (f) {
|
|
1825
|
+
throw i(!1), h(!1), $e(f) && (M(u.email), R(!0)), E(ne(f)), A(!0), f;
|
|
1818
1826
|
}
|
|
1819
|
-
},
|
|
1827
|
+
}, J = async (u) => {
|
|
1820
1828
|
if (!s.verifyMfa)
|
|
1821
1829
|
throw new Error("verifyMfa não suportado por esta implementação do ArchbaseAuthenticator");
|
|
1822
|
-
if (!
|
|
1830
|
+
if (!W)
|
|
1823
1831
|
throw new Error("Nenhum desafio de MFA pendente");
|
|
1824
1832
|
try {
|
|
1825
|
-
i(!0),
|
|
1826
|
-
const
|
|
1827
|
-
t.saveToken(
|
|
1828
|
-
} catch (
|
|
1829
|
-
throw i(!1),
|
|
1833
|
+
i(!0), E(""), A(!1);
|
|
1834
|
+
const l = await s.verifyMfa(W, u);
|
|
1835
|
+
t.saveToken(l), t.saveUsername(I), a(l), b(!1), O(null), i(!1), h(!0);
|
|
1836
|
+
} catch (l) {
|
|
1837
|
+
throw i(!1), E(ne(l)), A(!0), l;
|
|
1830
1838
|
}
|
|
1831
|
-
},
|
|
1832
|
-
b(!1), O(null),
|
|
1833
|
-
},
|
|
1834
|
-
if (!
|
|
1839
|
+
}, H = () => {
|
|
1840
|
+
b(!1), O(null), E(""), A(!1);
|
|
1841
|
+
}, ve = async (u, l = !1) => {
|
|
1842
|
+
if (!P.hasFlexibleLogin || !s.loginFlexible)
|
|
1835
1843
|
throw new Error("Login flexível não suportado por esta implementação do ArchbaseAuthenticator");
|
|
1836
1844
|
try {
|
|
1837
|
-
i(!0),
|
|
1838
|
-
const { context:
|
|
1845
|
+
i(!0), h(!1);
|
|
1846
|
+
const { context: f, user: D, ...z } = await s.loginFlexible(u), Ae = {
|
|
1839
1847
|
scope: "",
|
|
1840
|
-
ext_expires_in:
|
|
1841
|
-
...
|
|
1848
|
+
ext_expires_in: z.expires_in,
|
|
1849
|
+
...z
|
|
1842
1850
|
};
|
|
1843
|
-
t.saveToken(Ae),
|
|
1844
|
-
} catch (
|
|
1845
|
-
throw i(!1),
|
|
1851
|
+
t.saveToken(Ae), l && t.saveUsernameAndPassword(u.identifier, u.password), t.saveUsername(D.email || u.identifier), P.hasContextSupport && t.saveContext && f && (t.saveContext(JSON.stringify(f)), V(f)), M(D.email || u.identifier), a(Ae), i(!1), h(!0);
|
|
1852
|
+
} catch (f) {
|
|
1853
|
+
throw i(!1), h(!1), $e(f) && (M(u.identifier), R(!0)), E(ne(f)), A(!0), f;
|
|
1846
1854
|
}
|
|
1847
|
-
},
|
|
1848
|
-
if (!
|
|
1855
|
+
}, he = async (u) => {
|
|
1856
|
+
if (!P.hasSocialLogin || !s.loginSocial)
|
|
1849
1857
|
throw new Error("Login social não suportado por esta implementação do ArchbaseAuthenticator");
|
|
1850
1858
|
try {
|
|
1851
|
-
i(!0),
|
|
1852
|
-
const { context:
|
|
1859
|
+
i(!0), h(!1);
|
|
1860
|
+
const { context: l, user: f, ...D } = await s.loginSocial(u), z = {
|
|
1853
1861
|
scope: "",
|
|
1854
|
-
ext_expires_in:
|
|
1855
|
-
...
|
|
1862
|
+
ext_expires_in: D.expires_in,
|
|
1863
|
+
...D
|
|
1856
1864
|
};
|
|
1857
|
-
t.saveToken(
|
|
1858
|
-
} catch (
|
|
1859
|
-
throw i(!1),
|
|
1865
|
+
t.saveToken(z), t.saveUsername(f.email), P.hasContextSupport && t.saveContext && l && (t.saveContext(JSON.stringify(l)), V(l)), M(f.email), a(z), i(!1), h(!0);
|
|
1866
|
+
} catch (l) {
|
|
1867
|
+
throw i(!1), h(!1), E(ne(l)), A(!0), l;
|
|
1860
1868
|
}
|
|
1861
|
-
},
|
|
1862
|
-
if (!
|
|
1869
|
+
}, B = async (u) => {
|
|
1870
|
+
if (!P.hasRegistration || !s.register)
|
|
1863
1871
|
throw new Error("Registro não suportado por esta implementação do ArchbaseAuthenticator");
|
|
1864
1872
|
try {
|
|
1865
1873
|
i(!0);
|
|
1866
|
-
const
|
|
1867
|
-
return i(!1),
|
|
1868
|
-
} catch (
|
|
1869
|
-
throw i(!1),
|
|
1874
|
+
const l = await s.register(u);
|
|
1875
|
+
return i(!1), l;
|
|
1876
|
+
} catch (l) {
|
|
1877
|
+
throw i(!1), E(ne(l)), A(!0), l;
|
|
1870
1878
|
}
|
|
1871
|
-
},
|
|
1872
|
-
|
|
1879
|
+
}, ce = async () => s.getSupportedContexts ? await s.getSupportedContexts() : { supportedContexts: ["DEFAULT"], defaultContext: "DEFAULT" }, oe = async (u) => s.validateContext ? await s.validateContext(u) : { context: u, supported: u === "DEFAULT" };
|
|
1880
|
+
Y(() => {
|
|
1873
1881
|
const u = setInterval(() => {
|
|
1874
|
-
o && o.access_token && t.isTokenExpired(o, e) &&
|
|
1882
|
+
o && o.access_token && t.isTokenExpired(o, e) && be();
|
|
1875
1883
|
}, r);
|
|
1876
1884
|
return () => {
|
|
1877
1885
|
clearInterval(u);
|
|
1878
1886
|
};
|
|
1879
1887
|
}, [o]);
|
|
1880
|
-
const
|
|
1888
|
+
const be = async () => {
|
|
1881
1889
|
if (o)
|
|
1882
1890
|
try {
|
|
1883
1891
|
const u = await s.refreshToken(o?.refresh_token);
|
|
1884
1892
|
t.saveToken(u), a(u);
|
|
1885
1893
|
} catch (u) {
|
|
1886
|
-
console.error("Erro ao renovar o token:", u),
|
|
1894
|
+
console.error("Erro ao renovar o token:", u), se();
|
|
1887
1895
|
}
|
|
1888
1896
|
};
|
|
1889
1897
|
return {
|
|
1890
1898
|
// Métodos básicos (compatibilidade)
|
|
1891
|
-
login:
|
|
1892
|
-
logout:
|
|
1893
|
-
username:
|
|
1894
|
-
isAuthenticated:
|
|
1899
|
+
login: g,
|
|
1900
|
+
logout: se,
|
|
1901
|
+
username: I,
|
|
1902
|
+
isAuthenticated: S,
|
|
1895
1903
|
isAuthenticating: c,
|
|
1896
|
-
isInitializing:
|
|
1897
|
-
isError:
|
|
1898
|
-
error:
|
|
1899
|
-
clearError:
|
|
1904
|
+
isInitializing: d,
|
|
1905
|
+
isError: U,
|
|
1906
|
+
error: v,
|
|
1907
|
+
clearError: ee,
|
|
1900
1908
|
accessToken: o ? o.access_token : null,
|
|
1901
1909
|
// Métodos opcionais para autenticação avançada
|
|
1902
|
-
loginWithContext:
|
|
1903
|
-
loginFlexible:
|
|
1904
|
-
loginSocial:
|
|
1905
|
-
register:
|
|
1906
|
-
getSupportedContexts:
|
|
1907
|
-
validateContext:
|
|
1910
|
+
loginWithContext: P.hasContextualLogin ? w : void 0,
|
|
1911
|
+
loginFlexible: P.hasFlexibleLogin ? ve : void 0,
|
|
1912
|
+
loginSocial: P.hasSocialLogin ? he : void 0,
|
|
1913
|
+
register: P.hasRegistration ? B : void 0,
|
|
1914
|
+
getSupportedContexts: ce,
|
|
1915
|
+
validateContext: oe,
|
|
1908
1916
|
// MFA / segundo fator (2 passos)
|
|
1909
|
-
mfaRequired:
|
|
1910
|
-
verifyMfa: typeof s.verifyMfa == "function" ?
|
|
1911
|
-
cancelMfa:
|
|
1917
|
+
mfaRequired: _,
|
|
1918
|
+
verifyMfa: typeof s.verifyMfa == "function" ? J : void 0,
|
|
1919
|
+
cancelMfa: H,
|
|
1912
1920
|
// Troca de senha obrigatória (CREDENTIALS_EXPIRED)
|
|
1913
|
-
passwordChangeRequired:
|
|
1914
|
-
clearPasswordChangeRequired:
|
|
1921
|
+
passwordChangeRequired: m,
|
|
1922
|
+
clearPasswordChangeRequired: te,
|
|
1915
1923
|
// Informações de contexto
|
|
1916
|
-
context:
|
|
1924
|
+
context: L,
|
|
1917
1925
|
// Detecção de capacidades
|
|
1918
|
-
capabilities:
|
|
1926
|
+
capabilities: P
|
|
1919
1927
|
};
|
|
1920
|
-
},
|
|
1928
|
+
}, Zr = () => {
|
|
1921
1929
|
const r = De(
|
|
1922
|
-
(s) => s.get(
|
|
1930
|
+
(s) => s.get(X.TokenManager)
|
|
1923
1931
|
), [e, t] = p(null);
|
|
1924
|
-
return
|
|
1932
|
+
return Y(() => {
|
|
1925
1933
|
const s = r.getToken();
|
|
1926
1934
|
s && t(s.access_token);
|
|
1927
1935
|
}, []), {
|
|
1928
1936
|
token: e
|
|
1929
1937
|
};
|
|
1930
|
-
},
|
|
1938
|
+
}, es = () => {
|
|
1931
1939
|
const r = De(
|
|
1932
|
-
(
|
|
1940
|
+
(d) => d.get(X.Authenticator)
|
|
1933
1941
|
), [e, t] = p(!1), [s, o] = p("");
|
|
1934
1942
|
return {
|
|
1935
|
-
sendResetPasswordEmail: async (
|
|
1943
|
+
sendResetPasswordEmail: async (d) => {
|
|
1936
1944
|
try {
|
|
1937
|
-
return await r.sendResetPasswordEmail(
|
|
1945
|
+
return await r.sendResetPasswordEmail(d);
|
|
1938
1946
|
} catch (y) {
|
|
1939
|
-
throw o(
|
|
1947
|
+
throw o(ne(y)), t(!0), y;
|
|
1940
1948
|
}
|
|
1941
1949
|
},
|
|
1942
|
-
resetPassword: async (
|
|
1950
|
+
resetPassword: async (d, y, S) => {
|
|
1943
1951
|
try {
|
|
1944
|
-
return await r.resetPassword(
|
|
1945
|
-
} catch (
|
|
1946
|
-
throw o(
|
|
1952
|
+
return await r.resetPassword(d, y, S);
|
|
1953
|
+
} catch (h) {
|
|
1954
|
+
throw o(ne(h)), t(!0), h;
|
|
1947
1955
|
}
|
|
1948
1956
|
},
|
|
1949
1957
|
isError: e,
|
|
@@ -1952,36 +1960,36 @@ const qr = ({
|
|
|
1952
1960
|
t(!1), o("");
|
|
1953
1961
|
}
|
|
1954
1962
|
};
|
|
1955
|
-
},
|
|
1956
|
-
/* @__PURE__ */ C(
|
|
1963
|
+
}, Cr = () => /* @__PURE__ */ n(er, { p: "xl", style: { width: "100%", height: "100%" }, children: /* @__PURE__ */ C(Ee, { gap: "md", children: [
|
|
1964
|
+
/* @__PURE__ */ C(ue, { gap: "sm", children: [
|
|
1957
1965
|
/* @__PURE__ */ n(dt, { size: "sm" }),
|
|
1958
|
-
/* @__PURE__ */ n(
|
|
1966
|
+
/* @__PURE__ */ n(j, { size: "sm", c: "dimmed", children: "Carregando permissões..." })
|
|
1959
1967
|
] }),
|
|
1960
1968
|
/* @__PURE__ */ n(Ie, { height: 40, radius: "sm" }),
|
|
1961
1969
|
/* @__PURE__ */ n(Ie, { height: 200, radius: "sm" }),
|
|
1962
|
-
/* @__PURE__ */ C(
|
|
1970
|
+
/* @__PURE__ */ C(ue, { gap: "md", children: [
|
|
1963
1971
|
/* @__PURE__ */ n(Ie, { height: 36, width: 100, radius: "sm" }),
|
|
1964
1972
|
/* @__PURE__ */ n(Ie, { height: 36, width: 100, radius: "sm" })
|
|
1965
1973
|
] })
|
|
1966
|
-
] }) }), Ye = Ve(null),
|
|
1974
|
+
] }) }), Ye = Ve(null), ts = ({
|
|
1967
1975
|
children: r,
|
|
1968
1976
|
user: e,
|
|
1969
1977
|
onError: t
|
|
1970
1978
|
}) => {
|
|
1971
|
-
const [s, o] = p(!1), [a, c] = p(null), [i] = p([]),
|
|
1972
|
-
c(
|
|
1979
|
+
const [s, o] = p(!1), [a, c] = p(null), [i] = p([]), d = e?.isAdministrator || !1, y = Ce((v) => d ? !0 : i.includes(v), [i, d]), S = Ce((v) => d ? !0 : v.some((E) => i.includes(E)), [i, d]), h = Ce((v) => d ? !0 : v.every((E) => i.includes(E)), [i, d]), U = Ce((v) => {
|
|
1980
|
+
c(v), v && t && t(v);
|
|
1973
1981
|
}, [t]), A = {
|
|
1974
1982
|
user: e,
|
|
1975
1983
|
isLoading: s,
|
|
1976
1984
|
hasGlobalPermission: y,
|
|
1977
|
-
hasAnyGlobalPermission:
|
|
1978
|
-
hasAllGlobalPermissions:
|
|
1979
|
-
isAdmin:
|
|
1985
|
+
hasAnyGlobalPermission: S,
|
|
1986
|
+
hasAllGlobalPermissions: h,
|
|
1987
|
+
isAdmin: d,
|
|
1980
1988
|
error: a,
|
|
1981
|
-
setError:
|
|
1989
|
+
setError: U
|
|
1982
1990
|
};
|
|
1983
1991
|
return /* @__PURE__ */ n(Ye.Provider, { value: A, children: r });
|
|
1984
|
-
},
|
|
1992
|
+
}, Mt = Ve(null), Ir = ({
|
|
1985
1993
|
children: r,
|
|
1986
1994
|
resourceName: e,
|
|
1987
1995
|
resourceDescription: t,
|
|
@@ -1991,38 +1999,38 @@ const qr = ({
|
|
|
1991
1999
|
onSecurityReady: c,
|
|
1992
2000
|
onError: i
|
|
1993
2001
|
}) => {
|
|
1994
|
-
const
|
|
1995
|
-
if (!
|
|
2002
|
+
const d = We(Ye);
|
|
2003
|
+
if (!d)
|
|
1996
2004
|
throw new Error("ArchbaseViewSecurityProvider deve ser usado dentro de um ArchbaseSecurityProvider");
|
|
1997
|
-
const { user: y, isAdmin:
|
|
2005
|
+
const { user: y, isAdmin: S } = d, [h, U] = p(null), [A, v] = p(!0), [E, I] = p(null);
|
|
1998
2006
|
if (it.useEffect(() => {
|
|
1999
2007
|
if (!y) {
|
|
2000
|
-
|
|
2008
|
+
v(!1);
|
|
2001
2009
|
return;
|
|
2002
2010
|
}
|
|
2003
|
-
const
|
|
2011
|
+
const m = new wt(e, t, S);
|
|
2004
2012
|
(async () => {
|
|
2005
|
-
|
|
2013
|
+
v(!0);
|
|
2006
2014
|
try {
|
|
2007
|
-
await
|
|
2008
|
-
|
|
2015
|
+
await m.apply(() => {
|
|
2016
|
+
U(m), v(!1), c && c(m);
|
|
2009
2017
|
});
|
|
2010
2018
|
} catch {
|
|
2011
|
-
const O =
|
|
2012
|
-
|
|
2019
|
+
const O = m.getError() || "Erro ao carregar permissões";
|
|
2020
|
+
I(O), v(!1), i && i(O);
|
|
2013
2021
|
}
|
|
2014
2022
|
})();
|
|
2015
|
-
}, [e, t, y,
|
|
2016
|
-
return a ? /* @__PURE__ */ n(
|
|
2017
|
-
if (
|
|
2023
|
+
}, [e, t, y, S, c, i]), A)
|
|
2024
|
+
return a ? /* @__PURE__ */ n(ie, { children: a }) : /* @__PURE__ */ n(Cr, {});
|
|
2025
|
+
if (E)
|
|
2018
2026
|
return /* @__PURE__ */ n("div", { className: "archbase-security-error", children: /* @__PURE__ */ C("div", { children: [
|
|
2019
2027
|
"Erro ao carregar permissões: ",
|
|
2020
|
-
|
|
2028
|
+
E
|
|
2021
2029
|
] }) });
|
|
2022
2030
|
if (!y)
|
|
2023
2031
|
return o || /* @__PURE__ */ n("div", { className: "archbase-security-no-user", children: /* @__PURE__ */ n("div", { children: "É necessário fazer login para acessar esta área" }) });
|
|
2024
|
-
if (s.length > 0 &&
|
|
2025
|
-
(
|
|
2032
|
+
if (s.length > 0 && h && !s.every(
|
|
2033
|
+
(R) => h.hasPermission(R)
|
|
2026
2034
|
))
|
|
2027
2035
|
return o || /* @__PURE__ */ C("div", { className: "archbase-security-access-denied", children: [
|
|
2028
2036
|
/* @__PURE__ */ n("div", { children: "Você não possui permissão para acessar esta área" }),
|
|
@@ -2032,29 +2040,29 @@ const qr = ({
|
|
|
2032
2040
|
] })
|
|
2033
2041
|
] });
|
|
2034
2042
|
const b = {
|
|
2035
|
-
securityManager:
|
|
2036
|
-
hasPermission: (
|
|
2037
|
-
hasAnyPermission: (
|
|
2038
|
-
hasAllPermissions: (
|
|
2039
|
-
registerAction: (
|
|
2040
|
-
|
|
2043
|
+
securityManager: h,
|
|
2044
|
+
hasPermission: (m) => h?.hasPermission(m) || !1,
|
|
2045
|
+
hasAnyPermission: (m) => m.some((R) => h?.hasPermission(R) || !1),
|
|
2046
|
+
hasAllPermissions: (m) => m.every((R) => h?.hasPermission(R) || !1),
|
|
2047
|
+
registerAction: (m, R) => {
|
|
2048
|
+
h?.registerAction(m, R);
|
|
2041
2049
|
},
|
|
2042
2050
|
isLoading: A,
|
|
2043
|
-
error:
|
|
2051
|
+
error: E
|
|
2044
2052
|
};
|
|
2045
|
-
return /* @__PURE__ */ n(
|
|
2046
|
-
},
|
|
2053
|
+
return /* @__PURE__ */ n(Mt.Provider, { value: b, children: r });
|
|
2054
|
+
}, Pr = () => {
|
|
2047
2055
|
const r = We(Ye);
|
|
2048
2056
|
if (!r)
|
|
2049
2057
|
throw new Error("useArchbaseSecurity deve ser usado dentro de um ArchbaseSecurityProvider");
|
|
2050
2058
|
return r;
|
|
2051
2059
|
}, Xe = () => {
|
|
2052
|
-
const r = We(
|
|
2060
|
+
const r = We(Mt);
|
|
2053
2061
|
if (!r)
|
|
2054
2062
|
throw new Error("useArchbaseViewSecurity deve ser usado dentro de um ArchbaseViewSecurityProvider");
|
|
2055
2063
|
return r;
|
|
2056
|
-
},
|
|
2057
|
-
const t = Xe(), { hasPermission: s, hasAnyPermission: o, hasAllPermissions: a, registerAction: c, securityManager: i, isLoading:
|
|
2064
|
+
}, rs = (r, e) => {
|
|
2065
|
+
const t = Xe(), { hasPermission: s, hasAnyPermission: o, hasAllPermissions: a, registerAction: c, securityManager: i, isLoading: d, error: y } = t;
|
|
2058
2066
|
return it.useEffect(() => {
|
|
2059
2067
|
r && e && (c("create", `Criar ${e}`), c("edit", `Editar ${e}`), c("delete", `Deletar ${e}`), c("view", `Visualizar ${e}`), c("list", `Listar ${e}`));
|
|
2060
2068
|
}, [r, e, c]), {
|
|
@@ -2068,18 +2076,18 @@ const qr = ({
|
|
|
2068
2076
|
canDelete: s("delete"),
|
|
2069
2077
|
canView: s("view"),
|
|
2070
2078
|
canList: s("list"),
|
|
2071
|
-
isLoading:
|
|
2079
|
+
isLoading: d,
|
|
2072
2080
|
error: y
|
|
2073
2081
|
};
|
|
2074
|
-
},
|
|
2082
|
+
}, ss = () => {
|
|
2075
2083
|
const r = Xe();
|
|
2076
2084
|
return {
|
|
2077
2085
|
check: r.hasPermission,
|
|
2078
2086
|
checkAny: r.hasAnyPermission,
|
|
2079
2087
|
checkAll: r.hasAllPermissions,
|
|
2080
|
-
isAdmin:
|
|
2088
|
+
isAdmin: Pr().isAdmin
|
|
2081
2089
|
};
|
|
2082
|
-
},
|
|
2090
|
+
}, Nt = ({
|
|
2083
2091
|
children: r,
|
|
2084
2092
|
actionName: e,
|
|
2085
2093
|
requiredPermissions: t = [],
|
|
@@ -2088,13 +2096,13 @@ const qr = ({
|
|
|
2088
2096
|
fallback: a = null,
|
|
2089
2097
|
autoRegister: c = !0
|
|
2090
2098
|
}) => {
|
|
2091
|
-
const { hasPermission: i, hasAnyPermission:
|
|
2092
|
-
|
|
2093
|
-
c && e && o &&
|
|
2094
|
-
}, [e, o, c,
|
|
2095
|
-
let
|
|
2096
|
-
return e ?
|
|
2097
|
-
},
|
|
2099
|
+
const { hasPermission: i, hasAnyPermission: d, hasAllPermissions: y, registerAction: S } = Xe();
|
|
2100
|
+
Y(() => {
|
|
2101
|
+
c && e && o && S(e, o);
|
|
2102
|
+
}, [e, o, c, S]);
|
|
2103
|
+
let h = !1;
|
|
2104
|
+
return e ? h = i(e) : t.length > 0 ? h = s ? y(t) : d(t) : h = !0, h ? /* @__PURE__ */ n(ie, { children: r }) : /* @__PURE__ */ n(ie, { children: a });
|
|
2105
|
+
}, os = ({
|
|
2098
2106
|
actionName: r,
|
|
2099
2107
|
actionDescription: e,
|
|
2100
2108
|
children: t,
|
|
@@ -2103,14 +2111,14 @@ const qr = ({
|
|
|
2103
2111
|
className: a = "",
|
|
2104
2112
|
style: c = {},
|
|
2105
2113
|
variant: i = "primary",
|
|
2106
|
-
size:
|
|
2114
|
+
size: d = "medium",
|
|
2107
2115
|
type: y = "button"
|
|
2108
2116
|
}) => {
|
|
2109
|
-
const
|
|
2110
|
-
const
|
|
2111
|
-
return `${
|
|
2112
|
-
},
|
|
2113
|
-
const
|
|
2117
|
+
const S = () => {
|
|
2118
|
+
const U = "archbase-secure-btn", A = `archbase-secure-btn--${i}`, v = `archbase-secure-btn--${d}`;
|
|
2119
|
+
return `${U} ${A} ${v} ${a}`.trim();
|
|
2120
|
+
}, h = () => {
|
|
2121
|
+
const U = {
|
|
2114
2122
|
small: { padding: "4px 8px", fontSize: "12px" },
|
|
2115
2123
|
medium: { padding: "8px 16px", fontSize: "14px" },
|
|
2116
2124
|
large: { padding: "12px 24px", fontSize: "16px" }
|
|
@@ -2127,13 +2135,13 @@ const qr = ({
|
|
|
2127
2135
|
cursor: o ? "not-allowed" : "pointer",
|
|
2128
2136
|
fontWeight: "500",
|
|
2129
2137
|
opacity: o ? 0.6 : 1,
|
|
2130
|
-
...
|
|
2138
|
+
...U[d],
|
|
2131
2139
|
...A[i],
|
|
2132
2140
|
...c
|
|
2133
2141
|
};
|
|
2134
2142
|
};
|
|
2135
2143
|
return /* @__PURE__ */ n(
|
|
2136
|
-
|
|
2144
|
+
Nt,
|
|
2137
2145
|
{
|
|
2138
2146
|
actionName: r,
|
|
2139
2147
|
actionDescription: e,
|
|
@@ -2144,14 +2152,14 @@ const qr = ({
|
|
|
2144
2152
|
type: y,
|
|
2145
2153
|
onClick: s,
|
|
2146
2154
|
disabled: o,
|
|
2147
|
-
className:
|
|
2148
|
-
style:
|
|
2155
|
+
className: S(),
|
|
2156
|
+
style: h(),
|
|
2149
2157
|
children: t
|
|
2150
2158
|
}
|
|
2151
2159
|
)
|
|
2152
2160
|
}
|
|
2153
2161
|
);
|
|
2154
|
-
},
|
|
2162
|
+
}, ns = ({
|
|
2155
2163
|
children: r,
|
|
2156
2164
|
actionName: e,
|
|
2157
2165
|
actionDescription: t,
|
|
@@ -2160,7 +2168,7 @@ const qr = ({
|
|
|
2160
2168
|
fallbackText: a = "Campo não disponível",
|
|
2161
2169
|
fallbackComponent: c
|
|
2162
2170
|
}) => e ? /* @__PURE__ */ n(
|
|
2163
|
-
|
|
2171
|
+
Nt,
|
|
2164
2172
|
{
|
|
2165
2173
|
actionName: e,
|
|
2166
2174
|
actionDescription: t,
|
|
@@ -2180,12 +2188,12 @@ const qr = ({
|
|
|
2180
2188
|
] }),
|
|
2181
2189
|
children: r
|
|
2182
2190
|
}
|
|
2183
|
-
) : /* @__PURE__ */ n(
|
|
2184
|
-
function
|
|
2191
|
+
) : /* @__PURE__ */ n(ie, { children: r });
|
|
2192
|
+
function is(r, e) {
|
|
2185
2193
|
return function(s) {
|
|
2186
2194
|
const { resourceName: o, resourceDescription: a, requiredPermissions: c, fallbackComponent: i } = e;
|
|
2187
2195
|
return /* @__PURE__ */ n(
|
|
2188
|
-
|
|
2196
|
+
Ir,
|
|
2189
2197
|
{
|
|
2190
2198
|
resourceName: o,
|
|
2191
2199
|
resourceDescription: a,
|
|
@@ -2198,75 +2206,75 @@ function ss(r, e) {
|
|
|
2198
2206
|
}
|
|
2199
2207
|
export {
|
|
2200
2208
|
Rt as ARCHBASE_SECURITY_MANAGER_STORE,
|
|
2201
|
-
|
|
2209
|
+
Er as AccessIntervalDto,
|
|
2202
2210
|
At as AccessScheduleDto,
|
|
2203
2211
|
qe as AccessTokenDto,
|
|
2204
|
-
|
|
2212
|
+
xr as ActionDto,
|
|
2205
2213
|
Ke as ApiTokenDto,
|
|
2206
2214
|
Dt as ArchbaseAccessTokenService,
|
|
2207
2215
|
Ut as ArchbaseApiTokenService,
|
|
2208
|
-
|
|
2209
|
-
|
|
2216
|
+
vr as ArchbaseAuthContext,
|
|
2217
|
+
Hr as ArchbaseAuthProvider,
|
|
2210
2218
|
Pt as ArchbaseGroupService,
|
|
2211
|
-
|
|
2212
|
-
|
|
2219
|
+
Kr as ArchbaseLogin,
|
|
2220
|
+
qr as ArchbaseMfaSetup,
|
|
2213
2221
|
Tt as ArchbaseProfileService,
|
|
2214
|
-
|
|
2215
|
-
|
|
2222
|
+
Nt as ArchbaseProtectedComponent,
|
|
2223
|
+
Yr as ArchbaseResetPassword,
|
|
2216
2224
|
_t as ArchbaseResourceService,
|
|
2217
|
-
|
|
2218
|
-
|
|
2225
|
+
os as ArchbaseSecureActionButton,
|
|
2226
|
+
ns as ArchbaseSecureFormField,
|
|
2219
2227
|
wt as ArchbaseSecurityManager,
|
|
2220
|
-
|
|
2221
|
-
|
|
2228
|
+
ts as ArchbaseSecurityProvider,
|
|
2229
|
+
q as ArchbaseTenantManager,
|
|
2222
2230
|
ht as ArchbaseUser,
|
|
2223
2231
|
It as ArchbaseUserService,
|
|
2224
2232
|
pt as ArchbaseUsernameAndPassword,
|
|
2225
2233
|
pt as ArchbaseUsernameAndPasswordImpl,
|
|
2226
|
-
|
|
2234
|
+
Ir as ArchbaseViewSecurityProvider,
|
|
2227
2235
|
Oe as CONTEXT_STORAGE_KEY,
|
|
2228
|
-
|
|
2229
|
-
|
|
2230
|
-
|
|
2236
|
+
or as DefaultArchbaseTokenManager,
|
|
2237
|
+
Cr as DefaultSecurityLoading,
|
|
2238
|
+
le as ENCRYPTION_KEY,
|
|
2231
2239
|
mt as FetchError,
|
|
2232
2240
|
Se as GroupDto,
|
|
2233
|
-
|
|
2241
|
+
Jr as PermissionDto,
|
|
2234
2242
|
ke as ProfileDto,
|
|
2235
2243
|
St as ResourceDto,
|
|
2236
|
-
|
|
2237
|
-
|
|
2238
|
-
|
|
2239
|
-
|
|
2244
|
+
ye as SecurityDto,
|
|
2245
|
+
me as SecurityType,
|
|
2246
|
+
Ne as TOKEN_COOKIE_NAME,
|
|
2247
|
+
Ar as TipoRecurso,
|
|
2240
2248
|
Le as USER_NAME,
|
|
2241
2249
|
Be as USER_NAME_AND_PASSWORD,
|
|
2242
|
-
|
|
2250
|
+
Me as UserDto,
|
|
2243
2251
|
Ge as UserGroupDto,
|
|
2244
|
-
|
|
2252
|
+
mr as createInternalConfig,
|
|
2245
2253
|
Te as decodeJWT,
|
|
2246
|
-
|
|
2254
|
+
pe as epochAtSecondsFromNow,
|
|
2247
2255
|
nt as epochTimeIsPast,
|
|
2248
|
-
|
|
2249
|
-
|
|
2250
|
-
|
|
2251
|
-
|
|
2256
|
+
ur as fetchTokens,
|
|
2257
|
+
hr as fetchWithRefreshToken,
|
|
2258
|
+
ir as generateCodeChallenge,
|
|
2259
|
+
nr as generateRandomString,
|
|
2252
2260
|
ft as getRandomInteger,
|
|
2253
|
-
|
|
2261
|
+
wr as getRefreshExpiresIn,
|
|
2254
2262
|
$e as isCredentialsExpiredError,
|
|
2255
|
-
|
|
2256
|
-
|
|
2257
|
-
|
|
2258
|
-
|
|
2259
|
-
|
|
2260
|
-
|
|
2261
|
-
|
|
2262
|
-
|
|
2263
|
-
|
|
2264
|
-
|
|
2265
|
-
|
|
2266
|
-
|
|
2263
|
+
cr as postWithXForm,
|
|
2264
|
+
lr as redirectToLogin,
|
|
2265
|
+
pr as redirectToLogout,
|
|
2266
|
+
Qr as useArchbaseAuthenticationManager,
|
|
2267
|
+
Zr as useArchbaseGetCurrentToken,
|
|
2268
|
+
Sr as useArchbaseGetLoggedUser,
|
|
2269
|
+
ss as useArchbasePermissionCheck,
|
|
2270
|
+
es as useArchbaseResetPassword,
|
|
2271
|
+
rs as useArchbaseSecureForm,
|
|
2272
|
+
Pr as useArchbaseSecurity,
|
|
2273
|
+
Xr as useArchbaseSecurityManager,
|
|
2274
|
+
Gr as useArchbaseTenantManager,
|
|
2267
2275
|
Xe as useArchbaseViewSecurity,
|
|
2268
|
-
|
|
2269
|
-
|
|
2270
|
-
|
|
2271
|
-
|
|
2276
|
+
Wr as useBrowserStorage,
|
|
2277
|
+
gr as validateConfig,
|
|
2278
|
+
fr as validateState,
|
|
2279
|
+
is as withArchbaseSecurity
|
|
2272
2280
|
};
|