@redneckz/wildless-cms-uni-blocks 0.14.665 → 0.14.667

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 (374) hide show
  1. package/bundle/api/RetailAPI/regionOffices.d.ts +16 -0
  2. package/bundle/blocks.schema.json +1 -1
  3. package/bundle/bundle.umd.js +1428 -1367
  4. package/bundle/bundle.umd.min.js +1 -1
  5. package/bundle/components/ApplicationForm/getInitialFormState.d.ts +1 -0
  6. package/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +7 -2
  7. package/bundle/components/CreditForm/getFifthStepData.d.ts +3 -0
  8. package/bundle/components/CreditForm/utils.d.ts +7 -1
  9. package/bundle/components/OfficesAtmsMap/renderWorkSchedule.d.ts +1 -1
  10. package/{dist/ui-kit/FormField/Fields/RetailAddressField.d.ts → bundle/ui-kit/FormField/Fields/AddressRetailField.d.ts} +1 -1
  11. package/bundle/ui-kit/FormField/Fields/MandatoryPaymentsField.d.ts +2 -0
  12. package/{lib/ui-kit/FormField/Fields/RetailRegionField.d.ts → bundle/ui-kit/FormField/Fields/RegionRetailField.d.ts} +1 -1
  13. package/bundle/ui-kit/FormField/Fields/WagesField.d.ts +2 -0
  14. package/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  15. package/bundle/ui-kit/FormField/SelectField.d.ts +2 -0
  16. package/bundle/ui-kit/YandexMap/YandexMap.d.ts +1 -0
  17. package/dist/api/RetailAPI/regionOffices.d.ts +16 -0
  18. package/dist/api/RetailAPI/regionOffices.js +19 -0
  19. package/dist/api/RetailAPI/regionOffices.js.map +1 -0
  20. package/dist/components/ApplicationForm/getInitialFormState.d.ts +1 -0
  21. package/dist/components/ApplicationForm/getInitialFormState.js +1 -0
  22. package/dist/components/ApplicationForm/getInitialFormState.js.map +1 -1
  23. package/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +7 -2
  24. package/dist/components/ApplicationLeadForm/getInitialFormState.js +1 -0
  25. package/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  26. package/dist/components/ContentPage/useContentPageData.js +1 -1
  27. package/dist/components/ContentPage/useContentPageData.js.map +1 -1
  28. package/dist/components/CreditCardForm/CreditCardForm.js +2 -0
  29. package/dist/components/CreditCardForm/CreditCardForm.js.map +1 -1
  30. package/dist/components/CreditCardForm/creditCardFormStepsData.js +2 -2
  31. package/dist/components/CreditCardForm/creditCardFormStepsData.js.map +1 -1
  32. package/dist/components/CreditCardForm/formStateMap.js +4 -4
  33. package/dist/components/CreditCardForm/formStateMap.js.map +1 -1
  34. package/dist/components/CreditCardForm/getFourthStepData.js +8 -2
  35. package/dist/components/CreditCardForm/getFourthStepData.js.map +1 -1
  36. package/dist/components/CreditForm/creditFormStepsData.js +2 -2
  37. package/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
  38. package/dist/components/CreditForm/formStateMap.js +2 -2
  39. package/dist/components/CreditForm/formStateMap.js.map +1 -1
  40. package/dist/components/CreditForm/getCreditFormTaskData.js +3 -1
  41. package/dist/components/CreditForm/getCreditFormTaskData.js.map +1 -1
  42. package/dist/components/CreditForm/getFifthStepData.d.ts +3 -0
  43. package/dist/components/CreditForm/getFifthStepData.js +10 -0
  44. package/dist/components/CreditForm/getFifthStepData.js.map +1 -0
  45. package/dist/components/CreditForm/getThirdStepData.js +8 -2
  46. package/dist/components/CreditForm/getThirdStepData.js.map +1 -1
  47. package/dist/components/CreditForm/utils.d.ts +7 -1
  48. package/dist/components/CreditForm/utils.js +9 -3
  49. package/dist/components/CreditForm/utils.js.map +1 -1
  50. package/dist/components/OfficesAtmsMap/renderWorkSchedule.d.ts +1 -1
  51. package/dist/components/OfficesAtmsMap/renderWorkSchedule.js +1 -1
  52. package/dist/components/OfficesAtmsMap/renderWorkSchedule.js.map +1 -1
  53. package/{lib/ui-kit/FormField/Fields/RetailAddressField.d.ts → dist/ui-kit/FormField/Fields/AddressRetailField.d.ts} +1 -1
  54. package/dist/ui-kit/FormField/Fields/{RetailAddressField.js → AddressRetailField.js} +20 -18
  55. package/dist/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -0
  56. package/dist/ui-kit/FormField/Fields/MandatoryPaymentsField.d.ts +2 -0
  57. package/dist/ui-kit/FormField/Fields/MandatoryPaymentsField.js +9 -0
  58. package/dist/ui-kit/FormField/Fields/MandatoryPaymentsField.js.map +1 -0
  59. package/dist/ui-kit/FormField/Fields/{RetailRegionField.d.ts → RegionRetailField.d.ts} +1 -1
  60. package/dist/ui-kit/FormField/Fields/RegionRetailField.js +14 -0
  61. package/dist/ui-kit/FormField/Fields/RegionRetailField.js.map +1 -0
  62. package/dist/ui-kit/FormField/Fields/RetirementIncomeField.js +10 -1
  63. package/dist/ui-kit/FormField/Fields/RetirementIncomeField.js.map +1 -1
  64. package/dist/ui-kit/FormField/Fields/WagesField.d.ts +2 -0
  65. package/dist/ui-kit/FormField/Fields/WagesField.js +18 -0
  66. package/dist/ui-kit/FormField/Fields/WagesField.js.map +1 -0
  67. package/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  68. package/dist/ui-kit/FormField/SelectField.d.ts +2 -0
  69. package/dist/ui-kit/FormField/SelectField.js +2 -2
  70. package/dist/ui-kit/FormField/SelectField.js.map +1 -1
  71. package/dist/ui-kit/FormField/getField.js +8 -8
  72. package/dist/ui-kit/FormField/getField.js.map +1 -1
  73. package/dist/ui-kit/FormField/getObjectValidator.js +3 -3
  74. package/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  75. package/dist/ui-kit/YandexMap/YandexMap.d.ts +1 -0
  76. package/dist/ui-kit/YandexMap/YandexMap.js +4 -4
  77. package/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
  78. package/lib/api/RetailAPI/regionOffices.d.ts +16 -0
  79. package/lib/api/RetailAPI/regionOffices.js +16 -0
  80. package/lib/api/RetailAPI/regionOffices.js.map +1 -0
  81. package/lib/components/ApplicationForm/getInitialFormState.d.ts +1 -0
  82. package/lib/components/ApplicationForm/getInitialFormState.js +1 -0
  83. package/lib/components/ApplicationForm/getInitialFormState.js.map +1 -1
  84. package/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +7 -2
  85. package/lib/components/ApplicationLeadForm/getInitialFormState.js +1 -0
  86. package/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  87. package/lib/components/ContentPage/useContentPageData.js +1 -1
  88. package/lib/components/ContentPage/useContentPageData.js.map +1 -1
  89. package/lib/components/CreditCardForm/CreditCardForm.js +3 -1
  90. package/lib/components/CreditCardForm/CreditCardForm.js.map +1 -1
  91. package/lib/components/CreditCardForm/creditCardFormStepsData.js +2 -2
  92. package/lib/components/CreditCardForm/creditCardFormStepsData.js.map +1 -1
  93. package/lib/components/CreditCardForm/formStateMap.js +4 -4
  94. package/lib/components/CreditCardForm/formStateMap.js.map +1 -1
  95. package/lib/components/CreditCardForm/getFourthStepData.js +8 -2
  96. package/lib/components/CreditCardForm/getFourthStepData.js.map +1 -1
  97. package/lib/components/CreditForm/creditFormStepsData.js +2 -2
  98. package/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
  99. package/lib/components/CreditForm/formStateMap.js +2 -2
  100. package/lib/components/CreditForm/formStateMap.js.map +1 -1
  101. package/lib/components/CreditForm/getCreditFormTaskData.js +3 -1
  102. package/lib/components/CreditForm/getCreditFormTaskData.js.map +1 -1
  103. package/lib/components/CreditForm/getFifthStepData.d.ts +3 -0
  104. package/lib/components/CreditForm/getFifthStepData.js +7 -0
  105. package/lib/components/CreditForm/getFifthStepData.js.map +1 -0
  106. package/lib/components/CreditForm/getThirdStepData.js +8 -2
  107. package/lib/components/CreditForm/getThirdStepData.js.map +1 -1
  108. package/lib/components/CreditForm/utils.d.ts +7 -1
  109. package/lib/components/CreditForm/utils.js +9 -3
  110. package/lib/components/CreditForm/utils.js.map +1 -1
  111. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +1 -1
  112. package/lib/components/OfficesAtmsMap/renderWorkSchedule.d.ts +1 -1
  113. package/lib/components/OfficesAtmsMap/renderWorkSchedule.js +1 -1
  114. package/lib/components/OfficesAtmsMap/renderWorkSchedule.js.map +1 -1
  115. package/{bundle/ui-kit/FormField/Fields/RetailAddressField.d.ts → lib/ui-kit/FormField/Fields/AddressRetailField.d.ts} +1 -1
  116. package/lib/ui-kit/FormField/Fields/{RetailAddressField.js → AddressRetailField.js} +20 -18
  117. package/lib/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -0
  118. package/lib/ui-kit/FormField/Fields/MandatoryPaymentsField.d.ts +2 -0
  119. package/lib/ui-kit/FormField/Fields/MandatoryPaymentsField.js +7 -0
  120. package/lib/ui-kit/FormField/Fields/MandatoryPaymentsField.js.map +1 -0
  121. package/{mobile/bundle/ui-kit/FormField/Fields/RetailRegionField.d.ts → lib/ui-kit/FormField/Fields/RegionRetailField.d.ts} +1 -1
  122. package/lib/ui-kit/FormField/Fields/RegionRetailField.js +12 -0
  123. package/lib/ui-kit/FormField/Fields/RegionRetailField.js.map +1 -0
  124. package/lib/ui-kit/FormField/Fields/RetirementIncomeField.js +10 -1
  125. package/lib/ui-kit/FormField/Fields/RetirementIncomeField.js.map +1 -1
  126. package/lib/ui-kit/FormField/Fields/WagesField.d.ts +2 -0
  127. package/lib/ui-kit/FormField/Fields/WagesField.js +16 -0
  128. package/lib/ui-kit/FormField/Fields/WagesField.js.map +1 -0
  129. package/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  130. package/lib/ui-kit/FormField/SelectField.d.ts +2 -0
  131. package/lib/ui-kit/FormField/SelectField.js +2 -2
  132. package/lib/ui-kit/FormField/SelectField.js.map +1 -1
  133. package/lib/ui-kit/FormField/getField.js +8 -8
  134. package/lib/ui-kit/FormField/getField.js.map +1 -1
  135. package/lib/ui-kit/FormField/getObjectValidator.js +3 -3
  136. package/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  137. package/lib/ui-kit/YandexMap/YandexMap.d.ts +1 -0
  138. package/lib/ui-kit/YandexMap/YandexMap.js +2 -2
  139. package/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
  140. package/mobile/bundle/api/RetailAPI/regionOffices.d.ts +16 -0
  141. package/mobile/bundle/bundle.umd.js +1428 -1367
  142. package/mobile/bundle/bundle.umd.min.js +1 -1
  143. package/mobile/bundle/components/ApplicationForm/getInitialFormState.d.ts +1 -0
  144. package/mobile/bundle/components/ApplicationLeadForm/getInitialFormState.d.ts +7 -2
  145. package/mobile/bundle/components/CreditForm/getFifthStepData.d.ts +3 -0
  146. package/mobile/bundle/components/CreditForm/utils.d.ts +7 -1
  147. package/mobile/bundle/components/OfficesAtmsMap/renderWorkSchedule.d.ts +1 -1
  148. package/mobile/bundle/ui-kit/FormField/Fields/{RetailAddressField.d.ts → AddressRetailField.d.ts} +1 -1
  149. package/mobile/bundle/ui-kit/FormField/Fields/MandatoryPaymentsField.d.ts +2 -0
  150. package/{bundle/ui-kit/FormField/Fields/RetailRegionField.d.ts → mobile/bundle/ui-kit/FormField/Fields/RegionRetailField.d.ts} +1 -1
  151. package/mobile/bundle/ui-kit/FormField/Fields/WagesField.d.ts +2 -0
  152. package/mobile/bundle/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  153. package/mobile/bundle/ui-kit/FormField/SelectField.d.ts +2 -0
  154. package/mobile/bundle/ui-kit/YandexMap/YandexMap.d.ts +1 -0
  155. package/mobile/dist/api/RetailAPI/regionOffices.d.ts +16 -0
  156. package/mobile/dist/api/RetailAPI/regionOffices.js +19 -0
  157. package/mobile/dist/api/RetailAPI/regionOffices.js.map +1 -0
  158. package/mobile/dist/components/ApplicationForm/getInitialFormState.d.ts +1 -0
  159. package/mobile/dist/components/ApplicationForm/getInitialFormState.js +1 -0
  160. package/mobile/dist/components/ApplicationForm/getInitialFormState.js.map +1 -1
  161. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.d.ts +7 -2
  162. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js +1 -0
  163. package/mobile/dist/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  164. package/mobile/dist/components/ContentPage/useContentPageData.js +1 -1
  165. package/mobile/dist/components/ContentPage/useContentPageData.js.map +1 -1
  166. package/mobile/dist/components/CreditCardForm/CreditCardForm.js +2 -0
  167. package/mobile/dist/components/CreditCardForm/CreditCardForm.js.map +1 -1
  168. package/mobile/dist/components/CreditCardForm/creditCardFormStepsData.js +2 -2
  169. package/mobile/dist/components/CreditCardForm/creditCardFormStepsData.js.map +1 -1
  170. package/mobile/dist/components/CreditCardForm/formStateMap.js +4 -4
  171. package/mobile/dist/components/CreditCardForm/formStateMap.js.map +1 -1
  172. package/mobile/dist/components/CreditCardForm/getFourthStepData.js +8 -2
  173. package/mobile/dist/components/CreditCardForm/getFourthStepData.js.map +1 -1
  174. package/mobile/dist/components/CreditForm/creditFormStepsData.js +2 -2
  175. package/mobile/dist/components/CreditForm/creditFormStepsData.js.map +1 -1
  176. package/mobile/dist/components/CreditForm/formStateMap.js +2 -2
  177. package/mobile/dist/components/CreditForm/formStateMap.js.map +1 -1
  178. package/mobile/dist/components/CreditForm/getCreditFormTaskData.js +3 -1
  179. package/mobile/dist/components/CreditForm/getCreditFormTaskData.js.map +1 -1
  180. package/mobile/dist/components/CreditForm/getFifthStepData.d.ts +3 -0
  181. package/mobile/dist/components/CreditForm/getFifthStepData.js +10 -0
  182. package/mobile/dist/components/CreditForm/getFifthStepData.js.map +1 -0
  183. package/mobile/dist/components/CreditForm/getThirdStepData.js +8 -2
  184. package/mobile/dist/components/CreditForm/getThirdStepData.js.map +1 -1
  185. package/mobile/dist/components/CreditForm/utils.d.ts +7 -1
  186. package/mobile/dist/components/CreditForm/utils.js +9 -3
  187. package/mobile/dist/components/CreditForm/utils.js.map +1 -1
  188. package/mobile/dist/components/OfficesAtmsMap/renderWorkSchedule.d.ts +1 -1
  189. package/mobile/dist/components/OfficesAtmsMap/renderWorkSchedule.js +1 -1
  190. package/mobile/dist/components/OfficesAtmsMap/renderWorkSchedule.js.map +1 -1
  191. package/mobile/dist/ui-kit/FormField/Fields/AddressRetailField.d.ts +2 -0
  192. package/mobile/dist/ui-kit/FormField/Fields/{RetailAddressField.js → AddressRetailField.js} +20 -18
  193. package/mobile/dist/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -0
  194. package/mobile/dist/ui-kit/FormField/Fields/MandatoryPaymentsField.d.ts +2 -0
  195. package/mobile/dist/ui-kit/FormField/Fields/MandatoryPaymentsField.js +9 -0
  196. package/mobile/dist/ui-kit/FormField/Fields/MandatoryPaymentsField.js.map +1 -0
  197. package/mobile/dist/ui-kit/FormField/Fields/RegionRetailField.d.ts +2 -0
  198. package/mobile/dist/ui-kit/FormField/Fields/RegionRetailField.js +14 -0
  199. package/mobile/dist/ui-kit/FormField/Fields/RegionRetailField.js.map +1 -0
  200. package/mobile/dist/ui-kit/FormField/Fields/RetirementIncomeField.js +10 -1
  201. package/mobile/dist/ui-kit/FormField/Fields/RetirementIncomeField.js.map +1 -1
  202. package/mobile/dist/ui-kit/FormField/Fields/WagesField.d.ts +2 -0
  203. package/mobile/dist/ui-kit/FormField/Fields/WagesField.js +18 -0
  204. package/mobile/dist/ui-kit/FormField/Fields/WagesField.js.map +1 -0
  205. package/mobile/dist/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  206. package/mobile/dist/ui-kit/FormField/SelectField.d.ts +2 -0
  207. package/mobile/dist/ui-kit/FormField/SelectField.js +2 -2
  208. package/mobile/dist/ui-kit/FormField/SelectField.js.map +1 -1
  209. package/mobile/dist/ui-kit/FormField/getField.js +8 -8
  210. package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
  211. package/mobile/dist/ui-kit/FormField/getObjectValidator.js +3 -3
  212. package/mobile/dist/ui-kit/FormField/getObjectValidator.js.map +1 -1
  213. package/mobile/dist/ui-kit/YandexMap/YandexMap.d.ts +1 -0
  214. package/mobile/dist/ui-kit/YandexMap/YandexMap.js +4 -4
  215. package/mobile/dist/ui-kit/YandexMap/YandexMap.js.map +1 -1
  216. package/mobile/lib/api/RetailAPI/regionOffices.d.ts +16 -0
  217. package/mobile/lib/api/RetailAPI/regionOffices.js +16 -0
  218. package/mobile/lib/api/RetailAPI/regionOffices.js.map +1 -0
  219. package/mobile/lib/components/ApplicationForm/getInitialFormState.d.ts +1 -0
  220. package/mobile/lib/components/ApplicationForm/getInitialFormState.js +1 -0
  221. package/mobile/lib/components/ApplicationForm/getInitialFormState.js.map +1 -1
  222. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.d.ts +7 -2
  223. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js +1 -0
  224. package/mobile/lib/components/ApplicationLeadForm/getInitialFormState.js.map +1 -1
  225. package/mobile/lib/components/ContentPage/useContentPageData.js +1 -1
  226. package/mobile/lib/components/ContentPage/useContentPageData.js.map +1 -1
  227. package/mobile/lib/components/CreditCardForm/CreditCardForm.js +3 -1
  228. package/mobile/lib/components/CreditCardForm/CreditCardForm.js.map +1 -1
  229. package/mobile/lib/components/CreditCardForm/creditCardFormStepsData.js +2 -2
  230. package/mobile/lib/components/CreditCardForm/creditCardFormStepsData.js.map +1 -1
  231. package/mobile/lib/components/CreditCardForm/formStateMap.js +4 -4
  232. package/mobile/lib/components/CreditCardForm/formStateMap.js.map +1 -1
  233. package/mobile/lib/components/CreditCardForm/getFourthStepData.js +8 -2
  234. package/mobile/lib/components/CreditCardForm/getFourthStepData.js.map +1 -1
  235. package/mobile/lib/components/CreditForm/creditFormStepsData.js +2 -2
  236. package/mobile/lib/components/CreditForm/creditFormStepsData.js.map +1 -1
  237. package/mobile/lib/components/CreditForm/formStateMap.js +2 -2
  238. package/mobile/lib/components/CreditForm/formStateMap.js.map +1 -1
  239. package/mobile/lib/components/CreditForm/getCreditFormTaskData.js +3 -1
  240. package/mobile/lib/components/CreditForm/getCreditFormTaskData.js.map +1 -1
  241. package/mobile/lib/components/CreditForm/getFifthStepData.d.ts +3 -0
  242. package/mobile/lib/components/CreditForm/getFifthStepData.js +7 -0
  243. package/mobile/lib/components/CreditForm/getFifthStepData.js.map +1 -0
  244. package/mobile/lib/components/CreditForm/getThirdStepData.js +8 -2
  245. package/mobile/lib/components/CreditForm/getThirdStepData.js.map +1 -1
  246. package/mobile/lib/components/CreditForm/utils.d.ts +7 -1
  247. package/mobile/lib/components/CreditForm/utils.js +9 -3
  248. package/mobile/lib/components/CreditForm/utils.js.map +1 -1
  249. package/mobile/lib/components/OfficesAtmsMap/renderWorkSchedule.d.ts +1 -1
  250. package/mobile/lib/components/OfficesAtmsMap/renderWorkSchedule.js +1 -1
  251. package/mobile/lib/components/OfficesAtmsMap/renderWorkSchedule.js.map +1 -1
  252. package/mobile/lib/ui-kit/FormField/Fields/AddressRetailField.d.ts +2 -0
  253. package/mobile/lib/ui-kit/FormField/Fields/{RetailAddressField.js → AddressRetailField.js} +20 -18
  254. package/mobile/lib/ui-kit/FormField/Fields/AddressRetailField.js.map +1 -0
  255. package/mobile/lib/ui-kit/FormField/Fields/MandatoryPaymentsField.d.ts +2 -0
  256. package/mobile/lib/ui-kit/FormField/Fields/MandatoryPaymentsField.js +7 -0
  257. package/mobile/lib/ui-kit/FormField/Fields/MandatoryPaymentsField.js.map +1 -0
  258. package/mobile/lib/ui-kit/FormField/Fields/RegionRetailField.d.ts +2 -0
  259. package/mobile/lib/ui-kit/FormField/Fields/RegionRetailField.js +12 -0
  260. package/mobile/lib/ui-kit/FormField/Fields/RegionRetailField.js.map +1 -0
  261. package/mobile/lib/ui-kit/FormField/Fields/RetirementIncomeField.js +10 -1
  262. package/mobile/lib/ui-kit/FormField/Fields/RetirementIncomeField.js.map +1 -1
  263. package/mobile/lib/ui-kit/FormField/Fields/WagesField.d.ts +2 -0
  264. package/mobile/lib/ui-kit/FormField/Fields/WagesField.js +16 -0
  265. package/mobile/lib/ui-kit/FormField/Fields/WagesField.js.map +1 -0
  266. package/mobile/lib/ui-kit/FormField/NameFieldDef.d.ts +1 -1
  267. package/mobile/lib/ui-kit/FormField/SelectField.d.ts +2 -0
  268. package/mobile/lib/ui-kit/FormField/SelectField.js +2 -2
  269. package/mobile/lib/ui-kit/FormField/SelectField.js.map +1 -1
  270. package/mobile/lib/ui-kit/FormField/getField.js +8 -8
  271. package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
  272. package/mobile/lib/ui-kit/FormField/getObjectValidator.js +3 -3
  273. package/mobile/lib/ui-kit/FormField/getObjectValidator.js.map +1 -1
  274. package/mobile/lib/ui-kit/YandexMap/YandexMap.d.ts +1 -0
  275. package/mobile/lib/ui-kit/YandexMap/YandexMap.js +2 -2
  276. package/mobile/lib/ui-kit/YandexMap/YandexMap.js.map +1 -1
  277. package/mobile/src/api/RetailAPI/regionOffices.ts +36 -0
  278. package/mobile/src/components/ApplicationForm/getInitialFormState.tsx +2 -0
  279. package/mobile/src/components/ApplicationLeadForm/getInitialFormState.tsx +8 -2
  280. package/mobile/src/components/ContentPage/useContentPageData.ts +1 -1
  281. package/mobile/src/components/CreditCardForm/CreditCardForm.tsx +4 -1
  282. package/mobile/src/components/CreditCardForm/creditCardFormStepsData.tsx +2 -2
  283. package/mobile/src/components/CreditCardForm/formStateMap.tsx +4 -4
  284. package/mobile/src/components/CreditCardForm/getFourthStepData.ts +14 -2
  285. package/mobile/src/components/CreditForm/creditFormStepsData.tsx +2 -2
  286. package/mobile/src/components/CreditForm/formStateMap.tsx +2 -2
  287. package/mobile/src/components/CreditForm/getCreditFormTaskData.ts +3 -1
  288. package/mobile/src/components/CreditForm/getFifthStepData.ts +10 -0
  289. package/mobile/src/components/CreditForm/getThirdStepData.ts +14 -2
  290. package/mobile/src/components/CreditForm/utils.ts +9 -3
  291. package/mobile/src/components/OfficesAtmsMap/renderWorkSchedule.tsx +1 -1
  292. package/mobile/src/ui-kit/FormField/Fields/{RetailAddressField.tsx → AddressRetailField.tsx} +20 -23
  293. package/{src/ui-kit/FormField/Fields/OtherPayments.tsx → mobile/src/ui-kit/FormField/Fields/MandatoryPaymentsField.tsx} +2 -2
  294. package/{src/ui-kit/FormField/Fields/RetailRegionField.tsx → mobile/src/ui-kit/FormField/Fields/RegionRetailField.tsx} +6 -8
  295. package/mobile/src/ui-kit/FormField/Fields/RetirementIncomeField.tsx +25 -9
  296. package/mobile/src/ui-kit/FormField/Fields/WagesField.tsx +31 -0
  297. package/mobile/src/ui-kit/FormField/NameFieldDef.ts +5 -1
  298. package/mobile/src/ui-kit/FormField/SelectField.tsx +13 -2
  299. package/mobile/src/ui-kit/FormField/getField.tsx +8 -8
  300. package/mobile/src/ui-kit/FormField/getObjectValidator.tsx +3 -3
  301. package/mobile/src/ui-kit/YandexMap/YandexMap.tsx +2 -2
  302. package/package.json +1 -1
  303. package/src/api/RetailAPI/regionOffices.ts +36 -0
  304. package/src/components/ApplicationForm/getInitialFormState.tsx +2 -0
  305. package/src/components/ApplicationLeadForm/getInitialFormState.tsx +8 -2
  306. package/src/components/ContentPage/useContentPageData.ts +1 -1
  307. package/src/components/CreditCardForm/CreditCardForm.fixture.tsx +11 -0
  308. package/src/components/CreditCardForm/CreditCardForm.tsx +4 -1
  309. package/src/components/CreditCardForm/creditCardFormStepsData.tsx +2 -2
  310. package/src/components/CreditCardForm/formStateMap.tsx +4 -4
  311. package/src/components/CreditCardForm/getFourthStepData.ts +14 -2
  312. package/src/components/CreditForm/creditFormStepsData.tsx +2 -2
  313. package/src/components/CreditForm/formStateMap.tsx +2 -2
  314. package/src/components/CreditForm/getCreditFormTaskData.ts +3 -1
  315. package/src/components/CreditForm/getFifthStepData.ts +10 -0
  316. package/src/components/CreditForm/getThirdStepData.ts +14 -2
  317. package/src/components/CreditForm/utils.ts +9 -3
  318. package/src/components/OfficesAtmsMap/renderWorkSchedule.tsx +1 -1
  319. package/src/ui-kit/FormField/Fields/{RetailAddressField.tsx → AddressRetailField.tsx} +20 -23
  320. package/{mobile/src/ui-kit/FormField/Fields/OtherPayments.tsx → src/ui-kit/FormField/Fields/MandatoryPaymentsField.tsx} +2 -2
  321. package/{mobile/src/ui-kit/FormField/Fields/RetailRegionField.tsx → src/ui-kit/FormField/Fields/RegionRetailField.tsx} +6 -8
  322. package/src/ui-kit/FormField/Fields/RetirementIncomeField.tsx +25 -9
  323. package/src/ui-kit/FormField/Fields/WagesField.tsx +31 -0
  324. package/src/ui-kit/FormField/NameFieldDef.ts +5 -1
  325. package/src/ui-kit/FormField/SelectField.tsx +13 -2
  326. package/src/ui-kit/FormField/getField.tsx +8 -8
  327. package/src/ui-kit/FormField/getObjectValidator.tsx +3 -3
  328. package/src/ui-kit/YandexMap/YandexMap.tsx +2 -2
  329. package/bundle/ui-kit/FormField/Fields/MandatoryIncome.d.ts +0 -2
  330. package/bundle/ui-kit/FormField/Fields/OtherPayments.d.ts +0 -2
  331. package/dist/ui-kit/FormField/Fields/MandatoryIncome.d.ts +0 -2
  332. package/dist/ui-kit/FormField/Fields/MandatoryIncome.js +0 -9
  333. package/dist/ui-kit/FormField/Fields/MandatoryIncome.js.map +0 -1
  334. package/dist/ui-kit/FormField/Fields/OtherPayments.d.ts +0 -2
  335. package/dist/ui-kit/FormField/Fields/OtherPayments.js +0 -9
  336. package/dist/ui-kit/FormField/Fields/OtherPayments.js.map +0 -1
  337. package/dist/ui-kit/FormField/Fields/RetailAddressField.js.map +0 -1
  338. package/dist/ui-kit/FormField/Fields/RetailRegionField.js +0 -14
  339. package/dist/ui-kit/FormField/Fields/RetailRegionField.js.map +0 -1
  340. package/lib/ui-kit/FormField/Fields/MandatoryIncome.d.ts +0 -2
  341. package/lib/ui-kit/FormField/Fields/MandatoryIncome.js +0 -7
  342. package/lib/ui-kit/FormField/Fields/MandatoryIncome.js.map +0 -1
  343. package/lib/ui-kit/FormField/Fields/OtherPayments.d.ts +0 -2
  344. package/lib/ui-kit/FormField/Fields/OtherPayments.js +0 -7
  345. package/lib/ui-kit/FormField/Fields/OtherPayments.js.map +0 -1
  346. package/lib/ui-kit/FormField/Fields/RetailAddressField.js.map +0 -1
  347. package/lib/ui-kit/FormField/Fields/RetailRegionField.js +0 -12
  348. package/lib/ui-kit/FormField/Fields/RetailRegionField.js.map +0 -1
  349. package/mobile/bundle/ui-kit/FormField/Fields/MandatoryIncome.d.ts +0 -2
  350. package/mobile/bundle/ui-kit/FormField/Fields/OtherPayments.d.ts +0 -2
  351. package/mobile/dist/ui-kit/FormField/Fields/MandatoryIncome.d.ts +0 -2
  352. package/mobile/dist/ui-kit/FormField/Fields/MandatoryIncome.js +0 -9
  353. package/mobile/dist/ui-kit/FormField/Fields/MandatoryIncome.js.map +0 -1
  354. package/mobile/dist/ui-kit/FormField/Fields/OtherPayments.d.ts +0 -2
  355. package/mobile/dist/ui-kit/FormField/Fields/OtherPayments.js +0 -9
  356. package/mobile/dist/ui-kit/FormField/Fields/OtherPayments.js.map +0 -1
  357. package/mobile/dist/ui-kit/FormField/Fields/RetailAddressField.d.ts +0 -2
  358. package/mobile/dist/ui-kit/FormField/Fields/RetailAddressField.js.map +0 -1
  359. package/mobile/dist/ui-kit/FormField/Fields/RetailRegionField.d.ts +0 -2
  360. package/mobile/dist/ui-kit/FormField/Fields/RetailRegionField.js +0 -14
  361. package/mobile/dist/ui-kit/FormField/Fields/RetailRegionField.js.map +0 -1
  362. package/mobile/lib/ui-kit/FormField/Fields/MandatoryIncome.d.ts +0 -2
  363. package/mobile/lib/ui-kit/FormField/Fields/MandatoryIncome.js +0 -7
  364. package/mobile/lib/ui-kit/FormField/Fields/MandatoryIncome.js.map +0 -1
  365. package/mobile/lib/ui-kit/FormField/Fields/OtherPayments.d.ts +0 -2
  366. package/mobile/lib/ui-kit/FormField/Fields/OtherPayments.js +0 -7
  367. package/mobile/lib/ui-kit/FormField/Fields/OtherPayments.js.map +0 -1
  368. package/mobile/lib/ui-kit/FormField/Fields/RetailAddressField.d.ts +0 -2
  369. package/mobile/lib/ui-kit/FormField/Fields/RetailAddressField.js.map +0 -1
  370. package/mobile/lib/ui-kit/FormField/Fields/RetailRegionField.d.ts +0 -2
  371. package/mobile/lib/ui-kit/FormField/Fields/RetailRegionField.js +0 -12
  372. package/mobile/lib/ui-kit/FormField/Fields/RetailRegionField.js.map +0 -1
  373. package/mobile/src/ui-kit/FormField/Fields/MandatoryIncome.tsx +0 -15
  374. package/src/ui-kit/FormField/Fields/MandatoryIncome.tsx +0 -15
@@ -1512,6 +1512,7 @@
1512
1512
  feedbackMethod: defaultSelectValidator(),
1513
1513
  serviceType: defaultSelectValidator(),
1514
1514
  serviceDirection: defaultSelectValidator(),
1515
+ regionRetail: defaultSelectValidator('Выберите регион'),
1515
1516
  meetingDay: defaultValidator(),
1516
1517
  product: defaultValidator(),
1517
1518
  localities: defaultValidator(),
@@ -1538,15 +1539,14 @@
1538
1539
  participantDateRegistration: defaultValidator('Укажите дату регистрации'),
1539
1540
  retirementIncome: defaultValidator(),
1540
1541
  otherIncome: defaultValidator(),
1541
- mandatoryIncome: defaultValidator(),
1542
- otherPayments: defaultValidator(),
1542
+ wages: defaultValidator(),
1543
+ mandatoryPayments: defaultValidator(),
1543
1544
  disablePeopleFlg: defaultValidator(),
1544
1545
  bankruptcyFlg: defaultValidator(),
1545
1546
  shareholderFlg: defaultValidator(),
1546
1547
  legalEntityName: defaultValidator(),
1547
1548
  bankEmployeeCode: defaultValidator(),
1548
1549
  partInBusiness: defaultValidator(),
1549
- regionRetail: defaultSelectValidator('Выберите филиал банка'),
1550
1550
  addressRetail: defaultSelectValidator('Выберите адрес банка'),
1551
1551
  addressMatch: defaultValidator(),
1552
1552
  codeWord: codeWordValidator('Необходимо ввести кодовое слово'),
@@ -1804,1463 +1804,1485 @@
1804
1804
  return (jsx(CheckboxWithError, { text: "\u0410\u0434\u0440\u0435\u0441 \u0444\u0430\u043A\u0442\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043C\u0435\u0441\u0442\u0430 \u0436\u0438\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u0430 \u0441\u043E\u0432\u043F\u0430\u0434\u0430\u0435\u0442 \u0441 \u0430\u0434\u0440\u0435\u0441\u043E\u043C \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438", ...getValidation(field('addressMatch'), validatorObj.addressMatch, input?.required) }));
1805
1805
  });
1806
1806
 
1807
- const useNormalizedInput = (props, { normalize, format }) => {
1808
- const { value, onFocus, onBlur, onChange } = props;
1809
- const [isFocused, setIsFocused] = useState(false);
1810
- const handleFocus = useCallback((ev) => {
1811
- setIsFocused(true);
1812
- onFocus && onFocus(ev);
1813
- }, []);
1814
- const handleBlur = useCallback(() => {
1815
- setIsFocused(false);
1816
- onChange && onChange(normalize(value));
1817
- onBlur && onBlur();
1818
- }, [onChange, value]);
1819
- return {
1820
- value: (isFocused || !format ? value : format(value)),
1821
- onFocus: handleFocus,
1822
- onBlur: handleBlur,
1823
- };
1824
- };
1825
-
1826
- const clamp = (value, min, max) => Math.max(min, Math.min(value, max));
1827
-
1828
- function parseDecimal(value) {
1829
- const rawValue = (value || '').replace(/\D/g, '');
1830
- const unsafeDecimal = parseInt(rawValue, 10);
1831
- return Number.isNaN(unsafeDecimal) ? 0 : unsafeDecimal;
1832
- }
1807
+ 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, {
1808
+ 'backdrop-blur': blur,
1809
+ }), 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" }) })));
1833
1810
 
1834
- function renderRangeWithTicks({ list = [], min, max, step, value = list[0] || min, disabled, onChange, }) {
1835
- const rangeValue = list.length ? list.indexOf(value) : value;
1836
- const rangeValueShift = rangeValue > min ? rangeValue - min : 0;
1837
- const percentage = (rangeValueShift * 100) / (max - min);
1838
- const inputStyle = {
1839
- backgroundSize: `${percentage.toFixed(2)}% 100%`,
1840
- };
1841
- return (jsxs("div", { children: [list.length ? (jsx("div", { className: "absolute w-full flex justify-between -bottom-[3px] px-m", children: list.map((_, i) => (jsx("div", { className: style('w-2 h-2 rounded-full', rangeValue <= i || disabled ? 'bg-gray' : 'bg-primary-main') }, String(i)))) })) : null, jsx("div", { className: "absolute inset-x-0 -bottom-1 px-m leading-[18px]", children: jsx("input", { className: "box-border w-full m-0 cursor-pointer slider relative z-10", style: inputStyle, type: "range", min: min, max: max, step: step, value: rangeValue, disabled: disabled, onChange: ((ev) => {
1842
- const rawValue = parseDecimal(ev.target?.value);
1843
- const newValue = list.length ? list[rawValue] : rawValue;
1844
- onChange && onChange(newValue || 0);
1845
- }) }) })] }));
1811
+ const MapMarkerClusterIcon = '/icons/MapMarkerClusterIcon.svg';
1812
+ const MapMarkerClusterYellowIcon = '/icons/MapMarkerClusterYellowIcon.svg';
1813
+ function renderClusterer({ yandexMaps, map, points, isLoad, }) {
1814
+ if (isLoad || !points) {
1815
+ return;
1816
+ }
1817
+ map.geoObjects.removeAll();
1818
+ if (!points.length) {
1819
+ return;
1820
+ }
1821
+ const clusterIconContentLayout = yandexMaps.templateLayoutFactory.createClass('<div style="margin-top: -3px;">{{properties.geoObjects.length}}</div>');
1822
+ const officeClusterer = defineClusterer('offices', yandexMaps, clusterIconContentLayout);
1823
+ if (points.length && points.every((_) => 'type' in _)) {
1824
+ const remoteWorkplaceClusterer = defineClusterer('workplaces', yandexMaps, clusterIconContentLayout);
1825
+ const remoteWorkplaceGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'workplaces'), 'workplaces', yandexMaps);
1826
+ const officesGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'offices'), 'offices', yandexMaps);
1827
+ officeClusterer.add(officesGeoObjects);
1828
+ remoteWorkplaceClusterer.add(remoteWorkplaceGeoObjects);
1829
+ map.geoObjects.add(remoteWorkplaceClusterer);
1830
+ map.geoObjects.add(officeClusterer);
1831
+ }
1832
+ else {
1833
+ const geoObjects = defineGeoObjects(points, 'offices', yandexMaps);
1834
+ officeClusterer.add(geoObjects);
1835
+ map.geoObjects.add(officeClusterer);
1836
+ }
1837
+ map.setBounds(yandexMaps.util.bounds.fromPoints(points.map((_) => _.coords))).then(() => {
1838
+ if (map.getZoom() > 10) {
1839
+ map.setZoom(10);
1840
+ }
1841
+ });
1846
1842
  }
1847
-
1848
- const inputDisabledStyle = 'disabled:border-gray disabled:bg-main-divider';
1849
- const DEFAULT_MIN = 1;
1850
- const DEFAULT_MAX = 100;
1851
- const InputRange = JSX((props) => {
1852
- const { className, title, items = [], list = [], min = list.length ? 0 : DEFAULT_MIN, max = list.length ? list.length - 1 : DEFAULT_MAX, step = 1, value = list[0] || min, disabled = false, onChange, } = props;
1853
- const normalizedProps = useNormalizedInput(props, {
1854
- normalize: (_ = 0) => list.length ? closestValue(list)(_) : clamp(_, min, max),
1855
- format: toLocalNumberFormat(),
1843
+ const defineClusterer = (type, yandexMaps, clusterIconContentLayout) => {
1844
+ return new yandexMaps.Clusterer({
1845
+ clusterIcons: [
1846
+ {
1847
+ href: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
1848
+ size: [78, 84],
1849
+ offset: [-35, -50],
1850
+ },
1851
+ ],
1852
+ clusterIconContentLayout,
1853
+ clusterHideIconOnBalloonOpen: false,
1854
+ geoObjectHideIconOnBalloonOpen: false,
1856
1855
  });
1857
- const handleChange = useCallback((ev) => {
1858
- onChange && onChange(parseDecimal(ev.target?.value));
1859
- }, [onChange]);
1860
- return (jsxs("div", { className: className, children: [jsxs("label", { className: "block relative", children: [title ? (jsx(Text, { size: "text-m", font: "font-light", color: "text-primary-text", children: title })) : null, jsx("input", { className: style('text-h3 w-full h-14', 'pl-m mt-xs box-border', 'text-primary-text', inputValidStyle, inputDisabledStyle), disabled: disabled, onChange: handleChange, ...normalizedProps }), renderRangeWithTicks({ list, min, max, step, disabled, value, onChange })] }), renderRangeCaption(items)] }));
1861
- });
1862
- const closestValue = (list) => (_) => list.reduce((prev, curr) => (Math.abs(curr - _) < Math.abs(prev - _) ? curr : prev));
1863
- const renderRangeCaption = (items) => (jsx("div", { className: "flex justify-between my-xs", children: items.map((item, i) => (jsx(Text, { size: "text-s", font: "font-light", color: "text-secondary-text", children: item }, String(i)))) }));
1864
-
1865
- const MIN_CREDIT_AMOUNT = 1000;
1866
- const MAX_CREDIT_AMOUNT = 1000000000;
1867
- const ITEMS_CREDIT_AMOUNT = ['От 1 000 ₽', 'До 1 000 000 000 ₽'];
1868
- const AmountField = JSX(({ field }) => (jsx(InputRange, { title: "\u0421\u0443\u043C\u043C\u0430, \u20BD", items: ITEMS_CREDIT_AMOUNT, min: MIN_CREDIT_AMOUNT, max: MAX_CREDIT_AMOUNT, ...field('amount') })));
1869
-
1870
- const useLeadFormData = (typeField) => {
1871
- const { data, error } = useAsyncData(`/api/v1/dictionary?dictionaryType=${encodeURIComponent(typeField)}`, fetchData);
1872
- if (data && 'errorMessage' in data) {
1873
- return { error };
1874
- }
1875
- return { data: data, error };
1876
1856
  };
1877
- const fetchData = async (url) => {
1878
- const result = await fetchJSON(url, { method: 'POST' });
1879
- return result || [];
1857
+ const defineGeoObjects = (pointArr, type, yandexMaps) => {
1858
+ return pointArr.map(({ coords, content }) => new yandexMaps.Placemark(coords, {
1859
+ balloonContentHeader: content?.header,
1860
+ balloonContentBody: content?.body,
1861
+ balloonContentFooter: content?.footer,
1862
+ hintContent: content?.hint,
1863
+ }, {
1864
+ iconLayout: 'default#image',
1865
+ iconImageHref: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
1866
+ iconImageSize: [78, 84],
1867
+ iconImageOffset: [-35, -50],
1868
+ }));
1880
1869
  };
1881
1870
 
1882
- const SelectField = UniBlock(({ field, source, label, fieldName, input }) => {
1883
- const leadOptions = (source &&
1884
- source?.map((_) => ({
1885
- key: _.key || '',
1886
- text: _.value,
1887
- }))) ||
1888
- [];
1889
- return (jsx(SelectControl, { placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0438\u0437 \u0441\u043F\u0438\u0441\u043A\u0430", label: label, options: leadOptions, ...getValidation(field(fieldName), validatorObj[fieldName], input?.required) }));
1890
- });
1891
-
1892
- const AmountWorkersField = JSX(({ field, input }) => {
1893
- const { data: amountWorkers } = useLeadFormData('EMPLOYEES_NUMBER');
1894
- return (jsx(SelectField, { field: field, source: amountWorkers, label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0440\u0430\u0431\u043E\u0442\u0430\u044E\u0449\u0438\u0445 \u0432 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", fieldName: "amountWorkers", input: input }));
1895
- });
1896
-
1897
- const AnnualRevenueField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0413\u043E\u0434\u043E\u0432\u0430\u044F \u0432\u044B\u0440\u0443\u0447\u043A\u0430, \u20BD", ...getValidation(field('annualRevenue'), validatorObj.annualRevenue, input?.required) })));
1898
-
1899
- const ArmyIdFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u041D\u0430\u043B\u0438\u0447\u0438\u0435 \u0432\u043E\u0435\u043D\u043D\u043E\u0433\u043E \u0431\u0438\u043B\u0435\u0442\u0430", ...getValidation(field('armyIdFlg'), validatorObj.armyIdFlg, input?.required) })));
1900
-
1901
- const BankEmpoleeCodeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u0434 \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043B\u044F \u0411\u0430\u043D\u043A\u0430", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0434", type: "number", ...getValidation(field('bankEmployeeCode'), validatorObj.bankEmployeeCode, input?.required), ...input })));
1902
-
1903
- const BankEmpoleeField = JSX(({ field }) => (jsx(InputControl, { label: "\u0424\u0418\u041E \u0438\u043B\u0438 \u0434\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u0432\u0448\u0435\u0433\u043E \u0412\u0430\u0441 \u0441\u043E\u0442\u0440\u0443\u0434\u043D\u0438\u043A\u0430 \u0411\u0430\u043D\u043A\u0430", ...field('bankEmpolee') })));
1871
+ const defaultStyle = {
1872
+ focus: 'focus:border-primary-text focus:border',
1873
+ hover: 'hover:bg-primary-hover',
1874
+ active: 'active:bg-primary-active',
1875
+ font: 'text-center font-sans',
1876
+ };
1904
1877
 
1905
- const BankruptcyFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u0412 \u043E\u0442\u043D\u043E\u0448\u0435\u043D\u0438\u0438 \u043C\u0435\u043D\u044F \u0432\u0435\u0434\u0451\u0442\u0441\u044F \u043F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u0441\u0442\u0432\u043E \u043F\u043E \u0434\u0435\u043B\u0443 \u043E \u0431\u0430\u043D\u043A\u0440\u043E\u0442\u0441\u0442\u0432\u0435", ...getValidation(field('bankruptcyFlg'), validatorObj.bankruptcyFlg, input?.required) })));
1878
+ const styles$1 = {
1879
+ ...defaultStyle,
1880
+ border: 'border border-transparent rounded-md',
1881
+ position: 'absolute flex items-center justify-center',
1882
+ };
1883
+ const renderUserGeolocation = (map, yandexMaps, className) => {
1884
+ const setUserGeoLocation = () => {
1885
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1886
+ // @ts-ignore
1887
+ yandexMaps.geolocation
1888
+ .get({
1889
+ provider: 'yandex',
1890
+ autoReverseGeocode: true,
1891
+ mapStateAutoApply: true,
1892
+ })
1893
+ .then(function (result) {
1894
+ map.current.geoObjects.add(result.geoObjects);
1895
+ });
1896
+ };
1897
+ 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" }) }));
1898
+ };
1906
1899
 
1907
- const useElementSpace = (ref, heightEl) => {
1908
- const [spaceAbove, setSpaceAbove] = useState(false);
1900
+ const getNS = (_) => globalThis[_];
1901
+ const initializeExternalNS = (namespaceName, url) => {
1902
+ const script = document.getElementById(url);
1903
+ if (script) {
1904
+ const ns = getNS(namespaceName);
1905
+ if (ns) {
1906
+ return Promise.resolve(ns);
1907
+ }
1908
+ else {
1909
+ return new Promise((resolve) => {
1910
+ script.addEventListener('load', () => {
1911
+ resolve(getNS(namespaceName));
1912
+ });
1913
+ });
1914
+ }
1915
+ }
1916
+ else {
1917
+ return new Promise((resolve, reject) => {
1918
+ const newScript = document.createElement('script');
1919
+ newScript.src = url;
1920
+ newScript.async = true;
1921
+ newScript.id = url;
1922
+ newScript.addEventListener('load', () => {
1923
+ resolve(getNS(namespaceName));
1924
+ });
1925
+ newScript.addEventListener('error', (error) => {
1926
+ reject(error);
1927
+ });
1928
+ document.head.appendChild(newScript);
1929
+ });
1930
+ }
1931
+ };
1932
+ function useExternalNS(namespaceName, url, unmountNS = true) {
1933
+ const [externalNS, setExternalNS] = useState(undefined);
1909
1934
  useEffect(() => {
1910
- const handleResize = () => {
1911
- if (ref?.current) {
1912
- const { top } = ref.current.getBoundingClientRect();
1913
- const hasSpaceAbove = top > heightEl;
1914
- setSpaceAbove(hasSpaceAbove);
1935
+ let isMounted = true;
1936
+ initializeExternalNS(namespaceName, url)
1937
+ .then((ns) => {
1938
+ if (isMounted) {
1939
+ setExternalNS(ns);
1940
+ }
1941
+ })
1942
+ .catch((error) => {
1943
+ console.error(`Failed to initialize external namespace: ${error}`);
1944
+ });
1945
+ return () => {
1946
+ isMounted = false;
1947
+ if (unmountNS) {
1948
+ const script = document.getElementById(url);
1949
+ if (script) {
1950
+ document.head.removeChild(script);
1951
+ }
1952
+ setExternalNS(undefined);
1915
1953
  }
1916
1954
  };
1917
- handleResize();
1918
- window.addEventListener('resize', handleResize);
1919
- return () => window.removeEventListener('resize', handleResize);
1920
- }, [ref]);
1921
- return spaceAbove;
1955
+ }, [namespaceName, url, unmountNS]);
1956
+ return externalNS;
1957
+ }
1958
+
1959
+ const YMAPS_NAMESPACE = 'ymaps';
1960
+ const useYandexMaps = () => {
1961
+ const url = `https://api-maps.yandex.ru/2.1/?apikey=${projectSettings.YANDEX_MAP_API_KEY || ''}&lang=ru_RU`;
1962
+ return useExternalNS(YMAPS_NAMESPACE, url, false);
1922
1963
  };
1923
1964
 
1924
- const DAY_COUNT = 6;
1925
- const WEEK_COUNT = 7;
1926
- const renderCalendarCells = ({ today, firstDayOfWeek, totalDays, currentMonth, currentYear, min, max, onDateClick, }) => {
1927
- const calendarCells = [];
1928
- let dayCounter = 1;
1929
- for (let i = 0; i < DAY_COUNT; i++) {
1930
- const rowCells = [];
1931
- for (let j = 0; j < WEEK_COUNT; j++) {
1932
- if (i === 0 && j < firstDayOfWeek) {
1933
- rowCells.push(jsx("td", {}, `empty-${j}`));
1934
- }
1935
- else if (dayCounter > totalDays) {
1936
- rowCells.push(jsx("td", {}, `empty-${j}`));
1937
- }
1938
- else {
1939
- const currentDate = new Date(currentYear, currentMonth, dayCounter);
1940
- const isToday = checkIsToday(currentDate, today);
1941
- const isDisabled = checkIsDisabled(currentDate, min, max);
1942
- rowCells.push(jsx("td", { children: jsx("div", { className: getDayStyles(isToday, isDisabled), onClick: () => !isDisabled && onDateClick(currentDate), children: dayCounter }) }, `day-${dayCounter}`));
1943
- dayCounter++;
1944
- }
1945
- }
1946
- calendarCells.push(jsx("tr", { children: rowCells }, `row-${i}`));
1947
- }
1948
- return calendarCells;
1965
+ const styles = {
1966
+ ...defaultStyle,
1967
+ border: 'border-b border-b-2 border-gray last:border-0',
1968
+ position: 'relative flex items-center justify-center',
1949
1969
  };
1950
- const checkIsToday = (currentDate, today) => today && currentDate.toDateString() === today.toDateString();
1951
- const checkIsDisabled = (currentDate, min, max) => (min && currentDate.getTime() < min.getTime()) || (max && currentDate.getTime() > max.getTime());
1952
- const getDayStyles = (isToday = false, isDisabled = false) => style('p-s text-center rounded-md border', {
1953
- 'border-transparent hover:bg-gray': !isToday,
1954
- }, isDisabled ? 'text-gray hover:bg-transparent' : 'cursor-pointer');
1955
-
1956
- const WEEK_DAYS = ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'];
1957
- const Calendar = JSX(({ today, currentMonth, currentYear, min, max, onDateSelect = noop, setValue = noop }) => {
1958
- const handleDateClick = useCallback((date) => {
1959
- onDateSelect(date);
1960
- setValue(false);
1961
- }, []);
1962
- const { firstDayOfWeek, totalDays } = useMemo(() => ({
1963
- firstDayOfWeek: new Date(currentYear, currentMonth, 1).getDay() - 1,
1964
- totalDays: new Date(currentYear, currentMonth + 1, 0).getDate(),
1965
- }), [currentYear, currentMonth]);
1966
- return (jsxs("table", { className: "mx-auto", children: [jsx("thead", { className: "text-gray font-light", children: jsx("tr", { children: WEEK_DAYS.map((day, index) => (jsx("th", { className: "p-s", children: day }, String(index)))) }) }), jsx("tbody", { children: renderCalendarCells({
1967
- firstDayOfWeek,
1968
- today,
1969
- totalDays,
1970
- currentYear,
1971
- currentMonth,
1972
- min,
1973
- max,
1974
- onDateClick: handleDateClick,
1975
- }) })] }));
1970
+ // TODO: Добавить метод определения центральной точки
1971
+ const ZoomButton = JSX(({ yandexMaps, direction = 'in' }) => {
1972
+ const iconName = direction === 'in' ? 'PlusIcon' : 'MinusIcon';
1973
+ const changeZoom = () => {
1974
+ const currentZoom = yandexMaps.current.getZoom();
1975
+ const newZoom = direction === 'in' ? currentZoom + 1 : currentZoom - 1;
1976
+ yandexMaps.current.setZoom(newZoom, { checkZoomRange: true });
1977
+ };
1978
+ 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" }) }));
1976
1979
  });
1977
1980
 
1978
- const months = [
1979
- 'Январь',
1980
- 'Февраль',
1981
- 'Март',
1982
- 'Апрель',
1983
- 'Май',
1984
- 'Июнь',
1985
- 'Июль',
1986
- 'Август',
1987
- 'Сентябрь',
1988
- 'Октябрь',
1989
- 'Ноябрь',
1990
- 'Декабрь',
1991
- ];
1992
-
1993
- function normalizeWithMask(value, pattern) {
1994
- const valueNumbers = value.replace(/\D/g, '');
1995
- if (valueNumbers === '' || value?.length === pattern.length) {
1996
- return value;
1997
- }
1998
- const patternInArr = [...pattern];
1999
- const firstPlaceholderIndex = patternInArr.findIndex(isPlaceholder$1);
2000
- const valueWildcardIndicies = patternInArr.map((_, i) => isWildcard$1(_) ? patternInArr.slice(0, i).filter(isWildcard$1).length : -1);
2001
- const applyPlaceholder = (_, i) => isDigit$1(_) ? _ : valueNumbers.charAt(valueWildcardIndicies[i]) || _;
2002
- const resultInArr = patternInArr.map(applyPlaceholder);
2003
- const resultLength = valueWildcardIndicies.indexOf(valueNumbers.length - 1) + 1;
2004
- return resultInArr.slice(0, Math.max(firstPlaceholderIndex, resultLength)).join('');
2005
- }
2006
- const isPlaceholder$1 = (_) => _ === '_';
2007
- const isDigit$1 = (_) => /\d/.test(_);
2008
- const isWildcard$1 = (_) => isPlaceholder$1(_) || isDigit$1(_);
2009
-
2010
- const START_YEAR = 1940;
2011
- const getYears = () => Array.from({ length: new Date().getFullYear() - START_YEAR + 1 }, (_, i) => START_YEAR + i);
2012
-
2013
- const ICON_PROPS$1 = {
2014
- name: 'CalendarIcon',
2015
- iconVersion: 'black',
2016
- width: '24',
2017
- height: '24',
2018
- };
2019
- const DatePickerInput = JSX(({ setSelectedMonth, setSelectedYear, className, value, disabled, onChange, onClick }) => {
2020
- const ref = useRef(null);
2021
- const [inputValue, setInputValue] = useState(value || '');
2022
- const handleChange = (ev) => {
2023
- const val = ev.target?.value;
2024
- if (typeof val === 'string' && val?.length < 11) {
2025
- setInputValue(normalizeWithMask(val, '__.__.____'));
2026
- }
2027
- };
2028
- const onBlur = () => {
2029
- if (checkIsValidDate(inputValue)) {
2030
- const [day, month, year] = inputValue.split('.');
2031
- onChange?.(new Date(Number(year), Number(month) - 1, Number(day)));
2032
- setSelectedMonth(Number(month) - 1);
2033
- setSelectedYear(Number(year));
1981
+ const DEFAULT_CENTER_COORDS = [55.753995, 37.614069];
1982
+ // TODO: Поле для поиска: невыяснено среди каких данных делать поиск (искать в имени офиса, в адресе, метро и т.д.).
1983
+ // Сейчас реализован поиск среди тестовых данных
1984
+ // TODO: Также выяснить что делать когда ничего не найдено
1985
+ // TODO: На макетах также когда есть поле поиска нет кнопки открыть на карте.
1986
+ const YandexMap = JSX(({ points, className = '', zoom = 5, isLoad, selectedAddress }) => {
1987
+ const map = useRef(null);
1988
+ const yandexMaps = useYandexMaps();
1989
+ useEffect(() => {
1990
+ if (map.current) {
1991
+ renderClusterer({ yandexMaps, map: map.current, points, isLoad, selectedAddress });
2034
1992
  }
2035
1993
  else {
2036
- setInputValue(value || '');
2037
- }
2038
- };
2039
- const onInputClick = () => {
2040
- if (ref.current !== null) {
2041
- ref.current.focus();
1994
+ yandexMaps?.ready(() => {
1995
+ // Ready function may be called few times, but must be called once
1996
+ if (map.current) {
1997
+ renderClusterer({ yandexMaps, map: map.current, points, isLoad });
1998
+ return;
1999
+ }
2000
+ map.current = new yandexMaps.Map('map', {
2001
+ center: getCenterPoint(points),
2002
+ zoom,
2003
+ controls: [],
2004
+ suppressMapOpenBlock: true,
2005
+ });
2006
+ renderClusterer({ yandexMaps, map: map.current, points, isLoad });
2007
+ });
2042
2008
  }
2043
- onClick?.();
2044
- };
2009
+ }, [yandexMaps, points, zoom, isLoad, selectedAddress]);
2045
2010
  useEffect(() => {
2046
- setInputValue(value || '');
2047
- }, [value]);
2048
- return (jsxs("div", { onClick: onInputClick, className: style('relative', className), children: [jsx("input", { ref: ref, className: "h-full w-full px-m text-l text-black focus-visible:outline-none", value: inputValue, type: "text", onChange: handleChange, onBlur: onBlur, disabled: disabled }), disabled ? null : jsx(Icon, { className: "mr-s", ...ICON_PROPS$1 })] }));
2049
- });
2050
- const isValidYear = (year) => Number(year) >= START_YEAR && Number(year) <= new Date().getFullYear();
2051
- const isValidMonth = (month) => Number(month) > 0 && Number(month) < 13;
2052
- const checkIsValidDate = (date) => {
2053
- const [day, month, year] = date.split('.');
2054
- if (isValidYear(year)) {
2055
- if (isValidMonth(month)) {
2056
- const currentDate = new Date(Number(year), Number(month) - 1, 1);
2057
- let maxDateOfMonth = 0;
2058
- while (currentDate.getMonth() === Number(month) - 1) {
2059
- currentDate.setDate(currentDate.getDate() + 1);
2060
- maxDateOfMonth++;
2061
- }
2062
- if (Number(day) > 0 && Number(day) <= maxDateOfMonth) {
2063
- return true;
2064
- }
2011
+ if (map.current && selectedAddress) {
2012
+ yandexMaps?.geocode(selectedAddress).then((res) => {
2013
+ const firstGeoObject = res.geoObjects.get(0);
2014
+ const coords = firstGeoObject.geometry.getCoordinates();
2015
+ map.current.setCenter(coords);
2016
+ map.current.setZoom(18);
2017
+ });
2065
2018
  }
2019
+ }, [selectedAddress]);
2020
+ if (!yandexMaps) {
2021
+ return null;
2066
2022
  }
2067
- return false;
2023
+ const zIndex = 'z-10';
2024
+ 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))] }));
2025
+ });
2026
+ const getCenterPoint = (points) => {
2027
+ const centerCoords = [
2028
+ getArraySumAndAverage(mapByIndex(points, 0)),
2029
+ getArraySumAndAverage(mapByIndex(points, 1)),
2030
+ ];
2031
+ return centerCoords.every((_) => _) ? centerCoords : DEFAULT_CENTER_COORDS;
2068
2032
  };
2033
+ const mapByIndex = (points, index) => points.map((_) => _.coords?.[index]);
2034
+ const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
2069
2035
 
2070
- const formStyle = 'flex justify-between items-center h-14 border rounded-md cursor-pointer ' +
2071
- 'hover:border-black active:border-black focus:border-black';
2072
- const renderDatePickerForm = ({ handleChangeVisibleCalendar, value, valid, onChange, setSelectedMonth, setSelectedYear, disabled = false, }) => (jsx(DatePickerInput, { onChange: onChange, disabled: disabled, onClick: handleChangeVisibleCalendar, value: value && formatDate(value), setSelectedMonth: setSelectedMonth, setSelectedYear: setSelectedYear, className: style(formStyle, valid ? 'border-gray' : 'border-error') }));
2036
+ async function doRequest(url, method, body) {
2037
+ const response = await fetch(`${API_BASE_URI}${url}`, {
2038
+ method,
2039
+ headers: {
2040
+ 'Content-Type': 'application/json',
2041
+ ...getAuthorizationHeaders(),
2042
+ },
2043
+ credentials: 'include',
2044
+ body: body ? JSON.stringify(body) : null,
2045
+ });
2046
+ // TODO: add error handling
2047
+ return isJSON(response) ? response.json() : response;
2048
+ }
2049
+ // TODO: Need delete isJSON
2050
+ const isJSON = (response) => response.headers.get('Content-Type') === 'application/json';
2051
+ const getAuthorizationHeaders = () => {
2052
+ const token = sessionStorage.getItem('accessToken');
2053
+ return token ? { Authorization: `Bearer ${token}` } : null;
2054
+ };
2073
2055
 
2074
- const MONTHS_COUNT = 11;
2075
- const MONTHS_OPTIONS = months.map((key) => ({ key }));
2076
- const YEARS_OPTIONS = getYears()
2077
- .reverse()
2078
- .map((key) => ({ key: String(key) }));
2079
- const useDatePickerManager = ({ onShowCalendar, showCalendar, selectedMonth, onMonthSelect, onYearSelect, selectedYear, onChange, value, }) => {
2080
- const close = useCallback(() => showCalendar && onShowCalendar(false), [showCalendar]);
2081
- const ref = useOutsideClick(close);
2082
- const handleChangeVisibleCalendar = useCallback(() => onShowCalendar(!showCalendar), [showCalendar]);
2083
- const handleNextMonth = useCallback(() => {
2084
- if (selectedMonth + 1 <= MONTHS_COUNT) {
2085
- onMonthSelect(selectedMonth + 1);
2086
- }
2087
- else {
2088
- onMonthSelect(0);
2089
- onYearSelect(selectedYear + 1);
2090
- }
2091
- }, [selectedMonth]);
2092
- const handlePrevMonth = useCallback(() => {
2093
- if (selectedMonth - 1 >= 0) {
2094
- onMonthSelect(selectedMonth - 1);
2095
- }
2096
- else {
2097
- onMonthSelect(11);
2098
- onYearSelect(selectedYear - 1);
2056
+ const regionOffices = async (regionKey) => {
2057
+ const response = await doRequest('/public-data/regionOffices', 'POST', {
2058
+ regionRfCd: {
2059
+ key: regionKey,
2060
+ },
2061
+ cashCardFlg: true,
2062
+ });
2063
+ return await response.json().then((_) => _?.offices?.map((office) => ({
2064
+ ...office,
2065
+ gpsLatitude: (office.latitude ?? DEFAULT_CENTER_COORDS[0]).toString().replace(',', '.'),
2066
+ gpsLongitude: (office.longitude ?? DEFAULT_CENTER_COORDS[1]).toString().replace(',', '.'),
2067
+ })));
2068
+ };
2069
+
2070
+ const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
2071
+ const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
2072
+ const onToggle = useCallback(() => {
2073
+ setIsUnfolded((_) => !_);
2074
+ }, []);
2075
+ const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
2076
+ const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
2077
+ return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
2078
+ });
2079
+
2080
+ function useResizeObserver(callback, deps) {
2081
+ const ref = useRef(null);
2082
+ useEffect(() => {
2083
+ const element = ref?.current;
2084
+ if (!element) {
2085
+ return undefined;
2099
2086
  }
2100
- }, [selectedMonth]);
2101
- const handleSelectMonth = useCallback(({ key }) => {
2102
- onMonthSelect(months.indexOf(key));
2103
- const maxDateOfMonth = calculateMaxDaysOfMonth(selectedYear, months.indexOf(key));
2104
- handleChangeMonth({
2105
- maxDateOfMonth,
2106
- selectedYear,
2107
- selectedMonth: months.indexOf(key),
2108
- value,
2109
- onChange,
2087
+ const observer = new ResizeObserver((entries) => {
2088
+ callback(element, entries[0]);
2110
2089
  });
2111
- }, [value]);
2112
- const handleSelectYear = useCallback(({ key }) => {
2113
- onYearSelect(Number(key));
2114
- value && onChange?.(new Date(Number(key), selectedMonth, value?.getDate()));
2115
- }, [value]);
2116
- return {
2117
- handleChangeVisibleCalendar,
2118
- handleNextMonth,
2119
- handlePrevMonth,
2120
- handleSelectMonth,
2121
- handleSelectYear,
2122
- monthsOptions: MONTHS_OPTIONS,
2123
- yearsOptions: YEARS_OPTIONS,
2124
- ref,
2125
- };
2090
+ observer.observe(element);
2091
+ return () => {
2092
+ observer.disconnect();
2093
+ };
2094
+ }, [callback, ...deps]);
2095
+ return ref;
2096
+ }
2097
+
2098
+ const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
2099
+ const containerRef = useRef(null);
2100
+ const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
2101
+ if (containerRef.current) {
2102
+ containerRef.current.style.maxHeight = isUnfolded
2103
+ ? `${childrenWrapperEl.scrollHeight}px`
2104
+ : '';
2105
+ }
2106
+ }, [isUnfolded]);
2107
+ 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 }) }));
2108
+ });
2109
+
2110
+ const CardCell = JSX(({ value, subText, children, isPhone, ...props }) => {
2111
+ const textItems = (Array.isArray(value) ? value : value?.split(',') ?? []).filter(Boolean);
2112
+ if ([textItems.length, children, subText].every((_) => !_)) {
2113
+ return null;
2114
+ }
2115
+ return renderCardCell({ textItems, subText, children, isPhone, ...props });
2116
+ });
2117
+ 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] }));
2118
+ 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))));
2119
+ const cleanPhoneNumber = (phone) => phone.replace(/\D/g, '');
2120
+
2121
+ 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 })));
2122
+
2123
+ const getScheduleDescription = (workScheduleWeek) => {
2124
+ const rows = getDateDescription(workScheduleWeek);
2125
+ return jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", value: rows, className: "max-w-none" });
2126
2126
  };
2127
- const calculateMaxDaysOfMonth = (selectedYear, selectedMonth) => {
2128
- const date = new Date(selectedYear, selectedMonth, 1);
2129
- let maxDateOfMonth = 0;
2130
- while (date.getMonth() === selectedMonth) {
2131
- maxDateOfMonth++;
2132
- date.setDate(date.getDate() + 1);
2127
+ const buildScheduleText = ({ workTime = '', lunchHour = '', daysOff = '' }, isSaturday = false) => {
2128
+ if (!workTime) {
2129
+ return '';
2133
2130
  }
2134
- return maxDateOfMonth;
2131
+ return [
2132
+ `${isSaturday ? 'Суббота' : 'Будние дни'}: ${workTime}`,
2133
+ lunchHour ? `перерыв: ${lunchHour}` : '',
2134
+ daysOff ? `не работает: ${daysOff}` : '',
2135
+ ]
2136
+ .filter(Boolean)
2137
+ .join('; ');
2135
2138
  };
2136
- const handleChangeMonth = ({ maxDateOfMonth, selectedYear, selectedMonth, value, onChange, }) => {
2137
- value &&
2138
- onChange?.(new Date(selectedYear, selectedMonth, Math.min(maxDateOfMonth, value.getDate())));
2139
+ const getDateDescription = (workScheduleWeek) => {
2140
+ const workingWeekday = workScheduleWeek.find((_) => _.key !== 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
2141
+ const workingSaturday = workScheduleWeek.find((_) => _.key === 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
2142
+ const daysOff = workScheduleWeek
2143
+ .filter((_) => !_.status)
2144
+ .map((_) => _.short?.toLowerCase())
2145
+ .join(', ');
2146
+ const rows = [
2147
+ buildScheduleText({
2148
+ workTime: workingWeekday?.workTime,
2149
+ lunchHour: workingWeekday?.lunchHour,
2150
+ daysOff: workingSaturday ? '' : daysOff,
2151
+ }),
2152
+ buildScheduleText({ workTime: workingSaturday?.workTime, lunchHour: workingSaturday?.lunchHour, daysOff }, true),
2153
+ ].filter(Boolean);
2154
+ return rows;
2139
2155
  };
2140
2156
 
2141
- const ICON_PROPS = {
2142
- name: 'ArrowUpIcon',
2143
- iconVersion: 'black',
2144
- width: '24',
2145
- height: '24',
2157
+ const WEEKDAY_MAP = [
2158
+ ['workingMonday', 'Пн', 'Понедельник'],
2159
+ ['workingTuesday', 'Вт', 'Вторник'],
2160
+ ['workingWednesday', 'Ср', 'Среда'],
2161
+ ['workingThursday', 'Чт', 'Четверг'],
2162
+ ['workingFriday', 'Пт', 'Пятница'],
2163
+ ['workingSaturday', 'Сб', 'Суббота'],
2164
+ ['workingSunday', 'Вс', 'Воскресенье'],
2165
+ ];
2166
+ const getWorkScheduleWeek = (workSchedule) => WEEKDAY_MAP.map(([key, short, title]) => ({
2167
+ key,
2168
+ title,
2169
+ short,
2170
+ status: Boolean(workSchedule?.[key]),
2171
+ get workTime() {
2172
+ return key === 'workingSaturday' ? workSchedule?.workTimeSaturday : workSchedule?.workTime;
2173
+ },
2174
+ get lunchHour() {
2175
+ return key === 'workingSaturday' ? workSchedule?.lunchHourSaturday : workSchedule?.lunchHour;
2176
+ },
2177
+ get hasLunch() {
2178
+ return /\d+/.test(this.lunchHour ?? '');
2179
+ },
2180
+ }));
2181
+
2182
+ const renderBusinessSchedule = (scheduleDescription) => {
2183
+ if (!scheduleDescription) {
2184
+ return null;
2185
+ }
2186
+ const businessSchedule = getBusinessSchedule(scheduleDescription);
2187
+ 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 }) })] }));
2146
2188
  };
2147
- const SELECT_PROPS = {
2148
- className: 'min-w-32',
2149
- iconVersion: 'black',
2150
- isBorder: false,
2189
+ const getBusinessSchedule = (scheduleDescription) => {
2190
+ const weekDayMap = WEEKDAY_MAP.map(([, short]) => ({ short, status: true }));
2191
+ const splittedScheduleDescription = scheduleDescription.split('/') ?? [];
2192
+ const lastPartScheduleDescription = splittedScheduleDescription[splittedScheduleDescription.length - 1]?.toLowerCase();
2193
+ if (!lastPartScheduleDescription?.includes('выходной')) {
2194
+ return weekDayMap;
2195
+ }
2196
+ return weekDayMap.map((_) => ({
2197
+ ..._,
2198
+ status: !lastPartScheduleDescription?.includes(_.short.toLowerCase()),
2199
+ }));
2151
2200
  };
2152
- const DatePicker = JSX(
2153
- // eslint-disable-next-line max-lines-per-function
2154
- ({ className = '', label = '', value, valid = true, minDate, maxDate, disabled, onChange }) => {
2155
- const [showCalendar, { setValue }] = useBool(false);
2156
- const [selectedMonth, setSelectedMonth] = useState(value?.getMonth() || new Date().getMonth());
2157
- const [selectedYear, setSelectedYear] = useState(value?.getFullYear() || new Date().getFullYear());
2158
- const { handlePrevMonth, handleNextMonth, handleSelectMonth, handleSelectYear, monthsOptions, yearsOptions, handleChangeVisibleCalendar, ref, } = useDatePickerManager({
2159
- onYearSelect: setSelectedYear,
2160
- onMonthSelect: setSelectedMonth,
2161
- onShowCalendar: setValue,
2162
- selectedYear,
2163
- selectedMonth,
2164
- showCalendar,
2165
- onChange,
2166
- value,
2167
- });
2168
- const spaceAbove = useElementSpace(ref, 370);
2169
- return (jsxs("div", { className: style('space-y-xs', className), ref: ref, children: [renderLabel(label), jsxs("div", { className: "relative", children: [renderDatePickerForm({
2170
- handleChangeVisibleCalendar,
2171
- value,
2172
- valid,
2173
- onChange,
2174
- disabled,
2175
- setSelectedMonth,
2176
- setSelectedYear,
2177
- }), showCalendar && !disabled ? (jsxs("div", { className: style('absolute bg-white z-20 select-none', {
2178
- 'bottom-full': spaceAbove,
2179
- }), children: [jsxs("div", { className: "flex gap-s", children: [jsx("div", { className: "my-auto", onClick: handlePrevMonth, children: jsx(Icon, { ...ICON_PROPS, className: "-rotate-90 cursor-pointer" }) }), jsx(Select, { onChange: handleSelectMonth, value: { key: months[selectedMonth] }, options: monthsOptions, ...SELECT_PROPS }), jsx(Select, { onChange: handleSelectYear, value: { key: String(selectedYear) }, options: yearsOptions, ...SELECT_PROPS }), jsx("div", { className: "my-auto", onClick: handleNextMonth, children: jsx(Icon, { ...ICON_PROPS, className: "rotate-90 cursor-pointer" }) })] }), jsx(Calendar, { today: value, currentMonth: selectedMonth, currentYear: selectedYear, onDateSelect: onChange, min: minDate, max: maxDate, setValue: setValue })] })) : null] })] }));
2180
- });
2201
+ 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)));
2181
2202
 
2182
- const DatePickerControl = JSX(({ className, label, error, errors, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(DatePicker, { label: getRequiredLabel({ label, errors }), valid: Boolean(!error), ...rest }), renderErrorText(error)] })));
2203
+ 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)));
2183
2204
 
2184
- const BeginDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430 \u0440\u0430\u0431\u043E\u0442\u044B \u043D\u0430 \u0442\u0435\u043A\u0443\u0449\u0435\u043C \u043C\u0435\u0441\u0442\u0435", ...getValidation(field('beginDate'), validatorObj.beginDate, input?.required), ...input })));
2205
+ const colorStyle = {
2206
+ yellow: { border: 'border-yellow-light', text: 'text-yellow' },
2207
+ green: { border: 'border-green-more-light', text: 'text-green-dark' },
2208
+ gray: { border: 'border-gray', text: 'text-secondary-text' },
2209
+ red: { border: 'border-error/30', text: 'text-error' },
2210
+ };
2211
+ 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 })] })));
2185
2212
 
2186
- const MIN_AGE = 23;
2187
- const MAX_AGE = 75;
2188
- const AGE_ERROR_MESSAGE = 'Допустимый возраст заёмщика - от 23 до 75 лет';
2189
- const FIELD_NAME$8 = 'birthday';
2190
- const BirthdayField = JSX(({ field, input, isRetailForm = false }) => {
2191
- const { value } = field(FIELD_NAME$8);
2192
- return (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field(FIELD_NAME$8), validatorObj.birthday, input?.required), error: isRetailForm && value && !birthdayValidate(value) ? AGE_ERROR_MESSAGE : '', disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$8) }));
2193
- });
2194
- const birthdayValidate = (date) => {
2195
- const today = new Date();
2196
- const minDate = new Date(today.getFullYear() - MIN_AGE, today.getMonth(), today.getDate());
2197
- const maxDate = new Date(today.getFullYear() - MAX_AGE, today.getMonth(), today.getDate());
2198
- if (!date || date > minDate || date < maxDate) {
2199
- return false;
2213
+ const currentWeekDayIdx = new Date().getDay();
2214
+ //TODO: Add logic time https://github.com/redneckz/wildless-cms-uni-blocks/pull/1549
2215
+ const renderCurrentDaySchedule = (workScheduleWeek) => {
2216
+ const [currentWeekDay] = workScheduleWeek?.slice(currentWeekDayIdx - 1) ?? [];
2217
+ if (!currentWeekDay) {
2218
+ return null;
2200
2219
  }
2201
- return true;
2220
+ const { lunchHour, status, workTime, hasLunch } = currentWeekDay;
2221
+ 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" }));
2202
2222
  };
2203
2223
 
2204
- const FIELD_NAME$7 = 'birthPlace';
2205
- const BirthPlaceField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041C\u0435\u0441\u0442\u043E \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field('birthPlace'), validatorObj.birthPlace, input?.required), ...input, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$7) })));
2206
-
2207
- const CardCategoryField = JSX(({ field, input }) => {
2208
- const { data: cardCategory } = useLeadFormData('CARD_TYPE');
2209
- return (jsx(SelectField, { field: field, source: cardCategory, label: "\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F \u043A\u0430\u0440\u0442\u044B", fieldName: "cardCategory", input: input }));
2210
- });
2211
-
2212
- const ChildrenField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0434\u0435\u0442\u0435\u0439 \u0434\u043E 18 \u043B\u0435\u0442", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", ...getValidation(field('children'), validatorObj.children, input?.required), ...input })));
2213
-
2214
- const CodeWordField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u0434\u043E\u0432\u043E\u0435 \u0441\u043B\u043E\u0432\u043E", ...getValidation(field('codeWord'), validatorObj.codeWord, input?.required), ...input })));
2215
-
2216
- const CollectionCountField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043E\u0431\u044A\u0435\u043A\u0442\u043E\u0432 \u0438\u043D\u043A\u0430\u0441\u0441\u0430\u0446\u0438\u0438", type: "number", ...getValidation(field('collectionCount'), validatorObj.collectionCount, input?.required) })));
2224
+ const getSubTextLunch = ({ lunchHour, hasLunch = false, status = false }) => {
2225
+ if (!status) {
2226
+ return 'Не работает';
2227
+ }
2228
+ return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
2229
+ };
2230
+ 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)));
2217
2231
 
2218
- const CommentField = JSX(({ field, input }) => (jsx(InputControl, { className: "col-span-2", ...getValidation(field('comment'), validatorObj.comment, input?.required), placeholder: "\u0412\u0430\u0448\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435", isTextarea: true })));
2232
+ const ICONS$1 = ['ArrowDownIcon', 'ArrowUpIcon'];
2233
+ const labels = ['Подробнее', 'Скрыть'];
2234
+ 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" })] }));
2219
2235
 
2220
- const ConfirmationIncomeField = JSX(({ field, input }) => {
2221
- const { data: confirmationIncome } = useLeadFormData('INCOME_CERT_UNITED');
2222
- return (jsx(SelectField, { field: field, source: confirmationIncome, label: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u044F \u0434\u043E\u0445\u043E\u0434\u0430", fieldName: "confirmationIncome", input: input }));
2223
- });
2236
+ const renderWorkSchedule = (workSchedule) => {
2237
+ const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2238
+ const timeOfWork = workSchedule ? getDateDescription(workScheduleWeek) : '';
2239
+ const businessTimeOfWork = workSchedule ? workSchedule.businessScheduleDescription : '';
2240
+ if (!workSchedule) {
2241
+ return '';
2242
+ }
2243
+ if (!workSchedule.businessScheduleVisibleTag) {
2244
+ return renderMatchingTimeOfWork(timeOfWork);
2245
+ }
2246
+ if (workSchedule.businessScheduleVisibleTag &&
2247
+ workSchedule.businessScheduleDescription === null) {
2248
+ return renderIndividualTimeOfWork(timeOfWork);
2249
+ }
2250
+ return renderDefaultTimeOfWork(timeOfWork, businessTimeOfWork);
2251
+ };
2252
+ const renderIndividualTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p>`;
2253
+ const renderMatchingTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ. и юр. лиц:<br/></b> ${timeOfWork}</p>`;
2254
+ const renderDefaultTimeOfWork = (timeOfWork, businessTimeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${businessTimeOfWork}</p>`;
2224
2255
 
2225
- const ConscriptionField = JSX(({ field, input }) => {
2226
- const { data: conscription } = useLeadFormData('MILITARY_STATUS');
2227
- return (jsx(SelectField, { field: field, source: conscription, label: "\u0421\u0442\u0430\u0442\u0443\u0441 \u0432\u043E\u0435\u043D\u043D\u043E\u043E\u0431\u044F\u0437\u0430\u043D\u043D\u043E\u0433\u043E", fieldName: "conscription", input: input }));
2228
- });
2229
-
2230
- const CONSENTS = {
2231
- processPersonalDataFlg: {
2232
- text: 'Согласие на обработку персональных данных',
2233
- docId: 4,
2234
- },
2235
- consentInformFlg: {
2236
- text: 'Согласие на информирование о продуктах и услугах Банка',
2237
- docId: 14,
2238
- },
2239
- consentProviderFlg: {
2240
- text: 'Согласие об использовании простой электронной подписи',
2241
- docId: 5,
2242
- },
2243
- consentOthersFlg: {
2244
- text: 'Прочие согласия',
2245
- docId: 1,
2246
- },
2247
- consentPfrFlg: {
2248
- text: 'Согласие на запрос в ПФР',
2249
- docId: 3,
2250
- },
2251
- consentToReceiveMaterials: {
2252
- text: 'Согласен на получение информационных и аналитических материалов по электронной почте',
2253
- },
2254
- };
2255
-
2256
- async function doRequest(url, method, body) {
2257
- const response = await fetch(`${API_BASE_URI}${url}`, {
2258
- method,
2259
- headers: {
2260
- 'Content-Type': 'application/json',
2261
- ...getAuthorizationHeaders(),
2262
- },
2263
- credentials: 'include',
2264
- body: body ? JSON.stringify(body) : null,
2265
- });
2266
- // TODO: add error handling
2267
- return isJSON(response) ? response.json() : response;
2268
- }
2269
- // TODO: Need delete isJSON
2270
- const isJSON = (response) => response.headers.get('Content-Type') === 'application/json';
2271
- const getAuthorizationHeaders = () => {
2272
- const token = sessionStorage.getItem('accessToken');
2273
- return token ? { Authorization: `Bearer ${token}` } : null;
2256
+ const renderOfficeCard = ({ name, address, phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }, i) => {
2257
+ if (!workSchedule) {
2258
+ return null;
2259
+ }
2260
+ const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2261
+ 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({
2262
+ phone,
2263
+ fax,
2264
+ phoneBusiness,
2265
+ phoneNatural,
2266
+ phoneCallCentre,
2267
+ phoneCurrencyControl,
2268
+ workSchedule,
2269
+ exchangeRate,
2270
+ }) }), jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
2271
+ return (jsx(FoldableSection, { isUnfolded: isUnfolded, children: renderCardContent$1({
2272
+ phone,
2273
+ fax,
2274
+ phoneBusiness,
2275
+ phoneNatural,
2276
+ phoneCallCentre,
2277
+ phoneCurrencyControl,
2278
+ workSchedule,
2279
+ exchangeRate,
2280
+ }) }));
2281
+ },
2282
+ //** TODO: remove styles with refactoring DefaultFoldButton*/
2283
+ renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$3({ isUnfolded, onToggle }) })] }, String(i)));
2274
2284
  };
2275
-
2276
- const feedbackById = async (id, convertToPng = false) => {
2277
- const response = await doRequest(`/feedback/file?id=${encodeURIComponent(id)}&convertToPngFlg=${convertToPng}`, 'GET');
2278
- return await response.blob();
2285
+ const renderCardContent$1 = ({ phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }) => {
2286
+ const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2287
+ const labelSchedule = workSchedule?.businessScheduleVisibleTag
2288
+ ? 'Для физических лиц'
2289
+ : 'Для физических и юридических лиц';
2290
+ 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
2291
+ ? renderBusinessSchedule(workSchedule?.businessScheduleDescription)
2292
+ : null, exchangeRate?.currencies?.length ? (jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }));
2279
2293
  };
2280
-
2281
- const getDocument = async (id, convertToPng = false) => {
2282
- const response = await feedbackById(id, convertToPng);
2283
- return URL.createObjectURL(response);
2294
+ const capitalizedFirstLetter$1 = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
2295
+ const getOfficePoint = ({ name = '', address = '', workSchedule }) => {
2296
+ const header = capitalizedFirstLetter$1(name);
2297
+ const body = `${address} ${renderWorkSchedule(workSchedule)}`;
2298
+ return { header, body };
2284
2299
  };
2285
2300
 
2286
- const CloseButton = JSX(({ className, onClose }) => (jsx("button", { className: style('flex justify-center items-center w-12 h-12 p-2xs bg-transparent border-none', className), onClick: onClose, title: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C", type: "button", children: jsx(Icon, { name: "CloseIcon", width: "20", height: "20", iconVersion: "gray" }) })));
2301
+ const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
2287
2302
 
2288
- const Dialog = JSX(({ className, head, children, onClose, onClick }) => {
2289
- const { close } = useDialogManager();
2290
- const handleClose = useCallback(() => {
2291
- close();
2292
- onClose && onClose();
2293
- }, [onClose]);
2294
- return (jsxs("div", { onClick: onClick, className: style('relative min-h-full bg-white pt-0 p-lg', className), role: "dialog", children: [jsxs("div", { className: "sticky py-xl top-0 bg-white z-10", children: [jsx(CloseButton, { className: "absolute top-0 right-0", onClose: handleClose }), jsx("div", { className: "container", children: head })] }), jsx("div", { className: "container pb-6xl", children: children })] }));
2295
- });
2303
+ const isClient = !isSSR();
2304
+ const ClientOnly = JSX(({ children }) => (isClient ? children : null));
2296
2305
 
2297
- const openDocument = async (open, id, convertToPng = false) => {
2298
- const document = await getDocument(id, convertToPng);
2299
- open(jsx(Dialog, { className: "my-6xl max-w-4xl mx-auto px-0 min-h-0 pb-0", children: convertToPng ? (jsx("img", { src: document })) : (jsx("iframe", { src: `${document}#toolbar=0`, className: "w-full h-[80vh]", id: "iframe-dialog" })) }));
2306
+ const INITIAL_FILTRATION_STATE$1 = {
2307
+ workingSaturday: false,
2308
+ premiumService: false,
2309
+ privateBanking: false,
2310
+ remoteWorkplace: false,
2311
+ serviceDisabledPeople: false,
2312
+ sellingCoins: false,
2313
+ buyingCoins: false,
2314
+ bullionOperations: false,
2315
+ preciousMetalsOperations: false,
2316
+ transferringDataToBiometricSystem: false,
2300
2317
  };
2301
-
2302
- const OPEN_DOC_BUTTON_TEXT = 'Ознакомиться';
2303
- const CheckboxWithDoc = JSX(({ className, error, docId, ...props }) => {
2304
- const { open } = useDialogManager();
2305
- const isMobile = useMobileMode();
2306
- return (jsxs("div", { className: className, children: [jsxs("div", { className: "flex flex-wrap gap-x-m", children: [jsx(Checkbox, { ...props }), docId ? (jsx(LinkButton, { className: "text-primary-main", onClick: () => openDocument(open, docId, isMobile), children: jsx(Text, { children: OPEN_DOC_BUTTON_TEXT }) })) : null] }), renderErrorText(error)] }));
2307
- });
2308
-
2309
- const ConsentField = JSX(({ field, input }) => input && input.name ? (jsx(CheckboxWithDoc, { text: CONSENTS[input.name]?.text, docId: CONSENTS[input.name]?.docId, ...getValidation(field(input.name), validatorObj[input.name], input?.required) })) : null);
2310
-
2311
- const LABEL_TEXT = `Имеет ли юридическое лицо, акционером / участником / членом / пайщиком /
2312
- вкладчиком с долей участия более 20% уставного капитала руководителем,
2313
- которого Вы являетесь, кредит в АО «Россельхозбанк»`;
2314
- const CreditInRshbCdField = JSX(({ field, input }) => {
2315
- const { data: creditInRshbCd } = useLeadFormData('CREDIT_IN_RSHB');
2316
- return (jsx(SelectField, { field: field, source: creditInRshbCd, label: LABEL_TEXT, fieldName: "creditInRshbCd", input: input }));
2317
- });
2318
-
2319
- const orientationStyleMap = {
2320
- horizontal: '@lg:flex-row',
2321
- vertical: '',
2318
+ const FILTRATION_LABELS = {
2319
+ safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
2320
+ workingSaturday: 'Открыты по субботам',
2321
+ terminalTypeAtms: 'Банкоматы',
2322
+ terminalTypeTerm: 'Терминалы',
2323
+ workAllTime: 'Круглосуточно',
2324
+ billAcceptorEnable: 'Прием наличных',
2325
+ premiumService: 'Премиальное обслуживание',
2326
+ privateBanking: 'Услуга Private banking',
2327
+ sellingCoins: 'Продажа монет из драгоценных металлов',
2328
+ buyingCoins: 'Покупка монет из драгоценных металлов',
2329
+ bullionOperations: 'Операции со слитками',
2330
+ preciousMetalsOperations: 'Операции с драгоценными металлами',
2331
+ transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
2332
+ locationDisabledPeople: 'Для маломобильных',
2333
+ designDisabledPeople: 'Для слабовидящих',
2334
+ remoteWorkplace: 'Удаленное рабочее место',
2335
+ serviceDisabledPeople: 'Для маломобильных граждан',
2336
+ };
2337
+ const FILTRATION_PREDICATES$1 = {
2338
+ workingSaturday: (item) => Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
2339
+ premiumService: (item) => Boolean('premiumService' in item && item.premiumService),
2340
+ privateBanking: (item) => Boolean('privateBanking' in item && item.privateBanking),
2341
+ remoteWorkplace: (item) => Boolean('workScheduleDescription' in item),
2342
+ serviceDisabledPeople: (item) => Boolean('serviceDisabledPeople' in item && item.serviceDisabledPeople),
2343
+ sellingCoins: (item) => Boolean('sellingCoins' in item && item.sellingCoins),
2344
+ buyingCoins: (item) => Boolean('buyingCoins' in item && item.buyingCoins),
2345
+ bullionOperations: (item) => Boolean('bullionOperations' in item && item.bullionOperations),
2346
+ preciousMetalsOperations: (item) => Boolean('preciousMetalsOperations' in item && item.preciousMetalsOperations),
2347
+ transferringDataToBiometricSystem: (item) => Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
2322
2348
  };
2323
- 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)))) })] })));
2324
2349
 
2325
- 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)] })));
2350
+ function useButton() {
2351
+ return (props) => ({
2352
+ ...props,
2353
+ onClick: handlerDecorator(handleClick(props)),
2354
+ });
2355
+ }
2356
+ function handleClick({ disabled, onClick }) {
2357
+ return (ev) => {
2358
+ !disabled && onClick && onClick(ev);
2359
+ };
2360
+ }
2326
2361
 
2327
- const CURRENCY_TYPES = [{ id: 'rub', text: 'Рубль' }];
2328
- const CurrencyField = JSX(({ field, input }) => {
2329
- const { value, onChange } = field('currency');
2330
- return (jsx(RadioButtonGroupControl, { label: "\u0412\u0430\u043B\u044E\u0442\u0430", orientation: "horizontal", items: CURRENCY_TYPES, value: value, onChange: (_) => onChange?.(_), ...getValidation(field('currency'), validatorObj.currency, input?.required) }));
2362
+ const buttonStyleMap = {
2363
+ primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
2364
+ secondary: 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
2365
+ };
2366
+ const secondaryButtonStyleMap = {
2367
+ 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'),
2368
+ 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'),
2369
+ };
2370
+ const Button = JSX(({ children, ...props }) => {
2371
+ const button = useButton();
2372
+ const { className, version = 'primary', active, disabled, type = 'button', rounded = true, role, onClick, } = button(props);
2373
+ return (jsx("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs', {
2374
+ 'text-white bg-primary-active': active,
2375
+ 'bg-main-gray text-main-disabled cursor-not-allowed': disabled,
2376
+ 'rounded-md': rounded,
2377
+ }, !active && !disabled
2378
+ ? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
2379
+ : '', className), type: type, role: role, onClick: onClick, children: children }));
2331
2380
  });
2332
2381
 
2333
- const DeliveryDateFiels = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0438", ...getValidation(field('deliveryDate'), validatorObj.deliveryDate, input?.required) })));
2334
-
2335
- const DependentsField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0438\u0436\u0434\u0438\u0432\u0435\u043D\u0446\u0435\u0432", placeholder: "\u0417\u0430 \u0438\u0441\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435 \u0434\u0435\u0442\u0435\u0439 \u0434\u043E 18 \u043B\u0435\u0442", type: "number", maxLength: 2, ...getValidation(field('dependents'), validatorObj.dependents, input?.required), ...input })));
2382
+ const getVersion = (isPrimary, type) => isPrimary && type !== 'underlined' ? 'primary' : 'secondary';
2336
2383
 
2337
- const DesiredMeetingDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0416\u0435\u043B\u0430\u0435\u043C\u0430\u044F \u0434\u0430\u0442\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0438", ...getValidation(field('desiredMeetingDate'), validatorObj.meetingDay, input?.required) })));
2384
+ const renderButtonsGroup = (data, activeButton, onButtonClick) => {
2385
+ const allButtonVersion = getVersion(activeButton === 'all');
2386
+ const businessButtonVersion = getVersion(activeButton === 'business');
2387
+ const handleClick = (e, key, branches) => {
2388
+ const filteredBranches = e.currentTarget === e.target && key === 'business' ? filterBranches(branches) : branches;
2389
+ onButtonClick(key);
2390
+ return filteredBranches;
2391
+ };
2392
+ const filterBranches = (branches) => branches.filter((branch) => branch.workSchedule &&
2393
+ branch.workSchedule.businessScheduleVisibleTag &&
2394
+ !branch.workSchedule.businessScheduleDescription);
2395
+ 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" })] }));
2396
+ };
2338
2397
 
2339
- const DisablePeopleFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u042F\u0432\u043B\u044F\u044E\u0441\u044C \u0438\u043D\u0432\u0430\u043B\u0438\u0434\u043E\u043C", ...getValidation(field('disablePeopleFlg'), validatorObj.disablePeopleFlg, input?.required) })));
2398
+ 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;
2340
2399
 
2341
- const FIELD_NAME$6 = 'dulIssueDateField';
2342
- const DulIssueDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0432\u044B\u0434\u0430\u0447\u0438", ...getValidation(field(FIELD_NAME$6), validatorObj.dulIssueDateField, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$6) })));
2400
+ const COMMON_FILTERS_STYLES = 'flex flex-col sm:flex-row sm:flex-wrap gap-3xl pb-2xl';
2401
+ const renderFiltrationForm = ({ filters, field: { field, reset }, onlyOffice, labels, }) => {
2402
+ const visibleFiltersNum = onlyOffice ? 5 : 6;
2403
+ const filtersCheckbox = (filters || []).map((key) => (jsx(Checkbox, { text: labels[key], ...field(key) }, key)));
2404
+ const [visibleFilters, hiddenFilters] = visibleFiltersNum > 0
2405
+ ? [filtersCheckbox.slice(0, visibleFiltersNum), filtersCheckbox.slice(visibleFiltersNum)]
2406
+ : [filtersCheckbox, []];
2407
+ 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 }));
2408
+ };
2409
+ const renderFoldButton$2 = (reset, onlyOffice = false) => ({ isUnfolded, onToggle }) => {
2410
+ const labels = ['Больше фильтров', 'Меньше фильтров'];
2411
+ const icons = ['ArrowDownIcon', 'ArrowUpIcon'];
2412
+ 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() })] }));
2413
+ };
2414
+ 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" })] }));
2343
2415
 
2344
- const FIELD_NAME$5 = 'dulIssuedBy';
2345
- const DulIssuedByField = JSX(({ field, input }) => {
2346
- const { value: dulSubdivisionCode, onChange: changeDulSubdivisionCode } = field('dulSubdivisionCode');
2347
- const onDaDataChange = useCallback((item) => {
2348
- changeDulSubdivisionCode?.(item?.data?.code?.replace('-', ''));
2349
- }, []);
2350
- return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$5), label: "\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D", ...input, ...getValidation(field(FIELD_NAME$5), validatorObj.dulIssuedBy, input?.required), onDaDataChange: onDaDataChange, daDataQueryPrefix: dulSubdivisionCode }));
2351
- });
2416
+ 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] }) }));
2352
2417
 
2353
- const FIELD_NAME$4 = 'dulNumber';
2354
- const DulNumberField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$4), label: "\u041D\u043E\u043C\u0435\u0440 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", type: "number", maxLength: 6, ...getValidation(field('dulNumber'), validatorObj.dulNumber, input?.required) })));
2355
-
2356
- const FIELD_NAME$3 = 'dulSerie';
2357
- const DulSerieField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$3), label: "\u0421\u0435\u0440\u0438\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", type: "number", maxLength: 4, ...getValidation(field('dulSerie'), validatorObj.dulSerie, input?.required) })));
2358
-
2359
- const FIELD_NAME$2 = 'dulSubdivisionCode';
2360
- const DulSubdivisionCodeField = JSX(({ field, input }) => {
2361
- const onDaDataChange = useCallback((item) => {
2362
- field?.('dulIssuedBy')?.onChange?.(item?.data?.name);
2363
- }, []);
2364
- return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$2), label: "\u041A\u043E\u0434 \u043F\u043E\u0434\u0440\u0430\u0437\u0434\u0435\u043B\u0435\u043D\u0438\u044F", type: "number", maxLength: 6, ...input, ...getValidation(field(FIELD_NAME$2), validatorObj.dulSubdivisionCode, input?.required), onDaDataChange: onDaDataChange }));
2365
- });
2366
-
2367
- const EducationField = JSX(({ field, input }) => {
2368
- const { data: education } = useLeadFormData('EDUCATION_LEVEL');
2369
- return (jsx(SelectField, { field: field, source: education, label: "\u041E\u0431\u0440\u0430\u0437\u043E\u0432\u0430\u043D\u0438\u0435", fieldName: "education", input: input }));
2418
+ const defaultEmptyFunction$1 = () => void 0;
2419
+ const filtersVisibleStyles = (activeButton) => activeButton === 'all' ? 'block' : 'hidden';
2420
+ const OfficesAtmsMapLayout = JSX(({ className, data = [], isLoad, remoteWorkplaces = [], renderCard = defaultEmptyFunction$1, renderRemoteWorkplaceCard = defaultEmptyFunction$1, getBalloon = defaultEmptyFunction$1, getBalloonRemoteWorkplaces = defaultEmptyFunction$1, descriptionData, title, }) => {
2421
+ const onlyOffice = title?.includes('Офис');
2422
+ const [filtrationState, { field, reset }] = useForm(INITIAL_FILTRATION_STATE$1);
2423
+ const { filteredItems, points, filteredRemoteWorkplaces, lengthItems } = useOfficesAtmsMapData({
2424
+ data,
2425
+ remoteWorkplaces,
2426
+ filtrationState,
2427
+ getBalloon,
2428
+ getBalloonRemoteWorkplaces,
2429
+ });
2430
+ const [activeButton, setActiveButton] = useState('all');
2431
+ const filterOptions = {
2432
+ filters: getFiltersWithNonEmptyData([...data, ...remoteWorkplaces]),
2433
+ field: { field, reset },
2434
+ onlyOffice,
2435
+ labels: FILTRATION_LABELS,
2436
+ };
2437
+ 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)] })] }));
2370
2438
  });
2439
+ const filterItems$1 = (data, filtrationState) => {
2440
+ const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
2441
+ return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES$1[_](item)));
2442
+ };
2443
+ const getFiltersWithNonEmptyData = (data) => Object.keys(INITIAL_FILTRATION_STATE$1).filter((_) => data.filter((item) => FILTRATION_PREDICATES$1[_](item)).length);
2371
2444
 
2372
- const EmailField = JSX(({ field, input }) => {
2373
- const { required, ...rest } = input;
2374
- return (jsx(InputControl, { label: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430", ...getValidation(field('email'), validatorObj.email, required), ...rest }));
2375
- });
2445
+ const defaultEmptyFunction = () => void 0;
2446
+ const useOfficesAtmsMapData = ({ data, remoteWorkplaces = [], filtrationState = {}, getBalloon = defaultEmptyFunction, getBalloonRemoteWorkplaces = defaultEmptyFunction, }) => {
2447
+ const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
2448
+ const _filteredItems = filterItems$1(data, filtrationState);
2449
+ const _filteredRemoteWorkplaces = filterItems$1(remoteWorkplaces, filtrationState);
2450
+ const _points = [
2451
+ ..._filteredItems.map((_) => ({
2452
+ type: 'offices',
2453
+ coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
2454
+ content: getBalloon(_),
2455
+ })),
2456
+ ..._filteredRemoteWorkplaces.map((_) => ({
2457
+ type: 'workplaces',
2458
+ coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
2459
+ content: getBalloonRemoteWorkplaces({
2460
+ address: _.address,
2461
+ workScheduleDescription: _.workScheduleDescription,
2462
+ }),
2463
+ })),
2464
+ ].filter((_) => _.coords && _.coords.length === 2);
2465
+ const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
2466
+ return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
2467
+ }, [data, remoteWorkplaces, filtrationState, getBalloon, getBalloonRemoteWorkplaces]);
2468
+ return { filteredItems, points, filteredRemoteWorkplaces, lengthItems };
2469
+ };
2376
2470
 
2377
- const EmployerActivitiesField = JSX(({ field, input }) => {
2378
- const { data: employerActivities } = useLeadFormData('ORGANIZATION_ACTIVITY_TYPE');
2379
- return (jsx(SelectField, { field: field, source: employerActivities, label: "\u0412\u0438\u0434 \u0434\u0435\u044F\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438-\u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044F", fieldName: "employerActivities", input: input }));
2380
- });
2471
+ const useLeadFormData = (typeField) => {
2472
+ const { data, error } = useAsyncData(`/api/v1/dictionary?dictionaryType=${encodeURIComponent(typeField)}`, fetchData);
2473
+ if (data && 'errorMessage' in data) {
2474
+ return { error };
2475
+ }
2476
+ return { data: data, error };
2477
+ };
2478
+ const fetchData = async (url) => {
2479
+ const result = await fetchJSON(url, { method: 'POST' });
2480
+ return result || [];
2481
+ };
2381
2482
 
2382
- const EmployerOrganizationField = JSX(({ field, input }) => {
2383
- const { data: employerOrganization } = useLeadFormData('ORGANIZATION_KIND');
2384
- return (jsx(SelectField, { field: field, source: employerOrganization, label: "\u0412\u0438\u0434 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044F", fieldName: "employerOrganization", input: input }));
2483
+ const AddressRetailField = JSX(({ field, input }) => {
2484
+ const [offices, setOffices] = useState([]);
2485
+ const { data } = useLeadFormData('REGION_RF');
2486
+ const regionValue = field('regionRetail')?.value || {};
2487
+ const fieldBranch = field('addressRetail');
2488
+ useEffect(() => {
2489
+ (async () => {
2490
+ const officesList = await regionOffices(regionValue?.key ?? '');
2491
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
2492
+ setOffices(officesList || []);
2493
+ })();
2494
+ if (regionValue?.key) {
2495
+ field?.('addressRetail')?.onChange?.('');
2496
+ }
2497
+ }, [regionValue.key]);
2498
+ const { points } = useOfficesAtmsMapData({
2499
+ data: offices,
2500
+ filtrationState: {},
2501
+ getBalloon: getOfficePoint,
2502
+ });
2503
+ const isRegionSelected = Boolean(regionValue?.key);
2504
+ 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: offices.map(({ id, address = '' }) => ({
2505
+ key: id?.toString() || '',
2506
+ text: address,
2507
+ })), ...getValidation(field('addressRetail'), validatorObj.addressRetail, input?.required && isRegionSelected), isSearch: true }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: !data, className: "h-full", selectedAddress: fieldBranch?.value?.text }) }) })] }));
2385
2508
  });
2386
2509
 
2387
- const EmploymentField = JSX(({ field, input }) => {
2388
- const { data: employment } = useLeadFormData('EMPLOYMENT_INFO_UNITED');
2389
- return (jsx(SelectField, { field: field, source: employment, label: "\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u043E \u0442\u0440\u0443\u0434\u043E\u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u0435", fieldName: "employment", input: input }));
2390
- });
2510
+ const useNormalizedInput = (props, { normalize, format }) => {
2511
+ const { value, onFocus, onBlur, onChange } = props;
2512
+ const [isFocused, setIsFocused] = useState(false);
2513
+ const handleFocus = useCallback((ev) => {
2514
+ setIsFocused(true);
2515
+ onFocus && onFocus(ev);
2516
+ }, []);
2517
+ const handleBlur = useCallback(() => {
2518
+ setIsFocused(false);
2519
+ onChange && onChange(normalize(value));
2520
+ onBlur && onBlur();
2521
+ }, [onChange, value]);
2522
+ return {
2523
+ value: (isFocused || !format ? value : format(value)),
2524
+ onFocus: handleFocus,
2525
+ onBlur: handleBlur,
2526
+ };
2527
+ };
2391
2528
 
2392
- const ExpensesField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0440\u0430\u0441\u0445\u043E\u0434\u044B \u0432 \u043C\u0435\u0441\u044F\u0446", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", ...getValidation(field('expenses'), validatorObj.expenses, input?.required), ...input })));
2529
+ const clamp = (value, min, max) => Math.max(min, Math.min(value, max));
2393
2530
 
2394
- const Experience5YearsField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u0442\u0430\u0436", placeholder: "\u0417\u0430 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 5 \u043B\u0435\u0442", type: "number", maxLength: 2, ...getValidation(field('experience5Years'), validatorObj.experience5Years, input?.required), ...input })));
2531
+ function parseDecimal(value) {
2532
+ const rawValue = (value || '').replace(/\D/g, '');
2533
+ const unsafeDecimal = parseInt(rawValue, 10);
2534
+ return Number.isNaN(unsafeDecimal) ? 0 : unsafeDecimal;
2535
+ }
2395
2536
 
2396
- const FamilyMembersField = JSX(({ field }) => {
2397
- const { value, onChange } = field('familyMembers');
2398
- const familyStatusKey = field('familyStatus')?.value?.key;
2399
- const adultsCount = familyStatusKey === 'MARRIED' ? 2 : 1;
2400
- const childrenCount = Number(field('children')?.value);
2401
- const dependentsCount = Number(field('dependents')?.value);
2402
- const totalCount = adultsCount + childrenCount + dependentsCount;
2403
- useEffect(() => {
2404
- field?.('familyMembers')?.onChange?.(totalCount);
2405
- }, [familyStatusKey, childrenCount, dependentsCount]);
2406
- return (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0447\u043B\u0435\u043D\u043E\u0432 \u0441\u0435\u043C\u044C\u0438", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", disabled: true, value: value, onChange: (_) => onChange?.(_) }));
2407
- });
2537
+ function renderRangeWithTicks({ list = [], min, max, step, value = list[0] || min, disabled, onChange, }) {
2538
+ const rangeValue = list.length ? list.indexOf(value) : value;
2539
+ const rangeValueShift = rangeValue > min ? rangeValue - min : 0;
2540
+ const percentage = (rangeValueShift * 100) / (max - min);
2541
+ const inputStyle = {
2542
+ backgroundSize: `${percentage.toFixed(2)}% 100%`,
2543
+ };
2544
+ return (jsxs("div", { children: [list.length ? (jsx("div", { className: "absolute w-full flex justify-between -bottom-[3px] px-m", children: list.map((_, i) => (jsx("div", { className: style('w-2 h-2 rounded-full', rangeValue <= i || disabled ? 'bg-gray' : 'bg-primary-main') }, String(i)))) })) : null, jsx("div", { className: "absolute inset-x-0 -bottom-1 px-m leading-[18px]", children: jsx("input", { className: "box-border w-full m-0 cursor-pointer slider relative z-10", style: inputStyle, type: "range", min: min, max: max, step: step, value: rangeValue, disabled: disabled, onChange: ((ev) => {
2545
+ const rawValue = parseDecimal(ev.target?.value);
2546
+ const newValue = list.length ? list[rawValue] : rawValue;
2547
+ onChange && onChange(newValue || 0);
2548
+ }) }) })] }));
2549
+ }
2408
2550
 
2409
- const FamilyStatusField = JSX(({ field, input }) => {
2410
- const { data: familyStatus } = useLeadFormData('MARITAL_STATUS');
2411
- return (jsx(SelectField, { field: field, source: familyStatus, label: "\u0421\u0435\u043C\u0435\u0439\u043D\u043E\u0435 \u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435", fieldName: "familyStatus", input: input }));
2551
+ const inputDisabledStyle = 'disabled:border-gray disabled:bg-main-divider';
2552
+ const DEFAULT_MIN = 1;
2553
+ const DEFAULT_MAX = 100;
2554
+ const InputRange = JSX((props) => {
2555
+ const { className, title, items = [], list = [], min = list.length ? 0 : DEFAULT_MIN, max = list.length ? list.length - 1 : DEFAULT_MAX, step = 1, value = list[0] || min, disabled = false, onChange, } = props;
2556
+ const normalizedProps = useNormalizedInput(props, {
2557
+ normalize: (_ = 0) => list.length ? closestValue(list)(_) : clamp(_, min, max),
2558
+ format: toLocalNumberFormat(),
2559
+ });
2560
+ const handleChange = useCallback((ev) => {
2561
+ onChange && onChange(parseDecimal(ev.target?.value));
2562
+ }, [onChange]);
2563
+ return (jsxs("div", { className: className, children: [jsxs("label", { className: "block relative", children: [title ? (jsx(Text, { size: "text-m", font: "font-light", color: "text-primary-text", children: title })) : null, jsx("input", { className: style('text-h3 w-full h-14', 'pl-m mt-xs box-border', 'text-primary-text', inputValidStyle, inputDisabledStyle), disabled: disabled, onChange: handleChange, ...normalizedProps }), renderRangeWithTicks({ list, min, max, step, disabled, value, onChange })] }), renderRangeCaption(items)] }));
2412
2564
  });
2565
+ const closestValue = (list) => (_) => list.reduce((prev, curr) => (Math.abs(curr - _) < Math.abs(prev - _) ? curr : prev));
2566
+ const renderRangeCaption = (items) => (jsx("div", { className: "flex justify-between my-xs", children: items.map((item, i) => (jsx(Text, { size: "text-s", font: "font-light", color: "text-secondary-text", children: item }, String(i)))) }));
2413
2567
 
2414
- const SERVICE_TYPES = [
2415
- { key: 'ULTRASERVICE', text: 'Ультра' },
2416
- { key: 'PREMIUMSERVICE', text: 'Премиум' },
2417
- ];
2418
- const SERVICE_DIRECTIONS = [
2419
- { key: 'Физическое лицо' },
2420
- { key: 'Юридическое лицо / ИП' },
2421
- ];
2422
- const FEEDBACK_METHOD = [
2423
- { key: 'phone', text: 'Телефонный звонок' },
2424
- { key: 'email', text: 'Электронное сообщение' },
2425
- ];
2426
-
2427
- const FeedbackMethodField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u043E\u0442\u0432\u0435\u0442\u0430", options: FEEDBACK_METHOD, ...getValidation(field('feedbackMethod'), validatorObj.feedbackMethod, input?.required) })));
2428
-
2429
- const FullNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0418\u041E", ...getValidation(field('fullName'), validatorObj.fullName, input?.required), ...input })));
2430
-
2431
- const GeneralSeniorityField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u0449\u0438\u0439 \u0441\u0442\u0430\u0436", type: "number", maxLength: 2, placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043B\u0435\u0442", ...getValidation(field('generalSeniority'), validatorObj.generalSeniority, input?.required), ...input })));
2568
+ const MIN_CREDIT_AMOUNT = 1000;
2569
+ const MAX_CREDIT_AMOUNT = 1000000000;
2570
+ const ITEMS_CREDIT_AMOUNT = ['От 1 000 ₽', 'До 1 000 000 000 ₽'];
2571
+ const AmountField = JSX(({ field }) => (jsx(InputRange, { title: "\u0421\u0443\u043C\u043C\u0430, \u20BD", items: ITEMS_CREDIT_AMOUNT, min: MIN_CREDIT_AMOUNT, max: MAX_CREDIT_AMOUNT, ...field('amount') })));
2432
2572
 
2433
- const HousingField = JSX(({ field, input }) => {
2434
- const { data: housing } = useLeadFormData('HOUSE_TYPE');
2435
- return (jsx(SelectField, { field: field, source: housing, label: "\u0422\u0438\u043F \u0436\u0438\u043B\u044C\u044F", fieldName: "housing", input: input }));
2573
+ const SelectField = UniBlock(({ field, source, label, fieldName, input, placeholder = 'Выберите из списка', isSearch = false, }) => {
2574
+ const leadOptions = (source &&
2575
+ source?.map((_) => ({
2576
+ key: _.key || '',
2577
+ text: _.value,
2578
+ }))) ||
2579
+ [];
2580
+ return (jsx(SelectControl, { placeholder: placeholder, label: label, options: leadOptions, isSearch: isSearch, ...getValidation(field(fieldName), validatorObj[fieldName], input?.required) }));
2436
2581
  });
2437
2582
 
2438
- const InnField = JSX(({ field, input }) => {
2439
- const onDaDataChange = useCallback((item) => {
2440
- field?.('organizationName')?.onChange?.(item.data?.name?.short_with_opf);
2441
- field?.('legalForm')?.onChange?.(item.data?.opf?.short);
2442
- }, []);
2443
- return (jsx(InputControl, { label: "\u0418\u041D\u041D", type: "number", maxLength: 12, ...input, ...getValidation(field('inn'), validatorObj.inn, input?.required), onDaDataChange: onDaDataChange }));
2583
+ const AmountWorkersField = JSX(({ field, input }) => {
2584
+ const { data: amountWorkers } = useLeadFormData('EMPLOYEES_NUMBER');
2585
+ return (jsx(SelectField, { field: field, source: amountWorkers, label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0440\u0430\u0431\u043E\u0442\u0430\u044E\u0449\u0438\u0445 \u0432 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", fieldName: "amountWorkers", input: input }));
2444
2586
  });
2445
2587
 
2446
- const IsClientField = JSX(({ field }) => (jsx(CheckboxWithError, { ...field('isClient'), text: '\u042F\u0432\u043B\u044F\u044E\u0441\u044C \u043A\u043B\u0438\u0435\u043D\u0442\u043E\u043C \u0431\u0430\u043D\u043A\u0430 \u0410\u041E "\u0420\u043E\u0441\u0441\u0435\u043B\u044C\u0445\u043E\u0437\u0431\u0430\u043D\u043A"' })));
2447
-
2448
- const JobsNumberField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043C\u0435\u0441\u0442 \u0440\u0430\u0431\u043E\u0442\u044B \u0437\u0430 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 5 \u043B\u0435\u0442", placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043C\u0435\u0441\u0442", type: "number", maxLength: 2, ...getValidation(field('jobsNumber'), validatorObj.jobsNumber, input?.required), ...input })));
2588
+ const AnnualRevenueField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0413\u043E\u0434\u043E\u0432\u0430\u044F \u0432\u044B\u0440\u0443\u0447\u043A\u0430, \u20BD", ...getValidation(field('annualRevenue'), validatorObj.annualRevenue, input?.required) })));
2449
2589
 
2450
- const LastJobExperienceField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u0442\u0430\u0436 \u043D\u0430 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0435\u043C \u0440\u0430\u0431\u043E\u0447\u0435\u043C \u043C\u0435\u0441\u0442\u0435", placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043B\u0435\u0442", type: "number", maxLength: 2, ...getValidation(field('lastJobExperience'), validatorObj.lastJobExperience, input?.required), ...input })));
2590
+ const ArmyIdFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u041D\u0430\u043B\u0438\u0447\u0438\u0435 \u0432\u043E\u0435\u043D\u043D\u043E\u0433\u043E \u0431\u0438\u043B\u0435\u0442\u0430", ...getValidation(field('armyIdFlg'), validatorObj.armyIdFlg, input?.required) })));
2451
2591
 
2452
- const LegalEntityNameField = JSX(({ field, input }) => {
2453
- return (jsx(InputControl, { label: "\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043B\u0438\u0446\u0430", ...input, ...getValidation(field('legalEntityName'), validatorObj.legalEntityName, input?.required) }));
2454
- });
2592
+ const BankEmpoleeCodeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u0434 \u043F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043B\u044F \u0411\u0430\u043D\u043A\u0430", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u043A\u043E\u0434", type: "number", ...getValidation(field('bankEmployeeCode'), validatorObj.bankEmployeeCode, input?.required), ...input })));
2455
2593
 
2456
- const LegalFormField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u041F\u0424", placeholder: "\u041E\u041E\u041E, \u041F\u0410\u041E \u0438 \u0434\u0440.", ...getValidation(field('legalForm'), validatorObj.legalForm, input?.required), ...input })));
2594
+ const BankEmpoleeField = JSX(({ field }) => (jsx(InputControl, { label: "\u0424\u0418\u041E \u0438\u043B\u0438 \u0434\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C \u043E\u0431\u0441\u043B\u0443\u0436\u0438\u0432\u0430\u0432\u0448\u0435\u0433\u043E \u0412\u0430\u0441 \u0441\u043E\u0442\u0440\u0443\u0434\u043D\u0438\u043A\u0430 \u0411\u0430\u043D\u043A\u0430", ...field('bankEmpolee') })));
2457
2595
 
2458
- const OUT_SERVICE_BASE_URL = `${API_BASE_URI}/outservice`;
2459
- const EMPTY_REGIONS = [];
2460
- async function getOutServiceRegions() {
2461
- const data = await fetchJSON(`${OUT_SERVICE_BASE_URL}/outserviceregions`);
2462
- return data && Array.isArray(data) ? data : EMPTY_REGIONS;
2463
- }
2596
+ const BankruptcyFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u0412 \u043E\u0442\u043D\u043E\u0448\u0435\u043D\u0438\u0438 \u043C\u0435\u043D\u044F \u0432\u0435\u0434\u0451\u0442\u0441\u044F \u043F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u0441\u0442\u0432\u043E \u043F\u043E \u0434\u0435\u043B\u0443 \u043E \u0431\u0430\u043D\u043A\u0440\u043E\u0442\u0441\u0442\u0432\u0435", ...getValidation(field('bankruptcyFlg'), validatorObj.bankruptcyFlg, input?.required) })));
2464
2597
 
2465
- const LocalitiesField = JSX(({ field, input }) => {
2466
- const fieldRegion = field('region');
2467
- const regionKey = fieldRegion?.value?.key;
2468
- const { data: regions } = useAsyncData('outServiceRegions', getOutServiceRegions);
2469
- const localities = regions
2470
- ?.find((_) => _.code === regionKey)
2471
- ?.localities?.map((_) => ({ key: _, text: _ }));
2598
+ const useElementSpace = (ref, heightEl) => {
2599
+ const [spaceAbove, setSpaceAbove] = useState(false);
2472
2600
  useEffect(() => {
2473
- if (regionKey !== '') {
2474
- field?.('localities')?.onChange?.('');
2475
- }
2476
- }, [regionKey]);
2477
- return (jsx(SelectControl, { label: "\u041D\u0430\u0441\u0435\u043B\u0435\u043D\u043D\u044B\u0439 \u043F\u0443\u043D\u043A\u0442", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0433\u043E\u0440\u043E\u0434, \u0433\u0434\u0435 \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0441\u0435\u0440\u0432\u0438\u0441", options: localities, ...getValidation(field('localities'), validatorObj.localities, input?.required), isSearch: true }));
2478
- });
2479
-
2480
- const MandatoryIncomeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u043E\u0432\u043E\u043A\u0443\u043F\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('mandatoryIncome'), validatorObj.mandatoryIncome, input?.required), ...input })));
2481
-
2482
- const METHODS_OF_OBTAIN = [
2483
- { id: 'office', text: 'В отделении Банка' },
2484
- { id: 'courier', text: 'Курьерская доставка' },
2485
- ];
2486
- const MethodObtainField = JSX(({ field, input }) => (jsx(RadioButtonGroupControl, { orientation: "horizontal", items: METHODS_OF_OBTAIN, ...getValidation(field('methodObtain'), validatorObj.methodObtain, input?.required) })));
2487
-
2488
- const FIELD_NAME$1 = 'middleName';
2489
- const MiddleNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E (\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E, \u043F\u0440\u0438 \u043D\u0430\u043B\u0438\u0447\u0438\u0438)", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$1), ...getValidation(field(FIELD_NAME$1), validatorObj.middleName, input?.required), ...input })));
2490
-
2491
- const NameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0418\u043C\u044F", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, input.name ?? ''), ...getValidation(field('name'), validatorObj.name, input?.required), ...input })));
2492
-
2493
- const SlideCheckbox = JSX(({ value = false, text, type = 'checkbox', onChange }) => (jsxs("div", { role: type, "aria-checked": value, className: "flex justify-start items-center w-full cursor-pointer mb-s", onClick: () => onChange && onChange(!value), children: [jsx("div", { className: style('relative flex-shrink-0 duration-300 w-9 h-5 mr-s rounded-2xl', value ? 'bg-primary-main' : 'bg-main-divider'), children: jsx("div", { className: style('absolute opacity-80 duration-500 top-0.5 w-4 h-4 bg-white rounded-full', value ? 'left-1/2' : 'left-[5%]') }) }), text ? (jsx(Text, { size: "text-l", font: "font-light", color: "text-primary-text", children: text })) : null] })));
2494
-
2495
- const OnlineCheckoutField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 \u043E\u043D\u043B\u0430\u0439\u043D-\u043A\u0430\u0441\u0441\u0443", ...field('onlineCheckout') })) : null);
2601
+ const handleResize = () => {
2602
+ if (ref?.current) {
2603
+ const { top } = ref.current.getBoundingClientRect();
2604
+ const hasSpaceAbove = top > heightEl;
2605
+ setSpaceAbove(hasSpaceAbove);
2606
+ }
2607
+ };
2608
+ handleResize();
2609
+ window.addEventListener('resize', handleResize);
2610
+ return () => window.removeEventListener('resize', handleResize);
2611
+ }, [ref]);
2612
+ return spaceAbove;
2613
+ };
2496
2614
 
2497
- const OrganizationField = JSX(({ field, input }) => {
2498
- const { data: organization } = useLeadFormData('ORGANIZATION_TYPE');
2499
- return (jsx(SelectField, { field: field, source: organization, label: "\u0422\u0438\u043F \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", fieldName: "organization", input: input }));
2500
- });
2615
+ const DAY_COUNT = 6;
2616
+ const WEEK_COUNT = 7;
2617
+ const renderCalendarCells = ({ today, firstDayOfWeek, totalDays, currentMonth, currentYear, min, max, onDateClick, }) => {
2618
+ const calendarCells = [];
2619
+ let dayCounter = 1;
2620
+ for (let i = 0; i < DAY_COUNT; i++) {
2621
+ const rowCells = [];
2622
+ for (let j = 0; j < WEEK_COUNT; j++) {
2623
+ if (i === 0 && j < firstDayOfWeek) {
2624
+ rowCells.push(jsx("td", {}, `empty-${j}`));
2625
+ }
2626
+ else if (dayCounter > totalDays) {
2627
+ rowCells.push(jsx("td", {}, `empty-${j}`));
2628
+ }
2629
+ else {
2630
+ const currentDate = new Date(currentYear, currentMonth, dayCounter);
2631
+ const isToday = checkIsToday(currentDate, today);
2632
+ const isDisabled = checkIsDisabled(currentDate, min, max);
2633
+ rowCells.push(jsx("td", { children: jsx("div", { className: getDayStyles(isToday, isDisabled), onClick: () => !isDisabled && onDateClick(currentDate), children: dayCounter }) }, `day-${dayCounter}`));
2634
+ dayCounter++;
2635
+ }
2636
+ }
2637
+ calendarCells.push(jsx("tr", { children: rowCells }, `row-${i}`));
2638
+ }
2639
+ return calendarCells;
2640
+ };
2641
+ const checkIsToday = (currentDate, today) => today && currentDate.toDateString() === today.toDateString();
2642
+ const checkIsDisabled = (currentDate, min, max) => (min && currentDate.getTime() < min.getTime()) || (max && currentDate.getTime() > max.getTime());
2643
+ const getDayStyles = (isToday = false, isDisabled = false) => style('p-s text-center rounded-md border', {
2644
+ 'border-transparent hover:bg-gray': !isToday,
2645
+ }, isDisabled ? 'text-gray hover:bg-transparent' : 'cursor-pointer');
2501
2646
 
2502
- const OrganizationNameField = JSX(({ field, input }) => {
2503
- const onDaDataChange = useCallback((item) => {
2504
- field?.('inn')?.onChange?.(item.data?.inn);
2505
- field?.('legalForm')?.onChange?.(item.data?.opf?.short);
2647
+ const WEEK_DAYS = ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'];
2648
+ const Calendar = JSX(({ today, currentMonth, currentYear, min, max, onDateSelect = noop, setValue = noop }) => {
2649
+ const handleDateClick = useCallback((date) => {
2650
+ onDateSelect(date);
2651
+ setValue(false);
2506
2652
  }, []);
2507
- return (jsx(InputControl, { label: "\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", ...input, ...getValidation(field('organizationName'), validatorObj.organizationName, input?.required), onDaDataChange: onDaDataChange }));
2508
- });
2509
-
2510
- const OtherIncomeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0418\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('otherIncome'), validatorObj.otherIncome, input?.required), ...input })));
2511
-
2512
- const OtherPaymentsField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0432\u044B\u043F\u043B\u0430\u0442\u044B", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", ...getValidation(field('otherPayments'), validatorObj.otherPayments, input?.required), ...input })));
2513
-
2514
- const ParticipantDateRegistrationField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043F\u043E \u043C\u0435\u0441\u0442\u0443 \u0436\u0438\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u0430", ...getValidation(field('participantDateRegistration'), validatorObj.participantDateRegistration, input?.required) })));
2515
-
2516
- const MAX_PART = 100;
2517
- const PartInBusinessField = JSX(({ field, input }) => {
2518
- const isBusinessOwner = field('positionOrganization')?.value?.key === 'BUSINESS_OWNER';
2519
- const partInBusinessField = {
2520
- ...getValidation(field('partInBusiness'), validatorObj.partInBusiness, input?.required),
2521
- };
2522
- const handleChange = (value) => partInBusinessField?.onChange &&
2523
- partInBusinessField?.onChange(String(Number(value) > MAX_PART ? MAX_PART : Number(value) || ''));
2524
- return (jsx(InputControl, { label: "\u0414\u043E\u043B\u044F \u0443\u0447\u0430\u0441\u0442\u0438\u044F \u0432 \u0431\u0438\u0437\u043D\u0435\u0441\u0435", placeholder: "\u0432 %", type: "number", maxLength: 3, ...partInBusinessField, ...input, onChange: handleChange, value: isBusinessOwner ? partInBusinessField?.value : '', disabled: !isBusinessOwner }));
2525
- });
2526
-
2527
- const PartnerCommentsField = JSX(({ field, input }) => {
2528
- const { required, ...rest } = input;
2529
- return (jsx(InputControl, { ...getValidation(field('partnerComments'), validatorObj.partnerComments, required), placeholder: "\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0438\u043D\u0442\u0435\u0440\u0435\u0441\u0443\u044E\u0449\u0438\u0439 \u0432\u0430\u0441 \u0432\u043E\u043F\u0440\u043E\u0441", isTextarea: true, ...rest }));
2653
+ const { firstDayOfWeek, totalDays } = useMemo(() => ({
2654
+ firstDayOfWeek: new Date(currentYear, currentMonth, 1).getDay() - 1,
2655
+ totalDays: new Date(currentYear, currentMonth + 1, 0).getDate(),
2656
+ }), [currentYear, currentMonth]);
2657
+ return (jsxs("table", { className: "mx-auto", children: [jsx("thead", { className: "text-gray font-light", children: jsx("tr", { children: WEEK_DAYS.map((day, index) => (jsx("th", { className: "p-s", children: day }, String(index)))) }) }), jsx("tbody", { children: renderCalendarCells({
2658
+ firstDayOfWeek,
2659
+ today,
2660
+ totalDays,
2661
+ currentYear,
2662
+ currentMonth,
2663
+ min,
2664
+ max,
2665
+ onDateClick: handleDateClick,
2666
+ }) })] }));
2530
2667
  });
2531
2668
 
2532
- const PAYMENT_SYSTEM_TYPES = [
2533
- { id: 'mir', text: 'Карта МИР' },
2534
- { id: 'union_pay', text: 'UnionPay' },
2669
+ const months = [
2670
+ 'Январь',
2671
+ 'Февраль',
2672
+ 'Март',
2673
+ 'Апрель',
2674
+ 'Май',
2675
+ 'Июнь',
2676
+ 'Июль',
2677
+ 'Август',
2678
+ 'Сентябрь',
2679
+ 'Октябрь',
2680
+ 'Ноябрь',
2681
+ 'Декабрь',
2535
2682
  ];
2536
- const PaymentSystemField = JSX(({ field, input }) => {
2537
- const { value, onChange } = field('paymentSystem');
2538
- return (jsx(RadioButtonGroupControl, { label: "\u041F\u043B\u0430\u0442\u0435\u0436\u043D\u0430\u044F \u0441\u0438\u0441\u0442\u0435\u043C\u0430", orientation: "horizontal", items: PAYMENT_SYSTEM_TYPES, value: value, onChange: (_) => onChange?.(_), ...getValidation(field('paymentSystem'), validatorObj.paymentSystem, input?.required) }));
2539
- });
2540
-
2541
- const isPlaceholder = (_) => _ === '_';
2542
- const isDigit = (_) => /\d/.test(_);
2543
- const isWildcard = (_) => isPlaceholder(_) || isDigit(_);
2544
- const phonePattern = [...'+7 (___) ___-__-__'];
2545
- const firstPlaceholderIndex = phonePattern.findIndex(isPlaceholder);
2546
- const phoneWildcardIndicies = phonePattern.map((_, i) => isWildcard(_) ? phonePattern.slice(0, i).filter(isWildcard).length : -1);
2547
- function normalizePhone(phone) {
2548
- const phoneNumbers = phone.replace(/\D/g, '');
2549
- const applyPlaceholder = (_, i) => isDigit(_) ? _ : phoneNumbers.charAt(phoneWildcardIndicies[i]) || _;
2550
- const result = phonePattern.map(applyPlaceholder);
2551
- const resultLength = phoneWildcardIndicies.indexOf(phoneNumbers.length - 1) + 1;
2552
- return (resultLength ? result.slice(0, Math.max(firstPlaceholderIndex, resultLength)) : result).join('');
2553
- }
2554
-
2555
- const PhoneInput = JSX(({ children, onChange, ...inputProps }) => {
2556
- const handleChange = useCallback((v) => onChange && onChange(normalizePhone(v)), [onChange]);
2557
- const handleBlur = useCallback((v) => {
2558
- if (v === '+7 (') {
2559
- onChange && onChange('');
2560
- }
2561
- }, []);
2562
- return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
2563
- });
2564
-
2565
- const InputPhoneControl = JSX(({ className, label, error, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(PhoneInput, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), placeholder: "+7 (___) ___-__-__", ...rest }), renderErrorText(error)] })));
2566
-
2567
- const PhoneField = JSX(({ field, input }) => {
2568
- const fieldName = input?.name || 'phone';
2569
- return (jsx(InputPhoneControl, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D", ...getValidation(field(fieldName), validatorObj.phone, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, fieldName), ...input }));
2570
- });
2571
-
2572
- const PositionOrganizationField = JSX(({ field, input }) => {
2573
- const { data: positionOrganization } = useLeadFormData('POSITION');
2574
- return (jsx(SelectField, { field: field, source: positionOrganization, label: "\u0414\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C \u0432 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", fieldName: "positionOrganization", input: input }));
2575
- });
2576
-
2577
- const PosTerminalField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 POS-\u0442\u0435\u0440\u043C\u0438\u043D\u0430\u043B", ...field('posTerminal') })) : null);
2578
-
2579
- const ProductField = UniBlock(({ field, source }) => (jsx(SelectControl, { placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043F\u0440\u043E\u0434\u0443\u043A\u0442", label: "\u041F\u0440\u043E\u0434\u0443\u043A\u0442", options: arrayToOptions(source?.productList), ...withValidator(field('product'), validatorObj.product) })));
2580
- const arrayToOptions = (array) => (array ?? []).map((_) => ({ key: _, value: _ }));
2581
2683
 
2582
- const REGIONS_URL = `${API_BASE_URI}/regions`;
2583
- function useRegions(url = REGIONS_URL) {
2584
- const { data } = useAsyncData(url, fetchJSONUnsafe);
2585
- return Array.isArray(data) ? data : [];
2684
+ function normalizeWithMask(value, pattern) {
2685
+ const valueNumbers = value.replace(/\D/g, '');
2686
+ if (valueNumbers === '' || value?.length === pattern.length) {
2687
+ return value;
2688
+ }
2689
+ const patternInArr = [...pattern];
2690
+ const firstPlaceholderIndex = patternInArr.findIndex(isPlaceholder$1);
2691
+ const valueWildcardIndicies = patternInArr.map((_, i) => isWildcard$1(_) ? patternInArr.slice(0, i).filter(isWildcard$1).length : -1);
2692
+ const applyPlaceholder = (_, i) => isDigit$1(_) ? _ : valueNumbers.charAt(valueWildcardIndicies[i]) || _;
2693
+ const resultInArr = patternInArr.map(applyPlaceholder);
2694
+ const resultLength = valueWildcardIndicies.indexOf(valueNumbers.length - 1) + 1;
2695
+ return resultInArr.slice(0, Math.max(firstPlaceholderIndex, resultLength)).join('');
2586
2696
  }
2697
+ const isPlaceholder$1 = (_) => _ === '_';
2698
+ const isDigit$1 = (_) => /\d/.test(_);
2699
+ const isWildcard$1 = (_) => isPlaceholder$1(_) || isDigit$1(_);
2587
2700
 
2588
- const RegionField = JSX(({ field, input, url }) => {
2589
- const regions = useRegions(url);
2590
- return (jsx(SelectControl, { label: "\u0424\u0438\u043B\u0438\u0430\u043B", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0438\u043B\u0438\u0430\u043B", isSearch: true, options: useMemo(() => regions?.map(({ code = '', name = '' }) => ({ key: code, text: name })), [regions]), ...getValidation(field('region'), validatorObj.region, input?.required) }));
2591
- });
2592
-
2593
- const RegionPremiumField = JSX(({ field, input }) => {
2594
- const branchByRegions = useBranchesByRegions(true);
2595
- const regions = useMemo(() => branchByRegions?.map(({ region }) => ({
2596
- key: region,
2597
- text: region,
2598
- })), [branchByRegions]);
2599
- 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) }));
2600
- });
2601
-
2602
- const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
2603
- const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
2604
- const onToggle = useCallback(() => {
2605
- setIsUnfolded((_) => !_);
2606
- }, []);
2607
- const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
2608
- const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
2609
- return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
2610
- });
2701
+ const START_YEAR = 1940;
2702
+ const getYears = () => Array.from({ length: new Date().getFullYear() - START_YEAR + 1 }, (_, i) => START_YEAR + i);
2611
2703
 
2612
- function useResizeObserver(callback, deps) {
2704
+ const ICON_PROPS$1 = {
2705
+ name: 'CalendarIcon',
2706
+ iconVersion: 'black',
2707
+ width: '24',
2708
+ height: '24',
2709
+ };
2710
+ const DatePickerInput = JSX(({ setSelectedMonth, setSelectedYear, className, value, disabled, onChange, onClick }) => {
2613
2711
  const ref = useRef(null);
2614
- useEffect(() => {
2615
- const element = ref?.current;
2616
- if (!element) {
2617
- return undefined;
2712
+ const [inputValue, setInputValue] = useState(value || '');
2713
+ const handleChange = (ev) => {
2714
+ const val = ev.target?.value;
2715
+ if (typeof val === 'string' && val?.length < 11) {
2716
+ setInputValue(normalizeWithMask(val, '__.__.____'));
2618
2717
  }
2619
- const observer = new ResizeObserver((entries) => {
2620
- callback(element, entries[0]);
2621
- });
2622
- observer.observe(element);
2623
- return () => {
2624
- observer.disconnect();
2625
- };
2626
- }, [callback, ...deps]);
2627
- return ref;
2628
- }
2629
-
2630
- const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
2631
- const containerRef = useRef(null);
2632
- const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
2633
- if (containerRef.current) {
2634
- containerRef.current.style.maxHeight = isUnfolded
2635
- ? `${childrenWrapperEl.scrollHeight}px`
2636
- : '';
2718
+ };
2719
+ const onBlur = () => {
2720
+ if (checkIsValidDate(inputValue)) {
2721
+ const [day, month, year] = inputValue.split('.');
2722
+ onChange?.(new Date(Number(year), Number(month) - 1, Number(day)));
2723
+ setSelectedMonth(Number(month) - 1);
2724
+ setSelectedYear(Number(year));
2637
2725
  }
2638
- }, [isUnfolded]);
2639
- 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 }) }));
2640
- });
2641
-
2642
- const CardCell = JSX(({ value, subText, children, isPhone, ...props }) => {
2643
- const textItems = (Array.isArray(value) ? value : value?.split(',') ?? []).filter(Boolean);
2644
- if ([textItems.length, children, subText].every((_) => !_)) {
2645
- return null;
2646
- }
2647
- return renderCardCell({ textItems, subText, children, isPhone, ...props });
2726
+ else {
2727
+ setInputValue(value || '');
2728
+ }
2729
+ };
2730
+ const onInputClick = () => {
2731
+ if (ref.current !== null) {
2732
+ ref.current.focus();
2733
+ }
2734
+ onClick?.();
2735
+ };
2736
+ useEffect(() => {
2737
+ setInputValue(value || '');
2738
+ }, [value]);
2739
+ return (jsxs("div", { onClick: onInputClick, className: style('relative', className), children: [jsx("input", { ref: ref, className: "h-full w-full px-m text-l text-black focus-visible:outline-none", value: inputValue, type: "text", onChange: handleChange, onBlur: onBlur, disabled: disabled }), disabled ? null : jsx(Icon, { className: "mr-s", ...ICON_PROPS$1 })] }));
2648
2740
  });
2649
- 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] }));
2650
- 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))));
2651
- const cleanPhoneNumber = (phone) => phone.replace(/\D/g, '');
2741
+ const isValidYear = (year) => Number(year) >= START_YEAR && Number(year) <= new Date().getFullYear();
2742
+ const isValidMonth = (month) => Number(month) > 0 && Number(month) < 13;
2743
+ const checkIsValidDate = (date) => {
2744
+ const [day, month, year] = date.split('.');
2745
+ if (isValidYear(year)) {
2746
+ if (isValidMonth(month)) {
2747
+ const currentDate = new Date(Number(year), Number(month) - 1, 1);
2748
+ let maxDateOfMonth = 0;
2749
+ while (currentDate.getMonth() === Number(month) - 1) {
2750
+ currentDate.setDate(currentDate.getDate() + 1);
2751
+ maxDateOfMonth++;
2752
+ }
2753
+ if (Number(day) > 0 && Number(day) <= maxDateOfMonth) {
2754
+ return true;
2755
+ }
2756
+ }
2757
+ }
2758
+ return false;
2759
+ };
2652
2760
 
2653
- 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 })));
2761
+ const formStyle = 'flex justify-between items-center h-14 border rounded-md cursor-pointer ' +
2762
+ 'hover:border-black active:border-black focus:border-black';
2763
+ const renderDatePickerForm = ({ handleChangeVisibleCalendar, value, valid, onChange, setSelectedMonth, setSelectedYear, disabled = false, }) => (jsx(DatePickerInput, { onChange: onChange, disabled: disabled, onClick: handleChangeVisibleCalendar, value: value && formatDate(value), setSelectedMonth: setSelectedMonth, setSelectedYear: setSelectedYear, className: style(formStyle, valid ? 'border-gray' : 'border-error') }));
2654
2764
 
2655
- const getScheduleDescription = (workScheduleWeek) => {
2656
- const rows = getDateDescription(workScheduleWeek);
2657
- return jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", value: rows, className: "max-w-none" });
2765
+ const MONTHS_COUNT = 11;
2766
+ const MONTHS_OPTIONS = months.map((key) => ({ key }));
2767
+ const YEARS_OPTIONS = getYears()
2768
+ .reverse()
2769
+ .map((key) => ({ key: String(key) }));
2770
+ const useDatePickerManager = ({ onShowCalendar, showCalendar, selectedMonth, onMonthSelect, onYearSelect, selectedYear, onChange, value, }) => {
2771
+ const close = useCallback(() => showCalendar && onShowCalendar(false), [showCalendar]);
2772
+ const ref = useOutsideClick(close);
2773
+ const handleChangeVisibleCalendar = useCallback(() => onShowCalendar(!showCalendar), [showCalendar]);
2774
+ const handleNextMonth = useCallback(() => {
2775
+ if (selectedMonth + 1 <= MONTHS_COUNT) {
2776
+ onMonthSelect(selectedMonth + 1);
2777
+ }
2778
+ else {
2779
+ onMonthSelect(0);
2780
+ onYearSelect(selectedYear + 1);
2781
+ }
2782
+ }, [selectedMonth]);
2783
+ const handlePrevMonth = useCallback(() => {
2784
+ if (selectedMonth - 1 >= 0) {
2785
+ onMonthSelect(selectedMonth - 1);
2786
+ }
2787
+ else {
2788
+ onMonthSelect(11);
2789
+ onYearSelect(selectedYear - 1);
2790
+ }
2791
+ }, [selectedMonth]);
2792
+ const handleSelectMonth = useCallback(({ key }) => {
2793
+ onMonthSelect(months.indexOf(key));
2794
+ const maxDateOfMonth = calculateMaxDaysOfMonth(selectedYear, months.indexOf(key));
2795
+ handleChangeMonth({
2796
+ maxDateOfMonth,
2797
+ selectedYear,
2798
+ selectedMonth: months.indexOf(key),
2799
+ value,
2800
+ onChange,
2801
+ });
2802
+ }, [value]);
2803
+ const handleSelectYear = useCallback(({ key }) => {
2804
+ onYearSelect(Number(key));
2805
+ value && onChange?.(new Date(Number(key), selectedMonth, value?.getDate()));
2806
+ }, [value]);
2807
+ return {
2808
+ handleChangeVisibleCalendar,
2809
+ handleNextMonth,
2810
+ handlePrevMonth,
2811
+ handleSelectMonth,
2812
+ handleSelectYear,
2813
+ monthsOptions: MONTHS_OPTIONS,
2814
+ yearsOptions: YEARS_OPTIONS,
2815
+ ref,
2816
+ };
2658
2817
  };
2659
- const buildScheduleText = ({ workTime = '', lunchHour = '', daysOff = '' }, isSaturday = false) => {
2660
- if (!workTime) {
2661
- return '';
2818
+ const calculateMaxDaysOfMonth = (selectedYear, selectedMonth) => {
2819
+ const date = new Date(selectedYear, selectedMonth, 1);
2820
+ let maxDateOfMonth = 0;
2821
+ while (date.getMonth() === selectedMonth) {
2822
+ maxDateOfMonth++;
2823
+ date.setDate(date.getDate() + 1);
2662
2824
  }
2663
- return [
2664
- `${isSaturday ? 'Суббота' : 'Будние дни'}: ${workTime}`,
2665
- lunchHour ? `перерыв: ${lunchHour}` : '',
2666
- daysOff ? `не работает: ${daysOff}` : '',
2667
- ]
2668
- .filter(Boolean)
2669
- .join('; ');
2825
+ return maxDateOfMonth;
2670
2826
  };
2671
- const getDateDescription = (workScheduleWeek) => {
2672
- const workingWeekday = workScheduleWeek.find((_) => _.key !== 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
2673
- const workingSaturday = workScheduleWeek.find((_) => _.key === 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
2674
- const daysOff = workScheduleWeek
2675
- .filter((_) => !_.status)
2676
- .map((_) => _.short?.toLowerCase())
2677
- .join(', ');
2678
- const rows = [
2679
- buildScheduleText({
2680
- workTime: workingWeekday?.workTime,
2681
- lunchHour: workingWeekday?.lunchHour,
2682
- daysOff: workingSaturday ? '' : daysOff,
2683
- }),
2684
- buildScheduleText({ workTime: workingSaturday?.workTime, lunchHour: workingSaturday?.lunchHour, daysOff }, true),
2685
- ].filter(Boolean);
2686
- return rows;
2827
+ const handleChangeMonth = ({ maxDateOfMonth, selectedYear, selectedMonth, value, onChange, }) => {
2828
+ value &&
2829
+ onChange?.(new Date(selectedYear, selectedMonth, Math.min(maxDateOfMonth, value.getDate())));
2687
2830
  };
2688
2831
 
2689
- const WEEKDAY_MAP = [
2690
- ['workingMonday', 'Пн', 'Понедельник'],
2691
- ['workingTuesday', 'Вт', 'Вторник'],
2692
- ['workingWednesday', 'Ср', 'Среда'],
2693
- ['workingThursday', 'Чт', 'Четверг'],
2694
- ['workingFriday', 'Пт', 'Пятница'],
2695
- ['workingSaturday', 'Сб', 'Суббота'],
2696
- ['workingSunday', 'Вс', 'Воскресенье'],
2697
- ];
2698
- const getWorkScheduleWeek = (workSchedule) => WEEKDAY_MAP.map(([key, short, title]) => ({
2699
- key,
2700
- title,
2701
- short,
2702
- status: Boolean(workSchedule?.[key]),
2703
- get workTime() {
2704
- return key === 'workingSaturday' ? workSchedule?.workTimeSaturday : workSchedule?.workTime;
2705
- },
2706
- get lunchHour() {
2707
- return key === 'workingSaturday' ? workSchedule?.lunchHourSaturday : workSchedule?.lunchHour;
2708
- },
2709
- get hasLunch() {
2710
- return /\d+/.test(this.lunchHour ?? '');
2711
- },
2712
- }));
2713
-
2714
- const renderBusinessSchedule = (scheduleDescription) => {
2715
- if (!scheduleDescription) {
2716
- return null;
2717
- }
2718
- const businessSchedule = getBusinessSchedule(scheduleDescription);
2719
- 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 }) })] }));
2832
+ const ICON_PROPS = {
2833
+ name: 'ArrowUpIcon',
2834
+ iconVersion: 'black',
2835
+ width: '24',
2836
+ height: '24',
2720
2837
  };
2721
- const getBusinessSchedule = (scheduleDescription) => {
2722
- const weekDayMap = WEEKDAY_MAP.map(([, short]) => ({ short, status: true }));
2723
- const splittedScheduleDescription = scheduleDescription.split('/') ?? [];
2724
- const lastPartScheduleDescription = splittedScheduleDescription[splittedScheduleDescription.length - 1]?.toLowerCase();
2725
- if (!lastPartScheduleDescription?.includes('выходной')) {
2726
- return weekDayMap;
2727
- }
2728
- return weekDayMap.map((_) => ({
2729
- ..._,
2730
- status: !lastPartScheduleDescription?.includes(_.short.toLowerCase()),
2731
- }));
2838
+ const SELECT_PROPS = {
2839
+ className: 'min-w-32',
2840
+ iconVersion: 'black',
2841
+ isBorder: false,
2732
2842
  };
2733
- 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)));
2843
+ const DatePicker = JSX(
2844
+ // eslint-disable-next-line max-lines-per-function
2845
+ ({ className = '', label = '', value, valid = true, minDate, maxDate, disabled, onChange }) => {
2846
+ const [showCalendar, { setValue }] = useBool(false);
2847
+ const [selectedMonth, setSelectedMonth] = useState(value?.getMonth() || new Date().getMonth());
2848
+ const [selectedYear, setSelectedYear] = useState(value?.getFullYear() || new Date().getFullYear());
2849
+ const { handlePrevMonth, handleNextMonth, handleSelectMonth, handleSelectYear, monthsOptions, yearsOptions, handleChangeVisibleCalendar, ref, } = useDatePickerManager({
2850
+ onYearSelect: setSelectedYear,
2851
+ onMonthSelect: setSelectedMonth,
2852
+ onShowCalendar: setValue,
2853
+ selectedYear,
2854
+ selectedMonth,
2855
+ showCalendar,
2856
+ onChange,
2857
+ value,
2858
+ });
2859
+ const spaceAbove = useElementSpace(ref, 370);
2860
+ return (jsxs("div", { className: style('space-y-xs', className), ref: ref, children: [renderLabel(label), jsxs("div", { className: "relative", children: [renderDatePickerForm({
2861
+ handleChangeVisibleCalendar,
2862
+ value,
2863
+ valid,
2864
+ onChange,
2865
+ disabled,
2866
+ setSelectedMonth,
2867
+ setSelectedYear,
2868
+ }), showCalendar && !disabled ? (jsxs("div", { className: style('absolute bg-white z-20 select-none', {
2869
+ 'bottom-full': spaceAbove,
2870
+ }), children: [jsxs("div", { className: "flex gap-s", children: [jsx("div", { className: "my-auto", onClick: handlePrevMonth, children: jsx(Icon, { ...ICON_PROPS, className: "-rotate-90 cursor-pointer" }) }), jsx(Select, { onChange: handleSelectMonth, value: { key: months[selectedMonth] }, options: monthsOptions, ...SELECT_PROPS }), jsx(Select, { onChange: handleSelectYear, value: { key: String(selectedYear) }, options: yearsOptions, ...SELECT_PROPS }), jsx("div", { className: "my-auto", onClick: handleNextMonth, children: jsx(Icon, { ...ICON_PROPS, className: "rotate-90 cursor-pointer" }) })] }), jsx(Calendar, { today: value, currentMonth: selectedMonth, currentYear: selectedYear, onDateSelect: onChange, min: minDate, max: maxDate, setValue: setValue })] })) : null] })] }));
2871
+ });
2734
2872
 
2735
- 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)));
2873
+ const DatePickerControl = JSX(({ className, label, error, errors, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(DatePicker, { label: getRequiredLabel({ label, errors }), valid: Boolean(!error), ...rest }), renderErrorText(error)] })));
2736
2874
 
2737
- const colorStyle = {
2738
- yellow: { border: 'border-yellow-light', text: 'text-yellow' },
2739
- green: { border: 'border-green-more-light', text: 'text-green-dark' },
2740
- gray: { border: 'border-gray', text: 'text-secondary-text' },
2741
- red: { border: 'border-error/30', text: 'text-error' },
2742
- };
2743
- 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 })] })));
2875
+ const BeginDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u043D\u0430\u0447\u0430\u043B\u0430 \u0440\u0430\u0431\u043E\u0442\u044B \u043D\u0430 \u0442\u0435\u043A\u0443\u0449\u0435\u043C \u043C\u0435\u0441\u0442\u0435", ...getValidation(field('beginDate'), validatorObj.beginDate, input?.required), ...input })));
2744
2876
 
2745
- const currentWeekDayIdx = new Date().getDay();
2746
- //TODO: Add logic time https://github.com/redneckz/wildless-cms-uni-blocks/pull/1549
2747
- const renderCurrentDaySchedule = (workScheduleWeek) => {
2748
- const [currentWeekDay] = workScheduleWeek?.slice(currentWeekDayIdx - 1) ?? [];
2749
- if (!currentWeekDay) {
2750
- return null;
2877
+ const MIN_AGE = 23;
2878
+ const MAX_AGE = 75;
2879
+ const AGE_ERROR_MESSAGE = 'Допустимый возраст заёмщика - от 23 до 75 лет';
2880
+ const FIELD_NAME$8 = 'birthday';
2881
+ const BirthdayField = JSX(({ field, input, isRetailForm = false }) => {
2882
+ const { value } = field(FIELD_NAME$8);
2883
+ return (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field(FIELD_NAME$8), validatorObj.birthday, input?.required), error: isRetailForm && value && !birthdayValidate(value) ? AGE_ERROR_MESSAGE : '', disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$8) }));
2884
+ });
2885
+ const birthdayValidate = (date) => {
2886
+ const today = new Date();
2887
+ const minDate = new Date(today.getFullYear() - MIN_AGE, today.getMonth(), today.getDate());
2888
+ const maxDate = new Date(today.getFullYear() - MAX_AGE, today.getMonth(), today.getDate());
2889
+ if (!date || date > minDate || date < maxDate) {
2890
+ return false;
2751
2891
  }
2752
- const { lunchHour, status, workTime, hasLunch } = currentWeekDay;
2753
- 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" }));
2892
+ return true;
2754
2893
  };
2755
2894
 
2756
- const getSubTextLunch = ({ lunchHour, hasLunch = false, status = false }) => {
2757
- if (!status) {
2758
- return 'Не работает';
2759
- }
2760
- return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
2761
- };
2762
- 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)));
2895
+ const FIELD_NAME$7 = 'birthPlace';
2896
+ const BirthPlaceField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041C\u0435\u0441\u0442\u043E \u0440\u043E\u0436\u0434\u0435\u043D\u0438\u044F", ...getValidation(field('birthPlace'), validatorObj.birthPlace, input?.required), ...input, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$7) })));
2763
2897
 
2764
- const ICONS$1 = ['ArrowDownIcon', 'ArrowUpIcon'];
2765
- const labels = ['Подробнее', 'Скрыть'];
2766
- 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" })] }));
2898
+ const CardCategoryField = JSX(({ field, input }) => {
2899
+ const { data: cardCategory } = useLeadFormData('CARD_TYPE');
2900
+ return (jsx(SelectField, { field: field, source: cardCategory, label: "\u041A\u0430\u0442\u0435\u0433\u043E\u0440\u0438\u044F \u043A\u0430\u0440\u0442\u044B", fieldName: "cardCategory", input: input }));
2901
+ });
2767
2902
 
2768
- const renderWorkSchedule = (workSchedule) => {
2769
- const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2770
- const timeOfWork = workSchedule ? getDateDescription(workScheduleWeek) : '';
2771
- const businessTimeOfWork = workSchedule ? workSchedule.businessScheduleDescription : '';
2772
- if (!workSchedule) {
2773
- return null;
2774
- }
2775
- if (!workSchedule.businessScheduleVisibleTag) {
2776
- return renderMatchingTimeOfWork(timeOfWork);
2777
- }
2778
- if (workSchedule.businessScheduleVisibleTag &&
2779
- workSchedule.businessScheduleDescription === null) {
2780
- return renderIndividualTimeOfWork(timeOfWork);
2781
- }
2782
- return renderDefaultTimeOfWork(timeOfWork, businessTimeOfWork);
2783
- };
2784
- const renderIndividualTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p>`;
2785
- const renderMatchingTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ. и юр. лиц:<br/></b> ${timeOfWork}</p>`;
2786
- const renderDefaultTimeOfWork = (timeOfWork, businessTimeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${businessTimeOfWork}</p>`;
2903
+ const ChildrenField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0434\u0435\u0442\u0435\u0439 \u0434\u043E 18 \u043B\u0435\u0442", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", ...getValidation(field('children'), validatorObj.children, input?.required), ...input })));
2787
2904
 
2788
- const renderOfficeCard = ({ name, address, phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }, i) => {
2789
- if (!workSchedule) {
2790
- return null;
2791
- }
2792
- const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2793
- 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({
2794
- phone,
2795
- fax,
2796
- phoneBusiness,
2797
- phoneNatural,
2798
- phoneCallCentre,
2799
- phoneCurrencyControl,
2800
- workSchedule,
2801
- exchangeRate,
2802
- }) }), jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
2803
- return (jsx(FoldableSection, { isUnfolded: isUnfolded, children: renderCardContent$1({
2804
- phone,
2805
- fax,
2806
- phoneBusiness,
2807
- phoneNatural,
2808
- phoneCallCentre,
2809
- phoneCurrencyControl,
2810
- workSchedule,
2811
- exchangeRate,
2812
- }) }));
2813
- },
2814
- //** TODO: remove styles with refactoring DefaultFoldButton*/
2815
- renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$3({ isUnfolded, onToggle }) })] }, String(i)));
2816
- };
2817
- const renderCardContent$1 = ({ phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }) => {
2818
- const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2819
- const labelSchedule = workSchedule?.businessScheduleVisibleTag
2820
- ? 'Для физических лиц'
2821
- : 'Для физических и юридических лиц';
2822
- 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
2823
- ? renderBusinessSchedule(workSchedule?.businessScheduleDescription)
2824
- : null, exchangeRate?.currencies?.length ? (jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }));
2825
- };
2826
- const capitalizedFirstLetter$1 = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
2827
- const getOfficePoint = ({ name = '', address = '', workSchedule }) => {
2828
- const header = capitalizedFirstLetter$1(name);
2829
- const body = `${address} ${renderWorkSchedule(workSchedule)}`;
2830
- return { header, body };
2831
- };
2905
+ const CodeWordField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u0434\u043E\u0432\u043E\u0435 \u0441\u043B\u043E\u0432\u043E", ...getValidation(field('codeWord'), validatorObj.codeWord, input?.required), ...input })));
2832
2906
 
2833
- const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
2907
+ const CollectionCountField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043E\u0431\u044A\u0435\u043A\u0442\u043E\u0432 \u0438\u043D\u043A\u0430\u0441\u0441\u0430\u0446\u0438\u0438", type: "number", ...getValidation(field('collectionCount'), validatorObj.collectionCount, input?.required) })));
2834
2908
 
2835
- const isClient = !isSSR();
2836
- const ClientOnly = JSX(({ children }) => (isClient ? children : null));
2909
+ const CommentField = JSX(({ field, input }) => (jsx(InputControl, { className: "col-span-2", ...getValidation(field('comment'), validatorObj.comment, input?.required), placeholder: "\u0412\u0430\u0448\u0435 \u0441\u043E\u043E\u0431\u0449\u0435\u043D\u0438\u0435", isTextarea: true })));
2837
2910
 
2838
- 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, {
2839
- 'backdrop-blur': blur,
2840
- }), 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" }) })));
2911
+ const ConfirmationIncomeField = JSX(({ field, input }) => {
2912
+ const { data: confirmationIncome } = useLeadFormData('INCOME_CERT_UNITED');
2913
+ return (jsx(SelectField, { field: field, source: confirmationIncome, label: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043F\u043E\u0434\u0442\u0432\u0435\u0440\u0436\u0434\u0435\u043D\u0438\u044F \u0434\u043E\u0445\u043E\u0434\u0430", fieldName: "confirmationIncome", input: input }));
2914
+ });
2841
2915
 
2842
- const MapMarkerClusterIcon = '/icons/MapMarkerClusterIcon.svg';
2843
- const MapMarkerClusterYellowIcon = '/icons/MapMarkerClusterYellowIcon.svg';
2844
- function renderClusterer({ yandexMaps, map, points, isLoad, }) {
2845
- if (isLoad || !points) {
2846
- return;
2847
- }
2848
- map.geoObjects.removeAll();
2849
- if (!points.length) {
2850
- return;
2851
- }
2852
- const clusterIconContentLayout = yandexMaps.templateLayoutFactory.createClass('<div style="margin-top: -3px;">{{properties.geoObjects.length}}</div>');
2853
- const officeClusterer = defineClusterer('offices', yandexMaps, clusterIconContentLayout);
2854
- if (points.length && points.every((_) => 'type' in _)) {
2855
- const remoteWorkplaceClusterer = defineClusterer('workplaces', yandexMaps, clusterIconContentLayout);
2856
- const remoteWorkplaceGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'workplaces'), 'workplaces', yandexMaps);
2857
- const officesGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'offices'), 'offices', yandexMaps);
2858
- officeClusterer.add(officesGeoObjects);
2859
- remoteWorkplaceClusterer.add(remoteWorkplaceGeoObjects);
2860
- map.geoObjects.add(remoteWorkplaceClusterer);
2861
- map.geoObjects.add(officeClusterer);
2862
- }
2863
- else {
2864
- const geoObjects = defineGeoObjects(points, 'offices', yandexMaps);
2865
- officeClusterer.add(geoObjects);
2866
- map.geoObjects.add(officeClusterer);
2867
- }
2868
- map.setBounds(yandexMaps.util.bounds.fromPoints(points.map((_) => _.coords))).then(() => {
2869
- if (map.getZoom() > 10) {
2870
- map.setZoom(10);
2871
- }
2872
- });
2873
- }
2874
- const defineClusterer = (type, yandexMaps, clusterIconContentLayout) => {
2875
- return new yandexMaps.Clusterer({
2876
- clusterIcons: [
2877
- {
2878
- href: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
2879
- size: [78, 84],
2880
- offset: [-35, -50],
2881
- },
2882
- ],
2883
- clusterIconContentLayout,
2884
- clusterHideIconOnBalloonOpen: false,
2885
- geoObjectHideIconOnBalloonOpen: false,
2886
- });
2916
+ const ConscriptionField = JSX(({ field, input }) => {
2917
+ const { data: conscription } = useLeadFormData('MILITARY_STATUS');
2918
+ return (jsx(SelectField, { field: field, source: conscription, label: "\u0421\u0442\u0430\u0442\u0443\u0441 \u0432\u043E\u0435\u043D\u043D\u043E\u043E\u0431\u044F\u0437\u0430\u043D\u043D\u043E\u0433\u043E", fieldName: "conscription", input: input }));
2919
+ });
2920
+
2921
+ const CONSENTS = {
2922
+ processPersonalDataFlg: {
2923
+ text: 'Согласие на обработку персональных данных',
2924
+ docId: 4,
2925
+ },
2926
+ consentInformFlg: {
2927
+ text: 'Согласие на информирование о продуктах и услугах Банка',
2928
+ docId: 14,
2929
+ },
2930
+ consentProviderFlg: {
2931
+ text: 'Согласие об использовании простой электронной подписи',
2932
+ docId: 5,
2933
+ },
2934
+ consentOthersFlg: {
2935
+ text: 'Прочие согласия',
2936
+ docId: 1,
2937
+ },
2938
+ consentPfrFlg: {
2939
+ text: 'Согласие на запрос в ПФР',
2940
+ docId: 3,
2941
+ },
2942
+ consentToReceiveMaterials: {
2943
+ text: 'Согласен на получение информационных и аналитических материалов по электронной почте',
2944
+ },
2887
2945
  };
2888
- const defineGeoObjects = (pointArr, type, yandexMaps) => {
2889
- return pointArr.map(({ coords, content }) => new yandexMaps.Placemark(coords, {
2890
- balloonContentHeader: content?.header,
2891
- balloonContentBody: content?.body,
2892
- balloonContentFooter: content?.footer,
2893
- hintContent: content?.hint,
2894
- }, {
2895
- iconLayout: 'default#image',
2896
- iconImageHref: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
2897
- iconImageSize: [78, 84],
2898
- iconImageOffset: [-35, -50],
2899
- }));
2946
+
2947
+ const feedbackById = async (id, convertToPng = false) => {
2948
+ const response = await doRequest(`/feedback/file?id=${encodeURIComponent(id)}&convertToPngFlg=${convertToPng}`, 'GET');
2949
+ return await response.blob();
2900
2950
  };
2901
2951
 
2902
- const defaultStyle = {
2903
- focus: 'focus:border-primary-text focus:border',
2904
- hover: 'hover:bg-primary-hover',
2905
- active: 'active:bg-primary-active',
2906
- font: 'text-center font-sans',
2952
+ const getDocument = async (id, convertToPng = false) => {
2953
+ const response = await feedbackById(id, convertToPng);
2954
+ return URL.createObjectURL(response);
2907
2955
  };
2908
2956
 
2909
- const styles$1 = {
2910
- ...defaultStyle,
2911
- border: 'border border-transparent rounded-md',
2912
- position: 'absolute flex items-center justify-center',
2957
+ const CloseButton = JSX(({ className, onClose }) => (jsx("button", { className: style('flex justify-center items-center w-12 h-12 p-2xs bg-transparent border-none', className), onClick: onClose, title: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C", type: "button", children: jsx(Icon, { name: "CloseIcon", width: "20", height: "20", iconVersion: "gray" }) })));
2958
+
2959
+ const Dialog = JSX(({ className, head, children, onClose, onClick }) => {
2960
+ const { close } = useDialogManager();
2961
+ const handleClose = useCallback(() => {
2962
+ close();
2963
+ onClose && onClose();
2964
+ }, [onClose]);
2965
+ return (jsxs("div", { onClick: onClick, className: style('relative min-h-full bg-white pt-0 p-lg', className), role: "dialog", children: [jsxs("div", { className: "sticky py-xl top-0 bg-white z-10", children: [jsx(CloseButton, { className: "absolute top-0 right-0", onClose: handleClose }), jsx("div", { className: "container", children: head })] }), jsx("div", { className: "container pb-6xl", children: children })] }));
2966
+ });
2967
+
2968
+ const openDocument = async (open, id, convertToPng = false) => {
2969
+ const document = await getDocument(id, convertToPng);
2970
+ open(jsx(Dialog, { className: "my-6xl max-w-4xl mx-auto px-0 min-h-0 pb-0", children: convertToPng ? (jsx("img", { src: document })) : (jsx("iframe", { src: `${document}#toolbar=0`, className: "w-full h-[80vh]", id: "iframe-dialog" })) }));
2913
2971
  };
2914
- const renderUserGeolocation = (map, yandexMaps, className) => {
2915
- const setUserGeoLocation = () => {
2916
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2917
- // @ts-ignore
2918
- yandexMaps.geolocation
2919
- .get({
2920
- provider: 'yandex',
2921
- autoReverseGeocode: true,
2922
- mapStateAutoApply: true,
2923
- })
2924
- .then(function (result) {
2925
- map.current.geoObjects.add(result.geoObjects);
2926
- });
2927
- };
2928
- 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" }) }));
2972
+
2973
+ const OPEN_DOC_BUTTON_TEXT = 'Ознакомиться';
2974
+ const CheckboxWithDoc = JSX(({ className, error, docId, ...props }) => {
2975
+ const { open } = useDialogManager();
2976
+ const isMobile = useMobileMode();
2977
+ return (jsxs("div", { className: className, children: [jsxs("div", { className: "flex flex-wrap gap-x-m", children: [jsx(Checkbox, { ...props }), docId ? (jsx(LinkButton, { className: "text-primary-main", onClick: () => openDocument(open, docId, isMobile), children: jsx(Text, { children: OPEN_DOC_BUTTON_TEXT }) })) : null] }), renderErrorText(error)] }));
2978
+ });
2979
+
2980
+ const ConsentField = JSX(({ field, input }) => input && input.name ? (jsx(CheckboxWithDoc, { text: CONSENTS[input.name]?.text, docId: CONSENTS[input.name]?.docId, ...getValidation(field(input.name), validatorObj[input.name], input?.required) })) : null);
2981
+
2982
+ const LABEL_TEXT = `Имеет ли юридическое лицо, акционером / участником / членом / пайщиком /
2983
+ вкладчиком с долей участия более 20% уставного капитала руководителем,
2984
+ которого Вы являетесь, кредит в АО «Россельхозбанк»`;
2985
+ const CreditInRshbCdField = JSX(({ field, input }) => {
2986
+ const { data: creditInRshbCd } = useLeadFormData('CREDIT_IN_RSHB');
2987
+ return (jsx(SelectField, { field: field, source: creditInRshbCd, label: LABEL_TEXT, fieldName: "creditInRshbCd", input: input }));
2988
+ });
2989
+
2990
+ const orientationStyleMap = {
2991
+ horizontal: '@lg:flex-row',
2992
+ vertical: '',
2929
2993
  };
2994
+ 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)))) })] })));
2930
2995
 
2931
- const getNS = (_) => globalThis[_];
2932
- const initializeExternalNS = (namespaceName, url) => {
2933
- const script = document.getElementById(url);
2934
- if (script) {
2935
- const ns = getNS(namespaceName);
2936
- if (ns) {
2937
- return Promise.resolve(ns);
2938
- }
2939
- else {
2940
- return new Promise((resolve) => {
2941
- script.addEventListener('load', () => {
2942
- resolve(getNS(namespaceName));
2943
- });
2944
- });
2945
- }
2946
- }
2947
- else {
2948
- return new Promise((resolve, reject) => {
2949
- const newScript = document.createElement('script');
2950
- newScript.src = url;
2951
- newScript.async = true;
2952
- newScript.id = url;
2953
- newScript.addEventListener('load', () => {
2954
- resolve(getNS(namespaceName));
2955
- });
2956
- newScript.addEventListener('error', (error) => {
2957
- reject(error);
2958
- });
2959
- document.head.appendChild(newScript);
2960
- });
2961
- }
2962
- };
2963
- function useExternalNS(namespaceName, url, unmountNS = true) {
2964
- const [externalNS, setExternalNS] = useState(undefined);
2965
- useEffect(() => {
2966
- let isMounted = true;
2967
- initializeExternalNS(namespaceName, url)
2968
- .then((ns) => {
2969
- if (isMounted) {
2970
- setExternalNS(ns);
2971
- }
2972
- })
2973
- .catch((error) => {
2974
- console.error(`Failed to initialize external namespace: ${error}`);
2975
- });
2976
- return () => {
2977
- isMounted = false;
2978
- if (unmountNS) {
2979
- const script = document.getElementById(url);
2980
- if (script) {
2981
- document.head.removeChild(script);
2982
- }
2983
- setExternalNS(undefined);
2984
- }
2985
- };
2986
- }, [namespaceName, url, unmountNS]);
2987
- return externalNS;
2988
- }
2996
+ 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)] })));
2989
2997
 
2990
- const YMAPS_NAMESPACE = 'ymaps';
2991
- const useYandexMaps = () => {
2992
- const url = `https://api-maps.yandex.ru/2.1/?apikey=${projectSettings.YANDEX_MAP_API_KEY || ''}&lang=ru_RU`;
2993
- return useExternalNS(YMAPS_NAMESPACE, url, false);
2994
- };
2998
+ const CURRENCY_TYPES = [{ id: 'rub', text: 'Рубль' }];
2999
+ const CurrencyField = JSX(({ field, input }) => {
3000
+ const { value, onChange } = field('currency');
3001
+ return (jsx(RadioButtonGroupControl, { label: "\u0412\u0430\u043B\u044E\u0442\u0430", orientation: "horizontal", items: CURRENCY_TYPES, value: value, onChange: (_) => onChange?.(_), ...getValidation(field('currency'), validatorObj.currency, input?.required) }));
3002
+ });
2995
3003
 
2996
- const styles = {
2997
- ...defaultStyle,
2998
- border: 'border-b border-b-2 border-gray last:border-0',
2999
- position: 'relative flex items-center justify-center',
3000
- };
3001
- // TODO: Добавить метод определения центральной точки
3002
- const ZoomButton = JSX(({ yandexMaps, direction = 'in' }) => {
3003
- const iconName = direction === 'in' ? 'PlusIcon' : 'MinusIcon';
3004
- const changeZoom = () => {
3005
- const currentZoom = yandexMaps.current.getZoom();
3006
- const newZoom = direction === 'in' ? currentZoom + 1 : currentZoom - 1;
3007
- yandexMaps.current.setZoom(newZoom, { checkZoomRange: true });
3008
- };
3009
- 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" }) }));
3004
+ const DeliveryDateFiels = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0434\u043E\u0441\u0442\u0430\u0432\u043A\u0438", ...getValidation(field('deliveryDate'), validatorObj.deliveryDate, input?.required) })));
3005
+
3006
+ const DependentsField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0438\u0436\u0434\u0438\u0432\u0435\u043D\u0446\u0435\u0432", placeholder: "\u0417\u0430 \u0438\u0441\u043A\u043B\u044E\u0447\u0435\u043D\u0438\u0435 \u0434\u0435\u0442\u0435\u0439 \u0434\u043E 18 \u043B\u0435\u0442", type: "number", maxLength: 2, ...getValidation(field('dependents'), validatorObj.dependents, input?.required), ...input })));
3007
+
3008
+ const DesiredMeetingDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0416\u0435\u043B\u0430\u0435\u043C\u0430\u044F \u0434\u0430\u0442\u0430 \u0432\u0441\u0442\u0440\u0435\u0447\u0438", ...getValidation(field('desiredMeetingDate'), validatorObj.meetingDay, input?.required) })));
3009
+
3010
+ const DisablePeopleFlgField = JSX(({ field, input }) => (jsx(CheckboxWithError, { text: "\u042F\u0432\u043B\u044F\u044E\u0441\u044C \u0438\u043D\u0432\u0430\u043B\u0438\u0434\u043E\u043C", ...getValidation(field('disablePeopleFlg'), validatorObj.disablePeopleFlg, input?.required) })));
3011
+
3012
+ const FIELD_NAME$6 = 'dulIssueDateField';
3013
+ const DulIssueDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0432\u044B\u0434\u0430\u0447\u0438", ...getValidation(field(FIELD_NAME$6), validatorObj.dulIssueDateField, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$6) })));
3014
+
3015
+ const FIELD_NAME$5 = 'dulIssuedBy';
3016
+ const DulIssuedByField = JSX(({ field, input }) => {
3017
+ const { value: dulSubdivisionCode, onChange: changeDulSubdivisionCode } = field('dulSubdivisionCode');
3018
+ const onDaDataChange = useCallback((item) => {
3019
+ changeDulSubdivisionCode?.(item?.data?.code?.replace('-', ''));
3020
+ }, []);
3021
+ return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$5), label: "\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D", ...input, ...getValidation(field(FIELD_NAME$5), validatorObj.dulIssuedBy, input?.required), onDaDataChange: onDaDataChange, daDataQueryPrefix: dulSubdivisionCode }));
3010
3022
  });
3011
3023
 
3012
- const DEFAULT_CENTER_COORDS = [55.753995, 37.614069];
3013
- // TODO: Поле для поиска: невыяснено среди каких данных делать поиск (искать в имени офиса, в адресе, метро и т.д.).
3014
- // Сейчас реализован поиск среди тестовых данных
3015
- // TODO: Также выяснить что делать когда ничего не найдено
3016
- // TODO: На макетах также когда есть поле поиска нет кнопки открыть на карте.
3017
- const YandexMap = JSX(({ points, className = '', zoom = 5, isLoad, selectedAddress }) => {
3018
- const map = useRef(null);
3019
- const yandexMaps = useYandexMaps();
3024
+ const FIELD_NAME$4 = 'dulNumber';
3025
+ const DulNumberField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$4), label: "\u041D\u043E\u043C\u0435\u0440 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", type: "number", maxLength: 6, ...getValidation(field('dulNumber'), validatorObj.dulNumber, input?.required) })));
3026
+
3027
+ const FIELD_NAME$3 = 'dulSerie';
3028
+ const DulSerieField = JSX(({ field, input }) => (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$3), label: "\u0421\u0435\u0440\u0438\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", type: "number", maxLength: 4, ...getValidation(field('dulSerie'), validatorObj.dulSerie, input?.required) })));
3029
+
3030
+ const FIELD_NAME$2 = 'dulSubdivisionCode';
3031
+ const DulSubdivisionCodeField = JSX(({ field, input }) => {
3032
+ const onDaDataChange = useCallback((item) => {
3033
+ field?.('dulIssuedBy')?.onChange?.(item?.data?.name);
3034
+ }, []);
3035
+ return (jsx(InputControl, { disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$2), label: "\u041A\u043E\u0434 \u043F\u043E\u0434\u0440\u0430\u0437\u0434\u0435\u043B\u0435\u043D\u0438\u044F", type: "number", maxLength: 6, ...input, ...getValidation(field(FIELD_NAME$2), validatorObj.dulSubdivisionCode, input?.required), onDaDataChange: onDaDataChange }));
3036
+ });
3037
+
3038
+ const EducationField = JSX(({ field, input }) => {
3039
+ const { data: education } = useLeadFormData('EDUCATION_LEVEL');
3040
+ return (jsx(SelectField, { field: field, source: education, label: "\u041E\u0431\u0440\u0430\u0437\u043E\u0432\u0430\u043D\u0438\u0435", fieldName: "education", input: input }));
3041
+ });
3042
+
3043
+ const EmailField = JSX(({ field, input }) => {
3044
+ const { required, ...rest } = input;
3045
+ return (jsx(InputControl, { label: "\u042D\u043B\u0435\u043A\u0442\u0440\u043E\u043D\u043D\u0430\u044F \u043F\u043E\u0447\u0442\u0430", ...getValidation(field('email'), validatorObj.email, required), ...rest }));
3046
+ });
3047
+
3048
+ const EmployerActivitiesField = JSX(({ field, input }) => {
3049
+ const { data: employerActivities } = useLeadFormData('ORGANIZATION_ACTIVITY_TYPE');
3050
+ return (jsx(SelectField, { field: field, source: employerActivities, label: "\u0412\u0438\u0434 \u0434\u0435\u044F\u0442\u0435\u043B\u044C\u043D\u043E\u0441\u0442\u0438 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438-\u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044F", fieldName: "employerActivities", input: input }));
3051
+ });
3052
+
3053
+ const EmployerOrganizationField = JSX(({ field, input }) => {
3054
+ const { data: employerOrganization } = useLeadFormData('ORGANIZATION_KIND');
3055
+ return (jsx(SelectField, { field: field, source: employerOrganization, label: "\u0412\u0438\u0434 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438 \u0440\u0430\u0431\u043E\u0442\u043E\u0434\u0430\u0442\u0435\u043B\u044F", fieldName: "employerOrganization", input: input }));
3056
+ });
3057
+
3058
+ const EmploymentField = JSX(({ field, input }) => {
3059
+ const { data: employment } = useLeadFormData('EMPLOYMENT_INFO_UNITED');
3060
+ return (jsx(SelectField, { field: field, source: employment, label: "\u0418\u043D\u0444\u043E\u0440\u043C\u0430\u0446\u0438\u044F \u043E \u0442\u0440\u0443\u0434\u043E\u0443\u0441\u0442\u0440\u043E\u0439\u0441\u0442\u0432\u0435", fieldName: "employment", input: input }));
3061
+ });
3062
+
3063
+ const ExpensesField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0440\u0430\u0441\u0445\u043E\u0434\u044B \u0432 \u043C\u0435\u0441\u044F\u0446", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", ...getValidation(field('expenses'), validatorObj.expenses, input?.required), ...input })));
3064
+
3065
+ const Experience5YearsField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u0442\u0430\u0436", placeholder: "\u0417\u0430 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 5 \u043B\u0435\u0442", type: "number", maxLength: 2, ...getValidation(field('experience5Years'), validatorObj.experience5Years, input?.required), ...input })));
3066
+
3067
+ const FamilyMembersField = JSX(({ field }) => {
3068
+ const { value, onChange } = field('familyMembers');
3069
+ const familyStatusKey = field('familyStatus')?.value?.key;
3070
+ const adultsCount = familyStatusKey === 'MARRIED' ? 2 : 1;
3071
+ const childrenCount = Number(field('children')?.value);
3072
+ const dependentsCount = Number(field('dependents')?.value);
3073
+ const totalCount = adultsCount + childrenCount + dependentsCount;
3020
3074
  useEffect(() => {
3021
- if (map.current) {
3022
- renderClusterer({ yandexMaps, map: map.current, points, isLoad });
3023
- }
3024
- else {
3025
- yandexMaps?.ready(() => {
3026
- // Ready function may be called few times, but must be called once
3027
- if (map.current) {
3028
- renderClusterer({ yandexMaps, map: map.current, points, isLoad });
3029
- return;
3030
- }
3031
- map.current = new yandexMaps.Map('map', {
3032
- center: getCenterPoint(points),
3033
- zoom,
3034
- controls: [],
3035
- suppressMapOpenBlock: true,
3036
- });
3037
- renderClusterer({ yandexMaps, map: map.current, points, isLoad });
3038
- });
3039
- }
3040
- }, [yandexMaps, points, zoom, isLoad, selectedAddress]);
3075
+ field?.('familyMembers')?.onChange?.(totalCount);
3076
+ }, [familyStatusKey, childrenCount, dependentsCount]);
3077
+ return (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u0447\u043B\u0435\u043D\u043E\u0432 \u0441\u0435\u043C\u044C\u0438", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", disabled: true, value: value, onChange: (_) => onChange?.(_) }));
3078
+ });
3079
+
3080
+ const FamilyStatusField = JSX(({ field, input }) => {
3081
+ const { data: familyStatus } = useLeadFormData('MARITAL_STATUS');
3082
+ return (jsx(SelectField, { field: field, source: familyStatus, label: "\u0421\u0435\u043C\u0435\u0439\u043D\u043E\u0435 \u043F\u043E\u043B\u043E\u0436\u0435\u043D\u0438\u0435", fieldName: "familyStatus", input: input }));
3083
+ });
3084
+
3085
+ const SERVICE_TYPES = [
3086
+ { key: 'ULTRASERVICE', text: 'Ультра' },
3087
+ { key: 'PREMIUMSERVICE', text: 'Премиум' },
3088
+ ];
3089
+ const SERVICE_DIRECTIONS = [
3090
+ { key: 'Физическое лицо' },
3091
+ { key: 'Юридическое лицо / ИП' },
3092
+ ];
3093
+ const FEEDBACK_METHOD = [
3094
+ { key: 'phone', text: 'Телефонный звонок' },
3095
+ { key: 'email', text: 'Электронное сообщение' },
3096
+ ];
3097
+
3098
+ const FeedbackMethodField = JSX(({ field, input }) => (jsx(SelectControl, { label: "\u0421\u043F\u043E\u0441\u043E\u0431 \u043F\u043E\u043B\u0443\u0447\u0435\u043D\u0438\u044F \u043E\u0442\u0432\u0435\u0442\u0430", options: FEEDBACK_METHOD, ...getValidation(field('feedbackMethod'), validatorObj.feedbackMethod, input?.required) })));
3099
+
3100
+ const FullNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0418\u041E", ...getValidation(field('fullName'), validatorObj.fullName, input?.required), ...input })));
3101
+
3102
+ const GeneralSeniorityField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u0449\u0438\u0439 \u0441\u0442\u0430\u0436", type: "number", maxLength: 2, placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043B\u0435\u0442", ...getValidation(field('generalSeniority'), validatorObj.generalSeniority, input?.required), ...input })));
3103
+
3104
+ const HousingField = JSX(({ field, input }) => {
3105
+ const { data: housing } = useLeadFormData('HOUSE_TYPE');
3106
+ return (jsx(SelectField, { field: field, source: housing, label: "\u0422\u0438\u043F \u0436\u0438\u043B\u044C\u044F", fieldName: "housing", input: input }));
3107
+ });
3108
+
3109
+ const InnField = JSX(({ field, input }) => {
3110
+ const onDaDataChange = useCallback((item) => {
3111
+ field?.('organizationName')?.onChange?.(item.data?.name?.short_with_opf);
3112
+ field?.('legalForm')?.onChange?.(item.data?.opf?.short);
3113
+ }, []);
3114
+ return (jsx(InputControl, { label: "\u0418\u041D\u041D", type: "number", maxLength: 12, ...input, ...getValidation(field('inn'), validatorObj.inn, input?.required), onDaDataChange: onDaDataChange }));
3115
+ });
3116
+
3117
+ const IsClientField = JSX(({ field }) => (jsx(CheckboxWithError, { ...field('isClient'), text: '\u042F\u0432\u043B\u044F\u044E\u0441\u044C \u043A\u043B\u0438\u0435\u043D\u0442\u043E\u043C \u0431\u0430\u043D\u043A\u0430 \u0410\u041E "\u0420\u043E\u0441\u0441\u0435\u043B\u044C\u0445\u043E\u0437\u0431\u0430\u043D\u043A"' })));
3118
+
3119
+ const JobsNumberField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043C\u0435\u0441\u0442 \u0440\u0430\u0431\u043E\u0442\u044B \u0437\u0430 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0438\u0435 5 \u043B\u0435\u0442", placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043C\u0435\u0441\u0442", type: "number", maxLength: 2, ...getValidation(field('jobsNumber'), validatorObj.jobsNumber, input?.required), ...input })));
3120
+
3121
+ const LastJobExperienceField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u0442\u0430\u0436 \u043D\u0430 \u043F\u043E\u0441\u043B\u0435\u0434\u043D\u0435\u043C \u0440\u0430\u0431\u043E\u0447\u0435\u043C \u043C\u0435\u0441\u0442\u0435", placeholder: "\u041A\u043E\u043B\u0438\u0447\u0435\u0441\u0442\u0432\u043E \u043B\u0435\u0442", type: "number", maxLength: 2, ...getValidation(field('lastJobExperience'), validatorObj.lastJobExperience, input?.required), ...input })));
3122
+
3123
+ const LegalEntityNameField = JSX(({ field, input }) => {
3124
+ return (jsx(InputControl, { label: "\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u044E\u0440\u0438\u0434\u0438\u0447\u0435\u0441\u043A\u043E\u0433\u043E \u043B\u0438\u0446\u0430", ...input, ...getValidation(field('legalEntityName'), validatorObj.legalEntityName, input?.required) }));
3125
+ });
3126
+
3127
+ const LegalFormField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u041F\u0424", placeholder: "\u041E\u041E\u041E, \u041F\u0410\u041E \u0438 \u0434\u0440.", ...getValidation(field('legalForm'), validatorObj.legalForm, input?.required), ...input })));
3128
+
3129
+ const OUT_SERVICE_BASE_URL = `${API_BASE_URI}/outservice`;
3130
+ const EMPTY_REGIONS = [];
3131
+ async function getOutServiceRegions() {
3132
+ const data = await fetchJSON(`${OUT_SERVICE_BASE_URL}/outserviceregions`);
3133
+ return data && Array.isArray(data) ? data : EMPTY_REGIONS;
3134
+ }
3135
+
3136
+ const LocalitiesField = JSX(({ field, input }) => {
3137
+ const fieldRegion = field('region');
3138
+ const regionKey = fieldRegion?.value?.key;
3139
+ const { data: regions } = useAsyncData('outServiceRegions', getOutServiceRegions);
3140
+ const localities = regions
3141
+ ?.find((_) => _.code === regionKey)
3142
+ ?.localities?.map((_) => ({ key: _, text: _ }));
3041
3143
  useEffect(() => {
3042
- if (map.current && selectedAddress) {
3043
- yandexMaps?.geocode(selectedAddress).then((res) => {
3044
- const firstGeoObject = res.geoObjects.get(0);
3045
- const coords = firstGeoObject.geometry.getCoordinates();
3046
- map.current.setCenter(coords);
3047
- map.current.setZoom(18);
3048
- });
3144
+ if (regionKey !== '') {
3145
+ field?.('localities')?.onChange?.('');
3049
3146
  }
3050
- }, [selectedAddress]);
3051
- if (!yandexMaps) {
3052
- return null;
3053
- }
3054
- const zIndex = 'z-10';
3055
- 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))] }));
3147
+ }, [regionKey]);
3148
+ return (jsx(SelectControl, { label: "\u041D\u0430\u0441\u0435\u043B\u0435\u043D\u043D\u044B\u0439 \u043F\u0443\u043D\u043A\u0442", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0433\u043E\u0440\u043E\u0434, \u0433\u0434\u0435 \u0434\u043E\u0441\u0442\u0443\u043F\u0435\u043D \u0441\u0435\u0440\u0432\u0438\u0441", options: localities, ...getValidation(field('localities'), validatorObj.localities, input?.required), isSearch: true }));
3056
3149
  });
3057
- const getCenterPoint = (points) => {
3058
- const centerCoords = [
3059
- getArraySumAndAverage(mapByIndex(points, 0)),
3060
- getArraySumAndAverage(mapByIndex(points, 1)),
3061
- ];
3062
- return centerCoords.every((_) => _) ? centerCoords : DEFAULT_CENTER_COORDS;
3063
- };
3064
- const mapByIndex = (points, index) => points.map((_) => _.coords?.[index]);
3065
- const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
3066
3150
 
3067
- const INITIAL_FILTRATION_STATE$1 = {
3068
- workingSaturday: false,
3069
- premiumService: false,
3070
- privateBanking: false,
3071
- remoteWorkplace: false,
3072
- serviceDisabledPeople: false,
3073
- sellingCoins: false,
3074
- buyingCoins: false,
3075
- bullionOperations: false,
3076
- preciousMetalsOperations: false,
3077
- transferringDataToBiometricSystem: false,
3078
- };
3079
- const FILTRATION_LABELS = {
3080
- safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
3081
- workingSaturday: 'Открыты по субботам',
3082
- terminalTypeAtms: 'Банкоматы',
3083
- terminalTypeTerm: 'Терминалы',
3084
- workAllTime: 'Круглосуточно',
3085
- billAcceptorEnable: 'Прием наличных',
3086
- premiumService: 'Премиальное обслуживание',
3087
- privateBanking: 'Услуга Private banking',
3088
- sellingCoins: 'Продажа монет из драгоценных металлов',
3089
- buyingCoins: 'Покупка монет из драгоценных металлов',
3090
- bullionOperations: 'Операции со слитками',
3091
- preciousMetalsOperations: 'Операции с драгоценными металлами',
3092
- transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
3093
- locationDisabledPeople: 'Для маломобильных',
3094
- designDisabledPeople: 'Для слабовидящих',
3095
- remoteWorkplace: 'Удаленное рабочее место',
3096
- serviceDisabledPeople: 'Для маломобильных граждан',
3097
- };
3098
- const FILTRATION_PREDICATES$1 = {
3099
- workingSaturday: (item) => Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
3100
- premiumService: (item) => Boolean('premiumService' in item && item.premiumService),
3101
- privateBanking: (item) => Boolean('privateBanking' in item && item.privateBanking),
3102
- remoteWorkplace: (item) => Boolean('workScheduleDescription' in item),
3103
- serviceDisabledPeople: (item) => Boolean('serviceDisabledPeople' in item && item.serviceDisabledPeople),
3104
- sellingCoins: (item) => Boolean('sellingCoins' in item && item.sellingCoins),
3105
- buyingCoins: (item) => Boolean('buyingCoins' in item && item.buyingCoins),
3106
- bullionOperations: (item) => Boolean('bullionOperations' in item && item.bullionOperations),
3107
- preciousMetalsOperations: (item) => Boolean('preciousMetalsOperations' in item && item.preciousMetalsOperations),
3108
- transferringDataToBiometricSystem: (item) => Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
3109
- };
3151
+ const MandatoryPaymentsField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u044B\u0435 \u0432\u044B\u043F\u043B\u0430\u0442\u044B", placeholder: "\u0412\u0432\u0435\u0434\u0438\u0442\u0435 \u0437\u043D\u0430\u0447\u0435\u043D\u0438\u0435", type: "number", ...getValidation(field('mandatoryPayments'), validatorObj.mandatoryPayments, input?.required), ...input })));
3152
+
3153
+ const METHODS_OF_OBTAIN = [
3154
+ { id: 'office', text: 'В отделении Банка' },
3155
+ { id: 'courier', text: 'Курьерская доставка' },
3156
+ ];
3157
+ const MethodObtainField = JSX(({ field, input }) => (jsx(RadioButtonGroupControl, { orientation: "horizontal", items: METHODS_OF_OBTAIN, ...getValidation(field('methodObtain'), validatorObj.methodObtain, input?.required) })));
3158
+
3159
+ const FIELD_NAME$1 = 'middleName';
3160
+ const MiddleNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041E\u0442\u0447\u0435\u0441\u0442\u0432\u043E (\u041E\u0431\u044F\u0437\u0430\u0442\u0435\u043B\u044C\u043D\u043E, \u043F\u0440\u0438 \u043D\u0430\u043B\u0438\u0447\u0438\u0438)", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, FIELD_NAME$1), ...getValidation(field(FIELD_NAME$1), validatorObj.middleName, input?.required), ...input })));
3161
+
3162
+ const NameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0418\u043C\u044F", maxLength: 60, disabled: input?.filledByEsia && isEsiaAuthorize(field, input.name ?? ''), ...getValidation(field('name'), validatorObj.name, input?.required), ...input })));
3163
+
3164
+ const SlideCheckbox = JSX(({ value = false, text, type = 'checkbox', onChange }) => (jsxs("div", { role: type, "aria-checked": value, className: "flex justify-start items-center w-full cursor-pointer mb-s", onClick: () => onChange && onChange(!value), children: [jsx("div", { className: style('relative flex-shrink-0 duration-300 w-9 h-5 mr-s rounded-2xl', value ? 'bg-primary-main' : 'bg-main-divider'), children: jsx("div", { className: style('absolute opacity-80 duration-500 top-0.5 w-4 h-4 bg-white rounded-full', value ? 'left-1/2' : 'left-[5%]') }) }), text ? (jsx(Text, { size: "text-l", font: "font-light", color: "text-primary-text", children: text })) : null] })));
3165
+
3166
+ const OnlineCheckoutField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 \u043E\u043D\u043B\u0430\u0439\u043D-\u043A\u0430\u0441\u0441\u0443", ...field('onlineCheckout') })) : null);
3167
+
3168
+ const OrganizationField = JSX(({ field, input }) => {
3169
+ const { data: organization } = useLeadFormData('ORGANIZATION_TYPE');
3170
+ return (jsx(SelectField, { field: field, source: organization, label: "\u0422\u0438\u043F \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", fieldName: "organization", input: input }));
3171
+ });
3172
+
3173
+ const OrganizationNameField = JSX(({ field, input }) => {
3174
+ const onDaDataChange = useCallback((item) => {
3175
+ field?.('inn')?.onChange?.(item.data?.inn);
3176
+ field?.('legalForm')?.onChange?.(item.data?.opf?.short);
3177
+ }, []);
3178
+ return (jsx(InputControl, { label: "\u041D\u0430\u0438\u043C\u0435\u043D\u043E\u0432\u0430\u043D\u0438\u0435 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", ...input, ...getValidation(field('organizationName'), validatorObj.organizationName, input?.required), onDaDataChange: onDaDataChange }));
3179
+ });
3180
+
3181
+ const OtherIncomeField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0418\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('otherIncome'), validatorObj.otherIncome, input?.required), ...input })));
3182
+
3183
+ const ParticipantDateRegistrationField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0440\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u0438 \u043F\u043E \u043C\u0435\u0441\u0442\u0443 \u0436\u0438\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u0430", ...getValidation(field('participantDateRegistration'), validatorObj.participantDateRegistration, input?.required) })));
3184
+
3185
+ const MAX_PART = 100;
3186
+ const PartInBusinessField = JSX(({ field, input }) => {
3187
+ const isBusinessOwner = field('positionOrganization')?.value?.key === 'BUSINESS_OWNER';
3188
+ const partInBusinessField = {
3189
+ ...getValidation(field('partInBusiness'), validatorObj.partInBusiness, input?.required),
3190
+ };
3191
+ const handleChange = (value) => partInBusinessField?.onChange &&
3192
+ partInBusinessField?.onChange(String(Number(value) > MAX_PART ? MAX_PART : Number(value) || ''));
3193
+ return (jsx(InputControl, { label: "\u0414\u043E\u043B\u044F \u0443\u0447\u0430\u0441\u0442\u0438\u044F \u0432 \u0431\u0438\u0437\u043D\u0435\u0441\u0435", placeholder: "\u0432 %", type: "number", maxLength: 3, ...partInBusinessField, ...input, onChange: handleChange, value: isBusinessOwner ? partInBusinessField?.value : '', disabled: !isBusinessOwner }));
3194
+ });
3195
+
3196
+ const PartnerCommentsField = JSX(({ field, input }) => {
3197
+ const { required, ...rest } = input;
3198
+ return (jsx(InputControl, { ...getValidation(field('partnerComments'), validatorObj.partnerComments, required), placeholder: "\u0423\u043A\u0430\u0436\u0438\u0442\u0435 \u0438\u043D\u0442\u0435\u0440\u0435\u0441\u0443\u044E\u0449\u0438\u0439 \u0432\u0430\u0441 \u0432\u043E\u043F\u0440\u043E\u0441", isTextarea: true, ...rest }));
3199
+ });
3200
+
3201
+ const PAYMENT_SYSTEM_TYPES = [
3202
+ { id: 'mir', text: 'Карта МИР' },
3203
+ { id: 'union_pay', text: 'UnionPay' },
3204
+ ];
3205
+ const PaymentSystemField = JSX(({ field, input }) => {
3206
+ const { value, onChange } = field('paymentSystem');
3207
+ return (jsx(RadioButtonGroupControl, { label: "\u041F\u043B\u0430\u0442\u0435\u0436\u043D\u0430\u044F \u0441\u0438\u0441\u0442\u0435\u043C\u0430", orientation: "horizontal", items: PAYMENT_SYSTEM_TYPES, value: value, onChange: (_) => onChange?.(_), ...getValidation(field('paymentSystem'), validatorObj.paymentSystem, input?.required) }));
3208
+ });
3110
3209
 
3111
- function useButton() {
3112
- return (props) => ({
3113
- ...props,
3114
- onClick: handlerDecorator(handleClick(props)),
3115
- });
3116
- }
3117
- function handleClick({ disabled, onClick }) {
3118
- return (ev) => {
3119
- !disabled && onClick && onClick(ev);
3120
- };
3210
+ const isPlaceholder = (_) => _ === '_';
3211
+ const isDigit = (_) => /\d/.test(_);
3212
+ const isWildcard = (_) => isPlaceholder(_) || isDigit(_);
3213
+ const phonePattern = [...'+7 (___) ___-__-__'];
3214
+ const firstPlaceholderIndex = phonePattern.findIndex(isPlaceholder);
3215
+ const phoneWildcardIndicies = phonePattern.map((_, i) => isWildcard(_) ? phonePattern.slice(0, i).filter(isWildcard).length : -1);
3216
+ function normalizePhone(phone) {
3217
+ const phoneNumbers = phone.replace(/\D/g, '');
3218
+ const applyPlaceholder = (_, i) => isDigit(_) ? _ : phoneNumbers.charAt(phoneWildcardIndicies[i]) || _;
3219
+ const result = phonePattern.map(applyPlaceholder);
3220
+ const resultLength = phoneWildcardIndicies.indexOf(phoneNumbers.length - 1) + 1;
3221
+ return (resultLength ? result.slice(0, Math.max(firstPlaceholderIndex, resultLength)) : result).join('');
3121
3222
  }
3122
3223
 
3123
- const buttonStyleMap = {
3124
- primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
3125
- secondary: 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
3126
- };
3127
- const secondaryButtonStyleMap = {
3128
- 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'),
3129
- 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'),
3130
- };
3131
- const Button = JSX(({ children, ...props }) => {
3132
- const button = useButton();
3133
- const { className, version = 'primary', active, disabled, type = 'button', rounded = true, role, onClick, } = button(props);
3134
- return (jsx("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs', {
3135
- 'text-white bg-primary-active': active,
3136
- 'bg-main-gray text-main-disabled cursor-not-allowed': disabled,
3137
- 'rounded-md': rounded,
3138
- }, !active && !disabled
3139
- ? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
3140
- : '', className), type: type, role: role, onClick: onClick, children: children }));
3224
+ const PhoneInput = JSX(({ children, onChange, ...inputProps }) => {
3225
+ const handleChange = useCallback((v) => onChange && onChange(normalizePhone(v)), [onChange]);
3226
+ const handleBlur = useCallback((v) => {
3227
+ if (v === '+7 (') {
3228
+ onChange && onChange('');
3229
+ }
3230
+ }, []);
3231
+ return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
3141
3232
  });
3142
3233
 
3143
- const getVersion = (isPrimary, type) => isPrimary && type !== 'underlined' ? 'primary' : 'secondary';
3234
+ const InputPhoneControl = JSX(({ className, label, error, ...rest }) => (jsxs("div", { className: style('shrink-0 w-full', className), children: [jsx(PhoneInput, { "aria-label": label, label: getRequiredLabel({ label, errors: rest?.errors }), valid: Boolean(!error), placeholder: "+7 (___) ___-__-__", ...rest }), renderErrorText(error)] })));
3144
3235
 
3145
- const renderButtonsGroup = (data, activeButton, onButtonClick) => {
3146
- const allButtonVersion = getVersion(activeButton === 'all');
3147
- const businessButtonVersion = getVersion(activeButton === 'business');
3148
- const handleClick = (e, key, branches) => {
3149
- const filteredBranches = e.currentTarget === e.target && key === 'business' ? filterBranches(branches) : branches;
3150
- onButtonClick(key);
3151
- return filteredBranches;
3152
- };
3153
- const filterBranches = (branches) => branches.filter((branch) => branch.workSchedule &&
3154
- branch.workSchedule.businessScheduleVisibleTag &&
3155
- !branch.workSchedule.businessScheduleDescription);
3156
- 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" })] }));
3157
- };
3236
+ const PhoneField = JSX(({ field, input }) => {
3237
+ const fieldName = input?.name || 'phone';
3238
+ return (jsx(InputPhoneControl, { label: "\u0422\u0435\u043B\u0435\u0444\u043E\u043D", ...getValidation(field(fieldName), validatorObj.phone, input?.required), disabled: input?.filledByEsia && isEsiaAuthorize(field, fieldName), ...input }));
3239
+ });
3158
3240
 
3159
- 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;
3241
+ const PositionOrganizationField = JSX(({ field, input }) => {
3242
+ const { data: positionOrganization } = useLeadFormData('POSITION');
3243
+ return (jsx(SelectField, { field: field, source: positionOrganization, label: "\u0414\u043E\u043B\u0436\u043D\u043E\u0441\u0442\u044C \u0432 \u043E\u0440\u0433\u0430\u043D\u0438\u0437\u0430\u0446\u0438\u0438", fieldName: "positionOrganization", input: input }));
3244
+ });
3160
3245
 
3161
- const COMMON_FILTERS_STYLES = 'flex flex-col sm:flex-row sm:flex-wrap gap-3xl pb-2xl';
3162
- const renderFiltrationForm = ({ filters, field: { field, reset }, onlyOffice, labels, }) => {
3163
- const visibleFiltersNum = onlyOffice ? 5 : 6;
3164
- const filtersCheckbox = (filters || []).map((key) => (jsx(Checkbox, { text: labels[key], ...field(key) }, key)));
3165
- const [visibleFilters, hiddenFilters] = visibleFiltersNum > 0
3166
- ? [filtersCheckbox.slice(0, visibleFiltersNum), filtersCheckbox.slice(visibleFiltersNum)]
3167
- : [filtersCheckbox, []];
3168
- 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 }));
3169
- };
3170
- const renderFoldButton$2 = (reset, onlyOffice = false) => ({ isUnfolded, onToggle }) => {
3171
- const labels = ['Больше фильтров', 'Меньше фильтров'];
3172
- const icons = ['ArrowDownIcon', 'ArrowUpIcon'];
3173
- 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() })] }));
3174
- };
3175
- 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" })] }));
3246
+ const PosTerminalField = JSX(({ field }) => isAcquiringTrade(field('acquiringType')?.value?.key) ? (jsx(SlideCheckbox, { type: "radio", text: "\u0425\u043E\u0447\u0443 POS-\u0442\u0435\u0440\u043C\u0438\u043D\u0430\u043B", ...field('posTerminal') })) : null);
3176
3247
 
3177
- 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] }) }));
3248
+ const ProductField = UniBlock(({ field, source }) => (jsx(SelectControl, { placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u043F\u0440\u043E\u0434\u0443\u043A\u0442", label: "\u041F\u0440\u043E\u0434\u0443\u043A\u0442", options: arrayToOptions(source?.productList), ...withValidator(field('product'), validatorObj.product) })));
3249
+ const arrayToOptions = (array) => (array ?? []).map((_) => ({ key: _, value: _ }));
3178
3250
 
3179
- const defaultEmptyFunction$1 = () => void 0;
3180
- const filtersVisibleStyles = (activeButton) => activeButton === 'all' ? 'block' : 'hidden';
3181
- const OfficesAtmsMapLayout = JSX(({ className, data = [], isLoad, remoteWorkplaces = [], renderCard = defaultEmptyFunction$1, renderRemoteWorkplaceCard = defaultEmptyFunction$1, getBalloon = defaultEmptyFunction$1, getBalloonRemoteWorkplaces = defaultEmptyFunction$1, descriptionData, title, }) => {
3182
- const onlyOffice = title?.includes('Офис');
3183
- const [filtrationState, { field, reset }] = useForm(INITIAL_FILTRATION_STATE$1);
3184
- const { filteredItems, points, filteredRemoteWorkplaces, lengthItems } = useOfficesAtmsMapData({
3185
- data,
3186
- remoteWorkplaces,
3187
- filtrationState,
3188
- getBalloon,
3189
- getBalloonRemoteWorkplaces,
3190
- });
3191
- const [activeButton, setActiveButton] = useState('all');
3192
- const filterOptions = {
3193
- filters: getFiltersWithNonEmptyData([...data, ...remoteWorkplaces]),
3194
- field: { field, reset },
3195
- onlyOffice,
3196
- labels: FILTRATION_LABELS,
3197
- };
3198
- 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)] })] }));
3199
- });
3200
- const filterItems$1 = (data, filtrationState) => {
3201
- const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
3202
- return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES$1[_](item)));
3203
- };
3204
- const getFiltersWithNonEmptyData = (data) => Object.keys(INITIAL_FILTRATION_STATE$1).filter((_) => data.filter((item) => FILTRATION_PREDICATES$1[_](item)).length);
3251
+ const REGIONS_URL = `${API_BASE_URI}/regions`;
3252
+ function useRegions(url = REGIONS_URL) {
3253
+ const { data } = useAsyncData(url, fetchJSONUnsafe);
3254
+ return Array.isArray(data) ? data : [];
3255
+ }
3205
3256
 
3206
- const defaultEmptyFunction = () => void 0;
3207
- const useOfficesAtmsMapData = ({ data, remoteWorkplaces = [], filtrationState = {}, getBalloon = defaultEmptyFunction, getBalloonRemoteWorkplaces = defaultEmptyFunction, }) => {
3208
- const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
3209
- const _filteredItems = filterItems$1(data, filtrationState);
3210
- const _filteredRemoteWorkplaces = filterItems$1(remoteWorkplaces, filtrationState);
3211
- const _points = [
3212
- ..._filteredItems.map((_) => ({
3213
- type: 'offices',
3214
- coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
3215
- content: getBalloon(_),
3216
- })),
3217
- ..._filteredRemoteWorkplaces.map((_) => ({
3218
- type: 'workplaces',
3219
- coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
3220
- content: getBalloonRemoteWorkplaces({
3221
- address: _.address,
3222
- workScheduleDescription: _.workScheduleDescription,
3223
- }),
3224
- })),
3225
- ].filter((_) => _.coords && _.coords.length === 2);
3226
- const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
3227
- return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
3228
- }, [data, remoteWorkplaces, filtrationState, getBalloon, getBalloonRemoteWorkplaces]);
3229
- return { filteredItems, points, filteredRemoteWorkplaces, lengthItems };
3230
- };
3257
+ const RegionField = JSX(({ field, input, url }) => {
3258
+ const regions = useRegions(url);
3259
+ return (jsx(SelectControl, { label: "\u0424\u0438\u043B\u0438\u0430\u043B", placeholder: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0438\u043B\u0438\u0430\u043B", isSearch: true, options: useMemo(() => regions?.map(({ code = '', name = '' }) => ({ key: code, text: name })), [regions]), ...getValidation(field('region'), validatorObj.region, input?.required) }));
3260
+ });
3231
3261
 
3232
- const RetailAddressField = JSX(({ field, input }) => {
3233
- const fieldRegion = field('regionRetail');
3234
- const fieldBranch = field('addressRetail');
3235
- const regions = useBranchesByRegions();
3236
- const regionKey = fieldRegion?.value?.key;
3237
- const selectedRegion = regions.find(({ region }) => region === regionKey);
3238
- const isLoad = !regions;
3239
- const regionText = fieldRegion?.value?.text;
3240
- const addressBranchRetail = useBranchesByRegions()?.find((_) => _?.region === regionText)?.branches;
3241
- useEffect(() => {
3242
- if (fieldRegion?.value?.key !== '') {
3243
- field?.('addressRetail')?.onChange?.('');
3244
- }
3245
- }, [fieldRegion?.value]);
3246
- const { points } = useOfficesAtmsMapData({
3247
- data: selectedRegion?.branches || [],
3248
- filtrationState: {},
3249
- getBalloon: getOfficePoint,
3250
- });
3251
- const isRegionSelected = Boolean(fieldRegion?.value?.key);
3252
- 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 = '' }) => ({
3253
- key: address,
3254
- text: address,
3255
- })), ...getValidation(field('addressRetail'), validatorObj.addressRetail, input?.required && isRegionSelected), isSearch: true }), jsx("div", { className: "h-[600px]", children: jsx(ClientOnly, { children: jsx(YandexMap, { points: points, isLoad: isLoad, className: "h-full", selectedAddress: fieldBranch?.value?.text }) }) })] }));
3262
+ const RegionPremiumField = JSX(({ field, input }) => {
3263
+ const branchByRegions = useBranchesByRegions(true);
3264
+ const regions = useMemo(() => branchByRegions?.map(({ region }) => ({
3265
+ key: region,
3266
+ text: region,
3267
+ })), [branchByRegions]);
3268
+ 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) }));
3256
3269
  });
3257
3270
 
3258
- const RetailRegionField = JSX(({ field, input }) => {
3259
- const regions = useBranchesByRegions();
3260
- 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", isSearch: true, options: useMemo(() => regions?.map(({ region = '' }) => ({ key: region, text: region })), [regions]), ...getValidation(field('regionRetail'), validatorObj.regionRetail, input?.required) }));
3271
+ const RegionRetailField = JSX(({ field, input }) => {
3272
+ const { data: regions } = useLeadFormData('REGION_RF');
3273
+ const formatRegions = regions?.map(({ key, value }) => ({ key, text: value }));
3274
+ 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", isSearch: true, options: formatRegions, ...getValidation(field('regionRetail'), validatorObj.regionRetail, input?.required) }));
3261
3275
  });
3262
3276
 
3263
- 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 })));
3277
+ const RetirementIncomeField = JSX(({ field, input }) => {
3278
+ const currentWages = field('wages')?.value;
3279
+ const onChange = useCallback((_) => {
3280
+ const incomesSum = Number(_) + Number(currentWages || 0);
3281
+ field('retirementIncome')?.onChange?.(_);
3282
+ field('incomeAverage')?.onChange?.(String(incomesSum));
3283
+ }, [currentWages]);
3284
+ return (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, onChange: onChange }));
3285
+ });
3264
3286
 
3265
3287
  const SecondaryPhoneField = JSX(({ field }) => {
3266
3288
  const fieldPhone = field('secondaryPhone');
@@ -3325,6 +3347,16 @@
3325
3347
  return (jsx("div", { className: "py-m gap-m grid @xl:flex @xl:items-center", children: jsx(RadioButtonGroup, { className: "whitespace-normal", orientation: "horizontal", items: VED_TYPES, value: value, onChange: (_) => onChange && onChange(_) }) }));
3326
3348
  });
3327
3349
 
3350
+ const WagesField = JSX(({ field, input }) => {
3351
+ const currentRetirementIncome = field('retirementIncome')?.value;
3352
+ const onChange = useCallback((_) => {
3353
+ const incomesSum = Number(_) + Number(currentRetirementIncome || 0);
3354
+ field('wages')?.onChange?.(_);
3355
+ field('incomeAverage')?.onChange?.(String(incomesSum));
3356
+ }, [currentRetirementIncome]);
3357
+ return (jsx(InputControl, { label: "\u0421\u043E\u0432\u043E\u043A\u0443\u043F\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('wages'), validatorObj.wages, input?.required), ...input, onChange: onChange }));
3358
+ });
3359
+
3328
3360
  function isRenderField({ input, field, }) {
3329
3361
  const { condition } = input;
3330
3362
  const { value } = field(condition?.name || '');
@@ -3412,8 +3444,8 @@
3412
3444
  participantDateRegistration: jsx(ParticipantDateRegistrationField, { field: field, input: input }),
3413
3445
  retirementIncome: jsx(RetirementIncomeField, { field: field, input: input }),
3414
3446
  otherIncome: jsx(OtherIncomeField, { field: field, input: input }),
3415
- mandatoryIncome: jsx(MandatoryIncomeField, { field: field, input: input }),
3416
- otherPayments: jsx(OtherPaymentsField, { field: field, input: input }),
3447
+ wages: jsx(WagesField, { field: field, input: input }),
3448
+ mandatoryPayments: jsx(MandatoryPaymentsField, { field: field, input: input }),
3417
3449
  disablePeopleFlg: jsx(DisablePeopleFlgField, { field: field, input: input }),
3418
3450
  bankruptcyFlg: jsx(BankruptcyFlgField, { field: field, input: input }),
3419
3451
  shareholderFlg: jsx(ShareholderFlgField, { field: field, input: input }),
@@ -3421,8 +3453,8 @@
3421
3453
  creditInRshbCd: jsx(CreditInRshbCdField, { field: field, input: input }),
3422
3454
  bankEmployeeCode: jsx(BankEmpoleeCodeField, { field: field, input: input }),
3423
3455
  partInBusiness: jsx(PartInBusinessField, { field: field, input: input }),
3424
- regionRetail: jsx(RetailRegionField, { field: field, input: input }),
3425
- addressRetail: jsx(RetailAddressField, { field: field, input: input }),
3456
+ regionRetail: jsx(RegionRetailField, { field: field, input: input }),
3457
+ addressRetail: jsx(AddressRetailField, { field: field, input: input }),
3426
3458
  addressMatch: jsx(AddressMatchField, { field: field, input: input }),
3427
3459
  paymentSystem: jsx(PaymentSystemField, { field: field, input: input }),
3428
3460
  currency: jsx(CurrencyField, { field: field, input: input }),
@@ -3523,6 +3555,7 @@
3523
3555
  posTerminal: false,
3524
3556
  consentToReceiveMaterials: false,
3525
3557
  consentDataProcessing: false,
3558
+ addressRetail: { key: '', text: '' },
3526
3559
  };
3527
3560
  const getInitialFormState$3 = (inputs, typeForm = '') => {
3528
3561
  const formState = Object.fromEntries(inputs.map((_) => [
@@ -3660,6 +3693,7 @@
3660
3693
  paymentSystem: '',
3661
3694
  cardCategory: { key: '', text: '' },
3662
3695
  codeWord: '',
3696
+ addressRetail: { key: '', text: '' },
3663
3697
  };
3664
3698
  const getInitialFormState$2 = (inputs, savedForm, typeForm = '') => {
3665
3699
  if (savedForm) {
@@ -4057,8 +4091,14 @@
4057
4091
  organizationAddress: 'WORK',
4058
4092
  };
4059
4093
  const fieldsNamesToIncomeKeysMap = {
4060
- mandatoryIncome: 'INCOME_AVERAGE',
4061
- otherPayments: 'MANDATORY_PAYMENTS',
4094
+ incomeAverage: 'INCOME_AVERAGE',
4095
+ mandatoryPayments: 'MANDATORY_PAYMENTS',
4096
+ additionalIncome: 'ADDITIONAL_INCOME',
4097
+ otherIncome: 'OTHER_INCOME',
4098
+ otherPayments: 'OTHER_PAYMENTS',
4099
+ rentalIncome: 'RENTAL_INCOME',
4100
+ wages: 'WAGES',
4101
+ retirementIncome: 'RETIREMENT_INCOME',
4062
4102
  };
4063
4103
  const getParticipantContacts = (fields) => Object.entries(fields).reduce((acc, [key, value]) => {
4064
4104
  if (key in fieldsNamesToContactKeysMap) {
@@ -4099,7 +4139,7 @@
4099
4139
  incomeTypeCd: {
4100
4140
  key: fieldsNamesToIncomeKeysMap[key],
4101
4141
  },
4102
- value,
4142
+ value: Number(value || 0),
4103
4143
  },
4104
4144
  ];
4105
4145
  }
@@ -5951,6 +5991,40 @@
5951
5991
  }
5952
5992
  }, type: "button", ...(isUnfolded ? getAspectsAttributes(data) : {}), children: [jsx("div", { children: isUnfolded ? 'Скрыть' : 'Подробнее о тарифе' }), jsx(Icon, { className: "text-primary-text", name: isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon', width: "16", height: "16" })] }));
5953
5993
 
5994
+ const PORTAL_NATURAL_URL = '/';
5995
+ const UPDATING_INTERVAL = 60000 * 4;
5996
+ const updateRefreshToken = () => {
5997
+ const refreshToken = globalThis.sessionStorage?.getItem('refreshToken');
5998
+ const accessToken = globalThis.sessionStorage?.getItem('accessToken');
5999
+ const taskId = globalThis.localStorage.getItem('taskId');
6000
+ if (!accessToken || !refreshToken || !taskId) {
6001
+ globalThis.location.href = PORTAL_NATURAL_URL;
6002
+ return () => null;
6003
+ }
6004
+ const updateTokenRequest = async () => {
6005
+ const res = await doRequest('/auth/refresh', 'POST', {
6006
+ // eslint-disable-next-line camelcase
6007
+ refresh_token: refreshToken,
6008
+ // eslint-disable-next-line camelcase
6009
+ access_token: accessToken,
6010
+ });
6011
+ if (res instanceof Response) {
6012
+ handleStatus(res.status);
6013
+ return;
6014
+ }
6015
+ globalThis.sessionStorage.setItem('refreshToken', res.refresh_token);
6016
+ globalThis.sessionStorage.setItem('accessToken', res.access_token);
6017
+ };
6018
+ updateTokenRequest();
6019
+ const timer = setInterval(updateTokenRequest, UPDATING_INTERVAL);
6020
+ return () => clearInterval(timer);
6021
+ };
6022
+ const handleStatus = (status) => {
6023
+ if (status == 401) {
6024
+ globalThis.location.href = PORTAL_NATURAL_URL;
6025
+ }
6026
+ };
6027
+
5954
6028
  const ProgressBar = JSX(({ step = 10, description, showPercentage = true }) => (jsxs("div", { children: [jsx("div", { className: "h-4 w-full bg-gray relative", children: jsx("div", { className: "h-4 bg-green", style: { width: `${step}%` } }) }), jsxs("div", { className: "relative", children: [showPercentage ? jsxs("div", { className: "absolute left-2/4 text-green", children: [step, "%"] }) : null, description ? jsx("div", { className: "text-right mr-4 text-gray", children: description }) : null] })] })));
5955
6029
 
5956
6030
  const CreditCardFormProgress = JSX(({ step = 1, totalSteps = 6, stepsTitles = [] }) => {
@@ -6153,8 +6227,8 @@
6153
6227
  dependents: undefined,
6154
6228
  familyMembers: undefined,
6155
6229
  confirmationIncome: { key: '', text: '' },
6156
- mandatoryIncome: undefined,
6157
- otherPayments: undefined,
6230
+ wages: undefined,
6231
+ mandatoryPayments: undefined,
6158
6232
  snils: '',
6159
6233
  armyIdFlg: false,
6160
6234
  },
@@ -6168,8 +6242,8 @@
6168
6242
  {
6169
6243
  regionRetail: '',
6170
6244
  addressRetail: {
6171
- fullAddress: '',
6172
- fiasCode: '',
6245
+ key: '',
6246
+ text: '',
6173
6247
  },
6174
6248
  bankEmployeeCode: undefined,
6175
6249
  addressCourier: {
@@ -6249,7 +6323,7 @@
6249
6323
  return (jsxs("div", { className: "flex justify-between gap-m", children: [jsx(Button, { onClick: onPrevStep, className: style('w-full @xl:w-auto'), type: "button", version: "secondary", disabled: isFirstStep, children: "\u041D\u0430\u0437\u0430\u0434" }), jsx(Button, { className: "w-full @xl:w-auto", type: "submit", children: "\u0414\u0430\u043B\u0435\u0435" })] }));
6250
6324
  });
6251
6325
 
6252
- const getFifthStepData = (formData) => {
6326
+ const getFifthStepData$1 = (formData) => {
6253
6327
  const { bankruptcyFlg, shareholderFlg, legalEntityName, creditInRshbCd } = formData;
6254
6328
  return {
6255
6329
  bankruptcyFlg,
@@ -6270,14 +6344,20 @@
6270
6344
  };
6271
6345
 
6272
6346
  const getFourthStepData$1 = (formData) => {
6273
- const { familyStatus, dependents, familyMembers, mandatoryIncome, otherPayments, snils, armyIdFlg, } = formData;
6347
+ const { familyStatus, dependents, familyMembers, wages, mandatoryPayments, incomeAverage, additionalIncome, otherIncome, otherPayments, rentalIncome, retirementIncome, snils, armyIdFlg, } = formData;
6274
6348
  return {
6275
6349
  maritalStatusCd: familyStatus,
6276
6350
  totalDependents: familyMembers,
6277
6351
  otherDependents: dependents,
6278
6352
  participantIncomes: getParticipantIncomes({
6279
- mandatoryIncome,
6353
+ wages,
6354
+ mandatoryPayments,
6355
+ incomeAverage,
6356
+ additionalIncome,
6357
+ otherIncome,
6280
6358
  otherPayments,
6359
+ rentalIncome,
6360
+ retirementIncome,
6281
6361
  }),
6282
6362
  snils: snils?.replaceAll(' ', ''),
6283
6363
  armyIdFlg,
@@ -6391,7 +6471,7 @@
6391
6471
  case 3:
6392
6472
  return getFourthStepData$1(formData);
6393
6473
  case 4:
6394
- return getFifthStepData(formData);
6474
+ return getFifthStepData$1(formData);
6395
6475
  case 5:
6396
6476
  return getSixthStepData(formData);
6397
6477
  default:
@@ -6668,11 +6748,11 @@
6668
6748
  },
6669
6749
  {
6670
6750
  columns: 1,
6671
- inputs: [{ fieldType: 'common', name: 'mandatoryIncome', required: true }],
6751
+ inputs: [{ fieldType: 'common', name: 'wages', required: true }],
6672
6752
  },
6673
6753
  {
6674
6754
  columns: 1,
6675
- inputs: [{ fieldType: 'common', name: 'otherPayments', required: true }],
6755
+ inputs: [{ fieldType: 'common', name: 'mandatoryPayments', required: true }],
6676
6756
  },
6677
6757
  {
6678
6758
  columns: 1,
@@ -6810,6 +6890,7 @@
6810
6890
  ];
6811
6891
  const CreditCardForm = JSX(({ className, ...rest }) => {
6812
6892
  const [step, setStep] = useState(0);
6893
+ useEffect(updateRefreshToken, []);
6813
6894
  const handleNextStep = useCallback(() => {
6814
6895
  setStep((_) => Math.min(_ + 1, WIZARD_STEPS$1));
6815
6896
  }, []);
@@ -6822,40 +6903,6 @@
6822
6903
  return (jsx(BlockWrapper, { className: style('bg-transparent', className), defaultPadding: "p-0", ...rest, children: jsxs("div", { className: "container grid grid-cols-12", children: [isFormFinished ? null : (jsx(CreditCardFormProgress, { stepsTitles: WIZARD_TITLES$1, step: step, totalSteps: WIZARD_STEPS$1 })), jsx("div", { className: "py-lg px-5xl mt-2xs bg-white col-span-12", children: jsx(CreditCardFormStep, { step: step, sections: sections, onNextStep: handleNextStep, onPrevStep: handlePrevStep, isFormFinished: isFormFinished, finishForm: setIsFormFinished }, String(step)) })] }) }));
6823
6904
  });
6824
6905
 
6825
- const PORTAL_NATURAL_URL = '/';
6826
- const UPDATING_INTERVAL = 60000 * 4;
6827
- const updateRefreshToken = () => {
6828
- const refreshToken = globalThis.sessionStorage?.getItem('refreshToken');
6829
- const accessToken = globalThis.sessionStorage?.getItem('accessToken');
6830
- const taskId = globalThis.localStorage.getItem('taskId');
6831
- if (!accessToken || !refreshToken || !taskId) {
6832
- globalThis.location.href = PORTAL_NATURAL_URL;
6833
- return () => null;
6834
- }
6835
- const updateTokenRequest = async () => {
6836
- const res = await doRequest('/auth/refresh', 'POST', {
6837
- // eslint-disable-next-line camelcase
6838
- refresh_token: refreshToken,
6839
- // eslint-disable-next-line camelcase
6840
- access_token: accessToken,
6841
- });
6842
- if (res instanceof Response) {
6843
- handleStatus(res.status);
6844
- return;
6845
- }
6846
- globalThis.sessionStorage.setItem('refreshToken', res.refresh_token);
6847
- globalThis.sessionStorage.setItem('accessToken', res.access_token);
6848
- };
6849
- updateTokenRequest();
6850
- const timer = setInterval(updateTokenRequest, UPDATING_INTERVAL);
6851
- return () => clearInterval(timer);
6852
- };
6853
- const handleStatus = (status) => {
6854
- if (status == 401) {
6855
- globalThis.location.href = PORTAL_NATURAL_URL;
6856
- }
6857
- };
6858
-
6859
6906
  const CreditFormProgress = JSX(({ step = 1, totalSteps = 5, stepsTitles = [] }) => {
6860
6907
  const progress = useMemo(() => (step / totalSteps) * 100, [step, totalSteps]);
6861
6908
  return (jsx("div", { className: "py-lg px-5xl bg-white col-span-12", children: jsxs("div", { children: [jsxs("span", { className: "font-bold mr-s", children: ["\u0428\u0430\u0433 ", step, " \u0438\u0437 ", totalSteps, "."] }), stepsTitles[step] || null, jsx(ProgressBar, { step: progress, showPercentage: false })] }) }));
@@ -7047,8 +7094,8 @@
7047
7094
  dependents: undefined,
7048
7095
  familyMembers: undefined,
7049
7096
  confirmationIncome: { key: '', text: '' },
7050
- mandatoryIncome: undefined,
7051
- otherPayments: undefined,
7097
+ wages: undefined,
7098
+ mandatoryPayments: undefined,
7052
7099
  snils: '',
7053
7100
  armyIdFlg: false,
7054
7101
  },
@@ -7133,6 +7180,13 @@
7133
7180
  return (jsxs("div", { className: 'flex justify-between', children: [jsx(Button, { onClick: onPrevStep, className: style('w-full @xl:w-auto'), type: "button", version: "secondary", disabled: isFirstStep, children: "\u041D\u0430\u0437\u0430\u0434" }), jsx(Button, { className: style('w-full @xl:w-auto'), type: "submit", children: "\u0414\u0430\u043B\u0435\u0435" })] }));
7134
7181
  });
7135
7182
 
7183
+ const getFifthStepData = (formData) => {
7184
+ const { addressRetail } = formData;
7185
+ return {
7186
+ office: addressRetail?.key ? { id: addressRetail.key } : undefined,
7187
+ };
7188
+ };
7189
+
7136
7190
  const getFirstStepData = (formData) => {
7137
7191
  const { name, surname, middleName, birthday = '', phone = '', email, sex, birthPlace, dulIssueDateField = '', dulIssuedBy, dulNumber, dulSerie, dulSubdivisionCode, education, participantDateRegistration = '', housing, addressRegistration, addressFact, } = formData;
7138
7192
  return {
@@ -7197,15 +7251,21 @@
7197
7251
  };
7198
7252
 
7199
7253
  const getThirdStepData = (formData) => {
7200
- const { familyStatus, dependents, familyMembers, confirmationIncome, mandatoryIncome, otherPayments, snils, armyIdFlg, } = formData;
7254
+ const { familyStatus, dependents, familyMembers, confirmationIncome, wages, mandatoryPayments, incomeAverage, additionalIncome, otherIncome, otherPayments, rentalIncome, retirementIncome, snils, armyIdFlg, } = formData;
7201
7255
  return {
7202
7256
  maritalStatusCd: familyStatus,
7203
7257
  totalDependents: familyMembers,
7204
7258
  incomeCertificateCd: confirmationIncome,
7205
7259
  otherDependents: dependents,
7206
7260
  participantIncomes: getParticipantIncomes({
7207
- mandatoryIncome,
7261
+ wages,
7262
+ mandatoryPayments,
7263
+ incomeAverage,
7264
+ additionalIncome,
7265
+ otherIncome,
7208
7266
  otherPayments,
7267
+ rentalIncome,
7268
+ retirementIncome,
7209
7269
  }),
7210
7270
  snils: snils?.replaceAll(' ', ''),
7211
7271
  armyIdFlg,
@@ -7232,7 +7292,7 @@
7232
7292
  taskSource: globalThis.location.origin,
7233
7293
  id: taskId,
7234
7294
  office: {
7235
- id: '650', // TODO: Remove hardcode
7295
+ id: '',
7236
7296
  },
7237
7297
  authorizedAgentId: formData?.bankEmployeeCode,
7238
7298
  participants: [
@@ -7249,6 +7309,7 @@
7249
7309
  },
7250
7310
  ],
7251
7311
  ...getZeroStepData(formData),
7312
+ ...getFifthStepData(formData),
7252
7313
  esiaAccountTypeCd: {
7253
7314
  key: formData?.esiaAccountTypeCd?.key,
7254
7315
  },
@@ -7527,11 +7588,11 @@
7527
7588
  },
7528
7589
  {
7529
7590
  columns: 1,
7530
- inputs: [{ fieldType: 'common', name: 'mandatoryIncome', required: true }],
7591
+ inputs: [{ fieldType: 'common', name: 'wages', required: true }],
7531
7592
  },
7532
7593
  {
7533
7594
  columns: 1,
7534
- inputs: [{ fieldType: 'common', name: 'otherPayments', required: true }],
7595
+ inputs: [{ fieldType: 'common', name: 'mandatoryPayments', required: true }],
7535
7596
  },
7536
7597
  {
7537
7598
  columns: 1,
@@ -9531,7 +9592,7 @@
9531
9592
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
9532
9593
  });
9533
9594
 
9534
- const packageVersion = "0.14.664";
9595
+ const packageVersion = "0.14.666";
9535
9596
 
9536
9597
  exports.Blocks = Blocks;
9537
9598
  exports.ContentPage = ContentPage;