@graphcommerce/magento-cart-items 9.0.0-canary.99 → 9.0.1-canary.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +36 -965
- package/components/CartCrosssellsScroller/CartCrosssellsScroller.tsx +3 -7
- package/components/CartItem/CartItem.tsx +6 -5
- package/components/CartItemActionCard/CartItemActionCard.tsx +8 -8
- package/components/CartItemsActionCards/CartItemsActionCards.tsx +5 -14
- package/components/EditCartItem/EditCartItemButton/EditCartItemButton.tsx +2 -4
- package/components/EditCartItem/EditCartItemForm/EditCartItemForm.tsx +10 -14
- package/components/RemoveItemFromCart/RemoveItemFromCart.tsx +6 -6
- package/components/RemoveItemFromCart/RemoveItemFromCartFab.tsx +6 -6
- package/components/SelectedCustomizableOptions/SelectedCustomizableOptions.tsx +3 -3
- package/components/UpdateItemQuantity/UpdateItemQuantity.tsx +7 -5
- package/hooks/useRemoveItemFromCart.ts +4 -4
- package/package.json +16 -15
- package/utils/cartItemToCartItemInput.ts +5 -5
- package/components/CartItems/CartItems.tsx +0 -25
- package/components/SelectedCustomizableOptions/index.ts +0 -2
|
@@ -1,10 +1,6 @@
|
|
|
1
1
|
import { useCrosssellItems } from '@graphcommerce/magento-cart/components/CartAdded/useCrosssellItems'
|
|
2
|
-
import {
|
|
3
|
-
|
|
4
|
-
ProductListItemRenderer,
|
|
5
|
-
ProductScroller,
|
|
6
|
-
ProductScrollerProps,
|
|
7
|
-
} from '@graphcommerce/magento-product'
|
|
2
|
+
import type { ProductListItemRenderer, ProductScrollerProps } from '@graphcommerce/magento-product'
|
|
3
|
+
import { AddProductsToCartForm, ProductScroller } from '@graphcommerce/magento-product'
|
|
8
4
|
import { Trans } from '@lingui/macro'
|
|
9
5
|
|
|
10
6
|
export type CartItemCrosssellsProps = {
|
|
@@ -13,7 +9,7 @@ export type CartItemCrosssellsProps = {
|
|
|
13
9
|
|
|
14
10
|
export function CartCrosssellsScroller(props: CartItemCrosssellsProps) {
|
|
15
11
|
const { renderer, sx = [], title, titleProps } = props
|
|
16
|
-
const [
|
|
12
|
+
const [, crossSellItems] = useCrosssellItems()
|
|
17
13
|
|
|
18
14
|
const crossSellsHideCartItems = Boolean(import.meta.graphCommerce.crossSellsHideCartItems)
|
|
19
15
|
if (crossSellItems.length === 0 || crossSellsHideCartItems === true) return null
|
|
@@ -3,13 +3,14 @@ import { useDisplayInclTax } from '@graphcommerce/magento-cart'
|
|
|
3
3
|
import { useProductLink } from '@graphcommerce/magento-product'
|
|
4
4
|
import { Money } from '@graphcommerce/magento-store'
|
|
5
5
|
import {
|
|
6
|
-
|
|
6
|
+
NextLink,
|
|
7
7
|
extendableComponent,
|
|
8
8
|
filterNonNullableKeys,
|
|
9
|
-
|
|
9
|
+
responsiveVal,
|
|
10
10
|
} from '@graphcommerce/next-ui'
|
|
11
|
-
import {
|
|
12
|
-
import {
|
|
11
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
12
|
+
import { Badge, Box, Link } from '@mui/material'
|
|
13
|
+
import type { CartItemFragment } from '../../Api/CartItem.gql'
|
|
13
14
|
import { RemoveItemFromCartFab } from '../RemoveItemFromCart/RemoveItemFromCartFab'
|
|
14
15
|
import { UpdateItemQuantity } from '../UpdateItemQuantity/UpdateItemQuantity'
|
|
15
16
|
|
|
@@ -21,7 +22,7 @@ export type CartItemProps = CartItemFragment & {
|
|
|
21
22
|
} & OwnerState
|
|
22
23
|
|
|
23
24
|
type OwnerState = { withOptions?: boolean }
|
|
24
|
-
const compName = 'CartItem'
|
|
25
|
+
const compName = 'CartItem'
|
|
25
26
|
const parts = [
|
|
26
27
|
'item',
|
|
27
28
|
'picture',
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
import { Image } from '@graphcommerce/image'
|
|
2
2
|
import { useDisplayInclTax } from '@graphcommerce/magento-cart/hooks'
|
|
3
|
-
import { ProductLinkProps } from '@graphcommerce/magento-product'
|
|
3
|
+
import type { ProductLinkProps } from '@graphcommerce/magento-product'
|
|
4
4
|
import { Money } from '@graphcommerce/magento-store'
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
ActionCardProps,
|
|
8
|
-
filterNonNullableKeys,
|
|
9
|
-
actionCardImageSizes,
|
|
10
|
-
} from '@graphcommerce/next-ui'
|
|
5
|
+
import type { ActionCardProps } from '@graphcommerce/next-ui'
|
|
6
|
+
import { ActionCard, actionCardImageSizes, filterNonNullableKeys } from '@graphcommerce/next-ui'
|
|
11
7
|
import { Trans } from '@lingui/react'
|
|
12
8
|
import { Box, Button, Link } from '@mui/material'
|
|
13
|
-
import { CartItemFragment } from '../../Api/CartItem.gql'
|
|
9
|
+
import type { CartItemFragment } from '../../Api/CartItem.gql'
|
|
14
10
|
import { RemoveItemFromCart } from '../RemoveItemFromCart/RemoveItemFromCart'
|
|
15
11
|
import { UpdateItemQuantity } from '../UpdateItemQuantity/UpdateItemQuantity'
|
|
16
12
|
|
|
@@ -19,6 +15,10 @@ export type CartItemActionCardProps = { cartItem: CartItemFragment; readOnly?: b
|
|
|
19
15
|
'value' | 'image' | 'price' | 'title' | 'action'
|
|
20
16
|
>
|
|
21
17
|
|
|
18
|
+
/**
|
|
19
|
+
* @deprecated
|
|
20
|
+
* @public
|
|
21
|
+
*/
|
|
22
22
|
export function productEditLink(link: ProductLinkProps) {
|
|
23
23
|
return `/checkout/item/${link.url_key}`
|
|
24
24
|
}
|
|
@@ -1,20 +1,11 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
} from '../CartItemActionCard/CartItemActionCard'
|
|
1
|
+
import type { ActionCardLayoutProps } from '@graphcommerce/next-ui'
|
|
2
|
+
import { ActionCardLayout, nonNullable } from '@graphcommerce/next-ui'
|
|
3
|
+
import type { CartItemsFragment } from '../../Api/CartItems.gql'
|
|
4
|
+
import type { CartItemActionCardProps } from '../CartItemActionCard/CartItemActionCard'
|
|
5
|
+
import { CartItemActionCard } from '../CartItemActionCard/CartItemActionCard'
|
|
7
6
|
|
|
8
7
|
export type CartProps = Omit<ActionCardLayoutProps, 'className'> & {
|
|
9
8
|
cart?: CartItemsFragment | null
|
|
10
|
-
/**
|
|
11
|
-
* @deprecated Not used anymore, please use the size prop
|
|
12
|
-
*/
|
|
13
|
-
sizeSm?: CartItemActionCardProps['size']
|
|
14
|
-
/**
|
|
15
|
-
* @deprecated Not used anymore, please use the size prop
|
|
16
|
-
*/
|
|
17
|
-
sizeMd?: CartItemActionCardProps['size']
|
|
18
9
|
variant?: CartItemActionCardProps['variant']
|
|
19
10
|
itemProps?: Omit<
|
|
20
11
|
CartItemActionCardProps,
|
|
@@ -1,7 +1,5 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
AddProductsToCartButtonProps,
|
|
4
|
-
} from '@graphcommerce/magento-product'
|
|
1
|
+
import type { AddProductsToCartButtonProps } from '@graphcommerce/magento-product'
|
|
2
|
+
import { AddProductsToCartButton } from '@graphcommerce/magento-product'
|
|
5
3
|
import { Trans } from '@lingui/react'
|
|
6
4
|
|
|
7
5
|
export function EditCartItemButton(props: AddProductsToCartButtonProps) {
|
|
@@ -1,23 +1,19 @@
|
|
|
1
|
-
import { UseHistoryLink
|
|
2
|
-
import {
|
|
3
|
-
|
|
1
|
+
import type { UseHistoryLink } from '@graphcommerce/framer-next-pages'
|
|
2
|
+
import { useHistoryGo } from '@graphcommerce/framer-next-pages'
|
|
3
|
+
import type {
|
|
4
4
|
AddProductsToCartFormProps,
|
|
5
5
|
AddToCartItemSelector,
|
|
6
|
-
AddProductsToCartForm,
|
|
7
6
|
} from '@graphcommerce/magento-product'
|
|
7
|
+
import { AddProductsToCartForm, useFormAddProductsToCart } from '@graphcommerce/magento-product'
|
|
8
8
|
import { useRouter } from 'next/router'
|
|
9
9
|
import { useEffect, useRef } from 'react'
|
|
10
|
-
import { CartItemsFragment } from '../../../Api/CartItems.gql'
|
|
11
|
-
import {
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
} from '../../../
|
|
15
|
-
import {
|
|
16
|
-
CartItemToCartItemInputProps,
|
|
17
|
-
cartItemToCartItemInput,
|
|
18
|
-
} from '../../../utils/cartItemToCartItemInput'
|
|
10
|
+
import type { CartItemsFragment } from '../../../Api/CartItems.gql'
|
|
11
|
+
import type { UseRemoveItemFromCartProps } from '../../../hooks/useRemoveItemFromCart'
|
|
12
|
+
import { useRemoveItemFromCart } from '../../../hooks/useRemoveItemFromCart'
|
|
13
|
+
import type { CartItemToCartItemInputProps } from '../../../utils/cartItemToCartItemInput'
|
|
14
|
+
import { cartItemToCartItemInput } from '../../../utils/cartItemToCartItemInput'
|
|
19
15
|
|
|
20
|
-
type EditInitProps = CartItemToCartItemInputProps & AddToCartItemSelector
|
|
16
|
+
export type EditInitProps = CartItemToCartItemInputProps & AddToCartItemSelector
|
|
21
17
|
|
|
22
18
|
function EditInit(props: EditInitProps) {
|
|
23
19
|
const { product, selectors, cartItem, index = 0 } = props
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ApolloCartErrorSnackbar } from '@graphcommerce/magento-cart'
|
|
2
|
-
import {
|
|
2
|
+
import type { ButtonProps } from '@graphcommerce/next-ui'
|
|
3
|
+
import { Button } from '@graphcommerce/next-ui'
|
|
3
4
|
import { Trans } from '@lingui/react'
|
|
4
|
-
import { SxProps, Theme
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from '../../hooks/useRemoveItemFromCart'
|
|
5
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
6
|
+
import { styled } from '@mui/material'
|
|
7
|
+
import type { UseRemoveItemFromCartProps } from '../../hooks/useRemoveItemFromCart'
|
|
8
|
+
import { useRemoveItemFromCart } from '../../hooks/useRemoveItemFromCart'
|
|
9
9
|
|
|
10
10
|
export type RemoveItemFromCartProps = UseRemoveItemFromCartProps & {
|
|
11
11
|
sx?: SxProps<Theme>
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
import { ApolloCartErrorSnackbar } from '@graphcommerce/magento-cart'
|
|
2
|
-
import {
|
|
2
|
+
import type { FabProps } from '@graphcommerce/next-ui'
|
|
3
|
+
import { Fab, iconClose } from '@graphcommerce/next-ui'
|
|
3
4
|
import { i18n } from '@lingui/core'
|
|
4
|
-
import { SxProps, Theme
|
|
5
|
-
import {
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
} from '../../hooks/useRemoveItemFromCart'
|
|
5
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
6
|
+
import { styled } from '@mui/material'
|
|
7
|
+
import type { UseRemoveItemFromCartProps } from '../../hooks/useRemoveItemFromCart'
|
|
8
|
+
import { useRemoveItemFromCart } from '../../hooks/useRemoveItemFromCart'
|
|
9
9
|
|
|
10
10
|
export type RemoveItemFromCartFabProps = UseRemoveItemFromCartProps & {
|
|
11
11
|
sx?: SxProps<Theme>
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import { Money } from '@graphcommerce/magento-store'
|
|
2
2
|
import { filterNonNullableKeys, nonNullable } from '@graphcommerce/next-ui'
|
|
3
3
|
import { Box } from '@mui/material'
|
|
4
|
-
import { CartItemFragment } from '../../Api/CartItem.gql'
|
|
5
|
-
import { SelectedCustomizableOptionFragment } from './SelectedCustomizableOption.gql'
|
|
4
|
+
import type { CartItemFragment } from '../../Api/CartItem.gql'
|
|
5
|
+
import type { SelectedCustomizableOptionFragment } from './SelectedCustomizableOption.gql'
|
|
6
6
|
|
|
7
|
-
type SelectedCustomizableOptionProps = CartItemFragment & {
|
|
7
|
+
export type SelectedCustomizableOptionProps = CartItemFragment & {
|
|
8
8
|
customizable_options?: (SelectedCustomizableOptionFragment | null | undefined)[] | null
|
|
9
9
|
}
|
|
10
10
|
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type { NumberFieldElementProps } from '@graphcommerce/ecommerce-ui'
|
|
2
|
+
import { NumberFieldElement } from '@graphcommerce/ecommerce-ui'
|
|
2
3
|
import { ApolloCartErrorSnackbar, useFormGqlMutationCart } from '@graphcommerce/magento-cart'
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
4
|
+
import type { UseFormGraphQlOptions } from '@graphcommerce/react-hook-form'
|
|
5
|
+
import { FormAutoSubmit } from '@graphcommerce/react-hook-form'
|
|
6
|
+
import type { SxProps, Theme } from '@mui/material'
|
|
5
7
|
import React from 'react'
|
|
6
|
-
import {
|
|
7
|
-
UpdateItemQuantityDocument,
|
|
8
|
+
import type {
|
|
8
9
|
UpdateItemQuantityMutation,
|
|
9
10
|
UpdateItemQuantityMutationVariables,
|
|
10
11
|
} from './UpdateItemQuantity.gql'
|
|
12
|
+
import { UpdateItemQuantityDocument } from './UpdateItemQuantity.gql'
|
|
11
13
|
|
|
12
14
|
type UpdateItemQuantityFormReturn = UseFormGraphQlOptions<
|
|
13
15
|
UpdateItemQuantityMutation,
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { useFormGqlMutationCart } from '@graphcommerce/magento-cart/hooks'
|
|
2
|
-
import { UseFormGraphQlOptions } from '@graphcommerce/react-hook-form'
|
|
2
|
+
import type { UseFormGraphQlOptions } from '@graphcommerce/react-hook-form'
|
|
3
3
|
import type { DistributedOmit } from 'type-fest'
|
|
4
|
-
import { CartItemFragment } from '../Api/CartItem.gql'
|
|
5
|
-
import {
|
|
4
|
+
import type { CartItemFragment } from '../Api/CartItem.gql'
|
|
5
|
+
import type {
|
|
6
6
|
RemoveItemFromCartMutation,
|
|
7
7
|
RemoveItemFromCartMutationVariables,
|
|
8
|
-
RemoveItemFromCartDocument,
|
|
9
8
|
} from '../components/RemoveItemFromCart/RemoveItemFromCart.gql'
|
|
9
|
+
import { RemoveItemFromCartDocument } from '../components/RemoveItemFromCart/RemoveItemFromCart.gql'
|
|
10
10
|
|
|
11
11
|
export type UseRemoveItemFromCartProps = DistributedOmit<CartItemFragment, '__typename'> &
|
|
12
12
|
Omit<
|
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": "9.0.
|
|
5
|
+
"version": "9.0.1-canary.0",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,28 +12,29 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"peerDependencies": {
|
|
15
|
-
"@graphcommerce/
|
|
16
|
-
"@graphcommerce/
|
|
17
|
-
"@graphcommerce/
|
|
18
|
-
"@graphcommerce/
|
|
19
|
-
"@graphcommerce/
|
|
20
|
-
"@graphcommerce/magento-
|
|
21
|
-
"@graphcommerce/magento-
|
|
22
|
-
"@graphcommerce/magento-
|
|
23
|
-
"@graphcommerce/
|
|
24
|
-
"@graphcommerce/
|
|
25
|
-
"@graphcommerce/
|
|
26
|
-
"@graphcommerce/
|
|
15
|
+
"@graphcommerce/ecommerce-ui": "^9.0.1-canary.0",
|
|
16
|
+
"@graphcommerce/eslint-config-pwa": "^9.0.1-canary.0",
|
|
17
|
+
"@graphcommerce/framer-next-pages": "^9.0.1-canary.0",
|
|
18
|
+
"@graphcommerce/graphql": "^9.0.1-canary.0",
|
|
19
|
+
"@graphcommerce/image": "^9.0.1-canary.0",
|
|
20
|
+
"@graphcommerce/magento-cart": "^9.0.1-canary.0",
|
|
21
|
+
"@graphcommerce/magento-customer": "^9.0.1-canary.0",
|
|
22
|
+
"@graphcommerce/magento-product": "^9.0.1-canary.0",
|
|
23
|
+
"@graphcommerce/magento-store": "^9.0.1-canary.0",
|
|
24
|
+
"@graphcommerce/next-ui": "^9.0.1-canary.0",
|
|
25
|
+
"@graphcommerce/prettier-config-pwa": "^9.0.1-canary.0",
|
|
26
|
+
"@graphcommerce/react-hook-form": "^9.0.1-canary.0",
|
|
27
|
+
"@graphcommerce/typescript-config-pwa": "^9.0.1-canary.0",
|
|
27
28
|
"@lingui/core": "^4.2.1",
|
|
28
29
|
"@lingui/macro": "^4.2.1",
|
|
29
30
|
"@lingui/react": "^4.2.1",
|
|
30
31
|
"@mui/material": "^5.10.16",
|
|
31
|
-
"framer-motion": "^
|
|
32
|
+
"framer-motion": "^11.0.0",
|
|
32
33
|
"next": "*",
|
|
33
34
|
"react": "^18.2.0",
|
|
34
35
|
"react-dom": "^18.2.0"
|
|
35
36
|
},
|
|
36
37
|
"devDependencies": {
|
|
37
|
-
"type-fest": "^4.
|
|
38
|
+
"type-fest": "^4.30.1"
|
|
38
39
|
}
|
|
39
40
|
}
|
|
@@ -1,14 +1,14 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import type {
|
|
2
2
|
AddProductsToCartFields,
|
|
3
3
|
AnyOption,
|
|
4
4
|
CustomizableProductOptionBase,
|
|
5
5
|
OptionValueSelector,
|
|
6
6
|
SelectorsProp,
|
|
7
|
-
productCustomizableSelectors,
|
|
8
7
|
} from '@graphcommerce/magento-product'
|
|
9
|
-
import {
|
|
10
|
-
import {
|
|
11
|
-
import {
|
|
8
|
+
import { productCustomizableSelectors } from '@graphcommerce/magento-product'
|
|
9
|
+
import { filterNonNullableKeys, isTypename, nonNullable } from '@graphcommerce/next-ui'
|
|
10
|
+
import type { CartItemFragment } from '../Api/CartItem.gql'
|
|
11
|
+
import type { EditCartItemFormFragment } from '../components/EditCartItem/EditCartItemForm/EditCartItemForm.gql'
|
|
12
12
|
|
|
13
13
|
type CartItemInput = AddProductsToCartFields['cartItems'][number]
|
|
14
14
|
|
|
@@ -1,25 +0,0 @@
|
|
|
1
|
-
import { RenderType, TypeRenderer } from '@graphcommerce/next-ui'
|
|
2
|
-
import { Box } from '@mui/material'
|
|
3
|
-
import { CartItemsFragment } from '../../Api/CartItems.gql'
|
|
4
|
-
|
|
5
|
-
export type CartItemRenderer = TypeRenderer<NonNullable<NonNullable<CartItemsFragment['items']>[0]>>
|
|
6
|
-
|
|
7
|
-
export type CartProps = { renderer: CartItemRenderer } & CartItemsFragment
|
|
8
|
-
|
|
9
|
-
/** @deprecated Replace with CartItemsActionCards */
|
|
10
|
-
export function CartItems(props: CartProps) {
|
|
11
|
-
const { renderer, items, id } = props
|
|
12
|
-
|
|
13
|
-
return (
|
|
14
|
-
<>
|
|
15
|
-
{items?.map((item) => {
|
|
16
|
-
if (!item?.uid || !id) return null
|
|
17
|
-
return (
|
|
18
|
-
<Box key={item.uid}>
|
|
19
|
-
<RenderType renderer={renderer} {...item} />
|
|
20
|
-
</Box>
|
|
21
|
-
)
|
|
22
|
-
})}
|
|
23
|
-
</>
|
|
24
|
-
)
|
|
25
|
-
}
|