@redneckz/wildless-cms-uni-blocks 0.7.6 → 0.7.8

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 (277) hide show
  1. package/bin/migration-scripts/0.7.8.js +29 -0
  2. package/bundle/blocks.schema.json +1 -1
  3. package/bundle/bundle.umd.js +115 -71
  4. package/bundle/bundle.umd.min.js +1 -1
  5. package/bundle/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +5 -9
  6. package/bundle/components/Footer/MediaButton.d.ts +3 -4
  7. package/bundle/components/Footer/SocialMedia.d.ts +2 -3
  8. package/bundle/components/Header/HeaderChatBotButton.d.ts +11 -0
  9. package/bundle/components/Header/HeaderContent.d.ts +6 -1
  10. package/bundle/components/Header/HeaderSecondaryMenu.d.ts +2 -0
  11. package/bundle/components/Header/HeaderSecondaryMenuButton.d.ts +7 -2
  12. package/bundle/components/Header/useChatBot.d.ts +2 -0
  13. package/bundle/components/PictureText/renderBenefit.d.ts +4 -0
  14. package/bundle/hooks/useBool.d.ts +9 -0
  15. package/bundle/icons/IconName.d.ts +4 -2
  16. package/bundle/model/ButtonVersion.d.ts +2 -2
  17. package/bundle/ui-kit/BenefitItem/BenefitItemProps.d.ts +26 -3
  18. package/cosmos-static/icons/HeadphonesIcon.svg +1 -0
  19. package/dist/components/CarouselCatalogCard/CarouselCatalogCard.js +1 -1
  20. package/dist/components/CarouselCatalogCard/CarouselCatalogCard.js.map +1 -1
  21. package/dist/components/CarouselProductCard/CarouselProductCard.js +1 -1
  22. package/dist/components/CarouselProductCard/CarouselProductCard.js.map +1 -1
  23. package/dist/components/CarouselRecommendationCard/CarouselRecommendationCard.js +2 -2
  24. package/dist/components/CarouselRecommendationCard/CarouselRecommendationCard.js.map +1 -1
  25. package/dist/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +5 -9
  26. package/dist/components/Footer/Footer.js +2 -2
  27. package/dist/components/Footer/Footer.js.map +1 -1
  28. package/dist/components/Footer/Footer.mobile.js.map +1 -1
  29. package/dist/components/Footer/MediaButton.d.ts +3 -4
  30. package/dist/components/Footer/MediaButton.js +4 -5
  31. package/dist/components/Footer/MediaButton.js.map +1 -1
  32. package/dist/components/Footer/SocialMedia.d.ts +2 -3
  33. package/dist/components/Footer/SocialMedia.js +1 -1
  34. package/dist/components/Footer/SocialMedia.js.map +1 -1
  35. package/dist/components/Header/DropdownMenu.js +3 -2
  36. package/dist/components/Header/DropdownMenu.js.map +1 -1
  37. package/dist/components/Header/Header.js +3 -2
  38. package/dist/components/Header/Header.js.map +1 -1
  39. package/dist/components/Header/HeaderChatBotButton.d.ts +11 -0
  40. package/dist/components/Header/HeaderChatBotButton.js +19 -0
  41. package/dist/components/Header/HeaderChatBotButton.js.map +1 -0
  42. package/dist/components/Header/HeaderContent.d.ts +6 -1
  43. package/dist/components/Header/HeaderSecondaryMenu.d.ts +2 -0
  44. package/dist/components/Header/HeaderSecondaryMenu.js +6 -11
  45. package/dist/components/Header/HeaderSecondaryMenu.js.map +1 -1
  46. package/dist/components/Header/HeaderSecondaryMenuButton.d.ts +7 -2
  47. package/dist/components/Header/HeaderSecondaryMenuButton.js +5 -1
  48. package/dist/components/Header/HeaderSecondaryMenuButton.js.map +1 -1
  49. package/dist/components/Header/useChatBot.d.ts +2 -0
  50. package/dist/components/Header/useChatBot.js +15 -0
  51. package/dist/components/Header/useChatBot.js.map +1 -0
  52. package/dist/components/PictureText/PictureText.js +2 -3
  53. package/dist/components/PictureText/PictureText.js.map +1 -1
  54. package/dist/components/PictureText/renderBenefit.d.ts +4 -0
  55. package/dist/components/PictureText/renderBenefit.js +25 -0
  56. package/dist/components/PictureText/renderBenefit.js.map +1 -0
  57. package/dist/components/ProductTile/renderBenefit.js +1 -1
  58. package/dist/components/ProductTile/renderBenefit.js.map +1 -1
  59. package/dist/hooks/useBool.d.ts +9 -0
  60. package/dist/hooks/useBool.js +12 -0
  61. package/dist/hooks/useBool.js.map +1 -0
  62. package/dist/icons/IconName.d.ts +4 -2
  63. package/dist/icons/IconName.js +3 -1
  64. package/dist/icons/IconName.js.map +1 -1
  65. package/dist/model/ButtonVersion.d.ts +2 -2
  66. package/dist/ui-kit/BenefitItem/BenefitItemProps.d.ts +26 -3
  67. package/dist/ui-kit/Button/buttonClassNameConstants.js +3 -0
  68. package/dist/ui-kit/Button/buttonClassNameConstants.js.map +1 -1
  69. package/lib/common.css +1 -1
  70. package/lib/components/CarouselCatalogCard/CarouselCatalogCard.js +1 -1
  71. package/lib/components/CarouselCatalogCard/CarouselCatalogCard.js.map +1 -1
  72. package/lib/components/CarouselProductCard/CarouselProductCard.js +1 -1
  73. package/lib/components/CarouselProductCard/CarouselProductCard.js.map +1 -1
  74. package/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.js +2 -2
  75. package/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.js.map +1 -1
  76. package/lib/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +5 -9
  77. package/lib/components/Footer/Footer.js +2 -2
  78. package/lib/components/Footer/Footer.js.map +1 -1
  79. package/lib/components/Footer/Footer.mobile.js.map +1 -1
  80. package/lib/components/Footer/MediaButton.d.ts +3 -4
  81. package/lib/components/Footer/MediaButton.js +4 -5
  82. package/lib/components/Footer/MediaButton.js.map +1 -1
  83. package/lib/components/Footer/SocialMedia.d.ts +2 -3
  84. package/lib/components/Footer/SocialMedia.js +1 -1
  85. package/lib/components/Footer/SocialMedia.js.map +1 -1
  86. package/lib/components/Header/DropdownMenu.js +3 -2
  87. package/lib/components/Header/DropdownMenu.js.map +1 -1
  88. package/lib/components/Header/Header.js +3 -2
  89. package/lib/components/Header/Header.js.map +1 -1
  90. package/lib/components/Header/HeaderChatBotButton.d.ts +11 -0
  91. package/lib/components/Header/HeaderChatBotButton.js +17 -0
  92. package/lib/components/Header/HeaderChatBotButton.js.map +1 -0
  93. package/lib/components/Header/HeaderContent.d.ts +6 -1
  94. package/lib/components/Header/HeaderSecondaryMenu.d.ts +2 -0
  95. package/lib/components/Header/HeaderSecondaryMenu.js +6 -11
  96. package/lib/components/Header/HeaderSecondaryMenu.js.map +1 -1
  97. package/lib/components/Header/HeaderSecondaryMenuButton.d.ts +7 -2
  98. package/lib/components/Header/HeaderSecondaryMenuButton.js +5 -1
  99. package/lib/components/Header/HeaderSecondaryMenuButton.js.map +1 -1
  100. package/lib/components/Header/useChatBot.d.ts +2 -0
  101. package/lib/components/Header/useChatBot.js +12 -0
  102. package/lib/components/Header/useChatBot.js.map +1 -0
  103. package/lib/components/PictureText/PictureText.fixture.d.ts +2 -0
  104. package/lib/components/PictureText/PictureText.js +1 -2
  105. package/lib/components/PictureText/PictureText.js.map +1 -1
  106. package/lib/components/PictureText/renderBenefit.d.ts +4 -0
  107. package/lib/components/PictureText/renderBenefit.js +22 -0
  108. package/lib/components/PictureText/renderBenefit.js.map +1 -0
  109. package/lib/components/ProductTile/renderBenefit.js +1 -1
  110. package/lib/components/ProductTile/renderBenefit.js.map +1 -1
  111. package/lib/hooks/useBool.d.ts +9 -0
  112. package/lib/hooks/useBool.js +9 -0
  113. package/lib/hooks/useBool.js.map +1 -0
  114. package/lib/icons/IconName.d.ts +4 -2
  115. package/lib/icons/IconName.js +3 -1
  116. package/lib/icons/IconName.js.map +1 -1
  117. package/lib/model/ButtonVersion.d.ts +2 -2
  118. package/lib/ui-kit/BenefitItem/BenefitItemProps.d.ts +26 -3
  119. package/lib/ui-kit/Button/buttonClassNameConstants.js +3 -0
  120. package/lib/ui-kit/Button/buttonClassNameConstants.js.map +1 -1
  121. package/mobile/bundle/bundle.umd.js +7 -5
  122. package/mobile/bundle/bundle.umd.min.js +1 -1
  123. package/mobile/bundle/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +5 -9
  124. package/mobile/bundle/components/Footer/MediaButton.d.ts +3 -4
  125. package/mobile/bundle/components/Header/HeaderChatBotButton.d.ts +11 -0
  126. package/mobile/bundle/components/Header/HeaderContent.d.ts +6 -1
  127. package/mobile/bundle/components/Header/HeaderSecondaryMenu.d.ts +2 -0
  128. package/mobile/bundle/components/Header/HeaderSecondaryMenuButton.d.ts +7 -2
  129. package/mobile/bundle/components/Header/useChatBot.d.ts +2 -0
  130. package/mobile/bundle/components/PictureText/renderBenefit.d.ts +4 -0
  131. package/mobile/bundle/hooks/useBool.d.ts +9 -0
  132. package/mobile/bundle/icons/IconName.d.ts +4 -2
  133. package/mobile/bundle/model/ButtonVersion.d.ts +2 -2
  134. package/mobile/bundle/ui-kit/BenefitItem/BenefitItemProps.d.ts +26 -3
  135. package/mobile/dist/components/CarouselCatalogCard/CarouselCatalogCard.js +1 -1
  136. package/mobile/dist/components/CarouselCatalogCard/CarouselCatalogCard.js.map +1 -1
  137. package/mobile/dist/components/CarouselProductCard/CarouselProductCard.js +1 -1
  138. package/mobile/dist/components/CarouselProductCard/CarouselProductCard.js.map +1 -1
  139. package/mobile/dist/components/CarouselRecommendationCard/CarouselRecommendationCard.js +2 -2
  140. package/mobile/dist/components/CarouselRecommendationCard/CarouselRecommendationCard.js.map +1 -1
  141. package/mobile/dist/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +5 -9
  142. package/mobile/dist/components/Footer/Footer.js.map +1 -1
  143. package/mobile/dist/components/Footer/MediaButton.d.ts +3 -4
  144. package/mobile/dist/components/Footer/MediaButton.js +4 -5
  145. package/mobile/dist/components/Footer/MediaButton.js.map +1 -1
  146. package/mobile/dist/components/Header/DropdownMenu.js +3 -2
  147. package/mobile/dist/components/Header/DropdownMenu.js.map +1 -1
  148. package/mobile/dist/components/Header/HeaderChatBotButton.d.ts +11 -0
  149. package/mobile/dist/components/Header/HeaderChatBotButton.js +19 -0
  150. package/mobile/dist/components/Header/HeaderChatBotButton.js.map +1 -0
  151. package/mobile/dist/components/Header/HeaderContent.d.ts +6 -1
  152. package/mobile/dist/components/Header/HeaderSecondaryMenu.d.ts +2 -0
  153. package/mobile/dist/components/Header/HeaderSecondaryMenu.js +6 -11
  154. package/mobile/dist/components/Header/HeaderSecondaryMenu.js.map +1 -1
  155. package/mobile/dist/components/Header/HeaderSecondaryMenuButton.d.ts +7 -2
  156. package/mobile/dist/components/Header/HeaderSecondaryMenuButton.js +5 -1
  157. package/mobile/dist/components/Header/HeaderSecondaryMenuButton.js.map +1 -1
  158. package/mobile/dist/components/Header/useChatBot.d.ts +2 -0
  159. package/mobile/dist/components/Header/useChatBot.js +15 -0
  160. package/mobile/dist/components/Header/useChatBot.js.map +1 -0
  161. package/mobile/dist/components/PictureText/PictureText.js +2 -3
  162. package/mobile/dist/components/PictureText/PictureText.js.map +1 -1
  163. package/mobile/dist/components/PictureText/renderBenefit.d.ts +4 -0
  164. package/mobile/dist/components/PictureText/renderBenefit.js +25 -0
  165. package/mobile/dist/components/PictureText/renderBenefit.js.map +1 -0
  166. package/mobile/dist/components/ProductTile/renderBenefit.js +1 -1
  167. package/mobile/dist/components/ProductTile/renderBenefit.js.map +1 -1
  168. package/mobile/dist/hooks/useBool.d.ts +9 -0
  169. package/mobile/dist/hooks/useBool.js +12 -0
  170. package/mobile/dist/hooks/useBool.js.map +1 -0
  171. package/mobile/dist/icons/IconName.d.ts +4 -2
  172. package/mobile/dist/icons/IconName.js +3 -1
  173. package/mobile/dist/icons/IconName.js.map +1 -1
  174. package/mobile/dist/model/ButtonVersion.d.ts +2 -2
  175. package/mobile/dist/ui-kit/BenefitItem/BenefitItemProps.d.ts +26 -3
  176. package/mobile/dist/ui-kit/Button/buttonClassNameConstants.js +3 -0
  177. package/mobile/dist/ui-kit/Button/buttonClassNameConstants.js.map +1 -1
  178. package/mobile/lib/components/CarouselCatalogCard/CarouselCatalogCard.js +1 -1
  179. package/mobile/lib/components/CarouselCatalogCard/CarouselCatalogCard.js.map +1 -1
  180. package/mobile/lib/components/CarouselProductCard/CarouselProductCard.js +1 -1
  181. package/mobile/lib/components/CarouselProductCard/CarouselProductCard.js.map +1 -1
  182. package/mobile/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.js +2 -2
  183. package/mobile/lib/components/CarouselRecommendationCard/CarouselRecommendationCard.js.map +1 -1
  184. package/mobile/lib/components/CarouselRecommendationCard/CarouselRecommendationCardContent.d.ts +5 -9
  185. package/mobile/lib/components/Footer/Footer.js.map +1 -1
  186. package/mobile/lib/components/Footer/MediaButton.d.ts +3 -4
  187. package/mobile/lib/components/Footer/MediaButton.js +4 -5
  188. package/mobile/lib/components/Footer/MediaButton.js.map +1 -1
  189. package/mobile/lib/components/Header/DropdownMenu.js +3 -2
  190. package/mobile/lib/components/Header/DropdownMenu.js.map +1 -1
  191. package/mobile/lib/components/Header/HeaderChatBotButton.d.ts +11 -0
  192. package/mobile/lib/components/Header/HeaderChatBotButton.js +17 -0
  193. package/mobile/lib/components/Header/HeaderChatBotButton.js.map +1 -0
  194. package/mobile/lib/components/Header/HeaderContent.d.ts +6 -1
  195. package/mobile/lib/components/Header/HeaderSecondaryMenu.d.ts +2 -0
  196. package/mobile/lib/components/Header/HeaderSecondaryMenu.js +6 -11
  197. package/mobile/lib/components/Header/HeaderSecondaryMenu.js.map +1 -1
  198. package/mobile/lib/components/Header/HeaderSecondaryMenuButton.d.ts +7 -2
  199. package/mobile/lib/components/Header/HeaderSecondaryMenuButton.js +5 -1
  200. package/mobile/lib/components/Header/HeaderSecondaryMenuButton.js.map +1 -1
  201. package/mobile/lib/components/Header/useChatBot.d.ts +2 -0
  202. package/mobile/lib/components/Header/useChatBot.js +12 -0
  203. package/mobile/lib/components/Header/useChatBot.js.map +1 -0
  204. package/mobile/lib/components/PictureText/PictureText.js +1 -2
  205. package/mobile/lib/components/PictureText/PictureText.js.map +1 -1
  206. package/mobile/lib/components/PictureText/renderBenefit.d.ts +4 -0
  207. package/mobile/lib/components/PictureText/renderBenefit.js +22 -0
  208. package/mobile/lib/components/PictureText/renderBenefit.js.map +1 -0
  209. package/mobile/lib/components/ProductTile/renderBenefit.js +1 -1
  210. package/mobile/lib/components/ProductTile/renderBenefit.js.map +1 -1
  211. package/mobile/lib/hooks/useBool.d.ts +9 -0
  212. package/mobile/lib/hooks/useBool.js +9 -0
  213. package/mobile/lib/hooks/useBool.js.map +1 -0
  214. package/mobile/lib/icons/IconName.d.ts +4 -2
  215. package/mobile/lib/icons/IconName.js +3 -1
  216. package/mobile/lib/icons/IconName.js.map +1 -1
  217. package/mobile/lib/model/ButtonVersion.d.ts +2 -2
  218. package/mobile/lib/ui-kit/BenefitItem/BenefitItemProps.d.ts +26 -3
  219. package/mobile/lib/ui-kit/Button/buttonClassNameConstants.js +3 -0
  220. package/mobile/lib/ui-kit/Button/buttonClassNameConstants.js.map +1 -1
  221. package/mobile/src/components/CarouselCatalogCard/CarouselCatalogCard.tsx +0 -1
  222. package/mobile/src/components/CarouselProductCard/CarouselProductCard.tsx +0 -1
  223. package/mobile/src/components/CarouselRecommendationCard/CarouselRecommendationCard.example.json +6 -3
  224. package/mobile/src/components/CarouselRecommendationCard/CarouselRecommendationCard.tsx +2 -0
  225. package/mobile/src/components/CarouselRecommendationCard/CarouselRecommendationCard.ui.json +7 -0
  226. package/mobile/src/components/CarouselRecommendationCard/CarouselRecommendationCardContent.ts +5 -9
  227. package/mobile/src/components/Footer/Footer.tsx +1 -1
  228. package/mobile/src/components/Footer/MediaButton.tsx +19 -17
  229. package/mobile/src/components/Header/DropdownMenu.tsx +7 -5
  230. package/mobile/src/components/Header/HeaderChatBotButton.tsx +45 -0
  231. package/mobile/src/components/Header/HeaderContent.ts +7 -1
  232. package/mobile/src/components/Header/HeaderSecondaryMenu.tsx +20 -30
  233. package/mobile/src/components/Header/HeaderSecondaryMenuButton.tsx +24 -5
  234. package/mobile/src/components/Header/useChatBot.ts +16 -0
  235. package/mobile/src/components/PictureText/PictureText.tsx +1 -14
  236. package/mobile/src/components/PictureText/PictureText.ui.json +10 -0
  237. package/mobile/src/components/PictureText/renderBenefit.tsx +33 -0
  238. package/mobile/src/components/ProductTile/renderBenefit.tsx +5 -1
  239. package/mobile/src/hooks/useBool.ts +19 -0
  240. package/mobile/src/icons/HeadphonesIcon.svg +5 -0
  241. package/mobile/src/icons/IconName.ts +5 -5
  242. package/mobile/src/model/ButtonVersion.ts +9 -2
  243. package/mobile/src/ui-kit/BenefitItem/BenefitItemProps.ts +28 -3
  244. package/mobile/src/ui-kit/Button/buttonClassNameConstants.ts +3 -0
  245. package/mobile/src/ui-kit/Img/ImgProps.ts +1 -0
  246. package/package.json +1 -1
  247. package/src/components/CarouselCatalogCard/CarouselCatalogCard.tsx +0 -1
  248. package/src/components/CarouselProductCard/CarouselProductCard.tsx +0 -1
  249. package/src/components/CarouselRecommendationCard/CarouselRecommendationCard.example.json +6 -3
  250. package/src/components/CarouselRecommendationCard/CarouselRecommendationCard.fixture.tsx +20 -5
  251. package/src/components/CarouselRecommendationCard/CarouselRecommendationCard.tsx +2 -0
  252. package/src/components/CarouselRecommendationCard/CarouselRecommendationCard.ui.json +7 -0
  253. package/src/components/CarouselRecommendationCard/CarouselRecommendationCardContent.ts +5 -9
  254. package/src/components/Footer/Footer.mobile.tsx +1 -1
  255. package/src/components/Footer/Footer.tsx +2 -2
  256. package/src/components/Footer/MediaButton.tsx +19 -17
  257. package/src/components/Footer/SocialMedia.tsx +4 -5
  258. package/src/components/Header/DropdownMenu.tsx +7 -5
  259. package/src/components/Header/Header.fixture.tsx +3 -3
  260. package/src/components/Header/Header.tsx +13 -5
  261. package/src/components/Header/HeaderChatBotButton.tsx +45 -0
  262. package/src/components/Header/HeaderContent.ts +7 -1
  263. package/src/components/Header/HeaderSecondaryMenu.tsx +20 -30
  264. package/src/components/Header/HeaderSecondaryMenuButton.tsx +24 -5
  265. package/src/components/Header/useChatBot.ts +16 -0
  266. package/src/components/PictureText/PictureText.fixture.tsx +37 -0
  267. package/src/components/PictureText/PictureText.tsx +1 -14
  268. package/src/components/PictureText/PictureText.ui.json +10 -0
  269. package/src/components/PictureText/renderBenefit.tsx +33 -0
  270. package/src/components/ProductTile/renderBenefit.tsx +5 -1
  271. package/src/hooks/useBool.ts +19 -0
  272. package/src/icons/HeadphonesIcon.svg +5 -0
  273. package/src/icons/IconName.ts +6 -340
  274. package/src/model/ButtonVersion.ts +9 -2
  275. package/src/ui-kit/BenefitItem/BenefitItemProps.ts +28 -3
  276. package/src/ui-kit/Button/buttonClassNameConstants.ts +3 -0
  277. package/src/ui-kit/Img/ImgProps.ts +1 -0
@@ -3,6 +3,7 @@ import { useCallback, useState } from '@redneckz/uni-jsx/lib/hooks';
3
3
  import { useLink } from '../../hooks/useLink';
4
4
  import { useOutsideClick } from '../../hooks/useOutsideClick';
5
5
  import type { LinkProps } from '../../model/LinkProps';
6
+ import { style } from '../../utils/style';
6
7
 
7
8
  interface DropdownMenuProps {
8
9
  className?: string;
@@ -21,7 +22,7 @@ export const DropdownMenu = JSX<DropdownMenuProps>(({ className = '', items, act
21
22
 
22
23
  return (
23
24
  <div
24
- className={`${visible ? 'bg-white rounded-md shadow-blue-gray' : ''} ${className}`}
25
+ className={style(visible ? 'bg-white rounded-md shadow-blue-gray' : '', className)}
25
26
  ref={ref}
26
27
  >
27
28
  <button
@@ -39,15 +40,16 @@ export const DropdownMenu = JSX<DropdownMenuProps>(({ className = '', items, act
39
40
  ))}
40
41
  </button>
41
42
  <div
42
- className={`flex flex-col rounded-md bg-white p-6 pb-2 ${visible ? '' : 'hidden'}`}
43
+ className={style('flex flex-col rounded-md bg-white p-6 pb-2', visible ? '' : 'hidden')}
43
44
  aria-hidden={!visible}
44
45
  >
45
46
  {items?.map((item, i) => (
46
47
  <a
47
48
  key={item.href || String(i)}
48
- className={`text-l-light pb-4 hover:text-primary-main ${
49
- item === activeItem ? 'text-primary-main' : ''
50
- }`}
49
+ className={style(
50
+ 'text-l-light pb-4 hover:text-primary-main',
51
+ item === activeItem ? 'text-primary-main' : '',
52
+ )}
51
53
  {...link(item)}
52
54
  >
53
55
  {item.text}
@@ -2,7 +2,7 @@ import '../../setup-fixture';
2
2
  import { Header } from './Header';
3
3
 
4
4
  export default {
5
- default: <Header />,
6
- transparent: <Header bgColor="transparent" />,
7
- 'no submenu': <Header showSubMenu={false} />,
5
+ default: <Header chat="personal" />,
6
+ transparent: <Header bgColor="transparent" chat="personal" />,
7
+ 'no submenu': <Header showSubMenu={false} chat="personal" />,
8
8
  };
@@ -10,6 +10,7 @@ import { useSWRResource } from '../../services/sitemap/useSWRResource';
10
10
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
11
11
  import { Logo } from '../../ui-kit/Logo/Logo';
12
12
  import { TopItem } from '../../ui-kit/TopItem/TopItem';
13
+ import { style } from '../../utils/style';
13
14
  import type { HeaderContent } from './HeaderContent';
14
15
  import { HeaderSecondaryMenu } from './HeaderSecondaryMenu';
15
16
  import { HeaderSubMenu } from './HeaderSubMenu';
@@ -24,9 +25,10 @@ const BG_COLOR_TO_BLOCK_VERSION: Record<BgColorVersion, BlockVersion> = {
24
25
  export const Header = JSX<HeaderProps>(
25
26
  ({
26
27
  bgColor = 'bg-white',
27
- className = '',
28
+ className,
28
29
  showSubMenu = true,
29
30
  version = BG_COLOR_TO_BLOCK_VERSION[bgColor],
31
+ chat,
30
32
  ...rest
31
33
  }) => {
32
34
  const router = useRouter();
@@ -46,9 +48,11 @@ export const Header = JSX<HeaderProps>(
46
48
  return (
47
49
  <BlockWrapper
48
50
  tag="header"
49
- className={`pt-6 px-20 ${className} ${
50
- showSubMenu && activeTopItem?.items?.length ? 'pb-4' : 'pb-5'
51
- }`}
51
+ className={style(
52
+ 'pt-6 px-20',
53
+ showSubMenu && activeTopItem?.items?.length ? 'pb-4' : 'pb-5',
54
+ className,
55
+ )}
52
56
  version={version}
53
57
  {...rest}
54
58
  >
@@ -62,10 +66,14 @@ export const Header = JSX<HeaderProps>(
62
66
  foreignOffices={foreignOffices}
63
67
  defaultLocation={defaultLocation}
64
68
  officesLink={officesLink}
69
+ chat={chat}
65
70
  />
66
71
  </div>
67
72
  <div
68
- className={`mt-6 h-px bg-main-divider${version === 'transparent' ? ' opacity-30' : ''}`}
73
+ className={style(
74
+ 'mt-6 h-px bg-main-divider',
75
+ version === 'transparent' ? 'opacity-30' : '',
76
+ )}
69
77
  />
70
78
  {showSubMenu && activeTopItem?.items?.length ? (
71
79
  <HeaderSubMenu subItems={activeTopItem.items} />
@@ -0,0 +1,45 @@
1
+ import { JSX } from '@redneckz/uni-jsx';
2
+ import { useBool } from '../../hooks/useBool';
3
+ import type { IconVersion } from '../../model/IconVersion';
4
+ import { style } from '../../utils/style';
5
+ import type { ChatBot as ChatBotWithEmptyOption } from './HeaderContent';
6
+ import { HeaderSecondaryMenuButton } from './HeaderSecondaryMenuButton';
7
+ import { useChatBot } from './useChatBot';
8
+
9
+ export type ChatBot = Exclude<ChatBotWithEmptyOption, ''>;
10
+
11
+ interface HeaderChatBotButtonProps {
12
+ className?: string;
13
+ iconVersion?: IconVersion;
14
+ chat?: ChatBot;
15
+ onClick?: () => void;
16
+ }
17
+
18
+ const CHAT_BUTTON_EXTERNAL_NAME = 'text-page__btn-chat';
19
+
20
+ export const HeaderChatBotButton = JSX<HeaderChatBotButtonProps>((props) => {
21
+ const [loadRequested, { setTrue: load }] = useBool();
22
+
23
+ return loadRequested ? (
24
+ <HeaderChatBotButtonWithLoader {...props} />
25
+ ) : (
26
+ renderChatBotButton({ ...props, onClick: load })
27
+ );
28
+ });
29
+
30
+ const HeaderChatBotButtonWithLoader = JSX<HeaderChatBotButtonProps>(
31
+ ({ chat = 'personal', ...rest }) => {
32
+ useChatBot(chat);
33
+
34
+ return renderChatBotButton(rest);
35
+ },
36
+ );
37
+
38
+ const renderChatBotButton = ({ className, iconVersion, onClick }: HeaderChatBotButtonProps) => (
39
+ <HeaderSecondaryMenuButton
40
+ className={style(CHAT_BUTTON_EXTERNAL_NAME, className)}
41
+ image={{ icon: 'HeadphonesIcon', iconVersion }}
42
+ ariaLabel="Чат"
43
+ onClick={onClick}
44
+ />
45
+ );
@@ -7,6 +7,12 @@ import type { IconProps, Picture } from '../../model/Picture';
7
7
  */
8
8
  export type SubMenuItem = LinkProps & IconProps;
9
9
 
10
+ /**
11
+ * @title Чат-бот
12
+ * @enumNames ["", "Для физических лиц", "Для юридических лиц"]
13
+ */
14
+ export type ChatBot = '' | 'personal' | 'business';
15
+
10
16
  /**
11
17
  * @title Ссылка дополнительного меню
12
18
  * @required ["text", "href"]
@@ -28,11 +34,11 @@ export interface Logo {
28
34
 
29
35
  /**
30
36
  * @title Шапка (для мобильных горизонтальная прокрутка shift+mouseScroll)
31
- * @required ["defaultLocation", "topItems"]
32
37
  */
33
38
  export interface HeaderContent {
34
39
  /** @hidden */
35
40
  showSubMenu?: boolean;
36
41
  /** @hidden */
37
42
  bgColor?: BgColorVersion;
43
+ chat?: ChatBot;
38
44
  }
@@ -1,12 +1,14 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import { useCallback, useState } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { useBool } from '../../hooks/useBool';
3
3
  import { useLocation } from '../../hooks/useLocation';
4
4
  import type { BlockVersion } from '../../model/BlockVersion';
5
5
  import type { IconVersion } from '../../model/IconVersion';
6
6
  import type { ForeignOffice } from '../../services/sitemap/SitemapProps';
7
- import { Img } from '../../ui-kit/Img/Img';
8
7
  import { Location } from '../../ui-kit/Location/Location';
9
8
  import { TopItem } from '../../ui-kit/TopItem/TopItem';
9
+ import { style } from '../../utils/style';
10
+ import { HeaderChatBotButton } from './HeaderChatBotButton';
11
+ import type { ChatBot } from './HeaderContent';
10
12
  import { HeaderSecondaryMenuButton } from './HeaderSecondaryMenuButton';
11
13
 
12
14
  interface HeaderSecondaryMenuContent {
@@ -14,6 +16,7 @@ interface HeaderSecondaryMenuContent {
14
16
  defaultLocation?: string;
15
17
  officesLink?: string;
16
18
  foreignOffices?: ForeignOffice[];
19
+ chat?: ChatBot;
17
20
  }
18
21
 
19
22
  export interface HeaderSecondaryMenuProps extends HeaderSecondaryMenuContent {
@@ -21,22 +24,16 @@ export interface HeaderSecondaryMenuProps extends HeaderSecondaryMenuContent {
21
24
  }
22
25
 
23
26
  export const HeaderSecondaryMenu = JSX<HeaderSecondaryMenuProps>(
24
- ({ version, className, officesLink, defaultLocation = 'Москва', foreignOffices }) => {
25
- const [isShowLocationModal, setShowLocationModal] = useState<boolean>(false);
27
+ ({ version, className, officesLink, defaultLocation = 'Москва', foreignOffices, chat }) => {
28
+ const [isShowLocationModal, { setTrue: showLocationModal, setFalse: hideLocationModal }] =
29
+ useBool();
26
30
 
27
31
  const [location, onChangeLocation] = useLocation(defaultLocation);
28
32
 
29
- const showLocationModal = useCallback(() => {
30
- setShowLocationModal(true);
31
- }, []);
32
- const hideLocationModal = useCallback(() => {
33
- setShowLocationModal(false);
34
- }, []);
35
-
36
33
  const iconVersion: IconVersion = version === 'transparent' ? 'white' : 'black';
37
34
 
38
35
  return (
39
- <div className={`flex items-center ${className || ''}`}>
36
+ <div className={style('flex items-center', className)}>
40
37
  <TopItem
41
38
  className="mr-5"
42
39
  flat={true}
@@ -54,28 +51,21 @@ export const HeaderSecondaryMenu = JSX<HeaderSecondaryMenuProps>(
54
51
  ariaLabel="Список всех доступных офисов и банкоматов"
55
52
  />
56
53
  ) : null}
54
+ {chat ? (
55
+ <HeaderChatBotButton className="mr-5" iconVersion={iconVersion} chat={chat} />
56
+ ) : null}
57
57
  <HeaderSecondaryMenuButton
58
- className="mr-5 group/btn text-primary-text hover:text-primary-main group-data-transparent:text-white"
58
+ className="mr-5"
59
+ image={{ icon: 'LoupeIcon', iconVersion }}
59
60
  ariaLabel="Поиск по сайту"
60
- >
61
- <Img
62
- image={{ icon: 'LoupeIcon', iconVersion }}
63
- className="h-full pointer-events-none"
64
- imageClassName="group-hover/btn:text-primary-hover group-hover/btn:invert-0 pointer-events-none"
65
- asSVG
66
- />
67
- </HeaderSecondaryMenuButton>
61
+ disabled={true}
62
+ />
68
63
  <HeaderSecondaryMenuButton
69
- className="group/btn min-w-8 min-h-8 text-secondary-light hover:text-secondary-hover group-data-transparent:text-white"
64
+ image={{ icon: 'GridIcon', iconVersion }}
70
65
  ariaLabel="Дополнительные ссылки"
71
- >
72
- <Img
73
- image={{ icon: 'GridIcon', iconVersion }}
74
- className="h-full bg-main-divider/20 rounded-full pointer-events-none"
75
- imageClassName="group-hover/btn:text-primary-hover group-hover/btn:invert-0"
76
- asSVG
77
- />
78
- </HeaderSecondaryMenuButton>
66
+ isRounded={true}
67
+ disabled={true}
68
+ />
79
69
  {isShowLocationModal ? (
80
70
  <Location
81
71
  currentLocation={location}
@@ -1,19 +1,38 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
+ import { Img } from '../../ui-kit/Img/Img';
3
+ import type { ImageContent } from '../../ui-kit/Img/ImgProps';
4
+ import { style } from '../../utils/style';
2
5
 
3
- interface HeaderSecondaryMenuButtonProps {
6
+ export interface HeaderSecondaryMenuButtonProps extends ImageContent {
4
7
  className?: string;
8
+ isRounded?: boolean;
9
+ disabled?: boolean;
5
10
  ariaLabel?: string;
11
+ onClick?: (ev?: { preventDefault: () => void }) => void;
6
12
  }
7
13
 
8
14
  export const HeaderSecondaryMenuButton = JSX<HeaderSecondaryMenuButtonProps>(
9
- ({ className = '', children, ariaLabel }) => (
15
+ ({ className, isRounded, disabled, ariaLabel, image, onClick }) => (
10
16
  <button
17
+ className={style(
18
+ 'group/btn border-0 p-0 flex items-center bg-inherit',
19
+ isRounded
20
+ ? 'w-8 h-8 text-secondary-light hover:text-secondary-hove'
21
+ : 'w-6 h-6 text-primary-text hover:text-primary-main',
22
+ 'group-data-transparent:text-white',
23
+ className,
24
+ )}
11
25
  type="button"
12
- className={`border-0 p-0 w-6 h-6 flex items-center bg-inherit cursor-pointer ${className}`}
13
- disabled={true}
26
+ disabled={disabled}
14
27
  aria-label={ariaLabel}
28
+ onClick={onClick}
15
29
  >
16
- {children}
30
+ <Img
31
+ image={image}
32
+ className={style('h-full', isRounded ? 'bg-main-divider/20 rounded-full' : '')}
33
+ imageClassName="group-hover/btn:text-primary-hover group-hover/btn:invert-0"
34
+ asSVG
35
+ />
17
36
  </button>
18
37
  ),
19
38
  );
@@ -0,0 +1,16 @@
1
+ import { useEffect } from '@redneckz/uni-jsx/lib/hooks';
2
+ import { useExternalNS } from '../../hooks/useExternalNS';
3
+ import { ChatBot } from './HeaderChatBotButton';
4
+
5
+ const CHATBOT_NAMESPACE = 'chatbot';
6
+
7
+ const CHATBOT_URL: Record<ChatBot, string> = {
8
+ personal: '//chat.mes.rshb.ru/assets/js/webchat_rshb',
9
+ business: '', //TODO: add url business chat
10
+ };
11
+
12
+ export const useChatBot = (chat: ChatBot) => {
13
+ useEffect(() => globalThis.localStorage?.setItem('webchat-keep-open', String(Date.now())), []);
14
+
15
+ return useExternalNS(CHATBOT_NAMESPACE, CHATBOT_URL[chat]);
16
+ };
@@ -29,6 +29,14 @@ const imageInsurance: Picture = {
29
29
  ],
30
30
  };
31
31
 
32
+ const imageMonitor: Picture = {
33
+ src: 'monitor.png',
34
+ format: 'webp',
35
+ alt: 'Управление несколькими счетами',
36
+ size: {
37
+ width: 420,
38
+ },
39
+ };
32
40
  export const PICTURE_TEXT: PictureTextContent = {
33
41
  title: 'Обменивайте бонусы на путешествия',
34
42
  description:
@@ -36,11 +44,13 @@ export const PICTURE_TEXT: PictureTextContent = {
36
44
  'бонусные баллы на авиа и ж/д билеты, бронирование отелей и прокат автомобилей.',
37
45
  benefits: [
38
46
  {
47
+ type: 'default',
39
48
  label: 'Кредит по одному документу',
40
49
  description: 'До 300 тыс ₽ по упрощённой процедуре получения кредита',
41
50
  icon: { icon: 'DocumentTextIcon' },
42
51
  },
43
52
  {
53
+ type: 'default',
44
54
  label: 'Кредит на общих условиях',
45
55
  description: 'До 5 млн ₽ на общих условиях получения кредита',
46
56
  icon: { icon: 'DocumentTextIcon' },
@@ -54,19 +64,23 @@ export const INSURANCE_TEXT: PictureTextContent = {
54
64
  description: 'Покрываемые риски программы «Защита вас и ваших близких»',
55
65
  benefits: [
56
66
  {
67
+ type: 'default',
57
68
  label: 'Телесное повреждение',
58
69
  icon: { icon: 'ShieldTickIcon' },
59
70
  },
60
71
  {
72
+ type: 'default',
61
73
  label: 'Госпитализация застрахованного',
62
74
  description: 'Описание',
63
75
  icon: { icon: 'ShieldTickIcon' },
64
76
  },
65
77
  {
78
+ type: 'default',
66
79
  label: 'Сокращение численности работников организации и другой текст для теста длинны текста',
67
80
  icon: { icon: 'ShieldTickIcon' },
68
81
  },
69
82
  {
83
+ type: 'default',
70
84
  label: 'Смерть застрахованного',
71
85
  icon: { icon: 'ShieldTickIcon' },
72
86
  },
@@ -75,6 +89,24 @@ export const INSURANCE_TEXT: PictureTextContent = {
75
89
  sum: 500000,
76
90
  };
77
91
 
92
+ export const BENEFITS_HTML_TEXT: PictureTextContent = {
93
+ title: '',
94
+ benefits: [
95
+ {
96
+ type: 'rte',
97
+ __html:
98
+ '<p class="h3">Управление несколькими счетами</p><p>Контролируйте баланс, пересылайте реквизиты контрагентам и установите любимый счёт для регулярных платежей</p>',
99
+ },
100
+ {
101
+ type: 'rte',
102
+ __html:
103
+ '<p class="h3">Управление несколькими счетами</p><p>Контролируйте баланс, пересылайте реквизиты контрагентам и установите любимый счёт для регулярных платежей</p>',
104
+ },
105
+ ],
106
+
107
+ image: imageMonitor,
108
+ };
109
+
78
110
  export default {
79
111
  default: (
80
112
  <div className="container grid grid-cols-12">
@@ -96,4 +128,9 @@ export default {
96
128
  <PictureText className="col-span-12" {...INSURANCE_TEXT} monthLimit={25000} />
97
129
  </div>
98
130
  ),
131
+ 'benefits as html': (
132
+ <div className="container grid grid-cols-12">
133
+ <PictureText className="col-span-12" {...BENEFITS_HTML_TEXT} />
134
+ </div>
135
+ ),
99
136
  };
@@ -1,13 +1,11 @@
1
1
  import { JSX } from '@redneckz/uni-jsx';
2
- import type { BlockVersion } from '../../model/BlockVersion';
3
2
  import type { UniBlockProps } from '../../model/JSXBlock';
4
- import { BenefitItem } from '../../ui-kit/BenefitItem/BenefitItem';
5
- import type { BenefitItemProps } from '../../ui-kit/BenefitItem/BenefitItemProps';
6
3
  import { BlockWrapper } from '../../ui-kit/BlockWrapper';
7
4
  import { Img } from '../../ui-kit/Img/Img';
8
5
  import { addSpacesBetweenNumbers } from '../../utils/addSpacesBetweenNumbers';
9
6
  import { Headline } from '../Headline/Headline';
10
7
  import type { PictureTextContent } from './PictureTextContent';
8
+ import { renderBenefit } from './renderBenefit';
11
9
 
12
10
  export interface PictureTextProps extends PictureTextContent, UniBlockProps {}
13
11
 
@@ -39,17 +37,6 @@ export const PictureText = JSX<PictureTextProps>(
39
37
  ),
40
38
  );
41
39
 
42
- const renderBenefit = (version: BlockVersion) => (benefit: BenefitItemProps, i: number) =>
43
- (
44
- <BenefitItem
45
- key={String(i)}
46
- icon={benefit.icon}
47
- label={benefit.label}
48
- description={benefit.description}
49
- version={version}
50
- />
51
- );
52
-
53
40
  function renderInsuranceSumMonth(sum?: number, monthLimit?: number) {
54
41
  return sum || monthLimit ? (
55
42
  <div className="bg-main-divider rounded-md flex mt-7 gap-6 px-5 py-4">
@@ -5,6 +5,16 @@
5
5
  },
6
6
  "monthLimit": {
7
7
  "ui:field": "number"
8
+ },
9
+ "benefits": {
10
+ "items": {
11
+ "__html": {
12
+ "ui:widget": "html"
13
+ },
14
+ "type": {
15
+ "ui:widget": "hidden"
16
+ }
17
+ }
8
18
  }
9
19
  }
10
20
  }
@@ -0,0 +1,33 @@
1
+ import { BlockVersion } from '../../model/BlockVersion';
2
+ import { BenefitItem } from '../../ui-kit/BenefitItem/BenefitItem';
3
+ import type { ComplexBenefitProps } from '../../ui-kit/BenefitItem/BenefitItemProps';
4
+ import { RichText } from '../../ui-kit/RichText/RichText';
5
+ import { assertUnreachable } from '../../utils/assertUnreachable';
6
+
7
+ export const renderBenefit =
8
+ // Linter doesn't understand that switch processes all cases
9
+ // eslint-disable-next-line consistent-return
10
+ (version: BlockVersion) => (benefit: ComplexBenefitProps, i: number) => {
11
+ const { type } = benefit;
12
+
13
+ if (!(type === 'default' || type === 'rte')) {
14
+ return null;
15
+ }
16
+
17
+ switch (type) {
18
+ case 'default':
19
+ return (
20
+ <BenefitItem
21
+ key={String(i)}
22
+ icon={benefit.icon}
23
+ label={benefit.label}
24
+ description={benefit.description}
25
+ version={version}
26
+ />
27
+ );
28
+ case 'rte':
29
+ return <RichText __html={benefit.__html} />;
30
+ default:
31
+ assertUnreachable(benefit);
32
+ }
33
+ };
@@ -29,7 +29,11 @@ export const renderBenefit =
29
29
  </Text>,
30
30
  ];
31
31
  case 'rte':
32
- return <RichText __html={benefit.__html} />;
32
+ return (
33
+ <div className="col-span-2">
34
+ <RichText __html={benefit.__html} />
35
+ </div>
36
+ );
33
37
  default:
34
38
  assertUnreachable(benefit);
35
39
  }
@@ -0,0 +1,19 @@
1
+ import { useCallback, useState } from '@redneckz/uni-jsx/lib/hooks';
2
+
3
+ export function useBool(defaultValue = false): [
4
+ boolean,
5
+ {
6
+ setValue: (_: boolean) => void;
7
+ setTrue: () => void;
8
+ setFalse: () => void;
9
+ toggle: () => void;
10
+ },
11
+ ] {
12
+ const [value, setValue] = useState<boolean>(defaultValue);
13
+
14
+ const setTrue = useCallback(() => setValue(true), []);
15
+ const setFalse = useCallback(() => setValue(false), []);
16
+ const toggle = useCallback(() => setValue((_) => !_), []);
17
+
18
+ return [value, { setValue, setTrue, setFalse, toggle }];
19
+ }
@@ -0,0 +1,5 @@
1
+ <svg xmlns="http://www.w3.org/2000/svg" name="Наушники" fill="none" viewBox="0 0 24 23">
2
+ <path fill="currentColor" fill-rule="evenodd"
3
+ d="M2.002 19.612a3.025 3.025 0 0 1-2-2.965V13.48a2.948 2.948 0 0 1 1.53-2.561v-.272C1.504 5.437 5.237.98 10.334.14c5.098-.841 10.044 2.182 11.664 7.128.124.34.058.718-.17.995a.997.997 0 0 1-1.71-.299 8.484 8.484 0 0 0-3.999-4.85 8.505 8.505 0 0 0-8.417.215 8.657 8.657 0 0 0-4.17 7.378v1.009c0 .557-.448 1.008-1 1.008-.17 0-.5.393-.5.767v3.267c0 .557.447 1.008 1 1.008.552 0 1-.451 1-1.008v-2.26c0-.556.447-1.007 1-1.007.551 0 .999.45.999 1.008v2.259c.004.99-.472 1.92-1.276 2.488a2.978 2.978 0 0 1-2.753.366Zm19.876.222a3.022 3.022 0 0 0 2.12-2.885v-2.924a3.025 3.025 0 0 0-2-2.965 2.978 2.978 0 0 0-2.74.388 3.034 3.034 0 0 0-1.259 2.486v2.017c0 .557.448 1.008 1 1.008s1-.451 1-1.008v-2.017c0-.557.447-1.008 1-1.008.552 0 1 .451 1 1.008v3.025c0 .557-.448 1.009-1 1.009a.996.996 0 0 0-.73.316c-.189.203-.287.475-.27.753a2.008 2.008 0 0 1-2 1.956h-4v-.716c0-.557-.447-1.008-1-1.008-.551 0-.999.451-.999 1.008v1.715c0 .556.448 1.008 1 1.008h4.999a4.007 4.007 0 0 0 3.91-3.166h-.03Z"
4
+ clip-rule="evenodd" />
5
+ </svg>