@zeniai/client-epic-state 4.12.97 → 4.12.99
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/commonStateTypes/common.d.ts +2 -0
- package/lib/commonStateTypes/common.js +5 -1
- package/lib/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.d.ts +1 -0
- package/lib/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.js +2 -1
- package/lib/commonStateTypes/timePeriod.d.ts +16 -0
- package/lib/commonStateTypes/timePeriod.js +31 -1
- package/lib/commonStateTypes/viewAndReport/reportIDHelper.d.ts +1 -0
- package/lib/commonStateTypes/viewAndReport/reportIDHelper.js +3 -1
- package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
- package/lib/commonStateTypes/viewAndReport/viewAndReport.js +2 -0
- package/lib/entity/account/accountState.d.ts +1 -1
- package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
- package/lib/entity/class/classReducer.d.ts +4 -4
- package/lib/entity/class/classState.d.ts +1 -1
- package/lib/entity/company/companyStateTypes.d.ts +1 -1
- package/lib/entity/forecast/forecastState.d.ts +1 -1
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -0
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +7 -1
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -2
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +3 -1
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +2 -1
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +3 -1
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +2 -0
- package/lib/entity/jeSchedules/jeSchedulesTypes.js +12 -1
- package/lib/entity/monthEndCloseChecks/monthEndCloseChecksPayload.d.ts +32 -0
- package/lib/entity/monthEndCloseChecks/monthEndCloseChecksPayload.js +53 -0
- package/lib/entity/monthEndCloseChecks/monthEndCloseChecksReducer.d.ts +12 -0
- package/lib/entity/monthEndCloseChecks/monthEndCloseChecksReducer.js +25 -0
- package/lib/entity/monthEndCloseChecks/monthEndCloseChecksSelector.d.ts +7 -0
- package/lib/entity/monthEndCloseChecks/monthEndCloseChecksSelector.js +36 -0
- package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +38 -0
- package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.js +10 -0
- package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
- package/lib/entity/tenant/clearAllEpic.d.ts +9 -2
- package/lib/entity/tenant/clearAllEpic.js +14 -0
- package/lib/entity/tenant/epic/fetchAllTenantsEpic.d.ts +4 -1
- package/lib/entity/tenant/epic/fetchAllTenantsEpic.js +32 -2
- package/lib/entity/tenant/tenantPayload.d.ts +1 -0
- package/lib/entity/tenant/tenantReducer.js +3 -0
- package/lib/entity/tenant/tenantState.d.ts +1 -0
- package/lib/entity/transaction/payloadTypes/attachmentPayload.d.ts +1 -1
- package/lib/entity/transaction/payloadTypes/attachmentPayload.js +3 -3
- package/lib/entity/transaction/stateTypes/transactionType.d.ts +2 -2
- package/lib/entity/transaction/transactionSelector.d.ts +1 -0
- package/lib/entity/transaction/transactionSelector.js +7 -1
- package/lib/entity/vendor/__mocks__/vendorStateMocks.d.ts +1 -0
- package/lib/entity/vendor/__mocks__/vendorStateMocks.js +35 -1
- package/lib/entity/vendor/vendorPayload.js +3 -2
- package/lib/entity/vendor/vendorState.d.ts +3 -3
- package/lib/entity/vendor/vendorType.d.ts +0 -2
- package/lib/entity/vendor/vendorType.js +1 -4
- package/lib/epic.d.ts +10 -1
- package/lib/epic.js +10 -1
- package/lib/index.d.ts +40 -8
- package/lib/index.js +74 -25
- package/lib/reducer.d.ts +22 -1
- package/lib/reducer.js +22 -1
- package/lib/view/auditReportView/auditReportViewState.d.ts +2 -2
- package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
- package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
- package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
- package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
- package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.d.ts +10 -5
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +10 -7
- package/lib/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportTemplatesEpic.js +4 -4
- package/lib/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportViewEpic.js +4 -4
- package/lib/view/companyMonthEndReportView/epics/improveUsingZeniGPTEpic.js +5 -3
- package/lib/view/companyMonthEndReportView/epics/saveCompanyMonthEndReportEpic.js +3 -3
- package/lib/view/companyMonthEndReportView/epics/sendCompanyMonthEndReportEpic.js +3 -3
- package/lib/view/companyView/types/cockpitTypes.d.ts +2 -2
- package/lib/view/dashboard/dashboardEpic.d.ts +2 -1
- package/lib/view/dashboard/dashboardEpic.js +22 -2
- package/lib/view/dashboard/dashboardReducer.d.ts +3 -2
- package/lib/view/dashboard/dashboardReducer.js +2 -1
- package/lib/view/dashboard/dashboardSelector.d.ts +2 -0
- package/lib/view/dashboard/dashboardSelector.js +10 -2
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +10 -0
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +72 -0
- package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +11 -0
- package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +53 -0
- package/lib/view/expenseAutomationView/epics/fluxAnalysis/fetchFluxAnalysisViewEpic.d.ts +11 -0
- package/lib/view/expenseAutomationView/epics/fluxAnalysis/fetchFluxAnalysisViewEpic.js +66 -0
- package/lib/view/expenseAutomationView/epics/fluxAnalysis/reviewFluxAnalysisEpic.d.ts +7 -0
- package/lib/view/expenseAutomationView/epics/fluxAnalysis/reviewFluxAnalysisEpic.js +39 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.d.ts +7 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +22 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +59 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.d.ts +7 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +44 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/initializeJeScheduleLocalDataEpic.d.ts +6 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/initializeJeScheduleLocalDataEpic.js +28 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/retryJeSchedulesEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/jeSchedule/retryJeSchedulesEpic.js +44 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMissingReceiptsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMissingReceiptsEpic.js +58 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.d.ts +10 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +12 -0
- package/lib/view/expenseAutomationView/expenseAutomationViewPayload.d.ts +3 -0
- package/lib/view/expenseAutomationView/expenseAutomationViewPayload.js +2 -0
- package/lib/view/expenseAutomationView/expenseAutomationViewReducer.d.ts +17 -0
- package/lib/view/expenseAutomationView/expenseAutomationViewReducer.js +66 -0
- package/lib/view/expenseAutomationView/expenseAutomationViewSelector.d.ts +3 -0
- package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +97 -0
- package/lib/view/expenseAutomationView/expenseAutomationViewState.d.ts +11 -0
- package/lib/view/expenseAutomationView/expenseAutomationViewState.js +14 -0
- package/lib/view/expenseAutomationView/helpers/helpers.d.ts +7 -0
- package/lib/view/expenseAutomationView/helpers/helpers.js +67 -0
- package/lib/view/expenseAutomationView/payload/fluxAnalysisPayload.d.ts +76 -0
- package/lib/view/expenseAutomationView/payload/fluxAnalysisPayload.js +9 -0
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +36 -0
- package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +58 -0
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.d.ts +16 -0
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +2 -0
- package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.d.ts +34 -0
- package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.js +205 -0
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +53 -0
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +245 -0
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +31 -0
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +130 -0
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +5 -0
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +45 -0
- package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +35 -0
- package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.js +47 -0
- package/lib/view/expenseAutomationView/selectorTypes/fluxAnalysisViewSelectorTypes.d.ts +32 -0
- package/lib/view/expenseAutomationView/selectorTypes/fluxAnalysisViewSelectorTypes.js +2 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +28 -0
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.js +2 -0
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +11 -0
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.js +2 -0
- package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.d.ts +3 -0
- package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +55 -0
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +7 -0
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +95 -0
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.d.ts +3 -0
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +61 -0
- package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.d.ts +53 -0
- package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.js +5 -0
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +31 -0
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +2 -0
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +20 -0
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +13 -0
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +28 -0
- package/lib/view/expenseAutomationView/types/transactionsViewState.js +15 -0
- package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
- package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
- package/lib/view/monthEndCloseChecksView/epics/fetchMonthEndCloseChecksEpic.d.ts +8 -0
- package/lib/view/monthEndCloseChecksView/epics/fetchMonthEndCloseChecksEpic.js +58 -0
- package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewPayload.d.ts +3 -0
- package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewPayload.js +2 -0
- package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewReducer.d.ts +16 -0
- package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewReducer.js +36 -0
- package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewSelector.d.ts +10 -0
- package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewSelector.js +27 -0
- package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewState.d.ts +5 -0
- package/lib/view/monthEndCloseChecksView/monthEndCloseChecksViewState.js +2 -0
- package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
- package/lib/view/reviewCompanyView/reviewCompanyViewState.d.ts +1 -1
- package/lib/view/scheduleView/scheduleAccruedDetailView/LinkBillExpenseView/linkBillExpense.d.ts +1 -1
- package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsEpic.js +3 -2
- package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsPageEpic.js +1 -1
- package/lib/view/scheduleView/scheduleDetailView/epics/saveScheduleDetailsEpic.js +2 -2
- package/lib/view/scheduleView/scheduleDetailView/scheduleDetailLocalDataHelper.js +19 -5
- package/lib/view/scheduleView/scheduleDetailView/scheduleDetailPayload.d.ts +8 -3
- package/lib/view/scheduleView/scheduleDetailView/scheduleDetailPayload.js +39 -57
- package/lib/view/scheduleView/scheduleDetailView/scheduleDetailReducer.d.ts +13 -8
- package/lib/view/scheduleView/scheduleDetailView/scheduleDetailReducer.js +19 -12
- package/lib/view/scheduleView/scheduleDetailView/scheduleDetailSelector.d.ts +1 -0
- package/lib/view/scheduleView/scheduleDetailView/scheduleDetailSelector.js +4 -3
- package/lib/view/scheduleView/scheduleDetailView/scheduleDetailState.d.ts +2 -0
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/spendManagement/billPay/editBillView/epics/parseInvoiceToBillEpic.js +2 -2
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/editRemiView/epics/parseReceiptsToRemiEpic.js +2 -2
- package/lib/view/subscriptionView/types/subscriptionTypes.d.ts +1 -1
- package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
- package/lib/view/topEx/topExSelector.d.ts +1 -1
- package/lib/view/transactionDetail/epics/uploadMissingReceiptSuccessEpic.js +2 -2
- package/lib/view/transactionDetail/transactionDetailState.d.ts +2 -2
- package/lib/view/vendorReviewView/common/state/commonTypes.d.ts +1 -1
- package/lib/view/zeniAccStatementList/zeniAccStatementList.d.ts +2 -5
- package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +3 -1
- package/package.json +1 -1
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../../reducer';
|
|
4
|
+
import { fetchAllExpenseAutomationTabs } from '../../expenseAutomationViewReducer';
|
|
5
|
+
import { fetchMissingReceipts } from '../../reducers/missingReceiptsViewReducer';
|
|
6
|
+
import { fetchFluxAnalysisView } from '../../reducers/fluxAnalysisViewReducer';
|
|
7
|
+
import { fetchMonthEndCloseChecks } from '../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer';
|
|
8
|
+
import { fetchJeSchedulesPage } from '../../reducers/jeSchedulesViewReducer';
|
|
9
|
+
export declare type ActionType = ReturnType<typeof fetchAllExpenseAutomationTabs> | ReturnType<typeof fetchMissingReceipts> | ReturnType<typeof fetchMonthEndCloseChecks> | ReturnType<typeof fetchFluxAnalysisView> | ReturnType<typeof fetchJeSchedulesPage>;
|
|
10
|
+
export declare const fetchAllExpenseAutomationTabsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -0,0 +1,72 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchAllExpenseAutomationTabsEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const expenseAutomationViewReducer_1 = require("../../expenseAutomationViewReducer");
|
|
7
|
+
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
8
|
+
const fluxAnalysisViewReducer_1 = require("../../reducers/fluxAnalysisViewReducer");
|
|
9
|
+
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
10
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
11
|
+
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
12
|
+
const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(expenseAutomationViewReducer_1.fetchAllExpenseAutomationTabs.match), (0, operators_1.switchMap)((action) => {
|
|
13
|
+
const { cacheOverride, refreshViewInBackground } = action.payload;
|
|
14
|
+
const state = state$.value;
|
|
15
|
+
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
16
|
+
const companyId = currentTenant.companyId;
|
|
17
|
+
const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
|
|
18
|
+
const period = (0, timePeriod_1.convertToPeriod)(selectedPeriod);
|
|
19
|
+
const timePeriodStart = (0, timePeriod_1.toAbsoluteDay)(period.start);
|
|
20
|
+
const timePeriodEnd = (0, timePeriod_1.toAbsoluteDay)(period.end);
|
|
21
|
+
const monthYearPeriodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
22
|
+
if (timePeriodStart == null ||
|
|
23
|
+
timePeriodEnd == null ||
|
|
24
|
+
companyId == null) {
|
|
25
|
+
throw Error(`Invalid start - ${timePeriodStart} and end - ${timePeriodEnd} period from given ${selectedPeriod}`);
|
|
26
|
+
}
|
|
27
|
+
if (cacheOverride === true) {
|
|
28
|
+
return (0, rxjs_1.from)([
|
|
29
|
+
(0, missingReceiptsViewReducer_1.fetchMissingReceipts)({ start: timePeriodStart, end: timePeriodEnd }, {
|
|
30
|
+
amount: 75.0,
|
|
31
|
+
currencyCode: 'USD',
|
|
32
|
+
currencySymbol: '$',
|
|
33
|
+
}, cacheOverride, refreshViewInBackground),
|
|
34
|
+
// TOODO - Vivek - Add fetch state
|
|
35
|
+
(0, fluxAnalysisViewReducer_1.fetchFluxAnalysisView)(selectedPeriod, refreshViewInBackground),
|
|
36
|
+
(0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride),
|
|
37
|
+
]);
|
|
38
|
+
}
|
|
39
|
+
else {
|
|
40
|
+
const fetchActions = [];
|
|
41
|
+
if (state.expenseAutomationMissingReceiptsViewState.fetchState !==
|
|
42
|
+
'In-Progress' &&
|
|
43
|
+
(!state.expenseAutomationMissingReceiptsViewState.hasValidState() ||
|
|
44
|
+
state.expenseAutomationMissingReceiptsViewState
|
|
45
|
+
.transactionIdsBySelectedPeriod[monthYearPeriodId] == null)) {
|
|
46
|
+
fetchActions.push((0, missingReceiptsViewReducer_1.fetchMissingReceipts)({ start: timePeriodStart, end: timePeriodEnd }, {
|
|
47
|
+
amount: 75.0,
|
|
48
|
+
currencyCode: '',
|
|
49
|
+
currencySymbol: '',
|
|
50
|
+
}, cacheOverride, refreshViewInBackground));
|
|
51
|
+
}
|
|
52
|
+
// TOODO - Vivek - Add fetch state
|
|
53
|
+
if (state.expenseAutomationFluxAnalysisViewState.fetchState !==
|
|
54
|
+
'In-Progress' &&
|
|
55
|
+
!state.expenseAutomationFluxAnalysisViewState.hasValidState() // TODO - Anjali - add condition for selected period
|
|
56
|
+
) {
|
|
57
|
+
fetchActions.push((0, fluxAnalysisViewReducer_1.fetchFluxAnalysisView)(selectedPeriod, refreshViewInBackground));
|
|
58
|
+
}
|
|
59
|
+
if (state.expenseAutomationJESchedulesViewState.fetchState !==
|
|
60
|
+
'In-Progress' &&
|
|
61
|
+
(!state.expenseAutomationJESchedulesViewState.hasValidState() ||
|
|
62
|
+
state.expenseAutomationJESchedulesViewState
|
|
63
|
+
.jeScheduleTransactionKeysByPeriod[monthYearPeriodId] == null ||
|
|
64
|
+
state.expenseAutomationJESchedulesViewState
|
|
65
|
+
.failedJeScheduleTransactionKeysByPeriod[monthYearPeriodId] ==
|
|
66
|
+
null)) {
|
|
67
|
+
fetchActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride));
|
|
68
|
+
}
|
|
69
|
+
return (0, rxjs_1.from)(fetchActions);
|
|
70
|
+
}
|
|
71
|
+
}));
|
|
72
|
+
exports.fetchAllExpenseAutomationTabsEpic = fetchAllExpenseAutomationTabsEpic;
|
package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts
ADDED
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../../reducer';
|
|
4
|
+
import { refreshExpenseAutomationCurrentTab } from '../../expenseAutomationViewReducer';
|
|
5
|
+
import { fetchMissingReceipts } from '../../reducers/missingReceiptsViewReducer';
|
|
6
|
+
import { fetchFluxAnalysisView } from '../../reducers/fluxAnalysisViewReducer';
|
|
7
|
+
import { fetchCompanyMonthEndReportView, fetchCompanyMonthEndReportTemplates } from '../../../companyMonthEndReportView/companyMonthEndReportViewReducer';
|
|
8
|
+
import { fetchMonthEndCloseChecks } from '../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer';
|
|
9
|
+
import { fetchJeSchedulesPage } from '../../reducers/jeSchedulesViewReducer';
|
|
10
|
+
export declare type ActionType = ReturnType<typeof refreshExpenseAutomationCurrentTab> | ReturnType<typeof fetchCompanyMonthEndReportView> | ReturnType<typeof fetchCompanyMonthEndReportTemplates> | ReturnType<typeof fetchMissingReceipts> | ReturnType<typeof fetchMonthEndCloseChecks> | ReturnType<typeof fetchFluxAnalysisView> | ReturnType<typeof fetchFluxAnalysisView> | ReturnType<typeof fetchJeSchedulesPage>;
|
|
11
|
+
export declare const refreshExpenseAutomationCurrentTabEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -0,0 +1,53 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.refreshExpenseAutomationCurrentTabEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const expenseAutomationViewReducer_1 = require("../../expenseAutomationViewReducer");
|
|
7
|
+
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
8
|
+
const fluxAnalysisViewReducer_1 = require("../../reducers/fluxAnalysisViewReducer");
|
|
9
|
+
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
10
|
+
const companyMonthEndReportViewReducer_1 = require("../../../companyMonthEndReportView/companyMonthEndReportViewReducer");
|
|
11
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
12
|
+
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
13
|
+
const refreshExpenseAutomationCurrentTabEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(expenseAutomationViewReducer_1.refreshExpenseAutomationCurrentTab.match), (0, operators_1.switchMap)(() => {
|
|
14
|
+
const state = state$.value;
|
|
15
|
+
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
16
|
+
const companyId = currentTenant.companyId;
|
|
17
|
+
const { selectedPeriodByTenantId, currentSelectedView } = state.expenseAutomationViewState;
|
|
18
|
+
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
19
|
+
const period = (0, timePeriod_1.convertToPeriod)(selectedPeriod);
|
|
20
|
+
const timePeriodStart = (0, timePeriod_1.toAbsoluteDay)(period.start);
|
|
21
|
+
const timePeriodEnd = (0, timePeriod_1.toAbsoluteDay)(period.end);
|
|
22
|
+
if (timePeriodStart == null ||
|
|
23
|
+
timePeriodEnd == null ||
|
|
24
|
+
companyId == null) {
|
|
25
|
+
throw Error(`Invalid start - ${timePeriodStart} and end - ${timePeriodEnd} period from given ${selectedPeriod}`);
|
|
26
|
+
}
|
|
27
|
+
switch (currentSelectedView) {
|
|
28
|
+
case 'missing_receipts':
|
|
29
|
+
return (0, rxjs_1.from)([
|
|
30
|
+
(0, missingReceiptsViewReducer_1.fetchMissingReceipts)({ start: timePeriodStart, end: timePeriodEnd }, {
|
|
31
|
+
amount: 75.0,
|
|
32
|
+
currencyCode: 'USD',
|
|
33
|
+
currencySymbol: '$',
|
|
34
|
+
}, true, true),
|
|
35
|
+
]);
|
|
36
|
+
case 'flux_analysis':
|
|
37
|
+
return (0, rxjs_1.from)([(0, fluxAnalysisViewReducer_1.fetchFluxAnalysisView)(selectedPeriod, true)]);
|
|
38
|
+
case 'je_schedules':
|
|
39
|
+
return (0, rxjs_1.from)([
|
|
40
|
+
(0, jeSchedulesViewReducer_1.fetchJeSchedulesPage)({ start: timePeriodStart, end: timePeriodEnd }, true),
|
|
41
|
+
]);
|
|
42
|
+
case 'month_end_insights':
|
|
43
|
+
return (0, rxjs_1.from)([
|
|
44
|
+
(0, companyMonthEndReportViewReducer_1.fetchCompanyMonthEndReportView)(true, companyId),
|
|
45
|
+
(0, companyMonthEndReportViewReducer_1.fetchCompanyMonthEndReportTemplates)(companyId),
|
|
46
|
+
]);
|
|
47
|
+
case 'transaction_categorization':
|
|
48
|
+
default:
|
|
49
|
+
// TODO - Vivek - Add fetch state
|
|
50
|
+
return (0, rxjs_1.from)([]);
|
|
51
|
+
}
|
|
52
|
+
}));
|
|
53
|
+
exports.refreshExpenseAutomationCurrentTabEpic = refreshExpenseAutomationCurrentTabEpic;
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
4
|
+
import { RootState } from '../../../../reducer';
|
|
5
|
+
import { fetchFluxAnalysisView, fetchFluxAnalysisViewSuccess, fetchFluxAnalysisViewFailure } from '../../reducers/fluxAnalysisViewReducer';
|
|
6
|
+
import { updateAccounts } from '../../../../entity/account/accountReducer';
|
|
7
|
+
import { updateClasses } from '../../../../entity/class/classReducer';
|
|
8
|
+
import { updateVendors } from '../../../../entity/vendor/vendorReducer';
|
|
9
|
+
import { updateAllUsers } from '../../../../entity/user/userReducer';
|
|
10
|
+
export declare type ActionType = ReturnType<typeof fetchFluxAnalysisView> | ReturnType<typeof fetchFluxAnalysisViewSuccess> | ReturnType<typeof fetchFluxAnalysisViewFailure> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateClasses> | ReturnType<typeof updateVendors> | ReturnType<typeof updateAllUsers>;
|
|
11
|
+
export declare const fetchFluxAnalysisViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchFluxAnalysisViewEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
|
+
const fluxAnalysisViewReducer_1 = require("../../reducers/fluxAnalysisViewReducer");
|
|
8
|
+
const helpers_1 = require("../../helpers/helpers");
|
|
9
|
+
const accountReducer_1 = require("../../../../entity/account/accountReducer");
|
|
10
|
+
const classReducer_1 = require("../../../../entity/class/classReducer");
|
|
11
|
+
const vendorReducer_1 = require("../../../../entity/vendor/vendorReducer");
|
|
12
|
+
const userReducer_1 = require("../../../../entity/user/userReducer");
|
|
13
|
+
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
14
|
+
const fetchFluxAnalysisViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(fluxAnalysisViewReducer_1.fetchFluxAnalysisView.match), (0, operators_1.switchMap)((action) => {
|
|
15
|
+
const { expenseAutomationFluxAnalysisViewState: { fetchState, uiState }, } = state$.value;
|
|
16
|
+
const { monthAndYear } = action.payload;
|
|
17
|
+
if (fetchState === 'Not-Started') {
|
|
18
|
+
const queryParam = {
|
|
19
|
+
month_and_year: (0, timePeriod_1.toMonthYearPeriodQuery)(monthAndYear),
|
|
20
|
+
sort_by: (0, helpers_1.toVendorFluxAnalysisSortKeyPayload)(uiState.sortKey),
|
|
21
|
+
sort_order: uiState.sortOrder,
|
|
22
|
+
};
|
|
23
|
+
return zeniAPI
|
|
24
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/month-close-checks/flux_analysis?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
25
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
26
|
+
var _a, _b;
|
|
27
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
28
|
+
const updateActions = [];
|
|
29
|
+
if (response.data.report.accounts != null) {
|
|
30
|
+
updateActions.push((0, accountReducer_1.updateAccounts)(response.data.report.accounts, 'account_list'));
|
|
31
|
+
}
|
|
32
|
+
if (response.data.report.accounting_class != null) {
|
|
33
|
+
updateActions.push((0, classReducer_1.updateClasses)('class_list', response.data.report.accounting_class));
|
|
34
|
+
}
|
|
35
|
+
if (response.data.report.vendors != null) {
|
|
36
|
+
updateActions.push((0, vendorReducer_1.updateVendors)(response.data.report.vendors, 'merge'));
|
|
37
|
+
}
|
|
38
|
+
if (response.data.report.users != null) {
|
|
39
|
+
updateActions.push((0, userReducer_1.updateAllUsers)({
|
|
40
|
+
users: response.data.report.users,
|
|
41
|
+
updateType: 'merge',
|
|
42
|
+
}));
|
|
43
|
+
}
|
|
44
|
+
if (((_a = response.data.report.flux_analysis_entities) === null || _a === void 0 ? void 0 : _a.operating_expenses) != null) {
|
|
45
|
+
updateActions.push((0, fluxAnalysisViewReducer_1.fetchFluxAnalysisViewSuccess)({
|
|
46
|
+
expensesPayload: (_b = response.data.report.flux_analysis_entities) === null || _b === void 0 ? void 0 : _b.operating_expenses,
|
|
47
|
+
currency: response.data.report.currency,
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
return (0, rxjs_1.from)(updateActions);
|
|
51
|
+
}
|
|
52
|
+
else {
|
|
53
|
+
return (0, rxjs_1.of)((0, fluxAnalysisViewReducer_1.fetchFluxAnalysisViewFailure)({
|
|
54
|
+
status: response.status,
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, fluxAnalysisViewReducer_1.fetchFluxAnalysisViewFailure)({
|
|
58
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'fetch flux analysis view REST API call errored out' +
|
|
59
|
+
JSON.stringify(error)),
|
|
60
|
+
}))));
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
return (0, rxjs_1.from)([]);
|
|
64
|
+
}
|
|
65
|
+
}));
|
|
66
|
+
exports.fetchFluxAnalysisViewEpic = fetchFluxAnalysisViewEpic;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
4
|
+
import { RootState } from '../../../../reducer';
|
|
5
|
+
import { reviewFluxAnalysisView, reviewFluxAnalysisViewFailure, reviewFluxAnalysisViewSuccess } from '../../reducers/fluxAnalysisViewReducer';
|
|
6
|
+
export declare type ActionType = ReturnType<typeof reviewFluxAnalysisView> | ReturnType<typeof reviewFluxAnalysisViewSuccess> | ReturnType<typeof reviewFluxAnalysisViewFailure>;
|
|
7
|
+
export declare const reviewFluxAnalysisViewEpic: (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.reviewFluxAnalysisViewEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
|
+
const fluxAnalysisViewReducer_1 = require("../../reducers/fluxAnalysisViewReducer");
|
|
8
|
+
const helpers_1 = require("../../helpers/helpers");
|
|
9
|
+
const reviewFluxAnalysisViewEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(fluxAnalysisViewReducer_1.reviewFluxAnalysisView.match), (0, operators_1.switchMap)((action) => {
|
|
10
|
+
const { actionType, operatingExpenseIds } = action.payload;
|
|
11
|
+
const queryParam = {
|
|
12
|
+
action: (0, helpers_1.toVendorFluxAnalysisReviewActionPayload)(actionType),
|
|
13
|
+
flux_analysis_entity_ids: operatingExpenseIds,
|
|
14
|
+
};
|
|
15
|
+
return zeniAPI
|
|
16
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/month-close-checks/flux_analysis/review?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
17
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
18
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
19
|
+
const updateActions = [];
|
|
20
|
+
if (response.data != null) {
|
|
21
|
+
updateActions.push((0, fluxAnalysisViewReducer_1.reviewFluxAnalysisViewSuccess)({
|
|
22
|
+
operatingExpenseIds: response.data.operating_expense_ids,
|
|
23
|
+
}));
|
|
24
|
+
}
|
|
25
|
+
return (0, rxjs_1.from)(updateActions);
|
|
26
|
+
}
|
|
27
|
+
else {
|
|
28
|
+
return (0, rxjs_1.of)((0, fluxAnalysisViewReducer_1.reviewFluxAnalysisViewFailure)({
|
|
29
|
+
operatingExpenseIds: operatingExpenseIds,
|
|
30
|
+
status: response.status,
|
|
31
|
+
}));
|
|
32
|
+
}
|
|
33
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, fluxAnalysisViewReducer_1.reviewFluxAnalysisViewFailure)({
|
|
34
|
+
operatingExpenseIds: operatingExpenseIds,
|
|
35
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'review flux analysis view REST API call errored out' +
|
|
36
|
+
JSON.stringify(error)),
|
|
37
|
+
}))));
|
|
38
|
+
}));
|
|
39
|
+
exports.reviewFluxAnalysisViewEpic = reviewFluxAnalysisViewEpic;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { fetchAccountList } from '../../../accountList/accountListReducer';
|
|
4
|
+
import { fetchJeSchedulesPage, fetchJeSchedules } from '../../reducers/jeSchedulesViewReducer';
|
|
5
|
+
import { RootState } from '../../../../reducer';
|
|
6
|
+
export declare type ActionType = ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof fetchJeSchedules> | ReturnType<typeof fetchAccountList>;
|
|
7
|
+
export declare const fetchJeSchedulesPageEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchJeSchedulesPageEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const accountListReducer_1 = require("../../../accountList/accountListReducer");
|
|
7
|
+
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
8
|
+
const scheduleListHelper_1 = require("../../../scheduleView/scheduleListView/scheduleListHelper");
|
|
9
|
+
const fetchJeSchedulesPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.fetchJeSchedulesPage.match), (0, operators_1.mergeMap)((action) => {
|
|
10
|
+
const jeSchedulePageActions = [];
|
|
11
|
+
const { period, refreshViewInBackground } = action.payload;
|
|
12
|
+
const accountType = (0, scheduleListHelper_1.getAccountsTypesForScheduleEpics)();
|
|
13
|
+
const accountListState = state$.value.accountListState;
|
|
14
|
+
if (accountListState.byReportId[accountType.accountListKey].fetchState ===
|
|
15
|
+
'Not-Started') {
|
|
16
|
+
// call this only if the account list for schedules is not fetched already
|
|
17
|
+
jeSchedulePageActions.push((0, accountListReducer_1.fetchAccountList)(accountType.accountListKey, true, false, false, false, accountType.allowedAccountList));
|
|
18
|
+
}
|
|
19
|
+
jeSchedulePageActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedules)(period, refreshViewInBackground));
|
|
20
|
+
return (0, rxjs_1.concat)((0, rxjs_1.from)(jeSchedulePageActions));
|
|
21
|
+
}));
|
|
22
|
+
exports.fetchJeSchedulesPageEpic = fetchJeSchedulesPageEpic;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
4
|
+
import { RootState } from '../../../../reducer';
|
|
5
|
+
import { fetchJeSchedules, fetchJeSchedulesFailure, fetchJeSchedulesSuccess, initializeJeScheduleLocalData } from '../../reducers/jeSchedulesViewReducer';
|
|
6
|
+
import { updateJESchedules, updateJESchedulesDetails } from '../../../../entity/jeSchedules/jeSchedulesReducer';
|
|
7
|
+
export declare type ActionType = ReturnType<typeof fetchJeSchedules> | ReturnType<typeof fetchJeSchedulesFailure> | ReturnType<typeof fetchJeSchedulesSuccess> | ReturnType<typeof initializeJeScheduleLocalData> | ReturnType<typeof updateJESchedules> | ReturnType<typeof updateJESchedulesDetails>;
|
|
8
|
+
export declare const fetchJeSchedulesEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,59 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchJeSchedulesEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
|
+
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
8
|
+
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
9
|
+
const jeSchedulesReducer_1 = require("../../../../entity/jeSchedules/jeSchedulesReducer");
|
|
10
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
11
|
+
const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.fetchJeSchedules.match), (0, operators_1.switchMap)((action) => {
|
|
12
|
+
const state = state$.value;
|
|
13
|
+
const {
|
|
14
|
+
// expenseAutomationJESchedulesViewState: {fetchState},
|
|
15
|
+
expenseAutomationViewState: { selectedPeriodByTenantId }, } = state;
|
|
16
|
+
const { period } = action.payload;
|
|
17
|
+
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
18
|
+
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
19
|
+
// if (fetchState !== 'Not-Started') {
|
|
20
|
+
const queryParam = {
|
|
21
|
+
start_date: (0, timePeriod_1.toString)(period.start),
|
|
22
|
+
end_date: (0, timePeriod_1.toString)(period.end),
|
|
23
|
+
};
|
|
24
|
+
return zeniAPI
|
|
25
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expenses_automation/je_schedules?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
26
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
27
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
28
|
+
const updateActions = [];
|
|
29
|
+
updateActions.push((0, jeSchedulesReducer_1.updateJESchedules)([
|
|
30
|
+
...response.data.draft_je_schedules,
|
|
31
|
+
...response.data.failed_je_postings.je_schedules,
|
|
32
|
+
]), (0, jeSchedulesReducer_1.updateJESchedulesDetails)([...response.data.failed_je_postings.je_schedules], response.data.failed_je_postings.scheduled_journal_entries), (0, jeSchedulesViewReducer_1.initializeJeScheduleLocalData)([
|
|
33
|
+
...response.data.failed_je_postings.je_schedules,
|
|
34
|
+
]));
|
|
35
|
+
updateActions.push((0, jeSchedulesViewReducer_1.fetchJeSchedulesSuccess)({
|
|
36
|
+
jeSchedules: [...response.data.draft_je_schedules],
|
|
37
|
+
failedJeSchedules: [
|
|
38
|
+
...response.data.failed_je_postings.je_schedules,
|
|
39
|
+
],
|
|
40
|
+
selectedPeriod: selectedPeriod,
|
|
41
|
+
}));
|
|
42
|
+
return (0, rxjs_1.from)(updateActions);
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
return (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.fetchJeSchedulesFailure)({
|
|
46
|
+
status: response.status,
|
|
47
|
+
selectedPeriod,
|
|
48
|
+
}));
|
|
49
|
+
}
|
|
50
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.fetchJeSchedulesFailure)({
|
|
51
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'fetch JE schedules REST API call errored out' +
|
|
52
|
+
JSON.stringify(error)),
|
|
53
|
+
selectedPeriod,
|
|
54
|
+
}))));
|
|
55
|
+
// } else {
|
|
56
|
+
// return from([] as ActionType[]);
|
|
57
|
+
// }
|
|
58
|
+
}));
|
|
59
|
+
exports.fetchJeSchedulesEpic = fetchJeSchedulesEpic;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
3
|
+
import { RootState } from '../../../../reducer';
|
|
4
|
+
import { updateJESchedulesDetails, updateJESchedules } from '../../../../entity/jeSchedules/jeSchedulesReducer';
|
|
5
|
+
import { ignoreRecommendedJeSchedule, ignoreRecommendedJeScheduleSuccess, ignoreRecommendedJeScheduleFailure, removeJeScheduleTransactionKey } from '../../reducers/jeSchedulesViewReducer';
|
|
6
|
+
export declare type ActionType = ReturnType<typeof ignoreRecommendedJeSchedule> | ReturnType<typeof updateJESchedulesDetails> | ReturnType<typeof updateJESchedules> | ReturnType<typeof removeJeScheduleTransactionKey> | ReturnType<typeof ignoreRecommendedJeScheduleFailure> | ReturnType<typeof ignoreRecommendedJeScheduleSuccess>;
|
|
7
|
+
export declare const ignoreRecommendedJeScheduleEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.ignoreRecommendedJeScheduleEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
|
+
const jeSchedulesReducer_1 = require("../../../../entity/jeSchedules/jeSchedulesReducer");
|
|
8
|
+
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
9
|
+
const jeSchedulesSelector_1 = require("../../../../entity/jeSchedules/jeSchedulesSelector");
|
|
10
|
+
const jeSchedulesPayload_1 = require("../../payload/jeSchedulesPayload");
|
|
11
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
12
|
+
const ignoreRecommendedJeScheduleEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.ignoreRecommendedJeSchedule.match), (0, operators_1.mergeMap)((action) => {
|
|
13
|
+
const state = state$.value;
|
|
14
|
+
const { expenseAutomationViewState: { selectedPeriodByTenantId }, } = state;
|
|
15
|
+
const { scheduleType, jeScheduleTransactionKey } = action.payload;
|
|
16
|
+
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
17
|
+
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
18
|
+
const actions = [];
|
|
19
|
+
const jeScheduleTransactionState = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleTransactionKey, state);
|
|
20
|
+
const payload = Object.assign({}, (0, jeSchedulesPayload_1.prepareIgnoreSchedulePayload)(scheduleType, jeScheduleTransactionState, state));
|
|
21
|
+
const queryParam = {
|
|
22
|
+
je_schedule_type: scheduleType,
|
|
23
|
+
};
|
|
24
|
+
const ignoreScheduleApi = zeniAPI.putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules/ignore/${jeScheduleTransactionState.jeScheduleId}?query=${encodeURIComponent(JSON.stringify(queryParam))}`, payload);
|
|
25
|
+
return ignoreScheduleApi.pipe((0, operators_1.mergeMap)((response) => {
|
|
26
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
27
|
+
actions.push((0, jeSchedulesReducer_1.updateJESchedules)(response.data.je_schedules), (0, jeSchedulesReducer_1.updateJESchedulesDetails)(response.data.je_schedules, response.data.scheduled_journal_entries));
|
|
28
|
+
actions.push((0, jeSchedulesViewReducer_1.ignoreRecommendedJeScheduleSuccess)(jeScheduleTransactionKey));
|
|
29
|
+
actions.push((0, jeSchedulesViewReducer_1.removeJeScheduleTransactionKey)(jeScheduleTransactionKey, selectedPeriod));
|
|
30
|
+
return (0, rxjs_1.from)(actions);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.ignoreRecommendedJeScheduleFailure)({
|
|
34
|
+
status: response.status,
|
|
35
|
+
jeScheduleTransactionKey: jeScheduleTransactionKey,
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.ignoreRecommendedJeScheduleFailure)({
|
|
39
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'ignore JE schedules REST API call errored out' +
|
|
40
|
+
JSON.stringify(error)),
|
|
41
|
+
jeScheduleTransactionKey: jeScheduleTransactionKey,
|
|
42
|
+
}))));
|
|
43
|
+
}));
|
|
44
|
+
exports.ignoreRecommendedJeScheduleEpic = ignoreRecommendedJeScheduleEpic;
|
package/lib/view/expenseAutomationView/epics/jeSchedule/initializeJeScheduleLocalDataEpic.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../../reducer';
|
|
4
|
+
import { initializeJeScheduleLocalData, updateJeScheduleLocalDataById } from '../../reducers/jeSchedulesViewReducer';
|
|
5
|
+
export declare type ActionType = ReturnType<typeof initializeJeScheduleLocalData> | ReturnType<typeof updateJeScheduleLocalDataById>;
|
|
6
|
+
export declare const initializeJeScheduleLocalDataEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.initializeJeScheduleLocalDataEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
7
|
+
const jeSchedulesSelector_1 = require("../../../../entity/jeSchedules/jeSchedulesSelector");
|
|
8
|
+
const initializeJeScheduleLocalDataEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.initializeJeScheduleLocalData.match), (0, operators_1.mergeMap)((action) => {
|
|
9
|
+
const state = state$.value;
|
|
10
|
+
const actions = [];
|
|
11
|
+
const { jeScheduleTransactionKeys } = action.payload;
|
|
12
|
+
jeScheduleTransactionKeys.forEach((jeScheduleTransactionKey) => {
|
|
13
|
+
const jeScheduledTransaction = (0, jeSchedulesSelector_1.getJEScheduledTransactionByJEScheduleTransactionKey)(jeScheduleTransactionKey, state);
|
|
14
|
+
const initLocalData = {
|
|
15
|
+
jeScheduleType: jeScheduledTransaction.jeScheduleType,
|
|
16
|
+
jeScheduleID: jeScheduledTransaction.jeScheduleId,
|
|
17
|
+
scheduledJournalEntryID: jeScheduledTransaction.scheduledJournalEntry[0]
|
|
18
|
+
.scheduledJournalEntryID,
|
|
19
|
+
};
|
|
20
|
+
actions.push((0, jeSchedulesViewReducer_1.updateJeScheduleLocalDataById)({
|
|
21
|
+
localData: initLocalData,
|
|
22
|
+
scheduledJournalEntryID: jeScheduledTransaction.scheduledJournalEntry[0]
|
|
23
|
+
.scheduledJournalEntryID,
|
|
24
|
+
}));
|
|
25
|
+
});
|
|
26
|
+
return (0, rxjs_1.from)(actions);
|
|
27
|
+
}));
|
|
28
|
+
exports.initializeJeScheduleLocalDataEpic = initializeJeScheduleLocalDataEpic;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
4
|
+
import { RootState } from '../../../../reducer';
|
|
5
|
+
import { updateJeScheduleTransactionKeys, removeFailedJeScheduleTransactionKey, retryJeSchedule, retryJeScheduleFailure, retryJeScheduleSuccess } from '../../reducers/jeSchedulesViewReducer';
|
|
6
|
+
import { updateJESchedules, updateJESchedulesDetails } from '../../../../entity/jeSchedules/jeSchedulesReducer';
|
|
7
|
+
export declare type ActionType = ReturnType<typeof retryJeSchedule> | ReturnType<typeof retryJeScheduleFailure> | ReturnType<typeof retryJeScheduleSuccess> | ReturnType<typeof removeFailedJeScheduleTransactionKey> | ReturnType<typeof updateJESchedules> | ReturnType<typeof updateJESchedulesDetails> | ReturnType<typeof updateJeScheduleTransactionKeys>;
|
|
8
|
+
export declare const retryJeScheduleEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.retryJeScheduleEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
7
|
+
const jeSchedulesViewReducer_1 = require("../../reducers/jeSchedulesViewReducer");
|
|
8
|
+
const jeSchedulesPayload_1 = require("../../payload/jeSchedulesPayload");
|
|
9
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
10
|
+
const retryJeScheduleEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(jeSchedulesViewReducer_1.retryJeSchedule.match), (0, operators_1.switchMap)((action) => {
|
|
11
|
+
const state = state$.value;
|
|
12
|
+
const { expenseAutomationJESchedulesViewState: { jeScheduleLocalDataById }, expenseAutomationViewState: { selectedPeriodByTenantId }, } = state;
|
|
13
|
+
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
14
|
+
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
15
|
+
const { scheduledJournalEntryID, jeScheduleTransactionKey } = action.payload;
|
|
16
|
+
const jeSchedule = jeScheduleLocalDataById[scheduledJournalEntryID];
|
|
17
|
+
if (jeSchedule == null) {
|
|
18
|
+
return (0, rxjs_1.from)([]);
|
|
19
|
+
}
|
|
20
|
+
const payload = Object.assign({}, (0, jeSchedulesPayload_1.preparePayloadForRetryPosting)(jeSchedule));
|
|
21
|
+
return zeniAPI
|
|
22
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules/retry_sje_posting`, payload)
|
|
23
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
24
|
+
if ((0, responsePayload_1.isSuccessStatus)(response)) {
|
|
25
|
+
const updateActions = [];
|
|
26
|
+
updateActions.push((0, jeSchedulesViewReducer_1.retryJeScheduleSuccess)({
|
|
27
|
+
scheduledJournalEntryID,
|
|
28
|
+
}));
|
|
29
|
+
updateActions.push((0, jeSchedulesViewReducer_1.removeFailedJeScheduleTransactionKey)(jeScheduleTransactionKey, selectedPeriod));
|
|
30
|
+
return (0, rxjs_1.from)(updateActions);
|
|
31
|
+
}
|
|
32
|
+
else {
|
|
33
|
+
return (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.retryJeScheduleFailure)({
|
|
34
|
+
status: response.status,
|
|
35
|
+
scheduledJournalEntryID,
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, jeSchedulesViewReducer_1.retryJeScheduleFailure)({
|
|
39
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'retry JE schedule posting REST API call errored out' +
|
|
40
|
+
JSON.stringify(error)),
|
|
41
|
+
scheduledJournalEntryID,
|
|
42
|
+
}))));
|
|
43
|
+
}));
|
|
44
|
+
exports.retryJeScheduleEpic = retryJeScheduleEpic;
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
4
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
5
|
+
import { RootState } from '../../../../reducer';
|
|
6
|
+
import { fetchMissingReceipts, fetchMissingReceiptsSuccess, fetchMissingReceiptsFailure } from '../../reducers/missingReceiptsViewReducer';
|
|
7
|
+
export declare type ActionType = ReturnType<typeof fetchMissingReceipts> | ReturnType<typeof updateTransactions> | ReturnType<typeof fetchMissingReceiptsSuccess> | ReturnType<typeof fetchMissingReceiptsFailure>;
|
|
8
|
+
export declare const fetchMissingReceiptsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.fetchMissingReceiptsEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
|
|
7
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
|
+
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
9
|
+
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
10
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
11
|
+
const fetchMissingReceiptsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchMissingReceipts.match), (0, operators_1.switchMap)((action) => {
|
|
12
|
+
var _a;
|
|
13
|
+
const state = state$.value;
|
|
14
|
+
const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { transactionIdsBySelectedPeriod, fetchState, }, } = state;
|
|
15
|
+
const { period, cacheOverride, minimumTransactionAmount } = action.payload;
|
|
16
|
+
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
17
|
+
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
18
|
+
const transactionIds = (_a = transactionIdsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)]) !== null && _a !== void 0 ? _a : [];
|
|
19
|
+
if (cacheOverride === true ||
|
|
20
|
+
transactionIds.length === 0 ||
|
|
21
|
+
fetchState === 'Not-Started') {
|
|
22
|
+
const queryParam = {
|
|
23
|
+
start_date: (0, timePeriod_1.toString)(period.start),
|
|
24
|
+
end_date: (0, timePeriod_1.toString)(period.end),
|
|
25
|
+
total_amount_min: minimumTransactionAmount.amount,
|
|
26
|
+
is_attachment_missing_only: true,
|
|
27
|
+
sort_by: 'transaction_date',
|
|
28
|
+
sort_order: 'desc',
|
|
29
|
+
};
|
|
30
|
+
return zeniAPI
|
|
31
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/transactions?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
32
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
33
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
34
|
+
const updateActions = [];
|
|
35
|
+
updateActions.push((0, transactionReducer_1.updateTransactions)(response.data.transactions, (value) => value.transaction_id));
|
|
36
|
+
updateActions.push((0, missingReceiptsViewReducer_1.fetchMissingReceiptsSuccess)({
|
|
37
|
+
transactionsPayload: response.data.transactions,
|
|
38
|
+
selectedPeriod,
|
|
39
|
+
}));
|
|
40
|
+
return (0, rxjs_1.from)(updateActions);
|
|
41
|
+
}
|
|
42
|
+
else {
|
|
43
|
+
return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchMissingReceiptsFailure)({
|
|
44
|
+
status: response.status,
|
|
45
|
+
selectedPeriod,
|
|
46
|
+
}));
|
|
47
|
+
}
|
|
48
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchMissingReceiptsFailure)({
|
|
49
|
+
status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'fetch missing receipts REST API call errored out' +
|
|
50
|
+
JSON.stringify(error)),
|
|
51
|
+
selectedPeriod,
|
|
52
|
+
}))));
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
return (0, rxjs_1.from)([]);
|
|
56
|
+
}
|
|
57
|
+
}));
|
|
58
|
+
exports.fetchMissingReceiptsEpic = fetchMissingReceiptsEpic;
|
package/lib/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.d.ts
ADDED
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ActionsObservable } from 'redux-observable';
|
|
2
|
+
import { updateTransaction } from '../../../../entity/transaction/transactionReducer';
|
|
3
|
+
import { uploadMissingReceiptSuccess } from '../../reducers/missingReceiptsViewReducer';
|
|
4
|
+
export declare type ActionType = ReturnType<typeof uploadMissingReceiptSuccess> | ReturnType<typeof updateTransaction>;
|
|
5
|
+
export declare const uploadMissingReceiptSuccessEpic: (actions$: ActionsObservable<ActionType>) => import("rxjs").Observable<import("@reduxjs/toolkit").PayloadAction<{
|
|
6
|
+
id: string;
|
|
7
|
+
payload: import("../../../..").SupportedTransactionPayload;
|
|
8
|
+
}, string, {
|
|
9
|
+
updateType: import("../../../..").UpdateType;
|
|
10
|
+
}, never>>;
|