@redneckz/wildless-cms-uni-blocks 0.8.9 → 0.8.11

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 (349) hide show
  1. package/bin/migration-scripts/0.8.10.js +31 -0
  2. package/bundle/blocks.schema.json +1 -1
  3. package/bundle/bundle.umd.js +154 -138
  4. package/bundle/bundle.umd.min.js +1 -1
  5. package/bundle/components/Calculator/rangeHelpers.d.ts +4 -0
  6. package/bundle/components/StepsBlock/StepsBlockContent.d.ts +11 -1
  7. package/bundle/components/StepsBlock/checkCanRenderIcon.d.ts +2 -0
  8. package/bundle/components/StepsBlock/{renderStepContent.d.ts → renderStep.d.ts} +5 -5
  9. package/bundle/components/Tile/TileContent.d.ts +2 -2
  10. package/bundle/services/BlockRouter/BlockRouter.d.ts +1 -3
  11. package/bundle/ui-kit/Img/ImgAsPicture.d.ts +0 -2
  12. package/bundle/utils/adjustHref.d.ts +3 -0
  13. package/bundle/utils/dirname.d.ts +1 -0
  14. package/bundle/utils/url.d.ts +2 -2
  15. package/dist/ProjectSettings.js +3 -4
  16. package/dist/ProjectSettings.js.map +1 -1
  17. package/dist/components/Calculator/Rate.js +1 -1
  18. package/dist/components/Calculator/Rate.js.map +1 -1
  19. package/dist/components/Calculator/constants.js +2 -2
  20. package/dist/components/Calculator/constants.js.map +1 -1
  21. package/dist/components/Calculator/rangeHelpers.d.ts +4 -0
  22. package/dist/components/Calculator/rangeHelpers.js +12 -0
  23. package/dist/components/Calculator/rangeHelpers.js.map +1 -0
  24. package/dist/components/Calculator/useBusinessDepositCalculatorParams.js +10 -3
  25. package/dist/components/Calculator/useBusinessDepositCalculatorParams.js.map +1 -1
  26. package/dist/components/Calculator/useCreditCalculatorParams.js +8 -2
  27. package/dist/components/Calculator/useCreditCalculatorParams.js.map +1 -1
  28. package/dist/components/Calculator/useDepositCalculatorParams.js +14 -4
  29. package/dist/components/Calculator/useDepositCalculatorParams.js.map +1 -1
  30. package/dist/components/Carousel/Carousel.js +6 -4
  31. package/dist/components/Carousel/Carousel.js.map +1 -1
  32. package/dist/components/PictureText/renderBenefit.js +1 -0
  33. package/dist/components/PictureText/renderBenefit.js.map +1 -1
  34. package/dist/components/ProductTile/renderBenefit.js +1 -0
  35. package/dist/components/ProductTile/renderBenefit.js.map +1 -1
  36. package/dist/components/StepsBlock/StepsBlock.js +7 -13
  37. package/dist/components/StepsBlock/StepsBlock.js.map +1 -1
  38. package/dist/components/StepsBlock/StepsBlock.mobile.js +24 -4
  39. package/dist/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
  40. package/dist/components/StepsBlock/StepsBlockContent.d.ts +11 -1
  41. package/dist/components/StepsBlock/checkCanRenderIcon.d.ts +2 -0
  42. package/dist/components/StepsBlock/checkCanRenderIcon.js +5 -0
  43. package/dist/components/StepsBlock/checkCanRenderIcon.js.map +1 -0
  44. package/{lib/components/StepsBlock/renderStepContent.d.ts → dist/components/StepsBlock/renderStep.d.ts} +5 -5
  45. package/dist/components/StepsBlock/renderStep.js +34 -0
  46. package/dist/components/StepsBlock/renderStep.js.map +1 -0
  47. package/dist/components/Tile/Tile.js +3 -3
  48. package/dist/components/Tile/Tile.js.map +1 -1
  49. package/dist/components/Tile/TileContent.d.ts +2 -2
  50. package/dist/hooks/useLink.js +4 -16
  51. package/dist/hooks/useLink.js.map +1 -1
  52. package/dist/services/BlockRouter/BlockRouter.d.ts +1 -3
  53. package/dist/services/BlockRouter/BlockRouter.js +3 -9
  54. package/dist/services/BlockRouter/BlockRouter.js.map +1 -1
  55. package/dist/services/BlockRouter/useBlockRouterProvider.js +2 -10
  56. package/dist/services/BlockRouter/useBlockRouterProvider.js.map +1 -1
  57. package/dist/setup-fixture.js +3 -4
  58. package/dist/setup-fixture.js.map +1 -1
  59. package/dist/ui-kit/Icon/Icon.js +5 -1
  60. package/dist/ui-kit/Icon/Icon.js.map +1 -1
  61. package/dist/ui-kit/Img/ImgAsPicture.d.ts +0 -2
  62. package/dist/ui-kit/Img/ImgAsPicture.js +18 -21
  63. package/dist/ui-kit/Img/ImgAsPicture.js.map +1 -1
  64. package/dist/utils/adjustHref.d.ts +3 -0
  65. package/dist/utils/adjustHref.js +14 -0
  66. package/dist/utils/adjustHref.js.map +1 -0
  67. package/dist/utils/dirname.d.ts +1 -0
  68. package/dist/utils/dirname.js +5 -0
  69. package/dist/utils/dirname.js.map +1 -0
  70. package/dist/utils/url.d.ts +2 -2
  71. package/dist/utils/url.js +1 -1
  72. package/dist/utils/url.js.map +1 -1
  73. package/dist/wlc.json +0 -1
  74. package/lib/ProjectSettings.js +3 -4
  75. package/lib/ProjectSettings.js.map +1 -1
  76. package/lib/components/Calculator/Rate.js +1 -1
  77. package/lib/components/Calculator/Rate.js.map +1 -1
  78. package/lib/components/Calculator/constants.js +2 -2
  79. package/lib/components/Calculator/constants.js.map +1 -1
  80. package/lib/components/Calculator/rangeHelpers.d.ts +4 -0
  81. package/lib/components/Calculator/rangeHelpers.js +8 -0
  82. package/lib/components/Calculator/rangeHelpers.js.map +1 -0
  83. package/lib/components/Calculator/useBusinessDepositCalculatorParams.js +10 -3
  84. package/lib/components/Calculator/useBusinessDepositCalculatorParams.js.map +1 -1
  85. package/lib/components/Calculator/useCreditCalculatorParams.js +8 -2
  86. package/lib/components/Calculator/useCreditCalculatorParams.js.map +1 -1
  87. package/lib/components/Calculator/useDepositCalculatorParams.js +14 -4
  88. package/lib/components/Calculator/useDepositCalculatorParams.js.map +1 -1
  89. package/lib/components/Carousel/Carousel.js +6 -4
  90. package/lib/components/Carousel/Carousel.js.map +1 -1
  91. package/lib/components/PictureText/renderBenefit.js +1 -0
  92. package/lib/components/PictureText/renderBenefit.js.map +1 -1
  93. package/lib/components/ProductTile/renderBenefit.js +1 -0
  94. package/lib/components/ProductTile/renderBenefit.js.map +1 -1
  95. package/lib/components/StepsBlock/StepsBlock.js +7 -13
  96. package/lib/components/StepsBlock/StepsBlock.js.map +1 -1
  97. package/lib/components/StepsBlock/StepsBlock.mobile.js +24 -4
  98. package/lib/components/StepsBlock/StepsBlock.mobile.js.map +1 -1
  99. package/lib/components/StepsBlock/StepsBlockContent.d.ts +11 -1
  100. package/lib/components/StepsBlock/checkCanRenderIcon.d.ts +2 -0
  101. package/lib/components/StepsBlock/checkCanRenderIcon.js +2 -0
  102. package/lib/components/StepsBlock/checkCanRenderIcon.js.map +1 -0
  103. package/{dist/components/StepsBlock/renderStepContent.d.ts → lib/components/StepsBlock/renderStep.d.ts} +5 -5
  104. package/lib/components/StepsBlock/renderStep.js +31 -0
  105. package/lib/components/StepsBlock/renderStep.js.map +1 -0
  106. package/lib/components/Tile/Tile.js +3 -3
  107. package/lib/components/Tile/Tile.js.map +1 -1
  108. package/lib/components/Tile/TileContent.d.ts +2 -2
  109. package/lib/hooks/useLink.js +5 -17
  110. package/lib/hooks/useLink.js.map +1 -1
  111. package/lib/services/BlockRouter/BlockRouter.d.ts +1 -3
  112. package/lib/services/BlockRouter/BlockRouter.js +2 -7
  113. package/lib/services/BlockRouter/BlockRouter.js.map +1 -1
  114. package/lib/services/BlockRouter/useBlockRouterProvider.js +2 -10
  115. package/lib/services/BlockRouter/useBlockRouterProvider.js.map +1 -1
  116. package/lib/setup-fixture.js +3 -4
  117. package/lib/setup-fixture.js.map +1 -1
  118. package/lib/ui-kit/Icon/Icon.js +5 -1
  119. package/lib/ui-kit/Icon/Icon.js.map +1 -1
  120. package/lib/ui-kit/Img/ImgAsPicture.d.ts +0 -2
  121. package/lib/ui-kit/Img/ImgAsPicture.js +17 -19
  122. package/lib/ui-kit/Img/ImgAsPicture.js.map +1 -1
  123. package/lib/utils/adjustHref.d.ts +3 -0
  124. package/lib/utils/adjustHref.js +11 -0
  125. package/lib/utils/adjustHref.js.map +1 -0
  126. package/lib/utils/dirname.d.ts +1 -0
  127. package/lib/utils/dirname.js +2 -0
  128. package/lib/utils/dirname.js.map +1 -0
  129. package/lib/utils/url.d.ts +2 -2
  130. package/lib/utils/url.js +1 -1
  131. package/lib/utils/url.js.map +1 -1
  132. package/lib/wlc.json +0 -1
  133. package/mobile/bundle/bundle.umd.js +104 -95
  134. package/mobile/bundle/bundle.umd.min.js +1 -1
  135. package/mobile/bundle/components/Calculator/rangeHelpers.d.ts +4 -0
  136. package/mobile/bundle/components/StepsBlock/StepsBlockContent.d.ts +11 -1
  137. package/mobile/bundle/components/StepsBlock/checkCanRenderIcon.d.ts +2 -0
  138. package/mobile/bundle/components/StepsBlock/{renderStepContent.d.ts → renderStep.d.ts} +5 -5
  139. package/mobile/bundle/components/Tile/TileContent.d.ts +2 -2
  140. package/mobile/bundle/services/BlockRouter/BlockRouter.d.ts +1 -3
  141. package/mobile/bundle/ui-kit/Img/ImgAsPicture.d.ts +0 -2
  142. package/mobile/bundle/utils/adjustHref.d.ts +3 -0
  143. package/mobile/bundle/utils/dirname.d.ts +1 -0
  144. package/mobile/bundle/utils/url.d.ts +2 -2
  145. package/mobile/dist/ProjectSettings.js +3 -4
  146. package/mobile/dist/ProjectSettings.js.map +1 -1
  147. package/mobile/dist/components/Calculator/Rate.js +1 -1
  148. package/mobile/dist/components/Calculator/Rate.js.map +1 -1
  149. package/mobile/dist/components/Calculator/constants.js +2 -2
  150. package/mobile/dist/components/Calculator/constants.js.map +1 -1
  151. package/mobile/dist/components/Calculator/rangeHelpers.d.ts +4 -0
  152. package/mobile/dist/components/Calculator/rangeHelpers.js +12 -0
  153. package/mobile/dist/components/Calculator/rangeHelpers.js.map +1 -0
  154. package/mobile/dist/components/Calculator/useBusinessDepositCalculatorParams.js +10 -3
  155. package/mobile/dist/components/Calculator/useBusinessDepositCalculatorParams.js.map +1 -1
  156. package/mobile/dist/components/Calculator/useCreditCalculatorParams.js +8 -2
  157. package/mobile/dist/components/Calculator/useCreditCalculatorParams.js.map +1 -1
  158. package/mobile/dist/components/Calculator/useDepositCalculatorParams.js +14 -4
  159. package/mobile/dist/components/Calculator/useDepositCalculatorParams.js.map +1 -1
  160. package/mobile/dist/components/Carousel/Carousel.js +6 -4
  161. package/mobile/dist/components/Carousel/Carousel.js.map +1 -1
  162. package/mobile/dist/components/PictureText/renderBenefit.js +1 -0
  163. package/mobile/dist/components/PictureText/renderBenefit.js.map +1 -1
  164. package/mobile/dist/components/ProductTile/renderBenefit.js +1 -0
  165. package/mobile/dist/components/ProductTile/renderBenefit.js.map +1 -1
  166. package/mobile/dist/components/StepsBlock/StepsBlock.js +24 -4
  167. package/mobile/dist/components/StepsBlock/StepsBlock.js.map +1 -1
  168. package/mobile/dist/components/StepsBlock/StepsBlockContent.d.ts +11 -1
  169. package/mobile/dist/components/StepsBlock/checkCanRenderIcon.d.ts +2 -0
  170. package/mobile/dist/components/StepsBlock/checkCanRenderIcon.js +5 -0
  171. package/mobile/dist/components/StepsBlock/checkCanRenderIcon.js.map +1 -0
  172. package/mobile/dist/components/StepsBlock/renderStep.d.ts +11 -0
  173. package/mobile/dist/components/StepsBlock/renderStep.js +34 -0
  174. package/mobile/dist/components/StepsBlock/renderStep.js.map +1 -0
  175. package/mobile/dist/components/Tile/Tile.js +3 -3
  176. package/mobile/dist/components/Tile/Tile.js.map +1 -1
  177. package/mobile/dist/components/Tile/TileContent.d.ts +2 -2
  178. package/mobile/dist/hooks/useLink.js +4 -16
  179. package/mobile/dist/hooks/useLink.js.map +1 -1
  180. package/mobile/dist/services/BlockRouter/BlockRouter.d.ts +1 -3
  181. package/mobile/dist/services/BlockRouter/BlockRouter.js +3 -9
  182. package/mobile/dist/services/BlockRouter/BlockRouter.js.map +1 -1
  183. package/mobile/dist/services/BlockRouter/useBlockRouterProvider.js +2 -10
  184. package/mobile/dist/services/BlockRouter/useBlockRouterProvider.js.map +1 -1
  185. package/mobile/dist/setup-fixture.js +3 -4
  186. package/mobile/dist/setup-fixture.js.map +1 -1
  187. package/mobile/dist/ui-kit/Icon/Icon.js +5 -1
  188. package/mobile/dist/ui-kit/Icon/Icon.js.map +1 -1
  189. package/mobile/dist/ui-kit/Img/ImgAsPicture.d.ts +0 -2
  190. package/mobile/dist/ui-kit/Img/ImgAsPicture.js +18 -21
  191. package/mobile/dist/ui-kit/Img/ImgAsPicture.js.map +1 -1
  192. package/mobile/dist/utils/adjustHref.d.ts +3 -0
  193. package/mobile/dist/utils/adjustHref.js +14 -0
  194. package/mobile/dist/utils/adjustHref.js.map +1 -0
  195. package/mobile/dist/utils/dirname.d.ts +1 -0
  196. package/mobile/dist/utils/dirname.js +5 -0
  197. package/mobile/dist/utils/dirname.js.map +1 -0
  198. package/mobile/dist/utils/url.d.ts +2 -2
  199. package/mobile/dist/utils/url.js +1 -1
  200. package/mobile/dist/utils/url.js.map +1 -1
  201. package/mobile/dist/wlc.json +0 -1
  202. package/mobile/lib/ProjectSettings.js +3 -4
  203. package/mobile/lib/ProjectSettings.js.map +1 -1
  204. package/mobile/lib/components/Calculator/Rate.js +1 -1
  205. package/mobile/lib/components/Calculator/Rate.js.map +1 -1
  206. package/mobile/lib/components/Calculator/constants.js +2 -2
  207. package/mobile/lib/components/Calculator/constants.js.map +1 -1
  208. package/mobile/lib/components/Calculator/rangeHelpers.d.ts +4 -0
  209. package/mobile/lib/components/Calculator/rangeHelpers.js +8 -0
  210. package/mobile/lib/components/Calculator/rangeHelpers.js.map +1 -0
  211. package/mobile/lib/components/Calculator/useBusinessDepositCalculatorParams.js +10 -3
  212. package/mobile/lib/components/Calculator/useBusinessDepositCalculatorParams.js.map +1 -1
  213. package/mobile/lib/components/Calculator/useCreditCalculatorParams.js +8 -2
  214. package/mobile/lib/components/Calculator/useCreditCalculatorParams.js.map +1 -1
  215. package/mobile/lib/components/Calculator/useDepositCalculatorParams.js +14 -4
  216. package/mobile/lib/components/Calculator/useDepositCalculatorParams.js.map +1 -1
  217. package/mobile/lib/components/Carousel/Carousel.js +6 -4
  218. package/mobile/lib/components/Carousel/Carousel.js.map +1 -1
  219. package/mobile/lib/components/PictureText/renderBenefit.js +1 -0
  220. package/mobile/lib/components/PictureText/renderBenefit.js.map +1 -1
  221. package/mobile/lib/components/ProductTile/renderBenefit.js +1 -0
  222. package/mobile/lib/components/ProductTile/renderBenefit.js.map +1 -1
  223. package/mobile/lib/components/StepsBlock/StepsBlock.js +24 -4
  224. package/mobile/lib/components/StepsBlock/StepsBlock.js.map +1 -1
  225. package/mobile/lib/components/StepsBlock/StepsBlockContent.d.ts +11 -1
  226. package/mobile/lib/components/StepsBlock/checkCanRenderIcon.d.ts +2 -0
  227. package/mobile/lib/components/StepsBlock/checkCanRenderIcon.js +2 -0
  228. package/mobile/lib/components/StepsBlock/checkCanRenderIcon.js.map +1 -0
  229. package/mobile/lib/components/StepsBlock/renderStep.d.ts +11 -0
  230. package/mobile/lib/components/StepsBlock/renderStep.js +31 -0
  231. package/mobile/lib/components/StepsBlock/renderStep.js.map +1 -0
  232. package/mobile/lib/components/Tile/Tile.js +3 -3
  233. package/mobile/lib/components/Tile/Tile.js.map +1 -1
  234. package/mobile/lib/components/Tile/TileContent.d.ts +2 -2
  235. package/mobile/lib/hooks/useLink.js +5 -17
  236. package/mobile/lib/hooks/useLink.js.map +1 -1
  237. package/mobile/lib/services/BlockRouter/BlockRouter.d.ts +1 -3
  238. package/mobile/lib/services/BlockRouter/BlockRouter.js +2 -7
  239. package/mobile/lib/services/BlockRouter/BlockRouter.js.map +1 -1
  240. package/mobile/lib/services/BlockRouter/useBlockRouterProvider.js +2 -10
  241. package/mobile/lib/services/BlockRouter/useBlockRouterProvider.js.map +1 -1
  242. package/mobile/lib/setup-fixture.js +3 -4
  243. package/mobile/lib/setup-fixture.js.map +1 -1
  244. package/mobile/lib/ui-kit/Icon/Icon.js +5 -1
  245. package/mobile/lib/ui-kit/Icon/Icon.js.map +1 -1
  246. package/mobile/lib/ui-kit/Img/ImgAsPicture.d.ts +0 -2
  247. package/mobile/lib/ui-kit/Img/ImgAsPicture.js +17 -19
  248. package/mobile/lib/ui-kit/Img/ImgAsPicture.js.map +1 -1
  249. package/mobile/lib/utils/adjustHref.d.ts +3 -0
  250. package/mobile/lib/utils/adjustHref.js +11 -0
  251. package/mobile/lib/utils/adjustHref.js.map +1 -0
  252. package/mobile/lib/utils/dirname.d.ts +1 -0
  253. package/mobile/lib/utils/dirname.js +2 -0
  254. package/mobile/lib/utils/dirname.js.map +1 -0
  255. package/mobile/lib/utils/url.d.ts +2 -2
  256. package/mobile/lib/utils/url.js +1 -1
  257. package/mobile/lib/utils/url.js.map +1 -1
  258. package/mobile/lib/wlc.json +0 -1
  259. package/mobile/src/ProjectSettings.ts +4 -4
  260. package/mobile/src/components/Calculator/Rate.tsx +1 -1
  261. package/mobile/src/components/Calculator/constants.ts +2 -2
  262. package/mobile/src/components/Calculator/rangeHelpers.ts +24 -0
  263. package/mobile/src/components/Calculator/useBusinessDepositCalculatorParams.ts +15 -3
  264. package/mobile/src/components/Calculator/useCreditCalculatorParams.ts +8 -2
  265. package/mobile/src/components/Calculator/useDepositCalculatorParams.ts +18 -4
  266. package/mobile/src/components/Carousel/Carousel.tsx +6 -4
  267. package/mobile/src/components/PictureText/renderBenefit.tsx +1 -0
  268. package/mobile/src/components/ProductTile/renderBenefit.tsx +1 -0
  269. package/mobile/src/components/StepsBlock/StepsBlock.tsx +29 -5
  270. package/mobile/src/components/StepsBlock/StepsBlock.ui.json +6 -0
  271. package/mobile/src/components/StepsBlock/StepsBlockContent.ts +13 -1
  272. package/mobile/src/components/StepsBlock/checkCanRenderIcon.ts +3 -0
  273. package/mobile/src/components/StepsBlock/renderStep.tsx +83 -0
  274. package/mobile/src/components/Tile/Tile.example.json +1 -1
  275. package/mobile/src/components/Tile/Tile.tsx +4 -4
  276. package/mobile/src/components/Tile/Tile.ui.json +7 -1
  277. package/mobile/src/components/Tile/TileContent.ts +2 -2
  278. package/mobile/src/hooks/useLink.ts +5 -18
  279. package/mobile/src/services/BlockRouter/BlockRouter.ts +6 -9
  280. package/mobile/src/services/BlockRouter/useBlockRouterProvider.ts +4 -10
  281. package/mobile/src/setup-fixture.ts +5 -4
  282. package/mobile/src/ui-kit/Icon/Icon.tsx +5 -1
  283. package/mobile/src/ui-kit/Img/ImgAsPicture.tsx +23 -28
  284. package/mobile/src/utils/adjustHref.ts +17 -0
  285. package/mobile/src/utils/dirname.ts +1 -0
  286. package/mobile/src/utils/url.ts +2 -3
  287. package/mobile/src/wlc.json +0 -1
  288. package/package.json +1 -1
  289. package/src/ProjectSettings.ts +4 -4
  290. package/src/components/Calculator/Rate.tsx +1 -1
  291. package/src/components/Calculator/constants.ts +2 -2
  292. package/src/components/Calculator/rangeHelpers.ts +24 -0
  293. package/src/components/Calculator/useBusinessDepositCalculatorParams.ts +15 -3
  294. package/src/components/Calculator/useCreditCalculatorParams.ts +8 -2
  295. package/src/components/Calculator/useDepositCalculatorParams.ts +18 -4
  296. package/src/components/Carousel/Carousel.tsx +6 -4
  297. package/src/components/PictureText/renderBenefit.tsx +1 -0
  298. package/src/components/ProductTile/renderBenefit.tsx +1 -0
  299. package/src/components/StepsBlock/StepsBlock.fixture.mobile.tsx +19 -1
  300. package/src/components/StepsBlock/StepsBlock.fixture.tsx +10 -3
  301. package/src/components/StepsBlock/StepsBlock.mobile.tsx +29 -5
  302. package/src/components/StepsBlock/StepsBlock.tsx +28 -16
  303. package/src/components/StepsBlock/StepsBlock.ui.json +6 -0
  304. package/src/components/StepsBlock/StepsBlockContent.ts +13 -1
  305. package/src/components/StepsBlock/checkCanRenderIcon.ts +3 -0
  306. package/src/components/StepsBlock/renderStep.tsx +83 -0
  307. package/src/components/Tile/Tile.example.json +1 -1
  308. package/src/components/Tile/Tile.fixture.tsx +2 -2
  309. package/src/components/Tile/Tile.tsx +4 -4
  310. package/src/components/Tile/Tile.ui.json +7 -1
  311. package/src/components/Tile/TileContent.ts +2 -2
  312. package/src/hooks/useLink.ts +5 -18
  313. package/src/services/BlockRouter/BlockRouter.ts +6 -9
  314. package/src/services/BlockRouter/useBlockRouterProvider.ts +4 -10
  315. package/src/setup-fixture.ts +5 -4
  316. package/src/ui-kit/Icon/Icon.tsx +5 -1
  317. package/src/ui-kit/Img/ImgAsPicture.tsx +23 -28
  318. package/src/utils/adjustHref.ts +17 -0
  319. package/src/utils/dirname.ts +1 -0
  320. package/src/utils/url.ts +2 -3
  321. package/src/wlc.json +0 -1
  322. package/bundle/utils/checkIsIconRenderable.d.ts +0 -2
  323. package/dist/components/StepsBlock/renderStepContent.js +0 -19
  324. package/dist/components/StepsBlock/renderStepContent.js.map +0 -1
  325. package/dist/utils/checkIsIconRenderable.d.ts +0 -2
  326. package/dist/utils/checkIsIconRenderable.js +0 -5
  327. package/dist/utils/checkIsIconRenderable.js.map +0 -1
  328. package/lib/components/StepsBlock/renderStepContent.js +0 -16
  329. package/lib/components/StepsBlock/renderStepContent.js.map +0 -1
  330. package/lib/utils/checkIsIconRenderable.d.ts +0 -2
  331. package/lib/utils/checkIsIconRenderable.js +0 -2
  332. package/lib/utils/checkIsIconRenderable.js.map +0 -1
  333. package/mobile/bundle/utils/checkIsIconRenderable.d.ts +0 -2
  334. package/mobile/dist/components/StepsBlock/renderStepContent.d.ts +0 -11
  335. package/mobile/dist/components/StepsBlock/renderStepContent.js +0 -19
  336. package/mobile/dist/components/StepsBlock/renderStepContent.js.map +0 -1
  337. package/mobile/dist/utils/checkIsIconRenderable.d.ts +0 -2
  338. package/mobile/dist/utils/checkIsIconRenderable.js +0 -5
  339. package/mobile/dist/utils/checkIsIconRenderable.js.map +0 -1
  340. package/mobile/lib/components/StepsBlock/renderStepContent.d.ts +0 -11
  341. package/mobile/lib/components/StepsBlock/renderStepContent.js +0 -16
  342. package/mobile/lib/components/StepsBlock/renderStepContent.js.map +0 -1
  343. package/mobile/lib/utils/checkIsIconRenderable.d.ts +0 -2
  344. package/mobile/lib/utils/checkIsIconRenderable.js +0 -2
  345. package/mobile/lib/utils/checkIsIconRenderable.js.map +0 -1
  346. package/mobile/src/components/StepsBlock/renderStepContent.tsx +0 -83
  347. package/mobile/src/utils/checkIsIconRenderable.tsx +0 -3
  348. package/src/components/StepsBlock/renderStepContent.tsx +0 -83
  349. package/src/utils/checkIsIconRenderable.tsx +0 -3
@@ -1,12 +1,10 @@
1
1
  import { useEffect, useRef } from '@redneckz/uni-jsx/lib/hooks';
2
- import { useRouter } from '../../hooks/useRouter.js';
3
2
  import { debounce } from '../../utils/debounce.js';
4
3
  import { trackBlock } from './BlockRouter.js';
5
4
  import { blockRouterEventBus } from './blockRouterEventBus.js';
6
5
  import { findActiveBlock } from './findActiveBlock.js';
7
6
  const isScrolledEnough = () => globalThis.scrollY > (globalThis.innerHeight * 3) / 4;
8
7
  export function useBlockRouterProvider(scrollTarget = globalThis) {
9
- const router = useRouter();
10
8
  const intersectionsMapRef = useRef(new Map());
11
9
  useEffect(() => blockRouterEventBus.subscribe('intersection', ({ block, intersection }) => {
12
10
  if (intersectionsMapRef.current) {
@@ -15,19 +13,13 @@ export function useBlockRouterProvider(scrollTarget = globalThis) {
15
13
  }), []);
16
14
  useEffect(() => {
17
15
  const handleScroll = debounce(() => {
18
- if (isScrolledEnough()) {
19
- const activeBlock = findActiveBlock([...(intersectionsMapRef.current || [])]);
20
- trackBlock(router, activeBlock);
21
- }
22
- else {
23
- trackBlock(router);
24
- }
16
+ trackBlock(isScrolledEnough() ? findActiveBlock([...(intersectionsMapRef.current || [])]) : undefined);
25
17
  }, 100);
26
18
  scrollTarget.addEventListener('scroll', handleScroll);
27
19
  return () => {
28
20
  handleScroll.dispose();
29
21
  scrollTarget.removeEventListener('scroll', handleScroll);
30
22
  };
31
- }, [router, scrollTarget]);
23
+ }, [scrollTarget]);
32
24
  }
33
25
  //# sourceMappingURL=useBlockRouterProvider.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"useBlockRouterProvider.js","sourceRoot":"","sources":["../../../src/services/BlockRouter/useBlockRouterProvider.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,6BAA6B,CAAC;AAChE,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAElD,OAAO,EAAE,QAAQ,EAAE,MAAM,sBAAsB,CAAC;AAChD,OAAO,EAAE,UAAU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,SAAS,CAC3F,CAAC;QACJ,CAAC,EAAE,GAAG,CAAC,CAAC;QAER,YAAY,CAAC,gBAAgB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAEtD,OAAO,GAAG,EAAE;YACV,YAAY,CAAC,OAAO,EAAE,CAAC;YACvB,YAAY,CAAC,mBAAmB,CAAC,QAAQ,EAAE,YAAY,CAAC,CAAC;QAC3D,CAAC,CAAC;IACJ,CAAC,EAAE,CAAC,YAAY,CAAC,CAAC,CAAC;AACrB,CAAC"}
@@ -3,10 +3,11 @@ import { useEffect, useState } from 'react';
3
3
  import { handlerDecorator } from './hooks/handlerDecorator.js';
4
4
  import { useRouter } from './hooks/useRouter.js';
5
5
  import { projectSettings } from './ProjectSettings.js';
6
+ import { joinPath } from './utils/url.js';
6
7
  import wlc from './wlc.json.js';
7
8
  projectSettings.setup(wlc);
8
9
  useRouter.setup(() => {
9
- const [href, setHref] = useState(`${globalThis.location.origin}${projectSettings.BASE_PATH}cards-credit`);
10
+ const [href, setHref] = useState(joinPath(globalThis.location.origin, projectSettings.BASE_PATH, 'cards-credit'));
10
11
  useEffect(() => {
11
12
  const handleHistoryChange = () => {
12
13
  setHref(globalThis.location.href);
@@ -18,9 +19,7 @@ useRouter.setup(() => {
18
19
  }, []);
19
20
  return {
20
21
  href,
21
- pathname: projectSettings.BASE_PATH
22
- ? new URL(href).pathname.substring(projectSettings.BASE_PATH.length - 1)
23
- : '',
22
+ pathname: new URL(href).pathname.substring(projectSettings.BASE_PATH ? projectSettings.BASE_PATH.length - 1 : 0),
24
23
  query: {},
25
24
  push: (url) => {
26
25
  globalThis.history.pushState(null, '', url);
@@ -1 +1 @@
1
- {"version":3,"file":"setup-fixture.js","sourceRoot":"","sources":["../src/setup-fixture.ts"],"names":[],"mappings":"AAAA,OAAO,mCAAmC,CAAC;AAC3C,OAAO,EAAE,SAAS,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAC5C,OAAO,EAAE,gBAAgB,EAAE,MAAM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AC,EAAE,EAAE,CAAC,CAAC;IAEP,OAAO;QACL,IAAI;QACJ,QAAQ,EAAE,IAAI,GAAG,CAAC,IAAI,CAAC,CAAC,QAAQ,CAAC,SAAS,CACxC,eAAe,CAAC,SAAS,CAAC,CAAC,CAAC,eAAe,CAAC,SAAS,CAAC,MAAM,GAAG,CAAC,CAAC,CAAC,CAAC,CAAC,CACrE;QACD,KAAK,EAAE,EAAE;QACT,IAAI,EAAE,CAAC,GAAW,EAAE,EAAE;YACpB,UAAU,CAAC,OAAO,CAAC,SAAS,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;QAC9C,CAAC;QACD,OAAO,EAAE,CAAC,GAAW,EAAE,EAAE;YACvB,UAAU,CAAC,OAAO,CAAC,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,GAAG,CAAC,CAAC;QACjD,CAAC;KACF,CAAC;AACJ,CAAC,CAAC,CAAC;AAEH,gBAAgB,CAAC,KAAK,CAAC,CAAC,OAAO,EAAO,EAAE,CAAC,CAAC,EAAE,EAAE,EAAE;IAC9C,EAAE,CAAC,cAAc,EAAE,CAAC;IACpB,OAAO,CAAC,EAAE,CAAC,CAAC;AACd,CAAC,CAAC,CAAC"}
@@ -1,7 +1,10 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
2
2
  import { JSX } from '@redneckz/uni-jsx';
3
+ import { useRouter } from '../../hooks/useRouter.js';
3
4
  import { projectSettings } from '../../ProjectSettings.js';
5
+ import { adjustHref } from '../../utils/adjustHref.js';
4
6
  import { style } from '../../utils/style.js';
7
+ import { joinPath } from '../../utils/url.js';
5
8
  const svgUseStyleMap = {
6
9
  normal: '',
7
10
  color: 'text-primary-main',
@@ -9,7 +12,8 @@ const svgUseStyleMap = {
9
12
  white: 'text-black',
10
13
  };
11
14
  export const Icon = JSX(({ className = '', imageClassName = '', name = '', alt = `Иконка ${name}`, title = alt, iconVersion = 'color', asSVG, ...imgProps }) => {
12
- const href = `${projectSettings.CDN || ''}icons/${name}.svg`;
15
+ const router = useRouter();
16
+ const href = adjustHref(router)(joinPath(projectSettings.CDN, '/icons', `${name}.svg`));
13
17
  if (asSVG && iconVersion !== 'normal') {
14
18
  return (_jsx(Background, { className: className, children: _jsxs("svg", { className: style(getSvgSize(imgProps.width), svgUseStyleMap[iconVersion], iconVersion === 'white' ? 'invert' : '', imageClassName), ...imgProps, "aria-hidden": "true", children: [title ? _jsx("title", { children: title }) : null, alt ? _jsx("desc", { children: alt }) : null, _jsx("use", { href: `${href}#icon`, xlinkHref: `${href}#icon` })] }) }));
15
19
  }
@@ -1 +1 @@
1
- {"version":3,"file":"Icon.js","sourceRoot":"","sources":["../../../src/ui-kit/Icon/Icon.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAExC,OAAO,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AACxD,OAAO,EAAE,KAAK,EAAE,MAAM,mBAAmB,CAAC;AAG1C,MAAM,cAAc,GAAgC;IAClD,MAAM,EAAE,EAAE;IACV,KAAK,EAAE,mBAAmB;IAC1B,KAAK,EAAE,YAAY;IACnB,KAAK,EAAE,YAAY;CACpB,CAAC;AAEF,MAAM,CAAC,MAAM,IAAI,GAAG,GAAG,CACrB,CAAC,EACC,SAAS,GAAG,EAAE,EACd,cAAc,GAAG,EAAE,EACnB,IAAI,GAAG,EAAE,EACT,GAAG,GAAG,UAAU,IAAI,EAAE,EACtB,KAAK,GAAG,GAAG,EACX,WAAW,GAAG,OAAO,EACrB,KAAK,EACL,GAAG,QAAQ,EACZ,EAAE,EAAE;IACH,MAAM,IAAI,GAAG,GAAG,eAAe,CAAC,GAAG,IAAI,EAAE,SAAS,IAAI,MAAM,CAAC;IAE7D,IAAI,KAAK,IAAI,WAAW,KAAK,QAAQ,EAAE;QACrC,OAAO,CACL,KAAC,UAAU,IAAC,SAAS,EAAE,SAAS,YAC9B,eACE,SAAS,EAA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AAO,GAAI,IACpD,GACK,CACd,CAAC;KACH;IAED,OAAO,CACL,cACE,SAAS,EAAE,SAAS,EACpB,GAAG,EAAE,IAAI,EACT,GAAG,EAAE,GAAG,EACR,KAAK,EAAE,KAAK,KACR,QAAQ,iBACA,MAAM,GAClB,CACH,CAAC;AACJ,CAAC,CACF,CAAC;AAEF,MAAM,UAAU,GAAG,CAAC,KAAc,EAAE,EAAE,CAAC,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,eAAe,CAAC,CAAC;AAEtE,MAAM,UAAU,GAAG,GAAG,CAAyB,CAAC,EAAE,SAAS,EAAE,QAAQ,EAAE,EAAE,EAAE,CACzE,SAAS,CAAC,CAAC,CAAC,cAAK,SAAS,EAAE,SAAS,YAAG,QAAQ,GAAO,CAAC,CAAC,CAAC,QAAQ,CACnE,CAAC"}
@@ -1,4 +1,2 @@
1
- import type { ImgSource } from '../../model/Picture';
2
1
  import type { ImageProps } from './ImgProps';
3
2
  export declare const ImgAsPicture: import("@redneckz/uni-jsx").UNIComponent<ImageProps, any, any>;
4
- export declare function formatToMimeType(format: ImgSource['format']): string | undefined;
@@ -1,21 +1,20 @@
1
1
  import { jsx as _jsx, jsxs as _jsxs } from "@redneckz/uni-jsx/jsx-runtime";
2
2
  import { JSX } from '@redneckz/uni-jsx';
3
- const sourcesComparator = (a, b) => {
4
- if (a.media && b.media) {
5
- return a.media - b.media;
6
- }
7
- return 0;
8
- };
3
+ import { useRouter } from '../../hooks/useRouter.js';
4
+ import { adjustHref } from '../../utils/adjustHref.js';
5
+ import { isURL, joinPath } from '../../utils/url.js';
6
+ const sourcesComparator = (a, b) => a?.media && b?.media ? a.media - b.media : 0;
9
7
  export const ImgAsPicture = JSX(({ className = '', image, imageClassName = '', isMobile = false, pathPrefix }) => {
10
- if (!image || (!image?.sources && !image?.src)) {
11
- return null;
12
- }
8
+ const router = useRouter();
13
9
  const pictureStyles = isMobile ? 'flex' : 'flex-none';
14
10
  return (_jsxs("picture", { className: `${pictureStyles} ${className}`, children: [image?.sources?.length
15
11
  ? image.sources
12
+ .filter((_) => _?.src)
16
13
  .sort(sourcesComparator)
17
- .map(({ src, format, media }, index) => (_jsx("source", { srcSet: addPathPrefixToSrcSet(src, pathPrefix), type: formatToMimeType(format), media: media ? `(max-width: ${media}px)` : '', ...image.size }, `${index}_${src}`)))
18
- : null, renderImg({ ...image, src: addPathPrefixToSrc(image.src, pathPrefix) }, imageClassName, isMobile)] }));
14
+ .map(({ src, format, media }, index) => (_jsx("source", { srcSet: adjustSrcset(router, pathPrefix)(src), type: formatToMimeType(format), media: media ? `(max-width: ${media}px)` : '', ...image.size }, `${index}_${src}`)))
15
+ : null, image?.src
16
+ ? renderImg({ ...image, src: adjustSrcset(router, pathPrefix)(image.src) }, imageClassName, isMobile)
17
+ : null] }));
19
18
  });
20
19
  const renderImg = (image, imageClassName = '', isMobile = false) => {
21
20
  const style = {
@@ -27,13 +26,12 @@ const renderImg = (image, imageClassName = '', isMobile = false) => {
27
26
  const imgStyle = isMobile ? 'm-auto' : 'm-0';
28
27
  return (_jsx("img", { src: image.src, className: `${imgStyle} ${imageClassName}`, alt: alt, title: title, style: style, ...image.size }));
29
28
  };
30
- const normalizePathPrefix = (pathPrefix = '') => pathPrefix && !pathPrefix.endsWith('/') ? `${pathPrefix}/` : pathPrefix;
31
- const addPathPrefixToSrc = (src, pathPrefix) => !src || src?.startsWith('data:image') ? src : `${normalizePathPrefix(pathPrefix)}${src}`;
32
- const addPathPrefixToSrcSet = (srcset, pathPrefix) => srcset
33
- ?.split(',')
34
- .map((src) => addPathPrefixToSrc(src.trim(), pathPrefix))
29
+ const adjustSrcset = (router, pathPrefix) => (srcset) => srcset
30
+ ?.split(/\s*,\s*/)
31
+ .map((src) => src.trim())
32
+ .filter(Boolean)
33
+ .map((src) => (isURL(src) ? src : joinPath(pathPrefix, src)))
34
+ .map(adjustHref(router))
35
35
  .join(', ');
36
- export function formatToMimeType(format) {
37
- return format ? `image/${String(format)}` : undefined;
38
- }
36
+ const formatToMimeType = (format) => format ? `image/${String(format)}` : undefined;
39
37
  //# sourceMappingURL=ImgAsPicture.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"ImgAsPicture.js","sourceRoot":"","sources":["../../../src/ui-kit/Img/ImgAsPicture.tsx"],"names":[],"mappings":";AAAA,OAAO,EAAE,GAAG,EAAE,MAAM,mBAAmB,CAAC;AAIxC,MAAM,iBAAiB,GAAG,CAAC,CAAU,EAAE,CAAU,EAAE,EAAE;IACnD,IAAI,CAAC,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,EAAE;QACtB,OAAO,CAAC,CAAC,KAAK,GAAG,CAAC,CAAC,KAAK,CAAC;KAC1B;IAED,OAAO,CAAC,CAAC;AACX,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,YAAY,GAAG,GAAG,CAC7B,CAAC,EAAE,SAAS,GAAG,EAAE,EAAE,KAAK,EAAE,cAAc,GAAG,EAAE,EAAE,QAAQ,GAAG,KAAK,EAAE,UAAU,EAAE,EAAE,EAAE;IAC/E,IAAI,CAAC,KAAK,IAAI,CAAC,CAAC,KAAK,EAAE,OAAO,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,EAAE;QAC9C,OAAO,IAAI,CAAC;KACb;IAED,MAAM,aAAa,GAAG,QAAQ,CAAC,CAAC,CAAC,MAAM,CAAC,CAAC,CAAC,WAAW,CAAC;IAEtD,OAAO,CACL,mBAAS,SAAS,EAAE,GAAG,aAAa,IAAI,SAAS,EAAE,aAChD,KAAK,EAAE,OAAO,EAAE,MAAM;gBACrB,CAAC,CAAC,KAAK,CAAC,OAAO;qBACV,IAAI,CAAC,iBAAiB,CAAC;qBACvB,GAAG,CAAC,CAAC,EAAE,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,CAAC,CACtC,iBAEE,MAAM,EAAE,qBAAqB,CAAC,GAAG,EAAE,UAAU,CAAC,EAC9C,IAAI,EAAE,gBAA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,EAAE,CAAC,CAAC,KAAK,CAAC,GAAG,CAAC,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,QAAQ,CAAC,UAAU,EAAE,GAAG,CAAC,CAAC,CAAC;KAC5D,GAAG,CAAC,UAAU,CAAC,MAAM,CAAC,CAAC;KACvB,IAAI,CAAC,IAAI,CAAC,CAAC;AAEhB,MAAM,gBAAgB,GAAG,CAAC,MAA2B,EAAE,EAAE,CACvD,MAAM,CAAC,CAAC,CAAC,SAAS,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC,CAAC,CAAC,SAAS,CAAC"}
@@ -0,0 +1,3 @@
1
+ export declare const adjustHref: (router: {
2
+ pathname: string;
3
+ }) => (href: string | undefined) => string | undefined;
@@ -0,0 +1,11 @@
1
+ import { projectSettings } from '../ProjectSettings.js';
2
+ import { dirname } from './dirname.js';
3
+ import { isURL, joinPath } from './url.js';
4
+ export const adjustHref = (router) => (href) => {
5
+ if (!href || isURL(href) || (projectSettings.CDN && href.startsWith(projectSettings.CDN))) {
6
+ return href;
7
+ }
8
+ const isRelativeToBase = href.startsWith('/');
9
+ return joinPath(projectSettings.BASE_PATH, isRelativeToBase ? '/' : dirname(router.pathname), href);
10
+ };
11
+ //# sourceMappingURL=adjustHref.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"adjustHref.js","sourceRoot":"","sources":["../../src/utils/adjustHref.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,oBAAoB,CAAC;AACrD,OAAO,EAAE,OAAO,EAAE,MAAM,WAAW,CAAC;AACpC,OAAO,EAAE,KAAK,EAAE,QAAQ,EAAE,MAAM,OAAO,CAAC;AAExC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,MAA4B,EAAE,EAAE,CAAC,CAAC,IAAwB,EAAE,EAAE;IACvF,IAAI,CAAC,IAAI,IAAI,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,IAAI,IAAI,CAAC,UAAU,CAAC,eAAe,CAAC,GAAG,CAAC,CAAC,EAAE;QACzF,OAAO,IAAI,CAAC;KACb;IAED,MAAM,gBAAgB,GAAG,IAAI,CAAC,UAAU,CAAC,GAAG,CAAC,CAAC;IAE9C,OAAO,QAAQ,CACb,eAAe,CAAC,SAAS,EACzB,gBAAgB,CAAC,CAAC,CAAC,GAAG,CAAC,CAAC,CAAC,OAAO,CAAC,MAAM,CAAC,QAAQ,CAAC,EACjD,IAAI,CACL,CAAC;AACJ,CAAC,CAAC"}
@@ -0,0 +1 @@
1
+ export declare const dirname: (path: string | undefined) => string | undefined;
@@ -0,0 +1,2 @@
1
+ export const dirname = (path) => path?.split('/').slice(0, -1).join('/');
2
+ //# sourceMappingURL=dirname.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"dirname.js","sourceRoot":"","sources":["../../src/utils/dirname.ts"],"names":[],"mappings":"AAAA,MAAM,CAAC,MAAM,OAAO,GAAG,CAAC,IAAwB,EAAE,EAAE,CAAC,IAAI,EAAE,KAAK,CAAC,GAAG,CAAC,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC"}
@@ -1,6 +1,6 @@
1
1
  import type { Target } from '../model/LinkProps';
2
- export declare const isURL: (href?: string) => href is `${string}//${string}`;
2
+ export declare const isURL: (href?: string) => href is `${string}:${string}`;
3
3
  export declare const isLocalURL: (href: string | undefined, target?: Target) => boolean;
4
4
  export declare const isHash: (href?: string) => href is `#${string}`;
5
5
  export declare const withoutQuery: (href?: string) => string;
6
- export declare const joinPath: (...path: string[]) => string;
6
+ export declare const joinPath: (...path: (string | undefined)[]) => string;
package/lib/utils/url.js CHANGED
@@ -1,4 +1,4 @@
1
- export const isURL = (href) => Boolean(href?.includes('//'));
1
+ export const isURL = (href) => Boolean(href?.includes(':'));
2
2
  export const isLocalURL = (href, target) => Boolean(href && !isURL(href) && (!target || target === '_self'));
3
3
  export const isHash = (href) => Boolean(href?.startsWith('#'));
4
4
  export const withoutQuery = (href) => (href || '').replace(/\?.*/, '').replace(/\/$/, '');
@@ -1 +1 @@
1
- {"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAa,EAAkC,EAAE,CACrE,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,CAAC;AAEhC,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAwB,EAAE,MAAe,EAAE,EAAE,CACtE,OAAO,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC;AAEnE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,IAAa,EAAwB,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AAE9F,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAa,EAAU,EAAE,CACpD,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAG,IAAc,EAAU,EAAE,CACpD,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC"}
1
+ {"version":3,"file":"url.js","sourceRoot":"","sources":["../../src/utils/url.ts"],"names":[],"mappings":"AAEA,MAAM,CAAC,MAAM,KAAK,GAAG,CAAC,IAAa,EAAiC,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,QAAQ,CAAC,GAAG,CAAC,CAAC,CAAC;AAEpG,MAAM,CAAC,MAAM,UAAU,GAAG,CAAC,IAAwB,EAAE,MAAe,EAAE,EAAE,CACtE,OAAO,CAAC,IAAI,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,MAAM,IAAI,MAAM,KAAK,OAAO,CAAC,CAAC,CAAC;AAEnE,MAAM,CAAC,MAAM,MAAM,GAAG,CAAC,IAAa,EAAwB,EAAE,CAAC,OAAO,CAAC,IAAI,EAAE,UAAU,CAAC,GAAG,CAAC,CAAC,CAAC;AAE9F,MAAM,CAAC,MAAM,YAAY,GAAG,CAAC,IAAa,EAAU,EAAE,CACpD,CAAC,IAAI,IAAI,EAAE,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;AAEtD,MAAM,CAAC,MAAM,QAAQ,GAAG,CAAC,GAAG,IAA4B,EAAU,EAAE,CAClE,IAAI,CAAC,MAAM,CAAC,OAAO,CAAC,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,OAAO,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC"}
package/lib/wlc.json CHANGED
@@ -2,6 +2,5 @@
2
2
  "PROD_BRANCH": "master",
3
3
  "FORCED_DRAFT_FLOW": false,
4
4
  "YANDEX_MAP_API_KEY": "f4b40c1e-1891-45f2-b307-90c481af210b",
5
- "BASE_PATH": "/natural/",
6
5
  "SITEMAP": "sayt-rshb"
7
6
  }
@@ -81,12 +81,10 @@
81
81
  return this._.FOOTER;
82
82
  }
83
83
  get CDN() {
84
- return this._.CDN;
84
+ return appendSlash(this._.CDN);
85
85
  }
86
86
  get BASE_PATH() {
87
- return this._.BASE_PATH && !this._.BASE_PATH.endsWith('/')
88
- ? `${this._.BASE_PATH}/`
89
- : this._.BASE_PATH;
87
+ return appendSlash(this._.BASE_PATH);
90
88
  }
91
89
  get YANDEX_MAP_API_KEY() {
92
90
  return this._.YANDEX_MAP_API_KEY;
@@ -95,6 +93,7 @@
95
93
  return this._.YANDEX_METRIKA_ID;
96
94
  }
97
95
  })();
96
+ const appendSlash = (url) => (url && !url.endsWith('/') ? `${url}/` : url);
98
97
 
99
98
  const AUTH_PREFIX = 'guest';
100
99
  const STORAGE_KEY = 'likesToken';
@@ -425,6 +424,49 @@
425
424
  return (jsx("div", { ref: containerRef, className: `transition-max-h duration-300 overflow-hidden ${containerRef.current || !isUnfolded ? 'max-h-0' : ''} ${className}`, children: children }));
426
425
  });
427
426
 
427
+ function useRouter() {
428
+ return useRouter._impl();
429
+ }
430
+ useRouter._impl = () => ({
431
+ href: globalThis.location?.href || '/',
432
+ pathname: globalThis.location?.pathname || '/',
433
+ query: {},
434
+ push: () => {
435
+ // Do nothing
436
+ },
437
+ replace: () => {
438
+ // Do nothing
439
+ },
440
+ });
441
+ useRouter.setup = (impl) => {
442
+ useRouter._impl = impl;
443
+ };
444
+
445
+ const dirname = (path) => path?.split('/').slice(0, -1).join('/');
446
+
447
+ const isURL = (href) => Boolean(href?.includes(':'));
448
+ const isLocalURL = (href, target) => Boolean(href && !isURL(href) && (!target || target === '_self'));
449
+ const isHash = (href) => Boolean(href?.startsWith('#'));
450
+ const withoutQuery = (href) => (href || '').replace(/\?.*/, '').replace(/\/$/, '');
451
+ const joinPath = (...path) => path.filter(Boolean).join('/').replace(/\/+/g, '/');
452
+
453
+ var url = /*#__PURE__*/Object.freeze({
454
+ __proto__: null,
455
+ isURL: isURL,
456
+ isLocalURL: isLocalURL,
457
+ isHash: isHash,
458
+ withoutQuery: withoutQuery,
459
+ joinPath: joinPath
460
+ });
461
+
462
+ const adjustHref = (router) => (href) => {
463
+ if (!href || isURL(href) || (projectSettings.CDN && href.startsWith(projectSettings.CDN))) {
464
+ return href;
465
+ }
466
+ const isRelativeToBase = href.startsWith('/');
467
+ return joinPath(projectSettings.BASE_PATH, isRelativeToBase ? '/' : dirname(router.pathname), href);
468
+ };
469
+
428
470
  const svgUseStyleMap = {
429
471
  normal: '',
430
472
  color: 'text-primary-main',
@@ -432,7 +474,8 @@
432
474
  white: 'text-black',
433
475
  };
434
476
  const Icon = JSX(({ className = '', imageClassName = '', name = '', alt = `Иконка ${name}`, title = alt, iconVersion = 'color', asSVG, ...imgProps }) => {
435
- const href = `${projectSettings.CDN || ''}icons/${name}.svg`;
477
+ const router = useRouter();
478
+ const href = adjustHref(router)(joinPath(projectSettings.CDN, '/icons', `${name}.svg`));
436
479
  if (asSVG && iconVersion !== 'normal') {
437
480
  return (jsx(Background, { className: className, children: jsxs("svg", { className: style(getSvgSize(imgProps.width), svgUseStyleMap[iconVersion], iconVersion === 'white' ? 'invert' : '', imageClassName), ...imgProps, "aria-hidden": "true", children: [title ? jsx("title", { children: title }) : null, alt ? jsx("desc", { children: alt }) : null, jsx("use", { href: `${href}#icon`, xlinkHref: `${href}#icon` })] }) }));
438
481
  }
@@ -441,22 +484,18 @@
441
484
  const getSvgSize = (width) => (width ? '' : 'w-full h-full');
442
485
  const Background = JSX(({ className, children }) => className ? jsx("div", { className: className, children: children }) : children);
443
486
 
444
- const sourcesComparator = (a, b) => {
445
- if (a.media && b.media) {
446
- return a.media - b.media;
447
- }
448
- return 0;
449
- };
487
+ const sourcesComparator = (a, b) => a?.media && b?.media ? a.media - b.media : 0;
450
488
  const ImgAsPicture = JSX(({ className = '', image, imageClassName = '', isMobile = false, pathPrefix }) => {
451
- if (!image || (!image?.sources && !image?.src)) {
452
- return null;
453
- }
489
+ const router = useRouter();
454
490
  const pictureStyles = isMobile ? 'flex' : 'flex-none';
455
491
  return (jsxs("picture", { className: `${pictureStyles} ${className}`, children: [image?.sources?.length
456
492
  ? image.sources
493
+ .filter((_) => _?.src)
457
494
  .sort(sourcesComparator)
458
- .map(({ src, format, media }, index) => (jsx("source", { srcSet: addPathPrefixToSrcSet(src, pathPrefix), type: formatToMimeType(format), media: media ? `(max-width: ${media}px)` : '', ...image.size }, `${index}_${src}`)))
459
- : null, renderImg({ ...image, src: addPathPrefixToSrc(image.src, pathPrefix) }, imageClassName, isMobile)] }));
495
+ .map(({ src, format, media }, index) => (jsx("source", { srcSet: adjustSrcset(router, pathPrefix)(src), type: formatToMimeType(format), media: media ? `(max-width: ${media}px)` : '', ...image.size }, `${index}_${src}`)))
496
+ : null, image?.src
497
+ ? renderImg({ ...image, src: adjustSrcset(router, pathPrefix)(image.src) }, imageClassName, isMobile)
498
+ : null] }));
460
499
  });
461
500
  const renderImg = (image, imageClassName = '', isMobile = false) => {
462
501
  const style = {
@@ -468,15 +507,14 @@
468
507
  const imgStyle = isMobile ? 'm-auto' : 'm-0';
469
508
  return (jsx("img", { src: image.src, className: `${imgStyle} ${imageClassName}`, alt: alt, title: title, style: style, ...image.size }));
470
509
  };
471
- const normalizePathPrefix = (pathPrefix = '') => pathPrefix && !pathPrefix.endsWith('/') ? `${pathPrefix}/` : pathPrefix;
472
- const addPathPrefixToSrc = (src, pathPrefix) => !src || src?.startsWith('data:image') ? src : `${normalizePathPrefix(pathPrefix)}${src}`;
473
- const addPathPrefixToSrcSet = (srcset, pathPrefix) => srcset
474
- ?.split(',')
475
- .map((src) => addPathPrefixToSrc(src.trim(), pathPrefix))
510
+ const adjustSrcset = (router, pathPrefix) => (srcset) => srcset
511
+ ?.split(/\s*,\s*/)
512
+ .map((src) => src.trim())
513
+ .filter(Boolean)
514
+ .map((src) => (isURL(src) ? src : joinPath(pathPrefix, src)))
515
+ .map(adjustHref(router))
476
516
  .join(', ');
477
- function formatToMimeType(format) {
478
- return format ? `image/${String(format)}` : undefined;
479
- }
517
+ const formatToMimeType = (format) => format ? `image/${String(format)}` : undefined;
480
518
 
481
519
  const ImgInner = JSX(({ className = '', image, imageClassName = '', isMobile, pathPrefix, ...iconProps }) => {
482
520
  if (!image?.src && !image?.icon) {
@@ -666,31 +704,6 @@
666
704
  return (jsxs("div", { className: style(className, listType === 'vertical-list' ? 'relative h-full' : ''), children: [jsx(SwipeListContainer, { containerRef: containerRef, activeIndex: activeIndex, visibleItemCount: 1, gap: gap, padding: padding, onVisibleIndicesChange: scroll.handleVisibleIndicesChange, listType: listType, children: children }), showDots ? (jsx(SwipeListControlDots, { containerRef: containerRef, activeIndex: activeIndex, dotCount: itemCount, listType: listType })) : null] }));
667
705
  });
668
706
 
669
- const normalizeAnchor = (anchor) => anchor?.replace('#', '') || '';
670
- function gotoBlock(router, anchor) {
671
- router.replace(`#${normalizeAnchor(anchor)}`);
672
- }
673
- function trackBlock(router, block) {
674
- router.replace(`#${normalizeAnchor(block?.anchor)}`, undefined, {
675
- scroll: false,
676
- });
677
- }
678
-
679
- const isURL = (href) => Boolean(href?.includes('//'));
680
- const isLocalURL = (href, target) => Boolean(href && !isURL(href) && (!target || target === '_self'));
681
- const isHash = (href) => Boolean(href?.startsWith('#'));
682
- const withoutQuery = (href) => (href || '').replace(/\?.*/, '').replace(/\/$/, '');
683
- const joinPath = (...path) => path.filter(Boolean).join('/').replace(/\/+/g, '/');
684
-
685
- var url = /*#__PURE__*/Object.freeze({
686
- __proto__: null,
687
- isURL: isURL,
688
- isLocalURL: isLocalURL,
689
- isHash: isHash,
690
- withoutQuery: withoutQuery,
691
- joinPath: joinPath
692
- });
693
-
694
707
  /* eslint-disable @typescript-eslint/ban-types */
695
708
  const handlerDecorator = (handler, targetContent) => {
696
709
  return handlerDecorator._impl(handler, targetContent);
@@ -700,53 +713,24 @@
700
713
  handlerDecorator._impl = impl;
701
714
  };
702
715
 
703
- function useRouter() {
704
- return useRouter._impl();
705
- }
706
- useRouter._impl = () => ({
707
- href: globalThis.location?.href || '/',
708
- pathname: globalThis.location?.pathname || '/',
709
- query: {},
710
- push: () => {
711
- // Do nothing
712
- },
713
- replace: () => {
714
- // Do nothing
715
- },
716
- });
717
- useRouter.setup = (impl) => {
718
- useRouter._impl = impl;
719
- };
720
-
721
716
  function useLink(isRemote) {
722
717
  const router = useRouter();
723
718
  return (props) => ({
724
719
  ...props,
725
- href: adjustHref(props.href),
720
+ href: isRemote ? props.href : adjustHref(router)(props.href),
726
721
  'aria-label': props.text,
727
722
  onClick: handlerDecorator(handleHref(props), props),
728
723
  });
729
- function adjustHref(href) {
730
- const isRelativeToBase = !isRemote && href?.startsWith('/');
731
- return projectSettings.BASE_PATH && href && isRelativeToBase
732
- ? joinPath(projectSettings.BASE_PATH, href)
733
- : href;
734
- }
735
724
  function handleHref({ href, target, onClick }) {
736
725
  return (ev) => {
737
726
  onClick && onClick(ev);
738
- if (isRemote || !isLocalURL(href, target)) {
727
+ if (!href || isRemote || !isLocalURL(href, target)) {
739
728
  // Default routing
740
729
  return;
741
730
  }
742
731
  // Client routing
743
732
  ev?.preventDefault();
744
- if (isHash(href)) {
745
- gotoBlock(router, href);
746
- }
747
- else if (href) {
748
- router.push(href);
749
- }
733
+ router.push(href);
750
734
  };
751
735
  }
752
736
  }
@@ -1402,7 +1386,16 @@
1402
1386
  return (jsx(BlockWrapper, { className: `px-4 py-6 ${className}`, ...rest, children: jsx(ProductBlockInner, { ...props }) }));
1403
1387
  });
1404
1388
 
1405
- const checkIsIconRenderable = (icon) => Boolean(icon?.icon || icon?.src);
1389
+ const RichText = JSX((props) => {
1390
+ const { __html = '' } = props;
1391
+ return jsx("div", { className: "md-container", dangerouslySetInnerHTML: { __html } });
1392
+ });
1393
+
1394
+ function assertUnreachable(x) {
1395
+ throw new Error(x);
1396
+ }
1397
+
1398
+ const checkCanRenderIcon = (icon) => Boolean(icon?.icon || icon?.src);
1406
1399
 
1407
1400
  const STEPS_BLOCK_STYLE_MAPS = {
1408
1401
  primary: {
@@ -1454,9 +1447,27 @@
1454
1447
  };
1455
1448
  const StepsBlock = JSX(({ className = '', title, description, showLines = true, steps, size = 'normal', version = 'primary', ...rest }) => {
1456
1449
  const styleMap = STEPS_BLOCK_STYLE_MAPS[version];
1457
- return (jsxs(BlockWrapper, { className: `box-border px-4 py-6 flex flex-col ${className}`, version: version, ...rest, children: [title ? jsx(Heading, { headingType: "h3", className: "text-center", title: title }) : null, description ? (jsx("p", { className: `text-m-light text-center ${styleMap.description} ${title ? 'mt-2' : ''}`, children: description })) : null, steps?.length ? (jsx("div", { className: `box-border py-0.5 mb-0.5 mt-5`, children: jsx("div", { className: "flex flex-col justify-between gap-x-[101px]", children: steps.map(renderStepTitle(size, version, showLines)) }) })) : null] }));
1450
+ return (jsxs(BlockWrapper, { className: `box-border px-4 py-6 flex flex-col ${className}`, version: version, ...rest, children: [title ? jsx(Heading, { headingType: "h3", className: "text-center", title: title }) : null, description ? (jsx("p", { className: `text-m-light text-center ${styleMap.description} ${title ? 'mt-2' : ''}`, children: description })) : null, steps?.length ? (jsx("div", { className: `box-border py-0.5 mb-0.5 mt-5`, children: jsx("div", { className: "flex flex-col justify-between gap-x-[101px]", children: steps.map(renderStep(size, version, showLines)) }) })) : null] }));
1458
1451
  });
1459
- const renderStepTitle = (size, version, showLines) => (step, i, steps) => {
1452
+ // TODO: Create universal function for this case
1453
+ const renderStep = (size, version, showLines) =>
1454
+ // Linter doesn't understand that switch processes all cases
1455
+ // eslint-disable-next-line consistent-return
1456
+ (step, i, steps) => {
1457
+ const { type } = step;
1458
+ if (!(type === 'default' || type === 'rte')) {
1459
+ return null;
1460
+ }
1461
+ switch (type) {
1462
+ case 'default':
1463
+ return renderDefaultStep(size, version, showLines)(step, i, steps);
1464
+ case 'rte':
1465
+ return jsx(RichText, { __html: step.__html });
1466
+ default:
1467
+ assertUnreachable(step);
1468
+ }
1469
+ };
1470
+ const renderDefaultStep = (size, version, showLines) => (step, i, steps) => {
1460
1471
  const isLastStep = steps.length - 1 === i;
1461
1472
  const margin = size === 'normal' ? 'ml-[34px]' : 'ml-6';
1462
1473
  const styleMap = STEPS_BLOCK_STYLE_MAPS[version];
@@ -1467,7 +1478,7 @@
1467
1478
  const iconAreaSize = STEPS_SIZE_MAP[size];
1468
1479
  const iconSize = size === 'normal' ? '38' : '27';
1469
1480
  const iconTextSize = size === 'normal' ? 'text-m-title' : 'text-m-title-xs';
1470
- return (jsx("div", { className: `${iconAreaSize} ${styleMap.iconBackground} rounded-full z-10 mr-3 flex justify-center content-center`, children: jsx("span", { className: `font-medium flex self-center ${iconTextSize}`, children: checkIsIconRenderable(step?.icon) ? (jsx(Img, { image: getIconWithVersion({ ...step.icon }, version), width: iconSize, height: iconSize, asSVG: true })) : (jsx("span", { children: i + 1 })) }) }));
1481
+ return (jsx("div", { className: `${iconAreaSize} ${styleMap.iconBackground} rounded-full z-10 mr-3 flex justify-center content-center`, children: jsx("span", { className: `font-medium flex self-center ${iconTextSize}`, children: checkCanRenderIcon(step?.icon) ? (jsx(Img, { image: getIconWithVersion({ ...step.icon }, version), width: iconSize, height: iconSize, asSVG: true })) : (jsx("span", { children: i + 1 })) }) }));
1471
1482
  };
1472
1483
 
1473
1484
  const renderButtonsCellData = ({ buttons }) => renderButtonsSection(buttons, {
@@ -1581,6 +1592,11 @@
1581
1592
  return debouncedCallback;
1582
1593
  };
1583
1594
 
1595
+ const normalizeAnchor = (anchor) => anchor?.replace('#', '') || '';
1596
+ function trackBlock(block) {
1597
+ globalThis.history?.replaceState(globalThis.history?.state, '', `#${normalizeAnchor(block?.anchor)}`);
1598
+ }
1599
+
1584
1600
  const SPECIAL_BLOCK_TYPES = ['Header', 'Footer'];
1585
1601
  const EPS = 0.01;
1586
1602
  const topLineDelta = ([, { target }]) => Math.abs(target.getBoundingClientRect().top);
@@ -1594,7 +1610,6 @@
1594
1610
 
1595
1611
  const isScrolledEnough = () => globalThis.scrollY > (globalThis.innerHeight * 3) / 4;
1596
1612
  function useBlockRouterProvider(scrollTarget = globalThis) {
1597
- const router = useRouter();
1598
1613
  const intersectionsMapRef = useRef(new Map());
1599
1614
  useEffect(() => blockRouterEventBus.subscribe('intersection', ({ block, intersection }) => {
1600
1615
  if (intersectionsMapRef.current) {
@@ -1603,20 +1618,14 @@
1603
1618
  }), []);
1604
1619
  useEffect(() => {
1605
1620
  const handleScroll = debounce(() => {
1606
- if (isScrolledEnough()) {
1607
- const activeBlock = findActiveBlock([...(intersectionsMapRef.current || [])]);
1608
- trackBlock(router, activeBlock);
1609
- }
1610
- else {
1611
- trackBlock(router);
1612
- }
1621
+ trackBlock(isScrolledEnough() ? findActiveBlock([...(intersectionsMapRef.current || [])]) : undefined);
1613
1622
  }, 100);
1614
1623
  scrollTarget.addEventListener('scroll', handleScroll);
1615
1624
  return () => {
1616
1625
  handleScroll.dispose();
1617
1626
  scrollTarget.removeEventListener('scroll', handleScroll);
1618
1627
  };
1619
- }, [router, scrollTarget]);
1628
+ }, [scrollTarget]);
1620
1629
  }
1621
1630
 
1622
1631
  const api = LikeAPI();
@@ -1691,7 +1700,7 @@
1691
1700
  return (list) => list.reduce((acc, el, i) => (acc.length ? acc.concat({ ...sep, key: i }, el) : [el]), []);
1692
1701
  }
1693
1702
 
1694
- const packageVersion = "0.8.9";
1703
+ const packageVersion = "0.8.11";
1695
1704
 
1696
1705
  exports.Blocks = Blocks;
1697
1706
  exports.ContentPage = ContentPage;