@wearejh/m2-pwa-checkout 0.31.4 → 0.32.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/epics/persist.epic.ts +12 -4
- package/lib/hooks/useShippingSubmit.ts +7 -5
- 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.32.0](https://github.com/WeareJH/mage-mono/compare/v0.31.4...v0.32.0) (2025-06-06)
|
|
7
|
+
|
|
8
|
+
|
|
9
|
+
### Bug Fixes
|
|
10
|
+
|
|
11
|
+
* **WOOD-1598:** Checkout refresh re-directs to the homepage ([86b0de0](https://github.com/WeareJH/mage-mono/commit/86b0de09e0619d80d9292d13e1ef5e43bdd678ab))
|
|
12
|
+
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
|
|
16
|
+
|
|
6
17
|
## [0.31.4](https://github.com/WeareJH/mage-mono/compare/v0.31.3...v0.31.4) (2025-06-03)
|
|
7
18
|
|
|
8
19
|
**Note:** Version bump only for package @wearejh/m2-pwa-checkout
|
|
@@ -8,21 +8,29 @@ import { CheckoutState } from '../checkout.reducer';
|
|
|
8
8
|
import { STORAGE_CHECKOUT_KEY } from '../checkout.register';
|
|
9
9
|
import { CheckoutActions } from '../checkout.actions';
|
|
10
10
|
|
|
11
|
-
const
|
|
11
|
+
const ONE_HOUR = 60 * 60 * 1000;
|
|
12
12
|
|
|
13
|
+
/**
|
|
14
|
+
* Epic that listens for the 'Checkout.SetTempShippingAddress' action.
|
|
15
|
+
* When triggered, it retrieves the latest checkout state, extracts relevant
|
|
16
|
+
* checkout data (tempShippingAddress, step, shippingAddress, billingAddress,
|
|
17
|
+
* shipping_method, totals), and persists this data to storage with a 1-hour expiry.
|
|
18
|
+
*/
|
|
13
19
|
export function checkoutPersist(action$: Observable<any>, state$: Observable<unknown>): Observable<Action> {
|
|
14
20
|
return action$.pipe(
|
|
15
|
-
ofType<CheckoutActions>('Checkout.
|
|
21
|
+
ofType<CheckoutActions>('Checkout.ProceedToPayment'),
|
|
16
22
|
withLatestFrom<Action, [Action, CheckoutState]>(state$.pipe(pluck('checkout'))),
|
|
17
23
|
map(([, checkout]) => {
|
|
18
24
|
// Items to persist
|
|
19
|
-
const { tempShippingAddress } = checkout;
|
|
25
|
+
const { tempShippingAddress, shipping_method } = checkout;
|
|
26
|
+
|
|
20
27
|
return StorageMsg(StorageActions.Set, {
|
|
21
28
|
key: STORAGE_CHECKOUT_KEY,
|
|
22
29
|
value: {
|
|
23
30
|
tempShippingAddress,
|
|
31
|
+
shipping_method,
|
|
24
32
|
},
|
|
25
|
-
expiry: new Date().getTime() +
|
|
33
|
+
expiry: new Date().getTime() + ONE_HOUR,
|
|
26
34
|
});
|
|
27
35
|
}),
|
|
28
36
|
);
|
|
@@ -59,7 +59,11 @@ export function useShippingSubmit(): UseShippingAPI {
|
|
|
59
59
|
* Update addresses if user addresses change in global state
|
|
60
60
|
*/
|
|
61
61
|
useEffect(() => {
|
|
62
|
-
|
|
62
|
+
if (tempShippingAddress?.id === -1) {
|
|
63
|
+
setAddresses(addresses.concat(tempShippingAddress!).filter(Boolean));
|
|
64
|
+
} else {
|
|
65
|
+
setAddresses(addresses);
|
|
66
|
+
}
|
|
63
67
|
}, [addresses, tempShippingAddress]);
|
|
64
68
|
|
|
65
69
|
/**
|
|
@@ -67,12 +71,10 @@ export function useShippingSubmit(): UseShippingAPI {
|
|
|
67
71
|
*/
|
|
68
72
|
const submit = useCallback(
|
|
69
73
|
(params: ShippingSubmit) => {
|
|
70
|
-
|
|
71
|
-
dispatch(CheckoutMsg('Checkout.SetTempShippingAddress', params.address));
|
|
72
|
-
}
|
|
74
|
+
dispatch(CheckoutMsg('Checkout.SetTempShippingAddress', params.address));
|
|
73
75
|
dispatch(CheckoutMsg('Checkout.ShippingSubmit', params));
|
|
74
76
|
},
|
|
75
|
-
[dispatch
|
|
77
|
+
[dispatch],
|
|
76
78
|
);
|
|
77
79
|
|
|
78
80
|
/**
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@wearejh/m2-pwa-checkout",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.32.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.32.0",
|
|
22
|
+
"@wearejh/m2-pwa-cart": "^0.32.0",
|
|
23
|
+
"@wearejh/m2-pwa-engine": "^0.32.0",
|
|
24
|
+
"@wearejh/m2-pwa-user": "^0.32.0",
|
|
25
|
+
"@wearejh/rx-form": "^0.32.0",
|
|
26
|
+
"@wearejh/swagger-rxjs": "^0.32.0"
|
|
27
27
|
},
|
|
28
28
|
"devDependencies": {
|
|
29
29
|
"@reach/dialog": "0.8.2"
|
|
30
30
|
},
|
|
31
|
-
"gitHead": "
|
|
31
|
+
"gitHead": "523dca0507791ac27e0840cf3fedd87336468ab2"
|
|
32
32
|
}
|