@graphcommerce/magento-product 9.1.0-canary.55 → 10.0.0-canary.56
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 +80 -0
- package/components/AddProductsToCart/AddProductsToCartButton.tsx +1 -1
- package/components/AddProductsToCart/AddProductsToCartFab.tsx +1 -1
- package/components/AddProductsToCart/AddProductsToCartForm.tsx +1 -1
- package/components/AddProductsToCart/AddProductsToCartQuantity.tsx +3 -3
- package/components/AddProductsToCart/AddProductsToCartSnackbarMessage.tsx +2 -2
- package/components/ProductCustomizable/CustomizableAreaOption.tsx +2 -5
- package/components/ProductCustomizable/CustomizableCheckboxOption.tsx +4 -5
- package/components/ProductCustomizable/CustomizableDateOption.tsx +1 -1
- package/components/ProductCustomizable/CustomizableDropDownOption.tsx +3 -4
- package/components/ProductCustomizable/CustomizableFieldOption.tsx +3 -8
- package/components/ProductCustomizable/CustomizableMultipleOption.tsx +4 -5
- package/components/ProductCustomizable/CustomizableRadioOption.tsx +4 -5
- package/components/ProductFiltersPro/ProductFilterEqualSection.tsx +2 -2
- package/components/ProductFiltersPro/ProductFilterRangeSection.tsx +2 -2
- package/components/ProductFiltersPro/ProductFiltersPro.tsx +2 -1
- package/components/ProductFiltersPro/ProductFiltersProAllFiltersChip.tsx +2 -2
- package/components/ProductFiltersPro/ProductFiltersProCategorySection.tsx +3 -3
- package/components/ProductFiltersPro/ProductFiltersProClearAll.tsx +2 -2
- package/components/ProductFiltersPro/ProductFiltersProLimitChip.tsx +4 -4
- package/components/ProductFiltersPro/ProductFiltersProLimitSection.tsx +4 -4
- package/components/ProductFiltersPro/ProductFiltersProNoResults.tsx +1 -1
- package/components/ProductFiltersPro/ProductFiltersProSortChip.tsx +2 -2
- package/components/ProductFiltersPro/ProductFiltersProSortSection.tsx +3 -3
- package/components/ProductFiltersPro/useProductFiltersProSort.tsx +2 -2
- package/components/ProductListCount/ProductListCount.tsx +4 -4
- package/components/ProductListFilters/FilterRangeType.tsx +7 -9
- package/components/ProductListItem/ProductListItemImage.tsx +2 -2
- package/components/ProductListItems/getFilterTypes.ts +2 -1
- package/components/ProductListPagination/ProductListPagination.tsx +3 -2
- package/components/ProductListSort/ProductListSort.tsx +2 -2
- package/components/ProductListSuggestions/ProductListSuggestions.tsx +1 -1
- package/components/ProductPageBreadcrumb/ProductPageBreadcrumb.tsx +2 -2
- package/components/ProductPageGallery/ProductPageGallery.tsx +1 -1
- package/components/ProductPagePrice/ProductPagePriceLowest.tsx +1 -1
- package/components/ProductPagePrice/ProductPagePriceTiers.tsx +6 -8
- package/components/ProductSidebarDelivery/ProductSidebarDelivery.tsx +8 -11
- package/components/ProductStaticPaths/getProductStaticPaths.ts +2 -1
- package/hooks/useProductLink.ts +4 -3
- package/package.json +27 -20
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,85 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 10.0.0-canary.56
|
|
4
|
+
|
|
5
|
+
### Major Changes
|
|
6
|
+
|
|
7
|
+
- [#2546](https://github.com/graphcommerce-org/graphcommerce/pull/2546) [`ed9332a`](https://github.com/graphcommerce-org/graphcommerce/commit/ed9332a7f78966d932041d9a7725641edc92b28d) - ## GraphCommerce 10 - Turbopack Support
|
|
8
|
+
|
|
9
|
+
This major release brings full Turbopack compatibility, dramatically improving development speed.
|
|
10
|
+
|
|
11
|
+
### 🚀 Turbopack-Compatible Interceptor System
|
|
12
|
+
|
|
13
|
+
The entire plugin/interceptor system has been rewritten to work with Turbopack:
|
|
14
|
+
|
|
15
|
+
- **No more Webpack plugins** - Removed `InterceptorPlugin` webpack plugin entirely
|
|
16
|
+
- **File-based interception** - Original files are moved to `.original.tsx` and replaced with interceptor content
|
|
17
|
+
- **Direct imports** - Interceptors import from `.original` files instead of embedding source
|
|
18
|
+
- **New CLI commands**:
|
|
19
|
+
- `graphcommerce codegen-interceptors` - Generate interceptor files
|
|
20
|
+
- `graphcommerce cleanup-interceptors` - Reset interceptor system, restore original files
|
|
21
|
+
- **Stable file hashing** - Deterministic interceptor generation for better caching
|
|
22
|
+
|
|
23
|
+
### ⚙️ Treeshakable Configuration System
|
|
24
|
+
|
|
25
|
+
Replaced Webpack `DefinePlugin`-based `import.meta.graphCommerce` with a new generated configuration system:
|
|
26
|
+
|
|
27
|
+
- **New `codegen-config-values` command** - Generates TypeScript files with precise typing
|
|
28
|
+
- **Schema-driven** - Dynamically introspects Zod schemas to determine all available properties
|
|
29
|
+
- **Fully treeshakable** - Unused config values are eliminated from the bundle
|
|
30
|
+
- **Type-safe** - Uses `Get<GraphCommerceConfig, 'path'>` for nested property access
|
|
31
|
+
- **Separate files for nested objects** - Optimal treeshaking for complex configurations
|
|
32
|
+
|
|
33
|
+
### 🔧 withGraphCommerce Changes
|
|
34
|
+
|
|
35
|
+
- **Removed** `InterceptorPlugin` - No longer needed with file-based interception
|
|
36
|
+
- **Removed** `DefinePlugin` for `import.meta.graphCommerce` - Replaced with generated config
|
|
37
|
+
- **Removed** `@mui/*` alias rewrites - No longer required
|
|
38
|
+
- **Added** Turbopack loader rules for `.yaml`, `.yml`, and `.po` files
|
|
39
|
+
- **Added** `serverExternalPackages` for all `@whatwg-node/*` packages
|
|
40
|
+
- **Added** `optimizePackageImports` for better bundle optimization
|
|
41
|
+
- **Added** `images.qualities: [52, 75]` for Next.js image optimization
|
|
42
|
+
|
|
43
|
+
### 📦 Lingui Configuration
|
|
44
|
+
|
|
45
|
+
- **Renamed** `lingui.config.js` → `lingui.config.ts` with TypeScript support
|
|
46
|
+
- **Updated** `@graphcommerce/lingui-next/config` to TypeScript with proper exports
|
|
47
|
+
- **Simplified** formatter options
|
|
48
|
+
|
|
49
|
+
### ⚛️ React 19 & Next.js 16 Compatibility
|
|
50
|
+
|
|
51
|
+
- Updated `RefObject<T>` types for React 19 (now includes `null` by default)
|
|
52
|
+
- Replaced deprecated `React.VFC` with `React.FC`
|
|
53
|
+
- Fixed `useRef` calls to require explicit initial values
|
|
54
|
+
- Updated `MutableRefObject` usage in `framer-scroller`
|
|
55
|
+
|
|
56
|
+
### 📋 ESLint 9 Flat Config
|
|
57
|
+
|
|
58
|
+
- Migrated from legacy `.eslintrc` to new flat config format (`eslint.config.mjs`)
|
|
59
|
+
- Updated `@typescript-eslint/*` packages to v8
|
|
60
|
+
- Fixed AST selector for `SxProps` rule (`typeParameters` → `typeArguments`)
|
|
61
|
+
|
|
62
|
+
### 🔄 Apollo Client
|
|
63
|
+
|
|
64
|
+
- Fixed deprecated `name` option → `clientAwareness: { name: 'ssr' }`
|
|
65
|
+
- Updated error handling types to accept `ApolloError | null | undefined`
|
|
66
|
+
|
|
67
|
+
### ⚠️ Breaking Changes
|
|
68
|
+
|
|
69
|
+
- **Node.js 24.x not supported** - Restricted to `>=20 <24.0.0` due to [nodejs/undici#4290](https://github.com/nodejs/undici/issues/4290)
|
|
70
|
+
- **Interceptor files changed** - Original components now at `.original.tsx`
|
|
71
|
+
- **Config access changed** - Use generated config values instead of `import.meta.graphCommerce`
|
|
72
|
+
- **ESLint config format** - Must use flat config (`eslint.config.mjs`)
|
|
73
|
+
- **Lingui config** - Rename `lingui.config.js` to `lingui.config.ts`
|
|
74
|
+
|
|
75
|
+
### 🗑️ Removed
|
|
76
|
+
|
|
77
|
+
- `InterceptorPlugin` webpack plugin
|
|
78
|
+
- `configToImportMeta` utility
|
|
79
|
+
- Webpack `DefinePlugin` usage for config
|
|
80
|
+
- `@mui/*` modern alias rewrites
|
|
81
|
+
- Debug plugins (`CircularDependencyPlugin`, `DuplicatesPlugin`) ([@paales](https://github.com/paales))
|
|
82
|
+
|
|
3
83
|
## 9.1.0-canary.55
|
|
4
84
|
|
|
5
85
|
### Patch Changes
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCartEnabled } from '@graphcommerce/magento-cart'
|
|
2
2
|
import type { ButtonProps } from '@graphcommerce/next-ui'
|
|
3
3
|
import { Button } from '@graphcommerce/next-ui'
|
|
4
|
-
import { Trans } from '@lingui/macro'
|
|
4
|
+
import { Trans } from '@lingui/react/macro'
|
|
5
5
|
import React from 'react'
|
|
6
6
|
import type { UseAddProductsToCartActionProps } from './useAddProductsToCartAction'
|
|
7
7
|
import { useAddProductsToCartAction } from './useAddProductsToCartAction'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useCartEnabled } from '@graphcommerce/magento-cart'
|
|
2
2
|
import type { FabProps } from '@graphcommerce/next-ui'
|
|
3
3
|
import { Fab, iconCheckmark, iconShoppingBag } from '@graphcommerce/next-ui'
|
|
4
|
-
import { t } from '@lingui/macro'
|
|
4
|
+
import { t } from '@lingui/core/macro'
|
|
5
5
|
import type { SxProps, Theme } from '@mui/material'
|
|
6
6
|
import type { UseAddProductsToCartActionProps } from './useAddProductsToCartAction'
|
|
7
7
|
import { useAddProductsToCartAction } from './useAddProductsToCartAction'
|
|
@@ -44,7 +44,7 @@ export function AddProductsToCartForm(props: AddProductsToCartFormProps) {
|
|
|
44
44
|
const { children, redirect, onComplete, sx, snackbarProps, ...formProps } = props
|
|
45
45
|
const router = useRouter()
|
|
46
46
|
const client = useApolloClient()
|
|
47
|
-
const crosssellsQuery = useRef<Promise<ApolloQueryResult<CrosssellsQuery
|
|
47
|
+
const crosssellsQuery = useRef<Promise<ApolloQueryResult<CrosssellsQuery>> | undefined>(undefined)
|
|
48
48
|
|
|
49
49
|
const form = useFormGqlMutationCart<AddProductsToCartMutation, AddProductsToCartFields>(
|
|
50
50
|
AddProductsToCartDocument,
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { NumberFieldElementProps } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import { NumberFieldElement } from '@graphcommerce/ecommerce-ui'
|
|
3
|
-
import {
|
|
3
|
+
import { t } from '@lingui/core/macro'
|
|
4
4
|
import type { AddProductsToCartMutationVariables } from './AddProductsToCart.gql'
|
|
5
5
|
import type { AddToCartItemSelector } from './useFormAddProductsToCart'
|
|
6
6
|
import { useFormAddProductsToCart } from './useFormAddProductsToCart'
|
|
@@ -23,12 +23,12 @@ export function AddProductsToCartQuantity(props: AddToCartQuantityProps) {
|
|
|
23
23
|
required
|
|
24
24
|
inputProps={{
|
|
25
25
|
min: 1,
|
|
26
|
-
'aria-label':
|
|
26
|
+
'aria-label': t`Add to cart quantity`,
|
|
27
27
|
...inputProps,
|
|
28
28
|
}}
|
|
29
29
|
defaultValue={1}
|
|
30
30
|
control={control}
|
|
31
|
-
aria-label={
|
|
31
|
+
aria-label={t`Add to cart quantity`}
|
|
32
32
|
name={`cartItems.${index}.quantity`}
|
|
33
33
|
{...rest}
|
|
34
34
|
/>
|
|
@@ -13,12 +13,12 @@ import {
|
|
|
13
13
|
ListFormat,
|
|
14
14
|
MessageSnackbar,
|
|
15
15
|
} from '@graphcommerce/next-ui'
|
|
16
|
-
import { Plural, Trans } from '@lingui/macro'
|
|
16
|
+
import { Plural, Trans } from '@lingui/react/macro'
|
|
17
17
|
|
|
18
18
|
export type AddProductsToCartSnackbarMessageProps = {
|
|
19
19
|
errorSnackbar?: Omit<ErrorSnackbarProps, 'open'>
|
|
20
20
|
successSnackbar?: Omit<MessageSnackbarProps, 'open' | 'action'>
|
|
21
|
-
error?: ApolloError
|
|
21
|
+
error?: ApolloError | null
|
|
22
22
|
userErrors?: Pick<CartUserInputError, 'message'>[]
|
|
23
23
|
showSuccess: boolean
|
|
24
24
|
addedItems: string[]
|
|
@@ -3,7 +3,7 @@ import type { CurrencyEnum } from '@graphcommerce/graphql-mesh'
|
|
|
3
3
|
import { Money } from '@graphcommerce/magento-store'
|
|
4
4
|
import type { TypeRenderer } from '@graphcommerce/next-ui'
|
|
5
5
|
import { SectionHeader } from '@graphcommerce/next-ui'
|
|
6
|
-
import {
|
|
6
|
+
import { t } from '@lingui/core/macro'
|
|
7
7
|
import { Box } from '@mui/material'
|
|
8
8
|
import React from 'react'
|
|
9
9
|
import { useFormAddProductsToCart } from '../AddProductsToCart'
|
|
@@ -61,10 +61,7 @@ export function CustomizableAreaOption(props: CustomizableAreaOptionProps) {
|
|
|
61
61
|
required={Boolean(required)}
|
|
62
62
|
rules={{ maxLength }}
|
|
63
63
|
helperText={
|
|
64
|
-
|
|
65
|
-
i18n._(/* i18n*/ 'There is a maximum of ‘{maxLength}’ characters', {
|
|
66
|
-
maxLength,
|
|
67
|
-
})
|
|
64
|
+
maxLength && maxLength > 0 && t`There is a maximum of ‘${maxLength}’ characters`
|
|
68
65
|
}
|
|
69
66
|
/>
|
|
70
67
|
</Box>
|
|
@@ -2,7 +2,7 @@ import { ActionCardListForm } from '@graphcommerce/ecommerce-ui'
|
|
|
2
2
|
import { Money } from '@graphcommerce/magento-store'
|
|
3
3
|
import type { ActionCardProps } from '@graphcommerce/next-ui'
|
|
4
4
|
import { ActionCard, nonNullable, SectionHeader } from '@graphcommerce/next-ui'
|
|
5
|
-
import {
|
|
5
|
+
import { t } from '@lingui/core/macro'
|
|
6
6
|
import { Box, Checkbox } from '@mui/material'
|
|
7
7
|
import { useFormAddProductsToCart } from '../AddProductsToCart'
|
|
8
8
|
import type { OptionTypeRenderer } from './CustomizableAreaOption'
|
|
@@ -53,8 +53,9 @@ function CustomizableCheckboxActionCard(props: CheckboxActionCardProps) {
|
|
|
53
53
|
}
|
|
54
54
|
|
|
55
55
|
export function CustomizableCheckboxOption(props: CustomizableCheckboxOptionProps) {
|
|
56
|
-
const { uid, required, index, title
|
|
56
|
+
const { uid, required, index, title, checkboxValue, productPrice, currency } = props
|
|
57
57
|
const { control } = useFormAddProductsToCart()
|
|
58
|
+
const label = title ?? ''
|
|
58
59
|
|
|
59
60
|
return (
|
|
60
61
|
<Box>
|
|
@@ -73,9 +74,7 @@ export function CustomizableCheckboxOption(props: CustomizableCheckboxOptionProp
|
|
|
73
74
|
multiple
|
|
74
75
|
control={control}
|
|
75
76
|
rules={{
|
|
76
|
-
required: required
|
|
77
|
-
? i18n._(/* i18n*/ 'Please select a value for ‘{label}’', { label })
|
|
78
|
-
: false,
|
|
77
|
+
required: required ? t`Please select a value for ‘${label}’` : false,
|
|
79
78
|
}}
|
|
80
79
|
render={CustomizableCheckboxActionCard}
|
|
81
80
|
name={`cartItems.${index}.selected_options_record.${uid}`}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TextFieldElement } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import type { CustomizableDateTypeEnum } from '@graphcommerce/graphql-mesh'
|
|
3
3
|
import { SectionHeader } from '@graphcommerce/next-ui'
|
|
4
|
-
import { t } from '@lingui/macro'
|
|
4
|
+
import { t } from '@lingui/core/macro'
|
|
5
5
|
import { Box } from '@mui/material'
|
|
6
6
|
import { useFormAddProductsToCart } from '../AddProductsToCart'
|
|
7
7
|
import type { OptionTypeRenderer } from './CustomizableAreaOption'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { useController } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import { Money } from '@graphcommerce/magento-store'
|
|
3
3
|
import { filterNonNullableKeys, SectionHeader } from '@graphcommerce/next-ui'
|
|
4
|
-
import {
|
|
4
|
+
import { t } from '@lingui/core/macro'
|
|
5
5
|
import { Box, MenuItem, TextField } from '@mui/material'
|
|
6
6
|
import { useFormAddProductsToCart } from '../AddProductsToCart'
|
|
7
7
|
import type { OptionTypeRenderer } from './CustomizableAreaOption'
|
|
@@ -14,15 +14,14 @@ export function CustomizableDropDownOption(props: CustomizableDropDownOptionProp
|
|
|
14
14
|
const { uid, required, index, title, dropdownValue, productPrice, currency } = props
|
|
15
15
|
const { control } = useFormAddProductsToCart()
|
|
16
16
|
|
|
17
|
+
const label = title ?? ''
|
|
17
18
|
const {
|
|
18
19
|
field: { onChange, value, ref, ...field },
|
|
19
20
|
fieldState: { invalid, error },
|
|
20
21
|
} = useController({
|
|
21
22
|
name: `cartItems.${index}.selected_options_record.${uid}`,
|
|
22
23
|
rules: {
|
|
23
|
-
required: required
|
|
24
|
-
? i18n._(/* i18n*/ 'Please select a value for ‘{label}’', { label: title })
|
|
25
|
-
: false,
|
|
24
|
+
required: required ? t`Please select a value for ‘${label}’` : false,
|
|
26
25
|
},
|
|
27
26
|
control,
|
|
28
27
|
defaultValue: '',
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { TextFieldElement, useWatch } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import { Money } from '@graphcommerce/magento-store'
|
|
3
3
|
import { SectionHeader } from '@graphcommerce/next-ui'
|
|
4
|
-
import {
|
|
4
|
+
import { t } from '@lingui/core/macro'
|
|
5
5
|
import { Box } from '@mui/material'
|
|
6
6
|
import { useFormAddProductsToCart } from '../AddProductsToCart'
|
|
7
7
|
import type { OptionTypeRenderer } from './CustomizableAreaOption'
|
|
@@ -50,16 +50,11 @@ export function CustomizableFieldOption(props: CustomizableFieldOptionProps) {
|
|
|
50
50
|
rules={{
|
|
51
51
|
maxLength: {
|
|
52
52
|
value: maxLength,
|
|
53
|
-
message:
|
|
54
|
-
maxLength,
|
|
55
|
-
}),
|
|
53
|
+
message: t`There is a maximum of ‘${maxLength}’ characters`,
|
|
56
54
|
},
|
|
57
55
|
}}
|
|
58
56
|
helperText={
|
|
59
|
-
|
|
60
|
-
i18n._(/* i18n*/ 'There is a maximum of ‘{maxLength}’ characters', {
|
|
61
|
-
maxLength,
|
|
62
|
-
})
|
|
57
|
+
maxLength && maxLength > 0 && t`There is a maximum of ‘${maxLength}’ characters`
|
|
63
58
|
}
|
|
64
59
|
/>
|
|
65
60
|
</Box>
|
|
@@ -2,7 +2,7 @@ import { ActionCardListForm } from '@graphcommerce/ecommerce-ui'
|
|
|
2
2
|
import { Money } from '@graphcommerce/magento-store'
|
|
3
3
|
import type { ActionCardProps } from '@graphcommerce/next-ui'
|
|
4
4
|
import { ActionCard, filterNonNullableKeys, SectionHeader } from '@graphcommerce/next-ui'
|
|
5
|
-
import {
|
|
5
|
+
import { t } from '@lingui/core/macro'
|
|
6
6
|
import { Box } from '@mui/material'
|
|
7
7
|
import { useFormAddProductsToCart } from '../AddProductsToCart'
|
|
8
8
|
import type { OptionTypeRenderer } from './CustomizableAreaOption'
|
|
@@ -48,8 +48,9 @@ function CustomizableMultipleActionCard(props: MultipleActionCardProps) {
|
|
|
48
48
|
}
|
|
49
49
|
|
|
50
50
|
export function CustomizableMultipleOption(props: CustomizableMultipleOptionProps) {
|
|
51
|
-
const { uid, required, index, title
|
|
51
|
+
const { uid, required, index, title, multipleValue, currency, productPrice } = props
|
|
52
52
|
const { control } = useFormAddProductsToCart()
|
|
53
|
+
const label = title ?? ''
|
|
53
54
|
|
|
54
55
|
return (
|
|
55
56
|
<Box>
|
|
@@ -67,9 +68,7 @@ export function CustomizableMultipleOption(props: CustomizableMultipleOptionProp
|
|
|
67
68
|
})}
|
|
68
69
|
multiple
|
|
69
70
|
rules={{
|
|
70
|
-
required: required
|
|
71
|
-
? i18n._(/* i18n*/ 'Please select a value for ‘{label}’', { label })
|
|
72
|
-
: false,
|
|
71
|
+
required: required ? t`Please select a value for ‘${label}’` : false,
|
|
73
72
|
}}
|
|
74
73
|
control={control}
|
|
75
74
|
render={CustomizableMultipleActionCard}
|
|
@@ -2,7 +2,7 @@ import { ActionCardListForm } from '@graphcommerce/ecommerce-ui'
|
|
|
2
2
|
import { Money } from '@graphcommerce/magento-store'
|
|
3
3
|
import type { ActionCardProps } from '@graphcommerce/next-ui'
|
|
4
4
|
import { ActionCard, filterNonNullableKeys, SectionHeader } from '@graphcommerce/next-ui'
|
|
5
|
-
import {
|
|
5
|
+
import { t } from '@lingui/core/macro'
|
|
6
6
|
import { Box } from '@mui/material'
|
|
7
7
|
import { useFormAddProductsToCart } from '../AddProductsToCart'
|
|
8
8
|
import type { OptionTypeRenderer } from './CustomizableAreaOption'
|
|
@@ -50,8 +50,9 @@ function CustomizableRadioActionCard(props: RadioActionCardProps) {
|
|
|
50
50
|
}
|
|
51
51
|
|
|
52
52
|
export function CustomizableRadioOption(props: CustomizableRadioOptionProps) {
|
|
53
|
-
const { uid, required, index, title
|
|
53
|
+
const { uid, required, index, title, radioValue, currency, productPrice } = props
|
|
54
54
|
const { control } = useFormAddProductsToCart()
|
|
55
|
+
const label = title ?? ''
|
|
55
56
|
|
|
56
57
|
return (
|
|
57
58
|
<Box>
|
|
@@ -72,9 +73,7 @@ export function CustomizableRadioOption(props: CustomizableRadioOptionProps) {
|
|
|
72
73
|
render={CustomizableRadioActionCard}
|
|
73
74
|
name={`cartItems.${index}.selected_options_record.${uid}`}
|
|
74
75
|
rules={{
|
|
75
|
-
required: required
|
|
76
|
-
? i18n._(/* i18n*/ 'Please select a value for ‘{label}’', { label })
|
|
77
|
-
: false,
|
|
76
|
+
required: required ? t`Please select a value for ‘${label}’` : false,
|
|
78
77
|
}}
|
|
79
78
|
items={filterNonNullableKeys(radioValue, ['title']).map((radioVal) => ({
|
|
80
79
|
productPrice,
|
|
@@ -8,7 +8,7 @@ import {
|
|
|
8
8
|
iconCirle,
|
|
9
9
|
IconSvg,
|
|
10
10
|
} from '@graphcommerce/next-ui'
|
|
11
|
-
import { Trans } from '@lingui/react'
|
|
11
|
+
import { Trans } from '@lingui/react/macro'
|
|
12
12
|
import { Box } from '@mui/material'
|
|
13
13
|
import { useMemo } from 'react'
|
|
14
14
|
import { isFilterTypeEqual } from '../ProductListItems/filterTypes'
|
|
@@ -79,7 +79,7 @@ export function ProductFilterEqualSection(props: FilterProps) {
|
|
|
79
79
|
form.setValue(name, null)
|
|
80
80
|
}}
|
|
81
81
|
>
|
|
82
|
-
<Trans
|
|
82
|
+
<Trans>Clear</Trans>
|
|
83
83
|
</Button>
|
|
84
84
|
) : undefined
|
|
85
85
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Controller } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import type { ProductAttributeFilterInput } from '@graphcommerce/graphql-mesh'
|
|
3
3
|
import { ActionCardAccordion, Button } from '@graphcommerce/next-ui'
|
|
4
|
-
import { Trans } from '@lingui/react'
|
|
4
|
+
import { Trans } from '@lingui/react/macro'
|
|
5
5
|
import { isFilterTypeRange } from '../ProductListItems/filterTypes'
|
|
6
6
|
import { getMinMaxFromOptions, PriceSlider } from './PriceSlider'
|
|
7
7
|
import { useProductFiltersPro } from './ProductFiltersPro'
|
|
@@ -46,7 +46,7 @@ export function ProductFilterRangeSection(props: FilterProps) {
|
|
|
46
46
|
form.setValue(name, null)
|
|
47
47
|
}}
|
|
48
48
|
>
|
|
49
|
-
<Trans
|
|
49
|
+
<Trans>Clear</Trans>
|
|
50
50
|
</Button>
|
|
51
51
|
) : undefined
|
|
52
52
|
}
|
|
@@ -13,12 +13,13 @@ import { m, useTransform } from 'framer-motion'
|
|
|
13
13
|
import { useRouter } from 'next/router'
|
|
14
14
|
import type { BaseSyntheticEvent, MutableRefObject } from 'react'
|
|
15
15
|
import React, { createContext, useContext, useEffect, useMemo, useRef } from 'react'
|
|
16
|
-
import type { Subscription } from 'react-hook-form/dist/utils/createSubject'
|
|
17
16
|
import { productListLinkFromFilter } from '../../hooks/useProductListLink'
|
|
18
17
|
import type { ProductListFiltersFragment } from '../ProductListFilters/ProductListFilters.gql'
|
|
19
18
|
import type { ProductFilterParams, ProductListParams } from '../ProductListItems/filterTypes'
|
|
20
19
|
import { toFilterParams } from '../ProductListItems/filterTypes'
|
|
21
20
|
|
|
21
|
+
type Subscription = { unsubscribe: () => void }
|
|
22
|
+
|
|
22
23
|
type DataProps = {
|
|
23
24
|
filterTypes: Record<string, string | undefined>
|
|
24
25
|
appliedAggregations?: ProductListFiltersFragment['aggregations']
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ChipOverlayOrPopperProps } from '@graphcommerce/next-ui'
|
|
2
2
|
import { ChipOverlayOrPopper } from '@graphcommerce/next-ui'
|
|
3
|
-
import { Trans } from '@lingui/react'
|
|
3
|
+
import { Trans } from '@lingui/react/macro'
|
|
4
4
|
import { activeAggregations } from './activeAggregations'
|
|
5
5
|
import { applyAggregationCount } from './applyAggregationCount'
|
|
6
6
|
import { useProductFiltersPro } from './ProductFiltersPro'
|
|
@@ -40,7 +40,7 @@ export function ProductFiltersProAllFiltersChip(props: ProductFiltersProAllFilte
|
|
|
40
40
|
|
|
41
41
|
return (
|
|
42
42
|
<ChipOverlayOrPopper
|
|
43
|
-
label={<Trans
|
|
43
|
+
label={<Trans>All filters</Trans>}
|
|
44
44
|
chipProps={{ variant: 'outlined' }}
|
|
45
45
|
onApply={submit}
|
|
46
46
|
onReset={hasFilters ? clearAll : undefined}
|
|
@@ -11,7 +11,7 @@ import {
|
|
|
11
11
|
IconSvg,
|
|
12
12
|
responsiveVal,
|
|
13
13
|
} from '@graphcommerce/next-ui'
|
|
14
|
-
import { Trans } from '@lingui/react'
|
|
14
|
+
import { Trans } from '@lingui/react/macro'
|
|
15
15
|
import type { SxProps, Theme } from '@mui/material'
|
|
16
16
|
import { Box } from '@mui/material'
|
|
17
17
|
import { useProductFiltersPro } from './ProductFiltersPro'
|
|
@@ -39,7 +39,7 @@ export function ProductFiltersProCategoryAccordion(props: ProductFiltersProCateg
|
|
|
39
39
|
...(Array.isArray(sx) ? sx : [sx]),
|
|
40
40
|
]}
|
|
41
41
|
defaultExpanded={defaultExpanded}
|
|
42
|
-
summary={<Trans
|
|
42
|
+
summary={<Trans>Categories</Trans>}
|
|
43
43
|
right={
|
|
44
44
|
clearable && currentFilter && currentFilter.length > 0 ? (
|
|
45
45
|
<Button
|
|
@@ -49,7 +49,7 @@ export function ProductFiltersProCategoryAccordion(props: ProductFiltersProCateg
|
|
|
49
49
|
form.setValue(name, null)
|
|
50
50
|
}}
|
|
51
51
|
>
|
|
52
|
-
<Trans
|
|
52
|
+
<Trans>Clear</Trans>
|
|
53
53
|
</Button>
|
|
54
54
|
) : undefined
|
|
55
55
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Button } from '@graphcommerce/next-ui'
|
|
2
|
-
import { Trans } from '@lingui/react'
|
|
2
|
+
import { Trans } from '@lingui/react/macro'
|
|
3
3
|
import type { SxProps, Theme } from '@mui/material'
|
|
4
4
|
import type { ProductFiltersProAggregationsProps } from './ProductFiltersProAggregations'
|
|
5
5
|
import { useProductFiltersProClearAllAction } from './useProductFiltersProClearAllAction'
|
|
@@ -30,7 +30,7 @@ export function ProductFiltersProClearAll(props: AllFiltersSidebar) {
|
|
|
30
30
|
return clearAll()
|
|
31
31
|
}}
|
|
32
32
|
>
|
|
33
|
-
<Trans
|
|
33
|
+
<Trans>Clear all filters</Trans>
|
|
34
34
|
</Button>
|
|
35
35
|
)
|
|
36
36
|
}
|
|
@@ -4,7 +4,7 @@ import { useQuery } from '@graphcommerce/graphql'
|
|
|
4
4
|
import { StoreConfigDocument } from '@graphcommerce/magento-store'
|
|
5
5
|
import type { ChipOverlayOrPopperProps } from '@graphcommerce/next-ui'
|
|
6
6
|
import { ActionCard, ChipOverlayOrPopper } from '@graphcommerce/next-ui'
|
|
7
|
-
import { Trans } from '@lingui/react'
|
|
7
|
+
import { Trans } from '@lingui/react/macro'
|
|
8
8
|
import { useMemo } from 'react'
|
|
9
9
|
import { useProductFiltersPro } from './ProductFiltersPro'
|
|
10
10
|
|
|
@@ -27,7 +27,7 @@ export function ProductFiltersProLimitChip(props: ProductFiltersProLimitChipProp
|
|
|
27
27
|
(storeConfigQuery?.storeConfig?.grid_per_page_values?.split(',').map(Number) ?? []).map(
|
|
28
28
|
(count) => ({
|
|
29
29
|
value: count === defaultPerPage ? null : count,
|
|
30
|
-
title: <Trans
|
|
30
|
+
title: <Trans>{count} Per page</Trans>,
|
|
31
31
|
}),
|
|
32
32
|
),
|
|
33
33
|
[defaultPerPage, storeConfigQuery?.storeConfig?.grid_per_page_values],
|
|
@@ -39,9 +39,9 @@ export function ProductFiltersProLimitChip(props: ProductFiltersProLimitChipProp
|
|
|
39
39
|
<ChipOverlayOrPopper
|
|
40
40
|
{...rest}
|
|
41
41
|
overlayProps={{ sizeSm: 'minimal', sizeMd: 'minimal', ...rest.overlayProps }}
|
|
42
|
-
label={<Trans
|
|
42
|
+
label={<Trans>Per page</Trans>}
|
|
43
43
|
selected={Boolean(params.pageSize)}
|
|
44
|
-
selectedLabel={<Trans
|
|
44
|
+
selectedLabel={<Trans>{params.pageSize} Per page</Trans>}
|
|
45
45
|
onApply={submit}
|
|
46
46
|
onReset={
|
|
47
47
|
activePageSize
|
|
@@ -3,7 +3,7 @@ import { ActionCardListForm, useWatch } from '@graphcommerce/ecommerce-ui'
|
|
|
3
3
|
import { useQuery } from '@graphcommerce/graphql'
|
|
4
4
|
import { StoreConfigDocument } from '@graphcommerce/magento-store'
|
|
5
5
|
import { ActionCard, ActionCardAccordion, Button } from '@graphcommerce/next-ui'
|
|
6
|
-
import { Trans } from '@lingui/react'
|
|
6
|
+
import { Trans } from '@lingui/react/macro'
|
|
7
7
|
import type { SxProps, Theme } from '@mui/material'
|
|
8
8
|
import { useMemo } from 'react'
|
|
9
9
|
import { useProductFiltersPro } from './ProductFiltersPro'
|
|
@@ -25,7 +25,7 @@ export function ProductFiltersProLimitSection(props: ProductFiltersProLimitSecti
|
|
|
25
25
|
(storeConfigQuery?.storeConfig?.grid_per_page_values?.split(',').map(Number) ?? []).map(
|
|
26
26
|
(count) => ({
|
|
27
27
|
value: count === defaultPerPage ? null : count,
|
|
28
|
-
title: <Trans
|
|
28
|
+
title: <Trans>{count} Per page</Trans>,
|
|
29
29
|
}),
|
|
30
30
|
),
|
|
31
31
|
[defaultPerPage, storeConfigQuery?.storeConfig?.grid_per_page_values],
|
|
@@ -37,7 +37,7 @@ export function ProductFiltersProLimitSection(props: ProductFiltersProLimitSecti
|
|
|
37
37
|
<ActionCardAccordion
|
|
38
38
|
sx={sx}
|
|
39
39
|
defaultExpanded={!!activePageSize}
|
|
40
|
-
summary={<Trans
|
|
40
|
+
summary={<Trans>Per page</Trans>}
|
|
41
41
|
details={
|
|
42
42
|
<ActionCardListForm
|
|
43
43
|
sx={{ mb: 2 }}
|
|
@@ -61,7 +61,7 @@ export function ProductFiltersProLimitSection(props: ProductFiltersProLimitSecti
|
|
|
61
61
|
form.setValue('currentPage', 1)
|
|
62
62
|
}}
|
|
63
63
|
>
|
|
64
|
-
<Trans
|
|
64
|
+
<Trans>Clear</Trans>
|
|
65
65
|
</Button>
|
|
66
66
|
) : undefined
|
|
67
67
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { extendableComponent } from '@graphcommerce/next-ui'
|
|
2
|
-
import { Trans } from '@lingui/macro'
|
|
2
|
+
import { Trans } from '@lingui/react/macro'
|
|
3
3
|
import type { SxProps, Theme } from '@mui/material'
|
|
4
4
|
import { Box, Link, Typography } from '@mui/material'
|
|
5
5
|
import { useProductFiltersProClearAllAction } from './useProductFiltersProClearAllAction'
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ActionCardListForm } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import type { ChipOverlayOrPopperProps } from '@graphcommerce/next-ui'
|
|
3
3
|
import { ActionCard, ChipOverlayOrPopper } from '@graphcommerce/next-ui'
|
|
4
|
-
import { Trans } from '@lingui/react'
|
|
4
|
+
import { Trans } from '@lingui/react/macro'
|
|
5
5
|
import { useProductFiltersPro } from './ProductFiltersPro'
|
|
6
6
|
import type { UseProductFiltersProSortProps } from './useProductFiltersProSort'
|
|
7
7
|
import { useProductFiltersProSort } from './useProductFiltersProSort'
|
|
@@ -23,7 +23,7 @@ export function ProductFiltersProSortChip(props: ProductListActionSortProps) {
|
|
|
23
23
|
<ChipOverlayOrPopper
|
|
24
24
|
{...rest}
|
|
25
25
|
overlayProps={{ sizeSm: 'minimal', sizeMd: 'minimal', ...rest.overlayProps }}
|
|
26
|
-
label={<Trans
|
|
26
|
+
label={<Trans>Sort By</Trans>}
|
|
27
27
|
selected={selected}
|
|
28
28
|
selectedLabel={selectedLabel}
|
|
29
29
|
onApply={submit}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { ActionCardListForm } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import { ActionCard, ActionCardAccordion, Button } from '@graphcommerce/next-ui'
|
|
3
|
-
import { Trans } from '@lingui/react'
|
|
3
|
+
import { Trans } from '@lingui/react/macro'
|
|
4
4
|
import type { SxProps, Theme } from '@mui/material'
|
|
5
5
|
import { useProductFiltersPro } from './ProductFiltersPro'
|
|
6
6
|
import type { UseProductFiltersProSortProps } from './useProductFiltersProSort'
|
|
@@ -21,7 +21,7 @@ export function ProductFiltersProSortSection(props: ProductFiltersProSortSection
|
|
|
21
21
|
<ActionCardAccordion
|
|
22
22
|
sx={sx}
|
|
23
23
|
defaultExpanded={selected}
|
|
24
|
-
summary={<Trans
|
|
24
|
+
summary={<Trans>Sort By</Trans>}
|
|
25
25
|
details={
|
|
26
26
|
<ActionCardListForm
|
|
27
27
|
control={form.control}
|
|
@@ -44,7 +44,7 @@ export function ProductFiltersProSortSection(props: ProductFiltersProSortSection
|
|
|
44
44
|
form.setValue('currentPage', 1)
|
|
45
45
|
}}
|
|
46
46
|
>
|
|
47
|
-
<Trans
|
|
47
|
+
<Trans>Clear</Trans>
|
|
48
48
|
</Button>
|
|
49
49
|
) : undefined
|
|
50
50
|
}
|
|
@@ -2,7 +2,7 @@ import { useWatch } from '@graphcommerce/ecommerce-ui'
|
|
|
2
2
|
import { useQuery } from '@graphcommerce/graphql'
|
|
3
3
|
import { StoreConfigDocument } from '@graphcommerce/magento-store'
|
|
4
4
|
import { filterNonNullableKeys, nonNullable } from '@graphcommerce/next-ui'
|
|
5
|
-
import {
|
|
5
|
+
import { t } from '@lingui/core/macro'
|
|
6
6
|
import { useMemo } from 'react'
|
|
7
7
|
import type { CategoryDefaultFragment } from '../ProductListItems/CategoryDefault.gql'
|
|
8
8
|
import type { ProductListSortFragment } from '../ProductListSort'
|
|
@@ -26,7 +26,7 @@ export function useProductFiltersProSort(props: ProductListActionSortProps) {
|
|
|
26
26
|
() =>
|
|
27
27
|
filterNonNullableKeys(sort_fields?.options).map((o) =>
|
|
28
28
|
(!category?.uid && o.value === 'position') || o.value === 'relevance'
|
|
29
|
-
? { value: 'relevance', label:
|
|
29
|
+
? { value: 'relevance', label: t`Relevance` }
|
|
30
30
|
: o,
|
|
31
31
|
),
|
|
32
32
|
[category?.uid, sort_fields?.options],
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { extendableComponent, responsiveVal } from '@graphcommerce/next-ui'
|
|
2
|
-
import { Trans } from '@lingui/react'
|
|
2
|
+
import { Trans } from '@lingui/react/macro'
|
|
3
3
|
import type { SxProps, Theme } from '@mui/material'
|
|
4
4
|
import { Box, Divider, Typography } from '@mui/material'
|
|
5
5
|
import type { ProductListCountFragment } from './ProductListCount.gql'
|
|
@@ -44,9 +44,9 @@ export function ProductListCount(props: ProductCountProps) {
|
|
|
44
44
|
sx={{ lineHeight: 0 }}
|
|
45
45
|
>
|
|
46
46
|
{children ? <> {children} </> : null}
|
|
47
|
-
{total_count === 0 && <Trans
|
|
48
|
-
{total_count === 1 && <Trans
|
|
49
|
-
{(total_count ?? 0) > 1 && <Trans
|
|
47
|
+
{total_count === 0 && <Trans>no products</Trans>}
|
|
48
|
+
{total_count === 1 && <Trans>one product</Trans>}
|
|
49
|
+
{(total_count ?? 0) > 1 && <Trans>{total_count} products</Trans>}
|
|
50
50
|
</Typography>
|
|
51
51
|
<Divider component='div' className={classes.line} />
|
|
52
52
|
</Box>
|
|
@@ -3,7 +3,7 @@ import type { FilterRangeTypeInput } from '@graphcommerce/graphql-mesh'
|
|
|
3
3
|
import { Money } from '@graphcommerce/magento-store'
|
|
4
4
|
import type { ChipMenuProps } from '@graphcommerce/next-ui'
|
|
5
5
|
import { ChipMenu, extendableComponent } from '@graphcommerce/next-ui'
|
|
6
|
-
import { Trans } from '@lingui/react'
|
|
6
|
+
import { Trans } from '@lingui/react/macro'
|
|
7
7
|
// eslint-disable-next-line @typescript-eslint/no-restricted-imports
|
|
8
8
|
import { Box, Slider } from '@mui/material'
|
|
9
9
|
import React, { useEffect } from 'react'
|
|
@@ -82,18 +82,16 @@ export function FilterRangeType(props: FilterRangeTypeProps) {
|
|
|
82
82
|
|
|
83
83
|
if (from === min && to !== max)
|
|
84
84
|
currentLabel = (
|
|
85
|
-
<Trans
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
/>
|
|
85
|
+
<Trans>
|
|
86
|
+
Below <Money round value={Number(currentFilter?.to)} />
|
|
87
|
+
</Trans>
|
|
89
88
|
)
|
|
90
89
|
|
|
91
90
|
if (from !== min && to === max)
|
|
92
91
|
currentLabel = (
|
|
93
|
-
<Trans
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
/>
|
|
92
|
+
<Trans>
|
|
93
|
+
Above <Money round value={Number(currentFilter?.from)} />
|
|
94
|
+
</Trans>
|
|
97
95
|
)
|
|
98
96
|
|
|
99
97
|
if (from !== min && to !== max)
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import type { ImageProps } from '@graphcommerce/image'
|
|
2
2
|
import { Image } from '@graphcommerce/image'
|
|
3
|
-
import { Trans } from '@lingui/react'
|
|
3
|
+
import { Trans } from '@lingui/react/macro'
|
|
4
4
|
import type { BoxProps } from '@mui/material'
|
|
5
5
|
import { Box, Skeleton, styled } from '@mui/material'
|
|
6
6
|
|
|
@@ -91,7 +91,7 @@ export function ProductListItemImage(props: ImageOrPlaceholderProps) {
|
|
|
91
91
|
...(Array.isArray(sx) ? sx : [sx]),
|
|
92
92
|
]}
|
|
93
93
|
>
|
|
94
|
-
<Trans
|
|
94
|
+
<Trans>No Image</Trans>
|
|
95
95
|
</Box>
|
|
96
96
|
</PlaceHolderContainer>
|
|
97
97
|
)
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import type { ApolloClient, NormalizedCacheObject, TypedDocumentNode } from '@graphcommerce/graphql'
|
|
2
2
|
import { gql } from '@graphcommerce/graphql'
|
|
3
3
|
import type { AttributeFrontendInputEnum, Exact } from '@graphcommerce/graphql-mesh'
|
|
4
|
+
import { magentoVersion } from '@graphcommerce/next-config/config'
|
|
4
5
|
import { filterNonNullableKeys, nonNullable } from '@graphcommerce/next-ui'
|
|
5
6
|
import { ProductFilterTypesDocument } from './ProductFilterTypes.gql'
|
|
6
7
|
|
|
@@ -34,7 +35,7 @@ export async function getFilterTypes(
|
|
|
34
35
|
client: ApolloClient<NormalizedCacheObject>,
|
|
35
36
|
isSearch: boolean = false,
|
|
36
37
|
): Promise<FilterTypes> {
|
|
37
|
-
if (
|
|
38
|
+
if (magentoVersion >= 247) {
|
|
38
39
|
const types = await client.query({
|
|
39
40
|
query: ProductFilterTypesDocument,
|
|
40
41
|
variables: {
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { productListPaginationVariant } from '@graphcommerce/next-config/config'
|
|
1
2
|
import { NextLink, Pagination, PaginationExtended } from '@graphcommerce/next-ui'
|
|
2
3
|
import type { PaginationProps } from '@mui/material'
|
|
3
4
|
import { Link } from '@mui/material'
|
|
@@ -17,7 +18,7 @@ export function ProductListPagination({
|
|
|
17
18
|
}: ProductPaginationProps) {
|
|
18
19
|
if (!page_info || !page_info.total_pages || !page_info.current_page) return null
|
|
19
20
|
|
|
20
|
-
if (
|
|
21
|
+
if (productListPaginationVariant !== 'EXTENDED') {
|
|
21
22
|
return (
|
|
22
23
|
<Pagination
|
|
23
24
|
count={page_info?.total_pages}
|
|
@@ -41,7 +42,7 @@ export function ProductListPagination({
|
|
|
41
42
|
)
|
|
42
43
|
}
|
|
43
44
|
|
|
44
|
-
if (
|
|
45
|
+
if (productListPaginationVariant === 'EXTENDED') {
|
|
45
46
|
return (
|
|
46
47
|
<PaginationExtended
|
|
47
48
|
count={page_info?.total_pages}
|
|
@@ -2,7 +2,7 @@ import { cloneDeep, useQuery } from '@graphcommerce/graphql'
|
|
|
2
2
|
import { StoreConfigDocument } from '@graphcommerce/magento-store'
|
|
3
3
|
import type { ChipMenuProps } from '@graphcommerce/next-ui'
|
|
4
4
|
import { ChipMenu, extendableComponent } from '@graphcommerce/next-ui'
|
|
5
|
-
import { Trans } from '@lingui/react'
|
|
5
|
+
import { Trans } from '@lingui/react/macro'
|
|
6
6
|
import type { SxProps, Theme } from '@mui/material'
|
|
7
7
|
import { ListItem, ListItemText } from '@mui/material'
|
|
8
8
|
import React from 'react'
|
|
@@ -30,7 +30,7 @@ export function ProductListSort(props: ProductListSortProps) {
|
|
|
30
30
|
const [currentSort = defaultSort] = Object.keys(params.sort)
|
|
31
31
|
const currentOption = sort_fields?.options?.find((option) => option?.value === currentSort)
|
|
32
32
|
const selected = currentSort !== defaultSort
|
|
33
|
-
const label = <Trans
|
|
33
|
+
const label = <Trans>Sort By</Trans>
|
|
34
34
|
|
|
35
35
|
const removeFilter = () => {
|
|
36
36
|
const linkParams = cloneDeep(params)
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { filterNonNullableKeys, ListFormat } from '@graphcommerce/next-ui'
|
|
2
|
-
import { Trans } from '@lingui/macro'
|
|
2
|
+
import { Trans } from '@lingui/react/macro'
|
|
3
3
|
import { Box, Link } from '@mui/material'
|
|
4
4
|
import { productListLinkFromFilter } from '../../hooks/useProductListLink'
|
|
5
5
|
import { useProductFiltersPro } from '../ProductFiltersPro'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { usePrevPageRouter } from '@graphcommerce/framer-next-pages'
|
|
2
2
|
import { filterNonNullableKeys } from '@graphcommerce/next-ui'
|
|
3
|
-
import { Trans } from '@lingui/react'
|
|
3
|
+
import { Trans } from '@lingui/react/macro'
|
|
4
4
|
import type { BreadcrumbsProps } from '@mui/material'
|
|
5
5
|
import { Breadcrumbs, Link, Typography } from '@mui/material'
|
|
6
6
|
import { productPageCategory } from '../ProductPageCategory/productPageCategory'
|
|
@@ -23,7 +23,7 @@ export function ProductPageBreadcrumb(props: ProductPageBreadcrumbProps) {
|
|
|
23
23
|
return (
|
|
24
24
|
<Breadcrumbs {...breadcrumbProps}>
|
|
25
25
|
<Link href='/' underline='hover' color='inherit'>
|
|
26
|
-
<Trans
|
|
26
|
+
<Trans>Home</Trans>
|
|
27
27
|
</Link>
|
|
28
28
|
{filterNonNullableKeys(category?.breadcrumbs, ['category_level'])
|
|
29
29
|
.sort((a, b) => a.category_level - b.category_level)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import type { MotionImageAspectProps } from '@graphcommerce/framer-scroller
|
|
1
|
+
import type { MotionImageAspectProps } from '@graphcommerce/framer-scroller'
|
|
2
2
|
import type { SidebarGalleryProps, TypeRenderer } from '@graphcommerce/next-ui'
|
|
3
3
|
import { filterNonNullableKeys, nonNullable, SidebarGallery } from '@graphcommerce/next-ui'
|
|
4
4
|
import type { ProductPageGalleryFragment } from './ProductPageGallery.gql'
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { filterNonNullableKeys, sxx } from '@graphcommerce/next-ui'
|
|
2
|
-
import { Trans } from '@lingui/macro'
|
|
2
|
+
import { Trans } from '@lingui/react/macro'
|
|
3
3
|
import { Box, type SxProps, type Theme } from '@mui/material'
|
|
4
4
|
import { type AddToCartItemSelector } from '../AddProductsToCart'
|
|
5
5
|
import { ProductListPrice } from '../ProductListPrice'
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { PrivateQueryMask } from '@graphcommerce/graphql'
|
|
2
2
|
import { filterNonNullableKeys } from '@graphcommerce/next-ui'
|
|
3
|
-
import { Trans } from '@lingui/react'
|
|
3
|
+
import { Trans } from '@lingui/react/macro'
|
|
4
4
|
import type { SxProps, Theme } from '@mui/material'
|
|
5
5
|
import { ProductListPrice } from '../ProductListPrice/ProductListPrice'
|
|
6
6
|
import type { ProductPagePriceFragment } from './ProductPagePrice.gql'
|
|
@@ -25,13 +25,11 @@ export function ProductPagePriceTiers(props: ProductPagePriceTiersProps) {
|
|
|
25
25
|
<PrivateQueryMask sx={sx} variant='rectangular'>
|
|
26
26
|
{priceTiers.map(({ quantity, final_price, discount }) => (
|
|
27
27
|
<div key={quantity}>
|
|
28
|
-
<Trans
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
values={{ quantity, percent: discount.percent_off }}
|
|
34
|
-
/>
|
|
28
|
+
<Trans>
|
|
29
|
+
Buy {quantity} for{' '}
|
|
30
|
+
<ProductListPrice final_price={final_price} regular_price={final_price} /> and save{' '}
|
|
31
|
+
{discount.percent_off}%
|
|
32
|
+
</Trans>
|
|
35
33
|
</div>
|
|
36
34
|
))}
|
|
37
35
|
</PrivateQueryMask>
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { breakpointVal, iconOrderBefore, IconSvg } from '@graphcommerce/next-ui'
|
|
2
|
-
import { Trans } from '@lingui/react'
|
|
2
|
+
import { Trans } from '@lingui/react/macro'
|
|
3
3
|
import { Box, darken, lighten } from '@mui/material'
|
|
4
4
|
import type { UseAddProductsToCartActionFragment } from '../AddProductsToCart/UseAddProductsToCartAction.gql'
|
|
5
5
|
|
|
@@ -11,23 +11,20 @@ export function ProductSidebarDelivery(props: ProductSidebarDeliveryProps) {
|
|
|
11
11
|
const { product } = props
|
|
12
12
|
const { stock_status, only_x_left_in_stock } = product ?? {}
|
|
13
13
|
|
|
14
|
-
let title = <Trans
|
|
15
|
-
let subtitle = <Trans
|
|
14
|
+
let title = <Trans>Order before 22:00</Trans>
|
|
15
|
+
let subtitle = <Trans>Next day delivery - Shipping free</Trans>
|
|
16
16
|
|
|
17
17
|
if (stock_status === 'OUT_OF_STOCK') {
|
|
18
|
-
title = <Trans
|
|
19
|
-
subtitle = <Trans
|
|
18
|
+
title = <Trans>Out of stock</Trans>
|
|
19
|
+
subtitle = <Trans>We are sorry, this product is currently out of stock.</Trans>
|
|
20
20
|
} else if (stock_status === 'IN_STOCK' && only_x_left_in_stock) {
|
|
21
|
-
title = <Trans
|
|
21
|
+
title = <Trans>Only a few left</Trans>
|
|
22
22
|
subtitle = (
|
|
23
|
-
<Trans
|
|
24
|
-
id='Only {amount_left_in_stock} left in stock.'
|
|
25
|
-
values={{ amount_left_in_stock: only_x_left_in_stock }}
|
|
26
|
-
/>
|
|
23
|
+
<Trans>Only {only_x_left_in_stock} left in stock.</Trans>
|
|
27
24
|
)
|
|
28
25
|
}
|
|
29
26
|
if (only_x_left_in_stock === 1) {
|
|
30
|
-
subtitle = <Trans
|
|
27
|
+
subtitle = <Trans>Only 1 left in stock.</Trans>
|
|
31
28
|
}
|
|
32
29
|
|
|
33
30
|
return (
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import type { ApolloClient, ApolloQueryResult, NormalizedCacheObject } from '@graphcommerce/graphql'
|
|
2
|
+
import { limitSsg } from '@graphcommerce/next-config/config'
|
|
2
3
|
import type { GetStaticPathsResult } from 'next'
|
|
3
4
|
import type { ProductStaticPathsQuery } from './ProductStaticPaths.gql'
|
|
4
5
|
import { ProductStaticPathsDocument } from './ProductStaticPaths.gql'
|
|
@@ -12,7 +13,7 @@ export type ProductTypenames = NonNullable<
|
|
|
12
13
|
export async function getProductStaticPaths(
|
|
13
14
|
client: ApolloClient<NormalizedCacheObject>,
|
|
14
15
|
locale: string,
|
|
15
|
-
options: { limit?: boolean } = { limit:
|
|
16
|
+
options: { limit?: boolean } = { limit: limitSsg || false },
|
|
16
17
|
) {
|
|
17
18
|
const query = client.query({
|
|
18
19
|
query: ProductStaticPathsDocument,
|
package/hooks/useProductLink.ts
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
import { productRoute } from '@graphcommerce/next-config/config'
|
|
1
2
|
import type { ProductLinkFragment } from './ProductLink.gql'
|
|
2
3
|
|
|
3
4
|
export type ProductLinkProps = Omit<ProductLinkFragment, 'uid'>
|
|
4
5
|
|
|
5
|
-
const
|
|
6
|
+
const productRouteVal = productRoute ?? '/p/'
|
|
6
7
|
|
|
7
8
|
export function productPath(urlKey: string) {
|
|
8
|
-
return `${
|
|
9
|
+
return `${productRouteVal}${urlKey}`
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
export function productLink(link: ProductLinkProps) {
|
|
12
|
-
return `${
|
|
13
|
+
return `${productRouteVal}${link.url_key}`
|
|
13
14
|
}
|
|
14
15
|
|
|
15
16
|
export function useProductLink(props: ProductLinkProps) {
|
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": "
|
|
5
|
+
"version": "10.0.0-canary.56",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,31 +12,38 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"dependencies": {
|
|
15
|
-
"schema-dts": "^1.1.
|
|
15
|
+
"schema-dts": "^1.1.5"
|
|
16
16
|
},
|
|
17
17
|
"devDependencies": {
|
|
18
|
-
"typescript": "5.
|
|
18
|
+
"typescript": "5.9.3"
|
|
19
19
|
},
|
|
20
20
|
"peerDependencies": {
|
|
21
|
-
"@graphcommerce/ecommerce-ui": "^
|
|
22
|
-
"@graphcommerce/eslint-config-pwa": "^
|
|
23
|
-
"@graphcommerce/framer-next-pages": "^
|
|
24
|
-
"@graphcommerce/framer-scroller": "^
|
|
25
|
-
"@graphcommerce/graphql": "^
|
|
26
|
-
"@graphcommerce/graphql-mesh": "^
|
|
27
|
-
"@graphcommerce/image": "^
|
|
28
|
-
"@graphcommerce/magento-cart": "^
|
|
29
|
-
"@graphcommerce/magento-store": "^
|
|
30
|
-
"@graphcommerce/next-ui": "^
|
|
31
|
-
"@graphcommerce/prettier-config-pwa": "^
|
|
32
|
-
"@graphcommerce/typescript-config-pwa": "^
|
|
33
|
-
"@lingui/core": "^
|
|
34
|
-
"@lingui/macro": "^
|
|
35
|
-
"@lingui/react": "^
|
|
21
|
+
"@graphcommerce/ecommerce-ui": "^10.0.0-canary.56",
|
|
22
|
+
"@graphcommerce/eslint-config-pwa": "^10.0.0-canary.56",
|
|
23
|
+
"@graphcommerce/framer-next-pages": "^10.0.0-canary.56",
|
|
24
|
+
"@graphcommerce/framer-scroller": "^10.0.0-canary.56",
|
|
25
|
+
"@graphcommerce/graphql": "^10.0.0-canary.56",
|
|
26
|
+
"@graphcommerce/graphql-mesh": "^10.0.0-canary.56",
|
|
27
|
+
"@graphcommerce/image": "^10.0.0-canary.56",
|
|
28
|
+
"@graphcommerce/magento-cart": "^10.0.0-canary.56",
|
|
29
|
+
"@graphcommerce/magento-store": "^10.0.0-canary.56",
|
|
30
|
+
"@graphcommerce/next-ui": "^10.0.0-canary.56",
|
|
31
|
+
"@graphcommerce/prettier-config-pwa": "^10.0.0-canary.56",
|
|
32
|
+
"@graphcommerce/typescript-config-pwa": "^10.0.0-canary.56",
|
|
33
|
+
"@lingui/core": "^5",
|
|
34
|
+
"@lingui/macro": "^5",
|
|
35
|
+
"@lingui/react": "^5",
|
|
36
36
|
"@mui/material": "^5.10.16",
|
|
37
37
|
"framer-motion": "^11.0.0",
|
|
38
38
|
"next": "*",
|
|
39
|
-
"react": "^
|
|
40
|
-
"react-dom": "^
|
|
39
|
+
"react": "^19.2.0",
|
|
40
|
+
"react-dom": "^19.2.0"
|
|
41
|
+
},
|
|
42
|
+
"exports": {
|
|
43
|
+
".": "./index.ts",
|
|
44
|
+
"./components": "./components/index.ts",
|
|
45
|
+
"./components/AddProductsToCart/AddProductsToCartSnackbarMessage": "./components/AddProductsToCart/AddProductsToCartSnackbarMessage.tsx",
|
|
46
|
+
"./components/ProductFiltersPro": "./components/ProductFiltersPro/index.ts",
|
|
47
|
+
"./hooks/useProductLink": "./hooks/useProductLink.ts"
|
|
41
48
|
}
|
|
42
49
|
}
|