@blaze-cms/react-page-builder 0.124.0-alpha.4 → 0.124.0-alpha.43
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 +347 -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 +18 -5
- 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 +1 -1
- 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 +18 -3
- 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/SearchFilter/helpers/parse-filter-value.js +3 -7
- package/lib/components/SearchFilter/helpers/parse-filter-value.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/Button.js +18 -6
- package/lib-es/components/Button.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-query.js +1 -1
- package/lib-es/components/SearchFilter/helpers/build-query.js.map +1 -1
- 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 +13 -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/SearchFilter/helpers/parse-filter-value.js +3 -3
- package/lib-es/components/SearchFilter/helpers/parse-filter-value.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/Button.js +27 -5
- 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 +61 -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-query.js +3 -1
- package/src/components/SearchFilter/helpers/build-raw-query-stringified.js +2 -1
- package/src/components/SearchFilter/helpers/get-initial-filter-values.js +12 -1
- package/src/components/SearchFilter/helpers/index.js +3 -1
- package/src/components/SearchFilter/helpers/parse-filter-value.js +3 -3
- 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/Button.test.js +55 -1
- 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/SearchFilter/helpers/build-query.test.js +2 -2
- package/tests/unit/src/components/SearchFilter/helpers/get-initial-filter-values.test.js +25 -11
- package/tests/unit/src/components/SearchFilter/helpers/parse-filter-value.test.js +1 -1
- package/tests/unit/src/components/__snapshots__/index.test.js.snap +12 -0
|
@@ -0,0 +1,64 @@
|
|
|
1
|
+
import React from 'react';
|
|
2
|
+
import PropTypes from 'prop-types';
|
|
3
|
+
import { useRouter } from 'next/router';
|
|
4
|
+
import { useQuery } from '@apollo/client';
|
|
5
|
+
import BlazeButton from '@blaze-react/button';
|
|
6
|
+
import { parseUrl } from 'query-string';
|
|
7
|
+
import { getItemList } from '../../../application/query';
|
|
8
|
+
import { useItemListId } from '../hooks';
|
|
9
|
+
import { getItemListData, setItemListId, setParamAndRedirect } from '../helpers';
|
|
10
|
+
import { LIST_ITEM_QUERY_PARAM } from '../constants';
|
|
11
|
+
|
|
12
|
+
const ItemListNew = ({
|
|
13
|
+
listName,
|
|
14
|
+
modifier,
|
|
15
|
+
text
|
|
16
|
+
}) => {
|
|
17
|
+
const router = useRouter();
|
|
18
|
+
const {
|
|
19
|
+
query: {
|
|
20
|
+
[LIST_ITEM_QUERY_PARAM]: listItemId
|
|
21
|
+
} = {}
|
|
22
|
+
} = parseUrl(router.asPath);
|
|
23
|
+
const {
|
|
24
|
+
listId
|
|
25
|
+
} = useItemListId({
|
|
26
|
+
listName
|
|
27
|
+
});
|
|
28
|
+
const listIdToUse = listItemId || listId;
|
|
29
|
+
const {
|
|
30
|
+
data,
|
|
31
|
+
error,
|
|
32
|
+
loading
|
|
33
|
+
} = useQuery(getItemList, {
|
|
34
|
+
variables: {
|
|
35
|
+
id: listIdToUse
|
|
36
|
+
},
|
|
37
|
+
skip: !listIdToUse
|
|
38
|
+
});
|
|
39
|
+
if (loading) return '';
|
|
40
|
+
if (error) return error.message;
|
|
41
|
+
const listItems = getItemListData(data);
|
|
42
|
+
if (!listItems.length) return '';
|
|
43
|
+
|
|
44
|
+
const handleClick = () => {
|
|
45
|
+
setItemListId(listName, '');
|
|
46
|
+
setParamAndRedirect(router);
|
|
47
|
+
};
|
|
48
|
+
|
|
49
|
+
return /*#__PURE__*/React.createElement(BlazeButton, {
|
|
50
|
+
className: `item-list-new ${modifier}`,
|
|
51
|
+
onClick: handleClick
|
|
52
|
+
}, text);
|
|
53
|
+
};
|
|
54
|
+
|
|
55
|
+
ItemListNew.propTypes = {
|
|
56
|
+
listName: PropTypes.string.isRequired,
|
|
57
|
+
modifier: PropTypes.string,
|
|
58
|
+
text: PropTypes.string.isRequired
|
|
59
|
+
};
|
|
60
|
+
ItemListNew.defaultProps = {
|
|
61
|
+
modifier: ''
|
|
62
|
+
};
|
|
63
|
+
export default ItemListNew;
|
|
64
|
+
//# sourceMappingURL=ItemListNew.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"ItemListNew.js","names":["React","PropTypes","useRouter","useQuery","BlazeButton","parseUrl","getItemList","useItemListId","getItemListData","setItemListId","setParamAndRedirect","LIST_ITEM_QUERY_PARAM","ItemListNew","listName","modifier","text","router","query","listItemId","asPath","listId","listIdToUse","data","error","loading","variables","id","skip","message","listItems","length","handleClick","propTypes","string","isRequired","defaultProps"],"sources":["../../../../src/components/ItemList/ItemListNew/ItemListNew.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { useRouter } from 'next/router';\nimport { useQuery } from '@apollo/client';\nimport BlazeButton from '@blaze-react/button';\nimport { parseUrl } from 'query-string';\nimport { getItemList } from '../../../application/query';\nimport { useItemListId } from '../hooks';\nimport { getItemListData, setItemListId, setParamAndRedirect } from '../helpers';\nimport { LIST_ITEM_QUERY_PARAM } from '../constants';\n\nconst ItemListNew = ({ listName, modifier, text }) => {\n const router = useRouter();\n const { query: { [LIST_ITEM_QUERY_PARAM]: listItemId } = {} } = parseUrl(router.asPath);\n\n const { listId } = useItemListId({ listName });\n const listIdToUse = listItemId || listId;\n const { data, error, loading } = useQuery(getItemList, {\n variables: { id: listIdToUse },\n skip: !listIdToUse\n });\n\n if (loading) return '';\n if (error) return error.message;\n\n const listItems = getItemListData(data);\n if (!listItems.length) return '';\n\n const handleClick = () => {\n setItemListId(listName, '');\n setParamAndRedirect(router);\n };\n\n return (\n <BlazeButton className={`item-list-new ${modifier}`} onClick={handleClick}>\n {text}\n </BlazeButton>\n );\n};\n\nItemListNew.propTypes = {\n listName: PropTypes.string.isRequired,\n modifier: PropTypes.string,\n text: PropTypes.string.isRequired\n};\n\nItemListNew.defaultProps = {\n modifier: ''\n};\n\nexport default ItemListNew;\n"],"mappings":"AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,QAAT,QAAyB,gBAAzB;AACA,OAAOC,WAAP,MAAwB,qBAAxB;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,SAASC,WAAT,QAA4B,4BAA5B;AACA,SAASC,aAAT,QAA8B,UAA9B;AACA,SAASC,eAAT,EAA0BC,aAA1B,EAAyCC,mBAAzC,QAAoE,YAApE;AACA,SAASC,qBAAT,QAAsC,cAAtC;;AAEA,MAAMC,WAAW,GAAG,CAAC;EAAEC,QAAF;EAAYC,QAAZ;EAAsBC;AAAtB,CAAD,KAAkC;EACpD,MAAMC,MAAM,GAAGd,SAAS,EAAxB;EACA,MAAM;IAAEe,KAAK,EAAE;MAAE,CAACN,qBAAD,GAAyBO;IAA3B,IAA0C;EAAnD,IAA0Db,QAAQ,CAACW,MAAM,CAACG,MAAR,CAAxE;EAEA,MAAM;IAAEC;EAAF,IAAab,aAAa,CAAC;IAAEM;EAAF,CAAD,CAAhC;EACA,MAAMQ,WAAW,GAAGH,UAAU,IAAIE,MAAlC;EACA,MAAM;IAAEE,IAAF;IAAQC,KAAR;IAAeC;EAAf,IAA2BrB,QAAQ,CAACG,WAAD,EAAc;IACrDmB,SAAS,EAAE;MAAEC,EAAE,EAAEL;IAAN,CAD0C;IAErDM,IAAI,EAAE,CAACN;EAF8C,CAAd,CAAzC;EAKA,IAAIG,OAAJ,EAAa,OAAO,EAAP;EACb,IAAID,KAAJ,EAAW,OAAOA,KAAK,CAACK,OAAb;EAEX,MAAMC,SAAS,GAAGrB,eAAe,CAACc,IAAD,CAAjC;EACA,IAAI,CAACO,SAAS,CAACC,MAAf,EAAuB,OAAO,EAAP;;EAEvB,MAAMC,WAAW,GAAG,MAAM;IACxBtB,aAAa,CAACI,QAAD,EAAW,EAAX,CAAb;IACAH,mBAAmB,CAACM,MAAD,CAAnB;EACD,CAHD;;EAKA,oBACE,oBAAC,WAAD;IAAa,SAAS,EAAG,iBAAgBF,QAAS,EAAlD;IAAqD,OAAO,EAAEiB;EAA9D,GACGhB,IADH,CADF;AAKD,CA3BD;;AA6BAH,WAAW,CAACoB,SAAZ,GAAwB;EACtBnB,QAAQ,EAAEZ,SAAS,CAACgC,MAAV,CAAiBC,UADL;EAEtBpB,QAAQ,EAAEb,SAAS,CAACgC,MAFE;EAGtBlB,IAAI,EAAEd,SAAS,CAACgC,MAAV,CAAiBC;AAHD,CAAxB;AAMAtB,WAAW,CAACuB,YAAZ,GAA2B;EACzBrB,QAAQ,EAAE;AADe,CAA3B;AAIA,eAAeF,WAAf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["ItemListNew"],"sources":["../../../../src/components/ItemList/ItemListNew/index.js"],"sourcesContent":["import ItemListNew from './ItemListNew';\n\nexport default ItemListNew;\n"],"mappings":"AAAA,OAAOA,WAAP,MAAwB,eAAxB;AAEA,eAAeA,WAAf"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export const ITEM_LIST_BUTTON = 'itemlistbutton';
|
|
2
|
+
export const ITEM_LIST_COUNTER = 'itemlistcounter';
|
|
3
|
+
export const ITEM_LIST_NEW = 'itemlistnew';
|
|
4
|
+
export const LIST_ITEM_LOCAL_KEY = 'blaze_item_list_';
|
|
5
|
+
export const LIST_ITEM_QUERY_PARAM = 'itemListId';
|
|
6
|
+
//# sourceMappingURL=constants.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"constants.js","names":["ITEM_LIST_BUTTON","ITEM_LIST_COUNTER","ITEM_LIST_NEW","LIST_ITEM_LOCAL_KEY","LIST_ITEM_QUERY_PARAM"],"sources":["../../../src/components/ItemList/constants.js"],"sourcesContent":["export const ITEM_LIST_BUTTON = 'itemlistbutton';\nexport const ITEM_LIST_COUNTER = 'itemlistcounter';\nexport const ITEM_LIST_NEW = 'itemlistnew';\nexport const LIST_ITEM_LOCAL_KEY = 'blaze_item_list_';\nexport const LIST_ITEM_QUERY_PARAM = 'itemListId';\n"],"mappings":"AAAA,OAAO,MAAMA,gBAAgB,GAAG,gBAAzB;AACP,OAAO,MAAMC,iBAAiB,GAAG,iBAA1B;AACP,OAAO,MAAMC,aAAa,GAAG,aAAtB;AACP,OAAO,MAAMC,mBAAmB,GAAG,kBAA5B;AACP,OAAO,MAAMC,qBAAqB,GAAG,YAA9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-item-list-data.js","names":["getItemListData","data","getItemList","listItems"],"sources":["../../../../src/components/ItemList/helpers/get-item-list-data.js"],"sourcesContent":["const getItemListData = data => {\n if (data && data.getItemList && data.getItemList.listItems) return data.getItemList.listItems;\n return [];\n};\n\nexport default getItemListData;\n"],"mappings":"AAAA,MAAMA,eAAe,GAAGC,IAAI,IAAI;EAC9B,IAAIA,IAAI,IAAIA,IAAI,CAACC,WAAb,IAA4BD,IAAI,CAACC,WAAL,CAAiBC,SAAjD,EAA4D,OAAOF,IAAI,CAACC,WAAL,CAAiBC,SAAxB;EAC5D,OAAO,EAAP;AACD,CAHD;;AAKA,eAAeH,eAAf"}
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { LIST_ITEM_LOCAL_KEY } from '../constants';
|
|
2
|
+
|
|
3
|
+
const getItemListId = (listName, queryId) => {
|
|
4
|
+
if (queryId) return queryId;
|
|
5
|
+
if (!listName || typeof localStorage === 'undefined') return '';
|
|
6
|
+
const localListName = `${LIST_ITEM_LOCAL_KEY}${listName}`;
|
|
7
|
+
return localStorage.getItem(localListName) || '';
|
|
8
|
+
};
|
|
9
|
+
|
|
10
|
+
export default getItemListId;
|
|
11
|
+
//# sourceMappingURL=get-item-list-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-item-list-id.js","names":["LIST_ITEM_LOCAL_KEY","getItemListId","listName","queryId","localStorage","localListName","getItem"],"sources":["../../../../src/components/ItemList/helpers/get-item-list-id.js"],"sourcesContent":["import { LIST_ITEM_LOCAL_KEY } from '../constants';\n\nconst getItemListId = (listName, queryId) => {\n if (queryId) return queryId;\n if (!listName || typeof localStorage === 'undefined') return '';\n\n const localListName = `${LIST_ITEM_LOCAL_KEY}${listName}`;\n return localStorage.getItem(localListName) || '';\n};\n\nexport default getItemListId;\n"],"mappings":"AAAA,SAASA,mBAAT,QAAoC,cAApC;;AAEA,MAAMC,aAAa,GAAG,CAACC,QAAD,EAAWC,OAAX,KAAuB;EAC3C,IAAIA,OAAJ,EAAa,OAAOA,OAAP;EACb,IAAI,CAACD,QAAD,IAAa,OAAOE,YAAP,KAAwB,WAAzC,EAAsD,OAAO,EAAP;EAEtD,MAAMC,aAAa,GAAI,GAAEL,mBAAoB,GAAEE,QAAS,EAAxD;EACA,OAAOE,YAAY,CAACE,OAAb,CAAqBD,aAArB,KAAuC,EAA9C;AACD,CAND;;AAQA,eAAeJ,aAAf"}
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import getItemListData from './get-item-list-data';
|
|
2
|
+
|
|
3
|
+
const getItemListIds = data => {
|
|
4
|
+
const itemListElements = getItemListData(data);
|
|
5
|
+
return itemListElements.length ? itemListElements.map(({
|
|
6
|
+
itemId
|
|
7
|
+
}) => ({
|
|
8
|
+
displayItems: [itemId]
|
|
9
|
+
})) : null;
|
|
10
|
+
};
|
|
11
|
+
|
|
12
|
+
export default getItemListIds;
|
|
13
|
+
//# sourceMappingURL=get-item-list-ids.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"get-item-list-ids.js","names":["getItemListData","getItemListIds","data","itemListElements","length","map","itemId","displayItems"],"sources":["../../../../src/components/ItemList/helpers/get-item-list-ids.js"],"sourcesContent":["import getItemListData from './get-item-list-data';\n\nconst getItemListIds = data => {\n const itemListElements = getItemListData(data);\n return itemListElements.length\n ? itemListElements.map(({ itemId }) => ({ displayItems: [itemId] }))\n : null;\n};\n\nexport default getItemListIds;\n"],"mappings":"AAAA,OAAOA,eAAP,MAA4B,sBAA5B;;AAEA,MAAMC,cAAc,GAAGC,IAAI,IAAI;EAC7B,MAAMC,gBAAgB,GAAGH,eAAe,CAACE,IAAD,CAAxC;EACA,OAAOC,gBAAgB,CAACC,MAAjB,GACHD,gBAAgB,CAACE,GAAjB,CAAqB,CAAC;IAAEC;EAAF,CAAD,MAAiB;IAAEC,YAAY,EAAE,CAACD,MAAD;EAAhB,CAAjB,CAArB,CADG,GAEH,IAFJ;AAGD,CALD;;AAOA,eAAeL,cAAf"}
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
export { default as getItemListId } from './get-item-list-id';
|
|
2
|
+
export { default as getItemListIds } from './get-item-list-ids';
|
|
3
|
+
export { default as getItemListData } from './get-item-list-data';
|
|
4
|
+
export { default as setItemListId } from './set-item-list-id';
|
|
5
|
+
export { default as setParamAndRedirect } from './set-param-and-redirect';
|
|
6
|
+
//# sourceMappingURL=index.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","getItemListId","getItemListIds","getItemListData","setItemListId","setParamAndRedirect"],"sources":["../../../../src/components/ItemList/helpers/index.js"],"sourcesContent":["export { default as getItemListId } from './get-item-list-id';\nexport { default as getItemListIds } from './get-item-list-ids';\nexport { default as getItemListData } from './get-item-list-data';\nexport { default as setItemListId } from './set-item-list-id';\nexport { default as setParamAndRedirect } from './set-param-and-redirect';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,aAApB,QAAyC,oBAAzC;AACA,SAASD,OAAO,IAAIE,cAApB,QAA0C,qBAA1C;AACA,SAASF,OAAO,IAAIG,eAApB,QAA2C,sBAA3C;AACA,SAASH,OAAO,IAAII,aAApB,QAAyC,oBAAzC;AACA,SAASJ,OAAO,IAAIK,mBAApB,QAA+C,0BAA/C"}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { LIST_ITEM_LOCAL_KEY } from '../constants';
|
|
2
|
+
|
|
3
|
+
const setItemListId = (listName, id) => {
|
|
4
|
+
const localListName = `${LIST_ITEM_LOCAL_KEY}${listName}`;
|
|
5
|
+
localStorage.setItem(localListName, id);
|
|
6
|
+
window.dispatchEvent(new Event('storage'));
|
|
7
|
+
};
|
|
8
|
+
|
|
9
|
+
export default setItemListId;
|
|
10
|
+
//# sourceMappingURL=set-item-list-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-item-list-id.js","names":["LIST_ITEM_LOCAL_KEY","setItemListId","listName","id","localListName","localStorage","setItem","window","dispatchEvent","Event"],"sources":["../../../../src/components/ItemList/helpers/set-item-list-id.js"],"sourcesContent":["import { LIST_ITEM_LOCAL_KEY } from '../constants';\n\nconst setItemListId = (listName, id) => {\n const localListName = `${LIST_ITEM_LOCAL_KEY}${listName}`;\n localStorage.setItem(localListName, id);\n window.dispatchEvent(new Event('storage'));\n};\n\nexport default setItemListId;\n"],"mappings":"AAAA,SAASA,mBAAT,QAAoC,cAApC;;AAEA,MAAMC,aAAa,GAAG,CAACC,QAAD,EAAWC,EAAX,KAAkB;EACtC,MAAMC,aAAa,GAAI,GAAEJ,mBAAoB,GAAEE,QAAS,EAAxD;EACAG,YAAY,CAACC,OAAb,CAAqBF,aAArB,EAAoCD,EAApC;EACAI,MAAM,CAACC,aAAP,CAAqB,IAAIC,KAAJ,CAAU,SAAV,CAArB;AACD,CAJD;;AAMA,eAAeR,aAAf"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { LIST_ITEM_QUERY_PARAM } from '../constants';
|
|
2
|
+
const placeholderBase = 'https://blazecms.app'; // placeholder for URL, removed later
|
|
3
|
+
|
|
4
|
+
const setParamAndRedirect = (router, value) => {
|
|
5
|
+
const currentUrl = new URL(router.asPath, placeholderBase);
|
|
6
|
+
|
|
7
|
+
if (value) {
|
|
8
|
+
currentUrl.searchParams.set(LIST_ITEM_QUERY_PARAM, value);
|
|
9
|
+
} else if (!currentUrl.searchParams.get(LIST_ITEM_QUERY_PARAM)) return;else {
|
|
10
|
+
currentUrl.searchParams.delete(LIST_ITEM_QUERY_PARAM);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
const newUrl = currentUrl.toString().replace(placeholderBase, '');
|
|
14
|
+
router.push('/Resolver', newUrl, {
|
|
15
|
+
shallow: true
|
|
16
|
+
});
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default setParamAndRedirect;
|
|
20
|
+
//# sourceMappingURL=set-param-and-redirect.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"set-param-and-redirect.js","names":["LIST_ITEM_QUERY_PARAM","placeholderBase","setParamAndRedirect","router","value","currentUrl","URL","asPath","searchParams","set","get","delete","newUrl","toString","replace","push","shallow"],"sources":["../../../../src/components/ItemList/helpers/set-param-and-redirect.js"],"sourcesContent":["import { LIST_ITEM_QUERY_PARAM } from '../constants';\n\nconst placeholderBase = 'https://blazecms.app'; // placeholder for URL, removed later\n\nconst setParamAndRedirect = (router, value) => {\n const currentUrl = new URL(router.asPath, placeholderBase);\n if (value) {\n currentUrl.searchParams.set(LIST_ITEM_QUERY_PARAM, value);\n } else if (!currentUrl.searchParams.get(LIST_ITEM_QUERY_PARAM)) return;\n else {\n currentUrl.searchParams.delete(LIST_ITEM_QUERY_PARAM);\n }\n\n const newUrl = currentUrl.toString().replace(placeholderBase, '');\n router.push('/Resolver', newUrl, {\n shallow: true\n });\n};\n\nexport default setParamAndRedirect;\n"],"mappings":"AAAA,SAASA,qBAAT,QAAsC,cAAtC;AAEA,MAAMC,eAAe,GAAG,sBAAxB,C,CAAgD;;AAEhD,MAAMC,mBAAmB,GAAG,CAACC,MAAD,EAASC,KAAT,KAAmB;EAC7C,MAAMC,UAAU,GAAG,IAAIC,GAAJ,CAAQH,MAAM,CAACI,MAAf,EAAuBN,eAAvB,CAAnB;;EACA,IAAIG,KAAJ,EAAW;IACTC,UAAU,CAACG,YAAX,CAAwBC,GAAxB,CAA4BT,qBAA5B,EAAmDI,KAAnD;EACD,CAFD,MAEO,IAAI,CAACC,UAAU,CAACG,YAAX,CAAwBE,GAAxB,CAA4BV,qBAA5B,CAAL,EAAyD,OAAzD,KACF;IACHK,UAAU,CAACG,YAAX,CAAwBG,MAAxB,CAA+BX,qBAA/B;EACD;;EAED,MAAMY,MAAM,GAAGP,UAAU,CAACQ,QAAX,GAAsBC,OAAtB,CAA8Bb,eAA9B,EAA+C,EAA/C,CAAf;EACAE,MAAM,CAACY,IAAP,CAAY,WAAZ,EAAyBH,MAAzB,EAAiC;IAC/BI,OAAO,EAAE;EADsB,CAAjC;AAGD,CAbD;;AAeA,eAAed,mBAAf"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"index.js","names":["default","useItemListId"],"sources":["../../../../src/components/ItemList/hooks/index.js"],"sourcesContent":["export { default as useItemListId } from './use-item-list-id';\n"],"mappings":"AAAA,SAASA,OAAO,IAAIC,aAApB,QAAyC,oBAAzC"}
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { useState, useEffect } from 'react';
|
|
2
|
+
import { getItemListId } from '../helpers';
|
|
3
|
+
|
|
4
|
+
const useItemListId = ({
|
|
5
|
+
listName
|
|
6
|
+
}) => {
|
|
7
|
+
const idFromStorage = getItemListId(listName);
|
|
8
|
+
const [listId, setListId] = useState(idFromStorage);
|
|
9
|
+
useEffect(() => {
|
|
10
|
+
const storageEventHandler = () => {
|
|
11
|
+
const newId = getItemListId(listName);
|
|
12
|
+
setListId(newId);
|
|
13
|
+
};
|
|
14
|
+
|
|
15
|
+
window.addEventListener('storage', storageEventHandler);
|
|
16
|
+
return () => {
|
|
17
|
+
window.removeEventListener('storage', storageEventHandler);
|
|
18
|
+
};
|
|
19
|
+
}, [listName]);
|
|
20
|
+
return {
|
|
21
|
+
listId
|
|
22
|
+
};
|
|
23
|
+
};
|
|
24
|
+
|
|
25
|
+
export default useItemListId;
|
|
26
|
+
//# sourceMappingURL=use-item-list-id.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"use-item-list-id.js","names":["useState","useEffect","getItemListId","useItemListId","listName","idFromStorage","listId","setListId","storageEventHandler","newId","window","addEventListener","removeEventListener"],"sources":["../../../../src/components/ItemList/hooks/use-item-list-id.js"],"sourcesContent":["import { useState, useEffect } from 'react';\nimport { getItemListId } from '../helpers';\n\nconst useItemListId = ({ listName }) => {\n const idFromStorage = getItemListId(listName);\n const [listId, setListId] = useState(idFromStorage);\n\n useEffect(\n () => {\n const storageEventHandler = () => {\n const newId = getItemListId(listName);\n setListId(newId);\n };\n\n window.addEventListener('storage', storageEventHandler);\n\n return () => {\n window.removeEventListener('storage', storageEventHandler);\n };\n },\n [listName]\n );\n\n return { listId };\n};\n\nexport default useItemListId;\n"],"mappings":"AAAA,SAASA,QAAT,EAAmBC,SAAnB,QAAoC,OAApC;AACA,SAASC,aAAT,QAA8B,YAA9B;;AAEA,MAAMC,aAAa,GAAG,CAAC;EAAEC;AAAF,CAAD,KAAkB;EACtC,MAAMC,aAAa,GAAGH,aAAa,CAACE,QAAD,CAAnC;EACA,MAAM,CAACE,MAAD,EAASC,SAAT,IAAsBP,QAAQ,CAACK,aAAD,CAApC;EAEAJ,SAAS,CACP,MAAM;IACJ,MAAMO,mBAAmB,GAAG,MAAM;MAChC,MAAMC,KAAK,GAAGP,aAAa,CAACE,QAAD,CAA3B;MACAG,SAAS,CAACE,KAAD,CAAT;IACD,CAHD;;IAKAC,MAAM,CAACC,gBAAP,CAAwB,SAAxB,EAAmCH,mBAAnC;IAEA,OAAO,MAAM;MACXE,MAAM,CAACE,mBAAP,CAA2B,SAA3B,EAAsCJ,mBAAtC;IACD,CAFD;EAGD,CAZM,EAaP,CAACJ,QAAD,CAbO,CAAT;EAgBA,OAAO;IAAEE;EAAF,CAAP;AACD,CArBD;;AAuBA,eAAeH,aAAf"}
|
|
@@ -4,6 +4,7 @@ const _excluded = ["src", "alt", "sizeKey", "priority"];
|
|
|
4
4
|
import React from 'react';
|
|
5
5
|
import PropTypes from 'prop-types';
|
|
6
6
|
import { ResponsiveImage } from '@blaze-cms/image-cdn-react';
|
|
7
|
+
import Head from 'next/head';
|
|
7
8
|
import { useInView } from '@blaze-react/utils/lib/customHooks';
|
|
8
9
|
import { IN_VIEW_CONFIG } from '../../constants';
|
|
9
10
|
|
|
@@ -18,12 +19,14 @@ const LazyImage = _ref => {
|
|
|
18
19
|
|
|
19
20
|
const [isIntersecting, outerRef] = useInView(IN_VIEW_CONFIG);
|
|
20
21
|
const shouldRender = priority || isIntersecting;
|
|
22
|
+
const HeadComponent = priority ? Head : null;
|
|
21
23
|
return /*#__PURE__*/React.createElement("span", {
|
|
22
24
|
ref: outerRef
|
|
23
25
|
}, shouldRender && /*#__PURE__*/React.createElement(ResponsiveImage, _extends({
|
|
24
26
|
src: src,
|
|
25
27
|
alt: alt,
|
|
26
|
-
sizeKey: sizeKey
|
|
28
|
+
sizeKey: sizeKey,
|
|
29
|
+
HeadComponent: HeadComponent
|
|
27
30
|
}, props)));
|
|
28
31
|
};
|
|
29
32
|
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LazyImage.js","names":["React","PropTypes","ResponsiveImage","useInView","IN_VIEW_CONFIG","LazyImage","src","alt","sizeKey","priority","props","isIntersecting","outerRef","shouldRender","propTypes","string","isRequired","bool","defaultProps"],"sources":["../../../src/components/LazyImage/LazyImage.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { ResponsiveImage } from '@blaze-cms/image-cdn-react';\nimport { useInView } from '@blaze-react/utils/lib/customHooks';\nimport { IN_VIEW_CONFIG } from '../../constants';\n\nconst LazyImage = ({ src, alt, sizeKey, priority, ...props }) => {\n const [isIntersecting, outerRef] = useInView(IN_VIEW_CONFIG);\n const shouldRender = priority || isIntersecting;\n\n return (\n <span ref={outerRef}>\n {shouldRender && <ResponsiveImage
|
|
1
|
+
{"version":3,"file":"LazyImage.js","names":["React","PropTypes","ResponsiveImage","Head","useInView","IN_VIEW_CONFIG","LazyImage","src","alt","sizeKey","priority","props","isIntersecting","outerRef","shouldRender","HeadComponent","propTypes","string","isRequired","bool","defaultProps"],"sources":["../../../src/components/LazyImage/LazyImage.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { ResponsiveImage } from '@blaze-cms/image-cdn-react';\nimport Head from 'next/head';\nimport { useInView } from '@blaze-react/utils/lib/customHooks';\nimport { IN_VIEW_CONFIG } from '../../constants';\n\nconst LazyImage = ({ src, alt, sizeKey, priority, ...props }) => {\n const [isIntersecting, outerRef] = useInView(IN_VIEW_CONFIG);\n const shouldRender = priority || isIntersecting;\n const HeadComponent = priority ? Head : null;\n\n return (\n <span ref={outerRef}>\n {shouldRender && (\n <ResponsiveImage\n src={src}\n alt={alt}\n sizeKey={sizeKey}\n HeadComponent={HeadComponent}\n {...props}\n />\n )}\n </span>\n );\n};\n\nLazyImage.propTypes = {\n src: PropTypes.string.isRequired,\n alt: PropTypes.string,\n sizeKey: PropTypes.string.isRequired,\n priority: PropTypes.bool\n};\n\nLazyImage.defaultProps = {\n alt: '',\n priority: false\n};\n\nexport default LazyImage;\n"],"mappings":";;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,eAAT,QAAgC,4BAAhC;AACA,OAAOC,IAAP,MAAiB,WAAjB;AACA,SAASC,SAAT,QAA0B,oCAA1B;AACA,SAASC,cAAT,QAA+B,iBAA/B;;AAEA,MAAMC,SAAS,GAAG,QAA+C;EAAA,IAA9C;IAAEC,GAAF;IAAOC,GAAP;IAAYC,OAAZ;IAAqBC;EAArB,CAA8C;EAAA,IAAZC,KAAY;;EAC/D,MAAM,CAACC,cAAD,EAAiBC,QAAjB,IAA6BT,SAAS,CAACC,cAAD,CAA5C;EACA,MAAMS,YAAY,GAAGJ,QAAQ,IAAIE,cAAjC;EACA,MAAMG,aAAa,GAAGL,QAAQ,GAAGP,IAAH,GAAU,IAAxC;EAEA,oBACE;IAAM,GAAG,EAAEU;EAAX,GACGC,YAAY,iBACX,oBAAC,eAAD;IACE,GAAG,EAAEP,GADP;IAEE,GAAG,EAAEC,GAFP;IAGE,OAAO,EAAEC,OAHX;IAIE,aAAa,EAAEM;EAJjB,GAKMJ,KALN,EAFJ,CADF;AAaD,CAlBD;;AAoBAL,SAAS,CAACU,SAAV,GAAsB;EACpBT,GAAG,EAAEN,SAAS,CAACgB,MAAV,CAAiBC,UADF;EAEpBV,GAAG,EAAEP,SAAS,CAACgB,MAFK;EAGpBR,OAAO,EAAER,SAAS,CAACgB,MAAV,CAAiBC,UAHN;EAIpBR,QAAQ,EAAET,SAAS,CAACkB;AAJA,CAAtB;AAOAb,SAAS,CAACc,YAAV,GAAyB;EACvBZ,GAAG,EAAE,EADkB;EAEvBE,QAAQ,EAAE;AAFa,CAAzB;AAKA,eAAeJ,SAAf"}
|
|
@@ -46,13 +46,15 @@ const ListBuilder = props => {
|
|
|
46
46
|
requiredSchema,
|
|
47
47
|
searchValues,
|
|
48
48
|
azFilter,
|
|
49
|
-
sortProperties
|
|
49
|
+
sortProperties,
|
|
50
|
+
itemListIds
|
|
50
51
|
} = props;
|
|
51
52
|
const isInfinite = paginationType === INFINITE;
|
|
52
53
|
const listComponent = getListComponent(isCard, paginationType);
|
|
53
54
|
const propsToDisplayValues = checkPropsToUse(propsToDisplay);
|
|
54
55
|
const entityFields = buildPropsQuery(entitySchema, propsToDisplayValues, props) || '';
|
|
55
|
-
const
|
|
56
|
+
const itemsToDisplayToUse = itemListIds || itemsToDisplay;
|
|
57
|
+
const limitToUse = limit || itemsToDisplayToUse.length;
|
|
56
58
|
const shouldApplyDefaultSort = !sortProperties || !sortProperties.length;
|
|
57
59
|
const itemsPerPageToUse = getItemsPerPageToUse(itemsPerPage, limitToUse);
|
|
58
60
|
const initialOffset = getCurrentOffset(offset, itemsPerPageToUse, paginationIndex, limitToUse);
|
|
@@ -76,7 +78,7 @@ const ListBuilder = props => {
|
|
|
76
78
|
filterOperator,
|
|
77
79
|
relations,
|
|
78
80
|
stringProps
|
|
79
|
-
}, itemId,
|
|
81
|
+
}, itemId, itemsToDisplayToUse, shouldApplyDefaultSort, {
|
|
80
82
|
shouldReturnAggs: true,
|
|
81
83
|
isAZ
|
|
82
84
|
});
|
|
@@ -106,7 +108,7 @@ const ListBuilder = props => {
|
|
|
106
108
|
relations,
|
|
107
109
|
stringProps,
|
|
108
110
|
azFilter
|
|
109
|
-
}, itemId,
|
|
111
|
+
}, itemId, itemsToDisplayToUse, shouldApplyDefaultSort, {
|
|
110
112
|
shouldReturnAggs: false,
|
|
111
113
|
isAZ
|
|
112
114
|
});
|
|
@@ -130,7 +132,9 @@ const ListBuilder = props => {
|
|
|
130
132
|
listAggregations: updatedAggregations,
|
|
131
133
|
isAZ: isAZ,
|
|
132
134
|
azFilter: azFilter
|
|
133
|
-
}, props
|
|
135
|
+
}, props, {
|
|
136
|
+
itemsToDisplay: itemsToDisplayToUse
|
|
137
|
+
}));
|
|
134
138
|
};
|
|
135
139
|
|
|
136
140
|
ListBuilder.propTypes = {
|
|
@@ -159,11 +163,13 @@ ListBuilder.propTypes = {
|
|
|
159
163
|
filterOperator: PropTypes.string.isRequired,
|
|
160
164
|
paginationType: PropTypes.string,
|
|
161
165
|
azFilter: PropTypes.string,
|
|
162
|
-
sortProperties: PropTypes.array
|
|
166
|
+
sortProperties: PropTypes.array,
|
|
167
|
+
itemListIds: PropTypes.array
|
|
163
168
|
};
|
|
164
169
|
ListBuilder.defaultProps = {
|
|
165
170
|
entityData: {},
|
|
166
171
|
itemsToDisplay: [],
|
|
172
|
+
itemListIds: null,
|
|
167
173
|
limit: 0,
|
|
168
174
|
omitWrappers: false,
|
|
169
175
|
offset: 0,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListBuilder.js","names":["React","PropTypes","useQuery","getStringTypeProps","CardRenderWithInfiniteScroll","CardsRender","FullRender","FullRenderWithInfiniteScroll","ListRender","getSearchPublishedContent","buildRawQuery","buildQueryFields","buildSetFilters","getGenericRenderVariables","getEntityData","getCurrentOffset","getUpdatedFilterBy","checkPropsToUse","buildPropsQuery","sortAggs","getItemsPerPageToUse","buildAzAggregations","SEARCH_PUBLISHED_CONTENT","INFINITE","CLASSIC","RAW_RESULTS","ListBuilder","props","entitySchema","isCard","isAZ","inheritedFilters","paginationType","entity","isTextSearchFilterApplied","parent","itemId","itemsPerPage","itemsToDisplay","limit","propsToDisplay","offset","entityData","sortby","sort","paginationIndex","omitWrappers","operator","filterOperator","currentSchema","filterEntitySchema","requiredSchema","searchValues","azFilter","sortProperties","isInfinite","listComponent","getListComponent","propsToDisplayValues","entityFields","limitToUse","length","shouldApplyDefaultSort","itemsPerPageToUse","initialOffset","entityType","docType","fields","action","actionKey","updatedFilterBy","filterValues","filterBy","relations","stringProps","Object","values","azRawQuery","shouldReturnAggs","azVariables","azAction","data","error","loading","variables","skip","message","listAggregations","updatedAggregations","rawQuery","propTypes","string","isRequired","object","bool","number","array","defaultProps","isNotClassic"],"sources":["../../../src/components/List/ListBuilder.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { getStringTypeProps } from '@blaze-cms/utils/src/helpers';\nimport {\n CardRenderWithInfiniteScroll,\n CardsRender,\n FullRender,\n FullRenderWithInfiniteScroll\n} from './components';\nimport ListRender from './ListRender';\nimport { getSearchPublishedContent } from '../../application/query';\nimport {\n buildRawQuery,\n buildQueryFields,\n buildSetFilters,\n getGenericRenderVariables,\n getEntityData,\n getCurrentOffset,\n getUpdatedFilterBy,\n checkPropsToUse,\n buildPropsQuery\n} from '../../helpers';\nimport { sortAggs, getItemsPerPageToUse, buildAzAggregations } from './helpers';\nimport { SEARCH_PUBLISHED_CONTENT, INFINITE, CLASSIC } from '../../constants';\nimport { RAW_RESULTS } from './constants';\n\nconst ListBuilder = props => {\n const {\n entitySchema,\n isCard,\n isAZ,\n inheritedFilters,\n paginationType,\n entity,\n isTextSearchFilterApplied,\n parent: { itemId },\n itemsPerPage,\n itemsToDisplay,\n limit,\n propsToDisplay,\n offset,\n entityData,\n sortby,\n sort,\n paginationIndex,\n omitWrappers,\n operator,\n filterOperator,\n currentSchema,\n filterEntitySchema,\n requiredSchema,\n searchValues,\n azFilter,\n sortProperties\n } = props;\n const isInfinite = paginationType === INFINITE;\n const listComponent = getListComponent(isCard, paginationType);\n const propsToDisplayValues = checkPropsToUse(propsToDisplay);\n const entityFields = buildPropsQuery(entitySchema, propsToDisplayValues, props) || '';\n const limitToUse = limit || itemsToDisplay.length;\n const shouldApplyDefaultSort = !sortProperties || !sortProperties.length;\n const itemsPerPageToUse = getItemsPerPageToUse(itemsPerPage, limitToUse);\n const initialOffset = getCurrentOffset(offset, itemsPerPageToUse, paginationIndex, limitToUse);\n const { entityType, docType } = getEntityData(entity, requiredSchema);\n const fields = buildQueryFields(entityFields, entityType, !isCard);\n const action = getSearchPublishedContent(fields);\n const actionKey = SEARCH_PUBLISHED_CONTENT;\n const updatedFilterBy = getUpdatedFilterBy(\n inheritedFilters,\n entityData,\n currentSchema,\n filterEntitySchema,\n itemId,\n props\n );\n\n const filterValues =\n updatedFilterBy && updatedFilterBy.length\n ? buildSetFilters({ ...props, filterBy: updatedFilterBy })\n : buildSetFilters({ ...props });\n\n const { relations = [] } = filterEntitySchema;\n const stringProps = getStringTypeProps(entity, relations, Object.values(requiredSchema));\n\n const azRawQuery = buildRawQuery(\n docType,\n operator,\n searchValues,\n {\n filterValues,\n filterOperator,\n relations,\n stringProps\n },\n itemId,\n itemsToDisplay,\n shouldApplyDefaultSort,\n { shouldReturnAggs: true, isAZ }\n );\n\n const azVariables = getGenericRenderVariables(\n relations,\n {\n ...props,\n limit: itemsPerPageToUse,\n offset: initialOffset,\n sort,\n sortby,\n sortProperties\n },\n stringProps,\n azRawQuery,\n isTextSearchFilterApplied\n );\n\n const azAction = getSearchPublishedContent(RAW_RESULTS);\n const { data, error, loading } = useQuery(azAction, {\n variables: azVariables,\n skip: !isAZ\n });\n if (loading) return '';\n if (error) return error.message;\n\n const listAggregations = isAZ ? sortAggs(data) : [];\n const updatedAggregations = buildAzAggregations(listAggregations);\n\n const rawQuery = buildRawQuery(\n docType,\n operator,\n searchValues,\n {\n filterValues,\n filterOperator,\n relations,\n stringProps,\n azFilter\n },\n itemId,\n itemsToDisplay,\n shouldApplyDefaultSort,\n { shouldReturnAggs: false, isAZ }\n );\n\n const variables = getGenericRenderVariables(\n relations,\n {\n ...props,\n limit: itemsPerPageToUse,\n offset: initialOffset,\n sort,\n sortby,\n sortProperties\n },\n stringProps,\n rawQuery,\n isTextSearchFilterApplied\n );\n\n return (\n <ListRender\n variables={variables}\n isInfinite={isInfinite}\n initialOffset={initialOffset}\n actionKey={actionKey}\n limitToUse={limitToUse}\n itemsPerPageToUse={itemsPerPageToUse}\n action={action}\n omitWrappers={omitWrappers}\n listComponent={listComponent}\n listAggregations={updatedAggregations}\n isAZ={isAZ}\n azFilter={azFilter}\n {...props}\n />\n );\n};\n\nListBuilder.propTypes = {\n entity: PropTypes.string.isRequired,\n entitySchema: PropTypes.object.isRequired,\n isCard: PropTypes.bool.isRequired,\n isAZ: PropTypes.bool.isRequired,\n isTextSearchFilterApplied: PropTypes.bool.isRequired,\n parent: PropTypes.object.isRequired,\n itemsPerPage: PropTypes.number.isRequired,\n paginationIndex: PropTypes.number.isRequired,\n propsToDisplay: PropTypes.array.isRequired,\n currentSchema: PropTypes.object.isRequired,\n filterEntitySchema: PropTypes.object.isRequired,\n requiredSchema: PropTypes.object.isRequired,\n searchValues: PropTypes.object.isRequired,\n inheritedFilters: PropTypes.array,\n entityData: PropTypes.object,\n itemsToDisplay: PropTypes.array,\n limit: PropTypes.number,\n omitWrappers: PropTypes.bool,\n offset: PropTypes.number,\n sortby: PropTypes.array.isRequired,\n sort: PropTypes.string.isRequired,\n operator: PropTypes.string.isRequired,\n filterOperator: PropTypes.string.isRequired,\n paginationType: PropTypes.string,\n azFilter: PropTypes.string,\n sortProperties: PropTypes.array\n};\n\nListBuilder.defaultProps = {\n entityData: {},\n itemsToDisplay: [],\n limit: 0,\n omitWrappers: false,\n offset: 0,\n paginationType: 'infinite',\n inheritedFilters: [],\n azFilter: '',\n sortProperties: []\n};\n\nexport default ListBuilder;\nfunction getListComponent(isCard, paginationType) {\n const isNotClassic = paginationType !== CLASSIC;\n\n if (isCard) return isNotClassic ? CardRenderWithInfiniteScroll : CardsRender;\n\n return isNotClassic ? FullRenderWithInfiniteScroll : FullRender;\n}\n"],"mappings":";;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,QAAT,QAAyB,gBAAzB;AACA,SAASC,kBAAT,QAAmC,8BAAnC;AACA,SACEC,4BADF,EAEEC,WAFF,EAGEC,UAHF,EAIEC,4BAJF,QAKO,cALP;AAMA,OAAOC,UAAP,MAAuB,cAAvB;AACA,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MAjBK;EAkBtBjD,YAAY,EAAE7C,SAAS,CAAC6F,IAlBF;EAmBtBrD,MAAM,EAAExC,SAAS,CAAC8F,MAnBI;EAoBtBpD,MAAM,EAAE1C,SAAS,CAAC+F,KAAV,CAAgBJ,UApBF;EAqBtBhD,IAAI,EAAE3C,SAAS,CAAC0F,MAAV,CAAiBC,UArBD;EAsBtB7C,QAAQ,EAAE9C,SAAS,CAAC0F,MAAV,CAAiBC,UAtBL;EAuBtB5C,cAAc,EAAE/C,SAAS,CAAC0F,MAAV,CAAiBC,UAvBX;EAwBtB5D,cAAc,EAAE/B,SAAS,CAAC0F,MAxBJ;EAyBtBtC,QAAQ,EAAEpD,SAAS,CAAC0F,MAzBE;EA0BtBrC,cAAc,EAAErD,SAAS,CAAC+F;AA1BJ,CAAxB;AA6BAtE,WAAW,CAACuE,YAAZ,GAA2B;EACzBvD,UAAU,EAAE,EADa;EAEzBJ,cAAc,EAAE,EAFS;EAGzBC,KAAK,EAAE,CAHkB;EAIzBO,YAAY,EAAE,KAJW;EAKzBL,MAAM,EAAE,CALiB;EAMzBT,cAAc,EAAE,UANS;EAOzBD,gBAAgB,EAAE,EAPO;EAQzBsB,QAAQ,EAAE,EARe;EASzBC,cAAc,EAAE;AATS,CAA3B;AAYA,eAAe5B,WAAf;;AACA,SAAS+B,gBAAT,CAA0B5B,MAA1B,EAAkCG,cAAlC,EAAkD;EAChD,MAAMkE,YAAY,GAAGlE,cAAc,KAAKR,OAAxC;EAEA,IAAIK,MAAJ,EAAY,OAAOqE,YAAY,GAAG9F,4BAAH,GAAkCC,WAArD;EAEZ,OAAO6F,YAAY,GAAG3F,4BAAH,GAAkCD,UAArD;AACD"}
|
|
1
|
+
{"version":3,"file":"ListBuilder.js","names":["React","PropTypes","useQuery","getStringTypeProps","CardRenderWithInfiniteScroll","CardsRender","FullRender","FullRenderWithInfiniteScroll","ListRender","getSearchPublishedContent","buildRawQuery","buildQueryFields","buildSetFilters","getGenericRenderVariables","getEntityData","getCurrentOffset","getUpdatedFilterBy","checkPropsToUse","buildPropsQuery","sortAggs","getItemsPerPageToUse","buildAzAggregations","SEARCH_PUBLISHED_CONTENT","INFINITE","CLASSIC","RAW_RESULTS","ListBuilder","props","entitySchema","isCard","isAZ","inheritedFilters","paginationType","entity","isTextSearchFilterApplied","parent","itemId","itemsPerPage","itemsToDisplay","limit","propsToDisplay","offset","entityData","sortby","sort","paginationIndex","omitWrappers","operator","filterOperator","currentSchema","filterEntitySchema","requiredSchema","searchValues","azFilter","sortProperties","itemListIds","isInfinite","listComponent","getListComponent","propsToDisplayValues","entityFields","itemsToDisplayToUse","limitToUse","length","shouldApplyDefaultSort","itemsPerPageToUse","initialOffset","entityType","docType","fields","action","actionKey","updatedFilterBy","filterValues","filterBy","relations","stringProps","Object","values","azRawQuery","shouldReturnAggs","azVariables","azAction","data","error","loading","variables","skip","message","listAggregations","updatedAggregations","rawQuery","propTypes","string","isRequired","object","bool","number","array","defaultProps","isNotClassic"],"sources":["../../../src/components/List/ListBuilder.js"],"sourcesContent":["import React from 'react';\nimport PropTypes from 'prop-types';\nimport { useQuery } from '@apollo/client';\nimport { getStringTypeProps } from '@blaze-cms/utils/src/helpers';\nimport {\n CardRenderWithInfiniteScroll,\n CardsRender,\n FullRender,\n FullRenderWithInfiniteScroll\n} from './components';\nimport ListRender from './ListRender';\nimport { getSearchPublishedContent } from '../../application/query';\nimport {\n buildRawQuery,\n buildQueryFields,\n buildSetFilters,\n getGenericRenderVariables,\n getEntityData,\n getCurrentOffset,\n getUpdatedFilterBy,\n checkPropsToUse,\n buildPropsQuery\n} from '../../helpers';\nimport { sortAggs, getItemsPerPageToUse, buildAzAggregations } from './helpers';\nimport { SEARCH_PUBLISHED_CONTENT, INFINITE, CLASSIC } from '../../constants';\nimport { RAW_RESULTS } from './constants';\n\nconst ListBuilder = props => {\n const {\n entitySchema,\n isCard,\n isAZ,\n inheritedFilters,\n paginationType,\n entity,\n isTextSearchFilterApplied,\n parent: { itemId },\n itemsPerPage,\n itemsToDisplay,\n limit,\n propsToDisplay,\n offset,\n entityData,\n sortby,\n sort,\n paginationIndex,\n omitWrappers,\n operator,\n filterOperator,\n currentSchema,\n filterEntitySchema,\n requiredSchema,\n searchValues,\n azFilter,\n sortProperties,\n itemListIds\n } = props;\n const isInfinite = paginationType === INFINITE;\n const listComponent = getListComponent(isCard, paginationType);\n const propsToDisplayValues = checkPropsToUse(propsToDisplay);\n const entityFields = buildPropsQuery(entitySchema, propsToDisplayValues, props) || '';\n const itemsToDisplayToUse = itemListIds || itemsToDisplay;\n const limitToUse = limit || itemsToDisplayToUse.length;\n const shouldApplyDefaultSort = !sortProperties || !sortProperties.length;\n const itemsPerPageToUse = getItemsPerPageToUse(itemsPerPage, limitToUse);\n const initialOffset = getCurrentOffset(offset, itemsPerPageToUse, paginationIndex, limitToUse);\n const { entityType, docType } = getEntityData(entity, requiredSchema);\n const fields = buildQueryFields(entityFields, entityType, !isCard);\n const action = getSearchPublishedContent(fields);\n const actionKey = SEARCH_PUBLISHED_CONTENT;\n const updatedFilterBy = getUpdatedFilterBy(\n inheritedFilters,\n entityData,\n currentSchema,\n filterEntitySchema,\n itemId,\n props\n );\n\n const filterValues =\n updatedFilterBy && updatedFilterBy.length\n ? buildSetFilters({ ...props, filterBy: updatedFilterBy })\n : buildSetFilters({ ...props });\n\n const { relations = [] } = filterEntitySchema;\n const stringProps = getStringTypeProps(entity, relations, Object.values(requiredSchema));\n\n const azRawQuery = buildRawQuery(\n docType,\n operator,\n searchValues,\n {\n filterValues,\n filterOperator,\n relations,\n stringProps\n },\n itemId,\n itemsToDisplayToUse,\n shouldApplyDefaultSort,\n { shouldReturnAggs: true, isAZ }\n );\n\n const azVariables = getGenericRenderVariables(\n relations,\n {\n ...props,\n limit: itemsPerPageToUse,\n offset: initialOffset,\n sort,\n sortby,\n sortProperties\n },\n stringProps,\n azRawQuery,\n isTextSearchFilterApplied\n );\n\n const azAction = getSearchPublishedContent(RAW_RESULTS);\n const { data, error, loading } = useQuery(azAction, {\n variables: azVariables,\n skip: !isAZ\n });\n if (loading) return '';\n if (error) return error.message;\n\n const listAggregations = isAZ ? sortAggs(data) : [];\n const updatedAggregations = buildAzAggregations(listAggregations);\n\n const rawQuery = buildRawQuery(\n docType,\n operator,\n searchValues,\n {\n filterValues,\n filterOperator,\n relations,\n stringProps,\n azFilter\n },\n itemId,\n itemsToDisplayToUse,\n shouldApplyDefaultSort,\n { shouldReturnAggs: false, isAZ }\n );\n\n const variables = getGenericRenderVariables(\n relations,\n {\n ...props,\n limit: itemsPerPageToUse,\n offset: initialOffset,\n sort,\n sortby,\n sortProperties\n },\n stringProps,\n rawQuery,\n isTextSearchFilterApplied\n );\n\n return (\n <ListRender\n variables={variables}\n isInfinite={isInfinite}\n initialOffset={initialOffset}\n actionKey={actionKey}\n limitToUse={limitToUse}\n itemsPerPageToUse={itemsPerPageToUse}\n action={action}\n omitWrappers={omitWrappers}\n listComponent={listComponent}\n listAggregations={updatedAggregations}\n isAZ={isAZ}\n azFilter={azFilter}\n {...props}\n itemsToDisplay={itemsToDisplayToUse}\n />\n );\n};\n\nListBuilder.propTypes = {\n entity: PropTypes.string.isRequired,\n entitySchema: PropTypes.object.isRequired,\n isCard: PropTypes.bool.isRequired,\n isAZ: PropTypes.bool.isRequired,\n isTextSearchFilterApplied: PropTypes.bool.isRequired,\n parent: PropTypes.object.isRequired,\n itemsPerPage: PropTypes.number.isRequired,\n paginationIndex: PropTypes.number.isRequired,\n propsToDisplay: PropTypes.array.isRequired,\n currentSchema: PropTypes.object.isRequired,\n filterEntitySchema: PropTypes.object.isRequired,\n requiredSchema: PropTypes.object.isRequired,\n searchValues: PropTypes.object.isRequired,\n inheritedFilters: PropTypes.array,\n entityData: PropTypes.object,\n itemsToDisplay: PropTypes.array,\n limit: PropTypes.number,\n omitWrappers: PropTypes.bool,\n offset: PropTypes.number,\n sortby: PropTypes.array.isRequired,\n sort: PropTypes.string.isRequired,\n operator: PropTypes.string.isRequired,\n filterOperator: PropTypes.string.isRequired,\n paginationType: PropTypes.string,\n azFilter: PropTypes.string,\n sortProperties: PropTypes.array,\n itemListIds: PropTypes.array\n};\n\nListBuilder.defaultProps = {\n entityData: {},\n itemsToDisplay: [],\n itemListIds: null,\n limit: 0,\n omitWrappers: false,\n offset: 0,\n paginationType: 'infinite',\n inheritedFilters: [],\n azFilter: '',\n sortProperties: []\n};\n\nexport default ListBuilder;\nfunction getListComponent(isCard, paginationType) {\n const isNotClassic = paginationType !== CLASSIC;\n\n if (isCard) return isNotClassic ? CardRenderWithInfiniteScroll : CardsRender;\n\n return isNotClassic ? FullRenderWithInfiniteScroll : FullRender;\n}\n"],"mappings":";;;;;;;AAAA,OAAOA,KAAP,MAAkB,OAAlB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,QAAT,QAAyB,gBAAzB;AACA,SAASC,kBAAT,QAAmC,8BAAnC;AACA,SACEC,4BADF,EAEEC,WAFF,EAGEC,UAHF,EAIEC,4BAJF,QAKO,cALP;AAMA,OAAOC,UAAP,MAAuB,cAAvB;AACA,SAASC,yBAAT,QAA0C,yBAA1C;AACA,SACEC,aADF,EAEEC,gBAFF,EAGEC,eAHF,EAIEC,yBAJF,EAKEC,aALF,EAMEC,gBANF,EAOEC,kBAPF,EAQEC,eARF,EASEC,eATF,QAUO,eAVP;AAWA,SAASC,QAAT,EAAmBC,oBAAnB,EAAyCC,mBAAzC,QAAoE,WAApE;AACA,SAASC,wBAAT,EAAmCC,QAAnC,EAA6CC,OAA7C,QAA4D,iBAA5D;AACA,SAASC,WAAT,QAA4B,aAA5B;;AAEA,MAAMC,WAAW,GAAGC,KAAK,IAAI;EAC3B,MAAM;IACJC,YADI;IAEJC,MAFI;IAGJC,IAHI;IAIJC,gBAJI;IAKJC,cALI;IAMJC,MANI;IAOJC,yBAPI;IAQJC,MAAM,EAAE;MAAEC;IAAF,CARJ;IASJC,YATI;IAUJC,cAVI;IAWJC,KAXI;IAYJC,cAZI;IAaJC,MAbI;IAcJC,UAdI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BtB3C,WAAW,EAAEtD,SAAS,CAACiG;AA3BD,CAAxB;AA8BAxE,WAAW,CAACyE,YAAZ,GAA2B;EACzBzD,UAAU,EAAE,EADa;EAEzBJ,cAAc,EAAE,EAFS;EAGzBiB,WAAW,EAAE,IAHY;EAIzBhB,KAAK,EAAE,CAJkB;EAKzBO,YAAY,EAAE,KALW;EAMzBL,MAAM,EAAE,CANiB;EAOzBT,cAAc,EAAE,UAPS;EAQzBD,gBAAgB,EAAE,EARO;EASzBsB,QAAQ,EAAE,EATe;EAUzBC,cAAc,EAAE;AAVS,CAA3B;AAaA,eAAe5B,WAAf;;AACA,SAASgC,gBAAT,CAA0B7B,MAA1B,EAAkCG,cAAlC,EAAkD;EAChD,MAAMoE,YAAY,GAAGpE,cAAc,KAAKR,OAAxC;EAEA,IAAIK,MAAJ,EAAY,OAAOuE,YAAY,GAAGhG,4BAAH,GAAkCC,WAArD;EAEZ,OAAO+F,YAAY,GAAG7F,4BAAH,GAAkCD,UAArD;AACD"}
|
|
@@ -10,11 +10,12 @@ import { parseUrl } from 'query-string';
|
|
|
10
10
|
import PropTypes from 'prop-types';
|
|
11
11
|
import { useRouter } from 'next/router';
|
|
12
12
|
import { MainContext } from '@blaze-cms/nextjs-components';
|
|
13
|
-
import { getSingleEntitySchema, generateSingleItemQuery } from '../../application/query';
|
|
13
|
+
import { getSingleEntitySchema, generateSingleItemQuery, getItemList } from '../../application/query';
|
|
14
14
|
import ListBuilder from './ListBuilder';
|
|
15
15
|
import { AZ_LIST_TYPE } from './constants';
|
|
16
|
-
import { getAzQueryFilter, getSortProps } from './helpers';
|
|
16
|
+
import { getAzQueryFilter, getSortProps, hasRequiredItemListDetails } from './helpers';
|
|
17
17
|
import { getGenericProps, getRequiredSchemas, checkForError, getUnpublishedEntityName, getPaginationIndex, getSearchFilterType, getElasticsearchOperator, buildSearchValuesText, getQueryFilters, getInheritedFilters, getQueryProps } from '../../helpers';
|
|
18
|
+
import { getItemListId, getItemListIds } from '../ItemList/helpers';
|
|
18
19
|
import { useGetEntitySchemasAsObj } from '../../hooks';
|
|
19
20
|
import { AND_OPERATOR, TEXT_SEARCH, ID, AND, FULL } from '../../constants';
|
|
20
21
|
|
|
@@ -31,7 +32,8 @@ const ListFactory = props => {
|
|
|
31
32
|
sort: defaultSort,
|
|
32
33
|
searchFilter,
|
|
33
34
|
operator: filterOperator,
|
|
34
|
-
sortProperties
|
|
35
|
+
sortProperties,
|
|
36
|
+
itemListName
|
|
35
37
|
} = props;
|
|
36
38
|
const {
|
|
37
39
|
isPreview
|
|
@@ -46,7 +48,8 @@ const ListFactory = props => {
|
|
|
46
48
|
url,
|
|
47
49
|
query: {
|
|
48
50
|
sort: querySort,
|
|
49
|
-
sortby: querySortBy
|
|
51
|
+
sortby: querySortBy,
|
|
52
|
+
itemListId: queryItemListId
|
|
50
53
|
} = {}
|
|
51
54
|
} = parseUrl(parsedQuery);
|
|
52
55
|
const {
|
|
@@ -59,6 +62,7 @@ const ListFactory = props => {
|
|
|
59
62
|
querySortBy,
|
|
60
63
|
defaultSortBy
|
|
61
64
|
});
|
|
65
|
+
const itemListId = getItemListId(itemListName, queryItemListId);
|
|
62
66
|
const {
|
|
63
67
|
itemEntity,
|
|
64
68
|
itemId
|
|
@@ -107,14 +111,31 @@ const ListFactory = props => {
|
|
|
107
111
|
},
|
|
108
112
|
skip: schemasLoading || !inheritedFilters.length && queryProps === ID
|
|
109
113
|
});
|
|
110
|
-
const
|
|
114
|
+
const {
|
|
115
|
+
data: itemListData = {},
|
|
116
|
+
error: itemListError,
|
|
117
|
+
loading: itemListLoading
|
|
118
|
+
} = useQuery(getItemList, {
|
|
119
|
+
variables: {
|
|
120
|
+
id: itemListId
|
|
121
|
+
},
|
|
122
|
+
skip: !itemListId
|
|
123
|
+
});
|
|
124
|
+
if (!hasRequiredItemListDetails({
|
|
125
|
+
itemListName,
|
|
126
|
+
router,
|
|
127
|
+
itemListId,
|
|
128
|
+
queryItemListId
|
|
129
|
+
})) return '';
|
|
130
|
+
const errorsToCheck = [schemaError, schemasError, requiredSchemaError, itemQueryError, itemListError];
|
|
111
131
|
const {
|
|
112
132
|
hasErr,
|
|
113
133
|
errMsg
|
|
114
134
|
} = checkForError(errorsToCheck);
|
|
115
|
-
if (requiredSchemaLoading || schemasLoading || schemaLoading || itemQueryLoading) return '';
|
|
135
|
+
if (requiredSchemaLoading || schemasLoading || schemaLoading || itemQueryLoading || itemListLoading) return '';
|
|
116
136
|
if (hasErr) return errMsg;
|
|
117
137
|
if (!entitySchema) return null;
|
|
138
|
+
const itemListIds = getItemListIds(itemListData);
|
|
118
139
|
const isCard = type !== FULL;
|
|
119
140
|
const isAZ = type === AZ_LIST_TYPE;
|
|
120
141
|
const genericProps = getGenericProps(props);
|
|
@@ -154,7 +175,8 @@ const ListFactory = props => {
|
|
|
154
175
|
paginationIndex,
|
|
155
176
|
entityData,
|
|
156
177
|
inheritedFilters,
|
|
157
|
-
filterOperator
|
|
178
|
+
filterOperator,
|
|
179
|
+
itemListIds
|
|
158
180
|
});
|
|
159
181
|
|
|
160
182
|
return /*#__PURE__*/React.createElement(ListBuilder, listProps);
|
|
@@ -172,7 +194,8 @@ ListFactory.propTypes = {
|
|
|
172
194
|
sortby: PropTypes.array,
|
|
173
195
|
sort: PropTypes.string,
|
|
174
196
|
searchFilter: PropTypes.object,
|
|
175
|
-
sortProperties: PropTypes.array
|
|
197
|
+
sortProperties: PropTypes.array,
|
|
198
|
+
itemListName: PropTypes.string
|
|
176
199
|
};
|
|
177
200
|
ListFactory.defaultProps = {
|
|
178
201
|
filterBy: [],
|
|
@@ -183,7 +206,8 @@ ListFactory.defaultProps = {
|
|
|
183
206
|
sortProperties: [],
|
|
184
207
|
sort: '',
|
|
185
208
|
operator: AND,
|
|
186
|
-
searchFilter: {}
|
|
209
|
+
searchFilter: {},
|
|
210
|
+
itemListName: ''
|
|
187
211
|
};
|
|
188
212
|
export default ListFactory;
|
|
189
213
|
//# sourceMappingURL=ListFactory.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ListFactory.js","names":["React","useContext","useQuery","parseUrl","PropTypes","useRouter","MainContext","getSingleEntitySchema","generateSingleItemQuery","ListBuilder","AZ_LIST_TYPE","getAzQueryFilter","getSortProps","getGenericProps","getRequiredSchemas","checkForError","getUnpublishedEntityName","getPaginationIndex","getSearchFilterType","getElasticsearchOperator","buildSearchValuesText","getQueryFilters","getInheritedFilters","getQueryProps","useGetEntitySchemasAsObj","AND_OPERATOR","TEXT_SEARCH","ID","AND","FULL","ListFactory","props","entity","parent","name","filterByProperty","filterBy","omitWrappers","type","sortby","defaultSortBy","sort","defaultSort","searchFilter","operator","filterOperator","sortProperties","isPreview","router","asPath","parsedQuery","replace","query","url","querySort","querySortBy","sortbyFilters","updatedSortProperties","itemEntity","itemId","itemEntityUpdated","paginationIndex","azFilter","data","entitySchema","error","schemaError","loading","schemaLoading","variables","id","mainSchemas","schemasLoading","schemasError","currentSchema","filterEntitySchema","requiredSchema","requiredSchemaLoading","requiredSchemaError","inheritedFilters","queryProps","actions","getAction","get","getPublished","entityData","itemQueryError","itemQueryLoading","skip","length","errorsToCheck","hasErr","errMsg","isCard","isAZ","genericProps","textFilter","shouldApplyTextFilter","propsToDisplay","valuesText","valuesAnd","valuesOr","isTextSearchFilterApplied","search_term","searchValues","searchValuesText","searchValuesCheckboxSelectRange","searchValuesCheckboxOr","listProps","propTypes","object","isRequired","string","array","bool","defaultProps"],"sources":["../../../src/components/List/ListFactory.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport { parseUrl } from 'query-string';\nimport PropTypes from 'prop-types';\nimport { useRouter } from 'next/router';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport { getSingleEntitySchema, generateSingleItemQuery } from '../../application/query';\nimport ListBuilder from './ListBuilder';\nimport { AZ_LIST_TYPE } from './constants';\nimport { getAzQueryFilter, getSortProps } from './helpers';\nimport {\n getGenericProps,\n getRequiredSchemas,\n checkForError,\n getUnpublishedEntityName,\n getPaginationIndex,\n getSearchFilterType,\n getElasticsearchOperator,\n buildSearchValuesText,\n getQueryFilters,\n getInheritedFilters,\n getQueryProps\n} from '../../helpers';\nimport { useGetEntitySchemasAsObj } from '../../hooks';\nimport { AND_OPERATOR, TEXT_SEARCH, ID, AND, FULL } from '../../constants';\n\nconst ListFactory = props => {\n const {\n entity,\n parent,\n name,\n filterByProperty,\n filterBy,\n omitWrappers,\n type,\n sortby: defaultSortBy,\n sort: defaultSort,\n searchFilter,\n operator: filterOperator,\n sortProperties\n } = props;\n\n const { isPreview } = useContext(MainContext);\n const router = useRouter();\n const { asPath } = router;\n const parsedQuery = asPath.replace(/%5D/g, ']').replace(/%5B/g, '[');\n const { query, url, query: { sort: querySort, sortby: querySortBy } = {} } = parseUrl(\n parsedQuery\n );\n const { sortbyFilters, updatedSortProperties } = getSortProps({\n querySort,\n sortProperties,\n defaultSort,\n querySortBy,\n defaultSortBy\n });\n\n const { itemEntity, itemId } = parent;\n const itemEntityUpdated = getUnpublishedEntityName(itemEntity);\n const paginationIndex = getPaginationIndex(query, name);\n const azFilter = getAzQueryFilter(query, name);\n\n const { data: entitySchema, error: schemaError, loading: schemaLoading } = useQuery(\n getSingleEntitySchema,\n {\n variables: { id: entity }\n }\n );\n const {\n data: mainSchemas = {},\n loading: schemasLoading,\n error: schemasError\n } = useGetEntitySchemasAsObj([itemEntityUpdated, entity]);\n\n const {\n [itemEntityUpdated]: currentSchema = {},\n [entity]: filterEntitySchema = {}\n } = mainSchemas;\n\n const {\n data: requiredSchema = {},\n loading: requiredSchemaLoading,\n error: requiredSchemaError\n } = useGetEntitySchemasAsObj(\n getRequiredSchemas([...filterByProperty, ...sortbyFilters], filterEntitySchema),\n schemasLoading\n );\n const inheritedFilters = getInheritedFilters(filterBy, filterByProperty);\n const queryProps = getQueryProps(inheritedFilters, currentSchema, filterEntitySchema);\n const { actions = {} } = currentSchema || {};\n const getAction = isPreview ? actions.get : actions.getPublished;\n\n const {\n data: { entityData = {} } = {},\n error: itemQueryError,\n loading: itemQueryLoading\n } = useQuery(generateSingleItemQuery(getAction, queryProps), {\n variables: { id: itemId },\n skip: schemasLoading || (!inheritedFilters.length && queryProps === ID)\n });\n const errorsToCheck = [schemaError, schemasError, requiredSchemaError, itemQueryError];\n const { hasErr, errMsg } = checkForError(errorsToCheck);\n\n if (requiredSchemaLoading || schemasLoading || schemaLoading || itemQueryLoading) return '';\n if (hasErr) return errMsg;\n if (!entitySchema) return null;\n\n const isCard = type !== FULL;\n const isAZ = type === AZ_LIST_TYPE;\n const genericProps = getGenericProps(props);\n const [textFilter] = getSearchFilterType(searchFilter, TEXT_SEARCH);\n const shouldApplyTextFilter = textFilter && textFilter.propsToDisplay.length;\n const operator = shouldApplyTextFilter ? getElasticsearchOperator(textFilter) : AND_OPERATOR;\n const valuesText = shouldApplyTextFilter ? buildSearchValuesText(textFilter, query) : [];\n const { valuesAnd, valuesOr } = getQueryFilters(searchFilter, query);\n const isTextSearchFilterApplied = !!(\n query.search_term &&\n searchFilter &&\n getSearchFilterType(searchFilter, TEXT_SEARCH).length\n );\n\n const searchValues = {\n searchValuesText: valuesText,\n searchValuesCheckboxSelectRange: valuesAnd,\n searchValuesCheckboxOr: valuesOr\n };\n const listProps = {\n ...props,\n ...genericProps,\n query,\n url,\n isCard,\n isAZ,\n router,\n entitySchema,\n sort: null,\n sortby: null,\n sortProperties: updatedSortProperties,\n azFilter,\n searchValues,\n filterEntitySchema,\n requiredSchema,\n currentSchema,\n omitWrappers,\n operator,\n isTextSearchFilterApplied,\n paginationIndex,\n entityData,\n inheritedFilters,\n filterOperator\n };\n\n return <ListBuilder {...listProps} />;\n};\n\nListFactory.propTypes = {\n parent: PropTypes.object.isRequired,\n entity: PropTypes.string.isRequired,\n type: PropTypes.string.isRequired,\n filterBy: PropTypes.array,\n filterByProperty: PropTypes.array,\n omitWrappers: PropTypes.bool,\n operator: PropTypes.string,\n name: PropTypes.string,\n sortby: PropTypes.array,\n sort: PropTypes.string,\n searchFilter: PropTypes.object,\n sortProperties: PropTypes.array\n};\n\nListFactory.defaultProps = {\n filterBy: [],\n filterByProperty: [],\n omitWrappers: false,\n name: '',\n sortby: [],\n sortProperties: [],\n sort: '',\n operator: AND,\n searchFilter: {}\n};\n\nexport default ListFactory;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,QAAkC,OAAlC;AACA,SAASC,QAAT,QAAyB,gBAAzB;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,WAAT,QAA4B,8BAA5B;AACA,SAASC,qBAAT,EAAgCC,uBAAhC,QAA+D,yBAA/D;AACA,OAAOC,WAAP,MAAwB,eAAxB;AACA,SAASC,YAAT,QAA6B,aAA7B;AACA,SAASC,gBAAT,EAA2BC,YAA3B,QAA+C,WAA/C;AACA,SACEC,eADF,EAEEC,kBAFF,EAGEC,aAHF,EAIEC,wBAJF,EAKEC,kBALF,EAMEC,mBANF,EAOEC,wBAPF,EAQEC,qBARF,EASEC,eATF,EAUEC,mBAVF,EAWEC,aAXF,QAYO,eAZP;AAaA,SAASC,wBAAT,QAAyC,aAAzC;AACA,SAASC,YAAT,EAAuBC,WAAvB,EAAoCC,EAApC,EAAwCC,GAAxC,EAA6CC,IAA7C,QAAyD,iBAAzD;;AAEA,MAAMC,WAAW,GAAGC,KAAK,IAAI;EAC3B,MAAM;IACJC,MADI;IAEJC,MAFI;IAGJC,IAHI;IAIJC,gBAJI;IAKJC,QALI;IAMJC,YANI;IAOJC,IAPI;IAQJC,MAAM,EAAEC,aARJ;IASJC,IAAI,EAAEC,WATF;IAUJC,YAVI;IAWJC,QAAQ,EAAEC,cAXN;IAYJC;EAZI,IAaFf,KAbJ;EAeA,MAAM;IAAEgB;EAAF,IAAgB9C,UAAU,CAACK,WAAD,CAAhC;EACA,MAAM0C,MAAM,GAAG3C,SAAS,EAAxB;EACA,MAA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Ba;IAsBbN,gBAtBa;IAuBblC;EAvBa,EAAf;;EA0BA,oBAAO,oBAAC,WAAD,EAAiB+D,SAAjB,CAAP;AACD,CA/HD;;AAiIA9E,WAAW,CAAC+E,SAAZ,GAAwB;EACtB5E,MAAM,EAAE7B,SAAS,CAAC0G,MAAV,CAAiBC,UADH;EAEtB/E,MAAM,EAAE5B,SAAS,CAAC4G,MAAV,CAAiBD,UAFH;EAGtBzE,IAAI,EAAElC,SAAS,CAAC4G,MAAV,CAAiBD,UAHD;EAItB3E,QAAQ,EAAEhC,SAAS,CAAC6G,KAJE;EAKtB9E,gBAAgB,EAAE/B,SAAS,CAAC6G,KALN;EAMtB5E,YAAY,EAAEjC,SAAS,CAAC8G,IANF;EAOtBtE,QAAQ,EAAExC,SAAS,CAAC4G,MAPE;EAQtB9E,IAAI,EAAE9B,SAAS,CAAC4G,MARM;EAStBzE,MAAM,EAAEnC,SAAS,CAAC6G,KATI;EAUtBxE,IAAI,EAAErC,SAAS,CAAC4G,MAVM;EAWtBrE,YAAY,EAAEvC,SAAS,CAAC0G,MAXF;EAYtBhE,cAAc,EAAE1C,SAAS,CAAC6G;AAZJ,CAAxB;AAeAnF,WAAW,CAACqF,YAAZ,GAA2B;EACzB/E,QAAQ,EAAE,EADe;EAEzBD,gBAAgB,EAAE,EAFO;EAGzBE,YAAY,EAAE,KAHW;EAIzBH,IAAI,EAAE,EAJmB;EAKzBK,MAAM,EAAE,EALiB;EAMzBO,cAAc,EAAE,EANS;EAOzBL,IAAI,EAAE,EAPmB;EAQzBG,QAAQ,EAAEhB,GARe;EASzBe,YAAY,EAAE;AATW,CAA3B;AAYA,eAAeb,WAAf"}
|
|
1
|
+
{"version":3,"file":"ListFactory.js","names":["React","useContext","useQuery","parseUrl","PropTypes","useRouter","MainContext","getSingleEntitySchema","generateSingleItemQuery","getItemList","ListBuilder","AZ_LIST_TYPE","getAzQueryFilter","getSortProps","hasRequiredItemListDetails","getGenericProps","getRequiredSchemas","checkForError","getUnpublishedEntityName","getPaginationIndex","getSearchFilterType","getElasticsearchOperator","buildSearchValuesText","getQueryFilters","getInheritedFilters","getQueryProps","getItemListId","getItemListIds","useGetEntitySchemasAsObj","AND_OPERATOR","TEXT_SEARCH","ID","AND","FULL","ListFactory","props","entity","parent","name","filterByProperty","filterBy","omitWrappers","type","sortby","defaultSortBy","sort","defaultSort","searchFilter","operator","filterOperator","sortProperties","itemListName","isPreview","router","asPath","parsedQuery","replace","query","url","querySort","querySortBy","itemListId","queryItemListId","sortbyFilters","updatedSortProperties","itemEntity","itemId","itemEntityUpdated","paginationIndex","azFilter","data","entitySchema","error","schemaError","loading","schemaLoading","variables","id","mainSchemas","schemasLoading","schemasError","currentSchema","filterEntitySchema","requiredSchema","requiredSchemaLoading","requiredSchemaError","inheritedFilters","queryProps","actions","getAction","get","getPublished","entityData","itemQueryError","itemQueryLoading","skip","length","itemListData","itemListError","itemListLoading","errorsToCheck","hasErr","errMsg","itemListIds","isCard","isAZ","genericProps","textFilter","shouldApplyTextFilter","propsToDisplay","valuesText","valuesAnd","valuesOr","isTextSearchFilterApplied","search_term","searchValues","searchValuesText","searchValuesCheckboxSelectRange","searchValuesCheckboxOr","listProps","propTypes","object","isRequired","string","array","bool","defaultProps"],"sources":["../../../src/components/List/ListFactory.js"],"sourcesContent":["import React, { useContext } from 'react';\nimport { useQuery } from '@apollo/client';\nimport { parseUrl } from 'query-string';\nimport PropTypes from 'prop-types';\nimport { useRouter } from 'next/router';\nimport { MainContext } from '@blaze-cms/nextjs-components';\nimport {\n getSingleEntitySchema,\n generateSingleItemQuery,\n getItemList\n} from '../../application/query';\nimport ListBuilder from './ListBuilder';\nimport { AZ_LIST_TYPE } from './constants';\nimport { getAzQueryFilter, getSortProps, hasRequiredItemListDetails } from './helpers';\nimport {\n getGenericProps,\n getRequiredSchemas,\n checkForError,\n getUnpublishedEntityName,\n getPaginationIndex,\n getSearchFilterType,\n getElasticsearchOperator,\n buildSearchValuesText,\n getQueryFilters,\n getInheritedFilters,\n getQueryProps\n} from '../../helpers';\nimport { getItemListId, getItemListIds } from '../ItemList/helpers';\nimport { useGetEntitySchemasAsObj } from '../../hooks';\nimport { AND_OPERATOR, TEXT_SEARCH, ID, AND, FULL } from '../../constants';\n\nconst ListFactory = props => {\n const {\n entity,\n parent,\n name,\n filterByProperty,\n filterBy,\n omitWrappers,\n type,\n sortby: defaultSortBy,\n sort: defaultSort,\n searchFilter,\n operator: filterOperator,\n sortProperties,\n itemListName\n } = props;\n const { isPreview } = useContext(MainContext);\n const router = useRouter();\n const { asPath } = router;\n const parsedQuery = asPath.replace(/%5D/g, ']').replace(/%5B/g, '[');\n const {\n query,\n url,\n query: { sort: querySort, sortby: querySortBy, itemListId: queryItemListId } = {}\n } = parseUrl(parsedQuery);\n const { sortbyFilters, updatedSortProperties } = getSortProps({\n querySort,\n sortProperties,\n defaultSort,\n querySortBy,\n defaultSortBy\n });\n\n const itemListId = getItemListId(itemListName, queryItemListId);\n const { itemEntity, itemId } = parent;\n const itemEntityUpdated = getUnpublishedEntityName(itemEntity);\n const paginationIndex = getPaginationIndex(query, name);\n const azFilter = getAzQueryFilter(query, name);\n\n const { data: entitySchema, error: schemaError, loading: schemaLoading } = useQuery(\n getSingleEntitySchema,\n {\n variables: { id: entity }\n }\n );\n const {\n data: mainSchemas = {},\n loading: schemasLoading,\n error: schemasError\n } = useGetEntitySchemasAsObj([itemEntityUpdated, entity]);\n\n const {\n [itemEntityUpdated]: currentSchema = {},\n [entity]: filterEntitySchema = {}\n } = mainSchemas;\n\n const {\n data: requiredSchema = {},\n loading: requiredSchemaLoading,\n error: requiredSchemaError\n } = useGetEntitySchemasAsObj(\n getRequiredSchemas([...filterByProperty, ...sortbyFilters], filterEntitySchema),\n schemasLoading\n );\n const inheritedFilters = getInheritedFilters(filterBy, filterByProperty);\n const queryProps = getQueryProps(inheritedFilters, currentSchema, filterEntitySchema);\n const { actions = {} } = currentSchema || {};\n const getAction = isPreview ? actions.get : actions.getPublished;\n\n const {\n data: { entityData = {} } = {},\n error: itemQueryError,\n loading: itemQueryLoading\n } = useQuery(generateSingleItemQuery(getAction, queryProps), {\n variables: { id: itemId },\n skip: schemasLoading || (!inheritedFilters.length && queryProps === ID)\n });\n\n const { data: itemListData = {}, error: itemListError, loading: itemListLoading } = useQuery(\n getItemList,\n {\n variables: { id: itemListId },\n skip: !itemListId\n }\n );\n\n if (!hasRequiredItemListDetails({ itemListName, router, itemListId, queryItemListId })) return '';\n\n const errorsToCheck = [\n schemaError,\n schemasError,\n requiredSchemaError,\n itemQueryError,\n itemListError\n ];\n const { hasErr, errMsg } = checkForError(errorsToCheck);\n\n if (\n requiredSchemaLoading ||\n schemasLoading ||\n schemaLoading ||\n itemQueryLoading ||\n itemListLoading\n )\n return '';\n if (hasErr) return errMsg;\n if (!entitySchema) return null;\n\n const itemListIds = getItemListIds(itemListData);\n const isCard = type !== FULL;\n const isAZ = type === AZ_LIST_TYPE;\n const genericProps = getGenericProps(props);\n const [textFilter] = getSearchFilterType(searchFilter, TEXT_SEARCH);\n const shouldApplyTextFilter = textFilter && textFilter.propsToDisplay.length;\n const operator = shouldApplyTextFilter ? getElasticsearchOperator(textFilter) : AND_OPERATOR;\n const valuesText = shouldApplyTextFilter ? buildSearchValuesText(textFilter, query) : [];\n const { valuesAnd, valuesOr } = getQueryFilters(searchFilter, query);\n const isTextSearchFilterApplied = !!(\n query.search_term &&\n searchFilter &&\n getSearchFilterType(searchFilter, TEXT_SEARCH).length\n );\n\n const searchValues = {\n searchValuesText: valuesText,\n searchValuesCheckboxSelectRange: valuesAnd,\n searchValuesCheckboxOr: valuesOr\n };\n const listProps = {\n ...props,\n ...genericProps,\n query,\n url,\n isCard,\n isAZ,\n router,\n entitySchema,\n sort: null,\n sortby: null,\n sortProperties: updatedSortProperties,\n azFilter,\n searchValues,\n filterEntitySchema,\n requiredSchema,\n currentSchema,\n omitWrappers,\n operator,\n isTextSearchFilterApplied,\n paginationIndex,\n entityData,\n inheritedFilters,\n filterOperator,\n itemListIds\n };\n\n return <ListBuilder {...listProps} />;\n};\n\nListFactory.propTypes = {\n parent: PropTypes.object.isRequired,\n entity: PropTypes.string.isRequired,\n type: PropTypes.string.isRequired,\n filterBy: PropTypes.array,\n filterByProperty: PropTypes.array,\n omitWrappers: PropTypes.bool,\n operator: PropTypes.string,\n name: PropTypes.string,\n sortby: PropTypes.array,\n sort: PropTypes.string,\n searchFilter: PropTypes.object,\n sortProperties: PropTypes.array,\n itemListName: PropTypes.string\n};\n\nListFactory.defaultProps = {\n filterBy: [],\n filterByProperty: [],\n omitWrappers: false,\n name: '',\n sortby: [],\n sortProperties: [],\n sort: '',\n operator: AND,\n searchFilter: {},\n itemListName: ''\n};\n\nexport default ListFactory;\n"],"mappings":";;;;;;AAAA,OAAOA,KAAP,IAAgBC,UAAhB,QAAkC,OAAlC;AACA,SAASC,QAAT,QAAyB,gBAAzB;AACA,SAASC,QAAT,QAAyB,cAAzB;AACA,OAAOC,SAAP,MAAsB,YAAtB;AACA,SAASC,SAAT,QAA0B,aAA1B;AACA,SAASC,WAAT,QAA4B,8BAA5B;AACA,SACEC,qBADF,EAEEC,uBAFF,EAGEC,WAHF,QAIO,yBAJP;AAKA,OAAOC,WAAP,MAAwB,eAAxB;AACA,SAASC,YAAT,QAA6B,aAA7B;AACA,SAASC,gBAAT,EAA2BC,YAA3B,EAAyCC,0BAAzC,QAA2E,WAA3E;AACA,SACEC,eADF,EAEEC,kBAFF,EAGEC,aAHF,EAIEC,wBAJF,EAKEC,kBALF,EAMEC,mBANF,EAOEC,wBAPF,EAQEC,qBARF,EASEC,eATF,EAUEC,mBAVF,EAWEC,aAXF,QAYO,eAZP;AAaA,SAASC,aAAT,EAAwBC,cAAxB,QAA8C,qBAA9C;AACA,SAASC,wBAAT,QAAyC,aAAzC;AACA,SAASC,YAAT,EAAuBC,WAAvB,EAAoCC,EAApC,EAAwCC,GAAxC,EAA6CC,IAA7C,QAAyD,iBAAzD;;AAEA,MAAMC,WAAW,GAAGC,KAAK,IA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BD,UAHD;EAItBlF,QAAQ,EAAEpC,SAAS,CAACwH,KAJE;EAKtBrF,gBAAgB,EAAEnC,SAAS,CAACwH,KALN;EAMtBnF,YAAY,EAAErC,SAAS,CAACyH,IANF;EAOtB7E,QAAQ,EAAE5C,SAAS,CAACuH,MAPE;EAQtBrF,IAAI,EAAElC,SAAS,CAACuH,MARM;EAStBhF,MAAM,EAAEvC,SAAS,CAACwH,KATI;EAUtB/E,IAAI,EAAEzC,SAAS,CAACuH,MAVM;EAWtB5E,YAAY,EAAE3C,SAAS,CAACqH,MAXF;EAYtBvE,cAAc,EAAE9C,SAAS,CAACwH,KAZJ;EAatBzE,YAAY,EAAE/C,SAAS,CAACuH;AAbF,CAAxB;AAgBAzF,WAAW,CAAC4F,YAAZ,GAA2B;EACzBtF,QAAQ,EAAE,EADe;EAEzBD,gBAAgB,EAAE,EAFO;EAGzBE,YAAY,EAAE,KAHW;EAIzBH,IAAI,EAAE,EAJmB;EAKzBK,MAAM,EAAE,EALiB;EAMzBO,cAAc,EAAE,EANS;EAOzBL,IAAI,EAAE,EAPmB;EAQzBG,QAAQ,EAAEhB,GARe;EASzBe,YAAY,EAAE,EATW;EAUzBI,YAAY,EAAE;AAVW,CAA3B;AAaA,eAAejB,WAAf"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { setParamAndRedirect } from '../../ItemList/helpers';
|
|
2
|
+
|
|
3
|
+
const hasRequiredItemListDetails = ({
|
|
4
|
+
itemListName,
|
|
5
|
+
router,
|
|
6
|
+
itemListId,
|
|
7
|
+
queryItemListId
|
|
8
|
+
}) => {
|
|
9
|
+
if (!itemListName) return true;
|
|
10
|
+
|
|
11
|
+
if (!queryItemListId && itemListId) {
|
|
12
|
+
setParamAndRedirect(router, itemListId);
|
|
13
|
+
return false;
|
|
14
|
+
}
|
|
15
|
+
|
|
16
|
+
return !!queryItemListId;
|
|
17
|
+
};
|
|
18
|
+
|
|
19
|
+
export default hasRequiredItemListDetails;
|
|
20
|
+
//# sourceMappingURL=has-required-item-list-details.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"has-required-item-list-details.js","names":["setParamAndRedirect","hasRequiredItemListDetails","itemListName","router","itemListId","queryItemListId"],"sources":["../../../../src/components/List/helpers/has-required-item-list-details.js"],"sourcesContent":["import { setParamAndRedirect } from '../../ItemList/helpers';\n\nconst hasRequiredItemListDetails = ({ itemListName, router, itemListId, queryItemListId }) => {\n if (!itemListName) return true;\n\n if (!queryItemListId && itemListId) {\n setParamAndRedirect(router, itemListId);\n return false;\n }\n\n return !!queryItemListId;\n};\n\nexport default hasRequiredItemListDetails;\n"],"mappings":"AAAA,SAASA,mBAAT,QAAoC,wBAApC;;AAEA,MAAMC,0BAA0B,GAAG,CAAC;EAAEC,YAAF;EAAgBC,MAAhB;EAAwBC,UAAxB;EAAoCC;AAApC,CAAD,KAA2D;EAC5F,IAAI,CAACH,YAAL,EAAmB,OAAO,IAAP;;EAEnB,IAAI,CAACG,eAAD,IAAoBD,UAAxB,EAAoC;IAClCJ,mBAAmB,CAACG,MAAD,EAASC,UAAT,CAAnB;IACA,OAAO,KAAP;EACD;;EAED,OAAO,CAAC,CAACC,eAAT;AACD,CATD;;AAWA,eAAeJ,0BAAf"}
|