@redneckz/wildless-cms-uni-blocks 0.14.43 → 0.14.44

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.
Files changed (58) hide show
  1. package/bundle/bundle.umd.js +3 -3
  2. package/bundle/bundle.umd.min.js +1 -1
  3. package/dist/components/ApplicationForm/renderWedTextarea.js +1 -1
  4. package/dist/components/ApplicationForm/renderWedTextarea.js.map +1 -1
  5. package/dist/components/Blocks.mobile.js +3 -1
  6. package/dist/components/Blocks.mobile.js.map +1 -1
  7. package/dist/components/OfficesAtmsMap/renderOfficeCard.js +1 -1
  8. package/dist/components/OfficesAtmsMap/renderOfficeCard.js.map +1 -1
  9. package/dist/components/ProductGallery/ProductGallery.mobile.js +1 -1
  10. package/dist/components/ProductGallery/ProductGallery.mobile.js.map +1 -1
  11. package/lib/components/ApplicationForm/renderWedTextarea.js +1 -1
  12. package/lib/components/ApplicationForm/renderWedTextarea.js.map +1 -1
  13. package/lib/components/Blocks.mobile.js +3 -1
  14. package/lib/components/Blocks.mobile.js.map +1 -1
  15. package/lib/components/OfficesAtmsMap/OfficesAtmsMap.fixture.d.ts +1 -0
  16. package/lib/components/OfficesAtmsMap/OfficesAtmsMap.fixture.mobile.d.ts +7 -0
  17. package/lib/components/OfficesAtmsMap/getScheduleDescription.d.ts +0 -1
  18. package/lib/components/OfficesAtmsMap/renderAtmCard.d.ts +0 -1
  19. package/lib/components/OfficesAtmsMap/renderBusinessSchedule.d.ts +0 -1
  20. package/lib/components/OfficesAtmsMap/renderFiltrationForm.d.ts +0 -1
  21. package/lib/components/OfficesAtmsMap/renderOfficeCard.d.ts +0 -1
  22. package/lib/components/OfficesAtmsMap/renderOfficeCard.js +1 -1
  23. package/lib/components/OfficesAtmsMap/renderOfficeCard.js.map +1 -1
  24. package/lib/components/ProductGallery/ProductGallery.mobile.js +1 -1
  25. package/lib/components/ProductGallery/ProductGallery.mobile.js.map +1 -1
  26. package/mobile/bundle/bundle.umd.js +359 -106
  27. package/mobile/bundle/bundle.umd.min.js +1 -1
  28. package/mobile/dist/components/ApplicationForm/renderWedTextarea.js +1 -1
  29. package/mobile/dist/components/ApplicationForm/renderWedTextarea.js.map +1 -1
  30. package/mobile/dist/components/Blocks.js +3 -1
  31. package/mobile/dist/components/Blocks.js.map +1 -1
  32. package/mobile/dist/components/OfficesAtmsMap/renderOfficeCard.js +1 -1
  33. package/mobile/dist/components/OfficesAtmsMap/renderOfficeCard.js.map +1 -1
  34. package/mobile/dist/components/ProductGallery/ProductGallery.js +1 -1
  35. package/mobile/dist/components/ProductGallery/ProductGallery.js.map +1 -1
  36. package/mobile/lib/components/ApplicationForm/renderWedTextarea.js +1 -1
  37. package/mobile/lib/components/ApplicationForm/renderWedTextarea.js.map +1 -1
  38. package/mobile/lib/components/Blocks.js +3 -1
  39. package/mobile/lib/components/Blocks.js.map +1 -1
  40. package/mobile/lib/components/OfficesAtmsMap/renderOfficeCard.js +1 -1
  41. package/mobile/lib/components/OfficesAtmsMap/renderOfficeCard.js.map +1 -1
  42. package/mobile/lib/components/ProductGallery/ProductGallery.js +1 -1
  43. package/mobile/lib/components/ProductGallery/ProductGallery.js.map +1 -1
  44. package/mobile/src/components/ApplicationForm/renderWedTextarea.tsx +2 -1
  45. package/mobile/src/components/BenefitsBlock/BenefitsBlock.example.json +1 -1
  46. package/mobile/src/components/Blocks.ts +3 -1
  47. package/mobile/src/components/OfficesAtmsMap/renderOfficeCard.tsx +3 -1
  48. package/mobile/src/components/ProductBlock/ProductBlock.example.json +1 -1
  49. package/mobile/src/components/ProductGallery/ProductGallery.tsx +1 -1
  50. package/package.json +1 -1
  51. package/src/components/ApplicationForm/renderWedTextarea.tsx +2 -1
  52. package/src/components/BenefitsBlock/BenefitsBlock.example.json +1 -1
  53. package/src/components/Blocks.mobile.ts +3 -1
  54. package/src/components/OfficesAtmsMap/OfficesAtmsMap.fixture.mobile.tsx +43 -0
  55. package/src/components/OfficesAtmsMap/OfficesAtmsMap.fixture.tsx +2 -0
  56. package/src/components/OfficesAtmsMap/renderOfficeCard.tsx +3 -1
  57. package/src/components/ProductBlock/ProductBlock.example.json +1 -1
  58. package/src/components/ProductGallery/ProductGallery.mobile.tsx +1 -1
@@ -525,10 +525,10 @@
525
525
  }
526
526
 
527
527
  const REGIONS_URL$1 = '/api/v1/regions';
528
- const EMPTY_VALUE$3 = [];
528
+ const EMPTY_VALUE$5 = [];
529
529
  function useGetRegions() {
530
530
  const { data } = useAsyncData(REGIONS_URL$1, fetchJSONUnsafe);
531
- return data || EMPTY_VALUE$3;
531
+ return data || EMPTY_VALUE$5;
532
532
  }
533
533
 
534
534
  const useDialogManager = () => ({
@@ -1013,14 +1013,14 @@
1013
1013
  });
1014
1014
 
1015
1015
  const BRANCHES_URL = '/api/v1/branches';
1016
- const EMPTY_VALUE$2 = [];
1016
+ const EMPTY_VALUE$4 = [];
1017
1017
  function useBranches(regionCode) {
1018
1018
  const { data } = useAsyncData(regionCode ? `${BRANCHES_URL}?regionCode=${regionCode}` : null, fetchSafeBoxes$1);
1019
- return data || EMPTY_VALUE$2;
1019
+ return data || EMPTY_VALUE$4;
1020
1020
  }
1021
1021
  const fetchSafeBoxes$1 = async (url) => {
1022
1022
  const result = await fetchJSON(url, { method: 'GET' });
1023
- return result || EMPTY_VALUE$2;
1023
+ return result || EMPTY_VALUE$4;
1024
1024
  };
1025
1025
 
1026
1026
  const MIN_CREDIT_AMOUNT = 1000;
@@ -1165,15 +1165,15 @@
1165
1165
  return (jsxs("form", { className: "container", onSubmit: formProps.onSubmit, children: [jsx(Heading, { headingType: "h6", title: "\u041E\u0441\u0442\u0430\u0432\u044C\u0442\u0435 \u0437\u0430\u044F\u0432\u043A\u0443 \u0438 \u043C\u044B \u043E\u0442\u0432\u0435\u0442\u0438\u043C \u043D\u0430 \u043B\u044E\u0431\u044B\u0435 \u0432\u043E\u043F\u0440\u043E\u0441\u044B \u043F\u043E \u0434\u0435\u043F\u043E\u0437\u0438\u0442\u0430\u043C", className: "@xl:text-center mb-m" }), jsxs("div", { className: "max-w-[560px] m-auto space-y-s", children: [jsx(InputControl, { className: "shrink-0 w-full", label: "\u0418\u043C\u044F", ...withValidator(field('name'), nameValidator) }), jsx(PhoneInputControl, { className: "shrink-0 w-full", label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D", ...withValidator(field('phone'), phoneValidator) })] }), jsxs("div", { className: "flex justify-between flex-col-reverse @xl:items-center @xl:flex-row max-w-[560px] m-auto", children: [jsx("div", { className: "flex-1", children: jsx(Footnote, { link: link }) }), renderSubmitButton(button)] })] }));
1166
1166
  });
1167
1167
 
1168
- const EMPTY_VALUE$1 = {};
1168
+ const EMPTY_VALUE$3 = {};
1169
1169
  const DEFAULT_FOLDER_NAME = 'wcms-resources';
1170
1170
  function useSWRResource(filename, options = {}) {
1171
- const { fallback = EMPTY_VALUE$1, folderName = DEFAULT_FOLDER_NAME, setBasePath = false } = options;
1171
+ const { fallback = EMPTY_VALUE$3, folderName = DEFAULT_FOLDER_NAME, setBasePath = false } = options;
1172
1172
  const path = joinPath('/', setBasePath ? projectSettings.BASE_PATH : '', folderName, `${filename}.json`);
1173
1173
  const { data } = useAsyncData(filename ? path : null, fetchJSONUnsafe, {
1174
1174
  fallback,
1175
1175
  });
1176
- return data || EMPTY_VALUE$1;
1176
+ return data || EMPTY_VALUE$3;
1177
1177
  }
1178
1178
 
1179
1179
  const ApplicationFormGrantSupport = JSX((props) => {
@@ -1451,7 +1451,7 @@
1451
1451
  const activeTextareaStyles = 'hover:border-primary-hover active:focus:border-primary-text focus:border-primary-text';
1452
1452
  const renderWedTextarea = (field) => {
1453
1453
  const textField = field('text');
1454
- return (jsxs("label", { children: [jsx("div", { className: "mb-xs", children: jsx(Text, { size: "text-m", font: "font-light", children: "\u041E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u0435" }) }), jsx("textarea", { placeholder: "\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0438\u043D\u0442\u0435\u0440\u0435\u0441\u0443\u044E\u0449\u0438\u0439 \u0432\u0430\u0441 \u0432\u043E\u043F\u0440\u043E\u0441, \u043C\u0435\u0441\u0442\u043E \u0432\u0435\u0434\u0435\u043D\u0438\u044F \u0431\u0438\u0437\u043D\u0435\u0441\u0430 \u0438 \u0443\u0434\u043E\u0431\u043D\u043E\u0435 \u0432\u0440\u0435\u043C\u044F \u0434\u043B\u044F \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u043D\u043E\u0433\u043E \u0437\u0432\u043E\u043D\u043A\u0430", className: style('block w-full resize-y min-h-24 p-m outline-none border rounded-md border-gray', activeTextareaStyles), value: textField.value, onInput: ((e) => textField.onChange && textField.onChange(e.target?.value || '')) })] }));
1454
+ return (jsxs("label", { htmlFor: "textarea", children: [jsx("div", { className: "mb-xs", children: jsx(Text, { size: "text-m", font: "font-light", children: "\u041E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u0435" }) }), jsx("textarea", { id: "textarea", placeholder: "\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0438\u043D\u0442\u0435\u0440\u0435\u0441\u0443\u044E\u0449\u0438\u0439 \u0432\u0430\u0441 \u0432\u043E\u043F\u0440\u043E\u0441, \u043C\u0435\u0441\u0442\u043E \u0432\u0435\u0434\u0435\u043D\u0438\u044F \u0431\u0438\u0437\u043D\u0435\u0441\u0430 \u0438 \u0443\u0434\u043E\u0431\u043D\u043E\u0435 \u0432\u0440\u0435\u043C\u044F \u0434\u043B\u044F \u0442\u0435\u043B\u0435\u0444\u043E\u043D\u043D\u043E\u0433\u043E \u0437\u0432\u043E\u043D\u043A\u0430", className: style('block w-full resize-y min-h-24 p-m outline-none border rounded-md border-gray', activeTextareaStyles), value: textField.value, onInput: ((e) => textField.onChange && textField.onChange(e.target?.value || '')) })] }));
1455
1455
  };
1456
1456
 
1457
1457
  const initialFormState = {
@@ -3171,7 +3171,7 @@
3171
3171
  return items.map((item) => (jsx(SlideCheckbox, { text: item.title, value: [value].flatMap((_) => _).includes(item.value), onChange: () => handleChange(item.value), type: multiple ? 'checkbox' : 'radio' }, item.value)));
3172
3172
  });
3173
3173
 
3174
- const renderFiltrationForm = ({ field, reset, filtrationSchema, resetButton, children, }) => (jsxs("form", { className: "flex flex-col @4xl:flex-row justify-between bg-white p-4xl gap-s @4xl:gap-0", children: [jsxs("div", { className: "flex flex-col @4xl:flex-row gap-5xl", children: [children, Object.entries(filtrationSchema).map(renderFormItem(field))] }), resetButton ? (jsx("div", { children: jsx(Button, { className: "w-full @4xl:w-72 @4xl:ml-s", onClick: reset, ...resetButton }) })) : null] }));
3174
+ const renderFiltrationForm$1 = ({ field, reset, filtrationSchema, resetButton, children, }) => (jsxs("form", { className: "flex flex-col @4xl:flex-row justify-between bg-white p-4xl gap-s @4xl:gap-0", children: [jsxs("div", { className: "flex flex-col @4xl:flex-row gap-5xl", children: [children, Object.entries(filtrationSchema).map(renderFormItem(field))] }), resetButton ? (jsx("div", { children: jsx(Button, { className: "w-full @4xl:w-72 @4xl:ml-s", onClick: reset, ...resetButton }) })) : null] }));
3175
3175
  const renderFormItem = (field) => ([key, item]) => {
3176
3176
  const type = item?.type;
3177
3177
  switch (type) {
@@ -3237,7 +3237,7 @@
3237
3237
  parse: (min) => ({ min: Number(min), max: DEFAULT_MAX_SUM }),
3238
3238
  format: ({ min }) => String(min),
3239
3239
  }) }), jsx(InputRange, { title: periodInput?.title, items: ['От 3 мес', 'До 5 лет'], list: months, ...field('period') })] }));
3240
- return (jsxs(BlockWrapper, { className: style('space-y-2xs', className), defaultPadding: "p-0", version: "transparent", ...rest, children: [renderFiltrationForm({ field, reset, filtrationSchema, resetButton, children: Inputs }), jsx(BaseFiltrationInner, { blocksToRender: blocksToRender, ...rest })] }));
3240
+ return (jsxs(BlockWrapper, { className: style('space-y-2xs', className), defaultPadding: "p-0", version: "transparent", ...rest, children: [renderFiltrationForm$1({ field, reset, filtrationSchema, resetButton, children: Inputs }), jsx(BaseFiltrationInner, { blocksToRender: blocksToRender, ...rest })] }));
3241
3241
  });
3242
3242
  const sourceBookSchema = {
3243
3243
  type: 'string',
@@ -3668,7 +3668,7 @@
3668
3668
  primary: 'text-white',
3669
3669
  secondary: 'text-secondary-text',
3670
3670
  };
3671
- const Badge = JSX(({ count, version = 'secondary' }) => {
3671
+ const Badge$1 = JSX(({ count, version = 'secondary' }) => {
3672
3672
  return (jsx("div", { className: style('w-6 h-6 rounded-full flex items-center justify-center', badgeBgStyleMap[version]), children: jsx(Text, { size: "text-xs", color: badgeTextColorStyleMap[version], children: count }) }));
3673
3673
  });
3674
3674
 
@@ -3693,7 +3693,7 @@
3693
3693
  const activeItemIndex = useMemo(() => Math.max(0, hotFilters.findIndex((_) => hotFilterRecordCmp(_.filter, filtrationState))), [hotFilters, filtrationState]);
3694
3694
  const items = useMemo(() => hotFilters.map((_) => ({
3695
3695
  text: _.text,
3696
- appendRight: (jsx(Badge, { version: _ === hotFilters[activeItemIndex] ? 'primary' : 'secondary', count: getBadgeCount(blocks, _.filter) })),
3696
+ appendRight: (jsx(Badge$1, { version: _ === hotFilters[activeItemIndex] ? 'primary' : 'secondary', count: getBadgeCount(blocks, _.filter) })),
3697
3697
  })), [hotFilters, blocks, activeItemIndex]);
3698
3698
  const handleChange = useCallback((_) => {
3699
3699
  onFiltrationStateChange(hotFilters[items.indexOf(_)].filter);
@@ -3769,63 +3769,57 @@
3769
3769
  blocks: rest.block?.blocks,
3770
3770
  onFiltrationStateChange: handleFiltrationStateChange,
3771
3771
  });
3772
- return (jsxs(BlockWrapper, { className: style('space-y-2xs', className), defaultPadding: "p-0", version: "transparent", ...rest, children: [jsx(TabsControl, { ...tabsControlProps }), renderFiltrationForm({ field, reset, filtrationSchema, resetButton }), jsx(BaseFiltrationInner, { blocksToRender: blocksToRender, ...rest })] }));
3772
+ return (jsxs(BlockWrapper, { className: style('space-y-2xs', className), defaultPadding: "p-0", version: "transparent", ...rest, children: [jsx(TabsControl, { ...tabsControlProps }), renderFiltrationForm$1({ field, reset, filtrationSchema, resetButton }), jsx(BaseFiltrationInner, { blocksToRender: blocksToRender, ...rest })] }));
3773
3773
  });
3774
3774
  MortgageFiltration.childrenTypes = ['ProductTile'];
3775
3775
  MortgageFiltration.childSchema = (content) => content?.filtrationSchema || {};
3776
3776
 
3777
- const GOLDEN_RATIO = 1.618;
3778
- const Placeholder = JSX(({ className, title, description = 'Блок в разработке...', ...rest }) => (jsxs(BlockWrapper, { className: style('box-border', className), ...rest, children: [jsx(Headline, { className: "max-w-[600px]", title: title, description: description, headlineVersion: "L", align: "text-left", isEmbedded: true }), jsx("figure", { className: "m-0 mt-xl min-w-[80%]", children: renderShimmer() })] })));
3779
- const renderShimmer = (size = 3) => goldenSequence(100, size)
3780
- .map((_) => Math.floor(_))
3781
- .map(renderShimmerItem);
3782
- const renderShimmerItem = (width, index) => (jsx("div", { style: { width: `${width || 100}%` }, className: "h-4 mt-xs bg-secondary-light" }, String(index)));
3783
- const goldenSequence = (first, size) => [first].concat(size > 0 ? goldenSequence(first / GOLDEN_RATIO, size - 1) : []);
3784
-
3785
- function renderBackwardButton(version, handleClick) {
3786
- const iconVersion = version === 'primary' ? 'white' : 'black';
3787
- const className = 'w-12 h-12 min-h-12 min-w-12 flex items-center justify-center';
3788
- const text = 'Вернуться назад';
3789
- return (jsxs("div", { className: "hidden sm:flex items-center gap-s", children: [jsx("div", { className: getRegularButtonClasses({ className, version, rounded: true }), onClick: handleClick, children: jsx(Img, { className: "w-4 h-4", image: {
3790
- icon: 'ArrowLeftIcon',
3791
- iconVersion: iconVersion,
3792
- } }) }), jsx(Button, { version: "link", className: "group-data-secondary:text-white/80", text: text, ariaLabel: text, onClick: handleClick })] }));
3793
- }
3777
+ const useLatestEvent = (eventBus, type, initialEvent) => {
3778
+ const [latestEvent, setLatestEvent] = useState(initialEvent || null);
3779
+ useEffect(() => eventBus.subscribe(type, (_) => setLatestEvent(_)), [eventBus, type]);
3780
+ const fireEvent = useCallback((_) => eventBus.fire(type, _), [eventBus, type]);
3781
+ return [latestEvent, fireEvent];
3782
+ };
3794
3783
 
3795
- const ProductBlock = JSX(({ className, padding, backwardButton, showBorder, ...rest }) => {
3796
- const router = useRouter();
3797
- const handleClick = useCallback((ev) => {
3798
- ev?.preventDefault();
3799
- router.back();
3784
+ const REGION_URL = '/api/v1/region';
3785
+ const LOCATION_STORAGE_KEY = 'location';
3786
+ function useLocation(defaultLocation = 'Москва') {
3787
+ const [currentLocation, fireCurrentLocation] = useLatestEvent(defaultEventBus, 'location', restoreLocation() ?? { name: defaultLocation });
3788
+ const selectCurrentLocation = useCallback((_) => {
3789
+ storeLocation(_);
3790
+ fireCurrentLocation(_);
3800
3791
  }, []);
3801
- return (jsxs(BlockWrapper, { className: style('overflow-hidden flex flex-col gap-3xl box-border', getBorderStyle(showBorder), className), defaultPadding: "p-6xl", padding: padding, ...rest, children: [backwardButton
3802
- ? renderBackwardButton(!rest.version || rest.version === 'primary' ? 'primary' : 'white', handleClick)
3803
- : null, jsx(BaseProductTile, { className: "grow h-full", ...rest })] }));
3804
- });
3805
-
3806
- const ProductGallery = JSX(({ className, padding, slides = [], ...rest }) => (jsx(BlockWrapper, { className: style('overflow-hidden relative', className), padding: padding, ...rest, children: jsx(SwipeListControl, { gap: 0, padding: 0, children: slides
3807
- .map((s) => s.productBlock)
3808
- .map((_, i) => (jsx("div", { className: "box-border h-full", role: "listitem", children: jsx(BaseProductTile, { className: "px-5 h-full", headlineVersion: "L", ..._, ...rest }) }, String(i)))) }) })));
3809
-
3810
- const ProductTile = JSX(({ className, padding, headlineVersion = 'S', isTabularBenefits = true, additionalDescription, imageOptions, isFullWidthTitle = true, ...rest }) => (jsx(BlockWrapper, { className: className, padding: "p-0", ...rest, children: jsx(BaseProductTile, { className: "h-full", defaultPadding: "p-4xl sm:p-xl", padding: padding, headlineVersion: headlineVersion, isTabularBenefits: isTabularBenefits, imageOptions: { isImageSecondary: true, ...imageOptions }, isFullWidthTitle: isFullWidthTitle, ...rest, children: additionalDescription ? (jsx(Paragraph, { size: "text-m", font: "font-light", color: "group-data-primary:text-secondary-text", children: additionalDescription })) : null }) })));
3792
+ const { data } = useAsyncData(REGION_URL, fetchJSONUnsafe);
3793
+ useEffect(() => {
3794
+ if (data && !hasStoredLocation()) {
3795
+ fireCurrentLocation(data);
3796
+ }
3797
+ }, [data]);
3798
+ return [currentLocation ?? { name: defaultLocation }, selectCurrentLocation];
3799
+ }
3800
+ const hasStoredLocation = () => Boolean(globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY));
3801
+ const restoreLocation = () => {
3802
+ try {
3803
+ const data = globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY);
3804
+ return data && JSON.parse(data);
3805
+ }
3806
+ catch (ex) {
3807
+ return null;
3808
+ }
3809
+ };
3810
+ const storeLocation = (_) => {
3811
+ try {
3812
+ globalThis.localStorage?.setItem(LOCATION_STORAGE_KEY, JSON.stringify(_));
3813
+ }
3814
+ catch (ex) {
3815
+ // Do nothing
3816
+ }
3817
+ };
3811
3818
 
3812
- const RepresentativeOfficeInfo = JSX(({ address, email, telephone, button, className = '', __html, icon, title, version = 'primary', ...rest }) => (jsxs(BlockWrapper, { className: style('box-border text-left space-y-s', className), version: version, ...rest, children: [jsxs("div", { className: "w-full flex justify-between flex-row-reverse", children: [isIcon(icon) ? (jsx("div", { className: 'w-10 h-7 sm:w-24 sm:h-16', children: jsx(Img, { image: icon }) })) : null, title ? jsx(Heading, { headingType: "h3", as: "h3", title: title }) : null] }), jsxs("div", { className: "w-full space-y-m", children: [__html ? renderDescriptionBlock(__html) : null, renderBlock({
3813
- label: 'Адрес',
3814
- data: address,
3815
- iconName: 'GeolocationIcon',
3816
- }), renderBlock({ label: 'Телефон(факс)', data: telephone, iconName: 'PhoneIcon' }), renderBlock({
3817
- label: 'E-mail',
3818
- data: email,
3819
- iconName: 'MailIcon',
3820
- dataColor: 'text-primary-main',
3821
- }), button?.text ? renderButtonsSection([button]) : null] })] })));
3822
- const renderDescriptionBlock = (__html) => (jsx("div", { className: "border-b border-main-divider pb-lg", children: jsx(RichText, { __html: __html }) }));
3823
- const renderBlock = ({ label, data, iconName, dataColor = '' }) => data ? (jsxs("div", { className: "flex gap-s", children: [jsx(Icon, { iconVersion: "black", name: iconName, width: "24", height: "24" }), jsxs("div", { className: "flex flex-col gap-2xs", children: [jsx(Text, { size: "text-m", font: "font-light", color: "text-secondary-text", children: label }), jsx(Text, { size: "text-xl", color: dataColor, children: data })] })] })) : null;
3819
+ const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
3824
3820
 
3825
- const RichTextBlock = JSX((props) => {
3826
- const { __html, richVersion, ...rest } = props;
3827
- return (jsx(BlockWrapper, { defaultPadding: "p-0", ...rest, children: jsx(RichText, { __html: __html, richVersion: richVersion }) }));
3828
- });
3821
+ const isClient = !isSSR();
3822
+ const ClientOnly = JSX(({ children }) => (isClient ? children : null));
3829
3823
 
3830
3824
  function renderClusterer(yandexMaps, map, points) {
3831
3825
  map.geoObjects.removeAll();
@@ -4024,6 +4018,306 @@
4024
4018
  const mapByIndex = (arr, index) => arr.map((a) => a[index]);
4025
4019
  const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
4026
4020
 
4021
+ const FILTRATION_LABELS = {
4022
+ safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
4023
+ workingSaturday: 'Открыты по субботам',
4024
+ terminalTypeAtms: 'Банкоматы',
4025
+ terminalTypeTerm: 'Терминалы',
4026
+ workAllTime: 'Круглосуточно',
4027
+ billAcceptorEnable: 'Прием наличных',
4028
+ };
4029
+ const renderFiltrationForm = (filters, { field, reset }) => (jsxs("div", { className: "pb-2xl", children: [filters?.length ? (jsx("div", { className: "flex flex-wrap gap-3xl pb-2xl", children: filters.map((key) => (jsx(Checkbox, { text: FILTRATION_LABELS[key], ...field(key) }, key))) })) : null, jsx(Button, { version: "transparent", className: "text-secondary-text [&>*]:p-0", onClick: reset, text: "\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440", appendRight: jsx(Icon, { name: "CloseIcon", width: "16", height: "16" }) })] }));
4030
+
4031
+ const defaultRenderCard = () => null;
4032
+ const defaultFilterItems = () => [];
4033
+ const OfficesAtmsMapLayout = JSX(({ className, data = [], renderCard = defaultRenderCard, filterItems = defaultFilterItems, initFilterState = {}, descriptionData, title, }) => {
4034
+ const [filtrationState, { field, reset }] = useForm(initFilterState);
4035
+ const filteredItems = filterItems(data, filtrationState);
4036
+ const points = filteredItems
4037
+ .map((_) => [_.gpsLatitude, _.gpsLongitude].filter(Boolean))
4038
+ .filter((_) => _ && _.length === 2);
4039
+ const lengthItems = filteredItems.length;
4040
+ return (jsxs("div", { className: style('space-y-1', className), children: [jsxs("div", { className: "bg-white", children: [jsxs("div", { className: "pt-6xl px-6xl", children: [jsxs("div", { className: "flex gap-xs pb-2xl", children: [jsx(Heading, { headingType: "h2", children: title }), lengthItems ? (jsx(Text, { size: "text-h2", color: "text-secondary-text", children: `(${lengthItems})` })) : null] }), descriptionData ? renderDescriptionBlock$1(descriptionData) : null, renderFiltrationForm(Object.keys(initFilterState), { field, reset })] }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, className: "h-full" }) }) })] }), filteredItems.map(renderCard)] }));
4041
+ });
4042
+ const renderDescriptionBlock$1 = ({ description, list }) => description || list?.length ? (jsxs("div", { className: "p-xl mb-2xl border border-gray rounded-md", children: [description ? (jsx(Paragraph, { size: "text-l", font: "font-light", children: description })) : null, list?.length ? (jsx("div", { className: "flex gap-2xl flex-wrap pt-xs", children: list.map((item, i) => (jsxs("div", { className: "flex gap-xs items-center", children: [item?.image ? jsx(Img, { image: item.image }) : null, item?.text ? (jsx(Text, { size: "text-m", font: "font-light", children: item.text })) : null] }, String(i)))) })) : null] })) : null;
4043
+
4044
+ const colorStyle = {
4045
+ yellow: { border: 'border-yellow-light', text: 'text-yellow' },
4046
+ green: { border: 'border-green-more-light', text: 'text-green-dark' },
4047
+ gray: { border: 'border-gray', text: 'text-secondary-text' },
4048
+ red: { border: 'border-error/30', text: 'text-error' },
4049
+ };
4050
+ const Badge = JSX(({ className, children, color = 'gray' }) => (jsx("div", { className: style('p-s border border-gray rounded-md flex items-center', colorStyle[color].border, className), children: jsx(Text, { size: "text-m", color: colorStyle[color].text, children: children }) })));
4051
+
4052
+ const CardCell = JSX(({ value, subText, children, ...props }) => {
4053
+ const textItems = (Array.isArray(value) ? value : value?.split(',') ?? []).filter(Boolean);
4054
+ if ([textItems.length, children, subText].every((_) => !_)) {
4055
+ return null;
4056
+ }
4057
+ return renderCardCell({ textItems, subText, children, ...props });
4058
+ });
4059
+ const renderCardCell = ({ label, labelSize = 'text-m', textItems, subColor, subText, className, children, }) => (jsxs("div", { className: style('flex gap-2xs flex-col h-full max-w-[300px]', className), children: [label ? (jsx(Text, { color: "text-secondary-text", font: "font-light", size: labelSize, children: label })) : null, children ||
4060
+ textItems.filter(Boolean).map((text, i) => (jsx(Text, { size: "text-l", children: text.trim() }, String(i)))), subText ? (jsx(Text, { color: subColor, size: "text-m", children: subText })) : null] }));
4061
+
4062
+ const CardRow = JSX(({ className, children }) => (jsx("div", { className: style('flex border-t border-solid border-main-divider py-xl gap-x-6xl gap-y-xl', className), children: children })));
4063
+
4064
+ const renderAtmCard = ({ location, address, billAcceptorType, terminalType, billAcceptorEnable, atmCode = '', atmAccess = '', workTime, }, index) => {
4065
+ const additionalInfo = [
4066
+ {
4067
+ label: 'Устройство',
4068
+ value: capitalizedFirstLetter(terminalType),
4069
+ },
4070
+ { label: 'Модуль приема наличных', value: billAcceptorEnable ? 'Да' : 'Нет' },
4071
+ {
4072
+ label: 'Прием наличных пачкой',
4073
+ value: billAcceptorType === 'банкомат принимает пачками' ? 'Да' : 'Нет',
4074
+ },
4075
+ {
4076
+ label: 'Доступность',
4077
+ value: ['внешняя установка', 'территория банка'].includes(atmAccess) ? 'Общедоступный' : '',
4078
+ },
4079
+ { label: 'Регистрационный номер', value: atmCode },
4080
+ ];
4081
+ return (jsxs("div", { className: "bg-white col-span-12 p-3xl border-green border", children: [jsxs("div", { className: "flex justify-between", children: [jsx(Text, { size: "text-h4", children: capitalizedFirstLetter(location) }), jsx(Badge, { color: "green", children: capitalizedFirstLetter(workTime) })] }), address ? (jsxs("div", { className: "flex pb-xl pt-xs gap-2xs", children: [jsx(Icon, { name: "GeolocationIcon", width: "24", height: "24" }), jsx(Text, { size: "text-l", children: address })] })) : null, jsx(CardRow, { className: "flex-wrap", children: additionalInfo?.map(renderInfo) })] }, String(index)));
4082
+ };
4083
+ const renderInfo = (item, index) => (jsx(CardCell, { ...item }, String(index)));
4084
+ const capitalizedFirstLetter = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
4085
+
4086
+ const EMPTY_VALUE$2 = [];
4087
+ function useAtms(regionCode) {
4088
+ const { data = EMPTY_VALUE$2 } = useAsyncData(`/api/v1/atms?regionCode=${regionCode}`, fetchMap$1);
4089
+ return data;
4090
+ }
4091
+ const fetchMap$1 = async (url) => {
4092
+ const result = await fetchJSON(url, { method: 'GET' });
4093
+ return result || EMPTY_VALUE$2;
4094
+ };
4095
+
4096
+ const INITIAL_FILTRATION_STATE$1 = {
4097
+ terminalTypeAtms: true,
4098
+ terminalTypeTerm: false,
4099
+ workAllTime: false,
4100
+ billAcceptorEnable: false,
4101
+ };
4102
+ const FILTRATION_PREDICATES$1 = {
4103
+ terminalTypeAtms: (item) => item.terminalType?.toLowerCase() === 'банкомат',
4104
+ terminalTypeTerm: (item) => item.terminalType?.toLowerCase() === 'терминал',
4105
+ workAllTime: (item) => item.workTime?.toLowerCase() === 'круглосуточно',
4106
+ billAcceptorEnable: (item) => Boolean(item.billAcceptorEnable),
4107
+ };
4108
+ const AtmsMap = JSX(({ data, className }) => {
4109
+ const [currentLocation] = useLocation();
4110
+ const regionCode = currentLocation?.code ?? '000';
4111
+ const officesData = useAtms(regionCode);
4112
+ return (jsx(OfficesAtmsMapLayout, { className: className, filterItems: filterItems$1, data: officesData, initFilterState: INITIAL_FILTRATION_STATE$1, renderCard: renderAtmCard, title: `Банкоматы филиала ${currentLocation?.name}`, descriptionData: data }));
4113
+ });
4114
+ const filterItems$1 = (data, filtrationState) => {
4115
+ const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
4116
+ const filtersOR = truthyFilters.filter((_) => _.startsWith('terminalType'));
4117
+ const filtersAND = truthyFilters.filter((_) => !filtersOR.includes(_));
4118
+ return data.filter((item) => {
4119
+ const resultAND = filtersAND.every((_) => FILTRATION_PREDICATES$1[_](item));
4120
+ const resultOR = filtersOR.length
4121
+ ? filtersOR.some((_) => FILTRATION_PREDICATES$1[_](item))
4122
+ : true;
4123
+ return resultAND && resultOR;
4124
+ });
4125
+ };
4126
+
4127
+ const getScheduleDescription = (workScheduleWeek) => {
4128
+ const workingWeekday = workScheduleWeek.find((_) => _.key !== 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
4129
+ const workingSaturday = workScheduleWeek.find((_) => _.key === 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
4130
+ const daysOff = workScheduleWeek
4131
+ .filter((_) => !_.status)
4132
+ .map((_) => _.short?.toLowerCase())
4133
+ .join(', ');
4134
+ const rows = [
4135
+ buildScheduleText({
4136
+ workTime: workingWeekday?.workTime,
4137
+ lunchHour: workingWeekday?.lunchHour,
4138
+ daysOff: workingSaturday ? '' : daysOff,
4139
+ }),
4140
+ buildScheduleText({ workTime: workingSaturday?.workTime, lunchHour: workingSaturday?.lunchHour, daysOff }, true),
4141
+ ].filter(Boolean);
4142
+ return jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", value: rows, className: "max-w-none" });
4143
+ };
4144
+ const buildScheduleText = ({ workTime = '', lunchHour = '', daysOff = '' }, isSaturday = false) => {
4145
+ if (!workTime) {
4146
+ return '';
4147
+ }
4148
+ return [
4149
+ `${isSaturday ? 'Суббота' : 'Будние дни'}: ${workTime}`,
4150
+ lunchHour ? `перерыв: ${lunchHour}` : '',
4151
+ daysOff ? `не работает: ${daysOff}` : '',
4152
+ ]
4153
+ .filter(Boolean)
4154
+ .join('; ');
4155
+ };
4156
+
4157
+ const WEEKDAY_MAP = [
4158
+ ['workingMonday', 'Пн', 'Понедельник'],
4159
+ ['workingTuesday', 'Вт', 'Вторник'],
4160
+ ['workingWednesday', 'Ср', 'Среда'],
4161
+ ['workingThursday', 'Чт', 'Четверг'],
4162
+ ['workingFriday', 'Пт', 'Пятница'],
4163
+ ['workingSaturday', 'Сб', 'Суббота'],
4164
+ ['workingSunday', 'Вс', 'Воскресенье'],
4165
+ ];
4166
+ const getWorkScheduleWeek = (workSchedule) => WEEKDAY_MAP.map(([key, short, title]) => ({
4167
+ key,
4168
+ title,
4169
+ short,
4170
+ status: Boolean(workSchedule?.[key]),
4171
+ get workTime() {
4172
+ return key === 'workingSaturday' ? workSchedule?.workTimeSaturday : workSchedule?.workTime;
4173
+ },
4174
+ get lunchHour() {
4175
+ return key === 'workingSaturday' ? workSchedule?.lunchHourSaturday : workSchedule?.lunchHour;
4176
+ },
4177
+ get hasLunch() {
4178
+ return /\d+/.test(this.lunchHour ?? '');
4179
+ },
4180
+ }));
4181
+
4182
+ const renderBusinessSchedule = (scheduleDescription) => {
4183
+ if (!scheduleDescription) {
4184
+ return null;
4185
+ }
4186
+ const businessSchedule = getBusinessSchedule(scheduleDescription);
4187
+ return (jsxs(CardRow, { className: "border-none", children: [jsx(CardCell, { label: "\u0414\u043B\u044F \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", labelSize: "text-l", children: jsx("div", { className: "flex gap-1", children: businessSchedule.map(renderAlternativeDay) }) }), jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", className: "max-w-none", children: jsx(Text, { children: scheduleDescription }) })] }));
4188
+ };
4189
+ const getBusinessSchedule = (scheduleDescription) => {
4190
+ const weekDayMap = WEEKDAY_MAP.map(([, short]) => ({ short, status: true }));
4191
+ const splittedScheduleDescription = scheduleDescription.split('/') ?? [];
4192
+ const lastPartScheduleDescription = splittedScheduleDescription[splittedScheduleDescription.length - 1]?.toLowerCase();
4193
+ if (!lastPartScheduleDescription?.includes('выходной')) {
4194
+ return weekDayMap;
4195
+ }
4196
+ return weekDayMap.map((_) => ({
4197
+ ..._,
4198
+ status: !lastPartScheduleDescription?.includes(_.short.toLowerCase()),
4199
+ }));
4200
+ };
4201
+ const renderAlternativeDay = ({ short, status }, index) => (jsx("div", { className: style('w-9 h-9 rounded-md flex items-center justify-center', status ? 'bg-green-more-light text-green-dark' : 'bg-error/30 text-error'), children: jsx(Text, { size: "text-xs", children: short }) }, String(index)));
4202
+
4203
+ const currentWeekDayIdx = new Date().getDay();
4204
+ const renderOfficeCard = ({ name, address, phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }, index) => {
4205
+ if (!workSchedule) {
4206
+ return null;
4207
+ }
4208
+ const workScheduleWeek = getWorkScheduleWeek(workSchedule);
4209
+ const labelSchedule = workSchedule?.businessScheduleVisibleTag
4210
+ ? 'Для физических лиц'
4211
+ : 'Для физических и юридических лиц';
4212
+ return (jsxs("div", { className: "bg-white col-span-12 p-3xl border-green border", children: [jsxs("div", { className: "flex justify-between", children: [jsx(Text, { size: "text-h4", children: name }), renderCurrentDaySchedule(workScheduleWeek)] }), address ? (jsxs("div", { className: "flex pb-xl pt-xs gap-2xs", children: [jsx(Icon, { name: "GeolocationIcon", width: "24", height: "24" }), jsx(Text, { size: "text-l", children: address })] })) : null, jsxs(CardRow, { className: "flex-wrap", children: [jsx(CardCell, { label: "\u0424\u0430\u043A\u0441", value: fax }), jsx(CardCell, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D \u0444\u0438\u043B\u0438\u0430\u043B\u0430", value: phone }), jsx(CardCell, { label: "\u0414\u043B\u044F \u043E\u0431\u0440\u0430\u0449\u0435\u043D\u0438\u0439 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", value: phoneBusiness }), jsx(CardCell, { label: "\u041E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u0435 \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", value: phoneNatural }), jsx(CardCell, { label: "\u0414\u043B\u044F \u043A\u043E\u043D\u0441\u0443\u043B\u044C\u0442\u0430\u0446\u0438\u0439 \u043F\u043E \u0432\u0430\u043B\u044E\u0442\u043D\u043E\u043C\u0443 \u043A\u043E\u043D\u0442\u0440\u043E\u043B\u044E", value: phoneCurrencyControl }), jsx(CardCell, { label: "\u041A\u043E\u043D\u0442\u0430\u043A\u0442-\u0446\u0435\u043D\u0442\u0440", value: phoneCallCentre })] }), workSchedule.isMatchesPattern ? (jsx(CardRow, { children: jsx(CardCell, { label: labelSchedule, labelSize: "text-l", className: "w-full max-w-none", children: jsx("div", { className: "flex flex-wrap gap-xs sm:justify-between pt-xs", children: workScheduleWeek?.map(renderDay) }) }) })) : (jsxs(CardRow, { children: [jsx(CardCell, { label: labelSchedule, labelSize: "text-l", children: jsx("div", { className: "flex gap-1", children: workScheduleWeek?.map(renderAlternativeDay) }) }), getScheduleDescription(workScheduleWeek)] })), workSchedule?.businessScheduleVisibleTag
4213
+ ? renderBusinessSchedule(workSchedule?.businessScheduleDescription)
4214
+ : null, exchangeRate?.currencies?.length ? (jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }, String(index)));
4215
+ };
4216
+ const renderCurrency = ({ currency, buyExchangeRate, saleExchangeRate }, i) => (jsxs("div", { className: "flex gap-lg h-full", children: [currency?.currency ? jsx(CardCell, { label: "\u0412\u0430\u043B\u044E\u0442\u0430", value: currency.currency }) : null, buyExchangeRate ? jsx(CardCell, { label: "\u041A\u0443\u043F\u0438\u0442\u044C", value: String(buyExchangeRate) }) : null, saleExchangeRate ? jsx(CardCell, { label: "\u041F\u0440\u043E\u0434\u0430\u0442\u044C", value: String(saleExchangeRate) }) : null] }, String(i)));
4217
+ //TODO: Add logic time https://github.com/redneckz/wildless-cms-uni-blocks/pull/1549
4218
+ const renderCurrentDaySchedule = (workScheduleWeek) => {
4219
+ const [currentWeekDay] = workScheduleWeek?.slice(currentWeekDayIdx - 1) ?? [];
4220
+ if (!currentWeekDay) {
4221
+ return null;
4222
+ }
4223
+ const { lunchHour, status, workTime, hasLunch } = currentWeekDay;
4224
+ return status ? (jsxs("div", { className: "flex gap-s items-start whitespace-nowrap", children: [workTime ? jsx(Badge, { color: "green", children: workTime }) : null, lunchHour && hasLunch ? jsx(Badge, { color: "yellow", children: `перерыв: ${lunchHour}` }) : null] })) : (jsx(Badge, { color: "red", children: "\u0412\u044B\u0445\u043E\u0434\u043D\u043E\u0439" }));
4225
+ };
4226
+ const renderDay = ({ title, status, workTime, lunchHour, hasLunch }, index) => (jsx(CardCell, { label: title, value: status && workTime ? workTime : '', subText: getSubTextLunch(lunchHour, hasLunch, status), subColor: !status || hasLunch ? 'text-error' : 'text-green-dark' }, String(index)));
4227
+ const getSubTextLunch = (lunchHour, hasLunch = false, status = false) => {
4228
+ if (!status) {
4229
+ return 'Не работает';
4230
+ }
4231
+ return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
4232
+ };
4233
+
4234
+ const EMPTY_VALUE$1 = [];
4235
+ function useOffices(regionCode) {
4236
+ const { data = EMPTY_VALUE$1 } = useAsyncData(`/api/v1/branches?regionCode=${regionCode}`, fetchMap);
4237
+ return data;
4238
+ }
4239
+ const fetchMap = async (url) => {
4240
+ const result = await fetchJSON(url, { method: 'GET' });
4241
+ return result || EMPTY_VALUE$1;
4242
+ };
4243
+
4244
+ const INITIAL_FILTRATION_STATE = {
4245
+ //safeBoxCaseVolumes: false, //TODO: temp hide
4246
+ workingSaturday: false,
4247
+ };
4248
+ const FILTRATION_PREDICATES = {
4249
+ //safeBoxCaseVolumes: (item: Branch) => Boolean(item.safeBoxCaseVolumes), //TODO: temp hide
4250
+ workingSaturday: (item) => Boolean(item.workSchedule?.workingSaturday),
4251
+ };
4252
+ const OfficesMap = JSX(({ className }) => {
4253
+ const [currentLocation] = useLocation();
4254
+ const regionCode = currentLocation?.code ?? '000';
4255
+ const officesData = useOffices(regionCode);
4256
+ return (jsx(OfficesAtmsMapLayout, { className: className, filterItems: filterItems, data: officesData, initFilterState: INITIAL_FILTRATION_STATE, renderCard: renderOfficeCard, title: `Офисы филиала ${currentLocation?.name}` }));
4257
+ });
4258
+ const filterItems = (data, filtrationState) => {
4259
+ const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
4260
+ return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES[_](item)));
4261
+ };
4262
+
4263
+ const OfficesAtmsMap = JSX(({ data, className, ...rest }) => {
4264
+ const dataType = data?.dataType ?? 'offices';
4265
+ return (jsx(BlockWrapper, { version: "transparent", className: style(className), defaultPadding: "p-0", ...rest, children: dataType === 'offices' ? jsx(OfficesMap, {}) : jsx(AtmsMap, { data: data }) }));
4266
+ });
4267
+
4268
+ const GOLDEN_RATIO = 1.618;
4269
+ const Placeholder = JSX(({ className, title, description = 'Блок в разработке...', ...rest }) => (jsxs(BlockWrapper, { className: style('box-border', className), ...rest, children: [jsx(Headline, { className: "max-w-[600px]", title: title, description: description, headlineVersion: "L", align: "text-left", isEmbedded: true }), jsx("figure", { className: "m-0 mt-xl min-w-[80%]", children: renderShimmer() })] })));
4270
+ const renderShimmer = (size = 3) => goldenSequence(100, size)
4271
+ .map((_) => Math.floor(_))
4272
+ .map(renderShimmerItem);
4273
+ const renderShimmerItem = (width, index) => (jsx("div", { style: { width: `${width || 100}%` }, className: "h-4 mt-xs bg-secondary-light" }, String(index)));
4274
+ const goldenSequence = (first, size) => [first].concat(size > 0 ? goldenSequence(first / GOLDEN_RATIO, size - 1) : []);
4275
+
4276
+ function renderBackwardButton(version, handleClick) {
4277
+ const iconVersion = version === 'primary' ? 'white' : 'black';
4278
+ const className = 'w-12 h-12 min-h-12 min-w-12 flex items-center justify-center';
4279
+ const text = 'Вернуться назад';
4280
+ return (jsxs("div", { className: "hidden sm:flex items-center gap-s", children: [jsx("div", { className: getRegularButtonClasses({ className, version, rounded: true }), onClick: handleClick, children: jsx(Img, { className: "w-4 h-4", image: {
4281
+ icon: 'ArrowLeftIcon',
4282
+ iconVersion: iconVersion,
4283
+ } }) }), jsx(Button, { version: "link", className: "group-data-secondary:text-white/80", text: text, ariaLabel: text, onClick: handleClick })] }));
4284
+ }
4285
+
4286
+ const ProductBlock = JSX(({ className, padding, backwardButton, showBorder, ...rest }) => {
4287
+ const router = useRouter();
4288
+ const handleClick = useCallback((ev) => {
4289
+ ev?.preventDefault();
4290
+ router.back();
4291
+ }, []);
4292
+ return (jsxs(BlockWrapper, { className: style('overflow-hidden flex flex-col gap-3xl box-border', getBorderStyle(showBorder), className), defaultPadding: "p-6xl", padding: padding, ...rest, children: [backwardButton
4293
+ ? renderBackwardButton(!rest.version || rest.version === 'primary' ? 'primary' : 'white', handleClick)
4294
+ : null, jsx(BaseProductTile, { className: "grow h-full", ...rest })] }));
4295
+ });
4296
+
4297
+ const ProductGallery = JSX(({ className, padding, slides = [], ...rest }) => (jsx(BlockWrapper, { className: style('overflow-hidden relative', className), padding: padding, ...rest, children: jsx(SwipeListControl, { gap: 0, padding: 0, children: slides
4298
+ .map((s) => s.productBlock)
4299
+ .map((_, i) => (jsx("div", { className: "box-border h-full", children: jsx(BaseProductTile, { className: "px-5 h-full", headlineVersion: "L", ..._, ...rest }) }, String(i)))) }) })));
4300
+
4301
+ const ProductTile = JSX(({ className, padding, headlineVersion = 'S', isTabularBenefits = true, additionalDescription, imageOptions, isFullWidthTitle = true, ...rest }) => (jsx(BlockWrapper, { className: className, padding: "p-0", ...rest, children: jsx(BaseProductTile, { className: "h-full", defaultPadding: "p-4xl sm:p-xl", padding: padding, headlineVersion: headlineVersion, isTabularBenefits: isTabularBenefits, imageOptions: { isImageSecondary: true, ...imageOptions }, isFullWidthTitle: isFullWidthTitle, ...rest, children: additionalDescription ? (jsx(Paragraph, { size: "text-m", font: "font-light", color: "group-data-primary:text-secondary-text", children: additionalDescription })) : null }) })));
4302
+
4303
+ const RepresentativeOfficeInfo = JSX(({ address, email, telephone, button, className = '', __html, icon, title, version = 'primary', ...rest }) => (jsxs(BlockWrapper, { className: style('box-border text-left space-y-s', className), version: version, ...rest, children: [jsxs("div", { className: "w-full flex justify-between flex-row-reverse", children: [isIcon(icon) ? (jsx("div", { className: 'w-10 h-7 sm:w-24 sm:h-16', children: jsx(Img, { image: icon }) })) : null, title ? jsx(Heading, { headingType: "h3", as: "h3", title: title }) : null] }), jsxs("div", { className: "w-full space-y-m", children: [__html ? renderDescriptionBlock(__html) : null, renderBlock({
4304
+ label: 'Адрес',
4305
+ data: address,
4306
+ iconName: 'GeolocationIcon',
4307
+ }), renderBlock({ label: 'Телефон(факс)', data: telephone, iconName: 'PhoneIcon' }), renderBlock({
4308
+ label: 'E-mail',
4309
+ data: email,
4310
+ iconName: 'MailIcon',
4311
+ dataColor: 'text-primary-main',
4312
+ }), button?.text ? renderButtonsSection([button]) : null] })] })));
4313
+ const renderDescriptionBlock = (__html) => (jsx("div", { className: "border-b border-main-divider pb-lg", children: jsx(RichText, { __html: __html }) }));
4314
+ const renderBlock = ({ label, data, iconName, dataColor = '' }) => data ? (jsxs("div", { className: "flex gap-s", children: [jsx(Icon, { iconVersion: "black", name: iconName, width: "24", height: "24" }), jsxs("div", { className: "flex flex-col gap-2xs", children: [jsx(Text, { size: "text-m", font: "font-light", color: "text-secondary-text", children: label }), jsx(Text, { size: "text-xl", color: dataColor, children: data })] })] })) : null;
4315
+
4316
+ const RichTextBlock = JSX((props) => {
4317
+ const { __html, richVersion, ...rest } = props;
4318
+ return (jsx(BlockWrapper, { defaultPadding: "p-0", ...rest, children: jsx(RichText, { __html: __html, richVersion: richVersion }) }));
4319
+ });
4320
+
4027
4321
  const RadioButtons = JSX(({ className = '' }) => {
4028
4322
  const [selectedOption, setSelectedOption] = useState('option2');
4029
4323
  const onChange = useCallback((_) => setSelectedOption(_), []);
@@ -4274,48 +4568,6 @@
4274
4568
  return dialogs;
4275
4569
  };
4276
4570
 
4277
- const useLatestEvent = (eventBus, type, initialEvent) => {
4278
- const [latestEvent, setLatestEvent] = useState(initialEvent || null);
4279
- useEffect(() => eventBus.subscribe(type, (_) => setLatestEvent(_)), [eventBus, type]);
4280
- const fireEvent = useCallback((_) => eventBus.fire(type, _), [eventBus, type]);
4281
- return [latestEvent, fireEvent];
4282
- };
4283
-
4284
- const REGION_URL = '/api/v1/region';
4285
- const LOCATION_STORAGE_KEY = 'location';
4286
- function useLocation(defaultLocation = 'Москва') {
4287
- const [currentLocation, fireCurrentLocation] = useLatestEvent(defaultEventBus, 'location', restoreLocation() ?? { name: defaultLocation });
4288
- const selectCurrentLocation = useCallback((_) => {
4289
- storeLocation(_);
4290
- fireCurrentLocation(_);
4291
- }, []);
4292
- const { data } = useAsyncData(REGION_URL, fetchJSONUnsafe);
4293
- useEffect(() => {
4294
- if (data && !hasStoredLocation()) {
4295
- fireCurrentLocation(data);
4296
- }
4297
- }, [data]);
4298
- return [currentLocation ?? { name: defaultLocation }, selectCurrentLocation];
4299
- }
4300
- const hasStoredLocation = () => Boolean(globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY));
4301
- const restoreLocation = () => {
4302
- try {
4303
- const data = globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY);
4304
- return data && JSON.parse(data);
4305
- }
4306
- catch (ex) {
4307
- return null;
4308
- }
4309
- };
4310
- const storeLocation = (_) => {
4311
- try {
4312
- globalThis.localStorage?.setItem(LOCATION_STORAGE_KEY, JSON.stringify(_));
4313
- }
4314
- catch (ex) {
4315
- // Do nothing
4316
- }
4317
- };
4318
-
4319
4571
  const CloseButton = JSX(({ className, onClose }) => (jsx("button", { className: style('flex justify-center items-center w-12 h-12 p-2xs bg-transparent border-none', className), onClick: onClose, title: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C", children: jsx(Img, { image: { icon: 'CloseIcon' }, width: "24", height: "24" }) })));
4320
4572
 
4321
4573
  const Dialog = JSX(({ className, head, children, onClose }) => {
@@ -4962,7 +5214,6 @@
4962
5214
  CarouselTariffsCard,
4963
5215
  ComparisonTable,
4964
5216
  DepositFiltration,
4965
- MortgageFiltration,
4966
5217
  ErrorBlock,
4967
5218
  ExchangeRateTile,
4968
5219
  Footer,
@@ -4972,6 +5223,8 @@
4972
5223
  ImgBlock,
4973
5224
  LinkDocs,
4974
5225
  MobileAppTile,
5226
+ MortgageFiltration,
5227
+ OfficesAtmsMap,
4975
5228
  Placeholder,
4976
5229
  ProductBlock,
4977
5230
  ProductGallery,
@@ -5183,7 +5436,7 @@
5183
5436
 
5184
5437
  const joinList = (sep) => (list) => list.reduce((acc, el, i) => (acc.length ? acc.concat({ ...sep, key: `sep-${i}` }, el) : [el]), []);
5185
5438
 
5186
- const packageVersion = "0.14.42";
5439
+ const packageVersion = "0.14.43";
5187
5440
 
5188
5441
  exports.Blocks = Blocks;
5189
5442
  exports.ContentPage = ContentPage;