@graphcommerce/magento-cart-items 7.0.0-canary.21 → 7.0.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.
@@ -1,6 +1,7 @@
1
1
  fragment CartItem on CartItemInterface @injectable {
2
2
  uid
3
3
  quantity
4
+ __typename
4
5
  product {
5
6
  uid
6
7
  ...ProductLink
@@ -23,12 +24,15 @@ fragment CartItem on CartItemInterface @injectable {
23
24
  price {
24
25
  ...Money
25
26
  }
26
- row_total {
27
+ price_including_tax {
27
28
  ...Money
28
29
  }
29
30
  row_total_including_tax {
30
31
  ...Money
31
32
  }
33
+ row_total {
34
+ ...Money
35
+ }
32
36
  total_item_discount {
33
37
  ...Money
34
38
  }
package/CHANGELOG.md CHANGED
@@ -1,6 +1,176 @@
1
1
  # Change Log
2
2
 
3
- ## 7.0.0-canary.21
3
+ ## 7.0.0
4
+
5
+ ### Minor Changes
6
+
7
+ - [#2003](https://github.com/graphcommerce-org/graphcommerce/pull/2003) [`609b384de`](https://github.com/graphcommerce-org/graphcommerce/commit/609b384de8cded7a9dd2f29bd516ded810ab970a) - Created a new version of the cart using ActionCards for each CartItem. Different types of CartItems can have different ActionCards. These ActionCards will be overridden with the use of Plugins. An example can be found in the @graphcommerce/magento-product-configurable package. ([@Jessevdpoel](https://github.com/Jessevdpoel))
8
+
9
+ - [#2029](https://github.com/graphcommerce-org/graphcommerce/pull/2029) [`4ac92840a`](https://github.com/graphcommerce-org/graphcommerce/commit/4ac92840a44c8697738f5437fa0b81ef8210e2a7) - Use price_including_tax field when available instead of dividing through the row_total_including_tax ([@Jessevdpoel](https://github.com/Jessevdpoel))
10
+
11
+ ## 6.2.0-canary.98
12
+
13
+ ## 6.2.0-canary.97
14
+
15
+ ## 6.2.0-canary.96
16
+
17
+ ## 6.2.0-canary.95
18
+
19
+ ## 6.2.0-canary.94
20
+
21
+ ## 6.2.0-canary.93
22
+
23
+ ## 6.2.0-canary.92
24
+
25
+ ## 6.2.0-canary.91
26
+
27
+ ### Minor Changes
28
+
29
+ - [#2029](https://github.com/graphcommerce-org/graphcommerce/pull/2029) [`4ac92840a`](https://github.com/graphcommerce-org/graphcommerce/commit/4ac92840a44c8697738f5437fa0b81ef8210e2a7) - Support official price_including_tax instead of dividing through the row_total_including_tax ([@Jessevdpoel](https://github.com/Jessevdpoel))
30
+
31
+ ## 6.2.0-canary.90
32
+
33
+ ## 6.2.0-canary.89
34
+
35
+ ## 6.2.0-canary.88
36
+
37
+ ## 6.2.0-canary.87
38
+
39
+ ## 6.2.0-canary.86
40
+
41
+ ## 6.2.0-canary.85
42
+
43
+ ## 6.2.0-canary.84
44
+
45
+ ## 6.2.0-canary.83
46
+
47
+ ## 6.2.0-canary.82
48
+
49
+ ## 6.2.0-canary.81
50
+
51
+ ### Minor Changes
52
+
53
+ - [#2003](https://github.com/graphcommerce-org/graphcommerce/pull/2003) [`609b384de`](https://github.com/graphcommerce-org/graphcommerce/commit/609b384de8cded7a9dd2f29bd516ded810ab970a) - Created a new version of the cart using ActionCards for each CartItem. Different types of CartItems can have different ActionCards. These ActionCards will be overridden with the use of Plugins. An example can be found in the @graphcommerce/magento-product-configurable package. ([@Jessevdpoel](https://github.com/Jessevdpoel))
54
+
55
+ ## 6.2.0-canary.80
56
+
57
+ ## 6.2.0-canary.79
58
+
59
+ ## 6.2.0-canary.78
60
+
61
+ ## 6.2.0-canary.77
62
+
63
+ ## 6.2.0-canary.76
64
+
65
+ ## 6.2.0-canary.75
66
+
67
+ ## 6.2.0-canary.74
68
+
69
+ ## 6.2.0-canary.73
70
+
71
+ ## 6.2.0-canary.72
72
+
73
+ ## 6.2.0-canary.71
74
+
75
+ ## 6.2.0-canary.70
76
+
77
+ ## 6.2.0-canary.69
78
+
79
+ ## 6.2.0-canary.68
80
+
81
+ ## 6.2.0-canary.67
82
+
83
+ ## 6.2.0-canary.66
84
+
85
+ ## 6.2.0-canary.65
86
+
87
+ ## 6.2.0-canary.64
88
+
89
+ ## 6.2.0-canary.63
90
+
91
+ ## 6.2.0-canary.62
92
+
93
+ ## 6.2.0-canary.61
94
+
95
+ ## 6.2.0-canary.60
96
+
97
+ ## 6.2.0-canary.59
98
+
99
+ ## 6.2.0-canary.58
100
+
101
+ ## 6.2.0-canary.57
102
+
103
+ ## 6.2.0-canary.56
104
+
105
+ ## 6.2.0-canary.55
106
+
107
+ ## 6.2.0-canary.54
108
+
109
+ ## 6.2.0-canary.53
110
+
111
+ ## 6.2.0-canary.52
112
+
113
+ ## 6.2.0-canary.51
114
+
115
+ ## 6.2.0-canary.50
116
+
117
+ ## 6.2.0-canary.49
118
+
119
+ ## 6.2.0-canary.48
120
+
121
+ ## 6.2.0-canary.47
122
+
123
+ ## 6.2.0-canary.46
124
+
125
+ ## 6.2.0-canary.45
126
+
127
+ ## 6.2.0-canary.44
128
+
129
+ ## 6.2.0-canary.43
130
+
131
+ ## 6.2.0-canary.42
132
+
133
+ ## 6.2.0-canary.41
134
+
135
+ ## 6.2.0-canary.40
136
+
137
+ ## 6.2.0-canary.39
138
+
139
+ ## 6.2.0-canary.38
140
+
141
+ ## 6.2.0-canary.37
142
+
143
+ ## 6.2.0-canary.36
144
+
145
+ ## 6.2.0-canary.35
146
+
147
+ ## 6.2.0-canary.34
148
+
149
+ ## 6.2.0-canary.33
150
+
151
+ ## 6.2.0-canary.32
152
+
153
+ ## 6.2.0-canary.31
154
+
155
+ ## 6.2.0-canary.30
156
+
157
+ ## 6.2.0-canary.29
158
+
159
+ ## 6.2.0-canary.28
160
+
161
+ ## 6.2.0-canary.27
162
+
163
+ ## 6.2.0-canary.26
164
+
165
+ ## 6.2.0-canary.25
166
+
167
+ ## 6.2.0-canary.24
168
+
169
+ ## 6.2.0-canary.23
170
+
171
+ ## 6.2.0-canary.22
172
+
173
+ ## 6.2.0-canary.21
4
174
 
5
175
  ## 6.2.0-canary.20
6
176
 
@@ -9,7 +9,7 @@ import {
9
9
  NextLink,
10
10
  } from '@graphcommerce/next-ui'
11
11
  import { Badge, Box, Link, SxProps, Theme } from '@mui/material'
12
- import { CartItemFragment } from '../Api/CartItem.gql'
12
+ import { CartItemFragment } from '../../Api/CartItem.gql'
13
13
  import { RemoveItemFromCartFab } from '../RemoveItemFromCart/RemoveItemFromCartFab'
14
14
  import { UpdateItemQuantity } from '../UpdateItemQuantity/UpdateItemQuantity'
15
15
 
@@ -38,6 +38,7 @@ const { withState } = extendableComponent<OwnerState, typeof compName, typeof pa
38
38
  parts,
39
39
  )
40
40
 
41
+ /** @deprecated Replace with CartItemActionCard */
41
42
  export function CartItem(props: CartItemProps) {
42
43
  const { product, errors, uid, prices, quantity, children, withOptions = true, sx = [] } = props
43
44
  const { name } = product
@@ -96,7 +97,7 @@ export function CartItem(props: CartItemProps) {
96
97
  quantity={quantity}
97
98
  prices={prices}
98
99
  product={product}
99
- className={classes.badge}
100
+ fabProps={{ className: classes.badge }}
100
101
  sx={(theme) => ({
101
102
  '& > button': {
102
103
  background: theme.palette.background.paper,
@@ -0,0 +1,149 @@
1
+ import { Image } from '@graphcommerce/image'
2
+ import { useDisplayInclTax } from '@graphcommerce/magento-cart/hooks'
3
+ import { Money } from '@graphcommerce/magento-store'
4
+ import {
5
+ ActionCard,
6
+ ActionCardProps,
7
+ responsiveVal,
8
+ filterNonNullableKeys,
9
+ } from '@graphcommerce/next-ui'
10
+ import { Box, Link } from '@mui/material'
11
+ import { CartItemFragment } from '../../Api/CartItem.gql'
12
+ import { RemoveItemFromCart } from '../RemoveItemFromCart/RemoveItemFromCart'
13
+ import { UpdateItemQuantity } from '../UpdateItemQuantity/UpdateItemQuantity'
14
+
15
+ export type CartItemActionCardProps = { cartItem: CartItemFragment } & Omit<
16
+ ActionCardProps,
17
+ 'value' | 'image' | 'price' | 'title' | 'action'
18
+ >
19
+
20
+ export const productImageSizes = {
21
+ small: responsiveVal(60, 80),
22
+ medium: responsiveVal(60, 80),
23
+ large: responsiveVal(100, 120),
24
+ }
25
+
26
+ const typographySizes = {
27
+ small: 'body2',
28
+ medium: 'body1',
29
+ large: 'subtitle1',
30
+ }
31
+
32
+ export function CartItemActionCard(props: CartItemActionCardProps) {
33
+ const { cartItem, sx = [], size = 'large', ...rest } = props
34
+ const { uid, quantity, prices, errors, product } = cartItem
35
+ const { name, thumbnail, url_key } = product
36
+
37
+ const inclTaxes = useDisplayInclTax()
38
+
39
+ let price: number | null | undefined
40
+
41
+ if (inclTaxes) {
42
+ if (prices?.price_including_tax) {
43
+ price = prices.price_including_tax.value
44
+ } else {
45
+ const rowTotalIncludingTax = prices?.row_total_including_tax?.value ?? 0
46
+ price = rowTotalIncludingTax / quantity
47
+ }
48
+ } else {
49
+ price = prices?.price.value
50
+ }
51
+
52
+ return (
53
+ <ActionCard
54
+ value={uid}
55
+ sx={[
56
+ (theme) => ({
57
+ '&.ActionCard-root': {
58
+ px: 0,
59
+ py: theme.spacings.xs,
60
+ },
61
+ '& .MuiBox-root': {
62
+ justifyContent: 'space-between',
63
+ alignItems: 'stretch',
64
+ },
65
+ '&.sizeSmall': {
66
+ px: 0,
67
+ },
68
+ '& .ActionCard-action': {
69
+ pr: theme.spacings.xs,
70
+ },
71
+ '& .ActionCard-image': {
72
+ alignSelf: 'flex-start',
73
+ transform: 'translateY(10px)',
74
+ },
75
+ '& .ActionCard-secondaryAction': {
76
+ typography: typographySizes[size],
77
+ display: 'flex',
78
+ alignItems: 'center',
79
+ color: 'text.secondary',
80
+ mt: 1,
81
+ gap: '10px',
82
+ justifyContent: 'start',
83
+ },
84
+ '& .ActionCard-price': {
85
+ typography: typographySizes[size],
86
+ pr: theme.spacings.xs,
87
+ mb: { xs: 0.5, sm: 0 },
88
+ },
89
+ }),
90
+ ...(Array.isArray(sx) ? sx : [sx]),
91
+ ]}
92
+ image={
93
+ thumbnail?.url && (
94
+ <Image
95
+ layout='fill'
96
+ src={thumbnail?.url}
97
+ sx={{
98
+ width: productImageSizes[size],
99
+ height: productImageSizes[size],
100
+ display: 'block',
101
+ borderRadius: 1,
102
+ }}
103
+ sizes={productImageSizes[size]}
104
+ />
105
+ )
106
+ }
107
+ title={
108
+ url_key ? (
109
+ <Link
110
+ href={url_key}
111
+ underline='hover'
112
+ sx={{
113
+ color: 'inherit',
114
+ flexWrap: 'nowrap',
115
+ maxWidth: 'max-content',
116
+ }}
117
+ >
118
+ {name}
119
+ </Link>
120
+ ) : (
121
+ name
122
+ )
123
+ }
124
+ secondaryAction={
125
+ <>
126
+ <UpdateItemQuantity uid={uid} quantity={quantity} />
127
+ {' ⨉ '}
128
+ <Money value={price} currency={prices?.price.currency} />
129
+ </>
130
+ }
131
+ price={<Money {...(inclTaxes ? prices?.row_total_including_tax : prices?.row_total)} />}
132
+ action={
133
+ <RemoveItemFromCart
134
+ uid={uid}
135
+ quantity={quantity}
136
+ product={product}
137
+ buttonProps={{ size }}
138
+ />
139
+ }
140
+ size={size}
141
+ after={filterNonNullableKeys(errors).map((error) => (
142
+ <Box sx={{ color: 'error.main', typography: 'caption' }} key={error.message}>
143
+ {error.message}
144
+ </Box>
145
+ ))}
146
+ {...rest}
147
+ />
148
+ )
149
+ }
@@ -1,11 +1,12 @@
1
1
  import { RenderType, TypeRenderer } from '@graphcommerce/next-ui'
2
2
  import { Box } from '@mui/material'
3
- import { CartItemsFragment } from '../Api/CartItems.gql'
3
+ import { CartItemsFragment } from '../../Api/CartItems.gql'
4
4
 
5
5
  export type CartItemRenderer = TypeRenderer<NonNullable<NonNullable<CartItemsFragment['items']>[0]>>
6
6
 
7
7
  export type CartProps = { renderer: CartItemRenderer } & CartItemsFragment
8
8
 
9
+ /** @deprecated Replace with CartItemsActionCards */
9
10
  export function CartItems(props: CartProps) {
10
11
  const { renderer, items, id } = props
11
12
 
@@ -0,0 +1,63 @@
1
+ import { ActionCardLayout, ActionCardLayoutProps, nonNullable } from '@graphcommerce/next-ui'
2
+ import { Theme, useMediaQuery } from '@mui/material'
3
+ import { CartItemsFragment } from '../../Api/CartItems.gql'
4
+ import {
5
+ CartItemActionCard,
6
+ CartItemActionCardProps,
7
+ } from '../CartItemActionCard/CartItemActionCard'
8
+
9
+ export type CartProps = Omit<ActionCardLayoutProps, 'className'> & {
10
+ cart?: CartItemsFragment | null
11
+ sizeSm?: CartItemActionCardProps['size']
12
+ sizeMd?: CartItemActionCardProps['size']
13
+ variant?: CartItemActionCardProps['variant']
14
+ itemProps?: Omit<
15
+ CartItemActionCardProps,
16
+ | 'cartItem'
17
+ | 'layout'
18
+ | 'onClick'
19
+ | 'disabled'
20
+ | 'selected'
21
+ | 'reset'
22
+ | 'color'
23
+ | 'size'
24
+ | 'variant'
25
+ >
26
+ }
27
+
28
+ export function CartItemsActionCards(props: CartProps) {
29
+ const {
30
+ cart,
31
+ children,
32
+ layout = 'list',
33
+ itemProps = {},
34
+ sizeSm = 'medium',
35
+ sizeMd = 'large',
36
+ variant = 'default',
37
+ ...remainingProps
38
+ } = props
39
+
40
+ const isMobile = useMediaQuery<Theme>((theme) => theme.breakpoints.down('md'), {
41
+ defaultMatches: false,
42
+ })
43
+
44
+ const size = isMobile ? sizeSm : sizeMd
45
+
46
+ if (!cart?.items?.length) return null
47
+
48
+ return (
49
+ <ActionCardLayout layout={layout} {...remainingProps}>
50
+ {cart.items?.filter(nonNullable).map((item) => (
51
+ <CartItemActionCard
52
+ key={item.uid}
53
+ cartItem={item}
54
+ layout={layout}
55
+ size={size}
56
+ variant={variant}
57
+ {...itemProps}
58
+ />
59
+ ))}
60
+ {children}
61
+ </ActionCardLayout>
62
+ )
63
+ }
@@ -0,0 +1,36 @@
1
+ import { ApolloCartErrorSnackbar, useFormGqlMutationCart } from '@graphcommerce/magento-cart'
2
+ import { Button, ButtonProps } from '@graphcommerce/next-ui'
3
+ import { Trans } from '@lingui/react'
4
+ import { SxProps, Theme, styled } from '@mui/material'
5
+ import { CartItemFragment } from '../../Api/CartItem.gql'
6
+ import { RemoveItemFromCartDocument } from './RemoveItemFromCart.gql'
7
+
8
+ export type RemoveItemFromCartProps = Omit<CartItemFragment, '__typename'> & {
9
+ sx?: SxProps<Theme>
10
+ buttonProps?: Omit<ButtonProps, 'type' | 'loading'>
11
+ }
12
+
13
+ const Form = styled('form')({})
14
+
15
+ export function RemoveItemFromCart(props: RemoveItemFromCartProps) {
16
+ const { uid, quantity, prices, buttonProps, ...formProps } = props
17
+ const form = useFormGqlMutationCart(RemoveItemFromCartDocument, { defaultValues: { uid } })
18
+ const { handleSubmit, formState, error } = form
19
+ const submitHandler = handleSubmit(() => {})
20
+
21
+ return (
22
+ <Form noValidate onSubmit={submitHandler} {...formProps}>
23
+ <Button
24
+ variant='inline'
25
+ color='secondary'
26
+ {...buttonProps}
27
+ size='medium'
28
+ type='submit'
29
+ loading={formState.isSubmitting}
30
+ >
31
+ <Trans id='Remove' />
32
+ </Button>
33
+ <ApolloCartErrorSnackbar error={error} />
34
+ </Form>
35
+ )
36
+ }
@@ -1,23 +1,19 @@
1
1
  import { ApolloCartErrorSnackbar, useFormGqlMutationCart } from '@graphcommerce/magento-cart'
2
- import { iconClose, IconSvg } from '@graphcommerce/next-ui'
2
+ import { Fab, FabProps, iconClose } from '@graphcommerce/next-ui'
3
3
  import { i18n } from '@lingui/core'
4
- import { Fab, SxProps, Theme, styled } from '@mui/material'
5
- import { CartItemFragment } from '../Api/CartItem.gql'
4
+ import { SxProps, Theme, styled } from '@mui/material'
5
+ import { CartItemFragment } from '../../Api/CartItem.gql'
6
6
  import { RemoveItemFromCartDocument } from './RemoveItemFromCart.gql'
7
7
 
8
- export type RemoveItemFromCartProps = CartItemFragment &
9
- Omit<JSX.IntrinsicElements['form'], 'onSubmit' | 'noValidate'> & { sx?: SxProps<Theme> }
8
+ export type RemoveItemFromCartFabProps = Omit<CartItemFragment, '__typename'> & {
9
+ sx?: SxProps<Theme>
10
+ fabProps?: Omit<FabProps, 'type' | 'icon' | 'loading'>
11
+ }
10
12
 
11
13
  const Form = styled('form')({})
12
14
 
13
- export function RemoveItemFromCartFab(props: RemoveItemFromCartProps) {
14
- const {
15
- product: {},
16
- uid,
17
- quantity,
18
- prices,
19
- ...formProps
20
- } = props
15
+ export function RemoveItemFromCartFab(props: RemoveItemFromCartFabProps) {
16
+ const { uid, quantity, prices, product, ...formProps } = props
21
17
  const form = useFormGqlMutationCart(RemoveItemFromCartDocument, { defaultValues: { uid } })
22
18
  const { handleSubmit, formState, error } = form
23
19
  const submitHandler = handleSubmit(() => {})
@@ -29,9 +25,8 @@ export function RemoveItemFromCartFab(props: RemoveItemFromCartProps) {
29
25
  size='small'
30
26
  type='submit'
31
27
  disabled={formState.isSubmitting}
32
- >
33
- <IconSvg src={iconClose} />
34
- </Fab>
28
+ icon={iconClose}
29
+ />
35
30
  <ApolloCartErrorSnackbar error={error} />
36
31
  </Form>
37
32
  )
@@ -1,8 +1,7 @@
1
1
  import { Money } from '@graphcommerce/magento-store'
2
- import { filterNonNullableKeys, nonNullable } from '@graphcommerce/next-ui'
3
- import { Typography } from '@mui/material'
4
- import { CartItem_ConfigurableCartItem_Fragment } from '../../Api/CartItem.gql'
5
- import { ActionCartItemProps } from '../ActionCartItem/ActionCartItem'
2
+ import { IconSvg, filterNonNullableKeys, nonNullable } from '@graphcommerce/next-ui'
3
+ import * as InfoIcon from '@graphcommerce/next-ui/icons/info.svg'
4
+ import { Box, Tooltip, Typography } from '@mui/material'
6
5
  import { SelectedCustomizableOptionFragment } from './SelectedCustomizableOption.gql'
7
6
 
8
7
  type ConfigurableActionCartItemProps = {
@@ -19,17 +18,24 @@ export function SelectedCustomizableOptions(props: ConfigurableActionCartItemPro
19
18
  return (
20
19
  <>
21
20
  {options.map((option) => (
22
- <Typography variant='body2' component='div' key={option.customizable_option_uid}>
23
- <Typography variant='subtitle2' component='span'>
21
+ <Box
22
+ key={option.customizable_option_uid}
23
+ sx={(theme) => ({ display: 'flex', gap: theme.spacings.xxs })}
24
+ >
25
+ <Typography variant='subtitle2' component='span' sx={{ color: 'text.primary' }}>
24
26
  {option.label}
25
27
  </Typography>
26
28
  {option.values.filter(nonNullable).map((value) => (
27
- <span key={value.customizable_option_value_uid}>
28
- {value.price.value > 0 && <Money value={value.price.value} />} {value?.label}
29
- {value?.value}
30
- </span>
29
+ <>
30
+ <span key={value.customizable_option_value_uid}>
31
+ {value.price.value > 0 && <Money value={value.price.value} />} {value?.label}
32
+ </span>
33
+ <Tooltip title={value.value}>
34
+ <IconSvg src={InfoIcon} size='medium' />
35
+ </Tooltip>
36
+ </>
31
37
  ))}
32
- </Typography>
38
+ </Box>
33
39
  ))}
34
40
  </>
35
41
  )
@@ -34,8 +34,9 @@ export function UpdateItemQuantity(props: UpdateItemQuantityProps) {
34
34
  <form noValidate onSubmit={submit}>
35
35
  <TextInputNumber
36
36
  size='small'
37
- variant='outlined'
37
+ variant='standard'
38
38
  inputProps={{ min: 1 }}
39
+ InputProps={{ disableUnderline: true }}
39
40
  error={!!formState.errors.quantity}
40
41
  {...muiRegister('quantity', { required: required.quantity })}
41
42
  helperText={formState.errors.quantity?.message}
package/index.ts CHANGED
@@ -1,8 +1,10 @@
1
1
  export * from './Api/CartItem.gql'
2
2
  export * from './Api/CartItems.gql'
3
- export * from './CartItem/CartItem'
4
- export * from './CartItems/CartItems'
5
- export * from './components/ActionCartItem/ActionCartItem'
3
+ export * from './components/CartItem/CartItem'
4
+ export * from './components/CartItemsActionCards/CartItemsActionCards'
5
+ export * from './components/CartItemActionCard/CartItemActionCard'
6
6
  export * from './components/SelectedCustomizableOptions/SelectedCustomizableOptions'
7
- export * from './RemoveItemFromCart/RemoveItemFromCartFab'
8
- export * from './UpdateItemQuantity/UpdateItemQuantity'
7
+ export * from './components/RemoveItemFromCart/RemoveItemFromCart'
8
+ export * from './components/RemoveItemFromCart/RemoveItemFromCartFab'
9
+ export * from './components/RemoveItemFromCart/RemoveItemFromCart.gql'
10
+ export * from './components/UpdateItemQuantity/UpdateItemQuantity'
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-cart-items",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "7.0.0-canary.21",
5
+ "version": "7.0.0",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,23 +12,24 @@
12
12
  }
13
13
  },
14
14
  "devDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "7.0.0-canary.21",
16
- "@graphcommerce/prettier-config-pwa": "7.0.0-canary.21",
17
- "@graphcommerce/typescript-config-pwa": "7.0.0-canary.21"
15
+ "@graphcommerce/eslint-config-pwa": "7.0.0",
16
+ "@graphcommerce/prettier-config-pwa": "7.0.0",
17
+ "@graphcommerce/typescript-config-pwa": "7.0.0"
18
18
  },
19
19
  "dependencies": {
20
- "@graphcommerce/graphql": "7.0.0-canary.21",
21
- "@graphcommerce/image": "7.0.0-canary.21",
22
- "@graphcommerce/magento-cart": "7.0.0-canary.21",
23
- "@graphcommerce/magento-customer": "7.0.0-canary.21",
24
- "@graphcommerce/magento-product": "7.0.0-canary.21",
25
- "@graphcommerce/magento-store": "7.0.0-canary.21",
26
- "@graphcommerce/next-ui": "7.0.0-canary.21",
27
- "@graphcommerce/react-hook-form": "7.0.0-canary.21"
20
+ "@graphcommerce/graphql": "7.0.0",
21
+ "@graphcommerce/image": "7.0.0",
22
+ "@graphcommerce/magento-cart": "7.0.0",
23
+ "@graphcommerce/magento-customer": "7.0.0",
24
+ "@graphcommerce/magento-product": "7.0.0",
25
+ "@graphcommerce/magento-store": "7.0.0",
26
+ "@graphcommerce/next-ui": "7.0.0",
27
+ "@graphcommerce/react-hook-form": "7.0.0"
28
28
  },
29
29
  "peerDependencies": {
30
- "@lingui/react": "^3.13.2",
31
- "@lingui/core": "^3.13.2",
30
+ "@lingui/react": "^4.2.1",
31
+ "@lingui/core": "^4.2.1",
32
+ "@lingui/macro": "^4.2.1",
32
33
  "@mui/material": "^5.10.16",
33
34
  "framer-motion": "^10.0.0",
34
35
  "next": "^13.2.0",
@@ -1,5 +0,0 @@
1
- query CartItemsQuery($cartId: String!) {
2
- cart(cart_id: $cartId) {
3
- ...CartItems
4
- }
5
- }
@@ -1,57 +0,0 @@
1
- import { Image } from '@graphcommerce/image'
2
- import { Money } from '@graphcommerce/magento-store'
3
- import { ActionCard, ActionCardProps, responsiveVal } from '@graphcommerce/next-ui'
4
- import { CartItemFragment } from '../../Api/CartItem.gql'
5
- import { RemoveItemFromCartFab } from '../../RemoveItemFromCart/RemoveItemFromCartFab'
6
- import { UpdateItemQuantity } from '../../UpdateItemQuantity/UpdateItemQuantity'
7
-
8
- export type ActionCartItemProps = Omit<
9
- ActionCardProps,
10
- 'value' | 'image' | 'price' | 'title' | 'action'
11
- >
12
-
13
- export const productImageSizes = {
14
- small: responsiveVal(50, 60),
15
- medium: responsiveVal(60, 80),
16
- large: responsiveVal(80, 100),
17
- }
18
-
19
- export function ActionCartItem(props: CartItemFragment & ActionCartItemProps) {
20
- const { uid, quantity, prices, product, sx = [], details, size = 'medium', ...cardProps } = props
21
-
22
- return (
23
- <ActionCard
24
- {...cardProps}
25
- value={uid}
26
- size={size}
27
- sx={[{}, ...(Array.isArray(sx) ? sx : [sx])]}
28
- image={
29
- product.thumbnail?.url && (
30
- <Image
31
- src={product.thumbnail?.url}
32
- width={50}
33
- height={50}
34
- sx={{
35
- width: productImageSizes[size],
36
- height: productImageSizes[size],
37
- display: 'block',
38
- borderRadius: 1,
39
- }}
40
- sizes={productImageSizes[size]}
41
- />
42
- )
43
- }
44
- price={<Money {...prices?.row_total_including_tax} />}
45
- title={product.name}
46
- details={
47
- <>
48
- {details}
49
- <UpdateItemQuantity uid={uid} quantity={quantity} />
50
- </>
51
- }
52
- action={
53
- <RemoveItemFromCartFab uid={uid} quantity={quantity} prices={prices} product={product} />
54
- }
55
- />
56
- )
57
- }