@zeniai/client-epic-state 5.1.59 → 5.1.60
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/esm/view/commonVendorView/transactionVendorView/epics/saveTransactionVendorEpic.js +0 -1
- package/lib/esm/view/commonVendorView/transactionVendorView/transactionVendorViewReducer.js +1 -2
- package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -3
- package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +2 -3
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/backgroundRefetchReviewTabEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +1 -1
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +4 -4
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/initializeTransactionCategorizationLocalDataEpic.js +2 -4
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscategorizedEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/saveTransactionCategorizationEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/triggerReviewTabRefetchEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/expenseAutomationViewReducer.js +3 -4
- package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +14 -25
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +21 -32
- package/lib/esm/view/recommendation/fetchEntityRecommendationsByTransactionIdEpic.js +2 -2
- package/lib/esm/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.js +2 -2
- package/lib/esm/view/recommendation/recommendationReducer.js +1 -2
- package/lib/esm/view/transactionDetail/epics/saveTransactionDetailEpic.js +2 -2
- package/lib/esm/view/transactionDetail/epics/updateTransactionDetailEpic.js +2 -2
- package/lib/esm/view/transactionDetail/transactionDetailReducer.js +1 -2
- package/lib/view/commonVendorView/transactionVendorView/epics/saveTransactionVendorEpic.js +0 -1
- package/lib/view/commonVendorView/transactionVendorView/transactionVendorViewReducer.d.ts +1 -2
- package/lib/view/commonVendorView/transactionVendorView/transactionVendorViewReducer.js +1 -2
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +3 -3
- package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +2 -3
- package/lib/view/expenseAutomationView/epics/transactionCategorization/backgroundRefetchReviewTabEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +1 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationViewEpic.js +4 -4
- package/lib/view/expenseAutomationView/epics/transactionCategorization/initializeTransactionCategorizationLocalDataEpic.js +2 -4
- package/lib/view/expenseAutomationView/epics/transactionCategorization/markTransactionAsNotMiscategorizedEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/saveTransactionCategorizationEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/triggerReviewTabRefetchEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +2 -2
- package/lib/view/expenseAutomationView/expenseAutomationViewReducer.d.ts +2 -5
- package/lib/view/expenseAutomationView/expenseAutomationViewReducer.js +3 -4
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +5 -5
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +14 -25
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +10 -23
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +21 -32
- package/lib/view/recommendation/fetchEntityRecommendationsByTransactionIdEpic.js +2 -2
- package/lib/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.js +2 -2
- package/lib/view/recommendation/recommendationReducer.d.ts +1 -3
- package/lib/view/recommendation/recommendationReducer.js +1 -2
- package/lib/view/transactionDetail/epics/saveTransactionDetailEpic.js +2 -2
- package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +2 -2
- package/lib/view/transactionDetail/transactionDetailReducer.d.ts +1 -3
- package/lib/view/transactionDetail/transactionDetailReducer.js +1 -2
- package/package.json +1 -1
package/lib/esm/view/commonVendorView/transactionVendorView/epics/saveTransactionVendorEpic.js
CHANGED
|
@@ -107,7 +107,6 @@ export const saveTransactionVendorEpic = (actions$, state$, zeniAPI) => actions$
|
|
|
107
107
|
transactionId: action.payload.transactionId,
|
|
108
108
|
isExpenseAutomationEnabled: action.payload.isExpenseAutomationEnabled,
|
|
109
109
|
cotTransactionTracking: [], // We don't need to pass COT tracking for vendor save
|
|
110
|
-
isUncategorizedExpenseCategoryEnabled: action.payload.isUncategorizedExpenseCategoryEnabled,
|
|
111
110
|
}));
|
|
112
111
|
}
|
|
113
112
|
return from(actions);
|
|
@@ -44,14 +44,13 @@ const transactionVendorView = createSlice({
|
|
|
44
44
|
draft.newVendorState.saveStatus.error = undefined;
|
|
45
45
|
}
|
|
46
46
|
},
|
|
47
|
-
prepare(transactionId, vendorId, saveTransaction, isExpenseAutomationEnabled = false
|
|
47
|
+
prepare(transactionId, vendorId, saveTransaction, isExpenseAutomationEnabled = false) {
|
|
48
48
|
return {
|
|
49
49
|
payload: {
|
|
50
50
|
vendorId,
|
|
51
51
|
transactionId,
|
|
52
52
|
saveTransaction,
|
|
53
53
|
isExpenseAutomationEnabled,
|
|
54
|
-
isUncategorizedExpenseCategoryEnabled,
|
|
55
54
|
},
|
|
56
55
|
};
|
|
57
56
|
},
|
package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js
CHANGED
|
@@ -9,7 +9,7 @@ import { fetchMissingReceipts } from '../../reducers/missingReceiptsViewReducer'
|
|
|
9
9
|
import { fetchReconciliation } from '../../reducers/reconciliationViewReducer';
|
|
10
10
|
import { fetchTransactionCategorizationView } from '../../reducers/transactionsViewReducer';
|
|
11
11
|
export const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe(filter(fetchAllExpenseAutomationTabs.match), switchMap((action) => {
|
|
12
|
-
const { cacheOverride, refreshViewInBackground,
|
|
12
|
+
const { cacheOverride, refreshViewInBackground, } = action.payload;
|
|
13
13
|
const state = state$.value;
|
|
14
14
|
const { monthEndCloseChecksState } = state;
|
|
15
15
|
const { monthEndCloseChecksByTenantId } = monthEndCloseChecksState;
|
|
@@ -30,7 +30,7 @@ export const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.
|
|
|
30
30
|
}
|
|
31
31
|
if (cacheOverride === true) {
|
|
32
32
|
const actions = [];
|
|
33
|
-
actions.push(fetchTransactionCategorizationView(selectedTransactionCategorizationTab, { start: timePeriodStart, end: timePeriodEnd }, cacheOverride, false, undefined, undefined, refreshViewInBackground, false
|
|
33
|
+
actions.push(fetchTransactionCategorizationView(selectedTransactionCategorizationTab, { start: timePeriodStart, end: timePeriodEnd }, cacheOverride, false, undefined, undefined, refreshViewInBackground, false), fetchMissingReceipts({ start: timePeriodStart, end: timePeriodEnd }, {
|
|
34
34
|
amount: 75.0,
|
|
35
35
|
currencyCode: 'USD',
|
|
36
36
|
currencySymbol: '$',
|
|
@@ -83,7 +83,7 @@ export const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.
|
|
|
83
83
|
(state.expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab].hasValidState() === false ||
|
|
84
84
|
state.expenseAutomationTransactionsViewState
|
|
85
85
|
.transactionCategorizationView[selectedTransactionCategorizationTab].transactionIdsBySelectedPeriod[monthYearPeriodId] == null)) {
|
|
86
|
-
fetchActions.push(fetchTransactionCategorizationView(selectedTransactionCategorizationTab, { start: timePeriodStart, end: timePeriodEnd }, cacheOverride, false, undefined, undefined, refreshViewInBackground, false
|
|
86
|
+
fetchActions.push(fetchTransactionCategorizationView(selectedTransactionCategorizationTab, { start: timePeriodStart, end: timePeriodEnd }, cacheOverride, false, undefined, undefined, refreshViewInBackground, false));
|
|
87
87
|
}
|
|
88
88
|
return from(fetchActions);
|
|
89
89
|
}
|
package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js
CHANGED
|
@@ -9,8 +9,7 @@ import { fetchJeSchedulesPage } from '../../reducers/jeSchedulesViewReducer';
|
|
|
9
9
|
import { fetchMissingReceipts } from '../../reducers/missingReceiptsViewReducer';
|
|
10
10
|
import { fetchReconciliation } from '../../reducers/reconciliationViewReducer';
|
|
11
11
|
import { fetchTransactionCategorizationView } from '../../reducers/transactionsViewReducer';
|
|
12
|
-
export const refreshExpenseAutomationCurrentTabEpic = (actions$, state$) => actions$.pipe(filter(refreshExpenseAutomationCurrentTab.match), switchMap((
|
|
13
|
-
const { isUncategorizedExpenseCategoryEnabled } = action.payload;
|
|
12
|
+
export const refreshExpenseAutomationCurrentTabEpic = (actions$, state$) => actions$.pipe(filter(refreshExpenseAutomationCurrentTab.match), switchMap(() => {
|
|
14
13
|
const state = state$.value;
|
|
15
14
|
const currentTenant = getCurrentTenant(state);
|
|
16
15
|
const companyId = currentTenant.companyId;
|
|
@@ -63,7 +62,7 @@ export const refreshExpenseAutomationCurrentTabEpic = (actions$, state$) => acti
|
|
|
63
62
|
case 'transaction_categorization':
|
|
64
63
|
default:
|
|
65
64
|
return from([
|
|
66
|
-
fetchTransactionCategorizationView(selectedTransactionCategorizationTab, { start: timePeriodStart, end: timePeriodEnd }, true, false, undefined, undefined, true, undefined
|
|
65
|
+
fetchTransactionCategorizationView(selectedTransactionCategorizationTab, { start: timePeriodStart, end: timePeriodEnd }, true, false, undefined, undefined, true, undefined),
|
|
67
66
|
]);
|
|
68
67
|
}
|
|
69
68
|
}));
|
|
@@ -10,7 +10,7 @@ import { toTransactionsSortKey } from '../../types/transactionsViewState';
|
|
|
10
10
|
const SELECTED_TAB = 'review';
|
|
11
11
|
const PAGE_SIZE = 25;
|
|
12
12
|
export const backgroundRefetchReviewTabEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(backgroundRefetchReviewTab.match), switchMap((action) => {
|
|
13
|
-
const { period
|
|
13
|
+
const { period } = action.payload;
|
|
14
14
|
const state = state$.value;
|
|
15
15
|
const currentTenant = getCurrentTenant(state);
|
|
16
16
|
const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
|
|
@@ -80,7 +80,7 @@ export const backgroundRefetchReviewTabEpic = (actions$, state$, zeniAPI) => act
|
|
|
80
80
|
pageToken: accumulated.finalPageToken,
|
|
81
81
|
},
|
|
82
82
|
}),
|
|
83
|
-
initializeTransactionCategorizationViewLocalData(SELECTED_TAB, transactionIds, selectedPeriod, false, accumulated.finalPageToken, accumulated.totalCount, lineItemsByTransactionIds, true
|
|
83
|
+
initializeTransactionCategorizationViewLocalData(SELECTED_TAB, transactionIds, selectedPeriod, false, accumulated.finalPageToken, accumulated.totalCount, lineItemsByTransactionIds, true),
|
|
84
84
|
updateTotalCountForTransactionCategorization({
|
|
85
85
|
selectedPeriod,
|
|
86
86
|
selectedTab: SELECTED_TAB,
|
|
@@ -73,7 +73,7 @@ groupBy((action) => action.payload.selectedTab), mergeMap((group$) => group$.pip
|
|
|
73
73
|
pageToken: response.data.next_page_token ?? null,
|
|
74
74
|
},
|
|
75
75
|
}));
|
|
76
|
-
updateActions.push(initializeTransactionCategorizationViewLocalData(selectedTab, transactionIds, selectedPeriod, keepExistingListItems, response.data.next_page_token ?? null, response.data.total_count, lineItemsByTransactionIds, refreshViewInBackground
|
|
76
|
+
updateActions.push(initializeTransactionCategorizationViewLocalData(selectedTab, transactionIds, selectedPeriod, keepExistingListItems, response.data.next_page_token ?? null, response.data.total_count, lineItemsByTransactionIds, refreshViewInBackground));
|
|
77
77
|
updateActions.push(updateTotalCountForTransactionCategorization({
|
|
78
78
|
selectedPeriod,
|
|
79
79
|
selectedTab,
|
|
@@ -9,7 +9,7 @@ import { fetchProjectList } from '../../../projectList/projectListReducer';
|
|
|
9
9
|
import { fetchTransactionCategorization, fetchTransactionCategorizationView, } from '../../reducers/transactionsViewReducer';
|
|
10
10
|
import { TRANSACTIONS_TABS } from '../../types/transactionsViewState';
|
|
11
11
|
export const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pipe(filter(fetchTransactionCategorizationView.match), mergeMap((action) => {
|
|
12
|
-
const { selectedTab, cacheOverride, keepExistingListItems, pageToken, period, refreshViewInBackground, searchString, resetListItems,
|
|
12
|
+
const { selectedTab, cacheOverride, keepExistingListItems, pageToken, period, refreshViewInBackground, searchString, resetListItems, } = action.payload;
|
|
13
13
|
const updateActions = [];
|
|
14
14
|
const { expenseAutomationTransactionsViewState } = state$.value;
|
|
15
15
|
const { fetchState, transactionIdsBySelectedPeriod, uiState } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTab];
|
|
@@ -45,7 +45,7 @@ export const fetchTransactionCategorizationViewEpic = (actions$, state$) => acti
|
|
|
45
45
|
fetchState === 'Not-Started' ||
|
|
46
46
|
transactionIds.length === 0 ||
|
|
47
47
|
uiState.searchString !== '') {
|
|
48
|
-
updateActions.push(fetchTransactionCategorization(selectedTab, period, cacheOverride, keepExistingListItems, searchString, pageToken, refreshViewInBackground, resetListItems
|
|
48
|
+
updateActions.push(fetchTransactionCategorization(selectedTab, period, cacheOverride, keepExistingListItems, searchString, pageToken, refreshViewInBackground, resetListItems));
|
|
49
49
|
}
|
|
50
50
|
// On the initial load of a tab (searchString undefined = non-search fetch),
|
|
51
51
|
// preload every other tab that hasn't been fetched yet for this period.
|
|
@@ -55,7 +55,7 @@ export const fetchTransactionCategorizationViewEpic = (actions$, state$) => acti
|
|
|
55
55
|
TRANSACTIONS_TABS.filter((tab) => tab !== selectedTab).forEach((otherTab) => {
|
|
56
56
|
const otherTabFetchState = expenseAutomationTransactionsViewState.transactionCategorizationView[otherTab].fetchState;
|
|
57
57
|
if (otherTabFetchState === 'Not-Started') {
|
|
58
|
-
updateActions.push(fetchTransactionCategorization(otherTab, period, false, false, undefined, undefined, true, undefined
|
|
58
|
+
updateActions.push(fetchTransactionCategorization(otherTab, period, false, false, undefined, undefined, true, undefined));
|
|
59
59
|
}
|
|
60
60
|
});
|
|
61
61
|
}
|
|
@@ -68,7 +68,7 @@ export const fetchTransactionCategorizationViewEpic = (actions$, state$) => acti
|
|
|
68
68
|
TRANSACTIONS_TABS.filter((tab) => tab !== selectedTab).forEach((otherTab) => {
|
|
69
69
|
const otherTabSearchString = expenseAutomationTransactionsViewState.transactionCategorizationView[otherTab].uiState.searchString;
|
|
70
70
|
if (searchString !== otherTabSearchString) {
|
|
71
|
-
updateActions.push(fetchTransactionCategorization(otherTab, period, true, keepExistingListItems, searchString, undefined, true, true
|
|
71
|
+
updateActions.push(fetchTransactionCategorization(otherTab, period, true, keepExistingListItems, searchString, undefined, true, true));
|
|
72
72
|
}
|
|
73
73
|
});
|
|
74
74
|
}
|
|
@@ -2,12 +2,11 @@ import { from } from 'rxjs';
|
|
|
2
2
|
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
3
|
import { getTransactionWithCOT } from '../../../../entity/transaction/transactionHelper';
|
|
4
4
|
import { getSupportedTransactionsByIds } from '../../../../entity/transaction/transactionSelector';
|
|
5
|
-
import { getUncategorizedAccounts } from '../../../accountList/accountListSelector';
|
|
6
5
|
import { mergeTabSpecificLineItems, toTransactionDetailLocalData, } from '../../helpers/transactionCategorizationLocalDataHelper';
|
|
7
6
|
import { initializeTransactionCategorizationViewLocalData, saveTransactionCategorizationLocalData, } from '../../reducers/transactionsViewReducer';
|
|
8
7
|
import { initialSupportedTransactionCategorization, } from '../../types/transactionsViewState';
|
|
9
8
|
export const initializeTransactionCategorizationViewLocalDataEpic = (actions$, state$) => actions$.pipe(filter(initializeTransactionCategorizationViewLocalData.match), mergeMap((action) => {
|
|
10
|
-
const { transactionIds, selectedPeriod, keepExistingListItems, selectedTab, pageToken, totalCount, lineItemsByTransactionIds, refreshViewInBackground,
|
|
9
|
+
const { transactionIds, selectedPeriod, keepExistingListItems, selectedTab, pageToken, totalCount, lineItemsByTransactionIds, refreshViewInBackground, } = action.payload;
|
|
11
10
|
const fetchActions = [];
|
|
12
11
|
const { transactionState, expenseAutomationTransactionsViewState } = state$.value;
|
|
13
12
|
const { transactionReviewLocalDataById } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTab];
|
|
@@ -15,10 +14,9 @@ export const initializeTransactionCategorizationViewLocalDataEpic = (actions$, s
|
|
|
15
14
|
? { ...transactionReviewLocalDataById }
|
|
16
15
|
: {};
|
|
17
16
|
const transactions = getSupportedTransactionsByIds(transactionState, transactionIds);
|
|
18
|
-
const uncategorizedIncomeExpense = getUncategorizedAccounts(state$.value.accountState, state$.value.accountListState, 'accountList');
|
|
19
17
|
transactions.forEach((transaction) => {
|
|
20
18
|
const transactionWithCOT = getTransactionWithCOT(transaction);
|
|
21
|
-
const newTransactionsLocalData = toTransactionDetailLocalData(transactionWithCOT, selectedTab, lineItemsByTransactionIds[transaction.id]
|
|
19
|
+
const newTransactionsLocalData = toTransactionDetailLocalData(transactionWithCOT, selectedTab, lineItemsByTransactionIds[transaction.id]);
|
|
22
20
|
if (transactionLocalData[transaction.id] == null) {
|
|
23
21
|
transactionLocalData[transaction.id] = {
|
|
24
22
|
...initialSupportedTransactionCategorization,
|
|
@@ -10,7 +10,7 @@ import { getSnackbarMessageForTransactionReview } from '../../helpers/transactio
|
|
|
10
10
|
import { fetchTransactionCategorizationView, markTransactionAsNotMiscategorized, updateStatusForTransactionNotMiscategorizedUpdateForCategorization, updateTotalCountForTransactionCategorization, } from '../../reducers/transactionsViewReducer';
|
|
11
11
|
export const markTransactionAsNotMiscategorizedEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(markTransactionAsNotMiscategorized.match), mergeMap((action) => {
|
|
12
12
|
const { expenseAutomationViewState, expenseAutomationTransactionsViewState, } = state$.value;
|
|
13
|
-
const { transactionsInReview, selectedTab,
|
|
13
|
+
const { transactionsInReview, selectedTab, } = action.payload;
|
|
14
14
|
const transactionsSuccess = transactionsInReview.transactions_update_success;
|
|
15
15
|
const transactionsFailed = transactionsInReview.transactions_update_failed;
|
|
16
16
|
const currentTenant = getCurrentTenant(state$.value);
|
|
@@ -107,7 +107,7 @@ export const markTransactionAsNotMiscategorizedEpic = (actions$, state$, zeniAPI
|
|
|
107
107
|
if (timePeriodStart != null && timePeriodEnd != null) {
|
|
108
108
|
actions.push(fetchTransactionCategorizationView('review', { start: timePeriodStart, end: timePeriodEnd }, true, // cacheOverride = true to force refresh
|
|
109
109
|
false, undefined, undefined, true, // refreshViewInBackground
|
|
110
|
-
false
|
|
110
|
+
false));
|
|
111
111
|
}
|
|
112
112
|
}
|
|
113
113
|
actions.push(updateTotalCountForTransactionCategorization({
|
|
@@ -6,7 +6,7 @@ import { getUncategorizedAccounts } from '../../../accountList/accountListSelect
|
|
|
6
6
|
import { toTransactionUpdatesFromTransactionCategorizationLocalData } from '../../helpers/saveTransactionHelper';
|
|
7
7
|
import { saveTransactionCategorization, updateTransactionCategorization, } from '../../reducers/transactionsViewReducer';
|
|
8
8
|
export const saveTransactionCategorizationEpic = (actions$, state$) => actions$.pipe(filter(saveTransactionCategorization.match), mergeMap((action) => {
|
|
9
|
-
const { transactionIds, cotTrackingByTransactionId, selectedTab,
|
|
9
|
+
const { transactionIds, cotTrackingByTransactionId, selectedTab, } = action.payload;
|
|
10
10
|
const fetchActions = [];
|
|
11
11
|
const { transactionState, expenseAutomationTransactionsViewState } = state$.value;
|
|
12
12
|
const transactionSaveUpdates = [];
|
|
@@ -19,6 +19,6 @@ export const saveTransactionCategorizationEpic = (actions$, state$) => actions$.
|
|
|
19
19
|
transactionSaveUpdates.push(toTransactionUpdatesFromTransactionCategorizationLocalData(localData, transaction, uncategorizedIncomeExpense));
|
|
20
20
|
}
|
|
21
21
|
});
|
|
22
|
-
fetchActions.push(updateTransactionCategorization(selectedTab, transactionIds, transactionSaveUpdates, cotTrackingByTransactionId
|
|
22
|
+
fetchActions.push(updateTransactionCategorization(selectedTab, transactionIds, transactionSaveUpdates, cotTrackingByTransactionId));
|
|
23
23
|
return from(fetchActions);
|
|
24
24
|
}));
|
|
@@ -4,7 +4,7 @@ import { convertToPeriod, toAbsoluteDay, } from '../../../../commonStateTypes/ti
|
|
|
4
4
|
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
5
5
|
import { backgroundRefetchReviewTab, syncTransactionCategorizationFromDetailSave, } from '../../reducers/transactionsViewReducer';
|
|
6
6
|
export const triggerReviewTabRefetchEpic = (actions$, state$) => actions$.pipe(filter(syncTransactionCategorizationFromDetailSave.match), mergeMap((action) => {
|
|
7
|
-
const { pendingReviewLineIds, transactionId,
|
|
7
|
+
const { pendingReviewLineIds, transactionId, } = action.payload;
|
|
8
8
|
if (pendingReviewLineIds.length === 0) {
|
|
9
9
|
return EMPTY;
|
|
10
10
|
}
|
|
@@ -23,5 +23,5 @@ export const triggerReviewTabRefetchEpic = (actions$, state$) => actions$.pipe(f
|
|
|
23
23
|
if (timePeriodStart == null || timePeriodEnd == null) {
|
|
24
24
|
return EMPTY;
|
|
25
25
|
}
|
|
26
|
-
return of(backgroundRefetchReviewTab({ start: timePeriodStart, end: timePeriodEnd }
|
|
26
|
+
return of(backgroundRefetchReviewTab({ start: timePeriodStart, end: timePeriodEnd }));
|
|
27
27
|
}));
|
|
@@ -15,7 +15,7 @@ import { getVendorByVendorId } from '../../../../entity/vendor/vendorSelector';
|
|
|
15
15
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
16
16
|
import { markTransactionAsNotMiscategorized, updateTransactionCategorization, updateTransactionCategorizationSaveStatus, } from '../../reducers/transactionsViewReducer';
|
|
17
17
|
export const updateTransactionCategorizationEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(updateTransactionCategorization.match), mergeMap((action) => {
|
|
18
|
-
const { selectedTab, transactionIds, transactionSaveUpdates, cotTrackingByTransactionId,
|
|
18
|
+
const { selectedTab, transactionIds, transactionSaveUpdates, cotTrackingByTransactionId, } = action.payload;
|
|
19
19
|
const { transactionState, vendorState, expenseAutomationTransactionsViewState, } = state$.value;
|
|
20
20
|
const payloadArray = preparePayload(selectedTab, transactionState, vendorState, expenseAutomationTransactionsViewState, transactionIds, transactionSaveUpdates, cotTrackingByTransactionId).filter((payload) => payload != null);
|
|
21
21
|
return zeniAPI
|
|
@@ -24,7 +24,7 @@ export const updateTransactionCategorizationEpic = (actions$, state$, zeniAPI) =
|
|
|
24
24
|
if (isSuccessResponse(response) && response.data != null) {
|
|
25
25
|
const transactionsInReview = response.data;
|
|
26
26
|
const actions = [];
|
|
27
|
-
actions.push(markTransactionAsNotMiscategorized(selectedTab, transactionsInReview
|
|
27
|
+
actions.push(markTransactionAsNotMiscategorized(selectedTab, transactionsInReview), updateTransactionCategorizationSaveStatus(selectedTab, 'Completed', createZeniAPIStatus('Completed', 'Transaction categorization updated successfully')));
|
|
28
28
|
return from(actions);
|
|
29
29
|
}
|
|
30
30
|
else {
|
|
@@ -18,20 +18,19 @@ const expenseAutomationView = createSlice({
|
|
|
18
18
|
reducer() {
|
|
19
19
|
//do nothing
|
|
20
20
|
},
|
|
21
|
-
prepare(cacheOverride = false, refreshViewInBackground = false
|
|
21
|
+
prepare(cacheOverride = false, refreshViewInBackground = false) {
|
|
22
22
|
return {
|
|
23
23
|
payload: {
|
|
24
24
|
cacheOverride,
|
|
25
25
|
refreshViewInBackground,
|
|
26
|
-
isUncategorizedExpenseCategoryEnabled,
|
|
27
26
|
},
|
|
28
27
|
};
|
|
29
28
|
},
|
|
30
29
|
},
|
|
31
30
|
refreshExpenseAutomationCurrentTab: {
|
|
32
|
-
prepare(
|
|
31
|
+
prepare() {
|
|
33
32
|
return {
|
|
34
|
-
payload: {
|
|
33
|
+
payload: {},
|
|
35
34
|
};
|
|
36
35
|
},
|
|
37
36
|
reducer() {
|
package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js
CHANGED
|
@@ -66,16 +66,16 @@ export const MAX_SELECTION_LIMIT = 5;
|
|
|
66
66
|
// triplet that was inlined at four sites (updateSelectedCustomer/Vendor,
|
|
67
67
|
// setAllItemsToCategoryClassInLocalDataForCategorization, and
|
|
68
68
|
// setEntityRecommendationForLineIdInLocalData below).
|
|
69
|
-
export const shouldAutoSelectAndAdd = (transaction, localData, selectedCheckBoxTransactionIds,
|
|
69
|
+
export const shouldAutoSelectAndAdd = (transaction, localData, selectedCheckBoxTransactionIds, isAccountingClassesEnabled) => {
|
|
70
70
|
if (selectedCheckBoxTransactionIds.includes(transaction.id)) {
|
|
71
71
|
return false;
|
|
72
72
|
}
|
|
73
73
|
if (selectedCheckBoxTransactionIds.length >= MAX_SELECTION_LIMIT) {
|
|
74
74
|
return false;
|
|
75
75
|
}
|
|
76
|
-
return checkIfAllLineItemsAreCategoryClassFilled(transaction, localData,
|
|
76
|
+
return checkIfAllLineItemsAreCategoryClassFilled(transaction, localData, isAccountingClassesEnabled);
|
|
77
77
|
};
|
|
78
|
-
export const toTransactionDetailLocalData = (transaction, selectedTab, lineItemsByTransactionIds
|
|
78
|
+
export const toTransactionDetailLocalData = (transaction, selectedTab, lineItemsByTransactionIds) => {
|
|
79
79
|
const transactionLocal = {
|
|
80
80
|
...initialSupportedTransactionCategorization.transactionReviewLocalData,
|
|
81
81
|
};
|
|
@@ -162,7 +162,7 @@ export const toTransactionDetailLocalData = (transaction, selectedTab, lineItems
|
|
|
162
162
|
}
|
|
163
163
|
transactionLocal.lineItemById =
|
|
164
164
|
transaction.lines != null && transaction.lines.length > 0
|
|
165
|
-
? buildLineItemById(transaction,
|
|
165
|
+
? buildLineItemById(transaction, transaction.recommendationsWithCOT)
|
|
166
166
|
: {};
|
|
167
167
|
transactionLocal.sortedLineItems =
|
|
168
168
|
transaction.lines != null && transaction.lines.length > 0
|
|
@@ -177,7 +177,7 @@ export const toTransactionDetailLocalData = (transaction, selectedTab, lineItems
|
|
|
177
177
|
};
|
|
178
178
|
return transactionLocal;
|
|
179
179
|
};
|
|
180
|
-
const buildLineItemById = (transaction,
|
|
180
|
+
const buildLineItemById = (transaction, recommendations) => {
|
|
181
181
|
const lineItemData = {};
|
|
182
182
|
const { lines } = transaction;
|
|
183
183
|
lines?.forEach((line) => {
|
|
@@ -241,10 +241,7 @@ const buildLineItemById = (transaction, uncategorizedIncomeExpense, recommendati
|
|
|
241
241
|
if (recommendations != null) {
|
|
242
242
|
record.recommendationsWithCOT = recommendations[lineId];
|
|
243
243
|
const higherPreferenceRecommendation = recommendations[lineId]?.[0];
|
|
244
|
-
if (
|
|
245
|
-
isAccountUncategorized(uncategorizedIncomeExpense, accountLine.account.qboId, isUncategorizedExpenseCategoryEnabled === true
|
|
246
|
-
? ['income']
|
|
247
|
-
: undefined)) &&
|
|
244
|
+
if (Boolean(accountLine.account.accountId) === false &&
|
|
248
245
|
higherPreferenceRecommendation?.account != null) {
|
|
249
246
|
record.account = {
|
|
250
247
|
...higherPreferenceRecommendation.account,
|
|
@@ -322,7 +319,7 @@ const buildLineItemById = (transaction, uncategorizedIncomeExpense, recommendati
|
|
|
322
319
|
});
|
|
323
320
|
return lineItemData;
|
|
324
321
|
};
|
|
325
|
-
export const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, transactionLineId, transactionDetailLocalData, updatedItem,
|
|
322
|
+
export const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, transactionLineId, transactionDetailLocalData, updatedItem, selectedTab, vendorId, customerId, selectedAccount, selectedClassBase, selectedProjectBase, isAccountingClassesEnabled) => {
|
|
326
323
|
let newLineItems = {};
|
|
327
324
|
let selectedCheckBoxTransactionIds = draft.selectedCheckBoxTransactionIds;
|
|
328
325
|
let similarTransactionUpdated = false;
|
|
@@ -379,10 +376,7 @@ export const toSetAllLineItemsToCategoryClass = (draft, transaction, transaction
|
|
|
379
376
|
// if the vendor is same, then set the account and class with the selected ones and add the transaction to the selected list
|
|
380
377
|
if (selectedAccount != null &&
|
|
381
378
|
updatedItem === 'category' &&
|
|
382
|
-
|
|
383
|
-
isAccountUncategorized(uncategorizedAccounts, record.account?.qboId, isUncategorizedExpenseCategoryEnabled === true
|
|
384
|
-
? ['income']
|
|
385
|
-
: undefined) === true)) {
|
|
379
|
+
record.account?.qboId == null) {
|
|
386
380
|
record.account = selectedAccount;
|
|
387
381
|
similarTransactionUpdated = true;
|
|
388
382
|
if ((isAccountingClassesEnabled === false ||
|
|
@@ -451,13 +445,13 @@ export const toSetAllLineItemsToCategoryClass = (draft, transaction, transaction
|
|
|
451
445
|
selectedEntity: transactionDetailLocalData.selectedEntity,
|
|
452
446
|
tabSpecificLineItems: transactionDetailLocalData.tabSpecificLineItems,
|
|
453
447
|
};
|
|
454
|
-
if (!checkIfAllLineItemsAreCategoryClassFilled(transaction, newLocalData,
|
|
448
|
+
if (!checkIfAllLineItemsAreCategoryClassFilled(transaction, newLocalData, isAccountingClassesEnabled)) {
|
|
455
449
|
selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds.filter((id) => id !== transaction.id);
|
|
456
450
|
}
|
|
457
451
|
draft.selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds;
|
|
458
452
|
return { localData: newLocalData, similarTransactionUpdated };
|
|
459
453
|
};
|
|
460
|
-
export const setEntityRecommendationForLineIdInLocalData = (draft, transaction, transactionDetailLocalData, entity, recommendationLineIds,
|
|
454
|
+
export const setEntityRecommendationForLineIdInLocalData = (draft, transaction, transactionDetailLocalData, entity, recommendationLineIds, recommendationWithCOTByLineId, isAccountingClassesEnabled) => {
|
|
461
455
|
const newLineItems = {};
|
|
462
456
|
let matchingEntityLineId = undefined;
|
|
463
457
|
const checkIfNotJEAndDeposit = !isVendorTransaction(transaction);
|
|
@@ -477,11 +471,8 @@ export const setEntityRecommendationForLineIdInLocalData = (draft, transaction,
|
|
|
477
471
|
};
|
|
478
472
|
const recommendations = mergeTransactionAndEntityRecommendationsWithCOT(oldRecord.recommendationsWithCOT, recommendationWithCOTByLineId?.[lineId]);
|
|
479
473
|
const accountLine = line;
|
|
480
|
-
const isUncategorizedAccount = isAccountUncategorized(uncategorizedAccounts, accountLine.account.qboId, isUncategorizedExpenseCategoryEnabled === true
|
|
481
|
-
? ['income']
|
|
482
|
-
: undefined);
|
|
483
474
|
record.account =
|
|
484
|
-
|
|
475
|
+
accountLine.account.qboId !== ''
|
|
485
476
|
? accountLine.account
|
|
486
477
|
: recommendations?.[0]?.account
|
|
487
478
|
? {
|
|
@@ -564,23 +555,21 @@ export const setEntityRecommendationForLineIdInLocalData = (draft, transaction,
|
|
|
564
555
|
// category/class became stale after the entity update). Otherwise
|
|
565
556
|
// route through shouldAutoSelectAndAdd so the MAX_SELECTION_LIMIT
|
|
566
557
|
// gate is consistently applied across all auto-add sites.
|
|
567
|
-
if (!checkIfAllLineItemsAreCategoryClassFilled(transaction, newLocalData,
|
|
558
|
+
if (!checkIfAllLineItemsAreCategoryClassFilled(transaction, newLocalData, isAccountingClassesEnabled)) {
|
|
568
559
|
selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds.filter((id) => id !== transaction.id);
|
|
569
560
|
}
|
|
570
|
-
else if (shouldAutoSelectAndAdd(transaction, newLocalData, selectedCheckBoxTransactionIds,
|
|
561
|
+
else if (shouldAutoSelectAndAdd(transaction, newLocalData, selectedCheckBoxTransactionIds, isAccountingClassesEnabled)) {
|
|
571
562
|
selectedCheckBoxTransactionIds.push(transaction.id);
|
|
572
563
|
}
|
|
573
564
|
draft.selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds;
|
|
574
565
|
return newLocalData;
|
|
575
566
|
};
|
|
576
|
-
export const checkIfAllLineItemsAreCategoryClassFilled = (transaction, transactionDetailLocalData,
|
|
567
|
+
export const checkIfAllLineItemsAreCategoryClassFilled = (transaction, transactionDetailLocalData, isAccountingClassesEnabled) => {
|
|
577
568
|
const lineItems = Object.values(transactionDetailLocalData.lineItemById);
|
|
578
569
|
const isVendorTransactionAvailable = isVendorTransaction(transaction);
|
|
579
|
-
const uncategorizedAccountTypes = isUncategorizedExpenseCategoryEnabled === true ? ['income'] : undefined;
|
|
580
570
|
return lineItems.every((lineItem) => Boolean(lineItem?.account?.qboId) &&
|
|
581
571
|
(isAccountingClassesEnabled === false ||
|
|
582
572
|
Boolean(lineItem?.class?.qboId)) &&
|
|
583
|
-
isAccountUncategorized(uncategorizedAccounts, lineItem?.account?.qboId, uncategorizedAccountTypes) === false &&
|
|
584
573
|
((isVendorTransactionAvailable
|
|
585
574
|
? Boolean(transactionDetailLocalData?.vendor?.id)
|
|
586
575
|
: Boolean(lineItem?.vendor?.id)) ||
|