@graphcommerce/magento-product 3.7.0 → 3.7.4
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 +11 -0
- package/components/ProductListFilters/FilterCheckboxType.tsx +1 -1
- package/components/ProductListFilters/FilterEqualType.tsx +0 -1
- package/components/ProductListFilters/index.tsx +5 -1
- package/components/ProductListFiltersContainer/index.tsx +4 -3
- package/components/ProductListItem/index.tsx +3 -3
- package/components/ProductListItems/ProductListItemsBase.tsx +0 -1
- package/components/ProductListItems/ProductListParamsProvider.tsx +5 -7
- package/components/ProductListSort/index.tsx +2 -2
- package/components/ProductPageDescription/index.tsx +17 -18
- package/components/ProductShortDescription/index.tsx +3 -5
- package/components/ProductSidebarDelivery/index.tsx +1 -1
- package/hooks/useProductListLinkReplace.ts +5 -4
- package/package.json +9 -9
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
## [3.7.2](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-product@3.7.1...@graphcommerce/magento-product@3.7.2) (2021-12-03)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* make sure elements that use scroll positioning are using the right hook ([80ee33f](https://github.com/ho-nl/m2-pwa/commit/80ee33f68ecc223147d63fc37e5b9ba94df4564e))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [3.7.0](https://github.com/ho-nl/m2-pwa/compare/@graphcommerce/magento-product@3.6.4...@graphcommerce/magento-product@3.7.0) (2021-12-01)
|
|
7
18
|
|
|
8
19
|
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { cloneDeep } from '@apollo/client/utilities'
|
|
2
|
-
import { useChipMenuStyles,
|
|
2
|
+
import { useChipMenuStyles, iconCancelAlt, SvgImageSimple } from '@graphcommerce/next-ui'
|
|
3
3
|
import { Chip, ChipProps } from '@material-ui/core'
|
|
4
4
|
import clsx from 'clsx'
|
|
5
5
|
import React from 'react'
|
|
@@ -53,7 +53,11 @@ export default function ProductListFilters(props: ProductFiltersProps) {
|
|
|
53
53
|
/>
|
|
54
54
|
)
|
|
55
55
|
}
|
|
56
|
-
console.log(
|
|
56
|
+
console.log(
|
|
57
|
+
'Filter not recognized',
|
|
58
|
+
aggregation.attribute_code,
|
|
59
|
+
filterTypes[aggregation.attribute_code],
|
|
60
|
+
)
|
|
57
61
|
return null // `FilterMatchTypeInput not ${aggregation.attribute_code}`
|
|
58
62
|
})}
|
|
59
63
|
</>
|
|
@@ -4,11 +4,12 @@ import {
|
|
|
4
4
|
iconChevronRight,
|
|
5
5
|
responsiveVal,
|
|
6
6
|
SvgImageSimple,
|
|
7
|
+
useScrollY,
|
|
7
8
|
UseStyles,
|
|
8
9
|
} from '@graphcommerce/next-ui'
|
|
9
10
|
import { makeStyles, Theme } from '@material-ui/core'
|
|
10
11
|
import clsx from 'clsx'
|
|
11
|
-
import { m,
|
|
12
|
+
import { m, useTransform } from 'framer-motion'
|
|
12
13
|
import React, { PropsWithChildren, useEffect, useRef, useState } from 'react'
|
|
13
14
|
|
|
14
15
|
const useStyles = makeStyles(
|
|
@@ -91,7 +92,7 @@ export type ProductListFiltersContainerProps = PropsWithChildren<UseStyles<typeo
|
|
|
91
92
|
export default function ProductListFiltersContainer(props: ProductListFiltersContainerProps) {
|
|
92
93
|
const { children } = props
|
|
93
94
|
const classes = useStyles(props)
|
|
94
|
-
const
|
|
95
|
+
const scrollY = useScrollY()
|
|
95
96
|
|
|
96
97
|
const [isSticky, setIsSticky] = useState<boolean>(false)
|
|
97
98
|
const [startPosition, setStartPosition] = useState<number>(100)
|
|
@@ -148,7 +149,7 @@ export default function ProductListFiltersContainer(props: ProductListFiltersCon
|
|
|
148
149
|
>
|
|
149
150
|
{children}
|
|
150
151
|
</Scroller>
|
|
151
|
-
<m.div className={classes.shadow} style={{ opacity }}
|
|
152
|
+
<m.div className={classes.shadow} style={{ opacity }} />
|
|
152
153
|
</div>
|
|
153
154
|
<ScrollerButton direction='right' className={classes.sliderNext}>
|
|
154
155
|
<SvgImageSimple src={iconChevronRight} />
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
+
import { usePageRouter } from '@graphcommerce/framer-next-pages'
|
|
1
2
|
import { Image, ImageProps } from '@graphcommerce/image'
|
|
2
3
|
import { responsiveVal, UseStyles } from '@graphcommerce/next-ui'
|
|
3
|
-
import { ButtonBase,
|
|
4
|
+
import { ButtonBase, makeStyles, Theme, Typography } from '@material-ui/core'
|
|
4
5
|
import clsx from 'clsx'
|
|
5
6
|
import PageLink from 'next/link'
|
|
6
|
-
import { useRouter } from 'next/router'
|
|
7
7
|
import React, { PropsWithChildren, useCallback } from 'react'
|
|
8
8
|
import { ProductListItemFragment } from '../../Api/ProductListItem.gql'
|
|
9
9
|
import { useProductLink } from '../../hooks/useProductLink'
|
|
@@ -157,7 +157,7 @@ export default function ProductListItem(props: ProductListItemProps) {
|
|
|
157
157
|
const classes = useProductListItemStyles(props)
|
|
158
158
|
const productLink = useProductLink(props)
|
|
159
159
|
const discount = Math.floor(price_range.minimum_price.discount?.percent_off ?? 0)
|
|
160
|
-
const { locale } =
|
|
160
|
+
const { locale } = usePageRouter()
|
|
161
161
|
|
|
162
162
|
// eslint-disable-next-line react-hooks/exhaustive-deps
|
|
163
163
|
const format = useCallback(
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PropsWithChildren, useState, useEffect } from 'react'
|
|
1
|
+
import { PropsWithChildren, useState, useEffect, useMemo } from 'react'
|
|
2
2
|
import { productListParamsContext } from '../../context/productListParamsContext'
|
|
3
3
|
import { ProductListParams } from './filterTypes'
|
|
4
4
|
|
|
@@ -8,13 +8,11 @@ export default function ProductListParamsProvider({
|
|
|
8
8
|
}: PropsWithChildren<{ value: ProductListParams }>) {
|
|
9
9
|
const [params, setParams] = useState<ProductListParams>(value)
|
|
10
10
|
|
|
11
|
-
useEffect(() =>
|
|
12
|
-
|
|
13
|
-
}, [
|
|
11
|
+
useEffect(() => setParams(value), [value])
|
|
12
|
+
|
|
13
|
+
const prov = useMemo(() => ({ params, setParams }), [params])
|
|
14
14
|
|
|
15
15
|
return (
|
|
16
|
-
<productListParamsContext.Provider value={{
|
|
17
|
-
{children}
|
|
18
|
-
</productListParamsContext.Provider>
|
|
16
|
+
<productListParamsContext.Provider value={prov}>{children}</productListParamsContext.Provider>
|
|
19
17
|
)
|
|
20
18
|
}
|
|
@@ -53,7 +53,7 @@ export default function ProductListSort(props: ProductListSortProps) {
|
|
|
53
53
|
key={option?.value ?? ''}
|
|
54
54
|
dense
|
|
55
55
|
selected={option?.value === currentSort}
|
|
56
|
-
component={(chipProps) => (
|
|
56
|
+
component={React.memo((chipProps) => (
|
|
57
57
|
<ProductListLink
|
|
58
58
|
{...chipProps}
|
|
59
59
|
{...linkParams}
|
|
@@ -61,7 +61,7 @@ export default function ProductListSort(props: ProductListSortProps) {
|
|
|
61
61
|
underline='none'
|
|
62
62
|
link={{ scroll: false, replace: true }}
|
|
63
63
|
/>
|
|
64
|
-
)}
|
|
64
|
+
))}
|
|
65
65
|
>
|
|
66
66
|
<ListItemText secondary>{option?.label}</ListItemText>
|
|
67
67
|
</ListItem>
|
|
@@ -41,23 +41,22 @@ export default function ProductPageDescription(props: ProductPageDescriptionProp
|
|
|
41
41
|
const { description, name, right } = props
|
|
42
42
|
|
|
43
43
|
return (
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
</>
|
|
44
|
+
<ColumnTwoWithTop
|
|
45
|
+
top={
|
|
46
|
+
<Typography variant='h1' component='h2'>
|
|
47
|
+
{name}
|
|
48
|
+
</Typography>
|
|
49
|
+
}
|
|
50
|
+
left={
|
|
51
|
+
description && (
|
|
52
|
+
<div
|
|
53
|
+
className={classes.description}
|
|
54
|
+
// eslint-disable-next-line react/no-danger
|
|
55
|
+
dangerouslySetInnerHTML={{ __html: description.html }}
|
|
56
|
+
/>
|
|
57
|
+
)
|
|
58
|
+
}
|
|
59
|
+
right={right}
|
|
60
|
+
/>
|
|
62
61
|
)
|
|
63
62
|
}
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
import { UseStyles } from '@graphcommerce/next-ui'
|
|
2
|
-
import { makeStyles,
|
|
2
|
+
import { makeStyles, Typography } from '@material-ui/core'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
import { ProductShortDescriptionFragment } from './ProductShortDescription.gql'
|
|
5
5
|
|
|
6
6
|
const useStyles = makeStyles(
|
|
7
|
-
|
|
7
|
+
{
|
|
8
8
|
root: {
|
|
9
9
|
'& > p': {
|
|
10
10
|
marginTop: 0,
|
|
11
11
|
},
|
|
12
12
|
},
|
|
13
|
-
}),
|
|
14
|
-
{
|
|
15
|
-
name: 'ProductShortDescription',
|
|
16
13
|
},
|
|
14
|
+
{ name: 'ProductShortDescription' },
|
|
17
15
|
)
|
|
18
16
|
|
|
19
17
|
type ProductShortDescriptionProps = ProductShortDescriptionFragment & UseStyles<typeof useStyles>
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { responsiveVal, iconOrderBefore, SvgImageSimple } from '@graphcommerce/next-ui'
|
|
2
2
|
import { darken, lighten, makeStyles, Theme, Typography } from '@material-ui/core'
|
|
3
3
|
import React from 'react'
|
|
4
4
|
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { useRouter } from 'next/router'
|
|
2
2
|
import { ProductListParams } from '../components/ProductListItems/filterTypes'
|
|
3
3
|
import { createProductListLink } from './useProductListLink'
|
|
4
4
|
import { useProductListParamsContext } from './useProductListParamsContext'
|
|
@@ -11,9 +11,10 @@ type UseProductLinkPushProps = {
|
|
|
11
11
|
|
|
12
12
|
export function useProductListLinkReplace(props?: UseProductLinkPushProps) {
|
|
13
13
|
const { setParams } = useProductListParamsContext()
|
|
14
|
+
const router = useRouter()
|
|
14
15
|
|
|
15
16
|
return (params: ProductListParams) => {
|
|
16
|
-
const queryUrl =
|
|
17
|
+
const queryUrl = router.query.url ?? []
|
|
17
18
|
const comingFromURLWithoutFilters = !queryUrl.includes('q')
|
|
18
19
|
|
|
19
20
|
setParams(params)
|
|
@@ -23,10 +24,10 @@ export function useProductListLinkReplace(props?: UseProductLinkPushProps) {
|
|
|
23
24
|
// push the first filter, so the new route (on browser back) will be e.g. /women/fruit instead of /women
|
|
24
25
|
if (comingFromURLWithoutFilters) {
|
|
25
26
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
26
|
-
|
|
27
|
+
router.push(path, path, props)
|
|
27
28
|
} else {
|
|
28
29
|
// eslint-disable-next-line @typescript-eslint/no-floating-promises
|
|
29
|
-
|
|
30
|
+
router.replace(path, path, props)
|
|
30
31
|
}
|
|
31
32
|
}
|
|
32
33
|
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@graphcommerce/magento-product",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.4",
|
|
4
4
|
"sideEffects": false,
|
|
5
5
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
6
6
|
"browserslist": [
|
|
@@ -14,19 +14,19 @@
|
|
|
14
14
|
},
|
|
15
15
|
"devDependencies": {
|
|
16
16
|
"@graphcommerce/browserslist-config-pwa": "^3.0.2",
|
|
17
|
-
"@graphcommerce/eslint-config-pwa": "^3.1.
|
|
17
|
+
"@graphcommerce/eslint-config-pwa": "^3.1.6",
|
|
18
18
|
"@graphcommerce/prettier-config-pwa": "^3.0.4",
|
|
19
19
|
"@graphcommerce/typescript-config-pwa": "^3.1.1",
|
|
20
20
|
"@playwright/test": "^1.16.2"
|
|
21
21
|
},
|
|
22
22
|
"dependencies": {
|
|
23
23
|
"@apollo/client": "^3.4.16",
|
|
24
|
-
"@graphcommerce/framer-scroller": "^1.
|
|
25
|
-
"@graphcommerce/graphql": "^2.105.
|
|
26
|
-
"@graphcommerce/image": "^2.105.
|
|
27
|
-
"@graphcommerce/magento-cart": "^3.8.
|
|
28
|
-
"@graphcommerce/magento-store": "^3.3.
|
|
29
|
-
"@graphcommerce/next-ui": "^3.
|
|
24
|
+
"@graphcommerce/framer-scroller": "^1.1.2",
|
|
25
|
+
"@graphcommerce/graphql": "^2.105.6",
|
|
26
|
+
"@graphcommerce/image": "^2.105.5",
|
|
27
|
+
"@graphcommerce/magento-cart": "^3.8.4",
|
|
28
|
+
"@graphcommerce/magento-store": "^3.3.9",
|
|
29
|
+
"@graphcommerce/next-ui": "^3.20.2",
|
|
30
30
|
"@lingui/macro": "^3.12.1",
|
|
31
31
|
"@material-ui/core": "^4.12.3",
|
|
32
32
|
"@material-ui/lab": "^4.0.0-alpha.60",
|
|
@@ -38,5 +38,5 @@
|
|
|
38
38
|
"schema-dts": "^1.0.0",
|
|
39
39
|
"type-fest": "^2.5.1"
|
|
40
40
|
},
|
|
41
|
-
"gitHead": "
|
|
41
|
+
"gitHead": "688a7042901bf36f8ab8bbf8e1886570a5350b9e"
|
|
42
42
|
}
|