@zeniai/client-epic-state 5.0.47 → 5.0.48-betaRD1
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/project/projectPayload.d.ts +3 -3
- package/lib/entity/project/projectPayload.js +3 -3
- package/lib/entity/project/projectState.d.ts +4 -2
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +1 -1
- package/lib/entity/transaction/stateTypes/transactionLine.d.ts +2 -2
- package/lib/esm/entity/project/projectPayload.js +1 -1
- package/lib/esm/entity/transaction/payloadTypes/transactionLinePayload.js +2 -2
- package/lib/esm/index.js +2 -1
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +6 -0
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +3 -0
- package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +19 -2
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +13 -4
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +7 -2
- package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +44 -0
- package/lib/index.d.ts +4 -3
- package/lib/index.js +30 -28
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +6 -0
- package/lib/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +3 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +2 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +19 -2
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +3 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +13 -4
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +3 -0
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +6 -1
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +3 -0
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.d.ts +15 -1
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +45 -0
- package/lib/view/transactionDetail/transactionDetailState.d.ts +2 -2
- package/lib/view/transactionDetail/transactionDetailTypes.d.ts +2 -2
- package/package.json +1 -1
|
@@ -4,6 +4,7 @@ import { RootState } from '../../../../reducer';
|
|
|
4
4
|
import { fetchAccountList } from '../../../accountList/accountListReducer';
|
|
5
5
|
import { fetchClassList } from '../../../classList/classListReducer';
|
|
6
6
|
import { fetchOwnerList } from '../../../ownerList/ownerListReducer';
|
|
7
|
+
import { fetchProjectList } from '../../../projectList/projectListReducer';
|
|
7
8
|
import { fetchTransactionCategorization, fetchTransactionCategorizationView } from '../../reducers/transactionsViewReducer';
|
|
8
|
-
export type ActionType = ReturnType<typeof fetchTransactionCategorizationView> | ReturnType<typeof fetchTransactionCategorization> | ReturnType<typeof fetchAccountList> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchOwnerList>;
|
|
9
|
+
export type ActionType = ReturnType<typeof fetchTransactionCategorizationView> | ReturnType<typeof fetchTransactionCategorization> | ReturnType<typeof fetchAccountList> | ReturnType<typeof fetchClassList> | ReturnType<typeof fetchOwnerList> | ReturnType<typeof fetchProjectList>;
|
|
9
10
|
export declare const fetchTransactionCategorizationViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
@@ -7,6 +7,7 @@ const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
|
7
7
|
const accountListReducer_1 = require("../../../accountList/accountListReducer");
|
|
8
8
|
const classListReducer_1 = require("../../../classList/classListReducer");
|
|
9
9
|
const ownerListReducer_1 = require("../../../ownerList/ownerListReducer");
|
|
10
|
+
const projectListReducer_1 = require("../../../projectList/projectListReducer");
|
|
10
11
|
const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
|
|
11
12
|
const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(transactionsViewReducer_1.fetchTransactionCategorizationView.match), (0, operators_1.mergeMap)((action) => {
|
|
12
13
|
const { selectedTab, cacheOverride, keepExistingListItems, pageToken, period, refreshViewInBackground, searchString, resetListItems, isUncategorizedExpenseCategoryEnabled, } = action.payload;
|
|
@@ -29,6 +30,11 @@ const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pi
|
|
|
29
30
|
classList.fetchState === 'Not-Started') {
|
|
30
31
|
updateActions.push((0, classListReducer_1.fetchClassList)());
|
|
31
32
|
}
|
|
33
|
+
const projectList = state$.value.projectListState;
|
|
34
|
+
if (projectList.hasValidState() === false &&
|
|
35
|
+
projectList.fetchState === 'Not-Started') {
|
|
36
|
+
updateActions.push((0, projectListReducer_1.fetchProjectList)());
|
|
37
|
+
}
|
|
32
38
|
const vendorOwnerList = state$.value.ownerListState;
|
|
33
39
|
if (vendorOwnerList.hasValidState() === false &&
|
|
34
40
|
vendorOwnerList.fetchState === 'Not-Started') {
|
|
@@ -117,6 +117,9 @@ const toTransactionUpdatePayload = (updates, detail, transactionId, cotTrackingB
|
|
|
117
117
|
if (lineUpdates.class != null) {
|
|
118
118
|
lineToBeUpdated.class = lineUpdates.class;
|
|
119
119
|
}
|
|
120
|
+
if (lineUpdates.project != null) {
|
|
121
|
+
lineToBeUpdated.project = lineUpdates.project;
|
|
122
|
+
}
|
|
120
123
|
if (lineUpdates.account != null) {
|
|
121
124
|
lineToBeUpdated.account = lineUpdates.account;
|
|
122
125
|
}
|
package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts
CHANGED
|
@@ -2,6 +2,7 @@ import { ID } from '../../../commonStateTypes/common';
|
|
|
2
2
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
3
3
|
import { UncategorizedAccountTypes } from '../../../entity/account/accountState';
|
|
4
4
|
import { ClassBase } from '../../../entity/class/classState';
|
|
5
|
+
import { ProjectBase } from '../../../entity/project/projectState';
|
|
5
6
|
import { Entity } from '../../../entity/genericEntity/entity';
|
|
6
7
|
import { RecommendationWithCOTByLineId } from '../../../entity/transaction/stateTypes/transaction';
|
|
7
8
|
import { SupportedTransactionPayload, SupportedTransactionWithCOT } from '../../../entity/transaction/transactionState';
|
|
@@ -27,7 +28,7 @@ export declare const removeTransactionFromTabView: (tabView: TransactionsTabView
|
|
|
27
28
|
export declare const filterAutoTabLineItems: (tabView: TransactionsTabViewState, transactionId: ID, updatedTransaction: SupportedTransactionWithCOT) => void;
|
|
28
29
|
export declare const MAX_SELECTION_LIMIT = 5;
|
|
29
30
|
export declare const toTransactionDetailLocalData: (transaction: SupportedTransactionWithCOT, selectedTab: TransactionsTab, lineItemsByTransactionIds: string[], uncategorizedIncomeExpense: UncategorizedAccounts, isUncategorizedExpenseCategoryEnabled?: boolean) => TransactionReviewLocalData;
|
|
30
|
-
export declare const toSetAllLineItemsToCategoryClass: (draft: TransactionsTabViewState, transaction: SupportedTransactionWithCOT, transactionId: ID, transactionLineId: ID, transactionDetailLocalData: TransactionReviewLocalData, updatedItem: "category" | "class", uncategorizedAccounts: UncategorizedAccounts, selectedTab: TransactionsTab, vendorId?: ID, customerId?: ID, selectedAccount?: AccountBase, selectedClassBase?: ClassBase, isUncategorizedExpenseCategoryEnabled?: boolean, isAccountingClassesEnabled?: boolean) => {
|
|
31
|
+
export declare const toSetAllLineItemsToCategoryClass: (draft: TransactionsTabViewState, transaction: SupportedTransactionWithCOT, transactionId: ID, transactionLineId: ID, transactionDetailLocalData: TransactionReviewLocalData, updatedItem: "category" | "class" | "project", uncategorizedAccounts: UncategorizedAccounts, selectedTab: TransactionsTab, vendorId?: ID, customerId?: ID, selectedAccount?: AccountBase, selectedClassBase?: ClassBase, selectedProject?: ProjectBase, isUncategorizedExpenseCategoryEnabled?: boolean, isAccountingClassesEnabled?: boolean) => {
|
|
31
32
|
localData: TransactionReviewLocalData;
|
|
32
33
|
similarTransactionUpdated: boolean;
|
|
33
34
|
};
|
|
@@ -190,6 +190,7 @@ const buildLineItemById = (transaction, uncategorizedIncomeExpense, recommendati
|
|
|
190
190
|
const lineId = line.id;
|
|
191
191
|
record.account = accountLine.account;
|
|
192
192
|
record.class = accountLine.class;
|
|
193
|
+
record.project = accountLine.project;
|
|
193
194
|
record.vendor =
|
|
194
195
|
accountLine.vendor != null
|
|
195
196
|
? {
|
|
@@ -312,7 +313,7 @@ const buildLineItemById = (transaction, uncategorizedIncomeExpense, recommendati
|
|
|
312
313
|
});
|
|
313
314
|
return lineItemData;
|
|
314
315
|
};
|
|
315
|
-
const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, transactionLineId, transactionDetailLocalData, updatedItem, uncategorizedAccounts, selectedTab, vendorId, customerId, selectedAccount, selectedClassBase, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) => {
|
|
316
|
+
const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, transactionLineId, transactionDetailLocalData, updatedItem, uncategorizedAccounts, selectedTab, vendorId, customerId, selectedAccount, selectedClassBase, selectedProject, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) => {
|
|
316
317
|
let newLineItems = {};
|
|
317
318
|
let selectedCheckBoxTransactionIds = draft.selectedCheckBoxTransactionIds;
|
|
318
319
|
let similarTransactionUpdated = false;
|
|
@@ -332,7 +333,7 @@ const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, tra
|
|
|
332
333
|
const record = {
|
|
333
334
|
...transactionDetailLocalData.lineItemById[lineId],
|
|
334
335
|
};
|
|
335
|
-
// if the line is the one that is being updated, then set the account and
|
|
336
|
+
// if the line is the one that is being updated, then set the account, class, and project
|
|
336
337
|
if (transactionId === record.transactionId &&
|
|
337
338
|
transactionLineId === lineId) {
|
|
338
339
|
if (selectedAccount != null) {
|
|
@@ -341,6 +342,9 @@ const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, tra
|
|
|
341
342
|
if (selectedClassBase != null) {
|
|
342
343
|
record.class = selectedClassBase;
|
|
343
344
|
}
|
|
345
|
+
if (selectedProject != null) {
|
|
346
|
+
record.project = selectedProject;
|
|
347
|
+
}
|
|
344
348
|
const isClassSatisfied = isAccountingClassesEnabled === false || record.class != null;
|
|
345
349
|
if (isClassSatisfied && record.account != null) {
|
|
346
350
|
if (selectedCheckBoxTransactionIds.length < exports.MAX_SELECTION_LIMIT &&
|
|
@@ -392,6 +396,18 @@ const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, tra
|
|
|
392
396
|
selectedCheckBoxTransactionIds.push(transaction.id);
|
|
393
397
|
}
|
|
394
398
|
}
|
|
399
|
+
if (selectedProject != null &&
|
|
400
|
+
updatedItem === 'project' &&
|
|
401
|
+
record.project?.projectId == null) {
|
|
402
|
+
record.project = selectedProject;
|
|
403
|
+
similarTransactionUpdated = true;
|
|
404
|
+
if (record.account != null &&
|
|
405
|
+
selectedCheckBoxTransactionIds.length < exports.MAX_SELECTION_LIMIT &&
|
|
406
|
+
selectedCheckBoxTransactionIds.includes(transaction.id) ===
|
|
407
|
+
false) {
|
|
408
|
+
selectedCheckBoxTransactionIds.push(transaction.id);
|
|
409
|
+
}
|
|
410
|
+
}
|
|
395
411
|
}
|
|
396
412
|
}
|
|
397
413
|
if (line.type === 'transaction_with_product_or_service_line') {
|
|
@@ -522,6 +538,7 @@ const setEntityRecommendationForLineIdInLocalData = (draft, transaction, transac
|
|
|
522
538
|
...newLineItem,
|
|
523
539
|
class: matchingRecord.class,
|
|
524
540
|
account: matchingRecord.account,
|
|
541
|
+
project: matchingRecord.project,
|
|
525
542
|
lineEntity: matchingRecord.lineEntity,
|
|
526
543
|
};
|
|
527
544
|
}
|
|
@@ -4,6 +4,7 @@ import { MonthYearPeriod, TimePeriod } from '../../../commonStateTypes/timePerio
|
|
|
4
4
|
import { PageToken } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
5
5
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
6
6
|
import { ClassBase } from '../../../entity/class/classState';
|
|
7
|
+
import { ProjectBase } from '../../../entity/project/projectState';
|
|
7
8
|
import { CustomerBase } from '../../../entity/customer/customerState';
|
|
8
9
|
import { Entity } from '../../../entity/genericEntity/entity';
|
|
9
10
|
import { RecommendationWithCOTByLineId, TransactionID } from '../../../entity/transaction/stateTypes/transaction';
|
|
@@ -100,7 +101,7 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
100
101
|
isUncategorizedExpenseCategoryEnabled?: boolean;
|
|
101
102
|
selectedEntity?: Entity;
|
|
102
103
|
updatedCustomer?: CustomerBase;
|
|
103
|
-
}, "expenseAutomationTransactionsView/updateSelectedCustomerForTransaction">, setAllItemsToCategoryClassInLocalDataForCategorization: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionId: string, lineId: string, transactions: SupportedTransactionWithCOT[], uncategorizedAccounts: UncategorizedAccounts, vendorId?: string | undefined, customerId?: string | undefined, selectedAccount?: AccountBase | undefined, selectedClassBase?: ClassBase | undefined, lineEntity?: Entity | undefined, recommendations?: RecommendationWithCOT[] | undefined, isUncategorizedExpenseCategoryEnabled?: boolean | undefined, isAccountingClassesEnabled?: boolean | undefined], {
|
|
104
|
+
}, "expenseAutomationTransactionsView/updateSelectedCustomerForTransaction">, setAllItemsToCategoryClassInLocalDataForCategorization: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionId: string, lineId: string, transactions: SupportedTransactionWithCOT[], uncategorizedAccounts: UncategorizedAccounts, vendorId?: string | undefined, customerId?: string | undefined, selectedAccount?: AccountBase | undefined, selectedClassBase?: ClassBase | undefined, selectedProject?: ProjectBase | undefined, lineEntity?: Entity | undefined, recommendations?: RecommendationWithCOT[] | undefined, isUncategorizedExpenseCategoryEnabled?: boolean | undefined, isAccountingClassesEnabled?: boolean | undefined], {
|
|
104
105
|
selectedTab: "review" | "autoCategorized";
|
|
105
106
|
transactionId: string;
|
|
106
107
|
lineId: string;
|
|
@@ -110,6 +111,7 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
110
111
|
lineEntity: Entity | undefined;
|
|
111
112
|
selectedAccount: AccountBase | undefined;
|
|
112
113
|
selectedClassBase: ClassBase | undefined;
|
|
114
|
+
selectedProject: ProjectBase | undefined;
|
|
113
115
|
recommendations: RecommendationWithCOT[] | undefined;
|
|
114
116
|
uncategorizedAccounts: UncategorizedAccounts;
|
|
115
117
|
isAccountingClassesEnabled: boolean | undefined;
|
|
@@ -289,7 +289,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
289
289
|
},
|
|
290
290
|
setAllItemsToCategoryClassInLocalDataForCategorization: {
|
|
291
291
|
reducer(draft, action) {
|
|
292
|
-
const { vendorId, customerId, selectedAccount, selectedClassBase, transactions, transactionId, lineId, selectedTab, uncategorizedAccounts, isAccountingClassesEnabled, isUncategorizedExpenseCategoryEnabled, } = action.payload;
|
|
292
|
+
const { vendorId, customerId, selectedAccount, selectedClassBase, selectedProject, transactions, transactionId, lineId, selectedTab, uncategorizedAccounts, isAccountingClassesEnabled, isUncategorizedExpenseCategoryEnabled, } = action.payload;
|
|
293
293
|
const transactionLocalData = (0, get_1.default)(draft.transactionCategorizationView[selectedTab]
|
|
294
294
|
.transactionReviewLocalDataById, transactionId, undefined);
|
|
295
295
|
const existingAccount = transactionLocalData?.transactionReviewLocalData.lineItemById[lineId]
|
|
@@ -303,6 +303,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
303
303
|
...transactionLocalData.transactionReviewLocalData.lineItemById[lineId],
|
|
304
304
|
account: selectedAccount,
|
|
305
305
|
class: selectedClassBase,
|
|
306
|
+
project: selectedProject,
|
|
306
307
|
},
|
|
307
308
|
},
|
|
308
309
|
};
|
|
@@ -331,9 +332,16 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
331
332
|
const transactionLocalData = (0, get_1.default)(draft.transactionCategorizationView[selectedTab]
|
|
332
333
|
.transactionReviewLocalDataById, transaction.id, undefined);
|
|
333
334
|
if (transactionLocalData != null) {
|
|
334
|
-
const
|
|
335
|
+
const existingClassId = transactionLocalData.transactionReviewLocalData.lineItemById[lineId]?.class?.classId;
|
|
336
|
+
const existingProjectId = transactionLocalData.transactionReviewLocalData.lineItemById[lineId]?.project?.projectId;
|
|
337
|
+
const updatedItem = existingAccount?.accountId !== selectedAccount?.accountId
|
|
335
338
|
? 'category'
|
|
336
|
-
:
|
|
339
|
+
: existingClassId !== selectedClassBase?.classId
|
|
340
|
+
? 'class'
|
|
341
|
+
: existingProjectId !== selectedProject?.projectId
|
|
342
|
+
? 'project'
|
|
343
|
+
: 'class';
|
|
344
|
+
const { localData, similarTransactionUpdated } = (0, transactionCategorizationLocalDataHelper_1.toSetAllLineItemsToCategoryClass)(draft.transactionCategorizationView[selectedTab], transaction, transactionId, lineId, transactionLocalData.transactionReviewLocalData, updatedItem, uncategorizedAccounts, selectedTab, vendorId, customerId, selectedAccount, selectedClassBase, selectedProject, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled);
|
|
337
345
|
draft.transactionCategorizationView[selectedTab].transactionReviewLocalDataById[transaction.id] = {
|
|
338
346
|
transactionId: transaction.id,
|
|
339
347
|
transactionReviewLocalData: localData,
|
|
@@ -352,7 +360,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
352
360
|
...dirtyIds,
|
|
353
361
|
]);
|
|
354
362
|
},
|
|
355
|
-
prepare(selectedTab, transactionId, lineId, transactions, uncategorizedAccounts, vendorId, customerId, selectedAccount, selectedClassBase, lineEntity, recommendations, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) {
|
|
363
|
+
prepare(selectedTab, transactionId, lineId, transactions, uncategorizedAccounts, vendorId, customerId, selectedAccount, selectedClassBase, selectedProject, lineEntity, recommendations, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) {
|
|
356
364
|
return {
|
|
357
365
|
payload: {
|
|
358
366
|
selectedTab,
|
|
@@ -364,6 +372,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
364
372
|
lineEntity,
|
|
365
373
|
selectedAccount,
|
|
366
374
|
selectedClassBase,
|
|
375
|
+
selectedProject,
|
|
367
376
|
recommendations,
|
|
368
377
|
uncategorizedAccounts,
|
|
369
378
|
isAccountingClassesEnabled,
|
|
@@ -6,6 +6,7 @@ import { AccountBase } from '../../../entity/account/accountState';
|
|
|
6
6
|
import { ClassBase } from '../../../entity/class/classState';
|
|
7
7
|
import { SupportedTransactionWithCOT } from '../../../entity/transaction/transactionState';
|
|
8
8
|
import { UncategorizedAccounts } from '../../accountList/accountListSelector';
|
|
9
|
+
import { ProjectListSelectorView } from '../../projectList/projectListSelector';
|
|
9
10
|
import { TransactionReviewLocalData, TransactionsTab, TransactionsViewUIState } from '../types/transactionsViewState';
|
|
10
11
|
export interface TransactionReviewLocalDataSelectorView {
|
|
11
12
|
transactionId: ID;
|
|
@@ -18,7 +19,9 @@ export interface ExpenseAutomationTransactionViewSelector extends SelectorView {
|
|
|
18
19
|
classList: ClassBase[];
|
|
19
20
|
completionStatus: CompletionStatusType;
|
|
20
21
|
fetchStateByTransactionTabs: Record<TransactionsTab, FetchStateAndError>;
|
|
22
|
+
isAccountingProjectsEnabled: boolean;
|
|
21
23
|
markAsNotMiscategorizedStatus: FetchStateAndError;
|
|
24
|
+
projectList: ProjectListSelectorView;
|
|
22
25
|
refreshStatus: FetchStateAndError;
|
|
23
26
|
saveStatus: FetchStateAndError;
|
|
24
27
|
selectedCheckBoxTransactionIds: ID[];
|
|
@@ -12,9 +12,10 @@ const transactionHelper_1 = require("../../../entity/transaction/transactionHelp
|
|
|
12
12
|
const transactionSelector_1 = require("../../../entity/transaction/transactionSelector");
|
|
13
13
|
const accountListSelector_1 = require("../../accountList/accountListSelector");
|
|
14
14
|
const classListSelector_1 = require("../../classList/classListSelector");
|
|
15
|
+
const projectListSelector_1 = require("../../projectList/projectListSelector");
|
|
15
16
|
const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
|
|
16
17
|
function getExpenseAutomationTransactionView(state) {
|
|
17
|
-
const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
|
|
18
|
+
const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, projectState, projectListState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
|
|
18
19
|
const { selectedTransactionCategorizationTab } = expenseAutomationTransactionsViewState;
|
|
19
20
|
const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
|
|
20
21
|
const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(accountState, accountListState, 'accountList');
|
|
@@ -23,6 +24,8 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
23
24
|
const allClasses = classList.classes.map((classData) => {
|
|
24
25
|
return (0, omit_1.default)(classData, ['accountIds', 'key']);
|
|
25
26
|
});
|
|
27
|
+
const projectList = (0, projectListSelector_1.getProjectList)(projectState, projectListState);
|
|
28
|
+
const isAccountingProjectsEnabled = (0, tenantSelector_1.getIsAccountingProjectsEnabled)(state);
|
|
26
29
|
const accountsHierarchyList = (0, accountListSelector_1.getNestedAccountListHierarchy)(accountListState, 'accountList');
|
|
27
30
|
const classHierarchyList = (0, classListSelector_1.getNestedClassListHierarchy)(classListState);
|
|
28
31
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
@@ -102,6 +105,8 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
102
105
|
classList: allClasses,
|
|
103
106
|
accountsHierarchyList,
|
|
104
107
|
classHierarchyList,
|
|
108
|
+
isAccountingProjectsEnabled,
|
|
109
|
+
projectList,
|
|
105
110
|
transactionLocalData,
|
|
106
111
|
uiState,
|
|
107
112
|
refreshStatus,
|
|
@@ -7,6 +7,7 @@ import { PageToken } from '../../../commonStateTypes/viewAndReport/viewAndReport
|
|
|
7
7
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
8
8
|
import { ClassBase } from '../../../entity/class/classState';
|
|
9
9
|
import { CustomerBase } from '../../../entity/customer/customerState';
|
|
10
|
+
import { ProjectBase } from '../../../entity/project/projectState';
|
|
10
11
|
import { Entity, EntityType } from '../../../entity/genericEntity/entity';
|
|
11
12
|
import { TransactionID } from '../../../entity/transaction/stateTypes/transaction';
|
|
12
13
|
import { BillableStatus, CategorizationStatusType, PlatformLineDetailType, ProductOrService, TransactionLineBase } from '../../../entity/transaction/stateTypes/transactionLine';
|
|
@@ -53,6 +54,7 @@ export interface TransactionCategorizationLineItemData extends TransactionLineBa
|
|
|
53
54
|
lineTransactionType?: TransactionType;
|
|
54
55
|
postingType?: TransactionCategory;
|
|
55
56
|
postingTypeName?: string;
|
|
57
|
+
project?: ProjectBase;
|
|
56
58
|
recommendationsWithCOT?: RecommendationWithCOT[];
|
|
57
59
|
reviewPendingReasons?: string[];
|
|
58
60
|
selectedEntityLine?: Entity;
|
|
@@ -110,6 +112,7 @@ export interface TransactionLineUpdates {
|
|
|
110
112
|
class?: ClassBase;
|
|
111
113
|
customer?: CustomerBase;
|
|
112
114
|
lineDescription?: string;
|
|
115
|
+
project?: ProjectBase;
|
|
113
116
|
recommendation?: Recommendation[];
|
|
114
117
|
vendor?: VendorBase;
|
|
115
118
|
}
|
|
@@ -1,6 +1,20 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { COABalance } from '../../commonStateTypes/coaBalance/coaBalance';
|
|
2
|
+
import { HorizontalAccountRow, ProfitAndLossByClassHorizontalReport } from './profitAndLossClassesByClassHorizontalSelectorTypes';
|
|
2
3
|
/**
|
|
3
4
|
* Populates `sectionHeaderBalancesSlice`, and per-account `accountReportData`, so the
|
|
4
5
|
* web layer only maps selector output to tree nodes.
|
|
5
6
|
*/
|
|
6
7
|
export declare function enrichProfitAndLossByClassHorizontalReport(report: ProfitAndLossByClassHorizontalReport): void;
|
|
8
|
+
/**
|
|
9
|
+
* Sum balances across descendant accounts (recursive).
|
|
10
|
+
*
|
|
11
|
+
* Parent rows in the horizontal pivot only carry their own direct postings
|
|
12
|
+
* (zero for "container" accounts), so callers rendering "Total {parent}" rows
|
|
13
|
+
* must aggregate from descendants to get the real per-class totals.
|
|
14
|
+
*
|
|
15
|
+
* Returns one `COABalance` per class column + total (same shape as the
|
|
16
|
+
* enriched `balancesInTimeframe.balances`), with `amount` summed and `type`
|
|
17
|
+
* set to `default_with_null_balance` for zeros. Returns `[]` when no
|
|
18
|
+
* descendants have enriched data.
|
|
19
|
+
*/
|
|
20
|
+
export declare function aggregateHorizontalDescendantBalances(accounts: readonly HorizontalAccountRow[], childIndices: readonly number[], childrenByParent: Readonly<Record<number, readonly number[]>>): COABalance[];
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.enrichProfitAndLossByClassHorizontalReport = enrichProfitAndLossByClassHorizontalReport;
|
|
4
|
+
exports.aggregateHorizontalDescendantBalances = aggregateHorizontalDescendantBalances;
|
|
4
5
|
const currencyHelper_1 = require("../../commonStateTypes/currencyHelper");
|
|
5
6
|
const horizontalSectionEmptyBalancesSlice_1 = require("./horizontalSectionEmptyBalancesSlice");
|
|
6
7
|
const profitAndLossClassesByClassHorizontalSelectorTypes_1 = require("./profitAndLossClassesByClassHorizontalSelectorTypes");
|
|
@@ -118,6 +119,50 @@ function buildHorizontalClassColumnBalancesSlice(report, classAmounts, totalAmou
|
|
|
118
119
|
},
|
|
119
120
|
};
|
|
120
121
|
}
|
|
122
|
+
/**
|
|
123
|
+
* Sum balances across descendant accounts (recursive).
|
|
124
|
+
*
|
|
125
|
+
* Parent rows in the horizontal pivot only carry their own direct postings
|
|
126
|
+
* (zero for "container" accounts), so callers rendering "Total {parent}" rows
|
|
127
|
+
* must aggregate from descendants to get the real per-class totals.
|
|
128
|
+
*
|
|
129
|
+
* Returns one `COABalance` per class column + total (same shape as the
|
|
130
|
+
* enriched `balancesInTimeframe.balances`), with `amount` summed and `type`
|
|
131
|
+
* set to `default_with_null_balance` for zeros. Returns `[]` when no
|
|
132
|
+
* descendants have enriched data.
|
|
133
|
+
*/
|
|
134
|
+
function aggregateHorizontalDescendantBalances(accounts, childIndices, childrenByParent) {
|
|
135
|
+
let template;
|
|
136
|
+
const sums = new Map();
|
|
137
|
+
const walk = (idx) => {
|
|
138
|
+
const childRow = accounts[idx];
|
|
139
|
+
const childBalances = childRow?.accountReportData?.balancesInTimeframe.balances;
|
|
140
|
+
if (childBalances != null) {
|
|
141
|
+
if (template == null) {
|
|
142
|
+
template = childBalances;
|
|
143
|
+
}
|
|
144
|
+
childBalances.forEach((b, i) => {
|
|
145
|
+
sums.set(i, (sums.get(i) ?? 0) + (b.balance.amount ?? 0));
|
|
146
|
+
});
|
|
147
|
+
}
|
|
148
|
+
// Always recurse — a missing intermediate node should not prune its
|
|
149
|
+
// descendants from the aggregate.
|
|
150
|
+
const grandChildren = childrenByParent[idx] ?? [];
|
|
151
|
+
grandChildren.forEach(walk);
|
|
152
|
+
};
|
|
153
|
+
childIndices.forEach(walk);
|
|
154
|
+
if (template == null) {
|
|
155
|
+
return [];
|
|
156
|
+
}
|
|
157
|
+
return template.map((tpl, i) => {
|
|
158
|
+
const amount = sums.get(i) ?? 0;
|
|
159
|
+
return {
|
|
160
|
+
...tpl,
|
|
161
|
+
balance: { ...tpl.balance, amount },
|
|
162
|
+
type: amount === 0 ? 'default_with_null_balance' : 'default',
|
|
163
|
+
};
|
|
164
|
+
});
|
|
165
|
+
}
|
|
121
166
|
/**
|
|
122
167
|
* Parent index per DFS row — O(n). Matches the scan in the former
|
|
123
168
|
* `findHorizontalAccountParentIndex` (depth <= 2 rows have no parent).
|
|
@@ -4,7 +4,7 @@ import { AccountBase } from '../../entity/account/accountState';
|
|
|
4
4
|
import { ClassBase } from '../../entity/class/classState';
|
|
5
5
|
import { CustomerBase } from '../../entity/customer/customerState';
|
|
6
6
|
import { EntityType } from '../../entity/genericEntity/entity';
|
|
7
|
-
import {
|
|
7
|
+
import { ProjectBase } from '../../entity/project/projectState';
|
|
8
8
|
import { Transaction, TransactionID } from '../../entity/transaction/stateTypes/transaction';
|
|
9
9
|
import { VendorBase } from '../../entity/vendor/vendorState';
|
|
10
10
|
import { EntityRecommendationKey } from '../recommendation/recommendationState';
|
|
@@ -53,7 +53,7 @@ export interface TransactionLineUpdates {
|
|
|
53
53
|
class?: ClassBase;
|
|
54
54
|
customer?: CustomerBase;
|
|
55
55
|
lineDescription?: string;
|
|
56
|
-
project?:
|
|
56
|
+
project?: ProjectBase;
|
|
57
57
|
recommendation?: Recommendation[];
|
|
58
58
|
vendor?: VendorBase;
|
|
59
59
|
}
|
|
@@ -4,7 +4,7 @@ import { AccountBase, RecommendedAccountBase } from '../../entity/account/accoun
|
|
|
4
4
|
import { ClassBase, RecommendedClassBase } from '../../entity/class/classState';
|
|
5
5
|
import { CustomerBase } from '../../entity/customer/customerState';
|
|
6
6
|
import { Entity } from '../../entity/genericEntity/entity';
|
|
7
|
-
import {
|
|
7
|
+
import { ProjectBase } from '../../entity/project/projectState';
|
|
8
8
|
import { TransactionID } from '../../entity/transaction/stateTypes/transaction';
|
|
9
9
|
import { BillableStatus, PlatformLineDetailType, ProductOrService, TransactionLineBase } from '../../entity/transaction/stateTypes/transactionLine';
|
|
10
10
|
import { TransactionCategory, TransactionType } from '../../entity/transaction/stateTypes/transactionType';
|
|
@@ -30,7 +30,7 @@ export interface TransactionDetailLineItemData extends TransactionLineBase {
|
|
|
30
30
|
linkedTransactions?: TransactionID[];
|
|
31
31
|
postingType?: TransactionCategory;
|
|
32
32
|
postingTypeName?: string;
|
|
33
|
-
project?:
|
|
33
|
+
project?: ProjectBase;
|
|
34
34
|
recommendationsWithCOT?: RecommendationWithCOT[];
|
|
35
35
|
recommendedAccount?: RecommendedAccountBase;
|
|
36
36
|
recommendedClass?: RecommendedClassBase;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.
|
|
3
|
+
"version": "5.0.48-betaRD1",
|
|
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",
|