@graphcommerce/magento-customer 9.1.0-canary.55 → 10.0.0-canary.57
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 +82 -0
- package/components/AccountAddress/AccountAddress.tsx +2 -2
- package/components/AccountAddresses/AccountAddresses.tsx +7 -7
- package/components/AccountDeleteForm/AccountDeleteForm.tsx +2 -1
- package/components/AccountSignInUpForm/AccountSignInUpForm.tsx +19 -18
- package/components/AddressFields/AddressAddition.tsx +2 -2
- package/components/AddressFields/AddressCity.tsx +2 -2
- package/components/AddressFields/AddressCountryRegion.tsx +4 -4
- package/components/AddressFields/AddressHouseNumber.tsx +4 -4
- package/components/AddressFields/AddressPostcode.tsx +1 -1
- package/components/AddressFields/AddressStreet.tsx +2 -2
- package/components/ApolloCustomerError/ApolloCustomerErrorAlert.tsx +2 -2
- package/components/ApolloCustomerError/ApolloCustomerErrorFullPage.tsx +2 -2
- package/components/ApolloCustomerError/ApolloCustomerErrorSnackbar.tsx +2 -2
- package/components/ApolloCustomerError/useAuthorizationErrorMasked.ts +3 -5
- package/components/CancelOrder/CancelOrderForm.tsx +1 -1
- package/components/ChangeNameForm/ChangeNameForm.tsx +3 -3
- package/components/ChangePasswordForm/ChangePasswordForm.tsx +6 -6
- package/components/CompanyFields/CompanyFields.tsx +4 -5
- package/components/CompanyFields/CompanyName.tsx +2 -2
- package/components/CompanyFields/CompanyVAT.tsx +2 -2
- package/components/ConfirmCustomer/ConfirmCustomerForm.tsx +7 -7
- package/components/ContactForm/ContactForm.tsx +1 -1
- package/components/CreateCustomerAddressForm/CreateCustomerAddressForm.tsx +3 -3
- package/components/CreditMemo/CreditMemoCard.tsx +1 -1
- package/components/CreditMemo/CreditMemoDetails.tsx +1 -1
- package/components/CreditMemo/CreditMemoItem.tsx +2 -2
- package/components/CreditMemo/CreditMemoItems.tsx +1 -1
- package/components/CreditMemo/CreditMemoTotals.tsx +1 -1
- package/components/CustomerFab/CustomerFab.tsx +2 -2
- package/components/CustomerForms/CustomerAttributeField.tsx +2 -2
- package/components/CustomerForms/CustomerUpdateForm.tsx +2 -2
- package/components/CustomerForms/customerAttributeFieldHelpers.ts +1 -1
- package/components/CustomerForms/nameFieldset.tsx +2 -2
- package/components/DeleteCustomerAddressForm/DeleteCustomerAddressForm.tsx +2 -2
- package/components/EditAddressForm/EditAddressForm.tsx +2 -2
- package/components/ForgotPasswordForm/ForgotPasswordForm.tsx +6 -6
- package/components/GuestOrderOverview/GuestOrder.graphql +2 -2
- package/components/GuestOrderOverview/GuestOrderOverviewForm.tsx +10 -10
- package/components/Invoice/InvoiceCard.tsx +1 -1
- package/components/Invoice/InvoiceDetails.tsx +1 -1
- package/components/Invoice/InvoiceItem.tsx +2 -2
- package/components/Invoice/InvoiceItems.tsx +1 -1
- package/components/Invoice/InvoiceTotals.tsx +1 -1
- package/components/NameFields/NameFields.tsx +8 -8
- package/components/NoOrdersFound/NoOrdersFound.tsx +2 -2
- package/components/Order/OrderCard/OrderCard.tsx +3 -3
- package/components/Order/OrderDetails/OrderDetails.tsx +1 -1
- package/components/Order/OrderItem/OrderItem.tsx +2 -2
- package/components/Order/OrderItems/OrderItems.tsx +2 -2
- package/components/Order/OrderStateLabel/OrderStateLabel.tsx +1 -1
- package/components/Order/OrderTotals/OrderTotals.tsx +7 -5
- package/components/ReorderItems/ReorderItems.tsx +1 -1
- package/components/ResetPasswordForm/ResetPasswordForm.tsx +4 -4
- package/components/Shipment/ShipmentCard.tsx +1 -1
- package/components/Shipment/ShipmentDetails.tsx +1 -1
- package/components/Shipment/ShipmentItem.tsx +2 -2
- package/components/Shipment/ShipmentItems.tsx +1 -1
- package/components/SignInForm/SignInForm.tsx +5 -5
- package/components/SignInForm/SignInFormInline.tsx +4 -4
- package/components/SignUpForm/SignUpForm.tsx +9 -7
- package/components/SignUpForm/SignUpFormInline.tsx +5 -8
- package/components/TrackingLink/TrackingLink.tsx +2 -2
- package/components/UpdateCustomerEmailForm/UpdateCustomerEmailForm.tsx +9 -9
- package/components/UpdateDefaultAddressForm/UpdateDefaultAddressForm.tsx +3 -3
- package/components/ValidatedPasswordElement/ValidatedPasswordElement.tsx +4 -9
- package/components/WaitForCustomer/WaitForCustomer.tsx +6 -6
- package/components/index.ts +1 -0
- package/graphql/index.ts +1 -0
- package/hooks/useAccountSignInUpForm.tsx +2 -1
- package/hooks/useCustomerPermissions.ts +2 -3
- package/package.json +28 -19
- package/utils/customerPermissions.ts +2 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,87 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 10.0.0-canary.57
|
|
4
|
+
|
|
5
|
+
## 10.0.0-canary.56
|
|
6
|
+
|
|
7
|
+
### Major Changes
|
|
8
|
+
|
|
9
|
+
- [#2546](https://github.com/graphcommerce-org/graphcommerce/pull/2546) [`ed9332a`](https://github.com/graphcommerce-org/graphcommerce/commit/ed9332a7f78966d932041d9a7725641edc92b28d) - ## GraphCommerce 10 - Turbopack Support
|
|
10
|
+
|
|
11
|
+
This major release brings full Turbopack compatibility, dramatically improving development speed.
|
|
12
|
+
|
|
13
|
+
### 🚀 Turbopack-Compatible Interceptor System
|
|
14
|
+
|
|
15
|
+
The entire plugin/interceptor system has been rewritten to work with Turbopack:
|
|
16
|
+
|
|
17
|
+
- **No more Webpack plugins** - Removed `InterceptorPlugin` webpack plugin entirely
|
|
18
|
+
- **File-based interception** - Original files are moved to `.original.tsx` and replaced with interceptor content
|
|
19
|
+
- **Direct imports** - Interceptors import from `.original` files instead of embedding source
|
|
20
|
+
- **New CLI commands**:
|
|
21
|
+
- `graphcommerce codegen-interceptors` - Generate interceptor files
|
|
22
|
+
- `graphcommerce cleanup-interceptors` - Reset interceptor system, restore original files
|
|
23
|
+
- **Stable file hashing** - Deterministic interceptor generation for better caching
|
|
24
|
+
|
|
25
|
+
### ⚙️ Treeshakable Configuration System
|
|
26
|
+
|
|
27
|
+
Replaced Webpack `DefinePlugin`-based `import.meta.graphCommerce` with a new generated configuration system:
|
|
28
|
+
|
|
29
|
+
- **New `codegen-config-values` command** - Generates TypeScript files with precise typing
|
|
30
|
+
- **Schema-driven** - Dynamically introspects Zod schemas to determine all available properties
|
|
31
|
+
- **Fully treeshakable** - Unused config values are eliminated from the bundle
|
|
32
|
+
- **Type-safe** - Uses `Get<GraphCommerceConfig, 'path'>` for nested property access
|
|
33
|
+
- **Separate files for nested objects** - Optimal treeshaking for complex configurations
|
|
34
|
+
|
|
35
|
+
### 🔧 withGraphCommerce Changes
|
|
36
|
+
|
|
37
|
+
- **Removed** `InterceptorPlugin` - No longer needed with file-based interception
|
|
38
|
+
- **Removed** `DefinePlugin` for `import.meta.graphCommerce` - Replaced with generated config
|
|
39
|
+
- **Removed** `@mui/*` alias rewrites - No longer required
|
|
40
|
+
- **Added** Turbopack loader rules for `.yaml`, `.yml`, and `.po` files
|
|
41
|
+
- **Added** `serverExternalPackages` for all `@whatwg-node/*` packages
|
|
42
|
+
- **Added** `optimizePackageImports` for better bundle optimization
|
|
43
|
+
- **Added** `images.qualities: [52, 75]` for Next.js image optimization
|
|
44
|
+
|
|
45
|
+
### 📦 Lingui Configuration
|
|
46
|
+
|
|
47
|
+
- **Renamed** `lingui.config.js` → `lingui.config.ts` with TypeScript support
|
|
48
|
+
- **Updated** `@graphcommerce/lingui-next/config` to TypeScript with proper exports
|
|
49
|
+
- **Simplified** formatter options
|
|
50
|
+
|
|
51
|
+
### ⚛️ React 19 & Next.js 16 Compatibility
|
|
52
|
+
|
|
53
|
+
- Updated `RefObject<T>` types for React 19 (now includes `null` by default)
|
|
54
|
+
- Replaced deprecated `React.VFC` with `React.FC`
|
|
55
|
+
- Fixed `useRef` calls to require explicit initial values
|
|
56
|
+
- Updated `MutableRefObject` usage in `framer-scroller`
|
|
57
|
+
|
|
58
|
+
### 📋 ESLint 9 Flat Config
|
|
59
|
+
|
|
60
|
+
- Migrated from legacy `.eslintrc` to new flat config format (`eslint.config.mjs`)
|
|
61
|
+
- Updated `@typescript-eslint/*` packages to v8
|
|
62
|
+
- Fixed AST selector for `SxProps` rule (`typeParameters` → `typeArguments`)
|
|
63
|
+
|
|
64
|
+
### 🔄 Apollo Client
|
|
65
|
+
|
|
66
|
+
- Fixed deprecated `name` option → `clientAwareness: { name: 'ssr' }`
|
|
67
|
+
- Updated error handling types to accept `ApolloError | null | undefined`
|
|
68
|
+
|
|
69
|
+
### ⚠️ Breaking Changes
|
|
70
|
+
|
|
71
|
+
- **Node.js 24.x not supported** - Restricted to `>=20 <24.0.0` due to [nodejs/undici#4290](https://github.com/nodejs/undici/issues/4290)
|
|
72
|
+
- **Interceptor files changed** - Original components now at `.original.tsx`
|
|
73
|
+
- **Config access changed** - Use generated config values instead of `import.meta.graphCommerce`
|
|
74
|
+
- **ESLint config format** - Must use flat config (`eslint.config.mjs`)
|
|
75
|
+
- **Lingui config** - Rename `lingui.config.js` to `lingui.config.ts`
|
|
76
|
+
|
|
77
|
+
### 🗑️ Removed
|
|
78
|
+
|
|
79
|
+
- `InterceptorPlugin` webpack plugin
|
|
80
|
+
- `configToImportMeta` utility
|
|
81
|
+
- Webpack `DefinePlugin` usage for config
|
|
82
|
+
- `@mui/*` modern alias rewrites
|
|
83
|
+
- Debug plugins (`CircularDependencyPlugin`, `DuplicatesPlugin`) ([@paales](https://github.com/paales))
|
|
84
|
+
|
|
3
85
|
## 9.1.0-canary.55
|
|
4
86
|
|
|
5
87
|
### Patch Changes
|
|
@@ -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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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 {
|
|
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 = !
|
|
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
|
|
71
|
+
<Trans>Sign in or create an account!</Trans>
|
|
71
72
|
</LayoutTitle>
|
|
72
73
|
<Typography variant='h6' align='center'>
|
|
73
|
-
<Trans
|
|
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
|
|
82
|
+
<Trans>Sign in</Trans>
|
|
82
83
|
</LayoutTitle>
|
|
83
84
|
<Typography variant='h6' align='center'>
|
|
84
|
-
<Trans
|
|
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
|
|
93
|
+
<Trans>Create account!</Trans>
|
|
93
94
|
</LayoutTitle>
|
|
94
95
|
<Typography variant='h6' align='center'>
|
|
95
|
-
<Trans
|
|
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
|
|
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
|
|
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
|
|
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
|
|
123
|
+
<Trans>Your session is expired</Trans>
|
|
123
124
|
</LayoutTitle>
|
|
124
125
|
<Typography variant='h6' align='center'>
|
|
125
|
-
<Trans
|
|
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
|
|
150
|
-
{ value: 'signup', title: <Trans
|
|
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
|
|
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
|
|
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
|
|
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
|
|
|
@@ -19,7 +19,7 @@ export function AddressAddition<
|
|
|
19
19
|
variant='outlined'
|
|
20
20
|
type='text'
|
|
21
21
|
required={required[name.addition]}
|
|
22
|
-
label={<Trans
|
|
22
|
+
label={<Trans>Addition</Trans>}
|
|
23
23
|
autoComplete='address-line3'
|
|
24
24
|
showValid
|
|
25
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
|
|
|
@@ -19,7 +19,7 @@ export function AddressCity<
|
|
|
19
19
|
variant='outlined'
|
|
20
20
|
type='text'
|
|
21
21
|
required={required[name.city]}
|
|
22
|
-
label={<Trans
|
|
22
|
+
label={<Trans>City</Trans>}
|
|
23
23
|
showValid
|
|
24
24
|
InputProps={{ readOnly }}
|
|
25
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
|
|
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
|
|
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
|
|
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 {
|
|
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
|
|
|
@@ -20,12 +20,12 @@ export function AddressHousenumber<
|
|
|
20
20
|
rules={{
|
|
21
21
|
pattern: {
|
|
22
22
|
value: houseNumberPattern,
|
|
23
|
-
message:
|
|
23
|
+
message: t`Please provide a valid house number`,
|
|
24
24
|
},
|
|
25
25
|
}}
|
|
26
26
|
variant='outlined'
|
|
27
27
|
type='text'
|
|
28
|
-
label={<Trans
|
|
28
|
+
label={<Trans>Housenumber</Trans>}
|
|
29
29
|
autoComplete='address-line2'
|
|
30
30
|
showValid
|
|
31
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
|
|
|
@@ -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
|
|
|
@@ -18,7 +18,7 @@ export function AddressStreet<
|
|
|
18
18
|
required={required[name.street]}
|
|
19
19
|
name={name.street}
|
|
20
20
|
type='text'
|
|
21
|
-
label={<Trans
|
|
21
|
+
label={<Trans>Street</Trans>}
|
|
22
22
|
autoComplete='address-line1'
|
|
23
23
|
showValid
|
|
24
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
|
|
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
|
|
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
|
|
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 {
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
98
|
+
<Trans>Successfully changed password</Trans>
|
|
99
99
|
</MessageSnackbar>
|
|
100
100
|
)}
|
|
101
101
|
</Form>
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
import type { FieldPath, FieldValues } from '@graphcommerce/ecommerce-ui'
|
|
2
2
|
import { ActionCardListForm, useWatch } from '@graphcommerce/ecommerce-ui'
|
|
3
|
+
import { customerCompanyFieldsEnable, magentoVersion } from '@graphcommerce/next-config/config'
|
|
3
4
|
import type { ActionCardProps } from '@graphcommerce/next-ui'
|
|
4
5
|
import { ActionCard, FormRow, useStorefrontConfig } from '@graphcommerce/next-ui'
|
|
5
|
-
import { t } from '@lingui/macro'
|
|
6
|
+
import { t } from '@lingui/core/macro'
|
|
6
7
|
import { CompanyName } from './CompanyName'
|
|
7
8
|
import { CompanyVAT } from './CompanyVAT'
|
|
8
9
|
import type { CompanyFieldsOptions } from './useCompanyFieldsForm'
|
|
@@ -23,9 +24,7 @@ export function CompanyFields<
|
|
|
23
24
|
|
|
24
25
|
const isCompany = useWatch({ name: name.isCompany, control })
|
|
25
26
|
|
|
26
|
-
const enable =
|
|
27
|
-
useStorefrontConfig().customerCompanyFieldsEnable ??
|
|
28
|
-
import.meta.graphCommerce.customerCompanyFieldsEnable
|
|
27
|
+
const enable = useStorefrontConfig().customerCompanyFieldsEnable ?? customerCompanyFieldsEnable
|
|
29
28
|
|
|
30
29
|
if (!enable) return null
|
|
31
30
|
|
|
@@ -61,7 +60,7 @@ export function CompanyFields<
|
|
|
61
60
|
{isCompany && (
|
|
62
61
|
<FormRow>
|
|
63
62
|
<CompanyName {...props} />
|
|
64
|
-
{
|
|
63
|
+
{magentoVersion >= 245 && <CompanyVAT {...props} />}
|
|
65
64
|
</FormRow>
|
|
66
65
|
)}
|
|
67
66
|
</>
|
|
@@ -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 { CompanyFieldsOptions } from './useCompanyFieldsForm'
|
|
5
5
|
import { useCompanyFieldsForm } from './useCompanyFieldsForm'
|
|
6
6
|
|
|
@@ -18,7 +18,7 @@ export function CompanyName<
|
|
|
18
18
|
variant='outlined'
|
|
19
19
|
type='text'
|
|
20
20
|
required
|
|
21
|
-
label={<Trans
|
|
21
|
+
label={<Trans>Company name</Trans>}
|
|
22
22
|
showValid
|
|
23
23
|
InputProps={{ readOnly }}
|
|
24
24
|
/>
|