@redneckz/wildless-cms-uni-blocks 0.14.595 → 0.14.597

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 (514) hide show
  1. package/bundle/EventBus/EventBus.d.ts +17 -4
  2. package/bundle/EventBus/defaultEventBus.d.ts +2 -13
  3. package/bundle/EventBus/useSubject.d.ts +2 -0
  4. package/bundle/EventBus/useSubjectState.d.ts +2 -0
  5. package/bundle/api/dadataHints/dadataHintsType.d.ts +20 -4
  6. package/bundle/api/dadataHints/hintsListsOptions.d.ts +2 -24
  7. package/bundle/bundle.umd.js +208 -109
  8. package/bundle/bundle.umd.min.js +1 -1
  9. package/bundle/components/CarouselTariffsCard/CardCellsSection.d.ts +9 -0
  10. package/bundle/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +9 -0
  11. package/bundle/hooks/useLocation.d.ts +2 -1
  12. package/bundle/hooks/useReducer.d.ts +4 -0
  13. package/bundle/ui-kit/Foldable/Foldable.d.ts +11 -1
  14. package/bundle/ui-kit/FormField/Fields/DulIssuedByField.d.ts +2 -0
  15. package/bundle/ui-kit/FormField/Fields/DulSubdivisionCodeField.d.ts +2 -0
  16. package/bundle/ui-kit/Input/InputPopup.d.ts +1 -1
  17. package/bundle/ui-kit/Input/InputProps.d.ts +3 -0
  18. package/bundle/ui-kit/Input/useInputPopup.d.ts +4 -1
  19. package/bundle/ui-kit/LocationDialog/SelectedLocation.d.ts +5 -0
  20. package/dist/EventBus/EventBus.d.ts +17 -4
  21. package/dist/EventBus/EventBus.js +29 -10
  22. package/dist/EventBus/EventBus.js.map +1 -1
  23. package/dist/EventBus/defaultEventBus.d.ts +2 -13
  24. package/dist/EventBus/defaultEventBus.js.map +1 -1
  25. package/dist/EventBus/useSubject.d.ts +2 -0
  26. package/dist/EventBus/useSubject.js +17 -0
  27. package/dist/EventBus/useSubject.js.map +1 -0
  28. package/dist/EventBus/useSubjectState.d.ts +2 -0
  29. package/dist/EventBus/useSubjectState.js +10 -0
  30. package/dist/EventBus/useSubjectState.js.map +1 -0
  31. package/dist/api/dadataHints/dadataHints.js +15 -8
  32. package/dist/api/dadataHints/dadataHints.js.map +1 -1
  33. package/dist/api/dadataHints/dadataHintsType.d.ts +20 -4
  34. package/dist/api/dadataHints/hintsListsOptions.d.ts +2 -24
  35. package/dist/api/dadataHints/hintsListsOptions.js +31 -9
  36. package/dist/api/dadataHints/hintsListsOptions.js.map +1 -1
  37. package/dist/components/CarouselTariffsCard/CardCellsSection.d.ts +9 -0
  38. package/dist/components/CarouselTariffsCard/CardCellsSection.js +18 -0
  39. package/dist/components/CarouselTariffsCard/CardCellsSection.js.map +1 -0
  40. package/dist/components/CarouselTariffsCard/CarouselTariffsCard.js +11 -25
  41. package/dist/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
  42. package/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +9 -0
  43. package/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.js +5 -0
  44. package/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.js.map +1 -0
  45. package/dist/components/ExchangeRateTile/ExchangeRateTile.js +1 -1
  46. package/dist/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
  47. package/dist/components/Header/HeaderSecondaryMenu.js +1 -1
  48. package/dist/components/Header/HeaderSecondaryMenu.js.map +1 -1
  49. package/dist/components/OfficesAtmsMap/AtmsMap.js +1 -1
  50. package/dist/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
  51. package/dist/components/OfficesAtmsMap/OfficesMap.js +1 -1
  52. package/dist/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
  53. package/dist/components/StickyBottomMenu/BurgerMenuDialog.js +1 -1
  54. package/dist/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
  55. package/dist/hooks/useLocation.d.ts +2 -1
  56. package/dist/hooks/useLocation.js +27 -33
  57. package/dist/hooks/useLocation.js.map +1 -1
  58. package/dist/hooks/useReducer.d.ts +4 -0
  59. package/dist/hooks/useReducer.js +12 -0
  60. package/dist/hooks/useReducer.js.map +1 -0
  61. package/dist/hooks/useRegions.js +3 -1
  62. package/dist/hooks/useRegions.js.map +1 -1
  63. package/dist/ui-kit/DialogManager/useDialogManager.js +3 -3
  64. package/dist/ui-kit/DialogManager/useDialogManager.js.map +1 -1
  65. package/dist/ui-kit/DialogManager/useDialogsList.js +1 -1
  66. package/dist/ui-kit/DialogManager/useDialogsList.js.map +1 -1
  67. package/dist/ui-kit/Foldable/Foldable.d.ts +11 -1
  68. package/dist/ui-kit/Foldable/Foldable.js +10 -2
  69. package/dist/ui-kit/Foldable/Foldable.js.map +1 -1
  70. package/dist/ui-kit/FormField/Fields/DulIssuedByField.d.ts +2 -0
  71. package/dist/ui-kit/FormField/Fields/DulIssuedByField.js +16 -0
  72. package/dist/ui-kit/FormField/Fields/DulIssuedByField.js.map +1 -0
  73. package/dist/ui-kit/FormField/Fields/DulSubdivisionCodeField.d.ts +2 -0
  74. package/dist/ui-kit/FormField/Fields/DulSubdivisionCodeField.js +15 -0
  75. package/dist/ui-kit/FormField/Fields/DulSubdivisionCodeField.js.map +1 -0
  76. package/dist/ui-kit/FormField/Fields/InnField.js +8 -1
  77. package/dist/ui-kit/FormField/Fields/InnField.js.map +1 -1
  78. package/dist/ui-kit/FormField/Fields/OrganizationNameField.js +8 -1
  79. package/dist/ui-kit/FormField/Fields/OrganizationNameField.js.map +1 -1
  80. package/dist/ui-kit/FormField/constants.js +1 -0
  81. package/dist/ui-kit/FormField/constants.js.map +1 -1
  82. package/dist/ui-kit/FormField/getField.js +4 -4
  83. package/dist/ui-kit/FormField/getField.js.map +1 -1
  84. package/dist/ui-kit/FormField/getValidation.js +1 -0
  85. package/dist/ui-kit/FormField/getValidation.js.map +1 -1
  86. package/dist/ui-kit/Input/InputControl.js +3 -1
  87. package/dist/ui-kit/Input/InputControl.js.map +1 -1
  88. package/dist/ui-kit/Input/InputPopup.d.ts +1 -1
  89. package/dist/ui-kit/Input/InputPopup.js +1 -1
  90. package/dist/ui-kit/Input/InputPopup.js.map +1 -1
  91. package/dist/ui-kit/Input/InputProps.d.ts +3 -0
  92. package/dist/ui-kit/Input/useInputPopup.d.ts +4 -1
  93. package/dist/ui-kit/Input/useInputPopup.js +7 -4
  94. package/dist/ui-kit/Input/useInputPopup.js.map +1 -1
  95. package/dist/ui-kit/LocationDialog/LocationDialog.js +9 -12
  96. package/dist/ui-kit/LocationDialog/LocationDialog.js.map +1 -1
  97. package/dist/ui-kit/LocationDialog/SelectedLocation.d.ts +5 -0
  98. package/dist/ui-kit/LocationDialog/SelectedLocation.js +15 -0
  99. package/dist/ui-kit/LocationDialog/SelectedLocation.js.map +1 -0
  100. package/dist/ui-kit/PopupManager/PopupManager.js +1 -1
  101. package/dist/ui-kit/PopupManager/PopupManager.js.map +1 -1
  102. package/dist/ui-kit/PopupManager/usePopupManager.js +3 -3
  103. package/dist/ui-kit/PopupManager/usePopupManager.js.map +1 -1
  104. package/lib/EventBus/EventBus.d.ts +17 -4
  105. package/lib/EventBus/EventBus.js +29 -10
  106. package/lib/EventBus/EventBus.js.map +1 -1
  107. package/lib/EventBus/defaultEventBus.d.ts +2 -13
  108. package/lib/EventBus/defaultEventBus.js.map +1 -1
  109. package/lib/EventBus/useSubject.d.ts +2 -0
  110. package/lib/EventBus/useSubject.js +14 -0
  111. package/lib/EventBus/useSubject.js.map +1 -0
  112. package/lib/EventBus/useSubjectState.d.ts +2 -0
  113. package/lib/EventBus/useSubjectState.js +7 -0
  114. package/lib/EventBus/useSubjectState.js.map +1 -0
  115. package/lib/api/dadataHints/dadataHints.js +15 -8
  116. package/lib/api/dadataHints/dadataHints.js.map +1 -1
  117. package/lib/api/dadataHints/dadataHintsType.d.ts +20 -4
  118. package/lib/api/dadataHints/hintsListsOptions.d.ts +2 -24
  119. package/lib/api/dadataHints/hintsListsOptions.js +26 -4
  120. package/lib/api/dadataHints/hintsListsOptions.js.map +1 -1
  121. package/lib/common.css +1 -1
  122. package/lib/components/CarouselTariffsCard/CardCellsSection.d.ts +9 -0
  123. package/lib/components/CarouselTariffsCard/CardCellsSection.js +16 -0
  124. package/lib/components/CarouselTariffsCard/CardCellsSection.js.map +1 -0
  125. package/lib/components/CarouselTariffsCard/CarouselTariffsCard.js +12 -26
  126. package/lib/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
  127. package/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +9 -0
  128. package/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.js +3 -0
  129. package/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.js.map +1 -0
  130. package/lib/components/ExchangeRateTile/ExchangeRateTile.js +2 -2
  131. package/lib/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
  132. package/lib/components/Header/HeaderSecondaryMenu.js +2 -2
  133. package/lib/components/Header/HeaderSecondaryMenu.js.map +1 -1
  134. package/lib/components/OfficesAtmsMap/AtmsMap.js +2 -2
  135. package/lib/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
  136. package/lib/components/OfficesAtmsMap/OfficesMap.js +2 -2
  137. package/lib/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
  138. package/lib/components/StickyBottomMenu/BurgerMenuDialog.js +2 -2
  139. package/lib/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
  140. package/lib/hooks/useLocation.d.ts +2 -1
  141. package/lib/hooks/useLocation.js +26 -33
  142. package/lib/hooks/useLocation.js.map +1 -1
  143. package/lib/hooks/useReducer.d.ts +4 -0
  144. package/lib/hooks/useReducer.js +9 -0
  145. package/lib/hooks/useReducer.js.map +1 -0
  146. package/lib/hooks/useRegions.js +3 -1
  147. package/lib/hooks/useRegions.js.map +1 -1
  148. package/lib/ui-kit/DialogManager/useDialogManager.js +3 -3
  149. package/lib/ui-kit/DialogManager/useDialogManager.js.map +1 -1
  150. package/lib/ui-kit/DialogManager/useDialogsList.js +1 -1
  151. package/lib/ui-kit/DialogManager/useDialogsList.js.map +1 -1
  152. package/lib/ui-kit/Foldable/Foldable.d.ts +11 -1
  153. package/lib/ui-kit/Foldable/Foldable.js +10 -2
  154. package/lib/ui-kit/Foldable/Foldable.js.map +1 -1
  155. package/lib/ui-kit/FormField/Fields/DulIssuedByField.d.ts +2 -0
  156. package/lib/ui-kit/FormField/Fields/DulIssuedByField.js +14 -0
  157. package/lib/ui-kit/FormField/Fields/DulIssuedByField.js.map +1 -0
  158. package/lib/ui-kit/FormField/Fields/DulSubdivisionCodeField.d.ts +2 -0
  159. package/lib/ui-kit/FormField/Fields/DulSubdivisionCodeField.js +13 -0
  160. package/lib/ui-kit/FormField/Fields/DulSubdivisionCodeField.js.map +1 -0
  161. package/lib/ui-kit/FormField/Fields/InnField.js +8 -1
  162. package/lib/ui-kit/FormField/Fields/InnField.js.map +1 -1
  163. package/lib/ui-kit/FormField/Fields/OrganizationNameField.js +8 -1
  164. package/lib/ui-kit/FormField/Fields/OrganizationNameField.js.map +1 -1
  165. package/lib/ui-kit/FormField/constants.js +1 -0
  166. package/lib/ui-kit/FormField/constants.js.map +1 -1
  167. package/lib/ui-kit/FormField/getField.js +4 -4
  168. package/lib/ui-kit/FormField/getField.js.map +1 -1
  169. package/lib/ui-kit/FormField/getValidation.js +1 -0
  170. package/lib/ui-kit/FormField/getValidation.js.map +1 -1
  171. package/lib/ui-kit/Input/InputControl.js +3 -1
  172. package/lib/ui-kit/Input/InputControl.js.map +1 -1
  173. package/lib/ui-kit/Input/InputPopup.d.ts +1 -1
  174. package/lib/ui-kit/Input/InputPopup.js +1 -1
  175. package/lib/ui-kit/Input/InputPopup.js.map +1 -1
  176. package/lib/ui-kit/Input/InputProps.d.ts +3 -0
  177. package/lib/ui-kit/Input/useInputPopup.d.ts +4 -1
  178. package/lib/ui-kit/Input/useInputPopup.js +7 -4
  179. package/lib/ui-kit/Input/useInputPopup.js.map +1 -1
  180. package/lib/ui-kit/LocationDialog/LocationDialog.js +10 -13
  181. package/lib/ui-kit/LocationDialog/LocationDialog.js.map +1 -1
  182. package/lib/ui-kit/LocationDialog/SelectedLocation.d.ts +5 -0
  183. package/lib/ui-kit/LocationDialog/SelectedLocation.js +13 -0
  184. package/lib/ui-kit/LocationDialog/SelectedLocation.js.map +1 -0
  185. package/lib/ui-kit/PopupManager/PopupManager.js +1 -1
  186. package/lib/ui-kit/PopupManager/PopupManager.js.map +1 -1
  187. package/lib/ui-kit/PopupManager/usePopupManager.js +3 -3
  188. package/lib/ui-kit/PopupManager/usePopupManager.js.map +1 -1
  189. package/mobile/bundle/EventBus/EventBus.d.ts +17 -4
  190. package/mobile/bundle/EventBus/defaultEventBus.d.ts +2 -13
  191. package/mobile/bundle/EventBus/useSubject.d.ts +2 -0
  192. package/mobile/bundle/EventBus/useSubjectState.d.ts +2 -0
  193. package/mobile/bundle/api/dadataHints/dadataHintsType.d.ts +20 -4
  194. package/mobile/bundle/api/dadataHints/hintsListsOptions.d.ts +2 -24
  195. package/mobile/bundle/bundle.umd.js +208 -109
  196. package/mobile/bundle/bundle.umd.min.js +1 -1
  197. package/mobile/bundle/components/CarouselTariffsCard/CardCellsSection.d.ts +9 -0
  198. package/mobile/bundle/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +9 -0
  199. package/mobile/bundle/hooks/useLocation.d.ts +2 -1
  200. package/mobile/bundle/hooks/useReducer.d.ts +4 -0
  201. package/mobile/bundle/ui-kit/Foldable/Foldable.d.ts +11 -1
  202. package/mobile/bundle/ui-kit/FormField/Fields/DulIssuedByField.d.ts +2 -0
  203. package/mobile/bundle/ui-kit/FormField/Fields/DulSubdivisionCodeField.d.ts +2 -0
  204. package/mobile/bundle/ui-kit/Input/InputPopup.d.ts +1 -1
  205. package/mobile/bundle/ui-kit/Input/InputProps.d.ts +3 -0
  206. package/mobile/bundle/ui-kit/Input/useInputPopup.d.ts +4 -1
  207. package/mobile/bundle/ui-kit/LocationDialog/SelectedLocation.d.ts +5 -0
  208. package/mobile/dist/EventBus/EventBus.d.ts +17 -4
  209. package/mobile/dist/EventBus/EventBus.js +29 -10
  210. package/mobile/dist/EventBus/EventBus.js.map +1 -1
  211. package/mobile/dist/EventBus/defaultEventBus.d.ts +2 -13
  212. package/mobile/dist/EventBus/defaultEventBus.js.map +1 -1
  213. package/mobile/dist/EventBus/useSubject.d.ts +2 -0
  214. package/mobile/dist/EventBus/useSubject.js +17 -0
  215. package/mobile/dist/EventBus/useSubject.js.map +1 -0
  216. package/mobile/dist/EventBus/useSubjectState.d.ts +2 -0
  217. package/mobile/dist/EventBus/useSubjectState.js +10 -0
  218. package/mobile/dist/EventBus/useSubjectState.js.map +1 -0
  219. package/mobile/dist/api/dadataHints/dadataHints.js +15 -8
  220. package/mobile/dist/api/dadataHints/dadataHints.js.map +1 -1
  221. package/mobile/dist/api/dadataHints/dadataHintsType.d.ts +20 -4
  222. package/mobile/dist/api/dadataHints/hintsListsOptions.d.ts +2 -24
  223. package/mobile/dist/api/dadataHints/hintsListsOptions.js +31 -9
  224. package/mobile/dist/api/dadataHints/hintsListsOptions.js.map +1 -1
  225. package/mobile/dist/components/CarouselTariffsCard/CardCellsSection.d.ts +9 -0
  226. package/mobile/dist/components/CarouselTariffsCard/CardCellsSection.js +18 -0
  227. package/mobile/dist/components/CarouselTariffsCard/CardCellsSection.js.map +1 -0
  228. package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCard.js +11 -25
  229. package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
  230. package/mobile/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +9 -0
  231. package/mobile/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.js +5 -0
  232. package/mobile/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.js.map +1 -0
  233. package/mobile/dist/components/ExchangeRateTile/ExchangeRateTile.js +1 -1
  234. package/mobile/dist/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
  235. package/mobile/dist/components/Header/HeaderSecondaryMenu.js +1 -1
  236. package/mobile/dist/components/Header/HeaderSecondaryMenu.js.map +1 -1
  237. package/mobile/dist/components/OfficesAtmsMap/AtmsMap.js +1 -1
  238. package/mobile/dist/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
  239. package/mobile/dist/components/OfficesAtmsMap/OfficesMap.js +1 -1
  240. package/mobile/dist/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
  241. package/mobile/dist/components/StickyBottomMenu/BurgerMenuDialog.js +1 -1
  242. package/mobile/dist/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
  243. package/mobile/dist/hooks/useLocation.d.ts +2 -1
  244. package/mobile/dist/hooks/useLocation.js +27 -33
  245. package/mobile/dist/hooks/useLocation.js.map +1 -1
  246. package/mobile/dist/hooks/useReducer.d.ts +4 -0
  247. package/mobile/dist/hooks/useReducer.js +12 -0
  248. package/mobile/dist/hooks/useReducer.js.map +1 -0
  249. package/mobile/dist/hooks/useRegions.js +3 -1
  250. package/mobile/dist/hooks/useRegions.js.map +1 -1
  251. package/mobile/dist/ui-kit/DialogManager/useDialogManager.js +3 -3
  252. package/mobile/dist/ui-kit/DialogManager/useDialogManager.js.map +1 -1
  253. package/mobile/dist/ui-kit/DialogManager/useDialogsList.js +1 -1
  254. package/mobile/dist/ui-kit/DialogManager/useDialogsList.js.map +1 -1
  255. package/mobile/dist/ui-kit/Foldable/Foldable.d.ts +11 -1
  256. package/mobile/dist/ui-kit/Foldable/Foldable.js +10 -2
  257. package/mobile/dist/ui-kit/Foldable/Foldable.js.map +1 -1
  258. package/mobile/dist/ui-kit/FormField/Fields/DulIssuedByField.d.ts +2 -0
  259. package/mobile/dist/ui-kit/FormField/Fields/DulIssuedByField.js +16 -0
  260. package/mobile/dist/ui-kit/FormField/Fields/DulIssuedByField.js.map +1 -0
  261. package/mobile/dist/ui-kit/FormField/Fields/DulSubdivisionCodeField.d.ts +2 -0
  262. package/mobile/dist/ui-kit/FormField/Fields/DulSubdivisionCodeField.js +15 -0
  263. package/mobile/dist/ui-kit/FormField/Fields/DulSubdivisionCodeField.js.map +1 -0
  264. package/mobile/dist/ui-kit/FormField/Fields/InnField.js +8 -1
  265. package/mobile/dist/ui-kit/FormField/Fields/InnField.js.map +1 -1
  266. package/mobile/dist/ui-kit/FormField/Fields/OrganizationNameField.js +8 -1
  267. package/mobile/dist/ui-kit/FormField/Fields/OrganizationNameField.js.map +1 -1
  268. package/mobile/dist/ui-kit/FormField/constants.js +1 -0
  269. package/mobile/dist/ui-kit/FormField/constants.js.map +1 -1
  270. package/mobile/dist/ui-kit/FormField/getField.js +4 -4
  271. package/mobile/dist/ui-kit/FormField/getField.js.map +1 -1
  272. package/mobile/dist/ui-kit/FormField/getValidation.js +1 -0
  273. package/mobile/dist/ui-kit/FormField/getValidation.js.map +1 -1
  274. package/mobile/dist/ui-kit/Input/InputControl.js +3 -1
  275. package/mobile/dist/ui-kit/Input/InputControl.js.map +1 -1
  276. package/mobile/dist/ui-kit/Input/InputPopup.d.ts +1 -1
  277. package/mobile/dist/ui-kit/Input/InputPopup.js +1 -1
  278. package/mobile/dist/ui-kit/Input/InputPopup.js.map +1 -1
  279. package/mobile/dist/ui-kit/Input/InputProps.d.ts +3 -0
  280. package/mobile/dist/ui-kit/Input/useInputPopup.d.ts +4 -1
  281. package/mobile/dist/ui-kit/Input/useInputPopup.js +7 -4
  282. package/mobile/dist/ui-kit/Input/useInputPopup.js.map +1 -1
  283. package/mobile/dist/ui-kit/LocationDialog/LocationDialog.js +9 -12
  284. package/mobile/dist/ui-kit/LocationDialog/LocationDialog.js.map +1 -1
  285. package/mobile/dist/ui-kit/LocationDialog/SelectedLocation.d.ts +5 -0
  286. package/mobile/dist/ui-kit/LocationDialog/SelectedLocation.js +15 -0
  287. package/mobile/dist/ui-kit/LocationDialog/SelectedLocation.js.map +1 -0
  288. package/mobile/dist/ui-kit/PopupManager/PopupManager.js +1 -1
  289. package/mobile/dist/ui-kit/PopupManager/PopupManager.js.map +1 -1
  290. package/mobile/dist/ui-kit/PopupManager/usePopupManager.js +3 -3
  291. package/mobile/dist/ui-kit/PopupManager/usePopupManager.js.map +1 -1
  292. package/mobile/lib/EventBus/EventBus.d.ts +17 -4
  293. package/mobile/lib/EventBus/EventBus.js +29 -10
  294. package/mobile/lib/EventBus/EventBus.js.map +1 -1
  295. package/mobile/lib/EventBus/defaultEventBus.d.ts +2 -13
  296. package/mobile/lib/EventBus/defaultEventBus.js.map +1 -1
  297. package/mobile/lib/EventBus/useSubject.d.ts +2 -0
  298. package/mobile/lib/EventBus/useSubject.js +14 -0
  299. package/mobile/lib/EventBus/useSubject.js.map +1 -0
  300. package/mobile/lib/EventBus/useSubjectState.d.ts +2 -0
  301. package/mobile/lib/EventBus/useSubjectState.js +7 -0
  302. package/mobile/lib/EventBus/useSubjectState.js.map +1 -0
  303. package/mobile/lib/api/dadataHints/dadataHints.js +15 -8
  304. package/mobile/lib/api/dadataHints/dadataHints.js.map +1 -1
  305. package/mobile/lib/api/dadataHints/dadataHintsType.d.ts +20 -4
  306. package/mobile/lib/api/dadataHints/hintsListsOptions.d.ts +2 -24
  307. package/mobile/lib/api/dadataHints/hintsListsOptions.js +26 -4
  308. package/mobile/lib/api/dadataHints/hintsListsOptions.js.map +1 -1
  309. package/mobile/lib/common.css +1 -1
  310. package/mobile/lib/components/CarouselTariffsCard/CardCellsSection.d.ts +9 -0
  311. package/mobile/lib/components/CarouselTariffsCard/CardCellsSection.js +16 -0
  312. package/mobile/lib/components/CarouselTariffsCard/CardCellsSection.js.map +1 -0
  313. package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCard.js +12 -26
  314. package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
  315. package/mobile/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +9 -0
  316. package/mobile/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.js +3 -0
  317. package/mobile/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.js.map +1 -0
  318. package/mobile/lib/components/ExchangeRateTile/ExchangeRateTile.js +2 -2
  319. package/mobile/lib/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
  320. package/mobile/lib/components/Header/HeaderSecondaryMenu.js +2 -2
  321. package/mobile/lib/components/Header/HeaderSecondaryMenu.js.map +1 -1
  322. package/mobile/lib/components/OfficesAtmsMap/AtmsMap.js +2 -2
  323. package/mobile/lib/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
  324. package/mobile/lib/components/OfficesAtmsMap/OfficesMap.js +2 -2
  325. package/mobile/lib/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
  326. package/mobile/lib/components/StickyBottomMenu/BurgerMenuDialog.js +2 -2
  327. package/mobile/lib/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
  328. package/mobile/lib/hooks/useLocation.d.ts +2 -1
  329. package/mobile/lib/hooks/useLocation.js +26 -33
  330. package/mobile/lib/hooks/useLocation.js.map +1 -1
  331. package/mobile/lib/hooks/useReducer.d.ts +4 -0
  332. package/mobile/lib/hooks/useReducer.js +9 -0
  333. package/mobile/lib/hooks/useReducer.js.map +1 -0
  334. package/mobile/lib/hooks/useRegions.js +3 -1
  335. package/mobile/lib/hooks/useRegions.js.map +1 -1
  336. package/mobile/lib/ui-kit/DialogManager/useDialogManager.js +3 -3
  337. package/mobile/lib/ui-kit/DialogManager/useDialogManager.js.map +1 -1
  338. package/mobile/lib/ui-kit/DialogManager/useDialogsList.js +1 -1
  339. package/mobile/lib/ui-kit/DialogManager/useDialogsList.js.map +1 -1
  340. package/mobile/lib/ui-kit/Foldable/Foldable.d.ts +11 -1
  341. package/mobile/lib/ui-kit/Foldable/Foldable.js +10 -2
  342. package/mobile/lib/ui-kit/Foldable/Foldable.js.map +1 -1
  343. package/mobile/lib/ui-kit/FormField/Fields/DulIssuedByField.d.ts +2 -0
  344. package/mobile/lib/ui-kit/FormField/Fields/DulIssuedByField.js +14 -0
  345. package/mobile/lib/ui-kit/FormField/Fields/DulIssuedByField.js.map +1 -0
  346. package/mobile/lib/ui-kit/FormField/Fields/DulSubdivisionCodeField.d.ts +2 -0
  347. package/mobile/lib/ui-kit/FormField/Fields/DulSubdivisionCodeField.js +13 -0
  348. package/mobile/lib/ui-kit/FormField/Fields/DulSubdivisionCodeField.js.map +1 -0
  349. package/mobile/lib/ui-kit/FormField/Fields/InnField.js +8 -1
  350. package/mobile/lib/ui-kit/FormField/Fields/InnField.js.map +1 -1
  351. package/mobile/lib/ui-kit/FormField/Fields/OrganizationNameField.js +8 -1
  352. package/mobile/lib/ui-kit/FormField/Fields/OrganizationNameField.js.map +1 -1
  353. package/mobile/lib/ui-kit/FormField/constants.js +1 -0
  354. package/mobile/lib/ui-kit/FormField/constants.js.map +1 -1
  355. package/mobile/lib/ui-kit/FormField/getField.js +4 -4
  356. package/mobile/lib/ui-kit/FormField/getField.js.map +1 -1
  357. package/mobile/lib/ui-kit/FormField/getValidation.js +1 -0
  358. package/mobile/lib/ui-kit/FormField/getValidation.js.map +1 -1
  359. package/mobile/lib/ui-kit/Input/InputControl.js +3 -1
  360. package/mobile/lib/ui-kit/Input/InputControl.js.map +1 -1
  361. package/mobile/lib/ui-kit/Input/InputPopup.d.ts +1 -1
  362. package/mobile/lib/ui-kit/Input/InputPopup.js +1 -1
  363. package/mobile/lib/ui-kit/Input/InputPopup.js.map +1 -1
  364. package/mobile/lib/ui-kit/Input/InputProps.d.ts +3 -0
  365. package/mobile/lib/ui-kit/Input/useInputPopup.d.ts +4 -1
  366. package/mobile/lib/ui-kit/Input/useInputPopup.js +7 -4
  367. package/mobile/lib/ui-kit/Input/useInputPopup.js.map +1 -1
  368. package/mobile/lib/ui-kit/LocationDialog/LocationDialog.js +10 -13
  369. package/mobile/lib/ui-kit/LocationDialog/LocationDialog.js.map +1 -1
  370. package/mobile/lib/ui-kit/LocationDialog/SelectedLocation.d.ts +5 -0
  371. package/mobile/lib/ui-kit/LocationDialog/SelectedLocation.js +13 -0
  372. package/mobile/lib/ui-kit/LocationDialog/SelectedLocation.js.map +1 -0
  373. package/mobile/lib/ui-kit/PopupManager/PopupManager.js +1 -1
  374. package/mobile/lib/ui-kit/PopupManager/PopupManager.js.map +1 -1
  375. package/mobile/lib/ui-kit/PopupManager/usePopupManager.js +3 -3
  376. package/mobile/lib/ui-kit/PopupManager/usePopupManager.js.map +1 -1
  377. package/mobile/src/EventBus/EventBus.ts +51 -15
  378. package/mobile/src/EventBus/defaultEventBus.ts +2 -14
  379. package/mobile/src/EventBus/useSubject.ts +19 -0
  380. package/mobile/src/EventBus/useSubjectState.ts +13 -0
  381. package/mobile/src/api/dadataHints/dadataHints.ts +27 -10
  382. package/mobile/src/api/dadataHints/dadataHintsType.ts +21 -4
  383. package/mobile/src/api/dadataHints/hintsListsOptions.ts +34 -4
  384. package/mobile/src/components/CarouselTariffsCard/CardCellsSection.tsx +54 -0
  385. package/mobile/src/components/CarouselTariffsCard/CarouselTariffsCard.tsx +23 -66
  386. package/mobile/src/components/CarouselTariffsCard/carouselTariffsCardEventBus.ts +11 -0
  387. package/mobile/src/components/ExchangeRateTile/ExchangeRateTile.tsx +2 -2
  388. package/mobile/src/components/Header/HeaderSecondaryMenu.tsx +2 -2
  389. package/mobile/src/components/OfficesAtmsMap/AtmsMap.tsx +2 -3
  390. package/mobile/src/components/OfficesAtmsMap/OfficesMap.tsx +2 -2
  391. package/mobile/src/components/StickyBottomMenu/BurgerMenuDialog.tsx +2 -2
  392. package/mobile/src/hooks/useLocation.ts +30 -44
  393. package/mobile/src/hooks/useReducer.ts +21 -0
  394. package/mobile/src/hooks/useRegions.ts +4 -1
  395. package/mobile/src/ui-kit/DialogManager/useDialogManager.ts +3 -3
  396. package/mobile/src/ui-kit/DialogManager/useDialogsList.ts +1 -1
  397. package/mobile/src/ui-kit/Foldable/Foldable.tsx +21 -5
  398. package/mobile/src/ui-kit/FormField/Fields/DulIssuedByField.tsx +26 -0
  399. package/mobile/src/ui-kit/FormField/Fields/DulSubdivisionCodeField.tsx +27 -0
  400. package/mobile/src/ui-kit/FormField/Fields/InnField.tsx +18 -7
  401. package/mobile/src/ui-kit/FormField/Fields/OrganizationNameField.tsx +17 -7
  402. package/mobile/src/ui-kit/FormField/constants.tsx +1 -0
  403. package/mobile/src/ui-kit/FormField/getField.tsx +4 -4
  404. package/mobile/src/ui-kit/FormField/getValidation.tsx +1 -0
  405. package/mobile/src/ui-kit/Input/InputControl.tsx +4 -0
  406. package/mobile/src/ui-kit/Input/InputPopup.tsx +2 -2
  407. package/mobile/src/ui-kit/Input/InputProps.ts +3 -0
  408. package/mobile/src/ui-kit/Input/useInputPopup.tsx +17 -5
  409. package/mobile/src/ui-kit/LocationDialog/LocationDialog.tsx +13 -25
  410. package/mobile/src/ui-kit/LocationDialog/SelectedLocation.tsx +27 -0
  411. package/mobile/src/ui-kit/PopupManager/PopupManager.tsx +1 -1
  412. package/mobile/src/ui-kit/PopupManager/usePopupManager.tsx +3 -3
  413. package/package.json +1 -1
  414. package/src/EventBus/EventBus.ts +51 -15
  415. package/src/EventBus/defaultEventBus.ts +2 -14
  416. package/src/EventBus/useSubject.ts +19 -0
  417. package/src/EventBus/useSubjectState.ts +13 -0
  418. package/src/api/dadataHints/dadataHints.ts +27 -10
  419. package/src/api/dadataHints/dadataHintsType.ts +21 -4
  420. package/src/api/dadataHints/hintsListsOptions.ts +34 -4
  421. package/src/components/ApplicationLeadForm/ApplicationLeadForm.fixture.tsx +10 -15
  422. package/src/components/CarouselTariffsCard/CardCellsSection.tsx +54 -0
  423. package/src/components/CarouselTariffsCard/CarouselTariffsCard.tsx +23 -66
  424. package/src/components/CarouselTariffsCard/carouselTariffsCardEventBus.ts +11 -0
  425. package/src/components/ExchangeRateTile/ExchangeRateTile.tsx +2 -2
  426. package/src/components/Header/HeaderSecondaryMenu.tsx +2 -2
  427. package/src/components/OfficesAtmsMap/AtmsMap.tsx +2 -3
  428. package/src/components/OfficesAtmsMap/OfficesMap.tsx +2 -2
  429. package/src/components/StickyBottomMenu/BurgerMenuDialog.tsx +2 -2
  430. package/src/hooks/useLocation.ts +30 -44
  431. package/src/hooks/useReducer.ts +21 -0
  432. package/src/hooks/useRegions.ts +4 -1
  433. package/src/ui-kit/DialogManager/useDialogManager.ts +3 -3
  434. package/src/ui-kit/DialogManager/useDialogsList.ts +1 -1
  435. package/src/ui-kit/Foldable/Foldable.tsx +21 -5
  436. package/src/ui-kit/FormField/Fields/DulIssuedByField.tsx +26 -0
  437. package/src/ui-kit/FormField/Fields/DulSubdivisionCodeField.tsx +27 -0
  438. package/src/ui-kit/FormField/Fields/InnField.tsx +18 -7
  439. package/src/ui-kit/FormField/Fields/OrganizationNameField.tsx +17 -7
  440. package/src/ui-kit/FormField/constants.tsx +1 -0
  441. package/src/ui-kit/FormField/getField.tsx +4 -4
  442. package/src/ui-kit/FormField/getValidation.tsx +1 -0
  443. package/src/ui-kit/Input/InputControl.tsx +4 -0
  444. package/src/ui-kit/Input/InputPopup.tsx +2 -2
  445. package/src/ui-kit/Input/InputProps.ts +3 -0
  446. package/src/ui-kit/Input/useInputPopup.tsx +17 -5
  447. package/src/ui-kit/LocationDialog/LocationDialog.tsx +13 -25
  448. package/src/ui-kit/LocationDialog/SelectedLocation.tsx +27 -0
  449. package/src/ui-kit/PopupManager/PopupManager.tsx +1 -1
  450. package/src/ui-kit/PopupManager/usePopupManager.tsx +3 -3
  451. package/bundle/EventBus/useLatestEvent.d.ts +0 -2
  452. package/bundle/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +0 -6
  453. package/bundle/ui-kit/FormField/Fields/DulIssuedBy.d.ts +0 -2
  454. package/bundle/ui-kit/FormField/Fields/DulSubdivisionCode.d.ts +0 -2
  455. package/dist/EventBus/useLatestEvent.d.ts +0 -2
  456. package/dist/EventBus/useLatestEvent.js +0 -11
  457. package/dist/EventBus/useLatestEvent.js.map +0 -1
  458. package/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +0 -6
  459. package/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.js +0 -2
  460. package/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +0 -1
  461. package/dist/ui-kit/FormField/Fields/DulIssuedBy.d.ts +0 -2
  462. package/dist/ui-kit/FormField/Fields/DulIssuedBy.js +0 -9
  463. package/dist/ui-kit/FormField/Fields/DulIssuedBy.js.map +0 -1
  464. package/dist/ui-kit/FormField/Fields/DulSubdivisionCode.d.ts +0 -2
  465. package/dist/ui-kit/FormField/Fields/DulSubdivisionCode.js +0 -9
  466. package/dist/ui-kit/FormField/Fields/DulSubdivisionCode.js.map +0 -1
  467. package/lib/EventBus/useLatestEvent.d.ts +0 -2
  468. package/lib/EventBus/useLatestEvent.js +0 -8
  469. package/lib/EventBus/useLatestEvent.js.map +0 -1
  470. package/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +0 -6
  471. package/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js +0 -2
  472. package/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +0 -1
  473. package/lib/ui-kit/FormField/Fields/DulIssuedBy.d.ts +0 -2
  474. package/lib/ui-kit/FormField/Fields/DulIssuedBy.js +0 -7
  475. package/lib/ui-kit/FormField/Fields/DulIssuedBy.js.map +0 -1
  476. package/lib/ui-kit/FormField/Fields/DulSubdivisionCode.d.ts +0 -2
  477. package/lib/ui-kit/FormField/Fields/DulSubdivisionCode.js +0 -7
  478. package/lib/ui-kit/FormField/Fields/DulSubdivisionCode.js.map +0 -1
  479. package/mobile/bundle/EventBus/useLatestEvent.d.ts +0 -2
  480. package/mobile/bundle/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +0 -6
  481. package/mobile/bundle/ui-kit/FormField/Fields/DulIssuedBy.d.ts +0 -2
  482. package/mobile/bundle/ui-kit/FormField/Fields/DulSubdivisionCode.d.ts +0 -2
  483. package/mobile/dist/EventBus/useLatestEvent.d.ts +0 -2
  484. package/mobile/dist/EventBus/useLatestEvent.js +0 -11
  485. package/mobile/dist/EventBus/useLatestEvent.js.map +0 -1
  486. package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +0 -6
  487. package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.js +0 -2
  488. package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +0 -1
  489. package/mobile/dist/ui-kit/FormField/Fields/DulIssuedBy.d.ts +0 -2
  490. package/mobile/dist/ui-kit/FormField/Fields/DulIssuedBy.js +0 -9
  491. package/mobile/dist/ui-kit/FormField/Fields/DulIssuedBy.js.map +0 -1
  492. package/mobile/dist/ui-kit/FormField/Fields/DulSubdivisionCode.d.ts +0 -2
  493. package/mobile/dist/ui-kit/FormField/Fields/DulSubdivisionCode.js +0 -9
  494. package/mobile/dist/ui-kit/FormField/Fields/DulSubdivisionCode.js.map +0 -1
  495. package/mobile/lib/EventBus/useLatestEvent.d.ts +0 -2
  496. package/mobile/lib/EventBus/useLatestEvent.js +0 -8
  497. package/mobile/lib/EventBus/useLatestEvent.js.map +0 -1
  498. package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +0 -6
  499. package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js +0 -2
  500. package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +0 -1
  501. package/mobile/lib/ui-kit/FormField/Fields/DulIssuedBy.d.ts +0 -2
  502. package/mobile/lib/ui-kit/FormField/Fields/DulIssuedBy.js +0 -7
  503. package/mobile/lib/ui-kit/FormField/Fields/DulIssuedBy.js.map +0 -1
  504. package/mobile/lib/ui-kit/FormField/Fields/DulSubdivisionCode.d.ts +0 -2
  505. package/mobile/lib/ui-kit/FormField/Fields/DulSubdivisionCode.js +0 -7
  506. package/mobile/lib/ui-kit/FormField/Fields/DulSubdivisionCode.js.map +0 -1
  507. package/mobile/src/EventBus/useLatestEvent.ts +0 -16
  508. package/mobile/src/components/CarouselTariffsCard/CarouselTariffsCardAction.ts +0 -6
  509. package/mobile/src/ui-kit/FormField/Fields/DulIssuedBy.tsx +0 -12
  510. package/mobile/src/ui-kit/FormField/Fields/DulSubdivisionCode.tsx +0 -17
  511. package/src/EventBus/useLatestEvent.ts +0 -16
  512. package/src/components/CarouselTariffsCard/CarouselTariffsCardAction.ts +0 -6
  513. package/src/ui-kit/FormField/Fields/DulIssuedBy.tsx +0 -12
  514. package/src/ui-kit/FormField/Fields/DulSubdivisionCode.tsx +0 -17
@@ -411,39 +411,58 @@
411
411
  ].join(' ');
412
412
 
413
413
  class EventBus {
414
- subscribers = {};
414
+ subscribersMap = {};
415
415
  subjectsStateMap = {};
416
+ emitter = this;
417
+ observable = this;
416
418
  subscribe(type, listener) {
417
- this.subscribers[type] = (this.subscribers[type] || []).concat(listener);
418
- const latestEvent = this.subjectsStateMap[type];
419
- if (latestEvent) {
420
- listener(latestEvent);
421
- }
419
+ this.subscribersMap[type] ||= [];
420
+ this.subscribersMap[type]?.push(listener);
421
+ this.fireSubscribers([listener], this.subjectsStateMap[type]);
422
422
  return () => {
423
423
  this.unsubscribe(type, listener);
424
424
  };
425
425
  }
426
426
  unsubscribe(type, listener) {
427
- this.subscribers[type] = this.subscribers[type]?.filter((s) => s !== listener);
427
+ const index = this.subscribersMap[type]?.indexOf(listener);
428
+ if (index && index !== -1) {
429
+ this.subscribersMap[type]?.splice(index, 1);
430
+ }
428
431
  }
429
432
  fire(type, event) {
430
433
  const isSubjectDeclared = type in this.subjectsStateMap;
431
434
  if (isSubjectDeclared) {
432
- this.subjectsStateMap[type] = event;
435
+ this.subject(type, event);
436
+ }
437
+ else {
438
+ this.fireSubscribers(this.subscribersMap[type], event);
433
439
  }
434
- this.subscribers[type]?.forEach((s) => s(event));
435
440
  }
436
441
  subject(type, event) {
437
- this.subjectsStateMap[type] = event;
442
+ if (this.subjectsStateMap[type] !== event) {
443
+ this.subjectsStateMap[type] = event;
444
+ this.fireSubscribers(this.subscribersMap[type], event);
445
+ }
446
+ return () => {
447
+ delete this.subjectsStateMap[type];
448
+ };
449
+ }
450
+ fireSubscribers(subscribers, event) {
451
+ if (!subscribers || !event) {
452
+ return;
453
+ }
454
+ for (const _ of subscribers) {
455
+ _(event);
456
+ }
438
457
  }
439
458
  }
440
459
 
441
460
  const defaultEventBus = new EventBus();
442
461
 
443
462
  const useDialogManager = () => ({
444
- open: (dialog, options = {}) => defaultEventBus.fire('dialog', { type: 'open', dialog, ...options }),
445
- close: () => defaultEventBus.fire('dialog', { type: 'close' }),
446
- closeAll: () => defaultEventBus.fire('dialog', { type: 'close', all: true }),
463
+ open: (dialog, options = {}) => defaultEventBus.emitter.fire('dialog', { type: 'open', dialog, ...options }),
464
+ close: () => defaultEventBus.emitter.fire('dialog', { type: 'close' }),
465
+ closeAll: () => defaultEventBus.emitter.fire('dialog', { type: 'close', all: true }),
447
466
  });
448
467
 
449
468
  const adjustBase = (href, basePath = '') => href.replace(basePath, '') || '/';
@@ -1098,6 +1117,7 @@
1098
1117
  { key: 'phone', text: 'Телефонный звонок' },
1099
1118
  { key: 'email', text: 'Электронное сообщение' },
1100
1119
  ];
1120
+ // TODO Тоже надо рефакторить - файлик constants
1101
1121
  const OUT_SERVICE_URL = '/api/v1/outservice/outserviceregions';
1102
1122
 
1103
1123
  const getRegionUrl = (typeForm) => typeForm === 'OUTSERVICE' ? OUT_SERVICE_URL : undefined;
@@ -1201,15 +1221,22 @@
1201
1221
  const defaultStyle$1 = 'w-full border rounded-md text-primary-text outline-none p-m';
1202
1222
 
1203
1223
  const DEFAULT_HINTS_COUNT = 10;
1204
- const getResponseHandler = (response) => {
1224
+ const defaultResponseItemHandler = (item) => item?.value || '';
1225
+ const getResponseHandler = (itemHandler) => (response) => {
1205
1226
  const responseData = response?.suggestions || [];
1206
- return responseData.map((item) => ({
1207
- ...item,
1208
- processedValue: item?.value,
1209
- }));
1227
+ return responseData.map((item) => {
1228
+ const value = itemHandler(item);
1229
+ return {
1230
+ ...item,
1231
+ processedValue: value,
1232
+ };
1233
+ });
1210
1234
  };
1211
1235
  const getDaDataHints = (options) => {
1212
- const { url, query, requestData = {} } = options;
1236
+ const { url, query, queryPrefix, requestData = {}, responseItemHandler = defaultResponseItemHandler, } = options;
1237
+ const responseHandler = getResponseHandler(responseItemHandler);
1238
+ const queryPrefixValue = queryPrefix ? `${queryPrefix}, ` : '';
1239
+ const combinedQuery = `${queryPrefixValue}${query}`;
1213
1240
  const result = fetch(`/api/v1/suggestions/${url}`, {
1214
1241
  method: 'POST',
1215
1242
  mode: 'cors',
@@ -1219,11 +1246,11 @@
1219
1246
  body: JSON.stringify({
1220
1247
  count: DEFAULT_HINTS_COUNT,
1221
1248
  ...requestData,
1222
- query,
1249
+ query: combinedQuery,
1223
1250
  }),
1224
1251
  })
1225
1252
  .then((response) => response.json())
1226
- .then(getResponseHandler);
1253
+ .then(responseHandler);
1227
1254
  return result;
1228
1255
  };
1229
1256
 
@@ -1251,11 +1278,33 @@
1251
1278
  const EMAIL_HINTS_LIST_OPTIONS = {
1252
1279
  url: 'suggest/email',
1253
1280
  };
1281
+ const PASSPORT_FMS_HINTS_LIST_OPTIONS = {
1282
+ url: 'suggest/fms_unit',
1283
+ };
1284
+ const PASSPORT_CODE_HINTS_LIST_OPTIONS = {
1285
+ url: 'suggest/fms_unit',
1286
+ responseItemHandler: (item) => item?.data?.code?.replace('-', '') || '',
1287
+ };
1288
+ const ORGANIZATION_NAME_HINTS_LIST_OPTIONS = {
1289
+ url: 'suggest/party',
1290
+ };
1291
+ const ORGANIZATION_INN_HINTS_LIST_OPTIONS = {
1292
+ url: 'suggest/party',
1293
+ responseItemHandler: (item) => item?.data?.inn || '',
1294
+ };
1295
+ const ADDRESS_HINTS_LIST_OPTIONS = {
1296
+ url: 'suggest/address',
1297
+ };
1254
1298
  const hintsListsOptions = {
1255
1299
  name: NAME_HINTS_LIST_OPTIONS,
1256
1300
  surname: SURNAME_HINTS_LIST_OPTIONS,
1257
1301
  middleName: PATRONYMIC_HINTS_LIST_OPTIONS,
1258
1302
  email: EMAIL_HINTS_LIST_OPTIONS,
1303
+ dulSubdivisionCode: PASSPORT_CODE_HINTS_LIST_OPTIONS,
1304
+ dulIssuedBy: PASSPORT_FMS_HINTS_LIST_OPTIONS,
1305
+ organizationName: ORGANIZATION_NAME_HINTS_LIST_OPTIONS,
1306
+ inn: ORGANIZATION_INN_HINTS_LIST_OPTIONS,
1307
+ participantAddress: ADDRESS_HINTS_LIST_OPTIONS,
1259
1308
  };
1260
1309
 
1261
1310
  const debounce = (fn, delay = 600) => {
@@ -1275,14 +1324,14 @@
1275
1324
  };
1276
1325
 
1277
1326
  const usePopupManager = () => ({
1278
- open: (popup, options) => defaultEventBus.fire('popup', { type: 'open', popup, ...options }),
1279
- update: (popup, options) => defaultEventBus.fire('popup', { type: 'update', popup, ...options }),
1280
- close: () => defaultEventBus.fire('popup', { type: 'close' }),
1327
+ open: (popup, options) => defaultEventBus.emitter.fire('popup', { type: 'open', popup, ...options }),
1328
+ update: (popup, options) => defaultEventBus.emitter.fire('popup', { type: 'update', popup, ...options }),
1329
+ close: () => defaultEventBus.emitter.fire('popup', { type: 'close' }),
1281
1330
  });
1282
1331
 
1283
- const InputPopup = JSX(({ options, onChange }) => (jsx("div", { className: "bg-white text-l max-h-64 overflow-y-auto overflow-x-hidden rounded-md shadow-2xl", role: "list", children: options?.map((item, key) => (jsx("div", { className: "flex px-m py-s cursor-pointer hover:bg-main-divider pr-5xl relative", role: "listitem", onMouseDown: () => onChange(item.processedValue), children: jsx("span", { className: "min-h-6", children: item.processedValue }) }, key.toString()))) })));
1332
+ const InputPopup = JSX(({ options, onChange }) => (jsx("div", { className: "bg-white text-l max-h-64 overflow-y-auto overflow-x-hidden rounded-md shadow-2xl", role: "list", children: options?.map((item, key) => (jsx("div", { className: "flex px-m py-s cursor-pointer hover:bg-main-divider pr-5xl relative", role: "listitem", onMouseDown: () => onChange(item), children: jsx("span", { className: "min-h-6", children: item.processedValue }) }, key.toString()))) })));
1284
1333
 
1285
- function useInputPopup({ isOpen, value, name, onChange }) {
1334
+ function useInputPopup({ isOpen, value, name, onChange, onDaDataChange, daDataQueryPrefix, }) {
1286
1335
  const prevInputValue = useRef(value);
1287
1336
  const currentInputValue = useRef(value);
1288
1337
  const [hintsList, setHintsList] = useState([]);
@@ -1294,8 +1343,9 @@
1294
1343
  }, [value]);
1295
1344
  const handleChange = useCallback((option) => {
1296
1345
  close();
1297
- currentInputValue.current = option;
1298
- onChange && onChange(option);
1346
+ currentInputValue.current = option.processedValue;
1347
+ onChange && onChange(option.processedValue);
1348
+ onDaDataChange && onDaDataChange(option);
1299
1349
  }, [close, onChange]);
1300
1350
  const inputRef = useRef(null);
1301
1351
  const getHintsList = useMemo(() => async (searchValue) => {
@@ -1304,15 +1354,17 @@
1304
1354
  }
1305
1355
  const result = await getDaDataHints({
1306
1356
  url: defaultHintsListOptions.url,
1357
+ responseItemHandler: defaultHintsListOptions.responseItemHandler,
1307
1358
  requestData: {
1308
1359
  ...defaultHintsListOptions?.requestData,
1309
1360
  },
1310
1361
  query: searchValue,
1362
+ queryPrefix: daDataQueryPrefix,
1311
1363
  });
1312
1364
  if (result?.length) {
1313
1365
  setHintsList(result);
1314
1366
  }
1315
- }, []);
1367
+ }, [daDataQueryPrefix]);
1316
1368
  const debouncedGetHintsList = useMemo(() => debounce(getHintsList, 300), [getHintsList]);
1317
1369
  useEffect(() => {
1318
1370
  if (!isOpen || !inputRef.current || currentInputValue.current === value) {
@@ -1334,14 +1386,16 @@
1334
1386
  return inputRef;
1335
1387
  }
1336
1388
 
1337
- const InputControl = JSX(({ className, label, value = '', placeholder, error, errors, onChange = noop, onBlur, isTextarea, type, name = '', dadata = false, }) => {
1389
+ const InputControl = JSX(({ className, label, value = '', placeholder, error, errors, onChange = noop, onDaDataChange, onBlur, isTextarea, type, name = '', daDataQueryPrefix, dadata = false, }) => {
1338
1390
  const [isOpen, { setFalse: close, setTrue: open }] = useBool();
1339
1391
  const popupRef = useOutsideClick(close);
1340
1392
  const inputRef = useInputPopup({
1341
1393
  isOpen: isOpen && dadata,
1342
1394
  name,
1343
1395
  value,
1396
+ daDataQueryPrefix,
1344
1397
  onChange,
1398
+ onDaDataChange,
1345
1399
  });
1346
1400
  return (jsxs("div", { className: style('shrink-0 w-full', className), ref: popupRef, onBlur: close, onFocus: open, children: [jsx("div", { ref: inputRef, children: jsx(Input, { type: type || 'text', "aria-label": label, label: getRequiredLabel({ label, errors }), valid: Boolean(!error), value: value, onChange: onChange, onBlur: onBlur, isTextarea: isTextarea, placeholder: getPlaceholder(placeholder, errors, label) }) }), renderErrorText(error)] }));
1347
1401
  });
@@ -1541,6 +1595,7 @@
1541
1595
  };
1542
1596
  };
1543
1597
 
1598
+ // TODO Зачем это?
1544
1599
  const getValidation = (field, validator, required = false) => required ? withValidator(field, validator) : field;
1545
1600
 
1546
1601
  const ACQUIRING_TYPES = [
@@ -1957,13 +2012,24 @@
1957
2012
 
1958
2013
  const DulIssueDateField = JSX(({ field, input }) => (jsx(DatePickerControl, { label: "\u0414\u0430\u0442\u0430 \u0432\u044B\u0434\u0430\u0447\u0438", ...getValidation(field('dulIssueDateField'), validatorObj.dulIssueDateField, input?.required) })));
1959
2014
 
1960
- const DulIssuedBy = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D", ...getValidation(field('dulIssuedBy'), validatorObj.dulIssuedBy, input?.required) })));
2015
+ const DulIssuedByField = JSX(({ field, input }) => {
2016
+ const { value: dulSubdivisionCode, onChange: changeDulSubdivisionCode } = field('dulSubdivisionCode');
2017
+ const onDaDataChange = useCallback((item) => {
2018
+ changeDulSubdivisionCode?.(item?.data?.code?.replace('-', ''));
2019
+ }, []);
2020
+ return (jsx(InputControl, { label: "\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D", ...input, ...getValidation(field('dulIssuedBy'), validatorObj.dulIssuedBy, input?.required), onDaDataChange: onDaDataChange, daDataQueryPrefix: dulSubdivisionCode }));
2021
+ });
1961
2022
 
1962
2023
  const DulNumberField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041D\u043E\u043C\u0435\u0440 \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", type: "number", ...getValidation(field('dulNumber'), validatorObj.dulNumber, input?.required) })));
1963
2024
 
1964
2025
  const DulSerieField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0421\u0435\u0440\u0438\u044F \u0434\u043E\u043A\u0443\u043C\u0435\u043D\u0442\u0430", type: "number", ...getValidation(field('dulSerie'), validatorObj.dulSerie, input?.required) })));
1965
2026
 
1966
- const DulSubdivisionCode = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u043E\u0434 \u043F\u043E\u0434\u0440\u0430\u0437\u0434\u0435\u043B\u0435\u043D\u0438\u044F", type: "number", ...getValidation(field('dulSubdivisionCode'), validatorObj.dulSubdivisionCode, input?.required) })));
2027
+ const DulSubdivisionCodeField = JSX(({ field, input }) => {
2028
+ const onDaDataChange = useCallback((item) => {
2029
+ field?.('dulIssuedBy')?.onChange?.(item?.data?.name);
2030
+ }, []);
2031
+ return (jsx(InputControl, { label: "\u041A\u043E\u0434 \u043F\u043E\u0434\u0440\u0430\u0437\u0434\u0435\u043B\u0435\u043D\u0438\u044F", type: "number", ...input, ...getValidation(field('dulSubdivisionCode'), validatorObj.dulSubdivisionCode, input?.required), onDaDataChange: onDaDataChange }));
2032
+ });
1967
2033
 
1968
2034
  const EducationField = JSX(({ field, input }) => {
1969
2035
  const { data: education } = useLeadFormData('EDUCATION_LEVEL');
@@ -2014,7 +2080,13 @@
2014
2080
  return (jsx(SelectField, { field: field, source: housing, label: "\u0422\u0438\u043F \u0436\u0438\u043B\u044C\u044F", fieldName: "housing", input: input }));
2015
2081
  });
2016
2082
 
2017
- const InnField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0418\u041D\u041D", type: "number", ...getValidation(field('inn'), validatorObj.inn, input?.required) })));
2083
+ const InnField = JSX(({ field, input }) => {
2084
+ const onDaDataChange = useCallback((item) => {
2085
+ field?.('organizationName')?.onChange?.(item.data?.name?.short_with_opf);
2086
+ field?.('legalForm')?.onChange?.(item.data?.opf?.short);
2087
+ }, []);
2088
+ return (jsx(InputControl, { label: "\u0418\u041D\u041D", type: "number", ...input, ...getValidation(field('inn'), validatorObj.inn, input?.required), onDaDataChange: onDaDataChange }));
2089
+ });
2018
2090
 
2019
2091
  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"' })));
2020
2092
 
@@ -2025,9 +2097,11 @@
2025
2097
  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 })));
2026
2098
 
2027
2099
  const REGIONS_URL = '/api/v1/regions';
2100
+ const EMPTY_REGIONS = [];
2101
+ // TODO Почему url можно менять? Разве смысл не в инкапсуляции api url. Тоже под рефакторинг попадает
2028
2102
  function useRegions(url = REGIONS_URL) {
2029
2103
  const { data } = useAsyncData(url, fetchJSONUnsafe);
2030
- return Array.isArray(data) ? data : [];
2104
+ return Array.isArray(data) ? data : EMPTY_REGIONS;
2031
2105
  }
2032
2106
 
2033
2107
  const LocalitiesField = JSX(({ field, input }) => {
@@ -2057,7 +2131,13 @@
2057
2131
  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 }));
2058
2132
  });
2059
2133
 
2060
- const OrganizationNameField = JSX(({ field, input }) => (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", ...getValidation(field('organizationName'), validatorObj.organizationName, input?.required), ...input })));
2134
+ const OrganizationNameField = JSX(({ field, input }) => {
2135
+ const onDaDataChange = useCallback((item) => {
2136
+ field?.('inn')?.onChange?.(item.data?.inn);
2137
+ field?.('legalForm')?.onChange?.(item.data?.opf?.short);
2138
+ }, []);
2139
+ 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 }));
2140
+ });
2061
2141
 
2062
2142
  const ParticipantAddressField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0410\u0434\u0440\u0435\u0441", ...getValidation(field('participantAddress'), validatorObj.participantAddress, input?.required), ...input })));
2063
2143
 
@@ -2292,8 +2372,8 @@
2292
2372
  dulSerie: jsx(DulSerieField, { field: field, input: input }),
2293
2373
  dulNumber: jsx(DulNumberField, { field: field, input: input }),
2294
2374
  dulIssueDateField: jsx(DulIssueDateField, { field: field, input: input }),
2295
- dulSubdivisionCode: jsx(DulSubdivisionCode, { field: field, input: input }),
2296
- dulIssuedBy: jsx(DulIssuedBy, { field: field, input: input }),
2375
+ dulSubdivisionCode: jsx(DulSubdivisionCodeField, { field: field, input: input }),
2376
+ dulIssuedBy: jsx(DulIssuedByField, { field: field, input: input }),
2297
2377
  participantAddress: jsx(ParticipantAddressField, { field: field, input: input }),
2298
2378
  participantDateRegistration: jsx(ParticipantDateRegistrationField, { field: field, input: input }),
2299
2379
  };
@@ -2551,6 +2631,14 @@
2551
2631
  return { ...formState, typeForm: { key: typeForm, text: '' } };
2552
2632
  };
2553
2633
 
2634
+ const FoldableWrapper = JSX(({ className, children }) => (jsx("div", { className: className, role: "group", children: children })));
2635
+ /**
2636
+ * Какой то бесполезный компонент. Его можно заменить на useBool
2637
+ * Лучше оставить только обёрточный div с необходимой атрибутикой
2638
+ * и сделать пассивный компонент
2639
+ *
2640
+ * @deprecated
2641
+ */
2554
2642
  const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
2555
2643
  const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
2556
2644
  const onToggle = useCallback(() => {
@@ -2558,7 +2646,7 @@
2558
2646
  }, []);
2559
2647
  const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
2560
2648
  const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
2561
- return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
2649
+ return isFoldButtonOnTop ? (jsxs(FoldableWrapper, { className: className, children: [buttonNode, sectionNode] })) : (jsxs(FoldableWrapper, { className: className, children: [sectionNode, buttonNode] }));
2562
2650
  });
2563
2651
 
2564
2652
  function useResizeObserver(callback, deps) {
@@ -4636,31 +4724,37 @@
4636
4724
  const CarouselRecommendationCard = JSX(({ className, padding, description, additionalDescription, href, icon, isDotted, __html, socialMedia = [], target, title, align = 'text-left', benefits, imageOptions: { directionRight = true, isImageAlwaysOnRight = ImageAlwaysOnRight, isImageSecondary = false, } = {}, data, ...rest }) => (jsx(BlockWrapper, { className: style('relative min-h-28 group-data-gray:bg-main-divider/50', className), defaultPadding: "p-0", ...rest, children: jsx(LinkWrapper, { href: href, target: target, className: "h-full", data: getAspectsWithInclude(data), children: jsxs(BaseTile, { className: "h-full", defaultPadding: "p-2xl", padding: padding, insetTitle: jsx(Headline, { title: title, description: description, headlineVersion: "XS", isEmbedded: true, align: align }), ...leftOrRightImage(isIcon(icon) ? jsx(Img, { image: icon }) : null, directionRight), buttons: socialMedia.length ? (jsx(SocialMedia, { media: socialMedia, stretched: true, showButtonText: true, version: rest?.version })) : null, isImageAlwaysOnRight: isImageAlwaysOnRight, isImageSecondary: isImageSecondary, imageAlign: "center", children: [jsx(BenefitsList, { benefits: benefits }), __html ? jsx(RichText, { __html: __html, isDotted: isDotted, itemSize: "list-s" }) : null, renderAdditionalDescription(additionalDescription, align)] }) }) })));
4637
4725
  const renderAdditionalDescription = (additionalDescription, align) => additionalDescription ? (jsx(Paragraph, { size: "text-m", font: "font-light", color: "text-secondary-text group-data-secondary:text-white/80", align: align, children: additionalDescription })) : null;
4638
4726
 
4727
+ const useSubjectState = (eventBus, type, initialState) => {
4728
+ const [state, setState] = useState(initialState);
4729
+ useEffect(() => eventBus.subscribe(type, setState), [eventBus, type]);
4730
+ return state;
4731
+ };
4732
+
4639
4733
  const renderCardInfo = (cell, i) => {
4640
4734
  const { title, description, buttons } = cell;
4641
4735
  return (jsxs("div", { className: "py-lg border-b border-main-divider", children: [title ? (jsx("div", { className: "opacity-80", children: jsx(Text, { size: "text-m", color: "text-secondary-text", children: title }) })) : null, description ? (jsx("div", { className: "mt-2xs", children: jsx(Text, { size: "text-xl", color: "text-primary-text", children: description }) })) : null, buttons?.length ? (jsx("div", { className: "text-primary-main", children: renderButtonsSection(buttons) })) : null] }, String(i)));
4642
4736
  };
4643
4737
 
4644
- const CarouselTariffsCard = JSX(({ className = '', title, align = 'text-center', icon, button, visibleCellsCount = 1, cardCells = [], options, data, ...rest }) => {
4645
- const cellsNode = cardCells.map(renderCardInfo);
4646
- const [visibleCells, hiddenCells] = visibleCellsCount > 0
4647
- ? [cellsNode.slice(0, visibleCellsCount), cellsNode.slice(visibleCellsCount)]
4648
- : [cellsNode, []];
4649
- const [isVisible, setIsVisible] = useState(false);
4650
- useEffect(() => defaultEventBus.subscribe('fold', (event) => {
4651
- if (options?.parent !== undefined && event.parent === options?.parent) {
4652
- setIsVisible(event.isUnfolded);
4653
- }
4654
- }), [options?.parent]);
4655
- return (jsxs(BlockWrapper, { className: style('flex flex-col', className), defaultPadding: "p-2xl", ...rest, children: [isIcon(icon) ? (jsx("div", { className: "self-center", children: jsx(Img, { image: icon }) })) : null, title ? (jsx(Heading, { className: style('pt-xs', align), headingType: "h5", title: title })) : null, button?.text ? jsx(LinkButton, { className: "w-full mt-m mb-lg", ...button }) : null, hiddenCells.length ? (jsx(Foldable, { renderFoldableSection: () => (jsxs("div", { children: [visibleCells, jsx(FoldableSection, { isUnfolded: isVisible, children: hiddenCells })] })), renderFoldButton: cardCells.length >= visibleCellsCount
4656
- ? renderFoldButton$3(options?.parent, data, isVisible)
4657
- : null })) : (jsx("div", { children: visibleCells }))] }));
4658
- });
4659
- const renderFoldButton$3 = (parent, data, isUnfolded = false) => () => (jsxs("button", { className: "w-full cursor-pointer text-primary-main pt-lg flex justify-between items-center", onClick: () => {
4660
- if (parent !== undefined) {
4661
- defaultEventBus.fire('fold', { type: 'fold', isUnfolded: !isUnfolded, parent });
4662
- }
4663
- }, type: "button", ...(isUnfolded ? getAspectsAttributes(data) : {}), children: [jsx("div", { children: isUnfolded ? 'Скрыть' : 'Подробнее о тарифе' }), jsx(Icon, { className: "text-primary-text", name: isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon', width: "16", height: "16" })] }));
4738
+ const CardCellsSection = JSX((props) => {
4739
+ const { cardCells = [], visibleCellsCount = 1, isUnfolded } = props;
4740
+ const [visibleCells, hiddenCells] = visibleCellsCount > 0 && cardCells.length >= visibleCellsCount
4741
+ ? [cardCells.slice(0, visibleCellsCount), cardCells.slice(visibleCellsCount)]
4742
+ : [cardCells, []];
4743
+ return hiddenCells.length ? (jsxs(FoldableWrapper, { children: [jsxs("div", { children: [visibleCells.map(renderCardInfo), jsx(FoldableSection, { isUnfolded: isUnfolded, children: hiddenCells.map(renderCardInfo) })] }), jsx(FoldButton, { ...props })] })) : (jsx("div", { children: visibleCells.map(renderCardInfo) }));
4744
+ });
4745
+ const FoldButton = JSX(({ isUnfolded, data, onToggle }) => (jsxs("button", { type: "button", className: "w-full cursor-pointer text-primary-main pt-lg flex justify-between items-center", ...(isUnfolded ? getAspectsAttributes(data) : {}), onClick: onToggle, children: [jsx("div", { children: isUnfolded ? 'Скрыть' : 'Подробнее о тарифе' }), jsx(Icon, { className: "text-primary-text", name: isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon', width: "16", height: "16" })] })));
4746
+
4747
+ const carouselTariffsCardEventBus = new EventBus();
4748
+
4749
+ const CarouselTariffsCard = JSX(({ className, title, align = 'text-center', icon, button, visibleCellsCount = 1, cardCells = [], options, data, ...rest }) => {
4750
+ const { isUnfolded, parent: firedParent } = useSubjectState(carouselTariffsCardEventBus.observable, 'fold', {});
4751
+ const isVisible = isUnfolded && firedParent === options?.parent;
4752
+ const toggle = useCallback(() => carouselTariffsCardEventBus.emitter.fire('fold', {
4753
+ isUnfolded: !isVisible,
4754
+ parent: options?.parent,
4755
+ }), [isVisible, options?.parent]);
4756
+ return (jsxs(BlockWrapper, { className: style('flex flex-col', className), defaultPadding: "p-2xl", ...rest, children: [isIcon(icon) ? (jsx("div", { className: "self-center", children: jsx(Img, { image: icon }) })) : null, title ? (jsx(Heading, { className: style('pt-xs', align), headingType: "h5", title: title })) : null, button?.text ? jsx(LinkButton, { className: "w-full mt-m mb-lg", ...button }) : null, jsx(CardCellsSection, { cardCells: cardCells, visibleCellsCount: visibleCellsCount, isUnfolded: isVisible, data: data, onToggle: toggle })] }));
4757
+ });
4664
4758
 
4665
4759
  const isRateRow = (rateRow) => typeof rateRow?.minMonths === 'number' && typeof rateRow?.maxMonths === 'number';
4666
4760
 
@@ -4827,47 +4921,46 @@
4827
4921
  };
4828
4922
  const ErrorBlock = JSX(({ className = '', title, description, error, button, ...rest }) => (jsxs(BlockWrapper, { className: style('flex flex-col justify-center items-center', className), defaultPadding: style('p-6xl'), version: "transparent", ...rest, children: [jsx("div", { className: "flex justify-center", children: renderErrorContent(error) }), jsx(Headline, { title: title, description: description, headlineVersion: "XL", isEmbedded: true, className: "mb-2xl last:mb-0" }), button?.text ? (jsx(LinkButton, { version: button?.version, text: button?.text, ...button })) : null] })));
4829
4923
 
4830
- const useLatestEvent = (eventBus, type, initialEvent) => {
4831
- const [latestEvent, setLatestEvent] = useState(initialEvent || null);
4832
- useEffect(() => eventBus.subscribe(type, (_) => setLatestEvent(_)), [eventBus, type]);
4833
- const fireEvent = useCallback((_) => eventBus.fire(type, _), [eventBus, type]);
4834
- return [latestEvent, fireEvent];
4835
- };
4924
+ function useSubject(eventBus, type, initialState) {
4925
+ useEffect(() => {
4926
+ const state = initialState instanceof Function ? initialState() : initialState;
4927
+ if (state instanceof Promise) {
4928
+ state.then((_) => eventBus.subject(type, _), console.warn);
4929
+ }
4930
+ else {
4931
+ eventBus.subject(type, state);
4932
+ }
4933
+ }, [eventBus, type]);
4934
+ return useCallback((_) => eventBus.fire(type, _), [eventBus, type]);
4935
+ }
4836
4936
 
4837
4937
  const REGION_URL = '/api/v1/region';
4838
4938
  const LOCATION_STORAGE_KEY = 'location';
4839
4939
  function useLocation(defaultLocation = 'Москва') {
4840
- const [currentLocation, fireCurrentLocation] = useLatestEvent(defaultEventBus, 'location', restoreLocation() ?? { name: defaultLocation });
4841
- const selectCurrentLocation = useCallback((_) => {
4842
- storeLocation(_);
4843
- fireCurrentLocation(_);
4844
- }, []);
4845
- const { data } = useAsyncData(hasStoredLocation() ? null : REGION_URL, fetchJSONUnsafe);
4846
- useEffect(() => {
4847
- if (data && !hasStoredLocation()) {
4848
- fireCurrentLocation(data);
4940
+ useEffect(() => defaultEventBus.subscribe('location', storeLocation), []);
4941
+ return useSubject(defaultEventBus.emitter, 'location', restoreLocation(defaultLocation));
4942
+ }
4943
+ function useLocationState(defaultLocation = 'Москва') {
4944
+ return useSubjectState(defaultEventBus.observable, 'location', { name: defaultLocation });
4945
+ }
4946
+ function restoreLocation(defaultLocation) {
4947
+ return async () => {
4948
+ if (!globalThis.localStorage?.hasItem(LOCATION_STORAGE_KEY)) {
4949
+ storeLocation(await fetchJSON(REGION_URL));
4950
+ }
4951
+ const storedLocation = globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY);
4952
+ try {
4953
+ return storedLocation && JSON.parse(storedLocation);
4954
+ }
4955
+ catch (ex) {
4956
+ // Do nothing
4849
4957
  }
4850
- }, [data]);
4851
- return [currentLocation ?? { name: defaultLocation }, selectCurrentLocation];
4958
+ return { name: defaultLocation };
4959
+ };
4960
+ }
4961
+ function storeLocation(_) {
4962
+ _ && globalThis.localStorage?.setItem(LOCATION_STORAGE_KEY, JSON.stringify(_));
4852
4963
  }
4853
- const hasStoredLocation = () => Boolean(globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY));
4854
- const restoreLocation = () => {
4855
- try {
4856
- const data = globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY);
4857
- return data && JSON.parse(data);
4858
- }
4859
- catch (ex) {
4860
- return null;
4861
- }
4862
- };
4863
- const storeLocation = (_) => {
4864
- try {
4865
- globalThis.localStorage?.setItem(LOCATION_STORAGE_KEY, JSON.stringify(_));
4866
- }
4867
- catch (ex) {
4868
- // Do nothing
4869
- }
4870
- };
4871
4964
 
4872
4965
  var Currency;
4873
4966
  (function (Currency) {
@@ -5009,7 +5102,7 @@
5009
5102
  }
5010
5103
 
5011
5104
  const ExchangeRateTile = JSX(({ className = '', title = 'Курсы обмена валют', button, ...rest }) => {
5012
- const [currentLocation] = useLocation();
5105
+ const currentLocation = useLocationState();
5013
5106
  const exchangeRates = useFetchExchangeRateData(currentLocation);
5014
5107
  const currencyRates = getCurrencyRates(exchangeRates?.exchangeRate?.currencies);
5015
5108
  const currencyRatesBuy = currencyRates.filter((_) => _.buyExchangeRate);
@@ -5862,7 +5955,7 @@
5862
5955
  designDisabledPeople: (item) => Boolean(item.designDisabledPeople),
5863
5956
  };
5864
5957
  const AtmsMap = JSX(({ descriptionData, className }) => {
5865
- const [currentLocation] = useLocation();
5958
+ const currentLocation = useLocationState();
5866
5959
  const regionCode = currentLocation?.code ?? '000';
5867
5960
  const { data: officesData, isLoad } = useAtms(regionCode);
5868
5961
  return (jsx(OfficesAtmsMapLayout, { className: className, filterItems: filterItems, data: officesData, isLoad: isLoad, initFilterState: INITIAL_FILTRATION_STATE, renderCard: renderAtmCard, getBalloon: getAtmPoint, title: `Банкоматы филиала ${currentLocation?.name}`, descriptionData: descriptionData }));
@@ -6081,7 +6174,7 @@
6081
6174
  };
6082
6175
 
6083
6176
  const OfficesMap = JSX(({ className }) => {
6084
- const [currentLocation] = useLocation();
6177
+ const currentLocation = useLocationState();
6085
6178
  const regionCode = currentLocation?.code ?? '000';
6086
6179
  const { data, isLoad } = useOffices(regionCode);
6087
6180
  return (jsx(OfficesAtmsMapLayout, { className: className, data: data?.branches, isLoad: isLoad, remoteWorkplaces: data?.remoteWorkplaces, renderCard: renderOfficeCard, renderRemoteWorkplaceCard: renderRemoteWorkplaceCard, getBalloon: getOfficePoint, getBalloonRemoteWorkplaces: getRemoteWorkplacePoint, title: `Офисы филиала ${currentLocation?.name}` }));
@@ -6329,7 +6422,7 @@
6329
6422
  onClose && onClose(dialogs[dialogs.length - 1]);
6330
6423
  pop();
6331
6424
  }, [dialogs, onClose]);
6332
- useEffect(() => defaultEventBus.subscribe('dialog', (action) => {
6425
+ useEffect(() => defaultEventBus.observable.subscribe('dialog', (action) => {
6333
6426
  switch (action.type) {
6334
6427
  case 'open':
6335
6428
  push(action);
@@ -6438,27 +6531,33 @@
6438
6531
  return (jsxs("form", { className: `font-sans relative ${className}`, children: [jsx("div", { className: "absolute rounded h-full flex items-center justify-center pl-m max-w-44 gap-s pointer-events-none", children: searchTerm ? null : (jsx("label", { htmlFor: "search-bar-input", className: `text-secondary-text `, children: "\u041F\u043E\u0438\u0441\u043A \u043F\u043E \u0444\u0438\u043B\u0438\u0430\u043B\u0430\u043C" })) }), jsx("input", { id: "search-bar-input", className: style(inputValidStyle, `h-12 pl-m w-full peer text-l text-black rounded-md box-border`), value: searchTerm, onChange: (e) => onSearch(e.target.value.toLowerCase()), type: "text", name: "location-search-bar-input" })] }));
6439
6532
  });
6440
6533
 
6441
- const SEARCH_TERM_MIN_LENGTH = 3;
6442
- const LocationDialog = JSX(({ foreignOffices, branches }) => {
6443
- const [currentLocation, selectCurrentLocation] = useLocation(branches?.default);
6534
+ const SelectedLocation = JSX(({ defaultLocation }) => {
6535
+ const currentLocation = useLocationState(defaultLocation);
6444
6536
  const link = useLink();
6445
6537
  const { href } = link({ href: `/branches/${currentLocation.slug}` });
6538
+ return currentLocation ? (jsx("div", { className: "mb-s", children: jsxs(Paragraph, { size: "text-l", color: "text-primary-text", children: ["\u0421\u0435\u0439\u0447\u0430\u0441 \u0432\u044B\u0431\u0440\u0430\u043D:", jsx(LinkWrapper, { href: href, className: "inline mx-2xs text-primary-main", children: currentLocation.name })] }) })) : null;
6539
+ });
6540
+
6541
+ const SEARCH_TERM_MIN_LENGTH = 3;
6542
+ const LocationDialog = JSX(({ foreignOffices, branches }) => {
6543
+ const selectLocation = useLocation(branches?.default);
6446
6544
  const [query, setQuery] = useState('');
6447
- const regions = cleanUpRegions(useRegions()).sort((a, b) => a.name.localeCompare(b.name));
6448
- const regionsGroupByLetter = groupBy(regions, regionFirstLetter);
6545
+ const rawRegions = useRegions();
6546
+ const regions = useMemo(() => cleanUpRegions(rawRegions).sort((a, b) => (a.name ?? '').localeCompare(b.name ?? '')), [rawRegions]);
6547
+ const regionsGroupByLetter = useMemo(() => groupBy(regions, regionFirstLetter), [regions]);
6449
6548
  const { close } = useDialogManager();
6450
6549
  const handleChangeLocation = useCallback((region) => {
6451
- selectCurrentLocation(region);
6550
+ selectLocation(region);
6452
6551
  close();
6453
6552
  }, []);
6454
- return (jsxs(Dialog, { className: "pb-20", head: jsxs("div", { children: [jsx(Text, { size: "text-h4", color: "text-primary-text", children: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0438\u043B\u0438\u0430\u043B" }), currentLocation ? (jsx("div", { className: "mb-s", children: jsxs(Paragraph, { size: "text-l", color: "text-primary-text", children: ["\u0421\u0435\u0439\u0447\u0430\u0441 \u0432\u044B\u0431\u0440\u0430\u043D:", jsx(LinkWrapper, { href: href, className: "inline mx-2xs text-primary-main", children: currentLocation.name })] }) })) : null, jsx(SearchBar, { onSearch: setQuery, searchTerm: query })] }), children: [query && query.length >= SEARCH_TERM_MIN_LENGTH ? (jsx("div", { children: regions
6553
+ return (jsxs(Dialog, { className: "pb-20", head: jsxs("div", { children: [jsx(Text, { size: "text-h4", color: "text-primary-text", children: "\u0412\u044B\u0431\u0435\u0440\u0438\u0442\u0435 \u0444\u0438\u043B\u0438\u0430\u043B" }), jsx(SelectedLocation, { defaultLocation: branches?.default }), jsx(SearchBar, { onSearch: setQuery, searchTerm: query })] }), children: [query && query.length >= SEARCH_TERM_MIN_LENGTH ? (jsx("div", { children: regions
6455
6554
  .filter(({ name }) => name && jaroWinklerDistance(name.toLowerCase())(query.toLowerCase()) >= 0.8)
6456
6555
  .map(renderRegion(branches?.dataSelect, handleChangeLocation)) })) : (jsx("div", { className: "columns-1 sm:columns-3 md:columns-4 lg:columns-5", children: Array.from(regionsGroupByLetter.entries()).map(renderRegionGroup(handleChangeLocation, branches?.dataSelect)) })), renderForeignOffices(foreignOffices)] }));
6457
6556
  });
6458
- const regionFirstLetter = (region) => region.name?.charAt(0) || '';
6557
+ const regionFirstLetter = (region) => region.name?.charAt(0) ?? '';
6459
6558
  const cleanUpRegions = (regions) => regions.map((region) => ({
6460
6559
  ...region,
6461
- name: region.name?.replace(/республика|область|край'/gi, '').trim() || '',
6560
+ name: region.name?.replace(/республика|область|край'/gi, '').trim() ?? '',
6462
6561
  }));
6463
6562
 
6464
6563
  const useLocationDialog = (props) => {
@@ -6471,7 +6570,7 @@
6471
6570
 
6472
6571
  const BurgerMenuDialog = JSX(({ menuRef, menuItem, locationDialogProps, closeAll }) => {
6473
6572
  const locationDialog = useLocationDialog(locationDialogProps || {});
6474
- const [{ name: location }] = useLocation();
6573
+ const { name: location } = useLocationState();
6475
6574
  const menuDimensions = menuRef?.current?.getBoundingClientRect();
6476
6575
  const basePath = getBasePath(env.SITE_URL);
6477
6576
  const handleIframeLoad = () => {
@@ -7031,7 +7130,7 @@
7031
7130
  const close = useCallback(() => {
7032
7131
  setPopup(null);
7033
7132
  }, []);
7034
- useEffect(() => defaultEventBus.subscribe('popup', (action) => {
7133
+ useEffect(() => defaultEventBus.observable.subscribe('popup', (action) => {
7035
7134
  switch (action.type) {
7036
7135
  case 'open':
7037
7136
  case 'update':
@@ -7086,7 +7185,7 @@
7086
7185
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
7087
7186
  });
7088
7187
 
7089
- const packageVersion = "0.14.594";
7188
+ const packageVersion = "0.14.596";
7090
7189
 
7091
7190
  exports.Blocks = Blocks;
7092
7191
  exports.ContentPage = ContentPage;