@redneckz/wildless-cms-uni-blocks 0.14.623 → 0.14.625

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 (172) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +1040 -981
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/CreditForm/getInitialFormState.d.ts +2 -2
  5. package/bundle/components/OfficesAtmsMap/useOfficesAtmsMapData.d.ts +20 -0
  6. package/bundle/hooks/useRegions.d.ts +2 -0
  7. package/bundle/ui-kit/FormField/Fields/RetailAddressField.d.ts +2 -0
  8. package/bundle/ui-kit/FormField/Fields/RetailRegionField.d.ts +2 -0
  9. package/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  10. package/bundle/ui-kit/FormField/validators.d.ts +1 -1
  11. package/bundle/ui-kit/YandexMap/YandexMap.d.ts +1 -0
  12. package/dist/components/CreditForm/creditFormStepsData.js +2 -2
  13. package/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
  14. package/dist/components/CreditForm/getInitialFormState.d.ts +2 -2
  15. package/dist/components/CreditForm/getInitialFormState.js +2 -2
  16. package/dist/components/CreditForm/getInitialFormState.js.map +1 -1
  17. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +8 -21
  18. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  19. package/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.d.ts +20 -0
  20. package/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.js +31 -0
  21. package/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.js.map +1 -0
  22. package/dist/hooks/useRegions.d.ts +2 -0
  23. package/dist/hooks/useRegions.js.map +1 -1
  24. package/dist/ui-kit/FormField/Fields/RetailAddressField.d.ts +2 -0
  25. package/dist/ui-kit/FormField/Fields/RetailAddressField.js +38 -0
  26. package/dist/ui-kit/FormField/Fields/RetailAddressField.js.map +1 -0
  27. package/dist/ui-kit/FormField/Fields/RetailRegionField.d.ts +2 -0
  28. package/dist/ui-kit/FormField/Fields/RetailRegionField.js +14 -0
  29. package/dist/ui-kit/FormField/Fields/RetailRegionField.js.map +1 -0
  30. package/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  31. package/dist/ui-kit/FormField/getField.js +4 -1
  32. package/dist/ui-kit/FormField/getField.js.map +1 -1
  33. package/dist/ui-kit/FormField/getObjectValidator.js +8 -6
  34. package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  35. package/dist/ui-kit/FormField/validators.d.ts +1 -1
  36. package/dist/ui-kit/FormField/validators.js +6 -5
  37. package/dist/ui-kit/FormField/validators.js.map +1 -1
  38. package/dist/ui-kit/VerifyPhoneDialog/handleSendCode.js +7 -3
  39. package/dist/ui-kit/VerifyPhoneDialog/handleSendCode.js.map +1 -1
  40. package/dist/ui-kit/YandexMap/YandexMap.d.ts +1 -0
  41. package/dist/ui-kit/YandexMap/YandexMap.js +12 -2
  42. package/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
  43. package/lib/components/CreditForm/creditFormStepsData.js +2 -2
  44. package/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
  45. package/lib/components/CreditForm/getInitialFormState.d.ts +2 -2
  46. package/lib/components/CreditForm/getInitialFormState.js +2 -2
  47. package/lib/components/CreditForm/getInitialFormState.js.map +1 -1
  48. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +9 -22
  49. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  50. package/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.d.ts +20 -0
  51. package/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.js +28 -0
  52. package/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.js.map +1 -0
  53. package/lib/hooks/useRegions.d.ts +2 -0
  54. package/lib/hooks/useRegions.js.map +1 -1
  55. package/lib/ui-kit/FormField/Fields/RetailAddressField.d.ts +2 -0
  56. package/lib/ui-kit/FormField/Fields/RetailAddressField.js +36 -0
  57. package/lib/ui-kit/FormField/Fields/RetailAddressField.js.map +1 -0
  58. package/lib/ui-kit/FormField/Fields/RetailRegionField.d.ts +2 -0
  59. package/lib/ui-kit/FormField/Fields/RetailRegionField.js +12 -0
  60. package/lib/ui-kit/FormField/Fields/RetailRegionField.js.map +1 -0
  61. package/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  62. package/lib/ui-kit/FormField/getField.js +4 -1
  63. package/lib/ui-kit/FormField/getField.js.map +1 -1
  64. package/lib/ui-kit/FormField/getObjectValidator.js +8 -6
  65. package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  66. package/lib/ui-kit/FormField/validators.d.ts +1 -1
  67. package/lib/ui-kit/FormField/validators.js +5 -5
  68. package/lib/ui-kit/FormField/validators.js.map +1 -1
  69. package/lib/ui-kit/VerifyPhoneDialog/handleSendCode.js +7 -3
  70. package/lib/ui-kit/VerifyPhoneDialog/handleSendCode.js.map +1 -1
  71. package/lib/ui-kit/YandexMap/YandexMap.d.ts +1 -0
  72. package/lib/ui-kit/YandexMap/YandexMap.js +12 -2
  73. package/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
  74. package/mobile/bundle/bundle.umd.js +1079 -1020
  75. package/mobile/bundle/bundle.umd.min.js +1 -1
  76. package/mobile/bundle/components/CreditForm/getInitialFormState.d.ts +2 -2
  77. package/mobile/bundle/components/OfficesAtmsMap/useOfficesAtmsMapData.d.ts +20 -0
  78. package/mobile/bundle/hooks/useRegions.d.ts +2 -0
  79. package/mobile/bundle/ui-kit/FormField/Fields/RetailAddressField.d.ts +2 -0
  80. package/mobile/bundle/ui-kit/FormField/Fields/RetailRegionField.d.ts +2 -0
  81. package/mobile/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  82. package/mobile/bundle/ui-kit/FormField/validators.d.ts +1 -1
  83. package/mobile/bundle/ui-kit/YandexMap/YandexMap.d.ts +1 -0
  84. package/mobile/dist/components/CreditForm/creditFormStepsData.js +2 -2
  85. package/mobile/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
  86. package/mobile/dist/components/CreditForm/getInitialFormState.d.ts +2 -2
  87. package/mobile/dist/components/CreditForm/getInitialFormState.js +2 -2
  88. package/mobile/dist/components/CreditForm/getInitialFormState.js.map +1 -1
  89. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +8 -21
  90. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  91. package/mobile/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.d.ts +20 -0
  92. package/mobile/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.js +31 -0
  93. package/mobile/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.js.map +1 -0
  94. package/mobile/dist/hooks/useRegions.d.ts +2 -0
  95. package/mobile/dist/hooks/useRegions.js.map +1 -1
  96. package/mobile/dist/ui-kit/FormField/Fields/RetailAddressField.d.ts +2 -0
  97. package/mobile/dist/ui-kit/FormField/Fields/RetailAddressField.js +38 -0
  98. package/mobile/dist/ui-kit/FormField/Fields/RetailAddressField.js.map +1 -0
  99. package/mobile/dist/ui-kit/FormField/Fields/RetailRegionField.d.ts +2 -0
  100. package/mobile/dist/ui-kit/FormField/Fields/RetailRegionField.js +14 -0
  101. package/mobile/dist/ui-kit/FormField/Fields/RetailRegionField.js.map +1 -0
  102. package/mobile/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  103. package/mobile/dist/ui-kit/FormField/getField.js +4 -1
  104. package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
  105. package/mobile/dist/ui-kit/FormField/getObjectValidator.js +8 -6
  106. package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  107. package/mobile/dist/ui-kit/FormField/validators.d.ts +1 -1
  108. package/mobile/dist/ui-kit/FormField/validators.js +6 -5
  109. package/mobile/dist/ui-kit/FormField/validators.js.map +1 -1
  110. package/mobile/dist/ui-kit/VerifyPhoneDialog/handleSendCode.js +7 -3
  111. package/mobile/dist/ui-kit/VerifyPhoneDialog/handleSendCode.js.map +1 -1
  112. package/mobile/dist/ui-kit/YandexMap/YandexMap.d.ts +1 -0
  113. package/mobile/dist/ui-kit/YandexMap/YandexMap.js +12 -2
  114. package/mobile/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
  115. package/mobile/lib/components/CreditForm/creditFormStepsData.js +2 -2
  116. package/mobile/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
  117. package/mobile/lib/components/CreditForm/getInitialFormState.d.ts +2 -2
  118. package/mobile/lib/components/CreditForm/getInitialFormState.js +2 -2
  119. package/mobile/lib/components/CreditForm/getInitialFormState.js.map +1 -1
  120. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +9 -22
  121. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  122. package/mobile/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.d.ts +20 -0
  123. package/mobile/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.js +28 -0
  124. package/mobile/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.js.map +1 -0
  125. package/mobile/lib/hooks/useRegions.d.ts +2 -0
  126. package/mobile/lib/hooks/useRegions.js.map +1 -1
  127. package/mobile/lib/ui-kit/FormField/Fields/RetailAddressField.d.ts +2 -0
  128. package/mobile/lib/ui-kit/FormField/Fields/RetailAddressField.js +36 -0
  129. package/mobile/lib/ui-kit/FormField/Fields/RetailAddressField.js.map +1 -0
  130. package/mobile/lib/ui-kit/FormField/Fields/RetailRegionField.d.ts +2 -0
  131. package/mobile/lib/ui-kit/FormField/Fields/RetailRegionField.js +12 -0
  132. package/mobile/lib/ui-kit/FormField/Fields/RetailRegionField.js.map +1 -0
  133. package/mobile/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  134. package/mobile/lib/ui-kit/FormField/getField.js +4 -1
  135. package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
  136. package/mobile/lib/ui-kit/FormField/getObjectValidator.js +8 -6
  137. package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  138. package/mobile/lib/ui-kit/FormField/validators.d.ts +1 -1
  139. package/mobile/lib/ui-kit/FormField/validators.js +5 -5
  140. package/mobile/lib/ui-kit/FormField/validators.js.map +1 -1
  141. package/mobile/lib/ui-kit/VerifyPhoneDialog/handleSendCode.js +7 -3
  142. package/mobile/lib/ui-kit/VerifyPhoneDialog/handleSendCode.js.map +1 -1
  143. package/mobile/lib/ui-kit/YandexMap/YandexMap.d.ts +1 -0
  144. package/mobile/lib/ui-kit/YandexMap/YandexMap.js +12 -2
  145. package/mobile/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
  146. package/mobile/src/components/CreditForm/creditFormStepsData.tsx +2 -2
  147. package/mobile/src/components/CreditForm/getInitialFormState.tsx +4 -4
  148. package/mobile/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +9 -25
  149. package/mobile/src/components/OfficesAtmsMap/useOfficesAtmsMapData.tsx +49 -0
  150. package/mobile/src/hooks/useRegions.ts +2 -0
  151. package/mobile/src/ui-kit/FormField/Fields/RetailAddressField.tsx +66 -0
  152. package/mobile/src/ui-kit/FormField/Fields/RetailRegionField.tsx +24 -0
  153. package/mobile/src/ui-kit/FormField/NameFieldDef.ts +3 -1
  154. package/mobile/src/ui-kit/FormField/getField.tsx +4 -1
  155. package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +8 -6
  156. package/mobile/src/ui-kit/FormField/validators.ts +6 -6
  157. package/mobile/src/ui-kit/VerifyPhoneDialog/handleSendCode.ts +9 -3
  158. package/mobile/src/ui-kit/YandexMap/YandexMap.tsx +59 -45
  159. package/package.json +1 -1
  160. package/src/components/CreditForm/creditFormStepsData.tsx +2 -2
  161. package/src/components/CreditForm/getInitialFormState.tsx +4 -4
  162. package/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +9 -25
  163. package/src/components/OfficesAtmsMap/useOfficesAtmsMapData.tsx +49 -0
  164. package/src/hooks/useRegions.ts +2 -0
  165. package/src/ui-kit/FormField/Fields/RetailAddressField.tsx +66 -0
  166. package/src/ui-kit/FormField/Fields/RetailRegionField.tsx +24 -0
  167. package/src/ui-kit/FormField/NameFieldDef.ts +3 -1
  168. package/src/ui-kit/FormField/getField.tsx +4 -1
  169. package/src/ui-kit/FormField/getObjectValidator.tsx +8 -6
  170. package/src/ui-kit/FormField/validators.ts +6 -6
  171. package/src/ui-kit/VerifyPhoneDialog/handleSendCode.ts +9 -3
  172. package/src/ui-kit/YandexMap/YandexMap.tsx +59 -45
@@ -1410,11 +1410,11 @@
1410
1410
  const required = validator((_) => _ !== null && _ !== undefined && _ !== '');
1411
1411
 
1412
1412
  const ERROR_MESSAGE = 'Некорректно заполненное поле';
1413
- const defaultValidator = (errorMsg) => required(errorMsg ? errorMsg : ERROR_MESSAGE);
1414
- const defaultSelectValidator = validator((_) => _?.key && _?.key !== '')(ERROR_MESSAGE);
1415
- const jobNumberValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length > 0 && _.length <= 2)(errorMsg ? errorMsg : ERROR_MESSAGE);
1416
- const nameValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length > 1)(errorMsg ? errorMsg : ERROR_MESSAGE);
1417
- const lengthStringValidator = (maxLength, errorMsg) => validator((_) => typeof _ === 'string' && _.length >= 1 && _.length <= maxLength)(errorMsg ? errorMsg : ERROR_MESSAGE);
1413
+ const defaultValidator = (errorMsg) => required(errorMsg ?? ERROR_MESSAGE);
1414
+ const defaultSelectValidator = (errorMsg) => validator((_) => _?.key && _?.key !== '')(errorMsg ?? ERROR_MESSAGE);
1415
+ const jobNumberValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length > 0 && _.length <= 2)(errorMsg ?? ERROR_MESSAGE);
1416
+ const nameValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length > 1)(errorMsg ?? ERROR_MESSAGE);
1417
+ const lengthStringValidator = (maxLength, errorMsg) => validator((_) => typeof _ === 'string' && _.length >= 1 && _.length <= maxLength)(errorMsg ?? ERROR_MESSAGE);
1418
1418
  const serieValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length === 4)(errorMsg);
1419
1419
  const numberValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length === 6)(errorMsg);
1420
1420
  const innValidator = (errorMsg) => validator((_) => typeof _ === 'string' && (_.length === 10 || _.length === 12))(errorMsg);
@@ -1446,8 +1446,8 @@
1446
1446
  surname: nameValidator('Укажите свою фамилию'),
1447
1447
  name: nameValidator('Укажите своё имя'),
1448
1448
  middleName: nameValidator('Укажите своё отчество'),
1449
- region: defaultSelectValidator,
1450
- addressBranch: defaultSelectValidator,
1449
+ region: defaultSelectValidator(),
1450
+ addressBranch: defaultSelectValidator(),
1451
1451
  phone: phoneValidator('Укажите номер телефона'),
1452
1452
  secondaryPhone: phoneValidator('Укажите номер телефона'),
1453
1453
  birthday: defaultValidator('Укажите дату рождения'),
@@ -1479,10 +1479,10 @@
1479
1479
  partnerComments: defaultValidator(),
1480
1480
  collectionCount: defaultValidator(),
1481
1481
  comment: defaultValidator(),
1482
- acquiringType: defaultSelectValidator,
1483
- feedbackMethod: defaultSelectValidator,
1484
- serviceType: defaultSelectValidator,
1485
- serviceDirection: defaultSelectValidator,
1482
+ acquiringType: defaultSelectValidator(),
1483
+ feedbackMethod: defaultSelectValidator(),
1484
+ serviceType: defaultSelectValidator(),
1485
+ serviceDirection: defaultSelectValidator(),
1486
1486
  meetingDay: defaultValidator(),
1487
1487
  product: defaultValidator(),
1488
1488
  localities: defaultValidator(),
@@ -1516,6 +1516,8 @@
1516
1516
  legalEntityName: defaultValidator(),
1517
1517
  bankEmployeeCode: defaultValidator(),
1518
1518
  partInBusiness: defaultValidator(),
1519
+ regionRetail: defaultSelectValidator('Выберите филиал банка'),
1520
+ addressRetail: defaultSelectValidator('Выберите адрес банка'),
1519
1521
  };
1520
1522
  const getObjectValidator = (inputs) => {
1521
1523
  const requiredInputs = getNamesFromInput(inputs.filter((_) => Boolean(_?.required)));
@@ -2403,68 +2405,728 @@
2403
2405
  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, ...getValidation(field('region'), validatorObj.region, input?.required) }));
2404
2406
  });
2405
2407
 
2406
- const RetirementIncomeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041F\u0435\u043D\u0441\u0438\u043E\u043D\u043D\u044B\u0435 \u0434\u043E\u0445\u043E\u0434\u044B", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", ...getValidation(field('retirementIncome'), validatorObj.retirementIncome, input?.required), ...input })));
2408
+ const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
2409
+ const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
2410
+ const onToggle = useCallback(() => {
2411
+ setIsUnfolded((_) => !_);
2412
+ }, []);
2413
+ const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
2414
+ const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
2415
+ return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
2416
+ });
2407
2417
 
2408
- const SecondaryPhoneField = JSX(({ field }) => {
2409
- const fieldPhone = field('secondaryPhone');
2410
- return (jsx(InputPhoneControl, { label: "\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0439 \u0442\u0435\u043B\u0435\u0444\u043E\u043D", ...(!fieldPhone.value || fieldPhone.value === '+7 ('
2411
- ? fieldPhone
2412
- : withValidator(fieldPhone, validatorObj.secondaryPhone)) }));
2418
+ function useResizeObserver(callback, deps) {
2419
+ const ref = useRef(null);
2420
+ useEffect(() => {
2421
+ const element = ref?.current;
2422
+ if (!element) {
2423
+ return undefined;
2424
+ }
2425
+ const observer = new ResizeObserver((entries) => {
2426
+ callback(element, entries[0]);
2427
+ });
2428
+ observer.observe(element);
2429
+ return () => {
2430
+ observer.disconnect();
2431
+ };
2432
+ }, [callback, ...deps]);
2433
+ return ref;
2434
+ }
2435
+
2436
+ const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
2437
+ const containerRef = useRef(null);
2438
+ const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
2439
+ if (containerRef.current) {
2440
+ containerRef.current.style.maxHeight = isUnfolded
2441
+ ? `${childrenWrapperEl.scrollHeight}px`
2442
+ : '';
2443
+ }
2444
+ }, [isUnfolded]);
2445
+ return (jsx("div", { ref: containerRef, className: `transition-max-h duration-300 overflow-hidden ${containerRef.current || !isUnfolded ? 'max-h-0' : ''} `, children: jsx("div", { className: className, ref: childrenWrapperRef, children: children }) }));
2413
2446
  });
2414
2447
 
2415
- const ServiceDirectionField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u041D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u044F", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435", options: SERVICE_DIRECTIONS, ...getValidation(field('serviceDirection'), validatorObj.serviceDirection, input?.required) })));
2448
+ const CardCell = JSX(({ value, subText, children, isPhone, ...props }) => {
2449
+ const textItems = (Array.isArray(value) ? value : value?.split(',') ?? []).filter(Boolean);
2450
+ if ([textItems.length, children, subText].every((_) => !_)) {
2451
+ return null;
2452
+ }
2453
+ return renderCardCell({ textItems, subText, children, isPhone, ...props });
2454
+ });
2455
+ const renderCardCell = ({ label, labelSize = 'text-m', textItems, subColor, subText, className, children, isPhone = false, }) => (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 || renderTextItems(textItems, isPhone), subText ? (jsx(Text, { color: subColor, size: "text-m", children: subText })) : null] }));
2456
+ const renderTextItems = (textItems, isPhone) => textItems.filter(Boolean).map((text, i) => (jsx(Text, { size: "text-l", children: isPhone ? jsx("a", { href: `tel:${cleanPhoneNumber(text)}`, children: text.trim() }) : text.trim() }, String(i))));
2457
+ const cleanPhoneNumber = (phone) => phone.replace(/\D/g, '');
2416
2458
 
2417
- const orientationStyleMap = {
2418
- horizontal: '@lg:flex-row',
2419
- vertical: '',
2420
- };
2421
- const RadioButtonGroup = JSX(({ label, items, value, className, onChange: onChangeCheckedItem, disabled = false, orientation = 'horizontal', }) => (jsxs("div", { className: "grid gap-xs whitespace-nowrap", children: [label ? (jsx("div", { role: "radiogroup", "aria-label": label, children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: label }) })) : null, jsx("div", { className: style('flex flex-col gap-s', orientationStyleMap[orientation], className), role: "radiogroup", "aria-label": "\u0413\u0440\u0443\u043F\u043F\u0430 \u043A\u043D\u043E\u043F\u043E\u043A", children: items?.map(({ id, text }) => (jsx(Checkbox, { isRadio: true, text: text, value: value === id, onChange: () => onChangeCheckedItem && onChangeCheckedItem(id), disabled: disabled }, String(id)))) })] })));
2459
+ const CardRow = JSX(({ className, children }) => (jsx("div", { className: style('flex flex-col sm:flex-row sm:border-t sm:border-solid sm:border-main-divider py-xl gap-x-6xl gap-y-xl', className), children: children })));
2422
2460
 
2423
- const RadioButtonGroupControl = JSX(({ className, label, onChange, error, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(RadioButtonGroup, { label: getRequiredLabel({ label, errors: rest?.errors }), onChange: (_) => onChange && onChange(_), ...rest }), renderErrorText(error)] })));
2461
+ const getScheduleDescription = (workScheduleWeek) => {
2462
+ const rows = getDateDescription(workScheduleWeek);
2463
+ return jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", value: rows, className: "max-w-none" });
2464
+ };
2465
+ const buildScheduleText = ({ workTime = '', lunchHour = '', daysOff = '' }, isSaturday = false) => {
2466
+ if (!workTime) {
2467
+ return '';
2468
+ }
2469
+ return [
2470
+ `${isSaturday ? 'Суббота' : 'Будние дни'}: ${workTime}`,
2471
+ lunchHour ? `перерыв: ${lunchHour}` : '',
2472
+ daysOff ? `не работает: ${daysOff}` : '',
2473
+ ]
2474
+ .filter(Boolean)
2475
+ .join('; ');
2476
+ };
2477
+ const getDateDescription = (workScheduleWeek) => {
2478
+ const workingWeekday = workScheduleWeek.find((_) => _.key !== 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
2479
+ const workingSaturday = workScheduleWeek.find((_) => _.key === 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
2480
+ const daysOff = workScheduleWeek
2481
+ .filter((_) => !_.status)
2482
+ .map((_) => _.short?.toLowerCase())
2483
+ .join(', ');
2484
+ const rows = [
2485
+ buildScheduleText({
2486
+ workTime: workingWeekday?.workTime,
2487
+ lunchHour: workingWeekday?.lunchHour,
2488
+ daysOff: workingSaturday ? '' : daysOff,
2489
+ }),
2490
+ buildScheduleText({ workTime: workingSaturday?.workTime, lunchHour: workingSaturday?.lunchHour, daysOff }, true),
2491
+ ].filter(Boolean);
2492
+ return rows;
2493
+ };
2424
2494
 
2425
- const SEX_TYPES = [
2426
- { id: 'male', text: 'Мужской' },
2427
- { id: 'female', text: 'Женский' },
2495
+ const WEEKDAY_MAP = [
2496
+ ['workingMonday', 'Пн', 'Понедельник'],
2497
+ ['workingTuesday', 'Вт', 'Вторник'],
2498
+ ['workingWednesday', 'Ср', 'Среда'],
2499
+ ['workingThursday', 'Чт', 'Четверг'],
2500
+ ['workingFriday', 'Пт', 'Пятница'],
2501
+ ['workingSaturday', 'Сб', 'Суббота'],
2502
+ ['workingSunday', 'Вс', 'Воскресенье'],
2428
2503
  ];
2429
- const SexField = JSX(({ field, input }) => (jsx(RadioButtonGroupControl, { label: "\u041F\u043E\u043B", orientation: "horizontal", items: SEX_TYPES, ...getValidation(field('sex'), validatorObj.sex, input?.required) })));
2504
+ const getWorkScheduleWeek = (workSchedule) => WEEKDAY_MAP.map(([key, short, title]) => ({
2505
+ key,
2506
+ title,
2507
+ short,
2508
+ status: Boolean(workSchedule?.[key]),
2509
+ get workTime() {
2510
+ return key === 'workingSaturday' ? workSchedule?.workTimeSaturday : workSchedule?.workTime;
2511
+ },
2512
+ get lunchHour() {
2513
+ return key === 'workingSaturday' ? workSchedule?.lunchHourSaturday : workSchedule?.lunchHour;
2514
+ },
2515
+ get hasLunch() {
2516
+ return /\d+/.test(this.lunchHour ?? '');
2517
+ },
2518
+ }));
2430
2519
 
2431
- const ShareholderFlgField = JSX(({ field }) => (jsx(CheckboxWithError, { text: "\u042F \u044F\u0432\u043B\u044F\u044E\u0441\u044C \u0430\u043A\u0446\u0438\u043E\u043D\u0435\u0440\u043E\u043C / \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u043E\u043C / \u0447\u043B\u0435\u043D\u043E\u043C / \u043F\u0430\u0439\u0449\u0438\u043A\u043E\u043C / \u0432\u043A\u043B\u0430\u0434\u0447\u0438\u043A\u043E\u043C \u0441 \u0434\u043E\u043B\u0435\u0439 \u0443\u0447\u0430\u0441\u0442\u0438\u044F \u0431\u043E\u043B\u0435\u0435 20% \u0443\u0441\u0442\u0430\u0432\u043D\u043E\u0433\u043E \u043A\u0430\u043F\u0438\u0442\u0430\u043B\u0430 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043B\u0438\u0446\u0430", ...getValidation(field('shareholderFlg'), validatorObj.shareholderFlg) })));
2520
+ const renderBusinessSchedule = (scheduleDescription) => {
2521
+ if (!scheduleDescription) {
2522
+ return null;
2523
+ }
2524
+ const businessSchedule = getBusinessSchedule(scheduleDescription);
2525
+ 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 }) })] }));
2526
+ };
2527
+ const getBusinessSchedule = (scheduleDescription) => {
2528
+ const weekDayMap = WEEKDAY_MAP.map(([, short]) => ({ short, status: true }));
2529
+ const splittedScheduleDescription = scheduleDescription.split('/') ?? [];
2530
+ const lastPartScheduleDescription = splittedScheduleDescription[splittedScheduleDescription.length - 1]?.toLowerCase();
2531
+ if (!lastPartScheduleDescription?.includes('выходной')) {
2532
+ return weekDayMap;
2533
+ }
2534
+ return weekDayMap.map((_) => ({
2535
+ ..._,
2536
+ status: !lastPartScheduleDescription?.includes(_.short.toLowerCase()),
2537
+ }));
2538
+ };
2539
+ const renderAlternativeDay = ({ short, status }, i) => (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(i)));
2432
2540
 
2433
- const SnilsInput = JSX(({ children, onChange, ...inputProps }) => {
2434
- const handleChange = useCallback((v) => onChange && onChange(normalizeWithMask(v, '___-___-___ __')), [onChange]);
2435
- const handleBlur = useCallback((v) => {
2436
- if (v === '___-___-___ __') {
2437
- onChange && onChange('');
2438
- }
2439
- }, []);
2440
- return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
2441
- });
2541
+ 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)));
2442
2542
 
2443
- const InputSnilsControl = JSX(({ className, label, value, error, onChange, onBlur, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(SnilsInput, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), value: value, onChange: onChange, onBlur: onBlur, placeholder: "___-___-___ __" }), renderErrorText(error)] })));
2543
+ const colorStyle = {
2544
+ yellow: { border: 'border-yellow-light', text: 'text-yellow' },
2545
+ green: { border: 'border-green-more-light', text: 'text-green-dark' },
2546
+ gray: { border: 'border-gray', text: 'text-secondary-text' },
2547
+ red: { border: 'border-error/30', text: 'text-error' },
2548
+ };
2549
+ const Badge$1 = JSX(({ className, children, color = 'gray' }) => (jsxs("div", { className: style('sm:p-s sm:border sm:border-green rounded-md flex items-center h-fit', colorStyle[color].border, className), children: [jsx("div", { className: "block pr-m sm:pr-0 sm:hidden", children: jsx(Img, { image: { icon: 'SmallClockIcon' }, width: "24", height: "24" }) }), jsx(Text, { size: "text-m", color: colorStyle[color].text, children: children })] })));
2444
2550
 
2445
- const SnilsField = JSX(({ field, input }) => (jsx(InputSnilsControl, { label: "\u0421\u041D\u0418\u041B\u0421", ...getValidation(field('snils'), validatorObj.snils, input?.required), ...input })));
2551
+ const currentWeekDayIdx = new Date().getDay();
2552
+ //TODO: Add logic time https://github.com/redneckz/wildless-cms-uni-blocks/pull/1549
2553
+ const renderCurrentDaySchedule = (workScheduleWeek) => {
2554
+ const [currentWeekDay] = workScheduleWeek?.slice(currentWeekDayIdx - 1) ?? [];
2555
+ if (!currentWeekDay) {
2556
+ return null;
2557
+ }
2558
+ const { lunchHour, status, workTime, hasLunch } = currentWeekDay;
2559
+ return status ? (jsxs("div", { className: "flex gap-s items-start whitespace-nowrap", children: [workTime ? jsx(Badge$1, { color: "green", children: workTime }) : null, lunchHour && hasLunch ? jsx(Badge$1, { color: "yellow", children: `перерыв: ${lunchHour}` }) : null] })) : (jsx(Badge$1, { color: "red", children: "\u0412\u044B\u0445\u043E\u0434\u043D\u043E\u0439" }));
2560
+ };
2446
2561
 
2447
- const SurnameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0430\u043C\u0438\u043B\u0438\u044F", ...getValidation(field('surname'), validatorObj.surname, input?.required), ...input })));
2562
+ const getSubTextLunch = ({ lunchHour, hasLunch = false, status = false }) => {
2563
+ if (!status) {
2564
+ return 'Не работает';
2565
+ }
2566
+ return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
2567
+ };
2568
+ const renderDay = ({ title, status, workTime, lunchHour, hasLunch }, i) => (jsx(CardCell, { label: title, value: status && workTime ? workTime : '', subText: getSubTextLunch({ lunchHour, hasLunch, status }), subColor: !status || hasLunch ? 'text-error' : 'text-green-dark' }, String(i)));
2448
2569
 
2449
- const MIN_CREDIT_TERM = 1;
2450
- const MAX_CREDIT_TERM = 180;
2451
- const ITEMS_CREDIT_TERM = ['От 1 мес', 'До 15 лет'];
2452
- const TermField = JSX(({ field }) => (jsx(InputRange, { title: "\u0421\u0440\u043E\u043A, \u043C\u0435\u0441\u044F\u0446\u0435\u0432", items: ITEMS_CREDIT_TERM, min: MIN_CREDIT_TERM, max: MAX_CREDIT_TERM, ...field('term') })));
2570
+ const ICONS$1 = ['ArrowDownIcon', 'ArrowUpIcon'];
2571
+ const labels = ['Подробнее', 'Скрыть'];
2572
+ const renderFoldButton$3 = ({ isUnfolded, onToggle }) => (jsxs("button", { className: "w-full py-2xl cursor-pointer text-primary-main flex items-center border-b border-solid border-main-divider", onClick: onToggle, type: "button", children: [jsx("div", { className: "pr-m", children: labels[Number(isUnfolded)] }), jsx(Icon, { className: "text-primary-text", name: ICONS$1[Number(isUnfolded)], width: "16", height: "16" })] }));
2453
2573
 
2454
- const TotalIncomeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u043E\u0432\u043E\u043A\u0443\u043F\u043D\u044B\u0439 \u043E\u0444\u0438\u0446\u0438\u0430\u043B\u044C\u043D\u044B\u0439 \u0434\u043E\u0445\u043E\u0434 \u0432 \u043C\u0435\u0441\u044F\u0446 \u043F\u043E\u0441\u043B\u0435 \u0432\u044B\u0447\u0435\u0442\u0430 \u043D\u0430\u043B\u043E\u0433\u043E\u0432 (\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430, \u043F\u0440\u0435\u043C\u0438\u0438)", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", ...getValidation(field('totalIncome'), validatorObj.totalIncome, input?.required), ...input })));
2574
+ const renderWorkSchedule = (workSchedule) => {
2575
+ const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2576
+ const timeOfWork = workSchedule ? getDateDescription(workScheduleWeek) : '';
2577
+ const businessTimeOfWork = workSchedule ? workSchedule.businessScheduleDescription : '';
2578
+ if (!workSchedule) {
2579
+ return null;
2580
+ }
2581
+ if (!workSchedule.businessScheduleVisibleTag) {
2582
+ return renderMatchingTimeOfWork(timeOfWork);
2583
+ }
2584
+ if (workSchedule.businessScheduleVisibleTag &&
2585
+ workSchedule.businessScheduleDescription === null) {
2586
+ return renderIndividualTimeOfWork(timeOfWork);
2587
+ }
2588
+ return renderDefaultTimeOfWork(timeOfWork, businessTimeOfWork);
2589
+ };
2590
+ const renderIndividualTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p>`;
2591
+ const renderMatchingTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ. и юр. лиц:<br/></b> ${timeOfWork}</p>`;
2592
+ const renderDefaultTimeOfWork = (timeOfWork, businessTimeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${businessTimeOfWork}</p>`;
2455
2593
 
2456
- const UltraPremiumField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u0422\u0438\u043F \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u044F", options: SERVICE_TYPES, ...getValidation(field('serviceType'), validatorObj.serviceType, input?.required) })));
2594
+ const renderOfficeCard = ({ name, address, phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }, i) => {
2595
+ if (!workSchedule) {
2596
+ return null;
2597
+ }
2598
+ const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2599
+ return (jsxs("div", { className: "bg-white col-span-12 p-3xl sm:border-green sm:border", children: [jsxs("div", { className: "sm:flex sm:justify-between", children: [jsxs("div", { children: [jsx(Text, { size: "text-h4", children: name }), 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] }), renderCurrentDaySchedule(workScheduleWeek)] }), jsx("div", { className: "hidden sm:block", children: renderCardContent$1({
2600
+ phone,
2601
+ fax,
2602
+ phoneBusiness,
2603
+ phoneNatural,
2604
+ phoneCallCentre,
2605
+ phoneCurrencyControl,
2606
+ workSchedule,
2607
+ exchangeRate,
2608
+ }) }), jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
2609
+ return (jsx(FoldableSection, { isUnfolded: isUnfolded, children: renderCardContent$1({
2610
+ phone,
2611
+ fax,
2612
+ phoneBusiness,
2613
+ phoneNatural,
2614
+ phoneCallCentre,
2615
+ phoneCurrencyControl,
2616
+ workSchedule,
2617
+ exchangeRate,
2618
+ }) }));
2619
+ },
2620
+ //** TODO: remove styles with refactoring DefaultFoldButton*/
2621
+ renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$3({ isUnfolded, onToggle }) })] }, String(i)));
2622
+ };
2623
+ const renderCardContent$1 = ({ phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }) => {
2624
+ const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2625
+ const labelSchedule = workSchedule?.businessScheduleVisibleTag
2626
+ ? 'Для физических лиц'
2627
+ : 'Для физических и юридических лиц';
2628
+ return (jsxs("div", { children: [jsxs(CardRow, { className: "flex-wrap border-b border-solid border-main-divider", children: [jsx(CardCell, { label: "\u0424\u0430\u043A\u0441", value: fax, isPhone: true }), jsx(CardCell, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D \u0444\u0438\u043B\u0438\u0430\u043B\u0430", value: phone, isPhone: true }), 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, isPhone: true }), 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, isPhone: true }), 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, isPhone: true }), jsx(CardCell, { label: "\u041A\u043E\u043D\u0442\u0430\u043A\u0442-\u0446\u0435\u043D\u0442\u0440", value: phoneCallCentre, isPhone: true })] }), 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
2629
+ ? renderBusinessSchedule(workSchedule?.businessScheduleDescription)
2630
+ : null, exchangeRate?.currencies?.length ? (jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }));
2631
+ };
2632
+ const capitalizedFirstLetter$1 = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
2633
+ const getOfficePoint = ({ name = '', address = '', workSchedule }) => {
2634
+ const header = capitalizedFirstLetter$1(name);
2635
+ const body = `${address} ${renderWorkSchedule(workSchedule)}`;
2636
+ return { header, body };
2637
+ };
2457
2638
 
2458
- const VED_TYPES = [
2459
- { id: 'currencyControl', text: 'Валютный контроль' },
2460
- { id: 'documentOperations', text: 'Документарные операции' },
2461
- { id: 'conversionTransactions', text: 'Конверсионные операции' },
2462
- { id: 'otherIssues', text: 'Иные вопросы ВЭД' },
2463
- ];
2464
- const VedField = JSX(({ field }) => {
2465
- const { value, onChange } = field('vedTypes');
2466
- useEffect(() => {
2467
- if (value !== 'currencyControl') {
2639
+ const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
2640
+
2641
+ const isClient = !isSSR();
2642
+ const ClientOnly = JSX(({ children }) => (isClient ? children : null));
2643
+
2644
+ const Loader = JSX(({ color = 'text-primary-main', position = 'absolute', blur = true }) => (jsx("div", { className: style('flex justify-center items-center h-full w-full z-50', position, {
2645
+ 'backdrop-blur': blur,
2646
+ }), children: jsx("div", { className: style('inline-block h-28 w-28', 'animate-spin rounded-full', 'border-8 border-solid border-current', 'border-r-transparent', color), role: "status" }) })));
2647
+
2648
+ const MapMarkerClusterIcon = '/icons/MapMarkerClusterIcon.svg';
2649
+ const MapMarkerClusterYellowIcon = '/icons/MapMarkerClusterYellowIcon.svg';
2650
+ function renderClusterer({ yandexMaps, map, points, isLoad, }) {
2651
+ if (isLoad || !points) {
2652
+ return;
2653
+ }
2654
+ map.geoObjects.removeAll();
2655
+ if (!points.length) {
2656
+ return;
2657
+ }
2658
+ const clusterIconContentLayout = yandexMaps.templateLayoutFactory.createClass('<div style="margin-top: -3px;">{{properties.geoObjects.length}}</div>');
2659
+ const officeClusterer = defineClusterer('offices', yandexMaps, clusterIconContentLayout);
2660
+ if (points.length && points.every((_) => 'type' in _)) {
2661
+ const remoteWorkplaceClusterer = defineClusterer('workplaces', yandexMaps, clusterIconContentLayout);
2662
+ const remoteWorkplaceGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'workplaces'), 'workplaces', yandexMaps);
2663
+ const officesGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'offices'), 'offices', yandexMaps);
2664
+ officeClusterer.add(officesGeoObjects);
2665
+ remoteWorkplaceClusterer.add(remoteWorkplaceGeoObjects);
2666
+ map.geoObjects.add(remoteWorkplaceClusterer);
2667
+ map.geoObjects.add(officeClusterer);
2668
+ }
2669
+ else {
2670
+ const geoObjects = defineGeoObjects(points, 'offices', yandexMaps);
2671
+ officeClusterer.add(geoObjects);
2672
+ map.geoObjects.add(officeClusterer);
2673
+ }
2674
+ map.setBounds(yandexMaps.util.bounds.fromPoints(points.map((_) => _.coords))).then(() => {
2675
+ if (map.getZoom() > 10) {
2676
+ map.setZoom(10);
2677
+ }
2678
+ });
2679
+ }
2680
+ const defineClusterer = (type, yandexMaps, clusterIconContentLayout) => {
2681
+ return new yandexMaps.Clusterer({
2682
+ clusterIcons: [
2683
+ {
2684
+ href: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
2685
+ size: [78, 84],
2686
+ offset: [-35, -50],
2687
+ },
2688
+ ],
2689
+ clusterIconContentLayout,
2690
+ clusterHideIconOnBalloonOpen: false,
2691
+ geoObjectHideIconOnBalloonOpen: false,
2692
+ });
2693
+ };
2694
+ const defineGeoObjects = (pointArr, type, yandexMaps) => {
2695
+ return pointArr.map(({ coords, content }) => new yandexMaps.Placemark(coords, {
2696
+ balloonContentHeader: content?.header,
2697
+ balloonContentBody: content?.body,
2698
+ balloonContentFooter: content?.footer,
2699
+ hintContent: content?.hint,
2700
+ }, {
2701
+ iconLayout: 'default#image',
2702
+ iconImageHref: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
2703
+ iconImageSize: [78, 84],
2704
+ iconImageOffset: [-35, -50],
2705
+ }));
2706
+ };
2707
+
2708
+ const defaultStyle = {
2709
+ focus: 'focus:border-primary-text focus:border',
2710
+ hover: 'hover:bg-primary-hover',
2711
+ active: 'active:bg-primary-active',
2712
+ font: 'text-center font-sans',
2713
+ };
2714
+
2715
+ const styles$1 = {
2716
+ ...defaultStyle,
2717
+ border: 'border border-transparent rounded-md',
2718
+ position: 'absolute flex items-center justify-center',
2719
+ };
2720
+ const renderUserGeolocation = (map, yandexMaps, className) => {
2721
+ const setUserGeoLocation = () => {
2722
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2723
+ // @ts-ignore
2724
+ yandexMaps.geolocation
2725
+ .get({
2726
+ provider: 'yandex',
2727
+ autoReverseGeocode: true,
2728
+ mapStateAutoApply: true,
2729
+ })
2730
+ .then(function (result) {
2731
+ map.current.geoObjects.add(result.geoObjects);
2732
+ });
2733
+ };
2734
+ return (jsx("div", { className: `select-none cursor-pointer py-m w-12 bg-white ${Object.values(styles$1).join(' ')} ${className}`, onClick: setUserGeoLocation, children: jsx(Icon, { name: "UserGeoLocationIcon", width: "20", height: "16" }) }));
2735
+ };
2736
+
2737
+ const getNS = (_) => globalThis[_];
2738
+ const initializeExternalNS = (namespaceName, url) => {
2739
+ const script = document.getElementById(url);
2740
+ if (script) {
2741
+ const ns = getNS(namespaceName);
2742
+ if (ns) {
2743
+ return Promise.resolve(ns);
2744
+ }
2745
+ else {
2746
+ return new Promise((resolve) => {
2747
+ script.addEventListener('load', () => {
2748
+ resolve(getNS(namespaceName));
2749
+ });
2750
+ });
2751
+ }
2752
+ }
2753
+ else {
2754
+ return new Promise((resolve, reject) => {
2755
+ const newScript = document.createElement('script');
2756
+ newScript.src = url;
2757
+ newScript.async = true;
2758
+ newScript.id = url;
2759
+ newScript.addEventListener('load', () => {
2760
+ resolve(getNS(namespaceName));
2761
+ });
2762
+ newScript.addEventListener('error', (error) => {
2763
+ reject(error);
2764
+ });
2765
+ document.head.appendChild(newScript);
2766
+ });
2767
+ }
2768
+ };
2769
+ function useExternalNS(namespaceName, url, unmountNS = true) {
2770
+ const [externalNS, setExternalNS] = useState(undefined);
2771
+ useEffect(() => {
2772
+ let isMounted = true;
2773
+ initializeExternalNS(namespaceName, url)
2774
+ .then((ns) => {
2775
+ if (isMounted) {
2776
+ setExternalNS(ns);
2777
+ }
2778
+ })
2779
+ .catch((error) => {
2780
+ console.error(`Failed to initialize external namespace: ${error}`);
2781
+ });
2782
+ return () => {
2783
+ isMounted = false;
2784
+ if (unmountNS) {
2785
+ const script = document.getElementById(url);
2786
+ if (script) {
2787
+ document.head.removeChild(script);
2788
+ }
2789
+ setExternalNS(undefined);
2790
+ }
2791
+ };
2792
+ }, [namespaceName, url, unmountNS]);
2793
+ return externalNS;
2794
+ }
2795
+
2796
+ const YMAPS_NAMESPACE = 'ymaps';
2797
+ const useYandexMaps = () => {
2798
+ const url = `https://api-maps.yandex.ru/2.1/?apikey=${projectSettings.YANDEX_MAP_API_KEY || ''}&lang=ru_RU`;
2799
+ return useExternalNS(YMAPS_NAMESPACE, url, false);
2800
+ };
2801
+
2802
+ const styles = {
2803
+ ...defaultStyle,
2804
+ border: 'border-b border-b-2 border-gray last:border-0',
2805
+ position: 'relative flex items-center justify-center',
2806
+ };
2807
+ // TODO: Добавить метод определения центральной точки
2808
+ const ZoomButton = JSX(({ yandexMaps, direction = 'in' }) => {
2809
+ const iconName = direction === 'in' ? 'PlusIcon' : 'MinusIcon';
2810
+ const changeZoom = () => {
2811
+ const currentZoom = yandexMaps.current.getZoom();
2812
+ const newZoom = direction === 'in' ? currentZoom + 1 : currentZoom - 1;
2813
+ yandexMaps.current.setZoom(newZoom, { checkZoomRange: true });
2814
+ };
2815
+ return (jsx("div", { onClick: changeZoom, className: `${Object.values(styles).join(' ')} bg-white select-none cursor-pointer w-12 h-12`, children: jsx(Icon, { name: iconName, width: "20", height: "16" }) }));
2816
+ });
2817
+
2818
+ const DEFAULT_CENTER_COORDS = [55.753995, 37.614069];
2819
+ // TODO: Поле для поиска: невыяснено среди каких данных делать поиск (искать в имени офиса, в адресе, метро и т.д.).
2820
+ // Сейчас реализован поиск среди тестовых данных
2821
+ // TODO: Также выяснить что делать когда ничего не найдено
2822
+ // TODO: На макетах также когда есть поле поиска нет кнопки открыть на карте.
2823
+ const YandexMap = JSX(({ points, className = '', zoom = 5, isLoad, selectedAddress }) => {
2824
+ const map = useRef(null);
2825
+ const yandexMaps = useYandexMaps();
2826
+ useEffect(() => {
2827
+ if (map.current) {
2828
+ renderClusterer({ yandexMaps, map: map.current, points, isLoad });
2829
+ }
2830
+ else {
2831
+ yandexMaps?.ready(() => {
2832
+ // Ready function may be called few times, but must be called once
2833
+ if (map.current) {
2834
+ renderClusterer({ yandexMaps, map: map.current, points, isLoad });
2835
+ return;
2836
+ }
2837
+ map.current = new yandexMaps.Map('map', {
2838
+ center: getCenterPoint(points),
2839
+ zoom,
2840
+ controls: [],
2841
+ suppressMapOpenBlock: true,
2842
+ });
2843
+ renderClusterer({ yandexMaps, map: map.current, points, isLoad });
2844
+ });
2845
+ }
2846
+ }, [yandexMaps, points, zoom, isLoad, selectedAddress]);
2847
+ useEffect(() => {
2848
+ if (map.current && selectedAddress) {
2849
+ yandexMaps?.geocode(selectedAddress).then((res) => {
2850
+ const firstGeoObject = res.geoObjects.get(0);
2851
+ const coords = firstGeoObject.geometry.getCoordinates();
2852
+ map.current.setCenter(coords);
2853
+ map.current.setZoom(18);
2854
+ });
2855
+ }
2856
+ }, [selectedAddress]);
2857
+ if (!yandexMaps) {
2858
+ return null;
2859
+ }
2860
+ const zIndex = 'z-10';
2861
+ return (jsxs("div", { id: "map", className: style('relative', 'w-full', className), children: [isLoad ? jsx(Loader, {}) : null, jsxs("div", { className: style('absolute right-2 top-52 z-10 w-12 overflow-hidden border border-transparent rounded-md', zIndex), children: [jsx(ZoomButton, { yandexMaps: map }), jsx(ZoomButton, { yandexMaps: map, direction: "out" })] }), renderUserGeolocation(map, yandexMaps, style('right-2 top-80', zIndex))] }));
2862
+ });
2863
+ const getCenterPoint = (points) => {
2864
+ const centerCoords = [
2865
+ getArraySumAndAverage(mapByIndex(points, 0)),
2866
+ getArraySumAndAverage(mapByIndex(points, 1)),
2867
+ ];
2868
+ return centerCoords.every((_) => _) ? centerCoords : DEFAULT_CENTER_COORDS;
2869
+ };
2870
+ const mapByIndex = (points, index) => points.map((_) => _.coords?.[index]);
2871
+ const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
2872
+
2873
+ const INITIAL_FILTRATION_STATE$1 = {
2874
+ workingSaturday: false,
2875
+ premiumService: false,
2876
+ privateBanking: false,
2877
+ remoteWorkplace: false,
2878
+ serviceDisabledPeople: false,
2879
+ sellingCoins: false,
2880
+ buyingCoins: false,
2881
+ bullionOperations: false,
2882
+ preciousMetalsOperations: false,
2883
+ transferringDataToBiometricSystem: false,
2884
+ };
2885
+ const FILTRATION_LABELS = {
2886
+ safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
2887
+ workingSaturday: 'Открыты по субботам',
2888
+ terminalTypeAtms: 'Банкоматы',
2889
+ terminalTypeTerm: 'Терминалы',
2890
+ workAllTime: 'Круглосуточно',
2891
+ billAcceptorEnable: 'Прием наличных',
2892
+ premiumService: 'Премиальное обслуживание',
2893
+ privateBanking: 'Услуга Private banking',
2894
+ sellingCoins: 'Продажа монет из драгоценных металлов',
2895
+ buyingCoins: 'Покупка монет из драгоценных металлов',
2896
+ bullionOperations: 'Операции со слитками',
2897
+ preciousMetalsOperations: 'Операции с драгоценными металлами',
2898
+ transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
2899
+ locationDisabledPeople: 'Для маломобильных',
2900
+ designDisabledPeople: 'Для слабовидящих',
2901
+ remoteWorkplace: 'Удаленное рабочее место',
2902
+ serviceDisabledPeople: 'Для маломобильных граждан',
2903
+ };
2904
+ const FILTRATION_PREDICATES$1 = {
2905
+ workingSaturday: (item) => Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
2906
+ premiumService: (item) => Boolean('premiumService' in item && item.premiumService),
2907
+ privateBanking: (item) => Boolean('privateBanking' in item && item.privateBanking),
2908
+ remoteWorkplace: (item) => Boolean('workScheduleDescription' in item),
2909
+ serviceDisabledPeople: (item) => Boolean('serviceDisabledPeople' in item && item.serviceDisabledPeople),
2910
+ sellingCoins: (item) => Boolean('sellingCoins' in item && item.sellingCoins),
2911
+ buyingCoins: (item) => Boolean('buyingCoins' in item && item.buyingCoins),
2912
+ bullionOperations: (item) => Boolean('bullionOperations' in item && item.bullionOperations),
2913
+ preciousMetalsOperations: (item) => Boolean('preciousMetalsOperations' in item && item.preciousMetalsOperations),
2914
+ transferringDataToBiometricSystem: (item) => Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
2915
+ };
2916
+
2917
+ function useButton() {
2918
+ return (props) => ({
2919
+ ...props,
2920
+ onClick: handlerDecorator(handleClick(props)),
2921
+ });
2922
+ }
2923
+ function handleClick({ disabled, onClick }) {
2924
+ return (ev) => {
2925
+ !disabled && onClick && onClick(ev);
2926
+ };
2927
+ }
2928
+
2929
+ const buttonStyleMap = {
2930
+ primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
2931
+ secondary: 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
2932
+ };
2933
+ const secondaryButtonStyleMap = {
2934
+ primary: style('group-data-secondary:text-primary-main group-data-secondary:bg-white', 'group-data-secondary:hover:text-white group-data-secondary:hover:bg-primary-hover', 'group-data-secondary:active:bg-primary-active'),
2935
+ secondary: style('group-data-secondary:text-white group-data-secondary:bg-white/20', 'group-data-secondary:hover:bg-primary-hover', 'group-data-secondary:active:bg-primary-active'),
2936
+ };
2937
+ const Button = JSX(({ children, ...props }) => {
2938
+ const button = useButton();
2939
+ const { className, version = 'primary', active, disabled, type = 'button', rounded = true, role, onClick, } = button(props);
2940
+ return (jsx("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs', {
2941
+ 'text-white bg-primary-active': active,
2942
+ 'bg-main-gray text-main-disabled cursor-not-allowed': disabled,
2943
+ 'rounded-md': rounded,
2944
+ }, !active && !disabled
2945
+ ? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
2946
+ : '', className), type: type, role: role, onClick: onClick, children: children }));
2947
+ });
2948
+
2949
+ const getVersion = (isPrimary, type) => isPrimary && type !== 'underlined' ? 'primary' : 'secondary';
2950
+
2951
+ const renderButtonsGroup = (data, activeButton, onButtonClick) => {
2952
+ const allButtonVersion = getVersion(activeButton === 'all');
2953
+ const businessButtonVersion = getVersion(activeButton === 'business');
2954
+ const handleClick = (e, key, branches) => {
2955
+ const filteredBranches = e.currentTarget === e.target && key === 'business' ? filterBranches(branches) : branches;
2956
+ onButtonClick(key);
2957
+ return filteredBranches;
2958
+ };
2959
+ const filterBranches = (branches) => branches.filter((branch) => branch.workSchedule &&
2960
+ branch.workSchedule.businessScheduleVisibleTag &&
2961
+ !branch.workSchedule.businessScheduleDescription);
2962
+ return (jsxs("div", { className: "flex gap-lg flex-col sm:flex-row pb-lg", children: [jsx(Button, { "data-id": "all", onClick: (e) => handleClick(e, 'all', data), version: allButtonVersion, children: "\u0414\u043B\u044F \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446" }), jsx(Button, { "data-id": "business", onClick: (e) => handleClick(e, 'business', data), version: businessButtonVersion, children: "\u0414\u043B\u044F \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446" })] }));
2963
+ };
2964
+
2965
+ const renderDescriptionBlock$1 = ({ __html, list, richVersion }) => __html || list?.length ? (jsxs("div", { className: "mb-2xl border-b sm:border border-main-divider sm:rounded-md", children: [__html ? (jsx("div", { className: "mb-2xl", children: jsx(RichText, { __html: __html, richVersion: richVersion }) })) : null, list?.length ? (jsx("div", { className: "flex flex-col sm:flex-row gap-2xl sm:flex-wrap pb-2xl sm:pb-xl", 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;
2966
+
2967
+ const COMMON_FILTERS_STYLES = 'flex flex-col sm:flex-row sm:flex-wrap gap-3xl pb-2xl';
2968
+ const renderFiltrationForm = ({ filters, field: { field, reset }, onlyOffice, labels, }) => {
2969
+ const visibleFiltersNum = onlyOffice ? 5 : 6;
2970
+ const filtersCheckbox = (filters || []).map((key) => (jsx(Checkbox, { text: labels[key], ...field(key) }, key)));
2971
+ const [visibleFilters, hiddenFilters] = visibleFiltersNum > 0
2972
+ ? [filtersCheckbox.slice(0, visibleFiltersNum), filtersCheckbox.slice(visibleFiltersNum)]
2973
+ : [filtersCheckbox, []];
2974
+ return (jsx("div", { children: filters?.length ? (jsx("div", { children: jsx(Foldable, { renderFoldableSection: ({ isUnfolded }) => (jsxs("div", { children: [jsx("div", { className: COMMON_FILTERS_STYLES, children: visibleFilters }), jsx(FoldableSection, { className: COMMON_FILTERS_STYLES, isUnfolded: isUnfolded, children: hiddenFilters })] })), renderFoldButton: renderFoldButton$2(reset, onlyOffice) }) })) : null }));
2975
+ };
2976
+ const renderFoldButton$2 = (reset, onlyOffice = false) => ({ isUnfolded, onToggle }) => {
2977
+ const labels = ['Больше фильтров', 'Меньше фильтров'];
2978
+ const icons = ['ArrowDownIcon', 'ArrowUpIcon'];
2979
+ return (jsxs("div", { className: "flex space-x-lg", children: [onlyOffice ? (jsx(LinkButton, { version: "transparent", className: "text-secondary-text [&>*]:p-0", appendRight: jsx(Icon, { name: icons[Number(isUnfolded)], width: "16", height: "16" }), text: labels[Number(isUnfolded)], onClick: onToggle })) : null, jsx(LinkButton, { version: "transparent", className: "text-secondary-text [&>*]:p-0", onClick: reset, children: renderBtnInner() })] }));
2980
+ };
2981
+ const renderBtnInner = () => (jsxs("div", { className: "flex items-center", children: ["\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440", jsx(Icon, { name: "CloseIcon", width: "16", height: "16", className: "ml-2xs" })] }));
2982
+
2983
+ const renderHeading = (title, lengthItems) => (jsx("div", { className: "flex flex-col sm:flex-row gap-xs mb-2xl", children: jsxs(Heading, { headingType: "h3", children: [jsx("span", { suppressHydrationWarning: true, children: title }), lengthItems ? (jsx(Text, { size: "text-h2", color: "text-secondary-text", children: jsx("span", { suppressHydrationWarning: true, children: ` (${lengthItems})` }) })) : null] }) }));
2984
+
2985
+ const defaultEmptyFunction$1 = () => void 0;
2986
+ const filtersVisibleStyles = (activeButton) => activeButton === 'all' ? 'block' : 'hidden';
2987
+ const OfficesAtmsMapLayout = JSX(({ className, data = [], isLoad, remoteWorkplaces = [], renderCard = defaultEmptyFunction$1, renderRemoteWorkplaceCard = defaultEmptyFunction$1, getBalloon = defaultEmptyFunction$1, getBalloonRemoteWorkplaces = defaultEmptyFunction$1, descriptionData, title, }) => {
2988
+ const onlyOffice = title?.includes('Офис');
2989
+ const [filtrationState, { field, reset }] = useForm(INITIAL_FILTRATION_STATE$1);
2990
+ const { filteredItems, points, filteredRemoteWorkplaces, lengthItems } = useOfficesAtmsMapData({
2991
+ data,
2992
+ remoteWorkplaces,
2993
+ filtrationState,
2994
+ getBalloon,
2995
+ getBalloonRemoteWorkplaces,
2996
+ });
2997
+ const [activeButton, setActiveButton] = useState('all');
2998
+ const filterOptions = {
2999
+ filters: getFiltersWithNonEmptyData([...data, ...remoteWorkplaces]),
3000
+ field: { field, reset },
3001
+ onlyOffice,
3002
+ labels: FILTRATION_LABELS,
3003
+ };
3004
+ return (jsxs("div", { className: style('space-y-1', className), children: [jsxs("div", { className: "bg-white", children: [jsxs("div", { className: "p-3xl pb-0", children: [renderHeading(title, lengthItems), descriptionData ? renderDescriptionBlock$1(descriptionData) : null, onlyOffice && renderButtonsGroup(data, activeButton, setActiveButton), jsx("div", { className: style('pb-3xl', filtersVisibleStyles(activeButton)), children: renderFiltrationForm(filterOptions) })] }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: isLoad, className: "h-full" }) }) })] }), jsxs(ClientOnly, { children: [filteredItems.map(renderCard), filteredRemoteWorkplaces.map(renderRemoteWorkplaceCard)] })] }));
3005
+ });
3006
+ const filterItems$1 = (data, filtrationState) => {
3007
+ const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
3008
+ return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES$1[_](item)));
3009
+ };
3010
+ const getFiltersWithNonEmptyData = (data) => Object.keys(INITIAL_FILTRATION_STATE$1).filter((_) => data.filter((item) => FILTRATION_PREDICATES$1[_](item)).length);
3011
+
3012
+ const defaultEmptyFunction = () => void 0;
3013
+ const useOfficesAtmsMapData = ({ data, remoteWorkplaces = [], filtrationState = {}, getBalloon = defaultEmptyFunction, getBalloonRemoteWorkplaces = defaultEmptyFunction, }) => {
3014
+ const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
3015
+ const _filteredItems = filterItems$1(data, filtrationState);
3016
+ const _filteredRemoteWorkplaces = filterItems$1(remoteWorkplaces, filtrationState);
3017
+ const _points = [
3018
+ ..._filteredItems.map((_) => ({
3019
+ type: 'offices',
3020
+ coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
3021
+ content: getBalloon(_),
3022
+ })),
3023
+ ..._filteredRemoteWorkplaces.map((_) => ({
3024
+ type: 'workplaces',
3025
+ coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
3026
+ content: getBalloonRemoteWorkplaces({
3027
+ address: _.address,
3028
+ workScheduleDescription: _.workScheduleDescription,
3029
+ }),
3030
+ })),
3031
+ ].filter((_) => _.coords && _.coords.length === 2);
3032
+ const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
3033
+ return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
3034
+ }, [data, remoteWorkplaces, filtrationState, getBalloon, getBalloonRemoteWorkplaces]);
3035
+ return { filteredItems, points, filteredRemoteWorkplaces, lengthItems };
3036
+ };
3037
+
3038
+ const RetailAddressField = JSX(({ field, input }) => {
3039
+ const fieldRegion = field('regionRetail');
3040
+ const fieldBranch = field('addressRetail');
3041
+ const regions = useBranchesByRegions();
3042
+ const regionKey = fieldRegion?.value?.key;
3043
+ const selectedRegion = regions.find(({ region }) => region === regionKey);
3044
+ const isLoad = !regions;
3045
+ const regionText = fieldRegion?.value?.text;
3046
+ const addressBranchRetail = useBranchesByRegions()?.find((_) => _?.region === regionText)?.branches;
3047
+ useEffect(() => {
3048
+ if (fieldRegion?.value?.key !== '') {
3049
+ field?.('addressRetail')?.onChange?.('');
3050
+ }
3051
+ }, [fieldRegion?.value]);
3052
+ const { points } = useOfficesAtmsMapData({
3053
+ data: selectedRegion?.branches || [],
3054
+ filtrationState: {},
3055
+ getBalloon: getOfficePoint,
3056
+ });
3057
+ return (jsxs("div", { children: [jsx(SelectControl, { label: "\u0410\u0434\u0440\u0435\u0441 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u044F", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043E\u0442\u0434\u0435\u043B\u0435\u043D\u0438\u0435", options: (addressBranchRetail || []).map(({ address = '' }) => ({
3058
+ key: address,
3059
+ text: address,
3060
+ })), ...getValidation(field('addressRetail'), validatorObj.addressRetail, input?.required), isSearch: true }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: isLoad, className: "h-full", selectedAddress: fieldBranch?.value?.text }) }) })] }));
3061
+ });
3062
+
3063
+ const RetailRegionField = JSX(({ field, input }) => {
3064
+ const regions = useBranchesByRegions();
3065
+ return (jsx(SelectControl, { label: "\u0424\u0438\u043B\u0438\u0430\u043B \u0431\u0430\u043D\u043A\u0430", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0438\u043B\u0438\u0430\u043B \u0431\u0430\u043D\u043A\u0430", isSearch: true, options: useMemo(() => regions?.map(({ region = '' }) => ({ key: region, text: region })), [regions]), ...getValidation(field('regionRetail'), validatorObj.regionRetail, input?.required) }));
3066
+ });
3067
+
3068
+ const RetirementIncomeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041F\u0435\u043D\u0441\u0438\u043E\u043D\u043D\u044B\u0435 \u0434\u043E\u0445\u043E\u0434\u044B", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", ...getValidation(field('retirementIncome'), validatorObj.retirementIncome, input?.required), ...input })));
3069
+
3070
+ const SecondaryPhoneField = JSX(({ field }) => {
3071
+ const fieldPhone = field('secondaryPhone');
3072
+ return (jsx(InputPhoneControl, { label: "\u0414\u043E\u043F\u043E\u043B\u043D\u0438\u0442\u0435\u043B\u044C\u043D\u044B\u0439 \u0442\u0435\u043B\u0435\u0444\u043E\u043D", ...(!fieldPhone.value || fieldPhone.value === '+7 ('
3073
+ ? fieldPhone
3074
+ : withValidator(fieldPhone, validatorObj.secondaryPhone)) }));
3075
+ });
3076
+
3077
+ const ServiceDirectionField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u041D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435 \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u044F", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043D\u0430\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u0435", options: SERVICE_DIRECTIONS, ...getValidation(field('serviceDirection'), validatorObj.serviceDirection, input?.required) })));
3078
+
3079
+ const orientationStyleMap = {
3080
+ horizontal: '@lg:flex-row',
3081
+ vertical: '',
3082
+ };
3083
+ const RadioButtonGroup = JSX(({ label, items, value, className, onChange: onChangeCheckedItem, disabled = false, orientation = 'horizontal', }) => (jsxs("div", { className: "grid gap-xs whitespace-nowrap", children: [label ? (jsx("div", { role: "radiogroup", "aria-label": label, children: jsx(Text, { color: "text-secondary-text", font: "font-light", children: label }) })) : null, jsx("div", { className: style('flex flex-col gap-s', orientationStyleMap[orientation], className), role: "radiogroup", "aria-label": "\u0413\u0440\u0443\u043F\u043F\u0430 \u043A\u043D\u043E\u043F\u043E\u043A", children: items?.map(({ id, text }) => (jsx(Checkbox, { isRadio: true, text: text, value: value === id, onChange: () => onChangeCheckedItem && onChangeCheckedItem(id), disabled: disabled }, String(id)))) })] })));
3084
+
3085
+ const RadioButtonGroupControl = JSX(({ className, label, onChange, error, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(RadioButtonGroup, { label: getRequiredLabel({ label, errors: rest?.errors }), onChange: (_) => onChange && onChange(_), ...rest }), renderErrorText(error)] })));
3086
+
3087
+ const SEX_TYPES = [
3088
+ { id: 'male', text: 'Мужской' },
3089
+ { id: 'female', text: 'Женский' },
3090
+ ];
3091
+ const SexField = JSX(({ field, input }) => (jsx(RadioButtonGroupControl, { label: "\u041F\u043E\u043B", orientation: "horizontal", items: SEX_TYPES, ...getValidation(field('sex'), validatorObj.sex, input?.required) })));
3092
+
3093
+ const ShareholderFlgField = JSX(({ field }) => (jsx(CheckboxWithError, { text: "\u042F \u044F\u0432\u043B\u044F\u044E\u0441\u044C \u0430\u043A\u0446\u0438\u043E\u043D\u0435\u0440\u043E\u043C / \u0443\u0447\u0430\u0441\u0442\u043D\u0438\u043A\u043E\u043C / \u0447\u043B\u0435\u043D\u043E\u043C / \u043F\u0430\u0439\u0449\u0438\u043A\u043E\u043C / \u0432\u043A\u043B\u0430\u0434\u0447\u0438\u043A\u043E\u043C \u0441 \u0434\u043E\u043B\u0435\u0439 \u0443\u0447\u0430\u0441\u0442\u0438\u044F \u0431\u043E\u043B\u0435\u0435 20% \u0443\u0441\u0442\u0430\u0432\u043D\u043E\u0433\u043E \u043A\u0430\u043F\u0438\u0442\u0430\u043B\u0430 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043B\u0438\u0446\u0430", ...getValidation(field('shareholderFlg'), validatorObj.shareholderFlg) })));
3094
+
3095
+ const SnilsInput = JSX(({ children, onChange, ...inputProps }) => {
3096
+ const handleChange = useCallback((v) => onChange && onChange(normalizeWithMask(v, '___-___-___ __')), [onChange]);
3097
+ const handleBlur = useCallback((v) => {
3098
+ if (v === '___-___-___ __') {
3099
+ onChange && onChange('');
3100
+ }
3101
+ }, []);
3102
+ return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
3103
+ });
3104
+
3105
+ const InputSnilsControl = JSX(({ className, label, value, error, onChange, onBlur, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(SnilsInput, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), value: value, onChange: onChange, onBlur: onBlur, placeholder: "___-___-___ __" }), renderErrorText(error)] })));
3106
+
3107
+ const SnilsField = JSX(({ field, input }) => (jsx(InputSnilsControl, { label: "\u0421\u041D\u0418\u041B\u0421", ...getValidation(field('snils'), validatorObj.snils, input?.required), ...input })));
3108
+
3109
+ const SurnameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0430\u043C\u0438\u043B\u0438\u044F", ...getValidation(field('surname'), validatorObj.surname, input?.required), ...input })));
3110
+
3111
+ const MIN_CREDIT_TERM = 1;
3112
+ const MAX_CREDIT_TERM = 180;
3113
+ const ITEMS_CREDIT_TERM = ['От 1 мес', 'До 15 лет'];
3114
+ const TermField = JSX(({ field }) => (jsx(InputRange, { title: "\u0421\u0440\u043E\u043A, \u043C\u0435\u0441\u044F\u0446\u0435\u0432", items: ITEMS_CREDIT_TERM, min: MIN_CREDIT_TERM, max: MAX_CREDIT_TERM, ...field('term') })));
3115
+
3116
+ const TotalIncomeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u043E\u0432\u043E\u043A\u0443\u043F\u043D\u044B\u0439 \u043E\u0444\u0438\u0446\u0438\u0430\u043B\u044C\u043D\u044B\u0439 \u0434\u043E\u0445\u043E\u0434 \u0432 \u043C\u0435\u0441\u044F\u0446 \u043F\u043E\u0441\u043B\u0435 \u0432\u044B\u0447\u0435\u0442\u0430 \u043D\u0430\u043B\u043E\u0433\u043E\u0432 (\u0437\u0430\u0440\u043F\u043B\u0430\u0442\u0430, \u043F\u0440\u0435\u043C\u0438\u0438)", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", ...getValidation(field('totalIncome'), validatorObj.totalIncome, input?.required), ...input })));
3117
+
3118
+ const UltraPremiumField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u0422\u0438\u043F \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u044F", options: SERVICE_TYPES, ...getValidation(field('serviceType'), validatorObj.serviceType, input?.required) })));
3119
+
3120
+ const VED_TYPES = [
3121
+ { id: 'currencyControl', text: 'Валютный контроль' },
3122
+ { id: 'documentOperations', text: 'Документарные операции' },
3123
+ { id: 'conversionTransactions', text: 'Конверсионные операции' },
3124
+ { id: 'otherIssues', text: 'Иные вопросы ВЭД' },
3125
+ ];
3126
+ const VedField = JSX(({ field }) => {
3127
+ const { value, onChange } = field('vedTypes');
3128
+ useEffect(() => {
3129
+ if (value !== 'currencyControl') {
2468
3130
  field?.('inn')?.onChange?.('');
2469
3131
  field?.('region')?.onChange?.('');
2470
3132
  }
@@ -2551,7 +3213,6 @@
2551
3213
  armyIdFlg: jsx(ArmyIdFlgField, { field: field, input: input }),
2552
3214
  dulSerie: jsx(DulSerieField, { field: field, input: input }),
2553
3215
  dulNumber: jsx(DulNumberField, { field: field, input: input }),
2554
- // eslint-disable-next-line max-lines
2555
3216
  dulIssueDateField: jsx(DulIssueDateField, { field: field, input: input }),
2556
3217
  dulSubdivisionCode: jsx(DulSubdivisionCodeField, { field: field, input: input }),
2557
3218
  dulIssuedBy: jsx(DulIssuedByField, { field: field, input: input }),
@@ -2568,6 +3229,8 @@
2568
3229
  creditInRshbCd: jsx(CreditInRshbCdField, { field: field, input: input }),
2569
3230
  bankEmployeeCode: jsx(BankEmpoleeCodeField, { field: field, input: input }),
2570
3231
  partInBusiness: jsx(PartInBusinessField, { field: field, input: input }),
3232
+ regionRetail: jsx(RetailRegionField, { field: field, input: input }),
3233
+ addressRetail: jsx(RetailAddressField, { field: field, input: input }),
2571
3234
  };
2572
3235
  return isRenderField({ input, field }) ? (jsx("div", { children: InputsMap[input?.name || ''] }, String(i))) : null;
2573
3236
  };
@@ -2576,38 +3239,6 @@
2576
3239
 
2577
3240
  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;
2578
3241
 
2579
- function useButton() {
2580
- return (props) => ({
2581
- ...props,
2582
- onClick: handlerDecorator(handleClick(props)),
2583
- });
2584
- }
2585
- function handleClick({ disabled, onClick }) {
2586
- return (ev) => {
2587
- !disabled && onClick && onClick(ev);
2588
- };
2589
- }
2590
-
2591
- const buttonStyleMap = {
2592
- primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
2593
- secondary: 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
2594
- };
2595
- const secondaryButtonStyleMap = {
2596
- primary: style('group-data-secondary:text-primary-main group-data-secondary:bg-white', 'group-data-secondary:hover:text-white group-data-secondary:hover:bg-primary-hover', 'group-data-secondary:active:bg-primary-active'),
2597
- secondary: style('group-data-secondary:text-white group-data-secondary:bg-white/20', 'group-data-secondary:hover:bg-primary-hover', 'group-data-secondary:active:bg-primary-active'),
2598
- };
2599
- const Button = JSX(({ children, ...props }) => {
2600
- const button = useButton();
2601
- const { className, version = 'primary', active, disabled, type = 'button', rounded = true, role, onClick, } = button(props);
2602
- return (jsx("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs', {
2603
- 'text-white bg-primary-active': active,
2604
- 'bg-main-gray text-main-disabled cursor-not-allowed': disabled,
2605
- 'rounded-md': rounded,
2606
- }, !active && !disabled
2607
- ? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
2608
- : '', className), type: type, role: role, onClick: onClick, children: children }));
2609
- });
2610
-
2611
3242
  const ResponseTypeDialog = JSX(function ({ responseType, typeForm, }) {
2612
3243
  const responseOK = responseType === 'OK';
2613
3244
  const statusIcon = responseOK ? 'ResponseOKIcon' : 'ResponseFailIcon';
@@ -2766,50 +3397,6 @@
2766
3397
  return [storedValue, setValue];
2767
3398
  }
2768
3399
 
2769
- const Loader = JSX(({ color = 'text-primary-main', position = 'absolute', blur = true }) => (jsx("div", { className: style('flex justify-center items-center h-full w-full z-50', position, {
2770
- 'backdrop-blur': blur,
2771
- }), children: jsx("div", { className: style('inline-block h-28 w-28', 'animate-spin rounded-full', 'border-8 border-solid border-current', 'border-r-transparent', color), role: "status" }) })));
2772
-
2773
- const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
2774
- const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
2775
- const onToggle = useCallback(() => {
2776
- setIsUnfolded((_) => !_);
2777
- }, []);
2778
- const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
2779
- const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
2780
- return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
2781
- });
2782
-
2783
- function useResizeObserver(callback, deps) {
2784
- const ref = useRef(null);
2785
- useEffect(() => {
2786
- const element = ref?.current;
2787
- if (!element) {
2788
- return undefined;
2789
- }
2790
- const observer = new ResizeObserver((entries) => {
2791
- callback(element, entries[0]);
2792
- });
2793
- observer.observe(element);
2794
- return () => {
2795
- observer.disconnect();
2796
- };
2797
- }, [callback, ...deps]);
2798
- return ref;
2799
- }
2800
-
2801
- const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
2802
- const containerRef = useRef(null);
2803
- const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
2804
- if (containerRef.current) {
2805
- containerRef.current.style.maxHeight = isUnfolded
2806
- ? `${childrenWrapperEl.scrollHeight}px`
2807
- : '';
2808
- }
2809
- }, [isUnfolded]);
2810
- return (jsx("div", { ref: containerRef, className: `transition-max-h duration-300 overflow-hidden ${containerRef.current || !isUnfolded ? 'max-h-0' : ''} `, children: jsx("div", { className: className, ref: childrenWrapperRef, children: children }) }));
2811
- });
2812
-
2813
3400
  const CONSENT_ALL_DOCS_TEXT = 'Согласие на все документы';
2814
3401
  const CONSENT_REQUIRED = 'Отметьте все обязательные соглашения';
2815
3402
  const GroupedConsents = JSX(({ inputs = [], typeForm = '', field, key }) => {
@@ -3052,15 +3639,19 @@
3052
3639
  await sendCode({
3053
3640
  phoneNumber: phoneNumber,
3054
3641
  smsCodesSetName: { key: 'AUTHENTICATION' },
3642
+ }).then((res) => {
3643
+ if (typeof res !== 'string' &&
3644
+ res.errorMessage &&
3645
+ res.errorMessage.startsWith(`Too many request for phoneNumber [${phoneNumber}]`)) {
3646
+ throw res;
3647
+ }
3055
3648
  });
3056
3649
  setAttemps(0);
3057
3650
  setTimeNextReq(180);
3058
3651
  setIsTimerStarted(true);
3059
3652
  }
3060
3653
  catch (e) {
3061
- if (e?.status === 429) {
3062
- captchaDialog.open();
3063
- }
3654
+ captchaDialog.open();
3064
3655
  }
3065
3656
  };
3066
3657
 
@@ -3757,13 +4348,13 @@
3757
4348
  return (jsx(DefaultFoldButton, { icon: icons[Number(isUnfolded)], label: labels[Number(isUnfolded)], onClick: onToggle }));
3758
4349
  };
3759
4350
 
3760
- const ICONS$1 = ['ArrowDownIcon', 'ArrowUpIcon'];
4351
+ const ICONS = ['ArrowDownIcon', 'ArrowUpIcon'];
3761
4352
  const resultsGridStyle = 'space-y-px lg:space-y-0 lg:grid lg:grid-cols-12 gap-2xs';
3762
4353
  const renderGridBlocks = ({ topItemsCount = 0, label = '', block, blocksToRender = [], ...rest }) => {
3763
4354
  const [visibleBlocks, hiddenBlocks] = topItemsCount > 0
3764
4355
  ? [blocksToRender.slice(0, topItemsCount), blocksToRender.slice(topItemsCount)]
3765
4356
  : [blocksToRender, []];
3766
- return (jsxs("div", { className: style('space-y-2xs', { hidden: !blocksToRender.length }), children: [jsxs("div", { className: style(resultsGridStyle), children: [renderBlocksList(visibleBlocks, { ...rest.options, parent: block }), isOdd(visibleBlocks.length) ? jsx(AdTile, { className: "col-span-6", ...rest }) : null] }), jsx(Foldable, { renderFoldableSection: ({ isUnfolded }) => (jsxs(FoldableSection, { className: style(resultsGridStyle), isUnfolded: isUnfolded, children: [renderBlocksList(hiddenBlocks, { ...rest.options, parent: block }), isOdd(hiddenBlocks.length) ? jsx(AdTile, { className: "col-span-6", ...rest }) : null] })), renderFoldButton: ({ isUnfolded, onToggle }) => (jsx(DefaultFoldButton, { className: style({ hidden: topItemsCount < 1 }), disabled: !hiddenBlocks?.length, label: label, icon: ICONS$1[Number(isUnfolded)], dataTheme: rest.options?.page?.colorPalette, onClick: onToggle })) })] }));
4357
+ return (jsxs("div", { className: style('space-y-2xs', { hidden: !blocksToRender.length }), children: [jsxs("div", { className: style(resultsGridStyle), children: [renderBlocksList(visibleBlocks, { ...rest.options, parent: block }), isOdd(visibleBlocks.length) ? jsx(AdTile, { className: "col-span-6", ...rest }) : null] }), jsx(Foldable, { renderFoldableSection: ({ isUnfolded }) => (jsxs(FoldableSection, { className: style(resultsGridStyle), isUnfolded: isUnfolded, children: [renderBlocksList(hiddenBlocks, { ...rest.options, parent: block }), isOdd(hiddenBlocks.length) ? jsx(AdTile, { className: "col-span-6", ...rest }) : null] })), renderFoldButton: ({ isUnfolded, onToggle }) => (jsx(DefaultFoldButton, { className: style({ hidden: topItemsCount < 1 }), disabled: !hiddenBlocks?.length, label: label, icon: ICONS[Number(isUnfolded)], dataTheme: rest.options?.page?.colorPalette, onClick: onToggle })) })] }));
3767
4358
  };
3768
4359
 
3769
4360
  const FilteredBlocks = JSX(({ blocksSection, blocksToRender = [], notFound, ...rest }) => {
@@ -5089,10 +5680,10 @@
5089
5680
  }
5090
5681
  }), [options?.parent]);
5091
5682
  return (jsxs(BlockWrapper, { className: style('flex flex-col', className), defaultPadding: "p-2xl", ...rest, children: [isIcon(icon) ? (jsx("div", { className: "self-center", children: jsx(Img, { image: icon }) })) : null, title ? (jsx(Heading, { className: style('pt-xs', align), headingType: "h5", title: title })) : null, button?.text ? jsx(LinkButton, { className: "w-full mt-m mb-lg", ...button }) : null, hiddenCells.length ? (jsx(Foldable, { renderFoldableSection: () => (jsxs("div", { children: [visibleCells, jsx(FoldableSection, { isUnfolded: isVisible, children: hiddenCells })] })), renderFoldButton: cardCells.length >= visibleCellsCount
5092
- ? renderFoldButton$3(options?.parent, data, isVisible)
5683
+ ? renderFoldButton$1(options?.parent, data, isVisible)
5093
5684
  : null })) : (jsx("div", { children: visibleCells }))] }));
5094
5685
  });
5095
- const renderFoldButton$3 = (parent, data, isUnfolded = false) => () => (jsxs("button", { className: "w-full cursor-pointer text-primary-main pt-lg flex justify-between items-center", onClick: () => {
5686
+ const renderFoldButton$1 = (parent, data, isUnfolded = false) => () => (jsxs("button", { className: "w-full cursor-pointer text-primary-main pt-lg flex justify-between items-center", onClick: () => {
5096
5687
  if (parent !== undefined) {
5097
5688
  defaultEventBus.fire('fold', { type: 'fold', isUnfolded: !isUnfolded, parent });
5098
5689
  }
@@ -5164,8 +5755,8 @@
5164
5755
  creditInRshbCd: '',
5165
5756
  },
5166
5757
  5: {
5167
- region: '',
5168
- addressBranch: '',
5758
+ regionRetail: '',
5759
+ addressRetail: '',
5169
5760
  bankEmployeeCode: '',
5170
5761
  },
5171
5762
  };
@@ -5421,10 +6012,10 @@
5421
6012
  inputs: [],
5422
6013
  },
5423
6014
  {
5424
- inputs: [{ fieldType: 'common', name: 'region', required: true }],
6015
+ inputs: [{ fieldType: 'common', name: 'regionRetail', required: true }],
5425
6016
  },
5426
6017
  {
5427
- inputs: [{ fieldType: 'common', name: 'addressBranch', required: true }],
6018
+ inputs: [{ fieldType: 'common', name: 'addressRetail', required: true }],
5428
6019
  },
5429
6020
  {
5430
6021
  title: 'Код представителя Банка',
@@ -6148,103 +6739,44 @@
6148
6739
  if (newDropdownPosition > dropdownButtonRect.left) {
6149
6740
  menuRef.current.style.left = '';
6150
6741
  }
6151
- else {
6152
- menuRef.current.style.left = `${newDropdownPosition}px`;
6153
- }
6154
- }
6155
- }
6156
- }, [isVisible]);
6157
- useEventListener(globalThis, 'resize', () => changeDropdownPosition({ isOpened: isVisible, buttonRef: ref, menuRef: dropdownRef }));
6158
- useEffect(() => {
6159
- changeDropdownPosition({ isOpened: isVisible, buttonRef: ref, menuRef: dropdownRef });
6160
- }, [isVisible]);
6161
- return (jsxs("div", { className: style(isVisible ? 'rounded-md shadow-blue-gray' : '', className), ref: ref, role: "navigation", children: [jsx("button", { type: "button", className: "group/btn flex justify-between items-center h-6", "aria-label": ariaLabel, onClick: toggle, role: "button", "aria-labelledby": "labeldiv", children: Array(3)
6162
- .fill(null)
6163
- .map((_, i) => (jsx("div", { className: "w-[3px] h-[3px] rounded mr-2xs bg-primary-text group-hover/btn:bg-primary-hover group-data-transparent:bg-white" }, String(i)))) }), jsx("div", { ref: dropdownRef, className: style('absolute flex flex-col rounded-md bg-white p-xl pb-xs w-56 z-40', {
6164
- hidden: !isVisible,
6165
- }), "aria-hidden": !isVisible, children: renderDropdownItems(items, activeItem) })] }));
6166
- });
6167
- const DropdownMenuItem = JSX(({ isActive, ...rest }) => {
6168
- const link = useLink();
6169
- const { text, href, target, onClick } = link(rest);
6170
- return (jsx("a", { className: style('text-l font-light pb-m hover:text-primary-main', {
6171
- 'text-primary-main': isActive,
6172
- }), href: href, target: target, onClick: onClick, role: "link", ...getAspectsAttributes(rest?.data), children: text }));
6173
- });
6174
- const renderDropdownItems = (items, activeItem) => items?.map((item, i) => (jsx(DropdownMenuItem, { isActive: item === activeItem, ...item }, item?.text ?? String(i))));
6175
-
6176
- const BUTTON_SIZE_STYLE = {
6177
- default: 'w-6 h-6',
6178
- large: 'w-12 h-12',
6179
- };
6180
- const HeaderSecondaryMenuButton = JSX(({ className, isRounded, buttonSize = 'default', isGrayBg = false, disabled, ariaLabel = 'Меню второго уровня', image, data, onClick, version, }) => {
6181
- const grayBg = isGrayBg && !isRounded ? 'bg-main-divider' : '';
6182
- const bgColor = version === 'transparent' ? 'backdrop-opacity-30 bg-white/30' : grayBg;
6183
- return (jsx("button", { className: style('group/btn border-0 flex shrink-0 items-center', isGrayBg ? 'p-s rounded-full' : 'p-0 bg-inherit', bgColor, isRounded
6184
- ? 'w-8 h-8 text-secondary-light hover:text-secondary-hove'
6185
- : `${BUTTON_SIZE_STYLE[buttonSize]} text-primary-text hover:text-primary-main`, 'group-data-transparent:text-white', className), type: "button", disabled: disabled, "aria-label": ariaLabel, onClick: onClick, ...getAspectsAttributes(data), children: jsx(Img, { image: image, className: style('h-full', {
6186
- 'bg-main-divider/20 rounded-full': isRounded,
6187
- }), imageClassName: "group-hover/btn:text-primary-hover group-hover/btn:invert-0" }) }));
6188
- });
6189
-
6190
- const getNS = (_) => globalThis[_];
6191
- const initializeExternalNS = (namespaceName, url) => {
6192
- const script = document.getElementById(url);
6193
- if (script) {
6194
- const ns = getNS(namespaceName);
6195
- if (ns) {
6196
- return Promise.resolve(ns);
6197
- }
6198
- else {
6199
- return new Promise((resolve) => {
6200
- script.addEventListener('load', () => {
6201
- resolve(getNS(namespaceName));
6202
- });
6203
- });
6204
- }
6205
- }
6206
- else {
6207
- return new Promise((resolve, reject) => {
6208
- const newScript = document.createElement('script');
6209
- newScript.src = url;
6210
- newScript.async = true;
6211
- newScript.id = url;
6212
- newScript.addEventListener('load', () => {
6213
- resolve(getNS(namespaceName));
6214
- });
6215
- newScript.addEventListener('error', (error) => {
6216
- reject(error);
6217
- });
6218
- document.head.appendChild(newScript);
6219
- });
6220
- }
6221
- };
6222
- function useExternalNS(namespaceName, url, unmountNS = true) {
6223
- const [externalNS, setExternalNS] = useState(undefined);
6224
- useEffect(() => {
6225
- let isMounted = true;
6226
- initializeExternalNS(namespaceName, url)
6227
- .then((ns) => {
6228
- if (isMounted) {
6229
- setExternalNS(ns);
6230
- }
6231
- })
6232
- .catch((error) => {
6233
- console.error(`Failed to initialize external namespace: ${error}`);
6234
- });
6235
- return () => {
6236
- isMounted = false;
6237
- if (unmountNS) {
6238
- const script = document.getElementById(url);
6239
- if (script) {
6240
- document.head.removeChild(script);
6241
- }
6242
- setExternalNS(undefined);
6742
+ else {
6743
+ menuRef.current.style.left = `${newDropdownPosition}px`;
6744
+ }
6243
6745
  }
6244
- };
6245
- }, [namespaceName, url, unmountNS]);
6246
- return externalNS;
6247
- }
6746
+ }
6747
+ }, [isVisible]);
6748
+ useEventListener(globalThis, 'resize', () => changeDropdownPosition({ isOpened: isVisible, buttonRef: ref, menuRef: dropdownRef }));
6749
+ useEffect(() => {
6750
+ changeDropdownPosition({ isOpened: isVisible, buttonRef: ref, menuRef: dropdownRef });
6751
+ }, [isVisible]);
6752
+ return (jsxs("div", { className: style(isVisible ? 'rounded-md shadow-blue-gray' : '', className), ref: ref, role: "navigation", children: [jsx("button", { type: "button", className: "group/btn flex justify-between items-center h-6", "aria-label": ariaLabel, onClick: toggle, role: "button", "aria-labelledby": "labeldiv", children: Array(3)
6753
+ .fill(null)
6754
+ .map((_, i) => (jsx("div", { className: "w-[3px] h-[3px] rounded mr-2xs bg-primary-text group-hover/btn:bg-primary-hover group-data-transparent:bg-white" }, String(i)))) }), jsx("div", { ref: dropdownRef, className: style('absolute flex flex-col rounded-md bg-white p-xl pb-xs w-56 z-40', {
6755
+ hidden: !isVisible,
6756
+ }), "aria-hidden": !isVisible, children: renderDropdownItems(items, activeItem) })] }));
6757
+ });
6758
+ const DropdownMenuItem = JSX(({ isActive, ...rest }) => {
6759
+ const link = useLink();
6760
+ const { text, href, target, onClick } = link(rest);
6761
+ return (jsx("a", { className: style('text-l font-light pb-m hover:text-primary-main', {
6762
+ 'text-primary-main': isActive,
6763
+ }), href: href, target: target, onClick: onClick, role: "link", ...getAspectsAttributes(rest?.data), children: text }));
6764
+ });
6765
+ const renderDropdownItems = (items, activeItem) => items?.map((item, i) => (jsx(DropdownMenuItem, { isActive: item === activeItem, ...item }, item?.text ?? String(i))));
6766
+
6767
+ const BUTTON_SIZE_STYLE = {
6768
+ default: 'w-6 h-6',
6769
+ large: 'w-12 h-12',
6770
+ };
6771
+ const HeaderSecondaryMenuButton = JSX(({ className, isRounded, buttonSize = 'default', isGrayBg = false, disabled, ariaLabel = 'Меню второго уровня', image, data, onClick, version, }) => {
6772
+ const grayBg = isGrayBg && !isRounded ? 'bg-main-divider' : '';
6773
+ const bgColor = version === 'transparent' ? 'backdrop-opacity-30 bg-white/30' : grayBg;
6774
+ return (jsx("button", { className: style('group/btn border-0 flex shrink-0 items-center', isGrayBg ? 'p-s rounded-full' : 'p-0 bg-inherit', bgColor, isRounded
6775
+ ? 'w-8 h-8 text-secondary-light hover:text-secondary-hove'
6776
+ : `${BUTTON_SIZE_STYLE[buttonSize]} text-primary-text hover:text-primary-main`, 'group-data-transparent:text-white', className), type: "button", disabled: disabled, "aria-label": ariaLabel, onClick: onClick, ...getAspectsAttributes(data), children: jsx(Img, { image: image, className: style('h-full', {
6777
+ 'bg-main-divider/20 rounded-full': isRounded,
6778
+ }), imageClassName: "group-hover/btn:text-primary-hover group-hover/btn:invert-0" }) }));
6779
+ });
6248
6780
 
6249
6781
  const CHAT_NAMESPACE = 'chatbot';
6250
6782
  const CHAT_BUTTON_EXTERNAL_NAME = 'text-page__btn-chat';
@@ -6574,619 +7106,312 @@
6574
7106
  title: item?.title,
6575
7107
  i,
6576
7108
  isActive: Boolean(i === activeSlideIndex),
6577
- onClick: () => handleActiveSlideIndex(i),
6578
- })) })) : null, jsx("div", { className: "flex", style: { transform: `translateX(-${activeSlideIndex}00%)` }, role: "list", children: renderInsuranceGalleries({
6579
- insuranceTabs,
6580
- button,
6581
- }) })] }));
6582
- });
6583
- const renderInsuranceGalleries = ({ insuranceTabs, button }) => {
6584
- const insuranceGalleries = insuranceTabs?.map((_) => _.cards);
6585
- return insuranceGalleries?.length
6586
- ? insuranceGalleries.map((cards, i) => (jsx(InsuranceAmountBlockInner, { button: button, cards: cards }, String(i))))
6587
- : null;
6588
- };
6589
- function renderNavButton$1({ title, i, isActive, onClick }) {
6590
- const btnClassName = isActive ? 'bg-primary-main text-white rounded-md' : `text-secondary-text`;
6591
- return (jsx("button", { type: "button", onClick: onClick, "aria-label": `Кнопка ${title}`, className: `box-border px-m py-s text-m font-light ${btnClassName}`, children: title }, String(i)));
6592
- }
6593
-
6594
- const investmentCellColorMap = {
6595
- yellow: 'bg-yellow',
6596
- green: 'bg-green',
6597
- 'green-light': 'bg-green-light',
6598
- 'green-dark': 'bg-green-dark',
6599
- };
6600
- const investmentCellSizeMap = {
6601
- XS: 'h-10',
6602
- S: 'h-16',
6603
- M: 'h-24',
6604
- L: 'h-32',
6605
- XL: 'h-52',
6606
- };
6607
- const InvestmentInfo = JSX((props) => {
6608
- const { className = '', __html, isDotted, investmentZeroColumn, investmentColumns, ...rest } = props;
6609
- const columns = investmentColumns ? [...investmentColumns] : [];
6610
- if (investmentZeroColumn) {
6611
- columns.unshift(investmentZeroColumn);
6612
- }
6613
- return (jsx(BlockWrapper, { className: className, defaultPadding: "p-4xl", ...rest, children: jsxs("div", { className: "container text-m font-light space-y-4xl", children: [columns?.length ? (jsxs("div", { children: [jsxs("div", { className: "flex items-end relative pl-3xl pr-lg text-white", children: [joinList(jsx("div", { className: "w-px h-4 bg-gray" }))(columns.map(renderInvestmentColumn)), jsx("div", { className: "absolute right-3xl w-px h-4 bg-gray" })] }), jsx("div", { className: "border-t border-gray -mt-xs mx-3xl" }), jsx("div", { className: "flex justify-between text-primary-text mt-s -mx-5xl", children: columns.map(renderInvestmentColumnTitle) })] })) : null, __html ? (jsx("div", { className: "max-w-2xl font-light text-base", children: jsx(RichText, { __html: __html, isDotted: isDotted, itemSize: "list-s" }) })) : null] }) }));
6614
- });
6615
- const renderInvestmentColumn = (column, i, arr) => {
6616
- const isSecondColumn = i === 1;
6617
- const isLastColumn = i === arr.length - 1;
6618
- const reversedCells = column.cells?.reverse() || [];
6619
- return (jsx("div", { className: `${getColumnClasses(isSecondColumn, isLastColumn, column.cells)}`, children: reversedCells.length ? (jsx("div", { className: `w-full ${isLastColumn ? 'border-4 border-green-more-dark p-1.5 min-w-72' : ''}`, children: reversedCells.map(renderInvestmentCell) })) : null }, `column_${i}`));
6620
- };
6621
- const getColumnClasses = (isSecondColumn, isLastColumn, cells = []) => [
6622
- cells.length ? 'flex-1' : 'flex-0',
6623
- cells.length && !isSecondColumn && !isLastColumn ? 'pl-s' : '',
6624
- cells.length && !isLastColumn ? 'pr-s pb-3xl' : 'pb-xl',
6625
- ].join(' ');
6626
- const renderInvestmentCell = (cell, i) => {
6627
- const cellSize = cell.cellSize || 'XS';
6628
- const cellColor = cell.cellColor || 'green';
6629
- return cell.text ? (jsx("div", { className: `flex-1 flex items-center justify-center relative py-xs ${investmentCellSizeMap[cellSize]} ${investmentCellColorMap[cellColor]} ${cellSize === 'XS' ? 'px-s' : 'px-5xl'}`, children: jsx(Text, { align: "text-center", children: cell.text }) }, `cell_${i}`)) : null;
6630
- };
6631
- const renderInvestmentColumnTitle = (column, i) => column?.title ? (jsx("div", { className: "flex-1 max-w-44 text-center px-xs last:pr-4xl last:max-w-52", children: column.title }, `title_${i}`)) : null;
6632
-
6633
- const KILO = 1024;
6634
- const KILO_SIZES = ['байт', 'Кб', 'Мб', 'Гб', 'Тб', 'Пб'];
6635
- const formatBytes = (bytes, decimals = 2) => {
6636
- if (bytes === 0) {
6637
- return '';
6638
- }
6639
- const i = Math.floor(Math.log(bytes) / Math.log(KILO));
6640
- return `${parseFloat((bytes / Math.pow(KILO, i)).toFixed(decimals))} ${KILO_SIZES[i]}`;
6641
- };
6642
-
6643
- const LinkDocItem = JSX(({ icon, text, href, target, fileFormat, data, fileSize }) => {
6644
- const prefix = fileSize && fileFormat ? ',' : '';
6645
- const size = fileSize ?? '';
6646
- const format = fileFormat ? String(fileFormat) : '';
6647
- return (jsxs("a", { className: "flex box-border gap-s group/item h-fit w-fit text-primary-text no-underline hover:text-primary-main", href: href, target: target, ...getAspectsAttributes(data), children: [icon, text ? (jsxs(Text, { size: "text-l", font: "font-light", children: [text, " ", addSpace(size, format), jsx(Text, { color: "text-secondary-text", children: href && `${size + prefix + format}` })] })) : null] }));
6648
- });
6649
- const addSpace = (size, format) => (size || format ? jsx("span", { children: ",\u00A0" }) : '');
6650
-
6651
- const linkIconStyle = 'min-w-6 min-h-6';
6652
-
6653
- const renderDefaultItem = (router, icon) => (docBlockDef, i) => {
6654
- const href = adjustHref(router)(docBlockDef?.docType === 'Attachment' ? docBlockDef?.attachment?.src : docBlockDef?.href);
6655
- const fileSize = docBlockDef?.docType === 'Attachment'
6656
- ? formatBytes(docBlockDef?.attachment?.fileSize || 0)
6657
- : docBlockDef?.fileSize;
6658
- const fileFormat = docBlockDef?.docType === 'Attachment' ? getExtFromHref(href) : docBlockDef?.fileFormat;
6659
- return (jsxs("div", { role: "listitem", children: [jsx(LinkDocItem, { text: docBlockDef?.text, target: docBlockDef?.target, href: href, fileFormat: fileFormat, fileSize: fileSize, icon: renderImg(icon), data: docBlockDef?.data }), jsx(RichText, { __html: docBlockDef?.__html })] }, String(i)));
6660
- };
6661
- const renderImg = (icon) => icon ? jsx(Img, { className: linkIconStyle, image: icon, width: "24", height: "24" }) : null;
6662
- const getExtFromHref = (href) => {
6663
- if (!href) {
6664
- return '';
6665
- }
6666
- const index = href.lastIndexOf('.');
6667
- const regexp = new RegExp(/\/(.*)/);
6668
- const docFormat = index !== -1 ? href.substring(index + 1) : '';
6669
- return docFormat.includes('/') ? docFormat.replace(regexp, '') : docFormat;
6670
- };
6671
-
6672
- const ReportDialog = JSX(({ href, __html, target }) => {
6673
- const { close } = useDialogManager();
6674
- const router = useRouter();
6675
- const adjustedHref = adjustHref(router)(href);
6676
- const handleClose = useCallback(() => {
6677
- close();
6678
- }, []);
6679
- return (jsxs(Dialog, { className: "my-6xl min-h-fit w-fit mx-auto", children: [__html ? jsx(RichText, { __html: __html }) : null, jsxs("div", { className: "flex flex-row mx-auto w-fit gap-lg py-lg", children: [jsx(LinkButton, { text: "\u042F \u0441\u043E\u0433\u043B\u0430\u0441\u0435\u043D", version: "primary", target: target, href: adjustedHref, onClick: handleClose }), jsx(Button, { type: "button", version: "secondary", onClick: handleClose, children: "\u042F \u043D\u0435 \u0441\u043E\u0433\u043B\u0430\u0441\u0435\u043D" })] }), jsx("div", { children: "\u041D\u0430\u0436\u0438\u043C\u0430\u044F \u043A\u043D\u043E\u043F\u043A\u0443 \u00AB\u042F \u0421\u041E\u0413\u041B\u0410\u0421\u0415\u041D\u00BB \u043D\u0438\u0436\u0435 \u0412\u044B \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442\u0435 \u0434\u0430\u043D\u043D\u044B\u0435 \u0443\u0441\u043B\u043E\u0432\u0438\u044F. \u0420\u0430\u0441\u043F\u0440\u043E\u0441\u0442\u0440\u0430\u043D\u0435\u043D\u0438\u0435 \u0438\u043B\u0438 \u0440\u0430\u0441\u043A\u0440\u044B\u0442\u0438\u0435 \u043B\u044E\u0431\u043E\u0439 \u0447\u0430\u0441\u0442\u0438 \u0434\u0430\u043D\u043D\u043E\u0433\u043E \u0417\u0430\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F \u0438\u043B\u0438 \u043B\u044E\u0431\u043E\u0439 \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u0438, \u0438\u043B\u0438 \u0440\u0435\u043A\u043E\u043C\u0435\u043D\u0434\u0430\u0446\u0438\u0438 \u0432 \u043D\u0435\u043C \u0437\u0430\u043F\u0440\u0435\u0449\u0435\u043D\u043E.\u00BB" })] }));
6680
- });
6681
-
6682
- const useReportDialog = (props) => {
6683
- const { open, close } = useDialogManager();
6684
- return {
6685
- open: (options = {}) => open(jsx(ReportDialog, { ...props }), options),
6686
- close,
6687
- };
6688
- };
6689
-
6690
- const ReportDialogButton = JSX(({ text, href, target, __html, icon }) => {
6691
- if (!text && !__html) {
6692
- return null;
6693
- }
6694
- const reportDialog = useReportDialog({ __html, href, target });
6695
- const openReportDialog = useCallback(() => reportDialog.open(), [reportDialog]);
6696
- return (jsxs("button", { className: "flex gap-s text-primary-text no-underline hover:text-primary-main", onClick: openReportDialog, children: [renderImg(icon), jsx(Text, { font: "font-light", children: text })] }));
6697
- });
6698
-
6699
- const linkColumnsModeStyleMap = {
6700
- double: 'sm:flex-wrap sm:flex-row',
6701
- single: 'sm:flex-col',
6702
- };
6703
- const LinkDocs = UniBlock(({ className = '', title, description, align = 'text-center', documents, icon = { icon: 'DocIcon' }, columnsMode = 'double', ...rest }) => {
6704
- const router = useRouter();
6705
- return (jsxs(BlockWrapper, { className: style('space-y-lg', className), defaultPadding: "p-6xl", ...rest, children: [jsx(Headline, { title: title, description: description, align: align, headlineVersion: "M", as: "h2", isEmbedded: true }), documents?.length ? (jsx("div", { className: style('grid gap-xl', columnsMode === 'double' ? '@md:grid-cols-2' : 'grid-cols-1', linkColumnsModeStyleMap[columnsMode]), role: "list", children: documents.map(renderLinkDocItem(router, icon)) })) : null] }));
6706
- });
6707
- const renderLinkDocItem = (router, icon) => (docBlockDef, i) => {
6708
- const docType = docBlockDef?.docType;
6709
- if (docType === '') {
6710
- return null;
6711
- }
6712
- if ('reportSource' in docBlockDef && docBlockDef?.reportSource?.__html) {
6713
- return renderModalItem(icon)(docBlockDef, i);
6714
- }
6715
- return renderDefaultItem(router, icon)(docBlockDef, i);
6716
- };
6717
- const renderModalItem = (icon) => (props, i) => {
6718
- const commonProps = {
6719
- text: props.text,
6720
- target: props.target,
6721
- __html: props.reportSource?.__html,
6722
- };
6723
- return props.reportSource?.__html && props.text ? (jsxs("div", { role: "listitem", children: [jsx(ReportDialogButton, { ...commonProps, icon: icon, href: isLinkDoc(props) ? props?.href : props?.attachment?.src }), jsx(RichText, { __html: props?.__html })] }, String(i))) : null;
6724
- };
6725
- const isLinkDoc = (data) => 'href' in data;
6726
-
6727
- const MobileAppTile = UniBlock(({ className, padding, align = 'text-left', buttons = [], description, image, __html, headingType, qr, additionalDescription = '', title = 'Мобильное приложение', version = 'primary', ...rest }) => {
6728
- const containerStyle = version === 'secondary' ? 'p-m min-w-32' : 'min-w-24';
6729
- const img = image?.src ? jsx(Img, { className: "hidden lg:block", image: image }) : null;
6730
- return (jsx(BlockWrapper, { className: style('min-h-80', className), padding: "p-0", version: version, ...rest, children: jsxs(BaseTile, { className: "h-full", padding: padding, defaultPadding: "p-6xl", title: jsx(Heading, { headingType: headingType, title: title, className: style('whitespace-pre-wrap', align) }), rightImage: img, buttons: renderButtonsSection(buttons, { className: 'flex-wrap' }), children: [description ? (jsx(Text, { size: "text-xl", "font-weight": "font-light", children: description })) : null, jsxs("div", { className: style('gap-m', 'flex flex-1 flex-col', 'flex-col items-start @xl:flex-row @xl:items-center'), children: [__html ? jsx(RichText, { __html: __html, itemSize: "list-m" }) : null, jsx(Text, { size: "text-m", "font-weight": "font-light", color: "text-secondary-text", children: additionalDescription }), qr?.src ? (jsx("div", { className: style('flex justify-center bg-white rounded-md @xl:-order-1', containerStyle), children: jsx(Img, { className: "w-fit", image: qr }) })) : null, image?.src ? jsx(Img, { className: "lg:hidden", image: image }) : null] })] }) }));
6731
- });
6732
-
6733
- const getVersion = (isPrimary, type) => isPrimary && type !== 'underlined' ? 'primary' : 'secondary';
6734
-
6735
- const getBadgeCount = (blocks = [], filter = {}) => blocks.filter(({ content = {} }) => targetMatchPattern(filter, content)).length;
6736
-
6737
- const scalarCmp = (a, b) => a === b;
6738
- const arrCmp = (cmp = scalarCmp) => (a, b) => a === b || Boolean(a && b && a.length === b.length && a.every((_, i) => cmp(_, b[i])));
6739
- const objCmp = (cmp) => (a, b) => a === b ||
6740
- Boolean(a &&
6741
- b &&
6742
- Object.keys(a).length === Object.keys(b).length &&
6743
- Object.entries(a).every(([key, value]) => cmp(value, b[key])));
6744
- function combineBoolCmps(...comparators) {
6745
- return (a, b) => comparators.some((cmp) => cmp(a, b));
6746
- }
6747
-
6748
- const hotFilterRecordCmp = objCmp(combineBoolCmps(scalarCmp, arrCmp()));
6749
-
6750
- const EMPTY_ARR = [];
6751
- const EMPTY_OBJ = {};
6752
- const useHotFilters = ({ hotFilters = EMPTY_ARR, filtrationState = EMPTY_OBJ, blocks = EMPTY_ARR, onFiltrationStateChange, }) => {
6753
- const activeItemIndex = useMemo(() => Math.max(0, hotFilters.findIndex((_) => hotFilterRecordCmp(_.filter, filtrationState))), [hotFilters, filtrationState]);
6754
- const items = useMemo(() => hotFilters.map((_) => ({
6755
- text: _.text,
6756
- count: getBadgeCount(blocks, _.filter),
6757
- version: getVersion(_ === hotFilters[activeItemIndex]),
6758
- })), [hotFilters, blocks, activeItemIndex]);
6759
- const handleChange = useCallback((_) => {
6760
- onFiltrationStateChange(hotFilters[items.indexOf(_)].filter);
6761
- }, [hotFilters, items]);
6762
- return {
6763
- activeItem: items[activeItemIndex],
6764
- items: items,
6765
- onChange: handleChange,
6766
- };
6767
- };
6768
-
6769
- const badgeBgStyleMap = {
6770
- primary: 'bg-white/30',
6771
- secondary: 'bg-main-divider',
6772
- };
6773
- const badgeTextColorStyleMap = {
6774
- primary: { desktop: 'text-white', mobile: 'text-primary-text' },
6775
- secondary: { desktop: 'text-secondary-text', mobile: 'text-secondary-text' },
6776
- };
6777
- const Badge$1 = JSX(({ count, version = 'secondary' }) => {
6778
- const isMobileMode = useMobileMode();
6779
- const badgeBgStyle = isMobileMode ? 'bg-main-divider' : badgeBgStyleMap[version];
6780
- const textStyle = badgeTextColorStyleMap[version][isMobileMode ? 'mobile' : 'desktop'];
6781
- return (jsx("div", { className: style('w-6 h-6 rounded-full flex items-center justify-center', badgeBgStyle), role: "status", "aria-label": `Количество ${count} доступных программ и сервисов`, children: jsx(Text, { size: "text-xs", color: textStyle, children: count }) }));
6782
- });
6783
-
6784
- const getButtonClassNames = (isActive) => ({
6785
- btn: `w-96 ${isActive ? 'p-m border-none bg-primary-main text-white' : 'p-s ease-in duration-300 bg-white'}`,
6786
- text: isActive ? 'mb-xs text-xl' : 'mb-2xs text-l text-primary-text',
6787
- desc: `font-light ${isActive ? 'text-l text-white' : 'text-m text-secondary-text'}`,
6788
- icon: isActive ? '' : 'text-primary-main',
6789
- iconVersion: (isActive ? 'white' : 'normal'),
6790
- oldText: 'text-m text-center',
6791
- oldDesc: 'text-m-light',
7109
+ onClick: () => handleActiveSlideIndex(i),
7110
+ })) })) : null, jsx("div", { className: "flex", style: { transform: `translateX(-${activeSlideIndex}00%)` }, role: "list", children: renderInsuranceGalleries({
7111
+ insuranceTabs,
7112
+ button,
7113
+ }) })] }));
6792
7114
  });
6793
- const renderTabItemInner = ({ text, description, icon, isActive, type, }) => {
6794
- const buttonClassNames = getButtonClassNames(isActive);
6795
- return (jsxs("div", { className: style('cursor-pointer text-left border-b-0 flex gap-2xs'), "aria-label": text, "aria-labelledby": `${text}-label`, children: [icon ? (jsx(Img, { className: style('h-6 w-6 min-w-6 min-h-6', buttonClassNames.icon), image: {
6796
- ...icon,
6797
- iconVersion: icon?.iconVersion ?? buttonClassNames.iconVersion,
6798
- }, width: "24", height: "24", alt: text })) : null, jsxs("div", { className: "border-0", children: [jsx("div", { className: type === 'animated' ? buttonClassNames.text : buttonClassNames.oldText, children: text }), jsx("div", { className: type === 'animated' ? buttonClassNames.desc : buttonClassNames.oldDesc, children: description })] })] }));
7115
+ const renderInsuranceGalleries = ({ insuranceTabs, button }) => {
7116
+ const insuranceGalleries = insuranceTabs?.map((_) => _.cards);
7117
+ return insuranceGalleries?.length
7118
+ ? insuranceGalleries.map((cards, i) => (jsx(InsuranceAmountBlockInner, { button: button, cards: cards }, String(i))))
7119
+ : null;
6799
7120
  };
7121
+ function renderNavButton$1({ title, i, isActive, onClick }) {
7122
+ const btnClassName = isActive ? 'bg-primary-main text-white rounded-md' : `text-secondary-text`;
7123
+ return (jsx("button", { type: "button", onClick: onClick, "aria-label": `Кнопка ${title}`, className: `box-border px-m py-s text-m font-light ${btnClassName}`, children: title }, String(i)));
7124
+ }
6800
7125
 
6801
- const tabPaddingStyleMap = {
6802
- default: 'px-xs',
6803
- underlined: 'px-m',
6804
- animated: 'px-m border border-gray cursor-pointer text-left border-b-0 mt-auto flex gap-2xs',
6805
- };
6806
- const tabTextStyle = 'text-secondary-text hover:text-primary-main';
6807
- const activeTabTextStyleMap = {
6808
- default: 'text-black sm:text-white',
6809
- underlined: 'text-primary-main border-b-2',
6810
- animated: 'text-white sm:text-white',
6811
- };
6812
- const tabBgStyleMap = {
6813
- default: 'bg-white',
6814
- underlined: 'bg-white',
6815
- animated: 'p-1 ease-in duration-300 bg-white text-primary-text h-[70px] w-96',
7126
+ const investmentCellColorMap = {
7127
+ yellow: 'bg-yellow',
7128
+ green: 'bg-green',
7129
+ 'green-light': 'bg-green-light',
7130
+ 'green-dark': 'bg-green-dark',
6816
7131
  };
6817
- const activeTabBgStyleMap = {
6818
- default: 'bg-white sm:bg-primary-main',
6819
- underlined: 'bg-white',
6820
- animated: 'p-2 border-none bg-primary-main text-white h-20 w-96',
7132
+ const investmentCellSizeMap = {
7133
+ XS: 'h-10',
7134
+ S: 'h-16',
7135
+ M: 'h-24',
7136
+ L: 'h-32',
7137
+ XL: 'h-52',
6821
7138
  };
6822
- const TabItemInner = JSX(({ tag = 'div', item = {}, isActive = false, type = 'default', onClick }) => {
6823
- const Tag = tag;
6824
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
6825
- const { text, description, icon, count, tabName, ...link } = item;
6826
- return (jsx(Tag, { className: style('h-12', 'block flex-1', 'cursor-pointer', tabPaddingStyleMap[type], isActive ? activeTabBgStyleMap[type] : tabBgStyleMap[type]), role: "tablist", "aria-label": "\u0421\u043F\u0438\u0441\u043E\u043A \u0442\u0430\u0431\u043E\u0432", onClick: onClick, ...link, children: jsxs("div", { className: style('h-full', 'flex justify-center items-center', 'text-center whitespace-nowrap', isActive ? activeTabTextStyleMap[type] : tabTextStyle), role: "tab", "aria-label": `Таб ${text}`, children: [renderTabItemInner({
6827
- text,
6828
- description,
6829
- icon,
6830
- isActive,
6831
- type,
6832
- }), Number.isInteger(count) ? (jsx("div", { className: "ml-xs", role: "status", "aria-label": `Количество программ и сервисов ${count}`, children: jsx(Badge$1, { count: count, version: getVersion(isActive, type) }) })) : null] }) }));
6833
- });
6834
-
6835
- const TabItem = JSX((props) => props?.item?.href ? jsx(LinkTabItem, { ...props }) : jsx(ButtonTabItem, { ...props }));
6836
- const LinkTabItem = JSX((props) => {
6837
- const link = useLink();
6838
- const handleClick = useCallback(() => {
6839
- props.onClick && props.onClick(props.item || {});
6840
- }, [props.onClick, props.item]);
6841
- const { onClick, ...item } = link({ ...props.item, onClick: handleClick });
6842
- return jsx(TabItemInner, { ...props, tag: "a", item: item, onClick: onClick });
6843
- });
6844
- // TODO: Update handlerDecorator (support buttons?)
6845
- const ButtonTabItem = JSX(({ item = {}, onClick, ...rest }) => {
6846
- const handleClick = useCallback(() => {
6847
- onClick && onClick(item);
6848
- }, [onClick, item]);
6849
- return jsx(TabItemInner, { item: item, onClick: handleClick, ...rest });
7139
+ const InvestmentInfo = JSX((props) => {
7140
+ const { className = '', __html, isDotted, investmentZeroColumn, investmentColumns, ...rest } = props;
7141
+ const columns = investmentColumns ? [...investmentColumns] : [];
7142
+ if (investmentZeroColumn) {
7143
+ columns.unshift(investmentZeroColumn);
7144
+ }
7145
+ return (jsx(BlockWrapper, { className: className, defaultPadding: "p-4xl", ...rest, children: jsxs("div", { className: "container text-m font-light space-y-4xl", children: [columns?.length ? (jsxs("div", { children: [jsxs("div", { className: "flex items-end relative pl-3xl pr-lg text-white", children: [joinList(jsx("div", { className: "w-px h-4 bg-gray" }))(columns.map(renderInvestmentColumn)), jsx("div", { className: "absolute right-3xl w-px h-4 bg-gray" })] }), jsx("div", { className: "border-t border-gray -mt-xs mx-3xl" }), jsx("div", { className: "flex justify-between text-primary-text mt-s -mx-5xl", children: columns.map(renderInvestmentColumnTitle) })] })) : null, __html ? (jsx("div", { className: "max-w-2xl font-light text-base", children: jsx(RichText, { __html: __html, isDotted: isDotted, itemSize: "list-s" }) })) : null] }) }));
6850
7146
  });
6851
-
6852
- const renderTab = (activeTab, onClick, type) => (tab, i) => (jsx(TabItem, { isActive: tab === activeTab, onClick: onClick, type: type, item: tab }, String(i)));
6853
-
6854
- const TabsControl = JSX(({ className, tabsType = 'default', items = [], activeItem, onChange }) => (jsx("div", { className: style('flex gap-x-2xs overflow-x-auto no-scrollbar', className), role: "tabpanel", "aria-label": "\u041F\u0430\u043D\u0435\u043B\u044C \u0443\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u044F \u0442\u0430\u0431\u0430\u043C\u0438", children: items.map(renderTab(activeItem, onChange, tabsType)) })));
6855
-
6856
- const initialFiltrationState = {
6857
- categories: [],
6858
- extraOptions: [],
6859
- propertyType: [],
6860
- stage: [],
7147
+ const renderInvestmentColumn = (column, i, arr) => {
7148
+ const isSecondColumn = i === 1;
7149
+ const isLastColumn = i === arr.length - 1;
7150
+ const reversedCells = column.cells?.reverse() || [];
7151
+ return (jsx("div", { className: `${getColumnClasses(isSecondColumn, isLastColumn, column.cells)}`, children: reversedCells.length ? (jsx("div", { className: `w-full ${isLastColumn ? 'border-4 border-green-more-dark p-1.5 min-w-72' : ''}`, children: reversedCells.map(renderInvestmentCell) })) : null }, `column_${i}`));
6861
7152
  };
6862
- const MortgageFiltration = UniBlock(({ className, hotFilters, filtrationSchema = {}, resetButton, ...rest }) => {
6863
- const [filtrationState, { blocksToRender }, { field, reset, update: replaceFiltrationState }] = useFiltrationForm(initialFiltrationState, {
6864
- block: rest.block,
6865
- page: rest.options?.page,
6866
- });
6867
- const handleFiltrationStateChange = useCallback((_ = initialFiltrationState) => replaceFiltrationState(_), []);
6868
- const tabsControlProps = useHotFilters({
6869
- hotFilters,
6870
- filtrationState,
6871
- blocks: rest.block?.blocks,
6872
- onFiltrationStateChange: handleFiltrationStateChange,
6873
- });
6874
- return (jsxs(BlockWrapper, { className: style('space-y-2xs', className), defaultPadding: "p-0", version: "transparent", ...rest, children: [jsx(TabsControl, { ...tabsControlProps }), jsx(FiltrationForm, { filtrationSchema: filtrationSchema, resetButton: resetButton, field: field, reset: reset }), jsx(FilteredBlocks, { blocksToRender: blocksToRender, ...rest })] }));
6875
- }, {
6876
- childrenTypes: ['ProductBlock'],
6877
- childSchema: (content) => content?.filtrationSchema || {},
6878
- });
6879
-
6880
- const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
6881
-
6882
- const isClient = !isSSR();
6883
- const ClientOnly = JSX(({ children }) => (isClient ? children : null));
7153
+ const getColumnClasses = (isSecondColumn, isLastColumn, cells = []) => [
7154
+ cells.length ? 'flex-1' : 'flex-0',
7155
+ cells.length && !isSecondColumn && !isLastColumn ? 'pl-s' : '',
7156
+ cells.length && !isLastColumn ? 'pr-s pb-3xl' : 'pb-xl',
7157
+ ].join(' ');
7158
+ const renderInvestmentCell = (cell, i) => {
7159
+ const cellSize = cell.cellSize || 'XS';
7160
+ const cellColor = cell.cellColor || 'green';
7161
+ return cell.text ? (jsx("div", { className: `flex-1 flex items-center justify-center relative py-xs ${investmentCellSizeMap[cellSize]} ${investmentCellColorMap[cellColor]} ${cellSize === 'XS' ? 'px-s' : 'px-5xl'}`, children: jsx(Text, { align: "text-center", children: cell.text }) }, `cell_${i}`)) : null;
7162
+ };
7163
+ const renderInvestmentColumnTitle = (column, i) => column?.title ? (jsx("div", { className: "flex-1 max-w-44 text-center px-xs last:pr-4xl last:max-w-52", children: column.title }, `title_${i}`)) : null;
6884
7164
 
6885
- const MapMarkerClusterIcon = '/icons/MapMarkerClusterIcon.svg';
6886
- const MapMarkerClusterYellowIcon = '/icons/MapMarkerClusterYellowIcon.svg';
6887
- function renderClusterer({ yandexMaps, map, points, isLoad, }) {
6888
- if (isLoad || !points) {
6889
- return;
6890
- }
6891
- map.geoObjects.removeAll();
6892
- if (!points.length) {
6893
- return;
6894
- }
6895
- const clusterIconContentLayout = yandexMaps.templateLayoutFactory.createClass('<div style="margin-top: -3px;">{{properties.geoObjects.length}}</div>');
6896
- const officeClusterer = defineClusterer('offices', yandexMaps, clusterIconContentLayout);
6897
- if (points.length && points.every((_) => 'type' in _)) {
6898
- const remoteWorkplaceClusterer = defineClusterer('workplaces', yandexMaps, clusterIconContentLayout);
6899
- const remoteWorkplaceGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'workplaces'), 'workplaces', yandexMaps);
6900
- const officesGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'offices'), 'offices', yandexMaps);
6901
- officeClusterer.add(officesGeoObjects);
6902
- remoteWorkplaceClusterer.add(remoteWorkplaceGeoObjects);
6903
- map.geoObjects.add(remoteWorkplaceClusterer);
6904
- map.geoObjects.add(officeClusterer);
6905
- }
6906
- else {
6907
- const geoObjects = defineGeoObjects(points, 'offices', yandexMaps);
6908
- officeClusterer.add(geoObjects);
6909
- map.geoObjects.add(officeClusterer);
7165
+ const KILO = 1024;
7166
+ const KILO_SIZES = ['байт', 'Кб', 'Мб', 'Гб', 'Тб', 'Пб'];
7167
+ const formatBytes = (bytes, decimals = 2) => {
7168
+ if (bytes === 0) {
7169
+ return '';
6910
7170
  }
6911
- map.setBounds(yandexMaps.util.bounds.fromPoints(points.map((_) => _.coords))).then(() => {
6912
- if (map.getZoom() > 10) {
6913
- map.setZoom(10);
6914
- }
6915
- });
6916
- }
6917
- const defineClusterer = (type, yandexMaps, clusterIconContentLayout) => {
6918
- return new yandexMaps.Clusterer({
6919
- clusterIcons: [
6920
- {
6921
- href: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
6922
- size: [78, 84],
6923
- offset: [-35, -50],
6924
- },
6925
- ],
6926
- clusterIconContentLayout,
6927
- clusterHideIconOnBalloonOpen: false,
6928
- geoObjectHideIconOnBalloonOpen: false,
6929
- });
6930
- };
6931
- const defineGeoObjects = (pointArr, type, yandexMaps) => {
6932
- return pointArr.map(({ coords, content }) => new yandexMaps.Placemark(coords, {
6933
- balloonContentHeader: content?.header,
6934
- balloonContentBody: content?.body,
6935
- balloonContentFooter: content?.footer,
6936
- hintContent: content?.hint,
6937
- }, {
6938
- iconLayout: 'default#image',
6939
- iconImageHref: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
6940
- iconImageSize: [78, 84],
6941
- iconImageOffset: [-35, -50],
6942
- }));
7171
+ const i = Math.floor(Math.log(bytes) / Math.log(KILO));
7172
+ return `${parseFloat((bytes / Math.pow(KILO, i)).toFixed(decimals))} ${KILO_SIZES[i]}`;
6943
7173
  };
6944
7174
 
6945
- const defaultStyle = {
6946
- focus: 'focus:border-primary-text focus:border',
6947
- hover: 'hover:bg-primary-hover',
6948
- active: 'active:bg-primary-active',
6949
- font: 'text-center font-sans',
6950
- };
7175
+ const LinkDocItem = JSX(({ icon, text, href, target, fileFormat, data, fileSize }) => {
7176
+ const prefix = fileSize && fileFormat ? ',' : '';
7177
+ const size = fileSize ?? '';
7178
+ const format = fileFormat ? String(fileFormat) : '';
7179
+ return (jsxs("a", { className: "flex box-border gap-s group/item h-fit w-fit text-primary-text no-underline hover:text-primary-main", href: href, target: target, ...getAspectsAttributes(data), children: [icon, text ? (jsxs(Text, { size: "text-l", font: "font-light", children: [text, " ", addSpace(size, format), jsx(Text, { color: "text-secondary-text", children: href && `${size + prefix + format}` })] })) : null] }));
7180
+ });
7181
+ const addSpace = (size, format) => (size || format ? jsx("span", { children: ",\u00A0" }) : '');
6951
7182
 
6952
- const styles$1 = {
6953
- ...defaultStyle,
6954
- border: 'border border-transparent rounded-md',
6955
- position: 'absolute flex items-center justify-center',
7183
+ const linkIconStyle = 'min-w-6 min-h-6';
7184
+
7185
+ const renderDefaultItem = (router, icon) => (docBlockDef, i) => {
7186
+ const href = adjustHref(router)(docBlockDef?.docType === 'Attachment' ? docBlockDef?.attachment?.src : docBlockDef?.href);
7187
+ const fileSize = docBlockDef?.docType === 'Attachment'
7188
+ ? formatBytes(docBlockDef?.attachment?.fileSize || 0)
7189
+ : docBlockDef?.fileSize;
7190
+ const fileFormat = docBlockDef?.docType === 'Attachment' ? getExtFromHref(href) : docBlockDef?.fileFormat;
7191
+ return (jsxs("div", { role: "listitem", children: [jsx(LinkDocItem, { text: docBlockDef?.text, target: docBlockDef?.target, href: href, fileFormat: fileFormat, fileSize: fileSize, icon: renderImg(icon), data: docBlockDef?.data }), jsx(RichText, { __html: docBlockDef?.__html })] }, String(i)));
6956
7192
  };
6957
- const renderUserGeolocation = (map, yandexMaps, className) => {
6958
- const setUserGeoLocation = () => {
6959
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
6960
- // @ts-ignore
6961
- yandexMaps.geolocation
6962
- .get({
6963
- provider: 'yandex',
6964
- autoReverseGeocode: true,
6965
- mapStateAutoApply: true,
6966
- })
6967
- .then(function (result) {
6968
- map.current.geoObjects.add(result.geoObjects);
6969
- });
6970
- };
6971
- return (jsx("div", { className: `select-none cursor-pointer py-m w-12 bg-white ${Object.values(styles$1).join(' ')} ${className}`, onClick: setUserGeoLocation, children: jsx(Icon, { name: "UserGeoLocationIcon", width: "20", height: "16" }) }));
7193
+ const renderImg = (icon) => icon ? jsx(Img, { className: linkIconStyle, image: icon, width: "24", height: "24" }) : null;
7194
+ const getExtFromHref = (href) => {
7195
+ if (!href) {
7196
+ return '';
7197
+ }
7198
+ const index = href.lastIndexOf('.');
7199
+ const regexp = new RegExp(/\/(.*)/);
7200
+ const docFormat = index !== -1 ? href.substring(index + 1) : '';
7201
+ return docFormat.includes('/') ? docFormat.replace(regexp, '') : docFormat;
6972
7202
  };
6973
7203
 
6974
- const YMAPS_NAMESPACE = 'ymaps';
6975
- const useYandexMaps = () => {
6976
- const url = `https://api-maps.yandex.ru/2.1/?apikey=${projectSettings.YANDEX_MAP_API_KEY || ''}&lang=ru_RU`;
6977
- return useExternalNS(YMAPS_NAMESPACE, url, false);
6978
- };
7204
+ const ReportDialog = JSX(({ href, __html, target }) => {
7205
+ const { close } = useDialogManager();
7206
+ const router = useRouter();
7207
+ const adjustedHref = adjustHref(router)(href);
7208
+ const handleClose = useCallback(() => {
7209
+ close();
7210
+ }, []);
7211
+ return (jsxs(Dialog, { className: "my-6xl min-h-fit w-fit mx-auto", children: [__html ? jsx(RichText, { __html: __html }) : null, jsxs("div", { className: "flex flex-row mx-auto w-fit gap-lg py-lg", children: [jsx(LinkButton, { text: "\u042F \u0441\u043E\u0433\u043B\u0430\u0441\u0435\u043D", version: "primary", target: target, href: adjustedHref, onClick: handleClose }), jsx(Button, { type: "button", version: "secondary", onClick: handleClose, children: "\u042F \u043D\u0435 \u0441\u043E\u0433\u043B\u0430\u0441\u0435\u043D" })] }), jsx("div", { children: "\u041D\u0430\u0436\u0438\u043C\u0430\u044F \u043A\u043D\u043E\u043F\u043A\u0443 \u00AB\u042F \u0421\u041E\u0413\u041B\u0410\u0421\u0415\u041D\u00BB \u043D\u0438\u0436\u0435 \u0412\u044B \u043F\u0440\u0438\u043D\u0438\u043C\u0430\u0435\u0442\u0435 \u0434\u0430\u043D\u043D\u044B\u0435 \u0443\u0441\u043B\u043E\u0432\u0438\u044F. \u0420\u0430\u0441\u043F\u0440\u043E\u0441\u0442\u0440\u0430\u043D\u0435\u043D\u0438\u0435 \u0438\u043B\u0438 \u0440\u0430\u0441\u043A\u0440\u044B\u0442\u0438\u0435 \u043B\u044E\u0431\u043E\u0439 \u0447\u0430\u0441\u0442\u0438 \u0434\u0430\u043D\u043D\u043E\u0433\u043E \u0417\u0430\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u044F \u0438\u043B\u0438 \u043B\u044E\u0431\u043E\u0439 \u0438\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u0438, \u0438\u043B\u0438 \u0440\u0435\u043A\u043E\u043C\u0435\u043D\u0434\u0430\u0446\u0438\u0438 \u0432 \u043D\u0435\u043C \u0437\u0430\u043F\u0440\u0435\u0449\u0435\u043D\u043E.\u00BB" })] }));
7212
+ });
6979
7213
 
6980
- const styles = {
6981
- ...defaultStyle,
6982
- border: 'border-b border-b-2 border-gray last:border-0',
6983
- position: 'relative flex items-center justify-center',
6984
- };
6985
- // TODO: Добавить метод определения центральной точки
6986
- const ZoomButton = JSX(({ yandexMaps, direction = 'in' }) => {
6987
- const iconName = direction === 'in' ? 'PlusIcon' : 'MinusIcon';
6988
- const changeZoom = () => {
6989
- const currentZoom = yandexMaps.current.getZoom();
6990
- const newZoom = direction === 'in' ? currentZoom + 1 : currentZoom - 1;
6991
- yandexMaps.current.setZoom(newZoom, { checkZoomRange: true });
7214
+ const useReportDialog = (props) => {
7215
+ const { open, close } = useDialogManager();
7216
+ return {
7217
+ open: (options = {}) => open(jsx(ReportDialog, { ...props }), options),
7218
+ close,
6992
7219
  };
6993
- return (jsx("div", { onClick: changeZoom, className: `${Object.values(styles).join(' ')} bg-white select-none cursor-pointer w-12 h-12`, children: jsx(Icon, { name: iconName, width: "20", height: "16" }) }));
6994
- });
7220
+ };
6995
7221
 
6996
- const DEFAULT_CENTER_COORDS = [55.753995, 37.614069];
6997
- // TODO: Поле для поиска: невыяснено среди каких данных делать поиск (искать в имени офиса, в адресе, метро и т.д.).
6998
- // Сейчас реализован поиск среди тестовых данных
6999
- // TODO: Также выяснить что делать когда ничего не найдено
7000
- // TODO: На макетах также когда есть поле поиска нет кнопки открыть на карте.
7001
- const YandexMap = JSX(({ points, className = '', zoom = 5, isLoad }) => {
7002
- const map = useRef(null);
7003
- const yandexMaps = useYandexMaps();
7004
- useEffect(() => {
7005
- if (map.current) {
7006
- renderClusterer({ yandexMaps, map: map.current, points, isLoad });
7007
- }
7008
- else {
7009
- yandexMaps?.ready(() => {
7010
- // Ready function may be called few times, but must be called once
7011
- if (map.current) {
7012
- renderClusterer({ yandexMaps, map: map.current, points, isLoad });
7013
- return;
7014
- }
7015
- map.current = new yandexMaps.Map('map', {
7016
- center: getCenterPoint(points),
7017
- zoom,
7018
- controls: [],
7019
- suppressMapOpenBlock: true,
7020
- });
7021
- renderClusterer({ yandexMaps, map: map.current, points, isLoad });
7022
- });
7023
- }
7024
- }, [yandexMaps, points, zoom, isLoad]);
7025
- if (!yandexMaps) {
7222
+ const ReportDialogButton = JSX(({ text, href, target, __html, icon }) => {
7223
+ if (!text && !__html) {
7026
7224
  return null;
7027
7225
  }
7028
- const zIndex = 'z-10';
7029
- return (jsxs("div", { id: "map", className: style('relative', 'w-full', className), children: [isLoad ? jsx(Loader, {}) : null, jsxs("div", { className: style('absolute right-2 top-52 z-10 w-12 overflow-hidden border border-transparent rounded-md', zIndex), children: [jsx(ZoomButton, { yandexMaps: map }), jsx(ZoomButton, { yandexMaps: map, direction: "out" })] }), renderUserGeolocation(map, yandexMaps, style('right-2 top-80', zIndex))] }));
7226
+ const reportDialog = useReportDialog({ __html, href, target });
7227
+ const openReportDialog = useCallback(() => reportDialog.open(), [reportDialog]);
7228
+ return (jsxs("button", { className: "flex gap-s text-primary-text no-underline hover:text-primary-main", onClick: openReportDialog, children: [renderImg(icon), jsx(Text, { font: "font-light", children: text })] }));
7030
7229
  });
7031
- const getCenterPoint = (points) => {
7032
- const centerCoords = [
7033
- getArraySumAndAverage(mapByIndex(points, 0)),
7034
- getArraySumAndAverage(mapByIndex(points, 1)),
7035
- ];
7036
- return centerCoords.every((_) => _) ? centerCoords : DEFAULT_CENTER_COORDS;
7037
- };
7038
- const mapByIndex = (points, index) => points.map((_) => _.coords?.[index]);
7039
- const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
7040
7230
 
7041
- const INITIAL_FILTRATION_STATE$1 = {
7042
- workingSaturday: false,
7043
- premiumService: false,
7044
- privateBanking: false,
7045
- remoteWorkplace: false,
7046
- serviceDisabledPeople: false,
7047
- sellingCoins: false,
7048
- buyingCoins: false,
7049
- bullionOperations: false,
7050
- preciousMetalsOperations: false,
7051
- transferringDataToBiometricSystem: false,
7231
+ const linkColumnsModeStyleMap = {
7232
+ double: 'sm:flex-wrap sm:flex-row',
7233
+ single: 'sm:flex-col',
7052
7234
  };
7053
- const FILTRATION_LABELS = {
7054
- safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
7055
- workingSaturday: 'Открыты по субботам',
7056
- terminalTypeAtms: 'Банкоматы',
7057
- terminalTypeTerm: 'Терминалы',
7058
- workAllTime: 'Круглосуточно',
7059
- billAcceptorEnable: 'Прием наличных',
7060
- premiumService: 'Премиальное обслуживание',
7061
- privateBanking: 'Услуга Private banking',
7062
- sellingCoins: 'Продажа монет из драгоценных металлов',
7063
- buyingCoins: 'Покупка монет из драгоценных металлов',
7064
- bullionOperations: 'Операции со слитками',
7065
- preciousMetalsOperations: 'Операции с драгоценными металлами',
7066
- transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
7067
- locationDisabledPeople: 'Для маломобильных',
7068
- designDisabledPeople: 'Для слабовидящих',
7069
- remoteWorkplace: 'Удаленное рабочее место',
7070
- serviceDisabledPeople: 'Для маломобильных граждан',
7235
+ const LinkDocs = UniBlock(({ className = '', title, description, align = 'text-center', documents, icon = { icon: 'DocIcon' }, columnsMode = 'double', ...rest }) => {
7236
+ const router = useRouter();
7237
+ return (jsxs(BlockWrapper, { className: style('space-y-lg', className), defaultPadding: "p-6xl", ...rest, children: [jsx(Headline, { title: title, description: description, align: align, headlineVersion: "M", as: "h2", isEmbedded: true }), documents?.length ? (jsx("div", { className: style('grid gap-xl', columnsMode === 'double' ? '@md:grid-cols-2' : 'grid-cols-1', linkColumnsModeStyleMap[columnsMode]), role: "list", children: documents.map(renderLinkDocItem(router, icon)) })) : null] }));
7238
+ });
7239
+ const renderLinkDocItem = (router, icon) => (docBlockDef, i) => {
7240
+ const docType = docBlockDef?.docType;
7241
+ if (docType === '') {
7242
+ return null;
7243
+ }
7244
+ if ('reportSource' in docBlockDef && docBlockDef?.reportSource?.__html) {
7245
+ return renderModalItem(icon)(docBlockDef, i);
7246
+ }
7247
+ return renderDefaultItem(router, icon)(docBlockDef, i);
7071
7248
  };
7072
- const FILTRATION_PREDICATES$1 = {
7073
- workingSaturday: (item) => Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
7074
- premiumService: (item) => Boolean('premiumService' in item && item.premiumService),
7075
- privateBanking: (item) => Boolean('privateBanking' in item && item.privateBanking),
7076
- remoteWorkplace: (item) => Boolean('workScheduleDescription' in item),
7077
- serviceDisabledPeople: (item) => Boolean('serviceDisabledPeople' in item && item.serviceDisabledPeople),
7078
- sellingCoins: (item) => Boolean('sellingCoins' in item && item.sellingCoins),
7079
- buyingCoins: (item) => Boolean('buyingCoins' in item && item.buyingCoins),
7080
- bullionOperations: (item) => Boolean('bullionOperations' in item && item.bullionOperations),
7081
- preciousMetalsOperations: (item) => Boolean('preciousMetalsOperations' in item && item.preciousMetalsOperations),
7082
- transferringDataToBiometricSystem: (item) => Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
7249
+ const renderModalItem = (icon) => (props, i) => {
7250
+ const commonProps = {
7251
+ text: props.text,
7252
+ target: props.target,
7253
+ __html: props.reportSource?.__html,
7254
+ };
7255
+ return props.reportSource?.__html && props.text ? (jsxs("div", { role: "listitem", children: [jsx(ReportDialogButton, { ...commonProps, icon: icon, href: isLinkDoc(props) ? props?.href : props?.attachment?.src }), jsx(RichText, { __html: props?.__html })] }, String(i))) : null;
7083
7256
  };
7257
+ const isLinkDoc = (data) => 'href' in data;
7084
7258
 
7085
- const renderButtonsGroup = (data, activeButton, onButtonClick) => {
7086
- const allButtonVersion = getVersion(activeButton === 'all');
7087
- const businessButtonVersion = getVersion(activeButton === 'business');
7088
- const handleClick = (e, key, branches) => {
7089
- const filteredBranches = e.currentTarget === e.target && key === 'business' ? filterBranches(branches) : branches;
7090
- onButtonClick(key);
7091
- return filteredBranches;
7259
+ const MobileAppTile = UniBlock(({ className, padding, align = 'text-left', buttons = [], description, image, __html, headingType, qr, additionalDescription = '', title = 'Мобильное приложение', version = 'primary', ...rest }) => {
7260
+ const containerStyle = version === 'secondary' ? 'p-m min-w-32' : 'min-w-24';
7261
+ const img = image?.src ? jsx(Img, { className: "hidden lg:block", image: image }) : null;
7262
+ return (jsx(BlockWrapper, { className: style('min-h-80', className), padding: "p-0", version: version, ...rest, children: jsxs(BaseTile, { className: "h-full", padding: padding, defaultPadding: "p-6xl", title: jsx(Heading, { headingType: headingType, title: title, className: style('whitespace-pre-wrap', align) }), rightImage: img, buttons: renderButtonsSection(buttons, { className: 'flex-wrap' }), children: [description ? (jsx(Text, { size: "text-xl", "font-weight": "font-light", children: description })) : null, jsxs("div", { className: style('gap-m', 'flex flex-1 flex-col', 'flex-col items-start @xl:flex-row @xl:items-center'), children: [__html ? jsx(RichText, { __html: __html, itemSize: "list-m" }) : null, jsx(Text, { size: "text-m", "font-weight": "font-light", color: "text-secondary-text", children: additionalDescription }), qr?.src ? (jsx("div", { className: style('flex justify-center bg-white rounded-md @xl:-order-1', containerStyle), children: jsx(Img, { className: "w-fit", image: qr }) })) : null, image?.src ? jsx(Img, { className: "lg:hidden", image: image }) : null] })] }) }));
7263
+ });
7264
+
7265
+ const getBadgeCount = (blocks = [], filter = {}) => blocks.filter(({ content = {} }) => targetMatchPattern(filter, content)).length;
7266
+
7267
+ const scalarCmp = (a, b) => a === b;
7268
+ const arrCmp = (cmp = scalarCmp) => (a, b) => a === b || Boolean(a && b && a.length === b.length && a.every((_, i) => cmp(_, b[i])));
7269
+ const objCmp = (cmp) => (a, b) => a === b ||
7270
+ Boolean(a &&
7271
+ b &&
7272
+ Object.keys(a).length === Object.keys(b).length &&
7273
+ Object.entries(a).every(([key, value]) => cmp(value, b[key])));
7274
+ function combineBoolCmps(...comparators) {
7275
+ return (a, b) => comparators.some((cmp) => cmp(a, b));
7276
+ }
7277
+
7278
+ const hotFilterRecordCmp = objCmp(combineBoolCmps(scalarCmp, arrCmp()));
7279
+
7280
+ const EMPTY_ARR = [];
7281
+ const EMPTY_OBJ = {};
7282
+ const useHotFilters = ({ hotFilters = EMPTY_ARR, filtrationState = EMPTY_OBJ, blocks = EMPTY_ARR, onFiltrationStateChange, }) => {
7283
+ const activeItemIndex = useMemo(() => Math.max(0, hotFilters.findIndex((_) => hotFilterRecordCmp(_.filter, filtrationState))), [hotFilters, filtrationState]);
7284
+ const items = useMemo(() => hotFilters.map((_) => ({
7285
+ text: _.text,
7286
+ count: getBadgeCount(blocks, _.filter),
7287
+ version: getVersion(_ === hotFilters[activeItemIndex]),
7288
+ })), [hotFilters, blocks, activeItemIndex]);
7289
+ const handleChange = useCallback((_) => {
7290
+ onFiltrationStateChange(hotFilters[items.indexOf(_)].filter);
7291
+ }, [hotFilters, items]);
7292
+ return {
7293
+ activeItem: items[activeItemIndex],
7294
+ items: items,
7295
+ onChange: handleChange,
7092
7296
  };
7093
- const filterBranches = (branches) => branches.filter((branch) => branch.workSchedule &&
7094
- branch.workSchedule.businessScheduleVisibleTag &&
7095
- !branch.workSchedule.businessScheduleDescription);
7096
- return (jsxs("div", { className: "flex gap-lg flex-col sm:flex-row pb-lg", children: [jsx(Button, { "data-id": "all", onClick: (e) => handleClick(e, 'all', data), version: allButtonVersion, children: "\u0414\u043B\u044F \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446" }), jsx(Button, { "data-id": "business", onClick: (e) => handleClick(e, 'business', data), version: businessButtonVersion, children: "\u0414\u043B\u044F \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446" })] }));
7097
7297
  };
7098
7298
 
7099
- const renderDescriptionBlock$1 = ({ __html, list, richVersion }) => __html || list?.length ? (jsxs("div", { className: "mb-2xl border-b sm:border border-main-divider sm:rounded-md", children: [__html ? (jsx("div", { className: "mb-2xl", children: jsx(RichText, { __html: __html, richVersion: richVersion }) })) : null, list?.length ? (jsx("div", { className: "flex flex-col sm:flex-row gap-2xl sm:flex-wrap pb-2xl sm:pb-xl", 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;
7100
-
7101
- const COMMON_FILTERS_STYLES = 'flex flex-col sm:flex-row sm:flex-wrap gap-3xl pb-2xl';
7102
- const renderFiltrationForm = ({ filters, field: { field, reset }, onlyOffice, labels, }) => {
7103
- const visibleFiltersNum = onlyOffice ? 5 : 6;
7104
- const filtersCheckbox = (filters || []).map((key) => (jsx(Checkbox, { text: labels[key], ...field(key) }, key)));
7105
- const [visibleFilters, hiddenFilters] = visibleFiltersNum > 0
7106
- ? [filtersCheckbox.slice(0, visibleFiltersNum), filtersCheckbox.slice(visibleFiltersNum)]
7107
- : [filtersCheckbox, []];
7108
- return (jsx("div", { children: filters?.length ? (jsx("div", { children: jsx(Foldable, { renderFoldableSection: ({ isUnfolded }) => (jsxs("div", { children: [jsx("div", { className: COMMON_FILTERS_STYLES, children: visibleFilters }), jsx(FoldableSection, { className: COMMON_FILTERS_STYLES, isUnfolded: isUnfolded, children: hiddenFilters })] })), renderFoldButton: renderFoldButton$2(reset, onlyOffice) }) })) : null }));
7299
+ const badgeBgStyleMap = {
7300
+ primary: 'bg-white/30',
7301
+ secondary: 'bg-main-divider',
7109
7302
  };
7110
- const renderFoldButton$2 = (reset, onlyOffice = false) => ({ isUnfolded, onToggle }) => {
7111
- const labels = ['Больше фильтров', 'Меньше фильтров'];
7112
- const icons = ['ArrowDownIcon', 'ArrowUpIcon'];
7113
- return (jsxs("div", { className: "flex space-x-lg", children: [onlyOffice ? (jsx(LinkButton, { version: "transparent", className: "text-secondary-text [&>*]:p-0", appendRight: jsx(Icon, { name: icons[Number(isUnfolded)], width: "16", height: "16" }), text: labels[Number(isUnfolded)], onClick: onToggle })) : null, jsx(LinkButton, { version: "transparent", className: "text-secondary-text [&>*]:p-0", onClick: reset, children: renderBtnInner() })] }));
7303
+ const badgeTextColorStyleMap = {
7304
+ primary: { desktop: 'text-white', mobile: 'text-primary-text' },
7305
+ secondary: { desktop: 'text-secondary-text', mobile: 'text-secondary-text' },
7114
7306
  };
7115
- const renderBtnInner = () => (jsxs("div", { className: "flex items-center", children: ["\u041E\u0447\u0438\u0441\u0442\u0438\u0442\u044C \u0444\u0438\u043B\u044C\u0442\u0440", jsx(Icon, { name: "CloseIcon", width: "16", height: "16", className: "ml-2xs" })] }));
7116
-
7117
- const renderHeading = (title, lengthItems) => (jsx("div", { className: "flex flex-col sm:flex-row gap-xs mb-2xl", children: jsxs(Heading, { headingType: "h3", children: [jsx("span", { suppressHydrationWarning: true, children: title }), lengthItems ? (jsx(Text, { size: "text-h2", color: "text-secondary-text", children: jsx("span", { suppressHydrationWarning: true, children: ` (${lengthItems})` }) })) : null] }) }));
7307
+ const Badge = JSX(({ count, version = 'secondary' }) => {
7308
+ const isMobileMode = useMobileMode();
7309
+ const badgeBgStyle = isMobileMode ? 'bg-main-divider' : badgeBgStyleMap[version];
7310
+ const textStyle = badgeTextColorStyleMap[version][isMobileMode ? 'mobile' : 'desktop'];
7311
+ return (jsx("div", { className: style('w-6 h-6 rounded-full flex items-center justify-center', badgeBgStyle), role: "status", "aria-label": `Количество ${count} доступных программ и сервисов`, children: jsx(Text, { size: "text-xs", color: textStyle, children: count }) }));
7312
+ });
7118
7313
 
7119
- const defaultEmptyFunction = () => void 0;
7120
- const filtersVisibleStyles = (activeButton) => activeButton === 'all' ? 'block' : 'hidden';
7121
- const OfficesAtmsMapLayout = JSX(({ className, data = [], isLoad, remoteWorkplaces = [], renderCard = defaultEmptyFunction, renderRemoteWorkplaceCard = defaultEmptyFunction, getBalloon = defaultEmptyFunction, getBalloonRemoteWorkplaces = defaultEmptyFunction, descriptionData, title, }) => {
7122
- const onlyOffice = title?.includes('Офис');
7123
- const [filtrationState, { field, reset }] = useForm(INITIAL_FILTRATION_STATE$1);
7124
- const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
7125
- const _filteredItems = filterItems$1(data, filtrationState);
7126
- const _filteredRemoteWorkplaces = filterItems$1(remoteWorkplaces, filtrationState);
7127
- const _points = [
7128
- ..._filteredItems.map((_) => ({
7129
- type: 'offices',
7130
- coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
7131
- content: getBalloon(_),
7132
- })),
7133
- ..._filteredRemoteWorkplaces.map((_) => ({
7134
- type: 'workplaces',
7135
- coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
7136
- content: getBalloonRemoteWorkplaces({
7137
- address: _.address,
7138
- workScheduleDescription: _.workScheduleDescription,
7139
- }),
7140
- })),
7141
- ].filter((_) => _.coords && _.coords.length === 2);
7142
- const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
7143
- return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
7144
- }, [data, remoteWorkplaces, filtrationState]);
7145
- const [activeButton, setActiveButton] = useState('all');
7146
- const filterOptions = {
7147
- filters: getFiltersWithNonEmptyData([...data, ...remoteWorkplaces]),
7148
- field: { field, reset },
7149
- onlyOffice,
7150
- labels: FILTRATION_LABELS,
7151
- };
7152
- return (jsxs("div", { className: style('space-y-1', className), children: [jsxs("div", { className: "bg-white", children: [jsxs("div", { className: "p-3xl pb-0", children: [renderHeading(title, lengthItems), descriptionData ? renderDescriptionBlock$1(descriptionData) : null, onlyOffice && renderButtonsGroup(data, activeButton, setActiveButton), jsx("div", { className: style('pb-3xl', filtersVisibleStyles(activeButton)), children: renderFiltrationForm(filterOptions) })] }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: isLoad, className: "h-full" }) }) })] }), jsxs(ClientOnly, { children: [filteredItems.map(renderCard), filteredRemoteWorkplaces.map(renderRemoteWorkplaceCard)] })] }));
7314
+ const getButtonClassNames = (isActive) => ({
7315
+ btn: `w-96 ${isActive ? 'p-m border-none bg-primary-main text-white' : 'p-s ease-in duration-300 bg-white'}`,
7316
+ text: isActive ? 'mb-xs text-xl' : 'mb-2xs text-l text-primary-text',
7317
+ desc: `font-light ${isActive ? 'text-l text-white' : 'text-m text-secondary-text'}`,
7318
+ icon: isActive ? '' : 'text-primary-main',
7319
+ iconVersion: (isActive ? 'white' : 'normal'),
7320
+ oldText: 'text-m text-center',
7321
+ oldDesc: 'text-m-light',
7153
7322
  });
7154
- const filterItems$1 = (data, filtrationState) => {
7155
- const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
7156
- return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES$1[_](item)));
7323
+ const renderTabItemInner = ({ text, description, icon, isActive, type, }) => {
7324
+ const buttonClassNames = getButtonClassNames(isActive);
7325
+ return (jsxs("div", { className: style('cursor-pointer text-left border-b-0 flex gap-2xs'), "aria-label": text, "aria-labelledby": `${text}-label`, children: [icon ? (jsx(Img, { className: style('h-6 w-6 min-w-6 min-h-6', buttonClassNames.icon), image: {
7326
+ ...icon,
7327
+ iconVersion: icon?.iconVersion ?? buttonClassNames.iconVersion,
7328
+ }, width: "24", height: "24", alt: text })) : null, jsxs("div", { className: "border-0", children: [jsx("div", { className: type === 'animated' ? buttonClassNames.text : buttonClassNames.oldText, children: text }), jsx("div", { className: type === 'animated' ? buttonClassNames.desc : buttonClassNames.oldDesc, children: description })] })] }));
7157
7329
  };
7158
- const getFiltersWithNonEmptyData = (data) => Object.keys(INITIAL_FILTRATION_STATE$1).filter((_) => data.filter((item) => FILTRATION_PREDICATES$1[_](item)).length);
7159
7330
 
7160
- const colorStyle = {
7161
- yellow: { border: 'border-yellow-light', text: 'text-yellow' },
7162
- green: { border: 'border-green-more-light', text: 'text-green-dark' },
7163
- gray: { border: 'border-gray', text: 'text-secondary-text' },
7164
- red: { border: 'border-error/30', text: 'text-error' },
7331
+ const tabPaddingStyleMap = {
7332
+ default: 'px-xs',
7333
+ underlined: 'px-m',
7334
+ animated: 'px-m border border-gray cursor-pointer text-left border-b-0 mt-auto flex gap-2xs',
7335
+ };
7336
+ const tabTextStyle = 'text-secondary-text hover:text-primary-main';
7337
+ const activeTabTextStyleMap = {
7338
+ default: 'text-black sm:text-white',
7339
+ underlined: 'text-primary-main border-b-2',
7340
+ animated: 'text-white sm:text-white',
7341
+ };
7342
+ const tabBgStyleMap = {
7343
+ default: 'bg-white',
7344
+ underlined: 'bg-white',
7345
+ animated: 'p-1 ease-in duration-300 bg-white text-primary-text h-[70px] w-96',
7346
+ };
7347
+ const activeTabBgStyleMap = {
7348
+ default: 'bg-white sm:bg-primary-main',
7349
+ underlined: 'bg-white',
7350
+ animated: 'p-2 border-none bg-primary-main text-white h-20 w-96',
7165
7351
  };
7166
- const Badge = JSX(({ className, children, color = 'gray' }) => (jsxs("div", { className: style('sm:p-s sm:border sm:border-green rounded-md flex items-center h-fit', colorStyle[color].border, className), children: [jsx("div", { className: "block pr-m sm:pr-0 sm:hidden", children: jsx(Img, { image: { icon: 'SmallClockIcon' }, width: "24", height: "24" }) }), jsx(Text, { size: "text-m", color: colorStyle[color].text, children: children })] })));
7352
+ const TabItemInner = JSX(({ tag = 'div', item = {}, isActive = false, type = 'default', onClick }) => {
7353
+ const Tag = tag;
7354
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
7355
+ const { text, description, icon, count, tabName, ...link } = item;
7356
+ return (jsx(Tag, { className: style('h-12', 'block flex-1', 'cursor-pointer', tabPaddingStyleMap[type], isActive ? activeTabBgStyleMap[type] : tabBgStyleMap[type]), role: "tablist", "aria-label": "\u0421\u043F\u0438\u0441\u043E\u043A \u0442\u0430\u0431\u043E\u0432", onClick: onClick, ...link, children: jsxs("div", { className: style('h-full', 'flex justify-center items-center', 'text-center whitespace-nowrap', isActive ? activeTabTextStyleMap[type] : tabTextStyle), role: "tab", "aria-label": `Таб ${text}`, children: [renderTabItemInner({
7357
+ text,
7358
+ description,
7359
+ icon,
7360
+ isActive,
7361
+ type,
7362
+ }), Number.isInteger(count) ? (jsx("div", { className: "ml-xs", role: "status", "aria-label": `Количество программ и сервисов ${count}`, children: jsx(Badge, { count: count, version: getVersion(isActive, type) }) })) : null] }) }));
7363
+ });
7167
7364
 
7168
- const CardCell = JSX(({ value, subText, children, isPhone, ...props }) => {
7169
- const textItems = (Array.isArray(value) ? value : value?.split(',') ?? []).filter(Boolean);
7170
- if ([textItems.length, children, subText].every((_) => !_)) {
7171
- return null;
7172
- }
7173
- return renderCardCell({ textItems, subText, children, isPhone, ...props });
7365
+ const TabItem = JSX((props) => props?.item?.href ? jsx(LinkTabItem, { ...props }) : jsx(ButtonTabItem, { ...props }));
7366
+ const LinkTabItem = JSX((props) => {
7367
+ const link = useLink();
7368
+ const handleClick = useCallback(() => {
7369
+ props.onClick && props.onClick(props.item || {});
7370
+ }, [props.onClick, props.item]);
7371
+ const { onClick, ...item } = link({ ...props.item, onClick: handleClick });
7372
+ return jsx(TabItemInner, { ...props, tag: "a", item: item, onClick: onClick });
7373
+ });
7374
+ // TODO: Update handlerDecorator (support buttons?)
7375
+ const ButtonTabItem = JSX(({ item = {}, onClick, ...rest }) => {
7376
+ const handleClick = useCallback(() => {
7377
+ onClick && onClick(item);
7378
+ }, [onClick, item]);
7379
+ return jsx(TabItemInner, { item: item, onClick: handleClick, ...rest });
7174
7380
  });
7175
- const renderCardCell = ({ label, labelSize = 'text-m', textItems, subColor, subText, className, children, isPhone = false, }) => (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 || renderTextItems(textItems, isPhone), subText ? (jsx(Text, { color: subColor, size: "text-m", children: subText })) : null] }));
7176
- const renderTextItems = (textItems, isPhone) => textItems.filter(Boolean).map((text, i) => (jsx(Text, { size: "text-l", children: isPhone ? jsx("a", { href: `tel:${cleanPhoneNumber(text)}`, children: text.trim() }) : text.trim() }, String(i))));
7177
- const cleanPhoneNumber = (phone) => phone.replace(/\D/g, '');
7178
7381
 
7179
- const CardRow = JSX(({ className, children }) => (jsx("div", { className: style('flex flex-col sm:flex-row sm:border-t sm:border-solid sm:border-main-divider py-xl gap-x-6xl gap-y-xl', className), children: children })));
7382
+ const renderTab = (activeTab, onClick, type) => (tab, i) => (jsx(TabItem, { isActive: tab === activeTab, onClick: onClick, type: type, item: tab }, String(i)));
7180
7383
 
7181
- const ICONS = ['ArrowDownIcon', 'ArrowUpIcon'];
7182
- const labels = ['Подробнее', 'Скрыть'];
7183
- const renderFoldButton$1 = ({ isUnfolded, onToggle }) => (jsxs("button", { className: "w-full py-2xl cursor-pointer text-primary-main flex items-center border-b border-solid border-main-divider", onClick: onToggle, type: "button", children: [jsx("div", { className: "pr-m", children: labels[Number(isUnfolded)] }), jsx(Icon, { className: "text-primary-text", name: ICONS[Number(isUnfolded)], width: "16", height: "16" })] }));
7384
+ const TabsControl = JSX(({ className, tabsType = 'default', items = [], activeItem, onChange }) => (jsx("div", { className: style('flex gap-x-2xs overflow-x-auto no-scrollbar', className), role: "tabpanel", "aria-label": "\u041F\u0430\u043D\u0435\u043B\u044C \u0443\u043F\u0440\u0430\u0432\u043B\u0435\u043D\u0438\u044F \u0442\u0430\u0431\u0430\u043C\u0438", children: items.map(renderTab(activeItem, onChange, tabsType)) })));
7385
+
7386
+ const initialFiltrationState = {
7387
+ categories: [],
7388
+ extraOptions: [],
7389
+ propertyType: [],
7390
+ stage: [],
7391
+ };
7392
+ const MortgageFiltration = UniBlock(({ className, hotFilters, filtrationSchema = {}, resetButton, ...rest }) => {
7393
+ const [filtrationState, { blocksToRender }, { field, reset, update: replaceFiltrationState }] = useFiltrationForm(initialFiltrationState, {
7394
+ block: rest.block,
7395
+ page: rest.options?.page,
7396
+ });
7397
+ const handleFiltrationStateChange = useCallback((_ = initialFiltrationState) => replaceFiltrationState(_), []);
7398
+ const tabsControlProps = useHotFilters({
7399
+ hotFilters,
7400
+ filtrationState,
7401
+ blocks: rest.block?.blocks,
7402
+ onFiltrationStateChange: handleFiltrationStateChange,
7403
+ });
7404
+ return (jsxs(BlockWrapper, { className: style('space-y-2xs', className), defaultPadding: "p-0", version: "transparent", ...rest, children: [jsx(TabsControl, { ...tabsControlProps }), jsx(FiltrationForm, { filtrationSchema: filtrationSchema, resetButton: resetButton, field: field, reset: reset }), jsx(FilteredBlocks, { blocksToRender: blocksToRender, ...rest })] }));
7405
+ }, {
7406
+ childrenTypes: ['ProductBlock'],
7407
+ childSchema: (content) => content?.filtrationSchema || {},
7408
+ });
7184
7409
 
7185
7410
  const renderAtmCard = ({ location, address, billAcceptorType, terminalType, billAcceptorEnable, atmCode = '', atmAccess = '', workTime, }, i) => {
7186
7411
  const additionalInfo = [
7187
7412
  {
7188
7413
  label: 'Устройство',
7189
- value: capitalizedFirstLetter$1(terminalType),
7414
+ value: capitalizedFirstLetter(terminalType),
7190
7415
  },
7191
7416
  { label: 'Модуль приема наличных', value: billAcceptorEnable ? 'Да' : 'Нет' },
7192
7417
  {
@@ -7199,19 +7424,19 @@
7199
7424
  },
7200
7425
  { label: 'Регистрационный номер', value: atmCode },
7201
7426
  ];
7202
- return (jsxs("div", { className: "bg-white col-span-12 p-3xl sm:border-green sm:border", children: [jsxs("div", { className: "sm:flex sm:justify-between", children: [jsxs("div", { children: [jsx(Text, { size: "text-h4", children: capitalizedFirstLetter$1(location) }), 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("div", { className: "whitespace-nowrap", children: jsx(Badge, { color: "green", children: capitalizedFirstLetter$1(workTime) }) })] }), jsx("div", { className: "hidden sm:block", children: jsx(CardRow, { className: "flex-wrap", children: additionalInfo?.map(renderInfo) }) }), jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
7427
+ return (jsxs("div", { className: "bg-white col-span-12 p-3xl sm:border-green sm:border", children: [jsxs("div", { className: "sm:flex sm:justify-between", children: [jsxs("div", { children: [jsx(Text, { size: "text-h4", children: capitalizedFirstLetter(location) }), 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("div", { className: "whitespace-nowrap", children: jsx(Badge$1, { color: "green", children: capitalizedFirstLetter(workTime) }) })] }), jsx("div", { className: "hidden sm:block", children: jsx(CardRow, { className: "flex-wrap", children: additionalInfo?.map(renderInfo) }) }), jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
7203
7428
  return (jsx(FoldableSection, { isUnfolded: isUnfolded, children: jsx(CardRow, { className: "flex-wrap", children: additionalInfo?.map(renderInfo) }) }));
7204
7429
  },
7205
7430
  //** TODO: Remove styles with refactoring DefaultFoldButton*/
7206
- renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$1({ isUnfolded, onToggle }) })] }, String(i)));
7431
+ renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$3({ isUnfolded, onToggle }) })] }, String(i)));
7207
7432
  };
7208
7433
  const getAtmPoint = ({ address = '', terminalType, atmCode = '' }) => {
7209
- const header = `${capitalizedFirstLetter$1(terminalType)} №${atmCode}`;
7434
+ const header = `${capitalizedFirstLetter(terminalType)} №${atmCode}`;
7210
7435
  const body = address.toUpperCase();
7211
7436
  return { header, body };
7212
7437
  };
7213
7438
  const renderInfo = (item, i) => (jsx(CardCell, { ...item }, String(i)));
7214
- const capitalizedFirstLetter$1 = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
7439
+ const capitalizedFirstLetter = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
7215
7440
 
7216
7441
  const EMPTY_VALUE$2 = [];
7217
7442
  function useAtms(regionCode) {
@@ -7259,172 +7484,6 @@
7259
7484
  });
7260
7485
  };
7261
7486
 
7262
- const getScheduleDescription = (workScheduleWeek) => {
7263
- const rows = getDateDescription(workScheduleWeek);
7264
- return jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", value: rows, className: "max-w-none" });
7265
- };
7266
- const buildScheduleText = ({ workTime = '', lunchHour = '', daysOff = '' }, isSaturday = false) => {
7267
- if (!workTime) {
7268
- return '';
7269
- }
7270
- return [
7271
- `${isSaturday ? 'Суббота' : 'Будние дни'}: ${workTime}`,
7272
- lunchHour ? `перерыв: ${lunchHour}` : '',
7273
- daysOff ? `не работает: ${daysOff}` : '',
7274
- ]
7275
- .filter(Boolean)
7276
- .join('; ');
7277
- };
7278
- const getDateDescription = (workScheduleWeek) => {
7279
- const workingWeekday = workScheduleWeek.find((_) => _.key !== 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
7280
- const workingSaturday = workScheduleWeek.find((_) => _.key === 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
7281
- const daysOff = workScheduleWeek
7282
- .filter((_) => !_.status)
7283
- .map((_) => _.short?.toLowerCase())
7284
- .join(', ');
7285
- const rows = [
7286
- buildScheduleText({
7287
- workTime: workingWeekday?.workTime,
7288
- lunchHour: workingWeekday?.lunchHour,
7289
- daysOff: workingSaturday ? '' : daysOff,
7290
- }),
7291
- buildScheduleText({ workTime: workingSaturday?.workTime, lunchHour: workingSaturday?.lunchHour, daysOff }, true),
7292
- ].filter(Boolean);
7293
- return rows;
7294
- };
7295
-
7296
- const WEEKDAY_MAP = [
7297
- ['workingMonday', 'Пн', 'Понедельник'],
7298
- ['workingTuesday', 'Вт', 'Вторник'],
7299
- ['workingWednesday', 'Ср', 'Среда'],
7300
- ['workingThursday', 'Чт', 'Четверг'],
7301
- ['workingFriday', 'Пт', 'Пятница'],
7302
- ['workingSaturday', 'Сб', 'Суббота'],
7303
- ['workingSunday', 'Вс', 'Воскресенье'],
7304
- ];
7305
- const getWorkScheduleWeek = (workSchedule) => WEEKDAY_MAP.map(([key, short, title]) => ({
7306
- key,
7307
- title,
7308
- short,
7309
- status: Boolean(workSchedule?.[key]),
7310
- get workTime() {
7311
- return key === 'workingSaturday' ? workSchedule?.workTimeSaturday : workSchedule?.workTime;
7312
- },
7313
- get lunchHour() {
7314
- return key === 'workingSaturday' ? workSchedule?.lunchHourSaturday : workSchedule?.lunchHour;
7315
- },
7316
- get hasLunch() {
7317
- return /\d+/.test(this.lunchHour ?? '');
7318
- },
7319
- }));
7320
-
7321
- const renderBusinessSchedule = (scheduleDescription) => {
7322
- if (!scheduleDescription) {
7323
- return null;
7324
- }
7325
- const businessSchedule = getBusinessSchedule(scheduleDescription);
7326
- 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 }) })] }));
7327
- };
7328
- const getBusinessSchedule = (scheduleDescription) => {
7329
- const weekDayMap = WEEKDAY_MAP.map(([, short]) => ({ short, status: true }));
7330
- const splittedScheduleDescription = scheduleDescription.split('/') ?? [];
7331
- const lastPartScheduleDescription = splittedScheduleDescription[splittedScheduleDescription.length - 1]?.toLowerCase();
7332
- if (!lastPartScheduleDescription?.includes('выходной')) {
7333
- return weekDayMap;
7334
- }
7335
- return weekDayMap.map((_) => ({
7336
- ..._,
7337
- status: !lastPartScheduleDescription?.includes(_.short.toLowerCase()),
7338
- }));
7339
- };
7340
- const renderAlternativeDay = ({ short, status }, i) => (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(i)));
7341
-
7342
- 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)));
7343
-
7344
- const currentWeekDayIdx = new Date().getDay();
7345
- //TODO: Add logic time https://github.com/redneckz/wildless-cms-uni-blocks/pull/1549
7346
- const renderCurrentDaySchedule = (workScheduleWeek) => {
7347
- const [currentWeekDay] = workScheduleWeek?.slice(currentWeekDayIdx - 1) ?? [];
7348
- if (!currentWeekDay) {
7349
- return null;
7350
- }
7351
- const { lunchHour, status, workTime, hasLunch } = currentWeekDay;
7352
- 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" }));
7353
- };
7354
-
7355
- const getSubTextLunch = ({ lunchHour, hasLunch = false, status = false }) => {
7356
- if (!status) {
7357
- return 'Не работает';
7358
- }
7359
- return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
7360
- };
7361
- const renderDay = ({ title, status, workTime, lunchHour, hasLunch }, i) => (jsx(CardCell, { label: title, value: status && workTime ? workTime : '', subText: getSubTextLunch({ lunchHour, hasLunch, status }), subColor: !status || hasLunch ? 'text-error' : 'text-green-dark' }, String(i)));
7362
-
7363
- const renderWorkSchedule = (workSchedule) => {
7364
- const workScheduleWeek = getWorkScheduleWeek(workSchedule);
7365
- const timeOfWork = workSchedule ? getDateDescription(workScheduleWeek) : '';
7366
- const businessTimeOfWork = workSchedule ? workSchedule.businessScheduleDescription : '';
7367
- if (!workSchedule) {
7368
- return null;
7369
- }
7370
- if (!workSchedule.businessScheduleVisibleTag) {
7371
- return renderMatchingTimeOfWork(timeOfWork);
7372
- }
7373
- if (workSchedule.businessScheduleVisibleTag &&
7374
- workSchedule.businessScheduleDescription === null) {
7375
- return renderIndividualTimeOfWork(timeOfWork);
7376
- }
7377
- return renderDefaultTimeOfWork(timeOfWork, businessTimeOfWork);
7378
- };
7379
- const renderIndividualTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p>`;
7380
- const renderMatchingTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ. и юр. лиц:<br/></b> ${timeOfWork}</p>`;
7381
- const renderDefaultTimeOfWork = (timeOfWork, businessTimeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${businessTimeOfWork}</p>`;
7382
-
7383
- const renderOfficeCard = ({ name, address, phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }, i) => {
7384
- if (!workSchedule) {
7385
- return null;
7386
- }
7387
- const workScheduleWeek = getWorkScheduleWeek(workSchedule);
7388
- return (jsxs("div", { className: "bg-white col-span-12 p-3xl sm:border-green sm:border", children: [jsxs("div", { className: "sm:flex sm:justify-between", children: [jsxs("div", { children: [jsx(Text, { size: "text-h4", children: name }), 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] }), renderCurrentDaySchedule(workScheduleWeek)] }), jsx("div", { className: "hidden sm:block", children: renderCardContent$1({
7389
- phone,
7390
- fax,
7391
- phoneBusiness,
7392
- phoneNatural,
7393
- phoneCallCentre,
7394
- phoneCurrencyControl,
7395
- workSchedule,
7396
- exchangeRate,
7397
- }) }), jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
7398
- return (jsx(FoldableSection, { isUnfolded: isUnfolded, children: renderCardContent$1({
7399
- phone,
7400
- fax,
7401
- phoneBusiness,
7402
- phoneNatural,
7403
- phoneCallCentre,
7404
- phoneCurrencyControl,
7405
- workSchedule,
7406
- exchangeRate,
7407
- }) }));
7408
- },
7409
- //** TODO: remove styles with refactoring DefaultFoldButton*/
7410
- renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$1({ isUnfolded, onToggle }) })] }, String(i)));
7411
- };
7412
- const renderCardContent$1 = ({ phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }) => {
7413
- const workScheduleWeek = getWorkScheduleWeek(workSchedule);
7414
- const labelSchedule = workSchedule?.businessScheduleVisibleTag
7415
- ? 'Для физических лиц'
7416
- : 'Для физических и юридических лиц';
7417
- return (jsxs("div", { children: [jsxs(CardRow, { className: "flex-wrap border-b border-solid border-main-divider", children: [jsx(CardCell, { label: "\u0424\u0430\u043A\u0441", value: fax, isPhone: true }), jsx(CardCell, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D \u0444\u0438\u043B\u0438\u0430\u043B\u0430", value: phone, isPhone: true }), 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, isPhone: true }), 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, isPhone: true }), 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, isPhone: true }), jsx(CardCell, { label: "\u041A\u043E\u043D\u0442\u0430\u043A\u0442-\u0446\u0435\u043D\u0442\u0440", value: phoneCallCentre, isPhone: true })] }), 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
7418
- ? renderBusinessSchedule(workSchedule?.businessScheduleDescription)
7419
- : null, exchangeRate?.currencies?.length ? (jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }));
7420
- };
7421
- const capitalizedFirstLetter = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
7422
- const getOfficePoint = ({ name = '', address = '', workSchedule }) => {
7423
- const header = capitalizedFirstLetter(name);
7424
- const body = `${address} ${renderWorkSchedule(workSchedule)}`;
7425
- return { header, body };
7426
- };
7427
-
7428
7487
  const renderRemoteWorkplaceCard = ({ address, workScheduleDescription }, i) => {
7429
7488
  if (!workScheduleDescription) {
7430
7489
  return null;
@@ -7435,7 +7494,7 @@
7435
7494
  workScheduleDescription,
7436
7495
  }) })),
7437
7496
  //** TODO: remove styles with refactoring DefaultFoldButton*/
7438
- renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$1({ isUnfolded, onToggle }) })] }, String(i)));
7497
+ renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$3({ isUnfolded, onToggle }) })] }, String(i)));
7439
7498
  };
7440
7499
  const renderCardContent = ({ workScheduleDescription }) => {
7441
7500
  return (jsxs("div", { children: [jsxs(CardRow, { className: "flex", children: [jsx(CardCell, { label: "\u041E\u043F\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u043B\u044F \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", children: jsx(Text, { children: "\u041E\u0444\u043E\u0440\u043C\u043B\u0435\u043D\u0438\u0435 \u0438 \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u0435 \u043A\u0440\u0435\u0434\u0438\u0442\u043E\u0432, \u0441\u0447\u0435\u0442\u043E\u0432, \u0432\u043A\u043B\u0430\u0434\u043E\u0432" }) }), jsx(CardCell, { label: "\u041E\u043F\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u043B\u044F \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", children: jsx(Text, { children: "\u041E\u0444\u043E\u0440\u043C\u043B\u0435\u043D\u0438\u0435 \u0438 \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u043D\u0438\u0435 \u0431\u0430\u043D\u043A\u043E\u0432\u0441\u043A\u0438\u0445 \u043A\u0430\u0440\u0442" }) }), jsx(CardCell, { label: "\u041E\u043F\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u043B\u044F \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", children: jsx(Text, { children: "\u0418\u043D\u0432\u0435\u0441\u0442\u0438\u0446\u0438\u043E\u043D\u043D\u043E\u0435 \u0438 \u043D\u0430\u043A\u043E\u043F\u0438\u0442\u0435\u043B\u044C\u043D\u043E\u0435 \u0441\u0442\u0440\u0430\u0445\u043E\u0432\u0430\u043D\u0438\u0435" }) }), jsx(CardCell, { label: "\u041E\u043F\u0435\u0440\u0430\u0446\u0438\u0438 \u0434\u043B\u044F \u0444\u0438\u0437\u0438\u0447\u0435\u0441\u043A\u0438\u0445 \u043B\u0438\u0446", children: jsx(Text, { children: "\u0411\u0435\u0437\u043D\u0430\u043B\u0438\u0447\u043D\u044B\u0435 \u043E\u043F\u0435\u0440\u0430\u0446\u0438\u0438 \u0432 \u0440\u0443\u0431\u043B\u044F\u0445, \u043F\u0435\u0440\u0435\u0432\u043E\u0434\u044B \u0431\u0435\u0437 \u043E\u0442\u043A\u0440\u044B\u0442\u0438\u044F \u0441\u0447\u0451\u0442\u0430" }) })] }), jsx("hr", { className: "text-main-divider pb-xl" }), jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", className: "max-w-none", children: jsx(Text, { children: workScheduleDescription }) })] }));
@@ -8258,7 +8317,7 @@
8258
8317
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
8259
8318
  });
8260
8319
 
8261
- const packageVersion = "0.14.622";
8320
+ const packageVersion = "0.14.624";
8262
8321
 
8263
8322
  exports.Blocks = Blocks;
8264
8323
  exports.ContentPage = ContentPage;