@zeniai/client-epic-state 4.15.36 → 4.15.37

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 (178) hide show
  1. package/lib/commonPayloadTypes/recommendationPayload.d.ts +0 -1
  2. package/lib/commonStateTypes/timePeriod.d.ts +1 -1
  3. package/lib/commonStateTypes/timePeriod.js +2 -2
  4. package/lib/commonStateTypes/viewAndReport/agingReportStateTypes.js +1 -1
  5. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  6. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +0 -1
  7. package/lib/configureStore.js +1 -2
  8. package/lib/entity/account/accountState.d.ts +1 -1
  9. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  10. package/lib/entity/class/classReducer.d.ts +4 -4
  11. package/lib/entity/class/classState.d.ts +1 -1
  12. package/lib/entity/company/companyReducer.js +1 -0
  13. package/lib/entity/customer/customerPayload.d.ts +1 -1
  14. package/lib/entity/customer/customerPayload.js +6 -16
  15. package/lib/entity/forecast/forecastState.d.ts +1 -1
  16. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  17. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  18. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  19. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  20. package/lib/entity/snackbar/snackbarTypes.js +0 -4
  21. package/lib/entity/task/taskState.d.ts +1 -1
  22. package/lib/entity/tenant/clearAllEpic.d.ts +2 -4
  23. package/lib/entity/tenant/clearAllEpic.js +0 -4
  24. package/lib/entity/tenant/tenantReducer.js +1 -0
  25. package/lib/entity/transaction/payloadTypes/customerTransactionPayload.d.ts +1 -1
  26. package/lib/entity/transaction/payloadTypes/customerTransactionPayload.js +2 -1
  27. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +0 -2
  28. package/lib/entity/transaction/payloadTypes/transactionPayload.js +6 -9
  29. package/lib/entity/transaction/payloadTypes/vendorTransactionPayload.d.ts +1 -9
  30. package/lib/entity/transaction/payloadTypes/vendorTransactionPayload.js +2 -23
  31. package/lib/entity/transaction/stateTypes/transaction.d.ts +1 -3
  32. package/lib/entity/transaction/stateTypes/transactionType.d.ts +1 -1
  33. package/lib/entity/transaction/stateTypes/transactionType.js +1 -1
  34. package/lib/entity/transaction/stateTypes/vendorTransaction.d.ts +0 -5
  35. package/lib/entity/transaction/stateTypes/vendorTransaction.js +1 -5
  36. package/lib/entity/transaction/toSupportedTransaction.js +1 -6
  37. package/lib/entity/transaction/transactionReducer.d.ts +0 -17
  38. package/lib/entity/transaction/transactionReducer.js +2 -47
  39. package/lib/entity/transaction/transactionSelector.d.ts +0 -2
  40. package/lib/entity/transaction/transactionSelector.js +0 -5
  41. package/lib/entity/transaction/transactionState.d.ts +4 -6
  42. package/lib/entity/vendorExpense/vendorExpenseReducer.js +1 -0
  43. package/lib/entity/vendorExpense/vendorExpenseSelector.d.ts +2 -2
  44. package/lib/epic.d.ts +1 -6
  45. package/lib/epic.js +1 -6
  46. package/lib/index.d.ts +12 -20
  47. package/lib/index.js +27 -56
  48. package/lib/init.d.ts +1 -2
  49. package/lib/init.js +2 -9
  50. package/lib/reducer.d.ts +1 -7
  51. package/lib/reducer.js +0 -6
  52. package/lib/view/accountList/accountListReducer.js +3 -1
  53. package/lib/view/accountMappingView/accountMappingReducer.js +1 -0
  54. package/lib/view/apAgingView/apAgingDetail/apAgingDetailReducer.js +2 -1
  55. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  56. package/lib/view/balanceSheet/balanceSheetReducer.js +6 -1
  57. package/lib/view/bankAccountView/bankAccountViewReducer.js +1 -0
  58. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  59. package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
  60. package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
  61. package/lib/view/cashFlow/cashFlowReducer.js +4 -1
  62. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  63. package/lib/view/cashPosition/cashPositionReducer.js +1 -0
  64. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  65. package/lib/view/commonVendorView/vendorView/epics/fetchAndUpdateVendorRecommendationsEpic.js +3 -1
  66. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.d.ts +2 -2
  67. package/lib/view/companyView/companyViewReducer.js +10 -1
  68. package/lib/view/dashboard/dashboardEpic.js +2 -0
  69. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  70. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +1 -2
  71. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +10 -24
  72. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +1 -2
  73. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +0 -14
  74. package/lib/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +5 -32
  75. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.d.ts +2 -2
  76. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.js +5 -1
  77. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +2 -17
  78. package/lib/view/expenseAutomationView/expenseAutomationViewState.d.ts +2 -2
  79. package/lib/view/expenseAutomationView/expenseAutomationViewState.js +1 -1
  80. package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +35 -111
  81. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  82. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +10 -84
  83. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +1 -12
  84. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +7 -66
  85. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +0 -2
  86. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.js +1 -1
  87. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +0 -10
  88. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  89. package/lib/view/financeStatement/financeStatementReducer.js +4 -1
  90. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  91. package/lib/view/netBurnOrIncome/netBurnOrIncomeReducer.js +10 -3
  92. package/lib/view/netBurnOrIncomeClassesView/netBurnOrIncomeClassesViewReducer.js +6 -1
  93. package/lib/view/netBurnOrIncomeStoryCard/netBurnOrIncomeStoryCardReducer.js +1 -0
  94. package/lib/view/onboardingView/cockpitView/onboardingCockpitViewReducer.js +3 -0
  95. package/lib/view/opEx/opExForTimeFrameEpic.js +1 -1
  96. package/lib/view/opEx/opExReducer.js +14 -4
  97. package/lib/view/opExByVendor/opExByVendorReducer.js +3 -1
  98. package/lib/view/opExClassesView/opExClassesViewReducer.js +6 -1
  99. package/lib/view/people/fetchPeopleEpic.js +3 -1
  100. package/lib/view/people/invitePeopleEpic.js +3 -1
  101. package/lib/view/people/inviteZeniPeopleEpic.js +3 -1
  102. package/lib/view/people/peopleReducer.js +1 -0
  103. package/lib/view/people/peopleSaveUpdatesEpic.js +1 -1
  104. package/lib/view/profitAndLoss/profitAndLossReducer.js +6 -1
  105. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +6 -1
  106. package/lib/view/recommendation/recommendationReducer.js +4 -1
  107. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  108. package/lib/view/reportUIOptions/updateReportUIOptionThisPeriodEpic.js +3 -1
  109. package/lib/view/revenue/revenueReducer.js +10 -3
  110. package/lib/view/revenueClassesView/revenueClassesViewReducer.js +6 -1
  111. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  112. package/lib/view/settingsView/settingsViewReducer.js +1 -0
  113. package/lib/view/spendManagement/billPay/billList/billListReducer.js +1 -0
  114. package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.js +6 -0
  115. package/lib/view/spendManagement/billPay/billsBulkActionView/epics/validateBillsBulkActionEpic.ts.js +3 -4
  116. package/lib/view/spendManagement/billPay/editBillView/epics/fetchBillAndInitializeLocalStoreEpic.js +3 -1
  117. package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.js +3 -11
  118. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +1 -2
  119. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +1 -3
  120. package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +1 -1
  121. package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchRecommendationsAndUpdateMerchantRecommendationsEpic.js +6 -2
  122. package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchRemiAndInitializeLocalStoreEpic.js +3 -1
  123. package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.js +1 -0
  124. package/lib/view/subscriptionView/subscriptionViewReducer.js +1 -0
  125. package/lib/view/subscriptionView/types/subscriptionTypes.js +1 -0
  126. package/lib/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +3 -1
  127. package/lib/view/tasksCard/fetchTasksCardEpic.js +2 -1
  128. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  129. package/lib/view/tasksCard/tasksCardSelector.js +1 -1
  130. package/lib/view/topEx/topExSelector.d.ts +1 -1
  131. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +15 -45
  132. package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +4 -22
  133. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +13 -69
  134. package/lib/view/transactionDetail/transactionDetailReducer.d.ts +2 -11
  135. package/lib/view/transactionDetail/transactionDetailReducer.js +21 -51
  136. package/lib/view/transactionDetail/transactionDetailState.d.ts +0 -1
  137. package/lib/view/transactionDetail/transactionDetailTypes.d.ts +0 -8
  138. package/lib/view/transactionList/transactionListByEntitySelector.js +2 -0
  139. package/lib/view/transactionList/transactionListReducer.js +6 -4
  140. package/lib/view/trendWithTransactions/trendWithTransactionsReducer.js +1 -0
  141. package/lib/view/userFinancialAccount/userFinancialAccountReducer.js +3 -1
  142. package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewState.d.ts +1 -1
  143. package/lib/zeniAPI.d.ts +0 -1
  144. package/package.json +3 -8
  145. package/lib/entity/accountRecon/accountReconPayload.d.ts +0 -70
  146. package/lib/entity/accountRecon/accountReconPayload.js +0 -125
  147. package/lib/entity/accountRecon/accountReconReducer.d.ts +0 -16
  148. package/lib/entity/accountRecon/accountReconReducer.js +0 -71
  149. package/lib/entity/accountRecon/accountReconSelector.d.ts +0 -28
  150. package/lib/entity/accountRecon/accountReconSelector.js +0 -44
  151. package/lib/entity/accountRecon/accountReconState.d.ts +0 -70
  152. package/lib/entity/accountRecon/accountReconState.js +0 -28
  153. package/lib/entity/transaction/payloadTypes/reconciliationTransactionPayloads.d.ts +0 -35
  154. package/lib/entity/transaction/payloadTypes/reconciliationTransactionPayloads.js +0 -53
  155. package/lib/entity/transaction/stateTypes/reconciliationTransaction.d.ts +0 -32
  156. package/lib/entity/transaction/stateTypes/reconciliationTransaction.js +0 -10
  157. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.d.ts +0 -15
  158. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +0 -118
  159. package/lib/view/expenseAutomationView/epics/accountRecon/initialiseLocalDataForSelectedAccountIdEpic.d.ts +0 -10
  160. package/lib/view/expenseAutomationView/epics/accountRecon/initialiseLocalDataForSelectedAccountIdEpic.js +0 -49
  161. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationDetailEpic.d.ts +0 -14
  162. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationDetailEpic.js +0 -169
  163. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.d.ts +0 -9
  164. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +0 -154
  165. package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.d.ts +0 -6
  166. package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.js +0 -110
  167. package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.d.ts +0 -7
  168. package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.js +0 -18
  169. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +0 -28
  170. package/lib/view/expenseAutomationView/payload/reconciliationPayload.js +0 -51
  171. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +0 -66
  172. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +0 -384
  173. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +0 -51
  174. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +0 -7
  175. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.d.ts +0 -5
  176. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +0 -250
  177. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +0 -103
  178. package/lib/view/expenseAutomationView/types/reconciliationViewState.js +0 -38
@@ -1,384 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.updateSaveReconciliationReviewFetchStatus = exports.saveReconciliationReview = exports.updateReviewTabLocalData = exports.initializeReconciliationReviewTabLocalData = exports.updateReviewTabSortState = exports.updateSelectedDrawerAccountId = exports.clearExpenseAutomationReconciliationView = exports.initialiseLocalDataForSelectedAccountId = exports.updateBalancesLocalData = exports.updateSelectedTab = exports.saveReconciliationDetailSuccess = exports.updateReconcileTabListScrollState = exports.updateReconcileTabListSortState = exports.updateReconcileTabLocalData = exports.setConnectionInProgressForAccount = exports.updateSelectedAccountId = exports.saveReconciliationDetailFailure = exports.saveReconciliationDetail = exports.fetchReconciliationSuccess = exports.fetchReconciliationFailure = exports.fetchReconciliation = exports.initialState = exports.initialActionFetchState = exports.initialReconciliationTabsState = void 0;
5
- const toolkit_1 = require("@reduxjs/toolkit");
6
- const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
7
- const accountReconState_1 = require("../../../entity/accountRecon/accountReconState");
8
- // Initial state
9
- exports.initialReconciliationTabsState = {
10
- balances: {
11
- clearedBalance: { amount: 0, currencyCode: 'USD', currencySymbol: '$' },
12
- variance: { amount: 0, currencyCode: 'USD', currencySymbol: '$' },
13
- variancePercentage: 0,
14
- deposits: {
15
- count: 0,
16
- totalAmount: { amount: 0, currencyCode: 'USD', currencySymbol: '$' },
17
- },
18
- payments: {
19
- count: 0,
20
- totalAmount: { amount: 0, currencyCode: 'USD', currencySymbol: '$' },
21
- },
22
- },
23
- reconcile: {
24
- localData: {
25
- selectedTransactionIds: [],
26
- },
27
- uiState: {
28
- scrollYOffset: undefined,
29
- sortKey: 'date',
30
- sortOrder: 'descending',
31
- },
32
- },
33
- review: {
34
- localData: {},
35
- uiState: {
36
- scrollPosition: undefined,
37
- sortKey: 'date',
38
- sortOrder: 'descending',
39
- },
40
- },
41
- };
42
- exports.initialActionFetchState = {
43
- excludeFetchById: {},
44
- reconcileFetch: {
45
- fetchState: 'Not-Started',
46
- error: undefined,
47
- },
48
- saveForLaterFetch: {
49
- fetchState: 'Not-Started',
50
- error: undefined,
51
- },
52
- saveReconciliationReviewFetch: {},
53
- };
54
- exports.initialState = {
55
- accountReconciliationRecordsBySelectedPeriod: {},
56
- accountConnectionStatusByAccountID: {},
57
- fetchState: 'Not-Started',
58
- error: undefined,
59
- selectedTab: 'review',
60
- reconTabsState: exports.initialReconciliationTabsState,
61
- refreshStatus: { fetchState: 'Not-Started', error: undefined },
62
- actionFetchState: exports.initialActionFetchState,
63
- selectedAccountId: undefined,
64
- };
65
- // Create slice with reducers
66
- const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
67
- name: 'expenseAutomationReconciliationView',
68
- initialState: exports.initialState,
69
- reducers: {
70
- fetchReconciliation: {
71
- reducer(draft, action) {
72
- if (action.payload.accountId == null) {
73
- if (action.payload.refreshViewInBackground === true) {
74
- draft.refreshStatus = { fetchState: 'In-Progress', error: undefined };
75
- }
76
- else {
77
- draft.fetchState = 'In-Progress';
78
- draft.error = undefined;
79
- }
80
- }
81
- else {
82
- // select the account for which we are fetching
83
- draft.selectedAccountId = action.payload.accountId;
84
- const accountReconciliationRecords = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(action.payload.selectedPeriod)];
85
- const { transactionFetchState } = accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId];
86
- if (transactionFetchState.fetchState !== 'Completed' ||
87
- action.payload.cacheOverride === true) {
88
- const data = accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId];
89
- if (action.payload.refreshViewInBackground === true) {
90
- accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId] = Object.assign(Object.assign({}, data), { refreshStatus: {
91
- fetchState: 'In-Progress',
92
- error: undefined,
93
- }, accountId: action.payload.accountId, reconciliationId: undefined });
94
- }
95
- else {
96
- accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId] = Object.assign(Object.assign({}, data), { transactionFetchState: {
97
- fetchState: 'In-Progress',
98
- error: undefined,
99
- }, accountId: action.payload.accountId, reconciliationId: undefined });
100
- }
101
- }
102
- }
103
- },
104
- prepare(selectedPeriod, accountId, cacheOverride = false, refreshViewInBackground = false) {
105
- return {
106
- payload: {
107
- selectedPeriod,
108
- accountId,
109
- cacheOverride,
110
- refreshViewInBackground,
111
- },
112
- };
113
- },
114
- },
115
- fetchReconciliationSuccess: {
116
- reducer(draft, action) {
117
- if (action.payload.accountId == null) {
118
- updateAllReconciliation(draft, action.payload.reconciliation.accounts, action.payload.selectedPeriod, action.payload.reconciliation.reconciliation, action.payload.refreshViewInBackground);
119
- }
120
- else if (action.payload.reconciliation.reconciliation.length > 0 &&
121
- action.payload.reconciliation.accounts.length > 0) {
122
- updateReconciliationByAccountID(draft, action.payload.reconciliation.accounts[0], action.payload.selectedPeriod, action.payload.accountId, action.payload.reconciliation.reconciliation[0], action.payload.refreshViewInBackground);
123
- }
124
- },
125
- prepare(selectedPeriod, reconciliation, refreshViewInBackground = false, accountId, reconciliationId) {
126
- return {
127
- payload: {
128
- selectedPeriod,
129
- reconciliation,
130
- refreshViewInBackground,
131
- accountId,
132
- reconciliationId,
133
- },
134
- };
135
- },
136
- },
137
- fetchReconciliationFailure: (draft, action) => {
138
- if (action.payload.accountId == null) {
139
- if (action.payload.refreshViewInBackground === true) {
140
- draft.refreshStatus = {
141
- fetchState: 'Error',
142
- error: action.payload.error,
143
- };
144
- }
145
- else {
146
- draft.error = action.payload.error;
147
- draft.fetchState = 'Error';
148
- }
149
- }
150
- else {
151
- const accountReconciliationRecords = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(action.payload.selectedPeriod)];
152
- if (action.payload.refreshViewInBackground === true) {
153
- accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId].refreshStatus.error = action.payload.error;
154
- accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId].refreshStatus.fetchState = 'Error';
155
- }
156
- else {
157
- accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId].transactionFetchState.error = action.payload.error;
158
- accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId].transactionFetchState.fetchState = 'Error';
159
- }
160
- }
161
- },
162
- saveReconciliationDetail: (draft, action) => {
163
- const { reconcileAction } = action.payload;
164
- if (reconcileAction === 'reconcile') {
165
- draft.actionFetchState.reconcileFetch = {
166
- fetchState: 'In-Progress',
167
- error: undefined,
168
- };
169
- }
170
- else if (reconcileAction === 'save_reconcile_for_later') {
171
- draft.actionFetchState.saveForLaterFetch = {
172
- fetchState: 'In-Progress',
173
- error: undefined,
174
- };
175
- }
176
- else if (reconcileAction === 'exclude') {
177
- const excludeTransactionId = action.payload.excludeTransactionId;
178
- const excludeFetchStates = draft.actionFetchState.excludeFetchById;
179
- draft.actionFetchState.excludeFetchById = Object.assign(Object.assign({}, excludeFetchStates), { [excludeTransactionId]: {
180
- fetchState: 'In-Progress',
181
- error: undefined,
182
- } });
183
- }
184
- },
185
- saveReconciliationDetailFailure: (draft, action) => {
186
- const { reconcileAction } = action.payload.fetchStateByAction;
187
- const { error } = action.payload;
188
- if (reconcileAction === 'reconcile') {
189
- draft.actionFetchState.reconcileFetch = {
190
- fetchState: 'Error',
191
- error: error,
192
- };
193
- }
194
- else if (reconcileAction === 'save_reconcile_for_later') {
195
- draft.actionFetchState.saveForLaterFetch = {
196
- fetchState: 'Error',
197
- error: error,
198
- };
199
- }
200
- else if (reconcileAction === 'exclude') {
201
- const excludeTransactionId = action.payload.fetchStateByAction.excludeTransactionId;
202
- const excludeFetchStates = draft.actionFetchState.excludeFetchById;
203
- draft.actionFetchState.excludeFetchById = Object.assign(Object.assign({}, excludeFetchStates), { [excludeTransactionId]: {
204
- fetchState: 'Error',
205
- error: error,
206
- } });
207
- }
208
- },
209
- saveReconciliationDetailSuccess: (draft, action) => {
210
- const { reconcileAction } = action.payload;
211
- if (reconcileAction === 'reconcile') {
212
- draft.actionFetchState.reconcileFetch = {
213
- fetchState: 'Completed',
214
- error: undefined,
215
- };
216
- }
217
- else if (reconcileAction === 'save_reconcile_for_later') {
218
- draft.actionFetchState.saveForLaterFetch = {
219
- fetchState: 'Completed',
220
- error: undefined,
221
- };
222
- }
223
- else if (reconcileAction === 'exclude') {
224
- const excludeTransactionId = action.payload.excludeTransactionId;
225
- const excludeFetchStates = draft.actionFetchState.excludeFetchById;
226
- draft.actionFetchState.excludeFetchById = Object.assign(Object.assign({}, excludeFetchStates), { [excludeTransactionId]: {
227
- fetchState: 'Completed',
228
- error: undefined,
229
- } });
230
- }
231
- },
232
- updateReconcileTabLocalData: (draft, action) => {
233
- const { selectedTransactionIds } = action.payload;
234
- draft.reconTabsState.reconcile.localData.selectedTransactionIds =
235
- selectedTransactionIds;
236
- },
237
- updateBalancesLocalData: (draft, action) => {
238
- const { clearedBalance, variance, payments, deposits, variancePercentage } = action.payload;
239
- draft.reconTabsState.balances = {
240
- clearedBalance,
241
- variance,
242
- variancePercentage,
243
- payments: payments,
244
- deposits: deposits,
245
- };
246
- },
247
- updateSelectedAccountId: (draft, action) => {
248
- draft.selectedAccountId = action.payload.selectedAccountId;
249
- },
250
- updateSelectedDrawerAccountId: (draft, action) => {
251
- draft.selectedDrawerAccountId = action.payload.selectedDrawerAccountId;
252
- },
253
- initialiseLocalDataForSelectedAccountId: () => { },
254
- updateSelectedTab: (draft, action) => {
255
- const { selectedTab } = action.payload;
256
- draft.selectedTab = selectedTab;
257
- },
258
- updateReconcileTabListSortState: (draft, action) => {
259
- draft.reconTabsState.reconcile.uiState = Object.assign(Object.assign({}, draft.reconTabsState.reconcile.uiState), { sortOrder: action.payload.sortOrder, sortKey: action.payload.sortKey });
260
- },
261
- updateReviewTabSortState: (draft, action) => {
262
- draft.reconTabsState.review.uiState = Object.assign(Object.assign({}, draft.reconTabsState.review.uiState), { sortOrder: action.payload.sortOrder, sortKey: action.payload.sortKey });
263
- },
264
- updateReconcileTabListScrollState: (draft, action) => {
265
- draft.reconTabsState.reconcile.uiState = Object.assign(Object.assign({}, draft.reconTabsState.reconcile.uiState), { scrollYOffset: action.payload.scrollYOffset });
266
- },
267
- updateReviewTabLocalData(draft, action) {
268
- const { data, transactionId } = action.payload;
269
- draft.reconTabsState.review.localData = Object.assign(Object.assign({}, draft.reconTabsState.review.localData), { [transactionId]: data });
270
- },
271
- saveReconciliationReview: {
272
- reducer(draft, action) {
273
- const { transactionId } = action.payload;
274
- draft.actionFetchState.saveReconciliationReviewFetch[transactionId] = {
275
- fetchState: 'In-Progress',
276
- error: undefined,
277
- };
278
- },
279
- prepare(transactionId) {
280
- return {
281
- payload: {
282
- transactionId,
283
- },
284
- };
285
- },
286
- },
287
- updateSaveReconciliationReviewFetchStatus: (draft, action) => {
288
- const { transactionId, error, fetchState } = action.payload;
289
- draft.actionFetchState.saveReconciliationReviewFetch[transactionId] = {
290
- fetchState: fetchState,
291
- error,
292
- };
293
- },
294
- initializeReconciliationReviewTabLocalData: {
295
- reducer(draft, action) {
296
- draft.reconTabsState.review.localData = action.payload.localData;
297
- },
298
- prepare(localData) {
299
- return {
300
- payload: { localData },
301
- };
302
- },
303
- },
304
- setConnectionInProgressForAccount: (draft, action) => {
305
- if (draft.accountConnectionStatusByAccountID[action.payload.accountId] ==
306
- null) {
307
- console.error(`Account ${action.payload.accountId} not found to set connection in progress`);
308
- }
309
- else {
310
- draft.accountConnectionStatusByAccountID[action.payload.accountId] = Object.assign(Object.assign({}, draft.accountConnectionStatusByAccountID[action.payload.accountId]), { connectionInProgress: action.payload.connectionInProgress });
311
- }
312
- },
313
- clearExpenseAutomationReconciliationView: (draft) => {
314
- Object.assign(draft, exports.initialState);
315
- },
316
- },
317
- });
318
- // Export actions
319
- _a = expenseAutomationReconciliationView.actions, exports.fetchReconciliation = _a.fetchReconciliation, exports.fetchReconciliationFailure = _a.fetchReconciliationFailure, exports.fetchReconciliationSuccess = _a.fetchReconciliationSuccess, exports.saveReconciliationDetail = _a.saveReconciliationDetail, exports.saveReconciliationDetailFailure = _a.saveReconciliationDetailFailure, exports.updateSelectedAccountId = _a.updateSelectedAccountId, exports.setConnectionInProgressForAccount = _a.setConnectionInProgressForAccount, exports.updateReconcileTabLocalData = _a.updateReconcileTabLocalData, exports.updateReconcileTabListSortState = _a.updateReconcileTabListSortState, exports.updateReconcileTabListScrollState = _a.updateReconcileTabListScrollState, exports.saveReconciliationDetailSuccess = _a.saveReconciliationDetailSuccess, exports.updateSelectedTab = _a.updateSelectedTab, exports.updateBalancesLocalData = _a.updateBalancesLocalData, exports.initialiseLocalDataForSelectedAccountId = _a.initialiseLocalDataForSelectedAccountId, exports.clearExpenseAutomationReconciliationView = _a.clearExpenseAutomationReconciliationView, exports.updateSelectedDrawerAccountId = _a.updateSelectedDrawerAccountId, exports.updateReviewTabSortState = _a.updateReviewTabSortState, exports.initializeReconciliationReviewTabLocalData = _a.initializeReconciliationReviewTabLocalData, exports.updateReviewTabLocalData = _a.updateReviewTabLocalData, exports.saveReconciliationReview = _a.saveReconciliationReview, exports.updateSaveReconciliationReviewFetchStatus = _a.updateSaveReconciliationReviewFetchStatus;
320
- // Export reducer
321
- exports.default = expenseAutomationReconciliationView.reducer;
322
- function updateAllReconciliation(draft, accounts, selectedPeriod, reconciliationData, refreshViewInBackground) {
323
- draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = {
324
- accountIDs: [],
325
- reconciliationByAccountID: {},
326
- };
327
- const accountReconciliationRecords = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)];
328
- reconciliationData.forEach((reconciliation) => {
329
- var _a, _b, _c;
330
- const account = accounts.find((account) => account.account_id === reconciliation.account_id);
331
- const oldConnectionStatus = draft.accountConnectionStatusByAccountID[reconciliation.account_id];
332
- if (oldConnectionStatus == null) {
333
- draft.accountConnectionStatusByAccountID[reconciliation.account_id] = {
334
- status: (0, accountReconState_1.toBankStatusCodeType)(reconciliation.bank_status.code),
335
- connectionInProgress: false,
336
- paymentAccountId: (_a = account === null || account === void 0 ? void 0 : account.payment_account_id) !== null && _a !== void 0 ? _a : undefined,
337
- };
338
- }
339
- else {
340
- draft.accountConnectionStatusByAccountID[reconciliation.account_id] = {
341
- status: (0, accountReconState_1.toBankStatusCodeType)(reconciliation.bank_status.code),
342
- connectionInProgress: reconciliation.bank_status.code === 'not_connected' &&
343
- oldConnectionStatus.connectionInProgress === true,
344
- paymentAccountId: (_b = account === null || account === void 0 ? void 0 : account.payment_account_id) !== null && _b !== void 0 ? _b : undefined,
345
- };
346
- }
347
- accountReconciliationRecords.reconciliationByAccountID[reconciliation.account_id] = {
348
- accountId: reconciliation.account_id,
349
- reconciliationId: (_c = reconciliation.reconciliation_id) !== null && _c !== void 0 ? _c : undefined,
350
- transactionFetchState: { fetchState: 'Not-Started', error: undefined },
351
- refreshStatus: { fetchState: 'Not-Started', error: undefined },
352
- };
353
- accountReconciliationRecords.accountIDs.push(reconciliation.account_id);
354
- });
355
- if (refreshViewInBackground === true) {
356
- draft.refreshStatus = {
357
- fetchState: 'Completed',
358
- error: undefined,
359
- };
360
- }
361
- else {
362
- draft.fetchState = 'Completed';
363
- draft.error = undefined;
364
- }
365
- }
366
- function updateReconciliationByAccountID(draft, accounts, selectedPeriod, accountId, reconciliationData, refreshViewInBackground) {
367
- var _a, _b, _c;
368
- const oldRecord = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId];
369
- const oldConnectionStatus = draft.accountConnectionStatusByAccountID[accountId];
370
- draft.accountConnectionStatusByAccountID[accountId] = {
371
- status: (0, accountReconState_1.toBankStatusCodeType)(reconciliationData.bank_status.code),
372
- connectionInProgress: oldConnectionStatus != null
373
- ? reconciliationData.bank_status.code === 'not_connected' &&
374
- oldConnectionStatus.connectionInProgress === true
375
- : false,
376
- paymentAccountId: (_a = accounts.payment_account_id) !== null && _a !== void 0 ? _a : undefined,
377
- };
378
- if (refreshViewInBackground === true) {
379
- draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId] = Object.assign(Object.assign({}, oldRecord), { reconciliationId: (_b = reconciliationData.reconciliation_id) !== null && _b !== void 0 ? _b : undefined, refreshStatus: { fetchState: 'Completed', error: undefined } });
380
- }
381
- else {
382
- draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId] = Object.assign(Object.assign({}, oldRecord), { reconciliationId: (_c = reconciliationData.reconciliation_id) !== null && _c !== void 0 ? _c : undefined, transactionFetchState: { fetchState: 'Completed', error: undefined } });
383
- }
384
- }
@@ -1,51 +0,0 @@
1
- import { NestedAccountHierarchyForReport } from '../../../commonStateTypes/accountView/nestedAccountID';
2
- import { Amount } from '../../../commonStateTypes/amount';
3
- import { NestedClassHierarchyForReport } from '../../../commonStateTypes/classesView/nestedClassID';
4
- import { CompletionStatusType, FetchStateAndError, ID } from '../../../commonStateTypes/common';
5
- import { MonthYearPeriod } from '../../../commonStateTypes/timePeriod';
6
- import { AccountBase } from '../../../entity/account/accountState';
7
- import { AccountReconciliationEntity } from '../../../entity/accountRecon/accountReconSelector';
8
- import { BankStatusCodeType } from '../../../entity/accountRecon/accountReconState';
9
- import { ClassBase } from '../../../entity/class/classState';
10
- import { PlaidConnectionDetails } from '../../spendManagement/plaidAccount/plaidAccountViewState';
11
- import { ActionFetchStates, ReconciliationTabsState, ReconciliationViewTabType } from '../types/reconciliationViewState';
12
- export declare const ALL_ACCOUNT_RECON_SECTION_IDS: readonly ["assets", "liabilities"];
13
- declare const toAccountReconSectionID: (v: string) => "assets" | "liabilities";
14
- export type AccountReconSectionID = ReturnType<typeof toAccountReconSectionID>;
15
- export interface ExpenseAutomationReconciliationViewSelector {
16
- fetchStatus: FetchStateAndError;
17
- refreshStatus: FetchStateAndError;
18
- completionStatus: CompletionStatusType;
19
- selectedTab: ReconciliationViewTabType;
20
- monthYearPeriod: MonthYearPeriod;
21
- plaidConnectionDetails: PlaidConnectionDetails;
22
- accountReconciliationBySectionID: Record<AccountReconSectionID, AccountReconciliationBySection>;
23
- accountReconciliationsByAccountID: Record<ID, AccountReconciliationByAccount>;
24
- reconciliationTabsState: ReconciliationTabsState;
25
- selectedAccountId?: ID;
26
- selectedReconAccount?: AccountReconciliationByAccount;
27
- selectedDrawerAccountId?: ID;
28
- actionFetchStates: ActionFetchStates;
29
- accountListNestedAccountHierarchy: NestedAccountHierarchyForReport[];
30
- classListNestedAccountHierarchy: NestedClassHierarchyForReport[];
31
- allAccountList: AccountBase[];
32
- allClassList: ClassBase[];
33
- }
34
- export interface AccountReconciliationBySection {
35
- sectionId: AccountReconSectionID;
36
- accountIDs: ID[];
37
- totalBankBalance?: Amount;
38
- totalClearedBalance?: Amount;
39
- totalReconciledBalance?: Amount;
40
- totalVariance?: Amount;
41
- totalVariancePercentage?: number;
42
- }
43
- export interface AccountReconciliationByAccount {
44
- accountConnectionStatus: BankStatusCodeType;
45
- connectionInProgress: boolean;
46
- accountReconEntity: AccountReconciliationEntity;
47
- transactionFetchState: FetchStateAndError;
48
- refreshStatus: FetchStateAndError;
49
- paymentAccountId?: ID;
50
- }
51
- export {};
@@ -1,7 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.ALL_ACCOUNT_RECON_SECTION_IDS = void 0;
4
- const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
5
- exports.ALL_ACCOUNT_RECON_SECTION_IDS = ['assets', 'liabilities'];
6
- // eslint-disable-next-line @typescript-eslint/no-unused-vars
7
- const toAccountReconSectionID = (v) => (0, stringToUnion_1.stringToUnion)(v, exports.ALL_ACCOUNT_RECON_SECTION_IDS);
@@ -1,5 +0,0 @@
1
- import { ReportIDPlusForecastID } from '../../../commonStateTypes/viewAndReport/viewAndReport';
2
- import { RootState } from '../../../reducer';
3
- import { ExpenseAutomationReconciliationViewSelector } from '../selectorTypes/reconciliationViewSelectorTypes';
4
- export declare const getExpenseAutomationReconciliationView: (state: RootState) => ExpenseAutomationReconciliationViewSelector;
5
- export declare const isAccountReconReport: (reportId: ReportIDPlusForecastID) => boolean;