@zeniai/client-epic-state 4.15.25 → 4.15.26

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 (124) hide show
  1. package/lib/commonStateTypes/timePeriod.d.ts +1 -1
  2. package/lib/commonStateTypes/timePeriod.js +2 -2
  3. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  4. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +0 -1
  5. package/lib/configureStore.js +1 -2
  6. package/lib/entity/account/accountState.d.ts +1 -1
  7. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  8. package/lib/entity/class/classReducer.d.ts +4 -4
  9. package/lib/entity/class/classState.d.ts +1 -1
  10. package/lib/entity/customer/customerPayload.d.ts +1 -1
  11. package/lib/entity/customer/customerPayload.js +6 -16
  12. package/lib/entity/forecast/forecastState.d.ts +1 -1
  13. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  14. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  15. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  16. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  17. package/lib/entity/snackbar/snackbarTypes.js +0 -4
  18. package/lib/entity/task/taskState.d.ts +1 -1
  19. package/lib/entity/tenant/clearAllEpic.d.ts +2 -4
  20. package/lib/entity/tenant/clearAllEpic.js +0 -4
  21. package/lib/entity/tenant/tenantReducer.d.ts +1 -1
  22. package/lib/entity/tenant/tenantReducer.js +2 -7
  23. package/lib/entity/transaction/payloadTypes/customerTransactionPayload.d.ts +1 -1
  24. package/lib/entity/transaction/payloadTypes/customerTransactionPayload.js +2 -1
  25. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +0 -2
  26. package/lib/entity/transaction/payloadTypes/transactionPayload.js +3 -7
  27. package/lib/entity/transaction/payloadTypes/vendorTransactionPayload.d.ts +1 -9
  28. package/lib/entity/transaction/payloadTypes/vendorTransactionPayload.js +2 -23
  29. package/lib/entity/transaction/stateTypes/transaction.d.ts +1 -3
  30. package/lib/entity/transaction/stateTypes/transactionType.d.ts +1 -1
  31. package/lib/entity/transaction/stateTypes/transactionType.js +0 -1
  32. package/lib/entity/transaction/stateTypes/vendorTransaction.d.ts +0 -5
  33. package/lib/entity/transaction/stateTypes/vendorTransaction.js +1 -5
  34. package/lib/entity/transaction/toSupportedTransaction.js +1 -6
  35. package/lib/entity/transaction/transactionReducer.d.ts +0 -17
  36. package/lib/entity/transaction/transactionReducer.js +2 -47
  37. package/lib/entity/transaction/transactionSelector.d.ts +0 -2
  38. package/lib/entity/transaction/transactionSelector.js +0 -5
  39. package/lib/entity/transaction/transactionState.d.ts +4 -6
  40. package/lib/entity/vendorExpense/vendorExpenseSelector.d.ts +2 -2
  41. package/lib/epic.d.ts +1 -6
  42. package/lib/epic.js +1 -6
  43. package/lib/index.d.ts +6 -14
  44. package/lib/index.js +27 -52
  45. package/lib/reducer.d.ts +1 -7
  46. package/lib/reducer.js +0 -6
  47. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  48. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  49. package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
  50. package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
  51. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  52. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  53. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.d.ts +2 -2
  54. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  55. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +1 -2
  56. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +10 -24
  57. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +1 -2
  58. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +0 -14
  59. package/lib/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +4 -20
  60. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.d.ts +2 -2
  61. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +2 -17
  62. package/lib/view/expenseAutomationView/expenseAutomationViewState.d.ts +2 -2
  63. package/lib/view/expenseAutomationView/expenseAutomationViewState.js +1 -1
  64. package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +30 -81
  65. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  66. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +10 -54
  67. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +1 -2
  68. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +4 -5
  69. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +0 -2
  70. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.js +1 -1
  71. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +0 -8
  72. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  73. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  74. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  75. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  76. package/lib/view/spendManagement/billPay/billsBulkActionView/epics/validateBillsBulkActionEpic.ts.js +3 -4
  77. package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.js +3 -11
  78. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +1 -2
  79. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +1 -3
  80. package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +1 -1
  81. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  82. package/lib/view/topEx/topExSelector.d.ts +1 -1
  83. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +4 -13
  84. package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +3 -16
  85. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +5 -22
  86. package/lib/view/transactionDetail/transactionDetailState.d.ts +0 -1
  87. package/lib/view/transactionDetail/transactionDetailTypes.d.ts +0 -6
  88. package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewState.d.ts +1 -1
  89. package/lib/zeniAPI.d.ts +0 -1
  90. package/package.json +1 -2
  91. package/lib/entity/accountRecon/accountReconPayload.d.ts +0 -70
  92. package/lib/entity/accountRecon/accountReconPayload.js +0 -125
  93. package/lib/entity/accountRecon/accountReconReducer.d.ts +0 -16
  94. package/lib/entity/accountRecon/accountReconReducer.js +0 -71
  95. package/lib/entity/accountRecon/accountReconSelector.d.ts +0 -28
  96. package/lib/entity/accountRecon/accountReconSelector.js +0 -44
  97. package/lib/entity/accountRecon/accountReconState.d.ts +0 -70
  98. package/lib/entity/accountRecon/accountReconState.js +0 -28
  99. package/lib/entity/transaction/payloadTypes/reconciliationTransactionPayloads.d.ts +0 -35
  100. package/lib/entity/transaction/payloadTypes/reconciliationTransactionPayloads.js +0 -53
  101. package/lib/entity/transaction/stateTypes/reconciliationTransaction.d.ts +0 -32
  102. package/lib/entity/transaction/stateTypes/reconciliationTransaction.js +0 -10
  103. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.d.ts +0 -15
  104. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +0 -118
  105. package/lib/view/expenseAutomationView/epics/accountRecon/initialiseLocalDataForSelectedAccountIdEpic.d.ts +0 -10
  106. package/lib/view/expenseAutomationView/epics/accountRecon/initialiseLocalDataForSelectedAccountIdEpic.js +0 -49
  107. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationDetailEpic.d.ts +0 -14
  108. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationDetailEpic.js +0 -169
  109. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.d.ts +0 -9
  110. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +0 -154
  111. package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.d.ts +0 -6
  112. package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.js +0 -110
  113. package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.d.ts +0 -7
  114. package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.js +0 -18
  115. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +0 -25
  116. package/lib/view/expenseAutomationView/payload/reconciliationPayload.js +0 -51
  117. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +0 -66
  118. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +0 -375
  119. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +0 -50
  120. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +0 -7
  121. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.d.ts +0 -5
  122. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +0 -249
  123. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +0 -102
  124. package/lib/view/expenseAutomationView/types/reconciliationViewState.js +0 -38
@@ -1,375 +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: 'ascending',
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.selectedPeriod, action.payload.reconciliation.reconciliation, action.payload.refreshViewInBackground);
119
- }
120
- else if (action.payload.reconciliation.reconciliation.length > 0) {
121
- updateReconciliationByAccountID(draft, action.payload.selectedPeriod, action.payload.accountId, action.payload.reconciliation.reconciliation[0], action.payload.refreshViewInBackground);
122
- }
123
- },
124
- prepare(selectedPeriod, reconciliation, refreshViewInBackground = false, accountId, reconciliationId) {
125
- return {
126
- payload: {
127
- selectedPeriod,
128
- accountId,
129
- refreshViewInBackground,
130
- reconciliation,
131
- reconciliationId,
132
- },
133
- };
134
- },
135
- },
136
- fetchReconciliationFailure: (draft, action) => {
137
- if (action.payload.accountId == null) {
138
- if (action.payload.refreshViewInBackground === true) {
139
- draft.refreshStatus = {
140
- fetchState: 'Error',
141
- error: action.payload.error,
142
- };
143
- }
144
- else {
145
- draft.error = action.payload.error;
146
- draft.fetchState = 'Error';
147
- }
148
- }
149
- else {
150
- const accountReconciliationRecords = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(action.payload.selectedPeriod)];
151
- if (action.payload.refreshViewInBackground === true) {
152
- accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId].refreshStatus.error = action.payload.error;
153
- accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId].refreshStatus.fetchState = 'Error';
154
- }
155
- else {
156
- accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId].transactionFetchState.error = action.payload.error;
157
- accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId].transactionFetchState.fetchState = 'Error';
158
- }
159
- }
160
- },
161
- saveReconciliationDetail: (draft, action) => {
162
- const { reconcileAction } = action.payload;
163
- if (reconcileAction === 'reconcile') {
164
- draft.actionFetchState.reconcileFetch = {
165
- fetchState: 'In-Progress',
166
- error: undefined,
167
- };
168
- }
169
- else if (reconcileAction === 'save_reconcile_for_later') {
170
- draft.actionFetchState.saveForLaterFetch = {
171
- fetchState: 'In-Progress',
172
- error: undefined,
173
- };
174
- }
175
- else if (reconcileAction === 'exclude') {
176
- const excludeTransactionId = action.payload.excludeTransactionId;
177
- const excludeFetchStates = draft.actionFetchState.excludeFetchById;
178
- draft.actionFetchState.excludeFetchById = Object.assign(Object.assign({}, excludeFetchStates), { [excludeTransactionId]: {
179
- fetchState: 'In-Progress',
180
- error: undefined,
181
- } });
182
- }
183
- },
184
- saveReconciliationDetailFailure: (draft, action) => {
185
- const { reconcileAction } = action.payload.fetchStateByAction;
186
- const { error } = action.payload;
187
- if (reconcileAction === 'reconcile') {
188
- draft.actionFetchState.reconcileFetch = {
189
- fetchState: 'Error',
190
- error: error,
191
- };
192
- }
193
- else if (reconcileAction === 'save_reconcile_for_later') {
194
- draft.actionFetchState.saveForLaterFetch = {
195
- fetchState: 'Error',
196
- error: error,
197
- };
198
- }
199
- else if (reconcileAction === 'exclude') {
200
- const excludeTransactionId = action.payload.fetchStateByAction.excludeTransactionId;
201
- const excludeFetchStates = draft.actionFetchState.excludeFetchById;
202
- draft.actionFetchState.excludeFetchById = Object.assign(Object.assign({}, excludeFetchStates), { [excludeTransactionId]: {
203
- fetchState: 'Error',
204
- error: error,
205
- } });
206
- }
207
- },
208
- saveReconciliationDetailSuccess: (draft, action) => {
209
- const { reconcileAction } = action.payload;
210
- if (reconcileAction === 'reconcile') {
211
- draft.actionFetchState.reconcileFetch = {
212
- fetchState: 'Completed',
213
- error: undefined,
214
- };
215
- }
216
- else if (reconcileAction === 'save_reconcile_for_later') {
217
- draft.actionFetchState.saveForLaterFetch = {
218
- fetchState: 'Completed',
219
- error: undefined,
220
- };
221
- }
222
- else if (reconcileAction === 'exclude') {
223
- const excludeTransactionId = action.payload.excludeTransactionId;
224
- const excludeFetchStates = draft.actionFetchState.excludeFetchById;
225
- draft.actionFetchState.excludeFetchById = Object.assign(Object.assign({}, excludeFetchStates), { [excludeTransactionId]: {
226
- fetchState: 'Completed',
227
- error: undefined,
228
- } });
229
- }
230
- },
231
- updateReconcileTabLocalData: (draft, action) => {
232
- const { selectedTransactionIds } = action.payload;
233
- draft.reconTabsState.reconcile.localData.selectedTransactionIds =
234
- selectedTransactionIds;
235
- },
236
- updateBalancesLocalData: (draft, action) => {
237
- const { clearedBalance, variance, payments, deposits, variancePercentage } = action.payload;
238
- draft.reconTabsState.balances = {
239
- clearedBalance,
240
- variance,
241
- variancePercentage,
242
- payments: payments,
243
- deposits: deposits,
244
- };
245
- },
246
- updateSelectedAccountId: (draft, action) => {
247
- draft.selectedAccountId = action.payload.selectedAccountId;
248
- },
249
- updateSelectedDrawerAccountId: (draft, action) => {
250
- draft.selectedDrawerAccountId = action.payload.selectedDrawerAccountId;
251
- },
252
- initialiseLocalDataForSelectedAccountId: () => { },
253
- updateSelectedTab: (draft, action) => {
254
- const { selectedTab } = action.payload;
255
- draft.selectedTab = selectedTab;
256
- },
257
- updateReconcileTabListSortState: (draft, action) => {
258
- draft.reconTabsState.reconcile.uiState = Object.assign(Object.assign({}, draft.reconTabsState.reconcile.uiState), { sortOrder: action.payload.sortOrder, sortKey: action.payload.sortKey });
259
- },
260
- updateReviewTabSortState: (draft, action) => {
261
- draft.reconTabsState.review.uiState = Object.assign(Object.assign({}, draft.reconTabsState.review.uiState), { sortOrder: action.payload.sortOrder, sortKey: action.payload.sortKey });
262
- },
263
- updateReconcileTabListScrollState: (draft, action) => {
264
- draft.reconTabsState.reconcile.uiState = Object.assign(Object.assign({}, draft.reconTabsState.reconcile.uiState), { scrollYOffset: action.payload.scrollYOffset });
265
- },
266
- updateReviewTabLocalData(draft, action) {
267
- const { data, transactionId } = action.payload;
268
- draft.reconTabsState.review.localData = Object.assign(Object.assign({}, draft.reconTabsState.review.localData), { [transactionId]: data });
269
- },
270
- saveReconciliationReview: {
271
- reducer(draft, action) {
272
- const { transactionId } = action.payload;
273
- draft.actionFetchState.saveReconciliationReviewFetch[transactionId] = {
274
- fetchState: 'In-Progress',
275
- error: undefined,
276
- };
277
- },
278
- prepare(transactionId) {
279
- return {
280
- payload: {
281
- transactionId,
282
- },
283
- };
284
- },
285
- },
286
- updateSaveReconciliationReviewFetchStatus: (draft, action) => {
287
- const { transactionId, error, fetchState } = action.payload;
288
- draft.actionFetchState.saveReconciliationReviewFetch[transactionId] = {
289
- fetchState: fetchState,
290
- error,
291
- };
292
- },
293
- initializeReconciliationReviewTabLocalData: {
294
- reducer(draft, action) {
295
- draft.reconTabsState.review.localData = action.payload.localData;
296
- },
297
- prepare(localData) {
298
- return {
299
- payload: { localData },
300
- };
301
- },
302
- },
303
- setConnectionInProgressForAccount: (draft, action) => {
304
- if (draft.accountConnectionStatusByAccountID[action.payload.accountId] ==
305
- null) {
306
- console.error(`Account ${action.payload.accountId} not found to set connection in progress`);
307
- }
308
- else {
309
- draft.accountConnectionStatusByAccountID[action.payload.accountId] = Object.assign(Object.assign({}, draft.accountConnectionStatusByAccountID[action.payload.accountId]), { connectionInProgress: action.payload.connectionInProgress });
310
- }
311
- },
312
- clearExpenseAutomationReconciliationView: (draft) => {
313
- Object.assign(draft, exports.initialState);
314
- },
315
- },
316
- });
317
- // Export actions
318
- _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;
319
- // Export reducer
320
- exports.default = expenseAutomationReconciliationView.reducer;
321
- function updateAllReconciliation(draft, selectedPeriod, reconciliationData, refreshViewInBackground) {
322
- draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = {
323
- accountIDs: [],
324
- reconciliationByAccountID: {},
325
- };
326
- const accountReconciliationRecords = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)];
327
- reconciliationData.forEach((reconciliation) => {
328
- var _a;
329
- const oldConnectionStatus = draft.accountConnectionStatusByAccountID[reconciliation.account_id];
330
- if (oldConnectionStatus == null) {
331
- draft.accountConnectionStatusByAccountID[reconciliation.account_id] = {
332
- status: (0, accountReconState_1.toBankStatusCodeType)(reconciliation.bank_status.code),
333
- connectionInProgress: false,
334
- };
335
- }
336
- else {
337
- draft.accountConnectionStatusByAccountID[reconciliation.account_id] = {
338
- status: (0, accountReconState_1.toBankStatusCodeType)(reconciliation.bank_status.code),
339
- connectionInProgress: !(reconciliation.bank_status.code === 'connected' &&
340
- oldConnectionStatus.connectionInProgress === true),
341
- };
342
- }
343
- accountReconciliationRecords.reconciliationByAccountID[reconciliation.account_id] = {
344
- accountId: reconciliation.account_id,
345
- reconciliationId: (_a = reconciliation.reconciliation_id) !== null && _a !== void 0 ? _a : undefined,
346
- transactionFetchState: { fetchState: 'Not-Started', error: undefined },
347
- refreshStatus: { fetchState: 'Not-Started', error: undefined },
348
- };
349
- accountReconciliationRecords.accountIDs.push(reconciliation.account_id);
350
- });
351
- if (refreshViewInBackground === true) {
352
- draft.refreshStatus = {
353
- fetchState: 'Completed',
354
- error: undefined,
355
- };
356
- }
357
- else {
358
- draft.fetchState = 'Completed';
359
- draft.error = undefined;
360
- }
361
- }
362
- function updateReconciliationByAccountID(draft, selectedPeriod, accountId, reconciliationData, refreshViewInBackground) {
363
- var _a, _b;
364
- const oldRecord = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId];
365
- draft.accountConnectionStatusByAccountID[accountId] = {
366
- status: (0, accountReconState_1.toBankStatusCodeType)(reconciliationData.bank_status.code),
367
- connectionInProgress: false,
368
- };
369
- if (refreshViewInBackground === true) {
370
- draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId] = Object.assign(Object.assign({}, oldRecord), { reconciliationId: (_a = reconciliationData.reconciliation_id) !== null && _a !== void 0 ? _a : undefined, refreshStatus: { fetchState: 'Completed', error: undefined } });
371
- }
372
- else {
373
- 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, transactionFetchState: { fetchState: 'Completed', error: undefined } });
374
- }
375
- }
@@ -1,50 +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
- }
50
- 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;