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