@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
package/CHANGELOG.md CHANGED
@@ -1,5 +1,93 @@
1
1
  # Change Log
2
2
 
3
+ ## 10.0.0-canary.56
4
+
5
+ ### Major Changes
6
+
7
+ - [#2546](https://github.com/graphcommerce-org/graphcommerce/pull/2546) [`ed9332a`](https://github.com/graphcommerce-org/graphcommerce/commit/ed9332a7f78966d932041d9a7725641edc92b28d) - ## GraphCommerce 10 - Turbopack Support
8
+
9
+ This major release brings full Turbopack compatibility, dramatically improving development speed.
10
+
11
+ ### 🚀 Turbopack-Compatible Interceptor System
12
+
13
+ The entire plugin/interceptor system has been rewritten to work with Turbopack:
14
+
15
+ - **No more Webpack plugins** - Removed `InterceptorPlugin` webpack plugin entirely
16
+ - **File-based interception** - Original files are moved to `.original.tsx` and replaced with interceptor content
17
+ - **Direct imports** - Interceptors import from `.original` files instead of embedding source
18
+ - **New CLI commands**:
19
+ - `graphcommerce codegen-interceptors` - Generate interceptor files
20
+ - `graphcommerce cleanup-interceptors` - Reset interceptor system, restore original files
21
+ - **Stable file hashing** - Deterministic interceptor generation for better caching
22
+
23
+ ### ⚙️ Treeshakable Configuration System
24
+
25
+ Replaced Webpack `DefinePlugin`-based `import.meta.graphCommerce` with a new generated configuration system:
26
+
27
+ - **New `codegen-config-values` command** - Generates TypeScript files with precise typing
28
+ - **Schema-driven** - Dynamically introspects Zod schemas to determine all available properties
29
+ - **Fully treeshakable** - Unused config values are eliminated from the bundle
30
+ - **Type-safe** - Uses `Get<GraphCommerceConfig, 'path'>` for nested property access
31
+ - **Separate files for nested objects** - Optimal treeshaking for complex configurations
32
+
33
+ ### 🔧 withGraphCommerce Changes
34
+
35
+ - **Removed** `InterceptorPlugin` - No longer needed with file-based interception
36
+ - **Removed** `DefinePlugin` for `import.meta.graphCommerce` - Replaced with generated config
37
+ - **Removed** `@mui/*` alias rewrites - No longer required
38
+ - **Added** Turbopack loader rules for `.yaml`, `.yml`, and `.po` files
39
+ - **Added** `serverExternalPackages` for all `@whatwg-node/*` packages
40
+ - **Added** `optimizePackageImports` for better bundle optimization
41
+ - **Added** `images.qualities: [52, 75]` for Next.js image optimization
42
+
43
+ ### 📦 Lingui Configuration
44
+
45
+ - **Renamed** `lingui.config.js` → `lingui.config.ts` with TypeScript support
46
+ - **Updated** `@graphcommerce/lingui-next/config` to TypeScript with proper exports
47
+ - **Simplified** formatter options
48
+
49
+ ### ⚛️ React 19 & Next.js 16 Compatibility
50
+
51
+ - Updated `RefObject<T>` types for React 19 (now includes `null` by default)
52
+ - Replaced deprecated `React.VFC` with `React.FC`
53
+ - Fixed `useRef` calls to require explicit initial values
54
+ - Updated `MutableRefObject` usage in `framer-scroller`
55
+
56
+ ### 📋 ESLint 9 Flat Config
57
+
58
+ - Migrated from legacy `.eslintrc` to new flat config format (`eslint.config.mjs`)
59
+ - Updated `@typescript-eslint/*` packages to v8
60
+ - Fixed AST selector for `SxProps` rule (`typeParameters` → `typeArguments`)
61
+
62
+ ### 🔄 Apollo Client
63
+
64
+ - Fixed deprecated `name` option → `clientAwareness: { name: 'ssr' }`
65
+ - Updated error handling types to accept `ApolloError | null | undefined`
66
+
67
+ ### ⚠️ Breaking Changes
68
+
69
+ - **Node.js 24.x not supported** - Restricted to `>=20 <24.0.0` due to [nodejs/undici#4290](https://github.com/nodejs/undici/issues/4290)
70
+ - **Interceptor files changed** - Original components now at `.original.tsx`
71
+ - **Config access changed** - Use generated config values instead of `import.meta.graphCommerce`
72
+ - **ESLint config format** - Must use flat config (`eslint.config.mjs`)
73
+ - **Lingui config** - Rename `lingui.config.js` to `lingui.config.ts`
74
+
75
+ ### 🗑️ Removed
76
+
77
+ - `InterceptorPlugin` webpack plugin
78
+ - `configToImportMeta` utility
79
+ - Webpack `DefinePlugin` usage for config
80
+ - `@mui/*` modern alias rewrites
81
+ - Debug plugins (`CircularDependencyPlugin`, `DuplicatesPlugin`) ([@paales](https://github.com/paales))
82
+
83
+ ## 9.1.0-canary.55
84
+
85
+ ### Patch Changes
86
+
87
+ - [#2539](https://github.com/graphcommerce-org/graphcommerce/pull/2539) [`427833d`](https://github.com/graphcommerce-org/graphcommerce/commit/427833d3fa46ec6096853bdc3dfd81321df6e63b) - Forward address field props ([@paales](https://github.com/paales))
88
+
89
+ - [#2539](https://github.com/graphcommerce-org/graphcommerce/pull/2539) [`183d8dd`](https://github.com/graphcommerce-org/graphcommerce/commit/183d8ddef6059f07ffe585b0f05a51731b12b371) - Remove odd nonNullable that is also available in @graphcommmerce/next-ui ([@paales](https://github.com/paales))
90
+
3
91
  ## 9.1.0-canary.54
4
92
 
5
93
  ## 9.1.0-canary.53
@@ -1,5 +1,5 @@
1
1
  import { extendableComponent } 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 } from '@mui/material'
5
5
  import { AddressMultiLine } from '../AddressMultiLine/AddressMultiLine'
@@ -46,7 +46,7 @@ export function AccountAddress(props: AccountAddressProps) {
46
46
  }}
47
47
  >
48
48
  <Link href={`/account/addresses/edit?addressId=${id}`} color='primary' underline='hover'>
49
- <Trans id='Edit' />
49
+ <Trans>Edit</Trans>
50
50
  </Link>
51
51
  <DeleteCustomerAddressForm addressId={id ?? undefined} />
52
52
  </Box>
@@ -6,7 +6,7 @@ import {
6
6
  IconSvg,
7
7
  SectionContainer,
8
8
  } from '@graphcommerce/next-ui'
9
- import { Trans } from '@lingui/react'
9
+ import { Trans } from '@lingui/react/macro'
10
10
  import type { SxProps, Theme } from '@mui/material'
11
11
  import { Box, Button, Skeleton } from '@mui/material'
12
12
  import { AccountAddress } from '../AccountAddress/AccountAddress'
@@ -29,7 +29,7 @@ export function AccountAddresses(props: AccountAddressesProps) {
29
29
  if (loading) {
30
30
  return (
31
31
  <SectionContainer
32
- labelLeft={<Trans id='Shipping addresses' />}
32
+ labelLeft={<Trans>Shipping addresses</Trans>}
33
33
  sx={sx}
34
34
  className={classes.root}
35
35
  >
@@ -53,7 +53,7 @@ export function AccountAddresses(props: AccountAddressesProps) {
53
53
  margin: `${theme.spacings.md} auto`,
54
54
  })}
55
55
  >
56
- <Trans id='Add new address' />
56
+ <Trans>Add new address</Trans>
57
57
  </Button>
58
58
  </SectionContainer>
59
59
  )
@@ -63,18 +63,18 @@ export function AccountAddresses(props: AccountAddressesProps) {
63
63
  <>
64
64
  {addresses.length === 0 && (
65
65
  <FullPageMessage
66
- title={<Trans id='You have no addresses saved yet' />}
66
+ title={<Trans>You have no addresses saved yet</Trans>}
67
67
  icon={<IconSvg src={iconHome} size='xxl' />}
68
68
  button={
69
69
  <Button href='/account/addresses/add' size='large' variant='pill' color='primary'>
70
- <Trans id='Add new address' />
70
+ <Trans>Add new address</Trans>
71
71
  </Button>
72
72
  }
73
73
  />
74
74
  )}
75
75
 
76
76
  {addresses.length >= 1 && (
77
- <SectionContainer labelLeft={<Trans id='Shipping addresses' />}>
77
+ <SectionContainer labelLeft={<Trans>Shipping addresses</Trans>}>
78
78
  <Box
79
79
  className={classes.addresses}
80
80
  sx={(theme) => ({ '& > div': { borderBottom: `1px solid ${theme.palette.divider}` } })}
@@ -96,7 +96,7 @@ export function AccountAddresses(props: AccountAddressesProps) {
96
96
  margin: `${theme.spacings.md} auto`,
97
97
  })}
98
98
  >
99
- <Trans id='Add new address' />
99
+ <Trans>Add new address</Trans>
100
100
  </Button>
101
101
  </SectionContainer>
102
102
  )}
@@ -2,7 +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 { t, Trans } from '@lingui/macro'
5
+ import { Trans } from '@lingui/react/macro'
6
+ import { t } from '@lingui/core/macro'
6
7
  import { Box, Typography } from '@mui/material'
7
8
  import { useRouter } from 'next/router'
8
9
  import { CustomerDocument, CustomerTokenDocument, useCustomerQuery } from '../../hooks'
@@ -1,5 +1,6 @@
1
1
  import { ActionCardListForm, EmailElement, FormAutoSubmit } from '@graphcommerce/ecommerce-ui'
2
2
  import { useApolloClient } from '@graphcommerce/graphql'
3
+ import { enableGuestCheckoutLogin } from '@graphcommerce/next-config/config'
3
4
  import {
4
5
  ActionCard,
5
6
  Button,
@@ -9,7 +10,7 @@ import {
9
10
  FormRow,
10
11
  LayoutTitle,
11
12
  } from '@graphcommerce/next-ui'
12
- import { Trans } from '@lingui/react'
13
+ import { Trans } from '@lingui/react/macro'
13
14
  import type { SxProps, Theme } from '@mui/material'
14
15
  import { Alert, Box, CircularProgress, Link, Typography } from '@mui/material'
15
16
  import { useRouter } from 'next/router'
@@ -48,7 +49,7 @@ export function AccountSignInUpForm(props: AccountSignInUpFormProps) {
48
49
  const client = useApolloClient()
49
50
 
50
51
  const canSignUp = useCustomerAccountCanSignUp()
51
- const isToggleMethod = !import.meta.graphCommerce.enableGuestCheckoutLogin || !canSignUp
52
+ const isToggleMethod = !enableGuestCheckoutLogin || !canSignUp
52
53
 
53
54
  const showEmail =
54
55
  mode === 'email' ||
@@ -67,10 +68,10 @@ export function AccountSignInUpForm(props: AccountSignInUpFormProps) {
67
68
  {mode === 'email' && (
68
69
  <>
69
70
  <LayoutTitle variant='h2' gutterBottom={false}>
70
- <Trans id='Sign in or create an account!' />
71
+ <Trans>Sign in or create an account!</Trans>
71
72
  </LayoutTitle>
72
73
  <Typography variant='h6' align='center'>
73
- <Trans id='Fill in your e-mail to login or create an account' />
74
+ <Trans>Fill in your e-mail to login or create an account</Trans>
74
75
  </Typography>
75
76
  </>
76
77
  )}
@@ -78,10 +79,10 @@ export function AccountSignInUpForm(props: AccountSignInUpFormProps) {
78
79
  {(mode === 'signin' || (mode === 'signup' && !canSignUp)) && (
79
80
  <>
80
81
  <LayoutTitle variant='h2' gutterBottom={false}>
81
- <Trans id='Sign in' />
82
+ <Trans>Sign in</Trans>
82
83
  </LayoutTitle>
83
84
  <Typography variant='h6' align='center'>
84
- <Trans id='Fill in your password' />
85
+ <Trans>Fill in your password</Trans>
85
86
  </Typography>
86
87
  </>
87
88
  )}
@@ -89,10 +90,10 @@ export function AccountSignInUpForm(props: AccountSignInUpFormProps) {
89
90
  {mode === 'signup' && canSignUp && (
90
91
  <>
91
92
  <LayoutTitle variant='h2' gutterBottom={false}>
92
- <Trans id='Create account!' />
93
+ <Trans>Create account!</Trans>
93
94
  </LayoutTitle>
94
95
  <Typography variant='h6' align='center'>
95
- <Trans id='Create a password and tell us your name' />
96
+ <Trans>Create a password and tell us your name</Trans>
96
97
  </Typography>
97
98
  </>
98
99
  )}
@@ -100,17 +101,17 @@ export function AccountSignInUpForm(props: AccountSignInUpFormProps) {
100
101
  {mode === 'signedin' && (
101
102
  <>
102
103
  <LayoutTitle variant='h2' gutterBottom={false}>
103
- <Trans id='Hi {firstname}! You’re now logged in!' values={{ firstname }} />
104
+ <Trans>Hi {firstname}! You’re now logged in!</Trans>
104
105
  </LayoutTitle>
105
106
  <Typography variant='h6' align='center'>
106
107
  <Link href='/account' underline='hover' color='secondary'>
107
- <Trans id='View your account' />
108
+ <Trans>View your account</Trans>
108
109
  </Link>
109
110
  </Typography>
110
111
 
111
112
  <FormActions>
112
113
  <Button onClick={() => router.back()} variant='pill' color='secondary' size='large'>
113
- <Trans id='Continue shopping' />
114
+ <Trans>Continue shopping</Trans>
114
115
  </Button>
115
116
  </FormActions>
116
117
  </>
@@ -119,10 +120,10 @@ export function AccountSignInUpForm(props: AccountSignInUpFormProps) {
119
120
  {mode === 'session-expired' && (
120
121
  <>
121
122
  <LayoutTitle variant='h2' gutterBottom={false}>
122
- <Trans id='Your session is expired' />
123
+ <Trans>Your session is expired</Trans>
123
124
  </LayoutTitle>
124
125
  <Typography variant='h6' align='center'>
125
- <Trans id='Log in to continue shopping' />
126
+ <Trans>Log in to continue shopping</Trans>
126
127
  </Typography>
127
128
  </>
128
129
  )}
@@ -146,8 +147,8 @@ export function AccountSignInUpForm(props: AccountSignInUpFormProps) {
146
147
  },
147
148
  })}
148
149
  items={[
149
- { value: 'signin', title: <Trans id='Sign in' /> },
150
- { value: 'signup', title: <Trans id='Create Account' /> },
150
+ { value: 'signin', title: <Trans>Sign in</Trans> },
151
+ { value: 'signup', title: <Trans>Create Account</Trans> },
151
152
  ]}
152
153
  />
153
154
  </FormRow>
@@ -177,7 +178,7 @@ export function AccountSignInUpForm(props: AccountSignInUpFormProps) {
177
178
  form.resetField('email')
178
179
  }}
179
180
  >
180
- <Trans id='Sign out' />
181
+ <Trans>Sign out</Trans>
181
182
  </Button>
182
183
  ) : (
183
184
  formState.isSubmitting && <CircularProgress sx={{ display: 'inline-flex' }} />
@@ -200,7 +201,7 @@ export function AccountSignInUpForm(props: AccountSignInUpFormProps) {
200
201
  color='primary'
201
202
  size='large'
202
203
  >
203
- <Trans id='Continue' />
204
+ <Trans>Continue</Trans>
204
205
  </Button>
205
206
  </FormActions>
206
207
  </Box>
@@ -223,7 +224,7 @@ export function AccountSignInUpForm(props: AccountSignInUpFormProps) {
223
224
  <Box>
224
225
  {signUpDisabled || (
225
226
  <Alert severity='success'>
226
- <Trans id='Sign up is disabled, please contact us for more information.' />
227
+ <Trans>Sign up is disabled, please contact us for more information.</Trans>
227
228
  </Alert>
228
229
  )}
229
230
  </Box>
@@ -1,6 +1,6 @@
1
1
  import type { FieldPath, FieldValues } from '@graphcommerce/ecommerce-ui'
2
2
  import { TextFieldElement } from '@graphcommerce/ecommerce-ui'
3
- import { Trans } from '@lingui/react'
3
+ import { Trans } from '@lingui/react/macro'
4
4
  import type { AddressFieldsOptions } from './useAddressFieldsForm'
5
5
  import { useAddressFieldsForm } from './useAddressFieldsForm'
6
6
 
@@ -13,12 +13,13 @@ export function AddressAddition<
13
13
 
14
14
  return (
15
15
  <TextFieldElement
16
+ {...props}
16
17
  control={control}
17
18
  name={name.addition}
18
19
  variant='outlined'
19
20
  type='text'
20
21
  required={required[name.addition]}
21
- label={<Trans id='Addition' />}
22
+ label={<Trans>Addition</Trans>}
22
23
  autoComplete='address-line3'
23
24
  showValid
24
25
  InputProps={{ readOnly }}
@@ -1,6 +1,6 @@
1
1
  import type { FieldPath, FieldValues } from '@graphcommerce/ecommerce-ui'
2
2
  import { TextFieldElement } from '@graphcommerce/ecommerce-ui'
3
- import { Trans } from '@lingui/react'
3
+ import { Trans } from '@lingui/react/macro'
4
4
  import type { AddressFieldsOptions } from './useAddressFieldsForm'
5
5
  import { useAddressFieldsForm } from './useAddressFieldsForm'
6
6
 
@@ -13,12 +13,13 @@ export function AddressCity<
13
13
 
14
14
  return (
15
15
  <TextFieldElement
16
+ {...props}
16
17
  control={control}
17
18
  name={name.city}
18
19
  variant='outlined'
19
20
  type='text'
20
21
  required={required[name.city]}
21
- label={<Trans id='City' />}
22
+ label={<Trans>City</Trans>}
22
23
  showValid
23
24
  InputProps={{ readOnly }}
24
25
  />
@@ -3,7 +3,7 @@ import { SelectElement, TextFieldElement, useWatch } from '@graphcommerce/ecomme
3
3
  import { useQuery } from '@graphcommerce/graphql'
4
4
  import { CountryRegionsDocument } from '@graphcommerce/magento-store'
5
5
  import { filterNonNullableKeys, FormRow } from '@graphcommerce/next-ui'
6
- import { Trans } from '@lingui/react'
6
+ import { Trans } from '@lingui/react/macro'
7
7
  import { useMemo } from 'react'
8
8
  import type { AddressFieldsOptions } from './useAddressFieldsForm'
9
9
  import { useAddressFieldsForm } from './useAddressFieldsForm'
@@ -52,7 +52,7 @@ export function AddressCountryRegionBase(props: AddressFieldsOptions) {
52
52
  return (
53
53
  <FormRow>
54
54
  <TextFieldElement
55
- label={<Trans id='Country' />}
55
+ label={<Trans>Country</Trans>}
56
56
  control={control}
57
57
  required={required[name.countryCode]}
58
58
  name={name.countryCode}
@@ -70,7 +70,7 @@ export function AddressCountryRegionBase(props: AddressFieldsOptions) {
70
70
  name={name.countryCode}
71
71
  SelectProps={{ autoWidth: true }}
72
72
  variant='outlined'
73
- label={<Trans id='Country' />}
73
+ label={<Trans>Country</Trans>}
74
74
  required={required[name.countryCode]}
75
75
  showValid
76
76
  InputProps={{ readOnly }}
@@ -85,7 +85,7 @@ export function AddressCountryRegionBase(props: AddressFieldsOptions) {
85
85
  control={control}
86
86
  name={name.regionId}
87
87
  variant='outlined'
88
- label={<Trans id='Region' />}
88
+ label={<Trans>Region</Trans>}
89
89
  required
90
90
  showValid
91
91
  InputProps={{ readOnly }}
@@ -1,7 +1,7 @@
1
1
  import type { FieldPath, FieldValues } from '@graphcommerce/ecommerce-ui'
2
2
  import { houseNumberPattern, TextFieldElement } from '@graphcommerce/ecommerce-ui'
3
- import { i18n } from '@lingui/core'
4
- import { Trans } from '@lingui/react'
3
+ import { t } from '@lingui/core/macro'
4
+ import { Trans } from '@lingui/react/macro'
5
5
  import type { AddressFieldsOptions } from './useAddressFieldsForm'
6
6
  import { useAddressFieldsForm } from './useAddressFieldsForm'
7
7
 
@@ -13,18 +13,19 @@ export function AddressHousenumber<
13
13
  const { control, name, readOnly, required } = form
14
14
  return (
15
15
  <TextFieldElement
16
+ {...props}
16
17
  control={control}
17
18
  name={name.houseNumber}
18
19
  required={required[name.houseNumber]}
19
20
  rules={{
20
21
  pattern: {
21
22
  value: houseNumberPattern,
22
- message: i18n._(/* i18n */ 'Please provide a valid house number'),
23
+ message: t`Please provide a valid house number`,
23
24
  },
24
25
  }}
25
26
  variant='outlined'
26
27
  type='text'
27
- label={<Trans id='Housenumber' />}
28
+ label={<Trans>Housenumber</Trans>}
28
29
  autoComplete='address-line2'
29
30
  showValid
30
31
  InputProps={{ readOnly }}
@@ -1,6 +1,6 @@
1
1
  import type { FieldPath, FieldValues } from '@graphcommerce/ecommerce-ui'
2
2
  import { TextFieldElement } from '@graphcommerce/ecommerce-ui'
3
- import { Trans } from '@lingui/macro'
3
+ import { Trans } from '@lingui/react/macro'
4
4
  import type { AddressFieldsOptions } from './useAddressFieldsForm'
5
5
  import { useAddressFieldsForm } from './useAddressFieldsForm'
6
6
 
@@ -13,6 +13,7 @@ export function AddressPostcode<
13
13
 
14
14
  return (
15
15
  <TextFieldElement
16
+ {...props}
16
17
  control={control}
17
18
  name={name.postcode}
18
19
  variant='outlined'
@@ -1,6 +1,6 @@
1
1
  import { TextFieldElement } from '@graphcommerce/ecommerce-ui'
2
2
  import type { FieldPath, FieldValues } from '@graphcommerce/react-hook-form'
3
- import { Trans } from '@lingui/react'
3
+ import { Trans } from '@lingui/react/macro'
4
4
  import type { AddressFieldsOptions } from './useAddressFieldsForm'
5
5
  import { useAddressFieldsForm } from './useAddressFieldsForm'
6
6
 
@@ -12,12 +12,13 @@ export function AddressStreet<
12
12
  const { control, name, readOnly, required } = form
13
13
  return (
14
14
  <TextFieldElement
15
+ {...props}
15
16
  variant='outlined'
16
17
  control={control}
17
18
  required={required[name.street]}
18
19
  name={name.street}
19
20
  type='text'
20
- label={<Trans id='Street' />}
21
+ label={<Trans>Street</Trans>}
21
22
  autoComplete='address-line1'
22
23
  showValid
23
24
  InputProps={{ readOnly }}
@@ -1,7 +1,7 @@
1
1
  import type { ApolloErrorAlertProps } from '@graphcommerce/ecommerce-ui'
2
2
  import { ApolloErrorAlert } from '@graphcommerce/ecommerce-ui'
3
3
  import { Button } from '@graphcommerce/next-ui'
4
- import { Trans } from '@lingui/react'
4
+ import { Trans } from '@lingui/react/macro'
5
5
  import { useAuthorizationErrorMasked } from './useAuthorizationErrorMasked'
6
6
 
7
7
  export type ApolloCustomerErrorAlertProps = ApolloErrorAlertProps
@@ -19,7 +19,7 @@ export function ApolloCustomerErrorAlert(props: ApolloCustomerErrorAlertProps) {
19
19
  <>
20
20
  {graphqlErrorAlertProps?.action}
21
21
  <Button href='/account/signin' color='error' size='small'>
22
- <Trans id='Sign in' />
22
+ <Trans>Sign in</Trans>
23
23
  </Button>
24
24
  </>
25
25
  ) : (
@@ -1,7 +1,7 @@
1
1
  import type { ApolloErrorFullPageProps } from '@graphcommerce/ecommerce-ui'
2
2
  import { ApolloErrorFullPage } from '@graphcommerce/ecommerce-ui'
3
3
  import { iconPerson, IconSvg } from '@graphcommerce/next-ui'
4
- import { Trans } from '@lingui/react'
4
+ import { Trans } from '@lingui/react/macro'
5
5
  import { Button } from '@mui/material'
6
6
  import type { SetOptional } from 'type-fest'
7
7
  import { useCustomerAccountCanSignUp } from '../../hooks'
@@ -27,7 +27,7 @@ export function ApolloCustomerErrorFullPage(props: ApolloCustomerErrorFullPagePr
27
27
  button={
28
28
  unauthorized ? (
29
29
  <Button href='/account/signin' variant='pill' color='primary' size='large'>
30
- {canSignUp ? <Trans id='Sign in or create an account!' /> : <Trans id='Sign in' />}
30
+ {canSignUp ? <Trans>Sign in or create an account!</Trans> : <Trans>Sign in</Trans>}
31
31
  </Button>
32
32
  ) : (
33
33
  button
@@ -1,6 +1,6 @@
1
1
  import type { ApolloErrorSnackbarProps } from '@graphcommerce/ecommerce-ui'
2
2
  import { ApolloErrorSnackbar } from '@graphcommerce/ecommerce-ui'
3
- import { Trans } from '@lingui/react'
3
+ import { Trans } from '@lingui/react/macro'
4
4
  import { Button } from '@mui/material'
5
5
  import { useCustomerSession } from '../../hooks/useCustomerSession'
6
6
  import { useAuthorizationErrorMasked } from './useAuthorizationErrorMasked'
@@ -19,7 +19,7 @@ export function ApolloCustomerErrorSnackbar(props: ApolloCustomerErrorSnackbarPr
19
19
  action={
20
20
  unauthorized ? (
21
21
  <Button href='/account/signin' variant='pill' color='secondary'>
22
- {token ? <Trans id='Sign in' /> : <Trans id='Create Account' />}
22
+ {token ? <Trans>Sign in</Trans> : <Trans>Create Account</Trans>}
23
23
  </Button>
24
24
  ) : (
25
25
  action
@@ -1,17 +1,15 @@
1
1
  import type { ApolloError } from '@graphcommerce/graphql'
2
2
  import { graphqlErrorByCategory } from '@graphcommerce/magento-graphql'
3
- import { i18n } from '@lingui/core'
3
+ import { t } from '@lingui/core/macro'
4
4
  import { useCustomerSession } from '../../hooks/useCustomerSession'
5
5
 
6
- export function useAuthorizationErrorMasked(error?: ApolloError) {
6
+ export function useAuthorizationErrorMasked(error?: ApolloError | null) {
7
7
  const { token } = useCustomerSession()
8
8
 
9
9
  return graphqlErrorByCategory({
10
10
  category: 'graphql-authorization',
11
11
  error,
12
- mask: token
13
- ? i18n._(/* i18n */ 'Please reauthenticate and try again')
14
- : i18n._(/* i18n */ 'You must be signed in to continue'),
12
+ mask: token ? t`Please reauthenticate and try again` : t`You must be signed in to continue`,
15
13
  extract: false,
16
14
  })
17
15
  }
@@ -10,7 +10,7 @@ import {
10
10
  IconSvg,
11
11
  } from '@graphcommerce/next-ui'
12
12
  import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
13
- import { Trans } from '@lingui/macro'
13
+ import { Trans } from '@lingui/react/macro'
14
14
  import type { AccordionProps } from '@mui/material'
15
15
  import { Accordion, AccordionDetails, AccordionSummary, Alert, Box } from '@mui/material'
16
16
  import { canCancelOrder } from '../../utils'
@@ -1,6 +1,6 @@
1
1
  import { Button, Form, FormActions, FormDivider, MessageSnackbar } from '@graphcommerce/next-ui'
2
2
  import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
3
- import { Trans } from '@lingui/react'
3
+ import { Trans } from '@lingui/react/macro'
4
4
  import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
5
5
  import { NameFields } from '../NameFields/NameFields'
6
6
  import { UpdateCustomerNameDocument } from './UpdateCustomerName.gql'
@@ -42,7 +42,7 @@ export function ChangeNameForm(props: ChangeNameFormProps) {
42
42
  size='large'
43
43
  loading={formState.isSubmitting}
44
44
  >
45
- <Trans id='Save changes' />
45
+ <Trans>Save changes</Trans>
46
46
  </Button>
47
47
  </FormActions>
48
48
  <ApolloCustomerErrorAlert error={error} />
@@ -52,7 +52,7 @@ export function ChangeNameForm(props: ChangeNameFormProps) {
52
52
  variant='pill'
53
53
  severity='success'
54
54
  >
55
- <Trans id='Successfully saved changes' />
55
+ <Trans>Successfully saved changes</Trans>
56
56
  </MessageSnackbar>
57
57
  </>
58
58
  )
@@ -13,7 +13,7 @@ import {
13
13
  MessageSnackbar,
14
14
  } from '@graphcommerce/next-ui'
15
15
  import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
16
- import { Trans } from '@lingui/react'
16
+ import { Trans } from '@lingui/react/macro'
17
17
  import { ValidatedPasswordElement } from '../ValidatedPasswordElement/ValidatedPasswordElement'
18
18
  import type { ChangePasswordMutation, ChangePasswordMutationVariables } from './ChangePassword.gql'
19
19
  import { ChangePasswordDocument } from './ChangePassword.gql'
@@ -45,7 +45,7 @@ export function ChangePasswordForm() {
45
45
  name='currentPassword'
46
46
  variant='outlined'
47
47
  autoComplete='current-password'
48
- label={<Trans id='Current Password' />}
48
+ label={<Trans>Current Password</Trans>}
49
49
  required={required.currentPassword}
50
50
  disabled={formState.isSubmitting}
51
51
  error={Boolean(authenticationError)}
@@ -59,7 +59,7 @@ export function ChangePasswordForm() {
59
59
  name='newPassword'
60
60
  variant='outlined'
61
61
  autoComplete='new-password'
62
- label={<Trans id='New password' />}
62
+ label={<Trans>New password</Trans>}
63
63
  required={required.newPassword}
64
64
  disabled={formState.isSubmitting}
65
65
  error={Boolean(inputError)}
@@ -71,7 +71,7 @@ export function ChangePasswordForm() {
71
71
  passwordFieldName='newPassword'
72
72
  autoComplete='new-password'
73
73
  variant='outlined'
74
- label={<Trans id='Confirm password' />}
74
+ label={<Trans>Confirm password</Trans>}
75
75
  required
76
76
  disabled={formState.isSubmitting}
77
77
  />
@@ -87,7 +87,7 @@ export function ChangePasswordForm() {
87
87
  variant='pill'
88
88
  size='large'
89
89
  >
90
- <Trans id='Save new password' />
90
+ <Trans>Save new password</Trans>
91
91
  </Button>
92
92
  </FormActions>
93
93
 
@@ -95,7 +95,7 @@ export function ChangePasswordForm() {
95
95
 
96
96
  {showSuccess && (
97
97
  <MessageSnackbar open={showSuccess} sticky variant='pill' severity='success'>
98
- <Trans id='Successfully changed password' />
98
+ <Trans>Successfully changed password</Trans>
99
99
  </MessageSnackbar>
100
100
  )}
101
101
  </Form>