@blaze-cms/react-page-builder 0.124.0-alpha.9 → 0.124.0

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 (279) hide show
  1. package/CHANGELOG.md +303 -0
  2. package/README.md +8 -0
  3. package/lib/application/query/index.js +8 -2
  4. package/lib/application/query/index.js.map +1 -1
  5. package/lib/components/Button.js +18 -5
  6. package/lib/components/Button.js.map +1 -1
  7. package/lib/components/Card/CardContainer.js +3 -7
  8. package/lib/components/Card/CardContainer.js.map +1 -1
  9. package/lib/components/Card/CardFactory.js +6 -3
  10. package/lib/components/Card/CardFactory.js.map +1 -1
  11. package/lib/components/CarouselWrapper.js +2 -2
  12. package/lib/components/CarouselWrapper.js.map +1 -1
  13. package/lib/components/Image/ImageRender.js +5 -1
  14. package/lib/components/Image/ImageRender.js.map +1 -1
  15. package/lib/components/ItemList/ItemListButton/ItemListButton.js +161 -0
  16. package/lib/components/ItemList/ItemListButton/ItemListButton.js.map +1 -0
  17. package/lib/components/ItemList/ItemListButton/index.js +16 -0
  18. package/lib/components/ItemList/ItemListButton/index.js.map +1 -0
  19. package/lib/components/ItemList/ItemListCounter/ItemListCounter.js +83 -0
  20. package/lib/components/ItemList/ItemListCounter/ItemListCounter.js.map +1 -0
  21. package/lib/components/ItemList/ItemListCounter/index.js +16 -0
  22. package/lib/components/ItemList/ItemListCounter/index.js.map +1 -0
  23. package/lib/components/ItemList/ItemListNew/ItemListNew.js +87 -0
  24. package/lib/components/ItemList/ItemListNew/ItemListNew.js.map +1 -0
  25. package/lib/components/ItemList/ItemListNew/index.js +16 -0
  26. package/lib/components/ItemList/ItemListNew/index.js.map +1 -0
  27. package/lib/components/ItemList/constants.js +19 -0
  28. package/lib/components/ItemList/constants.js.map +1 -0
  29. package/lib/components/ItemList/helpers/get-item-list-data.js +17 -0
  30. package/lib/components/ItemList/helpers/get-item-list-data.js.map +1 -0
  31. package/lib/components/ItemList/helpers/get-item-list-id.js +23 -0
  32. package/lib/components/ItemList/helpers/get-item-list-id.js.map +1 -0
  33. package/lib/components/ItemList/helpers/get-item-list-ids.js +28 -0
  34. package/lib/components/ItemList/helpers/get-item-list-ids.js.map +1 -0
  35. package/lib/components/ItemList/helpers/index.js +50 -0
  36. package/lib/components/ItemList/helpers/index.js.map +1 -0
  37. package/lib/components/ItemList/helpers/set-item-list-id.js +22 -0
  38. package/lib/components/ItemList/helpers/set-item-list-id.js.map +1 -0
  39. package/lib/components/ItemList/helpers/set-param-and-redirect.js +51 -0
  40. package/lib/components/ItemList/helpers/set-param-and-redirect.js.map +1 -0
  41. package/lib/components/ItemList/hooks/index.js +18 -0
  42. package/lib/components/ItemList/hooks/index.js.map +1 -0
  43. package/lib/components/ItemList/hooks/use-item-list-id.js +45 -0
  44. package/lib/components/ItemList/hooks/use-item-list-id.js.map +1 -0
  45. package/lib/components/LazyImage/LazyImage.js +5 -1
  46. package/lib/components/LazyImage/LazyImage.js.map +1 -1
  47. package/lib/components/List/ListBuilder.js +12 -6
  48. package/lib/components/List/ListBuilder.js.map +1 -1
  49. package/lib/components/List/ListFactory.js +34 -7
  50. package/lib/components/List/ListFactory.js.map +1 -1
  51. package/lib/components/List/helpers/has-required-item-list-details.js +29 -0
  52. package/lib/components/List/helpers/has-required-item-list-details.js.map +1 -0
  53. package/lib/components/List/helpers/index.js +8 -0
  54. package/lib/components/List/helpers/index.js.map +1 -1
  55. package/lib/components/Menu/Menu.js +41 -28
  56. package/lib/components/Menu/Menu.js.map +1 -1
  57. package/lib/components/Menu/MenuContext.js +20 -0
  58. package/lib/components/Menu/MenuContext.js.map +1 -0
  59. package/lib/components/MenuItem/MenuItem.js +26 -7
  60. package/lib/components/MenuItem/MenuItem.js.map +1 -1
  61. package/lib/components/SearchContent/SearchContent.js +183 -0
  62. package/lib/components/SearchContent/SearchContent.js.map +1 -0
  63. package/lib/components/SearchContent/SearchContentItems.js +51 -0
  64. package/lib/components/SearchContent/SearchContentItems.js.map +1 -0
  65. package/lib/components/SearchContent/SearchContentResults.js +45 -0
  66. package/lib/components/SearchContent/SearchContentResults.js.map +1 -0
  67. package/lib/components/SearchContent/SearchContentToggleIcon.js +42 -0
  68. package/lib/components/SearchContent/SearchContentToggleIcon.js.map +1 -0
  69. package/lib/components/SearchContent/index.js +2 -301
  70. package/lib/components/SearchContent/index.js.map +1 -1
  71. package/lib/components/SearchFilter/SearchFilter/FiltersList.js +2 -4
  72. package/lib/components/SearchFilter/SearchFilter/FiltersList.js.map +1 -1
  73. package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +16 -66
  74. package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
  75. package/lib/components/SearchFilter/SearchFilterContainer.js +87 -23
  76. package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
  77. package/lib/components/SearchFilter/components/Checkbox.js +19 -9
  78. package/lib/components/SearchFilter/components/Checkbox.js.map +1 -1
  79. package/lib/components/SearchFilter/components/Select.js +27 -11
  80. package/lib/components/SearchFilter/components/Select.js.map +1 -1
  81. package/lib/components/SearchFilter/components/TextSearch.js +1 -5
  82. package/lib/components/SearchFilter/components/TextSearch.js.map +1 -1
  83. package/lib/components/SearchFilter/helpers/build-filters-query.js +87 -0
  84. package/lib/components/SearchFilter/helpers/build-filters-query.js.map +1 -0
  85. package/lib/components/SearchFilter/helpers/build-query.js +1 -1
  86. package/lib/components/SearchFilter/helpers/build-query.js.map +1 -1
  87. package/lib/components/SearchFilter/helpers/build-raw-query-stringified.js +2 -1
  88. package/lib/components/SearchFilter/helpers/build-raw-query-stringified.js.map +1 -1
  89. package/lib/components/SearchFilter/helpers/get-initial-filter-values.js +18 -3
  90. package/lib/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -1
  91. package/lib/components/SearchFilter/helpers/index.js +8 -0
  92. package/lib/components/SearchFilter/helpers/index.js.map +1 -1
  93. package/lib/components/SearchFilter/helpers/parse-filter-value.js +3 -7
  94. package/lib/components/SearchFilter/helpers/parse-filter-value.js.map +1 -1
  95. package/lib/components/index.js +16 -1
  96. package/lib/components/index.js.map +1 -1
  97. package/lib/constants/index.js +3 -1
  98. package/lib/constants/index.js.map +1 -1
  99. package/lib/helpers/build-raw-query.js.map +1 -1
  100. package/lib/hooks/helpers/append-gtm-classname.js +1 -0
  101. package/lib/hooks/helpers/append-gtm-classname.js.map +1 -1
  102. package/lib-es/application/query/index.js +45 -1
  103. package/lib-es/application/query/index.js.map +1 -1
  104. package/lib-es/components/Button.js +18 -6
  105. package/lib-es/components/Button.js.map +1 -1
  106. package/lib-es/components/Card/CardContainer.js +3 -7
  107. package/lib-es/components/Card/CardContainer.js.map +1 -1
  108. package/lib-es/components/Card/CardFactory.js +7 -4
  109. package/lib-es/components/Card/CardFactory.js.map +1 -1
  110. package/lib-es/components/CarouselWrapper.js +2 -2
  111. package/lib-es/components/CarouselWrapper.js.map +1 -1
  112. package/lib-es/components/Image/ImageRender.js +4 -1
  113. package/lib-es/components/Image/ImageRender.js.map +1 -1
  114. package/lib-es/components/ItemList/ItemListButton/ItemListButton.js +111 -0
  115. package/lib-es/components/ItemList/ItemListButton/ItemListButton.js.map +1 -0
  116. package/lib-es/components/ItemList/ItemListButton/index.js +3 -0
  117. package/lib-es/components/ItemList/ItemListButton/index.js.map +1 -0
  118. package/lib-es/components/ItemList/ItemListCounter/ItemListCounter.js +60 -0
  119. package/lib-es/components/ItemList/ItemListCounter/ItemListCounter.js.map +1 -0
  120. package/lib-es/components/ItemList/ItemListCounter/index.js +3 -0
  121. package/lib-es/components/ItemList/ItemListCounter/index.js.map +1 -0
  122. package/lib-es/components/ItemList/ItemListNew/ItemListNew.js +64 -0
  123. package/lib-es/components/ItemList/ItemListNew/ItemListNew.js.map +1 -0
  124. package/lib-es/components/ItemList/ItemListNew/index.js +3 -0
  125. package/lib-es/components/ItemList/ItemListNew/index.js.map +1 -0
  126. package/lib-es/components/ItemList/constants.js +6 -0
  127. package/lib-es/components/ItemList/constants.js.map +1 -0
  128. package/lib-es/components/ItemList/helpers/get-item-list-data.js +7 -0
  129. package/lib-es/components/ItemList/helpers/get-item-list-data.js.map +1 -0
  130. package/lib-es/components/ItemList/helpers/get-item-list-id.js +11 -0
  131. package/lib-es/components/ItemList/helpers/get-item-list-id.js.map +1 -0
  132. package/lib-es/components/ItemList/helpers/get-item-list-ids.js +13 -0
  133. package/lib-es/components/ItemList/helpers/get-item-list-ids.js.map +1 -0
  134. package/lib-es/components/ItemList/helpers/index.js +6 -0
  135. package/lib-es/components/ItemList/helpers/index.js.map +1 -0
  136. package/lib-es/components/ItemList/helpers/set-item-list-id.js +10 -0
  137. package/lib-es/components/ItemList/helpers/set-item-list-id.js.map +1 -0
  138. package/lib-es/components/ItemList/helpers/set-param-and-redirect.js +20 -0
  139. package/lib-es/components/ItemList/helpers/set-param-and-redirect.js.map +1 -0
  140. package/lib-es/components/ItemList/hooks/index.js +2 -0
  141. package/lib-es/components/ItemList/hooks/index.js.map +1 -0
  142. package/lib-es/components/ItemList/hooks/use-item-list-id.js +26 -0
  143. package/lib-es/components/ItemList/hooks/use-item-list-id.js.map +1 -0
  144. package/lib-es/components/LazyImage/LazyImage.js +4 -1
  145. package/lib-es/components/LazyImage/LazyImage.js.map +1 -1
  146. package/lib-es/components/List/ListBuilder.js +12 -6
  147. package/lib-es/components/List/ListBuilder.js.map +1 -1
  148. package/lib-es/components/List/ListFactory.js +33 -9
  149. package/lib-es/components/List/ListFactory.js.map +1 -1
  150. package/lib-es/components/List/helpers/has-required-item-list-details.js +20 -0
  151. package/lib-es/components/List/helpers/has-required-item-list-details.js.map +1 -0
  152. package/lib-es/components/List/helpers/index.js +1 -0
  153. package/lib-es/components/List/helpers/index.js.map +1 -1
  154. package/lib-es/components/Menu/Menu.js +54 -46
  155. package/lib-es/components/Menu/Menu.js.map +1 -1
  156. package/lib-es/components/Menu/MenuContext.js +6 -0
  157. package/lib-es/components/Menu/MenuContext.js.map +1 -0
  158. package/lib-es/components/MenuItem/MenuItem.js +24 -9
  159. package/lib-es/components/MenuItem/MenuItem.js.map +1 -1
  160. package/lib-es/components/SearchContent/SearchContent.js +129 -0
  161. package/lib-es/components/SearchContent/SearchContent.js.map +1 -0
  162. package/lib-es/components/SearchContent/SearchContentItems.js +33 -0
  163. package/lib-es/components/SearchContent/SearchContentItems.js.map +1 -0
  164. package/lib-es/components/SearchContent/SearchContentResults.js +31 -0
  165. package/lib-es/components/SearchContent/SearchContentResults.js.map +1 -0
  166. package/lib-es/components/SearchContent/SearchContentToggleIcon.js +30 -0
  167. package/lib-es/components/SearchContent/SearchContentToggleIcon.js.map +1 -0
  168. package/lib-es/components/SearchContent/index.js +1 -205
  169. package/lib-es/components/SearchContent/index.js.map +1 -1
  170. package/lib-es/components/SearchFilter/SearchFilter/FiltersList.js +2 -4
  171. package/lib-es/components/SearchFilter/SearchFilter/FiltersList.js.map +1 -1
  172. package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js +10 -43
  173. package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
  174. package/lib-es/components/SearchFilter/SearchFilterContainer.js +70 -15
  175. package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
  176. package/lib-es/components/SearchFilter/components/Checkbox.js +18 -9
  177. package/lib-es/components/SearchFilter/components/Checkbox.js.map +1 -1
  178. package/lib-es/components/SearchFilter/components/Select.js +23 -8
  179. package/lib-es/components/SearchFilter/components/Select.js.map +1 -1
  180. package/lib-es/components/SearchFilter/components/TextSearch.js +1 -5
  181. package/lib-es/components/SearchFilter/components/TextSearch.js.map +1 -1
  182. package/lib-es/components/SearchFilter/helpers/build-filters-query.js +54 -0
  183. package/lib-es/components/SearchFilter/helpers/build-filters-query.js.map +1 -0
  184. package/lib-es/components/SearchFilter/helpers/build-query.js +1 -1
  185. package/lib-es/components/SearchFilter/helpers/build-query.js.map +1 -1
  186. package/lib-es/components/SearchFilter/helpers/build-raw-query-stringified.js +2 -1
  187. package/lib-es/components/SearchFilter/helpers/build-raw-query-stringified.js.map +1 -1
  188. package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js +13 -1
  189. package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -1
  190. package/lib-es/components/SearchFilter/helpers/index.js +2 -1
  191. package/lib-es/components/SearchFilter/helpers/index.js.map +1 -1
  192. package/lib-es/components/SearchFilter/helpers/parse-filter-value.js +3 -3
  193. package/lib-es/components/SearchFilter/helpers/parse-filter-value.js.map +1 -1
  194. package/lib-es/components/index.js +10 -1
  195. package/lib-es/components/index.js.map +1 -1
  196. package/lib-es/constants/index.js +2 -1
  197. package/lib-es/constants/index.js.map +1 -1
  198. package/lib-es/helpers/build-raw-query.js.map +1 -1
  199. package/lib-es/hooks/helpers/append-gtm-classname.js +1 -0
  200. package/lib-es/hooks/helpers/append-gtm-classname.js.map +1 -1
  201. package/package.json +5 -4
  202. package/src/application/query/index.js +51 -1
  203. package/src/components/Button.js +27 -5
  204. package/src/components/Card/CardContainer.js +2 -6
  205. package/src/components/Card/CardFactory.js +5 -3
  206. package/src/components/CarouselWrapper.js +2 -2
  207. package/src/components/Image/ImageRender.js +3 -0
  208. package/src/components/ItemList/ItemListButton/ItemListButton.js +94 -0
  209. package/src/components/ItemList/ItemListButton/index.js +3 -0
  210. package/src/components/ItemList/ItemListCounter/ItemListCounter.js +52 -0
  211. package/src/components/ItemList/ItemListCounter/index.js +3 -0
  212. package/src/components/ItemList/ItemListNew/ItemListNew.js +51 -0
  213. package/src/components/ItemList/ItemListNew/index.js +3 -0
  214. package/src/components/ItemList/constants.js +5 -0
  215. package/src/components/ItemList/helpers/get-item-list-data.js +6 -0
  216. package/src/components/ItemList/helpers/get-item-list-id.js +11 -0
  217. package/src/components/ItemList/helpers/get-item-list-ids.js +10 -0
  218. package/src/components/ItemList/helpers/index.js +5 -0
  219. package/src/components/ItemList/helpers/set-item-list-id.js +9 -0
  220. package/src/components/ItemList/helpers/set-param-and-redirect.js +20 -0
  221. package/src/components/ItemList/hooks/index.js +1 -0
  222. package/src/components/ItemList/hooks/use-item-list-id.js +27 -0
  223. package/src/components/LazyImage/LazyImage.js +11 -1
  224. package/src/components/List/ListBuilder.js +10 -5
  225. package/src/components/List/ListFactory.js +48 -12
  226. package/src/components/List/helpers/has-required-item-list-details.js +14 -0
  227. package/src/components/List/helpers/index.js +1 -0
  228. package/src/components/Menu/Menu.js +61 -54
  229. package/src/components/Menu/MenuContext.js +5 -0
  230. package/src/components/MenuItem/MenuItem.js +39 -14
  231. package/src/components/SearchContent/SearchContent.js +136 -0
  232. package/src/components/SearchContent/SearchContentItems.js +28 -0
  233. package/src/components/SearchContent/SearchContentResults.js +27 -0
  234. package/src/components/SearchContent/SearchContentToggleIcon.js +27 -0
  235. package/src/components/SearchContent/index.js +1 -217
  236. package/src/components/SearchFilter/SearchFilter/FiltersList.js +30 -37
  237. package/src/components/SearchFilter/SearchFilter/SearchFilter.js +10 -25
  238. package/src/components/SearchFilter/SearchFilterContainer.js +61 -16
  239. package/src/components/SearchFilter/components/Checkbox.js +23 -8
  240. package/src/components/SearchFilter/components/Select.js +18 -11
  241. package/src/components/SearchFilter/components/TextSearch.js +1 -3
  242. package/src/components/SearchFilter/helpers/build-filters-query.js +40 -0
  243. package/src/components/SearchFilter/helpers/build-query.js +3 -1
  244. package/src/components/SearchFilter/helpers/build-raw-query-stringified.js +2 -1
  245. package/src/components/SearchFilter/helpers/get-initial-filter-values.js +12 -1
  246. package/src/components/SearchFilter/helpers/index.js +3 -1
  247. package/src/components/SearchFilter/helpers/parse-filter-value.js +3 -3
  248. package/src/components/index.js +10 -1
  249. package/src/constants/index.js +2 -0
  250. package/src/helpers/build-raw-query.js +1 -0
  251. package/src/hooks/helpers/append-gtm-classname.js +3 -0
  252. package/tests/unit/src/components/Button.test.js +55 -1
  253. package/tests/unit/src/components/ItemList/ItemListButton.test.js +175 -0
  254. package/tests/unit/src/components/ItemList/ItemListCounter.test.js +65 -0
  255. package/tests/unit/src/components/ItemList/ItemListNew.test.js +164 -0
  256. package/tests/unit/src/components/ItemList/__snapshots__/ItemListButton.test.js.snap +107 -0
  257. package/tests/unit/src/components/ItemList/__snapshots__/ItemListCounter.test.js.snap +31 -0
  258. package/tests/unit/src/components/ItemList/__snapshots__/ItemListNew.test.js.snap +27 -0
  259. package/tests/unit/src/components/ItemList/helpers/get-item-list-data.test.js +28 -0
  260. package/tests/unit/src/components/ItemList/helpers/get-item-list-id.test.js +20 -0
  261. package/tests/unit/src/components/ItemList/helpers/get-item-list-ids.test.js +19 -0
  262. package/tests/unit/src/components/ItemList/helpers/set-item-list-id.test.js +13 -0
  263. package/tests/unit/src/components/ItemList/helpers/set-param-and-redirect.test.js +30 -0
  264. package/tests/unit/src/components/ItemList/hooks/use-item-list-id.test.js +32 -0
  265. package/tests/unit/src/components/List/helpers/has-required-item-list-details.test.js +30 -0
  266. package/tests/unit/src/components/Menu/Menu.test.js +9 -3
  267. package/tests/unit/src/components/Menu/__snapshots__/Menu.test.js.snap +12 -11
  268. package/tests/unit/src/components/MenuItem/MenuItem.test.js +1 -1
  269. package/tests/unit/src/components/MenuItem/SubMenu.test.js +5 -1
  270. package/tests/unit/src/components/MenuItem/__snapshots__/MenuItem.test.js.snap +54 -10
  271. package/tests/unit/src/components/SearchContent/SearchContent.test.js +29 -0
  272. package/tests/unit/src/components/SearchContent/__snapshots__/SearchContent.test.js.snap +9 -0
  273. package/tests/unit/src/components/SearchFilter/SearchFilter/SearchFilter.test.js +3 -6
  274. package/tests/unit/src/components/SearchFilter/components/__snapshots__/Checkbox.test.js.snap +2 -0
  275. package/tests/unit/src/components/SearchFilter/components/__snapshots__/Select.test.js.snap +4 -0
  276. package/tests/unit/src/components/SearchFilter/helpers/build-query.test.js +2 -2
  277. package/tests/unit/src/components/SearchFilter/helpers/get-initial-filter-values.test.js +25 -11
  278. package/tests/unit/src/components/SearchFilter/helpers/parse-filter-value.test.js +1 -1
  279. package/tests/unit/src/components/__snapshots__/index.test.js.snap +12 -0
@@ -1,10 +1,11 @@
1
1
  import React, { useState, Fragment } from 'react';
2
2
  import { useCookies } from 'react-cookie';
3
3
  import { useRouter } from 'next/router';
4
+ import classnames from 'classnames';
4
5
  import BlazeButton from '@blaze-react/button';
5
6
  import { handleLogout } from '@blaze-cms/core-auth-ui';
6
7
  import { useApolloClient } from '@apollo/client';
7
- import PropTypes from 'prop-types';
8
+ import PropTypes, { bool, string } from 'prop-types';
8
9
  import ClickWrapper from './ClickWrapper';
9
10
  import BlazeLink from './BlazeLink';
10
11
  import { withTitle } from '../HOC';
@@ -18,7 +19,19 @@ import {
18
19
  } from '../helpers';
19
20
 
20
21
  const Button = props => {
21
- const { type, text, url, icon, name, style, children, clickAction, ...otherProps } = props;
22
+ const {
23
+ type,
24
+ text,
25
+ url,
26
+ icon,
27
+ name,
28
+ style,
29
+ children,
30
+ clickAction,
31
+ childSeoVisibility,
32
+ afterClickText,
33
+ ...otherProps
34
+ } = props;
22
35
  const client = useApolloClient();
23
36
  const router = useRouter();
24
37
  const isLogoutButton = clickAction === LOGOUT;
@@ -54,13 +67,18 @@ const Button = props => {
54
67
  const { shouldUseClickWrapper, wrapperProps } = getClickWrapperOptions(children, props);
55
68
  const Wrapper = shouldUseClickWrapper ? ClickWrapper : Fragment;
56
69
 
70
+ const contentClassName = classnames('button__content', {
71
+ 'button__content--show': showChildren
72
+ });
73
+
57
74
  return (
58
75
  <Wrapper {...wrapperProps}>
76
+ {childSeoVisibility && <div className={contentClassName}>{renderedChildren}</div>}
77
+ {!childSeoVisibility && showChildren && renderedChildren}
59
78
  <DynamicButton className={modifiers} onClick={handleClick} {...currentProps}>
60
79
  {icon && <i className={icon} />}
61
- {text}
80
+ {showChildren ? afterClickText : text}
62
81
  </DynamicButton>
63
- {showChildren && renderedChildren}
64
82
  </Wrapper>
65
83
  );
66
84
  };
@@ -68,25 +86,29 @@ const Button = props => {
68
86
  Button.propTypes = {
69
87
  clickAction: PropTypes.string,
70
88
  text: PropTypes.string,
89
+ afterClickText: string,
71
90
  name: PropTypes.string,
72
91
  type: PropTypes.string,
73
92
  url: PropTypes.string,
74
93
  size: PropTypes.string,
75
94
  icon: PropTypes.string,
76
95
  style: PropTypes.string,
96
+ childSeoVisibility: bool,
77
97
  children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])
78
98
  };
79
99
 
80
100
  Button.defaultProps = {
81
101
  clickAction: '',
82
102
  text: '',
103
+ afterClickText: '',
83
104
  name: '',
84
105
  type: '',
85
106
  url: null,
86
107
  size: '',
87
108
  icon: '',
88
109
  style: '',
89
- children: []
110
+ children: [],
111
+ childSeoVisibility: false
90
112
  };
91
113
 
92
114
  export default withTitle(Button);
@@ -31,7 +31,6 @@ const CardContainer = ({
31
31
  enableAutoScroll,
32
32
  enableOverlay,
33
33
  autoScrollTimer,
34
- arrowSize,
35
34
  overlayModifier,
36
35
  titleOverlayModifier,
37
36
  ...cardProps
@@ -88,7 +87,6 @@ const CardContainer = ({
88
87
  displayThumbnail={displayThumbnail}
89
88
  displayTitle={displayTitle}
90
89
  priority={priority}
91
- arrowSize={arrowSize}
92
90
  enableOverlay={enableOverlay}
93
91
  overlayModifier={overlayModifier}
94
92
  titleOverlayModifier={titleOverlayModifier}
@@ -122,8 +120,7 @@ CardContainer.propTypes = {
122
120
  enableOverlay: PropTypes.bool,
123
121
  overlayModifier: PropTypes.string,
124
122
  titleOverlayModifier: PropTypes.string,
125
- autoScrollTimer: PropTypes.number,
126
- arrowSize: PropTypes.string
123
+ autoScrollTimer: PropTypes.number
127
124
  };
128
125
 
129
126
  CardContainer.defaultProps = {
@@ -146,8 +143,7 @@ CardContainer.defaultProps = {
146
143
  enableOverlay: false,
147
144
  autoScrollTimer: 0,
148
145
  overlayModifier: '',
149
- titleOverlayModifier: '',
150
- arrowSize: ''
146
+ titleOverlayModifier: ''
151
147
  };
152
148
 
153
149
  export default withTitle(CardContainer);
@@ -6,7 +6,7 @@ import CardRender from './CardRender';
6
6
  import { buildPropsQuery, getGenericProps, checkPropsToUse } from '../../helpers';
7
7
  import { WITH_BANNER } from '../../constants';
8
8
 
9
- const CardFactory = ({ entity, propsToDisplay, itemsToDisplay, ...cardProps }) => {
9
+ const CardFactory = ({ entity, propsToDisplay, itemsToDisplay, itemListName, ...cardProps }) => {
10
10
  const { data, error, loading } = useQuery(getSingleEntitySchema, {
11
11
  variables: { id: entity }
12
12
  });
@@ -36,12 +36,14 @@ const CardFactory = ({ entity, propsToDisplay, itemsToDisplay, ...cardProps }) =
36
36
  CardFactory.propTypes = {
37
37
  entity: PropTypes.string.isRequired,
38
38
  propsToDisplay: PropTypes.array,
39
- itemsToDisplay: PropTypes.array
39
+ itemsToDisplay: PropTypes.array,
40
+ itemListName: PropTypes.string
40
41
  };
41
42
 
42
43
  CardFactory.defaultProps = {
43
44
  propsToDisplay: [],
44
- itemsToDisplay: []
45
+ itemsToDisplay: [],
46
+ itemListName: ''
45
47
  };
46
48
 
47
49
  export default CardFactory;
@@ -80,7 +80,7 @@ const CarouselWrapper = ({
80
80
  setShouldAutoScroll(false);
81
81
  handleButtonNavigation();
82
82
  }}>
83
- <i className="carousel--arrow-left" />
83
+ <i className="cards-carousel--arrow cards-carousel--arrow__left" />
84
84
  </button>
85
85
  )}
86
86
  </div>
@@ -93,7 +93,7 @@ const CarouselWrapper = ({
93
93
  setShouldAutoScroll(false);
94
94
  handleButtonNavigation(true);
95
95
  }}>
96
- <i className="carousel--arrow-left" />
96
+ <i className="cards-carousel--arrow cards-carousel--arrow__right" />
97
97
  </button>
98
98
  )}
99
99
  </div>
@@ -1,5 +1,6 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
+ import Head from 'next/head';
3
4
  import { ResponsiveImage } from '@blaze-cms/image-cdn-react';
4
5
  import Lightbox from './Lightbox';
5
6
 
@@ -22,6 +23,7 @@ const ImageRender = ({
22
23
  ...otherProps
23
24
  }) => {
24
25
  const imageStyle = enableLightbox ? { cursor: 'pointer' } : style;
26
+ const HeadComponent = priority ? Head : null;
25
27
 
26
28
  return (
27
29
  <>
@@ -31,6 +33,7 @@ const ImageRender = ({
31
33
  src={imageUrl}
32
34
  onClick={handleEnableLightbox}
33
35
  style={imageStyle}
36
+ HeadComponent={HeadComponent}
34
37
  />
35
38
  {displayLightbox && (
36
39
  <Lightbox
@@ -0,0 +1,94 @@
1
+ import React, { useState } from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import {
4
+ BsBookmarkStarFill,
5
+ BsBookmarkCheckFill,
6
+ BsBookmarkStar,
7
+ BsBookmarkXFill
8
+ } from 'react-icons/bs';
9
+ import { useQuery, useMutation } from '@apollo/client';
10
+ import { getItemList, addItemsToList, removeItemsFromList } from '../../../application/query';
11
+ import { getItemListData, setItemListId } from '../helpers';
12
+ import { useItemListId } from '../hooks';
13
+
14
+ const ItemListButton = ({ listName, parent, modifier }) => {
15
+ const { itemId, itemEntity } = parent;
16
+ const [isHover, setIsHover] = useState(false);
17
+ const { listId } = useItemListId({ listName });
18
+
19
+ const getIcon = () => {
20
+ if (isInList) return isHover ? BsBookmarkXFill : BsBookmarkCheckFill;
21
+ return isHover ? BsBookmarkStarFill : BsBookmarkStar;
22
+ };
23
+
24
+ const { data, error, loading } = useQuery(getItemList, {
25
+ variables: { id: listId },
26
+ skip: !listId
27
+ });
28
+
29
+ const [addListItem] = useMutation(addItemsToList, {
30
+ onCompleted: ({ addItemsToList: listAddResult }) => {
31
+ const {
32
+ result: { id }
33
+ } = listAddResult;
34
+
35
+ if (!listId) {
36
+ setItemListId(listName, id);
37
+ }
38
+ }
39
+ });
40
+
41
+ const [removeListItem] = useMutation(removeItemsFromList);
42
+
43
+ const clickHandler = () => {
44
+ setIsHover(false);
45
+ isInList
46
+ ? removeListItem({
47
+ variables: { listId, listItems: [{ itemId, itemEntity }] },
48
+ skip: !listId
49
+ })
50
+ : addListItem({
51
+ variables: { name: listName, id: listId, listItems: [{ itemId, itemEntity }] },
52
+ skip: !listId
53
+ });
54
+ };
55
+
56
+ if (loading) return '';
57
+ if (error) return error.message;
58
+
59
+ const listItems = getItemListData(data);
60
+ const isInList = !!listItems.find(
61
+ ({ itemId: idToCheck, itemEntity: entityToCheck }) =>
62
+ idToCheck === itemId && entityToCheck === itemEntity
63
+ );
64
+ const Icon = getIcon();
65
+ const stateClassName = isInList ? 'item-list-button--selected' : '';
66
+ const className = ['item-list-button', stateClassName, modifier].filter(Boolean).join(' ');
67
+
68
+ return (
69
+ <div
70
+ className={className}
71
+ role="button"
72
+ onClick={clickHandler}
73
+ onMouseEnter={() => setIsHover(true)}
74
+ onMouseLeave={() => setIsHover(false)}>
75
+ <i>
76
+ <Icon />
77
+ </i>
78
+ </div>
79
+ );
80
+ };
81
+
82
+ ItemListButton.propTypes = {
83
+ parent: PropTypes.object,
84
+ listName: PropTypes.string,
85
+ modifier: PropTypes.string
86
+ };
87
+
88
+ ItemListButton.defaultProps = {
89
+ parent: {},
90
+ listName: '',
91
+ modifier: ''
92
+ };
93
+
94
+ export default ItemListButton;
@@ -0,0 +1,3 @@
1
+ import ItemListButton from './ItemListButton';
2
+
3
+ export default ItemListButton;
@@ -0,0 +1,52 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { useRouter } from 'next/router';
4
+ import { useQuery } from '@apollo/client';
5
+ import { BsBookmarkStarFill, BsBookmarkStar } from 'react-icons/bs';
6
+ import { getItemList } from '../../../application/query';
7
+ import { useItemListId } from '../hooks';
8
+ import { getItemListData } from '../helpers';
9
+
10
+ const ItemListCounter = ({ listName, modifier, url }) => {
11
+ const router = useRouter();
12
+ const { listId } = useItemListId({ listName });
13
+
14
+ const { data, error, loading } = useQuery(getItemList, {
15
+ variables: { id: listId },
16
+ skip: !listId
17
+ });
18
+
19
+ if (loading) return '';
20
+ if (error) return error.message;
21
+
22
+ const listItems = getItemListData(data);
23
+ const listLength = listItems.length;
24
+ const CounterIcon = listLength ? BsBookmarkStarFill : BsBookmarkStar;
25
+
26
+ const handleClick = () => router.push('/Resolver', `${url}?itemListId=${listId}`);
27
+
28
+ return (
29
+ <div
30
+ role="button"
31
+ type="button"
32
+ className={`item-list-counter ${modifier}`}
33
+ onClick={handleClick}>
34
+ <CounterIcon />
35
+ <span className="item-list-counter__badge">{listLength}</span>
36
+ </div>
37
+ );
38
+ };
39
+
40
+ ItemListCounter.propTypes = {
41
+ url: PropTypes.string,
42
+ listName: PropTypes.string,
43
+ modifier: PropTypes.string
44
+ };
45
+
46
+ ItemListCounter.defaultProps = {
47
+ url: '',
48
+ listName: '',
49
+ modifier: ''
50
+ };
51
+
52
+ export default ItemListCounter;
@@ -0,0 +1,3 @@
1
+ import ItemListCounter from './ItemListCounter';
2
+
3
+ export default ItemListCounter;
@@ -0,0 +1,51 @@
1
+ import React from 'react';
2
+ import PropTypes from 'prop-types';
3
+ import { useRouter } from 'next/router';
4
+ import { useQuery } from '@apollo/client';
5
+ import BlazeButton from '@blaze-react/button';
6
+ import { parseUrl } from 'query-string';
7
+ import { getItemList } from '../../../application/query';
8
+ import { useItemListId } from '../hooks';
9
+ import { getItemListData, setItemListId, setParamAndRedirect } from '../helpers';
10
+ import { LIST_ITEM_QUERY_PARAM } from '../constants';
11
+
12
+ const ItemListNew = ({ listName, modifier, text }) => {
13
+ const router = useRouter();
14
+ const { query: { [LIST_ITEM_QUERY_PARAM]: listItemId } = {} } = parseUrl(router.asPath);
15
+
16
+ const { listId } = useItemListId({ listName });
17
+ const listIdToUse = listItemId || listId;
18
+ const { data, error, loading } = useQuery(getItemList, {
19
+ variables: { id: listIdToUse },
20
+ skip: !listIdToUse
21
+ });
22
+
23
+ if (loading) return '';
24
+ if (error) return error.message;
25
+
26
+ const listItems = getItemListData(data);
27
+ if (!listItems.length) return '';
28
+
29
+ const handleClick = () => {
30
+ setItemListId(listName, '');
31
+ setParamAndRedirect(router);
32
+ };
33
+
34
+ return (
35
+ <BlazeButton className={`item-list-new ${modifier}`} onClick={handleClick}>
36
+ {text}
37
+ </BlazeButton>
38
+ );
39
+ };
40
+
41
+ ItemListNew.propTypes = {
42
+ listName: PropTypes.string.isRequired,
43
+ modifier: PropTypes.string,
44
+ text: PropTypes.string.isRequired
45
+ };
46
+
47
+ ItemListNew.defaultProps = {
48
+ modifier: ''
49
+ };
50
+
51
+ export default ItemListNew;
@@ -0,0 +1,3 @@
1
+ import ItemListNew from './ItemListNew';
2
+
3
+ export default ItemListNew;
@@ -0,0 +1,5 @@
1
+ export const ITEM_LIST_BUTTON = 'itemlistbutton';
2
+ export const ITEM_LIST_COUNTER = 'itemlistcounter';
3
+ export const ITEM_LIST_NEW = 'itemlistnew';
4
+ export const LIST_ITEM_LOCAL_KEY = 'blaze_item_list_';
5
+ export const LIST_ITEM_QUERY_PARAM = 'itemListId';
@@ -0,0 +1,6 @@
1
+ const getItemListData = data => {
2
+ if (data && data.getItemList && data.getItemList.listItems) return data.getItemList.listItems;
3
+ return [];
4
+ };
5
+
6
+ export default getItemListData;
@@ -0,0 +1,11 @@
1
+ import { LIST_ITEM_LOCAL_KEY } from '../constants';
2
+
3
+ const getItemListId = (listName, queryId) => {
4
+ if (queryId) return queryId;
5
+ if (!listName || typeof localStorage === 'undefined') return '';
6
+
7
+ const localListName = `${LIST_ITEM_LOCAL_KEY}${listName}`;
8
+ return localStorage.getItem(localListName) || '';
9
+ };
10
+
11
+ export default getItemListId;
@@ -0,0 +1,10 @@
1
+ import getItemListData from './get-item-list-data';
2
+
3
+ const getItemListIds = data => {
4
+ const itemListElements = getItemListData(data);
5
+ return itemListElements.length
6
+ ? itemListElements.map(({ itemId }) => ({ displayItems: [itemId] }))
7
+ : null;
8
+ };
9
+
10
+ export default getItemListIds;
@@ -0,0 +1,5 @@
1
+ export { default as getItemListId } from './get-item-list-id';
2
+ export { default as getItemListIds } from './get-item-list-ids';
3
+ export { default as getItemListData } from './get-item-list-data';
4
+ export { default as setItemListId } from './set-item-list-id';
5
+ export { default as setParamAndRedirect } from './set-param-and-redirect';
@@ -0,0 +1,9 @@
1
+ import { LIST_ITEM_LOCAL_KEY } from '../constants';
2
+
3
+ const setItemListId = (listName, id) => {
4
+ const localListName = `${LIST_ITEM_LOCAL_KEY}${listName}`;
5
+ localStorage.setItem(localListName, id);
6
+ window.dispatchEvent(new Event('storage'));
7
+ };
8
+
9
+ export default setItemListId;
@@ -0,0 +1,20 @@
1
+ import { LIST_ITEM_QUERY_PARAM } from '../constants';
2
+
3
+ const placeholderBase = 'https://blazecms.app'; // placeholder for URL, removed later
4
+
5
+ const setParamAndRedirect = (router, value) => {
6
+ const currentUrl = new URL(router.asPath, placeholderBase);
7
+ if (value) {
8
+ currentUrl.searchParams.set(LIST_ITEM_QUERY_PARAM, value);
9
+ } else if (!currentUrl.searchParams.get(LIST_ITEM_QUERY_PARAM)) return;
10
+ else {
11
+ currentUrl.searchParams.delete(LIST_ITEM_QUERY_PARAM);
12
+ }
13
+
14
+ const newUrl = currentUrl.toString().replace(placeholderBase, '');
15
+ router.push('/Resolver', newUrl, {
16
+ shallow: true
17
+ });
18
+ };
19
+
20
+ export default setParamAndRedirect;
@@ -0,0 +1 @@
1
+ export { default as useItemListId } from './use-item-list-id';
@@ -0,0 +1,27 @@
1
+ import { useState, useEffect } from 'react';
2
+ import { getItemListId } from '../helpers';
3
+
4
+ const useItemListId = ({ listName }) => {
5
+ const idFromStorage = getItemListId(listName);
6
+ const [listId, setListId] = useState(idFromStorage);
7
+
8
+ useEffect(
9
+ () => {
10
+ const storageEventHandler = () => {
11
+ const newId = getItemListId(listName);
12
+ setListId(newId);
13
+ };
14
+
15
+ window.addEventListener('storage', storageEventHandler);
16
+
17
+ return () => {
18
+ window.removeEventListener('storage', storageEventHandler);
19
+ };
20
+ },
21
+ [listName]
22
+ );
23
+
24
+ return { listId };
25
+ };
26
+
27
+ export default useItemListId;
@@ -1,16 +1,26 @@
1
1
  import React from 'react';
2
2
  import PropTypes from 'prop-types';
3
3
  import { ResponsiveImage } from '@blaze-cms/image-cdn-react';
4
+ import Head from 'next/head';
4
5
  import { useInView } from '@blaze-react/utils/lib/customHooks';
5
6
  import { IN_VIEW_CONFIG } from '../../constants';
6
7
 
7
8
  const LazyImage = ({ src, alt, sizeKey, priority, ...props }) => {
8
9
  const [isIntersecting, outerRef] = useInView(IN_VIEW_CONFIG);
9
10
  const shouldRender = priority || isIntersecting;
11
+ const HeadComponent = priority ? Head : null;
10
12
 
11
13
  return (
12
14
  <span ref={outerRef}>
13
- {shouldRender && <ResponsiveImage src={src} alt={alt} sizeKey={sizeKey} {...props} />}
15
+ {shouldRender && (
16
+ <ResponsiveImage
17
+ src={src}
18
+ alt={alt}
19
+ sizeKey={sizeKey}
20
+ HeadComponent={HeadComponent}
21
+ {...props}
22
+ />
23
+ )}
14
24
  </span>
15
25
  );
16
26
  };
@@ -52,13 +52,15 @@ const ListBuilder = props => {
52
52
  requiredSchema,
53
53
  searchValues,
54
54
  azFilter,
55
- sortProperties
55
+ sortProperties,
56
+ itemListIds
56
57
  } = props;
57
58
  const isInfinite = paginationType === INFINITE;
58
59
  const listComponent = getListComponent(isCard, paginationType);
59
60
  const propsToDisplayValues = checkPropsToUse(propsToDisplay);
60
61
  const entityFields = buildPropsQuery(entitySchema, propsToDisplayValues, props) || '';
61
- const limitToUse = limit || itemsToDisplay.length;
62
+ const itemsToDisplayToUse = itemListIds || itemsToDisplay;
63
+ const limitToUse = limit || itemsToDisplayToUse.length;
62
64
  const shouldApplyDefaultSort = !sortProperties || !sortProperties.length;
63
65
  const itemsPerPageToUse = getItemsPerPageToUse(itemsPerPage, limitToUse);
64
66
  const initialOffset = getCurrentOffset(offset, itemsPerPageToUse, paginationIndex, limitToUse);
@@ -94,7 +96,7 @@ const ListBuilder = props => {
94
96
  stringProps
95
97
  },
96
98
  itemId,
97
- itemsToDisplay,
99
+ itemsToDisplayToUse,
98
100
  shouldApplyDefaultSort,
99
101
  { shouldReturnAggs: true, isAZ }
100
102
  );
@@ -137,7 +139,7 @@ const ListBuilder = props => {
137
139
  azFilter
138
140
  },
139
141
  itemId,
140
- itemsToDisplay,
142
+ itemsToDisplayToUse,
141
143
  shouldApplyDefaultSort,
142
144
  { shouldReturnAggs: false, isAZ }
143
145
  );
@@ -172,6 +174,7 @@ const ListBuilder = props => {
172
174
  isAZ={isAZ}
173
175
  azFilter={azFilter}
174
176
  {...props}
177
+ itemsToDisplay={itemsToDisplayToUse}
175
178
  />
176
179
  );
177
180
  };
@@ -202,12 +205,14 @@ ListBuilder.propTypes = {
202
205
  filterOperator: PropTypes.string.isRequired,
203
206
  paginationType: PropTypes.string,
204
207
  azFilter: PropTypes.string,
205
- sortProperties: PropTypes.array
208
+ sortProperties: PropTypes.array,
209
+ itemListIds: PropTypes.array
206
210
  };
207
211
 
208
212
  ListBuilder.defaultProps = {
209
213
  entityData: {},
210
214
  itemsToDisplay: [],
215
+ itemListIds: null,
211
216
  limit: 0,
212
217
  omitWrappers: false,
213
218
  offset: 0,