@wearejh/m2-pwa-checkout 0.30.0 → 0.31.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 +11 -0
- package/lib/checkout.actions.ts +1 -0
- package/lib/hooks/useAddressChanges.ts +10 -7
- package/package.json +8 -8
package/CHANGELOG.md
CHANGED
|
@@ -3,6 +3,17 @@
|
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
|
5
5
|
|
|
6
|
+
# [0.31.0](https://github.com/WeareJH/mage-mono/compare/v0.30.0...v0.31.0) (2024-12-02)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **m2-pwa-checkout:** sned the city with the shipping estimation query (WOOD-2149) ([73d5341](https://github.com/WeareJH/mage-mono/commit/73d5341a9216b37eba5c6c1c69f4691f011206f5))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
# [0.30.0](https://github.com/WeareJH/mage-mono/compare/v0.29.0...v0.30.0) (2024-09-27)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @wearejh/m2-pwa-checkout
|
package/lib/checkout.actions.ts
CHANGED
|
@@ -11,6 +11,7 @@ import { EstimateShippingByIdParams, EstimateShippingParams } from '../checkout.
|
|
|
11
11
|
type PostcodeEvent = {
|
|
12
12
|
type: 'postcode';
|
|
13
13
|
payload: {
|
|
14
|
+
city: string | undefined;
|
|
14
15
|
postcode: string | undefined;
|
|
15
16
|
country_id: string | undefined;
|
|
16
17
|
region: string | undefined;
|
|
@@ -44,13 +45,13 @@ export function useAddressChanges({ fetchDates, fetchDatesById, postcodeValidati
|
|
|
44
45
|
filter((event) => event.type === 'select'),
|
|
45
46
|
tap((event) => {
|
|
46
47
|
if (event.type === 'select') {
|
|
47
|
-
const { id, postcode, country_id = 'GB' } = event.payload;
|
|
48
|
+
const { city, id, postcode, country_id = 'GB' } = event.payload;
|
|
48
49
|
if (id && id !== -1 && id !== -2) {
|
|
49
50
|
fetchDatesById({ address_id: id });
|
|
50
51
|
return;
|
|
51
52
|
}
|
|
52
53
|
if (postcode) {
|
|
53
|
-
fetchDates({ postcode, country_id });
|
|
54
|
+
fetchDates({ city, postcode, country_id });
|
|
54
55
|
}
|
|
55
56
|
}
|
|
56
57
|
}),
|
|
@@ -60,17 +61,18 @@ export function useAddressChanges({ fetchDates, fetchDatesById, postcodeValidati
|
|
|
60
61
|
filter((event) => event.type === 'postcode'),
|
|
61
62
|
debounceTime(300),
|
|
62
63
|
filter((x) => {
|
|
63
|
-
const { postcode, country_id, region, region_id } = x.payload;
|
|
64
|
+
const { city, postcode, country_id, region, region_id } = x.payload;
|
|
64
65
|
if (postcode) {
|
|
65
66
|
return !postcodeValidation()(x.payload.postcode);
|
|
66
67
|
}
|
|
67
|
-
if (country_id || region || region_id) {
|
|
68
|
+
if (city || country_id || region || region_id) {
|
|
68
69
|
return true;
|
|
69
70
|
}
|
|
70
71
|
return false;
|
|
71
72
|
}),
|
|
72
73
|
tap((event) => {
|
|
73
74
|
fetchDates({
|
|
75
|
+
city: event.payload.city,
|
|
74
76
|
postcode: event.payload.postcode,
|
|
75
77
|
country_id: event.payload.country_id || 'GB',
|
|
76
78
|
region: event.payload.region,
|
|
@@ -104,6 +106,7 @@ export const useAddressEvents = (props: InnerProps) => {
|
|
|
104
106
|
|
|
105
107
|
const address_id = useFieldValue(Fields.address_id);
|
|
106
108
|
const postcode = useFieldValue(Fields.postcode);
|
|
109
|
+
const city = useFieldValue(Fields.city);
|
|
107
110
|
const country_id = useFieldValue(Fields.country_id);
|
|
108
111
|
const region = useFieldValue(Fields.region);
|
|
109
112
|
const region_id = useFieldValue(Fields.region_id);
|
|
@@ -136,10 +139,10 @@ export const useAddressEvents = (props: InnerProps) => {
|
|
|
136
139
|
const send = () =>
|
|
137
140
|
events.next({
|
|
138
141
|
type: 'postcode',
|
|
139
|
-
payload: { postcode: postcode, country_id: country_id, region, region_id },
|
|
142
|
+
payload: { city, postcode: postcode, country_id: country_id, region, region_id },
|
|
140
143
|
});
|
|
141
144
|
|
|
142
|
-
if ((postcode || country_id || region || region_id) && !initial.current) {
|
|
145
|
+
if ((city || postcode || country_id || region || region_id) && !initial.current) {
|
|
143
146
|
initial.current = true;
|
|
144
147
|
setTimeout(send, 0);
|
|
145
148
|
} else {
|
|
@@ -147,5 +150,5 @@ export const useAddressEvents = (props: InnerProps) => {
|
|
|
147
150
|
send();
|
|
148
151
|
}
|
|
149
152
|
}
|
|
150
|
-
}, [events, initial, postcode, country_id, region, region_id]);
|
|
153
|
+
}, [events, initial, city, postcode, country_id, region, region_id]);
|
|
151
154
|
};
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wearejh/m2-pwa-checkout",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.31.0",
|
|
4
4
|
"description": "> TODO: description",
|
|
5
5
|
"author": "Shane Osbourne <shane.osbourne8@gmail.com>",
|
|
6
6
|
"homepage": "",
|
|
@@ -18,15 +18,15 @@
|
|
|
18
18
|
],
|
|
19
19
|
"scripts": {},
|
|
20
20
|
"dependencies": {
|
|
21
|
-
"@wearejh/m2-pwa-addresses": "^0.
|
|
22
|
-
"@wearejh/m2-pwa-cart": "^0.
|
|
23
|
-
"@wearejh/m2-pwa-engine": "^0.
|
|
24
|
-
"@wearejh/m2-pwa-user": "^0.
|
|
25
|
-
"@wearejh/rx-form": "^0.
|
|
26
|
-
"@wearejh/swagger-rxjs": "^0.
|
|
21
|
+
"@wearejh/m2-pwa-addresses": "^0.31.0",
|
|
22
|
+
"@wearejh/m2-pwa-cart": "^0.31.0",
|
|
23
|
+
"@wearejh/m2-pwa-engine": "^0.31.0",
|
|
24
|
+
"@wearejh/m2-pwa-user": "^0.31.0",
|
|
25
|
+
"@wearejh/rx-form": "^0.31.0",
|
|
26
|
+
"@wearejh/swagger-rxjs": "^0.31.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@reach/dialog": "0.8.2"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "5b654ab21cf7d6ad199e579e8b62d9f4dd67dbd7"
|
|
32
32
|
}
|