@zeniai/client-epic-state 4.15.98 → 4.16.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.
Files changed (168) 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 +18 -18
  28. package/lib/index.js +17 -26
  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/epics/transactionCategorization/markTransactionAsNotMiscatgorizedEpic.d.ts +2 -2
  40. package/lib/view/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscatgorizedEpic.js +3 -3
  41. package/lib/view/expenseAutomationView/helpers/helpers.js +4 -4
  42. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +23 -25
  43. package/lib/view/expenseAutomationView/payload/fluxAnalysisPayload.d.ts +9 -22
  44. package/lib/view/expenseAutomationView/payload/fluxAnalysisPayload.js +2 -2
  45. package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.d.ts +5 -13
  46. package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.js +115 -245
  47. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
  48. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +18 -12
  49. package/lib/view/expenseAutomationView/selectorTypes/fluxAnalysisViewSelectorTypes.d.ts +9 -29
  50. package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +40 -108
  51. package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.d.ts +15 -40
  52. package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.js +1 -1
  53. package/lib/view/onboardingView/cockpitView/epic/initializeOnboardingCustomerViewUpdateDataEpic.js +4 -4
  54. package/lib/view/onboardingView/cockpitView/onboardingCockpitViewReducer.d.ts +1 -2
  55. package/lib/view/onboardingView/cockpitView/onboardingCockpitViewReducer.js +2 -2
  56. package/lib/view/settingsView/settingsViewHelpers.d.ts +4 -4
  57. package/lib/view/settingsView/settingsViewHelpers.js +8 -9
  58. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +1 -1
  59. package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.d.ts +1 -6
  60. package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.js +2 -20
  61. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +0 -5
  62. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +2 -9
  63. package/lib/view/spendManagement/billPay/editBillView/editBillViewState.d.ts +0 -1
  64. package/lib/view/spendManagement/chargeCards/cardUserOnboarding/cardUserOnboardingSelector.js +3 -4
  65. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigPayload.d.ts +3 -5
  66. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigPayload.js +2 -4
  67. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +3 -8
  68. package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigState.d.ts +2 -4
  69. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +0 -12
  70. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.js +0 -26
  71. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailPayload.d.ts +0 -2
  72. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +4 -43
  73. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +9 -104
  74. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.d.ts +0 -15
  75. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailSelector.js +16 -70
  76. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.d.ts +1 -2
  77. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +3 -12
  78. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardTransactionListEpic.js +1 -2
  79. package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateChargeCardLimitEpic.js +2 -2
  80. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -11
  81. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -20
  82. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListPayload.d.ts +1 -16
  83. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +4 -6
  84. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +4 -30
  85. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.d.ts +2 -5
  86. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +14 -26
  87. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.d.ts +2 -2
  88. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +5 -20
  89. package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewReducer.d.ts +1 -2
  90. package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewReducer.js +2 -4
  91. package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewSelector.d.ts +1 -2
  92. package/lib/view/spendManagement/chargeCards/chargeCardSetUp/chargeCardSetUpViewSelector.js +0 -2
  93. package/lib/view/spendManagement/chargeCards/chargeCardSetUp/epic/acceptChargeCardTermsEpic.js +2 -19
  94. package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchIssueCardPageEpic.d.ts +2 -2
  95. package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchIssueCardPageEpic.js +3 -15
  96. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.d.ts +2 -2
  97. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardEpic.js +25 -65
  98. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.d.ts +3 -11
  99. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer.js +11 -45
  100. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.d.ts +3 -6
  101. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardSelector.js +18 -33
  102. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.d.ts +8 -41
  103. package/lib/view/spendManagement/chargeCards/issueChargeCard/issueChargeCardState.js +21 -0
  104. package/lib/view/spendManagement/commonSetup/epic/setup/enableSetupEpic.js +0 -9
  105. package/lib/view/spendManagement/commonSetup/epic/setup/updateBusinessVerificationDetailsEpic.js +3 -8
  106. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +4 -4
  107. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +1 -2
  108. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +1 -3
  109. package/lib/view/spendManagement/commonSetup/setupViewState.js +1 -13
  110. package/lib/view/spendManagement/helpers.d.ts +0 -3
  111. package/lib/view/spendManagement/helpers.js +1 -13
  112. package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/getPaymentAccountsEpic.js +1 -2
  113. package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountEpic.js +1 -2
  114. package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountLoginStatusEpic.js +1 -2
  115. package/lib/view/spendManagement/plaidAccount/epic/paymentAccounts/updatePaymentAccountStatusEpic.js +1 -2
  116. package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.d.ts +1 -2
  117. package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.js +1 -6
  118. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +10 -10
  119. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +0 -1
  120. package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +1 -1
  121. package/lib/view/spendManagement/zeniAccounts/checkDeposit/checkDepositSelector.js +1 -1
  122. package/lib/view/spendManagement/zeniAccounts/depositAccountList/depositAccountListSelector.d.ts +1 -1
  123. package/lib/view/spendManagement/zeniAccounts/depositAccountList/depositAccountListSelector.js +3 -3
  124. package/lib/view/spendManagement/zeniAccounts/expressPay/expressPaySelector.js +1 -1
  125. package/lib/view/spendManagement/zeniAccounts/transferDetail/transferDetailSelector.js +1 -1
  126. package/lib/view/spendManagement/zeniAccounts/zeniAccountList/zeniAccountListSelector.js +1 -1
  127. package/lib/view/transactionDetail/epics/markTransactionAsNotMiscategorizedEpic.d.ts +3 -4
  128. package/lib/view/transactionDetail/epics/markTransactionAsNotMiscategorizedEpic.js +1 -25
  129. package/lib/view/transactionDetail/epics/saveTransactionDetailEpic.js +1 -1
  130. package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +1 -1
  131. package/lib/view/transactionDetail/transactionDetailReducer.d.ts +2 -4
  132. package/lib/view/transactionDetail/transactionDetailReducer.js +2 -4
  133. package/lib/view/twoFactorAuthentication/resendOtpEpic.d.ts +2 -3
  134. package/lib/view/twoFactorAuthentication/resendOtpEpic.js +19 -44
  135. package/lib/view/twoFactorAuthentication/sendOtpEpic.d.ts +1 -2
  136. package/lib/view/twoFactorAuthentication/sendOtpEpic.js +18 -45
  137. package/lib/view/twoFactorAuthentication/twoFactorAuthentication.d.ts +5 -17
  138. package/lib/view/twoFactorAuthentication/twoFactorAuthentication.js +0 -33
  139. package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.d.ts +7 -7
  140. package/lib/view/twoFactorAuthentication/twoFactorAuthenticationPayload.js +6 -6
  141. package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.d.ts +6 -22
  142. package/lib/view/twoFactorAuthentication/twoFactorAuthenticationReducer.js +60 -176
  143. package/lib/view/twoFactorAuthentication/twoFactorAuthenticationSelector.d.ts +3 -5
  144. package/lib/view/twoFactorAuthentication/twoFactorAuthenticationSelector.js +2 -13
  145. package/lib/view/twoFactorAuthentication/verifyOtpEpic.d.ts +2 -5
  146. package/lib/view/twoFactorAuthentication/verifyOtpEpic.js +5 -46
  147. package/lib/view/userListView/fetchUserListByTypeEpic.d.ts +2 -2
  148. package/lib/view/userListView/fetchUserListByTypeEpic.js +3 -4
  149. package/lib/view/userListView/userListViewPayload.d.ts +0 -11
  150. package/package.json +4 -5
  151. package/lib/entity/connectedAccount/connectedAccount.d.ts +0 -19
  152. package/lib/entity/connectedAccount/connectedAccount.js +0 -10
  153. package/lib/entity/connectedAccount/connectedAccountPayload.d.ts +0 -11
  154. package/lib/entity/connectedAccount/connectedAccountPayload.js +0 -15
  155. package/lib/entity/connectedAccount/connectedAccountReducer.d.ts +0 -6
  156. package/lib/entity/connectedAccount/connectedAccountReducer.js +0 -27
  157. package/lib/entity/connectedAccount/connectedAccountSelector.d.ts +0 -4
  158. package/lib/entity/connectedAccount/connectedAccountSelector.js +0 -17
  159. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchDepositAccountLimitEpic.d.ts +0 -8
  160. package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchDepositAccountLimitEpic.js +0 -41
  161. package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateDebitCardPinAttemptEpic.d.ts +0 -11
  162. package/lib/view/spendManagement/chargeCards/chargeCardDetail/updateDebitCardPinAttemptEpic.js +0 -42
  163. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchDebitCardSummaryEpic.d.ts +0 -7
  164. package/lib/view/spendManagement/chargeCards/chargeCardList/fetchDebitCardSummaryEpic.js +0 -23
  165. package/lib/view/spendManagement/chargeCards/issueChargeCard/depositAccountWithLimitPayload.d.ts +0 -6
  166. package/lib/view/spendManagement/chargeCards/issueChargeCard/depositAccountWithLimitPayload.js +0 -2
  167. package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchDepositAccountListForCardsEpic.d.ts +0 -8
  168. package/lib/view/spendManagement/chargeCards/issueChargeCard/fetchDepositAccountListForCardsEpic.js +0 -31
@@ -1,55 +1,39 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.updateSelectedSectionIdsForReview = exports.updateFluxAnalysisViewPageMetaData = exports.updateFluxAnalysisViewUIState = exports.reviewFluxAnalysisViewFailure = exports.reviewFluxAnalysisViewSuccess = exports.reviewFluxAnalysisView = exports.updateOperatingExpensesIdsForReview = exports.clearExpenseAutomationFluxAnalysisView = exports.fetchFluxAnalysisViewFailure = exports.fetchFluxAnalysisViewSuccess = exports.fetchFluxAnalysisView = exports.initialState = void 0;
4
+ exports.updateFluxAnalysisViewPageMetaData = exports.updateFluxAnalysisViewUIState = exports.reviewFluxAnalysisViewFailure = exports.reviewFluxAnalysisViewSuccess = exports.reviewFluxAnalysisView = exports.updateOperatingExpensesIdsForReview = exports.clearExpenseAutomationFluxAnalysisView = exports.fetchFluxAnalysisViewFailure = exports.fetchFluxAnalysisViewSuccess = exports.fetchFluxAnalysisView = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
7
- const vendorState_1 = require("../../../entity/vendor/vendorState");
8
7
  const helpers_1 = require("../helpers/helpers");
9
8
  exports.initialState = {
9
+ reviewStatusById: {},
10
+ operatingExpenseIdsBySelectedPeriod: {},
10
11
  fluxAnalysisEntities: { operatingExpenses: [] },
11
12
  uiState: {
12
13
  scrollPosition: { scrollTop: 0, scrollLeft: undefined },
14
+ pageToken: null,
15
+ hasMore: true,
16
+ totalCount: 0,
17
+ limit: 10,
13
18
  sortKey: 'vendor',
14
19
  searchString: '',
15
20
  sortOrder: 'ascending',
16
- paginationInfoByGroup: {
17
- generalExpense: {
18
- pageToken: null,
19
- hasMore: true,
20
- totalCount: 0,
21
- limit: 10,
22
- },
23
- reimbursement: {
24
- pageToken: null,
25
- hasMore: true,
26
- totalCount: 0,
27
- limit: 10,
28
- },
29
- },
30
- collapsableStatus: {
31
- generalExpense: true,
32
- reimbursement: true,
33
- },
34
- },
35
- fetchState: 'Not-Started',
36
- error: undefined,
37
- currency: vendorState_1.defaultVendorCurrency,
38
- totalBalancesAndVariance: undefined,
39
- hasValidState() {
40
- return this.fetchState == 'Completed';
41
21
  },
42
22
  refreshStatus: {
43
23
  fetchState: 'Not-Started',
44
24
  error: undefined,
45
25
  },
26
+ fetchState: 'Not-Started',
46
27
  bulkReviewStatus: {
47
28
  fetchState: 'Not-Started',
48
29
  error: undefined,
49
30
  },
50
- groupsBySelectedPeriod: {},
51
- reviewOperatingExpenseIdsByPeriod: {},
52
- selectedSectionIdsByPeriod: {},
31
+ error: undefined,
32
+ fluxAnalysisReportGenerated: false,
33
+ reviewOperatingExpensesIds: [],
34
+ hasValidState() {
35
+ return this.fetchState == 'Completed';
36
+ },
53
37
  };
54
38
  const expenseAutomationFluxAnalysisView = (0, toolkit_1.createSlice)({
55
39
  name: 'expenseAutomationFluxAnalysisView',
@@ -57,45 +41,27 @@ const expenseAutomationFluxAnalysisView = (0, toolkit_1.createSlice)({
57
41
  reducers: {
58
42
  fetchFluxAnalysisView: {
59
43
  reducer(draft, action) {
60
- const { refreshViewInBackground, monthAndYear, resetListItems, fetchReimbursement, } = action.payload;
61
- const periodId = (0, timePeriod_1.toMonthYearPeriodId)(monthAndYear);
44
+ const { refreshViewInBackground, monthAndYear, resetListItems } = action.payload;
62
45
  if (refreshViewInBackground) {
63
46
  draft.refreshStatus = { fetchState: 'In-Progress', error: undefined };
64
47
  }
65
48
  else {
66
49
  draft.fetchState = 'In-Progress';
67
- const group = draft.groupsBySelectedPeriod[periodId];
68
- // Initialize group structure if it's the first fetch
69
- if (group == null) {
70
- draft.groupsBySelectedPeriod[periodId] = getInProgressGroup();
71
- }
72
- else {
73
- // Update fetch status based on fetchReimbursement
74
- const statusField = fetchReimbursement
75
- ? 'reimbursement'
76
- : 'generalExpense';
77
- group[statusField].fetchStatus = {
78
- fetchState: 'In-Progress',
79
- error: undefined,
80
- };
81
- }
82
- // Reset list if necessary
83
- if (resetListItems === true) {
84
- const statusField = fetchReimbursement
85
- ? 'reimbursement'
86
- : 'generalExpense';
87
- draft.groupsBySelectedPeriod[periodId][statusField].operatingExpenseIds = [];
88
- }
50
+ draft.error = undefined;
51
+ }
52
+ // Reset list when we change the sort order and fetch list again
53
+ if (resetListItems === true) {
54
+ draft.operatingExpenseIdsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(monthAndYear)] = [];
55
+ draft.reviewOperatingExpensesIds = [];
89
56
  }
90
57
  },
91
- prepare(monthAndYear, cacheOverride, refreshViewInBackground, pageToken, fetchReimbursement = false, keepExistingListItems, resetListItems) {
58
+ prepare(monthAndYear, cacheOverride, refreshViewInBackground, pageToken, keepExistingListItems, resetListItems) {
92
59
  return {
93
60
  payload: {
94
61
  monthAndYear,
95
62
  refreshViewInBackground,
96
63
  cacheOverride,
97
64
  pageToken,
98
- fetchReimbursement,
99
65
  keepExistingListItems,
100
66
  resetListItems,
101
67
  },
@@ -103,79 +69,72 @@ const expenseAutomationFluxAnalysisView = (0, toolkit_1.createSlice)({
103
69
  },
104
70
  },
105
71
  fetchFluxAnalysisViewSuccess(draft, action) {
106
- const { expensesPayload, selectedPeriod, keepExistingListItems, fetchReimbursement, currency, totalsPayload, } = action.payload;
107
- const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
108
- const group = draft.groupsBySelectedPeriod[periodId];
109
- const groupToBeFetched = fetchReimbursement
110
- ? group.reimbursement
111
- : group.generalExpense;
72
+ const { expensesPayload, selectedPeriod, keepExistingListItems, currency } = action.payload;
73
+ if (draft.fetchState === 'In-Progress') {
74
+ draft.fetchState = 'Completed';
75
+ draft.error = undefined;
76
+ }
77
+ else {
78
+ draft.refreshStatus = { fetchState: 'Completed', error: undefined };
79
+ }
80
+ draft.reviewStatusById = Object.assign(Object.assign({}, draft.reviewStatusById), toReviewStatusById(expensesPayload));
112
81
  const fluxOpExEntityIds = expensesPayload.map((expense) => expense.flux_analysis_entity_id);
113
- // Handle fetch completion
114
- handleFetchCompletion(draft, selectedPeriod, fetchReimbursement, groupToBeFetched);
115
- draft.fetchState = 'Completed';
116
- // Update flux analysis entities
117
- const allFluxAnalysisEntities = updateFluxAnalysisEntities(draft.fluxAnalysisEntities, expensesPayload, currency);
118
- // Update operating expense ids based on the "keepExistingListItems" flag
119
- updateOperatingExpenseIds(draft, selectedPeriod, groupToBeFetched, fluxOpExEntityIds, fetchReimbursement, keepExistingListItems);
120
- // Update total balances and variance if available
121
- if (totalsPayload != null) {
122
- updateTotals(draft, selectedPeriod, totalsPayload, currency);
82
+ if (keepExistingListItems === true) {
83
+ const allFluxAnalysisEntities = {
84
+ operatingExpenses: [
85
+ ...draft.fluxAnalysisEntities.operatingExpenses,
86
+ ...toFluxAnalysisOperatingExpenses(expensesPayload, currency),
87
+ ],
88
+ };
89
+ const allOperatingExpenseIdsBySelectedPeriod = [
90
+ ...draft.operatingExpenseIdsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)],
91
+ ...fluxOpExEntityIds,
92
+ ];
93
+ draft.fluxAnalysisEntities = allFluxAnalysisEntities;
94
+ draft.operatingExpenseIdsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = allOperatingExpenseIdsBySelectedPeriod;
95
+ }
96
+ else {
97
+ draft.operatingExpenseIdsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = fluxOpExEntityIds;
98
+ draft.fluxAnalysisEntities = {
99
+ operatingExpenses: [
100
+ ...toFluxAnalysisOperatingExpenses(expensesPayload, currency),
101
+ ...draft.fluxAnalysisEntities.operatingExpenses,
102
+ ],
103
+ };
123
104
  }
124
- // Set currency
125
- draft.currency = {
126
- currencyCode: currency.currency_code,
127
- currencySymbol: currency.currency_symbol,
128
- };
129
- // Reset review operating expenses ids for the period
130
- draft.reviewOperatingExpenseIdsByPeriod[periodId] = [];
131
- // Final update of flux analysis entities
132
- draft.fluxAnalysisEntities = allFluxAnalysisEntities;
133
105
  },
134
106
  updateFluxAnalysisViewPageMetaData(draft, action) {
135
- var _a, _b, _c, _d, _e, _f, _g, _h;
136
- draft.uiState = Object.assign(Object.assign({}, draft.uiState), { paginationInfoByGroup: {
137
- generalExpense: action.payload.fetchReimbursement === true
138
- ? draft.uiState.paginationInfoByGroup.generalExpense
139
- : Object.assign(Object.assign({}, draft.uiState.paginationInfoByGroup.generalExpense), { pageToken: (_b = (_a = action.payload.pageMetaData) === null || _a === void 0 ? void 0 : _a.next_page_token) !== null && _b !== void 0 ? _b : null, hasMore: (_d = (_c = action.payload.pageMetaData) === null || _c === void 0 ? void 0 : _c.is_more_data_to_load) !== null && _d !== void 0 ? _d : true }),
140
- reimbursement: action.payload.fetchReimbursement === false
141
- ? draft.uiState.paginationInfoByGroup.reimbursement
142
- : Object.assign(Object.assign({}, draft.uiState.paginationInfoByGroup.reimbursement), { pageToken: (_f = (_e = action.payload.pageMetaData) === null || _e === void 0 ? void 0 : _e.next_page_token) !== null && _f !== void 0 ? _f : null, hasMore: (_h = (_g = action.payload.pageMetaData) === null || _g === void 0 ? void 0 : _g.is_more_data_to_load) !== null && _h !== void 0 ? _h : true }),
143
- } });
107
+ var _a, _b, _c, _d;
108
+ draft.uiState = Object.assign(Object.assign({}, draft.uiState), { pageToken: (_b = (_a = action.payload.pageMetaData) === null || _a === void 0 ? void 0 : _a.next_page_token) !== null && _b !== void 0 ? _b : null, hasMore: (_d = (_c = action.payload.pageMetaData) === null || _c === void 0 ? void 0 : _c.is_more_data_to_load) !== null && _d !== void 0 ? _d : true });
144
109
  },
145
110
  fetchFluxAnalysisViewFailure(draft, action) {
146
- var _a, _b;
147
- const { status, fetchReimbursement, selectedPeriod } = action.payload;
148
- const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
149
- if (fetchReimbursement) {
150
- updateFetchFailureStatus(draft, selectedPeriod, 'reimbursement', status);
111
+ const { status, selectedPeriod } = action.payload;
112
+ draft.operatingExpenseIdsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = [];
113
+ if (draft.fetchState === 'In-Progress') {
114
+ draft.fetchState = 'Error';
115
+ draft.error = status;
151
116
  }
152
117
  else {
153
- const generalExpenseStatus = (_b = (_a = draft.groupsBySelectedPeriod[periodId]) === null || _a === void 0 ? void 0 : _a.generalExpense) === null || _b === void 0 ? void 0 : _b.fetchStatus.fetchState;
154
- if (generalExpenseStatus === 'In-Progress') {
155
- updateFetchFailureStatus(draft, selectedPeriod, 'generalExpense', status);
156
- }
157
- else {
158
- draft.refreshStatus = { fetchState: 'Error', error: status };
159
- }
118
+ draft.refreshStatus = { fetchState: 'Error', error: status };
160
119
  }
161
- draft.fetchState = 'Error';
162
- draft.error = status;
163
- },
164
- // This action updates the sections ids whenever a section is bulk selected
165
- updateSelectedSectionIdsForReview(draft, action) {
166
- const { sectionId, selectedPeriod } = action.payload;
167
- draft.selectedSectionIdsByPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] =
168
- sectionId;
169
120
  },
170
121
  updateOperatingExpensesIdsForReview(draft, action) {
171
- const { operatingExpenseIds, selectedPeriod } = action.payload;
172
- draft.reviewOperatingExpenseIdsByPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = operatingExpenseIds;
122
+ const { operatingExpenseIds } = action.payload;
123
+ draft.reviewOperatingExpensesIds = operatingExpenseIds;
173
124
  },
174
125
  reviewFluxAnalysisView: {
175
- reducer(draft) {
176
- draft.bulkReviewStatus = {
177
- fetchState: 'In-Progress',
178
- };
126
+ reducer(draft, action) {
127
+ const { operatingExpenseIds, isBulk } = action.payload;
128
+ operatingExpenseIds.forEach((id) => {
129
+ draft.reviewStatusById[id] = {
130
+ fetchState: 'In-Progress',
131
+ };
132
+ });
133
+ if (isBulk === true) {
134
+ draft.bulkReviewStatus = {
135
+ fetchState: 'In-Progress',
136
+ };
137
+ }
179
138
  },
180
139
  prepare(actionType, operatingExpenseIds, selectedPeriod, isBulk) {
181
140
  return {
@@ -184,32 +143,41 @@ const expenseAutomationFluxAnalysisView = (0, toolkit_1.createSlice)({
184
143
  },
185
144
  },
186
145
  reviewFluxAnalysisViewSuccess(draft, action) {
187
- const { expensesPayload, currency, selectedPeriod } = action.payload;
188
- const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
189
- // Create a map of flux entity IDs to be removed for efficiency
190
- const fluxEntitiesToRemove = new Set(expensesPayload.map((opExPayload) => opExPayload.flux_analysis_entity_id));
191
- // Generate updated flux entities
192
- const updatedFluxEntities = [
193
- ...draft.fluxAnalysisEntities.operatingExpenses.filter((fluxEntity) => !fluxEntitiesToRemove.has(fluxEntity.fluxAnalysisEntityId)),
194
- ...expensesPayload.map((opExPayload) => toFluxAnalysisOperatingExpense(opExPayload, currency)),
195
- ];
196
- // Update the draft with the new list of operating expenses
146
+ const { expensesPayload, currency, isBulk } = action.payload;
147
+ let updatedFluxEntities = draft.fluxAnalysisEntities.operatingExpenses;
148
+ expensesPayload.forEach((opExPayload) => {
149
+ draft.reviewStatusById[opExPayload.flux_analysis_entity_id] = {
150
+ fetchState: 'Completed',
151
+ };
152
+ const fluxEntity = toFluxAnalysisOperatingExpense(opExPayload, currency);
153
+ updatedFluxEntities = updatedFluxEntities.filter((fluxEntity) => fluxEntity.operatingExpenseId !==
154
+ opExPayload.flux_analysis_entity_id);
155
+ updatedFluxEntities.push(fluxEntity);
156
+ });
197
157
  draft.fluxAnalysisEntities = {
198
158
  operatingExpenses: updatedFluxEntities,
199
159
  };
200
- // Reset the review state
201
- draft.reviewOperatingExpenseIdsByPeriod[periodId] = [];
202
- draft.selectedSectionIdsByPeriod[periodId] = [];
203
- draft.bulkReviewStatus = {
204
- fetchState: 'Completed',
205
- };
160
+ draft.reviewOperatingExpensesIds = [];
161
+ if (isBulk === true) {
162
+ draft.bulkReviewStatus = {
163
+ fetchState: 'Completed',
164
+ };
165
+ }
206
166
  },
207
167
  reviewFluxAnalysisViewFailure(draft, action) {
208
- const { status } = action.payload;
209
- draft.bulkReviewStatus = {
210
- fetchState: 'Error',
211
- error: status,
212
- };
168
+ const { operatingExpenseIds, status, isBulk } = action.payload;
169
+ operatingExpenseIds.forEach((id) => {
170
+ if (draft.reviewStatusById[id].fetchState === 'In-Progress') {
171
+ draft.reviewStatusById[id].fetchState = 'Error';
172
+ draft.reviewStatusById[id].error = status;
173
+ }
174
+ });
175
+ if (isBulk === true) {
176
+ draft.bulkReviewStatus = {
177
+ fetchState: 'Error',
178
+ error: status,
179
+ };
180
+ }
213
181
  },
214
182
  updateFluxAnalysisViewUIState(draft, action) {
215
183
  if (action.payload.sortKey != null) {
@@ -224,9 +192,6 @@ const expenseAutomationFluxAnalysisView = (0, toolkit_1.createSlice)({
224
192
  if (action.payload.scrollPosition != null) {
225
193
  draft.uiState.scrollPosition = action.payload.scrollPosition;
226
194
  }
227
- if (action.payload.collapsableStatus != null) {
228
- draft.uiState.collapsableStatus = action.payload.collapsableStatus;
229
- }
230
195
  },
231
196
  clearExpenseAutomationFluxAnalysisView(draft) {
232
197
  Object.assign(draft, exports.initialState);
@@ -243,9 +208,10 @@ const toFluxAnalysisOperatingExpenses = (operatingExpensesPayload, currency) =>
243
208
  const toFluxAnalysisOperatingExpense = (operatingExpensePayload, currency) => {
244
209
  var _a;
245
210
  return {
246
- fluxAnalysisEntityId: operatingExpensePayload.flux_analysis_entity_id,
211
+ operatingExpenseId: operatingExpensePayload.flux_analysis_entity_id,
247
212
  vendorId: operatingExpensePayload.vendor_id,
248
- vendorAccountsAndClasses: toVendorAccountsAndClasses(operatingExpensePayload.category_and_class_json, currency),
213
+ accountId: operatingExpensePayload.account_id,
214
+ classId: operatingExpensePayload.accounting_class_id,
249
215
  userId: (_a = operatingExpensePayload.reviewed_by_user_id) !== null && _a !== void 0 ? _a : undefined,
250
216
  varianceAmount: operatingExpensePayload.variance_amount,
251
217
  variancePercentage: operatingExpensePayload.variance_percentage,
@@ -258,111 +224,15 @@ const toFluxAnalysisOperatingExpense = (operatingExpensePayload, currency) => {
258
224
  balancesByMonth: (0, helpers_1.toBalancesByMonthFromPayload)(operatingExpensePayload.month_1, operatingExpensePayload.month_2, currency),
259
225
  };
260
226
  };
261
- const toVendorAccountsAndClasses = (accountAndClassJSON, currency) => {
262
- return accountAndClassJSON.map((accountAndClass) => {
263
- return {
264
- varianceAmount: accountAndClass.variance_amount,
265
- variancePercentage: accountAndClass.variance_percentage,
266
- accountId: accountAndClass.account_id,
267
- classId: accountAndClass.accounting_class_id,
268
- balancesByMonth: (0, helpers_1.toBalancesByMonthFromPayload)(accountAndClass.month_1, accountAndClass.month_2, currency),
269
- };
270
- });
271
- };
272
- const getInProgressGroup = () => {
273
- return {
274
- generalExpense: {
275
- fetchStatus: {
276
- fetchState: 'In-Progress',
277
- error: undefined,
278
- },
279
- operatingExpenseIds: [],
280
- total: undefined,
281
- },
282
- reimbursement: {
283
- fetchStatus: { fetchState: 'Not-Started', error: undefined },
284
- operatingExpenseIds: [],
285
- total: undefined,
286
- },
287
- };
288
- };
289
- // Helper function to handle the fetch completion
290
- const handleFetchCompletion = (draft, selectedPeriod, fetchReimbursement, groupToBeFetched) => {
291
- const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
292
- if (fetchReimbursement) {
293
- draft.groupsBySelectedPeriod[periodId].reimbursement.fetchStatus = {
294
- fetchState: 'Completed',
295
- error: undefined,
296
- };
297
- }
298
- else if (groupToBeFetched.fetchStatus.fetchState === 'In-Progress') {
299
- draft.groupsBySelectedPeriod[periodId].generalExpense.fetchStatus = {
300
- fetchState: 'Completed',
227
+ const toReviewStatusById = (operatingExpenses) => {
228
+ const reviewStatusById = {};
229
+ operatingExpenses.forEach((operatingExpense) => {
230
+ reviewStatusById[operatingExpense.flux_analysis_entity_id] = {
231
+ fetchState: 'Not-Started',
301
232
  error: undefined,
302
233
  };
303
- }
304
- else {
305
- draft.refreshStatus = { fetchState: 'Completed', error: undefined };
306
- }
307
- };
308
- // Helper function to update flux analysis entities
309
- const updateFluxAnalysisEntities = (existingEntities, expensesPayload, currency) => {
310
- const incomingExpenses = toFluxAnalysisOperatingExpenses(expensesPayload, currency);
311
- // Combine existing and incoming expenses, prioritizing incoming
312
- const allExpenses = [
313
- ...existingEntities.operatingExpenses,
314
- ...incomingExpenses,
315
- ];
316
- // Use a Map to deduplicate by fluxAnalysisEntityId, keeping the latest (incoming) entry
317
- const expensesMap = new Map();
318
- allExpenses.forEach((expense) => {
319
- expensesMap.set(expense.fluxAnalysisEntityId, expense);
320
234
  });
321
- return { operatingExpenses: Array.from(expensesMap.values()) };
322
- };
323
- // Helper function to update operating expense ids
324
- const updateOperatingExpenseIds = (draft, selectedPeriod, groupToBeFetched, fluxOpExEntityIds, fetchReimbursement, keepExistingListItems) => {
325
- const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
326
- const updatedOperatingExpenseIds = keepExistingListItems === true
327
- ? Array.from(new Set([
328
- ...groupToBeFetched.operatingExpenseIds,
329
- ...fluxOpExEntityIds,
330
- ]))
331
- : fluxOpExEntityIds;
332
- if (fetchReimbursement) {
333
- draft.groupsBySelectedPeriod[periodId].reimbursement.operatingExpenseIds =
334
- updatedOperatingExpenseIds;
335
- }
336
- else {
337
- draft.groupsBySelectedPeriod[periodId].generalExpense.operatingExpenseIds =
338
- updatedOperatingExpenseIds;
339
- }
340
- };
341
- // Helper function to update totals
342
- const updateTotals = (draft, selectedPeriod, totalsPayload, currency) => {
343
- const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
344
- draft.totalBalancesAndVariance = {
345
- balancesByMonth: (0, helpers_1.toBalancesByMonthFromPayload)(totalsPayload.total.month_1, totalsPayload.total.month_2, currency),
346
- varianceAmount: totalsPayload.total.variance_amount,
347
- variancePercentage: totalsPayload.total.variance_percentage,
348
- };
349
- draft.groupsBySelectedPeriod[periodId].generalExpense.total = {
350
- balancesByMonth: (0, helpers_1.toBalancesByMonthFromPayload)(totalsPayload.general_expenses.month_1, totalsPayload.general_expenses.month_2, currency),
351
- varianceAmount: totalsPayload.general_expenses.variance_amount,
352
- variancePercentage: totalsPayload.general_expenses.variance_percentage,
353
- };
354
- draft.groupsBySelectedPeriod[periodId].reimbursement.total = {
355
- balancesByMonth: (0, helpers_1.toBalancesByMonthFromPayload)(totalsPayload.reimbursement.month_1, totalsPayload.reimbursement.month_2, currency),
356
- varianceAmount: totalsPayload.reimbursement.variance_amount,
357
- variancePercentage: totalsPayload.reimbursement.variance_percentage,
358
- };
359
- };
360
- // Helper function to update the fetch failure status for a group
361
- const updateFetchFailureStatus = (draft, selectedPeriod, groupType, status) => {
362
- const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
363
- const group = draft.groupsBySelectedPeriod[periodId][groupType];
364
- group.operatingExpenseIds = [];
365
- group.fetchStatus = { fetchState: 'Error', error: status };
235
+ return reviewStatusById;
366
236
  };
367
- _a = expenseAutomationFluxAnalysisView.actions, exports.fetchFluxAnalysisView = _a.fetchFluxAnalysisView, exports.fetchFluxAnalysisViewSuccess = _a.fetchFluxAnalysisViewSuccess, exports.fetchFluxAnalysisViewFailure = _a.fetchFluxAnalysisViewFailure, exports.clearExpenseAutomationFluxAnalysisView = _a.clearExpenseAutomationFluxAnalysisView, exports.updateOperatingExpensesIdsForReview = _a.updateOperatingExpensesIdsForReview, exports.reviewFluxAnalysisView = _a.reviewFluxAnalysisView, exports.reviewFluxAnalysisViewSuccess = _a.reviewFluxAnalysisViewSuccess, exports.reviewFluxAnalysisViewFailure = _a.reviewFluxAnalysisViewFailure, exports.updateFluxAnalysisViewUIState = _a.updateFluxAnalysisViewUIState, exports.updateFluxAnalysisViewPageMetaData = _a.updateFluxAnalysisViewPageMetaData, exports.updateSelectedSectionIdsForReview = _a.updateSelectedSectionIdsForReview;
237
+ _a = expenseAutomationFluxAnalysisView.actions, exports.fetchFluxAnalysisView = _a.fetchFluxAnalysisView, exports.fetchFluxAnalysisViewSuccess = _a.fetchFluxAnalysisViewSuccess, exports.fetchFluxAnalysisViewFailure = _a.fetchFluxAnalysisViewFailure, exports.clearExpenseAutomationFluxAnalysisView = _a.clearExpenseAutomationFluxAnalysisView, exports.updateOperatingExpensesIdsForReview = _a.updateOperatingExpensesIdsForReview, exports.reviewFluxAnalysisView = _a.reviewFluxAnalysisView, exports.reviewFluxAnalysisViewSuccess = _a.reviewFluxAnalysisViewSuccess, exports.reviewFluxAnalysisViewFailure = _a.reviewFluxAnalysisViewFailure, exports.updateFluxAnalysisViewUIState = _a.updateFluxAnalysisViewUIState, exports.updateFluxAnalysisViewPageMetaData = _a.updateFluxAnalysisViewPageMetaData;
368
238
  exports.default = expenseAutomationFluxAnalysisView.reducer;
@@ -64,13 +64,13 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
64
64
  }, "expenseAutomationTransactionsView/updateTransactionCategorizationSaveStatus", never, never>, markTransactionAsNotMiscategorized: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionsInReview: UpdateTransactionCategorizationResponsePayload], {
65
65
  selectedTab: "review" | "autoCategorized";
66
66
  transactionsInReview: UpdateTransactionCategorizationResponsePayload;
67
- }, "expenseAutomationTransactionsView/markTransactionAsNotMiscategorized", never, never>, updateStatusForTransactionNotMiscategorizedUpdateForCategorization: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionIds: string[], selectedPeriod: MonthYearPeriod, fetchState: FetchState, error?: ZeniAPIStatus<Record<string, unknown>> | undefined], {
67
+ }, "expenseAutomationTransactionsView/markTransactionAsNotMiscategorized", never, never>, updateStatusForTransactionNotMiscategorizedUpdate: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionIds: string[], selectedPeriod: MonthYearPeriod, fetchState: FetchState, error?: ZeniAPIStatus<Record<string, unknown>> | undefined], {
68
68
  selectedPeriod: MonthYearPeriod;
69
69
  transactionIds: string[];
70
70
  selectedTab: "review" | "autoCategorized";
71
71
  fetchState: FetchState;
72
72
  error: ZeniAPIStatus<Record<string, unknown>> | undefined;
73
- }, "expenseAutomationTransactionsView/updateStatusForTransactionNotMiscategorizedUpdateForCategorization", never, never>, updateSelectedVendorForTransaction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
73
+ }, "expenseAutomationTransactionsView/updateStatusForTransactionNotMiscategorizedUpdate", never, never>, updateSelectedVendorForTransaction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
74
74
  selectedTab: TransactionsTab;
75
75
  transactionId: ID;
76
76
  lineId: ID;
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  var _a;
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.updateSelectedTransactionId = exports.setEntityRecommendationForLineIdsForCategorization = exports.clearExpenseAutomationTransactionsView = exports.clearExpenseAutomationTransactionsViewPerTabView = exports.updateSelectedCheckboxTransactionIds = exports.fetchTransactionCategorizationView = exports.fetchTransactionCategorizationSuccess = exports.updateTotalCountForTransactionCategorization = exports.setAllItemsToCategoryClassInLocalDataForCategorization = exports.updateSelectedCustomerForTransaction = exports.updateSelectedVendorForTransaction = exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = exports.markTransactionAsNotMiscategorized = exports.updateTransactionCategorizationSaveStatus = exports.updateCurrentSelectedTransactionCategorizationTab = exports.updateTransactionCategorization = exports.saveTransactionCategorization = exports.fetchTransactionCategorizationFailure = exports.saveTransactionCategorizationLocalData = exports.initializeTransactionCategorizationViewLocalData = exports.updateTransactionCategorizationUIState = exports.fetchTransactionCategorization = exports.initialState = exports.initialTransactionTabViewState = void 0;
7
+ exports.updateSelectedTransactionId = exports.setEntityRecommendationForLineIdsForCategorization = exports.clearExpenseAutomationTransactionsView = exports.clearExpenseAutomationTransactionsViewPerTabView = exports.updateSelectedCheckboxTransactionIds = exports.fetchTransactionCategorizationView = exports.fetchTransactionCategorizationSuccess = exports.updateTotalCountForTransactionCategorization = exports.setAllItemsToCategoryClassInLocalDataForCategorization = exports.updateSelectedCustomerForTransaction = exports.updateSelectedVendorForTransaction = exports.updateStatusForTransactionNotMiscategorizedUpdate = exports.markTransactionAsNotMiscategorized = exports.updateTransactionCategorizationSaveStatus = exports.updateCurrentSelectedTransactionCategorizationTab = exports.updateTransactionCategorization = exports.saveTransactionCategorization = exports.fetchTransactionCategorizationFailure = exports.saveTransactionCategorizationLocalData = exports.initializeTransactionCategorizationViewLocalData = exports.updateTransactionCategorizationUIState = exports.fetchTransactionCategorization = exports.initialState = exports.initialTransactionTabViewState = void 0;
8
8
  const toolkit_1 = require("@reduxjs/toolkit");
9
9
  const get_1 = __importDefault(require("lodash/get"));
10
10
  const uniq_1 = __importDefault(require("lodash/uniq"));
@@ -90,6 +90,14 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
90
90
  'In-Progress';
91
91
  draft.transactionCategorizationView[selectedTab].error = undefined;
92
92
  }
93
+ // Note: Need to reset scroll position whenever a new fetch happens, except when fetching through scroll
94
+ if (pageToken == null) {
95
+ // Page Token is null in each fetch except when fetching through scroll
96
+ draft.transactionCategorizationView[selectedTab].uiState.scrollPosition = {
97
+ scrollTop: 0,
98
+ scrollLeft: undefined,
99
+ };
100
+ }
93
101
  draft.transactionCategorizationView[selectedTab].uiState.pageToken =
94
102
  pageToken !== null && pageToken !== void 0 ? pageToken : null;
95
103
  draft.transactionCategorizationView[selectedTab].uiState.searchString =
@@ -338,20 +346,18 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
338
346
  },
339
347
  },
340
348
  fetchTransactionCategorizationSuccess(draft, action) {
341
- const { selectedTab, refreshViewInBackground } = action.payload;
342
- if (draft.transactionCategorizationView[selectedTab].fetchState ===
343
- 'In-Progress' ||
344
- refreshViewInBackground !== true) {
345
- draft.transactionCategorizationView[selectedTab].fetchState =
346
- 'Completed';
347
- draft.transactionCategorizationView[selectedTab].error = undefined;
348
- }
349
- else {
349
+ const { selectedTab } = action.payload;
350
+ if (action.payload.refreshViewInBackground === true) {
350
351
  draft.transactionCategorizationView[selectedTab].refreshStatus = {
351
352
  fetchState: 'Completed',
352
353
  error: undefined,
353
354
  };
354
355
  }
356
+ else {
357
+ draft.transactionCategorizationView[selectedTab].fetchState =
358
+ 'Completed';
359
+ draft.transactionCategorizationView[selectedTab].error = undefined;
360
+ }
355
361
  },
356
362
  fetchTransactionCategorizationFailure(draft, action) {
357
363
  const { selectedTab, selectedPeriod } = action.payload;
@@ -506,7 +512,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
506
512
  };
507
513
  },
508
514
  },
509
- updateStatusForTransactionNotMiscategorizedUpdateForCategorization: {
515
+ updateStatusForTransactionNotMiscategorizedUpdate: {
510
516
  reducer(draft, action) {
511
517
  const { selectedTab, selectedPeriod, transactionIds } = action.payload;
512
518
  if (action.payload.fetchState === 'Completed') {
@@ -555,5 +561,5 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
555
561
  },
556
562
  },
557
563
  });
558
- _a = expenseAutomationTransactionsView.actions, exports.fetchTransactionCategorization = _a.fetchTransactionCategorization, exports.updateTransactionCategorizationUIState = _a.updateTransactionCategorizationUIState, exports.initializeTransactionCategorizationViewLocalData = _a.initializeTransactionCategorizationViewLocalData, exports.saveTransactionCategorizationLocalData = _a.saveTransactionCategorizationLocalData, exports.fetchTransactionCategorizationFailure = _a.fetchTransactionCategorizationFailure, exports.saveTransactionCategorization = _a.saveTransactionCategorization, exports.updateTransactionCategorization = _a.updateTransactionCategorization, exports.updateCurrentSelectedTransactionCategorizationTab = _a.updateCurrentSelectedTransactionCategorizationTab, exports.updateTransactionCategorizationSaveStatus = _a.updateTransactionCategorizationSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = _a.updateStatusForTransactionNotMiscategorizedUpdateForCategorization, exports.updateSelectedVendorForTransaction = _a.updateSelectedVendorForTransaction, exports.updateSelectedCustomerForTransaction = _a.updateSelectedCustomerForTransaction, exports.setAllItemsToCategoryClassInLocalDataForCategorization = _a.setAllItemsToCategoryClassInLocalDataForCategorization, exports.updateTotalCountForTransactionCategorization = _a.updateTotalCountForTransactionCategorization, exports.fetchTransactionCategorizationSuccess = _a.fetchTransactionCategorizationSuccess, exports.fetchTransactionCategorizationView = _a.fetchTransactionCategorizationView, exports.updateSelectedCheckboxTransactionIds = _a.updateSelectedCheckboxTransactionIds, exports.clearExpenseAutomationTransactionsViewPerTabView = _a.clearExpenseAutomationTransactionsViewPerTabView, exports.clearExpenseAutomationTransactionsView = _a.clearExpenseAutomationTransactionsView, exports.setEntityRecommendationForLineIdsForCategorization = _a.setEntityRecommendationForLineIdsForCategorization, exports.updateSelectedTransactionId = _a.updateSelectedTransactionId;
564
+ _a = expenseAutomationTransactionsView.actions, exports.fetchTransactionCategorization = _a.fetchTransactionCategorization, exports.updateTransactionCategorizationUIState = _a.updateTransactionCategorizationUIState, exports.initializeTransactionCategorizationViewLocalData = _a.initializeTransactionCategorizationViewLocalData, exports.saveTransactionCategorizationLocalData = _a.saveTransactionCategorizationLocalData, exports.fetchTransactionCategorizationFailure = _a.fetchTransactionCategorizationFailure, exports.saveTransactionCategorization = _a.saveTransactionCategorization, exports.updateTransactionCategorization = _a.updateTransactionCategorization, exports.updateCurrentSelectedTransactionCategorizationTab = _a.updateCurrentSelectedTransactionCategorizationTab, exports.updateTransactionCategorizationSaveStatus = _a.updateTransactionCategorizationSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.updateStatusForTransactionNotMiscategorizedUpdate = _a.updateStatusForTransactionNotMiscategorizedUpdate, exports.updateSelectedVendorForTransaction = _a.updateSelectedVendorForTransaction, exports.updateSelectedCustomerForTransaction = _a.updateSelectedCustomerForTransaction, exports.setAllItemsToCategoryClassInLocalDataForCategorization = _a.setAllItemsToCategoryClassInLocalDataForCategorization, exports.updateTotalCountForTransactionCategorization = _a.updateTotalCountForTransactionCategorization, exports.fetchTransactionCategorizationSuccess = _a.fetchTransactionCategorizationSuccess, exports.fetchTransactionCategorizationView = _a.fetchTransactionCategorizationView, exports.updateSelectedCheckboxTransactionIds = _a.updateSelectedCheckboxTransactionIds, exports.clearExpenseAutomationTransactionsViewPerTabView = _a.clearExpenseAutomationTransactionsViewPerTabView, exports.clearExpenseAutomationTransactionsView = _a.clearExpenseAutomationTransactionsView, exports.setEntityRecommendationForLineIdsForCategorization = _a.setEntityRecommendationForLineIdsForCategorization, exports.updateSelectedTransactionId = _a.updateSelectedTransactionId;
559
565
  exports.default = expenseAutomationTransactionsView.reducer;
@@ -5,48 +5,28 @@ import { ClassBase } from '../../../entity/class/classState';
5
5
  import { User } from '../../../entity/user/userState';
6
6
  import { Vendor } from '../../../entity/vendor/vendorState';
7
7
  import { ZeniDate } from '../../../zeniDayJS';
8
- import { BalancesAndVariance, FluxAnalysisReviewStatus, FluxAnalysisViewUIState, FluxBalancesByMonth } from '../types/fluxAnalysisViewState';
9
- export interface FluxVendorAccountsAndClassesView {
10
- varianceAmount: number;
11
- variancePercentage: number;
8
+ import { FluxAnalysisReviewStatus, FluxAnalysisViewUIState, FluxBalancesByMonth } from '../types/fluxAnalysisViewState';
9
+ export interface FluxAnalysisOperatingExpenseView {
10
+ operatingExpenseId: ID;
11
+ vendor: Vendor;
12
12
  accountBase: AccountBase | undefined;
13
13
  classBase: ClassBase | undefined;
14
- currency: Currency;
15
- balancesByMonth?: FluxBalancesByMonth;
16
- }
17
- export interface FluxAnalysisOperatingExpenseView extends BalancesAndVariance {
18
- fluxAnalysisEntityId: ID;
19
- vendorAccountsAndClasses: FluxVendorAccountsAndClassesView[];
20
- reviewedByUser: User | undefined;
21
- currency: Currency;
22
- anomalyReason: string;
23
- status: FluxAnalysisReviewStatus;
24
- }
25
- export interface FluxAnalysisVendorView extends BalancesAndVariance {
26
- fluxAnalysisEntityId: ID;
27
- vendor: Vendor;
28
14
  reviewedByUser: User | undefined;
15
+ varianceAmount: number;
16
+ variancePercentage: number;
29
17
  currency: Currency;
30
18
  anomalyReason: string;
31
19
  status: FluxAnalysisReviewStatus;
32
- vendorAccountsAndClasses: FluxVendorAccountsAndClassesView[];
33
- }
34
- export interface FluxAnalysisViewSectionReport extends BalancesAndVariance {
35
- sectionId: FluxAnalysisSectionType;
36
- vendors: FluxAnalysisVendorView[];
37
- fetchStatus: FetchStateAndError;
20
+ balancesByMonth?: FluxBalancesByMonth;
21
+ reviewStatus: FetchStateAndError;
38
22
  }
39
- export type FluxAnalysisSectionType = 'generalExpense' | 'reimbursement';
40
23
  export interface ExpenseAutomationFluxAnalysisViewSelector {
41
- sections: Record<FluxAnalysisSectionType, FluxAnalysisViewSectionReport>;
42
- totalBalancesAndVariance: BalancesAndVariance | undefined;
24
+ operatingExpensesView: FluxAnalysisOperatingExpenseView[];
43
25
  reviewOperatingExpensesIds: ID[];
44
- selectedSectionIds: FluxAnalysisSectionType[];
45
26
  fetchStatus: FetchStateAndError;
46
27
  refreshStatus: FetchStateAndError;
47
28
  bulkReviewStatus: FetchStateAndError;
48
29
  uiState: FluxAnalysisViewUIState;
49
- currency: Currency;
50
30
  lastRefreshSuccessTime?: ZeniDate;
51
31
  completionStatus: CompletionStatusType;
52
32
  }