@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
@@ -1504,6 +1504,7 @@
1504
1504
  feedbackMethod: defaultSelectValidator(),
1505
1505
  serviceType: defaultSelectValidator(),
1506
1506
  serviceDirection: defaultSelectValidator(),
1507
+ regionRetail: defaultSelectValidator('Выберите регион'),
1507
1508
  meetingDay: defaultValidator(),
1508
1509
  product: defaultValidator(),
1509
1510
  localities: defaultValidator(),
@@ -1530,15 +1531,14 @@
1530
1531
  participantDateRegistration: defaultValidator('Укажите дату регистрации'),
1531
1532
  retirementIncome: defaultValidator(),
1532
1533
  otherIncome: defaultValidator(),
1533
- mandatoryIncome: defaultValidator(),
1534
- otherPayments: defaultValidator(),
1534
+ wages: defaultValidator(),
1535
+ mandatoryPayments: defaultValidator(),
1535
1536
  disablePeopleFlg: defaultValidator(),
1536
1537
  bankruptcyFlg: defaultValidator(),
1537
1538
  shareholderFlg: defaultValidator(),
1538
1539
  legalEntityName: defaultValidator(),
1539
1540
  bankEmployeeCode: defaultValidator(),
1540
1541
  partInBusiness: defaultValidator(),
1541
- regionRetail: defaultSelectValidator('Выберите филиал банка'),
1542
1542
  addressRetail: defaultSelectValidator('Выберите адрес банка'),
1543
1543
  addressMatch: defaultValidator(),
1544
1544
  codeWord: codeWordValidator('Необходимо ввести кодовое слово'),
@@ -1796,1463 +1796,1485 @@
1796
1796
  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) }));
1797
1797
  });
1798
1798
 
1799
- const useNormalizedInput = (props, { normalize, format }) => {
1800
- const { value, onFocus, onBlur, onChange } = props;
1801
- const [isFocused, setIsFocused] = useState(false);
1802
- const handleFocus = useCallback((ev) => {
1803
- setIsFocused(true);
1804
- onFocus && onFocus(ev);
1805
- }, []);
1806
- const handleBlur = useCallback(() => {
1807
- setIsFocused(false);
1808
- onChange && onChange(normalize(value));
1809
- onBlur && onBlur();
1810
- }, [onChange, value]);
1811
- return {
1812
- value: (isFocused || !format ? value : format(value)),
1813
- onFocus: handleFocus,
1814
- onBlur: handleBlur,
1815
- };
1816
- };
1817
-
1818
- const clamp = (value, min, max) => Math.max(min, Math.min(value, max));
1819
-
1820
- function parseDecimal(value) {
1821
- const rawValue = (value || '').replace(/\D/g, '');
1822
- const unsafeDecimal = parseInt(rawValue, 10);
1823
- return Number.isNaN(unsafeDecimal) ? 0 : unsafeDecimal;
1824
- }
1799
+ 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, {
1800
+ 'backdrop-blur': blur,
1801
+ }), 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" }) })));
1825
1802
 
1826
- function renderRangeWithTicks({ list = [], min, max, step, value = list[0] || min, disabled, onChange, }) {
1827
- const rangeValue = list.length ? list.indexOf(value) : value;
1828
- const rangeValueShift = rangeValue > min ? rangeValue - min : 0;
1829
- const percentage = (rangeValueShift * 100) / (max - min);
1830
- const inputStyle = {
1831
- backgroundSize: `${percentage.toFixed(2)}% 100%`,
1832
- };
1833
- 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) => {
1834
- const rawValue = parseDecimal(ev.target?.value);
1835
- const newValue = list.length ? list[rawValue] : rawValue;
1836
- onChange && onChange(newValue || 0);
1837
- }) }) })] }));
1803
+ const MapMarkerClusterIcon = '/icons/MapMarkerClusterIcon.svg';
1804
+ const MapMarkerClusterYellowIcon = '/icons/MapMarkerClusterYellowIcon.svg';
1805
+ function renderClusterer({ yandexMaps, map, points, isLoad, }) {
1806
+ if (isLoad || !points) {
1807
+ return;
1808
+ }
1809
+ map.geoObjects.removeAll();
1810
+ if (!points.length) {
1811
+ return;
1812
+ }
1813
+ const clusterIconContentLayout = yandexMaps.templateLayoutFactory.createClass('<div style="margin-top: -3px;">{{properties.geoObjects.length}}</div>');
1814
+ const officeClusterer = defineClusterer('offices', yandexMaps, clusterIconContentLayout);
1815
+ if (points.length && points.every((_) => 'type' in _)) {
1816
+ const remoteWorkplaceClusterer = defineClusterer('workplaces', yandexMaps, clusterIconContentLayout);
1817
+ const remoteWorkplaceGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'workplaces'), 'workplaces', yandexMaps);
1818
+ const officesGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'offices'), 'offices', yandexMaps);
1819
+ officeClusterer.add(officesGeoObjects);
1820
+ remoteWorkplaceClusterer.add(remoteWorkplaceGeoObjects);
1821
+ map.geoObjects.add(remoteWorkplaceClusterer);
1822
+ map.geoObjects.add(officeClusterer);
1823
+ }
1824
+ else {
1825
+ const geoObjects = defineGeoObjects(points, 'offices', yandexMaps);
1826
+ officeClusterer.add(geoObjects);
1827
+ map.geoObjects.add(officeClusterer);
1828
+ }
1829
+ map.setBounds(yandexMaps.util.bounds.fromPoints(points.map((_) => _.coords))).then(() => {
1830
+ if (map.getZoom() > 10) {
1831
+ map.setZoom(10);
1832
+ }
1833
+ });
1838
1834
  }
1839
-
1840
- const inputDisabledStyle = 'disabled:border-gray disabled:bg-main-divider';
1841
- const DEFAULT_MIN = 1;
1842
- const DEFAULT_MAX = 100;
1843
- const InputRange = JSX((props) => {
1844
- 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;
1845
- const normalizedProps = useNormalizedInput(props, {
1846
- normalize: (_ = 0) => list.length ? closestValue(list)(_) : clamp(_, min, max),
1847
- format: toLocalNumberFormat(),
1835
+ const defineClusterer = (type, yandexMaps, clusterIconContentLayout) => {
1836
+ return new yandexMaps.Clusterer({
1837
+ clusterIcons: [
1838
+ {
1839
+ href: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
1840
+ size: [78, 84],
1841
+ offset: [-35, -50],
1842
+ },
1843
+ ],
1844
+ clusterIconContentLayout,
1845
+ clusterHideIconOnBalloonOpen: false,
1846
+ geoObjectHideIconOnBalloonOpen: false,
1848
1847
  });
1849
- const handleChange = useCallback((ev) => {
1850
- onChange && onChange(parseDecimal(ev.target?.value));
1851
- }, [onChange]);
1852
- 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)] }));
1853
- });
1854
- const closestValue = (list) => (_) => list.reduce((prev, curr) => (Math.abs(curr - _) < Math.abs(prev - _) ? curr : prev));
1855
- 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)))) }));
1856
-
1857
- const MIN_CREDIT_AMOUNT = 1000;
1858
- const MAX_CREDIT_AMOUNT = 1000000000;
1859
- const ITEMS_CREDIT_AMOUNT = ['От 1 000 ₽', 'До 1 000 000 000 ₽'];
1860
- 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') })));
1861
-
1862
- const useLeadFormData = (typeField) => {
1863
- const { data, error } = useAsyncData(`/api/v1/dictionary?dictionaryType=${encodeURIComponent(typeField)}`, fetchData);
1864
- if (data && 'errorMessage' in data) {
1865
- return { error };
1866
- }
1867
- return { data: data, error };
1868
1848
  };
1869
- const fetchData = async (url) => {
1870
- const result = await fetchJSON(url, { method: 'POST' });
1871
- return result || [];
1849
+ const defineGeoObjects = (pointArr, type, yandexMaps) => {
1850
+ return pointArr.map(({ coords, content }) => new yandexMaps.Placemark(coords, {
1851
+ balloonContentHeader: content?.header,
1852
+ balloonContentBody: content?.body,
1853
+ balloonContentFooter: content?.footer,
1854
+ hintContent: content?.hint,
1855
+ }, {
1856
+ iconLayout: 'default#image',
1857
+ iconImageHref: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
1858
+ iconImageSize: [78, 84],
1859
+ iconImageOffset: [-35, -50],
1860
+ }));
1872
1861
  };
1873
1862
 
1874
- const SelectField = UniBlock(({ field, source, label, fieldName, input }) => {
1875
- const leadOptions = (source &&
1876
- source?.map((_) => ({
1877
- key: _.key || '',
1878
- text: _.value,
1879
- }))) ||
1880
- [];
1881
- 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) }));
1882
- });
1883
-
1884
- const AmountWorkersField = JSX(({ field, input }) => {
1885
- const { data: amountWorkers } = useLeadFormData('EMPLOYEES_NUMBER');
1886
- 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 }));
1887
- });
1888
-
1889
- 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) })));
1890
-
1891
- 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) })));
1892
-
1893
- 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 })));
1894
-
1895
- 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') })));
1863
+ const defaultStyle = {
1864
+ focus: 'focus:border-primary-text focus:border',
1865
+ hover: 'hover:bg-primary-hover',
1866
+ active: 'active:bg-primary-active',
1867
+ font: 'text-center font-sans',
1868
+ };
1896
1869
 
1897
- 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) })));
1870
+ const styles$1 = {
1871
+ ...defaultStyle,
1872
+ border: 'border border-transparent rounded-md',
1873
+ position: 'absolute flex items-center justify-center',
1874
+ };
1875
+ const renderUserGeolocation = (map, yandexMaps, className) => {
1876
+ const setUserGeoLocation = () => {
1877
+ // eslint-disable-next-line @typescript-eslint/ban-ts-comment
1878
+ // @ts-ignore
1879
+ yandexMaps.geolocation
1880
+ .get({
1881
+ provider: 'yandex',
1882
+ autoReverseGeocode: true,
1883
+ mapStateAutoApply: true,
1884
+ })
1885
+ .then(function (result) {
1886
+ map.current.geoObjects.add(result.geoObjects);
1887
+ });
1888
+ };
1889
+ 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" }) }));
1890
+ };
1898
1891
 
1899
- const useElementSpace = (ref, heightEl) => {
1900
- const [spaceAbove, setSpaceAbove] = useState(false);
1892
+ const getNS = (_) => globalThis[_];
1893
+ const initializeExternalNS = (namespaceName, url) => {
1894
+ const script = document.getElementById(url);
1895
+ if (script) {
1896
+ const ns = getNS(namespaceName);
1897
+ if (ns) {
1898
+ return Promise.resolve(ns);
1899
+ }
1900
+ else {
1901
+ return new Promise((resolve) => {
1902
+ script.addEventListener('load', () => {
1903
+ resolve(getNS(namespaceName));
1904
+ });
1905
+ });
1906
+ }
1907
+ }
1908
+ else {
1909
+ return new Promise((resolve, reject) => {
1910
+ const newScript = document.createElement('script');
1911
+ newScript.src = url;
1912
+ newScript.async = true;
1913
+ newScript.id = url;
1914
+ newScript.addEventListener('load', () => {
1915
+ resolve(getNS(namespaceName));
1916
+ });
1917
+ newScript.addEventListener('error', (error) => {
1918
+ reject(error);
1919
+ });
1920
+ document.head.appendChild(newScript);
1921
+ });
1922
+ }
1923
+ };
1924
+ function useExternalNS(namespaceName, url, unmountNS = true) {
1925
+ const [externalNS, setExternalNS] = useState(undefined);
1901
1926
  useEffect(() => {
1902
- const handleResize = () => {
1903
- if (ref?.current) {
1904
- const { top } = ref.current.getBoundingClientRect();
1905
- const hasSpaceAbove = top > heightEl;
1906
- setSpaceAbove(hasSpaceAbove);
1927
+ let isMounted = true;
1928
+ initializeExternalNS(namespaceName, url)
1929
+ .then((ns) => {
1930
+ if (isMounted) {
1931
+ setExternalNS(ns);
1932
+ }
1933
+ })
1934
+ .catch((error) => {
1935
+ console.error(`Failed to initialize external namespace: ${error}`);
1936
+ });
1937
+ return () => {
1938
+ isMounted = false;
1939
+ if (unmountNS) {
1940
+ const script = document.getElementById(url);
1941
+ if (script) {
1942
+ document.head.removeChild(script);
1943
+ }
1944
+ setExternalNS(undefined);
1907
1945
  }
1908
1946
  };
1909
- handleResize();
1910
- window.addEventListener('resize', handleResize);
1911
- return () => window.removeEventListener('resize', handleResize);
1912
- }, [ref]);
1913
- return spaceAbove;
1947
+ }, [namespaceName, url, unmountNS]);
1948
+ return externalNS;
1949
+ }
1950
+
1951
+ const YMAPS_NAMESPACE = 'ymaps';
1952
+ const useYandexMaps = () => {
1953
+ const url = `https://api-maps.yandex.ru/2.1/?apikey=${projectSettings.YANDEX_MAP_API_KEY || ''}&lang=ru_RU`;
1954
+ return useExternalNS(YMAPS_NAMESPACE, url, false);
1914
1955
  };
1915
1956
 
1916
- const DAY_COUNT = 6;
1917
- const WEEK_COUNT = 7;
1918
- const renderCalendarCells = ({ today, firstDayOfWeek, totalDays, currentMonth, currentYear, min, max, onDateClick, }) => {
1919
- const calendarCells = [];
1920
- let dayCounter = 1;
1921
- for (let i = 0; i < DAY_COUNT; i++) {
1922
- const rowCells = [];
1923
- for (let j = 0; j < WEEK_COUNT; j++) {
1924
- if (i === 0 && j < firstDayOfWeek) {
1925
- rowCells.push(jsx("td", {}, `empty-${j}`));
1926
- }
1927
- else if (dayCounter > totalDays) {
1928
- rowCells.push(jsx("td", {}, `empty-${j}`));
1929
- }
1930
- else {
1931
- const currentDate = new Date(currentYear, currentMonth, dayCounter);
1932
- const isToday = checkIsToday(currentDate, today);
1933
- const isDisabled = checkIsDisabled(currentDate, min, max);
1934
- rowCells.push(jsx("td", { children: jsx("div", { className: getDayStyles(isToday, isDisabled), onClick: () => !isDisabled && onDateClick(currentDate), children: dayCounter }) }, `day-${dayCounter}`));
1935
- dayCounter++;
1936
- }
1937
- }
1938
- calendarCells.push(jsx("tr", { children: rowCells }, `row-${i}`));
1939
- }
1940
- return calendarCells;
1957
+ const styles = {
1958
+ ...defaultStyle,
1959
+ border: 'border-b border-b-2 border-gray last:border-0',
1960
+ position: 'relative flex items-center justify-center',
1941
1961
  };
1942
- const checkIsToday = (currentDate, today) => today && currentDate.toDateString() === today.toDateString();
1943
- const checkIsDisabled = (currentDate, min, max) => (min && currentDate.getTime() < min.getTime()) || (max && currentDate.getTime() > max.getTime());
1944
- const getDayStyles = (isToday = false, isDisabled = false) => style('p-s text-center rounded-md border', {
1945
- 'border-transparent hover:bg-gray': !isToday,
1946
- }, isDisabled ? 'text-gray hover:bg-transparent' : 'cursor-pointer');
1947
-
1948
- const WEEK_DAYS = ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'];
1949
- const Calendar = JSX(({ today, currentMonth, currentYear, min, max, onDateSelect = noop, setValue = noop }) => {
1950
- const handleDateClick = useCallback((date) => {
1951
- onDateSelect(date);
1952
- setValue(false);
1953
- }, []);
1954
- const { firstDayOfWeek, totalDays } = useMemo(() => ({
1955
- firstDayOfWeek: new Date(currentYear, currentMonth, 1).getDay() - 1,
1956
- totalDays: new Date(currentYear, currentMonth + 1, 0).getDate(),
1957
- }), [currentYear, currentMonth]);
1958
- 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({
1959
- firstDayOfWeek,
1960
- today,
1961
- totalDays,
1962
- currentYear,
1963
- currentMonth,
1964
- min,
1965
- max,
1966
- onDateClick: handleDateClick,
1967
- }) })] }));
1962
+ // TODO: Добавить метод определения центральной точки
1963
+ const ZoomButton = JSX(({ yandexMaps, direction = 'in' }) => {
1964
+ const iconName = direction === 'in' ? 'PlusIcon' : 'MinusIcon';
1965
+ const changeZoom = () => {
1966
+ const currentZoom = yandexMaps.current.getZoom();
1967
+ const newZoom = direction === 'in' ? currentZoom + 1 : currentZoom - 1;
1968
+ yandexMaps.current.setZoom(newZoom, { checkZoomRange: true });
1969
+ };
1970
+ 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" }) }));
1968
1971
  });
1969
1972
 
1970
- const months = [
1971
- 'Январь',
1972
- 'Февраль',
1973
- 'Март',
1974
- 'Апрель',
1975
- 'Май',
1976
- 'Июнь',
1977
- 'Июль',
1978
- 'Август',
1979
- 'Сентябрь',
1980
- 'Октябрь',
1981
- 'Ноябрь',
1982
- 'Декабрь',
1983
- ];
1984
-
1985
- function normalizeWithMask(value, pattern) {
1986
- const valueNumbers = value.replace(/\D/g, '');
1987
- if (valueNumbers === '' || value?.length === pattern.length) {
1988
- return value;
1989
- }
1990
- const patternInArr = [...pattern];
1991
- const firstPlaceholderIndex = patternInArr.findIndex(isPlaceholder$1);
1992
- const valueWildcardIndicies = patternInArr.map((_, i) => isWildcard$1(_) ? patternInArr.slice(0, i).filter(isWildcard$1).length : -1);
1993
- const applyPlaceholder = (_, i) => isDigit$1(_) ? _ : valueNumbers.charAt(valueWildcardIndicies[i]) || _;
1994
- const resultInArr = patternInArr.map(applyPlaceholder);
1995
- const resultLength = valueWildcardIndicies.indexOf(valueNumbers.length - 1) + 1;
1996
- return resultInArr.slice(0, Math.max(firstPlaceholderIndex, resultLength)).join('');
1997
- }
1998
- const isPlaceholder$1 = (_) => _ === '_';
1999
- const isDigit$1 = (_) => /\d/.test(_);
2000
- const isWildcard$1 = (_) => isPlaceholder$1(_) || isDigit$1(_);
2001
-
2002
- const START_YEAR = 1940;
2003
- const getYears = () => Array.from({ length: new Date().getFullYear() - START_YEAR + 1 }, (_, i) => START_YEAR + i);
2004
-
2005
- const ICON_PROPS$1 = {
2006
- name: 'CalendarIcon',
2007
- iconVersion: 'black',
2008
- width: '24',
2009
- height: '24',
2010
- };
2011
- const DatePickerInput = JSX(({ setSelectedMonth, setSelectedYear, className, value, disabled, onChange, onClick }) => {
2012
- const ref = useRef(null);
2013
- const [inputValue, setInputValue] = useState(value || '');
2014
- const handleChange = (ev) => {
2015
- const val = ev.target?.value;
2016
- if (typeof val === 'string' && val?.length < 11) {
2017
- setInputValue(normalizeWithMask(val, '__.__.____'));
2018
- }
2019
- };
2020
- const onBlur = () => {
2021
- if (checkIsValidDate(inputValue)) {
2022
- const [day, month, year] = inputValue.split('.');
2023
- onChange?.(new Date(Number(year), Number(month) - 1, Number(day)));
2024
- setSelectedMonth(Number(month) - 1);
2025
- setSelectedYear(Number(year));
1973
+ const DEFAULT_CENTER_COORDS = [55.753995, 37.614069];
1974
+ // TODO: Поле для поиска: невыяснено среди каких данных делать поиск (искать в имени офиса, в адресе, метро и т.д.).
1975
+ // Сейчас реализован поиск среди тестовых данных
1976
+ // TODO: Также выяснить что делать когда ничего не найдено
1977
+ // TODO: На макетах также когда есть поле поиска нет кнопки открыть на карте.
1978
+ const YandexMap = JSX(({ points, className = '', zoom = 5, isLoad, selectedAddress }) => {
1979
+ const map = useRef(null);
1980
+ const yandexMaps = useYandexMaps();
1981
+ useEffect(() => {
1982
+ if (map.current) {
1983
+ renderClusterer({ yandexMaps, map: map.current, points, isLoad, selectedAddress });
2026
1984
  }
2027
1985
  else {
2028
- setInputValue(value || '');
2029
- }
2030
- };
2031
- const onInputClick = () => {
2032
- if (ref.current !== null) {
2033
- ref.current.focus();
1986
+ yandexMaps?.ready(() => {
1987
+ // Ready function may be called few times, but must be called once
1988
+ if (map.current) {
1989
+ renderClusterer({ yandexMaps, map: map.current, points, isLoad });
1990
+ return;
1991
+ }
1992
+ map.current = new yandexMaps.Map('map', {
1993
+ center: getCenterPoint(points),
1994
+ zoom,
1995
+ controls: [],
1996
+ suppressMapOpenBlock: true,
1997
+ });
1998
+ renderClusterer({ yandexMaps, map: map.current, points, isLoad });
1999
+ });
2034
2000
  }
2035
- onClick?.();
2036
- };
2001
+ }, [yandexMaps, points, zoom, isLoad, selectedAddress]);
2037
2002
  useEffect(() => {
2038
- setInputValue(value || '');
2039
- }, [value]);
2040
- 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 })] }));
2041
- });
2042
- const isValidYear = (year) => Number(year) >= START_YEAR && Number(year) <= new Date().getFullYear();
2043
- const isValidMonth = (month) => Number(month) > 0 && Number(month) < 13;
2044
- const checkIsValidDate = (date) => {
2045
- const [day, month, year] = date.split('.');
2046
- if (isValidYear(year)) {
2047
- if (isValidMonth(month)) {
2048
- const currentDate = new Date(Number(year), Number(month) - 1, 1);
2049
- let maxDateOfMonth = 0;
2050
- while (currentDate.getMonth() === Number(month) - 1) {
2051
- currentDate.setDate(currentDate.getDate() + 1);
2052
- maxDateOfMonth++;
2053
- }
2054
- if (Number(day) > 0 && Number(day) <= maxDateOfMonth) {
2055
- return true;
2056
- }
2003
+ if (map.current && selectedAddress) {
2004
+ yandexMaps?.geocode(selectedAddress).then((res) => {
2005
+ const firstGeoObject = res.geoObjects.get(0);
2006
+ const coords = firstGeoObject.geometry.getCoordinates();
2007
+ map.current.setCenter(coords);
2008
+ map.current.setZoom(18);
2009
+ });
2057
2010
  }
2011
+ }, [selectedAddress]);
2012
+ if (!yandexMaps) {
2013
+ return null;
2058
2014
  }
2059
- return false;
2015
+ const zIndex = 'z-10';
2016
+ 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))] }));
2017
+ });
2018
+ const getCenterPoint = (points) => {
2019
+ const centerCoords = [
2020
+ getArraySumAndAverage(mapByIndex(points, 0)),
2021
+ getArraySumAndAverage(mapByIndex(points, 1)),
2022
+ ];
2023
+ return centerCoords.every((_) => _) ? centerCoords : DEFAULT_CENTER_COORDS;
2060
2024
  };
2025
+ const mapByIndex = (points, index) => points.map((_) => _.coords?.[index]);
2026
+ const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
2061
2027
 
2062
- const formStyle = 'flex justify-between items-center h-14 border rounded-md cursor-pointer ' +
2063
- 'hover:border-black active:border-black focus:border-black';
2064
- 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') }));
2028
+ async function doRequest(url, method, body) {
2029
+ const response = await fetch(`${API_BASE_URI}${url}`, {
2030
+ method,
2031
+ headers: {
2032
+ 'Content-Type': 'application/json',
2033
+ ...getAuthorizationHeaders(),
2034
+ },
2035
+ credentials: 'include',
2036
+ body: body ? JSON.stringify(body) : null,
2037
+ });
2038
+ // TODO: add error handling
2039
+ return isJSON(response) ? response.json() : response;
2040
+ }
2041
+ // TODO: Need delete isJSON
2042
+ const isJSON = (response) => response.headers.get('Content-Type') === 'application/json';
2043
+ const getAuthorizationHeaders = () => {
2044
+ const token = sessionStorage.getItem('accessToken');
2045
+ return token ? { Authorization: `Bearer ${token}` } : null;
2046
+ };
2065
2047
 
2066
- const MONTHS_COUNT = 11;
2067
- const MONTHS_OPTIONS = months.map((key) => ({ key }));
2068
- const YEARS_OPTIONS = getYears()
2069
- .reverse()
2070
- .map((key) => ({ key: String(key) }));
2071
- const useDatePickerManager = ({ onShowCalendar, showCalendar, selectedMonth, onMonthSelect, onYearSelect, selectedYear, onChange, value, }) => {
2072
- const close = useCallback(() => showCalendar && onShowCalendar(false), [showCalendar]);
2073
- const ref = useOutsideClick(close);
2074
- const handleChangeVisibleCalendar = useCallback(() => onShowCalendar(!showCalendar), [showCalendar]);
2075
- const handleNextMonth = useCallback(() => {
2076
- if (selectedMonth + 1 <= MONTHS_COUNT) {
2077
- onMonthSelect(selectedMonth + 1);
2078
- }
2079
- else {
2080
- onMonthSelect(0);
2081
- onYearSelect(selectedYear + 1);
2082
- }
2083
- }, [selectedMonth]);
2084
- const handlePrevMonth = useCallback(() => {
2085
- if (selectedMonth - 1 >= 0) {
2086
- onMonthSelect(selectedMonth - 1);
2087
- }
2088
- else {
2089
- onMonthSelect(11);
2090
- onYearSelect(selectedYear - 1);
2048
+ const regionOffices = async (regionKey) => {
2049
+ const response = await doRequest('/public-data/regionOffices', 'POST', {
2050
+ regionRfCd: {
2051
+ key: regionKey,
2052
+ },
2053
+ cashCardFlg: true,
2054
+ });
2055
+ return await response.json().then((_) => _?.offices?.map((office) => ({
2056
+ ...office,
2057
+ gpsLatitude: (office.latitude ?? DEFAULT_CENTER_COORDS[0]).toString().replace(',', '.'),
2058
+ gpsLongitude: (office.longitude ?? DEFAULT_CENTER_COORDS[1]).toString().replace(',', '.'),
2059
+ })));
2060
+ };
2061
+
2062
+ const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
2063
+ const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
2064
+ const onToggle = useCallback(() => {
2065
+ setIsUnfolded((_) => !_);
2066
+ }, []);
2067
+ const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
2068
+ const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
2069
+ return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
2070
+ });
2071
+
2072
+ function useResizeObserver(callback, deps) {
2073
+ const ref = useRef(null);
2074
+ useEffect(() => {
2075
+ const element = ref?.current;
2076
+ if (!element) {
2077
+ return undefined;
2091
2078
  }
2092
- }, [selectedMonth]);
2093
- const handleSelectMonth = useCallback(({ key }) => {
2094
- onMonthSelect(months.indexOf(key));
2095
- const maxDateOfMonth = calculateMaxDaysOfMonth(selectedYear, months.indexOf(key));
2096
- handleChangeMonth({
2097
- maxDateOfMonth,
2098
- selectedYear,
2099
- selectedMonth: months.indexOf(key),
2100
- value,
2101
- onChange,
2079
+ const observer = new ResizeObserver((entries) => {
2080
+ callback(element, entries[0]);
2102
2081
  });
2103
- }, [value]);
2104
- const handleSelectYear = useCallback(({ key }) => {
2105
- onYearSelect(Number(key));
2106
- value && onChange?.(new Date(Number(key), selectedMonth, value?.getDate()));
2107
- }, [value]);
2108
- return {
2109
- handleChangeVisibleCalendar,
2110
- handleNextMonth,
2111
- handlePrevMonth,
2112
- handleSelectMonth,
2113
- handleSelectYear,
2114
- monthsOptions: MONTHS_OPTIONS,
2115
- yearsOptions: YEARS_OPTIONS,
2116
- ref,
2117
- };
2082
+ observer.observe(element);
2083
+ return () => {
2084
+ observer.disconnect();
2085
+ };
2086
+ }, [callback, ...deps]);
2087
+ return ref;
2088
+ }
2089
+
2090
+ const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
2091
+ const containerRef = useRef(null);
2092
+ const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
2093
+ if (containerRef.current) {
2094
+ containerRef.current.style.maxHeight = isUnfolded
2095
+ ? `${childrenWrapperEl.scrollHeight}px`
2096
+ : '';
2097
+ }
2098
+ }, [isUnfolded]);
2099
+ 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 }) }));
2100
+ });
2101
+
2102
+ const CardCell = JSX(({ value, subText, children, isPhone, ...props }) => {
2103
+ const textItems = (Array.isArray(value) ? value : value?.split(',') ?? []).filter(Boolean);
2104
+ if ([textItems.length, children, subText].every((_) => !_)) {
2105
+ return null;
2106
+ }
2107
+ return renderCardCell({ textItems, subText, children, isPhone, ...props });
2108
+ });
2109
+ 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] }));
2110
+ 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))));
2111
+ const cleanPhoneNumber = (phone) => phone.replace(/\D/g, '');
2112
+
2113
+ 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 })));
2114
+
2115
+ const getScheduleDescription = (workScheduleWeek) => {
2116
+ const rows = getDateDescription(workScheduleWeek);
2117
+ return jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", value: rows, className: "max-w-none" });
2118
2118
  };
2119
- const calculateMaxDaysOfMonth = (selectedYear, selectedMonth) => {
2120
- const date = new Date(selectedYear, selectedMonth, 1);
2121
- let maxDateOfMonth = 0;
2122
- while (date.getMonth() === selectedMonth) {
2123
- maxDateOfMonth++;
2124
- date.setDate(date.getDate() + 1);
2119
+ const buildScheduleText = ({ workTime = '', lunchHour = '', daysOff = '' }, isSaturday = false) => {
2120
+ if (!workTime) {
2121
+ return '';
2125
2122
  }
2126
- return maxDateOfMonth;
2123
+ return [
2124
+ `${isSaturday ? 'Суббота' : 'Будние дни'}: ${workTime}`,
2125
+ lunchHour ? `перерыв: ${lunchHour}` : '',
2126
+ daysOff ? `не работает: ${daysOff}` : '',
2127
+ ]
2128
+ .filter(Boolean)
2129
+ .join('; ');
2127
2130
  };
2128
- const handleChangeMonth = ({ maxDateOfMonth, selectedYear, selectedMonth, value, onChange, }) => {
2129
- value &&
2130
- onChange?.(new Date(selectedYear, selectedMonth, Math.min(maxDateOfMonth, value.getDate())));
2131
+ const getDateDescription = (workScheduleWeek) => {
2132
+ const workingWeekday = workScheduleWeek.find((_) => _.key !== 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
2133
+ const workingSaturday = workScheduleWeek.find((_) => _.key === 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
2134
+ const daysOff = workScheduleWeek
2135
+ .filter((_) => !_.status)
2136
+ .map((_) => _.short?.toLowerCase())
2137
+ .join(', ');
2138
+ const rows = [
2139
+ buildScheduleText({
2140
+ workTime: workingWeekday?.workTime,
2141
+ lunchHour: workingWeekday?.lunchHour,
2142
+ daysOff: workingSaturday ? '' : daysOff,
2143
+ }),
2144
+ buildScheduleText({ workTime: workingSaturday?.workTime, lunchHour: workingSaturday?.lunchHour, daysOff }, true),
2145
+ ].filter(Boolean);
2146
+ return rows;
2131
2147
  };
2132
2148
 
2133
- const ICON_PROPS = {
2134
- name: 'ArrowUpIcon',
2135
- iconVersion: 'black',
2136
- width: '24',
2137
- height: '24',
2149
+ const WEEKDAY_MAP = [
2150
+ ['workingMonday', 'Пн', 'Понедельник'],
2151
+ ['workingTuesday', 'Вт', 'Вторник'],
2152
+ ['workingWednesday', 'Ср', 'Среда'],
2153
+ ['workingThursday', 'Чт', 'Четверг'],
2154
+ ['workingFriday', 'Пт', 'Пятница'],
2155
+ ['workingSaturday', 'Сб', 'Суббота'],
2156
+ ['workingSunday', 'Вс', 'Воскресенье'],
2157
+ ];
2158
+ const getWorkScheduleWeek = (workSchedule) => WEEKDAY_MAP.map(([key, short, title]) => ({
2159
+ key,
2160
+ title,
2161
+ short,
2162
+ status: Boolean(workSchedule?.[key]),
2163
+ get workTime() {
2164
+ return key === 'workingSaturday' ? workSchedule?.workTimeSaturday : workSchedule?.workTime;
2165
+ },
2166
+ get lunchHour() {
2167
+ return key === 'workingSaturday' ? workSchedule?.lunchHourSaturday : workSchedule?.lunchHour;
2168
+ },
2169
+ get hasLunch() {
2170
+ return /\d+/.test(this.lunchHour ?? '');
2171
+ },
2172
+ }));
2173
+
2174
+ const renderBusinessSchedule = (scheduleDescription) => {
2175
+ if (!scheduleDescription) {
2176
+ return null;
2177
+ }
2178
+ const businessSchedule = getBusinessSchedule(scheduleDescription);
2179
+ 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 }) })] }));
2138
2180
  };
2139
- const SELECT_PROPS = {
2140
- className: 'min-w-32',
2141
- iconVersion: 'black',
2142
- isBorder: false,
2181
+ const getBusinessSchedule = (scheduleDescription) => {
2182
+ const weekDayMap = WEEKDAY_MAP.map(([, short]) => ({ short, status: true }));
2183
+ const splittedScheduleDescription = scheduleDescription.split('/') ?? [];
2184
+ const lastPartScheduleDescription = splittedScheduleDescription[splittedScheduleDescription.length - 1]?.toLowerCase();
2185
+ if (!lastPartScheduleDescription?.includes('выходной')) {
2186
+ return weekDayMap;
2187
+ }
2188
+ return weekDayMap.map((_) => ({
2189
+ ..._,
2190
+ status: !lastPartScheduleDescription?.includes(_.short.toLowerCase()),
2191
+ }));
2143
2192
  };
2144
- const DatePicker = JSX(
2145
- // eslint-disable-next-line max-lines-per-function
2146
- ({ className = '', label = '', value, valid = true, minDate, maxDate, disabled, onChange }) => {
2147
- const [showCalendar, { setValue }] = useBool(false);
2148
- const [selectedMonth, setSelectedMonth] = useState(value?.getMonth() || new Date().getMonth());
2149
- const [selectedYear, setSelectedYear] = useState(value?.getFullYear() || new Date().getFullYear());
2150
- const { handlePrevMonth, handleNextMonth, handleSelectMonth, handleSelectYear, monthsOptions, yearsOptions, handleChangeVisibleCalendar, ref, } = useDatePickerManager({
2151
- onYearSelect: setSelectedYear,
2152
- onMonthSelect: setSelectedMonth,
2153
- onShowCalendar: setValue,
2154
- selectedYear,
2155
- selectedMonth,
2156
- showCalendar,
2157
- onChange,
2158
- value,
2159
- });
2160
- const spaceAbove = useElementSpace(ref, 370);
2161
- return (jsxs("div", { className: style('space-y-xs', className), ref: ref, children: [renderLabel(label), jsxs("div", { className: "relative", children: [renderDatePickerForm({
2162
- handleChangeVisibleCalendar,
2163
- value,
2164
- valid,
2165
- onChange,
2166
- disabled,
2167
- setSelectedMonth,
2168
- setSelectedYear,
2169
- }), showCalendar && !disabled ? (jsxs("div", { className: style('absolute bg-white z-20 select-none', {
2170
- 'bottom-full': spaceAbove,
2171
- }), 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] })] }));
2172
- });
2193
+ 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)));
2173
2194
 
2174
- 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)] })));
2195
+ 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)));
2175
2196
 
2176
- 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 })));
2197
+ const colorStyle = {
2198
+ yellow: { border: 'border-yellow-light', text: 'text-yellow' },
2199
+ green: { border: 'border-green-more-light', text: 'text-green-dark' },
2200
+ gray: { border: 'border-gray', text: 'text-secondary-text' },
2201
+ red: { border: 'border-error/30', text: 'text-error' },
2202
+ };
2203
+ 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 })] })));
2177
2204
 
2178
- const MIN_AGE = 23;
2179
- const MAX_AGE = 75;
2180
- const AGE_ERROR_MESSAGE = 'Допустимый возраст заёмщика - от 23 до 75 лет';
2181
- const FIELD_NAME$8 = 'birthday';
2182
- const BirthdayField = JSX(({ field, input, isRetailForm = false }) => {
2183
- const { value } = field(FIELD_NAME$8);
2184
- 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) }));
2185
- });
2186
- const birthdayValidate = (date) => {
2187
- const today = new Date();
2188
- const minDate = new Date(today.getFullYear() - MIN_AGE, today.getMonth(), today.getDate());
2189
- const maxDate = new Date(today.getFullYear() - MAX_AGE, today.getMonth(), today.getDate());
2190
- if (!date || date > minDate || date < maxDate) {
2191
- return false;
2205
+ const currentWeekDayIdx = new Date().getDay();
2206
+ //TODO: Add logic time https://github.com/redneckz/wildless-cms-uni-blocks/pull/1549
2207
+ const renderCurrentDaySchedule = (workScheduleWeek) => {
2208
+ const [currentWeekDay] = workScheduleWeek?.slice(currentWeekDayIdx - 1) ?? [];
2209
+ if (!currentWeekDay) {
2210
+ return null;
2192
2211
  }
2193
- return true;
2212
+ const { lunchHour, status, workTime, hasLunch } = currentWeekDay;
2213
+ 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" }));
2194
2214
  };
2195
2215
 
2196
- const FIELD_NAME$7 = 'birthPlace';
2197
- 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) })));
2198
-
2199
- const CardCategoryField = JSX(({ field, input }) => {
2200
- const { data: cardCategory } = useLeadFormData('CARD_TYPE');
2201
- 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 }));
2202
- });
2203
-
2204
- 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 })));
2205
-
2206
- 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 })));
2207
-
2208
- 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) })));
2216
+ const getSubTextLunch = ({ lunchHour, hasLunch = false, status = false }) => {
2217
+ if (!status) {
2218
+ return 'Не работает';
2219
+ }
2220
+ return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
2221
+ };
2222
+ 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)));
2209
2223
 
2210
- 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 })));
2224
+ const ICONS$1 = ['ArrowDownIcon', 'ArrowUpIcon'];
2225
+ const labels = ['Подробнее', 'Скрыть'];
2226
+ 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" })] }));
2211
2227
 
2212
- const ConfirmationIncomeField = JSX(({ field, input }) => {
2213
- const { data: confirmationIncome } = useLeadFormData('INCOME_CERT_UNITED');
2214
- 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 }));
2215
- });
2228
+ const renderWorkSchedule = (workSchedule) => {
2229
+ const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2230
+ const timeOfWork = workSchedule ? getDateDescription(workScheduleWeek) : '';
2231
+ const businessTimeOfWork = workSchedule ? workSchedule.businessScheduleDescription : '';
2232
+ if (!workSchedule) {
2233
+ return '';
2234
+ }
2235
+ if (!workSchedule.businessScheduleVisibleTag) {
2236
+ return renderMatchingTimeOfWork(timeOfWork);
2237
+ }
2238
+ if (workSchedule.businessScheduleVisibleTag &&
2239
+ workSchedule.businessScheduleDescription === null) {
2240
+ return renderIndividualTimeOfWork(timeOfWork);
2241
+ }
2242
+ return renderDefaultTimeOfWork(timeOfWork, businessTimeOfWork);
2243
+ };
2244
+ const renderIndividualTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p>`;
2245
+ const renderMatchingTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ. и юр. лиц:<br/></b> ${timeOfWork}</p>`;
2246
+ const renderDefaultTimeOfWork = (timeOfWork, businessTimeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${businessTimeOfWork}</p>`;
2216
2247
 
2217
- const ConscriptionField = JSX(({ field, input }) => {
2218
- const { data: conscription } = useLeadFormData('MILITARY_STATUS');
2219
- 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 }));
2220
- });
2221
-
2222
- const CONSENTS = {
2223
- processPersonalDataFlg: {
2224
- text: 'Согласие на обработку персональных данных',
2225
- docId: 4,
2226
- },
2227
- consentInformFlg: {
2228
- text: 'Согласие на информирование о продуктах и услугах Банка',
2229
- docId: 14,
2230
- },
2231
- consentProviderFlg: {
2232
- text: 'Согласие об использовании простой электронной подписи',
2233
- docId: 5,
2234
- },
2235
- consentOthersFlg: {
2236
- text: 'Прочие согласия',
2237
- docId: 1,
2238
- },
2239
- consentPfrFlg: {
2240
- text: 'Согласие на запрос в ПФР',
2241
- docId: 3,
2242
- },
2243
- consentToReceiveMaterials: {
2244
- text: 'Согласен на получение информационных и аналитических материалов по электронной почте',
2245
- },
2246
- };
2247
-
2248
- async function doRequest(url, method, body) {
2249
- const response = await fetch(`${API_BASE_URI}${url}`, {
2250
- method,
2251
- headers: {
2252
- 'Content-Type': 'application/json',
2253
- ...getAuthorizationHeaders(),
2254
- },
2255
- credentials: 'include',
2256
- body: body ? JSON.stringify(body) : null,
2257
- });
2258
- // TODO: add error handling
2259
- return isJSON(response) ? response.json() : response;
2260
- }
2261
- // TODO: Need delete isJSON
2262
- const isJSON = (response) => response.headers.get('Content-Type') === 'application/json';
2263
- const getAuthorizationHeaders = () => {
2264
- const token = sessionStorage.getItem('accessToken');
2265
- return token ? { Authorization: `Bearer ${token}` } : null;
2248
+ const renderOfficeCard = ({ name, address, phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }, i) => {
2249
+ if (!workSchedule) {
2250
+ return null;
2251
+ }
2252
+ const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2253
+ 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({
2254
+ phone,
2255
+ fax,
2256
+ phoneBusiness,
2257
+ phoneNatural,
2258
+ phoneCallCentre,
2259
+ phoneCurrencyControl,
2260
+ workSchedule,
2261
+ exchangeRate,
2262
+ }) }), jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
2263
+ return (jsx(FoldableSection, { isUnfolded: isUnfolded, children: renderCardContent$1({
2264
+ phone,
2265
+ fax,
2266
+ phoneBusiness,
2267
+ phoneNatural,
2268
+ phoneCallCentre,
2269
+ phoneCurrencyControl,
2270
+ workSchedule,
2271
+ exchangeRate,
2272
+ }) }));
2273
+ },
2274
+ //** TODO: remove styles with refactoring DefaultFoldButton*/
2275
+ renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$3({ isUnfolded, onToggle }) })] }, String(i)));
2266
2276
  };
2267
-
2268
- const feedbackById = async (id, convertToPng = false) => {
2269
- const response = await doRequest(`/feedback/file?id=${encodeURIComponent(id)}&convertToPngFlg=${convertToPng}`, 'GET');
2270
- return await response.blob();
2277
+ const renderCardContent$1 = ({ phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }) => {
2278
+ const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2279
+ const labelSchedule = workSchedule?.businessScheduleVisibleTag
2280
+ ? 'Для физических лиц'
2281
+ : 'Для физических и юридических лиц';
2282
+ 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
2283
+ ? renderBusinessSchedule(workSchedule?.businessScheduleDescription)
2284
+ : null, exchangeRate?.currencies?.length ? (jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }));
2271
2285
  };
2272
-
2273
- const getDocument = async (id, convertToPng = false) => {
2274
- const response = await feedbackById(id, convertToPng);
2275
- return URL.createObjectURL(response);
2286
+ const capitalizedFirstLetter$1 = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
2287
+ const getOfficePoint = ({ name = '', address = '', workSchedule }) => {
2288
+ const header = capitalizedFirstLetter$1(name);
2289
+ const body = `${address} ${renderWorkSchedule(workSchedule)}`;
2290
+ return { header, body };
2276
2291
  };
2277
2292
 
2278
- 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" }) })));
2293
+ const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
2279
2294
 
2280
- const Dialog = JSX(({ className, head, children, onClose, onClick }) => {
2281
- const { close } = useDialogManager();
2282
- const handleClose = useCallback(() => {
2283
- close();
2284
- onClose && onClose();
2285
- }, [onClose]);
2286
- 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 })] }));
2287
- });
2295
+ const isClient = !isSSR();
2296
+ const ClientOnly = JSX(({ children }) => (isClient ? children : null));
2288
2297
 
2289
- const openDocument = async (open, id, convertToPng = false) => {
2290
- const document = await getDocument(id, convertToPng);
2291
- 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" })) }));
2298
+ const INITIAL_FILTRATION_STATE$1 = {
2299
+ workingSaturday: false,
2300
+ premiumService: false,
2301
+ privateBanking: false,
2302
+ remoteWorkplace: false,
2303
+ serviceDisabledPeople: false,
2304
+ sellingCoins: false,
2305
+ buyingCoins: false,
2306
+ bullionOperations: false,
2307
+ preciousMetalsOperations: false,
2308
+ transferringDataToBiometricSystem: false,
2292
2309
  };
2293
-
2294
- const OPEN_DOC_BUTTON_TEXT = 'Ознакомиться';
2295
- const CheckboxWithDoc = JSX(({ className, error, docId, ...props }) => {
2296
- const { open } = useDialogManager();
2297
- const isMobile = useMobileMode();
2298
- 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)] }));
2299
- });
2300
-
2301
- 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);
2302
-
2303
- const LABEL_TEXT = `Имеет ли юридическое лицо, акционером / участником / членом / пайщиком /
2304
- вкладчиком с долей участия более 20% уставного капитала руководителем,
2305
- которого Вы являетесь, кредит в АО «Россельхозбанк»`;
2306
- const CreditInRshbCdField = JSX(({ field, input }) => {
2307
- const { data: creditInRshbCd } = useLeadFormData('CREDIT_IN_RSHB');
2308
- return (jsx(SelectField, { field: field, source: creditInRshbCd, label: LABEL_TEXT, fieldName: "creditInRshbCd", input: input }));
2309
- });
2310
-
2311
- const orientationStyleMap = {
2312
- horizontal: '@lg:flex-row',
2313
- vertical: '',
2310
+ const FILTRATION_LABELS = {
2311
+ safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
2312
+ workingSaturday: 'Открыты по субботам',
2313
+ terminalTypeAtms: 'Банкоматы',
2314
+ terminalTypeTerm: 'Терминалы',
2315
+ workAllTime: 'Круглосуточно',
2316
+ billAcceptorEnable: 'Прием наличных',
2317
+ premiumService: 'Премиальное обслуживание',
2318
+ privateBanking: 'Услуга Private banking',
2319
+ sellingCoins: 'Продажа монет из драгоценных металлов',
2320
+ buyingCoins: 'Покупка монет из драгоценных металлов',
2321
+ bullionOperations: 'Операции со слитками',
2322
+ preciousMetalsOperations: 'Операции с драгоценными металлами',
2323
+ transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
2324
+ locationDisabledPeople: 'Для маломобильных',
2325
+ designDisabledPeople: 'Для слабовидящих',
2326
+ remoteWorkplace: 'Удаленное рабочее место',
2327
+ serviceDisabledPeople: 'Для маломобильных граждан',
2328
+ };
2329
+ const FILTRATION_PREDICATES$1 = {
2330
+ workingSaturday: (item) => Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
2331
+ premiumService: (item) => Boolean('premiumService' in item && item.premiumService),
2332
+ privateBanking: (item) => Boolean('privateBanking' in item && item.privateBanking),
2333
+ remoteWorkplace: (item) => Boolean('workScheduleDescription' in item),
2334
+ serviceDisabledPeople: (item) => Boolean('serviceDisabledPeople' in item && item.serviceDisabledPeople),
2335
+ sellingCoins: (item) => Boolean('sellingCoins' in item && item.sellingCoins),
2336
+ buyingCoins: (item) => Boolean('buyingCoins' in item && item.buyingCoins),
2337
+ bullionOperations: (item) => Boolean('bullionOperations' in item && item.bullionOperations),
2338
+ preciousMetalsOperations: (item) => Boolean('preciousMetalsOperations' in item && item.preciousMetalsOperations),
2339
+ transferringDataToBiometricSystem: (item) => Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
2314
2340
  };
2315
- 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)))) })] })));
2316
2341
 
2317
- 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)] })));
2342
+ function useButton() {
2343
+ return (props) => ({
2344
+ ...props,
2345
+ onClick: handlerDecorator(handleClick(props)),
2346
+ });
2347
+ }
2348
+ function handleClick({ disabled, onClick }) {
2349
+ return (ev) => {
2350
+ !disabled && onClick && onClick(ev);
2351
+ };
2352
+ }
2318
2353
 
2319
- const CURRENCY_TYPES = [{ id: 'rub', text: 'Рубль' }];
2320
- const CurrencyField = JSX(({ field, input }) => {
2321
- const { value, onChange } = field('currency');
2322
- 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) }));
2354
+ const buttonStyleMap = {
2355
+ primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
2356
+ secondary: 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
2357
+ };
2358
+ const secondaryButtonStyleMap = {
2359
+ 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'),
2360
+ 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'),
2361
+ };
2362
+ const Button = JSX(({ children, ...props }) => {
2363
+ const button = useButton();
2364
+ const { className, version = 'primary', active, disabled, type = 'button', rounded = true, role, onClick, } = button(props);
2365
+ return (jsx("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs', {
2366
+ 'text-white bg-primary-active': active,
2367
+ 'bg-main-gray text-main-disabled cursor-not-allowed': disabled,
2368
+ 'rounded-md': rounded,
2369
+ }, !active && !disabled
2370
+ ? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
2371
+ : '', className), type: type, role: role, onClick: onClick, children: children }));
2323
2372
  });
2324
2373
 
2325
- 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) })));
2326
-
2327
- 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 })));
2374
+ const getVersion = (isPrimary, type) => isPrimary && type !== 'underlined' ? 'primary' : 'secondary';
2328
2375
 
2329
- 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) })));
2376
+ const renderButtonsGroup = (data, activeButton, onButtonClick) => {
2377
+ const allButtonVersion = getVersion(activeButton === 'all');
2378
+ const businessButtonVersion = getVersion(activeButton === 'business');
2379
+ const handleClick = (e, key, branches) => {
2380
+ const filteredBranches = e.currentTarget === e.target && key === 'business' ? filterBranches(branches) : branches;
2381
+ onButtonClick(key);
2382
+ return filteredBranches;
2383
+ };
2384
+ const filterBranches = (branches) => branches.filter((branch) => branch.workSchedule &&
2385
+ branch.workSchedule.businessScheduleVisibleTag &&
2386
+ !branch.workSchedule.businessScheduleDescription);
2387
+ 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" })] }));
2388
+ };
2330
2389
 
2331
- 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) })));
2390
+ 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;
2332
2391
 
2333
- const FIELD_NAME$6 = 'dulIssueDateField';
2334
- 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) })));
2392
+ const COMMON_FILTERS_STYLES = 'flex flex-col sm:flex-row sm:flex-wrap gap-3xl pb-2xl';
2393
+ const renderFiltrationForm = ({ filters, field: { field, reset }, onlyOffice, labels, }) => {
2394
+ const visibleFiltersNum = onlyOffice ? 5 : 6;
2395
+ const filtersCheckbox = (filters || []).map((key) => (jsx(Checkbox, { text: labels[key], ...field(key) }, key)));
2396
+ const [visibleFilters, hiddenFilters] = visibleFiltersNum > 0
2397
+ ? [filtersCheckbox.slice(0, visibleFiltersNum), filtersCheckbox.slice(visibleFiltersNum)]
2398
+ : [filtersCheckbox, []];
2399
+ 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 }));
2400
+ };
2401
+ const renderFoldButton$2 = (reset, onlyOffice = false) => ({ isUnfolded, onToggle }) => {
2402
+ const labels = ['Больше фильтров', 'Меньше фильтров'];
2403
+ const icons = ['ArrowDownIcon', 'ArrowUpIcon'];
2404
+ 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() })] }));
2405
+ };
2406
+ 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" })] }));
2335
2407
 
2336
- const FIELD_NAME$5 = 'dulIssuedBy';
2337
- const DulIssuedByField = JSX(({ field, input }) => {
2338
- const { value: dulSubdivisionCode, onChange: changeDulSubdivisionCode } = field('dulSubdivisionCode');
2339
- const onDaDataChange = useCallback((item) => {
2340
- changeDulSubdivisionCode?.(item?.data?.code?.replace('-', ''));
2341
- }, []);
2342
- 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 }));
2343
- });
2408
+ 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] }) }));
2344
2409
 
2345
- const FIELD_NAME$4 = 'dulNumber';
2346
- 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) })));
2347
-
2348
- const FIELD_NAME$3 = 'dulSerie';
2349
- 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) })));
2350
-
2351
- const FIELD_NAME$2 = 'dulSubdivisionCode';
2352
- const DulSubdivisionCodeField = JSX(({ field, input }) => {
2353
- const onDaDataChange = useCallback((item) => {
2354
- field?.('dulIssuedBy')?.onChange?.(item?.data?.name);
2355
- }, []);
2356
- 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 }));
2357
- });
2358
-
2359
- const EducationField = JSX(({ field, input }) => {
2360
- const { data: education } = useLeadFormData('EDUCATION_LEVEL');
2361
- return (jsx(SelectField, { field: field, source: education, label: "\u041E\u0431\u0440\u0430\u0437\u043E\u0432\u0430\u043D\u0438\u0435", fieldName: "education", input: input }));
2410
+ const defaultEmptyFunction$1 = () => void 0;
2411
+ const filtersVisibleStyles = (activeButton) => activeButton === 'all' ? 'block' : 'hidden';
2412
+ const OfficesAtmsMapLayout = JSX(({ className, data = [], isLoad, remoteWorkplaces = [], renderCard = defaultEmptyFunction$1, renderRemoteWorkplaceCard = defaultEmptyFunction$1, getBalloon = defaultEmptyFunction$1, getBalloonRemoteWorkplaces = defaultEmptyFunction$1, descriptionData, title, }) => {
2413
+ const onlyOffice = title?.includes('Офис');
2414
+ const [filtrationState, { field, reset }] = useForm(INITIAL_FILTRATION_STATE$1);
2415
+ const { filteredItems, points, filteredRemoteWorkplaces, lengthItems } = useOfficesAtmsMapData({
2416
+ data,
2417
+ remoteWorkplaces,
2418
+ filtrationState,
2419
+ getBalloon,
2420
+ getBalloonRemoteWorkplaces,
2421
+ });
2422
+ const [activeButton, setActiveButton] = useState('all');
2423
+ const filterOptions = {
2424
+ filters: getFiltersWithNonEmptyData([...data, ...remoteWorkplaces]),
2425
+ field: { field, reset },
2426
+ onlyOffice,
2427
+ labels: FILTRATION_LABELS,
2428
+ };
2429
+ 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)] })] }));
2362
2430
  });
2431
+ const filterItems$1 = (data, filtrationState) => {
2432
+ const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
2433
+ return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES$1[_](item)));
2434
+ };
2435
+ const getFiltersWithNonEmptyData = (data) => Object.keys(INITIAL_FILTRATION_STATE$1).filter((_) => data.filter((item) => FILTRATION_PREDICATES$1[_](item)).length);
2363
2436
 
2364
- const EmailField = JSX(({ field, input }) => {
2365
- const { required, ...rest } = input;
2366
- 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 }));
2367
- });
2437
+ const defaultEmptyFunction = () => void 0;
2438
+ const useOfficesAtmsMapData = ({ data, remoteWorkplaces = [], filtrationState = {}, getBalloon = defaultEmptyFunction, getBalloonRemoteWorkplaces = defaultEmptyFunction, }) => {
2439
+ const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
2440
+ const _filteredItems = filterItems$1(data, filtrationState);
2441
+ const _filteredRemoteWorkplaces = filterItems$1(remoteWorkplaces, filtrationState);
2442
+ const _points = [
2443
+ ..._filteredItems.map((_) => ({
2444
+ type: 'offices',
2445
+ coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
2446
+ content: getBalloon(_),
2447
+ })),
2448
+ ..._filteredRemoteWorkplaces.map((_) => ({
2449
+ type: 'workplaces',
2450
+ coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
2451
+ content: getBalloonRemoteWorkplaces({
2452
+ address: _.address,
2453
+ workScheduleDescription: _.workScheduleDescription,
2454
+ }),
2455
+ })),
2456
+ ].filter((_) => _.coords && _.coords.length === 2);
2457
+ const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
2458
+ return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
2459
+ }, [data, remoteWorkplaces, filtrationState, getBalloon, getBalloonRemoteWorkplaces]);
2460
+ return { filteredItems, points, filteredRemoteWorkplaces, lengthItems };
2461
+ };
2368
2462
 
2369
- const EmployerActivitiesField = JSX(({ field, input }) => {
2370
- const { data: employerActivities } = useLeadFormData('ORGANIZATION_ACTIVITY_TYPE');
2371
- 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 }));
2372
- });
2463
+ const useLeadFormData = (typeField) => {
2464
+ const { data, error } = useAsyncData(`/api/v1/dictionary?dictionaryType=${encodeURIComponent(typeField)}`, fetchData);
2465
+ if (data && 'errorMessage' in data) {
2466
+ return { error };
2467
+ }
2468
+ return { data: data, error };
2469
+ };
2470
+ const fetchData = async (url) => {
2471
+ const result = await fetchJSON(url, { method: 'POST' });
2472
+ return result || [];
2473
+ };
2373
2474
 
2374
- const EmployerOrganizationField = JSX(({ field, input }) => {
2375
- const { data: employerOrganization } = useLeadFormData('ORGANIZATION_KIND');
2376
- 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 }));
2475
+ const AddressRetailField = JSX(({ field, input }) => {
2476
+ const [offices, setOffices] = useState([]);
2477
+ const { data } = useLeadFormData('REGION_RF');
2478
+ const regionValue = field('regionRetail')?.value || {};
2479
+ const fieldBranch = field('addressRetail');
2480
+ useEffect(() => {
2481
+ (async () => {
2482
+ const officesList = await regionOffices(regionValue?.key ?? '');
2483
+ // eslint-disable-next-line @typescript-eslint/no-unsafe-argument
2484
+ setOffices(officesList || []);
2485
+ })();
2486
+ if (regionValue?.key) {
2487
+ field?.('addressRetail')?.onChange?.('');
2488
+ }
2489
+ }, [regionValue.key]);
2490
+ const { points } = useOfficesAtmsMapData({
2491
+ data: offices,
2492
+ filtrationState: {},
2493
+ getBalloon: getOfficePoint,
2494
+ });
2495
+ const isRegionSelected = Boolean(regionValue?.key);
2496
+ 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 = '' }) => ({
2497
+ key: id?.toString() || '',
2498
+ text: address,
2499
+ })), ...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 }) }) })] }));
2377
2500
  });
2378
2501
 
2379
- const EmploymentField = JSX(({ field, input }) => {
2380
- const { data: employment } = useLeadFormData('EMPLOYMENT_INFO_UNITED');
2381
- 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 }));
2382
- });
2502
+ const useNormalizedInput = (props, { normalize, format }) => {
2503
+ const { value, onFocus, onBlur, onChange } = props;
2504
+ const [isFocused, setIsFocused] = useState(false);
2505
+ const handleFocus = useCallback((ev) => {
2506
+ setIsFocused(true);
2507
+ onFocus && onFocus(ev);
2508
+ }, []);
2509
+ const handleBlur = useCallback(() => {
2510
+ setIsFocused(false);
2511
+ onChange && onChange(normalize(value));
2512
+ onBlur && onBlur();
2513
+ }, [onChange, value]);
2514
+ return {
2515
+ value: (isFocused || !format ? value : format(value)),
2516
+ onFocus: handleFocus,
2517
+ onBlur: handleBlur,
2518
+ };
2519
+ };
2383
2520
 
2384
- 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 })));
2521
+ const clamp = (value, min, max) => Math.max(min, Math.min(value, max));
2385
2522
 
2386
- 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 })));
2523
+ function parseDecimal(value) {
2524
+ const rawValue = (value || '').replace(/\D/g, '');
2525
+ const unsafeDecimal = parseInt(rawValue, 10);
2526
+ return Number.isNaN(unsafeDecimal) ? 0 : unsafeDecimal;
2527
+ }
2387
2528
 
2388
- const FamilyMembersField = JSX(({ field }) => {
2389
- const { value, onChange } = field('familyMembers');
2390
- const familyStatusKey = field('familyStatus')?.value?.key;
2391
- const adultsCount = familyStatusKey === 'MARRIED' ? 2 : 1;
2392
- const childrenCount = Number(field('children')?.value);
2393
- const dependentsCount = Number(field('dependents')?.value);
2394
- const totalCount = adultsCount + childrenCount + dependentsCount;
2395
- useEffect(() => {
2396
- field?.('familyMembers')?.onChange?.(totalCount);
2397
- }, [familyStatusKey, childrenCount, dependentsCount]);
2398
- 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?.(_) }));
2399
- });
2529
+ function renderRangeWithTicks({ list = [], min, max, step, value = list[0] || min, disabled, onChange, }) {
2530
+ const rangeValue = list.length ? list.indexOf(value) : value;
2531
+ const rangeValueShift = rangeValue > min ? rangeValue - min : 0;
2532
+ const percentage = (rangeValueShift * 100) / (max - min);
2533
+ const inputStyle = {
2534
+ backgroundSize: `${percentage.toFixed(2)}% 100%`,
2535
+ };
2536
+ 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) => {
2537
+ const rawValue = parseDecimal(ev.target?.value);
2538
+ const newValue = list.length ? list[rawValue] : rawValue;
2539
+ onChange && onChange(newValue || 0);
2540
+ }) }) })] }));
2541
+ }
2400
2542
 
2401
- const FamilyStatusField = JSX(({ field, input }) => {
2402
- const { data: familyStatus } = useLeadFormData('MARITAL_STATUS');
2403
- 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 }));
2543
+ const inputDisabledStyle = 'disabled:border-gray disabled:bg-main-divider';
2544
+ const DEFAULT_MIN = 1;
2545
+ const DEFAULT_MAX = 100;
2546
+ const InputRange = JSX((props) => {
2547
+ 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;
2548
+ const normalizedProps = useNormalizedInput(props, {
2549
+ normalize: (_ = 0) => list.length ? closestValue(list)(_) : clamp(_, min, max),
2550
+ format: toLocalNumberFormat(),
2551
+ });
2552
+ const handleChange = useCallback((ev) => {
2553
+ onChange && onChange(parseDecimal(ev.target?.value));
2554
+ }, [onChange]);
2555
+ 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)] }));
2404
2556
  });
2557
+ const closestValue = (list) => (_) => list.reduce((prev, curr) => (Math.abs(curr - _) < Math.abs(prev - _) ? curr : prev));
2558
+ 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)))) }));
2405
2559
 
2406
- const SERVICE_TYPES = [
2407
- { key: 'ULTRASERVICE', text: 'Ультра' },
2408
- { key: 'PREMIUMSERVICE', text: 'Премиум' },
2409
- ];
2410
- const SERVICE_DIRECTIONS = [
2411
- { key: 'Физическое лицо' },
2412
- { key: 'Юридическое лицо / ИП' },
2413
- ];
2414
- const FEEDBACK_METHOD = [
2415
- { key: 'phone', text: 'Телефонный звонок' },
2416
- { key: 'email', text: 'Электронное сообщение' },
2417
- ];
2418
-
2419
- 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) })));
2420
-
2421
- const FullNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0418\u041E", ...getValidation(field('fullName'), validatorObj.fullName, input?.required), ...input })));
2422
-
2423
- 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 })));
2560
+ const MIN_CREDIT_AMOUNT = 1000;
2561
+ const MAX_CREDIT_AMOUNT = 1000000000;
2562
+ const ITEMS_CREDIT_AMOUNT = ['От 1 000 ₽', 'До 1 000 000 000 ₽'];
2563
+ 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') })));
2424
2564
 
2425
- const HousingField = JSX(({ field, input }) => {
2426
- const { data: housing } = useLeadFormData('HOUSE_TYPE');
2427
- return (jsx(SelectField, { field: field, source: housing, label: "\u0422\u0438\u043F \u0436\u0438\u043B\u044C\u044F", fieldName: "housing", input: input }));
2565
+ const SelectField = UniBlock(({ field, source, label, fieldName, input, placeholder = 'Выберите из списка', isSearch = false, }) => {
2566
+ const leadOptions = (source &&
2567
+ source?.map((_) => ({
2568
+ key: _.key || '',
2569
+ text: _.value,
2570
+ }))) ||
2571
+ [];
2572
+ return (jsx(SelectControl, { placeholder: placeholder, label: label, options: leadOptions, isSearch: isSearch, ...getValidation(field(fieldName), validatorObj[fieldName], input?.required) }));
2428
2573
  });
2429
2574
 
2430
- const InnField = JSX(({ field, input }) => {
2431
- const onDaDataChange = useCallback((item) => {
2432
- field?.('organizationName')?.onChange?.(item.data?.name?.short_with_opf);
2433
- field?.('legalForm')?.onChange?.(item.data?.opf?.short);
2434
- }, []);
2435
- return (jsx(InputControl, { label: "\u0418\u041D\u041D", type: "number", maxLength: 12, ...input, ...getValidation(field('inn'), validatorObj.inn, input?.required), onDaDataChange: onDaDataChange }));
2575
+ const AmountWorkersField = JSX(({ field, input }) => {
2576
+ const { data: amountWorkers } = useLeadFormData('EMPLOYEES_NUMBER');
2577
+ 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 }));
2436
2578
  });
2437
2579
 
2438
- 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"' })));
2439
-
2440
- 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 })));
2580
+ 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) })));
2441
2581
 
2442
- 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 })));
2582
+ 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) })));
2443
2583
 
2444
- const LegalEntityNameField = JSX(({ field, input }) => {
2445
- 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) }));
2446
- });
2584
+ 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 })));
2447
2585
 
2448
- 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 })));
2586
+ 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') })));
2449
2587
 
2450
- const OUT_SERVICE_BASE_URL = `${API_BASE_URI}/outservice`;
2451
- const EMPTY_REGIONS = [];
2452
- async function getOutServiceRegions() {
2453
- const data = await fetchJSON(`${OUT_SERVICE_BASE_URL}/outserviceregions`);
2454
- return data && Array.isArray(data) ? data : EMPTY_REGIONS;
2455
- }
2588
+ 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) })));
2456
2589
 
2457
- const LocalitiesField = JSX(({ field, input }) => {
2458
- const fieldRegion = field('region');
2459
- const regionKey = fieldRegion?.value?.key;
2460
- const { data: regions } = useAsyncData('outServiceRegions', getOutServiceRegions);
2461
- const localities = regions
2462
- ?.find((_) => _.code === regionKey)
2463
- ?.localities?.map((_) => ({ key: _, text: _ }));
2590
+ const useElementSpace = (ref, heightEl) => {
2591
+ const [spaceAbove, setSpaceAbove] = useState(false);
2464
2592
  useEffect(() => {
2465
- if (regionKey !== '') {
2466
- field?.('localities')?.onChange?.('');
2467
- }
2468
- }, [regionKey]);
2469
- 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 }));
2470
- });
2471
-
2472
- 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 })));
2473
-
2474
- const METHODS_OF_OBTAIN = [
2475
- { id: 'office', text: 'В отделении Банка' },
2476
- { id: 'courier', text: 'Курьерская доставка' },
2477
- ];
2478
- const MethodObtainField = JSX(({ field, input }) => (jsx(RadioButtonGroupControl, { orientation: "horizontal", items: METHODS_OF_OBTAIN, ...getValidation(field('methodObtain'), validatorObj.methodObtain, input?.required) })));
2479
-
2480
- const FIELD_NAME$1 = 'middleName';
2481
- 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 })));
2482
-
2483
- 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 })));
2484
-
2485
- 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] })));
2486
-
2487
- 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);
2593
+ const handleResize = () => {
2594
+ if (ref?.current) {
2595
+ const { top } = ref.current.getBoundingClientRect();
2596
+ const hasSpaceAbove = top > heightEl;
2597
+ setSpaceAbove(hasSpaceAbove);
2598
+ }
2599
+ };
2600
+ handleResize();
2601
+ window.addEventListener('resize', handleResize);
2602
+ return () => window.removeEventListener('resize', handleResize);
2603
+ }, [ref]);
2604
+ return spaceAbove;
2605
+ };
2488
2606
 
2489
- const OrganizationField = JSX(({ field, input }) => {
2490
- const { data: organization } = useLeadFormData('ORGANIZATION_TYPE');
2491
- 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 }));
2492
- });
2607
+ const DAY_COUNT = 6;
2608
+ const WEEK_COUNT = 7;
2609
+ const renderCalendarCells = ({ today, firstDayOfWeek, totalDays, currentMonth, currentYear, min, max, onDateClick, }) => {
2610
+ const calendarCells = [];
2611
+ let dayCounter = 1;
2612
+ for (let i = 0; i < DAY_COUNT; i++) {
2613
+ const rowCells = [];
2614
+ for (let j = 0; j < WEEK_COUNT; j++) {
2615
+ if (i === 0 && j < firstDayOfWeek) {
2616
+ rowCells.push(jsx("td", {}, `empty-${j}`));
2617
+ }
2618
+ else if (dayCounter > totalDays) {
2619
+ rowCells.push(jsx("td", {}, `empty-${j}`));
2620
+ }
2621
+ else {
2622
+ const currentDate = new Date(currentYear, currentMonth, dayCounter);
2623
+ const isToday = checkIsToday(currentDate, today);
2624
+ const isDisabled = checkIsDisabled(currentDate, min, max);
2625
+ rowCells.push(jsx("td", { children: jsx("div", { className: getDayStyles(isToday, isDisabled), onClick: () => !isDisabled && onDateClick(currentDate), children: dayCounter }) }, `day-${dayCounter}`));
2626
+ dayCounter++;
2627
+ }
2628
+ }
2629
+ calendarCells.push(jsx("tr", { children: rowCells }, `row-${i}`));
2630
+ }
2631
+ return calendarCells;
2632
+ };
2633
+ const checkIsToday = (currentDate, today) => today && currentDate.toDateString() === today.toDateString();
2634
+ const checkIsDisabled = (currentDate, min, max) => (min && currentDate.getTime() < min.getTime()) || (max && currentDate.getTime() > max.getTime());
2635
+ const getDayStyles = (isToday = false, isDisabled = false) => style('p-s text-center rounded-md border', {
2636
+ 'border-transparent hover:bg-gray': !isToday,
2637
+ }, isDisabled ? 'text-gray hover:bg-transparent' : 'cursor-pointer');
2493
2638
 
2494
- const OrganizationNameField = JSX(({ field, input }) => {
2495
- const onDaDataChange = useCallback((item) => {
2496
- field?.('inn')?.onChange?.(item.data?.inn);
2497
- field?.('legalForm')?.onChange?.(item.data?.opf?.short);
2639
+ const WEEK_DAYS = ['Пн', 'Вт', 'Ср', 'Чт', 'Пт', 'Сб', 'Вс'];
2640
+ const Calendar = JSX(({ today, currentMonth, currentYear, min, max, onDateSelect = noop, setValue = noop }) => {
2641
+ const handleDateClick = useCallback((date) => {
2642
+ onDateSelect(date);
2643
+ setValue(false);
2498
2644
  }, []);
2499
- 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 }));
2500
- });
2501
-
2502
- 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 })));
2503
-
2504
- 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 })));
2505
-
2506
- 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) })));
2507
-
2508
- const MAX_PART = 100;
2509
- const PartInBusinessField = JSX(({ field, input }) => {
2510
- const isBusinessOwner = field('positionOrganization')?.value?.key === 'BUSINESS_OWNER';
2511
- const partInBusinessField = {
2512
- ...getValidation(field('partInBusiness'), validatorObj.partInBusiness, input?.required),
2513
- };
2514
- const handleChange = (value) => partInBusinessField?.onChange &&
2515
- partInBusinessField?.onChange(String(Number(value) > MAX_PART ? MAX_PART : Number(value) || ''));
2516
- 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 }));
2517
- });
2518
-
2519
- const PartnerCommentsField = JSX(({ field, input }) => {
2520
- const { required, ...rest } = input;
2521
- 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 }));
2645
+ const { firstDayOfWeek, totalDays } = useMemo(() => ({
2646
+ firstDayOfWeek: new Date(currentYear, currentMonth, 1).getDay() - 1,
2647
+ totalDays: new Date(currentYear, currentMonth + 1, 0).getDate(),
2648
+ }), [currentYear, currentMonth]);
2649
+ 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({
2650
+ firstDayOfWeek,
2651
+ today,
2652
+ totalDays,
2653
+ currentYear,
2654
+ currentMonth,
2655
+ min,
2656
+ max,
2657
+ onDateClick: handleDateClick,
2658
+ }) })] }));
2522
2659
  });
2523
2660
 
2524
- const PAYMENT_SYSTEM_TYPES = [
2525
- { id: 'mir', text: 'Карта МИР' },
2526
- { id: 'union_pay', text: 'UnionPay' },
2661
+ const months = [
2662
+ 'Январь',
2663
+ 'Февраль',
2664
+ 'Март',
2665
+ 'Апрель',
2666
+ 'Май',
2667
+ 'Июнь',
2668
+ 'Июль',
2669
+ 'Август',
2670
+ 'Сентябрь',
2671
+ 'Октябрь',
2672
+ 'Ноябрь',
2673
+ 'Декабрь',
2527
2674
  ];
2528
- const PaymentSystemField = JSX(({ field, input }) => {
2529
- const { value, onChange } = field('paymentSystem');
2530
- 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) }));
2531
- });
2532
-
2533
- const isPlaceholder = (_) => _ === '_';
2534
- const isDigit = (_) => /\d/.test(_);
2535
- const isWildcard = (_) => isPlaceholder(_) || isDigit(_);
2536
- const phonePattern = [...'+7 (___) ___-__-__'];
2537
- const firstPlaceholderIndex = phonePattern.findIndex(isPlaceholder);
2538
- const phoneWildcardIndicies = phonePattern.map((_, i) => isWildcard(_) ? phonePattern.slice(0, i).filter(isWildcard).length : -1);
2539
- function normalizePhone(phone) {
2540
- const phoneNumbers = phone.replace(/\D/g, '');
2541
- const applyPlaceholder = (_, i) => isDigit(_) ? _ : phoneNumbers.charAt(phoneWildcardIndicies[i]) || _;
2542
- const result = phonePattern.map(applyPlaceholder);
2543
- const resultLength = phoneWildcardIndicies.indexOf(phoneNumbers.length - 1) + 1;
2544
- return (resultLength ? result.slice(0, Math.max(firstPlaceholderIndex, resultLength)) : result).join('');
2545
- }
2546
-
2547
- const PhoneInput = JSX(({ children, onChange, ...inputProps }) => {
2548
- const handleChange = useCallback((v) => onChange && onChange(normalizePhone(v)), [onChange]);
2549
- const handleBlur = useCallback((v) => {
2550
- if (v === '+7 (') {
2551
- onChange && onChange('');
2552
- }
2553
- }, []);
2554
- return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
2555
- });
2556
-
2557
- 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)] })));
2558
-
2559
- const PhoneField = JSX(({ field, input }) => {
2560
- const fieldName = input?.name || 'phone';
2561
- 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 }));
2562
- });
2563
-
2564
- const PositionOrganizationField = JSX(({ field, input }) => {
2565
- const { data: positionOrganization } = useLeadFormData('POSITION');
2566
- 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 }));
2567
- });
2568
-
2569
- 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);
2570
-
2571
- 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) })));
2572
- const arrayToOptions = (array) => (array ?? []).map((_) => ({ key: _, value: _ }));
2573
2675
 
2574
- const REGIONS_URL = `${API_BASE_URI}/regions`;
2575
- function useRegions(url = REGIONS_URL) {
2576
- const { data } = useAsyncData(url, fetchJSONUnsafe);
2577
- return Array.isArray(data) ? data : [];
2676
+ function normalizeWithMask(value, pattern) {
2677
+ const valueNumbers = value.replace(/\D/g, '');
2678
+ if (valueNumbers === '' || value?.length === pattern.length) {
2679
+ return value;
2680
+ }
2681
+ const patternInArr = [...pattern];
2682
+ const firstPlaceholderIndex = patternInArr.findIndex(isPlaceholder$1);
2683
+ const valueWildcardIndicies = patternInArr.map((_, i) => isWildcard$1(_) ? patternInArr.slice(0, i).filter(isWildcard$1).length : -1);
2684
+ const applyPlaceholder = (_, i) => isDigit$1(_) ? _ : valueNumbers.charAt(valueWildcardIndicies[i]) || _;
2685
+ const resultInArr = patternInArr.map(applyPlaceholder);
2686
+ const resultLength = valueWildcardIndicies.indexOf(valueNumbers.length - 1) + 1;
2687
+ return resultInArr.slice(0, Math.max(firstPlaceholderIndex, resultLength)).join('');
2578
2688
  }
2689
+ const isPlaceholder$1 = (_) => _ === '_';
2690
+ const isDigit$1 = (_) => /\d/.test(_);
2691
+ const isWildcard$1 = (_) => isPlaceholder$1(_) || isDigit$1(_);
2579
2692
 
2580
- const RegionField = JSX(({ field, input, url }) => {
2581
- const regions = useRegions(url);
2582
- 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) }));
2583
- });
2584
-
2585
- const RegionPremiumField = JSX(({ field, input }) => {
2586
- const branchByRegions = useBranchesByRegions(true);
2587
- const regions = useMemo(() => branchByRegions?.map(({ region }) => ({
2588
- key: region,
2589
- text: region,
2590
- })), [branchByRegions]);
2591
- 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) }));
2592
- });
2593
-
2594
- const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
2595
- const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
2596
- const onToggle = useCallback(() => {
2597
- setIsUnfolded((_) => !_);
2598
- }, []);
2599
- const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
2600
- const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
2601
- return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
2602
- });
2693
+ const START_YEAR = 1940;
2694
+ const getYears = () => Array.from({ length: new Date().getFullYear() - START_YEAR + 1 }, (_, i) => START_YEAR + i);
2603
2695
 
2604
- function useResizeObserver(callback, deps) {
2696
+ const ICON_PROPS$1 = {
2697
+ name: 'CalendarIcon',
2698
+ iconVersion: 'black',
2699
+ width: '24',
2700
+ height: '24',
2701
+ };
2702
+ const DatePickerInput = JSX(({ setSelectedMonth, setSelectedYear, className, value, disabled, onChange, onClick }) => {
2605
2703
  const ref = useRef(null);
2606
- useEffect(() => {
2607
- const element = ref?.current;
2608
- if (!element) {
2609
- return undefined;
2704
+ const [inputValue, setInputValue] = useState(value || '');
2705
+ const handleChange = (ev) => {
2706
+ const val = ev.target?.value;
2707
+ if (typeof val === 'string' && val?.length < 11) {
2708
+ setInputValue(normalizeWithMask(val, '__.__.____'));
2610
2709
  }
2611
- const observer = new ResizeObserver((entries) => {
2612
- callback(element, entries[0]);
2613
- });
2614
- observer.observe(element);
2615
- return () => {
2616
- observer.disconnect();
2617
- };
2618
- }, [callback, ...deps]);
2619
- return ref;
2620
- }
2621
-
2622
- const FoldableSection = JSX(({ className = '', isUnfolded, children }) => {
2623
- const containerRef = useRef(null);
2624
- const childrenWrapperRef = useResizeObserver((childrenWrapperEl) => {
2625
- if (containerRef.current) {
2626
- containerRef.current.style.maxHeight = isUnfolded
2627
- ? `${childrenWrapperEl.scrollHeight}px`
2628
- : '';
2710
+ };
2711
+ const onBlur = () => {
2712
+ if (checkIsValidDate(inputValue)) {
2713
+ const [day, month, year] = inputValue.split('.');
2714
+ onChange?.(new Date(Number(year), Number(month) - 1, Number(day)));
2715
+ setSelectedMonth(Number(month) - 1);
2716
+ setSelectedYear(Number(year));
2629
2717
  }
2630
- }, [isUnfolded]);
2631
- 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 }) }));
2632
- });
2633
-
2634
- const CardCell = JSX(({ value, subText, children, isPhone, ...props }) => {
2635
- const textItems = (Array.isArray(value) ? value : value?.split(',') ?? []).filter(Boolean);
2636
- if ([textItems.length, children, subText].every((_) => !_)) {
2637
- return null;
2638
- }
2639
- return renderCardCell({ textItems, subText, children, isPhone, ...props });
2718
+ else {
2719
+ setInputValue(value || '');
2720
+ }
2721
+ };
2722
+ const onInputClick = () => {
2723
+ if (ref.current !== null) {
2724
+ ref.current.focus();
2725
+ }
2726
+ onClick?.();
2727
+ };
2728
+ useEffect(() => {
2729
+ setInputValue(value || '');
2730
+ }, [value]);
2731
+ 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 })] }));
2640
2732
  });
2641
- 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] }));
2642
- 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))));
2643
- const cleanPhoneNumber = (phone) => phone.replace(/\D/g, '');
2733
+ const isValidYear = (year) => Number(year) >= START_YEAR && Number(year) <= new Date().getFullYear();
2734
+ const isValidMonth = (month) => Number(month) > 0 && Number(month) < 13;
2735
+ const checkIsValidDate = (date) => {
2736
+ const [day, month, year] = date.split('.');
2737
+ if (isValidYear(year)) {
2738
+ if (isValidMonth(month)) {
2739
+ const currentDate = new Date(Number(year), Number(month) - 1, 1);
2740
+ let maxDateOfMonth = 0;
2741
+ while (currentDate.getMonth() === Number(month) - 1) {
2742
+ currentDate.setDate(currentDate.getDate() + 1);
2743
+ maxDateOfMonth++;
2744
+ }
2745
+ if (Number(day) > 0 && Number(day) <= maxDateOfMonth) {
2746
+ return true;
2747
+ }
2748
+ }
2749
+ }
2750
+ return false;
2751
+ };
2644
2752
 
2645
- 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 })));
2753
+ const formStyle = 'flex justify-between items-center h-14 border rounded-md cursor-pointer ' +
2754
+ 'hover:border-black active:border-black focus:border-black';
2755
+ 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') }));
2646
2756
 
2647
- const getScheduleDescription = (workScheduleWeek) => {
2648
- const rows = getDateDescription(workScheduleWeek);
2649
- return jsx(CardCell, { label: "\u0420\u0435\u0436\u0438\u043C \u0440\u0430\u0431\u043E\u0442\u044B", value: rows, className: "max-w-none" });
2757
+ const MONTHS_COUNT = 11;
2758
+ const MONTHS_OPTIONS = months.map((key) => ({ key }));
2759
+ const YEARS_OPTIONS = getYears()
2760
+ .reverse()
2761
+ .map((key) => ({ key: String(key) }));
2762
+ const useDatePickerManager = ({ onShowCalendar, showCalendar, selectedMonth, onMonthSelect, onYearSelect, selectedYear, onChange, value, }) => {
2763
+ const close = useCallback(() => showCalendar && onShowCalendar(false), [showCalendar]);
2764
+ const ref = useOutsideClick(close);
2765
+ const handleChangeVisibleCalendar = useCallback(() => onShowCalendar(!showCalendar), [showCalendar]);
2766
+ const handleNextMonth = useCallback(() => {
2767
+ if (selectedMonth + 1 <= MONTHS_COUNT) {
2768
+ onMonthSelect(selectedMonth + 1);
2769
+ }
2770
+ else {
2771
+ onMonthSelect(0);
2772
+ onYearSelect(selectedYear + 1);
2773
+ }
2774
+ }, [selectedMonth]);
2775
+ const handlePrevMonth = useCallback(() => {
2776
+ if (selectedMonth - 1 >= 0) {
2777
+ onMonthSelect(selectedMonth - 1);
2778
+ }
2779
+ else {
2780
+ onMonthSelect(11);
2781
+ onYearSelect(selectedYear - 1);
2782
+ }
2783
+ }, [selectedMonth]);
2784
+ const handleSelectMonth = useCallback(({ key }) => {
2785
+ onMonthSelect(months.indexOf(key));
2786
+ const maxDateOfMonth = calculateMaxDaysOfMonth(selectedYear, months.indexOf(key));
2787
+ handleChangeMonth({
2788
+ maxDateOfMonth,
2789
+ selectedYear,
2790
+ selectedMonth: months.indexOf(key),
2791
+ value,
2792
+ onChange,
2793
+ });
2794
+ }, [value]);
2795
+ const handleSelectYear = useCallback(({ key }) => {
2796
+ onYearSelect(Number(key));
2797
+ value && onChange?.(new Date(Number(key), selectedMonth, value?.getDate()));
2798
+ }, [value]);
2799
+ return {
2800
+ handleChangeVisibleCalendar,
2801
+ handleNextMonth,
2802
+ handlePrevMonth,
2803
+ handleSelectMonth,
2804
+ handleSelectYear,
2805
+ monthsOptions: MONTHS_OPTIONS,
2806
+ yearsOptions: YEARS_OPTIONS,
2807
+ ref,
2808
+ };
2650
2809
  };
2651
- const buildScheduleText = ({ workTime = '', lunchHour = '', daysOff = '' }, isSaturday = false) => {
2652
- if (!workTime) {
2653
- return '';
2810
+ const calculateMaxDaysOfMonth = (selectedYear, selectedMonth) => {
2811
+ const date = new Date(selectedYear, selectedMonth, 1);
2812
+ let maxDateOfMonth = 0;
2813
+ while (date.getMonth() === selectedMonth) {
2814
+ maxDateOfMonth++;
2815
+ date.setDate(date.getDate() + 1);
2654
2816
  }
2655
- return [
2656
- `${isSaturday ? 'Суббота' : 'Будние дни'}: ${workTime}`,
2657
- lunchHour ? `перерыв: ${lunchHour}` : '',
2658
- daysOff ? `не работает: ${daysOff}` : '',
2659
- ]
2660
- .filter(Boolean)
2661
- .join('; ');
2817
+ return maxDateOfMonth;
2662
2818
  };
2663
- const getDateDescription = (workScheduleWeek) => {
2664
- const workingWeekday = workScheduleWeek.find((_) => _.key !== 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
2665
- const workingSaturday = workScheduleWeek.find((_) => _.key === 'workingSaturday' && Boolean(_.status) && Boolean(_.workTime));
2666
- const daysOff = workScheduleWeek
2667
- .filter((_) => !_.status)
2668
- .map((_) => _.short?.toLowerCase())
2669
- .join(', ');
2670
- const rows = [
2671
- buildScheduleText({
2672
- workTime: workingWeekday?.workTime,
2673
- lunchHour: workingWeekday?.lunchHour,
2674
- daysOff: workingSaturday ? '' : daysOff,
2675
- }),
2676
- buildScheduleText({ workTime: workingSaturday?.workTime, lunchHour: workingSaturday?.lunchHour, daysOff }, true),
2677
- ].filter(Boolean);
2678
- return rows;
2819
+ const handleChangeMonth = ({ maxDateOfMonth, selectedYear, selectedMonth, value, onChange, }) => {
2820
+ value &&
2821
+ onChange?.(new Date(selectedYear, selectedMonth, Math.min(maxDateOfMonth, value.getDate())));
2679
2822
  };
2680
2823
 
2681
- const WEEKDAY_MAP = [
2682
- ['workingMonday', 'Пн', 'Понедельник'],
2683
- ['workingTuesday', 'Вт', 'Вторник'],
2684
- ['workingWednesday', 'Ср', 'Среда'],
2685
- ['workingThursday', 'Чт', 'Четверг'],
2686
- ['workingFriday', 'Пт', 'Пятница'],
2687
- ['workingSaturday', 'Сб', 'Суббота'],
2688
- ['workingSunday', 'Вс', 'Воскресенье'],
2689
- ];
2690
- const getWorkScheduleWeek = (workSchedule) => WEEKDAY_MAP.map(([key, short, title]) => ({
2691
- key,
2692
- title,
2693
- short,
2694
- status: Boolean(workSchedule?.[key]),
2695
- get workTime() {
2696
- return key === 'workingSaturday' ? workSchedule?.workTimeSaturday : workSchedule?.workTime;
2697
- },
2698
- get lunchHour() {
2699
- return key === 'workingSaturday' ? workSchedule?.lunchHourSaturday : workSchedule?.lunchHour;
2700
- },
2701
- get hasLunch() {
2702
- return /\d+/.test(this.lunchHour ?? '');
2703
- },
2704
- }));
2705
-
2706
- const renderBusinessSchedule = (scheduleDescription) => {
2707
- if (!scheduleDescription) {
2708
- return null;
2709
- }
2710
- const businessSchedule = getBusinessSchedule(scheduleDescription);
2711
- 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 }) })] }));
2824
+ const ICON_PROPS = {
2825
+ name: 'ArrowUpIcon',
2826
+ iconVersion: 'black',
2827
+ width: '24',
2828
+ height: '24',
2712
2829
  };
2713
- const getBusinessSchedule = (scheduleDescription) => {
2714
- const weekDayMap = WEEKDAY_MAP.map(([, short]) => ({ short, status: true }));
2715
- const splittedScheduleDescription = scheduleDescription.split('/') ?? [];
2716
- const lastPartScheduleDescription = splittedScheduleDescription[splittedScheduleDescription.length - 1]?.toLowerCase();
2717
- if (!lastPartScheduleDescription?.includes('выходной')) {
2718
- return weekDayMap;
2719
- }
2720
- return weekDayMap.map((_) => ({
2721
- ..._,
2722
- status: !lastPartScheduleDescription?.includes(_.short.toLowerCase()),
2723
- }));
2830
+ const SELECT_PROPS = {
2831
+ className: 'min-w-32',
2832
+ iconVersion: 'black',
2833
+ isBorder: false,
2724
2834
  };
2725
- 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)));
2835
+ const DatePicker = JSX(
2836
+ // eslint-disable-next-line max-lines-per-function
2837
+ ({ className = '', label = '', value, valid = true, minDate, maxDate, disabled, onChange }) => {
2838
+ const [showCalendar, { setValue }] = useBool(false);
2839
+ const [selectedMonth, setSelectedMonth] = useState(value?.getMonth() || new Date().getMonth());
2840
+ const [selectedYear, setSelectedYear] = useState(value?.getFullYear() || new Date().getFullYear());
2841
+ const { handlePrevMonth, handleNextMonth, handleSelectMonth, handleSelectYear, monthsOptions, yearsOptions, handleChangeVisibleCalendar, ref, } = useDatePickerManager({
2842
+ onYearSelect: setSelectedYear,
2843
+ onMonthSelect: setSelectedMonth,
2844
+ onShowCalendar: setValue,
2845
+ selectedYear,
2846
+ selectedMonth,
2847
+ showCalendar,
2848
+ onChange,
2849
+ value,
2850
+ });
2851
+ const spaceAbove = useElementSpace(ref, 370);
2852
+ return (jsxs("div", { className: style('space-y-xs', className), ref: ref, children: [renderLabel(label), jsxs("div", { className: "relative", children: [renderDatePickerForm({
2853
+ handleChangeVisibleCalendar,
2854
+ value,
2855
+ valid,
2856
+ onChange,
2857
+ disabled,
2858
+ setSelectedMonth,
2859
+ setSelectedYear,
2860
+ }), showCalendar && !disabled ? (jsxs("div", { className: style('absolute bg-white z-20 select-none', {
2861
+ 'bottom-full': spaceAbove,
2862
+ }), 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] })] }));
2863
+ });
2726
2864
 
2727
- 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)));
2865
+ 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)] })));
2728
2866
 
2729
- const colorStyle = {
2730
- yellow: { border: 'border-yellow-light', text: 'text-yellow' },
2731
- green: { border: 'border-green-more-light', text: 'text-green-dark' },
2732
- gray: { border: 'border-gray', text: 'text-secondary-text' },
2733
- red: { border: 'border-error/30', text: 'text-error' },
2734
- };
2735
- 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 })] })));
2867
+ 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 })));
2736
2868
 
2737
- const currentWeekDayIdx = new Date().getDay();
2738
- //TODO: Add logic time https://github.com/redneckz/wildless-cms-uni-blocks/pull/1549
2739
- const renderCurrentDaySchedule = (workScheduleWeek) => {
2740
- const [currentWeekDay] = workScheduleWeek?.slice(currentWeekDayIdx - 1) ?? [];
2741
- if (!currentWeekDay) {
2742
- return null;
2869
+ const MIN_AGE = 23;
2870
+ const MAX_AGE = 75;
2871
+ const AGE_ERROR_MESSAGE = 'Допустимый возраст заёмщика - от 23 до 75 лет';
2872
+ const FIELD_NAME$8 = 'birthday';
2873
+ const BirthdayField = JSX(({ field, input, isRetailForm = false }) => {
2874
+ const { value } = field(FIELD_NAME$8);
2875
+ 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) }));
2876
+ });
2877
+ const birthdayValidate = (date) => {
2878
+ const today = new Date();
2879
+ const minDate = new Date(today.getFullYear() - MIN_AGE, today.getMonth(), today.getDate());
2880
+ const maxDate = new Date(today.getFullYear() - MAX_AGE, today.getMonth(), today.getDate());
2881
+ if (!date || date > minDate || date < maxDate) {
2882
+ return false;
2743
2883
  }
2744
- const { lunchHour, status, workTime, hasLunch } = currentWeekDay;
2745
- 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" }));
2884
+ return true;
2746
2885
  };
2747
2886
 
2748
- const getSubTextLunch = ({ lunchHour, hasLunch = false, status = false }) => {
2749
- if (!status) {
2750
- return 'Не работает';
2751
- }
2752
- return lunchHour && hasLunch ? `Перерыв ${lunchHour}` : lunchHour;
2753
- };
2754
- 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)));
2887
+ const FIELD_NAME$7 = 'birthPlace';
2888
+ 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) })));
2755
2889
 
2756
- const ICONS$1 = ['ArrowDownIcon', 'ArrowUpIcon'];
2757
- const labels = ['Подробнее', 'Скрыть'];
2758
- 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" })] }));
2890
+ const CardCategoryField = JSX(({ field, input }) => {
2891
+ const { data: cardCategory } = useLeadFormData('CARD_TYPE');
2892
+ 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 }));
2893
+ });
2759
2894
 
2760
- const renderWorkSchedule = (workSchedule) => {
2761
- const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2762
- const timeOfWork = workSchedule ? getDateDescription(workScheduleWeek) : '';
2763
- const businessTimeOfWork = workSchedule ? workSchedule.businessScheduleDescription : '';
2764
- if (!workSchedule) {
2765
- return null;
2766
- }
2767
- if (!workSchedule.businessScheduleVisibleTag) {
2768
- return renderMatchingTimeOfWork(timeOfWork);
2769
- }
2770
- if (workSchedule.businessScheduleVisibleTag &&
2771
- workSchedule.businessScheduleDescription === null) {
2772
- return renderIndividualTimeOfWork(timeOfWork);
2773
- }
2774
- return renderDefaultTimeOfWork(timeOfWork, businessTimeOfWork);
2775
- };
2776
- const renderIndividualTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p>`;
2777
- const renderMatchingTimeOfWork = (timeOfWork) => `<p><b>Режим обслуживания физ. и юр. лиц:<br/></b> ${timeOfWork}</p>`;
2778
- const renderDefaultTimeOfWork = (timeOfWork, businessTimeOfWork) => `<p><b>Режим обслуживания физ.лиц:<br/></b>${timeOfWork}</p> <p><b>Режим обслуживания юр.лиц:<br/></b>${businessTimeOfWork}</p>`;
2895
+ 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 })));
2779
2896
 
2780
- const renderOfficeCard = ({ name, address, phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }, i) => {
2781
- if (!workSchedule) {
2782
- return null;
2783
- }
2784
- const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2785
- 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({
2786
- phone,
2787
- fax,
2788
- phoneBusiness,
2789
- phoneNatural,
2790
- phoneCallCentre,
2791
- phoneCurrencyControl,
2792
- workSchedule,
2793
- exchangeRate,
2794
- }) }), jsx(Foldable, { className: "block sm:hidden", renderFoldableSection: ({ isUnfolded }) => {
2795
- return (jsx(FoldableSection, { isUnfolded: isUnfolded, children: renderCardContent$1({
2796
- phone,
2797
- fax,
2798
- phoneBusiness,
2799
- phoneNatural,
2800
- phoneCallCentre,
2801
- phoneCurrencyControl,
2802
- workSchedule,
2803
- exchangeRate,
2804
- }) }));
2805
- },
2806
- //** TODO: remove styles with refactoring DefaultFoldButton*/
2807
- renderFoldButton: ({ isUnfolded, onToggle }) => renderFoldButton$3({ isUnfolded, onToggle }) })] }, String(i)));
2808
- };
2809
- const renderCardContent$1 = ({ phone, fax, phoneBusiness, phoneNatural, phoneCallCentre, phoneCurrencyControl, workSchedule, exchangeRate, }) => {
2810
- const workScheduleWeek = getWorkScheduleWeek(workSchedule);
2811
- const labelSchedule = workSchedule?.businessScheduleVisibleTag
2812
- ? 'Для физических лиц'
2813
- : 'Для физических и юридических лиц';
2814
- 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
2815
- ? renderBusinessSchedule(workSchedule?.businessScheduleDescription)
2816
- : null, exchangeRate?.currencies?.length ? (jsx(CardRow, { className: "flex-wrap", children: exchangeRate?.currencies?.map(renderCurrency) })) : null] }));
2817
- };
2818
- const capitalizedFirstLetter$1 = (text) => text ? `${text?.charAt(0)?.toUpperCase()}${text?.slice(1)}` : '';
2819
- const getOfficePoint = ({ name = '', address = '', workSchedule }) => {
2820
- const header = capitalizedFirstLetter$1(name);
2821
- const body = `${address} ${renderWorkSchedule(workSchedule)}`;
2822
- return { header, body };
2823
- };
2897
+ 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 })));
2824
2898
 
2825
- const isSSR = () => Boolean(typeof globalThis.process === 'object' && globalThis.process && globalThis.process.version);
2899
+ 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) })));
2826
2900
 
2827
- const isClient = !isSSR();
2828
- const ClientOnly = JSX(({ children }) => (isClient ? children : null));
2901
+ 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 })));
2829
2902
 
2830
- 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, {
2831
- 'backdrop-blur': blur,
2832
- }), 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" }) })));
2903
+ const ConfirmationIncomeField = JSX(({ field, input }) => {
2904
+ const { data: confirmationIncome } = useLeadFormData('INCOME_CERT_UNITED');
2905
+ 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 }));
2906
+ });
2833
2907
 
2834
- const MapMarkerClusterIcon = '/icons/MapMarkerClusterIcon.svg';
2835
- const MapMarkerClusterYellowIcon = '/icons/MapMarkerClusterYellowIcon.svg';
2836
- function renderClusterer({ yandexMaps, map, points, isLoad, }) {
2837
- if (isLoad || !points) {
2838
- return;
2839
- }
2840
- map.geoObjects.removeAll();
2841
- if (!points.length) {
2842
- return;
2843
- }
2844
- const clusterIconContentLayout = yandexMaps.templateLayoutFactory.createClass('<div style="margin-top: -3px;">{{properties.geoObjects.length}}</div>');
2845
- const officeClusterer = defineClusterer('offices', yandexMaps, clusterIconContentLayout);
2846
- if (points.length && points.every((_) => 'type' in _)) {
2847
- const remoteWorkplaceClusterer = defineClusterer('workplaces', yandexMaps, clusterIconContentLayout);
2848
- const remoteWorkplaceGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'workplaces'), 'workplaces', yandexMaps);
2849
- const officesGeoObjects = defineGeoObjects(points.filter((_) => _.type === 'offices'), 'offices', yandexMaps);
2850
- officeClusterer.add(officesGeoObjects);
2851
- remoteWorkplaceClusterer.add(remoteWorkplaceGeoObjects);
2852
- map.geoObjects.add(remoteWorkplaceClusterer);
2853
- map.geoObjects.add(officeClusterer);
2854
- }
2855
- else {
2856
- const geoObjects = defineGeoObjects(points, 'offices', yandexMaps);
2857
- officeClusterer.add(geoObjects);
2858
- map.geoObjects.add(officeClusterer);
2859
- }
2860
- map.setBounds(yandexMaps.util.bounds.fromPoints(points.map((_) => _.coords))).then(() => {
2861
- if (map.getZoom() > 10) {
2862
- map.setZoom(10);
2863
- }
2864
- });
2865
- }
2866
- const defineClusterer = (type, yandexMaps, clusterIconContentLayout) => {
2867
- return new yandexMaps.Clusterer({
2868
- clusterIcons: [
2869
- {
2870
- href: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
2871
- size: [78, 84],
2872
- offset: [-35, -50],
2873
- },
2874
- ],
2875
- clusterIconContentLayout,
2876
- clusterHideIconOnBalloonOpen: false,
2877
- geoObjectHideIconOnBalloonOpen: false,
2878
- });
2908
+ const ConscriptionField = JSX(({ field, input }) => {
2909
+ const { data: conscription } = useLeadFormData('MILITARY_STATUS');
2910
+ 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 }));
2911
+ });
2912
+
2913
+ const CONSENTS = {
2914
+ processPersonalDataFlg: {
2915
+ text: 'Согласие на обработку персональных данных',
2916
+ docId: 4,
2917
+ },
2918
+ consentInformFlg: {
2919
+ text: 'Согласие на информирование о продуктах и услугах Банка',
2920
+ docId: 14,
2921
+ },
2922
+ consentProviderFlg: {
2923
+ text: 'Согласие об использовании простой электронной подписи',
2924
+ docId: 5,
2925
+ },
2926
+ consentOthersFlg: {
2927
+ text: 'Прочие согласия',
2928
+ docId: 1,
2929
+ },
2930
+ consentPfrFlg: {
2931
+ text: 'Согласие на запрос в ПФР',
2932
+ docId: 3,
2933
+ },
2934
+ consentToReceiveMaterials: {
2935
+ text: 'Согласен на получение информационных и аналитических материалов по электронной почте',
2936
+ },
2879
2937
  };
2880
- const defineGeoObjects = (pointArr, type, yandexMaps) => {
2881
- return pointArr.map(({ coords, content }) => new yandexMaps.Placemark(coords, {
2882
- balloonContentHeader: content?.header,
2883
- balloonContentBody: content?.body,
2884
- balloonContentFooter: content?.footer,
2885
- hintContent: content?.hint,
2886
- }, {
2887
- iconLayout: 'default#image',
2888
- iconImageHref: type === 'offices' ? MapMarkerClusterIcon : MapMarkerClusterYellowIcon,
2889
- iconImageSize: [78, 84],
2890
- iconImageOffset: [-35, -50],
2891
- }));
2938
+
2939
+ const feedbackById = async (id, convertToPng = false) => {
2940
+ const response = await doRequest(`/feedback/file?id=${encodeURIComponent(id)}&convertToPngFlg=${convertToPng}`, 'GET');
2941
+ return await response.blob();
2892
2942
  };
2893
2943
 
2894
- const defaultStyle = {
2895
- focus: 'focus:border-primary-text focus:border',
2896
- hover: 'hover:bg-primary-hover',
2897
- active: 'active:bg-primary-active',
2898
- font: 'text-center font-sans',
2944
+ const getDocument = async (id, convertToPng = false) => {
2945
+ const response = await feedbackById(id, convertToPng);
2946
+ return URL.createObjectURL(response);
2899
2947
  };
2900
2948
 
2901
- const styles$1 = {
2902
- ...defaultStyle,
2903
- border: 'border border-transparent rounded-md',
2904
- position: 'absolute flex items-center justify-center',
2949
+ 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" }) })));
2950
+
2951
+ const Dialog = JSX(({ className, head, children, onClose, onClick }) => {
2952
+ const { close } = useDialogManager();
2953
+ const handleClose = useCallback(() => {
2954
+ close();
2955
+ onClose && onClose();
2956
+ }, [onClose]);
2957
+ 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 })] }));
2958
+ });
2959
+
2960
+ const openDocument = async (open, id, convertToPng = false) => {
2961
+ const document = await getDocument(id, convertToPng);
2962
+ 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" })) }));
2905
2963
  };
2906
- const renderUserGeolocation = (map, yandexMaps, className) => {
2907
- const setUserGeoLocation = () => {
2908
- // eslint-disable-next-line @typescript-eslint/ban-ts-comment
2909
- // @ts-ignore
2910
- yandexMaps.geolocation
2911
- .get({
2912
- provider: 'yandex',
2913
- autoReverseGeocode: true,
2914
- mapStateAutoApply: true,
2915
- })
2916
- .then(function (result) {
2917
- map.current.geoObjects.add(result.geoObjects);
2918
- });
2919
- };
2920
- 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" }) }));
2964
+
2965
+ const OPEN_DOC_BUTTON_TEXT = 'Ознакомиться';
2966
+ const CheckboxWithDoc = JSX(({ className, error, docId, ...props }) => {
2967
+ const { open } = useDialogManager();
2968
+ const isMobile = useMobileMode();
2969
+ 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)] }));
2970
+ });
2971
+
2972
+ 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);
2973
+
2974
+ const LABEL_TEXT = `Имеет ли юридическое лицо, акционером / участником / членом / пайщиком /
2975
+ вкладчиком с долей участия более 20% уставного капитала руководителем,
2976
+ которого Вы являетесь, кредит в АО «Россельхозбанк»`;
2977
+ const CreditInRshbCdField = JSX(({ field, input }) => {
2978
+ const { data: creditInRshbCd } = useLeadFormData('CREDIT_IN_RSHB');
2979
+ return (jsx(SelectField, { field: field, source: creditInRshbCd, label: LABEL_TEXT, fieldName: "creditInRshbCd", input: input }));
2980
+ });
2981
+
2982
+ const orientationStyleMap = {
2983
+ horizontal: '@lg:flex-row',
2984
+ vertical: '',
2921
2985
  };
2986
+ 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)))) })] })));
2922
2987
 
2923
- const getNS = (_) => globalThis[_];
2924
- const initializeExternalNS = (namespaceName, url) => {
2925
- const script = document.getElementById(url);
2926
- if (script) {
2927
- const ns = getNS(namespaceName);
2928
- if (ns) {
2929
- return Promise.resolve(ns);
2930
- }
2931
- else {
2932
- return new Promise((resolve) => {
2933
- script.addEventListener('load', () => {
2934
- resolve(getNS(namespaceName));
2935
- });
2936
- });
2937
- }
2938
- }
2939
- else {
2940
- return new Promise((resolve, reject) => {
2941
- const newScript = document.createElement('script');
2942
- newScript.src = url;
2943
- newScript.async = true;
2944
- newScript.id = url;
2945
- newScript.addEventListener('load', () => {
2946
- resolve(getNS(namespaceName));
2947
- });
2948
- newScript.addEventListener('error', (error) => {
2949
- reject(error);
2950
- });
2951
- document.head.appendChild(newScript);
2952
- });
2953
- }
2954
- };
2955
- function useExternalNS(namespaceName, url, unmountNS = true) {
2956
- const [externalNS, setExternalNS] = useState(undefined);
2957
- useEffect(() => {
2958
- let isMounted = true;
2959
- initializeExternalNS(namespaceName, url)
2960
- .then((ns) => {
2961
- if (isMounted) {
2962
- setExternalNS(ns);
2963
- }
2964
- })
2965
- .catch((error) => {
2966
- console.error(`Failed to initialize external namespace: ${error}`);
2967
- });
2968
- return () => {
2969
- isMounted = false;
2970
- if (unmountNS) {
2971
- const script = document.getElementById(url);
2972
- if (script) {
2973
- document.head.removeChild(script);
2974
- }
2975
- setExternalNS(undefined);
2976
- }
2977
- };
2978
- }, [namespaceName, url, unmountNS]);
2979
- return externalNS;
2980
- }
2988
+ 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)] })));
2981
2989
 
2982
- const YMAPS_NAMESPACE = 'ymaps';
2983
- const useYandexMaps = () => {
2984
- const url = `https://api-maps.yandex.ru/2.1/?apikey=${projectSettings.YANDEX_MAP_API_KEY || ''}&lang=ru_RU`;
2985
- return useExternalNS(YMAPS_NAMESPACE, url, false);
2986
- };
2990
+ const CURRENCY_TYPES = [{ id: 'rub', text: 'Рубль' }];
2991
+ const CurrencyField = JSX(({ field, input }) => {
2992
+ const { value, onChange } = field('currency');
2993
+ 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) }));
2994
+ });
2987
2995
 
2988
- const styles = {
2989
- ...defaultStyle,
2990
- border: 'border-b border-b-2 border-gray last:border-0',
2991
- position: 'relative flex items-center justify-center',
2992
- };
2993
- // TODO: Добавить метод определения центральной точки
2994
- const ZoomButton = JSX(({ yandexMaps, direction = 'in' }) => {
2995
- const iconName = direction === 'in' ? 'PlusIcon' : 'MinusIcon';
2996
- const changeZoom = () => {
2997
- const currentZoom = yandexMaps.current.getZoom();
2998
- const newZoom = direction === 'in' ? currentZoom + 1 : currentZoom - 1;
2999
- yandexMaps.current.setZoom(newZoom, { checkZoomRange: true });
3000
- };
3001
- 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" }) }));
2996
+ 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) })));
2997
+
2998
+ 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 })));
2999
+
3000
+ 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) })));
3001
+
3002
+ 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) })));
3003
+
3004
+ const FIELD_NAME$6 = 'dulIssueDateField';
3005
+ 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) })));
3006
+
3007
+ const FIELD_NAME$5 = 'dulIssuedBy';
3008
+ const DulIssuedByField = JSX(({ field, input }) => {
3009
+ const { value: dulSubdivisionCode, onChange: changeDulSubdivisionCode } = field('dulSubdivisionCode');
3010
+ const onDaDataChange = useCallback((item) => {
3011
+ changeDulSubdivisionCode?.(item?.data?.code?.replace('-', ''));
3012
+ }, []);
3013
+ 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 }));
3002
3014
  });
3003
3015
 
3004
- const DEFAULT_CENTER_COORDS = [55.753995, 37.614069];
3005
- // TODO: Поле для поиска: невыяснено среди каких данных делать поиск (искать в имени офиса, в адресе, метро и т.д.).
3006
- // Сейчас реализован поиск среди тестовых данных
3007
- // TODO: Также выяснить что делать когда ничего не найдено
3008
- // TODO: На макетах также когда есть поле поиска нет кнопки открыть на карте.
3009
- const YandexMap = JSX(({ points, className = '', zoom = 5, isLoad, selectedAddress }) => {
3010
- const map = useRef(null);
3011
- const yandexMaps = useYandexMaps();
3016
+ const FIELD_NAME$4 = 'dulNumber';
3017
+ 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) })));
3018
+
3019
+ const FIELD_NAME$3 = 'dulSerie';
3020
+ 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) })));
3021
+
3022
+ const FIELD_NAME$2 = 'dulSubdivisionCode';
3023
+ const DulSubdivisionCodeField = JSX(({ field, input }) => {
3024
+ const onDaDataChange = useCallback((item) => {
3025
+ field?.('dulIssuedBy')?.onChange?.(item?.data?.name);
3026
+ }, []);
3027
+ 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 }));
3028
+ });
3029
+
3030
+ const EducationField = JSX(({ field, input }) => {
3031
+ const { data: education } = useLeadFormData('EDUCATION_LEVEL');
3032
+ return (jsx(SelectField, { field: field, source: education, label: "\u041E\u0431\u0440\u0430\u0437\u043E\u0432\u0430\u043D\u0438\u0435", fieldName: "education", input: input }));
3033
+ });
3034
+
3035
+ const EmailField = JSX(({ field, input }) => {
3036
+ const { required, ...rest } = input;
3037
+ 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 }));
3038
+ });
3039
+
3040
+ const EmployerActivitiesField = JSX(({ field, input }) => {
3041
+ const { data: employerActivities } = useLeadFormData('ORGANIZATION_ACTIVITY_TYPE');
3042
+ 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 }));
3043
+ });
3044
+
3045
+ const EmployerOrganizationField = JSX(({ field, input }) => {
3046
+ const { data: employerOrganization } = useLeadFormData('ORGANIZATION_KIND');
3047
+ 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 }));
3048
+ });
3049
+
3050
+ const EmploymentField = JSX(({ field, input }) => {
3051
+ const { data: employment } = useLeadFormData('EMPLOYMENT_INFO_UNITED');
3052
+ 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 }));
3053
+ });
3054
+
3055
+ 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 })));
3056
+
3057
+ 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 })));
3058
+
3059
+ const FamilyMembersField = JSX(({ field }) => {
3060
+ const { value, onChange } = field('familyMembers');
3061
+ const familyStatusKey = field('familyStatus')?.value?.key;
3062
+ const adultsCount = familyStatusKey === 'MARRIED' ? 2 : 1;
3063
+ const childrenCount = Number(field('children')?.value);
3064
+ const dependentsCount = Number(field('dependents')?.value);
3065
+ const totalCount = adultsCount + childrenCount + dependentsCount;
3012
3066
  useEffect(() => {
3013
- if (map.current) {
3014
- renderClusterer({ yandexMaps, map: map.current, points, isLoad });
3015
- }
3016
- else {
3017
- yandexMaps?.ready(() => {
3018
- // Ready function may be called few times, but must be called once
3019
- if (map.current) {
3020
- renderClusterer({ yandexMaps, map: map.current, points, isLoad });
3021
- return;
3022
- }
3023
- map.current = new yandexMaps.Map('map', {
3024
- center: getCenterPoint(points),
3025
- zoom,
3026
- controls: [],
3027
- suppressMapOpenBlock: true,
3028
- });
3029
- renderClusterer({ yandexMaps, map: map.current, points, isLoad });
3030
- });
3031
- }
3032
- }, [yandexMaps, points, zoom, isLoad, selectedAddress]);
3067
+ field?.('familyMembers')?.onChange?.(totalCount);
3068
+ }, [familyStatusKey, childrenCount, dependentsCount]);
3069
+ 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?.(_) }));
3070
+ });
3071
+
3072
+ const FamilyStatusField = JSX(({ field, input }) => {
3073
+ const { data: familyStatus } = useLeadFormData('MARITAL_STATUS');
3074
+ 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 }));
3075
+ });
3076
+
3077
+ const SERVICE_TYPES = [
3078
+ { key: 'ULTRASERVICE', text: 'Ультра' },
3079
+ { key: 'PREMIUMSERVICE', text: 'Премиум' },
3080
+ ];
3081
+ const SERVICE_DIRECTIONS = [
3082
+ { key: 'Физическое лицо' },
3083
+ { key: 'Юридическое лицо / ИП' },
3084
+ ];
3085
+ const FEEDBACK_METHOD = [
3086
+ { key: 'phone', text: 'Телефонный звонок' },
3087
+ { key: 'email', text: 'Электронное сообщение' },
3088
+ ];
3089
+
3090
+ 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) })));
3091
+
3092
+ const FullNameField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0424\u0418\u041E", ...getValidation(field('fullName'), validatorObj.fullName, input?.required), ...input })));
3093
+
3094
+ 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 })));
3095
+
3096
+ const HousingField = JSX(({ field, input }) => {
3097
+ const { data: housing } = useLeadFormData('HOUSE_TYPE');
3098
+ return (jsx(SelectField, { field: field, source: housing, label: "\u0422\u0438\u043F \u0436\u0438\u043B\u044C\u044F", fieldName: "housing", input: input }));
3099
+ });
3100
+
3101
+ const InnField = JSX(({ field, input }) => {
3102
+ const onDaDataChange = useCallback((item) => {
3103
+ field?.('organizationName')?.onChange?.(item.data?.name?.short_with_opf);
3104
+ field?.('legalForm')?.onChange?.(item.data?.opf?.short);
3105
+ }, []);
3106
+ return (jsx(InputControl, { label: "\u0418\u041D\u041D", type: "number", maxLength: 12, ...input, ...getValidation(field('inn'), validatorObj.inn, input?.required), onDaDataChange: onDaDataChange }));
3107
+ });
3108
+
3109
+ 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"' })));
3110
+
3111
+ 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 })));
3112
+
3113
+ 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 })));
3114
+
3115
+ const LegalEntityNameField = JSX(({ field, input }) => {
3116
+ 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) }));
3117
+ });
3118
+
3119
+ 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 })));
3120
+
3121
+ const OUT_SERVICE_BASE_URL = `${API_BASE_URI}/outservice`;
3122
+ const EMPTY_REGIONS = [];
3123
+ async function getOutServiceRegions() {
3124
+ const data = await fetchJSON(`${OUT_SERVICE_BASE_URL}/outserviceregions`);
3125
+ return data && Array.isArray(data) ? data : EMPTY_REGIONS;
3126
+ }
3127
+
3128
+ const LocalitiesField = JSX(({ field, input }) => {
3129
+ const fieldRegion = field('region');
3130
+ const regionKey = fieldRegion?.value?.key;
3131
+ const { data: regions } = useAsyncData('outServiceRegions', getOutServiceRegions);
3132
+ const localities = regions
3133
+ ?.find((_) => _.code === regionKey)
3134
+ ?.localities?.map((_) => ({ key: _, text: _ }));
3033
3135
  useEffect(() => {
3034
- if (map.current && selectedAddress) {
3035
- yandexMaps?.geocode(selectedAddress).then((res) => {
3036
- const firstGeoObject = res.geoObjects.get(0);
3037
- const coords = firstGeoObject.geometry.getCoordinates();
3038
- map.current.setCenter(coords);
3039
- map.current.setZoom(18);
3040
- });
3136
+ if (regionKey !== '') {
3137
+ field?.('localities')?.onChange?.('');
3041
3138
  }
3042
- }, [selectedAddress]);
3043
- if (!yandexMaps) {
3044
- return null;
3045
- }
3046
- const zIndex = 'z-10';
3047
- 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))] }));
3139
+ }, [regionKey]);
3140
+ 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 }));
3048
3141
  });
3049
- const getCenterPoint = (points) => {
3050
- const centerCoords = [
3051
- getArraySumAndAverage(mapByIndex(points, 0)),
3052
- getArraySumAndAverage(mapByIndex(points, 1)),
3053
- ];
3054
- return centerCoords.every((_) => _) ? centerCoords : DEFAULT_CENTER_COORDS;
3055
- };
3056
- const mapByIndex = (points, index) => points.map((_) => _.coords?.[index]);
3057
- const getArraySumAndAverage = (arr) => arr.length && arr.reduce((a, b) => a + b) / arr.length;
3058
3142
 
3059
- const INITIAL_FILTRATION_STATE$1 = {
3060
- workingSaturday: false,
3061
- premiumService: false,
3062
- privateBanking: false,
3063
- remoteWorkplace: false,
3064
- serviceDisabledPeople: false,
3065
- sellingCoins: false,
3066
- buyingCoins: false,
3067
- bullionOperations: false,
3068
- preciousMetalsOperations: false,
3069
- transferringDataToBiometricSystem: false,
3070
- };
3071
- const FILTRATION_LABELS = {
3072
- safeBoxCaseVolumes: 'Аренда индивидуальных сейфовых ячеек',
3073
- workingSaturday: 'Открыты по субботам',
3074
- terminalTypeAtms: 'Банкоматы',
3075
- terminalTypeTerm: 'Терминалы',
3076
- workAllTime: 'Круглосуточно',
3077
- billAcceptorEnable: 'Прием наличных',
3078
- premiumService: 'Премиальное обслуживание',
3079
- privateBanking: 'Услуга Private banking',
3080
- sellingCoins: 'Продажа монет из драгоценных металлов',
3081
- buyingCoins: 'Покупка монет из драгоценных металлов',
3082
- bullionOperations: 'Операции со слитками',
3083
- preciousMetalsOperations: 'Операции с драгоценными металлами',
3084
- transferringDataToBiometricSystem: 'Передача фото и голоса в Единую биометрическую систему',
3085
- locationDisabledPeople: 'Для маломобильных',
3086
- designDisabledPeople: 'Для слабовидящих',
3087
- remoteWorkplace: 'Удаленное рабочее место',
3088
- serviceDisabledPeople: 'Для маломобильных граждан',
3089
- };
3090
- const FILTRATION_PREDICATES$1 = {
3091
- workingSaturday: (item) => Boolean('workSchedule' in item && item.workSchedule?.workingSaturday),
3092
- premiumService: (item) => Boolean('premiumService' in item && item.premiumService),
3093
- privateBanking: (item) => Boolean('privateBanking' in item && item.privateBanking),
3094
- remoteWorkplace: (item) => Boolean('workScheduleDescription' in item),
3095
- serviceDisabledPeople: (item) => Boolean('serviceDisabledPeople' in item && item.serviceDisabledPeople),
3096
- sellingCoins: (item) => Boolean('sellingCoins' in item && item.sellingCoins),
3097
- buyingCoins: (item) => Boolean('buyingCoins' in item && item.buyingCoins),
3098
- bullionOperations: (item) => Boolean('bullionOperations' in item && item.bullionOperations),
3099
- preciousMetalsOperations: (item) => Boolean('preciousMetalsOperations' in item && item.preciousMetalsOperations),
3100
- transferringDataToBiometricSystem: (item) => Boolean('transferringDataToBiometricSystem' in item && item.transferringDataToBiometricSystem),
3101
- };
3143
+ 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 })));
3144
+
3145
+ const METHODS_OF_OBTAIN = [
3146
+ { id: 'office', text: 'В отделении Банка' },
3147
+ { id: 'courier', text: 'Курьерская доставка' },
3148
+ ];
3149
+ const MethodObtainField = JSX(({ field, input }) => (jsx(RadioButtonGroupControl, { orientation: "horizontal", items: METHODS_OF_OBTAIN, ...getValidation(field('methodObtain'), validatorObj.methodObtain, input?.required) })));
3150
+
3151
+ const FIELD_NAME$1 = 'middleName';
3152
+ 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 })));
3153
+
3154
+ 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 })));
3155
+
3156
+ 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] })));
3157
+
3158
+ 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);
3159
+
3160
+ const OrganizationField = JSX(({ field, input }) => {
3161
+ const { data: organization } = useLeadFormData('ORGANIZATION_TYPE');
3162
+ 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 }));
3163
+ });
3164
+
3165
+ const OrganizationNameField = JSX(({ field, input }) => {
3166
+ const onDaDataChange = useCallback((item) => {
3167
+ field?.('inn')?.onChange?.(item.data?.inn);
3168
+ field?.('legalForm')?.onChange?.(item.data?.opf?.short);
3169
+ }, []);
3170
+ 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 }));
3171
+ });
3172
+
3173
+ 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 })));
3174
+
3175
+ 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) })));
3176
+
3177
+ const MAX_PART = 100;
3178
+ const PartInBusinessField = JSX(({ field, input }) => {
3179
+ const isBusinessOwner = field('positionOrganization')?.value?.key === 'BUSINESS_OWNER';
3180
+ const partInBusinessField = {
3181
+ ...getValidation(field('partInBusiness'), validatorObj.partInBusiness, input?.required),
3182
+ };
3183
+ const handleChange = (value) => partInBusinessField?.onChange &&
3184
+ partInBusinessField?.onChange(String(Number(value) > MAX_PART ? MAX_PART : Number(value) || ''));
3185
+ 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 }));
3186
+ });
3187
+
3188
+ const PartnerCommentsField = JSX(({ field, input }) => {
3189
+ const { required, ...rest } = input;
3190
+ 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 }));
3191
+ });
3192
+
3193
+ const PAYMENT_SYSTEM_TYPES = [
3194
+ { id: 'mir', text: 'Карта МИР' },
3195
+ { id: 'union_pay', text: 'UnionPay' },
3196
+ ];
3197
+ const PaymentSystemField = JSX(({ field, input }) => {
3198
+ const { value, onChange } = field('paymentSystem');
3199
+ 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) }));
3200
+ });
3102
3201
 
3103
- function useButton() {
3104
- return (props) => ({
3105
- ...props,
3106
- onClick: handlerDecorator(handleClick(props)),
3107
- });
3108
- }
3109
- function handleClick({ disabled, onClick }) {
3110
- return (ev) => {
3111
- !disabled && onClick && onClick(ev);
3112
- };
3202
+ const isPlaceholder = (_) => _ === '_';
3203
+ const isDigit = (_) => /\d/.test(_);
3204
+ const isWildcard = (_) => isPlaceholder(_) || isDigit(_);
3205
+ const phonePattern = [...'+7 (___) ___-__-__'];
3206
+ const firstPlaceholderIndex = phonePattern.findIndex(isPlaceholder);
3207
+ const phoneWildcardIndicies = phonePattern.map((_, i) => isWildcard(_) ? phonePattern.slice(0, i).filter(isWildcard).length : -1);
3208
+ function normalizePhone(phone) {
3209
+ const phoneNumbers = phone.replace(/\D/g, '');
3210
+ const applyPlaceholder = (_, i) => isDigit(_) ? _ : phoneNumbers.charAt(phoneWildcardIndicies[i]) || _;
3211
+ const result = phonePattern.map(applyPlaceholder);
3212
+ const resultLength = phoneWildcardIndicies.indexOf(phoneNumbers.length - 1) + 1;
3213
+ return (resultLength ? result.slice(0, Math.max(firstPlaceholderIndex, resultLength)) : result).join('');
3113
3214
  }
3114
3215
 
3115
- const buttonStyleMap = {
3116
- primary: 'text-white bg-primary-main hover:bg-primary-hover active:bg-primary-active',
3117
- secondary: 'text-primary-main bg-main-divider hover:text-white hover:bg-primary-hover active:bg-primary-active',
3118
- };
3119
- const secondaryButtonStyleMap = {
3120
- 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'),
3121
- 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'),
3122
- };
3123
- const Button = JSX(({ children, ...props }) => {
3124
- const button = useButton();
3125
- const { className, version = 'primary', active, disabled, type = 'button', rounded = true, role, onClick, } = button(props);
3126
- return (jsx("button", { className: style('font-sans px-9 py-4', 'flex justify-center items-center gap-xs', {
3127
- 'text-white bg-primary-active': active,
3128
- 'bg-main-gray text-main-disabled cursor-not-allowed': disabled,
3129
- 'rounded-md': rounded,
3130
- }, !active && !disabled
3131
- ? style(buttonStyleMap[version], secondaryButtonStyleMap[version])
3132
- : '', className), type: type, role: role, onClick: onClick, children: children }));
3216
+ const PhoneInput = JSX(({ children, onChange, ...inputProps }) => {
3217
+ const handleChange = useCallback((v) => onChange && onChange(normalizePhone(v)), [onChange]);
3218
+ const handleBlur = useCallback((v) => {
3219
+ if (v === '+7 (') {
3220
+ onChange && onChange('');
3221
+ }
3222
+ }, []);
3223
+ return (jsx(Input, { ...inputProps, onChange: handleChange, onFocus: (ev) => handleChange(ev?.target?.value || ''), onBlur: (ev) => handleBlur(ev?.target?.value || ''), children: children }));
3133
3224
  });
3134
3225
 
3135
- const getVersion = (isPrimary, type) => isPrimary && type !== 'underlined' ? 'primary' : 'secondary';
3226
+ 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)] })));
3136
3227
 
3137
- const renderButtonsGroup = (data, activeButton, onButtonClick) => {
3138
- const allButtonVersion = getVersion(activeButton === 'all');
3139
- const businessButtonVersion = getVersion(activeButton === 'business');
3140
- const handleClick = (e, key, branches) => {
3141
- const filteredBranches = e.currentTarget === e.target && key === 'business' ? filterBranches(branches) : branches;
3142
- onButtonClick(key);
3143
- return filteredBranches;
3144
- };
3145
- const filterBranches = (branches) => branches.filter((branch) => branch.workSchedule &&
3146
- branch.workSchedule.businessScheduleVisibleTag &&
3147
- !branch.workSchedule.businessScheduleDescription);
3148
- 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" })] }));
3149
- };
3228
+ const PhoneField = JSX(({ field, input }) => {
3229
+ const fieldName = input?.name || 'phone';
3230
+ 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 }));
3231
+ });
3150
3232
 
3151
- 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;
3233
+ const PositionOrganizationField = JSX(({ field, input }) => {
3234
+ const { data: positionOrganization } = useLeadFormData('POSITION');
3235
+ 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 }));
3236
+ });
3152
3237
 
3153
- const COMMON_FILTERS_STYLES = 'flex flex-col sm:flex-row sm:flex-wrap gap-3xl pb-2xl';
3154
- const renderFiltrationForm = ({ filters, field: { field, reset }, onlyOffice, labels, }) => {
3155
- const visibleFiltersNum = onlyOffice ? 5 : 6;
3156
- const filtersCheckbox = (filters || []).map((key) => (jsx(Checkbox, { text: labels[key], ...field(key) }, key)));
3157
- const [visibleFilters, hiddenFilters] = visibleFiltersNum > 0
3158
- ? [filtersCheckbox.slice(0, visibleFiltersNum), filtersCheckbox.slice(visibleFiltersNum)]
3159
- : [filtersCheckbox, []];
3160
- 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 }));
3161
- };
3162
- const renderFoldButton$2 = (reset, onlyOffice = false) => ({ isUnfolded, onToggle }) => {
3163
- const labels = ['Больше фильтров', 'Меньше фильтров'];
3164
- const icons = ['ArrowDownIcon', 'ArrowUpIcon'];
3165
- 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() })] }));
3166
- };
3167
- 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" })] }));
3238
+ 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);
3168
3239
 
3169
- 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] }) }));
3240
+ 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) })));
3241
+ const arrayToOptions = (array) => (array ?? []).map((_) => ({ key: _, value: _ }));
3170
3242
 
3171
- const defaultEmptyFunction$1 = () => void 0;
3172
- const filtersVisibleStyles = (activeButton) => activeButton === 'all' ? 'block' : 'hidden';
3173
- const OfficesAtmsMapLayout = JSX(({ className, data = [], isLoad, remoteWorkplaces = [], renderCard = defaultEmptyFunction$1, renderRemoteWorkplaceCard = defaultEmptyFunction$1, getBalloon = defaultEmptyFunction$1, getBalloonRemoteWorkplaces = defaultEmptyFunction$1, descriptionData, title, }) => {
3174
- const onlyOffice = title?.includes('Офис');
3175
- const [filtrationState, { field, reset }] = useForm(INITIAL_FILTRATION_STATE$1);
3176
- const { filteredItems, points, filteredRemoteWorkplaces, lengthItems } = useOfficesAtmsMapData({
3177
- data,
3178
- remoteWorkplaces,
3179
- filtrationState,
3180
- getBalloon,
3181
- getBalloonRemoteWorkplaces,
3182
- });
3183
- const [activeButton, setActiveButton] = useState('all');
3184
- const filterOptions = {
3185
- filters: getFiltersWithNonEmptyData([...data, ...remoteWorkplaces]),
3186
- field: { field, reset },
3187
- onlyOffice,
3188
- labels: FILTRATION_LABELS,
3189
- };
3190
- 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)] })] }));
3191
- });
3192
- const filterItems$1 = (data, filtrationState) => {
3193
- const truthyFilters = Object.keys(filtrationState).filter((key) => filtrationState[key]);
3194
- return data.filter((item) => truthyFilters.every((_) => FILTRATION_PREDICATES$1[_](item)));
3195
- };
3196
- const getFiltersWithNonEmptyData = (data) => Object.keys(INITIAL_FILTRATION_STATE$1).filter((_) => data.filter((item) => FILTRATION_PREDICATES$1[_](item)).length);
3243
+ const REGIONS_URL = `${API_BASE_URI}/regions`;
3244
+ function useRegions(url = REGIONS_URL) {
3245
+ const { data } = useAsyncData(url, fetchJSONUnsafe);
3246
+ return Array.isArray(data) ? data : [];
3247
+ }
3197
3248
 
3198
- const defaultEmptyFunction = () => void 0;
3199
- const useOfficesAtmsMapData = ({ data, remoteWorkplaces = [], filtrationState = {}, getBalloon = defaultEmptyFunction, getBalloonRemoteWorkplaces = defaultEmptyFunction, }) => {
3200
- const [filteredItems, points, filteredRemoteWorkplaces, lengthItems] = useMemo(() => {
3201
- const _filteredItems = filterItems$1(data, filtrationState);
3202
- const _filteredRemoteWorkplaces = filterItems$1(remoteWorkplaces, filtrationState);
3203
- const _points = [
3204
- ..._filteredItems.map((_) => ({
3205
- type: 'offices',
3206
- coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
3207
- content: getBalloon(_),
3208
- })),
3209
- ..._filteredRemoteWorkplaces.map((_) => ({
3210
- type: 'workplaces',
3211
- coords: [Number(_.gpsLatitude), Number(_.gpsLongitude)]?.filter(Boolean),
3212
- content: getBalloonRemoteWorkplaces({
3213
- address: _.address,
3214
- workScheduleDescription: _.workScheduleDescription,
3215
- }),
3216
- })),
3217
- ].filter((_) => _.coords && _.coords.length === 2);
3218
- const itemsLength = _filteredItems.length + _filteredRemoteWorkplaces?.length;
3219
- return [_filteredItems, _points, _filteredRemoteWorkplaces, itemsLength];
3220
- }, [data, remoteWorkplaces, filtrationState, getBalloon, getBalloonRemoteWorkplaces]);
3221
- return { filteredItems, points, filteredRemoteWorkplaces, lengthItems };
3222
- };
3249
+ const RegionField = JSX(({ field, input, url }) => {
3250
+ const regions = useRegions(url);
3251
+ 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) }));
3252
+ });
3223
3253
 
3224
- const RetailAddressField = JSX(({ field, input }) => {
3225
- const fieldRegion = field('regionRetail');
3226
- const fieldBranch = field('addressRetail');
3227
- const regions = useBranchesByRegions();
3228
- const regionKey = fieldRegion?.value?.key;
3229
- const selectedRegion = regions.find(({ region }) => region === regionKey);
3230
- const isLoad = !regions;
3231
- const regionText = fieldRegion?.value?.text;
3232
- const addressBranchRetail = useBranchesByRegions()?.find((_) => _?.region === regionText)?.branches;
3233
- useEffect(() => {
3234
- if (fieldRegion?.value?.key !== '') {
3235
- field?.('addressRetail')?.onChange?.('');
3236
- }
3237
- }, [fieldRegion?.value]);
3238
- const { points } = useOfficesAtmsMapData({
3239
- data: selectedRegion?.branches || [],
3240
- filtrationState: {},
3241
- getBalloon: getOfficePoint,
3242
- });
3243
- const isRegionSelected = Boolean(fieldRegion?.value?.key);
3244
- 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 = '' }) => ({
3245
- key: address,
3246
- text: address,
3247
- })), ...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 }) }) })] }));
3254
+ const RegionPremiumField = JSX(({ field, input }) => {
3255
+ const branchByRegions = useBranchesByRegions(true);
3256
+ const regions = useMemo(() => branchByRegions?.map(({ region }) => ({
3257
+ key: region,
3258
+ text: region,
3259
+ })), [branchByRegions]);
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", options: regions, ...getValidation(field('region'), validatorObj.region, input?.required) }));
3248
3261
  });
3249
3262
 
3250
- const RetailRegionField = JSX(({ field, input }) => {
3251
- const regions = useBranchesByRegions();
3252
- 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) }));
3263
+ const RegionRetailField = JSX(({ field, input }) => {
3264
+ const { data: regions } = useLeadFormData('REGION_RF');
3265
+ const formatRegions = regions?.map(({ key, value }) => ({ key, text: value }));
3266
+ 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) }));
3253
3267
  });
3254
3268
 
3255
- 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 })));
3269
+ const RetirementIncomeField = JSX(({ field, input }) => {
3270
+ const currentWages = field('wages')?.value;
3271
+ const onChange = useCallback((_) => {
3272
+ const incomesSum = Number(_) + Number(currentWages || 0);
3273
+ field('retirementIncome')?.onChange?.(_);
3274
+ field('incomeAverage')?.onChange?.(String(incomesSum));
3275
+ }, [currentWages]);
3276
+ 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 }));
3277
+ });
3256
3278
 
3257
3279
  const SecondaryPhoneField = JSX(({ field }) => {
3258
3280
  const fieldPhone = field('secondaryPhone');
@@ -3317,6 +3339,16 @@
3317
3339
  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(_) }) }));
3318
3340
  });
3319
3341
 
3342
+ const WagesField = JSX(({ field, input }) => {
3343
+ const currentRetirementIncome = field('retirementIncome')?.value;
3344
+ const onChange = useCallback((_) => {
3345
+ const incomesSum = Number(_) + Number(currentRetirementIncome || 0);
3346
+ field('wages')?.onChange?.(_);
3347
+ field('incomeAverage')?.onChange?.(String(incomesSum));
3348
+ }, [currentRetirementIncome]);
3349
+ 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 }));
3350
+ });
3351
+
3320
3352
  function isRenderField({ input, field, }) {
3321
3353
  const { condition } = input;
3322
3354
  const { value } = field(condition?.name || '');
@@ -3404,8 +3436,8 @@
3404
3436
  participantDateRegistration: jsx(ParticipantDateRegistrationField, { field: field, input: input }),
3405
3437
  retirementIncome: jsx(RetirementIncomeField, { field: field, input: input }),
3406
3438
  otherIncome: jsx(OtherIncomeField, { field: field, input: input }),
3407
- mandatoryIncome: jsx(MandatoryIncomeField, { field: field, input: input }),
3408
- otherPayments: jsx(OtherPaymentsField, { field: field, input: input }),
3439
+ wages: jsx(WagesField, { field: field, input: input }),
3440
+ mandatoryPayments: jsx(MandatoryPaymentsField, { field: field, input: input }),
3409
3441
  disablePeopleFlg: jsx(DisablePeopleFlgField, { field: field, input: input }),
3410
3442
  bankruptcyFlg: jsx(BankruptcyFlgField, { field: field, input: input }),
3411
3443
  shareholderFlg: jsx(ShareholderFlgField, { field: field, input: input }),
@@ -3413,8 +3445,8 @@
3413
3445
  creditInRshbCd: jsx(CreditInRshbCdField, { field: field, input: input }),
3414
3446
  bankEmployeeCode: jsx(BankEmpoleeCodeField, { field: field, input: input }),
3415
3447
  partInBusiness: jsx(PartInBusinessField, { field: field, input: input }),
3416
- regionRetail: jsx(RetailRegionField, { field: field, input: input }),
3417
- addressRetail: jsx(RetailAddressField, { field: field, input: input }),
3448
+ regionRetail: jsx(RegionRetailField, { field: field, input: input }),
3449
+ addressRetail: jsx(AddressRetailField, { field: field, input: input }),
3418
3450
  addressMatch: jsx(AddressMatchField, { field: field, input: input }),
3419
3451
  paymentSystem: jsx(PaymentSystemField, { field: field, input: input }),
3420
3452
  currency: jsx(CurrencyField, { field: field, input: input }),
@@ -3515,6 +3547,7 @@
3515
3547
  posTerminal: false,
3516
3548
  consentToReceiveMaterials: false,
3517
3549
  consentDataProcessing: false,
3550
+ addressRetail: { key: '', text: '' },
3518
3551
  };
3519
3552
  const getInitialFormState$3 = (inputs, typeForm = '') => {
3520
3553
  const formState = Object.fromEntries(inputs.map((_) => [
@@ -3652,6 +3685,7 @@
3652
3685
  paymentSystem: '',
3653
3686
  cardCategory: { key: '', text: '' },
3654
3687
  codeWord: '',
3688
+ addressRetail: { key: '', text: '' },
3655
3689
  };
3656
3690
  const getInitialFormState$2 = (inputs, savedForm, typeForm = '') => {
3657
3691
  if (savedForm) {
@@ -4049,8 +4083,14 @@
4049
4083
  organizationAddress: 'WORK',
4050
4084
  };
4051
4085
  const fieldsNamesToIncomeKeysMap = {
4052
- mandatoryIncome: 'INCOME_AVERAGE',
4053
- otherPayments: 'MANDATORY_PAYMENTS',
4086
+ incomeAverage: 'INCOME_AVERAGE',
4087
+ mandatoryPayments: 'MANDATORY_PAYMENTS',
4088
+ additionalIncome: 'ADDITIONAL_INCOME',
4089
+ otherIncome: 'OTHER_INCOME',
4090
+ otherPayments: 'OTHER_PAYMENTS',
4091
+ rentalIncome: 'RENTAL_INCOME',
4092
+ wages: 'WAGES',
4093
+ retirementIncome: 'RETIREMENT_INCOME',
4054
4094
  };
4055
4095
  const getParticipantContacts = (fields) => Object.entries(fields).reduce((acc, [key, value]) => {
4056
4096
  if (key in fieldsNamesToContactKeysMap) {
@@ -4091,7 +4131,7 @@
4091
4131
  incomeTypeCd: {
4092
4132
  key: fieldsNamesToIncomeKeysMap[key],
4093
4133
  },
4094
- value,
4134
+ value: Number(value || 0),
4095
4135
  },
4096
4136
  ];
4097
4137
  }
@@ -5987,6 +6027,40 @@
5987
6027
  const renderBlocks = (info) => (jsx("div", { className: "flex gap-5xl grow basis-0", children: info.map((column, i) => renderBlocksColumn({ column, i })) }));
5988
6028
  const renderBlocksColumn = ({ column, i }) => column ? (jsx("div", { className: "flex flex-col gap-xl grow basis-0", children: column.map(({ title = '', description, additionalDescription, button }, key) => (jsxs("div", { children: [jsx(Headline, { title: title, description: description, headlineVersion: "XS", align: "text-left", isEmbedded: true }), additionalDescription ? (jsx("div", { className: "mt-xs opacity-80", children: jsx(Paragraph, { size: "text-m", font: "font-light", children: additionalDescription }) })) : null, jsx("div", { className: style({ 'mt-xl': Boolean(button?.text) }), children: renderButtonsSection([button]) })] }, String(key)))) }, `col-${String(i)}`)) : null;
5989
6029
 
6030
+ const PORTAL_NATURAL_URL = '/';
6031
+ const UPDATING_INTERVAL = 60000 * 4;
6032
+ const updateRefreshToken = () => {
6033
+ const refreshToken = globalThis.sessionStorage?.getItem('refreshToken');
6034
+ const accessToken = globalThis.sessionStorage?.getItem('accessToken');
6035
+ const taskId = globalThis.localStorage.getItem('taskId');
6036
+ if (!accessToken || !refreshToken || !taskId) {
6037
+ globalThis.location.href = PORTAL_NATURAL_URL;
6038
+ return () => null;
6039
+ }
6040
+ const updateTokenRequest = async () => {
6041
+ const res = await doRequest('/auth/refresh', 'POST', {
6042
+ // eslint-disable-next-line camelcase
6043
+ refresh_token: refreshToken,
6044
+ // eslint-disable-next-line camelcase
6045
+ access_token: accessToken,
6046
+ });
6047
+ if (res instanceof Response) {
6048
+ handleStatus(res.status);
6049
+ return;
6050
+ }
6051
+ globalThis.sessionStorage.setItem('refreshToken', res.refresh_token);
6052
+ globalThis.sessionStorage.setItem('accessToken', res.access_token);
6053
+ };
6054
+ updateTokenRequest();
6055
+ const timer = setInterval(updateTokenRequest, UPDATING_INTERVAL);
6056
+ return () => clearInterval(timer);
6057
+ };
6058
+ const handleStatus = (status) => {
6059
+ if (status == 401) {
6060
+ globalThis.location.href = PORTAL_NATURAL_URL;
6061
+ }
6062
+ };
6063
+
5990
6064
  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] })] })));
5991
6065
 
5992
6066
  const CreditCardFormProgress = JSX(({ step = 1, totalSteps = 6, stepsTitles = [] }) => {
@@ -6173,8 +6247,8 @@
6173
6247
  dependents: undefined,
6174
6248
  familyMembers: undefined,
6175
6249
  confirmationIncome: { key: '', text: '' },
6176
- mandatoryIncome: undefined,
6177
- otherPayments: undefined,
6250
+ wages: undefined,
6251
+ mandatoryPayments: undefined,
6178
6252
  snils: '',
6179
6253
  armyIdFlg: false,
6180
6254
  },
@@ -6188,8 +6262,8 @@
6188
6262
  {
6189
6263
  regionRetail: '',
6190
6264
  addressRetail: {
6191
- fullAddress: '',
6192
- fiasCode: '',
6265
+ key: '',
6266
+ text: '',
6193
6267
  },
6194
6268
  bankEmployeeCode: undefined,
6195
6269
  addressCourier: {
@@ -6269,7 +6343,7 @@
6269
6343
  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" })] }));
6270
6344
  });
6271
6345
 
6272
- const getFifthStepData = (formData) => {
6346
+ const getFifthStepData$1 = (formData) => {
6273
6347
  const { bankruptcyFlg, shareholderFlg, legalEntityName, creditInRshbCd } = formData;
6274
6348
  return {
6275
6349
  bankruptcyFlg,
@@ -6290,14 +6364,20 @@
6290
6364
  };
6291
6365
 
6292
6366
  const getFourthStepData$1 = (formData) => {
6293
- const { familyStatus, dependents, familyMembers, mandatoryIncome, otherPayments, snils, armyIdFlg, } = formData;
6367
+ const { familyStatus, dependents, familyMembers, wages, mandatoryPayments, incomeAverage, additionalIncome, otherIncome, otherPayments, rentalIncome, retirementIncome, snils, armyIdFlg, } = formData;
6294
6368
  return {
6295
6369
  maritalStatusCd: familyStatus,
6296
6370
  totalDependents: familyMembers,
6297
6371
  otherDependents: dependents,
6298
6372
  participantIncomes: getParticipantIncomes({
6299
- mandatoryIncome,
6373
+ wages,
6374
+ mandatoryPayments,
6375
+ incomeAverage,
6376
+ additionalIncome,
6377
+ otherIncome,
6300
6378
  otherPayments,
6379
+ rentalIncome,
6380
+ retirementIncome,
6301
6381
  }),
6302
6382
  snils: snils?.replaceAll(' ', ''),
6303
6383
  armyIdFlg,
@@ -6411,7 +6491,7 @@
6411
6491
  case 3:
6412
6492
  return getFourthStepData$1(formData);
6413
6493
  case 4:
6414
- return getFifthStepData(formData);
6494
+ return getFifthStepData$1(formData);
6415
6495
  case 5:
6416
6496
  return getSixthStepData(formData);
6417
6497
  default:
@@ -6688,11 +6768,11 @@
6688
6768
  },
6689
6769
  {
6690
6770
  columns: 1,
6691
- inputs: [{ fieldType: 'common', name: 'mandatoryIncome', required: true }],
6771
+ inputs: [{ fieldType: 'common', name: 'wages', required: true }],
6692
6772
  },
6693
6773
  {
6694
6774
  columns: 1,
6695
- inputs: [{ fieldType: 'common', name: 'otherPayments', required: true }],
6775
+ inputs: [{ fieldType: 'common', name: 'mandatoryPayments', required: true }],
6696
6776
  },
6697
6777
  {
6698
6778
  columns: 1,
@@ -6830,6 +6910,7 @@
6830
6910
  ];
6831
6911
  const CreditCardForm = JSX(({ className, ...rest }) => {
6832
6912
  const [step, setStep] = useState(0);
6913
+ useEffect(updateRefreshToken, []);
6833
6914
  const handleNextStep = useCallback(() => {
6834
6915
  setStep((_) => Math.min(_ + 1, WIZARD_STEPS$1));
6835
6916
  }, []);
@@ -6842,40 +6923,6 @@
6842
6923
  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)) })] }) }));
6843
6924
  });
6844
6925
 
6845
- const PORTAL_NATURAL_URL = '/';
6846
- const UPDATING_INTERVAL = 60000 * 4;
6847
- const updateRefreshToken = () => {
6848
- const refreshToken = globalThis.sessionStorage?.getItem('refreshToken');
6849
- const accessToken = globalThis.sessionStorage?.getItem('accessToken');
6850
- const taskId = globalThis.localStorage.getItem('taskId');
6851
- if (!accessToken || !refreshToken || !taskId) {
6852
- globalThis.location.href = PORTAL_NATURAL_URL;
6853
- return () => null;
6854
- }
6855
- const updateTokenRequest = async () => {
6856
- const res = await doRequest('/auth/refresh', 'POST', {
6857
- // eslint-disable-next-line camelcase
6858
- refresh_token: refreshToken,
6859
- // eslint-disable-next-line camelcase
6860
- access_token: accessToken,
6861
- });
6862
- if (res instanceof Response) {
6863
- handleStatus(res.status);
6864
- return;
6865
- }
6866
- globalThis.sessionStorage.setItem('refreshToken', res.refresh_token);
6867
- globalThis.sessionStorage.setItem('accessToken', res.access_token);
6868
- };
6869
- updateTokenRequest();
6870
- const timer = setInterval(updateTokenRequest, UPDATING_INTERVAL);
6871
- return () => clearInterval(timer);
6872
- };
6873
- const handleStatus = (status) => {
6874
- if (status == 401) {
6875
- globalThis.location.href = PORTAL_NATURAL_URL;
6876
- }
6877
- };
6878
-
6879
6926
  const CreditFormProgress = JSX(({ step = 1, totalSteps = 5, stepsTitles = [] }) => {
6880
6927
  const progress = useMemo(() => (step / totalSteps) * 100, [step, totalSteps]);
6881
6928
  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 })] }) }));
@@ -7067,8 +7114,8 @@
7067
7114
  dependents: undefined,
7068
7115
  familyMembers: undefined,
7069
7116
  confirmationIncome: { key: '', text: '' },
7070
- mandatoryIncome: undefined,
7071
- otherPayments: undefined,
7117
+ wages: undefined,
7118
+ mandatoryPayments: undefined,
7072
7119
  snils: '',
7073
7120
  armyIdFlg: false,
7074
7121
  },
@@ -7153,6 +7200,13 @@
7153
7200
  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" })] }));
7154
7201
  });
7155
7202
 
7203
+ const getFifthStepData = (formData) => {
7204
+ const { addressRetail } = formData;
7205
+ return {
7206
+ office: addressRetail?.key ? { id: addressRetail.key } : undefined,
7207
+ };
7208
+ };
7209
+
7156
7210
  const getFirstStepData = (formData) => {
7157
7211
  const { name, surname, middleName, birthday = '', phone = '', email, sex, birthPlace, dulIssueDateField = '', dulIssuedBy, dulNumber, dulSerie, dulSubdivisionCode, education, participantDateRegistration = '', housing, addressRegistration, addressFact, } = formData;
7158
7212
  return {
@@ -7217,15 +7271,21 @@
7217
7271
  };
7218
7272
 
7219
7273
  const getThirdStepData = (formData) => {
7220
- const { familyStatus, dependents, familyMembers, confirmationIncome, mandatoryIncome, otherPayments, snils, armyIdFlg, } = formData;
7274
+ const { familyStatus, dependents, familyMembers, confirmationIncome, wages, mandatoryPayments, incomeAverage, additionalIncome, otherIncome, otherPayments, rentalIncome, retirementIncome, snils, armyIdFlg, } = formData;
7221
7275
  return {
7222
7276
  maritalStatusCd: familyStatus,
7223
7277
  totalDependents: familyMembers,
7224
7278
  incomeCertificateCd: confirmationIncome,
7225
7279
  otherDependents: dependents,
7226
7280
  participantIncomes: getParticipantIncomes({
7227
- mandatoryIncome,
7281
+ wages,
7282
+ mandatoryPayments,
7283
+ incomeAverage,
7284
+ additionalIncome,
7285
+ otherIncome,
7228
7286
  otherPayments,
7287
+ rentalIncome,
7288
+ retirementIncome,
7229
7289
  }),
7230
7290
  snils: snils?.replaceAll(' ', ''),
7231
7291
  armyIdFlg,
@@ -7252,7 +7312,7 @@
7252
7312
  taskSource: globalThis.location.origin,
7253
7313
  id: taskId,
7254
7314
  office: {
7255
- id: '650', // TODO: Remove hardcode
7315
+ id: '',
7256
7316
  },
7257
7317
  authorizedAgentId: formData?.bankEmployeeCode,
7258
7318
  participants: [
@@ -7269,6 +7329,7 @@
7269
7329
  },
7270
7330
  ],
7271
7331
  ...getZeroStepData(formData),
7332
+ ...getFifthStepData(formData),
7272
7333
  esiaAccountTypeCd: {
7273
7334
  key: formData?.esiaAccountTypeCd?.key,
7274
7335
  },
@@ -7547,11 +7608,11 @@
7547
7608
  },
7548
7609
  {
7549
7610
  columns: 1,
7550
- inputs: [{ fieldType: 'common', name: 'mandatoryIncome', required: true }],
7611
+ inputs: [{ fieldType: 'common', name: 'wages', required: true }],
7551
7612
  },
7552
7613
  {
7553
7614
  columns: 1,
7554
- inputs: [{ fieldType: 'common', name: 'otherPayments', required: true }],
7615
+ inputs: [{ fieldType: 'common', name: 'mandatoryPayments', required: true }],
7555
7616
  },
7556
7617
  {
7557
7618
  columns: 1,
@@ -9917,7 +9978,7 @@
9917
9978
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
9918
9979
  });
9919
9980
 
9920
- const packageVersion = "0.14.664";
9981
+ const packageVersion = "0.14.666";
9921
9982
 
9922
9983
  exports.Blocks = Blocks;
9923
9984
  exports.ContentPage = ContentPage;