@graphcommerce/magento-cart-shipping-address 3.4.4 → 3.4.5
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,16 @@
|
|
|
1
1
|
# Change Log
|
|
2
2
|
|
|
3
|
+
## 3.4.5
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1579](https://github.com/graphcommerce-org/graphcommerce/pull/1579) [`e8639ec5f`](https://github.com/graphcommerce-org/graphcommerce/commit/e8639ec5f6759504211d70a966f5c348c6b3a7f6) Thanks [@paales](https://github.com/paales)! - New FormComponents added which combines react-hook-form and mui's form components for easier form handling
|
|
8
|
+
|
|
9
|
+
- Updated dependencies [[`e8639ec5f`](https://github.com/graphcommerce-org/graphcommerce/commit/e8639ec5f6759504211d70a966f5c348c6b3a7f6)]:
|
|
10
|
+
- @graphcommerce/ecommerce-ui@1.3.0
|
|
11
|
+
- @graphcommerce/magento-customer@4.10.5
|
|
12
|
+
- @graphcommerce/magento-cart@4.7.5
|
|
13
|
+
|
|
3
14
|
## 3.4.4
|
|
4
15
|
|
|
5
16
|
### Patch Changes
|
|
@@ -1,3 +1,11 @@
|
|
|
1
|
+
import {
|
|
2
|
+
phonePattern,
|
|
3
|
+
useFormAutoSubmit,
|
|
4
|
+
useFormCompose,
|
|
5
|
+
UseFormComposeOptions,
|
|
6
|
+
useFormPersist,
|
|
7
|
+
TextFieldElement,
|
|
8
|
+
} from '@graphcommerce/ecommerce-ui'
|
|
1
9
|
import { useQuery } from '@graphcommerce/graphql'
|
|
2
10
|
import {
|
|
3
11
|
ApolloCartErrorAlert,
|
|
@@ -5,19 +13,17 @@ import {
|
|
|
5
13
|
useFormGqlMutationCart,
|
|
6
14
|
} from '@graphcommerce/magento-cart'
|
|
7
15
|
import { CartAddressFragment } from '@graphcommerce/magento-cart/components/CartAddress/CartAddress.gql'
|
|
8
|
-
import {
|
|
16
|
+
import {
|
|
17
|
+
AddressFields,
|
|
18
|
+
CustomerDocument,
|
|
19
|
+
NameFields,
|
|
20
|
+
useCustomerQuery,
|
|
21
|
+
} from '@graphcommerce/magento-customer'
|
|
9
22
|
import { CountryRegionsDocument, StoreConfigDocument } from '@graphcommerce/magento-store'
|
|
10
23
|
import { Form, FormRow, InputCheckmark } from '@graphcommerce/next-ui'
|
|
11
|
-
import {
|
|
12
|
-
phonePattern,
|
|
13
|
-
useFormAutoSubmit,
|
|
14
|
-
useFormCompose,
|
|
15
|
-
UseFormComposeOptions,
|
|
16
|
-
useFormPersist,
|
|
17
|
-
} from '@graphcommerce/react-hook-form'
|
|
18
24
|
import { i18n } from '@lingui/core'
|
|
19
25
|
import { Trans } from '@lingui/react'
|
|
20
|
-
import { SxProps,
|
|
26
|
+
import { SxProps, Theme } from '@mui/material'
|
|
21
27
|
import React from 'react'
|
|
22
28
|
import { isSameAddress } from '../../utils/isSameAddress'
|
|
23
29
|
import { GetAddressesDocument } from './GetAddresses.gql'
|
|
@@ -35,7 +41,7 @@ export const ShippingAddressForm = React.memo<ShippingAddressFormProps>((props)
|
|
|
35
41
|
const { data: cartQuery } = useCartQuery(GetAddressesDocument)
|
|
36
42
|
const { data: config } = useQuery(StoreConfigDocument)
|
|
37
43
|
const { data: countriesData } = useQuery(CountryRegionsDocument)
|
|
38
|
-
const { data: customerQuery } =
|
|
44
|
+
const { data: customerQuery } = useCustomerQuery(CustomerDocument)
|
|
39
45
|
|
|
40
46
|
const shopCountry = config?.storeConfig?.locale?.split('_')?.[1].toUpperCase()
|
|
41
47
|
|
|
@@ -103,7 +109,7 @@ export const ShippingAddressForm = React.memo<ShippingAddressFormProps>((props)
|
|
|
103
109
|
}
|
|
104
110
|
},
|
|
105
111
|
})
|
|
106
|
-
const {
|
|
112
|
+
const { handleSubmit, valid, formState, required, error } = form
|
|
107
113
|
const submit = handleSubmit(() => {})
|
|
108
114
|
|
|
109
115
|
useFormPersist({ form, name: 'ShippingAddressForm' })
|
|
@@ -121,17 +127,16 @@ export const ShippingAddressForm = React.memo<ShippingAddressFormProps>((props)
|
|
|
121
127
|
<NameFields form={form} key='name' readOnly={readOnly} />
|
|
122
128
|
<AddressFields form={form} key='addressfields' readOnly={readOnly} />
|
|
123
129
|
<FormRow key='telephone'>
|
|
124
|
-
<
|
|
130
|
+
<TextFieldElement
|
|
131
|
+
control={form.control}
|
|
132
|
+
name='telephone'
|
|
125
133
|
variant='outlined'
|
|
126
134
|
type='text'
|
|
127
|
-
error={!!formState.errors.telephone}
|
|
128
135
|
required={required.telephone}
|
|
129
|
-
|
|
130
|
-
{...muiRegister('telephone', {
|
|
131
|
-
required: required.telephone,
|
|
136
|
+
validation={{
|
|
132
137
|
pattern: { value: phonePattern, message: i18n._(/* i18n */ 'Invalid phone number') },
|
|
133
|
-
}
|
|
134
|
-
|
|
138
|
+
}}
|
|
139
|
+
label={<Trans id='Telephone' />}
|
|
135
140
|
InputProps={{
|
|
136
141
|
readOnly,
|
|
137
142
|
endAdornment: <InputCheckmark show={valid.telephone} />,
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/magento-cart-shipping-address",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "3.4.
|
|
5
|
+
"version": "3.4.5",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -18,13 +18,13 @@
|
|
|
18
18
|
"@playwright/test": "^1.21.1"
|
|
19
19
|
},
|
|
20
20
|
"dependencies": {
|
|
21
|
+
"@graphcommerce/ecommerce-ui": "1.3.0",
|
|
21
22
|
"@graphcommerce/graphql": "3.4.8",
|
|
22
23
|
"@graphcommerce/image": "3.1.9",
|
|
23
|
-
"@graphcommerce/magento-cart": "4.7.
|
|
24
|
-
"@graphcommerce/magento-customer": "4.10.
|
|
24
|
+
"@graphcommerce/magento-cart": "4.7.5",
|
|
25
|
+
"@graphcommerce/magento-customer": "4.10.5",
|
|
25
26
|
"@graphcommerce/magento-store": "4.2.32",
|
|
26
|
-
"@graphcommerce/next-ui": "4.23.1"
|
|
27
|
-
"@graphcommerce/react-hook-form": "3.3.2"
|
|
27
|
+
"@graphcommerce/next-ui": "4.23.1"
|
|
28
28
|
},
|
|
29
29
|
"peerDependencies": {
|
|
30
30
|
"@lingui/react": "^3.13.2",
|