@graphcommerce/magento-customer 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.
Files changed (39) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/components/AccountAddress/AccountAddress.tsx +10 -5
  3. package/components/AccountAddresses/AccountAddresses.tsx +6 -2
  4. package/components/AccountDeleteForm/AccountDeleteForm.tsx +14 -4
  5. package/components/AccountMenu/AccountMenu.tsx +2 -2
  6. package/components/AccountMenuItem/AccountMenuItem.tsx +19 -16
  7. package/components/CancelOrder/CancelOrderForm.tsx +12 -19
  8. package/components/ConfirmCustomer/ConfirmCustomerForm.tsx +1 -5
  9. package/components/CreditMemo/CreditMemoCard.tsx +6 -6
  10. package/components/CreditMemo/CreditMemoDetails.tsx +12 -12
  11. package/components/CreditMemo/CreditMemoItems.tsx +5 -4
  12. package/components/CreditMemo/CreditMemoTotals.tsx +7 -8
  13. package/components/EditAddressForm/EditAddressForm.tsx +21 -13
  14. package/components/ForgotPasswordForm/ForgotPasswordForm.tsx +0 -2
  15. package/components/Invoice/InvoiceCard.tsx +6 -6
  16. package/components/Invoice/InvoiceDetails.tsx +12 -12
  17. package/components/Invoice/InvoiceItems.tsx +5 -4
  18. package/components/Invoice/InvoiceTotals.tsx +7 -8
  19. package/components/NoOrdersFound/NoOrdersFound.tsx +2 -5
  20. package/components/Order/OrderCard/OrderCard.tsx +6 -7
  21. package/components/Order/OrderDetails/OrderDetails.tsx +9 -12
  22. package/components/Order/OrderItems/OrderItems.tsx +5 -4
  23. package/components/Order/OrderStateLabel/OrderStateLabelInline.tsx +12 -13
  24. package/components/Order/OrderTotals/OrderTotals.tsx +7 -8
  25. package/components/Shipment/ShipmentCard.tsx +6 -6
  26. package/components/Shipment/ShipmentDetails.tsx +12 -12
  27. package/components/Shipment/ShipmentItems.tsx +5 -4
  28. package/components/SignInForm/SignInForm.tsx +0 -2
  29. package/components/SignInForm/SignInFormInline.tsx +8 -5
  30. package/components/SignUpForm/SignUpForm.tsx +2 -2
  31. package/components/SignUpForm/SignUpFormInline.tsx +3 -1
  32. package/components/TrackingLink/TrackingLink.tsx +5 -5
  33. package/components/UpdateDefaultAddressForm/UpdateDefaultAddressForm.tsx +4 -0
  34. package/graphql/Config.graphqls +9 -0
  35. package/hooks/index.ts +2 -1
  36. package/hooks/useBillingAddressPermission.tsx +8 -0
  37. package/package.json +16 -15
  38. package/utils/billingAddressPermission.tsx +10 -0
  39. package/utils/index.ts +1 -0
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,7 +1,8 @@
1
- import { extendableComponent } from '@graphcommerce/next-ui'
1
+ import { extendableComponent, sxx } from '@graphcommerce/next-ui'
2
2
  import { Trans } from '@lingui/react/macro'
3
3
  import type { SxProps, Theme } from '@mui/material'
4
4
  import { Box, Link } from '@mui/material'
5
+ import { useBillingAddressPermission } from '../../hooks'
5
6
  import { AddressMultiLine } from '../AddressMultiLine/AddressMultiLine'
6
7
  import { DeleteCustomerAddressForm } from '../DeleteCustomerAddressForm/DeleteCustomerAddressForm'
7
8
  import { UpdateDefaultAddressForm } from '../UpdateDefaultAddressForm/UpdateDefaultAddressForm'
@@ -16,10 +17,12 @@ const { classes } = extendableComponent(name, parts)
16
17
  export function AccountAddress(props: AccountAddressProps) {
17
18
  const { id, sx = [], ...addressProps } = props
18
19
 
20
+ const billingAddressReadonly = useBillingAddressPermission() === 'READONLY'
21
+
19
22
  return (
20
23
  <Box
21
24
  className={classes.root}
22
- sx={[
25
+ sx={sxx(
23
26
  (theme) => ({
24
27
  display: 'flex',
25
28
  justifyContent: 'space-between',
@@ -27,8 +30,8 @@ export function AccountAddress(props: AccountAddressProps) {
27
30
  paddingBottom: theme.spacings.md,
28
31
  typography: 'body2',
29
32
  }),
30
- ...(Array.isArray(sx) ? sx : [sx]),
31
- ]}
33
+ sx,
34
+ )}
32
35
  >
33
36
  <Box className={classes.address} sx={{ '& > span': { display: 'block' } }}>
34
37
  <AddressMultiLine id={id} {...addressProps} />
@@ -48,7 +51,9 @@ export function AccountAddress(props: AccountAddressProps) {
48
51
  <Link href={`/account/addresses/edit?addressId=${id}`} color='primary' underline='hover'>
49
52
  <Trans>Edit</Trans>
50
53
  </Link>
51
- <DeleteCustomerAddressForm addressId={id ?? undefined} />
54
+ {!(billingAddressReadonly && addressProps.default_billing) && (
55
+ <DeleteCustomerAddressForm addressId={id ?? undefined} />
56
+ )}
52
57
  </Box>
53
58
  </Box>
54
59
  )
@@ -35,7 +35,9 @@ export function AccountAddresses(props: AccountAddressesProps) {
35
35
  >
36
36
  <Box
37
37
  className={classes.addresses}
38
- sx={(theme) => ({ '& > div': { borderBottom: `1px solid ${theme.palette.divider}` } })}
38
+ sx={(theme) => ({
39
+ '& > div': { borderBottom: `1px solid ${theme.vars.palette.divider}` },
40
+ })}
39
41
  >
40
42
  <Skeleton height={128} />
41
43
  <Skeleton height={128} />
@@ -77,7 +79,9 @@ export function AccountAddresses(props: AccountAddressesProps) {
77
79
  <SectionContainer labelLeft={<Trans>Shipping addresses</Trans>}>
78
80
  <Box
79
81
  className={classes.addresses}
80
- sx={(theme) => ({ '& > div': { borderBottom: `1px solid ${theme.palette.divider}` } })}
82
+ sx={(theme) => ({
83
+ '& > div': { borderBottom: `1px solid ${theme.vars.palette.divider}` },
84
+ })}
81
85
  >
82
86
  {addresses.map((address) => (
83
87
  <AccountAddress key={address.id} {...address} />
@@ -2,8 +2,8 @@ import { CheckboxElement, EmailElement } from '@graphcommerce/ecommerce-ui'
2
2
  import { useApolloClient, useMutation } from '@graphcommerce/graphql'
3
3
  import { Button, FormActions, FormRow } from '@graphcommerce/next-ui'
4
4
  import { useForm } from '@graphcommerce/react-hook-form'
5
- import { Trans } from '@lingui/react/macro'
6
5
  import { t } from '@lingui/core/macro'
6
+ import { Trans } from '@lingui/react/macro'
7
7
  import { Box, Typography } from '@mui/material'
8
8
  import { useRouter } from 'next/router'
9
9
  import { CustomerDocument, CustomerTokenDocument, useCustomerQuery } from '../../hooks'
@@ -50,10 +50,20 @@ export function AccountDeleteForm() {
50
50
  {!called || error || loading ? (
51
51
  <WaitForCustomer waitFor={dashboard}>
52
52
  <Box component='form' onSubmit={submitHandler} noValidate>
53
- <Typography variant='h6' textAlign='center'>
53
+ <Typography
54
+ variant='h6'
55
+ sx={{
56
+ textAlign: 'center',
57
+ }}
58
+ >
54
59
  <Trans>Are you sure you want to delete your account?</Trans>
55
60
  </Typography>
56
- <Typography variant='body1' textAlign='center'>
61
+ <Typography
62
+ variant='body1'
63
+ sx={{
64
+ textAlign: 'center',
65
+ }}
66
+ >
57
67
  <Trans>
58
68
  Doing so will remove all your data including order history and saved shipping /
59
69
  billing addresses.
@@ -91,7 +101,7 @@ export function AccountDeleteForm() {
91
101
  </WaitForCustomer>
92
102
  ) : (
93
103
  <>
94
- <Typography variant='h6' textAlign='center'>
104
+ <Typography variant='h6' sx={{ textAlign: 'center' }}>
95
105
  <Trans>Account deletion successful</Trans>
96
106
  </Typography>
97
107
  <FormActions>
@@ -1,4 +1,4 @@
1
- import { extendableComponent } from '@graphcommerce/next-ui'
1
+ import { extendableComponent, sxx } from '@graphcommerce/next-ui'
2
2
  import type { SxProps, Theme } from '@mui/material'
3
3
  import { List } from '@mui/material'
4
4
  import React from 'react'
@@ -14,7 +14,7 @@ export function AccountMenu(props: AccountMenuProps) {
14
14
  <List
15
15
  classes={classes}
16
16
  disablePadding
17
- sx={[(theme) => ({ marginBottom: theme.spacings.lg }), ...(Array.isArray(sx) ? sx : [sx])]}
17
+ sx={sxx((theme) => ({ marginBottom: theme.spacings.lg }), sx)}
18
18
  >
19
19
  {children}
20
20
  </List>
@@ -6,6 +6,7 @@ import {
6
6
  iconChevronRight,
7
7
  IconSvg,
8
8
  responsiveVal,
9
+ sxx,
9
10
  } from '@graphcommerce/next-ui'
10
11
  import type { SxProps, Theme } from '@mui/material'
11
12
  import { ListItem, ListItemIcon, ListItemText } from '@mui/material'
@@ -44,30 +45,29 @@ export function AccountMenuItem(props: AccountMenuItemProps) {
44
45
  href={href}
45
46
  disabled={disabled}
46
47
  className={classes.root}
47
- sx={[
48
+ sx={sxx(
48
49
  (theme) => ({
49
50
  width: '100%',
50
51
  height: responsiveVal(88, 104),
51
52
  padding: 0,
52
53
  borderRadius: 0,
53
- background: theme.palette.background.paper,
54
+ background: theme.vars.palette.background.paper,
54
55
  '&:hover': {
55
- background: theme.palette.background.default,
56
+ background: theme.vars.palette.background.default,
56
57
  },
57
58
  '&:disabled': {
58
- background: theme.palette.background.default,
59
+ background: theme.vars.palette.background.default,
59
60
  },
60
61
  '&:focus': {
61
62
  // fix: disableElevation does not work when button is focused
62
63
  boxShadow: 'none',
63
64
  },
64
-
65
65
  '&:not(.noBorderBottom)': {
66
- borderBottom: `1px solid ${theme.palette.divider}`,
66
+ borderBottom: `1px solid ${theme.vars.palette.divider}`,
67
67
  },
68
68
  }),
69
- ...(Array.isArray(sx) ? sx : [sx]),
70
- ]}
69
+ sx,
70
+ )}
71
71
  {...buttonProps}
72
72
  >
73
73
  <ListItem disableGutters>
@@ -80,16 +80,19 @@ export function AccountMenuItem(props: AccountMenuItemProps) {
80
80
  <IconSvg src={iconSrc} size='large' />
81
81
  </ListItemIcon>
82
82
  <ListItemText
83
- primaryTypographyProps={{ sx: { typography: 'subtitle1' } }}
84
- secondaryTypographyProps={{
85
- sx: {
86
- whiteSpace: 'nowrap',
87
- overflow: 'hidden',
88
- textOverflow: 'elipsis',
89
- },
90
- }}
91
83
  primary={title}
92
84
  secondary={subtitle}
85
+ slotProps={{
86
+ primary: { sx: { typography: 'subtitle1' } },
87
+
88
+ secondary: {
89
+ sx: {
90
+ whiteSpace: 'nowrap',
91
+ overflow: 'hidden',
92
+ textOverflow: 'elipsis',
93
+ },
94
+ },
95
+ }}
93
96
  />
94
97
  {endIcon ?? <IconSvg src={iconChevronRight} />}
95
98
  </ListItem>
@@ -8,6 +8,7 @@ import {
8
8
  FormRow,
9
9
  iconChevronDown,
10
10
  IconSvg,
11
+ sxx,
11
12
  } from '@graphcommerce/next-ui'
12
13
  import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
13
14
  import { Trans } from '@lingui/react/macro'
@@ -52,10 +53,9 @@ export function CancelOrderForm(props: CancelOrderFormProps) {
52
53
  <Trans>Order has successfully been canceled</Trans>
53
54
  </Alert>
54
55
  )
55
-
56
56
  return (
57
57
  <Accordion
58
- sx={[
58
+ sx={sxx(
59
59
  (theme) => ({
60
60
  mb: theme.spacings.xxl,
61
61
  ...breakpointVal(
@@ -69,22 +69,20 @@ export function CancelOrderForm(props: CancelOrderFormProps) {
69
69
  mb: theme.spacings.xxl,
70
70
  },
71
71
  }),
72
- ...(Array.isArray(sx) ? sx : [sx]),
73
- ]}
72
+ sx,
73
+ )}
74
74
  {...rest}
75
75
  >
76
76
  <AccordionSummary
77
77
  expandIcon={<IconSvg src={iconChevronDown} />}
78
- sx={[
79
- (theme) => ({
80
- px: theme.spacings.xs,
81
- '& .MuiAccordionSummary-content': {
82
- alignItems: 'center',
83
- columnGap: 2,
84
- justifyContent: 'space-between',
85
- },
86
- }),
87
- ]}
78
+ sx={(theme) => ({
79
+ px: theme.spacings.xs,
80
+ '& .MuiAccordionSummary-content': {
81
+ alignItems: 'center',
82
+ columnGap: 2,
83
+ justifyContent: 'space-between',
84
+ },
85
+ })}
88
86
  >
89
87
  <Trans>Cancel order</Trans>
90
88
  </AccordionSummary>
@@ -103,7 +101,6 @@ export function CancelOrderForm(props: CancelOrderFormProps) {
103
101
  }))}
104
102
  />
105
103
  </FormRow>
106
-
107
104
  <CheckboxElement
108
105
  required
109
106
  control={control}
@@ -113,19 +110,15 @@ export function CancelOrderForm(props: CancelOrderFormProps) {
113
110
  <Trans>I understand that my order will be canceled and this can not be undone.</Trans>
114
111
  }
115
112
  />
116
-
117
113
  {submittedWithoutErrors && (
118
114
  <Alert>
119
115
  <Trans>Order has successfully been canceled</Trans>
120
116
  </Alert>
121
117
  )}
122
-
123
118
  {cancelOrderData?.cancelOrder?.error && (
124
119
  <Alert severity='error'>{cancelOrderData?.cancelOrder?.error}</Alert>
125
120
  )}
126
-
127
121
  <ApolloErrorSnackbar error={error} />
128
-
129
122
  <FormRow
130
123
  sx={(theme) => ({
131
124
  justifyContent: 'center',
@@ -37,7 +37,6 @@ export function ConfirmCustomerForm() {
37
37
  <LayoutTitle icon={iconPerson}>
38
38
  <Trans>Account confirmation</Trans>
39
39
  </LayoutTitle>
40
-
41
40
  {!key && (
42
41
  <Alert severity='error' sx={(theme) => ({ my: theme.spacings.xxs })}>
43
42
  <Trans>You can only confirm you account by clicking on the link in your email.</Trans>
@@ -45,10 +44,9 @@ export function ConfirmCustomerForm() {
45
44
  )}
46
45
  {key && (
47
46
  <>
48
- <Typography variant='h6' textAlign='center'>
47
+ <Typography variant='h6' sx={{ textAlign: 'center' }}>
49
48
  <Trans>Fill in your email to confirm registration</Trans>
50
49
  </Typography>
51
-
52
50
  <FormRow>
53
51
  <EmailElement
54
52
  variant='outlined'
@@ -59,7 +57,6 @@ export function ConfirmCustomerForm() {
59
57
  disabled={isSubmitSuccessful}
60
58
  />
61
59
  </FormRow>
62
-
63
60
  <FormRow sx={{ justifyItems: 'center' }}>
64
61
  <Button
65
62
  type='submit'
@@ -72,7 +69,6 @@ export function ConfirmCustomerForm() {
72
69
  <Trans>Confirm registration</Trans>
73
70
  </Button>
74
71
  </FormRow>
75
-
76
72
  <ApolloCustomerErrorAlert
77
73
  sx={(theme) => ({ my: theme.spacings.xxs })}
78
74
  error={error}
@@ -2,7 +2,7 @@ import { Money } from '@graphcommerce/magento-store'
2
2
  import { breakpointVal, iconChevronRight, IconSvg, NextLink, sxx } from '@graphcommerce/next-ui'
3
3
  import { Trans } from '@lingui/react/macro'
4
4
  import type { SxProps, Theme } from '@mui/material'
5
- import { Box, lighten } from '@mui/material'
5
+ import { Box } from '@mui/material'
6
6
  import type { CreditMemoCardFragment } from './CreditMemoCard.gql'
7
7
 
8
8
  export type CreditMemoCardProps = {
@@ -26,10 +26,10 @@ export function CreditMemoCard(props: CreditMemoCardProps) {
26
26
  px: theme.spacings.xxs,
27
27
  py: theme.spacings.xxs,
28
28
  gap: theme.spacings.sm,
29
- background:
30
- theme.palette.mode === 'light'
31
- ? theme.palette.background.default
32
- : lighten(theme.palette.background.default, 0.15),
29
+ background: theme.vars.palette.background.default,
30
+ ...theme.applyStyles('dark', {
31
+ background: theme.lighten(theme.vars.palette.background.default, 0.15),
32
+ }),
33
33
  ...breakpointVal(
34
34
  'borderRadius',
35
35
  theme.shape.borderRadius * 2,
@@ -37,7 +37,7 @@ export function CreditMemoCard(props: CreditMemoCardProps) {
37
37
  theme.breakpoints.values,
38
38
  ),
39
39
  '&:hover': {
40
- backgroundColor: theme.palette.action.hover,
40
+ backgroundColor: theme.vars.palette.action.hover,
41
41
  },
42
42
  display: 'grid',
43
43
  gridTemplate: `
@@ -3,10 +3,11 @@ import {
3
3
  DateTimeFormat,
4
4
  extendableComponent,
5
5
  SectionContainer,
6
+ sxx,
6
7
  } from '@graphcommerce/next-ui'
7
8
  import { Trans } from '@lingui/react/macro'
8
9
  import type { SxProps, Theme } from '@mui/material'
9
- import { Box, lighten, Typography } from '@mui/material'
10
+ import { Box, Typography } from '@mui/material'
10
11
  import type { CreditMemoFragment } from './CreditMemo.gql'
11
12
 
12
13
  export type CreditMemoDetailsProps = {
@@ -30,14 +31,11 @@ export function CreditMemoDetails(props: CreditMemoDetailsProps) {
30
31
  return (
31
32
  <SectionContainer
32
33
  labelLeft={<Trans>Credit Memo details</Trans>}
33
- sx={[
34
+ sx={sxx(
34
35
  (theme) => ({
35
36
  padding: theme.spacings.sm,
36
37
  marginBottom: theme.spacings.md,
37
- background:
38
- theme.palette.mode === 'light'
39
- ? theme.palette.background.default
40
- : lighten(theme.palette.background.default, 0.15),
38
+ background: theme.lighten(theme.vars.palette.background.default, 0.15),
41
39
  ...breakpointVal(
42
40
  'borderRadius',
43
41
  theme.shape.borderRadius * 2,
@@ -48,13 +46,16 @@ export function CreditMemoDetails(props: CreditMemoDetailsProps) {
48
46
  mt: 0,
49
47
  mb: theme.spacings.xs,
50
48
  },
49
+ ...theme.applyStyles('light', {
50
+ background: theme.vars.palette.background.default,
51
+ }),
51
52
  }),
52
- ...(Array.isArray(sx) ? sx : [sx]),
53
- ]}
53
+ sx,
54
+ )}
54
55
  >
55
56
  <Box
56
57
  className={classes.creditMemoDetailContainer}
57
- sx={[
58
+ sx={sxx(
58
59
  (theme) => ({
59
60
  gridColumnGap: theme.spacings.xxl,
60
61
  gridRowGap: theme.spacings.md,
@@ -64,8 +65,8 @@ export function CreditMemoDetails(props: CreditMemoDetailsProps) {
64
65
  marginTop: theme.spacings.xxs,
65
66
  },
66
67
  }),
67
- ...(Array.isArray(sx) ? sx : [sx]),
68
- ]}
68
+ sx,
69
+ )}
69
70
  >
70
71
  <Box className={classes.creditMemoDetailRow}>
71
72
  <SectionContainer
@@ -77,7 +78,6 @@ export function CreditMemoDetails(props: CreditMemoDetailsProps) {
77
78
  <Typography>{number}</Typography>
78
79
  </SectionContainer>
79
80
  </Box>
80
-
81
81
  <Box className={classes.creditMemoDetailRow}>
82
82
  {/* <SectionContainer
83
83
  variantLeft='h5'
@@ -4,6 +4,7 @@ import {
4
4
  extendableComponent,
5
5
  nonNullable,
6
6
  SectionContainer,
7
+ sxx,
7
8
  } from '@graphcommerce/next-ui'
8
9
  import { Trans } from '@lingui/react/macro'
9
10
  import type { SxProps, Theme } from '@mui/material'
@@ -31,11 +32,11 @@ export function CreditMemoItems(props: CreditMemoItemsProps) {
31
32
  return (
32
33
  <Box
33
34
  className={classes.root}
34
- sx={[
35
+ sx={sxx(
35
36
  (theme) => ({
36
37
  my: theme.spacings.md,
37
38
  padding: `${theme.spacings.sm} ${theme.spacings.sm}`,
38
- border: `1px ${theme.palette.divider} solid`,
39
+ border: `1px ${theme.vars.palette.divider} solid`,
39
40
  ...breakpointVal(
40
41
  'borderRadius',
41
42
  theme.shape.borderRadius * 2,
@@ -43,8 +44,8 @@ export function CreditMemoItems(props: CreditMemoItemsProps) {
43
44
  theme.breakpoints.values,
44
45
  ),
45
46
  }),
46
- ...(Array.isArray(sx) ? sx : [sx]),
47
- ]}
47
+ sx,
48
+ )}
48
49
  >
49
50
  <SectionContainer
50
51
  sx={{ '& .SectionHeader-root': { mt: 0 } }}
@@ -2,7 +2,7 @@ import { Money } from '@graphcommerce/magento-store'
2
2
  import { breakpointVal, extendableComponent, sxx } from '@graphcommerce/next-ui'
3
3
  import { Trans } from '@lingui/react/macro'
4
4
  import type { SxProps, Theme } from '@mui/material'
5
- import { Box, Divider, lighten, Typography } from '@mui/material'
5
+ import { Box, Divider, Typography } from '@mui/material'
6
6
  import type { CreditMemoFragment } from './CreditMemo.gql'
7
7
 
8
8
  export type CreditMemoTotalsProps = {
@@ -32,10 +32,10 @@ export function CreditMemoTotals(props: CreditMemoTotalsProps) {
32
32
  theme.shape.borderRadius * 5,
33
33
  theme.breakpoints.values,
34
34
  ),
35
- background:
36
- theme.palette.mode === 'light'
37
- ? theme.palette.background.default
38
- : lighten(theme.palette.background.default, 0.15),
35
+ background: theme.vars.palette.background.default,
36
+ ...theme.applyStyles('dark', {
37
+ background: theme.lighten(theme.vars.palette.background.default, 0.15),
38
+ }),
39
39
  padding: `${theme.spacings.xs} ${theme.spacings.sm}`,
40
40
  }),
41
41
  sx,
@@ -86,13 +86,12 @@ export function CreditMemoTotals(props: CreditMemoTotalsProps) {
86
86
  )}
87
87
 
88
88
  <Divider sx={(theme) => ({ my: theme.spacings.xxs })} />
89
-
90
89
  <Box
91
90
  className={classes.totalsRow}
92
91
  sx={(theme) => ({
93
92
  display: 'flex',
94
93
  justifyContent: 'space-between',
95
- color: theme.palette.primary.main,
94
+ color: theme.vars.palette.primary.main,
96
95
  })}
97
96
  >
98
97
  <Typography>
@@ -108,7 +107,7 @@ export function CreditMemoTotals(props: CreditMemoTotalsProps) {
108
107
  sx={(theme) => ({
109
108
  display: 'flex',
110
109
  justifyContent: 'space-between',
111
- color: theme.palette.text.disabled,
110
+ color: theme.vars.palette.text.disabled,
112
111
  })}
113
112
  >
114
113
  <Typography>
@@ -6,6 +6,7 @@ import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
6
6
  import { Trans } from '@lingui/react/macro'
7
7
  import type { SxProps, Theme } from '@mui/material'
8
8
  import { useRouter } from 'next/router'
9
+ import { useBillingAddressPermission } from '../../hooks'
9
10
  import type { AccountAddressFragment } from '../AccountAddress/AccountAddress.gql'
10
11
  import { AddressFields } from '../AddressFields/AddressFields'
11
12
  import { CompanyFields } from '../CompanyFields'
@@ -24,10 +25,12 @@ export function EditAddressForm(props: EditAddressFormProps) {
24
25
  const { address, sx } = props
25
26
 
26
27
  const router = useRouter()
28
+ const billingAddressReadonly = useBillingAddressPermission() === 'READONLY'
27
29
 
28
30
  const form = useFormGqlMutation(
29
31
  UpdateCustomerAddressDocument,
30
32
  {
33
+ disabled: billingAddressReadonly && (address?.default_billing ?? false),
31
34
  defaultValues: {
32
35
  id: address?.id ?? undefined,
33
36
  firstname: address?.firstname,
@@ -96,20 +99,25 @@ export function EditAddressForm(props: EditAddressFormProps) {
96
99
  showValid
97
100
  />
98
101
  </FormRow>
99
-
100
- <FormActions sx={{ paddingBottom: 0 }}>
101
- <Button
102
- type='submit'
103
- variant='pill'
104
- color='primary'
105
- size='large'
106
- loading={formState.isSubmitting}
107
- >
108
- <Trans>Save changes</Trans>
109
- </Button>
110
- </FormActions>
102
+ {billingAddressReadonly && address?.default_billing ? (
103
+ <Trans>
104
+ You can not change this address as it is your billing address. Not correct? Please
105
+ contact our support to update this.
106
+ </Trans>
107
+ ) : (
108
+ <FormActions sx={{ paddingBottom: 0 }}>
109
+ <Button
110
+ type='submit'
111
+ variant='pill'
112
+ color='primary'
113
+ size='large'
114
+ loading={formState.isSubmitting}
115
+ >
116
+ <Trans>Save changes</Trans>
117
+ </Button>
118
+ </FormActions>
119
+ )}
111
120
  </Form>
112
-
113
121
  <ApolloErrorSnackbar error={error} />
114
122
  </>
115
123
  )
@@ -56,9 +56,7 @@ export function ForgotPasswordForm(props: ForgotPasswordFormProps) {
56
56
  showValid
57
57
  />
58
58
  </FormRow>
59
-
60
59
  <ApolloCustomerErrorAlert error={error} />
61
-
62
60
  <FormActions>
63
61
  <Button
64
62
  type='submit'
@@ -2,7 +2,7 @@ import { Money } from '@graphcommerce/magento-store'
2
2
  import { breakpointVal, iconChevronRight, IconSvg, NextLink, sxx } from '@graphcommerce/next-ui'
3
3
  import { Trans } from '@lingui/react/macro'
4
4
  import type { SxProps, Theme } from '@mui/material'
5
- import { Box, lighten } from '@mui/material'
5
+ import { Box } from '@mui/material'
6
6
  import type { InvoiceCardFragment } from './InvoiceCard.gql'
7
7
 
8
8
  export type InvoiceCardProps = {
@@ -26,10 +26,10 @@ export function InvoiceCard(props: InvoiceCardProps) {
26
26
  px: theme.spacings.xxs,
27
27
  py: theme.spacings.xxs,
28
28
  gap: theme.spacings.sm,
29
- background:
30
- theme.palette.mode === 'light'
31
- ? theme.palette.background.default
32
- : lighten(theme.palette.background.default, 0.15),
29
+ background: theme.vars.palette.background.default,
30
+ ...theme.applyStyles('dark', {
31
+ background: theme.lighten(theme.vars.palette.background.default, 0.15),
32
+ }),
33
33
  ...breakpointVal(
34
34
  'borderRadius',
35
35
  theme.shape.borderRadius * 2,
@@ -37,7 +37,7 @@ export function InvoiceCard(props: InvoiceCardProps) {
37
37
  theme.breakpoints.values,
38
38
  ),
39
39
  '&:hover': {
40
- backgroundColor: theme.palette.action.hover,
40
+ backgroundColor: theme.vars.palette.action.hover,
41
41
  },
42
42
  display: 'grid',
43
43
  gridTemplate: `