@zeniai/client-epic-state 5.2.34-beta0ND → 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 (114) 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/entity/notificationRegistry/notificationRegistryReducer.d.ts +1 -2
  15. package/lib/entity/notificationRegistry/notificationRegistryReducer.js +9 -20
  16. package/lib/entity/notificationRegistry/notificationRegistrySelector.d.ts +1 -2
  17. package/lib/entity/notificationRegistry/notificationRegistrySelector.js +1 -7
  18. package/lib/entity/notificationRegistry/notificationRegistryState.d.ts +0 -5
  19. package/lib/entity/notificationRegistry/notificationRegistryState.js +1 -7
  20. package/lib/entity/sectionProjectView/sectionProjectViewReducer.js +1 -3
  21. package/lib/epic.d.ts +8 -1
  22. package/lib/epic.js +18 -4
  23. package/lib/esm/entity/actualMatching/actualMatchingPayload.js +40 -0
  24. package/lib/esm/entity/actualMatching/actualMatchingReducer.js +30 -0
  25. package/lib/esm/entity/actualMatching/actualMatchingSelector.js +3 -0
  26. package/lib/esm/entity/actualMatching/actualMatchingState.js +1 -0
  27. package/lib/esm/entity/actualMatching/actualMatchingTypes.js +1 -0
  28. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +49 -0
  29. package/lib/esm/entity/notificationRegistry/notificationRegistryReducer.js +9 -20
  30. package/lib/esm/entity/notificationRegistry/notificationRegistrySelector.js +0 -5
  31. package/lib/esm/entity/notificationRegistry/notificationRegistryState.js +0 -5
  32. package/lib/esm/entity/sectionProjectView/sectionProjectViewReducer.js +1 -3
  33. package/lib/esm/epic.js +18 -4
  34. package/lib/esm/index.js +10 -6
  35. package/lib/esm/reducer.js +6 -0
  36. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +2 -4
  37. package/lib/esm/view/aiCfoView/epics/fetchRoutineRunsEpic.js +1 -3
  38. package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +46 -0
  39. package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingMatchEpic.js +35 -0
  40. package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +7 -0
  41. package/lib/esm/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +52 -0
  42. package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +44 -0
  43. package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +73 -0
  44. package/lib/esm/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.js +52 -0
  45. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +28 -11
  46. package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
  47. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js +3 -1
  48. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +5 -0
  49. package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +22 -7
  50. package/lib/esm/view/expenseAutomationView/payload/actualMatchingPayload.js +68 -0
  51. package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +364 -0
  52. package/lib/esm/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +1 -0
  53. package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +281 -0
  54. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +3 -0
  55. package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +32 -0
  56. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -1
  57. package/lib/esm/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.js +7 -20
  58. package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewReducer.js +17 -43
  59. package/lib/esm/view/notificationPreferencesView/notificationPreferencesViewSelector.js +4 -24
  60. package/lib/esm/view/settingsView/epic/fetchNotificationSettingsEpic.js +2 -12
  61. package/lib/index.d.ts +16 -8
  62. package/lib/index.js +78 -55
  63. package/lib/reducer.d.ts +2 -0
  64. package/lib/reducer.js +6 -0
  65. package/lib/rootStateTypes.d.ts +4 -0
  66. package/lib/view/aiCfoView/aiCfoViewReducer.js +2 -4
  67. package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +1 -1
  68. package/lib/view/aiCfoView/epics/fetchRoutineRunsEpic.js +1 -3
  69. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.d.ts +9 -0
  70. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +50 -0
  71. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingMatchEpic.d.ts +12 -0
  72. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingMatchEpic.js +39 -0
  73. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.d.ts +5 -0
  74. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +11 -0
  75. package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.d.ts +8 -0
  76. package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +56 -0
  77. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.d.ts +8 -0
  78. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +48 -0
  79. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.d.ts +8 -0
  80. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +77 -0
  81. package/lib/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.d.ts +8 -0
  82. package/lib/view/expenseAutomationView/epics/actualMatching/undoReversalAccrualsEpic.js +56 -0
  83. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +2 -1
  84. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +28 -11
  85. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +2 -1
  86. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
  87. package/lib/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js +3 -1
  88. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +2 -1
  89. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +5 -0
  90. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +22 -7
  91. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +85 -0
  92. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.js +74 -0
  93. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +74 -0
  94. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +368 -0
  95. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +4 -4
  96. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +83 -0
  97. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +2 -0
  98. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +2 -0
  99. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +29 -0
  100. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +296 -0
  101. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +3 -0
  102. package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +99 -0
  103. package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +38 -0
  104. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +1 -1
  105. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -1
  106. package/lib/view/notificationPreferencesView/epics/saveNotificationPreferencesEpic.js +6 -19
  107. package/lib/view/notificationPreferencesView/notificationPreferencesViewReducer.d.ts +5 -8
  108. package/lib/view/notificationPreferencesView/notificationPreferencesViewReducer.js +17 -43
  109. package/lib/view/notificationPreferencesView/notificationPreferencesViewSelector.d.ts +0 -4
  110. package/lib/view/notificationPreferencesView/notificationPreferencesViewSelector.js +5 -30
  111. package/lib/view/notificationPreferencesView/notificationPreferencesViewState.d.ts +3 -4
  112. package/lib/view/settingsView/epic/fetchNotificationSettingsEpic.js +2 -12
  113. package/lib/view/settingsView/settingsViewPayload.d.ts +0 -2
  114. package/package.json +1 -1
package/lib/reducer.d.ts CHANGED
@@ -67,6 +67,7 @@ declare const reducers: import("redux").Reducer<import("redux").CombinedState<{
67
67
  entityAutoCompleteState: import("./view/autoComplete/entityAutoCompleteState").EntityAutoCompleteState;
68
68
  entityRecommendationState: import("./view/recommendation/recommendationState").EntityRecommendationState;
69
69
  expenseAutomationFluxAnalysisViewState: import("./view/expenseAutomationView/types/fluxAnalysisViewState").FluxAnalysisViewState;
70
+ expenseAutomationActualMatchingViewState: import("./view/expenseAutomationView/types/actualMatchingViewState").ActualMatchingViewState;
70
71
  expenseAutomationJESchedulesViewState: import("./view/expenseAutomationView/types/jeSchedulesViewState").JESchedulesViewState;
71
72
  expenseAutomationMissingReceiptsViewState: import(".").ExpenseAutomationMissingReceiptsViewState;
72
73
  expenseAutomationReconciliationViewState: import("./view/expenseAutomationView/types/reconciliationViewState").ReconciliationViewState;
@@ -203,6 +204,7 @@ declare const reducers: import("redux").Reducer<import("redux").CombinedState<{
203
204
  accountReconState: import("./entity/accountRecon/accountReconState").AccountReconState;
204
205
  accountingSummaryState: import("./entity/portfolio/accountingSummary/accountingSummaryState").AccountingSummaryState;
205
206
  accountState: import("./entity/account/accountState").AccountState;
207
+ actualMatchingState: import("./entity/actualMatching/actualMatchingState").ActualMatchingState;
206
208
  addressState: import("./entity/address/addressState").AddressState;
207
209
  aiAccountantCustomerState: import(".").AiAccountantCustomerState;
208
210
  aiCfoState: import(".").AiCfoState;
package/lib/reducer.js CHANGED
@@ -81,6 +81,7 @@ const invoicingSubscriptionReducer_1 = __importStar(require("./entity/invoicing/
81
81
  const invoicingTransactionReducer_1 = __importStar(require("./entity/invoicing/invoicingTransaction/invoicingTransactionReducer"));
82
82
  const planReducer_1 = __importStar(require("./entity/invoicing/plan/planReducer"));
83
83
  const productReducer_1 = __importStar(require("./entity/invoicing/product/productReducer"));
84
+ const actualMatchingReducer_1 = __importStar(require("./entity/actualMatching/actualMatchingReducer"));
84
85
  const jeSchedulesReducer_1 = __importStar(require("./entity/jeSchedules/jeSchedulesReducer"));
85
86
  const merchantReducer_1 = __importStar(require("./entity/merchant/merchantReducer"));
86
87
  const monthEndCloseChecksReducer_1 = __importStar(require("./entity/monthEndCloseChecks/monthEndCloseChecksReducer"));
@@ -157,6 +158,7 @@ const creditAgentViewReducer_1 = __importStar(require("./view/creditAgentView/cr
157
158
  const dashboardReducer_1 = __importStar(require("./view/dashboard/dashboardReducer"));
158
159
  const dashboardLayoutReducer_1 = __importStar(require("./view/dashboardLayout/dashboardLayoutReducer"));
159
160
  const expenseAutomationViewReducer_1 = __importStar(require("./view/expenseAutomationView/expenseAutomationViewReducer"));
161
+ const actualMatchingViewReducer_1 = __importStar(require("./view/expenseAutomationView/reducers/actualMatchingViewReducer"));
160
162
  const fluxAnalysisViewReducer_1 = __importStar(require("./view/expenseAutomationView/reducers/fluxAnalysisViewReducer"));
161
163
  const jeSchedulesViewReducer_1 = __importStar(require("./view/expenseAutomationView/reducers/jeSchedulesViewReducer"));
162
164
  const missingReceiptsViewReducer_1 = __importStar(require("./view/expenseAutomationView/reducers/missingReceiptsViewReducer"));
@@ -318,6 +320,7 @@ const initialEntitiesState = {
318
320
  accountingSummaryState: accountingSummaryReducer_1.initialState,
319
321
  accountReconState: accountReconReducer_1.initialState,
320
322
  accountState: accountReducer_1.initialState,
323
+ actualMatchingState: actualMatchingReducer_1.initialState,
321
324
  addressState: addressReducer_1.initialState,
322
325
  aiAccountantCustomerState: aiAccountantCustomerReducer_1.initialAiAccountantCustomerState,
323
326
  aiCfoState: aiCfoReducer_1.initialAiCfoState,
@@ -460,6 +463,7 @@ const initialViewsState = {
460
463
  entityAutoCompleteState: entityAutoCompleteReducer_1.initialState,
461
464
  entityRecommendationState: recommendationReducer_1.initialState,
462
465
  expenseAutomationFluxAnalysisViewState: fluxAnalysisViewReducer_1.initialState,
466
+ expenseAutomationActualMatchingViewState: actualMatchingViewReducer_1.initialState,
463
467
  expenseAutomationJESchedulesViewState: jeSchedulesViewReducer_1.initialState,
464
468
  expenseAutomationMissingReceiptsViewState: missingReceiptsViewReducer_1.initialState,
465
469
  expenseAutomationReconciliationViewState: reconciliationViewReducer_1.initialState,
@@ -602,6 +606,7 @@ const entityReducers = {
602
606
  accountReconState: accountReconReducer_1.default,
603
607
  accountingSummaryState: accountingSummaryReducer_1.default,
604
608
  accountState: accountReducer_1.default,
609
+ actualMatchingState: actualMatchingReducer_1.default,
605
610
  addressState: addressReducer_1.default,
606
611
  aiAccountantCustomerState: aiAccountantCustomerReducer_1.default,
607
612
  aiCfoState: aiCfoReducer_1.default,
@@ -744,6 +749,7 @@ const viewReducers = {
744
749
  entityAutoCompleteState: entityAutoCompleteReducer_1.default,
745
750
  entityRecommendationState: recommendationReducer_1.default,
746
751
  expenseAutomationFluxAnalysisViewState: fluxAnalysisViewReducer_1.default,
752
+ expenseAutomationActualMatchingViewState: actualMatchingViewReducer_1.default,
747
753
  expenseAutomationJESchedulesViewState: jeSchedulesViewReducer_1.default,
748
754
  expenseAutomationMissingReceiptsViewState: missingReceiptsViewReducer_1.default,
749
755
  expenseAutomationReconciliationViewState: reconciliationViewReducer_1.default,
@@ -41,6 +41,7 @@ import { InvoicingSubscriptionState } from './entity/invoicing/invoicingSubscrip
41
41
  import { InvoicingTransactionState } from './entity/invoicing/invoicingTransaction/invoicingTransactionState';
42
42
  import { InvoicingPlanState } from './entity/invoicing/plan/planState';
43
43
  import { InvoicingProductState } from './entity/invoicing/product/productState';
44
+ import { ActualMatchingState } from './entity/actualMatching/actualMatchingState';
44
45
  import { JESchedulesState } from './entity/jeSchedules/jeSchedulesState';
45
46
  import { MerchantState } from './entity/merchant/merchant';
46
47
  import { MonthEndCloseChecksState } from './entity/monthEndCloseChecks/monthEndCloseChecksState';
@@ -116,6 +117,7 @@ import { CreditAgentViewState } from './view/creditAgentView/creditAgentViewStat
116
117
  import { DashboardState } from './view/dashboard/dashboardState';
117
118
  import { DashboardLayoutState } from './view/dashboardLayout/dashboardLayoutState';
118
119
  import { ExpenseAutomationViewState } from './view/expenseAutomationView/expenseAutomationViewState';
120
+ import { ActualMatchingViewState as ExpenseAutomationActualMatchingViewState } from './view/expenseAutomationView/types/actualMatchingViewState';
119
121
  import { FluxAnalysisViewState as ExpenseAutomationFluxAnalysisViewState } from './view/expenseAutomationView/types/fluxAnalysisViewState';
120
122
  import { JESchedulesViewState as ExpenseAutomationJESchedulesViewState } from './view/expenseAutomationView/types/jeSchedulesViewState';
121
123
  import { MissingReceiptsViewState as ExpenseAutomationMissingReceiptsViewState } from './view/expenseAutomationView/types/missingReceiptsViewState';
@@ -275,6 +277,7 @@ export type EntitiesState = {
275
277
  accountingSummaryState: AccountingSummaryState;
276
278
  accountReconState: AccountReconState;
277
279
  accountState: AccountState;
280
+ actualMatchingState: ActualMatchingState;
278
281
  addressState: AddressState;
279
282
  aiAccountantCustomerState: AiAccountantCustomerState;
280
283
  aiCfoState: AiCfoState;
@@ -421,6 +424,7 @@ export type ViewsState = {
421
424
  editRemiDetailViewState: EditRemiDetailViewState;
422
425
  entityAutoCompleteState: EntityAutoCompleteState;
423
426
  entityRecommendationState: EntityRecommendationState;
427
+ expenseAutomationActualMatchingViewState: ExpenseAutomationActualMatchingViewState;
424
428
  expenseAutomationFluxAnalysisViewState: ExpenseAutomationFluxAnalysisViewState;
425
429
  expenseAutomationJESchedulesViewState: ExpenseAutomationJESchedulesViewState;
426
430
  expenseAutomationMissingReceiptsViewState: ExpenseAutomationMissingReceiptsViewState;
@@ -840,8 +840,7 @@ const aiCfoView = (0, toolkit_1.createSlice)({
840
840
  // The server has it. Nothing it sends from here on will contain this row,
841
841
  // so the tombstone has done its job and holding it any longer is what
842
842
  // makes a routine recreated under the same id invisible forever.
843
- draft.routines.deletedScheduleIds =
844
- draft.routines.deletedScheduleIds.filter((id) => id !== action.payload.scheduleId);
843
+ draft.routines.deletedScheduleIds = draft.routines.deletedScheduleIds.filter((id) => id !== action.payload.scheduleId);
845
844
  draft.routineMutation = {
846
845
  fetchState: 'Completed',
847
846
  error: undefined,
@@ -853,8 +852,7 @@ const aiCfoView = (0, toolkit_1.createSlice)({
853
852
  // is what lets the refetch put the row back — leaving it hidden would
854
853
  // tell the user they had stopped something they had not, which is the
855
854
  // worst outcome this list can produce.
856
- draft.routines.deletedScheduleIds =
857
- draft.routines.deletedScheduleIds.filter((id) => id !== action.payload.scheduleId);
855
+ draft.routines.deletedScheduleIds = draft.routines.deletedScheduleIds.filter((id) => id !== action.payload.scheduleId);
858
856
  // Its own slice: the refetch that puts the row back would otherwise wipe
859
857
  // this error, leaving the row silently reappearing with no explanation.
860
858
  draft.routineMutation = {
@@ -4,7 +4,7 @@ import { FetchStateAndError } from '../../commonStateTypes/common';
4
4
  import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
5
5
  import { AiCfoSelectorView } from '../../entity/aiCfo/aiCfoSelector';
6
6
  import { RootState } from '../../rootStateTypes';
7
- import { AiCfoViewUIState, RoutineMutationState, RoutineRunsState, RoutinesState, SkillDetailState, SkillMutationState, SkillVersionBodyState, SkillVersionsState, SkillsState, SuggestedQuestionsForPageContext } from './aiCfoViewState';
7
+ import { AiCfoViewUIState, SkillDetailState, SkillMutationState, SkillVersionBodyState, SkillVersionsState, RoutineMutationState, RoutineRunsState, RoutinesState, SkillsState, SuggestedQuestionsForPageContext } from './aiCfoViewState';
8
8
  export interface AiCfoViewSelector extends SelectorView, AiCfoSelectorView {
9
9
  createSessionAndSubmitState: FetchStateAndError;
10
10
  createSessionState: FetchStateAndError;
@@ -30,9 +30,7 @@ const fetchRoutineRunsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, o
30
30
  // Filtered, not trusted: one malformed row must not take the
31
31
  // whole history down, and a run without an id is not addressable
32
32
  // by anything the UI does with it.
33
- runs: (data.runs ?? [])
34
- .filter(toRoutineRun_1.isRoutineRunPayload)
35
- .map(toRoutineRun_1.toRoutineRun),
33
+ runs: (data.runs ?? []).filter(toRoutineRun_1.isRoutineRunPayload).map(toRoutineRun_1.toRoutineRun),
36
34
  scheduleId,
37
35
  sessionId: data.session_id ?? null,
38
36
  });
@@ -0,0 +1,9 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { updateActualMatchingMatches } from '../../../../entity/actualMatching/actualMatchingReducer';
4
+ import { clearAll } from '../../../../rootActions';
5
+ import { RootState } from '../../../../rootStateTypes';
6
+ import { ZeniAPI } from '../../../../zeniAPI';
7
+ import { fetchActualMatching, fetchActualMatchingFailure, fetchActualMatchingSuccess } from '../../reducers/actualMatchingViewReducer';
8
+ export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof fetchActualMatching> | ReturnType<typeof fetchActualMatchingFailure> | ReturnType<typeof fetchActualMatchingSuccess> | ReturnType<typeof updateActualMatchingMatches>;
9
+ export declare const fetchActualMatchingEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchActualMatchingEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const actualMatchingReducer_1 = require("../../../../entity/actualMatching/actualMatchingReducer");
7
+ const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
8
+ const responsePayload_1 = require("../../../../responsePayload");
9
+ const rootActions_1 = require("../../../../rootActions");
10
+ const actualMatchingPayload_1 = require("../../payload/actualMatchingPayload");
11
+ const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
12
+ const fetchActualMatchingEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.fetchActualMatching.match), (0, operators_1.switchMap)((action) => {
13
+ const state = state$.value;
14
+ const { period, refreshViewInBackground } = action.payload;
15
+ const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
16
+ const selectedPeriod = state.expenseAutomationViewState
17
+ .selectedPeriodByTenantId[currentTenant?.tenantId ?? ''] ?? {
18
+ month: period.start.month,
19
+ year: period.start.year,
20
+ };
21
+ const serviceMonth = (0, actualMatchingPayload_1.toServiceMonthFromPeriod)(period);
22
+ return zeniAPI
23
+ .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/actual-matching?service_month=${encodeURIComponent(serviceMonth)}`)
24
+ .pipe((0, operators_1.mergeMap)((response) => {
25
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
26
+ const matches = response.data.matches;
27
+ const updateActions = [];
28
+ if (matches.length > 0) {
29
+ updateActions.push((0, actualMatchingReducer_1.updateActualMatchingMatches)(matches));
30
+ }
31
+ updateActions.push((0, actualMatchingViewReducer_1.fetchActualMatchingSuccess)({
32
+ matchIds: matches.map((match) => match.match_id),
33
+ selectedPeriod,
34
+ refreshViewInBackground,
35
+ }));
36
+ return (0, rxjs_1.from)(updateActions);
37
+ }
38
+ return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.fetchActualMatchingFailure)({
39
+ status: response.status,
40
+ selectedPeriod,
41
+ refreshViewInBackground,
42
+ }));
43
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.fetchActualMatchingFailure)({
44
+ status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'fetch actual matching REST API call errored out' +
45
+ JSON.stringify(error)),
46
+ selectedPeriod,
47
+ refreshViewInBackground,
48
+ }))), (0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
49
+ }));
50
+ exports.fetchActualMatchingEpic = fetchActualMatchingEpic;
@@ -0,0 +1,12 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { ActualMatchingMatchPayload } from '../../../../entity/actualMatching/actualMatchingPayload';
4
+ import { updateActualMatchingMatches } from '../../../../entity/actualMatching/actualMatchingReducer';
5
+ import { ZeniAPIResponse } from '../../../../responsePayload';
6
+ import { clearAll } from '../../../../rootActions';
7
+ import { RootState } from '../../../../rootStateTypes';
8
+ import { ZeniAPI } from '../../../../zeniAPI';
9
+ import { fetchActualMatchingMatch, fetchActualMatchingMatchFailure, fetchActualMatchingMatchSuccess } from '../../reducers/actualMatchingViewReducer';
10
+ export type ActualMatchingMatchResponse = ZeniAPIResponse<ActualMatchingMatchPayload>;
11
+ export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof fetchActualMatchingMatch> | ReturnType<typeof fetchActualMatchingMatchFailure> | ReturnType<typeof fetchActualMatchingMatchSuccess> | ReturnType<typeof updateActualMatchingMatches>;
12
+ export declare const fetchActualMatchingMatchEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,39 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchActualMatchingMatchEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const actualMatchingReducer_1 = require("../../../../entity/actualMatching/actualMatchingReducer");
7
+ const responsePayload_1 = require("../../../../responsePayload");
8
+ const rootActions_1 = require("../../../../rootActions");
9
+ const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
10
+ const fetchActualMatchingMatchEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.fetchActualMatchingMatch.match), (0, operators_1.mergeMap)((action) => {
11
+ const { matchId, refreshViewInBackground } = action.payload;
12
+ return zeniAPI
13
+ .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/actual-matching/${encodeURIComponent(matchId)}`)
14
+ .pipe((0, operators_1.mergeMap)((response) => {
15
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
16
+ return (0, rxjs_1.from)([
17
+ (0, actualMatchingReducer_1.updateActualMatchingMatches)([response.data]),
18
+ (0, actualMatchingViewReducer_1.fetchActualMatchingMatchSuccess)({
19
+ matchId,
20
+ refreshViewInBackground,
21
+ }),
22
+ ]);
23
+ }
24
+ return (0, rxjs_1.from)([
25
+ (0, actualMatchingViewReducer_1.fetchActualMatchingMatchFailure)({
26
+ matchId,
27
+ refreshViewInBackground,
28
+ status: response.status,
29
+ }),
30
+ ]);
31
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
32
+ (0, actualMatchingViewReducer_1.fetchActualMatchingMatchFailure)({
33
+ matchId,
34
+ refreshViewInBackground,
35
+ status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Fetch actual matching match REST API call errored out ${JSON.stringify(error)}`),
36
+ }),
37
+ ])), (0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
38
+ }));
39
+ exports.fetchActualMatchingMatchEpic = fetchActualMatchingMatchEpic;
@@ -0,0 +1,5 @@
1
+ import { ActionsObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { fetchActualMatching, fetchActualMatchingPage } from '../../reducers/actualMatchingViewReducer';
4
+ export type ActionType = ReturnType<typeof fetchActualMatching> | ReturnType<typeof fetchActualMatchingPage>;
5
+ export declare const fetchActualMatchingPageEpic: (actions$: ActionsObservable<ActionType>) => Observable<ActionType>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchActualMatchingPageEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
7
+ const fetchActualMatchingPageEpic = (actions$) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.fetchActualMatchingPage.match), (0, operators_1.mergeMap)((action) => {
8
+ const { period, refreshViewInBackground } = action.payload;
9
+ return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.fetchActualMatching)(period, refreshViewInBackground));
10
+ }));
11
+ exports.fetchActualMatchingPageEpic = fetchActualMatchingPageEpic;
@@ -0,0 +1,8 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { clearAll } from '../../../../rootActions';
4
+ import { RootState } from '../../../../rootStateTypes';
5
+ import { ZeniAPI } from '../../../../zeniAPI';
6
+ import { clearMatchNewModal, fetchActualMatching, matchAndReverseAccruals, matchAndReverseAccrualsFailure, matchAndReverseAccrualsSuccess } from '../../reducers/actualMatchingViewReducer';
7
+ export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof clearMatchNewModal> | ReturnType<typeof fetchActualMatching> | ReturnType<typeof matchAndReverseAccruals> | ReturnType<typeof matchAndReverseAccrualsFailure> | ReturnType<typeof matchAndReverseAccrualsSuccess>;
8
+ export declare const matchAndReverseAccrualsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.matchAndReverseAccrualsEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
7
+ const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
8
+ const responsePayload_1 = require("../../../../responsePayload");
9
+ const rootActions_1 = require("../../../../rootActions");
10
+ const actualMatchingPayload_1 = require("../../payload/actualMatchingPayload");
11
+ const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
12
+ function refreshActualMatchingList(state) {
13
+ const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
14
+ const selectedMonthYear = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant?.tenantId ?? ''];
15
+ if (selectedMonthYear == null) {
16
+ return [];
17
+ }
18
+ const period = (0, timePeriod_1.convertToPeriod)(selectedMonthYear);
19
+ const start = (0, timePeriod_1.toAbsoluteDay)(period.start);
20
+ const end = (0, timePeriod_1.toAbsoluteDay)(period.end);
21
+ if (start == null || end == null) {
22
+ return [];
23
+ }
24
+ return [(0, actualMatchingViewReducer_1.fetchActualMatching)({ start, end }, true)];
25
+ }
26
+ const matchAndReverseAccrualsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.matchAndReverseAccruals.match), (0, operators_1.mergeMap)((action) => {
27
+ const { transactionId, transactionIntegrationId, transactionType, lineId, accrualIds, transactionSyncToken, } = action.payload;
28
+ const body = {
29
+ transaction_id: transactionId,
30
+ transaction_integration_id: transactionIntegrationId,
31
+ transaction_type: transactionType,
32
+ line_id: lineId,
33
+ transaction_sync_token: transactionSyncToken,
34
+ accrual_ids: accrualIds,
35
+ };
36
+ return zeniAPI
37
+ .postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/match-and-reverse`, body)
38
+ .pipe((0, operators_1.mergeMap)((response) => {
39
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
40
+ const results = response.data.results.map(actualMatchingPayload_1.toMatchAndReverseResult);
41
+ const successActions = [
42
+ (0, actualMatchingViewReducer_1.matchAndReverseAccrualsSuccess)({ results }),
43
+ ];
44
+ const anyReversed = results.some((result) => result.status === 'reversed');
45
+ if (anyReversed) {
46
+ successActions.push(...refreshActualMatchingList(state$.value), (0, actualMatchingViewReducer_1.clearMatchNewModal)());
47
+ }
48
+ return (0, rxjs_1.from)(successActions);
49
+ }
50
+ return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.matchAndReverseAccrualsFailure)({ status: response.status }));
51
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.matchAndReverseAccrualsFailure)({
52
+ status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Match and reverse accruals REST API call errored out' +
53
+ JSON.stringify(error)),
54
+ }))), (0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
55
+ }));
56
+ exports.matchAndReverseAccrualsEpic = matchAndReverseAccrualsEpic;
@@ -0,0 +1,8 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { updateJEOneTimeAccruals } from '../../../../entity/jeSchedules/jeSchedulesReducer';
4
+ import { RootState } from '../../../../rootStateTypes';
5
+ import { ZeniAPI } from '../../../../zeniAPI';
6
+ import { searchMatchAccruals, searchMatchAccrualsFailure, searchMatchAccrualsSuccess } from '../../reducers/actualMatchingViewReducer';
7
+ export type ActionType = ReturnType<typeof searchMatchAccruals> | ReturnType<typeof searchMatchAccrualsFailure> | ReturnType<typeof searchMatchAccrualsSuccess> | ReturnType<typeof updateJEOneTimeAccruals>;
8
+ export declare const searchMatchAccrualsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.searchMatchAccrualsEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const jeSchedulesReducer_1 = require("../../../../entity/jeSchedules/jeSchedulesReducer");
7
+ const responsePayload_1 = require("../../../../responsePayload");
8
+ const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
9
+ const actualMatchingViewState_1 = require("../../types/actualMatchingViewState");
10
+ const searchMatchAccrualsEpic = (actions$, _state$, zeniAPI) => {
11
+ const searchActions$ = actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.searchMatchAccruals.match));
12
+ const pagination$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken != null));
13
+ const newSearchDebounced$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken == null), (0, operators_1.debounceTime)(actualMatchingViewState_1.MATCH_SEARCH_DEBOUNCE_MS));
14
+ return (0, rxjs_1.merge)(pagination$, newSearchDebounced$).pipe((0, operators_1.switchMap)((action) => {
15
+ const { query, pageToken } = action.payload;
16
+ const offset = pageToken != null && pageToken.length > 0 ? Number(pageToken) : 0;
17
+ const searchText = encodeURIComponent(query);
18
+ const limit = actualMatchingViewState_1.MATCH_ACCRUAL_SEARCH_LIMIT;
19
+ return zeniAPI
20
+ .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals?status=posted&reversal_policy=on_bill_match&search_text=${searchText}&limit=${limit}&offset=${offset}`)
21
+ .pipe((0, operators_1.mergeMap)((response) => {
22
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
23
+ const accruals = response.data.accruals;
24
+ const append = pageToken != null;
25
+ const nextOffset = offset + accruals.length;
26
+ const total = response.data.total ?? nextOffset;
27
+ const nextPageToken = nextOffset < total ? String(nextOffset) : null;
28
+ const actionsOut = [];
29
+ if (accruals.length > 0) {
30
+ actionsOut.push((0, jeSchedulesReducer_1.updateJEOneTimeAccruals)(accruals));
31
+ }
32
+ actionsOut.push((0, actualMatchingViewReducer_1.searchMatchAccrualsSuccess)({
33
+ append,
34
+ nextPageToken,
35
+ results: accruals,
36
+ }));
37
+ return (0, rxjs_1.from)(actionsOut);
38
+ }
39
+ return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchAccrualsFailure)({
40
+ error: response.status,
41
+ }));
42
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchAccrualsFailure)({
43
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Search match accruals REST API call errored out' +
44
+ JSON.stringify(error)),
45
+ }))));
46
+ }));
47
+ };
48
+ exports.searchMatchAccrualsEpic = searchMatchAccrualsEpic;
@@ -0,0 +1,8 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { clearAll } from '../../../../rootActions';
4
+ import { RootState } from '../../../../rootStateTypes';
5
+ import { ZeniAPI } from '../../../../zeniAPI';
6
+ import { openMatchNewModal, searchMatchAccruals, searchMatchTransactions, searchMatchTransactionsFailure, searchMatchTransactionsSuccess } from '../../reducers/actualMatchingViewReducer';
7
+ export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof openMatchNewModal> | ReturnType<typeof searchMatchAccruals> | ReturnType<typeof searchMatchTransactions> | ReturnType<typeof searchMatchTransactionsFailure> | ReturnType<typeof searchMatchTransactionsSuccess>;
8
+ export declare const searchMatchTransactionsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,77 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.searchMatchTransactionsEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const actualMatchingSelector_1 = require("../../../../entity/actualMatching/actualMatchingSelector");
7
+ const responsePayload_1 = require("../../../../responsePayload");
8
+ const actualMatchingPayload_1 = require("../../payload/actualMatchingPayload");
9
+ const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
10
+ const actualMatchingViewSelector_1 = require("../../selectors/actualMatchingViewSelector");
11
+ const actualMatchingViewState_1 = require("../../types/actualMatchingViewState");
12
+ const searchMatchTransactionsEpic = (actions$, state$, zeniAPI) => {
13
+ const openModal$ = actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.openMatchNewModal.match), (0, operators_1.mergeMap)((action) => {
14
+ const matchId = action.payload.matchId;
15
+ if (matchId == null || matchId === '') {
16
+ return (0, rxjs_1.from)([
17
+ (0, actualMatchingViewReducer_1.searchMatchTransactions)({ query: '' }),
18
+ (0, actualMatchingViewReducer_1.searchMatchAccruals)({ query: '' }),
19
+ ]);
20
+ }
21
+ const match = (0, actualMatchingSelector_1.getActualMatchingMatchById)(state$.value.actualMatchingState, matchId);
22
+ const parsed = (0, actualMatchingViewSelector_1.parseActualMatchingMatchId)(matchId);
23
+ const transactionType = match?.transactionType != null && match.transactionType !== ''
24
+ ? match.transactionType
25
+ : parsed?.transactionType;
26
+ const transactionIntegrationId = match?.transactionIntegrationId != null &&
27
+ match.transactionIntegrationId !== ''
28
+ ? match.transactionIntegrationId
29
+ : parsed?.transactionIntegrationId;
30
+ return (0, rxjs_1.from)([
31
+ (0, actualMatchingViewReducer_1.searchMatchTransactions)({
32
+ query: '',
33
+ transactionType,
34
+ transactionIntegrationId,
35
+ }),
36
+ ]);
37
+ }));
38
+ const searchActions$ = actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.searchMatchTransactions.match));
39
+ const pagination$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken != null));
40
+ const newSearchDebounced$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken == null), (0, operators_1.debounceTime)(actualMatchingViewState_1.MATCH_SEARCH_DEBOUNCE_MS));
41
+ const search$ = (0, rxjs_1.merge)(pagination$, newSearchDebounced$).pipe((0, operators_1.switchMap)((action) => {
42
+ const { query, pageToken, transactionType, transactionIntegrationId } = action.payload;
43
+ const queryParam = {
44
+ search_text: query,
45
+ page_size: actualMatchingViewState_1.MATCH_TRANSACTION_SEARCH_PAGE_SIZE,
46
+ ...(pageToken != null ? { page_token: pageToken } : {}),
47
+ ...(transactionType != null && transactionType !== ''
48
+ ? { transaction_type: transactionType }
49
+ : {}),
50
+ ...(transactionIntegrationId != null && transactionIntegrationId !== ''
51
+ ? { transaction_integration_id: transactionIntegrationId }
52
+ : {}),
53
+ };
54
+ return zeniAPI
55
+ .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/match-transaction-search?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
56
+ .pipe((0, operators_1.mergeMap)((response) => {
57
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
58
+ const { transactions, next_page_token } = response.data;
59
+ const append = pageToken != null;
60
+ const results = transactions.map(actualMatchingPayload_1.toActualMatchingTransactionSearchResult);
61
+ return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchTransactionsSuccess)({
62
+ append,
63
+ nextPageToken: next_page_token ?? null,
64
+ results,
65
+ }));
66
+ }
67
+ return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchTransactionsFailure)({
68
+ error: response.status,
69
+ }));
70
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchTransactionsFailure)({
71
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Search match transactions REST API call errored out' +
72
+ JSON.stringify(error)),
73
+ }))));
74
+ }));
75
+ return (0, rxjs_1.merge)(openModal$, search$);
76
+ };
77
+ exports.searchMatchTransactionsEpic = searchMatchTransactionsEpic;
@@ -0,0 +1,8 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { clearAll } from '../../../../rootActions';
4
+ import { RootState } from '../../../../rootStateTypes';
5
+ import { ZeniAPI } from '../../../../zeniAPI';
6
+ import { fetchActualMatching, fetchActualMatchingMatch, undoReversalAccruals, undoReversalAccrualsFailure, undoReversalAccrualsSuccess } from '../../reducers/actualMatchingViewReducer';
7
+ export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof fetchActualMatching> | ReturnType<typeof fetchActualMatchingMatch> | ReturnType<typeof undoReversalAccruals> | ReturnType<typeof undoReversalAccrualsFailure> | ReturnType<typeof undoReversalAccrualsSuccess>;
8
+ export declare const undoReversalAccrualsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,56 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.undoReversalAccrualsEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
7
+ const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
8
+ const responsePayload_1 = require("../../../../responsePayload");
9
+ const rootActions_1 = require("../../../../rootActions");
10
+ const actualMatchingPayload_1 = require("../../payload/actualMatchingPayload");
11
+ const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
12
+ function refreshActualMatchingList(state) {
13
+ const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
14
+ const selectedMonthYear = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant?.tenantId ?? ''];
15
+ if (selectedMonthYear == null) {
16
+ return [];
17
+ }
18
+ const period = (0, timePeriod_1.convertToPeriod)(selectedMonthYear);
19
+ const start = (0, timePeriod_1.toAbsoluteDay)(period.start);
20
+ const end = (0, timePeriod_1.toAbsoluteDay)(period.end);
21
+ if (start == null || end == null) {
22
+ return [];
23
+ }
24
+ return [(0, actualMatchingViewReducer_1.fetchActualMatching)({ start, end }, true)];
25
+ }
26
+ function refreshOpenMatchDetails(state) {
27
+ const detailState = state.expenseAutomationActualMatchingViewState.detailFetchStateByMatchId;
28
+ return Object.keys(detailState)
29
+ .filter((matchId) => detailState[matchId]?.fetchState !== 'Not-Started')
30
+ .map((matchId) => (0, actualMatchingViewReducer_1.fetchActualMatchingMatch)(matchId, true));
31
+ }
32
+ const undoReversalAccrualsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.undoReversalAccruals.match), (0, operators_1.mergeMap)((action) => {
33
+ const body = {
34
+ accrual_ids: action.payload.accrualIds,
35
+ };
36
+ return zeniAPI
37
+ .postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/undo-reversal`, body)
38
+ .pipe((0, operators_1.mergeMap)((response) => {
39
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
40
+ const results = response.data.results.map(actualMatchingPayload_1.toUndoReversalResult);
41
+ const successActions = [
42
+ (0, actualMatchingViewReducer_1.undoReversalAccrualsSuccess)({ results }),
43
+ ];
44
+ const anyUndone = results.some((result) => result.status === 'undone');
45
+ if (anyUndone) {
46
+ successActions.push(...refreshActualMatchingList(state$.value), ...refreshOpenMatchDetails(state$.value));
47
+ }
48
+ return (0, rxjs_1.from)(successActions);
49
+ }
50
+ return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.undoReversalAccrualsFailure)({ status: response.status }));
51
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.undoReversalAccrualsFailure)({
52
+ status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Undo reversal accruals REST API call errored out' +
53
+ JSON.stringify(error)),
54
+ }))), (0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
55
+ }));
56
+ exports.undoReversalAccrualsEpic = undoReversalAccrualsEpic;
@@ -3,10 +3,11 @@ import { Observable } from 'rxjs';
3
3
  import { RootState } from '../../../../rootStateTypes';
4
4
  import { fetchMonthEndCloseChecks } from '../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer';
5
5
  import { fetchAllExpenseAutomationTabs } from '../../expenseAutomationViewReducer';
6
+ import { fetchActualMatchingPage } from '../../reducers/actualMatchingViewReducer';
6
7
  import { fetchFluxAnalysisView } from '../../reducers/fluxAnalysisViewReducer';
7
8
  import { fetchJeSchedulesPage } from '../../reducers/jeSchedulesViewReducer';
8
9
  import { fetchMissingReceipts } from '../../reducers/missingReceiptsViewReducer';
9
10
  import { fetchReconciliation } from '../../reducers/reconciliationViewReducer';
10
11
  import { fetchTransactionCategorizationView } from '../../reducers/transactionsViewReducer';
11
- export type ActionType = ReturnType<typeof fetchAllExpenseAutomationTabs> | ReturnType<typeof fetchMissingReceipts> | ReturnType<typeof fetchMonthEndCloseChecks> | ReturnType<typeof fetchFluxAnalysisView> | ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof fetchReconciliation> | ReturnType<typeof fetchTransactionCategorizationView>;
12
+ export type ActionType = ReturnType<typeof fetchAllExpenseAutomationTabs> | ReturnType<typeof fetchActualMatchingPage> | ReturnType<typeof fetchMissingReceipts> | ReturnType<typeof fetchMonthEndCloseChecks> | ReturnType<typeof fetchFluxAnalysisView> | ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof fetchReconciliation> | ReturnType<typeof fetchTransactionCategorizationView>;
12
13
  export declare const fetchAllExpenseAutomationTabsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;