@graphcommerce/magento-product 4.4.23 → 4.5.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/Api/ProductListItem.graphql +0 -3
- package/CHANGELOG.md +52 -0
- package/components/ProductAddToCart/ProductAddToCart.tsx +7 -10
- package/components/ProductList/ProductList.graphql +0 -2
- package/components/ProductListFilters/FilterCheckboxType.tsx +1 -1
- package/components/ProductListFilters/FilterEqualType.tsx +1 -1
- package/components/ProductListFilters/ProductFilters.graphql +5 -0
- package/components/ProductListItem/ProductListItem.tsx +19 -3
- package/components/ProductListItems/filteredProductList.tsx +5 -3
- package/components/ProductPageDescription/ProductPageDescription.tsx +7 -6
- package/components/ProductPagePrice/ProductPagePrice.graphql +0 -18
- package/components/ProductSidebarDelivery/ProductSidebarDelivery.tsx +7 -1
- package/components/index.ts +1 -0
- package/hooks/useProductListLink.ts +21 -12
- package/package.json +9 -9
- package/components/ProductListFilters/ProductFiltersQueryFragment.graphql +0 -5
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,57 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 4.5.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- [#1602](https://github.com/graphcommerce-org/graphcommerce/pull/1602) [`5f781a217`](https://github.com/graphcommerce-org/graphcommerce/commit/5f781a217ce63ed56bc1a9983487b04400a8a315) Thanks [@ErwinOtten](https://github.com/ErwinOtten)! - Default styles and layout fixes
|
|
8
|
+
|
|
9
|
+
- Scaled icons and fonts down. Size in typography is now more gradual: https://graphcommerce.vercel.app/test/typography
|
|
10
|
+
- Multiple accessibility fixes. Missing button/input labels, and fixed spacing issues resulting in high % appropriately sized tap targets
|
|
11
|
+
- Replaced responsiveVal usage with better performaning breakpointVal where possible
|
|
12
|
+
- All buttons are now Pill by default.
|
|
13
|
+
- Cleaned up checkout styles
|
|
14
|
+
|
|
15
|
+
### Patch Changes
|
|
16
|
+
|
|
17
|
+
- [#1590](https://github.com/graphcommerce-org/graphcommerce/pull/1590) [`b40a352f7`](https://github.com/graphcommerce-org/graphcommerce/commit/b40a352f7bccdb831dce1d45baf98d51b0921d58) Thanks [@paales](https://github.com/paales)! - Split ProductList query into two separate queries so the backend can use varnish more effectively
|
|
18
|
+
|
|
19
|
+
* [#1590](https://github.com/graphcommerce-org/graphcommerce/pull/1590) [`40983df17`](https://github.com/graphcommerce-org/graphcommerce/commit/40983df170ed0435c47496285dfe30aafeb2eeac) Thanks [@paales](https://github.com/paales)! - Implement search results with a base static page and dynamic pages after paginating/filtering
|
|
20
|
+
|
|
21
|
+
- [#1590](https://github.com/graphcommerce-org/graphcommerce/pull/1590) [`ec96a0eb0`](https://github.com/graphcommerce-org/graphcommerce/commit/ec96a0eb049ee2204f32f9c578455cf9c131dbd2) Thanks [@paales](https://github.com/paales)! - Filtered category pages are now servered by a separate route with getServerSideProps. Since there are practically infinite variations of filters, it doesn't make sense to query those on a URL level and we're leveraging the backend caching possibilities.
|
|
22
|
+
|
|
23
|
+
- Updated dependencies [[`3ff0e7f2d`](https://github.com/graphcommerce-org/graphcommerce/commit/3ff0e7f2d26edad228848268d24e9aaf56cd2c30), [`04708dacc`](https://github.com/graphcommerce-org/graphcommerce/commit/04708daccc213c6ea927bc67fa3bd0d5b1fad619), [`bb94e7045`](https://github.com/graphcommerce-org/graphcommerce/commit/bb94e7045460cb671c45d612a0833731d7c20c30), [`b0dc4e2e1`](https://github.com/graphcommerce-org/graphcommerce/commit/b0dc4e2e1982d502d38dd50a0f493396360a7a15), [`4a5286dfe`](https://github.com/graphcommerce-org/graphcommerce/commit/4a5286dfeaa1719e594a0078f274fbab53969c4e), [`d46d5ed0c`](https://github.com/graphcommerce-org/graphcommerce/commit/d46d5ed0cc5794391b7527fc17bbb68ec2212e33), [`e573278e4`](https://github.com/graphcommerce-org/graphcommerce/commit/e573278e43506a6b17a2981e61d0e9fad41eb2eb), [`5f781a217`](https://github.com/graphcommerce-org/graphcommerce/commit/5f781a217ce63ed56bc1a9983487b04400a8a315), [`ac6eedbb1`](https://github.com/graphcommerce-org/graphcommerce/commit/ac6eedbb14d3abd8cf1231a98dc2a8b7f4659f1f)]:
|
|
24
|
+
- @graphcommerce/graphql-mesh@4.1.8
|
|
25
|
+
- @graphcommerce/next-ui@4.22.0
|
|
26
|
+
- @graphcommerce/magento-cart@4.7.0
|
|
27
|
+
- @graphcommerce/magento-store@4.2.28
|
|
28
|
+
- @graphcommerce/framer-scroller@2.1.33
|
|
29
|
+
- @graphcommerce/graphql@3.4.7
|
|
30
|
+
- @graphcommerce/image@3.1.9
|
|
31
|
+
|
|
32
|
+
## 4.4.25
|
|
33
|
+
|
|
34
|
+
### Patch Changes
|
|
35
|
+
|
|
36
|
+
- Updated dependencies [[`1f7ee6f6c`](https://github.com/graphcommerce-org/graphcommerce/commit/1f7ee6f6cfb28544439ed36e10929ac530d1b2b7), [`707dbc73d`](https://github.com/graphcommerce-org/graphcommerce/commit/707dbc73d181204d88fdbbd2e09340e25b2b5f7b)]:
|
|
37
|
+
- @graphcommerce/next-ui@4.21.0
|
|
38
|
+
- @graphcommerce/graphql@3.4.6
|
|
39
|
+
- @graphcommerce/graphql-mesh@4.1.7
|
|
40
|
+
- @graphcommerce/framer-scroller@2.1.32
|
|
41
|
+
- @graphcommerce/magento-cart@4.6.9
|
|
42
|
+
- @graphcommerce/magento-store@4.2.27
|
|
43
|
+
- @graphcommerce/image@3.1.8
|
|
44
|
+
|
|
45
|
+
## 4.4.24
|
|
46
|
+
|
|
47
|
+
### Patch Changes
|
|
48
|
+
|
|
49
|
+
- Updated dependencies [[`43822fd61`](https://github.com/graphcommerce-org/graphcommerce/commit/43822fd61c949215b8ddce9fb37d09f29b638426), [`3a619b70d`](https://github.com/graphcommerce-org/graphcommerce/commit/3a619b70d082804b8de46a8e8232f9431479a8b7)]:
|
|
50
|
+
- @graphcommerce/next-ui@4.20.0
|
|
51
|
+
- @graphcommerce/framer-scroller@2.1.31
|
|
52
|
+
- @graphcommerce/magento-cart@4.6.8
|
|
53
|
+
- @graphcommerce/magento-store@4.2.26
|
|
54
|
+
|
|
3
55
|
## 4.4.23
|
|
4
56
|
|
|
5
57
|
### Patch Changes
|
|
@@ -8,11 +8,9 @@ import {
|
|
|
8
8
|
iconChevronRight,
|
|
9
9
|
IconSvg,
|
|
10
10
|
extendableComponent,
|
|
11
|
-
AnimatedRow,
|
|
12
11
|
} from '@graphcommerce/next-ui'
|
|
13
12
|
import { Trans } from '@lingui/react'
|
|
14
|
-
import { Divider, Typography, ButtonProps, Box, Alert } from '@mui/material'
|
|
15
|
-
import { AnimatePresence } from 'framer-motion'
|
|
13
|
+
import { Divider, Typography, ButtonProps, Box, Alert, useMediaQuery, Theme } from '@mui/material'
|
|
16
14
|
import PageLink from 'next/link'
|
|
17
15
|
import React from 'react'
|
|
18
16
|
import { ProductAddToCartDocument, ProductAddToCartMutationVariables } from './ProductAddToCart.gql'
|
|
@@ -100,13 +98,11 @@ export function ProductAddToCart(
|
|
|
100
98
|
|
|
101
99
|
<ApolloCartErrorAlert error={error} />
|
|
102
100
|
|
|
103
|
-
|
|
104
|
-
{
|
|
105
|
-
<
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
))}
|
|
109
|
-
</AnimatePresence>
|
|
101
|
+
{data?.addProductsToCart?.user_errors.map((e) => (
|
|
102
|
+
<Box key={e?.code}>
|
|
103
|
+
<Alert severity='error'>{e?.message}</Alert>
|
|
104
|
+
</Box>
|
|
105
|
+
))}
|
|
110
106
|
|
|
111
107
|
<MessageSnackbar
|
|
112
108
|
open={
|
|
@@ -116,6 +112,7 @@ export function ProductAddToCart(
|
|
|
116
112
|
!data?.addProductsToCart?.user_errors?.length
|
|
117
113
|
}
|
|
118
114
|
variant='pill'
|
|
115
|
+
autoHide
|
|
119
116
|
action={
|
|
120
117
|
<PageLink href='/cart' passHref>
|
|
121
118
|
<Button
|
|
@@ -30,7 +30,7 @@ export function FilterCheckboxType(props: FilterCheckboxTypeProps) {
|
|
|
30
30
|
filters={{ ...params.filters, [attribute_code]: filter }}
|
|
31
31
|
currentPage={undefined}
|
|
32
32
|
noLink
|
|
33
|
-
link={{
|
|
33
|
+
link={{ replace: true, prefetch: false }}
|
|
34
34
|
>
|
|
35
35
|
<Chip
|
|
36
36
|
component='button'
|
|
@@ -115,7 +115,7 @@ export function FilterEqualType(props: FilterEqualTypeProps) {
|
|
|
115
115
|
currentPage={undefined}
|
|
116
116
|
key={option?.value}
|
|
117
117
|
color='inherit'
|
|
118
|
-
link={{ replace: anyFilterActive }}
|
|
118
|
+
link={{ replace: anyFilterActive, prefetch: false }}
|
|
119
119
|
>
|
|
120
120
|
<ListItem
|
|
121
121
|
dense
|
|
@@ -1,5 +1,10 @@
|
|
|
1
1
|
import { Image, ImageProps } from '@graphcommerce/image'
|
|
2
|
-
import {
|
|
2
|
+
import {
|
|
3
|
+
responsiveVal,
|
|
4
|
+
extendableComponent,
|
|
5
|
+
useNumberFormat,
|
|
6
|
+
breakpointVal,
|
|
7
|
+
} from '@graphcommerce/next-ui'
|
|
3
8
|
import { Trans } from '@lingui/react'
|
|
4
9
|
import { ButtonBase, Typography, Box, styled, SxProps, Theme } from '@mui/material'
|
|
5
10
|
import PageLink from 'next/link'
|
|
@@ -83,7 +88,12 @@ export function ProductListItem(props: ProductListItemProps) {
|
|
|
83
88
|
display: 'block',
|
|
84
89
|
position: 'relative',
|
|
85
90
|
height: '100%',
|
|
86
|
-
|
|
91
|
+
...breakpointVal(
|
|
92
|
+
'borderRadius',
|
|
93
|
+
theme.shape.borderRadius * 2,
|
|
94
|
+
theme.shape.borderRadius * 3,
|
|
95
|
+
theme.breakpoints.values,
|
|
96
|
+
),
|
|
87
97
|
}),
|
|
88
98
|
...(Array.isArray(sx) ? sx : [sx]),
|
|
89
99
|
]}
|
|
@@ -93,7 +103,13 @@ export function ProductListItem(props: ProductListItemProps) {
|
|
|
93
103
|
sx={(theme) => ({
|
|
94
104
|
display: 'grid',
|
|
95
105
|
bgcolor: 'background.image',
|
|
96
|
-
|
|
106
|
+
...breakpointVal(
|
|
107
|
+
'borderRadius',
|
|
108
|
+
theme.shape.borderRadius * 2,
|
|
109
|
+
theme.shape.borderRadius * 3,
|
|
110
|
+
theme.breakpoints.values,
|
|
111
|
+
),
|
|
112
|
+
overflow: 'hidden',
|
|
97
113
|
padding: responsiveVal(8, 12),
|
|
98
114
|
'& > picture': {
|
|
99
115
|
gridArea: `1 / 1 / 3 / 3`,
|
|
@@ -18,7 +18,7 @@ export function parseParams(
|
|
|
18
18
|
let error = false
|
|
19
19
|
query.reduce<string | undefined>((param, value) => {
|
|
20
20
|
// We parse everything in pairs, every second loop we parse
|
|
21
|
-
if (!param) return value
|
|
21
|
+
if (!param || param === 'q') return value
|
|
22
22
|
|
|
23
23
|
if (param === 'page') {
|
|
24
24
|
categoryVariables.currentPage = Number(value)
|
|
@@ -64,10 +64,12 @@ export function parseParams(
|
|
|
64
64
|
export function extractUrlQuery(params?: { url: string[] }) {
|
|
65
65
|
if (!params?.url) return [undefined, undefined] as const
|
|
66
66
|
|
|
67
|
-
const queryIndex = params.url.findIndex(
|
|
67
|
+
const queryIndex = params.url.findIndex(
|
|
68
|
+
(slug) => slug === 'q' || slug === 'page' || slug === 'dir',
|
|
69
|
+
)
|
|
68
70
|
const qIndex = queryIndex < 0 ? params.url.length : queryIndex
|
|
69
71
|
const url = params.url.slice(0, qIndex).join('/')
|
|
70
|
-
const query = params.url.slice(qIndex
|
|
72
|
+
const query = params.url.slice(qIndex)
|
|
71
73
|
|
|
72
74
|
if (queryIndex > 0 && !query.length) return [undefined, undefined] as const
|
|
73
75
|
return [url, query] as const
|
|
@@ -2,7 +2,7 @@ import {
|
|
|
2
2
|
ColumnTwoWithTop,
|
|
3
3
|
ColumnTwoWithTopProps,
|
|
4
4
|
extendableComponent,
|
|
5
|
-
|
|
5
|
+
breakpointVal,
|
|
6
6
|
} from '@graphcommerce/next-ui'
|
|
7
7
|
import { Box, SxProps, Theme, Typography } from '@mui/material'
|
|
8
8
|
import { Variant } from '@mui/material/styles/createTypography'
|
|
@@ -52,11 +52,12 @@ export function ProductPageDescription(props: ProductPageDescriptionProps) {
|
|
|
52
52
|
display: 'inline',
|
|
53
53
|
},
|
|
54
54
|
},
|
|
55
|
-
fontSize === 'responsive' &&
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
55
|
+
fontSize === 'responsive' &&
|
|
56
|
+
((theme) => ({
|
|
57
|
+
'& p, & li': {
|
|
58
|
+
...breakpointVal('fontSize', 16, 30, theme.breakpoints.values),
|
|
59
|
+
},
|
|
60
|
+
})),
|
|
60
61
|
fontSize !== 'responsive' && {
|
|
61
62
|
'& p, & li': {
|
|
62
63
|
fontSize,
|
|
@@ -1,23 +1,5 @@
|
|
|
1
1
|
fragment ProductPagePrice on ProductInterface {
|
|
2
2
|
price_range {
|
|
3
|
-
maximum_price {
|
|
4
|
-
regular_price {
|
|
5
|
-
...Money
|
|
6
|
-
}
|
|
7
|
-
discount {
|
|
8
|
-
amount_off
|
|
9
|
-
percent_off
|
|
10
|
-
}
|
|
11
|
-
final_price {
|
|
12
|
-
...Money
|
|
13
|
-
}
|
|
14
|
-
fixed_product_taxes {
|
|
15
|
-
amount {
|
|
16
|
-
...Money
|
|
17
|
-
}
|
|
18
|
-
label
|
|
19
|
-
}
|
|
20
|
-
}
|
|
21
3
|
minimum_price {
|
|
22
4
|
regular_price {
|
|
23
5
|
...Money
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
responsiveVal,
|
|
3
|
+
breakpointVal,
|
|
3
4
|
iconOrderBefore,
|
|
4
5
|
IconSvg,
|
|
5
6
|
extendableComponent,
|
|
@@ -28,7 +29,12 @@ export function ProductSidebarDelivery() {
|
|
|
28
29
|
? darken(theme.palette.background.default, 0.01)
|
|
29
30
|
: lighten(theme.palette.background.default, 0.2),
|
|
30
31
|
padding: theme.spacings.xxs,
|
|
31
|
-
|
|
32
|
+
...breakpointVal(
|
|
33
|
+
'borderRadius',
|
|
34
|
+
theme.shape.borderRadius * 3,
|
|
35
|
+
theme.shape.borderRadius * 4,
|
|
36
|
+
theme.breakpoints.values,
|
|
37
|
+
),
|
|
32
38
|
})}
|
|
33
39
|
>
|
|
34
40
|
<IconSvg
|
package/components/index.ts
CHANGED
|
@@ -3,6 +3,7 @@ export * from './ProductAddToCart/ProductAddToCart'
|
|
|
3
3
|
export * from './ProductAddToCart/ProductAddToCart.gql'
|
|
4
4
|
export * from './ProductList/ProductList.gql'
|
|
5
5
|
export * from './ProductListCount/ProductListCount'
|
|
6
|
+
export * from './ProductListFilters/ProductFilters.gql'
|
|
6
7
|
export * from './ProductListFilters/ProductListFilters'
|
|
7
8
|
export * from './ProductListFiltersContainer/ProductListFiltersContainer'
|
|
8
9
|
export * from './ProductListItem/ProductListItem'
|
|
@@ -6,31 +6,40 @@ import {
|
|
|
6
6
|
} from '../components/ProductListItems/filterTypes'
|
|
7
7
|
|
|
8
8
|
export function createProductListLink(props: ProductListParams): string {
|
|
9
|
-
const { url, sort, currentPage, filters } = props
|
|
9
|
+
const { url, sort, currentPage, filters: incomming } = props
|
|
10
|
+
|
|
11
|
+
const filters = { ...incomming, category_uid: undefined }
|
|
12
|
+
const uid = incomming.category_uid?.eq || incomming.category_uid?.in?.[0]
|
|
10
13
|
|
|
11
14
|
// base url path generation
|
|
12
|
-
let
|
|
15
|
+
let paginateSort = ``
|
|
16
|
+
let query = ``
|
|
13
17
|
|
|
14
|
-
if (currentPage && currentPage > 1)
|
|
18
|
+
if (currentPage && currentPage > 1) paginateSort += `/page/${currentPage}`
|
|
15
19
|
|
|
16
20
|
// todo(paales): How should the URL look like with multiple sorts?
|
|
17
21
|
// Something like: /sort/position,price/dir/asc,asc
|
|
18
22
|
const [sortBy] = Object.keys(sort)
|
|
19
|
-
if (sort && sortBy)
|
|
20
|
-
if (sort && sortBy && sort[sortBy] && sort[sortBy] === 'DESC')
|
|
23
|
+
if (sort && sortBy) query += `/sort/${sortBy}`
|
|
24
|
+
if (sort && sortBy && sort[sortBy] && sort[sortBy] === 'DESC') query += `/dir/desc`
|
|
21
25
|
|
|
22
26
|
// Apply filters
|
|
23
27
|
if (filters)
|
|
24
28
|
Object.entries(filters).forEach(([param, value]) => {
|
|
25
|
-
if (value
|
|
26
|
-
|
|
27
|
-
if (value &&
|
|
28
|
-
if (value
|
|
29
|
-
|
|
29
|
+
if (!value) return
|
|
30
|
+
if (isFilterTypeEqual(value) && value.in?.length) query += `/${param}/${value.in?.join(',')}`
|
|
31
|
+
if (isFilterTypeEqual(value) && value.eq) query += `/${param}/${value.eq}`
|
|
32
|
+
if (isFilterTypeMatch(value)) paginateSort += `/${param}/${value.match}`
|
|
33
|
+
if (isFilterTypeRange(value)) query += `/${param}/${value.from ?? '*'}-${value.to ?? '*'}`
|
|
30
34
|
})
|
|
31
35
|
|
|
32
|
-
|
|
33
|
-
|
|
36
|
+
const result = query
|
|
37
|
+
? `/${url.startsWith('search') ? url : `c/${url}`}${paginateSort}/q${
|
|
38
|
+
uid ? `/category_uid/${uid}` : ''
|
|
39
|
+
}${query}`
|
|
40
|
+
: `/${url}${paginateSort}`
|
|
41
|
+
|
|
42
|
+
return result
|
|
34
43
|
}
|
|
35
44
|
|
|
36
45
|
export function useProductListLink(props: ProductListParams): string {
|
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.
|
|
5
|
+
"version": "4.5.0",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,20 +12,20 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@graphcommerce/eslint-config-pwa": "^4.1.
|
|
15
|
+
"@graphcommerce/eslint-config-pwa": "^4.1.10",
|
|
16
16
|
"@graphcommerce/prettier-config-pwa": "^4.0.6",
|
|
17
17
|
"@graphcommerce/typescript-config-pwa": "^4.0.4",
|
|
18
18
|
"@playwright/test": "^1.21.1",
|
|
19
19
|
"type-fest": "^2.12.2"
|
|
20
20
|
},
|
|
21
21
|
"dependencies": {
|
|
22
|
-
"@graphcommerce/framer-scroller": "2.1.
|
|
23
|
-
"@graphcommerce/graphql": "3.4.
|
|
24
|
-
"@graphcommerce/graphql-mesh": "4.1.
|
|
25
|
-
"@graphcommerce/image": "3.1.
|
|
26
|
-
"@graphcommerce/magento-cart": "4.
|
|
27
|
-
"@graphcommerce/magento-store": "4.2.
|
|
28
|
-
"@graphcommerce/next-ui": "4.
|
|
22
|
+
"@graphcommerce/framer-scroller": "2.1.33",
|
|
23
|
+
"@graphcommerce/graphql": "3.4.7",
|
|
24
|
+
"@graphcommerce/graphql-mesh": "4.1.8",
|
|
25
|
+
"@graphcommerce/image": "3.1.9",
|
|
26
|
+
"@graphcommerce/magento-cart": "4.7.0",
|
|
27
|
+
"@graphcommerce/magento-store": "4.2.28",
|
|
28
|
+
"@graphcommerce/next-ui": "4.22.0",
|
|
29
29
|
"schema-dts": "^1.1.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|