@redneckz/wildless-cms-uni-blocks 0.14.914 → 0.14.915
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/bin/migration-scripts/0.14.910.js +27 -0
- package/bundle/api/LeadServiceAPI.d.ts +0 -1
- package/bundle/api/getSubmitBody.d.ts +120 -96
- package/bundle/blocks.schema.json +1 -1
- package/bundle/bundle.umd.js +133 -82
- package/bundle/bundle.umd.min.js +1 -1
- package/bundle/components/ApplicationForm/getInitialFormState.d.ts +3 -0
- package/bundle/hooks/useDadataParty.d.ts +6 -0
- package/bundle/ui-kit/FormField/Fields/DadataPartySelectField.d.ts +6 -0
- package/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/bundle/ui-kit/Select/Option.d.ts +3 -6
- package/bundle/ui-kit/Select/Select.d.ts +2 -1
- package/bundle/ui-kit/Select/SelectPopup.d.ts +6 -2
- package/bundle/ui-kit/Select/useSelectPopup.d.ts +2 -1
- package/dist/api/LeadServiceAPI.d.ts +0 -1
- package/dist/api/LeadServiceAPI.js.map +1 -1
- package/dist/api/getSubmitBody.d.ts +120 -96
- package/dist/api/getSubmitBody.js +1 -6
- package/dist/api/getSubmitBody.js.map +1 -1
- package/dist/components/ApplicationForm/getFormatData.js +11 -1
- package/dist/components/ApplicationForm/getFormatData.js.map +1 -1
- package/dist/components/ApplicationForm/getInitialFormState.d.ts +3 -0
- package/dist/components/ApplicationForm/getInitialFormState.js.map +1 -1
- package/dist/hooks/useDadataParty.d.ts +6 -0
- package/dist/hooks/{useInn.js → useDadataParty.js} +4 -4
- package/dist/hooks/useDadataParty.js.map +1 -0
- package/dist/ui-kit/FormField/Fields/DadataPartySelectField.d.ts +6 -0
- package/dist/ui-kit/FormField/Fields/DadataPartySelectField.js +84 -0
- package/dist/ui-kit/FormField/Fields/DadataPartySelectField.js.map +1 -0
- package/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/dist/ui-kit/FormField/getField.js +3 -4
- package/dist/ui-kit/FormField/getField.js.map +1 -1
- package/dist/ui-kit/FormField/getObjectValidator.js +3 -3
- package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/dist/ui-kit/Select/Option.d.ts +3 -6
- package/dist/ui-kit/Select/Select.d.ts +2 -1
- package/dist/ui-kit/Select/Select.js +4 -4
- package/dist/ui-kit/Select/Select.js.map +1 -1
- package/dist/ui-kit/Select/SelectPopup.d.ts +6 -2
- package/dist/ui-kit/Select/SelectPopup.js +5 -3
- package/dist/ui-kit/Select/SelectPopup.js.map +1 -1
- package/dist/ui-kit/Select/useSelectPopup.d.ts +2 -1
- package/dist/ui-kit/Select/useSelectPopup.js +6 -3
- package/dist/ui-kit/Select/useSelectPopup.js.map +1 -1
- package/lib/api/LeadServiceAPI.d.ts +0 -1
- package/lib/api/LeadServiceAPI.js.map +1 -1
- package/lib/api/getSubmitBody.d.ts +120 -96
- package/lib/api/getSubmitBody.js +1 -6
- package/lib/api/getSubmitBody.js.map +1 -1
- package/lib/components/ApplicationForm/ApplicationForm.fixture.mobile.d.ts +1 -0
- package/lib/components/ApplicationForm/getFormatData.js +11 -1
- package/lib/components/ApplicationForm/getFormatData.js.map +1 -1
- package/lib/components/ApplicationForm/getInitialFormState.d.ts +3 -0
- package/lib/components/ApplicationForm/getInitialFormState.js.map +1 -1
- package/lib/hooks/useDadataParty.d.ts +6 -0
- package/lib/hooks/{useInn.js → useDadataParty.js} +2 -2
- package/lib/hooks/useDadataParty.js.map +1 -0
- package/lib/ui-kit/FormField/Fields/DadataPartySelectField.d.ts +6 -0
- package/lib/ui-kit/FormField/Fields/DadataPartySelectField.js +82 -0
- package/lib/ui-kit/FormField/Fields/DadataPartySelectField.js.map +1 -0
- package/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/lib/ui-kit/FormField/getField.js +3 -4
- package/lib/ui-kit/FormField/getField.js.map +1 -1
- package/lib/ui-kit/FormField/getObjectValidator.js +3 -3
- package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/lib/ui-kit/Select/Option.d.ts +3 -6
- package/lib/ui-kit/Select/Select.d.ts +2 -1
- package/lib/ui-kit/Select/Select.js +4 -4
- package/lib/ui-kit/Select/Select.js.map +1 -1
- package/lib/ui-kit/Select/SelectPopup.d.ts +6 -2
- package/lib/ui-kit/Select/SelectPopup.js +5 -3
- package/lib/ui-kit/Select/SelectPopup.js.map +1 -1
- package/lib/ui-kit/Select/useSelectPopup.d.ts +2 -1
- package/lib/ui-kit/Select/useSelectPopup.js +6 -3
- package/lib/ui-kit/Select/useSelectPopup.js.map +1 -1
- package/mobile/bundle/api/LeadServiceAPI.d.ts +0 -1
- package/mobile/bundle/api/getSubmitBody.d.ts +120 -96
- package/mobile/bundle/bundle.umd.js +133 -82
- package/mobile/bundle/bundle.umd.min.js +1 -1
- package/mobile/bundle/components/ApplicationForm/getInitialFormState.d.ts +3 -0
- package/mobile/bundle/hooks/useDadataParty.d.ts +6 -0
- package/mobile/bundle/ui-kit/FormField/Fields/DadataPartySelectField.d.ts +6 -0
- package/mobile/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/mobile/bundle/ui-kit/Select/Option.d.ts +3 -6
- package/mobile/bundle/ui-kit/Select/Select.d.ts +2 -1
- package/mobile/bundle/ui-kit/Select/SelectPopup.d.ts +6 -2
- package/mobile/bundle/ui-kit/Select/useSelectPopup.d.ts +2 -1
- package/mobile/dist/api/LeadServiceAPI.d.ts +0 -1
- package/mobile/dist/api/LeadServiceAPI.js.map +1 -1
- package/mobile/dist/api/getSubmitBody.d.ts +120 -96
- package/mobile/dist/api/getSubmitBody.js +1 -6
- package/mobile/dist/api/getSubmitBody.js.map +1 -1
- package/mobile/dist/components/ApplicationForm/getFormatData.js +11 -1
- package/mobile/dist/components/ApplicationForm/getFormatData.js.map +1 -1
- package/mobile/dist/components/ApplicationForm/getInitialFormState.d.ts +3 -0
- package/mobile/dist/components/ApplicationForm/getInitialFormState.js.map +1 -1
- package/mobile/dist/hooks/useDadataParty.d.ts +6 -0
- package/mobile/dist/hooks/{useInn.js → useDadataParty.js} +4 -4
- package/mobile/dist/hooks/useDadataParty.js.map +1 -0
- package/mobile/dist/ui-kit/FormField/Fields/DadataPartySelectField.d.ts +6 -0
- package/mobile/dist/ui-kit/FormField/Fields/DadataPartySelectField.js +84 -0
- package/mobile/dist/ui-kit/FormField/Fields/DadataPartySelectField.js.map +1 -0
- package/mobile/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/mobile/dist/ui-kit/FormField/getField.js +3 -4
- package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js +3 -3
- package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/dist/ui-kit/Select/Option.d.ts +3 -6
- package/mobile/dist/ui-kit/Select/Select.d.ts +2 -1
- package/mobile/dist/ui-kit/Select/Select.js +4 -4
- package/mobile/dist/ui-kit/Select/Select.js.map +1 -1
- package/mobile/dist/ui-kit/Select/SelectPopup.d.ts +6 -2
- package/mobile/dist/ui-kit/Select/SelectPopup.js +5 -3
- package/mobile/dist/ui-kit/Select/SelectPopup.js.map +1 -1
- package/mobile/dist/ui-kit/Select/useSelectPopup.d.ts +2 -1
- package/mobile/dist/ui-kit/Select/useSelectPopup.js +6 -3
- package/mobile/dist/ui-kit/Select/useSelectPopup.js.map +1 -1
- package/mobile/lib/api/LeadServiceAPI.d.ts +0 -1
- package/mobile/lib/api/LeadServiceAPI.js.map +1 -1
- package/mobile/lib/api/getSubmitBody.d.ts +120 -96
- package/mobile/lib/api/getSubmitBody.js +1 -6
- package/mobile/lib/api/getSubmitBody.js.map +1 -1
- package/mobile/lib/components/ApplicationForm/getFormatData.js +11 -1
- package/mobile/lib/components/ApplicationForm/getFormatData.js.map +1 -1
- package/mobile/lib/components/ApplicationForm/getInitialFormState.d.ts +3 -0
- package/mobile/lib/components/ApplicationForm/getInitialFormState.js.map +1 -1
- package/mobile/lib/hooks/useDadataParty.d.ts +6 -0
- package/mobile/lib/hooks/{useInn.js → useDadataParty.js} +2 -2
- package/mobile/lib/hooks/useDadataParty.js.map +1 -0
- package/mobile/lib/ui-kit/FormField/Fields/DadataPartySelectField.d.ts +6 -0
- package/mobile/lib/ui-kit/FormField/Fields/DadataPartySelectField.js +82 -0
- package/mobile/lib/ui-kit/FormField/Fields/DadataPartySelectField.js.map +1 -0
- package/mobile/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
- package/mobile/lib/ui-kit/FormField/getField.js +3 -4
- package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js +3 -3
- package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
- package/mobile/lib/ui-kit/Select/Option.d.ts +3 -6
- package/mobile/lib/ui-kit/Select/Select.d.ts +2 -1
- package/mobile/lib/ui-kit/Select/Select.js +4 -4
- package/mobile/lib/ui-kit/Select/Select.js.map +1 -1
- package/mobile/lib/ui-kit/Select/SelectPopup.d.ts +6 -2
- package/mobile/lib/ui-kit/Select/SelectPopup.js +5 -3
- package/mobile/lib/ui-kit/Select/SelectPopup.js.map +1 -1
- package/mobile/lib/ui-kit/Select/useSelectPopup.d.ts +2 -1
- package/mobile/lib/ui-kit/Select/useSelectPopup.js +6 -3
- package/mobile/lib/ui-kit/Select/useSelectPopup.js.map +1 -1
- package/mobile/src/api/LeadServiceAPI.ts +0 -1
- package/mobile/src/api/getSubmitBody.ts +0 -11
- package/mobile/src/components/ApplicationForm/ApplicationForm.example.json +22 -43
- package/mobile/src/components/ApplicationForm/getFormatData.tsx +16 -0
- package/mobile/src/components/ApplicationForm/getInitialFormState.tsx +3 -0
- package/mobile/src/hooks/{useInn.ts → useDadataParty.ts} +2 -2
- package/mobile/src/ui-kit/FormField/Fields/DadataPartySelectField.tsx +150 -0
- package/mobile/src/ui-kit/FormField/NameFieldDef.ts +3 -3
- package/mobile/src/ui-kit/FormField/getField.tsx +3 -4
- package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +3 -3
- package/mobile/src/ui-kit/Select/Option.ts +4 -6
- package/mobile/src/ui-kit/Select/Select.tsx +6 -4
- package/mobile/src/ui-kit/Select/SelectPopup.tsx +15 -21
- package/mobile/src/ui-kit/Select/useSelectPopup.tsx +9 -1
- package/package.json +1 -1
- package/src/api/LeadServiceAPI.ts +0 -1
- package/src/api/getSubmitBody.ts +0 -11
- package/src/components/ApplicationForm/ApplicationForm.example.json +22 -43
- package/src/components/ApplicationForm/ApplicationForm.fixture.mobile.tsx +36 -13
- package/src/components/ApplicationForm/ApplicationForm.fixture.tsx +13 -12
- package/src/components/ApplicationForm/getFormatData.tsx +16 -0
- package/src/components/ApplicationForm/getInitialFormState.tsx +3 -0
- package/src/hooks/{useInn.ts → useDadataParty.ts} +2 -2
- package/src/ui-kit/FormField/Fields/DadataPartySelectField.tsx +150 -0
- package/src/ui-kit/FormField/NameFieldDef.ts +3 -3
- package/src/ui-kit/FormField/getField.tsx +3 -4
- package/src/ui-kit/FormField/getObjectValidator.tsx +3 -3
- package/src/ui-kit/Select/Option.ts +4 -6
- package/src/ui-kit/Select/Select.tsx +6 -4
- package/src/ui-kit/Select/SelectPopup.tsx +15 -21
- package/src/ui-kit/Select/useSelectPopup.tsx +9 -1
- package/bundle/hooks/useInn.d.ts +0 -7
- package/bundle/ui-kit/FormField/Fields/CompanyNameByInnField.d.ts +0 -2
- package/bundle/ui-kit/FormField/Fields/InnDadataField.d.ts +0 -2
- package/dist/hooks/useInn.d.ts +0 -7
- package/dist/hooks/useInn.js.map +0 -1
- package/dist/ui-kit/FormField/Fields/CompanyNameByInnField.d.ts +0 -2
- package/dist/ui-kit/FormField/Fields/CompanyNameByInnField.js +0 -17
- package/dist/ui-kit/FormField/Fields/CompanyNameByInnField.js.map +0 -1
- package/dist/ui-kit/FormField/Fields/InnDadataField.d.ts +0 -2
- package/dist/ui-kit/FormField/Fields/InnDadataField.js +0 -32
- package/dist/ui-kit/FormField/Fields/InnDadataField.js.map +0 -1
- package/lib/hooks/useInn.d.ts +0 -7
- package/lib/hooks/useInn.js.map +0 -1
- package/lib/ui-kit/FormField/Fields/CompanyNameByInnField.d.ts +0 -2
- package/lib/ui-kit/FormField/Fields/CompanyNameByInnField.js +0 -15
- package/lib/ui-kit/FormField/Fields/CompanyNameByInnField.js.map +0 -1
- package/lib/ui-kit/FormField/Fields/InnDadataField.d.ts +0 -2
- package/lib/ui-kit/FormField/Fields/InnDadataField.js +0 -30
- package/lib/ui-kit/FormField/Fields/InnDadataField.js.map +0 -1
- package/mobile/bundle/hooks/useInn.d.ts +0 -7
- package/mobile/bundle/ui-kit/FormField/Fields/CompanyNameByInnField.d.ts +0 -2
- package/mobile/bundle/ui-kit/FormField/Fields/InnDadataField.d.ts +0 -2
- package/mobile/dist/hooks/useInn.d.ts +0 -7
- package/mobile/dist/hooks/useInn.js.map +0 -1
- package/mobile/dist/ui-kit/FormField/Fields/CompanyNameByInnField.d.ts +0 -2
- package/mobile/dist/ui-kit/FormField/Fields/CompanyNameByInnField.js +0 -17
- package/mobile/dist/ui-kit/FormField/Fields/CompanyNameByInnField.js.map +0 -1
- package/mobile/dist/ui-kit/FormField/Fields/InnDadataField.d.ts +0 -2
- package/mobile/dist/ui-kit/FormField/Fields/InnDadataField.js +0 -32
- package/mobile/dist/ui-kit/FormField/Fields/InnDadataField.js.map +0 -1
- package/mobile/lib/hooks/useInn.d.ts +0 -7
- package/mobile/lib/hooks/useInn.js.map +0 -1
- package/mobile/lib/ui-kit/FormField/Fields/CompanyNameByInnField.d.ts +0 -2
- package/mobile/lib/ui-kit/FormField/Fields/CompanyNameByInnField.js +0 -15
- package/mobile/lib/ui-kit/FormField/Fields/CompanyNameByInnField.js.map +0 -1
- package/mobile/lib/ui-kit/FormField/Fields/InnDadataField.d.ts +0 -2
- package/mobile/lib/ui-kit/FormField/Fields/InnDadataField.js +0 -30
- package/mobile/lib/ui-kit/FormField/Fields/InnDadataField.js.map +0 -1
- package/mobile/src/ui-kit/FormField/Fields/CompanyNameByInnField.tsx +0 -24
- package/mobile/src/ui-kit/FormField/Fields/InnDadataField.tsx +0 -52
- package/src/ui-kit/FormField/Fields/CompanyNameByInnField.tsx +0 -24
- package/src/ui-kit/FormField/Fields/InnDadataField.tsx +0 -52
|
@@ -1013,7 +1013,7 @@
|
|
|
1013
1013
|
const formatPhone = (phone) => phone?.replace(/[^+\d]/g, '');
|
|
1014
1014
|
|
|
1015
1015
|
const getSubmitBody = (body, isNaturalPerson, router) => {
|
|
1016
|
-
const { typeForm, region, phone = '', email, birthday, desiredMeetingDate, inn,
|
|
1016
|
+
const { typeForm, region, phone = '', email, birthday, desiredMeetingDate, inn, fullRegion, addressBranch, secondaryPhone = '', bankEmpolee, applicationDate, partnerName, ...staticBody } = body;
|
|
1017
1017
|
return {
|
|
1018
1018
|
typeForm,
|
|
1019
1019
|
...getRegion$1(region, isNaturalPerson),
|
|
@@ -1031,10 +1031,7 @@
|
|
|
1031
1031
|
}),
|
|
1032
1032
|
...addPageSlug(typeForm, router),
|
|
1033
1033
|
...formatPFForm(typeForm, {
|
|
1034
|
-
innDadata,
|
|
1035
1034
|
fullRegion,
|
|
1036
|
-
partnerSymbolCode,
|
|
1037
|
-
companyNameByInn,
|
|
1038
1035
|
partnerName,
|
|
1039
1036
|
}),
|
|
1040
1037
|
...staticBody,
|
|
@@ -1058,10 +1055,8 @@
|
|
|
1058
1055
|
: { secondaryPhoneNumber: formatPhone(secondaryPhone) };
|
|
1059
1056
|
const formatPFForm = (typeForm, data) => typeForm === 'PF'
|
|
1060
1057
|
? {
|
|
1061
|
-
inn: data?.innDadata,
|
|
1062
1058
|
region: data?.fullRegion,
|
|
1063
1059
|
partner: data?.partnerName,
|
|
1064
|
-
fullName: data?.companyNameByInn,
|
|
1065
1060
|
}
|
|
1066
1061
|
: {};
|
|
1067
1062
|
const addPageSlug = (typeForm, router) => typeForm === 'UNIVERSAL'
|
|
@@ -1456,17 +1451,20 @@
|
|
|
1456
1451
|
return options.filter((_) => _.text?.toLocaleLowerCase().includes(query?.trim().toLocaleLowerCase()));
|
|
1457
1452
|
};
|
|
1458
1453
|
|
|
1459
|
-
const SelectPopup = JSX(({ popupRef, options, value,
|
|
1454
|
+
const SelectPopup = JSX(({ popupRef, options, value, iconVersion, onChange, renderOptions = renderDefaultOptions,
|
|
1455
|
+
// TODO: вынести в хук отвечающий за фильтрацию
|
|
1456
|
+
query, onChangeQuery, disableFilterOptions, }) => options?.length ? (jsx("div", { className: "bg-white text-l max-h-64 overflow-y-auto overflow-x-hidden rounded-md shadow-2xl", role: "list", ref: popupRef, children: filterOptions(options, query, disableFilterOptions).map((option) => (jsxs("div", { className: "flex px-m py-s cursor-pointer hover:bg-main-divider pr-5xl relative", role: "listitem", "aria-selected": option.key === value?.key, onClick: (e) => {
|
|
1460
1457
|
e.stopPropagation();
|
|
1461
1458
|
if (onChange) {
|
|
1462
1459
|
onChangeQuery?.('');
|
|
1463
1460
|
onChange(option);
|
|
1464
1461
|
}
|
|
1465
|
-
}, children: [
|
|
1462
|
+
}, children: [renderOptions(option), jsx(Icon, { name: "DoneSimpleIcon", width: "16", height: "16", iconVersion: iconVersion, className: style('absolute right-2 pt-2xs', {
|
|
1466
1463
|
hidden: option.key !== value?.key,
|
|
1467
1464
|
}) })] }, option.key))) })) : null);
|
|
1465
|
+
const renderDefaultOptions = (option) => (jsx("span", { className: "min-h-6", children: formatOption(option) }));
|
|
1468
1466
|
|
|
1469
|
-
function useSelectPopup({ isOpen, options, value, query, onChange = noop, onClose = noop, iconVersion, disableFilterOptions = false, onChangeQuery = noop, }) {
|
|
1467
|
+
function useSelectPopup({ isOpen, options, value, query, onChange = noop, onClose = noop, iconVersion, disableFilterOptions = false, onChangeQuery = noop, renderOptions, isSearch = false, }) {
|
|
1470
1468
|
const popup = usePopupManager();
|
|
1471
1469
|
const close = useCallback(() => {
|
|
1472
1470
|
popup.close();
|
|
@@ -1475,8 +1473,11 @@
|
|
|
1475
1473
|
const handleChange = useCallback((option) => {
|
|
1476
1474
|
close();
|
|
1477
1475
|
onChange(option);
|
|
1478
|
-
onChangeQuery('');
|
|
1476
|
+
onChangeQuery(isSearch && option?.text ? option.text : '');
|
|
1479
1477
|
}, [close, onChange]);
|
|
1478
|
+
useEffect(() => {
|
|
1479
|
+
onChangeQuery(isSearch && value?.text ? value.text : '');
|
|
1480
|
+
}, [value]);
|
|
1480
1481
|
const inputRef = useRef(null);
|
|
1481
1482
|
const popupRef = useOutsideClick(close);
|
|
1482
1483
|
useEffect(() => {
|
|
@@ -1486,7 +1487,7 @@
|
|
|
1486
1487
|
const inputElement = inputRef.current;
|
|
1487
1488
|
const { top, left, width, height } = inputElement.getBoundingClientRect();
|
|
1488
1489
|
popup.open({
|
|
1489
|
-
popup: (jsx(SelectPopup, { popupRef: popupRef, options: options, value: value, query: query, iconVersion: iconVersion, disableFilterOptions: disableFilterOptions, onChange: handleChange, onChangeQuery: onChangeQuery })),
|
|
1490
|
+
popup: (jsx(SelectPopup, { popupRef: popupRef, options: options, value: value, query: query, iconVersion: iconVersion, disableFilterOptions: disableFilterOptions, onChange: handleChange, onChangeQuery: onChangeQuery, renderOptions: renderOptions })),
|
|
1490
1491
|
top: top + window.scrollY + height,
|
|
1491
1492
|
left,
|
|
1492
1493
|
width,
|
|
@@ -1495,7 +1496,7 @@
|
|
|
1495
1496
|
return inputRef;
|
|
1496
1497
|
}
|
|
1497
1498
|
|
|
1498
|
-
const Select = JSX(({ className, label, options = [], value, isSearch = false, isManualInput = false, disabled = false, iconVersion = 'black', onChange, onSearchQuery = noop, inputProps, disableFilterOptions = false, ...rest }) => {
|
|
1499
|
+
const Select = JSX(({ className, label, options = [], value, isSearch = false, isManualInput = false, disabled = false, iconVersion = 'black', onChange, onSearchQuery = noop, inputProps, disableFilterOptions = false, renderOptions, ...rest }) => {
|
|
1499
1500
|
const [isOpen, { setFalse: close, setTrue: open }] = useBool();
|
|
1500
1501
|
const [query, setQuery] = useState('');
|
|
1501
1502
|
const isDisabled = disabled || (!isManualInput && options.length === 0);
|
|
@@ -1504,15 +1505,15 @@
|
|
|
1504
1505
|
isDisabled ? noop() : open();
|
|
1505
1506
|
}, [isDisabled]);
|
|
1506
1507
|
const handleClose = useCallback(() => {
|
|
1507
|
-
!
|
|
1508
|
+
!isSearch && setQuery('');
|
|
1508
1509
|
close();
|
|
1509
1510
|
}, [isManualInput]);
|
|
1510
1511
|
const handleChangeQuery = useCallback((newQuery) => {
|
|
1511
1512
|
setQuery(newQuery);
|
|
1512
|
-
isManualInput && onChange?.({ key: newQuery, text: newQuery
|
|
1513
|
+
isManualInput && onChange?.({ key: newQuery, text: newQuery });
|
|
1513
1514
|
debouncedOnSearchQuery?.(newQuery);
|
|
1514
1515
|
}, [isManualInput, onChange, debouncedOnSearchQuery]);
|
|
1515
|
-
const selectState = { query, value, options, isOpen, iconVersion };
|
|
1516
|
+
const selectState = { query, value, options, isOpen, iconVersion, renderOptions, isSearch };
|
|
1516
1517
|
const inputRef = useSelectPopup({
|
|
1517
1518
|
onChange,
|
|
1518
1519
|
onClose: handleClose,
|
|
@@ -2049,47 +2050,6 @@
|
|
|
2049
2050
|
|
|
2050
2051
|
const CommentField = JSX(({ field, input }) => (jsx(InputControl, { className: "col-span-2", ...field(input?.name ?? ''), placeholder: "\u0412\u0430\u0448\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435", isTextarea: true })));
|
|
2051
2052
|
|
|
2052
|
-
const CompanyNameByInnField = JSX(({ field, input }) => {
|
|
2053
|
-
const fieldInn = field('innDadata');
|
|
2054
|
-
useEffect(() => {
|
|
2055
|
-
if (fieldInn?.value?.key !== '') {
|
|
2056
|
-
const companyName = fieldInn?.value?.innDaData?.companyName;
|
|
2057
|
-
companyName && field?.('companyNameByInn')?.onChange?.(companyName);
|
|
2058
|
-
}
|
|
2059
|
-
}, [fieldInn?.value]);
|
|
2060
|
-
return (jsx(InputControl, { maxLength: 60, label: "\u041F\u043E\u043B\u043D\u043E\u0435 \u043D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435", ...field(input?.name ?? ''), ...input }));
|
|
2061
|
-
});
|
|
2062
|
-
|
|
2063
|
-
const DesiredMeetingDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0416\u0435\u043B\u0430\u0435\u043C\u0430\u044F \u0434\u0430\u0442\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0438", ...field(input?.name ?? '') })));
|
|
2064
|
-
|
|
2065
|
-
const EmailField$1 = JSX(({ field, input }) => {
|
|
2066
|
-
return jsx(InputControl, { label: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430", ...field(input?.name ?? ''), ...input });
|
|
2067
|
-
});
|
|
2068
|
-
|
|
2069
|
-
const SERVICE_TYPES = [{ key: 'ULTRASERVICE', text: 'Ультра' }];
|
|
2070
|
-
const SERVICE_DIRECTIONS = [
|
|
2071
|
-
{ key: 'Физическое лицо' },
|
|
2072
|
-
{ key: 'Юридическое лицо / ИП' },
|
|
2073
|
-
];
|
|
2074
|
-
const FEEDBACK_METHOD = [
|
|
2075
|
-
{ key: 'phone', text: 'Телефонный звонок' },
|
|
2076
|
-
{ key: 'email', text: 'Электронное сообщение' },
|
|
2077
|
-
];
|
|
2078
|
-
|
|
2079
|
-
const FeedbackMethodField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u043E\u0442\u0432\u0435\u0442\u0430", options: FEEDBACK_METHOD, ...field(input?.name ?? '') })));
|
|
2080
|
-
|
|
2081
|
-
const FullNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0418\u041E", ...field(input?.name ?? ''), ...input })));
|
|
2082
|
-
|
|
2083
|
-
const FullRegionField = JSX(({ field, input, params }) => {
|
|
2084
|
-
const isPremium = params?.isPremium;
|
|
2085
|
-
const branchByRegions = useBranchesByRegions(isPremium);
|
|
2086
|
-
const regions = useMemo(() => branchByRegions?.map(({ region }) => ({
|
|
2087
|
-
key: region,
|
|
2088
|
-
text: region,
|
|
2089
|
-
})), [branchByRegions]);
|
|
2090
|
-
return (jsx(SelectControl, { label: "\u0420\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D", options: regions, ...field(input?.name ?? '') }));
|
|
2091
|
-
});
|
|
2092
|
-
|
|
2093
2053
|
function useAsyncEffect(effect, deps) {
|
|
2094
2054
|
useEffect(() => {
|
|
2095
2055
|
const free = effect();
|
|
@@ -2140,34 +2100,115 @@
|
|
|
2140
2100
|
};
|
|
2141
2101
|
|
|
2142
2102
|
const INN_DADATA_URL = 'suggest/party';
|
|
2143
|
-
const
|
|
2103
|
+
const useDadataParty = async (searchQuery) => (await getDaDataHints({ url: INN_DADATA_URL, query: searchQuery })).map((_) => ({
|
|
2144
2104
|
fullName: _?.value,
|
|
2145
2105
|
address: _?.data?.address?.value,
|
|
2146
2106
|
inn: _?.data?.inn,
|
|
2147
2107
|
}));
|
|
2148
2108
|
|
|
2149
|
-
const
|
|
2150
|
-
|
|
2109
|
+
const FIELD_MAPPING = {
|
|
2110
|
+
dadataPartyInnSelect: {
|
|
2111
|
+
fieldValue: 'inn',
|
|
2112
|
+
linkedFieldName: 'dadataPartyNameSelect',
|
|
2113
|
+
linkedFieldValue: 'fullName',
|
|
2114
|
+
},
|
|
2115
|
+
dadataPartyNameSelect: {
|
|
2116
|
+
fieldValue: 'fullName',
|
|
2117
|
+
linkedFieldName: 'dadataPartyInnSelect',
|
|
2118
|
+
linkedFieldValue: 'inn',
|
|
2119
|
+
},
|
|
2120
|
+
};
|
|
2121
|
+
const FIELD_CONFIG = {
|
|
2122
|
+
dadataPartyInnSelect: {
|
|
2123
|
+
label: 'ИНН',
|
|
2124
|
+
placeholder: 'Введите ИНН',
|
|
2125
|
+
inputProps: {
|
|
2126
|
+
isInteger: true,
|
|
2127
|
+
maxLength: 12,
|
|
2128
|
+
},
|
|
2129
|
+
},
|
|
2130
|
+
dadataPartyNameSelect: {
|
|
2131
|
+
label: 'Полное наименование',
|
|
2132
|
+
placeholder: 'Введите полное наименование',
|
|
2133
|
+
},
|
|
2134
|
+
};
|
|
2135
|
+
const DadataPartySelectField = JSX(({ field, input = {} }) => {
|
|
2136
|
+
const fieldName = input.name ?? '';
|
|
2137
|
+
const linkedField = FIELD_MAPPING[fieldName].linkedFieldName;
|
|
2138
|
+
const linkedFieldValue = field(linkedField).value;
|
|
2139
|
+
const linkedFieldValueData = linkedFieldValue?.data;
|
|
2140
|
+
useAsyncEffect(async () => {
|
|
2141
|
+
if (linkedFieldValueData?.fullName &&
|
|
2142
|
+
linkedFieldValueData?.fullName !== field(fieldName)?.value?.data?.fullName) {
|
|
2143
|
+
const fieldValues = getFieldValues(linkedFieldValue);
|
|
2144
|
+
const { fullName, address, inn } = fieldValues;
|
|
2145
|
+
const optionTextValue = getLinkedFieldValue(fieldValues, linkedField);
|
|
2146
|
+
const dadataFields = useDadataParty(optionTextValue);
|
|
2147
|
+
setSearchQuery(optionTextValue);
|
|
2148
|
+
setOptions(await dadataFields);
|
|
2149
|
+
field(fieldName)?.onChange?.({
|
|
2150
|
+
key: inn,
|
|
2151
|
+
text: optionTextValue,
|
|
2152
|
+
data: {
|
|
2153
|
+
fullName,
|
|
2154
|
+
address,
|
|
2155
|
+
},
|
|
2156
|
+
});
|
|
2157
|
+
}
|
|
2158
|
+
}, [linkedFieldValueData]);
|
|
2159
|
+
const [options, setOptions] = useState([]); // InnSuggestion
|
|
2151
2160
|
const [searchQuery, setSearchQuery] = useState('');
|
|
2152
2161
|
useAsyncEffect(async () => {
|
|
2153
|
-
const
|
|
2154
|
-
setOptions(await
|
|
2162
|
+
const dadataFields = useDadataParty(searchQuery);
|
|
2163
|
+
setOptions(await dadataFields);
|
|
2155
2164
|
return options;
|
|
2156
2165
|
}, [searchQuery]);
|
|
2157
|
-
const getOptions = useMemo(() => {
|
|
2158
|
-
|
|
2159
|
-
|
|
2160
|
-
|
|
2161
|
-
|
|
2162
|
-
|
|
2163
|
-
|
|
2164
|
-
|
|
2165
|
-
|
|
2166
|
-
|
|
2167
|
-
|
|
2168
|
-
|
|
2169
|
-
|
|
2170
|
-
|
|
2166
|
+
const getOptions = useMemo(() => (options || []).map((item = {}) => ({
|
|
2167
|
+
key: item.inn ?? '',
|
|
2168
|
+
text: item[FIELD_MAPPING[fieldName].fieldValue],
|
|
2169
|
+
data: {
|
|
2170
|
+
fullName: item.fullName,
|
|
2171
|
+
address: item.address,
|
|
2172
|
+
},
|
|
2173
|
+
})), [options]);
|
|
2174
|
+
return (jsx(SelectControl, { ...FIELD_CONFIG[fieldName], options: getOptions, ...field(input.name ?? ''), isSearch: true, isManualInput: true, disableFilterOptions: true, onSearchQuery: setSearchQuery, renderOptions: renderOptions }));
|
|
2175
|
+
});
|
|
2176
|
+
const getFieldValues = (value) => ({
|
|
2177
|
+
inn: value?.key,
|
|
2178
|
+
fullName: value?.data?.fullName,
|
|
2179
|
+
address: value?.data?.address,
|
|
2180
|
+
});
|
|
2181
|
+
const renderOptions = (option) => (jsxs("span", { children: [jsx(Text, { size: "text-s", children: option?.data?.fullName }), jsxs("div", { className: "space-x-2", children: [jsx(Text, { size: "text-s", font: "font-light", children: option?.key }), jsx(Text, { size: "text-s", font: "font-light", children: option?.data?.address })] })] }));
|
|
2182
|
+
const getLinkedFieldValue = (fieldValues, linkedField) => fieldValues?.[FIELD_MAPPING[linkedField].linkedFieldValue];
|
|
2183
|
+
|
|
2184
|
+
const DesiredMeetingDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0416\u0435\u043B\u0430\u0435\u043C\u0430\u044F \u0434\u0430\u0442\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0438", ...field(input?.name ?? '') })));
|
|
2185
|
+
|
|
2186
|
+
const EmailField$1 = JSX(({ field, input }) => {
|
|
2187
|
+
return jsx(InputControl, { label: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430", ...field(input?.name ?? ''), ...input });
|
|
2188
|
+
});
|
|
2189
|
+
|
|
2190
|
+
const SERVICE_TYPES = [{ key: 'ULTRASERVICE', text: 'Ультра' }];
|
|
2191
|
+
const SERVICE_DIRECTIONS = [
|
|
2192
|
+
{ key: 'Физическое лицо' },
|
|
2193
|
+
{ key: 'Юридическое лицо / ИП' },
|
|
2194
|
+
];
|
|
2195
|
+
const FEEDBACK_METHOD = [
|
|
2196
|
+
{ key: 'phone', text: 'Телефонный звонок' },
|
|
2197
|
+
{ key: 'email', text: 'Электронное сообщение' },
|
|
2198
|
+
];
|
|
2199
|
+
|
|
2200
|
+
const FeedbackMethodField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u043E\u0442\u0432\u0435\u0442\u0430", options: FEEDBACK_METHOD, ...field(input?.name ?? '') })));
|
|
2201
|
+
|
|
2202
|
+
const FullNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0418\u041E", ...field(input?.name ?? ''), ...input })));
|
|
2203
|
+
|
|
2204
|
+
const FullRegionField = JSX(({ field, input, params }) => {
|
|
2205
|
+
const isPremium = params?.isPremium;
|
|
2206
|
+
const branchByRegions = useBranchesByRegions(isPremium);
|
|
2207
|
+
const regions = useMemo(() => branchByRegions?.map(({ region }) => ({
|
|
2208
|
+
key: region,
|
|
2209
|
+
text: region,
|
|
2210
|
+
})), [branchByRegions]);
|
|
2211
|
+
return (jsx(SelectControl, { label: "\u0420\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D", options: regions, ...field(input?.name ?? '') }));
|
|
2171
2212
|
});
|
|
2172
2213
|
|
|
2173
2214
|
const InnField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0418\u041D\u041D", isInteger: true, maxLength: 12, ...input, ...field(input?.name ?? '') })));
|
|
@@ -2383,9 +2424,9 @@
|
|
|
2383
2424
|
typeForm: defaultValidator(),
|
|
2384
2425
|
consentToReceiveMaterials: agreementValidator,
|
|
2385
2426
|
consentDataProcessing: agreementValidator,
|
|
2386
|
-
partnerSymbolCode: defaultValidator(),
|
|
2387
|
-
|
|
2388
|
-
|
|
2427
|
+
partnerSymbolCode: defaultValidator('Укажите идентификатор партнёра'),
|
|
2428
|
+
dadataPartyInnSelect: innDadataValidator('Укажите ИНН'),
|
|
2429
|
+
dadataPartyNameSelect: defaultValidator('Укажите наименование организации'),
|
|
2389
2430
|
};
|
|
2390
2431
|
const getFormValidator = (fieldDefs, externalValidatorObj = {}) => {
|
|
2391
2432
|
const requiredFields = fieldDefs.filter((_) => Boolean(_?.required && _?.name));
|
|
@@ -2532,9 +2573,9 @@
|
|
|
2532
2573
|
comment: CommentField,
|
|
2533
2574
|
fullRegion: FullRegionField,
|
|
2534
2575
|
partnerSymbolCode: (props) => (jsx(PartnerSymbolCodeField, { ...props, source: AGENTS_REF })),
|
|
2535
|
-
innDadata: InnDadataField,
|
|
2536
|
-
companyNameByInn: CompanyNameByInnField,
|
|
2537
2576
|
partnerName: (props) => jsx(PartnerNameField, { ...props, source: AGENTS_REF }),
|
|
2577
|
+
dadataPartyNameSelect: DadataPartySelectField,
|
|
2578
|
+
dadataPartyInnSelect: DadataPartySelectField,
|
|
2538
2579
|
};
|
|
2539
2580
|
const getField = (field, params, externalInputs = {}) => (input, i) => {
|
|
2540
2581
|
const fieldsRegister = {
|
|
@@ -2606,7 +2647,7 @@
|
|
|
2606
2647
|
|
|
2607
2648
|
/* eslint-disable @typescript-eslint/no-unused-vars */
|
|
2608
2649
|
const getFormatData = (data) => {
|
|
2609
|
-
const { acquiringType, onlineCheckout, posTerminal, amount, term, annualRevenue, serviceType, vedTypes, region, inn, sufferedFrom, situationDescription, applierType, isPremium, ...usedData } = data;
|
|
2650
|
+
const { acquiringType, onlineCheckout, posTerminal, amount, term, annualRevenue, serviceType, vedTypes, region, inn, sufferedFrom, situationDescription, applierType, isPremium, dadataPartyNameSelect, partnerSymbolCode, dadataPartyInnSelect, ...usedData } = data;
|
|
2610
2651
|
const partnerComments = acquiringType || annualRevenue ? getPartnerComments(data) : null;
|
|
2611
2652
|
const formatData = {
|
|
2612
2653
|
...usedData,
|
|
@@ -2617,6 +2658,10 @@
|
|
|
2617
2658
|
...(serviceType ? { typeForm: serviceType } : {}),
|
|
2618
2659
|
...getIncidentComment(sufferedFrom?.text, situationDescription),
|
|
2619
2660
|
...getIsClient(applierType),
|
|
2661
|
+
...getDadataValues([
|
|
2662
|
+
[dadataPartyInnSelect, 'inn'],
|
|
2663
|
+
[dadataPartyNameSelect, 'fullName'],
|
|
2664
|
+
]),
|
|
2620
2665
|
};
|
|
2621
2666
|
return Object.fromEntries(Object.entries(formatData)?.map(([k, v]) => [k, v?.key || v]));
|
|
2622
2667
|
};
|
|
@@ -2630,6 +2675,12 @@
|
|
|
2630
2675
|
vedTypes: Object.fromEntries(VED_TYPES.map(({ id }) => [id, id === vedTypes])),
|
|
2631
2676
|
}
|
|
2632
2677
|
: {};
|
|
2678
|
+
const getDadataValues = (fields) => fields.reduce((acc, [field, name]) => {
|
|
2679
|
+
if (field?.text && name) {
|
|
2680
|
+
acc[name] = field.text;
|
|
2681
|
+
}
|
|
2682
|
+
return acc;
|
|
2683
|
+
}, {});
|
|
2633
2684
|
|
|
2634
2685
|
const initialFormState$1 = {
|
|
2635
2686
|
typeForm: '',
|
|
@@ -11784,7 +11835,7 @@
|
|
|
11784
11835
|
slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
|
|
11785
11836
|
});
|
|
11786
11837
|
|
|
11787
|
-
const packageVersion = "0.14.
|
|
11838
|
+
const packageVersion = "0.14.914";
|
|
11788
11839
|
|
|
11789
11840
|
exports.Blocks = Blocks;
|
|
11790
11841
|
exports.ContentPage = ContentPage;
|