@zeniai/client-epic-state 5.2.34 → 5.2.35-beta0MM

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 (94) hide show
  1. package/lib/entity/actualMatching/actualMatchingPayload.d.ts +25 -0
  2. package/lib/entity/actualMatching/actualMatchingPayload.js +43 -0
  3. package/lib/entity/actualMatching/actualMatchingReducer.d.ts +8 -0
  4. package/lib/entity/actualMatching/actualMatchingReducer.js +33 -0
  5. package/lib/entity/actualMatching/actualMatchingSelector.d.ts +3 -0
  6. package/lib/entity/actualMatching/actualMatchingSelector.js +6 -0
  7. package/lib/entity/actualMatching/actualMatchingState.d.ts +22 -0
  8. package/lib/entity/actualMatching/actualMatchingState.js +2 -0
  9. package/lib/entity/actualMatching/actualMatchingTypes.d.ts +1 -0
  10. package/lib/entity/actualMatching/actualMatchingTypes.js +2 -0
  11. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +29 -0
  12. package/lib/entity/jeSchedules/jeSchedulesPayload.js +49 -0
  13. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +31 -0
  14. package/lib/epic.d.ts +8 -1
  15. package/lib/epic.js +14 -0
  16. package/lib/esm/entity/actualMatching/actualMatchingPayload.js +40 -0
  17. package/lib/esm/entity/actualMatching/actualMatchingReducer.js +30 -0
  18. package/lib/esm/entity/actualMatching/actualMatchingSelector.js +3 -0
  19. package/lib/esm/entity/actualMatching/actualMatchingState.js +1 -0
  20. package/lib/esm/entity/actualMatching/actualMatchingTypes.js +1 -0
  21. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +49 -0
  22. package/lib/esm/epic.js +14 -0
  23. package/lib/esm/index.js +6 -2
  24. package/lib/esm/reducer.js +6 -0
  25. package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +46 -0
  26. package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingMatchEpic.js +35 -0
  27. package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +7 -0
  28. package/lib/esm/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +52 -0
  29. package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +44 -0
  30. package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +73 -0
  31. package/lib/esm/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.js +52 -0
  32. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +28 -11
  33. package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
  34. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js +3 -1
  35. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +5 -0
  36. package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +22 -7
  37. package/lib/esm/view/expenseAutomationView/payload/actualMatchingPayload.js +68 -0
  38. package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +364 -0
  39. package/lib/esm/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +1 -0
  40. package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +281 -0
  41. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +3 -0
  42. package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +32 -0
  43. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -1
  44. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewPayload.js +4 -0
  45. package/lib/index.d.ts +13 -5
  46. package/lib/index.js +78 -48
  47. package/lib/reducer.d.ts +2 -0
  48. package/lib/reducer.js +6 -0
  49. package/lib/rootStateTypes.d.ts +4 -0
  50. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.d.ts +9 -0
  51. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +50 -0
  52. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingMatchEpic.d.ts +12 -0
  53. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingMatchEpic.js +39 -0
  54. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.d.ts +5 -0
  55. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +11 -0
  56. package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.d.ts +8 -0
  57. package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +56 -0
  58. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.d.ts +8 -0
  59. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +48 -0
  60. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.d.ts +8 -0
  61. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +77 -0
  62. package/lib/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.d.ts +8 -0
  63. package/lib/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.js +56 -0
  64. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +2 -1
  65. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +28 -11
  66. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +2 -1
  67. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
  68. package/lib/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js +3 -1
  69. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +2 -1
  70. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +5 -0
  71. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +22 -7
  72. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +85 -0
  73. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.js +74 -0
  74. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +74 -0
  75. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +368 -0
  76. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +4 -4
  77. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +83 -0
  78. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +2 -0
  79. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +2 -0
  80. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +29 -0
  81. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +296 -0
  82. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +3 -0
  83. package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +99 -0
  84. package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +38 -0
  85. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +1 -1
  86. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -1
  87. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewPayload.d.ts +1 -11
  88. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewPayload.js +4 -0
  89. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.d.ts +1 -2
  90. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.d.ts +1 -2
  91. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewState.d.ts +15 -1
  92. package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewReducer.d.ts +1 -1
  93. package/lib/view/invoicing/invoicingCustomerListView/invoicingCustomerListViewState.d.ts +1 -1
  94. package/package.json +1 -1
@@ -0,0 +1,368 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.updateActualMatchingUIState = exports.undoReversalAccrualsSuccess = exports.undoReversalAccrualsFailure = exports.undoReversalAccruals = exports.searchMatchTransactionsSuccess = exports.searchMatchTransactionsFailure = exports.searchMatchTransactions = exports.searchMatchAccrualsSuccess = exports.searchMatchAccrualsFailure = exports.searchMatchAccruals = exports.openMatchNewModal = exports.matchAndReverseAccrualsSuccess = exports.matchAndReverseAccrualsFailure = exports.matchAndReverseAccruals = exports.fetchActualMatchingSuccess = exports.fetchActualMatchingPage = exports.fetchActualMatchingMatchSuccess = exports.fetchActualMatchingMatchFailure = exports.fetchActualMatchingMatch = exports.fetchActualMatchingFailure = exports.fetchActualMatching = exports.closeMatchNewModal = exports.clearMatchNewModal = exports.clearActualMatchingView = exports.initialState = exports.initialMatchModalState = exports.initialAccrualSearchState = exports.initialTransactionSearchState = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
7
+ const jeScheduleHelper_1 = require("../../../entity/jeSchedules/jeScheduleHelper");
8
+ const rootActions_1 = require("../../../rootActions");
9
+ exports.initialTransactionSearchState = {
10
+ query: '',
11
+ results: [],
12
+ fetchState: 'Not-Started',
13
+ error: undefined,
14
+ nextPageToken: null,
15
+ isLoadingMore: false,
16
+ };
17
+ exports.initialAccrualSearchState = {
18
+ query: '',
19
+ results: [],
20
+ fetchState: 'Not-Started',
21
+ error: undefined,
22
+ nextPageToken: null,
23
+ isLoadingMore: false,
24
+ };
25
+ exports.initialMatchModalState = {
26
+ isOpen: false,
27
+ openedFromMatchId: undefined,
28
+ pinnedTransactionResults: [],
29
+ transactionSearch: exports.initialTransactionSearchState,
30
+ accrualSearch: exports.initialAccrualSearchState,
31
+ confirmStatus: { fetchState: 'Not-Started', error: undefined },
32
+ };
33
+ exports.initialState = {
34
+ matchIdsByPeriod: {},
35
+ fetchState: 'Not-Started',
36
+ error: undefined,
37
+ refreshStatus: {
38
+ fetchState: 'Not-Started',
39
+ error: undefined,
40
+ },
41
+ detailFetchStateByMatchId: {},
42
+ detailRefreshStatusByMatchId: {},
43
+ uiState: {
44
+ sortKey: 'date',
45
+ sortOrder: 'descending',
46
+ searchString: '',
47
+ scrollPosition: { scrollTop: 0, scrollLeft: undefined },
48
+ },
49
+ matchModal: exports.initialMatchModalState,
50
+ undoReversalStatus: { fetchState: 'Not-Started', error: undefined },
51
+ hasValidState() {
52
+ return this.fetchState == 'Completed';
53
+ },
54
+ };
55
+ function resetMatchModalSearches(draft) {
56
+ draft.matchModal.transactionSearch = exports.initialTransactionSearchState;
57
+ draft.matchModal.accrualSearch = exports.initialAccrualSearchState;
58
+ draft.matchModal.confirmStatus = {
59
+ fetchState: 'Not-Started',
60
+ error: undefined,
61
+ };
62
+ draft.matchModal.lastBatchResults = undefined;
63
+ draft.matchModal.openedFromMatchId = undefined;
64
+ draft.matchModal.pinnedTransactionResults = [];
65
+ }
66
+ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
67
+ name: 'expenseAutomationActualMatchingView',
68
+ initialState: exports.initialState,
69
+ reducers: {
70
+ fetchActualMatchingPage: {
71
+ prepare(period, refreshViewInBackground = false) {
72
+ return {
73
+ payload: {
74
+ period,
75
+ refreshViewInBackground,
76
+ },
77
+ };
78
+ },
79
+ reducer() {
80
+ // Epic-only fan-out.
81
+ },
82
+ },
83
+ fetchActualMatching: {
84
+ reducer(draft, action) {
85
+ const { refreshViewInBackground } = action.payload;
86
+ if (refreshViewInBackground) {
87
+ draft.refreshStatus = { fetchState: 'In-Progress', error: undefined };
88
+ }
89
+ else {
90
+ draft.fetchState = 'In-Progress';
91
+ draft.error = undefined;
92
+ }
93
+ },
94
+ prepare(period, refreshViewInBackground = false) {
95
+ return {
96
+ payload: {
97
+ period,
98
+ refreshViewInBackground,
99
+ },
100
+ };
101
+ },
102
+ },
103
+ fetchActualMatchingSuccess(draft, action) {
104
+ const { matchIds, selectedPeriod, refreshViewInBackground } = action.payload;
105
+ const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
106
+ draft.matchIdsByPeriod[periodId] = matchIds;
107
+ if (refreshViewInBackground) {
108
+ draft.refreshStatus = { fetchState: 'Completed', error: undefined };
109
+ }
110
+ else {
111
+ draft.fetchState = 'Completed';
112
+ draft.error = undefined;
113
+ }
114
+ },
115
+ fetchActualMatchingFailure(draft, action) {
116
+ const { status, refreshViewInBackground } = action.payload;
117
+ if (refreshViewInBackground) {
118
+ draft.refreshStatus = { fetchState: 'Error', error: status };
119
+ }
120
+ else {
121
+ draft.fetchState = 'Error';
122
+ draft.error = status;
123
+ }
124
+ },
125
+ fetchActualMatchingMatch: {
126
+ prepare(matchId, refreshViewInBackground = false) {
127
+ return { payload: { matchId, refreshViewInBackground } };
128
+ },
129
+ reducer(draft, action) {
130
+ const { matchId, refreshViewInBackground } = action.payload;
131
+ if (refreshViewInBackground) {
132
+ draft.detailRefreshStatusByMatchId[matchId] = {
133
+ fetchState: 'In-Progress',
134
+ error: undefined,
135
+ };
136
+ }
137
+ else {
138
+ draft.detailFetchStateByMatchId[matchId] = {
139
+ fetchState: 'In-Progress',
140
+ error: undefined,
141
+ };
142
+ }
143
+ },
144
+ },
145
+ fetchActualMatchingMatchSuccess(draft, action) {
146
+ const { matchId, refreshViewInBackground } = action.payload;
147
+ if (refreshViewInBackground) {
148
+ draft.detailRefreshStatusByMatchId[matchId] = {
149
+ fetchState: 'Completed',
150
+ error: undefined,
151
+ };
152
+ }
153
+ else {
154
+ draft.detailFetchStateByMatchId[matchId] = {
155
+ fetchState: 'Completed',
156
+ error: undefined,
157
+ };
158
+ }
159
+ },
160
+ fetchActualMatchingMatchFailure(draft, action) {
161
+ const { matchId, refreshViewInBackground, status } = action.payload;
162
+ if (refreshViewInBackground) {
163
+ draft.detailRefreshStatusByMatchId[matchId] = {
164
+ fetchState: 'Error',
165
+ error: status,
166
+ };
167
+ }
168
+ else {
169
+ draft.detailFetchStateByMatchId[matchId] = {
170
+ fetchState: 'Error',
171
+ error: status,
172
+ };
173
+ }
174
+ },
175
+ updateActualMatchingUIState(draft, action) {
176
+ if (action.payload.sortKey != null) {
177
+ draft.uiState.sortKey = action.payload.sortKey;
178
+ }
179
+ if (action.payload.sortOrder != null) {
180
+ draft.uiState.sortOrder = action.payload.sortOrder;
181
+ }
182
+ if (action.payload.searchString != null) {
183
+ draft.uiState.searchString = action.payload.searchString;
184
+ }
185
+ if (action.payload.scrollPosition != null) {
186
+ draft.uiState.scrollPosition = action.payload.scrollPosition;
187
+ }
188
+ },
189
+ openMatchNewModal: {
190
+ prepare(matchId) {
191
+ return { payload: { matchId } };
192
+ },
193
+ reducer(draft, action) {
194
+ resetMatchModalSearches(draft);
195
+ draft.matchModal.isOpen = true;
196
+ const matchId = action.payload.matchId;
197
+ draft.matchModal.openedFromMatchId =
198
+ matchId != null && matchId !== '' ? matchId : undefined;
199
+ if (draft.matchModal.openedFromMatchId != null) {
200
+ draft.matchModal.accrualSearch.fetchState = 'Completed';
201
+ }
202
+ },
203
+ },
204
+ closeMatchNewModal(draft) {
205
+ draft.matchModal.isOpen = false;
206
+ resetMatchModalSearches(draft);
207
+ },
208
+ clearMatchNewModal(draft) {
209
+ draft.matchModal.isOpen = false;
210
+ resetMatchModalSearches(draft);
211
+ },
212
+ searchMatchTransactions: {
213
+ reducer(draft, action) {
214
+ const { query, pageToken } = action.payload;
215
+ const isLoadMore = pageToken != null;
216
+ draft.matchModal.transactionSearch.query = query;
217
+ if (isLoadMore) {
218
+ draft.matchModal.transactionSearch.isLoadingMore = true;
219
+ }
220
+ else {
221
+ draft.matchModal.transactionSearch.isLoadingMore = false;
222
+ draft.matchModal.transactionSearch.results = [];
223
+ draft.matchModal.transactionSearch.nextPageToken = null;
224
+ draft.matchModal.transactionSearch.fetchState = 'In-Progress';
225
+ draft.matchModal.transactionSearch.error = undefined;
226
+ }
227
+ },
228
+ prepare({ query, pageToken, transactionType, transactionIntegrationId, }) {
229
+ return {
230
+ payload: {
231
+ query,
232
+ pageToken: pageToken ?? undefined,
233
+ transactionType,
234
+ transactionIntegrationId,
235
+ },
236
+ };
237
+ },
238
+ },
239
+ searchMatchTransactionsSuccess(draft, action) {
240
+ const { append, nextPageToken, results } = action.payload;
241
+ if (append) {
242
+ const merged = [
243
+ ...draft.matchModal.transactionSearch.results,
244
+ ...results,
245
+ ];
246
+ const byKey = new Map(merged.map((result) => [
247
+ `${result.transactionId}:${result.lineId}`,
248
+ result,
249
+ ]));
250
+ draft.matchModal.transactionSearch.results = Array.from(byKey.values());
251
+ }
252
+ else {
253
+ draft.matchModal.transactionSearch.results = results;
254
+ if (draft.matchModal.openedFromMatchId != null &&
255
+ draft.matchModal.pinnedTransactionResults.length === 0) {
256
+ draft.matchModal.pinnedTransactionResults = results;
257
+ }
258
+ }
259
+ draft.matchModal.transactionSearch.nextPageToken = nextPageToken;
260
+ draft.matchModal.transactionSearch.isLoadingMore = false;
261
+ draft.matchModal.transactionSearch.fetchState = 'Completed';
262
+ draft.matchModal.transactionSearch.error = undefined;
263
+ },
264
+ searchMatchTransactionsFailure(draft, action) {
265
+ draft.matchModal.transactionSearch.isLoadingMore = false;
266
+ draft.matchModal.transactionSearch.fetchState = 'Error';
267
+ draft.matchModal.transactionSearch.error = action.payload.error;
268
+ },
269
+ searchMatchAccruals: {
270
+ reducer(draft, action) {
271
+ const { query, pageToken } = action.payload;
272
+ const isLoadMore = pageToken != null;
273
+ draft.matchModal.accrualSearch.query = query;
274
+ if (isLoadMore) {
275
+ draft.matchModal.accrualSearch.isLoadingMore = true;
276
+ }
277
+ else {
278
+ draft.matchModal.accrualSearch.isLoadingMore = false;
279
+ draft.matchModal.accrualSearch.results = [];
280
+ draft.matchModal.accrualSearch.nextPageToken = null;
281
+ draft.matchModal.accrualSearch.fetchState = 'In-Progress';
282
+ draft.matchModal.accrualSearch.error = undefined;
283
+ }
284
+ },
285
+ prepare({ query, pageToken }) {
286
+ return { payload: { query, pageToken: pageToken ?? undefined } };
287
+ },
288
+ },
289
+ searchMatchAccrualsSuccess(draft, action) {
290
+ const { append, nextPageToken, results } = action.payload;
291
+ const keys = results.map((accrual) => (0, jeScheduleHelper_1.generateJEOneTimeAccrualKey)(accrual._id));
292
+ if (append) {
293
+ const merged = [...draft.matchModal.accrualSearch.results, ...keys];
294
+ draft.matchModal.accrualSearch.results = Array.from(new Set(merged));
295
+ }
296
+ else {
297
+ draft.matchModal.accrualSearch.results = keys;
298
+ }
299
+ draft.matchModal.accrualSearch.nextPageToken = nextPageToken;
300
+ draft.matchModal.accrualSearch.isLoadingMore = false;
301
+ draft.matchModal.accrualSearch.fetchState = 'Completed';
302
+ draft.matchModal.accrualSearch.error = undefined;
303
+ },
304
+ searchMatchAccrualsFailure(draft, action) {
305
+ draft.matchModal.accrualSearch.isLoadingMore = false;
306
+ draft.matchModal.accrualSearch.fetchState = 'Error';
307
+ draft.matchModal.accrualSearch.error = action.payload.error;
308
+ },
309
+ matchAndReverseAccruals: {
310
+ reducer(draft) {
311
+ draft.matchModal.confirmStatus = {
312
+ fetchState: 'In-Progress',
313
+ error: undefined,
314
+ };
315
+ },
316
+ prepare(params) {
317
+ return { payload: params };
318
+ },
319
+ },
320
+ matchAndReverseAccrualsSuccess(draft, action) {
321
+ draft.matchModal.confirmStatus = {
322
+ fetchState: 'Completed',
323
+ error: undefined,
324
+ };
325
+ draft.matchModal.lastBatchResults = action.payload.results;
326
+ },
327
+ matchAndReverseAccrualsFailure(draft, action) {
328
+ draft.matchModal.confirmStatus = {
329
+ fetchState: 'Error',
330
+ error: action.payload.status,
331
+ };
332
+ },
333
+ undoReversalAccruals: {
334
+ reducer(draft) {
335
+ draft.undoReversalStatus = {
336
+ fetchState: 'In-Progress',
337
+ error: undefined,
338
+ };
339
+ },
340
+ prepare(params) {
341
+ return { payload: params };
342
+ },
343
+ },
344
+ undoReversalAccrualsSuccess(draft, action) {
345
+ draft.undoReversalStatus = {
346
+ fetchState: 'Completed',
347
+ error: undefined,
348
+ };
349
+ void action;
350
+ },
351
+ undoReversalAccrualsFailure(draft, action) {
352
+ draft.undoReversalStatus = {
353
+ fetchState: 'Error',
354
+ error: action.payload.status,
355
+ };
356
+ },
357
+ clearActualMatchingView(draft) {
358
+ Object.assign(draft, exports.initialState);
359
+ },
360
+ },
361
+ extraReducers: (builder) => {
362
+ builder.addCase(rootActions_1.clearAll, (draft) => {
363
+ Object.assign(draft, exports.initialState);
364
+ });
365
+ },
366
+ });
367
+ _a = expenseAutomationActualMatchingView.actions, exports.clearActualMatchingView = _a.clearActualMatchingView, exports.clearMatchNewModal = _a.clearMatchNewModal, exports.closeMatchNewModal = _a.closeMatchNewModal, exports.fetchActualMatching = _a.fetchActualMatching, exports.fetchActualMatchingFailure = _a.fetchActualMatchingFailure, exports.fetchActualMatchingMatch = _a.fetchActualMatchingMatch, exports.fetchActualMatchingMatchFailure = _a.fetchActualMatchingMatchFailure, exports.fetchActualMatchingMatchSuccess = _a.fetchActualMatchingMatchSuccess, exports.fetchActualMatchingPage = _a.fetchActualMatchingPage, exports.fetchActualMatchingSuccess = _a.fetchActualMatchingSuccess, exports.matchAndReverseAccruals = _a.matchAndReverseAccruals, exports.matchAndReverseAccrualsFailure = _a.matchAndReverseAccrualsFailure, exports.matchAndReverseAccrualsSuccess = _a.matchAndReverseAccrualsSuccess, exports.openMatchNewModal = _a.openMatchNewModal, exports.searchMatchAccruals = _a.searchMatchAccruals, exports.searchMatchAccrualsFailure = _a.searchMatchAccrualsFailure, exports.searchMatchAccrualsSuccess = _a.searchMatchAccrualsSuccess, exports.searchMatchTransactions = _a.searchMatchTransactions, exports.searchMatchTransactionsFailure = _a.searchMatchTransactionsFailure, exports.searchMatchTransactionsSuccess = _a.searchMatchTransactionsSuccess, exports.undoReversalAccruals = _a.undoReversalAccruals, exports.undoReversalAccrualsFailure = _a.undoReversalAccrualsFailure, exports.undoReversalAccrualsSuccess = _a.undoReversalAccrualsSuccess, exports.updateActualMatchingUIState = _a.updateActualMatchingUIState;
368
+ exports.default = expenseAutomationActualMatchingView.reducer;
@@ -43,10 +43,10 @@ export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/too
43
43
  accrualId: string;
44
44
  reason: "duplicate" | "amount_off" | "wrong_period" | "other_revert" | "not_accrual";
45
45
  note: string | undefined;
46
- }, "expenseAutomationJESchedulesView/revertOneTimeAccrual", never, never>, fetchAccountSettingsListForAccountTypes: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/fetchAccountSettingsListForAccountTypes">, fetchJeSchedules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, refreshViewInBackground?: any, selectedPageTab?: "schedules" | "existing_schedules" | undefined], {
46
+ }, "expenseAutomationJESchedulesView/revertOneTimeAccrual", never, never>, fetchAccountSettingsListForAccountTypes: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/fetchAccountSettingsListForAccountTypes">, fetchJeSchedules: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[period: TimePeriod, refreshViewInBackground?: any, selectedPageTab?: "schedules" | "actual_matching" | "existing_schedules" | undefined], {
47
47
  period: TimePeriod;
48
48
  refreshViewInBackground: any;
49
- selectedPageTab: "schedules" | "existing_schedules" | undefined;
49
+ selectedPageTab: "schedules" | "actual_matching" | "existing_schedules" | undefined;
50
50
  }, "expenseAutomationJESchedulesView/fetchJeSchedules", never, never>, fetchJeSchedulesFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
51
51
  selectedPageTab: JEPageTab;
52
52
  selectedPeriod: MonthYearPeriod;
@@ -141,10 +141,10 @@ export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/too
141
141
  }, "expenseAutomationJESchedulesView/updateJeOneTimeAccrualLocalData">, updateJeScheduleLocalDataById: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
142
142
  localData: Partial<JEScheduleLocalData>;
143
143
  scheduledJournalEntryID: ID;
144
- }, "expenseAutomationJESchedulesView/updateJeScheduleLocalDataById">, updateJeScheduleTransactionKeys: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleKeys: (`${string}_expense_${string}` | `${string}_check_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_refund_${string}` | `${string}_bill_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`)[], selectedPeriod: MonthYearPeriod, selectedPageTab: "schedules" | "existing_schedules"], {
144
+ }, "expenseAutomationJESchedulesView/updateJeScheduleLocalDataById">, updateJeScheduleTransactionKeys: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[jeScheduleKeys: (`${string}_expense_${string}` | `${string}_check_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_refund_${string}` | `${string}_bill_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`)[], selectedPeriod: MonthYearPeriod, selectedPageTab: "schedules" | "actual_matching" | "existing_schedules"], {
145
145
  jeScheduleKeys: (`${string}_expense_${string}` | `${string}_check_${string}` | `${string}_invoice_${string}` | `${string}_payment_${string}` | `${string}_credit_memo_${string}` | `${string}_sales_receipt_${string}` | `${string}_delayed_credit_${string}` | `${string}_delayed_charge_${string}` | `${string}_refund_${string}` | `${string}_bill_${string}` | `${string}_bill_payment_${string}` | `${string}_bill_payment_check_${string}` | `${string}_bill_payment_credit_card_${string}` | `${string}_vendor_credit_${string}` | `${string}_credit_card_credit_${string}` | `${string}_transfer_${string}` | `${string}_credit_card_payment_${string}` | `${string}_deposit_${string}` | `${string}_journal_entry_${string}`)[];
146
146
  selectedPeriod: MonthYearPeriod;
147
- selectedPageTab: "schedules" | "existing_schedules";
147
+ selectedPageTab: "schedules" | "actual_matching" | "existing_schedules";
148
148
  }, "expenseAutomationJESchedulesView/updateJeScheduleTransactionKeys", never, never>, updateNewScheduleLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
149
149
  localData: Partial<NewScheduleLocalDataFixedAssets>;
150
150
  scheduleType: "fixed_assets" | "prepaid_expenses";
@@ -0,0 +1,83 @@
1
+ import { Amount } from '../../../commonStateTypes/amount';
2
+ import { FetchStateAndError, ID } from '../../../commonStateTypes/common';
3
+ import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
4
+ import { JEOneTimeAccrual } from '../../../entity/jeSchedules/jeSchedulesSelector';
5
+ import { ZeniDate } from '../../../zeniDayJS';
6
+ import { ActualMatchingTransactionSearchResult, ActualMatchingViewUIState, MatchAndReverseResult } from '../types/actualMatchingViewState';
7
+ export type ActualMatchingRowKind = 'auto_reversed' | 'pending_review' | 'manually_reversed';
8
+ export type ActualMatchingGroupedAccrual = {
9
+ accrualId: ID;
10
+ estimatedAmount?: Amount;
11
+ jeDebitAccountName?: string;
12
+ memo?: string;
13
+ serviceMonth?: string;
14
+ };
15
+ export interface ActualMatchingRow extends JEOneTimeAccrual {
16
+ accruedAmount: Amount;
17
+ actualAmount: Amount;
18
+ kind: ActualMatchingRowKind;
19
+ matchId: string;
20
+ groupedAccrualIds?: ID[];
21
+ groupedMembers?: ActualMatchingGroupedAccrual[];
22
+ matchShape?: string;
23
+ matchTier?: string;
24
+ reversalDate?: ZeniDate;
25
+ transactionDate?: string;
26
+ transactionType?: string;
27
+ }
28
+ export interface ActualMatchingKpiSummary {
29
+ ai: {
30
+ count: number;
31
+ };
32
+ autoReversed: {
33
+ amount: number;
34
+ count: number;
35
+ };
36
+ manual: {
37
+ count: number;
38
+ };
39
+ pendingReview: {
40
+ amount: number;
41
+ count: number;
42
+ };
43
+ totalThisClose: {
44
+ amount: number;
45
+ count: number;
46
+ };
47
+ }
48
+ export interface ActualMatchingMatchModalView {
49
+ accrualSearch: {
50
+ fetchState: FetchStateAndError;
51
+ isLoadingMore: boolean;
52
+ nextPageToken: string | null;
53
+ query: string;
54
+ results: JEOneTimeAccrual[];
55
+ };
56
+ confirmStatus: FetchStateAndError;
57
+ isOpen: boolean;
58
+ transactionSearch: {
59
+ fetchState: FetchStateAndError;
60
+ isLoadingMore: boolean;
61
+ nextPageToken: string | null;
62
+ query: string;
63
+ results: ActualMatchingTransactionSearchResult[];
64
+ };
65
+ lastBatchResults?: MatchAndReverseResult[];
66
+ openedFromMatchId?: string;
67
+ prefill?: {
68
+ selectedAccrualIds: ID[];
69
+ actualAmount?: number;
70
+ matchedLineId?: string;
71
+ matchedTransactionId?: string;
72
+ };
73
+ }
74
+ export interface ExpenseAutomationActualMatchingViewSelector extends SelectorView {
75
+ hasLoadedForSelectedPeriod: boolean;
76
+ kpiSummary: ActualMatchingKpiSummary;
77
+ matchModal: ActualMatchingMatchModalView;
78
+ pendingReview: ActualMatchingRow[];
79
+ refreshStatus: FetchStateAndError;
80
+ reversed: ActualMatchingRow[];
81
+ uiState: ActualMatchingViewUIState;
82
+ undoReversalStatus?: FetchStateAndError;
83
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -6,6 +6,7 @@ import { MonthEndCloseChecksView } from '../../../view/monthEndCloseChecksView/m
6
6
  import { CompanyMonthEndReportSelectorView } from '../../companyMonthEndReportView/companyMonthEndReportViewSelector';
7
7
  import { ExpenseAutomationViewType } from '../expenseAutomationViewState';
8
8
  import { TransactionsTab } from '../types/transactionsViewState';
9
+ import { ExpenseAutomationActualMatchingViewSelector } from './actualMatchingViewSelectorTypes';
9
10
  import { ExpenseAutomationFluxAnalysisViewSelector } from './fluxAnalysisViewSelectorTypes';
10
11
  import { ExpenseAutomationJESchedulesViewSelector } from './jeSchedulesSelectorTypes';
11
12
  import { ExpenseAutomationMissingReceiptsViewSelector } from './missingReceiptsSelectorTypes';
@@ -21,6 +22,7 @@ export interface ExpenseAutomationStepDetails {
21
22
  title: string;
22
23
  }
23
24
  export interface ExpenseAutomationViewSelector extends SelectorView {
25
+ actualMatching: ExpenseAutomationActualMatchingViewSelector;
24
26
  allSteps: ExpenseAutomationStepDetails[];
25
27
  completionStatus: CompletionStatusType;
26
28
  currentSelectedView: ExpenseAutomationViewType;
@@ -0,0 +1,29 @@
1
+ import { FetchStateAndError } from '../../../commonStateTypes/common';
2
+ import { ActualMatchingMatch } from '../../../entity/actualMatching/actualMatchingState';
3
+ import { ActualMatchingMatchId } from '../../../entity/actualMatching/actualMatchingTypes';
4
+ import { JEOneTimeAccrual } from '../../../entity/jeSchedules/jeSchedulesSelector';
5
+ import { JEOneTimeAccrualMatchSuggestion } from '../../../entity/jeSchedules/jeSchedulesState';
6
+ import { RootState } from '../../../rootStateTypes';
7
+ import { ZeniDate } from '../../../zeniDayJS';
8
+ import { ActualMatchingRow, ActualMatchingRowKind, ExpenseAutomationActualMatchingViewSelector } from '../selectorTypes/actualMatchingViewSelectorTypes';
9
+ export declare function parseActualMatchingMatchId(matchId: string): {
10
+ transactionIntegrationId: string;
11
+ transactionType: string;
12
+ } | null;
13
+ export declare function isAutoReversedAccrual(accrual: JEOneTimeAccrual): boolean;
14
+ export declare function isManuallyReversedAccrual(accrual: JEOneTimeAccrual): boolean;
15
+ export declare function isPendingReviewAccrual(accrual: JEOneTimeAccrual): accrual is JEOneTimeAccrual & {
16
+ matchSuggestion: JEOneTimeAccrualMatchSuggestion;
17
+ };
18
+ export declare function isReversedMatchKind(kind: ActualMatchingRowKind): boolean;
19
+ export declare function getClearedMatchedAmount(accrual: JEOneTimeAccrual): number | undefined;
20
+ export declare function getActualMatchingAmount(row: ActualMatchingRow): number;
21
+ export declare function getActualMatchingReversalDate(accrual: JEOneTimeAccrual): ZeniDate | undefined;
22
+ export interface ExpenseAutomationActualMatchingMatchView {
23
+ detailFetchState: FetchStateAndError;
24
+ refreshStatus: FetchStateAndError;
25
+ undoReversalStatus: FetchStateAndError;
26
+ match?: ActualMatchingMatch;
27
+ }
28
+ export declare function getExpenseAutomationActualMatchingMatchView(state: RootState, matchId: ActualMatchingMatchId): ExpenseAutomationActualMatchingMatchView;
29
+ export declare function getExpenseAutomationActualMatchingView(state: RootState): ExpenseAutomationActualMatchingViewSelector;