@blaze-cms/react-page-builder 0.124.0-alpha.4 → 0.124.0-alpha.40
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.
- package/CHANGELOG.md +320 -0
- package/README.md +9 -0
- package/example.env +1 -0
- package/lib/BannerContext/index.js.map +1 -1
- package/lib/HOC/withInfiniteScroll.js.map +1 -1
- package/lib/HOC/withTitle.js.map +1 -1
- package/lib/PBContext/index.js.map +1 -1
- package/lib/application/query/index.js +9 -3
- package/lib/application/query/index.js.map +1 -1
- package/lib/components/BackToTop/BackToTop.js.map +1 -1
- package/lib/components/Banner/AdSlotRender.js.map +1 -1
- package/lib/components/Banner/Banner.js.map +1 -1
- package/lib/components/Banner/BannerRender.js.map +1 -1
- package/lib/components/Banner/helpers.js.map +1 -1
- package/lib/components/Banner/index.js.map +1 -1
- package/lib/components/BlazeLink.js.map +1 -1
- package/lib/components/Breadcrumb/Breadcrumb.js.map +1 -1
- package/lib/components/Button.js.map +1 -1
- package/lib/components/Card/Card.js.map +1 -1
- package/lib/components/Card/CardContainer.js +3 -7
- package/lib/components/Card/CardContainer.js.map +1 -1
- package/lib/components/Card/CardFactory.js +6 -3
- package/lib/components/Card/CardFactory.js.map +1 -1
- package/lib/components/Card/CardRender.js.map +1 -1
- package/lib/components/Card/helpers/filter-query-setup.js.map +1 -1
- package/lib/components/Card/helpers/filters-setup.js.map +1 -1
- package/lib/components/Card/helpers/get-dynamic-grid-classes.js.map +1 -1
- package/lib/components/Carousel/Carousel.js.map +1 -1
- package/lib/components/Carousel/CarouselImage/CarouselImage.js.map +1 -1
- package/lib/components/Carousel/CarouselRender/CarouselRender.js.map +1 -1
- package/lib/components/CarouselWrapper.js +2 -2
- package/lib/components/CarouselWrapper.js.map +1 -1
- package/lib/components/ClickWrapper.js.map +1 -1
- package/lib/components/Code/Code.js.map +1 -1
- package/lib/components/Code/ScriptTag.js.map +1 -1
- package/lib/components/Code/helpers/wrap-script-tags.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryFactory.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryRender.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/HeadingLargeSummary.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/HeadingLargeSummary/HeadingLargeSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummary.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/ItemDetailsSummary/ItemDetailsSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/LargeSummary/LargeSummary.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/LargeSummary/LargeSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/ListSummary/ListSummary.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/ListSummary/ListSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/TextSummary/TextSummary.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/TextSummary/TextSummaryContent.js.map +1 -1
- package/lib/components/DataSummary/DataSummaryTypes/index.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-loop-props-content.js.map +1 -1
- package/lib/components/DataSummary/helpers/build-props-to-display-with-content.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-data-summary-query.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-link-based-on-value.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-prop-value.js.map +1 -1
- package/lib/components/DataSummary/helpers/get-value-from-array.js.map +1 -1
- package/lib/components/DataSummary/helpers/strip-summary-props-content.js.map +1 -1
- package/lib/components/EmailConfirm/EmailConfirm.js.map +1 -1
- package/lib/components/Image/GlobalLightbox/GlobalLightbox.js.map +1 -1
- package/lib/components/Image/GlobalLightbox/NavButton.js.map +1 -1
- package/lib/components/Image/GlobalLightbox/index.js.map +1 -1
- package/lib/components/Image/Image.js.map +1 -1
- package/lib/components/Image/ImageDetails.js.map +1 -1
- package/lib/components/Image/ImageFactory.js.map +1 -1
- package/lib/components/Image/ImageRender.js +5 -1
- package/lib/components/Image/ImageRender.js.map +1 -1
- package/lib/components/Image/Lightbox/Lightbox.js.map +1 -1
- package/lib/components/ItemList/ItemListButton/ItemListButton.js +161 -0
- package/lib/components/ItemList/ItemListButton/ItemListButton.js.map +1 -0
- package/lib/components/ItemList/ItemListButton/index.js +16 -0
- package/lib/components/ItemList/ItemListButton/index.js.map +1 -0
- package/lib/components/ItemList/ItemListCounter/ItemListCounter.js +83 -0
- package/lib/components/ItemList/ItemListCounter/ItemListCounter.js.map +1 -0
- package/lib/components/ItemList/ItemListCounter/index.js +16 -0
- package/lib/components/ItemList/ItemListCounter/index.js.map +1 -0
- package/lib/components/ItemList/ItemListNew/ItemListNew.js +87 -0
- package/lib/components/ItemList/ItemListNew/ItemListNew.js.map +1 -0
- package/lib/components/ItemList/ItemListNew/index.js +16 -0
- package/lib/components/ItemList/ItemListNew/index.js.map +1 -0
- package/lib/components/ItemList/constants.js +19 -0
- package/lib/components/ItemList/constants.js.map +1 -0
- package/lib/components/ItemList/helpers/get-item-list-data.js +17 -0
- package/lib/components/ItemList/helpers/get-item-list-data.js.map +1 -0
- package/lib/components/ItemList/helpers/get-item-list-id.js +23 -0
- package/lib/components/ItemList/helpers/get-item-list-id.js.map +1 -0
- package/lib/components/ItemList/helpers/get-item-list-ids.js +28 -0
- package/lib/components/ItemList/helpers/get-item-list-ids.js.map +1 -0
- package/lib/components/ItemList/helpers/index.js +50 -0
- package/lib/components/ItemList/helpers/index.js.map +1 -0
- package/lib/components/ItemList/helpers/set-item-list-id.js +22 -0
- package/lib/components/ItemList/helpers/set-item-list-id.js.map +1 -0
- package/lib/components/ItemList/helpers/set-param-and-redirect.js +51 -0
- package/lib/components/ItemList/helpers/set-param-and-redirect.js.map +1 -0
- package/lib/components/ItemList/hooks/index.js +18 -0
- package/lib/components/ItemList/hooks/index.js.map +1 -0
- package/lib/components/ItemList/hooks/use-item-list-id.js +45 -0
- package/lib/components/ItemList/hooks/use-item-list-id.js.map +1 -0
- package/lib/components/Layout/Layout.js.map +1 -1
- package/lib/components/Layout/helpers/check-if-row-has-columns.js.map +1 -1
- package/lib/components/LazyImage/LazyImage.js +5 -1
- package/lib/components/LazyImage/LazyImage.js.map +1 -1
- package/lib/components/LazyImage/index.js.map +1 -1
- package/lib/components/List/ListBuilder.js +12 -6
- package/lib/components/List/ListBuilder.js.map +1 -1
- package/lib/components/List/ListFactory.js +34 -7
- package/lib/components/List/ListFactory.js.map +1 -1
- package/lib/components/List/ListRender.js.map +1 -1
- package/lib/components/List/components/Cards/CardRenderWithInfiniteScroll.js.map +1 -1
- package/lib/components/List/components/Cards/CardsRender.js.map +1 -1
- package/lib/components/List/components/Cards/CardsRenderItem.js.map +1 -1
- package/lib/components/List/components/Cards/CardsRenderWrapper.js.map +1 -1
- package/lib/components/List/components/Full/FullRender.js.map +1 -1
- package/lib/components/List/components/Full/FullRenderItem.js.map +1 -1
- package/lib/components/List/components/Full/FullRenderWithInfiniteScroll.js.map +1 -1
- package/lib/components/List/components/Header/ListHeader.js.map +1 -1
- package/lib/components/List/components/Pagination/Classic.js.map +1 -1
- package/lib/components/List/components/Pagination/ListPagination.js.map +1 -1
- package/lib/components/List/components/Pagination/LoadMore.js.map +1 -1
- package/lib/components/List/helpers/build-az-aggregations.js.map +1 -1
- package/lib/components/List/helpers/build-az-url.js.map +1 -1
- package/lib/components/List/helpers/build-pagination-items.js.map +1 -1
- package/lib/components/List/helpers/build-pagination-url.js.map +1 -1
- package/lib/components/List/helpers/has-required-item-list-details.js +29 -0
- package/lib/components/List/helpers/has-required-item-list-details.js.map +1 -0
- package/lib/components/List/helpers/index.js +8 -0
- package/lib/components/List/helpers/index.js.map +1 -1
- package/lib/components/Login/LoggedInMessage.js.map +1 -1
- package/lib/components/Login/Login.js.map +1 -1
- package/lib/components/Login/LoginForm.js.map +1 -1
- package/lib/components/Menu/Menu.js +41 -28
- package/lib/components/Menu/Menu.js.map +1 -1
- package/lib/components/Menu/MenuContext.js +20 -0
- package/lib/components/Menu/MenuContext.js.map +1 -0
- package/lib/components/MenuItem/MenuItem.js +26 -7
- package/lib/components/MenuItem/MenuItem.js.map +1 -1
- package/lib/components/Modal/Modal.js.map +1 -1
- package/lib/components/PasswordReset/PasswordReset.js.map +1 -1
- package/lib/components/PasswordReset/helpers/validatePassword.js.map +1 -1
- package/lib/components/PasswordResetRequest/PasswordResetRequest.js.map +1 -1
- package/lib/components/SearchContent/SearchContent.js +183 -0
- package/lib/components/SearchContent/SearchContent.js.map +1 -0
- package/lib/components/SearchContent/SearchContentItems.js +51 -0
- package/lib/components/SearchContent/SearchContentItems.js.map +1 -0
- package/lib/components/SearchContent/SearchContentResults.js +45 -0
- package/lib/components/SearchContent/SearchContentResults.js.map +1 -0
- package/lib/components/SearchContent/SearchContentToggleIcon.js +42 -0
- package/lib/components/SearchContent/SearchContentToggleIcon.js.map +1 -0
- package/lib/components/SearchContent/index.js +2 -233
- package/lib/components/SearchContent/index.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/CloseMobileForm.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/FiltersList.js +2 -4
- package/lib/components/SearchFilter/SearchFilter/FiltersList.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/MobileFormToolbar.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/ResetDesktopForm.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js +27 -69
- package/lib/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib/components/SearchFilter/SearchFilterContainer.js +87 -23
- package/lib/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib/components/SearchFilter/components/Checkbox.js +19 -9
- package/lib/components/SearchFilter/components/Checkbox.js.map +1 -1
- package/lib/components/SearchFilter/components/Range.js.map +1 -1
- package/lib/components/SearchFilter/components/Select.js +27 -11
- package/lib/components/SearchFilter/components/Select.js.map +1 -1
- package/lib/components/SearchFilter/components/TextSearch.js +1 -5
- package/lib/components/SearchFilter/components/TextSearch.js.map +1 -1
- package/lib/components/SearchFilter/constants.js +1 -1
- package/lib/components/SearchFilter/constants.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-filters-query.js +87 -0
- package/lib/components/SearchFilter/helpers/build-filters-query.js.map +1 -0
- package/lib/components/SearchFilter/helpers/build-query.js.map +1 -1
- package/lib/components/SearchFilter/helpers/build-raw-query-stringified.js +2 -1
- package/lib/components/SearchFilter/helpers/build-raw-query-stringified.js.map +1 -1
- package/lib/components/SearchFilter/helpers/calculate-min-max.js.map +1 -1
- package/lib/components/SearchFilter/helpers/check-if-range-updated.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-filter-value-from-query.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-intersected-prop.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-range-value.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-responsive-filter-classnames.js.map +1 -1
- package/lib/components/SearchFilter/helpers/get-select-options.js.map +1 -1
- package/lib/components/SearchFilter/helpers/index.js +8 -0
- package/lib/components/SearchFilter/helpers/index.js.map +1 -1
- package/lib/components/SearchFilterSort/SearchFilterSort.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/handle-sort-update.js.map +1 -1
- package/lib/components/SearchFilterSort/helpers/update-sort.js.map +1 -1
- package/lib/components/SocialFollow/SFItem.js.map +1 -1
- package/lib/components/SocialFollow/SocialFollow.js.map +1 -1
- package/lib/components/SocialFollow/SocialFollowRender.js.map +1 -1
- package/lib/components/SubMenu/SubMenu.js.map +1 -1
- package/lib/components/TextBlock/TextBlockRender.js.map +1 -1
- package/lib/components/TextBlock/index.js.map +1 -1
- package/lib/components/Video/Video.js.map +1 -1
- package/lib/components/Video/VideoModal.js.map +1 -1
- package/lib/components/Video/VideoRender.js.map +1 -1
- package/lib/components/Video/providers/Default.js.map +1 -1
- package/lib/components/Video/providers/JWPlayer/JWPlayerProvider.js.map +1 -1
- package/lib/components/Video/providers/YouTube/YouTubeProvider.js.map +1 -1
- package/lib/components/Video/providers/YouTube/YoutubeEmbeded.js.map +1 -1
- package/lib/components/Video/providers/get-provider.js.map +1 -1
- package/lib/components/Wrapper.js.map +1 -1
- package/lib/components/index.js +16 -1
- package/lib/components/index.js.map +1 -1
- package/lib/constants/index.js +3 -1
- package/lib/constants/index.js.map +1 -1
- package/lib/helpers/build-inherited-filters.js.map +1 -1
- package/lib/helpers/build-raw-query-base.js.map +1 -1
- package/lib/helpers/build-raw-query.js.map +1 -1
- package/lib/helpers/build-search-values-checkbox-select.js.map +1 -1
- package/lib/helpers/check-props-to-use.js.map +1 -1
- package/lib/helpers/get-entities-with-banner.js.map +1 -1
- package/lib/helpers/get-entity-data.js.map +1 -1
- package/lib/helpers/get-entity-render-props.js.map +1 -1
- package/lib/helpers/get-filter-props.js.map +1 -1
- package/lib/helpers/get-generic-props.js.map +1 -1
- package/lib/helpers/get-generic-render-variables.js.map +1 -1
- package/lib/helpers/get-image-ids.js.map +1 -1
- package/lib/helpers/get-parsed-prop-values.js.map +1 -1
- package/lib/helpers/get-prop-values.js.map +1 -1
- package/lib/helpers/get-query-filters.js.map +1 -1
- package/lib/helpers/get-query-props.js.map +1 -1
- package/lib/helpers/get-updated-filter-by.js.map +1 -1
- package/lib/helpers/inject-banner.js.map +1 -1
- package/lib/helpers/inject-banners-to-entities.js.map +1 -1
- package/lib/helpers/inject-multiple-banners/get-banners-for-entities/get-banners-for-entities.js.map +1 -1
- package/lib/helpers/inject-multiple-banners/get-banners-for-nodes/get-banners-for-nodes.js.map +1 -1
- package/lib/helpers/inject-multiple-banners/get-banners-for-nodes/helpers/group-node-entities.js.map +1 -1
- package/lib/helpers/inject-multiple-banners/inject-multiple-banners.js.map +1 -1
- package/lib/helpers/is-filter-entitys-id.js.map +1 -1
- package/lib/helpers/parse-TextBlock.js.map +1 -1
- package/lib/helpers/parse-props-to-display.js.map +1 -1
- package/lib/helpers/render-children.js.map +1 -1
- package/lib/helpers/sort-response-data.js.map +1 -1
- package/lib/hooks/helpers/RenderComponent.js.map +1 -1
- package/lib/hooks/helpers/append-gtm-classname.js +1 -0
- package/lib/hooks/helpers/append-gtm-classname.js.map +1 -1
- package/lib/hooks/helpers/buildPBComponents.js.map +1 -1
- package/lib/hooks/helpers/getComponent.js.map +1 -1
- package/lib/hooks/helpers/inject-element-banners.js.map +1 -1
- package/lib/hooks/helpers/inject-textblock-banners.js.map +1 -1
- package/lib/hooks/helpers/insert-banners.js.map +1 -1
- package/lib/hooks/helpers/update-targetings.js.map +1 -1
- package/lib/hooks/use-banner-insertion.js.map +1 -1
- package/lib/hooks/use-check-mobile-screen.js.map +1 -1
- package/lib/hooks/use-get-entity-schema.js.map +1 -1
- package/lib/hooks/use-get-entity-schemas-as-obj.js.map +1 -1
- package/lib/hooks/use-get-image-id-from-relation.js.map +1 -1
- package/lib/hooks/use-get-images.js.map +1 -1
- package/lib/hooks/use-get-single-entity-schema.js.map +1 -1
- package/lib/hooks/use-page-builder.js.map +1 -1
- package/lib/utils/get-class-modifiers.js.map +1 -1
- package/lib/utils/get-image-data.js.map +1 -1
- package/lib-es/application/query/index.js +49 -1
- package/lib-es/application/query/index.js.map +1 -1
- package/lib-es/components/Card/CardContainer.js +3 -7
- package/lib-es/components/Card/CardContainer.js.map +1 -1
- package/lib-es/components/Card/CardFactory.js +7 -4
- package/lib-es/components/Card/CardFactory.js.map +1 -1
- package/lib-es/components/CarouselWrapper.js +2 -2
- package/lib-es/components/CarouselWrapper.js.map +1 -1
- package/lib-es/components/Image/ImageRender.js +4 -1
- package/lib-es/components/Image/ImageRender.js.map +1 -1
- package/lib-es/components/ItemList/ItemListButton/ItemListButton.js +111 -0
- package/lib-es/components/ItemList/ItemListButton/ItemListButton.js.map +1 -0
- package/lib-es/components/ItemList/ItemListButton/index.js +3 -0
- package/lib-es/components/ItemList/ItemListButton/index.js.map +1 -0
- package/lib-es/components/ItemList/ItemListCounter/ItemListCounter.js +60 -0
- package/lib-es/components/ItemList/ItemListCounter/ItemListCounter.js.map +1 -0
- package/lib-es/components/ItemList/ItemListCounter/index.js +3 -0
- package/lib-es/components/ItemList/ItemListCounter/index.js.map +1 -0
- package/lib-es/components/ItemList/ItemListNew/ItemListNew.js +64 -0
- package/lib-es/components/ItemList/ItemListNew/ItemListNew.js.map +1 -0
- package/lib-es/components/ItemList/ItemListNew/index.js +3 -0
- package/lib-es/components/ItemList/ItemListNew/index.js.map +1 -0
- package/lib-es/components/ItemList/constants.js +6 -0
- package/lib-es/components/ItemList/constants.js.map +1 -0
- package/lib-es/components/ItemList/helpers/get-item-list-data.js +7 -0
- package/lib-es/components/ItemList/helpers/get-item-list-data.js.map +1 -0
- package/lib-es/components/ItemList/helpers/get-item-list-id.js +11 -0
- package/lib-es/components/ItemList/helpers/get-item-list-id.js.map +1 -0
- package/lib-es/components/ItemList/helpers/get-item-list-ids.js +13 -0
- package/lib-es/components/ItemList/helpers/get-item-list-ids.js.map +1 -0
- package/lib-es/components/ItemList/helpers/index.js +6 -0
- package/lib-es/components/ItemList/helpers/index.js.map +1 -0
- package/lib-es/components/ItemList/helpers/set-item-list-id.js +10 -0
- package/lib-es/components/ItemList/helpers/set-item-list-id.js.map +1 -0
- package/lib-es/components/ItemList/helpers/set-param-and-redirect.js +20 -0
- package/lib-es/components/ItemList/helpers/set-param-and-redirect.js.map +1 -0
- package/lib-es/components/ItemList/hooks/index.js +2 -0
- package/lib-es/components/ItemList/hooks/index.js.map +1 -0
- package/lib-es/components/ItemList/hooks/use-item-list-id.js +26 -0
- package/lib-es/components/ItemList/hooks/use-item-list-id.js.map +1 -0
- package/lib-es/components/LazyImage/LazyImage.js +4 -1
- package/lib-es/components/LazyImage/LazyImage.js.map +1 -1
- package/lib-es/components/List/ListBuilder.js +12 -6
- package/lib-es/components/List/ListBuilder.js.map +1 -1
- package/lib-es/components/List/ListFactory.js +33 -9
- package/lib-es/components/List/ListFactory.js.map +1 -1
- package/lib-es/components/List/helpers/has-required-item-list-details.js +20 -0
- package/lib-es/components/List/helpers/has-required-item-list-details.js.map +1 -0
- package/lib-es/components/List/helpers/index.js +1 -0
- package/lib-es/components/List/helpers/index.js.map +1 -1
- package/lib-es/components/Menu/Menu.js +54 -46
- package/lib-es/components/Menu/Menu.js.map +1 -1
- package/lib-es/components/Menu/MenuContext.js +6 -0
- package/lib-es/components/Menu/MenuContext.js.map +1 -0
- package/lib-es/components/MenuItem/MenuItem.js +24 -9
- package/lib-es/components/MenuItem/MenuItem.js.map +1 -1
- package/lib-es/components/SearchContent/SearchContent.js +129 -0
- package/lib-es/components/SearchContent/SearchContent.js.map +1 -0
- package/lib-es/components/SearchContent/SearchContentItems.js +33 -0
- package/lib-es/components/SearchContent/SearchContentItems.js.map +1 -0
- package/lib-es/components/SearchContent/SearchContentResults.js +31 -0
- package/lib-es/components/SearchContent/SearchContentResults.js.map +1 -0
- package/lib-es/components/SearchContent/SearchContentToggleIcon.js +30 -0
- package/lib-es/components/SearchContent/SearchContentToggleIcon.js.map +1 -0
- package/lib-es/components/SearchContent/index.js +1 -172
- package/lib-es/components/SearchContent/index.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/FiltersList.js +2 -4
- package/lib-es/components/SearchFilter/SearchFilter/FiltersList.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js +21 -46
- package/lib-es/components/SearchFilter/SearchFilter/SearchFilter.js.map +1 -1
- package/lib-es/components/SearchFilter/SearchFilterContainer.js +70 -15
- package/lib-es/components/SearchFilter/SearchFilterContainer.js.map +1 -1
- package/lib-es/components/SearchFilter/components/Checkbox.js +18 -9
- package/lib-es/components/SearchFilter/components/Checkbox.js.map +1 -1
- package/lib-es/components/SearchFilter/components/Select.js +23 -8
- package/lib-es/components/SearchFilter/components/Select.js.map +1 -1
- package/lib-es/components/SearchFilter/components/TextSearch.js +1 -5
- package/lib-es/components/SearchFilter/components/TextSearch.js.map +1 -1
- package/lib-es/components/SearchFilter/constants.js +1 -1
- package/lib-es/components/SearchFilter/constants.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/build-filters-query.js +54 -0
- package/lib-es/components/SearchFilter/helpers/build-filters-query.js.map +1 -0
- package/lib-es/components/SearchFilter/helpers/build-raw-query-stringified.js +2 -1
- package/lib-es/components/SearchFilter/helpers/build-raw-query-stringified.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/get-initial-filter-values.js.map +1 -1
- package/lib-es/components/SearchFilter/helpers/index.js +2 -1
- package/lib-es/components/SearchFilter/helpers/index.js.map +1 -1
- package/lib-es/components/index.js +10 -1
- package/lib-es/components/index.js.map +1 -1
- package/lib-es/constants/index.js +2 -1
- package/lib-es/constants/index.js.map +1 -1
- package/lib-es/helpers/build-raw-query.js.map +1 -1
- package/lib-es/hooks/helpers/append-gtm-classname.js +1 -0
- package/lib-es/hooks/helpers/append-gtm-classname.js.map +1 -1
- package/package.json +5 -4
- package/src/application/query/index.js +55 -1
- package/src/components/Card/CardContainer.js +2 -6
- package/src/components/Card/CardFactory.js +5 -3
- package/src/components/CarouselWrapper.js +2 -2
- package/src/components/Image/ImageRender.js +3 -0
- package/src/components/ItemList/ItemListButton/ItemListButton.js +94 -0
- package/src/components/ItemList/ItemListButton/index.js +3 -0
- package/src/components/ItemList/ItemListCounter/ItemListCounter.js +52 -0
- package/src/components/ItemList/ItemListCounter/index.js +3 -0
- package/src/components/ItemList/ItemListNew/ItemListNew.js +51 -0
- package/src/components/ItemList/ItemListNew/index.js +3 -0
- package/src/components/ItemList/constants.js +5 -0
- package/src/components/ItemList/helpers/get-item-list-data.js +6 -0
- package/src/components/ItemList/helpers/get-item-list-id.js +11 -0
- package/src/components/ItemList/helpers/get-item-list-ids.js +10 -0
- package/src/components/ItemList/helpers/index.js +5 -0
- package/src/components/ItemList/helpers/set-item-list-id.js +9 -0
- package/src/components/ItemList/helpers/set-param-and-redirect.js +20 -0
- package/src/components/ItemList/hooks/index.js +1 -0
- package/src/components/ItemList/hooks/use-item-list-id.js +27 -0
- package/src/components/LazyImage/LazyImage.js +11 -1
- package/src/components/List/ListBuilder.js +10 -5
- package/src/components/List/ListFactory.js +48 -12
- package/src/components/List/helpers/has-required-item-list-details.js +14 -0
- package/src/components/List/helpers/index.js +1 -0
- package/src/components/Menu/Menu.js +61 -54
- package/src/components/Menu/MenuContext.js +5 -0
- package/src/components/MenuItem/MenuItem.js +39 -14
- package/src/components/SearchContent/SearchContent.js +136 -0
- package/src/components/SearchContent/SearchContentItems.js +28 -0
- package/src/components/SearchContent/SearchContentResults.js +27 -0
- package/src/components/SearchContent/SearchContentToggleIcon.js +27 -0
- package/src/components/SearchContent/index.js +1 -177
- package/src/components/SearchFilter/SearchFilter/FiltersList.js +30 -37
- package/src/components/SearchFilter/SearchFilter/SearchFilter.js +20 -28
- package/src/components/SearchFilter/SearchFilterContainer.js +58 -16
- package/src/components/SearchFilter/components/Checkbox.js +23 -8
- package/src/components/SearchFilter/components/Select.js +18 -11
- package/src/components/SearchFilter/components/TextSearch.js +1 -3
- package/src/components/SearchFilter/constants.js +1 -1
- package/src/components/SearchFilter/helpers/build-filters-query.js +40 -0
- package/src/components/SearchFilter/helpers/build-raw-query-stringified.js +2 -1
- package/src/components/SearchFilter/helpers/get-initial-filter-values.js +1 -0
- package/src/components/SearchFilter/helpers/index.js +3 -1
- package/src/components/index.js +10 -1
- package/src/constants/index.js +2 -0
- package/src/helpers/build-raw-query.js +1 -0
- package/src/hooks/helpers/append-gtm-classname.js +3 -0
- package/tests/helpers/mocks.js +4 -4
- package/tests/unit/src/components/ItemList/ItemListButton.test.js +175 -0
- package/tests/unit/src/components/ItemList/ItemListCounter.test.js +65 -0
- package/tests/unit/src/components/ItemList/ItemListNew.test.js +164 -0
- package/tests/unit/src/components/ItemList/__snapshots__/ItemListButton.test.js.snap +107 -0
- package/tests/unit/src/components/ItemList/__snapshots__/ItemListCounter.test.js.snap +31 -0
- package/tests/unit/src/components/ItemList/__snapshots__/ItemListNew.test.js.snap +27 -0
- package/tests/unit/src/components/ItemList/helpers/get-item-list-data.test.js +28 -0
- package/tests/unit/src/components/ItemList/helpers/get-item-list-id.test.js +20 -0
- package/tests/unit/src/components/ItemList/helpers/get-item-list-ids.test.js +19 -0
- package/tests/unit/src/components/ItemList/helpers/set-item-list-id.test.js +13 -0
- package/tests/unit/src/components/ItemList/helpers/set-param-and-redirect.test.js +30 -0
- package/tests/unit/src/components/ItemList/hooks/use-item-list-id.test.js +32 -0
- package/tests/unit/src/components/List/helpers/has-required-item-list-details.test.js +30 -0
- package/tests/unit/src/components/Menu/Menu.test.js +9 -3
- package/tests/unit/src/components/Menu/__snapshots__/Menu.test.js.snap +12 -11
- package/tests/unit/src/components/MenuItem/MenuItem.test.js +1 -1
- package/tests/unit/src/components/MenuItem/SubMenu.test.js +5 -1
- package/tests/unit/src/components/MenuItem/__snapshots__/MenuItem.test.js.snap +54 -10
- package/tests/unit/src/components/SearchContent/SearchContent.test.js +29 -0
- package/tests/unit/src/components/SearchContent/__snapshots__/SearchContent.test.js.snap +9 -0
- package/tests/unit/src/components/SearchFilter/SearchFilter/SearchFilter.test.js +26 -7
- package/tests/unit/src/components/SearchFilter/SearchFilter/__snapshots__/SearchFilter.test.js.snap +4 -0
- package/tests/unit/src/components/SearchFilter/components/__snapshots__/Checkbox.test.js.snap +2 -0
- package/tests/unit/src/components/SearchFilter/components/__snapshots__/Select.test.js.snap +4 -0
- package/tests/unit/src/components/__snapshots__/index.test.js.snap +12 -0
|
@@ -17,13 +17,10 @@ const FiltersList = ({
|
|
|
17
17
|
|
|
18
18
|
return filters.map(({ type, label, propsToDisplay, elementTitle, ...otherProps }, index) => {
|
|
19
19
|
if (!propsToDisplay && !propsToDisplay.length) return null;
|
|
20
|
-
|
|
21
20
|
const dynamicKey = [itemId, index].join('-');
|
|
22
21
|
const isDataAvailable = !!data && Object.keys(data).length;
|
|
23
22
|
const dataAggregations = isDataAvailable ? data : null;
|
|
24
23
|
const areAggregationsAvailable = isDataAvailable && !!dataAggregations;
|
|
25
|
-
const results = areAggregationsAvailable && dataAggregations[propsToDisplay[0]];
|
|
26
|
-
const shouldDisplayFilter = results && results.buckets && results.buckets.length;
|
|
27
24
|
|
|
28
25
|
switch (type) {
|
|
29
26
|
case TEXT_SEARCH:
|
|
@@ -43,43 +40,39 @@ const FiltersList = ({
|
|
|
43
40
|
);
|
|
44
41
|
case CHECKBOX:
|
|
45
42
|
return (
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
</div>
|
|
62
|
-
)
|
|
43
|
+
<div
|
|
44
|
+
key={dynamicKey}
|
|
45
|
+
className="filter__section filter__section--search-refine filter__section--checkboxes">
|
|
46
|
+
<Checkbox
|
|
47
|
+
{...otherProps}
|
|
48
|
+
data={data}
|
|
49
|
+
prop={propsToDisplay[0]}
|
|
50
|
+
label={label}
|
|
51
|
+
elementTitle={elementTitle}
|
|
52
|
+
hasUrl={hasUrl}
|
|
53
|
+
filterValues={filterValues}
|
|
54
|
+
updateFilterValues={updateFilterValues}
|
|
55
|
+
shouldSearch={shouldSearch}
|
|
56
|
+
/>
|
|
57
|
+
</div>
|
|
63
58
|
);
|
|
64
59
|
case SELECT:
|
|
65
60
|
return (
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
</div>
|
|
82
|
-
)
|
|
61
|
+
<div
|
|
62
|
+
key={dynamicKey}
|
|
63
|
+
className="filter__section filter__section--search-refine filter__section--selects">
|
|
64
|
+
<SelectFilter
|
|
65
|
+
{...otherProps}
|
|
66
|
+
data={data}
|
|
67
|
+
prop={propsToDisplay[0]}
|
|
68
|
+
label={label}
|
|
69
|
+
elementTitle={elementTitle}
|
|
70
|
+
hasUrl={hasUrl}
|
|
71
|
+
filterValues={filterValues}
|
|
72
|
+
updateFilterValues={updateFilterValues}
|
|
73
|
+
shouldSearch={shouldSearch}
|
|
74
|
+
/>
|
|
75
|
+
</div>
|
|
83
76
|
);
|
|
84
77
|
case RANGE:
|
|
85
78
|
return (
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useEffect
|
|
1
|
+
import React, { useState, useEffect } from 'react';
|
|
2
2
|
import PropTypes from 'prop-types';
|
|
3
3
|
import classnames from 'classnames';
|
|
4
4
|
import debounce from 'lodash.debounce';
|
|
@@ -14,21 +14,6 @@ import ResetDesktopForm from './ResetDesktopForm';
|
|
|
14
14
|
import MobileFormToolbar from './MobileFormToolbar';
|
|
15
15
|
import { SEARCH, REFINE, MORE_FILTERS_CLASSES } from '../constants';
|
|
16
16
|
|
|
17
|
-
const reducer = (state, action) => {
|
|
18
|
-
const { newValues, type, shouldSearch = true } = action;
|
|
19
|
-
|
|
20
|
-
switch (type) {
|
|
21
|
-
case 'update':
|
|
22
|
-
return { ...state, ...newValues, shouldSearch };
|
|
23
|
-
case 'resetSearch':
|
|
24
|
-
return { ...state, shouldSearch: false };
|
|
25
|
-
case 'reset':
|
|
26
|
-
return { ...newValues, shouldSearch };
|
|
27
|
-
default:
|
|
28
|
-
throw new Error();
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
|
|
32
17
|
const SearchFilter = ({
|
|
33
18
|
searchFilterRef,
|
|
34
19
|
data,
|
|
@@ -40,27 +25,33 @@ const SearchFilter = ({
|
|
|
40
25
|
isCollapsedOnResponsive,
|
|
41
26
|
displaySearchFilter,
|
|
42
27
|
setDisplaySearchFilter,
|
|
43
|
-
initialFilterValues,
|
|
44
28
|
groupAfterDesktop,
|
|
45
|
-
groupAfterMobile
|
|
29
|
+
groupAfterMobile,
|
|
30
|
+
filterValues,
|
|
31
|
+
setAppliedFilters
|
|
46
32
|
}) => {
|
|
47
33
|
const [moreFiltersMobileCollapsed, setMoreFiltersMobileCollapsed] = useState(true);
|
|
48
34
|
const [moreFiltersDesktopCollapsed, setMoreFiltersDesktopCollapsed] = useState(true);
|
|
49
|
-
const [filterValues, dispatch] = useReducer(reducer, initialFilterValues);
|
|
50
35
|
|
|
51
|
-
const
|
|
36
|
+
const doSubmit = (newValues = filterValues) => {
|
|
52
37
|
const newQuery = buildQuery(newValues, filters);
|
|
53
38
|
handleSearch(newQuery);
|
|
39
|
+
setMoreFiltersDesktopCollapsed(true);
|
|
40
|
+
setMoreFiltersMobileCollapsed(true);
|
|
41
|
+
};
|
|
42
|
+
|
|
43
|
+
const handleSubmit = debounce(newValues => {
|
|
44
|
+
doSubmit(newValues);
|
|
54
45
|
}, 200);
|
|
55
46
|
|
|
56
47
|
useEffect(
|
|
57
48
|
() => {
|
|
58
49
|
if (filterValues.shouldSearch) {
|
|
59
50
|
handleSubmit(filterValues);
|
|
60
|
-
|
|
51
|
+
setAppliedFilters({ type: 'resetSearch' });
|
|
61
52
|
}
|
|
62
53
|
},
|
|
63
|
-
[filterValues, handleSubmit]
|
|
54
|
+
[filterValues, handleSubmit, setAppliedFilters]
|
|
64
55
|
);
|
|
65
56
|
|
|
66
57
|
const formClass = classnames('filter__form filter__form--initial', {
|
|
@@ -79,12 +70,11 @@ const SearchFilter = ({
|
|
|
79
70
|
|
|
80
71
|
const handleReset = () => {
|
|
81
72
|
const newValues = getInitialFilterValues(data, filters, {});
|
|
82
|
-
|
|
83
|
-
dispatch({ newValues, type: 'reset' });
|
|
73
|
+
setAppliedFilters({ newValues, type: 'reset' });
|
|
84
74
|
};
|
|
85
75
|
|
|
86
76
|
const updateFilterValues = (newValues, shouldSubmit) => {
|
|
87
|
-
|
|
77
|
+
setAppliedFilters({ newValues, shouldSearch: shouldSubmit, type: 'update' });
|
|
88
78
|
};
|
|
89
79
|
|
|
90
80
|
const shouldGroup = !!(groupAfterDesktop || groupAfterMobile);
|
|
@@ -99,8 +89,7 @@ const SearchFilter = ({
|
|
|
99
89
|
id={formId}
|
|
100
90
|
onSubmit={e => {
|
|
101
91
|
e.preventDefault();
|
|
102
|
-
|
|
103
|
-
handleSearch(newQuery);
|
|
92
|
+
doSubmit();
|
|
104
93
|
}}>
|
|
105
94
|
{displaySearchFilter && (
|
|
106
95
|
<CloseMobileForm handleClose={() => setDisplaySearchFilter(false)} />
|
|
@@ -136,6 +125,7 @@ const SearchFilter = ({
|
|
|
136
125
|
|
|
137
126
|
{!!groupAfterMobile && (
|
|
138
127
|
<button
|
|
128
|
+
data-testId="search-filter-mobile-toggler"
|
|
139
129
|
className={moreFiltersMobileTogglerClass}
|
|
140
130
|
type="button"
|
|
141
131
|
onClick={() => setMoreFiltersMobileCollapsed(!moreFiltersMobileCollapsed)}>
|
|
@@ -160,6 +150,7 @@ const SearchFilter = ({
|
|
|
160
150
|
|
|
161
151
|
{!!groupAfterDesktop && (
|
|
162
152
|
<button
|
|
153
|
+
data-testId="search-filter-desktop-toggler"
|
|
163
154
|
className={moreFiltersDesktopTogglerClass}
|
|
164
155
|
type="button"
|
|
165
156
|
onClick={() =>
|
|
@@ -241,7 +232,8 @@ SearchFilter.propTypes = {
|
|
|
241
232
|
isCollapsedOnResponsive: PropTypes.bool.isRequired,
|
|
242
233
|
groupAfterDesktop: PropTypes.number.isRequired,
|
|
243
234
|
groupAfterMobile: PropTypes.number.isRequired,
|
|
244
|
-
|
|
235
|
+
filterValues: PropTypes.object.isRequired,
|
|
236
|
+
setAppliedFilters: PropTypes.func.isRequired
|
|
245
237
|
};
|
|
246
238
|
|
|
247
239
|
export default SearchFilter;
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import React, { useState, useRef } from 'react';
|
|
1
|
+
import React, { useState, useRef, useReducer } from 'react';
|
|
2
2
|
import { useRouter } from 'next/router';
|
|
3
3
|
import { useQuery } from '@apollo/client';
|
|
4
4
|
import PropTypes from 'prop-types';
|
|
@@ -6,11 +6,31 @@ import { parseUrl, stringify } from 'query-string';
|
|
|
6
6
|
import SearchFilter from './SearchFilter';
|
|
7
7
|
import { withTitle } from '../../HOC';
|
|
8
8
|
import { getSearchPublishedContent } from '../../application/query';
|
|
9
|
-
import {
|
|
9
|
+
import {
|
|
10
|
+
buildNewQuery,
|
|
11
|
+
buildRawQueryStringified,
|
|
12
|
+
getInitialFilterValues,
|
|
13
|
+
buildFiltersQuery
|
|
14
|
+
} from './helpers';
|
|
10
15
|
import { getEntityData } from '../../helpers';
|
|
11
16
|
import { RAW_RESULTS, RANGE, CHECKBOX_SELECT } from './constants';
|
|
12
17
|
import { SCROLL_OFFSET } from '../../constants';
|
|
13
18
|
|
|
19
|
+
const reducer = (state, action) => {
|
|
20
|
+
const { newValues, type, shouldSearch = true } = action;
|
|
21
|
+
|
|
22
|
+
switch (type) {
|
|
23
|
+
case 'update':
|
|
24
|
+
return { ...state, ...newValues, shouldSearch };
|
|
25
|
+
case 'resetSearch':
|
|
26
|
+
return { ...state, shouldSearch: false };
|
|
27
|
+
case 'reset':
|
|
28
|
+
return { ...newValues, shouldSearch };
|
|
29
|
+
default:
|
|
30
|
+
throw new Error();
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
|
|
14
34
|
const SearchFilterContainer = ({
|
|
15
35
|
entity,
|
|
16
36
|
url,
|
|
@@ -18,25 +38,28 @@ const SearchFilterContainer = ({
|
|
|
18
38
|
name,
|
|
19
39
|
isCollapsedOnResponsive,
|
|
20
40
|
groupAfterMobile,
|
|
21
|
-
groupAfterDesktop
|
|
41
|
+
groupAfterDesktop,
|
|
42
|
+
filterBy,
|
|
43
|
+
filterByProperty,
|
|
44
|
+
shouldAddFilters
|
|
22
45
|
}) => {
|
|
23
46
|
const router = useRouter();
|
|
47
|
+
const { asPath } = router;
|
|
24
48
|
const searchFilterRef = useRef(null);
|
|
25
49
|
const [key, setKey] = useState(`filter-${name}`);
|
|
26
50
|
const [displaySearchFilter, setDisplaySearchFilter] = useState(false);
|
|
27
|
-
const hasUrl = !!url;
|
|
28
51
|
const {
|
|
29
52
|
url: currentUrl,
|
|
30
53
|
query: { sort, sortby },
|
|
31
54
|
query
|
|
32
|
-
} = parseUrl(
|
|
55
|
+
} = parseUrl(asPath);
|
|
56
|
+
const [filterValues, dispatch] = useReducer(reducer, query);
|
|
57
|
+
const hasUrl = !!url;
|
|
58
|
+
|
|
33
59
|
const sortValues = sort && sortby ? stringify({ sort, sortby }) : '';
|
|
34
60
|
const baseQuery = sortValues ? `${currentUrl}?${sortValues}` : currentUrl;
|
|
35
61
|
|
|
36
62
|
const action = getSearchPublishedContent(RAW_RESULTS);
|
|
37
|
-
|
|
38
|
-
let rawQueryStringified = '';
|
|
39
|
-
|
|
40
63
|
const checkboxSelectValues = [];
|
|
41
64
|
const rangeValues = [];
|
|
42
65
|
|
|
@@ -50,21 +73,32 @@ const SearchFilterContainer = ({
|
|
|
50
73
|
|
|
51
74
|
const { docType } = getEntityData(entity);
|
|
52
75
|
|
|
53
|
-
|
|
76
|
+
const filtersQuery = shouldAddFilters
|
|
77
|
+
? buildFiltersQuery(filterValues || query, filterBy, filterByProperty)
|
|
78
|
+
: [];
|
|
79
|
+
|
|
80
|
+
const rawQueryStringified = buildRawQueryStringified(
|
|
81
|
+
checkboxSelectValues,
|
|
82
|
+
rangeValues,
|
|
83
|
+
docType,
|
|
84
|
+
filtersQuery
|
|
85
|
+
);
|
|
54
86
|
|
|
55
|
-
const { data, error
|
|
87
|
+
const { data, error } = useQuery(action, {
|
|
56
88
|
variables: { rawQueryStringified, limit: 0 }, // we only want aggs so limit=0 for no search results
|
|
57
89
|
skip: !rawQueryStringified
|
|
58
90
|
});
|
|
59
91
|
|
|
60
|
-
if (loading) return null;
|
|
61
92
|
if (error) return error.message;
|
|
62
93
|
if (!filters.length) return null;
|
|
63
94
|
|
|
64
|
-
const { searchPublishedContent: { rawResults: { aggregations: filterData
|
|
95
|
+
const { searchPublishedContent: { rawResults: { aggregations: filterData } = {} } = {} } =
|
|
65
96
|
data || {};
|
|
66
97
|
|
|
67
|
-
|
|
98
|
+
if (!filterValues && filterData) {
|
|
99
|
+
const initialFilterValues = getInitialFilterValues(filterData, filters, query);
|
|
100
|
+
dispatch({ newValues: initialFilterValues, shouldSearch: false, type: 'update' });
|
|
101
|
+
}
|
|
68
102
|
|
|
69
103
|
const handleSearch = newQuery => {
|
|
70
104
|
setDisplaySearchFilter(false);
|
|
@@ -93,17 +127,19 @@ const SearchFilterContainer = ({
|
|
|
93
127
|
window.scrollTo(0, 0);
|
|
94
128
|
}
|
|
95
129
|
};
|
|
130
|
+
if (!filterValues) return '';
|
|
96
131
|
|
|
97
132
|
return (
|
|
98
133
|
<SearchFilter
|
|
99
134
|
key={key}
|
|
135
|
+
setAppliedFilters={dispatch}
|
|
100
136
|
searchFilterRef={searchFilterRef}
|
|
101
137
|
data={filterData}
|
|
102
138
|
filters={filters}
|
|
103
139
|
hasUrl={hasUrl}
|
|
104
140
|
entity={entity}
|
|
105
141
|
handleSearch={handleSearch}
|
|
106
|
-
|
|
142
|
+
filterValues={filterValues}
|
|
107
143
|
name={name}
|
|
108
144
|
isCollapsedOnResponsive={isCollapsedOnResponsive}
|
|
109
145
|
displaySearchFilter={displaySearchFilter}
|
|
@@ -121,7 +157,10 @@ SearchFilterContainer.propTypes = {
|
|
|
121
157
|
name: PropTypes.string.isRequired,
|
|
122
158
|
isCollapsedOnResponsive: PropTypes.bool,
|
|
123
159
|
groupAfterMobile: PropTypes.number,
|
|
124
|
-
groupAfterDesktop: PropTypes.number
|
|
160
|
+
groupAfterDesktop: PropTypes.number,
|
|
161
|
+
filterBy: PropTypes.array,
|
|
162
|
+
filterByProperty: PropTypes.array,
|
|
163
|
+
shouldAddFilters: PropTypes.bool
|
|
125
164
|
};
|
|
126
165
|
|
|
127
166
|
SearchFilterContainer.defaultProps = {
|
|
@@ -130,7 +169,10 @@ SearchFilterContainer.defaultProps = {
|
|
|
130
169
|
entity: '',
|
|
131
170
|
isCollapsedOnResponsive: true,
|
|
132
171
|
groupAfterMobile: 0,
|
|
133
|
-
groupAfterDesktop: 0
|
|
172
|
+
groupAfterDesktop: 0,
|
|
173
|
+
filterBy: [],
|
|
174
|
+
filterByProperty: [],
|
|
175
|
+
shouldAddFilters: false
|
|
134
176
|
};
|
|
135
177
|
|
|
136
178
|
export default withTitle(SearchFilterContainer);
|
|
@@ -7,8 +7,17 @@ import { withTitle } from '../../../HOC';
|
|
|
7
7
|
import { decodeValue } from '../helpers';
|
|
8
8
|
import { LIMIT_MIN, LIMIT_MAX, MORE, LESS } from '../constants';
|
|
9
9
|
|
|
10
|
-
const Checkbox = ({
|
|
10
|
+
const Checkbox = ({
|
|
11
|
+
data,
|
|
12
|
+
prop,
|
|
13
|
+
updateFilterValues,
|
|
14
|
+
filterValues,
|
|
15
|
+
label,
|
|
16
|
+
shouldSearch,
|
|
17
|
+
displayFilterCount
|
|
18
|
+
}) => {
|
|
11
19
|
const [checkboxLimit, setCheckboxLimit] = useState(null);
|
|
20
|
+
if (!data[prop]) return null;
|
|
12
21
|
|
|
13
22
|
const handleCheckboxOptions = () => {
|
|
14
23
|
if (checkboxLimit[prop] === LIMIT_MIN) {
|
|
@@ -35,7 +44,10 @@ const Checkbox = ({ data, prop, updateFilterValues, filterValues, label, shouldS
|
|
|
35
44
|
const multiple = [];
|
|
36
45
|
|
|
37
46
|
const sortedValues = data[prop].buckets
|
|
38
|
-
.map(({ key }) =>
|
|
47
|
+
.map(({ key, doc_count: count }) => {
|
|
48
|
+
const optionLabel = displayFilterCount ? `${key} (${count})` : key;
|
|
49
|
+
return [key, optionLabel, !count];
|
|
50
|
+
})
|
|
39
51
|
.filter(Boolean)
|
|
40
52
|
.sort();
|
|
41
53
|
|
|
@@ -43,11 +55,12 @@ const Checkbox = ({ data, prop, updateFilterValues, filterValues, label, shouldS
|
|
|
43
55
|
(value, i) =>
|
|
44
56
|
i < checkboxLimit[prop] &&
|
|
45
57
|
multiple.push({
|
|
46
|
-
label: upperFirst(value),
|
|
47
|
-
value,
|
|
58
|
+
label: upperFirst(value[1]),
|
|
59
|
+
value: value[0],
|
|
48
60
|
name: prop,
|
|
49
|
-
checked: checkboxQueryParams.includes(value),
|
|
50
|
-
id: value
|
|
61
|
+
checked: checkboxQueryParams.includes(value[0]),
|
|
62
|
+
id: value[0],
|
|
63
|
+
disabled: value[2]
|
|
51
64
|
})
|
|
52
65
|
);
|
|
53
66
|
|
|
@@ -95,12 +108,14 @@ Checkbox.propTypes = {
|
|
|
95
108
|
filterValues: PropTypes.object.isRequired,
|
|
96
109
|
updateFilterValues: PropTypes.func.isRequired,
|
|
97
110
|
shouldSearch: PropTypes.bool,
|
|
98
|
-
label: PropTypes.string
|
|
111
|
+
label: PropTypes.string,
|
|
112
|
+
displayFilterCount: PropTypes.bool
|
|
99
113
|
};
|
|
100
114
|
|
|
101
115
|
Checkbox.defaultProps = {
|
|
102
116
|
shouldSearch: false,
|
|
103
|
-
label: ''
|
|
117
|
+
label: '',
|
|
118
|
+
displayFilterCount: false
|
|
104
119
|
};
|
|
105
120
|
|
|
106
121
|
export default withTitle(Checkbox);
|
|
@@ -11,17 +11,21 @@ const SelectFilter = ({
|
|
|
11
11
|
updateFilterValues,
|
|
12
12
|
filterValues,
|
|
13
13
|
shouldSearch,
|
|
14
|
-
displayLabelAsPlaceholder
|
|
14
|
+
displayLabelAsPlaceholder,
|
|
15
|
+
displayFilterCount
|
|
15
16
|
}) => {
|
|
16
17
|
const filterValue = filterValues[prop] || '';
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
18
|
+
const disabledOptions = [];
|
|
19
|
+
const { buckets = [] } = data[prop] || {};
|
|
20
|
+
const options = buckets
|
|
21
|
+
.map(({ key, doc_count: count }) => {
|
|
22
|
+
if (!count) disabledOptions.push(key);
|
|
23
|
+
const optionLabel = displayFilterCount ? `${key} (${count})` : key;
|
|
24
|
+
return [key, optionLabel];
|
|
25
|
+
})
|
|
20
26
|
.filter(Boolean)
|
|
21
27
|
.sort();
|
|
22
28
|
|
|
23
|
-
const optionsJoined = options;
|
|
24
|
-
|
|
25
29
|
const labelText = label || prop;
|
|
26
30
|
let labelToUse = labelText;
|
|
27
31
|
let defaultTextValue = DEFAULT_OPTION;
|
|
@@ -36,14 +40,14 @@ const SelectFilter = ({
|
|
|
36
40
|
value={filterValue}
|
|
37
41
|
id={prop}
|
|
38
42
|
data-testid={`filter-${prop}`}
|
|
39
|
-
options={
|
|
43
|
+
options={options}
|
|
40
44
|
defaultTextValue={defaultTextValue}
|
|
41
45
|
onChange={({ value }) => {
|
|
42
46
|
let valueToUse = value;
|
|
43
47
|
if (value === defaultTextValue) valueToUse = '';
|
|
44
|
-
|
|
45
48
|
updateFilterValues({ [prop]: valueToUse }, shouldSearch);
|
|
46
49
|
}}
|
|
50
|
+
disabled={disabledOptions}
|
|
47
51
|
/>
|
|
48
52
|
);
|
|
49
53
|
};
|
|
@@ -51,17 +55,20 @@ const SelectFilter = ({
|
|
|
51
55
|
SelectFilter.propTypes = {
|
|
52
56
|
data: PropTypes.object.isRequired,
|
|
53
57
|
prop: PropTypes.string.isRequired,
|
|
54
|
-
filterValues: PropTypes.object
|
|
58
|
+
filterValues: PropTypes.object,
|
|
55
59
|
updateFilterValues: PropTypes.func.isRequired,
|
|
56
60
|
shouldSearch: PropTypes.bool,
|
|
57
61
|
label: PropTypes.string,
|
|
58
|
-
displayLabelAsPlaceholder: PropTypes.bool
|
|
62
|
+
displayLabelAsPlaceholder: PropTypes.bool,
|
|
63
|
+
displayFilterCount: PropTypes.bool
|
|
59
64
|
};
|
|
60
65
|
|
|
61
66
|
SelectFilter.defaultProps = {
|
|
67
|
+
filterValues: {},
|
|
62
68
|
shouldSearch: false,
|
|
63
69
|
label: '',
|
|
64
|
-
displayLabelAsPlaceholder: false
|
|
70
|
+
displayLabelAsPlaceholder: false,
|
|
71
|
+
displayFilterCount: false
|
|
65
72
|
};
|
|
66
73
|
|
|
67
74
|
export default withTitle(SelectFilter);
|
|
@@ -5,7 +5,7 @@ import { MdSearch } from 'react-icons/md';
|
|
|
5
5
|
import { withTitle } from '../../../HOC';
|
|
6
6
|
import { SEARCH_TERM } from '../constants';
|
|
7
7
|
|
|
8
|
-
const TextSearch = ({ label, searchValue, updateFilterValues
|
|
8
|
+
const TextSearch = ({ label, searchValue, updateFilterValues }) => (
|
|
9
9
|
<div className="search">
|
|
10
10
|
<div className="search__wrapper">
|
|
11
11
|
<div className="form-field form-field--input form-field--search">
|
|
@@ -34,10 +34,8 @@ const TextSearch = ({ label, searchValue, updateFilterValues, handleSubmit, filt
|
|
|
34
34
|
);
|
|
35
35
|
|
|
36
36
|
TextSearch.propTypes = {
|
|
37
|
-
filterValues: PropTypes.object.isRequired,
|
|
38
37
|
searchValue: PropTypes.string.isRequired,
|
|
39
38
|
updateFilterValues: PropTypes.func.isRequired,
|
|
40
|
-
handleSubmit: PropTypes.func.isRequired,
|
|
41
39
|
label: PropTypes.string
|
|
42
40
|
};
|
|
43
41
|
|
|
@@ -2,7 +2,7 @@ const CHECKBOX = 'checkbox';
|
|
|
2
2
|
const SELECT = 'select';
|
|
3
3
|
const TEXT_SEARCH = 'text-search';
|
|
4
4
|
const SEARCH_TERM = 'search_term';
|
|
5
|
-
const SIZE =
|
|
5
|
+
const SIZE = process.env.BLAZE_PB_SEARCH_FILETER_AGG_SIZE || 500;
|
|
6
6
|
const KEYWORD = 'keyword';
|
|
7
7
|
const RAW_RESULTS = 'rawResults';
|
|
8
8
|
const DEFAULT_OPTION = 'Any';
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
const builFilterObject = (key, value, filters) => {
|
|
2
|
+
const isArray = Array.isArray(value);
|
|
3
|
+
if (!isArray) {
|
|
4
|
+
const singleFilterObj = { match: { [key]: value } };
|
|
5
|
+
filters.push(singleFilterObj);
|
|
6
|
+
return;
|
|
7
|
+
}
|
|
8
|
+
|
|
9
|
+
value.forEach(filterValue => {
|
|
10
|
+
filters.push({ match: { [key]: filterValue } });
|
|
11
|
+
});
|
|
12
|
+
};
|
|
13
|
+
const buildFiltersQuery = (query, filterBy, filterByProperty) => {
|
|
14
|
+
const mustFilters = [];
|
|
15
|
+
Object.keys(query).forEach(queryKey => {
|
|
16
|
+
if (queryKey === 'search_term' || queryKey === 'shouldSearch') return;
|
|
17
|
+
if (!queryKey || !query[queryKey]) return;
|
|
18
|
+
const queryValue = query[queryKey];
|
|
19
|
+
const queryKeyword = `${queryKey}.keyword`;
|
|
20
|
+
builFilterObject(queryKeyword, queryValue, mustFilters);
|
|
21
|
+
});
|
|
22
|
+
|
|
23
|
+
if (filterByProperty && filterByProperty.length) {
|
|
24
|
+
filterByProperty &&
|
|
25
|
+
filterByProperty.forEach(filterByPropOption => {
|
|
26
|
+
const [filterByPropKey] = filterByPropOption.split('/');
|
|
27
|
+
filterBy.forEach(filterByOption => {
|
|
28
|
+
if (filterByOption.indexOf(filterByPropKey) === -1) return;
|
|
29
|
+
const [, filteryByValue] = filterByOption.split('/');
|
|
30
|
+
const filterByKeyword = `${filterByPropKey}.keyword`;
|
|
31
|
+
if (!filteryByValue) return;
|
|
32
|
+
mustFilters.push({ match: { [filterByKeyword]: filteryByValue } });
|
|
33
|
+
});
|
|
34
|
+
});
|
|
35
|
+
}
|
|
36
|
+
|
|
37
|
+
return mustFilters;
|
|
38
|
+
};
|
|
39
|
+
|
|
40
|
+
export default buildFiltersQuery;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { KEYWORD, SIZE } from '../constants';
|
|
2
2
|
|
|
3
|
-
const buildRawQueryStringified = (checkboxSelectValues, rangeValues, entity) => {
|
|
3
|
+
const buildRawQueryStringified = (checkboxSelectValues, rangeValues, entity, mustFilters) => {
|
|
4
4
|
if (!checkboxSelectValues.length && !rangeValues.length) return '';
|
|
5
5
|
|
|
6
6
|
const aggs = {};
|
|
@@ -36,6 +36,7 @@ const buildRawQueryStringified = (checkboxSelectValues, rangeValues, entity) =>
|
|
|
36
36
|
}
|
|
37
37
|
}
|
|
38
38
|
],
|
|
39
|
+
must: mustFilters,
|
|
39
40
|
minimum_should_match: 1
|
|
40
41
|
}
|
|
41
42
|
}
|
|
@@ -3,6 +3,7 @@ import getFilterValueFromQuery from './get-filter-value-from-query';
|
|
|
3
3
|
|
|
4
4
|
const getInitialFilterValues = (filterData, filters, query) => {
|
|
5
5
|
const filterValues = {};
|
|
6
|
+
|
|
6
7
|
Object.keys(filterData).forEach(key => {
|
|
7
8
|
const filterProps =
|
|
8
9
|
filters.find(({ propsToDisplay }) => propsToDisplay.find(prop => key === prop)) || {};
|
|
@@ -13,6 +13,7 @@ import isDeviceDesktop from './is-device-desktop';
|
|
|
13
13
|
import getInitialFilterValues from './get-initial-filter-values';
|
|
14
14
|
import getFilterValueFromQuery from './get-filter-value-from-query';
|
|
15
15
|
import buildQuery from './build-query';
|
|
16
|
+
import buildFiltersQuery from './build-filters-query';
|
|
16
17
|
|
|
17
18
|
export {
|
|
18
19
|
buildQuery,
|
|
@@ -30,5 +31,6 @@ export {
|
|
|
30
31
|
getSelectOptions,
|
|
31
32
|
isDeviceDesktop,
|
|
32
33
|
getInitialFilterValues,
|
|
33
|
-
getFilterValueFromQuery
|
|
34
|
+
getFilterValueFromQuery,
|
|
35
|
+
buildFiltersQuery
|
|
34
36
|
};
|
package/src/components/index.js
CHANGED
|
@@ -18,7 +18,7 @@ export default {
|
|
|
18
18
|
video: dynamic(() => import(/* webpackChunkName: "blazePbVideo" */ './Video')),
|
|
19
19
|
wrapper: dynamic(() => import(/* webpackChunkName: "blazePbWrapper" */ './Wrapper')),
|
|
20
20
|
searchcontent: dynamic(() =>
|
|
21
|
-
import(/* webpackChunkName: "blazePbSearchFilter" */ './SearchContent')
|
|
21
|
+
import(/* webpackChunkName: "blazePbSearchFilter" */ './SearchContent/SearchContent')
|
|
22
22
|
),
|
|
23
23
|
searchfilter: dynamic(() =>
|
|
24
24
|
import(/* webpackChunkName: "blazePbSearchFilter" */ './SearchFilter')
|
|
@@ -42,5 +42,14 @@ export default {
|
|
|
42
42
|
import(/* webpackChunkName: "blazePbPasswordResetRequest" */ './PasswordResetRequest')
|
|
43
43
|
),
|
|
44
44
|
breadcrumb: dynamic(() => import(/* webpackChunkName: "blazePbBreadcrumb" */ './Breadcrumb')),
|
|
45
|
+
itemlistbutton: dynamic(() =>
|
|
46
|
+
import(/* webpackChunkName: "blazePbItemListButton" */ './ItemList/ItemListButton')
|
|
47
|
+
),
|
|
48
|
+
itemlistcounter: dynamic(() =>
|
|
49
|
+
import(/* webpackChunkName: "blazePbItemListCounter" */ './ItemList/ItemListCounter')
|
|
50
|
+
),
|
|
51
|
+
itemlistnew: dynamic(() =>
|
|
52
|
+
import(/* webpackChunkName: "blazePbItemListNew" */ './ItemList/ItemListNew')
|
|
53
|
+
),
|
|
45
54
|
backtotop: dynamic(() => import(/* webpackChunkName: "blazePbBackToTop" */ './BackToTop'))
|
|
46
55
|
};
|
package/src/constants/index.js
CHANGED
|
@@ -17,6 +17,7 @@ const RANGE = 'range';
|
|
|
17
17
|
const CHECKBOX = 'checkbox';
|
|
18
18
|
const ELEMENT = 'element';
|
|
19
19
|
const MENU_ITEM = 'menuitem';
|
|
20
|
+
const SUB_MENU = 'submenu';
|
|
20
21
|
const SELECT = 'select';
|
|
21
22
|
const ON_CLICK = 'onClick';
|
|
22
23
|
const KEYWORD = 'keyword';
|
|
@@ -303,6 +304,7 @@ export {
|
|
|
303
304
|
MOBILE_WIDTH,
|
|
304
305
|
HIDDEN,
|
|
305
306
|
MENU_ITEM,
|
|
307
|
+
SUB_MENU,
|
|
306
308
|
LOGIN_FORM,
|
|
307
309
|
PASSWORD_REGEX,
|
|
308
310
|
PASSWORD_VALIDATION_MESSAGE,
|