@sentecacommerce-theme/lib 0.13.7-alpha.7 → 0.13.10
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 +15 -6
- package/dist/cjs/GDPR/hooks/useCheckForCookies.js +10 -0
- 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 +4 -9
- package/dist/cjs/analytics/Pixel/hooks/usePixelProductDetails.js +19 -4
- 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 +6 -1
- 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 +20 -6
- package/dist/cjs/analytics/Releva/utils.js +2 -4
- package/dist/cjs/analytics/viewContent.js +2 -1
- 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 +224 -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 +72 -20
- 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/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 +8 -14
- 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 +2 -4
- 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/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 +24 -7
- 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/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/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 +87 -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/useProduct/index.js +23 -271
- package/dist/cjs/hooks/useProduct/utils/index.js +75 -57
- package/dist/cjs/hooks/useProductVariants/index.js +350 -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 +4 -7
- 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 +86 -74
- 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 +1 -1
- 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 +7 -10
- package/dist/cjs/listing/api/queries/useInfiniteListing.js +2 -4
- package/dist/cjs/listing/api/queries/useLabelsQuery.js +19 -10
- package/dist/cjs/listing/api/queries/useListingQuery.js +26 -9
- package/dist/cjs/listing/api/queries/usePredicate.js +34 -22
- package/dist/cjs/listing/components/BasicListingSEO.js +23 -7
- package/dist/cjs/listing/components/index.js +2 -4
- package/dist/cjs/listing/hooks/index.js +3 -6
- package/dist/cjs/listing/hooks/useListingBreadcrumbs.js +38 -19
- package/dist/cjs/listing/hooks/useListingCategories.js +20 -13
- package/dist/cjs/listing/hooks/useListingConfig.js +2 -4
- package/dist/cjs/listing/hooks/useListingFilters.js +55 -30
- package/dist/cjs/listing/hooks/useListingMeta.js +68 -49
- package/dist/cjs/listing/hooks/useListingPagination.js +3 -6
- package/dist/cjs/listing/hooks/useSlideFilter.js +46 -8
- package/dist/cjs/listing/hooks/useSort.js +3 -6
- package/dist/cjs/listing/index.js +3 -6
- package/dist/cjs/listing/ssr/index.js +3 -6
- package/dist/cjs/listing/ssr/prefetchCategories.js +5 -6
- package/dist/cjs/listing/ssr/prefetchListing.js +2 -1
- package/dist/cjs/listing/ssr/prefetchPredicate.js +4 -4
- package/dist/cjs/listing/types.js +15 -20
- package/dist/cjs/listing/utils/buildCategoryQuery.js +30 -11
- package/dist/cjs/listing/utils/buildFilterQuery.js +27 -22
- package/dist/cjs/listing/utils/extendFilter.js +19 -4
- package/dist/cjs/listing/utils/getListingAlias.js +21 -8
- package/dist/cjs/listing/utils/getListingPageType.js +2 -4
- package/dist/cjs/listing/utils/index.js +3 -6
- package/dist/cjs/navigation/components/SearchBox/Components/EmptyBox/index.js +7 -7
- package/dist/cjs/navigation/components/SearchBox/Components/IconArrowRight/index.js +2 -4
- package/dist/cjs/navigation/components/SearchBox/Components/Products/Components/ProductCard/index.js +1 -2
- package/dist/cjs/navigation/components/SearchBox/Components/Products/Components/index.js +2 -4
- 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 +9 -12
- 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 +3 -6
- 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/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/index.js +1 -0
- package/dist/esm/GDPR/hooks/useCheckForCookies.js +5 -0
- 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 +5 -10
- package/dist/esm/analytics/Pixel/hooks/usePixelProductDetails.js +19 -4
- 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 +260 -99
- package/dist/esm/analytics/Pixel/minifiedPixel.js +1 -1
- package/dist/esm/analytics/Pixel/usePixel.js +6 -1
- 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 +20 -6
- package/dist/esm/analytics/Releva/utils.js +2 -4
- package/dist/esm/analytics/viewContent.js +2 -1
- 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 +223 -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 +72 -20
- package/dist/esm/api/wishlistApi/utils/index.js +2 -4
- 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 +6 -10
- 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 +38 -18
- 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 +1 -2
- 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 +24 -7
- 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/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/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 +76 -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/useProduct/index.js +24 -267
- package/dist/esm/hooks/useProduct/utils/index.js +75 -57
- package/dist/esm/hooks/useProductVariants/index.js +309 -0
- package/dist/esm/hooks/useProductVariants/types.js +1 -0
- package/dist/esm/hooks/useProgressBar/hooks/useGetSetState.js +4 -7
- 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 +86 -74
- 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 +1 -2
- 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 +6 -10
- package/dist/esm/listing/api/queries/useInfiniteListing.js +2 -4
- package/dist/esm/listing/api/queries/useLabelsQuery.js +19 -10
- package/dist/esm/listing/api/queries/useListingQuery.js +26 -9
- package/dist/esm/listing/api/queries/usePredicate.js +34 -22
- package/dist/esm/listing/components/BasicListingSEO.js +24 -8
- package/dist/esm/listing/hooks/useListingBreadcrumbs.js +33 -14
- package/dist/esm/listing/hooks/useListingCategories.js +20 -13
- package/dist/esm/listing/hooks/useListingConfig.js +2 -4
- package/dist/esm/listing/hooks/useListingFilters.js +55 -30
- package/dist/esm/listing/hooks/useListingMeta.js +68 -51
- package/dist/esm/listing/hooks/useListingPagination.js +3 -6
- package/dist/esm/listing/hooks/useSlideFilter.js +46 -8
- package/dist/esm/listing/hooks/useSort.js +3 -6
- package/dist/esm/listing/ssr/prefetchCategories.js +6 -7
- package/dist/esm/listing/ssr/prefetchListing.js +2 -1
- package/dist/esm/listing/ssr/prefetchPredicate.js +4 -4
- package/dist/esm/listing/types.js +10 -20
- package/dist/esm/listing/utils/buildCategoryQuery.js +30 -11
- package/dist/esm/listing/utils/buildFilterQuery.js +27 -22
- package/dist/esm/listing/utils/extendFilter.js +19 -4
- package/dist/esm/listing/utils/getListingAlias.js +21 -8
- package/dist/esm/listing/utils/getListingPageType.js +2 -4
- package/dist/esm/navigation/components/SearchBox/Components/EmptyBox/index.js +7 -7
- package/dist/esm/navigation/components/SearchBox/Components/Products/Components/ProductCard/index.js +1 -2
- package/dist/esm/navigation/components/SearchBox/Components/Suggestions/Utils/ScrollView.js +4 -8
- package/dist/esm/navigation/components/SearchBox/index.js +7 -8
- 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 +3 -6
- 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/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/GDPR/hooks/index.d.ts +1 -0
- package/dist/types/GDPR/hooks/useCheckForCookies.d.ts +1 -0
- 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/api/myCartApi/index.d.ts +2 -0
- 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/useBasket/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 +23 -0
- package/dist/types/hooks/useLineItem/index.d.ts +3 -3
- package/dist/types/hooks/useProduct/index.d.ts +6 -78
- package/dist/types/hooks/useProduct/utils/index.d.ts +6 -4
- package/dist/types/hooks/useProductVariants/index.d.ts +36 -0
- package/dist/types/hooks/useProductVariants/types.d.ts +79 -0
- package/dist/types/hooks/useSearchbar/index.d.ts +1 -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/useListingQuery.d.ts +2 -1
- package/dist/types/listing/components/BasicListingSEO.d.ts +3 -1
- package/dist/types/listing/hooks/useListingMeta.d.ts +4 -0
- package/dist/types/listing/hooks/useSlideFilter.d.ts +4 -0
- package/dist/types/listing/types.d.ts +14 -2
- package/dist/types/navigation/components/SearchBox/Components/EmptyBox/index.d.ts +5 -4
- package/dist/types/navigation/components/SearchBox/index.d.ts +7 -6
- 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/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/index.d.ts +1 -0
- package/package.json +13 -14
- 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,17 +1,29 @@
|
|
1
1
|
Object.defineProperty(exports, "__esModule", {
|
2
2
|
value: true
|
3
3
|
});
|
4
|
-
Object.defineProperty(exports, "
|
4
|
+
Object.defineProperty(exports, "useLineItemFunctions", {
|
5
5
|
enumerable: true,
|
6
6
|
get: function() {
|
7
|
-
return
|
7
|
+
return _lineItemContext.useLineItemFunctions;
|
8
|
+
}
|
9
|
+
});
|
10
|
+
Object.defineProperty(exports, "useLineItemState", {
|
11
|
+
enumerable: true,
|
12
|
+
get: function() {
|
13
|
+
return _lineItemContext.useLineItemState;
|
14
|
+
}
|
15
|
+
});
|
16
|
+
Object.defineProperty(exports, "LineItemStateProvider", {
|
17
|
+
enumerable: true,
|
18
|
+
get: function() {
|
19
|
+
return _lineItemContext.LineItemStateProvider;
|
8
20
|
}
|
9
21
|
});
|
10
22
|
exports.useLineItem = void 0;
|
11
23
|
var _react = _interopRequireDefault(require("react"));
|
12
|
-
var _sdk = require("@sentecacommerce/sdk");
|
13
24
|
var _utils = require("../../utils");
|
14
25
|
var _usePrefetchProduct = require("../usePrefetchProduct");
|
26
|
+
var _lineItemContext = require("./LineItemContext");
|
15
27
|
function _defineProperty(obj, key, value) {
|
16
28
|
if (key in obj) {
|
17
29
|
Object.defineProperty(obj, key, {
|
@@ -32,8 +44,7 @@ function _interopRequireDefault(obj) {
|
|
32
44
|
}
|
33
45
|
function _objectSpread(target) {
|
34
46
|
for(var i = 1; i < arguments.length; i++){
|
35
|
-
var source = arguments[i] != null ? arguments[i] : {
|
36
|
-
};
|
47
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
37
48
|
var ownKeys = Object.keys(source);
|
38
49
|
if (typeof Object.getOwnPropertySymbols === "function") {
|
39
50
|
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
@@ -47,10 +58,10 @@ function _objectSpread(target) {
|
|
47
58
|
return target;
|
48
59
|
}
|
49
60
|
var useLineItem = function(props) {
|
50
|
-
var
|
61
|
+
var ref17 = (0, _usePrefetchProduct).usePrefetchProduct((0, _utils).getTranslatableField(props === null || props === void 0 ? void 0 : props.slug)), onMouseEnter = ref17.onMouseEnter, onMouseLeave = ref17.onMouseLeave, onMouseDown = ref17.onMouseDown;
|
51
62
|
var data = _react.default.useMemo(function() {
|
52
|
-
var
|
53
|
-
var mappedAttributes = (
|
63
|
+
var ref18, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, ref10, ref11, ref12, ref13;
|
64
|
+
var mappedAttributes = (ref18 = Object.keys(props === null || props === void 0 ? void 0 : props.attributes)) === null || ref18 === void 0 ? void 0 : ref18.reduce(function(map, key) {
|
54
65
|
var current = props === null || props === void 0 ? void 0 : props.attributes[key];
|
55
66
|
var ref;
|
56
67
|
map[key] = {
|
@@ -64,18 +75,14 @@ var useLineItem = function(props) {
|
|
64
75
|
})
|
65
76
|
};
|
66
77
|
return map;
|
67
|
-
}, {
|
68
|
-
});
|
78
|
+
}, {});
|
69
79
|
var customFields = props === null || props === void 0 ? void 0 : (ref1 = props.custom) === null || ref1 === void 0 ? void 0 : ref1.reduce(function(map, current) {
|
70
80
|
if (Boolean(current.value) && current.value !== '0') {
|
71
|
-
return _objectSpread({
|
72
|
-
}, map, _defineProperty({
|
73
|
-
}, current.field, current.value));
|
81
|
+
return _objectSpread({}, map, _defineProperty({}, current.field, current.value));
|
74
82
|
}
|
75
83
|
return map;
|
76
|
-
}, {
|
77
|
-
|
78
|
-
var ref13, ref14, ref15;
|
84
|
+
}, {});
|
85
|
+
var ref14, ref15, ref16;
|
79
86
|
return {
|
80
87
|
_id: props === null || props === void 0 ? void 0 : props._id,
|
81
88
|
name: (0, _utils).getTranslatableField(props === null || props === void 0 ? void 0 : props.name),
|
@@ -83,19 +90,21 @@ var useLineItem = function(props) {
|
|
83
90
|
name: (0, _utils).getTranslatableField(props === null || props === void 0 ? void 0 : (ref2 = props.brands) === null || ref2 === void 0 ? void 0 : (ref3 = ref2[0]) === null || ref3 === void 0 ? void 0 : ref3.name),
|
84
91
|
slug: (0, _utils).getTranslatableField(props === null || props === void 0 ? void 0 : (ref4 = props.brands) === null || ref4 === void 0 ? void 0 : (ref5 = ref4[0]) === null || ref5 === void 0 ? void 0 : ref5.slug)
|
85
92
|
},
|
93
|
+
attributes: props === null || props === void 0 ? void 0 : props.attributes,
|
94
|
+
variantAttributes: (ref6 = props) === null || ref6 === void 0 ? void 0 : ref6.variantAttributes,
|
95
|
+
variants: props === null || props === void 0 ? void 0 : props.variants,
|
86
96
|
slug: (0, _utils).getTranslatableField(props === null || props === void 0 ? void 0 : props.slug),
|
87
97
|
collapseKey: props === null || props === void 0 ? void 0 : props.collapseKey,
|
88
98
|
variantId: props === null || props === void 0 ? void 0 : props.variantId,
|
89
|
-
offerId: props === null || props === void 0 ? void 0 : (
|
99
|
+
offerId: props === null || props === void 0 ? void 0 : (ref7 = props.offer) === null || ref7 === void 0 ? void 0 : ref7._id,
|
90
100
|
offer: props === null || props === void 0 ? void 0 : props.offer,
|
91
101
|
sku: props === null || props === void 0 ? void 0 : props.sku,
|
92
|
-
images: (props === null || props === void 0 ? void 0 : props.images) || {
|
93
|
-
},
|
102
|
+
images: (props === null || props === void 0 ? void 0 : props.images) || {},
|
94
103
|
ratings: props === null || props === void 0 ? void 0 : props.reviewRatingStatistics,
|
95
|
-
price: props === null || props === void 0 ? void 0 : (
|
96
|
-
discountedPrice: props === null || props === void 0 ? void 0 : (
|
97
|
-
variantOptions: (
|
98
|
-
variantsCount: (
|
104
|
+
price: props === null || props === void 0 ? void 0 : (ref8 = props.offer) === null || ref8 === void 0 ? void 0 : ref8.originalPrice,
|
105
|
+
discountedPrice: props === null || props === void 0 ? void 0 : (ref9 = props.offer) === null || ref9 === void 0 ? void 0 : ref9.discountedPrice,
|
106
|
+
variantOptions: (ref14 = props === null || props === void 0 ? void 0 : props.variantOptions) !== null && ref14 !== void 0 ? ref14 : 0,
|
107
|
+
variantsCount: (ref15 = props === null || props === void 0 ? void 0 : props.variantsCount) !== null && ref15 !== void 0 ? ref15 : 0,
|
99
108
|
categories: props === null || props === void 0 ? void 0 : props.categories.map(function(category) {
|
100
109
|
return {
|
101
110
|
name: (0, _utils).getTranslatableField(category.name),
|
@@ -103,9 +112,9 @@ var useLineItem = function(props) {
|
|
103
112
|
};
|
104
113
|
}),
|
105
114
|
inventory: {
|
106
|
-
hasAvailableQuantity: (props === null || props === void 0 ? void 0 : (
|
107
|
-
availableQuantity: (props === null || props === void 0 ? void 0 : (
|
108
|
-
maxQuantity: props === null || props === void 0 ? void 0 : (
|
115
|
+
hasAvailableQuantity: (props === null || props === void 0 ? void 0 : (ref10 = props.inventorySnapshot) === null || ref10 === void 0 ? void 0 : ref10.canOrder) ? true : false,
|
116
|
+
availableQuantity: (props === null || props === void 0 ? void 0 : (ref11 = props.inventorySnapshot) === null || ref11 === void 0 ? void 0 : ref11.canOrder) ? (ref16 = props === null || props === void 0 ? void 0 : (ref12 = props.inventorySnapshot) === null || ref12 === void 0 ? void 0 : ref12.availableQuantity) !== null && ref16 !== void 0 ? ref16 : 0 : 0,
|
117
|
+
maxQuantity: props === null || props === void 0 ? void 0 : (ref13 = props.offer) === null || ref13 === void 0 ? void 0 : ref13.maxQuantity
|
109
118
|
},
|
110
119
|
labels: mapLabelData(props === null || props === void 0 ? void 0 : props.labels),
|
111
120
|
getCustomFieldByKey: function(key) {
|
@@ -4,6 +4,11 @@ Object.defineProperty(exports, "__esModule", {
|
|
4
4
|
exports.useLocalRating = void 0;
|
5
5
|
var _react = require("react");
|
6
6
|
var _useProduct = require("../useProduct");
|
7
|
+
function _arrayLikeToArray(arr, len) {
|
8
|
+
if (len == null || len > arr.length) len = arr.length;
|
9
|
+
for(var i = 0, arr2 = new Array(len); i < len; i++)arr2[i] = arr[i];
|
10
|
+
return arr2;
|
11
|
+
}
|
7
12
|
function _arrayWithHoles(arr) {
|
8
13
|
if (Array.isArray(arr)) return arr;
|
9
14
|
}
|
@@ -21,12 +26,14 @@ function _defineProperty(obj, key, value) {
|
|
21
26
|
return obj;
|
22
27
|
}
|
23
28
|
function _iterableToArrayLimit(arr, i) {
|
29
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
30
|
+
if (_i == null) return;
|
24
31
|
var _arr = [];
|
25
32
|
var _n = true;
|
26
33
|
var _d = false;
|
27
|
-
var _e
|
34
|
+
var _s, _e;
|
28
35
|
try {
|
29
|
-
for(
|
36
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
30
37
|
_arr.push(_s.value);
|
31
38
|
if (i && _arr.length === i) break;
|
32
39
|
}
|
@@ -43,12 +50,11 @@ function _iterableToArrayLimit(arr, i) {
|
|
43
50
|
return _arr;
|
44
51
|
}
|
45
52
|
function _nonIterableRest() {
|
46
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
53
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
47
54
|
}
|
48
55
|
function _objectSpread(target) {
|
49
56
|
for(var i = 1; i < arguments.length; i++){
|
50
|
-
var source = arguments[i] != null ? arguments[i] : {
|
51
|
-
};
|
57
|
+
var source = arguments[i] != null ? arguments[i] : {};
|
52
58
|
var ownKeys = Object.keys(source);
|
53
59
|
if (typeof Object.getOwnPropertySymbols === "function") {
|
54
60
|
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
@@ -62,10 +68,18 @@ function _objectSpread(target) {
|
|
62
68
|
return target;
|
63
69
|
}
|
64
70
|
function _slicedToArray(arr, i) {
|
65
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
71
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
72
|
+
}
|
73
|
+
function _unsupportedIterableToArray(o, minLen) {
|
74
|
+
if (!o) return;
|
75
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
76
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
77
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
78
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
79
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
66
80
|
}
|
67
|
-
var useLocalRating = function(
|
68
|
-
var storageKey =
|
81
|
+
var useLocalRating = function() {
|
82
|
+
var storageKey = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : '__RATINGS__';
|
69
83
|
var ref, ref1;
|
70
84
|
var metaData = (0, _useProduct).useProductState().metaData;
|
71
85
|
var ref2 = _slicedToArray((0, _react).useState({
|
@@ -101,8 +115,7 @@ var useLocalRating = function(param) {
|
|
101
115
|
value: newValue,
|
102
116
|
count: rating.count + 1
|
103
117
|
});
|
104
|
-
return _objectSpread({
|
105
|
-
}, item, {
|
118
|
+
return _objectSpread({}, item, {
|
106
119
|
value: newValue,
|
107
120
|
count: rating.count + 1
|
108
121
|
});
|
@@ -6,6 +6,11 @@ var _regeneratorRuntime = _interopRequireDefault(require("regenerator-runtime"))
|
|
6
6
|
var _react = _interopRequireDefault(require("react"));
|
7
7
|
var _reactQuery = require("react-query");
|
8
8
|
var _ = require("../../");
|
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
|
+
}
|
9
14
|
function _arrayWithHoles(arr) {
|
10
15
|
if (Array.isArray(arr)) return arr;
|
11
16
|
}
|
@@ -44,12 +49,14 @@ function _interopRequireDefault(obj) {
|
|
44
49
|
};
|
45
50
|
}
|
46
51
|
function _iterableToArrayLimit(arr, i) {
|
52
|
+
var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
|
53
|
+
if (_i == null) return;
|
47
54
|
var _arr = [];
|
48
55
|
var _n = true;
|
49
56
|
var _d = false;
|
50
|
-
var _e
|
57
|
+
var _s, _e;
|
51
58
|
try {
|
52
|
-
for(
|
59
|
+
for(_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true){
|
53
60
|
_arr.push(_s.value);
|
54
61
|
if (i && _arr.length === i) break;
|
55
62
|
}
|
@@ -66,10 +73,18 @@ function _iterableToArrayLimit(arr, i) {
|
|
66
73
|
return _arr;
|
67
74
|
}
|
68
75
|
function _nonIterableRest() {
|
69
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
76
|
+
throw new TypeError("Invalid attempt to destructure non-iterable instance.\\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
|
70
77
|
}
|
71
78
|
function _slicedToArray(arr, i) {
|
72
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
79
|
+
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
|
80
|
+
}
|
81
|
+
function _unsupportedIterableToArray(o, minLen) {
|
82
|
+
if (!o) return;
|
83
|
+
if (typeof o === "string") return _arrayLikeToArray(o, minLen);
|
84
|
+
var n = Object.prototype.toString.call(o).slice(8, -1);
|
85
|
+
if (n === "Object" && o.constructor) n = o.constructor.name;
|
86
|
+
if (n === "Map" || n === "Set") return Array.from(n);
|
87
|
+
if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen);
|
73
88
|
}
|
74
89
|
var usePrefetchProduct = function(slug) {
|
75
90
|
var queryCache = (0, _reactQuery).useQueryCache();
|
@@ -1,141 +1,58 @@
|
|
1
1
|
Object.defineProperty(exports, "__esModule", {
|
2
2
|
value: true
|
3
3
|
});
|
4
|
-
Object.defineProperty(exports, "AssetSourceDTO", {
|
5
|
-
enumerable: true,
|
6
|
-
get: function() {
|
7
|
-
return _sdk.AssetSourceDTO;
|
8
|
-
}
|
9
|
-
});
|
10
4
|
exports.ProductProvider = ProductProvider;
|
11
5
|
exports.useProductState = useProductState;
|
12
6
|
exports.useProductFunctions = useProductFunctions;
|
13
7
|
exports.useProduct = useProduct;
|
14
8
|
var _react = _interopRequireDefault(require("react"));
|
15
|
-
var _sdk = require("@sentecacommerce/sdk");
|
16
9
|
var _ = require("../../");
|
17
10
|
var _utils = require("./utils");
|
18
11
|
var _productsApi = require("../../api/productsApi");
|
19
12
|
var _assetsToMap = require("../../utils/assetsToMap");
|
20
|
-
|
21
|
-
if (Array.isArray(arr)) return arr;
|
22
|
-
}
|
23
|
-
function _arrayWithoutHoles(arr) {
|
24
|
-
if (Array.isArray(arr)) {
|
25
|
-
for(var i = 0, arr2 = new Array(arr.length); i < arr.length; i++){
|
26
|
-
arr2[i] = arr[i];
|
27
|
-
}
|
28
|
-
return arr2;
|
29
|
-
}
|
30
|
-
}
|
31
|
-
function _defineProperty(obj, key, value) {
|
32
|
-
if (key in obj) {
|
33
|
-
Object.defineProperty(obj, key, {
|
34
|
-
value: value,
|
35
|
-
enumerable: true,
|
36
|
-
configurable: true,
|
37
|
-
writable: true
|
38
|
-
});
|
39
|
-
} else {
|
40
|
-
obj[key] = value;
|
41
|
-
}
|
42
|
-
return obj;
|
43
|
-
}
|
13
|
+
var _useProductVariants = require("../useProductVariants");
|
44
14
|
function _interopRequireDefault(obj) {
|
45
15
|
return obj && obj.__esModule ? obj : {
|
46
16
|
default: obj
|
47
17
|
};
|
48
18
|
}
|
49
|
-
function _iterableToArray(iter) {
|
50
|
-
if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter);
|
51
|
-
}
|
52
|
-
function _iterableToArrayLimit(arr, i) {
|
53
|
-
var _arr = [];
|
54
|
-
var _n = true;
|
55
|
-
var _d = false;
|
56
|
-
var _e = undefined;
|
57
|
-
try {
|
58
|
-
for(var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true){
|
59
|
-
_arr.push(_s.value);
|
60
|
-
if (i && _arr.length === i) break;
|
61
|
-
}
|
62
|
-
} catch (err) {
|
63
|
-
_d = true;
|
64
|
-
_e = err;
|
65
|
-
} finally{
|
66
|
-
try {
|
67
|
-
if (!_n && _i["return"] != null) _i["return"]();
|
68
|
-
} finally{
|
69
|
-
if (_d) throw _e;
|
70
|
-
}
|
71
|
-
}
|
72
|
-
return _arr;
|
73
|
-
}
|
74
|
-
function _nonIterableRest() {
|
75
|
-
throw new TypeError("Invalid attempt to destructure non-iterable instance");
|
76
|
-
}
|
77
|
-
function _nonIterableSpread() {
|
78
|
-
throw new TypeError("Invalid attempt to spread non-iterable instance");
|
79
|
-
}
|
80
|
-
function _objectSpread(target) {
|
81
|
-
for(var i = 1; i < arguments.length; i++){
|
82
|
-
var source = arguments[i] != null ? arguments[i] : {
|
83
|
-
};
|
84
|
-
var ownKeys = Object.keys(source);
|
85
|
-
if (typeof Object.getOwnPropertySymbols === "function") {
|
86
|
-
ownKeys = ownKeys.concat(Object.getOwnPropertySymbols(source).filter(function(sym) {
|
87
|
-
return Object.getOwnPropertyDescriptor(source, sym).enumerable;
|
88
|
-
}));
|
89
|
-
}
|
90
|
-
ownKeys.forEach(function(key) {
|
91
|
-
_defineProperty(target, key, source[key]);
|
92
|
-
});
|
93
|
-
}
|
94
|
-
return target;
|
95
|
-
}
|
96
|
-
function _slicedToArray(arr, i) {
|
97
|
-
return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest();
|
98
|
-
}
|
99
|
-
function _toConsumableArray(arr) {
|
100
|
-
return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread();
|
101
|
-
}
|
102
19
|
var ProductStateContext = /*#__PURE__*/ _react.default.createContext(undefined);
|
103
20
|
var CountDispatchContext = /*#__PURE__*/ _react.default.createContext(undefined);
|
104
21
|
function ProductProvider(param) {
|
105
|
-
var product = param.product, children = param.children, defaultVariantId = param.defaultVariantId;
|
106
|
-
var
|
107
|
-
|
108
|
-
|
109
|
-
|
22
|
+
var product = param.product, children = param.children, defaultVariantId = param.defaultVariantId, _includeBrandInName = param.includeBrandInName, includeBrandInName = _includeBrandInName === void 0 ? false : _includeBrandInName;
|
23
|
+
var ref38 = (0, _useProductVariants).useProductVariants({
|
24
|
+
product: product,
|
25
|
+
defaultVariantId: defaultVariantId
|
26
|
+
}), selectedVariant = ref38.selectedVariant, attributeRules = ref38.attributeRules, variants = ref38.variants, getVariantById = ref38.getVariantById, getVariantByAttribute = ref38.getVariantByAttribute, getVariantByCombination = ref38.getVariantByCombination, getCustomFieldValue = ref38.getCustomFieldValue, getCombinationsForAttributeRule = ref38.getCombinationsForAttributeRule, selectVariantById = ref38.selectVariantById, selectVariantByAttribute = ref38.selectVariantByAttribute, getAllPossibleSizesForCurrentVariant = ref38.getAllPossibleSizesForCurrentVariant, selectVariantByCombination = ref38.selectVariantByCombination, selectVariantOptions = ref38.selectVariantOptions;
|
110
27
|
var metaData = _react.default.useMemo(function() {
|
111
|
-
var ref, ref5, ref6, ref7, ref8, ref9, ref10, ref11, ref12, ref13, ref14, ref15, ref16, ref17, ref18, ref19, ref20, ref21, ref22, ref23, ref24, ref25, ref26, ref27, ref28, ref29, ref30, ref31, ref32, ref33, ref34, ref35;
|
28
|
+
var ref, ref1, ref2, ref3, ref4, ref5, ref6, ref7, ref8, ref9, ref10, ref11, ref12, ref13, ref14, ref15, ref16, ref17, ref18, ref19, ref20, ref21, ref22, ref23, ref24, ref25, ref26, ref27, ref28, ref29, ref30, ref31, ref32, ref33, ref34, ref35, ref36, ref37;
|
112
29
|
var rootCategory = product === null || product === void 0 ? void 0 : (ref = product.categories) === null || ref === void 0 ? void 0 : ref[0];
|
113
30
|
var rootCategoryId = rootCategory === null || rootCategory === void 0 ? void 0 : rootCategory.resourceId;
|
114
31
|
var metaObj = {
|
115
32
|
_id: product === null || product === void 0 ? void 0 : product._id,
|
116
|
-
name: (0, _).getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.name) || (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : product.name),
|
33
|
+
name: includeBrandInName && (product === null || product === void 0 ? void 0 : (ref1 = product.brands) === null || ref1 === void 0 ? void 0 : (ref2 = ref1[0]) === null || ref2 === void 0 ? void 0 : (ref3 = ref2.resource) === null || ref3 === void 0 ? void 0 : ref3.name) ? "".concat((0, _).getTranslatableField(product === null || product === void 0 ? void 0 : (ref4 = product.brands) === null || ref4 === void 0 ? void 0 : (ref5 = ref4[0]) === null || ref5 === void 0 ? void 0 : (ref6 = ref5.resource) === null || ref6 === void 0 ? void 0 : ref6.name), " ").concat((0, _).getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.name) || (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : product.name)) : (0, _).getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.name) || (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : product.name),
|
117
34
|
slug: (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : product.slug),
|
118
35
|
description: (0, _).getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.description) || (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : product.description),
|
119
36
|
shortDescription: (0, _).getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.metaDescription) || (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : product.metaDescription),
|
120
37
|
brand: {
|
121
|
-
_id: product === null || product === void 0 ? void 0 : (
|
122
|
-
name: (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : (
|
123
|
-
slug: (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : (
|
124
|
-
logo: product === null || product === void 0 ? void 0 : (
|
38
|
+
_id: product === null || product === void 0 ? void 0 : (ref7 = product.brands) === null || ref7 === void 0 ? void 0 : (ref8 = ref7[0]) === null || ref8 === void 0 ? void 0 : ref8.resourceId,
|
39
|
+
name: (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : (ref9 = product.brands) === null || ref9 === void 0 ? void 0 : (ref10 = ref9[0]) === null || ref10 === void 0 ? void 0 : (ref11 = ref10.resource) === null || ref11 === void 0 ? void 0 : ref11.name),
|
40
|
+
slug: (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : (ref12 = product.brands) === null || ref12 === void 0 ? void 0 : (ref13 = ref12[0]) === null || ref13 === void 0 ? void 0 : (ref14 = ref13.resource) === null || ref14 === void 0 ? void 0 : ref14.slug),
|
41
|
+
logo: product === null || product === void 0 ? void 0 : (ref15 = product.brands) === null || ref15 === void 0 ? void 0 : (ref16 = ref15[0]) === null || ref16 === void 0 ? void 0 : (ref17 = ref16.resource) === null || ref17 === void 0 ? void 0 : (ref18 = ref17.assets) === null || ref18 === void 0 ? void 0 : (ref19 = ref18[0]) === null || ref19 === void 0 ? void 0 : (ref20 = ref19.sources) === null || ref20 === void 0 ? void 0 : (ref21 = ref20[0]) === null || ref21 === void 0 ? void 0 : ref21.url
|
125
42
|
},
|
126
43
|
category: {
|
127
|
-
_id: product === null || product === void 0 ? void 0 : (
|
128
|
-
name: (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : (
|
129
|
-
slug: (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : (
|
44
|
+
_id: product === null || product === void 0 ? void 0 : (ref23 = product.categories) === null || ref23 === void 0 ? void 0 : (ref24 = ref23[(product === null || product === void 0 ? void 0 : (ref22 = product.categories) === null || ref22 === void 0 ? void 0 : ref22.length) - 1]) === null || ref24 === void 0 ? void 0 : ref24.resourceId,
|
45
|
+
name: (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : (ref26 = product.categories) === null || ref26 === void 0 ? void 0 : (ref27 = ref26[(product === null || product === void 0 ? void 0 : (ref25 = product.categories) === null || ref25 === void 0 ? void 0 : ref25.length) - 1]) === null || ref27 === void 0 ? void 0 : (ref28 = ref27.resource) === null || ref28 === void 0 ? void 0 : ref28.name),
|
46
|
+
slug: (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : (ref30 = product.categories) === null || ref30 === void 0 ? void 0 : (ref31 = ref30[(product === null || product === void 0 ? void 0 : (ref29 = product.categories) === null || ref29 === void 0 ? void 0 : ref29.length) - 1]) === null || ref31 === void 0 ? void 0 : (ref32 = ref31.resource) === null || ref32 === void 0 ? void 0 : ref32.slug)
|
130
47
|
},
|
131
48
|
rootCategory: {
|
132
49
|
_id: rootCategoryId,
|
133
|
-
name: (0, _).getTranslatableField(rootCategory === null || rootCategory === void 0 ? void 0 : (
|
134
|
-
slug: (0, _).getTranslatableField(rootCategory === null || rootCategory === void 0 ? void 0 : (
|
50
|
+
name: (0, _).getTranslatableField(rootCategory === null || rootCategory === void 0 ? void 0 : (ref33 = rootCategory.resource) === null || ref33 === void 0 ? void 0 : ref33.name),
|
51
|
+
slug: (0, _).getTranslatableField(rootCategory === null || rootCategory === void 0 ? void 0 : (ref34 = rootCategory.resource) === null || ref34 === void 0 ? void 0 : ref34.slug)
|
135
52
|
},
|
136
53
|
categories: (0, _utils).formatCategories(product === null || product === void 0 ? void 0 : product.categories, rootCategoryId),
|
137
54
|
reviewRatingStatistics: product === null || product === void 0 ? void 0 : product.reviewRatingStatistics,
|
138
|
-
content: Boolean(selectedVariant === null || selectedVariant === void 0 ? void 0 : (
|
55
|
+
content: Boolean(selectedVariant === null || selectedVariant === void 0 ? void 0 : (ref35 = selectedVariant.content) === null || ref35 === void 0 ? void 0 : ref35.map(_utils.createProductContent).length) ? selectedVariant === null || selectedVariant === void 0 ? void 0 : (ref36 = selectedVariant.content) === null || ref36 === void 0 ? void 0 : ref36.map(_utils.createProductContent) : product === null || product === void 0 ? void 0 : (ref37 = product.content) === null || ref37 === void 0 ? void 0 : ref37.map(_utils.createProductContent),
|
139
56
|
assets: (0, _assetsToMap).assetsFieldsToMap(product === null || product === void 0 ? void 0 : product.assets)
|
140
57
|
};
|
141
58
|
return metaObj;
|
@@ -151,8 +68,11 @@ function ProductProvider(param) {
|
|
151
68
|
selectedVariant,
|
152
69
|
]);
|
153
70
|
var seoData = _react.default.useMemo(function() {
|
71
|
+
var ref, ref39, ref40;
|
72
|
+
var title = (0, _).getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.metaTitle) || (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : product.metaTitle);
|
73
|
+
var brandName = product === null || product === void 0 ? void 0 : (ref = product.brands) === null || ref === void 0 ? void 0 : (ref39 = ref[0]) === null || ref39 === void 0 ? void 0 : (ref40 = ref39.resource) === null || ref40 === void 0 ? void 0 : ref40.name;
|
154
74
|
var seoObj = {
|
155
|
-
title:
|
75
|
+
title: includeBrandInName && brandName ? "".concat(brandName, " ").concat(title) : title,
|
156
76
|
description: (0, _).getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.metaDescription) || (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : product.metaDescription),
|
157
77
|
keywords: (0, _).getTranslatableField(selectedVariant === null || selectedVariant === void 0 ? void 0 : selectedVariant.metaKeywords) || (0, _).getTranslatableField(product === null || product === void 0 ? void 0 : product.metaKeywords)
|
158
78
|
};
|
@@ -163,175 +83,6 @@ function ProductProvider(param) {
|
|
163
83
|
product === null || product === void 0 ? void 0 : product.metaTitle,
|
164
84
|
selectedVariant,
|
165
85
|
]);
|
166
|
-
var customFields = _react.default.useMemo(function() {
|
167
|
-
var mappedFields = (0, _utils).createCustomFieldsMap(product === null || product === void 0 ? void 0 : product.custom);
|
168
|
-
return mappedFields;
|
169
|
-
}, [
|
170
|
-
product === null || product === void 0 ? void 0 : product.custom
|
171
|
-
]);
|
172
|
-
_react.default.useEffect(function() {
|
173
|
-
// prevent unnecessary calculations
|
174
|
-
if (mounted) {
|
175
|
-
setVariants(getVariantsWithInventory());
|
176
|
-
}
|
177
|
-
}, [
|
178
|
-
product
|
179
|
-
]);
|
180
|
-
_react.default.useMemo(function() {
|
181
|
-
// prevent unnecessary calculations
|
182
|
-
if (!mounted) {
|
183
|
-
return setMounted(true);
|
184
|
-
}
|
185
|
-
var data = getCombinationsAndAttributeRules();
|
186
|
-
setCombinationsAndAttributeRules(data);
|
187
|
-
}, [
|
188
|
-
variants
|
189
|
-
]);
|
190
|
-
function getVariantsWithInventory() {
|
191
|
-
var ref40;
|
192
|
-
var variantsWithInventory = product === null || product === void 0 ? void 0 : (ref40 = product.variants) === null || ref40 === void 0 ? void 0 : ref40.reduce(function(map, _, index, arr) {
|
193
|
-
var ref41, ref37, ref38, ref39;
|
194
|
-
var currentVariant = arr[index];
|
195
|
-
var mappedAttributes = (0, _utils).createMappedAttributes(currentVariant);
|
196
|
-
var mappedOptions = (0, _utils).createMappedOptions(currentVariant === null || currentVariant === void 0 ? void 0 : currentVariant.availableOptions) || [];
|
197
|
-
var isAvailable = currentVariant === null || currentVariant === void 0 ? void 0 : (ref41 = currentVariant.inventorySnapshot) === null || ref41 === void 0 ? void 0 : ref41.canOrder;
|
198
|
-
var updatedVariant = _objectSpread({
|
199
|
-
}, currentVariant, {
|
200
|
-
inventory: {
|
201
|
-
hasAvailableQuantity: (ref37 = currentVariant.inventorySnapshot) === null || ref37 === void 0 ? void 0 : ref37.canOrder,
|
202
|
-
availableQuantity: (ref38 = currentVariant.inventorySnapshot) === null || ref38 === void 0 ? void 0 : ref38.availableQuantity
|
203
|
-
},
|
204
|
-
isAvailable: isAvailable ? true : false,
|
205
|
-
quantity: isAvailable ? currentVariant === null || currentVariant === void 0 ? void 0 : (ref39 = currentVariant.inventorySnapshot) === null || ref39 === void 0 ? void 0 : ref39.availableQuantity : 0,
|
206
|
-
attributes: mappedAttributes,
|
207
|
-
options: mappedOptions,
|
208
|
-
selectedOptions: [],
|
209
|
-
labels: (0, _utils).createLabelsMap(currentVariant.labels),
|
210
|
-
getAttribute: function(rule) {
|
211
|
-
return getSelectedAttribute(rule, mappedAttributes);
|
212
|
-
},
|
213
|
-
getAttributeByKey: function(key) {
|
214
|
-
var ref;
|
215
|
-
return (ref = mappedAttributes.find(function(a) {
|
216
|
-
return a.name === key;
|
217
|
-
})) === null || ref === void 0 ? void 0 : ref.value;
|
218
|
-
},
|
219
|
-
getAvailabilityByStore: function() {
|
220
|
-
var ref;
|
221
|
-
return (0, _utils).processAvailabilityPerStore(currentVariant === null || currentVariant === void 0 ? void 0 : (ref = currentVariant.inventorySnapshot) === null || ref === void 0 ? void 0 : ref.availabilities);
|
222
|
-
}
|
223
|
-
});
|
224
|
-
map[currentVariant._id] = updatedVariant;
|
225
|
-
return map;
|
226
|
-
}, {
|
227
|
-
});
|
228
|
-
return variantsWithInventory || {
|
229
|
-
};
|
230
|
-
}
|
231
|
-
function getCombinationsAndAttributeRules() {
|
232
|
-
var mappedAttributeRules = (0, _utils).createAttributeRulesMap(product);
|
233
|
-
var attributesWithId = Object.keys(variants || {
|
234
|
-
}).map(function(key) {
|
235
|
-
return {
|
236
|
-
variantId: variants === null || variants === void 0 ? void 0 : variants[key]._id,
|
237
|
-
attributes: variants === null || variants === void 0 ? void 0 : variants[key].attributes
|
238
|
-
};
|
239
|
-
});
|
240
|
-
var combinationsMap = (0, _utils).createCombinationsMap(Object.keys(mappedAttributeRules), attributesWithId);
|
241
|
-
(0, _utils).assignCombinationsToAttributeRules(mappedAttributeRules, combinationsMap);
|
242
|
-
return {
|
243
|
-
combinations: combinationsMap,
|
244
|
-
attributeRules: mappedAttributeRules
|
245
|
-
};
|
246
|
-
}
|
247
|
-
function getDefaultVariant() {
|
248
|
-
if (!defaultVariantId) return null;
|
249
|
-
return variants[defaultVariantId];
|
250
|
-
}
|
251
|
-
function selectVariantById(id) {
|
252
|
-
setSelectedVariant(variants[id]);
|
253
|
-
}
|
254
|
-
function selectVariantByAttribute(key) {
|
255
|
-
var ref;
|
256
|
-
// Get by collapseKey for SD
|
257
|
-
var split = key.split(':');
|
258
|
-
if (split[0] === 'collapseKey') {
|
259
|
-
var id = Object.keys(variants).find(function(el) {
|
260
|
-
return variants[el].collapseKey === split[1];
|
261
|
-
});
|
262
|
-
return setSelectedVariant(variants[id]);
|
263
|
-
}
|
264
|
-
var id1 = (ref = combinations[key]) === null || ref === void 0 ? void 0 : ref.value;
|
265
|
-
setSelectedVariant(variants[id1]);
|
266
|
-
}
|
267
|
-
function selectVariantByCombination(key, value) {
|
268
|
-
// Take collapseKey for SD
|
269
|
-
var split = value.split(':');
|
270
|
-
if (split[0] === 'collapseKey') {
|
271
|
-
var id = Object.keys(variants).find(function(el) {
|
272
|
-
var ref;
|
273
|
-
return variants[el].collapseKey === split[1] && ((ref = variants[el].attributes.find(function(attr) {
|
274
|
-
return attr.name === 'size';
|
275
|
-
})) === null || ref === void 0 ? void 0 : ref.value) === key;
|
276
|
-
});
|
277
|
-
return setSelectedVariant(variants[id]);
|
278
|
-
}
|
279
|
-
var id2 = combinations[key].params[value];
|
280
|
-
setSelectedVariant(variants[id2]);
|
281
|
-
}
|
282
|
-
function selectVariantOptions(definitionKey, optionKey) {
|
283
|
-
if (selectedVariant) {
|
284
|
-
var newSelectedVariant = _objectSpread({
|
285
|
-
}, selectedVariant);
|
286
|
-
newSelectedVariant.selectedOptions = newSelectedVariant.selectedOptions.filter(function(opt) {
|
287
|
-
return opt.definitionKey !== definitionKey;
|
288
|
-
});
|
289
|
-
newSelectedVariant.selectedOptions = _toConsumableArray(newSelectedVariant.selectedOptions).concat([
|
290
|
-
{
|
291
|
-
definitionKey: definitionKey,
|
292
|
-
optionKey: optionKey
|
293
|
-
},
|
294
|
-
]);
|
295
|
-
newSelectedVariant.mappedSelectedOptions = newSelectedVariant.selectedOptions.map(function(option) {
|
296
|
-
return (0, _utils).createSelectedOption2(newSelectedVariant.options, option);
|
297
|
-
});
|
298
|
-
setSelectedVariant(newSelectedVariant);
|
299
|
-
}
|
300
|
-
}
|
301
|
-
function getSelectedAttribute(rule, attributes) {
|
302
|
-
var ref;
|
303
|
-
var attributeRule = (ref = attributeRules[rule]) === null || ref === void 0 ? void 0 : ref.values;
|
304
|
-
var result;
|
305
|
-
attributes.forEach(function(currentKey) {
|
306
|
-
var found = attributeRule === null || attributeRule === void 0 ? void 0 : attributeRule[currentKey.value];
|
307
|
-
if (found) result = _objectSpread({
|
308
|
-
id: currentKey.value,
|
309
|
-
name: rule
|
310
|
-
}, found);
|
311
|
-
});
|
312
|
-
return result;
|
313
|
-
}
|
314
|
-
function getVariantById(id) {
|
315
|
-
return variants === null || variants === void 0 ? void 0 : variants[id];
|
316
|
-
}
|
317
|
-
function getVariantByAttribute(key) {
|
318
|
-
var ref;
|
319
|
-
var id = (ref = combinations[key]) === null || ref === void 0 ? void 0 : ref.value;
|
320
|
-
return variants === null || variants === void 0 ? void 0 : variants[id];
|
321
|
-
}
|
322
|
-
function getVariantByCombination(key, value) {
|
323
|
-
var ref;
|
324
|
-
var id = (ref = combinations[key]) === null || ref === void 0 ? void 0 : ref.params[value];
|
325
|
-
return variants === null || variants === void 0 ? void 0 : variants[id];
|
326
|
-
}
|
327
|
-
function getCustomFieldValue(field) {
|
328
|
-
return customFields === null || customFields === void 0 ? void 0 : customFields[field];
|
329
|
-
}
|
330
|
-
function getCombinationsForAttributeRule(key, id) {
|
331
|
-
var ref, ref42;
|
332
|
-
var result = attributeRules === null || attributeRules === void 0 ? void 0 : (ref = attributeRules[key]) === null || ref === void 0 ? void 0 : (ref42 = ref.values) === null || ref42 === void 0 ? void 0 : ref42[id];
|
333
|
-
return result;
|
334
|
-
}
|
335
86
|
var collapsedImages = (0, _utils).createCollapseKeyImagesMap(product);
|
336
87
|
var state = {
|
337
88
|
metaData: metaData,
|
@@ -348,6 +99,7 @@ function ProductProvider(param) {
|
|
348
99
|
selectVariantById: selectVariantById,
|
349
100
|
selectVariantByAttribute: selectVariantByAttribute,
|
350
101
|
selectVariantByCombination: selectVariantByCombination,
|
102
|
+
getAllPossibleSizesForCurrentVariant: getAllPossibleSizesForCurrentVariant,
|
351
103
|
getCombinationsForAttributeRule: getCombinationsForAttributeRule,
|
352
104
|
selectVariantOptions: selectVariantOptions,
|
353
105
|
getCustomFieldValue: getCustomFieldValue,
|