@redneckz/wildless-cms-uni-blocks 0.14.288 → 0.14.289
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/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +91 -81
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationFormCustom/ApplicationFormCustomContent.d.ts +11 -4
- package/bundle/components/ApplicationFormCustom/getFormatData.d.ts +2 -3
- package/bundle/components/ApplicationFormCustom/getInitialFormState.d.ts +4 -0
- package/bundle/components/ApplicationFormGrantSupport/ApplicationFormGrantSupportContent.d.ts +2 -0
- package/bundle/hooks/useAspects/handleAspects.d.ts +10 -0
- package/bundle/hooks/useForm.d.ts +4 -4
- package/bundle/model/AspectsProps.d.ts +1 -1
- package/dist/components/ApplicationFormCustom/ApplicationFormCustom.js +13 -6
- package/dist/components/ApplicationFormCustom/ApplicationFormCustom.js.map +1 -1
- package/dist/components/ApplicationFormCustom/ApplicationFormCustomContent.d.ts +11 -4
- package/dist/components/ApplicationFormCustom/getFormatData.d.ts +2 -3
- package/dist/components/ApplicationFormCustom/getFormatData.js.map +1 -1
- package/dist/components/ApplicationFormCustom/getInitialFormState.d.ts +4 -0
- package/dist/components/ApplicationFormCustom/getInitialFormState.js.map +1 -1
- package/dist/components/ApplicationFormGrantSupport/ApplicationFormGrantSupport.js +2 -2
- package/dist/components/ApplicationFormGrantSupport/ApplicationFormGrantSupport.js.map +1 -1
- package/dist/components/ApplicationFormGrantSupport/ApplicationFormGrantSupportContent.d.ts +2 -0
- package/dist/hooks/useAspects/applyAspects.js +2 -3
- package/dist/hooks/useAspects/applyAspects.js.map +1 -1
- package/dist/hooks/useAspects/handleAspects.d.ts +10 -0
- package/dist/hooks/useAspects/handleAspects.js +10 -0
- package/dist/hooks/useAspects/handleAspects.js.map +1 -0
- package/dist/hooks/useForm.d.ts +4 -4
- package/dist/hooks/useForm.js +4 -4
- package/dist/hooks/useForm.js.map +1 -1
- package/dist/model/AspectsProps.d.ts +1 -1
- package/dist/ui-kit/InputRange/InputRange.js +2 -2
- package/dist/ui-kit/InputRange/InputRange.js.map +1 -1
- package/dist/ui-kit/InputRange/renderRangeWithTicks.js +2 -2
- package/dist/ui-kit/InputRange/renderRangeWithTicks.js.map +1 -1
- package/dist/ui-kit/PhoneInput/PhoneInput.js +1 -1
- package/dist/ui-kit/PhoneInput/PhoneInput.js.map +1 -1
- package/lib/components/ApplicationFormCustom/ApplicationFormCustom.js +14 -7
- package/lib/components/ApplicationFormCustom/ApplicationFormCustom.js.map +1 -1
- package/lib/components/ApplicationFormCustom/ApplicationFormCustomContent.d.ts +11 -4
- package/lib/components/ApplicationFormCustom/getFormatData.d.ts +2 -3
- package/lib/components/ApplicationFormCustom/getFormatData.js.map +1 -1
- package/lib/components/ApplicationFormCustom/getInitialFormState.d.ts +4 -0
- package/lib/components/ApplicationFormCustom/getInitialFormState.js.map +1 -1
- package/lib/components/ApplicationFormGrantSupport/ApplicationFormGrantSupport.js +2 -2
- package/lib/components/ApplicationFormGrantSupport/ApplicationFormGrantSupport.js.map +1 -1
- package/lib/components/ApplicationFormGrantSupport/ApplicationFormGrantSupportContent.d.ts +2 -0
- package/lib/hooks/useAspects/applyAspects.js +2 -3
- package/lib/hooks/useAspects/applyAspects.js.map +1 -1
- package/lib/hooks/useAspects/handleAspects.d.ts +10 -0
- package/lib/hooks/useAspects/handleAspects.js +7 -0
- package/lib/hooks/useAspects/handleAspects.js.map +1 -0
- package/lib/hooks/useForm.d.ts +4 -4
- package/lib/hooks/useForm.js +4 -4
- package/lib/hooks/useForm.js.map +1 -1
- package/lib/model/AspectsProps.d.ts +1 -1
- package/lib/ui-kit/InputRange/InputRange.js +2 -2
- package/lib/ui-kit/InputRange/InputRange.js.map +1 -1
- package/lib/ui-kit/InputRange/renderRangeWithTicks.js +2 -2
- package/lib/ui-kit/InputRange/renderRangeWithTicks.js.map +1 -1
- package/lib/ui-kit/PhoneInput/PhoneInput.js +1 -1
- package/lib/ui-kit/PhoneInput/PhoneInput.js.map +1 -1
- package/mobile/bundle/bundle.umd.js +89 -79
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationFormCustom/ApplicationFormCustomContent.d.ts +11 -4
- package/mobile/bundle/components/ApplicationFormCustom/getFormatData.d.ts +2 -3
- package/mobile/bundle/components/ApplicationFormCustom/getInitialFormState.d.ts +4 -0
- package/mobile/bundle/components/ApplicationFormGrantSupport/ApplicationFormGrantSupportContent.d.ts +2 -0
- package/mobile/bundle/hooks/useAspects/handleAspects.d.ts +10 -0
- package/mobile/bundle/hooks/useForm.d.ts +4 -4
- package/mobile/bundle/model/AspectsProps.d.ts +1 -1
- package/mobile/dist/components/ApplicationFormCustom/ApplicationFormCustom.js +13 -6
- package/mobile/dist/components/ApplicationFormCustom/ApplicationFormCustom.js.map +1 -1
- package/mobile/dist/components/ApplicationFormCustom/ApplicationFormCustomContent.d.ts +11 -4
- package/mobile/dist/components/ApplicationFormCustom/getFormatData.d.ts +2 -3
- package/mobile/dist/components/ApplicationFormCustom/getFormatData.js.map +1 -1
- package/mobile/dist/components/ApplicationFormCustom/getInitialFormState.d.ts +4 -0
- package/mobile/dist/components/ApplicationFormCustom/getInitialFormState.js.map +1 -1
- package/mobile/dist/components/ApplicationFormGrantSupport/ApplicationFormGrantSupport.js +2 -2
- package/mobile/dist/components/ApplicationFormGrantSupport/ApplicationFormGrantSupport.js.map +1 -1
- package/mobile/dist/components/ApplicationFormGrantSupport/ApplicationFormGrantSupportContent.d.ts +2 -0
- package/mobile/dist/hooks/useAspects/applyAspects.js +2 -3
- package/mobile/dist/hooks/useAspects/applyAspects.js.map +1 -1
- package/mobile/dist/hooks/useAspects/handleAspects.d.ts +10 -0
- package/mobile/dist/hooks/useAspects/handleAspects.js +10 -0
- package/mobile/dist/hooks/useAspects/handleAspects.js.map +1 -0
- package/mobile/dist/hooks/useForm.d.ts +4 -4
- package/mobile/dist/hooks/useForm.js +4 -4
- package/mobile/dist/hooks/useForm.js.map +1 -1
- package/mobile/dist/model/AspectsProps.d.ts +1 -1
- package/mobile/dist/ui-kit/InputRange/InputRange.js +2 -2
- package/mobile/dist/ui-kit/InputRange/InputRange.js.map +1 -1
- package/mobile/dist/ui-kit/InputRange/renderRangeWithTicks.js +2 -2
- package/mobile/dist/ui-kit/InputRange/renderRangeWithTicks.js.map +1 -1
- package/mobile/dist/ui-kit/PhoneInput/PhoneInput.js +1 -1
- package/mobile/dist/ui-kit/PhoneInput/PhoneInput.js.map +1 -1
- package/mobile/lib/components/ApplicationFormCustom/ApplicationFormCustom.js +14 -7
- package/mobile/lib/components/ApplicationFormCustom/ApplicationFormCustom.js.map +1 -1
- package/mobile/lib/components/ApplicationFormCustom/ApplicationFormCustomContent.d.ts +11 -4
- package/mobile/lib/components/ApplicationFormCustom/getFormatData.d.ts +2 -3
- package/mobile/lib/components/ApplicationFormCustom/getFormatData.js.map +1 -1
- package/mobile/lib/components/ApplicationFormCustom/getInitialFormState.d.ts +4 -0
- package/mobile/lib/components/ApplicationFormCustom/getInitialFormState.js.map +1 -1
- package/mobile/lib/components/ApplicationFormGrantSupport/ApplicationFormGrantSupport.js +2 -2
- package/mobile/lib/components/ApplicationFormGrantSupport/ApplicationFormGrantSupport.js.map +1 -1
- package/mobile/lib/components/ApplicationFormGrantSupport/ApplicationFormGrantSupportContent.d.ts +2 -0
- package/mobile/lib/hooks/useAspects/applyAspects.js +2 -3
- package/mobile/lib/hooks/useAspects/applyAspects.js.map +1 -1
- package/mobile/lib/hooks/useAspects/handleAspects.d.ts +10 -0
- package/mobile/lib/hooks/useAspects/handleAspects.js +7 -0
- package/mobile/lib/hooks/useAspects/handleAspects.js.map +1 -0
- package/mobile/lib/hooks/useForm.d.ts +4 -4
- package/mobile/lib/hooks/useForm.js +4 -4
- package/mobile/lib/hooks/useForm.js.map +1 -1
- package/mobile/lib/model/AspectsProps.d.ts +1 -1
- package/mobile/lib/ui-kit/InputRange/InputRange.js +2 -2
- package/mobile/lib/ui-kit/InputRange/InputRange.js.map +1 -1
- package/mobile/lib/ui-kit/InputRange/renderRangeWithTicks.js +2 -2
- package/mobile/lib/ui-kit/InputRange/renderRangeWithTicks.js.map +1 -1
- package/mobile/lib/ui-kit/PhoneInput/PhoneInput.js +1 -1
- package/mobile/lib/ui-kit/PhoneInput/PhoneInput.js.map +1 -1
- package/mobile/src/components/ApplicationFormCustom/ApplicationFormCustom.example.json +0 -1
- package/mobile/src/components/ApplicationFormCustom/ApplicationFormCustom.tsx +31 -16
- package/mobile/src/components/ApplicationFormCustom/ApplicationFormCustomContent.ts +11 -4
- package/mobile/src/components/ApplicationFormCustom/getFormatData.tsx +6 -5
- package/mobile/src/components/ApplicationFormCustom/getInitialFormState.tsx +4 -0
- package/mobile/src/components/ApplicationFormGrantSupport/ApplicationFormGrantSupport.tsx +2 -1
- package/mobile/src/components/ApplicationFormGrantSupport/ApplicationFormGrantSupportContent.ts +2 -0
- package/mobile/src/hooks/useAspects/applyAspects.ts +2 -4
- package/mobile/src/hooks/useAspects/handleAspects.ts +18 -0
- package/mobile/src/hooks/useForm.ts +12 -6
- package/mobile/src/model/AspectsProps.ts +1 -1
- package/mobile/src/ui-kit/InputRange/InputRange.tsx +2 -2
- package/mobile/src/ui-kit/InputRange/renderRangeWithTicks.tsx +2 -2
- package/mobile/src/ui-kit/PhoneInput/PhoneInput.tsx +2 -2
- package/package.json +1 -1
- package/src/components/ApplicationFormCustom/ApplicationFormCustom.example.json +0 -1
- package/src/components/ApplicationFormCustom/ApplicationFormCustom.tsx +31 -16
- package/src/components/ApplicationFormCustom/ApplicationFormCustomContent.ts +11 -4
- package/src/components/ApplicationFormCustom/getFormatData.tsx +6 -5
- package/src/components/ApplicationFormCustom/getInitialFormState.tsx +4 -0
- package/src/components/ApplicationFormGrantSupport/ApplicationFormGrantSupport.fixture.tsx +8 -0
- package/src/components/ApplicationFormGrantSupport/ApplicationFormGrantSupport.tsx +2 -1
- package/src/components/ApplicationFormGrantSupport/ApplicationFormGrantSupportContent.ts +2 -0
- package/src/hooks/useAspects/applyAspects.ts +2 -4
- package/src/hooks/useAspects/handleAspects.ts +18 -0
- package/src/hooks/useForm.ts +12 -6
- package/src/model/AspectsProps.ts +1 -1
- package/src/ui-kit/InputRange/InputRange.tsx +2 -2
- package/src/ui-kit/InputRange/renderRangeWithTicks.tsx +2 -2
- package/src/ui-kit/PhoneInput/PhoneInput.tsx +2 -2
package/bundle/bundle.umd.js
CHANGED
|
@@ -881,9 +881,76 @@
|
|
|
881
881
|
: { secondaryPhoneNumber: formatPhone(secondaryPhone) };
|
|
882
882
|
};
|
|
883
883
|
|
|
884
|
+
const handleAspects = ({ aspectsAttributes, aspects, ev, formData }) => {
|
|
885
|
+
for (const { aspectName, params } of aspectsAttributes) {
|
|
886
|
+
const paramsData = aspectName === 'mindboxEvent' ? { ...params, eventJson: JSON.stringify(formData) } : params;
|
|
887
|
+
aspects[aspectName ?? '']?.(ev, paramsData);
|
|
888
|
+
}
|
|
889
|
+
};
|
|
890
|
+
|
|
891
|
+
const QUERY_STORAGE_KEY = 'rshb-query-params';
|
|
892
|
+
function saveSessionQuery() {
|
|
893
|
+
const result = globalThis.location?.search || globalThis.sessionStorage?.getItem(QUERY_STORAGE_KEY) || '';
|
|
894
|
+
if (result) {
|
|
895
|
+
globalThis.sessionStorage?.setItem(QUERY_STORAGE_KEY, result);
|
|
896
|
+
}
|
|
897
|
+
return result;
|
|
898
|
+
}
|
|
899
|
+
|
|
900
|
+
const adjustSessionQuery = (href) => {
|
|
901
|
+
const sessionQuery = saveSessionQuery();
|
|
902
|
+
if (!isURL(href) || !sessionQuery) {
|
|
903
|
+
return href;
|
|
904
|
+
}
|
|
905
|
+
const url = new URL(href);
|
|
906
|
+
for (const [key, value] of new URLSearchParams(sessionQuery)) {
|
|
907
|
+
url.searchParams.set(key, value);
|
|
908
|
+
}
|
|
909
|
+
return url.toString();
|
|
910
|
+
};
|
|
911
|
+
|
|
912
|
+
const tableFunc = (table) => (input) => {
|
|
913
|
+
const [, output] = table.find(([predicate]) => predicate(input)) || [];
|
|
914
|
+
return output;
|
|
915
|
+
};
|
|
916
|
+
|
|
917
|
+
const forwardQuery = (ev) => {
|
|
918
|
+
const anchor = ev.target?.closest('a');
|
|
919
|
+
if (isURL(anchor?.href) && !anchor?.href?.startsWith(globalThis.location?.origin)) {
|
|
920
|
+
ev.preventDefault();
|
|
921
|
+
ev.stopPropagation();
|
|
922
|
+
const url = adjustSessionQuery(anchor?.href) || anchor?.href;
|
|
923
|
+
if (url) {
|
|
924
|
+
const transition = getTransition(anchor?.target);
|
|
925
|
+
transition?.(url);
|
|
926
|
+
}
|
|
927
|
+
}
|
|
928
|
+
};
|
|
929
|
+
const getTransition = tableFunc([
|
|
930
|
+
[(_) => _ === '_blank', (url) => globalThis.open(url, '_blank')],
|
|
931
|
+
[(_) => _ === '_parent', (url) => globalThis.parent && (globalThis.parent.location.href = url)],
|
|
932
|
+
[
|
|
933
|
+
(_) => _ === '_top',
|
|
934
|
+
(url) => {
|
|
935
|
+
globalThis.top && (globalThis.top.location.href = url);
|
|
936
|
+
},
|
|
937
|
+
],
|
|
938
|
+
[() => true, (url) => globalThis.location && (globalThis.location.href = url)],
|
|
939
|
+
]);
|
|
940
|
+
|
|
941
|
+
function useAspects() {
|
|
942
|
+
return useAspects._impl();
|
|
943
|
+
}
|
|
944
|
+
useAspects._impl = () => ({
|
|
945
|
+
forwardQuery,
|
|
946
|
+
});
|
|
947
|
+
useAspects.setup = (impl) => {
|
|
948
|
+
useAspects._impl = impl;
|
|
949
|
+
};
|
|
950
|
+
|
|
884
951
|
const identity = (_) => _;
|
|
885
952
|
|
|
886
|
-
const useForm = (initialState, { resetOnSubmit, onSubmit } = {}) => {
|
|
953
|
+
const useForm = (initialState, { resetOnSubmit, onSubmit, } = {}) => {
|
|
887
954
|
const [formState, setFormState] = useState(initialState);
|
|
888
955
|
const [isDirtyForm, setDirtyForm] = useState(false);
|
|
889
956
|
const [dirtyFieldsMap, setDirtyFieldsMap] = useState({});
|
|
@@ -912,10 +979,10 @@
|
|
|
912
979
|
setDirtyForm(false);
|
|
913
980
|
setDirtyFieldsMap({});
|
|
914
981
|
}, [initialState]);
|
|
915
|
-
const handleSubmit = useCallback((
|
|
916
|
-
|
|
982
|
+
const handleSubmit = useCallback((ev) => {
|
|
983
|
+
ev.preventDefault();
|
|
917
984
|
resetOnSubmit ? reset() : setDirtyForm(true);
|
|
918
|
-
onSubmit && onSubmit(formState);
|
|
985
|
+
onSubmit && onSubmit(formState, ev);
|
|
919
986
|
}, [onSubmit, formState]);
|
|
920
987
|
return [
|
|
921
988
|
formState,
|
|
@@ -1283,7 +1350,7 @@
|
|
|
1283
1350
|
const handleBlur = useCallback((v) => {
|
|
1284
1351
|
v === '+7 (' ? onChange && onChange('') : null;
|
|
1285
1352
|
}, []);
|
|
1286
|
-
return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (
|
|
1353
|
+
return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
|
|
1287
1354
|
});
|
|
1288
1355
|
|
|
1289
1356
|
const InputPhoneControl = JSX(({ className, label, value, error, onChange, onBlur, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(PhoneInput, { "aria-label": label, label: rest?.errors ? `${label}*` : label, valid: Boolean(!error), value: value, onChange: onChange, onBlur: onBlur, placeholder: "+7 (___) ___-__-__" }), renderErrorText(error)] })));
|
|
@@ -1500,8 +1567,8 @@
|
|
|
1500
1567
|
const inputStyle = {
|
|
1501
1568
|
backgroundSize: `${percentage.toFixed(2)}% 100%`,
|
|
1502
1569
|
};
|
|
1503
|
-
return (jsxs("div", { children: [list.length ? (jsx("div", { className: "absolute w-full flex justify-between -bottom-[3px] px-m", children: list.map((_, i) => (jsx("div", { className: style('w-2 h-2 rounded-full', rangeValue <= i || disabled ? 'bg-gray' : 'bg-primary-main') }, String(i)))) })) : null, jsx("div", { className: "absolute inset-x-0 -bottom-1 px-m leading-[18px]", children: jsx("input", { className: "box-border w-full m-0 cursor-pointer slider relative z-10", style: inputStyle, type: "range", min: min, max: max, step: step, value: rangeValue, disabled: disabled, onInput: ((
|
|
1504
|
-
const rawValue = parseDecimal(
|
|
1570
|
+
return (jsxs("div", { children: [list.length ? (jsx("div", { className: "absolute w-full flex justify-between -bottom-[3px] px-m", children: list.map((_, i) => (jsx("div", { className: style('w-2 h-2 rounded-full', rangeValue <= i || disabled ? 'bg-gray' : 'bg-primary-main') }, String(i)))) })) : null, jsx("div", { className: "absolute inset-x-0 -bottom-1 px-m leading-[18px]", children: jsx("input", { className: "box-border w-full m-0 cursor-pointer slider relative z-10", style: inputStyle, type: "range", min: min, max: max, step: step, value: rangeValue, disabled: disabled, onInput: ((ev) => {
|
|
1571
|
+
const rawValue = parseDecimal(ev.target?.value);
|
|
1505
1572
|
const newValue = list.length ? list[rawValue] : rawValue;
|
|
1506
1573
|
onChange && onChange(newValue || 0);
|
|
1507
1574
|
}) }) })] }));
|
|
@@ -1516,8 +1583,8 @@
|
|
|
1516
1583
|
normalize: (_ = 0) => list.length ? closestValue(list)(_) : clamp(_, min, max),
|
|
1517
1584
|
format: toLocalNumberFormat(),
|
|
1518
1585
|
});
|
|
1519
|
-
const handleChange = useCallback((
|
|
1520
|
-
onChange && onChange(parseDecimal(
|
|
1586
|
+
const handleChange = useCallback((ev) => {
|
|
1587
|
+
onChange && onChange(parseDecimal(ev.target?.value));
|
|
1521
1588
|
}, [onChange]);
|
|
1522
1589
|
return (jsxs("div", { className: className, children: [jsxs("label", { className: "block relative", children: [title ? (jsx(Text, { size: "text-m", font: "font-light", color: "text-primary-text", children: title })) : null, jsx("input", { className: style('mt-xs font-sans text-h3 w-full h-14', 'border border-solid border-gray rounded-md outline-none', 'pl-m box-border', 'text-primary-text hover:border-primary-hover focus:border-primary-text', DISABLED_INPUT_CLASSES), disabled: disabled, onInput: handleChange, ...normalizedProps }), renderRangeWithTicks({ list, min, max, step, disabled, value, onChange })] }), renderRangeCaption(items)] }));
|
|
1523
1590
|
});
|
|
@@ -1784,19 +1851,23 @@
|
|
|
1784
1851
|
const renderContacts = () => (jsxs("div", { className: "space-y-m", children: [jsx(Heading, { headingType: "h6", title: "\u0418\u043B\u0438 \u0441\u0432\u044F\u0436\u0438\u0442\u0435\u0441\u044C \u0441 \u043D\u0430\u043C\u0438 \u0443\u0434\u043E\u0431\u043D\u044B\u043C \u0441\u043F\u043E\u0441\u043E\u0431\u043E\u043C", className: "@xl:text-center" }), jsxs("div", { className: "flex gap-xl", children: [jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", href: `tel:8 (800) 200-78-70`, "aria-label": "8 (800) 200-78-70", children: [jsx(Img, { image: { icon: 'PhoneIcon' }, width: "24", height: "24" }), jsx("span", { children: "8 (800) 200-78-70" })] }), jsxs("a", { className: "flex gap-s items-center text-primary-text no-underline", "aria-label": "ved@rshb.ru", href: `mailto:ved@rshb.ru`, children: [jsx(Img, { image: { icon: 'MailIcon' }, width: "24", height: "24" }), jsx("span", { children: "ved@rshb.ru" })] })] })] }));
|
|
1785
1852
|
|
|
1786
1853
|
const API = LeadServiceAPI();
|
|
1787
|
-
const ApplicationFormCustom = JSX(({ className, title, typeForm = '', sections = [], button, link, endpoint, additionalParams, isContacts, ...rest }) => {
|
|
1854
|
+
const ApplicationFormCustom = JSX(({ className, title, typeForm = '', sections = [], button, link, endpoint, additionalParams, isContacts, data, ...rest }) => {
|
|
1788
1855
|
const inputs = (sections?.flatMap((_) => _?.inputs) || []);
|
|
1789
1856
|
const initialFormState = getInitialFormState(inputs, typeForm);
|
|
1790
1857
|
const [responseType, setResponseType] = useState('');
|
|
1791
|
-
const handleSubmit = useCallback(async (
|
|
1792
|
-
const inputsFiltered = getFilteredInputs(inputs,
|
|
1858
|
+
const handleSubmit = useCallback(async (formData, ev) => {
|
|
1859
|
+
const inputsFiltered = getFilteredInputs(inputs, formData);
|
|
1793
1860
|
const feedbackValidator = objectValidator(getObjectValidator(inputsFiltered));
|
|
1794
|
-
if (!isValidationSuccess(feedbackValidator(
|
|
1861
|
+
if (!isValidationSuccess(feedbackValidator(formData))) {
|
|
1795
1862
|
return 'Fail';
|
|
1796
1863
|
}
|
|
1797
|
-
const formatData = getFormatData({ ...
|
|
1864
|
+
const formatData = getFormatData({ ...formData, ...additionalParams });
|
|
1798
1865
|
const status = (await API.send(formatData, endpoint === 'lead')) ? 'OK' : 'Fail';
|
|
1799
1866
|
setResponseType(status);
|
|
1867
|
+
if (status === 'OK' && data) {
|
|
1868
|
+
const aspects = useAspects();
|
|
1869
|
+
handleAspects({ aspectsAttributes: data, aspects, ev, formData: formatData });
|
|
1870
|
+
}
|
|
1800
1871
|
return status;
|
|
1801
1872
|
}, []);
|
|
1802
1873
|
const [, { field, onSubmit, reset }] = useForm(initialFormState, { onSubmit: handleSubmit });
|
|
@@ -1806,8 +1877,9 @@
|
|
|
1806
1877
|
reset();
|
|
1807
1878
|
}
|
|
1808
1879
|
}, [responseType]);
|
|
1809
|
-
return (jsxs(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, responseType: responseType, ...rest, children: [jsxs("form", { onSubmit: onSubmit, children: [sections.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [
|
|
1880
|
+
return (jsxs(ApplicationFormLayout, { className: style('container space-y-m', className), title: title, responseType: responseType, ...rest, children: [jsxs("form", { onSubmit: onSubmit, children: [sections.map((_, i) => (jsxs("div", { className: style(inputColumnStyles(_.columns), 'grid gap-x-m'), children: [renderTitle(_.title), (_?.inputs || [])?.map(getField(field, typeForm))] }, `section-${i}`))), renderAgreementSubmit(fieldName ? field('consentDataProcessing') : undefined, link, button)] }), isContacts ? renderContacts() : null] }));
|
|
1810
1881
|
});
|
|
1882
|
+
const renderTitle = (title) => title ? (jsx("div", { className: "@xl:text-center @xl:col-span-2 mb-m", children: jsx(Text, { size: "text-h6", children: title }) })) : null;
|
|
1811
1883
|
const inputColumnStyles = (column) => column === 2 ? '@xl:grid-cols-2' : '';
|
|
1812
1884
|
const getConsentDataProcessing = (inputs) => inputs?.find((_) => _?.name === 'consentDataProcessing');
|
|
1813
1885
|
const getFilteredInputs = (inputs, data) => inputs
|
|
@@ -1820,7 +1892,7 @@
|
|
|
1820
1892
|
: _ === (dataValue?.key ?? dataValue);
|
|
1821
1893
|
}));
|
|
1822
1894
|
|
|
1823
|
-
const ApplicationFormGrantSupport = UniBlock(({ className, title, button, regionSource, ...rest }) => {
|
|
1895
|
+
const ApplicationFormGrantSupport = UniBlock(({ className, title, button, regionSource, data, ...rest }) => {
|
|
1824
1896
|
const [region, setRegion] = useState({ key: '' });
|
|
1825
1897
|
const regions = regionSource?.regions ?? [];
|
|
1826
1898
|
const buttonStyle = getRegularButtonClasses({
|
|
@@ -1829,7 +1901,7 @@
|
|
|
1829
1901
|
});
|
|
1830
1902
|
const regionHref = regions?.find((_) => _.name === region.key)?.href;
|
|
1831
1903
|
const buttonText = button?.text ? button.text : 'Перейти';
|
|
1832
|
-
return (jsx(BlockWrapper, { className: className, defaultPadding: "p-6xl", ...rest, children: jsxs("div", { className: "container max-w-[978px] space-y-m", children: [title ? jsx(Heading, { headingType: "h3", title: title, className: "@xl:text-center" }) : null, regions ? (jsx(SelectControl, { label: "\u0412\u0430\u0448 \u0440\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D", isSearch: true, options: regions.map(({ name = '' }) => ({ key: name, text: name })), value: region, onChange: setRegion })) : null, regionHref ? (jsx("div", { className: "text-center", children: jsx(LinkButton, { href: regionHref, target: "_blank", className: style('p-m w-full @xl:w-auto', buttonStyle), children: buttonText }) })) : null] }) }));
|
|
1904
|
+
return (jsx(BlockWrapper, { className: className, defaultPadding: "p-6xl", ...rest, children: jsxs("div", { className: "container max-w-[978px] space-y-m", children: [title ? jsx(Heading, { headingType: "h3", title: title, className: "@xl:text-center" }) : null, regions ? (jsx(SelectControl, { label: "\u0412\u0430\u0448 \u0440\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D", isSearch: true, options: regions.map(({ name = '' }) => ({ key: name, text: name })), value: region, onChange: setRegion })) : null, regionHref ? (jsx("div", { className: "text-center", children: jsx(LinkButton, { href: regionHref, target: "_blank", className: style('p-m w-full @xl:w-auto', buttonStyle), data: data, children: buttonText }) })) : null] }) }));
|
|
1833
1905
|
});
|
|
1834
1906
|
|
|
1835
1907
|
const joinList = (sep) => (list) => list.reduce((acc, el, i) => (acc.length ? acc.concat({ ...sep, key: `sep-${i}` }, el) : [el]), []);
|
|
@@ -3697,11 +3769,6 @@
|
|
|
3697
3769
|
};
|
|
3698
3770
|
const formatValue = (value) => value.replace(/[^\d.,]/g, '').replace(',', '.');
|
|
3699
3771
|
|
|
3700
|
-
const tableFunc = (table) => (input) => {
|
|
3701
|
-
const [, output] = table.find(([predicate]) => predicate(input)) || [];
|
|
3702
|
-
return output;
|
|
3703
|
-
};
|
|
3704
|
-
|
|
3705
3772
|
const callbackCurrencySelect = (props) => tableFunc([
|
|
3706
3773
|
[
|
|
3707
3774
|
(_) => _.value !== Currency.RUB && _.oppositeValue !== Currency.RUB,
|
|
@@ -5917,22 +5984,11 @@
|
|
|
5917
5984
|
Video,
|
|
5918
5985
|
};
|
|
5919
5986
|
|
|
5920
|
-
const QUERY_STORAGE_KEY = 'rshb-query-params';
|
|
5921
|
-
function saveSessionQuery() {
|
|
5922
|
-
const result = globalThis.location?.search || globalThis.sessionStorage?.getItem(QUERY_STORAGE_KEY) || '';
|
|
5923
|
-
if (result) {
|
|
5924
|
-
globalThis.sessionStorage?.setItem(QUERY_STORAGE_KEY, result);
|
|
5925
|
-
}
|
|
5926
|
-
return result;
|
|
5927
|
-
}
|
|
5928
|
-
|
|
5929
5987
|
const applyAspects = (aspects) => (ev) => {
|
|
5930
5988
|
const element = ev.target?.closest('[data-aspects]');
|
|
5931
5989
|
try {
|
|
5932
5990
|
const aspectsAttributes = JSON.parse(element?.dataset?.aspects ?? '[]');
|
|
5933
|
-
|
|
5934
|
-
aspects[aspectName ?? '']?.(ev, params);
|
|
5935
|
-
}
|
|
5991
|
+
handleAspects({ aspectsAttributes, aspects, ev });
|
|
5936
5992
|
}
|
|
5937
5993
|
catch (_) {
|
|
5938
5994
|
// Do nothing
|
|
@@ -5941,52 +5997,6 @@
|
|
|
5941
5997
|
aspects.forwardQuery?.(ev);
|
|
5942
5998
|
};
|
|
5943
5999
|
|
|
5944
|
-
const adjustSessionQuery = (href) => {
|
|
5945
|
-
const sessionQuery = saveSessionQuery();
|
|
5946
|
-
if (!isURL(href) || !sessionQuery) {
|
|
5947
|
-
return href;
|
|
5948
|
-
}
|
|
5949
|
-
const url = new URL(href);
|
|
5950
|
-
for (const [key, value] of new URLSearchParams(sessionQuery)) {
|
|
5951
|
-
url.searchParams.set(key, value);
|
|
5952
|
-
}
|
|
5953
|
-
return url.toString();
|
|
5954
|
-
};
|
|
5955
|
-
|
|
5956
|
-
const forwardQuery = (ev) => {
|
|
5957
|
-
const anchor = ev.target?.closest('a');
|
|
5958
|
-
if (isURL(anchor?.href) && !anchor?.href?.startsWith(globalThis.location?.origin)) {
|
|
5959
|
-
ev.preventDefault();
|
|
5960
|
-
ev.stopPropagation();
|
|
5961
|
-
const url = adjustSessionQuery(anchor?.href) || anchor?.href;
|
|
5962
|
-
if (url) {
|
|
5963
|
-
const transition = getTransition(anchor?.target);
|
|
5964
|
-
transition?.(url);
|
|
5965
|
-
}
|
|
5966
|
-
}
|
|
5967
|
-
};
|
|
5968
|
-
const getTransition = tableFunc([
|
|
5969
|
-
[(_) => _ === '_blank', (url) => globalThis.open(url, '_blank')],
|
|
5970
|
-
[(_) => _ === '_parent', (url) => globalThis.parent && (globalThis.parent.location.href = url)],
|
|
5971
|
-
[
|
|
5972
|
-
(_) => _ === '_top',
|
|
5973
|
-
(url) => {
|
|
5974
|
-
globalThis.top && (globalThis.top.location.href = url);
|
|
5975
|
-
},
|
|
5976
|
-
],
|
|
5977
|
-
[() => true, (url) => globalThis.location && (globalThis.location.href = url)],
|
|
5978
|
-
]);
|
|
5979
|
-
|
|
5980
|
-
function useAspects() {
|
|
5981
|
-
return useAspects._impl();
|
|
5982
|
-
}
|
|
5983
|
-
useAspects._impl = () => ({
|
|
5984
|
-
forwardQuery,
|
|
5985
|
-
});
|
|
5986
|
-
useAspects.setup = (impl) => {
|
|
5987
|
-
useAspects._impl = impl;
|
|
5988
|
-
};
|
|
5989
|
-
|
|
5990
6000
|
const useClickHandler = handlerDecorator(() => {
|
|
5991
6001
|
useEffect(() => {
|
|
5992
6002
|
saveSessionQuery(); //? Call first time for save query in sessionStorage
|
|
@@ -6145,7 +6155,7 @@
|
|
|
6145
6155
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
6146
6156
|
});
|
|
6147
6157
|
|
|
6148
|
-
const packageVersion = "0.14.
|
|
6158
|
+
const packageVersion = "0.14.288";
|
|
6149
6159
|
|
|
6150
6160
|
exports.Blocks = Blocks;
|
|
6151
6161
|
exports.ContentPage = ContentPage;
|