@graphcommerce/magento-product 9.0.0-canary.101 → 9.0.0-canary.104
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +140 -1309
- package/components/AddProductsToCart/AddProductsToCartButton.tsx +4 -5
- package/components/AddProductsToCart/AddProductsToCartError.tsx +2 -1
- package/components/AddProductsToCart/AddProductsToCartFab.tsx +5 -6
- package/components/AddProductsToCart/AddProductsToCartForm.tsx +15 -19
- package/components/AddProductsToCart/AddProductsToCartQuantity.tsx +5 -3
- package/components/AddProductsToCart/AddProductsToCartSnackbar.tsx +2 -1
- package/components/AddProductsToCart/AddProductsToCartSnackbarMessage.tsx +5 -6
- package/components/AddProductsToCart/findAddedItems.ts +2 -2
- package/components/AddProductsToCart/toUserErrors.ts +2 -2
- package/components/AddProductsToCart/useAddProductsToCartAction.ts +4 -3
- package/components/AddProductsToCart/useFormAddProductsToCart.ts +3 -3
- package/components/JsonLdProduct/ProductPageJsonLd.tsx +1 -1
- package/components/JsonLdProduct/jsonLdProduct.tsx +2 -2
- package/components/ProductAddToCart/ProductAddToCart.tsx +8 -5
- package/components/ProductCustomizable/CustomizableAreaOption.tsx +4 -3
- package/components/ProductCustomizable/CustomizableCheckboxOption.tsx +3 -7
- package/components/ProductCustomizable/CustomizableDateOption.tsx +2 -2
- package/components/ProductCustomizable/CustomizableDropDownOption.tsx +5 -5
- package/components/ProductCustomizable/CustomizableFieldOption.tsx +2 -2
- package/components/ProductCustomizable/CustomizableMultipleOption.tsx +3 -7
- package/components/ProductCustomizable/CustomizableRadioOption.tsx +3 -7
- package/components/ProductCustomizable/ProductCustomizable.tsx +6 -5
- package/components/ProductFiltersPro/PriceSlider.tsx +4 -2
- package/components/ProductFiltersPro/ProductFilterEqualChip.tsx +1 -1
- package/components/ProductFiltersPro/ProductFilterEqualSection.tsx +1 -1
- package/components/ProductFiltersPro/ProductFilterRangeChip.tsx +1 -1
- package/components/ProductFiltersPro/ProductFiltersPro.tsx +10 -19
- package/components/ProductFiltersPro/ProductFiltersProAggregations.tsx +2 -2
- package/components/ProductFiltersPro/ProductFiltersProAllFiltersChip.tsx +5 -6
- package/components/ProductFiltersPro/ProductFiltersProAllFiltersSidebar.tsx +7 -12
- package/components/ProductFiltersPro/ProductFiltersProCategorySection.tsx +6 -8
- package/components/ProductFiltersPro/ProductFiltersProChips.tsx +1 -1
- package/components/ProductFiltersPro/ProductFiltersProClearAll.tsx +2 -2
- package/components/ProductFiltersPro/ProductFiltersProLayoutSidebar.tsx +5 -3
- package/components/ProductFiltersPro/ProductFiltersProLimitChip.tsx +4 -2
- package/components/ProductFiltersPro/ProductFiltersProLimitSection.tsx +3 -2
- package/components/ProductFiltersPro/ProductFiltersProNoResults.tsx +3 -2
- package/components/ProductFiltersPro/ProductFiltersProSortChip.tsx +4 -2
- package/components/ProductFiltersPro/ProductFiltersProSortDirectionArrow.tsx +1 -1
- package/components/ProductFiltersPro/ProductFiltersProSortSection.tsx +3 -2
- package/components/ProductFiltersPro/activeAggregations.ts +2 -2
- package/components/ProductFiltersPro/applyAggregationCount.ts +2 -2
- package/components/ProductFiltersPro/useProductFiltersProClearAllAction.ts +1 -1
- package/components/ProductFiltersPro/useProductFiltersProSort.tsx +3 -3
- package/components/ProductListCount/ProductListCount.tsx +3 -2
- package/components/ProductListFilters/FilterCheckboxType.tsx +5 -4
- package/components/ProductListFilters/FilterEqualType.tsx +6 -6
- package/components/ProductListFilters/FilterRangeType.tsx +3 -2
- package/components/ProductListFilters/ProductListFilters.tsx +3 -3
- package/components/ProductListFiltersContainer/ProductListFiltersContainer.tsx +5 -4
- package/components/ProductListItem/ProductDiscountLabel.tsx +4 -3
- package/components/ProductListItem/ProductListItem.tsx +10 -15
- package/components/ProductListItem/ProductListItemImage.tsx +4 -2
- package/components/ProductListItem/ProductListItemImageContainer.tsx +8 -7
- package/components/ProductListItem/ProductListItemLinkOrDiv.tsx +2 -1
- package/components/ProductListItem/ProductListItemTitleAndPrice.tsx +4 -3
- package/components/ProductListItems/ProductListItemsBase.tsx +5 -4
- package/components/ProductListItems/ProductListParamsProvider.tsx +2 -2
- package/components/ProductListItems/filterTypes.tsx +4 -4
- package/components/ProductListItems/filteredProductList.tsx +2 -2
- package/components/ProductListItems/getFilterTypes.ts +2 -1
- package/components/ProductListItems/productListApplyCategoryDefaults.ts +5 -4
- package/components/ProductListItems/renderer.tsx +2 -2
- package/components/ProductListLink/ProductListLink.tsx +5 -3
- package/components/ProductListPagination/ProductListPagination.tsx +6 -5
- package/components/ProductListPrice/ProductListPrice.tsx +3 -2
- package/components/ProductListSort/ProductListSort.tsx +8 -6
- package/components/ProductListSuggestions/ProductListSuggestions.tsx +1 -1
- package/components/ProductPage/ProductPageAddToCartRow.tsx +3 -2
- package/components/ProductPageBreadcrumb/ProductPageBreadcrumb.tsx +3 -2
- package/components/ProductPageBreadcrumb/ProductPageBreadcrumbs.tsx +3 -3
- package/components/ProductPageCategory/productPageCategory.ts +1 -1
- package/components/ProductPageDescription/ProductPageDescription.tsx +7 -6
- package/components/ProductPageGallery/ProductImage.tsx +1 -1
- package/components/ProductPageGallery/ProductPageGallery.tsx +3 -7
- package/components/ProductPageGallery/ProductVideo.tsx +1 -1
- package/components/ProductPageMeta/ProductPageMeta.tsx +2 -2
- package/components/ProductPageName/ProductPageName.tsx +2 -2
- package/components/ProductPagePrice/ProductPagePrice.tsx +5 -6
- package/components/ProductPagePrice/ProductPagePriceTiers.tsx +2 -2
- package/components/ProductPagePrice/getProductTierPrice.ts +2 -2
- package/components/ProductPagePrice/useCustomizableOptionPrice.ts +7 -6
- package/components/ProductScroller/ProductScroller.tsx +10 -15
- package/components/ProductShortDescription/ProductShortDescription.tsx +3 -2
- package/components/ProductSidebarDelivery/ProductSidebarDelivery.tsx +3 -3
- package/components/ProductSpecs/ProductSpecs.tsx +5 -4
- package/components/ProductSpecs/ProductSpecsAggregations.tsx +2 -2
- package/components/ProductSpecs/ProductSpecsCustomAttributes.tsx +3 -3
- package/components/ProductStaticPaths/getProductStaticPaths.ts +4 -3
- package/components/ProductStaticPaths/getSitemapPaths.ts +2 -2
- package/components/ProductWeight/ProductWeight.tsx +4 -7
- package/context/productListParamsContext.ts +1 -1
- package/hooks/useProductLink.ts +1 -1
- package/hooks/useProductList.ts +11 -14
- package/hooks/useProductListLink.ts +7 -5
- package/hooks/useProductListLinkReplace.ts +1 -1
- package/package.json +14 -14
- package/test/productURL.fixture.ts +1 -1
- package/tsconfig.json +1 -1
@@ -1,9 +1,10 @@
|
|
1
1
|
import { usePrevPageRouter } from '@graphcommerce/framer-next-pages'
|
2
2
|
import { filterNonNullableKeys } from '@graphcommerce/next-ui'
|
3
3
|
import { Trans } from '@lingui/react'
|
4
|
-
import {
|
4
|
+
import type { BreadcrumbsProps } from '@mui/material'
|
5
|
+
import { Breadcrumbs, Link, Typography } from '@mui/material'
|
5
6
|
import { productPageCategory } from '../ProductPageCategory/productPageCategory'
|
6
|
-
import { ProductPageBreadcrumbFragment } from './ProductPageBreadcrumb.gql'
|
7
|
+
import type { ProductPageBreadcrumbFragment } from './ProductPageBreadcrumb.gql'
|
7
8
|
|
8
9
|
type ProductPageBreadcrumbsProps = ProductPageBreadcrumbFragment &
|
9
10
|
Omit<BreadcrumbsProps, 'children'>
|
@@ -3,12 +3,12 @@ import { categoryToBreadcrumbs } from '@graphcommerce/magento-category'
|
|
3
3
|
import { Breadcrumbs } from '@graphcommerce/next-ui'
|
4
4
|
import { BreadcrumbsJsonLd } from '@graphcommerce/next-ui/Breadcrumbs/BreadcrumbsJsonLd'
|
5
5
|
import { jsonLdBreadcrumb } from '@graphcommerce/next-ui/Breadcrumbs/jsonLdBreadcrumb'
|
6
|
-
import { BreadcrumbsProps } from '@mui/material'
|
6
|
+
import type { BreadcrumbsProps } from '@mui/material'
|
7
7
|
import { useRouter } from 'next/router'
|
8
|
-
import { BreadcrumbList } from 'schema-dts'
|
8
|
+
import type { BreadcrumbList } from 'schema-dts'
|
9
9
|
import { productLink } from '../../hooks/useProductLink'
|
10
10
|
import { productPageCategory } from '../ProductPageCategory/productPageCategory'
|
11
|
-
import { ProductPageBreadcrumbFragment } from './ProductPageBreadcrumb.gql'
|
11
|
+
import type { ProductPageBreadcrumbFragment } from './ProductPageBreadcrumb.gql'
|
12
12
|
|
13
13
|
export type ProductPageBreadcrumbsProps = Omit<BreadcrumbsProps, 'children'> & {
|
14
14
|
breadcrumbsAmount?: number
|
@@ -1,14 +1,15 @@
|
|
1
|
+
import type { ColumnTwoWithTopProps } from '@graphcommerce/next-ui'
|
1
2
|
import {
|
2
3
|
ColumnTwoWithTop,
|
3
|
-
ColumnTwoWithTopProps,
|
4
|
-
extendableComponent,
|
5
|
-
breakpointVal,
|
6
4
|
LazyHydrate,
|
5
|
+
breakpointVal,
|
6
|
+
extendableComponent,
|
7
7
|
} from '@graphcommerce/next-ui'
|
8
|
-
import {
|
9
|
-
import {
|
8
|
+
import type { SxProps, Theme } from '@mui/material'
|
9
|
+
import { Box, Typography } from '@mui/material'
|
10
|
+
import type { Variant } from '@mui/material/styles/createTypography'
|
10
11
|
import { ProductPageName } from '../ProductPageName'
|
11
|
-
import { ProductPageDescriptionFragment } from './ProductPageDescription.gql'
|
12
|
+
import type { ProductPageDescriptionFragment } from './ProductPageDescription.gql'
|
12
13
|
|
13
14
|
export type ProductPageDescriptionProps = ProductPageDescriptionFragment &
|
14
15
|
Omit<ColumnTwoWithTopProps, 'top' | 'left'> & {
|
@@ -1,10 +1,6 @@
|
|
1
|
-
import {
|
2
|
-
|
3
|
-
|
4
|
-
SidebarGalleryProps,
|
5
|
-
TypeRenderer,
|
6
|
-
} from '@graphcommerce/next-ui'
|
7
|
-
import { ProductPageGalleryFragment } from './ProductPageGallery.gql'
|
1
|
+
import type { SidebarGalleryProps, TypeRenderer } from '@graphcommerce/next-ui'
|
2
|
+
import { SidebarGallery, nonNullable } from '@graphcommerce/next-ui'
|
3
|
+
import type { ProductPageGalleryFragment } from './ProductPageGallery.gql'
|
8
4
|
|
9
5
|
export type ProductPageGalleryRenderers = TypeRenderer<
|
10
6
|
NonNullable<NonNullable<ProductPageGalleryFragment['media_gallery']>[0]>
|
@@ -1,7 +1,7 @@
|
|
1
1
|
import { PageMeta } from '@graphcommerce/magento-store'
|
2
|
-
import { PageMetaProps } from '@graphcommerce/next-ui'
|
2
|
+
import type { PageMetaProps } from '@graphcommerce/next-ui'
|
3
3
|
import { productLink } from '../../hooks/useProductLink'
|
4
|
-
import { ProductPageMetaFragment } from './ProductPageMeta.gql'
|
4
|
+
import type { ProductPageMetaFragment } from './ProductPageMeta.gql'
|
5
5
|
|
6
6
|
export type ProductPageMetaProps = { product: ProductPageMetaFragment } & Pick<
|
7
7
|
PageMetaProps,
|
@@ -1,10 +1,10 @@
|
|
1
|
-
import { ProductPageNameFragment } from './ProductPageName.gql'
|
1
|
+
import type { ProductPageNameFragment } from './ProductPageName.gql'
|
2
2
|
|
3
3
|
export type ProductPageNameProps = {
|
4
4
|
product: ProductPageNameFragment
|
5
5
|
}
|
6
6
|
|
7
|
-
export
|
7
|
+
export function ProductPageName(props: ProductPageNameProps) {
|
8
8
|
const { product } = props
|
9
9
|
return <>{product.name}</>
|
10
10
|
}
|
@@ -2,13 +2,12 @@ import { useWatch } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import { InContextMask } from '@graphcommerce/graphql'
|
3
3
|
import { Money } from '@graphcommerce/magento-store'
|
4
4
|
import { extendableComponent } from '@graphcommerce/next-ui'
|
5
|
-
import { AddToCartItemSelector
|
6
|
-
import {
|
5
|
+
import type { AddToCartItemSelector } from '../AddProductsToCart'
|
6
|
+
import { useFormAddProductsToCart } from '../AddProductsToCart'
|
7
|
+
import type { ProductPagePriceFragment } from './ProductPagePrice.gql'
|
7
8
|
import { getProductTierPrice } from './getProductTierPrice'
|
8
|
-
import {
|
9
|
-
|
10
|
-
useCustomizableOptionPrice,
|
11
|
-
} from './useCustomizableOptionPrice'
|
9
|
+
import type { UseCustomizableOptionPriceProps } from './useCustomizableOptionPrice'
|
10
|
+
import { useCustomizableOptionPrice } from './useCustomizableOptionPrice'
|
12
11
|
|
13
12
|
export type ProductPagePriceProps = { product: ProductPagePriceFragment } & AddToCartItemSelector &
|
14
13
|
UseCustomizableOptionPriceProps
|
@@ -2,8 +2,8 @@ import { InContextMask } from '@graphcommerce/graphql'
|
|
2
2
|
import { Money } from '@graphcommerce/magento-store'
|
3
3
|
import { filterNonNullableKeys } from '@graphcommerce/next-ui'
|
4
4
|
import { Trans } from '@lingui/react'
|
5
|
-
import { SxProps, Theme } from '@mui/material'
|
6
|
-
import { ProductPagePriceFragment } from './ProductPagePrice.gql'
|
5
|
+
import type { SxProps, Theme } from '@mui/material'
|
6
|
+
import type { ProductPagePriceFragment } from './ProductPagePrice.gql'
|
7
7
|
|
8
8
|
export type ProductPagePriceTiersProps = {
|
9
9
|
sx?: SxProps<Theme>
|
@@ -1,5 +1,5 @@
|
|
1
|
-
import { MoneyFragment } from '@graphcommerce/magento-store'
|
2
|
-
import { ProductPagePriceFragment } from './ProductPagePrice.gql'
|
1
|
+
import type { MoneyFragment } from '@graphcommerce/magento-store'
|
2
|
+
import type { ProductPagePriceFragment } from './ProductPagePrice.gql'
|
3
3
|
|
4
4
|
export function getProductTierPrice(
|
5
5
|
price: Pick<ProductPagePriceFragment, 'price_tiers'>,
|
@@ -1,15 +1,16 @@
|
|
1
1
|
import { useWatch } from '@graphcommerce/ecommerce-ui'
|
2
|
-
import { MoneyFragment } from '@graphcommerce/magento-store'
|
2
|
+
import type { MoneyFragment } from '@graphcommerce/magento-store'
|
3
3
|
import { filterNonNullableKeys, isTypename, nonNullable } from '@graphcommerce/next-ui'
|
4
|
-
import { AddToCartItemSelector
|
5
|
-
import {
|
6
|
-
|
4
|
+
import type { AddToCartItemSelector } from '../AddProductsToCart'
|
5
|
+
import { useFormAddProductsToCart } from '../AddProductsToCart'
|
6
|
+
import type {
|
7
|
+
AnyOption,
|
7
8
|
CustomizableProductOptionBase,
|
8
9
|
OptionValueSelector,
|
9
|
-
AnyOption,
|
10
10
|
SelectorsProp,
|
11
11
|
} from '../ProductCustomizable/productCustomizableSelectors'
|
12
|
-
import {
|
12
|
+
import { productCustomizableSelectors } from '../ProductCustomizable/productCustomizableSelectors'
|
13
|
+
import type { ProductPagePriceFragment } from './ProductPagePrice.gql'
|
13
14
|
import { getProductTierPrice } from './getProductTierPrice'
|
14
15
|
|
15
16
|
export type UseCustomizableOptionPriceProps = {
|
@@ -1,18 +1,11 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
|
4
|
-
|
5
|
-
ContainerProps,
|
6
|
-
SxProps,
|
7
|
-
Theme,
|
8
|
-
Typography,
|
9
|
-
TypographyProps,
|
10
|
-
useTheme,
|
11
|
-
} from '@mui/material'
|
1
|
+
import type { ItemScrollerProps } from '@graphcommerce/next-ui'
|
2
|
+
import { ItemScroller, RenderType, responsiveVal } from '@graphcommerce/next-ui'
|
3
|
+
import type { ContainerProps, SxProps, Theme, TypographyProps } from '@mui/material'
|
4
|
+
import { Box, Container, Typography, useTheme } from '@mui/material'
|
12
5
|
import React, { forwardRef, useContext } from 'react'
|
13
6
|
import { AddProductsToCartContext, AddProductsToCartForm } from '../AddProductsToCart'
|
14
|
-
import { ProductListItemProps } from '../ProductListItem/ProductListItem'
|
15
|
-
import { ProductListItemRenderer, ProductListItemType } from '../ProductListItems/renderer'
|
7
|
+
import type { ProductListItemProps } from '../ProductListItem/ProductListItem'
|
8
|
+
import type { ProductListItemRenderer, ProductListItemType } from '../ProductListItems/renderer'
|
16
9
|
|
17
10
|
export type ProductScrollerProps = {
|
18
11
|
title?: React.ReactNode
|
@@ -22,7 +15,8 @@ export type ProductScrollerProps = {
|
|
22
15
|
sx?: SxProps<Theme>
|
23
16
|
containerProps?: ContainerProps
|
24
17
|
titleProps?: TypographyProps
|
25
|
-
itemScrollerProps?: ItemScrollerProps
|
18
|
+
itemScrollerProps?: Omit<ItemScrollerProps, 'children'>
|
19
|
+
sizes?: string
|
26
20
|
}
|
27
21
|
export const ProductScroller = forwardRef<HTMLDivElement, ProductScrollerProps>(
|
28
22
|
(props: ProductScrollerProps, ref) => {
|
@@ -35,6 +29,7 @@ export const ProductScroller = forwardRef<HTMLDivElement, ProductScrollerProps>(
|
|
35
29
|
containerProps,
|
36
30
|
titleProps,
|
37
31
|
itemScrollerProps,
|
32
|
+
sizes = responsiveVal(200, 300),
|
38
33
|
} = props
|
39
34
|
|
40
35
|
const theme = useTheme()
|
@@ -61,7 +56,7 @@ export const ProductScroller = forwardRef<HTMLDivElement, ProductScrollerProps>(
|
|
61
56
|
renderer={productListRenderer}
|
62
57
|
{...item}
|
63
58
|
imageOnly={imageOnly}
|
64
|
-
sizes={
|
59
|
+
sizes={sizes}
|
65
60
|
/>
|
66
61
|
))}
|
67
62
|
</ItemScroller>
|
@@ -1,6 +1,7 @@
|
|
1
1
|
import { extendableComponent } from '@graphcommerce/next-ui'
|
2
|
-
import { SxProps, Theme
|
3
|
-
import {
|
2
|
+
import type { SxProps, Theme } from '@mui/material'
|
3
|
+
import { Typography } from '@mui/material'
|
4
|
+
import type { ProductShortDescriptionFragment } from './ProductShortDescription.gql'
|
4
5
|
|
5
6
|
export type ProductShortDescriptionProps = {
|
6
7
|
product: ProductShortDescriptionFragment
|
@@ -1,7 +1,7 @@
|
|
1
|
-
import { breakpointVal, iconOrderBefore
|
1
|
+
import { IconSvg, breakpointVal, iconOrderBefore } from '@graphcommerce/next-ui'
|
2
2
|
import { Trans } from '@lingui/react'
|
3
3
|
import { Box, darken, lighten } from '@mui/material'
|
4
|
-
import { UseAddProductsToCartActionFragment } from '../AddProductsToCart/UseAddProductsToCartAction.gql'
|
4
|
+
import type { UseAddProductsToCartActionFragment } from '../AddProductsToCart/UseAddProductsToCartAction.gql'
|
5
5
|
|
6
6
|
type ProductSidebarDeliveryProps = {
|
7
7
|
product?: UseAddProductsToCartActionFragment
|
@@ -39,7 +39,7 @@ export function ProductSidebarDelivery(props: ProductSidebarDeliveryProps) {
|
|
39
39
|
"image title"
|
40
40
|
". subtitle"
|
41
41
|
`,
|
42
|
-
gridTemplateColumns:
|
42
|
+
gridTemplateColumns: 'min-content auto',
|
43
43
|
columnGap: theme.spacings.xxs,
|
44
44
|
background:
|
45
45
|
theme.palette.mode === 'light'
|
@@ -1,6 +1,7 @@
|
|
1
|
-
import {
|
2
|
-
import {
|
3
|
-
import {
|
1
|
+
import { Row, SectionContainer, extendableComponent, responsiveVal } from '@graphcommerce/next-ui'
|
2
|
+
import type { SxProps, Theme } from '@mui/material'
|
3
|
+
import { Box } from '@mui/material'
|
4
|
+
import type { ProductSpecsFragment } from './ProductSpecs.gql'
|
4
5
|
import { ProductSpecsAggregations } from './ProductSpecsAggregations'
|
5
6
|
import { ProductSpecsCustomAttributes } from './ProductSpecsCustomAttributes'
|
6
7
|
|
@@ -10,7 +11,7 @@ export type ProductSpecsProps = ProductSpecsFragment & {
|
|
10
11
|
children?: React.ReactNode
|
11
12
|
}
|
12
13
|
|
13
|
-
const name = 'ProductSpecs'
|
14
|
+
const name = 'ProductSpecs'
|
14
15
|
const parts = ['root', 'specs', 'options'] as const
|
15
16
|
const { classes } = extendableComponent(name, parts)
|
16
17
|
|
@@ -1,8 +1,8 @@
|
|
1
1
|
import { extendableComponent } from '@graphcommerce/next-ui'
|
2
2
|
import { Box } from '@mui/material'
|
3
|
-
import { ProductSpecsFragment } from './ProductSpecs.gql'
|
3
|
+
import type { ProductSpecsFragment } from './ProductSpecs.gql'
|
4
4
|
|
5
|
-
const name = 'ProductSpecs'
|
5
|
+
const name = 'ProductSpecs'
|
6
6
|
const parts = ['root', 'specs', 'options'] as const
|
7
7
|
const { classes } = extendableComponent(name, parts)
|
8
8
|
|
@@ -1,10 +1,10 @@
|
|
1
1
|
import { useQuery } from '@graphcommerce/graphql'
|
2
|
-
import {
|
2
|
+
import { ListFormat, extendableComponent } from '@graphcommerce/next-ui'
|
3
3
|
import { Box } from '@mui/material'
|
4
|
-
import { ProductSpecsFragment } from './ProductSpecs.gql'
|
4
|
+
import type { ProductSpecsFragment } from './ProductSpecs.gql'
|
5
5
|
import { ProductSpecsTypesDocument } from './ProductSpecsTypes.gql'
|
6
6
|
|
7
|
-
const name = 'ProductSpecs'
|
7
|
+
const name = 'ProductSpecs'
|
8
8
|
const parts = ['root', 'specs', 'options'] as const
|
9
9
|
const { classes } = extendableComponent(name, parts)
|
10
10
|
|
@@ -1,6 +1,7 @@
|
|
1
|
-
import { ApolloClient, ApolloQueryResult, NormalizedCacheObject } from '@graphcommerce/graphql'
|
2
|
-
import { GetStaticPathsResult } from 'next'
|
3
|
-
import {
|
1
|
+
import type { ApolloClient, ApolloQueryResult, NormalizedCacheObject } from '@graphcommerce/graphql'
|
2
|
+
import type { GetStaticPathsResult } from 'next'
|
3
|
+
import type { ProductStaticPathsQuery } from './ProductStaticPaths.gql'
|
4
|
+
import { ProductStaticPathsDocument } from './ProductStaticPaths.gql'
|
4
5
|
|
5
6
|
type Return = GetStaticPathsResult<{ url: string }>
|
6
7
|
|
@@ -1,4 +1,4 @@
|
|
1
|
-
import { ApolloClient, NormalizedCacheObject } from '@graphcommerce/graphql'
|
1
|
+
import type { ApolloClient, NormalizedCacheObject } from '@graphcommerce/graphql'
|
2
2
|
import { canonicalize, nonNullable } from '@graphcommerce/next-ui'
|
3
3
|
import { productLink } from '../../hooks/useProductLink'
|
4
4
|
import { ProductStaticPathsDocument } from './ProductStaticPaths.gql'
|
@@ -24,7 +24,7 @@ export async function getSitemapPaths(
|
|
24
24
|
|
25
25
|
const options = { locale, defaultLocale, pathname: '/', isLocaleDomain: false }
|
26
26
|
const lastmod = new Date().toISOString()
|
27
|
-
const changefreq = 'daily'
|
27
|
+
const changefreq = 'daily'
|
28
28
|
const priority = 0.7
|
29
29
|
|
30
30
|
const paths = (await Promise.all(result))
|
@@ -1,7 +1,8 @@
|
|
1
1
|
import { useQuery } from '@graphcommerce/graphql'
|
2
2
|
import { StoreConfigDocument } from '@graphcommerce/magento-store'
|
3
|
-
import {
|
4
|
-
import {
|
3
|
+
import type { UnitFormatProps } from '@graphcommerce/next-ui'
|
4
|
+
import { UnitFormat } from '@graphcommerce/next-ui'
|
5
|
+
import type { ProductWeightFragment } from './ProductWeight.gql'
|
5
6
|
|
6
7
|
export type ProductWeightProps = Omit<UnitFormatProps, 'unit'> & { product: ProductWeightFragment }
|
7
8
|
|
@@ -14,9 +15,5 @@ export function ProductWeight(props: ProductWeightProps) {
|
|
14
15
|
|
15
16
|
const unit = conf?.storeConfig?.weight_unit === 'lbs' ? 'pound' : 'kilogram'
|
16
17
|
|
17
|
-
return
|
18
|
-
<UnitFormat unit={unit} {...rest}>
|
19
|
-
{product.weight}
|
20
|
-
</UnitFormat>
|
21
|
-
)
|
18
|
+
return <UnitFormat unit={unit} {...rest} value={product.weight} />
|
22
19
|
}
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import React from 'react'
|
2
|
-
import { ProductListParams } from '../components/ProductListItems/filterTypes'
|
2
|
+
import type { ProductListParams } from '../components/ProductListItems/filterTypes'
|
3
3
|
|
4
4
|
export const productListParamsContext = React.createContext<{
|
5
5
|
params: ProductListParams
|
package/hooks/useProductLink.ts
CHANGED
package/hooks/useProductList.ts
CHANGED
@@ -1,30 +1,27 @@
|
|
1
1
|
import { debounce } from '@graphcommerce/ecommerce-ui'
|
2
|
-
import {
|
3
|
-
|
4
|
-
useQuery,
|
5
|
-
useInContextQuery,
|
6
|
-
getInContextInput,
|
7
|
-
} from '@graphcommerce/graphql'
|
2
|
+
import type { ApolloClient } from '@graphcommerce/graphql'
|
3
|
+
import { getInContextInput, useInContextQuery, useQuery } from '@graphcommerce/graphql'
|
8
4
|
import { StoreConfigDocument } from '@graphcommerce/magento-store'
|
9
5
|
import { showPageLoadIndicator } from '@graphcommerce/next-ui'
|
10
6
|
import { useEventCallback } from '@mui/material'
|
11
|
-
import {
|
7
|
+
import type {
|
12
8
|
FilterFormProviderProps,
|
13
|
-
ProductFiltersDocument,
|
14
9
|
ProductFiltersQuery,
|
15
10
|
ProductFiltersQueryVariables,
|
16
11
|
} from '../components'
|
17
|
-
import {
|
18
|
-
|
12
|
+
import { ProductFiltersDocument } from '../components'
|
13
|
+
import type {
|
19
14
|
ProductListQuery,
|
20
15
|
ProductListQueryVariables,
|
21
16
|
} from '../components/ProductList/ProductList.gql'
|
22
|
-
import {
|
23
|
-
import {
|
17
|
+
import { ProductListDocument } from '../components/ProductList/ProductList.gql'
|
18
|
+
import type { CategoryDefaultFragment } from '../components/ProductListItems/CategoryDefault.gql'
|
19
|
+
import type { ProductListParams } from '../components/ProductListItems/filterTypes'
|
20
|
+
import { toProductListParams } from '../components/ProductListItems/filterTypes'
|
24
21
|
import { useRouterFilterParams } from '../components/ProductListItems/filteredProductList'
|
25
22
|
import {
|
26
|
-
productListApplyCategoryDefaults,
|
27
23
|
categoryDefaultsToProductListFilters,
|
24
|
+
productListApplyCategoryDefaults,
|
28
25
|
useProductListApplyCategoryDefaults,
|
29
26
|
} from '../components/ProductListItems/productListApplyCategoryDefaults'
|
30
27
|
|
@@ -37,7 +34,7 @@ export const prefetchProductList = debounce(
|
|
37
34
|
variables: ProductListQueryVariables,
|
38
35
|
filtersVariables: ProductFiltersQueryVariables,
|
39
36
|
next: Next,
|
40
|
-
client: ApolloClient<
|
37
|
+
client: ApolloClient<unknown>,
|
41
38
|
shallow: boolean,
|
42
39
|
) => {
|
43
40
|
if (!shallow) return next(shallow)
|
@@ -1,9 +1,11 @@
|
|
1
|
+
import type {
|
2
|
+
ProductFilterParams,
|
3
|
+
ProductListParams,
|
4
|
+
} from '../components/ProductListItems/filterTypes'
|
1
5
|
import {
|
2
6
|
isFilterTypeEqual,
|
3
7
|
isFilterTypeMatch,
|
4
8
|
isFilterTypeRange,
|
5
|
-
ProductFilterParams,
|
6
|
-
ProductListParams,
|
7
9
|
toFilterParams,
|
8
10
|
} from '../components/ProductListItems/filterTypes'
|
9
11
|
|
@@ -17,15 +19,15 @@ export function productListLinkFromFilter(props: ProductFilterParams): string {
|
|
17
19
|
if (isSearch) urlBase = search ? `search/${search}` : 'search'
|
18
20
|
|
19
21
|
// base url path generation
|
20
|
-
let paginateSort =
|
21
|
-
let query =
|
22
|
+
let paginateSort = ''
|
23
|
+
let query = ''
|
22
24
|
|
23
25
|
if (currentPage && currentPage > 1) paginateSort += `/page/${currentPage}`
|
24
26
|
|
25
27
|
// todo(paales): How should the URL look like with multiple sorts?
|
26
28
|
// Something like: /sort/position,price/dir/asc,asc
|
27
29
|
if (sort) query += `/sort/${sort}`
|
28
|
-
if (dir) query +=
|
30
|
+
if (dir) query += '/dir/desc'
|
29
31
|
if (pageSize) query += `/page-size/${pageSize}`
|
30
32
|
|
31
33
|
// Apply filters
|
@@ -1,5 +1,5 @@
|
|
1
1
|
import { useRouter } from 'next/router'
|
2
|
-
import { ProductListParams } from '../components/ProductListItems/filterTypes'
|
2
|
+
import type { ProductListParams } from '../components/ProductListItems/filterTypes'
|
3
3
|
import { productListLink } from './useProductListLink'
|
4
4
|
import { useProductListParamsContext } from './useProductListParamsContext'
|
5
5
|
|
package/package.json
CHANGED
@@ -2,7 +2,7 @@
|
|
2
2
|
"name": "@graphcommerce/magento-product",
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
5
|
-
"version": "9.0.0-canary.
|
5
|
+
"version": "9.0.0-canary.104",
|
6
6
|
"sideEffects": false,
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
8
8
|
"eslintConfig": {
|
@@ -18,23 +18,23 @@
|
|
18
18
|
"typescript": "5.6.2"
|
19
19
|
},
|
20
20
|
"peerDependencies": {
|
21
|
-
"@graphcommerce/ecommerce-ui": "^9.0.0-canary.
|
22
|
-
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.
|
23
|
-
"@graphcommerce/framer-next-pages": "^9.0.0-canary.
|
24
|
-
"@graphcommerce/framer-scroller": "^9.0.0-canary.
|
25
|
-
"@graphcommerce/graphql": "^9.0.0-canary.
|
26
|
-
"@graphcommerce/graphql-mesh": "^9.0.0-canary.
|
27
|
-
"@graphcommerce/image": "^9.0.0-canary.
|
28
|
-
"@graphcommerce/magento-cart": "^9.0.0-canary.
|
29
|
-
"@graphcommerce/magento-store": "^9.0.0-canary.
|
30
|
-
"@graphcommerce/next-ui": "^9.0.0-canary.
|
31
|
-
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.
|
32
|
-
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.
|
21
|
+
"@graphcommerce/ecommerce-ui": "^9.0.0-canary.104",
|
22
|
+
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.104",
|
23
|
+
"@graphcommerce/framer-next-pages": "^9.0.0-canary.104",
|
24
|
+
"@graphcommerce/framer-scroller": "^9.0.0-canary.104",
|
25
|
+
"@graphcommerce/graphql": "^9.0.0-canary.104",
|
26
|
+
"@graphcommerce/graphql-mesh": "^9.0.0-canary.104",
|
27
|
+
"@graphcommerce/image": "^9.0.0-canary.104",
|
28
|
+
"@graphcommerce/magento-cart": "^9.0.0-canary.104",
|
29
|
+
"@graphcommerce/magento-store": "^9.0.0-canary.104",
|
30
|
+
"@graphcommerce/next-ui": "^9.0.0-canary.104",
|
31
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.104",
|
32
|
+
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.104",
|
33
33
|
"@lingui/core": "^4.2.1",
|
34
34
|
"@lingui/macro": "^4.2.1",
|
35
35
|
"@lingui/react": "^4.2.1",
|
36
36
|
"@mui/material": "^5.10.16",
|
37
|
-
"framer-motion": "^
|
37
|
+
"framer-motion": "^11.0.0",
|
38
38
|
"next": "*",
|
39
39
|
"react": "^18.2.0",
|
40
40
|
"react-dom": "^18.2.0"
|
@@ -1,7 +1,7 @@
|
|
1
1
|
/* eslint-disable @typescript-eslint/no-non-null-assertion */
|
2
2
|
import { test as base } from '@graphcommerce/magento-store/test/apolloClientStore.fixture'
|
3
3
|
import { ProductStaticPathsDocument } from '../components/ProductStaticPaths/ProductStaticPaths.gql'
|
4
|
-
import { ProductTypenames } from '../components/ProductStaticPaths/getProductStaticPaths'
|
4
|
+
import type { ProductTypenames } from '../components/ProductStaticPaths/getProductStaticPaths'
|
5
5
|
import { productLink } from '../hooks/useProductLink'
|
6
6
|
|
7
7
|
type ProductUrls = {
|
package/tsconfig.json
CHANGED