@graphcommerce/ecommerce-ui 7.1.0-canary.9 → 8.0.0-canary.69

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,125 @@
1
1
  # @graphcommerce/ecommerce-ui
2
2
 
3
+ ## 8.0.0-canary.69
4
+
5
+ ## 7.1.0-canary.68
6
+
7
+ ## 7.1.0-canary.67
8
+
9
+ ## 7.1.0-canary.66
10
+
11
+ ## 7.1.0-canary.65
12
+
13
+ ## 7.1.0-canary.64
14
+
15
+ ## 7.1.0-canary.63
16
+
17
+ ## 7.1.0-canary.62
18
+
19
+ ## 7.1.0-canary.61
20
+
21
+ ## 7.1.0-canary.60
22
+
23
+ ## 7.1.0-canary.59
24
+
25
+ ## 7.1.0-canary.58
26
+
27
+ ## 7.1.0-canary.57
28
+
29
+ ## 7.1.0-canary.56
30
+
31
+ ## 7.1.0-canary.55
32
+
33
+ ## 7.1.0-canary.54
34
+
35
+ ## 7.1.0-canary.53
36
+
37
+ ## 7.1.0-canary.52
38
+
39
+ ## 7.1.0-canary.51
40
+
41
+ ## 7.1.0-canary.50
42
+
43
+ ## 7.1.0-canary.49
44
+
45
+ ## 7.1.0-canary.48
46
+
47
+ ## 7.1.0-canary.47
48
+
49
+ ### Minor Changes
50
+
51
+ - [#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))
52
+
53
+ ## 7.1.0-canary.46
54
+
55
+ ## 7.1.0-canary.45
56
+
57
+ ## 7.1.0-canary.38
58
+
59
+ ### Minor Changes
60
+
61
+ - [#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))
62
+
63
+ ## 7.1.0-canary.37
64
+
65
+ ## 7.1.0-canary.36
66
+
67
+ ## 7.1.0-canary.35
68
+
69
+ ## 7.1.0-canary.34
70
+
71
+ ## 7.1.0-canary.33
72
+
73
+ ## 7.1.0-canary.32
74
+
75
+ ## 7.1.0-canary.31
76
+
77
+ ## 7.1.0-canary.30
78
+
79
+ ## 7.1.0-canary.29
80
+
81
+ ## 7.1.0-canary.28
82
+
83
+ ### Minor Changes
84
+
85
+ - [#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))
86
+
87
+ ## 7.1.0-canary.27
88
+
89
+ ## 7.1.0-canary.26
90
+
91
+ ## 7.1.0-canary.25
92
+
93
+ ## 7.1.0-canary.24
94
+
95
+ ## 7.1.0-canary.23
96
+
97
+ ## 7.1.0-canary.22
98
+
99
+ ## 7.1.0-canary.21
100
+
101
+ ## 7.1.0-canary.20
102
+
103
+ ## 7.1.0-canary.19
104
+
105
+ ## 7.1.0-canary.18
106
+
107
+ ## 7.1.0-canary.17
108
+
109
+ ## 7.1.0-canary.16
110
+
111
+ ## 7.1.0-canary.15
112
+
113
+ ## 7.1.0-canary.14
114
+
115
+ ## 7.1.0-canary.13
116
+
117
+ ## 7.1.0-canary.12
118
+
119
+ ## 7.1.0-canary.11
120
+
121
+ ## 7.1.0-canary.10
122
+
3
123
  ## 7.1.0-canary.9
4
124
 
5
125
  ## 7.1.0-canary.8
@@ -956,31 +1076,31 @@
956
1076
  All occurences of `<Trans>` and `t` need to be replaced:
957
1077
 
958
1078
  ```tsx
959
- import { Trans, t } from '@lingui/macro'
1079
+ import { Trans, t } from "@lingui/macro";
960
1080
 
961
1081
  function MyComponent() {
962
- const foo = 'bar'
1082
+ const foo = "bar";
963
1083
  return (
964
1084
  <div aria-label={t`Account ${foo}`}>
965
1085
  <Trans>My Translation {foo}</Trans>
966
1086
  </div>
967
- )
1087
+ );
968
1088
  }
969
1089
  ```
970
1090
 
971
1091
  Needs to be replaced with:
972
1092
 
973
1093
  ```tsx
974
- import { Trans } from '@lingui/react'
975
- import { i18n } from '@lingui/core'
1094
+ import { Trans } from "@lingui/react";
1095
+ import { i18n } from "@lingui/core";
976
1096
 
977
1097
  function MyComponent() {
978
- const foo = 'bar'
1098
+ const foo = "bar";
979
1099
  return (
980
1100
  <div aria-label={i18n._(/* i18n */ `Account {foo}`, { foo })}>
981
- <Trans key='My Translation {foo}' values={{ foo }}></Trans>
1101
+ <Trans key="My Translation {foo}" values={{ foo }}></Trans>
982
1102
  </div>
983
- )
1103
+ );
984
1104
  }
985
1105
  ```
986
1106
 
@@ -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
- Network Error: {error.networkError.message}
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].message ?? error?.networkError?.message}
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 && <>Network Error: {error.networkError.message}</>}
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',
@@ -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(false)
17
- useEffect(() => startTransition(() => setMounted(true)), [])
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": "7.1.0-canary.9",
5
+ "version": "8.0.0-canary.69",
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.9",
16
- "@graphcommerce/next-ui": "7.1.0-canary.9",
17
- "@graphcommerce/react-hook-form": "7.1.0-canary.9"
18
- },
19
- "devDependencies": {
20
- "@graphcommerce/eslint-config-pwa": "7.1.0-canary.9",
21
- "@graphcommerce/prettier-config-pwa": "7.1.0-canary.9",
22
- "@graphcommerce/typescript-config-pwa": "7.1.0-canary.9"
23
- },
24
14
  "peerDependencies": {
25
- "@lingui/react": "^4.2.1",
15
+ "@graphcommerce/eslint-config-pwa": "^8.0.0-canary.69",
16
+ "@graphcommerce/graphql": "^8.0.0-canary.69",
17
+ "@graphcommerce/next-ui": "^8.0.0-canary.69",
18
+ "@graphcommerce/prettier-config-pwa": "^8.0.0-canary.69",
19
+ "@graphcommerce/react-hook-form": "^8.0.0-canary.69",
20
+ "@graphcommerce/typescript-config-pwa": "^8.0.0-canary.69",
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": "^13.2.0",
26
+ "next": "*",
31
27
  "react": "^18.2.0",
32
28
  "react-dom": "^18.2.0"
33
29
  }