@graphcommerce/magento-newsletter 8.0.6-canary.4 → 8.0.7
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,19 +1,8 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
-
## 8.0.
|
3
|
+
## 8.0.7
|
4
4
|
|
5
|
-
## 8.0.6
|
6
|
-
|
7
|
-
## 8.0.6-canary.2
|
8
|
-
|
9
|
-
### Patch Changes
|
10
|
-
|
11
|
-
- [#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.
|
12
|
-
([@FrankHarland](https://github.com/FrankHarland))
|
13
|
-
|
14
|
-
## 8.0.6-canary.1
|
15
|
-
|
16
|
-
## 8.0.6-canary.0
|
5
|
+
## 8.0.6
|
17
6
|
|
18
7
|
## 8.0.5
|
19
8
|
|
@@ -49,8 +38,7 @@
|
|
49
38
|
|
50
39
|
### Patch Changes
|
51
40
|
|
52
|
-
- [#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.
|
53
|
-
([@paales](https://github.com/paales))
|
41
|
+
- [#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. ([@paales](https://github.com/paales))
|
54
42
|
|
55
43
|
## 8.0.3-canary.6
|
56
44
|
|
@@ -64,8 +52,7 @@
|
|
64
52
|
|
65
53
|
### Patch Changes
|
66
54
|
|
67
|
-
- [#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.
|
68
|
-
([@paales](https://github.com/paales))
|
55
|
+
- [#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. ([@paales](https://github.com/paales))
|
69
56
|
|
70
57
|
## 8.0.3-canary.1
|
71
58
|
|
@@ -1302,31 +1289,31 @@
|
|
1302
1289
|
All occurences of `<Trans>` and `t` need to be replaced:
|
1303
1290
|
|
1304
1291
|
```tsx
|
1305
|
-
import { Trans, t } from
|
1292
|
+
import { Trans, t } from '@lingui/macro'
|
1306
1293
|
|
1307
1294
|
function MyComponent() {
|
1308
|
-
const foo =
|
1295
|
+
const foo = 'bar'
|
1309
1296
|
return (
|
1310
1297
|
<div aria-label={t`Account ${foo}`}>
|
1311
1298
|
<Trans>My Translation {foo}</Trans>
|
1312
1299
|
</div>
|
1313
|
-
)
|
1300
|
+
)
|
1314
1301
|
}
|
1315
1302
|
```
|
1316
1303
|
|
1317
1304
|
Needs to be replaced with:
|
1318
1305
|
|
1319
1306
|
```tsx
|
1320
|
-
import { Trans } from
|
1321
|
-
import { i18n } from
|
1307
|
+
import { Trans } from '@lingui/react'
|
1308
|
+
import { i18n } from '@lingui/core'
|
1322
1309
|
|
1323
1310
|
function MyComponent() {
|
1324
|
-
const foo =
|
1311
|
+
const foo = 'bar'
|
1325
1312
|
return (
|
1326
1313
|
<div aria-label={i18n._(/* i18n */ `Account {foo}`, { foo })}>
|
1327
|
-
<Trans key=
|
1314
|
+
<Trans key='My Translation {foo}' values={{ foo }}></Trans>
|
1328
1315
|
</div>
|
1329
|
-
)
|
1316
|
+
)
|
1330
1317
|
}
|
1331
1318
|
```
|
1332
1319
|
|
@@ -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 {
|
5
|
+
import { 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,13 +43,14 @@ export function SubscribeToNewsletter(props: CheckoutNewsletterProps) {
|
|
43
43
|
const { control, handleSubmit } = form
|
44
44
|
const submit = handleSubmit(() => {})
|
45
45
|
|
46
|
+
useFormPersist({ form, name: 'NewsletterSubscribeForm' })
|
47
|
+
|
46
48
|
useFormCompose({ form, step, submit, key: 'NewsletterSubscribeForm' })
|
47
49
|
|
48
50
|
if (isCustomerSubscribed) return null
|
49
51
|
|
50
52
|
return (
|
51
53
|
<Box sx={sx}>
|
52
|
-
<FormPersist form={form} name='NewsletterSubscribeForm' />
|
53
54
|
<form onSubmit={submit} noValidate>
|
54
55
|
<CheckboxElement color='secondary' control={control} name='subscribe' label={label} />
|
55
56
|
</form>
|
@@ -1,6 +1,6 @@
|
|
1
1
|
import { useQuery } from '@graphcommerce/graphql'
|
2
2
|
import { ApolloCustomerErrorAlert } from '@graphcommerce/magento-customer'
|
3
|
-
import { Controller,
|
3
|
+
import { Controller, useFormAutoSubmit, 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 })
|
34
35
|
|
35
36
|
if (disabled || loading) return <Switch disabled color='primary' {...switchProps} />
|
36
37
|
|
37
38
|
return (
|
38
39
|
<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,
|
4
|
+
import { Controller, useFormAutoSubmit, useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
5
5
|
import {
|
6
6
|
FormControl,
|
7
7
|
FormControlLabel,
|
@@ -33,13 +33,13 @@ export function GuestNewsletterToggle(props: GuestNewsletterToggleProps) {
|
|
33
33
|
|
34
34
|
const { handleSubmit, control, formState, error, register } = form
|
35
35
|
const submit = handleSubmit(() => {})
|
36
|
+
useFormAutoSubmit({ form, submit })
|
36
37
|
|
37
38
|
if (formState.isSubmitted) return <Switch color='primary' {...switchProps} checked disabled />
|
38
39
|
|
39
40
|
return (
|
40
41
|
<Form noValidate sx={sx}>
|
41
42
|
<input type='hidden' {...register('email')} value={email} />
|
42
|
-
<FormAutoSubmit control={control} submit={submit} />
|
43
43
|
<Controller
|
44
44
|
name='isSubscribed'
|
45
45
|
control={control}
|
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.0.
|
5
|
+
"version": "8.0.7",
|
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.0.
|
16
|
-
"@graphcommerce/eslint-config-pwa": "^8.0.
|
17
|
-
"@graphcommerce/graphql": "^8.0.
|
18
|
-
"@graphcommerce/magento-cart": "^8.0.
|
19
|
-
"@graphcommerce/magento-customer": "^8.0.
|
20
|
-
"@graphcommerce/next-ui": "^8.0.
|
21
|
-
"@graphcommerce/prettier-config-pwa": "^8.0.
|
22
|
-
"@graphcommerce/react-hook-form": "^8.0.
|
23
|
-
"@graphcommerce/typescript-config-pwa": "^8.0.
|
15
|
+
"@graphcommerce/ecommerce-ui": "^8.0.7",
|
16
|
+
"@graphcommerce/eslint-config-pwa": "^8.0.7",
|
17
|
+
"@graphcommerce/graphql": "^8.0.7",
|
18
|
+
"@graphcommerce/magento-cart": "^8.0.7",
|
19
|
+
"@graphcommerce/magento-customer": "^8.0.7",
|
20
|
+
"@graphcommerce/next-ui": "^8.0.7",
|
21
|
+
"@graphcommerce/prettier-config-pwa": "^8.0.7",
|
22
|
+
"@graphcommerce/react-hook-form": "^8.0.7",
|
23
|
+
"@graphcommerce/typescript-config-pwa": "^8.0.7",
|
24
24
|
"@lingui/core": "^4.2.1",
|
25
25
|
"@lingui/macro": "^4.2.1",
|
26
26
|
"@lingui/react": "^4.2.1",
|