@graphcommerce/magento-product 7.0.0-canary.21 → 7.0.1-canary.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 +237 -1
- package/Config.graphqls +12 -2
- package/components/AddProductsToCart/AddProductsToCart.graphql +1 -0
- package/components/AddProductsToCart/AddProductsToCartError.tsx +2 -3
- package/components/AddProductsToCart/AddProductsToCartForm.tsx +1 -2
- package/components/AddProductsToCart/AddProductsToCartQuantity.tsx +3 -2
- package/components/AddProductsToCart/useAddProductsToCartAction.ts +2 -3
- package/components/AddProductsToCart/useFormAddProductsToCart.ts +3 -1
- package/components/JsonLdProduct/JsonLdProduct.graphql +1 -1
- package/components/JsonLdProduct/ProductPageJsonLd.tsx +12 -0
- package/components/JsonLdProduct/index.ts +2 -0
- package/components/ProductCustomizable/ProductCustomizable.tsx +4 -5
- package/components/ProductFiltersPro/PriceSlider.tsx +7 -2
- package/components/ProductFiltersPro/ProductFilterEqualChip.tsx +1 -1
- package/components/ProductFiltersPro/ProductFilterEqualSection.tsx +36 -37
- package/components/ProductFiltersPro/ProductFilterRangeChip.tsx +1 -1
- package/components/ProductFiltersPro/ProductFilterRangeSection.tsx +19 -23
- package/components/ProductFiltersPro/ProductFiltersPro.tsx +35 -18
- package/components/ProductFiltersPro/ProductFiltersProAggregations.tsx +5 -6
- package/components/ProductFiltersPro/ProductFiltersProAllFiltersChip.tsx +20 -43
- package/components/ProductFiltersPro/ProductFiltersProAllFiltersSidebar.tsx +32 -0
- package/components/ProductFiltersPro/ProductFiltersProClearAll.tsx +48 -0
- package/components/ProductFiltersPro/ProductFiltersProLayoutSidebar.tsx +100 -0
- package/components/ProductFiltersPro/ProductFiltersProLimitChip.tsx +2 -2
- package/components/ProductFiltersPro/ProductFiltersProLimitSection.tsx +35 -32
- package/components/ProductFiltersPro/ProductFiltersProSortChip.tsx +3 -2
- package/components/ProductFiltersPro/ProductFiltersProSortSection.tsx +31 -31
- package/components/ProductFiltersPro/index.ts +3 -0
- package/components/ProductFiltersPro/useClearAllFiltersHandler.ts +31 -0
- package/components/ProductListCount/ProductListCount.tsx +12 -6
- package/components/ProductListFilters/FilterEqualType.tsx +1 -0
- package/components/ProductListFilters/FilterRangeType.tsx +1 -0
- package/components/ProductListItems/ProductListItemsBase.tsx +58 -38
- package/components/ProductListItems/filterTypes.tsx +4 -5
- package/components/ProductListLink/ProductListLink.tsx +1 -0
- package/components/ProductListPagination/ProductListPagination.tsx +14 -7
- package/components/ProductListPrice/ProductListPrice.tsx +1 -1
- package/components/ProductListPrice/index.ts +2 -0
- package/components/ProductPage/ProductPageAddToCartRow.tsx +3 -2
- package/components/ProductPageBreadcrumb/ProductPageBreadcrumb.tsx +2 -2
- package/components/ProductPageDescription/ProductPageDescription.graphql +1 -0
- package/components/ProductPageDescription/ProductPageDescription.tsx +6 -4
- package/components/ProductPageGallery/ProductPageGallery.graphql +1 -0
- package/components/ProductPageGallery/ProductPageGallery.tsx +6 -8
- package/components/ProductPageMeta/ProductPageMeta.graphql +5 -3
- package/components/ProductPageMeta/ProductPageMeta.tsx +18 -21
- package/components/ProductPageName/ProductPageName.graphql +4 -0
- package/components/ProductPageName/ProductPageName.tsx +10 -0
- package/components/ProductPageName/index.ts +1 -0
- package/components/ProductPagePrice/ProductPagePrice.graphql +1 -0
- package/components/ProductPagePrice/ProductPagePrice.tsx +2 -2
- package/components/ProductShortDescription/ProductShortDescription.graphql +1 -0
- package/components/ProductShortDescription/ProductShortDescription.tsx +6 -2
- package/components/ProductSpecs/ProductSpecs.tsx +7 -2
- package/components/index.ts +5 -2
- package/hooks/useProductListLink.ts +2 -2
- package/hooks/useProductListLinkReplace.ts +2 -2
- package/index.ts +1 -0
- package/package.json +16 -15
- package/components/AddProductsToCart/AddProductsToCartIndex.tsx +0 -3
- package/components/ProductFiltersPro/useFilterActions.ts +0 -61
- package/components/ProductListItems/ProductListItems.tsx +0 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { useRouter } from 'next/router'
|
|
2
2
|
import { ProductListParams } from '../components/ProductListItems/filterTypes'
|
|
3
|
-
import {
|
|
3
|
+
import { productListLink } from './useProductListLink'
|
|
4
4
|
import { useProductListParamsContext } from './useProductListParamsContext'
|
|
5
5
|
|
|
6
6
|
type UseProductLinkPushProps = {
|
|
@@ -19,7 +19,7 @@ export function useProductListLinkReplace(props?: UseProductLinkPushProps) {
|
|
|
19
19
|
|
|
20
20
|
setParams(params)
|
|
21
21
|
|
|
22
|
-
const path =
|
|
22
|
+
const path = productListLink(params)
|
|
23
23
|
|
|
24
24
|
if (router.asPath === path) return false
|
|
25
25
|
|
package/index.ts
CHANGED
|
@@ -2,6 +2,7 @@ export * from './components'
|
|
|
2
2
|
export * from './Api/ProductListItem.gql'
|
|
3
3
|
export * from './Api/ProductPageItem.gql'
|
|
4
4
|
export * from './hooks/useProductLink'
|
|
5
|
+
export * from './hooks/useProductListLink'
|
|
5
6
|
export * from './hooks/useProductListLinkReplace'
|
|
6
7
|
export * from './hooks/useProductListParamsContext'
|
|
7
8
|
export * from './hooks/ProductLink.gql'
|
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": "7.0.
|
|
5
|
+
"version": "7.0.1-canary.0",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,25 +12,26 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@graphcommerce/eslint-config-pwa": "7.0.
|
|
16
|
-
"@graphcommerce/prettier-config-pwa": "7.0.
|
|
17
|
-
"@graphcommerce/typescript-config-pwa": "7.0.
|
|
15
|
+
"@graphcommerce/eslint-config-pwa": "7.0.1-canary.0",
|
|
16
|
+
"@graphcommerce/prettier-config-pwa": "7.0.1-canary.0",
|
|
17
|
+
"@graphcommerce/typescript-config-pwa": "7.0.1-canary.0"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@graphcommerce/ecommerce-ui": "7.0.
|
|
21
|
-
"@graphcommerce/framer-scroller": "7.0.
|
|
22
|
-
"@graphcommerce/framer-next-pages": "7.0.
|
|
23
|
-
"@graphcommerce/graphql": "7.0.
|
|
24
|
-
"@graphcommerce/graphql-mesh": "7.0.
|
|
25
|
-
"@graphcommerce/image": "7.0.
|
|
26
|
-
"@graphcommerce/magento-cart": "7.0.
|
|
27
|
-
"@graphcommerce/magento-store": "7.0.
|
|
28
|
-
"@graphcommerce/next-ui": "7.0.
|
|
20
|
+
"@graphcommerce/ecommerce-ui": "7.0.1-canary.0",
|
|
21
|
+
"@graphcommerce/framer-scroller": "7.0.1-canary.0",
|
|
22
|
+
"@graphcommerce/framer-next-pages": "7.0.1-canary.0",
|
|
23
|
+
"@graphcommerce/graphql": "7.0.1-canary.0",
|
|
24
|
+
"@graphcommerce/graphql-mesh": "7.0.1-canary.0",
|
|
25
|
+
"@graphcommerce/image": "7.0.1-canary.0",
|
|
26
|
+
"@graphcommerce/magento-cart": "7.0.1-canary.0",
|
|
27
|
+
"@graphcommerce/magento-store": "7.0.1-canary.0",
|
|
28
|
+
"@graphcommerce/next-ui": "7.0.1-canary.0",
|
|
29
29
|
"schema-dts": "^1.1.0"
|
|
30
30
|
},
|
|
31
31
|
"peerDependencies": {
|
|
32
|
-
"@lingui/react": "^
|
|
33
|
-
"@lingui/core": "^
|
|
32
|
+
"@lingui/react": "^4.2.1",
|
|
33
|
+
"@lingui/core": "^4.2.1",
|
|
34
|
+
"@lingui/macro": "^4.2.1",
|
|
34
35
|
"@mui/material": "^5.10.16",
|
|
35
36
|
"framer-motion": "^10.0.0",
|
|
36
37
|
"next": "^13.2.0",
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
import { UseFormReturn } from '@graphcommerce/ecommerce-ui'
|
|
2
|
-
import { cloneDeep } from '@graphcommerce/graphql'
|
|
3
|
-
import { ProductAttributeFilterInput } from '@graphcommerce/graphql-mesh'
|
|
4
|
-
import { useProductListLinkReplace } from '../../hooks/useProductListLinkReplace'
|
|
5
|
-
import { ProductFilterParams } from '../ProductListItems/filterTypes'
|
|
6
|
-
import { useProductFiltersPro } from './ProductFiltersPro'
|
|
7
|
-
|
|
8
|
-
export type FilterActionProps = {
|
|
9
|
-
attribute_code: keyof ProductAttributeFilterInput
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
type LocalFilterInputProps = FilterActionProps & {
|
|
13
|
-
form: UseFormReturn<ProductFilterParams>
|
|
14
|
-
params: ProductFilterParams
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
const emptyFilters = (props: LocalFilterInputProps & { defaultValue: unknown }) => {
|
|
18
|
-
const { params, attribute_code, form, defaultValue = '' } = props
|
|
19
|
-
const linkParams = cloneDeep(params)
|
|
20
|
-
|
|
21
|
-
// If the attribute_code is a filter key, replace filter value with default value
|
|
22
|
-
const activeFilter = linkParams.filters[attribute_code]
|
|
23
|
-
|
|
24
|
-
const filterkeys = Object.keys(activeFilter ?? {})
|
|
25
|
-
const clearFilters = {}
|
|
26
|
-
filterkeys.forEach((key, index) => {
|
|
27
|
-
clearFilters[key] = Array.isArray(defaultValue) ? defaultValue[index] : defaultValue
|
|
28
|
-
})
|
|
29
|
-
|
|
30
|
-
if (linkParams && attribute_code) {
|
|
31
|
-
form?.reset({
|
|
32
|
-
...linkParams,
|
|
33
|
-
filters: { ...linkParams.filters, [attribute_code]: clearFilters },
|
|
34
|
-
})
|
|
35
|
-
}
|
|
36
|
-
|
|
37
|
-
return linkParams
|
|
38
|
-
}
|
|
39
|
-
|
|
40
|
-
const removeAllFilters = (
|
|
41
|
-
props: LocalFilterInputProps & { onReplace: (params: ProductFilterParams) => void },
|
|
42
|
-
) => {
|
|
43
|
-
const { params, form, onReplace } = props
|
|
44
|
-
const linkParams = cloneDeep(params)
|
|
45
|
-
if (linkParams) {
|
|
46
|
-
Object.keys(linkParams.filters).forEach((filter) => delete linkParams.filters[filter])
|
|
47
|
-
delete linkParams.currentPage
|
|
48
|
-
form?.reset({ ...linkParams, sort: undefined })
|
|
49
|
-
onReplace(linkParams)
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
|
|
53
|
-
export const useFilterActions = (props: FilterActionProps) => {
|
|
54
|
-
const replaceRoute = useProductListLinkReplace({ scroll: false })
|
|
55
|
-
const { form, params, submit } = useProductFiltersPro()
|
|
56
|
-
return {
|
|
57
|
-
emptyFilters: (defaultValue?: unknown) =>
|
|
58
|
-
emptyFilters({ ...props, form, params, defaultValue }),
|
|
59
|
-
clearAllFilters: () => removeAllFilters({ ...props, form, params, onReplace: replaceRoute }),
|
|
60
|
-
}
|
|
61
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { ProductListItemsBase, ProductItemsGridProps } from './ProductListItemsBase'
|
|
2
|
-
import { renderer } from './renderer'
|
|
3
|
-
|
|
4
|
-
export function ProductListItems(props: Omit<ProductItemsGridProps, 'renderers'>) {
|
|
5
|
-
return <ProductListItemsBase renderers={renderer} {...props} />
|
|
6
|
-
}
|