@zeniai/client-epic-state 4.15.16 → 4.15.17

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 (101) 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 +1 -0
  5. package/lib/configureStore.js +2 -1
  6. package/lib/entity/account/accountState.d.ts +1 -1
  7. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  8. package/lib/entity/accountRecon/accountReconPayload.d.ts +70 -0
  9. package/lib/entity/accountRecon/accountReconPayload.js +125 -0
  10. package/lib/entity/accountRecon/accountReconReducer.d.ts +16 -0
  11. package/lib/entity/accountRecon/accountReconReducer.js +71 -0
  12. package/lib/entity/accountRecon/accountReconSelector.d.ts +28 -0
  13. package/lib/entity/accountRecon/accountReconSelector.js +44 -0
  14. package/lib/entity/accountRecon/accountReconState.d.ts +70 -0
  15. package/lib/entity/accountRecon/accountReconState.js +28 -0
  16. package/lib/entity/class/classReducer.d.ts +4 -4
  17. package/lib/entity/class/classState.d.ts +1 -1
  18. package/lib/entity/forecast/forecastState.d.ts +1 -1
  19. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  20. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  21. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  22. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  23. package/lib/entity/snackbar/snackbarTypes.js +4 -0
  24. package/lib/entity/task/taskState.d.ts +1 -1
  25. package/lib/entity/tenant/clearAllEpic.d.ts +4 -2
  26. package/lib/entity/tenant/clearAllEpic.js +4 -0
  27. package/lib/entity/tenant/tenantReducer.d.ts +1 -1
  28. package/lib/entity/tenant/tenantReducer.js +7 -2
  29. package/lib/entity/transaction/payloadTypes/reconciliationTransactionPayloads.d.ts +35 -0
  30. package/lib/entity/transaction/payloadTypes/reconciliationTransactionPayloads.js +53 -0
  31. package/lib/entity/transaction/stateTypes/reconciliationTransaction.d.ts +32 -0
  32. package/lib/entity/transaction/stateTypes/reconciliationTransaction.js +10 -0
  33. package/lib/entity/transaction/stateTypes/transaction.d.ts +1 -1
  34. package/lib/entity/transaction/stateTypes/transactionType.d.ts +1 -1
  35. package/lib/entity/transaction/stateTypes/transactionType.js +1 -0
  36. package/lib/entity/transaction/transactionReducer.d.ts +17 -0
  37. package/lib/entity/transaction/transactionReducer.js +47 -2
  38. package/lib/entity/transaction/transactionSelector.d.ts +2 -0
  39. package/lib/entity/transaction/transactionSelector.js +5 -0
  40. package/lib/entity/transaction/transactionState.d.ts +2 -0
  41. package/lib/entity/vendorExpense/vendorExpenseSelector.d.ts +2 -2
  42. package/lib/epic.d.ts +6 -1
  43. package/lib/epic.js +6 -1
  44. package/lib/index.d.ts +14 -6
  45. package/lib/index.js +52 -27
  46. package/lib/init.js +1 -1
  47. package/lib/reducer.d.ts +7 -1
  48. package/lib/reducer.js +6 -0
  49. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  50. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  51. package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
  52. package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
  53. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  54. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  55. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.d.ts +2 -2
  56. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  57. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.d.ts +15 -0
  58. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +118 -0
  59. package/lib/view/expenseAutomationView/epics/accountRecon/initialiseLocalDataForSelectedAccountIdEpic.d.ts +10 -0
  60. package/lib/view/expenseAutomationView/epics/accountRecon/initialiseLocalDataForSelectedAccountIdEpic.js +49 -0
  61. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationDetailEpic.d.ts +14 -0
  62. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationDetailEpic.js +169 -0
  63. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.d.ts +9 -0
  64. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +154 -0
  65. package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.d.ts +6 -0
  66. package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.js +110 -0
  67. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +2 -1
  68. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +9 -0
  69. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +2 -1
  70. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +14 -0
  71. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.d.ts +2 -2
  72. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +17 -2
  73. package/lib/view/expenseAutomationView/expenseAutomationViewState.d.ts +2 -2
  74. package/lib/view/expenseAutomationView/expenseAutomationViewState.js +1 -1
  75. package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.d.ts +7 -0
  76. package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.js +18 -0
  77. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +25 -0
  78. package/lib/view/expenseAutomationView/payload/reconciliationPayload.js +51 -0
  79. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +66 -0
  80. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +375 -0
  81. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +2 -0
  82. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.js +1 -1
  83. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +50 -0
  84. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +7 -0
  85. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.d.ts +5 -0
  86. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +249 -0
  87. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +102 -0
  88. package/lib/view/expenseAutomationView/types/reconciliationViewState.js +38 -0
  89. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  90. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  91. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  92. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  93. package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.js +11 -3
  94. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +2 -1
  95. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +3 -1
  96. package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +1 -1
  97. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  98. package/lib/view/topEx/topExSelector.d.ts +1 -1
  99. package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewState.d.ts +1 -1
  100. package/lib/zeniAPI.d.ts +1 -0
  101. package/package.json +2 -1
@@ -0,0 +1,375 @@
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
+ }
@@ -9,6 +9,7 @@ import { TransactionsTab } from '../types/transactionsViewState';
9
9
  import { ExpenseAutomationFluxAnalysisViewSelector } from './fluxAnalysisViewSelectorTypes';
10
10
  import { ExpenseAutomationJESchedulesViewSelector } from './jeSchedulesSelectorTypes';
11
11
  import { ExpenseAutomationMissingReceiptsViewSelector } from './missingReceiptsSelectorTypes';
12
+ import { ExpenseAutomationReconciliationViewSelector } from './reconciliationViewSelectorTypes';
12
13
  import { ExpenseAutomationTransactionViewSelector } from './transactionsViewSelectorTypes';
13
14
  export interface ExpenseAutomationStepDetails {
14
15
  step: ExpenseAutomationViewType;
@@ -29,6 +30,7 @@ export interface ExpenseAutomationViewSelector extends SelectorView {
29
30
  jeSchedules: ExpenseAutomationJESchedulesViewSelector;
30
31
  missingReceipts: ExpenseAutomationMissingReceiptsViewSelector;
31
32
  fluxAnalysis: ExpenseAutomationFluxAnalysisViewSelector;
33
+ reconciliation: ExpenseAutomationReconciliationViewSelector;
32
34
  monthEndInsights?: CompanyMonthEndReportSelectorView;
33
35
  saveStatus: FetchStateAndError;
34
36
  updateStatus: FetchStateAndError;
@@ -19,7 +19,7 @@ const getAllSteps = (monthEndCloseChecksState, monthYearId, tenantId, auditSumma
19
19
  isPrevDisabled: false,
20
20
  isNextDisabled: false,
21
21
  };
22
- case 'account_recon':
22
+ case 'reconciliation':
23
23
  case 'je_schedules':
24
24
  case 'missing_receipts':
25
25
  case 'flux_analysis':
@@ -0,0 +1,50 @@
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 {};
@@ -0,0 +1,7 @@
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);
@@ -0,0 +1,5 @@
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;