diy-template-components 2.0.17 → 2.0.19
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/build/index.es.js +8 -3
- package/build/index.es.js.map +1 -1
- package/build/index.js +8 -3
- package/build/index.js.map +1 -1
- package/package.json +1 -1
package/build/index.es.js
CHANGED
|
@@ -6890,6 +6890,7 @@ function FormEnquiry({
|
|
|
6890
6890
|
isMobile
|
|
6891
6891
|
});
|
|
6892
6892
|
const [nodeData] = sectionData.components;
|
|
6893
|
+
const [isSubmitted, setIsSubmitted] = useState(false);
|
|
6893
6894
|
const theme = useTheme();
|
|
6894
6895
|
let [btnDisabled, setBtnDisabled] = useState(false);
|
|
6895
6896
|
let formInitialValue = {
|
|
@@ -6906,12 +6907,12 @@ function FormEnquiry({
|
|
|
6906
6907
|
messageValid: 1
|
|
6907
6908
|
});
|
|
6908
6909
|
useEffect(() => {
|
|
6909
|
-
if (validData?.nameValid && validData?.emailValid && validData?.phoneValid && validData?.messageValid) {
|
|
6910
|
+
if (validData?.nameValid && validData?.emailValid && validData?.phoneValid && validData?.messageValid && inputVal?.email && inputVal?.name && inputVal?.phone && inputVal?.message) {
|
|
6910
6911
|
setBtnDisabled(false);
|
|
6911
6912
|
} else {
|
|
6912
6913
|
setBtnDisabled(true);
|
|
6913
6914
|
}
|
|
6914
|
-
}, [validData]);
|
|
6915
|
+
}, [validData, inputVal]);
|
|
6915
6916
|
const handleSubmit = () => {
|
|
6916
6917
|
let data = {
|
|
6917
6918
|
sectionId: sectionData?._id || null,
|
|
@@ -6926,6 +6927,10 @@ function FormEnquiry({
|
|
|
6926
6927
|
if (!(isPreview || isEdit)) postApiCall(baseURLs, data);
|
|
6927
6928
|
setBtnDisabled(true);
|
|
6928
6929
|
setInputVal(formInitialValue);
|
|
6930
|
+
setIsSubmitted(true);
|
|
6931
|
+
setTimeout(() => {
|
|
6932
|
+
setIsSubmitted(false);
|
|
6933
|
+
}, 1000);
|
|
6929
6934
|
};
|
|
6930
6935
|
const checkValidity = (regexField, fieldname, fieldValidity) => {
|
|
6931
6936
|
if (validations?.[regexField]?.length) {
|
|
@@ -7106,7 +7111,7 @@ function FormEnquiry({
|
|
|
7106
7111
|
className: classes.btnContainer
|
|
7107
7112
|
}, /*#__PURE__*/React.createElement(Button, {
|
|
7108
7113
|
ref: nodeData?.cta?.refSetter,
|
|
7109
|
-
data:
|
|
7114
|
+
data: isSubmitted ? {
|
|
7110
7115
|
value: 'Submitted'
|
|
7111
7116
|
} : {
|
|
7112
7117
|
value: nodeData.cta.metadata.value
|