@data-c/ui 0.2.93 → 0.2.95
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.d.ts +1 -1
- package/dist/index.js +432 -75
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +486 -129
- package/dist/index.mjs.map +1 -1
- package/package.json +2 -2
package/dist/index.mjs
CHANGED
|
@@ -2637,9 +2637,9 @@ function Header(props) {
|
|
|
2637
2637
|
}
|
|
2638
2638
|
|
|
2639
2639
|
// src/MioAuth/components/LoginForm/index.tsx
|
|
2640
|
-
import { useState as
|
|
2640
|
+
import { useState as useState27 } from "react";
|
|
2641
2641
|
import {
|
|
2642
|
-
useCredentials as
|
|
2642
|
+
useCredentials as useCredentials2,
|
|
2643
2643
|
useValidations as useValidations5
|
|
2644
2644
|
} from "@data-c/hooks";
|
|
2645
2645
|
import { Alert as Alert9, Divider as Divider6, Stack as Stack47, TextField as TextField12, Typography as Typography29 } from "@mui/material";
|
|
@@ -5056,21 +5056,21 @@ create$1.prototype = TupleSchema.prototype;
|
|
|
5056
5056
|
// src/AlterarSenha/index.tsx
|
|
5057
5057
|
import InfoOutlined2 from "@mui/icons-material/InfoOutlined";
|
|
5058
5058
|
import { Alert as Alert8, Box as Box23, Divider as Divider5, Grid as Grid2, Typography as Typography28 } from "@mui/material";
|
|
5059
|
-
import { useState as
|
|
5059
|
+
import { useState as useState26 } from "react";
|
|
5060
5060
|
import {
|
|
5061
|
-
useCredentials
|
|
5061
|
+
useCredentials,
|
|
5062
5062
|
useForm as useForm3,
|
|
5063
5063
|
useValidations as useValidations4
|
|
5064
5064
|
} from "@data-c/hooks";
|
|
5065
5065
|
import { isAxiosError as isAxiosError3 } from "axios";
|
|
5066
|
-
import { useEffect as
|
|
5066
|
+
import { useEffect as useEffect20 } from "react";
|
|
5067
5067
|
import isStrongPassword2 from "validator/lib/isStrongPassword";
|
|
5068
5068
|
|
|
5069
5069
|
// src/PasswordTextField/index.tsx
|
|
5070
5070
|
import Visibility from "@mui/icons-material/Visibility";
|
|
5071
5071
|
import VisibilityOff from "@mui/icons-material/VisibilityOff";
|
|
5072
5072
|
import { IconButton as IconButton14, InputAdornment as InputAdornment4 } from "@mui/material";
|
|
5073
|
-
import { useState as
|
|
5073
|
+
import { useState as useState25 } from "react";
|
|
5074
5074
|
|
|
5075
5075
|
// src/v2/Header/HeaderContent.tsx
|
|
5076
5076
|
import { Stack as Stack9 } from "@mui/material";
|
|
@@ -10417,13 +10417,73 @@ function DefaultBanner() {
|
|
|
10417
10417
|
import { Box as Box21, Stack as Stack45, useMediaQuery as useMediaQuery6, useTheme as useTheme11 } from "@mui/material";
|
|
10418
10418
|
|
|
10419
10419
|
// src/v2/Auth/components/EsqueciSenhaForm/index.tsx
|
|
10420
|
-
import { useState as
|
|
10420
|
+
import { useState as useState17 } from "react";
|
|
10421
10421
|
import { Alert as Alert3, Box as Box16, TextField as TextField6 } from "@mui/material";
|
|
10422
10422
|
import { useValidations } from "@data-c/hooks";
|
|
10423
10423
|
|
|
10424
|
+
// ../../node_modules/jwt-decode/build/esm/index.js
|
|
10425
|
+
var InvalidTokenError = class extends Error {
|
|
10426
|
+
};
|
|
10427
|
+
InvalidTokenError.prototype.name = "InvalidTokenError";
|
|
10428
|
+
function b64DecodeUnicode(str) {
|
|
10429
|
+
return decodeURIComponent(atob(str).replace(/(.)/g, (m, p) => {
|
|
10430
|
+
let code = p.charCodeAt(0).toString(16).toUpperCase();
|
|
10431
|
+
if (code.length < 2) {
|
|
10432
|
+
code = "0" + code;
|
|
10433
|
+
}
|
|
10434
|
+
return "%" + code;
|
|
10435
|
+
}));
|
|
10436
|
+
}
|
|
10437
|
+
function base64UrlDecode(str) {
|
|
10438
|
+
let output = str.replace(/-/g, "+").replace(/_/g, "/");
|
|
10439
|
+
switch (output.length % 4) {
|
|
10440
|
+
case 0:
|
|
10441
|
+
break;
|
|
10442
|
+
case 2:
|
|
10443
|
+
output += "==";
|
|
10444
|
+
break;
|
|
10445
|
+
case 3:
|
|
10446
|
+
output += "=";
|
|
10447
|
+
break;
|
|
10448
|
+
default:
|
|
10449
|
+
throw new Error("base64 string is not of the correct length");
|
|
10450
|
+
}
|
|
10451
|
+
try {
|
|
10452
|
+
return b64DecodeUnicode(output);
|
|
10453
|
+
} catch (err) {
|
|
10454
|
+
return atob(output);
|
|
10455
|
+
}
|
|
10456
|
+
}
|
|
10457
|
+
function jwtDecode(token, options) {
|
|
10458
|
+
if (typeof token !== "string") {
|
|
10459
|
+
throw new InvalidTokenError("Invalid token specified: must be a string");
|
|
10460
|
+
}
|
|
10461
|
+
options || (options = {});
|
|
10462
|
+
const pos = options.header === true ? 0 : 1;
|
|
10463
|
+
const part = token.split(".")[pos];
|
|
10464
|
+
if (typeof part !== "string") {
|
|
10465
|
+
throw new InvalidTokenError(`Invalid token specified: missing part #${pos + 1}`);
|
|
10466
|
+
}
|
|
10467
|
+
let decoded;
|
|
10468
|
+
try {
|
|
10469
|
+
decoded = base64UrlDecode(part);
|
|
10470
|
+
} catch (e) {
|
|
10471
|
+
throw new InvalidTokenError(`Invalid token specified: invalid base64 for part #${pos + 1} (${e.message})`);
|
|
10472
|
+
}
|
|
10473
|
+
try {
|
|
10474
|
+
return JSON.parse(decoded);
|
|
10475
|
+
} catch (e) {
|
|
10476
|
+
throw new InvalidTokenError(`Invalid token specified: invalid json for part #${pos + 1} (${e.message})`);
|
|
10477
|
+
}
|
|
10478
|
+
}
|
|
10479
|
+
|
|
10424
10480
|
// src/v2/Auth/context/CredentialsContext.tsx
|
|
10425
|
-
import {
|
|
10426
|
-
|
|
10481
|
+
import {
|
|
10482
|
+
createContext as createContext5,
|
|
10483
|
+
useContext as useContext6,
|
|
10484
|
+
useEffect as useEffect15,
|
|
10485
|
+
useState as useState16
|
|
10486
|
+
} from "react";
|
|
10427
10487
|
import { jsx as jsx154 } from "react/jsx-runtime";
|
|
10428
10488
|
var CredentialsContext = createContext5(
|
|
10429
10489
|
void 0
|
|
@@ -10432,11 +10492,308 @@ function CredentialsProvider({
|
|
|
10432
10492
|
children,
|
|
10433
10493
|
credentialsConfig
|
|
10434
10494
|
}) {
|
|
10435
|
-
const
|
|
10495
|
+
const TOKEN_KEY = credentialsConfig.tokenKey;
|
|
10496
|
+
const REFRESH_TOKEN_KEY = credentialsConfig.refreshTokenKey;
|
|
10497
|
+
const axios2 = credentialsConfig.axios;
|
|
10498
|
+
const [isSubmitting, setSubmitting] = useState16(false);
|
|
10499
|
+
const [token, setTokenState] = useState16(
|
|
10500
|
+
() => localStorage.getItem(TOKEN_KEY)
|
|
10501
|
+
);
|
|
10502
|
+
const [refreshToken, setRefreshTokenState] = useState16(
|
|
10503
|
+
() => localStorage.getItem(REFRESH_TOKEN_KEY)
|
|
10504
|
+
);
|
|
10505
|
+
const [userLogged, setUserLogged] = useState16(
|
|
10506
|
+
() => {
|
|
10507
|
+
const currentToken = localStorage.getItem(TOKEN_KEY);
|
|
10508
|
+
if (!currentToken)
|
|
10509
|
+
return null;
|
|
10510
|
+
try {
|
|
10511
|
+
const { data } = jwtDecode(
|
|
10512
|
+
currentToken
|
|
10513
|
+
);
|
|
10514
|
+
return data;
|
|
10515
|
+
} catch {
|
|
10516
|
+
return null;
|
|
10517
|
+
}
|
|
10518
|
+
}
|
|
10519
|
+
);
|
|
10520
|
+
const [isAuthenticated, setIsAuthenticated] = useState16(() => {
|
|
10521
|
+
const currentToken = localStorage.getItem(TOKEN_KEY);
|
|
10522
|
+
if (!currentToken)
|
|
10523
|
+
return false;
|
|
10524
|
+
try {
|
|
10525
|
+
const { exp } = jwtDecode(currentToken);
|
|
10526
|
+
const expDate = new Date(exp * 1e3).getTime();
|
|
10527
|
+
const nowDate = (/* @__PURE__ */ new Date()).getTime();
|
|
10528
|
+
return nowDate < expDate;
|
|
10529
|
+
} catch {
|
|
10530
|
+
return false;
|
|
10531
|
+
}
|
|
10532
|
+
});
|
|
10533
|
+
function decodeTokenFromValue(tokenValue) {
|
|
10534
|
+
if (!tokenValue)
|
|
10535
|
+
return null;
|
|
10536
|
+
try {
|
|
10537
|
+
const { data } = jwtDecode(tokenValue);
|
|
10538
|
+
return data;
|
|
10539
|
+
} catch {
|
|
10540
|
+
return null;
|
|
10541
|
+
}
|
|
10542
|
+
}
|
|
10543
|
+
function isTokenValid(tokenValue) {
|
|
10544
|
+
if (!tokenValue)
|
|
10545
|
+
return false;
|
|
10546
|
+
try {
|
|
10547
|
+
const { exp } = jwtDecode(tokenValue);
|
|
10548
|
+
const expDate = new Date(exp * 1e3).getTime();
|
|
10549
|
+
const nowDate = (/* @__PURE__ */ new Date()).getTime();
|
|
10550
|
+
return nowDate < expDate;
|
|
10551
|
+
} catch {
|
|
10552
|
+
return false;
|
|
10553
|
+
}
|
|
10554
|
+
}
|
|
10555
|
+
function syncAuthState(nextToken, nextRefreshToken) {
|
|
10556
|
+
setTokenState(nextToken);
|
|
10557
|
+
setRefreshTokenState(nextRefreshToken);
|
|
10558
|
+
setUserLogged(decodeTokenFromValue(nextToken));
|
|
10559
|
+
setIsAuthenticated(isTokenValid(nextToken));
|
|
10560
|
+
}
|
|
10561
|
+
useEffect15(() => {
|
|
10562
|
+
const onStorage = (event) => {
|
|
10563
|
+
if (event.key !== TOKEN_KEY && event.key !== REFRESH_TOKEN_KEY) {
|
|
10564
|
+
return;
|
|
10565
|
+
}
|
|
10566
|
+
const nextToken = localStorage.getItem(TOKEN_KEY);
|
|
10567
|
+
const nextRefreshToken = localStorage.getItem(REFRESH_TOKEN_KEY);
|
|
10568
|
+
syncAuthState(nextToken, nextRefreshToken);
|
|
10569
|
+
};
|
|
10570
|
+
window.addEventListener("storage", onStorage);
|
|
10571
|
+
return () => window.removeEventListener("storage", onStorage);
|
|
10572
|
+
}, [TOKEN_KEY, REFRESH_TOKEN_KEY]);
|
|
10573
|
+
function setToken(token2, refreshToken2) {
|
|
10574
|
+
localStorage.setItem(TOKEN_KEY, token2);
|
|
10575
|
+
if (refreshToken2) {
|
|
10576
|
+
localStorage.setItem(REFRESH_TOKEN_KEY, refreshToken2);
|
|
10577
|
+
} else {
|
|
10578
|
+
localStorage.removeItem(REFRESH_TOKEN_KEY);
|
|
10579
|
+
}
|
|
10580
|
+
syncAuthState(token2, refreshToken2 || null);
|
|
10581
|
+
}
|
|
10582
|
+
function logout() {
|
|
10583
|
+
localStorage.removeItem(TOKEN_KEY);
|
|
10584
|
+
localStorage.removeItem(REFRESH_TOKEN_KEY);
|
|
10585
|
+
syncAuthState(null, null);
|
|
10586
|
+
}
|
|
10587
|
+
function getToken() {
|
|
10588
|
+
return token;
|
|
10589
|
+
}
|
|
10590
|
+
function getRefreshToken() {
|
|
10591
|
+
return refreshToken;
|
|
10592
|
+
}
|
|
10593
|
+
function formatAndSetToken(_token, email, senha) {
|
|
10594
|
+
const toReturn = _token;
|
|
10595
|
+
if (toReturn) {
|
|
10596
|
+
const token3 = _token.token;
|
|
10597
|
+
const { data: decodedToken } = jwtDecode(token3);
|
|
10598
|
+
const permissoes = decodedToken.permissoes;
|
|
10599
|
+
const permissao = permissoes[credentialsConfig.applicationsId];
|
|
10600
|
+
const uuid = decodedToken.uuid;
|
|
10601
|
+
const name = decodedToken.name;
|
|
10602
|
+
toReturn.email = email;
|
|
10603
|
+
toReturn.password = senha;
|
|
10604
|
+
toReturn.userId = uuid;
|
|
10605
|
+
toReturn.userName = name;
|
|
10606
|
+
toReturn.empresas = permissao?.empresas || null;
|
|
10607
|
+
}
|
|
10608
|
+
const { token: token2, refreshToken: refreshToken2 } = _token;
|
|
10609
|
+
setToken(token2, refreshToken2);
|
|
10610
|
+
return toReturn;
|
|
10611
|
+
}
|
|
10612
|
+
async function login(email, password) {
|
|
10613
|
+
setSubmitting(true);
|
|
10614
|
+
try {
|
|
10615
|
+
const response = await axios2.post(
|
|
10616
|
+
"sessions",
|
|
10617
|
+
{
|
|
10618
|
+
email,
|
|
10619
|
+
password
|
|
10620
|
+
},
|
|
10621
|
+
{
|
|
10622
|
+
headers: {
|
|
10623
|
+
"DC-SISTEMA": credentialsConfig.applicationsIds
|
|
10624
|
+
}
|
|
10625
|
+
}
|
|
10626
|
+
);
|
|
10627
|
+
return formatAndSetToken(response.data, email, password);
|
|
10628
|
+
} catch (err) {
|
|
10629
|
+
throw err;
|
|
10630
|
+
} finally {
|
|
10631
|
+
setSubmitting(false);
|
|
10632
|
+
}
|
|
10633
|
+
}
|
|
10634
|
+
async function alterarSenha(senhaAtual, senhaNova, email) {
|
|
10635
|
+
const headers = {};
|
|
10636
|
+
const token2 = getToken();
|
|
10637
|
+
if (!email && token2) {
|
|
10638
|
+
headers.Authorization = `Bearer ${token2}`;
|
|
10639
|
+
}
|
|
10640
|
+
setSubmitting(true);
|
|
10641
|
+
try {
|
|
10642
|
+
const response = await axios2.put(
|
|
10643
|
+
"passwords/change",
|
|
10644
|
+
{
|
|
10645
|
+
old: senhaAtual,
|
|
10646
|
+
new: senhaNova,
|
|
10647
|
+
email
|
|
10648
|
+
},
|
|
10649
|
+
{
|
|
10650
|
+
headers
|
|
10651
|
+
}
|
|
10652
|
+
);
|
|
10653
|
+
return response?.data;
|
|
10654
|
+
} catch (err) {
|
|
10655
|
+
throw err;
|
|
10656
|
+
} finally {
|
|
10657
|
+
setSubmitting(false);
|
|
10658
|
+
}
|
|
10659
|
+
}
|
|
10660
|
+
async function selecionarLicenca(loginToken, empresaId) {
|
|
10661
|
+
if (!loginToken) {
|
|
10662
|
+
throw new Error("As informa\xE7\xF5es de login foram perdidas");
|
|
10663
|
+
}
|
|
10664
|
+
setSubmitting(true);
|
|
10665
|
+
try {
|
|
10666
|
+
const response = await axios2.post(
|
|
10667
|
+
"selecionar-empresa",
|
|
10668
|
+
{
|
|
10669
|
+
permissao: credentialsConfig.applicationsId,
|
|
10670
|
+
empresaUuid: empresaId
|
|
10671
|
+
},
|
|
10672
|
+
{
|
|
10673
|
+
headers: {
|
|
10674
|
+
Authorization: `Bearer ${loginToken}`
|
|
10675
|
+
}
|
|
10676
|
+
}
|
|
10677
|
+
);
|
|
10678
|
+
if (!response) {
|
|
10679
|
+
throw new Error("Ocorreu um erro ao tentar selecionar a licen\xE7a");
|
|
10680
|
+
}
|
|
10681
|
+
const { token: token2, refreshToken: refreshToken2 } = response.data;
|
|
10682
|
+
setToken(token2, refreshToken2);
|
|
10683
|
+
return response.data;
|
|
10684
|
+
} catch (err) {
|
|
10685
|
+
throw err;
|
|
10686
|
+
} finally {
|
|
10687
|
+
setSubmitting(false);
|
|
10688
|
+
}
|
|
10689
|
+
}
|
|
10690
|
+
async function recuperarSenha(email) {
|
|
10691
|
+
const response = await axios2.put("/passwords/recover", { email });
|
|
10692
|
+
return response;
|
|
10693
|
+
}
|
|
10694
|
+
async function refreshAccessToken() {
|
|
10695
|
+
const token2 = getToken();
|
|
10696
|
+
const refreshToken2 = getRefreshToken();
|
|
10697
|
+
const response = await axios2.post("refresh-token", {
|
|
10698
|
+
token: token2,
|
|
10699
|
+
refreshToken: refreshToken2
|
|
10700
|
+
});
|
|
10701
|
+
setToken(response.data.token, response.data.refreshToken);
|
|
10702
|
+
return response.data.token;
|
|
10703
|
+
}
|
|
10704
|
+
async function obterUsuarioLogado() {
|
|
10705
|
+
const response = await axios2.get("/api/usuario");
|
|
10706
|
+
return response.data;
|
|
10707
|
+
}
|
|
10708
|
+
function base64ToBlob(base64) {
|
|
10709
|
+
const [prefix2, data] = base64.split(",");
|
|
10710
|
+
const mime = prefix2.match(/:(.*?);/)?.[1] || "image/jpeg";
|
|
10711
|
+
const binary = atob(data);
|
|
10712
|
+
const array2 = new Uint8Array(binary.length);
|
|
10713
|
+
for (let i = 0; i < binary.length; i++) {
|
|
10714
|
+
array2[i] = binary.charCodeAt(i);
|
|
10715
|
+
}
|
|
10716
|
+
return new Blob([array2], { type: mime });
|
|
10717
|
+
}
|
|
10718
|
+
async function uploadAvatar(base64Image) {
|
|
10719
|
+
try {
|
|
10720
|
+
const blob = base64ToBlob(base64Image);
|
|
10721
|
+
const file = new File([blob], "avatar.jpg", { type: blob.type });
|
|
10722
|
+
const formData = new FormData();
|
|
10723
|
+
formData.append("avatar", file);
|
|
10724
|
+
const response = await axios2.post(
|
|
10725
|
+
"/api/usuario/avatar",
|
|
10726
|
+
formData,
|
|
10727
|
+
{
|
|
10728
|
+
headers: {
|
|
10729
|
+
"Content-Type": "multipart/form-data"
|
|
10730
|
+
}
|
|
10731
|
+
}
|
|
10732
|
+
);
|
|
10733
|
+
return response.data;
|
|
10734
|
+
} catch (error) {
|
|
10735
|
+
throw error;
|
|
10736
|
+
}
|
|
10737
|
+
}
|
|
10738
|
+
async function atualizarUsuario(data) {
|
|
10739
|
+
const response = await axios2.put("/api/usuario", data);
|
|
10740
|
+
return response.data;
|
|
10741
|
+
}
|
|
10742
|
+
async function gerarWhatsappVerificationCode() {
|
|
10743
|
+
const response = await axios2.post(
|
|
10744
|
+
"/api/usuario/gerar-codigo-validacao-whatsapp"
|
|
10745
|
+
);
|
|
10746
|
+
return response.data;
|
|
10747
|
+
}
|
|
10748
|
+
async function gerarOtpVerificationCode(data) {
|
|
10749
|
+
const response = await axios2.post("/otp/generate", data);
|
|
10750
|
+
return response.data;
|
|
10751
|
+
}
|
|
10752
|
+
async function validarOtpVerificationCode(data) {
|
|
10753
|
+
const response = await axios2.post("/otp/verify", data, {
|
|
10754
|
+
headers: {
|
|
10755
|
+
"DC-SISTEMA": credentialsConfig.applicationsIds
|
|
10756
|
+
}
|
|
10757
|
+
});
|
|
10758
|
+
return formatAndSetToken(response.data, data.target);
|
|
10759
|
+
}
|
|
10760
|
+
async function validarCodigoWhatsapp(codigoVerificacao) {
|
|
10761
|
+
const response = await axios2.post(
|
|
10762
|
+
"/api/usuario/validar-codigo-whatsapp",
|
|
10763
|
+
{
|
|
10764
|
+
codigoVerificacao
|
|
10765
|
+
},
|
|
10766
|
+
{
|
|
10767
|
+
headers: {
|
|
10768
|
+
"DC-SISTEMA": credentialsConfig.applicationsIds
|
|
10769
|
+
}
|
|
10770
|
+
}
|
|
10771
|
+
);
|
|
10772
|
+
return response.data;
|
|
10773
|
+
}
|
|
10436
10774
|
return /* @__PURE__ */ jsx154(
|
|
10437
10775
|
CredentialsContext.Provider,
|
|
10438
10776
|
{
|
|
10439
|
-
value:
|
|
10777
|
+
value: {
|
|
10778
|
+
login,
|
|
10779
|
+
logout,
|
|
10780
|
+
isSubmitting,
|
|
10781
|
+
token,
|
|
10782
|
+
refreshToken,
|
|
10783
|
+
userLogged,
|
|
10784
|
+
isAuthenticated,
|
|
10785
|
+
selecionarLicenca,
|
|
10786
|
+
alterarSenha,
|
|
10787
|
+
recuperarSenha,
|
|
10788
|
+
refreshAccessToken,
|
|
10789
|
+
obterUsuarioLogado,
|
|
10790
|
+
uploadAvatar,
|
|
10791
|
+
atualizarUsuario,
|
|
10792
|
+
gerarWhatsappVerificationCode,
|
|
10793
|
+
validarCodigoWhatsapp,
|
|
10794
|
+
gerarOtpVerificationCode,
|
|
10795
|
+
validarOtpVerificationCode
|
|
10796
|
+
},
|
|
10440
10797
|
children
|
|
10441
10798
|
}
|
|
10442
10799
|
);
|
|
@@ -10458,10 +10815,10 @@ var schema = create$3().shape({
|
|
|
10458
10815
|
});
|
|
10459
10816
|
function EsqueciSenhaForm(props) {
|
|
10460
10817
|
const { onLoginClick } = props;
|
|
10461
|
-
const [email, setEmail] =
|
|
10462
|
-
const [isSubmitting, setSubmitting] =
|
|
10463
|
-
const [sucessoRecuperarSenha, setSucessoRecuperarSenha] =
|
|
10464
|
-
const [error, setError] =
|
|
10818
|
+
const [email, setEmail] = useState17("");
|
|
10819
|
+
const [isSubmitting, setSubmitting] = useState17(false);
|
|
10820
|
+
const [sucessoRecuperarSenha, setSucessoRecuperarSenha] = useState17(false);
|
|
10821
|
+
const [error, setError] = useState17(null);
|
|
10465
10822
|
const { recuperarSenha } = useCredentialsContext();
|
|
10466
10823
|
const { validationProps, setValidationErrors } = useValidations();
|
|
10467
10824
|
async function handleRecuperarSenha() {
|
|
@@ -10588,13 +10945,13 @@ function Header3(props) {
|
|
|
10588
10945
|
|
|
10589
10946
|
// src/v2/Auth/components/LicencaForm/index.tsx
|
|
10590
10947
|
import { Box as Box17, MenuItem as MenuItem6, TextField as TextField7 } from "@mui/material";
|
|
10591
|
-
import { useEffect as
|
|
10948
|
+
import { useEffect as useEffect16, useState as useState18 } from "react";
|
|
10592
10949
|
import { jsx as jsx157, jsxs as jsxs70 } from "react/jsx-runtime";
|
|
10593
10950
|
function LicencaForm(props) {
|
|
10594
10951
|
const { loginData, onLoginFailed, onLoginSuccess } = props;
|
|
10595
|
-
const [empresaId, setEmpresaId] =
|
|
10952
|
+
const [empresaId, setEmpresaId] = useState18("");
|
|
10596
10953
|
const { selecionarLicenca, isSubmitting } = useCredentialsContext();
|
|
10597
|
-
|
|
10954
|
+
useEffect16(() => {
|
|
10598
10955
|
if (Array.isArray(loginData?.empresas)) {
|
|
10599
10956
|
const empresa = loginData?.empresas[0];
|
|
10600
10957
|
setEmpresaId(empresa?.uuid);
|
|
@@ -10642,7 +10999,7 @@ function LicencaForm(props) {
|
|
|
10642
10999
|
}
|
|
10643
11000
|
|
|
10644
11001
|
// src/v2/Auth/components/LoginForm/index.tsx
|
|
10645
|
-
import { useState as
|
|
11002
|
+
import { useState as useState20 } from "react";
|
|
10646
11003
|
import { useValidations as useValidations3 } from "@data-c/hooks";
|
|
10647
11004
|
import { Alert as Alert5, Divider as Divider4, Stack as Stack42, TextField as TextField8, Typography as Typography23 } from "@mui/material";
|
|
10648
11005
|
import { isAxiosError as isAxiosError2 } from "axios";
|
|
@@ -10652,10 +11009,10 @@ import WhatsApp from "@mui/icons-material/WhatsApp";
|
|
|
10652
11009
|
// src/v2/Auth/components/AlterarSenhaV2/index.tsx
|
|
10653
11010
|
import InfoOutlined from "@mui/icons-material/InfoOutlined";
|
|
10654
11011
|
import { Alert as Alert4, Box as Box19, Divider as Divider3, Grid, Typography as Typography22 } from "@mui/material";
|
|
10655
|
-
import { useState as
|
|
11012
|
+
import { useState as useState19 } from "react";
|
|
10656
11013
|
import { useForm, useValidations as useValidations2 } from "@data-c/hooks";
|
|
10657
11014
|
import { isAxiosError } from "axios";
|
|
10658
|
-
import { useEffect as
|
|
11015
|
+
import { useEffect as useEffect17 } from "react";
|
|
10659
11016
|
import isStrongPassword from "validator/lib/isStrongPassword";
|
|
10660
11017
|
|
|
10661
11018
|
// src/v2/Auth/components/AlterarSenhaV2/components/ValidatorMessage/index.tsx
|
|
@@ -10724,14 +11081,14 @@ function AlterarSenhaV2(props) {
|
|
|
10724
11081
|
const { alterarSenha, isSubmitting } = useCredentialsContext();
|
|
10725
11082
|
const { setValidationErrors, validationProps } = useValidations2();
|
|
10726
11083
|
const { data, handleChange, setData, changeValue } = useForm(defaultData);
|
|
10727
|
-
const [ehSegura, setEhSegura] =
|
|
10728
|
-
const [error, setError] =
|
|
10729
|
-
|
|
11084
|
+
const [ehSegura, setEhSegura] = useState19(false);
|
|
11085
|
+
const [error, setError] = useState19(null);
|
|
11086
|
+
useEffect17(() => {
|
|
10730
11087
|
if (senhaAtual) {
|
|
10731
11088
|
changeValue("senhaAtual", senhaAtual);
|
|
10732
11089
|
}
|
|
10733
11090
|
}, [senhaAtual]);
|
|
10734
|
-
|
|
11091
|
+
useEffect17(() => {
|
|
10735
11092
|
if (data.senhaNova) {
|
|
10736
11093
|
setEhSegura(
|
|
10737
11094
|
isStrongPassword(data.senhaNova, {
|
|
@@ -10942,12 +11299,12 @@ var schema3 = create$3().shape({
|
|
|
10942
11299
|
});
|
|
10943
11300
|
function LoginForm(props) {
|
|
10944
11301
|
const { onLoginSuccess, onLoginFailed, onOptionsClick } = props;
|
|
10945
|
-
const [email, setEmail] =
|
|
10946
|
-
const [password, setPassword] =
|
|
10947
|
-
const [isLoading, setLoading] =
|
|
10948
|
-
const [exibirAlterarSenha, setExibirAlterarSenha] =
|
|
10949
|
-
const [sucessoAlterarSenha, setSucessoAlterarSenha] =
|
|
10950
|
-
const [error, setError] =
|
|
11302
|
+
const [email, setEmail] = useState20("");
|
|
11303
|
+
const [password, setPassword] = useState20("");
|
|
11304
|
+
const [isLoading, setLoading] = useState20(false);
|
|
11305
|
+
const [exibirAlterarSenha, setExibirAlterarSenha] = useState20(false);
|
|
11306
|
+
const [sucessoAlterarSenha, setSucessoAlterarSenha] = useState20(false);
|
|
11307
|
+
const [error, setError] = useState20(null);
|
|
10951
11308
|
const { login } = useCredentialsContext();
|
|
10952
11309
|
const { validationProps, setValidationErrors } = useValidations3();
|
|
10953
11310
|
async function handleLogin() {
|
|
@@ -11103,16 +11460,16 @@ function LoginForm(props) {
|
|
|
11103
11460
|
}
|
|
11104
11461
|
|
|
11105
11462
|
// src/v2/Auth/components/LoginSection/index.tsx
|
|
11106
|
-
import { useEffect as
|
|
11463
|
+
import { useEffect as useEffect19, useState as useState24 } from "react";
|
|
11107
11464
|
|
|
11108
11465
|
// src/v2/Auth/components/OtpForm/index.tsx
|
|
11109
11466
|
import { useForm as useForm2 } from "@data-c/hooks";
|
|
11110
11467
|
import HelpOutline from "@mui/icons-material/HelpOutline";
|
|
11111
11468
|
import { Alert as Alert7, IconButton as IconButton13, Stack as Stack44, TextField as TextField11, Typography as Typography25 } from "@mui/material";
|
|
11112
|
-
import { useState as
|
|
11469
|
+
import { useState as useState23 } from "react";
|
|
11113
11470
|
|
|
11114
11471
|
// src/WhastappTextField/index.tsx
|
|
11115
|
-
import { useState as
|
|
11472
|
+
import { useState as useState21, useMemo as useMemo10 } from "react";
|
|
11116
11473
|
import TextField9 from "@mui/material/TextField";
|
|
11117
11474
|
import { jsx as jsx161 } from "react/jsx-runtime";
|
|
11118
11475
|
var formatPhone = (value) => {
|
|
@@ -11130,7 +11487,7 @@ var formatPhone = (value) => {
|
|
|
11130
11487
|
};
|
|
11131
11488
|
function WhatsAppTextField(props) {
|
|
11132
11489
|
const { value: propValue, onChange: propOnChange, ...rest } = props;
|
|
11133
|
-
const [internalValue, setInternalValue] =
|
|
11490
|
+
const [internalValue, setInternalValue] = useState21("");
|
|
11134
11491
|
const isControlled = propValue !== void 0;
|
|
11135
11492
|
const displayedValue = useMemo10(() => {
|
|
11136
11493
|
return isControlled ? formatPhone(propValue || "") : internalValue;
|
|
@@ -11164,7 +11521,7 @@ function WhatsAppTextField(props) {
|
|
|
11164
11521
|
|
|
11165
11522
|
// src/v2/Auth/components/OtpForm/DialogVerificarOtp.tsx
|
|
11166
11523
|
import { Alert as Alert6, Stack as Stack43, Typography as Typography24 } from "@mui/material";
|
|
11167
|
-
import { useEffect as
|
|
11524
|
+
import { useEffect as useEffect18, useState as useState22 } from "react";
|
|
11168
11525
|
|
|
11169
11526
|
// src/VerificationCodeInput/index.tsx
|
|
11170
11527
|
import { useRef as useRef5 } from "react";
|
|
@@ -11220,11 +11577,11 @@ function VerificationCodeInput({
|
|
|
11220
11577
|
import { jsx as jsx163, jsxs as jsxs74 } from "react/jsx-runtime";
|
|
11221
11578
|
function DialogVerificarOtp(props) {
|
|
11222
11579
|
const { open, onClose, payload, onLoginSuccess } = props;
|
|
11223
|
-
const [code, setCode] =
|
|
11224
|
-
const [error, setError] =
|
|
11225
|
-
const [isLoading, setLoading] =
|
|
11580
|
+
const [code, setCode] = useState22("");
|
|
11581
|
+
const [error, setError] = useState22(false);
|
|
11582
|
+
const [isLoading, setLoading] = useState22(false);
|
|
11226
11583
|
const { validarOtpVerificationCode } = useCredentialsContext();
|
|
11227
|
-
|
|
11584
|
+
useEffect18(() => {
|
|
11228
11585
|
if (error) {
|
|
11229
11586
|
setTimeout(() => {
|
|
11230
11587
|
setError(false);
|
|
@@ -11314,11 +11671,11 @@ var contatoSchema = create$3().shape({
|
|
|
11314
11671
|
});
|
|
11315
11672
|
function OtpForm(props) {
|
|
11316
11673
|
const { tipo, onLoginSuccess, onLoginClick } = props;
|
|
11317
|
-
const [isLoading, setLoading] =
|
|
11318
|
-
const [error, setError] =
|
|
11674
|
+
const [isLoading, setLoading] = useState23(false);
|
|
11675
|
+
const [error, setError] = useState23(false);
|
|
11319
11676
|
const { gerarOtpVerificationCode } = useCredentialsContext();
|
|
11320
11677
|
const { handleChange, changeValue, data, validate, validationErrors } = useForm2({ contato: "" }, contatoSchema);
|
|
11321
|
-
const [isOpenVerificar, setOpenVerificar] =
|
|
11678
|
+
const [isOpenVerificar, setOpenVerificar] = useState23(false);
|
|
11322
11679
|
const handleSubmit = async (e) => {
|
|
11323
11680
|
e.preventDefault();
|
|
11324
11681
|
validate(
|
|
@@ -11447,12 +11804,12 @@ var pageLabelMap = {
|
|
|
11447
11804
|
};
|
|
11448
11805
|
function LoginSection(props) {
|
|
11449
11806
|
const { onLoginSuccess, onLoginFailed, onAlreadyLogged, appName } = props;
|
|
11450
|
-
const [loginData, setLoginData] =
|
|
11807
|
+
const [loginData, setLoginData] = useState24();
|
|
11451
11808
|
const { selecionarLicenca, isAuthenticated } = useCredentialsContext();
|
|
11452
|
-
const [view, setView] =
|
|
11809
|
+
const [view, setView] = useState24("login");
|
|
11453
11810
|
const theme2 = useTheme11();
|
|
11454
11811
|
const fullScreen = useMediaQuery6(theme2.breakpoints.up("md"));
|
|
11455
|
-
|
|
11812
|
+
useEffect19(() => {
|
|
11456
11813
|
if (isAuthenticated && onAlreadyLogged) {
|
|
11457
11814
|
onAlreadyLogged();
|
|
11458
11815
|
}
|
|
@@ -11581,7 +11938,7 @@ function Auth(props) {
|
|
|
11581
11938
|
import { jsx as jsx167 } from "react/jsx-runtime";
|
|
11582
11939
|
function PasswordTextField(props) {
|
|
11583
11940
|
const { name, label, value, onChange, onKeyDown, ...rest } = props;
|
|
11584
|
-
const [showPassword, setShowPassword] =
|
|
11941
|
+
const [showPassword, setShowPassword] = useState25(false);
|
|
11585
11942
|
function handleClickShowPassword() {
|
|
11586
11943
|
setShowPassword(!showPassword);
|
|
11587
11944
|
}
|
|
@@ -11676,17 +12033,17 @@ function AlterarSenha(props) {
|
|
|
11676
12033
|
senhaAtual,
|
|
11677
12034
|
email
|
|
11678
12035
|
} = props;
|
|
11679
|
-
const { alterarSenha, isSubmitting } =
|
|
12036
|
+
const { alterarSenha, isSubmitting } = useCredentials(credentialsConfig);
|
|
11680
12037
|
const { setValidationErrors, validationProps } = useValidations4();
|
|
11681
12038
|
const { data, handleChange, setData, changeValue } = useForm3(defaultData2);
|
|
11682
|
-
const [ehSegura, setEhSegura] =
|
|
11683
|
-
const [error, setError] =
|
|
11684
|
-
|
|
12039
|
+
const [ehSegura, setEhSegura] = useState26(false);
|
|
12040
|
+
const [error, setError] = useState26(null);
|
|
12041
|
+
useEffect20(() => {
|
|
11685
12042
|
if (senhaAtual) {
|
|
11686
12043
|
changeValue("senhaAtual", senhaAtual);
|
|
11687
12044
|
}
|
|
11688
12045
|
}, [senhaAtual]);
|
|
11689
|
-
|
|
12046
|
+
useEffect20(() => {
|
|
11690
12047
|
if (data.senhaNova) {
|
|
11691
12048
|
setEhSegura(
|
|
11692
12049
|
isStrongPassword2(data.senhaNova, {
|
|
@@ -11897,13 +12254,13 @@ var schema5 = create$3().shape({
|
|
|
11897
12254
|
});
|
|
11898
12255
|
function LoginForm2(props) {
|
|
11899
12256
|
const { onLoginSuccess, onLoginFailed, onOptionsClick, credentialsConfig } = props;
|
|
11900
|
-
const [email, setEmail] =
|
|
11901
|
-
const [password, setPassword] =
|
|
11902
|
-
const [isLoading, setLoading] =
|
|
11903
|
-
const [exibirAlterarSenha, setExibirAlterarSenha] =
|
|
11904
|
-
const [sucessoAlterarSenha, setSucessoAlterarSenha] =
|
|
11905
|
-
const [error, setError] =
|
|
11906
|
-
const { login } =
|
|
12257
|
+
const [email, setEmail] = useState27("");
|
|
12258
|
+
const [password, setPassword] = useState27("");
|
|
12259
|
+
const [isLoading, setLoading] = useState27(false);
|
|
12260
|
+
const [exibirAlterarSenha, setExibirAlterarSenha] = useState27(false);
|
|
12261
|
+
const [sucessoAlterarSenha, setSucessoAlterarSenha] = useState27(false);
|
|
12262
|
+
const [error, setError] = useState27(null);
|
|
12263
|
+
const { login } = useCredentials2(credentialsConfig);
|
|
11907
12264
|
const { validationProps, setValidationErrors } = useValidations5();
|
|
11908
12265
|
async function handleLogin() {
|
|
11909
12266
|
setValidationErrors(null);
|
|
@@ -12059,20 +12416,20 @@ function LoginForm2(props) {
|
|
|
12059
12416
|
}
|
|
12060
12417
|
|
|
12061
12418
|
// src/MioAuth/components/EsqueciSenhaForm/index.tsx
|
|
12062
|
-
import { useState as
|
|
12419
|
+
import { useState as useState28 } from "react";
|
|
12063
12420
|
import { Alert as Alert10, Box as Box24, TextField as TextField13 } from "@mui/material";
|
|
12064
|
-
import { useCredentials as
|
|
12421
|
+
import { useCredentials as useCredentials3, useValidations as useValidations6 } from "@data-c/hooks";
|
|
12065
12422
|
import { jsx as jsx171, jsxs as jsxs81 } from "react/jsx-runtime";
|
|
12066
12423
|
var schema6 = create$3().shape({
|
|
12067
12424
|
email: create$6().required("Informe o e-mail")
|
|
12068
12425
|
});
|
|
12069
12426
|
function EsqueciSenhaForm2(props) {
|
|
12070
12427
|
const { onLoginClick, credentialsConfig } = props;
|
|
12071
|
-
const [email, setEmail] =
|
|
12072
|
-
const [isSubmitting, setSubmitting] =
|
|
12073
|
-
const [sucessoRecuperarSenha, setSucessoRecuperarSenha] =
|
|
12074
|
-
const [error, setError] =
|
|
12075
|
-
const { recuperarSenha } =
|
|
12428
|
+
const [email, setEmail] = useState28("");
|
|
12429
|
+
const [isSubmitting, setSubmitting] = useState28(false);
|
|
12430
|
+
const [sucessoRecuperarSenha, setSucessoRecuperarSenha] = useState28(false);
|
|
12431
|
+
const [error, setError] = useState28(null);
|
|
12432
|
+
const { recuperarSenha } = useCredentials3(credentialsConfig);
|
|
12076
12433
|
const { validationProps, setValidationErrors } = useValidations6();
|
|
12077
12434
|
async function handleRecuperarSenha() {
|
|
12078
12435
|
setValidationErrors(null);
|
|
@@ -12165,15 +12522,15 @@ function EsqueciSenhaForm2(props) {
|
|
|
12165
12522
|
}
|
|
12166
12523
|
|
|
12167
12524
|
// src/MioAuth/components/LicencaForm/index.tsx
|
|
12168
|
-
import { useEffect as
|
|
12525
|
+
import { useEffect as useEffect21, useState as useState29 } from "react";
|
|
12169
12526
|
import { Box as Box25, MenuItem as MenuItem7, TextField as TextField14 } from "@mui/material";
|
|
12170
|
-
import { useCredentials as
|
|
12527
|
+
import { useCredentials as useCredentials4 } from "@data-c/hooks";
|
|
12171
12528
|
import { jsx as jsx172, jsxs as jsxs82 } from "react/jsx-runtime";
|
|
12172
12529
|
function LicencaForm2(props) {
|
|
12173
12530
|
const { loginData, credentialsConfig, onLoginFailed, onLoginSuccess } = props;
|
|
12174
|
-
const [empresaId, setEmpresaId] =
|
|
12175
|
-
const { selecionarLicenca, isSubmitting } =
|
|
12176
|
-
|
|
12531
|
+
const [empresaId, setEmpresaId] = useState29("");
|
|
12532
|
+
const { selecionarLicenca, isSubmitting } = useCredentials4(credentialsConfig);
|
|
12533
|
+
useEffect21(() => {
|
|
12177
12534
|
if (Array.isArray(loginData?.empresas)) {
|
|
12178
12535
|
const empresa = loginData?.empresas[0];
|
|
12179
12536
|
setEmpresaId(empresa?.uuid);
|
|
@@ -12221,34 +12578,34 @@ function LicencaForm2(props) {
|
|
|
12221
12578
|
}
|
|
12222
12579
|
|
|
12223
12580
|
// src/MioAuth/components/LoginSection/index.tsx
|
|
12224
|
-
import { useEffect as
|
|
12581
|
+
import { useEffect as useEffect23, useState as useState32 } from "react";
|
|
12225
12582
|
import {
|
|
12226
|
-
useCredentials as
|
|
12583
|
+
useCredentials as useCredentials7
|
|
12227
12584
|
} from "@data-c/hooks";
|
|
12228
12585
|
|
|
12229
12586
|
// src/MioAuth/components/OtpForm/index.tsx
|
|
12230
12587
|
import {
|
|
12231
|
-
useCredentials as
|
|
12588
|
+
useCredentials as useCredentials6,
|
|
12232
12589
|
useForm as useForm4
|
|
12233
12590
|
} from "@data-c/hooks";
|
|
12234
12591
|
import HelpOutline2 from "@mui/icons-material/HelpOutline";
|
|
12235
12592
|
import { Alert as Alert12, IconButton as IconButton15, Stack as Stack49, TextField as TextField15, Typography as Typography31 } from "@mui/material";
|
|
12236
|
-
import { useState as
|
|
12593
|
+
import { useState as useState31 } from "react";
|
|
12237
12594
|
|
|
12238
12595
|
// src/MioAuth/components/OtpForm/DialogVerificarOtp.tsx
|
|
12239
12596
|
import {
|
|
12240
|
-
useCredentials as
|
|
12597
|
+
useCredentials as useCredentials5
|
|
12241
12598
|
} from "@data-c/hooks";
|
|
12242
12599
|
import { Alert as Alert11, Stack as Stack48, Typography as Typography30 } from "@mui/material";
|
|
12243
|
-
import { useEffect as
|
|
12600
|
+
import { useEffect as useEffect22, useState as useState30 } from "react";
|
|
12244
12601
|
import { jsx as jsx173, jsxs as jsxs83 } from "react/jsx-runtime";
|
|
12245
12602
|
function DialogVerificarOtp2(props) {
|
|
12246
12603
|
const { open, onClose, payload, onLoginSuccess, credentialsConfig } = props;
|
|
12247
|
-
const [code, setCode] =
|
|
12248
|
-
const [error, setError] =
|
|
12249
|
-
const [isLoading, setLoading] =
|
|
12250
|
-
const { validarOtpVerificationCode } =
|
|
12251
|
-
|
|
12604
|
+
const [code, setCode] = useState30("");
|
|
12605
|
+
const [error, setError] = useState30(false);
|
|
12606
|
+
const [isLoading, setLoading] = useState30(false);
|
|
12607
|
+
const { validarOtpVerificationCode } = useCredentials5(credentialsConfig);
|
|
12608
|
+
useEffect22(() => {
|
|
12252
12609
|
if (error) {
|
|
12253
12610
|
setTimeout(() => {
|
|
12254
12611
|
setError(false);
|
|
@@ -12338,11 +12695,11 @@ var contatoSchema2 = create$3().shape({
|
|
|
12338
12695
|
});
|
|
12339
12696
|
function OtpForm2(props) {
|
|
12340
12697
|
const { tipo, credentialsConfig, onLoginSuccess, onLoginClick } = props;
|
|
12341
|
-
const [isLoading, setLoading] =
|
|
12342
|
-
const [error, setError] =
|
|
12343
|
-
const { gerarOtpVerificationCode } =
|
|
12698
|
+
const [isLoading, setLoading] = useState31(false);
|
|
12699
|
+
const [error, setError] = useState31(false);
|
|
12700
|
+
const { gerarOtpVerificationCode } = useCredentials6(credentialsConfig);
|
|
12344
12701
|
const { handleChange, changeValue, data, validate, validationErrors } = useForm4({ contato: "" }, contatoSchema2);
|
|
12345
|
-
const [isOpenVerificar, setOpenVerificar] =
|
|
12702
|
+
const [isOpenVerificar, setOpenVerificar] = useState31(false);
|
|
12346
12703
|
const handleSubmit = async (e) => {
|
|
12347
12704
|
e.preventDefault();
|
|
12348
12705
|
validate(
|
|
@@ -12478,12 +12835,12 @@ function LoginSection2(props) {
|
|
|
12478
12835
|
onAlreadyLogged,
|
|
12479
12836
|
appName
|
|
12480
12837
|
} = props;
|
|
12481
|
-
const [loginData, setLoginData] =
|
|
12482
|
-
const { selecionarLicenca, isAuthenticated } =
|
|
12483
|
-
const [view, setView] =
|
|
12838
|
+
const [loginData, setLoginData] = useState32();
|
|
12839
|
+
const { selecionarLicenca, isAuthenticated } = useCredentials7(credentialsConfig);
|
|
12840
|
+
const [view, setView] = useState32("login");
|
|
12484
12841
|
const theme2 = useTheme14();
|
|
12485
12842
|
const fullScreen = useMediaQuery8(theme2.breakpoints.up("md"));
|
|
12486
|
-
|
|
12843
|
+
useEffect23(() => {
|
|
12487
12844
|
if (isAuthenticated && onAlreadyLogged) {
|
|
12488
12845
|
onAlreadyLogged();
|
|
12489
12846
|
}
|
|
@@ -12724,11 +13081,11 @@ function MioAuth(props) {
|
|
|
12724
13081
|
import { formatDocumento as formatDocumento2, normalizeText } from "@data-c/hooks";
|
|
12725
13082
|
import ArrowDropDown from "@mui/icons-material/ArrowDropDown";
|
|
12726
13083
|
import { Button as Button12, Stack as Stack53, Typography as Typography35 } from "@mui/material";
|
|
12727
|
-
import { useState as
|
|
13084
|
+
import { useState as useState33 } from "react";
|
|
12728
13085
|
import { jsx as jsx178, jsxs as jsxs88 } from "react/jsx-runtime";
|
|
12729
13086
|
function AlterarLicenca(props) {
|
|
12730
13087
|
const { licencas, licencaSelecionada, onAlterarLicenca } = props;
|
|
12731
|
-
const [query, setQuery] =
|
|
13088
|
+
const [query, setQuery] = useState33("");
|
|
12732
13089
|
if (licencas.length === 0)
|
|
12733
13090
|
return /* @__PURE__ */ jsxs88(Stack53, { overflow: "hidden", children: [
|
|
12734
13091
|
/* @__PURE__ */ jsx178(Typography35, { overflow: "hidden", textOverflow: "ellipsis", variant: "body1", children: licencaSelecionada.nome }),
|
|
@@ -12807,7 +13164,7 @@ import { styled as styled9 } from "@mui/material/styles";
|
|
|
12807
13164
|
import { List as List5 } from "@mui/material";
|
|
12808
13165
|
|
|
12809
13166
|
// src/DrawerMenu/components/FullMenu/components/FullMenuItem/index.tsx
|
|
12810
|
-
import { useState as
|
|
13167
|
+
import { useState as useState34 } from "react";
|
|
12811
13168
|
import ExpandLess from "@mui/icons-material/ExpandLess";
|
|
12812
13169
|
import ExpandMore from "@mui/icons-material/ExpandMore";
|
|
12813
13170
|
import { Box as Box27, Collapse as Collapse3, Icon as Icon4, ListItemText as ListItemText3 } from "@mui/material";
|
|
@@ -12858,7 +13215,7 @@ var MenuItem_default = MenuItem8;
|
|
|
12858
13215
|
import { jsx as jsx180, jsxs as jsxs89 } from "react/jsx-runtime";
|
|
12859
13216
|
function FullMenuItem2(props) {
|
|
12860
13217
|
const { menuItem, activeMenu, onMenuClick } = props;
|
|
12861
|
-
const [expanded, setExpanded] =
|
|
13218
|
+
const [expanded, setExpanded] = useState34(false);
|
|
12862
13219
|
if (!menuItem.visible)
|
|
12863
13220
|
return null;
|
|
12864
13221
|
const isExpandable = Boolean(
|
|
@@ -12919,12 +13276,12 @@ function FullMenu(props) {
|
|
|
12919
13276
|
}
|
|
12920
13277
|
|
|
12921
13278
|
// src/DrawerMenu/components/MinMenu/index.tsx
|
|
12922
|
-
import { useState as
|
|
13279
|
+
import { useState as useState35 } from "react";
|
|
12923
13280
|
import { List as List6, Icon as Icon5, ListItemIcon as ListItemIcon3, Popper as Popper3 } from "@mui/material";
|
|
12924
13281
|
import { jsx as jsx182, jsxs as jsxs90 } from "react/jsx-runtime";
|
|
12925
13282
|
function MinMenu(props) {
|
|
12926
13283
|
const { menus, activeMenu, onMenuClick } = props;
|
|
12927
|
-
const [opened, setOpened] =
|
|
13284
|
+
const [opened, setOpened] = useState35(null);
|
|
12928
13285
|
const handleOpen = (event, id, items) => {
|
|
12929
13286
|
setOpened({
|
|
12930
13287
|
element: event.currentTarget,
|
|
@@ -13099,7 +13456,7 @@ function Avatar(props) {
|
|
|
13099
13456
|
|
|
13100
13457
|
// src/Profile/index.tsx
|
|
13101
13458
|
import { Stack as Stack58, Tab, Tabs } from "@mui/material";
|
|
13102
|
-
import { useState as
|
|
13459
|
+
import { useState as useState40 } from "react";
|
|
13103
13460
|
|
|
13104
13461
|
// src/Profile/TabPanel.tsx
|
|
13105
13462
|
import { Box as Box29 } from "@mui/material";
|
|
@@ -13128,7 +13485,7 @@ function TabPanel(props) {
|
|
|
13128
13485
|
|
|
13129
13486
|
// src/Profile/MinhaConta.tsx
|
|
13130
13487
|
import {
|
|
13131
|
-
useCredentials as
|
|
13488
|
+
useCredentials as useCredentials8,
|
|
13132
13489
|
useForm as useForm5
|
|
13133
13490
|
} from "@data-c/hooks";
|
|
13134
13491
|
import {
|
|
@@ -13139,10 +13496,10 @@ import {
|
|
|
13139
13496
|
TextField as TextField16,
|
|
13140
13497
|
Typography as Typography36
|
|
13141
13498
|
} from "@mui/material";
|
|
13142
|
-
import { useEffect as
|
|
13499
|
+
import { useEffect as useEffect24, useState as useState37 } from "react";
|
|
13143
13500
|
|
|
13144
13501
|
// src/Profile/AvatarUploader.tsx
|
|
13145
|
-
import { useState as
|
|
13502
|
+
import { useState as useState36, useCallback as useCallback5 } from "react";
|
|
13146
13503
|
import Cropper from "react-easy-crop";
|
|
13147
13504
|
import Slider from "@mui/material/Slider";
|
|
13148
13505
|
import Button13 from "@mui/material/Button";
|
|
@@ -13181,12 +13538,12 @@ function getCroppedImg(imageSrc, crop) {
|
|
|
13181
13538
|
import { Stack as Stack54 } from "@mui/material";
|
|
13182
13539
|
import { jsx as jsx187, jsxs as jsxs92 } from "react/jsx-runtime";
|
|
13183
13540
|
var AvatarUploader = ({ onSave, src }) => {
|
|
13184
|
-
const [image, setImage] =
|
|
13185
|
-
const [croppedImage, setCroppedImage] =
|
|
13186
|
-
const [crop, setCrop] =
|
|
13187
|
-
const [zoom, setZoom] =
|
|
13188
|
-
const [croppedAreaPixels, setCroppedAreaPixels] =
|
|
13189
|
-
const [open, setOpen] =
|
|
13541
|
+
const [image, setImage] = useState36(null);
|
|
13542
|
+
const [croppedImage, setCroppedImage] = useState36(null);
|
|
13543
|
+
const [crop, setCrop] = useState36({ x: 0, y: 0 });
|
|
13544
|
+
const [zoom, setZoom] = useState36(1);
|
|
13545
|
+
const [croppedAreaPixels, setCroppedAreaPixels] = useState36(null);
|
|
13546
|
+
const [open, setOpen] = useState36(false);
|
|
13190
13547
|
const onCropComplete = useCallback5((_, croppedAreaPixels2) => {
|
|
13191
13548
|
setCroppedAreaPixels(croppedAreaPixels2);
|
|
13192
13549
|
}, []);
|
|
@@ -13291,21 +13648,21 @@ function MinhaConta(props) {
|
|
|
13291
13648
|
usuario,
|
|
13292
13649
|
schema7
|
|
13293
13650
|
);
|
|
13294
|
-
const [error, setErro] =
|
|
13295
|
-
const [isAlterando, setAlterando] =
|
|
13296
|
-
const [isAlteradoComSucesso, setAlteradoComSucesso] =
|
|
13297
|
-
const { uploadAvatar, atualizarUsuario } =
|
|
13298
|
-
|
|
13651
|
+
const [error, setErro] = useState37(false);
|
|
13652
|
+
const [isAlterando, setAlterando] = useState37(false);
|
|
13653
|
+
const [isAlteradoComSucesso, setAlteradoComSucesso] = useState37(false);
|
|
13654
|
+
const { uploadAvatar, atualizarUsuario } = useCredentials8(credentialsConfig);
|
|
13655
|
+
useEffect24(() => {
|
|
13299
13656
|
setData(usuario);
|
|
13300
13657
|
}, [usuario]);
|
|
13301
|
-
|
|
13658
|
+
useEffect24(() => {
|
|
13302
13659
|
if (isAlteradoComSucesso) {
|
|
13303
13660
|
setTimeout(() => {
|
|
13304
13661
|
setAlteradoComSucesso(false);
|
|
13305
13662
|
}, 3e3);
|
|
13306
13663
|
}
|
|
13307
13664
|
}, [isAlteradoComSucesso]);
|
|
13308
|
-
|
|
13665
|
+
useEffect24(() => {
|
|
13309
13666
|
if (error) {
|
|
13310
13667
|
setTimeout(() => {
|
|
13311
13668
|
setErro(false);
|
|
@@ -13397,27 +13754,27 @@ function MinhaConta(props) {
|
|
|
13397
13754
|
|
|
13398
13755
|
// src/Profile/LoginSeguranca.tsx
|
|
13399
13756
|
import {
|
|
13400
|
-
useCredentials as
|
|
13757
|
+
useCredentials as useCredentials10,
|
|
13401
13758
|
useForm as useForm6
|
|
13402
13759
|
} from "@data-c/hooks";
|
|
13403
13760
|
import Verified from "@mui/icons-material/Verified";
|
|
13404
13761
|
import { Alert as Alert15, Divider as Divider8, Stack as Stack57, Typography as Typography38 } from "@mui/material";
|
|
13405
|
-
import { useEffect as
|
|
13762
|
+
import { useEffect as useEffect26, useState as useState39 } from "react";
|
|
13406
13763
|
|
|
13407
13764
|
// src/Profile/DialogVerificarWhastapp.tsx
|
|
13408
13765
|
import {
|
|
13409
|
-
useCredentials as
|
|
13766
|
+
useCredentials as useCredentials9
|
|
13410
13767
|
} from "@data-c/hooks";
|
|
13411
13768
|
import { Alert as Alert14, Stack as Stack56, Typography as Typography37 } from "@mui/material";
|
|
13412
|
-
import { useEffect as
|
|
13769
|
+
import { useEffect as useEffect25, useState as useState38 } from "react";
|
|
13413
13770
|
import { jsx as jsx189, jsxs as jsxs94 } from "react/jsx-runtime";
|
|
13414
13771
|
function DialogVerificarWhastapp(props) {
|
|
13415
13772
|
const { open, onClose, payload, onCodigoVerificado, credentialsConfig } = props;
|
|
13416
|
-
const [code, setCode] =
|
|
13417
|
-
const [error, setError] =
|
|
13418
|
-
const [isLoading, setLoading] =
|
|
13419
|
-
const { validarCodigoWhatsapp } =
|
|
13420
|
-
|
|
13773
|
+
const [code, setCode] = useState38("");
|
|
13774
|
+
const [error, setError] = useState38(false);
|
|
13775
|
+
const [isLoading, setLoading] = useState38(false);
|
|
13776
|
+
const { validarCodigoWhatsapp } = useCredentials9(credentialsConfig);
|
|
13777
|
+
useEffect25(() => {
|
|
13421
13778
|
if (error) {
|
|
13422
13779
|
setTimeout(() => {
|
|
13423
13780
|
setError(false);
|
|
@@ -13499,13 +13856,13 @@ var schema8 = create$3().shape({
|
|
|
13499
13856
|
});
|
|
13500
13857
|
function LoginSeguranca(props) {
|
|
13501
13858
|
const { usuario, credentialsConfig, onWhastappSaved } = props;
|
|
13502
|
-
const [isOpenAlterarSenha, setOpenAlterarSenha] =
|
|
13503
|
-
const [isAlterando, setAlterando] =
|
|
13859
|
+
const [isOpenAlterarSenha, setOpenAlterarSenha] = useState39(false);
|
|
13860
|
+
const [isAlterando, setAlterando] = useState39(false);
|
|
13504
13861
|
const { data, setData, changeValue, validate, validationErrors } = useForm6(usuario);
|
|
13505
|
-
const [isGerandoNumero, setGerandoNumero] =
|
|
13506
|
-
const [isOpenVerificarWhastapp, setOpenVerificarWhatsapp] =
|
|
13507
|
-
const { atualizarUsuario, gerarWhatsappVerificationCode } =
|
|
13508
|
-
|
|
13862
|
+
const [isGerandoNumero, setGerandoNumero] = useState39(false);
|
|
13863
|
+
const [isOpenVerificarWhastapp, setOpenVerificarWhatsapp] = useState39(false);
|
|
13864
|
+
const { atualizarUsuario, gerarWhatsappVerificationCode } = useCredentials10(credentialsConfig);
|
|
13865
|
+
useEffect26(() => {
|
|
13509
13866
|
setData(usuario);
|
|
13510
13867
|
}, [usuario]);
|
|
13511
13868
|
function handleSalvarWhastapp() {
|
|
@@ -13621,7 +13978,7 @@ function LoginSeguranca(props) {
|
|
|
13621
13978
|
import { useUserContext as useUserContext2 } from "@data-c/providers";
|
|
13622
13979
|
import { Fragment as Fragment12, jsx as jsx191, jsxs as jsxs96 } from "react/jsx-runtime";
|
|
13623
13980
|
function Profile(props) {
|
|
13624
|
-
const [tabValue, setTabValue] =
|
|
13981
|
+
const [tabValue, setTabValue] = useState40(0);
|
|
13625
13982
|
const {
|
|
13626
13983
|
user: usuarioLogado,
|
|
13627
13984
|
setUser: setUsuarioLogado,
|