ublo-lib 1.47.28 → 1.47.29
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.
|
@@ -20,6 +20,7 @@ function CustomContactForm({ site, kind, title, fields, presets, className, inne
|
|
|
20
20
|
const [sending, setSending] = React.useState(false);
|
|
21
21
|
const [ready, setReady] = React.useState(false);
|
|
22
22
|
const [settings, setSettings] = React.useState();
|
|
23
|
+
const [formKey, setFormKey] = React.useState(0);
|
|
23
24
|
const { lang, config } = useUbloContext();
|
|
24
25
|
const { site: ubloSite } = config;
|
|
25
26
|
const target = site || ubloSite;
|
|
@@ -51,6 +52,7 @@ function CustomContactForm({ site, kind, title, fields, presets, className, inne
|
|
|
51
52
|
const resetForm = () => {
|
|
52
53
|
presets?.setter?.(undefined);
|
|
53
54
|
setData((currentData) => getInitialFormState(fields, undefined, currentData.subject?.value));
|
|
55
|
+
setFormKey((prevKey) => prevKey + 1);
|
|
54
56
|
};
|
|
55
57
|
const blurForm = () => {
|
|
56
58
|
const activeElement = document.activeElement;
|
|
@@ -86,6 +88,8 @@ function CustomContactForm({ site, kind, title, fields, presets, className, inne
|
|
|
86
88
|
if (ready && !settings) {
|
|
87
89
|
return (_jsx("div", { className: css.root, children: Messages.get(lang, "NO_SETTINGS_FOUND") }));
|
|
88
90
|
}
|
|
89
|
-
const
|
|
90
|
-
|
|
91
|
+
const fullFormKey = presets
|
|
92
|
+
? `${formKey}${JSON.stringify(presets.values)}`
|
|
93
|
+
: formKey;
|
|
94
|
+
return (_jsxs("div", { className: classes, children: [title && _jsx("div", { className: css.title, children: title }), _jsx("div", { className: innerClasses, children: Object.keys(fields).map((key) => (_jsx(Field, { target: target, kind: kind, name: key, field: fields[key], data: data, setData: setData, settings: settings, presets: presets }, key))) }), _jsxs("div", { className: css.bottom, children: [presets?.allowReset && (_jsx(Button, { className: css.resetButton, disabled: sending, onClick: resetForm, children: Messages.get(lang, "reset") })), _jsxs(Button, { className: css.submitButton, disabled: !isFormValid || sending, onClick: sendForm, onPointerEnter: blurForm, children: [sendButtonText || Messages.get(lang, "send"), _jsx(MailIcon, {})] })] }), showSendingOverlay && (_jsxs("div", { className: css.sendingOverlay, children: [_jsx(Icons.Spinner, { className: css.sendingIcon }), _jsx("span", { className: css.sendingMessage, children: Messages.get(lang, "sending") })] }))] }, fullFormKey));
|
|
91
95
|
}
|