@wearejh/m2-pwa-checkout 0.31.4 → 0.33.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
@@ -3,6 +3,25 @@
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.33.0](https://github.com/WeareJH/mage-mono/compare/v0.32.0...v0.33.0) (2025-06-18)
7
+
8
+ **Note:** Version bump only for package @wearejh/m2-pwa-checkout
9
+
10
+
11
+
12
+
13
+
14
+ # [0.32.0](https://github.com/WeareJH/mage-mono/compare/v0.31.4...v0.32.0) (2025-06-06)
15
+
16
+
17
+ ### Bug Fixes
18
+
19
+ * **WOOD-1598:** Checkout refresh re-directs to the homepage ([86b0de0](https://github.com/WeareJH/mage-mono/commit/86b0de09e0619d80d9292d13e1ef5e43bdd678ab))
20
+
21
+
22
+
23
+
24
+
6
25
  ## [0.31.4](https://github.com/WeareJH/mage-mono/compare/v0.31.3...v0.31.4) (2025-06-03)
7
26
 
8
27
  **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 ONE_DAY = 60 * 60 * 24 * 1000;
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.SetTempShippingAddress'),
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() + ONE_DAY,
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
- setAddresses(addresses.concat(tempShippingAddress!).filter(Boolean));
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
- if (addresses.length === 0) {
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, addresses.length],
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.31.4",
3
+ "version": "0.33.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.31.4",
22
- "@wearejh/m2-pwa-cart": "^0.31.4",
23
- "@wearejh/m2-pwa-engine": "^0.31.4",
24
- "@wearejh/m2-pwa-user": "^0.31.4",
25
- "@wearejh/rx-form": "^0.31.4",
26
- "@wearejh/swagger-rxjs": "^0.31.4"
21
+ "@wearejh/m2-pwa-addresses": "^0.33.0",
22
+ "@wearejh/m2-pwa-cart": "^0.33.0",
23
+ "@wearejh/m2-pwa-engine": "^0.33.0",
24
+ "@wearejh/m2-pwa-user": "^0.33.0",
25
+ "@wearejh/rx-form": "^0.33.0",
26
+ "@wearejh/swagger-rxjs": "^0.33.0"
27
27
  },
28
28
  "devDependencies": {
29
29
  "@reach/dialog": "0.8.2"
30
30
  },
31
- "gitHead": "c27eb1e25a1dcead4870e3335562df3a9c2508c2"
31
+ "gitHead": "055f7dbb98d0e595ef8d904d9c981e82fcc31b25"
32
32
  }