@graphcommerce/magento-newsletter 8.1.0-canary.2 → 8.1.0-canary.22

Sign up to get free protection for your applications and to get access to all the features.
package/CHANGELOG.md CHANGED
@@ -1,6 +1,107 @@
1
1
  # Change Log
2
2
 
3
- ## 8.1.0-canary.2
3
+ ## 8.1.0-canary.22
4
+
5
+ ## 8.1.0-canary.21
6
+
7
+ ## 8.1.0-canary.20
8
+
9
+ ## 8.1.0-canary.19
10
+
11
+ ## 8.1.0-canary.18
12
+
13
+ ## 8.1.0-canary.17
14
+
15
+ ## 8.1.0-canary.16
16
+
17
+ ## 8.1.0-canary.15
18
+
19
+ ## 8.1.0-canary.14
20
+
21
+ ## 8.1.0-canary.13
22
+
23
+ ## 8.1.0-canary.12
24
+
25
+ ## 8.1.0-canary.11
26
+
27
+ ## 8.1.0-canary.10
28
+
29
+ ## 8.1.0-canary.9
30
+
31
+ ## 8.1.0-canary.8
32
+
33
+ ## 8.1.0-canary.7
34
+
35
+ ## 8.1.0-canary.6
36
+
37
+ ## 8.1.0-canary.5
38
+
39
+ ## 8.0.6-canary.4
40
+
41
+ ## 8.0.6-canary.3
42
+
43
+ ## 8.0.6-canary.2
44
+
45
+ ### Patch Changes
46
+
47
+ - [#2234](https://github.com/graphcommerce-org/graphcommerce/pull/2234) [`530076e`](https://github.com/graphcommerce-org/graphcommerce/commit/530076e3664703cb8b577b7fcf1998a420819f60) - Moved all usages of useFormPersist to the <FormPersist/> component to prevent rerenders.
48
+ ([@FrankHarland](https://github.com/FrankHarland))
49
+
50
+ ## 8.0.6-canary.1
51
+
52
+ ## 8.0.6-canary.0
53
+
54
+ ## 8.0.5
55
+
56
+ ## 8.0.5-canary.10
57
+
58
+ ## 8.0.5-canary.9
59
+
60
+ ## 8.0.5-canary.8
61
+
62
+ ## 8.0.5-canary.7
63
+
64
+ ## 8.0.5-canary.6
65
+
66
+ ## 8.0.5-canary.5
67
+
68
+ ## 8.0.5-canary.4
69
+
70
+ ## 8.0.5-canary.3
71
+
72
+ ## 8.0.5-canary.2
73
+
74
+ ## 8.0.5-canary.1
75
+
76
+ ## 8.0.5-canary.0
77
+
78
+ ## 8.0.4
79
+
80
+ ## 8.0.4-canary.1
81
+
82
+ ## 8.0.4-canary.0
83
+
84
+ ## 8.0.3
85
+
86
+ ### Patch Changes
87
+
88
+ - [#2205](https://github.com/graphcommerce-org/graphcommerce/pull/2205) [`d67c89d`](https://github.com/graphcommerce-org/graphcommerce/commit/d67c89d464a60f0e2618dab670b63a39f6291341) - Deprecate the allowUrl option for useCartQuery, it was already enabled by default and should never be set to false.
89
+ ([@paales](https://github.com/paales))
90
+
91
+ ## 8.0.3-canary.6
92
+
93
+ ## 8.0.3-canary.5
94
+
95
+ ## 8.0.3-canary.4
96
+
97
+ ## 8.0.3-canary.3
98
+
99
+ ## 8.0.3-canary.2
100
+
101
+ ### Patch Changes
102
+
103
+ - [#2205](https://github.com/graphcommerce-org/graphcommerce/pull/2205) [`d67c89d`](https://github.com/graphcommerce-org/graphcommerce/commit/d67c89d464a60f0e2618dab670b63a39f6291341) - Deprecate the allowUrl option for useCartQuery, it was already enabled by default and should never be set to false.
104
+ ([@paales](https://github.com/paales))
4
105
 
5
106
  ## 8.0.3-canary.1
6
107
 
@@ -2,7 +2,7 @@ import { CheckboxElement, useFormCompose } from '@graphcommerce/ecommerce-ui'
2
2
  import { DocumentNode } from '@graphcommerce/graphql'
3
3
  import { useCartQuery } from '@graphcommerce/magento-cart'
4
4
  import { useCustomerQuery, useCustomerSession } from '@graphcommerce/magento-customer'
5
- import { useFormGqlMutation, useFormPersist } from '@graphcommerce/react-hook-form'
5
+ import { FormPersist, useFormGqlMutation, useFormPersist } from '@graphcommerce/react-hook-form'
6
6
  import { Box, SxProps, Theme } from '@mui/material'
7
7
  import { GetCustomerNewsletterToggleDocument } from '../CustomerNewsletterToggle/GetCustomerNewsLetterToggle.gql'
8
8
  import { GetCartEmailDocument } from '../SignupNewsletter/GetCartEmail.gql'
@@ -43,14 +43,13 @@ export function SubscribeToNewsletter(props: CheckoutNewsletterProps) {
43
43
  const { control, handleSubmit } = form
44
44
  const submit = handleSubmit(() => {})
45
45
 
46
- useFormPersist({ form, name: 'NewsletterSubscribeForm' })
47
-
48
46
  useFormCompose({ form, step, submit, key: 'NewsletterSubscribeForm' })
49
47
 
50
48
  if (isCustomerSubscribed) return null
51
49
 
52
50
  return (
53
51
  <Box sx={sx}>
52
+ <FormPersist form={form} name='NewsletterSubscribeForm' />
54
53
  <form onSubmit={submit} noValidate>
55
54
  <CheckboxElement color='secondary' control={control} name='subscribe' label={label} />
56
55
  </form>
@@ -1,6 +1,6 @@
1
1
  import { useQuery } from '@graphcommerce/graphql'
2
2
  import { ApolloCustomerErrorAlert } from '@graphcommerce/magento-customer'
3
- import { Controller, useFormAutoSubmit, useFormGqlMutation } from '@graphcommerce/react-hook-form'
3
+ import { Controller, FormAutoSubmit, useFormGqlMutation } from '@graphcommerce/react-hook-form'
4
4
  import {
5
5
  Box,
6
6
  FormControl,
@@ -31,12 +31,12 @@ export function CustomerNewsletterToggle(props: CustomerNewsletterToggleProps) {
31
31
 
32
32
  const { handleSubmit, control, formState, error } = form
33
33
  const submit = handleSubmit(() => {})
34
- useFormAutoSubmit({ form, submit })
35
34
 
36
35
  if (disabled || loading) return <Switch disabled color='primary' {...switchProps} />
37
36
 
38
37
  return (
39
38
  <Box component='form' onSubmit={submit} noValidate sx={sx}>
39
+ <FormAutoSubmit control={control} submit={submit} />
40
40
  <Controller
41
41
  name='isSubscribed'
42
42
  control={control}
@@ -1,7 +1,7 @@
1
1
  import { useCartQuery } from '@graphcommerce/magento-cart'
2
2
  import { ApolloCustomerErrorAlert } from '@graphcommerce/magento-customer'
3
3
  import { Form } from '@graphcommerce/next-ui'
4
- import { Controller, useFormAutoSubmit, useFormGqlMutation } from '@graphcommerce/react-hook-form'
4
+ import { Controller, FormAutoSubmit, useFormGqlMutation } from '@graphcommerce/react-hook-form'
5
5
  import {
6
6
  FormControl,
7
7
  FormControlLabel,
@@ -25,8 +25,7 @@ export type GuestNewsletterToggleProps = SwitchProps & { sx?: SxProps<Theme> }
25
25
  export function GuestNewsletterToggle(props: GuestNewsletterToggleProps) {
26
26
  const { sx = [], ...switchProps } = props
27
27
 
28
- const email =
29
- useCartQuery(GetCartEmailDocument, { allowUrl: true }).data?.cart?.email ?? undefined
28
+ const email = useCartQuery(GetCartEmailDocument).data?.cart?.email ?? undefined
30
29
  const form = useFormGqlMutation<
31
30
  GuestNewsletterToggleMutation,
32
31
  GuestNewsletterToggleMutationVariables & { isSubscribed?: boolean }
@@ -34,13 +33,13 @@ export function GuestNewsletterToggle(props: GuestNewsletterToggleProps) {
34
33
 
35
34
  const { handleSubmit, control, formState, error, register } = form
36
35
  const submit = handleSubmit(() => {})
37
- useFormAutoSubmit({ form, submit })
38
36
 
39
37
  if (formState.isSubmitted) return <Switch color='primary' {...switchProps} checked disabled />
40
38
 
41
39
  return (
42
40
  <Form noValidate sx={sx}>
43
41
  <input type='hidden' {...register('email')} value={email} />
42
+ <FormAutoSubmit control={control} submit={submit} />
44
43
  <Controller
45
44
  name='isSubscribed'
46
45
  control={control}
@@ -17,7 +17,7 @@ const { withState } = extendableComponent<OwnerState, typeof name, typeof parts>
17
17
 
18
18
  export function SignupNewsletter(props: SignupNewsletterProps) {
19
19
  const { sx = [] } = props
20
- const { data: cartData } = useCartQuery(GetCartEmailDocument, { allowUrl: true })
20
+ const { data: cartData } = useCartQuery(GetCartEmailDocument)
21
21
  const { loggedIn } = useCustomerSession()
22
22
 
23
23
  const classes = withState({ loggedIn })
package/package.json CHANGED
@@ -2,7 +2,7 @@
2
2
  "name": "@graphcommerce/magento-newsletter",
3
3
  "homepage": "https://www.graphcommerce.org/",
4
4
  "repository": "github:graphcommerce-org/graphcommerce",
5
- "version": "8.1.0-canary.2",
5
+ "version": "8.1.0-canary.22",
6
6
  "sideEffects": false,
7
7
  "prettier": "@graphcommerce/prettier-config-pwa",
8
8
  "eslintConfig": {
@@ -12,15 +12,15 @@
12
12
  }
13
13
  },
14
14
  "peerDependencies": {
15
- "@graphcommerce/ecommerce-ui": "^8.1.0-canary.2",
16
- "@graphcommerce/eslint-config-pwa": "^8.1.0-canary.2",
17
- "@graphcommerce/graphql": "^8.1.0-canary.2",
18
- "@graphcommerce/magento-cart": "^8.1.0-canary.2",
19
- "@graphcommerce/magento-customer": "^8.1.0-canary.2",
20
- "@graphcommerce/next-ui": "^8.1.0-canary.2",
21
- "@graphcommerce/prettier-config-pwa": "^8.1.0-canary.2",
22
- "@graphcommerce/react-hook-form": "^8.1.0-canary.2",
23
- "@graphcommerce/typescript-config-pwa": "^8.1.0-canary.2",
15
+ "@graphcommerce/ecommerce-ui": "^8.1.0-canary.22",
16
+ "@graphcommerce/eslint-config-pwa": "^8.1.0-canary.22",
17
+ "@graphcommerce/graphql": "^8.1.0-canary.22",
18
+ "@graphcommerce/magento-cart": "^8.1.0-canary.22",
19
+ "@graphcommerce/magento-customer": "^8.1.0-canary.22",
20
+ "@graphcommerce/next-ui": "^8.1.0-canary.22",
21
+ "@graphcommerce/prettier-config-pwa": "^8.1.0-canary.22",
22
+ "@graphcommerce/react-hook-form": "^8.1.0-canary.22",
23
+ "@graphcommerce/typescript-config-pwa": "^8.1.0-canary.22",
24
24
  "@lingui/core": "^4.2.1",
25
25
  "@lingui/macro": "^4.2.1",
26
26
  "@lingui/react": "^4.2.1",