@redneckz/wildless-cms-uni-blocks 0.14.124 → 0.14.126

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 (347) hide show
  1. package/bundle/blocks.schema.json +1 -1
  2. package/bundle/bundle.umd.js +12 -11
  3. package/bundle/bundle.umd.min.js +1 -1
  4. package/bundle/components/Header/Header.fallback.d.ts +2 -1
  5. package/bundle/hooks/fallbackWCMSResource.d.ts +1 -1
  6. package/bundle/hooks/useSWRResource.d.ts +1 -2
  7. package/bundle/{components → ui-kit}/StickyBottomMenu/TopItemMobile.d.ts +1 -1
  8. package/dist/components/Blocks.js +0 -2
  9. package/dist/components/Blocks.js.map +1 -1
  10. package/dist/components/Blocks.mobile.js +0 -2
  11. package/dist/components/Blocks.mobile.js.map +1 -1
  12. package/{mobile/dist/components/StickyBottomMenu/StickyBottomMenu.fallback.js → dist/components/ContentPage/ContentPage.fallback.js} +2 -2
  13. package/dist/components/ContentPage/ContentPage.fallback.js.map +1 -0
  14. package/dist/components/ContentPage/ContentPage.js +3 -3
  15. package/dist/components/ContentPage/ContentPage.js.map +1 -1
  16. package/dist/components/ContentPage/computeAPIFallback.js +1 -1
  17. package/dist/components/ContentPage/computeAPIFallback.js.map +1 -1
  18. package/dist/components/Header/Header.fallback.d.ts +2 -1
  19. package/dist/components/Header/Header.fallback.js +4 -1
  20. package/dist/components/Header/Header.fallback.js.map +1 -1
  21. package/dist/components/Header/Header.js +5 -1
  22. package/dist/components/Header/Header.js.map +1 -1
  23. package/dist/components/Header/Header.mobile.js +5 -1
  24. package/dist/components/Header/Header.mobile.js.map +1 -1
  25. package/dist/hooks/fallbackWCMSResource.d.ts +1 -1
  26. package/dist/hooks/fallbackWCMSResource.js +3 -2
  27. package/dist/hooks/fallbackWCMSResource.js.map +1 -1
  28. package/dist/hooks/useSWRResource.d.ts +1 -2
  29. package/dist/hooks/useSWRResource.js +3 -6
  30. package/dist/hooks/useSWRResource.js.map +1 -1
  31. package/dist/ui-kit/StickyBottomMenu/ActiveSubMenu.js.map +1 -0
  32. package/dist/{components → ui-kit}/StickyBottomMenu/ActiveSubMenuItem.js +2 -2
  33. package/dist/ui-kit/StickyBottomMenu/ActiveSubMenuItem.js.map +1 -0
  34. package/dist/{components → ui-kit}/StickyBottomMenu/BurgerMenuDialog.js +8 -8
  35. package/dist/ui-kit/StickyBottomMenu/BurgerMenuDialog.js.map +1 -0
  36. package/dist/ui-kit/StickyBottomMenu/StickyBottomMenu.js +5 -0
  37. package/dist/ui-kit/StickyBottomMenu/StickyBottomMenu.js.map +1 -0
  38. package/dist/{components → ui-kit}/StickyBottomMenu/StickyBottomMenu.mobile.js +7 -3
  39. package/dist/ui-kit/StickyBottomMenu/StickyBottomMenu.mobile.js.map +1 -0
  40. package/{mobile/dist/components → dist/ui-kit}/StickyBottomMenu/StickyBottomMenuBurger.js +1 -1
  41. package/dist/ui-kit/StickyBottomMenu/StickyBottomMenuBurger.js.map +1 -0
  42. package/dist/ui-kit/StickyBottomMenu/StickyBottomMenuContent.js.map +1 -0
  43. package/{mobile/dist/components → dist/ui-kit}/StickyBottomMenu/StickyBottomMenuItem.js +1 -1
  44. package/dist/ui-kit/StickyBottomMenu/StickyBottomMenuItem.js.map +1 -0
  45. package/dist/ui-kit/StickyBottomMenu/StickyBottomMenuProps.js.map +1 -0
  46. package/dist/{components → ui-kit}/StickyBottomMenu/TopItemMobile.d.ts +1 -1
  47. package/dist/ui-kit/StickyBottomMenu/TopItemMobile.js.map +1 -0
  48. package/dist/{components → ui-kit}/StickyBottomMenu/useBurgerMenuDialog.js +3 -3
  49. package/dist/ui-kit/StickyBottomMenu/useBurgerMenuDialog.js.map +1 -0
  50. package/lib/common.css +1 -1
  51. package/lib/components/Blocks.js +0 -2
  52. package/lib/components/Blocks.js.map +1 -1
  53. package/lib/components/Blocks.mobile.js +0 -2
  54. package/lib/components/Blocks.mobile.js.map +1 -1
  55. package/lib/components/{StickyBottomMenu/StickyBottomMenu.fallback.js → ContentPage/ContentPage.fallback.js} +2 -2
  56. package/lib/components/ContentPage/ContentPage.fallback.js.map +1 -0
  57. package/lib/components/ContentPage/ContentPage.js +3 -3
  58. package/lib/components/ContentPage/ContentPage.js.map +1 -1
  59. package/lib/components/ContentPage/computeAPIFallback.js +1 -1
  60. package/lib/components/ContentPage/computeAPIFallback.js.map +1 -1
  61. package/lib/components/Header/Header.fallback.d.ts +2 -1
  62. package/lib/components/Header/Header.fallback.js +4 -1
  63. package/lib/components/Header/Header.fallback.js.map +1 -1
  64. package/lib/components/Header/Header.js +5 -1
  65. package/lib/components/Header/Header.js.map +1 -1
  66. package/lib/components/Header/Header.mobile.js +5 -1
  67. package/lib/components/Header/Header.mobile.js.map +1 -1
  68. package/lib/hooks/fallbackWCMSResource.d.ts +1 -1
  69. package/lib/hooks/fallbackWCMSResource.js +3 -2
  70. package/lib/hooks/fallbackWCMSResource.js.map +1 -1
  71. package/lib/hooks/useSWRResource.d.ts +1 -2
  72. package/lib/hooks/useSWRResource.js +3 -6
  73. package/lib/hooks/useSWRResource.js.map +1 -1
  74. package/lib/ui-kit/StickyBottomMenu/ActiveSubMenu.js.map +1 -0
  75. package/{mobile/lib/components → lib/ui-kit}/StickyBottomMenu/ActiveSubMenuItem.js +2 -2
  76. package/lib/ui-kit/StickyBottomMenu/ActiveSubMenuItem.js.map +1 -0
  77. package/{mobile/lib/components → lib/ui-kit}/StickyBottomMenu/BurgerMenuDialog.js +8 -8
  78. package/lib/ui-kit/StickyBottomMenu/BurgerMenuDialog.js.map +1 -0
  79. package/lib/ui-kit/StickyBottomMenu/StickyBottomMenu.js +3 -0
  80. package/lib/ui-kit/StickyBottomMenu/StickyBottomMenu.js.map +1 -0
  81. package/lib/{components → ui-kit}/StickyBottomMenu/StickyBottomMenu.mobile.js +7 -3
  82. package/lib/ui-kit/StickyBottomMenu/StickyBottomMenu.mobile.js.map +1 -0
  83. package/{mobile/lib/components → lib/ui-kit}/StickyBottomMenu/StickyBottomMenuBurger.js +1 -1
  84. package/lib/ui-kit/StickyBottomMenu/StickyBottomMenuBurger.js.map +1 -0
  85. package/lib/ui-kit/StickyBottomMenu/StickyBottomMenuContent.js.map +1 -0
  86. package/{mobile/lib/components → lib/ui-kit}/StickyBottomMenu/StickyBottomMenuItem.js +1 -1
  87. package/lib/ui-kit/StickyBottomMenu/StickyBottomMenuItem.js.map +1 -0
  88. package/lib/ui-kit/StickyBottomMenu/StickyBottomMenuProps.js.map +1 -0
  89. package/lib/{components → ui-kit}/StickyBottomMenu/TopItemMobile.d.ts +1 -1
  90. package/lib/ui-kit/StickyBottomMenu/TopItemMobile.js.map +1 -0
  91. package/lib/{components → ui-kit}/StickyBottomMenu/useBurgerMenuDialog.js +3 -3
  92. package/lib/ui-kit/StickyBottomMenu/useBurgerMenuDialog.js.map +1 -0
  93. package/mobile/bundle/bundle.umd.js +708 -703
  94. package/mobile/bundle/bundle.umd.min.js +1 -1
  95. package/mobile/bundle/components/Header/Header.fallback.d.ts +2 -1
  96. package/mobile/bundle/hooks/fallbackWCMSResource.d.ts +1 -1
  97. package/mobile/bundle/hooks/useSWRResource.d.ts +1 -2
  98. package/mobile/bundle/{components → ui-kit}/StickyBottomMenu/TopItemMobile.d.ts +1 -1
  99. package/mobile/dist/components/Blocks.js +0 -2
  100. package/mobile/dist/components/Blocks.js.map +1 -1
  101. package/{dist/components/StickyBottomMenu/StickyBottomMenu.fallback.js → mobile/dist/components/ContentPage/ContentPage.fallback.js} +2 -2
  102. package/mobile/dist/components/ContentPage/ContentPage.fallback.js.map +1 -0
  103. package/mobile/dist/components/ContentPage/ContentPage.js +3 -3
  104. package/mobile/dist/components/ContentPage/ContentPage.js.map +1 -1
  105. package/mobile/dist/components/ContentPage/computeAPIFallback.js +1 -1
  106. package/mobile/dist/components/ContentPage/computeAPIFallback.js.map +1 -1
  107. package/mobile/dist/components/Header/Header.fallback.d.ts +2 -1
  108. package/mobile/dist/components/Header/Header.fallback.js +4 -1
  109. package/mobile/dist/components/Header/Header.fallback.js.map +1 -1
  110. package/mobile/dist/components/Header/Header.js +5 -1
  111. package/mobile/dist/components/Header/Header.js.map +1 -1
  112. package/mobile/dist/hooks/fallbackWCMSResource.d.ts +1 -1
  113. package/mobile/dist/hooks/fallbackWCMSResource.js +3 -2
  114. package/mobile/dist/hooks/fallbackWCMSResource.js.map +1 -1
  115. package/mobile/dist/hooks/useSWRResource.d.ts +1 -2
  116. package/mobile/dist/hooks/useSWRResource.js +3 -6
  117. package/mobile/dist/hooks/useSWRResource.js.map +1 -1
  118. package/mobile/dist/ui-kit/StickyBottomMenu/ActiveSubMenu.js.map +1 -0
  119. package/mobile/dist/{components → ui-kit}/StickyBottomMenu/ActiveSubMenuItem.js +2 -2
  120. package/mobile/dist/ui-kit/StickyBottomMenu/ActiveSubMenuItem.js.map +1 -0
  121. package/mobile/dist/{components → ui-kit}/StickyBottomMenu/BurgerMenuDialog.js +8 -8
  122. package/mobile/dist/ui-kit/StickyBottomMenu/BurgerMenuDialog.js.map +1 -0
  123. package/mobile/dist/{components → ui-kit}/StickyBottomMenu/StickyBottomMenu.js +7 -3
  124. package/mobile/dist/ui-kit/StickyBottomMenu/StickyBottomMenu.js.map +1 -0
  125. package/{dist/components → mobile/dist/ui-kit}/StickyBottomMenu/StickyBottomMenuBurger.js +1 -1
  126. package/mobile/dist/ui-kit/StickyBottomMenu/StickyBottomMenuBurger.js.map +1 -0
  127. package/mobile/dist/ui-kit/StickyBottomMenu/StickyBottomMenuContent.js.map +1 -0
  128. package/{dist/components → mobile/dist/ui-kit}/StickyBottomMenu/StickyBottomMenuItem.js +1 -1
  129. package/mobile/dist/ui-kit/StickyBottomMenu/StickyBottomMenuItem.js.map +1 -0
  130. package/mobile/dist/ui-kit/StickyBottomMenu/StickyBottomMenuProps.js.map +1 -0
  131. package/mobile/dist/{components → ui-kit}/StickyBottomMenu/TopItemMobile.d.ts +1 -1
  132. package/mobile/dist/ui-kit/StickyBottomMenu/TopItemMobile.js.map +1 -0
  133. package/mobile/dist/{components → ui-kit}/StickyBottomMenu/useBurgerMenuDialog.js +3 -3
  134. package/mobile/dist/ui-kit/StickyBottomMenu/useBurgerMenuDialog.js.map +1 -0
  135. package/mobile/lib/common.css +1 -1
  136. package/mobile/lib/components/Blocks.js +0 -2
  137. package/mobile/lib/components/Blocks.js.map +1 -1
  138. package/mobile/lib/components/{StickyBottomMenu/StickyBottomMenu.fallback.js → ContentPage/ContentPage.fallback.js} +2 -2
  139. package/mobile/lib/components/ContentPage/ContentPage.fallback.js.map +1 -0
  140. package/mobile/lib/components/ContentPage/ContentPage.js +3 -3
  141. package/mobile/lib/components/ContentPage/ContentPage.js.map +1 -1
  142. package/mobile/lib/components/ContentPage/computeAPIFallback.js +1 -1
  143. package/mobile/lib/components/ContentPage/computeAPIFallback.js.map +1 -1
  144. package/mobile/lib/components/Header/Header.fallback.d.ts +2 -1
  145. package/mobile/lib/components/Header/Header.fallback.js +4 -1
  146. package/mobile/lib/components/Header/Header.fallback.js.map +1 -1
  147. package/mobile/lib/components/Header/Header.js +5 -1
  148. package/mobile/lib/components/Header/Header.js.map +1 -1
  149. package/mobile/lib/hooks/fallbackWCMSResource.d.ts +1 -1
  150. package/mobile/lib/hooks/fallbackWCMSResource.js +3 -2
  151. package/mobile/lib/hooks/fallbackWCMSResource.js.map +1 -1
  152. package/mobile/lib/hooks/useSWRResource.d.ts +1 -2
  153. package/mobile/lib/hooks/useSWRResource.js +3 -6
  154. package/mobile/lib/hooks/useSWRResource.js.map +1 -1
  155. package/mobile/lib/ui-kit/StickyBottomMenu/ActiveSubMenu.js.map +1 -0
  156. package/{lib/components → mobile/lib/ui-kit}/StickyBottomMenu/ActiveSubMenuItem.js +2 -2
  157. package/mobile/lib/ui-kit/StickyBottomMenu/ActiveSubMenuItem.js.map +1 -0
  158. package/{lib/components → mobile/lib/ui-kit}/StickyBottomMenu/BurgerMenuDialog.js +8 -8
  159. package/mobile/lib/ui-kit/StickyBottomMenu/BurgerMenuDialog.js.map +1 -0
  160. package/mobile/lib/{components → ui-kit}/StickyBottomMenu/StickyBottomMenu.js +7 -3
  161. package/mobile/lib/ui-kit/StickyBottomMenu/StickyBottomMenu.js.map +1 -0
  162. package/{lib/components → mobile/lib/ui-kit}/StickyBottomMenu/StickyBottomMenuBurger.js +1 -1
  163. package/mobile/lib/ui-kit/StickyBottomMenu/StickyBottomMenuBurger.js.map +1 -0
  164. package/mobile/lib/ui-kit/StickyBottomMenu/StickyBottomMenuContent.js.map +1 -0
  165. package/{lib/components → mobile/lib/ui-kit}/StickyBottomMenu/StickyBottomMenuItem.js +1 -1
  166. package/mobile/lib/ui-kit/StickyBottomMenu/StickyBottomMenuItem.js.map +1 -0
  167. package/mobile/lib/ui-kit/StickyBottomMenu/StickyBottomMenuProps.js.map +1 -0
  168. package/mobile/lib/ui-kit/StickyBottomMenu/TopItemMobile.d.ts +10 -0
  169. package/mobile/lib/ui-kit/StickyBottomMenu/TopItemMobile.js.map +1 -0
  170. package/mobile/lib/{components → ui-kit}/StickyBottomMenu/useBurgerMenuDialog.js +3 -3
  171. package/mobile/lib/ui-kit/StickyBottomMenu/useBurgerMenuDialog.js.map +1 -0
  172. package/mobile/src/components/Blocks.ts +0 -2
  173. package/mobile/src/components/{StickyBottomMenu/StickyBottomMenu.fallback.ts → ContentPage/ContentPage.fallback.ts} +1 -0
  174. package/mobile/src/components/ContentPage/ContentPage.tsx +3 -3
  175. package/mobile/src/components/ContentPage/computeAPIFallback.ts +3 -1
  176. package/mobile/src/components/Header/Header.fallback.ts +10 -1
  177. package/mobile/src/components/Header/Header.tsx +5 -1
  178. package/mobile/src/hooks/fallbackWCMSResource.ts +3 -1
  179. package/mobile/src/hooks/useSWRResource.ts +4 -14
  180. package/mobile/src/{components → ui-kit}/StickyBottomMenu/ActiveSubMenuItem.tsx +2 -2
  181. package/mobile/src/{components → ui-kit}/StickyBottomMenu/BurgerMenuDialog.tsx +8 -8
  182. package/mobile/src/{components → ui-kit}/StickyBottomMenu/StickyBottomMenu.tsx +9 -10
  183. package/{src/components → mobile/src/ui-kit}/StickyBottomMenu/StickyBottomMenuBurger.tsx +1 -1
  184. package/mobile/src/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuItem.tsx +1 -1
  185. package/mobile/src/{components → ui-kit}/StickyBottomMenu/TopItemMobile.tsx +1 -1
  186. package/mobile/src/{components → ui-kit}/StickyBottomMenu/useBurgerMenuDialog.tsx +3 -3
  187. package/package.json +1 -1
  188. package/src/components/Blocks.mobile.ts +0 -2
  189. package/src/components/Blocks.ts +0 -2
  190. package/src/components/{StickyBottomMenu/StickyBottomMenu.fallback.ts → ContentPage/ContentPage.fallback.ts} +1 -0
  191. package/src/components/ContentPage/ContentPage.tsx +3 -3
  192. package/src/components/ContentPage/computeAPIFallback.ts +3 -1
  193. package/src/components/Header/Header.fallback.ts +10 -1
  194. package/src/components/Header/Header.mobile.tsx +5 -1
  195. package/src/components/Header/Header.tsx +5 -1
  196. package/src/hooks/fallbackWCMSResource.ts +3 -1
  197. package/src/hooks/useSWRResource.ts +4 -14
  198. package/src/{components → ui-kit}/StickyBottomMenu/ActiveSubMenuItem.tsx +2 -2
  199. package/src/{components → ui-kit}/StickyBottomMenu/BurgerMenuDialog.tsx +8 -8
  200. package/src/{components → ui-kit}/StickyBottomMenu/StickyBottomMenu.mobile.tsx +9 -10
  201. package/src/{components → ui-kit}/StickyBottomMenu/StickyBottomMenu.tsx +1 -1
  202. package/{mobile/src/components → src/ui-kit}/StickyBottomMenu/StickyBottomMenuBurger.tsx +1 -1
  203. package/src/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuItem.tsx +1 -1
  204. package/src/{components → ui-kit}/StickyBottomMenu/TopItemMobile.tsx +1 -1
  205. package/src/{components → ui-kit}/StickyBottomMenu/useBurgerMenuDialog.tsx +3 -3
  206. package/dist/components/StickyBottomMenu/ActiveSubMenu.js.map +0 -1
  207. package/dist/components/StickyBottomMenu/ActiveSubMenuItem.js.map +0 -1
  208. package/dist/components/StickyBottomMenu/BurgerMenuDialog.js.map +0 -1
  209. package/dist/components/StickyBottomMenu/StickyBottomMenu.fallback.js.map +0 -1
  210. package/dist/components/StickyBottomMenu/StickyBottomMenu.js +0 -6
  211. package/dist/components/StickyBottomMenu/StickyBottomMenu.js.map +0 -1
  212. package/dist/components/StickyBottomMenu/StickyBottomMenu.mobile.js.map +0 -1
  213. package/dist/components/StickyBottomMenu/StickyBottomMenuBurger.js.map +0 -1
  214. package/dist/components/StickyBottomMenu/StickyBottomMenuContent.js.map +0 -1
  215. package/dist/components/StickyBottomMenu/StickyBottomMenuItem.js.map +0 -1
  216. package/dist/components/StickyBottomMenu/StickyBottomMenuProps.js.map +0 -1
  217. package/dist/components/StickyBottomMenu/TopItemMobile.js.map +0 -1
  218. package/dist/components/StickyBottomMenu/useBurgerMenuDialog.js.map +0 -1
  219. package/lib/components/StickyBottomMenu/ActiveSubMenu.js.map +0 -1
  220. package/lib/components/StickyBottomMenu/ActiveSubMenuItem.js.map +0 -1
  221. package/lib/components/StickyBottomMenu/BurgerMenuDialog.js.map +0 -1
  222. package/lib/components/StickyBottomMenu/StickyBottomMenu.fallback.js.map +0 -1
  223. package/lib/components/StickyBottomMenu/StickyBottomMenu.fixture.d.ts +0 -8
  224. package/lib/components/StickyBottomMenu/StickyBottomMenu.js +0 -4
  225. package/lib/components/StickyBottomMenu/StickyBottomMenu.js.map +0 -1
  226. package/lib/components/StickyBottomMenu/StickyBottomMenu.mobile.js.map +0 -1
  227. package/lib/components/StickyBottomMenu/StickyBottomMenuBurger.js.map +0 -1
  228. package/lib/components/StickyBottomMenu/StickyBottomMenuContent.js.map +0 -1
  229. package/lib/components/StickyBottomMenu/StickyBottomMenuItem.js.map +0 -1
  230. package/lib/components/StickyBottomMenu/StickyBottomMenuProps.js.map +0 -1
  231. package/lib/components/StickyBottomMenu/TopItemMobile.js.map +0 -1
  232. package/lib/components/StickyBottomMenu/useBurgerMenuDialog.js.map +0 -1
  233. package/mobile/dist/components/StickyBottomMenu/ActiveSubMenu.js.map +0 -1
  234. package/mobile/dist/components/StickyBottomMenu/ActiveSubMenuItem.js.map +0 -1
  235. package/mobile/dist/components/StickyBottomMenu/BurgerMenuDialog.js.map +0 -1
  236. package/mobile/dist/components/StickyBottomMenu/StickyBottomMenu.fallback.js.map +0 -1
  237. package/mobile/dist/components/StickyBottomMenu/StickyBottomMenu.js.map +0 -1
  238. package/mobile/dist/components/StickyBottomMenu/StickyBottomMenuBurger.js.map +0 -1
  239. package/mobile/dist/components/StickyBottomMenu/StickyBottomMenuContent.js.map +0 -1
  240. package/mobile/dist/components/StickyBottomMenu/StickyBottomMenuItem.js.map +0 -1
  241. package/mobile/dist/components/StickyBottomMenu/StickyBottomMenuProps.js.map +0 -1
  242. package/mobile/dist/components/StickyBottomMenu/TopItemMobile.js.map +0 -1
  243. package/mobile/dist/components/StickyBottomMenu/useBurgerMenuDialog.js.map +0 -1
  244. package/mobile/lib/components/StickyBottomMenu/ActiveSubMenu.js.map +0 -1
  245. package/mobile/lib/components/StickyBottomMenu/ActiveSubMenuItem.js.map +0 -1
  246. package/mobile/lib/components/StickyBottomMenu/BurgerMenuDialog.js.map +0 -1
  247. package/mobile/lib/components/StickyBottomMenu/StickyBottomMenu.fallback.js.map +0 -1
  248. package/mobile/lib/components/StickyBottomMenu/StickyBottomMenu.js.map +0 -1
  249. package/mobile/lib/components/StickyBottomMenu/StickyBottomMenuBurger.js.map +0 -1
  250. package/mobile/lib/components/StickyBottomMenu/StickyBottomMenuContent.js.map +0 -1
  251. package/mobile/lib/components/StickyBottomMenu/StickyBottomMenuItem.js.map +0 -1
  252. package/mobile/lib/components/StickyBottomMenu/StickyBottomMenuProps.js.map +0 -1
  253. package/mobile/lib/components/StickyBottomMenu/TopItemMobile.d.ts +0 -10
  254. package/mobile/lib/components/StickyBottomMenu/TopItemMobile.js.map +0 -1
  255. package/mobile/lib/components/StickyBottomMenu/useBurgerMenuDialog.js.map +0 -1
  256. package/mobile/src/components/StickyBottomMenu/StickyBottomMenu.example.json +0 -35
  257. package/mobile/src/components/StickyBottomMenu/StickyBottomMenu.ui.json +0 -11
  258. package/src/components/StickyBottomMenu/StickyBottomMenu.example.json +0 -35
  259. package/src/components/StickyBottomMenu/StickyBottomMenu.fixture.tsx +0 -37
  260. package/src/components/StickyBottomMenu/StickyBottomMenu.ui.json +0 -11
  261. /package/bundle/components/{StickyBottomMenu/StickyBottomMenu.fallback.d.ts → ContentPage/ContentPage.fallback.d.ts} +0 -0
  262. /package/bundle/{components → ui-kit}/StickyBottomMenu/ActiveSubMenu.d.ts +0 -0
  263. /package/bundle/{components → ui-kit}/StickyBottomMenu/ActiveSubMenuItem.d.ts +0 -0
  264. /package/bundle/{components → ui-kit}/StickyBottomMenu/BurgerMenuDialog.d.ts +0 -0
  265. /package/bundle/{components → ui-kit}/StickyBottomMenu/StickyBottomMenu.d.ts +0 -0
  266. /package/bundle/{components → ui-kit}/StickyBottomMenu/StickyBottomMenu.mobile.d.ts +0 -0
  267. /package/bundle/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuBurger.d.ts +0 -0
  268. /package/bundle/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuContent.d.ts +0 -0
  269. /package/bundle/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuItem.d.ts +0 -0
  270. /package/bundle/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuProps.d.ts +0 -0
  271. /package/bundle/{components → ui-kit}/StickyBottomMenu/useBurgerMenuDialog.d.ts +0 -0
  272. /package/dist/components/{StickyBottomMenu/StickyBottomMenu.fallback.d.ts → ContentPage/ContentPage.fallback.d.ts} +0 -0
  273. /package/dist/{components → ui-kit}/StickyBottomMenu/ActiveSubMenu.d.ts +0 -0
  274. /package/dist/{components → ui-kit}/StickyBottomMenu/ActiveSubMenu.js +0 -0
  275. /package/dist/{components → ui-kit}/StickyBottomMenu/ActiveSubMenuItem.d.ts +0 -0
  276. /package/dist/{components → ui-kit}/StickyBottomMenu/BurgerMenuDialog.d.ts +0 -0
  277. /package/dist/{components → ui-kit}/StickyBottomMenu/StickyBottomMenu.d.ts +0 -0
  278. /package/dist/{components → ui-kit}/StickyBottomMenu/StickyBottomMenu.mobile.d.ts +0 -0
  279. /package/dist/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuBurger.d.ts +0 -0
  280. /package/dist/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuContent.d.ts +0 -0
  281. /package/dist/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuContent.js +0 -0
  282. /package/dist/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuItem.d.ts +0 -0
  283. /package/dist/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuProps.d.ts +0 -0
  284. /package/dist/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuProps.js +0 -0
  285. /package/dist/{components → ui-kit}/StickyBottomMenu/TopItemMobile.js +0 -0
  286. /package/dist/{components → ui-kit}/StickyBottomMenu/useBurgerMenuDialog.d.ts +0 -0
  287. /package/lib/components/{StickyBottomMenu/StickyBottomMenu.fallback.d.ts → ContentPage/ContentPage.fallback.d.ts} +0 -0
  288. /package/lib/{components → ui-kit}/StickyBottomMenu/ActiveSubMenu.d.ts +0 -0
  289. /package/lib/{components → ui-kit}/StickyBottomMenu/ActiveSubMenu.js +0 -0
  290. /package/lib/{components → ui-kit}/StickyBottomMenu/ActiveSubMenuItem.d.ts +0 -0
  291. /package/lib/{components → ui-kit}/StickyBottomMenu/BurgerMenuDialog.d.ts +0 -0
  292. /package/lib/{components → ui-kit}/StickyBottomMenu/StickyBottomMenu.d.ts +0 -0
  293. /package/lib/{components → ui-kit}/StickyBottomMenu/StickyBottomMenu.fixture.mobile.d.ts +0 -0
  294. /package/lib/{components → ui-kit}/StickyBottomMenu/StickyBottomMenu.mobile.d.ts +0 -0
  295. /package/lib/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuBurger.d.ts +0 -0
  296. /package/lib/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuContent.d.ts +0 -0
  297. /package/lib/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuContent.js +0 -0
  298. /package/lib/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuItem.d.ts +0 -0
  299. /package/lib/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuProps.d.ts +0 -0
  300. /package/lib/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuProps.js +0 -0
  301. /package/lib/{components → ui-kit}/StickyBottomMenu/TopItemMobile.js +0 -0
  302. /package/lib/{components → ui-kit}/StickyBottomMenu/useBurgerMenuDialog.d.ts +0 -0
  303. /package/mobile/bundle/components/{StickyBottomMenu/StickyBottomMenu.fallback.d.ts → ContentPage/ContentPage.fallback.d.ts} +0 -0
  304. /package/mobile/bundle/{components → ui-kit}/StickyBottomMenu/ActiveSubMenu.d.ts +0 -0
  305. /package/mobile/bundle/{components → ui-kit}/StickyBottomMenu/ActiveSubMenuItem.d.ts +0 -0
  306. /package/mobile/bundle/{components → ui-kit}/StickyBottomMenu/BurgerMenuDialog.d.ts +0 -0
  307. /package/mobile/bundle/{components → ui-kit}/StickyBottomMenu/StickyBottomMenu.d.ts +0 -0
  308. /package/mobile/bundle/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuBurger.d.ts +0 -0
  309. /package/mobile/bundle/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuContent.d.ts +0 -0
  310. /package/mobile/bundle/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuItem.d.ts +0 -0
  311. /package/mobile/bundle/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuProps.d.ts +0 -0
  312. /package/mobile/bundle/{components → ui-kit}/StickyBottomMenu/useBurgerMenuDialog.d.ts +0 -0
  313. /package/mobile/dist/components/{StickyBottomMenu/StickyBottomMenu.fallback.d.ts → ContentPage/ContentPage.fallback.d.ts} +0 -0
  314. /package/mobile/dist/{components → ui-kit}/StickyBottomMenu/ActiveSubMenu.d.ts +0 -0
  315. /package/mobile/dist/{components → ui-kit}/StickyBottomMenu/ActiveSubMenu.js +0 -0
  316. /package/mobile/dist/{components → ui-kit}/StickyBottomMenu/ActiveSubMenuItem.d.ts +0 -0
  317. /package/mobile/dist/{components → ui-kit}/StickyBottomMenu/BurgerMenuDialog.d.ts +0 -0
  318. /package/mobile/dist/{components → ui-kit}/StickyBottomMenu/StickyBottomMenu.d.ts +0 -0
  319. /package/mobile/dist/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuBurger.d.ts +0 -0
  320. /package/mobile/dist/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuContent.d.ts +0 -0
  321. /package/mobile/dist/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuContent.js +0 -0
  322. /package/mobile/dist/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuItem.d.ts +0 -0
  323. /package/mobile/dist/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuProps.d.ts +0 -0
  324. /package/mobile/dist/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuProps.js +0 -0
  325. /package/mobile/dist/{components → ui-kit}/StickyBottomMenu/TopItemMobile.js +0 -0
  326. /package/mobile/dist/{components → ui-kit}/StickyBottomMenu/useBurgerMenuDialog.d.ts +0 -0
  327. /package/mobile/lib/components/{StickyBottomMenu/StickyBottomMenu.fallback.d.ts → ContentPage/ContentPage.fallback.d.ts} +0 -0
  328. /package/mobile/lib/{components → ui-kit}/StickyBottomMenu/ActiveSubMenu.d.ts +0 -0
  329. /package/mobile/lib/{components → ui-kit}/StickyBottomMenu/ActiveSubMenu.js +0 -0
  330. /package/mobile/lib/{components → ui-kit}/StickyBottomMenu/ActiveSubMenuItem.d.ts +0 -0
  331. /package/mobile/lib/{components → ui-kit}/StickyBottomMenu/BurgerMenuDialog.d.ts +0 -0
  332. /package/mobile/lib/{components → ui-kit}/StickyBottomMenu/StickyBottomMenu.d.ts +0 -0
  333. /package/mobile/lib/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuBurger.d.ts +0 -0
  334. /package/mobile/lib/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuContent.d.ts +0 -0
  335. /package/mobile/lib/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuContent.js +0 -0
  336. /package/mobile/lib/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuItem.d.ts +0 -0
  337. /package/mobile/lib/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuProps.d.ts +0 -0
  338. /package/mobile/lib/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuProps.js +0 -0
  339. /package/mobile/lib/{components → ui-kit}/StickyBottomMenu/TopItemMobile.js +0 -0
  340. /package/mobile/lib/{components → ui-kit}/StickyBottomMenu/useBurgerMenuDialog.d.ts +0 -0
  341. /package/mobile/src/{components → ui-kit}/StickyBottomMenu/ActiveSubMenu.tsx +0 -0
  342. /package/mobile/src/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuContent.ts +0 -0
  343. /package/mobile/src/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuProps.tsx +0 -0
  344. /package/src/{components → ui-kit}/StickyBottomMenu/ActiveSubMenu.tsx +0 -0
  345. /package/src/{components → ui-kit}/StickyBottomMenu/StickyBottomMenu.fixture.mobile.tsx +0 -0
  346. /package/src/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuContent.ts +0 -0
  347. /package/src/{components → ui-kit}/StickyBottomMenu/StickyBottomMenuProps.tsx +0 -0
@@ -863,11 +863,10 @@
863
863
  };
864
864
 
865
865
  const EMPTY_VALUE$5 = {};
866
- const DEFAULT_FOLDER_NAME = 'wcms-resources';
866
+ const DEFAULT_PATH_DIR = '/wcms-resources';
867
867
  function useSWRResource(filename, options = {}) {
868
- const { fallback = EMPTY_VALUE$5, folderName = DEFAULT_FOLDER_NAME, setBasePath = false } = options;
869
- const path = joinPath('/', setBasePath ? projectSettings.BASE_PATH : '', folderName, `${filename}.json`);
870
- const { data } = useAsyncData(filename ? path : null, fetchJSONUnsafe, {
868
+ const { fallback = EMPTY_VALUE$5, pathDir = DEFAULT_PATH_DIR } = options;
869
+ const { data } = useAsyncData(filename ? `${pathDir}/${filename}.json` : null, fetchJSONUnsafe, {
871
870
  fallback,
872
871
  });
873
872
  return data || EMPTY_VALUE$5;
@@ -3689,7 +3688,10 @@
3689
3688
  };
3690
3689
  const Header = JSX(({ bgColor = 'bg-white', version = BG_COLOR_TO_BLOCK_VERSION[bgColor], ...rest }) => {
3691
3690
  const { logo } = useSitemap(rest.options?.page?.fallback);
3692
- const { internetBankUrl } = useSWRResource(projectSettings.PORTAL_DATA || 'portal-data', { folderName: 'portal-resources', setBasePath: true });
3691
+ const { internetBankUrl } = useSWRResource(projectSettings.PORTAL_DATA || 'portal-data', {
3692
+ fallback: rest.options?.page?.fallback,
3693
+ pathDir: joinPath(projectSettings.BASE_PATH, 'portal-resources'),
3694
+ });
3693
3695
  return (jsx(BlockWrapper, { tag: "header", defaultPadding: "", version: version, ...rest, children: jsx("div", { className: "container px-lg py-2xs box-border", children: jsx(HeaderTop, { bgColor: bgColor, logo: logo, internetBankUrl: internetBankUrl, version: version, ...rest }) }) }));
3694
3696
  });
3695
3697
 
@@ -4562,802 +4564,805 @@
4562
4564
  };
4563
4565
  const getIconSizeStyle = (size) => (size === 'normal' ? '38' : '24');
4564
4566
 
4565
- const isHrefActive = (router) => ({ href }) => !href ? false : withoutQuery(getRouterHref(href, router)).startsWith(withoutQuery(href));
4566
- const getRouterHref = (href, router) => isURL(href) ? router.href : router.pathname;
4567
-
4568
- const isTopItemActive = (router) => isHrefActive(projectSettings.BASE_PATH ? { pathname: projectSettings.BASE_PATH } : router);
4569
-
4570
- function useActiveRoute(items = []) {
4571
- const router = useRouter();
4572
- const activeIndex = items.findIndex(isTopItemActive(router));
4573
- return [activeIndex, items[activeIndex]];
4574
- }
4575
-
4576
- const StickyBottomMenuBurger = JSX(({ isActive, onClick }) => (jsxs("button", { className: style(isActive ? 'text-primary-main' : 'text-primary-text', `w-10 m-4 flex justify-center items-center flex-col text-xs cursor-pointer`), onClick: onClick, children: [jsx(Icon, { className: "w-6 h-6", name: "BurgerIcon", iconVersion: isActive ? 'color' : 'black' }), "\u041C\u0435\u043D\u044E"] })));
4577
-
4578
- const StickyBottomMenuItem = JSX(({ isActive, item, onClick }) => {
4579
- const link = useLink({ isRemote: true });
4580
- const { href, onClick: handleClick } = link({ href: item?.href, onClick });
4581
- return (jsxs("a", { className: style(isActive ? 'text-primary-main' : 'text-primary-text', `w-10 m-4 flex justify-center items-center flex-col text-xs cursor-pointer`), href: href, target: "_self", title: item?.title || '', onClick: handleClick, children: [jsx(Icon, { className: "w-6 h-6", name: item?.icon?.icon, iconVersion: isActive ? 'color' : 'black' }), item?.title || ''] }));
4582
- });
4583
-
4584
- const isDialogOpen = (id, dialogs) => dialogs.find((item) => item.id === id, id);
4585
-
4586
- function useList(initialList = []) {
4587
- const [list, setList] = useState(initialList);
4588
- const push = useCallback((item) => setList(_ => [..._, item]), []);
4589
- const pop = useCallback(() => setList(_ => _.slice(0, -1)), []);
4590
- const remove = useCallback((item) => setList(_ => _.filter(currentItem => currentItem !== item)), []);
4591
- const clear = useCallback(() => setList([]), []);
4592
- return [list, { setList, push, pop, remove, clear }];
4593
- }
4594
-
4595
- const useDialogsList = ({ onCloseAll, onClose, } = {}) => {
4596
- const [dialogs, { push, pop, clear }] = useList();
4597
- const closeAll = useCallback(() => {
4598
- onCloseAll && onCloseAll(dialogs);
4599
- clear();
4600
- }, [dialogs, onCloseAll]);
4601
- const close = useCallback(() => {
4602
- onClose && onClose(dialogs[dialogs.length - 1]);
4603
- pop();
4604
- }, [dialogs, onClose]);
4605
- useEffect(() => defaultEventBus.subscribe('dialog', (action) => {
4606
- switch (action.type) {
4607
- case 'open':
4608
- push(action);
4609
- break;
4610
- case 'close':
4611
- if (action.all) {
4612
- closeAll();
4613
- }
4614
- else {
4615
- close();
4616
- }
4617
- break;
4618
- default:
4619
- assertUnreachable(action);
4620
- }
4621
- }), [closeAll, close]);
4622
- return dialogs;
4623
- };
4624
-
4625
- const CloseButton = JSX(({ className, onClose }) => (jsx("button", { className: style('flex justify-center items-center w-12 h-12 p-2xs bg-transparent border-none', className), onClick: onClose, title: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C", children: jsx(Img, { image: { icon: 'CloseIcon' }, width: "24", height: "24" }) })));
4626
-
4627
- const Dialog = JSX(({ className, head, children, onClose }) => {
4628
- const { close } = useDialogManager();
4629
- const handleClose = useCallback(() => {
4630
- close();
4631
- onClose && onClose();
4632
- }, [onClose]);
4633
- return (jsxs("div", { className: style('relative min-h-full bg-white pt-0 p-5', className), children: [jsxs("div", { className: "sticky py-xl top-0 bg-white z-10", children: [jsx(CloseButton, { className: "absolute top-0 right-0", onClose: handleClose }), jsx("div", { className: "container", children: head })] }), jsx("div", { className: "container pb-6xl", children: children })] }));
4567
+ const scrollButtonStyle = 'hidden sm:flex absolute z-40 top-0';
4568
+ const ScrollableTabsControl = JSX(({ className, items = [], value, onChange, tabsType }) => {
4569
+ const [containerRef, scroll] = useSwipeListScroll({
4570
+ itemCount: items?.length || 0,
4571
+ });
4572
+ return (jsxs("div", { className: style('relative overflow-x-auto no-scrollbar', className), role: "tablist", children: [jsx(SwipeListContainer, { containerRef: containerRef, snapAlign: "snap-start", onVisibleIndicesChange: scroll.handleVisibleIndicesChange, children: items.map(renderTab(value, onChange, tabsType)) }), scroll.canScrollLeft ? (jsx(ScrollLeftButton, { className: style('left-6', scrollButtonStyle), onClick: scroll.scrollLeft })) : null, scroll.canScrollRight ? (jsx(ScrollRightButton, { className: style('right-6', scrollButtonStyle), onClick: scroll.scrollRight })) : null] }));
4634
4573
  });
4635
4574
 
4636
- const REGIONS_URL = '/api/v1/regions';
4637
- function useRegions() {
4638
- const { data } = useAsyncData(REGIONS_URL, fetchJSONUnsafe);
4639
- return data || [];
4640
- }
4641
-
4642
- const groupBy = (list, keyGetter) => {
4643
- const result = new Map();
4644
- for (const item of list) {
4645
- const key = keyGetter(item);
4646
- const group = result.get(key) || [];
4647
- result.set(key, [...group, item]);
4575
+ const renderTabs = ({ tabsMode, ...props }) => {
4576
+ switch (tabsMode) {
4577
+ case 'wideScreen':
4578
+ return jsx(TabsControl, { ...props });
4579
+ case 'centered':
4580
+ return (jsx("div", { className: "flex", children: jsx(TabsControl, { className: "m-auto p-xs rounded-md bg-main-gray", tabsType: "rounded", ...props }) }));
4581
+ case 'scrollable':
4582
+ return (jsx("div", { className: "flex", children: jsx(ScrollableTabsControl, { className: "m-auto", tabsType: "underlined", ...props }) }));
4583
+ default:
4584
+ return null;
4648
4585
  }
4649
- return result;
4650
4586
  };
4651
4587
 
4652
- const JARO_WINKLER_P = 0.1;
4653
- const JARO_WINKLER_MAX_L = 4;
4654
- const jaroWinklerDistance = (s1) => (s2) => {
4655
- if (s1 === s2) {
4656
- return 1;
4657
- }
4658
- if (!s1 || !s2) {
4659
- return 0;
4660
- }
4661
- const { m, s1Matches, s2Matches } = computeM(s1, s2);
4662
- if (m === 0) {
4663
- return 0;
4664
- }
4665
- const t = computeT(s1, s2, { s1Matches, s2Matches });
4666
- const jaroWeight = (m / s1.length + m / s2.length + (m - t / 2) / m) / 3;
4667
- const winklerWeight = jaroWeight > 0.7 ? computePrefixL(s1, s2) * JARO_WINKLER_P : 0;
4668
- return jaroWeight + winklerWeight * (1 - jaroWeight);
4669
- };
4670
- function computeM(s1, s2) {
4671
- const range = Math.max(0, Math.floor(Math.max(s1.length, s2.length) / 2) - 1);
4672
- const s1Matches = Array.from({ length: s1.length });
4673
- const s2Matches = Array.from({ length: s2.length });
4674
- let m = 0;
4675
- for (let i = 0; i < s1.length; i++) {
4676
- const low = Math.max(0, i - range);
4677
- const high = Math.min(i + range, s2.length - 1);
4678
- for (let j = low; j <= high; j++) {
4679
- if (s1Matches[i] || s2Matches[j] || s1[i] !== s2[j]) {
4680
- continue;
4681
- }
4682
- m++;
4683
- s1Matches[i] = true;
4684
- s2Matches[j] = true;
4588
+ const TAB_QUERY_PARAM_KEY = 'tab';
4589
+ const Tabs = JSX(({ className = '', isSticky, tabs = [], tabsMode, ...rest }) => {
4590
+ const router = useRouter();
4591
+ const { isReady } = router;
4592
+ const tabsControlItems = useMemo(() => tabs.map(normalizeTab), [tabs]);
4593
+ const [activeTabIndex, setActiveTabIndex] = useState(0);
4594
+ useEffect(() => {
4595
+ if (!tabs || !tabs[0]) {
4596
+ return;
4685
4597
  }
4686
- }
4687
- return { m, s1Matches, s2Matches };
4688
- }
4689
- function computeT(s1, s2, { s1Matches, s2Matches }) {
4690
- let t = 0;
4691
- for (let i = 0, k = 0; i < s1.length; i++) {
4692
- if (!s1Matches[i]) {
4693
- continue;
4598
+ const defaultTabIndex = router.query[TAB_QUERY_PARAM_KEY]
4599
+ ? tabs.findIndex((_) => _.type === 'group' && _.ref === router.query[TAB_QUERY_PARAM_KEY]) || 0
4600
+ : 0;
4601
+ const defaultTab = tabs[defaultTabIndex] || tabs[0];
4602
+ setActiveTabIndex(defaultTabIndex);
4603
+ fireTabEvent(defaultTab);
4604
+ }, [isReady]);
4605
+ useEffect(() => {
4606
+ const activeTab = tabs[activeTabIndex];
4607
+ if (activeTab?.type === 'group') {
4608
+ defaultEventBus.subject('tab', {
4609
+ type: activeTab.type,
4610
+ label: activeTab.ref,
4611
+ groupName: activeTab.name,
4612
+ });
4694
4613
  }
4695
- let j = k;
4696
- for (; j < s2.length; j++) {
4697
- if (s2Matches[j]) {
4698
- k = j + 1;
4699
- break;
4700
- }
4614
+ }, [tabs, activeTabIndex]);
4615
+ const updateUrlSearchTabParam = (_) => {
4616
+ const searchParams = new URLSearchParams(router.query);
4617
+ if (_.name) {
4618
+ searchParams.set(TAB_QUERY_PARAM_KEY, _.name);
4701
4619
  }
4702
- if (s1[i] !== s2[j]) {
4703
- t++;
4620
+ else {
4621
+ searchParams.delete(TAB_QUERY_PARAM_KEY);
4622
+ }
4623
+ router.replace(`${router.pathname}?${searchParams}`, '', { scroll: false });
4624
+ };
4625
+ const handleChange = useCallback((_) => {
4626
+ const index = tabsControlItems.indexOf(_);
4627
+ const tab = tabs[index];
4628
+ setActiveTabIndex(index);
4629
+ fireTabEvent(tab);
4630
+ if (tab.type === 'group') {
4631
+ updateUrlSearchTabParam(_);
4704
4632
  }
4633
+ }, [tabs, tabsControlItems]);
4634
+ return (jsx(BlockWrapper, { className: style(isSticky ? 'sticky top-1 z-20' : '', className), defaultPadding: "p-0", ...rest, children: renderTabs({
4635
+ items: tabsControlItems,
4636
+ value: tabsControlItems[activeTabIndex],
4637
+ tabsMode,
4638
+ onChange: handleChange,
4639
+ }) }));
4640
+ });
4641
+ const fireTabEvent = (tab) => {
4642
+ if (tab.type === 'group') {
4643
+ defaultEventBus.fire('tab', { type: tab.type, label: tab.ref, groupName: tab.name });
4705
4644
  }
4706
- return t;
4707
- }
4708
- function computePrefixL(s1, s2) {
4709
- let prefixL = 0;
4710
- while (s1[prefixL] === s2[prefixL] && prefixL < JARO_WINKLER_MAX_L) {
4711
- prefixL++;
4645
+ if (tab.type === 'link') {
4646
+ defaultEventBus.fire('tab', { type: tab.type, label: tab.href });
4712
4647
  }
4713
- return prefixL;
4714
- }
4648
+ };
4649
+ const normalizeTab = (_) => _?.type === 'group' ? { text: _.title, name: _.ref } : _;
4715
4650
 
4716
- const renderForeignOffices = (foreignOffices) => foreignOffices?.length ? (jsxs("div", { className: "sm:border-t sm:border-main-divider mt-2xs pt-2xs", children: [jsx("div", { className: "mb-m", children: jsx(Text, { size: "text-m", font: "font-light", color: "text-secondary-text", children: "\u041F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u0430 \u0437\u0430 \u0440\u0443\u0431\u0435\u0436\u043E\u043C:" }) }), jsx("div", { className: "flex flex-col sm:flex-row gap-5xl", children: foreignOffices.map((office, i) => (jsx(ForeignOffice, { ...office }, String(i)))) })] })) : null;
4717
- const ForeignOffice = JSX(({ icon, ...rest }) => {
4718
- const link = useLink();
4719
- const { text, target, href, onClick } = link(rest);
4720
- return (jsxs("div", { className: "flex gap-s items-center", children: [icon ? jsx(Img, { pathPrefix: "/wcms-resources/", image: icon }) : null, text ? (jsx("a", { className: "hover:text-primary-hover", href: href, target: target, onClick: onClick, children: jsx(Text, { size: "text-l", font: "font-light", color: "text-primary-text", children: text }) })) : null] }));
4721
- });
4651
+ const dividerStyle = '@4xl:border-main-divider @4xl:border-b';
4652
+ const firstCellStyle = 'w-80 flex-shrink-0';
4653
+ const COLS_LENGTH_FOR_SCROLL = 2;
4654
+ const COLUMN_WIDTH$1 = 4 * 80 + 40; // w-80 + pl-10 = 360px
4722
4655
 
4723
- const renderRegion = (onChangeLocation) => (region) => (jsx("div", { className: "mb-xs sm:mb-2xs", children: jsx("button", { className: "cursor-pointer hover:text-primary-hover", onClick: () => {
4724
- onChangeLocation && onChangeLocation(region);
4725
- }, children: jsx(Text, { size: "text-l", font: "font-light", children: region.name || '' }) }) }, region.id));
4656
+ const carouselContainerClassesMap = {
4657
+ comparison: 'flex gap-m duration-1000',
4658
+ tariff: 'flex gap-5xl flex-grow duration-1000',
4659
+ };
4660
+ const TableCarouselContainer = JSX(({ children, activeIndex, columnWidth, version = 'comparison' }) => (jsx("div", { className: "flex flex-1 overflow-hidden", children: jsx("div", { className: carouselContainerClassesMap[version], style: { transform: `translateX(-${activeIndex * columnWidth}px)` }, children: children }) })));
4726
4661
 
4727
- const renderRegionGroup = (onChangeLocation) => ([letter, regions]) => (jsxs("div", { className: "break-inside-avoid mb-2xl w-56", children: [jsx("div", { className: "mb-s", children: jsx(Text, { size: "text-h6", children: letter }) }), regions.map(renderRegion(onChangeLocation))] }, letter));
4662
+ const TableInnerButton = JSX(({ className = '', isOpen, onClick }) => (jsx(LinkButton, { className: className, appendRight: jsx(Img, { image: { icon: isOpen ? 'ArrowUpIcon' : 'ArrowDownIcon' }, width: "20", height: "20" }), text: isOpen ? 'Скрыть' : 'Показать', version: "gray", onClick: onClick })));
4728
4663
 
4729
- const SearchBar$1 = JSX(({ className, searchTerm, onSearch }) => {
4730
- 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: `h-12 pl-m w-full peer text-l text-black border border-solid rounded-md box-border
4731
- outline-none border-gray hover:border-primary-hover active:border-primary-text focus:border-primary-text`, value: searchTerm, onChange: (e) => onSearch(e.target.value.toLowerCase()), type: "text", name: "location-search-bar-input" })] }));
4664
+ const renderButtonsCellData = ({ buttons }) => renderButtonsSection(buttons, {
4665
+ buttonClassName: 'basis-0',
4732
4666
  });
4667
+ const renderLabelDescriptionCellData = ({ label, description }) => (jsxs("div", { className: "space-y-2xs", children: [label ? (jsx("div", { children: jsx(Text, { size: "text-h6", children: label }) })) : null, description ? (jsx("div", { children: jsx(Text, { size: "text-l", color: "text-secondary-text", children: description }) })) : null] }));
4668
+ const renderImgCellData = ({ image }) => (image?.src ? jsx(Img, { image: image }) : null);
4669
+ const renderListCellData = ({ isDotted, ...rest }) => (jsx(List, { className: "flex flex-col justify-between items-start text-h6", isDotted: isDotted ?? true, ...rest }));
4670
+ const renderInnerTableCellData = ({ isVisible, displayTable, dataUrl, pdfUrl, isOpen, }) => isVisible ? (jsx(TableInnerButton, { isOpen: isOpen, onClick: () => {
4671
+ displayTable({ dataUrl, pdfUrl });
4672
+ } })) : null;
4673
+ const EmbeddableCellData = {
4674
+ Buttons: renderButtonsCellData,
4675
+ Img: renderImgCellData,
4676
+ List: renderListCellData,
4677
+ LabelDescription: renderLabelDescriptionCellData,
4678
+ Table: renderInnerTableCellData,
4679
+ };
4733
4680
 
4734
- const SEARCH_TERM_MIN_LENGTH = 3;
4735
- const LocationDialog = JSX(() => {
4736
- const { defaultLocation, foreignOffices } = useSitemap();
4737
- const [currentLocation, selectCurrentLocation] = useLocation(defaultLocation);
4738
- const [query, setQuery] = useState('');
4739
- const regions = cleanUpRegions(useRegions()).sort((a, b) => a.name.localeCompare(b.name));
4740
- const regionsGroupByLetter = groupBy(regions, regionFirstLetter);
4741
- const { close } = useDialogManager();
4742
- const handleChangeLocation = useCallback((region) => {
4743
- selectCurrentLocation(region);
4744
- close();
4745
- }, []);
4746
- 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 ? (jsxs("div", { className: "mb-s", children: [jsx(Text, { size: "text-l", font: "font-light", children: "\u0421\u0435\u0439\u0447\u0430\u0441 \u0432\u044B\u0431\u0440\u0430\u043D:\u00A0" }), jsx("button", { onClick: () => selectCurrentLocation(currentLocation), children: jsx(Text, { color: "text-primary-main", children: currentLocation.name }) })] })) : null, jsx(SearchBar$1, { onSearch: setQuery, searchTerm: query })] }), children: [query && query.length >= SEARCH_TERM_MIN_LENGTH ? (jsx("div", { children: regions
4747
- .filter(({ name }) => name && jaroWinklerDistance(name.toLowerCase())(query.toLowerCase()) >= 0.8)
4748
- .map(renderRegion(handleChangeLocation)) })) : (jsx("div", { className: "columns-1 sm:columns-5", children: Array.from(regionsGroupByLetter.entries()).map(renderRegionGroup(handleChangeLocation)) })), renderForeignOffices(foreignOffices)] }));
4749
- });
4750
- const regionFirstLetter = (region) => region.name?.charAt(0) || '';
4751
- const cleanUpRegions = (regions) => regions.map((region) => ({
4752
- ...region,
4753
- name: region.name?.replace(/республика|область|край'/gi, '').trim() || '',
4754
- }));
4755
-
4756
- const useLocationDialog = () => {
4757
- const { open, close } = useDialogManager();
4758
- return {
4759
- open: (options = {}) => open(jsx(LocationDialog, {}), options),
4760
- close,
4681
+ const RenderCellInner = JSX(({ cell, fieldIdx, rowIdx, cellIdx, setTableInner, tableInner, openTableInnerIdx, setOpenTableInnerIdx, }) => {
4682
+ const [isVisible, setVisibility] = useState(true);
4683
+ useEffect(() => {
4684
+ if (cellIdx !== openTableInnerIdx || !tableInner) {
4685
+ setVisibility(true);
4686
+ }
4687
+ }, [tableInner, openTableInnerIdx]);
4688
+ const displayTable = (props) => {
4689
+ setVisibility(false);
4690
+ setOpenTableInnerIdx(cellIdx);
4691
+ setTableInner(props);
4761
4692
  };
4693
+ return renderCell({
4694
+ cell,
4695
+ cellProps: {
4696
+ rowIdx,
4697
+ cellIdx,
4698
+ fieldIdx,
4699
+ displayTable,
4700
+ isVisible,
4701
+ },
4702
+ });
4703
+ });
4704
+ const renderCell = ({ cell, cellProps }) => {
4705
+ if (!cell) {
4706
+ return null;
4707
+ }
4708
+ const { tableCellType: type, ...rest } = cell;
4709
+ if (!type || !(type in EmbeddableCellData)) {
4710
+ return null;
4711
+ }
4712
+ const EmbeddableCellInner = EmbeddableCellData[type];
4713
+ return jsx(EmbeddableCellInner, { ...cellProps, ...rest });
4762
4714
  };
4763
4715
 
4764
- const SearchInput = JSX(({ className, value, autoFocus, onChange, onFocus, placeholder = 'Поиск по сайту' }) => {
4765
- const handleChange = useCallback((ev) => {
4766
- onChange && onChange(ev.target?.value || '');
4767
- }, [onChange]);
4768
- return (jsxs("div", { className: style('font-sans relative', className), role: "form", children: [jsx("div", { className: "absolute h-full flex items-center pl-m pointer-events-none", children: jsx(Img, { image: { icon: 'LoupeIcon', iconVersion: 'black' }, width: "24", height: "24" }) }), jsx("input", { className: style('h-14 w-full px-10 text-l text-black outline-none box-border border border-solid rounded-md', 'border-gray hover:border-primary-hover active:border-primary-text focus:border-primary-text'), value: value, type: "text", name: "search-bar-input", placeholder: placeholder, autoFocus: autoFocus, onChange: handleChange, onFocus: onFocus })] }));
4716
+ const TariffsTableCell = JSX(({ cells, rowIdx, cellIdx, setTableInner, tableInner, openTableInnerIdx, setOpenTableInnerIdx, }) => {
4717
+ return (jsx("div", { className: "w-80 flex-grow flex flex-col gap-m @4xl:gap-lg", role: "cell", children: cells?.length
4718
+ ? cells.map((_, i) => (jsx(RenderCellInner, { cell: _, fieldIdx: i, rowIdx: rowIdx, cellIdx: cellIdx, setTableInner: setTableInner, tableInner: tableInner, openTableInnerIdx: openTableInnerIdx, setOpenTableInnerIdx: setOpenTableInnerIdx }, String(i))))
4719
+ : null }));
4769
4720
  });
4770
4721
 
4771
- function useDebouncedEffect(effect, deps, delay = 300) {
4772
- useEffect(() => {
4773
- const timerId = globalThis.setTimeout(effect, delay);
4774
- return () => {
4775
- globalThis.clearTimeout(timerId);
4776
- };
4777
- }, deps);
4778
- }
4779
-
4780
- const compareBy = (indexOf) => (a, b) => indexOf(a) - indexOf(b);
4781
- const desc = (cmp) => (a, b) => -cmp(a, b);
4722
+ const COLUMN_WIDTH = 140;
4723
+ const getHorizontalShift = (columns, activeColumnIndex) => sum(columns.slice(0, activeColumnIndex).map((_) => _?.cols?.length ?? 1)) * COLUMN_WIDTH;
4782
4724
 
4783
- const joinMaps = (aggregate, emptyVal) => (acc, map) => {
4784
- for (const [key, b] of map) {
4785
- acc.set(key, aggregate(acc.get(key) || emptyVal, b));
4725
+ const renderInnerTableRow = (activeColumnIndex) => (rowData, rowIdx) => {
4726
+ if (!rowData?.length) {
4727
+ return null;
4786
4728
  }
4787
- return acc;
4729
+ const [headerColumn, ...columns] = rowData;
4730
+ const columnsStyle = style('flex duration-1000 text-center', rowIdx !== 0 ? 'font-normal' : 'font-light');
4731
+ return (jsxs("div", { className: "flex border-main-divider border-b border-solid h-full", children: [headerColumn?.data ? (jsx("div", { className: "text-xl font-light w-56 min-w-56 py-lg", children: headerColumn.data })) : null, jsx("div", { className: "flex flex-grow overflow-hidden", children: jsx("div", { className: columnsStyle, style: {
4732
+ transform: `translateX(-${getHorizontalShift(columns, activeColumnIndex)}px)`,
4733
+ }, children: columns?.map((_, i) => (jsxs("div", { className: "flex flex-col flex-grow gap-s justify-center py-xl odd:bg-main-divider", children: [_?.data ? jsx("div", { className: "text-xl font-light", children: _.data }) : null, _?.cols ? renderCols(_.cols, activeColumnIndex) : null] }, `row${i}`))) }) })] }, String(rowIdx)));
4788
4734
  };
4735
+ const renderCols = (cols, rowIndex) => cols?.length > 0 ? (jsx("div", { className: style('flex', rowIndex === 0 ? 'text-secondary-text' : ''), children: cols.map((data, i) => (jsx("div", { className: "w-20 text-h6 mx-lg", children: data }, String(i)))) })) : null;
4789
4736
 
4790
- const MIN_TERM_LEN = 3;
4791
- const tokenize = (text) => text
4792
- .toLowerCase()
4793
- .split(/[^0-9a-zа-я-]+/)
4794
- .filter((token) => token.length >= MIN_TERM_LEN && !/[0-9a-z]/.test(token));
4737
+ const InnerTableBodyItem = JSX(({ rows }) => (jsx(SwipeListContainer, { visibleItemCount: 0, snapAlign: "snap-start", children: jsx("div", { children: rows?.map(renderInnerTableRow(0)) }) })));
4795
4738
 
4796
- const textRank = (queryTokens) => (text) => {
4797
- const textTokens = tokenize(text || '');
4798
- return textTokens.length
4799
- ? sum(queryTokens.map((qToken) => max(textTokens.map(jaroWinklerDistance(qToken)))))
4800
- : 0;
4801
- };
4739
+ const InnerTableBody = JSX(({ activeTabIndex, items }) => {
4740
+ return (jsx("div", { children: items.map((_, tableIdx) => {
4741
+ const key = `activeTabIdx:${activeTabIndex}-tableIdx:${tableIdx}`;
4742
+ return (jsxs("div", { className: "w-full @container", children: [jsx("div", { className: "flex p-m bg-white @4xl:bg-gray text-center justify-center relative", children: jsx(Text, { size: "text-xl", font: "font-light", children: _.title }) }), jsx("div", { className: "w-full pl-xs overflow-hidden transition-height duration-500 ease-in-out", children: jsx("div", { className: "relative", children: jsx(InnerTableBodyItem, { rows: _.rowsData }) }) })] }, key));
4743
+ }) }));
4744
+ });
4802
4745
 
4803
- const JW_THRESHOLD = 0.8;
4804
- const RANK_EPS = 0.001;
4805
- const search = (query) => (searchIndex) => {
4806
- const { corpus, dictionary } = searchIndex || {};
4807
- if (!query || !corpus?.length || !dictionary || !Object.keys(dictionary).length) {
4808
- return [];
4809
- }
4810
- const queryTokens = tokenize(query);
4811
- if (!queryTokens.length) {
4812
- return [];
4813
- }
4814
- const dictEntries = Object.entries(dictionary);
4815
- const pagesRanking = queryTokens
4816
- .map(computePagesRankingPerToken(dictEntries))
4817
- .reduce(joinMaps((a, b) => a + b, 0), new Map());
4818
- const relevantPages = [...pagesRanking.entries()]
4819
- .filter(([, pageRank]) => pageRank >= (JW_THRESHOLD - RANK_EPS) * queryTokens.length) // Multiplication of query tokens
4820
- .map(([pageIndex]) => corpus[pageIndex]);
4821
- return sortResultsByRank(queryTokens)(relevantPages);
4822
- };
4823
- const computePagesRankingPerToken = (dictEntries) => (qToken) => dictEntries
4824
- .map(([stem, pageIndices]) => [jaroWinklerDistance(qToken)(stem), pageIndices])
4825
- .filter(([stemRank]) => stemRank >= JW_THRESHOLD)
4826
- .map(([stemRank, pageIndices]) => fillMapWith(pageIndices, stemRank))
4827
- .reduce(joinMaps(Math.max, 0), new Map());
4828
- const sortResultsByRank = (queryTokens) => (results) => zip(results, results.map(({ title }) => title).map(textRank(queryTokens)))
4829
- .sort(desc(compareBy(([, pageTitleRank]) => pageTitleRank)))
4830
- .map(([corpusItem]) => corpusItem);
4831
- const fillMapWith = (keys, value) => new Map(keys.map((_) => [_, value]));
4746
+ const linkButtonVersion = 'link';
4832
4747
 
4833
- const SEARCH_INDEX_FILENAME = 'search.index.json';
4834
- const useSearch = ({ basePathList, initialQuery = '', }) => {
4835
- const [query, setQuery] = useState(initialQuery || '');
4836
- useEffect(() => {
4837
- if (initialQuery !== undefined && initialQuery !== null) {
4838
- setQuery(initialQuery);
4839
- }
4840
- }, [initialQuery]);
4841
- const { data } = useAsyncData(basePathList?.length ? basePathList : null, fetchSearchIndex);
4842
- const [result, setResult] = useState(null);
4843
- useDebouncedEffect(() => {
4844
- if (data) {
4845
- setResult(data.map(search(query)));
4846
- }
4847
- }, [data, query]);
4848
- return [result, { value: query, onChange: setQuery }];
4849
- };
4850
- const fetchSearchIndex = async (...basePathList) => (await Promise.allSettled(basePathList.map((basePath) => fetchJSON(joinPath(basePath, '/', SEARCH_INDEX_FILENAME))))).map((_) => (_.status === 'fulfilled' ? _.value : {}));
4748
+ const InnerTableHeader = JSX(({ currencies, linkToPDF, activeTabIndex, setActiveTabIndex }) => (jsxs("div", { className: "flex justify-between items-center w-full py-lg", children: [currencies && currencies.length > 1 ? (jsx("div", { className: "flex bg-secondary-light p-2xs rounded-md", children: currencies.map((currency, idx) => (jsx("div", { className: `rounded-md text-xl font-light px-4 py-3 cursor-pointer ${idx === activeTabIndex ? 'bg-primary-main text-white' : 'text-secondary-text'}`, onClick: () => setActiveTabIndex(idx), children: currency || idx + 1 }, currency))) })) : null, linkToPDF ? (jsx(LinkButton, { className: "text-primary-main", href: linkToPDF, version: linkButtonVersion, target: "_blank", appendLeft: jsx(Icon, { name: "DocDownloadIcon", iconVersion: "color", className: "mr-3xs", width: "20", height: "20" }), text: "\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u0432 PDF" })) : null] })));
4851
4749
 
4852
- const Sitemap = JSX(({ className, topItems }) => {
4853
- const link = useLink({ isRemote: true });
4854
- return (jsx("div", { className: style('flex items-start justify-between', className), children: topItems?.map(link).map(renderColumn) }));
4855
- });
4856
- const FOOTER_AREA_KEYS = ['all', 'footer'];
4857
- const renderColumn = (menuItem, index) => {
4858
- const { text, items = [], href, target, onClick } = menuItem;
4859
- const visibleSubItems = items.filter((_) => !_.displayArea || FOOTER_AREA_KEYS.includes(_.displayArea.toLowerCase()));
4860
- return (jsxs("div", { className: "flex flex-col gap-s w-1/4", children: [jsx("a", { className: "leading-5 text-l text-primary-text hover:text-primary-main no-underline", href: href, target: target || '_self', onClick: onClick, children: text || `Раздел ${index}` }), visibleSubItems.map((_, i) => (jsx(ColumnItem, { ..._, basePath: appendSlash(href), index: i }, String(i))))] }, String(index)));
4861
- };
4862
- const ColumnItem = JSX(({ text, index, basePath, ...rest }) => {
4863
- const isAnotherPortal = projectSettings.BASE_PATH && basePath ? !projectSettings.BASE_PATH.startsWith(basePath) : false;
4864
- const link = useLink({ isRemote: isAnotherPortal, basePath });
4865
- const { href, target, onClick } = link(rest);
4866
- return (jsx("a", { className: style('text-l font-light text-secondary-text hover:text-primary-main no-underline', 'overflow-x-hidden overflow-ellipsis whitespace-nowrap'), href: href, target: target || '_self', onClick: onClick, children: text || `Раздел ${index}` }));
4750
+ function useTariffsInnerTableData(directoryName) {
4751
+ const { data } = useAsyncData(tariffsInnerTableDataUrl(directoryName), fetchTariffsInnerTableData);
4752
+ return data || {};
4753
+ }
4754
+ async function fetchTariffsInnerTableData(url) {
4755
+ const response = await fetch(url);
4756
+ return await response.json();
4757
+ }
4758
+ function tariffsInnerTableDataUrl(directoryName) {
4759
+ return `/wcms-resources/${directoryName || 'tariffs-inner-table-data'}.json`;
4760
+ }
4761
+
4762
+ const EMPTY_DATA = 'Данных нет';
4763
+ const InnerTable = JSX(({ dataUrl, pdfUrl, onClick }) => {
4764
+ const { tableData } = useTariffsInnerTableData(dataUrl);
4765
+ const [activeTabIndex, setActiveTabIndex] = useState(0);
4766
+ const handleActiveTabIndex = useCallback((_) => setActiveTabIndex(_), []);
4767
+ const items = tableData?.[activeTabIndex]?.items ?? [];
4768
+ const currencies = tableData?.map((item) => item.currency ?? '');
4769
+ return tableData ? (jsxs("div", { className: "bg-white z-10", children: [jsx(InnerTableHeader, { currencies: currencies, activeTabIndex: activeTabIndex, setActiveTabIndex: handleActiveTabIndex, linkToPDF: pdfUrl }), jsx(InnerTableBody, { activeTabIndex: activeTabIndex, items: items }), jsx(TableInnerButton, { className: "mt-xl", onClick: onClick, isOpen: true })] })) : (jsxs("div", { className: "my-lg space-y-m text-h6 text-center", children: [jsx("p", { children: EMPTY_DATA }), jsx(TableInnerButton, { onClick: onClick, isOpen: true })] }));
4867
4770
  });
4868
4771
 
4869
- const SearchDialog = JSX(({ initialQuery }) => {
4870
- const { topItems } = useSitemap();
4871
- const basePathList = useMemo(() => topItems?.map((_) => _.href || '/'), [topItems]);
4872
- const [searchResult, searchInputProps] = useSearch({
4873
- basePathList,
4874
- initialQuery,
4875
- });
4876
- const searchItems = useMemo(() => combineTopItemsAndSearchResult(topItems)(searchResult), [topItems, searchResult]);
4877
- useEffect(() => printSearchItems(searchItems), [searchItems]); // Temp
4878
- return (jsx(Dialog, { head: jsx(SearchInput, { autoFocus: true, ...searchInputProps }), children: jsx(Sitemap, { topItems: searchItems }) }));
4772
+ const TariffsTableRowContainer = JSX(({ children, tableInner, onHideContentClick }) => (jsxs("div", { className: "self-start flex flex-col", role: "row", children: [jsx("div", { className: style(dividerStyle, 'flex flex-col @4xl:flex-row gap-y-xs gap-x-5xl pb-lg @4xl:pt-lg'), children: children }), tableInner ? (jsx("div", { className: "origin-top animate-expansion", children: jsx(InnerTable, { ...tableInner, onClick: onHideContentClick }) })) : null] })));
4773
+
4774
+ const TariffsTableRow = JSX(({ row: { header, data }, activeIndex, rowIdx, ...rest }) => {
4775
+ const [tableInner, setTableInner] = useState(undefined);
4776
+ const handleSetTableInner = useCallback((_) => setTableInner(_), []);
4777
+ const [openTableInnerIdx, setOpenTableInnerIdx] = useState(undefined);
4778
+ const handleOpenTableInnerIdx = useCallback((_) => setOpenTableInnerIdx(_), []);
4779
+ const onHideContentClick = () => setTableInner(undefined);
4780
+ return (jsxs(TariffsTableRowContainer, { onHideContentClick: onHideContentClick, tableInner: tableInner, ...rest, children: [jsx("div", { className: style('text-s', firstCellStyle), children: jsxs("div", { className: "flex gap-m items-center text-primary-text", role: "cell", children: [header?.icon ? (jsx(Img, { className: "hidden @4xl:block max-w-6 shrink-0", image: header.icon, width: "24", height: "24" })) : null, header?.title ? (jsx(Text, { size: "text-m", font: "font-light", children: header?.title })) : null] }) }), data?.length ? (jsx(TableCarouselContainer, { activeIndex: activeIndex, columnWidth: COLUMN_WIDTH$1, version: "tariff", children: data.map((cells, i) => (jsx(TariffsTableCell, { cells: cells, rowIdx: rowIdx, cellIdx: i, setTableInner: handleSetTableInner, tableInner: tableInner, openTableInnerIdx: openTableInnerIdx, setOpenTableInnerIdx: handleOpenTableInnerIdx, ...rest }, String(i)))) })) : null] }));
4879
4781
  });
4880
- const combineTopItemsAndSearchResult = (topItems) => (searchResult) => topItems?.length && searchResult?.length
4881
- ? zip(topItems, searchResult).map(([_, portalSearchResult]) => ({
4882
- ..._,
4883
- items: portalSearchResult?.map(({ title, uri }) => ({ text: title, href: joinPath('/', uri) })),
4884
- }))
4885
- : [];
4886
- // Temp
4887
- function printSearchItems(topItems) {
4888
- for (const _ of topItems.filter(({ items }) => items?.length)) {
4889
- console.group(_.text);
4890
- console.table(_.items, ['text', 'href']);
4891
- console.groupEnd();
4782
+
4783
+ /** @deprecated */
4784
+ function renderArrows({ dec, inc, canDec, canInc, btnClass, className = '', }) {
4785
+ const isVisible = canDec || canInc;
4786
+ if (!isVisible) {
4787
+ return null;
4892
4788
  }
4789
+ return (jsxs("div", { children: [canDec ? (jsx(ArrowButton, { className: style('absolute z-40', btnClass[0], className), onClick: dec, ariaLabel: "\u041F\u0440\u043E\u043B\u0438\u0441\u0442\u0430\u0442\u044C \u0432\u043B\u0435\u0432\u043E", "data-block-control": "scroll-left", disabled: !canDec })) : null, canInc ? (jsx(ArrowButton, { className: style('absolute z-40 rotate-180', btnClass[1], className), onClick: inc, ariaLabel: "\u041F\u0440\u043E\u043B\u0438\u0441\u0442\u0430\u0442\u044C \u0432\u043F\u0440\u0430\u0432\u043E", "data-block-control": "scroll-right", disabled: !canInc })) : null] }));
4893
4790
  }
4894
4791
 
4895
- const useSearchDialog = () => {
4896
- const { open, close } = useDialogManager();
4897
- return {
4898
- open: (props = {}, options = {}) => open(jsx(SearchDialog, { ...props }), options),
4899
- close,
4900
- };
4901
- };
4902
-
4903
- const MIN_QUERY_LEN = 3;
4904
- const SearchBar = JSX(({ className }) => {
4905
- const [value, setValue] = useState('');
4906
- const resetQueryOnDialogClose = useCallback(() => setValue(''), []);
4907
- const { open } = useSearchDialog();
4908
- const handleInitialInputChange = useCallback((_) => {
4909
- setValue(_);
4910
- if (isQueryLongEnough(_)) {
4911
- open({ initialQuery: _ }, { onClose: resetQueryOnDialogClose });
4912
- }
4913
- }, [resetQueryOnDialogClose]);
4914
- return (jsxs("div", { className: style('relative', className), children: [jsx(SearchInput, { value: value, onChange: handleInitialInputChange }), jsx(CloseButton, { className: "absolute top-0 right-0 sm:hidden", onClose: resetQueryOnDialogClose })] }));
4792
+ const TariffsTableWrapper = JSX(({ children, controls }) => {
4793
+ const { isScrollAvailable } = controls;
4794
+ return (jsxs("div", { role: "table", children: [jsxs("div", { className: "relative space-y-xs", children: [children, renderArrows({
4795
+ ...controls,
4796
+ btnClass: ['top-28', 'top-11'],
4797
+ className: 'right-7',
4798
+ })] }), isScrollAvailable ? (jsx("div", { className: "absolute top-0 right-0 bottom-0 w-20 bg-opacity-to-white" })) : null] }));
4915
4799
  });
4916
- const isQueryLongEnough = (_) => _ && _.length >= MIN_QUERY_LEN;
4917
4800
 
4918
- const ActiveSubMenuItem = JSX(({ item, basePath }) => {
4919
- const isAnotherPortal = projectSettings.BASE_PATH && basePath ? !projectSettings.BASE_PATH.startsWith(basePath) : false;
4920
- const link = useLink({ isRemote: isAnotherPortal, basePath });
4921
- const { href, target, onClick } = link(item);
4922
- const router = useRouter();
4923
- const isActive = isHrefActive(router)({ href });
4924
- return (jsxs("a", { className: style(isActive ? 'text-primary-main' : 'text-primary-text', `py-3 text-h5 font-light flex justify-between cursor-pointer`), href: href, target: target, onClick: onClick, children: [item.text, jsx(Img, { image: { icon: 'ChevronLeftIcon', iconVersion: 'black' }, width: "24", height: "24", className: "text-secondary-text rotate-180 opacity-30" })] }));
4801
+ const TariffsTable = JSX(({ className = '', title, description, rowHeaders, tariffsColumns: columns, hiddenRowsNum = 0, ...rest }) => {
4802
+ const colData = columns?.map(({ data }) => data) || [];
4803
+ const rowData = rowHeaders?.map((header, i) => ({
4804
+ header,
4805
+ data: colData.map((col) => col?.[i] || []),
4806
+ }));
4807
+ const itemCount = colData.length;
4808
+ const [activeIndex, controls] = useCarouselControls({
4809
+ itemCount: itemCount,
4810
+ visibleItemCount: COLS_LENGTH_FOR_SCROLL,
4811
+ });
4812
+ const rows = (rowData || []).map((row, i) => (jsx(TariffsTableRow, { row: row, activeIndex: activeIndex, rowIdx: i, ...rest }, String(i))));
4813
+ const [visibleRows, hiddenRows] = hiddenRowsNum > 0 ? [rows.slice(0, -hiddenRowsNum), rows.slice(-hiddenRowsNum)] : [rows, []];
4814
+ return (jsxs(BlockWrapper, { className: style('overflow-hidden relative space-y-6xl @4xl:space-y-xl', className), defaultPadding: "p-6xl", ...rest, children: [jsx(Headline, { title: title, description: description, headlineVersion: "M", isEmbedded: true, align: "text-center" }), jsx("div", { className: "space-y-m", children: hiddenRowsNum > 0 ? (jsx(Foldable, { renderFoldableSection: ({ isUnfolded }) => (jsxs(TariffsTableWrapper, { controls: controls, children: [visibleRows, jsx(FoldableSection, { isUnfolded: isUnfolded, children: hiddenRows })] })), renderFoldButton: renderDefaultFoldButton })) : (jsx(TariffsTableWrapper, { controls: controls, children: rows })) })] }));
4925
4815
  });
4926
4816
 
4927
- const ActiveSubMenu = JSX(({ activeMenuSubItems, basePath }) => activeMenuSubItems ? (jsx("div", { className: "mb-5", children: activeMenuSubItems.map((_, i) => (jsx(ActiveSubMenuItem, { item: _, basePath: basePath }, String(i)))) })) : null);
4817
+ const TextBlock = JSX(({ className = '', title, description, iconVersion, __html, ...rest }) => (jsxs(BlockWrapper, { className: style('flex gap-s sm:gap-m bg-white group-data-secondary:bg-primary-main/10', className), ...rest, children: [iconVersion === 'small' ? renderIcon() : null, jsxs("div", { className: "flex flex-col w-fit gap-2xs sm:gap-xs", children: [title ? (jsx(Text, { size: "text-l", font: "font-normal", color: "text-primary-text group-data-secondary:text-white", children: title })) : null, description ? renderDescription(description) : null, __html ? jsx(RichText, { __html: __html }) : null] })] })));
4818
+ const renderIcon = () => (jsx("div", { className: `rounded-full h-4 w-4 text-center text-xs font-light bg-primary-main text-white group-data-secondary:bg-white group-data-secondary:text-primary-main`, children: "i" }));
4819
+ const renderDescription = (description) => (jsx(Paragraph, { size: "text-s", font: "font-light", color: "text-secondary-text group-data-secondary:text-white", children: description }));
4928
4820
 
4929
- const TopItemMobile = ({ item, isActive, onClick }) => (jsxs("button", { type: "button", className: "relative", onClick: onClick, children: [jsx("span", { className: style('whitespace-nowrap', isActive ? 'text-primary-main' : ''), children: item.text }), isActive ? (jsx("div", { className: "absolute left-0 right-0 -bottom-3 h-0.5 bg-primary-main group-data-transparent:bg-transparent" })) : null] }));
4821
+ const Blocks = {
4822
+ AdTile,
4823
+ ApplicationForm,
4824
+ BenefitsBlock,
4825
+ Bonus,
4826
+ BonusBenefitsBlock,
4827
+ ButtonsBlock,
4828
+ Calculator,
4829
+ CardTransfer,
4830
+ Carousel,
4831
+ CarouselBankHistoryCard,
4832
+ CarouselCard,
4833
+ CarouselCatalogCard,
4834
+ CarouselLinks,
4835
+ CarouselRecommendationCard,
4836
+ CarouselTariffsCard,
4837
+ ComparisonTable,
4838
+ DepositFiltration,
4839
+ ErrorBlock,
4840
+ ExchangeRateTile,
4841
+ Footer,
4842
+ Header,
4843
+ Headline,
4844
+ HorizontalLayout,
4845
+ ImgBlock,
4846
+ LinkDocs,
4847
+ MobileAppTile,
4848
+ MortgageFiltration,
4849
+ OfficesAtmsMap,
4850
+ Placeholder,
4851
+ ProductBlock,
4852
+ ProductGallery,
4853
+ RepresentativeOfficeInfo,
4854
+ RichTextBlock,
4855
+ RollupItem,
4856
+ SafeDepositRental,
4857
+ StepsBlock,
4858
+ Tabs,
4859
+ TariffsTable,
4860
+ TextBlock,
4861
+ VerticalLayout,
4862
+ };
4930
4863
 
4931
- const BurgerMenuDialog = JSX((props) => {
4932
- const { topItems, officesLink, defaultLocation } = useSitemap(props.options?.page?.fallback);
4933
- const [location] = useLocation(defaultLocation);
4934
- const locationDialog = useLocationDialog();
4935
- const openLocationDialog = useCallback(() => locationDialog.open(), []);
4936
- const [containerRef, scroll] = useSwipeListScroll({
4937
- itemCount: topItems?.length ?? 0,
4938
- });
4939
- const [activeIndex] = useActiveRoute(topItems);
4940
- const [activeTopItemIndex, setActiveTopItemIndex] = useState(activeIndex);
4941
- const activeRoute = useMemo(() => topItems?.[activeTopItemIndex], [topItems, activeTopItemIndex]);
4942
- const activeMenuSubItems = activeRoute?.items || [];
4943
- useEffect(() => {
4944
- setActiveTopItemIndex(activeIndex);
4945
- }, [activeIndex]);
4946
- useEffect(() => {
4947
- if (activeTopItemIndex > 0) {
4948
- scroll.scrollTo(activeTopItemIndex);
4864
+ function useDebouncedEffect(effect, deps, delay = 300) {
4865
+ useEffect(() => {
4866
+ const timerId = globalThis.setTimeout(effect, delay);
4867
+ return () => {
4868
+ globalThis.clearTimeout(timerId);
4869
+ };
4870
+ }, deps);
4871
+ }
4872
+
4873
+ const CloseButton = JSX(({ className, onClose }) => (jsx("button", { className: style('flex justify-center items-center w-12 h-12 p-2xs bg-transparent border-none', className), onClick: onClose, title: "\u0417\u0430\u043A\u0440\u044B\u0442\u044C", children: jsx(Img, { image: { icon: 'CloseIcon' }, width: "24", height: "24" }) })));
4874
+
4875
+ const COOKIE_DIALOG_ID = 'cookie';
4876
+ const DIALOG_INITIAL_DELAY = 3 * 1000;
4877
+ const CookiePopup = JSX(({ termLink, personalDataPolicyLink }) => {
4878
+ const [opened, { setTrue: open, setFalse: close }] = useBool();
4879
+ useDebouncedEffect(() => {
4880
+ if (!globalThis.localStorage?.getItem(COOKIE_DIALOG_ID)) {
4881
+ open();
4949
4882
  }
4950
- }, [activeTopItemIndex, scroll]);
4951
- const handleTopItemClick = useCallback((idx) => setActiveTopItemIndex(idx), []);
4952
- return (jsx(Dialog, { head: jsx("div", { className: "flex items-center", children: jsx(Heading, { as: "h4", title: "\u041C\u0435\u043D\u044E" }) }), children: jsxs("div", { className: "flex flex-col flex-nowrap relative w-full h-auto m-auto bg-white pb-24 box-border rounded-md", children: [jsx("div", { className: "w-full mb-3", children: jsx(SwipeListContainer, { containerRef: containerRef, visibleItemCount: 0, gap: 20, className: "pb-3", children: topItems?.map((item, i) => (jsx(TopItemMobile, { item: item, isActive: activeTopItemIndex === i, onClick: () => handleTopItemClick(i) }, String(i)))) }) }), jsxs("div", { className: "relative grow overflow-auto", children: [jsx(ActiveSubMenu, { activeMenuSubItems: activeMenuSubItems, basePath: activeRoute?.href }), jsx(SearchBar, { className: "grow mb-5" }), renderOfficeLink(officesLink), jsxs("div", { className: "flex items-center text-s cursor-pointer", onClick: openLocationDialog, children: [jsx(Img, { image: { icon: 'GeolocationIcon', iconVersion: 'black' }, width: "24", height: "24", className: "text-primary-main box-border mr-xs bg-main-divider p-xs rounded-md" }), jsxs("div", { className: "flex flex-col items-start", children: [jsx(Text, { size: "text-h5", children: location.name }), jsx(Text, { color: "text-secondary-text", size: "text-s", children: "\u0412\u0430\u0448\u0430 \u043B\u043E\u043A\u0430\u0446\u0438\u044F" })] })] })] })] }) }));
4883
+ }, [], DIALOG_INITIAL_DELAY);
4884
+ const handleClose = useCallback(() => {
4885
+ globalThis.localStorage?.setItem(COOKIE_DIALOG_ID, 'true');
4886
+ close();
4887
+ }, []);
4888
+ return opened ? (jsx("div", { className: "container fixed left-0 right-0 bottom-0 z-50", children: jsxs("div", { className: "bg-white m-xl p-xl rounded-md flex sm:items-center shadow-main-black", children: [jsx("div", { className: "sm:flex-1", children: jsxs(Paragraph, { size: "text-s", font: "font-light", color: "text-primary-text", children: ["\u0410\u041E \u00AB\u0420\u043E\u0441\u0441\u0435\u043B\u044C\u0445\u043E\u0437\u0431\u0430\u043D\u043A\u00BB \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442", jsx(LinkWrapper, { isRemote: true, className: linkWrapperStyle(termLink?.href), ...termLink, children: "cookie" }), "(\u0444\u0430\u0439\u043B\u044B \u0441 \u0434\u0430\u043D\u043D\u044B\u043C\u0438 \u043E \u043F\u0440\u043E\u0448\u043B\u044B\u0445 \u043F\u043E\u0441\u0435\u0449\u0435\u043D\u0438\u044F\u0445 \u0441\u0430\u0439\u0442\u0430) \u0434\u043B\u044F \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043E\u0432 \u0438 \u0443\u0434\u043E\u0431\u0441\u0442\u0432\u0430 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u0435\u0439. \u0412\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0437\u0430\u043F\u0440\u0435\u0442\u0438\u0442\u044C \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435 cookie \u0432 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430\u0445 \u0441\u0432\u043E\u0435\u0433\u043E \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430.", jsx(LinkWrapper, { isRemote: true, className: linkWrapperStyle(personalDataPolicyLink?.href), ...personalDataPolicyLink, children: "\u041E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0430 \u0412\u0430\u0448\u0438\u0445 \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u043B\u044C\u043D\u044B\u0445 \u0434\u0430\u043D\u043D\u044B\u0445" }), "\u043F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u0438\u0442\u0441\u044F \u0432 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0442\u0440\u0435\u0431\u043E\u0432\u0430\u043D\u0438\u044F\u043C\u0438 \u0424\u0435\u0434\u0435\u0440\u0430\u043B\u044C\u043D\u043E\u0433\u043E \u0437\u0430\u043A\u043E\u043D\u0430 \u043E\u0442 27.07.2006 \u2116 152-\u04243 \u00AB\u041E \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u043B\u044C\u043D\u044B\u0445 \u0434\u0430\u043D\u043D\u044B\u0445\u00BB."] }) }), jsx("div", { className: "ml-s sm:ml-0 w-24 flex justify-end", children: jsx(CloseButton, { className: "bg-main-gray rounded-md", onClose: handleClose }) })] }) })) : null;
4953
4889
  });
4954
- const renderOfficeLink = (officesLink) => officesLink ? (jsxs("a", { className: "flex items-center mb-3", href: officesLink, rel: "noopener noreferrer", "aria-label": "\u041E\u0444\u0438\u0441\u044B \u0438 \u0431\u0430\u043D\u043A\u043E\u043C\u0430\u0442\u044B", children: [jsx(Img, { image: { icon: 'MapOpenedIcon', iconVersion: 'black' }, width: "24", height: "24", className: "text-primary-main box-border mr-xs bg-main-divider p-xs rounded-md" }), jsx("span", { children: "\u041E\u0444\u0438\u0441\u044B \u0438 \u0431\u0430\u043D\u043A\u043E\u043C\u0430\u0442\u044B" })] })) : null;
4890
+ const linkWrapperStyle = (href) => style('inline mx-2xs', href ? 'text-green-dark' : '');
4955
4891
 
4956
- const BURGER_MENU_DIALOG_ID = 'burgerMenuDialog';
4957
- const useBurgerMenuDialog = () => {
4958
- const { open: openDialog, closeAll, close } = useDialogManager();
4959
- const dialogs = useDialogsList();
4960
- const isBurgerMenuOpen = isDialogOpen(BURGER_MENU_DIALOG_ID, dialogs);
4961
- const open = useCallback(() => openDialog(jsx(BurgerMenuDialog, {}), { id: BURGER_MENU_DIALOG_ID }), []);
4962
- const toggle = useCallback(() => {
4963
- if (isBurgerMenuOpen) {
4964
- closeAll();
4892
+ function useList(initialList = []) {
4893
+ const [list, setList] = useState(initialList);
4894
+ const push = useCallback((item) => setList(_ => [..._, item]), []);
4895
+ const pop = useCallback(() => setList(_ => _.slice(0, -1)), []);
4896
+ const remove = useCallback((item) => setList(_ => _.filter(currentItem => currentItem !== item)), []);
4897
+ const clear = useCallback(() => setList([]), []);
4898
+ return [list, { setList, push, pop, remove, clear }];
4899
+ }
4900
+
4901
+ const useDialogsList = ({ onCloseAll, onClose, } = {}) => {
4902
+ const [dialogs, { push, pop, clear }] = useList();
4903
+ const closeAll = useCallback(() => {
4904
+ onCloseAll && onCloseAll(dialogs);
4905
+ clear();
4906
+ }, [dialogs, onCloseAll]);
4907
+ const close = useCallback(() => {
4908
+ onClose && onClose(dialogs[dialogs.length - 1]);
4909
+ pop();
4910
+ }, [dialogs, onClose]);
4911
+ useEffect(() => defaultEventBus.subscribe('dialog', (action) => {
4912
+ switch (action.type) {
4913
+ case 'open':
4914
+ push(action);
4915
+ break;
4916
+ case 'close':
4917
+ if (action.all) {
4918
+ closeAll();
4919
+ }
4920
+ else {
4921
+ close();
4922
+ }
4923
+ break;
4924
+ default:
4925
+ assertUnreachable(action);
4926
+ }
4927
+ }), [closeAll, close]);
4928
+ return dialogs;
4929
+ };
4930
+
4931
+ const DialogManager = JSX(() => {
4932
+ const handleCloseAll = useCallback((dialogs) => {
4933
+ for (const _ of dialogs) {
4934
+ _?.onClose && _.onClose();
4935
+ }
4936
+ }, []);
4937
+ const handleClose = useCallback((_) => {
4938
+ _?.onClose && _.onClose();
4939
+ }, []);
4940
+ const dialogs = useDialogsList({ onCloseAll: handleCloseAll, onClose: handleClose });
4941
+ const { close } = useDialogManager();
4942
+ const escapeHandler = useCallback(({ key }) => {
4943
+ if (key === 'Escape') {
4944
+ close();
4945
+ }
4946
+ }, []);
4947
+ useEventListener(globalThis.document, 'keydown', escapeHandler);
4948
+ useEffect(() => {
4949
+ if (dialogs.length) {
4950
+ globalThis.document?.body.classList.add('no-scrollbar');
4951
+ globalThis.document?.body.classList.add('overflow-hidden');
4965
4952
  }
4966
4953
  else {
4967
- open();
4954
+ globalThis.document?.body.classList.remove('no-scrollbar');
4955
+ globalThis.document?.body.classList.remove('overflow-hidden');
4968
4956
  }
4969
- }, [isBurgerMenuOpen]);
4970
- return [Boolean(isBurgerMenuOpen), { open, close, toggle }];
4971
- };
4957
+ }, [dialogs]);
4958
+ return dialogs.length ? (jsx("div", { className: "fixed inset-0 z-50", role: "dialog", children: dialogs.map(({ dialog, id }, i) => (jsx("div", { className: style('absolute inset-0 overflow-x-hidden overflow-y-scroll no-scrollbar', i === dialogs.length - 1 ? '' : 'hidden'), children: dialog }, String(id || i)))) })) : null;
4959
+ });
4972
4960
 
4973
- const EMPTY_MENU = [];
4974
- const StickyBottomMenu = JSX(({ ...rest }) => {
4975
- const [isBurgerMenuDialogOpen, { toggle, close }] = useBurgerMenuDialog();
4976
- const { menuItems = EMPTY_MENU } = useSWRResource(projectSettings.STICKY_MOBILE_MENU || 'sticky-mobile-menu', { fallback: rest.options?.page?.fallback, folderName: 'portal-resources', setBasePath: true });
4977
- const [, activeItem] = useActiveRoute(menuItems);
4978
- const middleIdx = Math.floor(menuItems.length / 2);
4979
- const leftItems = menuItems.slice(0, middleIdx);
4980
- const rightItems = menuItems.slice(middleIdx);
4981
- /* Attribute [data-component] need for correct render in wcms editor. Do not remove. */
4982
- return (jsx("div", { className: "w-full mb-5", "data-component": "sticky-bottom-menu-container", children: jsx(BlockWrapper, { className: "@container-normal fixed w-full h-[74px] bottom-0 left-0 my-0 mx-auto bg-transparent z-[100]", padding: "p-0", children: jsxs("div", { className: "ml-auto container bg-white flex justify-center shadow-blue-gray", children: [leftItems.map(renderMenuItem(activeItem, close)), jsx(StickyBottomMenuBurger, { isActive: isBurgerMenuDialogOpen, onClick: toggle }), rightItems.map(renderMenuItem(activeItem, close))] }) }) }));
4961
+ const PopupManager = JSX(() => {
4962
+ const [popup, setPopup] = useState(null);
4963
+ const close = useCallback(() => {
4964
+ setPopup(null);
4965
+ }, []);
4966
+ useEffect(() => defaultEventBus.subscribe('popup', (action) => {
4967
+ switch (action.type) {
4968
+ case 'open':
4969
+ case 'update':
4970
+ setPopup(action);
4971
+ break;
4972
+ case 'close':
4973
+ close();
4974
+ break;
4975
+ default:
4976
+ assertUnreachable(action);
4977
+ }
4978
+ }), []);
4979
+ const escapeHandler = useCallback(({ key }) => {
4980
+ if (key === 'Escape') {
4981
+ close();
4982
+ }
4983
+ }, [close]);
4984
+ useEventListener(globalThis.document, 'keydown', escapeHandler);
4985
+ return popup ? (jsx("div", { className: "absolute z-50", style: {
4986
+ left: `${popup.left}px`,
4987
+ top: `${popup.top}px`,
4988
+ ...(popup.width ? { width: `${popup.width}px` } : {}),
4989
+ }, role: "dialog", children: popup.popup })) : null;
4983
4990
  });
4984
- const renderMenuItem = (activeItem, close) => (_, i) => (jsx(StickyBottomMenuItem, { isActive: _ === activeItem, item: _, onClick: close }, _.href || String(i)));
4985
4991
 
4986
- const scrollButtonStyle = 'hidden sm:flex absolute z-40 top-0';
4987
- const ScrollableTabsControl = JSX(({ className, items = [], value, onChange, tabsType }) => {
4988
- const [containerRef, scroll] = useSwipeListScroll({
4989
- itemCount: items?.length || 0,
4990
- });
4991
- return (jsxs("div", { className: style('relative overflow-x-auto no-scrollbar', className), role: "tablist", children: [jsx(SwipeListContainer, { containerRef: containerRef, snapAlign: "snap-start", onVisibleIndicesChange: scroll.handleVisibleIndicesChange, children: items.map(renderTab(value, onChange, tabsType)) }), scroll.canScrollLeft ? (jsx(ScrollLeftButton, { className: style('left-6', scrollButtonStyle), onClick: scroll.scrollLeft })) : null, scroll.canScrollRight ? (jsx(ScrollRightButton, { className: style('right-6', scrollButtonStyle), onClick: scroll.scrollRight })) : null] }));
4992
+ const isHrefActive = (router) => ({ href }) => !href ? false : withoutQuery(getRouterHref(href, router)).startsWith(withoutQuery(href));
4993
+ const getRouterHref = (href, router) => isURL(href) ? router.href : router.pathname;
4994
+
4995
+ const isTopItemActive = (router) => isHrefActive(projectSettings.BASE_PATH ? { pathname: projectSettings.BASE_PATH } : router);
4996
+
4997
+ function useActiveRoute(items = []) {
4998
+ const router = useRouter();
4999
+ const activeIndex = items.findIndex(isTopItemActive(router));
5000
+ return [activeIndex, items[activeIndex]];
5001
+ }
5002
+
5003
+ const StickyBottomMenuBurger = JSX(({ isActive, onClick }) => (jsxs("button", { className: style(isActive ? 'text-primary-main' : 'text-primary-text', `w-10 m-4 flex justify-center items-center flex-col text-xs cursor-pointer`), onClick: onClick, children: [jsx(Icon, { className: "w-6 h-6", name: "BurgerIcon", iconVersion: isActive ? 'color' : 'black' }), "\u041C\u0435\u043D\u044E"] })));
5004
+
5005
+ const StickyBottomMenuItem = JSX(({ isActive, item, onClick }) => {
5006
+ const link = useLink({ isRemote: true });
5007
+ const { href, onClick: handleClick } = link({ href: item?.href, onClick });
5008
+ return (jsxs("a", { className: style(isActive ? 'text-primary-main' : 'text-primary-text', `w-10 m-4 flex justify-center items-center flex-col text-xs cursor-pointer`), href: href, target: "_self", title: item?.title || '', onClick: handleClick, children: [jsx(Icon, { className: "w-6 h-6", name: item?.icon?.icon, iconVersion: isActive ? 'color' : 'black' }), item?.title || ''] }));
4992
5009
  });
4993
5010
 
4994
- const renderTabs = ({ tabsMode, ...props }) => {
4995
- switch (tabsMode) {
4996
- case 'wideScreen':
4997
- return jsx(TabsControl, { ...props });
4998
- case 'centered':
4999
- return (jsx("div", { className: "flex", children: jsx(TabsControl, { className: "m-auto p-xs rounded-md bg-main-gray", tabsType: "rounded", ...props }) }));
5000
- case 'scrollable':
5001
- return (jsx("div", { className: "flex", children: jsx(ScrollableTabsControl, { className: "m-auto", tabsType: "underlined", ...props }) }));
5002
- default:
5003
- return null;
5011
+ const isDialogOpen = (id, dialogs) => dialogs.find((item) => item.id === id, id);
5012
+
5013
+ const Dialog = JSX(({ className, head, children, onClose }) => {
5014
+ const { close } = useDialogManager();
5015
+ const handleClose = useCallback(() => {
5016
+ close();
5017
+ onClose && onClose();
5018
+ }, [onClose]);
5019
+ return (jsxs("div", { className: style('relative min-h-full bg-white pt-0 p-5', className), children: [jsxs("div", { className: "sticky py-xl top-0 bg-white z-10", children: [jsx(CloseButton, { className: "absolute top-0 right-0", onClose: handleClose }), jsx("div", { className: "container", children: head })] }), jsx("div", { className: "container pb-6xl", children: children })] }));
5020
+ });
5021
+
5022
+ const REGIONS_URL = '/api/v1/regions';
5023
+ function useRegions() {
5024
+ const { data } = useAsyncData(REGIONS_URL, fetchJSONUnsafe);
5025
+ return data || [];
5026
+ }
5027
+
5028
+ const groupBy = (list, keyGetter) => {
5029
+ const result = new Map();
5030
+ for (const item of list) {
5031
+ const key = keyGetter(item);
5032
+ const group = result.get(key) || [];
5033
+ result.set(key, [...group, item]);
5004
5034
  }
5035
+ return result;
5005
5036
  };
5006
5037
 
5007
- const TAB_QUERY_PARAM_KEY = 'tab';
5008
- const Tabs = JSX(({ className = '', isSticky, tabs = [], tabsMode, ...rest }) => {
5009
- const router = useRouter();
5010
- const { isReady } = router;
5011
- const tabsControlItems = useMemo(() => tabs.map(normalizeTab), [tabs]);
5012
- const [activeTabIndex, setActiveTabIndex] = useState(0);
5013
- useEffect(() => {
5014
- if (!tabs || !tabs[0]) {
5015
- return;
5016
- }
5017
- const defaultTabIndex = router.query[TAB_QUERY_PARAM_KEY]
5018
- ? tabs.findIndex((_) => _.type === 'group' && _.ref === router.query[TAB_QUERY_PARAM_KEY]) || 0
5019
- : 0;
5020
- const defaultTab = tabs[defaultTabIndex] || tabs[0];
5021
- setActiveTabIndex(defaultTabIndex);
5022
- fireTabEvent(defaultTab);
5023
- }, [isReady]);
5024
- useEffect(() => {
5025
- const activeTab = tabs[activeTabIndex];
5026
- if (activeTab?.type === 'group') {
5027
- defaultEventBus.subject('tab', {
5028
- type: activeTab.type,
5029
- label: activeTab.ref,
5030
- groupName: activeTab.name,
5031
- });
5038
+ const JARO_WINKLER_P = 0.1;
5039
+ const JARO_WINKLER_MAX_L = 4;
5040
+ const jaroWinklerDistance = (s1) => (s2) => {
5041
+ if (s1 === s2) {
5042
+ return 1;
5043
+ }
5044
+ if (!s1 || !s2) {
5045
+ return 0;
5046
+ }
5047
+ const { m, s1Matches, s2Matches } = computeM(s1, s2);
5048
+ if (m === 0) {
5049
+ return 0;
5050
+ }
5051
+ const t = computeT(s1, s2, { s1Matches, s2Matches });
5052
+ const jaroWeight = (m / s1.length + m / s2.length + (m - t / 2) / m) / 3;
5053
+ const winklerWeight = jaroWeight > 0.7 ? computePrefixL(s1, s2) * JARO_WINKLER_P : 0;
5054
+ return jaroWeight + winklerWeight * (1 - jaroWeight);
5055
+ };
5056
+ function computeM(s1, s2) {
5057
+ const range = Math.max(0, Math.floor(Math.max(s1.length, s2.length) / 2) - 1);
5058
+ const s1Matches = Array.from({ length: s1.length });
5059
+ const s2Matches = Array.from({ length: s2.length });
5060
+ let m = 0;
5061
+ for (let i = 0; i < s1.length; i++) {
5062
+ const low = Math.max(0, i - range);
5063
+ const high = Math.min(i + range, s2.length - 1);
5064
+ for (let j = low; j <= high; j++) {
5065
+ if (s1Matches[i] || s2Matches[j] || s1[i] !== s2[j]) {
5066
+ continue;
5067
+ }
5068
+ m++;
5069
+ s1Matches[i] = true;
5070
+ s2Matches[j] = true;
5032
5071
  }
5033
- }, [tabs, activeTabIndex]);
5034
- const updateUrlSearchTabParam = (_) => {
5035
- const searchParams = new URLSearchParams(router.query);
5036
- if (_.name) {
5037
- searchParams.set(TAB_QUERY_PARAM_KEY, _.name);
5072
+ }
5073
+ return { m, s1Matches, s2Matches };
5074
+ }
5075
+ function computeT(s1, s2, { s1Matches, s2Matches }) {
5076
+ let t = 0;
5077
+ for (let i = 0, k = 0; i < s1.length; i++) {
5078
+ if (!s1Matches[i]) {
5079
+ continue;
5038
5080
  }
5039
- else {
5040
- searchParams.delete(TAB_QUERY_PARAM_KEY);
5081
+ let j = k;
5082
+ for (; j < s2.length; j++) {
5083
+ if (s2Matches[j]) {
5084
+ k = j + 1;
5085
+ break;
5086
+ }
5041
5087
  }
5042
- router.replace(`${router.pathname}?${searchParams}`, '', { scroll: false });
5043
- };
5044
- const handleChange = useCallback((_) => {
5045
- const index = tabsControlItems.indexOf(_);
5046
- const tab = tabs[index];
5047
- setActiveTabIndex(index);
5048
- fireTabEvent(tab);
5049
- if (tab.type === 'group') {
5050
- updateUrlSearchTabParam(_);
5088
+ if (s1[i] !== s2[j]) {
5089
+ t++;
5051
5090
  }
5052
- }, [tabs, tabsControlItems]);
5053
- return (jsx(BlockWrapper, { className: style(isSticky ? 'sticky top-1 z-20' : '', className), defaultPadding: "p-0", ...rest, children: renderTabs({
5054
- items: tabsControlItems,
5055
- value: tabsControlItems[activeTabIndex],
5056
- tabsMode,
5057
- onChange: handleChange,
5058
- }) }));
5059
- });
5060
- const fireTabEvent = (tab) => {
5061
- if (tab.type === 'group') {
5062
- defaultEventBus.fire('tab', { type: tab.type, label: tab.ref, groupName: tab.name });
5063
5091
  }
5064
- if (tab.type === 'link') {
5065
- defaultEventBus.fire('tab', { type: tab.type, label: tab.href });
5092
+ return t;
5093
+ }
5094
+ function computePrefixL(s1, s2) {
5095
+ let prefixL = 0;
5096
+ while (s1[prefixL] === s2[prefixL] && prefixL < JARO_WINKLER_MAX_L) {
5097
+ prefixL++;
5066
5098
  }
5067
- };
5068
- const normalizeTab = (_) => _?.type === 'group' ? { text: _.title, name: _.ref } : _;
5099
+ return prefixL;
5100
+ }
5069
5101
 
5070
- const dividerStyle = '@4xl:border-main-divider @4xl:border-b';
5071
- const firstCellStyle = 'w-80 flex-shrink-0';
5072
- const COLS_LENGTH_FOR_SCROLL = 2;
5073
- const COLUMN_WIDTH$1 = 4 * 80 + 40; // w-80 + pl-10 = 360px
5102
+ const renderForeignOffices = (foreignOffices) => foreignOffices?.length ? (jsxs("div", { className: "sm:border-t sm:border-main-divider mt-2xs pt-2xs", children: [jsx("div", { className: "mb-m", children: jsx(Text, { size: "text-m", font: "font-light", color: "text-secondary-text", children: "\u041F\u0440\u0435\u0434\u0441\u0442\u0430\u0432\u0438\u0442\u0435\u043B\u044C\u0441\u0442\u0432\u0430 \u0437\u0430 \u0440\u0443\u0431\u0435\u0436\u043E\u043C:" }) }), jsx("div", { className: "flex flex-col sm:flex-row gap-5xl", children: foreignOffices.map((office, i) => (jsx(ForeignOffice, { ...office }, String(i)))) })] })) : null;
5103
+ const ForeignOffice = JSX(({ icon, ...rest }) => {
5104
+ const link = useLink();
5105
+ const { text, target, href, onClick } = link(rest);
5106
+ return (jsxs("div", { className: "flex gap-s items-center", children: [icon ? jsx(Img, { pathPrefix: "/wcms-resources/", image: icon }) : null, text ? (jsx("a", { className: "hover:text-primary-hover", href: href, target: target, onClick: onClick, children: jsx(Text, { size: "text-l", font: "font-light", color: "text-primary-text", children: text }) })) : null] }));
5107
+ });
5074
5108
 
5075
- const carouselContainerClassesMap = {
5076
- comparison: 'flex gap-m duration-1000',
5077
- tariff: 'flex gap-5xl flex-grow duration-1000',
5078
- };
5079
- const TableCarouselContainer = JSX(({ children, activeIndex, columnWidth, version = 'comparison' }) => (jsx("div", { className: "flex flex-1 overflow-hidden", children: jsx("div", { className: carouselContainerClassesMap[version], style: { transform: `translateX(-${activeIndex * columnWidth}px)` }, children: children }) })));
5109
+ const renderRegion = (onChangeLocation) => (region) => (jsx("div", { className: "mb-xs sm:mb-2xs", children: jsx("button", { className: "cursor-pointer hover:text-primary-hover", onClick: () => {
5110
+ onChangeLocation && onChangeLocation(region);
5111
+ }, children: jsx(Text, { size: "text-l", font: "font-light", children: region.name || '' }) }) }, region.id));
5080
5112
 
5081
- const TableInnerButton = JSX(({ className = '', isOpen, onClick }) => (jsx(LinkButton, { className: className, appendRight: jsx(Img, { image: { icon: isOpen ? 'ArrowUpIcon' : 'ArrowDownIcon' }, width: "20", height: "20" }), text: isOpen ? 'Скрыть' : 'Показать', version: "gray", onClick: onClick })));
5113
+ const renderRegionGroup = (onChangeLocation) => ([letter, regions]) => (jsxs("div", { className: "break-inside-avoid mb-2xl w-56", children: [jsx("div", { className: "mb-s", children: jsx(Text, { size: "text-h6", children: letter }) }), regions.map(renderRegion(onChangeLocation))] }, letter));
5082
5114
 
5083
- const renderButtonsCellData = ({ buttons }) => renderButtonsSection(buttons, {
5084
- buttonClassName: 'basis-0',
5115
+ const SearchBar$1 = JSX(({ className, searchTerm, onSearch }) => {
5116
+ 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: `h-12 pl-m w-full peer text-l text-black border border-solid rounded-md box-border
5117
+ outline-none border-gray hover:border-primary-hover active:border-primary-text focus:border-primary-text`, value: searchTerm, onChange: (e) => onSearch(e.target.value.toLowerCase()), type: "text", name: "location-search-bar-input" })] }));
5085
5118
  });
5086
- const renderLabelDescriptionCellData = ({ label, description }) => (jsxs("div", { className: "space-y-2xs", children: [label ? (jsx("div", { children: jsx(Text, { size: "text-h6", children: label }) })) : null, description ? (jsx("div", { children: jsx(Text, { size: "text-l", color: "text-secondary-text", children: description }) })) : null] }));
5087
- const renderImgCellData = ({ image }) => (image?.src ? jsx(Img, { image: image }) : null);
5088
- const renderListCellData = ({ isDotted, ...rest }) => (jsx(List, { className: "flex flex-col justify-between items-start text-h6", isDotted: isDotted ?? true, ...rest }));
5089
- const renderInnerTableCellData = ({ isVisible, displayTable, dataUrl, pdfUrl, isOpen, }) => isVisible ? (jsx(TableInnerButton, { isOpen: isOpen, onClick: () => {
5090
- displayTable({ dataUrl, pdfUrl });
5091
- } })) : null;
5092
- const EmbeddableCellData = {
5093
- Buttons: renderButtonsCellData,
5094
- Img: renderImgCellData,
5095
- List: renderListCellData,
5096
- LabelDescription: renderLabelDescriptionCellData,
5097
- Table: renderInnerTableCellData,
5098
- };
5099
5119
 
5100
- const RenderCellInner = JSX(({ cell, fieldIdx, rowIdx, cellIdx, setTableInner, tableInner, openTableInnerIdx, setOpenTableInnerIdx, }) => {
5101
- const [isVisible, setVisibility] = useState(true);
5102
- useEffect(() => {
5103
- if (cellIdx !== openTableInnerIdx || !tableInner) {
5104
- setVisibility(true);
5105
- }
5106
- }, [tableInner, openTableInnerIdx]);
5107
- const displayTable = (props) => {
5108
- setVisibility(false);
5109
- setOpenTableInnerIdx(cellIdx);
5110
- setTableInner(props);
5111
- };
5112
- return renderCell({
5113
- cell,
5114
- cellProps: {
5115
- rowIdx,
5116
- cellIdx,
5117
- fieldIdx,
5118
- displayTable,
5119
- isVisible,
5120
- },
5121
- });
5120
+ const SEARCH_TERM_MIN_LENGTH = 3;
5121
+ const LocationDialog = JSX(() => {
5122
+ const { defaultLocation, foreignOffices } = useSitemap();
5123
+ const [currentLocation, selectCurrentLocation] = useLocation(defaultLocation);
5124
+ const [query, setQuery] = useState('');
5125
+ const regions = cleanUpRegions(useRegions()).sort((a, b) => a.name.localeCompare(b.name));
5126
+ const regionsGroupByLetter = groupBy(regions, regionFirstLetter);
5127
+ const { close } = useDialogManager();
5128
+ const handleChangeLocation = useCallback((region) => {
5129
+ selectCurrentLocation(region);
5130
+ close();
5131
+ }, []);
5132
+ 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 ? (jsxs("div", { className: "mb-s", children: [jsx(Text, { size: "text-l", font: "font-light", children: "\u0421\u0435\u0439\u0447\u0430\u0441 \u0432\u044B\u0431\u0440\u0430\u043D:\u00A0" }), jsx("button", { onClick: () => selectCurrentLocation(currentLocation), children: jsx(Text, { color: "text-primary-main", children: currentLocation.name }) })] })) : null, jsx(SearchBar$1, { onSearch: setQuery, searchTerm: query })] }), children: [query && query.length >= SEARCH_TERM_MIN_LENGTH ? (jsx("div", { children: regions
5133
+ .filter(({ name }) => name && jaroWinklerDistance(name.toLowerCase())(query.toLowerCase()) >= 0.8)
5134
+ .map(renderRegion(handleChangeLocation)) })) : (jsx("div", { className: "columns-1 sm:columns-5", children: Array.from(regionsGroupByLetter.entries()).map(renderRegionGroup(handleChangeLocation)) })), renderForeignOffices(foreignOffices)] }));
5122
5135
  });
5123
- const renderCell = ({ cell, cellProps }) => {
5124
- if (!cell) {
5125
- return null;
5126
- }
5127
- const { tableCellType: type, ...rest } = cell;
5128
- if (!type || !(type in EmbeddableCellData)) {
5129
- return null;
5130
- }
5131
- const EmbeddableCellInner = EmbeddableCellData[type];
5132
- return jsx(EmbeddableCellInner, { ...cellProps, ...rest });
5136
+ const regionFirstLetter = (region) => region.name?.charAt(0) || '';
5137
+ const cleanUpRegions = (regions) => regions.map((region) => ({
5138
+ ...region,
5139
+ name: region.name?.replace(/республика|область|край'/gi, '').trim() || '',
5140
+ }));
5141
+
5142
+ const useLocationDialog = () => {
5143
+ const { open, close } = useDialogManager();
5144
+ return {
5145
+ open: (options = {}) => open(jsx(LocationDialog, {}), options),
5146
+ close,
5147
+ };
5133
5148
  };
5134
5149
 
5135
- const TariffsTableCell = JSX(({ cells, rowIdx, cellIdx, setTableInner, tableInner, openTableInnerIdx, setOpenTableInnerIdx, }) => {
5136
- return (jsx("div", { className: "w-80 flex-grow flex flex-col gap-m @4xl:gap-lg", role: "cell", children: cells?.length
5137
- ? cells.map((_, i) => (jsx(RenderCellInner, { cell: _, fieldIdx: i, rowIdx: rowIdx, cellIdx: cellIdx, setTableInner: setTableInner, tableInner: tableInner, openTableInnerIdx: openTableInnerIdx, setOpenTableInnerIdx: setOpenTableInnerIdx }, String(i))))
5138
- : null }));
5150
+ const SearchInput = JSX(({ className, value, autoFocus, onChange, onFocus, placeholder = 'Поиск по сайту' }) => {
5151
+ const handleChange = useCallback((ev) => {
5152
+ onChange && onChange(ev.target?.value || '');
5153
+ }, [onChange]);
5154
+ return (jsxs("div", { className: style('font-sans relative', className), role: "form", children: [jsx("div", { className: "absolute h-full flex items-center pl-m pointer-events-none", children: jsx(Img, { image: { icon: 'LoupeIcon', iconVersion: 'black' }, width: "24", height: "24" }) }), jsx("input", { className: style('h-14 w-full px-10 text-l text-black outline-none box-border border border-solid rounded-md', 'border-gray hover:border-primary-hover active:border-primary-text focus:border-primary-text'), value: value, type: "text", name: "search-bar-input", placeholder: placeholder, autoFocus: autoFocus, onChange: handleChange, onFocus: onFocus })] }));
5139
5155
  });
5140
5156
 
5141
- const COLUMN_WIDTH = 140;
5142
- const getHorizontalShift = (columns, activeColumnIndex) => sum(columns.slice(0, activeColumnIndex).map((_) => _?.cols?.length ?? 1)) * COLUMN_WIDTH;
5157
+ const compareBy = (indexOf) => (a, b) => indexOf(a) - indexOf(b);
5158
+ const desc = (cmp) => (a, b) => -cmp(a, b);
5143
5159
 
5144
- const renderInnerTableRow = (activeColumnIndex) => (rowData, rowIdx) => {
5145
- if (!rowData?.length) {
5146
- return null;
5160
+ const joinMaps = (aggregate, emptyVal) => (acc, map) => {
5161
+ for (const [key, b] of map) {
5162
+ acc.set(key, aggregate(acc.get(key) || emptyVal, b));
5147
5163
  }
5148
- const [headerColumn, ...columns] = rowData;
5149
- const columnsStyle = style('flex duration-1000 text-center', rowIdx !== 0 ? 'font-normal' : 'font-light');
5150
- return (jsxs("div", { className: "flex border-main-divider border-b border-solid h-full", children: [headerColumn?.data ? (jsx("div", { className: "text-xl font-light w-56 min-w-56 py-lg", children: headerColumn.data })) : null, jsx("div", { className: "flex flex-grow overflow-hidden", children: jsx("div", { className: columnsStyle, style: {
5151
- transform: `translateX(-${getHorizontalShift(columns, activeColumnIndex)}px)`,
5152
- }, children: columns?.map((_, i) => (jsxs("div", { className: "flex flex-col flex-grow gap-s justify-center py-xl odd:bg-main-divider", children: [_?.data ? jsx("div", { className: "text-xl font-light", children: _.data }) : null, _?.cols ? renderCols(_.cols, activeColumnIndex) : null] }, `row${i}`))) }) })] }, String(rowIdx)));
5164
+ return acc;
5153
5165
  };
5154
- const renderCols = (cols, rowIndex) => cols?.length > 0 ? (jsx("div", { className: style('flex', rowIndex === 0 ? 'text-secondary-text' : ''), children: cols.map((data, i) => (jsx("div", { className: "w-20 text-h6 mx-lg", children: data }, String(i)))) })) : null;
5155
-
5156
- const InnerTableBodyItem = JSX(({ rows }) => (jsx(SwipeListContainer, { visibleItemCount: 0, snapAlign: "snap-start", children: jsx("div", { children: rows?.map(renderInnerTableRow(0)) }) })));
5157
5166
 
5158
- const InnerTableBody = JSX(({ activeTabIndex, items }) => {
5159
- return (jsx("div", { children: items.map((_, tableIdx) => {
5160
- const key = `activeTabIdx:${activeTabIndex}-tableIdx:${tableIdx}`;
5161
- return (jsxs("div", { className: "w-full @container", children: [jsx("div", { className: "flex p-m bg-white @4xl:bg-gray text-center justify-center relative", children: jsx(Text, { size: "text-xl", font: "font-light", children: _.title }) }), jsx("div", { className: "w-full pl-xs overflow-hidden transition-height duration-500 ease-in-out", children: jsx("div", { className: "relative", children: jsx(InnerTableBodyItem, { rows: _.rowsData }) }) })] }, key));
5162
- }) }));
5163
- });
5167
+ const MIN_TERM_LEN = 3;
5168
+ const tokenize = (text) => text
5169
+ .toLowerCase()
5170
+ .split(/[^0-9a-zа-я-]+/)
5171
+ .filter((token) => token.length >= MIN_TERM_LEN && !/[0-9a-z]/.test(token));
5164
5172
 
5165
- const linkButtonVersion = 'link';
5173
+ const textRank = (queryTokens) => (text) => {
5174
+ const textTokens = tokenize(text || '');
5175
+ return textTokens.length
5176
+ ? sum(queryTokens.map((qToken) => max(textTokens.map(jaroWinklerDistance(qToken)))))
5177
+ : 0;
5178
+ };
5166
5179
 
5167
- const InnerTableHeader = JSX(({ currencies, linkToPDF, activeTabIndex, setActiveTabIndex }) => (jsxs("div", { className: "flex justify-between items-center w-full py-lg", children: [currencies && currencies.length > 1 ? (jsx("div", { className: "flex bg-secondary-light p-2xs rounded-md", children: currencies.map((currency, idx) => (jsx("div", { className: `rounded-md text-xl font-light px-4 py-3 cursor-pointer ${idx === activeTabIndex ? 'bg-primary-main text-white' : 'text-secondary-text'}`, onClick: () => setActiveTabIndex(idx), children: currency || idx + 1 }, currency))) })) : null, linkToPDF ? (jsx(LinkButton, { className: "text-primary-main", href: linkToPDF, version: linkButtonVersion, target: "_blank", appendLeft: jsx(Icon, { name: "DocDownloadIcon", iconVersion: "color", className: "mr-3xs", width: "20", height: "20" }), text: "\u0421\u043A\u0430\u0447\u0430\u0442\u044C \u0432 PDF" })) : null] })));
5180
+ const JW_THRESHOLD = 0.8;
5181
+ const RANK_EPS = 0.001;
5182
+ const search = (query) => (searchIndex) => {
5183
+ const { corpus, dictionary } = searchIndex || {};
5184
+ if (!query || !corpus?.length || !dictionary || !Object.keys(dictionary).length) {
5185
+ return [];
5186
+ }
5187
+ const queryTokens = tokenize(query);
5188
+ if (!queryTokens.length) {
5189
+ return [];
5190
+ }
5191
+ const dictEntries = Object.entries(dictionary);
5192
+ const pagesRanking = queryTokens
5193
+ .map(computePagesRankingPerToken(dictEntries))
5194
+ .reduce(joinMaps((a, b) => a + b, 0), new Map());
5195
+ const relevantPages = [...pagesRanking.entries()]
5196
+ .filter(([, pageRank]) => pageRank >= (JW_THRESHOLD - RANK_EPS) * queryTokens.length) // Multiplication of query tokens
5197
+ .map(([pageIndex]) => corpus[pageIndex]);
5198
+ return sortResultsByRank(queryTokens)(relevantPages);
5199
+ };
5200
+ const computePagesRankingPerToken = (dictEntries) => (qToken) => dictEntries
5201
+ .map(([stem, pageIndices]) => [jaroWinklerDistance(qToken)(stem), pageIndices])
5202
+ .filter(([stemRank]) => stemRank >= JW_THRESHOLD)
5203
+ .map(([stemRank, pageIndices]) => fillMapWith(pageIndices, stemRank))
5204
+ .reduce(joinMaps(Math.max, 0), new Map());
5205
+ const sortResultsByRank = (queryTokens) => (results) => zip(results, results.map(({ title }) => title).map(textRank(queryTokens)))
5206
+ .sort(desc(compareBy(([, pageTitleRank]) => pageTitleRank)))
5207
+ .map(([corpusItem]) => corpusItem);
5208
+ const fillMapWith = (keys, value) => new Map(keys.map((_) => [_, value]));
5168
5209
 
5169
- function useTariffsInnerTableData(directoryName) {
5170
- const { data } = useAsyncData(tariffsInnerTableDataUrl(directoryName), fetchTariffsInnerTableData);
5171
- return data || {};
5172
- }
5173
- async function fetchTariffsInnerTableData(url) {
5174
- const response = await fetch(url);
5175
- return await response.json();
5176
- }
5177
- function tariffsInnerTableDataUrl(directoryName) {
5178
- return `/wcms-resources/${directoryName || 'tariffs-inner-table-data'}.json`;
5179
- }
5210
+ const SEARCH_INDEX_FILENAME = 'search.index.json';
5211
+ const useSearch = ({ basePathList, initialQuery = '', }) => {
5212
+ const [query, setQuery] = useState(initialQuery || '');
5213
+ useEffect(() => {
5214
+ if (initialQuery !== undefined && initialQuery !== null) {
5215
+ setQuery(initialQuery);
5216
+ }
5217
+ }, [initialQuery]);
5218
+ const { data } = useAsyncData(basePathList?.length ? basePathList : null, fetchSearchIndex);
5219
+ const [result, setResult] = useState(null);
5220
+ useDebouncedEffect(() => {
5221
+ if (data) {
5222
+ setResult(data.map(search(query)));
5223
+ }
5224
+ }, [data, query]);
5225
+ return [result, { value: query, onChange: setQuery }];
5226
+ };
5227
+ const fetchSearchIndex = async (...basePathList) => (await Promise.allSettled(basePathList.map((basePath) => fetchJSON(joinPath(basePath, '/', SEARCH_INDEX_FILENAME))))).map((_) => (_.status === 'fulfilled' ? _.value : {}));
5180
5228
 
5181
- const EMPTY_DATA = 'Данных нет';
5182
- const InnerTable = JSX(({ dataUrl, pdfUrl, onClick }) => {
5183
- const { tableData } = useTariffsInnerTableData(dataUrl);
5184
- const [activeTabIndex, setActiveTabIndex] = useState(0);
5185
- const handleActiveTabIndex = useCallback((_) => setActiveTabIndex(_), []);
5186
- const items = tableData?.[activeTabIndex]?.items ?? [];
5187
- const currencies = tableData?.map((item) => item.currency ?? '');
5188
- return tableData ? (jsxs("div", { className: "bg-white z-10", children: [jsx(InnerTableHeader, { currencies: currencies, activeTabIndex: activeTabIndex, setActiveTabIndex: handleActiveTabIndex, linkToPDF: pdfUrl }), jsx(InnerTableBody, { activeTabIndex: activeTabIndex, items: items }), jsx(TableInnerButton, { className: "mt-xl", onClick: onClick, isOpen: true })] })) : (jsxs("div", { className: "my-lg space-y-m text-h6 text-center", children: [jsx("p", { children: EMPTY_DATA }), jsx(TableInnerButton, { onClick: onClick, isOpen: true })] }));
5229
+ const Sitemap = JSX(({ className, topItems }) => {
5230
+ const link = useLink({ isRemote: true });
5231
+ return (jsx("div", { className: style('flex items-start justify-between', className), children: topItems?.map(link).map(renderColumn) }));
5232
+ });
5233
+ const FOOTER_AREA_KEYS = ['all', 'footer'];
5234
+ const renderColumn = (menuItem, index) => {
5235
+ const { text, items = [], href, target, onClick } = menuItem;
5236
+ const visibleSubItems = items.filter((_) => !_.displayArea || FOOTER_AREA_KEYS.includes(_.displayArea.toLowerCase()));
5237
+ return (jsxs("div", { className: "flex flex-col gap-s w-1/4", children: [jsx("a", { className: "leading-5 text-l text-primary-text hover:text-primary-main no-underline", href: href, target: target || '_self', onClick: onClick, children: text || `Раздел ${index}` }), visibleSubItems.map((_, i) => (jsx(ColumnItem, { ..._, basePath: appendSlash(href), index: i }, String(i))))] }, String(index)));
5238
+ };
5239
+ const ColumnItem = JSX(({ text, index, basePath, ...rest }) => {
5240
+ const isAnotherPortal = projectSettings.BASE_PATH && basePath ? !projectSettings.BASE_PATH.startsWith(basePath) : false;
5241
+ const link = useLink({ isRemote: isAnotherPortal, basePath });
5242
+ const { href, target, onClick } = link(rest);
5243
+ return (jsx("a", { className: style('text-l font-light text-secondary-text hover:text-primary-main no-underline', 'overflow-x-hidden overflow-ellipsis whitespace-nowrap'), href: href, target: target || '_self', onClick: onClick, children: text || `Раздел ${index}` }));
5189
5244
  });
5190
5245
 
5191
- const TariffsTableRowContainer = JSX(({ children, tableInner, onHideContentClick }) => (jsxs("div", { className: "self-start flex flex-col", role: "row", children: [jsx("div", { className: style(dividerStyle, 'flex flex-col @4xl:flex-row gap-y-xs gap-x-5xl pb-lg @4xl:pt-lg'), children: children }), tableInner ? (jsx("div", { className: "origin-top animate-expansion", children: jsx(InnerTable, { ...tableInner, onClick: onHideContentClick }) })) : null] })));
5192
-
5193
- const TariffsTableRow = JSX(({ row: { header, data }, activeIndex, rowIdx, ...rest }) => {
5194
- const [tableInner, setTableInner] = useState(undefined);
5195
- const handleSetTableInner = useCallback((_) => setTableInner(_), []);
5196
- const [openTableInnerIdx, setOpenTableInnerIdx] = useState(undefined);
5197
- const handleOpenTableInnerIdx = useCallback((_) => setOpenTableInnerIdx(_), []);
5198
- const onHideContentClick = () => setTableInner(undefined);
5199
- return (jsxs(TariffsTableRowContainer, { onHideContentClick: onHideContentClick, tableInner: tableInner, ...rest, children: [jsx("div", { className: style('text-s', firstCellStyle), children: jsxs("div", { className: "flex gap-m items-center text-primary-text", role: "cell", children: [header?.icon ? (jsx(Img, { className: "hidden @4xl:block max-w-6 shrink-0", image: header.icon, width: "24", height: "24" })) : null, header?.title ? (jsx(Text, { size: "text-m", font: "font-light", children: header?.title })) : null] }) }), data?.length ? (jsx(TableCarouselContainer, { activeIndex: activeIndex, columnWidth: COLUMN_WIDTH$1, version: "tariff", children: data.map((cells, i) => (jsx(TariffsTableCell, { cells: cells, rowIdx: rowIdx, cellIdx: i, setTableInner: handleSetTableInner, tableInner: tableInner, openTableInnerIdx: openTableInnerIdx, setOpenTableInnerIdx: handleOpenTableInnerIdx, ...rest }, String(i)))) })) : null] }));
5246
+ const SearchDialog = JSX(({ initialQuery }) => {
5247
+ const { topItems } = useSitemap();
5248
+ const basePathList = useMemo(() => topItems?.map((_) => _.href || '/'), [topItems]);
5249
+ const [searchResult, searchInputProps] = useSearch({
5250
+ basePathList,
5251
+ initialQuery,
5252
+ });
5253
+ const searchItems = useMemo(() => combineTopItemsAndSearchResult(topItems)(searchResult), [topItems, searchResult]);
5254
+ useEffect(() => printSearchItems(searchItems), [searchItems]); // Temp
5255
+ return (jsx(Dialog, { head: jsx(SearchInput, { autoFocus: true, ...searchInputProps }), children: jsx(Sitemap, { topItems: searchItems }) }));
5200
5256
  });
5201
-
5202
- /** @deprecated */
5203
- function renderArrows({ dec, inc, canDec, canInc, btnClass, className = '', }) {
5204
- const isVisible = canDec || canInc;
5205
- if (!isVisible) {
5206
- return null;
5257
+ const combineTopItemsAndSearchResult = (topItems) => (searchResult) => topItems?.length && searchResult?.length
5258
+ ? zip(topItems, searchResult).map(([_, portalSearchResult]) => ({
5259
+ ..._,
5260
+ items: portalSearchResult?.map(({ title, uri }) => ({ text: title, href: joinPath('/', uri) })),
5261
+ }))
5262
+ : [];
5263
+ // Temp
5264
+ function printSearchItems(topItems) {
5265
+ for (const _ of topItems.filter(({ items }) => items?.length)) {
5266
+ console.group(_.text);
5267
+ console.table(_.items, ['text', 'href']);
5268
+ console.groupEnd();
5207
5269
  }
5208
- return (jsxs("div", { children: [canDec ? (jsx(ArrowButton, { className: style('absolute z-40', btnClass[0], className), onClick: dec, ariaLabel: "\u041F\u0440\u043E\u043B\u0438\u0441\u0442\u0430\u0442\u044C \u0432\u043B\u0435\u0432\u043E", "data-block-control": "scroll-left", disabled: !canDec })) : null, canInc ? (jsx(ArrowButton, { className: style('absolute z-40 rotate-180', btnClass[1], className), onClick: inc, ariaLabel: "\u041F\u0440\u043E\u043B\u0438\u0441\u0442\u0430\u0442\u044C \u0432\u043F\u0440\u0430\u0432\u043E", "data-block-control": "scroll-right", disabled: !canInc })) : null] }));
5209
5270
  }
5210
5271
 
5211
- const TariffsTableWrapper = JSX(({ children, controls }) => {
5212
- const { isScrollAvailable } = controls;
5213
- return (jsxs("div", { role: "table", children: [jsxs("div", { className: "relative space-y-xs", children: [children, renderArrows({
5214
- ...controls,
5215
- btnClass: ['top-28', 'top-11'],
5216
- className: 'right-7',
5217
- })] }), isScrollAvailable ? (jsx("div", { className: "absolute top-0 right-0 bottom-0 w-20 bg-opacity-to-white" })) : null] }));
5272
+ const useSearchDialog = () => {
5273
+ const { open, close } = useDialogManager();
5274
+ return {
5275
+ open: (props = {}, options = {}) => open(jsx(SearchDialog, { ...props }), options),
5276
+ close,
5277
+ };
5278
+ };
5279
+
5280
+ const MIN_QUERY_LEN = 3;
5281
+ const SearchBar = JSX(({ className }) => {
5282
+ const [value, setValue] = useState('');
5283
+ const resetQueryOnDialogClose = useCallback(() => setValue(''), []);
5284
+ const { open } = useSearchDialog();
5285
+ const handleInitialInputChange = useCallback((_) => {
5286
+ setValue(_);
5287
+ if (isQueryLongEnough(_)) {
5288
+ open({ initialQuery: _ }, { onClose: resetQueryOnDialogClose });
5289
+ }
5290
+ }, [resetQueryOnDialogClose]);
5291
+ return (jsxs("div", { className: style('relative', className), children: [jsx(SearchInput, { value: value, onChange: handleInitialInputChange }), jsx(CloseButton, { className: "absolute top-0 right-0 sm:hidden", onClose: resetQueryOnDialogClose })] }));
5218
5292
  });
5293
+ const isQueryLongEnough = (_) => _ && _.length >= MIN_QUERY_LEN;
5219
5294
 
5220
- const TariffsTable = JSX(({ className = '', title, description, rowHeaders, tariffsColumns: columns, hiddenRowsNum = 0, ...rest }) => {
5221
- const colData = columns?.map(({ data }) => data) || [];
5222
- const rowData = rowHeaders?.map((header, i) => ({
5223
- header,
5224
- data: colData.map((col) => col?.[i] || []),
5225
- }));
5226
- const itemCount = colData.length;
5227
- const [activeIndex, controls] = useCarouselControls({
5228
- itemCount: itemCount,
5229
- visibleItemCount: COLS_LENGTH_FOR_SCROLL,
5230
- });
5231
- const rows = (rowData || []).map((row, i) => (jsx(TariffsTableRow, { row: row, activeIndex: activeIndex, rowIdx: i, ...rest }, String(i))));
5232
- const [visibleRows, hiddenRows] = hiddenRowsNum > 0 ? [rows.slice(0, -hiddenRowsNum), rows.slice(-hiddenRowsNum)] : [rows, []];
5233
- return (jsxs(BlockWrapper, { className: style('overflow-hidden relative space-y-6xl @4xl:space-y-xl', className), defaultPadding: "p-6xl", ...rest, children: [jsx(Headline, { title: title, description: description, headlineVersion: "M", isEmbedded: true, align: "text-center" }), jsx("div", { className: "space-y-m", children: hiddenRowsNum > 0 ? (jsx(Foldable, { renderFoldableSection: ({ isUnfolded }) => (jsxs(TariffsTableWrapper, { controls: controls, children: [visibleRows, jsx(FoldableSection, { isUnfolded: isUnfolded, children: hiddenRows })] })), renderFoldButton: renderDefaultFoldButton })) : (jsx(TariffsTableWrapper, { controls: controls, children: rows })) })] }));
5295
+ const ActiveSubMenuItem = JSX(({ item, basePath }) => {
5296
+ const isAnotherPortal = projectSettings.BASE_PATH && basePath ? !projectSettings.BASE_PATH.startsWith(basePath) : false;
5297
+ const link = useLink({ isRemote: isAnotherPortal, basePath });
5298
+ const { href, target, onClick } = link(item);
5299
+ const router = useRouter();
5300
+ const isActive = isHrefActive(router)({ href });
5301
+ return (jsxs("a", { className: style(isActive ? 'text-primary-main' : 'text-primary-text', `py-3 text-h5 font-light flex justify-between cursor-pointer`), href: href, target: target, onClick: onClick, children: [item.text, jsx(Img, { image: { icon: 'ChevronLeftIcon', iconVersion: 'black' }, width: "24", height: "24", className: "text-secondary-text rotate-180 opacity-30" })] }));
5234
5302
  });
5235
5303
 
5236
- const TextBlock = JSX(({ className = '', title, description, iconVersion, __html, ...rest }) => (jsxs(BlockWrapper, { className: style('flex gap-s sm:gap-m bg-white group-data-secondary:bg-primary-main/10', className), ...rest, children: [iconVersion === 'small' ? renderIcon() : null, jsxs("div", { className: "flex flex-col w-fit gap-2xs sm:gap-xs", children: [title ? (jsx(Text, { size: "text-l", font: "font-normal", color: "text-primary-text group-data-secondary:text-white", children: title })) : null, description ? renderDescription(description) : null, __html ? jsx(RichText, { __html: __html }) : null] })] })));
5237
- const renderIcon = () => (jsx("div", { className: `rounded-full h-4 w-4 text-center text-xs font-light bg-primary-main text-white group-data-secondary:bg-white group-data-secondary:text-primary-main`, children: "i" }));
5238
- const renderDescription = (description) => (jsx(Paragraph, { size: "text-s", font: "font-light", color: "text-secondary-text group-data-secondary:text-white", children: description }));
5304
+ const ActiveSubMenu = JSX(({ activeMenuSubItems, basePath }) => activeMenuSubItems ? (jsx("div", { className: "mb-5", children: activeMenuSubItems.map((_, i) => (jsx(ActiveSubMenuItem, { item: _, basePath: basePath }, String(i)))) })) : null);
5239
5305
 
5240
- const Blocks = {
5241
- AdTile,
5242
- ApplicationForm,
5243
- BenefitsBlock,
5244
- Bonus,
5245
- BonusBenefitsBlock,
5246
- ButtonsBlock,
5247
- Calculator,
5248
- CardTransfer,
5249
- Carousel,
5250
- CarouselBankHistoryCard,
5251
- CarouselCard,
5252
- CarouselCatalogCard,
5253
- CarouselLinks,
5254
- CarouselRecommendationCard,
5255
- CarouselTariffsCard,
5256
- ComparisonTable,
5257
- DepositFiltration,
5258
- ErrorBlock,
5259
- ExchangeRateTile,
5260
- Footer,
5261
- Header,
5262
- Headline,
5263
- HorizontalLayout,
5264
- ImgBlock,
5265
- LinkDocs,
5266
- MobileAppTile,
5267
- MortgageFiltration,
5268
- OfficesAtmsMap,
5269
- Placeholder,
5270
- ProductBlock,
5271
- ProductGallery,
5272
- RepresentativeOfficeInfo,
5273
- RichTextBlock,
5274
- RollupItem,
5275
- SafeDepositRental,
5276
- StepsBlock,
5277
- StickyBottomMenu,
5278
- Tabs,
5279
- TariffsTable,
5280
- TextBlock,
5281
- VerticalLayout,
5282
- };
5306
+ const TopItemMobile = ({ item, isActive, onClick }) => (jsxs("button", { type: "button", className: "relative", onClick: onClick, children: [jsx("span", { className: style('whitespace-nowrap', isActive ? 'text-primary-main' : ''), children: item.text }), isActive ? (jsx("div", { className: "absolute left-0 right-0 -bottom-3 h-0.5 bg-primary-main group-data-transparent:bg-transparent" })) : null] }));
5283
5307
 
5284
- const COOKIE_DIALOG_ID = 'cookie';
5285
- const DIALOG_INITIAL_DELAY = 3 * 1000;
5286
- const CookiePopup = JSX(({ termLink, personalDataPolicyLink }) => {
5287
- const [opened, { setTrue: open, setFalse: close }] = useBool();
5288
- useDebouncedEffect(() => {
5289
- if (!globalThis.localStorage?.getItem(COOKIE_DIALOG_ID)) {
5290
- open();
5308
+ const BurgerMenuDialog = JSX((props) => {
5309
+ const { topItems, officesLink, defaultLocation } = useSitemap(props.options?.page?.fallback);
5310
+ const [location] = useLocation(defaultLocation);
5311
+ const locationDialog = useLocationDialog();
5312
+ const openLocationDialog = useCallback(() => locationDialog.open(), []);
5313
+ const [containerRef, scroll] = useSwipeListScroll({
5314
+ itemCount: topItems?.length ?? 0,
5315
+ });
5316
+ const [activeIndex] = useActiveRoute(topItems);
5317
+ const [activeTopItemIndex, setActiveTopItemIndex] = useState(activeIndex);
5318
+ const activeRoute = useMemo(() => topItems?.[activeTopItemIndex], [topItems, activeTopItemIndex]);
5319
+ const activeMenuSubItems = activeRoute?.items || [];
5320
+ useEffect(() => {
5321
+ setActiveTopItemIndex(activeIndex);
5322
+ }, [activeIndex]);
5323
+ useEffect(() => {
5324
+ if (activeTopItemIndex > 0) {
5325
+ scroll.scrollTo(activeTopItemIndex);
5291
5326
  }
5292
- }, [], DIALOG_INITIAL_DELAY);
5293
- const handleClose = useCallback(() => {
5294
- globalThis.localStorage?.setItem(COOKIE_DIALOG_ID, 'true');
5295
- close();
5296
- }, []);
5297
- return opened ? (jsx("div", { className: "container fixed left-0 right-0 bottom-0 z-50", children: jsxs("div", { className: "bg-white m-xl p-xl rounded-md flex sm:items-center shadow-main-black", children: [jsx("div", { className: "sm:flex-1", children: jsxs(Paragraph, { size: "text-s", font: "font-light", color: "text-primary-text", children: ["\u0410\u041E \u00AB\u0420\u043E\u0441\u0441\u0435\u043B\u044C\u0445\u043E\u0437\u0431\u0430\u043D\u043A\u00BB \u0438\u0441\u043F\u043E\u043B\u044C\u0437\u0443\u0435\u0442", jsx(LinkWrapper, { isRemote: true, className: linkWrapperStyle(termLink?.href), ...termLink, children: "cookie" }), "(\u0444\u0430\u0439\u043B\u044B \u0441 \u0434\u0430\u043D\u043D\u044B\u043C\u0438 \u043E \u043F\u0440\u043E\u0448\u043B\u044B\u0445 \u043F\u043E\u0441\u0435\u0449\u0435\u043D\u0438\u044F\u0445 \u0441\u0430\u0439\u0442\u0430) \u0434\u043B\u044F \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u043B\u0438\u0437\u0430\u0446\u0438\u0438 \u0441\u0435\u0440\u0432\u0438\u0441\u043E\u0432 \u0438 \u0443\u0434\u043E\u0431\u0441\u0442\u0432\u0430 \u043F\u043E\u043B\u044C\u0437\u043E\u0432\u0430\u0442\u0435\u043B\u0435\u0439. \u0412\u044B \u043C\u043E\u0436\u0435\u0442\u0435 \u0437\u0430\u043F\u0440\u0435\u0442\u0438\u0442\u044C \u0441\u043E\u0445\u0440\u0430\u043D\u0435\u043D\u0438\u0435 cookie \u0432 \u043D\u0430\u0441\u0442\u0440\u043E\u0439\u043A\u0430\u0445 \u0441\u0432\u043E\u0435\u0433\u043E \u0431\u0440\u0430\u0443\u0437\u0435\u0440\u0430.", jsx(LinkWrapper, { isRemote: true, className: linkWrapperStyle(personalDataPolicyLink?.href), ...personalDataPolicyLink, children: "\u041E\u0431\u0440\u0430\u0431\u043E\u0442\u043A\u0430 \u0412\u0430\u0448\u0438\u0445 \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u043B\u044C\u043D\u044B\u0445 \u0434\u0430\u043D\u043D\u044B\u0445" }), "\u043F\u0440\u043E\u0438\u0437\u0432\u043E\u0434\u0438\u0442\u0441\u044F \u0432 \u0441\u043E\u043E\u0442\u0432\u0435\u0442\u0441\u0442\u0432\u0438\u0438 \u0441 \u0442\u0440\u0435\u0431\u043E\u0432\u0430\u043D\u0438\u044F\u043C\u0438 \u0424\u0435\u0434\u0435\u0440\u0430\u043B\u044C\u043D\u043E\u0433\u043E \u0437\u0430\u043A\u043E\u043D\u0430 \u043E\u0442 27.07.2006 \u2116 152-\u04243 \u00AB\u041E \u043F\u0435\u0440\u0441\u043E\u043D\u0430\u043B\u044C\u043D\u044B\u0445 \u0434\u0430\u043D\u043D\u044B\u0445\u00BB."] }) }), jsx("div", { className: "ml-s sm:ml-0 w-24 flex justify-end", children: jsx(CloseButton, { className: "bg-main-gray rounded-md", onClose: handleClose }) })] }) })) : null;
5327
+ }, [activeTopItemIndex, scroll]);
5328
+ const handleTopItemClick = useCallback((idx) => setActiveTopItemIndex(idx), []);
5329
+ return (jsx(Dialog, { head: jsx("div", { className: "flex items-center", children: jsx(Heading, { as: "h4", title: "\u041C\u0435\u043D\u044E" }) }), children: jsxs("div", { className: "flex flex-col flex-nowrap relative w-full h-auto m-auto bg-white pb-24 box-border rounded-md", children: [jsx("div", { className: "w-full mb-3", children: jsx(SwipeListContainer, { containerRef: containerRef, visibleItemCount: 0, gap: 20, className: "pb-3", children: topItems?.map((item, i) => (jsx(TopItemMobile, { item: item, isActive: activeTopItemIndex === i, onClick: () => handleTopItemClick(i) }, String(i)))) }) }), jsxs("div", { className: "relative grow overflow-auto", children: [jsx(ActiveSubMenu, { activeMenuSubItems: activeMenuSubItems, basePath: activeRoute?.href }), jsx(SearchBar, { className: "grow mb-5" }), renderOfficeLink(officesLink), jsxs("div", { className: "flex items-center text-s cursor-pointer", onClick: openLocationDialog, children: [jsx(Img, { image: { icon: 'GeolocationIcon', iconVersion: 'black' }, width: "24", height: "24", className: "text-primary-main box-border mr-xs bg-main-divider p-xs rounded-md" }), jsxs("div", { className: "flex flex-col items-start", children: [jsx(Text, { size: "text-h5", children: location.name }), jsx(Text, { color: "text-secondary-text", size: "text-s", children: "\u0412\u0430\u0448\u0430 \u043B\u043E\u043A\u0430\u0446\u0438\u044F" })] })] })] })] }) }));
5298
5330
  });
5299
- const linkWrapperStyle = (href) => style('inline mx-2xs', href ? 'text-green-dark' : '');
5331
+ const renderOfficeLink = (officesLink) => officesLink ? (jsxs("a", { className: "flex items-center mb-3", href: officesLink, rel: "noopener noreferrer", "aria-label": "\u041E\u0444\u0438\u0441\u044B \u0438 \u0431\u0430\u043D\u043A\u043E\u043C\u0430\u0442\u044B", children: [jsx(Img, { image: { icon: 'MapOpenedIcon', iconVersion: 'black' }, width: "24", height: "24", className: "text-primary-main box-border mr-xs bg-main-divider p-xs rounded-md" }), jsx("span", { children: "\u041E\u0444\u0438\u0441\u044B \u0438 \u0431\u0430\u043D\u043A\u043E\u043C\u0430\u0442\u044B" })] })) : null;
5300
5332
 
5301
- const DialogManager = JSX(() => {
5302
- const handleCloseAll = useCallback((dialogs) => {
5303
- for (const _ of dialogs) {
5304
- _?.onClose && _.onClose();
5305
- }
5306
- }, []);
5307
- const handleClose = useCallback((_) => {
5308
- _?.onClose && _.onClose();
5309
- }, []);
5310
- const dialogs = useDialogsList({ onCloseAll: handleCloseAll, onClose: handleClose });
5311
- const { close } = useDialogManager();
5312
- const escapeHandler = useCallback(({ key }) => {
5313
- if (key === 'Escape') {
5314
- close();
5315
- }
5316
- }, []);
5317
- useEventListener(globalThis.document, 'keydown', escapeHandler);
5318
- useEffect(() => {
5319
- if (dialogs.length) {
5320
- globalThis.document?.body.classList.add('no-scrollbar');
5321
- globalThis.document?.body.classList.add('overflow-hidden');
5333
+ const BURGER_MENU_DIALOG_ID = 'burgerMenuDialog';
5334
+ const useBurgerMenuDialog = () => {
5335
+ const { open: openDialog, closeAll, close } = useDialogManager();
5336
+ const dialogs = useDialogsList();
5337
+ const isBurgerMenuOpen = isDialogOpen(BURGER_MENU_DIALOG_ID, dialogs);
5338
+ const open = useCallback(() => openDialog(jsx(BurgerMenuDialog, {}), { id: BURGER_MENU_DIALOG_ID }), []);
5339
+ const toggle = useCallback(() => {
5340
+ if (isBurgerMenuOpen) {
5341
+ closeAll();
5322
5342
  }
5323
5343
  else {
5324
- globalThis.document?.body.classList.remove('no-scrollbar');
5325
- globalThis.document?.body.classList.remove('overflow-hidden');
5344
+ open();
5326
5345
  }
5327
- }, [dialogs]);
5328
- return dialogs.length ? (jsx("div", { className: "fixed inset-0 z-50", role: "dialog", children: dialogs.map(({ dialog, id }, i) => (jsx("div", { className: style('absolute inset-0 overflow-x-hidden overflow-y-scroll no-scrollbar', i === dialogs.length - 1 ? '' : 'hidden'), children: dialog }, String(id || i)))) })) : null;
5329
- });
5346
+ }, [isBurgerMenuOpen]);
5347
+ return [Boolean(isBurgerMenuOpen), { open, close, toggle }];
5348
+ };
5330
5349
 
5331
- const PopupManager = JSX(() => {
5332
- const [popup, setPopup] = useState(null);
5333
- const close = useCallback(() => {
5334
- setPopup(null);
5335
- }, []);
5336
- useEffect(() => defaultEventBus.subscribe('popup', (action) => {
5337
- switch (action.type) {
5338
- case 'open':
5339
- case 'update':
5340
- setPopup(action);
5341
- break;
5342
- case 'close':
5343
- close();
5344
- break;
5345
- default:
5346
- assertUnreachable(action);
5347
- }
5348
- }), []);
5349
- const escapeHandler = useCallback(({ key }) => {
5350
- if (key === 'Escape') {
5351
- close();
5352
- }
5353
- }, [close]);
5354
- useEventListener(globalThis.document, 'keydown', escapeHandler);
5355
- return popup ? (jsx("div", { className: "absolute z-50", style: {
5356
- left: `${popup.left}px`,
5357
- top: `${popup.top}px`,
5358
- ...(popup.width ? { width: `${popup.width}px` } : {}),
5359
- }, role: "dialog", children: popup.popup })) : null;
5350
+ const EMPTY_MENU = [];
5351
+ const StickyBottomMenu = JSX(({ ...rest }) => {
5352
+ const [isBurgerMenuDialogOpen, { toggle, close }] = useBurgerMenuDialog();
5353
+ const dataName = projectSettings.STICKY_MOBILE_MENU || 'sticky-mobile-menu';
5354
+ const { menuItems = EMPTY_MENU } = useSWRResource(dataName, {
5355
+ fallback: rest.options?.page?.fallback,
5356
+ pathDir: joinPath(projectSettings.BASE_PATH, 'portal-resources'),
5357
+ });
5358
+ const [, activeItem] = useActiveRoute(menuItems);
5359
+ const middleIdx = Math.floor(menuItems.length / 2);
5360
+ const leftItems = menuItems.slice(0, middleIdx);
5361
+ const rightItems = menuItems.slice(middleIdx);
5362
+ /* Attribute [data-component] need for correct render in wcms editor. Do not remove. */
5363
+ return (jsx("div", { className: "w-full mb-5", "data-component": "sticky-bottom-menu-container", children: jsx("div", { className: "fixed w-full h-[74px] bottom-0 left-0 my-0 mx-auto bg-transparent z-[100]", children: jsxs("div", { className: "ml-auto container bg-white flex justify-center shadow-blue-gray", children: [leftItems.map(renderMenuItem(activeItem, close)), jsx(StickyBottomMenuBurger, { isActive: isBurgerMenuDialogOpen, onClick: toggle }), rightItems.map(renderMenuItem(activeItem, close))] }) }) }));
5360
5364
  });
5365
+ const renderMenuItem = (activeItem, close) => (_, i) => (jsx(StickyBottomMenuItem, { isActive: _ === activeItem, item: _, onClick: close }, _.href || String(i)));
5361
5366
 
5362
5367
  const api = LikeAPI();
5363
5368
  function useLikeService(pagePath) {
@@ -5406,17 +5411,17 @@
5406
5411
  blockDecorator,
5407
5412
  parent: data,
5408
5413
  };
5409
- return (jsxs("div", { "data-theme": colorPalette, children: [jsxs("section", { className: style('@container relative', pageStyle, className), children: [slots?.header ? (jsx("div", { className: "relative z-10 mb-lg shadow-[0_8px_32px_0px_#00000014]", children: renderBlocksList(slots?.header, { ...options, slotName: 'header' }) })) : null, jsxs("div", { className: "container space-y-px @5xl:space-y-0 @5xl:grid @5xl:grid-cols-12 @5xl:gap-2xs", children: [renderChildren({ block: data, options, extraProps: { className: 'scroll-mt-12' } }), renderBlocksList(slots?.footer, { ...options, slotName: 'footer' })] }), likeControl ? renderLikeControl() : null] }), jsx(StickyBottomMenu, {}), jsx(DialogManager, {}), jsx(PopupManager, {}), jsx(CookiePopup, { termLink: { href: '/pd-policy#cookie', target: '_blank' }, personalDataPolicyLink: { href: '/pd-policy', target: '_blank' } })] }));
5414
+ return (jsxs("div", { "data-theme": colorPalette, children: [jsxs("section", { className: style('@container relative', pageStyle, className), children: [slots?.header ? (jsx("div", { className: "relative z-10 mb-lg shadow-[0_8px_32px_0px_#00000014]", children: renderBlocksList(slots?.header, { ...options, slotName: 'header' }) })) : null, jsxs("div", { className: "container space-y-px @5xl:space-y-0 @5xl:grid @5xl:grid-cols-12 @5xl:gap-2xs", children: [renderChildren({ block: data, options, extraProps: { className: 'scroll-mt-12' } }), renderBlocksList(slots?.footer, { ...options, slotName: 'footer' })] }), likeControl ? renderLikeControl() : null] }), jsx(StickyBottomMenu, { options: options }), jsx(DialogManager, {}), jsx(PopupManager, {}), jsx(CookiePopup, { termLink: { href: '/pd-policy#cookie', target: '_blank' }, personalDataPolicyLink: { href: '/pd-policy', target: '_blank' } })] }));
5410
5415
  });
5411
5416
  ContentPage.childrenTypes = [];
5412
- ContentPage.slots = () => ['header', 'footer', 'StickyBottomMenu'];
5417
+ ContentPage.slots = () => ['header', 'footer'];
5413
5418
  function renderLikeControl() {
5414
5419
  return (jsx("div", { className: "flex items-end absolute bottom-0 right-0 h-full pointer-events-none", children: jsx(LikeControl, { className: "rounded-tl-3xl sticky bottom-0 pointer-events-auto" }) }));
5415
5420
  }
5416
5421
 
5417
5422
  const joinList = (sep) => (list) => list.reduce((acc, el, i) => (acc.length ? acc.concat({ ...sep, key: `sep-${i}` }, el) : [el]), []);
5418
5423
 
5419
- const packageVersion = "0.14.123";
5424
+ const packageVersion = "0.14.125";
5420
5425
 
5421
5426
  exports.Blocks = Blocks;
5422
5427
  exports.ContentPage = ContentPage;