@graphcommerce/magento-cart 4.2.1 → 4.2.4

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,56 @@
1
1
  # Change Log
2
2
 
3
+ ## 4.2.4
4
+
5
+ ### Patch Changes
6
+
7
+ - [#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
8
+
9
+ - 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)]:
10
+ - @graphcommerce/next-ui@4.6.0
11
+ - @graphcommerce/react-hook-form@3.1.0
12
+ - @graphcommerce/image@3.1.4
13
+ - @graphcommerce/ecommerce-ui@1.0.6
14
+ - @graphcommerce/framer-scroller@2.1.5
15
+ - @graphcommerce/magento-customer@4.2.2
16
+ - @graphcommerce/magento-store@4.1.6
17
+
18
+ ## 4.2.3
19
+
20
+ ### Patch Changes
21
+
22
+ - [#1378](https://github.com/graphcommerce-org/graphcommerce/pull/1378) [`b610a6e40`](https://github.com/graphcommerce-org/graphcommerce/commit/b610a6e4049e8c9e8b5d2aeff31b8e1bfc24abe5) Thanks [@paales](https://github.com/paales)! - Pin all versions internally so we can’t end up in an unfixable state for the user
23
+
24
+ - Updated dependencies [[`b610a6e40`](https://github.com/graphcommerce-org/graphcommerce/commit/b610a6e4049e8c9e8b5d2aeff31b8e1bfc24abe5), [`22ff9df16`](https://github.com/graphcommerce-org/graphcommerce/commit/22ff9df1677742ae8e07d9b7e5b12fbb487580dc)]:
25
+ - @graphcommerce/ecommerce-ui@1.0.5
26
+ - @graphcommerce/framer-next-pages@3.1.5
27
+ - @graphcommerce/framer-scroller@2.1.4
28
+ - @graphcommerce/graphql@3.0.7
29
+ - @graphcommerce/image@3.1.3
30
+ - @graphcommerce/magento-customer@4.2.1
31
+ - @graphcommerce/magento-graphql@3.0.6
32
+ - @graphcommerce/magento-store@4.1.5
33
+ - @graphcommerce/next-ui@4.5.1
34
+ - @graphcommerce/react-hook-form@3.0.7
35
+
36
+ ## 4.2.2
37
+
38
+ ### Patch Changes
39
+
40
+ - [#1369](https://github.com/graphcommerce-org/graphcommerce/pull/1369) [`ae6449502`](https://github.com/graphcommerce-org/graphcommerce/commit/ae64495024a455bbe5188588604368c1542840c9) Thanks [@paales](https://github.com/paales)! - Upgraded dependencies
41
+
42
+ - Updated dependencies [[`892018809`](https://github.com/graphcommerce-org/graphcommerce/commit/8920188093d0422ec50580e408dc28ac5f93e46a), [`892018809`](https://github.com/graphcommerce-org/graphcommerce/commit/8920188093d0422ec50580e408dc28ac5f93e46a), [`ae6449502`](https://github.com/graphcommerce-org/graphcommerce/commit/ae64495024a455bbe5188588604368c1542840c9), [`892018809`](https://github.com/graphcommerce-org/graphcommerce/commit/8920188093d0422ec50580e408dc28ac5f93e46a), [`892018809`](https://github.com/graphcommerce-org/graphcommerce/commit/8920188093d0422ec50580e408dc28ac5f93e46a), [`6213f0b0f`](https://github.com/graphcommerce-org/graphcommerce/commit/6213f0b0f5f53d622b993d9f7ea96cbbeb5bd670), [`892018809`](https://github.com/graphcommerce-org/graphcommerce/commit/8920188093d0422ec50580e408dc28ac5f93e46a)]:
43
+ - @graphcommerce/graphql@3.0.6
44
+ - @graphcommerce/next-ui@4.5.0
45
+ - @graphcommerce/ecommerce-ui@1.0.4
46
+ - @graphcommerce/framer-next-pages@3.1.4
47
+ - @graphcommerce/framer-scroller@2.1.3
48
+ - @graphcommerce/image@3.1.2
49
+ - @graphcommerce/magento-customer@4.2.0
50
+ - @graphcommerce/magento-graphql@3.0.5
51
+ - @graphcommerce/magento-store@4.1.4
52
+ - @graphcommerce/react-hook-form@3.0.6
53
+
3
54
  ## 4.2.1
4
55
 
5
56
  ### Patch Changes
@@ -40,11 +40,13 @@ 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
+ console.log(values)
49
+ })
48
50
 
49
51
  useFormPersist({ form, name: 'PaymentAgreementsForm' })
50
52
 
@@ -66,12 +68,14 @@ export function CartAgreementsForm(props: CartAgreementsFormProps) {
66
68
  {agreement.mode === 'MANUAL' ? (
67
69
  <Controller
68
70
  defaultValue=''
69
- name={String(agreement.agreement_id)}
71
+ name={`agreement[${agreement.agreement_id}]`}
70
72
  control={control}
71
- rules={{ required: t`You have to agree in order to proceed` }}
73
+ rules={{
74
+ required: t`You have to agree in order to proceed`,
75
+ }}
72
76
  render={({
73
77
  field: { onChange, value, name, ref, onBlur },
74
- fieldState: { error },
78
+ fieldState: { error, invalid },
75
79
  }) => (
76
80
  <FormControl
77
81
  error={!!formState.errors[String(agreement.agreement_id)]}
@@ -79,7 +83,17 @@ export function CartAgreementsForm(props: CartAgreementsFormProps) {
79
83
  sx={{ display: 'block' }}
80
84
  >
81
85
  <FormControlLabel
82
- control={<Checkbox color='secondary' required />}
86
+ control={
87
+ <Checkbox
88
+ color='secondary'
89
+ required
90
+ checked={!!value}
91
+ name={name}
92
+ inputRef={ref}
93
+ onBlur={onBlur}
94
+ onChange={(e) => onChange(e)}
95
+ />
96
+ }
83
97
  label={
84
98
  <PageLink href={href} passHref>
85
99
  <Link color='secondary' underline='hover'>
@@ -87,13 +101,8 @@ export function CartAgreementsForm(props: CartAgreementsFormProps) {
87
101
  </Link>
88
102
  </PageLink>
89
103
  }
90
- checked={!!value}
91
- inputRef={ref}
92
- onBlur={onBlur}
93
- name={name}
94
- onChange={(e) => onChange(e as React.ChangeEvent<HTMLInputElement>)}
95
104
  />
96
- {error?.message && <FormHelperText>{error.message}</FormHelperText>}
105
+ {error?.message && <FormHelperText error>{error.message}</FormHelperText>}
97
106
  </FormControl>
98
107
  )}
99
108
  />
@@ -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,11 +16,11 @@ 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()
23
- const urlCartId = router.query.cartId
23
+ const urlCartId = router.query.cart_id
24
24
  const usingUrl = allowUrl && typeof urlCartId === 'string'
25
25
 
26
26
  const cartId = usingUrl ? urlCartId : currentCartId
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.1",
5
+ "version": "4.2.4",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,28 +12,28 @@
12
12
  }
13
13
  },
14
14
  "devDependencies": {
15
- "@graphcommerce/eslint-config-pwa": "^4.1.2",
16
- "@graphcommerce/prettier-config-pwa": "^4.0.3",
15
+ "@graphcommerce/eslint-config-pwa": "^4.1.4",
16
+ "@graphcommerce/prettier-config-pwa": "^4.0.5",
17
17
  "@graphcommerce/typescript-config-pwa": "^4.0.2",
18
- "@playwright/test": "^1.19.2"
18
+ "@playwright/test": "^1.20.1"
19
19
  },
20
20
  "dependencies": {
21
- "@graphcommerce/ecommerce-ui": "^1.0.3",
22
- "@graphcommerce/framer-next-pages": "^3.1.3",
23
- "@graphcommerce/framer-scroller": "^2.1.2",
24
- "@graphcommerce/graphql": "^3.0.4",
25
- "@graphcommerce/image": "^3.1.1",
26
- "@graphcommerce/magento-customer": "^4.1.6",
27
- "@graphcommerce/magento-graphql": "^3.0.4",
28
- "@graphcommerce/magento-store": "^4.1.3",
29
- "@graphcommerce/next-ui": "^4.4.0",
30
- "@graphcommerce/react-hook-form": "^3.0.4"
21
+ "@graphcommerce/ecommerce-ui": "1.0.6",
22
+ "@graphcommerce/framer-next-pages": "3.1.5",
23
+ "@graphcommerce/framer-scroller": "2.1.5",
24
+ "@graphcommerce/graphql": "3.0.7",
25
+ "@graphcommerce/image": "3.1.4",
26
+ "@graphcommerce/magento-customer": "4.2.2",
27
+ "@graphcommerce/magento-graphql": "3.0.6",
28
+ "@graphcommerce/magento-store": "4.1.6",
29
+ "@graphcommerce/next-ui": "4.6.0",
30
+ "@graphcommerce/react-hook-form": "3.1.0"
31
31
  },
32
32
  "peerDependencies": {
33
33
  "@lingui/macro": "^3.13.2",
34
- "@mui/material": "^5.4.1",
34
+ "@mui/material": "5.5.3",
35
35
  "framer-motion": "^6.2.4",
36
- "next": "^12.0.10",
36
+ "next": "12.1.2",
37
37
  "react": "^17.0.2",
38
38
  "react-dom": "^17.0.2"
39
39
  }
@@ -0,0 +1,16 @@
1
+ import { ApolloClient, NormalizedCacheObject } from '@graphcommerce/graphql'
2
+ import { Page } from '@playwright/test'
3
+ import { CartAgreementsDocument } from '../components/CartAgreementsForm/CartAgreements.gql'
4
+
5
+ export async function fillCartAgreementsForm(
6
+ page: Page,
7
+ client: ApolloClient<NormalizedCacheObject>,
8
+ ) {
9
+ const res = (await client.query({ query: CartAgreementsDocument })).data
10
+
11
+ for await (const agreement of res.checkoutAgreements ?? []) {
12
+ if (!agreement?.agreement_id || agreement?.mode === 'AUTO') continue
13
+
14
+ await page.locator(`input[name="agreement\\[${agreement.agreement_id}\\]"]`).click()
15
+ }
16
+ }
@@ -1,6 +0,0 @@
1
- import { Page } from '@playwright/test'
2
-
3
- export async function fillCartAgreementsForm(page: Page) {
4
- const inputs = await page.$$('form[name=cartAgreements] input')
5
- await Promise.all(inputs.map((input) => input.check()))
6
- }