@graphcommerce/address-fields-nl 6.0.2-canary.8 → 6.1.0
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,43 @@
|
|
|
1
1
|
# @graphcommerce/address-fields-nl
|
|
2
2
|
|
|
3
|
+
## 6.1.0
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- [#1889](https://github.com/graphcommerce-org/graphcommerce/pull/1889) [`38bf4b6bc`](https://github.com/graphcommerce-org/graphcommerce/commit/38bf4b6bc6e705d9d124d50b775ba3f440599482) - put the country field first, so the address fields will not be changed afterwards when postcode service is active. ([@carlocarels90](https://github.com/carlocarels90))
|
|
8
|
+
|
|
9
|
+
## 6.0.2-canary.22
|
|
10
|
+
|
|
11
|
+
## 6.0.2-canary.21
|
|
12
|
+
|
|
13
|
+
## 6.0.2-canary.20
|
|
14
|
+
|
|
15
|
+
## 6.0.2-canary.19
|
|
16
|
+
|
|
17
|
+
## 6.0.2-canary.18
|
|
18
|
+
|
|
19
|
+
### Patch Changes
|
|
20
|
+
|
|
21
|
+
- [#1889](https://github.com/graphcommerce-org/graphcommerce/pull/1889) [`38bf4b6bc`](https://github.com/graphcommerce-org/graphcommerce/commit/38bf4b6bc6e705d9d124d50b775ba3f440599482) - put the country field first, so the address fields will not be changed afterwards when postcode service is active. ([@carlocarels90](https://github.com/carlocarels90))
|
|
22
|
+
|
|
23
|
+
## 6.0.2-canary.17
|
|
24
|
+
|
|
25
|
+
## 6.0.2-canary.16
|
|
26
|
+
|
|
27
|
+
## 6.0.2-canary.15
|
|
28
|
+
|
|
29
|
+
## 6.0.2-canary.14
|
|
30
|
+
|
|
31
|
+
## 6.0.2-canary.13
|
|
32
|
+
|
|
33
|
+
## 6.0.2-canary.12
|
|
34
|
+
|
|
35
|
+
## 6.0.2-canary.11
|
|
36
|
+
|
|
37
|
+
## 6.0.2-canary.10
|
|
38
|
+
|
|
39
|
+
## 6.0.2-canary.9
|
|
40
|
+
|
|
3
41
|
## 6.0.2-canary.8
|
|
4
42
|
|
|
5
43
|
## 6.0.2-canary.7
|
|
@@ -14,7 +14,7 @@ import { useMemo } from 'react'
|
|
|
14
14
|
import { usePostcodeService } from '../helpers/usePostcodeService'
|
|
15
15
|
|
|
16
16
|
export function PostcodeNLAddressFields(props: AddressFieldsProps) {
|
|
17
|
-
const { form, readOnly } = props
|
|
17
|
+
const { form, readOnly, countryFirst } = props
|
|
18
18
|
|
|
19
19
|
const countryQuery = useQuery(CountryRegionsDocument, { fetchPolicy: 'cache-and-network' })
|
|
20
20
|
const countries = countryQuery.data?.countries ?? countryQuery.previousData?.countries
|
|
@@ -45,8 +45,49 @@ export function PostcodeNLAddressFields(props: AddressFieldsProps) {
|
|
|
45
45
|
return availableRegions?.sort(compare)
|
|
46
46
|
}, [country, countryList])
|
|
47
47
|
|
|
48
|
+
const countryFields = (
|
|
49
|
+
<FormRow>
|
|
50
|
+
<SelectElement
|
|
51
|
+
control={control}
|
|
52
|
+
name='countryCode'
|
|
53
|
+
SelectProps={{ autoWidth: true }}
|
|
54
|
+
variant='outlined'
|
|
55
|
+
label={<Trans id='Country' />}
|
|
56
|
+
required={required.countryCode}
|
|
57
|
+
InputProps={{
|
|
58
|
+
readOnly,
|
|
59
|
+
endAdornment: <InputCheckmark show={valid.countryCode} select />,
|
|
60
|
+
}}
|
|
61
|
+
options={filterNonNullableKeys(countryList, [
|
|
62
|
+
'two_letter_abbreviation',
|
|
63
|
+
'full_name_locale',
|
|
64
|
+
]).map(({ two_letter_abbreviation: id, full_name_locale: label }) => ({ id, label }))}
|
|
65
|
+
/>
|
|
66
|
+
|
|
67
|
+
{regionList.length > 0 && (
|
|
68
|
+
<SelectElement
|
|
69
|
+
control={control}
|
|
70
|
+
name='regionId'
|
|
71
|
+
// SelectProps={{ native: true, displayEmpty: true }}
|
|
72
|
+
variant='outlined'
|
|
73
|
+
label={<Trans id='Region' />}
|
|
74
|
+
required
|
|
75
|
+
InputProps={{
|
|
76
|
+
readOnly,
|
|
77
|
+
endAdornment: <InputCheckmark show={valid.regionId} select />,
|
|
78
|
+
}}
|
|
79
|
+
options={filterNonNullableKeys(regionList, ['id', 'name']).map(({ id, name: label }) => ({
|
|
80
|
+
id,
|
|
81
|
+
label,
|
|
82
|
+
}))}
|
|
83
|
+
/>
|
|
84
|
+
)}
|
|
85
|
+
</FormRow>
|
|
86
|
+
)
|
|
87
|
+
|
|
48
88
|
return (
|
|
49
89
|
<>
|
|
90
|
+
{countryFirst && countryFields}
|
|
50
91
|
<FormRow>
|
|
51
92
|
<TextFieldElement
|
|
52
93
|
control={control}
|
|
@@ -120,42 +161,7 @@ export function PostcodeNLAddressFields(props: AddressFieldsProps) {
|
|
|
120
161
|
}}
|
|
121
162
|
/>
|
|
122
163
|
</FormRow>
|
|
123
|
-
|
|
124
|
-
<SelectElement
|
|
125
|
-
control={control}
|
|
126
|
-
name='countryCode'
|
|
127
|
-
SelectProps={{ autoWidth: true }}
|
|
128
|
-
variant='outlined'
|
|
129
|
-
label={<Trans id='Country' />}
|
|
130
|
-
required={required.countryCode}
|
|
131
|
-
InputProps={{
|
|
132
|
-
readOnly,
|
|
133
|
-
endAdornment: <InputCheckmark show={valid.countryCode} select />,
|
|
134
|
-
}}
|
|
135
|
-
options={filterNonNullableKeys(countryList, [
|
|
136
|
-
'two_letter_abbreviation',
|
|
137
|
-
'full_name_locale',
|
|
138
|
-
]).map(({ two_letter_abbreviation: id, full_name_locale: label }) => ({ id, label }))}
|
|
139
|
-
/>
|
|
140
|
-
|
|
141
|
-
{regionList.length > 0 && (
|
|
142
|
-
<SelectElement
|
|
143
|
-
control={control}
|
|
144
|
-
name='regionId'
|
|
145
|
-
// SelectProps={{ native: true, displayEmpty: true }}
|
|
146
|
-
variant='outlined'
|
|
147
|
-
label={<Trans id='Region' />}
|
|
148
|
-
required
|
|
149
|
-
InputProps={{
|
|
150
|
-
readOnly,
|
|
151
|
-
endAdornment: <InputCheckmark show={valid.regionId} select />,
|
|
152
|
-
}}
|
|
153
|
-
options={filterNonNullableKeys(regionList, ['id', 'name']).map(
|
|
154
|
-
({ id, name: label }) => ({ id, label }),
|
|
155
|
-
)}
|
|
156
|
-
/>
|
|
157
|
-
)}
|
|
158
|
-
</FormRow>
|
|
164
|
+
{!countryFirst && countryFields}
|
|
159
165
|
</>
|
|
160
166
|
)
|
|
161
167
|
}
|
package/package.json
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
"name": "@graphcommerce/address-fields-nl",
|
|
3
3
|
"homepage": "https://www.graphcommerce.org/",
|
|
4
4
|
"repository": "github:graphcommerce-org/graphcommerce",
|
|
5
|
-
"version": "6.0
|
|
5
|
+
"version": "6.1.0",
|
|
6
6
|
"sideEffects": false,
|
|
7
7
|
"prettier": "@graphcommerce/prettier-config-pwa",
|
|
8
8
|
"eslintConfig": {
|
|
@@ -12,16 +12,16 @@
|
|
|
12
12
|
}
|
|
13
13
|
},
|
|
14
14
|
"devDependencies": {
|
|
15
|
-
"@graphcommerce/eslint-config-pwa": "6.0
|
|
16
|
-
"@graphcommerce/prettier-config-pwa": "6.0
|
|
17
|
-
"@graphcommerce/typescript-config-pwa": "6.0
|
|
15
|
+
"@graphcommerce/eslint-config-pwa": "6.1.0",
|
|
16
|
+
"@graphcommerce/prettier-config-pwa": "6.1.0",
|
|
17
|
+
"@graphcommerce/typescript-config-pwa": "6.1.0"
|
|
18
18
|
},
|
|
19
19
|
"dependencies": {
|
|
20
|
-
"@graphcommerce/ecommerce-ui": "6.0
|
|
21
|
-
"@graphcommerce/graphql": "6.0
|
|
22
|
-
"@graphcommerce/magento-customer": "6.0
|
|
23
|
-
"@graphcommerce/magento-store": "6.0
|
|
24
|
-
"@graphcommerce/next-ui": "6.0
|
|
20
|
+
"@graphcommerce/ecommerce-ui": "6.1.0",
|
|
21
|
+
"@graphcommerce/graphql": "6.1.0",
|
|
22
|
+
"@graphcommerce/magento-customer": "6.1.0",
|
|
23
|
+
"@graphcommerce/magento-store": "6.1.0",
|
|
24
|
+
"@graphcommerce/next-ui": "6.1.0"
|
|
25
25
|
},
|
|
26
26
|
"peerDependencies": {
|
|
27
27
|
"@lingui/react": "^3.13.2",
|
|
@@ -9,7 +9,11 @@ export const exported = '@graphcommerce/magento-customer'
|
|
|
9
9
|
function AddPostcodeNLAddressFields(props: PluginProps<AddressFieldsProps>) {
|
|
10
10
|
const { form, Prev } = props
|
|
11
11
|
const country = form.watch('countryCode')
|
|
12
|
-
return country === 'NL' ?
|
|
12
|
+
return country === 'NL' ? (
|
|
13
|
+
<PostcodeNLAddressFields countryFirst {...props} />
|
|
14
|
+
) : (
|
|
15
|
+
<Prev countryFirst {...props} />
|
|
16
|
+
)
|
|
13
17
|
}
|
|
14
18
|
|
|
15
19
|
export const Plugin = AddPostcodeNLAddressFields
|