@graphcommerce/magento-product 9.0.0-canary.98 → 9.0.0

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.
Files changed (106) hide show
  1. package/CHANGELOG.md +211 -1277
  2. package/components/AddProductsToCart/AddProductsToCartButton.tsx +4 -5
  3. package/components/AddProductsToCart/AddProductsToCartError.tsx +3 -2
  4. package/components/AddProductsToCart/AddProductsToCartFab.tsx +5 -6
  5. package/components/AddProductsToCart/AddProductsToCartForm.tsx +15 -19
  6. package/components/AddProductsToCart/AddProductsToCartQuantity.tsx +7 -5
  7. package/components/AddProductsToCart/AddProductsToCartSnackbar.tsx +2 -1
  8. package/components/AddProductsToCart/AddProductsToCartSnackbarMessage.tsx +5 -6
  9. package/components/AddProductsToCart/findAddedItems.ts +2 -2
  10. package/components/AddProductsToCart/toUserErrors.ts +2 -2
  11. package/components/AddProductsToCart/useAddProductsToCartAction.ts +4 -3
  12. package/components/AddProductsToCart/useFormAddProductsToCart.ts +3 -3
  13. package/components/JsonLdProduct/ProductPageJsonLd.tsx +1 -1
  14. package/components/JsonLdProduct/jsonLdProduct.tsx +2 -2
  15. package/components/ProductAddToCart/index.ts +0 -1
  16. package/components/ProductCustomizable/CustomizableAreaOption.tsx +5 -4
  17. package/components/ProductCustomizable/CustomizableCheckboxOption.tsx +4 -8
  18. package/components/ProductCustomizable/CustomizableDateOption.tsx +3 -3
  19. package/components/ProductCustomizable/CustomizableDropDownOption.tsx +6 -6
  20. package/components/ProductCustomizable/CustomizableFieldOption.tsx +3 -3
  21. package/components/ProductCustomizable/CustomizableMultipleOption.tsx +4 -8
  22. package/components/ProductCustomizable/CustomizableRadioOption.tsx +4 -8
  23. package/components/ProductCustomizable/ProductCustomizable.tsx +7 -6
  24. package/components/ProductFiltersPro/PriceSlider.tsx +4 -2
  25. package/components/ProductFiltersPro/ProductFilterEqualChip.tsx +1 -1
  26. package/components/ProductFiltersPro/ProductFilterEqualSection.tsx +1 -1
  27. package/components/ProductFiltersPro/ProductFilterRangeChip.tsx +1 -1
  28. package/components/ProductFiltersPro/ProductFiltersPro.tsx +10 -19
  29. package/components/ProductFiltersPro/ProductFiltersProAggregations.tsx +2 -2
  30. package/components/ProductFiltersPro/ProductFiltersProAllFiltersChip.tsx +7 -7
  31. package/components/ProductFiltersPro/ProductFiltersProAllFiltersSidebar.tsx +8 -15
  32. package/components/ProductFiltersPro/ProductFiltersProCategorySection.tsx +6 -8
  33. package/components/ProductFiltersPro/ProductFiltersProChips.tsx +4 -2
  34. package/components/ProductFiltersPro/ProductFiltersProClearAll.tsx +2 -2
  35. package/components/ProductFiltersPro/ProductFiltersProLayoutSidebar.tsx +8 -2
  36. package/components/ProductFiltersPro/ProductFiltersProLimitChip.tsx +4 -2
  37. package/components/ProductFiltersPro/ProductFiltersProLimitSection.tsx +3 -2
  38. package/components/ProductFiltersPro/ProductFiltersProNoResults.tsx +5 -4
  39. package/components/ProductFiltersPro/ProductFiltersProSortChip.tsx +4 -2
  40. package/components/ProductFiltersPro/ProductFiltersProSortDirectionArrow.tsx +5 -3
  41. package/components/ProductFiltersPro/ProductFiltersProSortSection.tsx +3 -2
  42. package/components/ProductFiltersPro/activeAggregations.ts +2 -2
  43. package/components/ProductFiltersPro/applyAggregationCount.ts +2 -2
  44. package/components/ProductFiltersPro/useProductFiltersProClearAllAction.ts +1 -1
  45. package/components/ProductFiltersPro/useProductFiltersProSort.tsx +3 -3
  46. package/components/ProductList/ProductList.graphql +4 -3
  47. package/components/ProductListCount/ProductListCount.tsx +3 -2
  48. package/components/ProductListFilters/FilterCheckboxType.tsx +5 -4
  49. package/components/ProductListFilters/FilterEqualType.tsx +7 -7
  50. package/components/ProductListFilters/FilterRangeType.tsx +4 -3
  51. package/components/ProductListFilters/ProductFilters.graphql +2 -2
  52. package/components/ProductListFilters/ProductListFilters.tsx +3 -3
  53. package/components/ProductListFiltersContainer/ProductListFiltersContainer.tsx +5 -4
  54. package/components/ProductListItem/ProductDiscountLabel.tsx +4 -3
  55. package/components/ProductListItem/ProductListItem.tsx +58 -31
  56. package/components/ProductListItem/ProductListItemImage.tsx +9 -7
  57. package/components/ProductListItem/ProductListItemImageContainer.tsx +9 -8
  58. package/components/ProductListItem/ProductListItemLinkOrDiv.tsx +13 -8
  59. package/components/ProductListItem/ProductListItemTitleAndPrice.tsx +4 -3
  60. package/components/ProductListItems/ProductListItemsBase.tsx +24 -18
  61. package/components/ProductListItems/ProductListParamsProvider.tsx +2 -2
  62. package/components/ProductListItems/filterTypes.tsx +4 -4
  63. package/components/ProductListItems/filteredProductList.tsx +2 -2
  64. package/components/ProductListItems/getFilterTypes.ts +2 -1
  65. package/components/ProductListItems/productListApplyCategoryDefaults.ts +5 -4
  66. package/components/ProductListItems/renderer.tsx +3 -2
  67. package/components/ProductListLink/ProductListLink.tsx +5 -3
  68. package/components/ProductListPagination/ProductListPagination.tsx +6 -5
  69. package/components/ProductListPrice/ProductListPrice.tsx +12 -7
  70. package/components/ProductListSort/ProductListSort.tsx +8 -6
  71. package/components/ProductListSuggestions/ProductListSearchSuggestion.graphql +3 -0
  72. package/components/ProductListSuggestions/ProductListSuggestions.graphql +1 -1
  73. package/components/ProductListSuggestions/ProductListSuggestions.tsx +2 -2
  74. package/components/ProductPage/ProductPageAddToCartRow.tsx +4 -3
  75. package/components/ProductPageBreadcrumb/ProductPageBreadcrumb.tsx +6 -4
  76. package/components/ProductPageBreadcrumb/ProductPageBreadcrumbs.tsx +3 -3
  77. package/components/ProductPageCategory/productPageCategory.ts +1 -1
  78. package/components/ProductPageDescription/ProductPageDescription.tsx +7 -6
  79. package/components/ProductPageGallery/ProductPageGallery.tsx +3 -7
  80. package/components/ProductPageMeta/ProductPageMeta.tsx +2 -2
  81. package/components/ProductPageName/ProductPageName.tsx +2 -2
  82. package/components/ProductPagePrice/ProductPagePrice.tsx +10 -11
  83. package/components/ProductPagePrice/ProductPagePriceTiers.tsx +5 -5
  84. package/components/ProductPagePrice/getProductTierPrice.ts +2 -2
  85. package/components/ProductPagePrice/useCustomizableOptionPrice.ts +7 -6
  86. package/components/ProductScroller/ProductScroller.tsx +11 -16
  87. package/components/ProductShortDescription/ProductShortDescription.tsx +3 -2
  88. package/components/ProductSidebarDelivery/ProductSidebarDelivery.tsx +4 -4
  89. package/components/ProductSpecs/ProductSpecs.tsx +5 -4
  90. package/components/ProductSpecs/ProductSpecsAggregations.tsx +2 -2
  91. package/components/ProductSpecs/ProductSpecsCustomAttributes.tsx +3 -3
  92. package/components/ProductStaticPaths/getProductStaticPaths.ts +4 -3
  93. package/components/ProductStaticPaths/getSitemapPaths.ts +3 -2
  94. package/components/ProductWeight/ProductWeight.tsx +5 -7
  95. package/components/index.ts +5 -0
  96. package/context/productListParamsContext.ts +1 -1
  97. package/hooks/useProductLink.ts +6 -2
  98. package/hooks/useProductList.ts +14 -17
  99. package/hooks/useProductListLink.ts +7 -5
  100. package/hooks/useProductListLinkReplace.ts +1 -1
  101. package/package.json +15 -15
  102. package/test/productURL.fixture.ts +1 -1
  103. package/tsconfig.json +1 -1
  104. package/components/ProductAddToCart/ProductAddToCart.tsx +0 -139
  105. package/components/ProductPageGallery/ProductImage.tsx +0 -10
  106. package/components/ProductPageGallery/ProductVideo.tsx +0 -10
@@ -1,6 +1,8 @@
1
- import { Image, ImageProps } from '@graphcommerce/image'
1
+ import type { ImageProps } from '@graphcommerce/image'
2
+ import { Image } from '@graphcommerce/image'
2
3
  import { Trans } from '@lingui/react'
3
- import { Box, BoxProps, Skeleton, styled } from '@mui/material'
4
+ import type { BoxProps } from '@mui/material'
5
+ import { Box, Skeleton, styled } from '@mui/material'
4
6
 
5
7
  const StyledImage = styled(Image)({})
6
8
 
@@ -24,7 +26,7 @@ function PlaceHolderContainer(props: BoxProps) {
24
26
 
25
27
  export type ProductListItemImageProps = {
26
28
  aspectRatio?: [number, number]
27
- classes: {
29
+ classes?: {
28
30
  image?: string
29
31
  placeholder?: string
30
32
  }
@@ -33,7 +35,7 @@ export type ProductListItemImageProps = {
33
35
  export function ProductListItemImageSkeleton(props: ProductListItemImageProps) {
34
36
  const { aspectRatio = [4, 3], classes } = props
35
37
  return (
36
- <PlaceHolderContainer className={`${classes.placeholder} ${classes.image}`}>
38
+ <PlaceHolderContainer className={`${classes?.placeholder} ${classes?.image}`}>
37
39
  <Skeleton
38
40
  animation='wave'
39
41
  sx={{
@@ -46,7 +48,7 @@ export function ProductListItemImageSkeleton(props: ProductListItemImageProps) {
46
48
  )
47
49
  }
48
50
 
49
- type ImageOrPlaceholderProps = ProductListItemImageProps &
51
+ export type ImageOrPlaceholderProps = ProductListItemImageProps &
50
52
  Omit<ImageProps, 'alt' | 'src'> & {
51
53
  alt?: ImageProps['alt'] | null
52
54
  src?: ImageProps['src'] | null
@@ -64,7 +66,7 @@ export function ProductListItemImage(props: ImageOrPlaceholderProps) {
64
66
  src={src}
65
67
  alt={alt ?? ''}
66
68
  {...image}
67
- className={classes.image}
69
+ className={classes?.image}
68
70
  sx={[
69
71
  {
70
72
  objectFit: 'contain',
@@ -78,7 +80,7 @@ export function ProductListItemImage(props: ImageOrPlaceholderProps) {
78
80
  }
79
81
 
80
82
  return (
81
- <PlaceHolderContainer className={`${classes.placeholder} ${classes.image}`}>
83
+ <PlaceHolderContainer className={`${classes?.placeholder} ${classes?.image}`}>
82
84
  <Box
83
85
  sx={[
84
86
  {
@@ -1,7 +1,8 @@
1
- import { responsiveVal, breakpointVal } from '@graphcommerce/next-ui'
2
- import { Box, BoxProps } from '@mui/material'
1
+ import { breakpointVal, responsiveVal } from '@graphcommerce/next-ui'
2
+ import type { BoxProps } from '@mui/material'
3
+ import { Box } from '@mui/material'
3
4
 
4
- type ProductImageContainerProps = BoxProps
5
+ export type ProductImageContainerProps = BoxProps
5
6
 
6
7
  export function ProductImageContainer(props: ProductImageContainerProps) {
7
8
  const { sx = [] } = props
@@ -22,7 +23,7 @@ export function ProductImageContainer(props: ProductImageContainerProps) {
22
23
  overflow: 'hidden',
23
24
  padding: responsiveVal(8, 12),
24
25
  '& > picture, & > .ProductListItem-placeholder': {
25
- gridArea: `1 / 1 / 3 / 3`,
26
+ gridArea: '1 / 1 / 3 / 3',
26
27
  margin: `calc(${responsiveVal(8, 12)} * -1)`,
27
28
  height: 'auto',
28
29
  },
@@ -52,7 +53,7 @@ export function ProductListItemImageAreas(props: ProductListsItemImageAreaProps)
52
53
  <>
53
54
  <Box
54
55
  sx={{
55
- gridArea: `1 / 1 / 2 / 2`,
56
+ gridArea: '1 / 1 / 2 / 2',
56
57
  zIndex: 1,
57
58
  }}
58
59
  className={classes.topLeft}
@@ -63,7 +64,7 @@ export function ProductListItemImageAreas(props: ProductListsItemImageAreaProps)
63
64
  sx={{
64
65
  justifySelf: 'end',
65
66
  textAlign: 'right',
66
- gridArea: `1 / 2 / 2 / 3`,
67
+ gridArea: '1 / 2 / 2 / 3',
67
68
  zIndex: 1,
68
69
  }}
69
70
  className={classes.topRight}
@@ -73,7 +74,7 @@ export function ProductListItemImageAreas(props: ProductListsItemImageAreaProps)
73
74
  <Box
74
75
  sx={{
75
76
  alignSelf: 'flex-end',
76
- gridArea: `2 / 1 / 3 / 2`,
77
+ gridArea: '2 / 1 / 3 / 2',
77
78
  zIndex: 1,
78
79
  }}
79
80
  className={classes.bottomLeft}
@@ -84,7 +85,7 @@ export function ProductListItemImageAreas(props: ProductListsItemImageAreaProps)
84
85
  sx={{
85
86
  textAlign: 'right',
86
87
  alignSelf: 'flex-end',
87
- gridArea: `2 / 2 / 3 / 3`,
88
+ gridArea: '2 / 2 / 3 / 3',
88
89
  zIndex: 1,
89
90
  justifySelf: 'end',
90
91
  }}
@@ -1,14 +1,19 @@
1
- import { NextLink, breakpointVal } from '@graphcommerce/next-ui'
2
- import { Box, BoxProps, ButtonBase, ButtonBaseProps, SxProps, Theme } from '@mui/material'
1
+ import { breakpointVal, NextLink } from '@graphcommerce/next-ui'
2
+ import type { BoxProps, ButtonBaseProps, SxProps, Theme } from '@mui/material'
3
+ import { Box, ButtonBase } from '@mui/material'
4
+ import React from 'react'
3
5
 
4
- type ProductListItemLinkProps = ButtonBaseProps<typeof NextLink>
5
- type ProductListItemLinkOrDivProps = ProductListItemLinkProps | BoxProps
6
+ export type ProductListItemLinkProps = ButtonBaseProps<typeof NextLink>
7
+ export type ProductListItemLinkOrDivProps = ProductListItemLinkProps | BoxProps
6
8
 
7
9
  function isLink(props: ProductListItemLinkOrDivProps): props is ProductListItemLinkProps {
8
10
  return 'href' in props
9
11
  }
10
12
 
11
- export function ProductListItemLinkOrDiv(props: ProductListItemLinkOrDivProps) {
13
+ export const ProductListItemLinkOrDiv = React.forwardRef<
14
+ HTMLDivElement | HTMLAnchorElement,
15
+ ProductListItemLinkOrDivProps
16
+ >((props, ref) => {
12
17
  const { sx = [] } = props
13
18
 
14
19
  const sxProps: SxProps<Theme> = [
@@ -27,8 +32,8 @@ export function ProductListItemLinkOrDiv(props: ProductListItemLinkOrDivProps) {
27
32
  ]
28
33
 
29
34
  return isLink(props) ? (
30
- <ButtonBase component={NextLink} {...props} sx={sxProps} />
35
+ <ButtonBase ref={ref} component={NextLink} {...props} sx={sxProps} focusRipple />
31
36
  ) : (
32
- <Box {...props} sx={sxProps} />
37
+ <Box ref={ref} component='div' {...props} sx={sxProps} />
33
38
  )
34
- }
39
+ })
@@ -1,4 +1,5 @@
1
- import { Box, SxProps, Theme, Typography } from '@mui/material'
1
+ import type { SxProps, Theme } from '@mui/material'
2
+ import { Box, Typography } from '@mui/material'
2
3
  import { productListPrice } from '../ProductListPrice'
3
4
 
4
5
  export type ProductListItemTitleAndPriceProps = {
@@ -23,8 +24,8 @@ export function ProductListItemTitleAndPrice(props: ProductListItemTitleAndPrice
23
24
  marginTop: theme.spacings.xs,
24
25
  columnGap: 1,
25
26
  gridTemplateAreas: {
26
- xs: `"title title" "subtitle price"`,
27
- md: `"title subtitle price"`,
27
+ xs: '"title title" "subtitle price"',
28
+ md: '"title subtitle price"',
28
29
  },
29
30
  gridTemplateColumns: { xs: 'unset', md: 'auto auto 1fr' },
30
31
  justifyContent: 'space-between',
@@ -1,34 +1,34 @@
1
- import { LazyHydrate, RenderType, extendableComponent, responsiveVal } from '@graphcommerce/next-ui'
2
- import { Box, BoxProps, Breakpoint, Theme, useTheme } from '@mui/material'
1
+ import { extendableComponent, LazyHydrate, RenderType, responsiveVal } from '@graphcommerce/next-ui'
2
+ import type { BoxProps, Breakpoint, Theme } from '@mui/material'
3
+ import { Box, useTheme } from '@mui/material'
3
4
  import { AddProductsToCartForm } from '../AddProductsToCart'
4
- import { ProductListItemProps } from '../ProductListItem/ProductListItem'
5
- import { ProductListItemsFragment } from './ProductListItems.gql'
6
- import { ProductListItemRenderer } from './renderer'
5
+ import type { ProductListItemProps } from '../ProductListItem/ProductListItem'
6
+ import type { ProductListItemsFragment } from './ProductListItems.gql'
7
+ import type { ProductListItemRenderer } from './renderer'
7
8
 
8
9
  type ComponentState = {
9
10
  size?: 'normal' | 'small'
10
11
  }
11
12
 
12
- type ColumnConfig = {
13
+ export type ColumnConfig = {
13
14
  /**
14
- * The total width of the grid, this is used to provde the correct values to the image sizes prop so the right image size is loaded.
15
+ * The total width of the grid, this is used to provde the correct values to the image sizes prop
16
+ * so the right image size is loaded.
15
17
  *
16
- * @default "calc(100vw - ${theme.page.horizontal} * 2)"
18
+ * @default 'calc(100vw - ${theme.page.horizontal} * 2)'
17
19
  */
18
- totalWidth?: string
20
+ maxWidth?: string
19
21
  /**
20
22
  * Gap between the columns/rows
21
23
  *
22
24
  * @default theme.spacings.md
23
25
  */
24
26
  gap?: string
25
- /**
26
- * Number of columns
27
- */
27
+ /** Number of columns */
28
28
  count: number
29
29
  }
30
30
 
31
- type ColumnsConfig = Partial<Record<Breakpoint, ColumnConfig>>
31
+ export type ColumnsConfig = Partial<Record<Breakpoint, ColumnConfig>>
32
32
 
33
33
  export type ProductItemsGridProps = ProductListItemsFragment & {
34
34
  renderers: ProductListItemRenderer
@@ -37,6 +37,8 @@ export type ProductItemsGridProps = ProductListItemsFragment & {
37
37
  sx?: BoxProps['sx']
38
38
  columns?: ((theme: Theme) => ColumnsConfig) | ColumnsConfig
39
39
  containerRef?: React.Ref<HTMLDivElement>
40
+ children?: React.ReactNode
41
+ maxWidth?: string
40
42
  } & Pick<ProductListItemProps, 'onClick' | 'titleComponent'> &
41
43
  ComponentState
42
44
 
@@ -56,11 +58,14 @@ export function ProductListItemsBase(props: ProductItemsGridProps) {
56
58
  titleComponent,
57
59
  onClick,
58
60
  columns,
61
+ children,
62
+ maxWidth: maxWidthProp,
59
63
  } = props
60
64
 
61
65
  const theme = useTheme()
62
66
 
63
- const totalWidth = `calc(100vw - ${theme.page.horizontal} * 2)`
67
+ const maxWidth = maxWidthProp ?? `calc(100vw - ${theme.page.horizontal} * 2)`
68
+
64
69
  const gap = theme.spacings.md
65
70
 
66
71
  let columnConfig = typeof columns === 'function' ? columns(theme) : columns
@@ -69,7 +74,7 @@ export function ProductListItemsBase(props: ProductItemsGridProps) {
69
74
  columnConfig = {
70
75
  xs: { count: 2 },
71
76
  md: { count: 3 },
72
- lg: { count: 4, totalWidth: `${theme.breakpoints.values.xl}px` },
77
+ lg: { count: 4, maxWidth: `${theme.breakpoints.values.xl}px` },
73
78
  }
74
79
  }
75
80
 
@@ -88,7 +93,7 @@ export function ProductListItemsBase(props: ProductItemsGridProps) {
88
93
  ...Object.entries(columnConfig).map(([key, column]) => ({
89
94
  [theme.breakpoints.up(key as Breakpoint)]: {
90
95
  gap: column.gap ?? gap,
91
- // width: totalWidth,
96
+ // maxWidth: column.maxWidth ?? maxWidth,
92
97
  gridTemplateColumns: `repeat(${column.count}, 1fr)`,
93
98
  },
94
99
  })),
@@ -106,8 +111,8 @@ export function ProductListItemsBase(props: ProductItemsGridProps) {
106
111
  <RenderType
107
112
  renderer={renderers}
108
113
  sizes={Object.fromEntries(
109
- Object.entries(columnConfig ?? {}).map(([key, column]) => {
110
- const totalW = column.totalWidth ?? totalWidth
114
+ Object.entries(columnConfig).map(([key, column]) => {
115
+ const totalW = column.maxWidth ?? maxWidth
111
116
  const columnGap = column.gap ?? gap
112
117
  return [
113
118
  theme.breakpoints.values[key as Breakpoint],
@@ -123,6 +128,7 @@ export function ProductListItemsBase(props: ProductItemsGridProps) {
123
128
  </LazyHydrate>
124
129
  ) : null,
125
130
  )}
131
+ {children}
126
132
  </Box>
127
133
  </AddProductsToCartForm>
128
134
  )
@@ -1,6 +1,6 @@
1
- import { useState, useEffect, useMemo } from 'react'
1
+ import { useEffect, useMemo, useState } from 'react'
2
2
  import { productListParamsContext } from '../../context/productListParamsContext'
3
- import { ProductListParams } from './filterTypes'
3
+ import type { ProductListParams } from './filterTypes'
4
4
 
5
5
  export function ProductListParamsProvider({
6
6
  children,
@@ -1,11 +1,11 @@
1
1
  import type {
2
- Maybe,
3
- Scalars,
4
- ProductAttributeFilterInput,
5
- ProductAttributeSortInput,
6
2
  FilterEqualTypeInput,
7
3
  FilterMatchTypeInput,
8
4
  FilterRangeTypeInput,
5
+ Maybe,
6
+ ProductAttributeFilterInput,
7
+ ProductAttributeSortInput,
8
+ Scalars,
9
9
  SortEnum,
10
10
  } from '@graphcommerce/graphql-mesh'
11
11
 
@@ -6,8 +6,8 @@ import type {
6
6
  // eslint-disable-next-line import/no-extraneous-dependencies
7
7
  import { equal } from '@wry/equality'
8
8
  import { useRouter } from 'next/router'
9
- import { ProductListParams } from './filterTypes'
10
- import { FilterTypes } from './getFilterTypes'
9
+ import type { ProductListParams } from './filterTypes'
10
+ import type { FilterTypes } from './getFilterTypes'
11
11
 
12
12
  export function parseParams(
13
13
  url: string,
@@ -1,4 +1,5 @@
1
- import { gql, ApolloClient, NormalizedCacheObject, TypedDocumentNode } from '@graphcommerce/graphql'
1
+ import type { ApolloClient, NormalizedCacheObject, TypedDocumentNode } from '@graphcommerce/graphql'
2
+ import { gql } from '@graphcommerce/graphql'
2
3
  import type { AttributeFrontendInputEnum, Exact } from '@graphcommerce/graphql-mesh'
3
4
  import { filterNonNullableKeys, nonNullable } from '@graphcommerce/next-ui'
4
5
  import { ProductFilterTypesDocument } from './ProductFilterTypes.gql'
@@ -1,8 +1,9 @@
1
1
  import { cloneDeep, useQuery } from '@graphcommerce/graphql'
2
- import { StoreConfigDocument, StoreConfigQuery } from '@graphcommerce/magento-store'
3
- import { ProductListQueryVariables } from '../ProductList/ProductList.gql'
4
- import { CategoryDefaultFragment } from './CategoryDefault.gql'
5
- import { ProductListParams } from './filterTypes'
2
+ import type { StoreConfigQuery } from '@graphcommerce/magento-store'
3
+ import { StoreConfigDocument } from '@graphcommerce/magento-store'
4
+ import type { ProductListQueryVariables } from '../ProductList/ProductList.gql'
5
+ import type { CategoryDefaultFragment } from './CategoryDefault.gql'
6
+ import type { ProductListParams } from './filterTypes'
6
7
 
7
8
  export function useProductListApplyCategoryDefaults(
8
9
  params: ProductListParams | undefined,
@@ -1,5 +1,5 @@
1
- import { TypeRenderer } from '@graphcommerce/next-ui'
2
- import { ProductListItemFragment } from '../../Api/ProductListItem.gql'
1
+ import type { TypeRenderer } from '@graphcommerce/next-ui'
2
+ import type { ProductListItemFragment } from '../../Api/ProductListItem.gql'
3
3
  import { ProductListItem } from '../ProductListItem/ProductListItem'
4
4
 
5
5
  type SkeletonType = { __typename: 'Skeleton'; uid: string }
@@ -8,6 +8,7 @@ export type ProductListItemRenderer = TypeRenderer<ProductListItemFragment | Ske
8
8
 
9
9
  /**
10
10
  * @deprecated Please use productListRenderer from the example directory instead.
11
+ * @public
11
12
  */
12
13
  export const renderer: ProductListItemRenderer = {
13
14
  Skeleton: ProductListItem,
@@ -1,9 +1,11 @@
1
- import { Link, LinkProps } from '@mui/material'
2
- import PageLink, { LinkProps as PageLinkProps } from 'next/link'
1
+ import type { LinkProps } from '@mui/material'
2
+ import { Link } from '@mui/material'
3
+ import type { LinkProps as PageLinkProps } from 'next/link'
4
+ import PageLink from 'next/link'
3
5
  import React from 'react'
4
6
  import { useProductListLink } from '../../hooks/useProductListLink'
5
7
  import { useProductListParamsContext } from '../../hooks/useProductListParamsContext'
6
- import { ProductListParams } from '../ProductListItems/filterTypes'
8
+ import type { ProductListParams } from '../ProductListItems/filterTypes'
7
9
 
8
10
  export type ProductListLinkProps = LinkProps &
9
11
  ProductListParams & {
@@ -1,8 +1,9 @@
1
- import { NextLink, PaginationExtended, Pagination } from '@graphcommerce/next-ui'
2
- import { Link, PaginationProps } from '@mui/material'
1
+ import { NextLink, Pagination, PaginationExtended } from '@graphcommerce/next-ui'
2
+ import type { PaginationProps } from '@mui/material'
3
+ import { Link } from '@mui/material'
3
4
  import { productListLink } from '../../hooks/useProductListLink'
4
- import { ProductListParams } from '../ProductListItems/filterTypes'
5
- import { ProductListPaginationFragment } from './ProductListPagination.gql'
5
+ import type { ProductListParams } from '../ProductListItems/filterTypes'
6
+ import type { ProductListPaginationFragment } from './ProductListPagination.gql'
6
7
 
7
8
  export type ProductPaginationProps = ProductListPaginationFragment &
8
9
  Omit<PaginationProps, 'count' | 'defaultPage' | 'page' | 'renderItem'> & {
@@ -22,7 +23,7 @@ export function ProductListPagination({
22
23
  count={page_info?.total_pages}
23
24
  page={page_info?.current_page ?? 1}
24
25
  renderLink={(_, icon, btnProps) => {
25
- const suffix = btnProps.page === 1 ? '' : `#products`
26
+ const suffix = btnProps.page === 1 ? '' : '#products'
26
27
  return (
27
28
  <Link
28
29
  {...btnProps}
@@ -1,8 +1,9 @@
1
- import { InContextMask } from '@graphcommerce/graphql'
1
+ import { PrivateQueryMask } from '@graphcommerce/graphql'
2
2
  import { Money } from '@graphcommerce/magento-store'
3
3
  import { extendableComponent } from '@graphcommerce/next-ui'
4
- import { Typography, TypographyProps } from '@mui/material'
5
- import { ProductListPriceFragment } from './ProductListPrice.gql'
4
+ import type { TypographyProps } from '@mui/material'
5
+ import { Typography } from '@mui/material'
6
+ import type { ProductListPriceFragment } from './ProductListPrice.gql'
6
7
 
7
8
  export const productListPrice = extendableComponent('ProductListPrice', [
8
9
  'root',
@@ -20,7 +21,7 @@ export function ProductListPrice(props: ProductListPriceProps) {
20
21
  return (
21
22
  <Typography component='div' variant='body1' className={classes.root} sx={sx}>
22
23
  {regular_price.value !== final_price.value && (
23
- <InContextMask
24
+ <PrivateQueryMask
24
25
  component='span'
25
26
  sx={{
26
27
  textDecoration: 'line-through',
@@ -31,11 +32,15 @@ export function ProductListPrice(props: ProductListPriceProps) {
31
32
  className={classes.discountPrice}
32
33
  >
33
34
  <Money {...regular_price} />
34
- </InContextMask>
35
+ </PrivateQueryMask>
35
36
  )}
36
- <InContextMask className={classes.finalPrice} component='span' skeleton={{ width: '3.5em' }}>
37
+ <PrivateQueryMask
38
+ className={classes.finalPrice}
39
+ component='span'
40
+ skeleton={{ width: '3.5em' }}
41
+ >
37
42
  <Money {...final_price} />
38
- </InContextMask>
43
+ </PrivateQueryMask>
39
44
  </Typography>
40
45
  )
41
46
  }
@@ -1,20 +1,22 @@
1
- import { useQuery, cloneDeep } from '@graphcommerce/graphql'
1
+ import { cloneDeep, useQuery } from '@graphcommerce/graphql'
2
2
  import { StoreConfigDocument } from '@graphcommerce/magento-store'
3
- import { ChipMenu, ChipMenuProps, extendableComponent } from '@graphcommerce/next-ui'
3
+ import type { ChipMenuProps } from '@graphcommerce/next-ui'
4
+ import { ChipMenu, extendableComponent } from '@graphcommerce/next-ui'
4
5
  import { Trans } from '@lingui/react'
5
- import { ListItem, ListItemText, SxProps, Theme } from '@mui/material'
6
+ import type { SxProps, Theme } from '@mui/material'
7
+ import { ListItem, ListItemText } from '@mui/material'
6
8
  import React from 'react'
7
9
  import { useProductListLinkReplace } from '../../hooks/useProductListLinkReplace'
8
10
  import { useProductListParamsContext } from '../../hooks/useProductListParamsContext'
9
11
  import { ProductListLink } from '../ProductListLink/ProductListLink'
10
- import { ProductListSortFragment } from './ProductListSort.gql'
12
+ import type { ProductListSortFragment } from './ProductListSort.gql'
11
13
 
12
14
  export type ProductListSortProps = ProductListSortFragment &
13
15
  Omit<ChipMenuProps, 'selected' | 'selectedLabel' | 'children' | 'label' | 'onDelete'> & {
14
16
  sx?: SxProps<Theme>
15
17
  }
16
18
 
17
- const name = 'ProductListSort' as const
19
+ const name = 'ProductListSort'
18
20
  const parts = ['menu', 'item', 'link'] as const
19
21
  const { classes } = extendableComponent(name, parts)
20
22
 
@@ -46,7 +48,7 @@ export function ProductListSort(props: ProductListSortProps) {
46
48
  selected={selected}
47
49
  label={label}
48
50
  {...filterMenuProps}
49
- selectedLabel={selected ? currentOption?.label ?? '' : label}
51
+ selectedLabel={selected ? (currentOption?.label ?? '') : label}
50
52
  onDelete={selected ? removeFilter : undefined}
51
53
  sx={Array.isArray(sx) ? sx : [sx]}
52
54
  >
@@ -0,0 +1,3 @@
1
+ fragment ProductListSearchSuggestion on SearchSuggestion {
2
+ search
3
+ }
@@ -1,5 +1,5 @@
1
1
  fragment ProductListSuggestions on Products {
2
2
  suggestions {
3
- search
3
+ ...ProductListSearchSuggestion
4
4
  }
5
5
  }
@@ -3,9 +3,9 @@ import { Trans } from '@lingui/macro'
3
3
  import { Box, Link } from '@mui/material'
4
4
  import { productListLinkFromFilter } from '../../hooks/useProductListLink'
5
5
  import { useProductFiltersPro } from '../ProductFiltersPro'
6
- import { ProductListSuggestionsFragment } from './ProductListSuggestions.gql'
6
+ import type { ProductListSuggestionsFragment } from './ProductListSuggestions.gql'
7
7
 
8
- type ProductListSuggestionsProps = {
8
+ export type ProductListSuggestionsProps = {
9
9
  products: ProductListSuggestionsFragment
10
10
  }
11
11
 
@@ -1,5 +1,6 @@
1
- import { Box, SxProps, Theme } from '@mui/material'
2
- import { UseAddProductsToCartActionFragment } from '../AddProductsToCart/UseAddProductsToCartAction.gql'
1
+ import type { SxProps, Theme } from '@mui/material'
2
+ import { Box } from '@mui/material'
3
+ import type { UseAddProductsToCartActionFragment } from '../AddProductsToCart/UseAddProductsToCartAction.gql'
3
4
 
4
5
  export type ProductPageAddToCartRowProps = {
5
6
  sx?: SxProps<Theme>
@@ -9,7 +10,7 @@ export type ProductPageAddToCartRowProps = {
9
10
  product: UseAddProductsToCartActionFragment
10
11
  }
11
12
 
12
- export function ProductPageAddToCartRow(props: ProductPageAddToCartRowProps) {
13
+ function ProductPageAddToCartRow(props: ProductPageAddToCartRowProps) {
13
14
  const { sx, children, after } = props
14
15
  return (
15
16
  <>
@@ -1,17 +1,19 @@
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 { Breadcrumbs, BreadcrumbsProps, Link, Typography } from '@mui/material'
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
- type ProductPageBreadcrumbsProps = ProductPageBreadcrumbFragment &
9
+ export type ProductPageBreadcrumbProps = ProductPageBreadcrumbFragment &
9
10
  Omit<BreadcrumbsProps, 'children'>
10
11
 
11
12
  /**
12
13
  * @deprecated Please use ProductPageBreadcrumbs
14
+ * @public
13
15
  */
14
- export function ProductPageBreadcrumb(props: ProductPageBreadcrumbsProps) {
16
+ export function ProductPageBreadcrumb(props: ProductPageBreadcrumbProps) {
15
17
  const { categories, name, ...breadcrumbProps } = props
16
18
  const prev = usePrevPageRouter()
17
19
 
@@ -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,4 +1,4 @@
1
- import { ProductPageCategoryFragment } from './ProductPageCategory.gql'
1
+ import type { ProductPageCategoryFragment } from './ProductPageCategory.gql'
2
2
 
3
3
  /**
4
4
  * Get the most siginifcant category a product is in.
@@ -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 { Box, SxProps, Theme, Typography } from '@mui/material'
9
- import { Variant } from '@mui/material/styles/createTypography'
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
- nonNullable,
3
- SidebarGallery,
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 const ProductPageName = (props: ProductPageNameProps) => {
7
+ export function ProductPageName(props: ProductPageNameProps) {
8
8
  const { product } = props
9
9
  return <>{product.name}</>
10
10
  }