@akinon/next 2.0.28-beta.0 → 2.0.28

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,10 +1,12 @@
1
1
  # @akinon/next
2
2
 
3
- ## 2.0.28-beta.0
3
+ ## 2.0.28
4
4
 
5
5
  ### Patch Changes
6
6
 
7
- - cbbbfd75: ZERO-4376: Bootstrap beta cycle (next-main pre-release motor)
7
+ - a224cf7: ZERO-4565: Prevent funds transfer bank accounts from being cleared by paymentOptionResetMiddleware
8
+
9
+ The reset on `setPaymentOption/fulfilled` cleared `bankAccounts` after `contextListMiddleware` had already populated them from the same response, so funds transfer showed no bank accounts. The reset now skips clearing the bank account list when the response carries its own `bank_accounts`; `selectedBankAccountPk` and the installment/card/masterpass resets are unchanged, preserving the ZERO-3460 installment-loop fix.
8
10
 
9
11
  ## 2.0.27
10
12
 
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "@akinon/next",
3
3
  "description": "Core package for Project Zero Next",
4
- "version": "2.0.28-beta.0",
4
+ "version": "2.0.28",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -36,7 +36,7 @@
36
36
  "set-cookie-parser": "2.6.0"
37
37
  },
38
38
  "devDependencies": {
39
- "@akinon/eslint-plugin-projectzero": "2.0.28-beta.0",
39
+ "@akinon/eslint-plugin-projectzero": "2.0.28",
40
40
  "@babel/core": "7.26.10",
41
41
  "@babel/preset-env": "7.26.9",
42
42
  "@babel/preset-typescript": "7.27.0",
@@ -19,11 +19,30 @@ export const paymentOptionResetMiddleware: Middleware = ({
19
19
  act.type === 'api/executeMutation/fulfilled' &&
20
20
  act.meta?.arg?.endpointName === 'setPaymentOption'
21
21
  ) {
22
+ // When the payment option changes, the previously loaded
23
+ // payment-dependent state becomes stale and is reset here (these fields
24
+ // are also cleared at request-start in setPaymentOption's
25
+ // onQueryStarted). The one exception is the bank account LIST: some
26
+ // payment options (e.g. funds transfer) return their own bank_accounts
27
+ // in this same response's context_list, which contextListMiddleware
28
+ // populates. Since this middleware runs after contextListMiddleware on
29
+ // the unwind, clearing the list here would clobber that freshly loaded
30
+ // data, so we only clear it when the response carries none. The selected
31
+ // bank account pk is always reset (contextListMiddleware never
32
+ // repopulates it; the funds-transfer view re-selects the first account).
33
+ const responseHasBankAccounts = result?.payload?.context_list?.some(
34
+ (context) => !!context.page_context?.bank_accounts?.length
35
+ );
36
+
22
37
  dispatch(setInstallmentOptions([]));
23
- dispatch(setBankAccounts([]));
24
- dispatch(setSelectedBankAccountPk(null));
25
38
  dispatch(setCardType(null));
26
- if(resetMasterpassState){
39
+ dispatch(setSelectedBankAccountPk(null));
40
+
41
+ if (!responseHasBankAccounts) {
42
+ dispatch(setBankAccounts([]));
43
+ }
44
+
45
+ if (resetMasterpassState) {
27
46
  dispatch(resetMasterpassState());
28
47
  }
29
48
  }