@graphcommerce/magento-cart 4.2.3 → 4.2.6

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,49 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.2.6
4
+
5
+ ### Patch Changes
6
+
7
+ - [#1399](https://github.com/graphcommerce-org/graphcommerce/pull/1399) [`fb277d8e1`](https://github.com/graphcommerce-org/graphcommerce/commit/fb277d8e1e3612c5e9cf890a30d19cfd1ff70542) Thanks [@paales](https://github.com/paales)! - Now using [@graphql-yoga](https://github.com/dotansimha/graphql-yoga) for GraphQL which has full support for [envelop](https://www.envelop.dev/) plugins.
8
+
9
+ * [#1399](https://github.com/graphcommerce-org/graphcommerce/pull/1399) [`fb277d8e1`](https://github.com/graphcommerce-org/graphcommerce/commit/fb277d8e1e3612c5e9cf890a30d19cfd1ff70542) Thanks [@paales](https://github.com/paales)! - Added a new @graphcommerce/cli package to generate the mesh so it can be generated _inside_ the @graphcommerce/graphql-mesh package to allow for better future extensibility.
10
+
11
+ - [#1399](https://github.com/graphcommerce-org/graphcommerce/pull/1399) [`da0ae7d02`](https://github.com/graphcommerce-org/graphcommerce/commit/da0ae7d0236e4908ba0bf0fa16656be516e841d4) Thanks [@paales](https://github.com/paales)! - Updated dependencies
12
+
13
+ - Updated dependencies [[`fb277d8e1`](https://github.com/graphcommerce-org/graphcommerce/commit/fb277d8e1e3612c5e9cf890a30d19cfd1ff70542), [`fb277d8e1`](https://github.com/graphcommerce-org/graphcommerce/commit/fb277d8e1e3612c5e9cf890a30d19cfd1ff70542), [`da0ae7d02`](https://github.com/graphcommerce-org/graphcommerce/commit/da0ae7d0236e4908ba0bf0fa16656be516e841d4)]:
14
+ - @graphcommerce/graphql@3.1.0
15
+ - @graphcommerce/magento-customer@4.2.4
16
+ - @graphcommerce/magento-graphql@3.0.7
17
+ - @graphcommerce/magento-store@4.1.7
18
+ - @graphcommerce/next-ui@4.6.1
19
+ - @graphcommerce/react-hook-form@3.1.1
20
+ - @graphcommerce/ecommerce-ui@1.0.7
21
+ - @graphcommerce/framer-next-pages@3.1.6
22
+ - @graphcommerce/framer-scroller@2.1.6
23
+ - @graphcommerce/image@3.1.5
24
+
25
+ ## 4.2.5
26
+
27
+ ### Patch Changes
28
+
29
+ - Updated dependencies [[`4169b8c68`](https://github.com/graphcommerce-org/graphcommerce/commit/4169b8c686f682ff6e981b029f13abd87fd5f52a)]:
30
+ - @graphcommerce/magento-customer@4.2.3
31
+
32
+ ## 4.2.4
33
+
34
+ ### Patch Changes
35
+
36
+ - [#1379](https://github.com/graphcommerce-org/graphcommerce/pull/1379) [`b8d04130a`](https://github.com/graphcommerce-org/graphcommerce/commit/b8d04130a1b1cb8fc85308939235140288744465) Thanks [@paales](https://github.com/paales)! - Removed unused trigger: onChange for useForm handler
37
+
38
+ - Updated dependencies [[`3c801f45c`](https://github.com/graphcommerce-org/graphcommerce/commit/3c801f45c7df55131acf30ae2fe0d2344830d480), [`3192fab82`](https://github.com/graphcommerce-org/graphcommerce/commit/3192fab82560e2211dfcacadc3b0b305260527d8), [`104abd14e`](https://github.com/graphcommerce-org/graphcommerce/commit/104abd14e1585ef0d8de77937d25156b8fa1e201), [`0e425e85e`](https://github.com/graphcommerce-org/graphcommerce/commit/0e425e85ee8fed280349317ee0440c7bceea5823), [`2a125b1f9`](https://github.com/graphcommerce-org/graphcommerce/commit/2a125b1f98bb9272d96c3577f21d6c984caad892), [`8a354d1cd`](https://github.com/graphcommerce-org/graphcommerce/commit/8a354d1cd4757497ddfc9b1969a0addbc8ff616b)]:
39
+ - @graphcommerce/next-ui@4.6.0
40
+ - @graphcommerce/react-hook-form@3.1.0
41
+ - @graphcommerce/image@3.1.4
42
+ - @graphcommerce/ecommerce-ui@1.0.6
43
+ - @graphcommerce/framer-scroller@2.1.5
44
+ - @graphcommerce/magento-customer@4.2.2
45
+ - @graphcommerce/magento-store@4.1.6
46
+
3
47
  ## 4.2.3
4
48
 
5
49
  ### Patch Changes
@@ -1,4 +1,4 @@
1
- import { CountryCodeEnum } from '@graphcommerce/graphql'
1
+ import type { CountryCodeEnum } from '@graphcommerce/graphql-mesh'
2
2
  import { AddressMultiLine } from '@graphcommerce/magento-customer'
3
3
  import React from 'react'
4
4
  import { CartAddressFragment } from '../CartAddress/CartAddress.gql'
@@ -1,4 +1,4 @@
1
- import { CountryCodeEnum } from '@graphcommerce/graphql'
1
+ import type { CountryCodeEnum } from '@graphcommerce/graphql-mesh'
2
2
  import { AddressSingleLine } from '@graphcommerce/magento-customer'
3
3
  import React from 'react'
4
4
  import { CartAddressFragment } from '../CartAddress/CartAddress.gql'
@@ -40,11 +40,14 @@ export function CartAgreementsForm(props: CartAgreementsFormProps) {
40
40
  )
41
41
  : []
42
42
 
43
- const form = useForm({ mode: 'onChange' })
43
+ const form = useForm()
44
44
 
45
45
  const { handleSubmit, formState, control } = form
46
46
 
47
- const submit = handleSubmit(() => {})
47
+ const submit = handleSubmit((values) => {
48
+ // eslint-disable-next-line no-console
49
+ console.log(values)
50
+ })
48
51
 
49
52
  useFormPersist({ form, name: 'PaymentAgreementsForm' })
50
53
 
@@ -68,7 +71,9 @@ export function CartAgreementsForm(props: CartAgreementsFormProps) {
68
71
  defaultValue=''
69
72
  name={`agreement[${agreement.agreement_id}]`}
70
73
  control={control}
71
- rules={{ required: t`You have to agree in order to proceed` }}
74
+ rules={{
75
+ required: t`You have to agree in order to proceed`,
76
+ }}
72
77
  render={({
73
78
  field: { onChange, value, name, ref, onBlur },
74
79
  fieldState: { error },
@@ -79,7 +84,17 @@ export function CartAgreementsForm(props: CartAgreementsFormProps) {
79
84
  sx={{ display: 'block' }}
80
85
  >
81
86
  <FormControlLabel
82
- control={<Checkbox color='secondary' required />}
87
+ control={
88
+ <Checkbox
89
+ color='secondary'
90
+ required
91
+ checked={!!value}
92
+ name={name}
93
+ inputRef={ref}
94
+ onBlur={onBlur}
95
+ onChange={(e) => onChange(e)}
96
+ />
97
+ }
83
98
  label={
84
99
  <PageLink href={href} passHref>
85
100
  <Link color='secondary' underline='hover'>
@@ -87,13 +102,8 @@ export function CartAgreementsForm(props: CartAgreementsFormProps) {
87
102
  </Link>
88
103
  </PageLink>
89
104
  }
90
- checked={!!value}
91
- inputRef={ref}
92
- onBlur={onBlur}
93
- name={name}
94
- onChange={(e) => onChange(e as React.ChangeEvent<HTMLInputElement>)}
95
105
  />
96
- {error?.message && <FormHelperText>{error.message}</FormHelperText>}
106
+ {error?.message && <FormHelperText error>{error.message}</FormHelperText>}
97
107
  </FormControl>
98
108
  )}
99
109
  />
@@ -37,6 +37,7 @@ export function CartStartCheckout(props: CartStartCheckoutProps) {
37
37
  >
38
38
  <PageLink href='/checkout' passHref>
39
39
  <Button
40
+ id='cart-start-checkout'
40
41
  variant='pill'
41
42
  color='secondary'
42
43
  size='large'
@@ -74,7 +74,7 @@ export function InlineAccount(props: InlineAccountProps) {
74
74
  })}
75
75
  >
76
76
  <div>
77
- <Typography variant='h4' className={classes.title} sx={{ paddingBottom: 8 }}>
77
+ <Typography variant='h4' className={classes.title} sx={{ paddingBottom: '8px' }}>
78
78
  {title ?? <Trans>No account yet?</Trans>}
79
79
  </Typography>
80
80
  {description ?? <Trans>You can track your order status and much more!</Trans>}
@@ -16,7 +16,7 @@ export function useCartQuery<Q, V extends { cartId: string; [index: string]: unk
16
16
  document: TypedDocumentNode<Q, V>,
17
17
  options: QueryHookOptions<Q, Omit<V, 'cartId'>> & { allowUrl?: boolean } = {},
18
18
  ) {
19
- const { allowUrl = false, ...queryOptions } = options
19
+ const { allowUrl = true, ...queryOptions } = options
20
20
 
21
21
  const router = useRouter()
22
22
  const currentCartId = useCurrentCartId()
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": "4.2.3",
5
+ "version": "4.2.6",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,22 +12,22 @@
12
12
  }
13
13
  },
14
14
  "devDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "^4.1.4",
16
- "@graphcommerce/prettier-config-pwa": "^4.0.5",
15
+ "@graphcommerce/eslint-config-pwa": "^4.1.5",
16
+ "@graphcommerce/prettier-config-pwa": "^4.0.6",
17
17
  "@graphcommerce/typescript-config-pwa": "^4.0.2",
18
- "@playwright/test": "^1.20.1"
18
+ "@playwright/test": "^1.21.1"
19
19
  },
20
20
  "dependencies": {
21
- "@graphcommerce/ecommerce-ui": "1.0.5",
22
- "@graphcommerce/framer-next-pages": "3.1.5",
23
- "@graphcommerce/framer-scroller": "2.1.4",
24
- "@graphcommerce/graphql": "3.0.7",
25
- "@graphcommerce/image": "3.1.3",
26
- "@graphcommerce/magento-customer": "4.2.1",
27
- "@graphcommerce/magento-graphql": "3.0.6",
28
- "@graphcommerce/magento-store": "4.1.5",
29
- "@graphcommerce/next-ui": "4.5.1",
30
- "@graphcommerce/react-hook-form": "3.0.7"
21
+ "@graphcommerce/ecommerce-ui": "1.0.7",
22
+ "@graphcommerce/framer-next-pages": "3.1.6",
23
+ "@graphcommerce/framer-scroller": "2.1.6",
24
+ "@graphcommerce/graphql": "3.1.0",
25
+ "@graphcommerce/image": "3.1.5",
26
+ "@graphcommerce/magento-customer": "4.2.4",
27
+ "@graphcommerce/magento-graphql": "3.0.7",
28
+ "@graphcommerce/magento-store": "4.1.7",
29
+ "@graphcommerce/next-ui": "4.6.1",
30
+ "@graphcommerce/react-hook-form": "3.1.1"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@lingui/macro": "^3.13.2",
@@ -9,6 +9,7 @@ export async function fillCartAgreementsForm(
9
9
  const res = (await client.query({ query: CartAgreementsDocument })).data
10
10
 
11
11
  for await (const agreement of res.checkoutAgreements ?? []) {
12
+ // eslint-disable-next-line no-continue
12
13
  if (!agreement?.agreement_id || agreement?.mode === 'AUTO') continue
13
14
 
14
15
  await page.locator(`input[name="agreement\\[${agreement.agreement_id}\\]"]`).click()
package/typePolicies.ts CHANGED
@@ -1,10 +1,10 @@
1
1
  import { ApolloCache, NormalizedCacheObject } from '@graphcommerce/graphql'
2
- import type { QueryCartArgs, ShippingCartAddress, TypedTypePolicies } from '@graphcommerce/graphql'
3
- import { CartPrices } from '@graphcommerce/graphql/generated/types'
2
+ import type { StrictTypedTypePolicies } from '@graphcommerce/graphql'
3
+ import type { CartPrices, QuerycartArgs, ShippingCartAddress } from '@graphcommerce/graphql-mesh'
4
4
  import { CartFabDocument } from './components/CartFab/CartFab.gql'
5
5
  import { CurrentCartIdDocument } from './hooks/CurrentCartId.gql'
6
6
 
7
- export const cartTypePolicies: TypedTypePolicies = {
7
+ export const cartTypePolicies: StrictTypedTypePolicies = {
8
8
  CurrentCartId: { keyFields: [] },
9
9
  CartPrices: {
10
10
  merge: (exiting, incomming, { mergeObjects }) => mergeObjects(exiting, incomming),
@@ -29,7 +29,7 @@ export const cartTypePolicies: TypedTypePolicies = {
29
29
  fields: {
30
30
  currentCartId: (_, { toReference }) => toReference({ __typename: 'CurrentCartId' }),
31
31
  cart: (_, { args, toReference }) =>
32
- toReference({ __typename: 'Cart', id: (args as QueryCartArgs)?.cart_id }),
32
+ toReference({ __typename: 'Cart', id: (args as QuerycartArgs)?.cart_id }),
33
33
  },
34
34
  },
35
35
  }