@blaze-cms/react-page-builder 0.131.0 → 0.132.0-admin-updates.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (229) hide show
  1. package/CHANGELOG.md +38 -0
  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/SearchFilter/__snapshots__/SearchFilterContainer.test.js.snap +1 -7
  204. package/tests/unit/src/components/SearchFilter/helpers/build-new-query.test.js +10 -10
  205. package/tests/unit/src/components/SearchFilter/helpers/build-query.test.js +24 -7
  206. package/tests/unit/src/components/SearchFilter/helpers/get-initial-filter-values.test.js +10 -10
  207. package/tests/unit/src/components/SearchFilterSort/SearchFilterSort.test.js +4 -1
  208. package/tests/unit/src/components/SearchFilterSort/helpers/handle-sort-update.test.js +26 -19
  209. package/tests/unit/src/components/SearchFilterSort/helpers/update-sort.test.js +10 -1
  210. package/tests/unit/src/helpers/__snapshots__/get-wrapped-value-with-link.test.js.snap +18 -0
  211. package/tests/unit/src/helpers/build-props-query.test.js +25 -0
  212. package/tests/unit/src/helpers/get-wrapped-value-with-link.test.js +2 -2
  213. package/tests/unit/src/helpers/parse-props-to-display.test.js +4 -0
  214. package/tests/unit/src/helpers/prcoess-data-summary-value.test.js +52 -0
  215. package/lib/components/SearchFilter/helpers/build-new-query.js +0 -15
  216. package/lib/components/SearchFilter/helpers/build-new-query.js.map +0 -1
  217. package/lib/components/SearchFilter/helpers/build-query.js +0 -37
  218. package/lib/components/SearchFilter/helpers/build-query.js.map +0 -1
  219. package/lib/components/SearchFilter/helpers/get-initial-filter-values.js +0 -43
  220. package/lib/components/SearchFilter/helpers/get-initial-filter-values.js.map +0 -1
  221. package/lib-es/components/SearchFilter/helpers/build-new-query.js +0 -6
  222. package/lib-es/components/SearchFilter/helpers/build-new-query.js.map +0 -1
  223. package/lib-es/components/SearchFilter/helpers/build-query.js +0 -23
  224. package/lib-es/components/SearchFilter/helpers/build-query.js.map +0 -1
  225. package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js +0 -26
  226. package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js.map +0 -1
  227. package/src/components/SearchFilter/helpers/build-new-query.js +0 -6
  228. package/src/components/SearchFilter/helpers/build-query.js +0 -26
  229. package/src/components/SearchFilter/helpers/get-initial-filter-values.js +0 -30
package/CHANGELOG.md CHANGED
@@ -3,6 +3,44 @@
3
3
  All notable changes to this project will be documented in this file.
4
4
  See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
5
5
 
6
+ # [0.132.0-admin-updates.0](https://github.com/thebyte9/blaze/compare/v0.131.0...v0.132.0-admin-updates.0) (2023-07-27)
7
+
8
+
9
+ ### Bug Fixes
10
+
11
+ * add collapse property to searchContent ([#3964](https://github.com/thebyte9/blaze/issues/3964)) ([3703a29](https://github.com/thebyte9/blaze/commit/3703a29d9a838f857863430d9223025900f29880))
12
+ * add collapse property to searchContent ([#3964](https://github.com/thebyte9/blaze/issues/3964)) ([d133a19](https://github.com/thebyte9/blaze/commit/d133a1965fdb447824dfdb87566809d7597a24b2))
13
+ * add second render ([488b2b6](https://github.com/thebyte9/blaze/commit/488b2b65b437db9beff90eaf38f6a8d2dc30f3a9))
14
+ * added logout handling for button ([#3983](https://github.com/thebyte9/blaze/issues/3983)) ([f634575](https://github.com/thebyte9/blaze/commit/f634575cd6865dbc23391634c177efe4826d44c6))
15
+ * added logout handling for button ([#3983](https://github.com/thebyte9/blaze/issues/3983)) ([1940547](https://github.com/thebyte9/blaze/commit/19405477315238fe8b14c974645675ec285ee85a))
16
+ * carousel - set min width to the content ([7313a94](https://github.com/thebyte9/blaze/commit/7313a947d816716c607afaed6eaa61c3f26b0e89))
17
+ * handle data summary urls in loops correctly ([#3993](https://github.com/thebyte9/blaze/issues/3993)) ([008e1a1](https://github.com/thebyte9/blaze/commit/008e1a1f24f065b4060302c2c32d1aa32dd8a007))
18
+ * hash bits now persists through filter changes ([#3965](https://github.com/thebyte9/blaze/issues/3965)) ([e0c37fc](https://github.com/thebyte9/blaze/commit/e0c37fcff2479f531f2f337b4e98b4edf57b4795))
19
+ * hash bits now persists through filter changes ([#3965](https://github.com/thebyte9/blaze/issues/3965)) ([04e4cb3](https://github.com/thebyte9/blaze/commit/04e4cb380520ea7c9b20860bf9cb4ea2facd27ad))
20
+ * hlist component andle when no search filter ([#3982](https://github.com/thebyte9/blaze/issues/3982)) ([268eddc](https://github.com/thebyte9/blaze/commit/268eddcc71d42b3d63770554684bf79a5f163b7e))
21
+ * hlist component andle when no search filter ([#3982](https://github.com/thebyte9/blaze/issues/3982)) ([e9e1a6d](https://github.com/thebyte9/blaze/commit/e9e1a6da969d9afc5f9ddaffcb7bf2238c84d898))
22
+ * improve animation ([b9111b5](https://github.com/thebyte9/blaze/commit/b9111b59f9f297f5b4701bf5c42b0acd718d9985))
23
+ * remove log ([9eac18f](https://github.com/thebyte9/blaze/commit/9eac18fa06744a11d8e57d5b4a1d58f488ada931))
24
+ * reset search filters and handle single text property ([#3996](https://github.com/thebyte9/blaze/issues/3996)) ([0160414](https://github.com/thebyte9/blaze/commit/016041454d30cc4cfc0a4c8e2d484fcedc2a631c))
25
+ * set width to carousel container ([d8f3ffb](https://github.com/thebyte9/blaze/commit/d8f3ffbdd22df47dcac88446828c2af5ac0f3318))
26
+
27
+
28
+ ### Features
29
+
30
+ * add isHtml option to data summary component to render string as html ([#3969](https://github.com/thebyte9/blaze/issues/3969)) ([6005cdf](https://github.com/thebyte9/blaze/commit/6005cdf0e18f2eea51cc7bc143cf34423743fe5e))
31
+ * add isHtml option to data summary component to render string as html ([#3969](https://github.com/thebyte9/blaze/issues/3969)) ([78b6ed2](https://github.com/thebyte9/blaze/commit/78b6ed2735e94e078d4b174777ba3a99fc1a6b4c))
32
+ * add sticky setting to column and row ([#3988](https://github.com/thebyte9/blaze/issues/3988)) ([1d1a219](https://github.com/thebyte9/blaze/commit/1d1a21901b23fe184e1eadf2bbb49551dd5f9b33))
33
+ * enableLink in data summary now works with neste objects ([#3974](https://github.com/thebyte9/blaze/issues/3974)) ([67b3c7f](https://github.com/thebyte9/blaze/commit/67b3c7fee9ffd60526dae525fea4d87097742453))
34
+ * enableLink in data summary now works with neste objects ([#3974](https://github.com/thebyte9/blaze/issues/3974)) ([5411725](https://github.com/thebyte9/blaze/commit/54117258b20ecb95b6359a8a412c8317b38b4fb3))
35
+ * Filters and sorts now target generic or specific lists ([#3973](https://github.com/thebyte9/blaze/issues/3973)) ([013fead](https://github.com/thebyte9/blaze/commit/013fead2b1fa467c084535d36404d3b80b9db02f))
36
+ * Filters and sorts now target generic or specific lists ([#3973](https://github.com/thebyte9/blaze/issues/3973)) ([3041c71](https://github.com/thebyte9/blaze/commit/3041c71418996a874138fa9ea9b509040264bf43))
37
+ * filteryBy on cards allow for id prop which fetches related data on parent to render ([#3975](https://github.com/thebyte9/blaze/issues/3975)) ([2eed0ed](https://github.com/thebyte9/blaze/commit/2eed0ed09cedda3a9424d3b88cb16bb437eada50))
38
+ * filteryBy on cards allow for id prop which fetches related data on parent to render ([#3975](https://github.com/thebyte9/blaze/issues/3975)) ([b18c177](https://github.com/thebyte9/blaze/commit/b18c177b9ad0c137fe98a979bfa6ca4baa5e214b))
39
+
40
+
41
+
42
+
43
+
6
44
  # [0.131.0](https://github.com/thebyte9/blaze/compare/v0.130.1...v0.131.0) (2023-07-18)
7
45
 
8
46
 
@@ -84,7 +84,8 @@ var Button = function Button(props) {
84
84
  };
85
85
  var logout = function logout() {
86
86
  (0, _coreAuthUi.handleLogout)(client);
87
- url ? router.reload(urlToUse) : router.reload();
87
+ if ((0, _helpers.hasChildren)(children)) return setShowChildren(true);
88
+ return url ? router.reload(urlToUse) : router.reload();
88
89
  };
89
90
  var handleClick = function handleClick() {
90
91
  if (isLogoutButton) logout();
@@ -1 +1 @@
1
- {"version":3,"file":"Button.js","names":["_react","_interopRequireWildcard","require","_reactCookie","_router","_classnames","_interopRequireDefault","_button","_coreAuthUi","_client","_propTypes","_utilsHandlebars","_ClickWrapper","_BlazeLink","_HOC","_utils","_constants","_helpers","_excluded","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","Button","props","type","text","url","icon","name","style","children","clickAction","childSeoVisibility","afterClickText","parent","otherProps","_objectWithoutProperties2","client","useApolloClient","router","useRouter","isLogoutButton","LOGOUT","_useCookies","useCookies","_useCookies2","_slicedToArray2","cookies","blazeCookie","blaze_auth","_useState","useState","_useState2","showChildren","setShowChildren","_useStringTemplate","useStringTemplate","_useStringTemplate$da","data","textToUse","afterClickTextToUse","urlToUse","useEffect","asPath","checkIfButtonShouldRender","hasChildren","logout","handleLogout","reload","handleClick","buttonType","modifiers","getClassModifiers","currentProps","href","title","DynamicButton","BlazeLink","BlazeButton","updateChildrensParent","itemId","itemEntity","renderedChildren","renderChildren","onClose","_getClickWrapperOptio","getClickWrapperOptions","shouldUseClickWrapper","wrapperProps","Wrapper","ClickWrapper","Fragment","contentClassName","classnames","createElement","className","_extends2","onClick","propTypes","PropTypes","string","size","bool","oneOfType","arrayOf","node","defaultProps","_default","withTitle","exports"],"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,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAT,uBAAA,CAAAC,OAAA;AACA,IAAAS,gBAAA,GAAAT,OAAA;AACA,IAAAU,aAAA,GAAAN,sBAAA,CAAAJ,OAAA;AAC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,EAAEyE,qBAAS,CAACC,MAAM;EACrBC,IAAI,EAAEF,qBAAS,CAACC,MAAM;EACtBzE,IAAI,EAAEwE,qBAAS,CAACC,MAAM;EACtBvE,KAAK,EAAEsE,qBAAS,CAACC,MAAM;EACvBpE,kBAAkB,EAAEsE,eAAI;EACxBxE,QAAQ,EAAEqE,qBAAS,CAACI,SAAS,CAAC,CAACJ,qBAAS,CAACK,OAAO,CAACL,qBAAS,CAACM,IAAI,CAAC,EAAEN,qBAAS,CAACM,IAAI,CAAC;AACnF,CAAC;AAEDnF,MAAM,CAACoF,YAAY,GAAG;EACpBxE,MAAM,EAAE,CAAC,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;EACT2E,IAAI,EAAE,EAAE;EACR1E,IAAI,EAAE,EAAE;EACRE,KAAK,EAAE,EAAE;EACTC,QAAQ,EAAE,EAAE;EACZE,kBAAkB,EAAE;AACtB,CAAC;AAAC,IAAA2E,QAAA,GAEa,IAAAC,cAAS,EAACtF,MAAM,CAAC;AAAAuF,OAAA,cAAAF,QAAA"}
1
+ {"version":3,"file":"Button.js","names":["_react","_interopRequireWildcard","require","_reactCookie","_router","_classnames","_interopRequireDefault","_button","_coreAuthUi","_client","_propTypes","_utilsHandlebars","_ClickWrapper","_BlazeLink","_HOC","_utils","_constants","_helpers","_excluded","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","Button","props","type","text","url","icon","name","style","children","clickAction","childSeoVisibility","afterClickText","parent","otherProps","_objectWithoutProperties2","client","useApolloClient","router","useRouter","isLogoutButton","LOGOUT","_useCookies","useCookies","_useCookies2","_slicedToArray2","cookies","blazeCookie","blaze_auth","_useState","useState","_useState2","showChildren","setShowChildren","_useStringTemplate","useStringTemplate","_useStringTemplate$da","data","textToUse","afterClickTextToUse","urlToUse","useEffect","asPath","checkIfButtonShouldRender","hasChildren","logout","handleLogout","reload","handleClick","buttonType","modifiers","getClassModifiers","currentProps","href","title","DynamicButton","BlazeLink","BlazeButton","updateChildrensParent","itemId","itemEntity","renderedChildren","renderChildren","onClose","_getClickWrapperOptio","getClickWrapperOptions","shouldUseClickWrapper","wrapperProps","Wrapper","ClickWrapper","Fragment","contentClassName","classnames","createElement","className","_extends2","onClick","propTypes","PropTypes","string","size","bool","oneOfType","arrayOf","node","defaultProps","_default","withTitle","exports"],"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,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,YAAA,GAAAD,OAAA;AACA,IAAAE,OAAA,GAAAF,OAAA;AACA,IAAAG,WAAA,GAAAC,sBAAA,CAAAJ,OAAA;AACA,IAAAK,OAAA,GAAAD,sBAAA,CAAAJ,OAAA;AACA,IAAAM,WAAA,GAAAN,OAAA;AACA,IAAAO,OAAA,GAAAP,OAAA;AACA,IAAAQ,UAAA,GAAAT,uBAAA,CAAAC,OAAA;AACA,IAAAS,gBAAA,GAAAT,OAAA;AACA,IAAAU,aAAA,GAAAN,sBAAA,CAAAJ,OAAA;AACA,IAAAW,UAAA,GAAAP,sBAAA,CAAAJ,OAAA;AACA,IAAAY,IAAA,GAAAZ,OAAA;AACA,IAAAa,MAAA,GAAAb,OAAA;AACA,IAAAc,UAAA,GAAAd,OAAA;AACA,IAAAe,QAAA,GAAAf,OAAA;AAKoB,IAAAgB,SAAA;AAAA,SAAAC,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAnB,wBAAAuB,GAAA,EAAAJ,WAAA,SAAAA,WAAA,IAAAI,GAAA,IAAAA,GAAA,CAAAC,UAAA,WAAAD,GAAA,QAAAA,GAAA,aAAAE,OAAA,CAAAF,GAAA,yBAAAA,GAAA,uCAAAA,GAAA,UAAAG,KAAA,GAAAR,wBAAA,CAAAC,WAAA,OAAAO,KAAA,IAAAA,KAAA,CAAAC,GAAA,CAAAJ,GAAA,YAAAG,KAAA,CAAAE,GAAA,CAA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E,EAAE;EACRE,KAAK,EAAE,EAAE;EACTC,QAAQ,EAAE,EAAE;EACZE,kBAAkB,EAAE;AACtB,CAAC;AAAC,IAAA2E,QAAA,GAEa,IAAAC,cAAS,EAACtF,MAAM,CAAC;AAAAuF,OAAA,cAAAF,QAAA"}
@@ -146,6 +146,12 @@ var CardsRender = function CardsRender(_ref) {
146
146
  schemaLoading = _useGetEntitySchemasA3.loading,
147
147
  schemaError = _useGetEntitySchemasA3.error;
148
148
  var updatedFilterBy = (0, _helpers.getUpdatedFilterBy)(inheritedFilters, parentEntityData, parentSchema, filterEntitySchema, parentId, variableProps);
149
+ var updatedItemsToDisplay = (0, _helpers2.getUpdatedItemsToDisplay)({
150
+ itemsToDisplay: itemsToDisplay,
151
+ inheritedFilters: inheritedFilters,
152
+ parentSchema: parentSchema,
153
+ parentEntityData: parentEntityData
154
+ });
149
155
  var _filterQuerySetup = (0, _helpers2.filterQuerySetup)({
150
156
  getEntitySchemas: Object.values(requiredSchema),
151
157
  entity: primaryEntityToUse,
@@ -154,21 +160,22 @@ var CardsRender = function CardsRender(_ref) {
154
160
  docType: docTypes,
155
161
  filterOperator: filterOperator,
156
162
  filterEntityRelations: filterEntityRelations,
157
- itemsToDisplay: itemsToDisplay,
163
+ itemsToDisplay: updatedItemsToDisplay,
158
164
  entitySameAsCurrentItemEntity: entitySameAsCurrentItemEntity,
159
165
  useRandomSort: useRandomSort
160
166
  }),
161
167
  limit = _filterQuerySetup.limit,
162
168
  variables = _filterQuerySetup.variables;
169
+ var hasNoFiltersOrItemsToDisplay = !updatedItemsToDisplay.length && !updatedFilterBy;
163
170
  var _useQuery2 = (0, _client.useQuery)(action, {
164
171
  variables: variables,
165
172
  fetchPolicy: useRandomSort ? 'cache-and-network' : 'cache-first',
166
- skip: (0, _helpers2.shouldReturn)(!updatedFilterBy, _loading, _load, schemaLoading, _error, _err, schemaError)
173
+ skip: (0, _helpers2.shouldReturn)(hasNoFiltersOrItemsToDisplay, _loading, _load, schemaLoading, _error, _err, schemaError)
167
174
  }),
168
175
  cardData = _useQuery2.data,
169
176
  cardsError = _useQuery2.error,
170
177
  cardsLoading = _useQuery2.loading;
171
- var imageIds = itemsToDisplay.map(function (_ref4) {
178
+ var imageIds = updatedItemsToDisplay.map(function (_ref4) {
172
179
  var imageId = _ref4.imageId;
173
180
  return imageId;
174
181
  }).filter(Boolean);
@@ -177,7 +184,7 @@ var CardsRender = function CardsRender(_ref) {
177
184
  imagesLoading = _useGetImages.loading;
178
185
  var isLoading = (0, _helpers2.shouldReturn)(_loading, _load, schemaLoading, cardsLoading, imagesLoading);
179
186
  var hasError = (0, _helpers2.shouldReturn)(_error, _err, schemaError);
180
- if (!updatedFilterBy) return null;
187
+ if (hasNoFiltersOrItemsToDisplay) return null;
181
188
  if (isLoading) return null;
182
189
  if (hasError) return null;
183
190
  if (cardsError) return cardsError.message;
@@ -185,13 +192,13 @@ var CardsRender = function CardsRender(_ref) {
185
192
  if (!cardDataResults || !cardDataResults.length) return null;
186
193
  cardDataResults = entitySameAsCurrentItemEntity ? (0, _helpers.removeExtraItems)(cardDataResults, limit, parentId) : cardDataResults;
187
194
  if (!cardDataResults.length) return null;
188
- var orderedData = useRandomSort ? cardDataResults : (0, _helpers.sortResponseData)(cardDataResults, itemsToDisplay);
195
+ var orderedData = useRandomSort ? cardDataResults : (0, _helpers.sortResponseData)(cardDataResults, updatedItemsToDisplay);
189
196
  var _splitChildren = (0, _helpers.splitChildren)(children, cardDataResults, graphqlEntityMap, {
190
197
  name: variableProps.name
191
198
  }),
192
199
  regularChildren = _splitChildren.regularChildren,
193
200
  gtmChildren = _splitChildren.gtmChildren;
194
- var updatedCards = (0, _helpers.appendImages)(imagesData, orderedData, itemsToDisplay);
201
+ var updatedCards = (0, _helpers.appendImages)(imagesData, orderedData, updatedItemsToDisplay);
195
202
  return /*#__PURE__*/_react["default"].createElement(_react["default"].Fragment, null, gtmChildren && (0, _helpers.renderChildren)(gtmChildren), /*#__PURE__*/_react["default"].createElement(CardsContainer, (0, _extends2["default"])({
196
203
  cardData: updatedCards,
197
204
  entity: primaryEntityToUse,
@@ -1 +1 @@
1
- {"version":3,"file":"CardsRender.js","names":["_react","_interopRequireWildcard","require","_client","_dynamic","_interopRequireDefault","_propTypes","_nextjsComponents","_query","_constants","_hooks","_helpers","_helpers2","_excluded","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof2","cache","has","get","newObj","hasPropertyDescriptor","prototype","hasOwnProperty","call","desc","set","CardsContainer","dynamic","Promise","resolve","then","CardsRender","_ref","legacyEntity","entity","entities","entityFields","itemsToDisplay","children","otherProps","_objectWithoutProperties2","_useContext","useContext","MainContext","isPreview","_otherProps$parent","parent","parentId","itemId","parentEntity","itemEntity","_otherProps$filterBy","filterBy","_otherProps$filterByP","filterByProperty","sortby","sort","_otherProps$sortPrope","sortProperties","_otherProps$operator","operator","filterOperator","AND","useRandomSort","_getUpdatedSortProper","getUpdatedSortProperties","_getUpdatedSortProper2","_slicedToArray2","updatedSortProperties","sortbyFilters","variableProps","entitiesToUse","primaryEntityToUse","unpublishedParentEntityName","getUnpublishedEntityName","allEntityNames","concat","_toConsumableArray2","uniqueEntityNames","Set","_useGetEntitySchemasA","useGetEntitySchemasAsObj","_useGetEntitySchemasA2","data","mainSchemas","_loading","loading","_error","error","parentSchema","filterEntitySchema","entitiesTypes","map","ent","getEntityData","graphqlEntityMap","reduce","acc","entityType","docTypes","_ref2","type","docType","entityTypes","_ref3","eType","_filtersSetup","filtersSetup","currentSchema","itemEntityUpdated","getAction","queryProps","inheritedFilters","entitySameAsCurrentItemEntity","action","filterEntityRelations","_useQuery","useQuery","generateSingleItemQuery","variables","id","skip","shouldSkipSingleQuery","_useQuery$data","_useQuery$data2","_useQuery$data2$entit","entityData","parentEntityData","_err","_load","_useGetEntitySchemasA3","getRequiredSchemas","_useGetEntitySchemasA4","requiredSchema","schemaLoading","schemaError","updatedFilterBy","getUpdatedFilterBy","_filterQuerySetup","filterQuerySetup","getEntitySchemas","values","limit","_useQuery2","fetchPolicy","shouldReturn","cardData","cardsError","cardsLoading","imageIds","_ref4","imageId","Boolean","_useGetImages","useGetImages","imagesData","imagesLoading","isLoading","hasError","message","cardDataResults","SEARCH_PUBLISHED_CONTENT","results","removeExtraItems","orderedData","sortResponseData","_splitChildren","splitChildren","name","regularChildren","gtmChildren","updatedCards","appendImages","createElement","Fragment","renderChildren","_extends2","cardChildren","propTypes","PropTypes","oneOfType","arrayOf","node","string","isRequired","array","defaultProps","_default","exports"],"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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AY;IACzBO,YAAY,EAAER,eAAgB;IAC9B1E,gBAAgB,EAAEA;EAAiB,GAC/BzB,aAAa,CAClB,CACD,CAAC;AAEP,CAAC;AAEDvC,WAAW,CAACmJ,SAAS,GAAG;EACtB5I,QAAQ,EAAE6I,qBAAS,CAACC,SAAS,CAAC,CAACD,qBAAS,CAACE,OAAO,CAACF,qBAAS,CAACG,IAAI,CAAC,EAAEH,qBAAS,CAACG,IAAI,CAAC,CAAC;EAClFpJ,MAAM,EAAEiJ,qBAAS,CAACI,MAAM,CAACC,UAAU;EACnCpJ,YAAY,EAAE+I,qBAAS,CAACI,MAAM,CAACC,UAAU;EACzCnJ,cAAc,EAAE8I,qBAAS,CAACM,KAAK;EAC/BtJ,QAAQ,EAAEgJ,qBAAS,CAACM;AACtB,CAAC;AAED1J,WAAW,CAAC2J,YAAY,GAAG;EACzBpJ,QAAQ,EAAE,EAAE;EACZD,cAAc,EAAE,EAAE;EAClBF,QAAQ,EAAE;AACZ,CAAC;AAAC,IAAAwJ,QAAA,GAEa5J,WAAW;AAAA6J,OAAA,cAAAD,QAAA"}
1
+ {"version":3,"file":"CardsRender.js","names":["_react","_interopRequireWildcard","require","_client","_dynamic","_interopRequireDefault","_propTypes","_nextjsComponents","_query","_constants","_hooks","_helpers","_helpers2","_excluded","ownKeys","object","enumerableOnly","keys","Object","getOwnPropertySymbols","symbols","filter","sym","getOwnPropertyDescriptor","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","key","_defineProperty2","getOwnPropertyDescriptors","defineProperties","defineProperty","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof2","cache","has","get","newObj","hasPropertyDescriptor","prototype","hasOwnProperty","call","desc","set","CardsContainer","dynamic","Promise","resolve","then","CardsRender","_ref","legacyEntity","entity","entities","entityFields","itemsToDisplay","children","otherProps","_objectWithoutProperties2","_useContext","useContext","MainContext","isPreview","_otherProps$parent","parent","parentId","itemId","parentEntity","itemEntity","_otherProps$filterBy","filterBy","_otherProps$filterByP","filterByProperty","sortby","sort","_otherProps$sortPrope","sortProperties","_otherProps$operator","operator","filterOperator","AND","useRandomSort","_getUpdatedSortProper","getUpdatedSortProperties","_getUpdatedSortProper2","_slicedToArray2","updatedSortProperties","sortbyFilters","variableProps","entitiesToUse","primaryEntityToUse","unpublishedParentEntityName","getUnpublishedEntityName","allEntityNames","concat","_toConsumableArray2","uniqueEntityNames","Set","_useGetEntitySchemasA","useGetEntitySchemasAsObj","_useGetEntitySchemasA2","data","mainSchemas","_loading","loading","_error","error","parentSchema","filterEntitySchema","entitiesTypes","map","ent","getEntityData","graphqlEntityMap","reduce","acc","entityType","docTypes","_ref2","type","docType","entityTypes","_ref3","eType","_filtersSetup","filtersSetup","currentSchema","itemEntityUpdated","getAction","queryProps","inheritedFilters","entitySameAsCurrentItemEntity","action","filterEntityRelations","_useQuery","useQuery","generateSingleItemQuery","variables","id","skip","shouldSkipSingleQuery","_useQuery$data","_useQuery$data2","_useQuery$data2$entit","entityData","parentEntityData","_err","_load","_useGetEntitySchemasA3","getRequiredSchemas","_useGetEntitySchemasA4","requiredSchema","schemaLoading","schemaError","updatedFilterBy","getUpdatedFilterBy","updatedItemsToDisplay","getUpdatedItemsToDisplay","_filterQuerySetup","filterQuerySetup","getEntitySchemas","values","limit","hasNoFiltersOrItemsToDisplay","_useQuery2","fetchPolicy","shouldReturn","cardData","cardsError","cardsLoading","imageIds","_ref4","imageId","Boolean","_useGetImages","useGetImages","imagesData","imagesLoading","isLoading","hasError","message","cardDataResults","SEARCH_PUBLISHED_CONTENT","results","removeExtraItems","orderedData","sortResponseData","_splitChildren","splitChildren","name","regularChildren","gtmChildren","updatedCards","appendImages","createElement","Fragment","renderChildren","_extends2","cardChildren","propTypes","PropTypes","oneOfType","arrayOf","node","string","isRequired","array","defaultProps","_default","exports"],"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,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,OAAA,GAAAD,OAAA;AACA,IAAAE,QAAA,GAAAC,sBAAA,CAAAH,OAAA;AACA,IAAAI,UAAA,GAAAD,sBAAA,CAAAH,OAAA;AACA,IAAAK,iBAAA,GAA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B,CACD,CAAC;AAEP,CAAC;AAEDvC,WAAW,CAACsJ,SAAS,GAAG;EACtB/I,QAAQ,EAAEgJ,qBAAS,CAACC,SAAS,CAAC,CAACD,qBAAS,CAACE,OAAO,CAACF,qBAAS,CAACG,IAAI,CAAC,EAAEH,qBAAS,CAACG,IAAI,CAAC,CAAC;EAClFvJ,MAAM,EAAEoJ,qBAAS,CAACI,MAAM,CAACC,UAAU;EACnCvJ,YAAY,EAAEkJ,qBAAS,CAACI,MAAM,CAACC,UAAU;EACzCtJ,cAAc,EAAEiJ,qBAAS,CAACM,KAAK;EAC/BzJ,QAAQ,EAAEmJ,qBAAS,CAACM;AACtB,CAAC;AAED7J,WAAW,CAAC8J,YAAY,GAAG;EACzBvJ,QAAQ,EAAE,EAAE;EACZD,cAAc,EAAE,EAAE;EAClBF,QAAQ,EAAE;AACZ,CAAC;AAAC,IAAA2J,QAAA,GAEa/J,WAAW;AAAAgK,OAAA,cAAAD,QAAA"}
@@ -0,0 +1,55 @@
1
+ "use strict";
2
+
3
+ require("core-js/modules/es.object.define-property.js");
4
+ var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault");
5
+ Object.defineProperty(exports, "__esModule", {
6
+ value: true
7
+ });
8
+ exports["default"] = void 0;
9
+ var _toConsumableArray2 = _interopRequireDefault(require("@babel/runtime/helpers/toConsumableArray"));
10
+ var _slicedToArray2 = _interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));
11
+ require("core-js/modules/es.array.find.js");
12
+ require("core-js/modules/es.object.to-string.js");
13
+ require("core-js/modules/es.array.index-of.js");
14
+ require("core-js/modules/es.object.keys.js");
15
+ require("core-js/modules/es.array.is-array.js");
16
+ require("core-js/modules/es.array.for-each.js");
17
+ require("core-js/modules/web.dom-collections.for-each.js");
18
+ var getUpdatedItemsToDisplay = function getUpdatedItemsToDisplay(_ref) {
19
+ var parentSchema = _ref.parentSchema,
20
+ parentEntityData = _ref.parentEntityData,
21
+ _ref$itemsToDisplay = _ref.itemsToDisplay,
22
+ itemsToDisplay = _ref$itemsToDisplay === void 0 ? [] : _ref$itemsToDisplay,
23
+ _ref$inheritedFilters = _ref.inheritedFilters,
24
+ inheritedFilters = _ref$inheritedFilters === void 0 ? [] : _ref$inheritedFilters;
25
+ var idProp = inheritedFilters.find(function (filter) {
26
+ return filter.indexOf('id/') === 0;
27
+ });
28
+ if (!idProp || !parentSchema || !parentEntityData) return itemsToDisplay;
29
+ var properties = parentSchema.properties;
30
+ var _idProp$split = idProp.split('/'),
31
+ _idProp$split2 = (0, _slicedToArray2["default"])(_idProp$split, 2),
32
+ entityKey = _idProp$split2[1];
33
+ if (!properties || !entityKey) return itemsToDisplay;
34
+ var queryValue = Object.keys(properties).find(function (propKey) {
35
+ return properties[propKey] && properties[propKey].relation && properties[propKey].relation.entityIdentifier === entityKey;
36
+ });
37
+ var parentValues = parentEntityData[queryValue];
38
+ if (!parentValues) return itemsToDisplay;
39
+ var updatedItemsToDisplay = (0, _toConsumableArray2["default"])(itemsToDisplay);
40
+ if (Array.isArray(parentValues)) {
41
+ parentValues.forEach(function (value) {
42
+ updatedItemsToDisplay.push({
43
+ displayItems: [value]
44
+ });
45
+ });
46
+ } else {
47
+ updatedItemsToDisplay.push({
48
+ displayItems: [parentValues]
49
+ });
50
+ }
51
+ return updatedItemsToDisplay;
52
+ };
53
+ var _default = getUpdatedItemsToDisplay;
54
+ exports["default"] = _default;
55
+ //# sourceMappingURL=get-updated-items-to-display.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"get-updated-items-to-display.js","names":["getUpdatedItemsToDisplay","_ref","parentSchema","parentEntityData","_ref$itemsToDisplay","itemsToDisplay","_ref$inheritedFilters","inheritedFilters","idProp","find","filter","indexOf","properties","_idProp$split","split","_idProp$split2","_slicedToArray2","entityKey","queryValue","Object","keys","propKey","relation","entityIdentifier","parentValues","updatedItemsToDisplay","_toConsumableArray2","Array","isArray","forEach","value","push","displayItems","_default","exports"],"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,IAAMA,wBAAwB,GAAG,SAA3BA,wBAAwBA,CAAAC,IAAA,EAKxB;EAAA,IAJJC,YAAY,GAAAD,IAAA,CAAZC,YAAY;IACZC,gBAAgB,GAAAF,IAAA,CAAhBE,gBAAgB;IAAAC,mBAAA,GAAAH,IAAA,CAChBI,cAAc;IAAdA,cAAc,GAAAD,mBAAA,cAAG,EAAE,GAAAA,mBAAA;IAAAE,qBAAA,GAAAL,IAAA,CACnBM,gBAAgB;IAAhBA,gBAAgB,GAAAD,qBAAA,cAAG,EAAE,GAAAA,qBAAA;EAErB,IAAME,MAAM,GAAGD,gBAAgB,CAACE,IAAI,CAAC,UAAAC,MAAM;IAAA,OAAIA,MAAM,CAACC,OAAO,CAAC,KAAK,CAAC,KAAK,CAAC;EAAA,EAAC;EAE3E,IAAI,CAACH,MAAM,IAAI,CAACN,YAAY,IAAI,CAACC,gBAAgB,EAAE,OAAOE,cAAc;EACxE,IAAQO,UAAU,GAAKV,YAAY,CAA3BU,UAAU;EAClB,IAAAC,aAAA,GAAsBL,MAAM,CAACM,KAAK,CAAC,GAAG,CAAC;IAAAC,cAAA,OAAAC,eAAA,aAAAH,aAAA;IAA9BI,SAAS,GAAAF,cAAA;EAClB,IAAI,CAACH,UAAU,IAAI,CAACK,SAAS,EAAE,OAAOZ,cAAc;EACpD,IAAMa,UAAU,GAAGC,MAAM,CAACC,IAAI,CAACR,UAAU,CAAC,CAACH,IAAI,CAC7C,UAAAY,OAAO;IAAA,OACLT,UAAU,CAACS,OAAO,CAAC,IACnBT,UAAU,CAACS,OAAO,CAAC,CAACC,QAAQ,IAC5BV,UAAU,CAACS,OAAO,CAAC,CAACC,QAAQ,CAACC,gBAAgB,KAAKN,SAAS;EAAA,CAC/D,CAAC;EACD,IAAMO,YAAY,GAAGrB,gBAAgB,CAACe,UAAU,CAAC;EACjD,IAAI,CAACM,YAAY,EAAE,OAAOnB,cAAc;EACxC,IAAMoB,qBAAqB,OAAAC,mBAAA,aAAOrB,cAAc,CAAC;EACjD,IAAIsB,KAAK,CAACC,OAAO,CAACJ,YAAY,CAAC,EAAE;IAC/BA,YAAY,CAACK,OAAO,CAAC,UAAAC,KAAK,EAAI;MAC5BL,qBAAqB,CAACM,IAAI,CAAC;QAAEC,YAAY,EAAE,CAACF,KAAK;MAAE,CAAC,CAAC;IACvD,CAAC,CAAC;EACJ,CAAC,MAAM;IACLL,qBAAqB,CAACM,IAAI,CAAC;MAAEC,YAAY,EAAE,CAACR,YAAY;IAAE,CAAC,CAAC;EAC9D;EACA,OAAOC,qBAAqB;AAC9B,CAAC;AAAC,IAAAQ,QAAA,GAEajC,wBAAwB;AAAAkC,OAAA,cAAAD,QAAA"}
@@ -29,6 +29,12 @@ Object.defineProperty(exports, "getPublishedListingUrl", {
29
29
  return _getPublishedListingUrl["default"];
30
30
  }
31
31
  });
32
+ Object.defineProperty(exports, "getUpdatedItemsToDisplay", {
33
+ enumerable: true,
34
+ get: function get() {
35
+ return _getUpdatedItemsToDisplay["default"];
36
+ }
37
+ });
32
38
  Object.defineProperty(exports, "getUpdatedSortProperties", {
33
39
  enumerable: true,
34
40
  get: function get() {
@@ -61,4 +67,5 @@ var _filterQuerySetup = _interopRequireDefault(require("./filter-query-setup"));
61
67
  var _shouldReturn = _interopRequireDefault(require("./should-return"));
62
68
  var _shouldSkipSingleQuery = _interopRequireDefault(require("./should-skip-single-query"));
63
69
  var _getUpdatedSortProperties = _interopRequireDefault(require("./get-updated-sort-properties"));
70
+ var _getUpdatedItemsToDisplay = _interopRequireDefault(require("./get-updated-items-to-display"));
64
71
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","names":["_getPublishedListingUrl","_interopRequireDefault","require","_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,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,sBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,aAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,iBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,aAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,sBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,yBAAA,GAAAR,sBAAA,CAAAC,OAAA"}
1
+ {"version":3,"file":"index.js","names":["_getPublishedListingUrl","_interopRequireDefault","require","_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,IAAAA,uBAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,kBAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,sBAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,aAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,iBAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,aAAA,GAAAN,sBAAA,CAAAC,OAAA;AACA,IAAAM,sBAAA,GAAAP,sBAAA,CAAAC,OAAA;AACA,IAAAO,yBAAA,GAAAR,sBAAA,CAAAC,OAAA;AACA,IAAAQ,yBAAA,GAAAT,sBAAA,CAAAC,OAAA"}
@@ -16,8 +16,8 @@ var SmoothScrollCarousel = function SmoothScrollCarousel(_ref) {
16
16
  numberOfCards = _ref.numberOfCards;
17
17
  var wrapperClassName = "cards-carousel-smooth".concat(bannerModifier);
18
18
  var contentClassName = "cards-carousel--content smooth-scroll items-per-row-".concat(itemsPerRow);
19
- var aimationTime = autoScrollTimer * numberOfCards / 1000;
20
- var animationDuration = "".concat(aimationTime < 1 ? 1 : aimationTime, "s");
19
+ var animationTime = autoScrollTimer * numberOfCards / 1000;
20
+ var animationDuration = "".concat(animationTime < 1 ? 1 : animationTime, "s");
21
21
  return /*#__PURE__*/_react["default"].createElement("div", {
22
22
  className: wrapperClassName
23
23
  }, /*#__PURE__*/_react["default"].createElement("div", {
@@ -1 +1 @@
1
- {"version":3,"file":"SmoothScrollCarousel.js","names":["_react","_interopRequireDefault","require","_propTypes","SmoothScrollCarousel","_ref","children","bannerModifier","itemsPerRow","autoScrollTimer","numberOfCards","wrapperClassName","concat","contentClassName","aimationTime","animationDuration","createElement","className","style","propTypes","PropTypes","string","number","oneOfType","arrayOf","node","defaultProps","_default","exports"],"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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,CAACJ,qBAAS,CAACK,IAAI,CAAC,EAAEL,qBAAS,CAACK,IAAI,CAAC,CAAC;EAClFhB,eAAe,EAAEW,qBAAS,CAACE,MAAM;EACjCZ,aAAa,EAAEU,qBAAS,CAACE;AAC3B,CAAC;AAEDlB,oBAAoB,CAACsB,YAAY,GAAG;EAClClB,WAAW,EAAE,CAAC;EACdD,cAAc,EAAE,EAAE;EAClBD,QAAQ,EAAE,EAAE;EACZG,eAAe,EAAE,CAAC;EAClBC,aAAa,EAAE;AACjB,CAAC;AAAC,IAAAiB,QAAA,GAEavB,oBAAoB;AAAAwB,OAAA,cAAAD,QAAA"}
1
+ {"version":3,"file":"SmoothScrollCarousel.js","names":["_react","_interopRequireDefault","require","_propTypes","SmoothScrollCarousel","_ref","children","bannerModifier","itemsPerRow","autoScrollTimer","numberOfCards","wrapperClassName","concat","contentClassName","animationTime","animationDuration","createElement","className","style","propTypes","PropTypes","string","number","oneOfType","arrayOf","node","defaultProps","_default","exports"],"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,IAAAA,MAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAF,sBAAA,CAAAC,OAAA;AAEA,IAAME,oBAAoB,GAAG,SAAvBA,oBAAoBA,CAAAC,IAAA,EAMpB;EAAA,IALJC,QAAQ,GAAAD,IAAA,CAARC,QAAQ;IACRC,cAAc,GAAAF,IAAA,CAAdE,cAAc;IACdC,WAAW,GAAAH,IAAA,CAAXG,WAAW;IACXC,eAAe,GAAAJ,IAAA,CAAfI,eAAe;IACfC,aAAa,GAAAL,IAAA,CAAbK,aAAa;EAEb,IAAMC,gBAAgB,2BAAAC,MAAA,CAA2BL,cAAc,CAAE;EACjE,IAAMM,gBAAgB,0DAAAD,MAAA,CAA0DJ,WAAW,CAAE;EAC7F,IAAMM,aAAa,GAAIL,eAAe,GAAGC,aAAa,GAAI,IAAI;EAC9D,IAAMK,iBAAiB,MAAAH,MAAA,CAAME,aAAa,GAAG,CAAC,GAAG,CAAC,GAAGA,aAAa,MAAG;EAErE,oBACEd,MAAA,YAAAgB,aAAA;IAAKC,SAAS,EAAEN;EAAiB,gBAC/BX,MAAA,YAAAgB,aAAA;IAAKC,SAAS,EAAEJ,gBAAiB;IAACK,KAAK,EAAE;MAAEH,iBAAiB,EAAjBA;IAAkB;EAAE,GAC5DT,QACE,CAAC,eACNN,MAAA,YAAAgB,aAAA;IAAKC,SAAS,EAAEJ,gBAAiB;IAACK,KAAK,EAAE;MAAEH,iBAAiB,EAAjBA;IAAkB;EAAE,GAC5DT,QACE,CACF,CAAC;AAEV,CAAC;AAEDF,oBAAoB,CAACe,SAAS,GAAG;EAC/BZ,cAAc,EAAEa,qBAAS,CAACC,MAAM;EAChCb,WAAW,EAAEY,qBAAS,CAACE,MAAM;EAC7BhB,QAAQ,EAAEc,qBAAS,CAACG,SAAS,CAAC,CAACH,qBAAS,CAACI,OAAO,CAACJ,qBAAS,CAACK,IAAI,CAAC,EAAEL,qBAAS,CAACK,IAAI,CAAC,CAAC;EAClFhB,eAAe,EAAEW,qBAAS,CAACE,MAAM;EACjCZ,aAAa,EAAEU,qBAAS,CAACE;AAC3B,CAAC;AAEDlB,oBAAoB,CAACsB,YAAY,GAAG;EAClClB,WAAW,EAAE,CAAC;EACdD,cAAc,EAAE,EAAE;EAClBD,QAAQ,EAAE,EAAE;EACZG,eAAe,EAAE,CAAC;EAClBC,aAAa,EAAE;AACjB,CAAC;AAAC,IAAAiB,QAAA,GAEavB,oBAAoB;AAAAwB,OAAA,cAAAD,QAAA"}
@@ -30,7 +30,7 @@ var _HOC = require("../../HOC");
30
30
  var _utils = require("../../utils");
31
31
  var _constants = require("../../constants");
32
32
  var _helpers = require("./helpers");
33
- var _excluded = ["code", "parserOptions"];
33
+ var _excluded = ["code", "parserOptions", "disableWrapper"];
34
34
  function _getRequireWildcardCache(nodeInterop) { if (typeof WeakMap !== "function") return null; var cacheBabelInterop = new WeakMap(); var cacheNodeInterop = new WeakMap(); return (_getRequireWildcardCache = function _getRequireWildcardCache(nodeInterop) { return nodeInterop ? cacheNodeInterop : cacheBabelInterop; })(nodeInterop); }
35
35
  function _interopRequireWildcard(obj, nodeInterop) { if (!nodeInterop && obj && obj.__esModule) { return obj; } if (obj === null || _typeof(obj) !== "object" && typeof obj !== "function") { return { "default": obj }; } var cache = _getRequireWildcardCache(nodeInterop); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (key !== "default" && Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj["default"] = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
36
36
  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; }
@@ -38,11 +38,13 @@ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { va
38
38
  var Code = /*#__PURE__*/(0, _react.memo)(function (_ref) {
39
39
  var embedCode = _ref.code,
40
40
  parserOptions = _ref.parserOptions,
41
+ disableWrapper = _ref.disableWrapper,
41
42
  otherProps = (0, _objectWithoutProperties2["default"])(_ref, _excluded);
42
43
  if (!embedCode) return null;
43
44
  var parsedCode = (0, _htmlReactParser["default"])(embedCode, parserOptions);
44
45
  var wrappedCode = (0, _helpers.wrapScriptTags)(parsedCode);
45
46
  var modifiers = (0, _utils.getClassModifiers)(_constants.CODE, _objectSpread({}, otherProps));
47
+ if (disableWrapper) return wrappedCode;
46
48
  return /*#__PURE__*/_react["default"].createElement(_Wrapper["default"], {
47
49
  modifiers: modifiers
48
50
  }, wrappedCode);
@@ -50,12 +52,14 @@ var Code = /*#__PURE__*/(0, _react.memo)(function (_ref) {
50
52
  Code.propTypes = {
51
53
  code: _propTypes["default"].string,
52
54
  modifier: _propTypes["default"].string,
53
- parserOptions: _propTypes["default"].object
55
+ parserOptions: _propTypes["default"].object,
56
+ disableWrapper: _propTypes["default"].bool
54
57
  };
55
58
  Code.defaultProps = {
56
59
  code: '',
57
60
  modifier: '',
58
- parserOptions: {}
61
+ parserOptions: {},
62
+ disableWrapper: false
59
63
  };
60
64
  var _default = (0, _HOC.withTitle)(Code);
61
65
  exports["default"] = _default;
@@ -1 +1 @@
1
- {"version":3,"file":"Code.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_htmlReactParser","_Wrapper","_HOC","_utils","_constants","_helpers","_excluded","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","Code","memo","_ref","embedCode","code","parserOptions","otherProps","_objectWithoutProperties2","parsedCode","parseHTML","wrappedCode","wrapScriptTags","modifiers","getClassModifiers","CODE","createElement","propTypes","PropTypes","string","modifier","defaultProps","_default","withTitle","exports"],"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,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,QAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;A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C,2BAAS,EAACN,SAAS,EAAEE,aAAa,CAAC;EACtD,IAAMK,WAAW,GAAG,IAAAC,uBAAc,EAACH,UAAU,CAAC;EAC9C,IAAMI,SAAS,GAAG,IAAAC,wBAAiB,EAACC,eAAI,EAAAxB,aAAA,KAAOgB,UAAU,CAAE,CAAC;EAE5D,oBAAO7D,MAAA,YAAAsE,aAAA,CAAChE,QAAA,WAAO;IAAC6D,SAAS,EAAEA;EAAU,GAAEF,WAAqB,CAAC;AAC/D,CAAC,CAAC;AAEFV,IAAI,CAACgB,SAAS,GAAG;EACfZ,IAAI,EAAEa,qBAAS,CAACC,MAAM;EACtBC,QAAQ,EAAEF,qBAAS,CAACC,MAAM;EAC1Bb,aAAa,EAAEY,qBAAS,CAACrC;AAC3B,CAAC;AAEDoB,IAAI,CAACoB,YAAY,GAAG;EAClBhB,IAAI,EAAE,EAAE;EACRe,QAAQ,EAAE,EAAE;EACZd,aAAa,EAAE,CAAC;AAClB,CAAC;AAAC,IAAAgB,QAAA,GAEa,IAAAC,cAAS,EAACtB,IAAI,CAAC;AAAAuB,OAAA,cAAAF,QAAA"}
1
+ {"version":3,"file":"Code.js","names":["_react","_interopRequireWildcard","require","_propTypes","_interopRequireDefault","_htmlReactParser","_Wrapper","_HOC","_utils","_constants","_helpers","_excluded","_getRequireWildcardCache","nodeInterop","WeakMap","cacheBabelInterop","cacheNodeInterop","obj","__esModule","_typeof","cache","has","get","newObj","hasPropertyDescriptor","Object","defineProperty","getOwnPropertyDescriptor","key","prototype","hasOwnProperty","call","desc","set","ownKeys","object","enumerableOnly","keys","getOwnPropertySymbols","symbols","filter","sym","enumerable","push","apply","_objectSpread","target","i","arguments","length","source","forEach","_defineProperty2","getOwnPropertyDescriptors","defineProperties","Code","memo","_ref","embedCode","code","parserOptions","disableWrapper","otherProps","_objectWithoutProperties2","parsedCode","parseHTML","wrappedCode","wrapScriptTags","modifiers","getClassModifiers","CODE","createElement","propTypes","PropTypes","string","modifier","bool","defaultProps","_default","withTitle","exports"],"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: '',\n parserOptions: {},\n disableWrapper: false\n};\n\nexport default withTitle(Code);\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA,IAAAA,MAAA,GAAAC,uBAAA,CAAAC,OAAA;AACA,IAAAC,UAAA,GAAAC,sBAAA,CAAAF,OAAA;AACA,IAAAG,gBAAA,GAAAD,sBAAA,CAAAF,OAAA;AACA,IAAAI,QAAA,GAAAF,sBAAA,CAAAF,OAAA;AACA,IAAAK,IAAA,GAAAL,OAAA;AACA,IAAAM,MAAA,GAAAN,OAAA;AACA,IAAAO,UAAA,GAAAP,OAAA;AACA,IAAAQ,QAAA,GAAAR,OAAA;AAA2C,IAAAS,SAAA;AAAA,SAAAC,yBAAAC,WAAA,eAAAC,OAAA,kCAAAC,iBAAA,OAAAD,OAAA,QAAAE,gBAAA,OAAAF,OAAA,YAAAF,wBAAA,YAAAA,yBAAAC,WAAA,WAAAA,WAAA,GAAAG,gBAAA,GAAAD,iBAAA,KAAAF,WAAA;AAAA,SAAAZ,wBAAAgB,GAAA,EAAAJ,WAAA,SAAA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A,WAAO;IAAC8D,SAAS,EAAEA;EAAU,GAAEF,WAAqB,CAAC;AAC/D,CAAC,CAAC;AAEFX,IAAI,CAACiB,SAAS,GAAG;EACfb,IAAI,EAAEc,qBAAS,CAACC,MAAM;EACtBC,QAAQ,EAAEF,qBAAS,CAACC,MAAM;EAC1Bd,aAAa,EAAEa,qBAAS,CAACtC,MAAM;EAC/B0B,cAAc,EAAEY,qBAAS,CAACG;AAC5B,CAAC;AAEDrB,IAAI,CAACsB,YAAY,GAAG;EAClBlB,IAAI,EAAE,EAAE;EACRgB,QAAQ,EAAE,EAAE;EACZf,aAAa,EAAE,CAAC,CAAC;EACjBC,cAAc,EAAE;AAClB,CAAC;AAAC,IAAAiB,QAAA,GAEa,IAAAC,cAAS,EAACxB,IAAI,CAAC;AAAAyB,OAAA,cAAAF,QAAA"}
@@ -20,6 +20,7 @@ var _lodash2 = _interopRequireDefault(require("lodash.flatten"));
20
20
  var _getLinkToPublishedContent = _interopRequireDefault(require("./get-link-to-published-content"));
21
21
  var _getLoopPropsLimit = _interopRequireDefault(require("./get-loop-props-limit"));
22
22
  var _getPropValue = _interopRequireDefault(require("./get-prop-value"));
23
+ var _helpers = require("../../../helpers");
23
24
  var getLoopValue = function getLoopValue(value) {
24
25
  var keyField = value.keyField;
25
26
  return value[keyField];
@@ -62,10 +63,12 @@ var buildLoopPropsContent = function buildLoopPropsContent() {
62
63
  modifier = _options$modifier === void 0 ? '' : _options$modifier;
63
64
  return propertiesToDisplay.map(function (key) {
64
65
  var loopValue = loopValues[key];
65
- var propValue = loopValue ? getLoopValue(loopValue[i]) : regularValues[key];
66
+ var loopValueItem = loopValue && loopValue[i];
67
+ var propValue = loopValueItem ? getLoopValue(loopValueItem) : regularValues[key];
66
68
  if (!propValue) return null;
67
- var linkToPublishedContent = (0, _getLinkToPublishedContent["default"])(key, data);
68
- return [(0, _lodash["default"])(label), propValue, linkToPublishedContent, modifier];
69
+ var processedValue = (0, _helpers.processDataSummaryValue)(propValue, options);
70
+ var linkToPublishedContent = (0, _getLinkToPublishedContent["default"])(key, data, loopValueItem);
71
+ return [(0, _lodash["default"])(label), processedValue, linkToPublishedContent, modifier];
69
72
  });
70
73
  })).filter(Boolean);
71
74
  loopPropsWithContent.push(propsArray);
@@ -1 +1 @@
1
- {"version":3,"file":"build-loop-props-content.js","names":["_lodash","_interopRequireDefault","require","_lodash2","_getLinkToPublishedContent","_getLoopPropsLimit","_getPropValue","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","getPropValue","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","arguments","length","undefined","limit","loopPropsWithContent","_separateValues","_separateValues2","_slicedToArray2","loopLimit","getLoopPropsLimit","_loop","i","propsArray","flatten","map","label","_options$modifier","modifier","key","loopValue","propValue","linkToPublishedContent","getLinkToPublishedContent","upperFirst","filter","Boolean","push","_default","exports"],"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,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,0BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,kBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,aAAA,GAAAL,sBAAA,CAAAC,OAAA;AAEA,IAAMK,YAAY,GAAG,SAAfA,YAAYA,CAAGC,KAAK,EAAI;EAC5B,IAAQC,QAAQ,GAAKD,KAAK,CAAlBC,QAAQ;EAChB,OAAOD,KAAK,CAACC,QAAQ,CAAC;AACxB,CAAC;AAED,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,cAAc,EAAEC,SAAS,EAAEC,IAAI,EAAK;EAC1D,IAAMC,aAAa,GAAG,CAAC,CAAC;EACxB,IAAMC,UAAU,GAAG,CAAC,CAAC;EAErBJ,cAAc,CAACK,OAAO,CAAC,UAAAC,OAAO,EAAI;IAChC,IAAQC,mBAAmB,GAAKD,OAAO,CAA/BC,mBAAmB;IAC3BA,mBAAmB,CAACF,OAAO,CAAC,UAAAG,IAAI,EAAI;MAClC,IAAMX,KAAK,GAAG,IAAAY,wBAAY,EAACD,IAAI,EAAEN,IAAI,EAAEI,OAAO,CAAC;MAC/C,IAA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7B,cAAc,CAAC8B,GAAG,CAAC,UAAAxB,OAAO,EAAI;MAC5B,IAAQC,mBAAmB,GAA2BD,OAAO,CAArDC,mBAAmB;QAAEwB,KAAK,GAAoBzB,OAAO,CAAhCyB,KAAK;QAAAC,iBAAA,GAAoB1B,OAAO,CAAzB2B,QAAQ;QAARA,QAAQ,GAAAD,iBAAA,cAAG,EAAE,GAAAA,iBAAA;MAEjD,OAAOzB,mBAAmB,CAACuB,GAAG,CAAC,UAAAI,GAAG,EAAI;QACpC,IAAMC,SAAS,GAAG/B,UAAU,CAAC8B,GAAG,CAAC;QACjC,IAAME,SAAS,GAAGD,SAAS,GAAGvC,YAAY,CAACuC,SAAS,CAACR,CAAC,CAAC,CAAC,GAAGxB,aAAa,CAAC+B,GAAG,CAAC;QAC7E,IAAI,CAACE,SAAS,EAAE,OAAO,IAAI;QAC3B,IAAMC,sBAAsB,GAAG,IAAAC,qCAAyB,EAACJ,GAAG,EAAEhC,IAAI,CAAC;QACnE,OAAO,CAAC,IAAAqC,kBAAU,EAACR,KAAK,CAAC,EAAEK,SAAS,EAAEC,sBAAsB,EAAEJ,QAAQ,CAAC;MACzE,CAAC,CAAC;IACJ,CAAC,CACH,CAAC,CAACO,MAAM,CAACC,OAAO,CAAC;IACjBrB,oBAAoB,CAACsB,IAAI,CAACd,UAAU,CAAC;EACvC,CAAC;EAfD,KAAK,IAAID,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,SAAS,EAAEG,CAAC,IAAI,CAAC;IAAAD,KAAA,CAAAC,CAAA;EAAA;EAiBrC,OAAO,IAAAE,mBAAO,EAACT,oBAAoB,CAAC;AACtC,CAAC;AAAC,IAAAuB,QAAA,GAEa5B,qBAAqB;AAAA6B,OAAA,cAAAD,QAAA"}
1
+ {"version":3,"file":"build-loop-props-content.js","names":["_lodash","_interopRequireDefault","require","_lodash2","_getLinkToPublishedContent","_getLoopPropsLimit","_getPropValue","_helpers","getLoopValue","value","keyField","separateValues","propsToDisplay","loopProps","data","regularValues","loopValues","forEach","options","propertiesToDisplay","prop","getPropValue","isArrayValue","Array","isArray","isLoopableProp","includes","buildLoopPropsContent","arguments","length","undefined","limit","loopPropsWithContent","_separateValues","_separateValues2","_slicedToArray2","loopLimit","getLoopPropsLimit","_loop","i","propsArray","flatten","map","label","_options$modifier","modifier","key","loopValue","loopValueItem","propValue","processedValue","processDataSummaryValue","linkToPublishedContent","getLinkToPublishedContent","upperFirst","filter","Boolean","push","_default","exports"],"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,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,0BAAA,GAAAH,sBAAA,CAAAC,OAAA;AACA,IAAAG,kBAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,aAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,QAAA,GAAAL,OAAA;AAEA,IAAMM,YAAY,GAAG,SAAfA,YAAYA,CAAGC,KAAK,EAAI;EAC5B,IAAQC,QAAQ,GAAKD,KAAK,CAAlBC,QAAQ;EAChB,OAAOD,KAAK,CAACC,QAAQ,CAAC;AACxB,CAAC;AAED,IAAMC,cAAc,GAAG,SAAjBA,cAAcA,CAAIC,cAAc,EAAEC,SAAS,EAAEC,IAAI,EAAK;EAC1D,IAAMC,aAAa,GAAG,CAAC,CAAC;EACxB,IAAMC,UAAU,GAAG,CAAC,CAAC;EAErBJ,cAAc,CAACK,OAAO,CAAC,UAAAC,OAAO,EAAI;IAChC,IAAQC,mBAAmB,GAAKD,OAAO,CAA/BC,mBAAmB;IAC3BA,mBAAmB,CAACF,OAAO,CAAC,UAAAG,IAAI,EAAI;MAClC,IAAMX,KAAK,GAAG,IAAAY,wBAAY,EAACD,IAAI,EAAEN,IAAI,EAAEI,OAAO,CAAC;MAC/C,IAAMI,YAAY,GAAGC,KAAK,CAACC,OAAO,CAACf,KAAK,CAAC;MACzC,IAAI,CAACA,KAAK,EAAE;MACZ,IAAMgB,cAAc,GAAGZ,SAAS,CAACa,QAAQ,CAACN,IAAI,CAAC,IAAI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C,iBAAA,GAAoB1B,OAAO,CAAzB2B,QAAQ;QAARA,QAAQ,GAAAD,iBAAA,cAAG,EAAE,GAAAA,iBAAA;MAEjD,OAAOzB,mBAAmB,CAACuB,GAAG,CAAC,UAAAI,GAAG,EAAI;QACpC,IAAMC,SAAS,GAAG/B,UAAU,CAAC8B,GAAG,CAAC;QACjC,IAAME,aAAa,GAAGD,SAAS,IAAIA,SAAS,CAACR,CAAC,CAAC;QAC/C,IAAMU,SAAS,GAAGD,aAAa,GAAGxC,YAAY,CAACwC,aAAa,CAAC,GAAGjC,aAAa,CAAC+B,GAAG,CAAC;QAClF,IAAI,CAACG,SAAS,EAAE,OAAO,IAAI;QAE3B,IAAMC,cAAc,GAAG,IAAAC,gCAAuB,EAACF,SAAS,EAAE/B,OAAO,CAAC;QAClE,IAAMkC,sBAAsB,GAAG,IAAAC,qCAAyB,EAACP,GAAG,EAAEhC,IAAI,EAAEkC,aAAa,CAAC;QAClF,OAAO,CAAC,IAAAM,kBAAU,EAACX,KAAK,CAAC,EAAEO,cAAc,EAAEE,sBAAsB,EAAEP,QAAQ,CAAC;MAC9E,CAAC,CAAC;IACJ,CAAC,CACH,CAAC,CAACU,MAAM,CAACC,OAAO,CAAC;IACjBxB,oBAAoB,CAACyB,IAAI,CAACjB,UAAU,CAAC;EACvC,CAAC;EAlBD,KAAK,IAAID,CAAC,GAAG,CAAC,EAAEA,CAAC,GAAGH,SAAS,EAAEG,CAAC,IAAI,CAAC;IAAAD,KAAA,CAAAC,CAAA;EAAA;EAoBrC,OAAO,IAAAE,mBAAO,EAACT,oBAAoB,CAAC;AACtC,CAAC;AAAC,IAAA0B,QAAA,GAEa/B,qBAAqB;AAAAgC,OAAA,cAAAD,QAAA"}
@@ -37,8 +37,9 @@ var buildPropsToDisplayWithContent = function buildPropsToDisplayWithContent(pro
37
37
  if (!key) return null;
38
38
  var objPropValue = (0, _getPropValue["default"])(key, props, options);
39
39
  if (!objPropValue) return null;
40
- var link = getLink(enableLink, key, props, objPropValue);
41
- return [(0, _lodash["default"])(label), objPropValue, link, modifier];
40
+ var processedValue = (0, _helpers.processDataSummaryValue)(objPropValue, options);
41
+ var link = getLink(enableLink, key, props, processedValue);
42
+ return [(0, _lodash["default"])(label), processedValue, link, modifier];
42
43
  });
43
44
  })).filter(Boolean);
44
45
  };
@@ -1 +1 @@
1
- {"version":3,"file":"build-props-to-display-with-content.js","names":["_lodash","_interopRequireDefault","require","_lodash2","_helpers","_getLinkToPublishedContent","_getPropValue","_getLinkBasedOnValue","buildPropsToDisplayWithContent","props","propsToDisplay","arguments","length","undefined","isObject","map","key","propValue","getPropValue","propName","split","join","upperFirst","filter","Boolean","flatten","options","propertiesToDisplay","label","_options$modifier","modifier","enableLink","objPropValue","link","getLink","_default","exports","getLinkToPublishedContent","getLinkBasedOnValue"],"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 = get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MAAAC,iBAAA,GAAgCH,OAAO,CAArCI,QAAQ;MAARA,QAAQ,GAAAD,iBAAA,cAAG,EAAE,GAAAA,iBAAA;MAAEE,UAAU,GAAKL,OAAO,CAAtBK,UAAU;IAC7D,OAAOJ,mBAAmB,CAACZ,GAAG,CAAC,UAAAC,GAAG,EAAI;MACpC,IAAI,CAACA,GAAG,EAAE,OAAO,IAAI;MAErB,IAAMgB,YAAY,GAAG,IAAAd,wBAAY,EAACF,GAAG,EAAEP,KAAK,EAAEiB,OAAO,CAAC;MACtD,IAAI,CAACM,YAAY,EAAE,OAAO,IAAI;MAE9B,IAAMC,IAAI,GAAGC,OAAO,CAACH,UAAU,EAAEf,GAAG,EAAEP,KAAK,EAAEuB,YAAY,CAAC;MAE1D,OAAO,CAAC,IAAAV,kBAAU,EAACM,KAAK,CAAC,EAAEI,YAAY,EAAEC,IAAI,EAAEH,QAAQ,CAAC;IAC1D,CAAC,CAAC;EACJ,CAAC,CACH,CAAC,CAACP,MAAM,CAACC,OAAO,CAAC;AACnB,CAAC;AAAC,IAAAW,QAAA,GAEa3B,8BAA8B;AAAA4B,OAAA,cAAAD,QAAA;AAC7C,SAASD,OAAOA,CAACH,UAAU,EAAEf,GAAG,EAAEP,KAAK,EAAEuB,YAAY,EAAE;EACrD,IAAIC,IAAI,GAAG,EAAE;EACb,IAAIF,UAAU,EAAE;IACdE,IAAI,GAAG,IAAAI,qCAAyB,EAACrB,GAAG,EAAEP,KAAK,CAAC;IAC5C,IAAI,CAACwB,IAAI,EAAE;MACTA,IAAI,GAAG,IAAAK,+BAAmB,EAACN,YAAY,CAAC;IAC1C;EACF;EACA,OAAOC,IAAI;AACb"}
1
+ {"version":3,"file":"build-props-to-display-with-content.js","names":["_lodash","_interopRequireDefault","require","_lodash2","_helpers","_getLinkToPublishedContent","_getPropValue","_getLinkBasedOnValue","buildPropsToDisplayWithContent","props","propsToDisplay","arguments","length","undefined","isObject","map","key","propValue","getPropValue","propName","split","join","upperFirst","filter","Boolean","flatten","options","propertiesToDisplay","label","_options$modifier","modifier","enableLink","objPropValue","processedValue","processDataSummaryValue","link","getLink","_default","exports","getLinkToPublishedContent","getLinkBasedOnValue"],"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,IAAAA,OAAA,GAAAC,sBAAA,CAAAC,OAAA;AACA,IAAAC,QAAA,GAAAF,sBAAA,CAAAC,OAAA;AACA,IAAAE,QAAA,GAAAF,OAAA;AACA,IAAAG,0BAAA,GAAAJ,sBAAA,CAAAC,OAAA;AACA,IAAAI,aAAA,GAAAL,sBAAA,CAAAC,OAAA;AACA,IAAAK,oBAAA,GAAAN,sBAAA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