@graphcommerce/ecommerce-ui 7.1.0-canary.8 → 8.0.0-canary.100
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 +197 -8
- package/components/ApolloError/ApolloErrorAlert.tsx +3 -1
- package/components/ApolloError/ApolloErrorFullPage.tsx +3 -2
- package/components/ApolloError/ApolloErrorSnackbar.tsx +2 -1
- package/components/ApolloError/maskNetworkError.tsx +26 -0
- package/components/FormComponents/NumberFieldElement.tsx +5 -10
- package/components/WaitForQueries/WaitForQueries.tsx +6 -3
- package/package.json +9 -13
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,194 @@
|
|
|
1
1
|
# @graphcommerce/ecommerce-ui
|
|
2
2
|
|
|
3
|
+
## 8.0.0-canary.100
|
|
4
|
+
|
|
5
|
+
## 8.0.0-canary.99
|
|
6
|
+
|
|
7
|
+
## 8.0.0-canary.98
|
|
8
|
+
|
|
9
|
+
## 8.0.0-canary.97
|
|
10
|
+
|
|
11
|
+
## 8.0.0-canary.96
|
|
12
|
+
|
|
13
|
+
## 8.0.0-canary.95
|
|
14
|
+
|
|
15
|
+
## 8.0.0-canary.94
|
|
16
|
+
|
|
17
|
+
## 8.0.0-canary.93
|
|
18
|
+
|
|
19
|
+
## 8.0.0-canary.92
|
|
20
|
+
|
|
21
|
+
## 8.0.0-canary.91
|
|
22
|
+
|
|
23
|
+
## 8.0.0-canary.90
|
|
24
|
+
|
|
25
|
+
## 8.0.0-canary.89
|
|
26
|
+
|
|
27
|
+
## 8.0.0-canary.88
|
|
28
|
+
|
|
29
|
+
## 8.0.0-canary.87
|
|
30
|
+
|
|
31
|
+
## 8.0.0-canary.86
|
|
32
|
+
|
|
33
|
+
## 8.0.0-canary.85
|
|
34
|
+
|
|
35
|
+
## 8.0.0-canary.84
|
|
36
|
+
|
|
37
|
+
## 8.0.0-canary.83
|
|
38
|
+
|
|
39
|
+
## 8.0.0-canary.82
|
|
40
|
+
|
|
41
|
+
## 8.0.0-canary.81
|
|
42
|
+
|
|
43
|
+
## 8.0.0-canary.80
|
|
44
|
+
|
|
45
|
+
## 8.0.0-canary.79
|
|
46
|
+
|
|
47
|
+
## 8.0.0-canary.78
|
|
48
|
+
|
|
49
|
+
## 8.0.0-canary.77
|
|
50
|
+
|
|
51
|
+
### Patch Changes
|
|
52
|
+
|
|
53
|
+
- [`e33660f`](https://github.com/graphcommerce-org/graphcommerce/commit/e33660f172466dcfa0ab7262cee612d9a3e47776) - a11y improvements (see https://github.com/graphcommerce-org/graphcommerce/issues/1995 for more info)
|
|
54
|
+
([@FrankHarland](https://github.com/FrankHarland))
|
|
55
|
+
|
|
56
|
+
## 8.0.0-canary.76
|
|
57
|
+
|
|
58
|
+
## 8.0.0-canary.75
|
|
59
|
+
|
|
60
|
+
## 8.0.0-canary.74
|
|
61
|
+
|
|
62
|
+
## 8.0.0-canary.73
|
|
63
|
+
|
|
64
|
+
## 8.0.0-canary.72
|
|
65
|
+
|
|
66
|
+
## 8.0.0-canary.71
|
|
67
|
+
|
|
68
|
+
## 8.0.0-canary.70
|
|
69
|
+
|
|
70
|
+
## 8.0.0-canary.69
|
|
71
|
+
|
|
72
|
+
## 7.1.0-canary.68
|
|
73
|
+
|
|
74
|
+
## 7.1.0-canary.67
|
|
75
|
+
|
|
76
|
+
## 7.1.0-canary.66
|
|
77
|
+
|
|
78
|
+
## 7.1.0-canary.65
|
|
79
|
+
|
|
80
|
+
## 7.1.0-canary.64
|
|
81
|
+
|
|
82
|
+
## 7.1.0-canary.63
|
|
83
|
+
|
|
84
|
+
## 7.1.0-canary.62
|
|
85
|
+
|
|
86
|
+
## 7.1.0-canary.61
|
|
87
|
+
|
|
88
|
+
## 7.1.0-canary.60
|
|
89
|
+
|
|
90
|
+
## 7.1.0-canary.59
|
|
91
|
+
|
|
92
|
+
## 7.1.0-canary.58
|
|
93
|
+
|
|
94
|
+
## 7.1.0-canary.57
|
|
95
|
+
|
|
96
|
+
## 7.1.0-canary.56
|
|
97
|
+
|
|
98
|
+
## 7.1.0-canary.55
|
|
99
|
+
|
|
100
|
+
## 7.1.0-canary.54
|
|
101
|
+
|
|
102
|
+
## 7.1.0-canary.53
|
|
103
|
+
|
|
104
|
+
## 7.1.0-canary.52
|
|
105
|
+
|
|
106
|
+
## 7.1.0-canary.51
|
|
107
|
+
|
|
108
|
+
## 7.1.0-canary.50
|
|
109
|
+
|
|
110
|
+
## 7.1.0-canary.49
|
|
111
|
+
|
|
112
|
+
## 7.1.0-canary.48
|
|
113
|
+
|
|
114
|
+
## 7.1.0-canary.47
|
|
115
|
+
|
|
116
|
+
### Minor Changes
|
|
117
|
+
|
|
118
|
+
- [#2111](https://github.com/graphcommerce-org/graphcommerce/pull/2111) [`35f3d3eaf`](https://github.com/graphcommerce-org/graphcommerce/commit/35f3d3eaf46f4b782bb1149e0efb0ec3819442d6) - Only show network errors in development mode. ([@Jessevdpoel](https://github.com/Jessevdpoel))
|
|
119
|
+
|
|
120
|
+
## 7.1.0-canary.46
|
|
121
|
+
|
|
122
|
+
## 7.1.0-canary.45
|
|
123
|
+
|
|
124
|
+
## 7.1.0-canary.38
|
|
125
|
+
|
|
126
|
+
### Minor Changes
|
|
127
|
+
|
|
128
|
+
- [#2048](https://github.com/graphcommerce-org/graphcommerce/pull/2048) [`13e23e426`](https://github.com/graphcommerce-org/graphcommerce/commit/13e23e4265bac70fb4d0830e4661019e71ce299f) - Wishlist will now support configurable products and uses the ActionCardLayout ([@Jessevdpoel](https://github.com/Jessevdpoel))
|
|
129
|
+
|
|
130
|
+
## 7.1.0-canary.37
|
|
131
|
+
|
|
132
|
+
## 7.1.0-canary.36
|
|
133
|
+
|
|
134
|
+
## 7.1.0-canary.35
|
|
135
|
+
|
|
136
|
+
## 7.1.0-canary.34
|
|
137
|
+
|
|
138
|
+
## 7.1.0-canary.33
|
|
139
|
+
|
|
140
|
+
## 7.1.0-canary.32
|
|
141
|
+
|
|
142
|
+
## 7.1.0-canary.31
|
|
143
|
+
|
|
144
|
+
## 7.1.0-canary.30
|
|
145
|
+
|
|
146
|
+
## 7.1.0-canary.29
|
|
147
|
+
|
|
148
|
+
## 7.1.0-canary.28
|
|
149
|
+
|
|
150
|
+
### Minor Changes
|
|
151
|
+
|
|
152
|
+
- [#2018](https://github.com/graphcommerce-org/graphcommerce/pull/2018) [`750aa6a72`](https://github.com/graphcommerce-org/graphcommerce/commit/750aa6a72710869d54244467253212e551d335e0) - Changed the layout of the succes page. We are using ActionCards right now to match the design of the cart. ([@Jessevdpoel](https://github.com/Jessevdpoel))
|
|
153
|
+
|
|
154
|
+
## 7.1.0-canary.27
|
|
155
|
+
|
|
156
|
+
## 7.1.0-canary.26
|
|
157
|
+
|
|
158
|
+
## 7.1.0-canary.25
|
|
159
|
+
|
|
160
|
+
## 7.1.0-canary.24
|
|
161
|
+
|
|
162
|
+
## 7.1.0-canary.23
|
|
163
|
+
|
|
164
|
+
## 7.1.0-canary.22
|
|
165
|
+
|
|
166
|
+
## 7.1.0-canary.21
|
|
167
|
+
|
|
168
|
+
## 7.1.0-canary.20
|
|
169
|
+
|
|
170
|
+
## 7.1.0-canary.19
|
|
171
|
+
|
|
172
|
+
## 7.1.0-canary.18
|
|
173
|
+
|
|
174
|
+
## 7.1.0-canary.17
|
|
175
|
+
|
|
176
|
+
## 7.1.0-canary.16
|
|
177
|
+
|
|
178
|
+
## 7.1.0-canary.15
|
|
179
|
+
|
|
180
|
+
## 7.1.0-canary.14
|
|
181
|
+
|
|
182
|
+
## 7.1.0-canary.13
|
|
183
|
+
|
|
184
|
+
## 7.1.0-canary.12
|
|
185
|
+
|
|
186
|
+
## 7.1.0-canary.11
|
|
187
|
+
|
|
188
|
+
## 7.1.0-canary.10
|
|
189
|
+
|
|
190
|
+
## 7.1.0-canary.9
|
|
191
|
+
|
|
3
192
|
## 7.1.0-canary.8
|
|
4
193
|
|
|
5
194
|
## 7.0.2-canary.7
|
|
@@ -954,31 +1143,31 @@
|
|
|
954
1143
|
All occurences of `<Trans>` and `t` need to be replaced:
|
|
955
1144
|
|
|
956
1145
|
```tsx
|
|
957
|
-
import { Trans, t } from
|
|
1146
|
+
import { Trans, t } from "@lingui/macro";
|
|
958
1147
|
|
|
959
1148
|
function MyComponent() {
|
|
960
|
-
const foo =
|
|
1149
|
+
const foo = "bar";
|
|
961
1150
|
return (
|
|
962
1151
|
<div aria-label={t`Account ${foo}`}>
|
|
963
1152
|
<Trans>My Translation {foo}</Trans>
|
|
964
1153
|
</div>
|
|
965
|
-
)
|
|
1154
|
+
);
|
|
966
1155
|
}
|
|
967
1156
|
```
|
|
968
1157
|
|
|
969
1158
|
Needs to be replaced with:
|
|
970
1159
|
|
|
971
1160
|
```tsx
|
|
972
|
-
import { Trans } from
|
|
973
|
-
import { i18n } from
|
|
1161
|
+
import { Trans } from "@lingui/react";
|
|
1162
|
+
import { i18n } from "@lingui/core";
|
|
974
1163
|
|
|
975
1164
|
function MyComponent() {
|
|
976
|
-
const foo =
|
|
1165
|
+
const foo = "bar";
|
|
977
1166
|
return (
|
|
978
1167
|
<div aria-label={i18n._(/* i18n */ `Account {foo}`, { foo })}>
|
|
979
|
-
<Trans key=
|
|
1168
|
+
<Trans key="My Translation {foo}" values={{ foo }}></Trans>
|
|
980
1169
|
</div>
|
|
981
|
-
)
|
|
1170
|
+
);
|
|
982
1171
|
}
|
|
983
1172
|
```
|
|
984
1173
|
|
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
import { ApolloError } from '@graphcommerce/graphql'
|
|
2
2
|
import { extendableComponent } from '@graphcommerce/next-ui/Styles/extendableComponent'
|
|
3
|
+
import { Trans } from '@lingui/react'
|
|
3
4
|
import { AlertProps, Alert, Box, SxProps, Theme } from '@mui/material'
|
|
5
|
+
import { maskNetworkError } from './maskNetworkError'
|
|
4
6
|
|
|
5
7
|
const { classes, selectors } = extendableComponent('ApolloErrorAlert', ['root', 'alert'] as const)
|
|
6
8
|
|
|
@@ -46,7 +48,7 @@ export function ApolloErrorAlert(props: ApolloErrorAlertProps) {
|
|
|
46
48
|
key='networkError'
|
|
47
49
|
>
|
|
48
50
|
<Alert severity='error' {...networkErrorAlertProps}>
|
|
49
|
-
|
|
51
|
+
{maskNetworkError(error.networkError)}
|
|
50
52
|
</Alert>
|
|
51
53
|
</Box>
|
|
52
54
|
</Box>
|
|
@@ -3,6 +3,7 @@ import { FullPageMessage, FullPageMessageProps } from '@graphcommerce/next-ui'
|
|
|
3
3
|
import { Trans } from '@lingui/react'
|
|
4
4
|
import { AlertProps } from '@mui/material'
|
|
5
5
|
import { ApolloErrorAlert } from './ApolloErrorAlert'
|
|
6
|
+
import { maskNetworkError } from './maskNetworkError'
|
|
6
7
|
|
|
7
8
|
export type ApolloErrorFullPageProps = {
|
|
8
9
|
error: ApolloError
|
|
@@ -19,14 +20,14 @@ export function ApolloErrorFullPage(props: ApolloErrorFullPageProps) {
|
|
|
19
20
|
...fullPageMessageProps
|
|
20
21
|
} = props
|
|
21
22
|
|
|
22
|
-
const errorCount = error?.graphQLErrors?.length ?? +(error?.networkError ? 1 : 0)
|
|
23
|
+
const errorCount = (error?.graphQLErrors?.length ?? 0) + (error?.networkError ? 1 : 0)
|
|
23
24
|
|
|
24
25
|
if (errorCount === 0) return null
|
|
25
26
|
|
|
26
27
|
if (errorCount === 1) {
|
|
27
28
|
return (
|
|
28
29
|
<FullPageMessage
|
|
29
|
-
title={error?.graphQLErrors[0]
|
|
30
|
+
title={error?.graphQLErrors?.[0]?.message ?? maskNetworkError(error.networkError)}
|
|
30
31
|
{...fullPageMessageProps}
|
|
31
32
|
>
|
|
32
33
|
{children}
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { ApolloError } from '@graphcommerce/graphql'
|
|
2
2
|
import { ErrorSnackbar, ErrorSnackbarProps } from '@graphcommerce/next-ui'
|
|
3
|
+
import { maskNetworkError } from './maskNetworkError'
|
|
3
4
|
|
|
4
5
|
export type ApolloErrorSnackbarProps = {
|
|
5
6
|
error?: ApolloError
|
|
@@ -14,7 +15,7 @@ export function ApolloErrorSnackbar(props: ApolloErrorSnackbarProps) {
|
|
|
14
15
|
<ErrorSnackbar variant='pill' severity='error' {...passedProps} open={!!error}>
|
|
15
16
|
<>
|
|
16
17
|
{error.graphQLErrors.map((e) => e.message).join(', ')}
|
|
17
|
-
{error.networkError
|
|
18
|
+
{maskNetworkError(error.networkError)}
|
|
18
19
|
</>
|
|
19
20
|
</ErrorSnackbar>
|
|
20
21
|
)
|
|
@@ -0,0 +1,26 @@
|
|
|
1
|
+
import { ServerError, ServerParseError } from '@graphcommerce/graphql'
|
|
2
|
+
import { Trans } from '@lingui/react'
|
|
3
|
+
|
|
4
|
+
function isServerError(error: Error | ServerParseError | ServerError | null): error is ServerError {
|
|
5
|
+
return 'name' in (error as ServerError)
|
|
6
|
+
}
|
|
7
|
+
|
|
8
|
+
function isServerParseError(
|
|
9
|
+
error: Error | ServerParseError | ServerError | null,
|
|
10
|
+
): error is ServerParseError {
|
|
11
|
+
return 'bodyText' in (error as ServerParseError)
|
|
12
|
+
}
|
|
13
|
+
|
|
14
|
+
export function maskNetworkError(networkError: Error | ServerParseError | ServerError | null) {
|
|
15
|
+
if (!networkError) return null
|
|
16
|
+
|
|
17
|
+
if (isServerParseError(networkError) || isServerError(networkError)) {
|
|
18
|
+
return <Trans id='Something went wrong on the server, please try again later.' />
|
|
19
|
+
}
|
|
20
|
+
|
|
21
|
+
if (globalThis.navigator && !globalThis.navigator?.onLine) {
|
|
22
|
+
return <Trans id='It appears you are offline, please try again later.' />
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return <Trans id='Something went wrong' />
|
|
26
|
+
}
|
|
@@ -7,15 +7,7 @@ import {
|
|
|
7
7
|
} from '@graphcommerce/next-ui'
|
|
8
8
|
import { Controller, ControllerProps, FieldValues } from '@graphcommerce/react-hook-form'
|
|
9
9
|
import { i18n } from '@lingui/core'
|
|
10
|
-
import {
|
|
11
|
-
IconButton,
|
|
12
|
-
IconButtonProps,
|
|
13
|
-
SxProps,
|
|
14
|
-
Theme,
|
|
15
|
-
TextField,
|
|
16
|
-
TextFieldProps,
|
|
17
|
-
Fab,
|
|
18
|
-
} from '@mui/material'
|
|
10
|
+
import { IconButtonProps, SxProps, Theme, TextField, TextFieldProps, Fab } from '@mui/material'
|
|
19
11
|
|
|
20
12
|
export type NumberFieldElementProps<T extends FieldValues = FieldValues> = Omit<
|
|
21
13
|
TextFieldProps,
|
|
@@ -88,6 +80,9 @@ export function NumberFieldElement<T extends FieldValues>(props: NumberFieldElem
|
|
|
88
80
|
width: responsiveVal(90, 120),
|
|
89
81
|
},
|
|
90
82
|
{
|
|
83
|
+
'& input[type=number]': {
|
|
84
|
+
MozAppearance: 'textfield',
|
|
85
|
+
},
|
|
91
86
|
'& .MuiOutlinedInput-root': {
|
|
92
87
|
px: '2px',
|
|
93
88
|
display: 'grid',
|
|
@@ -151,8 +146,8 @@ export function NumberFieldElement<T extends FieldValues>(props: NumberFieldElem
|
|
|
151
146
|
),
|
|
152
147
|
}}
|
|
153
148
|
inputProps={{
|
|
154
|
-
...inputProps,
|
|
155
149
|
'aria-label': i18n._(/* i18n */ 'Number'),
|
|
150
|
+
...inputProps,
|
|
156
151
|
className: `${inputProps?.className ?? ''} ${classes.quantityInput}`,
|
|
157
152
|
sx: {
|
|
158
153
|
typography: 'body1',
|
|
@@ -3,18 +3,21 @@ import React, { startTransition, useEffect, useState } from 'react'
|
|
|
3
3
|
|
|
4
4
|
export type WaitForQueriesProps = {
|
|
5
5
|
waitFor: QueryResult<any, any> | boolean | (QueryResult<any, any> | boolean)[] | undefined
|
|
6
|
+
noSsr?: boolean
|
|
6
7
|
children: React.ReactNode
|
|
7
8
|
fallback?: React.ReactNode
|
|
8
9
|
}
|
|
9
10
|
|
|
10
11
|
/** Shows the fallback during: SSR, Hydration and Query Loading. */
|
|
11
12
|
export const WaitForQueries = (props: WaitForQueriesProps) => {
|
|
12
|
-
const { waitFor, fallback, children } = props
|
|
13
|
+
const { waitFor, fallback, children, noSsr = false } = props
|
|
13
14
|
|
|
14
15
|
// Make sure the first render is always the same as the server.
|
|
15
16
|
// Make sure we we use startTransition to make sure we don't get into trouble with Suspense.
|
|
16
|
-
const [mounted, setMounted] = useState(
|
|
17
|
-
useEffect(() =>
|
|
17
|
+
const [mounted, setMounted] = useState(!noSsr)
|
|
18
|
+
useEffect(() => {
|
|
19
|
+
if (noSsr) startTransition(() => setMounted(true))
|
|
20
|
+
}, [noSsr])
|
|
18
21
|
|
|
19
22
|
// We are done when all queries either have data or an error.
|
|
20
23
|
const isDone = (Array.isArray(waitFor) ? waitFor : [waitFor]).every((res) => {
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/ecommerce-ui",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "
|
|
5
|
+
"version": "8.0.0-canary.100",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -11,23 +11,19 @@
|
|
|
11
11
|
"project": "./tsconfig.json"
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
|
-
"dependencies": {
|
|
15
|
-
"@graphcommerce/graphql": "7.1.0-canary.8",
|
|
16
|
-
"@graphcommerce/next-ui": "7.1.0-canary.8",
|
|
17
|
-
"@graphcommerce/react-hook-form": "7.1.0-canary.8"
|
|
18
|
-
},
|
|
19
|
-
"devDependencies": {
|
|
20
|
-
"@graphcommerce/eslint-config-pwa": "7.1.0-canary.8",
|
|
21
|
-
"@graphcommerce/prettier-config-pwa": "7.1.0-canary.8",
|
|
22
|
-
"@graphcommerce/typescript-config-pwa": "7.1.0-canary.8"
|
|
23
|
-
},
|
|
24
14
|
"peerDependencies": {
|
|
25
|
-
"@
|
|
15
|
+
"@graphcommerce/eslint-config-pwa": "^8.0.0-canary.100",
|
|
16
|
+
"@graphcommerce/graphql": "^8.0.0-canary.100",
|
|
17
|
+
"@graphcommerce/next-ui": "^8.0.0-canary.100",
|
|
18
|
+
"@graphcommerce/prettier-config-pwa": "^8.0.0-canary.100",
|
|
19
|
+
"@graphcommerce/react-hook-form": "^8.0.0-canary.100",
|
|
20
|
+
"@graphcommerce/typescript-config-pwa": "^8.0.0-canary.100",
|
|
26
21
|
"@lingui/core": "^4.2.1",
|
|
27
22
|
"@lingui/macro": "^4.2.1",
|
|
23
|
+
"@lingui/react": "^4.2.1",
|
|
28
24
|
"@mui/material": "^5.10.16",
|
|
29
25
|
"framer-motion": "^10.0.0",
|
|
30
|
-
"next": "
|
|
26
|
+
"next": "*",
|
|
31
27
|
"react": "^18.2.0",
|
|
32
28
|
"react-dom": "^18.2.0"
|
|
33
29
|
}
|