@graphcommerce/magento-cart 7.0.0-canary.21 → 7.0.1-canary.0

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,6 +1,198 @@
1
1
  # Change Log
2
2
 
3
- ## 7.0.0-canary.21
3
+ ## 7.0.1-canary.0
4
+
5
+ ## 7.0.0
6
+
7
+ ### Minor Changes
8
+
9
+ - [#1962](https://github.com/graphcommerce-org/graphcommerce/pull/1962) [`518b6ca24`](https://github.com/graphcommerce-org/graphcommerce/commit/518b6ca248fc94624dc06eb02de5b3eac0fc9483) - Created a new `<ValidatedPasswordElement/>` which validates according to Magento's validation groups and implement on all locations. Move remaining password fields to `<PasswordElement />` ([@carlocarels90](https://github.com/carlocarels90))
10
+
11
+ ### Patch Changes
12
+
13
+ - [#1916](https://github.com/graphcommerce-org/graphcommerce/pull/1916) [`ee2f814f4`](https://github.com/graphcommerce-org/graphcommerce/commit/ee2f814f4d91898f106036e92be4e560d638509d) - When the customer is logging in and the merge cart functionality throws an error, it would not set the current customer's cart as active, but keep the faulty cart active. ([@paales](https://github.com/paales))
14
+
15
+ - [#2031](https://github.com/graphcommerce-org/graphcommerce/pull/2031) [`4d8fc9e99`](https://github.com/graphcommerce-org/graphcommerce/commit/4d8fc9e998fc9361282833316ec9564da0644ed6) - Eslint fixes and suppress accepted warnings ([@paales](https://github.com/paales))
16
+
17
+ - [#1914](https://github.com/graphcommerce-org/graphcommerce/pull/1914) [`000556331`](https://github.com/graphcommerce-org/graphcommerce/commit/000556331f5379c71d7edca541fd0b145b7dc435) - When there is an error in the cart, disable the checkout buttons ([@paales](https://github.com/paales))
18
+
19
+ - [#1942](https://github.com/graphcommerce-org/graphcommerce/pull/1942) [`045d0a6cb`](https://github.com/graphcommerce-org/graphcommerce/commit/045d0a6cbbfc6339852c19dd21f349bb51c38fcd) - When the ApolloCartError would throw an authorization error it would link to the wrong page ([@paales](https://github.com/paales))
20
+
21
+ - [#1914](https://github.com/graphcommerce-org/graphcommerce/pull/1914) [`38d6c4888`](https://github.com/graphcommerce-org/graphcommerce/commit/38d6c488850013b36cae9f388996039219c1327e) - Errors in the cart didn't allow for recovery from the faulty state ([@paales](https://github.com/paales))
22
+
23
+ - [#1914](https://github.com/graphcommerce-org/graphcommerce/pull/1914) [`5d115a11a`](https://github.com/graphcommerce-org/graphcommerce/commit/5d115a11a417f35c3315879c785d24ae32e64663) - When a customer tries to add a product to an invalid customer cart, discard the cart and create a new cart ([@paales](https://github.com/paales))
24
+
25
+ ## 6.2.0-canary.98
26
+
27
+ ## 6.2.0-canary.97
28
+
29
+ ## 6.2.0-canary.96
30
+
31
+ ## 6.2.0-canary.95
32
+
33
+ ## 6.2.0-canary.94
34
+
35
+ ## 6.2.0-canary.93
36
+
37
+ ## 6.2.0-canary.92
38
+
39
+ ## 6.2.0-canary.91
40
+
41
+ ## 6.2.0-canary.90
42
+
43
+ ## 6.2.0-canary.89
44
+
45
+ ### Patch Changes
46
+
47
+ - [#2031](https://github.com/graphcommerce-org/graphcommerce/pull/2031) [`4d8fc9e99`](https://github.com/graphcommerce-org/graphcommerce/commit/4d8fc9e998fc9361282833316ec9564da0644ed6) - Eslint fixes and suppress accepted warnings ([@paales](https://github.com/paales))
48
+
49
+ ## 6.2.0-canary.88
50
+
51
+ ## 6.2.0-canary.87
52
+
53
+ ## 6.2.0-canary.86
54
+
55
+ ## 6.2.0-canary.85
56
+
57
+ ## 6.2.0-canary.84
58
+
59
+ ## 6.2.0-canary.83
60
+
61
+ ## 6.2.0-canary.82
62
+
63
+ ## 6.2.0-canary.81
64
+
65
+ ## 6.2.0-canary.80
66
+
67
+ ## 6.2.0-canary.79
68
+
69
+ ### Patch Changes
70
+
71
+ - [#2013](https://github.com/graphcommerce-org/graphcommerce/pull/2013) [`c57bdf8a4`](https://github.com/graphcommerce-org/graphcommerce/commit/c57bdf8a4ce936c3eedc4dfada3a464a113ac68a) - Updated @mui and framer-motion packages to latest versions ([@paales](https://github.com/paales))
72
+
73
+ ## 6.2.0-canary.78
74
+
75
+ ## 6.2.0-canary.77
76
+
77
+ ## 6.2.0-canary.76
78
+
79
+ ## 6.2.0-canary.75
80
+
81
+ ## 6.2.0-canary.74
82
+
83
+ ## 6.2.0-canary.73
84
+
85
+ ## 6.2.0-canary.72
86
+
87
+ ## 6.2.0-canary.71
88
+
89
+ ## 6.2.0-canary.70
90
+
91
+ ## 6.2.0-canary.69
92
+
93
+ ## 6.2.0-canary.68
94
+
95
+ ## 6.2.0-canary.67
96
+
97
+ ## 6.2.0-canary.66
98
+
99
+ ## 6.2.0-canary.65
100
+
101
+ ## 6.2.0-canary.64
102
+
103
+ ## 6.2.0-canary.63
104
+
105
+ ## 6.2.0-canary.62
106
+
107
+ ## 6.2.0-canary.61
108
+
109
+ ## 6.2.0-canary.60
110
+
111
+ ## 6.2.0-canary.59
112
+
113
+ ## 6.2.0-canary.58
114
+
115
+ ## 6.2.0-canary.57
116
+
117
+ ## 6.2.0-canary.56
118
+
119
+ ## 6.2.0-canary.55
120
+
121
+ ## 6.2.0-canary.54
122
+
123
+ ## 6.2.0-canary.53
124
+
125
+ ## 6.2.0-canary.52
126
+
127
+ ## 6.2.0-canary.51
128
+
129
+ ## 6.2.0-canary.50
130
+
131
+ ## 6.2.0-canary.49
132
+
133
+ ## 6.2.0-canary.48
134
+
135
+ ## 6.2.0-canary.47
136
+
137
+ ## 6.2.0-canary.46
138
+
139
+ ## 6.2.0-canary.45
140
+
141
+ ### Minor Changes
142
+
143
+ - [#1962](https://github.com/graphcommerce-org/graphcommerce/pull/1962) [`518b6ca24`](https://github.com/graphcommerce-org/graphcommerce/commit/518b6ca248fc94624dc06eb02de5b3eac0fc9483) - Created a new `<ValidatedPasswordElement/>` which validates according to Magento's validation groups and implement on all locations. Move remaining password fields to `<PasswordElement />` ([@carlocarels90](https://github.com/carlocarels90))
144
+
145
+ ## 6.2.0-canary.44
146
+
147
+ ## 6.2.0-canary.43
148
+
149
+ ## 6.2.0-canary.42
150
+
151
+ ## 6.2.0-canary.41
152
+
153
+ ## 6.2.0-canary.40
154
+
155
+ ## 6.2.0-canary.39
156
+
157
+ ## 6.2.0-canary.38
158
+
159
+ ## 6.2.0-canary.37
160
+
161
+ ## 6.2.0-canary.36
162
+
163
+ ## 6.2.0-canary.35
164
+
165
+ ## 6.2.0-canary.34
166
+
167
+ ## 6.2.0-canary.33
168
+
169
+ ## 6.2.0-canary.32
170
+
171
+ ## 6.2.0-canary.31
172
+
173
+ ## 6.2.0-canary.30
174
+
175
+ ### Patch Changes
176
+
177
+ - [#1942](https://github.com/graphcommerce-org/graphcommerce/pull/1942) [`045d0a6cb`](https://github.com/graphcommerce-org/graphcommerce/commit/045d0a6cbbfc6339852c19dd21f349bb51c38fcd) - When the ApolloCartError would throw an authorization error it would link to the wrong page ([@paales](https://github.com/paales))
178
+
179
+ ## 6.2.0-canary.29
180
+
181
+ ## 6.2.0-canary.28
182
+
183
+ ## 6.2.0-canary.27
184
+
185
+ ## 6.2.0-canary.26
186
+
187
+ ## 6.2.0-canary.25
188
+
189
+ ## 6.2.0-canary.24
190
+
191
+ ## 6.2.0-canary.23
192
+
193
+ ## 6.2.0-canary.22
194
+
195
+ ## 6.2.0-canary.21
4
196
 
5
197
  ## 6.2.0-canary.20
6
198
 
@@ -42,7 +42,7 @@ export function ApolloCartErrorAlert(props: ApolloCartErrorAlertProps) {
42
42
  <Button onClick={clear} color='error' size='small'>
43
43
  <Trans id='Sign out' />
44
44
  </Button>
45
- <Button href='/account/login' color='error' size='small'>
45
+ <Button href='/account/signin' color='error' size='small'>
46
46
  <Trans id='Sign in' />
47
47
  </Button>
48
48
  </>
@@ -2,23 +2,13 @@ import { CheckboxElement } from '@graphcommerce/ecommerce-ui'
2
2
  import { useQuery } from '@graphcommerce/graphql'
3
3
  import { extendableComponent, FormDiv } from '@graphcommerce/next-ui'
4
4
  import {
5
- Controller,
6
5
  useForm,
7
6
  useFormCompose,
8
7
  UseFormComposeOptions,
9
8
  useFormPersist,
10
9
  } from '@graphcommerce/react-hook-form'
11
10
  import { i18n } from '@lingui/core'
12
- import {
13
- Box,
14
- Checkbox,
15
- FormControl,
16
- FormControlLabel,
17
- FormHelperText,
18
- Link,
19
- SxProps,
20
- Theme,
21
- } from '@mui/material'
11
+ import { Box, Link, SxProps, Theme } from '@mui/material'
22
12
  import React from 'react'
23
13
  import { CartAgreementsDocument } from './CartAgreements.gql'
24
14
 
@@ -42,7 +32,7 @@ export function CartAgreementsForm(props: CartAgreementsFormProps) {
42
32
 
43
33
  const form = useForm()
44
34
 
45
- const { handleSubmit, formState, control } = form
35
+ const { handleSubmit, control } = form
46
36
 
47
37
  const submit = handleSubmit((values) => {
48
38
  // eslint-disable-next-line no-console
@@ -83,7 +83,7 @@ export function CartItemSummary(props: OrderSummaryProps) {
83
83
  >
84
84
  <IconSvg src={iconChevronLeft} />
85
85
  </ScrollerButton>
86
- <Box className={classes.scrollerContainer} sx={{ padding: '1px' }}>
86
+ <Box className={classes.scrollerContainer} sx={{ padding: '1px', display: 'flex' }}>
87
87
  <Scroller className={classes.scroller}>
88
88
  {items?.map((item) => (
89
89
  <React.Fragment key={item?.uid}>
@@ -9,7 +9,7 @@ export type CartStartCheckoutLinkOrButtonProps = CartStartCheckoutFragment & {
9
9
  sx?: SxProps<Theme>
10
10
  disabled?: boolean
11
11
  onStart?: (
12
- e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>,
12
+ e: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLSpanElement>,
13
13
  cart: CartStartCheckoutFragment,
14
14
  ) => void
15
15
  linkOrButtonProps?: LinkOrButtonProps
@@ -30,7 +30,9 @@ export function CartStartCheckoutLinkOrButton(props: CartStartCheckoutLinkOrButt
30
30
  return (
31
31
  <LinkOrButton
32
32
  href='/checkout'
33
- onClick={(e: React.MouseEvent<HTMLButtonElement | HTMLAnchorElement>) => {
33
+ onClick={(
34
+ e: React.MouseEvent<HTMLButtonElement & HTMLAnchorElement & HTMLSpanElement, MouseEvent>,
35
+ ) => {
34
36
  onClick?.(e)
35
37
  onStart?.(e, cart)
36
38
  }}
@@ -68,6 +68,7 @@ export function CartTotals(props: CartTotalsProps) {
68
68
 
69
69
  '&.containerMargin': {
70
70
  marginTop: theme.spacings.md,
71
+ px: theme.spacings.xs,
71
72
  },
72
73
  }),
73
74
  ...(Array.isArray(sx) ? sx : [sx]),
@@ -14,6 +14,7 @@ export function EmptyCart(props: EmptyCartProps) {
14
14
 
15
15
  return (
16
16
  <FullPageMessage
17
+ sx={(theme) => ({ mt: { md: theme.spacings.md } })}
17
18
  title={<Trans id='Your cart is empty' />}
18
19
  icon={<IconSvg src={iconShoppingBag} size='xxl' />}
19
20
  button={
@@ -6,6 +6,7 @@ import {
6
6
  } from '@graphcommerce/magento-customer'
7
7
  import { Button, FormRow, extendableComponent } from '@graphcommerce/next-ui'
8
8
  import { Trans } from '@lingui/react'
9
+ // eslint-disable-next-line @typescript-eslint/no-restricted-imports
9
10
  import { Box, SxProps, TextField, Theme, Typography } from '@mui/material'
10
11
  import React, { useState } from 'react'
11
12
  import { useCartQuery } from '../../hooks/useCartQuery'
@@ -49,6 +50,7 @@ export function InlineAccount(props: InlineAccountProps) {
49
50
  borderRadius: '4px',
50
51
  border: `1px solid ${theme.palette.divider}`,
51
52
  padding: theme.spacings.md,
53
+ marginTop: theme.spacings.sm,
52
54
  }),
53
55
  ...(Array.isArray(sx) ? sx : [sx]),
54
56
  ]}
@@ -116,7 +118,21 @@ export function InlineAccount(props: InlineAccountProps) {
116
118
  )}
117
119
 
118
120
  {loggedIn && (
119
- <Box className={classes.innerContainer}>
121
+ <Box
122
+ className={classes.innerContainer}
123
+ sx={(theme) => ({
124
+ display: 'flex',
125
+ justifyContent: 'space-between',
126
+ flexDirection: 'column',
127
+ alignItems: 'flex-start',
128
+ gap: theme.spacings.md,
129
+ [theme.breakpoints.up('sm')]: {
130
+ alignItems: 'flex-end',
131
+ flexDirection: 'unset',
132
+ gap: 0,
133
+ },
134
+ })}
135
+ >
120
136
  <div>
121
137
  <Typography variant='h4' className={classes.title}>
122
138
  {title ?? <Trans id='Have an account?' />}
@@ -34,7 +34,7 @@ export function useCartQuery<Q, V extends { cartId: string; [index: string]: unk
34
34
  queryOptions.variables = { cartId, ...options?.variables } as V
35
35
  queryOptions.skip = queryOptions?.skip || !cartId
36
36
 
37
- const result = useQuery(document, queryOptions)
37
+ const result = useQuery(document, queryOptions as QueryHookOptions<Q, V>)
38
38
 
39
39
  return {
40
40
  ...result,
@@ -1,14 +1,14 @@
1
- import { OperationVariables, QueryHookOptions, useQuery } from '@graphcommerce/graphql'
2
- import { CurrentCartIdDocument, CurrentCartIdQuery } from './CurrentCartId.gql'
1
+ import { QueryHookOptions, useQuery } from '@graphcommerce/graphql'
2
+ import {
3
+ CurrentCartIdDocument,
4
+ CurrentCartIdQuery,
5
+ CurrentCartIdQueryVariables,
6
+ } from './CurrentCartId.gql'
3
7
 
4
- type UseCurrentCartIdOptions<Q, V extends OperationVariables> = QueryHookOptions<
5
- Q & Pick<CurrentCartIdQuery, 'currentCartId'>,
6
- V
7
- >
8
-
9
- export function useCurrentCartId<Q, V extends OperationVariables>(
10
- options: UseCurrentCartIdOptions<Q, V> = {},
11
- ) {
12
- const queryResults = useQuery(CurrentCartIdDocument, { ...options })
8
+ export function useCurrentCartId<
9
+ Q extends CurrentCartIdQuery,
10
+ V extends CurrentCartIdQueryVariables,
11
+ >(options: QueryHookOptions<Q, V> = {}) {
12
+ const queryResults = useQuery<Q, V>(CurrentCartIdDocument, options)
13
13
  return { currentCartId: queryResults.data?.currentCartId?.id || '', ...queryResults }
14
14
  }
@@ -7,7 +7,7 @@ import {
7
7
  import { useCartIdCreate } from './useCartIdCreate'
8
8
 
9
9
  export function useFormGqlMutationCart<
10
- Q extends Record<string, any>,
10
+ Q extends Record<string, unknown>,
11
11
  V extends { cartId: string; [index: string]: unknown },
12
12
  >(
13
13
  document: TypedDocumentNode<Q, V>,
@@ -1,9 +1,9 @@
1
1
  import { fromPromise, globalApolloClient, Operation } from '@graphcommerce/graphql'
2
2
  import { onError } from '@graphcommerce/graphql/apollo'
3
+ import { ErrorCategory } from '@graphcommerce/magento-graphql'
4
+ import type { GraphQLError } from 'graphql'
3
5
  import { writeCartId } from '../hooks'
4
6
  import { CreateEmptyCartDocument } from '../hooks/CreateEmptyCart.gql'
5
- import { GraphQLError } from 'graphql'
6
- import { ErrorCategory } from '@graphcommerce/magento-graphql'
7
7
 
8
8
  type CartOperation = Operation & { variables: { cartId: string } }
9
9
  function isCartOperation(operation: Operation): operation is CartOperation {
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-cart",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "7.0.0-canary.21",
5
+ "version": "7.0.1-canary.0",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,26 +12,27 @@
12
12
  }
13
13
  },
14
14
  "devDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "7.0.0-canary.21",
16
- "@graphcommerce/prettier-config-pwa": "7.0.0-canary.21",
17
- "@graphcommerce/typescript-config-pwa": "7.0.0-canary.21"
15
+ "@graphcommerce/eslint-config-pwa": "7.0.1-canary.0",
16
+ "@graphcommerce/prettier-config-pwa": "7.0.1-canary.0",
17
+ "@graphcommerce/typescript-config-pwa": "7.0.1-canary.0"
18
18
  },
19
19
  "dependencies": {
20
- "@graphcommerce/ecommerce-ui": "7.0.0-canary.21",
21
- "@graphcommerce/framer-utils": "7.0.0-canary.21",
22
- "@graphcommerce/framer-next-pages": "7.0.0-canary.21",
23
- "@graphcommerce/framer-scroller": "7.0.0-canary.21",
24
- "@graphcommerce/graphql": "7.0.0-canary.21",
25
- "@graphcommerce/image": "7.0.0-canary.21",
26
- "@graphcommerce/magento-customer": "7.0.0-canary.21",
27
- "@graphcommerce/magento-graphql": "7.0.0-canary.21",
28
- "@graphcommerce/magento-store": "7.0.0-canary.21",
29
- "@graphcommerce/next-ui": "7.0.0-canary.21",
30
- "@graphcommerce/react-hook-form": "7.0.0-canary.21"
20
+ "@graphcommerce/ecommerce-ui": "7.0.1-canary.0",
21
+ "@graphcommerce/framer-utils": "7.0.1-canary.0",
22
+ "@graphcommerce/framer-next-pages": "7.0.1-canary.0",
23
+ "@graphcommerce/framer-scroller": "7.0.1-canary.0",
24
+ "@graphcommerce/graphql": "7.0.1-canary.0",
25
+ "@graphcommerce/image": "7.0.1-canary.0",
26
+ "@graphcommerce/magento-customer": "7.0.1-canary.0",
27
+ "@graphcommerce/magento-graphql": "7.0.1-canary.0",
28
+ "@graphcommerce/magento-store": "7.0.1-canary.0",
29
+ "@graphcommerce/next-ui": "7.0.1-canary.0",
30
+ "@graphcommerce/react-hook-form": "7.0.1-canary.0"
31
31
  },
32
32
  "peerDependencies": {
33
- "@lingui/react": "^3.13.2",
34
- "@lingui/core": "^3.13.2",
33
+ "@lingui/react": "^4.2.1",
34
+ "@lingui/core": "^4.2.1",
35
+ "@lingui/macro": "^4.2.1",
35
36
  "@mui/material": "^5.10.16",
36
37
  "framer-motion": "^10.0.0",
37
38
  "next": "^13.2.0",
@@ -1,3 +1,4 @@
1
+ /* eslint-disable import/no-extraneous-dependencies */
1
2
  import { ApolloClient, NormalizedCacheObject } from '@graphcommerce/graphql'
2
3
  import { Page } from '@playwright/test'
3
4
  import { CartAgreementsDocument } from '../components/CartAgreementsForm/CartAgreements.gql'