@graphcommerce/magento-product-configurable 9.0.0-canary.100 → 9.0.0-canary.103
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 +53 -1088
- package/ConfigurableCartItem/ConfigurableCartItem.tsx +3 -2
- package/ConfigurableCartItem/OptionsList.tsx +4 -3
- package/ConfigurableContext/ConfigurableContext.tsx +3 -11
- package/ConfigurableContext/cheapestVariant.ts +1 -1
- package/ConfigurableOptions/ConfigurableOptions.tsx +9 -6
- package/ConfigurableProductAddToCart/ConfigurableProductAddToCart.tsx +7 -10
- package/SwatchList.tsx +2 -2
- package/Swatches/ColorSwatchData.tsx +5 -4
- package/Swatches/ImageSwatchData.tsx +5 -4
- package/Swatches/TextSwatchData.tsx +5 -4
- package/Swatches/types.ts +4 -4
- package/components/ConfigurableCartItemOptions/ConfigurableCartItemOptions.tsx +3 -2
- package/components/ConfigurableOptionValue/ConfigurableOptionValue.tsx +2 -2
- package/components/ConfigurableOptionValueColor/ConfigurableOptionValueColor.tsx +2 -2
- package/components/ConfigurableOptionValueImage/ConfigurableOptionValueImage.tsx +2 -2
- package/components/ConfigurableOptionValueText/ConfigurableOptionValueText.tsx +2 -2
- package/components/ConfigurableProductOptions/ConfigurableProductOption.tsx +10 -9
- package/components/ConfigurableProductOptions/ConfigurableProductOptions.tsx +8 -5
- package/components/ProductListItemConfigurable/ProductListItemConfigurable.tsx +3 -6
- package/hooks/useConfigurableOptionsSelection.ts +2 -1
- package/package.json +19 -19
- package/plugins/ConfigurableProductPage/ConfigurableProductPageDescription.tsx +2 -2
- package/plugins/ConfigurableProductPage/ConfigurableProductPageMeta.tsx +2 -5
- package/plugins/ConfigurableProductPage/ConfigurableProductPagePrice.tsx +1 -1
- package/test/addConfigurableProductToCart.ts +2 -1
- package/utils/defaultConfigurableOptionsSelection.ts +3 -3
|
@@ -1,5 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
1
|
+
import type { CartItemProps } from '@graphcommerce/magento-cart-items'
|
|
2
|
+
import { CartItem } from '@graphcommerce/magento-cart-items'
|
|
3
|
+
import type { ConfigurableCartItemFragment } from './ConfigurableCartItem.gql'
|
|
3
4
|
import { OptionsList } from './OptionsList'
|
|
4
5
|
|
|
5
6
|
export function ConfigurableCartItem(props: ConfigurableCartItemFragment & CartItemProps) {
|
|
@@ -1,12 +1,13 @@
|
|
|
1
1
|
import { extendableComponent } from '@graphcommerce/next-ui'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
2
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
3
|
+
import { Box } from '@mui/material'
|
|
4
|
+
import type { ConfigurableCartItemFragment } from './ConfigurableCartItem.gql'
|
|
4
5
|
|
|
5
6
|
type CartItemOptionsListProps = Partial<ConfigurableCartItemFragment> & {
|
|
6
7
|
sx?: SxProps<Theme>
|
|
7
8
|
}
|
|
8
9
|
|
|
9
|
-
const name = 'ColorSwatchData'
|
|
10
|
+
const name = 'ColorSwatchData'
|
|
10
11
|
const parts = ['root', 'option'] as const
|
|
11
12
|
const { classes } = extendableComponent(name, parts)
|
|
12
13
|
|
|
@@ -1,14 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
Context,
|
|
5
|
-
useState,
|
|
6
|
-
Dispatch,
|
|
7
|
-
SetStateAction,
|
|
8
|
-
useMemo,
|
|
9
|
-
useCallback,
|
|
10
|
-
} from 'react'
|
|
11
|
-
import { ConfigurableProductFormFragment } from './ConfigurableProductForm.gql'
|
|
1
|
+
import type { Context, Dispatch, SetStateAction } from 'react'
|
|
2
|
+
import { useContext, createContext, useState, useMemo, useCallback } from 'react'
|
|
3
|
+
import type { ConfigurableProductFormFragment } from './ConfigurableProductForm.gql'
|
|
12
4
|
import cheapestVariant from './cheapestVariant'
|
|
13
5
|
|
|
14
6
|
type ConfigurableProductFormProps = ConfigurableProductFormFragment & {
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { FieldErrors, UseControllerProps } from '@graphcommerce/ecommerce-ui'
|
|
2
|
+
import { Controller } from '@graphcommerce/ecommerce-ui'
|
|
2
3
|
import {
|
|
3
4
|
RenderType,
|
|
4
5
|
SectionHeader,
|
|
@@ -6,13 +7,15 @@ import {
|
|
|
6
7
|
ToggleButtonGroup,
|
|
7
8
|
extendableComponent,
|
|
8
9
|
} from '@graphcommerce/next-ui'
|
|
9
|
-
import { BaseTextFieldProps,
|
|
10
|
+
import type { BaseTextFieldProps, SxProps } from '@mui/material'
|
|
11
|
+
import { FormHelperText } from '@mui/material'
|
|
10
12
|
import React from 'react'
|
|
11
|
-
import { Selected
|
|
13
|
+
import type { Selected } from '../ConfigurableContext/ConfigurableContext'
|
|
14
|
+
import { useConfigurableContext } from '../ConfigurableContext/ConfigurableContext'
|
|
12
15
|
import { ColorSwatchData } from '../Swatches/ColorSwatchData'
|
|
13
16
|
import { ImageSwatchData } from '../Swatches/ImageSwatchData'
|
|
14
17
|
import { TextSwatchData } from '../Swatches/TextSwatchData'
|
|
15
|
-
import { SwatchTypeRenderer, SwatchSize } from '../Swatches/types'
|
|
18
|
+
import type { SwatchTypeRenderer, SwatchSize } from '../Swatches/types'
|
|
16
19
|
|
|
17
20
|
export type ConfigurableOptionsInputProps = {
|
|
18
21
|
sku: string
|
|
@@ -27,7 +30,7 @@ export type ConfigurableOptionsInputProps = {
|
|
|
27
30
|
|
|
28
31
|
const renderer: SwatchTypeRenderer = { TextSwatchData, ImageSwatchData, ColorSwatchData }
|
|
29
32
|
|
|
30
|
-
const compName = 'ConfigurableOptionsInput'
|
|
33
|
+
const compName = 'ConfigurableOptionsInput'
|
|
31
34
|
const parts = ['buttonGroup', 'button', 'helperText'] as const
|
|
32
35
|
const { classes } = extendableComponent(compName, parts)
|
|
33
36
|
|
|
@@ -76,7 +79,7 @@ export function ConfigurableOptionsInput(props: ConfigurableOptionsInputProps) {
|
|
|
76
79
|
exclusive
|
|
77
80
|
onChange={(_, val: string | number) => {
|
|
78
81
|
onChange(val)
|
|
79
|
-
select((prev) => ({ ...prev, [attribute_code]: val } as Selected)
|
|
82
|
+
select((prev) => ({ ...prev, [attribute_code]: val }) as Selected)
|
|
80
83
|
}}
|
|
81
84
|
ref={ref}
|
|
82
85
|
onBlur={onBlur}
|
|
@@ -9,18 +9,15 @@ import {
|
|
|
9
9
|
IconSvg,
|
|
10
10
|
} from '@graphcommerce/next-ui'
|
|
11
11
|
import { Trans } from '@lingui/macro'
|
|
12
|
-
import {
|
|
12
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
13
|
+
import { Divider, Typography, Alert, Box } from '@mui/material'
|
|
13
14
|
import React from 'react'
|
|
14
15
|
import { useConfigurableContext } from '../ConfigurableContext/ConfigurableContext'
|
|
15
16
|
import cheapestVariant from '../ConfigurableContext/cheapestVariant'
|
|
16
|
-
import {
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
} from '../
|
|
20
|
-
import {
|
|
21
|
-
ConfigurableProductAddToCartDocument,
|
|
22
|
-
ConfigurableProductAddToCartMutationVariables,
|
|
23
|
-
} from '../graphql/ConfigurableProductAddToCart.gql'
|
|
17
|
+
import type { ConfigurableOptionsInputProps } from '../ConfigurableOptions/ConfigurableOptions'
|
|
18
|
+
import { ConfigurableOptionsInput } from '../ConfigurableOptions/ConfigurableOptions'
|
|
19
|
+
import type { ConfigurableProductAddToCartMutationVariables } from '../graphql/ConfigurableProductAddToCart.gql'
|
|
20
|
+
import { ConfigurableProductAddToCartDocument } from '../graphql/ConfigurableProductAddToCart.gql'
|
|
24
21
|
|
|
25
22
|
type ConfigurableProductAddToCartProps = {
|
|
26
23
|
variables: Omit<ConfigurableProductAddToCartMutationVariables, 'cartId' | 'selectedOptions'>
|
|
@@ -35,7 +32,7 @@ type ConfigurableProductAddToCartProps = {
|
|
|
35
32
|
>
|
|
36
33
|
}
|
|
37
34
|
|
|
38
|
-
const compName = 'ConfigurableOptionsInput'
|
|
35
|
+
const compName = 'ConfigurableOptionsInput'
|
|
39
36
|
const parts = ['form', 'button', 'finalPrice', 'quantity', 'divider', 'buttonWrapper'] as const
|
|
40
37
|
const { classes } = extendableComponent(compName, parts)
|
|
41
38
|
|
package/SwatchList.tsx
CHANGED
|
@@ -4,8 +4,8 @@ import React from 'react'
|
|
|
4
4
|
import { ColorSwatchData } from './Swatches/ColorSwatchData'
|
|
5
5
|
import { ImageSwatchData } from './Swatches/ImageSwatchData'
|
|
6
6
|
import { TextSwatchData } from './Swatches/TextSwatchData'
|
|
7
|
-
import { SwatchSize, SwatchTypeRenderer } from './Swatches/types'
|
|
8
|
-
import { ProductListItemConfigurableFragment } from './components/ProductListItemConfigurable/ProductListItemConfigurable.gql'
|
|
7
|
+
import type { SwatchSize, SwatchTypeRenderer } from './Swatches/types'
|
|
8
|
+
import type { ProductListItemConfigurableFragment } from './components/ProductListItemConfigurable/ProductListItemConfigurable.gql'
|
|
9
9
|
|
|
10
10
|
type SwatchListProps = {
|
|
11
11
|
attributes?: string[]
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
import { responsiveVal, extendableComponent } from '@graphcommerce/next-ui'
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
2
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
3
|
+
import { Box } from '@mui/material'
|
|
4
|
+
import type { ColorSwatchDataFragment } from './ColorSwatchData.gql'
|
|
5
|
+
import type { SwatchDataProps } from './types'
|
|
5
6
|
|
|
6
7
|
type ColorSwatchDataProps = ColorSwatchDataFragment &
|
|
7
8
|
SwatchDataProps & {
|
|
@@ -9,7 +10,7 @@ type ColorSwatchDataProps = ColorSwatchDataFragment &
|
|
|
9
10
|
}
|
|
10
11
|
|
|
11
12
|
type OwnerState = Pick<SwatchDataProps, 'size'>
|
|
12
|
-
const name = 'ColorSwatchData'
|
|
13
|
+
const name = 'ColorSwatchData'
|
|
13
14
|
const parts = ['root', 'color', 'label'] as const
|
|
14
15
|
const { withState } = extendableComponent<OwnerState, typeof name, typeof parts>(name, parts)
|
|
15
16
|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Image } from '@graphcommerce/image'
|
|
2
2
|
import { responsiveVal, extendableComponent } from '@graphcommerce/next-ui'
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
4
|
+
import { Box } from '@mui/material'
|
|
5
|
+
import type { ImageSwatchDataFragment } from './ImageSwatchData.gql'
|
|
6
|
+
import type { SwatchDataProps } from './types'
|
|
6
7
|
|
|
7
8
|
type ImageSwatchDataProps = ImageSwatchDataFragment & SwatchDataProps & { sx?: SxProps<Theme> }
|
|
8
9
|
|
|
9
10
|
type OwnerState = Pick<SwatchDataProps, 'size'>
|
|
10
|
-
const name = 'ColorSwatchData'
|
|
11
|
+
const name = 'ColorSwatchData'
|
|
11
12
|
const parts = ['root', 'image', 'label'] as const
|
|
12
13
|
const { withState } = extendableComponent<OwnerState, typeof name, typeof parts>(name, parts)
|
|
13
14
|
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
import { Money } from '@graphcommerce/magento-store'
|
|
2
2
|
import { extendableComponent } from '@graphcommerce/next-ui'
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
3
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
4
|
+
import { Box } from '@mui/material'
|
|
5
|
+
import type { TextSwatchDataFragment } from './TextSwatchData.gql'
|
|
6
|
+
import type { SwatchDataProps } from './types'
|
|
6
7
|
|
|
7
8
|
type TextSwatchDataProps = TextSwatchDataFragment & SwatchDataProps & { sx?: SxProps<Theme> }
|
|
8
9
|
|
|
9
10
|
type OwnerState = Pick<SwatchDataProps, 'size'>
|
|
10
|
-
const name = 'TextSwatchData'
|
|
11
|
+
const name = 'TextSwatchData'
|
|
11
12
|
const parts = ['root', 'value', 'price', 'label', 'storeLabel', 'content'] as const
|
|
12
13
|
const { withState } = extendableComponent<OwnerState, typeof name, typeof parts>(name, parts)
|
|
13
14
|
|
package/Swatches/types.ts
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import { MoneyProps } from '@graphcommerce/magento-store'
|
|
2
|
-
import { TypeRenderer } from '@graphcommerce/next-ui'
|
|
3
|
-
import { ProductListItemConfigurableFragment } from '../components/ProductListItemConfigurable/ProductListItemConfigurable.gql'
|
|
4
|
-
import { SwatchDataFragment } from './SwatchData.gql'
|
|
1
|
+
import type { MoneyProps } from '@graphcommerce/magento-store'
|
|
2
|
+
import type { TypeRenderer } from '@graphcommerce/next-ui'
|
|
3
|
+
import type { ProductListItemConfigurableFragment } from '../components/ProductListItemConfigurable/ProductListItemConfigurable.gql'
|
|
4
|
+
import type { SwatchDataFragment } from './SwatchData.gql'
|
|
5
5
|
|
|
6
6
|
type ConfigurableOption = NonNullable<
|
|
7
7
|
NonNullable<ProductListItemConfigurableFragment['configurable_options']>[0]
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
import { CartItemFragment
|
|
1
|
+
import type { CartItemFragment } from '@graphcommerce/magento-cart-items'
|
|
2
|
+
import { SelectedCustomizableOptions } from '@graphcommerce/magento-cart-items'
|
|
2
3
|
import { Box } from '@mui/material'
|
|
3
|
-
import { ConfigurableCartItemFragment } from '../../ConfigurableCartItem/ConfigurableCartItem.gql'
|
|
4
|
+
import type { ConfigurableCartItemFragment } from '../../ConfigurableCartItem/ConfigurableCartItem.gql'
|
|
4
5
|
|
|
5
6
|
type ConfigurableActionCartItemProps = ConfigurableCartItemFragment & CartItemFragment
|
|
6
7
|
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ActionCardItemRenderProps } from '@graphcommerce/ecommerce-ui'
|
|
1
|
+
import type { ActionCardItemRenderProps } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import { RenderType } from '@graphcommerce/next-ui'
|
|
3
3
|
import { ConfigurableOptionValueColor } from '../ConfigurableOptionValueColor'
|
|
4
4
|
import { ConfigurableOptionValueImage } from '../ConfigurableOptionValueImage/ConfigurableOptionValueImage'
|
|
5
5
|
import { ConfigurableOptionValueText } from '../ConfigurableOptionValueText/ConfigurableOptionValueText'
|
|
6
|
-
import { ConfigurableOptionValueFragment } from './ConfigurableOptionValue.gql'
|
|
6
|
+
import type { ConfigurableOptionValueFragment } from './ConfigurableOptionValue.gql'
|
|
7
7
|
|
|
8
8
|
export type ConfigurabeOptionValueProps = ActionCardItemRenderProps<ConfigurableOptionValueFragment>
|
|
9
9
|
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ActionCardItemRenderProps } from '@graphcommerce/ecommerce-ui'
|
|
1
|
+
import type { ActionCardItemRenderProps } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import { ActionCard } from '@graphcommerce/next-ui'
|
|
3
3
|
import { Box } from '@mui/material'
|
|
4
4
|
import { swatchSizes } from '../ConfigurableOptionValueImage'
|
|
5
|
-
import { ConfigurableOptionValueColorFragment } from './ConfigurableOptionValueColor.gql'
|
|
5
|
+
import type { ConfigurableOptionValueColorFragment } from './ConfigurableOptionValueColor.gql'
|
|
6
6
|
|
|
7
7
|
export type ConfigurableOptionValueColorProps =
|
|
8
8
|
ActionCardItemRenderProps<ConfigurableOptionValueColorFragment>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { ActionCardItemRenderProps } from '@graphcommerce/ecommerce-ui'
|
|
1
|
+
import type { ActionCardItemRenderProps } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import { Image } from '@graphcommerce/image'
|
|
3
3
|
import { ActionCard, responsiveVal } from '@graphcommerce/next-ui'
|
|
4
4
|
import { Trans } from '@lingui/react'
|
|
5
5
|
import { Button } from '@mui/material'
|
|
6
|
-
import { ConfigurableOptionValueImageFragment } from './ConfigurableOptionValueImage.gql'
|
|
6
|
+
import type { ConfigurableOptionValueImageFragment } from './ConfigurableOptionValueImage.gql'
|
|
7
7
|
|
|
8
8
|
export type ConfigurableOptionValueImageProps =
|
|
9
9
|
ActionCardItemRenderProps<ConfigurableOptionValueImageFragment>
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { ActionCardItemRenderProps } from '@graphcommerce/ecommerce-ui'
|
|
1
|
+
import type { ActionCardItemRenderProps } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import { ActionCard } from '@graphcommerce/next-ui'
|
|
3
|
-
import { ConfigurableOptionValueTextFragment } from './ConfigurableOptionValueText.gql'
|
|
3
|
+
import type { ConfigurableOptionValueTextFragment } from './ConfigurableOptionValueText.gql'
|
|
4
4
|
|
|
5
5
|
export type ConfigurableOptionValueTextProps =
|
|
6
6
|
ActionCardItemRenderProps<ConfigurableOptionValueTextFragment>
|
|
@@ -1,15 +1,16 @@
|
|
|
1
|
-
import { ActionCardItemBase
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
} from '@graphcommerce/magento-product/components'
|
|
1
|
+
import type { ActionCardItemBase } from '@graphcommerce/ecommerce-ui'
|
|
2
|
+
import { ActionCardListForm } from '@graphcommerce/ecommerce-ui'
|
|
3
|
+
import type { AddProductsToCartFields } from '@graphcommerce/magento-product/components'
|
|
4
|
+
import { useFormAddProductsToCart } from '@graphcommerce/magento-product/components'
|
|
6
5
|
import { filterNonNullableKeys, nonNullable, SectionHeader } from '@graphcommerce/next-ui'
|
|
7
6
|
import { useWatch } from '@graphcommerce/react-hook-form'
|
|
8
7
|
import { i18n } from '@lingui/core'
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
8
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
9
|
+
import { Box } from '@mui/material'
|
|
10
|
+
import type { ConfigurableOptionsFragment } from '../../graphql/ConfigurableOptions.gql'
|
|
11
|
+
import type { UseConfigurableOptionsSelection } from '../../hooks'
|
|
12
|
+
import { useConfigurableOptionsForSelection } from '../../hooks'
|
|
13
|
+
import type {
|
|
13
14
|
ConfigurableOptionValue,
|
|
14
15
|
ConfigurableOptionValueFragment,
|
|
15
16
|
} from '../ConfigurableOptionValue'
|
|
@@ -1,10 +1,13 @@
|
|
|
1
|
-
import { ActionCardRequireOptionSelection } from '@graphcommerce/ecommerce-ui'
|
|
2
|
-
import { AddToCartItemSelector
|
|
3
|
-
import {
|
|
1
|
+
import type { ActionCardRequireOptionSelection } from '@graphcommerce/ecommerce-ui'
|
|
2
|
+
import type { AddToCartItemSelector } from '@graphcommerce/magento-product'
|
|
3
|
+
import { useFormAddProductsToCart } from '@graphcommerce/magento-product'
|
|
4
|
+
import type { ActionCardListProps } from '@graphcommerce/next-ui'
|
|
5
|
+
import { filterNonNullableKeys, useLocale } from '@graphcommerce/next-ui'
|
|
4
6
|
import { i18n } from '@lingui/core'
|
|
5
|
-
import {
|
|
7
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
8
|
+
import { Box } from '@mui/material'
|
|
6
9
|
import React, { useEffect, useMemo } from 'react'
|
|
7
|
-
import { ConfigurableOptionsFragment } from '../../graphql/ConfigurableOptions.gql'
|
|
10
|
+
import type { ConfigurableOptionsFragment } from '../../graphql/ConfigurableOptions.gql'
|
|
8
11
|
import { useConfigurableOptionsSelection } from '../../hooks'
|
|
9
12
|
import { ConfigurableOptionValue } from '../ConfigurableOptionValue/ConfigurableOptionValue'
|
|
10
13
|
import { ConfigurableProductOption } from './ConfigurableProductOption'
|
|
@@ -1,10 +1,7 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
OverlayAreaKeys,
|
|
4
|
-
ProductListItemProps,
|
|
5
|
-
} from '@graphcommerce/magento-product'
|
|
1
|
+
import type { OverlayAreaKeys, ProductListItemProps } from '@graphcommerce/magento-product'
|
|
2
|
+
import { ProductListItem } from '@graphcommerce/magento-product'
|
|
6
3
|
import { SwatchList } from '../../SwatchList'
|
|
7
|
-
import { ProductListItemConfigurableFragment } from './ProductListItemConfigurable.gql'
|
|
4
|
+
import type { ProductListItemConfigurableFragment } from './ProductListItemConfigurable.gql'
|
|
8
5
|
|
|
9
6
|
export type ProdustListItemConfigurableProps = ProductListItemConfigurableFragment &
|
|
10
7
|
ProductListItemProps & {
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { useQuery } from '@graphcommerce/graphql'
|
|
2
|
-
import { AddToCartItemSelector
|
|
2
|
+
import type { AddToCartItemSelector } from '@graphcommerce/magento-product'
|
|
3
|
+
import { useFormAddProductsToCart } from '@graphcommerce/magento-product'
|
|
3
4
|
import { findByTypename, nonNullable } from '@graphcommerce/next-ui'
|
|
4
5
|
import { useWatch } from '@graphcommerce/react-hook-form'
|
|
5
6
|
import { GetConfigurableOptionsSelectionDocument } from '../graphql/GetConfigurableOptionsSelection.gql'
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/magento-product-configurable",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "9.0.0-canary.
|
|
5
|
+
"version": "9.0.0-canary.103",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,28 +12,28 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@graphcommerce/ecommerce-ui": "^9.0.0-canary.
|
|
16
|
-
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.
|
|
17
|
-
"@graphcommerce/graphql": "^9.0.0-canary.
|
|
18
|
-
"@graphcommerce/graphql-mesh": "^9.0.0-canary.
|
|
19
|
-
"@graphcommerce/image": "^9.0.0-canary.
|
|
20
|
-
"@graphcommerce/lingui-next": "9.0.0-canary.
|
|
21
|
-
"@graphcommerce/magento-cart": "^9.0.0-canary.
|
|
22
|
-
"@graphcommerce/magento-cart-items": "^9.0.0-canary.
|
|
23
|
-
"@graphcommerce/magento-category": "^9.0.0-canary.
|
|
24
|
-
"@graphcommerce/magento-customer": "^9.0.0-canary.
|
|
25
|
-
"@graphcommerce/magento-product": "^9.0.0-canary.
|
|
26
|
-
"@graphcommerce/magento-product-simple": "^9.0.0-canary.
|
|
27
|
-
"@graphcommerce/magento-store": "^9.0.0-canary.
|
|
28
|
-
"@graphcommerce/next-ui": "^9.0.0-canary.
|
|
29
|
-
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.
|
|
30
|
-
"@graphcommerce/react-hook-form": "^9.0.0-canary.
|
|
31
|
-
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.
|
|
15
|
+
"@graphcommerce/ecommerce-ui": "^9.0.0-canary.103",
|
|
16
|
+
"@graphcommerce/eslint-config-pwa": "^9.0.0-canary.103",
|
|
17
|
+
"@graphcommerce/graphql": "^9.0.0-canary.103",
|
|
18
|
+
"@graphcommerce/graphql-mesh": "^9.0.0-canary.103",
|
|
19
|
+
"@graphcommerce/image": "^9.0.0-canary.103",
|
|
20
|
+
"@graphcommerce/lingui-next": "9.0.0-canary.103",
|
|
21
|
+
"@graphcommerce/magento-cart": "^9.0.0-canary.103",
|
|
22
|
+
"@graphcommerce/magento-cart-items": "^9.0.0-canary.103",
|
|
23
|
+
"@graphcommerce/magento-category": "^9.0.0-canary.103",
|
|
24
|
+
"@graphcommerce/magento-customer": "^9.0.0-canary.103",
|
|
25
|
+
"@graphcommerce/magento-product": "^9.0.0-canary.103",
|
|
26
|
+
"@graphcommerce/magento-product-simple": "^9.0.0-canary.103",
|
|
27
|
+
"@graphcommerce/magento-store": "^9.0.0-canary.103",
|
|
28
|
+
"@graphcommerce/next-ui": "^9.0.0-canary.103",
|
|
29
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.0-canary.103",
|
|
30
|
+
"@graphcommerce/react-hook-form": "^9.0.0-canary.103",
|
|
31
|
+
"@graphcommerce/typescript-config-pwa": "^9.0.0-canary.103",
|
|
32
32
|
"@lingui/core": "^4.2.1",
|
|
33
33
|
"@lingui/macro": "^4.2.1",
|
|
34
34
|
"@lingui/react": "^4.2.1",
|
|
35
35
|
"@mui/material": "^5.10.16",
|
|
36
|
-
"framer-motion": "^
|
|
36
|
+
"framer-motion": "^11.0.0",
|
|
37
37
|
"next": "*",
|
|
38
38
|
"react": "^18.2.0",
|
|
39
39
|
"react-dom": "^18.2.0"
|
|
@@ -11,9 +11,9 @@ export const config: PluginConfig = {
|
|
|
11
11
|
ifConfig: 'configurableVariantValues.content',
|
|
12
12
|
}
|
|
13
13
|
|
|
14
|
-
export
|
|
14
|
+
export function ProductPageDescription(
|
|
15
15
|
props: PluginProps<ProductPageDescriptionProps & AddToCartItemSelector>,
|
|
16
|
-
)
|
|
16
|
+
) {
|
|
17
17
|
const { Prev, product, index, ...rest } = props
|
|
18
18
|
const variant = useConfigurableSelectedVariant({ url_key: product.url_key, index })
|
|
19
19
|
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
import { mergeDeep } from '@graphcommerce/graphql'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
type AddToCartItemSelector,
|
|
5
|
-
ProductPageMetaProps,
|
|
6
|
-
} from '@graphcommerce/magento-product'
|
|
2
|
+
import type { ProductPageMetaProps } from '@graphcommerce/magento-product'
|
|
3
|
+
import { productLink, type AddToCartItemSelector } from '@graphcommerce/magento-product'
|
|
7
4
|
import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
|
|
8
5
|
import { useRouter } from 'next/router'
|
|
9
6
|
import { useEffect } from 'react'
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { AddToCartItemSelector, ProductPagePriceProps } from '@graphcommerce/magento-product'
|
|
1
|
+
import type { AddToCartItemSelector, ProductPagePriceProps } from '@graphcommerce/magento-product'
|
|
2
2
|
import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
|
|
3
3
|
import { useConfigurableSelectedVariant } from '../../hooks'
|
|
4
4
|
|
|
@@ -2,7 +2,8 @@
|
|
|
2
2
|
import { waitForGraphQlResponse } from '@graphcommerce/graphql/test/apolloClient.fixture'
|
|
3
3
|
import { CreateEmptyCartDocument } from '@graphcommerce/magento-cart/hooks/CreateEmptyCart.gql'
|
|
4
4
|
import { ProductAddToCartDocument } from '@graphcommerce/magento-product'
|
|
5
|
-
import { Page
|
|
5
|
+
import type { Page } from '@playwright/test'
|
|
6
|
+
import { expect } from '@playwright/test'
|
|
6
7
|
|
|
7
8
|
export async function addConfigurableProductToCart(page: Page, productUrl: string) {
|
|
8
9
|
await page.goto(productUrl)
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { ApolloClient } from '@graphcommerce/graphql'
|
|
2
|
-
import { AddProductsToCartFormProps } from '@graphcommerce/magento-product'
|
|
1
|
+
import type { ApolloClient } from '@graphcommerce/graphql'
|
|
2
|
+
import type { AddProductsToCartFormProps } from '@graphcommerce/magento-product'
|
|
3
3
|
import { filterNonNullableKeys, findByTypename, nonNullable } from '@graphcommerce/next-ui'
|
|
4
4
|
import { GetConfigurableOptionsSelectionDocument } from '../graphql'
|
|
5
|
-
import { DefaultConfigurableOptionsSelectionFragment } from './DefaultConfigurableOptionsSelection.gql'
|
|
5
|
+
import type { DefaultConfigurableOptionsSelectionFragment } from './DefaultConfigurableOptionsSelection.gql'
|
|
6
6
|
|
|
7
7
|
type BaseQuery =
|
|
8
8
|
| { products?: DefaultConfigurableOptionsSelectionFragment | null | undefined }
|