@graphcommerce/magento-product 4.1.10 → 4.3.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.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,34 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.3.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#1256](https://github.com/graphcommerce-org/graphcommerce/pull/1256) [`669a17a97`](https://github.com/graphcommerce-org/graphcommerce/commit/669a17a973c47c00fed4a649a9da0bfc5670c5da) Thanks [@timhofman](https://github.com/timhofman)! - Wishlist
8
+
9
+ ## 4.2.0
10
+
11
+ ### Minor Changes
12
+
13
+ - [#1416](https://github.com/graphcommerce-org/graphcommerce/pull/1416) [`f3d06dd83`](https://github.com/graphcommerce-org/graphcommerce/commit/f3d06dd836c9a76412b419d4d2c79bbd0ee92e04) Thanks [@ErwinOtten](https://github.com/ErwinOtten)! - SEO audit
14
+
15
+ ### Patch Changes
16
+
17
+ - Updated dependencies [[`f3d06dd83`](https://github.com/graphcommerce-org/graphcommerce/commit/f3d06dd836c9a76412b419d4d2c79bbd0ee92e04)]:
18
+ - @graphcommerce/magento-store@4.2.0
19
+ - @graphcommerce/next-ui@4.7.0
20
+ - @graphcommerce/magento-cart@4.2.10
21
+ - @graphcommerce/framer-scroller@2.1.8
22
+
23
+ ## 4.1.11
24
+
25
+ ### Patch Changes
26
+
27
+ - Updated dependencies [[`ba8cd4d34`](https://github.com/graphcommerce-org/graphcommerce/commit/ba8cd4d3480a7ec7e555b051cfd0fbc809c7aa12)]:
28
+ - @graphcommerce/graphql-mesh@4.1.2
29
+ - @graphcommerce/magento-cart@4.2.9
30
+ - @graphcommerce/magento-store@4.1.9
31
+
3
32
  ## 4.1.10
4
33
 
5
34
  ### Patch Changes
@@ -22,6 +22,7 @@ const { classes, selectors } = extendableComponent('ProductAddToCart', [
22
22
  'button',
23
23
  'price',
24
24
  'divider',
25
+ 'buttonWrapper',
25
26
  ] as const)
26
27
 
27
28
  export type AddToCartProps = React.ComponentProps<typeof ProductAddToCart>
@@ -31,10 +32,11 @@ export function ProductAddToCart(
31
32
  variables: Omit<ProductAddToCartMutationVariables, 'cartId'>
32
33
  name: string
33
34
  price: MoneyProps
35
+ additionalButtons?: React.ReactNode
34
36
  children?: React.ReactNode
35
37
  } & Omit<ButtonProps, 'type' | 'name'>,
36
38
  ) {
37
- const { name, children, variables, price, sx, ...buttonProps } = props
39
+ const { name, children, variables, price, sx, additionalButtons, ...buttonProps } = props
38
40
 
39
41
  const form = useFormGqlMutationCart(ProductAddToCartDocument, {
40
42
  defaultValues: { ...variables },
@@ -69,21 +71,32 @@ export function ProductAddToCart(
69
71
  size='small'
70
72
  />
71
73
  {children}
72
- <Button
73
- type='submit'
74
- className={classes.button}
75
- loading={formState.isSubmitting}
76
- color='primary'
77
- variant='pill'
78
- size='large'
74
+ <Box
79
75
  sx={(theme) => ({
80
- marginTop: theme.spacings.sm,
81
- width: '100%',
76
+ display: 'flex',
77
+ alignItems: 'center',
78
+ columnGap: theme.spacings.xs,
82
79
  })}
83
- {...buttonProps}
80
+ className={classes.buttonWrapper}
84
81
  >
85
- <Trans>Add to Cart</Trans>
86
- </Button>
82
+ <Button
83
+ type='submit'
84
+ className={classes.button}
85
+ loading={formState.isSubmitting}
86
+ color='primary'
87
+ variant='pill'
88
+ size='large'
89
+ sx={(theme) => ({
90
+ marginTop: theme.spacings.sm,
91
+ marginBottom: theme.spacings.sm,
92
+ width: '100%',
93
+ })}
94
+ {...buttonProps}
95
+ >
96
+ <Trans>Add to Cart</Trans>
97
+ </Button>
98
+ {additionalButtons}
99
+ </Box>
87
100
 
88
101
  <ApolloCartErrorAlert error={error} />
89
102
 
@@ -43,7 +43,10 @@ type BaseProps = PropsWithChildren<
43
43
  Pick<ImageProps, 'loading' | 'sizes' | 'dontReportWronglySizedImages'>
44
44
  >
45
45
 
46
- export type ProductListItemProps = BaseProps & { sx?: SxProps<Theme> }
46
+ export type ProductListItemProps = BaseProps & {
47
+ sx?: SxProps<Theme>
48
+ titleComponent?: React.ElementType
49
+ }
47
50
 
48
51
  const StyledImage = styled(Image)({})
49
52
 
@@ -63,6 +66,7 @@ export function ProductListItem(props: ProductListItemProps) {
63
66
  sizes,
64
67
  dontReportWronglySizedImages,
65
68
  aspectRatio = [4, 3],
69
+ titleComponent = 'h2',
66
70
  sx = [],
67
71
  } = props
68
72
 
@@ -218,7 +222,7 @@ export function ProductListItem(props: ProductListItemProps) {
218
222
  })}
219
223
  >
220
224
  <Typography
221
- component='h2'
225
+ component={titleComponent}
222
226
  variant='subtitle1'
223
227
  sx={{
224
228
  display: 'inline',
@@ -12,11 +12,12 @@ export type ProductItemsGridProps = {
12
12
  renderers: ProductListItemRenderer
13
13
  loadingEager?: number
14
14
  size?: 'normal' | 'small'
15
+ titleComponent?: React.ElementType
15
16
  sx?: BoxProps['sx']
16
17
  }
17
18
 
18
19
  export function ProductListItemsBase(props: ProductItemsGridProps) {
19
- const { items, sx = [], renderers, loadingEager = 0, size = 'normal' } = props
20
+ const { items, sx = [], renderers, loadingEager = 0, size = 'normal', titleComponent } = props
20
21
 
21
22
  return (
22
23
  <Box
@@ -47,6 +48,7 @@ export function ProductListItemsBase(props: ProductItemsGridProps) {
47
48
  ? { 0: '100vw', 354: '50vw', 675: '30vw', 1255: '23vw', 1500: '337px' }
48
49
  : { 0: '100vw', 367: '48vw', 994: '30vw', 1590: '23vw', 1920: '443px' }
49
50
  }
51
+ titleComponent={titleComponent}
50
52
  noReport
51
53
  />
52
54
  ) : null,
@@ -13,5 +13,5 @@ export function productPageCategory(product?: ProductPageCategoryFragment | null
13
13
  const carryL = carry?.url_path?.split('/')?.length ?? 0
14
14
  const valueL = value?.url_path?.split('/')?.length ?? 0
15
15
  return carryL >= valueL ? carry : value
16
- })
16
+ }, null)
17
17
  }
@@ -27,7 +27,7 @@ export function ProductPageDescription(props: ProductPageDescriptionProps) {
27
27
  className={classes.root}
28
28
  sx={sx}
29
29
  top={
30
- <Typography variant='h1' component='h2'>
30
+ <Typography variant='h1' component='h1'>
31
31
  {name}
32
32
  </Typography>
33
33
  }
@@ -1,5 +1,6 @@
1
1
  export * from './JsonLdProduct/jsonLdProduct'
2
2
  export * from './ProductAddToCart/ProductAddToCart'
3
+ export * from './ProductAddToCart/ProductAddToCart.gql'
3
4
  export * from './ProductList/ProductList.gql'
4
5
  export * from './ProductListCount/ProductListCount'
5
6
  export * from './ProductListFilters/ProductListFilters'
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": "4.1.10",
5
+ "version": "4.3.0",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -19,13 +19,13 @@
19
19
  "type-fest": "^2.12.2"
20
20
  },
21
21
  "dependencies": {
22
- "@graphcommerce/framer-scroller": "2.1.7",
22
+ "@graphcommerce/framer-scroller": "2.1.8",
23
23
  "@graphcommerce/graphql": "3.1.1",
24
- "@graphcommerce/graphql-mesh": "4.1.1",
24
+ "@graphcommerce/graphql-mesh": "4.1.2",
25
25
  "@graphcommerce/image": "3.1.5",
26
- "@graphcommerce/magento-cart": "4.2.8",
27
- "@graphcommerce/magento-store": "4.1.8",
28
- "@graphcommerce/next-ui": "4.6.2",
26
+ "@graphcommerce/magento-cart": "4.2.10",
27
+ "@graphcommerce/magento-store": "4.2.0",
28
+ "@graphcommerce/next-ui": "4.7.0",
29
29
  "schema-dts": "^1.1.0"
30
30
  },
31
31
  "peerDependencies": {