@zeniai/client-epic-state 4.13.84 → 4.13.86
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/view/expenseAutomationView/epics/fluxAnalysis/reviewFluxAnalysisEpic.js +1 -1
- package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.d.ts +2 -6
- package/lib/view/expenseAutomationView/reducers/fluxAnalysisViewReducer.js +7 -19
- package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +6 -2
- package/package.json +1 -1
|
@@ -11,7 +11,7 @@ const vendorReducer_1 = require("../../../../entity/vendor/vendorReducer");
|
|
|
11
11
|
const userReducer_1 = require("../../../../entity/user/userReducer");
|
|
12
12
|
const helpers_1 = require("../../helpers/helpers");
|
|
13
13
|
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
14
|
-
const reviewFluxAnalysisViewEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(fluxAnalysisViewReducer_1.reviewFluxAnalysisView.match), (0, operators_1.
|
|
14
|
+
const reviewFluxAnalysisViewEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(fluxAnalysisViewReducer_1.reviewFluxAnalysisView.match), (0, operators_1.mergeMap)((action) => {
|
|
15
15
|
const { actionType, operatingExpenseIds, selectedPeriod, isBulk } = action.payload;
|
|
16
16
|
const payload = Object.assign({}, getReviewFluxPayload(actionType, operatingExpenseIds));
|
|
17
17
|
return zeniAPI
|
|
@@ -1,15 +1,11 @@
|
|
|
1
|
-
import { FluxAnalysisActionType,
|
|
1
|
+
import { FluxAnalysisActionType, FluxAnalysisViewState, FluxAnalysisViewUIState } from '../types/fluxAnalysisViewState';
|
|
2
2
|
import { MonthYearPeriod } from '../../../commonStateTypes/timePeriod';
|
|
3
3
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
4
4
|
import { FluxAnalysisOperatingExpensePayload, PageMetadataPayload } from '../payload/fluxAnalysisPayload';
|
|
5
|
-
import {
|
|
5
|
+
import { ID } from '../../../commonStateTypes/common';
|
|
6
6
|
import { CurrencyPayload } from '../../../commonPayloadTypes/v2/viewAndReportPayloadv2';
|
|
7
7
|
import { PageToken } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
8
8
|
export declare const initialState: FluxAnalysisViewState;
|
|
9
|
-
export declare const toFluxAnalysisiOperatingExpensesById: (operatingExpenses: FluxAnalysisOperatingExpensePayload[], currency: CurrencyPayload) => Record<ID, FluxAnalysisOperatingExpense>;
|
|
10
|
-
export declare const toFluxAnalysisOperatingExpenses: (operatingExpensesPayload: FluxAnalysisOperatingExpensePayload[], currency: CurrencyPayload) => FluxAnalysisOperatingExpense[];
|
|
11
|
-
export declare const toFluxAnalysisOperatingEexpense: (operatingExpensePayload: FluxAnalysisOperatingExpensePayload, currency: CurrencyPayload) => FluxAnalysisOperatingExpense;
|
|
12
|
-
export declare const toReviewStatusById: (operatingExpenses: FluxAnalysisOperatingExpensePayload[]) => Record<ID, FetchStateAndError>;
|
|
13
9
|
export declare const fetchFluxAnalysisView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[monthAndYear: MonthYearPeriod, cacheOverride: boolean, refreshViewInBackground: boolean, pageToken: PageToken, keepExistingListItems?: boolean | undefined, resetListItems?: boolean | undefined], {
|
|
14
10
|
monthAndYear: MonthYearPeriod;
|
|
15
11
|
refreshViewInBackground: boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.updateFluxAnalysisViewPageMetaData = exports.updateFluxAnalysisViewUIState = exports.reviewFluxAnalysisViewFailure = exports.reviewFluxAnalysisViewSuccess = exports.reviewFluxAnalysisView = exports.updateOperatingExpensesIdsForReview = exports.clearExpenseAutomationFluxAnalysisView = exports.fetchFluxAnalysisViewFailure = exports.fetchFluxAnalysisViewSuccess = exports.fetchFluxAnalysisView = exports.
|
|
4
|
+
exports.updateFluxAnalysisViewPageMetaData = exports.updateFluxAnalysisViewUIState = exports.reviewFluxAnalysisViewFailure = exports.reviewFluxAnalysisViewSuccess = exports.reviewFluxAnalysisView = exports.updateOperatingExpensesIdsForReview = exports.clearExpenseAutomationFluxAnalysisView = exports.fetchFluxAnalysisViewFailure = exports.fetchFluxAnalysisViewSuccess = exports.fetchFluxAnalysisView = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
7
7
|
const helpers_1 = require("../helpers/helpers");
|
|
@@ -77,13 +77,13 @@ const expenseAutomationFluxAnalysisView = (0, toolkit_1.createSlice)({
|
|
|
77
77
|
else {
|
|
78
78
|
draft.refreshStatus = { fetchState: 'Completed', error: undefined };
|
|
79
79
|
}
|
|
80
|
-
draft.reviewStatusById = Object.assign(Object.assign({}, draft.reviewStatusById),
|
|
80
|
+
draft.reviewStatusById = Object.assign(Object.assign({}, draft.reviewStatusById), toReviewStatusById(expensesPayload));
|
|
81
81
|
const fluxOpExEntityIds = expensesPayload.map((expense) => expense.flux_analysis_entity_id);
|
|
82
82
|
if (keepExistingListItems === true) {
|
|
83
83
|
const allFluxAnalysisEntities = {
|
|
84
84
|
operatingExpenses: [
|
|
85
85
|
...draft.fluxAnalysisEntities.operatingExpenses,
|
|
86
|
-
...
|
|
86
|
+
...toFluxAnalysisOperatingExpenses(expensesPayload, currency),
|
|
87
87
|
],
|
|
88
88
|
};
|
|
89
89
|
const allOperatingExpenseIdsBySelectedPeriod = [
|
|
@@ -97,7 +97,7 @@ const expenseAutomationFluxAnalysisView = (0, toolkit_1.createSlice)({
|
|
|
97
97
|
draft.operatingExpenseIdsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = fluxOpExEntityIds;
|
|
98
98
|
draft.fluxAnalysisEntities = {
|
|
99
99
|
operatingExpenses: [
|
|
100
|
-
...
|
|
100
|
+
...toFluxAnalysisOperatingExpenses(expensesPayload, currency),
|
|
101
101
|
...draft.fluxAnalysisEntities.operatingExpenses,
|
|
102
102
|
],
|
|
103
103
|
};
|
|
@@ -149,7 +149,7 @@ const expenseAutomationFluxAnalysisView = (0, toolkit_1.createSlice)({
|
|
|
149
149
|
draft.reviewStatusById[opExPayload.flux_analysis_entity_id] = {
|
|
150
150
|
fetchState: 'Completed',
|
|
151
151
|
};
|
|
152
|
-
const fluxEntity = (
|
|
152
|
+
const fluxEntity = toFluxAnalysisOperatingExpense(opExPayload, currency);
|
|
153
153
|
updatedFluxEntities = updatedFluxEntities.filter((fluxEntity) => fluxEntity.operatingExpenseId !==
|
|
154
154
|
opExPayload.flux_analysis_entity_id);
|
|
155
155
|
updatedFluxEntities.push(fluxEntity);
|
|
@@ -198,24 +198,14 @@ const expenseAutomationFluxAnalysisView = (0, toolkit_1.createSlice)({
|
|
|
198
198
|
},
|
|
199
199
|
},
|
|
200
200
|
});
|
|
201
|
-
const toFluxAnalysisiOperatingExpensesById = (operatingExpenses, currency) => {
|
|
202
|
-
const balancesByVendorKey = {};
|
|
203
|
-
operatingExpenses.forEach((operatingExpense) => {
|
|
204
|
-
const vendorFluxKey = operatingExpense.flux_analysis_entity_id;
|
|
205
|
-
balancesByVendorKey[vendorFluxKey] = (0, exports.toFluxAnalysisOperatingEexpense)(operatingExpense, currency);
|
|
206
|
-
});
|
|
207
|
-
return balancesByVendorKey;
|
|
208
|
-
};
|
|
209
|
-
exports.toFluxAnalysisiOperatingExpensesById = toFluxAnalysisiOperatingExpensesById;
|
|
210
201
|
const toFluxAnalysisOperatingExpenses = (operatingExpensesPayload, currency) => {
|
|
211
202
|
const operatingExpenses = [];
|
|
212
203
|
operatingExpensesPayload.forEach((operatingExpensePayload) => {
|
|
213
|
-
operatingExpenses.push((
|
|
204
|
+
operatingExpenses.push(toFluxAnalysisOperatingExpense(operatingExpensePayload, currency));
|
|
214
205
|
});
|
|
215
206
|
return operatingExpenses;
|
|
216
207
|
};
|
|
217
|
-
|
|
218
|
-
const toFluxAnalysisOperatingEexpense = (operatingExpensePayload, currency) => {
|
|
208
|
+
const toFluxAnalysisOperatingExpense = (operatingExpensePayload, currency) => {
|
|
219
209
|
var _a;
|
|
220
210
|
return {
|
|
221
211
|
operatingExpenseId: operatingExpensePayload.flux_analysis_entity_id,
|
|
@@ -234,7 +224,6 @@ const toFluxAnalysisOperatingEexpense = (operatingExpensePayload, currency) => {
|
|
|
234
224
|
balancesByMonth: (0, helpers_1.toBalancesByMonthFromPayload)(operatingExpensePayload.month_1, operatingExpensePayload.month_2, currency),
|
|
235
225
|
};
|
|
236
226
|
};
|
|
237
|
-
exports.toFluxAnalysisOperatingEexpense = toFluxAnalysisOperatingEexpense;
|
|
238
227
|
const toReviewStatusById = (operatingExpenses) => {
|
|
239
228
|
const reviewStatusById = {};
|
|
240
229
|
operatingExpenses.forEach((operatingExpense) => {
|
|
@@ -245,6 +234,5 @@ const toReviewStatusById = (operatingExpenses) => {
|
|
|
245
234
|
});
|
|
246
235
|
return reviewStatusById;
|
|
247
236
|
};
|
|
248
|
-
exports.toReviewStatusById = toReviewStatusById;
|
|
249
237
|
_a = expenseAutomationFluxAnalysisView.actions, exports.fetchFluxAnalysisView = _a.fetchFluxAnalysisView, exports.fetchFluxAnalysisViewSuccess = _a.fetchFluxAnalysisViewSuccess, exports.fetchFluxAnalysisViewFailure = _a.fetchFluxAnalysisViewFailure, exports.clearExpenseAutomationFluxAnalysisView = _a.clearExpenseAutomationFluxAnalysisView, exports.updateOperatingExpensesIdsForReview = _a.updateOperatingExpensesIdsForReview, exports.reviewFluxAnalysisView = _a.reviewFluxAnalysisView, exports.reviewFluxAnalysisViewSuccess = _a.reviewFluxAnalysisViewSuccess, exports.reviewFluxAnalysisViewFailure = _a.reviewFluxAnalysisViewFailure, exports.updateFluxAnalysisViewUIState = _a.updateFluxAnalysisViewUIState, exports.updateFluxAnalysisViewPageMetaData = _a.updateFluxAnalysisViewPageMetaData;
|
|
250
238
|
exports.default = expenseAutomationFluxAnalysisView.reducer;
|
|
@@ -68,8 +68,12 @@ function getExpenseAutomationFluxAnalysisView(state) {
|
|
|
68
68
|
// If all operating expenses are fetched and reviewed, then the bulk review status should be 'complete'
|
|
69
69
|
// If there are no operating expenses (after fetch state is completed), then the bulk review status should be 'complete'
|
|
70
70
|
// If the flux analysis is complete and all operating expenses are reviewed (in our state), then the bulk review status should be 'complete'
|
|
71
|
-
const completionStatus = (isFetchStateCompleted &&
|
|
72
|
-
|
|
71
|
+
const completionStatus = (isFetchStateCompleted &&
|
|
72
|
+
allOperatingExpensesReviewed &&
|
|
73
|
+
uiState.hasMore === false) ||
|
|
74
|
+
(isFetchStateCompleted &&
|
|
75
|
+
operatingExpensesView.length === 0 &&
|
|
76
|
+
uiState.hasMore === false) ||
|
|
73
77
|
(fluxCompletionStatus === 'complete' && allOperatingExpensesReviewed)
|
|
74
78
|
? 'complete'
|
|
75
79
|
: 'incomplete';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.86",
|
|
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
|
"types": "lib/index.d.ts",
|