@graphcommerce/magento-cart 8.0.6-canary.4 → 8.1.0-canary.11

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,24 @@
1
1
  # Change Log
2
2
 
3
+ ## 8.1.0-canary.11
4
+
5
+ ## 8.1.0-canary.10
6
+
7
+ ## 8.1.0-canary.9
8
+
9
+ ## 8.1.0-canary.8
10
+
11
+ ### Patch Changes
12
+
13
+ - [#2247](https://github.com/graphcommerce-org/graphcommerce/pull/2247) [`a56a7c6`](https://github.com/graphcommerce-org/graphcommerce/commit/a56a7c67cf27dfb91bf763a873beeec562ab3156) - Solve an issue where the cart would be sometimes undefined, but Partial was too eleborate
14
+ ([@paales](https://github.com/paales))
15
+
16
+ ## 8.1.0-canary.7
17
+
18
+ ## 8.1.0-canary.6
19
+
20
+ ## 8.1.0-canary.5
21
+
3
22
  ## 8.0.6-canary.4
4
23
 
5
24
  ## 8.0.6-canary.3
@@ -5,14 +5,15 @@ import { Box, Button, ButtonProps, SxProps, Theme } from '@mui/material'
5
5
  import React from 'react'
6
6
  import { CartStartCheckoutFragment } from './CartStartCheckout.gql'
7
7
 
8
- export type CartStartCheckoutProps = Partial<CartStartCheckoutFragment> & {
8
+ export type CartStartCheckoutProps = {
9
9
  children?: React.ReactNode
10
10
  sx?: SxProps<Theme>
11
11
  buttonProps?: ButtonProps<'button'>
12
12
  disabled?: boolean
13
+ cart?: CartStartCheckoutFragment | null | undefined
13
14
  onStart?: (
14
15
  e: React.MouseEvent<HTMLButtonElement>,
15
- cart: Partial<CartStartCheckoutFragment>,
16
+ cart: CartStartCheckoutFragment | null | undefined,
16
17
  ) => void
17
18
  }
18
19
 
@@ -32,11 +33,11 @@ export function CartStartCheckout(props: CartStartCheckoutProps) {
32
33
  buttonProps: { onClick, ...buttonProps } = {},
33
34
  disabled,
34
35
  sx = [],
35
- ...cart
36
+ cart,
36
37
  } = props
37
38
 
38
- const hasTotals = (cart.prices?.grand_total?.value ?? 0) > 0
39
- const hasErrors = cart.items?.some((item) => (item?.errors?.length ?? 0) > 0)
39
+ const hasTotals = (cart?.prices?.grand_total?.value ?? 0) > 0
40
+ const hasErrors = cart?.items?.some((item) => (item?.errors?.length ?? 0) > 0)
40
41
 
41
42
  return (
42
43
  <Box
@@ -74,7 +75,7 @@ export function CartStartCheckout(props: CartStartCheckoutProps) {
74
75
  </Box>{' '}
75
76
  {hasTotals && (
76
77
  <span className={classes.checkoutMoney}>
77
- <Money {...cart.prices?.grand_total} />
78
+ <Money {...cart?.prices?.grand_total} />
78
79
  </span>
79
80
  )}
80
81
  </Button>
@@ -4,13 +4,14 @@ import { SxProps, Theme } from '@mui/material'
4
4
  import React from 'react'
5
5
  import { CartStartCheckoutFragment } from './CartStartCheckout.gql'
6
6
 
7
- export type CartStartCheckoutLinkOrButtonProps = Partial<CartStartCheckoutFragment> & {
7
+ export type CartStartCheckoutLinkOrButtonProps = {
8
8
  children?: React.ReactNode
9
9
  sx?: SxProps<Theme>
10
10
  disabled?: boolean
11
+ cart?: CartStartCheckoutFragment | null | undefined
11
12
  onStart?: (
12
13
  e: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLSpanElement>,
13
- cart: Partial<CartStartCheckoutFragment>,
14
+ cart: CartStartCheckoutFragment | null | undefined,
14
15
  ) => void
15
16
  linkOrButtonProps?: LinkOrButtonProps
16
17
  }
@@ -21,11 +22,11 @@ export function CartStartCheckoutLinkOrButton(props: CartStartCheckoutLinkOrButt
21
22
  onStart,
22
23
  disabled,
23
24
  linkOrButtonProps: { onClick, button, ...linkOrButtonProps } = {},
24
- ...cart
25
+ cart,
25
26
  } = props
26
27
 
27
- const hasTotals = (cart.prices?.grand_total?.value ?? 0) > 0
28
- const hasErrors = cart.items?.some((item) => (item?.errors?.length ?? 0) > 0)
28
+ const hasTotals = (cart?.prices?.grand_total?.value ?? 0) > 0
29
+ const hasErrors = cart?.items?.some((item) => (item?.errors?.length ?? 0) > 0)
29
30
 
30
31
  return (
31
32
  <LinkOrButton
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-cart",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "8.0.6-canary.4",
5
+ "version": "8.1.0-canary.11",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,20 +12,20 @@
12
12
  }
13
13
  },
14
14
  "peerDependencies": {
15
- "@graphcommerce/ecommerce-ui": "^8.0.6-canary.4",
16
- "@graphcommerce/eslint-config-pwa": "^8.0.6-canary.4",
17
- "@graphcommerce/framer-next-pages": "^8.0.6-canary.4",
18
- "@graphcommerce/framer-scroller": "^8.0.6-canary.4",
19
- "@graphcommerce/framer-utils": "^8.0.6-canary.4",
20
- "@graphcommerce/graphql": "^8.0.6-canary.4",
21
- "@graphcommerce/image": "^8.0.6-canary.4",
22
- "@graphcommerce/magento-customer": "^8.0.6-canary.4",
23
- "@graphcommerce/magento-graphql": "^8.0.6-canary.4",
24
- "@graphcommerce/magento-store": "^8.0.6-canary.4",
25
- "@graphcommerce/next-ui": "^8.0.6-canary.4",
26
- "@graphcommerce/prettier-config-pwa": "^8.0.6-canary.4",
27
- "@graphcommerce/react-hook-form": "^8.0.6-canary.4",
28
- "@graphcommerce/typescript-config-pwa": "^8.0.6-canary.4",
15
+ "@graphcommerce/ecommerce-ui": "^8.1.0-canary.11",
16
+ "@graphcommerce/eslint-config-pwa": "^8.1.0-canary.11",
17
+ "@graphcommerce/framer-next-pages": "^8.1.0-canary.11",
18
+ "@graphcommerce/framer-scroller": "^8.1.0-canary.11",
19
+ "@graphcommerce/framer-utils": "^8.1.0-canary.11",
20
+ "@graphcommerce/graphql": "^8.1.0-canary.11",
21
+ "@graphcommerce/image": "^8.1.0-canary.11",
22
+ "@graphcommerce/magento-customer": "^8.1.0-canary.11",
23
+ "@graphcommerce/magento-graphql": "^8.1.0-canary.11",
24
+ "@graphcommerce/magento-store": "^8.1.0-canary.11",
25
+ "@graphcommerce/next-ui": "^8.1.0-canary.11",
26
+ "@graphcommerce/prettier-config-pwa": "^8.1.0-canary.11",
27
+ "@graphcommerce/react-hook-form": "^8.1.0-canary.11",
28
+ "@graphcommerce/typescript-config-pwa": "^8.1.0-canary.11",
29
29
  "@lingui/core": "^4.2.1",
30
30
  "@lingui/macro": "^4.2.1",
31
31
  "@lingui/react": "^4.2.1",
@@ -1,12 +1,14 @@
1
1
  import { GraphQLProviderProps } from '@graphcommerce/graphql'
2
- import type { PluginProps } from '@graphcommerce/next-config'
2
+ import type { PluginConfig, PluginProps } from '@graphcommerce/next-config'
3
3
  import { cartErrorLink } from '../link/createCartErrorLink'
4
4
  import { cartTypePolicies, migrateCart } from '../typePolicies'
5
5
 
6
- export const component = 'GraphQLProvider'
7
- export const exported = '@graphcommerce/graphql'
6
+ export const config: PluginConfig = {
7
+ type: 'component',
8
+ module: '@graphcommerce/graphql',
9
+ }
8
10
 
9
- function MagentoCartGraphqlProvider(props: PluginProps<GraphQLProviderProps>) {
11
+ export function GraphQLProvider(props: PluginProps<GraphQLProviderProps>) {
10
12
  const { Prev, links = [], policies = [], migrations = [], ...rest } = props
11
13
  return (
12
14
  <Prev
@@ -17,5 +19,3 @@ function MagentoCartGraphqlProvider(props: PluginProps<GraphQLProviderProps>) {
17
19
  />
18
20
  )
19
21
  }
20
-
21
- export const Plugin = MagentoCartGraphqlProvider
@@ -1,12 +1,12 @@
1
1
  import { useApolloClient } from '@graphcommerce/graphql'
2
- import type { useSignInForm } from '@graphcommerce/magento-customer/hooks/useSignInForm'
2
+ import type { useSignInForm } from '@graphcommerce/magento-customer'
3
3
  import type { MethodPlugin } from '@graphcommerce/next-config'
4
4
  import { cartLock, readCartId, useAssignCurrentCartId } from '../hooks'
5
5
  import { CustomerCartDocument } from '../hooks/CustomerCart.gql'
6
6
  import { MergeCartsDocument } from '../hooks/MergeCarts.gql'
7
7
 
8
8
  export const func = 'useSignInForm'
9
- export const exported = '@graphcommerce/magento-customer/hooks/useSignInForm'
9
+ export const exported = '@graphcommerce/magento-customer'
10
10
 
11
11
  const useSignInFormMergeCart: MethodPlugin<typeof useSignInForm> = (useSignInForm, options) => {
12
12
  const client = useApolloClient()