@zeniai/client-epic-state 4.17.34 → 4.17.35
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/commonPayloadTypes/recommendationPayload.d.ts +1 -0
- package/lib/commonPayloadTypes/recommendationPayload.js +1 -0
- package/lib/commonPayloadTypes/vendorRecommendationPayload.d.ts +2 -0
- package/lib/commonStateTypes/animations.d.ts +1 -1
- package/lib/commonStateTypes/animations.js +1 -0
- package/lib/commonStateTypes/recommendationBase.d.ts +11 -3
- package/lib/commonStateTypes/recommendationBase.js +5 -3
- package/lib/commonStateTypes/vendorRecommendation.d.ts +6 -0
- package/lib/entity/account/accountPayload.d.ts +1 -0
- package/lib/entity/account/accountPayload.js +1 -1
- package/lib/entity/account/accountState.d.ts +5 -0
- package/lib/entity/aiCfo/aiCfoState.d.ts +2 -2
- package/lib/entity/class/classPayload.d.ts +1 -0
- package/lib/entity/class/classPayload.js +1 -1
- package/lib/entity/class/classState.d.ts +5 -0
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.d.ts +15 -0
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +20 -1
- package/lib/entity/transaction/stateTypes/customerTransaction.d.ts +4 -1
- package/lib/entity/transaction/stateTypes/transaction.d.ts +5 -1
- package/lib/entity/transaction/stateTypes/transactionLine.d.ts +12 -0
- package/lib/entity/transaction/stateTypes/vendorTransaction.d.ts +7 -1
- package/lib/entity/transaction/transactionHelper.d.ts +5 -0
- package/lib/entity/transaction/transactionHelper.js +135 -0
- package/lib/entity/transaction/transactionState.d.ts +4 -3
- package/lib/index.d.ts +10 -10
- package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +2 -2
- package/lib/view/companyView/types/cockpitTypes.d.ts +1 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/initializeTransactionCategorizationLocalDataEpic.js +3 -1
- package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +6 -6
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +7 -7
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +9 -9
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +2 -2
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +3 -1
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +3 -3
- package/lib/view/opExByVendor/opExByVendorState.d.ts +1 -1
- package/lib/view/recommendation/fetchEntityRecommendationsByTransactionIdEpic.js +5 -1
- package/lib/view/scheduleView/scheduleAccruedDetailView/LinkBillExpenseView/linkBillExpense.d.ts +1 -1
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
- package/lib/view/taskManager/taskListView/taskList.d.ts +1 -1
- package/lib/view/transactionDetail/epics/saveTransactionHelper.js +3 -2
- package/lib/view/transactionDetail/transactionDetailLocalDataHelper.d.ts +3 -3
- package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +47 -21
- package/lib/view/transactionDetail/transactionDetailReducer.d.ts +2 -2
- package/lib/view/transactionDetail/transactionDetailSelector.d.ts +3 -3
- package/lib/view/transactionDetail/transactionDetailSelector.js +2 -1
- package/lib/view/transactionDetail/transactionDetailTypes.d.ts +2 -2
- package/package.json +1 -1
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.initializeTransactionCategorizationViewLocalDataEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const transactionHelper_1 = require("../../../../entity/transaction/transactionHelper");
|
|
6
7
|
const transactionSelector_1 = require("../../../../entity/transaction/transactionSelector");
|
|
7
8
|
const accountListSelector_1 = require("../../../accountList/accountListSelector");
|
|
8
9
|
const transactionCategorizationLocalDataHelper_1 = require("../../helpers/transactionCategorizationLocalDataHelper");
|
|
@@ -19,7 +20,8 @@ const initializeTransactionCategorizationViewLocalDataEpic = (actions$, state$)
|
|
|
19
20
|
const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(state$.value.accountState, state$.value.accountListState, 'accountList');
|
|
20
21
|
transactions.forEach((transaction) => {
|
|
21
22
|
var _a, _b;
|
|
22
|
-
const
|
|
23
|
+
const transactionWithCOT = (0, transactionHelper_1.getTransactionWithCOT)(transaction);
|
|
24
|
+
const newTransactionsLocalData = (0, transactionCategorizationLocalDataHelper_1.toTransactionDetailLocalData)(transactionWithCOT, selectedTab, lineItemsByTransactionIds[transaction.id], uncategorizedIncomeExpense);
|
|
23
25
|
if (transactionLocalData[transaction.id] == null) {
|
|
24
26
|
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
27
|
}
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toTransactionUpdatesFromTransactionCategorizationLocalData = void 0;
|
|
4
4
|
const vendorTransaction_1 = require("../../../entity/transaction/stateTypes/vendorTransaction");
|
|
5
|
+
const transactionHelper_1 = require("../../../entity/transaction/transactionHelper");
|
|
5
6
|
const recommendationState_1 = require("../../recommendation/recommendationState");
|
|
6
7
|
const saveTransactionHelper_1 = require("../../transactionDetail/epics/saveTransactionHelper");
|
|
7
8
|
/**
|
|
@@ -44,7 +45,7 @@ const toTransactionUpdatesFromTransactionCategorizationLocalData = (transactionC
|
|
|
44
45
|
lineDescription: lineItem.lineDescription,
|
|
45
46
|
class: lineItem.class,
|
|
46
47
|
account: lineItem.account,
|
|
47
|
-
recommendation: lineItem.
|
|
48
|
+
recommendation: (0, transactionHelper_1.convertCOTRecommendationsToRegular)(lineItem.recommendationsWithCOT),
|
|
48
49
|
};
|
|
49
50
|
if (line.type === 'journal_entry_transaction_line' ||
|
|
50
51
|
line.platformLineDetailType === 'deposit_line_detail') {
|
package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts
CHANGED
|
@@ -2,16 +2,16 @@ import { ID } from '../../../commonStateTypes/common';
|
|
|
2
2
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
3
3
|
import { ClassBase } from '../../../entity/class/classState';
|
|
4
4
|
import { Entity } from '../../../entity/genericEntity/entity';
|
|
5
|
-
import {
|
|
6
|
-
import {
|
|
5
|
+
import { RecommendationWithCOTByLineId } from '../../../entity/transaction/stateTypes/transaction';
|
|
6
|
+
import { SupportedTransactionPayload, SupportedTransactionWithCOT } from '../../../entity/transaction/transactionState';
|
|
7
7
|
import { UncategorizedAccounts } from '../../accountList/accountListSelector';
|
|
8
8
|
import { TransactionReviewLocalDataSelectorView } from '../selectorTypes/transactionsViewSelectorTypes';
|
|
9
9
|
import { TabSpecificLineItems, TransactionReviewLocalData, TransactionsTab, TransactionsTabViewState } from '../types/transactionsViewState';
|
|
10
10
|
export declare const MAX_SELECTION_LIMIT = 5;
|
|
11
|
-
export declare const toTransactionDetailLocalData: (transaction:
|
|
12
|
-
export declare const toSetAllLineItemsToCategoryClass: (draft: TransactionsTabViewState, transaction:
|
|
13
|
-
export declare const setEntityRecommendationForLineIdInLocalData: (draft: TransactionsTabViewState, transaction:
|
|
14
|
-
export declare const checkIfAllLineItemsAreCategoryClassFilled: (transaction:
|
|
11
|
+
export declare const toTransactionDetailLocalData: (transaction: SupportedTransactionWithCOT, selectedTab: TransactionsTab, lineItemsByTransactionIds: string[], uncategorizedIncomeExpense: UncategorizedAccounts) => TransactionReviewLocalData;
|
|
12
|
+
export declare const toSetAllLineItemsToCategoryClass: (draft: TransactionsTabViewState, transaction: SupportedTransactionWithCOT, transactionId: ID, transactionLineId: ID, transactionDetailLocalData: TransactionReviewLocalData, updatedItem: "category" | "class", uncategorizedAccounts: UncategorizedAccounts, vendorId?: ID, customerId?: ID, selectedAccount?: AccountBase, selectedClassBase?: ClassBase) => TransactionReviewLocalData;
|
|
13
|
+
export declare const setEntityRecommendationForLineIdInLocalData: (draft: TransactionsTabViewState, transaction: SupportedTransactionWithCOT, transactionDetailLocalData: TransactionReviewLocalData, entity: Entity, recommendationLineIds: ID[], uncategorizedAccounts: UncategorizedAccounts, recommendationByLineId?: RecommendationWithCOTByLineId) => TransactionReviewLocalData;
|
|
14
|
+
export declare const checkIfAllLineItemsAreCategoryClassFilled: (transaction: SupportedTransactionWithCOT, transactionDetailLocalData: TransactionReviewLocalData, uncategorizedAccounts: UncategorizedAccounts) => boolean;
|
|
15
15
|
export declare const getLineItemsByTransactionsIdsFromResponse: (transactions: SupportedTransactionPayload[]) => Record<string, string[]>;
|
|
16
16
|
export declare const getLineItemsByTransactionIdsFromLocalData: (transactionLocalData: TransactionReviewLocalDataSelectorView[], selectedTab: TransactionsTab) => Record<ID, string[]>;
|
|
17
17
|
export declare const mergeTabSpecificLineItems: (currentTabSpecificLineItems: TabSpecificLineItems, selectedTab: TransactionsTab, newLineItems: TabSpecificLineItems) => TabSpecificLineItems;
|
|
@@ -57,7 +57,7 @@ const toTransactionDetailLocalData = (transaction, selectedTab, lineItemsByTrans
|
|
|
57
57
|
else {
|
|
58
58
|
const firstLine = (_a = transaction.lines) === null || _a === void 0 ? void 0 : _a[0];
|
|
59
59
|
const recommendations = (firstLine === null || firstLine === void 0 ? void 0 : firstLine.id) != null
|
|
60
|
-
? (_b = transaction.
|
|
60
|
+
? (_b = transaction.recommendationsWithCOT) === null || _b === void 0 ? void 0 : _b[firstLine === null || firstLine === void 0 ? void 0 : firstLine.id]
|
|
61
61
|
: undefined;
|
|
62
62
|
const vendor = (_c = recommendations === null || recommendations === void 0 ? void 0 : recommendations[0]) === null || _c === void 0 ? void 0 : _c.vendor;
|
|
63
63
|
if (vendor != null && Boolean(vendor.id)) {
|
|
@@ -86,7 +86,7 @@ const toTransactionDetailLocalData = (transaction, selectedTab, lineItemsByTrans
|
|
|
86
86
|
transactionLocal.customerUpdates = undefined;
|
|
87
87
|
transactionLocal.lineItemById =
|
|
88
88
|
transaction.lines != null && transaction.lines.length > 0
|
|
89
|
-
? buildLineItemById(transaction, uncategorizedIncomeExpense, transaction.
|
|
89
|
+
? buildLineItemById(transaction, uncategorizedIncomeExpense, transaction.recommendationsWithCOT)
|
|
90
90
|
: {};
|
|
91
91
|
transactionLocal.sortedLineItems =
|
|
92
92
|
transaction.lines != null && transaction.lines.length > 0
|
|
@@ -152,7 +152,7 @@ const buildLineItemById = (transaction, uncategorizedIncomeExpense, recommendati
|
|
|
152
152
|
record.categorizationStatus = accountLine.categorizationStatus;
|
|
153
153
|
record.reviewPendingReasons = accountLine.reviewPendingReasons;
|
|
154
154
|
if (recommendations != null) {
|
|
155
|
-
record.
|
|
155
|
+
record.recommendationsWithCOT = recommendations[lineId];
|
|
156
156
|
const higherPreferenceRecommendation = (_c = recommendations[lineId]) === null || _c === void 0 ? void 0 : _c[0];
|
|
157
157
|
if ((accountLine.account.accountId === '' ||
|
|
158
158
|
accountLine.account.accountId == null ||
|
|
@@ -325,7 +325,7 @@ const setEntityRecommendationForLineIdInLocalData = (draft, transaction, transac
|
|
|
325
325
|
line.type === 'transaction_with_product_or_service_line' ||
|
|
326
326
|
line.type === 'journal_entry_transaction_line') {
|
|
327
327
|
const record = Object.assign({}, oldRecord);
|
|
328
|
-
const recommendations = (0, transactionDetailLocalDataHelper_1.
|
|
328
|
+
const recommendations = (0, transactionDetailLocalDataHelper_1.mergeTransactionAndEntityRecommendationsWithCOT)(oldRecord.recommendationsWithCOT, recommendationByLineId === null || recommendationByLineId === void 0 ? void 0 : recommendationByLineId[lineId]);
|
|
329
329
|
const accountLine = line;
|
|
330
330
|
const isUncategorizedAccount = (0, transactionDetailLocalDataHelper_2.isAccountUncategorized)(uncategorizedAccounts, accountLine.account.qboId);
|
|
331
331
|
record.account =
|
|
@@ -347,7 +347,7 @@ const setEntityRecommendationForLineIdInLocalData = (draft, transaction, transac
|
|
|
347
347
|
}
|
|
348
348
|
}
|
|
349
349
|
record.billable = accountLine.billable;
|
|
350
|
-
record.
|
|
350
|
+
record.recommendationsWithCOT = recommendations;
|
|
351
351
|
newLineItems[line.id] = record;
|
|
352
352
|
}
|
|
353
353
|
}
|
|
@@ -357,11 +357,11 @@ const setEntityRecommendationForLineIdInLocalData = (draft, transaction, transac
|
|
|
357
357
|
}
|
|
358
358
|
const record = Object.assign({}, oldRecord);
|
|
359
359
|
if (checkIfNotJEAndDeposit === false) {
|
|
360
|
-
const recommendations = (0, transactionDetailLocalDataHelper_1.
|
|
360
|
+
const recommendations = (0, transactionDetailLocalDataHelper_1.mergeTransactionAndEntityRecommendationsWithCOT)(oldRecord.recommendationsWithCOT, recommendationByLineId === null || recommendationByLineId === void 0 ? void 0 : recommendationByLineId[lineId]);
|
|
361
361
|
const accountLine = line;
|
|
362
362
|
record.account = accountLine.account;
|
|
363
363
|
record.class = accountLine.class;
|
|
364
|
-
record.
|
|
364
|
+
record.recommendationsWithCOT = recommendations;
|
|
365
365
|
}
|
|
366
366
|
newLineItems[lineId] = record;
|
|
367
367
|
}
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import { FetchState, ID } from '../../../commonStateTypes/common';
|
|
2
|
-
import {
|
|
2
|
+
import { RecommendationWithCOT } from '../../../commonStateTypes/recommendationBase';
|
|
3
3
|
import { MonthYearPeriod, TimePeriod } from '../../../commonStateTypes/timePeriod';
|
|
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
7
|
import { CustomerBase } from '../../../entity/customer/customerState';
|
|
8
8
|
import { Entity } from '../../../entity/genericEntity/entity';
|
|
9
|
-
import {
|
|
10
|
-
import { SupportedTransaction } from '../../../entity/transaction/transactionState';
|
|
9
|
+
import { RecommendationWithCOTByLineId, TransactionID } from '../../../entity/transaction/stateTypes/transaction';
|
|
10
|
+
import { SupportedTransaction, SupportedTransactionWithCOT } from '../../../entity/transaction/transactionState';
|
|
11
11
|
import { VendorBase } from '../../../entity/vendor/vendorState';
|
|
12
12
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
13
13
|
import { UncategorizedAccounts } from '../../accountList/accountListSelector';
|
|
@@ -87,17 +87,17 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
87
87
|
uncategorizedAccounts: UncategorizedAccounts;
|
|
88
88
|
updatedCustomer?: CustomerBase;
|
|
89
89
|
selectedEntity?: Entity;
|
|
90
|
-
}, "expenseAutomationTransactionsView/updateSelectedCustomerForTransaction">, setAllItemsToCategoryClassInLocalDataForCategorization: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionId: string, lineId: string, transactions:
|
|
90
|
+
}, "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], {
|
|
91
91
|
selectedTab: "review" | "autoCategorized";
|
|
92
92
|
transactionId: string;
|
|
93
93
|
lineId: string;
|
|
94
|
-
transactions:
|
|
94
|
+
transactions: SupportedTransactionWithCOT[];
|
|
95
95
|
vendorId: string | undefined;
|
|
96
96
|
customerId: string | undefined;
|
|
97
97
|
lineEntity: Entity | undefined;
|
|
98
98
|
selectedAccount: AccountBase | undefined;
|
|
99
99
|
selectedClassBase: ClassBase | undefined;
|
|
100
|
-
recommendations:
|
|
100
|
+
recommendations: RecommendationWithCOT[] | undefined;
|
|
101
101
|
uncategorizedAccounts: UncategorizedAccounts;
|
|
102
102
|
}, "expenseAutomationTransactionsView/setAllItemsToCategoryClassInLocalDataForCategorization", never, never>, updateTotalCountForTransactionCategorization: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
103
103
|
selectedPeriod: MonthYearPeriod;
|
|
@@ -122,14 +122,14 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
122
122
|
}, "expenseAutomationTransactionsView/fetchTransactionCategorizationView", never, never>, updateSelectedCheckboxTransactionIds: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
123
123
|
selectedTab: TransactionsTab;
|
|
124
124
|
transactionIds: ID[];
|
|
125
|
-
}, "expenseAutomationTransactionsView/updateSelectedCheckboxTransactionIds">, clearExpenseAutomationTransactionsViewPerTabView: import("@reduxjs/toolkit").ActionCreatorWithPayload<"review" | "autoCategorized", "expenseAutomationTransactionsView/clearExpenseAutomationTransactionsViewPerTabView">, clearExpenseAutomationTransactionsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationTransactionsView/clearExpenseAutomationTransactionsView">, setEntityRecommendationForLineIdsForCategorization: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionId: TransactionID, transaction:
|
|
125
|
+
}, "expenseAutomationTransactionsView/updateSelectedCheckboxTransactionIds">, clearExpenseAutomationTransactionsViewPerTabView: import("@reduxjs/toolkit").ActionCreatorWithPayload<"review" | "autoCategorized", "expenseAutomationTransactionsView/clearExpenseAutomationTransactionsViewPerTabView">, clearExpenseAutomationTransactionsView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationTransactionsView/clearExpenseAutomationTransactionsView">, setEntityRecommendationForLineIdsForCategorization: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionId: TransactionID, transaction: SupportedTransactionWithCOT, lineIds: string[], entity: Entity, amount: number, recommendationByLineId: RecommendationWithCOTByLineId, uncategorizedAccounts: UncategorizedAccounts], {
|
|
126
126
|
selectedTab: "review" | "autoCategorized";
|
|
127
127
|
transactionId: TransactionID;
|
|
128
|
-
transaction:
|
|
128
|
+
transaction: SupportedTransactionWithCOT;
|
|
129
129
|
lineIds: string[];
|
|
130
130
|
entity: Entity;
|
|
131
131
|
amount: number;
|
|
132
|
-
recommendationByLineId:
|
|
132
|
+
recommendationByLineId: RecommendationWithCOTByLineId;
|
|
133
133
|
uncategorizedAccounts: UncategorizedAccounts;
|
|
134
134
|
}, "expenseAutomationTransactionsView/setEntityRecommendationForLineIdsForCategorization", never, never>, updateSelectedTransactionId: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
135
135
|
selectedTab: TransactionsTab;
|
|
@@ -4,7 +4,7 @@ import { CompletionStatusType, FetchStateAndError, ID } from '../../../commonSta
|
|
|
4
4
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
5
5
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
6
6
|
import { ClassBase } from '../../../entity/class/classState';
|
|
7
|
-
import {
|
|
7
|
+
import { SupportedTransactionWithCOT } from '../../../entity/transaction/transactionState';
|
|
8
8
|
import { UncategorizedAccounts } from '../../accountList/accountListSelector';
|
|
9
9
|
import { TransactionReviewLocalData, TransactionsTab, TransactionsViewUIState } from '../types/transactionsViewState';
|
|
10
10
|
export interface TransactionReviewLocalDataSelectorView {
|
|
@@ -14,7 +14,7 @@ export interface TransactionReviewLocalDataSelectorView {
|
|
|
14
14
|
export interface ExpenseAutomationTransactionViewSelector extends SelectorView {
|
|
15
15
|
uiState: TransactionsViewUIState;
|
|
16
16
|
uncategorizedAccounts: UncategorizedAccounts;
|
|
17
|
-
transactions:
|
|
17
|
+
transactions: SupportedTransactionWithCOT[];
|
|
18
18
|
accountList: AccountBase[];
|
|
19
19
|
accountsHierarchyList: NestedAccountHierarchyForReport[];
|
|
20
20
|
totalCountByTab: Record<TransactionsTab, number>;
|
|
@@ -8,6 +8,7 @@ const omit_1 = __importDefault(require("lodash/omit"));
|
|
|
8
8
|
const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState");
|
|
9
9
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
10
10
|
const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
|
|
11
|
+
const transactionHelper_1 = require("../../../entity/transaction/transactionHelper");
|
|
11
12
|
const transactionSelector_1 = require("../../../entity/transaction/transactionSelector");
|
|
12
13
|
const accountListSelector_1 = require("../../accountList/accountListSelector");
|
|
13
14
|
const classListSelector_1 = require("../../classList/classListSelector");
|
|
@@ -46,6 +47,7 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
46
47
|
})
|
|
47
48
|
.filter((transaction) => transaction != null);
|
|
48
49
|
const transactions = (0, transactionSelector_1.getSupportedTransactionsByIds)(transactionState, transactionIds);
|
|
50
|
+
const transactionsWithCOT = transactions.map((transaction) => (0, transactionHelper_1.getTransactionWithCOT)(transaction));
|
|
49
51
|
const fetchStatus = (0, reduceFetchState_1.reduceAllFetchState)([
|
|
50
52
|
accountList,
|
|
51
53
|
classList,
|
|
@@ -82,7 +84,7 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
82
84
|
version: 0,
|
|
83
85
|
fetchState: fetchStatus.fetchState,
|
|
84
86
|
error: fetchStatus.error,
|
|
85
|
-
transactions,
|
|
87
|
+
transactions: transactionsWithCOT,
|
|
86
88
|
selectedCheckBoxTransactionIds,
|
|
87
89
|
uncategorizedAccounts: uncategorizedIncomeExpense,
|
|
88
90
|
transactionIdsBySelectedPeriod,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
3
3
|
import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
4
|
-
export declare const toMissingReceiptsSortKey: (v: string) => "date" | "vendor" | "amount" | "
|
|
4
|
+
export declare const toMissingReceiptsSortKey: (v: string) => "date" | "vendor" | "amount" | "category" | "class";
|
|
5
5
|
export type MissingReceiptsSortKey = ReturnType<typeof toMissingReceiptsSortKey>;
|
|
6
6
|
export interface MissingReceiptsViewUIState {
|
|
7
7
|
searchString: string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { Amount } from '../../../commonStateTypes/amount';
|
|
2
2
|
import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
|
|
3
|
-
import { Recommendation } from '../../../commonStateTypes/recommendationBase';
|
|
3
|
+
import { Recommendation, RecommendationWithCOT } from '../../../commonStateTypes/recommendationBase';
|
|
4
4
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
5
5
|
import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
6
6
|
import { PageToken } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
@@ -15,7 +15,7 @@ import { VendorBase } from '../../../entity/vendor/vendorState';
|
|
|
15
15
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
16
16
|
import { EntityRecommendationKey } from '../../recommendation/recommendationState';
|
|
17
17
|
import { TransactionDetailKey } from '../../transactionDetail/transactionDetailState';
|
|
18
|
-
export declare const toTransactionsSortKey: (v: string) => "date" | "vendor" | "amount" | "
|
|
18
|
+
export declare const toTransactionsSortKey: (v: string) => "date" | "vendor" | "amount" | "category" | "class" | "memo" | "transaction_type";
|
|
19
19
|
export type TransactionsSortKey = ReturnType<typeof toTransactionsSortKey>;
|
|
20
20
|
export declare const TRANSACTIONS_TABS: readonly ["review", "autoCategorized"];
|
|
21
21
|
export declare const toTransactionsTabKey: (v: string) => "review" | "autoCategorized";
|
|
@@ -48,7 +48,7 @@ export interface TransactionCategorizationLineItemData extends TransactionLineBa
|
|
|
48
48
|
account?: AccountBase;
|
|
49
49
|
customer?: CustomerBase;
|
|
50
50
|
vendor?: VendorBase;
|
|
51
|
-
|
|
51
|
+
recommendationsWithCOT?: RecommendationWithCOT[];
|
|
52
52
|
categorizationStatus?: CategorizationStatusType;
|
|
53
53
|
reviewPendingReasons?: string[];
|
|
54
54
|
item?: ProductOrService;
|
|
@@ -12,7 +12,7 @@ export interface OpExByVendorQuery {
|
|
|
12
12
|
fetchNextPage: boolean;
|
|
13
13
|
pageLimit?: number;
|
|
14
14
|
}
|
|
15
|
-
export declare const toOpexByVendorSortKeyType: (v: string) => "vendor" | "totals" | "
|
|
15
|
+
export declare const toOpexByVendorSortKeyType: (v: string) => "vendor" | "totals" | "class" | "account";
|
|
16
16
|
export declare type OpexByVendorSortKey = ReturnType<typeof toOpexByVendorSortKeyType>;
|
|
17
17
|
export declare function getOpexVendorKey(vendorId: ID, accountId: ID | undefined, classId: ID | undefined): string;
|
|
18
18
|
export type OpexVendorKey = ReturnType<typeof getOpexVendorKey>;
|
|
@@ -3,6 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.toEntityTypeURL = exports.fetchEntityRecommendationsByTransactionIdEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const transactionHelper_1 = require("../../entity/transaction/transactionHelper");
|
|
6
7
|
const responsePayload_1 = require("../../responsePayload");
|
|
7
8
|
const transactionsViewReducer_1 = require("../../view/expenseAutomationView/reducers/transactionsViewReducer");
|
|
8
9
|
const accountListSelector_1 = require("../accountList/accountListSelector");
|
|
@@ -27,6 +28,8 @@ const fetchEntityRecommendationsByTransactionIdEpic = (actions$, state$, zeniAPI
|
|
|
27
28
|
const { transactionId, transaction, lineIds } = transactionDetails;
|
|
28
29
|
const recommendationByLineId = (0, recommendationHelper_1.getRecommendationByLineIdFromRecommendationPayload)(response.data.recommendations, lineIds);
|
|
29
30
|
const recommendations = (0, recommendationHelper_1.getRecommendationFromRecommendationPayload)(response.data.recommendations);
|
|
31
|
+
// Convert transaction to COT format for categorization flow
|
|
32
|
+
const transactionWithCOT = (0, transactionHelper_1.getTransactionWithCOT)(transaction);
|
|
30
33
|
actions.push((0, recommendationReducer_1.updateRecommendationForEntity)({
|
|
31
34
|
entityId: entity.id,
|
|
32
35
|
entityType: entity.type,
|
|
@@ -38,7 +41,8 @@ const fetchEntityRecommendationsByTransactionIdEpic = (actions$, state$, zeniAPI
|
|
|
38
41
|
if (recommendationByLineId != null) {
|
|
39
42
|
const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(state$.value.accountState, state$.value.accountListState, 'accountList');
|
|
40
43
|
if (isTransactionCategorizationFlow === true) {
|
|
41
|
-
|
|
44
|
+
const recommendationWithCOTByLineId = (0, transactionHelper_1.convertRecommendationByLineIdToCOT)(recommendationByLineId, transactionWithCOT);
|
|
45
|
+
actions.push((0, transactionsViewReducer_1.setEntityRecommendationForLineIdsForCategorization)(selectedTransactionCategorizationTab, transactionId, transactionWithCOT, lineIds, entity, amount, recommendationWithCOTByLineId, uncategorizedIncomeExpense));
|
|
42
46
|
}
|
|
43
47
|
else {
|
|
44
48
|
actions.push((0, transactionDetailReducer_1.setEntityRecommendationForLineIdsForTransactionDetail)(transactionId, transaction, lineIds, entity, amount, recommendationByLineId, uncategorizedIncomeExpense));
|
package/lib/view/scheduleView/scheduleAccruedDetailView/LinkBillExpenseView/linkBillExpense.d.ts
CHANGED
|
@@ -1,3 +1,3 @@
|
|
|
1
|
-
declare const toLinkBillExpenseKeysType: (v: string) => "amount" | "
|
|
1
|
+
declare const toLinkBillExpenseKeysType: (v: string) => "amount" | "memo" | "name" | "attachment" | "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 type ScheduleListKey = ReturnType<typeof getScheduleListKey>;
|
|
8
8
|
export declare const toScheduleSubTabType: (v: string) => "completed" | "new" | "ongoing" | "all";
|
|
9
9
|
export type ScheduleSubTabType = ReturnType<typeof toScheduleSubTabType>;
|
|
10
|
-
declare const toScheduleSortKeyType: (v: string) => "months" | "vendor" | "status" | "amount" | "class" | "user" | "createTime" | "
|
|
10
|
+
declare const toScheduleSortKeyType: (v: string) => "months" | "vendor" | "status" | "amount" | "class" | "user" | "createTime" | "memo" | "balanceAsOfToday" | "assetId" | "transactionDate" | "transactionType" | "accruedExpenseCategory" | "scheduleCategory" | "expenseCategory" | "accumulatedDepreciationCategory" | "startMonth" | "endMonth";
|
|
11
11
|
export declare type ScheduleListSortKey = ReturnType<typeof toScheduleSortKeyType>;
|
|
12
12
|
export interface DownloadJEScheduleTabOptions {
|
|
13
13
|
timezone: string;
|
|
@@ -37,7 +37,7 @@ declare const toBillTabType: (v: string) => "paid" | "pending_approval" | "sched
|
|
|
37
37
|
export type BillTab = ReturnType<typeof toBillTabType>;
|
|
38
38
|
declare const toBillsSubTabType: (v: string) => "rejected" | "ach" | "wire" | "failed" | "cancelled" | "deleted" | "all" | "overdue" | "awaiting_approval" | "awaiting_my_approval" | "offline";
|
|
39
39
|
export type BillsSubTabType = ReturnType<typeof toBillsSubTabType>;
|
|
40
|
-
declare const toBillPaySortKeyType: (v: string) => "status" | "amount" | "
|
|
40
|
+
declare const toBillPaySortKeyType: (v: string) => "status" | "amount" | "dueDate" | "name" | "paymentMethod" | "invoiceDate";
|
|
41
41
|
export declare type BillPayViewSortKey = ReturnType<typeof toBillPaySortKeyType>;
|
|
42
42
|
export interface BillPayFilters {
|
|
43
43
|
categoryCombinationOperator: CategoryCombinationOperator;
|
|
@@ -45,7 +45,7 @@ export interface TaskListUIState extends SpendManagementUIState {
|
|
|
45
45
|
searchText: string;
|
|
46
46
|
groupByKey: TaskGroupKey;
|
|
47
47
|
}
|
|
48
|
-
declare const toTaskListSortKeyType: (v: string) => "status" | "
|
|
48
|
+
declare const toTaskListSortKeyType: (v: string) => "status" | "dueDate" | "name" | "tag" | "priority" | "timeSpent" | "assignee" | "creationDate";
|
|
49
49
|
export declare type TaskListViewSortKey = ReturnType<typeof toTaskListSortKeyType>;
|
|
50
50
|
export declare const TASK_LIST_FILTER_CATEGORIES: TaskListFilterCategoryOption[];
|
|
51
51
|
interface TaskListFilterCategoryOption {
|
|
@@ -4,6 +4,7 @@ exports.isTransactionUncategorized = exports.isTransactionMiscategorized = expor
|
|
|
4
4
|
const recommendationBase_1 = require("../../../commonStateTypes/recommendationBase");
|
|
5
5
|
const transactionType_1 = require("../../../entity/transaction/stateTypes/transactionType");
|
|
6
6
|
const vendorTransaction_1 = require("../../../entity/transaction/stateTypes/vendorTransaction");
|
|
7
|
+
const transactionHelper_1 = require("../../../entity/transaction/transactionHelper");
|
|
7
8
|
const recommendationState_1 = require("../../recommendation/recommendationState");
|
|
8
9
|
const transactionDetailLocalDataHelper_1 = require("../transactionDetailLocalDataHelper");
|
|
9
10
|
// This function will extract the data that will determine which all APIs need to be called
|
|
@@ -52,7 +53,7 @@ const toTransactionUpdatesFromTransactionDetailLocalData = (transactionDetailLoc
|
|
|
52
53
|
lineDescription: lineItem.lineDescription,
|
|
53
54
|
class: lineItem.class,
|
|
54
55
|
account: lineItem.account,
|
|
55
|
-
recommendation: lineItem.
|
|
56
|
+
recommendation: (0, transactionHelper_1.convertCOTRecommendationsToRegular)(lineItem.recommendationsWithCOT),
|
|
56
57
|
};
|
|
57
58
|
if (line.type === 'journal_entry_transaction_line' ||
|
|
58
59
|
line.platformLineDetailType === 'deposit_line_detail') {
|
|
@@ -90,7 +91,7 @@ const toTransactionUpdatesFromTransactionDetailLocalData = (transactionDetailLoc
|
|
|
90
91
|
lineItem.isRecommendedClassSelected === false ||
|
|
91
92
|
isMostRecentRecommendedCategorySelected === false ||
|
|
92
93
|
isMostRecentRecommendedClassSelected === false) &&
|
|
93
|
-
lineItem.
|
|
94
|
+
lineItem.recommendationsWithCOT != null &&
|
|
94
95
|
(hasCategoryChanged || hasClassChanged);
|
|
95
96
|
// If any bulkUpdate is true, call bulk update
|
|
96
97
|
isBulkUpdate = isBulkUpdate || ((_e = lineItem.isUpdateAllChecked) !== null && _e !== void 0 ? _e : false);
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { ID } from '../../commonStateTypes/common';
|
|
2
|
-
import {
|
|
2
|
+
import { RecommendationWithCOT } from '../../commonStateTypes/recommendationBase';
|
|
3
3
|
import { AccountBase, RecommendedAccountBase } from '../../entity/account/accountState';
|
|
4
4
|
import { ClassBase, RecommendedClassBase } from '../../entity/class/classState';
|
|
5
5
|
import { Entity } from '../../entity/genericEntity/entity';
|
|
@@ -17,7 +17,7 @@ export declare const toLineEntity: (lineRecord: JournalEntryTransactionLine | Tr
|
|
|
17
17
|
name: string;
|
|
18
18
|
logo?: import("../..").ZeniUrl;
|
|
19
19
|
} | undefined;
|
|
20
|
-
export declare const getRecommendedCategoryClass: (isCategoryMiscategorized: boolean, isClassMiscategorized: boolean, recommendation?:
|
|
20
|
+
export declare const getRecommendedCategoryClass: (isCategoryMiscategorized: boolean, isClassMiscategorized: boolean, recommendation?: RecommendationWithCOT[], account?: AccountBase, classObj?: ClassBase, uncategorizedIncomeExpense?: UncategorizedAccounts) => {
|
|
21
21
|
recommendedAccount: RecommendedAccountBase | undefined;
|
|
22
22
|
recommendedClass: RecommendedClassBase | undefined;
|
|
23
23
|
};
|
|
@@ -44,4 +44,4 @@ export declare const toUpdateLineItemsToOriginalVendor: (transaction: SupportedT
|
|
|
44
44
|
*/
|
|
45
45
|
export declare const isEntityMatching: (entity: Entity | undefined, record: TransactionDetailLineItemData) => boolean;
|
|
46
46
|
export declare const isAccountUncategorized: (uncategorizedIncomeExpense: UncategorizedAccounts, accountQboId?: ID) => boolean;
|
|
47
|
-
export declare const
|
|
47
|
+
export declare const mergeTransactionAndEntityRecommendationsWithCOT: (transactionRecommendations?: RecommendationWithCOT[], entityRecommendations?: RecommendationWithCOT[]) => RecommendationWithCOT[] | undefined;
|
|
@@ -1,9 +1,21 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __rest = (this && this.__rest) || function (s, e) {
|
|
3
|
+
var t = {};
|
|
4
|
+
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0)
|
|
5
|
+
t[p] = s[p];
|
|
6
|
+
if (s != null && typeof Object.getOwnPropertySymbols === "function")
|
|
7
|
+
for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) {
|
|
8
|
+
if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i]))
|
|
9
|
+
t[p[i]] = s[p[i]];
|
|
10
|
+
}
|
|
11
|
+
return t;
|
|
12
|
+
};
|
|
2
13
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
14
|
+
exports.mergeTransactionAndEntityRecommendationsWithCOT = exports.isAccountUncategorized = exports.isEntityMatching = exports.toUpdateLineItemsToOriginalVendor = exports.toSetAllLineItemsToVendor = exports.getChangedLineItemCountFromLocalData = exports.removeEntityRecommendationForLineIdInLocalData = exports.setEntityRecommendationForLineIdInLocalData = exports.toSetAllLineItemsLocalDataIsUpdateAllChecked = exports.toSetAllLineItemsToCategoryClass = exports.toUpdateLineItemsOriginalCategoryClass = exports.getRecommendedCategoryClass = exports.toLineEntity = exports.toTransactionDetailLocalData = void 0;
|
|
4
15
|
const entity_1 = require("../../entity/genericEntity/entity");
|
|
5
16
|
const customerTransaction_1 = require("../../entity/transaction/stateTypes/customerTransaction");
|
|
6
17
|
const vendorTransaction_1 = require("../../entity/transaction/stateTypes/vendorTransaction");
|
|
18
|
+
const transactionHelper_1 = require("../../entity/transaction/transactionHelper");
|
|
7
19
|
const transactionDetailState_1 = require("./transactionDetailState");
|
|
8
20
|
const toTransactionDetailLocalData = (transaction, vendorId, uncategorizedIncomeExpense) => {
|
|
9
21
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
@@ -81,14 +93,16 @@ const toTransactionDetailLocalData = (transaction, vendorId, uncategorizedIncome
|
|
|
81
93
|
else {
|
|
82
94
|
transactionLocal.customerDetails = undefined;
|
|
83
95
|
}
|
|
96
|
+
// Convert transaction to COT format
|
|
97
|
+
const transactionWithCOT = (0, transactionHelper_1.getTransactionWithCOT)(transaction);
|
|
84
98
|
transactionLocal.lineItemById =
|
|
85
99
|
transaction.lines != null && transaction.lines.length > 0
|
|
86
|
-
? buildLineItemById(transaction, uncategorizedIncomeExpense,
|
|
100
|
+
? buildLineItemById(transaction, uncategorizedIncomeExpense, transactionWithCOT.recommendationsWithCOT)
|
|
87
101
|
: {};
|
|
88
102
|
return transactionLocal;
|
|
89
103
|
};
|
|
90
104
|
exports.toTransactionDetailLocalData = toTransactionDetailLocalData;
|
|
91
|
-
const buildLineItemById = (transaction, uncategorizedIncomeExpense,
|
|
105
|
+
const buildLineItemById = (transaction, uncategorizedIncomeExpense, recommendationsWithCOT) => {
|
|
92
106
|
const lineItemData = {};
|
|
93
107
|
const { lines } = transaction;
|
|
94
108
|
const isJEOrBankDepositTransaction = (0, vendorTransaction_1.isVendorTransaction)(transaction) === false &&
|
|
@@ -112,9 +126,9 @@ const buildLineItemById = (transaction, uncategorizedIncomeExpense, recommendati
|
|
|
112
126
|
record.class = accountLine.class;
|
|
113
127
|
record.customer = accountLine.customer;
|
|
114
128
|
record.billable = accountLine.billable;
|
|
115
|
-
if (
|
|
116
|
-
record.
|
|
117
|
-
const recommendation =
|
|
129
|
+
if (recommendationsWithCOT != null) {
|
|
130
|
+
record.recommendationsWithCOT = recommendationsWithCOT[lineId];
|
|
131
|
+
const recommendation = recommendationsWithCOT[lineId];
|
|
118
132
|
const { recommendedAccount, recommendedClass } = (0, exports.getRecommendedCategoryClass)((_c = accountLine.isCategoryMiscategorized) !== null && _c !== void 0 ? _c : false, (_d = accountLine.isClassMiscategorized) !== null && _d !== void 0 ? _d : false, recommendation, accountLine.account, accountLine.class, uncategorizedIncomeExpense);
|
|
119
133
|
// TODO: comparing with qboId because backend temporarily required us to compare
|
|
120
134
|
// class and account based on qbo id. This should ideally be based on accountId/ClassId
|
|
@@ -215,12 +229,18 @@ const getRecommendedCategoryClass = (isCategoryMiscategorized, isClassMiscategor
|
|
|
215
229
|
if (rec.account != null &&
|
|
216
230
|
rec.account.qboId !== (account === null || account === void 0 ? void 0 : account.qboId) &&
|
|
217
231
|
recommendedAccount == undefined) {
|
|
218
|
-
|
|
232
|
+
const _a = rec.account, { cot, reasoning } = _a, accountWithoutCOT = __rest(_a, ["cot", "reasoning"]);
|
|
233
|
+
void cot;
|
|
234
|
+
void reasoning;
|
|
235
|
+
recommendedAccount = accountWithoutCOT;
|
|
219
236
|
}
|
|
220
237
|
if (rec.class != null &&
|
|
221
238
|
rec.class.qboId !== (classObj === null || classObj === void 0 ? void 0 : classObj.qboId) &&
|
|
222
239
|
recommendedClass == undefined) {
|
|
223
|
-
|
|
240
|
+
const _b = rec.class, { cot, reasoning } = _b, classWithoutCOT = __rest(_b, ["cot", "reasoning"]);
|
|
241
|
+
void cot;
|
|
242
|
+
void reasoning;
|
|
243
|
+
recommendedClass = classWithoutCOT;
|
|
224
244
|
}
|
|
225
245
|
// Note: In case of uncat transactions, if class is correctly categorized,
|
|
226
246
|
// i.e line item class is equal to 1st recommended class, then no class recommendation should be shown
|
|
@@ -270,10 +290,10 @@ const toUpdateLineItemsOriginalCategoryClass = (transaction, transactionDetailLo
|
|
|
270
290
|
const isVendorOrCustomerPresent = record.vendor != null || record.customer != null;
|
|
271
291
|
if (isLineIdInReplaceList(line.id) != null) {
|
|
272
292
|
if (checkIfNotJEAndDeposit === true) {
|
|
273
|
-
record.
|
|
274
|
-
(_a = transactionDetailLocalData.lineItemById) === null || _a === void 0 ? void 0 : _a[lineId].
|
|
293
|
+
record.recommendationsWithCOT =
|
|
294
|
+
(_a = transactionDetailLocalData.lineItemById) === null || _a === void 0 ? void 0 : _a[lineId].recommendationsWithCOT;
|
|
275
295
|
}
|
|
276
|
-
const { recommendedAccount, recommendedClass } = (0, exports.getRecommendedCategoryClass)((_b = accountLine.isCategoryMiscategorized) !== null && _b !== void 0 ? _b : false, (_c = accountLine.isClassMiscategorized) !== null && _c !== void 0 ? _c : false, record.
|
|
296
|
+
const { recommendedAccount, recommendedClass } = (0, exports.getRecommendedCategoryClass)((_b = accountLine.isCategoryMiscategorized) !== null && _b !== void 0 ? _b : false, (_c = accountLine.isClassMiscategorized) !== null && _c !== void 0 ? _c : false, record.recommendationsWithCOT, accountLine.account, accountLine.class);
|
|
277
297
|
const updateCategory = () => {
|
|
278
298
|
var _a, _b;
|
|
279
299
|
if ((recommendedAccount === null || recommendedAccount === void 0 ? void 0 : recommendedAccount.qboId) !== accountLine.account.qboId &&
|
|
@@ -502,6 +522,9 @@ const toSetAllLineItemsLocalDataIsUpdateAllChecked = (transaction, transactionDe
|
|
|
502
522
|
exports.toSetAllLineItemsLocalDataIsUpdateAllChecked = toSetAllLineItemsLocalDataIsUpdateAllChecked;
|
|
503
523
|
const setEntityRecommendationForLineIdInLocalData = (transaction, transactionDetailLocalData, entity, recommendationLineIds, uncategorizedIncomeExpense, recommendationByLineId) => {
|
|
504
524
|
const newLineItems = {};
|
|
525
|
+
const recommendationWithCOTByLineId = recommendationByLineId != null
|
|
526
|
+
? (0, transactionHelper_1.convertRecommendationByLineIdToCOT)(recommendationByLineId, (0, transactionHelper_1.getTransactionWithCOT)(transaction))
|
|
527
|
+
: undefined;
|
|
505
528
|
let matchingEntityLineId = undefined;
|
|
506
529
|
const checkIfNotJEAndDeposit = (0, vendorTransaction_1.isVendorTransaction)(transaction) === true ||
|
|
507
530
|
(0, customerTransaction_1.isCustomerTransaction)(transaction) === true;
|
|
@@ -517,7 +540,7 @@ const setEntityRecommendationForLineIdInLocalData = (transaction, transactionDet
|
|
|
517
540
|
line.type === 'transaction_with_product_or_service_line' ||
|
|
518
541
|
line.type === 'journal_entry_transaction_line') {
|
|
519
542
|
const record = Object.assign({}, oldRecord);
|
|
520
|
-
const
|
|
543
|
+
const recommendationsWithCOT = (0, exports.mergeTransactionAndEntityRecommendationsWithCOT)(oldRecord.recommendationsWithCOT, recommendationWithCOTByLineId === null || recommendationWithCOTByLineId === void 0 ? void 0 : recommendationWithCOTByLineId[lineId]);
|
|
521
544
|
const accountLine = line;
|
|
522
545
|
record.account = accountLine.account;
|
|
523
546
|
record.class = accountLine.class;
|
|
@@ -537,8 +560,8 @@ const setEntityRecommendationForLineIdInLocalData = (transaction, transactionDet
|
|
|
537
560
|
}
|
|
538
561
|
}
|
|
539
562
|
record.billable = accountLine.billable;
|
|
540
|
-
record.
|
|
541
|
-
const { recommendedAccount, recommendedClass } = (0, exports.getRecommendedCategoryClass)((_a = accountLine.isCategoryMiscategorized) !== null && _a !== void 0 ? _a : false, (_b = accountLine.isClassMiscategorized) !== null && _b !== void 0 ? _b : false,
|
|
563
|
+
record.recommendationsWithCOT = recommendationsWithCOT;
|
|
564
|
+
const { recommendedAccount, recommendedClass } = (0, exports.getRecommendedCategoryClass)((_a = accountLine.isCategoryMiscategorized) !== null && _a !== void 0 ? _a : false, (_b = accountLine.isClassMiscategorized) !== null && _b !== void 0 ? _b : false, recommendationsWithCOT, accountLine.account, accountLine.class);
|
|
542
565
|
// TODO: comparing with qboId because backend temporarily required us to compare
|
|
543
566
|
// class and account based on qbo id. This should ideally be based on accountId/ClassId
|
|
544
567
|
if ((recommendedAccount === null || recommendedAccount === void 0 ? void 0 : recommendedAccount.qboId) !== accountLine.account.qboId &&
|
|
@@ -743,6 +766,7 @@ const toSetAllLineItemsToVendor = (transaction, transactionDetailLocalData, enti
|
|
|
743
766
|
exports.toSetAllLineItemsToVendor = toSetAllLineItemsToVendor;
|
|
744
767
|
const toUpdateLineItemsToOriginalVendor = (transaction, transactionDetailLocalData, lineIdToRetainVendorSelection) => {
|
|
745
768
|
const newLineItems = {};
|
|
769
|
+
const transactionWithCOT = (0, transactionHelper_1.getTransactionWithCOT)(transaction);
|
|
746
770
|
if (transaction.lines != null) {
|
|
747
771
|
// always preserving the order of the line items. hence iterating over this
|
|
748
772
|
transaction.lines.forEach((line) => {
|
|
@@ -757,10 +781,11 @@ const toUpdateLineItemsToOriginalVendor = (transaction, transactionDetailLocalDa
|
|
|
757
781
|
// We want to retain vendor and other selections for the line after whose vendor `update all` was selected.
|
|
758
782
|
const isVendorOrCustomerPresent = record.vendor != null || record.customer != null;
|
|
759
783
|
record.isUpdateAllChecked = false;
|
|
760
|
-
record.
|
|
784
|
+
record.recommendationsWithCOT =
|
|
785
|
+
(_a = transactionWithCOT.recommendationsWithCOT) === null || _a === void 0 ? void 0 : _a[lineId];
|
|
761
786
|
record.vendor = accountLine.vendor;
|
|
762
787
|
record.customer = accountLine.customer;
|
|
763
|
-
const { recommendedAccount, recommendedClass } = (0, exports.getRecommendedCategoryClass)(accountLine.isCategoryMiscategorized, accountLine.isClassMiscategorized, record.
|
|
788
|
+
const { recommendedAccount, recommendedClass } = (0, exports.getRecommendedCategoryClass)(accountLine.isCategoryMiscategorized, accountLine.isClassMiscategorized, record.recommendationsWithCOT, accountLine.account, accountLine.class);
|
|
764
789
|
// Update category
|
|
765
790
|
record.account = accountLine.account;
|
|
766
791
|
record.isRecommendedCategorySelected = false;
|
|
@@ -890,14 +915,15 @@ const isAccountUncategorized = (uncategorizedIncomeExpense, accountQboId) => {
|
|
|
890
915
|
};
|
|
891
916
|
exports.isAccountUncategorized = isAccountUncategorized;
|
|
892
917
|
/*
|
|
893
|
-
Note:
|
|
918
|
+
Note: COT version of mergeTransactionAndEntityRecommendationsWithCOT.
|
|
919
|
+
This function merges transaction recommendations with COT and entity recommendations with COT.
|
|
894
920
|
On transaction detail page, we get vendors, accounting_classes and accounts inside recommendations. This is stored inside local data.
|
|
895
921
|
When we select a vendor from vendor dropdown, recommendations api is called and in response, only accounting_classes and accounts we get.
|
|
896
|
-
|
|
922
|
+
So in this case, we need to merge the transaction recommendation with this new recommendation in order to keep `vendors` part as it is.
|
|
897
923
|
|
|
898
|
-
|
|
924
|
+
We are keeping `vendors` of transaction and updated accounting_classes and accounts from recommendations api call.
|
|
899
925
|
*/
|
|
900
|
-
const
|
|
926
|
+
const mergeTransactionAndEntityRecommendationsWithCOT = (transactionRecommendations, entityRecommendations) => {
|
|
901
927
|
if (entityRecommendations == null) {
|
|
902
928
|
return transactionRecommendations;
|
|
903
929
|
}
|
|
@@ -925,4 +951,4 @@ const mergeTransactionAndEntityRecommendations = (transactionRecommendations, en
|
|
|
925
951
|
});
|
|
926
952
|
}
|
|
927
953
|
};
|
|
928
|
-
exports.
|
|
954
|
+
exports.mergeTransactionAndEntityRecommendationsWithCOT = mergeTransactionAndEntityRecommendationsWithCOT;
|
|
@@ -71,12 +71,12 @@ export declare const downloadAccountingProviderAttachment: import("@reduxjs/tool
|
|
|
71
71
|
transactionLocalData: TransactionDetailLocalData;
|
|
72
72
|
}, "transactionDetail/saveTransactionDetailLocalData">, clearTransactionDetailLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
73
73
|
transactionId: TransactionID;
|
|
74
|
-
}, "transactionDetail/clearTransactionDetailLocalData">, resetLineItemsCategoryClassInLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, transaction: SupportedTransaction, lineIdsForReplace: string[], lineIdsForUpdateAll: string[], replace: "
|
|
74
|
+
}, "transactionDetail/clearTransactionDetailLocalData">, resetLineItemsCategoryClassInLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, transaction: SupportedTransaction, lineIdsForReplace: string[], lineIdsForUpdateAll: string[], replace: "class" | "account" | "both", updateAll?: boolean | undefined], {
|
|
75
75
|
transactionId: TransactionID;
|
|
76
76
|
transaction: SupportedTransaction;
|
|
77
77
|
lineIdsForReplace: string[];
|
|
78
78
|
lineIdsForUpdateAll: string[];
|
|
79
|
-
replace: "
|
|
79
|
+
replace: "class" | "account" | "both";
|
|
80
80
|
updateAll: boolean | undefined;
|
|
81
81
|
}, "transactionDetail/resetLineItemsCategoryClassInLocalData", never, never>, setAllLineItemsToCategoryClassInLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, transaction: SupportedTransaction, isUpdateAll: boolean, chosenAccount?: {
|
|
82
82
|
account: AccountBase;
|