mitre-form-component 0.0.33 → 0.0.35
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.cjs +270 -93
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +269 -91
- package/dist/index.js.map +1 -1
- package/package.json +4 -1
package/dist/index.cjs
CHANGED
|
@@ -35,7 +35,7 @@ __export(index_exports, {
|
|
|
35
35
|
module.exports = __toCommonJS(index_exports);
|
|
36
36
|
|
|
37
37
|
// src/components/Form/index.tsx
|
|
38
|
-
var
|
|
38
|
+
var import_react6 = __toESM(require("react"), 1);
|
|
39
39
|
|
|
40
40
|
// src/components/hooks/useError.ts
|
|
41
41
|
var import_react = require("react");
|
|
@@ -54,6 +54,7 @@ function useError() {
|
|
|
54
54
|
var import_react_hook_form = require("react-hook-form");
|
|
55
55
|
var import_yup = require("@hookform/resolvers/yup");
|
|
56
56
|
var yup = __toESM(require("yup"), 1);
|
|
57
|
+
var import_google_libphonenumber = require("google-libphonenumber");
|
|
57
58
|
|
|
58
59
|
// src/components/styles/utils.ts
|
|
59
60
|
function flex(direction = "row", alignItems, justifyContent) {
|
|
@@ -109,6 +110,17 @@ var ButtonContainer = import_styled_components.default.div`
|
|
|
109
110
|
justify-content: center;
|
|
110
111
|
width: 100%;
|
|
111
112
|
margin-top: 0.75rem;
|
|
113
|
+
|
|
114
|
+
button {
|
|
115
|
+
${opacityEffect}
|
|
116
|
+
color: var(--black);
|
|
117
|
+
font-weight: 600;
|
|
118
|
+
border: none;
|
|
119
|
+
border-radius: 8px;
|
|
120
|
+
width: 60%;
|
|
121
|
+
margin-top: 10px;
|
|
122
|
+
margin-bottom: 10px;
|
|
123
|
+
}
|
|
112
124
|
`;
|
|
113
125
|
var Form = import_styled_components.default.form`
|
|
114
126
|
label {
|
|
@@ -146,17 +158,6 @@ var Form = import_styled_components.default.form`
|
|
|
146
158
|
& > div {
|
|
147
159
|
margin-bottom: 10px;,
|
|
148
160
|
}
|
|
149
|
-
|
|
150
|
-
button {
|
|
151
|
-
${opacityEffect}
|
|
152
|
-
color: var(--black);
|
|
153
|
-
font-weight: 600;
|
|
154
|
-
border: none;
|
|
155
|
-
border-radius: 8px;
|
|
156
|
-
width: 60%;
|
|
157
|
-
margin-top: 10px;
|
|
158
|
-
margin-bottom: 10px;
|
|
159
|
-
}
|
|
160
161
|
`;
|
|
161
162
|
var Title = import_styled_components.default.h2`
|
|
162
163
|
font-size: 1.25rem;
|
|
@@ -375,10 +376,6 @@ function date(e) {
|
|
|
375
376
|
return e;
|
|
376
377
|
}
|
|
377
378
|
|
|
378
|
-
// src/components/Input/index.tsx
|
|
379
|
-
var import_react_international_phone = require("react-international-phone");
|
|
380
|
-
var import_style = require("react-international-phone/style.css");
|
|
381
|
-
|
|
382
379
|
// src/components/Input/styles.ts
|
|
383
380
|
var import_styled_components3 = __toESM(require("styled-components"), 1);
|
|
384
381
|
var FormLabel = import_styled_components3.default.label`
|
|
@@ -386,7 +383,7 @@ var FormLabel = import_styled_components3.default.label`
|
|
|
386
383
|
font-style: normal;
|
|
387
384
|
font-weight: 500;
|
|
388
385
|
font-size: 1rem;
|
|
389
|
-
color: ${(props) => props
|
|
386
|
+
color: ${(props) => props.$textColor || "var(--black)"};
|
|
390
387
|
display: block;
|
|
391
388
|
margin-bottom: 0.5rem;
|
|
392
389
|
text-align: left;
|
|
@@ -441,7 +438,7 @@ var FormErrorMessage = import_styled_components3.default.small`
|
|
|
441
438
|
display: block;
|
|
442
439
|
`;
|
|
443
440
|
var FormControl = import_styled_components3.default.div.withConfig({
|
|
444
|
-
shouldForwardProp: (prop) => !["isInvalid"
|
|
441
|
+
shouldForwardProp: (prop) => !["isInvalid"].includes(prop)
|
|
445
442
|
})`
|
|
446
443
|
${FormLabel} {
|
|
447
444
|
${(props) => props.isInvalid && import_styled_components3.css`
|
|
@@ -470,7 +467,6 @@ var FormControl = import_styled_components3.default.div.withConfig({
|
|
|
470
467
|
// src/components/Input/index.tsx
|
|
471
468
|
var import_jsx_runtime = require("react/jsx-runtime");
|
|
472
469
|
var InputBase = ({ id, label, error, showErrorMessage = true, borderColor, textColor, mask = "", type = "text", ...rest }, ref) => {
|
|
473
|
-
const phoneInputRef = (0, import_react3.useRef)(null);
|
|
474
470
|
const handleKeyUp = (0, import_react3.useCallback)(
|
|
475
471
|
(e) => {
|
|
476
472
|
if (mask === "cep") cep(e);
|
|
@@ -493,23 +489,6 @@ var InputBase = ({ id, label, error, showErrorMessage = true, borderColor, textC
|
|
|
493
489
|
autoComplete: rest.autoComplete || "on",
|
|
494
490
|
...rest
|
|
495
491
|
}
|
|
496
|
-
) : mask === "phone" ? /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
497
|
-
import_react_international_phone.PhoneInput,
|
|
498
|
-
{
|
|
499
|
-
defaultCountry: "ua",
|
|
500
|
-
value: String(rest.value),
|
|
501
|
-
onChange: (value) => {
|
|
502
|
-
if (typeof rest.onChange === "function") {
|
|
503
|
-
const event = {
|
|
504
|
-
target: {
|
|
505
|
-
name: rest.name,
|
|
506
|
-
value
|
|
507
|
-
}
|
|
508
|
-
};
|
|
509
|
-
rest.onChange(event);
|
|
510
|
-
}
|
|
511
|
-
}
|
|
512
|
-
}
|
|
513
492
|
) : /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
|
|
514
493
|
Input,
|
|
515
494
|
{
|
|
@@ -815,21 +794,198 @@ var Alert = ({
|
|
|
815
794
|
);
|
|
816
795
|
};
|
|
817
796
|
|
|
818
|
-
// src/components/
|
|
797
|
+
// src/components/PhoneInput/index.tsx
|
|
798
|
+
var import_react5 = require("react");
|
|
799
|
+
|
|
800
|
+
// src/components/PhoneInput/styles.ts
|
|
801
|
+
var import_styled_components6 = __toESM(require("styled-components"), 1);
|
|
802
|
+
var import_react_international_phone = require("react-international-phone");
|
|
803
|
+
var import_style = require("react-international-phone/style.css");
|
|
804
|
+
var FormLabel2 = import_styled_components6.default.label`
|
|
805
|
+
font-family: "Montserrat", sans-serif;
|
|
806
|
+
font-style: normal;
|
|
807
|
+
font-weight: 500;
|
|
808
|
+
font-size: 1rem;
|
|
809
|
+
color: ${(props) => props.$textColor || "var(--black)"};
|
|
810
|
+
display: block;
|
|
811
|
+
margin-bottom: 0.5rem;
|
|
812
|
+
text-align: left;
|
|
813
|
+
`;
|
|
814
|
+
var StyledPhoneInput = (0, import_styled_components6.default)(import_react_international_phone.PhoneInput)`
|
|
815
|
+
width: 100%;
|
|
816
|
+
height: 3.125rem;
|
|
817
|
+
border-radius: 0.125rem;
|
|
818
|
+
background: var(--gray-500);
|
|
819
|
+
font-family: "Montserrat", sans-serif;
|
|
820
|
+
|
|
821
|
+
/* Style for the inner phone input container */
|
|
822
|
+
.react-international-phone-input-container {
|
|
823
|
+
width: 100%;
|
|
824
|
+
height: 100%;
|
|
825
|
+
display: flex;
|
|
826
|
+
align-items: center;
|
|
827
|
+
overflow: hidden;
|
|
828
|
+
font-family: "Montserrat", sans-serif;
|
|
829
|
+
font-size: 1rem;
|
|
830
|
+
font-weight: 500;
|
|
831
|
+
color: var(--black);
|
|
832
|
+
background: var(--gray-500);
|
|
833
|
+
border-radius: 0.125rem;
|
|
834
|
+
|
|
835
|
+
/* Apply dynamic border color here */
|
|
836
|
+
border: 1px solid ${(props) => props.$bordercolor || "transparent"};
|
|
837
|
+
}
|
|
838
|
+
|
|
839
|
+
/* Style for the country selector button */
|
|
840
|
+
.react-international-phone-country-selector-button {
|
|
841
|
+
height: 100%;
|
|
842
|
+
background: var(--gray-500);
|
|
843
|
+
display: flex;
|
|
844
|
+
align-items: center;
|
|
845
|
+
justify-content: center;
|
|
846
|
+
font-family: "Montserrat", sans-serif;
|
|
847
|
+
font-size: 1rem;
|
|
848
|
+
font-weight: 500;
|
|
849
|
+
cursor: pointer;
|
|
850
|
+
border: none;
|
|
851
|
+
outline: none;
|
|
852
|
+
}
|
|
853
|
+
|
|
854
|
+
/* Style for the input itself */
|
|
855
|
+
input.react-international-phone-input {
|
|
856
|
+
flex: 1;
|
|
857
|
+
height: 100%;
|
|
858
|
+
padding: 0 0.5rem;
|
|
859
|
+
margin: 0;
|
|
860
|
+
background: var(--gray-500);
|
|
861
|
+
font-family: "Montserrat", sans-serif;
|
|
862
|
+
font-style: normal;
|
|
863
|
+
font-weight: 500;
|
|
864
|
+
font-size: 1rem;
|
|
865
|
+
line-height: 1.5rem;
|
|
866
|
+
color: var(--black);
|
|
867
|
+
outline: none;
|
|
868
|
+
border: none;
|
|
869
|
+
border-radius: 0.125rem;
|
|
870
|
+
|
|
871
|
+
&::placeholder {
|
|
872
|
+
font-size: 1rem;
|
|
873
|
+
line-height: 1.5rem;
|
|
874
|
+
color: #b6b6b6;
|
|
875
|
+
font-weight: 800;
|
|
876
|
+
}
|
|
877
|
+
|
|
878
|
+
&:-webkit-autofill {
|
|
879
|
+
background: var(--gray-500) !important;
|
|
880
|
+
-webkit-text-fill-color: var(--black) !important;
|
|
881
|
+
transition: background-color 5000s ease-in-out 0s;
|
|
882
|
+
}
|
|
883
|
+
|
|
884
|
+
&:-webkit-autofill::first-line {
|
|
885
|
+
font-family: "Montserrat", sans-serif;
|
|
886
|
+
font-size: 1rem;
|
|
887
|
+
font-weight: 500;
|
|
888
|
+
}
|
|
889
|
+
}
|
|
890
|
+
`;
|
|
891
|
+
var FormErrorMessage2 = import_styled_components6.default.small`
|
|
892
|
+
font-size: 0.75rem;
|
|
893
|
+
line-height: 1.125rem;
|
|
894
|
+
color: var(--red);
|
|
895
|
+
margin-top: 0.25rem;
|
|
896
|
+
display: block;
|
|
897
|
+
`;
|
|
898
|
+
var FormControl2 = import_styled_components6.default.div.withConfig({
|
|
899
|
+
shouldForwardProp: (prop) => !["isInvalid"].includes(prop)
|
|
900
|
+
})`
|
|
901
|
+
${FormLabel2} {
|
|
902
|
+
${(props) => props.isInvalid && import_styled_components6.css`
|
|
903
|
+
color: var(--red);
|
|
904
|
+
`};
|
|
905
|
+
}
|
|
906
|
+
|
|
907
|
+
${StyledPhoneInput} {
|
|
908
|
+
.react-international-phone-input-container {
|
|
909
|
+
${(props) => props.isInvalid && import_styled_components6.css`
|
|
910
|
+
border: 1px solid var(--red);
|
|
911
|
+
|
|
912
|
+
&:not(:focus)::placeholder {
|
|
913
|
+
color: var(--red);
|
|
914
|
+
font-weight: 600;
|
|
915
|
+
}
|
|
916
|
+
`};
|
|
917
|
+
}
|
|
918
|
+
}
|
|
919
|
+
`;
|
|
920
|
+
|
|
921
|
+
// src/components/PhoneInput/index.tsx
|
|
819
922
|
var import_jsx_runtime4 = require("react/jsx-runtime");
|
|
923
|
+
var PhoneInputBase = ({ id, label, error, showErrorMessage = true, borderColor, textColor, value, ...rest }, ref) => {
|
|
924
|
+
return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(FormControl2, { isInvalid: !!error, children: [
|
|
925
|
+
!!label && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FormLabel2, { htmlFor: id, $textColor: textColor, children: label }),
|
|
926
|
+
/* @__PURE__ */ (0, import_jsx_runtime4.jsx)(
|
|
927
|
+
StyledPhoneInput,
|
|
928
|
+
{
|
|
929
|
+
ref,
|
|
930
|
+
defaultCountry: "br",
|
|
931
|
+
disableCountryGuess: true,
|
|
932
|
+
disableDialCodeAndPrefix: true,
|
|
933
|
+
showDisabledDialCodeAndPrefix: false,
|
|
934
|
+
$bordercolor: borderColor,
|
|
935
|
+
placeholder: rest.placeholder,
|
|
936
|
+
"aria-invalid": !!error && showErrorMessage ? "true" : "false",
|
|
937
|
+
value: String(value),
|
|
938
|
+
onChange: (phone, meta) => {
|
|
939
|
+
if (typeof rest.onChange === "function") {
|
|
940
|
+
rest.onChange({
|
|
941
|
+
phone,
|
|
942
|
+
dialCode: meta.country.dialCode,
|
|
943
|
+
inputValue: meta.inputValue
|
|
944
|
+
});
|
|
945
|
+
}
|
|
946
|
+
},
|
|
947
|
+
inputProps: {
|
|
948
|
+
id,
|
|
949
|
+
name: rest.name || "phone",
|
|
950
|
+
required: rest.required,
|
|
951
|
+
autoFocus: rest.autoFocus,
|
|
952
|
+
autoComplete: rest.autoComplete || "tel"
|
|
953
|
+
}
|
|
954
|
+
}
|
|
955
|
+
),
|
|
956
|
+
!!error && showErrorMessage && /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(FormErrorMessage2, { "data-testid": "error-message", children: typeof error === "string" ? error : error?.message })
|
|
957
|
+
] });
|
|
958
|
+
};
|
|
959
|
+
var PhoneInput2 = (0, import_react5.forwardRef)(PhoneInputBase);
|
|
960
|
+
|
|
961
|
+
// src/components/Form/index.tsx
|
|
962
|
+
var import_jsx_runtime5 = require("react/jsx-runtime");
|
|
963
|
+
var phoneUtil = import_google_libphonenumber.PhoneNumberUtil.getInstance();
|
|
964
|
+
var isPhoneValid = (phone) => {
|
|
965
|
+
try {
|
|
966
|
+
return phoneUtil.isValidNumber(phoneUtil.parseAndKeepRawInput(phone));
|
|
967
|
+
} catch (error) {
|
|
968
|
+
console.log("erro ao validar telefone = " + error);
|
|
969
|
+
return false;
|
|
970
|
+
}
|
|
971
|
+
};
|
|
820
972
|
var schema = yup.object().shape({
|
|
821
973
|
name: yup.string().required("Nome \xE9 obrigat\xF3rio"),
|
|
822
974
|
email: yup.string().required("Email \xE9 obrigat\xF3rio").email("Email inv\xE1lido"),
|
|
823
|
-
phone: yup.
|
|
824
|
-
"
|
|
825
|
-
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
829
|
-
|
|
830
|
-
|
|
975
|
+
phone: yup.object().shape({
|
|
976
|
+
phone: yup.string().required("Telefone \xE9 obrigat\xF3rio!").test(
|
|
977
|
+
"is-valid-phone",
|
|
978
|
+
"N\xFAmero de telefone inv\xE1lido!",
|
|
979
|
+
function(value) {
|
|
980
|
+
const digitsOnly = value?.replace(/\D/g, "") || "";
|
|
981
|
+
return digitsOnly.length >= 8 && isPhoneValid(value);
|
|
982
|
+
}
|
|
983
|
+
),
|
|
984
|
+
inputValue: yup.string().required("Telefone \xE9 obrigat\xF3rio!"),
|
|
985
|
+
dialCode: yup.string().required("C\xF3digo de pa\xEDs \xE9 obrigat\xF3rio")
|
|
986
|
+
})
|
|
831
987
|
});
|
|
832
|
-
var MitreFormComponent =
|
|
988
|
+
var MitreFormComponent = import_react6.default.forwardRef(({
|
|
833
989
|
productId,
|
|
834
990
|
apiUrl,
|
|
835
991
|
apiToken,
|
|
@@ -843,15 +999,35 @@ var MitreFormComponent = import_react5.default.forwardRef(({
|
|
|
843
999
|
backgroundColor = "#cecece",
|
|
844
1000
|
innerPadding = "1rem"
|
|
845
1001
|
}, ref) => {
|
|
846
|
-
const [loading, setIsLoading] = (0,
|
|
1002
|
+
const [loading, setIsLoading] = (0, import_react6.useState)(false);
|
|
847
1003
|
const { error, handleError, clearError } = useError();
|
|
848
|
-
const [successMessage, setSuccessMessage] = (0,
|
|
849
|
-
const
|
|
850
|
-
|
|
1004
|
+
const [successMessage, setSuccessMessage] = (0, import_react6.useState)("");
|
|
1005
|
+
const [formKey, setFormKey] = (0, import_react6.useState)(0);
|
|
1006
|
+
const { control, register, handleSubmit, formState: { errors }, reset, clearErrors } = (0, import_react_hook_form.useForm)({
|
|
1007
|
+
resolver: (0, import_yup.yupResolver)(schema),
|
|
1008
|
+
mode: "onSubmit"
|
|
851
1009
|
});
|
|
852
|
-
const
|
|
1010
|
+
const resetForm = () => {
|
|
1011
|
+
reset({
|
|
1012
|
+
name: "",
|
|
1013
|
+
email: "",
|
|
1014
|
+
phone: { phone: "", inputValue: "", dialCode: "" }
|
|
1015
|
+
}, {
|
|
1016
|
+
keepErrors: false,
|
|
1017
|
+
keepDirty: false,
|
|
1018
|
+
keepTouched: false,
|
|
1019
|
+
keepIsSubmitted: false,
|
|
1020
|
+
keepSubmitCount: false,
|
|
1021
|
+
keepValues: false,
|
|
1022
|
+
keepDefaultValues: false
|
|
1023
|
+
});
|
|
1024
|
+
clearErrors();
|
|
1025
|
+
setFormKey((k) => k + 1);
|
|
1026
|
+
};
|
|
853
1027
|
const sendMessage = async (data) => {
|
|
854
1028
|
const { name, email, phone } = data;
|
|
1029
|
+
const phoneValue = phone.inputValue;
|
|
1030
|
+
const phoneDigitsOnly = phoneValue?.replace(/\D/g, "") || "";
|
|
855
1031
|
const message = "Gostaria de mais informa\xE7\xF5es sobre o produto";
|
|
856
1032
|
try {
|
|
857
1033
|
setIsLoading(true);
|
|
@@ -867,7 +1043,7 @@ var MitreFormComponent = import_react5.default.forwardRef(({
|
|
|
867
1043
|
body: JSON.stringify({
|
|
868
1044
|
name,
|
|
869
1045
|
email,
|
|
870
|
-
phone,
|
|
1046
|
+
phone: phoneDigitsOnly,
|
|
871
1047
|
message,
|
|
872
1048
|
productId,
|
|
873
1049
|
utm_source,
|
|
@@ -877,24 +1053,21 @@ var MitreFormComponent = import_react5.default.forwardRef(({
|
|
|
877
1053
|
})
|
|
878
1054
|
});
|
|
879
1055
|
if (!response.ok) {
|
|
1056
|
+
console.log("response = " + JSON.stringify(response));
|
|
880
1057
|
throw new Error("Falha ao enviar a mensagem!");
|
|
881
1058
|
}
|
|
882
1059
|
setSuccessMessage("Mensagem enviada com sucesso!");
|
|
883
|
-
|
|
884
|
-
name: "",
|
|
885
|
-
email: "",
|
|
886
|
-
phone: ""
|
|
887
|
-
});
|
|
1060
|
+
resetForm();
|
|
888
1061
|
} catch (err) {
|
|
889
1062
|
handleError(err);
|
|
890
1063
|
} finally {
|
|
891
1064
|
setIsLoading(false);
|
|
892
1065
|
}
|
|
893
1066
|
};
|
|
894
|
-
return /* @__PURE__ */ (0,
|
|
895
|
-
/* @__PURE__ */ (0,
|
|
896
|
-
/* @__PURE__ */ (0,
|
|
897
|
-
error && /* @__PURE__ */ (0,
|
|
1067
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(import_jsx_runtime5.Fragment, { children: [
|
|
1068
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(global_default, {}),
|
|
1069
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(GlobalStyles, {}),
|
|
1070
|
+
error && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
898
1071
|
Alert,
|
|
899
1072
|
{
|
|
900
1073
|
type: "error",
|
|
@@ -904,7 +1077,7 @@ var MitreFormComponent = import_react5.default.forwardRef(({
|
|
|
904
1077
|
children: error.message
|
|
905
1078
|
}
|
|
906
1079
|
),
|
|
907
|
-
successMessage && /* @__PURE__ */ (0,
|
|
1080
|
+
successMessage && /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
908
1081
|
Alert,
|
|
909
1082
|
{
|
|
910
1083
|
type: "success",
|
|
@@ -914,13 +1087,13 @@ var MitreFormComponent = import_react5.default.forwardRef(({
|
|
|
914
1087
|
children: successMessage
|
|
915
1088
|
}
|
|
916
1089
|
),
|
|
917
|
-
/* @__PURE__ */ (0,
|
|
918
|
-
showHeader && /* @__PURE__ */ (0,
|
|
919
|
-
/* @__PURE__ */ (0,
|
|
920
|
-
/* @__PURE__ */ (0,
|
|
1090
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(FormContainer, { $backgroundColor: backgroundColor, $innerPadding: innerPadding, ref, children: [
|
|
1091
|
+
showHeader && /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(HeaderContainer, { children: [
|
|
1092
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Title, { $textColor: textColor, children: "Atendimento por mensagem" }),
|
|
1093
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Text, { $textColor: textColor, children: "Informe seus dados e retornaremos a mensagem." })
|
|
921
1094
|
] }),
|
|
922
|
-
/* @__PURE__ */ (0,
|
|
923
|
-
/* @__PURE__ */ (0,
|
|
1095
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)(Form, { $textColor: textColor, onSubmit: handleSubmit(sendMessage), noValidate: true, children: [
|
|
1096
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
924
1097
|
Input2,
|
|
925
1098
|
{
|
|
926
1099
|
id: "name",
|
|
@@ -934,7 +1107,7 @@ var MitreFormComponent = import_react5.default.forwardRef(({
|
|
|
934
1107
|
required: true
|
|
935
1108
|
}
|
|
936
1109
|
),
|
|
937
|
-
/* @__PURE__ */ (0,
|
|
1110
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
938
1111
|
Input2,
|
|
939
1112
|
{
|
|
940
1113
|
id: "email",
|
|
@@ -949,36 +1122,40 @@ var MitreFormComponent = import_react5.default.forwardRef(({
|
|
|
949
1122
|
required: true
|
|
950
1123
|
}
|
|
951
1124
|
),
|
|
952
|
-
/* @__PURE__ */ (0,
|
|
1125
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
953
1126
|
import_react_hook_form.Controller,
|
|
954
1127
|
{
|
|
955
|
-
control,
|
|
956
1128
|
name: "phone",
|
|
957
|
-
|
|
958
|
-
|
|
959
|
-
|
|
960
|
-
|
|
961
|
-
|
|
962
|
-
|
|
963
|
-
|
|
964
|
-
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
|
|
968
|
-
|
|
969
|
-
|
|
970
|
-
|
|
971
|
-
|
|
972
|
-
|
|
973
|
-
|
|
974
|
-
|
|
1129
|
+
control,
|
|
1130
|
+
defaultValue: { phone: "", inputValue: "", dialCode: "" },
|
|
1131
|
+
shouldUnregister: true,
|
|
1132
|
+
render: ({ field }) => {
|
|
1133
|
+
const errorMsg = errors.phone?.inputValue?.message || errors.phone?.phone?.message || errors.phone?.message;
|
|
1134
|
+
return /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
1135
|
+
PhoneInput2,
|
|
1136
|
+
{
|
|
1137
|
+
id: "phone",
|
|
1138
|
+
label: "Telefone *",
|
|
1139
|
+
placeholder: "(11) 00000-0000",
|
|
1140
|
+
borderColor: colorPrimary,
|
|
1141
|
+
textColor,
|
|
1142
|
+
error: errorMsg,
|
|
1143
|
+
required: true,
|
|
1144
|
+
value: field.value.phone,
|
|
1145
|
+
onChange: field.onChange,
|
|
1146
|
+
name: field.name
|
|
1147
|
+
}
|
|
1148
|
+
);
|
|
1149
|
+
}
|
|
1150
|
+
},
|
|
1151
|
+
formKey
|
|
975
1152
|
),
|
|
976
|
-
/* @__PURE__ */ (0,
|
|
977
|
-
/* @__PURE__ */ (0,
|
|
978
|
-
/* @__PURE__ */ (0,
|
|
1153
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)("h6", { children: "* Campos de preenchimento obrigat\xF3rio." }),
|
|
1154
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(ButtonContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(Button2, { bgColor: colorPrimary, color: textColor, type: "submit", isSubmitting: loading, children: "Enviar mensagem" }) }),
|
|
1155
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("p", { children: [
|
|
979
1156
|
"A Mitre Realty respeita a sua privacidade e utiliza os seus dados pessoais para contat\xE1-lo por e-mail ou telefone aqui registrados. Para saber mais, acesse a nossa",
|
|
980
1157
|
" ",
|
|
981
|
-
/* @__PURE__ */ (0,
|
|
1158
|
+
/* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
|
|
982
1159
|
"a",
|
|
983
1160
|
{
|
|
984
1161
|
href: "https://www.mitrerealty.com.br/politica-de-privacidade",
|