@zeniai/client-epic-state 4.9.63 → 4.9.65
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/scheduleView/scheduleDetailView/scheduleDetailSelector.js +1 -1
- package/lib/view/scheduleView/scheduleListView/scheduleListHelper.js +2 -1
- package/lib/view/spendManagement/billPay/editBillView/editBillViewReducer.d.ts +2 -2
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchVendorAndUpdateBillLocalDataEpic.js +22 -13
- package/package.json +1 -1
|
@@ -42,7 +42,7 @@ const getScheduleDetailsView = (state, scheduleType) => {
|
|
|
42
42
|
const scheduleDetailAccountIds = (0, accountSelector_1.getAccountIdsForTypes)(accountState, scheduleDetailAccountTypes);
|
|
43
43
|
const allAccountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, accountTypes.accountListKey);
|
|
44
44
|
const filteredAccounts = allAccountList.accounts.filter((account) => scheduleDetailAccountIds.includes(account.accountId));
|
|
45
|
-
const depreciationCategoryIds = (0, accountSelector_1.getAccountIdsForTypes)(accountState, ['fixed_assets'] // This will always be for fixed assets list
|
|
45
|
+
const depreciationCategoryIds = (0, accountSelector_1.getAccountIdsForTypes)(accountState, ['fixed_assets', 'other_assets'] // This will always be for fixed assets list
|
|
46
46
|
);
|
|
47
47
|
const accountLabel = (0, scheduleListHelper_1.getAccountLabelForScheduleType)('fixed_assets');
|
|
48
48
|
const fixedAssetLabelAccountIds = accountLabel != null
|
|
@@ -229,7 +229,7 @@ const getAccountsTypesForScheduleList = (scheduleType) => {
|
|
|
229
229
|
case 'fixed_assets':
|
|
230
230
|
return {
|
|
231
231
|
accountListKey: 'schedulesAccountList',
|
|
232
|
-
allowedAccountList: ['fixed_assets'],
|
|
232
|
+
allowedAccountList: ['fixed_assets', 'other_assets'],
|
|
233
233
|
};
|
|
234
234
|
default:
|
|
235
235
|
return {
|
|
@@ -263,6 +263,7 @@ const getAccountsTypesForScheduleEpics = () => {
|
|
|
263
263
|
'cogs',
|
|
264
264
|
'expenses',
|
|
265
265
|
'other_expense',
|
|
266
|
+
'other_assets',
|
|
266
267
|
],
|
|
267
268
|
};
|
|
268
269
|
};
|
|
@@ -65,8 +65,8 @@ export declare const fetchEditBillDetailPage: import("@reduxjs/toolkit").ActionC
|
|
|
65
65
|
amountPayload: AmountPayload;
|
|
66
66
|
conversionRate: number;
|
|
67
67
|
billId?: string | undefined;
|
|
68
|
-
}, string>, fetchVendorAndUpdateBillLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId
|
|
69
|
-
vendorId: string;
|
|
68
|
+
}, string>, fetchVendorAndUpdateBillLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId?: string | undefined, billId?: string | undefined], {
|
|
69
|
+
vendorId: string | undefined;
|
|
70
70
|
billId: string | undefined;
|
|
71
71
|
}, string, never, never>, waitForVendorByIdThenSaveBillUpdatetoLocalStore: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorId: string, billId?: string | undefined], {
|
|
72
72
|
vendorId: string;
|
package/lib/view/spendManagement/billPay/editBillView/epics/fetchVendorAndUpdateBillLocalDataEpic.js
CHANGED
|
@@ -18,22 +18,31 @@ const fetchVendorAndUpdateBillLocalDataEpic = (actions$, state$) => actions$.pip
|
|
|
18
18
|
const fetchActions = [];
|
|
19
19
|
const { vendorId } = action.payload;
|
|
20
20
|
const state = state$.value;
|
|
21
|
-
const vendor = (0, vendorSelector_1.getVendorByVendorId)(state.vendorState, vendorId);
|
|
22
21
|
let billInLocalStore = state.editBillDetailViewState.newBillState;
|
|
23
22
|
if (action.payload.billId != null) {
|
|
24
23
|
const billDetailKey = (0, billDetailViewState_1.getBillTransactionDetailKey)(action.payload.billId);
|
|
25
24
|
billInLocalStore =
|
|
26
25
|
state.editBillDetailViewState.editBillStateById[billDetailKey];
|
|
27
26
|
}
|
|
28
|
-
if (
|
|
27
|
+
if (vendorId != null) {
|
|
28
|
+
const vendor = (0, vendorSelector_1.getVendorByVendorId)(state.vendorState, vendorId);
|
|
29
|
+
if (vendor != null) {
|
|
30
|
+
fetchActions.push((0, editBillViewReducer_1.saveBillUpdatesToLocalStore)({
|
|
31
|
+
billDetailLocalData: prepareBillLocalData(state, billInLocalStore, vendor),
|
|
32
|
+
billId: action.payload.billId,
|
|
33
|
+
}));
|
|
34
|
+
fetchActions.push((0, previousBillsReducer_1.fetchPreviousBills)(vendor.qboId, false));
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
fetchActions.push((0, vendorViewReducer_1.fetchVendor)(vendorId), (0, editBillViewReducer_1.waitForVendorByIdThenSaveBillUpdatetoLocalStore)(vendorId, action.payload.billId));
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
else {
|
|
41
|
+
// when tentative vendor is selected from the vendor dropdown, then vendor_id is undefined
|
|
29
42
|
fetchActions.push((0, editBillViewReducer_1.saveBillUpdatesToLocalStore)({
|
|
30
|
-
billDetailLocalData: prepareBillLocalData(state, billInLocalStore
|
|
43
|
+
billDetailLocalData: prepareBillLocalData(state, billInLocalStore),
|
|
31
44
|
billId: action.payload.billId,
|
|
32
45
|
}));
|
|
33
|
-
fetchActions.push((0, previousBillsReducer_1.fetchPreviousBills)(vendor.qboId, false));
|
|
34
|
-
}
|
|
35
|
-
else {
|
|
36
|
-
fetchActions.push((0, vendorViewReducer_1.fetchVendor)(vendorId), (0, editBillViewReducer_1.waitForVendorByIdThenSaveBillUpdatetoLocalStore)(vendorId, action.payload.billId));
|
|
37
46
|
}
|
|
38
47
|
return (0, rxjs_1.from)(fetchActions);
|
|
39
48
|
}));
|
|
@@ -67,17 +76,17 @@ function prepareBillLocalData(state, billInLocalStore, vendor) {
|
|
|
67
76
|
const isCancelled = billInLocalStore.billDetailLocalData.isCancelled;
|
|
68
77
|
const lines = billInLocalStore.billDetailLocalData.updatesByLineId;
|
|
69
78
|
const updatedLines = Object.assign({}, lines);
|
|
70
|
-
const vendorCategory = vendor.accountId != null
|
|
79
|
+
const vendorCategory = (vendor === null || vendor === void 0 ? void 0 : vendor.accountId) != null
|
|
71
80
|
? (0, accountSelector_1.getAccountBase)(state.accountState, vendor.accountId, 'account_list')
|
|
72
81
|
: undefined;
|
|
73
|
-
const vendorClass = vendor.classId != null
|
|
82
|
+
const vendorClass = (vendor === null || vendor === void 0 ? void 0 : vendor.classId) != null
|
|
74
83
|
? (0, classSelector_1.getClassById)(state.classState, {
|
|
75
84
|
classId: vendor.classId,
|
|
76
85
|
reportId: 'class_list',
|
|
77
86
|
})
|
|
78
87
|
: undefined;
|
|
79
|
-
const vendorCurrencyCode = vendor.vendorCurrencyCode;
|
|
80
|
-
const vendorCurrencySymbol = vendor.vendorCurrencySymbol;
|
|
88
|
+
const vendorCurrencyCode = vendor === null || vendor === void 0 ? void 0 : vendor.vendorCurrencyCode;
|
|
89
|
+
const vendorCurrencySymbol = vendor === null || vendor === void 0 ? void 0 : vendor.vendorCurrencySymbol;
|
|
81
90
|
const { tenantState, companyState } = state;
|
|
82
91
|
const { currentTenantId } = tenantState;
|
|
83
92
|
const companyId = currentTenantId != null
|
|
@@ -101,8 +110,8 @@ function prepareBillLocalData(state, billInLocalStore, vendor) {
|
|
|
101
110
|
if (Object.keys(updatedLines).length === 0) {
|
|
102
111
|
updatedLines['1'] = Object.assign({ account: vendorCategory, class: vendorClass, amount: {
|
|
103
112
|
amount: 0,
|
|
104
|
-
currencyCode: vendorCurrencyCode,
|
|
105
|
-
currencySymbol: vendorCurrencySymbol,
|
|
113
|
+
currencyCode: vendorCurrencyCode !== null && vendorCurrencyCode !== void 0 ? vendorCurrencyCode : 'USD',
|
|
114
|
+
currencySymbol: vendorCurrencySymbol !== null && vendorCurrencySymbol !== void 0 ? vendorCurrencySymbol : '$',
|
|
106
115
|
}, id: '1', lineDescription: '', platformLineDetailType: 'account_based_expense_line_detail', type: 'transaction_with_account_and_class_line', billable: 'not_billable', isCategoryMiscategorized: false, isClassMiscategorized: false }, editBillViewState_1.defaultRecommendationStateObj);
|
|
107
116
|
}
|
|
108
117
|
return {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "4.9.
|
|
3
|
+
"version": "4.9.65",
|
|
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",
|