@redneckz/wildless-cms-uni-blocks 0.14.599 → 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 (346) 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 +91 -137
  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/dist/ui-kit/VerifyPhoneDialog/InputCode.js +2 -6
  55. package/dist/ui-kit/VerifyPhoneDialog/InputCode.js.map +1 -1
  56. package/lib/EventBus/EventBus.d.ts +4 -17
  57. package/lib/EventBus/EventBus.js +10 -29
  58. package/lib/EventBus/EventBus.js.map +1 -1
  59. package/lib/EventBus/defaultEventBus.d.ts +13 -2
  60. package/lib/EventBus/defaultEventBus.js.map +1 -1
  61. package/lib/EventBus/useLatestEvent.d.ts +2 -0
  62. package/lib/EventBus/useLatestEvent.js +8 -0
  63. package/lib/EventBus/useLatestEvent.js.map +1 -0
  64. package/lib/common.css +1 -1
  65. package/lib/components/CarouselTariffsCard/CarouselTariffsCard.js +26 -12
  66. package/lib/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
  67. package/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
  68. package/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js +2 -0
  69. package/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +1 -0
  70. package/lib/components/ExchangeRateTile/ExchangeRateTile.js +2 -2
  71. package/lib/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
  72. package/lib/components/Header/HeaderSecondaryMenu.js +2 -2
  73. package/lib/components/Header/HeaderSecondaryMenu.js.map +1 -1
  74. package/lib/components/OfficesAtmsMap/AtmsMap.js +2 -2
  75. package/lib/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
  76. package/lib/components/OfficesAtmsMap/OfficesAtmsMapLayout.d.ts +1 -1
  77. package/lib/components/OfficesAtmsMap/OfficesMap.js +2 -2
  78. package/lib/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
  79. package/lib/components/StickyBottomMenu/BurgerMenuDialog.js +2 -2
  80. package/lib/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
  81. package/lib/hooks/useLocation.d.ts +1 -2
  82. package/lib/hooks/useLocation.js +33 -26
  83. package/lib/hooks/useLocation.js.map +1 -1
  84. package/lib/hooks/useRegions.js +1 -3
  85. package/lib/hooks/useRegions.js.map +1 -1
  86. package/lib/ui-kit/DialogManager/useDialogManager.js +3 -3
  87. package/lib/ui-kit/DialogManager/useDialogManager.js.map +1 -1
  88. package/lib/ui-kit/DialogManager/useDialogsList.js +1 -1
  89. package/lib/ui-kit/DialogManager/useDialogsList.js.map +1 -1
  90. package/lib/ui-kit/Foldable/Foldable.d.ts +1 -11
  91. package/lib/ui-kit/Foldable/Foldable.js +2 -10
  92. package/lib/ui-kit/Foldable/Foldable.js.map +1 -1
  93. package/lib/ui-kit/FormField/constants.js +0 -1
  94. package/lib/ui-kit/FormField/constants.js.map +1 -1
  95. package/lib/ui-kit/FormField/getValidation.js +0 -1
  96. package/lib/ui-kit/FormField/getValidation.js.map +1 -1
  97. package/lib/ui-kit/LocationDialog/LocationDialog.js +13 -10
  98. package/lib/ui-kit/LocationDialog/LocationDialog.js.map +1 -1
  99. package/lib/ui-kit/PopupManager/PopupManager.js +1 -1
  100. package/lib/ui-kit/PopupManager/PopupManager.js.map +1 -1
  101. package/lib/ui-kit/PopupManager/usePopupManager.js +3 -3
  102. package/lib/ui-kit/PopupManager/usePopupManager.js.map +1 -1
  103. package/lib/ui-kit/VerifyPhoneDialog/InputCode.js +2 -6
  104. package/lib/ui-kit/VerifyPhoneDialog/InputCode.js.map +1 -1
  105. package/mobile/bundle/EventBus/EventBus.d.ts +4 -17
  106. package/mobile/bundle/EventBus/defaultEventBus.d.ts +13 -2
  107. package/mobile/bundle/EventBus/useLatestEvent.d.ts +2 -0
  108. package/mobile/bundle/bundle.umd.js +91 -137
  109. package/mobile/bundle/bundle.umd.min.js +1 -1
  110. package/mobile/bundle/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
  111. package/mobile/bundle/hooks/useLocation.d.ts +1 -2
  112. package/mobile/bundle/ui-kit/Foldable/Foldable.d.ts +1 -11
  113. package/mobile/dist/EventBus/EventBus.d.ts +4 -17
  114. package/mobile/dist/EventBus/EventBus.js +10 -29
  115. package/mobile/dist/EventBus/EventBus.js.map +1 -1
  116. package/mobile/dist/EventBus/defaultEventBus.d.ts +13 -2
  117. package/mobile/dist/EventBus/defaultEventBus.js.map +1 -1
  118. package/mobile/dist/EventBus/useLatestEvent.d.ts +2 -0
  119. package/mobile/dist/EventBus/useLatestEvent.js +11 -0
  120. package/mobile/dist/EventBus/useLatestEvent.js.map +1 -0
  121. package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCard.js +25 -11
  122. package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
  123. package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
  124. package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.js +2 -0
  125. package/mobile/dist/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +1 -0
  126. package/mobile/dist/components/ExchangeRateTile/ExchangeRateTile.js +1 -1
  127. package/mobile/dist/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
  128. package/mobile/dist/components/Header/HeaderSecondaryMenu.js +1 -1
  129. package/mobile/dist/components/Header/HeaderSecondaryMenu.js.map +1 -1
  130. package/mobile/dist/components/OfficesAtmsMap/AtmsMap.js +1 -1
  131. package/mobile/dist/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
  132. package/mobile/dist/components/OfficesAtmsMap/OfficesMap.js +1 -1
  133. package/mobile/dist/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
  134. package/mobile/dist/components/StickyBottomMenu/BurgerMenuDialog.js +1 -1
  135. package/mobile/dist/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
  136. package/mobile/dist/hooks/useLocation.d.ts +1 -2
  137. package/mobile/dist/hooks/useLocation.js +33 -27
  138. package/mobile/dist/hooks/useLocation.js.map +1 -1
  139. package/mobile/dist/hooks/useRegions.js +1 -3
  140. package/mobile/dist/hooks/useRegions.js.map +1 -1
  141. package/mobile/dist/ui-kit/DialogManager/useDialogManager.js +3 -3
  142. package/mobile/dist/ui-kit/DialogManager/useDialogManager.js.map +1 -1
  143. package/mobile/dist/ui-kit/DialogManager/useDialogsList.js +1 -1
  144. package/mobile/dist/ui-kit/DialogManager/useDialogsList.js.map +1 -1
  145. package/mobile/dist/ui-kit/Foldable/Foldable.d.ts +1 -11
  146. package/mobile/dist/ui-kit/Foldable/Foldable.js +2 -10
  147. package/mobile/dist/ui-kit/Foldable/Foldable.js.map +1 -1
  148. package/mobile/dist/ui-kit/FormField/constants.js +0 -1
  149. package/mobile/dist/ui-kit/FormField/constants.js.map +1 -1
  150. package/mobile/dist/ui-kit/FormField/getValidation.js +0 -1
  151. package/mobile/dist/ui-kit/FormField/getValidation.js.map +1 -1
  152. package/mobile/dist/ui-kit/LocationDialog/LocationDialog.js +12 -9
  153. package/mobile/dist/ui-kit/LocationDialog/LocationDialog.js.map +1 -1
  154. package/mobile/dist/ui-kit/PopupManager/PopupManager.js +1 -1
  155. package/mobile/dist/ui-kit/PopupManager/PopupManager.js.map +1 -1
  156. package/mobile/dist/ui-kit/PopupManager/usePopupManager.js +3 -3
  157. package/mobile/dist/ui-kit/PopupManager/usePopupManager.js.map +1 -1
  158. package/mobile/dist/ui-kit/VerifyPhoneDialog/InputCode.js +2 -6
  159. package/mobile/dist/ui-kit/VerifyPhoneDialog/InputCode.js.map +1 -1
  160. package/mobile/lib/EventBus/EventBus.d.ts +4 -17
  161. package/mobile/lib/EventBus/EventBus.js +10 -29
  162. package/mobile/lib/EventBus/EventBus.js.map +1 -1
  163. package/mobile/lib/EventBus/defaultEventBus.d.ts +13 -2
  164. package/mobile/lib/EventBus/defaultEventBus.js.map +1 -1
  165. package/mobile/lib/EventBus/useLatestEvent.d.ts +2 -0
  166. package/mobile/lib/EventBus/useLatestEvent.js +8 -0
  167. package/mobile/lib/EventBus/useLatestEvent.js.map +1 -0
  168. package/mobile/lib/common.css +1 -1
  169. package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCard.js +26 -12
  170. package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCard.js.map +1 -1
  171. package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.d.ts +6 -0
  172. package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js +2 -0
  173. package/mobile/lib/components/CarouselTariffsCard/CarouselTariffsCardAction.js.map +1 -0
  174. package/mobile/lib/components/ExchangeRateTile/ExchangeRateTile.js +2 -2
  175. package/mobile/lib/components/ExchangeRateTile/ExchangeRateTile.js.map +1 -1
  176. package/mobile/lib/components/Header/HeaderSecondaryMenu.js +2 -2
  177. package/mobile/lib/components/Header/HeaderSecondaryMenu.js.map +1 -1
  178. package/mobile/lib/components/OfficesAtmsMap/AtmsMap.js +2 -2
  179. package/mobile/lib/components/OfficesAtmsMap/AtmsMap.js.map +1 -1
  180. package/mobile/lib/components/OfficesAtmsMap/OfficesMap.js +2 -2
  181. package/mobile/lib/components/OfficesAtmsMap/OfficesMap.js.map +1 -1
  182. package/mobile/lib/components/StickyBottomMenu/BurgerMenuDialog.js +2 -2
  183. package/mobile/lib/components/StickyBottomMenu/BurgerMenuDialog.js.map +1 -1
  184. package/mobile/lib/hooks/useLocation.d.ts +1 -2
  185. package/mobile/lib/hooks/useLocation.js +33 -26
  186. package/mobile/lib/hooks/useLocation.js.map +1 -1
  187. package/mobile/lib/hooks/useRegions.js +1 -3
  188. package/mobile/lib/hooks/useRegions.js.map +1 -1
  189. package/mobile/lib/ui-kit/DialogManager/useDialogManager.js +3 -3
  190. package/mobile/lib/ui-kit/DialogManager/useDialogManager.js.map +1 -1
  191. package/mobile/lib/ui-kit/DialogManager/useDialogsList.js +1 -1
  192. package/mobile/lib/ui-kit/DialogManager/useDialogsList.js.map +1 -1
  193. package/mobile/lib/ui-kit/Foldable/Foldable.d.ts +1 -11
  194. package/mobile/lib/ui-kit/Foldable/Foldable.js +2 -10
  195. package/mobile/lib/ui-kit/Foldable/Foldable.js.map +1 -1
  196. package/mobile/lib/ui-kit/FormField/constants.js +0 -1
  197. package/mobile/lib/ui-kit/FormField/constants.js.map +1 -1
  198. package/mobile/lib/ui-kit/FormField/getValidation.js +0 -1
  199. package/mobile/lib/ui-kit/FormField/getValidation.js.map +1 -1
  200. package/mobile/lib/ui-kit/LocationDialog/LocationDialog.js +13 -10
  201. package/mobile/lib/ui-kit/LocationDialog/LocationDialog.js.map +1 -1
  202. package/mobile/lib/ui-kit/PopupManager/PopupManager.js +1 -1
  203. package/mobile/lib/ui-kit/PopupManager/PopupManager.js.map +1 -1
  204. package/mobile/lib/ui-kit/PopupManager/usePopupManager.js +3 -3
  205. package/mobile/lib/ui-kit/PopupManager/usePopupManager.js.map +1 -1
  206. package/mobile/lib/ui-kit/VerifyPhoneDialog/InputCode.js +2 -6
  207. package/mobile/lib/ui-kit/VerifyPhoneDialog/InputCode.js.map +1 -1
  208. package/mobile/src/EventBus/EventBus.ts +15 -51
  209. package/mobile/src/EventBus/defaultEventBus.ts +14 -2
  210. package/mobile/src/EventBus/useLatestEvent.ts +16 -0
  211. package/mobile/src/components/CarouselTariffsCard/CarouselTariffsCard.tsx +66 -23
  212. package/mobile/src/components/CarouselTariffsCard/CarouselTariffsCardAction.ts +6 -0
  213. package/mobile/src/components/ExchangeRateTile/ExchangeRateTile.tsx +2 -2
  214. package/mobile/src/components/Header/HeaderSecondaryMenu.tsx +2 -2
  215. package/mobile/src/components/OfficesAtmsMap/AtmsMap.tsx +3 -2
  216. package/mobile/src/components/OfficesAtmsMap/OfficesMap.tsx +2 -2
  217. package/mobile/src/components/StickyBottomMenu/BurgerMenuDialog.tsx +2 -2
  218. package/mobile/src/hooks/useLocation.ts +44 -30
  219. package/mobile/src/hooks/useRegions.ts +1 -4
  220. package/mobile/src/ui-kit/DialogManager/useDialogManager.ts +3 -3
  221. package/mobile/src/ui-kit/DialogManager/useDialogsList.ts +1 -1
  222. package/mobile/src/ui-kit/Foldable/Foldable.tsx +5 -21
  223. package/mobile/src/ui-kit/FormField/constants.tsx +0 -1
  224. package/mobile/src/ui-kit/FormField/getValidation.tsx +0 -1
  225. package/mobile/src/ui-kit/LocationDialog/LocationDialog.tsx +25 -13
  226. package/mobile/src/ui-kit/PopupManager/PopupManager.tsx +1 -1
  227. package/mobile/src/ui-kit/PopupManager/usePopupManager.tsx +3 -3
  228. package/mobile/src/ui-kit/VerifyPhoneDialog/InputCode.tsx +2 -6
  229. package/package.json +1 -1
  230. package/src/EventBus/EventBus.ts +15 -51
  231. package/src/EventBus/defaultEventBus.ts +14 -2
  232. package/src/EventBus/useLatestEvent.ts +16 -0
  233. package/src/components/CarouselTariffsCard/CarouselTariffsCard.tsx +66 -23
  234. package/src/components/CarouselTariffsCard/CarouselTariffsCardAction.ts +6 -0
  235. package/src/components/ExchangeRateTile/ExchangeRateTile.tsx +2 -2
  236. package/src/components/Header/HeaderSecondaryMenu.tsx +2 -2
  237. package/src/components/OfficesAtmsMap/AtmsMap.tsx +3 -2
  238. package/src/components/OfficesAtmsMap/OfficesMap.tsx +2 -2
  239. package/src/components/StickyBottomMenu/BurgerMenuDialog.tsx +2 -2
  240. package/src/hooks/useLocation.ts +44 -30
  241. package/src/hooks/useRegions.ts +1 -4
  242. package/src/ui-kit/DialogManager/useDialogManager.ts +3 -3
  243. package/src/ui-kit/DialogManager/useDialogsList.ts +1 -1
  244. package/src/ui-kit/Foldable/Foldable.tsx +5 -21
  245. package/src/ui-kit/FormField/constants.tsx +0 -1
  246. package/src/ui-kit/FormField/getValidation.tsx +0 -1
  247. package/src/ui-kit/LocationDialog/LocationDialog.tsx +25 -13
  248. package/src/ui-kit/PopupManager/PopupManager.tsx +1 -1
  249. package/src/ui-kit/PopupManager/usePopupManager.tsx +3 -3
  250. package/src/ui-kit/VerifyPhoneDialog/InputCode.tsx +2 -6
  251. package/bundle/EventBus/useSubject.d.ts +0 -2
  252. package/bundle/EventBus/useSubjectState.d.ts +0 -2
  253. package/bundle/components/CarouselTariffsCard/CardCellsSection.d.ts +0 -9
  254. package/bundle/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +0 -9
  255. package/bundle/hooks/useReducer.d.ts +0 -4
  256. package/bundle/ui-kit/LocationDialog/SelectedLocation.d.ts +0 -5
  257. package/dist/EventBus/useSubject.d.ts +0 -2
  258. package/dist/EventBus/useSubject.js +0 -17
  259. package/dist/EventBus/useSubject.js.map +0 -1
  260. package/dist/EventBus/useSubjectState.d.ts +0 -2
  261. package/dist/EventBus/useSubjectState.js +0 -10
  262. package/dist/EventBus/useSubjectState.js.map +0 -1
  263. package/dist/components/CarouselTariffsCard/CardCellsSection.d.ts +0 -9
  264. package/dist/components/CarouselTariffsCard/CardCellsSection.js +0 -18
  265. package/dist/components/CarouselTariffsCard/CardCellsSection.js.map +0 -1
  266. package/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +0 -9
  267. package/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.js +0 -5
  268. package/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.js.map +0 -1
  269. package/dist/hooks/useReducer.d.ts +0 -4
  270. package/dist/hooks/useReducer.js +0 -12
  271. package/dist/hooks/useReducer.js.map +0 -1
  272. package/dist/ui-kit/LocationDialog/SelectedLocation.d.ts +0 -5
  273. package/dist/ui-kit/LocationDialog/SelectedLocation.js +0 -15
  274. package/dist/ui-kit/LocationDialog/SelectedLocation.js.map +0 -1
  275. package/lib/EventBus/useSubject.d.ts +0 -2
  276. package/lib/EventBus/useSubject.js +0 -14
  277. package/lib/EventBus/useSubject.js.map +0 -1
  278. package/lib/EventBus/useSubjectState.d.ts +0 -2
  279. package/lib/EventBus/useSubjectState.js +0 -7
  280. package/lib/EventBus/useSubjectState.js.map +0 -1
  281. package/lib/components/CarouselTariffsCard/CardCellsSection.d.ts +0 -9
  282. package/lib/components/CarouselTariffsCard/CardCellsSection.js +0 -16
  283. package/lib/components/CarouselTariffsCard/CardCellsSection.js.map +0 -1
  284. package/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +0 -9
  285. package/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.js +0 -3
  286. package/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.js.map +0 -1
  287. package/lib/hooks/useReducer.d.ts +0 -4
  288. package/lib/hooks/useReducer.js +0 -9
  289. package/lib/hooks/useReducer.js.map +0 -1
  290. package/lib/ui-kit/LocationDialog/SelectedLocation.d.ts +0 -5
  291. package/lib/ui-kit/LocationDialog/SelectedLocation.js +0 -13
  292. package/lib/ui-kit/LocationDialog/SelectedLocation.js.map +0 -1
  293. package/mobile/bundle/EventBus/useSubject.d.ts +0 -2
  294. package/mobile/bundle/EventBus/useSubjectState.d.ts +0 -2
  295. package/mobile/bundle/components/CarouselTariffsCard/CardCellsSection.d.ts +0 -9
  296. package/mobile/bundle/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +0 -9
  297. package/mobile/bundle/hooks/useReducer.d.ts +0 -4
  298. package/mobile/bundle/ui-kit/LocationDialog/SelectedLocation.d.ts +0 -5
  299. package/mobile/dist/EventBus/useSubject.d.ts +0 -2
  300. package/mobile/dist/EventBus/useSubject.js +0 -17
  301. package/mobile/dist/EventBus/useSubject.js.map +0 -1
  302. package/mobile/dist/EventBus/useSubjectState.d.ts +0 -2
  303. package/mobile/dist/EventBus/useSubjectState.js +0 -10
  304. package/mobile/dist/EventBus/useSubjectState.js.map +0 -1
  305. package/mobile/dist/components/CarouselTariffsCard/CardCellsSection.d.ts +0 -9
  306. package/mobile/dist/components/CarouselTariffsCard/CardCellsSection.js +0 -18
  307. package/mobile/dist/components/CarouselTariffsCard/CardCellsSection.js.map +0 -1
  308. package/mobile/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +0 -9
  309. package/mobile/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.js +0 -5
  310. package/mobile/dist/components/CarouselTariffsCard/carouselTariffsCardEventBus.js.map +0 -1
  311. package/mobile/dist/hooks/useReducer.d.ts +0 -4
  312. package/mobile/dist/hooks/useReducer.js +0 -12
  313. package/mobile/dist/hooks/useReducer.js.map +0 -1
  314. package/mobile/dist/ui-kit/LocationDialog/SelectedLocation.d.ts +0 -5
  315. package/mobile/dist/ui-kit/LocationDialog/SelectedLocation.js +0 -15
  316. package/mobile/dist/ui-kit/LocationDialog/SelectedLocation.js.map +0 -1
  317. package/mobile/lib/EventBus/useSubject.d.ts +0 -2
  318. package/mobile/lib/EventBus/useSubject.js +0 -14
  319. package/mobile/lib/EventBus/useSubject.js.map +0 -1
  320. package/mobile/lib/EventBus/useSubjectState.d.ts +0 -2
  321. package/mobile/lib/EventBus/useSubjectState.js +0 -7
  322. package/mobile/lib/EventBus/useSubjectState.js.map +0 -1
  323. package/mobile/lib/components/CarouselTariffsCard/CardCellsSection.d.ts +0 -9
  324. package/mobile/lib/components/CarouselTariffsCard/CardCellsSection.js +0 -16
  325. package/mobile/lib/components/CarouselTariffsCard/CardCellsSection.js.map +0 -1
  326. package/mobile/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.d.ts +0 -9
  327. package/mobile/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.js +0 -3
  328. package/mobile/lib/components/CarouselTariffsCard/carouselTariffsCardEventBus.js.map +0 -1
  329. package/mobile/lib/hooks/useReducer.d.ts +0 -4
  330. package/mobile/lib/hooks/useReducer.js +0 -9
  331. package/mobile/lib/hooks/useReducer.js.map +0 -1
  332. package/mobile/lib/ui-kit/LocationDialog/SelectedLocation.d.ts +0 -5
  333. package/mobile/lib/ui-kit/LocationDialog/SelectedLocation.js +0 -13
  334. package/mobile/lib/ui-kit/LocationDialog/SelectedLocation.js.map +0 -1
  335. package/mobile/src/EventBus/useSubject.ts +0 -19
  336. package/mobile/src/EventBus/useSubjectState.ts +0 -13
  337. package/mobile/src/components/CarouselTariffsCard/CardCellsSection.tsx +0 -54
  338. package/mobile/src/components/CarouselTariffsCard/carouselTariffsCardEventBus.ts +0 -11
  339. package/mobile/src/hooks/useReducer.ts +0 -21
  340. package/mobile/src/ui-kit/LocationDialog/SelectedLocation.tsx +0 -27
  341. package/src/EventBus/useSubject.ts +0 -19
  342. package/src/EventBus/useSubjectState.ts +0 -13
  343. package/src/components/CarouselTariffsCard/CardCellsSection.tsx +0 -54
  344. package/src/components/CarouselTariffsCard/carouselTariffsCardEventBus.ts +0 -11
  345. package/src/hooks/useReducer.ts +0 -21
  346. package/src/ui-kit/LocationDialog/SelectedLocation.tsx +0 -27
@@ -1,21 +1,8 @@
1
- export declare type Subscriber<Event> = (ev: Event) => void;
2
- declare type Cleanup = () => void;
3
- export interface EventBusObservable<EM extends Record<string, any>> {
4
- subscribe<K extends keyof EM>(type: K, listener: Subscriber<EM[K]>): Cleanup;
5
- }
6
- export interface EventBusEmitter<EM extends Record<string, any>> {
7
- fire<K extends keyof EM>(type: K, event: EM[K]): void;
8
- subject<K extends keyof EM>(type: K, event: EM[K]): Cleanup;
9
- }
10
- export declare class EventBus<EM extends Record<string, any>> implements EventBusObservable<EM>, EventBusEmitter<EM> {
11
- private subscribersMap;
1
+ export declare class EventBus<EM extends Record<string, any>> {
2
+ private subscribers;
12
3
  private subjectsStateMap;
13
- readonly emitter: EventBusEmitter<EM>;
14
- readonly observable: EventBusObservable<EM>;
15
- subscribe<K extends keyof EM>(type: K, listener: Subscriber<EM[K]>): Cleanup;
4
+ subscribe<K extends keyof EM>(type: K, listener: (event: EM[K]) => void): () => void;
16
5
  private unsubscribe;
17
6
  fire<K extends keyof EM>(type: K, event: EM[K]): void;
18
- subject<K extends keyof EM>(type: K, event: EM[K]): Cleanup;
19
- private fireSubscribers;
7
+ subject<K extends keyof EM>(type: K, event: EM[K]): void;
20
8
  }
21
- export {};
@@ -1,9 +1,20 @@
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
- export declare const defaultEventBus: EventBus<{
7
+ interface TabActivationEvent {
8
+ type?: Tab['type'];
9
+ groupName?: string;
10
+ label?: string;
11
+ }
12
+ interface GlobalEventMap {
6
13
  location: Region;
7
14
  dialog: DialogAction;
8
15
  popup: PopupAction;
9
- }>;
16
+ tab: TabActivationEvent;
17
+ fold: CarouselTariffsCardAction;
18
+ }
19
+ export declare const defaultEventBus: EventBus<GlobalEventMap>;
20
+ export {};
@@ -0,0 +1,2 @@
1
+ import { type EventBus } from './EventBus';
2
+ export declare const useLatestEvent: <EM extends Record<string, any>, K extends keyof EM>(eventBus: EventBus<EM>, type: K, initialEvent?: EM[K] | undefined) => [EM[K] | null, (_: EM[K]) => void];
@@ -403,58 +403,39 @@
403
403
  ].join(' ');
404
404
 
405
405
  class EventBus {
406
- subscribersMap = {};
406
+ subscribers = {};
407
407
  subjectsStateMap = {};
408
- emitter = this;
409
- observable = this;
410
408
  subscribe(type, listener) {
411
- this.subscribersMap[type] ||= [];
412
- this.subscribersMap[type]?.push(listener);
413
- this.fireSubscribers([listener], this.subjectsStateMap[type]);
409
+ this.subscribers[type] = (this.subscribers[type] || []).concat(listener);
410
+ const latestEvent = this.subjectsStateMap[type];
411
+ if (latestEvent) {
412
+ listener(latestEvent);
413
+ }
414
414
  return () => {
415
415
  this.unsubscribe(type, listener);
416
416
  };
417
417
  }
418
418
  unsubscribe(type, listener) {
419
- const index = this.subscribersMap[type]?.indexOf(listener);
420
- if (index && index !== -1) {
421
- this.subscribersMap[type]?.splice(index, 1);
422
- }
419
+ this.subscribers[type] = this.subscribers[type]?.filter((s) => s !== listener);
423
420
  }
424
421
  fire(type, event) {
425
422
  const isSubjectDeclared = type in this.subjectsStateMap;
426
423
  if (isSubjectDeclared) {
427
- this.subject(type, event);
428
- }
429
- else {
430
- this.fireSubscribers(this.subscribersMap[type], event);
431
- }
432
- }
433
- subject(type, event) {
434
- if (this.subjectsStateMap[type] !== event) {
435
424
  this.subjectsStateMap[type] = event;
436
- this.fireSubscribers(this.subscribersMap[type], event);
437
425
  }
438
- return () => {
439
- delete this.subjectsStateMap[type];
440
- };
426
+ this.subscribers[type]?.forEach((s) => s(event));
441
427
  }
442
- fireSubscribers(subscribers, event) {
443
- if (!subscribers || !event) {
444
- return;
445
- }
446
- for (const _ of subscribers) {
447
- _(event);
448
- }
428
+ subject(type, event) {
429
+ this.subjectsStateMap[type] = event;
449
430
  }
450
431
  }
451
432
 
452
433
  const defaultEventBus = new EventBus();
453
434
 
454
435
  const useDialogManager = () => ({
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 }),
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 }),
458
439
  });
459
440
 
460
441
  const adjustBase = (href, basePath = '') => href.replace(basePath, '') || '/';
@@ -1109,7 +1090,6 @@
1109
1090
  { key: 'phone', text: 'Телефонный звонок' },
1110
1091
  { key: 'email', text: 'Электронное сообщение' },
1111
1092
  ];
1112
- // TODO Тоже надо рефакторить - файлик constants
1113
1093
  const OUT_SERVICE_URL = '/api/v1/outservice/outserviceregions';
1114
1094
 
1115
1095
  const getRegionUrl = (typeForm) => typeForm === 'OUTSERVICE' ? OUT_SERVICE_URL : undefined;
@@ -1316,9 +1296,9 @@
1316
1296
  };
1317
1297
 
1318
1298
  const usePopupManager = () => ({
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' }),
1299
+ open: (popup, options) => defaultEventBus.fire('popup', { type: 'open', popup, ...options }),
1300
+ update: (popup, options) => defaultEventBus.fire('popup', { type: 'update', popup, ...options }),
1301
+ close: () => defaultEventBus.fire('popup', { type: 'close' }),
1322
1302
  });
1323
1303
 
1324
1304
  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()))) })));
@@ -1587,7 +1567,6 @@
1587
1567
  };
1588
1568
  };
1589
1569
 
1590
- // TODO Зачем это?
1591
1570
  const getValidation = (field, validator, required = false) => required ? withValidator(field, validator) : field;
1592
1571
 
1593
1572
  const ACQUIRING_TYPES = [
@@ -2089,11 +2068,9 @@
2089
2068
  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 })));
2090
2069
 
2091
2070
  const REGIONS_URL = '/api/v1/regions';
2092
- const EMPTY_REGIONS = [];
2093
- // TODO Почему url можно менять? Разве смысл не в инкапсуляции api url. Тоже под рефакторинг попадает
2094
2071
  function useRegions(url = REGIONS_URL) {
2095
2072
  const { data } = useAsyncData(url, fetchJSONUnsafe);
2096
- return Array.isArray(data) ? data : EMPTY_REGIONS;
2073
+ return Array.isArray(data) ? data : [];
2097
2074
  }
2098
2075
 
2099
2076
  const LocalitiesField = JSX(({ field, input }) => {
@@ -2635,14 +2612,6 @@
2635
2612
  return { ...formState, typeForm: { key: typeForm, text: '' } };
2636
2613
  };
2637
2614
 
2638
- const FoldableWrapper = JSX(({ className, children }) => (jsx("div", { className: className, role: "group", children: children })));
2639
- /**
2640
- * Какой то бесполезный компонент. Его можно заменить на useBool
2641
- * Лучше оставить только обёрточный div с необходимой атрибутикой
2642
- * и сделать пассивный компонент
2643
- *
2644
- * @deprecated
2645
- */
2646
2615
  const Foldable = JSX(({ className = '', isFoldButtonOnTop = false, unfoldedByDefault = false, renderFoldableSection, renderFoldButton, }) => {
2647
2616
  const [isUnfolded, setIsUnfolded] = useState(unfoldedByDefault);
2648
2617
  const onToggle = useCallback(() => {
@@ -2650,7 +2619,7 @@
2650
2619
  }, []);
2651
2620
  const sectionNode = renderFoldableSection({ isUnfolded, onToggle });
2652
2621
  const buttonNode = renderFoldButton ? renderFoldButton({ isUnfolded, onToggle }) : null;
2653
- return isFoldButtonOnTop ? (jsxs(FoldableWrapper, { className: className, children: [buttonNode, sectionNode] })) : (jsxs(FoldableWrapper, { className: className, children: [sectionNode, buttonNode] }));
2622
+ return isFoldButtonOnTop ? (jsxs("div", { className: className, role: "group", children: [buttonNode, sectionNode] })) : (jsxs("div", { className: className, role: "group", children: [sectionNode, buttonNode] }));
2654
2623
  });
2655
2624
 
2656
2625
  function useResizeObserver(callback, deps) {
@@ -2919,12 +2888,8 @@
2919
2888
  }, [activeIndex]);
2920
2889
  const handleChange = useCallback((index) => (event) => {
2921
2890
  const { value } = event.currentTarget;
2922
- const isLastIndex = index === values.length - 1;
2923
- const isMultipleCharacters = value.length > 1;
2924
- if (isLastIndex && isMultipleCharacters) {
2925
- return;
2926
- }
2927
- setValues(values.map((_, i) => (i === index ? value : _)));
2891
+ const oneValue = value.slice(0, 1);
2892
+ setValues(values.map((_, i) => (i === index ? oneValue : _)));
2928
2893
  setActiveIndex(index + 1);
2929
2894
  }, [values]);
2930
2895
  const handleKeyDown = useCallback((currentIndex) => (event) => {
@@ -4755,37 +4720,31 @@
4755
4720
  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)] }) }) })));
4756
4721
  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;
4757
4722
 
4758
- const useSubjectState = (eventBus, type, initialState) => {
4759
- const [state, setState] = useState(initialState);
4760
- useEffect(() => eventBus.subscribe(type, setState), [eventBus, type]);
4761
- return state;
4762
- };
4763
-
4764
4723
  const renderCardInfo = (cell, i) => {
4765
4724
  const { title, description, buttons } = cell;
4766
4725
  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)));
4767
4726
  };
4768
4727
 
4769
- const CardCellsSection = JSX((props) => {
4770
- const { cardCells = [], visibleCellsCount = 1, isUnfolded } = props;
4771
- const [visibleCells, hiddenCells] = visibleCellsCount > 0 && cardCells.length >= visibleCellsCount
4772
- ? [cardCells.slice(0, visibleCellsCount), cardCells.slice(visibleCellsCount)]
4773
- : [cardCells, []];
4774
- 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) }));
4775
- });
4776
- 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" })] })));
4777
-
4778
- const carouselTariffsCardEventBus = new EventBus();
4779
-
4780
- const CarouselTariffsCard = JSX(({ className, title, align = 'text-center', icon, button, visibleCellsCount = 1, cardCells = [], options, data, ...rest }) => {
4781
- const { isUnfolded, parent: firedParent } = useSubjectState(carouselTariffsCardEventBus.observable, 'fold', {});
4782
- const isVisible = isUnfolded && firedParent === options?.parent;
4783
- const toggle = useCallback(() => carouselTariffsCardEventBus.emitter.fire('fold', {
4784
- isUnfolded: !isVisible,
4785
- parent: options?.parent,
4786
- }), [isVisible, options?.parent]);
4787
- 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 })] }));
4788
- });
4728
+ const CarouselTariffsCard = JSX(({ className = '', title, align = 'text-center', icon, button, visibleCellsCount = 1, cardCells = [], options, data, ...rest }) => {
4729
+ const cellsNode = cardCells.map(renderCardInfo);
4730
+ const [visibleCells, hiddenCells] = visibleCellsCount > 0
4731
+ ? [cellsNode.slice(0, visibleCellsCount), cellsNode.slice(visibleCellsCount)]
4732
+ : [cellsNode, []];
4733
+ const [isVisible, setIsVisible] = useState(false);
4734
+ useEffect(() => defaultEventBus.subscribe('fold', (event) => {
4735
+ if (options?.parent !== undefined && event.parent === options?.parent) {
4736
+ setIsVisible(event.isUnfolded);
4737
+ }
4738
+ }), [options?.parent]);
4739
+ 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
4740
+ ? renderFoldButton$3(options?.parent, data, isVisible)
4741
+ : null })) : (jsx("div", { children: visibleCells }))] }));
4742
+ });
4743
+ 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: () => {
4744
+ if (parent !== undefined) {
4745
+ defaultEventBus.fire('fold', { type: 'fold', isUnfolded: !isUnfolded, parent });
4746
+ }
4747
+ }, type: "button", ...(isUnfolded ? getAspectsAttributes(data) : {}), children: [jsx("div", { children: isUnfolded ? 'Скрыть' : 'Подробнее о тарифе' }), jsx(Icon, { className: "text-primary-text", name: isUnfolded ? 'ArrowUpIcon' : 'ArrowDownIcon', width: "16", height: "16" })] }));
4789
4748
 
4790
4749
  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] })));
4791
4750
  const renderBlocks = (info) => (jsx("div", { className: "flex gap-5xl grow basis-0", children: info.map((column, i) => renderBlocksColumn({ column, i })) }));
@@ -4957,46 +4916,47 @@
4957
4916
  };
4958
4917
  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] })));
4959
4918
 
4960
- function useSubject(eventBus, type, initialState) {
4961
- useEffect(() => {
4962
- const state = initialState instanceof Function ? initialState() : initialState;
4963
- if (state instanceof Promise) {
4964
- state.then((_) => eventBus.subject(type, _), console.warn);
4965
- }
4966
- else {
4967
- eventBus.subject(type, state);
4968
- }
4969
- }, [eventBus, type]);
4970
- return useCallback((_) => eventBus.fire(type, _), [eventBus, type]);
4971
- }
4919
+ const useLatestEvent = (eventBus, type, initialEvent) => {
4920
+ const [latestEvent, setLatestEvent] = useState(initialEvent || null);
4921
+ useEffect(() => eventBus.subscribe(type, (_) => setLatestEvent(_)), [eventBus, type]);
4922
+ const fireEvent = useCallback((_) => eventBus.fire(type, _), [eventBus, type]);
4923
+ return [latestEvent, fireEvent];
4924
+ };
4972
4925
 
4973
4926
  const REGION_URL = '/api/v1/region';
4974
4927
  const LOCATION_STORAGE_KEY = 'location';
4975
4928
  function useLocation(defaultLocation = 'Москва') {
4976
- useEffect(() => defaultEventBus.subscribe('location', storeLocation), []);
4977
- return useSubject(defaultEventBus.emitter, 'location', restoreLocation(defaultLocation));
4978
- }
4979
- function useLocationState(defaultLocation = 'Москва') {
4980
- return useSubjectState(defaultEventBus.observable, 'location', { name: defaultLocation });
4981
- }
4982
- function restoreLocation(defaultLocation) {
4983
- return async () => {
4984
- if (!globalThis.localStorage?.hasItem(LOCATION_STORAGE_KEY)) {
4985
- storeLocation(await fetchJSON(REGION_URL));
4986
- }
4987
- const storedLocation = globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY);
4988
- try {
4989
- return storedLocation && JSON.parse(storedLocation);
4990
- }
4991
- catch (ex) {
4992
- // Do nothing
4929
+ const [currentLocation, fireCurrentLocation] = useLatestEvent(defaultEventBus, 'location', restoreLocation() ?? { name: defaultLocation });
4930
+ const selectCurrentLocation = useCallback((_) => {
4931
+ storeLocation(_);
4932
+ fireCurrentLocation(_);
4933
+ }, []);
4934
+ const { data } = useAsyncData(hasStoredLocation() ? null : REGION_URL, fetchJSONUnsafe);
4935
+ useEffect(() => {
4936
+ if (data && !hasStoredLocation()) {
4937
+ fireCurrentLocation(data);
4993
4938
  }
4994
- return { name: defaultLocation };
4995
- };
4996
- }
4997
- function storeLocation(_) {
4998
- _ && globalThis.localStorage?.setItem(LOCATION_STORAGE_KEY, JSON.stringify(_));
4939
+ }, [data]);
4940
+ return [currentLocation ?? { name: defaultLocation }, selectCurrentLocation];
4999
4941
  }
4942
+ const hasStoredLocation = () => Boolean(globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY));
4943
+ const restoreLocation = () => {
4944
+ try {
4945
+ const data = globalThis.localStorage?.getItem(LOCATION_STORAGE_KEY);
4946
+ return data && JSON.parse(data);
4947
+ }
4948
+ catch (ex) {
4949
+ return null;
4950
+ }
4951
+ };
4952
+ const storeLocation = (_) => {
4953
+ try {
4954
+ globalThis.localStorage?.setItem(LOCATION_STORAGE_KEY, JSON.stringify(_));
4955
+ }
4956
+ catch (ex) {
4957
+ // Do nothing
4958
+ }
4959
+ };
5000
4960
 
5001
4961
  var Currency;
5002
4962
  (function (Currency) {
@@ -5138,7 +5098,7 @@
5138
5098
  }
5139
5099
 
5140
5100
  const ExchangeRateTile = JSX(({ className = '', title = 'Курсы обмена валют', button, ...rest }) => {
5141
- const currentLocation = useLocationState();
5101
+ const [currentLocation] = useLocation();
5142
5102
  const exchangeRates = useFetchExchangeRateData(currentLocation);
5143
5103
  const currencyRates = getCurrencyRates(exchangeRates?.exchangeRate?.currencies);
5144
5104
  const currencyRatesBuy = currencyRates.filter((_) => _.buyExchangeRate);
@@ -5677,33 +5637,27 @@
5677
5637
  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" })] }));
5678
5638
  });
5679
5639
 
5680
- const SelectedLocation = JSX(({ defaultLocation }) => {
5681
- const currentLocation = useLocationState(defaultLocation);
5682
- const link = useLink();
5683
- const { href } = link({ href: `/branches/${currentLocation.slug}` });
5684
- 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;
5685
- });
5686
-
5687
5640
  const SEARCH_TERM_MIN_LENGTH = 3;
5688
5641
  const LocationDialog = JSX(({ foreignOffices, branches }) => {
5689
- const selectLocation = useLocation(branches?.default);
5642
+ const [currentLocation, selectCurrentLocation] = useLocation(branches?.default);
5643
+ const link = useLink();
5644
+ const { href } = link({ href: `/branches/${currentLocation.slug}` });
5690
5645
  const [query, setQuery] = useState('');
5691
- const rawRegions = useRegions();
5692
- const regions = useMemo(() => cleanUpRegions(rawRegions).sort((a, b) => (a.name ?? '').localeCompare(b.name ?? '')), [rawRegions]);
5693
- const regionsGroupByLetter = useMemo(() => groupBy(regions, regionFirstLetter), [regions]);
5646
+ const regions = cleanUpRegions(useRegions()).sort((a, b) => a.name.localeCompare(b.name));
5647
+ const regionsGroupByLetter = groupBy(regions, regionFirstLetter);
5694
5648
  const { close } = useDialogManager();
5695
5649
  const handleChangeLocation = useCallback((region) => {
5696
- selectLocation(region);
5650
+ selectCurrentLocation(region);
5697
5651
  close();
5698
5652
  }, []);
5699
- 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
5653
+ 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
5700
5654
  .filter(({ name }) => name && jaroWinklerDistance(name.toLowerCase())(query.toLowerCase()) >= 0.8)
5701
5655
  .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)] }));
5702
5656
  });
5703
- const regionFirstLetter = (region) => region.name?.charAt(0) ?? '';
5657
+ const regionFirstLetter = (region) => region.name?.charAt(0) || '';
5704
5658
  const cleanUpRegions = (regions) => regions.map((region) => ({
5705
5659
  ...region,
5706
- name: region.name?.replace(/республика|область|край'/gi, '').trim() ?? '',
5660
+ name: region.name?.replace(/республика|область|край'/gi, '').trim() || '',
5707
5661
  }));
5708
5662
 
5709
5663
  const useLocationDialog = (props) => {
@@ -5731,7 +5685,7 @@
5731
5685
 
5732
5686
  const HeaderSecondaryMenu = JSX(({ className, version, ...rest }) => {
5733
5687
  const iconVersion = version === 'transparent' ? 'white' : 'black';
5734
- const currentLocation = useLocationState(rest?.branches?.default);
5688
+ const [currentLocation] = useLocation(rest?.branches?.default);
5735
5689
  const searchDialog = useSearchDialog(rest);
5736
5690
  const locationDialog = useLocationDialog(rest);
5737
5691
  const openSearchDialog = useCallback(() => searchDialog.open(), [searchDialog]);
@@ -6570,7 +6524,7 @@
6570
6524
  designDisabledPeople: (item) => Boolean(item.designDisabledPeople),
6571
6525
  };
6572
6526
  const AtmsMap = JSX(({ descriptionData, className }) => {
6573
- const currentLocation = useLocationState();
6527
+ const [currentLocation] = useLocation();
6574
6528
  const regionCode = currentLocation?.code ?? '000';
6575
6529
  const { data: officesData, isLoad } = useAtms(regionCode);
6576
6530
  return (jsx(OfficesAtmsMapLayout, { className: className, filterItems: filterItems, data: officesData, isLoad: isLoad, initFilterState: INITIAL_FILTRATION_STATE, renderCard: renderAtmCard, getBalloon: getAtmPoint, title: `Банкоматы филиала ${currentLocation?.name}`, descriptionData: descriptionData }));
@@ -6789,7 +6743,7 @@
6789
6743
  };
6790
6744
 
6791
6745
  const OfficesMap = JSX(({ className }) => {
6792
- const currentLocation = useLocationState();
6746
+ const [currentLocation] = useLocation();
6793
6747
  const regionCode = currentLocation?.code ?? '000';
6794
6748
  const { data, isLoad } = useOffices(regionCode);
6795
6749
  return (jsx(OfficesAtmsMapLayout, { className: className, data: data?.branches, isLoad: isLoad, remoteWorkplaces: data?.remoteWorkplaces, renderCard: renderOfficeCard, renderRemoteWorkplaceCard: renderRemoteWorkplaceCard, getBalloon: getOfficePoint, getBalloonRemoteWorkplaces: getRemoteWorkplacePoint, title: `Офисы филиала ${currentLocation?.name}` }));
@@ -7473,7 +7427,7 @@
7473
7427
  onClose && onClose(dialogs[dialogs.length - 1]);
7474
7428
  pop();
7475
7429
  }, [dialogs, onClose]);
7476
- useEffect(() => defaultEventBus.observable.subscribe('dialog', (action) => {
7430
+ useEffect(() => defaultEventBus.subscribe('dialog', (action) => {
7477
7431
  switch (action.type) {
7478
7432
  case 'open':
7479
7433
  push(action);
@@ -7530,7 +7484,7 @@
7530
7484
  const close = useCallback(() => {
7531
7485
  setPopup(null);
7532
7486
  }, []);
7533
- useEffect(() => defaultEventBus.observable.subscribe('popup', (action) => {
7487
+ useEffect(() => defaultEventBus.subscribe('popup', (action) => {
7534
7488
  switch (action.type) {
7535
7489
  case 'open':
7536
7490
  case 'update':
@@ -7585,7 +7539,7 @@
7585
7539
  slots: () => [HEADER_SLOT, FOOTER_SLOT, STICKY_FOOTER_SLOT],
7586
7540
  });
7587
7541
 
7588
- const packageVersion = "0.14.598";
7542
+ const packageVersion = "0.14.600";
7589
7543
 
7590
7544
  exports.Blocks = Blocks;
7591
7545
  exports.ContentPage = ContentPage;