@zeniai/client-epic-state 4.16.72 → 4.16.73

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.
@@ -77,7 +77,7 @@ const buildLineItemById = (transaction, recommendations) => {
77
77
  const lineItemData = {};
78
78
  const { lines } = transaction;
79
79
  lines === null || lines === void 0 ? void 0 : lines.forEach((line) => {
80
- var _a, _b;
80
+ var _a, _b, _c, _d, _e;
81
81
  if (line.type === 'transaction_with_account_and_class_line' ||
82
82
  line.type === 'transaction_with_product_or_service_line' ||
83
83
  line.type === 'journal_entry_transaction_line') {
@@ -128,6 +128,32 @@ const buildLineItemById = (transaction, recommendations) => {
128
128
  record.reviewPendingReasons = accountLine.reviewPendingReasons;
129
129
  if (recommendations != null) {
130
130
  record.recommendations = recommendations[lineId];
131
+ const higherPreferenceRecommendation = (_c = recommendations[lineId]) === null || _c === void 0 ? void 0 : _c[0];
132
+ if (accountLine.account.accountId === '' ||
133
+ (accountLine.account.accountId == null &&
134
+ (higherPreferenceRecommendation === null || higherPreferenceRecommendation === void 0 ? void 0 : higherPreferenceRecommendation.account) != null)) {
135
+ record.account =
136
+ (_d = higherPreferenceRecommendation === null || higherPreferenceRecommendation === void 0 ? void 0 : higherPreferenceRecommendation.account) !== null && _d !== void 0 ? _d : record.account;
137
+ }
138
+ if (accountLine.class.classId === '' &&
139
+ (higherPreferenceRecommendation === null || higherPreferenceRecommendation === void 0 ? void 0 : higherPreferenceRecommendation.class) != null) {
140
+ record.class = (_e = higherPreferenceRecommendation === null || higherPreferenceRecommendation === void 0 ? void 0 : higherPreferenceRecommendation.class) !== null && _e !== void 0 ? _e : record.class;
141
+ }
142
+ if (record.selectedEntityLine == null) {
143
+ const vendor = higherPreferenceRecommendation === null || higherPreferenceRecommendation === void 0 ? void 0 : higherPreferenceRecommendation.vendor;
144
+ if (vendor != null && vendor.id != null) {
145
+ const { id, name, logo } = vendor;
146
+ record.vendor = { id, name, logo };
147
+ record.selectedEntityLine = {
148
+ id,
149
+ name,
150
+ logo,
151
+ type: 'vendor',
152
+ qboId: id,
153
+ zeniId: id,
154
+ };
155
+ }
156
+ }
131
157
  }
132
158
  lineItemData[line.id] = record;
133
159
  if (line.platformLineDetailType === 'deposit_line_detail') {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.16.72",
3
+ "version": "4.16.73",
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",