@sentecacommerce-theme/lib 0.13.5-alpha.9 → 0.13.5
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/LICENSE.md +11 -0
- package/dist/cjs/GDPR/api/index.js +3 -6
- package/dist/cjs/GDPR/api/queries/index.js +3 -6
- package/dist/cjs/GDPR/api/queries/useConfirmConsentQuery.js +1 -2
- package/dist/cjs/GDPR/api/ssr/index.js +2 -4
- package/dist/cjs/GDPR/components/CookiesTable.js +2 -4
- package/dist/cjs/GDPR/components/index.js +2 -4
- package/dist/cjs/GDPR/hooks/index.js +3 -6
- package/dist/cjs/GDPR/hooks/useCookies.js +37 -37
- package/dist/cjs/GDPR/index.js +3 -6
- package/dist/cjs/analytics/Pixel/hooks/index.js +39 -6
- package/dist/cjs/analytics/Pixel/hooks/usePixelFinishOrder.js +27 -0
- package/dist/cjs/analytics/Pixel/hooks/usePixelProductClick.js +3 -8
- package/dist/cjs/analytics/Pixel/hooks/usePixelProductDetails.js +20 -5
- package/dist/cjs/analytics/Pixel/hooks/usePixelProductsImpression.js +61 -35
- package/dist/cjs/analytics/Pixel/hooks/usePixelViewBasket.js +24 -0
- package/dist/cjs/analytics/Pixel/hooks/usePixelViewCategory.js +29 -0
- package/dist/cjs/analytics/Pixel/index.js +3 -6
- package/dist/cjs/analytics/Pixel/mainScript.js +258 -99
- package/dist/cjs/analytics/Pixel/minifiedPixel.js +1 -1
- package/dist/cjs/analytics/Pixel/usePixel.js +7 -2
- package/dist/cjs/analytics/Pixel/utils.js +17 -0
- package/dist/cjs/analytics/Releva/api/index.js +2 -4
- package/dist/cjs/analytics/Releva/api/query/index.js +2 -4
- package/dist/cjs/analytics/Releva/api/query/useRelevaQuery.js +1 -0
- package/dist/cjs/analytics/Releva/hooks/index.js +3 -6
- package/dist/cjs/analytics/Releva/hooks/useRelevaData.js +20 -6
- package/dist/cjs/analytics/Releva/index.js +3 -6
- package/dist/cjs/analytics/Releva/types.js +23 -25
- package/dist/cjs/analytics/Releva/useReleva.js +21 -7
- package/dist/cjs/analytics/Releva/utils.js +2 -4
- package/dist/cjs/analytics/addToCart.js +0 -1
- package/dist/cjs/analytics/initiateCheckout.js +0 -1
- package/dist/cjs/analytics/viewContent.js +2 -2
- package/dist/cjs/api/addressesApi/index.js +10 -11
- package/dist/cjs/api/brandsApi/index.js +38 -33
- package/dist/cjs/api/catalogApi/index.js +157 -160
- package/dist/cjs/api/categoriesApi/index.js +38 -33
- package/dist/cjs/api/citiesApi/index.js +24 -19
- package/dist/cjs/api/companiesApi/index.js +12 -15
- package/dist/cjs/api/consentsApi/index.js +3 -6
- package/dist/cjs/api/getSDKConfig.js +14 -23
- package/dist/cjs/api/myCartApi/index.js +177 -136
- package/dist/cjs/api/myOrdersApi/index.js +56 -15
- package/dist/cjs/api/myPaymentsBoricaApi/index.js +23 -18
- package/dist/cjs/api/myShippingsEcontApi/index.js +150 -125
- package/dist/cjs/api/myShippingsEvropatApi/index.js +60 -50
- package/dist/cjs/api/myShippingsPickupFromStoreAPI/index.js +7 -7
- package/dist/cjs/api/myShippingsSpeedyApi/index.js +150 -125
- package/dist/cjs/api/notificationsApi/index.js +5 -5
- package/dist/cjs/api/pagesApi/index.js +4 -4
- package/dist/cjs/api/productsApi/index.js +49 -46
- package/dist/cjs/api/searchHistoryApi/index.js +36 -26
- package/dist/cjs/api/usersApi/index.js +2 -3
- package/dist/cjs/api/viewsApi/index.js +37 -32
- package/dist/cjs/api/vouchersApi/index.js +4 -4
- package/dist/cjs/api/walletApi/index.js +3 -6
- package/dist/cjs/api/wishlistApi/index.js +17 -13
- package/dist/cjs/api/wishlistApi/utils/index.js +2 -4
- package/dist/cjs/api.v2/core/checkout/index.js +3 -6
- package/dist/cjs/api.v2/core/checkout/payments/index.js +3 -6
- package/dist/cjs/api.v2/core/checkout/payments/useSetMerchantPaymentMethod.js +1 -1
- package/dist/cjs/api.v2/core/checkout/payments/useSetPaymentMethod.js +19 -4
- package/dist/cjs/api.v2/core/checkout/shippings/index.js +3 -6
- package/dist/cjs/api.v2/core/checkout/shippings/mutations/index.js +2 -4
- package/dist/cjs/api.v2/core/checkout/shippings/mutations/useMutateNomenclature.js +19 -14
- package/dist/cjs/api.v2/core/checkout/shippings/queries/index.js +3 -6
- package/dist/cjs/api.v2/core/checkout/shippings/queries/useFindNomenclatureElement.js +67 -56
- package/dist/cjs/api.v2/core/checkout/types.js +6 -8
- package/dist/cjs/api.v2/core/index.js +3 -6
- package/dist/cjs/api.v2/core/misc/index.js +3 -6
- package/dist/cjs/api.v2/core/misc/promo-code/index.js +3 -6
- package/dist/cjs/api.v2/core/misc/promo-code/mutations/usePromoCodeMutation.js +22 -17
- package/dist/cjs/api.v2/core/product/index.js +2 -4
- package/dist/cjs/api.v2/core/product/useSubscribeForSkuMutation.js +19 -4
- package/dist/cjs/api.v2/index.js +2 -4
- package/dist/cjs/basket/api/index.js +2 -4
- package/dist/cjs/basket/api/mutations/index.js +16 -4
- package/dist/cjs/basket/api/mutations/useChangeGiftVariant.js +116 -0
- package/dist/cjs/basket/api/mutations/useReplaceBasketMutation.js +17 -13
- package/dist/cjs/basket/hooks/index.js +15 -6
- package/dist/cjs/basket/hooks/useBasketCrossSaleItems.js +2 -4
- package/dist/cjs/basket/hooks/useChangeGiftVariant.js +16 -0
- package/dist/cjs/basket/index.js +2 -4
- package/dist/cjs/brands/api/index.js +3 -6
- package/dist/cjs/brands/api/queries/index.js +3 -6
- package/dist/cjs/brands/api/queries/keys.js +3 -4
- package/dist/cjs/brands/api/queries/useAllBrandsQuery.js +91 -76
- package/dist/cjs/brands/api/ssr/index.js +3 -6
- package/dist/cjs/brands/hooks/index.js +2 -4
- package/dist/cjs/brands/index.js +3 -6
- package/dist/cjs/build/api/index.js +2 -4
- package/dist/cjs/build/api/query/fetchStore.js +25 -20
- package/dist/cjs/build/api/query/index.js +2 -4
- package/dist/cjs/build/index.js +2 -4
- package/dist/cjs/checkout/api/index.js +3 -6
- package/dist/cjs/checkout/api/keys.js +9 -4
- package/dist/cjs/checkout/api/queries/index.js +15 -6
- package/dist/cjs/checkout/api/queries/useUniCreditCalculateForCartQuery.js +60 -0
- package/dist/cjs/checkout/contexts/BoricaResponseContext.js +3 -6
- package/dist/cjs/checkout/contexts/PaypalResponseContext.js +3 -6
- package/dist/cjs/checkout/contexts/UniCreditResponseContext.js +40 -0
- package/dist/cjs/checkout/contexts/index.js +15 -6
- package/dist/cjs/checkout/hooks/index.js +15 -6
- package/dist/cjs/checkout/hooks/useBnpCalculateForCart.js +9 -15
- package/dist/cjs/checkout/hooks/useUniCreditCalculateForCart.js +93 -0
- package/dist/cjs/checkout/index.js +3 -6
- package/dist/cjs/checkout/ssr/capturePaypalOrder.js +16 -11
- package/dist/cjs/checkout/ssr/captureUniCreditOrder.js +57 -0
- package/dist/cjs/checkout/ssr/index.js +15 -6
- package/dist/cjs/checkout/ssr/verifyBoricaResponse.js +24 -19
- package/dist/cjs/cms/api/index.js +3 -6
- package/dist/cjs/cms/api/mutations/index.js +3 -6
- package/dist/cjs/cms/api/mutations/useCMSFoldersCreateMutation.js +31 -29
- package/dist/cjs/cms/api/mutations/useCMSMediaDeleteAssetsMutation.js +19 -14
- package/dist/cjs/cms/api/mutations/useCMSMediaUploadAssetsMutation.js +21 -35
- package/dist/cjs/cms/api/queries/index.js +3 -6
- package/dist/cjs/cms/api/queries/keys.js +21 -14
- package/dist/cjs/cms/api/queries/useCMSContentListQuery.js +4 -7
- package/dist/cjs/cms/api/queries/useCMSMediaQuery.js +1 -2
- package/dist/cjs/cms/api/queries/useInjectedContentQuery.js +5 -7
- package/dist/cjs/cms/api/utils/index.js +2 -4
- package/dist/cjs/cms/components/RenderInjectedContent.js +5 -11
- package/dist/cjs/cms/components/index.js +2 -4
- package/dist/cjs/cms/hooks/index.js +3 -6
- package/dist/cjs/cms/hooks/useCmsContent.js +4 -8
- package/dist/cjs/cms/hooks/useCmsContentList.js +7 -12
- package/dist/cjs/cms/hooks/useCmsFolders.js +0 -6
- package/dist/cjs/cms/hooks/useCmsMedia.js +0 -6
- package/dist/cjs/cms/hooks/useCmsMediaDeleteAssets.js +0 -6
- package/dist/cjs/cms/hooks/useCmsMediaUploadAssets.js +0 -6
- package/dist/cjs/cms/hooks/useContentCategoriesMap.js +6 -13
- package/dist/cjs/cms/hooks/useCreateCmsFolders.js +0 -6
- package/dist/cjs/cms/hooks/useInjectedContentContext.js +6 -12
- package/dist/cjs/cms/hooks/useListingInjectedContent.js +1 -2
- package/dist/cjs/cms/index.js +3 -6
- package/dist/cjs/cms/ssr/fetchPagePaths.js +3 -3
- package/dist/cjs/cms/ssr/index.js +3 -6
- package/dist/cjs/cms/ssr/prefetchCMSPage.js +34 -29
- package/dist/cjs/cms/ssr/prefetchCmsContent.js +48 -43
- package/dist/cjs/cms/ssr/prefetchCmsContentList.js +52 -50
- package/dist/cjs/cms/utils/index.js +3 -6
- package/dist/cjs/components/AnalyticsScripts/index.js +24 -10
- package/dist/cjs/components/ClickOutside/index.js +2 -4
- package/dist/cjs/components/Drawer/index.js +6 -9
- package/dist/cjs/components/FadeIn/index.js +26 -15
- package/dist/cjs/components/FocusTrap/index.js +2 -4
- package/dist/cjs/components/GoogleOneTap/index.js +40 -22
- package/dist/cjs/components/Html/index.js +3 -5
- package/dist/cjs/components/LazyResponsiveImage/index.js +25 -16
- package/dist/cjs/components/Link/index.js +5 -10
- package/dist/cjs/components/Modal/index.js +2 -4
- package/dist/cjs/components/OverflowEllipsis/index.js +2 -4
- package/dist/cjs/components/Portal/index.js +1 -1
- package/dist/cjs/components/ProgressBar/index.js +21 -8
- package/dist/cjs/components/index.js +3 -6
- package/dist/cjs/config/SentecaProvider.js +7 -12
- package/dist/cjs/config/index.js +2 -4
- package/dist/cjs/contexts/CheckoutForm/Components/BoricaRedirect/index.js +21 -8
- package/dist/cjs/contexts/CheckoutForm/Components/CheckoutCustomState/index.js +24 -14
- package/dist/cjs/contexts/CheckoutForm/Components/UniCreditRedirect/index.js +87 -0
- package/dist/cjs/contexts/CheckoutForm/Components/index.js +15 -6
- package/dist/cjs/contexts/CheckoutForm/hooks/index.js +3 -6
- package/dist/cjs/contexts/CheckoutForm/hooks/useBilling/index.js +52 -31
- package/dist/cjs/contexts/CheckoutForm/hooks/usePayment/index.js +20 -6
- package/dist/cjs/contexts/CheckoutForm/hooks/useSavedBillingList/index.js +2 -4
- package/dist/cjs/contexts/CheckoutForm/hooks/useSavedShippingList/index.js +20 -15
- package/dist/cjs/contexts/CheckoutForm/hooks/useShipping/index.js +102 -90
- package/dist/cjs/contexts/CheckoutForm/hooks/useShippingInitialData/index.js +3 -7
- package/dist/cjs/contexts/CheckoutForm/index.js +105 -63
- package/dist/cjs/contexts/CheckoutForm/utils/index.js +3 -6
- package/dist/cjs/contexts/CheckoutForm/utils/updatedNestedObjectProps.js +16 -3
- package/dist/cjs/contexts/CheckoutForm/utils/validateBillingAddress.js +6 -14
- package/dist/cjs/contexts/CheckoutForm/utils/validateShipping.js +12 -23
- package/dist/cjs/contexts/CustomProductProvider/index.js +24 -14
- package/dist/cjs/contexts/Strings.js +34 -37
- package/dist/cjs/hooks/addresses-hooks/index.js +3 -6
- package/dist/cjs/hooks/addresses-hooks/useAddressForm/index.js +40 -52
- package/dist/cjs/hooks/basket-hooks/index.js +3 -6
- package/dist/cjs/hooks/basket-hooks/useBasket/index.js +19 -4
- package/dist/cjs/hooks/basket-hooks/useBasketCustom/index.js +19 -4
- package/dist/cjs/hooks/basket-hooks/useBasketItemList/index.js +5 -10
- package/dist/cjs/hooks/basket-hooks/useBasketItemWithErrorList/index.js +4 -8
- package/dist/cjs/hooks/basket-hooks/useBasketLineItem/index.js +19 -4
- package/dist/cjs/hooks/basket-hooks/useBasketLineItem/utils/index.js +4 -9
- package/dist/cjs/hooks/checkout-hooks/index.js +3 -6
- package/dist/cjs/hooks/checkout-hooks/useAllStockLocations.js +5 -10
- package/dist/cjs/hooks/checkout-hooks/useShippingCourierMethods.js +41 -36
- package/dist/cjs/hooks/cities-hooks/index.js +2 -4
- package/dist/cjs/hooks/cities-hooks/useCities/index.js +19 -4
- package/dist/cjs/hooks/companies-hooks/index.js +3 -6
- package/dist/cjs/hooks/error-handling/index.js +2 -4
- package/dist/cjs/hooks/error-handling/useErrors/index.js +4 -9
- package/dist/cjs/hooks/labels/index.js +3 -6
- package/dist/cjs/hooks/labels/useGlobalLabels/index.js +1 -2
- package/dist/cjs/hooks/order-hooks/api/hooks/index.js +2 -4
- package/dist/cjs/hooks/order-hooks/api/index.js +3 -6
- package/dist/cjs/hooks/order-hooks/api/mutations/index.js +2 -4
- package/dist/cjs/hooks/order-hooks/api/queries/index.js +2 -4
- package/dist/cjs/hooks/order-hooks/api/queries/useOrderGetPaymentMethodQuery.js +2 -4
- package/dist/cjs/hooks/order-hooks/index.js +3 -6
- package/dist/cjs/hooks/order-hooks/useGenericCourierAddress/index.js +103 -68
- package/dist/cjs/hooks/order-hooks/useOrder/index.js +3 -16
- package/dist/cjs/hooks/order-hooks/useOrderGetPaymentMethod/index.js +0 -6
- package/dist/cjs/hooks/order-hooks/useOrderPaymentMethods/index.js +2 -4
- package/dist/cjs/hooks/order-hooks/useOrdersList/index.js +2 -4
- package/dist/cjs/hooks/order-hooks/usePayOrder/index.js +66 -58
- package/dist/cjs/hooks/order-hooks/useUpdateOrderPaymentMethod/index.js +20 -7
- package/dist/cjs/hooks/profile-hooks/index.js +3 -6
- package/dist/cjs/hooks/subscriptions-hooks/index.js +3 -6
- package/dist/cjs/hooks/subscriptions-hooks/useAcceptOnRegister/index.js +21 -8
- package/dist/cjs/hooks/subscriptions-hooks/useAllSubscriptions/index.js +32 -33
- package/dist/cjs/hooks/subscriptions-hooks/useSubscribeForProduct/index.js +20 -6
- package/dist/cjs/hooks/ui-hooks/index.js +3 -6
- package/dist/cjs/hooks/ui-hooks/useAccordion/index.js +19 -5
- package/dist/cjs/hooks/ui-hooks/useBoolean/index.js +21 -6
- package/dist/cjs/hooks/ui-hooks/useCallbackRef/index.js +21 -15
- package/dist/cjs/hooks/ui-hooks/useClickOutside/index.js +2 -2
- package/dist/cjs/hooks/ui-hooks/useIsDesktop/index.js +2 -2
- package/dist/cjs/hooks/ui-hooks/useIsIos/index.js +19 -4
- package/dist/cjs/hooks/ui-hooks/useMenuAim/index.js +19 -4
- package/dist/cjs/hooks/ui-hooks/useMergeRefs/index.js +2 -4
- package/dist/cjs/hooks/ui-hooks/usePagination/index.js +19 -14
- package/dist/cjs/hooks/ui-hooks/useScrollDirection/index.js +21 -7
- package/dist/cjs/hooks/ui-hooks/useScrollTo/index.js +23 -9
- package/dist/cjs/hooks/ui-hooks/useSlideshow/index.js +21 -6
- package/dist/cjs/hooks/ui-hooks/useToggleNavbarOnScroll/index.js +3 -3
- package/dist/cjs/hooks/ui-hooks/useUI/index.js +34 -35
- package/dist/cjs/hooks/ui-hooks/useWindowDimensions/index.js +19 -4
- package/dist/cjs/hooks/useAddressList/index.js +2 -3
- package/dist/cjs/hooks/useAggregateResult/index.js +7 -5
- package/dist/cjs/hooks/useAllSelectedFilters/index.js +3 -3
- package/dist/cjs/hooks/useAvailability/index.js +28 -14
- package/dist/cjs/hooks/useCarousel/component/index.js +12 -17
- package/dist/cjs/hooks/useCarousel/helpers/eventStore.js +2 -2
- package/dist/cjs/hooks/useCarousel/index.js +20 -6
- package/dist/cjs/hooks/useCatalogResult/index.js +2 -2
- package/dist/cjs/hooks/useCategoryTree/index.js +1 -2
- package/dist/cjs/hooks/useCheckoutBillingAddress/index.js +96 -7
- package/dist/cjs/hooks/useCheckoutDelivery/index.js +71 -58
- package/dist/cjs/hooks/useCheckoutDiscountCode/index.js +19 -4
- package/dist/cjs/hooks/useCheckoutPickupFromStore/index.js +21 -8
- package/dist/cjs/hooks/useCheckoutShippingAddress/index.js +19 -4
- package/dist/cjs/hooks/useCheckoutShippingModule/index.js +4 -6
- package/dist/cjs/hooks/useCheckoutSubmit/index.js +97 -58
- package/dist/cjs/hooks/useClearAllFilters/index.js +4 -4
- package/dist/cjs/hooks/useContactForm/index.js +8 -4
- package/dist/cjs/hooks/useCopyToClipboard/index.js +20 -4
- package/dist/cjs/hooks/useForceUpdate/index.js +19 -4
- package/dist/cjs/hooks/useLineItem/LineItemContext.js +86 -0
- package/dist/cjs/hooks/useLineItem/index.js +35 -26
- package/dist/cjs/hooks/useLocalRating/index.js +23 -10
- package/dist/cjs/hooks/usePrefetchProduct/index.js +19 -4
- package/dist/cjs/hooks/usePrice/index.js +1 -1
- package/dist/cjs/hooks/useProduct/index.js +18 -270
- package/dist/cjs/hooks/useProduct/utils/index.js +75 -57
- package/dist/cjs/hooks/useProductVariants/index.js +334 -0
- package/dist/cjs/hooks/useProductVariants/types.js +3 -0
- package/dist/cjs/hooks/useProgressBar/helpers/index.js +3 -6
- package/dist/cjs/hooks/useProgressBar/hooks/index.js +3 -6
- package/dist/cjs/hooks/useProgressBar/hooks/useGetSetState.js +5 -31
- package/dist/cjs/hooks/useProgressBar/hooks/useUpdate.js +21 -8
- package/dist/cjs/hooks/useProgressBar/index.js +23 -11
- package/dist/cjs/hooks/usePromoCode/index.js +20 -6
- package/dist/cjs/hooks/useSearchbar/index.js +109 -74
- package/dist/cjs/hooks/useSelectedFilters/index.js +3 -3
- package/dist/cjs/hooks/useShippingAddress/index.js +2 -4
- package/dist/cjs/hooks/useSizesReducer/index.js +24 -12
- package/dist/cjs/hooks/useVouchers/index.js +2 -3
- package/dist/cjs/hooks/useWallet/index.js +2 -4
- package/dist/cjs/hooks/useZoom/index.js +23 -10
- package/dist/cjs/hooks/user-hooks/index.js +3 -6
- package/dist/cjs/hooks/user-hooks/useSubscribeToNewsletter/index.js +49 -7
- package/dist/cjs/hooks/wishlist-hooks/index.js +3 -6
- package/dist/cjs/hooks/wishlist-hooks/useWishlist/index.js +19 -4
- package/dist/cjs/hooks/wishlist-hooks/useWishlistItem/index.js +59 -21
- package/dist/cjs/index.js +19 -34
- package/dist/cjs/listing/api/index.js +3 -6
- package/dist/cjs/listing/api/keys.js +4 -5
- package/dist/cjs/listing/api/queries/useAggregateQuery.js +14 -17
- package/dist/cjs/listing/api/queries/useInfiniteListing.js +6 -8
- package/dist/cjs/listing/api/queries/useLabelsQuery.js +19 -10
- package/dist/cjs/listing/api/queries/useListingQuery.js +43 -29
- package/dist/cjs/listing/api/queries/usePredicate.js +38 -26
- package/dist/cjs/listing/components/BasicListingSEO.js +24 -8
- package/dist/cjs/listing/components/index.js +2 -4
- package/dist/cjs/listing/hooks/index.js +3 -6
- package/dist/cjs/listing/hooks/useListingAlias.js +2 -4
- package/dist/cjs/listing/hooks/useListingBreadcrumbs.js +40 -21
- package/dist/cjs/listing/hooks/useListingCategories.js +27 -21
- package/dist/cjs/listing/hooks/useListingConfig.js +5 -9
- package/dist/cjs/listing/hooks/useListingFilters.js +51 -34
- package/dist/cjs/listing/hooks/useListingItems.js +2 -2
- package/dist/cjs/listing/hooks/useListingMeta.js +72 -52
- package/dist/cjs/listing/hooks/useListingPagination.js +6 -10
- package/dist/cjs/listing/hooks/useListingSlug.js +3 -1
- package/dist/cjs/listing/hooks/useSlideFilter.js +50 -11
- package/dist/cjs/listing/hooks/useSort.js +47 -19
- package/dist/cjs/listing/hooks/utils.js +2 -1
- package/dist/cjs/listing/index.js +3 -6
- package/dist/cjs/listing/ssr/index.js +3 -6
- package/dist/cjs/listing/ssr/prefetchCategories.js +6 -7
- package/dist/cjs/listing/ssr/prefetchListing.js +9 -9
- package/dist/cjs/listing/ssr/prefetchPredicate.js +4 -4
- package/dist/cjs/listing/types.js +15 -20
- package/dist/cjs/listing/utils/buildCategoryQuery.js +38 -20
- package/dist/cjs/listing/utils/buildFilterQuery.js +30 -27
- package/dist/cjs/listing/utils/calculateOffset.js +1 -1
- package/dist/cjs/listing/utils/extendFilter.js +19 -4
- package/dist/cjs/listing/utils/getListingAlias.js +24 -12
- package/dist/cjs/listing/utils/getListingPageType.js +4 -5
- package/dist/cjs/listing/utils/index.js +3 -6
- package/dist/cjs/navigation/components/SearchBox/Components/Container/index.js +1 -1
- package/dist/cjs/navigation/components/SearchBox/Components/EmptyBox/index.js +21 -20
- package/dist/cjs/navigation/components/SearchBox/Components/IconArrowRight/index.js +2 -4
- package/dist/cjs/navigation/components/SearchBox/Components/PopularSearches/index.js +1 -1
- package/dist/cjs/navigation/components/SearchBox/Components/Products/Components/ProductCard/index.js +2 -3
- package/dist/cjs/navigation/components/SearchBox/Components/Products/Components/index.js +2 -4
- package/dist/cjs/navigation/components/SearchBox/Components/Products/index.js +2 -2
- package/dist/cjs/navigation/components/SearchBox/Components/RecentSearches/index.js +1 -1
- package/dist/cjs/navigation/components/SearchBox/Components/Spinner/index.js +2 -4
- package/dist/cjs/navigation/components/SearchBox/Components/Suggestions/Components/index.js +2 -4
- package/dist/cjs/navigation/components/SearchBox/Components/Suggestions/Utils/ScrollView.js +4 -8
- package/dist/cjs/navigation/components/SearchBox/Components/Suggestions/Utils/index.js +3 -6
- package/dist/cjs/navigation/components/SearchBox/Components/index.js +3 -6
- package/dist/cjs/navigation/components/SearchBox/index.js +18 -21
- package/dist/cjs/navigation/components/index.js +2 -4
- package/dist/cjs/navigation/hooks/index.js +3 -6
- package/dist/cjs/navigation/hooks/search-history/index.js +3 -6
- package/dist/cjs/navigation/index.js +3 -6
- package/dist/cjs/navigation/keys.js +3 -4
- package/dist/cjs/navigation/mutations/index.js +2 -4
- package/dist/cjs/navigation/mutations/useSearchHistoryMutation.js +20 -16
- package/dist/cjs/navigation/queries/index.js +3 -6
- package/dist/cjs/navigation/ssr/index.js +2 -4
- package/dist/cjs/navigation/types.js +3 -4
- package/dist/cjs/order/api/index.js +15 -6
- package/dist/cjs/order/api/mutations/index.js +3 -6
- package/dist/cjs/order/api/queries/index.js +2 -4
- package/dist/cjs/order/api/queries/prefetchOrder.js +24 -19
- package/dist/cjs/{user/types/index.js → order/api/utils/getOrderById.js} +2 -2
- package/dist/cjs/order/api/utils/index.js +35 -0
- package/dist/cjs/order/hooks/index.js +3 -6
- package/dist/cjs/order/index.js +3 -6
- package/dist/cjs/postcss/index.js +3 -6
- package/dist/cjs/postcss/tailwind/buttons-plugin.js +20 -16
- package/dist/cjs/postcss/tailwind/default-plugin.js +2 -4
- package/dist/cjs/postcss/tailwind/fonts-plugin.js +21 -18
- package/dist/cjs/postcss/tailwind/forms-plugin.js +6 -9
- package/dist/cjs/postcss/tailwind/index.js +3 -6
- package/dist/cjs/postcss/tailwind/utils.js +4 -6
- package/dist/cjs/postcss/types.js +6 -8
- package/dist/cjs/product/api/index.js +2 -4
- package/dist/cjs/product/api/keys.js +8 -1
- package/dist/cjs/product/api/queries/index.js +16 -4
- package/dist/cjs/product/api/queries/useUniCreditOffersQuery.js +63 -0
- package/dist/cjs/product/api/ssr/index.js +44 -40
- package/dist/cjs/product/hooks/index.js +16 -4
- package/dist/cjs/product/hooks/useBnpOffers.js +5 -31
- package/dist/cjs/product/hooks/useUniCreditOffers.js +107 -0
- package/dist/cjs/product/index.js +3 -6
- package/dist/cjs/seo/api/index.js +2 -4
- package/dist/cjs/seo/api/ssr/fetchRedirectByFrom.js +19 -14
- package/dist/cjs/seo/api/ssr/fetchSitemaps.js +22 -17
- package/dist/cjs/seo/api/ssr/getCanonicalUrl.js +19 -4
- package/dist/cjs/seo/api/ssr/index.js +3 -6
- package/dist/cjs/seo/components/GlobalSEO/index.js +3 -3
- package/dist/cjs/seo/components/HiddenBreadcrumb/index.js +1 -2
- package/dist/cjs/seo/components/ProductSEO/index.js +3 -5
- package/dist/cjs/seo/components/TranslationsMeta/index.js +59 -0
- package/dist/cjs/seo/components/index.js +15 -6
- package/dist/cjs/seo/hooks/index.js +16 -4
- package/dist/cjs/seo/hooks/useSEOBreadcrumb.js +19 -13
- package/dist/cjs/seo/hooks/useSeoTranslations.js +90 -0
- package/dist/cjs/seo/index.js +3 -6
- package/dist/cjs/seo/utils/handleRobots.js +4 -4
- package/dist/cjs/seo/utils/index.js +3 -6
- package/dist/cjs/ssr/emptyBasketGuard.js +2 -2
- package/dist/cjs/ssr/index.js +3 -6
- package/dist/cjs/ui/components/GridStyles.js +36 -0
- package/dist/cjs/ui/components/LazyImage.js +6 -12
- package/dist/cjs/ui/components/RangeSliderInput.js +38 -15
- package/dist/cjs/ui/components/index.js +15 -6
- package/dist/cjs/ui/hooks/index.js +35 -0
- package/dist/cjs/ui/hooks/useToasts.js +165 -0
- package/dist/cjs/ui/index.js +16 -4
- package/dist/cjs/ui/toastUtils/ErrorIcon.js +25 -0
- package/dist/cjs/ui/toastUtils/InfoIcon.js +25 -0
- package/dist/cjs/ui/toastUtils/SuccessIcon.js +25 -0
- package/dist/cjs/ui/toastUtils/WarningIcon.js +25 -0
- package/dist/cjs/ui/toastUtils/index.js +85 -0
- package/dist/cjs/ui/toastUtils/utils.js +81 -0
- package/dist/cjs/user/api/index.js +3 -6
- package/dist/cjs/user/api/mutations/index.js +3 -6
- package/dist/cjs/user/api/mutations/useLoginMutation.js +2 -5
- package/dist/cjs/user/api/mutations/useLogoutMutation.js +3 -6
- package/dist/cjs/user/api/mutations/useRegisterMutation.js +24 -24
- package/dist/cjs/user/api/mutations/useRequestResetPasswordTokenMutation.js +1 -2
- package/dist/cjs/user/api/mutations/useResetPasswordMutation.js +1 -2
- package/dist/cjs/user/api/queries/index.js +3 -6
- package/dist/cjs/user/api/queries/useGetMyLoyaltyCardQuery.js +49 -3
- package/dist/cjs/user/api/queries/useIsAuthenticatedQuery.js +2 -4
- package/dist/cjs/user/api/utils/generateAnonymousToken.js +25 -21
- package/dist/cjs/user/api/utils/index.js +3 -6
- package/dist/cjs/user/api/utils/processLoginPayload.js +2 -2
- package/dist/cjs/user/hooks/index.js +3 -6
- package/dist/cjs/user/hooks/useConfirmEmail.js +20 -6
- package/dist/cjs/user/hooks/useLoginApple.js +2 -4
- package/dist/cjs/user/hooks/useLoginFacebook.js +2 -4
- package/dist/cjs/user/hooks/useLoginGoogle.js +2 -4
- package/dist/cjs/user/hooks/useRequestEmailConfirmation.js +20 -6
- package/dist/cjs/user/index.js +3 -18
- package/dist/cjs/utils/assetsToMap.js +3 -7
- package/dist/cjs/utils/createAggregateQuery.js +4 -6
- package/dist/cjs/utils/customFieldsToMap.js +3 -8
- package/dist/cjs/utils/generateQueryFromRouter.js +5 -12
- package/dist/cjs/utils/getLocaleFromPath.js +13 -0
- package/dist/cjs/utils/getPagination.js +5 -11
- package/dist/cjs/utils/getSelectedFilters.js +25 -11
- package/dist/cjs/utils/index.js +15 -6
- package/dist/cjs/utils/isColorBright.js +2 -2
- package/dist/cjs/utils/isTouchDevice.js +2 -1
- package/dist/cjs/utils/localStorage.js +7 -2
- package/dist/cjs/utils/queryObjToString.js +3 -7
- package/dist/cjs/utils/sortAncestors.js +18 -11
- package/dist/cjs/utils/tokens.js +19 -4
- package/dist/cjs/utils/validations.js +2 -2
- package/dist/cjs/webview/hooks/index.js +2 -4
- package/dist/cjs/webview/hooks/useIsInWebview.js +21 -6
- package/dist/cjs/webview/index.js +3 -6
- package/dist/cjs/webview/utils/index.js +3 -6
- package/dist/cjs/webview/utils/sendMessage.js +3 -4
- package/dist/cjs/wishlist/api/index.js +2 -4
- package/dist/cjs/wishlist/api/queries/index.js +3 -6
- package/dist/cjs/wishlist/api/queries/keys.js +3 -4
- package/dist/cjs/wishlist/api/queries/useWishlistItemsQuery.js +4 -7
- package/dist/cjs/wishlist/hooks/index.js +2 -4
- package/dist/cjs/wishlist/hooks/useWishlistItems.js +2 -3
- package/dist/cjs/wishlist/index.js +3 -6
- package/dist/esm/GDPR/api/queries/useConfirmConsentQuery.js +1 -2
- package/dist/esm/GDPR/components/CookiesTable.js +2 -4
- package/dist/esm/GDPR/hooks/useCookies.js +34 -33
- package/dist/esm/analytics/Pixel/hooks/index.js +3 -0
- package/dist/esm/analytics/Pixel/hooks/usePixelFinishOrder.js +22 -0
- package/dist/esm/analytics/Pixel/hooks/usePixelProductClick.js +4 -9
- package/dist/esm/analytics/Pixel/hooks/usePixelProductDetails.js +20 -5
- package/dist/esm/analytics/Pixel/hooks/usePixelProductsImpression.js +61 -35
- package/dist/esm/analytics/Pixel/hooks/usePixelViewBasket.js +19 -0
- package/dist/esm/analytics/Pixel/hooks/usePixelViewCategory.js +24 -0
- package/dist/esm/analytics/Pixel/mainScript.js +259 -99
- package/dist/esm/analytics/Pixel/minifiedPixel.js +1 -1
- package/dist/esm/analytics/Pixel/usePixel.js +7 -2
- package/dist/esm/analytics/Pixel/utils.js +12 -0
- package/dist/esm/analytics/Releva/api/query/useRelevaQuery.js +1 -0
- package/dist/esm/analytics/Releva/hooks/useRelevaData.js +20 -6
- package/dist/esm/analytics/Releva/types.js +21 -25
- package/dist/esm/analytics/Releva/useReleva.js +21 -7
- package/dist/esm/analytics/Releva/utils.js +2 -4
- package/dist/esm/analytics/addToCart.js +0 -1
- package/dist/esm/analytics/initiateCheckout.js +0 -1
- package/dist/esm/analytics/pageView.js +1 -1
- package/dist/esm/analytics/viewContent.js +2 -2
- package/dist/esm/api/addressesApi/index.js +10 -12
- package/dist/esm/api/brandsApi/index.js +37 -33
- package/dist/esm/api/catalogApi/index.js +156 -160
- package/dist/esm/api/categoriesApi/index.js +37 -33
- package/dist/esm/api/citiesApi/index.js +23 -19
- package/dist/esm/api/companiesApi/index.js +11 -15
- package/dist/esm/api/consentsApi/index.js +3 -6
- package/dist/esm/api/getSDKConfig.js +15 -24
- package/dist/esm/api/myCartApi/index.js +176 -136
- package/dist/esm/api/myOrdersApi/index.js +55 -15
- package/dist/esm/api/myPaymentsBoricaApi/index.js +22 -18
- package/dist/esm/api/myShippingsEcontApi/index.js +150 -125
- package/dist/esm/api/myShippingsEvropatApi/index.js +60 -50
- package/dist/esm/api/myShippingsPickupFromStoreAPI/index.js +6 -7
- package/dist/esm/api/myShippingsSpeedyApi/index.js +150 -125
- package/dist/esm/api/notificationsApi/index.js +4 -5
- package/dist/esm/api/pagesApi/index.js +3 -4
- package/dist/esm/api/productsApi/index.js +48 -46
- package/dist/esm/api/searchHistoryApi/index.js +35 -26
- package/dist/esm/api/usersApi/index.js +2 -3
- package/dist/esm/api/viewsApi/index.js +36 -32
- package/dist/esm/api/vouchersApi/index.js +3 -4
- package/dist/esm/api/walletApi/index.js +3 -6
- package/dist/esm/api/wishlistApi/index.js +17 -13
- package/dist/esm/api/wishlistApi/utils/index.js +2 -4
- package/dist/esm/api.v2/core/checkout/payments/useSetMerchantPaymentMethod.js +1 -1
- package/dist/esm/api.v2/core/checkout/payments/useSetPaymentMethod.js +19 -4
- package/dist/esm/api.v2/core/checkout/shippings/mutations/useMutateNomenclature.js +19 -14
- package/dist/esm/api.v2/core/checkout/shippings/queries/useFindNomenclatureElement.js +67 -56
- package/dist/esm/api.v2/core/checkout/types.js +4 -8
- package/dist/esm/api.v2/core/misc/promo-code/mutations/usePromoCodeMutation.js +22 -17
- package/dist/esm/api.v2/core/product/useSubscribeForSkuMutation.js +19 -4
- package/dist/esm/basket/api/mutations/index.js +1 -0
- package/dist/esm/basket/api/mutations/useChangeGiftVariant.js +106 -0
- package/dist/esm/basket/api/mutations/useReplaceBasketMutation.js +17 -13
- package/dist/esm/basket/hooks/index.js +1 -0
- package/dist/esm/basket/hooks/useChangeGiftVariant.js +3 -0
- package/dist/esm/brands/api/queries/keys.js +2 -4
- package/dist/esm/brands/api/queries/useAllBrandsQuery.js +91 -76
- package/dist/esm/build/api/query/fetchStore.js +25 -20
- package/dist/esm/checkout/api/keys.js +7 -3
- package/dist/esm/checkout/api/queries/index.js +1 -0
- package/dist/esm/checkout/api/queries/useUniCreditCalculateForCartQuery.js +50 -0
- package/dist/esm/checkout/contexts/BoricaResponseContext.js +1 -2
- package/dist/esm/checkout/contexts/PaypalResponseContext.js +1 -2
- package/dist/esm/checkout/contexts/UniCreditResponseContext.js +13 -0
- package/dist/esm/checkout/contexts/index.js +1 -0
- package/dist/esm/checkout/hooks/index.js +1 -0
- package/dist/esm/checkout/hooks/useBnpCalculateForCart.js +7 -11
- package/dist/esm/checkout/hooks/useUniCreditCalculateForCart.js +88 -0
- package/dist/esm/checkout/ssr/capturePaypalOrder.js +16 -11
- package/dist/esm/checkout/ssr/captureUniCreditOrder.js +47 -0
- package/dist/esm/checkout/ssr/index.js +1 -0
- package/dist/esm/checkout/ssr/verifyBoricaResponse.js +24 -19
- package/dist/esm/cms/api/mutations/useCMSFoldersCreateMutation.js +31 -29
- package/dist/esm/cms/api/mutations/useCMSMediaDeleteAssetsMutation.js +19 -14
- package/dist/esm/cms/api/mutations/useCMSMediaUploadAssetsMutation.js +22 -19
- package/dist/esm/cms/api/queries/keys.js +20 -14
- package/dist/esm/cms/api/queries/useCMSContentListQuery.js +4 -7
- package/dist/esm/cms/api/queries/useCMSMediaQuery.js +1 -2
- package/dist/esm/cms/api/queries/useInjectedContentQuery.js +4 -7
- package/dist/esm/cms/components/RenderInjectedContent.js +3 -7
- package/dist/esm/cms/hooks/useCmsContent.js +4 -8
- package/dist/esm/cms/hooks/useCmsContentList.js +7 -12
- package/dist/esm/cms/hooks/useCmsFolders.js +0 -1
- package/dist/esm/cms/hooks/useCmsMedia.js +0 -1
- package/dist/esm/cms/hooks/useCmsMediaDeleteAssets.js +0 -1
- package/dist/esm/cms/hooks/useCmsMediaUploadAssets.js +0 -1
- package/dist/esm/cms/hooks/useContentCategoriesMap.js +6 -13
- package/dist/esm/cms/hooks/useCreateCmsFolders.js +0 -1
- package/dist/esm/cms/hooks/useInjectedContentContext.js +4 -8
- package/dist/esm/cms/hooks/useListingInjectedContent.js +1 -2
- package/dist/esm/cms/ssr/fetchPagePaths.js +3 -3
- package/dist/esm/cms/ssr/prefetchCMSPage.js +34 -29
- package/dist/esm/cms/ssr/prefetchCmsContent.js +48 -43
- package/dist/esm/cms/ssr/prefetchCmsContentList.js +52 -50
- package/dist/esm/components/AnalyticsScripts/index.js +22 -6
- package/dist/esm/components/Drawer/index.js +3 -5
- package/dist/esm/components/FadeIn/index.js +27 -15
- package/dist/esm/components/GoogleOneTap/index.js +39 -19
- package/dist/esm/components/Html/index.js +1 -1
- package/dist/esm/components/LazyResponsiveImage/index.js +23 -12
- package/dist/esm/components/Link/index.js +3 -6
- package/dist/esm/components/Portal/index.js +2 -3
- package/dist/esm/components/ProgressBar/index.js +19 -4
- package/dist/esm/config/SentecaProvider.js +7 -12
- package/dist/esm/contexts/CheckoutForm/Components/BoricaRedirect/index.js +19 -4
- package/dist/esm/contexts/CheckoutForm/Components/CheckoutCustomState/index.js +22 -10
- package/dist/esm/contexts/CheckoutForm/Components/UniCreditRedirect/index.js +61 -0
- package/dist/esm/contexts/CheckoutForm/Components/index.js +1 -0
- package/dist/esm/contexts/CheckoutForm/hooks/useBilling/index.js +52 -31
- package/dist/esm/contexts/CheckoutForm/hooks/usePayment/index.js +20 -6
- package/dist/esm/contexts/CheckoutForm/hooks/useSavedBillingList/index.js +2 -4
- package/dist/esm/contexts/CheckoutForm/hooks/useSavedShippingList/index.js +20 -15
- package/dist/esm/contexts/CheckoutForm/hooks/useShipping/index.js +102 -90
- package/dist/esm/contexts/CheckoutForm/hooks/useShippingInitialData/index.js +3 -7
- package/dist/esm/contexts/CheckoutForm/index.js +103 -60
- package/dist/esm/contexts/CheckoutForm/utils/updatedNestedObjectProps.js +16 -3
- package/dist/esm/contexts/CheckoutForm/utils/validateBillingAddress.js +6 -14
- package/dist/esm/contexts/CheckoutForm/utils/validateShipping.js +12 -23
- package/dist/esm/contexts/CustomProductProvider/index.js +22 -10
- package/dist/esm/contexts/Strings.js +32 -33
- package/dist/esm/hooks/addresses-hooks/useAddressForm/index.js +37 -48
- package/dist/esm/hooks/basket-hooks/useBasket/index.js +19 -4
- package/dist/esm/hooks/basket-hooks/useBasketCustom/index.js +19 -4
- package/dist/esm/hooks/basket-hooks/useBasketItemList/index.js +5 -10
- package/dist/esm/hooks/basket-hooks/useBasketItemWithErrorList/index.js +4 -8
- package/dist/esm/hooks/basket-hooks/useBasketLineItem/index.js +19 -4
- package/dist/esm/hooks/basket-hooks/useBasketLineItem/utils/index.js +4 -9
- package/dist/esm/hooks/checkout-hooks/useAllStockLocations.js +5 -10
- package/dist/esm/hooks/checkout-hooks/useShippingCourierMethods.js +41 -36
- package/dist/esm/hooks/cities-hooks/useCities/index.js +19 -4
- package/dist/esm/hooks/error-handling/useErrors/index.js +4 -9
- package/dist/esm/hooks/labels/useGlobalLabels/index.js +1 -2
- package/dist/esm/hooks/order-hooks/api/queries/useOrderGetPaymentMethodQuery.js +2 -4
- package/dist/esm/hooks/order-hooks/useGenericCourierAddress/index.js +103 -68
- package/dist/esm/hooks/order-hooks/useOrder/index.js +3 -11
- package/dist/esm/hooks/order-hooks/useOrderGetPaymentMethod/index.js +0 -1
- package/dist/esm/hooks/order-hooks/useOrderPaymentMethods/index.js +2 -4
- package/dist/esm/hooks/order-hooks/useOrdersList/index.js +2 -4
- package/dist/esm/hooks/order-hooks/usePayOrder/index.js +66 -58
- package/dist/esm/hooks/order-hooks/useUpdateOrderPaymentMethod/index.js +20 -7
- package/dist/esm/hooks/subscriptions-hooks/useAcceptOnRegister/index.js +21 -8
- package/dist/esm/hooks/subscriptions-hooks/useAllSubscriptions/index.js +32 -33
- package/dist/esm/hooks/subscriptions-hooks/useSubscribeForProduct/index.js +20 -6
- package/dist/esm/hooks/ui-hooks/useAccordion/index.js +19 -5
- package/dist/esm/hooks/ui-hooks/useBoolean/index.js +21 -6
- package/dist/esm/hooks/ui-hooks/useCallbackRef/index.js +19 -11
- package/dist/esm/hooks/ui-hooks/useClickOutside/index.js +2 -2
- package/dist/esm/hooks/ui-hooks/useIsDesktop/index.js +2 -2
- package/dist/esm/hooks/ui-hooks/useIsIos/index.js +19 -4
- package/dist/esm/hooks/ui-hooks/useMenuAim/index.js +19 -4
- package/dist/esm/hooks/ui-hooks/usePagination/index.js +19 -14
- package/dist/esm/hooks/ui-hooks/useScrollDirection/index.js +21 -7
- package/dist/esm/hooks/ui-hooks/useScrollTo/index.js +26 -12
- package/dist/esm/hooks/ui-hooks/useSlideshow/index.js +21 -6
- package/dist/esm/hooks/ui-hooks/useToggleNavbarOnScroll/index.js +3 -3
- package/dist/esm/hooks/ui-hooks/useUI/index.js +34 -35
- package/dist/esm/hooks/ui-hooks/useWindowDimensions/index.js +19 -4
- package/dist/esm/hooks/useAddressList/index.js +2 -3
- package/dist/esm/hooks/useAggregateResult/index.js +7 -5
- package/dist/esm/hooks/useAllSelectedFilters/index.js +4 -4
- package/dist/esm/hooks/useAvailability/index.js +27 -14
- package/dist/esm/hooks/useCarousel/component/index.js +12 -17
- package/dist/esm/hooks/useCarousel/helpers/eventStore.js +2 -2
- package/dist/esm/hooks/useCarousel/index.js +20 -6
- package/dist/esm/hooks/useCatalogResult/index.js +2 -2
- package/dist/esm/hooks/useCategoryTree/index.js +1 -2
- package/dist/esm/hooks/useCheckoutBillingAddress/index.js +75 -7
- package/dist/esm/hooks/useCheckoutDelivery/index.js +71 -58
- package/dist/esm/hooks/useCheckoutDiscountCode/index.js +19 -4
- package/dist/esm/hooks/useCheckoutPickupFromStore/index.js +21 -8
- package/dist/esm/hooks/useCheckoutShippingAddress/index.js +19 -4
- package/dist/esm/hooks/useCheckoutShippingModule/index.js +4 -6
- package/dist/esm/hooks/useCheckoutSubmit/index.js +98 -59
- package/dist/esm/hooks/useClearAllFilters/index.js +4 -4
- package/dist/esm/hooks/useContactForm/index.js +8 -4
- package/dist/esm/hooks/useCopyToClipboard/index.js +20 -4
- package/dist/esm/hooks/useForceUpdate/index.js +19 -4
- package/dist/esm/hooks/useLineItem/LineItemContext.js +75 -0
- package/dist/esm/hooks/useLineItem/index.js +21 -25
- package/dist/esm/hooks/useLocalRating/index.js +23 -10
- package/dist/esm/hooks/usePrefetchProduct/index.js +19 -4
- package/dist/esm/hooks/usePrice/index.js +1 -1
- package/dist/esm/hooks/useProduct/index.js +19 -266
- package/dist/esm/hooks/useProduct/utils/index.js +75 -57
- package/dist/esm/hooks/useProductVariants/index.js +293 -0
- package/dist/esm/hooks/useProductVariants/types.js +1 -0
- package/dist/esm/hooks/useProgressBar/hooks/useGetSetState.js +5 -8
- package/dist/esm/hooks/useProgressBar/hooks/useUpdate.js +19 -4
- package/dist/esm/hooks/useProgressBar/index.js +23 -11
- package/dist/esm/hooks/usePromoCode/index.js +20 -6
- package/dist/esm/hooks/useSearchbar/index.js +88 -74
- package/dist/esm/hooks/useSelectedFilters/index.js +4 -4
- package/dist/esm/hooks/useShippingAddress/index.js +2 -4
- package/dist/esm/hooks/useSizesReducer/index.js +24 -12
- package/dist/esm/hooks/useVouchers/index.js +2 -4
- package/dist/esm/hooks/useWallet/index.js +2 -4
- package/dist/esm/hooks/useZoom/index.js +20 -6
- package/dist/esm/hooks/user-hooks/useSubscribeToNewsletter/index.js +28 -7
- package/dist/esm/hooks/wishlist-hooks/useWishlist/index.js +20 -6
- package/dist/esm/hooks/wishlist-hooks/useWishlistItem/index.js +41 -19
- package/dist/esm/index.js +1 -3
- package/dist/esm/listing/api/keys.js +3 -5
- package/dist/esm/listing/api/queries/useAggregateQuery.js +13 -17
- package/dist/esm/listing/api/queries/useInfiniteListing.js +6 -8
- package/dist/esm/listing/api/queries/useLabelsQuery.js +19 -10
- package/dist/esm/listing/api/queries/useListingQuery.js +43 -29
- package/dist/esm/listing/api/queries/usePredicate.js +38 -26
- package/dist/esm/listing/components/BasicListingSEO.js +25 -9
- package/dist/esm/listing/hooks/useListingAlias.js +2 -4
- package/dist/esm/listing/hooks/useListingBreadcrumbs.js +37 -18
- package/dist/esm/listing/hooks/useListingCategories.js +28 -22
- package/dist/esm/listing/hooks/useListingConfig.js +6 -10
- package/dist/esm/listing/hooks/useListingFilters.js +51 -34
- package/dist/esm/listing/hooks/useListingItems.js +2 -2
- package/dist/esm/listing/hooks/useListingMeta.js +73 -55
- package/dist/esm/listing/hooks/useListingPagination.js +6 -10
- package/dist/esm/listing/hooks/useListingSlug.js +3 -1
- package/dist/esm/listing/hooks/useSlideFilter.js +51 -12
- package/dist/esm/listing/hooks/useSort.js +47 -19
- package/dist/esm/listing/hooks/utils.js +2 -1
- package/dist/esm/listing/ssr/prefetchCategories.js +7 -8
- package/dist/esm/listing/ssr/prefetchListing.js +9 -9
- package/dist/esm/listing/ssr/prefetchPredicate.js +4 -4
- package/dist/esm/listing/types.js +10 -20
- package/dist/esm/listing/utils/buildCategoryQuery.js +38 -20
- package/dist/esm/listing/utils/buildFilterQuery.js +30 -27
- package/dist/esm/listing/utils/calculateOffset.js +1 -1
- package/dist/esm/listing/utils/extendFilter.js +19 -4
- package/dist/esm/listing/utils/getListingAlias.js +24 -12
- package/dist/esm/listing/utils/getListingPageType.js +4 -5
- package/dist/esm/navigation/components/SearchBox/Components/Container/index.js +1 -1
- package/dist/esm/navigation/components/SearchBox/Components/EmptyBox/index.js +21 -20
- package/dist/esm/navigation/components/SearchBox/Components/PopularSearches/index.js +1 -1
- package/dist/esm/navigation/components/SearchBox/Components/Products/Components/ProductCard/index.js +2 -3
- package/dist/esm/navigation/components/SearchBox/Components/Products/index.js +2 -2
- package/dist/esm/navigation/components/SearchBox/Components/RecentSearches/index.js +1 -1
- package/dist/esm/navigation/components/SearchBox/Components/Suggestions/Utils/ScrollView.js +4 -8
- package/dist/esm/navigation/components/SearchBox/index.js +16 -17
- package/dist/esm/navigation/keys.js +2 -4
- package/dist/esm/navigation/mutations/useSearchHistoryMutation.js +20 -16
- package/dist/esm/navigation/types.js +2 -4
- package/dist/esm/order/api/index.js +1 -0
- package/dist/esm/order/api/queries/prefetchOrder.js +24 -19
- package/dist/esm/order/api/utils/getOrderById.js +2 -0
- package/dist/esm/order/api/utils/index.js +1 -0
- package/dist/esm/postcss/tailwind/buttons-plugin.js +20 -16
- package/dist/esm/postcss/tailwind/default-plugin.js +2 -4
- package/dist/esm/postcss/tailwind/fonts-plugin.js +21 -18
- package/dist/esm/postcss/tailwind/forms-plugin.js +6 -9
- package/dist/esm/postcss/tailwind/utils.js +4 -6
- package/dist/esm/postcss/types.js +4 -8
- package/dist/esm/product/api/keys.js +6 -0
- package/dist/esm/product/api/queries/index.js +1 -0
- package/dist/esm/product/api/queries/useUniCreditOffersQuery.js +53 -0
- package/dist/esm/product/api/ssr/index.js +44 -40
- package/dist/esm/product/hooks/index.js +1 -0
- package/dist/esm/product/hooks/useBnpOffers.js +5 -8
- package/dist/esm/product/hooks/useUniCreditOffers.js +81 -0
- package/dist/esm/seo/api/ssr/fetchRedirectByFrom.js +19 -14
- package/dist/esm/seo/api/ssr/fetchSitemaps.js +22 -17
- package/dist/esm/seo/api/ssr/getCanonicalUrl.js +19 -4
- package/dist/esm/seo/components/GlobalSEO/index.js +3 -3
- package/dist/esm/seo/components/HiddenBreadcrumb/index.js +1 -2
- package/dist/esm/seo/components/ProductSEO/index.js +3 -5
- package/dist/esm/seo/components/TranslationsMeta/index.js +49 -0
- package/dist/esm/seo/components/index.js +1 -0
- package/dist/esm/seo/hooks/index.js +1 -0
- package/dist/esm/seo/hooks/useSEOBreadcrumb.js +17 -9
- package/dist/esm/seo/hooks/useSeoTranslations.js +79 -0
- package/dist/esm/seo/utils/handleRobots.js +4 -4
- package/dist/esm/ssr/emptyBasketGuard.js +2 -2
- package/dist/esm/ui/components/GridStyles.js +26 -0
- package/dist/esm/ui/components/LazyImage.js +6 -12
- package/dist/esm/ui/components/RangeSliderInput.js +36 -11
- package/dist/esm/ui/components/index.js +1 -0
- package/dist/esm/ui/hooks/index.js +1 -0
- package/dist/esm/ui/hooks/useToasts.js +154 -0
- package/dist/esm/ui/index.js +1 -0
- package/dist/esm/ui/toastUtils/ErrorIcon.js +15 -0
- package/dist/esm/ui/toastUtils/InfoIcon.js +15 -0
- package/dist/esm/ui/toastUtils/SuccessIcon.js +15 -0
- package/dist/esm/ui/toastUtils/WarningIcon.js +15 -0
- package/dist/esm/ui/toastUtils/index.js +5 -0
- package/dist/esm/ui/toastUtils/utils.js +67 -0
- package/dist/esm/user/api/mutations/useLoginMutation.js +2 -5
- package/dist/esm/user/api/mutations/useLogoutMutation.js +3 -6
- package/dist/esm/user/api/mutations/useRegisterMutation.js +24 -24
- package/dist/esm/user/api/mutations/useRequestResetPasswordTokenMutation.js +1 -2
- package/dist/esm/user/api/mutations/useResetPasswordMutation.js +1 -2
- package/dist/esm/user/api/queries/useGetMyLoyaltyCardQuery.js +44 -3
- package/dist/esm/user/api/queries/useIsAuthenticatedQuery.js +2 -4
- package/dist/esm/user/api/utils/generateAnonymousToken.js +25 -21
- package/dist/esm/user/api/utils/processLoginPayload.js +2 -2
- package/dist/esm/user/hooks/useConfirmEmail.js +20 -6
- package/dist/esm/user/hooks/useLoginApple.js +2 -4
- package/dist/esm/user/hooks/useLoginFacebook.js +2 -4
- package/dist/esm/user/hooks/useLoginGoogle.js +2 -4
- package/dist/esm/user/hooks/useRequestEmailConfirmation.js +20 -6
- package/dist/esm/user/index.js +0 -1
- package/dist/esm/utils/assetsToMap.js +3 -7
- package/dist/esm/utils/createAggregateQuery.js +4 -6
- package/dist/esm/utils/customFieldsToMap.js +3 -8
- package/dist/esm/utils/generateQueryFromRouter.js +5 -12
- package/dist/esm/utils/getLocaleFromPath.js +8 -0
- package/dist/esm/utils/getPagination.js +5 -11
- package/dist/esm/utils/getSelectedFilters.js +25 -11
- package/dist/esm/utils/index.js +1 -0
- package/dist/esm/utils/isColorBright.js +2 -2
- package/dist/esm/utils/isTouchDevice.js +2 -1
- package/dist/esm/utils/localStorage.js +7 -2
- package/dist/esm/utils/queryObjToString.js +3 -7
- package/dist/esm/utils/sortAncestors.js +18 -11
- package/dist/esm/utils/tokens.js +19 -4
- package/dist/esm/utils/validations.js +2 -2
- package/dist/esm/webview/hooks/useIsInWebview.js +21 -6
- package/dist/esm/webview/utils/sendMessage.js +2 -4
- package/dist/esm/wishlist/api/queries/keys.js +2 -4
- package/dist/esm/wishlist/api/queries/useWishlistItemsQuery.js +4 -7
- package/dist/esm/wishlist/hooks/useWishlistItems.js +2 -3
- package/dist/types/analytics/Pixel/hooks/index.d.ts +3 -0
- package/dist/types/analytics/Pixel/hooks/usePixelFinishOrder.d.ts +4 -0
- package/dist/types/analytics/Pixel/hooks/usePixelViewBasket.d.ts +4 -0
- package/dist/types/analytics/Pixel/hooks/usePixelViewCategory.d.ts +7 -0
- package/dist/types/analytics/Pixel/types.d.ts +10 -1
- package/dist/types/analytics/Pixel/utils.d.ts +3 -0
- package/dist/types/analytics/Releva/hooks/useRelevaOnListingPage.d.ts +1 -1
- package/dist/types/analytics/Releva/types.d.ts +1 -1
- package/dist/types/analytics/Releva/utils.d.ts +1 -1
- package/dist/types/analytics/addToCart.d.ts +1 -1
- package/dist/types/analytics/initiateCheckout.d.ts +1 -1
- package/dist/types/analytics/purchase.d.ts +1 -1
- package/dist/types/api/addressesApi/index.d.ts +1 -1
- package/dist/types/api/brandsApi/index.d.ts +1 -1
- package/dist/types/api/catalogApi/index.d.ts +1 -1
- package/dist/types/api/categoriesApi/index.d.ts +1 -1
- package/dist/types/api/citiesApi/index.d.ts +1 -1
- package/dist/types/api/companiesApi/index.d.ts +1 -1
- package/dist/types/basket/api/mutations/index.d.ts +1 -0
- package/dist/types/basket/api/mutations/useChangeGiftVariant.d.ts +2 -0
- package/dist/types/basket/api/mutations/useReplaceBasketMutation.d.ts +1 -1
- package/dist/types/basket/hooks/index.d.ts +1 -0
- package/dist/types/basket/hooks/useChangeGiftVariant.d.ts +2 -0
- package/dist/types/checkout/api/keys.d.ts +1 -0
- package/dist/types/checkout/api/queries/index.d.ts +1 -0
- package/dist/types/checkout/api/queries/useBnpCalculateForCartQuery.d.ts +1 -1
- package/dist/types/checkout/api/queries/useUniCreditCalculateForCartQuery.d.ts +3 -0
- package/dist/types/checkout/contexts/UniCreditResponseContext.d.ts +6 -0
- package/dist/types/checkout/contexts/index.d.ts +1 -0
- package/dist/types/checkout/hooks/index.d.ts +1 -0
- package/dist/types/checkout/hooks/useBnpCalculateForCart.d.ts +4 -3
- package/dist/types/checkout/hooks/useUniCreditCalculateForCart.d.ts +41 -0
- package/dist/types/checkout/ssr/captureUniCreditOrder.d.ts +2 -0
- package/dist/types/checkout/ssr/index.d.ts +1 -0
- package/dist/types/cms/api/mutations/useCMSMediaUploadAssetsMutation.d.ts +1 -3
- package/dist/types/components/Portal/index.d.ts +2 -2
- package/dist/types/contexts/CheckoutForm/Components/UniCreditRedirect/index.d.ts +5 -0
- package/dist/types/contexts/CheckoutForm/Components/index.d.ts +1 -0
- package/dist/types/contexts/CheckoutForm/hooks/useBilling/index.d.ts +3 -1
- package/dist/types/contexts/CheckoutForm/hooks/usePayment/index.d.ts +2 -2
- package/dist/types/contexts/CheckoutForm/hooks/useShipping/index.d.ts +1 -1
- package/dist/types/contexts/CheckoutForm/index.d.ts +2 -1
- package/dist/types/hooks/basket-hooks/useBasketLineItem/index.d.ts +1 -2
- package/dist/types/hooks/order-hooks/useOrder/index.d.ts +3 -2
- package/dist/types/hooks/order-hooks/useOrderPaymentMethods/index.d.ts +4 -4
- package/dist/types/hooks/useCarousel/index.d.ts +2 -2
- package/dist/types/hooks/useCheckoutBillingAddress/index.d.ts +2 -0
- package/dist/types/hooks/useCheckoutSubmit/index.d.ts +3 -2
- package/dist/types/hooks/useContactForm/index.d.ts +2 -1
- package/dist/types/hooks/useLineItem/LineItemContext.d.ts +22 -0
- package/dist/types/hooks/useLineItem/index.d.ts +3 -3
- package/dist/types/hooks/useProduct/index.d.ts +5 -78
- package/dist/types/hooks/useProduct/utils/index.d.ts +6 -4
- package/dist/types/hooks/useProductVariants/index.d.ts +34 -0
- package/dist/types/hooks/useProductVariants/types.d.ts +79 -0
- package/dist/types/hooks/useVouchers/index.d.ts +2 -2
- package/dist/types/hooks/useZoom/index.d.ts +2 -2
- package/dist/types/hooks/wishlist-hooks/useWishlist/index.d.ts +1 -2
- package/dist/types/index.d.ts +1 -3
- package/dist/types/listing/api/queries/useAggregateQuery.d.ts +2 -1
- package/dist/types/listing/api/queries/useListingQuery.d.ts +6 -3
- package/dist/types/listing/api/queries/usePredicate.d.ts +2 -1
- package/dist/types/listing/components/BasicListingSEO.d.ts +3 -1
- package/dist/types/listing/hooks/useListingAlias.d.ts +2 -1
- package/dist/types/listing/hooks/useListingFilters.d.ts +0 -1
- package/dist/types/listing/hooks/useListingItems.d.ts +3 -2
- package/dist/types/listing/hooks/useListingMeta.d.ts +4 -0
- package/dist/types/listing/hooks/useListingSEOCategories.d.ts +6 -4
- package/dist/types/listing/hooks/useSlideFilter.d.ts +4 -0
- package/dist/types/listing/hooks/useSort.d.ts +6 -5
- package/dist/types/listing/hooks/utils.d.ts +3 -2
- package/dist/types/listing/ssr/prefetchCategories.d.ts +2 -2
- package/dist/types/listing/ssr/prefetchListing.d.ts +4 -5
- package/dist/types/listing/ssr/prefetchPredicate.d.ts +2 -1
- package/dist/types/listing/types.d.ts +39 -16
- package/dist/types/listing/utils/buildCategoryQuery.d.ts +2 -1
- package/dist/types/listing/utils/buildFilterQuery.d.ts +2 -1
- package/dist/types/listing/utils/extendFilter.d.ts +3 -2
- package/dist/types/listing/utils/getListingAlias.d.ts +2 -1
- package/dist/types/listing/utils/getListingPageType.d.ts +2 -2
- package/dist/types/navigation/components/SearchBox/Components/Container/index.d.ts +10 -9
- package/dist/types/navigation/components/SearchBox/Components/EmptyBox/index.d.ts +23 -21
- package/dist/types/navigation/components/SearchBox/Components/Products/Components/ProductCard/index.d.ts +8 -7
- package/dist/types/navigation/components/SearchBox/Components/Products/index.d.ts +9 -8
- package/dist/types/navigation/components/SearchBox/index.d.ts +32 -30
- package/dist/types/order/api/index.d.ts +1 -0
- package/dist/types/order/api/utils/getOrderById.d.ts +2 -0
- package/dist/types/order/api/utils/index.d.ts +1 -0
- package/dist/types/product/api/keys.d.ts +1 -0
- package/dist/types/product/api/queries/index.d.ts +1 -0
- package/dist/types/product/api/queries/useBnpOffersQuery.d.ts +1 -1
- package/dist/types/product/api/queries/useUniCreditOffersQuery.d.ts +4 -0
- package/dist/types/product/hooks/index.d.ts +1 -0
- package/dist/types/product/hooks/useBnpOffers.d.ts +2 -2
- package/dist/types/product/hooks/useUniCreditOffers.d.ts +36 -0
- package/dist/types/seo/components/TranslationsMeta/index.d.ts +1 -0
- package/dist/types/seo/components/index.d.ts +1 -0
- package/dist/types/seo/hooks/index.d.ts +1 -0
- package/dist/types/seo/hooks/useSeoTranslations.d.ts +24 -0
- package/dist/types/types/index.d.ts +38 -40
- package/dist/types/ui/components/GridStyles.d.ts +11 -0
- package/dist/types/ui/components/RangeSliderInput.d.ts +2 -1
- package/dist/types/ui/components/index.d.ts +1 -0
- package/dist/types/ui/hooks/index.d.ts +1 -0
- package/dist/types/ui/hooks/useToasts.d.ts +20 -0
- package/dist/types/ui/index.d.ts +1 -0
- package/dist/types/ui/toastUtils/ErrorIcon.d.ts +1 -0
- package/dist/types/ui/toastUtils/InfoIcon.d.ts +1 -0
- package/dist/types/ui/toastUtils/SuccessIcon.d.ts +1 -0
- package/dist/types/ui/toastUtils/WarningIcon.d.ts +1 -0
- package/dist/types/ui/toastUtils/index.d.ts +5 -0
- package/dist/types/ui/toastUtils/utils.d.ts +11 -0
- package/dist/types/user/index.d.ts +0 -1
- package/dist/types/utils/getLocaleFromPath.d.ts +1 -0
- package/dist/types/utils/getSelectedFilters.d.ts +2 -1
- package/dist/types/utils/index.d.ts +1 -0
- package/package.json +14 -9
- package/dist/cjs/dto/index.js +0 -34
- package/dist/esm/dto/index.js +0 -1
- package/dist/esm/user/types/index.js +0 -1
- package/dist/types/dto/index.d.ts +0 -2
- package/dist/types/user/types/index.d.ts +0 -1
@@ -1,18 +1,25 @@
|
|
1
|
-
import React from 'react';
|
2
|
-
import { wishlistApi } from '../../../';
|
1
|
+
import React, { useEffect } from 'react';
|
2
|
+
import { useBoolean, wishlistApi } from '../../../';
|
3
3
|
import { usePrefetchProduct, getTranslatableField } from '../../../';
|
4
|
-
import {
|
4
|
+
import { createMappedAttributes } from '../../basket-hooks/useBasketLineItem/utils';
|
5
5
|
import { customFieldsToMap } from '../../../utils';
|
6
|
+
function _arrayLikeToArray(arr, len) {
|
7
|
+
if (len == null || len > arr.length) len = arr.length;
|
8
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
9
|
+
return arr2;
|
10
|
+
}
|
6
11
|
function _arrayWithHoles(arr) {
|
7
12
|
if (Array.isArray(arr)) return arr;
|
8
13
|
}
|
9
14
|
function _iterableToArrayLimit(arr, i) {
|
15
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
16
|
+
if (_i == null) return;
|
10
17
|
var _arr = [];
|
11
18
|
var _n = true;
|
12
19
|
var _d = false;
|
13
|
-
var _e
|
20
|
+
var _s, _e;
|
14
21
|
try {
|
15
|
-
for(
|
22
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
16
23
|
_arr.push(_s.value);
|
17
24
|
if (i && _arr.length === i) break;
|
18
25
|
}
|
@@ -29,25 +36,36 @@ function _iterableToArrayLimit(arr, i) {
|
|
29
36
|
return _arr;
|
30
37
|
}
|
31
38
|
function _nonIterableRest() {
|
32
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
39
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
33
40
|
}
|
34
41
|
function _slicedToArray(arr, i) {
|
35
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
42
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
43
|
+
}
|
44
|
+
function _unsupportedIterableToArray(o, minLen) {
|
45
|
+
if (!o) return;
|
46
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
47
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
48
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
49
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
50
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
36
51
|
}
|
37
52
|
export var useWishlistItem = function(props) {
|
38
53
|
var ref16;
|
39
|
-
var
|
54
|
+
var item = props.item, expiry = props.expiry;
|
55
|
+
var ref1 = _slicedToArray(useBoolean(false), 2), isExpired = ref1[0], setIsExpired = ref1[1];
|
40
56
|
var ref2 = _slicedToArray(wishlistApi.useSync(), 1), syncWishlist = ref2[0];
|
41
57
|
var ref3 = usePrefetchProduct(getTranslatableField(props === null || props === void 0 ? void 0 : (ref16 = props.item) === null || ref16 === void 0 ? void 0 : ref16.productSlug)), onMouseDown = ref3.onMouseDown, onMouseEnter = ref3.onMouseEnter, onMouseLeave = ref3.onMouseLeave;
|
58
|
+
useEffect(function() {
|
59
|
+
if (expiry) {
|
60
|
+
if (Date.now() > expiry + (item === null || item === void 0 ? void 0 : item.snapshotFrom)) {
|
61
|
+
setIsExpired.on();
|
62
|
+
}
|
63
|
+
}
|
64
|
+
}, []);
|
42
65
|
var data = React.useMemo(function() {
|
43
66
|
var ref, ref4, ref5, ref6, ref7, ref8, ref9, ref10, ref11, ref12, ref13, ref14, ref15;
|
44
|
-
var item = props.item;
|
45
|
-
if (props.expiry && getTimeStamp(props.expiry) < (item === null || item === void 0 ? void 0 : item.snapshotFrom)) {
|
46
|
-
setIsExpired(true);
|
47
|
-
}
|
48
67
|
var offer = item === null || item === void 0 ? void 0 : (ref = item.productVariant) === null || ref === void 0 ? void 0 : ref.offer;
|
49
|
-
var mappedAttributes = createMappedAttributes(item === null || item === void 0 ? void 0 : (ref4 = item.productVariant) === null || ref4 === void 0 ? void 0 : ref4.attributes) || {
|
50
|
-
};
|
68
|
+
var mappedAttributes = createMappedAttributes(item === null || item === void 0 ? void 0 : (ref4 = item.productVariant) === null || ref4 === void 0 ? void 0 : ref4.attributes) || {};
|
51
69
|
var mappedCustomField = customFieldsToMap(item.custom);
|
52
70
|
return {
|
53
71
|
productId: item === null || item === void 0 ? void 0 : item.productId,
|
@@ -85,11 +103,15 @@ export var useWishlistItem = function(props) {
|
|
85
103
|
}
|
86
104
|
};
|
87
105
|
}, [
|
88
|
-
|
106
|
+
item
|
107
|
+
]);
|
108
|
+
useEffect(function() {
|
109
|
+
if (isExpired) {
|
110
|
+
syncWishlist();
|
111
|
+
setIsExpired.off();
|
112
|
+
}
|
113
|
+
}, [
|
114
|
+
isExpired
|
89
115
|
]);
|
90
|
-
if (isExpired) {
|
91
|
-
syncWishlist();
|
92
|
-
setIsExpired(false);
|
93
|
-
}
|
94
116
|
return data;
|
95
117
|
};
|
package/dist/esm/index.js
CHANGED
@@ -1,6 +1,3 @@
|
|
1
|
-
import Cookie from 'js-cookie';
|
2
|
-
export { Cookie };
|
3
|
-
export * from './dto';
|
4
1
|
// API
|
5
2
|
// export * from './api/myCart'
|
6
3
|
export * from './api/productsApi';
|
@@ -95,6 +92,7 @@ export * from './hooks/useRouterRedirect';
|
|
95
92
|
export * from './hooks/useProgressBar';
|
96
93
|
export * from './hooks/useCatalogDiscounts';
|
97
94
|
export * from './hooks/useLocalRating';
|
95
|
+
export * from './hooks/useProductVariants/types';
|
98
96
|
// Utils
|
99
97
|
export * from './utils';
|
100
98
|
export * from './types';
|
@@ -1,17 +1,15 @@
|
|
1
1
|
import { getTranslatableField } from '../..';
|
2
|
-
var
|
3
|
-
export { ListingQueryKeysEnum1 as ListingQueryKeysEnum, };
|
2
|
+
export var ListingQueryKeysEnum;
|
4
3
|
(function(ListingQueryKeysEnum) {
|
5
4
|
ListingQueryKeysEnum["usePredicate"] = 'predicate';
|
6
5
|
ListingQueryKeysEnum["useListingQuery"] = 'listing';
|
7
6
|
ListingQueryKeysEnum["useAggregateQuery"] = 'agg-query';
|
8
7
|
ListingQueryKeysEnum["useLabelsQuery"] = 'get-labels';
|
9
|
-
})(
|
10
|
-
}));
|
8
|
+
})(ListingQueryKeysEnum || (ListingQueryKeysEnum = {}));
|
11
9
|
export var getListingQueryKeys = function(param) {
|
12
10
|
var predicate = param.predicate, type = param.type, sort = param.sort, postFilter = param.postFilter, offset = param.offset, slug = param.slug;
|
13
11
|
return [
|
14
|
-
|
12
|
+
ListingQueryKeysEnum.useListingQuery,
|
15
13
|
type,
|
16
14
|
predicate ? "[".concat(getTranslatableField(predicate.name), "]: ").concat(predicate._id) : slug,
|
17
15
|
sort,
|
@@ -7,7 +7,7 @@ import { useListingAlias } from '../../hooks';
|
|
7
7
|
import { ListingTypesEnum } from '../../types';
|
8
8
|
import { getListingPageType, buildCategoryQuery, buildFilterQuery } from '../../utils';
|
9
9
|
import { canUseDOM } from '../../../utils';
|
10
|
-
import {
|
10
|
+
import { useListingConfig } from '../..';
|
11
11
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
12
12
|
try {
|
13
13
|
var info = gen[key](arg);
|
@@ -52,8 +52,7 @@ function _defineProperty(obj, key, value) {
|
|
52
52
|
}
|
53
53
|
function _objectSpread(target) {
|
54
54
|
for(var i = 1; i < arguments.length; i++){
|
55
|
-
var source = arguments[i] != null ? arguments[i] : {
|
56
|
-
};
|
55
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
57
56
|
var ownKeys = Object.keys(source);
|
58
57
|
if (typeof Object.getOwnPropertySymbols === "function") {
|
59
58
|
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
@@ -66,21 +65,19 @@ function _objectSpread(target) {
|
|
66
65
|
}
|
67
66
|
return target;
|
68
67
|
}
|
69
|
-
var
|
70
|
-
export { AggregateRequestEnum1 as AggregateRequestEnum, };
|
68
|
+
export var AggregateRequestEnum;
|
71
69
|
(function(AggregateRequestEnum) {
|
72
70
|
AggregateRequestEnum["Filters"] = 'filters';
|
73
71
|
AggregateRequestEnum["Categories"] = 'categories';
|
74
|
-
})(
|
75
|
-
}));
|
72
|
+
})(AggregateRequestEnum || (AggregateRequestEnum = {}));
|
76
73
|
export var useAggregateQuery = function(aggregates, request, sort) {
|
77
74
|
var router = useRouter();
|
78
75
|
var ref = usePredicate(), predicate = ref.data;
|
79
|
-
var
|
76
|
+
var meta = useListingConfig().meta;
|
80
77
|
var postFilter = getPostFilters(router);
|
81
78
|
var aggregateKeys = generateAggregateKey(aggregates);
|
82
79
|
var predicateId = predicate === null || predicate === void 0 ? void 0 : predicate._id;
|
83
|
-
var ref1 = useListingAlias(), aliasedSlug = ref1.slug;
|
80
|
+
var ref1 = useListingAlias(meta), aliasedSlug = ref1.slug;
|
84
81
|
var queryKeys = [
|
85
82
|
request.toString(),
|
86
83
|
aggregateKeys,
|
@@ -105,11 +102,10 @@ export var useAggregateQuery = function(aggregates, request, sort) {
|
|
105
102
|
router: router,
|
106
103
|
postFilter: postFilter,
|
107
104
|
slug: aliasedSlug,
|
108
|
-
config:
|
105
|
+
config: meta
|
109
106
|
});
|
110
107
|
if (sort) {
|
111
|
-
query = _objectSpread({
|
112
|
-
}, query, {
|
108
|
+
query = _objectSpread({}, query, {
|
113
109
|
attributeSortType: sort
|
114
110
|
});
|
115
111
|
}
|
@@ -126,7 +122,7 @@ export var useAggregateQuery = function(aggregates, request, sort) {
|
|
126
122
|
})), {
|
127
123
|
refetchOnMount: false,
|
128
124
|
refetchOnWindowFocus: false,
|
129
|
-
enabled: isQueryEnabled(router, aliasedSlug, predicateId,
|
125
|
+
enabled: isQueryEnabled(router, aliasedSlug, predicateId, meta),
|
130
126
|
keepPreviousData: true,
|
131
127
|
staleTime: 30000
|
132
128
|
});
|
@@ -135,7 +131,7 @@ export function prepareAggregateQuery(param) {
|
|
135
131
|
var request = param.request, predicate = param.predicate, aggregates = param.aggregates, router = param.router, postFilter = param.postFilter, slug = param.slug, config = param.config, attributeSortType = param.attributeSortType;
|
136
132
|
var pageType = getListingPageType(router, slug, config);
|
137
133
|
switch(request){
|
138
|
-
case
|
134
|
+
case AggregateRequestEnum.Categories:
|
139
135
|
return buildCategoryQuery({
|
140
136
|
aggregates: aggregates,
|
141
137
|
predicate: predicate,
|
@@ -145,7 +141,7 @@ export function prepareAggregateQuery(param) {
|
|
145
141
|
router: router,
|
146
142
|
slug: slug
|
147
143
|
});
|
148
|
-
case
|
144
|
+
case AggregateRequestEnum.Filters:
|
149
145
|
return buildFilterQuery({
|
150
146
|
predicate: predicate,
|
151
147
|
slug: slug,
|
@@ -168,8 +164,8 @@ function getPostFilters(router) {
|
|
168
164
|
var query = router.query;
|
169
165
|
return query && Array.isArray(query.filter) ? query === null || query === void 0 ? void 0 : (ref = query.filter) === null || ref === void 0 ? void 0 : ref.join('&') : query === null || query === void 0 ? void 0 : query.filter;
|
170
166
|
}
|
171
|
-
function isQueryEnabled(router, slug, predicate,
|
172
|
-
var pageType = getListingPageType(router, slug,
|
167
|
+
function isQueryEnabled(router, slug, predicate, meta) {
|
168
|
+
var pageType = getListingPageType(router, slug, meta);
|
173
169
|
if (pageType === ListingTypesEnum.Search) {
|
174
170
|
return canUseDOM();
|
175
171
|
}
|
@@ -51,8 +51,7 @@ function _defineProperty(obj, key, value) {
|
|
51
51
|
}
|
52
52
|
function _objectSpread(target) {
|
53
53
|
for(var i = 1; i < arguments.length; i++){
|
54
|
-
var source = arguments[i] != null ? arguments[i] : {
|
55
|
-
};
|
54
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
56
55
|
var ownKeys = Object.keys(source);
|
57
56
|
if (typeof Object.getOwnPropertySymbols === "function") {
|
58
57
|
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
@@ -71,8 +70,8 @@ export var useInfiniteListing = function() {
|
|
71
70
|
var config = useListingConfig();
|
72
71
|
var ref3 = usePredicate(), predicate = ref3.data;
|
73
72
|
var query = router.query;
|
74
|
-
var ref1 = useListingAlias(), aliasedSlug = ref1.slug;
|
75
|
-
var limit = config.
|
73
|
+
var ref1 = useListingAlias(config.meta), aliasedSlug = ref1.slug;
|
74
|
+
var limit = config.meta.limit || 24;
|
76
75
|
var postFilter = getPostFilters(router);
|
77
76
|
var ref2;
|
78
77
|
var queryKeys = getListingQueryKeys({
|
@@ -95,11 +94,11 @@ export var useInfiniteListing = function() {
|
|
95
94
|
data = processListingQuery({
|
96
95
|
predicate: predicate,
|
97
96
|
limit: limit,
|
98
|
-
sort: config === null || config === void 0 ? void 0 : config.defaultSortKey,
|
97
|
+
sort: (config === null || config === void 0 ? void 0 : config.defaultSortKey) || 'defaultSort',
|
99
98
|
router: router,
|
100
99
|
postFilter: postFilter,
|
101
100
|
offset: offset,
|
102
|
-
config: config,
|
101
|
+
config: config.meta,
|
103
102
|
slug: aliasedSlug
|
104
103
|
});
|
105
104
|
return _ctx.abrupt("return", data);
|
@@ -126,8 +125,7 @@ export var useInfiniteListing = function() {
|
|
126
125
|
*/ var flatResults = (ref = infiniteQuery.data) === null || ref === void 0 ? void 0 : ref.map(function(data) {
|
127
126
|
return data.results;
|
128
127
|
}).flat();
|
129
|
-
return _objectSpread({
|
130
|
-
}, infiniteQuery, {
|
128
|
+
return _objectSpread({}, infiniteQuery, {
|
131
129
|
showPlaceholders: Boolean(!isEnabled || infiniteQuery.isFetching || !flatResults),
|
132
130
|
results: flatResults
|
133
131
|
});
|
@@ -3,13 +3,13 @@ import React from 'react';
|
|
3
3
|
import { LabelsFilter } from '@sentecacommerce/sdk';
|
4
4
|
import { useQuery } from 'react-query';
|
5
5
|
import { ListingQueryKeysEnum } from '../keys';
|
6
|
+
function _arrayLikeToArray(arr, len) {
|
7
|
+
if (len == null || len > arr.length) len = arr.length;
|
8
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
9
|
+
return arr2;
|
10
|
+
}
|
6
11
|
function _arrayWithoutHoles(arr) {
|
7
|
-
if (Array.isArray(arr))
|
8
|
-
for(var i = 0, arr2 = new Array(arr.length); i < arr.length; i++){
|
9
|
-
arr2[i] = arr[i];
|
10
|
-
}
|
11
|
-
return arr2;
|
12
|
-
}
|
12
|
+
if (Array.isArray(arr)) return _arrayLikeToArray(arr);
|
13
13
|
}
|
14
14
|
function asyncGeneratorStep(gen, resolve, reject, _next, _throw, key, arg) {
|
15
15
|
try {
|
@@ -41,13 +41,21 @@ function _asyncToGenerator(fn) {
|
|
41
41
|
};
|
42
42
|
}
|
43
43
|
function _iterableToArray(iter) {
|
44
|
-
if (Symbol.iterator
|
44
|
+
if (typeof Symbol !== "undefined" && iter[Symbol.iterator] != null || iter["@@iterator"] != null) return Array.from(iter);
|
45
45
|
}
|
46
46
|
function _nonIterableSpread() {
|
47
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
47
|
+
throw new TypeError("Invalid attempt to spread non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
48
48
|
}
|
49
49
|
function _toConsumableArray(arr) {
|
50
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
|
50
|
+
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread();
|
51
|
+
}
|
52
|
+
function _unsupportedIterableToArray(o, minLen) {
|
53
|
+
if (!o) return;
|
54
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
55
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
56
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
57
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
58
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
51
59
|
}
|
52
60
|
export var useLabelsQuery = function(param) {
|
53
61
|
var _labels = param.labels, labels = _labels === void 0 ? [] : _labels;
|
@@ -71,6 +79,7 @@ export var useLabelsQuery = function(param) {
|
|
71
79
|
}
|
72
80
|
}, _callee);
|
73
81
|
})), {
|
74
|
-
cacheTime: 0
|
82
|
+
cacheTime: 0,
|
83
|
+
refetchOnWindowFocus: false
|
75
84
|
});
|
76
85
|
};
|
@@ -6,7 +6,11 @@ import { useListingConfig, useListingSlug, useListingAlias } from '../../hooks';
|
|
6
6
|
import { getListingQueryKeys, usePredicate } from '..';
|
7
7
|
import { ListingTypesEnum } from '../../types';
|
8
8
|
import { calculateOffset, getListingPageType, getPostFilters, extendFilter } from '../../utils';
|
9
|
-
|
9
|
+
function _arrayLikeToArray(arr, len) {
|
10
|
+
if (len == null || len > arr.length) len = arr.length;
|
11
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
12
|
+
return arr2;
|
13
|
+
}
|
10
14
|
function _arrayWithHoles(arr) {
|
11
15
|
if (Array.isArray(arr)) return arr;
|
12
16
|
}
|
@@ -53,12 +57,14 @@ function _defineProperty(obj, key, value) {
|
|
53
57
|
return obj;
|
54
58
|
}
|
55
59
|
function _iterableToArrayLimit(arr, i) {
|
60
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
61
|
+
if (_i == null) return;
|
56
62
|
var _arr = [];
|
57
63
|
var _n = true;
|
58
64
|
var _d = false;
|
59
|
-
var _e
|
65
|
+
var _s, _e;
|
60
66
|
try {
|
61
|
-
for(
|
67
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
62
68
|
_arr.push(_s.value);
|
63
69
|
if (i && _arr.length === i) break;
|
64
70
|
}
|
@@ -75,12 +81,11 @@ function _iterableToArrayLimit(arr, i) {
|
|
75
81
|
return _arr;
|
76
82
|
}
|
77
83
|
function _nonIterableRest() {
|
78
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
84
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
79
85
|
}
|
80
86
|
function _objectSpread(target) {
|
81
87
|
for(var i = 1; i < arguments.length; i++){
|
82
|
-
var source = arguments[i] != null ? arguments[i] : {
|
83
|
-
};
|
88
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
84
89
|
var ownKeys = Object.keys(source);
|
85
90
|
if (typeof Object.getOwnPropertySymbols === "function") {
|
86
91
|
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
@@ -94,30 +99,34 @@ function _objectSpread(target) {
|
|
94
99
|
return target;
|
95
100
|
}
|
96
101
|
function _slicedToArray(arr, i) {
|
97
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
102
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
103
|
+
}
|
104
|
+
function _unsupportedIterableToArray(o, minLen) {
|
105
|
+
if (!o) return;
|
106
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
107
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
108
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
109
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
110
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
98
111
|
}
|
99
112
|
export var useListingQuery = function() {
|
100
|
-
var ref
|
113
|
+
var ref;
|
101
114
|
var router = useRouter();
|
102
115
|
var slug = useListingSlug();
|
103
116
|
var config = useListingConfig();
|
104
|
-
var
|
105
|
-
var
|
106
|
-
var ref4 = useListingAlias(), aliasedSlug = ref4.slug;
|
117
|
+
var ref1 = usePredicate(), predicate = ref1.data;
|
118
|
+
var ref2 = useListingAlias(config.meta), aliasedSlug = ref2.slug;
|
107
119
|
var query = router.query;
|
108
120
|
var postFilter = getPostFilters(router);
|
109
|
-
var
|
110
|
-
var
|
111
|
-
var _sort, ref7;
|
112
|
-
var sort = (ref7 = (_sort = query.sort) !== null && _sort !== void 0 ? _sort : globalConfig === null || globalConfig === void 0 ? void 0 : (ref2 = globalConfig.listing) === null || ref2 === void 0 ? void 0 : ref2.defaultSortKey) !== null && ref7 !== void 0 ? ref7 : 'defaultSort';
|
121
|
+
var limit = !!router.query.limit ? Number(router.query.limit) : (config === null || config === void 0 ? void 0 : (ref = config.meta) === null || ref === void 0 ? void 0 : ref.limit) || 24;
|
122
|
+
var sort = query.sort || (config === null || config === void 0 ? void 0 : config.defaultSortKey) || 'defaultSort';
|
113
123
|
var offset = calculateOffset(query === null || query === void 0 ? void 0 : query.page, limit);
|
114
|
-
var _sort1, ref8;
|
115
124
|
var queryKeys = getListingQueryKeys({
|
116
125
|
type: config.type,
|
117
126
|
predicate: predicate,
|
118
|
-
sort:
|
127
|
+
sort: sort,
|
119
128
|
postFilter: postFilter,
|
120
|
-
slug:
|
129
|
+
slug: aliasedSlug,
|
121
130
|
offset: offset
|
122
131
|
});
|
123
132
|
return useQuery(queryKeys, _asyncToGenerator(regeneratorRuntime.mark(function _callee() {
|
@@ -125,18 +134,22 @@ export var useListingQuery = function() {
|
|
125
134
|
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
126
135
|
while(1)switch(_ctx.prev = _ctx.next){
|
127
136
|
case 0:
|
128
|
-
|
137
|
+
_ctx.next = 2;
|
138
|
+
return processListingQuery({
|
129
139
|
predicate: predicate,
|
130
140
|
limit: limit,
|
131
141
|
sort: sort,
|
132
142
|
router: router,
|
133
143
|
postFilter: postFilter,
|
134
144
|
offset: offset,
|
135
|
-
config:
|
145
|
+
config: config.meta,
|
146
|
+
includeVariants: config.includeVariants,
|
136
147
|
slug: aliasedSlug
|
137
148
|
});
|
138
|
-
return _ctx.abrupt("return", data);
|
139
149
|
case 2:
|
150
|
+
data = _ctx.sent;
|
151
|
+
return _ctx.abrupt("return", data);
|
152
|
+
case 4:
|
140
153
|
case "end":
|
141
154
|
return _ctx.stop();
|
142
155
|
}
|
@@ -155,12 +168,11 @@ export function processListingQuery(_) {
|
|
155
168
|
}
|
156
169
|
function _processListingQuery() {
|
157
170
|
_processListingQuery = _asyncToGenerator(regeneratorRuntime.mark(function _callee(param) {
|
158
|
-
var predicate, router, limit, sort, postFilter, offset, config, slug,
|
171
|
+
var predicate, router, limit, sort, postFilter, offset, config, slug, _includeVariants, includeVariants, query, type, filter, _sort;
|
159
172
|
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
160
173
|
while(1)switch(_ctx.prev = _ctx.next){
|
161
174
|
case 0:
|
162
|
-
predicate = param.predicate, router = param.router, limit = param.limit, sort = param.sort, postFilter = param.postFilter, offset = param.offset, config = param.config, slug = param.slug;
|
163
|
-
;
|
175
|
+
predicate = param.predicate, router = param.router, limit = param.limit, sort = param.sort, postFilter = param.postFilter, offset = param.offset, config = param.config, slug = param.slug, _includeVariants = param.includeVariants, includeVariants = _includeVariants === void 0 ? false : _includeVariants;
|
164
176
|
query = router.query;
|
165
177
|
type = getListingPageType(router, slug, config);
|
166
178
|
filter = generateFilter(type, query, slug, predicate);
|
@@ -170,16 +182,18 @@ function _processListingQuery() {
|
|
170
182
|
offset: offset || 0,
|
171
183
|
filter: extendFilter({
|
172
184
|
slug: filter,
|
173
|
-
filterExtension: config === null || config === void 0 ? void 0 :
|
185
|
+
filterExtension: config === null || config === void 0 ? void 0 : config.filterExtension,
|
174
186
|
noSplit: true
|
175
187
|
}),
|
176
188
|
sort: (_sort = query.sort) !== null && _sort !== void 0 ? _sort : sort
|
177
189
|
}, (query === null || query === void 0 ? void 0 : query.filter) && {
|
178
190
|
postFilter: postFilter
|
179
|
-
}, (config === null || config === void 0 ? void 0 : config.
|
180
|
-
collapseMode: config === null || config === void 0 ? void 0 : config.
|
191
|
+
}, (config === null || config === void 0 ? void 0 : config.collapseMode) && type !== ListingTypesEnum.Collection && {
|
192
|
+
collapseMode: config === null || config === void 0 ? void 0 : config.collapseMode
|
193
|
+
}, {
|
194
|
+
includeVariants: includeVariants
|
181
195
|
})));
|
182
|
-
case
|
196
|
+
case 6:
|
183
197
|
case "end":
|
184
198
|
return _ctx.stop();
|
185
199
|
}
|
@@ -212,6 +226,6 @@ export function isListingQueryEnabled(type, predicate) {
|
|
212
226
|
return false;
|
213
227
|
}
|
214
228
|
function parseAttribute(slug) {
|
215
|
-
var ref = _slicedToArray(slug.split('-'), 2), type = ref[0], val = ref[1];
|
229
|
+
var ref = _slicedToArray((slug === null || slug === void 0 ? void 0 : slug.split('-')) || [], 2), type = ref[0], val = ref[1];
|
216
230
|
return "attr.".concat(type, ";eq;\"").concat(val, "\"");
|
217
231
|
}
|
@@ -2,11 +2,16 @@ import regeneratorRuntime from "regenerator-runtime";
|
|
2
2
|
import { BrandsGetBySlug, CategoriesGetBySlug, ViewsGetBySlug, ProductsGetAttributeLabel, CollectionsGetBySlug } from '@sentecacommerce/sdk';
|
3
3
|
import { useQuery } from 'react-query';
|
4
4
|
import { useRouter } from 'next/router';
|
5
|
-
import { useConfigState } from '../../../index';
|
6
5
|
import { ListingTypesEnum } from '../../types';
|
7
6
|
import { ListingQueryKeysEnum } from '../';
|
8
7
|
import { getListingPageType } from '../../utils';
|
9
8
|
import { useListingSlug, useListingAlias } from '../../hooks';
|
9
|
+
import { useListingConfig } from '../..';
|
10
|
+
function _arrayLikeToArray(arr, len) {
|
11
|
+
if (len == null || len > arr.length) len = arr.length;
|
12
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
13
|
+
return arr2;
|
14
|
+
}
|
10
15
|
function _arrayWithHoles(arr) {
|
11
16
|
if (Array.isArray(arr)) return arr;
|
12
17
|
}
|
@@ -53,12 +58,14 @@ function _defineProperty(obj, key, value) {
|
|
53
58
|
return obj;
|
54
59
|
}
|
55
60
|
function _iterableToArrayLimit(arr, i) {
|
61
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
62
|
+
if (_i == null) return;
|
56
63
|
var _arr = [];
|
57
64
|
var _n = true;
|
58
65
|
var _d = false;
|
59
|
-
var _e
|
66
|
+
var _s, _e;
|
60
67
|
try {
|
61
|
-
for(
|
68
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
62
69
|
_arr.push(_s.value);
|
63
70
|
if (i && _arr.length === i) break;
|
64
71
|
}
|
@@ -75,19 +82,26 @@ function _iterableToArrayLimit(arr, i) {
|
|
75
82
|
return _arr;
|
76
83
|
}
|
77
84
|
function _nonIterableRest() {
|
78
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
85
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
79
86
|
}
|
80
87
|
function _slicedToArray(arr, i) {
|
81
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
88
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
89
|
+
}
|
90
|
+
function _unsupportedIterableToArray(o, minLen) {
|
91
|
+
if (!o) return;
|
92
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
93
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
94
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
95
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
96
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
82
97
|
}
|
83
98
|
var _obj;
|
84
|
-
var getBySlugMap = (_obj = {
|
85
|
-
}, _defineProperty(_obj, ListingTypesEnum.Category, CategoriesGetBySlug), _defineProperty(_obj, ListingTypesEnum.View, ViewsGetBySlug), _defineProperty(_obj, ListingTypesEnum.Brand, BrandsGetBySlug), _defineProperty(_obj, ListingTypesEnum.Collection, CollectionsGetBySlug), _obj);
|
99
|
+
var getBySlugMap = (_obj = {}, _defineProperty(_obj, ListingTypesEnum.Category, CategoriesGetBySlug), _defineProperty(_obj, ListingTypesEnum.View, ViewsGetBySlug), _defineProperty(_obj, ListingTypesEnum.Brand, BrandsGetBySlug), _defineProperty(_obj, ListingTypesEnum.Collection, CollectionsGetBySlug), _obj);
|
86
100
|
export var usePredicate = function() {
|
87
101
|
var slug = useListingSlug();
|
102
|
+
var meta = useListingConfig().meta;
|
88
103
|
var router = useRouter();
|
89
|
-
var
|
90
|
-
var ref = useListingAlias(), aliasedSlug = ref.slug;
|
104
|
+
var ref = useListingAlias(meta), aliasedSlug = ref.slug;
|
91
105
|
var attribute = router.query.cat && aliasedSlug;
|
92
106
|
return useQuery([
|
93
107
|
ListingQueryKeysEnum.usePredicate,
|
@@ -99,7 +113,7 @@ export var usePredicate = function() {
|
|
99
113
|
while(1)switch(_ctx.prev = _ctx.next){
|
100
114
|
case 0:
|
101
115
|
_ctx.next = 2;
|
102
|
-
return processPredicateRequest(slug, router, aliasedSlug,
|
116
|
+
return processPredicateRequest(slug, router, aliasedSlug, meta);
|
103
117
|
case 2:
|
104
118
|
data = _ctx.sent;
|
105
119
|
return _ctx.abrupt("return", data);
|
@@ -118,10 +132,9 @@ export var usePredicate = function() {
|
|
118
132
|
export function processPredicateRequest(slug, router, aliasedSlug, mainConfig) {
|
119
133
|
return _processPredicateRequest.apply(this, arguments);
|
120
134
|
}
|
121
|
-
var _obj1;
|
122
135
|
function _processPredicateRequest() {
|
123
136
|
_processPredicateRequest = _asyncToGenerator(regeneratorRuntime.mark(function _callee(slug, router, aliasedSlug, mainConfig) {
|
124
|
-
var pageType, allowedPages, config, data, ref, type, val;
|
137
|
+
var pageType, _obj1, allowedPages, config, data, ref, type, val;
|
125
138
|
return regeneratorRuntime.wrap(function _callee$(_ctx) {
|
126
139
|
while(1)switch(_ctx.prev = _ctx.next){
|
127
140
|
case 0:
|
@@ -132,41 +145,40 @@ function _processPredicateRequest() {
|
|
132
145
|
}
|
133
146
|
return _ctx.abrupt("return", undefined);
|
134
147
|
case 3:
|
135
|
-
|
136
|
-
}, _defineProperty(_obj1, ListingTypesEnum.Category, true), _defineProperty(_obj1, ListingTypesEnum.Brand, true), _defineProperty(_obj1, ListingTypesEnum.Search, Boolean(router.query.search)), _obj1);
|
148
|
+
;
|
149
|
+
allowedPages = (_obj1 = {}, _defineProperty(_obj1, ListingTypesEnum.Category, true), _defineProperty(_obj1, ListingTypesEnum.Brand, true), _defineProperty(_obj1, ListingTypesEnum.Search, Boolean(router.query.search)), _obj1);
|
137
150
|
if (getBySlugMap[pageType]) {
|
138
|
-
_ctx.next =
|
151
|
+
_ctx.next = 7;
|
139
152
|
break;
|
140
153
|
}
|
141
154
|
return _ctx.abrupt("return");
|
142
|
-
case
|
143
|
-
config = {
|
144
|
-
};
|
155
|
+
case 7:
|
156
|
+
config = {};
|
145
157
|
if (allowedPages[pageType]) {
|
146
158
|
config = {
|
147
159
|
expand: 'ancestors'
|
148
160
|
};
|
149
161
|
}
|
150
|
-
_ctx.next =
|
162
|
+
_ctx.next = 11;
|
151
163
|
return getBySlugMap[pageType](slug, config);
|
152
|
-
case
|
164
|
+
case 11:
|
153
165
|
data = _ctx.sent;
|
154
166
|
if (!router.query.cat) {
|
155
|
-
_ctx.next =
|
167
|
+
_ctx.next = 18;
|
156
168
|
break;
|
157
169
|
}
|
158
170
|
ref = _slicedToArray(aliasedSlug.split('-'), 2), type = ref[0], val = ref[1];
|
159
171
|
if (!data) {
|
160
|
-
_ctx.next =
|
172
|
+
_ctx.next = 18;
|
161
173
|
break;
|
162
174
|
}
|
163
|
-
_ctx.next =
|
175
|
+
_ctx.next = 17;
|
164
176
|
return ProductsGetAttributeLabel(type, val);
|
165
|
-
case 16:
|
166
|
-
data.breadcrumb = _ctx.sent;
|
167
177
|
case 17:
|
168
|
-
|
178
|
+
data.breadcrumb = _ctx.sent;
|
169
179
|
case 18:
|
180
|
+
return _ctx.abrupt("return", data);
|
181
|
+
case 19:
|
170
182
|
case "end":
|
171
183
|
return _ctx.stop();
|
172
184
|
}
|