@zeniai/client-epic-state 5.0.49 → 5.0.50-betaAS1
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/payloadTypes/transactionPayload.d.ts +2 -0
- package/lib/entity/transaction/payloadTypes/transactionPayload.js +6 -0
- package/lib/entity/transaction/stateTypes/transaction.d.ts +2 -0
- 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/entity/transaction/payloadTypes/transactionPayload.js +6 -0
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +8 -0
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +3 -0
- package/lib/esm/view/expenseAutomationView/helpers/saveTransactionHelper.js +1 -0
- package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +11 -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/spendManagement/zeniAccounts/depositAccountDetail/depositAccountDetailSelector.js +1 -1
- package/lib/index.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +8 -0
- package/lib/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +3 -0
- package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +1 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +2 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +11 -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/spendManagement/zeniAccounts/depositAccountDetail/depositAccountDetailSelector.js +1 -1
- package/lib/view/transactionDetail/transactionDetailState.d.ts +2 -2
- package/lib/view/transactionDetail/transactionDetailTypes.d.ts +2 -2
- package/package.json +1 -1
- package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Project } from './projectState';
|
|
1
|
+
import { Project, ProjectBase } from './projectState';
|
|
2
2
|
export interface ProjectMetadataPayload {
|
|
3
3
|
accounting_provider_project_customer_id: string | null;
|
|
4
4
|
accounting_provider_project_id: string | null;
|
|
@@ -15,6 +15,6 @@ export interface ProjectBasePayload {
|
|
|
15
15
|
accounting_provider_project_id?: string | null;
|
|
16
16
|
project_name?: string;
|
|
17
17
|
}
|
|
18
|
-
export declare const toProjectBasePayload: (project:
|
|
19
|
-
export declare const
|
|
18
|
+
export declare const toProjectBasePayload: (project: ProjectBase | undefined) => ProjectBasePayload;
|
|
19
|
+
export declare const mapProjectBasePayloadToProjectBase: (payload: ProjectBasePayload) => ProjectBase;
|
|
20
20
|
export declare const mapProjectMetadataPayloadToProject: (payload: ProjectMetadataPayload) => Project;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.mapProjectMetadataPayloadToProject = exports.
|
|
3
|
+
exports.mapProjectMetadataPayloadToProject = exports.mapProjectBasePayloadToProjectBase = exports.toProjectBasePayload = void 0;
|
|
4
4
|
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
5
5
|
const toProjectBasePayload = (project) => ({
|
|
6
6
|
zeni_project_id: project?.projectId ?? '',
|
|
@@ -8,14 +8,14 @@ const toProjectBasePayload = (project) => ({
|
|
|
8
8
|
project_name: project?.projectName ?? '',
|
|
9
9
|
});
|
|
10
10
|
exports.toProjectBasePayload = toProjectBasePayload;
|
|
11
|
-
const
|
|
11
|
+
const mapProjectBasePayloadToProjectBase = (payload) => ({
|
|
12
12
|
projectId: payload.zeni_project_id,
|
|
13
13
|
projectName: payload.project_name ?? '',
|
|
14
14
|
...(payload.accounting_provider_project_id != null
|
|
15
15
|
? { accountingProviderProjectId: payload.accounting_provider_project_id }
|
|
16
16
|
: {}),
|
|
17
17
|
});
|
|
18
|
-
exports.
|
|
18
|
+
exports.mapProjectBasePayloadToProjectBase = mapProjectBasePayloadToProjectBase;
|
|
19
19
|
const mapProjectMetadataPayloadToProject = (payload) => ({
|
|
20
20
|
projectId: payload.zeni_project_id,
|
|
21
21
|
projectName: payload.project_name,
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
import { ID } from '../../commonStateTypes/common';
|
|
2
2
|
import { ZeniDate } from '../../zeniDayJS';
|
|
3
|
-
export interface
|
|
3
|
+
export interface ProjectBase {
|
|
4
4
|
projectId: ID;
|
|
5
5
|
projectName: string;
|
|
6
|
-
accountingProviderProjectCustomerId?: ID;
|
|
7
6
|
accountingProviderProjectId?: ID;
|
|
7
|
+
}
|
|
8
|
+
export interface Project extends ProjectBase {
|
|
9
|
+
accountingProviderProjectCustomerId?: ID;
|
|
8
10
|
parentCustomerAccountingProviderId?: ID;
|
|
9
11
|
startDate?: ZeniDate;
|
|
10
12
|
status?: string;
|
|
@@ -47,7 +47,7 @@ const toTransactionWithAccountAndClassLine = (payload, currency, type = 'transac
|
|
|
47
47
|
project: payload.line_detail.project != null &&
|
|
48
48
|
payload.line_detail.project.zeni_project_id != null &&
|
|
49
49
|
payload.line_detail.project.zeni_project_id !== ''
|
|
50
|
-
? (0, projectPayload_1.
|
|
50
|
+
? (0, projectPayload_1.mapProjectBasePayloadToProjectBase)(payload.line_detail.project)
|
|
51
51
|
: undefined,
|
|
52
52
|
billable: payload.line_detail.billable_status ?? 'not_billable',
|
|
53
53
|
isCategoryMiscategorized: payload.is_category_miscategorized ?? false,
|
|
@@ -33,6 +33,7 @@ export interface TransactionPayload extends TransactionIDPayload, AccountBasePay
|
|
|
33
33
|
logo?: URLPayload;
|
|
34
34
|
payment_type?: string;
|
|
35
35
|
payment_type_name?: string;
|
|
36
|
+
project_name?: string | null;
|
|
36
37
|
recipient_currency_code?: string;
|
|
37
38
|
recipient_currency_symbol?: string;
|
|
38
39
|
recipient_total_amount?: number;
|
|
@@ -49,6 +50,7 @@ export interface TransactionPayload extends TransactionIDPayload, AccountBasePay
|
|
|
49
50
|
transaction_update_time?: string;
|
|
50
51
|
vendor_id?: string | null;
|
|
51
52
|
vendor_name?: string | null;
|
|
53
|
+
zeni_project_id?: string | null;
|
|
52
54
|
}
|
|
53
55
|
type LinesWithCOTTracking = LinePayload & {
|
|
54
56
|
cot_viewing_flags?: {
|
|
@@ -101,6 +101,12 @@ const toTransaction = (payload) => {
|
|
|
101
101
|
...(payload.class_name != null && payload.class_name !== ''
|
|
102
102
|
? { className: payload.class_name }
|
|
103
103
|
: {}),
|
|
104
|
+
...(payload.zeni_project_id != null && payload.zeni_project_id !== ''
|
|
105
|
+
? { projectId: payload.zeni_project_id }
|
|
106
|
+
: {}),
|
|
107
|
+
...(payload.project_name != null && payload.project_name !== ''
|
|
108
|
+
? { projectName: payload.project_name }
|
|
109
|
+
: {}),
|
|
104
110
|
...(payload.category_name != null && payload.category_name !== ''
|
|
105
111
|
? { categoryName: payload.category_name }
|
|
106
112
|
: {}),
|
|
@@ -4,7 +4,7 @@ import { COTLineItemTracking } from '../../../commonStateTypes/recommendationBas
|
|
|
4
4
|
import { AccountBase } from '../../account/accountState';
|
|
5
5
|
import { ClassBase } from '../../class/classState';
|
|
6
6
|
import { CustomerBase } from '../../customer/customerState';
|
|
7
|
-
import {
|
|
7
|
+
import { ProjectBase } from '../../project/projectState';
|
|
8
8
|
import { VendorBase } from '../../vendor/vendorState';
|
|
9
9
|
import { TransactionID } from './transaction';
|
|
10
10
|
import { TransactionCategory, TransactionType } from './transactionType';
|
|
@@ -40,7 +40,7 @@ export interface TransactionWithAccountAndClassLine extends TransactionLineBase
|
|
|
40
40
|
isClassMiscategorized: boolean;
|
|
41
41
|
class?: ClassBase;
|
|
42
42
|
customer?: CustomerBase;
|
|
43
|
-
project?:
|
|
43
|
+
project?: ProjectBase;
|
|
44
44
|
vendor?: VendorBase;
|
|
45
45
|
}
|
|
46
46
|
export interface TransactionWithAccountAndClassLineWithCOTTracking extends TransactionWithAccountAndClassLine {
|
|
@@ -4,7 +4,7 @@ export const toProjectBasePayload = (project) => ({
|
|
|
4
4
|
accounting_provider_project_id: project?.accountingProviderProjectId ?? null,
|
|
5
5
|
project_name: project?.projectName ?? '',
|
|
6
6
|
});
|
|
7
|
-
export const
|
|
7
|
+
export const mapProjectBasePayloadToProjectBase = (payload) => ({
|
|
8
8
|
projectId: payload.zeni_project_id,
|
|
9
9
|
projectName: payload.project_name ?? '',
|
|
10
10
|
...(payload.accounting_provider_project_id != null
|
|
@@ -2,7 +2,7 @@ import { toAmountWC } from '../../../commonStateTypes/amount';
|
|
|
2
2
|
import { mapAccountBasePayloadToAccountBase, toAccountPayload, } from '../../account/accountPayload';
|
|
3
3
|
import { mapClassBasePayloadToClassBase, toClassBasePayload, } from '../../class/classPayload';
|
|
4
4
|
import { toCustomerBase, toCustomerBasePayload, } from '../../customer/customerPayload';
|
|
5
|
-
import {
|
|
5
|
+
import { mapProjectBasePayloadToProjectBase, toProjectBasePayload, } from '../../project/projectPayload';
|
|
6
6
|
import { mapVendorBasePayloadToVendorBase, toVendorBasePayload, } from '../../vendor/vendorPayload';
|
|
7
7
|
import { toCategorizationStatusType, toPlatformLineDetailType, } from '../stateTypes/transactionLine';
|
|
8
8
|
import { toTransactionCategory, toTransactionType, } from '../stateTypes/transactionType';
|
|
@@ -43,7 +43,7 @@ export const toTransactionWithAccountAndClassLine = (payload, currency, type = '
|
|
|
43
43
|
project: payload.line_detail.project != null &&
|
|
44
44
|
payload.line_detail.project.zeni_project_id != null &&
|
|
45
45
|
payload.line_detail.project.zeni_project_id !== ''
|
|
46
|
-
?
|
|
46
|
+
? mapProjectBasePayloadToProjectBase(payload.line_detail.project)
|
|
47
47
|
: undefined,
|
|
48
48
|
billable: payload.line_detail.billable_status ?? 'not_billable',
|
|
49
49
|
isCategoryMiscategorized: payload.is_category_miscategorized ?? false,
|
|
@@ -97,6 +97,12 @@ export const toTransaction = (payload) => {
|
|
|
97
97
|
...(payload.class_name != null && payload.class_name !== ''
|
|
98
98
|
? { className: payload.class_name }
|
|
99
99
|
: {}),
|
|
100
|
+
...(payload.zeni_project_id != null && payload.zeni_project_id !== ''
|
|
101
|
+
? { projectId: payload.zeni_project_id }
|
|
102
|
+
: {}),
|
|
103
|
+
...(payload.project_name != null && payload.project_name !== ''
|
|
104
|
+
? { projectName: payload.project_name }
|
|
105
|
+
: {}),
|
|
100
106
|
...(payload.category_name != null && payload.category_name !== ''
|
|
101
107
|
? { categoryName: payload.category_name }
|
|
102
108
|
: {}),
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { from } from 'rxjs';
|
|
2
2
|
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { toMonthYearPeriodId, } from '../../../../commonStateTypes/timePeriod';
|
|
4
|
+
import { getIsAccountingProjectsEnabled } from '../../../../entity/tenant/tenantSelector';
|
|
4
5
|
import { fetchAccountList } from '../../../accountList/accountListReducer';
|
|
5
6
|
import { fetchClassList } from '../../../classList/classListReducer';
|
|
6
7
|
import { fetchOwnerList } from '../../../ownerList/ownerListReducer';
|
|
8
|
+
import { fetchProjectList } from '../../../projectList/projectListReducer';
|
|
7
9
|
import { fetchTransactionCategorization, fetchTransactionCategorizationView, } from '../../reducers/transactionsViewReducer';
|
|
8
10
|
export const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pipe(filter(fetchTransactionCategorizationView.match), mergeMap((action) => {
|
|
9
11
|
const { selectedTab, cacheOverride, keepExistingListItems, pageToken, period, refreshViewInBackground, searchString, resetListItems, isUncategorizedExpenseCategoryEnabled, } = action.payload;
|
|
@@ -26,6 +28,12 @@ export const fetchTransactionCategorizationViewEpic = (actions$, state$) => acti
|
|
|
26
28
|
classList.fetchState === 'Not-Started') {
|
|
27
29
|
updateActions.push(fetchClassList());
|
|
28
30
|
}
|
|
31
|
+
const projectList = state$.value.projectListState;
|
|
32
|
+
if (getIsAccountingProjectsEnabled(state$.value) &&
|
|
33
|
+
projectList.hasValidState() === false &&
|
|
34
|
+
projectList.fetchState === 'Not-Started') {
|
|
35
|
+
updateActions.push(fetchProjectList());
|
|
36
|
+
}
|
|
29
37
|
const vendorOwnerList = state$.value.ownerListState;
|
|
30
38
|
if (vendorOwnerList.hasValidState() === false &&
|
|
31
39
|
vendorOwnerList.fetchState === 'Not-Started') {
|
|
@@ -110,6 +110,9 @@ const toTransactionUpdatePayload = (updates, detail, transactionId, cotTrackingB
|
|
|
110
110
|
if (lineUpdates.class != null) {
|
|
111
111
|
lineToBeUpdated.class = lineUpdates.class;
|
|
112
112
|
}
|
|
113
|
+
if (lineUpdates.project != null) {
|
|
114
|
+
lineToBeUpdated.project = lineUpdates.project;
|
|
115
|
+
}
|
|
113
116
|
if (lineUpdates.account != null) {
|
|
114
117
|
lineToBeUpdated.account = lineUpdates.account;
|
|
115
118
|
}
|
|
@@ -41,6 +41,7 @@ export const toTransactionUpdatesFromTransactionCategorizationLocalData = (trans
|
|
|
41
41
|
lineDescription: lineItem.lineDescription,
|
|
42
42
|
class: lineItem.class,
|
|
43
43
|
account: lineItem.account,
|
|
44
|
+
project: lineItem.project,
|
|
44
45
|
recommendation: convertCOTRecommendationsToRegular(lineItem.recommendationsWithCOT),
|
|
45
46
|
};
|
|
46
47
|
if (line.type === 'journal_entry_transaction_line' ||
|
package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js
CHANGED
|
@@ -183,6 +183,7 @@ const buildLineItemById = (transaction, uncategorizedIncomeExpense, recommendati
|
|
|
183
183
|
const lineId = line.id;
|
|
184
184
|
record.account = accountLine.account;
|
|
185
185
|
record.class = accountLine.class;
|
|
186
|
+
record.project = accountLine.project;
|
|
186
187
|
record.vendor =
|
|
187
188
|
accountLine.vendor != null
|
|
188
189
|
? {
|
|
@@ -305,7 +306,7 @@ const buildLineItemById = (transaction, uncategorizedIncomeExpense, recommendati
|
|
|
305
306
|
});
|
|
306
307
|
return lineItemData;
|
|
307
308
|
};
|
|
308
|
-
export const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, transactionLineId, transactionDetailLocalData, updatedItem, uncategorizedAccounts, selectedTab, vendorId, customerId, selectedAccount, selectedClassBase, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) => {
|
|
309
|
+
export const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, transactionLineId, transactionDetailLocalData, updatedItem, uncategorizedAccounts, selectedTab, vendorId, customerId, selectedAccount, selectedClassBase, selectedProjectBase, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) => {
|
|
309
310
|
let newLineItems = {};
|
|
310
311
|
let selectedCheckBoxTransactionIds = draft.selectedCheckBoxTransactionIds;
|
|
311
312
|
let similarTransactionUpdated = false;
|
|
@@ -325,7 +326,7 @@ export const toSetAllLineItemsToCategoryClass = (draft, transaction, transaction
|
|
|
325
326
|
const record = {
|
|
326
327
|
...transactionDetailLocalData.lineItemById[lineId],
|
|
327
328
|
};
|
|
328
|
-
// if the line is the one that is being updated, then set the account and
|
|
329
|
+
// if the line is the one that is being updated, then set the account, class, and project
|
|
329
330
|
if (transactionId === record.transactionId &&
|
|
330
331
|
transactionLineId === lineId) {
|
|
331
332
|
if (selectedAccount != null) {
|
|
@@ -334,6 +335,9 @@ export const toSetAllLineItemsToCategoryClass = (draft, transaction, transaction
|
|
|
334
335
|
if (selectedClassBase != null) {
|
|
335
336
|
record.class = selectedClassBase;
|
|
336
337
|
}
|
|
338
|
+
if (selectedProjectBase != null) {
|
|
339
|
+
record.project = selectedProjectBase;
|
|
340
|
+
}
|
|
337
341
|
const isClassSatisfied = isAccountingClassesEnabled === false || record.class != null;
|
|
338
342
|
if (isClassSatisfied && record.account != null) {
|
|
339
343
|
if (selectedCheckBoxTransactionIds.length < MAX_SELECTION_LIMIT &&
|
|
@@ -385,6 +389,10 @@ export const toSetAllLineItemsToCategoryClass = (draft, transaction, transaction
|
|
|
385
389
|
selectedCheckBoxTransactionIds.push(transaction.id);
|
|
386
390
|
}
|
|
387
391
|
}
|
|
392
|
+
// Project intentionally does NOT propagate to other rows of
|
|
393
|
+
// the same vendor: each line can carry a different project,
|
|
394
|
+
// and auto-filling siblings (the way class does) leads to
|
|
395
|
+
// unexpected bulk selection.
|
|
388
396
|
}
|
|
389
397
|
}
|
|
390
398
|
if (line.type === 'transaction_with_product_or_service_line') {
|
|
@@ -514,6 +522,7 @@ export const setEntityRecommendationForLineIdInLocalData = (draft, transaction,
|
|
|
514
522
|
...newLineItem,
|
|
515
523
|
class: matchingRecord.class,
|
|
516
524
|
account: matchingRecord.account,
|
|
525
|
+
project: matchingRecord.project,
|
|
517
526
|
lineEntity: matchingRecord.lineEntity,
|
|
518
527
|
};
|
|
519
528
|
}
|
|
@@ -282,7 +282,7 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
282
282
|
},
|
|
283
283
|
setAllItemsToCategoryClassInLocalDataForCategorization: {
|
|
284
284
|
reducer(draft, action) {
|
|
285
|
-
const { vendorId, customerId, selectedAccount, selectedClassBase, transactions, transactionId, lineId, selectedTab, uncategorizedAccounts, isAccountingClassesEnabled, isUncategorizedExpenseCategoryEnabled, } = action.payload;
|
|
285
|
+
const { vendorId, customerId, selectedAccount, selectedClassBase, selectedProjectBase, transactions, transactionId, lineId, selectedTab, uncategorizedAccounts, isAccountingClassesEnabled, isUncategorizedExpenseCategoryEnabled, } = action.payload;
|
|
286
286
|
const transactionLocalData = recordGet(draft.transactionCategorizationView[selectedTab]
|
|
287
287
|
.transactionReviewLocalDataById, transactionId, undefined);
|
|
288
288
|
const existingAccount = transactionLocalData?.transactionReviewLocalData.lineItemById[lineId]
|
|
@@ -296,6 +296,7 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
296
296
|
...transactionLocalData.transactionReviewLocalData.lineItemById[lineId],
|
|
297
297
|
account: selectedAccount,
|
|
298
298
|
class: selectedClassBase,
|
|
299
|
+
project: selectedProjectBase,
|
|
299
300
|
},
|
|
300
301
|
},
|
|
301
302
|
};
|
|
@@ -324,9 +325,16 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
324
325
|
const transactionLocalData = recordGet(draft.transactionCategorizationView[selectedTab]
|
|
325
326
|
.transactionReviewLocalDataById, transaction.id, undefined);
|
|
326
327
|
if (transactionLocalData != null) {
|
|
327
|
-
const
|
|
328
|
+
const existingClassId = transactionLocalData.transactionReviewLocalData.lineItemById[lineId]?.class?.classId;
|
|
329
|
+
const existingProjectId = transactionLocalData.transactionReviewLocalData.lineItemById[lineId]?.project?.projectId;
|
|
330
|
+
const updatedItem = existingAccount?.accountId !== selectedAccount?.accountId
|
|
328
331
|
? 'category'
|
|
329
|
-
:
|
|
332
|
+
: existingClassId !== selectedClassBase?.classId
|
|
333
|
+
? 'class'
|
|
334
|
+
: existingProjectId !== selectedProjectBase?.projectId
|
|
335
|
+
? 'project'
|
|
336
|
+
: 'class';
|
|
337
|
+
const { localData, similarTransactionUpdated } = toSetAllLineItemsToCategoryClass(draft.transactionCategorizationView[selectedTab], transaction, transactionId, lineId, transactionLocalData.transactionReviewLocalData, updatedItem, uncategorizedAccounts, selectedTab, vendorId, customerId, selectedAccount, selectedClassBase, selectedProjectBase, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled);
|
|
330
338
|
draft.transactionCategorizationView[selectedTab].transactionReviewLocalDataById[transaction.id] = {
|
|
331
339
|
transactionId: transaction.id,
|
|
332
340
|
transactionReviewLocalData: localData,
|
|
@@ -345,7 +353,7 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
345
353
|
...dirtyIds,
|
|
346
354
|
]);
|
|
347
355
|
},
|
|
348
|
-
prepare(selectedTab, transactionId, lineId, transactions, uncategorizedAccounts, vendorId, customerId, selectedAccount, selectedClassBase, lineEntity, recommendations, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) {
|
|
356
|
+
prepare(selectedTab, transactionId, lineId, transactions, uncategorizedAccounts, vendorId, customerId, selectedAccount, selectedClassBase, lineEntity, recommendations, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled, selectedProjectBase) {
|
|
349
357
|
return {
|
|
350
358
|
payload: {
|
|
351
359
|
selectedTab,
|
|
@@ -357,6 +365,7 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
357
365
|
lineEntity,
|
|
358
366
|
selectedAccount,
|
|
359
367
|
selectedClassBase,
|
|
368
|
+
selectedProjectBase,
|
|
360
369
|
recommendations,
|
|
361
370
|
uncategorizedAccounts,
|
|
362
371
|
isAccountingClassesEnabled,
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import omit from 'lodash/omit';
|
|
2
2
|
import { reduceAllFetchState, reduceAnyFetchState, } from '../../../commonStateTypes/reduceFetchState';
|
|
3
3
|
import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
4
|
-
import { getIsAccountingClassesEnabled,
|
|
4
|
+
import { getCurrentTenant, getIsAccountingClassesEnabled, getIsAccountingProjectsEnabled, } from '../../../entity/tenant/tenantSelector';
|
|
5
5
|
import { getTransactionWithCOT } from '../../../entity/transaction/transactionHelper';
|
|
6
6
|
import { getSupportedTransactionsByIds } from '../../../entity/transaction/transactionSelector';
|
|
7
7
|
import { getAccountList, getNestedAccountListHierarchy, getUncategorizedAccounts, } from '../../accountList/accountListSelector';
|
|
8
8
|
import { getClassList, getNestedClassListHierarchy, } from '../../classList/classListSelector';
|
|
9
|
+
import { getProjectList } from '../../projectList/projectListSelector';
|
|
9
10
|
import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes';
|
|
10
11
|
export function getExpenseAutomationTransactionView(state) {
|
|
11
|
-
const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
|
|
12
|
+
const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, projectState, projectListState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
|
|
12
13
|
const { selectedTransactionCategorizationTab } = expenseAutomationTransactionsViewState;
|
|
13
14
|
const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
|
|
14
15
|
const uncategorizedIncomeExpense = getUncategorizedAccounts(accountState, accountListState, 'accountList');
|
|
@@ -17,6 +18,8 @@ export function getExpenseAutomationTransactionView(state) {
|
|
|
17
18
|
const allClasses = classList.classes.map((classData) => {
|
|
18
19
|
return omit(classData, ['accountIds', 'key']);
|
|
19
20
|
});
|
|
21
|
+
const projectList = getProjectList(projectState, projectListState);
|
|
22
|
+
const isAccountingProjectsEnabled = getIsAccountingProjectsEnabled(state);
|
|
20
23
|
const accountsHierarchyList = getNestedAccountListHierarchy(accountListState, 'accountList');
|
|
21
24
|
const classHierarchyList = getNestedClassListHierarchy(classListState);
|
|
22
25
|
const currentTenant = getCurrentTenant(state);
|
|
@@ -96,6 +99,8 @@ export function getExpenseAutomationTransactionView(state) {
|
|
|
96
99
|
classList: allClasses,
|
|
97
100
|
accountsHierarchyList,
|
|
98
101
|
classHierarchyList,
|
|
102
|
+
isAccountingProjectsEnabled,
|
|
103
|
+
projectList,
|
|
99
104
|
transactionLocalData,
|
|
100
105
|
uiState,
|
|
101
106
|
refreshStatus,
|
|
@@ -30,7 +30,7 @@ export const getDepositAccountDetail = (state, depositAccountId) => {
|
|
|
30
30
|
const zeniAccountDetail = zeniAccountDetailState.depositAccountDetailById[depositAccountId];
|
|
31
31
|
const depositAccount = getDepositAccountByDepositAccountId(depositAccountState, depositAccountId);
|
|
32
32
|
const zeniAccountsConfig = getZeniAccountsConfigDetail(state);
|
|
33
|
-
const transactionListView = getDepositAccountTransactionList(state, depositAccountId
|
|
33
|
+
const transactionListView = getDepositAccountTransactionList(state, depositAccountId);
|
|
34
34
|
let accountUpdateStatus = {
|
|
35
35
|
editName: {
|
|
36
36
|
fetchState: 'Not-Started',
|
package/lib/index.d.ts
CHANGED
|
@@ -103,7 +103,7 @@ import { ExternalNotificationData, NotificationActivityType, NotificationGroup,
|
|
|
103
103
|
import { Logo, PaymentAccount, VERIFIED_PAYMENT_ACCOUNT_PROVIDER_VERIFICATION_STATUS } from './entity/paymentAccount/paymentAccountState';
|
|
104
104
|
import { PaymentInstrument } from './entity/paymentInstrument/paymentInstrument';
|
|
105
105
|
import { AccountingSummary, Runway } from './entity/portfolio/accountingSummary/accountingSummaryState';
|
|
106
|
-
import { Project } from './entity/project/projectState';
|
|
106
|
+
import { Project, ProjectBase } from './entity/project/projectState';
|
|
107
107
|
import { MilageReimbursementLine, OutofPocketReimbursementLine, Reimbursement, ReimbursementLine, ReimbursementTypeCode } from './entity/reimbursement/reimbursementState';
|
|
108
108
|
import { SectionAccountsViewReport } from './entity/sectionAccountsView/sectionAccountsViewSelector';
|
|
109
109
|
import { SectionClassesView as SectionClassesViewV2 } from './entity/sectionClassesViewV2/sectionClassesView';
|
|
@@ -698,7 +698,7 @@ export { updateDashboardLayout };
|
|
|
698
698
|
export { PandLWithForecastView, getPandLWithForecast, } from './view/profitAndLoss/pAndLWithForecast/pAndLWithForecastSelector';
|
|
699
699
|
export { fetchProfitAndLoss, resetProfitAndLossNodeCollapseState, updateProfitAndLossUIState, ProfitAndLossState, ProfitAndLossUIState, getProfitAndLossReport, ProfitAndLossReport, getPandLReportFetchState, fetchProfitAndLossForTimeframe, };
|
|
700
700
|
export { fetchProfitAndLossClassesView, updateProfitAndLossClassesToFilterOut, resetProfitAndLossClassesNodeCollapseState, updateProfitAndLossClassesViewUIState, updateProfitAndLossAccountViewMode, updateClassViewLayout, ProfitAndLossClassesViewUIState, ProfitAndLossClassesViewReport, getProfitAndLossClassesView, aggregateHorizontalDescendantBalances, getEmptyHorizontalSectionBalancesSlice, getProfitAndLossClassesHorizontalView, PandLReportViewSectionID, PandLReportViewCalculatedSectionID, isPandLReportViewCalculatedSectionID, isPandLReportViewSectionID, ClassViewLayout, ProfitAndLossByClassHorizontalReport, ClassColumnDefinition, HORIZONTAL_CLASS_TOTAL_BALANCE_ID, HorizontalAccountReportData, HorizontalAccountRow, HorizontalClassBalance, HorizontalSectionReport, HorizontalSectionTreeLayout, HorizontalCalculatedSection, isHorizontalAccountReportData, };
|
|
701
|
-
export { clearProfitAndLossProjectView, fetchProfitAndLossForTimeframeProjectView, fetchProfitAndLossProjectView, resetProfitAndLossProjectNodeCollapseState, updateProjectViewAccountViewMode, updateProjectsToFilterOut, updateProfitAndLossProjectViewUIState, ProfitAndLossProjectViewUIState, getProfitAndLossProjectView, ProfitAndLossProjectViewReport, Project, ProjectReportWithBalances, SectionProjectViewReport, };
|
|
701
|
+
export { clearProfitAndLossProjectView, fetchProfitAndLossForTimeframeProjectView, fetchProfitAndLossProjectView, resetProfitAndLossProjectNodeCollapseState, updateProjectViewAccountViewMode, updateProjectsToFilterOut, updateProfitAndLossProjectViewUIState, ProfitAndLossProjectViewUIState, getProfitAndLossProjectView, ProfitAndLossProjectViewReport, Project, ProjectBase, ProjectReportWithBalances, SectionProjectViewReport, };
|
|
702
702
|
export { AccountingProviderAttachmentSelector, getAccountingProviderAttachment };
|
|
703
703
|
export { fetchUserListByType, getUserList, UserListSelectorView };
|
|
704
704
|
export { fetchAllPeopleRequiredViews, fetchPeoplePage, fetchPeople, deletePerson, resendInvite, changeZeniPersonRoles, invitePeople, inviteZeniPeople, updatePeopleUIState, peopleSaveUpdates, resetUpdateErrorMessage, peopleSaveDataInLocalStore, peopleClearDataInLocalStore, PeopleSelectorView, PeopleLocalDataView, Person, getPeople, getPeopleLocalData, PeopleState, PersonUpdateType, PeoplePageMode, ZeniPersonUserRoleType, PeopleUIState, PeopleLocalData, initializeEditPerson, };
|
|
@@ -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>;
|
|
@@ -4,9 +4,11 @@ exports.fetchTransactionCategorizationViewEpic = void 0;
|
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
7
8
|
const accountListReducer_1 = require("../../../accountList/accountListReducer");
|
|
8
9
|
const classListReducer_1 = require("../../../classList/classListReducer");
|
|
9
10
|
const ownerListReducer_1 = require("../../../ownerList/ownerListReducer");
|
|
11
|
+
const projectListReducer_1 = require("../../../projectList/projectListReducer");
|
|
10
12
|
const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
|
|
11
13
|
const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(transactionsViewReducer_1.fetchTransactionCategorizationView.match), (0, operators_1.mergeMap)((action) => {
|
|
12
14
|
const { selectedTab, cacheOverride, keepExistingListItems, pageToken, period, refreshViewInBackground, searchString, resetListItems, isUncategorizedExpenseCategoryEnabled, } = action.payload;
|
|
@@ -29,6 +31,12 @@ const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pi
|
|
|
29
31
|
classList.fetchState === 'Not-Started') {
|
|
30
32
|
updateActions.push((0, classListReducer_1.fetchClassList)());
|
|
31
33
|
}
|
|
34
|
+
const projectList = state$.value.projectListState;
|
|
35
|
+
if ((0, tenantSelector_1.getIsAccountingProjectsEnabled)(state$.value) &&
|
|
36
|
+
projectList.hasValidState() === false &&
|
|
37
|
+
projectList.fetchState === 'Not-Started') {
|
|
38
|
+
updateActions.push((0, projectListReducer_1.fetchProjectList)());
|
|
39
|
+
}
|
|
32
40
|
const vendorOwnerList = state$.value.ownerListState;
|
|
33
41
|
if (vendorOwnerList.hasValidState() === false &&
|
|
34
42
|
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
|
}
|
|
@@ -44,6 +44,7 @@ const toTransactionUpdatesFromTransactionCategorizationLocalData = (transactionC
|
|
|
44
44
|
lineDescription: lineItem.lineDescription,
|
|
45
45
|
class: lineItem.class,
|
|
46
46
|
account: lineItem.account,
|
|
47
|
+
project: lineItem.project,
|
|
47
48
|
recommendation: (0, transactionHelper_1.convertCOTRecommendationsToRegular)(lineItem.recommendationsWithCOT),
|
|
48
49
|
};
|
|
49
50
|
if (line.type === 'journal_entry_transaction_line' ||
|
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, selectedProjectBase?: 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, selectedProjectBase, 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 (selectedProjectBase != null) {
|
|
346
|
+
record.project = selectedProjectBase;
|
|
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,10 @@ const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, tra
|
|
|
392
396
|
selectedCheckBoxTransactionIds.push(transaction.id);
|
|
393
397
|
}
|
|
394
398
|
}
|
|
399
|
+
// Project intentionally does NOT propagate to other rows of
|
|
400
|
+
// the same vendor: each line can carry a different project,
|
|
401
|
+
// and auto-filling siblings (the way class does) leads to
|
|
402
|
+
// unexpected bulk selection.
|
|
395
403
|
}
|
|
396
404
|
}
|
|
397
405
|
if (line.type === 'transaction_with_product_or_service_line') {
|
|
@@ -522,6 +530,7 @@ const setEntityRecommendationForLineIdInLocalData = (draft, transaction, transac
|
|
|
522
530
|
...newLineItem,
|
|
523
531
|
class: matchingRecord.class,
|
|
524
532
|
account: matchingRecord.account,
|
|
533
|
+
project: matchingRecord.project,
|
|
525
534
|
lineEntity: matchingRecord.lineEntity,
|
|
526
535
|
};
|
|
527
536
|
}
|
|
@@ -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, lineEntity?: Entity | undefined, recommendations?: RecommendationWithCOT[] | undefined, isUncategorizedExpenseCategoryEnabled?: boolean | undefined, isAccountingClassesEnabled?: boolean | undefined, selectedProjectBase?: ProjectBase | 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
|
+
selectedProjectBase: 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, selectedProjectBase, 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: selectedProjectBase,
|
|
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 !== selectedProjectBase?.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, selectedProjectBase, 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, lineEntity, recommendations, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled, selectedProjectBase) {
|
|
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
|
+
selectedProjectBase,
|
|
367
376
|
recommendations,
|
|
368
377
|
uncategorizedAccounts,
|
|
369
378
|
isAccountingClassesEnabled,
|