@zeniai/client-epic-state 5.1.20 → 5.1.21-betaRD2
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/transaction/payloadTypes/customerTransactionPayload.js +1 -1
- package/lib/epic.d.ts +2 -1
- package/lib/epic.js +2 -1
- package/lib/esm/entity/transaction/payloadTypes/customerTransactionPayload.js +2 -2
- package/lib/esm/epic.js +2 -1
- package/lib/esm/index.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/fluxAnalysis/fetchFluxAnalysisViewEpic.js +1 -0
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +49 -11
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +30 -3
- package/lib/esm/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.js +6 -1
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +37 -17
- package/lib/esm/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +2 -1
- package/lib/esm/view/opExByVendor/opExByVendorReducer.js +28 -5
- package/lib/esm/view/opExByVendor/opExByVendorSelector.js +1 -0
- package/lib/esm/view/opExByVendor/refreshOpExByVendorReportEpic.js +21 -0
- package/lib/index.d.ts +2 -2
- package/lib/index.js +34 -33
- package/lib/view/expenseAutomationView/epics/fluxAnalysis/fetchFluxAnalysisViewEpic.js +1 -0
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +47 -9
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +30 -3
- package/lib/view/expenseAutomationView/payload/fluxAnalysisPayload.d.ts +8 -0
- package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +7 -0
- package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.d.ts +2 -1
- package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.js +6 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +37 -17
- package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +2 -1
- package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.d.ts +2 -0
- package/lib/view/opExByVendor/opExByVendorReducer.d.ts +6 -1
- package/lib/view/opExByVendor/opExByVendorReducer.js +29 -6
- package/lib/view/opExByVendor/opExByVendorSelector.d.ts +1 -0
- package/lib/view/opExByVendor/opExByVendorSelector.js +1 -0
- package/lib/view/opExByVendor/opExByVendorState.d.ts +1 -0
- package/lib/view/opExByVendor/refreshOpExByVendorReportEpic.d.ts +17 -0
- package/lib/view/opExByVendor/refreshOpExByVendorReportEpic.js +25 -0
- package/package.json +1 -1
|
@@ -5,6 +5,7 @@ exports.updateSelectedSectionIdsForReview = exports.updateFluxAnalysisViewPageMe
|
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
7
7
|
const vendorState_1 = require("../../../entity/vendor/vendorState");
|
|
8
|
+
const zeniDayJS_1 = require("../../../zeniDayJS");
|
|
8
9
|
const helpers_1 = require("../helpers/helpers");
|
|
9
10
|
exports.initialState = {
|
|
10
11
|
fluxAnalysisEntities: { operatingExpenses: [] },
|
|
@@ -35,6 +36,7 @@ exports.initialState = {
|
|
|
35
36
|
fetchState: 'Not-Started',
|
|
36
37
|
error: undefined,
|
|
37
38
|
currency: vendorState_1.defaultVendorCurrency,
|
|
39
|
+
lastRefreshSuccessTime: undefined,
|
|
38
40
|
totalBalancesAndVariance: undefined,
|
|
39
41
|
hasValidState() {
|
|
40
42
|
return this.fetchState == 'Completed';
|
|
@@ -103,7 +105,7 @@ const expenseAutomationFluxAnalysisView = (0, toolkit_1.createSlice)({
|
|
|
103
105
|
},
|
|
104
106
|
},
|
|
105
107
|
fetchFluxAnalysisViewSuccess(draft, action) {
|
|
106
|
-
const { expensesPayload, selectedPeriod, keepExistingListItems, fetchReimbursement, currency, totalsPayload, } = action.payload;
|
|
108
|
+
const { expensesPayload, selectedPeriod, keepExistingListItems, fetchReimbursement, currency, status, totalsPayload, } = action.payload;
|
|
107
109
|
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod);
|
|
108
110
|
const group = draft.groupsBySelectedPeriod[periodId];
|
|
109
111
|
const groupToBeFetched = fetchReimbursement
|
|
@@ -113,6 +115,9 @@ const expenseAutomationFluxAnalysisView = (0, toolkit_1.createSlice)({
|
|
|
113
115
|
// Handle fetch completion
|
|
114
116
|
handleFetchCompletion(draft, selectedPeriod, fetchReimbursement, groupToBeFetched);
|
|
115
117
|
draft.fetchState = 'Completed';
|
|
118
|
+
if (status?.last_refresh_success_time != null) {
|
|
119
|
+
draft.lastRefreshSuccessTime = (0, zeniDayJS_1.date)(status.last_refresh_success_time);
|
|
120
|
+
}
|
|
116
121
|
// Update flux analysis entities
|
|
117
122
|
const allFluxAnalysisEntities = updateFluxAnalysisEntities(draft.fluxAnalysisEntities, expensesPayload, currency);
|
|
118
123
|
// Update operating expense ids based on the "keepExistingListItems" flag
|
|
@@ -160,27 +160,39 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
160
160
|
draft.transactionCategorizationView[selectedTab].fetchState =
|
|
161
161
|
'In-Progress';
|
|
162
162
|
draft.transactionCategorizationView[selectedTab].error = undefined;
|
|
163
|
+
// A foreground fetch supersedes any in-flight background preload.
|
|
164
|
+
// Reset refreshStatus so a cancelled preload doesn't leave the
|
|
165
|
+
// spinner stuck at In-Progress.
|
|
166
|
+
draft.transactionCategorizationView[selectedTab].refreshStatus = {
|
|
167
|
+
fetchState: 'Not-Started',
|
|
168
|
+
error: undefined,
|
|
169
|
+
};
|
|
163
170
|
}
|
|
164
171
|
draft.transactionCategorizationView[selectedTab].uiState.pageToken =
|
|
165
172
|
pageToken ?? null;
|
|
166
|
-
|
|
167
|
-
|
|
173
|
+
// Only overwrite when explicitly set; undefined means a non-search fetch
|
|
174
|
+
// (tab switch, period change) should preserve the existing search string.
|
|
175
|
+
if (searchString !== undefined) {
|
|
176
|
+
draft.transactionCategorizationView[selectedTab].uiState.searchString =
|
|
177
|
+
searchString;
|
|
178
|
+
}
|
|
168
179
|
draft.transactionCategorizationView[selectedTab].error = undefined;
|
|
180
|
+
const monthYearPeriod = {
|
|
181
|
+
month: period.start.month,
|
|
182
|
+
year: period.start.year,
|
|
183
|
+
};
|
|
184
|
+
const periodId = (0, timePeriod_1.toMonthYearPeriodId)(monthYearPeriod);
|
|
185
|
+
const transactionIdsBySelectedPeriod = draft.transactionCategorizationView[selectedTab]
|
|
186
|
+
.transactionIdsBySelectedPeriod[periodId] ?? [];
|
|
169
187
|
// Reset list when we change the sort order and fetch list again
|
|
170
188
|
if (resetListItems === true) {
|
|
171
|
-
const monthYearPeriod = {
|
|
172
|
-
month: period.start.month,
|
|
173
|
-
year: period.start.year,
|
|
174
|
-
};
|
|
175
|
-
const transactionIdsBySelectedPeriod = draft.transactionCategorizationView[selectedTab]
|
|
176
|
-
.transactionIdsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(monthYearPeriod)];
|
|
177
189
|
transactionIdsBySelectedPeriod.forEach((transactionId) => {
|
|
178
190
|
delete draft.transactionCategorizationView[selectedTab]
|
|
179
191
|
.transactionReviewLocalDataById[transactionId];
|
|
180
192
|
});
|
|
181
193
|
draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds =
|
|
182
194
|
draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds.filter((selectedCheckBoxTransactionId) => transactionIdsBySelectedPeriod.includes(selectedCheckBoxTransactionId));
|
|
183
|
-
draft.transactionCategorizationView[selectedTab].transactionIdsBySelectedPeriod[
|
|
195
|
+
draft.transactionCategorizationView[selectedTab].transactionIdsBySelectedPeriod[periodId] = [];
|
|
184
196
|
draft.transactionCategorizationView[selectedTab].refreshStatus = {
|
|
185
197
|
fetchState: 'Not-Started',
|
|
186
198
|
error: undefined,
|
|
@@ -312,10 +324,12 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
312
324
|
}
|
|
313
325
|
},
|
|
314
326
|
updateTransactionFilters(draft, action) {
|
|
315
|
-
const {
|
|
316
|
-
//
|
|
317
|
-
//
|
|
318
|
-
|
|
327
|
+
const { filters } = action.payload;
|
|
328
|
+
// Filters are tab-agnostic (payee/category/class/amount), so apply to
|
|
329
|
+
// all tabs so switching tabs after filtering shows consistent results.
|
|
330
|
+
transactionsViewState_1.TRANSACTIONS_TABS.forEach((tab) => {
|
|
331
|
+
draft.transactionCategorizationView[tab].filters = filters;
|
|
332
|
+
});
|
|
319
333
|
},
|
|
320
334
|
saveTransactionCategorization: {
|
|
321
335
|
prepare(selectedTab, transactionIds, cotTrackingByTransactionId, isUncategorizedExpenseCategoryEnabled) {
|
|
@@ -667,18 +681,24 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
667
681
|
resetOtherTabsFetchState(draft, action) {
|
|
668
682
|
const { tabs, refreshViewInBackground } = action.payload;
|
|
669
683
|
tabs.forEach((tab) => {
|
|
670
|
-
|
|
671
|
-
|
|
672
|
-
|
|
684
|
+
const tabFetchState = draft.transactionCategorizationView[tab].fetchState;
|
|
685
|
+
if (refreshViewInBackground !== true) {
|
|
686
|
+
// Foreground fetch completed: mark other tabs as Completed.
|
|
673
687
|
draft.transactionCategorizationView[tab].fetchState = 'Completed';
|
|
674
688
|
draft.transactionCategorizationView[tab].error = undefined;
|
|
675
689
|
}
|
|
676
|
-
else {
|
|
690
|
+
else if (tabFetchState !== 'In-Progress') {
|
|
691
|
+
// Background fetch completed: reset the other tab's refreshStatus,
|
|
692
|
+
// but only when it is not mid-load. During a dual-search the active
|
|
693
|
+
// tab has its own foreground fetch in flight — clobbering its
|
|
694
|
+
// fetchState here would drop the skeleton and show an empty list.
|
|
677
695
|
draft.transactionCategorizationView[tab].refreshStatus = {
|
|
678
696
|
fetchState: 'Not-Started',
|
|
679
697
|
error: undefined,
|
|
680
698
|
};
|
|
681
699
|
}
|
|
700
|
+
// If tabFetchState === 'In-Progress' and refreshViewInBackground === true,
|
|
701
|
+
// leave the other tab's state untouched — it has its own active fetch.
|
|
682
702
|
});
|
|
683
703
|
},
|
|
684
704
|
fetchTransactionCategorizationFailure(draft, action) {
|
|
@@ -11,7 +11,7 @@ const vendorSelector_1 = require("../../../entity/vendor/vendorSelector");
|
|
|
11
11
|
const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
|
|
12
12
|
function getExpenseAutomationFluxAnalysisView(state) {
|
|
13
13
|
const { expenseAutomationFluxAnalysisViewState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
|
|
14
|
-
const { fetchState, error, refreshStatus, uiState, reviewOperatingExpenseIdsByPeriod, selectedSectionIdsByPeriod, groupsBySelectedPeriod, fluxAnalysisEntities, bulkReviewStatus, currency, totalBalancesAndVariance, } = expenseAutomationFluxAnalysisViewState;
|
|
14
|
+
const { fetchState, error, lastRefreshSuccessTime, refreshStatus, uiState, reviewOperatingExpenseIdsByPeriod, selectedSectionIdsByPeriod, groupsBySelectedPeriod, fluxAnalysisEntities, bulkReviewStatus, currency, totalBalancesAndVariance, } = expenseAutomationFluxAnalysisViewState;
|
|
15
15
|
const fetchStateAndError = {
|
|
16
16
|
fetchState,
|
|
17
17
|
error,
|
|
@@ -113,6 +113,7 @@ function getExpenseAutomationFluxAnalysisView(state) {
|
|
|
113
113
|
refreshStatus,
|
|
114
114
|
currency,
|
|
115
115
|
completionStatus,
|
|
116
|
+
lastRefreshSuccessTime,
|
|
116
117
|
};
|
|
117
118
|
}
|
|
118
119
|
// Helper function to transform operating expense to vendor view
|
|
@@ -5,6 +5,7 @@ import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderType
|
|
|
5
5
|
import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
6
6
|
import { PageToken } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
7
7
|
import { FluxAnalysisSectionType } from '../selectorTypes/fluxAnalysisViewSelectorTypes';
|
|
8
|
+
import { ZeniDate } from '../../../zeniDayJS';
|
|
8
9
|
declare const toFluxAnalysisSortKey: (v: string) => "vendor" | "status" | "variance";
|
|
9
10
|
export type FluxAnalysisSortKey = ReturnType<typeof toFluxAnalysisSortKey>;
|
|
10
11
|
export type FluxAnalysisActionType = 'review' | 'unreview';
|
|
@@ -75,5 +76,6 @@ export interface FluxAnalysisViewState extends FetchedState {
|
|
|
75
76
|
selectedSectionIdsByPeriod: Record<MonthYearPeriodId, FluxAnalysisSectionType[]>;
|
|
76
77
|
totalBalancesAndVariance: BalancesAndVariance | undefined;
|
|
77
78
|
uiState: FluxAnalysisViewUIState;
|
|
79
|
+
lastRefreshSuccessTime?: ZeniDate;
|
|
78
80
|
}
|
|
79
81
|
export {};
|
|
@@ -3,6 +3,7 @@ import { COABalanceType } from '../../commonStateTypes/coaBalance/coaBalanceType
|
|
|
3
3
|
import { FetchState } from '../../commonStateTypes/common';
|
|
4
4
|
import { SortOrder } from '../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
5
5
|
import { ZeniAPIStatus } from '../../responsePayload';
|
|
6
|
+
import { ZeniDate } from '../../zeniDayJS';
|
|
6
7
|
import { OpexByVendorReportPayload, OpexByVendorReportSummaryPayload } from './opExByVendorPayload';
|
|
7
8
|
import { OpExByVendorQuery, OpExByVendorState, OpexByVendorSortKey } from './opExByVendorState';
|
|
8
9
|
export declare const defaultTimeframePeriodsOpExByVendor: {
|
|
@@ -52,6 +53,10 @@ export declare const fetchOpExByVendor: import("@reduxjs/toolkit").ActionCreator
|
|
|
52
53
|
}, "opExByVendor/clearOpExByVendorSearch">, updateOpExByVendorPageLimit: import("@reduxjs/toolkit").ActionCreatorWithOptionalPayload<number | undefined, "opExByVendor/updateOpExByVendorPageLimit">, updateOpExByVendorSearchString: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
53
54
|
searchText: string;
|
|
54
55
|
timeframe: COABalanceMonthQuarterTimeframe;
|
|
55
|
-
}, "opExByVendor/updateOpExByVendorSearchString"
|
|
56
|
+
}, "opExByVendor/updateOpExByVendorSearchString">, refreshOpExByVendorReport: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"opExByVendor/refreshOpExByVendorReport">, refreshOpExByVendorReportSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
57
|
+
lastRefreshSuccessTime: ZeniDate | undefined;
|
|
58
|
+
}, "opExByVendor/refreshOpExByVendorReportSuccess">, refreshOpExByVendorReportFailure: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[error: ZeniAPIStatus<Record<string, unknown>>], {
|
|
59
|
+
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
60
|
+
}, "opExByVendor/refreshOpExByVendorReportFailure", never, never>;
|
|
56
61
|
declare const _default: import("redux").Reducer<OpExByVendorState>;
|
|
57
62
|
export default _default;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.updateOpExByVendorSearchString = exports.updateOpExByVendorPageLimit = exports.clearOpExByVendorSearch = exports.updateOpExByVendorDownloadState = exports.updateOpExByVendorPageFetchInProgress = exports.updateOpExByVendorSortOrSearchInProgress = exports.updateOpExByVendorSort = exports.updateOpExByVendorAdditionalBalancesSelection = exports.clearOpExByVendor = exports.updateOpExByVendorUIState = exports.updateOpExByVendorTimeFrame = exports.updateOpExByVendorReportSummarySuccess = exports.updateOpExByVendorReportSummaryFailure = exports.fetchOpExByVendorReportSummary = exports.updateOpExByVendorReportSuccessForTimeframe = exports.updateOpExByVendorReportFailureForTimeframe = exports.fetchOpExByVendorReportForTimeframe = exports.updateOpExByVendorReportGenerated = exports.fetchOpExByVendor = exports.initialState = exports.initialSearchStringState = exports.defaultTimeframePeriodsOpExByVendor = void 0;
|
|
4
|
+
exports.refreshOpExByVendorReportFailure = exports.refreshOpExByVendorReportSuccess = exports.refreshOpExByVendorReport = exports.updateOpExByVendorSearchString = exports.updateOpExByVendorPageLimit = exports.clearOpExByVendorSearch = exports.updateOpExByVendorDownloadState = exports.updateOpExByVendorPageFetchInProgress = exports.updateOpExByVendorSortOrSearchInProgress = exports.updateOpExByVendorSort = exports.updateOpExByVendorAdditionalBalancesSelection = exports.clearOpExByVendor = exports.updateOpExByVendorUIState = exports.updateOpExByVendorTimeFrame = exports.updateOpExByVendorReportSummarySuccess = exports.updateOpExByVendorReportSummaryFailure = exports.fetchOpExByVendorReportSummary = exports.updateOpExByVendorReportSuccessForTimeframe = exports.updateOpExByVendorReportFailureForTimeframe = exports.fetchOpExByVendorReportForTimeframe = exports.updateOpExByVendorReportGenerated = exports.fetchOpExByVendor = exports.initialState = exports.initialSearchStringState = exports.defaultTimeframePeriodsOpExByVendor = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const coaBalancePayload_1 = require("../../commonPayloadTypes/v2/coaBalancePayload");
|
|
7
7
|
const viewAndReportPayload_1 = require("../../commonPayloadTypes/viewAndReportPayload");
|
|
@@ -26,6 +26,10 @@ exports.initialState = {
|
|
|
26
26
|
error: undefined,
|
|
27
27
|
},
|
|
28
28
|
},
|
|
29
|
+
refreshStatus: {
|
|
30
|
+
fetchState: 'Not-Started',
|
|
31
|
+
error: undefined,
|
|
32
|
+
},
|
|
29
33
|
summaryFetchState: {
|
|
30
34
|
fetchState: 'Not-Started',
|
|
31
35
|
error: undefined,
|
|
@@ -263,12 +267,32 @@ const opexByVendor = (0, toolkit_1.createSlice)({
|
|
|
263
267
|
[timeframe]: [],
|
|
264
268
|
};
|
|
265
269
|
},
|
|
270
|
+
refreshOpExByVendorReport(draft) {
|
|
271
|
+
draft.refreshStatus = { fetchState: 'In-Progress', error: undefined };
|
|
272
|
+
},
|
|
273
|
+
refreshOpExByVendorReportSuccess(draft, action) {
|
|
274
|
+
draft.refreshStatus = { fetchState: 'Completed', error: undefined };
|
|
275
|
+
if (action.payload.lastRefreshSuccessTime != null) {
|
|
276
|
+
draft.lastRefreshSuccessTime = action.payload.lastRefreshSuccessTime;
|
|
277
|
+
}
|
|
278
|
+
},
|
|
279
|
+
refreshOpExByVendorReportFailure: {
|
|
280
|
+
prepare(error) {
|
|
281
|
+
return { payload: { error } };
|
|
282
|
+
},
|
|
283
|
+
reducer(draft, action) {
|
|
284
|
+
draft.refreshStatus = {
|
|
285
|
+
fetchState: 'Error',
|
|
286
|
+
error: action.payload.error,
|
|
287
|
+
};
|
|
288
|
+
},
|
|
289
|
+
},
|
|
266
290
|
clearOpExByVendor(draft) {
|
|
267
291
|
Object.assign(draft, exports.initialState);
|
|
268
292
|
},
|
|
269
293
|
},
|
|
270
294
|
});
|
|
271
|
-
_a = opexByVendor.actions, exports.fetchOpExByVendor = _a.fetchOpExByVendor, exports.updateOpExByVendorReportGenerated = _a.updateOpExByVendorReportGenerated, exports.fetchOpExByVendorReportForTimeframe = _a.fetchOpExByVendorReportForTimeframe, exports.updateOpExByVendorReportFailureForTimeframe = _a.updateOpExByVendorReportFailureForTimeframe, exports.updateOpExByVendorReportSuccessForTimeframe = _a.updateOpExByVendorReportSuccessForTimeframe, exports.fetchOpExByVendorReportSummary = _a.fetchOpExByVendorReportSummary, exports.updateOpExByVendorReportSummaryFailure = _a.updateOpExByVendorReportSummaryFailure, exports.updateOpExByVendorReportSummarySuccess = _a.updateOpExByVendorReportSummarySuccess, exports.updateOpExByVendorTimeFrame = _a.updateOpExByVendorTimeFrame, exports.updateOpExByVendorUIState = _a.updateOpExByVendorUIState, exports.clearOpExByVendor = _a.clearOpExByVendor, exports.updateOpExByVendorAdditionalBalancesSelection = _a.updateOpExByVendorAdditionalBalancesSelection, exports.updateOpExByVendorSort = _a.updateOpExByVendorSort, exports.updateOpExByVendorSortOrSearchInProgress = _a.updateOpExByVendorSortOrSearchInProgress, exports.updateOpExByVendorPageFetchInProgress = _a.updateOpExByVendorPageFetchInProgress, exports.updateOpExByVendorDownloadState = _a.updateOpExByVendorDownloadState, exports.clearOpExByVendorSearch = _a.clearOpExByVendorSearch, exports.updateOpExByVendorPageLimit = _a.updateOpExByVendorPageLimit, exports.updateOpExByVendorSearchString = _a.updateOpExByVendorSearchString;
|
|
295
|
+
_a = opexByVendor.actions, exports.fetchOpExByVendor = _a.fetchOpExByVendor, exports.updateOpExByVendorReportGenerated = _a.updateOpExByVendorReportGenerated, exports.fetchOpExByVendorReportForTimeframe = _a.fetchOpExByVendorReportForTimeframe, exports.updateOpExByVendorReportFailureForTimeframe = _a.updateOpExByVendorReportFailureForTimeframe, exports.updateOpExByVendorReportSuccessForTimeframe = _a.updateOpExByVendorReportSuccessForTimeframe, exports.fetchOpExByVendorReportSummary = _a.fetchOpExByVendorReportSummary, exports.updateOpExByVendorReportSummaryFailure = _a.updateOpExByVendorReportSummaryFailure, exports.updateOpExByVendorReportSummarySuccess = _a.updateOpExByVendorReportSummarySuccess, exports.updateOpExByVendorTimeFrame = _a.updateOpExByVendorTimeFrame, exports.updateOpExByVendorUIState = _a.updateOpExByVendorUIState, exports.clearOpExByVendor = _a.clearOpExByVendor, exports.updateOpExByVendorAdditionalBalancesSelection = _a.updateOpExByVendorAdditionalBalancesSelection, exports.updateOpExByVendorSort = _a.updateOpExByVendorSort, exports.updateOpExByVendorSortOrSearchInProgress = _a.updateOpExByVendorSortOrSearchInProgress, exports.updateOpExByVendorPageFetchInProgress = _a.updateOpExByVendorPageFetchInProgress, exports.updateOpExByVendorDownloadState = _a.updateOpExByVendorDownloadState, exports.clearOpExByVendorSearch = _a.clearOpExByVendorSearch, exports.updateOpExByVendorPageLimit = _a.updateOpExByVendorPageLimit, exports.updateOpExByVendorSearchString = _a.updateOpExByVendorSearchString, exports.refreshOpExByVendorReport = _a.refreshOpExByVendorReport, exports.refreshOpExByVendorReportSuccess = _a.refreshOpExByVendorReportSuccess, exports.refreshOpExByVendorReportFailure = _a.refreshOpExByVendorReportFailure;
|
|
272
296
|
exports.default = opexByVendor.reducer;
|
|
273
297
|
const doUpdateOpexByVendorReport = (draft, timeframe, reportPayload, queryProps) => {
|
|
274
298
|
if (reportPayload.status.is_report_generated == null) {
|
|
@@ -321,10 +345,9 @@ const doUpdateOpexByVendorReportSummary = (draft, reportPayload) => {
|
|
|
321
345
|
const report = (0, viewAndReportPayload_1.mapReportPayloadToReport)(reportPayload);
|
|
322
346
|
draft.firstMonthOfFY = report.firstMonthOfFY;
|
|
323
347
|
draft.bookCloseDate = report.bookCloseDate;
|
|
324
|
-
|
|
325
|
-
reportPayload.status.last_refresh_success_time
|
|
326
|
-
|
|
327
|
-
: undefined;
|
|
348
|
+
if (reportPayload.status.last_refresh_success_time != null) {
|
|
349
|
+
draft.lastRefreshSuccessTime = (0, zeniDayJS_1.date)(reportPayload.status.last_refresh_success_time);
|
|
350
|
+
}
|
|
328
351
|
draft.totalOpexByVendor = (0, coaBalancePayload_1.combineCOABalanceGrouped)((0, coaBalancePayload_1.mapCOABalanceGroupedPayloadV2ToCOABalanceGrouped)(reportPayload.operating_expenses, reportPayload.currency, 'month'), (0, coaBalancePayload_1.mapCOABalanceGroupedPayloadV2ToCOABalanceGrouped)(reportPayload.operating_expenses, reportPayload.currency, 'quarter'));
|
|
329
352
|
draft.summaryOpexByVendorKey = mapVendorSummaryBalances(reportPayload.operating_expenses, reportPayload.currency);
|
|
330
353
|
}
|
|
@@ -28,6 +28,7 @@ export interface OpExByVendorReport extends SelectorReport {
|
|
|
28
28
|
filter: COABalancesFilter;
|
|
29
29
|
isReportGenerated: boolean;
|
|
30
30
|
opexBalances: OpExBalancesByVendor[];
|
|
31
|
+
refreshStatus: FetchStateAndError;
|
|
31
32
|
reportFetchState: {
|
|
32
33
|
month: FetchStateAndError;
|
|
33
34
|
quarter: FetchStateAndError;
|
|
@@ -71,6 +71,7 @@ exports.getOpExByVendorReport = (0, toolkit_1.createSelector)((state) => state.o
|
|
|
71
71
|
filter,
|
|
72
72
|
isReportGenerated: opExByVendorState.opExByVendorReportGenerated,
|
|
73
73
|
lastRefreshSuccessTime: opExByVendorState.lastRefreshSuccessTime,
|
|
74
|
+
refreshStatus: opExByVendorState.refreshStatus,
|
|
74
75
|
opexBalances,
|
|
75
76
|
summaryBalances,
|
|
76
77
|
allTimeframeTicks,
|
|
@@ -65,6 +65,7 @@ export interface OpExByVendorState extends Omit<Report, 'dataAvailable'> {
|
|
|
65
65
|
quarter: OpexVendorKey[];
|
|
66
66
|
};
|
|
67
67
|
opExByVendorReportGenerated: boolean;
|
|
68
|
+
refreshStatus: FetchStateAndError;
|
|
68
69
|
reportFetchState: {
|
|
69
70
|
month: FetchStateAndError;
|
|
70
71
|
quarter: FetchStateAndError;
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { RootState } from '../../reducer';
|
|
3
|
+
import { ZeniAPIStatus } from '../../responsePayload';
|
|
4
|
+
import { ZeniAPI } from '../../zeniAPI';
|
|
5
|
+
import { refreshOpExByVendorReport, refreshOpExByVendorReportFailure, refreshOpExByVendorReportSuccess } from './opExByVendorReducer';
|
|
6
|
+
export type ActionType = ReturnType<typeof refreshOpExByVendorReport> | ReturnType<typeof refreshOpExByVendorReportSuccess> | ReturnType<typeof refreshOpExByVendorReportFailure>;
|
|
7
|
+
export declare const refreshOpExByVendorReportEpic: (actions$: ActionsObservable<ActionType>, _state: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
8
|
+
payload: {
|
|
9
|
+
lastRefreshSuccessTime: import("../../zeniDayJS").ZeniDate | undefined;
|
|
10
|
+
};
|
|
11
|
+
type: "opExByVendor/refreshOpExByVendorReportSuccess";
|
|
12
|
+
} | {
|
|
13
|
+
payload: {
|
|
14
|
+
error: ZeniAPIStatus<Record<string, unknown>>;
|
|
15
|
+
};
|
|
16
|
+
type: "opExByVendor/refreshOpExByVendorReportFailure";
|
|
17
|
+
}>;
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.refreshOpExByVendorReportEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const responsePayload_1 = require("../../responsePayload");
|
|
7
|
+
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
8
|
+
const opExByVendorReducer_1 = require("./opExByVendorReducer");
|
|
9
|
+
const refreshOpExByVendorReportEpic = (actions$, _state, zeniAPI) => actions$.pipe((0, operators_1.filter)(opExByVendorReducer_1.refreshOpExByVendorReport.match), (0, operators_1.switchMap)(() => {
|
|
10
|
+
return zeniAPI
|
|
11
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/reports/operating-expenses-by-vendor/refresh`)
|
|
12
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
13
|
+
if (response.status.code >= 200 && response.status.code < 300) {
|
|
14
|
+
const lastRefreshSuccessTime = response.status.last_refresh_success_time != null
|
|
15
|
+
? (0, zeniDayJS_1.date)(response.status.last_refresh_success_time)
|
|
16
|
+
: undefined;
|
|
17
|
+
return (0, rxjs_1.of)((0, opExByVendorReducer_1.refreshOpExByVendorReportSuccess)({ lastRefreshSuccessTime }));
|
|
18
|
+
}
|
|
19
|
+
else {
|
|
20
|
+
return (0, rxjs_1.of)((0, opExByVendorReducer_1.refreshOpExByVendorReportFailure)(response.status));
|
|
21
|
+
}
|
|
22
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, opExByVendorReducer_1.refreshOpExByVendorReportFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Refresh OpEx by Vendor REST API call errored out: ' +
|
|
23
|
+
JSON.stringify(error))))));
|
|
24
|
+
}));
|
|
25
|
+
exports.refreshOpExByVendorReportEpic = refreshOpExByVendorReportEpic;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.1.
|
|
3
|
+
"version": "5.1.21-betaRD2",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"module": "lib/esm/index.js",
|