@zeniai/client-epic-state 5.2.70 → 5.2.72

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 (159) hide show
  1. package/lib/entity/actualMatching/actualMatchingReducer.d.ts +3 -1
  2. package/lib/entity/actualMatching/actualMatchingReducer.js +11 -2
  3. package/lib/entity/aiCfo/aiCfoState.d.ts +2 -2
  4. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
  5. package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
  6. package/lib/entity/depositAccountTransaction/depositAccountTransaction.d.ts +1 -1
  7. package/lib/entity/invoicing/{product/productPayload.d.ts → invoicingCatalog/invoicingCatalogPayload.d.ts} +44 -6
  8. package/lib/entity/invoicing/{product/productPayload.js → invoicingCatalog/invoicingCatalogPayload.js} +50 -6
  9. package/lib/entity/invoicing/invoicingCatalog/invoicingCatalogReducer.d.ts +12 -0
  10. package/lib/entity/invoicing/{plan/planReducer.js → invoicingCatalog/invoicingCatalogReducer.js} +20 -21
  11. package/lib/entity/invoicing/{plan/planSelector.d.ts → invoicingCatalog/invoicingCatalogSelector.d.ts} +5 -6
  12. package/lib/entity/invoicing/{plan/planSelector.js → invoicingCatalog/invoicingCatalogSelector.js} +12 -12
  13. package/lib/entity/invoicing/{product/productState.d.ts → invoicingCatalog/invoicingCatalogState.d.ts} +42 -6
  14. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +2 -0
  15. package/lib/entity/jeSchedules/jeSchedulesPayload.js +2 -0
  16. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +2 -0
  17. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +4 -4
  18. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  19. package/lib/entity/snackbar/snackbarTypes.js +3 -0
  20. package/lib/epic.d.ts +4 -2
  21. package/lib/epic.js +5 -1
  22. package/lib/esm/entity/actualMatching/actualMatchingReducer.js +9 -1
  23. package/lib/esm/entity/invoicing/{product/productPayload.js → invoicingCatalog/invoicingCatalogPayload.js} +46 -3
  24. package/lib/esm/entity/invoicing/{plan/planReducer.js → invoicingCatalog/invoicingCatalogReducer.js} +19 -20
  25. package/lib/esm/entity/invoicing/{plan/planSelector.js → invoicingCatalog/invoicingCatalogSelector.js} +8 -8
  26. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +2 -0
  27. package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
  28. package/lib/esm/epic.js +5 -1
  29. package/lib/esm/index.js +9 -12
  30. package/lib/esm/reducer.js +4 -7
  31. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.js +4 -2
  32. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.js +50 -0
  33. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/matchAndReverseAccrualsEpic.js +26 -13
  34. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchTransactionsEpic.js +2 -23
  35. package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +89 -38
  36. package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +68 -62
  37. package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +15 -0
  38. package/lib/esm/view/invoicing/createInvoice/createInvoiceEpic.js +9 -1
  39. package/lib/esm/view/invoicing/createInvoice/createInvoiceSelector.js +1 -1
  40. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +5 -3
  41. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/fetchInvoicingCatalogItemDetailEpic.js +2 -2
  42. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogPlanActionEpic.js +2 -2
  43. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogProductActionEpic.js +4 -4
  44. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +3 -7
  45. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/seedInvoicingCatalogItemFormDraftEpic.js +2 -2
  46. package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.js +5 -1
  47. package/lib/esm/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +5 -1
  48. package/lib/esm/view/invoicing/invoiceList/invoiceListReducer.js +8 -1
  49. package/lib/esm/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogPlanListEpic.js +2 -2
  50. package/lib/esm/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogProductListEpic.js +2 -2
  51. package/lib/esm/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +55 -22
  52. package/lib/esm/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewState.js +1 -20
  53. package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +18 -9
  54. package/lib/esm/view/invoicing/settingsView/submitInvoicingBrandingFormEpic.js +11 -2
  55. package/lib/esm/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewEpic.js +31 -11
  56. package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +2 -1
  57. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +4 -30
  58. package/lib/esm/view/spendManagement/commonSetup/epic/setup/resetKycKybEpic.js +37 -0
  59. package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +21 -1
  60. package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +2 -1
  61. package/lib/index.d.ts +15 -19
  62. package/lib/index.js +65 -63
  63. package/lib/reducer.d.ts +1 -2
  64. package/lib/reducer.js +4 -7
  65. package/lib/rootStateTypes.d.ts +3 -5
  66. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.d.ts +2 -2
  67. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.js +3 -1
  68. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.d.ts +10 -0
  69. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/ignoreActualMatchingSuggestionEpic.js +54 -0
  70. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/matchAndReverseAccrualsEpic.js +24 -11
  71. package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchTransactionsEpic.js +1 -22
  72. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  73. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +12 -1
  74. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +19 -8
  75. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +90 -39
  76. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
  77. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +24 -10
  78. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +7 -4
  79. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +71 -62
  80. package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +19 -4
  81. package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +18 -1
  82. package/lib/view/invoicing/createInvoice/createInvoiceEpic.d.ts +3 -2
  83. package/lib/view/invoicing/createInvoice/createInvoiceEpic.js +8 -0
  84. package/lib/view/invoicing/createInvoice/createInvoiceSelector.d.ts +2 -2
  85. package/lib/view/invoicing/createInvoice/createInvoiceSelector.js +2 -2
  86. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewPayload.d.ts +8 -9
  87. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +2 -2
  88. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +5 -3
  89. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/fetchInvoicingCatalogItemDetailEpic.d.ts +2 -2
  90. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/fetchInvoicingCatalogItemDetailEpic.js +2 -2
  91. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/invoicingCatalogItemFormHelper.d.ts +3 -4
  92. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogPlanActionEpic.d.ts +2 -2
  93. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogPlanActionEpic.js +2 -2
  94. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogProductActionEpic.d.ts +2 -3
  95. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/runInvoicingCatalogProductActionEpic.js +4 -4
  96. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.d.ts +2 -3
  97. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/saveInvoicingCatalogItemEpic.js +3 -7
  98. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/seedInvoicingCatalogItemFormDraftEpic.js +2 -2
  99. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.d.ts +3 -1
  100. package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewReducer.js +6 -2
  101. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/editInvoicingSubscriptionDetailViewSelector.d.ts +2 -2
  102. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.d.ts +3 -1
  103. package/lib/view/invoicing/editInvoicingSubscriptionDetailView/saveInvoicingSubscriptionEpic.js +5 -1
  104. package/lib/view/invoicing/invoiceList/invoiceListReducer.d.ts +3 -1
  105. package/lib/view/invoicing/invoiceList/invoiceListReducer.js +9 -2
  106. package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogListPageEpic.d.ts +2 -2
  107. package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogPlanListEpic.d.ts +2 -2
  108. package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogPlanListEpic.js +2 -2
  109. package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogProductListEpic.d.ts +2 -2
  110. package/lib/view/invoicing/invoicingCatalogListView/epics/fetchInvoicingCatalogProductListEpic.js +2 -2
  111. package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewPayload.d.ts +3 -3
  112. package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.d.ts +33 -15
  113. package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewSelector.js +57 -23
  114. package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewState.d.ts +0 -15
  115. package/lib/view/invoicing/invoicingCatalogListView/invoicingCatalogListViewState.js +0 -22
  116. package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewReducer.d.ts +1 -1
  117. package/lib/view/invoicing/invoicingDunningCaseListView/invoicingDunningCaseListViewState.d.ts +1 -1
  118. package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewReducer.d.ts +1 -1
  119. package/lib/view/invoicing/invoicingSubscriptionListView/invoicingSubscriptionListViewState.d.ts +1 -1
  120. package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +12 -3
  121. package/lib/view/invoicing/settingsView/settingsViewSelector.js +17 -8
  122. package/lib/view/invoicing/settingsView/submitInvoicingBrandingFormEpic.js +11 -2
  123. package/lib/view/onboardingView/customerView/epic/customerDetails/updateOnboardingCustomerViewEpic.js +31 -11
  124. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +3 -2
  125. package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +2 -1
  126. package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +4 -0
  127. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  128. package/lib/view/spendManagement/billPay/billList/billListReducer.d.ts +5 -5
  129. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
  130. package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.d.ts +2 -2
  131. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.d.ts +1 -1
  132. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +4 -30
  133. package/lib/view/spendManagement/commonSetup/epic/setup/resetKycKybEpic.d.ts +8 -0
  134. package/lib/view/spendManagement/commonSetup/epic/setup/resetKycKybEpic.js +41 -0
  135. package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +1 -1
  136. package/lib/view/spendManagement/commonSetup/setupViewReducer.js +22 -2
  137. package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +1 -0
  138. package/lib/view/spendManagement/commonSetup/setupViewSelector.js +2 -1
  139. package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +1 -0
  140. package/lib/view/spendManagement/commonSetup/types/businessVerification.d.ts +2 -1
  141. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewReducer.d.ts +2 -2
  142. package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.d.ts +5 -5
  143. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +2 -2
  144. package/package.json +1 -1
  145. package/lib/entity/invoicing/plan/planPayload.d.ts +0 -40
  146. package/lib/entity/invoicing/plan/planPayload.js +0 -51
  147. package/lib/entity/invoicing/plan/planReducer.d.ts +0 -14
  148. package/lib/entity/invoicing/plan/planState.d.ts +0 -43
  149. package/lib/entity/invoicing/product/productReducer.d.ts +0 -9
  150. package/lib/entity/invoicing/product/productReducer.js +0 -50
  151. package/lib/entity/invoicing/product/productSelector.d.ts +0 -4
  152. package/lib/entity/invoicing/product/productSelector.js +0 -17
  153. package/lib/entity/invoicing/product/productState.js +0 -2
  154. package/lib/esm/entity/invoicing/plan/planPayload.js +0 -47
  155. package/lib/esm/entity/invoicing/product/productReducer.js +0 -43
  156. package/lib/esm/entity/invoicing/product/productSelector.js +0 -10
  157. package/lib/esm/entity/invoicing/product/productState.js +0 -1
  158. /package/lib/entity/invoicing/{plan/planState.js → invoicingCatalog/invoicingCatalogState.js} +0 -0
  159. /package/lib/esm/entity/invoicing/{plan/planState.js → invoicingCatalog/invoicingCatalogState.js} +0 -0
@@ -1,7 +1,7 @@
1
1
  "use strict";
2
2
  var _a;
3
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.ackCloseMatchAfterUndo = exports.initialState = exports.initialMatchModalState = exports.initialAccrualSearchState = exports.initialTransactionSearchState = void 0;
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.ignoreActualMatchingSuggestionSuccess = exports.ignoreActualMatchingSuggestionFailure = exports.ignoreActualMatchingSuggestion = exports.fetchActualMatchingSuccess = exports.fetchActualMatchingPage = exports.fetchActualMatchingMatchSuccess = exports.fetchActualMatchingMatchFailure = exports.fetchActualMatchingMatch = exports.fetchActualMatchingFailure = exports.fetchActualMatching = exports.closeMatchNewModal = exports.clearMatchNewModal = exports.clearActualMatchingView = exports.ackCloseMatchAfterUndo = exports.ackCloseMatchAfterIgnore = exports.initialState = exports.initialMatchModalState = exports.initialAccrualSearchState = exports.initialTransactionSearchState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
7
7
  const jeScheduleHelper_1 = require("../../../entity/jeSchedules/jeScheduleHelper");
@@ -26,9 +26,6 @@ exports.initialAccrualSearchState = {
26
26
  };
27
27
  exports.initialMatchModalState = {
28
28
  isOpen: false,
29
- openedFromMatchId: undefined,
30
- didPinPrefillTransactions: false,
31
- pinnedTransactionResults: [],
32
29
  transactionSearch: exports.initialTransactionSearchState,
33
30
  accrualSearch: exports.initialAccrualSearchState,
34
31
  confirmStatus: { fetchState: 'Not-Started', error: undefined },
@@ -48,16 +45,28 @@ exports.initialState = {
48
45
  sortOrder: 'descending',
49
46
  searchString: '',
50
47
  scrollPosition: { scrollTop: 0, scrollLeft: undefined },
48
+ statusFilter: 'all',
51
49
  },
52
50
  matchModal: exports.initialMatchModalState,
53
51
  undoReversalStatusByMatchId: {},
54
- closeMatchAfterUndo: false,
52
+ ignoreStatusByMatchId: {},
53
+ confirmStatusByMatchId: {},
54
+ closeMatchAfterUndoMatchIds: [],
55
+ closeMatchAfterIgnoreMatchIds: [],
55
56
  lastMatchResultsByMatchId: {},
56
57
  lastUndoResultsByMatchId: {},
57
58
  hasValidState() {
58
59
  return this.fetchState == 'Completed';
59
60
  },
60
61
  };
62
+ function enqueueCloseMatchId(ids, matchId) {
63
+ if (!ids.includes(matchId)) {
64
+ ids.push(matchId);
65
+ }
66
+ }
67
+ function dropCloseMatchId(ids, matchId) {
68
+ return ids.filter((id) => id !== matchId);
69
+ }
61
70
  function pruneLastMatchResultsForUndone(draft, matchId, results) {
62
71
  const undoneIds = new Set(results
63
72
  .filter((result) => result.status === 'undone')
@@ -100,9 +109,6 @@ function resetMatchModalSearches(draft) {
100
109
  error: undefined,
101
110
  };
102
111
  draft.matchModal.lastBatchResults = undefined;
103
- draft.matchModal.openedFromMatchId = undefined;
104
- draft.matchModal.didPinPrefillTransactions = false;
105
- draft.matchModal.pinnedTransactionResults = [];
106
112
  }
107
113
  const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
108
114
  name: 'expenseAutomationActualMatchingView',
@@ -243,21 +249,13 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
243
249
  if (action.payload.scrollPosition != null) {
244
250
  draft.uiState.scrollPosition = action.payload.scrollPosition;
245
251
  }
252
+ if (action.payload.statusFilter != null) {
253
+ draft.uiState.statusFilter = action.payload.statusFilter;
254
+ }
246
255
  },
247
- openMatchNewModal: {
248
- prepare(matchId) {
249
- return { payload: { matchId } };
250
- },
251
- reducer(draft, action) {
252
- resetMatchModalSearches(draft);
253
- draft.matchModal.isOpen = true;
254
- const matchId = action.payload.matchId;
255
- draft.matchModal.openedFromMatchId =
256
- matchId != null && matchId !== '' ? matchId : undefined;
257
- if (draft.matchModal.openedFromMatchId != null) {
258
- draft.matchModal.accrualSearch.fetchState = 'Completed';
259
- }
260
- },
256
+ openMatchNewModal(draft) {
257
+ resetMatchModalSearches(draft);
258
+ draft.matchModal.isOpen = true;
261
259
  },
262
260
  // Dismiss (Cancel / overlay). Store reset matches `clearMatchNewModal`;
263
261
  // the actions stay distinct so confirm-success vs user-dismiss stay observable.
@@ -312,11 +310,6 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
312
310
  }
313
311
  else {
314
312
  draft.matchModal.transactionSearch.results = results;
315
- if (draft.matchModal.openedFromMatchId != null &&
316
- !draft.matchModal.didPinPrefillTransactions) {
317
- draft.matchModal.didPinPrefillTransactions = true;
318
- draft.matchModal.pinnedTransactionResults = results;
319
- }
320
313
  }
321
314
  draft.matchModal.transactionSearch.nextPageToken = nextPageToken;
322
315
  draft.matchModal.transactionSearch.isLoadingMore = false;
@@ -369,21 +362,27 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
369
362
  draft.matchModal.accrualSearch.error = action.payload.error;
370
363
  },
371
364
  matchAndReverseAccruals: {
372
- reducer(draft) {
373
- draft.matchModal.confirmStatus = {
365
+ reducer(draft, action) {
366
+ const inProgress = {
374
367
  fetchState: 'In-Progress',
375
368
  error: undefined,
376
369
  };
370
+ if (action.payload.forMatchModal === true) {
371
+ draft.matchModal.confirmStatus = inProgress;
372
+ }
373
+ const matchId = `${action.payload.transactionType.toLowerCase()}:${action.payload.transactionIntegrationId}`;
374
+ draft.confirmStatusByMatchId[matchId] = inProgress;
377
375
  },
378
- prepare(transactionId, transactionIntegrationId, transactionType, lineIds, transactionSyncToken, accrualIds) {
376
+ prepare(transactionId, transactionIntegrationId, transactionType, lineIds, transactionSyncToken, accrualIds, forMatchModal) {
379
377
  return {
380
378
  payload: {
379
+ accrualIds,
380
+ lineIds,
381
381
  transactionId,
382
382
  transactionIntegrationId,
383
- transactionType,
384
- lineIds,
385
383
  transactionSyncToken,
386
- accrualIds,
384
+ transactionType,
385
+ forMatchModal,
387
386
  },
388
387
  };
389
388
  },
@@ -392,23 +391,33 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
392
391
  const { results } = action.payload;
393
392
  const allComplete = results.length > 0 &&
394
393
  results.every((result) => (0, actualMatchingViewState_1.isMatchAndReverseCompleteStatus)(result.status));
395
- draft.matchModal.confirmStatus = allComplete
394
+ const confirmStatus = allComplete
396
395
  ? { fetchState: 'Completed', error: undefined }
397
396
  : {
398
397
  fetchState: 'Error',
399
398
  error: (0, responsePayload_1.createZeniAPIStatus)('Partial match-and-reverse', 'Some accruals were not reversed'),
400
399
  };
401
- draft.matchModal.lastBatchResults = results;
400
+ if (action.payload.forMatchModal === true) {
401
+ draft.matchModal.confirmStatus = confirmStatus;
402
+ draft.matchModal.lastBatchResults = results;
403
+ }
402
404
  if (action.payload.matchId != null) {
405
+ draft.confirmStatusByMatchId[action.payload.matchId] = confirmStatus;
403
406
  draft.lastMatchResultsByMatchId[action.payload.matchId] = results;
404
407
  pruneLastUndoResultsForMatched(draft, action.payload.matchId, action.payload.results);
405
408
  }
406
409
  },
407
410
  matchAndReverseAccrualsFailure(draft, action) {
408
- draft.matchModal.confirmStatus = {
411
+ const failed = {
409
412
  fetchState: 'Error',
410
413
  error: action.payload.status,
411
414
  };
415
+ if (action.payload.forMatchModal === true) {
416
+ draft.matchModal.confirmStatus = failed;
417
+ }
418
+ if (action.payload.matchId != null) {
419
+ draft.confirmStatusByMatchId[action.payload.matchId] = failed;
420
+ }
412
421
  },
413
422
  undoReversalAccruals: {
414
423
  reducer(draft, action) {
@@ -430,7 +439,12 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
430
439
  };
431
440
  const allUndone = results.length > 0 &&
432
441
  results.every((result) => result.status === 'undone');
433
- draft.closeMatchAfterUndo = allUndone;
442
+ if (allUndone) {
443
+ enqueueCloseMatchId(draft.closeMatchAfterUndoMatchIds, matchId);
444
+ }
445
+ else {
446
+ draft.closeMatchAfterUndoMatchIds = dropCloseMatchId(draft.closeMatchAfterUndoMatchIds, matchId);
447
+ }
434
448
  pruneLastMatchResultsForUndone(draft, matchId, results);
435
449
  if (allUndone) {
436
450
  delete draft.lastUndoResultsByMatchId[matchId];
@@ -444,7 +458,44 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
444
458
  },
445
459
  },
446
460
  ackCloseMatchAfterUndo(draft) {
447
- draft.closeMatchAfterUndo = false;
461
+ draft.closeMatchAfterUndoMatchIds.shift();
462
+ },
463
+ ignoreActualMatchingSuggestion: {
464
+ prepare(matchId, reason, note) {
465
+ return { payload: { matchId, reason, note } };
466
+ },
467
+ reducer(draft, action) {
468
+ draft.ignoreStatusByMatchId[action.payload.matchId] = {
469
+ fetchState: 'In-Progress',
470
+ error: undefined,
471
+ };
472
+ },
473
+ },
474
+ ignoreActualMatchingSuggestionSuccess(draft, action) {
475
+ const { matchId } = action.payload;
476
+ draft.ignoreStatusByMatchId[matchId] = {
477
+ fetchState: 'Completed',
478
+ error: undefined,
479
+ };
480
+ enqueueCloseMatchId(draft.closeMatchAfterIgnoreMatchIds, matchId);
481
+ delete draft.lastMatchResultsByMatchId[matchId];
482
+ delete draft.lastUndoResultsByMatchId[matchId];
483
+ delete draft.detailFetchStateByMatchId[matchId];
484
+ delete draft.detailRefreshStatusByMatchId[matchId];
485
+ delete draft.undoReversalStatusByMatchId[matchId];
486
+ delete draft.confirmStatusByMatchId[matchId];
487
+ Object.keys(draft.matchIdsByPeriod).forEach((periodId) => {
488
+ draft.matchIdsByPeriod[periodId] = draft.matchIdsByPeriod[periodId].filter((id) => id !== matchId);
489
+ });
490
+ },
491
+ ignoreActualMatchingSuggestionFailure(draft, action) {
492
+ draft.ignoreStatusByMatchId[action.payload.matchId] = {
493
+ fetchState: 'Error',
494
+ error: action.payload.status,
495
+ };
496
+ },
497
+ ackCloseMatchAfterIgnore(draft) {
498
+ draft.closeMatchAfterIgnoreMatchIds.shift();
448
499
  },
449
500
  undoReversalAccrualsFailure(draft, action) {
450
501
  draft.undoReversalStatusByMatchId[action.payload.matchId] = {
@@ -462,5 +513,5 @@ const expenseAutomationActualMatchingView = (0, toolkit_1.createSlice)({
462
513
  });
463
514
  },
464
515
  });
465
- _a = expenseAutomationActualMatchingView.actions, exports.ackCloseMatchAfterUndo = _a.ackCloseMatchAfterUndo, 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;
516
+ _a = expenseAutomationActualMatchingView.actions, exports.ackCloseMatchAfterIgnore = _a.ackCloseMatchAfterIgnore, exports.ackCloseMatchAfterUndo = _a.ackCloseMatchAfterUndo, 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.ignoreActualMatchingSuggestion = _a.ignoreActualMatchingSuggestion, exports.ignoreActualMatchingSuggestionFailure = _a.ignoreActualMatchingSuggestionFailure, exports.ignoreActualMatchingSuggestionSuccess = _a.ignoreActualMatchingSuggestionSuccess, 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;
466
517
  exports.default = expenseAutomationActualMatchingView.reducer;
@@ -16,9 +16,9 @@ export declare const clearExpenseAutomationJESchedulesView: import("@reduxjs/too
16
16
  localData: NewOneTimeAccrualLocalData;
17
17
  }, "expenseAutomationJESchedulesView/createOneTimeAccrual", never, never>, createOneTimeAccrualFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
18
18
  status: ZeniAPIStatus;
19
- }, "expenseAutomationJESchedulesView/createOneTimeAccrualFailure">, createOneTimeAccrualSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/createOneTimeAccrualSuccess">, ignoreOneTimeAccrual: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accrualId: string, reason: "paused" | "no_activity" | "too_small" | "need_invoice" | "other_ignore", note?: string | undefined], {
19
+ }, "expenseAutomationJESchedulesView/createOneTimeAccrualFailure">, createOneTimeAccrualSuccess: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationJESchedulesView/createOneTimeAccrualSuccess">, ignoreOneTimeAccrual: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[accrualId: string, reason: "no_activity" | "paused" | "too_small" | "need_invoice" | "other_ignore", note?: string | undefined], {
20
20
  accrualId: string;
21
- reason: "paused" | "no_activity" | "too_small" | "need_invoice" | "other_ignore";
21
+ reason: "no_activity" | "paused" | "too_small" | "need_invoice" | "other_ignore";
22
22
  note: string | undefined;
23
23
  }, "expenseAutomationJESchedulesView/ignoreOneTimeAccrual", never, never>, oneTimeAccrualActionFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
24
24
  accrualId: ID;
@@ -5,13 +5,15 @@ import { JEOneTimeAccrual } from '../../../entity/jeSchedules/jeSchedulesSelecto
5
5
  import { ZeniDate } from '../../../zeniDayJS';
6
6
  import { ActualMatchingTransactionSearchResult, ActualMatchingViewUIState, MatchAndReverseResult } from '../types/actualMatchingViewState';
7
7
  export type ActualMatchingRowKind = 'auto_reversed' | 'pending_review' | 'manually_reversed';
8
- export type ActualMatchingGroupedAccrual = {
8
+ export type ActualMatchingJournalEntryIds = Pick<JEOneTimeAccrual, 'reversalTransactionId' | 'reversalTransactionIntegrationId' | 'transactionId' | 'transactionIntegrationId'>;
9
+ export type ActualMatchingLeftoverAccrual = {
9
10
  accrualId: ID;
10
11
  estimatedAmount?: Amount;
11
12
  jeDebitAccountName?: string;
12
13
  memo?: string;
13
14
  serviceMonth?: string;
14
15
  };
16
+ export type ActualMatchingGroupedAccrual = ActualMatchingLeftoverAccrual & ActualMatchingJournalEntryIds;
15
17
  export interface ActualMatchingRow extends JEOneTimeAccrual {
16
18
  accruedAmount: Amount;
17
19
  actualAmount: Amount;
@@ -20,7 +22,7 @@ export interface ActualMatchingRow extends JEOneTimeAccrual {
20
22
  groupedAccrualIds?: ID[];
21
23
  groupedMembers?: ActualMatchingGroupedAccrual[];
22
24
  intendedAccrualIds?: ID[];
23
- leftovers?: ActualMatchingGroupedAccrual[];
25
+ leftovers?: ActualMatchingLeftoverAccrual[];
24
26
  matchShape?: string;
25
27
  matchTier?: string;
26
28
  reversalDate?: ZeniDate;
@@ -43,6 +45,9 @@ export interface ActualMatchingKpiSummary {
43
45
  count: number;
44
46
  estimatedMinutesToClear: number;
45
47
  };
48
+ reversed: {
49
+ count: number;
50
+ };
46
51
  variance: {
47
52
  averagePercentPerMatch: number;
48
53
  netAmount: number;
@@ -67,21 +72,30 @@ export interface ActualMatchingMatchModalView {
67
72
  results: ActualMatchingTransactionSearchResult[];
68
73
  };
69
74
  lastBatchResults?: MatchAndReverseResult[];
70
- openedFromMatchId?: string;
71
- prefill?: {
72
- selectedAccrualIds: ID[];
73
- actualAmount?: number;
74
- consumedLineIds?: ID[];
75
- matchedLineId?: string;
76
- matchedTransactionId?: string;
77
- };
75
+ }
76
+ export interface ActualMatchingMatchView {
77
+ accruedAmount: Amount;
78
+ actualAmount: Amount;
79
+ kind: ActualMatchingRowKind;
80
+ matchId: string;
81
+ members: JEOneTimeAccrual[];
82
+ transactionIntegrationId: ID;
83
+ transactionType: string;
84
+ leftovers?: JEOneTimeAccrual[];
85
+ matchShape?: string;
86
+ matchTier?: string;
87
+ transactionDate?: string;
88
+ vendorId?: ID;
89
+ vendorName?: string;
78
90
  }
79
91
  export interface ExpenseAutomationActualMatchingViewSelector extends SelectorView {
80
92
  hasLoadedForSelectedPeriod: boolean;
93
+ ignoreStatusByMatchId: Record<string, FetchStateAndError>;
81
94
  kpiSummary: ActualMatchingKpiSummary;
82
95
  matchModal: ActualMatchingMatchModalView;
83
96
  pendingReview: ActualMatchingRow[];
84
97
  refreshStatus: FetchStateAndError;
85
98
  reversed: ActualMatchingRow[];
86
99
  uiState: ActualMatchingViewUIState;
100
+ undoReversalStatusByMatchId: Record<string, FetchStateAndError>;
87
101
  }
@@ -1,13 +1,12 @@
1
1
  import { FetchStateAndError } from '../../../commonStateTypes/common';
2
2
  import { MonthYearPeriod } from '../../../commonStateTypes/timePeriod';
3
3
  import { DisplayCurrencyFallback } from '../../../entity/actualMatching/actualMatchingPayload';
4
- import { ActualMatchingMatch } from '../../../entity/actualMatching/actualMatchingState';
5
4
  import { ActualMatchingMatchId } from '../../../entity/actualMatching/actualMatchingTypes';
6
5
  import { JEOneTimeAccrual } from '../../../entity/jeSchedules/jeSchedulesSelector';
7
6
  import { JEOneTimeAccrualMatchSuggestion } from '../../../entity/jeSchedules/jeSchedulesState';
8
7
  import { RootState } from '../../../rootStateTypes';
9
8
  import { ZeniDate } from '../../../zeniDayJS';
10
- import { ActualMatchingKpiSummary, ActualMatchingRow, ActualMatchingRowKind, ExpenseAutomationActualMatchingViewSelector } from '../selectorTypes/actualMatchingViewSelectorTypes';
9
+ import { ActualMatchingKpiSummary, ActualMatchingMatchView, ActualMatchingRow, ActualMatchingRowKind, ExpenseAutomationActualMatchingViewSelector } from '../selectorTypes/actualMatchingViewSelectorTypes';
11
10
  import { MatchAndReverseResult, UndoReversalResult } from '../types/actualMatchingViewState';
12
11
  export declare function getSelectedMonthYearForCurrentTenant(state: RootState): MonthYearPeriod | undefined;
13
12
  export declare function getTenantDisplayCurrency(state: RootState): DisplayCurrencyFallback | undefined;
@@ -27,12 +26,16 @@ export declare function getActualMatchingReversalDate(accrual: JEOneTimeAccrual,
27
26
  export declare function buildActualMatchingKpiSummary(rows: ActualMatchingRow[], displayCurrencyCode?: string): ActualMatchingKpiSummary;
28
27
  export interface ExpenseAutomationActualMatchingMatchView {
29
28
  detailFetchState: FetchStateAndError;
29
+ ignoreStatus: FetchStateAndError;
30
30
  refreshStatus: FetchStateAndError;
31
31
  undoReversalStatus: FetchStateAndError;
32
32
  lastMatchResults?: MatchAndReverseResult[];
33
33
  lastUndoResults?: UndoReversalResult[];
34
- match?: ActualMatchingMatch;
34
+ match?: ActualMatchingMatchView;
35
35
  }
36
36
  export declare function getExpenseAutomationActualMatchingMatchView(state: RootState, matchId: ActualMatchingMatchId): ExpenseAutomationActualMatchingMatchView;
37
- export declare function getCloseMatchAfterUndo(state: RootState): boolean;
37
+ export declare function getCloseMatchAfterUndo(state: RootState): ActualMatchingMatchId | undefined;
38
+ export declare function getCloseMatchAfterUndoMatchId(state: RootState): ActualMatchingMatchId | undefined;
39
+ export declare function getCloseMatchAfterIgnoreMatchId(state: RootState): ActualMatchingMatchId | undefined;
40
+ export declare function getActualMatchingMatchModalConfirmStatus(state: RootState, matchId?: ActualMatchingMatchId): FetchStateAndError;
38
41
  export declare function getExpenseAutomationActualMatchingView(state: RootState): ExpenseAutomationActualMatchingViewSelector;
@@ -16,7 +16,11 @@ exports.getActualMatchingReversalDate = getActualMatchingReversalDate;
16
16
  exports.buildActualMatchingKpiSummary = buildActualMatchingKpiSummary;
17
17
  exports.getExpenseAutomationActualMatchingMatchView = getExpenseAutomationActualMatchingMatchView;
18
18
  exports.getCloseMatchAfterUndo = getCloseMatchAfterUndo;
19
+ exports.getCloseMatchAfterUndoMatchId = getCloseMatchAfterUndoMatchId;
20
+ exports.getCloseMatchAfterIgnoreMatchId = getCloseMatchAfterIgnoreMatchId;
21
+ exports.getActualMatchingMatchModalConfirmStatus = getActualMatchingMatchModalConfirmStatus;
19
22
  exports.getExpenseAutomationActualMatchingView = getExpenseAutomationActualMatchingView;
23
+ const toolkit_1 = require("@reduxjs/toolkit");
20
24
  const orderBy_1 = __importDefault(require("lodash/orderBy"));
21
25
  const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
22
26
  const actualMatchingSelector_1 = require("../../../entity/actualMatching/actualMatchingSelector");
@@ -24,7 +28,6 @@ const jeScheduleHelper_1 = require("../../../entity/jeSchedules/jeScheduleHelper
24
28
  const jeSchedulesSelector_1 = require("../../../entity/jeSchedules/jeSchedulesSelector");
25
29
  const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
26
30
  const zeniDayJS_1 = require("../../../zeniDayJS");
27
- const actualMatchingViewState_1 = require("../types/actualMatchingViewState");
28
31
  function getSelectedMonthYearForCurrentTenant(state) {
29
32
  const tenantId = (0, tenantSelector_1.getCurrentTenant)(state)?.tenantId;
30
33
  if (tenantId == null) {
@@ -53,27 +56,6 @@ function toMatchModalAccrual(member) {
53
56
  jeOneTimeAccrualKey: (0, jeScheduleHelper_1.generateJEOneTimeAccrualKey)(member.accrualId),
54
57
  };
55
58
  }
56
- function uniqueMatchModalAccruals(pinned, searched) {
57
- const byId = new Map();
58
- pinned.forEach((row) => byId.set(row.accrualId, row));
59
- searched.forEach((row) => {
60
- if (!byId.has(row.accrualId)) {
61
- byId.set(row.accrualId, row);
62
- }
63
- });
64
- return Array.from(byId.values());
65
- }
66
- function uniqueTransactionSearchResults(pinned, searched) {
67
- const byKey = new Map();
68
- pinned.forEach((row) => byKey.set((0, actualMatchingViewState_1.actualMatchingTransactionLineKey)(row.transactionType, row.transactionIntegrationId, row.lineId), row));
69
- searched.forEach((row) => {
70
- const key = (0, actualMatchingViewState_1.actualMatchingTransactionLineKey)(row.transactionType, row.transactionIntegrationId, row.lineId);
71
- if (!byKey.has(key)) {
72
- byKey.set(key, row);
73
- }
74
- });
75
- return Array.from(byKey.values());
76
- }
77
59
  function parseActualMatchingMatchId(matchId) {
78
60
  const separator = matchId.indexOf(':');
79
61
  if (separator <= 0 || separator === matchId.length - 1) {
@@ -134,13 +116,18 @@ function collectGroupedMembers(members) {
134
116
  estimatedAmount: member.estimatedAmount,
135
117
  jeDebitAccountName: member.jeDebitAccountName,
136
118
  memo: member.memo,
119
+ reversalTransactionId: member.reversalTransactionId,
120
+ reversalTransactionIntegrationId: member.reversalTransactionIntegrationId,
137
121
  serviceMonth: member.serviceMonth,
122
+ transactionId: member.transactionId,
123
+ transactionIntegrationId: member.transactionIntegrationId,
138
124
  }));
139
125
  }
140
126
  function collectLeftoverMembers(leftovers) {
141
127
  if (leftovers == null || leftovers.length === 0) {
142
128
  return undefined;
143
129
  }
130
+ // Leftover accruals did not post, so they have no journal-entry ids to open.
144
131
  return leftovers.map((member) => ({
145
132
  accrualId: member.accrualId,
146
133
  estimatedAmount: member.estimatedAmount,
@@ -246,6 +233,7 @@ function emptyKpiSummary() {
246
233
  actualsReceived: { count: 0, expectedCount: 0, vendorsPending: 0 },
247
234
  autoReversed: { count: 0, percent: 0, clearedAmount: 0 },
248
235
  pendingReview: { count: 0, amount: 0, estimatedMinutesToClear: 0 },
236
+ reversed: { count: 0 },
249
237
  variance: { percent: 0, averagePercentPerMatch: 0, netAmount: 0 },
250
238
  };
251
239
  }
@@ -301,6 +289,7 @@ function buildActualMatchingKpiSummary(rows, displayCurrencyCode) {
301
289
  }
302
290
  const autoReversed = kpiRows.filter((row) => row.kind === 'auto_reversed');
303
291
  const pendingReview = kpiRows.filter((row) => row.kind === 'pending_review');
292
+ const reversed = kpiRows.filter((row) => isReversedMatchKind(row.kind));
304
293
  const receivedCount = kpiRows.length;
305
294
  const rowsWithActual = kpiRows.filter((row) => row.actualAmount?.amount != null);
306
295
  const accruedTotal = rowsWithActual.reduce((sum, row) => sum + (row.accruedAmount?.amount ?? row.estimatedAmount.amount), 0);
@@ -326,6 +315,9 @@ function buildActualMatchingKpiSummary(rows, displayCurrencyCode) {
326
315
  amount: sumRowAmounts(pendingReview, displayCurrencyCode),
327
316
  estimatedMinutesToClear: pendingReview.length * ESTIMATED_MINUTES_PER_PENDING_MATCH,
328
317
  },
318
+ reversed: {
319
+ count: reversed.length,
320
+ },
329
321
  variance: {
330
322
  percent: accruedTotal === 0
331
323
  ? 0
@@ -338,23 +330,66 @@ function buildActualMatchingKpiSummary(rows, displayCurrencyCode) {
338
330
  },
339
331
  };
340
332
  }
341
- function getExpenseAutomationActualMatchingMatchView(state, matchId) {
342
- const view = state.expenseAutomationActualMatchingViewState;
333
+ function toActualMatchingMatchView(match) {
343
334
  return {
344
- match: (0, actualMatchingSelector_1.getActualMatchingMatchById)(state.actualMatchingState, matchId),
345
- detailFetchState: view.detailFetchStateByMatchId[matchId] ?? NOT_STARTED,
346
- refreshStatus: view.detailRefreshStatusByMatchId[matchId] ?? NOT_STARTED,
347
- undoReversalStatus: view.undoReversalStatusByMatchId[matchId] ?? NOT_STARTED,
348
- lastMatchResults: view.lastMatchResultsByMatchId?.[matchId],
349
- lastUndoResults: view.lastUndoResultsByMatchId?.[matchId],
335
+ ...match,
336
+ members: match.members.map(toMatchModalAccrual),
337
+ leftovers: match.leftovers == null
338
+ ? undefined
339
+ : match.leftovers.map(toMatchModalAccrual),
350
340
  };
351
341
  }
342
+ const matchViewSelectorById = new Map();
343
+ function getExpenseAutomationActualMatchingMatchView(state, matchId) {
344
+ let selector = matchViewSelectorById.get(matchId);
345
+ if (selector == null) {
346
+ selector = (0, toolkit_1.createSelector)([
347
+ (root) => root.expenseAutomationActualMatchingViewState
348
+ .detailFetchStateByMatchId[matchId] ?? NOT_STARTED,
349
+ (root) => root.expenseAutomationActualMatchingViewState.ignoreStatusByMatchId[matchId] ?? NOT_STARTED,
350
+ (root) => root.expenseAutomationActualMatchingViewState
351
+ .lastMatchResultsByMatchId?.[matchId],
352
+ (root) => root.expenseAutomationActualMatchingViewState
353
+ .lastUndoResultsByMatchId?.[matchId],
354
+ (root) => root.expenseAutomationActualMatchingViewState
355
+ .detailRefreshStatusByMatchId[matchId] ?? NOT_STARTED,
356
+ (root) => root.expenseAutomationActualMatchingViewState
357
+ .undoReversalStatusByMatchId[matchId] ?? NOT_STARTED,
358
+ (root) => (0, actualMatchingSelector_1.getActualMatchingMatchById)(root.actualMatchingState, matchId),
359
+ ], (detailFetchState, ignoreStatus, lastMatchResults, lastUndoResults, refreshStatus, undoReversalStatus, match) => ({
360
+ detailFetchState,
361
+ ignoreStatus,
362
+ lastMatchResults,
363
+ lastUndoResults,
364
+ match: match == null ? undefined : toActualMatchingMatchView(match),
365
+ refreshStatus,
366
+ undoReversalStatus,
367
+ }));
368
+ matchViewSelectorById.set(matchId, selector);
369
+ }
370
+ return selector(state);
371
+ }
352
372
  function getCloseMatchAfterUndo(state) {
353
- return state.expenseAutomationActualMatchingViewState.closeMatchAfterUndo;
373
+ return state.expenseAutomationActualMatchingViewState
374
+ .closeMatchAfterUndoMatchIds[0];
375
+ }
376
+ function getCloseMatchAfterUndoMatchId(state) {
377
+ return getCloseMatchAfterUndo(state);
378
+ }
379
+ function getCloseMatchAfterIgnoreMatchId(state) {
380
+ return state.expenseAutomationActualMatchingViewState
381
+ .closeMatchAfterIgnoreMatchIds[0];
382
+ }
383
+ function getActualMatchingMatchModalConfirmStatus(state, matchId) {
384
+ if (matchId != null && matchId !== '') {
385
+ return (state.expenseAutomationActualMatchingViewState.confirmStatusByMatchId[matchId] ?? NOT_STARTED);
386
+ }
387
+ return state.expenseAutomationActualMatchingViewState.matchModal
388
+ .confirmStatus;
354
389
  }
355
390
  function getExpenseAutomationActualMatchingView(state) {
356
391
  const { expenseAutomationActualMatchingViewState } = state;
357
- const { matchIdsByPeriod, fetchState, error, refreshStatus, uiState, matchModal, } = expenseAutomationActualMatchingViewState;
392
+ const { matchIdsByPeriod, fetchState, error, refreshStatus, uiState, matchModal, ignoreStatusByMatchId, undoReversalStatusByMatchId, } = expenseAutomationActualMatchingViewState;
358
393
  const selectedPeriod = getSelectedMonthYearForCurrentTenant(state);
359
394
  const monthYearPeriodId = selectedPeriod != null ? (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod) : undefined;
360
395
  const matchIds = monthYearPeriodId != null ? matchIdsByPeriod[monthYearPeriodId] : undefined;
@@ -370,32 +405,6 @@ function getExpenseAutomationActualMatchingView(state) {
370
405
  const searchedAccruals = matchModal.accrualSearch.results
371
406
  .map((key) => (0, jeSchedulesSelector_1.getJEOneTimeAccrualByKey)(key, state.jeSchedulesState))
372
407
  .filter((accrual) => accrual != null);
373
- const openedMatch = matchModal.openedFromMatchId != null
374
- ? (0, actualMatchingSelector_1.getActualMatchingMatchById)(state.actualMatchingState, matchModal.openedFromMatchId)
375
- : undefined;
376
- const pinnedAccruals = [
377
- ...(openedMatch?.members ?? []),
378
- ...(openedMatch?.leftovers ?? []),
379
- ].map(toMatchModalAccrual);
380
- const firstMember = openedMatch?.members[0];
381
- const cleared = firstMember?.cleared;
382
- const suggestion = firstMember?.matchSuggestion;
383
- const stamp = cleared ?? suggestion;
384
- const consumedLineIds = cleared?.consumedLineIds;
385
- const prefill = openedMatch == null
386
- ? undefined
387
- : {
388
- selectedAccrualIds: [
389
- ...openedMatch.members.map((member) => member.accrualId),
390
- ...(openedMatch.leftovers ?? []).map((leftover) => leftover.accrualId),
391
- ],
392
- actualAmount: openedMatch.actualAmount.amount,
393
- matchedTransactionId: stamp?.matchedTransactionId,
394
- matchedLineId: cleared == null ? suggestion?.matchedLineId : undefined,
395
- ...(consumedLineIds != null && consumedLineIds.length > 0
396
- ? { consumedLineIds }
397
- : {}),
398
- };
399
408
  // `fetchState` is a flat slice field that survives a period switch. Until this
400
409
  // month's ids land, leftover Completed/Error is the previous month. Report
401
410
  // Not-Started so chrome matches Review's "cache slot missing" skeleton, not
@@ -413,16 +422,16 @@ function getExpenseAutomationActualMatchingView(state) {
413
422
  kpiSummary,
414
423
  uiState,
415
424
  refreshStatus,
425
+ ignoreStatusByMatchId,
426
+ undoReversalStatusByMatchId,
416
427
  hasLoadedForSelectedPeriod: matchIds != null,
417
428
  matchModal: {
418
429
  isOpen: matchModal.isOpen,
419
- openedFromMatchId: matchModal.openedFromMatchId,
420
- prefill,
421
430
  confirmStatus: matchModal.confirmStatus,
422
431
  lastBatchResults: matchModal.lastBatchResults,
423
432
  transactionSearch: {
424
433
  query: matchModal.transactionSearch.query,
425
- results: uniqueTransactionSearchResults(matchModal.pinnedTransactionResults, matchModal.transactionSearch.results),
434
+ results: matchModal.transactionSearch.results,
426
435
  fetchState: {
427
436
  fetchState: matchModal.transactionSearch.fetchState,
428
437
  error: matchModal.transactionSearch.error,
@@ -432,7 +441,7 @@ function getExpenseAutomationActualMatchingView(state) {
432
441
  },
433
442
  accrualSearch: {
434
443
  query: matchModal.accrualSearch.query,
435
- results: uniqueMatchModalAccruals(pinnedAccruals, searchedAccruals),
444
+ results: searchedAccruals,
436
445
  fetchState: {
437
446
  fetchState: matchModal.accrualSearch.fetchState,
438
447
  error: matchModal.accrualSearch.error,
@@ -5,6 +5,8 @@ import { ActualMatchingMatchId } from '../../../entity/actualMatching/actualMatc
5
5
  import { JEOneTimeAccrualKey } from '../../../entity/jeSchedules/jeSchedulesTypes';
6
6
  export declare const toActualMatchingSortKey: (v: string) => "type" | "date" | "vendor" | "category" | "class" | "amount" | "variance" | "lifecycle" | "service" | "accrued" | "actual";
7
7
  export type ActualMatchingSortKey = ReturnType<typeof toActualMatchingSortKey>;
8
+ export declare const toActualMatchingStatusFilter: (v: string) => "pending_review" | "reversed" | "all";
9
+ export type ActualMatchingStatusFilter = ReturnType<typeof toActualMatchingStatusFilter>;
8
10
  export declare const MATCH_TRANSACTION_SEARCH_PAGE_SIZE = 50;
9
11
  export declare const MATCH_ACCRUAL_SEARCH_LIMIT = 50;
10
12
  export declare const MATCH_SEARCH_DEBOUNCE_MS = 300;
@@ -18,6 +20,11 @@ export interface ActualMatchingViewUIState {
18
20
  searchString: string;
19
21
  sortKey: ActualMatchingSortKey;
20
22
  sortOrder: SortOrder;
23
+ /**
24
+ * Unused by the list: Pending review and Reversed always render as separate
25
+ * tables. Kept so persisted UI state and older clients still hydrate.
26
+ */
27
+ statusFilter: ActualMatchingStatusFilter;
21
28
  }
22
29
  /**
23
30
  * Sibling of Missing Receipts `MatchCandidate`. Confirm needs `lineId` and
@@ -69,6 +76,14 @@ export interface UndoReversalAccrualsParams {
69
76
  accrualIds: ID[];
70
77
  matchId: ActualMatchingMatchId;
71
78
  }
79
+ export declare const toActualMatchingIgnoreReasonType: (v: string) => "other_ignore" | "already_handled" | "amount_off" | "wrong_period" | "wrong_bill";
80
+ export type ActualMatchingIgnoreReasonType = ReturnType<typeof toActualMatchingIgnoreReasonType>;
81
+ export declare const ALL_ACTUAL_MATCHING_IGNORE_REASONS: readonly ActualMatchingIgnoreReasonType[];
82
+ export interface IgnoreActualMatchingSuggestionParams {
83
+ matchId: ActualMatchingMatchId;
84
+ reason: ActualMatchingIgnoreReasonType;
85
+ note?: string;
86
+ }
72
87
  export interface ActualMatchingTransactionSearchState extends FetchStateAndError {
73
88
  isLoadingMore: boolean;
74
89
  nextPageToken: string | null;
@@ -84,18 +99,18 @@ export interface ActualMatchingAccrualSearchState extends FetchStateAndError {
84
99
  export interface ActualMatchingMatchModalState {
85
100
  accrualSearch: ActualMatchingAccrualSearchState;
86
101
  confirmStatus: FetchStateAndError;
87
- didPinPrefillTransactions: boolean;
88
102
  isOpen: boolean;
89
- pinnedTransactionResults: ActualMatchingTransactionSearchResult[];
90
103
  transactionSearch: ActualMatchingTransactionSearchState;
91
104
  lastBatchResults?: MatchAndReverseResult[];
92
- openedFromMatchId?: ActualMatchingMatchId;
93
105
  }
94
106
  export declare function actualMatchingTransactionLineKey(transactionType: string, transactionIntegrationId: string, lineId: string): string;
95
107
  export interface ActualMatchingViewState extends FetchedState {
96
- closeMatchAfterUndo: boolean;
108
+ closeMatchAfterIgnoreMatchIds: ActualMatchingMatchId[];
109
+ closeMatchAfterUndoMatchIds: ActualMatchingMatchId[];
110
+ confirmStatusByMatchId: Record<ActualMatchingMatchId, FetchStateAndError>;
97
111
  detailFetchStateByMatchId: Record<ActualMatchingMatchId, FetchStateAndError>;
98
112
  detailRefreshStatusByMatchId: Record<ActualMatchingMatchId, FetchStateAndError>;
113
+ ignoreStatusByMatchId: Record<ActualMatchingMatchId, FetchStateAndError>;
99
114
  lastMatchResultsByMatchId: Record<ActualMatchingMatchId, MatchAndReverseResult[]>;
100
115
  lastUndoResultsByMatchId: Record<ActualMatchingMatchId, UndoReversalResult[]>;
101
116
  matchIdsByPeriod: Record<MonthYearPeriodId, ActualMatchingMatchId[]>;