@zeniai/client-epic-state 4.13.85 → 4.13.87
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/commonVendorView/vendorView/epics/saveVendorEpic.js +4 -0
- package/lib/view/expenseAutomationView/epics/fluxAnalysis/reviewFluxAnalysisEpic.js +1 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/initializeTransactionCategorizationLocalDataEpic.js +12 -3
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +6 -2
- 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/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/transactionsViewState.js +1 -1
- package/lib/view/recommendation/recommendationReducer.js +13 -13
- package/lib/view/recommendation/recommendationState.d.ts +1 -1
- package/lib/view/recommendation/recommendationState.js +2 -2
- package/lib/view/scheduleView/scheduleAccruedDetailView/LinkBillExpenseView/linkBillExpense.d.ts +1 -1
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/package.json +1 -1
|
@@ -85,6 +85,10 @@ const saveVendorEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operator
|
|
|
85
85
|
amount: 0,
|
|
86
86
|
currencyCode: vendorCurrencyCode,
|
|
87
87
|
currencySymbol: vendorCurrencySymbol,
|
|
88
|
+
}, recipientAmount: {
|
|
89
|
+
amount: 0,
|
|
90
|
+
currencyCode: vendorCurrencyCode,
|
|
91
|
+
currencySymbol: vendorCurrencySymbol,
|
|
88
92
|
}, id: '1', lineDescription: '', platformLineDetailType: 'account_based_expense_line_detail', type: 'transaction_with_account_and_class_line', billable: 'not_billable', isCategoryMiscategorized: false, isClassMiscategorized: false }, editBillViewState_1.defaultRecommendationStateObj);
|
|
89
93
|
}
|
|
90
94
|
}
|
|
@@ -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
|
|
@@ -16,7 +16,7 @@ const initializeTransactionCategorizationViewLocalDataEpic = (actions$, state$)
|
|
|
16
16
|
const transactionLocalData = Object.assign({}, transactionReviewLocalDataById);
|
|
17
17
|
const transactions = (0, transactionSelector_1.getSupportedTransactionsByIds)(transactionState, transactionIds);
|
|
18
18
|
transactions.forEach((transaction) => {
|
|
19
|
-
var _a, _b
|
|
19
|
+
var _a, _b;
|
|
20
20
|
const newTransactionsLocalData = (0, transactionCategorizationLocalDataHelper_1.toTransactionDetailLocalData)(transaction);
|
|
21
21
|
if (transactionLocalData[transaction.id] == null) {
|
|
22
22
|
transactionLocalData[transaction.id] = Object.assign(Object.assign({}, transactionsViewState_1.initialSupportedTransactionCategorization), { transactionId: transaction.id, transactionReviewLocalData: Object.assign(Object.assign({}, newTransactionsLocalData), { sortedLineItems: (_b = (_a = transaction.lines) === null || _a === void 0 ? void 0 : _a.map((line) => line.id)) !== null && _b !== void 0 ? _b : [] }) });
|
|
@@ -25,8 +25,8 @@ const initializeTransactionCategorizationViewLocalDataEpic = (actions$, state$)
|
|
|
25
25
|
transactionLocalData[transaction.id] = {
|
|
26
26
|
transactionId: transaction.id,
|
|
27
27
|
transactionReviewLocalData: Object.assign(Object.assign({}, transactionLocalData[transaction.id]
|
|
28
|
-
.transactionReviewLocalData), Object.assign(Object.assign({}, newTransactionsLocalData), { lineItemById: Object.assign(
|
|
29
|
-
.transactionReviewLocalData.lineItemById
|
|
28
|
+
.transactionReviewLocalData), Object.assign(Object.assign({}, newTransactionsLocalData), { lineItemById: Object.assign({}, mergeTransactionLineItems(transactionLocalData[transaction.id]
|
|
29
|
+
.transactionReviewLocalData.lineItemById, newTransactionsLocalData.lineItemById)), sortedLineItems: transactionLocalData[transaction.id].transactionReviewLocalData.sortedLineItems.concat(newTransactionsLocalData.sortedLineItems) })),
|
|
30
30
|
};
|
|
31
31
|
}
|
|
32
32
|
});
|
|
@@ -43,3 +43,12 @@ const initializeTransactionCategorizationViewLocalDataEpic = (actions$, state$)
|
|
|
43
43
|
return (0, rxjs_1.from)(fetchActions);
|
|
44
44
|
}));
|
|
45
45
|
exports.initializeTransactionCategorizationViewLocalDataEpic = initializeTransactionCategorizationViewLocalDataEpic;
|
|
46
|
+
// Better option to merge line items using this helper than merging inline to avoid overwriting the line items in future
|
|
47
|
+
// This function is used to merge the line items of a transaction so that the line items are not overwritten
|
|
48
|
+
function mergeTransactionLineItems(existingLineItems, newLineItems) {
|
|
49
|
+
const mergedLineItems = Object.assign({}, existingLineItems);
|
|
50
|
+
for (const id of Object.keys(newLineItems)) {
|
|
51
|
+
mergedLineItems[id] = Object.assign(Object.assign({}, existingLineItems[id]), newLineItems[id]);
|
|
52
|
+
}
|
|
53
|
+
return mergedLineItems;
|
|
54
|
+
}
|
|
@@ -26,6 +26,10 @@ const toTransactionDetailLocalData = (transaction) => {
|
|
|
26
26
|
transaction.lines != null && transaction.lines.length > 0
|
|
27
27
|
? buildLineItemById(transaction, transaction.recommendations)
|
|
28
28
|
: {};
|
|
29
|
+
transactionLocal.sortedLineItems =
|
|
30
|
+
transaction.lines != null && transaction.lines.length > 0
|
|
31
|
+
? transaction.lines.map((line) => line.id)
|
|
32
|
+
: [];
|
|
29
33
|
return transactionLocal;
|
|
30
34
|
};
|
|
31
35
|
exports.toTransactionDetailLocalData = toTransactionDetailLocalData;
|
|
@@ -168,7 +172,7 @@ const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, tra
|
|
|
168
172
|
}
|
|
169
173
|
});
|
|
170
174
|
}
|
|
171
|
-
const newLocalData = Object.assign(Object.assign({}, transactionsViewState_1.initialSupportedTransactionCategorization.transactionReviewLocalData), { memo: transactionDetailLocalData.memo, lineItemById: newLineItems, transactionDate: transactionDetailLocalData.transactionDate, transactionType: transactionDetailLocalData.transactionType, transactionTypeName: transactionDetailLocalData.transactionTypeName, vendor: transactionDetailLocalData.vendor, vendorUpdates: transactionDetailLocalData.vendorUpdates, vendorDetails: transactionDetailLocalData.vendorDetails });
|
|
175
|
+
const newLocalData = Object.assign(Object.assign({}, transactionsViewState_1.initialSupportedTransactionCategorization.transactionReviewLocalData), { sortedLineItems: transactionDetailLocalData.sortedLineItems, memo: transactionDetailLocalData.memo, lineItemById: newLineItems, transactionDate: transactionDetailLocalData.transactionDate, transactionType: transactionDetailLocalData.transactionType, transactionTypeName: transactionDetailLocalData.transactionTypeName, vendor: transactionDetailLocalData.vendor, vendorUpdates: transactionDetailLocalData.vendorUpdates, vendorDetails: transactionDetailLocalData.vendorDetails });
|
|
172
176
|
if (!(0, exports.checkIfAllLineItemsAreCategoryClassFilled)(transaction, newLocalData)) {
|
|
173
177
|
selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds.filter((id) => id !== transaction.id);
|
|
174
178
|
}
|
|
@@ -232,7 +236,7 @@ const setEntityRecommendationForLineIdInLocalData = (draft, transaction, transac
|
|
|
232
236
|
const newLineItem = newLineItems[matchingEntityLineId];
|
|
233
237
|
newLineItems[matchingEntityLineId] = Object.assign(Object.assign({}, newLineItem), { class: matchingRecord.class, account: matchingRecord.account, lineEntity: matchingRecord.lineEntity });
|
|
234
238
|
}
|
|
235
|
-
const newLocalData = Object.assign(Object.assign({}, transactionsViewState_1.initialSupportedTransactionCategorization.transactionReviewLocalData), { memo: transactionDetailLocalData.memo, lineItemById: newLineItems, transactionDate: transactionDetailLocalData.transactionDate, transactionType: transactionDetailLocalData.transactionType, transactionTypeName: transactionDetailLocalData.transactionTypeName, vendorUpdates: transactionDetailLocalData.vendorUpdates, vendorDetails: transactionDetailLocalData.vendorDetails, vendor: transactionDetailLocalData.vendor });
|
|
239
|
+
const newLocalData = Object.assign(Object.assign({}, transactionsViewState_1.initialSupportedTransactionCategorization.transactionReviewLocalData), { sortedLineItems: transactionDetailLocalData.sortedLineItems, memo: transactionDetailLocalData.memo, lineItemById: newLineItems, transactionDate: transactionDetailLocalData.transactionDate, transactionType: transactionDetailLocalData.transactionType, transactionTypeName: transactionDetailLocalData.transactionTypeName, vendorUpdates: transactionDetailLocalData.vendorUpdates, vendorDetails: transactionDetailLocalData.vendorDetails, vendor: transactionDetailLocalData.vendor });
|
|
236
240
|
if (!(0, exports.checkIfAllLineItemsAreCategoryClassFilled)(transaction, newLocalData)) {
|
|
237
241
|
selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds.filter((id) => id !== transaction.id);
|
|
238
242
|
}
|
|
@@ -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';
|
|
@@ -15,7 +15,7 @@ import { BillableStatus, CategorizationStatusType, PlatformLineDetailType, Produ
|
|
|
15
15
|
import { Entity, EntityType } from '../../../entity/genericEntity/entity';
|
|
16
16
|
import { TransactionType, TransactionCategory } from '../../../entity/transaction/stateTypes/transactionType';
|
|
17
17
|
import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
18
|
-
export declare const toTransactionsSortKey: (v: string) => "date" | "amount" | "vendor" | "
|
|
18
|
+
export declare const toTransactionsSortKey: (v: string) => "date" | "amount" | "vendor" | "transaction_type" | "category" | "class";
|
|
19
19
|
export declare type TransactionsSortKey = ReturnType<typeof toTransactionsSortKey>;
|
|
20
20
|
export declare const toTransactionsTabKey: (v: string) => "review" | "autoCategorized";
|
|
21
21
|
export declare type TransactionsTab = ReturnType<typeof toTransactionsTabKey>;
|
|
@@ -17,9 +17,9 @@ const recommendation = (0, toolkit_1.createSlice)({
|
|
|
17
17
|
action) {
|
|
18
18
|
const { entity } = action.payload;
|
|
19
19
|
const key = (0, recommendationState_1.getEntityRecommendationKey)(entity.type, entity.id);
|
|
20
|
-
const
|
|
21
|
-
if (
|
|
22
|
-
draft.recommendationByEntity[key] = Object.assign(Object.assign({}, recommendationState_1.
|
|
20
|
+
const existingRecommendation = draft.recommendationByEntity[key];
|
|
21
|
+
if (existingRecommendation == null) {
|
|
22
|
+
draft.recommendationByEntity[key] = Object.assign(Object.assign({}, recommendationState_1.initialEntityRecommendationState), { fetchState: 'In-Progress' });
|
|
23
23
|
}
|
|
24
24
|
},
|
|
25
25
|
prepare(entity, amount, transactionDetails, isBulkFetch, isTransactionCategorizationFlow = false) {
|
|
@@ -38,10 +38,10 @@ const recommendation = (0, toolkit_1.createSlice)({
|
|
|
38
38
|
reducer(draft, action) {
|
|
39
39
|
const { entityName, entityType } = action.payload;
|
|
40
40
|
const key = (0, recommendationState_1.getEntityRecommendationKey)(entityType, entityName);
|
|
41
|
-
const
|
|
42
|
-
if (
|
|
43
|
-
|
|
44
|
-
draft.recommendationByEntity[key] = Object.assign(Object.assign({}, recommendationState_1.
|
|
41
|
+
const existingRecommendation = draft.recommendationByEntity[key];
|
|
42
|
+
if (existingRecommendation == null ||
|
|
43
|
+
existingRecommendation.fetchState !== 'Completed') {
|
|
44
|
+
draft.recommendationByEntity[key] = Object.assign(Object.assign({}, recommendationState_1.initialEntityRecommendationState), { fetchState: 'In-Progress' });
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
47
|
prepare(entityName, entityType) {
|
|
@@ -57,10 +57,10 @@ const recommendation = (0, toolkit_1.createSlice)({
|
|
|
57
57
|
reducer(draft, action) {
|
|
58
58
|
const { entityId, entityType } = action.payload;
|
|
59
59
|
const key = (0, recommendationState_1.getEntityRecommendationKey)(entityType, entityId);
|
|
60
|
-
const
|
|
61
|
-
if (
|
|
62
|
-
|
|
63
|
-
draft.recommendationByEntity[key] = Object.assign(Object.assign({}, recommendationState_1.
|
|
60
|
+
const existingRecommendation = draft.recommendationByEntity[key];
|
|
61
|
+
if (existingRecommendation == null ||
|
|
62
|
+
existingRecommendation.fetchState !== 'Completed') {
|
|
63
|
+
draft.recommendationByEntity[key] = Object.assign(Object.assign({}, recommendationState_1.initialEntityRecommendationState), { fetchState: 'In-Progress' });
|
|
64
64
|
}
|
|
65
65
|
},
|
|
66
66
|
prepare(entityId, entityType) {
|
|
@@ -79,7 +79,7 @@ const recommendation = (0, toolkit_1.createSlice)({
|
|
|
79
79
|
updateRecommendationForEntityFailure(draft, action) {
|
|
80
80
|
const { entityId, entityType, status } = action.payload;
|
|
81
81
|
const key = (0, recommendationState_1.getEntityRecommendationKey)(entityType, entityId);
|
|
82
|
-
draft.recommendationByEntity[key] = Object.assign(Object.assign({}, recommendationState_1.
|
|
82
|
+
draft.recommendationByEntity[key] = Object.assign(Object.assign({}, recommendationState_1.initialEntityRecommendationState), { fetchState: 'Error', error: status });
|
|
83
83
|
},
|
|
84
84
|
indicateReadyToInitializeRecommendation: {
|
|
85
85
|
reducer(
|
|
@@ -107,5 +107,5 @@ _a = recommendation.actions, exports.fetchEntityRecommendationsByTransactionId =
|
|
|
107
107
|
exports.default = recommendation.reducer;
|
|
108
108
|
const doUpdateRecommendationForEntity = (draft, entityId, entityType, payload) => {
|
|
109
109
|
const key = (0, recommendationState_1.getEntityRecommendationKey)(entityType, entityId);
|
|
110
|
-
draft[key] = Object.assign(Object.assign({}, recommendationState_1.
|
|
110
|
+
draft[key] = Object.assign(Object.assign({}, recommendationState_1.initialEntityRecommendationState), { fetchState: 'Completed', recommendations: payload });
|
|
111
111
|
};
|
|
@@ -6,7 +6,7 @@ export declare type EntityRecommendationKey = ReturnType<typeof getEntityRecomme
|
|
|
6
6
|
export interface EntityRecommendationsStatus extends FetchedState {
|
|
7
7
|
recommendations?: Recommendation[];
|
|
8
8
|
}
|
|
9
|
-
export declare const
|
|
9
|
+
export declare const initialEntityRecommendationState: EntityRecommendationsStatus;
|
|
10
10
|
export interface EntityRecommendationState {
|
|
11
11
|
recommendationByEntity: Record<EntityRecommendationKey, EntityRecommendationsStatus>;
|
|
12
12
|
}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
exports.initialEntityRecommendationState = exports.getEntityRecommendationKey = void 0;
|
|
4
4
|
const getEntityRecommendationKey = (entityType, entityIdOrName) => `${entityType}_${entityIdOrName}`;
|
|
5
5
|
exports.getEntityRecommendationKey = getEntityRecommendationKey;
|
|
6
|
-
exports.
|
|
6
|
+
exports.initialEntityRecommendationState = {
|
|
7
7
|
fetchState: 'Not-Started',
|
|
8
8
|
error: undefined,
|
|
9
9
|
hasValidState() {
|
package/lib/view/scheduleView/scheduleAccruedDetailView/LinkBillExpenseView/linkBillExpense.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const toLinkBillExpenseKeysType: (v: string) => "attachment" | "name" | "amount" | "
|
|
1
|
+
declare const toLinkBillExpenseKeysType: (v: string) => "attachment" | "name" | "amount" | "memo" | "transactionType" | "creationDate";
|
|
2
2
|
export declare type LinkBillExpenseKey = ReturnType<typeof toLinkBillExpenseKeysType>;
|
|
3
3
|
export {};
|
|
@@ -7,7 +7,7 @@ export declare const getScheduleListKey: (selectedCategory: ID, selectedTimefram
|
|
|
7
7
|
export declare type ScheduleListKey = ReturnType<typeof getScheduleListKey>;
|
|
8
8
|
export declare const toScheduleSubTabType: (v: string) => "all" | "new" | "completed" | "ongoing";
|
|
9
9
|
export declare type ScheduleSubTabType = ReturnType<typeof toScheduleSubTabType>;
|
|
10
|
-
declare const toScheduleSortKeyType: (v: string) => "status" | "user" | "months" | "amount" | "vendor" | "
|
|
10
|
+
declare const toScheduleSortKeyType: (v: string) => "status" | "user" | "months" | "amount" | "vendor" | "class" | "memo" | "transactionDate" | "transactionType" | "balanceAsOfToday" | "createTime" | "assetId" | "accruedExpenseCategory" | "scheduleCategory" | "expenseCategory" | "accumulatedDepreciationCategory" | "startMonth" | "endMonth";
|
|
11
11
|
export declare type ScheduleListSortKey = ReturnType<typeof toScheduleSortKeyType>;
|
|
12
12
|
export interface DownloadJEScheduleTabOptions {
|
|
13
13
|
timezone: string;
|
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.87",
|
|
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",
|