@pipelinesolucoes/form 1.0.0-beta.0
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/LICENSE +78 -0
- package/README.md +162 -0
- package/dist/app/layout.d.ts +6 -0
- package/dist/app/layout.js +19 -0
- package/dist/app/layout.js.map +1 -0
- package/dist/app/page.d.ts +1 -0
- package/dist/app/page.js +6 -0
- package/dist/app/page.js.map +1 -0
- package/dist/components/FormStyled.d.ts +37 -0
- package/dist/components/FormStyled.js +120 -0
- package/dist/components/FormStyled.js.map +1 -0
- package/dist/components/GoogleButton.d.ts +60 -0
- package/dist/components/GoogleButton.js +110 -0
- package/dist/components/GoogleButton.js.map +1 -0
- package/dist/components/LoginForm.d.ts +29 -0
- package/dist/components/LoginForm.js +143 -0
- package/dist/components/LoginForm.js.map +1 -0
- package/dist/components/RecaptchaForm.d.ts +21 -0
- package/dist/components/RecaptchaForm.js +118 -0
- package/dist/components/RecaptchaForm.js.map +1 -0
- package/dist/components/RecaptchaInvisible.d.ts +10 -0
- package/dist/components/RecaptchaInvisible.js +29 -0
- package/dist/components/RecaptchaInvisible.js.map +1 -0
- package/dist/components/RecaptchaMessage.d.ts +5 -0
- package/dist/components/RecaptchaMessage.js +46 -0
- package/dist/components/RecaptchaMessage.js.map +1 -0
- package/dist/components/RecuperarSenhaForm.d.ts +23 -0
- package/dist/components/RecuperarSenhaForm.js +98 -0
- package/dist/components/RecuperarSenhaForm.js.map +1 -0
- package/dist/components/SignUpForm.d.ts +26 -0
- package/dist/components/SignUpForm.js +149 -0
- package/dist/components/SignUpForm.js.map +1 -0
- package/dist/components/TextFieldValidate.d.ts +108 -0
- package/dist/components/TextFieldValidate.js +181 -0
- package/dist/components/TextFieldValidate.js.map +1 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +9 -0
- package/dist/index.js.map +1 -0
- package/dist/pages/_app.d.ts +2 -0
- package/dist/pages/_app.js +20 -0
- package/dist/pages/_app.js.map +1 -0
- package/dist/pages/_document.d.ts +9 -0
- package/dist/pages/_document.js +33 -0
- package/dist/pages/_document.js.map +1 -0
- package/dist/theme.d.ts +35 -0
- package/dist/theme.js +142 -0
- package/dist/theme.js.map +1 -0
- package/dist/tsconfig.tsbuildinfo +1 -0
- package/dist/utils/validateEmail.d.ts +37 -0
- package/dist/utils/validateEmail.js +50 -0
- package/dist/utils/validateEmail.js.map +1 -0
- package/dist/utils/validateTelefone.d.ts +36 -0
- package/dist/utils/validateTelefone.js +47 -0
- package/dist/utils/validateTelefone.js.map +1 -0
- package/package.json +64 -0
|
@@ -0,0 +1,143 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
import { Box, Divider, IconButton, InputAdornment, Typography } from '@mui/material';
|
|
6
|
+
import { ButtonFormStyled, LinkFormStyled, TextFieldStyled } from './FormStyled';
|
|
7
|
+
import VisibilityOffIcon from '@mui/icons-material/VisibilityOff';
|
|
8
|
+
import VisibilityIcon from '@mui/icons-material/Visibility';
|
|
9
|
+
import GoogleIcon from '@mui/icons-material/Google';
|
|
10
|
+
const FormContainer = styled('div')(() => ({
|
|
11
|
+
display: 'flex',
|
|
12
|
+
flexDirection: 'column',
|
|
13
|
+
gap: '16px',
|
|
14
|
+
width: '100%',
|
|
15
|
+
margin: 'auto',
|
|
16
|
+
padding: '0px',
|
|
17
|
+
}));
|
|
18
|
+
const DivPassword = styled('div')(() => ({
|
|
19
|
+
display: 'flex',
|
|
20
|
+
flexDirection: 'column',
|
|
21
|
+
gap: '8px',
|
|
22
|
+
width: '100%',
|
|
23
|
+
margin: '0',
|
|
24
|
+
padding: '0',
|
|
25
|
+
}));
|
|
26
|
+
const DivTitulo = styled('div')(() => ({
|
|
27
|
+
display: 'flex',
|
|
28
|
+
flexDirection: 'column',
|
|
29
|
+
gap: '8px',
|
|
30
|
+
width: '100%',
|
|
31
|
+
margin: '0',
|
|
32
|
+
padding: '0',
|
|
33
|
+
alignItems: 'center',
|
|
34
|
+
justifyContent: 'center'
|
|
35
|
+
}));
|
|
36
|
+
const GoogleIconStyle = styled(GoogleIcon, {
|
|
37
|
+
shouldForwardProp: (prop) => !['color_icon'].includes(prop),
|
|
38
|
+
})(({ color_icon }) => ({
|
|
39
|
+
color: color_icon,
|
|
40
|
+
marginRight: '16px'
|
|
41
|
+
}));
|
|
42
|
+
const DivLink = styled("div", {
|
|
43
|
+
shouldForwardProp: (prop) => !['text_color', 'align'].includes(prop),
|
|
44
|
+
})(({ theme, text_color, align }) => {
|
|
45
|
+
var _a, _b, _c, _d, _e, _f;
|
|
46
|
+
return ({
|
|
47
|
+
display: 'flex',
|
|
48
|
+
flexDirection: 'row',
|
|
49
|
+
alignItems: 'center',
|
|
50
|
+
justifyContent: align,
|
|
51
|
+
width: '100%',
|
|
52
|
+
padding: '0',
|
|
53
|
+
flex: '1',
|
|
54
|
+
color: text_color,
|
|
55
|
+
// Tipografia
|
|
56
|
+
fontFamily: theme.typography.fontFamily,
|
|
57
|
+
fontWeight: (_a = theme.typography.body1) === null || _a === void 0 ? void 0 : _a.fontWeight,
|
|
58
|
+
fontStyle: (_b = theme.typography.body1) === null || _b === void 0 ? void 0 : _b.fontStyle,
|
|
59
|
+
lineHeight: (_c = theme.typography.body1) === null || _c === void 0 ? void 0 : _c.lineHeight,
|
|
60
|
+
letterSpacing: (_d = theme.typography.body1) === null || _d === void 0 ? void 0 : _d.letterSpacing,
|
|
61
|
+
fontSize: (_e = theme.typography.body1) === null || _e === void 0 ? void 0 : _e.fontSize,
|
|
62
|
+
margin: (_f = theme.typography.body1) === null || _f === void 0 ? void 0 : _f.margin,
|
|
63
|
+
});
|
|
64
|
+
});
|
|
65
|
+
const LoginForm = ({ Icon, titulo, googleButton, color, background = 'transparent', border_radius = '0px', background_color_field = 'transparent', border_radius_field = '0px', color_button, background_color_button = 'transparent', border_radius_button = '0px', text_button, message_sucess, color_message_sucess, message_erro, color_message_erro, color_link, color_separador, background_color_button_google = 'transparent', color_button_google, urlRecuperarConta, urlCriarConta, children }) => {
|
|
66
|
+
const [mensagemApi, setMensagemApi] = useState('');
|
|
67
|
+
const [corMensagemApi, setCorMensagemApi] = useState(color_message_erro);
|
|
68
|
+
const [email, setEmail] = useState('');
|
|
69
|
+
const [password, setPassword] = useState('');
|
|
70
|
+
const [errors, setErrors] = useState({});
|
|
71
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
72
|
+
const [showPassword, setShowPassword] = useState(false);
|
|
73
|
+
const validateEmail = (email) => /\S+@\S+\.\S+/.test(email);
|
|
74
|
+
const handleBlur = (field) => {
|
|
75
|
+
switch (field) {
|
|
76
|
+
case 'email':
|
|
77
|
+
setErrors((prevErrors) => (Object.assign(Object.assign({}, prevErrors), { email: !validateEmail(email) })));
|
|
78
|
+
break;
|
|
79
|
+
default:
|
|
80
|
+
setErrors((prevErrors) => (Object.assign(Object.assign({}, prevErrors), { [field]: !password.trim() })));
|
|
81
|
+
break;
|
|
82
|
+
}
|
|
83
|
+
};
|
|
84
|
+
const handleSubmit = async (e) => {
|
|
85
|
+
e.preventDefault();
|
|
86
|
+
// Validação dos campos
|
|
87
|
+
const newErrors = {
|
|
88
|
+
email: !validateEmail(email),
|
|
89
|
+
};
|
|
90
|
+
setErrors(newErrors);
|
|
91
|
+
const hasErrors = Object.values(newErrors).some(Boolean);
|
|
92
|
+
if (hasErrors) {
|
|
93
|
+
setCorMensagemApi(color_message_erro);
|
|
94
|
+
setMensagemApi(`Alguns dos dados fornecidos estão inválidos. Por favor, revise as informações preenchidas e corrija os campos destacados.`);
|
|
95
|
+
return;
|
|
96
|
+
}
|
|
97
|
+
setIsLoading(true);
|
|
98
|
+
setMensagemApi('');
|
|
99
|
+
//try {
|
|
100
|
+
const formData = new FormData();
|
|
101
|
+
formData.append('email', email);
|
|
102
|
+
formData.append('password', password);
|
|
103
|
+
// const response = await fetch('https://backend-sites-pipelinesolucoes.onrender.com/send-email-gmail', {
|
|
104
|
+
// method: 'POST',
|
|
105
|
+
// headers: {
|
|
106
|
+
// Authorization: `Bearer ${token_bearer}`,
|
|
107
|
+
// },
|
|
108
|
+
// body: formData,
|
|
109
|
+
// });
|
|
110
|
+
// if (response.status === 200) {
|
|
111
|
+
//setCorMensagemApi(color_message_sucess);
|
|
112
|
+
//setMensagemApi(message_sucess);
|
|
113
|
+
setEmail('');
|
|
114
|
+
setPassword('');
|
|
115
|
+
// setErrors({});
|
|
116
|
+
// } else {
|
|
117
|
+
// setCorMensagemApi(color_message_erro);
|
|
118
|
+
// setMensagemApi(
|
|
119
|
+
// message_erro ??
|
|
120
|
+
// `Houve um problema ao enviar sua mensagem. Por favor, verifique sua conexão e tente novamente mais tarde.`
|
|
121
|
+
// );
|
|
122
|
+
// console.error('Erro ao enviar dados:', response.statusText);
|
|
123
|
+
// }
|
|
124
|
+
// } catch (error) {
|
|
125
|
+
// setCorMensagemApi(color_message_erro);
|
|
126
|
+
// setMensagemApi(
|
|
127
|
+
// message_erro ??
|
|
128
|
+
// `Houve um problema ao enviar sua mensagem. Por favor, verifique sua conexão e tente novamente mais tarde.`
|
|
129
|
+
// );
|
|
130
|
+
// console.error('Erro na solicitação:', error);
|
|
131
|
+
// } finally {
|
|
132
|
+
// setIsLoading(false);
|
|
133
|
+
// }
|
|
134
|
+
};
|
|
135
|
+
return (_jsxs(Box, { display: "flex", flexDirection: 'column', justifyContent: "center", gap: "24px", flex: 1, sx: { padding: "24px", borderRadius: border_radius, background: background }, children: [(Icon || titulo) &&
|
|
136
|
+
_jsxs(DivTitulo, { children: [Icon && _jsx(Icon, {}), titulo && titulo()] }), _jsxs(FormContainer, { children: [googleButton && googleButton(), _jsx(Divider, { sx: { borderColor: color_separador }, children: "ou" }), _jsx(TextFieldStyled, { id: "email", label: "Email", placeholder: "Email", value: email, onChange: (e) => setEmail(e.target.value), onBlur: () => handleBlur('email'), error: errors.email, helperText: errors.email && _jsx("span", { style: { color: color_message_erro }, children: "Email inv\u00E1lido" }), required: true, background_color: background_color_field, text_color: color, text_color_error: color_message_erro, border_radius: border_radius_field }), _jsxs(DivPassword, { children: [_jsx(TextFieldStyled, { id: "password", label: "Senha", type: showPassword ? 'text' : 'password', value: password, onChange: (e) => setPassword(e.target.value), onBlur: () => handleBlur('password'), error: errors.password, helperText: errors.password && (_jsx("span", { style: { color: color_message_erro }, children: "Senha inv\u00E1lida" })), required: true, background_color: background_color_field, text_color: color, text_color_error: color_message_erro, border_radius: border_radius_field, slotProps: {
|
|
137
|
+
input: {
|
|
138
|
+
endAdornment: (_jsx(InputAdornment, { position: "end", children: _jsx(IconButton, { onClick: () => setShowPassword((prev) => !prev), edge: "end", children: showPassword ? _jsx(VisibilityOffIcon, {}) : _jsx(VisibilityIcon, {}) }) })),
|
|
139
|
+
},
|
|
140
|
+
} }), _jsx(DivLink, { text_color: color, align: "flex-start", children: _jsx(LinkFormStyled, { href: urlRecuperarConta, width: "auto", height: "auto", text_color: color_link, font_size: '0.8rem', children: "Esqueceu sua senha?" }) })] }), _jsx(ButtonFormStyled, { width: "100%", height: "100%", onClick: handleSubmit, background_color: background_color_button, text_color: color_button, border_radius: border_radius_button, disabled: isLoading, margin: '16px 0 0 0', children: isLoading ? 'Enviando...' : text_button }), mensagemApi && (_jsx(Typography, { variant: "body1", component: "span", color: corMensagemApi, children: mensagemApi })), _jsx(DivLink, { text_color: color, align: "center", children: _jsx(LinkFormStyled, { href: urlCriarConta, width: "auto", height: "100%", text_color: color_link, margin: '0', children: "Criar conta" }) })] }), children] }));
|
|
141
|
+
};
|
|
142
|
+
export default LoginForm;
|
|
143
|
+
//# sourceMappingURL=LoginForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LoginForm.js","sourceRoot":"","sources":["../../src/components/LoginForm.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAc,EAAU,QAAQ,EAAE,MAAM,OAAO,C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,MAAM,EAC1C,OAAO,EAAE,YAAY,EACrB,gBAAgB,EAAE,uBAAuB,EACzC,UAAU,EAAE,YAAY,EACxB,aAAa,EAAE,oBAAoB,EACnC,QAAQ,EAAE,SAAS,EACnB,MAAM,EAAC,YAAY,YAElB,SAAS,CAAC,CAAC,CAAC,aAAa,CAAC,CAAC,CAAC,WAAW,GACvB,EAClB,WAAW,IAAI,CACd,KAAC,UAAU,IAAC,OAAO,EAAC,OAAO,EAAC,SAAS,EAAC,MAAM,EAAC,KAAK,EAAE,cAAc,YAC/D,WAAW,GACD,CACd,EAED,KAAC,OAAO,IAAC,UAAU,EAAE,KAAK,EAAE,KAAK,EAAC,QAAQ,YACxC,KAAC,cAAc,IAAC,IAAI,EAAE,aAAa,EACjC,KAAK,EAAC,MAAM,EAAC,MAAM,EAAC,MAAM,EAAC,UAAU,EAAE,UAAU,EAAE,MAAM,EAAC,GAAG,4BAE9C,GACT,IAEI,EAEf,QAAQ,IAEL,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,SAAS,CAAC"}
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
interface RecaptchaFormProps {
|
|
3
|
+
color: string;
|
|
4
|
+
background?: string;
|
|
5
|
+
border_radius: string;
|
|
6
|
+
background_color_field?: string;
|
|
7
|
+
border_radius_field?: string;
|
|
8
|
+
color_button: string;
|
|
9
|
+
background_color_button?: string;
|
|
10
|
+
border_radius_button?: string;
|
|
11
|
+
text_button: string;
|
|
12
|
+
message_sucess: string;
|
|
13
|
+
color_message_sucess: string;
|
|
14
|
+
message_erro?: string;
|
|
15
|
+
color_message_erro: string;
|
|
16
|
+
token_bearer: string;
|
|
17
|
+
site_key_recaptcha: string;
|
|
18
|
+
children: React.ReactNode;
|
|
19
|
+
}
|
|
20
|
+
declare const RecaptchaForm: React.FC<RecaptchaFormProps>;
|
|
21
|
+
export default RecaptchaForm;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import React, { useRef, useState } from 'react';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
import { Box, Typography } from '@mui/material';
|
|
6
|
+
import RecaptchaInvisible from './RecaptchaInvisible';
|
|
7
|
+
import { ButtonFormStyled, TextFieldFixedSizeStyled, TextFieldStyled } from './FormStyled';
|
|
8
|
+
import RecaptchaMessage from './RecaptchaMessage';
|
|
9
|
+
const FormContainer = styled('div')(() => ({
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
gap: '16px',
|
|
13
|
+
width: '100%',
|
|
14
|
+
margin: 'auto',
|
|
15
|
+
padding: '0px',
|
|
16
|
+
}));
|
|
17
|
+
const RecaptchaForm = ({ color, background = 'transparent', border_radius = '0px', background_color_field = 'transparent', border_radius_field = '0px', color_button, background_color_button = 'transparent', border_radius_button = '0px', text_button, message_sucess, color_message_sucess, message_erro, color_message_erro, token_bearer, site_key_recaptcha, children }) => {
|
|
18
|
+
const [mensagemApi, setMensagemApi] = useState('');
|
|
19
|
+
const [corMensagemApi, setCorMensagemApi] = useState(color_message_erro);
|
|
20
|
+
const [nome, setNome] = useState('');
|
|
21
|
+
const [email, setEmail] = useState('');
|
|
22
|
+
const [telefone, setTelefone] = useState('');
|
|
23
|
+
const [mensagem, setMensagem] = useState('');
|
|
24
|
+
const [errors, setErrors] = useState({});
|
|
25
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
26
|
+
const telefoneRef = React.useRef(null);
|
|
27
|
+
// Ref para o recaptcha
|
|
28
|
+
const recaptchaRef = useRef(null);
|
|
29
|
+
const validateEmail = (email) => /\S+@\S+\.\S+/.test(email);
|
|
30
|
+
const validateTelefone = (telefone) => /^\d{2}\d{9}$/.test(telefone);
|
|
31
|
+
const handleBlur = (field) => {
|
|
32
|
+
switch (field) {
|
|
33
|
+
case 'email':
|
|
34
|
+
setErrors((prevErrors) => (Object.assign(Object.assign({}, prevErrors), { email: !validateEmail(email) })));
|
|
35
|
+
break;
|
|
36
|
+
case 'telefone':
|
|
37
|
+
setErrors((prevErrors) => (Object.assign(Object.assign({}, prevErrors), { telefone: !validateTelefone(telefone) })));
|
|
38
|
+
break;
|
|
39
|
+
default:
|
|
40
|
+
// Para campos nome e mensagem
|
|
41
|
+
setErrors((prevErrors) => (Object.assign(Object.assign({}, prevErrors), { [field]: !Boolean(field === 'nome' ? nome.trim() : mensagem.trim()) })));
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const handleSubmit = async (e) => {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
// Validação dos campos
|
|
48
|
+
const newErrors = {
|
|
49
|
+
nome: !nome.trim(),
|
|
50
|
+
email: !validateEmail(email),
|
|
51
|
+
telefone: !validateTelefone(telefone),
|
|
52
|
+
mensagem: !mensagem.trim(),
|
|
53
|
+
};
|
|
54
|
+
setErrors(newErrors);
|
|
55
|
+
const hasErrors = Object.values(newErrors).some(Boolean);
|
|
56
|
+
if (hasErrors) {
|
|
57
|
+
setCorMensagemApi(color_message_erro);
|
|
58
|
+
setMensagemApi(`Alguns dos dados fornecidos estão inválidos. Por favor, revise as informações preenchidas e corrija os campos destacados antes de tentar enviar o formulário novamente.`);
|
|
59
|
+
return;
|
|
60
|
+
}
|
|
61
|
+
setIsLoading(true);
|
|
62
|
+
setMensagemApi('');
|
|
63
|
+
if (!recaptchaRef.current) {
|
|
64
|
+
setCorMensagemApi(color_message_erro);
|
|
65
|
+
setMensagemApi('Erro interno: reCAPTCHA não disponível.');
|
|
66
|
+
setIsLoading(false);
|
|
67
|
+
return;
|
|
68
|
+
}
|
|
69
|
+
// Executa o recaptcha e pega o token
|
|
70
|
+
const token = await recaptchaRef.current.execute();
|
|
71
|
+
if (!token) {
|
|
72
|
+
setCorMensagemApi(color_message_erro);
|
|
73
|
+
setMensagemApi(message_erro !== null && message_erro !== void 0 ? message_erro : 'Falha na validação do reCAPTCHA. Por favor, tente novamente.');
|
|
74
|
+
setIsLoading(false);
|
|
75
|
+
return;
|
|
76
|
+
}
|
|
77
|
+
try {
|
|
78
|
+
const formData = new FormData();
|
|
79
|
+
formData.append('nome', nome);
|
|
80
|
+
formData.append('email', email);
|
|
81
|
+
formData.append('telefone', telefone);
|
|
82
|
+
formData.append('mensagem', mensagem);
|
|
83
|
+
formData.append('captcha_token', token); // Enviar token para backend validar
|
|
84
|
+
const response = await fetch('https://backend-sites-production.up.railway.app/send-email-gmail', {
|
|
85
|
+
method: 'POST',
|
|
86
|
+
headers: {
|
|
87
|
+
Authorization: `Bearer ${token_bearer}`,
|
|
88
|
+
},
|
|
89
|
+
body: formData,
|
|
90
|
+
});
|
|
91
|
+
if (response.status === 200) {
|
|
92
|
+
setCorMensagemApi(color_message_sucess);
|
|
93
|
+
setMensagemApi(message_sucess);
|
|
94
|
+
setNome('');
|
|
95
|
+
setEmail('');
|
|
96
|
+
setTelefone('');
|
|
97
|
+
setMensagem('');
|
|
98
|
+
setErrors({});
|
|
99
|
+
}
|
|
100
|
+
else {
|
|
101
|
+
setCorMensagemApi(color_message_erro);
|
|
102
|
+
setMensagemApi(message_erro !== null && message_erro !== void 0 ? message_erro : `Houve um problema ao enviar sua mensagem. Por favor, verifique sua conexão e tente novamente mais tarde.`);
|
|
103
|
+
console.error('Erro ao enviar dados:', response.statusText);
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
catch (error) {
|
|
107
|
+
setCorMensagemApi(color_message_erro);
|
|
108
|
+
setMensagemApi(message_erro !== null && message_erro !== void 0 ? message_erro : `Houve um problema ao enviar sua mensagem. Por favor, verifique sua conexão e tente novamente mais tarde.`);
|
|
109
|
+
console.error('Erro na solicitação:', error);
|
|
110
|
+
}
|
|
111
|
+
finally {
|
|
112
|
+
setIsLoading(false);
|
|
113
|
+
}
|
|
114
|
+
};
|
|
115
|
+
return (_jsxs(Box, { display: "flex", flexDirection: 'column', justifyContent: "center", gap: "24px", flex: 1, sx: { padding: "24px", borderRadius: border_radius, background: background }, children: [_jsxs(FormContainer, { children: [_jsx(TextFieldStyled, { id: "nome", label: "Nome", placeholder: "Nome", value: nome, onChange: (e) => setNome(e.target.value), onBlur: () => handleBlur('nome'), error: errors.nome, helperText: errors.nome && _jsx("span", { style: { color: color_message_erro }, children: "Nome \u00E9 obrigat\u00F3rio" }), required: true, background_color: background_color_field, text_color: color, text_color_error: color_message_erro, border_radius: border_radius_field }), _jsx(TextFieldStyled, { id: "email", label: "Email", placeholder: "Email", value: email, onChange: (e) => setEmail(e.target.value), onBlur: () => handleBlur('email'), error: errors.email, helperText: errors.email && _jsx("span", { style: { color: color_message_erro }, children: "Email inv\u00E1lido" }), required: true, background_color: background_color_field, text_color: color, text_color_error: color_message_erro, border_radius: border_radius_field }), _jsx(TextFieldStyled, { id: "telefone", label: "Telefone", value: telefone, onChange: (e) => setTelefone(e.target.value), onBlur: () => handleBlur('telefone'), error: errors.telefone, helperText: errors.telefone && _jsx("span", { style: { color: color_message_erro }, children: "Telefone inv\u00E1lido" }), required: true, placeholder: "21999999999", background_color: background_color_field, text_color: color, text_color_error: color_message_erro, border_radius: border_radius_field, inputRef: telefoneRef }), _jsx(TextFieldFixedSizeStyled, { id: "mensagem", label: "Mensagem", placeholder: "Mensagem", value: mensagem, onChange: (e) => setMensagem(e.target.value), onBlur: () => handleBlur('mensagem'), error: errors.mensagem, helperText: errors.mensagem && _jsx("span", { style: { color: color_message_erro }, children: "Mensagem \u00E9 obrigat\u00F3ria" }), required: true, multiline: true, background_color: background_color_field, text_color: color, text_color_error: color_message_erro, border_radius: border_radius_field }), _jsx(ButtonFormStyled, { width: "100%", height: "100%", onClick: handleSubmit, background_color: background_color_button, text_color: color_button, border_radius: border_radius_button, disabled: isLoading, children: isLoading ? 'Enviando...' : text_button }), mensagemApi && (_jsx(Typography, { variant: "body1", component: "span", color: corMensagemApi, children: mensagemApi }))] }), _jsx(Box, { flex: 1, children: children }), _jsx(RecaptchaMessage, { color: color }), _jsx(RecaptchaInvisible, { siteKey: site_key_recaptcha, ref: recaptchaRef })] }));
|
|
116
|
+
};
|
|
117
|
+
export default RecaptchaForm;
|
|
118
|
+
//# sourceMappingURL=RecaptchaForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecaptchaForm.js","sourceRoot":"","sources":["../../src/components/RecaptchaForm.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AAEb,OAAO,KAAK,EAAE,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAChD,OAAO,EAAE,MAAM,EAAE,MAAM,sBAAsB,CAAC;AAC9C,OAAO,EAAE,GAAG,EAAE,UAAU,EAAE,MAAM,eAAe,CAAC;AAChD,OAAO,kBAA6C,MAAM,sBAAsB,CAAC;AACjF,OAAO,EAAE,gBAAgB,EAAE,wBAAwB,EAAE,eAAe,EAAE,MAAM,cAAc,CAAC;AAC3F,OAAO,gBAAgB,MAAM,oBAAoB,CAAC;AAGlD,MAAM,aAAa,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,GAAG,EAAE,CAAC,CAAC;IACzC,OAAO,EAAE,MAAM;IACf,aAAa,EAAE,QAAQ;IACvB,GAAG,EAAE,MAAM;IACX,KAAK,EAAE,MAAM;IACb,MAAM,EAAE,MAAM;IACd,OAAO,EAAE,KAAK;CACf,CAAC,CAAC,CAAC;AAqBJ,MAAM,aAAa,GAAiC,CAAC,EACnD,KAAK,EACL,UAAU,GAAG,aAAa,EAC1B,aAAa,GAAG,KAAK,EACrB,sBAAsB,GAAG,aAAa,EACtC,mBAAmB,GAAG,KAAK,EAC3B,YAAY,EACZ,uBAAuB,GAAG,aAAa,EACvC,oBAAoB,GAAG,KAAK,EAC5B,WAAW,EACX,cAAc,EACd,oBAAoB,EACpB,YAAY,EACZ,kBAAkB,EAClB,YAAY,EACZ,kBAAkB,EAClB,QAAQ,EACT,EAAE,EAAE;IAGH,MAAM,CAAC,WA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|
|
1
|
+
import React from 'react';
|
|
2
|
+
export type RecaptchaInvisibleRef = {
|
|
3
|
+
execute: () => Promise<string | null>;
|
|
4
|
+
};
|
|
5
|
+
type RecaptchaInvisibleProps = {
|
|
6
|
+
siteKey: string;
|
|
7
|
+
onError?: (error: unknown) => void;
|
|
8
|
+
};
|
|
9
|
+
declare const RecaptchaInvisible: React.ForwardRefExoticComponent<RecaptchaInvisibleProps & React.RefAttributes<RecaptchaInvisibleRef>>;
|
|
10
|
+
export default RecaptchaInvisible;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
3
|
+
import { useRef, useImperativeHandle, forwardRef, useCallback } from 'react';
|
|
4
|
+
import ReCAPTCHA from 'react-google-recaptcha';
|
|
5
|
+
const RecaptchaInvisible = forwardRef(({ siteKey, onError }, ref) => {
|
|
6
|
+
const recaptchaRef = useRef(null);
|
|
7
|
+
const executeRecaptcha = useCallback(async () => {
|
|
8
|
+
try {
|
|
9
|
+
if (recaptchaRef.current) {
|
|
10
|
+
const token = await recaptchaRef.current.executeAsync();
|
|
11
|
+
recaptchaRef.current.reset();
|
|
12
|
+
return token;
|
|
13
|
+
}
|
|
14
|
+
return null;
|
|
15
|
+
}
|
|
16
|
+
catch (error) {
|
|
17
|
+
if (onError)
|
|
18
|
+
onError(error);
|
|
19
|
+
return null;
|
|
20
|
+
}
|
|
21
|
+
}, [onError]);
|
|
22
|
+
useImperativeHandle(ref, () => ({
|
|
23
|
+
execute: executeRecaptcha,
|
|
24
|
+
}));
|
|
25
|
+
return _jsx(ReCAPTCHA, { sitekey: siteKey, size: "invisible", badge: "bottomleft", ref: recaptchaRef });
|
|
26
|
+
});
|
|
27
|
+
RecaptchaInvisible.displayName = 'RecaptchaInvisible';
|
|
28
|
+
export default RecaptchaInvisible;
|
|
29
|
+
//# sourceMappingURL=RecaptchaInvisible.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{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|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { styled } from "@mui/material";
|
|
4
|
+
const Text = styled('div', {
|
|
5
|
+
shouldForwardProp: (prop) => !['text_color'].includes(prop),
|
|
6
|
+
})(({ theme, text_color }) => {
|
|
7
|
+
var _a, _b, _c, _d, _e, _f;
|
|
8
|
+
return ({
|
|
9
|
+
color: text_color,
|
|
10
|
+
fontFamily: theme.typography.fontFamily,
|
|
11
|
+
fontSize: (_a = theme.typography.caption) === null || _a === void 0 ? void 0 : _a.fontSize,
|
|
12
|
+
fontWeight: (_b = theme.typography.caption) === null || _b === void 0 ? void 0 : _b.fontWeight,
|
|
13
|
+
fontStyle: (_c = theme.typography.caption) === null || _c === void 0 ? void 0 : _c.fontStyle,
|
|
14
|
+
lineHeight: (_d = theme.typography.caption) === null || _d === void 0 ? void 0 : _d.lineHeight,
|
|
15
|
+
letterSpacing: (_e = theme.typography.caption) === null || _e === void 0 ? void 0 : _e.letterSpacing,
|
|
16
|
+
margin: (_f = theme.typography.caption) === null || _f === void 0 ? void 0 : _f.margin,
|
|
17
|
+
});
|
|
18
|
+
});
|
|
19
|
+
const LinkStyled = styled('a', {
|
|
20
|
+
shouldForwardProp: (prop) => ![
|
|
21
|
+
'text_color',
|
|
22
|
+
].includes(prop),
|
|
23
|
+
})(({ theme, text_color }) => {
|
|
24
|
+
var _a, _b, _c, _d, _e;
|
|
25
|
+
return ({
|
|
26
|
+
width: 'auto',
|
|
27
|
+
cursor: 'pointer',
|
|
28
|
+
textTransform: 'none',
|
|
29
|
+
textAlign: 'center',
|
|
30
|
+
boxShadow: 'none',
|
|
31
|
+
padding: '0',
|
|
32
|
+
margin: '0',
|
|
33
|
+
color: text_color,
|
|
34
|
+
fontFamily: theme.typography.fontFamily,
|
|
35
|
+
fontSize: (_a = theme.typography.caption) === null || _a === void 0 ? void 0 : _a.fontSize,
|
|
36
|
+
fontWeight: (_b = theme.typography.caption) === null || _b === void 0 ? void 0 : _b.fontWeight,
|
|
37
|
+
fontStyle: (_c = theme.typography.caption) === null || _c === void 0 ? void 0 : _c.fontStyle,
|
|
38
|
+
lineHeight: (_d = theme.typography.caption) === null || _d === void 0 ? void 0 : _d.lineHeight,
|
|
39
|
+
letterSpacing: (_e = theme.typography.caption) === null || _e === void 0 ? void 0 : _e.letterSpacing,
|
|
40
|
+
});
|
|
41
|
+
});
|
|
42
|
+
const RecaptchaMessage = ({ color }) => {
|
|
43
|
+
return (_jsxs(Text, { text_color: color, children: ["Este site \u00E9 protegido pelo Google reCAPTCHA e est\u00E1 sujeito \u00E0 ", ' ', _jsx(LinkStyled, { href: "https://policies.google.com/privacy", text_color: color, "aria-label": 'link termo de uso', target: "_blank", rel: "noopener noreferrer", children: "Pol\u00EDtica de Privacidade" }), ' ', " e aos ", ' ', _jsx(LinkStyled, { href: "https://policies.google.com/terms", text_color: color, "aria-label": 'link termo de uso', target: "_blank", rel: "noopener noreferrer", children: "Termos de Servi\u00E7o" }), " do Google."] }));
|
|
44
|
+
};
|
|
45
|
+
export default RecaptchaMessage;
|
|
46
|
+
//# sourceMappingURL=RecaptchaMessage.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecaptchaMessage.js","sourceRoot":"","sources":["../../src/components/RecaptchaMessage.tsx"],"names":[],"mappings":"AAAA,YAAY,CAAC;;AACb,OAAO,EAAE,MAAM,EAAE,MAAM,eAAe,CAAC;AAEvC,MAAM,IAAI,GAAG,MAAM,CAAC,KAAK,EAAE;IACzB,iBAAiB,EAAE,CAAC,IAAI,EAAE,EAAE,CAC1B,CAAC,CAAC,YAAY,CAAC,CAAC,QAAQ,CAAC,IAAc,CAAC;CAC3C,CAAC,CAAuB,CAAC,EAAE,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE;;IAAC,OAAA,CAAC;QAEnD,KAAK,EAAE,UAAU;QACjB,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,UAAU;QAC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AC,UAAU,CAAC,OAAO,0CAAE,aAAa;KACvD,CAAC,CAAA;CAAA,CAAC,CAAC;AAMJ,MAAM,gBAAgB,GAAoC,CAAC,EAAC,KAAK,EAAC,EAAE,EAAE;IAEpE,OAAO,CACL,MAAC,IAAI,IAAC,UAAU,EAAE,KAAK,6FAC2C,GAAG,EACjE,KAAC,UAAU,IAAC,IAAI,EAAC,qCAAqC,EAAC,UAAU,EAAE,KAAK,gBAC7D,mBAAmB,EAAC,MAAM,EAAC,QAAQ,EAAC,GAAG,EAAC,qBAAqB,6CAAqC,EAC5G,GAAG,aAAS,GAAG,EAChB,KAAC,UAAU,IAAC,IAAI,EAAC,mCAAmC,EAAC,UAAU,EAAE,KAAK,gBAC3D,mBAAmB,EAAC,MAAM,EAAC,QAAQ,EAAC,GAAG,EAAC,qBAAqB,uCAA+B,mBACpG,CACR,CAAC;AAEJ,CAAC,CAAC;AAEF,eAAe,gBAAgB,CAAC"}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SvgIconProps } from '@mui/material';
|
|
3
|
+
interface LoginFormProps {
|
|
4
|
+
Icon?: React.ElementType<SvgIconProps>;
|
|
5
|
+
titulo?: () => React.ReactElement;
|
|
6
|
+
subTitulo?: () => React.ReactElement;
|
|
7
|
+
color: string;
|
|
8
|
+
background?: string;
|
|
9
|
+
border_radius?: string;
|
|
10
|
+
background_color_field?: string;
|
|
11
|
+
border_radius_field?: string;
|
|
12
|
+
color_button: string;
|
|
13
|
+
background_color_button?: string;
|
|
14
|
+
border_radius_button?: string;
|
|
15
|
+
text_button: string;
|
|
16
|
+
message_sucess: string;
|
|
17
|
+
color_message_sucess: string;
|
|
18
|
+
message_erro?: string;
|
|
19
|
+
color_message_erro: string;
|
|
20
|
+
children?: React.ReactNode;
|
|
21
|
+
}
|
|
22
|
+
declare const RecuperarSenhaForm: React.FC<LoginFormProps>;
|
|
23
|
+
export default RecuperarSenhaForm;
|
|
@@ -0,0 +1,98 @@
|
|
|
1
|
+
'use client';
|
|
2
|
+
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
3
|
+
import { useState } from 'react';
|
|
4
|
+
import { styled } from '@mui/material/styles';
|
|
5
|
+
import { Box, Typography } from '@mui/material';
|
|
6
|
+
import { ButtonFormStyled, TextFieldStyled } from './FormStyled';
|
|
7
|
+
import TextFieldValidate from './TextFieldValidate';
|
|
8
|
+
import { validateEmailMessage } from '../utils/validateEmail';
|
|
9
|
+
const FormContainer = styled('div')(() => ({
|
|
10
|
+
display: 'flex',
|
|
11
|
+
flexDirection: 'column',
|
|
12
|
+
gap: '16px',
|
|
13
|
+
width: '100%',
|
|
14
|
+
margin: 'auto',
|
|
15
|
+
padding: '0px',
|
|
16
|
+
alignItems: 'center',
|
|
17
|
+
justifyContent: 'center',
|
|
18
|
+
}));
|
|
19
|
+
const DivTitulo = styled('div')(() => ({
|
|
20
|
+
display: 'flex',
|
|
21
|
+
flexDirection: 'column',
|
|
22
|
+
gap: '8px',
|
|
23
|
+
width: '100%',
|
|
24
|
+
margin: '0',
|
|
25
|
+
padding: '0',
|
|
26
|
+
alignItems: 'center',
|
|
27
|
+
justifyContent: 'center'
|
|
28
|
+
}));
|
|
29
|
+
const RecuperarSenhaForm = ({ Icon, titulo, subTitulo, color, background = 'transparent', border_radius = '0px', background_color_field = 'transparent', border_radius_field = '0px', color_button, background_color_button = 'transparent', border_radius_button = '0px', text_button, message_sucess, color_message_sucess, message_erro, color_message_erro, children }) => {
|
|
30
|
+
const [mensagemApi, setMensagemApi] = useState('');
|
|
31
|
+
const [corMensagemApi, setCorMensagemApi] = useState(color_message_erro);
|
|
32
|
+
const [email, setEmail] = useState('');
|
|
33
|
+
const [errors, setErrors] = useState({});
|
|
34
|
+
const [isLoading, setIsLoading] = useState(false);
|
|
35
|
+
const validateEmail = (email) => /\S+@\S+\.\S+/.test(email);
|
|
36
|
+
const handleBlur = (field) => {
|
|
37
|
+
switch (field) {
|
|
38
|
+
case 'email':
|
|
39
|
+
setErrors((prevErrors) => (Object.assign(Object.assign({}, prevErrors), { email: !validateEmail(email) })));
|
|
40
|
+
break;
|
|
41
|
+
default:
|
|
42
|
+
break;
|
|
43
|
+
}
|
|
44
|
+
};
|
|
45
|
+
const handleSubmit = async (e) => {
|
|
46
|
+
e.preventDefault();
|
|
47
|
+
// Validação dos campos
|
|
48
|
+
const newErrors = {
|
|
49
|
+
email: !validateEmail(email),
|
|
50
|
+
};
|
|
51
|
+
setErrors(newErrors);
|
|
52
|
+
const hasErrors = Object.values(newErrors).some(Boolean);
|
|
53
|
+
if (hasErrors) {
|
|
54
|
+
setCorMensagemApi(color_message_erro);
|
|
55
|
+
setMensagemApi(`Alguns dos dados fornecidos estão inválidos. Por favor, revise as informações preenchidas e corrija os campos destacados.`);
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
setIsLoading(true);
|
|
59
|
+
setMensagemApi('');
|
|
60
|
+
//try {
|
|
61
|
+
const formData = new FormData();
|
|
62
|
+
formData.append('email', email);
|
|
63
|
+
// const response = await fetch('https://backend-sites-pipelinesolucoes.onrender.com/send-email-gmail', {
|
|
64
|
+
// method: 'POST',
|
|
65
|
+
// headers: {
|
|
66
|
+
// Authorization: `Bearer ${token_bearer}`,
|
|
67
|
+
// },
|
|
68
|
+
// body: formData,
|
|
69
|
+
// });
|
|
70
|
+
// if (response.status === 200) {
|
|
71
|
+
//setCorMensagemApi(color_message_sucess);
|
|
72
|
+
//setMensagemApi(message_sucess);
|
|
73
|
+
setEmail('');
|
|
74
|
+
// setErrors({});
|
|
75
|
+
// } else {
|
|
76
|
+
// setCorMensagemApi(color_message_erro);
|
|
77
|
+
// setMensagemApi(
|
|
78
|
+
// message_erro ??
|
|
79
|
+
// `Houve um problema ao enviar sua mensagem. Por favor, verifique sua conexão e tente novamente mais tarde.`
|
|
80
|
+
// );
|
|
81
|
+
// console.error('Erro ao enviar dados:', response.statusText);
|
|
82
|
+
// }
|
|
83
|
+
// } catch (error) {
|
|
84
|
+
// setCorMensagemApi(color_message_erro);
|
|
85
|
+
// setMensagemApi(
|
|
86
|
+
// message_erro ??
|
|
87
|
+
// `Houve um problema ao enviar sua mensagem. Por favor, verifique sua conexão e tente novamente mais tarde.`
|
|
88
|
+
// );
|
|
89
|
+
// console.error('Erro na solicitação:', error);
|
|
90
|
+
// } finally {
|
|
91
|
+
// setIsLoading(false);
|
|
92
|
+
// }
|
|
93
|
+
};
|
|
94
|
+
return (_jsxs(Box, { display: "flex", flexDirection: 'column', justifyContent: "center", gap: "24px", flex: 1, sx: { padding: "24px", borderRadius: border_radius, background: background }, children: [(Icon || titulo) &&
|
|
95
|
+
_jsxs(DivTitulo, { children: [Icon && _jsx(Icon, {}), titulo && titulo(), subTitulo && subTitulo()] }), _jsxs(FormContainer, { children: [_jsx(TextFieldStyled, { id: "email", label: "Email", placeholder: "Email", value: email, onChange: (e) => setEmail(e.target.value), onBlur: () => handleBlur('email'), error: errors.email, helperText: errors.email && _jsx("span", { style: { color: color_message_erro }, children: "Email inv\u00E1lido" }), required: true, background_color: background_color_field, text_color: color, text_color_error: color_message_erro, border_radius: border_radius_field }), _jsx(TextFieldValidate, { id: "email", label: "Email", placeholder: "Email", background: background_color_field, colorText: color, borderRadius: border_radius_field, value: email, onChange: (e) => setEmail(e.target.value), required: true, requiredMessage: 'Campo obrigat\u00F3rio', validate: validateEmailMessage, showErrorOn: 'blur' }), _jsx(ButtonFormStyled, { width: "230px", height: "100%", onClick: handleSubmit, background_color: background_color_button, text_color: color_button, border_radius: border_radius_button, disabled: isLoading, margin: '16px 0 0 0', children: isLoading ? 'Enviando...' : text_button }), mensagemApi && (_jsx(Typography, { variant: "body1", component: "span", color: corMensagemApi, children: mensagemApi }))] }), children] }));
|
|
96
|
+
};
|
|
97
|
+
export default RecuperarSenhaForm;
|
|
98
|
+
//# sourceMappingURL=RecuperarSenhaForm.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"RecuperarSenhaForm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AAS,EAAC,MAAM,EAAC,KAAK,EAAE,cAAc,YAC/D,WAAW,GACD,CACd,IAEa,EAEf,QAAQ,IAEL,CACP,CAAC;AACJ,CAAC,CAAC;AAEF,eAAe,kBAAkB,CAAC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import { SvgIconProps } from '@mui/material';
|
|
3
|
+
interface SignUpFormProps {
|
|
4
|
+
Icon?: React.ElementType<SvgIconProps>;
|
|
5
|
+
titulo?: () => React.ReactElement;
|
|
6
|
+
googleButton: () => React.ReactElement;
|
|
7
|
+
color: string;
|
|
8
|
+
background?: string;
|
|
9
|
+
border_radius?: string;
|
|
10
|
+
background_color_field?: string;
|
|
11
|
+
border_radius_field?: string;
|
|
12
|
+
color_button: string;
|
|
13
|
+
background_color_button?: string;
|
|
14
|
+
border_radius_button?: string;
|
|
15
|
+
text_button: string;
|
|
16
|
+
message_sucess: string;
|
|
17
|
+
color_message_sucess: string;
|
|
18
|
+
message_erro?: string;
|
|
19
|
+
color_message_erro: string;
|
|
20
|
+
color_separador: string;
|
|
21
|
+
children?: React.ReactNode;
|
|
22
|
+
urlLogin: string;
|
|
23
|
+
color_link: string;
|
|
24
|
+
}
|
|
25
|
+
declare const SignUpForm: React.FC<SignUpFormProps>;
|
|
26
|
+
export default SignUpForm;
|