@zeniai/client-epic-state 4.16.3 → 4.16.4

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.
Files changed (159) hide show
  1. package/lib/commonStateTypes/animations.d.ts +1 -1
  2. package/lib/commonStateTypes/animations.js +1 -1
  3. package/lib/entity/chargeCard/chargeCard.d.ts +8 -26
  4. package/lib/entity/chargeCard/chargeCard.js +6 -25
  5. package/lib/entity/chargeCard/chargeCardPayload.d.ts +5 -41
  6. package/lib/entity/chargeCard/chargeCardPayload.js +8 -20
  7. package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
  8. package/lib/entity/chargeCardTransaction/chargeCardTransaction.js +1 -5
  9. package/lib/entity/company/companyPayload.d.ts +1 -12
  10. package/lib/entity/company/companyPayload.js +0 -14
  11. package/lib/entity/company/companyStateTypes.d.ts +0 -11
  12. package/lib/entity/depositAccount/depositAccount.d.ts +2 -20
  13. package/lib/entity/depositAccount/depositAccountPayload.d.ts +1 -22
  14. package/lib/entity/depositAccount/depositAccountPayload.js +1 -39
  15. package/lib/entity/depositAccount/depositAccountReducer.d.ts +2 -2
  16. package/lib/entity/depositAccount/depositAccountReducer.js +2 -8
  17. package/lib/entity/depositAccount/depositAccountSelector.d.ts +1 -3
  18. package/lib/entity/depositAccount/depositAccountSelector.js +0 -10
  19. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  20. package/lib/entity/snackbar/snackbarTypes.js +0 -2
  21. package/lib/entity/tenant/clearAllEpic.d.ts +1 -2
  22. package/lib/entity/tenant/clearAllEpic.js +0 -2
  23. package/lib/entity/tenant/tenantSelector.d.ts +2 -6
  24. package/lib/entity/tenant/tenantSelector.js +2 -10
  25. package/lib/epic.d.ts +1 -5
  26. package/lib/epic.js +1 -5
  27. package/lib/index.d.ts +16 -16
  28. package/lib/index.js +29 -39
  29. package/lib/reducer.d.ts +0 -3
  30. package/lib/reducer.js +0 -3
  31. package/lib/view/addressView/__mocks__/json/createCompanyAddressSuccess.json +0 -8
  32. package/lib/view/addressView/__mocks__/json/createCompanyUserAddressSuccess.json +0 -16
  33. package/lib/view/addressView/addressViewState.d.ts +1 -1
  34. package/lib/view/dashboard/dashboardSelector.js +6 -7
  35. package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.js +4 -5
  36. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +2 -1
  37. package/lib/view/expenseAutomationView/epics/fluxAnalysis/fetchFluxAnalysisViewEpic.js +6 -18
  38. package/lib/view/expenseAutomationView/epics/fluxAnalysis/reviewFluxAnalysisEpic.js +4 -1
  39. package/lib/view/expenseAutomationView/helpers/helpers.js +4 -4
  40. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +23 -25
  41. package/lib/view/expenseAutomationView/payload/fluxAnalysisPayload.d.ts +9 -22
  42. package/lib/view/expenseAutomationView/payload/fluxAnalysisPayload.js +2 -2
  43. package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.d.ts +5 -13
  44. package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.js +115 -245
  45. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +15 -9
  46. package/lib/view/expenseAutomationView/selectorTypes/fluxAnalysisViewSelectorTypes.d.ts +9 -29
  47. package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +40 -108
  48. package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.d.ts +15 -40
  49. package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.js +1 -1
  50. package/lib/view/onboardingView/cockpitView/epic/initializeOnboardingCustomerViewUpdateDataEpic.js +4 -4
  51. package/lib/view/onboardingView/cockpitView/onboardingCockpitViewReducer.d.ts +1 -2
  52. package/lib/view/onboardingView/cockpitView/onboardingCockpitViewReducer.js +2 -2
  53. package/lib/view/settingsView/settingsViewHelpers.d.ts +4 -4
  54. package/lib/view/settingsView/settingsViewHelpers.js +8 -9
  55. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +1 -1
  56. package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.d.ts +1 -6
  57. package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +2 -20
  58. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +0 -5
  59. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +2 -9
  60. package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +0 -1
  61. package/lib/view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingSelector.js +3 -4
  62. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigPayload.d.ts +3 -5
  63. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigPayload.js +2 -4
  64. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +3 -8
  65. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigState.d.ts +2 -4
  66. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +0 -12
  67. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.js +0 -26
  68. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailPayload.d.ts +0 -2
  69. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +4 -43
  70. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +9 -104
  71. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.d.ts +0 -15
  72. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.js +16 -70
  73. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.d.ts +1 -2
  74. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +3 -12
  75. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardTransactionListEpic.js +1 -2
  76. package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateChargeCardLimitEpic.js +2 -2
  77. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -11
  78. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -20
  79. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListPayload.d.ts +1 -16
  80. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +4 -6
  81. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +4 -30
  82. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +2 -5
  83. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +14 -26
  84. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.d.ts +2 -2
  85. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +5 -20
  86. package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewReducer.d.ts +1 -2
  87. package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewReducer.js +2 -4
  88. package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewSelector.d.ts +1 -2
  89. package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewSelector.js +0 -2
  90. package/lib/view/spendManagement/chargeCards/chargeCardSetUp/epic/acceptChargeCardTermsEpic.js +2 -19
  91. package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchIssueCardPageEpic.d.ts +2 -2
  92. package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchIssueCardPageEpic.js +3 -15
  93. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.d.ts +2 -2
  94. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +25 -65
  95. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.d.ts +3 -11
  96. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +11 -45
  97. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.d.ts +3 -6
  98. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +18 -33
  99. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.d.ts +8 -41
  100. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.js +21 -0
  101. package/lib/view/spendManagement/commonSetup/epic/setup/enableSetupEpic.js +0 -9
  102. package/lib/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js +3 -8
  103. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +4 -4
  104. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +1 -2
  105. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +1 -3
  106. package/lib/view/spendManagement/commonSetup/setupViewState.js +1 -13
  107. package/lib/view/spendManagement/helpers.d.ts +0 -3
  108. package/lib/view/spendManagement/helpers.js +1 -13
  109. package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/getPaymentAccountsEpic.js +1 -2
  110. package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountEpic.js +1 -2
  111. package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountLoginStatusEpic.js +1 -2
  112. package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountStatusEpic.js +1 -2
  113. package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.d.ts +1 -2
  114. package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.js +1 -6
  115. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +10 -10
  116. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +0 -1
  117. package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +1 -1
  118. package/lib/view/spendManagement/zeniAccounts/checkDeposit/checkDepositSelector.js +1 -1
  119. package/lib/view/spendManagement/zeniAccounts/depositAccountList/depositAccountListSelector.d.ts +1 -1
  120. package/lib/view/spendManagement/zeniAccounts/depositAccountList/depositAccountListSelector.js +3 -3
  121. package/lib/view/spendManagement/zeniAccounts/expressPay/expressPaySelector.js +1 -1
  122. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.js +1 -1
  123. package/lib/view/spendManagement/zeniAccounts/zeniAccountList/zeniAccountListSelector.js +1 -1
  124. package/lib/view/twoFactorAuthentication/resendOtpEpic.d.ts +2 -3
  125. package/lib/view/twoFactorAuthentication/resendOtpEpic.js +19 -44
  126. package/lib/view/twoFactorAuthentication/sendOtpEpic.d.ts +1 -2
  127. package/lib/view/twoFactorAuthentication/sendOtpEpic.js +18 -45
  128. package/lib/view/twoFactorAuthentication/twoFactorAuthentication.d.ts +5 -17
  129. package/lib/view/twoFactorAuthentication/twoFactorAuthentication.js +0 -33
  130. package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.d.ts +7 -7
  131. package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.js +6 -6
  132. package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.d.ts +6 -22
  133. package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.js +60 -176
  134. package/lib/view/twoFactorAuthentication/twoFactorAuthenticationSelector.d.ts +3 -5
  135. package/lib/view/twoFactorAuthentication/twoFactorAuthenticationSelector.js +2 -13
  136. package/lib/view/twoFactorAuthentication/verifyOtpEpic.d.ts +2 -5
  137. package/lib/view/twoFactorAuthentication/verifyOtpEpic.js +5 -46
  138. package/lib/view/userListView/fetchUserListByTypeEpic.d.ts +2 -2
  139. package/lib/view/userListView/fetchUserListByTypeEpic.js +3 -4
  140. package/lib/view/userListView/userListViewPayload.d.ts +0 -11
  141. package/package.json +4 -5
  142. package/lib/entity/connectedAccount/connectedAccount.d.ts +0 -19
  143. package/lib/entity/connectedAccount/connectedAccount.js +0 -10
  144. package/lib/entity/connectedAccount/connectedAccountPayload.d.ts +0 -11
  145. package/lib/entity/connectedAccount/connectedAccountPayload.js +0 -15
  146. package/lib/entity/connectedAccount/connectedAccountReducer.d.ts +0 -6
  147. package/lib/entity/connectedAccount/connectedAccountReducer.js +0 -27
  148. package/lib/entity/connectedAccount/connectedAccountSelector.d.ts +0 -4
  149. package/lib/entity/connectedAccount/connectedAccountSelector.js +0 -17
  150. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchDepositAccountLimitEpic.d.ts +0 -8
  151. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchDepositAccountLimitEpic.js +0 -41
  152. package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateDebitCardPinAttemptEpic.d.ts +0 -11
  153. package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateDebitCardPinAttemptEpic.js +0 -42
  154. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchDebitCardSummaryEpic.d.ts +0 -7
  155. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchDebitCardSummaryEpic.js +0 -23
  156. package/lib/view/spendManagement/chargeCards/issueChargeCard/depositAccountWithLimitPayload.d.ts +0 -6
  157. package/lib/view/spendManagement/chargeCards/issueChargeCard/depositAccountWithLimitPayload.js +0 -2
  158. package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchDepositAccountListForCardsEpic.d.ts +0 -8
  159. package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchDepositAccountListForCardsEpic.js +0 -31
@@ -9,19 +9,13 @@ const cashbackDetailReducer_1 = require("../cashbackDetail/cashbackDetailReducer
9
9
  const chargeCardConfigReducer_1 = require("../chargeCardConfig/chargeCardConfigReducer");
10
10
  const chargeCardListReducer_1 = require("./chargeCardListReducer");
11
11
  const fetchChargeCardListPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(chargeCardListReducer_1.fetchChargeCardListPage.match), (0, operators_1.mergeMap)((action) => {
12
- const { doFetchCreditAccountsDebitSummaryAndCashback, isDebitCardEnabled, isCreditCardEnabled, cacheOverride, } = action.payload;
12
+ const { doFetchCreditAccountsAndCashback, cacheOverride } = action.payload;
13
13
  const chargeCardListPageAction = [];
14
14
  const state = state$.value;
15
15
  const cashbackDetailState = state.cashbackDetailState;
16
16
  if (cacheOverride === true) {
17
- if (doFetchCreditAccountsDebitSummaryAndCashback === true) {
18
- if (isCreditCardEnabled) {
19
- chargeCardListPageAction.push((0, chargeCardListReducer_1.fetchCreditAccount)());
20
- }
21
- if (isDebitCardEnabled) {
22
- chargeCardListPageAction.push((0, chargeCardListReducer_1.fetchDebitCardSummary)());
23
- }
24
- chargeCardListPageAction.push((0, cashbackDetailReducer_1.fetchCashbackDetail)());
17
+ if (doFetchCreditAccountsAndCashback === true) {
18
+ chargeCardListPageAction.push((0, chargeCardListReducer_1.fetchCreditAccount)(), (0, cashbackDetailReducer_1.fetchCashbackDetail)());
25
19
  }
26
20
  chargeCardListPageAction.push((0, chargeCardListReducer_1.fetchChargeCardList)());
27
21
  chargeCardListPageAction.push((0, chargeCardConfigReducer_1.fetchChargeCardConfig)());
@@ -31,13 +25,12 @@ const fetchChargeCardListPageEpic = (actions$, state$) => actions$.pipe((0, oper
31
25
  }
32
26
  else {
33
27
  const chargeCardList = state.chargeCardListState;
34
- if (doFetchCreditAccountsDebitSummaryAndCashback === true &&
35
- isCreditCardEnabled &&
28
+ if (doFetchCreditAccountsAndCashback === true &&
36
29
  chargeCardList.creditAccount.fetchState !== 'Completed' &&
37
30
  chargeCardList.creditAccount.fetchState !== 'In-Progress') {
38
31
  chargeCardListPageAction.push((0, chargeCardListReducer_1.fetchCreditAccount)());
39
32
  }
40
- if (doFetchCreditAccountsDebitSummaryAndCashback &&
33
+ if (doFetchCreditAccountsAndCashback &&
41
34
  cashbackDetailState.fetchState !== 'In-Progress' &&
42
35
  cashbackDetailState.hasValidState() === false) {
43
36
  chargeCardListPageAction.push((0, cashbackDetailReducer_1.fetchCashbackDetail)());
@@ -65,14 +58,6 @@ const fetchChargeCardListPageEpic = (actions$, state$) => actions$.pipe((0, oper
65
58
  state.classListState.fetchState !== 'In-Progress') {
66
59
  chargeCardListPageAction.push((0, classListReducer_1.fetchClassList)());
67
60
  }
68
- if (doFetchCreditAccountsDebitSummaryAndCashback &&
69
- isDebitCardEnabled &&
70
- state.chargeCardListState.debitCardSummaries.fetchState !==
71
- 'In-Progress' &&
72
- state.chargeCardListState.debitCardSummaries.fetchState !==
73
- 'Completed') {
74
- chargeCardListPageAction.push((0, chargeCardListReducer_1.fetchDebitCardSummary)());
75
- }
76
61
  }
77
62
  return (0, rxjs_1.concat)((0, rxjs_1.from)(chargeCardListPageAction));
78
63
  }));
@@ -5,10 +5,9 @@ export declare const fetchChargeCardSetupView: import("@reduxjs/toolkit").Action
5
5
  companyId: string;
6
6
  cacheOverride: any;
7
7
  refreshViewInBackground: any;
8
- }, "chargeCardSetupView/fetchChargeCardSetupView", never, never>, fetchChargeCardSetupViewSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chargeCardSetupView/fetchChargeCardSetupViewSuccess">, fetchChargeCardSetupViewFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, "chargeCardSetupView/fetchChargeCardSetupViewFailure", never, never>, acceptChargeCardTerms: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, enableChargeCard: boolean, chargeCardSetupViewType: "charge_cards" | "debit_cards" | "charge_cards__debit_cards"], {
8
+ }, "chargeCardSetupView/fetchChargeCardSetupView", never, never>, fetchChargeCardSetupViewSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chargeCardSetupView/fetchChargeCardSetupViewSuccess">, fetchChargeCardSetupViewFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, "chargeCardSetupView/fetchChargeCardSetupViewFailure", never, never>, acceptChargeCardTerms: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, enableChargeCard: boolean], {
9
9
  companyId: string;
10
10
  enableChargeCard: boolean;
11
- chargeCardSetupViewType: "charge_cards" | "debit_cards" | "charge_cards__debit_cards";
12
11
  }, "chargeCardSetupView/acceptChargeCardTerms", never, never>, acceptChargeCardTermsSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chargeCardSetupView/acceptChargeCardTermsSuccess">, acceptChargeCardTermsFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], ZeniAPIStatus<Record<string, unknown>>, "chargeCardSetupView/acceptChargeCardTermsFailure", never, never>, clearChargeCardSetupView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chargeCardSetupView/clearChargeCardSetupView">;
13
12
  declare const _default: import("redux").Reducer<ChargeCardSetupViewState>;
14
13
  export default _default;
@@ -57,10 +57,8 @@ const chargeCardSetupView = (0, toolkit_1.createSlice)({
57
57
  },
58
58
  });
59
59
  },
60
- prepare(companyId, enableChargeCard, chargeCardSetupViewType) {
61
- return {
62
- payload: { companyId, enableChargeCard, chargeCardSetupViewType },
63
- };
60
+ prepare(companyId, enableChargeCard) {
61
+ return { payload: { companyId, enableChargeCard } };
64
62
  },
65
63
  },
66
64
  acceptChargeCardTermsSuccess(draft) {
@@ -1,11 +1,10 @@
1
1
  import { FetchStateAndError, ID } from '../../../../commonStateTypes/common';
2
2
  import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAndReport';
3
- import { CompanyChargeCardInfo, CompanyDebitCardInfo, CompanyLocaleInfo } from '../../../../entity/company/companyStateTypes';
3
+ import { CompanyChargeCardInfo, CompanyLocaleInfo } from '../../../../entity/company/companyStateTypes';
4
4
  import { RootState } from '../../../../reducer';
5
5
  import { BusinessVerificationDetails, CompanyOfficersDetails, SetupView } from '../../commonSetup/setupViewSelector';
6
6
  export interface ChargeCardSetupView extends SetupView, SelectorView {
7
7
  companyChargeCardInfo?: CompanyChargeCardInfo;
8
- companyDebitCardInfo?: CompanyDebitCardInfo;
9
8
  companyLocaleInfo?: CompanyLocaleInfo;
10
9
  chargeCardTermsDetails?: {
11
10
  fetchStatus: FetchStateAndError;
@@ -9,7 +9,6 @@ function getChargeCardSetupViewDetails(state, companyId) {
9
9
  const chargeCardSetupViewDetails = (0, setupViewSelector_1.getCommonSetupViewDetails)(state, companyId, 'charge_cards', 'charge_card_setup');
10
10
  const companyView = (0, getCompanyView_1.getCompanyView)(state, companyId, []);
11
11
  const companyChargeCardInfo = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyChargeCardInfo;
12
- const companyDebitCardInfo = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyDebitCardInfo;
13
12
  const companyLocaleInfo = companyView === null || companyView === void 0 ? void 0 : companyView.company.company.companyLocaleInfo;
14
13
  const { chargeCardSetupViewState, setupViewState } = state;
15
14
  const { chargeCardTermsDetails, isRefreshingViewInBackground } = chargeCardSetupViewState;
@@ -19,7 +18,6 @@ function getChargeCardSetupViewDetails(state, companyId) {
19
18
  const selectedCompanyOfficer = (0, helpers_1.getSelectedCompanyOfficer)(businessVerificationDetails);
20
19
  return Object.assign(Object.assign({}, chargeCardSetupViewDetails), { chargeCardTermsDetails,
21
20
  companyChargeCardInfo,
22
- companyDebitCardInfo,
23
21
  companyLocaleInfo, version: 1, fetchState,
24
22
  error,
25
23
  updateStatus,
@@ -10,26 +10,9 @@ const userRoleReducer_1 = require("../../../../../entity/userRole/userRoleReduce
10
10
  const responsePayload_1 = require("../../../../../responsePayload");
11
11
  const chargeCardSetUpViewReducer_1 = require("../chargeCardSetUpViewReducer");
12
12
  const acceptChargeCardTermsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(chargeCardSetUpViewReducer_1.acceptChargeCardTerms.match), (0, operators_1.mergeMap)((action) => {
13
- const { companyId, enableChargeCard, chargeCardSetupViewType } = action.payload;
14
- let payload;
15
- switch (chargeCardSetupViewType) {
16
- case 'charge_cards':
17
- payload = Object.assign({ is_charge_cards_tos_accepted: true }, (enableChargeCard && { is_charge_cards_enabled: true }));
18
- break;
19
- case 'charge_cards__debit_cards':
20
- payload = Object.assign({ is_charge_cards_tos_accepted: true, is_debit_cards_tos_accepted: true }, (enableChargeCard && {
21
- is_charge_cards_enabled: true,
22
- is_debit_cards_enabled: true,
23
- }));
24
- break;
25
- case 'debit_cards':
26
- payload = Object.assign({ is_debit_cards_tos_accepted: true }, (enableChargeCard && { is_debit_cards_enabled: true }));
27
- break;
28
- default:
29
- payload = {};
30
- }
13
+ const { companyId, enableChargeCard } = action.payload;
31
14
  return zeniAPI
32
- .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, payload)
15
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, Object.assign({ is_charge_cards_tos_accepted: true }, (enableChargeCard && { is_charge_cards_enabled: true })))
33
16
  .pipe((0, operators_1.mergeMap)((response) => {
34
17
  if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
35
18
  const actions = [
@@ -5,6 +5,6 @@ import { fetchClassList } from '../../../classList/classListReducer';
5
5
  import { fetchUserListByType } from '../../../userListView/userListViewReducer';
6
6
  import { fetchChargeCardConfig } from '../chargeCardConfig/chargeCardConfigReducer';
7
7
  import { fetchChargeCardList, fetchCreditAccount } from '../chargeCardList/chargeCardListReducer';
8
- import { fetchDepositAccountListForCards, fetchIssueCardPage } from './issueChargeCardReducer';
9
- export type ActionType = ReturnType<typeof fetchIssueCardPage> | ReturnType<typeof fetchChargeCardConfig> | ReturnType<typeof fetchUserListByType> | ReturnType<typeof fetchDepositAccountListForCards> | ReturnType<typeof fetchChargeCardList> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchCreditAccount>;
8
+ import { fetchIssueCardPage } from './issueChargeCardReducer';
9
+ export type ActionType = ReturnType<typeof fetchIssueCardPage> | ReturnType<typeof fetchChargeCardConfig> | ReturnType<typeof fetchUserListByType> | ReturnType<typeof fetchChargeCardList> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchCreditAccount>;
10
10
  export declare const fetchIssueCardPageEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
@@ -9,20 +9,15 @@ const chargeCardConfigReducer_1 = require("../chargeCardConfig/chargeCardConfigR
9
9
  const chargeCardListReducer_1 = require("../chargeCardList/chargeCardListReducer");
10
10
  const issueChargeCardReducer_1 = require("./issueChargeCardReducer");
11
11
  const fetchIssueCardPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(issueChargeCardReducer_1.fetchIssueCardPage.match), (0, operators_1.mergeMap)((action) => {
12
- const { cacheOverride, isDebitCardFlagEnabled, isCreditCardFlagEnabled } = action.payload;
12
+ const { cacheOverride } = action.payload;
13
13
  const issueCardPageAction = [];
14
14
  const state = state$.value;
15
15
  if (cacheOverride === true) {
16
16
  issueCardPageAction.push((0, chargeCardConfigReducer_1.fetchChargeCardConfig)());
17
- if (isCreditCardFlagEnabled) {
18
- issueCardPageAction.push((0, chargeCardListReducer_1.fetchCreditAccount)());
19
- }
17
+ issueCardPageAction.push((0, chargeCardListReducer_1.fetchCreditAccount)());
20
18
  issueCardPageAction.push((0, userListViewReducer_1.fetchUserListByType)('cardHolderCandidate', true));
21
19
  issueCardPageAction.push((0, classListReducer_1.fetchClassList)());
22
20
  issueCardPageAction.push((0, chargeCardListReducer_1.fetchChargeCardList)());
23
- if (isDebitCardFlagEnabled) {
24
- issueCardPageAction.push((0, issueChargeCardReducer_1.fetchDepositAccountListForCards)());
25
- }
26
21
  }
27
22
  else {
28
23
  const chargeCardConfig = state.chargeCardConfigState;
@@ -32,8 +27,7 @@ const fetchIssueCardPageEpic = (actions$, state$) => actions$.pipe((0, operators
32
27
  }
33
28
  const chargeCardList = state.chargeCardListState;
34
29
  if (chargeCardList.creditAccount.fetchState !== 'Completed' &&
35
- chargeCardList.creditAccount.fetchState !== 'In-Progress' &&
36
- isCreditCardFlagEnabled) {
30
+ chargeCardList.creditAccount.fetchState !== 'In-Progress') {
37
31
  issueCardPageAction.push((0, chargeCardListReducer_1.fetchCreditAccount)());
38
32
  }
39
33
  const userList = state.userListViewState.userListByType.cardHolderCandidate;
@@ -49,12 +43,6 @@ const fetchIssueCardPageEpic = (actions$, state$) => actions$.pipe((0, operators
49
43
  chargeCardList.fetchState !== 'In-Progress') {
50
44
  issueCardPageAction.push((0, chargeCardListReducer_1.fetchChargeCardList)());
51
45
  }
52
- const depositAccountsFetchState = state.issueChargeCardState.depositAccountsFetchState;
53
- if (isDebitCardFlagEnabled &&
54
- depositAccountsFetchState.fetchState !== 'Completed' &&
55
- depositAccountsFetchState.fetchState !== 'In-Progress') {
56
- issueCardPageAction.push((0, issueChargeCardReducer_1.fetchDepositAccountListForCards)());
57
- }
58
46
  }
59
47
  return (0, rxjs_1.concat)((0, rxjs_1.from)(issueCardPageAction));
60
48
  }));
@@ -8,6 +8,6 @@ import { updateUserRoles } from '../../../../entity/userRole/userRoleReducer';
8
8
  import { RootState } from '../../../../reducer';
9
9
  import { ZeniAPI } from '../../../../zeniAPI';
10
10
  import { updateChargeCardList } from '../chargeCardList/chargeCardListReducer';
11
- import { issueChargeCardSuccessOrFailure, issueChargeCards, updateChargeCardCount, updateDebitCardCount } from './issueChargeCardReducer';
12
- export type ActionType = ReturnType<typeof issueChargeCards> | ReturnType<typeof updateChargeCards> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateChargeCardList> | ReturnType<typeof updateChargeCardCount> | ReturnType<typeof updateDebitCardCount> | ReturnType<typeof issueChargeCardSuccessOrFailure> | ReturnType<typeof updateAddresses>;
11
+ import { issueChargeCardSuccessOrFailure, issueChargeCards, updateCardCount } from './issueChargeCardReducer';
12
+ export type ActionType = ReturnType<typeof issueChargeCards> | ReturnType<typeof updateChargeCards> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateUserRoles> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateChargeCardList> | ReturnType<typeof updateCardCount> | ReturnType<typeof issueChargeCardSuccessOrFailure> | ReturnType<typeof updateAddresses>;
13
13
  export declare const issueChargeCardEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -15,82 +15,42 @@ const issueChargeCardEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
15
15
  const state = state$.value;
16
16
  const localData = state.issueChargeCardState.localData;
17
17
  const payload = localData.map((data) => {
18
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
19
- if (data.chargeCardType === 'credit_card') {
20
- if (data.creditCard.cardType === 'business_physical_credit_card') {
21
- return {
22
- card_holder_user_ids: data.creditCard.physicalCard.userId != null
23
- ? [data.creditCard.physicalCard.userId]
24
- : [],
25
- card_name: data.creditCard.physicalCard.cardName,
26
- purchase_limit: (_b = (_a = data.creditCard.physicalCard.amount) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0,
27
- currency_code: (_d = (_c = data.creditCard.physicalCard.amount) === null || _c === void 0 ? void 0 : _c.currencyCode) !== null && _d !== void 0 ? _d : 'USD',
28
- purchase_limit_frequency: {
29
- code: data.creditCard.physicalCard.frequency,
30
- },
31
- card_type: data.creditCard.cardType,
32
- shipping_address_type: data.creditCard.physicalCard.addressType,
33
- shipping_address_id: data.creditCard.physicalCard.addressId,
34
- };
35
- }
36
- {
37
- return {
38
- card_holder_user_ids: data.creditCard.virtualCard.userIds,
39
- card_name: data.creditCard.virtualCard.cardName,
40
- purchase_limit: (_f = (_e = data.creditCard.virtualCard.amount) === null || _e === void 0 ? void 0 : _e.amount) !== null && _f !== void 0 ? _f : 0,
41
- currency_code: (_h = (_g = data.creditCard.virtualCard.amount) === null || _g === void 0 ? void 0 : _g.currencyCode) !== null && _h !== void 0 ? _h : 'USD',
42
- purchase_limit_frequency: {
43
- code: data.creditCard.virtualCard.frequency,
44
- },
45
- card_type: data.creditCard.cardType,
46
- };
47
- }
18
+ var _a, _b, _c, _d, _e, _f, _g, _h;
19
+ if (data.cardType === 'business_physical_credit_card') {
20
+ return {
21
+ card_holder_user_ids: data.physicalCard.userId != null
22
+ ? [data.physicalCard.userId]
23
+ : [],
24
+ card_name: data.physicalCard.cardName,
25
+ credit_limit: (_b = (_a = data.physicalCard.amount) === null || _a === void 0 ? void 0 : _a.amount) !== null && _b !== void 0 ? _b : 0,
26
+ currency_code: (_d = (_c = data.physicalCard.amount) === null || _c === void 0 ? void 0 : _c.currencyCode) !== null && _d !== void 0 ? _d : 'USD',
27
+ credit_limit_frequency: { code: data.physicalCard.frequency },
28
+ card_type: data.cardType,
29
+ shipping_address_type: data.physicalCard.addressType,
30
+ shipping_address_id: data.physicalCard.addressId,
31
+ };
48
32
  }
49
33
  else {
50
- if (data.debitCard.cardType === 'business_physical_debit_card') {
51
- return {
52
- card_holder_user_ids: data.debitCard.physicalCard.userId != null
53
- ? [data.debitCard.physicalCard.userId]
54
- : [],
55
- card_name: data.debitCard.physicalCard.cardName,
56
- purchase_limit: (_k = (_j = data.debitCard.physicalCard.amount) === null || _j === void 0 ? void 0 : _j.amount) !== null && _k !== void 0 ? _k : 0,
57
- currency_code: (_m = (_l = data.debitCard.physicalCard.amount) === null || _l === void 0 ? void 0 : _l.currencyCode) !== null && _m !== void 0 ? _m : 'USD',
58
- purchase_limit_frequency: {
59
- code: data.debitCard.physicalCard.frequency,
60
- },
61
- card_type: data.debitCard.cardType,
62
- shipping_address_type: data.debitCard.physicalCard.addressType,
63
- shipping_address_id: data.debitCard.physicalCard.addressId,
64
- connected_account_id: data.debitCard.physicalCard.connectedAccountId,
65
- connected_account_type: 'deposit_account',
66
- };
67
- }
68
- else {
69
- return {
70
- card_holder_user_ids: data.debitCard.virtualCard.userIds,
71
- card_name: data.debitCard.virtualCard.cardName,
72
- purchase_limit: (_p = (_o = data.debitCard.virtualCard.amount) === null || _o === void 0 ? void 0 : _o.amount) !== null && _p !== void 0 ? _p : 0,
73
- currency_code: (_r = (_q = data.debitCard.virtualCard.amount) === null || _q === void 0 ? void 0 : _q.currencyCode) !== null && _r !== void 0 ? _r : 'USD',
74
- purchase_limit_frequency: {
75
- code: data.debitCard.virtualCard.frequency,
76
- },
77
- connected_account_id: data.debitCard.virtualCard.connectedAccountId,
78
- card_type: data.debitCard.cardType,
79
- connected_account_type: 'deposit_account',
80
- };
81
- }
34
+ return {
35
+ card_holder_user_ids: data.virtualCard.userIds,
36
+ card_name: data.virtualCard.cardName,
37
+ credit_limit: (_f = (_e = data.virtualCard.amount) === null || _e === void 0 ? void 0 : _e.amount) !== null && _f !== void 0 ? _f : 0,
38
+ currency_code: (_h = (_g = data.virtualCard.amount) === null || _g === void 0 ? void 0 : _g.currencyCode) !== null && _h !== void 0 ? _h : 'USD',
39
+ credit_limit_frequency: { code: data.virtualCard.frequency },
40
+ card_type: data.cardType,
41
+ };
82
42
  }
83
43
  });
84
44
  return zeniAPI
85
45
  .postAndGetJSON(`${zeniAPI.apiEndPoints.cardMicroServiceBaseUrl}/1.0/cards`, { cards: payload })
86
46
  .pipe((0, operators_1.mergeMap)((response) => {
87
- var _a, _b, _c, _d, _e;
47
+ var _a, _b, _c;
88
48
  if ((0, responsePayload_1.isSuccessStatus)(response) && response.data != null) {
89
49
  const actions = [];
90
50
  actions.push((0, chargeCardReducer_1.updateChargeCards)(response.data.cards), (0, userReducer_1.updateAllUsers)({ users: response.data.users }), (0, userRoleReducer_1.updateUserRoles)(response.data.user_roles), (0, chargeCardListReducer_1.updateChargeCardList)({
91
51
  chargeCardListPayload: response.data,
92
52
  keepExistingListItems: true,
93
- }), (0, addressReducer_1.updateAddresses)(response.data.addresses), (0, issueChargeCardReducer_1.updateChargeCardCount)((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.cards_count_by_user_id) !== null && _b !== void 0 ? _b : []), (0, issueChargeCardReducer_1.updateDebitCardCount)((_d = (_c = response.data) === null || _c === void 0 ? void 0 : _c.debit_cards_count_by_deposit_account_id) !== null && _d !== void 0 ? _d : {}), (0, issueChargeCardReducer_1.issueChargeCardSuccessOrFailure)({ fetchState: 'Completed' }));
53
+ }), (0, addressReducer_1.updateAddresses)(response.data.addresses), (0, issueChargeCardReducer_1.updateCardCount)((_b = (_a = response.data) === null || _a === void 0 ? void 0 : _a.cards_count_by_user_id) !== null && _b !== void 0 ? _b : []), (0, issueChargeCardReducer_1.issueChargeCardSuccessOrFailure)({ fetchState: 'Completed' }));
94
54
  const cardHolderIds = response.data.cards.map((card) => card.holder_user_id);
95
55
  const namesList = response.data.users
96
56
  .filter((user) => cardHolderIds.includes(user.user_id))
@@ -105,7 +65,7 @@ const issueChargeCardEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, ope
105
65
  variables: [
106
66
  {
107
67
  variableName: '_user-name_',
108
- variableValue: (_e = namesList[0]) !== null && _e !== void 0 ? _e : '',
68
+ variableValue: (_c = namesList[0]) !== null && _c !== void 0 ? _c : '',
109
69
  },
110
70
  {
111
71
  variableName: '_card_',
@@ -1,8 +1,6 @@
1
1
  import { FetchState, ID } from '../../../../commonStateTypes/common';
2
- import { CardCodeType } from '../../../../entity/chargeCard/chargeCard';
3
- import { DepositAccountWithLimitPayload } from '../../../../entity/depositAccount/depositAccountPayload';
4
2
  import { ZeniAPIStatus } from '../../../../responsePayload';
5
- import { ActiveChargeCardCountPayload, ActiveDebitCardCountByUserIdPayload } from '../../../userListView/userListViewPayload';
3
+ import { ActiveChargeCardCountPayload } from '../../../userListView/userListViewPayload';
6
4
  import { IssueChargeCardLocalData, IssueChargeCardState } from './issueChargeCardState';
7
5
  export declare const initialState: IssueChargeCardState;
8
6
  export declare const issueChargeCards: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[], {}, "issueChargeCard/issueChargeCards", never, never>, updateChargeCardsLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPayload<IssueChargeCardLocalData[], "issueChargeCard/updateChargeCardsLocalStore">, issueChargeCardSuccessOrFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
@@ -11,14 +9,8 @@ export declare const issueChargeCards: import("@reduxjs/toolkit").ActionCreatorW
11
9
  }, "issueChargeCard/issueChargeCardSuccessOrFailure">, resetIssueChargeCardForm: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"issueChargeCard/resetIssueChargeCardForm">, updateCustomAddressId: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
12
10
  addressId: ID;
13
11
  cardLineId: ID;
14
- cardType: CardCodeType;
15
- }, "issueChargeCard/updateCustomAddressId">, updateChargeCardCount: import("@reduxjs/toolkit").ActionCreatorWithPayload<ActiveChargeCardCountPayload[], "issueChargeCard/updateChargeCardCount">, updateDebitCardCount: import("@reduxjs/toolkit").ActionCreatorWithPayload<Record<string, ActiveDebitCardCountByUserIdPayload>, "issueChargeCard/updateDebitCardCount">, fetchIssueCardPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[isDebitCardFlagEnabled: boolean, isCreditCardFlagEnabled: boolean, cacheOverride?: any], {
16
- isDebitCardFlagEnabled: boolean;
17
- isCreditCardFlagEnabled: boolean;
12
+ }, "issueChargeCard/updateCustomAddressId">, updateCardCount: import("@reduxjs/toolkit").ActionCreatorWithPayload<ActiveChargeCardCountPayload[], "issueChargeCard/updateCardCount">, fetchIssueCardPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride?: any], {
18
13
  cacheOverride: any;
19
- }, "issueChargeCard/fetchIssueCardPage", never, never>, updateDepositAccountsInCards: import("@reduxjs/toolkit").ActionCreatorWithPayload<DepositAccountWithLimitPayload[], "issueChargeCard/updateDepositAccountsInCards">, fetchDepositAccountListForCards: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"issueChargeCard/fetchDepositAccountListForCards">, updateDepositAccountListForCardsFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
20
- fetchState: FetchState;
21
- error?: ZeniAPIStatus;
22
- }, "issueChargeCard/updateDepositAccountListForCardsFetchStatus">, clearIssueChargeCard: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"issueChargeCard/clearIssueChargeCard">;
14
+ }, "issueChargeCard/fetchIssueCardPage", never, never>, clearIssueChargeCard: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"issueChargeCard/clearIssueChargeCard">;
23
15
  declare const _default: import("redux").Reducer<IssueChargeCardState>;
24
16
  export default _default;
@@ -1,12 +1,11 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearIssueChargeCard = exports.updateDepositAccountListForCardsFetchStatus = exports.fetchDepositAccountListForCards = exports.updateDepositAccountsInCards = exports.fetchIssueCardPage = exports.updateDebitCardCount = exports.updateChargeCardCount = exports.updateCustomAddressId = exports.resetIssueChargeCardForm = exports.issueChargeCardSuccessOrFailure = exports.updateChargeCardsLocalStore = exports.issueChargeCards = exports.initialState = void 0;
4
+ exports.clearIssueChargeCard = exports.fetchIssueCardPage = exports.updateCardCount = exports.updateCustomAddressId = exports.resetIssueChargeCardForm = exports.issueChargeCardSuccessOrFailure = exports.updateChargeCardsLocalStore = exports.issueChargeCards = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
+ const issueChargeCardState_1 = require("./issueChargeCardState");
6
7
  exports.initialState = {
7
- depositAccountIds: [],
8
- depositAccountsFetchState: { fetchState: 'Not-Started', error: undefined },
9
- localData: [],
8
+ localData: issueChargeCardState_1.initialIssueChargeCardLocalData,
10
9
  fetchState: 'Not-Started',
11
10
  error: undefined,
12
11
  saveStatus: {
@@ -16,8 +15,7 @@ exports.initialState = {
16
15
  hasValidState() {
17
16
  return this.fetchState == 'Completed';
18
17
  },
19
- activeChargeCardCount: {},
20
- activeDebitCardCountByDepositAccountId: {},
18
+ activeCardCount: {},
21
19
  };
22
20
  const issueChargeCard = (0, toolkit_1.createSlice)({
23
21
  name: 'issueChargeCard',
@@ -27,13 +25,9 @@ const issueChargeCard = (0, toolkit_1.createSlice)({
27
25
  reducer() {
28
26
  //do nothing
29
27
  },
30
- prepare(isDebitCardFlagEnabled, isCreditCardFlagEnabled, cacheOverride = false) {
28
+ prepare(cacheOverride = false) {
31
29
  return {
32
- payload: {
33
- isDebitCardFlagEnabled,
34
- isCreditCardFlagEnabled,
35
- cacheOverride,
36
- },
30
+ payload: { cacheOverride },
37
31
  };
38
32
  },
39
33
  },
@@ -58,52 +52,24 @@ const issueChargeCard = (0, toolkit_1.createSlice)({
58
52
  draft.saveStatus.error = action.payload.error;
59
53
  },
60
54
  updateCustomAddressId(draft, action) {
61
- const { addressId, cardLineId, cardType } = action.payload;
55
+ const { addressId, cardLineId } = action.payload;
62
56
  const targetIndex = draft.localData.findIndex((lineItem) => lineItem.lineId === cardLineId);
63
57
  if (targetIndex > -1) {
64
- if (cardType === 'business_physical_credit_card') {
65
- draft.localData[targetIndex] = Object.assign(Object.assign({}, draft.localData[targetIndex]), { creditCard: Object.assign(Object.assign({}, draft.localData[targetIndex].creditCard), { physicalCard: Object.assign(Object.assign({}, draft.localData[targetIndex].creditCard.physicalCard), { addressId: addressId }) }) });
66
- }
67
- else if (cardType === 'business_physical_debit_card') {
68
- draft.localData[targetIndex] = Object.assign(Object.assign({}, draft.localData[targetIndex]), { debitCard: Object.assign(Object.assign({}, draft.localData[targetIndex].debitCard), { physicalCard: Object.assign(Object.assign({}, draft.localData[targetIndex].debitCard.physicalCard), { addressId: addressId }) }) });
69
- }
58
+ draft.localData[targetIndex] = Object.assign(Object.assign({}, draft.localData[targetIndex]), { physicalCard: Object.assign(Object.assign({}, draft.localData[targetIndex].physicalCard), { addressId: addressId }) });
70
59
  }
71
60
  },
72
- updateChargeCardCount(draft, action) {
61
+ updateCardCount(draft, action) {
73
62
  action.payload.forEach((activeChargeCardCountPayload) => {
74
- draft.activeChargeCardCount[activeChargeCardCountPayload.user_id] = {
63
+ draft.activeCardCount[activeChargeCardCountPayload.user_id] = {
75
64
  physicalCardCount: activeChargeCardCountPayload.business_physical_credit_card_count,
76
65
  virtualCardCount: activeChargeCardCountPayload.business_virtual_credit_card_count,
77
66
  };
78
67
  });
79
68
  },
80
- updateDebitCardCount(draft, action) {
81
- Object.entries(action.payload).forEach(([depositAccountId, activeDebitCardCountByUserIdPayload]) => {
82
- Object.entries(activeDebitCardCountByUserIdPayload).forEach(([userId, activeDebitCardCount]) => {
83
- draft.activeDebitCardCountByDepositAccountId = Object.assign(Object.assign({}, draft.activeDebitCardCountByDepositAccountId), { [depositAccountId]: Object.assign(Object.assign({}, draft.activeDebitCardCountByDepositAccountId[depositAccountId]), { [userId]: {
84
- physicalCardCount: activeDebitCardCount.business_physical_debit_card_count,
85
- virtualCardCount: activeDebitCardCount.business_virtual_debit_card_count,
86
- } }) });
87
- });
88
- });
89
- },
90
- fetchDepositAccountListForCards(draft) {
91
- draft.depositAccountsFetchState.error = undefined;
92
- draft.depositAccountsFetchState.fetchState = 'In-Progress';
93
- },
94
- updateDepositAccountsInCards(draft, action) {
95
- draft.depositAccountIds = action.payload.map((depositAccountWithLimitPayload) => depositAccountWithLimitPayload.deposit_account_id);
96
- draft.depositAccountsFetchState.fetchState = 'Completed';
97
- draft.depositAccountsFetchState.error = undefined;
98
- },
99
- updateDepositAccountListForCardsFetchStatus(draft, action) {
100
- draft.depositAccountsFetchState.fetchState = action.payload.fetchState;
101
- draft.depositAccountsFetchState.error = action.payload.error;
102
- },
103
69
  clearIssueChargeCard(draft) {
104
70
  Object.assign(draft, exports.initialState);
105
71
  },
106
72
  },
107
73
  });
108
- _a = issueChargeCard.actions, exports.issueChargeCards = _a.issueChargeCards, exports.updateChargeCardsLocalStore = _a.updateChargeCardsLocalStore, exports.issueChargeCardSuccessOrFailure = _a.issueChargeCardSuccessOrFailure, exports.resetIssueChargeCardForm = _a.resetIssueChargeCardForm, exports.updateCustomAddressId = _a.updateCustomAddressId, exports.updateChargeCardCount = _a.updateChargeCardCount, exports.updateDebitCardCount = _a.updateDebitCardCount, exports.fetchIssueCardPage = _a.fetchIssueCardPage, exports.updateDepositAccountsInCards = _a.updateDepositAccountsInCards, exports.fetchDepositAccountListForCards = _a.fetchDepositAccountListForCards, exports.updateDepositAccountListForCardsFetchStatus = _a.updateDepositAccountListForCardsFetchStatus, exports.clearIssueChargeCard = _a.clearIssueChargeCard;
74
+ _a = issueChargeCard.actions, exports.issueChargeCards = _a.issueChargeCards, exports.updateChargeCardsLocalStore = _a.updateChargeCardsLocalStore, exports.issueChargeCardSuccessOrFailure = _a.issueChargeCardSuccessOrFailure, exports.resetIssueChargeCardForm = _a.resetIssueChargeCardForm, exports.updateCustomAddressId = _a.updateCustomAddressId, exports.updateCardCount = _a.updateCardCount, exports.fetchIssueCardPage = _a.fetchIssueCardPage, exports.clearIssueChargeCard = _a.clearIssueChargeCard;
109
75
  exports.default = issueChargeCard.reducer;
@@ -2,25 +2,22 @@ import { FetchStateAndError, ID } from '../../../../commonStateTypes/common';
2
2
  import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAndReport';
3
3
  import { Address } from '../../../../entity/address/addressState';
4
4
  import { Class } from '../../../../entity/class/classState';
5
- import { DepositAccountWithLimit } from '../../../../entity/depositAccount/depositAccount';
6
5
  import { RootState } from '../../../../reducer';
7
6
  import { Person } from '../../../people/peopleSelectorTypes';
8
7
  import { ChargeCardConfigState } from '../chargeCardConfig/chargeCardConfigState';
9
8
  import { CreditAccount } from '../chargeCardList/chargeCardList';
10
- import { ActiveChargeCardCount, ActiveDebitCardCountByUserId, IssueChargeCardLocalData } from './issueChargeCardState';
9
+ import { ActiveChargeCardCount, IssueChargeCardLocalData } from './issueChargeCardState';
11
10
  export interface IssueChargeCardSelectorView extends SelectorView {
12
11
  localData: IssueChargeCardLocalData[];
13
12
  issueCardStatus: FetchStateAndError;
14
13
  userList: Person[];
15
- depositAccounts: DepositAccountWithLimit[];
16
14
  allAccountingClasses: Class[];
17
15
  chargeCardConfig: ChargeCardConfigState;
18
16
  creditAccount: CreditAccount;
19
17
  customAddress: Record<ID, Address>;
20
18
  customAddressStatus: Record<ID, FetchStateAndError>;
21
19
  userAddress: Record<ID, Address>;
22
- activeChargeCardCount: Record<ID, ActiveChargeCardCount>;
23
- activeDebitCardCountByDepositAccountId: Record<ID, ActiveDebitCardCountByUserId>;
20
+ activeCardCountByUser: Record<ID, ActiveChargeCardCount>;
24
21
  companyAddress?: Address;
25
22
  }
26
- export declare const getIssueChargeCardView: (state: RootState, isCreditCardEnabled: boolean, isDebitCardEnabled: boolean) => IssueChargeCardSelectorView;
23
+ export declare const getIssueChargeCardView: (state: RootState) => IssueChargeCardSelectorView;
@@ -4,16 +4,14 @@ exports.getIssueChargeCardView = void 0;
4
4
  const reduceFetchState_1 = require("../../../../commonStateTypes/reduceFetchState");
5
5
  const addressSelector_1 = require("../../../../entity/address/addressSelector");
6
6
  const classSelector_1 = require("../../../../entity/class/classSelector");
7
- const depositAccountSelector_1 = require("../../../../entity/depositAccount/depositAccountSelector");
8
7
  const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
9
8
  const addressViewSelector_1 = require("../../../addressView/addressViewSelector");
10
9
  const userListViewSelector_1 = require("../../../userListView/userListViewSelector");
11
- const getIssueChargeCardView = (state, isCreditCardEnabled, isDebitCardEnabled) => {
10
+ const getIssueChargeCardView = (state) => {
12
11
  var _a;
13
- const { issueChargeCardState, userState, userRoleState, userListViewState, chargeCardConfigState, chargeCardListState, addressState, classState, depositAccountState, classListState, } = state;
12
+ const { issueChargeCardState, userState, userRoleState, userListViewState, chargeCardConfigState, chargeCardListState, addressState, classState, classListState, } = state;
14
13
  const userListSelectorView = (0, userListViewSelector_1.getUserList)(userState, userRoleState, userListViewState, 'cardHolderCandidate');
15
14
  const userList = userListSelectorView.users;
16
- const depositAccounts = (0, depositAccountSelector_1.getDepositAccountLimitsForChargeCardByDepositAccountIds)(depositAccountState, issueChargeCardState.depositAccountIds);
17
15
  let selectedUserAddress = {};
18
16
  userList.forEach((user) => {
19
17
  var _a, _b;
@@ -33,23 +31,17 @@ const getIssueChargeCardView = (state, isCreditCardEnabled, isDebitCardEnabled)
33
31
  };
34
32
  issueChargeCardState.localData.forEach((lineItem) => {
35
33
  var _a;
36
- let newlyAddedAddress;
37
- const targetLineId = lineItem.lineId;
38
- if (lineItem.chargeCardType === 'credit_card' &&
39
- lineItem.creditCard.cardType === 'business_physical_credit_card') {
40
- newlyAddedAddress = (0, addressViewSelector_1.getNewAddress)(`credit_custom_shipping_${targetLineId}_address`, state);
41
- }
42
- else if (lineItem.chargeCardType === 'debit_card' &&
43
- lineItem.debitCard.cardType === 'business_physical_debit_card') {
44
- newlyAddedAddress = (0, addressViewSelector_1.getNewAddress)(`debit_custom_shipping_${targetLineId}_address`, state);
45
- }
46
- customAddressStatus = Object.assign(Object.assign({}, customAddressStatus), { [targetLineId]: (_a = newlyAddedAddress === null || newlyAddedAddress === void 0 ? void 0 : newlyAddedAddress.status) !== null && _a !== void 0 ? _a : defaultFetchState });
47
- if (newlyAddedAddress != null &&
48
- newlyAddedAddress.status.fetchState === 'Completed' &&
49
- newlyAddedAddress.newAddressId != null) {
50
- const addressFromEntity = (0, addressSelector_1.getAddressByAddressId)(addressState, newlyAddedAddress.newAddressId);
51
- if (addressFromEntity != null) {
52
- customAddress = Object.assign(Object.assign({}, customAddress), { [targetLineId]: addressFromEntity });
34
+ if (lineItem.cardType === 'business_physical_credit_card') {
35
+ const targetLineId = lineItem.lineId;
36
+ const newlyAddedAddress = (0, addressViewSelector_1.getNewAddress)(`custom_shipping_${targetLineId}_address`, state);
37
+ customAddressStatus = Object.assign(Object.assign({}, customAddressStatus), { [targetLineId]: (_a = newlyAddedAddress === null || newlyAddedAddress === void 0 ? void 0 : newlyAddedAddress.status) !== null && _a !== void 0 ? _a : defaultFetchState });
38
+ if (newlyAddedAddress != null &&
39
+ newlyAddedAddress.status.fetchState === 'Completed' &&
40
+ newlyAddedAddress.newAddressId != null) {
41
+ const addressFromEntity = (0, addressSelector_1.getAddressByAddressId)(addressState, newlyAddedAddress.newAddressId);
42
+ if (addressFromEntity != null) {
43
+ customAddress = Object.assign(Object.assign({}, customAddress), { [targetLineId]: addressFromEntity });
44
+ }
53
45
  }
54
46
  }
55
47
  });
@@ -58,26 +50,20 @@ const getIssueChargeCardView = (state, isCreditCardEnabled, isDebitCardEnabled)
58
50
  classIds: classIds,
59
51
  reportId: 'class_list',
60
52
  });
61
- const requiredFetchStates = [
53
+ const issueCardPageFetchState = (0, reduceFetchState_1.reduceFetchState)([
62
54
  chargeCardConfigState,
63
55
  userListViewState.userListByType.cardHolderCandidate,
64
56
  userListSelectorView,
57
+ chargeCardListState.creditAccount,
65
58
  classListState,
66
- ];
67
- if (isDebitCardEnabled) {
68
- requiredFetchStates.push(issueChargeCardState.depositAccountsFetchState);
69
- }
70
- if (isCreditCardEnabled) {
71
- requiredFetchStates.push(chargeCardListState.creditAccount);
72
- }
73
- const issueCardPageFetchState = (0, reduceFetchState_1.reduceFetchState)(requiredFetchStates);
59
+ chargeCardListState,
60
+ ]);
74
61
  return {
75
62
  fetchState: issueCardPageFetchState.fetchState,
76
63
  error: issueCardPageFetchState.error,
77
64
  issueCardStatus: issueChargeCardState.saveStatus,
78
65
  localData: issueChargeCardState.localData,
79
66
  userList,
80
- depositAccounts,
81
67
  chargeCardConfig: chargeCardConfigState,
82
68
  creditAccount: chargeCardListState.creditAccount,
83
69
  companyAddress: companyAddress,
@@ -85,8 +71,7 @@ const getIssueChargeCardView = (state, isCreditCardEnabled, isDebitCardEnabled)
85
71
  customAddressStatus,
86
72
  userAddress: selectedUserAddress,
87
73
  allAccountingClasses,
88
- activeChargeCardCount: issueChargeCardState.activeChargeCardCount,
89
- activeDebitCardCountByDepositAccountId: issueChargeCardState.activeDebitCardCountByDepositAccountId,
74
+ activeCardCountByUser: issueChargeCardState.activeCardCount,
90
75
  };
91
76
  };
92
77
  exports.getIssueChargeCardView = getIssueChargeCardView;