@redneckz/wildless-cms-uni-blocks 0.14.600 → 0.14.601

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 (336) hide show
  1. package/bundle/EventBus/EventBus.d.ts +4 -17
  2. package/bundle/EventBus/defaultEventBus.d.ts +13 -2
  3. package/bundle/EventBus/useLatestEvent.d.ts +2 -0
  4. package/bundle/bundle.umd.js +89 -131
  5. package/bundle/bundle.umd.min.js +1 -1
  6. package/bundle/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
  7. package/bundle/hooks/useLocation.d.ts +1 -2
  8. package/bundle/ui-kit/Foldable/Foldable.d.ts +1 -11
  9. package/dist/EventBus/EventBus.d.ts +4 -17
  10. package/dist/EventBus/EventBus.js +10 -29
  11. package/dist/EventBus/EventBus.js.map +1 -1
  12. package/dist/EventBus/defaultEventBus.d.ts +13 -2
  13. package/dist/EventBus/defaultEventBus.js.map +1 -1
  14. package/dist/EventBus/useLatestEvent.d.ts +2 -0
  15. package/dist/EventBus/useLatestEvent.js +11 -0
  16. package/dist/EventBus/useLatestEvent.js.map +1 -0
  17. package/dist/components/CarouselTariffsCard/CarouselTariffsCard.js +25 -11
  18. package/dist/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
  19. package/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
  20. package/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.js +2 -0
  21. package/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +1 -0
  22. package/dist/components/ExchangeRateTile/ExchangeRateTile.js +1 -1
  23. package/dist/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
  24. package/dist/components/Header/HeaderSecondaryMenu.js +1 -1
  25. package/dist/components/Header/HeaderSecondaryMenu.js.map +1 -1
  26. package/dist/components/OfficesAtmsMap/AtmsMap.js +1 -1
  27. package/dist/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
  28. package/dist/components/OfficesAtmsMap/OfficesMap.js +1 -1
  29. package/dist/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
  30. package/dist/components/StickyBottomMenu/BurgerMenuDialog.js +1 -1
  31. package/dist/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
  32. package/dist/hooks/useLocation.d.ts +1 -2
  33. package/dist/hooks/useLocation.js +33 -27
  34. package/dist/hooks/useLocation.js.map +1 -1
  35. package/dist/hooks/useRegions.js +1 -3
  36. package/dist/hooks/useRegions.js.map +1 -1
  37. package/dist/ui-kit/DialogManager/useDialogManager.js +3 -3
  38. package/dist/ui-kit/DialogManager/useDialogManager.js.map +1 -1
  39. package/dist/ui-kit/DialogManager/useDialogsList.js +1 -1
  40. package/dist/ui-kit/DialogManager/useDialogsList.js.map +1 -1
  41. package/dist/ui-kit/Foldable/Foldable.d.ts +1 -11
  42. package/dist/ui-kit/Foldable/Foldable.js +2 -10
  43. package/dist/ui-kit/Foldable/Foldable.js.map +1 -1
  44. package/dist/ui-kit/FormField/constants.js +0 -1
  45. package/dist/ui-kit/FormField/constants.js.map +1 -1
  46. package/dist/ui-kit/FormField/getValidation.js +0 -1
  47. package/dist/ui-kit/FormField/getValidation.js.map +1 -1
  48. package/dist/ui-kit/LocationDialog/LocationDialog.js +12 -9
  49. package/dist/ui-kit/LocationDialog/LocationDialog.js.map +1 -1
  50. package/dist/ui-kit/PopupManager/PopupManager.js +1 -1
  51. package/dist/ui-kit/PopupManager/PopupManager.js.map +1 -1
  52. package/dist/ui-kit/PopupManager/usePopupManager.js +3 -3
  53. package/dist/ui-kit/PopupManager/usePopupManager.js.map +1 -1
  54. package/lib/EventBus/EventBus.d.ts +4 -17
  55. package/lib/EventBus/EventBus.js +10 -29
  56. package/lib/EventBus/EventBus.js.map +1 -1
  57. package/lib/EventBus/defaultEventBus.d.ts +13 -2
  58. package/lib/EventBus/defaultEventBus.js.map +1 -1
  59. package/lib/EventBus/useLatestEvent.d.ts +2 -0
  60. package/lib/EventBus/useLatestEvent.js +8 -0
  61. package/lib/EventBus/useLatestEvent.js.map +1 -0
  62. package/lib/common.css +1 -1
  63. package/lib/components/CarouselTariffsCard/CarouselTariffsCard.js +26 -12
  64. package/lib/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
  65. package/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
  66. package/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js +2 -0
  67. package/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +1 -0
  68. package/lib/components/ExchangeRateTile/ExchangeRateTile.js +2 -2
  69. package/lib/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
  70. package/lib/components/Header/HeaderSecondaryMenu.js +2 -2
  71. package/lib/components/Header/HeaderSecondaryMenu.js.map +1 -1
  72. package/lib/components/OfficesAtmsMap/AtmsMap.js +2 -2
  73. package/lib/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
  74. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +1 -1
  75. package/lib/components/OfficesAtmsMap/OfficesMap.js +2 -2
  76. package/lib/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
  77. package/lib/components/StickyBottomMenu/BurgerMenuDialog.js +2 -2
  78. package/lib/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
  79. package/lib/hooks/useLocation.d.ts +1 -2
  80. package/lib/hooks/useLocation.js +33 -26
  81. package/lib/hooks/useLocation.js.map +1 -1
  82. package/lib/hooks/useRegions.js +1 -3
  83. package/lib/hooks/useRegions.js.map +1 -1
  84. package/lib/ui-kit/DialogManager/useDialogManager.js +3 -3
  85. package/lib/ui-kit/DialogManager/useDialogManager.js.map +1 -1
  86. package/lib/ui-kit/DialogManager/useDialogsList.js +1 -1
  87. package/lib/ui-kit/DialogManager/useDialogsList.js.map +1 -1
  88. package/lib/ui-kit/Foldable/Foldable.d.ts +1 -11
  89. package/lib/ui-kit/Foldable/Foldable.js +2 -10
  90. package/lib/ui-kit/Foldable/Foldable.js.map +1 -1
  91. package/lib/ui-kit/FormField/constants.js +0 -1
  92. package/lib/ui-kit/FormField/constants.js.map +1 -1
  93. package/lib/ui-kit/FormField/getValidation.js +0 -1
  94. package/lib/ui-kit/FormField/getValidation.js.map +1 -1
  95. package/lib/ui-kit/LocationDialog/LocationDialog.js +13 -10
  96. package/lib/ui-kit/LocationDialog/LocationDialog.js.map +1 -1
  97. package/lib/ui-kit/PopupManager/PopupManager.js +1 -1
  98. package/lib/ui-kit/PopupManager/PopupManager.js.map +1 -1
  99. package/lib/ui-kit/PopupManager/usePopupManager.js +3 -3
  100. package/lib/ui-kit/PopupManager/usePopupManager.js.map +1 -1
  101. package/mobile/bundle/EventBus/EventBus.d.ts +4 -17
  102. package/mobile/bundle/EventBus/defaultEventBus.d.ts +13 -2
  103. package/mobile/bundle/EventBus/useLatestEvent.d.ts +2 -0
  104. package/mobile/bundle/bundle.umd.js +89 -131
  105. package/mobile/bundle/bundle.umd.min.js +1 -1
  106. package/mobile/bundle/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
  107. package/mobile/bundle/hooks/useLocation.d.ts +1 -2
  108. package/mobile/bundle/ui-kit/Foldable/Foldable.d.ts +1 -11
  109. package/mobile/dist/EventBus/EventBus.d.ts +4 -17
  110. package/mobile/dist/EventBus/EventBus.js +10 -29
  111. package/mobile/dist/EventBus/EventBus.js.map +1 -1
  112. package/mobile/dist/EventBus/defaultEventBus.d.ts +13 -2
  113. package/mobile/dist/EventBus/defaultEventBus.js.map +1 -1
  114. package/mobile/dist/EventBus/useLatestEvent.d.ts +2 -0
  115. package/mobile/dist/EventBus/useLatestEvent.js +11 -0
  116. package/mobile/dist/EventBus/useLatestEvent.js.map +1 -0
  117. package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCard.js +25 -11
  118. package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
  119. package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
  120. package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.js +2 -0
  121. package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +1 -0
  122. package/mobile/dist/components/ExchangeRateTile/ExchangeRateTile.js +1 -1
  123. package/mobile/dist/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
  124. package/mobile/dist/components/Header/HeaderSecondaryMenu.js +1 -1
  125. package/mobile/dist/components/Header/HeaderSecondaryMenu.js.map +1 -1
  126. package/mobile/dist/components/OfficesAtmsMap/AtmsMap.js +1 -1
  127. package/mobile/dist/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
  128. package/mobile/dist/components/OfficesAtmsMap/OfficesMap.js +1 -1
  129. package/mobile/dist/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
  130. package/mobile/dist/components/StickyBottomMenu/BurgerMenuDialog.js +1 -1
  131. package/mobile/dist/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
  132. package/mobile/dist/hooks/useLocation.d.ts +1 -2
  133. package/mobile/dist/hooks/useLocation.js +33 -27
  134. package/mobile/dist/hooks/useLocation.js.map +1 -1
  135. package/mobile/dist/hooks/useRegions.js +1 -3
  136. package/mobile/dist/hooks/useRegions.js.map +1 -1
  137. package/mobile/dist/ui-kit/DialogManager/useDialogManager.js +3 -3
  138. package/mobile/dist/ui-kit/DialogManager/useDialogManager.js.map +1 -1
  139. package/mobile/dist/ui-kit/DialogManager/useDialogsList.js +1 -1
  140. package/mobile/dist/ui-kit/DialogManager/useDialogsList.js.map +1 -1
  141. package/mobile/dist/ui-kit/Foldable/Foldable.d.ts +1 -11
  142. package/mobile/dist/ui-kit/Foldable/Foldable.js +2 -10
  143. package/mobile/dist/ui-kit/Foldable/Foldable.js.map +1 -1
  144. package/mobile/dist/ui-kit/FormField/constants.js +0 -1
  145. package/mobile/dist/ui-kit/FormField/constants.js.map +1 -1
  146. package/mobile/dist/ui-kit/FormField/getValidation.js +0 -1
  147. package/mobile/dist/ui-kit/FormField/getValidation.js.map +1 -1
  148. package/mobile/dist/ui-kit/LocationDialog/LocationDialog.js +12 -9
  149. package/mobile/dist/ui-kit/LocationDialog/LocationDialog.js.map +1 -1
  150. package/mobile/dist/ui-kit/PopupManager/PopupManager.js +1 -1
  151. package/mobile/dist/ui-kit/PopupManager/PopupManager.js.map +1 -1
  152. package/mobile/dist/ui-kit/PopupManager/usePopupManager.js +3 -3
  153. package/mobile/dist/ui-kit/PopupManager/usePopupManager.js.map +1 -1
  154. package/mobile/lib/EventBus/EventBus.d.ts +4 -17
  155. package/mobile/lib/EventBus/EventBus.js +10 -29
  156. package/mobile/lib/EventBus/EventBus.js.map +1 -1
  157. package/mobile/lib/EventBus/defaultEventBus.d.ts +13 -2
  158. package/mobile/lib/EventBus/defaultEventBus.js.map +1 -1
  159. package/mobile/lib/EventBus/useLatestEvent.d.ts +2 -0
  160. package/mobile/lib/EventBus/useLatestEvent.js +8 -0
  161. package/mobile/lib/EventBus/useLatestEvent.js.map +1 -0
  162. package/mobile/lib/common.css +1 -1
  163. package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCard.js +26 -12
  164. package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
  165. package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
  166. package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js +2 -0
  167. package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +1 -0
  168. package/mobile/lib/components/ExchangeRateTile/ExchangeRateTile.js +2 -2
  169. package/mobile/lib/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
  170. package/mobile/lib/components/Header/HeaderSecondaryMenu.js +2 -2
  171. package/mobile/lib/components/Header/HeaderSecondaryMenu.js.map +1 -1
  172. package/mobile/lib/components/OfficesAtmsMap/AtmsMap.js +2 -2
  173. package/mobile/lib/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
  174. package/mobile/lib/components/OfficesAtmsMap/OfficesMap.js +2 -2
  175. package/mobile/lib/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
  176. package/mobile/lib/components/StickyBottomMenu/BurgerMenuDialog.js +2 -2
  177. package/mobile/lib/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
  178. package/mobile/lib/hooks/useLocation.d.ts +1 -2
  179. package/mobile/lib/hooks/useLocation.js +33 -26
  180. package/mobile/lib/hooks/useLocation.js.map +1 -1
  181. package/mobile/lib/hooks/useRegions.js +1 -3
  182. package/mobile/lib/hooks/useRegions.js.map +1 -1
  183. package/mobile/lib/ui-kit/DialogManager/useDialogManager.js +3 -3
  184. package/mobile/lib/ui-kit/DialogManager/useDialogManager.js.map +1 -1
  185. package/mobile/lib/ui-kit/DialogManager/useDialogsList.js +1 -1
  186. package/mobile/lib/ui-kit/DialogManager/useDialogsList.js.map +1 -1
  187. package/mobile/lib/ui-kit/Foldable/Foldable.d.ts +1 -11
  188. package/mobile/lib/ui-kit/Foldable/Foldable.js +2 -10
  189. package/mobile/lib/ui-kit/Foldable/Foldable.js.map +1 -1
  190. package/mobile/lib/ui-kit/FormField/constants.js +0 -1
  191. package/mobile/lib/ui-kit/FormField/constants.js.map +1 -1
  192. package/mobile/lib/ui-kit/FormField/getValidation.js +0 -1
  193. package/mobile/lib/ui-kit/FormField/getValidation.js.map +1 -1
  194. package/mobile/lib/ui-kit/LocationDialog/LocationDialog.js +13 -10
  195. package/mobile/lib/ui-kit/LocationDialog/LocationDialog.js.map +1 -1
  196. package/mobile/lib/ui-kit/PopupManager/PopupManager.js +1 -1
  197. package/mobile/lib/ui-kit/PopupManager/PopupManager.js.map +1 -1
  198. package/mobile/lib/ui-kit/PopupManager/usePopupManager.js +3 -3
  199. package/mobile/lib/ui-kit/PopupManager/usePopupManager.js.map +1 -1
  200. package/mobile/src/EventBus/EventBus.ts +15 -51
  201. package/mobile/src/EventBus/defaultEventBus.ts +14 -2
  202. package/mobile/src/EventBus/useLatestEvent.ts +16 -0
  203. package/mobile/src/components/CarouselTariffsCard/CarouselTariffsCard.tsx +66 -23
  204. package/mobile/src/components/CarouselTariffsCard/CarouselTariffsCardAction.ts +6 -0
  205. package/mobile/src/components/ExchangeRateTile/ExchangeRateTile.tsx +2 -2
  206. package/mobile/src/components/Header/HeaderSecondaryMenu.tsx +2 -2
  207. package/mobile/src/components/OfficesAtmsMap/AtmsMap.tsx +3 -2
  208. package/mobile/src/components/OfficesAtmsMap/OfficesMap.tsx +2 -2
  209. package/mobile/src/components/StickyBottomMenu/BurgerMenuDialog.tsx +2 -2
  210. package/mobile/src/hooks/useLocation.ts +44 -30
  211. package/mobile/src/hooks/useRegions.ts +1 -4
  212. package/mobile/src/ui-kit/DialogManager/useDialogManager.ts +3 -3
  213. package/mobile/src/ui-kit/DialogManager/useDialogsList.ts +1 -1
  214. package/mobile/src/ui-kit/Foldable/Foldable.tsx +5 -21
  215. package/mobile/src/ui-kit/FormField/constants.tsx +0 -1
  216. package/mobile/src/ui-kit/FormField/getValidation.tsx +0 -1
  217. package/mobile/src/ui-kit/LocationDialog/LocationDialog.tsx +25 -13
  218. package/mobile/src/ui-kit/PopupManager/PopupManager.tsx +1 -1
  219. package/mobile/src/ui-kit/PopupManager/usePopupManager.tsx +3 -3
  220. package/package.json +1 -1
  221. package/src/EventBus/EventBus.ts +15 -51
  222. package/src/EventBus/defaultEventBus.ts +14 -2
  223. package/src/EventBus/useLatestEvent.ts +16 -0
  224. package/src/components/CarouselTariffsCard/CarouselTariffsCard.tsx +66 -23
  225. package/src/components/CarouselTariffsCard/CarouselTariffsCardAction.ts +6 -0
  226. package/src/components/ExchangeRateTile/ExchangeRateTile.tsx +2 -2
  227. package/src/components/Header/HeaderSecondaryMenu.tsx +2 -2
  228. package/src/components/OfficesAtmsMap/AtmsMap.tsx +3 -2
  229. package/src/components/OfficesAtmsMap/OfficesMap.tsx +2 -2
  230. package/src/components/StickyBottomMenu/BurgerMenuDialog.tsx +2 -2
  231. package/src/hooks/useLocation.ts +44 -30
  232. package/src/hooks/useRegions.ts +1 -4
  233. package/src/ui-kit/DialogManager/useDialogManager.ts +3 -3
  234. package/src/ui-kit/DialogManager/useDialogsList.ts +1 -1
  235. package/src/ui-kit/Foldable/Foldable.tsx +5 -21
  236. package/src/ui-kit/FormField/constants.tsx +0 -1
  237. package/src/ui-kit/FormField/getValidation.tsx +0 -1
  238. package/src/ui-kit/LocationDialog/LocationDialog.tsx +25 -13
  239. package/src/ui-kit/PopupManager/PopupManager.tsx +1 -1
  240. package/src/ui-kit/PopupManager/usePopupManager.tsx +3 -3
  241. package/bundle/EventBus/useSubject.d.ts +0 -2
  242. package/bundle/EventBus/useSubjectState.d.ts +0 -2
  243. package/bundle/components/CarouselTariffsCard/CardCellsSection.d.ts +0 -9
  244. package/bundle/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +0 -9
  245. package/bundle/hooks/useReducer.d.ts +0 -4
  246. package/bundle/ui-kit/LocationDialog/SelectedLocation.d.ts +0 -5
  247. package/dist/EventBus/useSubject.d.ts +0 -2
  248. package/dist/EventBus/useSubject.js +0 -17
  249. package/dist/EventBus/useSubject.js.map +0 -1
  250. package/dist/EventBus/useSubjectState.d.ts +0 -2
  251. package/dist/EventBus/useSubjectState.js +0 -10
  252. package/dist/EventBus/useSubjectState.js.map +0 -1
  253. package/dist/components/CarouselTariffsCard/CardCellsSection.d.ts +0 -9
  254. package/dist/components/CarouselTariffsCard/CardCellsSection.js +0 -18
  255. package/dist/components/CarouselTariffsCard/CardCellsSection.js.map +0 -1
  256. package/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +0 -9
  257. package/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.js +0 -5
  258. package/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.js.map +0 -1
  259. package/dist/hooks/useReducer.d.ts +0 -4
  260. package/dist/hooks/useReducer.js +0 -12
  261. package/dist/hooks/useReducer.js.map +0 -1
  262. package/dist/ui-kit/LocationDialog/SelectedLocation.d.ts +0 -5
  263. package/dist/ui-kit/LocationDialog/SelectedLocation.js +0 -15
  264. package/dist/ui-kit/LocationDialog/SelectedLocation.js.map +0 -1
  265. package/lib/EventBus/useSubject.d.ts +0 -2
  266. package/lib/EventBus/useSubject.js +0 -14
  267. package/lib/EventBus/useSubject.js.map +0 -1
  268. package/lib/EventBus/useSubjectState.d.ts +0 -2
  269. package/lib/EventBus/useSubjectState.js +0 -7
  270. package/lib/EventBus/useSubjectState.js.map +0 -1
  271. package/lib/components/CarouselTariffsCard/CardCellsSection.d.ts +0 -9
  272. package/lib/components/CarouselTariffsCard/CardCellsSection.js +0 -16
  273. package/lib/components/CarouselTariffsCard/CardCellsSection.js.map +0 -1
  274. package/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +0 -9
  275. package/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.js +0 -3
  276. package/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.js.map +0 -1
  277. package/lib/hooks/useReducer.d.ts +0 -4
  278. package/lib/hooks/useReducer.js +0 -9
  279. package/lib/hooks/useReducer.js.map +0 -1
  280. package/lib/ui-kit/LocationDialog/SelectedLocation.d.ts +0 -5
  281. package/lib/ui-kit/LocationDialog/SelectedLocation.js +0 -13
  282. package/lib/ui-kit/LocationDialog/SelectedLocation.js.map +0 -1
  283. package/mobile/bundle/EventBus/useSubject.d.ts +0 -2
  284. package/mobile/bundle/EventBus/useSubjectState.d.ts +0 -2
  285. package/mobile/bundle/components/CarouselTariffsCard/CardCellsSection.d.ts +0 -9
  286. package/mobile/bundle/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +0 -9
  287. package/mobile/bundle/hooks/useReducer.d.ts +0 -4
  288. package/mobile/bundle/ui-kit/LocationDialog/SelectedLocation.d.ts +0 -5
  289. package/mobile/dist/EventBus/useSubject.d.ts +0 -2
  290. package/mobile/dist/EventBus/useSubject.js +0 -17
  291. package/mobile/dist/EventBus/useSubject.js.map +0 -1
  292. package/mobile/dist/EventBus/useSubjectState.d.ts +0 -2
  293. package/mobile/dist/EventBus/useSubjectState.js +0 -10
  294. package/mobile/dist/EventBus/useSubjectState.js.map +0 -1
  295. package/mobile/dist/components/CarouselTariffsCard/CardCellsSection.d.ts +0 -9
  296. package/mobile/dist/components/CarouselTariffsCard/CardCellsSection.js +0 -18
  297. package/mobile/dist/components/CarouselTariffsCard/CardCellsSection.js.map +0 -1
  298. package/mobile/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +0 -9
  299. package/mobile/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.js +0 -5
  300. package/mobile/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.js.map +0 -1
  301. package/mobile/dist/hooks/useReducer.d.ts +0 -4
  302. package/mobile/dist/hooks/useReducer.js +0 -12
  303. package/mobile/dist/hooks/useReducer.js.map +0 -1
  304. package/mobile/dist/ui-kit/LocationDialog/SelectedLocation.d.ts +0 -5
  305. package/mobile/dist/ui-kit/LocationDialog/SelectedLocation.js +0 -15
  306. package/mobile/dist/ui-kit/LocationDialog/SelectedLocation.js.map +0 -1
  307. package/mobile/lib/EventBus/useSubject.d.ts +0 -2
  308. package/mobile/lib/EventBus/useSubject.js +0 -14
  309. package/mobile/lib/EventBus/useSubject.js.map +0 -1
  310. package/mobile/lib/EventBus/useSubjectState.d.ts +0 -2
  311. package/mobile/lib/EventBus/useSubjectState.js +0 -7
  312. package/mobile/lib/EventBus/useSubjectState.js.map +0 -1
  313. package/mobile/lib/components/CarouselTariffsCard/CardCellsSection.d.ts +0 -9
  314. package/mobile/lib/components/CarouselTariffsCard/CardCellsSection.js +0 -16
  315. package/mobile/lib/components/CarouselTariffsCard/CardCellsSection.js.map +0 -1
  316. package/mobile/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +0 -9
  317. package/mobile/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.js +0 -3
  318. package/mobile/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.js.map +0 -1
  319. package/mobile/lib/hooks/useReducer.d.ts +0 -4
  320. package/mobile/lib/hooks/useReducer.js +0 -9
  321. package/mobile/lib/hooks/useReducer.js.map +0 -1
  322. package/mobile/lib/ui-kit/LocationDialog/SelectedLocation.d.ts +0 -5
  323. package/mobile/lib/ui-kit/LocationDialog/SelectedLocation.js +0 -13
  324. package/mobile/lib/ui-kit/LocationDialog/SelectedLocation.js.map +0 -1
  325. package/mobile/src/EventBus/useSubject.ts +0 -19
  326. package/mobile/src/EventBus/useSubjectState.ts +0 -13
  327. package/mobile/src/components/CarouselTariffsCard/CardCellsSection.tsx +0 -54
  328. package/mobile/src/components/CarouselTariffsCard/carouselTariffsCardEventBus.ts +0 -11
  329. package/mobile/src/hooks/useReducer.ts +0 -21
  330. package/mobile/src/ui-kit/LocationDialog/SelectedLocation.tsx +0 -27
  331. package/src/EventBus/useSubject.ts +0 -19
  332. package/src/EventBus/useSubjectState.ts +0 -13
  333. package/src/components/CarouselTariffsCard/CardCellsSection.tsx +0 -54
  334. package/src/components/CarouselTariffsCard/carouselTariffsCardEventBus.ts +0 -11
  335. package/src/hooks/useReducer.ts +0 -21
  336. package/src/ui-kit/LocationDialog/SelectedLocation.tsx +0 -27
@@ -1,72 +1,36 @@
1
- export type Subscriber<Event> = (ev: Event) => void;
2
-
3
- type Cleanup = () => void;
4
-
5
- export interface EventBusObservable<EM extends Record<string, any>> {
6
- subscribe<K extends keyof EM>(type: K, listener: Subscriber<EM[K]>): Cleanup;
7
- }
8
-
9
- export interface EventBusEmitter<EM extends Record<string, any>> {
10
- fire<K extends keyof EM>(type: K, event: EM[K]): void;
11
- subject<K extends keyof EM>(type: K, event: EM[K]): Cleanup;
12
- }
13
-
14
- export class EventBus<EM extends Record<string, any>>
15
- implements EventBusObservable<EM>, EventBusEmitter<EM>
16
- {
17
- private subscribersMap: Partial<Record<keyof EM, Subscriber<EM[keyof EM]>[]>> = {};
1
+ export class EventBus<EM extends Record<string, any>> {
2
+ private subscribers: Partial<Record<keyof EM, Array<(ev: EM[keyof EM]) => void>>> = {};
18
3
  private subjectsStateMap: Partial<EM> = {};
19
4
 
20
- readonly emitter: EventBusEmitter<EM> = this;
21
- readonly observable: EventBusObservable<EM> = this;
5
+ subscribe<K extends keyof EM>(type: K, listener: (event: EM[K]) => void) {
6
+ this.subscribers[type] = (this.subscribers[type] || []).concat(
7
+ listener as (ev: EM[keyof EM]) => void,
8
+ );
22
9
 
23
- subscribe<K extends keyof EM>(type: K, listener: Subscriber<EM[K]>): Cleanup {
24
- this.subscribersMap[type] ||= [];
25
- this.subscribersMap[type]?.push(listener as Subscriber<EM[keyof EM]>);
26
-
27
- this.fireSubscribers([listener], this.subjectsStateMap[type]);
10
+ const latestEvent = this.subjectsStateMap[type];
11
+ if (latestEvent) {
12
+ listener(latestEvent as EM[K]);
13
+ }
28
14
 
29
15
  return () => {
30
16
  this.unsubscribe(type, listener);
31
17
  };
32
18
  }
33
19
 
34
- private unsubscribe<K extends keyof EM>(type: K, listener: Subscriber<EM[K]>) {
35
- const index = this.subscribersMap[type]?.indexOf(listener as Subscriber<EM[keyof EM]>);
36
- if (index && index !== -1) {
37
- this.subscribersMap[type]?.splice(index, 1);
38
- }
20
+ private unsubscribe<K extends keyof EM>(type: K, listener: (event: EM[K]) => void) {
21
+ this.subscribers[type] = this.subscribers[type]?.filter((s) => s !== listener);
39
22
  }
40
23
 
41
24
  fire<K extends keyof EM>(type: K, event: EM[K]) {
42
25
  const isSubjectDeclared = type in this.subjectsStateMap;
43
26
  if (isSubjectDeclared) {
44
- this.subject(type, event);
45
- } else {
46
- this.fireSubscribers(this.subscribersMap[type], event);
47
- }
48
- }
49
-
50
- subject<K extends keyof EM>(type: K, event: EM[K]): Cleanup {
51
- if (this.subjectsStateMap[type] !== event) {
52
27
  this.subjectsStateMap[type] = event;
53
- this.fireSubscribers(this.subscribersMap[type], event);
54
28
  }
55
29
 
56
- return () => {
57
- delete this.subjectsStateMap[type];
58
- };
30
+ this.subscribers[type]?.forEach((s) => s(event));
59
31
  }
60
32
 
61
- private fireSubscribers<K extends keyof EM>(
62
- subscribers: Subscriber<EM[K]>[] | undefined,
63
- event: EM[K] | undefined,
64
- ) {
65
- if (!subscribers || !event) {
66
- return;
67
- }
68
- for (const _ of subscribers) {
69
- _(event);
70
- }
33
+ subject<K extends keyof EM>(type: K, event: EM[K]) {
34
+ this.subjectsStateMap[type] = event;
71
35
  }
72
36
  }
@@ -1,10 +1,22 @@
1
+ import { type CarouselTariffsCardAction } from '../components/CarouselTariffsCard/CarouselTariffsCardAction';
2
+ import { type Tab } from '../components/TabsLayout/TabsLayoutContent';
1
3
  import { type Region } from '../hooks/useRegions';
2
4
  import { type DialogAction } from '../ui-kit/DialogManager/DialogAction';
3
5
  import { type PopupAction } from '../ui-kit/PopupManager/PopupAction';
4
6
  import { EventBus } from './EventBus';
5
7
 
6
- export const defaultEventBus = new EventBus<{
8
+ interface TabActivationEvent {
9
+ type?: Tab['type'];
10
+ groupName?: string;
11
+ label?: string;
12
+ }
13
+
14
+ interface GlobalEventMap {
7
15
  location: Region;
8
16
  dialog: DialogAction;
9
17
  popup: PopupAction;
10
- }>();
18
+ tab: TabActivationEvent;
19
+ fold: CarouselTariffsCardAction;
20
+ }
21
+
22
+ export const defaultEventBus = new EventBus<GlobalEventMap>();
@@ -0,0 +1,16 @@
1
+ import { useCallback, useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { type EventBus } from './EventBus';
3
+
4
+ export const useLatestEvent = <EM extends Record<string, any>, K extends keyof EM>(
5
+ eventBus: EventBus<EM>,
6
+ type: K,
7
+ initialEvent?: EM[K],
8
+ ): [EM[K] | null, (_: EM[K]) => void] => {
9
+ const [latestEvent, setLatestEvent] = useState<EM[K] | null>(initialEvent || null);
10
+
11
+ useEffect(() => eventBus.subscribe(type, (_) => setLatestEvent(_)), [eventBus, type]);
12
+
13
+ const fireEvent = useCallback((_: EM[K]) => eventBus.fire(type, _), [eventBus, type]);
14
+
15
+ return [latestEvent, fireEvent];
16
+ };
@@ -1,22 +1,28 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { useCallback } from '@redneckz/uni-jsx/lib/hooks';
3
- import { useSubjectState } from '../../EventBus/useSubjectState';
2
+ import { useEffect, useState } from '@redneckz/uni-jsx/lib/hooks';
3
+ import { defaultEventBus } from '../../EventBus/defaultEventBus';
4
+ import { type AspectsDef } from '../../model/AspectsProps';
5
+ import { type Slot } from '../../model/ContentPageDef';
6
+ import { type VNode } from '../../model/VNode';
4
7
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
8
+ import { Foldable } from '../../ui-kit/Foldable/Foldable';
9
+ import { FoldableSection } from '../../ui-kit/Foldable/FoldableSection';
5
10
  import { Heading } from '../../ui-kit/Heading/Heading';
11
+ import { Icon } from '../../ui-kit/Icon/Icon';
6
12
  import { Img } from '../../ui-kit/Img/Img';
7
13
  import { LinkButton } from '../../ui-kit/LinkButton/LinkButton';
8
14
  import { type UniBlockProps } from '../../UniBlock/UniBlockProps';
15
+ import { getAspectsAttributes } from '../../utils/dataAttributes';
9
16
  import { isIcon } from '../../utils/isIcon';
10
17
  import { style } from '../../utils/style';
11
- import { CardCellsSection } from './CardCellsSection';
12
18
  import { type CarouselTariffsCardContent } from './CarouselTariffsCardContent';
13
- import { carouselTariffsCardEventBus } from './carouselTariffsCardEventBus';
19
+ import { renderCardInfo } from './renderCardInfo';
14
20
 
15
21
  export interface CarouselTariffsCardProps extends CarouselTariffsCardContent, UniBlockProps {}
16
22
 
17
23
  export const CarouselTariffsCard = JSX<CarouselTariffsCardProps>(
18
24
  ({
19
- className,
25
+ className = '',
20
26
  title,
21
27
  align = 'text-center',
22
28
  icon,
@@ -27,20 +33,22 @@ export const CarouselTariffsCard = JSX<CarouselTariffsCardProps>(
27
33
  data,
28
34
  ...rest
29
35
  }) => {
30
- const { isUnfolded, parent: firedParent } = useSubjectState(
31
- carouselTariffsCardEventBus.observable,
32
- 'fold',
33
- {},
34
- );
35
- const isVisible = isUnfolded && firedParent === options?.parent;
36
+ const cellsNode = cardCells.map(renderCardInfo);
37
+
38
+ const [visibleCells, hiddenCells] =
39
+ visibleCellsCount > 0
40
+ ? [cellsNode.slice(0, visibleCellsCount), cellsNode.slice(visibleCellsCount)]
41
+ : [cellsNode, []];
42
+ const [isVisible, setIsVisible] = useState(false);
36
43
 
37
- const toggle = useCallback(
44
+ useEffect(
38
45
  () =>
39
- carouselTariffsCardEventBus.emitter.fire('fold', {
40
- isUnfolded: !isVisible,
41
- parent: options?.parent,
46
+ defaultEventBus.subscribe('fold', (event) => {
47
+ if (options?.parent !== undefined && event.parent === options?.parent) {
48
+ setIsVisible(event.isUnfolded);
49
+ }
42
50
  }),
43
- [isVisible, options?.parent],
51
+ [options?.parent],
44
52
  );
45
53
 
46
54
  return (
@@ -54,14 +62,49 @@ export const CarouselTariffsCard = JSX<CarouselTariffsCardProps>(
54
62
  <Heading className={style('pt-xs', align)} headingType="h5" title={title} />
55
63
  ) : null}
56
64
  {button?.text ? <LinkButton className="w-full mt-m mb-lg" {...button} /> : null}
57
- <CardCellsSection
58
- cardCells={cardCells}
59
- visibleCellsCount={visibleCellsCount}
60
- isUnfolded={isVisible}
61
- data={data}
62
- onToggle={toggle}
63
- />
65
+ {hiddenCells.length ? (
66
+ <Foldable
67
+ renderFoldableSection={() => (
68
+ <div>
69
+ {visibleCells}
70
+ <FoldableSection isUnfolded={isVisible}>{hiddenCells}</FoldableSection>
71
+ </div>
72
+ )}
73
+ renderFoldButton={
74
+ cardCells.length >= visibleCellsCount
75
+ ? renderFoldButton(options?.parent, data, isVisible)
76
+ : null
77
+ }
78
+ />
79
+ ) : (
80
+ <div>{visibleCells}</div>
81
+ )}
64
82
  </BlockWrapper>
65
83
  );
66
84
  },
67
85
  );
86
+
87
+ const renderFoldButton =
88
+ (parent?: Slot, data?: AspectsDef[], isUnfolded = false) =>
89
+ (): VNode =>
90
+ (
91
+ <button
92
+ className="w-full cursor-pointer text-primary-main pt-lg flex justify-between items-center"
93
+ onClick={() => {
94
+ if (parent !== undefined) {
95
+ defaultEventBus.fire('fold', { type: 'fold', isUnfolded: !isUnfolded, parent });
96
+ }
97
+ }}
98
+ type="button"
99
+ // eslint-disable-next-line react/jsx-props-no-spreading
100
+ {...(isUnfolded ? getAspectsAttributes(data) : {})}
101
+ >
102
+ <div>{isUnfolded ? 'Скрыть' : 'Подробнее о тарифе'}</div>
103
+ <Icon
104
+ className="text-primary-text"
105
+ name={isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon'}
106
+ width="16"
107
+ height="16"
108
+ />
109
+ </button>
110
+ );
@@ -0,0 +1,6 @@
1
+ import { type Slot } from './../../model/ContentPageDef';
2
+ export type CarouselTariffsCardAction = {
3
+ type: 'fold';
4
+ isUnfolded: boolean;
5
+ parent: Slot;
6
+ };
@@ -1,5 +1,5 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { useLocationState } from '../../hooks/useLocation';
2
+ import { useLocation } from '../../hooks/useLocation';
3
3
  import { BaseTile } from '../../ui-kit/BaseTile/BaseTile';
4
4
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
5
5
  import { Heading } from '../../ui-kit/Heading/Heading';
@@ -19,7 +19,7 @@ export interface ExchangeRateTileProps extends ExchangeRateTileContent, UniBlock
19
19
 
20
20
  export const ExchangeRateTile = JSX<ExchangeRateTileProps>(
21
21
  ({ className = '', title = 'Курсы обмена валют', button, ...rest }) => {
22
- const currentLocation = useLocationState();
22
+ const [currentLocation] = useLocation();
23
23
  const exchangeRates = useFetchExchangeRateData(currentLocation);
24
24
 
25
25
  const currencyRates = getCurrencyRates(exchangeRates?.exchangeRate?.currencies);
@@ -4,7 +4,7 @@ import { type SearchHeaderProps } from '../../data/CommonData';
4
4
  import { type HeaderData } from '../../data/HeaderData';
5
5
  import { type NavigationData } from '../../data/NavigationData';
6
6
  import { getAspectsWithInclude } from '../../hooks/useAspects/aspects/getAspectsWithInclude';
7
- import { useLocationState } from '../../hooks/useLocation';
7
+ import { useLocation } from '../../hooks/useLocation';
8
8
  import { type BlockVersion } from '../../model/BlockVersion';
9
9
  import { type IconVersion } from '../../model/IconVersion';
10
10
  import { useLocationDialog } from '../../ui-kit/LocationDialog/useLocationDialog';
@@ -22,7 +22,7 @@ export const HeaderSecondaryMenu = JSX<HeaderSecondaryMenuProps>(
22
22
  ({ className, version, ...rest }) => {
23
23
  const iconVersion: IconVersion = version === 'transparent' ? 'white' : 'black';
24
24
 
25
- const currentLocation = useLocationState(rest?.branches?.default);
25
+ const [currentLocation] = useLocation(rest?.branches?.default);
26
26
 
27
27
  const searchDialog = useSearchDialog(rest);
28
28
  const locationDialog = useLocationDialog(rest);
@@ -1,5 +1,5 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { useLocationState } from '../../hooks/useLocation';
2
+ import { useLocation } from '../../hooks/useLocation';
3
3
  import { type AtmsDef } from './OfficesAtmsMapContent';
4
4
  import { OfficesAtmsMapLayout } from './OfficesAtmsMapLayout';
5
5
  import { type Atm } from './OfficesAtmsMapProps';
@@ -30,7 +30,8 @@ export interface AtmsMapProps {
30
30
  }
31
31
 
32
32
  export const AtmsMap = JSX<AtmsMapProps>(({ descriptionData, className }) => {
33
- const currentLocation = useLocationState();
33
+ const [currentLocation] = useLocation();
34
+
34
35
  const regionCode = currentLocation?.code ?? '000';
35
36
 
36
37
  const { data: officesData, isLoad } = useAtms(regionCode);
@@ -1,5 +1,5 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { useLocationState } from '../../hooks/useLocation';
2
+ import { useLocation } from '../../hooks/useLocation';
3
3
  import { OfficesAtmsMapLayout } from './OfficesAtmsMapLayout';
4
4
  import { getOfficePoint, renderOfficeCard } from './renderOfficeCard';
5
5
  import { getRemoteWorkplacePoint, renderRemoteWorkplaceCard } from './renderRemoteWorkplaceCard';
@@ -10,7 +10,7 @@ export interface OfficesMapProps {
10
10
  }
11
11
 
12
12
  export const OfficesMap = JSX<OfficesMapProps>(({ className }) => {
13
- const currentLocation = useLocationState();
13
+ const [currentLocation] = useLocation();
14
14
  const regionCode = currentLocation?.code ?? '000';
15
15
  const { data, isLoad } = useOffices(regionCode);
16
16
 
@@ -4,7 +4,7 @@ import { type HeaderData } from '../../data/HeaderData';
4
4
  import { type JSONRefObject } from '../../data/JSONRefObject';
5
5
  import { type StickyMenuItem } from '../../data/StickyMobileData';
6
6
  import { env } from '../../Env';
7
- import { useLocationState } from '../../hooks/useLocation';
7
+ import { useLocation } from '../../hooks/useLocation';
8
8
  import { Heading } from '../../ui-kit/Heading/Heading';
9
9
  import { useLocationDialog } from '../../ui-kit/LocationDialog/useLocationDialog';
10
10
  import { getBasePath } from '../../utils/getBasePath';
@@ -22,7 +22,7 @@ export interface BurgerMenuDialogProps {
22
22
  export const BurgerMenuDialog = JSX<BurgerMenuDialogProps>(
23
23
  ({ menuRef, menuItem, locationDialogProps, closeAll }) => {
24
24
  const locationDialog = useLocationDialog(locationDialogProps || {});
25
- const { name: location } = useLocationState();
25
+ const [{ name: location }] = useLocation();
26
26
  const menuDimensions = menuRef?.current?.getBoundingClientRect();
27
27
  const basePath = getBasePath(env.SITE_URL);
28
28
 
@@ -1,40 +1,54 @@
1
- import { useEffect } from '@redneckz/uni-jsx/lib/hooks';
1
+ import { useCallback, useEffect } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { useAsyncData } from '@redneckz/uni-jsx/lib/hooks/useAsyncData';
2
3
  import { defaultEventBus } from '../EventBus/defaultEventBus';
3
- import { useSubject } from '../EventBus/useSubject';
4
- import { useSubjectState } from '../EventBus/useSubjectState';
5
- import { fetchJSON } from '../utils/fetchJSON';
4
+ import { useLatestEvent } from '../EventBus/useLatestEvent';
5
+ import { fetchJSONUnsafe, type FetchJSONUnsafeType } from '../utils/fetchJSON';
6
6
  import { type Region } from './useRegions';
7
7
 
8
8
  const REGION_URL = '/api/v1/region';
9
9
  const LOCATION_STORAGE_KEY = 'location';
10
10
 
11
- export function useLocation(defaultLocation = 'Москва'): (_: Region) => void {
12
- useEffect(() => defaultEventBus.subscribe('location', storeLocation), []);
13
-
14
- return useSubject(defaultEventBus.emitter, 'location', restoreLocation(defaultLocation));
15
- }
16
-
17
- export function useLocationState(defaultLocation = 'Москва'): Region {
18
- return useSubjectState(defaultEventBus.observable, 'location', { name: defaultLocation });
19
- }
20
-
21
- function restoreLocation(defaultLocation: string) {
22
- return async (): Promise<Region> => {
23
- if (!globalThis.localStorage?.hasItem(LOCATION_STORAGE_KEY)) {
24
- storeLocation(await fetchJSON<Region>(REGION_URL));
25
- }
26
-
27
- const storedLocation = globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY);
28
- try {
29
- return storedLocation && JSON.parse(storedLocation);
30
- } catch (ex) {
31
- // Do nothing
11
+ export function useLocation(defaultLocation = 'Москва'): [Region, (_: Region) => void] {
12
+ const [currentLocation, fireCurrentLocation] = useLatestEvent(
13
+ defaultEventBus,
14
+ 'location',
15
+ restoreLocation() ?? { name: defaultLocation },
16
+ );
17
+
18
+ const selectCurrentLocation = useCallback((_: Region) => {
19
+ storeLocation(_);
20
+ fireCurrentLocation(_);
21
+ }, []);
22
+
23
+ const { data } = useAsyncData(
24
+ hasStoredLocation() ? null : REGION_URL,
25
+ fetchJSONUnsafe as FetchJSONUnsafeType<Region>,
26
+ );
27
+ useEffect(() => {
28
+ if (data && !hasStoredLocation()) {
29
+ fireCurrentLocation(data);
32
30
  }
31
+ }, [data]);
33
32
 
34
- return { name: defaultLocation };
35
- };
33
+ return [currentLocation ?? { name: defaultLocation }, selectCurrentLocation];
36
34
  }
37
35
 
38
- function storeLocation(_: Region | null | undefined) {
39
- _ && globalThis.localStorage?.setItem(LOCATION_STORAGE_KEY, JSON.stringify(_));
40
- }
36
+ const hasStoredLocation = () => Boolean(globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY));
37
+
38
+ const restoreLocation = (): Region | null => {
39
+ try {
40
+ const data = globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY);
41
+
42
+ return data && JSON.parse(data);
43
+ } catch (ex) {
44
+ return null;
45
+ }
46
+ };
47
+
48
+ const storeLocation = (_: Region) => {
49
+ try {
50
+ globalThis.localStorage?.setItem(LOCATION_STORAGE_KEY, JSON.stringify(_));
51
+ } catch (ex) {
52
+ // Do nothing
53
+ }
54
+ };
@@ -11,11 +11,8 @@ export interface Region {
11
11
  localities?: string[];
12
12
  }
13
13
 
14
- const EMPTY_REGIONS: Region[] = [];
15
-
16
- // TODO Почему url можно менять? Разве смысл не в инкапсуляции api url. Тоже под рефакторинг попадает
17
14
  export function useRegions(url: string = REGIONS_URL): Region[] {
18
15
  const { data } = useAsyncData(url, fetchJSONUnsafe as FetchJSONUnsafeType<Region[]>);
19
16
 
20
- return Array.isArray(data) ? data : EMPTY_REGIONS;
17
+ return Array.isArray(data) ? data : [];
21
18
  }
@@ -8,7 +8,7 @@ export interface DialogOptions {
8
8
 
9
9
  export const useDialogManager = () => ({
10
10
  open: (dialog: VNode, options: DialogOptions = {}) =>
11
- defaultEventBus.emitter.fire('dialog', { type: 'open', dialog, ...options }),
12
- close: () => defaultEventBus.emitter.fire('dialog', { type: 'close' }),
13
- closeAll: () => defaultEventBus.emitter.fire('dialog', { type: 'close', all: true }),
11
+ defaultEventBus.fire('dialog', { type: 'open', dialog, ...options }),
12
+ close: () => defaultEventBus.fire('dialog', { type: 'close' }),
13
+ closeAll: () => defaultEventBus.fire('dialog', { type: 'close', all: true }),
14
14
  });
@@ -27,7 +27,7 @@ export const useDialogsList = ({
27
27
 
28
28
  useEffect(
29
29
  () =>
30
- defaultEventBus.observable.subscribe('dialog', (action) => {
30
+ defaultEventBus.subscribe('dialog', (action) => {
31
31
  switch (action.type) {
32
32
  case 'open':
33
33
  push(action);
@@ -3,30 +3,14 @@ import { useCallback, useState } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { type VNode } from '../../model/VNode';
4
4
  import { type FoldablePartProps } from './FoldablePartProps';
5
5
 
6
- export interface FoldableWrapperProps {
6
+ export interface FoldableProps {
7
7
  className?: string;
8
- }
9
-
10
- export interface FoldableProps extends FoldableWrapperProps {
11
8
  unfoldedByDefault?: boolean;
12
9
  isFoldButtonOnTop?: boolean;
13
10
  renderFoldableSection: (props: FoldablePartProps) => VNode;
14
11
  renderFoldButton?: ((props: FoldablePartProps) => VNode) | null;
15
12
  }
16
13
 
17
- export const FoldableWrapper = JSX<FoldableWrapperProps>(({ className, children }) => (
18
- <div className={className} role="group">
19
- {children}
20
- </div>
21
- ));
22
-
23
- /**
24
- * Какой то бесполезный компонент. Его можно заменить на useBool
25
- * Лучше оставить только обёрточный div с необходимой атрибутикой
26
- * и сделать пассивный компонент
27
- *
28
- * @deprecated
29
- */
30
14
  export const Foldable = JSX<FoldableProps>(
31
15
  ({
32
16
  className = '',
@@ -45,15 +29,15 @@ export const Foldable = JSX<FoldableProps>(
45
29
  const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
46
30
 
47
31
  return isFoldButtonOnTop ? (
48
- <FoldableWrapper className={className}>
32
+ <div className={className} role="group">
49
33
  {buttonNode}
50
34
  {sectionNode}
51
- </FoldableWrapper>
35
+ </div>
52
36
  ) : (
53
- <FoldableWrapper className={className}>
37
+ <div className={className} role="group">
54
38
  {sectionNode}
55
39
  {buttonNode}
56
- </FoldableWrapper>
40
+ </div>
57
41
  );
58
42
  },
59
43
  );
@@ -26,5 +26,4 @@ export const FEEDBACK_METHOD: Option[] = [
26
26
  { key: 'email', text: 'Электронное сообщение' },
27
27
  ];
28
28
 
29
- // TODO Тоже надо рефакторить - файлик constants
30
29
  export const OUT_SERVICE_URL = '/api/v1/outservice/outserviceregions';
@@ -2,6 +2,5 @@ import { type FieldProps } from '../../hooks/useForm';
2
2
  import { type Validator } from '../../validation/validator';
3
3
  import { withValidator } from '../../validation/withValidator';
4
4
 
5
- // TODO Зачем это?
6
5
  export const getValidation = (field: FieldProps<any>, validator: Validator, required = false) =>
7
6
  required ? withValidator(field, validator) : field;
@@ -1,18 +1,20 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { useCallback, useMemo, useState } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { useCallback, useState } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { type BranchesHeader, type ForeignOfficeProps } from '../../data/HeaderData';
4
+ import { useLink } from '../../hooks/useLink';
4
5
  import { useLocation } from '../../hooks/useLocation';
5
6
  import { useRegions, type Region } from '../../hooks/useRegions';
6
7
  import { groupBy } from '../../utils/groupBy';
7
8
  import { jaroWinklerDistance } from '../../utils/jaroWinklerDistance';
8
9
  import { Dialog } from '../DialogManager/Dialog';
9
10
  import { useDialogManager } from '../DialogManager/useDialogManager';
11
+ import { LinkWrapper } from '../LinkWrapper/LinkWrapper';
12
+ import { Paragraph } from '../Paragraph/Paragraph';
10
13
  import { Text } from '../Text/Text';
11
14
  import { renderForeignOffices } from './renderForeignOffices';
12
15
  import { renderRegion } from './renderRegion';
13
16
  import { renderRegionGroup } from './renderRegionGroup';
14
17
  import { SearchBar } from './SearchBar';
15
- import { SelectedLocation } from './SelectedLocation';
16
18
 
17
19
  const SEARCH_TERM_MIN_LENGTH = 3;
18
20
 
@@ -22,21 +24,22 @@ export interface LocationDialogProps {
22
24
  }
23
25
 
24
26
  export const LocationDialog = JSX<LocationDialogProps>(({ foreignOffices, branches }) => {
25
- const selectLocation = useLocation(branches?.default);
27
+ const [currentLocation, selectCurrentLocation] = useLocation(branches?.default);
28
+
29
+ const link = useLink();
30
+ const { href } = link({ href: `/branches/${currentLocation.slug}` });
26
31
 
27
32
  const [query, setQuery] = useState('');
28
33
 
29
- const rawRegions = useRegions();
30
- const regions = useMemo(
31
- () => cleanUpRegions(rawRegions).sort((a, b) => (a.name ?? '').localeCompare(b.name ?? '')),
32
- [rawRegions],
34
+ const regions: Region[] = cleanUpRegions(useRegions()).sort((a, b) =>
35
+ a.name.localeCompare(b.name),
33
36
  );
34
- const regionsGroupByLetter = useMemo(() => groupBy(regions, regionFirstLetter), [regions]);
37
+ const regionsGroupByLetter: Map<string, Region[]> = groupBy(regions, regionFirstLetter);
35
38
 
36
39
  const { close } = useDialogManager();
37
40
 
38
41
  const handleChangeLocation = useCallback((region: Region) => {
39
- selectLocation(region);
42
+ selectCurrentLocation(region);
40
43
  close();
41
44
  }, []);
42
45
 
@@ -48,7 +51,16 @@ export const LocationDialog = JSX<LocationDialogProps>(({ foreignOffices, branch
48
51
  <Text size="text-h4" color="text-primary-text">
49
52
  Выберите филиал
50
53
  </Text>
51
- <SelectedLocation defaultLocation={branches?.default} />
54
+ {currentLocation ? (
55
+ <div className="mb-s">
56
+ <Paragraph size="text-l" color="text-primary-text">
57
+ Сейчас выбран:
58
+ <LinkWrapper href={href} className="inline mx-2xs text-primary-main">
59
+ {currentLocation.name}
60
+ </LinkWrapper>
61
+ </Paragraph>
62
+ </div>
63
+ ) : null}
52
64
  <SearchBar onSearch={setQuery} searchTerm={query} />
53
65
  </div>
54
66
  }
@@ -74,10 +86,10 @@ export const LocationDialog = JSX<LocationDialogProps>(({ foreignOffices, branch
74
86
  );
75
87
  });
76
88
 
77
- const regionFirstLetter = (region: Region) => region.name?.charAt(0) ?? '';
89
+ const regionFirstLetter = (region: Region) => region.name?.charAt(0) || '';
78
90
 
79
- const cleanUpRegions = (regions: Region[]): Region[] =>
91
+ const cleanUpRegions = (regions: Region[]) =>
80
92
  regions.map((region) => ({
81
93
  ...region,
82
- name: region.name?.replace(/республика|область|край'/gi, '').trim() ?? '',
94
+ name: region.name?.replace(/республика|область|край'/gi, '').trim() || '',
83
95
  }));
@@ -15,7 +15,7 @@ export const PopupManager = JSX(() => {
15
15
 
16
16
  useEffect(
17
17
  () =>
18
- defaultEventBus.observable.subscribe('popup', (action) => {
18
+ defaultEventBus.subscribe('popup', (action) => {
19
19
  switch (action.type) {
20
20
  case 'open':
21
21
  case 'update':
@@ -4,8 +4,8 @@ import { type PopupOptions } from './PopupAction';
4
4
 
5
5
  export const usePopupManager = () => ({
6
6
  open: (popup: VNode, options: PopupOptions) =>
7
- defaultEventBus.emitter.fire('popup', { type: 'open', popup, ...options }),
7
+ defaultEventBus.fire('popup', { type: 'open', popup, ...options }),
8
8
  update: (popup: VNode, options: PopupOptions) =>
9
- defaultEventBus.emitter.fire('popup', { type: 'update', popup, ...options }),
10
- close: () => defaultEventBus.emitter.fire('popup', { type: 'close' }),
9
+ defaultEventBus.fire('popup', { type: 'update', popup, ...options }),
10
+ close: () => defaultEventBus.fire('popup', { type: 'close' }),
11
11
  });