@graphcommerce/magento-newsletter 9.0.4-canary.8 → 9.1.0-canary.15
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,25 @@
|
|
1
1
|
# Change Log
|
2
2
|
|
3
|
+
## 9.1.0-canary.15
|
4
|
+
|
5
|
+
### Patch Changes
|
6
|
+
|
7
|
+
- [#2493](https://github.com/graphcommerce-org/graphcommerce/pull/2493) [`53b896e`](https://github.com/graphcommerce-org/graphcommerce/commit/53b896e2ed9de6d0ab96b4426976c6b90dd75294) - Allow passing children to CustomerNewsletterToggle ([@paales](https://github.com/paales))
|
8
|
+
|
9
|
+
- [#2493](https://github.com/graphcommerce-org/graphcommerce/pull/2493) [`6c4f642`](https://github.com/graphcommerce-org/graphcommerce/commit/6c4f642100c7e88a6f60f0962a3af5d6d68d90d8) - Use CustomerNewsletterToggle whenever possible ([@paales](https://github.com/paales))
|
10
|
+
|
11
|
+
## 9.0.4-canary.14
|
12
|
+
|
13
|
+
## 9.0.4-canary.13
|
14
|
+
|
15
|
+
## 9.0.4-canary.12
|
16
|
+
|
17
|
+
## 9.0.4-canary.11
|
18
|
+
|
19
|
+
## 9.0.4-canary.10
|
20
|
+
|
21
|
+
## 9.0.4-canary.9
|
22
|
+
|
3
23
|
## 9.0.4-canary.8
|
4
24
|
|
5
25
|
## 9.0.4-canary.7
|
@@ -1,5 +1,7 @@
|
|
1
|
+
import { ApolloErrorSnackbar } from '@graphcommerce/ecommerce-ui'
|
1
2
|
import { useQuery } from '@graphcommerce/graphql'
|
2
3
|
import { ApolloCustomerErrorAlert } from '@graphcommerce/magento-customer'
|
4
|
+
import { sxx } from '@graphcommerce/next-ui'
|
3
5
|
import { Controller, FormAutoSubmit, useFormGqlMutation } from '@graphcommerce/react-hook-form'
|
4
6
|
import type { SwitchProps, SxProps, Theme } from '@mui/material'
|
5
7
|
import {
|
@@ -13,10 +15,13 @@ import React from 'react'
|
|
13
15
|
import { GetCustomerNewsletterToggleDocument } from './GetCustomerNewsLetterToggle.gql'
|
14
16
|
import { UpdateNewsletterSubscriptionDocument } from './UpdateNewsletterSubscription.gql'
|
15
17
|
|
16
|
-
export type CustomerNewsletterToggleProps = SwitchProps & {
|
18
|
+
export type CustomerNewsletterToggleProps = SwitchProps & {
|
19
|
+
sx?: SxProps<Theme>
|
20
|
+
children?: React.ReactNode
|
21
|
+
}
|
17
22
|
|
18
23
|
export function CustomerNewsletterToggle(props: CustomerNewsletterToggleProps) {
|
19
|
-
const { disabled, sx = [], ...switchProps } = props
|
24
|
+
const { disabled, sx = [], children, ...switchProps } = props
|
20
25
|
|
21
26
|
const { loading, data } = useQuery(GetCustomerNewsletterToggleDocument, { ssr: false })
|
22
27
|
const form = useFormGqlMutation(UpdateNewsletterSubscriptionDocument, {
|
@@ -32,7 +37,12 @@ export function CustomerNewsletterToggle(props: CustomerNewsletterToggleProps) {
|
|
32
37
|
if (disabled || loading) return <Switch disabled color='primary' {...switchProps} />
|
33
38
|
|
34
39
|
return (
|
35
|
-
<Box
|
40
|
+
<Box
|
41
|
+
component='form'
|
42
|
+
onSubmit={submit}
|
43
|
+
noValidate
|
44
|
+
sx={sxx({ display: 'flex', flexDirection: 'row', alignItems: 'center', gap: 2 }, sx)}
|
45
|
+
>
|
36
46
|
<FormAutoSubmit control={control} submit={submit} />
|
37
47
|
<Controller
|
38
48
|
name='isSubscribed'
|
@@ -55,8 +65,8 @@ export function CustomerNewsletterToggle(props: CustomerNewsletterToggleProps) {
|
|
55
65
|
</FormControl>
|
56
66
|
)}
|
57
67
|
/>
|
58
|
-
|
59
|
-
|
68
|
+
<ApolloErrorSnackbar error={error} />
|
69
|
+
{children}
|
60
70
|
</Box>
|
61
71
|
)
|
62
72
|
}
|
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": "9.0
|
5
|
+
"version": "9.1.0-canary.15",
|
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": "^9.0
|
16
|
-
"@graphcommerce/eslint-config-pwa": "^9.0
|
17
|
-
"@graphcommerce/graphql": "^9.0
|
18
|
-
"@graphcommerce/magento-cart": "^9.0
|
19
|
-
"@graphcommerce/magento-customer": "^9.0
|
20
|
-
"@graphcommerce/next-ui": "^9.0
|
21
|
-
"@graphcommerce/prettier-config-pwa": "^9.0
|
22
|
-
"@graphcommerce/react-hook-form": "^9.0
|
23
|
-
"@graphcommerce/typescript-config-pwa": "^9.0
|
15
|
+
"@graphcommerce/ecommerce-ui": "^9.1.0-canary.15",
|
16
|
+
"@graphcommerce/eslint-config-pwa": "^9.1.0-canary.15",
|
17
|
+
"@graphcommerce/graphql": "^9.1.0-canary.15",
|
18
|
+
"@graphcommerce/magento-cart": "^9.1.0-canary.15",
|
19
|
+
"@graphcommerce/magento-customer": "^9.1.0-canary.15",
|
20
|
+
"@graphcommerce/next-ui": "^9.1.0-canary.15",
|
21
|
+
"@graphcommerce/prettier-config-pwa": "^9.1.0-canary.15",
|
22
|
+
"@graphcommerce/react-hook-form": "^9.1.0-canary.15",
|
23
|
+
"@graphcommerce/typescript-config-pwa": "^9.1.0-canary.15",
|
24
24
|
"@lingui/core": "^4.2.1",
|
25
25
|
"@lingui/macro": "^4.2.1",
|
26
26
|
"@lingui/react": "^4.2.1",
|