@graphcommerce/magento-cart 10.0.0-canary.66 → 10.0.0-canary.68

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,19 @@
1
1
  # Change Log
2
2
 
3
+ ## 10.0.0-canary.68
4
+
5
+ ### Major Changes
6
+
7
+ - [#2557](https://github.com/graphcommerce-org/graphcommerce/pull/2557) [`ceaadd8`](https://github.com/graphcommerce-org/graphcommerce/commit/ceaadd87f0648982a068a3b07b1fa149c9127f49) - ## Material UI v5 → v7 Migration
8
+
9
+ This release upgrades Material UI from v5 to v7 with full CSS variables support. ([@paales](https://github.com/paales))
10
+
11
+ ## 10.0.0-canary.67
12
+
13
+ ### Patch Changes
14
+
15
+ - [#2540](https://github.com/graphcommerce-org/graphcommerce/pull/2540) [`36e2bac`](https://github.com/graphcommerce-org/graphcommerce/commit/36e2bacb4fe765ce1fcd24dc36736e90bb17a7dc) - Add billingAddress permission (EDITABLE | READONLY) that controls whether the end user can update their billing address in the account section and checkout. ([@Giovanni-Schroevers](https://github.com/Giovanni-Schroevers))
16
+
3
17
  ## 10.0.0-canary.66
4
18
 
5
19
  ## 10.0.0-canary.65
@@ -1,6 +1,6 @@
1
1
  import { CheckboxElement } from '@graphcommerce/ecommerce-ui'
2
2
  import { useQuery } from '@graphcommerce/graphql'
3
- import { extendableComponent, FormDiv } from '@graphcommerce/next-ui'
3
+ import { extendableComponent, FormDiv, sxx } from '@graphcommerce/next-ui'
4
4
  import type { UseFormComposeOptions } from '@graphcommerce/react-hook-form'
5
5
  import { FormPersist, useForm, useFormCompose } from '@graphcommerce/react-hook-form'
6
6
  import { t } from '@lingui/core/macro'
@@ -50,10 +50,7 @@ export function CartAgreementsForm(props: CartAgreementsFormProps) {
50
50
  if (data?.checkoutAgreements?.length === 0) return null
51
51
 
52
52
  return (
53
- <FormDiv
54
- className={classes.form}
55
- sx={[(theme) => ({ pt: theme.spacings.md }), ...(Array.isArray(sx) ? sx : [sx])]}
56
- >
53
+ <FormDiv className={classes.form} sx={sxx((theme) => ({ pt: theme.spacings.md }), sx)}>
57
54
  <form noValidate onSubmit={submit} name='cartAgreements'>
58
55
  <Box className={classes.formInner} sx={{ typography: 'body1', display: 'inline-block' }}>
59
56
  {data?.checkoutAgreements &&
@@ -64,7 +61,6 @@ export function CartAgreementsForm(props: CartAgreementsFormProps) {
64
61
  // check if the agreement text contains an anchor tag
65
62
  const containsLink = containsAnchorTag(agreement.checkbox_text)
66
63
  let labelContent: React.ReactNode
67
-
68
64
  if (containsLink) {
69
65
  labelContent = (
70
66
  <Typography
@@ -3,12 +3,13 @@ import {
3
3
  extendableComponent,
4
4
  iconShoppingBag,
5
5
  IconSvg,
6
+ sxx,
6
7
  useFabSize,
7
8
  useScrollY,
8
9
  } from '@graphcommerce/next-ui'
9
10
  import { t } from '@lingui/core/macro'
10
11
  import type { BadgeProps, FabProps, SxProps, Theme } from '@mui/material'
11
- import { alpha, Box, Fab, styled, useTheme } from '@mui/material'
12
+ import { Box, Fab, styled, useTheme } from '@mui/material'
12
13
  import { m, useTransform } from 'framer-motion'
13
14
  import React from 'react'
14
15
  import { useCartEnabled, useCartShouldLoginToContinue } from '../../hooks'
@@ -42,8 +43,8 @@ function CartFabContent(props: CartFabContentProps) {
42
43
  const scrollY = useScrollY()
43
44
  const opacity = useTransform(scrollY, [50, 60], [0, 1])
44
45
 
45
- const paper0 = alpha(theme2.palette.background.paper, 0)
46
- const paper1 = alpha(theme2.palette.background.paper, 1)
46
+ const paper0 = theme2.alpha(theme2.palette.background.paper, 0)
47
+ const paper1 = theme2.alpha(theme2.palette.background.paper, 1)
47
48
  const backgroundColor = useTransform(scrollY, [0, 10], [paper0, paper1])
48
49
 
49
50
  const cartIcon = icon ?? <IconSvg src={iconShoppingBag} size='large' />
@@ -52,10 +53,7 @@ function CartFabContent(props: CartFabContentProps) {
52
53
  return (
53
54
  <Box
54
55
  className={classes.root}
55
- sx={[
56
- { position: 'relative', width: fabIconSize, height: fabIconSize },
57
- ...(Array.isArray(sx) ? sx : [sx]),
58
- ]}
56
+ sx={sxx({ position: 'relative', width: fabIconSize, height: fabIconSize }, sx)}
59
57
  >
60
58
  <MotionFab
61
59
  href='/cart'
@@ -66,7 +64,7 @@ function CartFabContent(props: CartFabContentProps) {
66
64
  style={{ backgroundColor }}
67
65
  sx={(theme) => ({
68
66
  [theme.breakpoints.down('md')]: {
69
- backgroundColor: `${theme.palette.background.paper} !important`,
67
+ backgroundColor: `${theme.vars.palette.background.paper} !important`,
70
68
  },
71
69
  })}
72
70
  {...fabProps}
@@ -7,6 +7,7 @@ import {
7
7
  extendableComponent,
8
8
  nonNullable,
9
9
  SectionContainer,
10
+ sxx,
10
11
  } from '@graphcommerce/next-ui'
11
12
  import { Trans } from '@lingui/react/macro'
12
13
  import type { SxProps, Theme } from '@mui/material'
@@ -38,10 +39,10 @@ export function CartItemSummary(props: OrderSummaryProps) {
38
39
  return (
39
40
  <Box
40
41
  className={classes.root}
41
- sx={[
42
+ sx={sxx(
42
43
  (theme) => ({
43
44
  padding: `${theme.spacings.sm} ${theme.spacings.sm}`,
44
- border: `1px ${theme.palette.divider} solid`,
45
+ border: `1px ${theme.vars.palette.divider} solid`,
45
46
  ...breakpointVal(
46
47
  'borderRadius',
47
48
  theme.shape.borderRadius * 2,
@@ -49,8 +50,8 @@ export function CartItemSummary(props: OrderSummaryProps) {
49
50
  theme.breakpoints.values,
50
51
  ),
51
52
  }),
52
- ...(Array.isArray(sx) ? sx : [sx]),
53
- ]}
53
+ sx,
54
+ )}
54
55
  >
55
56
  <SectionContainer
56
57
  sx={{ '& .SectionHeader-root': { mt: 0 } }}
@@ -1,6 +1,6 @@
1
1
  import { Money } from '@graphcommerce/magento-store'
2
2
  import type { ButtonProps } from '@graphcommerce/next-ui'
3
- import { Button, extendableComponent, iconChevronRight, IconSvg } from '@graphcommerce/next-ui'
3
+ import { Button, extendableComponent, iconChevronRight, IconSvg, sxx } from '@graphcommerce/next-ui'
4
4
  import { Trans } from '@lingui/react/macro'
5
5
  import type { SxProps, Theme } from '@mui/material'
6
6
  import { Box, Link } from '@mui/material'
@@ -49,13 +49,13 @@ export function CartStartCheckout(props: CartStartCheckoutProps) {
49
49
  return (
50
50
  <Box
51
51
  className={classes.checkoutButtonContainer}
52
- sx={[
52
+ sx={sxx(
53
53
  (theme) => ({
54
54
  textAlign: 'center',
55
55
  my: theme.spacings.md,
56
56
  }),
57
- ...(Array.isArray(sx) ? sx : [sx]),
58
- ]}
57
+ sx,
58
+ )}
59
59
  >
60
60
  {shouldLoginToContinue && (
61
61
  <Box sx={{ mb: 1 }} className={classes.loginContainer}>
@@ -1,8 +1,9 @@
1
1
  import { useHistoryLink } from '@graphcommerce/framer-next-pages'
2
- import { breakpointVal, extendableComponent, SectionContainer } from '@graphcommerce/next-ui'
2
+ import { useBillingAddressPermission } from '@graphcommerce/magento-customer'
3
+ import { breakpointVal, extendableComponent, SectionContainer, sxx } from '@graphcommerce/next-ui'
3
4
  import { Trans } from '@lingui/react/macro'
4
5
  import type { SxProps, Theme } from '@mui/material'
5
- import { Box, lighten, Link, Typography } from '@mui/material'
6
+ import { Box, Link, Typography } from '@mui/material'
6
7
  import React from 'react'
7
8
  import { useCartQuery } from '../../hooks'
8
9
  import { CartAddressMultiLine } from '../CartAddressMultiLine/CartAddressMultiLine'
@@ -27,6 +28,8 @@ export function CartSummary(props: CartSummaryProps) {
27
28
  href: '/checkout',
28
29
  })
29
30
 
31
+ const billingAddressReadonly = useBillingAddressPermission() === 'READONLY'
32
+
30
33
  if (!data?.cart) return null
31
34
 
32
35
  const { email, shipping_addresses, billing_address, is_virtual } = data.cart
@@ -34,7 +37,7 @@ export function CartSummary(props: CartSummaryProps) {
34
37
  return (
35
38
  <Box
36
39
  className={classes.root}
37
- sx={[
40
+ sx={sxx(
38
41
  (theme) => ({
39
42
  margin: `${theme.spacings.sm} 0`,
40
43
  '& > div:last-of-type': {
@@ -53,8 +56,8 @@ export function CartSummary(props: CartSummaryProps) {
53
56
  ),
54
57
  },
55
58
  }),
56
- ...(Array.isArray(sx) ? sx : [sx]),
57
- ]}
59
+ sx,
60
+ )}
58
61
  >
59
62
  <Box
60
63
  className={classes.detailsContainer}
@@ -71,10 +74,7 @@ export function CartSummary(props: CartSummaryProps) {
71
74
  theme.shape.borderRadius * 3,
72
75
  theme.breakpoints.values,
73
76
  ),
74
- background:
75
- theme.palette.mode === 'light'
76
- ? theme.palette.background.default
77
- : lighten(theme.palette.background.default, 0.15),
77
+ background: theme.lighten(theme.vars.palette.background.default, 0.15),
78
78
  padding: theme.spacings.sm,
79
79
  gridColumnGap: theme.spacings.xxl,
80
80
  gridRowGap: theme.spacings.sm,
@@ -83,6 +83,9 @@ export function CartSummary(props: CartSummaryProps) {
83
83
  gridTemplateColumns: '1fr 1fr',
84
84
  marginTop: theme.spacings.xxs,
85
85
  },
86
+ ...theme.applyStyles('light', {
87
+ background: theme.vars.palette.background.default,
88
+ }),
86
89
  })}
87
90
  >
88
91
  <Box>
@@ -137,7 +140,7 @@ export function CartSummary(props: CartSummaryProps) {
137
140
  labelLeft={<Trans>Billing address</Trans>}
138
141
  sx={{ '& .SectionHeader-root': { marginTop: 0, paddingBottom: '8px' } }}
139
142
  labelRight={
140
- editable ? (
143
+ editable && !billingAddressReadonly ? (
141
144
  <Link
142
145
  href='/checkout/edit/billing-address'
143
146
  color='secondary'
@@ -3,7 +3,7 @@ import { magentoVersion } from '@graphcommerce/next-config/config'
3
3
  import { breakpointVal, extendableComponent, sxx } from '@graphcommerce/next-ui'
4
4
  import { Trans } from '@lingui/react/macro'
5
5
  import type { SxProps, Theme } from '@mui/material'
6
- import { Box, Divider, lighten } from '@mui/material'
6
+ import { Box, Divider } from '@mui/material'
7
7
  import { useCartQuery, useDisplayInclTax } from '../../hooks'
8
8
  import { GetCartTotalsDocument } from './GetCartTotals.gql'
9
9
 
@@ -71,12 +71,11 @@ export function CartTotals(props: CartTotalsProps) {
71
71
  theme.shape.borderRadius * 5,
72
72
  theme.breakpoints.values,
73
73
  ),
74
- background:
75
- theme.palette.mode === 'light'
76
- ? theme.palette.background.default
77
- : lighten(theme.palette.background.default, 0.15),
74
+ background: theme.vars.palette.background.default,
75
+ ...theme.applyStyles('dark', {
76
+ background: theme.lighten(theme.vars.palette.background.default, 0.15),
77
+ }),
78
78
  padding: `${theme.spacings.xs} ${theme.spacings.sm}`,
79
-
80
79
  '&.containerMargin': {
81
80
  marginTop: theme.spacings.md,
82
81
  px: theme.spacings.xs,
@@ -132,7 +131,9 @@ export function CartTotals(props: CartTotalsProps) {
132
131
  sx={{ display: 'flex', justifyContent: 'space-between' }}
133
132
  >
134
133
  <Box>
135
- <Trans>Shipping ({shippingMethod.carrier_title} {shippingMethod.method_title})</Trans>
134
+ <Trans>
135
+ Shipping ({shippingMethod.carrier_title} {shippingMethod.method_title})
136
+ </Trans>
136
137
  </Box>
137
138
  <Box className={classes.money} sx={{ whiteSpace: 'nowrap' }}>
138
139
  <Money
@@ -171,7 +172,7 @@ export function CartTotals(props: CartTotalsProps) {
171
172
  sx={(theme) => ({
172
173
  display: 'flex',
173
174
  justifyContent: 'space-between',
174
- color: theme.palette.primary.main,
175
+ color: theme.vars.palette.primary.main,
175
176
  })}
176
177
  >
177
178
  <Box>
@@ -74,7 +74,6 @@ export function EditBillingAddressForm(props: EditBillingAddressFormProps) {
74
74
  <CompanyFields<SetBillingAddressMutationVariables> form={form} />
75
75
  <NameFields form={form} prefix />
76
76
  <AddressFields<SetBillingAddressMutationVariables> form={form} />
77
-
78
77
  <FormRow>
79
78
  <TelephoneElement
80
79
  variant='outlined'
@@ -85,9 +84,7 @@ export function EditBillingAddressForm(props: EditBillingAddressFormProps) {
85
84
  showValid
86
85
  />
87
86
  </FormRow>
88
-
89
87
  <FormDivider />
90
-
91
88
  <FormActions sx={{ paddingBottom: 0 }}>
92
89
  <Button
93
90
  type='submit'
@@ -100,7 +97,6 @@ export function EditBillingAddressForm(props: EditBillingAddressFormProps) {
100
97
  </Button>
101
98
  </FormActions>
102
99
  </Form>
103
-
104
100
  <ApolloCustomerErrorAlert error={error} />
105
101
  </>
106
102
  )
@@ -30,11 +30,7 @@ export function EmptyCart(props: EmptyCartProps) {
30
30
  }
31
31
  {...rest}
32
32
  >
33
- {children ?? (
34
- <Trans>
35
- Discover our collection and add items to your cart!
36
- </Trans>
37
- )}
33
+ {children ?? <Trans>Discover our collection and add items to your cart!</Trans>}
38
34
  </FullPageMessage>
39
35
  )
40
36
  }
@@ -5,7 +5,7 @@ import {
5
5
  useCustomerSession,
6
6
  useGuestQuery,
7
7
  } from '@graphcommerce/magento-customer'
8
- import { Button, extendableComponent, FormRow } from '@graphcommerce/next-ui'
8
+ import { Button, extendableComponent, FormRow, sxx } from '@graphcommerce/next-ui'
9
9
  import { Trans } from '@lingui/react/macro'
10
10
  import type { SxProps, Theme } from '@mui/material'
11
11
  import { Box, TextField, Typography } from '@mui/material'
@@ -48,15 +48,15 @@ export function InlineAccount(props: InlineAccountProps) {
48
48
  <div>
49
49
  <Box
50
50
  className={classes.root}
51
- sx={[
51
+ sx={sxx(
52
52
  (theme) => ({
53
53
  borderRadius: '4px',
54
- border: `1px solid ${theme.palette.divider}`,
54
+ border: `1px solid ${theme.vars.palette.divider}`,
55
55
  padding: theme.spacings.md,
56
56
  marginTop: theme.spacings.sm,
57
57
  }),
58
- ...(Array.isArray(sx) ? sx : [sx]),
59
- ]}
58
+ sx,
59
+ )}
60
60
  >
61
61
  <Box
62
62
  className={classes.innerContainer}
@@ -101,8 +101,10 @@ export function InlineAccount(props: InlineAccountProps) {
101
101
  variant='outlined'
102
102
  label={<Trans>Email address</Trans>}
103
103
  value={cart?.email}
104
- InputProps={{
105
- readOnly: true,
104
+ slotProps={{
105
+ input: {
106
+ readOnly: true,
107
+ },
106
108
  }}
107
109
  />
108
110
  </FormRow>
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": "10.0.0-canary.66",
5
+ "version": "10.0.0-canary.68",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -20,24 +20,24 @@
20
20
  "./plugins/useSignInFormMergeCart": "./plugins/useSignInFormMergeCart.ts"
21
21
  },
22
22
  "peerDependencies": {
23
- "@graphcommerce/ecommerce-ui": "^10.0.0-canary.66",
24
- "@graphcommerce/eslint-config-pwa": "^10.0.0-canary.66",
25
- "@graphcommerce/framer-next-pages": "^10.0.0-canary.66",
26
- "@graphcommerce/framer-scroller": "^10.0.0-canary.66",
27
- "@graphcommerce/framer-utils": "^10.0.0-canary.66",
28
- "@graphcommerce/graphql": "^10.0.0-canary.66",
29
- "@graphcommerce/image": "^10.0.0-canary.66",
30
- "@graphcommerce/magento-customer": "^10.0.0-canary.66",
31
- "@graphcommerce/magento-graphql": "^10.0.0-canary.66",
32
- "@graphcommerce/magento-store": "^10.0.0-canary.66",
33
- "@graphcommerce/next-ui": "^10.0.0-canary.66",
34
- "@graphcommerce/prettier-config-pwa": "^10.0.0-canary.66",
35
- "@graphcommerce/react-hook-form": "^10.0.0-canary.66",
36
- "@graphcommerce/typescript-config-pwa": "^10.0.0-canary.66",
23
+ "@graphcommerce/ecommerce-ui": "^10.0.0-canary.68",
24
+ "@graphcommerce/eslint-config-pwa": "^10.0.0-canary.68",
25
+ "@graphcommerce/framer-next-pages": "^10.0.0-canary.68",
26
+ "@graphcommerce/framer-scroller": "^10.0.0-canary.68",
27
+ "@graphcommerce/framer-utils": "^10.0.0-canary.68",
28
+ "@graphcommerce/graphql": "^10.0.0-canary.68",
29
+ "@graphcommerce/image": "^10.0.0-canary.68",
30
+ "@graphcommerce/magento-customer": "^10.0.0-canary.68",
31
+ "@graphcommerce/magento-graphql": "^10.0.0-canary.68",
32
+ "@graphcommerce/magento-store": "^10.0.0-canary.68",
33
+ "@graphcommerce/next-ui": "^10.0.0-canary.68",
34
+ "@graphcommerce/prettier-config-pwa": "^10.0.0-canary.68",
35
+ "@graphcommerce/react-hook-form": "^10.0.0-canary.68",
36
+ "@graphcommerce/typescript-config-pwa": "^10.0.0-canary.68",
37
37
  "@lingui/core": "^5",
38
38
  "@lingui/macro": "^5",
39
39
  "@lingui/react": "^5",
40
- "@mui/material": "^5.10.16",
40
+ "@mui/material": "^7.0.0",
41
41
  "framer-motion": "^11.0.0",
42
42
  "graphql": "^16.0.0",
43
43
  "next": "*",