@zeniai/client-epic-state 4.13.74 → 4.13.75
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +26 -8
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +8 -2
- package/package.json +1 -1
package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts
CHANGED
|
@@ -10,5 +10,5 @@ export declare const INCOME_QBOID = "30";
|
|
|
10
10
|
export declare const EXPENSE_QBOID = "31";
|
|
11
11
|
export declare const toTransactionDetailLocalData: (transaction: SupportedTransaction) => TransactionReviewLocalData;
|
|
12
12
|
export declare const toSetAllLineItemsToCategoryClass: (draft: TransactionsTabViewState, transaction: SupportedTransaction, transactionId: ID, transactionLineId: ID, transactionDetailLocalData: TransactionReviewLocalData, vendorId?: string | undefined, selectedAccount?: AccountBase | undefined, selectedClassBase?: ClassBase | undefined) => TransactionReviewLocalData;
|
|
13
|
-
export declare const setEntityRecommendationForLineIdInLocalData: (transaction: SupportedTransaction, transactionDetailLocalData: TransactionReviewLocalData, entity: Entity, recommendationLineIds: ID[], recommendationByLineId?: RecommendationByLineId | undefined) => TransactionReviewLocalData;
|
|
13
|
+
export declare const setEntityRecommendationForLineIdInLocalData: (draft: TransactionsTabViewState, transaction: SupportedTransaction, transactionDetailLocalData: TransactionReviewLocalData, entity: Entity, recommendationLineIds: ID[], recommendationByLineId?: RecommendationByLineId | undefined) => TransactionReviewLocalData;
|
|
14
14
|
export declare const checkIfAllLineItemsAreCategoryClassFilled: (transaction: SupportedTransaction, transactionDetailLocalData: TransactionReviewLocalData) => boolean;
|
|
@@ -102,8 +102,12 @@ const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, tra
|
|
|
102
102
|
// if the line is the one that is being updated, then set the account and class
|
|
103
103
|
if (transactionId === record.transactionId &&
|
|
104
104
|
transactionLineId === lineId) {
|
|
105
|
-
|
|
106
|
-
|
|
105
|
+
if (selectedAccount != null) {
|
|
106
|
+
record.account = selectedAccount;
|
|
107
|
+
}
|
|
108
|
+
if (selectedClassBase != null) {
|
|
109
|
+
record.class = selectedClassBase;
|
|
110
|
+
}
|
|
107
111
|
if (record.class != null && record.account != null) {
|
|
108
112
|
if (selectedCheckBoxTransactionIds.length < exports.MAX_SELECTION_LIMIT &&
|
|
109
113
|
selectedCheckBoxTransactionIds.includes(transaction.id) === false) {
|
|
@@ -122,9 +126,10 @@ const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, tra
|
|
|
122
126
|
transactionDetailLocalData.vendor.id === vendorId) ||
|
|
123
127
|
(record.vendor != null && record.vendor.id === vendorId)) {
|
|
124
128
|
// if the vendor is same, then set the account and class with the selected ones and add the transaction to the selected list
|
|
125
|
-
if (
|
|
126
|
-
((
|
|
127
|
-
|
|
129
|
+
if (selectedAccount != null &&
|
|
130
|
+
(((_a = record.account) === null || _a === void 0 ? void 0 : _a.qboId) == null ||
|
|
131
|
+
((_b = record.account) === null || _b === void 0 ? void 0 : _b.qboId) === exports.EXPENSE_QBOID ||
|
|
132
|
+
((_c = record.account) === null || _c === void 0 ? void 0 : _c.qboId) === exports.INCOME_QBOID)) {
|
|
128
133
|
record.account = selectedAccount;
|
|
129
134
|
if (record.class != null &&
|
|
130
135
|
selectedCheckBoxTransactionIds.length < exports.MAX_SELECTION_LIMIT &&
|
|
@@ -133,7 +138,7 @@ const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, tra
|
|
|
133
138
|
selectedCheckBoxTransactionIds.push(transaction.id);
|
|
134
139
|
}
|
|
135
140
|
}
|
|
136
|
-
if (((_d = record.class) === null || _d === void 0 ? void 0 : _d.qboId) == null) {
|
|
141
|
+
if (selectedClassBase != null && ((_d = record.class) === null || _d === void 0 ? void 0 : _d.qboId) == null) {
|
|
137
142
|
record.class = selectedClassBase;
|
|
138
143
|
if (record.account != null &&
|
|
139
144
|
selectedCheckBoxTransactionIds.length < exports.MAX_SELECTION_LIMIT &&
|
|
@@ -171,10 +176,11 @@ const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, tra
|
|
|
171
176
|
return newLocalData;
|
|
172
177
|
};
|
|
173
178
|
exports.toSetAllLineItemsToCategoryClass = toSetAllLineItemsToCategoryClass;
|
|
174
|
-
const setEntityRecommendationForLineIdInLocalData = (transaction, transactionDetailLocalData, entity, recommendationLineIds, recommendationByLineId) => {
|
|
179
|
+
const setEntityRecommendationForLineIdInLocalData = (draft, transaction, transactionDetailLocalData, entity, recommendationLineIds, recommendationByLineId) => {
|
|
175
180
|
const newLineItems = {};
|
|
176
181
|
let matchingEntityLineId = undefined;
|
|
177
182
|
const checkIfNotJEAndDeposit = !(0, vendorTransaction_1.isVendorTransaction)(transaction);
|
|
183
|
+
let selectedCheckBoxTransactionIds = draft.selectedCheckBoxTransactionIds;
|
|
178
184
|
if (transaction.lines != null) {
|
|
179
185
|
// always preserving the order of the line items. hence iterating over this
|
|
180
186
|
transaction.lines.forEach((line) => {
|
|
@@ -207,7 +213,15 @@ const setEntityRecommendationForLineIdInLocalData = (transaction, transactionDet
|
|
|
207
213
|
if ((0, transactionDetailLocalDataHelper_1.isEntityMatching)(entity, oldRecord)) {
|
|
208
214
|
matchingEntityLineId = lineId;
|
|
209
215
|
}
|
|
210
|
-
|
|
216
|
+
const record = Object.assign({}, oldRecord);
|
|
217
|
+
if (checkIfNotJEAndDeposit === false) {
|
|
218
|
+
const recommendations = (0, transactionDetailLocalDataHelper_1.mergeTransactionAndEntityRecommendations)(oldRecord.recommendations, recommendationByLineId === null || recommendationByLineId === void 0 ? void 0 : recommendationByLineId[lineId]);
|
|
219
|
+
const accountLine = line;
|
|
220
|
+
record.account = accountLine.account;
|
|
221
|
+
record.class = accountLine.class;
|
|
222
|
+
record.recommendations = recommendations;
|
|
223
|
+
}
|
|
224
|
+
newLineItems[lineId] = record;
|
|
211
225
|
}
|
|
212
226
|
});
|
|
213
227
|
}
|
|
@@ -219,6 +233,10 @@ const setEntityRecommendationForLineIdInLocalData = (transaction, transactionDet
|
|
|
219
233
|
newLineItems[matchingEntityLineId] = Object.assign(Object.assign({}, newLineItem), { class: matchingRecord.class, account: matchingRecord.account, lineEntity: matchingRecord.lineEntity });
|
|
220
234
|
}
|
|
221
235
|
const newLocalData = Object.assign(Object.assign({}, transactionsViewState_1.initialSupportedTransactionCategorization.transactionReviewLocalData), { memo: transactionDetailLocalData.memo, lineItemById: newLineItems, transactionDate: transactionDetailLocalData.transactionDate, transactionType: transactionDetailLocalData.transactionType, transactionTypeName: transactionDetailLocalData.transactionTypeName, vendorUpdates: transactionDetailLocalData.vendorUpdates, vendorDetails: transactionDetailLocalData.vendorDetails, vendor: transactionDetailLocalData.vendor });
|
|
236
|
+
if (!(0, exports.checkIfAllLineItemsAreCategoryClassFilled)(transaction, newLocalData)) {
|
|
237
|
+
selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds.filter((id) => id !== transaction.id);
|
|
238
|
+
}
|
|
239
|
+
draft.selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds;
|
|
222
240
|
return newLocalData;
|
|
223
241
|
};
|
|
224
242
|
exports.setEntityRecommendationForLineIdInLocalData = setEntityRecommendationForLineIdInLocalData;
|
|
@@ -219,7 +219,13 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
219
219
|
const { vendorId, selectedAccount, selectedClassBase, transactions, transactionId, lineId, selectedTab, } = action.payload;
|
|
220
220
|
const transactionLocalData = (0, get_1.default)(draft[selectedTab].transactionReviewLocalDataById, transactionId, undefined);
|
|
221
221
|
if (transactionLocalData != null) {
|
|
222
|
-
const newTransactionLocalData = Object.assign(Object.assign({}, transactionLocalData.transactionReviewLocalData), { lineItemById: Object.assign(Object.assign({}, transactionLocalData.transactionReviewLocalData.lineItemById), { [lineId]: Object.assign(Object.assign({}, transactionLocalData.transactionReviewLocalData.lineItemById[lineId]), { account: selectedAccount
|
|
222
|
+
const newTransactionLocalData = Object.assign(Object.assign({}, transactionLocalData.transactionReviewLocalData), { lineItemById: Object.assign(Object.assign({}, transactionLocalData.transactionReviewLocalData.lineItemById), { [lineId]: Object.assign(Object.assign({}, transactionLocalData.transactionReviewLocalData.lineItemById[lineId]), { account: selectedAccount != null
|
|
223
|
+
? selectedAccount
|
|
224
|
+
: transactionLocalData.transactionReviewLocalData
|
|
225
|
+
.lineItemById[lineId].account, class: selectedClassBase != null
|
|
226
|
+
? selectedClassBase
|
|
227
|
+
: transactionLocalData.transactionReviewLocalData
|
|
228
|
+
.lineItemById[lineId].class }) }) });
|
|
223
229
|
draft[selectedTab].transactionReviewLocalDataById[transactionId] = {
|
|
224
230
|
transactionReviewLocalData: newTransactionLocalData,
|
|
225
231
|
transactionId,
|
|
@@ -284,7 +290,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
284
290
|
if (transactionLocalData != null) {
|
|
285
291
|
draft[selectedTab].transactionReviewLocalDataById[transaction.id] = {
|
|
286
292
|
transactionId: transaction.id,
|
|
287
|
-
transactionReviewLocalData: (0, transactionCategorizationLocalDataHelper_1.setEntityRecommendationForLineIdInLocalData)(transaction, transactionLocalData.transactionReviewLocalData, entity, lineIds, action.payload.recommendationByLineId),
|
|
293
|
+
transactionReviewLocalData: (0, transactionCategorizationLocalDataHelper_1.setEntityRecommendationForLineIdInLocalData)(draft[selectedTab], transaction, transactionLocalData.transactionReviewLocalData, entity, lineIds, action.payload.recommendationByLineId),
|
|
288
294
|
};
|
|
289
295
|
}
|
|
290
296
|
},
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.13.
|
|
3
|
+
"version": "4.13.75",
|
|
4
4
|
"description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
|
|
5
5
|
"main": "lib/index.js",
|
|
6
6
|
"types": "lib/index.d.ts",
|