@akinon/next 2.0.6-rc.0 → 2.0.6-rc.1

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,11 @@
1
1
  # @akinon/next
2
2
 
3
+ ## 2.0.6-rc.1
4
+
5
+ ### Patch Changes
6
+
7
+ - 51ea0688: ZERO-4377: Fix checkout card type state being cleared after valid bin number responses.
8
+
3
9
  ## 2.0.6-rc.0
4
10
 
5
11
  ### Patch Changes
@@ -738,7 +738,6 @@ export const checkoutApi = api.injectEndpoints({
738
738
  },
739
739
  async onQueryStarted(arg, { dispatch, queryFulfilled }) {
740
740
  dispatch(setPaymentStepBusy(true));
741
- dispatch(setCardType(arg));
742
741
  await queryFulfilled;
743
742
  dispatch(setPaymentStepBusy(false));
744
743
  }
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.6-rc.0",
4
+ "version": "2.0.6-rc.1",
5
5
  "private": false,
6
6
  "license": "MIT",
7
7
  "bin": {
@@ -37,7 +37,7 @@
37
37
  "set-cookie-parser": "2.6.0"
38
38
  },
39
39
  "devDependencies": {
40
- "@akinon/eslint-plugin-projectzero": "2.0.6-rc.0",
40
+ "@akinon/eslint-plugin-projectzero": "2.0.6-rc.1",
41
41
  "@babel/core": "7.26.10",
42
42
  "@babel/preset-env": "7.26.9",
43
43
  "@babel/preset-typescript": "7.27.0",
@@ -26,7 +26,7 @@ import {
26
26
  } from '../../redux/reducers/checkout';
27
27
  import { RootState, TypedDispatch } from 'redux/store';
28
28
  import { checkoutApi } from '../../data/client/checkout';
29
- import { CheckoutContext, PreOrder } from '../../types';
29
+ import { CheckoutContext, MiddlewareAction, PreOrder } from '../../types';
30
30
  import { getCookie } from '../../utils';
31
31
  import settings from 'settings';
32
32
  import { LocaleUrlStrategy } from '../../localization';
@@ -114,8 +114,15 @@ export const contextListMiddleware: Middleware = ({
114
114
  const { isMobileApp, userPhoneNumber } = getState().root;
115
115
  const result = next(action) as CheckoutResult;
116
116
  const preOrder = result?.payload?.pre_order;
117
+ const act = action as MiddlewareAction;
117
118
 
118
119
  if (result?.payload?.context_list) {
120
+ const endpointName = act.meta?.arg?.endpointName;
121
+ const isBinNumberResponse = endpointName === 'setBinNumber';
122
+ const hasCardTypeInContextList = result.payload.context_list.some(
123
+ (ctx) => ctx.page_context.card_type
124
+ );
125
+
119
126
  result.payload.context_list.forEach((context) => {
120
127
  const redirectUrl = context.page_context.redirect_url;
121
128
  const isIframe = context.page_context.is_iframe ?? false;
@@ -231,15 +238,24 @@ export const contextListMiddleware: Middleware = ({
231
238
 
232
239
  if (context.page_context.card_type) {
233
240
  dispatch(setCardType(context.page_context.card_type));
234
- } else if (isCreditCardPayment) {
241
+ } else if (
242
+ isCreditCardPayment &&
243
+ isBinNumberResponse &&
244
+ !hasCardTypeInContextList
245
+ ) {
235
246
  dispatch(setCardType(null));
247
+ dispatch(setInstallmentOptions([]));
236
248
  }
237
249
 
238
250
  if (
239
251
  context.page_context.installments &&
240
252
  preOrder?.payment_option?.payment_type !== 'masterpass_rest'
241
253
  ) {
242
- if (!isCreditCardPayment || context.page_context.card_type) {
254
+ if (
255
+ !isCreditCardPayment ||
256
+ context.page_context.card_type ||
257
+ hasCardTypeInContextList
258
+ ) {
243
259
  dispatch(
244
260
  setInstallmentOptions(context.page_context.installments)
245
261
  );