@graphcommerce/magento-customer 9.1.0-canary.54 → 10.0.0-canary.56

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 (73) hide show
  1. package/CHANGELOG.md +88 -0
  2. package/components/AccountAddress/AccountAddress.tsx +2 -2
  3. package/components/AccountAddresses/AccountAddresses.tsx +7 -7
  4. package/components/AccountDeleteForm/AccountDeleteForm.tsx +2 -1
  5. package/components/AccountSignInUpForm/AccountSignInUpForm.tsx +19 -18
  6. package/components/AddressFields/AddressAddition.tsx +3 -2
  7. package/components/AddressFields/AddressCity.tsx +3 -2
  8. package/components/AddressFields/AddressCountryRegion.tsx +4 -4
  9. package/components/AddressFields/AddressHouseNumber.tsx +5 -4
  10. package/components/AddressFields/AddressPostcode.tsx +2 -1
  11. package/components/AddressFields/AddressStreet.tsx +3 -2
  12. package/components/ApolloCustomerError/ApolloCustomerErrorAlert.tsx +2 -2
  13. package/components/ApolloCustomerError/ApolloCustomerErrorFullPage.tsx +2 -2
  14. package/components/ApolloCustomerError/ApolloCustomerErrorSnackbar.tsx +2 -2
  15. package/components/ApolloCustomerError/useAuthorizationErrorMasked.ts +3 -5
  16. package/components/CancelOrder/CancelOrderForm.tsx +1 -1
  17. package/components/ChangeNameForm/ChangeNameForm.tsx +3 -3
  18. package/components/ChangePasswordForm/ChangePasswordForm.tsx +6 -6
  19. package/components/CompanyFields/CompanyFields.tsx +4 -5
  20. package/components/CompanyFields/CompanyName.tsx +2 -2
  21. package/components/CompanyFields/CompanyVAT.tsx +2 -2
  22. package/components/ConfirmCustomer/ConfirmCustomerForm.tsx +7 -7
  23. package/components/ContactForm/ContactForm.tsx +1 -1
  24. package/components/CreateCustomerAddressForm/CreateCustomerAddressForm.tsx +3 -3
  25. package/components/CreditMemo/CreditMemoCard.tsx +1 -1
  26. package/components/CreditMemo/CreditMemoDetails.tsx +1 -1
  27. package/components/CreditMemo/CreditMemoItem.tsx +2 -2
  28. package/components/CreditMemo/CreditMemoItems.tsx +1 -1
  29. package/components/CreditMemo/CreditMemoTotals.tsx +1 -1
  30. package/components/CustomerFab/CustomerFab.tsx +2 -2
  31. package/components/CustomerForms/CustomerAttributeField.tsx +2 -2
  32. package/components/CustomerForms/CustomerUpdateForm.tsx +2 -2
  33. package/components/CustomerForms/customerAttributeFieldHelpers.ts +1 -1
  34. package/components/CustomerForms/nameFieldset.tsx +2 -2
  35. package/components/DeleteCustomerAddressForm/DeleteCustomerAddressForm.tsx +2 -2
  36. package/components/EditAddressForm/EditAddressForm.tsx +2 -2
  37. package/components/ForgotPasswordForm/ForgotPasswordForm.tsx +6 -6
  38. package/components/GuestOrderOverview/GuestOrder.graphql +2 -2
  39. package/components/GuestOrderOverview/GuestOrderOverviewForm.tsx +10 -10
  40. package/components/Invoice/InvoiceCard.tsx +1 -1
  41. package/components/Invoice/InvoiceDetails.tsx +1 -1
  42. package/components/Invoice/InvoiceItem.tsx +2 -2
  43. package/components/Invoice/InvoiceItems.tsx +1 -1
  44. package/components/Invoice/InvoiceTotals.tsx +1 -1
  45. package/components/NameFields/NameFields.tsx +8 -8
  46. package/components/NoOrdersFound/NoOrdersFound.tsx +2 -2
  47. package/components/Order/OrderCard/OrderCard.tsx +3 -3
  48. package/components/Order/OrderDetails/OrderDetails.tsx +1 -1
  49. package/components/Order/OrderItem/OrderItem.tsx +2 -2
  50. package/components/Order/OrderItems/OrderItems.tsx +2 -2
  51. package/components/Order/OrderStateLabel/OrderStateLabel.tsx +1 -1
  52. package/components/Order/OrderTotals/OrderTotals.tsx +7 -5
  53. package/components/ReorderItems/ReorderItems.tsx +2 -1
  54. package/components/ResetPasswordForm/ResetPasswordForm.tsx +4 -4
  55. package/components/Shipment/ShipmentCard.tsx +1 -1
  56. package/components/Shipment/ShipmentDetails.tsx +1 -1
  57. package/components/Shipment/ShipmentItem.tsx +2 -2
  58. package/components/Shipment/ShipmentItems.tsx +1 -1
  59. package/components/SignInForm/SignInForm.tsx +5 -5
  60. package/components/SignInForm/SignInFormInline.tsx +4 -4
  61. package/components/SignUpForm/SignUpForm.tsx +9 -7
  62. package/components/SignUpForm/SignUpFormInline.tsx +5 -8
  63. package/components/TrackingLink/TrackingLink.tsx +2 -2
  64. package/components/UpdateCustomerEmailForm/UpdateCustomerEmailForm.tsx +9 -9
  65. package/components/UpdateDefaultAddressForm/UpdateDefaultAddressForm.tsx +3 -3
  66. package/components/ValidatedPasswordElement/ValidatedPasswordElement.tsx +4 -9
  67. package/components/WaitForCustomer/WaitForCustomer.tsx +7 -11
  68. package/components/index.ts +1 -0
  69. package/graphql/index.ts +1 -0
  70. package/hooks/useAccountSignInUpForm.tsx +2 -1
  71. package/hooks/useCustomerPermissions.ts +2 -3
  72. package/package.json +28 -19
  73. package/utils/customerPermissions.ts +2 -1
@@ -1,5 +1,5 @@
1
1
  import { extendableComponent } from '@graphcommerce/next-ui'
2
- import { Trans } from '@lingui/macro'
2
+ import { Trans } from '@lingui/react/macro'
3
3
  import type { SxProps, Theme } from '@mui/material'
4
4
  import { Box } from '@mui/material'
5
5
  import type { OrderState, OrderStateProps } from '../../../utils'
@@ -1,6 +1,6 @@
1
1
  import { Money } from '@graphcommerce/magento-store'
2
2
  import { breakpointVal, extendableComponent, sxx } from '@graphcommerce/next-ui'
3
- import { Trans } from '@lingui/react'
3
+ import { Trans } from '@lingui/react/macro'
4
4
  import type { SxProps, Theme } from '@mui/material'
5
5
  import { Box, Divider, lighten, Typography } from '@mui/material'
6
6
  import type { OrderTotalsFragment } from './OrderTotals.gql'
@@ -44,7 +44,7 @@ export function OrderTotals(props: OrderTotalsProps) {
44
44
  >
45
45
  <Box className={classes.totalsRow} sx={{ display: 'flex', justifyContent: 'space-between' }}>
46
46
  <Typography>
47
- <Trans id='Products' />
47
+ <Trans>Products</Trans>
48
48
  </Typography>
49
49
  <Money {...total?.subtotal} />
50
50
  </Box>
@@ -68,7 +68,9 @@ export function OrderTotals(props: OrderTotalsProps) {
68
68
  sx={{ display: 'flex', justifyContent: 'space-between' }}
69
69
  >
70
70
  <Typography>
71
- <Trans id='Shipping ({0} {1})' values={{ 0: carrier, 1: shipping_method }} />
71
+ <Trans>
72
+ Shipping ({carrier} {shipping_method})
73
+ </Trans>
72
74
  </Typography>
73
75
  <Money {...total?.total_shipping} />
74
76
  </Box>
@@ -87,7 +89,7 @@ export function OrderTotals(props: OrderTotalsProps) {
87
89
  })}
88
90
  >
89
91
  <Typography>
90
- <Trans id='Grand total' />
92
+ <Trans>Grand total</Trans>
91
93
  </Typography>
92
94
  <Money {...total?.grand_total} />
93
95
  </Box>
@@ -105,7 +107,7 @@ export function OrderTotals(props: OrderTotalsProps) {
105
107
  })}
106
108
  >
107
109
  <Typography>
108
- <Trans id='Including {0}' values={{ 0: tax?.title }} />
110
+ <Trans>Including {tax?.title}</Trans>
109
111
  </Typography>
110
112
  <Money {...tax?.amount} />
111
113
  </Box>
@@ -2,7 +2,7 @@
2
2
  import { useFormGqlMutationCart } from '@graphcommerce/magento-cart'
3
3
  import { AddProductsToCartSnackbarMessage } from '@graphcommerce/magento-product/components/AddProductsToCart/AddProductsToCartSnackbarMessage'
4
4
  import { iconChevronRight, IconSvg, LinkOrButton, nonNullable } from '@graphcommerce/next-ui'
5
- import { Trans } from '@lingui/macro'
5
+ import { Trans } from '@lingui/react/macro'
6
6
  import { Box } from '@mui/material'
7
7
  import type { OrderItemsFragment } from '../Order'
8
8
  import type { ReorderItemsMutation, ReorderItemsMutationVariables } from './ReorderItems.gql'
@@ -45,6 +45,7 @@ export function ReorderItems(props: ReorderItemsProps) {
45
45
  error={error}
46
46
  userErrors={errors?.filter(nonNullable)}
47
47
  showSuccess={!!cart}
48
+ cart={cart}
48
49
  />
49
50
  </Box>
50
51
  )
@@ -1,7 +1,7 @@
1
1
  import { EmailElement, PasswordRepeatElement } from '@graphcommerce/ecommerce-ui'
2
2
  import { Button, Form, FormActions, FormRow } from '@graphcommerce/next-ui'
3
3
  import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
4
- import { Trans } from '@lingui/react'
4
+ import { Trans } from '@lingui/react/macro'
5
5
  import { useRouter } from 'next/router'
6
6
  import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
7
7
  import { ValidatedPasswordElement } from '../ValidatedPasswordElement/ValidatedPasswordElement'
@@ -56,7 +56,7 @@ export function ResetPasswordForm(props: ResetPasswordFormProps) {
56
56
  name='newPassword'
57
57
  autoComplete='new-password'
58
58
  variant='outlined'
59
- label={<Trans id='New password' />}
59
+ label={<Trans>New password</Trans>}
60
60
  required
61
61
  disabled={formState.isSubmitting}
62
62
  />
@@ -66,7 +66,7 @@ export function ResetPasswordForm(props: ResetPasswordFormProps) {
66
66
  autoComplete='new-password'
67
67
  passwordFieldName='newPassword'
68
68
  variant='outlined'
69
- label={<Trans id='Confirm password' />}
69
+ label={<Trans>Confirm password</Trans>}
70
70
  required
71
71
  disabled={formState.isSubmitting}
72
72
  />
@@ -83,7 +83,7 @@ export function ResetPasswordForm(props: ResetPasswordFormProps) {
83
83
  size='large'
84
84
  {...buttonProps}
85
85
  >
86
- <Trans id='Save new password' />
86
+ <Trans>Save new password</Trans>
87
87
  </Button>
88
88
  </FormActions>
89
89
  </Form>
@@ -7,7 +7,7 @@ import {
7
7
  NextLink,
8
8
  sxx,
9
9
  } from '@graphcommerce/next-ui'
10
- import { Trans } from '@lingui/macro'
10
+ import { Trans } from '@lingui/react/macro'
11
11
  import type { SxProps, Theme } from '@mui/material'
12
12
  import { Box, lighten } from '@mui/material'
13
13
  import { TrackingLink } from '../TrackingLink/TrackingLink'
@@ -5,7 +5,7 @@ import {
5
5
  filterNonNullableKeys,
6
6
  SectionContainer,
7
7
  } from '@graphcommerce/next-ui'
8
- import { Trans } from '@lingui/macro'
8
+ import { Trans } from '@lingui/react/macro'
9
9
  import type { SxProps, Theme } from '@mui/material'
10
10
  import { Box, lighten, Typography } from '@mui/material'
11
11
  import { TrackingLink } from '../TrackingLink/TrackingLink'
@@ -1,7 +1,7 @@
1
1
  import { Image } from '@graphcommerce/image'
2
2
  import { Money, PriceModifiersList, type PriceModifier } from '@graphcommerce/magento-store'
3
3
  import { ActionCard, actionCardImageSizes, type ActionCardProps } from '@graphcommerce/next-ui'
4
- import { Trans } from '@lingui/react'
4
+ import { Trans } from '@lingui/react/macro'
5
5
  import { Box } from '@mui/material'
6
6
  import type { ShipmentItemFragment } from './ShipmentItem.gql'
7
7
 
@@ -103,7 +103,7 @@ export function ShipmentItem(props: ShipmentItemProps) {
103
103
  <>
104
104
  {priceModifiers && priceModifiers.length > 0 && (
105
105
  <PriceModifiersList
106
- label={<Trans id='Base Price'>Base price</Trans>}
106
+ label={<Trans>Base price</Trans>}
107
107
  modifiers={[...priceModifiers]}
108
108
  total={product_sale_price.value ?? 0}
109
109
  currency={product_sale_price.currency}
@@ -5,7 +5,7 @@ import {
5
5
  nonNullable,
6
6
  SectionContainer,
7
7
  } from '@graphcommerce/next-ui'
8
- import { Trans } from '@lingui/macro'
8
+ import { Trans } from '@lingui/react/macro'
9
9
  import type { SxProps, Theme } from '@mui/material'
10
10
  import { Box } from '@mui/material'
11
11
  import type { ShipmentFragment } from './Shipment.gql'
@@ -2,8 +2,8 @@ import type { UseFormClearErrors, UseFormSetError } from '@graphcommerce/ecommer
2
2
  import { PasswordElement } from '@graphcommerce/ecommerce-ui'
3
3
  import { graphqlErrorByCategory } from '@graphcommerce/magento-graphql'
4
4
  import { Button, FormActions, FormRow } from '@graphcommerce/next-ui'
5
- import { t } from '@lingui/macro'
6
- import { Trans } from '@lingui/react'
5
+ import { t } from '@lingui/core/macro'
6
+ import { Trans } from '@lingui/react/macro'
7
7
  import type { SxProps, Theme } from '@mui/material'
8
8
  import { Box, FormControl, Link } from '@mui/material'
9
9
  import { useSignInForm } from '../../hooks/useSignInForm'
@@ -49,7 +49,7 @@ export function SignInForm(props: SignInFormProps) {
49
49
  error={!!formState.errors.password || !!authError}
50
50
  control={control}
51
51
  name='password'
52
- label={<Trans id='Password' />}
52
+ label={<Trans>Password</Trans>}
53
53
  autoFocus={!!email}
54
54
  autoComplete='current-password'
55
55
  id='current-password'
@@ -58,7 +58,7 @@ export function SignInForm(props: SignInFormProps) {
58
58
  InputProps={{
59
59
  endAdornment: (
60
60
  <Link href='/account/forgot-password' underline='hover' sx={{ whiteSpace: 'nowrap' }}>
61
- <Trans id='Forgot password?' />
61
+ <Trans>Forgot password?</Trans>
62
62
  </Link>
63
63
  ),
64
64
  }}
@@ -76,7 +76,7 @@ export function SignInForm(props: SignInFormProps) {
76
76
  variant='pill'
77
77
  size='large'
78
78
  >
79
- <Trans id='Sign in' />
79
+ <Trans>Sign in</Trans>
80
80
  </Button>
81
81
  </FormControl>
82
82
  </FormActions>
@@ -1,6 +1,6 @@
1
1
  import { PasswordElement } from '@graphcommerce/ecommerce-ui'
2
2
  import { Button, extendableComponent } from '@graphcommerce/next-ui'
3
- import { Trans } from '@lingui/react'
3
+ import { Trans } from '@lingui/react/macro'
4
4
  import type { SxProps, Theme } from '@mui/material'
5
5
  import { Box, Link } from '@mui/material'
6
6
  import { useSignInForm } from '../../hooks/useSignInForm'
@@ -45,7 +45,7 @@ export function SignInFormInline(props: InlineSignInFormProps) {
45
45
  control={control}
46
46
  variant='outlined'
47
47
  name='password'
48
- label={<Trans id='Password' />}
48
+ label={<Trans>Password</Trans>}
49
49
  autoFocus
50
50
  autoComplete='current-password'
51
51
  id='current-password'
@@ -54,7 +54,7 @@ export function SignInFormInline(props: InlineSignInFormProps) {
54
54
  InputProps={{
55
55
  endAdornment: (
56
56
  <Link href='/account/forgot-password' underline='hover' sx={{ whiteSpace: 'nowrap' }}>
57
- <Trans id='Forgot password?' />
57
+ <Trans>Forgot password?</Trans>
58
58
  </Link>
59
59
  ),
60
60
  }}
@@ -66,7 +66,7 @@ export function SignInFormInline(props: InlineSignInFormProps) {
66
66
  variant='pill'
67
67
  sx={{ alignSelf: 'start', marginTop: (theme) => `calc(${theme.spacings.xxs} * .33)` }}
68
68
  >
69
- <Trans id='Sign in' />
69
+ <Trans>Sign in</Trans>
70
70
  </Button>
71
71
  {children}
72
72
  </Box>
@@ -2,8 +2,10 @@ import { FormPersist, PasswordRepeatElement, SwitchElement } from '@graphcommerc
2
2
  import { useQuery } from '@graphcommerce/graphql'
3
3
  import { AttributesFormAutoLayout, StoreConfigDocument } from '@graphcommerce/magento-store'
4
4
  import { Button, FormActions, FormRow } from '@graphcommerce/next-ui'
5
+ import { magentoVersion } from '@graphcommerce/next-config/config'
5
6
  import type { UseFormClearErrors, UseFormSetError } from '@graphcommerce/react-hook-form'
6
- import { t, Trans } from '@lingui/macro'
7
+ import { Trans } from '@lingui/react/macro'
8
+ import { t } from '@lingui/core/macro'
7
9
  import { Alert } from '@mui/material'
8
10
  import { useSignInForm } from '../../hooks/useSignInForm'
9
11
  import { ApolloCustomerErrorSnackbar } from '../ApolloCustomerError/ApolloCustomerErrorSnackbar'
@@ -64,7 +66,7 @@ export function SignUpForm(props: SignUpFormProps) {
64
66
  ) {
65
67
  return (
66
68
  <Alert>
67
- <Trans id='Registration successful. Please check your inbox to confirm your email address ({email})'>
69
+ <Trans>
68
70
  Registration successful. Please check your inbox to confirm your email address ({email})
69
71
  </Trans>
70
72
  </Alert>
@@ -78,7 +80,7 @@ export function SignUpForm(props: SignUpFormProps) {
78
80
  control={control}
79
81
  name='input.password'
80
82
  variant='outlined'
81
- label={<Trans id='Password'>Password</Trans>}
83
+ label={<Trans>Password</Trans>}
82
84
  autoFocus={!!email}
83
85
  autoComplete='new-password'
84
86
  required
@@ -88,13 +90,13 @@ export function SignUpForm(props: SignUpFormProps) {
88
90
  name='confirmPassword'
89
91
  passwordFieldName='input.password'
90
92
  variant='outlined'
91
- label={<Trans id='Confirm password'>Confirm password</Trans>}
93
+ label={<Trans>Confirm password</Trans>}
92
94
  autoComplete='new-password'
93
95
  required
94
96
  />
95
97
  </FormRow>
96
98
 
97
- {import.meta.graphCommerce.magentoVersion < 247 ? (
99
+ {magentoVersion < 247 ? (
98
100
  <NameFields
99
101
  form={form}
100
102
  names={{
@@ -116,7 +118,7 @@ export function SignUpForm(props: SignUpFormProps) {
116
118
  control={control}
117
119
  name='input.is_subscribed'
118
120
  disabled={formState.isSubmitting}
119
- label={<Trans id='Subscribe to newsletter'>Subscribe to newsletter</Trans>}
121
+ label={<Trans>Subscribe to newsletter</Trans>}
120
122
  />
121
123
 
122
124
  <ApolloCustomerErrorSnackbar error={error} />
@@ -130,7 +132,7 @@ export function SignUpForm(props: SignUpFormProps) {
130
132
  size='large'
131
133
  loading={formState.isSubmitting}
132
134
  >
133
- <Trans id='Create Account'>Create Account</Trans>
135
+ <Trans>Create Account</Trans>
134
136
  </Button>
135
137
  </FormActions>
136
138
  <FormPersist form={form} name='SignUp' exclude={['input.password', 'confirmPassword']} />
@@ -4,7 +4,7 @@ import { graphqlErrorByCategory } from '@graphcommerce/magento-graphql'
4
4
  import { StoreConfigDocument } from '@graphcommerce/magento-store'
5
5
  import { Button, extendableComponent, Form, FormRow } from '@graphcommerce/next-ui'
6
6
  import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
7
- import { Trans } from '@lingui/react'
7
+ import { Trans } from '@lingui/react/macro'
8
8
  import { Alert, Box } from '@mui/material'
9
9
  import React from 'react'
10
10
  import { useSignInForm } from '../../hooks/useSignInForm'
@@ -68,10 +68,7 @@ export function SignUpFormInline(props: SignUpFormInlineProps) {
68
68
  ) {
69
69
  return (
70
70
  <Alert>
71
- <Trans
72
- id='Registration successful. Please check your inbox to confirm your email address ({email})'
73
- values={{ email }}
74
- />
71
+ <Trans>Registration successful. Please check your inbox to confirm your email address ({email})</Trans>
75
72
  </Alert>
76
73
  )
77
74
  }
@@ -84,7 +81,7 @@ export function SignUpFormInline(props: SignUpFormInlineProps) {
84
81
  name='password'
85
82
  autoComplete='new-password'
86
83
  variant='outlined'
87
- label={<Trans id='Password' />}
84
+ label={<Trans>Password</Trans>}
88
85
  required={required.password}
89
86
  disabled={formState.isSubmitting}
90
87
  error={!!inputError}
@@ -96,7 +93,7 @@ export function SignUpFormInline(props: SignUpFormInlineProps) {
96
93
  passwordFieldName='password'
97
94
  autoComplete='new-password'
98
95
  variant='outlined'
99
- label={<Trans id='Confirm password' />}
96
+ label={<Trans>Confirm password</Trans>}
100
97
  required
101
98
  disabled={formState.isSubmitting}
102
99
  />
@@ -121,7 +118,7 @@ export function SignUpFormInline(props: SignUpFormInlineProps) {
121
118
  color='secondary'
122
119
  variant='pill'
123
120
  >
124
- <Trans id='Create Account' />
121
+ <Trans>Create Account</Trans>
125
122
  </Button>
126
123
  </Box>
127
124
  </FormRow>
@@ -1,5 +1,5 @@
1
1
  import { iconLocation, IconSvg } from '@graphcommerce/next-ui'
2
- import { Trans } from '@lingui/react'
2
+ import { Trans } from '@lingui/react/macro'
3
3
  import type { SxProps, Theme } from '@mui/material'
4
4
  import { Box, Link, Typography } from '@mui/material'
5
5
  import type { TrackingLinkFragment } from './TrackingLink.gql'
@@ -32,7 +32,7 @@ export function TrackingLink(props: TrackingLinkProps) {
32
32
  sx={{ display: 'inline-flex', alignItems: 'center' }}
33
33
  >
34
34
  <IconSvg src={iconLocation} size='small' />
35
- <Trans id='Follow order' />
35
+ <Trans>Follow order</Trans>
36
36
  </Link>
37
37
  )}
38
38
 
@@ -10,8 +10,8 @@ import {
10
10
  MessageSnackbar,
11
11
  } from '@graphcommerce/next-ui'
12
12
  import { emailPattern, useFormGqlMutation } from '@graphcommerce/react-hook-form'
13
- import { i18n } from '@lingui/core'
14
- import { Trans } from '@lingui/react'
13
+ import { t } from '@lingui/core/macro'
14
+ import { Trans } from '@lingui/react/macro'
15
15
  import { ApolloCustomerErrorSnackbar } from '../ApolloCustomerError'
16
16
  import type {
17
17
  UpdateCustomerEmailMutation,
@@ -57,7 +57,7 @@ export function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormProps) {
57
57
  <TextFieldElement
58
58
  variant='outlined'
59
59
  type='text'
60
- label={<Trans id='Current email' />}
60
+ label={<Trans>Current email</Trans>}
61
61
  required
62
62
  name='currentEmail'
63
63
  control={control}
@@ -73,7 +73,7 @@ export function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormProps) {
73
73
  autoComplete='off'
74
74
  error={formState.isSubmitted && !!formState.errors.email}
75
75
  helperText={formState.isSubmitted && formState.errors.email?.message}
76
- label={<Trans id='New email' />}
76
+ label={<Trans>New email</Trans>}
77
77
  required={required.email}
78
78
  name='email'
79
79
  rules={{
@@ -90,12 +90,12 @@ export function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormProps) {
90
90
  autoComplete='off'
91
91
  error={formState.isSubmitted && !!formState.errors.confirmEmail}
92
92
  helperText={formState.isSubmitted && formState.errors.confirmEmail?.message}
93
- label={<Trans id='Confirm new email' />}
93
+ label={<Trans>Confirm new email</Trans>}
94
94
  required
95
95
  name='confirmEmail'
96
96
  rules={{
97
97
  required: true,
98
- validate: (value) => value === watchNewEmail || i18n._(/* i18n */ "Emails don't match"),
98
+ validate: (value) => value === watchNewEmail || t`Emails don't match`,
99
99
  }}
100
100
  showValid
101
101
  control={control}
@@ -107,7 +107,7 @@ export function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormProps) {
107
107
  control={control}
108
108
  variant='outlined'
109
109
  name='password'
110
- label={<Trans id='Password' />}
110
+ label={<Trans>Password</Trans>}
111
111
  autoComplete='current-password'
112
112
  required={required.password}
113
113
  disabled={formState.isSubmitting}
@@ -127,7 +127,7 @@ export function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormProps) {
127
127
  size='large'
128
128
  loading={formState.isSubmitting}
129
129
  >
130
- <Trans id='Save changes' />
130
+ <Trans>Save changes</Trans>
131
131
  </Button>
132
132
  </FormActions>
133
133
 
@@ -137,7 +137,7 @@ export function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormProps) {
137
137
  sticky
138
138
  open={formState.isSubmitSuccessful && !formState.isSubmitting && !error}
139
139
  >
140
- <Trans id='Successfully updated email' />
140
+ <Trans>Successfully updated email</Trans>
141
141
  </MessageSnackbar>
142
142
  </Form>
143
143
  )
@@ -1,5 +1,5 @@
1
1
  import { Controller, FormAutoSubmit, useFormGqlMutation } from '@graphcommerce/react-hook-form'
2
- import { Trans } from '@lingui/react'
2
+ import { Trans } from '@lingui/react/macro'
3
3
  // eslint-disable-next-line @typescript-eslint/no-restricted-imports
4
4
  import { FormControl, FormControlLabel, FormHelperText, Switch } from '@mui/material'
5
5
  import React, { useEffect, useMemo } from 'react'
@@ -47,7 +47,7 @@ export function UpdateDefaultAddressForm(props: UpdateDefaultAddressFormProps) {
47
47
  <FormControl error={!!formState.errors.defaultShipping}>
48
48
  <FormControlLabel
49
49
  control={<Switch color='primary' />}
50
- label={<Trans id='Shipping address' />}
50
+ label={<Trans>Shipping address</Trans>}
51
51
  checked={value}
52
52
  inputRef={ref}
53
53
  onBlur={onBlur}
@@ -68,7 +68,7 @@ export function UpdateDefaultAddressForm(props: UpdateDefaultAddressFormProps) {
68
68
  <FormControl error={!!formState.errors.defaultBilling}>
69
69
  <FormControlLabel
70
70
  control={<Switch color='primary' />}
71
- label={<Trans id='Billing address' />}
71
+ label={<Trans>Billing address</Trans>}
72
72
  checked={value}
73
73
  inputRef={ref}
74
74
  onBlur={onBlur}
@@ -3,13 +3,13 @@ import { PasswordElement } from '@graphcommerce/ecommerce-ui'
3
3
  import { useQuery } from '@graphcommerce/graphql'
4
4
  import { StoreConfigDocument } from '@graphcommerce/magento-store'
5
5
  import type { FieldValues } from '@graphcommerce/react-hook-form'
6
- import { i18n } from '@lingui/core'
6
+ import { t } from '@lingui/core/macro'
7
7
 
8
8
  export type ValidatedPasswordElementProps<T extends FieldValues> = PasswordElementProps<T>
9
9
 
10
10
  export function ValidatedPasswordElement<TFieldValues extends FieldValues>(
11
11
  props: PasswordElementProps<TFieldValues>,
12
- ): JSX.Element {
12
+ ): React.ReactNode {
13
13
  const { ...textFieldProps } = props
14
14
 
15
15
  const storeConfig = useQuery(StoreConfigDocument).data?.storeConfig
@@ -20,9 +20,7 @@ export function ValidatedPasswordElement<TFieldValues extends FieldValues>(
20
20
 
21
21
  rules.minLength = {
22
22
  value: minPasswordLength,
23
- message: i18n._(/* i18n */ 'Password must have at least {minPasswordLength} characters', {
24
- minPasswordLength,
25
- }),
23
+ message: t`Password must have at least ${minPasswordLength} characters`,
26
24
  }
27
25
 
28
26
  rules.validate = (value: string) => {
@@ -35,10 +33,7 @@ export function ValidatedPasswordElement<TFieldValues extends FieldValues>(
35
33
  if (pass.match(/[^a-zA-Z0-9]+/)) counter++
36
34
 
37
35
  if (counter < passwordMinCharacterSets) {
38
- return i18n._(
39
- /* i18n */ 'Minimum of different classes of characters in password is {passwordMinCharacterSets}. Classes of characters: Lower Case, Upper Case, Digits, Special Characters.',
40
- { passwordMinCharacterSets },
41
- )
36
+ return t`Minimum of different classes of characters in password is ${passwordMinCharacterSets}. Classes of characters: Lower Case, Upper Case, Digits, Special Characters.`
42
37
  }
43
38
 
44
39
  return true
@@ -1,8 +1,8 @@
1
1
  import type { WaitForQueriesProps } from '@graphcommerce/ecommerce-ui'
2
2
  import { mergeErrors, WaitForQueries } from '@graphcommerce/ecommerce-ui'
3
3
  import type { FullPageMessageProps } from '@graphcommerce/next-ui'
4
- import { FullPageMessage, iconPerson, IconSvg } from '@graphcommerce/next-ui'
5
- import { Trans } from '@lingui/react'
4
+ import { FullPageMessage, iconPerson, IconSvg, nonNullable } from '@graphcommerce/next-ui'
5
+ import { Trans } from '@lingui/react/macro'
6
6
  import { Button, CircularProgress } from '@mui/material'
7
7
  import React from 'react'
8
8
  import type { SetOptional } from 'type-fest'
@@ -15,10 +15,6 @@ export type WaitForCustomerProps = SetOptional<WaitForQueriesProps, 'waitFor'> &
15
15
  allowError?: boolean
16
16
  }
17
17
 
18
- export function nonNullable<T>(value: T): value is NonNullable<T> {
19
- return value !== null && value !== undefined
20
- }
21
-
22
18
  /**
23
19
  * A full page wrapper to render customer specific information.
24
20
  *
@@ -65,10 +61,10 @@ export function WaitForCustomer(props: WaitForCustomerProps) {
65
61
  fallback ?? (
66
62
  <FullPageMessage
67
63
  icon={<CircularProgress />}
68
- title={<Trans id='Loading your data' />}
64
+ title={<Trans>Loading your data</Trans>}
69
65
  {...rest}
70
66
  >
71
- <Trans id='This may take a second' />
67
+ <Trans>This may take a second</Trans>
72
68
  </FullPageMessage>
73
69
  )
74
70
  }
@@ -77,13 +73,13 @@ export function WaitForCustomer(props: WaitForCustomerProps) {
77
73
  (unauthenticated ?? (
78
74
  <FullPageMessage
79
75
  icon={<IconSvg src={iconPerson} size='xxl' />}
80
- title={<Trans id='You must sign in to continue' />}
76
+ title={<Trans>You must sign in to continue</Trans>}
81
77
  button={
82
78
  <Button href='/account/signin' variant='pill' color='secondary' size='large'>
83
79
  {!session.valid ? (
84
- <Trans id='Sign in' />
80
+ <Trans>Sign in</Trans>
85
81
  ) : (
86
- <Trans id='Sign in or create an account!' />
82
+ <Trans>Sign in or create an account!</Trans>
87
83
  )}
88
84
  </Button>
89
85
  }
@@ -19,6 +19,7 @@ export * from './CompanyFields'
19
19
  export * from './ConfirmCustomer/ConfirmCustomerForm'
20
20
  export * from './ContactForm/ContactForm'
21
21
  export * from './CreateCustomerAddressForm/CreateCustomerAddressForm'
22
+ export * from './CreateCustomerAddressForm/CustomerAddress.gql'
22
23
  export * from './CreditMemo'
23
24
  export * from './CustomerFab/CustomerFab'
24
25
  export * from './CustomerForms'
package/graphql/index.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export * from './fragments/AccountDashboardQueryFragment.gql'
2
+ export * from './fragments/AccountDashboardQueryFragment.gql'
2
3
  export * from './queries/AccountDashboard.gql'
3
4
  export * from './queries/AccountDashboardAddresses.gql'
4
5
  export * from './queries/AccountDashboardCustomer.gql'
@@ -1,5 +1,6 @@
1
1
  import { usePageContext } from '@graphcommerce/framer-next-pages'
2
2
  import { useQuery } from '@graphcommerce/graphql'
3
+ import { enableGuestCheckoutLogin } from '@graphcommerce/next-config/config'
3
4
  import { useUrlQuery } from '@graphcommerce/next-ui'
4
5
  import { useFormGqlQuery } from '@graphcommerce/react-hook-form'
5
6
  import { useEffect } from 'react'
@@ -20,7 +21,7 @@ export function useAccountSignInUpForm(props: UseFormIsEmailAvailableProps = {})
20
21
  const { token, valid } = useCustomerSession()
21
22
 
22
23
  const canSignUp = useCustomerAccountCanSignUp()
23
- const isToggleMethod = !import.meta.graphCommerce.enableGuestCheckoutLogin || !canSignUp
24
+ const isToggleMethod = !enableGuestCheckoutLogin || !canSignUp
24
25
 
25
26
  const [queryState, setRouterQuery] = useUrlQuery<{ email?: string | null }>()
26
27
 
@@ -1,10 +1,9 @@
1
+ import { permissions } from '@graphcommerce/next-config/config'
1
2
  import { useStorefrontConfig } from '@graphcommerce/next-ui'
2
3
 
3
4
  function useCustomerAccountPermission() {
4
5
  return (
5
- useStorefrontConfig().permissions?.customerAccount ??
6
- import.meta.graphCommerce.permissions?.customerAccount ??
7
- 'ENABLED'
6
+ useStorefrontConfig().permissions?.customerAccount ?? permissions?.customerAccount ?? 'ENABLED'
8
7
  )
9
8
  }
10
9