@blaze-cms/react-page-builder 0.131.1 → 0.132.0-admin-updates.1

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 (231) hide show
  1. package/CHANGELOG.md +101 -2
  2. package/lib/components/Button.js +2 -1
  3. package/lib/components/Button.js.map +1 -1
  4. package/lib/components/Card/CardsRender.js +13 -6
  5. package/lib/components/Card/CardsRender.js.map +1 -1
  6. package/lib/components/Card/helpers/get-updated-items-to-display.js +55 -0
  7. package/lib/components/Card/helpers/get-updated-items-to-display.js.map +1 -0
  8. package/lib/components/Card/helpers/index.js +7 -0
  9. package/lib/components/Card/helpers/index.js.map +1 -1
  10. package/lib/components/CarouselWrapper/SmoothScrollCarousel.js +2 -2
  11. package/lib/components/CarouselWrapper/SmoothScrollCarousel.js.map +1 -1
  12. package/lib/components/Code/Code.js +7 -3
  13. package/lib/components/Code/Code.js.map +1 -1
  14. package/lib/components/DataSummary/helpers/build-loop-props-content.js +6 -3
  15. package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
  16. package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js +3 -2
  17. package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
  18. package/lib/components/DataSummary/helpers/get-link-to-published-content.js +2 -0
  19. package/lib/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
  20. package/lib/components/List/ListFactory.js +16 -11
  21. package/lib/components/List/ListFactory.js.map +1 -1
  22. package/lib/components/List/helpers/get-list-query.js +43 -0
  23. package/lib/components/List/helpers/get-list-query.js.map +1 -0
  24. package/lib/components/List/helpers/get-list-specific-search-filter.js +21 -0
  25. package/lib/components/List/helpers/get-list-specific-search-filter.js.map +1 -0
  26. package/lib/components/List/helpers/index.js +14 -0
  27. package/lib/components/List/helpers/index.js.map +1 -1
  28. package/lib/components/List/helpers/strip-query-key.js +14 -0
  29. package/lib/components/List/helpers/strip-query-key.js.map +1 -0
  30. package/lib/components/SearchContent/SearchContent.js +8 -8
  31. package/lib/components/SearchContent/SearchContent.js.map +1 -1
  32. package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +17 -13
  33. package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
  34. package/lib/components/SearchFilter/SearchFilterContainer.js +64 -83
  35. package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
  36. package/lib/components/SearchFilter/helpers/build-filters-query.js +3 -1
  37. package/lib/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
  38. package/lib/components/SearchFilter/helpers/build-new-url.js +17 -0
  39. package/lib/components/SearchFilter/helpers/build-new-url.js.map +1 -0
  40. package/lib/components/SearchFilter/helpers/build-url-query.js +49 -0
  41. package/lib/components/SearchFilter/helpers/build-url-query.js.map +1 -0
  42. package/lib/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +32 -0
  43. package/lib/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js.map +1 -0
  44. package/lib/components/SearchFilter/helpers/get-filter-values.js +31 -0
  45. package/lib/components/SearchFilter/helpers/get-filter-values.js.map +1 -0
  46. package/lib/components/SearchFilter/helpers/index.js +18 -11
  47. package/lib/components/SearchFilter/helpers/index.js.map +1 -1
  48. package/lib/components/SearchFilter/index.js.map +1 -1
  49. package/lib/components/SearchFilter/searchFilterReducer.js +43 -0
  50. package/lib/components/SearchFilter/searchFilterReducer.js.map +1 -0
  51. package/lib/components/SearchFilterSort/SearchFilterSort.js +31 -11
  52. package/lib/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
  53. package/lib/components/SearchFilterSort/helpers/handle-sort-update.js +19 -5
  54. package/lib/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
  55. package/lib/components/SearchFilterSort/helpers/update-sort.js +9 -5
  56. package/lib/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
  57. package/lib/helpers/build-inherited-filters.js +2 -0
  58. package/lib/helpers/build-inherited-filters.js.map +1 -1
  59. package/lib/helpers/build-props-query.js +5 -2
  60. package/lib/helpers/build-props-query.js.map +1 -1
  61. package/lib/helpers/build-query-key.js +16 -0
  62. package/lib/helpers/build-query-key.js.map +1 -0
  63. package/lib/helpers/build-set-filters.js +5 -1
  64. package/lib/helpers/build-set-filters.js.map +1 -1
  65. package/lib/helpers/get-entities-with-banner.js +8 -2
  66. package/lib/helpers/get-entities-with-banner.js.map +1 -1
  67. package/lib/helpers/get-query-filters.js +6 -8
  68. package/lib/helpers/get-query-filters.js.map +1 -1
  69. package/lib/helpers/get-query-props.js +13 -2
  70. package/lib/helpers/get-query-props.js.map +1 -1
  71. package/lib/helpers/get-wrapped-value-with-link.js +2 -3
  72. package/lib/helpers/get-wrapped-value-with-link.js.map +1 -1
  73. package/lib/helpers/index.js +14 -0
  74. package/lib/helpers/index.js.map +1 -1
  75. package/lib/helpers/parse-props-to-display.js +13 -8
  76. package/lib/helpers/parse-props-to-display.js.map +1 -1
  77. package/lib/helpers/process-data-summary-value.js +56 -0
  78. package/lib/helpers/process-data-summary-value.js.map +1 -0
  79. package/lib-es/components/Button.js +2 -1
  80. package/lib-es/components/Button.js.map +1 -1
  81. package/lib-es/components/Card/CardsRender.js +14 -7
  82. package/lib-es/components/Card/CardsRender.js.map +1 -1
  83. package/lib-es/components/Card/helpers/get-updated-items-to-display.js +32 -0
  84. package/lib-es/components/Card/helpers/get-updated-items-to-display.js.map +1 -0
  85. package/lib-es/components/Card/helpers/index.js +1 -0
  86. package/lib-es/components/Card/helpers/index.js.map +1 -1
  87. package/lib-es/components/CarouselWrapper/SmoothScrollCarousel.js +2 -2
  88. package/lib-es/components/CarouselWrapper/SmoothScrollCarousel.js.map +1 -1
  89. package/lib-es/components/Code/Code.js +8 -4
  90. package/lib-es/components/Code/Code.js.map +1 -1
  91. package/lib-es/components/DataSummary/helpers/build-loop-props-content.js +6 -3
  92. package/lib-es/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
  93. package/lib-es/components/DataSummary/helpers/build-props-to-display-with-content.js +4 -3
  94. package/lib-es/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
  95. package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js +2 -1
  96. package/lib-es/components/DataSummary/helpers/get-link-to-published-content.js.map +1 -1
  97. package/lib-es/components/List/ListFactory.js +16 -12
  98. package/lib-es/components/List/ListFactory.js.map +1 -1
  99. package/lib-es/components/List/helpers/get-list-query.js +24 -0
  100. package/lib-es/components/List/helpers/get-list-query.js.map +1 -0
  101. package/lib-es/components/List/helpers/get-list-specific-search-filter.js +12 -0
  102. package/lib-es/components/List/helpers/get-list-specific-search-filter.js.map +1 -0
  103. package/lib-es/components/List/helpers/index.js +2 -0
  104. package/lib-es/components/List/helpers/index.js.map +1 -1
  105. package/lib-es/components/List/helpers/strip-query-key.js +6 -0
  106. package/lib-es/components/List/helpers/strip-query-key.js.map +1 -0
  107. package/lib-es/components/SearchContent/SearchContent.js +8 -8
  108. package/lib-es/components/SearchContent/SearchContent.js.map +1 -1
  109. package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js +18 -13
  110. package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
  111. package/lib-es/components/SearchFilter/SearchFilterContainer.js +48 -70
  112. package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
  113. package/lib-es/components/SearchFilter/helpers/build-filters-query.js +2 -0
  114. package/lib-es/components/SearchFilter/helpers/build-filters-query.js.map +1 -1
  115. package/lib-es/components/SearchFilter/helpers/build-new-url.js +8 -0
  116. package/lib-es/components/SearchFilter/helpers/build-new-url.js.map +1 -0
  117. package/lib-es/components/SearchFilter/helpers/build-url-query.js +31 -0
  118. package/lib-es/components/SearchFilter/helpers/build-url-query.js.map +1 -0
  119. package/lib-es/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +18 -0
  120. package/lib-es/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js.map +1 -0
  121. package/lib-es/components/SearchFilter/helpers/get-filter-values.js +19 -0
  122. package/lib-es/components/SearchFilter/helpers/get-filter-values.js.map +1 -0
  123. package/lib-es/components/SearchFilter/helpers/index.js +5 -4
  124. package/lib-es/components/SearchFilter/helpers/index.js.map +1 -1
  125. package/lib-es/components/SearchFilter/index.js +2 -2
  126. package/lib-es/components/SearchFilter/index.js.map +1 -1
  127. package/lib-es/components/SearchFilter/searchFilterReducer.js +26 -0
  128. package/lib-es/components/SearchFilter/searchFilterReducer.js.map +1 -0
  129. package/lib-es/components/SearchFilterSort/SearchFilterSort.js +26 -10
  130. package/lib-es/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
  131. package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js +21 -4
  132. package/lib-es/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
  133. package/lib-es/components/SearchFilterSort/helpers/update-sort.js +8 -4
  134. package/lib-es/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
  135. package/lib-es/helpers/build-inherited-filters.js +2 -0
  136. package/lib-es/helpers/build-inherited-filters.js.map +1 -1
  137. package/lib-es/helpers/build-props-query.js +4 -2
  138. package/lib-es/helpers/build-props-query.js.map +1 -1
  139. package/lib-es/helpers/build-query-key.js +7 -0
  140. package/lib-es/helpers/build-query-key.js.map +1 -0
  141. package/lib-es/helpers/build-set-filters.js +5 -1
  142. package/lib-es/helpers/build-set-filters.js.map +1 -1
  143. package/lib-es/helpers/get-entities-with-banner.js +9 -2
  144. package/lib-es/helpers/get-entities-with-banner.js.map +1 -1
  145. package/lib-es/helpers/get-query-filters.js +6 -8
  146. package/lib-es/helpers/get-query-filters.js.map +1 -1
  147. package/lib-es/helpers/get-query-props.js +10 -2
  148. package/lib-es/helpers/get-query-props.js.map +1 -1
  149. package/lib-es/helpers/get-wrapped-value-with-link.js +2 -2
  150. package/lib-es/helpers/get-wrapped-value-with-link.js.map +1 -1
  151. package/lib-es/helpers/index.js +2 -0
  152. package/lib-es/helpers/index.js.map +1 -1
  153. package/lib-es/helpers/parse-props-to-display.js +12 -9
  154. package/lib-es/helpers/parse-props-to-display.js.map +1 -1
  155. package/lib-es/helpers/process-data-summary-value.js +36 -0
  156. package/lib-es/helpers/process-data-summary-value.js.map +1 -0
  157. package/package.json +10 -10
  158. package/src/components/Button.js +2 -1
  159. package/src/components/Card/CardsRender.js +27 -7
  160. package/src/components/Card/helpers/get-updated-items-to-display.js +32 -0
  161. package/src/components/Card/helpers/index.js +1 -0
  162. package/src/components/CarouselWrapper/SmoothScrollCarousel.js +2 -2
  163. package/src/components/Code/Code.js +7 -3
  164. package/src/components/DataSummary/helpers/build-loop-props-content.js +7 -3
  165. package/src/components/DataSummary/helpers/build-props-to-display-with-content.js +6 -3
  166. package/src/components/DataSummary/helpers/get-link-to-published-content.js +4 -1
  167. package/src/components/List/ListFactory.js +25 -15
  168. package/src/components/List/helpers/get-list-query.js +28 -0
  169. package/src/components/List/helpers/get-list-specific-search-filter.js +10 -0
  170. package/src/components/List/helpers/index.js +2 -0
  171. package/src/components/List/helpers/strip-query-key.js +6 -0
  172. package/src/components/SearchContent/SearchContent.js +8 -8
  173. package/src/components/SearchFilter/SearchFilter/SearchFilter.js +21 -18
  174. package/src/components/SearchFilter/SearchFilterContainer.js +59 -67
  175. package/src/components/SearchFilter/helpers/build-filters-query.js +9 -1
  176. package/src/components/SearchFilter/helpers/build-new-url.js +8 -0
  177. package/src/components/SearchFilter/helpers/build-url-query.js +33 -0
  178. package/src/components/SearchFilter/helpers/get-filter-ranges-and-checkboxes-values.js +17 -0
  179. package/src/components/SearchFilter/helpers/get-filter-values.js +21 -0
  180. package/src/components/SearchFilter/helpers/index.js +9 -7
  181. package/src/components/SearchFilter/index.js +2 -2
  182. package/src/components/SearchFilter/searchFilterReducer.js +15 -0
  183. package/src/components/SearchFilterSort/SearchFilterSort.js +18 -8
  184. package/src/components/SearchFilterSort/helpers/handle-sort-update.js +14 -5
  185. package/src/components/SearchFilterSort/helpers/update-sort.js +7 -3
  186. package/src/helpers/build-inherited-filters.js +3 -1
  187. package/src/helpers/build-props-query.js +4 -2
  188. package/src/helpers/build-query-key.js +7 -0
  189. package/src/helpers/build-set-filters.js +2 -1
  190. package/src/helpers/get-entities-with-banner.js +3 -2
  191. package/src/helpers/get-query-filters.js +4 -4
  192. package/src/helpers/get-query-props.js +12 -4
  193. package/src/helpers/get-wrapped-value-with-link.js +6 -3
  194. package/src/helpers/index.js +2 -0
  195. package/src/helpers/parse-props-to-display.js +25 -21
  196. package/src/helpers/process-data-summary-value.js +22 -0
  197. package/tests/helpers/mocks.js +3 -5
  198. package/tests/unit/src/components/Card/helpers/get-updated-items-to-display.test.js +72 -0
  199. package/tests/unit/src/components/Code/Code.test.js +5 -0
  200. package/tests/unit/src/components/Code/__snapshots__/Code.test.js.snap +8 -0
  201. package/tests/unit/src/components/DataSummary/helpers/build-loop-props-content.test.js +50 -0
  202. package/tests/unit/src/components/DataSummary/helpers/get-link-to-published-content.test.js +21 -0
  203. package/tests/unit/src/components/PlaceholderIcon/__snapshots__/index.test.js.snap +72 -0
  204. package/tests/unit/src/components/PlaceholderIcon/index.test.js +20 -0
  205. package/tests/unit/src/components/SearchFilter/__snapshots__/SearchFilterContainer.test.js.snap +1 -7
  206. package/tests/unit/src/components/SearchFilter/helpers/build-new-query.test.js +10 -10
  207. package/tests/unit/src/components/SearchFilter/helpers/build-query.test.js +24 -7
  208. package/tests/unit/src/components/SearchFilter/helpers/get-initial-filter-values.test.js +10 -10
  209. package/tests/unit/src/components/SearchFilterSort/SearchFilterSort.test.js +4 -1
  210. package/tests/unit/src/components/SearchFilterSort/helpers/handle-sort-update.test.js +26 -19
  211. package/tests/unit/src/components/SearchFilterSort/helpers/update-sort.test.js +10 -1
  212. package/tests/unit/src/helpers/__snapshots__/get-wrapped-value-with-link.test.js.snap +18 -0
  213. package/tests/unit/src/helpers/build-props-query.test.js +25 -0
  214. package/tests/unit/src/helpers/get-wrapped-value-with-link.test.js +2 -2
  215. package/tests/unit/src/helpers/parse-props-to-display.test.js +4 -0
  216. package/tests/unit/src/helpers/prcoess-data-summary-value.test.js +52 -0
  217. package/lib/components/SearchFilter/helpers/build-new-query.js +0 -15
  218. package/lib/components/SearchFilter/helpers/build-new-query.js.map +0 -1
  219. package/lib/components/SearchFilter/helpers/build-query.js +0 -37
  220. package/lib/components/SearchFilter/helpers/build-query.js.map +0 -1
  221. package/lib/components/SearchFilter/helpers/get-initial-filter-values.js +0 -43
  222. package/lib/components/SearchFilter/helpers/get-initial-filter-values.js.map +0 -1
  223. package/lib-es/components/SearchFilter/helpers/build-new-query.js +0 -6
  224. package/lib-es/components/SearchFilter/helpers/build-new-query.js.map +0 -1
  225. package/lib-es/components/SearchFilter/helpers/build-query.js +0 -23
  226. package/lib-es/components/SearchFilter/helpers/build-query.js.map +0 -1
  227. package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js +0 -26
  228. package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js.map +0 -1
  229. package/src/components/SearchFilter/helpers/build-new-query.js +0 -6
  230. package/src/components/SearchFilter/helpers/build-query.js +0 -26
  231. package/src/components/SearchFilter/helpers/get-initial-filter-values.js +0 -30
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","names":["React","useState","Fragment","useEffect","useCookies","useRouter","classnames","BlazeButton","handleLogout","useApolloClient","PropTypes","bool","string","useStringTemplate","ClickWrapper","BlazeLink","withTitle","getClassModifiers","LOGOUT","renderChildren","updateChildrensParent","hasChildren","getClickWrapperOptions","Button","props","type","text","url","icon","name","style","children","clickAction","childSeoVisibility","afterClickText","parent","otherProps","_objectWithoutProperties","_excluded","client","router","isLogoutButton","cookies","blaze_auth","blazeCookie","showChildren","setShowChildren","data","textToUse","afterClickTextToUse","urlToUse","asPath","checkIfButtonShouldRender","logout","reload","handleClick","buttonType","modifiers","_objectSpread","currentProps","href","title","DynamicButton","itemId","itemEntity","renderedChildren","onClose","shouldUseClickWrapper","wrapperProps","Wrapper","contentClassName","createElement","className","_extends","onClick","propTypes","object","size","oneOfType","arrayOf","node","defaultProps"],"sources":["../../src/components/Button.js"],"sourcesContent":["import React, { useState, Fragment, useEffect } from 'react';\nimport { useCookies } from 'react-cookie';\nimport { useRouter } from 'next/router';\nimport classnames from 'classnames';\nimport BlazeButton from '@blaze-react/button';\nimport { handleLogout } from '@blaze-cms/core-auth-ui';\nimport { useApolloClient } from '@apollo/client';\nimport PropTypes, { bool, string } from 'prop-types';\nimport { useStringTemplate } from '@blaze-cms/utils-handlebars';\nimport ClickWrapper from './ClickWrapper';\nimport BlazeLink from './BlazeLink';\nimport { withTitle } from '../HOC';\nimport { getClassModifiers } from '../utils';\nimport { LOGOUT } from '../constants';\nimport {\n renderChildren,\n updateChildrensParent,\n hasChildren,\n getClickWrapperOptions\n} from '../helpers';\n\nconst Button = props => {\n const {\n type,\n text,\n url,\n icon,\n name,\n style,\n children,\n clickAction,\n childSeoVisibility,\n afterClickText,\n parent,\n ...otherProps\n } = props;\n const client = useApolloClient();\n const router = useRouter();\n const isLogoutButton = clickAction === LOGOUT;\n const [cookies] = useCookies();\n const { blaze_auth: blazeCookie } = cookies;\n const [showChildren, setShowChildren] = useState(false);\n const {\n data: [textToUse, afterClickTextToUse, urlToUse]\n } = useStringTemplate(parent, [text, afterClickText, url]);\n\n useEffect(\n () => {\n setShowChildren(false);\n },\n [router.asPath]\n );\n\n const checkIfButtonShouldRender = () => {\n if (isLogoutButton) return !!blazeCookie;\n if (!text && !icon) return false;\n return !!(url || hasChildren(children));\n };\n\n const logout = () => {\n handleLogout(client);\n url ? router.reload(urlToUse) : router.reload();\n };\n\n const handleClick = () => {\n if (isLogoutButton) logout();\n if (!url && !isLogoutButton) setShowChildren(!showChildren);\n };\n\n if (!checkIfButtonShouldRender()) return null;\n\n const buttonType = !text && icon ? 'icon' : type;\n const modifiers = getClassModifiers(buttonType, { icon, style, ...otherProps });\n const currentProps = url ? { href: urlToUse, title: name } : { name };\n const DynamicButton = url && !isLogoutButton ? BlazeLink : BlazeButton;\n updateChildrensParent(children, parent.itemId, parent.itemEntity);\n\n const renderedChildren = renderChildren(children, { onClose: handleClick });\n const { shouldUseClickWrapper, wrapperProps } = getClickWrapperOptions(children, props);\n const Wrapper = shouldUseClickWrapper ? ClickWrapper : Fragment;\n\n const contentClassName = classnames('button__content', {\n 'button__content--show': showChildren\n });\n\n return (\n <Wrapper {...wrapperProps}>\n {childSeoVisibility && <div className={contentClassName}>{renderedChildren}</div>}\n {!childSeoVisibility && showChildren && renderedChildren}\n <DynamicButton className={modifiers} onClick={handleClick} {...currentProps}>\n {icon && <i className={icon} />}\n {showChildren ? afterClickTextToUse : textToUse}\n </DynamicButton>\n </Wrapper>\n );\n};\n\nButton.propTypes = {\n parent: PropTypes.object,\n clickAction: PropTypes.string,\n text: PropTypes.string,\n afterClickText: string,\n name: PropTypes.string,\n type: PropTypes.string,\n url: PropTypes.string,\n size: PropTypes.string,\n icon: PropTypes.string,\n style: PropTypes.string,\n childSeoVisibility: bool,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])\n};\n\nButton.defaultProps = {\n parent: {},\n clickAction: '',\n text: '',\n afterClickText: '',\n name: '',\n type: '',\n url: null,\n size: '',\n icon: '',\n style: '',\n children: [],\n childSeoVisibility: false\n};\n\nexport default withTitle(Button);\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAC5D,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;AACvC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,WAAW,MAAM,qBAAqB;AAC7C,SAASC,YAAY,QAAQ,yBAAyB;AACtD,SAASC,eAAe,QAAQ,gBAAgB;AAChD,OAAOC,SAAS,IAAIC,IAAI,EAAEC,MAAM,QAAQ,YAAY;AACpD,SAASC,iBAAiB,QAAQ,6BAA6B;AAC/D,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,SAAS,MAAM,aAAa;AACnC,SAASC,S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AC,CAAC;EACVH,WAAW,EAAE,EAAE;EACfN,IAAI,EAAE,EAAE;EACRQ,cAAc,EAAE,EAAE;EAClBL,IAAI,EAAE,EAAE;EACRJ,IAAI,EAAE,EAAE;EACRE,GAAG,EAAE,IAAI;EACTkD,IAAI,EAAE,EAAE;EACRjD,IAAI,EAAE,EAAE;EACRE,KAAK,EAAE,EAAE;EACTC,QAAQ,EAAE,EAAE;EACZE,kBAAkB,EAAE;AACtB,CAAC;AAED,eAAejB,SAAS,CAACO,MAAM,CAAC"}
1
+ {"version":3,"file":"Button.js","names":["React","useState","Fragment","useEffect","useCookies","useRouter","classnames","BlazeButton","handleLogout","useApolloClient","PropTypes","bool","string","useStringTemplate","ClickWrapper","BlazeLink","withTitle","getClassModifiers","LOGOUT","renderChildren","updateChildrensParent","hasChildren","getClickWrapperOptions","Button","props","type","text","url","icon","name","style","children","clickAction","childSeoVisibility","afterClickText","parent","otherProps","_objectWithoutProperties","_excluded","client","router","isLogoutButton","cookies","blaze_auth","blazeCookie","showChildren","setShowChildren","data","textToUse","afterClickTextToUse","urlToUse","asPath","checkIfButtonShouldRender","logout","reload","handleClick","buttonType","modifiers","_objectSpread","currentProps","href","title","DynamicButton","itemId","itemEntity","renderedChildren","onClose","shouldUseClickWrapper","wrapperProps","Wrapper","contentClassName","createElement","className","_extends","onClick","propTypes","object","size","oneOfType","arrayOf","node","defaultProps"],"sources":["../../src/components/Button.js"],"sourcesContent":["import React, { useState, Fragment, useEffect } from 'react';\nimport { useCookies } from 'react-cookie';\nimport { useRouter } from 'next/router';\nimport classnames from 'classnames';\nimport BlazeButton from '@blaze-react/button';\nimport { handleLogout } from '@blaze-cms/core-auth-ui';\nimport { useApolloClient } from '@apollo/client';\nimport PropTypes, { bool, string } from 'prop-types';\nimport { useStringTemplate } from '@blaze-cms/utils-handlebars';\nimport ClickWrapper from './ClickWrapper';\nimport BlazeLink from './BlazeLink';\nimport { withTitle } from '../HOC';\nimport { getClassModifiers } from '../utils';\nimport { LOGOUT } from '../constants';\nimport {\n renderChildren,\n updateChildrensParent,\n hasChildren,\n getClickWrapperOptions\n} from '../helpers';\n\nconst Button = props => {\n const {\n type,\n text,\n url,\n icon,\n name,\n style,\n children,\n clickAction,\n childSeoVisibility,\n afterClickText,\n parent,\n ...otherProps\n } = props;\n const client = useApolloClient();\n const router = useRouter();\n const isLogoutButton = clickAction === LOGOUT;\n const [cookies] = useCookies();\n const { blaze_auth: blazeCookie } = cookies;\n const [showChildren, setShowChildren] = useState(false);\n const {\n data: [textToUse, afterClickTextToUse, urlToUse]\n } = useStringTemplate(parent, [text, afterClickText, url]);\n\n useEffect(\n () => {\n setShowChildren(false);\n },\n [router.asPath]\n );\n\n const checkIfButtonShouldRender = () => {\n if (isLogoutButton) return !!blazeCookie;\n if (!text && !icon) return false;\n return !!(url || hasChildren(children));\n };\n\n const logout = () => {\n handleLogout(client);\n if (hasChildren(children)) return setShowChildren(true);\n return url ? router.reload(urlToUse) : router.reload();\n };\n\n const handleClick = () => {\n if (isLogoutButton) logout();\n if (!url && !isLogoutButton) setShowChildren(!showChildren);\n };\n\n if (!checkIfButtonShouldRender()) return null;\n\n const buttonType = !text && icon ? 'icon' : type;\n const modifiers = getClassModifiers(buttonType, { icon, style, ...otherProps });\n const currentProps = url ? { href: urlToUse, title: name } : { name };\n const DynamicButton = url && !isLogoutButton ? BlazeLink : BlazeButton;\n updateChildrensParent(children, parent.itemId, parent.itemEntity);\n\n const renderedChildren = renderChildren(children, { onClose: handleClick });\n const { shouldUseClickWrapper, wrapperProps } = getClickWrapperOptions(children, props);\n const Wrapper = shouldUseClickWrapper ? ClickWrapper : Fragment;\n\n const contentClassName = classnames('button__content', {\n 'button__content--show': showChildren\n });\n\n return (\n <Wrapper {...wrapperProps}>\n {childSeoVisibility && <div className={contentClassName}>{renderedChildren}</div>}\n {!childSeoVisibility && showChildren && renderedChildren}\n <DynamicButton className={modifiers} onClick={handleClick} {...currentProps}>\n {icon && <i className={icon} />}\n {showChildren ? afterClickTextToUse : textToUse}\n </DynamicButton>\n </Wrapper>\n );\n};\n\nButton.propTypes = {\n parent: PropTypes.object,\n clickAction: PropTypes.string,\n text: PropTypes.string,\n afterClickText: string,\n name: PropTypes.string,\n type: PropTypes.string,\n url: PropTypes.string,\n size: PropTypes.string,\n icon: PropTypes.string,\n style: PropTypes.string,\n childSeoVisibility: bool,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node])\n};\n\nButton.defaultProps = {\n parent: {},\n clickAction: '',\n text: '',\n afterClickText: '',\n name: '',\n type: '',\n url: null,\n size: '',\n icon: '',\n style: '',\n children: [],\n childSeoVisibility: false\n};\n\nexport default withTitle(Button);\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAAIC,QAAQ,EAAEC,QAAQ,EAAEC,SAAS,QAAQ,OAAO;AAC5D,SAASC,UAAU,QAAQ,cAAc;AACzC,SAASC,SAAS,QAAQ,aAAa;AACvC,OAAOC,UAAU,MAAM,YAAY;AACnC,OAAOC,WAAW,MAAM,qBAAqB;AAC7C,SAASC,YAAY,QAAQ,yBAAyB;AACtD,SAASC,eAAe,QAAQ,gBAAgB;AAChD,OAAOC,SAAS,IAAIC,IAAI,EAAEC,MAAM,QAAQ,YAAY;AACpD,SAASC,iBAAiB,QAAQ,6BAA6B;AAC/D,OAAOC,YAAY,MAAM,gBAAgB;AACzC,OAAOC,SAAS,MAAM,aAAa;AACnC,SAASC,SAAS,QAAQ,QAAQ;AAClC,SAASC,iBAAiB,QAAQ,UAAU;AAC5C,SAASC,MAAM,QAAQ,cAAc;AACrC,SACEC,cAAc,EACdC,qBAAqB,EACrBC,WAAW,EACXC,sBAAsB,QACjB,YAAY;AAEnB,MAAMC,MAAM,GAAGC,KAAK,IAAI;EACtB,MAAM;MACJC,IAAI;MACJC,IAAI;MACJC,GAAG;MACHC,IAAI;MACJC,IAAI;MACJC,KAAK;MACLC,QAAQ;MACRC,WAAW;MACXC,kBAAkB;MAClBC,cAAc;MACdC;IAEF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,kBAAkB,EAAE;AACtB,CAAC;AAED,eAAejB,SAAS,CAACO,MAAM,CAAC"}
@@ -13,7 +13,7 @@ import { generateSingleItemQuery } from '../../application/query';
13
13
  import { SEARCH_PUBLISHED_CONTENT, AND } from '../../constants';
14
14
  import { useGetEntitySchemasAsObj, useGetImages } from '../../hooks';
15
15
  import { getUpdatedFilterBy, getEntityData, getRequiredSchemas, sortResponseData, getUnpublishedEntityName, renderChildren, splitChildren, removeExtraItems, appendImages } from '../../helpers';
16
- import { filtersSetup, filterQuerySetup, shouldSkipSingleQuery, shouldReturn, getUpdatedSortProperties } from './helpers';
16
+ import { filtersSetup, filterQuerySetup, shouldSkipSingleQuery, shouldReturn, getUpdatedSortProperties, getUpdatedItemsToDisplay } from './helpers';
17
17
  const CardsContainer = dynamic(() => import('./CardsContainer'));
18
18
  const CardsRender = _ref => {
19
19
  let {
@@ -104,6 +104,12 @@ const CardsRender = _ref => {
104
104
  error: schemaError
105
105
  } = useGetEntitySchemasAsObj(getRequiredSchemas([...filterByProperty, ...sortbyFilters], filterEntitySchema), _loading);
106
106
  const updatedFilterBy = getUpdatedFilterBy(inheritedFilters, parentEntityData, parentSchema, filterEntitySchema, parentId, variableProps);
107
+ const updatedItemsToDisplay = getUpdatedItemsToDisplay({
108
+ itemsToDisplay,
109
+ inheritedFilters,
110
+ parentSchema,
111
+ parentEntityData
112
+ });
107
113
  const {
108
114
  limit,
109
115
  variables
@@ -115,10 +121,11 @@ const CardsRender = _ref => {
115
121
  docType: docTypes,
116
122
  filterOperator,
117
123
  filterEntityRelations,
118
- itemsToDisplay,
124
+ itemsToDisplay: updatedItemsToDisplay,
119
125
  entitySameAsCurrentItemEntity,
120
126
  useRandomSort
121
127
  });
128
+ const hasNoFiltersOrItemsToDisplay = !updatedItemsToDisplay.length && !updatedFilterBy;
122
129
  const {
123
130
  data: cardData,
124
131
  error: cardsError,
@@ -126,9 +133,9 @@ const CardsRender = _ref => {
126
133
  } = useQuery(action, {
127
134
  variables,
128
135
  fetchPolicy: useRandomSort ? 'cache-and-network' : 'cache-first',
129
- skip: shouldReturn(!updatedFilterBy, _loading, _load, schemaLoading, _error, _err, schemaError)
136
+ skip: shouldReturn(hasNoFiltersOrItemsToDisplay, _loading, _load, schemaLoading, _error, _err, schemaError)
130
137
  });
131
- const imageIds = itemsToDisplay.map(({
138
+ const imageIds = updatedItemsToDisplay.map(({
132
139
  imageId
133
140
  }) => imageId).filter(Boolean);
134
141
  const {
@@ -137,7 +144,7 @@ const CardsRender = _ref => {
137
144
  } = useGetImages(imageIds, true);
138
145
  const isLoading = shouldReturn(_loading, _load, schemaLoading, cardsLoading, imagesLoading);
139
146
  const hasError = shouldReturn(_error, _err, schemaError);
140
- if (!updatedFilterBy) return null;
147
+ if (hasNoFiltersOrItemsToDisplay) return null;
141
148
  if (isLoading) return null;
142
149
  if (hasError) return null;
143
150
  if (cardsError) return cardsError.message;
@@ -147,14 +154,14 @@ const CardsRender = _ref => {
147
154
  if (!cardDataResults || !cardDataResults.length) return null;
148
155
  cardDataResults = entitySameAsCurrentItemEntity ? removeExtraItems(cardDataResults, limit, parentId) : cardDataResults;
149
156
  if (!cardDataResults.length) return null;
150
- const orderedData = useRandomSort ? cardDataResults : sortResponseData(cardDataResults, itemsToDisplay);
157
+ const orderedData = useRandomSort ? cardDataResults : sortResponseData(cardDataResults, updatedItemsToDisplay);
151
158
  const {
152
159
  regularChildren,
153
160
  gtmChildren
154
161
  } = splitChildren(children, cardDataResults, graphqlEntityMap, {
155
162
  name: variableProps.name
156
163
  });
157
- const updatedCards = appendImages(imagesData, orderedData, itemsToDisplay);
164
+ const updatedCards = appendImages(imagesData, orderedData, updatedItemsToDisplay);
158
165
  return /*#__PURE__*/React.createElement(React.Fragment, null, gtmChildren && renderChildren(gtmChildren), /*#__PURE__*/React.createElement(CardsContainer, _extends({
159
166
  cardData: updatedCards,
160
167
  entity: primaryEntityToUse,
@@ -1 +1 @@
1
- {"version":3,"file":"CardsRender.js","names":["React","useContext","useQuery","dynamic","PropTypes","MainContext","generateSingleItemQuery","SEARCH_PUBLISHED_CONTENT","AND","useGetEntitySchemasAsObj","useGetImages","getUpdatedFilterBy","getEntityData","getRequiredSchemas","sortResponseData","getUnpublishedEntityName","renderChildren","splitChildren","removeExtraItems","appendImages","filtersSetup","filterQuerySetup","shouldSkipSingleQuery","shouldReturn","getUpdatedSortProperties","CardsContainer","CardsRender","_ref","entity","legacyEntity","entities","entityFields","itemsToDisplay","children","otherProps","_objectWithoutProperties","_excluded","isPreview","parent","itemId","parentId","itemEntity","parentEntity","filterBy","filterByProperty","sortby","sort","sortProperties","operator","filterOperator","useRandomSort","updatedSortProperties","sortbyFilters","variableProps","_objectSpread","entitiesToUse","primaryEntityToUse","unpublishedParentEntityName","allEntityNames","uniqueEntityNames","Set","data","mainSchemas","loading","_loading","error","_error","parentSchema","filterEntitySchema","entitiesTypes","map","ent","graphqlEntityMap","reduce","acc","entityType","docTypes","docType","type","entityTypes","eType","getAction","queryProps","inheritedFilters","entitySameAsCurrentItemEntity","action","filterEntityRelations","currentSchema","itemEntityUpdated","entityData","parentEntityData","_err","_load","variables","id","skip","requiredSchema","schemaLoading","schemaError","updatedFilterBy","limit","getEntitySchemas","Object","values","cardData","cardsError","cardsLoading","fetchPolicy","imageIds","imageId","filter","Boolean","imagesData","imagesLoading","isLoading","hasError","message","results","cardDataResults","length","orderedData","regularChildren","gtmChildren","name","updatedCards","createElement","Fragment","_extends","cardChildren","propTypes","oneOfType","arrayOf","node","string","isRequired","array","defaultProps"],"sources":["../../../src/components/Card/CardsRender.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport dynamic from 'next/dynamic';\nimport PropTypes from 'prop-types';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { generateSingleItemQuery } from '../../application/query';\nimport { SEARCH_PUBLISHED_CONTENT, AND } from '../../constants';\nimport { useGetEntitySchemasAsObj, useGetImages } from '../../hooks';\nimport {\n getUpdatedFilterBy,\n getEntityData,\n getRequiredSchemas,\n sortResponseData,\n getUnpublishedEntityName,\n renderChildren,\n splitChildren,\n removeExtraItems,\n appendImages\n} from '../../helpers';\nimport {\n filtersSetup,\n filterQuerySetup,\n shouldSkipSingleQuery,\n shouldReturn,\n getUpdatedSortProperties\n} from './helpers';\n\nconst CardsContainer = dynamic(() => import('./CardsContainer'));\n\nconst CardsRender = ({\n entity: legacyEntity,\n entities,\n entityFields,\n itemsToDisplay,\n children,\n ...otherProps\n}) => {\n const { isPreview } = useContext(MainContext);\n const {\n parent: { itemId: parentId, itemEntity: parentEntity },\n filterBy = [],\n filterByProperty = [],\n sortby,\n sort,\n sortProperties = [],\n operator: filterOperator = AND,\n useRandomSort\n } = otherProps;\n const [updatedSortProperties, sortbyFilters] = getUpdatedSortProperties(\n sort,\n sortby,\n sortProperties\n );\n\n const variableProps = {\n ...otherProps,\n sortProperties: updatedSortProperties,\n sort: null,\n sortby: null\n };\n\n const entitiesToUse = entities || [legacyEntity];\n const primaryEntityToUse = entitiesToUse[0];\n const unpublishedParentEntityName = getUnpublishedEntityName(parentEntity);\n const allEntityNames = [...entitiesToUse, unpublishedParentEntityName];\n const uniqueEntityNames = [...new Set(allEntityNames)];\n const { data: mainSchemas = {}, loading: _loading, error: _error } = useGetEntitySchemasAsObj(\n uniqueEntityNames\n );\n const parentSchema = mainSchemas[unpublishedParentEntityName] || {};\n const filterEntitySchema = mainSchemas[primaryEntityToUse] || {};\n const entitiesTypes = entitiesToUse.map(ent => getEntityData(ent, mainSchemas[ent]));\n const graphqlEntityMap = entitiesTypes.reduce(\n (acc, entityType) => ({ ...acc, [entityType.entityType]: entityType.entity }),\n {}\n );\n const docTypes = entitiesTypes.map(({ docType: type }) => type);\n const entityTypes = entitiesTypes.map(({ entityType: eType }) => eType);\n\n const {\n getAction,\n queryProps,\n inheritedFilters,\n entitySameAsCurrentItemEntity,\n action,\n filterEntityRelations\n } = filtersSetup({\n entityFields,\n entityTypes,\n filterBy,\n filterByProperty,\n entities: entitiesToUse,\n currentSchema: parentSchema,\n filterEntitySchema,\n isPreview,\n itemEntityUpdated: unpublishedParentEntityName\n });\n const {\n data: { entityData: parentEntityData = {} } = {},\n error: _err,\n loading: _load\n } = useQuery(generateSingleItemQuery(getAction, queryProps), {\n variables: { id: parentId },\n skip: shouldSkipSingleQuery(_loading, getAction, queryProps)\n });\n\n const {\n data: requiredSchema = {},\n loading: schemaLoading,\n error: schemaError\n } = useGetEntitySchemasAsObj(\n getRequiredSchemas([...filterByProperty, ...sortbyFilters], filterEntitySchema),\n _loading\n );\n\n const updatedFilterBy = getUpdatedFilterBy(\n inheritedFilters,\n parentEntityData,\n parentSchema,\n filterEntitySchema,\n parentId,\n variableProps\n );\n\n const { limit, variables } = filterQuerySetup({\n getEntitySchemas: Object.values(requiredSchema),\n entity: primaryEntityToUse,\n updatedFilterBy,\n variableProps,\n docType: docTypes,\n filterOperator,\n filterEntityRelations,\n itemsToDisplay,\n entitySameAsCurrentItemEntity,\n useRandomSort\n });\n const { data: cardData, error: cardsError, loading: cardsLoading } = useQuery(action, {\n variables,\n fetchPolicy: useRandomSort ? 'cache-and-network' : 'cache-first',\n skip: shouldReturn(!updatedFilterBy, _loading, _load, schemaLoading, _error, _err, schemaError)\n });\n\n const imageIds = itemsToDisplay.map(({ imageId }) => imageId).filter(Boolean);\n const { data: imagesData, loading: imagesLoading } = useGetImages(imageIds, true);\n const isLoading = shouldReturn(_loading, _load, schemaLoading, cardsLoading, imagesLoading);\n const hasError = shouldReturn(_error, _err, schemaError);\n\n if (!updatedFilterBy) return null;\n if (isLoading) return null;\n if (hasError) return null;\n if (cardsError) return cardsError.message;\n let { results: cardDataResults } = cardData[SEARCH_PUBLISHED_CONTENT];\n\n if (!cardDataResults || !cardDataResults.length) return null;\n\n cardDataResults = entitySameAsCurrentItemEntity\n ? removeExtraItems(cardDataResults, limit, parentId)\n : cardDataResults;\n if (!cardDataResults.length) return null;\n\n const orderedData = useRandomSort\n ? cardDataResults\n : sortResponseData(cardDataResults, itemsToDisplay);\n const { regularChildren, gtmChildren } = splitChildren(\n children,\n cardDataResults,\n graphqlEntityMap,\n {\n name: variableProps.name\n }\n );\n const updatedCards = appendImages(imagesData, orderedData, itemsToDisplay);\n\n return (\n <>\n {gtmChildren && renderChildren(gtmChildren)}\n <CardsContainer\n cardData={updatedCards}\n entity={primaryEntityToUse}\n gtmChildren={gtmChildren}\n cardChildren={regularChildren}\n graphqlEntityMap={graphqlEntityMap}\n {...variableProps}\n />\n </>\n );\n};\n\nCardsRender.propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n entity: PropTypes.string.isRequired,\n entityFields: PropTypes.string.isRequired,\n itemsToDisplay: PropTypes.array,\n entities: PropTypes.array\n};\n\nCardsRender.defaultProps = {\n children: [],\n itemsToDisplay: [],\n entities: []\n};\n\nexport default CardsRender;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,OAAOC,OAAO,MAAM,cAAc;AAClC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,uBAAuB,QAAQ,yBAAyB;AACjE,SAASC,wBAAwB,EAAEC,GAAG,QAAQ,iBAAiB;AAC/D,SAASC,wBAAwB,EAAEC,YAAY,QAAQ,aAAa;AACpE,SACEC,kBAAkB,EAClBC,aAAa,EACbC,kBAAkB,EAClBC,gBAAgB,EAChBC,wBAAwB,EACxBC,cAAc,EACdC,aAAa,EACbC,gBAAgB,EAChBC,YAAY,QACP,eAAe;AACtB,SACEC,YAAY,EACZC,gBAAgB,EAChBC,qBAAqB,EACrBC,YAAY,EACZC,wBAAwB,QACnB,WAAW;AAElB,MAAMC,cAAc,GAAGtB,OAAO,CAAC,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAEhE,MAAMuB,WAAW,GAAGC,IAAA,IAOd;EAAA,IAPe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CAAA6H,aAAA,CAAA7H,KAAA,CAAA8H,QAAA,QACGJ,WAAW,IAAI1G,cAAc,CAAC0G,WAAW,CAAC,eAC3C1H,KAAA,CAAA6H,aAAA,CAACpG,cAAc,EAAAsG,QAAA;IACbvB,QAAQ,EAAEoB,YAAa;IACvBhG,MAAM,EAAE4B,kBAAmB;IAC3BkE,WAAW,EAAEA,WAAY;IACzBM,YAAY,EAAEP,eAAgB;IAC9BjD,gBAAgB,EAAEA;EAAiB,GAC/BnB,aAAa,CAClB,CACD,CAAC;AAEP,CAAC;AAED3B,WAAW,CAACuG,SAAS,GAAG;EACtBhG,QAAQ,EAAE7B,SAAS,CAAC8H,SAAS,CAAC,CAAC9H,SAAS,CAAC+H,OAAO,CAAC/H,SAAS,CAACgI,IAAI,CAAC,EAAEhI,SAAS,CAACgI,IAAI,CAAC,CAAC;EAClFxG,MAAM,EAAExB,SAAS,CAACiI,MAAM,CAACC,UAAU;EACnCvG,YAAY,EAAE3B,SAAS,CAACiI,MAAM,CAACC,UAAU;EACzCtG,cAAc,EAAE5B,SAAS,CAACmI,KAAK;EAC/BzG,QAAQ,EAAE1B,SAAS,CAACmI;AACtB,CAAC;AAED7G,WAAW,CAAC8G,YAAY,GAAG;EACzBvG,QAAQ,EAAE,EAAE;EACZD,cAAc,EAAE,EAAE;EAClBF,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeJ,WAAW"}
1
+ {"version":3,"file":"CardsRender.js","names":["React","useContext","useQuery","dynamic","PropTypes","MainContext","generateSingleItemQuery","SEARCH_PUBLISHED_CONTENT","AND","useGetEntitySchemasAsObj","useGetImages","getUpdatedFilterBy","getEntityData","getRequiredSchemas","sortResponseData","getUnpublishedEntityName","renderChildren","splitChildren","removeExtraItems","appendImages","filtersSetup","filterQuerySetup","shouldSkipSingleQuery","shouldReturn","getUpdatedSortProperties","getUpdatedItemsToDisplay","CardsContainer","CardsRender","_ref","entity","legacyEntity","entities","entityFields","itemsToDisplay","children","otherProps","_objectWithoutProperties","_excluded","isPreview","parent","itemId","parentId","itemEntity","parentEntity","filterBy","filterByProperty","sortby","sort","sortProperties","operator","filterOperator","useRandomSort","updatedSortProperties","sortbyFilters","variableProps","_objectSpread","entitiesToUse","primaryEntityToUse","unpublishedParentEntityName","allEntityNames","uniqueEntityNames","Set","data","mainSchemas","loading","_loading","error","_error","parentSchema","filterEntitySchema","entitiesTypes","map","ent","graphqlEntityMap","reduce","acc","entityType","docTypes","docType","type","entityTypes","eType","getAction","queryProps","inheritedFilters","entitySameAsCurrentItemEntity","action","filterEntityRelations","currentSchema","itemEntityUpdated","entityData","parentEntityData","_err","_load","variables","id","skip","requiredSchema","schemaLoading","schemaError","updatedFilterBy","updatedItemsToDisplay","limit","getEntitySchemas","Object","values","hasNoFiltersOrItemsToDisplay","length","cardData","cardsError","cardsLoading","fetchPolicy","imageIds","imageId","filter","Boolean","imagesData","imagesLoading","isLoading","hasError","message","results","cardDataResults","orderedData","regularChildren","gtmChildren","name","updatedCards","createElement","Fragment","_extends","cardChildren","propTypes","oneOfType","arrayOf","node","string","isRequired","array","defaultProps"],"sources":["../../../src/components/Card/CardsRender.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport dynamic from 'next/dynamic';\nimport PropTypes from 'prop-types';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { generateSingleItemQuery } from '../../application/query';\nimport { SEARCH_PUBLISHED_CONTENT, AND } from '../../constants';\nimport { useGetEntitySchemasAsObj, useGetImages } from '../../hooks';\nimport {\n getUpdatedFilterBy,\n getEntityData,\n getRequiredSchemas,\n sortResponseData,\n getUnpublishedEntityName,\n renderChildren,\n splitChildren,\n removeExtraItems,\n appendImages\n} from '../../helpers';\nimport {\n filtersSetup,\n filterQuerySetup,\n shouldSkipSingleQuery,\n shouldReturn,\n getUpdatedSortProperties,\n getUpdatedItemsToDisplay\n} from './helpers';\n\nconst CardsContainer = dynamic(() => import('./CardsContainer'));\n\nconst CardsRender = ({\n entity: legacyEntity,\n entities,\n entityFields,\n itemsToDisplay,\n children,\n ...otherProps\n}) => {\n const { isPreview } = useContext(MainContext);\n const {\n parent: { itemId: parentId, itemEntity: parentEntity },\n filterBy = [],\n filterByProperty = [],\n sortby,\n sort,\n sortProperties = [],\n operator: filterOperator = AND,\n useRandomSort\n } = otherProps;\n const [updatedSortProperties, sortbyFilters] = getUpdatedSortProperties(\n sort,\n sortby,\n sortProperties\n );\n\n const variableProps = {\n ...otherProps,\n sortProperties: updatedSortProperties,\n sort: null,\n sortby: null\n };\n\n const entitiesToUse = entities || [legacyEntity];\n const primaryEntityToUse = entitiesToUse[0];\n const unpublishedParentEntityName = getUnpublishedEntityName(parentEntity);\n const allEntityNames = [...entitiesToUse, unpublishedParentEntityName];\n const uniqueEntityNames = [...new Set(allEntityNames)];\n const { data: mainSchemas = {}, loading: _loading, error: _error } = useGetEntitySchemasAsObj(\n uniqueEntityNames\n );\n const parentSchema = mainSchemas[unpublishedParentEntityName] || {};\n const filterEntitySchema = mainSchemas[primaryEntityToUse] || {};\n const entitiesTypes = entitiesToUse.map(ent => getEntityData(ent, mainSchemas[ent]));\n const graphqlEntityMap = entitiesTypes.reduce(\n (acc, entityType) => ({ ...acc, [entityType.entityType]: entityType.entity }),\n {}\n );\n const docTypes = entitiesTypes.map(({ docType: type }) => type);\n const entityTypes = entitiesTypes.map(({ entityType: eType }) => eType);\n\n const {\n getAction,\n queryProps,\n inheritedFilters,\n entitySameAsCurrentItemEntity,\n action,\n filterEntityRelations\n } = filtersSetup({\n entityFields,\n entityTypes,\n filterBy,\n filterByProperty,\n entities: entitiesToUse,\n currentSchema: parentSchema,\n filterEntitySchema,\n isPreview,\n itemEntityUpdated: unpublishedParentEntityName\n });\n\n const {\n data: { entityData: parentEntityData = {} } = {},\n error: _err,\n loading: _load\n } = useQuery(generateSingleItemQuery(getAction, queryProps), {\n variables: { id: parentId },\n skip: shouldSkipSingleQuery(_loading, getAction, queryProps)\n });\n\n const {\n data: requiredSchema = {},\n loading: schemaLoading,\n error: schemaError\n } = useGetEntitySchemasAsObj(\n getRequiredSchemas([...filterByProperty, ...sortbyFilters], filterEntitySchema),\n _loading\n );\n\n const updatedFilterBy = getUpdatedFilterBy(\n inheritedFilters,\n parentEntityData,\n parentSchema,\n filterEntitySchema,\n parentId,\n variableProps\n );\n\n const updatedItemsToDisplay = getUpdatedItemsToDisplay({\n itemsToDisplay,\n inheritedFilters,\n parentSchema,\n parentEntityData\n });\n\n const { limit, variables } = filterQuerySetup({\n getEntitySchemas: Object.values(requiredSchema),\n entity: primaryEntityToUse,\n updatedFilterBy,\n variableProps,\n docType: docTypes,\n filterOperator,\n filterEntityRelations,\n itemsToDisplay: updatedItemsToDisplay,\n entitySameAsCurrentItemEntity,\n useRandomSort\n });\n\n const hasNoFiltersOrItemsToDisplay = !updatedItemsToDisplay.length && !updatedFilterBy;\n\n const { data: cardData, error: cardsError, loading: cardsLoading } = useQuery(action, {\n variables,\n fetchPolicy: useRandomSort ? 'cache-and-network' : 'cache-first',\n skip: shouldReturn(\n hasNoFiltersOrItemsToDisplay,\n _loading,\n _load,\n schemaLoading,\n _error,\n _err,\n schemaError\n )\n });\n\n const imageIds = updatedItemsToDisplay.map(({ imageId }) => imageId).filter(Boolean);\n const { data: imagesData, loading: imagesLoading } = useGetImages(imageIds, true);\n const isLoading = shouldReturn(_loading, _load, schemaLoading, cardsLoading, imagesLoading);\n const hasError = shouldReturn(_error, _err, schemaError);\n\n if (hasNoFiltersOrItemsToDisplay) return null;\n if (isLoading) return null;\n if (hasError) return null;\n if (cardsError) return cardsError.message;\n let { results: cardDataResults } = cardData[SEARCH_PUBLISHED_CONTENT];\n\n if (!cardDataResults || !cardDataResults.length) return null;\n\n cardDataResults = entitySameAsCurrentItemEntity\n ? removeExtraItems(cardDataResults, limit, parentId)\n : cardDataResults;\n if (!cardDataResults.length) return null;\n\n const orderedData = useRandomSort\n ? cardDataResults\n : sortResponseData(cardDataResults, updatedItemsToDisplay);\n const { regularChildren, gtmChildren } = splitChildren(\n children,\n cardDataResults,\n graphqlEntityMap,\n {\n name: variableProps.name\n }\n );\n const updatedCards = appendImages(imagesData, orderedData, updatedItemsToDisplay);\n\n return (\n <>\n {gtmChildren && renderChildren(gtmChildren)}\n <CardsContainer\n cardData={updatedCards}\n entity={primaryEntityToUse}\n gtmChildren={gtmChildren}\n cardChildren={regularChildren}\n graphqlEntityMap={graphqlEntityMap}\n {...variableProps}\n />\n </>\n );\n};\n\nCardsRender.propTypes = {\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n entity: PropTypes.string.isRequired,\n entityFields: PropTypes.string.isRequired,\n itemsToDisplay: PropTypes.array,\n entities: PropTypes.array\n};\n\nCardsRender.defaultProps = {\n children: [],\n itemsToDisplay: [],\n entities: []\n};\n\nexport default CardsRender;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAK,IAAIC,UAAU,QAAQ,OAAO;AACzC,SAASC,QAAQ,QAAQ,gBAAgB;AACzC,OAAOC,OAAO,MAAM,cAAc;AAClC,OAAOC,SAAS,MAAM,YAAY;AAClC,SAASC,WAAW,QAAQ,8BAA8B;AAC1D,SAASC,uBAAuB,QAAQ,yBAAyB;AACjE,SAASC,wBAAwB,EAAEC,GAAG,QAAQ,iBAAiB;AAC/D,SAASC,wBAAwB,EAAEC,YAAY,QAAQ,aAAa;AACpE,SACEC,kBAAkB,EAClBC,aAAa,EACbC,kBAAkB,EAClBC,gBAAgB,EAChBC,wBAAwB,EACxBC,cAAc,EACdC,aAAa,EACbC,gBAAgB,EAChBC,YAAY,QACP,eAAe;AACtB,SACEC,YAAY,EACZC,gBAAgB,EAChBC,qBAAqB,EACrBC,YAAY,EACZC,wBAAwB,EACxBC,wBAAwB,QACnB,WAAW;AAElB,MAAMC,cAAc,GAAGvB,OAAO,CAAC,MAAM,MAAM,CAAC,kBAAkB,CAAC,CAAC;AAEhE,MAAMwB,WAAW,GAAGC,IAAA,IAOd;EAAA,IAPe;MACnBC,MAAM,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,EACRwF,eAAe,EACfjD,gBAAgB,EAChB;IACEqD,IAAI,EAAExE,aAAa,CAACwE;EACtB,CACF,CAAC;EACD,MAAMC,YAAY,GAAG5G,YAAY,CAACiG,UAAU,EAAEO,WAAW,EAAEtB,qBAAqB,CAAC;EAEjF,oBACErG,KAAA,CAAAgI,aAAA,CAAAhI,KAAA,CAAAiI,QAAA,QACGJ,WAAW,IAAI7G,cAAc,CAAC6G,WAAW,CAAC,eAC3C7H,KAAA,CAAAgI,aAAA,CAACtG,cAAc,EAAAwG,QAAA;IACbtB,QAAQ,EAAEmB,YAAa;IACvBlG,MAAM,EAAE4B,kBAAmB;IAC3BoE,WAAW,EAAEA,WAAY;IACzBM,YAAY,EAAEP,eAAgB;IAC9BnD,gBAAgB,EAAEA;EAAiB,GAC/BnB,aAAa,CAClB,CACD,CAAC;AAEP,CAAC;AAED3B,WAAW,CAACyG,SAAS,GAAG;EACtBlG,QAAQ,EAAE9B,SAAS,CAACiI,SAAS,CAAC,CAACjI,SAAS,CAACkI,OAAO,CAAClI,SAAS,CAACmI,IAAI,CAAC,EAAEnI,SAAS,CAACmI,IAAI,CAAC,CAAC;EAClF1G,MAAM,EAAEzB,SAAS,CAACoI,MAAM,CAACC,UAAU;EACnCzG,YAAY,EAAE5B,SAAS,CAACoI,MAAM,CAACC,UAAU;EACzCxG,cAAc,EAAE7B,SAAS,CAACsI,KAAK;EAC/B3G,QAAQ,EAAE3B,SAAS,CAACsI;AACtB,CAAC;AAED/G,WAAW,CAACgH,YAAY,GAAG;EACzBzG,QAAQ,EAAE,EAAE;EACZD,cAAc,EAAE,EAAE;EAClBF,QAAQ,EAAE;AACZ,CAAC;AAED,eAAeJ,WAAW"}
@@ -0,0 +1,32 @@
1
+ const getUpdatedItemsToDisplay = ({
2
+ parentSchema,
3
+ parentEntityData,
4
+ itemsToDisplay = [],
5
+ inheritedFilters = []
6
+ }) => {
7
+ const idProp = inheritedFilters.find(filter => filter.indexOf('id/') === 0);
8
+ if (!idProp || !parentSchema || !parentEntityData) return itemsToDisplay;
9
+ const {
10
+ properties
11
+ } = parentSchema;
12
+ const [, entityKey] = idProp.split('/');
13
+ if (!properties || !entityKey) return itemsToDisplay;
14
+ const queryValue = Object.keys(properties).find(propKey => properties[propKey] && properties[propKey].relation && properties[propKey].relation.entityIdentifier === entityKey);
15
+ const parentValues = parentEntityData[queryValue];
16
+ if (!parentValues) return itemsToDisplay;
17
+ const updatedItemsToDisplay = [...itemsToDisplay];
18
+ if (Array.isArray(parentValues)) {
19
+ parentValues.forEach(value => {
20
+ updatedItemsToDisplay.push({
21
+ displayItems: [value]
22
+ });
23
+ });
24
+ } else {
25
+ updatedItemsToDisplay.push({
26
+ displayItems: [parentValues]
27
+ });
28
+ }
29
+ return updatedItemsToDisplay;
30
+ };
31
+ export default getUpdatedItemsToDisplay;
32
+ //# sourceMappingURL=get-updated-items-to-display.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-updated-items-to-display.js","names":["getUpdatedItemsToDisplay","parentSchema","parentEntityData","itemsToDisplay","inheritedFilters","idProp","find","filter","indexOf","properties","entityKey","split","queryValue","Object","keys","propKey","relation","entityIdentifier","parentValues","updatedItemsToDisplay","Array","isArray","forEach","value","push","displayItems"],"sources":["../../../../src/components/Card/helpers/get-updated-items-to-display.js"],"sourcesContent":["const getUpdatedItemsToDisplay = ({\n parentSchema,\n parentEntityData,\n itemsToDisplay = [],\n inheritedFilters = []\n}) => {\n const idProp = inheritedFilters.find(filter => filter.indexOf('id/') === 0);\n\n if (!idProp || !parentSchema || !parentEntityData) return itemsToDisplay;\n const { properties } = parentSchema;\n const [, entityKey] = idProp.split('/');\n if (!properties || !entityKey) return itemsToDisplay;\n const queryValue = Object.keys(properties).find(\n propKey =>\n properties[propKey] &&\n properties[propKey].relation &&\n properties[propKey].relation.entityIdentifier === entityKey\n );\n const parentValues = parentEntityData[queryValue];\n if (!parentValues) return itemsToDisplay;\n const updatedItemsToDisplay = [...itemsToDisplay];\n if (Array.isArray(parentValues)) {\n parentValues.forEach(value => {\n updatedItemsToDisplay.push({ displayItems: [value] });\n });\n } else {\n updatedItemsToDisplay.push({ displayItems: [parentValues] });\n }\n return updatedItemsToDisplay;\n};\n\nexport default getUpdatedItemsToDisplay;\n"],"mappings":"AAAA,MAAMA,wBAAwB,GAAGA,CAAC;EAChCC,YAAY;EACZC,gBAAgB;EAChBC,cAAc,GAAG,EAAE;EACnBC,gBAAgB,GAAG;AACrB,CAAC,KAAK;EACJ,MAAMC,MAAM,GAAGD,gBAAgB,CAACE,IAAI,CAACC,MAAM,IAAIA,MAAM,CAACC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;EAE3E,IAAI,CAACH,MAAM,IAAI,CAACJ,YAAY,IAAI,CAACC,gBAAgB,EAAE,OAAOC,cAAc;EACxE,MAAM;IAAEM;EAAW,CAAC,GAAGR,YAAY;EACnC,MAAM,GAAGS,SAAS,CAAC,GAAGL,MAAM,CAACM,KAAK,CAAC,GAAG,CAAC;EACvC,IAAI,CAACF,UAAU,IAAI,CAACC,SAAS,EAAE,OAAOP,cAAc;EACpD,MAAMS,UAAU,GAAGC,MAAM,CAACC,IAAI,CAACL,UAAU,CAAC,CAACH,IAAI,CAC7CS,OAAO,IACLN,UAAU,CAACM,OAAO,CAAC,IACnBN,UAAU,CAACM,OAAO,CAAC,CAACC,QAAQ,IAC5BP,UAAU,CAACM,OAAO,CAAC,CAACC,QAAQ,CAACC,gBAAgB,KAAKP,SACtD,CAAC;EACD,MAAMQ,YAAY,GAAGhB,gBAAgB,CAACU,UAAU,CAAC;EACjD,IAAI,CAACM,YAAY,EAAE,OAAOf,cAAc;EACxC,MAAMgB,qBAAqB,GAAG,CAAC,GAAGhB,cAAc,CAAC;EACjD,IAAIiB,KAAK,CAACC,OAAO,CAACH,YAAY,CAAC,EAAE;IAC/BA,YAAY,CAACI,OAAO,CAACC,KAAK,IAAI;MAC5BJ,qBAAqB,CAACK,IAAI,CAAC;QAAEC,YAAY,EAAE,CAACF,KAAK;MAAE,CAAC,CAAC;IACvD,CAAC,CAAC;EACJ,CAAC,MAAM;IACLJ,qBAAqB,CAACK,IAAI,CAAC;MAAEC,YAAY,EAAE,CAACP,YAAY;IAAE,CAAC,CAAC;EAC9D;EACA,OAAOC,qBAAqB;AAC9B,CAAC;AAED,eAAenB,wBAAwB"}
@@ -6,4 +6,5 @@ export { default as filterQuerySetup } from './filter-query-setup';
6
6
  export { default as shouldReturn } from './should-return';
7
7
  export { default as shouldSkipSingleQuery } from './should-skip-single-query';
8
8
  export { default as getUpdatedSortProperties } from './get-updated-sort-properties';
9
+ export { default as getUpdatedItemsToDisplay } from './get-updated-items-to-display';
9
10
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["default","getPublishedListingUrl","useDynamicSizeKey","getDynamicGridClasses","filtersSetup","filterQuerySetup","shouldReturn","shouldSkipSingleQuery","getUpdatedSortProperties"],"sources":["../../../../src/components/Card/helpers/index.js"],"sourcesContent":["export { default as getPublishedListingUrl } from './get-published-listing-url';\nexport { default as useDynamicSizeKey } from './use-dynamic-size-key';\nexport { default as getDynamicGridClasses } from './get-dynamic-grid-classes';\nexport { default as filtersSetup } from './filters-setup';\nexport { default as filterQuerySetup } from './filter-query-setup';\nexport { default as shouldReturn } from './should-return';\nexport { default as shouldSkipSingleQuery } from './should-skip-single-query';\nexport { default as getUpdatedSortProperties } from './get-updated-sort-properties';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,sBAAsB,QAAQ,6BAA6B;AAC/E,SAASD,OAAO,IAAIE,iBAAiB,QAAQ,wBAAwB;AACrE,SAASF,OAAO,IAAIG,qBAAqB,QAAQ,4BAA4B;AAC7E,SAASH,OAAO,IAAII,YAAY,QAAQ,iBAAiB;AACzD,SAASJ,OAAO,IAAIK,gBAAgB,QAAQ,sBAAsB;AAClE,SAASL,OAAO,IAAIM,YAAY,QAAQ,iBAAiB;AACzD,SAASN,OAAO,IAAIO,qBAAqB,QAAQ,4BAA4B;AAC7E,SAASP,OAAO,IAAIQ,wBAAwB,QAAQ,+BAA+B"}
1
+ {"version":3,"file":"index.js","names":["default","getPublishedListingUrl","useDynamicSizeKey","getDynamicGridClasses","filtersSetup","filterQuerySetup","shouldReturn","shouldSkipSingleQuery","getUpdatedSortProperties","getUpdatedItemsToDisplay"],"sources":["../../../../src/components/Card/helpers/index.js"],"sourcesContent":["export { default as getPublishedListingUrl } from './get-published-listing-url';\nexport { default as useDynamicSizeKey } from './use-dynamic-size-key';\nexport { default as getDynamicGridClasses } from './get-dynamic-grid-classes';\nexport { default as filtersSetup } from './filters-setup';\nexport { default as filterQuerySetup } from './filter-query-setup';\nexport { default as shouldReturn } from './should-return';\nexport { default as shouldSkipSingleQuery } from './should-skip-single-query';\nexport { default as getUpdatedSortProperties } from './get-updated-sort-properties';\nexport { default as getUpdatedItemsToDisplay } from './get-updated-items-to-display';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,sBAAsB,QAAQ,6BAA6B;AAC/E,SAASD,OAAO,IAAIE,iBAAiB,QAAQ,wBAAwB;AACrE,SAASF,OAAO,IAAIG,qBAAqB,QAAQ,4BAA4B;AAC7E,SAASH,OAAO,IAAII,YAAY,QAAQ,iBAAiB;AACzD,SAASJ,OAAO,IAAIK,gBAAgB,QAAQ,sBAAsB;AAClE,SAASL,OAAO,IAAIM,YAAY,QAAQ,iBAAiB;AACzD,SAASN,OAAO,IAAIO,qBAAqB,QAAQ,4BAA4B;AAC7E,SAASP,OAAO,IAAIQ,wBAAwB,QAAQ,+BAA+B;AACnF,SAASR,OAAO,IAAIS,wBAAwB,QAAQ,gCAAgC"}
@@ -9,8 +9,8 @@ const SmoothScrollCarousel = ({
9
9
  }) => {
10
10
  const wrapperClassName = `cards-carousel-smooth${bannerModifier}`;
11
11
  const contentClassName = `cards-carousel--content smooth-scroll items-per-row-${itemsPerRow}`;
12
- const aimationTime = autoScrollTimer * numberOfCards / 1000;
13
- const animationDuration = `${aimationTime < 1 ? 1 : aimationTime}s`;
12
+ const animationTime = autoScrollTimer * numberOfCards / 1000;
13
+ const animationDuration = `${animationTime < 1 ? 1 : animationTime}s`;
14
14
  return /*#__PURE__*/React.createElement("div", {
15
15
  className: wrapperClassName
16
16
  }, /*#__PURE__*/React.createElement("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"SmoothScrollCarousel.js","names":["React","PropTypes","SmoothScrollCarousel","children","bannerModifier","itemsPerRow","autoScrollTimer","numberOfCards","wrapperClassName","contentClassName","aimationTime","animationDuration","createElement","className","style","propTypes","string","number","oneOfType","arrayOf","node","defaultProps"],"sources":["../../../src/components/CarouselWrapper/SmoothScrollCarousel.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst SmoothScrollCarousel = ({\n children,\n bannerModifier,\n itemsPerRow,\n autoScrollTimer,\n numberOfCards\n}) => {\n const wrapperClassName = `cards-carousel-smooth${bannerModifier}`;\n const contentClassName = `cards-carousel--content smooth-scroll items-per-row-${itemsPerRow}`;\n const aimationTime = (autoScrollTimer * numberOfCards) / 1000;\n const animationDuration = `${aimationTime < 1 ? 1 : aimationTime}s`;\n\n return (\n <div className={wrapperClassName}>\n <div className={contentClassName} style={{ animationDuration }}>\n {children}\n </div>\n <div className={contentClassName} style={{ animationDuration }}>\n {children}\n </div>\n </div>\n );\n};\n\nSmoothScrollCarousel.propTypes = {\n bannerModifier: PropTypes.string,\n itemsPerRow: PropTypes.number,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n autoScrollTimer: PropTypes.number,\n numberOfCards: PropTypes.number\n};\n\nSmoothScrollCarousel.defaultProps = {\n itemsPerRow: 0,\n bannerModifier: '',\n children: [],\n autoScrollTimer: 0,\n numberOfCards: 1\n};\n\nexport default SmoothScrollCarousel;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAElC,MAAMC,oBAAoB,GAAGA,CAAC;EAC5BC,QAA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Row","autoScrollTimer","numberOfCards","wrapperClassName","contentClassName","animationTime","animationDuration","createElement","className","style","propTypes","string","number","oneOfType","arrayOf","node","defaultProps"],"sources":["../../../src/components/CarouselWrapper/SmoothScrollCarousel.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\n\nconst SmoothScrollCarousel = ({\n children,\n bannerModifier,\n itemsPerRow,\n autoScrollTimer,\n numberOfCards\n}) => {\n const wrapperClassName = `cards-carousel-smooth${bannerModifier}`;\n const contentClassName = `cards-carousel--content smooth-scroll items-per-row-${itemsPerRow}`;\n const animationTime = (autoScrollTimer * numberOfCards) / 1000;\n const animationDuration = `${animationTime < 1 ? 1 : animationTime}s`;\n\n return (\n <div className={wrapperClassName}>\n <div className={contentClassName} style={{ animationDuration }}>\n {children}\n </div>\n <div className={contentClassName} style={{ animationDuration }}>\n {children}\n </div>\n </div>\n );\n};\n\nSmoothScrollCarousel.propTypes = {\n bannerModifier: PropTypes.string,\n itemsPerRow: PropTypes.number,\n children: PropTypes.oneOfType([PropTypes.arrayOf(PropTypes.node), PropTypes.node]),\n autoScrollTimer: PropTypes.number,\n numberOfCards: PropTypes.number\n};\n\nSmoothScrollCarousel.defaultProps = {\n itemsPerRow: 0,\n bannerModifier: '',\n children: [],\n autoScrollTimer: 0,\n numberOfCards: 1\n};\n\nexport default SmoothScrollCarousel;\n"],"mappings":"AAAA,OAAOA,KAAK,MAAM,OAAO;AACzB,OAAOC,SAAS,MAAM,YAAY;AAElC,MAAMC,oBAAoB,GAAGA,CAAC;EAC5BC,QAAQ;EACRC,cAAc;EACdC,WAAW;EACXC,eAAe;EACfC;AACF,CAAC,KAAK;EACJ,MAAMC,gBAAgB,GAAI,wBAAuBJ,cAAe,EAAC;EACjE,MAAMK,gBAAgB,GAAI,uDAAsDJ,WAAY,EAAC;EAC7F,MAAMK,aAAa,GAAIJ,eAAe,GAAGC,aAAa,GAAI,IAAI;EAC9D,MAAMI,iBAAiB,GAAI,GAAED,aAAa,GAAG,CAAC,GAAG,CAAC,GAAGA,aAAc,GAAE;EAErE,oBACEV,KAAA,CAAAY,aAAA;IAAKC,SAAS,EAAEL;EAAiB,gBAC/BR,KAAA,CAAAY,aAAA;IAAKC,SAAS,EAAEJ,gBAAiB;IAACK,KAAK,EAAE;MAAEH;IAAkB;EAAE,GAC5DR,QACE,CAAC,eACNH,KAAA,CAAAY,aAAA;IAAKC,SAAS,EAAEJ,gBAAiB;IAACK,KAAK,EAAE;MAAEH;IAAkB;EAAE,GAC5DR,QACE,CACF,CAAC;AAEV,CAAC;AAEDD,oBAAoB,CAACa,SAAS,GAAG;EAC/BX,cAAc,EAAEH,SAAS,CAACe,MAAM;EAChCX,WAAW,EAAEJ,SAAS,CAACgB,MAAM;EAC7Bd,QAAQ,EAAEF,SAAS,CAACiB,SAAS,CAAC,CAACjB,SAAS,CAACkB,OAAO,CAAClB,SAAS,CAACmB,IAAI,CAAC,EAAEnB,SAAS,CAACmB,IAAI,CAAC,CAAC;EAClFd,eAAe,EAAEL,SAAS,CAACgB,MAAM;EACjCV,aAAa,EAAEN,SAAS,CAACgB;AAC3B,CAAC;AAEDf,oBAAoB,CAACmB,YAAY,GAAG;EAClChB,WAAW,EAAE,CAAC;EACdD,cAAc,EAAE,EAAE;EAClBD,QAAQ,EAAE,EAAE;EACZG,eAAe,EAAE,CAAC;EAClBC,aAAa,EAAE;AACjB,CAAC;AAED,eAAeL,oBAAoB"}
@@ -1,6 +1,6 @@
1
1
  import _defineProperty from "@babel/runtime/helpers/defineProperty";
2
2
  import _objectWithoutProperties from "@babel/runtime/helpers/objectWithoutProperties";
3
- const _excluded = ["code", "parserOptions"];
3
+ const _excluded = ["code", "parserOptions", "disableWrapper"];
4
4
  function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
5
5
  function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
6
6
  import React, { memo } from 'react';
@@ -14,13 +14,15 @@ import { wrapScriptTags } from './helpers';
14
14
  const Code = memo(_ref => {
15
15
  let {
16
16
  code: embedCode,
17
- parserOptions
17
+ parserOptions,
18
+ disableWrapper
18
19
  } = _ref,
19
20
  otherProps = _objectWithoutProperties(_ref, _excluded);
20
21
  if (!embedCode) return null;
21
22
  const parsedCode = parseHTML(embedCode, parserOptions);
22
23
  const wrappedCode = wrapScriptTags(parsedCode);
23
24
  const modifiers = getClassModifiers(CODE, _objectSpread({}, otherProps));
25
+ if (disableWrapper) return wrappedCode;
24
26
  return /*#__PURE__*/React.createElement(Wrapper, {
25
27
  modifiers: modifiers
26
28
  }, wrappedCode);
@@ -28,12 +30,14 @@ const Code = memo(_ref => {
28
30
  Code.propTypes = {
29
31
  code: PropTypes.string,
30
32
  modifier: PropTypes.string,
31
- parserOptions: PropTypes.object
33
+ parserOptions: PropTypes.object,
34
+ disableWrapper: PropTypes.bool
32
35
  };
33
36
  Code.defaultProps = {
34
37
  code: '',
35
38
  modifier: '',
36
- parserOptions: {}
39
+ parserOptions: {},
40
+ disableWrapper: false
37
41
  };
38
42
  export default withTitle(Code);
39
43
  //# sourceMappingURL=Code.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"Code.js","names":["React","memo","PropTypes","parseHTML","Wrapper","withTitle","getClassModifiers","CODE","wrapScriptTags","Code","_ref","code","embedCode","parserOptions","otherProps","_objectWithoutProperties","_excluded","parsedCode","wrappedCode","modifiers","_objectSpread","createElement","propTypes","string","modifier","object","defaultProps"],"sources":["../../../src/components/Code/Code.js"],"sourcesContent":["import React, { memo } from 'react';\nimport PropTypes from 'prop-types';\nimport parseHTML from 'html-react-parser';\nimport Wrapper from '../Wrapper';\nimport { withTitle } from '../../HOC';\nimport { getClassModifiers } from '../../utils';\nimport { CODE } from '../../constants';\nimport { wrapScriptTags } from './helpers';\n\nconst Code = memo(({ code: embedCode, parserOptions, ...otherProps }) => {\n if (!embedCode) return null;\n\n const parsedCode = parseHTML(embedCode, parserOptions);\n const wrappedCode = wrapScriptTags(parsedCode);\n const modifiers = getClassModifiers(CODE, { ...otherProps });\n\n return <Wrapper modifiers={modifiers}>{wrappedCode}</Wrapper>;\n});\n\nCode.propTypes = {\n code: PropTypes.string,\n modifier: PropTypes.string,\n parserOptions: PropTypes.object\n};\n\nCode.defaultProps = {\n code: '',\n modifier: '',\n parserOptions: {}\n};\n\nexport default withTitle(Code);\n"],"mappings":";;;;;AAAA,OAAOA,KAAK,IAAIC,IAAI,QAAQ,OAAO;AACnC,OAAOC,SAAS,MAAM,YAAY;AAClC,OAAOC,SAAS,MAAM,mBAAmB;AACzC,OAAOC,OAAO,MAAM,YAAY;AAChC,SAASC,SAAS,QAAQ,WAAW;AACrC,SAASC,iBAAiB,QAAQ,aAAa;AAC/C,SAASC,IAAI,QAAQ,iBAAiB;AACtC,SAASC,cAAc,QAAQ,WAAW;AAE1C,MAAMC,IAAI,GAAGR,IAAI,CAACS,IAAA,IAAuD;EAAA,IAAtD;MAAEC,IAAI,EAAEC,SAAS;MAAEC;IAA6B,CAAC,GAAAH,IAAA;IAAZI,UAAU,GAAAC,wBAAA,CAAAL,IAAA,EAAAM,SAAA;EAChE,IAAI,CAACJ,SAAS,EAAE,OAAO,IAAI;EAE3B,MAAMK,UAAU,GAAGd,SAAS,CAACS,SAAS,EAAEC,aAAa,CAAC;EACtD,MAAMK,WAAW,GAAGV,cAAc,CAACS,UAAU,CAAC;EAC9C,MAAME,SAAS,GAAGb,iBAAiB,CAACC,IAAI,EAAAa,aAAA,KAAON,UAAU,CAAE,CAAC;EAE5D,oBAAOd,KAAA,CAAAqB,aAAA,CAACjB,OAAO;IAACe,SAAS,EAAEA;EAAU,GAAED,WAAqB,CAAC;AAC/D,CAAC,CAAC;AAEFT,IAAI,CAACa,SAAS,GAAG;EACfX,IAAI,EAAET,SAAS,CAACqB,MAAM;EACtBC,QAAQ,EAAEtB,SAAS,CAACqB,MAAM;EAC1BV,aAAa,EAAEX,SAAS,CAACuB;AAC3B,CAAC;AAEDhB,IAAI,CAACiB,YAAY,GAAG;EAClBf,IAAI,EAAE,EAAE;EACRa,QAAQ,EAAE,EAAE;EACZX,aAAa,EAAE,CAAC;AAClB,CAAC;AAED,eAAeR,SAAS,CAACI,IAAI,CAAC"}
1
+ {"version":3,"file":"Code.js","names":["React","memo","PropTypes","parseHTML","Wrapper","withTitle","getClassModifiers","CODE","wrapScriptTags","Code","_ref","code","embedCode","parserOptions","disableWrapper","otherProps","_objectWithoutProperties","_excluded","parsedCode","wrappedCode","modifiers","_objectSpread","createElement","propTypes","string","modifier","object","bool","defaultProps"],"sources":["../../../src/components/Code/Code.js"],"sourcesContent":["import React, { memo } from 'react';\nimport PropTypes from 'prop-types';\nimport parseHTML from 'html-react-parser';\nimport Wrapper from '../Wrapper';\nimport { withTitle } from '../../HOC';\nimport { getClassModifiers } from '../../utils';\nimport { CODE } from '../../constants';\nimport { wrapScriptTags } from './helpers';\n\nconst Code = memo(({ code: embedCode, parserOptions, disableWrapper, ...otherProps }) => {\n if (!embedCode) return null;\n\n const parsedCode = parseHTML(embedCode, parserOptions);\n const wrappedCode = wrapScriptTags(parsedCode);\n const modifiers = getClassModifiers(CODE, { ...otherProps });\n\n if (disableWrapper) return wrappedCode;\n\n return <Wrapper modifiers={modifiers}>{wrappedCode}</Wrapper>;\n});\n\nCode.propTypes = {\n code: PropTypes.string,\n modifier: PropTypes.string,\n parserOptions: PropTypes.object,\n disableWrapper: PropTypes.bool\n};\n\nCode.defaultProps = {\n code: '',\n modifier: '',\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,CAAC,CAAC;EACjBC,cAAc,EAAE;AAClB,CAAC;AAED,eAAeT,SAAS,CAACI,IAAI,CAAC"}
@@ -3,6 +3,7 @@ import flatten from 'lodash.flatten';
3
3
  import getLinkToPublishedContent from './get-link-to-published-content';
4
4
  import getLoopPropsLimit from './get-loop-props-limit';
5
5
  import getPropValue from './get-prop-value';
6
+ import { processDataSummaryValue } from '../../../helpers';
6
7
  const getLoopValue = value => {
7
8
  const {
8
9
  keyField
@@ -43,10 +44,12 @@ const buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, d
43
44
  } = options;
44
45
  return propertiesToDisplay.map(key => {
45
46
  const loopValue = loopValues[key];
46
- const propValue = loopValue ? getLoopValue(loopValue[i]) : regularValues[key];
47
+ const loopValueItem = loopValue && loopValue[i];
48
+ const propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];
47
49
  if (!propValue) return null;
48
- const linkToPublishedContent = getLinkToPublishedContent(key, data);
49
- return [upperFirst(label), propValue, linkToPublishedContent, modifier];
50
+ const processedValue = processDataSummaryValue(propValue, options);
51
+ const linkToPublishedContent = getLinkToPublishedContent(key, data, loopValueItem);
52
+ return [upperFirst(label), processedValue, linkToPublishedContent, modifier];
50
53
  });
51
54
  })).filter(Boolean);
52
55
  loopPropsWithContent.push(propsArray);
@@ -1 +1 @@
1
- {"version":3,"file":"build-loop-props-content.js","names":["upperFirst","flatten","getLinkToPublishedContent","getLoopPropsLimit","getPropValue","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","limit","loopPropsWithContent","loopLimit","i","propsArray","map","label","modifier","key","loopValue","propValue","linkToPublishedContent","filter","Boolean","push"],"sources":["../../../../src/components/DataSummary/helpers/build-loop-props-content.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport flatten from 'lodash.flatten';\nimport getLinkToPublishedContent from './get-link-to-published-content';\nimport getLoopPropsLimit from './get-loop-props-limit';\nimport getPropValue from './get-prop-value';\n\nconst getLoopValue = value => {\n const { keyField } = value;\n return value[keyField];\n};\n\nconst separateValues = (propsToDisplay, loopProps, data) => {\n const regularValues = {};\n const loopValues = {};\n\n propsToDisplay.forEach(options => {\n const { propertiesToDisplay } = options;\n propertiesToDisplay.forEach(prop => {\n const value = getPropValue(prop, data, options);\n const isArrayValue = Array.isArray(value);\n if (!value) return;\n const isLoopableProp = loopProps.includes(prop) && isArrayValue;\n\n if (isLoopableProp) {\n loopValues[prop] = value;\n } else {\n regularValues[prop] = value;\n }\n });\n });\n return [regularValues, loopValues];\n};\n\nconst buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, data = {}) => {\n const loopPropsWithContent = [];\n const [regularValues, loopValues] = separateValues(propsToDisplay, loopProps, data);\n\n const loopLimit = getLoopPropsLimit(loopValues, limit);\n\n for (let i = 0; i < loopLimit; i += 1) {\n const propsArray = flatten(\n propsToDisplay.map(options => {\n const { propertiesToDisplay, label, modifier = '' } = options;\n\n return propertiesToDisplay.map(key => {\n const loopValue = loopValues[key];\n const propValue = loopValue ? getLoopValue(loopValue[i]) : regularValues[key];\n if (!propValue) return null;\n const linkToPublishedContent = getLinkToPublishedContent(key, data);\n return [upperFirst(label), propValue, linkToPublishedContent, modifier];\n });\n })\n ).filter(Boolean);\n loopPropsWithContent.push(propsArray);\n }\n\n return flatten(loopPropsWithContent);\n};\n\nexport default buildLoopPropsContent;\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,mBAAmB;AAC1C,OAAOC,OAAO,MAAM,gBAAgB;AACpC,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,OAAOC,YAAY,MAAM,kBAAkB;AAE3C,MAAMC,YAAY,GAAGC,KAAK,IAAI;EAC5B,MAAM;IAAEC;EAAS,CAAC,GAAGD,KAAK;EAC1B,OAAOA,KAAK,CAACC,QAAQ,CAAC;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AAG3B,OAAO,CACxBQ,cAAc,CAACoB,GAAG,CAACd,OAAO,IAAI;MAC5B,MAAM;QAAEC,mBAAmB;QAAEc,KAAK;QAAEC,QAAQ,GAAG;MAAG,CAAC,GAAGhB,OAAO;MAE7D,OAAOC,mBAAmB,CAACa,GAAG,CAACG,GAAG,IAAI;QACpC,MAAMC,SAAS,GAAGpB,UAAU,CAACmB,GAAG,CAAC;QACjC,MAAME,SAAS,GAAGD,SAAS,GAAG5B,YAAY,CAAC4B,SAAS,CAACN,CAAC,CAAC,CAAC,GAAGf,aAAa,CAACoB,GAAG,CAAC;QAC7E,IAAI,CAACE,SAAS,EAAE,OAAO,IAAI;QAC3B,MAAMC,sBAAsB,GAAGjC,yBAAyB,CAAC8B,GAAG,EAAErB,IAAI,CAAC;QACnE,OAAO,CAACX,UAAU,CAAC8B,KAAK,CAAC,EAAEI,SAAS,EAAEC,sBAAsB,EAAEJ,QAAQ,CAAC;MACzE,CAAC,CAAC;IACJ,CAAC,CACH,CAAC,CAACK,MAAM,CAACC,OAAO,CAAC;IACjBZ,oBAAoB,CAACa,IAAI,CAACV,UAAU,CAAC;EACvC;EAEA,OAAO3B,OAAO,CAACwB,oBAAoB,CAAC;AACtC,CAAC;AAED,eAAeF,qBAAqB"}
1
+ {"version":3,"file":"build-loop-props-content.js","names":["upperFirst","flatten","getLinkToPublishedContent","getLoopPropsLimit","getPropValue","processDataSummaryValue","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","limit","loopPropsWithContent","loopLimit","i","propsArray","map","label","modifier","key","loopValue","loopValueItem","propValue","processedValue","linkToPublishedContent","filter","Boolean","push"],"sources":["../../../../src/components/DataSummary/helpers/build-loop-props-content.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport flatten from 'lodash.flatten';\nimport getLinkToPublishedContent from './get-link-to-published-content';\nimport getLoopPropsLimit from './get-loop-props-limit';\nimport getPropValue from './get-prop-value';\nimport { processDataSummaryValue } from '../../../helpers';\n\nconst getLoopValue = value => {\n const { keyField } = value;\n return value[keyField];\n};\n\nconst separateValues = (propsToDisplay, loopProps, data) => {\n const regularValues = {};\n const loopValues = {};\n\n propsToDisplay.forEach(options => {\n const { propertiesToDisplay } = options;\n propertiesToDisplay.forEach(prop => {\n const value = getPropValue(prop, data, options);\n const isArrayValue = Array.isArray(value);\n if (!value) return;\n const isLoopableProp = loopProps.includes(prop) && isArrayValue;\n\n if (isLoopableProp) {\n loopValues[prop] = value;\n } else {\n regularValues[prop] = value;\n }\n });\n });\n return [regularValues, loopValues];\n};\n\nconst buildLoopPropsContent = (loopProps = [], propsToDisplay = [], limit = 0, data = {}) => {\n const loopPropsWithContent = [];\n const [regularValues, loopValues] = separateValues(propsToDisplay, loopProps, data);\n\n const loopLimit = getLoopPropsLimit(loopValues, limit);\n\n for (let i = 0; i < loopLimit; i += 1) {\n const propsArray = flatten(\n propsToDisplay.map(options => {\n const { propertiesToDisplay, label, modifier = '' } = options;\n\n return propertiesToDisplay.map(key => {\n const loopValue = loopValues[key];\n const loopValueItem = loopValue && loopValue[i];\n const propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];\n if (!propValue) return null;\n\n const processedValue = processDataSummaryValue(propValue, options);\n const linkToPublishedContent = getLinkToPublishedContent(key, data, loopValueItem);\n return [upperFirst(label), processedValue, linkToPublishedContent, modifier];\n });\n })\n ).filter(Boolean);\n loopPropsWithContent.push(propsArray);\n }\n\n return flatten(loopPropsWithContent);\n};\n\nexport default buildLoopPropsContent;\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,mBAAmB;AAC1C,OAAOC,OAAO,MAAM,gBAAgB;AACpC,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,OAAOC,iBAAiB,MAAM,wBAAwB;AACtD,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,SAASC,uBAAuB,QAAQ,kBAAkB;AAE1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AC;EAEtD,KAAK,IAAIG,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGD,SAAS,EAAEC,CAAC,IAAI,CAAC,EAAE;IACrC,MAAMC,UAAU,GAAG5B,OAAO,CACxBS,cAAc,CAACoB,GAAG,CAACd,OAAO,IAAI;MAC5B,MAAM;QAAEC,mBAAmB;QAAEc,KAAK;QAAEC,QAAQ,GAAG;MAAG,CAAC,GAAGhB,OAAO;MAE7D,OAAOC,mBAAmB,CAACa,GAAG,CAACG,GAAG,IAAI;QACpC,MAAMC,SAAS,GAAGpB,UAAU,CAACmB,GAAG,CAAC;QACjC,MAAME,aAAa,GAAGD,SAAS,IAAIA,SAAS,CAACN,CAAC,CAAC;QAC/C,MAAMQ,SAAS,GAAGD,aAAa,GAAG7B,YAAY,CAAC6B,aAAa,CAAC,GAAGtB,aAAa,CAACoB,GAAG,CAAC;QAClF,IAAI,CAACG,SAAS,EAAE,OAAO,IAAI;QAE3B,MAAMC,cAAc,GAAGhC,uBAAuB,CAAC+B,SAAS,EAAEpB,OAAO,CAAC;QAClE,MAAMsB,sBAAsB,GAAGpC,yBAAyB,CAAC+B,GAAG,EAAErB,IAAI,EAAEuB,aAAa,CAAC;QAClF,OAAO,CAACnC,UAAU,CAAC+B,KAAK,CAAC,EAAEM,cAAc,EAAEC,sBAAsB,EAAEN,QAAQ,CAAC;MAC9E,CAAC,CAAC;IACJ,CAAC,CACH,CAAC,CAACO,MAAM,CAACC,OAAO,CAAC;IACjBd,oBAAoB,CAACe,IAAI,CAACZ,UAAU,CAAC;EACvC;EAEA,OAAO5B,OAAO,CAACyB,oBAAoB,CAAC;AACtC,CAAC;AAED,eAAeF,qBAAqB"}
@@ -1,6 +1,6 @@
1
1
  import upperFirst from 'lodash.upperfirst';
2
2
  import flatten from 'lodash.flatten';
3
- import { isObject } from '../../../helpers';
3
+ import { isObject, processDataSummaryValue } from '../../../helpers';
4
4
  import getLinkToPublishedContent from './get-link-to-published-content';
5
5
  import getPropValue from './get-prop-value';
6
6
  import getLinkBasedOnValue from './get-link-based-on-value';
@@ -25,8 +25,9 @@ const buildPropsToDisplayWithContent = (props, propsToDisplay = []) => {
25
25
  if (!key) return null;
26
26
  const objPropValue = getPropValue(key, props, options);
27
27
  if (!objPropValue) return null;
28
- const link = getLink(enableLink, key, props, objPropValue);
29
- return [upperFirst(label), objPropValue, link, modifier];
28
+ const processedValue = processDataSummaryValue(objPropValue, options);
29
+ const link = getLink(enableLink, key, props, processedValue);
30
+ return [upperFirst(label), processedValue, link, modifier];
30
31
  });
31
32
  })).filter(Boolean);
32
33
  };
@@ -1 +1 @@
1
- {"version":3,"file":"build-props-to-display-with-content.js","names":["upperFirst","flatten","isObject","getLinkToPublishedContent","getPropValue","getLinkBasedOnValue","buildPropsToDisplayWithContent","props","propsToDisplay","map","key","propValue","propName","split","join","filter","Boolean","options","propertiesToDisplay","label","modifier","enableLink","objPropValue","link","getLink"],"sources":["../../../../src/components/DataSummary/helpers/build-props-to-display-with-content.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport flatten from 'lodash.flatten';\nimport { isObject } from '../../../helpers';\nimport getLinkToPublishedContent from './get-link-to-published-content';\nimport getPropValue from './get-prop-value';\nimport getLinkBasedOnValue from './get-link-based-on-value';\n\nconst buildPropsToDisplayWithContent = (props, propsToDisplay = []) => {\n if (!isObject(propsToDisplay[0])) {\n return propsToDisplay\n .map(key => {\n if (!key) return null;\n const propValue = getPropValue(key, props);\n if (!propValue) return null;\n const propName = key.split('.').join(' ');\n return [upperFirst(propName), propValue, '', ''];\n })\n .filter(Boolean);\n }\n\n return flatten(\n propsToDisplay.map(options => {\n const { propertiesToDisplay, label, modifier = '', enableLink } = options;\n return propertiesToDisplay.map(key => {\n if (!key) return null;\n\n const objPropValue = getPropValue(key, props, options);\n if (!objPropValue) return null;\n\n const link = getLink(enableLink, key, props, objPropValue);\n\n return [upperFirst(label), objPropValue, link, modifier];\n });\n })\n ).filter(Boolean);\n};\n\nexport default buildPropsToDisplayWithContent;\nfunction getLink(enableLink, key, props, objPropValue) {\n let link = '';\n if (enableLink) {\n link = getLinkToPublishedContent(key, props);\n if (!link) {\n link = getLinkBasedOnValue(objPropValue);\n }\n }\n return link;\n}\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,mBAAmB;AAC1C,OAAOC,OAAO,MAAM,gBAAgB;AACpC,SAASC,QAAQ,QAAQ,kBAAkB;AAC3C,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,mBAAmB,MAAM,2BAA2B;AAE3D,MAAMC,8BAA8B,GAAGA,CAACC,KAAK,EAAEC,cAAc,GAAG,EAAE,KAAK;EACrE,IAAI,CAACN,QAAQ,CAACM,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE;IAChC,OAAOA,cAAc,CAClBC,GAAG,CAACC,GAAG,IAAI;MACV,IAAI,CAACA,GAAG,EAAE,OAAO,IAAI;MACrB,MAAMC,SAAS,GAAGP,YAAY,CAACM,GAAG,EAAEH,KAAK,CAAC;MAC1C,IAAI,CAACI,SAAS,EAAE,OAAO,IAAI;MAC3B,MAAMC,QAAQ,GAAGF,GAAG,CAACG,KAAK,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;MACzC,OAAO,CAACd,UAAU,CAACY,QAAQ,CAAC,EAAED,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC;IAClD,CAAC,CAAC,CACDI,MAAM,CAACC,OAAO,CAAC;EACpB;EAEA,OAAOf,OAAO,CACZO,cAAc,CAACC,GAAG,CAACQ,OAAO,IAAI;IAC5B,MAAM;MAAEC,mBAAmB;MAAEC,KAAK;MAAEC,QAAQ,GAAG,EAAE;MAAEC;IAAW,CAAC,GAAGJ,OAAO;IACzE,OAAOC,mBAAmB,CAACT,GAAG,CAACC,GAAG,IAAI;MACpC,IAAI,CAACA,GAAG,EAAE,OAAO,IAAI;MAErB,MAAMY,YAAY,GAAGlB,YAAY,CAACM,GAAG,EAAEH,KAAK,EAAEU,OAAO,CAAC;MACtD,IAAI,CAACK,YAAY,EAAE,OAAO,IAAI;MAE9B,MAAMC,IAAI,GAAGC,OAAO,CAACH,UAAU,EAAEX,GAAG,EAAEH,KAAK,EAAEe,YAAY,CAAC;MAE1D,OAAO,CAACtB,UAAU,CAACmB,KAAK,CAAC,EAAEG,YAAY,EAAEC,IAAI,EAAEH,QAAQ,CAAC;IAC1D,CAAC,CAAC;EACJ,CAAC,CACH,CAAC,CAACL,MAAM,CAACC,OAAO,CAAC;AACnB,CAAC;AAED,eAAeV,8BAA8B;AAC7C,SAASkB,OAAOA,CAACH,UAAU,EAAEX,GAAG,EAAEH,KAAK,EAAEe,YAAY,EAAE;EACrD,IAAIC,IAAI,GAAG,EAAE;EACb,IAAIF,UAAU,EAAE;IACdE,IAAI,GAAGpB,yBAAyB,CAACO,GAAG,EAAEH,KAAK,CAAC;IAC5C,IAAI,CAACgB,IAAI,EAAE;MACTA,IAAI,GAAGlB,mBAAmB,CAACiB,YAAY,CAAC;IAC1C;EACF;EACA,OAAOC,IAAI;AACb"}
1
+ {"version":3,"file":"build-props-to-display-with-content.js","names":["upperFirst","flatten","isObject","processDataSummaryValue","getLinkToPublishedContent","getPropValue","getLinkBasedOnValue","buildPropsToDisplayWithContent","props","propsToDisplay","map","key","propValue","propName","split","join","filter","Boolean","options","propertiesToDisplay","label","modifier","enableLink","objPropValue","processedValue","link","getLink"],"sources":["../../../../src/components/DataSummary/helpers/build-props-to-display-with-content.js"],"sourcesContent":["import upperFirst from 'lodash.upperfirst';\nimport flatten from 'lodash.flatten';\nimport { isObject, processDataSummaryValue } from '../../../helpers';\nimport getLinkToPublishedContent from './get-link-to-published-content';\nimport getPropValue from './get-prop-value';\nimport getLinkBasedOnValue from './get-link-based-on-value';\n\nconst buildPropsToDisplayWithContent = (props, propsToDisplay = []) => {\n if (!isObject(propsToDisplay[0])) {\n return propsToDisplay\n .map(key => {\n if (!key) return null;\n const propValue = getPropValue(key, props);\n if (!propValue) return null;\n const propName = key.split('.').join(' ');\n return [upperFirst(propName), propValue, '', ''];\n })\n .filter(Boolean);\n }\n\n return flatten(\n propsToDisplay.map(options => {\n const { propertiesToDisplay, label, modifier = '', enableLink } = options;\n return propertiesToDisplay.map(key => {\n if (!key) return null;\n\n const objPropValue = getPropValue(key, props, options);\n if (!objPropValue) return null;\n\n const processedValue = processDataSummaryValue(objPropValue, options);\n\n const link = getLink(enableLink, key, props, processedValue);\n\n return [upperFirst(label), processedValue, link, modifier];\n });\n })\n ).filter(Boolean);\n};\n\nexport default buildPropsToDisplayWithContent;\n\nfunction getLink(enableLink, key, props, objPropValue) {\n let link = '';\n if (enableLink) {\n link = getLinkToPublishedContent(key, props);\n if (!link) {\n link = getLinkBasedOnValue(objPropValue);\n }\n }\n return link;\n}\n"],"mappings":"AAAA,OAAOA,UAAU,MAAM,mBAAmB;AAC1C,OAAOC,OAAO,MAAM,gBAAgB;AACpC,SAASC,QAAQ,EAAEC,uBAAuB,QAAQ,kBAAkB;AACpE,OAAOC,yBAAyB,MAAM,iCAAiC;AACvE,OAAOC,YAAY,MAAM,kBAAkB;AAC3C,OAAOC,mBAAmB,MAAM,2BAA2B;AAE3D,MAAMC,8BAA8B,GAAGA,CAACC,KAAK,EAAEC,cAAc,GAAG,EAAE,KAAK;EACrE,IAAI,CAACP,QAAQ,CAACO,cAAc,CAAC,CAAC,CAAC,CAAC,EAAE;IAChC,OAAOA,cAAc,CAClBC,GAAG,CAACC,GAAG,IAAI;MACV,IAAI,CAACA,GAAG,EAAE,OAAO,IAAI;MACrB,MAAMC,SAAS,GAAGP,YAAY,CAACM,GAAG,EAAEH,KAAK,CAAC;MAC1C,IAAI,CAACI,SAAS,EAAE,OAAO,IAAI;MAC3B,MAAMC,QAAQ,GAAGF,GAAG,CAACG,KAAK,CAAC,GAAG,CAAC,CAACC,IAAI,CAAC,GAAG,CAAC;MACzC,OAAO,CAACf,UAAU,CAACa,QAAQ,CAAC,EAAED,SAAS,EAAE,EAAE,EAAE,EAAE,CAAC;IAClD,CAAC,CAAC,CACDI,MAAM,CAACC,OAAO,CAAC;EACpB;EAEA,OAAOhB,OAAO,CACZQ,cAAc,CAACC,GAAG,CAACQ,OAAO,IAAI;IAC5B,MAAM;MAAEC,mBAAmB;MAAEC,KAAK;MAAEC,QAAQ,GAAG,EAAE;MAAEC;IAAW,CAAC,GAAGJ,OAAO;IACzE,OAAOC,mBAAmB,CAACT,GAAG,CAACC,GAAG,IAAI;MACpC,IAAI,CAACA,GAAG,EAAE,OAAO,IAAI;MAErB,MAAMY,YAAY,GAAGlB,YAAY,CAACM,GAAG,EAAEH,KAAK,EAAEU,OAAO,CAAC;MACtD,IAAI,CAACK,YAAY,EAAE,OAAO,IAAI;MAE9B,MAAMC,cAAc,GAAGrB,uBAAuB,CAACoB,YAAY,EAAEL,OAAO,CAAC;MAErE,MAAMO,IAAI,GAAGC,OAAO,CAACJ,UAAU,EAAEX,GAAG,EAAEH,KAAK,EAAEgB,cAAc,CAAC;MAE5D,OAAO,CAACxB,UAAU,CAACoB,KAAK,CAAC,EAAEI,cAAc,EAAEC,IAAI,EAAEJ,QAAQ,CAAC;IAC5D,CAAC,CAAC;EACJ,CAAC,CACH,CAAC,CAACL,MAAM,CAACC,OAAO,CAAC;AACnB,CAAC;AAED,eAAeV,8BAA8B;AAE7C,SAASmB,OAAOA,CAACJ,UAAU,EAAEX,GAAG,EAAEH,KAAK,EAAEe,YAAY,EAAE;EACrD,IAAIE,IAAI,GAAG,EAAE;EACb,IAAIH,UAAU,EAAE;IACdG,IAAI,GAAGrB,yBAAyB,CAACO,GAAG,EAAEH,KAAK,CAAC;IAC5C,IAAI,CAACiB,IAAI,EAAE;MACTA,IAAI,GAAGnB,mBAAmB,CAACiB,YAAY,CAAC;IAC1C;EACF;EACA,OAAOE,IAAI;AACb"}
@@ -1,6 +1,7 @@
1
- const getLinkToPublishedContent = (key = '', props = {}) => {
1
+ const getLinkToPublishedContent = (key = '', props = {}, currentValue = null) => {
2
2
  const [baseKey] = key.split('.');
3
3
  if (!props[baseKey]) return '';
4
+ if (currentValue && typeof currentValue.url !== 'undefined') return currentValue.url;
4
5
  const content = Array.isArray(props[baseKey]) ? props[baseKey][0] : props[baseKey];
5
6
  return content && content.url ? content.url : '';
6
7
  };
@@ -1 +1 @@
1
- {"version":3,"file":"get-link-to-published-content.js","names":["getLinkToPublishedContent","key","props","baseKey","split","content","Array","isArray","url"],"sources":["../../../../src/components/DataSummary/helpers/get-link-to-published-content.js"],"sourcesContent":["const getLinkToPublishedContent = (key = '', props = {}) => {\n const [baseKey] = key.split('.');\n if (!props[baseKey]) return '';\n const content = Array.isArray(props[baseKey]) ? props[baseKey][0] : props[baseKey];\n return content && content.url ? content.url : '';\n};\n\nexport default getLinkToPublishedContent;\n"],"mappings":"AAAA,MAAMA,yBAAyB,GAAGA,CAACC,GAAG,GAAG,EAAE,EAAEC,KAAK,GAAG,CAAC,CAAC,KAAK;EAC1D,MAAM,CAACC,OAAO,CAAC,GAAGF,GAAG,CAACG,KAAK,CAAC,GAAG,CAAC;EAChC,IAAI,CAACF,KAAK,CAACC,OAAO,CAAC,EAAE,OAAO,EAAE;EAC9B,MAAME,OAAO,GAAGC,KAAK,CAACC,OAAO,CAACL,KAAK,CAACC,OAAO,CAAC,CAAC,GAAGD,KAAK,CAACC,OAAO,CAAC,CAAC,CAAC,CAAC,GAAGD,KAAK,CAACC,OAAO,CAAC;EAClF,OAAOE,OAAO,IAAIA,OAAO,CAACG,GAAG,GAAGH,OAAO,CAACG,GAAG,GAAG,EAAE;AAClD,CAAC;AAED,eAAeR,yBAAyB"}
1
+ {"version":3,"file":"get-link-to-published-content.js","names":["getLinkToPublishedContent","key","props","currentValue","baseKey","split","url","content","Array","isArray"],"sources":["../../../../src/components/DataSummary/helpers/get-link-to-published-content.js"],"sourcesContent":["const getLinkToPublishedContent = (key = '', props = {}, currentValue = null) => {\n const [baseKey] = key.split('.');\n if (!props[baseKey]) return '';\n\n if (currentValue && typeof currentValue.url !== 'undefined') return currentValue.url;\n\n const content = Array.isArray(props[baseKey]) ? props[baseKey][0] : props[baseKey];\n return content && content.url ? content.url : '';\n};\n\nexport default getLinkToPublishedContent;\n"],"mappings":"AAAA,MAAMA,yBAAyB,GAAGA,CAACC,GAAG,GAAG,EAAE,EAAEC,KAAK,GAAG,CAAC,CAAC,EAAEC,YAAY,GAAG,IAAI,KAAK;EAC/E,MAAM,CAACC,OAAO,CAAC,GAAGH,GAAG,CAACI,KAAK,CAAC,GAAG,CAAC;EAChC,IAAI,CAACH,KAAK,CAACE,OAAO,CAAC,EAAE,OAAO,EAAE;EAE9B,IAAID,YAAY,IAAI,OAAOA,YAAY,CAACG,GAAG,KAAK,WAAW,EAAE,OAAOH,YAAY,CAACG,GAAG;EAEpF,MAAMC,OAAO,GAAGC,KAAK,CAACC,OAAO,CAACP,KAAK,CAACE,OAAO,CAAC,CAAC,GAAGF,KAAK,CAACE,OAAO,CAAC,CAAC,CAAC,CAAC,GAAGF,KAAK,CAACE,OAAO,CAAC;EAClF,OAAOG,OAAO,IAAIA,OAAO,CAACD,GAAG,GAAGC,OAAO,CAACD,GAAG,GAAG,EAAE;AAClD,CAAC;AAED,eAAeN,yBAAyB"}
@@ -10,7 +10,7 @@ import { MainContext } from '@blaze-cms/nextjs-components';
10
10
  import { generateSingleItemQuery, getItemList } from '../../application/query';
11
11
  import ListBuilder from './ListBuilder';
12
12
  import { AZ_LIST_TYPE } from './constants';
13
- import { getAzQueryFilter, getSortProps, hasRequiredItemListDetails } from './helpers';
13
+ import { getAzQueryFilter, getSortProps, hasRequiredItemListDetails, getListSpecificSearchFilter, getListQuery } from './helpers';
14
14
  import { getGenericProps, getRequiredSchemas, checkForError, getUnpublishedEntityName, getPaginationIndex, getSearchFilterType, getElasticsearchOperator, buildSearchValuesText, getQueryFilters, getInheritedFilters, getQueryProps } from '../../helpers';
15
15
  import { getItemListId, getItemListIds } from '../ItemList/helpers';
16
16
  import { useGetEntitySchemasAsObj } from '../../hooks';
@@ -27,7 +27,7 @@ const ListFactory = props => {
27
27
  type,
28
28
  sortby: defaultSortBy,
29
29
  sort: defaultSort,
30
- searchFilter,
30
+ allSearchFilters,
31
31
  operator: filterOperator,
32
32
  sortProperties,
33
33
  itemListName
@@ -40,15 +40,19 @@ const ListFactory = props => {
40
40
  asPath
41
41
  } = router;
42
42
  const parsedQuery = asPath.replace(/%5D/g, ']').replace(/%5B/g, '[');
43
+ const [searchFilter, hasListSpecificFilters] = getListSpecificSearchFilter(allSearchFilters, name);
43
44
  const {
44
45
  query,
45
46
  url,
46
47
  query: {
47
- sort: querySort,
48
- sortby: querySortBy,
49
48
  itemListId: queryItemListId
50
49
  } = {}
51
50
  } = parseUrl(parsedQuery);
51
+ const updatedQuery = getListQuery(query, hasListSpecificFilters, name);
52
+ const {
53
+ sort: querySort,
54
+ sortby: querySortBy
55
+ } = updatedQuery;
52
56
  const {
53
57
  sortbyFilters,
54
58
  updatedSortProperties
@@ -65,8 +69,8 @@ const ListFactory = props => {
65
69
  itemId: parentId
66
70
  } = parent;
67
71
  const updatedParentEntity = getUnpublishedEntityName(parentEntity);
68
- const paginationIndex = getPaginationIndex(query, name);
69
- const azFilter = getAzQueryFilter(query, name);
72
+ const paginationIndex = getPaginationIndex(updatedQuery, name);
73
+ const azFilter = getAzQueryFilter(updatedQuery, name);
70
74
  const entitiesToUse = entities && entities.length ? entities : [legacyEntity];
71
75
  const [filterEntity] = entitiesToUse;
72
76
  const {
@@ -131,19 +135,19 @@ const ListFactory = props => {
131
135
  const [textFilter] = getSearchFilterType(searchFilter, TEXT_SEARCH);
132
136
  const shouldApplyTextFilter = textFilter && textFilter.propsToDisplay.length;
133
137
  const operator = shouldApplyTextFilter ? getElasticsearchOperator(textFilter) : AND_OPERATOR;
134
- const valuesText = shouldApplyTextFilter ? buildSearchValuesText(textFilter, query) : [];
138
+ const valuesText = shouldApplyTextFilter ? buildSearchValuesText(textFilter, updatedQuery, name) : [];
135
139
  const {
136
140
  valuesAnd,
137
141
  valuesOr
138
- } = getQueryFilters(searchFilter, query);
139
- const isTextSearchFilterApplied = !!(query.search_term && searchFilter && getSearchFilterType(searchFilter, TEXT_SEARCH).length);
142
+ } = getQueryFilters(searchFilter, updatedQuery, name);
143
+ const isTextSearchFilterApplied = !!(updatedQuery.search_term && searchFilter && getSearchFilterType(searchFilter, TEXT_SEARCH).length);
140
144
  const searchValues = {
141
145
  searchValuesText: valuesText,
142
146
  searchValuesCheckboxSelectRange: valuesAnd,
143
147
  searchValuesCheckboxOr: valuesOr
144
148
  };
145
149
  const listProps = _objectSpread(_objectSpread(_objectSpread({}, props), genericProps), {}, {
146
- query,
150
+ query: updatedQuery,
147
151
  url,
148
152
  isCard,
149
153
  isAZ,
@@ -181,7 +185,7 @@ ListFactory.propTypes = {
181
185
  name: PropTypes.string,
182
186
  sortby: PropTypes.array,
183
187
  sort: PropTypes.string,
184
- searchFilter: PropTypes.object,
188
+ allSearchFilters: PropTypes.array,
185
189
  sortProperties: PropTypes.array,
186
190
  itemListName: PropTypes.string
187
191
  };
@@ -196,7 +200,7 @@ ListFactory.defaultProps = {
196
200
  sortProperties: [],
197
201
  sort: '',
198
202
  operator: AND,
199
- searchFilter: {},
203
+ allSearchFilters: [],
200
204
  itemListName: ''
201
205
  };
202
206
  export default ListFactory;