@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
@@ -403,39 +403,58 @@
403
403
  ].join(' ');
404
404
 
405
405
  class EventBus {
406
- subscribers = {};
406
+ subscribersMap = {};
407
407
  subjectsStateMap = {};
408
+ emitter = this;
409
+ observable = this;
408
410
  subscribe(type, listener) {
409
- this.subscribers[type] = (this.subscribers[type] || []).concat(listener);
410
- const latestEvent = this.subjectsStateMap[type];
411
- if (latestEvent) {
412
- listener(latestEvent);
413
- }
411
+ this.subscribersMap[type] ||= [];
412
+ this.subscribersMap[type]?.push(listener);
413
+ this.fireSubscribers([listener], this.subjectsStateMap[type]);
414
414
  return () => {
415
415
  this.unsubscribe(type, listener);
416
416
  };
417
417
  }
418
418
  unsubscribe(type, listener) {
419
- this.subscribers[type] = this.subscribers[type]?.filter((s) => s !== listener);
419
+ const index = this.subscribersMap[type]?.indexOf(listener);
420
+ if (index && index !== -1) {
421
+ this.subscribersMap[type]?.splice(index, 1);
422
+ }
420
423
  }
421
424
  fire(type, event) {
422
425
  const isSubjectDeclared = type in this.subjectsStateMap;
423
426
  if (isSubjectDeclared) {
424
- this.subjectsStateMap[type] = event;
427
+ this.subject(type, event);
428
+ }
429
+ else {
430
+ this.fireSubscribers(this.subscribersMap[type], event);
425
431
  }
426
- this.subscribers[type]?.forEach((s) => s(event));
427
432
  }
428
433
  subject(type, event) {
429
- this.subjectsStateMap[type] = event;
434
+ if (this.subjectsStateMap[type] !== event) {
435
+ this.subjectsStateMap[type] = event;
436
+ this.fireSubscribers(this.subscribersMap[type], event);
437
+ }
438
+ return () => {
439
+ delete this.subjectsStateMap[type];
440
+ };
441
+ }
442
+ fireSubscribers(subscribers, event) {
443
+ if (!subscribers || !event) {
444
+ return;
445
+ }
446
+ for (const _ of subscribers) {
447
+ _(event);
448
+ }
430
449
  }
431
450
  }
432
451
 
433
452
  const defaultEventBus = new EventBus();
434
453
 
435
454
  const useDialogManager = () => ({
436
- open: (dialog, options = {}) => defaultEventBus.fire('dialog', { type: 'open', dialog, ...options }),
437
- close: () => defaultEventBus.fire('dialog', { type: 'close' }),
438
- closeAll: () => defaultEventBus.fire('dialog', { type: 'close', all: true }),
455
+ open: (dialog, options = {}) => defaultEventBus.emitter.fire('dialog', { type: 'open', dialog, ...options }),
456
+ close: () => defaultEventBus.emitter.fire('dialog', { type: 'close' }),
457
+ closeAll: () => defaultEventBus.emitter.fire('dialog', { type: 'close', all: true }),
439
458
  });
440
459
 
441
460
  const adjustBase = (href, basePath = '') => href.replace(basePath, '') || '/';
@@ -1090,6 +1109,7 @@
1090
1109
  { key: 'phone', text: 'Телефонный звонок' },
1091
1110
  { key: 'email', text: 'Электронное сообщение' },
1092
1111
  ];
1112
+ // TODO Тоже надо рефакторить - файлик constants
1093
1113
  const OUT_SERVICE_URL = '/api/v1/outservice/outserviceregions';
1094
1114
 
1095
1115
  const getRegionUrl = (typeForm) => typeForm === 'OUTSERVICE' ? OUT_SERVICE_URL : undefined;
@@ -1193,15 +1213,22 @@
1193
1213
  const defaultStyle$1 = 'w-full border rounded-md text-primary-text outline-none p-m';
1194
1214
 
1195
1215
  const DEFAULT_HINTS_COUNT = 10;
1196
- const getResponseHandler = (response) => {
1216
+ const defaultResponseItemHandler = (item) => item?.value || '';
1217
+ const getResponseHandler = (itemHandler) => (response) => {
1197
1218
  const responseData = response?.suggestions || [];
1198
- return responseData.map((item) => ({
1199
- ...item,
1200
- processedValue: item?.value,
1201
- }));
1219
+ return responseData.map((item) => {
1220
+ const value = itemHandler(item);
1221
+ return {
1222
+ ...item,
1223
+ processedValue: value,
1224
+ };
1225
+ });
1202
1226
  };
1203
1227
  const getDaDataHints = (options) => {
1204
- const { url, query, requestData = {} } = options;
1228
+ const { url, query, queryPrefix, requestData = {}, responseItemHandler = defaultResponseItemHandler, } = options;
1229
+ const responseHandler = getResponseHandler(responseItemHandler);
1230
+ const queryPrefixValue = queryPrefix ? `${queryPrefix}, ` : '';
1231
+ const combinedQuery = `${queryPrefixValue}${query}`;
1205
1232
  const result = fetch(`/api/v1/suggestions/${url}`, {
1206
1233
  method: 'POST',
1207
1234
  mode: 'cors',
@@ -1211,11 +1238,11 @@
1211
1238
  body: JSON.stringify({
1212
1239
  count: DEFAULT_HINTS_COUNT,
1213
1240
  ...requestData,
1214
- query,
1241
+ query: combinedQuery,
1215
1242
  }),
1216
1243
  })
1217
1244
  .then((response) => response.json())
1218
- .then(getResponseHandler);
1245
+ .then(responseHandler);
1219
1246
  return result;
1220
1247
  };
1221
1248
 
@@ -1243,11 +1270,33 @@
1243
1270
  const EMAIL_HINTS_LIST_OPTIONS = {
1244
1271
  url: 'suggest/email',
1245
1272
  };
1273
+ const PASSPORT_FMS_HINTS_LIST_OPTIONS = {
1274
+ url: 'suggest/fms_unit',
1275
+ };
1276
+ const PASSPORT_CODE_HINTS_LIST_OPTIONS = {
1277
+ url: 'suggest/fms_unit',
1278
+ responseItemHandler: (item) => item?.data?.code?.replace('-', '') || '',
1279
+ };
1280
+ const ORGANIZATION_NAME_HINTS_LIST_OPTIONS = {
1281
+ url: 'suggest/party',
1282
+ };
1283
+ const ORGANIZATION_INN_HINTS_LIST_OPTIONS = {
1284
+ url: 'suggest/party',
1285
+ responseItemHandler: (item) => item?.data?.inn || '',
1286
+ };
1287
+ const ADDRESS_HINTS_LIST_OPTIONS = {
1288
+ url: 'suggest/address',
1289
+ };
1246
1290
  const hintsListsOptions = {
1247
1291
  name: NAME_HINTS_LIST_OPTIONS,
1248
1292
  surname: SURNAME_HINTS_LIST_OPTIONS,
1249
1293
  middleName: PATRONYMIC_HINTS_LIST_OPTIONS,
1250
1294
  email: EMAIL_HINTS_LIST_OPTIONS,
1295
+ dulSubdivisionCode: PASSPORT_CODE_HINTS_LIST_OPTIONS,
1296
+ dulIssuedBy: PASSPORT_FMS_HINTS_LIST_OPTIONS,
1297
+ organizationName: ORGANIZATION_NAME_HINTS_LIST_OPTIONS,
1298
+ inn: ORGANIZATION_INN_HINTS_LIST_OPTIONS,
1299
+ participantAddress: ADDRESS_HINTS_LIST_OPTIONS,
1251
1300
  };
1252
1301
 
1253
1302
  const debounce = (fn, delay = 600) => {
@@ -1267,14 +1316,14 @@
1267
1316
  };
1268
1317
 
1269
1318
  const usePopupManager = () => ({
1270
- open: (popup, options) => defaultEventBus.fire('popup', { type: 'open', popup, ...options }),
1271
- update: (popup, options) => defaultEventBus.fire('popup', { type: 'update', popup, ...options }),
1272
- close: () => defaultEventBus.fire('popup', { type: 'close' }),
1319
+ open: (popup, options) => defaultEventBus.emitter.fire('popup', { type: 'open', popup, ...options }),
1320
+ update: (popup, options) => defaultEventBus.emitter.fire('popup', { type: 'update', popup, ...options }),
1321
+ close: () => defaultEventBus.emitter.fire('popup', { type: 'close' }),
1273
1322
  });
1274
1323
 
1275
- 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()))) })));
1324
+ 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()))) })));
1276
1325
 
1277
- function useInputPopup({ isOpen, value, name, onChange }) {
1326
+ function useInputPopup({ isOpen, value, name, onChange, onDaDataChange, daDataQueryPrefix, }) {
1278
1327
  const prevInputValue = useRef(value);
1279
1328
  const currentInputValue = useRef(value);
1280
1329
  const [hintsList, setHintsList] = useState([]);
@@ -1286,8 +1335,9 @@
1286
1335
  }, [value]);
1287
1336
  const handleChange = useCallback((option) => {
1288
1337
  close();
1289
- currentInputValue.current = option;
1290
- onChange && onChange(option);
1338
+ currentInputValue.current = option.processedValue;
1339
+ onChange && onChange(option.processedValue);
1340
+ onDaDataChange && onDaDataChange(option);
1291
1341
  }, [close, onChange]);
1292
1342
  const inputRef = useRef(null);
1293
1343
  const getHintsList = useMemo(() => async (searchValue) => {
@@ -1296,15 +1346,17 @@
1296
1346
  }
1297
1347
  const result = await getDaDataHints({
1298
1348
  url: defaultHintsListOptions.url,
1349
+ responseItemHandler: defaultHintsListOptions.responseItemHandler,
1299
1350
  requestData: {
1300
1351
  ...defaultHintsListOptions?.requestData,
1301
1352
  },
1302
1353
  query: searchValue,
1354
+ queryPrefix: daDataQueryPrefix,
1303
1355
  });
1304
1356
  if (result?.length) {
1305
1357
  setHintsList(result);
1306
1358
  }
1307
- }, []);
1359
+ }, [daDataQueryPrefix]);
1308
1360
  const debouncedGetHintsList = useMemo(() => debounce(getHintsList, 300), [getHintsList]);
1309
1361
  useEffect(() => {
1310
1362
  if (!isOpen || !inputRef.current || currentInputValue.current === value) {
@@ -1326,14 +1378,16 @@
1326
1378
  return inputRef;
1327
1379
  }
1328
1380
 
1329
- const InputControl = JSX(({ className, label, value = '', placeholder, error, errors, onChange = noop, onBlur, isTextarea, type, name = '', dadata = false, }) => {
1381
+ const InputControl = JSX(({ className, label, value = '', placeholder, error, errors, onChange = noop, onDaDataChange, onBlur, isTextarea, type, name = '', daDataQueryPrefix, dadata = false, }) => {
1330
1382
  const [isOpen, { setFalse: close, setTrue: open }] = useBool();
1331
1383
  const popupRef = useOutsideClick(close);
1332
1384
  const inputRef = useInputPopup({
1333
1385
  isOpen: isOpen && dadata,
1334
1386
  name,
1335
1387
  value,
1388
+ daDataQueryPrefix,
1336
1389
  onChange,
1390
+ onDaDataChange,
1337
1391
  });
1338
1392
  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)] }));
1339
1393
  });
@@ -1533,6 +1587,7 @@
1533
1587
  };
1534
1588
  };
1535
1589
 
1590
+ // TODO Зачем это?
1536
1591
  const getValidation = (field, validator, required = false) => required ? withValidator(field, validator) : field;
1537
1592
 
1538
1593
  const ACQUIRING_TYPES = [
@@ -1949,13 +2004,24 @@
1949
2004
 
1950
2005
  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) })));
1951
2006
 
1952
- const DulIssuedBy = JSX(({ field, input }) => (jsx(InputControl, { label: "\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D", ...getValidation(field('dulIssuedBy'), validatorObj.dulIssuedBy, input?.required) })));
2007
+ const DulIssuedByField = JSX(({ field, input }) => {
2008
+ const { value: dulSubdivisionCode, onChange: changeDulSubdivisionCode } = field('dulSubdivisionCode');
2009
+ const onDaDataChange = useCallback((item) => {
2010
+ changeDulSubdivisionCode?.(item?.data?.code?.replace('-', ''));
2011
+ }, []);
2012
+ return (jsx(InputControl, { label: "\u041A\u0435\u043C \u0432\u044B\u0434\u0430\u043D", ...input, ...getValidation(field('dulIssuedBy'), validatorObj.dulIssuedBy, input?.required), onDaDataChange: onDaDataChange, daDataQueryPrefix: dulSubdivisionCode }));
2013
+ });
1953
2014
 
1954
2015
  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) })));
1955
2016
 
1956
2017
  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) })));
1957
2018
 
1958
- 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) })));
2019
+ const DulSubdivisionCodeField = JSX(({ field, input }) => {
2020
+ const onDaDataChange = useCallback((item) => {
2021
+ field?.('dulIssuedBy')?.onChange?.(item?.data?.name);
2022
+ }, []);
2023
+ 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 }));
2024
+ });
1959
2025
 
1960
2026
  const EducationField = JSX(({ field, input }) => {
1961
2027
  const { data: education } = useLeadFormData('EDUCATION_LEVEL');
@@ -2006,7 +2072,13 @@
2006
2072
  return (jsx(SelectField, { field: field, source: housing, label: "\u0422\u0438\u043F \u0436\u0438\u043B\u044C\u044F", fieldName: "housing", input: input }));
2007
2073
  });
2008
2074
 
2009
- const InnField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0418\u041D\u041D", type: "number", ...getValidation(field('inn'), validatorObj.inn, input?.required) })));
2075
+ const InnField = JSX(({ field, input }) => {
2076
+ const onDaDataChange = useCallback((item) => {
2077
+ field?.('organizationName')?.onChange?.(item.data?.name?.short_with_opf);
2078
+ field?.('legalForm')?.onChange?.(item.data?.opf?.short);
2079
+ }, []);
2080
+ return (jsx(InputControl, { label: "\u0418\u041D\u041D", type: "number", ...input, ...getValidation(field('inn'), validatorObj.inn, input?.required), onDaDataChange: onDaDataChange }));
2081
+ });
2010
2082
 
2011
2083
  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"' })));
2012
2084
 
@@ -2017,9 +2089,11 @@
2017
2089
  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 })));
2018
2090
 
2019
2091
  const REGIONS_URL = '/api/v1/regions';
2092
+ const EMPTY_REGIONS = [];
2093
+ // TODO Почему url можно менять? Разве смысл не в инкапсуляции api url. Тоже под рефакторинг попадает
2020
2094
  function useRegions(url = REGIONS_URL) {
2021
2095
  const { data } = useAsyncData(url, fetchJSONUnsafe);
2022
- return Array.isArray(data) ? data : [];
2096
+ return Array.isArray(data) ? data : EMPTY_REGIONS;
2023
2097
  }
2024
2098
 
2025
2099
  const LocalitiesField = JSX(({ field, input }) => {
@@ -2049,7 +2123,13 @@
2049
2123
  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 }));
2050
2124
  });
2051
2125
 
2052
- 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 })));
2126
+ const OrganizationNameField = JSX(({ field, input }) => {
2127
+ const onDaDataChange = useCallback((item) => {
2128
+ field?.('inn')?.onChange?.(item.data?.inn);
2129
+ field?.('legalForm')?.onChange?.(item.data?.opf?.short);
2130
+ }, []);
2131
+ 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 }));
2132
+ });
2053
2133
 
2054
2134
  const ParticipantAddressField = JSX(({ field, input }) => (jsx(InputControl, { label: "\u0410\u0434\u0440\u0435\u0441", ...getValidation(field('participantAddress'), validatorObj.participantAddress, input?.required), ...input })));
2055
2135
 
@@ -2284,8 +2364,8 @@
2284
2364
  dulSerie: jsx(DulSerieField, { field: field, input: input }),
2285
2365
  dulNumber: jsx(DulNumberField, { field: field, input: input }),
2286
2366
  dulIssueDateField: jsx(DulIssueDateField, { field: field, input: input }),
2287
- dulSubdivisionCode: jsx(DulSubdivisionCode, { field: field, input: input }),
2288
- dulIssuedBy: jsx(DulIssuedBy, { field: field, input: input }),
2367
+ dulSubdivisionCode: jsx(DulSubdivisionCodeField, { field: field, input: input }),
2368
+ dulIssuedBy: jsx(DulIssuedByField, { field: field, input: input }),
2289
2369
  participantAddress: jsx(ParticipantAddressField, { field: field, input: input }),
2290
2370
  participantDateRegistration: jsx(ParticipantDateRegistrationField, { field: field, input: input }),
2291
2371
  };
@@ -2543,6 +2623,14 @@
2543
2623
  return { ...formState, typeForm: { key: typeForm, text: '' } };
2544
2624
  };
2545
2625
 
2626
+ const FoldableWrapper = JSX(({ className, children }) => (jsx("div", { className: className, role: "group", children: children })));
2627
+ /**
2628
+ * Какой то бесполезный компонент. Его можно заменить на useBool
2629
+ * Лучше оставить только обёрточный div с необходимой атрибутикой
2630
+ * и сделать пассивный компонент
2631
+ *
2632
+ * @deprecated
2633
+ */
2546
2634
  const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
2547
2635
  const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
2548
2636
  const onToggle = useCallback(() => {
@@ -2550,7 +2638,7 @@
2550
2638
  }, []);
2551
2639
  const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
2552
2640
  const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
2553
- return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
2641
+ return isFoldButtonOnTop ? (jsxs(FoldableWrapper, { className: className, children: [buttonNode, sectionNode] })) : (jsxs(FoldableWrapper, { className: className, children: [sectionNode, buttonNode] }));
2554
2642
  });
2555
2643
 
2556
2644
  function useResizeObserver(callback, deps) {
@@ -4640,31 +4728,37 @@
4640
4728
  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)] }) }) })));
4641
4729
  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;
4642
4730
 
4731
+ const useSubjectState = (eventBus, type, initialState) => {
4732
+ const [state, setState] = useState(initialState);
4733
+ useEffect(() => eventBus.subscribe(type, setState), [eventBus, type]);
4734
+ return state;
4735
+ };
4736
+
4643
4737
  const renderCardInfo = (cell, i) => {
4644
4738
  const { title, description, buttons } = cell;
4645
4739
  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)));
4646
4740
  };
4647
4741
 
4648
- const CarouselTariffsCard = JSX(({ className = '', title, align = 'text-center', icon, button, visibleCellsCount = 1, cardCells = [], options, data, ...rest }) => {
4649
- const cellsNode = cardCells.map(renderCardInfo);
4650
- const [visibleCells, hiddenCells] = visibleCellsCount > 0
4651
- ? [cellsNode.slice(0, visibleCellsCount), cellsNode.slice(visibleCellsCount)]
4652
- : [cellsNode, []];
4653
- const [isVisible, setIsVisible] = useState(false);
4654
- useEffect(() => defaultEventBus.subscribe('fold', (event) => {
4655
- if (options?.parent !== undefined && event.parent === options?.parent) {
4656
- setIsVisible(event.isUnfolded);
4657
- }
4658
- }), [options?.parent]);
4659
- 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
4660
- ? renderFoldButton$3(options?.parent, data, isVisible)
4661
- : null })) : (jsx("div", { children: visibleCells }))] }));
4662
- });
4663
- 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: () => {
4664
- if (parent !== undefined) {
4665
- defaultEventBus.fire('fold', { type: 'fold', isUnfolded: !isUnfolded, parent });
4666
- }
4667
- }, type: "button", ...(isUnfolded ? getAspectsAttributes(data) : {}), children: [jsx("div", { children: isUnfolded ? 'Скрыть' : 'Подробнее о тарифе' }), jsx(Icon, { className: "text-primary-text", name: isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon', width: "16", height: "16" })] }));
4742
+ const CardCellsSection = JSX((props) => {
4743
+ const { cardCells = [], visibleCellsCount = 1, isUnfolded } = props;
4744
+ const [visibleCells, hiddenCells] = visibleCellsCount > 0 && cardCells.length >= visibleCellsCount
4745
+ ? [cardCells.slice(0, visibleCellsCount), cardCells.slice(visibleCellsCount)]
4746
+ : [cardCells, []];
4747
+ 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) }));
4748
+ });
4749
+ 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" })] })));
4750
+
4751
+ const carouselTariffsCardEventBus = new EventBus();
4752
+
4753
+ const CarouselTariffsCard = JSX(({ className, title, align = 'text-center', icon, button, visibleCellsCount = 1, cardCells = [], options, data, ...rest }) => {
4754
+ const { isUnfolded, parent: firedParent } = useSubjectState(carouselTariffsCardEventBus.observable, 'fold', {});
4755
+ const isVisible = isUnfolded && firedParent === options?.parent;
4756
+ const toggle = useCallback(() => carouselTariffsCardEventBus.emitter.fire('fold', {
4757
+ isUnfolded: !isVisible,
4758
+ parent: options?.parent,
4759
+ }), [isVisible, options?.parent]);
4760
+ 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 })] }));
4761
+ });
4668
4762
 
4669
4763
  const ContactsBlock = JSX(({ className, contacts, info, version = 'secondary', ...rest }) => (jsxs(BlockWrapper, { className: style('flex', className), defaultPadding: "p-6xl", version: version, ...rest, children: [info?.length ? renderBlocks(info) : null, contacts?.length ? renderBlocks(contacts) : null] })));
4670
4764
  const renderBlocks = (info) => (jsx("div", { className: "flex gap-5xl grow basis-0", children: info.map((column, i) => renderBlocksColumn({ column, i })) }));
@@ -4836,47 +4930,46 @@
4836
4930
  };
4837
4931
  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] })));
4838
4932
 
4839
- const useLatestEvent = (eventBus, type, initialEvent) => {
4840
- const [latestEvent, setLatestEvent] = useState(initialEvent || null);
4841
- useEffect(() => eventBus.subscribe(type, (_) => setLatestEvent(_)), [eventBus, type]);
4842
- const fireEvent = useCallback((_) => eventBus.fire(type, _), [eventBus, type]);
4843
- return [latestEvent, fireEvent];
4844
- };
4933
+ function useSubject(eventBus, type, initialState) {
4934
+ useEffect(() => {
4935
+ const state = initialState instanceof Function ? initialState() : initialState;
4936
+ if (state instanceof Promise) {
4937
+ state.then((_) => eventBus.subject(type, _), console.warn);
4938
+ }
4939
+ else {
4940
+ eventBus.subject(type, state);
4941
+ }
4942
+ }, [eventBus, type]);
4943
+ return useCallback((_) => eventBus.fire(type, _), [eventBus, type]);
4944
+ }
4845
4945
 
4846
4946
  const REGION_URL = '/api/v1/region';
4847
4947
  const LOCATION_STORAGE_KEY = 'location';
4848
4948
  function useLocation(defaultLocation = 'Москва') {
4849
- const [currentLocation, fireCurrentLocation] = useLatestEvent(defaultEventBus, 'location', restoreLocation() ?? { name: defaultLocation });
4850
- const selectCurrentLocation = useCallback((_) => {
4851
- storeLocation(_);
4852
- fireCurrentLocation(_);
4853
- }, []);
4854
- const { data } = useAsyncData(hasStoredLocation() ? null : REGION_URL, fetchJSONUnsafe);
4855
- useEffect(() => {
4856
- if (data && !hasStoredLocation()) {
4857
- fireCurrentLocation(data);
4949
+ useEffect(() => defaultEventBus.subscribe('location', storeLocation), []);
4950
+ return useSubject(defaultEventBus.emitter, 'location', restoreLocation(defaultLocation));
4951
+ }
4952
+ function useLocationState(defaultLocation = 'Москва') {
4953
+ return useSubjectState(defaultEventBus.observable, 'location', { name: defaultLocation });
4954
+ }
4955
+ function restoreLocation(defaultLocation) {
4956
+ return async () => {
4957
+ if (!globalThis.localStorage?.hasItem(LOCATION_STORAGE_KEY)) {
4958
+ storeLocation(await fetchJSON(REGION_URL));
4959
+ }
4960
+ const storedLocation = globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY);
4961
+ try {
4962
+ return storedLocation && JSON.parse(storedLocation);
4963
+ }
4964
+ catch (ex) {
4965
+ // Do nothing
4858
4966
  }
4859
- }, [data]);
4860
- return [currentLocation ?? { name: defaultLocation }, selectCurrentLocation];
4967
+ return { name: defaultLocation };
4968
+ };
4969
+ }
4970
+ function storeLocation(_) {
4971
+ _ && globalThis.localStorage?.setItem(LOCATION_STORAGE_KEY, JSON.stringify(_));
4861
4972
  }
4862
- const hasStoredLocation = () => Boolean(globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY));
4863
- const restoreLocation = () => {
4864
- try {
4865
- const data = globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY);
4866
- return data && JSON.parse(data);
4867
- }
4868
- catch (ex) {
4869
- return null;
4870
- }
4871
- };
4872
- const storeLocation = (_) => {
4873
- try {
4874
- globalThis.localStorage?.setItem(LOCATION_STORAGE_KEY, JSON.stringify(_));
4875
- }
4876
- catch (ex) {
4877
- // Do nothing
4878
- }
4879
- };
4880
4973
 
4881
4974
  var Currency;
4882
4975
  (function (Currency) {
@@ -5018,7 +5111,7 @@
5018
5111
  }
5019
5112
 
5020
5113
  const ExchangeRateTile = JSX(({ className = '', title = 'Курсы обмена валют', button, ...rest }) => {
5021
- const [currentLocation] = useLocation();
5114
+ const currentLocation = useLocationState();
5022
5115
  const exchangeRates = useFetchExchangeRateData(currentLocation);
5023
5116
  const currencyRates = getCurrencyRates(exchangeRates?.exchangeRate?.currencies);
5024
5117
  const currencyRatesBuy = currencyRates.filter((_) => _.buyExchangeRate);
@@ -5557,27 +5650,33 @@
5557
5650
  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" })] }));
5558
5651
  });
5559
5652
 
5560
- const SEARCH_TERM_MIN_LENGTH = 3;
5561
- const LocationDialog = JSX(({ foreignOffices, branches }) => {
5562
- const [currentLocation, selectCurrentLocation] = useLocation(branches?.default);
5653
+ const SelectedLocation = JSX(({ defaultLocation }) => {
5654
+ const currentLocation = useLocationState(defaultLocation);
5563
5655
  const link = useLink();
5564
5656
  const { href } = link({ href: `/branches/${currentLocation.slug}` });
5657
+ 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;
5658
+ });
5659
+
5660
+ const SEARCH_TERM_MIN_LENGTH = 3;
5661
+ const LocationDialog = JSX(({ foreignOffices, branches }) => {
5662
+ const selectLocation = useLocation(branches?.default);
5565
5663
  const [query, setQuery] = useState('');
5566
- const regions = cleanUpRegions(useRegions()).sort((a, b) => a.name.localeCompare(b.name));
5567
- const regionsGroupByLetter = groupBy(regions, regionFirstLetter);
5664
+ const rawRegions = useRegions();
5665
+ const regions = useMemo(() => cleanUpRegions(rawRegions).sort((a, b) => (a.name ?? '').localeCompare(b.name ?? '')), [rawRegions]);
5666
+ const regionsGroupByLetter = useMemo(() => groupBy(regions, regionFirstLetter), [regions]);
5568
5667
  const { close } = useDialogManager();
5569
5668
  const handleChangeLocation = useCallback((region) => {
5570
- selectCurrentLocation(region);
5669
+ selectLocation(region);
5571
5670
  close();
5572
5671
  }, []);
5573
- 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
5672
+ 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
5574
5673
  .filter(({ name }) => name && jaroWinklerDistance(name.toLowerCase())(query.toLowerCase()) >= 0.8)
5575
5674
  .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)] }));
5576
5675
  });
5577
- const regionFirstLetter = (region) => region.name?.charAt(0) || '';
5676
+ const regionFirstLetter = (region) => region.name?.charAt(0) ?? '';
5578
5677
  const cleanUpRegions = (regions) => regions.map((region) => ({
5579
5678
  ...region,
5580
- name: region.name?.replace(/республика|область|край'/gi, '').trim() || '',
5679
+ name: region.name?.replace(/республика|область|край'/gi, '').trim() ?? '',
5581
5680
  }));
5582
5681
 
5583
5682
  const useLocationDialog = (props) => {
@@ -5605,7 +5704,7 @@
5605
5704
 
5606
5705
  const HeaderSecondaryMenu = JSX(({ className, version, ...rest }) => {
5607
5706
  const iconVersion = version === 'transparent' ? 'white' : 'black';
5608
- const [currentLocation] = useLocation(rest?.branches?.default);
5707
+ const currentLocation = useLocationState(rest?.branches?.default);
5609
5708
  const searchDialog = useSearchDialog(rest);
5610
5709
  const locationDialog = useLocationDialog(rest);
5611
5710
  const openSearchDialog = useCallback(() => searchDialog.open(), [searchDialog]);
@@ -6444,7 +6543,7 @@
6444
6543
  designDisabledPeople: (item) => Boolean(item.designDisabledPeople),
6445
6544
  };
6446
6545
  const AtmsMap = JSX(({ descriptionData, className }) => {
6447
- const [currentLocation] = useLocation();
6546
+ const currentLocation = useLocationState();
6448
6547
  const regionCode = currentLocation?.code ?? '000';
6449
6548
  const { data: officesData, isLoad } = useAtms(regionCode);
6450
6549
  return (jsx(OfficesAtmsMapLayout, { className: className, filterItems: filterItems, data: officesData, isLoad: isLoad, initFilterState: INITIAL_FILTRATION_STATE, renderCard: renderAtmCard, getBalloon: getAtmPoint, title: `Банкоматы филиала ${currentLocation?.name}`, descriptionData: descriptionData }));
@@ -6663,7 +6762,7 @@
6663
6762
  };
6664
6763
 
6665
6764
  const OfficesMap = JSX(({ className }) => {
6666
- const [currentLocation] = useLocation();
6765
+ const currentLocation = useLocationState();
6667
6766
  const regionCode = currentLocation?.code ?? '000';
6668
6767
  const { data, isLoad } = useOffices(regionCode);
6669
6768
  return (jsx(OfficesAtmsMapLayout, { className: className, data: data?.branches, isLoad: isLoad, remoteWorkplaces: data?.remoteWorkplaces, renderCard: renderOfficeCard, renderRemoteWorkplaceCard: renderRemoteWorkplaceCard, getBalloon: getOfficePoint, getBalloonRemoteWorkplaces: getRemoteWorkplacePoint, title: `Офисы филиала ${currentLocation?.name}` }));
@@ -7347,7 +7446,7 @@
7347
7446
  onClose && onClose(dialogs[dialogs.length - 1]);
7348
7447
  pop();
7349
7448
  }, [dialogs, onClose]);
7350
- useEffect(() => defaultEventBus.subscribe('dialog', (action) => {
7449
+ useEffect(() => defaultEventBus.observable.subscribe('dialog', (action) => {
7351
7450
  switch (action.type) {
7352
7451
  case 'open':
7353
7452
  push(action);
@@ -7404,7 +7503,7 @@
7404
7503
  const close = useCallback(() => {
7405
7504
  setPopup(null);
7406
7505
  }, []);
7407
- useEffect(() => defaultEventBus.subscribe('popup', (action) => {
7506
+ useEffect(() => defaultEventBus.observable.subscribe('popup', (action) => {
7408
7507
  switch (action.type) {
7409
7508
  case 'open':
7410
7509
  case 'update':
@@ -7459,7 +7558,7 @@
7459
7558
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
7460
7559
  });
7461
7560
 
7462
- const packageVersion = "0.14.594";
7561
+ const packageVersion = "0.14.596";
7463
7562
 
7464
7563
  exports.Blocks = Blocks;
7465
7564
  exports.ContentPage = ContentPage;