@zeniai/client-epic-state 4.17.14 → 4.17.15

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.
@@ -60,17 +60,18 @@ const toTransactionDetailLocalData = (transaction, selectedTab, lineItemsByTrans
60
60
  ? (_b = transaction.recommendations) === 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
- if (vendor != null && vendor.id != null && vendor.id !== '') {
63
+ if (vendor != null && Boolean(vendor.id)) {
64
+ const vendorId = vendor.id;
64
65
  transactionLocal.selectedEntity = {
65
- id: vendor.id,
66
+ id: vendorId,
66
67
  name: vendor.name,
67
68
  type: 'vendor',
68
- qboId: vendor.id,
69
- zeniId: vendor.id,
69
+ qboId: vendorId,
70
+ zeniId: vendorId,
70
71
  logo: vendor.logo,
71
72
  };
72
73
  transactionLocal.vendor = {
73
- id: vendor.id,
74
+ id: vendorId,
74
75
  name: vendor.name,
75
76
  logo: vendor.logo,
76
77
  };
@@ -119,14 +120,13 @@ const buildLineItemById = (transaction, uncategorizedIncomeExpense, recommendati
119
120
  logo: accountLine.vendor.logo,
120
121
  }
121
122
  : undefined;
123
+ const customer = accountLine.customer;
122
124
  record.customer =
123
- accountLine.customer != null &&
124
- Boolean(accountLine.customer.id) === true &&
125
- Boolean(accountLine.customer.name) === true
125
+ customer != null && Boolean(customer.id) && Boolean(customer.name)
126
126
  ? {
127
- id: accountLine.customer.id,
128
- name: accountLine.customer.name,
129
- logo: accountLine.customer.logo,
127
+ id: customer.id,
128
+ name: customer.name,
129
+ logo: customer.logo,
130
130
  }
131
131
  : undefined;
132
132
  record.selectedEntityLine =
@@ -167,16 +167,17 @@ const buildLineItemById = (transaction, uncategorizedIncomeExpense, recommendati
167
167
  if (record.selectedEntityLine == null ||
168
168
  record.selectedEntityLine.qboId === '') {
169
169
  const vendor = higherPreferenceRecommendation === null || higherPreferenceRecommendation === void 0 ? void 0 : higherPreferenceRecommendation.vendor;
170
- if (vendor != null && vendor.id != null && vendor.id !== '') {
171
- const { id, name, logo } = vendor;
172
- record.vendor = { id, name, logo };
170
+ if (vendor != null && Boolean(vendor.id)) {
171
+ const vendorId = vendor.id;
172
+ const { name, logo } = vendor;
173
+ record.vendor = { id: vendorId, name, logo };
173
174
  record.selectedEntityLine = {
174
- id,
175
+ id: vendorId,
175
176
  name,
176
177
  logo,
177
178
  type: 'vendor',
178
- qboId: id,
179
- zeniId: id,
179
+ qboId: vendorId,
180
+ zeniId: vendorId,
180
181
  };
181
182
  }
182
183
  }
@@ -385,30 +386,20 @@ const checkIfAllLineItemsAreCategoryClassFilled = (transaction, transactionDetai
385
386
  const lineItems = Object.values(transactionDetailLocalData.lineItemById);
386
387
  const isVendorTransactionAvailable = (0, vendorTransaction_1.isVendorTransaction)(transaction);
387
388
  return lineItems.every((lineItem) => {
388
- var _a, _b, _c;
389
- return lineItem.account != null &&
390
- Boolean(lineItem.account.qboId) === true &&
391
- lineItem.class != null &&
392
- Boolean(lineItem.class.qboId) === true &&
393
- !(((_a = lineItem.account) === null || _a === void 0 ? void 0 : _a.qboId) != null &&
389
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j;
390
+ return Boolean((_a = lineItem === null || lineItem === void 0 ? void 0 : lineItem.account) === null || _a === void 0 ? void 0 : _a.qboId) &&
391
+ Boolean((_b = lineItem === null || lineItem === void 0 ? void 0 : lineItem.class) === null || _b === void 0 ? void 0 : _b.qboId) &&
392
+ !(((_c = lineItem.account) === null || _c === void 0 ? void 0 : _c.qboId) != null &&
394
393
  [
395
- (_b = uncategorizedAccounts.expense) === null || _b === void 0 ? void 0 : _b.qboId,
396
- (_c = uncategorizedAccounts.income) === null || _c === void 0 ? void 0 : _c.qboId,
394
+ (_d = uncategorizedAccounts.expense) === null || _d === void 0 ? void 0 : _d.qboId,
395
+ (_e = uncategorizedAccounts.income) === null || _e === void 0 ? void 0 : _e.qboId,
397
396
  ].includes(lineItem.account.qboId)) &&
398
397
  ((isVendorTransactionAvailable
399
- ? transactionDetailLocalData.vendor != null &&
400
- transactionDetailLocalData.vendor.id != null &&
401
- Boolean(transactionDetailLocalData.vendor.id) === true
402
- : lineItem.vendor != null &&
403
- lineItem.vendor.id != null &&
404
- Boolean(lineItem.vendor.id) === true) ||
398
+ ? Boolean((_f = transactionDetailLocalData === null || transactionDetailLocalData === void 0 ? void 0 : transactionDetailLocalData.vendor) === null || _f === void 0 ? void 0 : _f.id)
399
+ : Boolean((_g = lineItem === null || lineItem === void 0 ? void 0 : lineItem.vendor) === null || _g === void 0 ? void 0 : _g.id)) ||
405
400
  (isVendorTransactionAvailable
406
- ? transactionDetailLocalData.customer != null &&
407
- transactionDetailLocalData.customer.id != null &&
408
- Boolean(transactionDetailLocalData.customer.id) === true
409
- : lineItem.customer != null &&
410
- lineItem.customer.id != null &&
411
- Boolean(lineItem.customer.id) === true));
401
+ ? Boolean((_h = transactionDetailLocalData === null || transactionDetailLocalData === void 0 ? void 0 : transactionDetailLocalData.customer) === null || _h === void 0 ? void 0 : _h.id)
402
+ : Boolean((_j = lineItem === null || lineItem === void 0 ? void 0 : lineItem.customer) === null || _j === void 0 ? void 0 : _j.id)));
412
403
  });
413
404
  };
414
405
  exports.checkIfAllLineItemsAreCategoryClassFilled = checkIfAllLineItemsAreCategoryClassFilled;
@@ -6,7 +6,7 @@ const customerTransaction_1 = require("../../entity/transaction/stateTypes/custo
6
6
  const vendorTransaction_1 = require("../../entity/transaction/stateTypes/vendorTransaction");
7
7
  const transactionDetailState_1 = require("./transactionDetailState");
8
8
  const toTransactionDetailLocalData = (transaction, vendorId, uncategorizedIncomeExpense) => {
9
- var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r;
9
+ var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
10
10
  const transactionLocal = Object.assign({}, transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData);
11
11
  const customerId = (_a = transaction.customer) === null || _a === void 0 ? void 0 : _a.id;
12
12
  transactionLocal.memo = transaction.memo;
@@ -19,7 +19,7 @@ const toTransactionDetailLocalData = (transaction, vendorId, uncategorizedIncome
19
19
  }
20
20
  : undefined;
21
21
  transactionLocal.customerUpdates =
22
- (0, vendorTransaction_1.isVendorTransactionWithCustomer)(transaction) && customerId != null
22
+ (0, vendorTransaction_1.isVendorTransactionWithCustomer)(transaction) && Boolean(customerId)
23
23
  ? {
24
24
  id: customerId,
25
25
  name: (_f = (_e = transaction.customer) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : '',
@@ -29,54 +29,58 @@ const toTransactionDetailLocalData = (transaction, vendorId, uncategorizedIncome
29
29
  const vendorName = (_k = (_j = transaction.vendor) === null || _j === void 0 ? void 0 : _j.name) !== null && _k !== void 0 ? _k : '';
30
30
  const customerName = (_m = (_l = transaction.customer) === null || _l === void 0 ? void 0 : _l.name) !== null && _m !== void 0 ? _m : '';
31
31
  if ((0, vendorTransaction_1.isVendorTransactionWithCustomer)(transaction) === true &&
32
- customerId != null &&
33
- customerName != null &&
34
- Boolean(customerName) === true) {
32
+ Boolean(customerId) &&
33
+ Boolean(customerName)) {
34
+ const id = customerId;
35
35
  transactionLocal.selectedEntity = {
36
- id: customerId,
36
+ id: id,
37
37
  name: customerName,
38
38
  type: (0, entity_1.toEntityType)('customer'),
39
- qboId: customerId,
40
- zeniId: customerId,
39
+ qboId: id,
40
+ zeniId: id,
41
41
  };
42
42
  }
43
43
  else if ((0, vendorTransaction_1.isVendorTransaction)(transaction) === true &&
44
- vendorId != null &&
45
- vendorName &&
46
- Boolean(vendorName) === true) {
44
+ Boolean(vendorId) &&
45
+ Boolean(vendorName)) {
46
+ const id = vendorId;
47
47
  transactionLocal.selectedEntity = {
48
- id: vendorId,
48
+ id: id,
49
49
  name: vendorName,
50
50
  type: (0, entity_1.toEntityType)('vendor'),
51
- qboId: (_p = (_o = transaction.vendor) === null || _o === void 0 ? void 0 : _o.id) !== null && _p !== void 0 ? _p : '',
52
- zeniId: (_r = (_q = transaction.vendor) === null || _q === void 0 ? void 0 : _q.id) !== null && _r !== void 0 ? _r : '',
51
+ qboId: id,
52
+ zeniId: id,
53
53
  };
54
54
  }
55
55
  else {
56
56
  transactionLocal.selectedEntity = undefined;
57
57
  }
58
- transactionLocal.vendorDetails =
59
- (0, vendorTransaction_1.isVendorTransaction)(transaction) &&
60
- vendorId != null &&
61
- vendorName != null &&
62
- Boolean(vendorName) === true
63
- ? {
64
- id: vendorId,
65
- qboId: vendorId,
66
- name: vendorName,
67
- }
68
- : undefined;
69
- transactionLocal.customerDetails =
70
- (0, vendorTransaction_1.isVendorTransactionWithCustomer)(transaction) &&
71
- customerId != null &&
72
- customerName != null &&
73
- Boolean(customerName) === true
74
- ? {
75
- id: customerId,
76
- qboId: customerId,
77
- name: customerName,
78
- }
79
- : undefined;
58
+ if ((0, vendorTransaction_1.isVendorTransaction)(transaction) &&
59
+ Boolean(vendorId) &&
60
+ Boolean(vendorName)) {
61
+ const id = vendorId;
62
+ transactionLocal.vendorDetails = {
63
+ id: id,
64
+ qboId: id,
65
+ name: vendorName,
66
+ };
67
+ }
68
+ else {
69
+ transactionLocal.vendorDetails = undefined;
70
+ }
71
+ if ((0, vendorTransaction_1.isVendorTransactionWithCustomer)(transaction) &&
72
+ Boolean(customerId) &&
73
+ Boolean(customerName)) {
74
+ const id = customerId;
75
+ transactionLocal.customerDetails = {
76
+ id: id,
77
+ qboId: id,
78
+ name: customerName,
79
+ };
80
+ }
81
+ else {
82
+ transactionLocal.customerDetails = undefined;
83
+ }
80
84
  transactionLocal.lineItemById =
81
85
  transaction.lines != null && transaction.lines.length > 0
82
86
  ? buildLineItemById(transaction, uncategorizedIncomeExpense, transaction.recommendations)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.17.14",
3
+ "version": "4.17.15",
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",