@graphcommerce/magento-customer 10.1.0-canary.13 → 10.1.0-canary.18
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 +22 -0
- package/components/CustomerForms/CustomerUpdateForm.tsx +11 -2
- package/package.json +15 -15
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,27 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 10.1.0-canary.18
|
|
4
|
+
|
|
5
|
+
## 10.1.0-canary.17
|
|
6
|
+
|
|
7
|
+
### Minor Changes
|
|
8
|
+
|
|
9
|
+
- [#2624](https://github.com/graphcommerce-org/graphcommerce/pull/2624) [`cbad1fd`](https://github.com/graphcommerce-org/graphcommerce/commit/cbad1fd6e7463620b097d29dea7730c965444aeb) - `CustomerUpdateForm` now accepts `useFormGqlOptions` and `mutationOptions` props that get forwarded to its underlying `useCustomerUpdateForm` hook. Lets consumers attach an `onComplete` (e.g. to close an overlay and navigate back on a successful save), an `onBeforeSubmit` (to amend or veto the variables), or any other option already supported by `useFormGqlMutation`/`useMutation` — without having to drop down and rebuild the form from scratch.
|
|
10
|
+
|
|
11
|
+
Defaults preserve existing behaviour, so the change is backwards compatible. ([@paales](https://github.com/paales))
|
|
12
|
+
|
|
13
|
+
## 10.1.0-canary.16
|
|
14
|
+
|
|
15
|
+
### Minor Changes
|
|
16
|
+
|
|
17
|
+
- [#2624](https://github.com/graphcommerce-org/graphcommerce/pull/2624) [`cbad1fd`](https://github.com/graphcommerce-org/graphcommerce/commit/cbad1fd6e7463620b097d29dea7730c965444aeb) - `CustomerUpdateForm` now accepts `useFormGqlOptions` and `mutationOptions` props that get forwarded to its underlying `useCustomerUpdateForm` hook. Lets consumers attach an `onComplete` (e.g. to close an overlay and navigate back on a successful save), an `onBeforeSubmit` (to amend or veto the variables), or any other option already supported by `useFormGqlMutation`/`useMutation` — without having to drop down and rebuild the form from scratch.
|
|
18
|
+
|
|
19
|
+
Defaults preserve existing behaviour, so the change is backwards compatible. ([@paales](https://github.com/paales))
|
|
20
|
+
|
|
21
|
+
## 10.1.0-canary.15
|
|
22
|
+
|
|
23
|
+
## 10.1.0-canary.14
|
|
24
|
+
|
|
3
25
|
## 10.1.0-canary.13
|
|
4
26
|
|
|
5
27
|
### Minor Changes
|
|
@@ -4,6 +4,8 @@ import {
|
|
|
4
4
|
type AttributeFormAutoLayoutProps,
|
|
5
5
|
} from '@graphcommerce/magento-store'
|
|
6
6
|
import { Button, FormActions, type ButtonProps } from '@graphcommerce/next-ui'
|
|
7
|
+
import type { UseFormGraphQlOptions } from '@graphcommerce/react-hook-form'
|
|
8
|
+
import type { useMutation } from '@apollo/client/react'
|
|
7
9
|
import { Trans } from '@lingui/react/macro'
|
|
8
10
|
import { styled } from '@mui/material'
|
|
9
11
|
import type { ComponentProps } from 'react'
|
|
@@ -14,6 +16,7 @@ import {
|
|
|
14
16
|
type UpdateCustomerFormValues,
|
|
15
17
|
type UseCustomerUpdateFormConfig,
|
|
16
18
|
} from './useCustomerUpdateForm'
|
|
19
|
+
import type { UseCustomerUpdateFormMutation } from './UseCustomerUpdateForm.gql'
|
|
17
20
|
|
|
18
21
|
const Form = styled('form')({})
|
|
19
22
|
|
|
@@ -30,12 +33,18 @@ export type CustomerUpdateFormProps = Pick<
|
|
|
30
33
|
formActions?: ComponentProps<typeof FormActions>
|
|
31
34
|
button?: Omit<ButtonProps, 'type' | 'loading'>
|
|
32
35
|
}
|
|
36
|
+
useFormGqlOptions?: UseFormGraphQlOptions<UseCustomerUpdateFormMutation, UpdateCustomerFormValues>
|
|
37
|
+
mutationOptions?: useMutation.Options<UseCustomerUpdateFormMutation, UpdateCustomerFormValues>
|
|
33
38
|
} & UseCustomerUpdateFormConfig
|
|
34
39
|
|
|
35
40
|
export function CustomerUpdateForm(props: CustomerUpdateFormProps) {
|
|
36
|
-
const { slotProps, fieldsets, render, ...config } = props
|
|
41
|
+
const { slotProps, fieldsets, render, useFormGqlOptions, mutationOptions, ...config } = props
|
|
37
42
|
|
|
38
|
-
const { control, handleSubmit, formState, error, attributes } = useCustomerUpdateForm(
|
|
43
|
+
const { control, handleSubmit, formState, error, attributes } = useCustomerUpdateForm(
|
|
44
|
+
config,
|
|
45
|
+
useFormGqlOptions,
|
|
46
|
+
mutationOptions,
|
|
47
|
+
)
|
|
39
48
|
const submit = handleSubmit(() => {})
|
|
40
49
|
|
|
41
50
|
return (
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/magento-customer",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "10.1.0-canary.
|
|
5
|
+
"version": "10.1.0-canary.18",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -21,20 +21,20 @@
|
|
|
21
21
|
"./plugins/magentoCustomerPrivateQueryContext": "./plugins/magentoCustomerPrivateQueryContext.ts"
|
|
22
22
|
},
|
|
23
23
|
"peerDependencies": {
|
|
24
|
-
"@graphcommerce/ecommerce-ui": "^10.1.0-canary.
|
|
25
|
-
"@graphcommerce/eslint-config-pwa": "^10.1.0-canary.
|
|
26
|
-
"@graphcommerce/framer-next-pages": "^10.1.0-canary.
|
|
27
|
-
"@graphcommerce/framer-utils": "^10.1.0-canary.
|
|
28
|
-
"@graphcommerce/graphql": "^10.1.0-canary.
|
|
29
|
-
"@graphcommerce/graphql-mesh": "^10.1.0-canary.
|
|
30
|
-
"@graphcommerce/image": "^10.1.0-canary.
|
|
31
|
-
"@graphcommerce/magento-graphql": "^10.1.0-canary.
|
|
32
|
-
"@graphcommerce/magento-store": "^10.1.0-canary.
|
|
33
|
-
"@graphcommerce/next-config": "^10.1.0-canary.
|
|
34
|
-
"@graphcommerce/next-ui": "^10.1.0-canary.
|
|
35
|
-
"@graphcommerce/prettier-config-pwa": "^10.1.0-canary.
|
|
36
|
-
"@graphcommerce/react-hook-form": "^10.1.0-canary.
|
|
37
|
-
"@graphcommerce/typescript-config-pwa": "^10.1.0-canary.
|
|
24
|
+
"@graphcommerce/ecommerce-ui": "^10.1.0-canary.18",
|
|
25
|
+
"@graphcommerce/eslint-config-pwa": "^10.1.0-canary.18",
|
|
26
|
+
"@graphcommerce/framer-next-pages": "^10.1.0-canary.18",
|
|
27
|
+
"@graphcommerce/framer-utils": "^10.1.0-canary.18",
|
|
28
|
+
"@graphcommerce/graphql": "^10.1.0-canary.18",
|
|
29
|
+
"@graphcommerce/graphql-mesh": "^10.1.0-canary.18",
|
|
30
|
+
"@graphcommerce/image": "^10.1.0-canary.18",
|
|
31
|
+
"@graphcommerce/magento-graphql": "^10.1.0-canary.18",
|
|
32
|
+
"@graphcommerce/magento-store": "^10.1.0-canary.18",
|
|
33
|
+
"@graphcommerce/next-config": "^10.1.0-canary.18",
|
|
34
|
+
"@graphcommerce/next-ui": "^10.1.0-canary.18",
|
|
35
|
+
"@graphcommerce/prettier-config-pwa": "^10.1.0-canary.18",
|
|
36
|
+
"@graphcommerce/react-hook-form": "^10.1.0-canary.18",
|
|
37
|
+
"@graphcommerce/typescript-config-pwa": "^10.1.0-canary.18",
|
|
38
38
|
"@lingui/core": "^5",
|
|
39
39
|
"@lingui/macro": "^5",
|
|
40
40
|
"@lingui/react": "^5",
|