@graphcommerce/magento-category 4.3.1 → 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/CHANGELOG.md +56 -0
- package/components/CategoryChildren/CategoryChildren.tsx +3 -5
- package/components/CategoryHeroNav/CategoryHeroNav.tsx +7 -3
- package/components/CategoryMeta/CategoryMeta.graphql +0 -1
- package/components/CategoryMeta/CategoryMeta.tsx +4 -7
- package/index.ts +1 -1
- package/package.json +8 -8
- package/queries/GetCategoryStaticPaths.graphql +2 -2
- package/queries/MenuQueryFragment.graphql +6 -1
- package/queries/getCategoryStaticPaths.ts +0 -4
- package/{hooks/useMagentoMenuToNavigation.ts → utils/magentoMenuToNavigation.ts} +24 -4
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,61 @@
|
|
|
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
|
+
- [#1601](https://github.com/graphcommerce-org/graphcommerce/pull/1601) [`04708dacc`](https://github.com/graphcommerce-org/graphcommerce/commit/04708daccc213c6ea927bc67fa3bd0d5b1fad619) Thanks [@paales](https://github.com/paales)! - Navigation now uses a single `const selection = useNavigationSelection()` motionValue to control the state of the menu, to prevent excessive rerenders.
|
|
18
|
+
|
|
19
|
+
* [#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.
|
|
20
|
+
|
|
21
|
+
* Updated dependencies [[`b40a352f7`](https://github.com/graphcommerce-org/graphcommerce/commit/b40a352f7bccdb831dce1d45baf98d51b0921d58), [`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), [`40983df17`](https://github.com/graphcommerce-org/graphcommerce/commit/40983df170ed0435c47496285dfe30aafeb2eeac), [`d46d5ed0c`](https://github.com/graphcommerce-org/graphcommerce/commit/d46d5ed0cc5794391b7527fc17bbb68ec2212e33), [`5f781a217`](https://github.com/graphcommerce-org/graphcommerce/commit/5f781a217ce63ed56bc1a9983487b04400a8a315), [`ec96a0eb0`](https://github.com/graphcommerce-org/graphcommerce/commit/ec96a0eb049ee2204f32f9c578455cf9c131dbd2)]:
|
|
22
|
+
- @graphcommerce/magento-product@4.5.0
|
|
23
|
+
- @graphcommerce/next-ui@4.22.0
|
|
24
|
+
- @graphcommerce/magento-store@4.2.28
|
|
25
|
+
- @graphcommerce/framer-scroller@2.1.33
|
|
26
|
+
- @graphcommerce/graphql@3.4.7
|
|
27
|
+
- @graphcommerce/image@3.1.9
|
|
28
|
+
|
|
29
|
+
## 4.4.1
|
|
30
|
+
|
|
31
|
+
### Patch Changes
|
|
32
|
+
|
|
33
|
+
- Updated dependencies [[`1f7ee6f6c`](https://github.com/graphcommerce-org/graphcommerce/commit/1f7ee6f6cfb28544439ed36e10929ac530d1b2b7), [`707dbc73d`](https://github.com/graphcommerce-org/graphcommerce/commit/707dbc73d181204d88fdbbd2e09340e25b2b5f7b)]:
|
|
34
|
+
- @graphcommerce/next-ui@4.21.0
|
|
35
|
+
- @graphcommerce/graphql@3.4.6
|
|
36
|
+
- @graphcommerce/framer-scroller@2.1.32
|
|
37
|
+
- @graphcommerce/magento-product@4.4.25
|
|
38
|
+
- @graphcommerce/magento-store@4.2.27
|
|
39
|
+
- @graphcommerce/image@3.1.8
|
|
40
|
+
|
|
41
|
+
## 4.4.0
|
|
42
|
+
|
|
43
|
+
### Minor Changes
|
|
44
|
+
|
|
45
|
+
- [#1591](https://github.com/graphcommerce-org/graphcommerce/pull/1591) [`eee08c956`](https://github.com/graphcommerce-org/graphcommerce/commit/eee08c956fbcc4fe8d915b6fa8b399dafca69acd) Thanks [@ErwinOtten](https://github.com/ErwinOtten)! - Remove need for rootCategory query
|
|
46
|
+
|
|
47
|
+
* [#1591](https://github.com/graphcommerce-org/graphcommerce/pull/1591) [`79f057889`](https://github.com/graphcommerce-org/graphcommerce/commit/79f057889847c61d75db7f567fd6575a57cf1022) Thanks [@ErwinOtten](https://github.com/ErwinOtten)! - Remove need for query rootCategory
|
|
48
|
+
|
|
49
|
+
### Patch Changes
|
|
50
|
+
|
|
51
|
+
- [#1596](https://github.com/graphcommerce-org/graphcommerce/pull/1596) [`3a619b70d`](https://github.com/graphcommerce-org/graphcommerce/commit/3a619b70d082804b8de46a8e8232f9431479a8b7) Thanks [@paales](https://github.com/paales)! - Make sure the canonical of a page doesn’t contain a double forward slash
|
|
52
|
+
|
|
53
|
+
- Updated dependencies [[`43822fd61`](https://github.com/graphcommerce-org/graphcommerce/commit/43822fd61c949215b8ddce9fb37d09f29b638426), [`3a619b70d`](https://github.com/graphcommerce-org/graphcommerce/commit/3a619b70d082804b8de46a8e8232f9431479a8b7)]:
|
|
54
|
+
- @graphcommerce/next-ui@4.20.0
|
|
55
|
+
- @graphcommerce/framer-scroller@2.1.31
|
|
56
|
+
- @graphcommerce/magento-product@4.4.24
|
|
57
|
+
- @graphcommerce/magento-store@4.2.26
|
|
58
|
+
|
|
3
59
|
## 4.3.1
|
|
4
60
|
|
|
5
61
|
### Patch Changes
|
|
@@ -40,16 +40,14 @@ export function CategoryChildren(props: CategoryChildrenProps) {
|
|
|
40
40
|
{children.map((cat) => {
|
|
41
41
|
if (!cat?.url_path || !cat.name || !cat.include_in_menu) return null
|
|
42
42
|
|
|
43
|
-
const linkParams = cloneDeep(params)
|
|
44
|
-
linkParams.url = cat.url_path
|
|
45
|
-
delete linkParams.currentPage
|
|
46
|
-
|
|
47
43
|
return (
|
|
48
44
|
<ProductListLink
|
|
49
45
|
key={cat.url_path}
|
|
50
46
|
underline='none'
|
|
51
47
|
color='inherit'
|
|
52
|
-
{
|
|
48
|
+
url={cat.url_path}
|
|
49
|
+
filters={{ category_uid: { eq: cat.uid } }}
|
|
50
|
+
sort={params.sort}
|
|
53
51
|
className={classes.link}
|
|
54
52
|
sx={(theme) => ({
|
|
55
53
|
whiteSpace: 'nowrap',
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ProductListLink } from '@graphcommerce/magento-product'
|
|
2
|
-
import { responsiveVal, Row, extendableComponent } from '@graphcommerce/next-ui'
|
|
2
|
+
import { responsiveVal, breakpointVal, Row, extendableComponent } from '@graphcommerce/next-ui'
|
|
3
3
|
import { Box, SxProps, Theme, Typography } from '@mui/material'
|
|
4
4
|
import React from 'react'
|
|
5
5
|
import { CategoryHeroNavFragment } from './CategoryHeroNav.gql'
|
|
@@ -33,7 +33,6 @@ export function CategoryHeroNav({ children, title, asset, sx = [] }: CategoryHer
|
|
|
33
33
|
marginBottom: theme.spacings.xxl,
|
|
34
34
|
paddingBottom: theme.page.vertical,
|
|
35
35
|
[theme.breakpoints.up('md')]: {
|
|
36
|
-
rowGap: theme.spacings.md,
|
|
37
36
|
width: '100%',
|
|
38
37
|
paddingRight: theme.page.horizontal,
|
|
39
38
|
paddingTop: 0,
|
|
@@ -117,7 +116,12 @@ export function CategoryHeroNav({ children, title, asset, sx = [] }: CategoryHer
|
|
|
117
116
|
'& video': {
|
|
118
117
|
objectFit: 'cover',
|
|
119
118
|
width: '100%',
|
|
120
|
-
|
|
119
|
+
...breakpointVal(
|
|
120
|
+
'borderRadius',
|
|
121
|
+
theme.shape.borderRadius * 2,
|
|
122
|
+
theme.shape.borderRadius * 3,
|
|
123
|
+
theme.breakpoints.values,
|
|
124
|
+
),
|
|
121
125
|
},
|
|
122
126
|
[theme.breakpoints.up('md')]: {
|
|
123
127
|
minHeight: '80vh',
|
|
@@ -5,13 +5,10 @@ import { i18n } from '@lingui/core'
|
|
|
5
5
|
import { CategoryMetaFragment } from './CategoryMeta.gql'
|
|
6
6
|
|
|
7
7
|
export type CategoryMetaProps = CategoryMetaFragment &
|
|
8
|
-
Partial<PageMetaProps> & {
|
|
9
|
-
params?: ProductListParams
|
|
10
|
-
current_page?: number | null | undefined
|
|
11
|
-
}
|
|
8
|
+
Partial<PageMetaProps> & { params?: ProductListParams }
|
|
12
9
|
|
|
13
10
|
export function CategoryMeta(props: CategoryMetaProps) {
|
|
14
|
-
const { meta_title, meta_description, name, params
|
|
11
|
+
const { meta_title, meta_description, name, params } = props
|
|
15
12
|
let {
|
|
16
13
|
title = meta_title ?? name ?? '',
|
|
17
14
|
metaDescription = meta_description ?? undefined,
|
|
@@ -21,8 +18,8 @@ export function CategoryMeta(props: CategoryMetaProps) {
|
|
|
21
18
|
|
|
22
19
|
if (params?.url && !canonical) canonical = `/${params.url}`
|
|
23
20
|
|
|
24
|
-
|
|
25
|
-
|
|
21
|
+
const anyFilterActive =
|
|
22
|
+
Object.keys(params?.filters ?? {}).filter((k) => k !== 'category_uid').length > 0
|
|
26
23
|
const currentPage = params?.currentPage ?? 1
|
|
27
24
|
const isPaginated = currentPage > 1 && !anyFilterActive
|
|
28
25
|
|
package/index.ts
CHANGED
|
@@ -3,5 +3,5 @@ export * from './components/CategoryDescription/CategoryDescription'
|
|
|
3
3
|
export * from './components/CategoryHeroNav/CategoryHeroNav'
|
|
4
4
|
export * from './components/CategoryHeroNav/CategoryHeroNavTitle'
|
|
5
5
|
export * from './components/CategoryMeta/CategoryMeta'
|
|
6
|
-
export * from './
|
|
6
|
+
export * from './utils/magentoMenuToNavigation'
|
|
7
7
|
export * from './queries/getCategoryStaticPaths'
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/magento-category",
|
|
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,19 +12,19 @@
|
|
|
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/image": "3.1.
|
|
25
|
-
"@graphcommerce/magento-product": "4.
|
|
26
|
-
"@graphcommerce/magento-store": "4.2.
|
|
27
|
-
"@graphcommerce/next-ui": "4.
|
|
22
|
+
"@graphcommerce/framer-scroller": "2.1.33",
|
|
23
|
+
"@graphcommerce/graphql": "3.4.7",
|
|
24
|
+
"@graphcommerce/image": "3.1.9",
|
|
25
|
+
"@graphcommerce/magento-product": "4.5.0",
|
|
26
|
+
"@graphcommerce/magento-store": "4.2.28",
|
|
27
|
+
"@graphcommerce/next-ui": "4.22.0"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@lingui/react": "^3.13.2",
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
fragment MenuQueryFragment on Query {
|
|
2
|
-
menu: categories
|
|
2
|
+
menu: categories {
|
|
3
3
|
items {
|
|
4
|
+
uid
|
|
4
5
|
...NavigationItem
|
|
5
6
|
children {
|
|
6
7
|
uid
|
|
@@ -8,6 +9,10 @@ fragment MenuQueryFragment on Query {
|
|
|
8
9
|
children {
|
|
9
10
|
uid
|
|
10
11
|
...NavigationItem
|
|
12
|
+
children {
|
|
13
|
+
uid
|
|
14
|
+
...NavigationItem
|
|
15
|
+
}
|
|
11
16
|
}
|
|
12
17
|
}
|
|
13
18
|
}
|
|
@@ -12,12 +12,8 @@ const getCategoryStaticPaths = async (
|
|
|
12
12
|
client: ApolloClient<NormalizedCacheObject>,
|
|
13
13
|
locale: string,
|
|
14
14
|
) => {
|
|
15
|
-
const rootCategory =
|
|
16
|
-
(await client.query({ query: StoreConfigDocument })).data.storeConfig?.root_category_uid ?? ''
|
|
17
|
-
|
|
18
15
|
const { data } = await client.query({
|
|
19
16
|
query: GetCategoryStaticPathsDocument,
|
|
20
|
-
variables: { rootCategory },
|
|
21
17
|
})
|
|
22
18
|
|
|
23
19
|
const paths: StaticPathsResult['paths'] = []
|
|
@@ -13,7 +13,7 @@ export function categoryToNav(props: Item | null | undefined): NavigationNode |
|
|
|
13
13
|
if (!props) return undefined
|
|
14
14
|
const { uid, children, include_in_menu, name, url_path } = props
|
|
15
15
|
|
|
16
|
-
if (!uid || include_in_menu !== 1 || !
|
|
16
|
+
if (!uid || include_in_menu !== 1 || !name) return undefined
|
|
17
17
|
|
|
18
18
|
// If we've got children we make a button that navigates to childitems.
|
|
19
19
|
if (children && children.length > 0) {
|
|
@@ -21,7 +21,15 @@ export function categoryToNav(props: Item | null | undefined): NavigationNode |
|
|
|
21
21
|
name,
|
|
22
22
|
id: uid,
|
|
23
23
|
childItems: [
|
|
24
|
-
|
|
24
|
+
...(url_path
|
|
25
|
+
? [
|
|
26
|
+
{
|
|
27
|
+
name: i18n._(/* i18n */ 'All {name}', { name }),
|
|
28
|
+
href: `/${url_path}`,
|
|
29
|
+
id: `${uid}-all`,
|
|
30
|
+
},
|
|
31
|
+
]
|
|
32
|
+
: []),
|
|
25
33
|
...children.map(categoryToNav).filter(nonNullable),
|
|
26
34
|
],
|
|
27
35
|
} as NavigationNodeButton
|
|
@@ -35,6 +43,18 @@ export function categoryToNav(props: Item | null | undefined): NavigationNode |
|
|
|
35
43
|
* Converts the Magento GraphQL category tree to a NavigationNode tree, which can be used in the
|
|
36
44
|
* Navigation component.
|
|
37
45
|
*/
|
|
38
|
-
export function
|
|
39
|
-
return (menu?.items
|
|
46
|
+
export function magentoMenuToNavigation(menu: MenuQueryFragment['menu'], includeRoot: boolean) {
|
|
47
|
+
return ((includeRoot ? menu?.items : menu?.items?.[0]?.children) || [])
|
|
48
|
+
.map(categoryToNav)
|
|
49
|
+
.filter(nonNullable)
|
|
50
|
+
}
|
|
51
|
+
|
|
52
|
+
/**
|
|
53
|
+
* Converts the Magento GraphQL category tree to a NavigationNode tree, which can be used in the
|
|
54
|
+
* Navigation component.
|
|
55
|
+
*
|
|
56
|
+
* @deprecated Please use magentoMenuToNavigation instead.
|
|
57
|
+
*/
|
|
58
|
+
export function useMagentoMenuToNavigation(menu: MenuQueryFragment['menu'], includeRoot: boolean) {
|
|
59
|
+
return magentoMenuToNavigation(menu, includeRoot)
|
|
40
60
|
}
|