@zeniai/client-epic-state 4.17.1 → 4.17.2

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.
@@ -290,6 +290,7 @@ const setEntityRecommendationForLineIdInLocalData = (draft, transaction, transac
290
290
  if (transaction.lines != null) {
291
291
  // always preserving the order of the line items. hence iterating over this
292
292
  transaction.lines.forEach((line) => {
293
+ var _a, _b, _c, _d;
293
294
  const lineId = line.id;
294
295
  const oldRecord = transactionDetailLocalData.lineItemById[lineId];
295
296
  // check if any line already has this entity
@@ -300,8 +301,15 @@ const setEntityRecommendationForLineIdInLocalData = (draft, transaction, transac
300
301
  const record = Object.assign({}, oldRecord);
301
302
  const recommendations = (0, transactionDetailLocalDataHelper_1.mergeTransactionAndEntityRecommendations)(oldRecord.recommendations, recommendationByLineId === null || recommendationByLineId === void 0 ? void 0 : recommendationByLineId[lineId]);
302
303
  const accountLine = line;
303
- record.account = accountLine.account;
304
- record.class = accountLine.class;
304
+ const isUncategorizedAccount = (0, transactionDetailLocalDataHelper_2.isAccountUncategorized)(uncategorizedAccounts, accountLine.account.qboId);
305
+ record.account =
306
+ isUncategorizedAccount === false && accountLine.account.qboId !== ''
307
+ ? accountLine.account
308
+ : ((_b = (_a = recommendations === null || recommendations === void 0 ? void 0 : recommendations[0]) === null || _a === void 0 ? void 0 : _a.account) !== null && _b !== void 0 ? _b : accountLine.account);
309
+ record.class =
310
+ accountLine.class.classId !== ''
311
+ ? accountLine.class
312
+ : ((_d = (_c = recommendations === null || recommendations === void 0 ? void 0 : recommendations[0]) === null || _c === void 0 ? void 0 : _c.class) !== null && _d !== void 0 ? _d : accountLine.class);
305
313
  if (checkIfNotJEAndDeposit === true) {
306
314
  if (entity.type === 'customer') {
307
315
  record.customer = toLineCustomerOrVendor(entity);
@@ -342,6 +350,9 @@ const setEntityRecommendationForLineIdInLocalData = (draft, transaction, transac
342
350
  if (!(0, exports.checkIfAllLineItemsAreCategoryClassFilled)(transaction, newLocalData, uncategorizedAccounts)) {
343
351
  selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds.filter((id) => id !== transaction.id);
344
352
  }
353
+ else if (selectedCheckBoxTransactionIds.includes(transaction.id) === false) {
354
+ selectedCheckBoxTransactionIds.push(transaction.id);
355
+ }
345
356
  draft.selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds;
346
357
  return newLocalData;
347
358
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.17.1",
3
+ "version": "4.17.2",
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",