@graphcommerce/magento-customer 4.2.10 → 4.2.11

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md CHANGED
@@ -1,5 +1,54 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.2.11
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1451](https://github.com/graphcommerce-org/graphcommerce/pull/1451) [`f698ff85d`](https://github.com/graphcommerce-org/graphcommerce/commit/f698ff85df6bb0922288471bb3c81856091b8061) Thanks [@paales](https://github.com/paales)! - Removed all occurences of @lingui/macro and moved to @lingui/macro / @lingui/core in preparation to move to swc.
8
+
9
+ Since we've removed @lingui/macro, all occurences need to be replaced with @lingui/core and @lingui/react.
10
+
11
+ All occurences of `<Trans>` and `t` need to be replaced:
12
+
13
+ ```tsx
14
+ import { Trans, t } from '@lingui/macro'
15
+
16
+ function MyComponent() {
17
+ const foo = 'bar'
18
+ return (
19
+ <div aria-label={t`Account ${foo}`}>
20
+ <Trans>My Translation {foo}</Trans>
21
+ </div>
22
+ )
23
+ }
24
+ ```
25
+
26
+ Needs to be replaced with:
27
+
28
+ ```tsx
29
+ import { Trans } from '@lingui/react'
30
+ import { i18n } from '@lingui/core'
31
+
32
+ function MyComponent() {
33
+ const foo = 'bar'
34
+ return (
35
+ <div aria-label={i18n._(/* i18n */ `Account {foo}`, { foo })}>
36
+ <Trans key='My Translation {foo}' values={{ foo }}></Trans>
37
+ </div>
38
+ )
39
+ }
40
+ ```
41
+
42
+ [More examples for Trans](https://lingui.js.org/ref/macro.html#examples-of-jsx-macros) and [more examples for `t`](https://lingui.js.org/ref/macro.html#examples-of-js-macros)
43
+
44
+ - Updated dependencies [[`50188e378`](https://github.com/graphcommerce-org/graphcommerce/commit/50188e378b4c77561ebc600958ea11cd114fa61a), [`f698ff85d`](https://github.com/graphcommerce-org/graphcommerce/commit/f698ff85df6bb0922288471bb3c81856091b8061)]:
45
+ - @graphcommerce/react-hook-form@3.1.3
46
+ - @graphcommerce/ecommerce-ui@1.0.11
47
+ - @graphcommerce/magento-store@4.2.2
48
+ - @graphcommerce/next-ui@4.7.2
49
+ - @graphcommerce/graphql@3.1.3
50
+ - @graphcommerce/magento-graphql@3.0.12
51
+
3
52
  ## 4.2.10
4
53
 
5
54
  ### Patch Changes
@@ -1,5 +1,5 @@
1
1
  import { extendableComponent } from '@graphcommerce/next-ui'
2
- import { Trans } from '@lingui/macro'
2
+ import { Trans } from '@lingui/react'
3
3
  import { Box, Link, SxProps, Theme } from '@mui/material'
4
4
  import PageLink from 'next/link'
5
5
  import { AddressMultiLine } from '../AddressMultiLine/AddressMultiLine'
@@ -48,7 +48,7 @@ export function AccountAddress(props: AccountAddressProps) {
48
48
  >
49
49
  <PageLink href={`/account/addresses/edit?addressId=${id}`} passHref>
50
50
  <Link color='primary' underline='hover'>
51
- <Trans>Edit</Trans>
51
+ <Trans id='Edit' />
52
52
  </Link>
53
53
  </PageLink>
54
54
  <DeleteCustomerAddressForm addressId={id ?? undefined} />
@@ -5,7 +5,7 @@ import {
5
5
  IconSvg,
6
6
  extendableComponent,
7
7
  } from '@graphcommerce/next-ui'
8
- import { Trans } from '@lingui/macro'
8
+ import { Trans } from '@lingui/react'
9
9
  import { Skeleton, Button, Box, Theme, SxProps } from '@mui/material'
10
10
  import Link from 'next/link'
11
11
  import { AccountAddress } from '../AccountAddress/AccountAddress'
@@ -46,7 +46,7 @@ export function AccountAddresses(props: AccountAddressesProps) {
46
46
  margin: `${theme.spacings.md} auto`,
47
47
  })}
48
48
  >
49
- <Trans>Add new address</Trans>
49
+ <Trans id='Add new address' />
50
50
  </Button>
51
51
  </SectionContainer>
52
52
  )
@@ -56,12 +56,12 @@ export function AccountAddresses(props: AccountAddressesProps) {
56
56
  <>
57
57
  {((addresses && addresses.length === 0) || !addresses) && (
58
58
  <FullPageMessage
59
- title={<Trans>You have no addresses saved yet</Trans>}
59
+ title={<Trans id='You have no addresses saved yet' />}
60
60
  icon={<IconSvg src={iconHome} size='xxl' />}
61
61
  button={
62
62
  <Link href='/account/addresses/add' passHref>
63
63
  <Button size='large' variant='contained' color='primary'>
64
- <Trans>Add new address</Trans>
64
+ <Trans id='Add new address' />
65
65
  </Button>
66
66
  </Link>
67
67
  }
@@ -91,7 +91,7 @@ export function AccountAddresses(props: AccountAddressesProps) {
91
91
  margin: `${theme.spacings.md} auto`,
92
92
  })}
93
93
  >
94
- <Trans>Add new address</Trans>
94
+ <Trans id='Add new address' />
95
95
  </Button>
96
96
  </Link>
97
97
  </SectionContainer>
@@ -6,7 +6,8 @@ import {
6
6
  houseNumberPattern,
7
7
  UseFormReturn,
8
8
  } from '@graphcommerce/react-hook-form'
9
- import { t, Trans } from '@lingui/macro'
9
+ import { i18n } from '@lingui/core'
10
+ import { Trans } from '@lingui/react'
10
11
  import { TextField } from '@mui/material'
11
12
  import React, { useMemo } from 'react'
12
13
 
@@ -58,7 +59,7 @@ export function AddressFields(props: AddressFieldsProps) {
58
59
  variant='outlined'
59
60
  type='text'
60
61
  error={!!formState.errors.street}
61
- label={<Trans>Street</Trans>}
62
+ label={<Trans id='Street' />}
62
63
  autoComplete='address-line1'
63
64
  required={!!required?.street}
64
65
  {...muiRegister('street', { required: required?.street })}
@@ -72,12 +73,15 @@ export function AddressFields(props: AddressFieldsProps) {
72
73
  variant='outlined'
73
74
  type='text'
74
75
  error={!!formState.errors.houseNumber}
75
- label={<Trans>Housenumber</Trans>}
76
+ label={<Trans id='Housenumber' />}
76
77
  autoComplete='address-line2'
77
78
  required={!!required?.houseNumber}
78
79
  {...muiRegister('houseNumber', {
79
80
  required: required?.houseNumber,
80
- pattern: { value: houseNumberPattern, message: t`Please provide a valid house number` },
81
+ pattern: {
82
+ value: houseNumberPattern,
83
+ message: i18n._(/* i18n */ `Please provide a valid house number`),
84
+ },
81
85
  })}
82
86
  helperText={formState.isSubmitted && formState.errors.houseNumber?.message}
83
87
  InputProps={{
@@ -90,7 +94,7 @@ export function AddressFields(props: AddressFieldsProps) {
90
94
  type='text'
91
95
  error={!!formState.errors.addition}
92
96
  required={!!required?.addition}
93
- label={<Trans>Addition</Trans>}
97
+ label={<Trans id='Addition' />}
94
98
  autoComplete='address-line3'
95
99
  {...muiRegister('addition', { required: required?.addition })}
96
100
  helperText={formState.isSubmitted && formState.errors.addition?.message}
@@ -106,7 +110,7 @@ export function AddressFields(props: AddressFieldsProps) {
106
110
  type='text'
107
111
  error={!!formState.errors.postcode}
108
112
  required={!!required?.postcode}
109
- label={<Trans>Postcode</Trans>}
113
+ label={<Trans id='Postcode' />}
110
114
  {...muiRegister('postcode', { required: required?.postcode })}
111
115
  helperText={formState.isSubmitted && formState.errors.postcode?.message}
112
116
  InputProps={{
@@ -119,7 +123,7 @@ export function AddressFields(props: AddressFieldsProps) {
119
123
  type='text'
120
124
  error={!!formState.errors.city}
121
125
  required={!!required?.city}
122
- label={<Trans>City</Trans>}
126
+ label={<Trans id='City' />}
123
127
  {...muiRegister('city', { required: required?.city })}
124
128
  helperText={formState.isSubmitted && formState.errors.city?.message}
125
129
  InputProps={{
@@ -135,7 +139,7 @@ export function AddressFields(props: AddressFieldsProps) {
135
139
  {...muiRegister('countryCode', { required: required.countryCode })}
136
140
  variant='outlined'
137
141
  error={!!formState.errors.countryCode}
138
- label={<Trans>Country</Trans>}
142
+ label={<Trans id='Country' />}
139
143
  required={!!required?.countryCode}
140
144
  helperText={formState.errors.countryCode?.message}
141
145
  // onBlur={onBlur}
@@ -162,7 +166,7 @@ export function AddressFields(props: AddressFieldsProps) {
162
166
  SelectProps={{ native: true, displayEmpty: true }}
163
167
  variant='outlined'
164
168
  error={!!formState.errors.regionId}
165
- label={<Trans>Region</Trans>}
169
+ label={<Trans id='Region' />}
166
170
  {...muiRegister('regionId', {
167
171
  required: true,
168
172
  shouldUnregister: true,
@@ -1,5 +1,5 @@
1
1
  import { ApolloErrorAlert, ApolloErrorAlertProps } from '@graphcommerce/ecommerce-ui'
2
- import { Trans } from '@lingui/macro'
2
+ import { Trans } from '@lingui/react'
3
3
  import { Link } from '@mui/material'
4
4
  import NextLink from 'next/link'
5
5
  import { useExtractCustomerErrors } from '../../hooks/useExtractCustomerErrors'
@@ -12,7 +12,7 @@ export function ApolloCustomerErrorAlert(props: MagentoErrorAlertProps) {
12
12
  const action = unauthorized && (
13
13
  <NextLink href='/account/signin' passHref>
14
14
  <Link underline='hover'>
15
- <Trans>Create Account</Trans> / <Trans>Sign in</Trans>
15
+ <Trans id='Create Account' /> / <Trans id='Sign in' />
16
16
  </Link>
17
17
  </NextLink>
18
18
  )
@@ -1,6 +1,6 @@
1
1
  import { ApolloErrorFullPage, ApolloErrorAlertProps } from '@graphcommerce/ecommerce-ui'
2
2
  import { iconPerson, IconSvg } from '@graphcommerce/next-ui'
3
- import { Trans } from '@lingui/macro'
3
+ import { Trans } from '@lingui/react'
4
4
  import { Button } from '@mui/material'
5
5
  import PageLink from 'next/link'
6
6
  import { useExtractCustomerErrors } from '../../hooks/useExtractCustomerErrors'
@@ -22,7 +22,7 @@ export function ApolloCustomerErrorFullPage(props: ApolloCustomerErrorFullPagePr
22
22
  unauthorized ? (
23
23
  <PageLink href={signInHref} passHref>
24
24
  <Button variant='contained' color='primary' size='large'>
25
- <Trans>Log in</Trans>
25
+ <Trans id='Log in' />
26
26
  </Button>
27
27
  </PageLink>
28
28
  ) : undefined
@@ -31,7 +31,7 @@ export function ApolloCustomerErrorFullPage(props: ApolloCustomerErrorFullPagePr
31
31
  unauthorized ? (
32
32
  <PageLink href={signUpHref} passHref>
33
33
  <Button variant='text' color='primary'>
34
- <Trans>Or create an account</Trans>
34
+ <Trans id='Or create an account' />
35
35
  </Button>
36
36
  </PageLink>
37
37
  ) : undefined
@@ -1,6 +1,6 @@
1
1
  import { Form, FormActions, FormDivider, MessageSnackbar, Button } from '@graphcommerce/next-ui'
2
2
  import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
3
- import { Trans } from '@lingui/macro'
3
+ import { Trans } from '@lingui/react'
4
4
  import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
5
5
  import { NameFields } from '../NameFields/NameFields'
6
6
  import { UpdateCustomerNameDocument } from './UpdateCustomerName.gql'
@@ -41,13 +41,13 @@ export function ChangeNameForm(props: ChangeNameFormProps) {
41
41
  size='large'
42
42
  loading={formState.isSubmitting}
43
43
  >
44
- <Trans>Save changes</Trans>
44
+ <Trans id='Save changes' />
45
45
  </Button>
46
46
  </FormActions>
47
47
  <ApolloCustomerErrorAlert error={error} />
48
48
  </Form>
49
49
  <MessageSnackbar open={formState.isSubmitSuccessful && !error} variant='pill'>
50
- <Trans>Successfully saved changes</Trans>
50
+ <Trans id='Successfully saved changes' />
51
51
  </MessageSnackbar>
52
52
  </>
53
53
  )
@@ -7,7 +7,8 @@ import {
7
7
  Button,
8
8
  } from '@graphcommerce/next-ui'
9
9
  import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
10
- import { Trans, t } from '@lingui/macro'
10
+ import { i18n } from '@lingui/core'
11
+ import { Trans } from '@lingui/react'
11
12
  import { TextField } from '@mui/material'
12
13
  import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
13
14
  import {
@@ -32,7 +33,7 @@ export function ChangePasswordForm() {
32
33
  variant='outlined'
33
34
  type='password'
34
35
  error={!!formState.errors.currentPassword}
35
- label={<Trans>Current Password</Trans>}
36
+ label={<Trans id='Current Password' />}
36
37
  required={required.currentPassword}
37
38
  {...muiRegister('currentPassword', { required: required.currentPassword })}
38
39
  helperText={formState.errors.currentPassword?.message}
@@ -45,7 +46,7 @@ export function ChangePasswordForm() {
45
46
  variant='outlined'
46
47
  type='password'
47
48
  error={!!formState.errors.newPassword}
48
- label={<Trans>New password</Trans>}
49
+ label={<Trans id='New password' />}
49
50
  required={required.newPassword}
50
51
  {...muiRegister('newPassword', { required: required.newPassword })}
51
52
  helperText={formState.errors.newPassword?.message}
@@ -56,11 +57,11 @@ export function ChangePasswordForm() {
56
57
  variant='outlined'
57
58
  type='password'
58
59
  error={!!formState.errors.confirmPassword}
59
- label={<Trans>Confirm password</Trans>}
60
+ label={<Trans id='Confirm password' />}
60
61
  required
61
62
  {...muiRegister('confirmPassword', {
62
63
  required: true,
63
- validate: (value) => value === pass || t`Passwords don't match`,
64
+ validate: (value) => value === pass || i18n._(/* i18n */ `Passwords don't match`),
64
65
  })}
65
66
  helperText={formState.errors.confirmPassword?.message}
66
67
  disabled={formState.isSubmitting}
@@ -79,12 +80,12 @@ export function ChangePasswordForm() {
79
80
  variant='contained'
80
81
  size='large'
81
82
  >
82
- <Trans>Save new password</Trans>
83
+ <Trans id='Save new password' />
83
84
  </Button>
84
85
  </FormActions>
85
86
 
86
87
  <MessageSnackbar sticky open={Boolean(formState.isSubmitSuccessful && data)}>
87
- <Trans>Successfully changed password</Trans>
88
+ <Trans id='Successfully changed password' />
88
89
  </MessageSnackbar>
89
90
  </Form>
90
91
  )
@@ -9,7 +9,8 @@ import {
9
9
  Button,
10
10
  } from '@graphcommerce/next-ui'
11
11
  import { phonePattern, useFormGqlMutation } from '@graphcommerce/react-hook-form'
12
- import { Trans, t } from '@lingui/macro'
12
+ import { i18n } from '@lingui/core'
13
+ import { Trans } from '@lingui/react'
13
14
  import { TextField } from '@mui/material'
14
15
  import { useRouter } from 'next/router'
15
16
  import { AddressFields } from '../AddressFields/AddressFields'
@@ -65,10 +66,10 @@ export function CreateCustomerAddressForm() {
65
66
  type='text'
66
67
  error={!!formState.errors.telephone}
67
68
  required={required.telephone}
68
- label={<Trans>Telephone</Trans>}
69
+ label={<Trans id='Telephone' />}
69
70
  {...muiRegister('telephone', {
70
71
  required: required.telephone,
71
- pattern: { value: phonePattern, message: t`Invalid phone number` },
72
+ pattern: { value: phonePattern, message: i18n._(/* i18n */ `Invalid phone number`) },
72
73
  })}
73
74
  helperText={formState.isSubmitted && formState.errors.telephone?.message}
74
75
  disabled={formState.isSubmitting}
@@ -86,7 +87,7 @@ export function CreateCustomerAddressForm() {
86
87
  size='large'
87
88
  loading={formState.isSubmitting}
88
89
  >
89
- <Trans>Save changes</Trans>
90
+ <Trans id='Save changes' />
90
91
  </Button>
91
92
  </FormActions>
92
93
  </Form>
@@ -5,7 +5,7 @@ import {
5
5
  IconSvg,
6
6
  extendableComponent,
7
7
  } from '@graphcommerce/next-ui'
8
- import { t } from '@lingui/macro'
8
+ import { i18n } from '@lingui/core'
9
9
  import { Fab, FabProps as FabPropsType, NoSsr, SxProps, Theme } from '@mui/material'
10
10
  import PageLink from 'next/link'
11
11
  import React from 'react'
@@ -32,7 +32,7 @@ function CustomerFabContent(props: CustomerFabContentProps) {
32
32
  <Fab
33
33
  color='inherit'
34
34
  id='account'
35
- aria-label={t`Account`}
35
+ aria-label={i18n._(/* i18n */ `Account`)}
36
36
  size='large'
37
37
  className={classes.root}
38
38
  {...FabProps}
@@ -1,6 +1,6 @@
1
1
  import { ApolloErrorSnackbar } from '@graphcommerce/ecommerce-ui'
2
2
  import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
3
- import { Trans } from '@lingui/macro'
3
+ import { Trans } from '@lingui/react'
4
4
  import { Button } from '@mui/material'
5
5
  import { DeleteCustomerAddressFormDocument } from './DeleteCustomerAddressForm.gql'
6
6
 
@@ -20,7 +20,7 @@ export function DeleteCustomerAddressForm(props: DeleteCustomerAddressFormProps)
20
20
  return (
21
21
  <form onSubmit={submitHandler} noValidate>
22
22
  <Button type='submit' variant='text' color='primary'>
23
- <Trans>Delete this address</Trans>
23
+ <Trans id='Delete this address' />
24
24
  </Button>
25
25
  <ApolloErrorSnackbar error={error} />
26
26
  </form>
@@ -9,7 +9,8 @@ import {
9
9
  InputCheckmark,
10
10
  } from '@graphcommerce/next-ui'
11
11
  import { phonePattern, useFormGqlMutation } from '@graphcommerce/react-hook-form'
12
- import { t, Trans } from '@lingui/macro'
12
+ import { i18n } from '@lingui/core'
13
+ import { Trans } from '@lingui/react'
13
14
  import { SxProps, TextField, Theme } from '@mui/material'
14
15
  import { useRouter } from 'next/router'
15
16
  import { AccountAddressFragment } from '../AccountAddress/AccountAddress.gql'
@@ -84,10 +85,10 @@ export function EditAddressForm(props: EditAddressFormProps) {
84
85
  type='text'
85
86
  error={!!formState.errors.telephone}
86
87
  required={required.telephone}
87
- label={<Trans>Telephone</Trans>}
88
+ label={<Trans id='Telephone' />}
88
89
  {...muiRegister('telephone', {
89
90
  required: required.telephone,
90
- pattern: { value: phonePattern, message: t`Invalid phone number` },
91
+ pattern: { value: phonePattern, message: i18n._(/* i18n */ `Invalid phone number`) },
91
92
  })}
92
93
  helperText={formState.isSubmitted && formState.errors.telephone?.message}
93
94
  disabled={formState.isSubmitting}
@@ -105,7 +106,7 @@ export function EditAddressForm(props: EditAddressFormProps) {
105
106
  size='large'
106
107
  loading={formState.isSubmitting}
107
108
  >
108
- <Trans>Save changes</Trans>
109
+ <Trans id='Save changes' />
109
110
  </Button>
110
111
  </FormActions>
111
112
  </Form>
@@ -1,6 +1,7 @@
1
1
  import { Button, Form, FormActions, FormRow } from '@graphcommerce/next-ui'
2
2
  import { emailPattern, useFormGqlMutation } from '@graphcommerce/react-hook-form'
3
- import { t, Trans } from '@lingui/macro'
3
+ import { i18n } from '@lingui/core'
4
+ import { Trans } from '@lingui/react'
4
5
  import { TextField, Alert, SxProps, Theme } from '@mui/material'
5
6
  import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
6
7
  import {
@@ -27,7 +28,7 @@ export function ForgotPasswordForm(props: { sx?: SxProps<Theme> }) {
27
28
  marginBottom: theme.spacings.sm,
28
29
  })}
29
30
  >
30
- <Trans>We’ve send a password reset link to your email address!</Trans>
31
+ <Trans id='We’ve send a password reset link to your email address!' />
31
32
  </Alert>
32
33
  )
33
34
  }
@@ -39,11 +40,11 @@ export function ForgotPasswordForm(props: { sx?: SxProps<Theme> }) {
39
40
  variant='outlined'
40
41
  type='text'
41
42
  error={!!formState.errors.email}
42
- label={<Trans>Email</Trans>}
43
+ label={<Trans id='Email' />}
43
44
  required={required.email}
44
45
  {...muiRegister('email', {
45
46
  required: required.email,
46
- pattern: { value: emailPattern, message: t`Invalid email address` },
47
+ pattern: { value: emailPattern, message: i18n._(/* i18n */ `Invalid email address`) },
47
48
  })}
48
49
  helperText={formState.errors.email?.message}
49
50
  disabled={formState.isSubmitting}
@@ -60,7 +61,7 @@ export function ForgotPasswordForm(props: { sx?: SxProps<Theme> }) {
60
61
  variant='contained'
61
62
  size='large'
62
63
  >
63
- <Trans>Send password reset email</Trans>
64
+ <Trans id='Send password reset email' />
64
65
  </Button>
65
66
  </FormActions>
66
67
  </Form>
@@ -1,6 +1,7 @@
1
1
  import { FormRow, InputCheckmark } from '@graphcommerce/next-ui'
2
2
  import { assertFormGqlOperation, Controller, UseFormReturn } from '@graphcommerce/react-hook-form'
3
- import { t, Trans } from '@lingui/macro'
3
+ import { i18n } from '@lingui/core'
4
+ import { Trans } from '@lingui/react'
4
5
  import { MenuItem, TextField } from '@mui/material'
5
6
  import React from 'react'
6
7
 
@@ -19,7 +20,11 @@ type NameFieldProps = {
19
20
  }
20
21
 
21
22
  export function NameFields(props: NameFieldProps) {
22
- const { prefix, form, readOnly, prefixes = [t`Mr`, t`Mrs`, t`Other`] } = props
23
+ const mr = i18n._(/* i18n */ `Mr`)
24
+ const mrs = i18n._(/* i18n */ `Mrs`)
25
+ const other = i18n._(/* i18n */ `Other`)
26
+
27
+ const { prefix, form, readOnly, prefixes = [mr, mrs, other] } = props
23
28
  assertFormGqlOperation<NameFieldValues>(form)
24
29
 
25
30
  const { control, formState, muiRegister, required, valid } = form
@@ -37,7 +42,7 @@ export function NameFields(props: NameFieldProps) {
37
42
  variant='outlined'
38
43
  select
39
44
  error={!!fieldState.error}
40
- label={<Trans>Prefix</Trans>}
45
+ label={<Trans id='Prefix' />}
41
46
  required={!!required?.prefix}
42
47
  helperText={fieldState.error?.message}
43
48
  onChange={(e) => onChange(e.target.value)}
@@ -63,7 +68,7 @@ export function NameFields(props: NameFieldProps) {
63
68
  <TextField
64
69
  variant='outlined'
65
70
  type='text'
66
- label={<Trans>First Name</Trans>}
71
+ label={<Trans id='First Name' />}
67
72
  required={!!required}
68
73
  error={!!formState.errors.firstname}
69
74
  helperText={formState.isSubmitted && formState.errors.firstname?.message}
@@ -77,7 +82,7 @@ export function NameFields(props: NameFieldProps) {
77
82
  variant='outlined'
78
83
  type='text'
79
84
  error={!!formState.errors.lastname}
80
- label={<Trans>Last Name</Trans>}
85
+ label={<Trans id='Last Name' />}
81
86
  required={!!required?.lastname}
82
87
  helperText={formState.isSubmitted && formState.errors.lastname?.message}
83
88
  InputProps={{
@@ -1,6 +1,6 @@
1
1
  import { Button, Form, FormActions, FormRow } from '@graphcommerce/next-ui'
2
2
  import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
3
- import { Trans } from '@lingui/macro'
3
+ import { Trans } from '@lingui/react'
4
4
  import { TextField } from '@mui/material'
5
5
  import { useRouter } from 'next/router'
6
6
  import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
@@ -44,7 +44,7 @@ export function ResetPasswordForm(props: ResetPasswordFormProps) {
44
44
  variant='outlined'
45
45
  type='email'
46
46
  error={!!formState.errors.email}
47
- label={<Trans>Email</Trans>}
47
+ label={<Trans id='Email' />}
48
48
  required={required.email}
49
49
  {...muiRegister('email', { required: required.email })}
50
50
  helperText={formState.errors.email?.message}
@@ -56,7 +56,7 @@ export function ResetPasswordForm(props: ResetPasswordFormProps) {
56
56
  variant='outlined'
57
57
  type='password'
58
58
  error={!!formState.errors.newPassword}
59
- label={<Trans>New password</Trans>}
59
+ label={<Trans id='New password' />}
60
60
  required={required.newPassword}
61
61
  {...muiRegister('newPassword', { required: required.newPassword })}
62
62
  helperText={formState.errors.newPassword?.message}
@@ -68,7 +68,7 @@ export function ResetPasswordForm(props: ResetPasswordFormProps) {
68
68
  variant='outlined'
69
69
  type='password'
70
70
  error={!!formState.errors.confirmPassword}
71
- label={<Trans>Confirm password</Trans>}
71
+ label={<Trans id='Confirm password' />}
72
72
  required
73
73
  {...muiRegister('confirmPassword', {
74
74
  required: true,
@@ -89,7 +89,7 @@ export function ResetPasswordForm(props: ResetPasswordFormProps) {
89
89
  variant='contained'
90
90
  size='large'
91
91
  >
92
- <Trans>Save new password</Trans>
92
+ <Trans id='Save new password' />
93
93
  </Button>
94
94
  </FormActions>
95
95
  </Form>
@@ -1,7 +1,7 @@
1
1
  import { graphqlErrorByCategory } from '@graphcommerce/magento-graphql'
2
2
  import { Button, FormRow, FormActions } from '@graphcommerce/next-ui'
3
3
  import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
4
- import { Trans } from '@lingui/macro'
4
+ import { Trans } from '@lingui/react'
5
5
  import { Box, FormControl, Link, SxProps, TextField, Theme } from '@mui/material'
6
6
  import PageLink from 'next/link'
7
7
  import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
@@ -32,7 +32,7 @@ export function SignInForm(props: SignInFormProps) {
32
32
  variant='outlined'
33
33
  type='password'
34
34
  error={!!formState.errors.password || !!authError}
35
- label={<Trans>Password</Trans>}
35
+ label={<Trans id='Password' />}
36
36
  autoFocus
37
37
  autoComplete='current-password'
38
38
  id='current-password'
@@ -42,7 +42,7 @@ export function SignInForm(props: SignInFormProps) {
42
42
  endAdornment: (
43
43
  <PageLink href='/account/forgot-password' key='forgot-password' passHref>
44
44
  <Link underline='hover' sx={{ whiteSpace: 'nowrap' }}>
45
- <Trans>Forgot password?</Trans>
45
+ <Trans id='Forgot password?' />
46
46
  </Link>
47
47
  </PageLink>
48
48
  ),
@@ -63,7 +63,7 @@ export function SignInForm(props: SignInFormProps) {
63
63
  variant='contained'
64
64
  size='large'
65
65
  >
66
- <Trans>Log in</Trans>
66
+ <Trans id='Log in' />
67
67
  </Button>
68
68
  </FormControl>
69
69
  </FormActions>
@@ -1,6 +1,6 @@
1
1
  import { Button, extendableComponent } from '@graphcommerce/next-ui'
2
2
  import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
3
- import { Trans } from '@lingui/macro'
3
+ import { Trans } from '@lingui/react'
4
4
  import { Box, SxProps, TextField, Theme } from '@mui/material'
5
5
  import PageLink from 'next/link'
6
6
  import { PropsWithChildren } from 'react'
@@ -44,7 +44,7 @@ export function SignInFormInline(props: PropsWithChildren<InlineSignInFormProps>
44
44
  variant='outlined'
45
45
  type='password'
46
46
  error={!!formState.errors.password || !!error?.message}
47
- label={<Trans>Password</Trans>}
47
+ label={<Trans id='Password' />}
48
48
  autoFocus
49
49
  autoComplete='current-password'
50
50
  id='current-password'
@@ -61,14 +61,14 @@ export function SignInFormInline(props: PropsWithChildren<InlineSignInFormProps>
61
61
  className={classes.button}
62
62
  sx={{ minWidth: 'max-content' }}
63
63
  >
64
- <Trans>Forgot password?</Trans>
64
+ <Trans id='Forgot password?' />
65
65
  </Button>
66
66
  </PageLink>
67
67
  ),
68
68
  }}
69
69
  />
70
70
  <Button type='submit' loading={formState.isSubmitting} color='secondary' variant='pill'>
71
- <Trans>Sign in</Trans>
71
+ <Trans id='Sign in' />
72
72
  </Button>
73
73
  </Box>
74
74
  )
@@ -3,7 +3,8 @@ import { graphqlErrorByCategory } from '@graphcommerce/magento-graphql'
3
3
  import { StoreConfigDocument } from '@graphcommerce/magento-store'
4
4
  import { Button, FormActions, FormRow } from '@graphcommerce/next-ui'
5
5
  import { useFormGqlMutation, useFormPersist } from '@graphcommerce/react-hook-form'
6
- import { t, Trans } from '@lingui/macro'
6
+ import { i18n } from '@lingui/core'
7
+ import { Trans } from '@lingui/react'
7
8
  import { Alert, FormControlLabel, Switch, TextField } from '@mui/material'
8
9
  import { ApolloCustomerErrorSnackbar } from '../ApolloCustomerError/ApolloCustomerErrorSnackbar'
9
10
  import { NameFields } from '../NameFields/NameFields'
@@ -37,7 +38,7 @@ export function SignUpForm(props: SignUpFormProps) {
37
38
  if (requireEmailValidation && form.formState.isSubmitSuccessful) {
38
39
  return (
39
40
  <Alert>
40
- <Trans>Please check your inbox to validate your email ({email})</Trans>
41
+ <Trans id='Please check your inbox to validate your email ({email})' values={{ email }} />
41
42
  </Alert>
42
43
  )
43
44
  }
@@ -49,7 +50,7 @@ export function SignUpForm(props: SignUpFormProps) {
49
50
  variant='outlined'
50
51
  type='password'
51
52
  error={!!formState.errors.password || !!inputError}
52
- label={<Trans>Password</Trans>}
53
+ label={<Trans id='Password' />}
53
54
  autoFocus
54
55
  autoComplete='new-password'
55
56
  required={required.password}
@@ -57,7 +58,7 @@ export function SignUpForm(props: SignUpFormProps) {
57
58
  required: required.password,
58
59
  minLength: {
59
60
  value: Number(storeConfig?.minimum_password_length ?? 8),
60
- message: t`Password must have at least 8 characters`,
61
+ message: i18n._(/* i18n */ `Password must have at least 8 characters`),
61
62
  },
62
63
  })}
63
64
  helperText={formState.errors.password?.message || inputError?.message}
@@ -67,12 +68,13 @@ export function SignUpForm(props: SignUpFormProps) {
67
68
  variant='outlined'
68
69
  type='password'
69
70
  error={!!formState.errors.confirmPassword}
70
- label={<Trans>Confirm password</Trans>}
71
+ label={<Trans id='Confirm password' />}
71
72
  autoComplete='new-password'
72
73
  required
73
74
  {...muiRegister('confirmPassword', {
74
75
  required: true,
75
- validate: (value) => value === watchPassword || t`Passwords don't match`,
76
+ validate: (value) =>
77
+ value === watchPassword || i18n._(/* i18n */ `Passwords don't match`),
76
78
  })}
77
79
  helperText={formState.errors.confirmPassword?.message}
78
80
  disabled={formState.isSubmitting}
@@ -85,7 +87,7 @@ export function SignUpForm(props: SignUpFormProps) {
85
87
  control={<Switch color='primary' />}
86
88
  {...muiRegister('isSubscribed', { required: required.isSubscribed })}
87
89
  disabled={formState.isSubmitting}
88
- label={<Trans>Subscribe to newsletter</Trans>}
90
+ label={<Trans id='Subscribe to newsletter' />}
89
91
  />
90
92
 
91
93
  <ApolloCustomerErrorSnackbar error={remainingError} />
@@ -99,7 +101,7 @@ export function SignUpForm(props: SignUpFormProps) {
99
101
  size='large'
100
102
  loading={formState.isSubmitting}
101
103
  >
102
- <Trans>Create Account</Trans>
104
+ <Trans id='Create Account' />
103
105
  </Button>
104
106
  </FormActions>
105
107
  </form>
@@ -2,7 +2,8 @@ import { useQuery } from '@graphcommerce/graphql'
2
2
  import { StoreConfigDocument } from '@graphcommerce/magento-store'
3
3
  import { Button, extendableComponent, Form, FormRow } from '@graphcommerce/next-ui'
4
4
  import { useFormGqlMutation } from '@graphcommerce/react-hook-form'
5
- import { t, Trans } from '@lingui/macro'
5
+ import { i18n } from '@lingui/core'
6
+ import { Trans } from '@lingui/react'
6
7
  import { Box, TextField } from '@mui/material'
7
8
  import React, { PropsWithChildren } from 'react'
8
9
  import { SignUpMutationVariables, SignUpMutation, SignUpDocument } from './SignUp.gql'
@@ -55,7 +56,7 @@ export function SignUpFormInline({
55
56
  variant='outlined'
56
57
  type='password'
57
58
  error={!!formState.errors.password || !!error?.message}
58
- label={<Trans>Password</Trans>}
59
+ label={<Trans id='Password' />}
59
60
  autoFocus
60
61
  autoComplete='new-password'
61
62
  id='new-password'
@@ -64,7 +65,7 @@ export function SignUpFormInline({
64
65
  required: required.password,
65
66
  minLength: {
66
67
  value: minPasswordLength,
67
- message: t`Password must have at least 8 characters`,
68
+ message: i18n._(/* i18n */ `Password must have at least 8 characters`),
68
69
  },
69
70
  })}
70
71
  helperText={error?.message}
@@ -7,7 +7,8 @@ import {
7
7
  MessageSnackbar,
8
8
  } from '@graphcommerce/next-ui'
9
9
  import { emailPattern, useFormGqlMutation } from '@graphcommerce/react-hook-form'
10
- import { t, Trans } from '@lingui/macro'
10
+ import { i18n } from '@lingui/core'
11
+ import { Trans } from '@lingui/react'
11
12
  import { TextField } from '@mui/material'
12
13
  import { ApolloCustomerErrorAlert } from '../ApolloCustomerError/ApolloCustomerErrorAlert'
13
14
  import {
@@ -70,7 +71,7 @@ export function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormProps) {
70
71
  autoFocus
71
72
  error={formState.isSubmitted && !!formState.errors.email}
72
73
  helperText={formState.isSubmitted && formState.errors.email?.message}
73
- label={<Trans>New email</Trans>}
74
+ label={<Trans id='New email' />}
74
75
  required={required.email}
75
76
  {...muiRegister('email', {
76
77
  required: true,
@@ -85,11 +86,11 @@ export function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormProps) {
85
86
  autoFocus
86
87
  error={formState.isSubmitted && !!formState.errors.confirmEmail}
87
88
  helperText={formState.isSubmitted && formState.errors.confirmEmail?.message}
88
- label={<Trans>Confirm new email</Trans>}
89
+ label={<Trans id='Confirm new email' />}
89
90
  required
90
91
  {...muiRegister('confirmEmail', {
91
92
  required: true,
92
- validate: (value) => value === watchNewEmail || t`Emails don't match`,
93
+ validate: (value) => value === watchNewEmail || i18n._(/* i18n */ `Emails don't match`),
93
94
  })}
94
95
  />
95
96
  </FormRow>
@@ -99,7 +100,7 @@ export function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormProps) {
99
100
  variant='outlined'
100
101
  type='password'
101
102
  error={!!formState.errors.password}
102
- label={<Trans>Password</Trans>}
103
+ label={<Trans id='Password' />}
103
104
  autoComplete='password'
104
105
  required={required.password}
105
106
  {...muiRegister('password', {
@@ -119,13 +120,13 @@ export function UpdateCustomerEmailForm(props: UpdateCustomerEmailFormProps) {
119
120
  size='large'
120
121
  loading={formState.isSubmitting}
121
122
  >
122
- <Trans>Save changes</Trans>
123
+ <Trans id='Save changes' />
123
124
  </Button>
124
125
  </FormActions>
125
126
  <ApolloCustomerErrorAlert error={error} />
126
127
 
127
128
  <MessageSnackbar sticky open={formState.isSubmitSuccessful && !error}>
128
- <Trans>Successfully updated email</Trans>
129
+ <Trans id='Successfully updated email' />
129
130
  </MessageSnackbar>
130
131
  </Form>
131
132
  )
@@ -1,5 +1,5 @@
1
1
  import { Controller, useFormAutoSubmit, useFormGqlMutation } from '@graphcommerce/react-hook-form'
2
- import { Trans } from '@lingui/macro'
2
+ import { Trans } from '@lingui/react'
3
3
  import { FormControl, FormControlLabel, FormHelperText, Switch } from '@mui/material'
4
4
  import React, { useEffect, useMemo } from 'react'
5
5
  import { AccountAddressFragment } from '../AccountAddress/AccountAddress.gql'
@@ -46,7 +46,7 @@ export function UpdateDefaultAddressForm(props: UpdateDefaultAddressFormProps) {
46
46
  <FormControl error={!!formState.errors.defaultShipping}>
47
47
  <FormControlLabel
48
48
  control={<Switch color='primary' />}
49
- label={<Trans>Shipping address</Trans>}
49
+ label={<Trans id='Shipping address' />}
50
50
  checked={value}
51
51
  inputRef={ref}
52
52
  onBlur={onBlur}
@@ -67,7 +67,7 @@ export function UpdateDefaultAddressForm(props: UpdateDefaultAddressFormProps) {
67
67
  <FormControl error={!!formState.errors.defaultBilling}>
68
68
  <FormControlLabel
69
69
  control={<Switch color='primary' />}
70
- label={<Trans>Billing address</Trans>}
70
+ label={<Trans id='Billing address' />}
71
71
  checked={value}
72
72
  inputRef={ref}
73
73
  onBlur={onBlur}
@@ -1,6 +1,6 @@
1
1
  import { ApolloError, useApolloClient } from '@graphcommerce/graphql'
2
2
  import { graphqlErrorByCategory } from '@graphcommerce/magento-graphql'
3
- import { t } from '@lingui/macro'
3
+ import { i18n } from '@lingui/core'
4
4
  import { useEffect } from 'react'
5
5
  import { CustomerTokenDocument } from './CustomerToken.gql'
6
6
 
@@ -12,7 +12,7 @@ export function useExtractCustomerErrors({ error }: UseExtractErrors) {
12
12
  category: 'graphql-authorization',
13
13
  error,
14
14
  extract: false,
15
- mask: t`You must sign in to continue`,
15
+ mask: i18n._(/* i18n */ `You must sign in to continue`),
16
16
  })
17
17
 
18
18
  useEffect(() => {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-customer",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "4.2.10",
5
+ "version": "4.2.11",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,23 +12,24 @@
12
12
  }
13
13
  },
14
14
  "devDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "^4.1.6",
15
+ "@graphcommerce/eslint-config-pwa": "^4.1.7",
16
16
  "@graphcommerce/prettier-config-pwa": "^4.0.6",
17
- "@graphcommerce/typescript-config-pwa": "^4.0.2",
17
+ "@graphcommerce/typescript-config-pwa": "^4.0.3",
18
18
  "@playwright/test": "^1.21.1"
19
19
  },
20
20
  "dependencies": {
21
- "@graphcommerce/ecommerce-ui": "1.0.10",
22
- "@graphcommerce/graphql": "3.1.2",
21
+ "@graphcommerce/ecommerce-ui": "1.0.11",
22
+ "@graphcommerce/graphql": "3.1.3",
23
23
  "@graphcommerce/graphql-mesh": "4.1.3",
24
24
  "@graphcommerce/image": "3.1.5",
25
- "@graphcommerce/magento-graphql": "3.0.11",
26
- "@graphcommerce/magento-store": "4.2.1",
27
- "@graphcommerce/next-ui": "4.7.1",
28
- "@graphcommerce/react-hook-form": "3.1.2"
25
+ "@graphcommerce/magento-graphql": "3.0.12",
26
+ "@graphcommerce/magento-store": "4.2.2",
27
+ "@graphcommerce/next-ui": "4.7.2",
28
+ "@graphcommerce/react-hook-form": "3.1.3"
29
29
  },
30
30
  "peerDependencies": {
31
- "@lingui/macro": "^3.13.2",
31
+ "@lingui/react": "^3.13.2",
32
+ "@lingui/core": "^3.13.2",
32
33
  "@mui/material": "5.5.3",
33
34
  "framer-motion": "^6.2.4",
34
35
  "next": "12.1.2",