@zeniai/client-epic-state 4.17.17 → 4.17.19
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.
|
@@ -7,6 +7,7 @@ const transactionDetailLocalDataHelper_2 = require("../../transactionDetail/tran
|
|
|
7
7
|
const transactionsViewState_1 = require("../types/transactionsViewState");
|
|
8
8
|
exports.MAX_SELECTION_LIMIT = 5;
|
|
9
9
|
const toTransactionDetailLocalData = (transaction, selectedTab, lineItemsByTransactionIds, uncategorizedIncomeExpense) => {
|
|
10
|
+
var _a, _b, _c;
|
|
10
11
|
const transactionLocal = Object.assign({}, transactionsViewState_1.initialSupportedTransactionCategorization.transactionReviewLocalData);
|
|
11
12
|
transactionLocal.memo = transaction.memo;
|
|
12
13
|
transactionLocal.transactionDate = transaction.date;
|
|
@@ -54,7 +55,30 @@ const toTransactionDetailLocalData = (transaction, selectedTab, lineItemsByTrans
|
|
|
54
55
|
};
|
|
55
56
|
}
|
|
56
57
|
else {
|
|
57
|
-
|
|
58
|
+
const firstLine = (_a = transaction.lines) === null || _a === void 0 ? void 0 : _a[0];
|
|
59
|
+
const recommendations = (firstLine === null || firstLine === void 0 ? void 0 : firstLine.id) != null
|
|
60
|
+
? (_b = transaction.recommendations) === null || _b === void 0 ? void 0 : _b[firstLine === null || firstLine === void 0 ? void 0 : firstLine.id]
|
|
61
|
+
: undefined;
|
|
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 && Boolean(vendor.id)) {
|
|
64
|
+
const vendorId = vendor.id;
|
|
65
|
+
transactionLocal.selectedEntity = {
|
|
66
|
+
id: vendorId,
|
|
67
|
+
name: vendor.name,
|
|
68
|
+
type: 'vendor',
|
|
69
|
+
qboId: vendorId,
|
|
70
|
+
zeniId: vendorId,
|
|
71
|
+
logo: vendor.logo,
|
|
72
|
+
};
|
|
73
|
+
transactionLocal.vendor = {
|
|
74
|
+
id: vendorId,
|
|
75
|
+
name: vendor.name,
|
|
76
|
+
logo: vendor.logo,
|
|
77
|
+
};
|
|
78
|
+
}
|
|
79
|
+
else {
|
|
80
|
+
transactionLocal.selectedEntity = undefined;
|
|
81
|
+
}
|
|
58
82
|
}
|
|
59
83
|
}
|
|
60
84
|
transactionLocal.vendorUpdates = undefined;
|
|
@@ -96,14 +120,13 @@ const buildLineItemById = (transaction, uncategorizedIncomeExpense, recommendati
|
|
|
96
120
|
logo: accountLine.vendor.logo,
|
|
97
121
|
}
|
|
98
122
|
: undefined;
|
|
123
|
+
const customer = accountLine.customer;
|
|
99
124
|
record.customer =
|
|
100
|
-
|
|
101
|
-
Boolean(accountLine.customer.id) === true &&
|
|
102
|
-
Boolean(accountLine.customer.name) === true
|
|
125
|
+
customer != null && Boolean(customer.id) && Boolean(customer.name)
|
|
103
126
|
? {
|
|
104
|
-
id:
|
|
105
|
-
name:
|
|
106
|
-
logo:
|
|
127
|
+
id: customer.id,
|
|
128
|
+
name: customer.name,
|
|
129
|
+
logo: customer.logo,
|
|
107
130
|
}
|
|
108
131
|
: undefined;
|
|
109
132
|
record.selectedEntityLine =
|
|
@@ -141,18 +164,20 @@ const buildLineItemById = (transaction, uncategorizedIncomeExpense, recommendati
|
|
|
141
164
|
(higherPreferenceRecommendation === null || higherPreferenceRecommendation === void 0 ? void 0 : higherPreferenceRecommendation.class) != null) {
|
|
142
165
|
record.class = (_e = higherPreferenceRecommendation === null || higherPreferenceRecommendation === void 0 ? void 0 : higherPreferenceRecommendation.class) !== null && _e !== void 0 ? _e : record.class;
|
|
143
166
|
}
|
|
144
|
-
if (record.selectedEntityLine == null
|
|
167
|
+
if (record.selectedEntityLine == null ||
|
|
168
|
+
record.selectedEntityLine.qboId === '') {
|
|
145
169
|
const vendor = higherPreferenceRecommendation === null || higherPreferenceRecommendation === void 0 ? void 0 : higherPreferenceRecommendation.vendor;
|
|
146
|
-
if (vendor != null && vendor.id
|
|
147
|
-
const
|
|
148
|
-
|
|
170
|
+
if (vendor != null && Boolean(vendor.id)) {
|
|
171
|
+
const vendorId = vendor.id;
|
|
172
|
+
const { name, logo } = vendor;
|
|
173
|
+
record.vendor = { id: vendorId, name, logo };
|
|
149
174
|
record.selectedEntityLine = {
|
|
150
|
-
id,
|
|
175
|
+
id: vendorId,
|
|
151
176
|
name,
|
|
152
177
|
logo,
|
|
153
178
|
type: 'vendor',
|
|
154
|
-
qboId:
|
|
155
|
-
zeniId:
|
|
179
|
+
qboId: vendorId,
|
|
180
|
+
zeniId: vendorId,
|
|
156
181
|
};
|
|
157
182
|
}
|
|
158
183
|
}
|
|
@@ -361,30 +386,20 @@ const checkIfAllLineItemsAreCategoryClassFilled = (transaction, transactionDetai
|
|
|
361
386
|
const lineItems = Object.values(transactionDetailLocalData.lineItemById);
|
|
362
387
|
const isVendorTransactionAvailable = (0, vendorTransaction_1.isVendorTransaction)(transaction);
|
|
363
388
|
return lineItems.every((lineItem) => {
|
|
364
|
-
var _a, _b, _c;
|
|
365
|
-
return lineItem.account
|
|
366
|
-
Boolean(lineItem.
|
|
367
|
-
lineItem.
|
|
368
|
-
Boolean(lineItem.class.qboId) === true &&
|
|
369
|
-
!(((_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 &&
|
|
370
393
|
[
|
|
371
|
-
(
|
|
372
|
-
(
|
|
394
|
+
(_d = uncategorizedAccounts.expense) === null || _d === void 0 ? void 0 : _d.qboId,
|
|
395
|
+
(_e = uncategorizedAccounts.income) === null || _e === void 0 ? void 0 : _e.qboId,
|
|
373
396
|
].includes(lineItem.account.qboId)) &&
|
|
374
397
|
((isVendorTransactionAvailable
|
|
375
|
-
? transactionDetailLocalData.vendor
|
|
376
|
-
|
|
377
|
-
Boolean(transactionDetailLocalData.vendor.id) === true
|
|
378
|
-
: lineItem.vendor != null &&
|
|
379
|
-
lineItem.vendor.id != null &&
|
|
380
|
-
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)) ||
|
|
381
400
|
(isVendorTransactionAvailable
|
|
382
|
-
? transactionDetailLocalData.customer
|
|
383
|
-
|
|
384
|
-
Boolean(transactionDetailLocalData.customer.id) === true
|
|
385
|
-
: lineItem.customer != null &&
|
|
386
|
-
lineItem.customer.id != null &&
|
|
387
|
-
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)));
|
|
388
403
|
});
|
|
389
404
|
};
|
|
390
405
|
exports.checkIfAllLineItemsAreCategoryClassFilled = checkIfAllLineItemsAreCategoryClassFilled;
|
|
@@ -14,6 +14,7 @@ const getTransferDetail = (state) => {
|
|
|
14
14
|
const transferMoneyPartiesFetchState = (0, reduceFetchState_1.reduceAllFetchState)([
|
|
15
15
|
depositAccountsView,
|
|
16
16
|
paymentAccountsView,
|
|
17
|
+
...Object.values(paymentAccountListState.paymentAccountBalanceFetchStatus),
|
|
17
18
|
]).fetchState;
|
|
18
19
|
if (depositAccountsView.fetchState === 'Completed' &&
|
|
19
20
|
paymentAccountsView.fetchState === 'Completed') {
|
|
@@ -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
|
|
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
|
|
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
|
|
33
|
-
customerName
|
|
34
|
-
|
|
32
|
+
Boolean(customerId) &&
|
|
33
|
+
Boolean(customerName)) {
|
|
34
|
+
const id = customerId;
|
|
35
35
|
transactionLocal.selectedEntity = {
|
|
36
|
-
id:
|
|
36
|
+
id: id,
|
|
37
37
|
name: customerName,
|
|
38
38
|
type: (0, entity_1.toEntityType)('customer'),
|
|
39
|
-
qboId:
|
|
40
|
-
zeniId:
|
|
39
|
+
qboId: id,
|
|
40
|
+
zeniId: id,
|
|
41
41
|
};
|
|
42
42
|
}
|
|
43
43
|
else if ((0, vendorTransaction_1.isVendorTransaction)(transaction) === true &&
|
|
44
|
-
vendorId
|
|
45
|
-
vendorName
|
|
46
|
-
|
|
44
|
+
Boolean(vendorId) &&
|
|
45
|
+
Boolean(vendorName)) {
|
|
46
|
+
const id = vendorId;
|
|
47
47
|
transactionLocal.selectedEntity = {
|
|
48
|
-
id:
|
|
48
|
+
id: id,
|
|
49
49
|
name: vendorName,
|
|
50
50
|
type: (0, entity_1.toEntityType)('vendor'),
|
|
51
|
-
qboId:
|
|
52
|
-
zeniId:
|
|
51
|
+
qboId: id,
|
|
52
|
+
zeniId: id,
|
|
53
53
|
};
|
|
54
54
|
}
|
|
55
55
|
else {
|
|
56
56
|
transactionLocal.selectedEntity = undefined;
|
|
57
57
|
}
|
|
58
|
-
|
|
59
|
-
(
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
63
|
-
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
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.
|
|
3
|
+
"version": "4.17.19",
|
|
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",
|