@graphcommerce/magento-product 9.0.0-canary.80 → 9.0.0-canary.82

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 CHANGED
@@ -1,5 +1,9 @@
1
1
  # Change Log
2
2
 
3
+ ## 9.0.0-canary.82
4
+
5
+ ## 9.0.0-canary.81
6
+
3
7
  ## 9.0.0-canary.80
4
8
 
5
9
  ### Minor Changes
@@ -1,3 +1,4 @@
1
+ import { useCartEnabled } from '@graphcommerce/magento-cart'
1
2
  import { Button, ButtonProps } from '@graphcommerce/next-ui'
2
3
  import { Trans } from '@lingui/macro'
3
4
  import {
@@ -21,11 +22,22 @@ export type AddProductsToCartButtonProps = UseAddProductsToCartActionProps &
21
22
  >
22
23
 
23
24
  export function AddProductsToCartButton(props: AddProductsToCartButtonProps) {
24
- const { children, product, ...rest } = props
25
+ const { children, product, disabled, ...rest } = props
25
26
  const { showSuccess, ...action } = useAddProductsToCartAction(props)
27
+ const cartEnabled = useCartEnabled()
28
+
29
+ if (!cartEnabled) return null
26
30
 
27
31
  return (
28
- <Button type='submit' color='primary' variant='pill' size='large' {...rest} {...action}>
32
+ <Button
33
+ type='submit'
34
+ color='primary'
35
+ variant='pill'
36
+ size='large'
37
+ {...rest}
38
+ {...action}
39
+ disabled={disabled}
40
+ >
29
41
  {children || <Trans>Add to Cart</Trans>}
30
42
  </Button>
31
43
  )
@@ -1,3 +1,4 @@
1
+ import { useCartEnabled } from '@graphcommerce/magento-cart'
1
2
  import { Fab, FabProps, iconShoppingBag, iconCheckmark } from '@graphcommerce/next-ui'
2
3
  import { t } from '@lingui/macro'
3
4
  import { SxProps, Theme } from '@mui/material'
@@ -16,6 +17,10 @@ export function AddProductsToCartFab(props: AddProductsToCartFabProps) {
16
17
  const { icon = iconShoppingBag, product, sku, ...rest } = props
17
18
  const { showSuccess, ...action } = useAddProductsToCartAction(props)
18
19
 
20
+ const cartEnabled = useCartEnabled()
21
+
22
+ if (!cartEnabled) return null
23
+
19
24
  return (
20
25
  <Fab
21
26
  type='submit'
@@ -35,7 +35,7 @@ export function AddProductsToCartSnackbar(props: AddProductsToCartSnackbarProps)
35
35
 
36
36
  return (
37
37
  <AddProductsToCartSnackbarMessage
38
- error={error}
38
+ error={!formState.isSubmitting ? error : undefined}
39
39
  showSuccess={showSuccess}
40
40
  userErrors={data?.addProductsToCart?.user_errors.filter(nonNullable)}
41
41
  addedItems={addedItems.map((item) => item.itemInCart?.product.name).filter(nonNullable)}
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": "9.0.0-canary.80",
5
+ "version": "9.0.0-canary.82",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -18,18 +18,18 @@
18
18
  "typescript": "5.5.3"
19
19
  },
20
20
  "peerDependencies": {
21
- "@graphcommerce/ecommerce-ui": "^9.0.0-canary.80",
22
- "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.80",
23
- "@graphcommerce/framer-next-pages": "^9.0.0-canary.80",
24
- "@graphcommerce/framer-scroller": "^9.0.0-canary.80",
25
- "@graphcommerce/graphql": "^9.0.0-canary.80",
26
- "@graphcommerce/graphql-mesh": "^9.0.0-canary.80",
27
- "@graphcommerce/image": "^9.0.0-canary.80",
28
- "@graphcommerce/magento-cart": "^9.0.0-canary.80",
29
- "@graphcommerce/magento-store": "^9.0.0-canary.80",
30
- "@graphcommerce/next-ui": "^9.0.0-canary.80",
31
- "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.80",
32
- "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.80",
21
+ "@graphcommerce/ecommerce-ui": "^9.0.0-canary.82",
22
+ "@graphcommerce/eslint-config-pwa": "^9.0.0-canary.82",
23
+ "@graphcommerce/framer-next-pages": "^9.0.0-canary.82",
24
+ "@graphcommerce/framer-scroller": "^9.0.0-canary.82",
25
+ "@graphcommerce/graphql": "^9.0.0-canary.82",
26
+ "@graphcommerce/graphql-mesh": "^9.0.0-canary.82",
27
+ "@graphcommerce/image": "^9.0.0-canary.82",
28
+ "@graphcommerce/magento-cart": "^9.0.0-canary.82",
29
+ "@graphcommerce/magento-store": "^9.0.0-canary.82",
30
+ "@graphcommerce/next-ui": "^9.0.0-canary.82",
31
+ "@graphcommerce/prettier-config-pwa": "^9.0.0-canary.82",
32
+ "@graphcommerce/typescript-config-pwa": "^9.0.0-canary.82",
33
33
  "@lingui/core": "^4.2.1",
34
34
  "@lingui/macro": "^4.2.1",
35
35
  "@lingui/react": "^4.2.1",