@zeniai/client-epic-state 5.0.55-betaSS1 → 5.0.55-betaSS2
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/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +6 -1
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +10 -1
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +18 -0
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +5 -0
- package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +7 -0
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +5 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +11 -2
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +12 -0
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +18 -0
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +8 -0
- package/package.json +1 -1
|
@@ -5,7 +5,7 @@ import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
|
5
5
|
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
6
6
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
7
7
|
import { getLineItemsByTransactionsIdsFromResponse } from '../../helpers/transactionCategorizationLocalDataHelper';
|
|
8
|
-
import { fetchTransactionCategorization, fetchTransactionCategorizationFailure, fetchTransactionCategorizationSuccess, initializeTransactionCategorizationViewLocalData, resetOtherTabsFetchState, updateTotalCountForTransactionCategorization, updateTransactionCategorizationUIState, } from '../../reducers/transactionsViewReducer';
|
|
8
|
+
import { fetchTransactionCategorization, fetchTransactionCategorizationFailure, fetchTransactionCategorizationSuccess, initializeTransactionCategorizationViewLocalData, resetOtherTabsFetchState, updateParentTotalCountForTab, updateTotalCountForTransactionCategorization, updateTransactionCategorizationUIState, } from '../../reducers/transactionsViewReducer';
|
|
9
9
|
import { TRANSACTIONS_TABS, toTransactionsSortKey, } from '../../types/transactionsViewState';
|
|
10
10
|
export const fetchTransactionCategorizationEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchTransactionCategorization.match), switchMap((action) => {
|
|
11
11
|
const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationTransactionsViewState, } = state$.value;
|
|
@@ -48,6 +48,11 @@ export const fetchTransactionCategorizationEpic = (actions$, state$, zeniAPI) =>
|
|
|
48
48
|
selectedTab,
|
|
49
49
|
totalCount: response.data.total_count,
|
|
50
50
|
}));
|
|
51
|
+
updateActions.push(updateParentTotalCountForTab({
|
|
52
|
+
selectedPeriod,
|
|
53
|
+
selectedTab,
|
|
54
|
+
parentTotalCount: response.data.parent_tab_total_count,
|
|
55
|
+
}));
|
|
51
56
|
updateActions.push(resetOtherTabsFetchState({
|
|
52
57
|
refreshViewInBackground,
|
|
53
58
|
tabs: TRANSACTIONS_TABS.filter((tab) => selectedTab !== tab),
|
|
@@ -42,6 +42,10 @@ export const initialTransactionTabViewState = {
|
|
|
42
42
|
};
|
|
43
43
|
export const initialState = {
|
|
44
44
|
autoCategorizedSubTabCache: {},
|
|
45
|
+
parentTotalCountByTab: {
|
|
46
|
+
review: {},
|
|
47
|
+
autoCategorized: {},
|
|
48
|
+
},
|
|
45
49
|
selectedTransactionCategorizationTab: 'review',
|
|
46
50
|
selectedTransactionCategorizationCompletedSubTab: 'all',
|
|
47
51
|
transactionCategorizationView: {
|
|
@@ -767,6 +771,10 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
767
771
|
const { selectedTab, selectedPeriod, totalCount } = action.payload;
|
|
768
772
|
draft.transactionCategorizationView[selectedTab].uiState.totalCount[toMonthYearPeriodId(selectedPeriod)] = totalCount;
|
|
769
773
|
},
|
|
774
|
+
updateParentTotalCountForTab(draft, action) {
|
|
775
|
+
const { selectedTab, selectedPeriod, parentTotalCount } = action.payload;
|
|
776
|
+
draft.parentTotalCountByTab[selectedTab][toMonthYearPeriodId(selectedPeriod)] = parentTotalCount;
|
|
777
|
+
},
|
|
770
778
|
updateSelectedCheckboxTransactionIds(draft, action) {
|
|
771
779
|
const selectedTab = action.payload.selectedTab;
|
|
772
780
|
const transactionIds = action.payload.transactionIds;
|
|
@@ -777,6 +785,7 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
777
785
|
draft.transactionCategorizationView[selectedTab] = {
|
|
778
786
|
...initialTransactionTabViewState,
|
|
779
787
|
};
|
|
788
|
+
draft.parentTotalCountByTab[selectedTab] = {};
|
|
780
789
|
},
|
|
781
790
|
clearExpenseAutomationTransactionsView(draft) {
|
|
782
791
|
Object.assign(draft, initialState);
|
|
@@ -873,5 +882,5 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
873
882
|
},
|
|
874
883
|
},
|
|
875
884
|
});
|
|
876
|
-
export const { fetchTransactionCategorization, updateTransactionCategorizationUIState, initializeTransactionCategorizationViewLocalData, saveTransactionCategorizationLocalData, fetchTransactionCategorizationFailure, saveTransactionCategorization, updateTransactionCategorization, updateCurrentSelectedTransactionCategorizationTab, updateTransactionCategorizationCompletedSubTab, updateTransactionCategorizationSaveStatus, markTransactionAsNotMiscategorized, updateStatusForTransactionNotMiscategorizedUpdateForCategorization, updateSelectedVendorForTransaction, updateSelectedCustomerForTransaction, setAllItemsToCategoryClassInLocalDataForCategorization, updateTotalCountForTransactionCategorization, fetchTransactionCategorizationSuccess, resetOtherTabsFetchState, fetchTransactionCategorizationView, updateSelectedCheckboxTransactionIds, clearExpenseAutomationTransactionsViewPerTabView, clearExpenseAutomationTransactionsView, setEntityRecommendationForLineIdsForCategorization, updateSelectedTransactionId, syncTransactionCategorizationFromDetailSave, backgroundRefetchReviewTab, updateTransactionCategorizationUploadReceiptState, uploadTransactionCategorizationReceiptSuccess, } = expenseAutomationTransactionsView.actions;
|
|
885
|
+
export const { fetchTransactionCategorization, updateTransactionCategorizationUIState, initializeTransactionCategorizationViewLocalData, saveTransactionCategorizationLocalData, fetchTransactionCategorizationFailure, saveTransactionCategorization, updateTransactionCategorization, updateCurrentSelectedTransactionCategorizationTab, updateTransactionCategorizationCompletedSubTab, updateTransactionCategorizationSaveStatus, markTransactionAsNotMiscategorized, updateStatusForTransactionNotMiscategorizedUpdateForCategorization, updateSelectedVendorForTransaction, updateSelectedCustomerForTransaction, setAllItemsToCategoryClassInLocalDataForCategorization, updateTotalCountForTransactionCategorization, updateParentTotalCountForTab, fetchTransactionCategorizationSuccess, resetOtherTabsFetchState, fetchTransactionCategorizationView, updateSelectedCheckboxTransactionIds, clearExpenseAutomationTransactionsViewPerTabView, clearExpenseAutomationTransactionsView, setEntityRecommendationForLineIdsForCategorization, updateSelectedTransactionId, syncTransactionCategorizationFromDetailSave, backgroundRefetchReviewTab, updateTransactionCategorizationUploadReceiptState, uploadTransactionCategorizationReceiptSuccess, } = expenseAutomationTransactionsView.actions;
|
|
877
886
|
export default expenseAutomationTransactionsView.reducer;
|
|
@@ -63,10 +63,27 @@ export function getExpenseAutomationTransactionView(state) {
|
|
|
63
63
|
.uiState.totalCount;
|
|
64
64
|
const totalCountByAutoCat = expenseAutomationTransactionsViewState.transactionCategorizationView
|
|
65
65
|
.autoCategorized.uiState.totalCount;
|
|
66
|
+
// Per-(sub-)tab counts powering pagination, in-list "showing X of Y", and
|
|
67
|
+
// any save/refresh round-trips. Sourced from `uiState.totalCount` which
|
|
68
|
+
// mirrors the response's `total_count` for whatever tab/sub-tab the user is
|
|
69
|
+
// viewing (e.g. only the Manual sub-tab rows for Completed → Manual).
|
|
66
70
|
const totalCountByTab = {
|
|
67
71
|
review: monthYearPeriodId != null ? totalCountByReview[monthYearPeriodId] : 0,
|
|
68
72
|
autoCategorized: monthYearPeriodId != null ? totalCountByAutoCat[monthYearPeriodId] : 0,
|
|
69
73
|
};
|
|
74
|
+
// Parent-tab badge counts. Sourced from `parent_tab_total_count` in the
|
|
75
|
+
// listing response and used exclusively by the navbar / tab strip badges.
|
|
76
|
+
// Independent of which Completed sub-tab is active so the badge stays
|
|
77
|
+
// stable across sub-tab switches.
|
|
78
|
+
const parentTotalCountByTab = expenseAutomationTransactionsViewState.parentTotalCountByTab;
|
|
79
|
+
const parentTabTotalCountByTab = {
|
|
80
|
+
review: monthYearPeriodId != null
|
|
81
|
+
? (parentTotalCountByTab.review[monthYearPeriodId] ?? 0)
|
|
82
|
+
: 0,
|
|
83
|
+
autoCategorized: monthYearPeriodId != null
|
|
84
|
+
? (parentTotalCountByTab.autoCategorized[monthYearPeriodId] ?? 0)
|
|
85
|
+
: 0,
|
|
86
|
+
};
|
|
70
87
|
const fetchStateByTab = {
|
|
71
88
|
review: {
|
|
72
89
|
fetchState: expenseAutomationTransactionsViewState.transactionCategorizationView
|
|
@@ -108,6 +125,7 @@ export function getExpenseAutomationTransactionView(state) {
|
|
|
108
125
|
markAsNotMiscategorizedStatus,
|
|
109
126
|
completionStatus,
|
|
110
127
|
totalCountByTab,
|
|
128
|
+
parentTabTotalCountByTab,
|
|
111
129
|
fetchStateByTransactionTabs: fetchStateByTab,
|
|
112
130
|
uploadReceiptStatusById,
|
|
113
131
|
selectedTransactionId,
|
|
@@ -3,6 +3,6 @@ import { Observable } from 'rxjs';
|
|
|
3
3
|
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
4
4
|
import { RootState } from '../../../../reducer';
|
|
5
5
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
|
-
import { fetchTransactionCategorization, fetchTransactionCategorizationFailure, fetchTransactionCategorizationSuccess, initializeTransactionCategorizationViewLocalData, resetOtherTabsFetchState, updateTotalCountForTransactionCategorization, updateTransactionCategorizationUIState } from '../../reducers/transactionsViewReducer';
|
|
7
|
-
export type ActionType = ReturnType<typeof fetchTransactionCategorization> | ReturnType<typeof updateTransactions> | ReturnType<typeof initializeTransactionCategorizationViewLocalData> | ReturnType<typeof fetchTransactionCategorizationFailure> | ReturnType<typeof updateTransactionCategorizationUIState> | ReturnType<typeof updateTotalCountForTransactionCategorization> | ReturnType<typeof fetchTransactionCategorizationSuccess> | ReturnType<typeof resetOtherTabsFetchState>;
|
|
6
|
+
import { fetchTransactionCategorization, fetchTransactionCategorizationFailure, fetchTransactionCategorizationSuccess, initializeTransactionCategorizationViewLocalData, resetOtherTabsFetchState, updateParentTotalCountForTab, updateTotalCountForTransactionCategorization, updateTransactionCategorizationUIState } from '../../reducers/transactionsViewReducer';
|
|
7
|
+
export type ActionType = ReturnType<typeof fetchTransactionCategorization> | ReturnType<typeof updateTransactions> | ReturnType<typeof initializeTransactionCategorizationViewLocalData> | ReturnType<typeof fetchTransactionCategorizationFailure> | ReturnType<typeof updateTransactionCategorizationUIState> | ReturnType<typeof updateTotalCountForTransactionCategorization> | ReturnType<typeof updateParentTotalCountForTab> | ReturnType<typeof fetchTransactionCategorizationSuccess> | ReturnType<typeof resetOtherTabsFetchState>;
|
|
8
8
|
export declare const fetchTransactionCategorizationEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -51,6 +51,11 @@ const fetchTransactionCategorizationEpic = (actions$, state$, zeniAPI) => action
|
|
|
51
51
|
selectedTab,
|
|
52
52
|
totalCount: response.data.total_count,
|
|
53
53
|
}));
|
|
54
|
+
updateActions.push((0, transactionsViewReducer_1.updateParentTotalCountForTab)({
|
|
55
|
+
selectedPeriod,
|
|
56
|
+
selectedTab,
|
|
57
|
+
parentTotalCount: response.data.parent_tab_total_count,
|
|
58
|
+
}));
|
|
54
59
|
updateActions.push((0, transactionsViewReducer_1.resetOtherTabsFetchState)({
|
|
55
60
|
refreshViewInBackground,
|
|
56
61
|
tabs: transactionsViewState_1.TRANSACTIONS_TABS.filter((tab) => selectedTab !== tab),
|
|
@@ -22,6 +22,13 @@ export interface TransactionCategorizationQueryPayload {
|
|
|
22
22
|
}
|
|
23
23
|
export interface TransactionCategorizationPayload {
|
|
24
24
|
next_page_token: string | null;
|
|
25
|
+
/**
|
|
26
|
+
* Count of transactions for the entire parent tab (Review or Completed),
|
|
27
|
+
* regardless of which sub-tab the listing was scoped to. Used solely to
|
|
28
|
+
* drive the parent tab badge counts on the UI; pagination, list-level
|
|
29
|
+
* counts, and sub-tab chips continue to consume {@link total_count}.
|
|
30
|
+
*/
|
|
31
|
+
parent_tab_total_count: number;
|
|
25
32
|
query: TransactionCategorizationQueryPayload;
|
|
26
33
|
total_count: number;
|
|
27
34
|
transactions: SupportedTransactionPayload[];
|
|
@@ -122,7 +122,11 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
122
122
|
selectedPeriod: MonthYearPeriod;
|
|
123
123
|
selectedTab: TransactionsTab;
|
|
124
124
|
totalCount: number;
|
|
125
|
-
}, "expenseAutomationTransactionsView/updateTotalCountForTransactionCategorization">,
|
|
125
|
+
}, "expenseAutomationTransactionsView/updateTotalCountForTransactionCategorization">, updateParentTotalCountForTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
126
|
+
parentTotalCount: number;
|
|
127
|
+
selectedPeriod: MonthYearPeriod;
|
|
128
|
+
selectedTab: TransactionsTab;
|
|
129
|
+
}, "expenseAutomationTransactionsView/updateParentTotalCountForTab">, fetchTransactionCategorizationSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
126
130
|
selectedTab: TransactionsTab;
|
|
127
131
|
status: ZeniAPIStatus;
|
|
128
132
|
refreshViewInBackground?: boolean;
|
|
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.uploadTransactionCategorizationReceiptSuccess = exports.updateTransactionCategorizationUploadReceiptState = exports.backgroundRefetchReviewTab = exports.syncTransactionCategorizationFromDetailSave = exports.updateSelectedTransactionId = exports.setEntityRecommendationForLineIdsForCategorization = exports.clearExpenseAutomationTransactionsView = exports.clearExpenseAutomationTransactionsViewPerTabView = exports.updateSelectedCheckboxTransactionIds = exports.fetchTransactionCategorizationView = exports.resetOtherTabsFetchState = exports.fetchTransactionCategorizationSuccess = exports.updateTotalCountForTransactionCategorization = exports.setAllItemsToCategoryClassInLocalDataForCategorization = exports.updateSelectedCustomerForTransaction = exports.updateSelectedVendorForTransaction = exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = exports.markTransactionAsNotMiscategorized = exports.updateTransactionCategorizationSaveStatus = exports.updateTransactionCategorizationCompletedSubTab = exports.updateCurrentSelectedTransactionCategorizationTab = exports.updateTransactionCategorization = exports.saveTransactionCategorization = exports.fetchTransactionCategorizationFailure = exports.saveTransactionCategorizationLocalData = exports.initializeTransactionCategorizationViewLocalData = exports.updateTransactionCategorizationUIState = exports.fetchTransactionCategorization = exports.initialState = exports.initialTransactionTabViewState = void 0;
|
|
7
|
+
exports.uploadTransactionCategorizationReceiptSuccess = exports.updateTransactionCategorizationUploadReceiptState = exports.backgroundRefetchReviewTab = exports.syncTransactionCategorizationFromDetailSave = exports.updateSelectedTransactionId = exports.setEntityRecommendationForLineIdsForCategorization = exports.clearExpenseAutomationTransactionsView = exports.clearExpenseAutomationTransactionsViewPerTabView = exports.updateSelectedCheckboxTransactionIds = exports.fetchTransactionCategorizationView = exports.resetOtherTabsFetchState = exports.fetchTransactionCategorizationSuccess = exports.updateParentTotalCountForTab = exports.updateTotalCountForTransactionCategorization = exports.setAllItemsToCategoryClassInLocalDataForCategorization = exports.updateSelectedCustomerForTransaction = exports.updateSelectedVendorForTransaction = exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = exports.markTransactionAsNotMiscategorized = exports.updateTransactionCategorizationSaveStatus = exports.updateTransactionCategorizationCompletedSubTab = exports.updateCurrentSelectedTransactionCategorizationTab = exports.updateTransactionCategorization = exports.saveTransactionCategorization = exports.fetchTransactionCategorizationFailure = exports.saveTransactionCategorizationLocalData = exports.initializeTransactionCategorizationViewLocalData = exports.updateTransactionCategorizationUIState = exports.fetchTransactionCategorization = exports.initialState = exports.initialTransactionTabViewState = void 0;
|
|
8
8
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
9
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
10
10
|
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
@@ -49,6 +49,10 @@ exports.initialTransactionTabViewState = {
|
|
|
49
49
|
};
|
|
50
50
|
exports.initialState = {
|
|
51
51
|
autoCategorizedSubTabCache: {},
|
|
52
|
+
parentTotalCountByTab: {
|
|
53
|
+
review: {},
|
|
54
|
+
autoCategorized: {},
|
|
55
|
+
},
|
|
52
56
|
selectedTransactionCategorizationTab: 'review',
|
|
53
57
|
selectedTransactionCategorizationCompletedSubTab: 'all',
|
|
54
58
|
transactionCategorizationView: {
|
|
@@ -774,6 +778,10 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
774
778
|
const { selectedTab, selectedPeriod, totalCount } = action.payload;
|
|
775
779
|
draft.transactionCategorizationView[selectedTab].uiState.totalCount[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = totalCount;
|
|
776
780
|
},
|
|
781
|
+
updateParentTotalCountForTab(draft, action) {
|
|
782
|
+
const { selectedTab, selectedPeriod, parentTotalCount } = action.payload;
|
|
783
|
+
draft.parentTotalCountByTab[selectedTab][(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = parentTotalCount;
|
|
784
|
+
},
|
|
777
785
|
updateSelectedCheckboxTransactionIds(draft, action) {
|
|
778
786
|
const selectedTab = action.payload.selectedTab;
|
|
779
787
|
const transactionIds = action.payload.transactionIds;
|
|
@@ -784,6 +792,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
784
792
|
draft.transactionCategorizationView[selectedTab] = {
|
|
785
793
|
...exports.initialTransactionTabViewState,
|
|
786
794
|
};
|
|
795
|
+
draft.parentTotalCountByTab[selectedTab] = {};
|
|
787
796
|
},
|
|
788
797
|
clearExpenseAutomationTransactionsView(draft) {
|
|
789
798
|
Object.assign(draft, exports.initialState);
|
|
@@ -880,5 +889,5 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
880
889
|
},
|
|
881
890
|
},
|
|
882
891
|
});
|
|
883
|
-
_a = expenseAutomationTransactionsView.actions, exports.fetchTransactionCategorization = _a.fetchTransactionCategorization, exports.updateTransactionCategorizationUIState = _a.updateTransactionCategorizationUIState, exports.initializeTransactionCategorizationViewLocalData = _a.initializeTransactionCategorizationViewLocalData, exports.saveTransactionCategorizationLocalData = _a.saveTransactionCategorizationLocalData, exports.fetchTransactionCategorizationFailure = _a.fetchTransactionCategorizationFailure, exports.saveTransactionCategorization = _a.saveTransactionCategorization, exports.updateTransactionCategorization = _a.updateTransactionCategorization, exports.updateCurrentSelectedTransactionCategorizationTab = _a.updateCurrentSelectedTransactionCategorizationTab, exports.updateTransactionCategorizationCompletedSubTab = _a.updateTransactionCategorizationCompletedSubTab, exports.updateTransactionCategorizationSaveStatus = _a.updateTransactionCategorizationSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = _a.updateStatusForTransactionNotMiscategorizedUpdateForCategorization, exports.updateSelectedVendorForTransaction = _a.updateSelectedVendorForTransaction, exports.updateSelectedCustomerForTransaction = _a.updateSelectedCustomerForTransaction, exports.setAllItemsToCategoryClassInLocalDataForCategorization = _a.setAllItemsToCategoryClassInLocalDataForCategorization, exports.updateTotalCountForTransactionCategorization = _a.updateTotalCountForTransactionCategorization, exports.fetchTransactionCategorizationSuccess = _a.fetchTransactionCategorizationSuccess, exports.resetOtherTabsFetchState = _a.resetOtherTabsFetchState, exports.fetchTransactionCategorizationView = _a.fetchTransactionCategorizationView, exports.updateSelectedCheckboxTransactionIds = _a.updateSelectedCheckboxTransactionIds, exports.clearExpenseAutomationTransactionsViewPerTabView = _a.clearExpenseAutomationTransactionsViewPerTabView, exports.clearExpenseAutomationTransactionsView = _a.clearExpenseAutomationTransactionsView, exports.setEntityRecommendationForLineIdsForCategorization = _a.setEntityRecommendationForLineIdsForCategorization, exports.updateSelectedTransactionId = _a.updateSelectedTransactionId, exports.syncTransactionCategorizationFromDetailSave = _a.syncTransactionCategorizationFromDetailSave, exports.backgroundRefetchReviewTab = _a.backgroundRefetchReviewTab, exports.updateTransactionCategorizationUploadReceiptState = _a.updateTransactionCategorizationUploadReceiptState, exports.uploadTransactionCategorizationReceiptSuccess = _a.uploadTransactionCategorizationReceiptSuccess;
|
|
892
|
+
_a = expenseAutomationTransactionsView.actions, exports.fetchTransactionCategorization = _a.fetchTransactionCategorization, exports.updateTransactionCategorizationUIState = _a.updateTransactionCategorizationUIState, exports.initializeTransactionCategorizationViewLocalData = _a.initializeTransactionCategorizationViewLocalData, exports.saveTransactionCategorizationLocalData = _a.saveTransactionCategorizationLocalData, exports.fetchTransactionCategorizationFailure = _a.fetchTransactionCategorizationFailure, exports.saveTransactionCategorization = _a.saveTransactionCategorization, exports.updateTransactionCategorization = _a.updateTransactionCategorization, exports.updateCurrentSelectedTransactionCategorizationTab = _a.updateCurrentSelectedTransactionCategorizationTab, exports.updateTransactionCategorizationCompletedSubTab = _a.updateTransactionCategorizationCompletedSubTab, exports.updateTransactionCategorizationSaveStatus = _a.updateTransactionCategorizationSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = _a.updateStatusForTransactionNotMiscategorizedUpdateForCategorization, exports.updateSelectedVendorForTransaction = _a.updateSelectedVendorForTransaction, exports.updateSelectedCustomerForTransaction = _a.updateSelectedCustomerForTransaction, exports.setAllItemsToCategoryClassInLocalDataForCategorization = _a.setAllItemsToCategoryClassInLocalDataForCategorization, exports.updateTotalCountForTransactionCategorization = _a.updateTotalCountForTransactionCategorization, exports.updateParentTotalCountForTab = _a.updateParentTotalCountForTab, exports.fetchTransactionCategorizationSuccess = _a.fetchTransactionCategorizationSuccess, exports.resetOtherTabsFetchState = _a.resetOtherTabsFetchState, exports.fetchTransactionCategorizationView = _a.fetchTransactionCategorizationView, exports.updateSelectedCheckboxTransactionIds = _a.updateSelectedCheckboxTransactionIds, exports.clearExpenseAutomationTransactionsViewPerTabView = _a.clearExpenseAutomationTransactionsViewPerTabView, exports.clearExpenseAutomationTransactionsView = _a.clearExpenseAutomationTransactionsView, exports.setEntityRecommendationForLineIdsForCategorization = _a.setEntityRecommendationForLineIdsForCategorization, exports.updateSelectedTransactionId = _a.updateSelectedTransactionId, exports.syncTransactionCategorizationFromDetailSave = _a.syncTransactionCategorizationFromDetailSave, exports.backgroundRefetchReviewTab = _a.backgroundRefetchReviewTab, exports.updateTransactionCategorizationUploadReceiptState = _a.updateTransactionCategorizationUploadReceiptState, exports.uploadTransactionCategorizationReceiptSuccess = _a.uploadTransactionCategorizationReceiptSuccess;
|
|
884
893
|
exports.default = expenseAutomationTransactionsView.reducer;
|
|
@@ -22,11 +22,23 @@ export interface ExpenseAutomationTransactionViewSelector extends SelectorView {
|
|
|
22
22
|
fetchStateByTransactionTabs: Record<TransactionsTab, FetchStateAndError>;
|
|
23
23
|
isAccountingProjectsEnabled: boolean;
|
|
24
24
|
markAsNotMiscategorizedStatus: FetchStateAndError;
|
|
25
|
+
/**
|
|
26
|
+
* Parent tab badge counts, sourced from the listing response's
|
|
27
|
+
* `parent_tab_total_count`. Used exclusively to drive the navbar / tab
|
|
28
|
+
* strip badge labels — every other count consumer (pagination, in-list
|
|
29
|
+
* "showing X of Y", save flows) keeps reading {@link totalCountByTab}.
|
|
30
|
+
*/
|
|
31
|
+
parentTabTotalCountByTab: Record<TransactionsTab, number>;
|
|
25
32
|
projectList: ProjectListSelectorView;
|
|
26
33
|
refreshStatus: FetchStateAndError;
|
|
27
34
|
saveStatus: FetchStateAndError;
|
|
28
35
|
selectedCheckBoxTransactionIds: ID[];
|
|
29
36
|
selectedTransactionCategorizationCompletedSubTab: CompletedSubTab;
|
|
37
|
+
/**
|
|
38
|
+
* Per-(sub-)tab counts mirroring `total_count` from the listing response.
|
|
39
|
+
* Powers pagination via `InfiniteLoader.itemCount`, in-list count copy,
|
|
40
|
+
* and the `resetTransactionCategorizationLocalData` round-trip.
|
|
41
|
+
*/
|
|
30
42
|
totalCountByTab: Record<TransactionsTab, number>;
|
|
31
43
|
transactionIdsWithUnsavedData: ID[];
|
|
32
44
|
transactionLocalData: TransactionReviewLocalDataSelectorView[];
|
|
@@ -69,10 +69,27 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
69
69
|
.uiState.totalCount;
|
|
70
70
|
const totalCountByAutoCat = expenseAutomationTransactionsViewState.transactionCategorizationView
|
|
71
71
|
.autoCategorized.uiState.totalCount;
|
|
72
|
+
// Per-(sub-)tab counts powering pagination, in-list "showing X of Y", and
|
|
73
|
+
// any save/refresh round-trips. Sourced from `uiState.totalCount` which
|
|
74
|
+
// mirrors the response's `total_count` for whatever tab/sub-tab the user is
|
|
75
|
+
// viewing (e.g. only the Manual sub-tab rows for Completed → Manual).
|
|
72
76
|
const totalCountByTab = {
|
|
73
77
|
review: monthYearPeriodId != null ? totalCountByReview[monthYearPeriodId] : 0,
|
|
74
78
|
autoCategorized: monthYearPeriodId != null ? totalCountByAutoCat[monthYearPeriodId] : 0,
|
|
75
79
|
};
|
|
80
|
+
// Parent-tab badge counts. Sourced from `parent_tab_total_count` in the
|
|
81
|
+
// listing response and used exclusively by the navbar / tab strip badges.
|
|
82
|
+
// Independent of which Completed sub-tab is active so the badge stays
|
|
83
|
+
// stable across sub-tab switches.
|
|
84
|
+
const parentTotalCountByTab = expenseAutomationTransactionsViewState.parentTotalCountByTab;
|
|
85
|
+
const parentTabTotalCountByTab = {
|
|
86
|
+
review: monthYearPeriodId != null
|
|
87
|
+
? (parentTotalCountByTab.review[monthYearPeriodId] ?? 0)
|
|
88
|
+
: 0,
|
|
89
|
+
autoCategorized: monthYearPeriodId != null
|
|
90
|
+
? (parentTotalCountByTab.autoCategorized[monthYearPeriodId] ?? 0)
|
|
91
|
+
: 0,
|
|
92
|
+
};
|
|
76
93
|
const fetchStateByTab = {
|
|
77
94
|
review: {
|
|
78
95
|
fetchState: expenseAutomationTransactionsViewState.transactionCategorizationView
|
|
@@ -114,6 +131,7 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
114
131
|
markAsNotMiscategorizedStatus,
|
|
115
132
|
completionStatus,
|
|
116
133
|
totalCountByTab,
|
|
134
|
+
parentTabTotalCountByTab,
|
|
117
135
|
fetchStateByTransactionTabs: fetchStateByTab,
|
|
118
136
|
uploadReceiptStatusById,
|
|
119
137
|
selectedTransactionId,
|
|
@@ -129,6 +129,14 @@ export type TransactionsViewState = {
|
|
|
129
129
|
* the fetch epic loads page 1 fresh.
|
|
130
130
|
*/
|
|
131
131
|
autoCategorizedSubTabCache: Partial<Record<CompletedSubTab, AutoCategorizedSubTabSnapshot>>;
|
|
132
|
+
/**
|
|
133
|
+
* Period-keyed parent tab counts, scoped per {@link TransactionsTab}.
|
|
134
|
+
* Sourced from the listing response's `parent_tab_total_count` and used
|
|
135
|
+
* exclusively to drive the parent tab badges on the UI — every other
|
|
136
|
+
* count consumer (pagination, sub-tab chips, in-tab "showing X of Y")
|
|
137
|
+
* keeps reading from {@link TransactionsViewUIState.totalCount}.
|
|
138
|
+
*/
|
|
139
|
+
parentTotalCountByTab: Record<TransactionsTab, Record<MonthYearPeriodId, number>>;
|
|
132
140
|
selectedTransactionCategorizationCompletedSubTab: CompletedSubTab;
|
|
133
141
|
selectedTransactionCategorizationTab: TransactionsTab;
|
|
134
142
|
transactionCategorizationView: Record<TransactionsTab, TransactionsTabViewState>;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@zeniai/client-epic-state",
|
|
3
|
-
"version": "5.0.55-
|
|
3
|
+
"version": "5.0.55-betaSS2",
|
|
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
|
"module": "lib/esm/index.js",
|