@zeniai/client-epic-state 5.2.39 → 5.2.41-beta1MM
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.
- package/lib/entity/actualMatching/actualMatchingPayload.d.ts +31 -0
- package/lib/entity/actualMatching/actualMatchingPayload.js +52 -0
- package/lib/entity/actualMatching/actualMatchingReducer.d.ts +9 -0
- package/lib/entity/actualMatching/actualMatchingReducer.js +33 -0
- package/lib/entity/actualMatching/actualMatchingSelector.d.ts +3 -0
- package/lib/entity/actualMatching/actualMatchingSelector.js +6 -0
- package/lib/entity/actualMatching/actualMatchingState.d.ts +23 -0
- package/lib/entity/actualMatching/actualMatchingState.js +2 -0
- package/lib/entity/actualMatching/actualMatchingTypes.d.ts +1 -0
- package/lib/entity/actualMatching/actualMatchingTypes.js +2 -0
- package/lib/entity/aiCfo/aiCfoReducer.js +78 -4
- package/lib/entity/aiCfo/aiCfoState.d.ts +16 -0
- package/lib/entity/file/fileReducer.d.ts +8 -0
- package/lib/entity/file/fileReducer.js +10 -2
- package/lib/entity/invoicing/invoicingCommonPayload.d.ts +14 -1
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +31 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +53 -0
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +33 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +2 -0
- package/lib/epic.d.ts +8 -1
- package/lib/epic.js +14 -0
- package/lib/esm/entity/actualMatching/actualMatchingPayload.js +48 -0
- package/lib/esm/entity/actualMatching/actualMatchingReducer.js +30 -0
- package/lib/esm/entity/actualMatching/actualMatchingSelector.js +3 -0
- package/lib/esm/entity/actualMatching/actualMatchingState.js +1 -0
- package/lib/esm/entity/actualMatching/actualMatchingTypes.js +1 -0
- package/lib/esm/entity/aiCfo/aiCfoReducer.js +79 -5
- package/lib/esm/entity/file/fileReducer.js +10 -2
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +53 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +2 -0
- package/lib/esm/epic.js +14 -0
- package/lib/esm/index.js +7 -3
- package/lib/esm/reducer.js +6 -0
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +25 -12
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingEpic.js +46 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.js +36 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingPageEpic.js +7 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/matchAndReverseAccrualsEpic.js +108 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/refreshActualMatchingList.js +16 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchAccrualsEpic.js +60 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchTransactionsEpic.js +74 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/actualMatching/undoReversalAccrualsEpic.js +78 -0
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +13 -3
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js +40 -15
- package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +19 -8
- package/lib/esm/view/expenseAutomationView/expenseAutomationViewReducer.js +2 -1
- package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +24 -6
- package/lib/esm/view/expenseAutomationView/expenseAutomationViewState.js +4 -2
- package/lib/esm/view/expenseAutomationView/payload/actualMatchingPayload.js +68 -0
- package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +462 -0
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +2 -1
- package/lib/esm/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +1 -0
- package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +426 -0
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +4 -0
- package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +38 -0
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -1
- package/lib/esm/view/financeStatement/financeStatementReducer.js +17 -27
- package/lib/esm/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +1 -1
- package/lib/esm/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +6 -0
- package/lib/esm/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +7 -0
- package/lib/esm/view/invoicing/settingsView/invoicingBrandingFormConfig.js +1 -1
- package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +5 -0
- package/lib/esm/view/invoicing/settingsView/submitInvoicingBrandingFormEpic.js +9 -0
- package/lib/index.d.ts +14 -5
- package/lib/index.js +82 -48
- package/lib/reducer.d.ts +2 -0
- package/lib/reducer.js +6 -0
- package/lib/rootStateTypes.d.ts +4 -0
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +25 -12
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingEpic.js +50 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.d.ts +12 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingMatchEpic.js +40 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingPageEpic.d.ts +5 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingPageEpic.js +11 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/matchAndReverseAccrualsEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/matchAndReverseAccrualsEpic.js +112 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/refreshActualMatchingList.d.ts +3 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/refreshActualMatchingList.js +19 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchAccrualsEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchAccrualsEpic.js +64 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchTransactionsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchTransactionsEpic.js +78 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/undoReversalAccrualsEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/undoReversalAccrualsEpic.js +82 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +13 -3
- package/lib/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.d.ts +5 -1
- package/lib/view/expenseAutomationView/epics/jeSchedule/prefetchOtherJeSchedulesTabEpic.js +39 -14
- package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +18 -7
- package/lib/view/expenseAutomationView/expenseAutomationViewReducer.d.ts +2 -1
- package/lib/view/expenseAutomationView/expenseAutomationViewReducer.js +2 -1
- package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +24 -6
- package/lib/view/expenseAutomationView/expenseAutomationViewState.d.ts +2 -1
- package/lib/view/expenseAutomationView/expenseAutomationViewState.js +6 -3
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +85 -0
- package/lib/view/expenseAutomationView/payload/actualMatchingPayload.js +74 -0
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +79 -0
- package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +466 -0
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +6 -5
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +2 -1
- package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +87 -0
- package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +2 -0
- package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +11 -0
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +38 -0
- package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +445 -0
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +4 -0
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +106 -0
- package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +46 -0
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -1
- package/lib/view/financeStatement/financeStatementReducer.js +17 -27
- package/lib/view/invoicing/editInvoicingCustomerDetailView/editInvoicingCustomerDetailViewSelector.js +1 -1
- package/lib/view/invoicing/settingsView/epics/fetchInvoicingSettingsEpic.js +6 -0
- package/lib/view/invoicing/settingsView/epics/saveInvoicingSettingsEpic.js +7 -0
- package/lib/view/invoicing/settingsView/epics/settingsViewActionType.d.ts +2 -1
- package/lib/view/invoicing/settingsView/invoicingBrandingFormConfig.js +1 -1
- package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +8 -0
- package/lib/view/invoicing/settingsView/settingsViewSelector.js +5 -0
- package/lib/view/invoicing/settingsView/submitInvoicingBrandingFormEpic.d.ts +2 -1
- package/lib/view/invoicing/settingsView/submitInvoicingBrandingFormEpic.js +9 -0
- 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,
|
package/lib/rootStateTypes.d.ts
CHANGED
|
@@ -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;
|
|
@@ -13,7 +13,7 @@ const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewRe
|
|
|
13
13
|
const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
|
|
14
14
|
const jeSchedulesViewState_1 = require("../../types/jeSchedulesViewState");
|
|
15
15
|
const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(expenseAutomationViewReducer_1.fetchAllExpenseAutomationTabs.match), (0, operators_1.switchMap)((action) => {
|
|
16
|
-
const { cacheOverride, refreshViewInBackground } = action.payload;
|
|
16
|
+
const { cacheOverride, refreshViewInBackground, isAccrualEnabled } = action.payload;
|
|
17
17
|
const state = state$.value;
|
|
18
18
|
const { monthEndCloseChecksState } = state;
|
|
19
19
|
const { monthEndCloseChecksByTenantId } = monthEndCloseChecksState;
|
|
@@ -38,7 +38,7 @@ const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0
|
|
|
38
38
|
amount: 75.0,
|
|
39
39
|
currencyCode: 'USD',
|
|
40
40
|
currencySymbol: '$',
|
|
41
|
-
}, cacheOverride, refreshViewInBackground), (0, fluxAnalysisViewReducer_1.fetchFluxAnalysisView)(selectedPeriod, cacheOverride, refreshViewInBackground, null), (0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride));
|
|
41
|
+
}, cacheOverride, refreshViewInBackground), (0, fluxAnalysisViewReducer_1.fetchFluxAnalysisView)(selectedPeriod, cacheOverride, refreshViewInBackground, null), (0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride, isAccrualEnabled));
|
|
42
42
|
if (reconciliationEnabled) {
|
|
43
43
|
actions.push((0, reconciliationViewReducer_1.fetchReconciliation)(selectedPeriod, undefined, cacheOverride, refreshViewInBackground));
|
|
44
44
|
}
|
|
@@ -64,16 +64,29 @@ const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0
|
|
|
64
64
|
fetchActions.push((0, fluxAnalysisViewReducer_1.fetchFluxAnalysisView)(selectedPeriod, cacheOverride, refreshViewInBackground, null));
|
|
65
65
|
}
|
|
66
66
|
// The two JE tabs cache separately, so only the tab actually being shown decides whether a
|
|
67
|
-
// fetch is still needed.
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
67
|
+
// fetch is still needed. Actual Matching is a third tab on the same page with its own
|
|
68
|
+
// endpoint; fetchJeSchedulesPage carries isAccrualEnabled so the prefetch epic can warm AM.
|
|
69
|
+
const selectedPageTab = state.expenseAutomationJESchedulesViewState.uiState.selectedPageTab;
|
|
70
|
+
if (selectedPageTab === 'actual_matching') {
|
|
71
|
+
const actualMatchingPeriodKeys = state.expenseAutomationActualMatchingViewState.matchIdsByPeriod[monthYearPeriodId];
|
|
72
|
+
// `fetchState` is global across months. Skipping on In-Progress would
|
|
73
|
+
// drop October while September is still loading; September's success
|
|
74
|
+
// then writes the old month and October stays Not-Started with no request.
|
|
75
|
+
if (actualMatchingPeriodKeys == null) {
|
|
76
|
+
fetchActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride, isAccrualEnabled));
|
|
77
|
+
}
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
const jeSchedulesPeriodTabKey = (0, jeSchedulesViewState_1.getJESchedulePeriodTabKey)(selectedPageTab, monthYearPeriodId);
|
|
81
|
+
if (state.expenseAutomationJESchedulesViewState.fetchState !==
|
|
82
|
+
'In-Progress' &&
|
|
83
|
+
(!state.expenseAutomationJESchedulesViewState.hasValidState() ||
|
|
84
|
+
state.expenseAutomationJESchedulesViewState
|
|
85
|
+
.jeScheduleTransactionKeysByPeriodAndTab[jeSchedulesPeriodTabKey] == null ||
|
|
86
|
+
state.expenseAutomationJESchedulesViewState
|
|
87
|
+
.failedJeScheduleTransactionKeysByPeriodAndTab[jeSchedulesPeriodTabKey] == null)) {
|
|
88
|
+
fetchActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride, isAccrualEnabled));
|
|
89
|
+
}
|
|
77
90
|
}
|
|
78
91
|
if (state.expenseAutomationReconciliationViewState.fetchState !==
|
|
79
92
|
'In-Progress' &&
|
package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingEpic.d.ts
ADDED
|
@@ -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>;
|
package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/fetchActualMatchingEpic.js
ADDED
|
@@ -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 responsePayload_1 = require("../../../../../responsePayload");
|
|
8
|
+
const rootActions_1 = require("../../../../../rootActions");
|
|
9
|
+
const actualMatchingPayload_1 = require("../../../payload/actualMatchingPayload");
|
|
10
|
+
const actualMatchingViewReducer_1 = require("../../../reducers/actualMatchingViewReducer");
|
|
11
|
+
const actualMatchingViewSelector_1 = require("../../../selectors/actualMatchingViewSelector");
|
|
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
|
+
// Key the store write off the requested month. Using the selected period
|
|
16
|
+
// would park a prefetch for October under September's slot.
|
|
17
|
+
const requestPeriod = {
|
|
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, (0, actualMatchingViewSelector_1.getTenantDisplayCurrency)(state)));
|
|
30
|
+
}
|
|
31
|
+
updateActions.push((0, actualMatchingViewReducer_1.fetchActualMatchingSuccess)({
|
|
32
|
+
matchIds: matches.map((match) => match.match_id),
|
|
33
|
+
selectedPeriod: requestPeriod,
|
|
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: requestPeriod,
|
|
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: requestPeriod,
|
|
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,40 @@
|
|
|
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 actualMatchingViewSelector_1 = require("../../../selectors/actualMatchingViewSelector");
|
|
11
|
+
const fetchActualMatchingMatchEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.fetchActualMatchingMatch.match), (0, operators_1.mergeMap)((action) => {
|
|
12
|
+
const { matchId, refreshViewInBackground } = action.payload;
|
|
13
|
+
return zeniAPI
|
|
14
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/actual-matching/${encodeURIComponent(matchId)}`)
|
|
15
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
16
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
17
|
+
return (0, rxjs_1.from)([
|
|
18
|
+
(0, actualMatchingReducer_1.updateActualMatchingMatches)([response.data], (0, actualMatchingViewSelector_1.getTenantDisplayCurrency)(state$.value)),
|
|
19
|
+
(0, actualMatchingViewReducer_1.fetchActualMatchingMatchSuccess)({
|
|
20
|
+
matchId,
|
|
21
|
+
refreshViewInBackground,
|
|
22
|
+
}),
|
|
23
|
+
]);
|
|
24
|
+
}
|
|
25
|
+
return (0, rxjs_1.from)([
|
|
26
|
+
(0, actualMatchingViewReducer_1.fetchActualMatchingMatchFailure)({
|
|
27
|
+
matchId,
|
|
28
|
+
refreshViewInBackground,
|
|
29
|
+
status: response.status,
|
|
30
|
+
}),
|
|
31
|
+
]);
|
|
32
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.from)([
|
|
33
|
+
(0, actualMatchingViewReducer_1.fetchActualMatchingMatchFailure)({
|
|
34
|
+
matchId,
|
|
35
|
+
refreshViewInBackground,
|
|
36
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `Fetch actual matching match REST API call errored out ${JSON.stringify(error)}`),
|
|
37
|
+
}),
|
|
38
|
+
])), (0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
|
|
39
|
+
}));
|
|
40
|
+
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,9 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
|
|
4
|
+
import { clearAll } from '../../../../../rootActions';
|
|
5
|
+
import { RootState } from '../../../../../rootStateTypes';
|
|
6
|
+
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
7
|
+
import { clearMatchNewModal, fetchActualMatching, fetchActualMatchingMatch, matchAndReverseAccruals, matchAndReverseAccrualsFailure, matchAndReverseAccrualsSuccess } from '../../../reducers/actualMatchingViewReducer';
|
|
8
|
+
export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof clearMatchNewModal> | ReturnType<typeof fetchActualMatching> | ReturnType<typeof fetchActualMatchingMatch> | ReturnType<typeof matchAndReverseAccruals> | ReturnType<typeof matchAndReverseAccrualsFailure> | ReturnType<typeof matchAndReverseAccrualsSuccess> | ReturnType<typeof openSnackbar>;
|
|
9
|
+
export declare const matchAndReverseAccrualsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,112 @@
|
|
|
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 actualMatchingSelector_1 = require("../../../../../entity/actualMatching/actualMatchingSelector");
|
|
7
|
+
const snackbarReducer_1 = require("../../../../../entity/snackbar/snackbarReducer");
|
|
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 actualMatchingViewState_1 = require("../../../types/actualMatchingViewState");
|
|
13
|
+
const refreshActualMatchingList_1 = require("./refreshActualMatchingList");
|
|
14
|
+
function isMatchFailedStatus(status) {
|
|
15
|
+
return (status === 'conflict' || status === 'claim_lost' || status === 'error');
|
|
16
|
+
}
|
|
17
|
+
function matchAndReverseSnackbar(results, vendorName) {
|
|
18
|
+
const reversedCount = results.filter((result) => result.status === 'reversed').length;
|
|
19
|
+
const failedCount = results.filter((result) => isMatchFailedStatus(result.status)).length;
|
|
20
|
+
const variables = [
|
|
21
|
+
{ variableName: '_count_', variableValue: String(reversedCount) },
|
|
22
|
+
{ variableName: '_vendor_name_', variableValue: vendorName },
|
|
23
|
+
];
|
|
24
|
+
if (results.length === 0 || (reversedCount === 0 && failedCount > 0)) {
|
|
25
|
+
return (0, snackbarReducer_1.openSnackbar)({
|
|
26
|
+
messageSection: 'actual_matching_match_and_reverse',
|
|
27
|
+
messageText: 'failed',
|
|
28
|
+
type: 'error',
|
|
29
|
+
variables,
|
|
30
|
+
});
|
|
31
|
+
}
|
|
32
|
+
if (reversedCount > 0 && failedCount === 0) {
|
|
33
|
+
return (0, snackbarReducer_1.openSnackbar)({
|
|
34
|
+
messageSection: 'actual_matching_match_and_reverse',
|
|
35
|
+
messageText: 'success',
|
|
36
|
+
type: 'success',
|
|
37
|
+
variables,
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
if (reversedCount > 0 && failedCount > 0) {
|
|
41
|
+
return (0, snackbarReducer_1.openSnackbar)({
|
|
42
|
+
messageSection: 'actual_matching_match_and_reverse',
|
|
43
|
+
messageText: 'notification',
|
|
44
|
+
type: 'warning',
|
|
45
|
+
variables,
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
return null;
|
|
49
|
+
}
|
|
50
|
+
function matchAndReverseHttpFailSnackbar(vendorName) {
|
|
51
|
+
return (0, snackbarReducer_1.openSnackbar)({
|
|
52
|
+
messageSection: 'actual_matching_match_and_reverse',
|
|
53
|
+
messageText: 'failed',
|
|
54
|
+
type: 'error',
|
|
55
|
+
variables: [
|
|
56
|
+
{ variableName: '_count_', variableValue: '0' },
|
|
57
|
+
{ variableName: '_vendor_name_', variableValue: vendorName },
|
|
58
|
+
],
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
function matchVendorName(state, matchId) {
|
|
62
|
+
return (0, actualMatchingSelector_1.getActualMatchingMatchById)(state.actualMatchingState, matchId)?.vendorName ?? '';
|
|
63
|
+
}
|
|
64
|
+
const matchAndReverseAccrualsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.matchAndReverseAccruals.match),
|
|
65
|
+
// Posts reversing JEs; drop duplicate clicks while a request is in flight.
|
|
66
|
+
(0, operators_1.exhaustMap)((action) => {
|
|
67
|
+
const { transactionId, transactionIntegrationId, transactionType, lineIds, accrualIds, transactionSyncToken, } = action.payload;
|
|
68
|
+
const body = {
|
|
69
|
+
transaction_id: transactionId,
|
|
70
|
+
transaction_integration_id: transactionIntegrationId,
|
|
71
|
+
transaction_type: transactionType,
|
|
72
|
+
line_ids: lineIds,
|
|
73
|
+
transaction_sync_token: transactionSyncToken,
|
|
74
|
+
accrual_ids: accrualIds,
|
|
75
|
+
};
|
|
76
|
+
// Key leftover results and snackbar vendor to the confirmed bill, not the
|
|
77
|
+
// row Match New was opened from (user can pick a different txn).
|
|
78
|
+
const matchId = `${transactionType.toLowerCase()}:${transactionIntegrationId}`;
|
|
79
|
+
const vendorName = matchVendorName(state$.value, matchId);
|
|
80
|
+
return zeniAPI
|
|
81
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/match-and-reverse`, body)
|
|
82
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
83
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
84
|
+
const results = response.data.results.map(actualMatchingPayload_1.toMatchAndReverseResult);
|
|
85
|
+
const successActions = [
|
|
86
|
+
(0, actualMatchingViewReducer_1.matchAndReverseAccrualsSuccess)({ matchId, results }),
|
|
87
|
+
];
|
|
88
|
+
const occupancyChanged = results.some((result) => (0, actualMatchingViewState_1.isMatchAndReverseCompleteStatus)(result.status));
|
|
89
|
+
const allComplete = results.length > 0 &&
|
|
90
|
+
results.every((result) => (0, actualMatchingViewState_1.isMatchAndReverseCompleteStatus)(result.status));
|
|
91
|
+
if (occupancyChanged) {
|
|
92
|
+
// List + detail: list can omit leftovers; detail GET always
|
|
93
|
+
// writes intended occupancy so Continue match prefills the
|
|
94
|
+
// remaining leftover set instead of a stale cached row.
|
|
95
|
+
successActions.push(...(0, refreshActualMatchingList_1.refreshActualMatchingList)(state$.value), (0, actualMatchingViewReducer_1.fetchActualMatchingMatch)(matchId, true));
|
|
96
|
+
}
|
|
97
|
+
const snackbar = matchAndReverseSnackbar(results, vendorName);
|
|
98
|
+
if (snackbar != null) {
|
|
99
|
+
successActions.push(snackbar);
|
|
100
|
+
}
|
|
101
|
+
if (allComplete) {
|
|
102
|
+
successActions.push((0, actualMatchingViewReducer_1.clearMatchNewModal)());
|
|
103
|
+
}
|
|
104
|
+
return (0, rxjs_1.from)(successActions);
|
|
105
|
+
}
|
|
106
|
+
return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.matchAndReverseAccrualsFailure)({ status: response.status }), matchAndReverseHttpFailSnackbar(vendorName));
|
|
107
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.matchAndReverseAccrualsFailure)({
|
|
108
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Match and reverse accruals REST API call errored out' +
|
|
109
|
+
JSON.stringify(error)),
|
|
110
|
+
}), matchAndReverseHttpFailSnackbar(vendorName))), (0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
|
|
111
|
+
}));
|
|
112
|
+
exports.matchAndReverseAccrualsEpic = matchAndReverseAccrualsEpic;
|
package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/refreshActualMatchingList.js
ADDED
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.refreshActualMatchingList = refreshActualMatchingList;
|
|
4
|
+
const timePeriod_1 = require("../../../../../commonStateTypes/timePeriod");
|
|
5
|
+
const actualMatchingViewReducer_1 = require("../../../reducers/actualMatchingViewReducer");
|
|
6
|
+
const actualMatchingViewSelector_1 = require("../../../selectors/actualMatchingViewSelector");
|
|
7
|
+
function refreshActualMatchingList(state) {
|
|
8
|
+
const selectedMonthYear = (0, actualMatchingViewSelector_1.getSelectedMonthYearForCurrentTenant)(state);
|
|
9
|
+
if (selectedMonthYear == null) {
|
|
10
|
+
return [];
|
|
11
|
+
}
|
|
12
|
+
const period = (0, timePeriod_1.convertToPeriod)(selectedMonthYear);
|
|
13
|
+
const start = (0, timePeriod_1.toAbsoluteDay)(period.start);
|
|
14
|
+
const end = (0, timePeriod_1.toAbsoluteDay)(period.end);
|
|
15
|
+
if (start == null || end == null) {
|
|
16
|
+
return [];
|
|
17
|
+
}
|
|
18
|
+
return [(0, actualMatchingViewReducer_1.fetchActualMatching)({ start, end }, true)];
|
|
19
|
+
}
|
package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchAccrualsEpic.d.ts
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { updateJEOneTimeAccruals } from '../../../../../entity/jeSchedules/jeSchedulesReducer';
|
|
4
|
+
import { clearAll } from '../../../../../rootActions';
|
|
5
|
+
import { RootState } from '../../../../../rootStateTypes';
|
|
6
|
+
import { ZeniAPI } from '../../../../../zeniAPI';
|
|
7
|
+
import { searchMatchAccruals, searchMatchAccrualsFailure, searchMatchAccrualsSuccess } from '../../../reducers/actualMatchingViewReducer';
|
|
8
|
+
export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof searchMatchAccruals> | ReturnType<typeof searchMatchAccrualsFailure> | ReturnType<typeof searchMatchAccrualsSuccess> | ReturnType<typeof updateJEOneTimeAccruals>;
|
|
9
|
+
export declare const searchMatchAccrualsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
package/lib/view/expenseAutomationView/epics/jeSchedule/actualMatching/searchMatchAccrualsEpic.js
ADDED
|
@@ -0,0 +1,64 @@
|
|
|
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 actualMatchingPayload_1 = require("../../../../../entity/actualMatching/actualMatchingPayload");
|
|
7
|
+
const jeScheduleHelper_1 = require("../../../../../entity/jeSchedules/jeScheduleHelper");
|
|
8
|
+
const jeSchedulesReducer_1 = require("../../../../../entity/jeSchedules/jeSchedulesReducer");
|
|
9
|
+
const responsePayload_1 = require("../../../../../responsePayload");
|
|
10
|
+
const rootActions_1 = require("../../../../../rootActions");
|
|
11
|
+
const actualMatchingViewReducer_1 = require("../../../reducers/actualMatchingViewReducer");
|
|
12
|
+
const actualMatchingViewSelector_1 = require("../../../selectors/actualMatchingViewSelector");
|
|
13
|
+
const actualMatchingViewState_1 = require("../../../types/actualMatchingViewState");
|
|
14
|
+
const searchMatchAccrualsEpic = (actions$, state$, zeniAPI) => {
|
|
15
|
+
const searchActions$ = actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.searchMatchAccruals.match));
|
|
16
|
+
const pagination$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken != null));
|
|
17
|
+
const newSearchDebounced$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken == null), (0, operators_1.debounceTime)(actualMatchingViewState_1.MATCH_SEARCH_DEBOUNCE_MS));
|
|
18
|
+
return (0, rxjs_1.merge)(pagination$, newSearchDebounced$).pipe((0, operators_1.switchMap)((action) => {
|
|
19
|
+
const { query, pageToken } = action.payload;
|
|
20
|
+
const offset = pageToken != null && pageToken.length > 0 ? Number(pageToken) : 0;
|
|
21
|
+
const searchText = encodeURIComponent(query);
|
|
22
|
+
const limit = actualMatchingViewState_1.MATCH_ACCRUAL_SEARCH_LIMIT;
|
|
23
|
+
return zeniAPI
|
|
24
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals?status=posted&reversal_policy=on_bill_match&search_text=${searchText}&limit=${limit}&offset=${offset}`)
|
|
25
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
26
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
27
|
+
const accruals = response.data.accruals;
|
|
28
|
+
const append = pageToken != null;
|
|
29
|
+
const nextOffset = offset + accruals.length;
|
|
30
|
+
const total = response.data.total ?? nextOffset;
|
|
31
|
+
const nextPageToken = nextOffset < total ? String(nextOffset) : null;
|
|
32
|
+
// toJEOneTimeAccrual still defaults a missing code to USD. Stamp
|
|
33
|
+
// tenant currency first, same as list members.
|
|
34
|
+
const fallbackCurrencyCode = (0, actualMatchingViewSelector_1.getTenantDisplayCurrency)(state$.value)?.currencyCode ?? '';
|
|
35
|
+
const stampedAccruals = accruals.map((accrual) => (0, actualMatchingPayload_1.withInheritedAccrualCurrency)(accrual, fallbackCurrencyCode));
|
|
36
|
+
const actionsOut = [];
|
|
37
|
+
// Picker payloads are thin. Do not replace a Review/Existing
|
|
38
|
+
// accrual that already has accounts, memo, cleared, matchSuggestion.
|
|
39
|
+
const existingByKey = state$.value.jeSchedulesState.oneTimeAccrualsByKey;
|
|
40
|
+
const accrualsToInsert = stampedAccruals.filter((accrual) => existingByKey[(0, jeScheduleHelper_1.generateJEOneTimeAccrualKey)(accrual._id)] ==
|
|
41
|
+
null);
|
|
42
|
+
if (accrualsToInsert.length > 0) {
|
|
43
|
+
actionsOut.push((0, jeSchedulesReducer_1.updateJEOneTimeAccruals)(accrualsToInsert));
|
|
44
|
+
}
|
|
45
|
+
actionsOut.push((0, actualMatchingViewReducer_1.searchMatchAccrualsSuccess)({
|
|
46
|
+
append,
|
|
47
|
+
nextPageToken,
|
|
48
|
+
results: stampedAccruals,
|
|
49
|
+
}));
|
|
50
|
+
return (0, rxjs_1.from)(actionsOut);
|
|
51
|
+
}
|
|
52
|
+
return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchAccrualsFailure)({
|
|
53
|
+
error: response.status,
|
|
54
|
+
}));
|
|
55
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchAccrualsFailure)({
|
|
56
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Search match accruals REST API call errored out' +
|
|
57
|
+
JSON.stringify(error)),
|
|
58
|
+
}))),
|
|
59
|
+
// On the HTTP stream only. Wrapping the outer merge would complete
|
|
60
|
+
// the epic on the first `clearAll` and drop later searches.
|
|
61
|
+
(0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
|
|
62
|
+
}));
|
|
63
|
+
};
|
|
64
|
+
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,78 @@
|
|
|
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 rootActions_1 = require("../../../../../rootActions");
|
|
9
|
+
const actualMatchingPayload_1 = require("../../../payload/actualMatchingPayload");
|
|
10
|
+
const actualMatchingViewReducer_1 = require("../../../reducers/actualMatchingViewReducer");
|
|
11
|
+
const actualMatchingViewSelector_1 = require("../../../selectors/actualMatchingViewSelector");
|
|
12
|
+
const actualMatchingViewState_1 = require("../../../types/actualMatchingViewState");
|
|
13
|
+
const searchMatchTransactionsEpic = (actions$, state$, zeniAPI) => {
|
|
14
|
+
const openModal$ = actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.openMatchNewModal.match), (0, operators_1.mergeMap)((action) => {
|
|
15
|
+
const matchId = action.payload.matchId;
|
|
16
|
+
if (matchId == null || matchId === '') {
|
|
17
|
+
return (0, rxjs_1.from)([
|
|
18
|
+
(0, actualMatchingViewReducer_1.searchMatchTransactions)(''),
|
|
19
|
+
(0, actualMatchingViewReducer_1.searchMatchAccruals)(''),
|
|
20
|
+
]);
|
|
21
|
+
}
|
|
22
|
+
const match = (0, actualMatchingSelector_1.getActualMatchingMatchById)(state$.value.actualMatchingState, matchId);
|
|
23
|
+
const parsed = (0, actualMatchingViewSelector_1.parseActualMatchingMatchId)(matchId);
|
|
24
|
+
const transactionType = match?.transactionType != null && match.transactionType !== ''
|
|
25
|
+
? match.transactionType
|
|
26
|
+
: parsed?.transactionType;
|
|
27
|
+
const transactionIntegrationId = match?.transactionIntegrationId != null &&
|
|
28
|
+
match.transactionIntegrationId !== ''
|
|
29
|
+
? match.transactionIntegrationId
|
|
30
|
+
: parsed?.transactionIntegrationId;
|
|
31
|
+
return (0, rxjs_1.from)([
|
|
32
|
+
(0, actualMatchingViewReducer_1.searchMatchTransactions)('', undefined, transactionType, transactionIntegrationId),
|
|
33
|
+
]);
|
|
34
|
+
}));
|
|
35
|
+
const searchActions$ = actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.searchMatchTransactions.match));
|
|
36
|
+
const pagination$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken != null));
|
|
37
|
+
const newSearchDebounced$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken == null), (0, operators_1.debounceTime)(actualMatchingViewState_1.MATCH_SEARCH_DEBOUNCE_MS));
|
|
38
|
+
const search$ = (0, rxjs_1.merge)(pagination$, newSearchDebounced$).pipe((0, operators_1.switchMap)((action) => {
|
|
39
|
+
const { query, pageToken, transactionType, transactionIntegrationId } = action.payload;
|
|
40
|
+
const queryParam = {
|
|
41
|
+
search_text: query,
|
|
42
|
+
page_size: actualMatchingViewState_1.MATCH_TRANSACTION_SEARCH_PAGE_SIZE,
|
|
43
|
+
...(pageToken != null ? { page_token: pageToken } : {}),
|
|
44
|
+
...(transactionType != null && transactionType !== ''
|
|
45
|
+
? { transaction_type: transactionType }
|
|
46
|
+
: {}),
|
|
47
|
+
...(transactionIntegrationId != null && transactionIntegrationId !== ''
|
|
48
|
+
? { transaction_integration_id: transactionIntegrationId }
|
|
49
|
+
: {}),
|
|
50
|
+
};
|
|
51
|
+
return zeniAPI
|
|
52
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/match-transaction-search?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
53
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
54
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
55
|
+
const { transactions, next_page_token } = response.data;
|
|
56
|
+
const append = pageToken != null;
|
|
57
|
+
const fallbackCurrency = (0, actualMatchingViewSelector_1.getTenantDisplayCurrency)(state$.value);
|
|
58
|
+
const results = transactions.map((transaction) => (0, actualMatchingPayload_1.toActualMatchingTransactionSearchResult)(transaction, fallbackCurrency));
|
|
59
|
+
return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchTransactionsSuccess)({
|
|
60
|
+
append,
|
|
61
|
+
nextPageToken: next_page_token ?? null,
|
|
62
|
+
results,
|
|
63
|
+
}));
|
|
64
|
+
}
|
|
65
|
+
return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchTransactionsFailure)({
|
|
66
|
+
error: response.status,
|
|
67
|
+
}));
|
|
68
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchTransactionsFailure)({
|
|
69
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Search match transactions REST API call errored out' +
|
|
70
|
+
JSON.stringify(error)),
|
|
71
|
+
}))),
|
|
72
|
+
// On the HTTP stream only. Wrapping `merge(openModal$, search$)`
|
|
73
|
+
// would complete the epic on the first `clearAll` and drop later searches.
|
|
74
|
+
(0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
|
|
75
|
+
}));
|
|
76
|
+
return (0, rxjs_1.merge)(openModal$, search$);
|
|
77
|
+
};
|
|
78
|
+
exports.searchMatchTransactionsEpic = searchMatchTransactionsEpic;
|