@redneckz/wildless-cms-uni-blocks 0.14.622 → 0.14.624

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 (220) hide show
  1. package/bundle/api/RetailAPI/updateUserProfile.d.ts +1 -1
  2. package/bundle/blocks.schema.json +1 -1
  3. package/bundle/bundle.umd.js +1041 -985
  4. package/bundle/bundle.umd.min.js +1 -1
  5. package/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  6. package/bundle/components/CreditForm/getInitialFormState.d.ts +2 -2
  7. package/bundle/components/OfficesAtmsMap/useOfficesAtmsMapData.d.ts +20 -0
  8. package/bundle/hooks/useRegions.d.ts +2 -0
  9. package/bundle/ui-kit/FormField/Fields/RetailAddressField.d.ts +2 -0
  10. package/bundle/ui-kit/FormField/Fields/RetailRegionField.d.ts +2 -0
  11. package/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  12. package/bundle/ui-kit/FormField/validators.d.ts +1 -1
  13. package/bundle/ui-kit/YandexMap/YandexMap.d.ts +1 -0
  14. package/dist/api/RetailAPI/updateUserProfile.d.ts +1 -1
  15. package/dist/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
  16. package/dist/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
  17. package/dist/api/dadataHints/hintsListsOptions.js +1 -0
  18. package/dist/api/dadataHints/hintsListsOptions.js.map +1 -1
  19. package/dist/components/ApplicationLeadForm/consents.js +1 -1
  20. package/dist/components/ApplicationLeadForm/consents.js.map +1 -1
  21. package/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  22. package/dist/components/ApplicationLeadForm/getInitialFormState.js +1 -1
  23. package/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  24. package/dist/components/CreditForm/creditFormStepsData.js +3 -3
  25. package/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
  26. package/dist/components/CreditForm/getInitialFormState.d.ts +2 -2
  27. package/dist/components/CreditForm/getInitialFormState.js +2 -2
  28. package/dist/components/CreditForm/getInitialFormState.js.map +1 -1
  29. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +8 -21
  30. package/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  31. package/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.d.ts +20 -0
  32. package/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.js +31 -0
  33. package/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.js.map +1 -0
  34. package/dist/hooks/useRegions.d.ts +2 -0
  35. package/dist/hooks/useRegions.js.map +1 -1
  36. package/dist/ui-kit/FormField/Fields/RetailAddressField.d.ts +2 -0
  37. package/dist/ui-kit/FormField/Fields/RetailAddressField.js +38 -0
  38. package/dist/ui-kit/FormField/Fields/RetailAddressField.js.map +1 -0
  39. package/dist/ui-kit/FormField/Fields/RetailRegionField.d.ts +2 -0
  40. package/dist/ui-kit/FormField/Fields/RetailRegionField.js +14 -0
  41. package/dist/ui-kit/FormField/Fields/RetailRegionField.js.map +1 -0
  42. package/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  43. package/dist/ui-kit/FormField/getField.js +5 -2
  44. package/dist/ui-kit/FormField/getField.js.map +1 -1
  45. package/dist/ui-kit/FormField/getObjectValidator.js +9 -7
  46. package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  47. package/dist/ui-kit/FormField/validators.d.ts +1 -1
  48. package/dist/ui-kit/FormField/validators.js +6 -5
  49. package/dist/ui-kit/FormField/validators.js.map +1 -1
  50. package/dist/ui-kit/YandexMap/YandexMap.d.ts +1 -0
  51. package/dist/ui-kit/YandexMap/YandexMap.js +12 -2
  52. package/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
  53. package/lib/api/RetailAPI/updateUserProfile.d.ts +1 -1
  54. package/lib/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
  55. package/lib/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
  56. package/lib/api/dadataHints/hintsListsOptions.js +1 -0
  57. package/lib/api/dadataHints/hintsListsOptions.js.map +1 -1
  58. package/lib/components/ApplicationLeadForm/consents.js +1 -1
  59. package/lib/components/ApplicationLeadForm/consents.js.map +1 -1
  60. package/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  61. package/lib/components/ApplicationLeadForm/getInitialFormState.js +1 -1
  62. package/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  63. package/lib/components/CreditForm/creditFormStepsData.js +3 -3
  64. package/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
  65. package/lib/components/CreditForm/getInitialFormState.d.ts +2 -2
  66. package/lib/components/CreditForm/getInitialFormState.js +2 -2
  67. package/lib/components/CreditForm/getInitialFormState.js.map +1 -1
  68. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +9 -22
  69. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  70. package/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.d.ts +20 -0
  71. package/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.js +28 -0
  72. package/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.js.map +1 -0
  73. package/lib/hooks/useRegions.d.ts +2 -0
  74. package/lib/hooks/useRegions.js.map +1 -1
  75. package/lib/ui-kit/FormField/Fields/RetailAddressField.d.ts +2 -0
  76. package/lib/ui-kit/FormField/Fields/RetailAddressField.js +36 -0
  77. package/lib/ui-kit/FormField/Fields/RetailAddressField.js.map +1 -0
  78. package/lib/ui-kit/FormField/Fields/RetailRegionField.d.ts +2 -0
  79. package/lib/ui-kit/FormField/Fields/RetailRegionField.js +12 -0
  80. package/lib/ui-kit/FormField/Fields/RetailRegionField.js.map +1 -0
  81. package/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  82. package/lib/ui-kit/FormField/getField.js +5 -2
  83. package/lib/ui-kit/FormField/getField.js.map +1 -1
  84. package/lib/ui-kit/FormField/getObjectValidator.js +9 -7
  85. package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  86. package/lib/ui-kit/FormField/validators.d.ts +1 -1
  87. package/lib/ui-kit/FormField/validators.js +5 -5
  88. package/lib/ui-kit/FormField/validators.js.map +1 -1
  89. package/lib/ui-kit/YandexMap/YandexMap.d.ts +1 -0
  90. package/lib/ui-kit/YandexMap/YandexMap.js +12 -2
  91. package/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
  92. package/mobile/bundle/api/RetailAPI/updateUserProfile.d.ts +1 -1
  93. package/mobile/bundle/bundle.umd.js +1080 -1024
  94. package/mobile/bundle/bundle.umd.min.js +1 -1
  95. package/mobile/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  96. package/mobile/bundle/components/CreditForm/getInitialFormState.d.ts +2 -2
  97. package/mobile/bundle/components/OfficesAtmsMap/useOfficesAtmsMapData.d.ts +20 -0
  98. package/mobile/bundle/hooks/useRegions.d.ts +2 -0
  99. package/mobile/bundle/ui-kit/FormField/Fields/RetailAddressField.d.ts +2 -0
  100. package/mobile/bundle/ui-kit/FormField/Fields/RetailRegionField.d.ts +2 -0
  101. package/mobile/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  102. package/mobile/bundle/ui-kit/FormField/validators.d.ts +1 -1
  103. package/mobile/bundle/ui-kit/YandexMap/YandexMap.d.ts +1 -0
  104. package/mobile/dist/api/RetailAPI/updateUserProfile.d.ts +1 -1
  105. package/mobile/dist/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
  106. package/mobile/dist/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
  107. package/mobile/dist/api/dadataHints/hintsListsOptions.js +1 -0
  108. package/mobile/dist/api/dadataHints/hintsListsOptions.js.map +1 -1
  109. package/mobile/dist/components/ApplicationLeadForm/consents.js +1 -1
  110. package/mobile/dist/components/ApplicationLeadForm/consents.js.map +1 -1
  111. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  112. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js +1 -1
  113. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  114. package/mobile/dist/components/CreditForm/creditFormStepsData.js +3 -3
  115. package/mobile/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
  116. package/mobile/dist/components/CreditForm/getInitialFormState.d.ts +2 -2
  117. package/mobile/dist/components/CreditForm/getInitialFormState.js +2 -2
  118. package/mobile/dist/components/CreditForm/getInitialFormState.js.map +1 -1
  119. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +8 -21
  120. package/mobile/dist/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  121. package/mobile/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.d.ts +20 -0
  122. package/mobile/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.js +31 -0
  123. package/mobile/dist/components/OfficesAtmsMap/useOfficesAtmsMapData.js.map +1 -0
  124. package/mobile/dist/hooks/useRegions.d.ts +2 -0
  125. package/mobile/dist/hooks/useRegions.js.map +1 -1
  126. package/mobile/dist/ui-kit/FormField/Fields/RetailAddressField.d.ts +2 -0
  127. package/mobile/dist/ui-kit/FormField/Fields/RetailAddressField.js +38 -0
  128. package/mobile/dist/ui-kit/FormField/Fields/RetailAddressField.js.map +1 -0
  129. package/mobile/dist/ui-kit/FormField/Fields/RetailRegionField.d.ts +2 -0
  130. package/mobile/dist/ui-kit/FormField/Fields/RetailRegionField.js +14 -0
  131. package/mobile/dist/ui-kit/FormField/Fields/RetailRegionField.js.map +1 -0
  132. package/mobile/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  133. package/mobile/dist/ui-kit/FormField/getField.js +5 -2
  134. package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
  135. package/mobile/dist/ui-kit/FormField/getObjectValidator.js +9 -7
  136. package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  137. package/mobile/dist/ui-kit/FormField/validators.d.ts +1 -1
  138. package/mobile/dist/ui-kit/FormField/validators.js +6 -5
  139. package/mobile/dist/ui-kit/FormField/validators.js.map +1 -1
  140. package/mobile/dist/ui-kit/YandexMap/YandexMap.d.ts +1 -0
  141. package/mobile/dist/ui-kit/YandexMap/YandexMap.js +12 -2
  142. package/mobile/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
  143. package/mobile/lib/api/RetailAPI/updateUserProfile.d.ts +1 -1
  144. package/mobile/lib/api/RetailAPI/utils/getUpdateUserProfile.js +2 -2
  145. package/mobile/lib/api/RetailAPI/utils/getUpdateUserProfile.js.map +1 -1
  146. package/mobile/lib/api/dadataHints/hintsListsOptions.js +1 -0
  147. package/mobile/lib/api/dadataHints/hintsListsOptions.js.map +1 -1
  148. package/mobile/lib/components/ApplicationLeadForm/consents.js +1 -1
  149. package/mobile/lib/components/ApplicationLeadForm/consents.js.map +1 -1
  150. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +1 -1
  151. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js +1 -1
  152. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  153. package/mobile/lib/components/CreditForm/creditFormStepsData.js +3 -3
  154. package/mobile/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
  155. package/mobile/lib/components/CreditForm/getInitialFormState.d.ts +2 -2
  156. package/mobile/lib/components/CreditForm/getInitialFormState.js +2 -2
  157. package/mobile/lib/components/CreditForm/getInitialFormState.js.map +1 -1
  158. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js +9 -22
  159. package/mobile/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.js.map +1 -1
  160. package/mobile/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.d.ts +20 -0
  161. package/mobile/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.js +28 -0
  162. package/mobile/lib/components/OfficesAtmsMap/useOfficesAtmsMapData.js.map +1 -0
  163. package/mobile/lib/hooks/useRegions.d.ts +2 -0
  164. package/mobile/lib/hooks/useRegions.js.map +1 -1
  165. package/mobile/lib/ui-kit/FormField/Fields/RetailAddressField.d.ts +2 -0
  166. package/mobile/lib/ui-kit/FormField/Fields/RetailAddressField.js +36 -0
  167. package/mobile/lib/ui-kit/FormField/Fields/RetailAddressField.js.map +1 -0
  168. package/mobile/lib/ui-kit/FormField/Fields/RetailRegionField.d.ts +2 -0
  169. package/mobile/lib/ui-kit/FormField/Fields/RetailRegionField.js +12 -0
  170. package/mobile/lib/ui-kit/FormField/Fields/RetailRegionField.js.map +1 -0
  171. package/mobile/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  172. package/mobile/lib/ui-kit/FormField/getField.js +5 -2
  173. package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
  174. package/mobile/lib/ui-kit/FormField/getObjectValidator.js +9 -7
  175. package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  176. package/mobile/lib/ui-kit/FormField/validators.d.ts +1 -1
  177. package/mobile/lib/ui-kit/FormField/validators.js +5 -5
  178. package/mobile/lib/ui-kit/FormField/validators.js.map +1 -1
  179. package/mobile/lib/ui-kit/YandexMap/YandexMap.d.ts +1 -0
  180. package/mobile/lib/ui-kit/YandexMap/YandexMap.js +12 -2
  181. package/mobile/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
  182. package/mobile/src/api/RetailAPI/updateUserProfile.ts +1 -1
  183. package/mobile/src/api/RetailAPI/utils/getUpdateUserProfile.ts +2 -2
  184. package/mobile/src/api/dadataHints/hintsListsOptions.ts +1 -0
  185. package/mobile/src/components/ApplicationLeadForm/ApplicationLeadForm.example.json +1 -1
  186. package/mobile/src/components/ApplicationLeadForm/consents.ts +1 -1
  187. package/mobile/src/components/ApplicationLeadForm/getInitialFormState.tsx +2 -2
  188. package/mobile/src/components/CreditForm/creditFormStepsData.tsx +3 -3
  189. package/mobile/src/components/CreditForm/getInitialFormState.tsx +4 -4
  190. package/mobile/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +9 -25
  191. package/mobile/src/components/OfficesAtmsMap/useOfficesAtmsMapData.tsx +49 -0
  192. package/mobile/src/hooks/useRegions.ts +2 -0
  193. package/mobile/src/ui-kit/FormField/Fields/RetailAddressField.tsx +66 -0
  194. package/mobile/src/ui-kit/FormField/Fields/RetailRegionField.tsx +24 -0
  195. package/mobile/src/ui-kit/FormField/NameFieldDef.ts +4 -2
  196. package/mobile/src/ui-kit/FormField/getField.tsx +5 -2
  197. package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +9 -7
  198. package/mobile/src/ui-kit/FormField/validators.ts +6 -6
  199. package/mobile/src/ui-kit/YandexMap/YandexMap.tsx +59 -45
  200. package/package.json +1 -1
  201. package/src/api/RetailAPI/updateUserProfile.ts +1 -1
  202. package/src/api/RetailAPI/utils/getUpdateUserProfile.ts +2 -2
  203. package/src/api/dadataHints/hintsListsOptions.ts +1 -0
  204. package/src/components/ApplicationLeadForm/ApplicationLeadForm.example.json +1 -1
  205. package/src/components/ApplicationLeadForm/ApplicationLeadForm.fixture.mobile.tsx +1 -1
  206. package/src/components/ApplicationLeadForm/ApplicationLeadForm.fixture.tsx +1 -1
  207. package/src/components/ApplicationLeadForm/consents.ts +1 -1
  208. package/src/components/ApplicationLeadForm/getInitialFormState.tsx +2 -2
  209. package/src/components/CreditForm/creditFormStepsData.tsx +3 -3
  210. package/src/components/CreditForm/getInitialFormState.tsx +4 -4
  211. package/src/components/OfficesAtmsMap/OfficesAtmsMapLayout.tsx +9 -25
  212. package/src/components/OfficesAtmsMap/useOfficesAtmsMapData.tsx +49 -0
  213. package/src/hooks/useRegions.ts +2 -0
  214. package/src/ui-kit/FormField/Fields/RetailAddressField.tsx +66 -0
  215. package/src/ui-kit/FormField/Fields/RetailRegionField.tsx +24 -0
  216. package/src/ui-kit/FormField/NameFieldDef.ts +4 -2
  217. package/src/ui-kit/FormField/getField.tsx +5 -2
  218. package/src/ui-kit/FormField/getObjectValidator.tsx +9 -7
  219. package/src/ui-kit/FormField/validators.ts +6 -6
  220. package/src/ui-kit/YandexMap/YandexMap.tsx +59 -45
@@ -1239,6 +1239,7 @@
1239
1239
  organizationName: ORGANIZATION_NAME_HINTS_LIST_OPTIONS,
1240
1240
  inn: ORGANIZATION_INN_HINTS_LIST_OPTIONS,
1241
1241
  participantAddress: ADDRESS_HINTS_LIST_OPTIONS,
1242
+ fullAddress: ADDRESS_HINTS_LIST_OPTIONS,
1242
1243
  };
1243
1244
 
1244
1245
  const debounce = (fn, delay = 600) => {
@@ -1417,11 +1418,11 @@
1417
1418
  const required = validator((_) => _ !== null && _ !== undefined && _ !== '');
1418
1419
 
1419
1420
  const ERROR_MESSAGE = 'Некорректно заполненное поле';
1420
- const defaultValidator = (errorMsg) => required(errorMsg ? errorMsg : ERROR_MESSAGE);
1421
- const defaultSelectValidator = validator((_) => _?.key && _?.key !== '')(ERROR_MESSAGE);
1422
- const jobNumberValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length > 0 && _.length <= 2)(errorMsg ? errorMsg : ERROR_MESSAGE);
1423
- const nameValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length > 1)(errorMsg ? errorMsg : ERROR_MESSAGE);
1424
- const lengthStringValidator = (maxLength, errorMsg) => validator((_) => typeof _ === 'string' && _.length >= 1 && _.length <= maxLength)(errorMsg ? errorMsg : ERROR_MESSAGE);
1421
+ const defaultValidator = (errorMsg) => required(errorMsg ?? ERROR_MESSAGE);
1422
+ const defaultSelectValidator = (errorMsg) => validator((_) => _?.key && _?.key !== '')(errorMsg ?? ERROR_MESSAGE);
1423
+ const jobNumberValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length > 0 && _.length <= 2)(errorMsg ?? ERROR_MESSAGE);
1424
+ const nameValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length > 1)(errorMsg ?? ERROR_MESSAGE);
1425
+ const lengthStringValidator = (maxLength, errorMsg) => validator((_) => typeof _ === 'string' && _.length >= 1 && _.length <= maxLength)(errorMsg ?? ERROR_MESSAGE);
1425
1426
  const serieValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length === 4)(errorMsg);
1426
1427
  const numberValidator = (errorMsg) => validator((_) => typeof _ === 'string' && _.length === 6)(errorMsg);
1427
1428
  const innValidator = (errorMsg) => validator((_) => typeof _ === 'string' && (_.length === 10 || _.length === 12))(errorMsg);
@@ -1453,8 +1454,8 @@
1453
1454
  surname: nameValidator('Укажите свою фамилию'),
1454
1455
  name: nameValidator('Укажите своё имя'),
1455
1456
  middleName: nameValidator('Укажите своё отчество'),
1456
- region: defaultSelectValidator,
1457
- addressBranch: defaultSelectValidator,
1457
+ region: defaultSelectValidator(),
1458
+ addressBranch: defaultSelectValidator(),
1458
1459
  phone: phoneValidator('Укажите номер телефона'),
1459
1460
  secondaryPhone: phoneValidator('Укажите номер телефона'),
1460
1461
  birthday: defaultValidator('Укажите дату рождения'),
@@ -1486,17 +1487,17 @@
1486
1487
  partnerComments: defaultValidator(),
1487
1488
  collectionCount: defaultValidator(),
1488
1489
  comment: defaultValidator(),
1489
- acquiringType: defaultSelectValidator,
1490
- feedbackMethod: defaultSelectValidator,
1491
- serviceType: defaultSelectValidator,
1492
- serviceDirection: defaultSelectValidator,
1490
+ acquiringType: defaultSelectValidator(),
1491
+ feedbackMethod: defaultSelectValidator(),
1492
+ serviceType: defaultSelectValidator(),
1493
+ serviceDirection: defaultSelectValidator(),
1493
1494
  meetingDay: defaultValidator(),
1494
1495
  product: defaultValidator(),
1495
1496
  localities: defaultValidator(),
1496
1497
  consentDataProcessing: agreementValidator,
1497
1498
  annualRevenue: defaultValidator(),
1498
1499
  consentToReceiveMaterials: agreementValidator,
1499
- processPersonalDataLeadFlg: agreementValidator,
1500
+ processPersonalDataFlg: agreementValidator,
1500
1501
  consentProviderFlg: agreementValidator,
1501
1502
  consentPfrFlg: agreementValidator,
1502
1503
  consentOthersFlg: agreementValidator,
@@ -1523,6 +1524,8 @@
1523
1524
  legalEntityName: defaultValidator(),
1524
1525
  bankEmployeeCode: defaultValidator(),
1525
1526
  partInBusiness: defaultValidator(),
1527
+ regionRetail: defaultSelectValidator('Выберите филиал банка'),
1528
+ addressRetail: defaultSelectValidator('Выберите адрес банка'),
1526
1529
  };
1527
1530
  const getObjectValidator = (inputs) => {
1528
1531
  const requiredInputs = getNamesFromInput(inputs.filter((_) => Boolean(_?.required)));
@@ -2088,7 +2091,7 @@
2088
2091
  });
2089
2092
 
2090
2093
  const CONSENTS = {
2091
- processPersonalDataLeadFlg: {
2094
+ processPersonalDataFlg: {
2092
2095
  text: 'Согласие на обработку персональных данных',
2093
2096
  docId: 4,
2094
2097
  },
@@ -2410,6 +2413,666 @@
2410
2413
  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) }));
2411
2414
  });
2412
2415
 
2416
+ const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
2417
+ const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
2418
+ const onToggle = useCallback(() => {
2419
+ setIsUnfolded((_) => !_);
2420
+ }, []);
2421
+ const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
2422
+ const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
2423
+ return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
2424
+ });
2425
+
2426
+ function useResizeObserver(callback, deps) {
2427
+ const ref = useRef(null);
2428
+ useEffect(() => {
2429
+ const element = ref?.current;
2430
+ if (!element) {
2431
+ return undefined;
2432
+ }
2433
+ const observer = new ResizeObserver((entries) => {
2434
+ callback(element, entries[0]);
2435
+ });
2436
+ observer.observe(element);
2437
+ return () => {
2438
+ observer.disconnect();
2439
+ };
2440
+ }, [callback, ...deps]);
2441
+ return ref;
2442
+ }
2443
+
2444
+ const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
2445
+ const containerRef = useRef(null);
2446
+ const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
2447
+ if (containerRef.current) {
2448
+ containerRef.current.style.maxHeight = isUnfolded
2449
+ ? `${childrenWrapperEl.scrollHeight}px`
2450
+ : '';
2451
+ }
2452
+ }, [isUnfolded]);
2453
+ 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 }) }));
2454
+ });
2455
+
2456
+ const CardCell = JSX(({ value, subText, children, isPhone, ...props }) => {
2457
+ const textItems = (Array.isArray(value) ? value : value?.split(',') ?? []).filter(Boolean);
2458
+ if ([textItems.length, children, subText].every((_) => !_)) {
2459
+ return null;
2460
+ }
2461
+ return renderCardCell({ textItems, subText, children, isPhone, ...props });
2462
+ });
2463
+ 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] }));
2464
+ 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))));
2465
+ const cleanPhoneNumber = (phone) => phone.replace(/\D/g, '');
2466
+
2467
+ 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 })));
2468
+
2469
+ const getScheduleDescription = (workScheduleWeek) => {
2470
+ const rows = getDateDescription(workScheduleWeek);
2471
+ return jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", value: rows, className: "max-w-none" });
2472
+ };
2473
+ const buildScheduleText = ({ workTime = '', lunchHour = '', daysOff = '' }, isSaturday = false) => {
2474
+ if (!workTime) {
2475
+ return '';
2476
+ }
2477
+ return [
2478
+ `${isSaturday ? 'Суббота' : 'Будние дни'}: ${workTime}`,
2479
+ lunchHour ? `перерыв: ${lunchHour}` : '',
2480
+ daysOff ? `не работает: ${daysOff}` : '',
2481
+ ]
2482
+ .filter(Boolean)
2483
+ .join('; ');
2484
+ };
2485
+ const getDateDescription = (workScheduleWeek) => {
2486
+ const workingWeekday = workScheduleWeek.find((_) => _.key !== 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
2487
+ const workingSaturday = workScheduleWeek.find((_) => _.key === 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
2488
+ const daysOff = workScheduleWeek
2489
+ .filter((_) => !_.status)
2490
+ .map((_) => _.short?.toLowerCase())
2491
+ .join(', ');
2492
+ const rows = [
2493
+ buildScheduleText({
2494
+ workTime: workingWeekday?.workTime,
2495
+ lunchHour: workingWeekday?.lunchHour,
2496
+ daysOff: workingSaturday ? '' : daysOff,
2497
+ }),
2498
+ buildScheduleText({ workTime: workingSaturday?.workTime, lunchHour: workingSaturday?.lunchHour, daysOff }, true),
2499
+ ].filter(Boolean);
2500
+ return rows;
2501
+ };
2502
+
2503
+ const WEEKDAY_MAP = [
2504
+ ['workingMonday', 'Пн', 'Понедельник'],
2505
+ ['workingTuesday', 'Вт', 'Вторник'],
2506
+ ['workingWednesday', 'Ср', 'Среда'],
2507
+ ['workingThursday', 'Чт', 'Четверг'],
2508
+ ['workingFriday', 'Пт', 'Пятница'],
2509
+ ['workingSaturday', 'Сб', 'Суббота'],
2510
+ ['workingSunday', 'Вс', 'Воскресенье'],
2511
+ ];
2512
+ const getWorkScheduleWeek = (workSchedule) => WEEKDAY_MAP.map(([key, short, title]) => ({
2513
+ key,
2514
+ title,
2515
+ short,
2516
+ status: Boolean(workSchedule?.[key]),
2517
+ get workTime() {
2518
+ return key === 'workingSaturday' ? workSchedule?.workTimeSaturday : workSchedule?.workTime;
2519
+ },
2520
+ get lunchHour() {
2521
+ return key === 'workingSaturday' ? workSchedule?.lunchHourSaturday : workSchedule?.lunchHour;
2522
+ },
2523
+ get hasLunch() {
2524
+ return /\d+/.test(this.lunchHour ?? '');
2525
+ },
2526
+ }));
2527
+
2528
+ const renderBusinessSchedule = (scheduleDescription) => {
2529
+ if (!scheduleDescription) {
2530
+ return null;
2531
+ }
2532
+ const businessSchedule = getBusinessSchedule(scheduleDescription);
2533
+ 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 }) })] }));
2534
+ };
2535
+ const getBusinessSchedule = (scheduleDescription) => {
2536
+ const weekDayMap = WEEKDAY_MAP.map(([, short]) => ({ short, status: true }));
2537
+ const splittedScheduleDescription = scheduleDescription.split('/') ?? [];
2538
+ const lastPartScheduleDescription = splittedScheduleDescription[splittedScheduleDescription.length - 1]?.toLowerCase();
2539
+ if (!lastPartScheduleDescription?.includes('выходной')) {
2540
+ return weekDayMap;
2541
+ }
2542
+ return weekDayMap.map((_) => ({
2543
+ ..._,
2544
+ status: !lastPartScheduleDescription?.includes(_.short.toLowerCase()),
2545
+ }));
2546
+ };
2547
+ 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)));
2548
+
2549
+ 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)));
2550
+
2551
+ const colorStyle = {
2552
+ yellow: { border: 'border-yellow-light', text: 'text-yellow' },
2553
+ green: { border: 'border-green-more-light', text: 'text-green-dark' },
2554
+ gray: { border: 'border-gray', text: 'text-secondary-text' },
2555
+ red: { border: 'border-error/30', text: 'text-error' },
2556
+ };
2557
+ 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 })] })));
2558
+
2559
+ const currentWeekDayIdx = new Date().getDay();
2560
+ //TODO: Add logic time https://github.com/redneckz/wildless-cms-uni-blocks/pull/1549
2561
+ const renderCurrentDaySchedule = (workScheduleWeek) => {
2562
+ const [currentWeekDay] = workScheduleWeek?.slice(currentWeekDayIdx - 1) ?? [];
2563
+ if (!currentWeekDay) {
2564
+ return null;
2565
+ }
2566
+ const { lunchHour, status, workTime, hasLunch } = currentWeekDay;
2567
+ 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" }));
2568
+ };
2569
+
2570
+ const getSubTextLunch = ({ lunchHour, hasLunch = false, status = false }) => {
2571
+ if (!status) {
2572
+ return 'Не работает';
2573
+ }
2574
+ return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
2575
+ };
2576
+ 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)));
2577
+
2578
+ const ICONS$1 = ['ArrowDownIcon', 'ArrowUpIcon'];
2579
+ const labels = ['Подробнее', 'Скрыть'];
2580
+ 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" })] }));
2581
+
2582
+ const renderWorkSchedule = (workSchedule) => {
2583
+ const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2584
+ const timeOfWork = workSchedule ? getDateDescription(workScheduleWeek) : '';
2585
+ const businessTimeOfWork = workSchedule ? workSchedule.businessScheduleDescription : '';
2586
+ if (!workSchedule) {
2587
+ return null;
2588
+ }
2589
+ if (!workSchedule.businessScheduleVisibleTag) {
2590
+ return renderMatchingTimeOfWork(timeOfWork);
2591
+ }
2592
+ if (workSchedule.businessScheduleVisibleTag &&
2593
+ workSchedule.businessScheduleDescription === null) {
2594
+ return renderIndividualTimeOfWork(timeOfWork);
2595
+ }
2596
+ return renderDefaultTimeOfWork(timeOfWork, businessTimeOfWork);
2597
+ };
2598
+ const renderIndividualTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p>`;
2599
+ const renderMatchingTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ. и юр. лиц:<br/></b> ${timeOfWork}</p>`;
2600
+ const renderDefaultTimeOfWork = (timeOfWork, businessTimeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${businessTimeOfWork}</p>`;
2601
+
2602
+ const renderOfficeCard = ({ name, address, phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }, i) => {
2603
+ if (!workSchedule) {
2604
+ return null;
2605
+ }
2606
+ const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2607
+ 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({
2608
+ phone,
2609
+ fax,
2610
+ phoneBusiness,
2611
+ phoneNatural,
2612
+ phoneCallCentre,
2613
+ phoneCurrencyControl,
2614
+ workSchedule,
2615
+ exchangeRate,
2616
+ }) }), jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
2617
+ return (jsx(FoldableSection, { isUnfolded: isUnfolded, children: renderCardContent$1({
2618
+ phone,
2619
+ fax,
2620
+ phoneBusiness,
2621
+ phoneNatural,
2622
+ phoneCallCentre,
2623
+ phoneCurrencyControl,
2624
+ workSchedule,
2625
+ exchangeRate,
2626
+ }) }));
2627
+ },
2628
+ //** TODO: remove styles with refactoring DefaultFoldButton*/
2629
+ renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$3({ isUnfolded, onToggle }) })] }, String(i)));
2630
+ };
2631
+ const renderCardContent$1 = ({ phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }) => {
2632
+ const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2633
+ const labelSchedule = workSchedule?.businessScheduleVisibleTag
2634
+ ? 'Для физических лиц'
2635
+ : 'Для физических и юридических лиц';
2636
+ 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
2637
+ ? renderBusinessSchedule(workSchedule?.businessScheduleDescription)
2638
+ : null, exchangeRate?.currencies?.length ? (jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }));
2639
+ };
2640
+ const capitalizedFirstLetter$1 = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
2641
+ const getOfficePoint = ({ name = '', address = '', workSchedule }) => {
2642
+ const header = capitalizedFirstLetter$1(name);
2643
+ const body = `${address} ${renderWorkSchedule(workSchedule)}`;
2644
+ return { header, body };
2645
+ };
2646
+
2647
+ const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
2648
+
2649
+ const isClient = !isSSR();
2650
+ const ClientOnly = JSX(({ children }) => (isClient ? children : null));
2651
+
2652
+ 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, {
2653
+ 'backdrop-blur': blur,
2654
+ }), 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" }) })));
2655
+
2656
+ const MapMarkerClusterIcon = '/icons/MapMarkerClusterIcon.svg';
2657
+ const MapMarkerClusterYellowIcon = '/icons/MapMarkerClusterYellowIcon.svg';
2658
+ function renderClusterer({ yandexMaps, map, points, isLoad, }) {
2659
+ if (isLoad || !points) {
2660
+ return;
2661
+ }
2662
+ map.geoObjects.removeAll();
2663
+ if (!points.length) {
2664
+ return;
2665
+ }
2666
+ const clusterIconContentLayout = yandexMaps.templateLayoutFactory.createClass('<div style="margin-top: -3px;">{{properties.geoObjects.length}}</div>');
2667
+ const officeClusterer = defineClusterer('offices', yandexMaps, clusterIconContentLayout);
2668
+ if (points.length && points.every((_) => 'type' in _)) {
2669
+ const remoteWorkplaceClusterer = defineClusterer('workplaces', yandexMaps, clusterIconContentLayout);
2670
+ const remoteWorkplaceGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'workplaces'), 'workplaces', yandexMaps);
2671
+ const officesGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'offices'), 'offices', yandexMaps);
2672
+ officeClusterer.add(officesGeoObjects);
2673
+ remoteWorkplaceClusterer.add(remoteWorkplaceGeoObjects);
2674
+ map.geoObjects.add(remoteWorkplaceClusterer);
2675
+ map.geoObjects.add(officeClusterer);
2676
+ }
2677
+ else {
2678
+ const geoObjects = defineGeoObjects(points, 'offices', yandexMaps);
2679
+ officeClusterer.add(geoObjects);
2680
+ map.geoObjects.add(officeClusterer);
2681
+ }
2682
+ map.setBounds(yandexMaps.util.bounds.fromPoints(points.map((_) => _.coords))).then(() => {
2683
+ if (map.getZoom() > 10) {
2684
+ map.setZoom(10);
2685
+ }
2686
+ });
2687
+ }
2688
+ const defineClusterer = (type, yandexMaps, clusterIconContentLayout) => {
2689
+ return new yandexMaps.Clusterer({
2690
+ clusterIcons: [
2691
+ {
2692
+ href: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
2693
+ size: [78, 84],
2694
+ offset: [-35, -50],
2695
+ },
2696
+ ],
2697
+ clusterIconContentLayout,
2698
+ clusterHideIconOnBalloonOpen: false,
2699
+ geoObjectHideIconOnBalloonOpen: false,
2700
+ });
2701
+ };
2702
+ const defineGeoObjects = (pointArr, type, yandexMaps) => {
2703
+ return pointArr.map(({ coords, content }) => new yandexMaps.Placemark(coords, {
2704
+ balloonContentHeader: content?.header,
2705
+ balloonContentBody: content?.body,
2706
+ balloonContentFooter: content?.footer,
2707
+ hintContent: content?.hint,
2708
+ }, {
2709
+ iconLayout: 'default#image',
2710
+ iconImageHref: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
2711
+ iconImageSize: [78, 84],
2712
+ iconImageOffset: [-35, -50],
2713
+ }));
2714
+ };
2715
+
2716
+ const defaultStyle = {
2717
+ focus: 'focus:border-primary-text focus:border',
2718
+ hover: 'hover:bg-primary-hover',
2719
+ active: 'active:bg-primary-active',
2720
+ font: 'text-center font-sans',
2721
+ };
2722
+
2723
+ const styles$1 = {
2724
+ ...defaultStyle,
2725
+ border: 'border border-transparent rounded-md',
2726
+ position: 'absolute flex items-center justify-center',
2727
+ };
2728
+ const renderUserGeolocation = (map, yandexMaps, className) => {
2729
+ const setUserGeoLocation = () => {
2730
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2731
+ // @ts-ignore
2732
+ yandexMaps.geolocation
2733
+ .get({
2734
+ provider: 'yandex',
2735
+ autoReverseGeocode: true,
2736
+ mapStateAutoApply: true,
2737
+ })
2738
+ .then(function (result) {
2739
+ map.current.geoObjects.add(result.geoObjects);
2740
+ });
2741
+ };
2742
+ 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" }) }));
2743
+ };
2744
+
2745
+ const getNS = (_) => globalThis[_];
2746
+ const initializeExternalNS = (namespaceName, url) => {
2747
+ const script = document.getElementById(url);
2748
+ if (script) {
2749
+ const ns = getNS(namespaceName);
2750
+ if (ns) {
2751
+ return Promise.resolve(ns);
2752
+ }
2753
+ else {
2754
+ return new Promise((resolve) => {
2755
+ script.addEventListener('load', () => {
2756
+ resolve(getNS(namespaceName));
2757
+ });
2758
+ });
2759
+ }
2760
+ }
2761
+ else {
2762
+ return new Promise((resolve, reject) => {
2763
+ const newScript = document.createElement('script');
2764
+ newScript.src = url;
2765
+ newScript.async = true;
2766
+ newScript.id = url;
2767
+ newScript.addEventListener('load', () => {
2768
+ resolve(getNS(namespaceName));
2769
+ });
2770
+ newScript.addEventListener('error', (error) => {
2771
+ reject(error);
2772
+ });
2773
+ document.head.appendChild(newScript);
2774
+ });
2775
+ }
2776
+ };
2777
+ function useExternalNS(namespaceName, url, unmountNS = true) {
2778
+ const [externalNS, setExternalNS] = useState(undefined);
2779
+ useEffect(() => {
2780
+ let isMounted = true;
2781
+ initializeExternalNS(namespaceName, url)
2782
+ .then((ns) => {
2783
+ if (isMounted) {
2784
+ setExternalNS(ns);
2785
+ }
2786
+ })
2787
+ .catch((error) => {
2788
+ console.error(`Failed to initialize external namespace: ${error}`);
2789
+ });
2790
+ return () => {
2791
+ isMounted = false;
2792
+ if (unmountNS) {
2793
+ const script = document.getElementById(url);
2794
+ if (script) {
2795
+ document.head.removeChild(script);
2796
+ }
2797
+ setExternalNS(undefined);
2798
+ }
2799
+ };
2800
+ }, [namespaceName, url, unmountNS]);
2801
+ return externalNS;
2802
+ }
2803
+
2804
+ const YMAPS_NAMESPACE = 'ymaps';
2805
+ const useYandexMaps = () => {
2806
+ const url = `https://api-maps.yandex.ru/2.1/?apikey=${projectSettings.YANDEX_MAP_API_KEY || ''}&lang=ru_RU`;
2807
+ return useExternalNS(YMAPS_NAMESPACE, url, false);
2808
+ };
2809
+
2810
+ const styles = {
2811
+ ...defaultStyle,
2812
+ border: 'border-b border-b-2 border-gray last:border-0',
2813
+ position: 'relative flex items-center justify-center',
2814
+ };
2815
+ // TODO: Добавить метод определения центральной точки
2816
+ const ZoomButton = JSX(({ yandexMaps, direction = 'in' }) => {
2817
+ const iconName = direction === 'in' ? 'PlusIcon' : 'MinusIcon';
2818
+ const changeZoom = () => {
2819
+ const currentZoom = yandexMaps.current.getZoom();
2820
+ const newZoom = direction === 'in' ? currentZoom + 1 : currentZoom - 1;
2821
+ yandexMaps.current.setZoom(newZoom, { checkZoomRange: true });
2822
+ };
2823
+ 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" }) }));
2824
+ });
2825
+
2826
+ const DEFAULT_CENTER_COORDS = [55.753995, 37.614069];
2827
+ // TODO: Поле для поиска: невыяснено среди каких данных делать поиск (искать в имени офиса, в адресе, метро и т.д.).
2828
+ // Сейчас реализован поиск среди тестовых данных
2829
+ // TODO: Также выяснить что делать когда ничего не найдено
2830
+ // TODO: На макетах также когда есть поле поиска нет кнопки открыть на карте.
2831
+ const YandexMap = JSX(({ points, className = '', zoom = 5, isLoad, selectedAddress }) => {
2832
+ const map = useRef(null);
2833
+ const yandexMaps = useYandexMaps();
2834
+ useEffect(() => {
2835
+ if (map.current) {
2836
+ renderClusterer({ yandexMaps, map: map.current, points, isLoad });
2837
+ }
2838
+ else {
2839
+ yandexMaps?.ready(() => {
2840
+ // Ready function may be called few times, but must be called once
2841
+ if (map.current) {
2842
+ renderClusterer({ yandexMaps, map: map.current, points, isLoad });
2843
+ return;
2844
+ }
2845
+ map.current = new yandexMaps.Map('map', {
2846
+ center: getCenterPoint(points),
2847
+ zoom,
2848
+ controls: [],
2849
+ suppressMapOpenBlock: true,
2850
+ });
2851
+ renderClusterer({ yandexMaps, map: map.current, points, isLoad });
2852
+ });
2853
+ }
2854
+ }, [yandexMaps, points, zoom, isLoad, selectedAddress]);
2855
+ useEffect(() => {
2856
+ if (map.current && selectedAddress) {
2857
+ yandexMaps?.geocode(selectedAddress).then((res) => {
2858
+ const firstGeoObject = res.geoObjects.get(0);
2859
+ const coords = firstGeoObject.geometry.getCoordinates();
2860
+ map.current.setCenter(coords);
2861
+ map.current.setZoom(18);
2862
+ });
2863
+ }
2864
+ }, [selectedAddress]);
2865
+ if (!yandexMaps) {
2866
+ return null;
2867
+ }
2868
+ const zIndex = 'z-10';
2869
+ 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))] }));
2870
+ });
2871
+ const getCenterPoint = (points) => {
2872
+ const centerCoords = [
2873
+ getArraySumAndAverage(mapByIndex(points, 0)),
2874
+ getArraySumAndAverage(mapByIndex(points, 1)),
2875
+ ];
2876
+ return centerCoords.every((_) => _) ? centerCoords : DEFAULT_CENTER_COORDS;
2877
+ };
2878
+ const mapByIndex = (points, index) => points.map((_) => _.coords?.[index]);
2879
+ const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
2880
+
2881
+ const INITIAL_FILTRATION_STATE$1 = {
2882
+ workingSaturday: false,
2883
+ premiumService: false,
2884
+ privateBanking: false,
2885
+ remoteWorkplace: false,
2886
+ serviceDisabledPeople: false,
2887
+ sellingCoins: false,
2888
+ buyingCoins: false,
2889
+ bullionOperations: false,
2890
+ preciousMetalsOperations: false,
2891
+ transferringDataToBiometricSystem: false,
2892
+ };
2893
+ const FILTRATION_LABELS = {
2894
+ safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
2895
+ workingSaturday: 'Открыты по субботам',
2896
+ terminalTypeAtms: 'Банкоматы',
2897
+ terminalTypeTerm: 'Терминалы',
2898
+ workAllTime: 'Круглосуточно',
2899
+ billAcceptorEnable: 'Прием наличных',
2900
+ premiumService: 'Премиальное обслуживание',
2901
+ privateBanking: 'Услуга Private banking',
2902
+ sellingCoins: 'Продажа монет из драгоценных металлов',
2903
+ buyingCoins: 'Покупка монет из драгоценных металлов',
2904
+ bullionOperations: 'Операции со слитками',
2905
+ preciousMetalsOperations: 'Операции с драгоценными металлами',
2906
+ transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
2907
+ locationDisabledPeople: 'Для маломобильных',
2908
+ designDisabledPeople: 'Для слабовидящих',
2909
+ remoteWorkplace: 'Удаленное рабочее место',
2910
+ serviceDisabledPeople: 'Для маломобильных граждан',
2911
+ };
2912
+ const FILTRATION_PREDICATES$1 = {
2913
+ workingSaturday: (item) => Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
2914
+ premiumService: (item) => Boolean('premiumService' in item && item.premiumService),
2915
+ privateBanking: (item) => Boolean('privateBanking' in item && item.privateBanking),
2916
+ remoteWorkplace: (item) => Boolean('workScheduleDescription' in item),
2917
+ serviceDisabledPeople: (item) => Boolean('serviceDisabledPeople' in item && item.serviceDisabledPeople),
2918
+ sellingCoins: (item) => Boolean('sellingCoins' in item && item.sellingCoins),
2919
+ buyingCoins: (item) => Boolean('buyingCoins' in item && item.buyingCoins),
2920
+ bullionOperations: (item) => Boolean('bullionOperations' in item && item.bullionOperations),
2921
+ preciousMetalsOperations: (item) => Boolean('preciousMetalsOperations' in item && item.preciousMetalsOperations),
2922
+ transferringDataToBiometricSystem: (item) => Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
2923
+ };
2924
+
2925
+ function useButton() {
2926
+ return (props) => ({
2927
+ ...props,
2928
+ onClick: handlerDecorator(handleClick(props)),
2929
+ });
2930
+ }
2931
+ function handleClick({ disabled, onClick }) {
2932
+ return (ev) => {
2933
+ !disabled && onClick && onClick(ev);
2934
+ };
2935
+ }
2936
+
2937
+ const buttonStyleMap = {
2938
+ primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
2939
+ secondary: 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
2940
+ };
2941
+ const secondaryButtonStyleMap = {
2942
+ 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'),
2943
+ 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'),
2944
+ };
2945
+ const Button = JSX(({ children, ...props }) => {
2946
+ const button = useButton();
2947
+ const { className, version = 'primary', active, disabled, type = 'button', rounded = true, role, onClick, } = button(props);
2948
+ return (jsx("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs', {
2949
+ 'text-white bg-primary-active': active,
2950
+ 'bg-main-gray text-main-disabled cursor-not-allowed': disabled,
2951
+ 'rounded-md': rounded,
2952
+ }, !active && !disabled
2953
+ ? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
2954
+ : '', className), type: type, role: role, onClick: onClick, children: children }));
2955
+ });
2956
+
2957
+ const getVersion = (isPrimary, type) => isPrimary && type !== 'underlined' ? 'primary' : 'secondary';
2958
+
2959
+ const renderButtonsGroup = (data, activeButton, onButtonClick) => {
2960
+ const allButtonVersion = getVersion(activeButton === 'all');
2961
+ const businessButtonVersion = getVersion(activeButton === 'business');
2962
+ const handleClick = (e, key, branches) => {
2963
+ const filteredBranches = e.currentTarget === e.target && key === 'business' ? filterBranches(branches) : branches;
2964
+ onButtonClick(key);
2965
+ return filteredBranches;
2966
+ };
2967
+ const filterBranches = (branches) => branches.filter((branch) => branch.workSchedule &&
2968
+ branch.workSchedule.businessScheduleVisibleTag &&
2969
+ !branch.workSchedule.businessScheduleDescription);
2970
+ 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" })] }));
2971
+ };
2972
+
2973
+ 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;
2974
+
2975
+ const COMMON_FILTERS_STYLES = 'flex flex-col sm:flex-row sm:flex-wrap gap-3xl pb-2xl';
2976
+ const renderFiltrationForm = ({ filters, field: { field, reset }, onlyOffice, labels, }) => {
2977
+ const visibleFiltersNum = onlyOffice ? 5 : 6;
2978
+ const filtersCheckbox = (filters || []).map((key) => (jsx(Checkbox, { text: labels[key], ...field(key) }, key)));
2979
+ const [visibleFilters, hiddenFilters] = visibleFiltersNum > 0
2980
+ ? [filtersCheckbox.slice(0, visibleFiltersNum), filtersCheckbox.slice(visibleFiltersNum)]
2981
+ : [filtersCheckbox, []];
2982
+ 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 }));
2983
+ };
2984
+ const renderFoldButton$2 = (reset, onlyOffice = false) => ({ isUnfolded, onToggle }) => {
2985
+ const labels = ['Больше фильтров', 'Меньше фильтров'];
2986
+ const icons = ['ArrowDownIcon', 'ArrowUpIcon'];
2987
+ 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() })] }));
2988
+ };
2989
+ 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" })] }));
2990
+
2991
+ 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] }) }));
2992
+
2993
+ const defaultEmptyFunction$1 = () => void 0;
2994
+ const filtersVisibleStyles = (activeButton) => activeButton === 'all' ? 'block' : 'hidden';
2995
+ const OfficesAtmsMapLayout = JSX(({ className, data = [], isLoad, remoteWorkplaces = [], renderCard = defaultEmptyFunction$1, renderRemoteWorkplaceCard = defaultEmptyFunction$1, getBalloon = defaultEmptyFunction$1, getBalloonRemoteWorkplaces = defaultEmptyFunction$1, descriptionData, title, }) => {
2996
+ const onlyOffice = title?.includes('Офис');
2997
+ const [filtrationState, { field, reset }] = useForm(INITIAL_FILTRATION_STATE$1);
2998
+ const { filteredItems, points, filteredRemoteWorkplaces, lengthItems } = useOfficesAtmsMapData({
2999
+ data,
3000
+ remoteWorkplaces,
3001
+ filtrationState,
3002
+ getBalloon,
3003
+ getBalloonRemoteWorkplaces,
3004
+ });
3005
+ const [activeButton, setActiveButton] = useState('all');
3006
+ const filterOptions = {
3007
+ filters: getFiltersWithNonEmptyData([...data, ...remoteWorkplaces]),
3008
+ field: { field, reset },
3009
+ onlyOffice,
3010
+ labels: FILTRATION_LABELS,
3011
+ };
3012
+ 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)] })] }));
3013
+ });
3014
+ const filterItems$1 = (data, filtrationState) => {
3015
+ const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
3016
+ return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES$1[_](item)));
3017
+ };
3018
+ const getFiltersWithNonEmptyData = (data) => Object.keys(INITIAL_FILTRATION_STATE$1).filter((_) => data.filter((item) => FILTRATION_PREDICATES$1[_](item)).length);
3019
+
3020
+ const defaultEmptyFunction = () => void 0;
3021
+ const useOfficesAtmsMapData = ({ data, remoteWorkplaces = [], filtrationState = {}, getBalloon = defaultEmptyFunction, getBalloonRemoteWorkplaces = defaultEmptyFunction, }) => {
3022
+ const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
3023
+ const _filteredItems = filterItems$1(data, filtrationState);
3024
+ const _filteredRemoteWorkplaces = filterItems$1(remoteWorkplaces, filtrationState);
3025
+ const _points = [
3026
+ ..._filteredItems.map((_) => ({
3027
+ type: 'offices',
3028
+ coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
3029
+ content: getBalloon(_),
3030
+ })),
3031
+ ..._filteredRemoteWorkplaces.map((_) => ({
3032
+ type: 'workplaces',
3033
+ coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
3034
+ content: getBalloonRemoteWorkplaces({
3035
+ address: _.address,
3036
+ workScheduleDescription: _.workScheduleDescription,
3037
+ }),
3038
+ })),
3039
+ ].filter((_) => _.coords && _.coords.length === 2);
3040
+ const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
3041
+ return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
3042
+ }, [data, remoteWorkplaces, filtrationState, getBalloon, getBalloonRemoteWorkplaces]);
3043
+ return { filteredItems, points, filteredRemoteWorkplaces, lengthItems };
3044
+ };
3045
+
3046
+ const RetailAddressField = JSX(({ field, input }) => {
3047
+ const fieldRegion = field('regionRetail');
3048
+ const fieldBranch = field('addressRetail');
3049
+ const regions = useBranchesByRegions();
3050
+ const regionKey = fieldRegion?.value?.key;
3051
+ const selectedRegion = regions.find(({ region }) => region === regionKey);
3052
+ const isLoad = !regions;
3053
+ const regionText = fieldRegion?.value?.text;
3054
+ const addressBranchRetail = useBranchesByRegions()?.find((_) => _?.region === regionText)?.branches;
3055
+ useEffect(() => {
3056
+ if (fieldRegion?.value?.key !== '') {
3057
+ field?.('addressRetail')?.onChange?.('');
3058
+ }
3059
+ }, [fieldRegion?.value]);
3060
+ const { points } = useOfficesAtmsMapData({
3061
+ data: selectedRegion?.branches || [],
3062
+ filtrationState: {},
3063
+ getBalloon: getOfficePoint,
3064
+ });
3065
+ 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 = '' }) => ({
3066
+ key: address,
3067
+ text: address,
3068
+ })), ...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 }) }) })] }));
3069
+ });
3070
+
3071
+ const RetailRegionField = JSX(({ field, input }) => {
3072
+ const regions = useBranchesByRegions();
3073
+ 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) }));
3074
+ });
3075
+
2413
3076
  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 })));
2414
3077
 
2415
3078
  const SecondaryPhoneField = JSX(({ field }) => {
@@ -2532,7 +3195,7 @@
2532
3195
  bankEmpolee: jsx(BankEmpoleeField, { field: field }),
2533
3196
  secondaryPhone: jsx(SecondaryPhoneField, { field: field }),
2534
3197
  consentToReceiveMaterials: jsx(ConsentField, { field: field, input: input }),
2535
- processPersonalDataLeadFlg: jsx(ConsentField, { field: field, input: input }),
3198
+ processPersonalDataFlg: jsx(ConsentField, { field: field, input: input }),
2536
3199
  consentProviderFlg: jsx(ConsentField, { field: field, input: input }),
2537
3200
  consentOthersFlg: jsx(ConsentField, { field: field, input: input }),
2538
3201
  consentInformFlg: jsx(ConsentField, { field: field, input: input }),
@@ -2558,7 +3221,6 @@
2558
3221
  armyIdFlg: jsx(ArmyIdFlgField, { field: field, input: input }),
2559
3222
  dulSerie: jsx(DulSerieField, { field: field, input: input }),
2560
3223
  dulNumber: jsx(DulNumberField, { field: field, input: input }),
2561
- // eslint-disable-next-line max-lines
2562
3224
  dulIssueDateField: jsx(DulIssueDateField, { field: field, input: input }),
2563
3225
  dulSubdivisionCode: jsx(DulSubdivisionCodeField, { field: field, input: input }),
2564
3226
  dulIssuedBy: jsx(DulIssuedByField, { field: field, input: input }),
@@ -2575,6 +3237,8 @@
2575
3237
  creditInRshbCd: jsx(CreditInRshbCdField, { field: field, input: input }),
2576
3238
  bankEmployeeCode: jsx(BankEmpoleeCodeField, { field: field, input: input }),
2577
3239
  partInBusiness: jsx(PartInBusinessField, { field: field, input: input }),
3240
+ regionRetail: jsx(RetailRegionField, { field: field, input: input }),
3241
+ addressRetail: jsx(RetailAddressField, { field: field, input: input }),
2578
3242
  };
2579
3243
  return isRenderField({ input, field }) ? (jsx("div", { children: InputsMap[input?.name || ''] }, String(i))) : null;
2580
3244
  };
@@ -2583,38 +3247,6 @@
2583
3247
 
2584
3248
  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;
2585
3249
 
2586
- function useButton() {
2587
- return (props) => ({
2588
- ...props,
2589
- onClick: handlerDecorator(handleClick(props)),
2590
- });
2591
- }
2592
- function handleClick({ disabled, onClick }) {
2593
- return (ev) => {
2594
- !disabled && onClick && onClick(ev);
2595
- };
2596
- }
2597
-
2598
- const buttonStyleMap = {
2599
- primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
2600
- secondary: 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
2601
- };
2602
- const secondaryButtonStyleMap = {
2603
- 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'),
2604
- 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'),
2605
- };
2606
- const Button = JSX(({ children, ...props }) => {
2607
- const button = useButton();
2608
- const { className, version = 'primary', active, disabled, type = 'button', rounded = true, role, onClick, } = button(props);
2609
- return (jsx("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs', {
2610
- 'text-white bg-primary-active': active,
2611
- 'bg-main-gray text-main-disabled cursor-not-allowed': disabled,
2612
- 'rounded-md': rounded,
2613
- }, !active && !disabled
2614
- ? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
2615
- : '', className), type: type, role: role, onClick: onClick, children: children }));
2616
- });
2617
-
2618
3250
  const ResponseTypeDialog = JSX(function ({ responseType, typeForm, }) {
2619
3251
  const responseOK = responseType === 'OK';
2620
3252
  const statusIcon = responseOK ? 'ResponseOKIcon' : 'ResponseFailIcon';
@@ -2773,50 +3405,6 @@
2773
3405
  return [storedValue, setValue];
2774
3406
  }
2775
3407
 
2776
- 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, {
2777
- 'backdrop-blur': blur,
2778
- }), 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" }) })));
2779
-
2780
- const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
2781
- const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
2782
- const onToggle = useCallback(() => {
2783
- setIsUnfolded((_) => !_);
2784
- }, []);
2785
- const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
2786
- const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
2787
- return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
2788
- });
2789
-
2790
- function useResizeObserver(callback, deps) {
2791
- const ref = useRef(null);
2792
- useEffect(() => {
2793
- const element = ref?.current;
2794
- if (!element) {
2795
- return undefined;
2796
- }
2797
- const observer = new ResizeObserver((entries) => {
2798
- callback(element, entries[0]);
2799
- });
2800
- observer.observe(element);
2801
- return () => {
2802
- observer.disconnect();
2803
- };
2804
- }, [callback, ...deps]);
2805
- return ref;
2806
- }
2807
-
2808
- const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
2809
- const containerRef = useRef(null);
2810
- const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
2811
- if (containerRef.current) {
2812
- containerRef.current.style.maxHeight = isUnfolded
2813
- ? `${childrenWrapperEl.scrollHeight}px`
2814
- : '';
2815
- }
2816
- }, [isUnfolded]);
2817
- 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 }) }));
2818
- });
2819
-
2820
3408
  const CONSENT_ALL_DOCS_TEXT = 'Согласие на все документы';
2821
3409
  const CONSENT_REQUIRED = 'Отметьте все обязательные соглашения';
2822
3410
  const GroupedConsents = JSX(({ inputs = [], typeForm = '', field, key }) => {
@@ -2869,7 +3457,7 @@
2869
3457
  posTerminal: false,
2870
3458
  consentToReceiveMaterials: false,
2871
3459
  consentDataProcessing: false,
2872
- processPersonalDataLeadFlg: false,
3460
+ processPersonalDataFlg: false,
2873
3461
  consentProviderFlg: false,
2874
3462
  consentOthersFlg: false,
2875
3463
  consentInformFlg: false,
@@ -2900,7 +3488,7 @@
2900
3488
  const updateUserTask = (body) => doRequest('/user-data/updateUserTask', 'PUT', body);
2901
3489
 
2902
3490
  const getUpdateUserProfileData = (profileId, formData) => {
2903
- const { name = '', surname = '', middleName = '', birthday = '', phone = '', email = '', processPersonalDataLeadFlg, consentProviderFlg, consentPfrFlg, consentPhotoFlg, consentAssignmentClaimsFlg, consentCollectionFlg, consentInformFlg, } = formData;
3491
+ const { name = '', surname = '', middleName = '', birthday = '', phone = '', email = '', processPersonalDataFlg, consentProviderFlg, consentPfrFlg, consentPhotoFlg, consentAssignmentClaimsFlg, consentCollectionFlg, consentInformFlg, } = formData;
2904
3492
  return {
2905
3493
  profile: {
2906
3494
  id: profileId,
@@ -2910,7 +3498,7 @@
2910
3498
  birthDate: birthday && formatDate(birthday, true),
2911
3499
  email,
2912
3500
  phone: formatPhone(phone),
2913
- processPersonalDataLeadFlg: Boolean(processPersonalDataLeadFlg),
3501
+ processPersonalDataFlg: Boolean(processPersonalDataFlg),
2914
3502
  consentProviderFlg: Boolean(consentProviderFlg),
2915
3503
  consentPfrFlg: Boolean(consentPfrFlg),
2916
3504
  consentPhotoFlg: Boolean(consentPhotoFlg),
@@ -3742,13 +4330,13 @@
3742
4330
  return (jsx(DefaultFoldButton, { icon: icons[Number(isUnfolded)], label: labels[Number(isUnfolded)], onClick: onToggle }));
3743
4331
  };
3744
4332
 
3745
- const ICONS$1 = ['ArrowDownIcon', 'ArrowUpIcon'];
4333
+ const ICONS = ['ArrowDownIcon', 'ArrowUpIcon'];
3746
4334
  const resultsGridStyle = 'space-y-px lg:space-y-0 lg:grid lg:grid-cols-12 gap-2xs';
3747
4335
  const renderGridBlocks = ({ topItemsCount = 0, label = '', block, blocksToRender = [], ...rest }) => {
3748
4336
  const [visibleBlocks, hiddenBlocks] = topItemsCount > 0
3749
4337
  ? [blocksToRender.slice(0, topItemsCount), blocksToRender.slice(topItemsCount)]
3750
4338
  : [blocksToRender, []];
3751
- 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 })) })] }));
4339
+ 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 })) })] }));
3752
4340
  };
3753
4341
 
3754
4342
  const FilteredBlocks = JSX(({ blocksSection, blocksToRender = [], notFound, ...rest }) => {
@@ -5062,10 +5650,10 @@
5062
5650
  }
5063
5651
  }), [options?.parent]);
5064
5652
  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
5065
- ? renderFoldButton$3(options?.parent, data, isVisible)
5653
+ ? renderFoldButton$1(options?.parent, data, isVisible)
5066
5654
  : null })) : (jsx("div", { children: visibleCells }))] }));
5067
5655
  });
5068
- 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: () => {
5656
+ 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: () => {
5069
5657
  if (parent !== undefined) {
5070
5658
  defaultEventBus.fire('fold', { type: 'fold', isUnfolded: !isUnfolded, parent });
5071
5659
  }
@@ -5135,8 +5723,8 @@
5135
5723
  creditInRshbCd: '',
5136
5724
  },
5137
5725
  5: {
5138
- region: '',
5139
- addressBranch: '',
5726
+ regionRetail: '',
5727
+ addressRetail: '',
5140
5728
  bankEmployeeCode: '',
5141
5729
  },
5142
5730
  };
@@ -5316,7 +5904,7 @@
5316
5904
  inputs: [],
5317
5905
  },
5318
5906
  {
5319
- inputs: [{ fieldType: 'common', name: 'fullAddress', required: true }],
5907
+ inputs: [{ fieldType: 'common', name: 'fullAddress', required: true, dadata: true }],
5320
5908
  },
5321
5909
  ],
5322
5910
  [
@@ -5392,10 +5980,10 @@
5392
5980
  inputs: [],
5393
5981
  },
5394
5982
  {
5395
- inputs: [{ fieldType: 'common', name: 'region', required: true }],
5983
+ inputs: [{ fieldType: 'common', name: 'regionRetail', required: true }],
5396
5984
  },
5397
5985
  {
5398
- inputs: [{ fieldType: 'common', name: 'addressBranch', required: true }],
5986
+ inputs: [{ fieldType: 'common', name: 'addressRetail', required: true }],
5399
5987
  },
5400
5988
  {
5401
5989
  title: 'Код представителя Банка',
@@ -5766,824 +6354,458 @@
5766
6354
  });
5767
6355
  }
5768
6356
  };
5769
- const handleInputBuy = (setCalcState, currencyRatesBuy) => (value, currencyTo, currencyFrom) => {
5770
- setCalcState({ inputBuy: formatValue(value), selectSell: currencyFrom });
5771
- const rate = currencyRatesBuy.find((_) => _.currency?.currency === currencyFrom)?.saleExchangeRate ||
5772
- currencyRatesBuy.find((_) => _.currency?.currency === currencyTo)?.saleExchangeRate;
5773
- if (rate) {
5774
- setCalcState({
5775
- inputSell: String(calculateResult(value, rate, currencyTo === Currency.RUB) || ''),
5776
- });
5777
- }
5778
- };
5779
-
5780
- const EXCHANGE_RATES_URL = `${API_BASE_URI}/exchangerates`;
5781
- function useFetchExchangeRateData(currentRegion) {
5782
- const regionCode = currentRegion?.code || '000';
5783
- const { data } = useAsyncData(EXCHANGE_RATES_URL + `?regionCode=${regionCode}`, fetchJSONUnsafe);
5784
- return data || {};
5785
- }
5786
-
5787
- const ExchangeRateTile = JSX(({ className = '', title = 'Курсы обмена валют', button, ...rest }) => {
5788
- const [currentLocation] = useLocation();
5789
- const exchangeRates = useFetchExchangeRateData(currentLocation);
5790
- const currencyRates = getCurrencyRates(exchangeRates?.exchangeRate?.currencies);
5791
- const currencyRatesBuy = currencyRates.filter((_) => _.buyExchangeRate);
5792
- currencyRatesBuy.unshift({ currency: { currency: Currency.RUB } });
5793
- const currencyRatesSell = currencyRates.filter((_) => _.saleExchangeRate);
5794
- currencyRatesSell.push({ currency: { currency: Currency.RUB } });
5795
- return (jsx(BlockWrapper, { className: style('box-border min-h-80', className), ...rest, children: jsx(BaseTile, { className: "h-full", title: jsx(Heading, { headingType: "h4", title: title, className: "whitespace-pre-wrap" }), children: jsxs("div", { className: "flex w-full gap-6xl flex-wrap @lg:flex-nowrap", children: [jsxs("div", { className: "w-full @2xl:w-auto @5xl:w-1/2", children: [currencyRates ? (jsx(CurrencyTable, { className: "mb-xl", exchangeCurrencyItems: currencyRates })) : null, jsx(CurrentLocation, { address: exchangeRates?.address })] }), jsx(ExchangeCurrencyCalculator, { className: "grow w-1/2", currencyRatesBuy: currencyRatesBuy, currencyRatesSell: currencyRatesSell, button: button })] }) }) }));
5796
- });
5797
- const getCurrencyRates = (currencies) => currencies?.filter((_) => [1, 2, 3].includes(_?.currency?.id)) || [];
5798
-
5799
- const LinkList = JSX(({ className = '', items }) => {
5800
- const link = useLink();
5801
- return (jsx("ul", { className: style('flex flex-col gap-s w-full', className), children: items?.map(renderLinkListItem(link)) }));
5802
- });
5803
- const renderLinkListItem = (link) => ({ dataFooter, ...linkProps }, i) => {
5804
- const { text, href, target, onClick } = link(linkProps);
5805
- if (!text) {
5806
- return null;
5807
- }
5808
- return (jsx("li", { className: "list-none", children: jsx("a", { className: "hover:text-primary-main font-light", role: "link", href: href, target: target || '_self', onClick: onClick, ...getAspectsAttributes(dataFooter), children: text ? text : null }) }, String(i)));
5809
- };
5810
-
5811
- const AccordionFoldButton = JSX(({ label, labelIconBgVersion, icon, onToggle, labelIcon }) => (jsx(TextWithIcon, { tag: "button", className: style('border-none bg-transparent items-center group/button', labelIcon?.icon ? 'py-xs' : 'py-lg'), onClick: onToggle, textNode: jsxs("div", { className: "flex items-center text-start group-hover/button:text-primary-main gap-s", children: [renderRoundedIcon(labelIcon, labelIconBgVersion), label ? (jsx(Text, { size: "text-h6", font: "font-normal", children: label })) : null] }), iconNode: icon ? jsx(Icon, { name: icon, iconVersion: "color", width: "24", height: "24" }) : null })));
5812
-
5813
- const getFoldableStyles = (isMobile = false) => isMobile ? 'flex flex-wrap group-last:last:pb-0' : 'grid grid-cols-12 [&>*]:pb-m';
5814
-
5815
- const getIconName = (isUnfolded = false, isMobile = false) => isMobile ? getMobileName(isUnfolded) : getDesktopName(isUnfolded);
5816
- const getDesktopName = (isUnfolded = false) => (isUnfolded ? 'MinusIcon' : 'PlusIcon');
5817
- const getMobileName = (isUnfolded = false) => isUnfolded ? 'ArrowUpSolidIcon' : 'ArrowDownSolidIcon';
5818
-
5819
- const RollupItem = UniBlock(({ className = '', isExpanded, isFoldButtonOnTop = true, label = 'Развернуть', labelIcon, labelIconBgVersion, foldButtonVersion = 'default',
5820
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
5821
- version, role, ...rest }) => {
5822
- const isMobile = useMobileMode();
5823
- return (jsx(BlockWrapper, { className: style('w-full border-0 border-b border-solid border-main-divider last:border-b-0', className), defaultPadding: "p-0", tag: "div", version: "transparent", role: role, ...rest, children: jsx(Foldable, { isFoldButtonOnTop: isFoldButtonOnTop, unfoldedByDefault: isExpanded, renderFoldableSection: ({ isUnfolded }) => (jsx(FoldableSection, { className: style('gap-lg', getFoldableStyles(isMobile)), isUnfolded: isUnfolded, children: renderChildren({
5824
- ...rest,
5825
- extraProps: { className: 'w-full', padding: 'p-0' },
5826
- }) })), renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$2({
5827
- foldButtonVersion,
5828
- label,
5829
- labelIcon,
5830
- labelIconBgVersion,
5831
- isUnfolded,
5832
- onToggle,
5833
- isMobile,
5834
- }) }) }));
5835
- }, {
5836
- childrenTypes: { exclude: ['RollupItem'] },
5837
- });
5838
- const renderFoldButton$2 = ({ foldButtonVersion, label: defaultLabel, labelIcon, labelIconBgVersion, isUnfolded, onToggle, isMobile = false, }) => {
5839
- const label = defaultLabel || (isUnfolded ? 'Скрыть' : 'Развернуть');
5840
- const icon = getIconName(isUnfolded, isMobile);
5841
- return foldButtonVersion === 'accordion' ? (jsx(AccordionFoldButton, { label: label, labelIcon: labelIcon, labelIconBgVersion: labelIconBgVersion, icon: icon, onToggle: onToggle })) : (jsx(DefaultFoldButton, { label: label, icon: isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon', onClick: onToggle }));
5842
- };
5843
-
5844
- const Sitemap = JSX(({ navigationItems }) => (jsx("div", { className: "w-full", role: "menu", children: renderTopItems(navigationItems) })));
5845
- const renderTopItems = (topItems) => topItems
5846
- ?.filter((_) => _.icon?.icon)
5847
- .map((item, i) => (jsx(RollupItem, { foldButtonVersion: "accordion", label: item?.text, labelIcon: item?.icon, role: "menuitem", children: item.items ? jsx(LinkList, { items: item.items }) : null }, String(i))));
5848
-
5849
- const Contacts = JSX(({ className = '', items = [] }) => items?.length ? (jsx("div", { className: style('space-y-m', className), children: items.map(renderContactsGroup) })) : null);
5850
- const renderContactsGroup = (item, i) => (jsxs("div", { className: "space-y-m", children: [jsx("div", { children: jsx(Text, { size: "text-l", font: "font-medium", children: item?.title }) }), jsx("div", { className: "space-y-m", children: item.items?.map(renderContact) })] }, String(i)));
5851
- const renderContact = (item, i) => (jsxs("div", { className: "space-y-2xs", children: [jsx("div", { children: renderText$1(item.type, item.text) }), jsx(Paragraph, { size: "text-s", font: "font-light", color: "text-secondary-text", children: item.description })] }, String(i)));
5852
- const renderText$1 = (type, text = '') => {
5853
- switch (type) {
5854
- case 'tel':
5855
- return (jsx("a", { className: "text-primary-text hover:text-primary-main no-underline", href: `tel:${formatTel(text)}`, children: jsx(Text, { size: "text-h6", children: text }) }));
5856
- case 'email':
5857
- return (jsx("a", { className: "no-underline", href: `mailto:${text}`, children: jsx(Paragraph, { size: "text-xl", font: "font-light", color: "text-primary-text", children: text }) }));
5858
- default:
5859
- return jsx("span", { children: text });
5860
- }
5861
- };
5862
- const formatTel = (s) => s.replaceAll(/\D/g, '');
5863
-
5864
- const HorizontalNavigationLink = JSX(({ className = '', index, text, ...rest }) => {
5865
- const link = useLink();
5866
- const { href, target, onClick } = link(rest);
5867
- return (jsx("a", { className: style('text-secondary-text', className), href: href, target: target, onClick: onClick, children: text || `Документ ${index}` }));
5868
- });
5869
-
5870
- const HorizontalNavigation = JSX(({ className = '', title, links }) => (jsx("div", { className: className, children: links?.length ? (jsxs("div", { className: "flex justify-between lg:items-center flex-col lg:flex-row gap-lg py-lg border-y border-y-main-divider", children: [jsx("div", { className: "lg:hidden", children: jsx(Text, { size: "text-l", font: "font-normal", children: title }) }), links.map((_, i) => (jsx(HorizontalNavigationLink, { index: i, className: "text-l font-light lg:max-w-[292px]", ..._ }, String(i))))] })) : null })));
5871
-
5872
- const LEFT_COLUMN_STYLE = 'w-full lg:w-52';
5873
-
5874
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
5875
- const renderLogoSearchBar = (common, navigationItems) => null;
5876
-
5877
- const TextInformationLink = JSX(({ className = '', index, ...rest }) => {
5878
- const link = useLink();
5879
- const { href, target, text, onClick } = link(rest);
5880
- return (jsx("a", { className: style('text-xs font-light text-secondary-text visited:text-secondary-text hover:text-primary-main inline-block no-underline max-w-[292px]', className), href: href, target: target, onClick: onClick, children: text || `Документ ${index}` }));
5881
- });
5882
-
5883
- const TextInformation = JSX(({ className = '', links, license }) => (jsxs("div", { className: style('@container space-y-lg', className), children: [license ? (jsx("div", { children: jsx(Text, { size: "text-xs", font: "font-light", color: "text-secondary-text", children: `\u00a9\u00A02000-${new Date().getFullYear()}\u00A0${license}` }) })) : null, links?.length ? (jsx("div", { className: "flex flex-col @5xl:flex-row justify-start items-start gap-x-lg gap-y-xs", children: links.map((_, i) => (jsx(TextInformationLink, { index: i, ..._ }, String(i)))) })) : null] })));
5884
-
5885
- const Footer = UniBlock(({ className, footer, ...rest }) => {
5886
- const { navigationItems } = rest.options?.page?.navigation ?? {};
5887
- rest.options?.page?.common ?? {};
5888
- const { documents, relatedEnterprises, contacts, mediaLinks = [], horizontalNavigationTitle, feedbackButton, license, otherLinks = [], } = footer ?? {};
5889
- const linkStyle = '!text-left text-s font-light';
5890
- return (jsxs(BlockWrapper, { tag: "footer", className: style('grid gap-y-xl p-4xl pb-24 lg:p-xl', className), ...rest, children: [renderLogoSearchBar(), jsxs("div", { className: "flex flex-col lg:flex-row items-center @lg:items-stretch gap-lg lg:gap-6xl ", children: [jsx(Sitemap, { navigationItems: navigationItems }), jsx("div", { className: "border-t border-main-divider lg:hidden w-full" }), jsxs("div", { className: style(LEFT_COLUMN_STYLE, 'flex flex-col shrink-0 overflow-hidden space-y-xl'), children: [jsx(Contacts, { items: contacts }), feedbackButton ? (jsx(LinkButton, { className: "w-full", version: "primary", ...feedbackButton })) : null, mediaLinks.map((_, i) => (jsx(SocialMedia, { media: _?.links ?? [], showButtonText: false, stretched: true, children: _?.title }, String(i)))), otherLinks.map((_, i) => (jsx(LinkButton, { className: linkStyle, version: "link", ..._, children: _?.text }, String(i))))] })] }), jsx(HorizontalNavigation, { title: horizontalNavigationTitle, links: relatedEnterprises }), jsx(TextInformation, { links: documents, license: license })] }));
5891
- });
5892
-
5893
- const GrantSupport = UniBlock(({ className, title, button, regionSource, data, ...rest }) => {
5894
- const [region, setRegion] = useState({ key: '' });
5895
- const regions = regionSource?.regions ?? [];
5896
- const buttonStyle = getRegularButtonClasses({
5897
- className: 'text-white',
5898
- version: button?.version || 'primary',
5899
- });
5900
- const regionHref = regions?.find((_) => _.name === region.key)?.href;
5901
- const buttonText = button?.text ? button.text : 'Перейти';
5902
- return (jsx(BlockWrapper, { className: className, defaultPadding: "p-6xl", ...rest, children: jsxs("div", { className: "container max-w-[978px] space-y-m", children: [title ? jsx(Heading, { headingType: "h3", title: title, className: "@xl:text-center" }) : null, regions ? (jsx(SelectControl, { label: "\u0412\u0430\u0448 \u0440\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D", isSearch: true, options: regions.map(({ name = '' }) => ({ key: name, text: name })), value: region, onChange: setRegion })) : null, regionHref ? (jsx("div", { className: "text-center", children: jsx(LinkButton, { href: regionHref, target: "_blank", className: style('p-m w-full @xl:w-auto', buttonStyle), data: getAspectsWithInclude(data, region?.key), children: buttonText }) })) : null] }) }));
5903
- });
5904
-
5905
- const BUTTON_STYLE = {
5906
- default: 'bg-main-divider text-primary-main rounded hover:text-primary-main',
5907
- transparent: 'backdrop-opacity-30 bg-white/30 hover:text-primary-hover text-white',
5908
- };
5909
- const InternetBankButton = JSX(({ version, text, mobileText, ...rest }) => {
5910
- const isMobileMode = useMobileMode();
5911
- const buttonText = isMobileMode ? mobileText : text;
5912
- return buttonText ? (jsx(LinkButton, { className: style('py-s px-lg font-light whitespace-nowrap', BUTTON_STYLE[version === 'transparent' ? 'transparent' : 'default']), ...rest, children: buttonText })) : null;
5913
- });
5914
-
5915
- const HeaderTop = JSX(({ bgColor, logo, alwaysShowLogo, internetBankButton, version, backwardButton }) => {
5916
- const router = useRouter();
5917
- const isRootLocation = router.pathname === '/';
5918
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
5919
- const { dataFooter, dataHeader, ...logoProps } = logo ?? {};
5920
- const onClick = useCallback(() => {
5921
- router.back();
5922
- }, [router]);
5923
- return (jsxs("div", { className: "flex items-center justify-between w-full", children: [alwaysShowLogo || isRootLocation ? (jsx("div", { children: jsx(Logo, { className: "my-2xs", bgColor: bgColor, logo: logoProps, data: dataHeader, showTitle: false }) })) : (renderBackButton(onClick, backwardButton)), jsx(InternetBankButton, { version: version, ...internetBankButton })] }));
5924
- });
5925
- const renderBackButton = (onClick, text) => text ? (jsxs("button", { className: "flex items-center text-l my-2xs", onClick: onClick, type: "button", "aria-label": "\u041A\u043D\u043E\u043F\u043A\u0430 \u043D\u0430\u0437\u0430\u0434", children: [jsx(Icon, { name: "ChevronLeftIcon", iconVersion: "black", width: "24", height: "24" }), text] })) : null;
5926
-
5927
- const BG_COLOR_TO_BLOCK_VERSION = {
5928
- 'bg-white': 'primary',
5929
- transparent: 'transparent',
5930
- };
5931
- const Header = UniBlock(({ bgColor = 'bg-white', alwaysShowLogo = false, version = BG_COLOR_TO_BLOCK_VERSION[bgColor], portal, logo: customLogo = {}, ...rest }) => {
5932
- const { backwardButton, logo = {} } = rest.options?.page?.common ?? {};
5933
- const { internetBankButton } = portal || {};
5934
- const logoProps = customLogo.image?.icon || customLogo.image?.src ? customLogo : logo;
5935
- return (jsx(BlockWrapper, { tag: "header", defaultPadding: "", version: version, ...rest, children: jsx("div", { className: "container px-lg py-2xs box-border", children: jsx(HeaderTop, { bgColor: bgColor, logo: logoProps, alwaysShowLogo: alwaysShowLogo, internetBankButton: internetBankButton, version: version, backwardButton: backwardButton, ...rest }) }) }));
5936
- });
5937
-
5938
- const getInnerPadding = (isPadding = false) => isPadding ? {} : { padding: 'p-0' };
5939
-
5940
- const gapStyles = {
5941
- XXL: 'gap-6xl',
5942
- XL: 'gap-5xl',
5943
- L: 'gap-3xl',
5944
- M: 'gap-m',
5945
- S: 'gap-xs',
5946
- XS: 'gap-2xs',
5947
- '': '',
5948
- };
5949
-
5950
- const VerticalLayout = UniBlock(({ className = '', padding = 'p-0', gap = '', isInnerPadding = true, version = 'transparent', isTheme = false, isCardBorder = false, image, ...rest }) => {
5951
- const router = useRouter();
5952
- return (jsx(BlockWrapper, { className: style('relative flex flex-col', gapStyles[gap], image?.src ? 'bg-right-bottom bg-no-repeat' : '', className), ...(image?.src
5953
- ? { style: { backgroundImage: `url(${adjustSrc(router)(image?.src)})` } }
5954
- : {}), padding: padding, version: version, isTheme: isTheme, ...rest, children: renderChildren({
5955
- ...rest,
5956
- extraProps: {
5957
- className: style('w-full', getBorderStyle(isCardBorder)),
5958
- ...getInnerPadding(isInnerPadding),
5959
- },
5960
- }) }));
5961
- }, { childrenTypes: [] });
5962
-
5963
- const HorizontalLayout = UniBlock((props) => jsx(VerticalLayout, { ...props }), { childrenTypes: [] });
5964
-
5965
- const ImgBlock = JSX((props) => {
5966
- const { className, align, image, ...rest } = props;
5967
- const alignStyle = align ? style('flex', AlignJustifyStyle[align]) : '';
5968
- return (jsx(BlockWrapper, { className: style(alignStyle, className), defaultPadding: "p-0", ...rest, children: jsx(Img, { image: image }) }));
5969
- });
5970
-
5971
- const KILO = 1024;
5972
- const KILO_SIZES = ['байт', 'Кб', 'Мб', 'Гб', 'Тб', 'Пб'];
5973
- const formatBytes = (bytes, decimals = 2) => {
5974
- if (bytes === 0) {
5975
- return '';
5976
- }
5977
- const i = Math.floor(Math.log(bytes) / Math.log(KILO));
5978
- return `${parseFloat((bytes / Math.pow(KILO, i)).toFixed(decimals))} ${KILO_SIZES[i]}`;
5979
- };
5980
-
5981
- const LinkDocItem = JSX(({ icon, text, href, target, fileFormat, data, fileSize }) => {
5982
- const prefix = fileSize && fileFormat ? ',' : '';
5983
- const size = fileSize ?? '';
5984
- const format = fileFormat ? String(fileFormat) : '';
5985
- 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] }));
5986
- });
5987
- const addSpace = (size, format) => (size || format ? jsx("span", { children: ",\u00A0" }) : '');
5988
-
5989
- const linkIconStyle = 'min-w-11 min-h-11 h-fit p-2.5 bg-main-divider rounded-md';
5990
-
5991
- const renderDefaultItem = (router, icon) => (docBlockDef, i) => {
5992
- const href = adjustHref(router)(docBlockDef?.docType === 'Attachment' ? docBlockDef?.attachment?.src : docBlockDef?.href);
5993
- const fileSize = docBlockDef?.docType === 'Attachment'
5994
- ? formatBytes(docBlockDef?.attachment?.fileSize || 0)
5995
- : docBlockDef?.fileSize;
5996
- const fileFormat = docBlockDef?.docType === 'Attachment' ? getExtFromHref(href) : docBlockDef?.fileFormat;
5997
- 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)));
5998
- };
5999
- const renderImg = (icon) => icon ? jsx(Img, { className: linkIconStyle, image: icon, width: "24", height: "24" }) : null;
6000
- const getExtFromHref = (href) => {
6001
- if (!href) {
6002
- return '';
6003
- }
6004
- const index = href.lastIndexOf('.');
6005
- const regexp = new RegExp(/\/(.*)/);
6006
- const docFormat = index !== -1 ? href.substring(index + 1) : '';
6007
- return docFormat.includes('/') ? docFormat.replace(regexp, '') : docFormat;
6008
- };
6009
-
6010
- const ReportDialog = JSX(({ href, __html, target }) => {
6011
- const { close } = useDialogManager();
6012
- const router = useRouter();
6013
- const adjustedHref = adjustHref(router)(href);
6014
- const handleClose = useCallback(() => {
6015
- close();
6016
- }, []);
6017
- 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" })] }));
6018
- });
6019
-
6020
- const useReportDialog = (props) => {
6021
- const { open, close } = useDialogManager();
6022
- return {
6023
- open: (options = {}) => open(jsx(ReportDialog, { ...props }), options),
6024
- close,
6025
- };
6357
+ const handleInputBuy = (setCalcState, currencyRatesBuy) => (value, currencyTo, currencyFrom) => {
6358
+ setCalcState({ inputBuy: formatValue(value), selectSell: currencyFrom });
6359
+ const rate = currencyRatesBuy.find((_) => _.currency?.currency === currencyFrom)?.saleExchangeRate ||
6360
+ currencyRatesBuy.find((_) => _.currency?.currency === currencyTo)?.saleExchangeRate;
6361
+ if (rate) {
6362
+ setCalcState({
6363
+ inputSell: String(calculateResult(value, rate, currencyTo === Currency.RUB) || ''),
6364
+ });
6365
+ }
6026
6366
  };
6027
6367
 
6028
- const ReportDialogButton = JSX(({ text, href, target, __html, icon }) => {
6029
- if (!text && !__html) {
6030
- return null;
6031
- }
6032
- const reportDialog = useReportDialog({ __html, href, target });
6033
- const openReportDialog = useCallback(() => reportDialog.open(), [reportDialog]);
6034
- 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 })] }));
6368
+ const EXCHANGE_RATES_URL = `${API_BASE_URI}/exchangerates`;
6369
+ function useFetchExchangeRateData(currentRegion) {
6370
+ const regionCode = currentRegion?.code || '000';
6371
+ const { data } = useAsyncData(EXCHANGE_RATES_URL + `?regionCode=${regionCode}`, fetchJSONUnsafe);
6372
+ return data || {};
6373
+ }
6374
+
6375
+ const ExchangeRateTile = JSX(({ className = '', title = 'Курсы обмена валют', button, ...rest }) => {
6376
+ const [currentLocation] = useLocation();
6377
+ const exchangeRates = useFetchExchangeRateData(currentLocation);
6378
+ const currencyRates = getCurrencyRates(exchangeRates?.exchangeRate?.currencies);
6379
+ const currencyRatesBuy = currencyRates.filter((_) => _.buyExchangeRate);
6380
+ currencyRatesBuy.unshift({ currency: { currency: Currency.RUB } });
6381
+ const currencyRatesSell = currencyRates.filter((_) => _.saleExchangeRate);
6382
+ currencyRatesSell.push({ currency: { currency: Currency.RUB } });
6383
+ return (jsx(BlockWrapper, { className: style('box-border min-h-80', className), ...rest, children: jsx(BaseTile, { className: "h-full", title: jsx(Heading, { headingType: "h4", title: title, className: "whitespace-pre-wrap" }), children: jsxs("div", { className: "flex w-full gap-6xl flex-wrap @lg:flex-nowrap", children: [jsxs("div", { className: "w-full @2xl:w-auto @5xl:w-1/2", children: [currencyRates ? (jsx(CurrencyTable, { className: "mb-xl", exchangeCurrencyItems: currencyRates })) : null, jsx(CurrentLocation, { address: exchangeRates?.address })] }), jsx(ExchangeCurrencyCalculator, { className: "grow w-1/2", currencyRatesBuy: currencyRatesBuy, currencyRatesSell: currencyRatesSell, button: button })] }) }) }));
6035
6384
  });
6385
+ const getCurrencyRates = (currencies) => currencies?.filter((_) => [1, 2, 3].includes(_?.currency?.id)) || [];
6036
6386
 
6037
- const linkColumnsModeStyleMap = {
6038
- double: 'sm:flex-wrap sm:flex-row',
6039
- single: 'sm:flex-col',
6040
- };
6041
- const LinkDocs = UniBlock(({ className = '', title, description, align = 'text-center', documents, icon = { icon: 'DocIcon' }, columnsMode = 'double', ...rest }) => {
6042
- const router = useRouter();
6043
- 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] }));
6387
+ const LinkList = JSX(({ className = '', items }) => {
6388
+ const link = useLink();
6389
+ return (jsx("ul", { className: style('flex flex-col gap-s w-full', className), children: items?.map(renderLinkListItem(link)) }));
6044
6390
  });
6045
- const renderLinkDocItem = (router, icon) => (docBlockDef, i) => {
6046
- const docType = docBlockDef?.docType;
6047
- if (docType === '') {
6391
+ const renderLinkListItem = (link) => ({ dataFooter, ...linkProps }, i) => {
6392
+ const { text, href, target, onClick } = link(linkProps);
6393
+ if (!text) {
6048
6394
  return null;
6049
6395
  }
6050
- if ('reportSource' in docBlockDef && docBlockDef?.reportSource?.__html) {
6051
- return renderModalItem(icon)(docBlockDef, i);
6052
- }
6053
- return renderDefaultItem(router, icon)(docBlockDef, i);
6054
- };
6055
- const renderModalItem = (icon) => (props, i) => {
6056
- const commonProps = {
6057
- text: props.text,
6058
- target: props.target,
6059
- __html: props.reportSource?.__html,
6060
- };
6061
- 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;
6396
+ return (jsx("li", { className: "list-none", children: jsx("a", { className: "hover:text-primary-main font-light", role: "link", href: href, target: target || '_self', onClick: onClick, ...getAspectsAttributes(dataFooter), children: text ? text : null }) }, String(i)));
6062
6397
  };
6063
- const isLinkDoc = (data) => 'href' in data;
6064
6398
 
6065
- const MobileAppTile = UniBlock(({ className, padding, align = 'text-left', buttons = [], description, image, __html, headingType, qr, additionalDescription = '', title = 'Мобильное приложение', version = 'primary', ...rest }) => {
6066
- const containerStyle = version === 'secondary' ? 'p-m min-w-32' : 'min-w-24';
6067
- const img = image?.src ? jsx(Img, { className: "hidden lg:block", image: image }) : null;
6068
- 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] })] }) }));
6069
- });
6399
+ const AccordionFoldButton = JSX(({ label, labelIconBgVersion, icon, onToggle, labelIcon }) => (jsx(TextWithIcon, { tag: "button", className: style('border-none bg-transparent items-center group/button', labelIcon?.icon ? 'py-xs' : 'py-lg'), onClick: onToggle, textNode: jsxs("div", { className: "flex items-center text-start group-hover/button:text-primary-main gap-s", children: [renderRoundedIcon(labelIcon, labelIconBgVersion), label ? (jsx(Text, { size: "text-h6", font: "font-normal", children: label })) : null] }), iconNode: icon ? jsx(Icon, { name: icon, iconVersion: "color", width: "24", height: "24" }) : null })));
6070
6400
 
6071
- const getVersion = (isPrimary, type) => isPrimary && type !== 'underlined' ? 'primary' : 'secondary';
6401
+ const getFoldableStyles = (isMobile = false) => isMobile ? 'flex flex-wrap group-last:last:pb-0' : 'grid grid-cols-12 [&>*]:pb-m';
6072
6402
 
6073
- const getBadgeCount = (blocks = [], filter = {}) => blocks.filter(({ content = {} }) => targetMatchPattern(filter, content)).length;
6403
+ const getIconName = (isUnfolded = false, isMobile = false) => isMobile ? getMobileName(isUnfolded) : getDesktopName(isUnfolded);
6404
+ const getDesktopName = (isUnfolded = false) => (isUnfolded ? 'MinusIcon' : 'PlusIcon');
6405
+ const getMobileName = (isUnfolded = false) => isUnfolded ? 'ArrowUpSolidIcon' : 'ArrowDownSolidIcon';
6074
6406
 
6075
- const scalarCmp = (a, b) => a === b;
6076
- const arrCmp = (cmp = scalarCmp) => (a, b) => a === b || Boolean(a && b && a.length === b.length && a.every((_, i) => cmp(_, b[i])));
6077
- const objCmp = (cmp) => (a, b) => a === b ||
6078
- Boolean(a &&
6079
- b &&
6080
- Object.keys(a).length === Object.keys(b).length &&
6081
- Object.entries(a).every(([key, value]) => cmp(value, b[key])));
6082
- function combineBoolCmps(...comparators) {
6083
- return (a, b) => comparators.some((cmp) => cmp(a, b));
6084
- }
6407
+ const RollupItem = UniBlock(({ className = '', isExpanded, isFoldButtonOnTop = true, label = 'Развернуть', labelIcon, labelIconBgVersion, foldButtonVersion = 'default',
6408
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
6409
+ version, role, ...rest }) => {
6410
+ const isMobile = useMobileMode();
6411
+ return (jsx(BlockWrapper, { className: style('w-full border-0 border-b border-solid border-main-divider last:border-b-0', className), defaultPadding: "p-0", tag: "div", version: "transparent", role: role, ...rest, children: jsx(Foldable, { isFoldButtonOnTop: isFoldButtonOnTop, unfoldedByDefault: isExpanded, renderFoldableSection: ({ isUnfolded }) => (jsx(FoldableSection, { className: style('gap-lg', getFoldableStyles(isMobile)), isUnfolded: isUnfolded, children: renderChildren({
6412
+ ...rest,
6413
+ extraProps: { className: 'w-full', padding: 'p-0' },
6414
+ }) })), renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton({
6415
+ foldButtonVersion,
6416
+ label,
6417
+ labelIcon,
6418
+ labelIconBgVersion,
6419
+ isUnfolded,
6420
+ onToggle,
6421
+ isMobile,
6422
+ }) }) }));
6423
+ }, {
6424
+ childrenTypes: { exclude: ['RollupItem'] },
6425
+ });
6426
+ const renderFoldButton = ({ foldButtonVersion, label: defaultLabel, labelIcon, labelIconBgVersion, isUnfolded, onToggle, isMobile = false, }) => {
6427
+ const label = defaultLabel || (isUnfolded ? 'Скрыть' : 'Развернуть');
6428
+ const icon = getIconName(isUnfolded, isMobile);
6429
+ return foldButtonVersion === 'accordion' ? (jsx(AccordionFoldButton, { label: label, labelIcon: labelIcon, labelIconBgVersion: labelIconBgVersion, icon: icon, onToggle: onToggle })) : (jsx(DefaultFoldButton, { label: label, icon: isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon', onClick: onToggle }));
6430
+ };
6085
6431
 
6086
- const hotFilterRecordCmp = objCmp(combineBoolCmps(scalarCmp, arrCmp()));
6432
+ const Sitemap = JSX(({ navigationItems }) => (jsx("div", { className: "w-full", role: "menu", children: renderTopItems(navigationItems) })));
6433
+ const renderTopItems = (topItems) => topItems
6434
+ ?.filter((_) => _.icon?.icon)
6435
+ .map((item, i) => (jsx(RollupItem, { foldButtonVersion: "accordion", label: item?.text, labelIcon: item?.icon, role: "menuitem", children: item.items ? jsx(LinkList, { items: item.items }) : null }, String(i))));
6087
6436
 
6088
- const EMPTY_ARR = [];
6089
- const EMPTY_OBJ = {};
6090
- const useHotFilters = ({ hotFilters = EMPTY_ARR, filtrationState = EMPTY_OBJ, blocks = EMPTY_ARR, onFiltrationStateChange, }) => {
6091
- const activeItemIndex = useMemo(() => Math.max(0, hotFilters.findIndex((_) => hotFilterRecordCmp(_.filter, filtrationState))), [hotFilters, filtrationState]);
6092
- const items = useMemo(() => hotFilters.map((_) => ({
6093
- text: _.text,
6094
- count: getBadgeCount(blocks, _.filter),
6095
- version: getVersion(_ === hotFilters[activeItemIndex]),
6096
- })), [hotFilters, blocks, activeItemIndex]);
6097
- const handleChange = useCallback((_) => {
6098
- onFiltrationStateChange(hotFilters[items.indexOf(_)].filter);
6099
- }, [hotFilters, items]);
6100
- return {
6101
- activeItem: items[activeItemIndex],
6102
- items: items,
6103
- onChange: handleChange,
6104
- };
6437
+ const Contacts = JSX(({ className = '', items = [] }) => items?.length ? (jsx("div", { className: style('space-y-m', className), children: items.map(renderContactsGroup) })) : null);
6438
+ const renderContactsGroup = (item, i) => (jsxs("div", { className: "space-y-m", children: [jsx("div", { children: jsx(Text, { size: "text-l", font: "font-medium", children: item?.title }) }), jsx("div", { className: "space-y-m", children: item.items?.map(renderContact) })] }, String(i)));
6439
+ const renderContact = (item, i) => (jsxs("div", { className: "space-y-2xs", children: [jsx("div", { children: renderText$1(item.type, item.text) }), jsx(Paragraph, { size: "text-s", font: "font-light", color: "text-secondary-text", children: item.description })] }, String(i)));
6440
+ const renderText$1 = (type, text = '') => {
6441
+ switch (type) {
6442
+ case 'tel':
6443
+ return (jsx("a", { className: "text-primary-text hover:text-primary-main no-underline", href: `tel:${formatTel(text)}`, children: jsx(Text, { size: "text-h6", children: text }) }));
6444
+ case 'email':
6445
+ return (jsx("a", { className: "no-underline", href: `mailto:${text}`, children: jsx(Paragraph, { size: "text-xl", font: "font-light", color: "text-primary-text", children: text }) }));
6446
+ default:
6447
+ return jsx("span", { children: text });
6448
+ }
6105
6449
  };
6450
+ const formatTel = (s) => s.replaceAll(/\D/g, '');
6106
6451
 
6107
- const badgeBgStyleMap = {
6108
- primary: 'bg-white/30',
6109
- secondary: 'bg-main-divider',
6110
- };
6111
- const badgeTextColorStyleMap = {
6112
- primary: { desktop: 'text-white', mobile: 'text-primary-text' },
6113
- secondary: { desktop: 'text-secondary-text', mobile: 'text-secondary-text' },
6114
- };
6115
- const Badge$1 = JSX(({ count, version = 'secondary' }) => {
6116
- const isMobileMode = useMobileMode();
6117
- const badgeBgStyle = isMobileMode ? 'bg-main-divider' : badgeBgStyleMap[version];
6118
- const textStyle = badgeTextColorStyleMap[version][isMobileMode ? 'mobile' : 'desktop'];
6119
- 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 }) }));
6452
+ const HorizontalNavigationLink = JSX(({ className = '', index, text, ...rest }) => {
6453
+ const link = useLink();
6454
+ const { href, target, onClick } = link(rest);
6455
+ return (jsx("a", { className: style('text-secondary-text', className), href: href, target: target, onClick: onClick, children: text || `Документ ${index}` }));
6120
6456
  });
6121
6457
 
6122
- const getButtonClassNames = (isActive) => ({
6123
- btn: `w-96 ${isActive ? 'p-m border-none bg-primary-main text-white' : 'p-s ease-in duration-300 bg-white'}`,
6124
- text: isActive ? 'mb-xs text-xl' : 'mb-2xs text-l text-primary-text',
6125
- desc: `font-light ${isActive ? 'text-l text-white' : 'text-m text-secondary-text'}`,
6126
- icon: isActive ? '' : 'text-primary-main',
6127
- iconVersion: (isActive ? 'white' : 'normal'),
6128
- oldText: 'text-m text-center',
6129
- oldDesc: 'text-m-light',
6458
+ const HorizontalNavigation = JSX(({ className = '', title, links }) => (jsx("div", { className: className, children: links?.length ? (jsxs("div", { className: "flex justify-between lg:items-center flex-col lg:flex-row gap-lg py-lg border-y border-y-main-divider", children: [jsx("div", { className: "lg:hidden", children: jsx(Text, { size: "text-l", font: "font-normal", children: title }) }), links.map((_, i) => (jsx(HorizontalNavigationLink, { index: i, className: "text-l font-light lg:max-w-[292px]", ..._ }, String(i))))] })) : null })));
6459
+
6460
+ const LEFT_COLUMN_STYLE = 'w-full lg:w-52';
6461
+
6462
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
6463
+ const renderLogoSearchBar = (common, navigationItems) => null;
6464
+
6465
+ const TextInformationLink = JSX(({ className = '', index, ...rest }) => {
6466
+ const link = useLink();
6467
+ const { href, target, text, onClick } = link(rest);
6468
+ return (jsx("a", { className: style('text-xs font-light text-secondary-text visited:text-secondary-text hover:text-primary-main inline-block no-underline max-w-[292px]', className), href: href, target: target, onClick: onClick, children: text || `Документ ${index}` }));
6130
6469
  });
6131
- const renderTabItemInner = ({ text, description, icon, isActive, type, }) => {
6132
- const buttonClassNames = getButtonClassNames(isActive);
6133
- 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: {
6134
- ...icon,
6135
- iconVersion: icon?.iconVersion ?? buttonClassNames.iconVersion,
6136
- }, 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 })] })] }));
6137
- };
6138
6470
 
6139
- const tabPaddingStyleMap = {
6140
- default: 'px-xs',
6141
- underlined: 'px-m',
6142
- animated: 'px-m border border-gray cursor-pointer text-left border-b-0 mt-auto flex gap-2xs',
6143
- };
6144
- const tabTextStyle = 'text-secondary-text hover:text-primary-main';
6145
- const activeTabTextStyleMap = {
6146
- default: 'text-black sm:text-white',
6147
- underlined: 'text-primary-main border-b-2',
6148
- animated: 'text-white sm:text-white',
6149
- };
6150
- const tabBgStyleMap = {
6151
- default: 'bg-white',
6152
- underlined: 'bg-white',
6153
- animated: 'p-1 ease-in duration-300 bg-white text-primary-text h-[70px] w-96',
6154
- };
6155
- const activeTabBgStyleMap = {
6156
- default: 'bg-white sm:bg-primary-main',
6157
- underlined: 'bg-white',
6158
- animated: 'p-2 border-none bg-primary-main text-white h-20 w-96',
6159
- };
6160
- const TabItemInner = JSX(({ tag = 'div', item = {}, isActive = false, type = 'default', onClick }) => {
6161
- const Tag = tag;
6162
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
6163
- const { text, description, icon, count, tabName, ...link } = item;
6164
- 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({
6165
- text,
6166
- description,
6167
- icon,
6168
- isActive,
6169
- type,
6170
- }), Number.isInteger(count) ? (jsx("div", { className: "ml-xs", role: "status", "aria-label": `Количество программ и сервисов ${count}`, children: jsx(Badge$1, { count: count, version: getVersion(isActive, type) }) })) : null] }) }));
6471
+ const TextInformation = JSX(({ className = '', links, license }) => (jsxs("div", { className: style('@container space-y-lg', className), children: [license ? (jsx("div", { children: jsx(Text, { size: "text-xs", font: "font-light", color: "text-secondary-text", children: `\u00a9\u00A02000-${new Date().getFullYear()}\u00A0${license}` }) })) : null, links?.length ? (jsx("div", { className: "flex flex-col @5xl:flex-row justify-start items-start gap-x-lg gap-y-xs", children: links.map((_, i) => (jsx(TextInformationLink, { index: i, ..._ }, String(i)))) })) : null] })));
6472
+
6473
+ const Footer = UniBlock(({ className, footer, ...rest }) => {
6474
+ const { navigationItems } = rest.options?.page?.navigation ?? {};
6475
+ rest.options?.page?.common ?? {};
6476
+ const { documents, relatedEnterprises, contacts, mediaLinks = [], horizontalNavigationTitle, feedbackButton, license, otherLinks = [], } = footer ?? {};
6477
+ const linkStyle = '!text-left text-s font-light';
6478
+ return (jsxs(BlockWrapper, { tag: "footer", className: style('grid gap-y-xl p-4xl pb-24 lg:p-xl', className), ...rest, children: [renderLogoSearchBar(), jsxs("div", { className: "flex flex-col lg:flex-row items-center @lg:items-stretch gap-lg lg:gap-6xl ", children: [jsx(Sitemap, { navigationItems: navigationItems }), jsx("div", { className: "border-t border-main-divider lg:hidden w-full" }), jsxs("div", { className: style(LEFT_COLUMN_STYLE, 'flex flex-col shrink-0 overflow-hidden space-y-xl'), children: [jsx(Contacts, { items: contacts }), feedbackButton ? (jsx(LinkButton, { className: "w-full", version: "primary", ...feedbackButton })) : null, mediaLinks.map((_, i) => (jsx(SocialMedia, { media: _?.links ?? [], showButtonText: false, stretched: true, children: _?.title }, String(i)))), otherLinks.map((_, i) => (jsx(LinkButton, { className: linkStyle, version: "link", ..._, children: _?.text }, String(i))))] })] }), jsx(HorizontalNavigation, { title: horizontalNavigationTitle, links: relatedEnterprises }), jsx(TextInformation, { links: documents, license: license })] }));
6171
6479
  });
6172
6480
 
6173
- const TabItem = JSX((props) => props?.item?.href ? jsx(LinkTabItem, { ...props }) : jsx(ButtonTabItem, { ...props }));
6174
- const LinkTabItem = JSX((props) => {
6175
- const link = useLink();
6176
- const handleClick = useCallback(() => {
6177
- props.onClick && props.onClick(props.item || {});
6178
- }, [props.onClick, props.item]);
6179
- const { onClick, ...item } = link({ ...props.item, onClick: handleClick });
6180
- return jsx(TabItemInner, { ...props, tag: "a", item: item, onClick: onClick });
6481
+ const GrantSupport = UniBlock(({ className, title, button, regionSource, data, ...rest }) => {
6482
+ const [region, setRegion] = useState({ key: '' });
6483
+ const regions = regionSource?.regions ?? [];
6484
+ const buttonStyle = getRegularButtonClasses({
6485
+ className: 'text-white',
6486
+ version: button?.version || 'primary',
6487
+ });
6488
+ const regionHref = regions?.find((_) => _.name === region.key)?.href;
6489
+ const buttonText = button?.text ? button.text : 'Перейти';
6490
+ return (jsx(BlockWrapper, { className: className, defaultPadding: "p-6xl", ...rest, children: jsxs("div", { className: "container max-w-[978px] space-y-m", children: [title ? jsx(Heading, { headingType: "h3", title: title, className: "@xl:text-center" }) : null, regions ? (jsx(SelectControl, { label: "\u0412\u0430\u0448 \u0440\u0435\u0433\u0438\u043E\u043D", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0440\u0435\u0433\u0438\u043E\u043D", isSearch: true, options: regions.map(({ name = '' }) => ({ key: name, text: name })), value: region, onChange: setRegion })) : null, regionHref ? (jsx("div", { className: "text-center", children: jsx(LinkButton, { href: regionHref, target: "_blank", className: style('p-m w-full @xl:w-auto', buttonStyle), data: getAspectsWithInclude(data, region?.key), children: buttonText }) })) : null] }) }));
6181
6491
  });
6182
- // TODO: Update handlerDecorator (support buttons?)
6183
- const ButtonTabItem = JSX(({ item = {}, onClick, ...rest }) => {
6184
- const handleClick = useCallback(() => {
6185
- onClick && onClick(item);
6186
- }, [onClick, item]);
6187
- return jsx(TabItemInner, { item: item, onClick: handleClick, ...rest });
6492
+
6493
+ const BUTTON_STYLE = {
6494
+ default: 'bg-main-divider text-primary-main rounded hover:text-primary-main',
6495
+ transparent: 'backdrop-opacity-30 bg-white/30 hover:text-primary-hover text-white',
6496
+ };
6497
+ const InternetBankButton = JSX(({ version, text, mobileText, ...rest }) => {
6498
+ const isMobileMode = useMobileMode();
6499
+ const buttonText = isMobileMode ? mobileText : text;
6500
+ return buttonText ? (jsx(LinkButton, { className: style('py-s px-lg font-light whitespace-nowrap', BUTTON_STYLE[version === 'transparent' ? 'transparent' : 'default']), ...rest, children: buttonText })) : null;
6188
6501
  });
6189
6502
 
6190
- const renderTab = (activeTab, onClick, type) => (tab, i) => (jsx(TabItem, { isActive: tab === activeTab, onClick: onClick, type: type, item: tab }, String(i)));
6191
-
6192
- 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)) })));
6503
+ const HeaderTop = JSX(({ bgColor, logo, alwaysShowLogo, internetBankButton, version, backwardButton }) => {
6504
+ const router = useRouter();
6505
+ const isRootLocation = router.pathname === '/';
6506
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
6507
+ const { dataFooter, dataHeader, ...logoProps } = logo ?? {};
6508
+ const onClick = useCallback(() => {
6509
+ router.back();
6510
+ }, [router]);
6511
+ return (jsxs("div", { className: "flex items-center justify-between w-full", children: [alwaysShowLogo || isRootLocation ? (jsx("div", { children: jsx(Logo, { className: "my-2xs", bgColor: bgColor, logo: logoProps, data: dataHeader, showTitle: false }) })) : (renderBackButton(onClick, backwardButton)), jsx(InternetBankButton, { version: version, ...internetBankButton })] }));
6512
+ });
6513
+ const renderBackButton = (onClick, text) => text ? (jsxs("button", { className: "flex items-center text-l my-2xs", onClick: onClick, type: "button", "aria-label": "\u041A\u043D\u043E\u043F\u043A\u0430 \u043D\u0430\u0437\u0430\u0434", children: [jsx(Icon, { name: "ChevronLeftIcon", iconVersion: "black", width: "24", height: "24" }), text] })) : null;
6193
6514
 
6194
- const initialFiltrationState = {
6195
- categories: [],
6196
- extraOptions: [],
6197
- propertyType: [],
6198
- stage: [],
6515
+ const BG_COLOR_TO_BLOCK_VERSION = {
6516
+ 'bg-white': 'primary',
6517
+ transparent: 'transparent',
6199
6518
  };
6200
- const MortgageFiltration = UniBlock(({ className, hotFilters, filtrationSchema = {}, resetButton, ...rest }) => {
6201
- const [filtrationState, { blocksToRender }, { field, reset, update: replaceFiltrationState }] = useFiltrationForm(initialFiltrationState, {
6202
- block: rest.block,
6203
- page: rest.options?.page,
6204
- });
6205
- const handleFiltrationStateChange = useCallback((_ = initialFiltrationState) => replaceFiltrationState(_), []);
6206
- const tabsControlProps = useHotFilters({
6207
- hotFilters,
6208
- filtrationState,
6209
- blocks: rest.block?.blocks,
6210
- onFiltrationStateChange: handleFiltrationStateChange,
6211
- });
6212
- 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 })] }));
6213
- }, {
6214
- childrenTypes: ['ProductBlock'],
6215
- childSchema: (content) => content?.filtrationSchema || {},
6519
+ const Header = UniBlock(({ bgColor = 'bg-white', alwaysShowLogo = false, version = BG_COLOR_TO_BLOCK_VERSION[bgColor], portal, logo: customLogo = {}, ...rest }) => {
6520
+ const { backwardButton, logo = {} } = rest.options?.page?.common ?? {};
6521
+ const { internetBankButton } = portal || {};
6522
+ const logoProps = customLogo.image?.icon || customLogo.image?.src ? customLogo : logo;
6523
+ return (jsx(BlockWrapper, { tag: "header", defaultPadding: "", version: version, ...rest, children: jsx("div", { className: "container px-lg py-2xs box-border", children: jsx(HeaderTop, { bgColor: bgColor, logo: logoProps, alwaysShowLogo: alwaysShowLogo, internetBankButton: internetBankButton, version: version, backwardButton: backwardButton, ...rest }) }) }));
6216
6524
  });
6217
6525
 
6218
- const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
6526
+ const getInnerPadding = (isPadding = false) => isPadding ? {} : { padding: 'p-0' };
6219
6527
 
6220
- const isClient = !isSSR();
6221
- const ClientOnly = JSX(({ children }) => (isClient ? children : null));
6528
+ const gapStyles = {
6529
+ XXL: 'gap-6xl',
6530
+ XL: 'gap-5xl',
6531
+ L: 'gap-3xl',
6532
+ M: 'gap-m',
6533
+ S: 'gap-xs',
6534
+ XS: 'gap-2xs',
6535
+ '': '',
6536
+ };
6222
6537
 
6223
- const MapMarkerClusterIcon = '/icons/MapMarkerClusterIcon.svg';
6224
- const MapMarkerClusterYellowIcon = '/icons/MapMarkerClusterYellowIcon.svg';
6225
- function renderClusterer({ yandexMaps, map, points, isLoad, }) {
6226
- if (isLoad || !points) {
6227
- return;
6228
- }
6229
- map.geoObjects.removeAll();
6230
- if (!points.length) {
6231
- return;
6232
- }
6233
- const clusterIconContentLayout = yandexMaps.templateLayoutFactory.createClass('<div style="margin-top: -3px;">{{properties.geoObjects.length}}</div>');
6234
- const officeClusterer = defineClusterer('offices', yandexMaps, clusterIconContentLayout);
6235
- if (points.length && points.every((_) => 'type' in _)) {
6236
- const remoteWorkplaceClusterer = defineClusterer('workplaces', yandexMaps, clusterIconContentLayout);
6237
- const remoteWorkplaceGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'workplaces'), 'workplaces', yandexMaps);
6238
- const officesGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'offices'), 'offices', yandexMaps);
6239
- officeClusterer.add(officesGeoObjects);
6240
- remoteWorkplaceClusterer.add(remoteWorkplaceGeoObjects);
6241
- map.geoObjects.add(remoteWorkplaceClusterer);
6242
- map.geoObjects.add(officeClusterer);
6243
- }
6244
- else {
6245
- const geoObjects = defineGeoObjects(points, 'offices', yandexMaps);
6246
- officeClusterer.add(geoObjects);
6247
- map.geoObjects.add(officeClusterer);
6248
- }
6249
- map.setBounds(yandexMaps.util.bounds.fromPoints(points.map((_) => _.coords))).then(() => {
6250
- if (map.getZoom() > 10) {
6251
- map.setZoom(10);
6252
- }
6253
- });
6254
- }
6255
- const defineClusterer = (type, yandexMaps, clusterIconContentLayout) => {
6256
- return new yandexMaps.Clusterer({
6257
- clusterIcons: [
6258
- {
6259
- href: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
6260
- size: [78, 84],
6261
- offset: [-35, -50],
6538
+ const VerticalLayout = UniBlock(({ className = '', padding = 'p-0', gap = '', isInnerPadding = true, version = 'transparent', isTheme = false, isCardBorder = false, image, ...rest }) => {
6539
+ const router = useRouter();
6540
+ return (jsx(BlockWrapper, { className: style('relative flex flex-col', gapStyles[gap], image?.src ? 'bg-right-bottom bg-no-repeat' : '', className), ...(image?.src
6541
+ ? { style: { backgroundImage: `url(${adjustSrc(router)(image?.src)})` } }
6542
+ : {}), padding: padding, version: version, isTheme: isTheme, ...rest, children: renderChildren({
6543
+ ...rest,
6544
+ extraProps: {
6545
+ className: style('w-full', getBorderStyle(isCardBorder)),
6546
+ ...getInnerPadding(isInnerPadding),
6262
6547
  },
6263
- ],
6264
- clusterIconContentLayout,
6265
- clusterHideIconOnBalloonOpen: false,
6266
- geoObjectHideIconOnBalloonOpen: false,
6267
- });
6268
- };
6269
- const defineGeoObjects = (pointArr, type, yandexMaps) => {
6270
- return pointArr.map(({ coords, content }) => new yandexMaps.Placemark(coords, {
6271
- balloonContentHeader: content?.header,
6272
- balloonContentBody: content?.body,
6273
- balloonContentFooter: content?.footer,
6274
- hintContent: content?.hint,
6275
- }, {
6276
- iconLayout: 'default#image',
6277
- iconImageHref: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
6278
- iconImageSize: [78, 84],
6279
- iconImageOffset: [-35, -50],
6280
- }));
6281
- };
6548
+ }) }));
6549
+ }, { childrenTypes: [] });
6282
6550
 
6283
- const defaultStyle = {
6284
- focus: 'focus:border-primary-text focus:border',
6285
- hover: 'hover:bg-primary-hover',
6286
- active: 'active:bg-primary-active',
6287
- font: 'text-center font-sans',
6288
- };
6551
+ const HorizontalLayout = UniBlock((props) => jsx(VerticalLayout, { ...props }), { childrenTypes: [] });
6289
6552
 
6290
- const styles$1 = {
6291
- ...defaultStyle,
6292
- border: 'border border-transparent rounded-md',
6293
- position: 'absolute flex items-center justify-center',
6294
- };
6295
- const renderUserGeolocation = (map, yandexMaps, className) => {
6296
- const setUserGeoLocation = () => {
6297
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
6298
- // @ts-ignore
6299
- yandexMaps.geolocation
6300
- .get({
6301
- provider: 'yandex',
6302
- autoReverseGeocode: true,
6303
- mapStateAutoApply: true,
6304
- })
6305
- .then(function (result) {
6306
- map.current.geoObjects.add(result.geoObjects);
6307
- });
6308
- };
6309
- 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" }) }));
6310
- };
6553
+ const ImgBlock = JSX((props) => {
6554
+ const { className, align, image, ...rest } = props;
6555
+ const alignStyle = align ? style('flex', AlignJustifyStyle[align]) : '';
6556
+ return (jsx(BlockWrapper, { className: style(alignStyle, className), defaultPadding: "p-0", ...rest, children: jsx(Img, { image: image }) }));
6557
+ });
6311
6558
 
6312
- const getNS = (_) => globalThis[_];
6313
- const initializeExternalNS = (namespaceName, url) => {
6314
- const script = document.getElementById(url);
6315
- if (script) {
6316
- const ns = getNS(namespaceName);
6317
- if (ns) {
6318
- return Promise.resolve(ns);
6319
- }
6320
- else {
6321
- return new Promise((resolve) => {
6322
- script.addEventListener('load', () => {
6323
- resolve(getNS(namespaceName));
6324
- });
6325
- });
6326
- }
6327
- }
6328
- else {
6329
- return new Promise((resolve, reject) => {
6330
- const newScript = document.createElement('script');
6331
- newScript.src = url;
6332
- newScript.async = true;
6333
- newScript.id = url;
6334
- newScript.addEventListener('load', () => {
6335
- resolve(getNS(namespaceName));
6336
- });
6337
- newScript.addEventListener('error', (error) => {
6338
- reject(error);
6339
- });
6340
- document.head.appendChild(newScript);
6341
- });
6559
+ const KILO = 1024;
6560
+ const KILO_SIZES = ['байт', 'Кб', 'Мб', 'Гб', 'Тб', 'Пб'];
6561
+ const formatBytes = (bytes, decimals = 2) => {
6562
+ if (bytes === 0) {
6563
+ return '';
6342
6564
  }
6565
+ const i = Math.floor(Math.log(bytes) / Math.log(KILO));
6566
+ return `${parseFloat((bytes / Math.pow(KILO, i)).toFixed(decimals))} ${KILO_SIZES[i]}`;
6343
6567
  };
6344
- function useExternalNS(namespaceName, url, unmountNS = true) {
6345
- const [externalNS, setExternalNS] = useState(undefined);
6346
- useEffect(() => {
6347
- let isMounted = true;
6348
- initializeExternalNS(namespaceName, url)
6349
- .then((ns) => {
6350
- if (isMounted) {
6351
- setExternalNS(ns);
6352
- }
6353
- })
6354
- .catch((error) => {
6355
- console.error(`Failed to initialize external namespace: ${error}`);
6356
- });
6357
- return () => {
6358
- isMounted = false;
6359
- if (unmountNS) {
6360
- const script = document.getElementById(url);
6361
- if (script) {
6362
- document.head.removeChild(script);
6363
- }
6364
- setExternalNS(undefined);
6365
- }
6366
- };
6367
- }, [namespaceName, url, unmountNS]);
6368
- return externalNS;
6369
- }
6370
6568
 
6371
- const YMAPS_NAMESPACE = 'ymaps';
6372
- const useYandexMaps = () => {
6373
- const url = `https://api-maps.yandex.ru/2.1/?apikey=${projectSettings.YANDEX_MAP_API_KEY || ''}&lang=ru_RU`;
6374
- return useExternalNS(YMAPS_NAMESPACE, url, false);
6375
- };
6569
+ const LinkDocItem = JSX(({ icon, text, href, target, fileFormat, data, fileSize }) => {
6570
+ const prefix = fileSize && fileFormat ? ',' : '';
6571
+ const size = fileSize ?? '';
6572
+ const format = fileFormat ? String(fileFormat) : '';
6573
+ 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] }));
6574
+ });
6575
+ const addSpace = (size, format) => (size || format ? jsx("span", { children: ",\u00A0" }) : '');
6376
6576
 
6377
- const styles = {
6378
- ...defaultStyle,
6379
- border: 'border-b border-b-2 border-gray last:border-0',
6380
- position: 'relative flex items-center justify-center',
6577
+ const linkIconStyle = 'min-w-11 min-h-11 h-fit p-2.5 bg-main-divider rounded-md';
6578
+
6579
+ const renderDefaultItem = (router, icon) => (docBlockDef, i) => {
6580
+ const href = adjustHref(router)(docBlockDef?.docType === 'Attachment' ? docBlockDef?.attachment?.src : docBlockDef?.href);
6581
+ const fileSize = docBlockDef?.docType === 'Attachment'
6582
+ ? formatBytes(docBlockDef?.attachment?.fileSize || 0)
6583
+ : docBlockDef?.fileSize;
6584
+ const fileFormat = docBlockDef?.docType === 'Attachment' ? getExtFromHref(href) : docBlockDef?.fileFormat;
6585
+ 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)));
6586
+ };
6587
+ const renderImg = (icon) => icon ? jsx(Img, { className: linkIconStyle, image: icon, width: "24", height: "24" }) : null;
6588
+ const getExtFromHref = (href) => {
6589
+ if (!href) {
6590
+ return '';
6591
+ }
6592
+ const index = href.lastIndexOf('.');
6593
+ const regexp = new RegExp(/\/(.*)/);
6594
+ const docFormat = index !== -1 ? href.substring(index + 1) : '';
6595
+ return docFormat.includes('/') ? docFormat.replace(regexp, '') : docFormat;
6381
6596
  };
6382
- // TODO: Добавить метод определения центральной точки
6383
- const ZoomButton = JSX(({ yandexMaps, direction = 'in' }) => {
6384
- const iconName = direction === 'in' ? 'PlusIcon' : 'MinusIcon';
6385
- const changeZoom = () => {
6386
- const currentZoom = yandexMaps.current.getZoom();
6387
- const newZoom = direction === 'in' ? currentZoom + 1 : currentZoom - 1;
6388
- yandexMaps.current.setZoom(newZoom, { checkZoomRange: true });
6389
- };
6390
- 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" }) }));
6597
+
6598
+ const ReportDialog = JSX(({ href, __html, target }) => {
6599
+ const { close } = useDialogManager();
6600
+ const router = useRouter();
6601
+ const adjustedHref = adjustHref(router)(href);
6602
+ const handleClose = useCallback(() => {
6603
+ close();
6604
+ }, []);
6605
+ 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" })] }));
6391
6606
  });
6392
6607
 
6393
- const DEFAULT_CENTER_COORDS = [55.753995, 37.614069];
6394
- // TODO: Поле для поиска: невыяснено среди каких данных делать поиск (искать в имени офиса, в адресе, метро и т.д.).
6395
- // Сейчас реализован поиск среди тестовых данных
6396
- // TODO: Также выяснить что делать когда ничего не найдено
6397
- // TODO: На макетах также когда есть поле поиска нет кнопки открыть на карте.
6398
- const YandexMap = JSX(({ points, className = '', zoom = 5, isLoad }) => {
6399
- const map = useRef(null);
6400
- const yandexMaps = useYandexMaps();
6401
- useEffect(() => {
6402
- if (map.current) {
6403
- renderClusterer({ yandexMaps, map: map.current, points, isLoad });
6404
- }
6405
- else {
6406
- yandexMaps?.ready(() => {
6407
- // Ready function may be called few times, but must be called once
6408
- if (map.current) {
6409
- renderClusterer({ yandexMaps, map: map.current, points, isLoad });
6410
- return;
6411
- }
6412
- map.current = new yandexMaps.Map('map', {
6413
- center: getCenterPoint(points),
6414
- zoom,
6415
- controls: [],
6416
- suppressMapOpenBlock: true,
6417
- });
6418
- renderClusterer({ yandexMaps, map: map.current, points, isLoad });
6419
- });
6420
- }
6421
- }, [yandexMaps, points, zoom, isLoad]);
6422
- if (!yandexMaps) {
6608
+ const useReportDialog = (props) => {
6609
+ const { open, close } = useDialogManager();
6610
+ return {
6611
+ open: (options = {}) => open(jsx(ReportDialog, { ...props }), options),
6612
+ close,
6613
+ };
6614
+ };
6615
+
6616
+ const ReportDialogButton = JSX(({ text, href, target, __html, icon }) => {
6617
+ if (!text && !__html) {
6423
6618
  return null;
6424
6619
  }
6425
- const zIndex = 'z-10';
6426
- 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))] }));
6620
+ const reportDialog = useReportDialog({ __html, href, target });
6621
+ const openReportDialog = useCallback(() => reportDialog.open(), [reportDialog]);
6622
+ 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 })] }));
6427
6623
  });
6428
- const getCenterPoint = (points) => {
6429
- const centerCoords = [
6430
- getArraySumAndAverage(mapByIndex(points, 0)),
6431
- getArraySumAndAverage(mapByIndex(points, 1)),
6432
- ];
6433
- return centerCoords.every((_) => _) ? centerCoords : DEFAULT_CENTER_COORDS;
6434
- };
6435
- const mapByIndex = (points, index) => points.map((_) => _.coords?.[index]);
6436
- const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
6437
6624
 
6438
- const INITIAL_FILTRATION_STATE$1 = {
6439
- workingSaturday: false,
6440
- premiumService: false,
6441
- privateBanking: false,
6442
- remoteWorkplace: false,
6443
- serviceDisabledPeople: false,
6444
- sellingCoins: false,
6445
- buyingCoins: false,
6446
- bullionOperations: false,
6447
- preciousMetalsOperations: false,
6448
- transferringDataToBiometricSystem: false,
6625
+ const linkColumnsModeStyleMap = {
6626
+ double: 'sm:flex-wrap sm:flex-row',
6627
+ single: 'sm:flex-col',
6449
6628
  };
6450
- const FILTRATION_LABELS = {
6451
- safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
6452
- workingSaturday: 'Открыты по субботам',
6453
- terminalTypeAtms: 'Банкоматы',
6454
- terminalTypeTerm: 'Терминалы',
6455
- workAllTime: 'Круглосуточно',
6456
- billAcceptorEnable: 'Прием наличных',
6457
- premiumService: 'Премиальное обслуживание',
6458
- privateBanking: 'Услуга Private banking',
6459
- sellingCoins: 'Продажа монет из драгоценных металлов',
6460
- buyingCoins: 'Покупка монет из драгоценных металлов',
6461
- bullionOperations: 'Операции со слитками',
6462
- preciousMetalsOperations: 'Операции с драгоценными металлами',
6463
- transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
6464
- locationDisabledPeople: 'Для маломобильных',
6465
- designDisabledPeople: 'Для слабовидящих',
6466
- remoteWorkplace: 'Удаленное рабочее место',
6467
- serviceDisabledPeople: 'Для маломобильных граждан',
6629
+ const LinkDocs = UniBlock(({ className = '', title, description, align = 'text-center', documents, icon = { icon: 'DocIcon' }, columnsMode = 'double', ...rest }) => {
6630
+ const router = useRouter();
6631
+ 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] }));
6632
+ });
6633
+ const renderLinkDocItem = (router, icon) => (docBlockDef, i) => {
6634
+ const docType = docBlockDef?.docType;
6635
+ if (docType === '') {
6636
+ return null;
6637
+ }
6638
+ if ('reportSource' in docBlockDef && docBlockDef?.reportSource?.__html) {
6639
+ return renderModalItem(icon)(docBlockDef, i);
6640
+ }
6641
+ return renderDefaultItem(router, icon)(docBlockDef, i);
6468
6642
  };
6469
- const FILTRATION_PREDICATES$1 = {
6470
- workingSaturday: (item) => Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
6471
- premiumService: (item) => Boolean('premiumService' in item && item.premiumService),
6472
- privateBanking: (item) => Boolean('privateBanking' in item && item.privateBanking),
6473
- remoteWorkplace: (item) => Boolean('workScheduleDescription' in item),
6474
- serviceDisabledPeople: (item) => Boolean('serviceDisabledPeople' in item && item.serviceDisabledPeople),
6475
- sellingCoins: (item) => Boolean('sellingCoins' in item && item.sellingCoins),
6476
- buyingCoins: (item) => Boolean('buyingCoins' in item && item.buyingCoins),
6477
- bullionOperations: (item) => Boolean('bullionOperations' in item && item.bullionOperations),
6478
- preciousMetalsOperations: (item) => Boolean('preciousMetalsOperations' in item && item.preciousMetalsOperations),
6479
- transferringDataToBiometricSystem: (item) => Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
6643
+ const renderModalItem = (icon) => (props, i) => {
6644
+ const commonProps = {
6645
+ text: props.text,
6646
+ target: props.target,
6647
+ __html: props.reportSource?.__html,
6648
+ };
6649
+ 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;
6480
6650
  };
6651
+ const isLinkDoc = (data) => 'href' in data;
6481
6652
 
6482
- const renderButtonsGroup = (data, activeButton, onButtonClick) => {
6483
- const allButtonVersion = getVersion(activeButton === 'all');
6484
- const businessButtonVersion = getVersion(activeButton === 'business');
6485
- const handleClick = (e, key, branches) => {
6486
- const filteredBranches = e.currentTarget === e.target && key === 'business' ? filterBranches(branches) : branches;
6487
- onButtonClick(key);
6488
- return filteredBranches;
6653
+ const MobileAppTile = UniBlock(({ className, padding, align = 'text-left', buttons = [], description, image, __html, headingType, qr, additionalDescription = '', title = 'Мобильное приложение', version = 'primary', ...rest }) => {
6654
+ const containerStyle = version === 'secondary' ? 'p-m min-w-32' : 'min-w-24';
6655
+ const img = image?.src ? jsx(Img, { className: "hidden lg:block", image: image }) : null;
6656
+ 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] })] }) }));
6657
+ });
6658
+
6659
+ const getBadgeCount = (blocks = [], filter = {}) => blocks.filter(({ content = {} }) => targetMatchPattern(filter, content)).length;
6660
+
6661
+ const scalarCmp = (a, b) => a === b;
6662
+ const arrCmp = (cmp = scalarCmp) => (a, b) => a === b || Boolean(a && b && a.length === b.length && a.every((_, i) => cmp(_, b[i])));
6663
+ const objCmp = (cmp) => (a, b) => a === b ||
6664
+ Boolean(a &&
6665
+ b &&
6666
+ Object.keys(a).length === Object.keys(b).length &&
6667
+ Object.entries(a).every(([key, value]) => cmp(value, b[key])));
6668
+ function combineBoolCmps(...comparators) {
6669
+ return (a, b) => comparators.some((cmp) => cmp(a, b));
6670
+ }
6671
+
6672
+ const hotFilterRecordCmp = objCmp(combineBoolCmps(scalarCmp, arrCmp()));
6673
+
6674
+ const EMPTY_ARR = [];
6675
+ const EMPTY_OBJ = {};
6676
+ const useHotFilters = ({ hotFilters = EMPTY_ARR, filtrationState = EMPTY_OBJ, blocks = EMPTY_ARR, onFiltrationStateChange, }) => {
6677
+ const activeItemIndex = useMemo(() => Math.max(0, hotFilters.findIndex((_) => hotFilterRecordCmp(_.filter, filtrationState))), [hotFilters, filtrationState]);
6678
+ const items = useMemo(() => hotFilters.map((_) => ({
6679
+ text: _.text,
6680
+ count: getBadgeCount(blocks, _.filter),
6681
+ version: getVersion(_ === hotFilters[activeItemIndex]),
6682
+ })), [hotFilters, blocks, activeItemIndex]);
6683
+ const handleChange = useCallback((_) => {
6684
+ onFiltrationStateChange(hotFilters[items.indexOf(_)].filter);
6685
+ }, [hotFilters, items]);
6686
+ return {
6687
+ activeItem: items[activeItemIndex],
6688
+ items: items,
6689
+ onChange: handleChange,
6489
6690
  };
6490
- const filterBranches = (branches) => branches.filter((branch) => branch.workSchedule &&
6491
- branch.workSchedule.businessScheduleVisibleTag &&
6492
- !branch.workSchedule.businessScheduleDescription);
6493
- 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" })] }));
6494
6691
  };
6495
6692
 
6496
- 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;
6497
-
6498
- const COMMON_FILTERS_STYLES = 'flex flex-col sm:flex-row sm:flex-wrap gap-3xl pb-2xl';
6499
- const renderFiltrationForm = ({ filters, field: { field, reset }, onlyOffice, labels, }) => {
6500
- const visibleFiltersNum = onlyOffice ? 5 : 6;
6501
- const filtersCheckbox = (filters || []).map((key) => (jsx(Checkbox, { text: labels[key], ...field(key) }, key)));
6502
- const [visibleFilters, hiddenFilters] = visibleFiltersNum > 0
6503
- ? [filtersCheckbox.slice(0, visibleFiltersNum), filtersCheckbox.slice(visibleFiltersNum)]
6504
- : [filtersCheckbox, []];
6505
- 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$1(reset, onlyOffice) }) })) : null }));
6693
+ const badgeBgStyleMap = {
6694
+ primary: 'bg-white/30',
6695
+ secondary: 'bg-main-divider',
6506
6696
  };
6507
- const renderFoldButton$1 = (reset, onlyOffice = false) => ({ isUnfolded, onToggle }) => {
6508
- const labels = ['Больше фильтров', 'Меньше фильтров'];
6509
- const icons = ['ArrowDownIcon', 'ArrowUpIcon'];
6510
- 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() })] }));
6697
+ const badgeTextColorStyleMap = {
6698
+ primary: { desktop: 'text-white', mobile: 'text-primary-text' },
6699
+ secondary: { desktop: 'text-secondary-text', mobile: 'text-secondary-text' },
6511
6700
  };
6512
- 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" })] }));
6513
-
6514
- 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] }) }));
6701
+ const Badge = JSX(({ count, version = 'secondary' }) => {
6702
+ const isMobileMode = useMobileMode();
6703
+ const badgeBgStyle = isMobileMode ? 'bg-main-divider' : badgeBgStyleMap[version];
6704
+ const textStyle = badgeTextColorStyleMap[version][isMobileMode ? 'mobile' : 'desktop'];
6705
+ 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 }) }));
6706
+ });
6515
6707
 
6516
- const defaultEmptyFunction = () => void 0;
6517
- const filtersVisibleStyles = (activeButton) => activeButton === 'all' ? 'block' : 'hidden';
6518
- const OfficesAtmsMapLayout = JSX(({ className, data = [], isLoad, remoteWorkplaces = [], renderCard = defaultEmptyFunction, renderRemoteWorkplaceCard = defaultEmptyFunction, getBalloon = defaultEmptyFunction, getBalloonRemoteWorkplaces = defaultEmptyFunction, descriptionData, title, }) => {
6519
- const onlyOffice = title?.includes('Офис');
6520
- const [filtrationState, { field, reset }] = useForm(INITIAL_FILTRATION_STATE$1);
6521
- const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
6522
- const _filteredItems = filterItems$1(data, filtrationState);
6523
- const _filteredRemoteWorkplaces = filterItems$1(remoteWorkplaces, filtrationState);
6524
- const _points = [
6525
- ..._filteredItems.map((_) => ({
6526
- type: 'offices',
6527
- coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
6528
- content: getBalloon(_),
6529
- })),
6530
- ..._filteredRemoteWorkplaces.map((_) => ({
6531
- type: 'workplaces',
6532
- coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
6533
- content: getBalloonRemoteWorkplaces({
6534
- address: _.address,
6535
- workScheduleDescription: _.workScheduleDescription,
6536
- }),
6537
- })),
6538
- ].filter((_) => _.coords && _.coords.length === 2);
6539
- const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
6540
- return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
6541
- }, [data, remoteWorkplaces, filtrationState]);
6542
- const [activeButton, setActiveButton] = useState('all');
6543
- const filterOptions = {
6544
- filters: getFiltersWithNonEmptyData([...data, ...remoteWorkplaces]),
6545
- field: { field, reset },
6546
- onlyOffice,
6547
- labels: FILTRATION_LABELS,
6548
- };
6549
- 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)] })] }));
6708
+ const getButtonClassNames = (isActive) => ({
6709
+ btn: `w-96 ${isActive ? 'p-m border-none bg-primary-main text-white' : 'p-s ease-in duration-300 bg-white'}`,
6710
+ text: isActive ? 'mb-xs text-xl' : 'mb-2xs text-l text-primary-text',
6711
+ desc: `font-light ${isActive ? 'text-l text-white' : 'text-m text-secondary-text'}`,
6712
+ icon: isActive ? '' : 'text-primary-main',
6713
+ iconVersion: (isActive ? 'white' : 'normal'),
6714
+ oldText: 'text-m text-center',
6715
+ oldDesc: 'text-m-light',
6550
6716
  });
6551
- const filterItems$1 = (data, filtrationState) => {
6552
- const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
6553
- return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES$1[_](item)));
6717
+ const renderTabItemInner = ({ text, description, icon, isActive, type, }) => {
6718
+ const buttonClassNames = getButtonClassNames(isActive);
6719
+ 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: {
6720
+ ...icon,
6721
+ iconVersion: icon?.iconVersion ?? buttonClassNames.iconVersion,
6722
+ }, 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 })] })] }));
6554
6723
  };
6555
- const getFiltersWithNonEmptyData = (data) => Object.keys(INITIAL_FILTRATION_STATE$1).filter((_) => data.filter((item) => FILTRATION_PREDICATES$1[_](item)).length);
6556
6724
 
6557
- const colorStyle = {
6558
- yellow: { border: 'border-yellow-light', text: 'text-yellow' },
6559
- green: { border: 'border-green-more-light', text: 'text-green-dark' },
6560
- gray: { border: 'border-gray', text: 'text-secondary-text' },
6561
- red: { border: 'border-error/30', text: 'text-error' },
6725
+ const tabPaddingStyleMap = {
6726
+ default: 'px-xs',
6727
+ underlined: 'px-m',
6728
+ animated: 'px-m border border-gray cursor-pointer text-left border-b-0 mt-auto flex gap-2xs',
6729
+ };
6730
+ const tabTextStyle = 'text-secondary-text hover:text-primary-main';
6731
+ const activeTabTextStyleMap = {
6732
+ default: 'text-black sm:text-white',
6733
+ underlined: 'text-primary-main border-b-2',
6734
+ animated: 'text-white sm:text-white',
6735
+ };
6736
+ const tabBgStyleMap = {
6737
+ default: 'bg-white',
6738
+ underlined: 'bg-white',
6739
+ animated: 'p-1 ease-in duration-300 bg-white text-primary-text h-[70px] w-96',
6740
+ };
6741
+ const activeTabBgStyleMap = {
6742
+ default: 'bg-white sm:bg-primary-main',
6743
+ underlined: 'bg-white',
6744
+ animated: 'p-2 border-none bg-primary-main text-white h-20 w-96',
6562
6745
  };
6563
- 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 })] })));
6746
+ const TabItemInner = JSX(({ tag = 'div', item = {}, isActive = false, type = 'default', onClick }) => {
6747
+ const Tag = tag;
6748
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
6749
+ const { text, description, icon, count, tabName, ...link } = item;
6750
+ 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({
6751
+ text,
6752
+ description,
6753
+ icon,
6754
+ isActive,
6755
+ type,
6756
+ }), Number.isInteger(count) ? (jsx("div", { className: "ml-xs", role: "status", "aria-label": `Количество программ и сервисов ${count}`, children: jsx(Badge, { count: count, version: getVersion(isActive, type) }) })) : null] }) }));
6757
+ });
6564
6758
 
6565
- const CardCell = JSX(({ value, subText, children, isPhone, ...props }) => {
6566
- const textItems = (Array.isArray(value) ? value : value?.split(',') ?? []).filter(Boolean);
6567
- if ([textItems.length, children, subText].every((_) => !_)) {
6568
- return null;
6569
- }
6570
- return renderCardCell({ textItems, subText, children, isPhone, ...props });
6759
+ const TabItem = JSX((props) => props?.item?.href ? jsx(LinkTabItem, { ...props }) : jsx(ButtonTabItem, { ...props }));
6760
+ const LinkTabItem = JSX((props) => {
6761
+ const link = useLink();
6762
+ const handleClick = useCallback(() => {
6763
+ props.onClick && props.onClick(props.item || {});
6764
+ }, [props.onClick, props.item]);
6765
+ const { onClick, ...item } = link({ ...props.item, onClick: handleClick });
6766
+ return jsx(TabItemInner, { ...props, tag: "a", item: item, onClick: onClick });
6767
+ });
6768
+ // TODO: Update handlerDecorator (support buttons?)
6769
+ const ButtonTabItem = JSX(({ item = {}, onClick, ...rest }) => {
6770
+ const handleClick = useCallback(() => {
6771
+ onClick && onClick(item);
6772
+ }, [onClick, item]);
6773
+ return jsx(TabItemInner, { item: item, onClick: handleClick, ...rest });
6571
6774
  });
6572
- 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] }));
6573
- 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))));
6574
- const cleanPhoneNumber = (phone) => phone.replace(/\D/g, '');
6575
6775
 
6576
- 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 })));
6776
+ const renderTab = (activeTab, onClick, type) => (tab, i) => (jsx(TabItem, { isActive: tab === activeTab, onClick: onClick, type: type, item: tab }, String(i)));
6577
6777
 
6578
- const ICONS = ['ArrowDownIcon', 'ArrowUpIcon'];
6579
- const labels = ['Подробнее', 'Скрыть'];
6580
- const renderFoldButton = ({ 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" })] }));
6778
+ 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)) })));
6779
+
6780
+ const initialFiltrationState = {
6781
+ categories: [],
6782
+ extraOptions: [],
6783
+ propertyType: [],
6784
+ stage: [],
6785
+ };
6786
+ const MortgageFiltration = UniBlock(({ className, hotFilters, filtrationSchema = {}, resetButton, ...rest }) => {
6787
+ const [filtrationState, { blocksToRender }, { field, reset, update: replaceFiltrationState }] = useFiltrationForm(initialFiltrationState, {
6788
+ block: rest.block,
6789
+ page: rest.options?.page,
6790
+ });
6791
+ const handleFiltrationStateChange = useCallback((_ = initialFiltrationState) => replaceFiltrationState(_), []);
6792
+ const tabsControlProps = useHotFilters({
6793
+ hotFilters,
6794
+ filtrationState,
6795
+ blocks: rest.block?.blocks,
6796
+ onFiltrationStateChange: handleFiltrationStateChange,
6797
+ });
6798
+ 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 })] }));
6799
+ }, {
6800
+ childrenTypes: ['ProductBlock'],
6801
+ childSchema: (content) => content?.filtrationSchema || {},
6802
+ });
6581
6803
 
6582
6804
  const renderAtmCard = ({ location, address, billAcceptorType, terminalType, billAcceptorEnable, atmCode = '', atmAccess = '', workTime, }, i) => {
6583
6805
  const additionalInfo = [
6584
6806
  {
6585
6807
  label: 'Устройство',
6586
- value: capitalizedFirstLetter$1(terminalType),
6808
+ value: capitalizedFirstLetter(terminalType),
6587
6809
  },
6588
6810
  { label: 'Модуль приема наличных', value: billAcceptorEnable ? 'Да' : 'Нет' },
6589
6811
  {
@@ -6596,19 +6818,19 @@
6596
6818
  },
6597
6819
  { label: 'Регистрационный номер', value: atmCode },
6598
6820
  ];
6599
- 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 }) => {
6821
+ 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 }) => {
6600
6822
  return (jsx(FoldableSection, { isUnfolded: isUnfolded, children: jsx(CardRow, { className: "flex-wrap", children: additionalInfo?.map(renderInfo) }) }));
6601
6823
  },
6602
6824
  //** TODO: Remove styles with refactoring DefaultFoldButton*/
6603
- renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton({ isUnfolded, onToggle }) })] }, String(i)));
6825
+ renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$3({ isUnfolded, onToggle }) })] }, String(i)));
6604
6826
  };
6605
6827
  const getAtmPoint = ({ address = '', terminalType, atmCode = '' }) => {
6606
- const header = `${capitalizedFirstLetter$1(terminalType)} №${atmCode}`;
6828
+ const header = `${capitalizedFirstLetter(terminalType)} №${atmCode}`;
6607
6829
  const body = address.toUpperCase();
6608
6830
  return { header, body };
6609
6831
  };
6610
6832
  const renderInfo = (item, i) => (jsx(CardCell, { ...item }, String(i)));
6611
- const capitalizedFirstLetter$1 = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
6833
+ const capitalizedFirstLetter = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
6612
6834
 
6613
6835
  const EMPTY_VALUE$2 = [];
6614
6836
  function useAtms(regionCode) {
@@ -6656,172 +6878,6 @@
6656
6878
  });
6657
6879
  };
6658
6880
 
6659
- const getScheduleDescription = (workScheduleWeek) => {
6660
- const rows = getDateDescription(workScheduleWeek);
6661
- return jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", value: rows, className: "max-w-none" });
6662
- };
6663
- const buildScheduleText = ({ workTime = '', lunchHour = '', daysOff = '' }, isSaturday = false) => {
6664
- if (!workTime) {
6665
- return '';
6666
- }
6667
- return [
6668
- `${isSaturday ? 'Суббота' : 'Будние дни'}: ${workTime}`,
6669
- lunchHour ? `перерыв: ${lunchHour}` : '',
6670
- daysOff ? `не работает: ${daysOff}` : '',
6671
- ]
6672
- .filter(Boolean)
6673
- .join('; ');
6674
- };
6675
- const getDateDescription = (workScheduleWeek) => {
6676
- const workingWeekday = workScheduleWeek.find((_) => _.key !== 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
6677
- const workingSaturday = workScheduleWeek.find((_) => _.key === 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
6678
- const daysOff = workScheduleWeek
6679
- .filter((_) => !_.status)
6680
- .map((_) => _.short?.toLowerCase())
6681
- .join(', ');
6682
- const rows = [
6683
- buildScheduleText({
6684
- workTime: workingWeekday?.workTime,
6685
- lunchHour: workingWeekday?.lunchHour,
6686
- daysOff: workingSaturday ? '' : daysOff,
6687
- }),
6688
- buildScheduleText({ workTime: workingSaturday?.workTime, lunchHour: workingSaturday?.lunchHour, daysOff }, true),
6689
- ].filter(Boolean);
6690
- return rows;
6691
- };
6692
-
6693
- const WEEKDAY_MAP = [
6694
- ['workingMonday', 'Пн', 'Понедельник'],
6695
- ['workingTuesday', 'Вт', 'Вторник'],
6696
- ['workingWednesday', 'Ср', 'Среда'],
6697
- ['workingThursday', 'Чт', 'Четверг'],
6698
- ['workingFriday', 'Пт', 'Пятница'],
6699
- ['workingSaturday', 'Сб', 'Суббота'],
6700
- ['workingSunday', 'Вс', 'Воскресенье'],
6701
- ];
6702
- const getWorkScheduleWeek = (workSchedule) => WEEKDAY_MAP.map(([key, short, title]) => ({
6703
- key,
6704
- title,
6705
- short,
6706
- status: Boolean(workSchedule?.[key]),
6707
- get workTime() {
6708
- return key === 'workingSaturday' ? workSchedule?.workTimeSaturday : workSchedule?.workTime;
6709
- },
6710
- get lunchHour() {
6711
- return key === 'workingSaturday' ? workSchedule?.lunchHourSaturday : workSchedule?.lunchHour;
6712
- },
6713
- get hasLunch() {
6714
- return /\d+/.test(this.lunchHour ?? '');
6715
- },
6716
- }));
6717
-
6718
- const renderBusinessSchedule = (scheduleDescription) => {
6719
- if (!scheduleDescription) {
6720
- return null;
6721
- }
6722
- const businessSchedule = getBusinessSchedule(scheduleDescription);
6723
- 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 }) })] }));
6724
- };
6725
- const getBusinessSchedule = (scheduleDescription) => {
6726
- const weekDayMap = WEEKDAY_MAP.map(([, short]) => ({ short, status: true }));
6727
- const splittedScheduleDescription = scheduleDescription.split('/') ?? [];
6728
- const lastPartScheduleDescription = splittedScheduleDescription[splittedScheduleDescription.length - 1]?.toLowerCase();
6729
- if (!lastPartScheduleDescription?.includes('выходной')) {
6730
- return weekDayMap;
6731
- }
6732
- return weekDayMap.map((_) => ({
6733
- ..._,
6734
- status: !lastPartScheduleDescription?.includes(_.short.toLowerCase()),
6735
- }));
6736
- };
6737
- 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)));
6738
-
6739
- 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)));
6740
-
6741
- const currentWeekDayIdx = new Date().getDay();
6742
- //TODO: Add logic time https://github.com/redneckz/wildless-cms-uni-blocks/pull/1549
6743
- const renderCurrentDaySchedule = (workScheduleWeek) => {
6744
- const [currentWeekDay] = workScheduleWeek?.slice(currentWeekDayIdx - 1) ?? [];
6745
- if (!currentWeekDay) {
6746
- return null;
6747
- }
6748
- const { lunchHour, status, workTime, hasLunch } = currentWeekDay;
6749
- 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" }));
6750
- };
6751
-
6752
- const getSubTextLunch = ({ lunchHour, hasLunch = false, status = false }) => {
6753
- if (!status) {
6754
- return 'Не работает';
6755
- }
6756
- return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
6757
- };
6758
- 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)));
6759
-
6760
- const renderWorkSchedule = (workSchedule) => {
6761
- const workScheduleWeek = getWorkScheduleWeek(workSchedule);
6762
- const timeOfWork = workSchedule ? getDateDescription(workScheduleWeek) : '';
6763
- const businessTimeOfWork = workSchedule ? workSchedule.businessScheduleDescription : '';
6764
- if (!workSchedule) {
6765
- return null;
6766
- }
6767
- if (!workSchedule.businessScheduleVisibleTag) {
6768
- return renderMatchingTimeOfWork(timeOfWork);
6769
- }
6770
- if (workSchedule.businessScheduleVisibleTag &&
6771
- workSchedule.businessScheduleDescription === null) {
6772
- return renderIndividualTimeOfWork(timeOfWork);
6773
- }
6774
- return renderDefaultTimeOfWork(timeOfWork, businessTimeOfWork);
6775
- };
6776
- const renderIndividualTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p>`;
6777
- const renderMatchingTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ. и юр. лиц:<br/></b> ${timeOfWork}</p>`;
6778
- const renderDefaultTimeOfWork = (timeOfWork, businessTimeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${businessTimeOfWork}</p>`;
6779
-
6780
- const renderOfficeCard = ({ name, address, phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }, i) => {
6781
- if (!workSchedule) {
6782
- return null;
6783
- }
6784
- const workScheduleWeek = getWorkScheduleWeek(workSchedule);
6785
- 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({
6786
- phone,
6787
- fax,
6788
- phoneBusiness,
6789
- phoneNatural,
6790
- phoneCallCentre,
6791
- phoneCurrencyControl,
6792
- workSchedule,
6793
- exchangeRate,
6794
- }) }), jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
6795
- return (jsx(FoldableSection, { isUnfolded: isUnfolded, children: renderCardContent$1({
6796
- phone,
6797
- fax,
6798
- phoneBusiness,
6799
- phoneNatural,
6800
- phoneCallCentre,
6801
- phoneCurrencyControl,
6802
- workSchedule,
6803
- exchangeRate,
6804
- }) }));
6805
- },
6806
- //** TODO: remove styles with refactoring DefaultFoldButton*/
6807
- renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton({ isUnfolded, onToggle }) })] }, String(i)));
6808
- };
6809
- const renderCardContent$1 = ({ phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }) => {
6810
- const workScheduleWeek = getWorkScheduleWeek(workSchedule);
6811
- const labelSchedule = workSchedule?.businessScheduleVisibleTag
6812
- ? 'Для физических лиц'
6813
- : 'Для физических и юридических лиц';
6814
- 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
6815
- ? renderBusinessSchedule(workSchedule?.businessScheduleDescription)
6816
- : null, exchangeRate?.currencies?.length ? (jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }));
6817
- };
6818
- const capitalizedFirstLetter = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
6819
- const getOfficePoint = ({ name = '', address = '', workSchedule }) => {
6820
- const header = capitalizedFirstLetter(name);
6821
- const body = `${address} ${renderWorkSchedule(workSchedule)}`;
6822
- return { header, body };
6823
- };
6824
-
6825
6881
  const renderRemoteWorkplaceCard = ({ address, workScheduleDescription }, i) => {
6826
6882
  if (!workScheduleDescription) {
6827
6883
  return null;
@@ -6832,7 +6888,7 @@
6832
6888
  workScheduleDescription,
6833
6889
  }) })),
6834
6890
  //** TODO: remove styles with refactoring DefaultFoldButton*/
6835
- renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton({ isUnfolded, onToggle }) })] }, String(i)));
6891
+ renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$3({ isUnfolded, onToggle }) })] }, String(i)));
6836
6892
  };
6837
6893
  const renderCardContent = ({ workScheduleDescription }) => {
6838
6894
  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 }) })] }));
@@ -7863,7 +7919,7 @@
7863
7919
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
7864
7920
  });
7865
7921
 
7866
- const packageVersion = "0.14.621";
7922
+ const packageVersion = "0.14.623";
7867
7923
 
7868
7924
  exports.Blocks = Blocks;
7869
7925
  exports.ContentPage = ContentPage;