@zeniai/client-epic-state 5.0.74 → 5.0.76
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/coreEpics.js +1 -1
- package/lib/entity/account/accountSelector.d.ts +1 -27
- package/lib/entity/account/accountSelector.js +1 -47
- package/lib/entity/account/accountState.d.ts +1 -6
- package/lib/entity/account/accountState.js +4 -11
- package/lib/entity/account/subAccountSelector.d.ts +1 -1
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +3 -1
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +2 -1
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +1 -1
- package/lib/entity/chargeCard/chargeCardReducer.d.ts +2 -19
- package/lib/entity/chargeCard/chargeCardReducer.js +2 -35
- package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.d.ts +1 -14
- package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.js +2 -36
- package/lib/entity/class/classSelector.d.ts +0 -35
- package/lib/entity/class/classSelector.js +0 -50
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +1 -1
- package/lib/entity/sectionProjectView/sectionProjectViewSelector.js +1 -1
- package/lib/entity/tenant/SessionManager.js +3 -6
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -2
- package/lib/entity/tenant/clearAllEpic.js +2 -2
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.js +2 -6
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.js +2 -6
- package/lib/entity/tenant/tenantReducer.js +1 -6
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +1 -3
- package/lib/epic.d.ts +9 -9
- package/lib/epic.js +10 -10
- package/lib/esm/coreEpics.js +1 -1
- package/lib/esm/entity/account/accountSelector.js +1 -46
- package/lib/esm/entity/account/accountState.js +1 -7
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +3 -1
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +2 -1
- package/lib/esm/entity/chargeCard/chargeCardReducer.js +1 -34
- package/lib/esm/entity/chargeCardTransaction/chargeCardTransactionReducer.js +1 -35
- package/lib/esm/entity/class/classSelector.js +0 -48
- package/lib/esm/entity/sectionProjectView/sectionProjectViewSelector.js +1 -1
- package/lib/esm/entity/tenant/SessionManager.js +1 -4
- package/lib/esm/entity/tenant/clearAllEpic.js +2 -2
- package/lib/esm/entity/tenant/epic/saveAPIKeyConnectionEpic.js +2 -6
- package/lib/esm/entity/tenant/epic/saveOAuthConnectionEpic.js +2 -6
- package/lib/esm/entity/tenant/tenantReducer.js +1 -6
- package/lib/esm/entity/transaction/payloadTypes/transactionLinePayload.js +1 -3
- package/lib/esm/epic.js +10 -10
- package/lib/esm/index.js +16 -26
- package/lib/esm/reducer.js +2 -2
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +5 -2
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +5 -2
- package/lib/esm/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +1 -4
- package/lib/esm/view/companyHealthMetricView/companyHealthMetricViewSelector.js +1 -1
- package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
- package/lib/esm/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +1 -1
- package/lib/esm/view/companyView/helpers/cockpitHelpers.js +1 -1
- package/lib/esm/view/companyView/selector/companyManagementViewSelector.js +1 -1
- package/lib/esm/view/companyView/selector/companyPortfolioViewSelector.js +1 -1
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +1 -2
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +6 -8
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +1 -7
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +1 -11
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +1 -2
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +1 -137
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +13 -89
- package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +2 -0
- package/lib/esm/view/financeStatement/financeStatementSelector.js +1 -1
- package/lib/esm/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +2 -3
- package/lib/esm/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +2 -3
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +18 -55
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +2 -16
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +4 -5
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +9 -26
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +6 -9
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +2 -3
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
- package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +3 -7
- package/lib/esm/view/spendManagement/spendManagementFilterHelpers.js +2 -4
- package/lib/esm/view/subscriptionView/subscriptionViewSelector.js +1 -1
- package/lib/esm/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.js +1 -1
- package/lib/esm/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.js +1 -1
- package/lib/esm/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +1 -1
- package/lib/esm/view/taskManager/taskListView/taskListReducer.js +1 -1
- package/lib/esm/view/transactionDetail/transactionDetailSelector.js +1 -7
- package/lib/index.d.ts +19 -25
- package/lib/index.js +58 -81
- package/lib/reducer.d.ts +2 -2
- package/lib/reducer.js +2 -2
- package/lib/view/aiAccountantView/aiAccountantViewPayload.d.ts +2 -2
- package/lib/view/aiAccountantView/aiAccountantViewReducer.d.ts +1 -1
- package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +5 -2
- package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +5 -2
- package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +1 -4
- package/lib/view/companyHealthMetricView/companyHealthMetricViewSelector.js +1 -1
- package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.d.ts +1 -1
- package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
- package/lib/view/companyView/helpers/cockpitHelpers.js +1 -1
- package/lib/view/companyView/selector/companyManagementViewSelector.js +1 -1
- package/lib/view/companyView/selector/companyPortfolioViewSelector.js +1 -1
- package/lib/view/companyView/types/cockpitTypes.d.ts +1 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +1 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +6 -8
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +1 -7
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +0 -10
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +0 -21
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -2
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +1 -2
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +4 -14
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +2 -138
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +1 -2
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +0 -14
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.d.ts +1 -4
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +13 -91
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +2 -1
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +4 -1
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -43
- package/lib/view/financeStatement/financeStatementSelector.js +1 -1
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.d.ts +1 -3
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +2 -3
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.d.ts +1 -3
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +2 -3
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +18 -55
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +2 -16
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +4 -5
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +3 -18
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +10 -27
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +6 -9
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistory.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.d.ts +1 -3
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +2 -3
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.d.ts +1 -3
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +3 -7
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
- package/lib/view/spendManagement/spendManagementFilterHelpers.d.ts +3 -12
- package/lib/view/spendManagement/spendManagementFilterHelpers.js +2 -4
- package/lib/view/subscriptionView/subscriptionViewSelector.js +1 -1
- package/lib/view/taskManager/taskListView/taskList.d.ts +1 -1
- package/lib/view/taskManager/taskListView/taskListReducer.js +1 -1
- package/lib/view/transactionDetail/transactionDetailSelector.js +1 -7
- package/lib/view/zeniOAuthView/zeniOAuthSelector.d.ts +1 -1
- package/package.json +4 -9
- package/lib/commonStateTypes/cacheOverrideFetchReducer.d.ts +0 -17
- package/lib/commonStateTypes/cacheOverrideFetchReducer.js +0 -20
- package/lib/commonStateTypes/filterPrimitives.d.ts +0 -23
- package/lib/commonStateTypes/filterPrimitives.js +0 -21
- package/lib/commonStateTypes/pusherActions.d.ts +0 -11
- package/lib/commonStateTypes/pusherActions.js +0 -6
- package/lib/esm/commonStateTypes/cacheOverrideFetchReducer.js +0 -16
- package/lib/esm/commonStateTypes/filterPrimitives.js +0 -20
- package/lib/esm/commonStateTypes/pusherActions.js +0 -3
- package/lib/esm/view/expenseAutomationView/transactionFilterHelpers.js +0 -258
- package/lib/esm/view/expenseAutomationView/types/completedSubTab.js +0 -17
- package/lib/view/expenseAutomationView/transactionFilterHelpers.d.ts +0 -66
- package/lib/view/expenseAutomationView/transactionFilterHelpers.js +0 -262
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +0 -10
- package/lib/view/expenseAutomationView/types/completedSubTab.js +0 -21
|
@@ -4,14 +4,13 @@ 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.
|
|
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.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"));
|
|
11
11
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
12
12
|
const vendorTransaction_1 = require("../../../entity/transaction/stateTypes/vendorTransaction");
|
|
13
13
|
const transactionCategorizationLocalDataHelper_1 = require("../helpers/transactionCategorizationLocalDataHelper");
|
|
14
|
-
const completedSubTab_1 = require("../types/completedSubTab");
|
|
15
14
|
exports.initialTransactionTabViewState = {
|
|
16
15
|
saveStatus: {
|
|
17
16
|
fetchState: 'Not-Started',
|
|
@@ -35,10 +34,6 @@ exports.initialTransactionTabViewState = {
|
|
|
35
34
|
totalCount: {},
|
|
36
35
|
limit: 10,
|
|
37
36
|
},
|
|
38
|
-
filters: {
|
|
39
|
-
categoryCombinationOperator: 'AND',
|
|
40
|
-
categories: [],
|
|
41
|
-
},
|
|
42
37
|
fetchState: 'Not-Started',
|
|
43
38
|
error: undefined,
|
|
44
39
|
hasValidState() {
|
|
@@ -53,74 +48,12 @@ exports.initialTransactionTabViewState = {
|
|
|
53
48
|
selectedTransactionLineId: undefined,
|
|
54
49
|
};
|
|
55
50
|
exports.initialState = {
|
|
56
|
-
autoCategorizedSubTabCache: {},
|
|
57
|
-
parentTotalCountByTab: {
|
|
58
|
-
review: {},
|
|
59
|
-
autoCategorized: {},
|
|
60
|
-
},
|
|
61
51
|
selectedTransactionCategorizationTab: 'review',
|
|
62
|
-
selectedTransactionCategorizationCompletedSubTab: completedSubTab_1.DEFAULT_COMPLETED_SUB_TAB,
|
|
63
52
|
transactionCategorizationView: {
|
|
64
53
|
review: { ...exports.initialTransactionTabViewState },
|
|
65
54
|
autoCategorized: { ...exports.initialTransactionTabViewState },
|
|
66
55
|
},
|
|
67
56
|
};
|
|
68
|
-
/**
|
|
69
|
-
* Capture the autoCategorized tab's current paginated dataset for a sub-tab.
|
|
70
|
-
* The mid-flight `'In-Progress'` state is normalised to `'Completed'` because
|
|
71
|
-
* the in-flight request is cancelled by `switchMap` in the fetch epic when the
|
|
72
|
-
* sub-tab changes — restoring `'In-Progress'` later would leave the UI stuck
|
|
73
|
-
* showing a phantom loading state with no fetch actually running. Length-zero
|
|
74
|
-
* datasets degrade to `'Not-Started'` so the next visit triggers a fresh
|
|
75
|
-
* fetch from page 1 instead of short-circuiting on stale empty caches.
|
|
76
|
-
*
|
|
77
|
-
* Snapshot scope (deliberately narrow):
|
|
78
|
-
* - Captured: `pageToken`, `totalCount`, `transactionIdsBySelectedPeriod`,
|
|
79
|
-
* `fetchState`, `error`, `scrollPosition`. The first five are the keys the
|
|
80
|
-
* fetch epic's cache check reads to decide whether to short-circuit a
|
|
81
|
-
* sub-tab revisit; `scrollPosition` is captured per sub-tab so revisiting
|
|
82
|
-
* restores the user's last offset and switching to a never-visited sub-tab
|
|
83
|
-
* starts at the top instead of inheriting the outgoing sub-tab's offset
|
|
84
|
-
* (which would land the user at a meaningless row index against a
|
|
85
|
-
* completely different list).
|
|
86
|
-
* - Intentionally NOT captured (left in place on `autoCat` and inherited by
|
|
87
|
-
* the incoming sub-tab):
|
|
88
|
-
* - `uiState.searchString`, `uiState.sortKey`, `uiState.sortOrder`,
|
|
89
|
-
* `uiState.nodeCollapseState`, `uiState.limit` — search and sort are
|
|
90
|
-
* user-applied preferences that persist across sub-tabs by design (a
|
|
91
|
-
* search query stays active when the user toggles between Manual / AI
|
|
92
|
-
* Accountant).
|
|
93
|
-
* - `selectedCheckBoxTransactionIds` — selection state is intentionally
|
|
94
|
-
* cleared at the action source (the fetch epic / save flow), not
|
|
95
|
-
* by the snapshot path. Carrying selection across sub-tabs is safe
|
|
96
|
-
* because every sub-tab change goes through a fetch round-trip that
|
|
97
|
-
* reconciles selection against the new row IDs.
|
|
98
|
-
* - `transactionReviewLocalDataById`, `transactionIdsWithUnsavedData`,
|
|
99
|
-
* `uploadReceiptStatusById`, `saveStatus`, `refreshStatus`,
|
|
100
|
-
* `markAsNotMiscategorizedStatus` — these are per-row / per-flight
|
|
101
|
-
* caches that are write-through global state, not sub-tab-scoped.
|
|
102
|
-
*
|
|
103
|
-
* If the contract changes (e.g. selection should reset on every sub-tab
|
|
104
|
-
* switch), update both this comment and the snapshot return shape together.
|
|
105
|
-
*/
|
|
106
|
-
function snapshotAutoCategorizedTab(autoCat) {
|
|
107
|
-
const transactionIdsBySelectedPeriod = {
|
|
108
|
-
...autoCat.transactionIdsBySelectedPeriod,
|
|
109
|
-
};
|
|
110
|
-
const hasAnyLoadedRows = Object.values(transactionIdsBySelectedPeriod).some((ids) => ids.length > 0);
|
|
111
|
-
let normalisedFetchState = autoCat.fetchState;
|
|
112
|
-
if (normalisedFetchState === 'In-Progress') {
|
|
113
|
-
normalisedFetchState = hasAnyLoadedRows ? 'Completed' : 'Not-Started';
|
|
114
|
-
}
|
|
115
|
-
return {
|
|
116
|
-
error: autoCat.error,
|
|
117
|
-
fetchState: normalisedFetchState,
|
|
118
|
-
pageToken: autoCat.uiState.pageToken,
|
|
119
|
-
scrollPosition: autoCat.uiState.scrollPosition,
|
|
120
|
-
totalCount: { ...autoCat.uiState.totalCount },
|
|
121
|
-
transactionIdsBySelectedPeriod,
|
|
122
|
-
};
|
|
123
|
-
}
|
|
124
57
|
const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
125
58
|
name: 'expenseAutomationTransactionsView',
|
|
126
59
|
initialState: exports.initialState,
|
|
@@ -310,12 +243,6 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
310
243
|
uiState.totalCount;
|
|
311
244
|
}
|
|
312
245
|
},
|
|
313
|
-
updateTransactionFilters(draft, action) {
|
|
314
|
-
const { selectedTab, filters } = action.payload;
|
|
315
|
-
// `filters` is non-nullable per the payload type, so no runtime
|
|
316
|
-
// null-check is needed — dropping it removes a dead defensive branch.
|
|
317
|
-
draft.transactionCategorizationView[selectedTab].filters = filters;
|
|
318
|
-
},
|
|
319
246
|
saveTransactionCategorization: {
|
|
320
247
|
prepare(selectedTab, transactionIds, cotTrackingByTransactionId, isUncategorizedExpenseCategoryEnabled) {
|
|
321
248
|
return {
|
|
@@ -340,55 +267,6 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
340
267
|
return { payload: { newSelectedTab } };
|
|
341
268
|
},
|
|
342
269
|
},
|
|
343
|
-
updateTransactionCategorizationCompletedSubTab: {
|
|
344
|
-
reducer(draft, action) {
|
|
345
|
-
const { newSubTab } = action.payload;
|
|
346
|
-
const previousSubTab = draft.selectedTransactionCategorizationCompletedSubTab;
|
|
347
|
-
if (previousSubTab === newSubTab) {
|
|
348
|
-
return;
|
|
349
|
-
}
|
|
350
|
-
const autoCat = draft.transactionCategorizationView.autoCategorized;
|
|
351
|
-
// Snapshot the outgoing sub-tab so a future revisit can short-circuit
|
|
352
|
-
// the fetch epic (mirrors the parent-tab "don't refetch what's
|
|
353
|
-
// already cached" behaviour). Period-scoped data is preserved as-is
|
|
354
|
-
// because the snapshot itself is keyed only by sub-tab; the active
|
|
355
|
-
// tab's per-period maps remain the source of truth while live.
|
|
356
|
-
draft.autoCategorizedSubTabCache[previousSubTab] =
|
|
357
|
-
snapshotAutoCategorizedTab(autoCat);
|
|
358
|
-
const cached = draft.autoCategorizedSubTabCache[newSubTab];
|
|
359
|
-
if (cached != null) {
|
|
360
|
-
autoCat.uiState.pageToken = cached.pageToken;
|
|
361
|
-
autoCat.uiState.totalCount = { ...cached.totalCount };
|
|
362
|
-
autoCat.uiState.scrollPosition = cached.scrollPosition;
|
|
363
|
-
autoCat.transactionIdsBySelectedPeriod = {
|
|
364
|
-
...cached.transactionIdsBySelectedPeriod,
|
|
365
|
-
};
|
|
366
|
-
autoCat.fetchState = cached.fetchState;
|
|
367
|
-
autoCat.error = cached.error;
|
|
368
|
-
}
|
|
369
|
-
else {
|
|
370
|
-
// Sub-tab has never been visited — clear the active slot so the
|
|
371
|
-
// view-epic's `fetchState === 'Not-Started' || transactionIds.length
|
|
372
|
-
// === 0` cache check falls through and triggers a fresh page-1
|
|
373
|
-
// fetch for the new dataset. `scrollPosition` is reset to the top
|
|
374
|
-
// so the incoming list isn't anchored to the outgoing sub-tab's
|
|
375
|
-
// offset (different rows → previous offset is meaningless).
|
|
376
|
-
autoCat.uiState.pageToken = null;
|
|
377
|
-
autoCat.uiState.totalCount = {};
|
|
378
|
-
autoCat.uiState.scrollPosition = {
|
|
379
|
-
scrollTop: 0,
|
|
380
|
-
scrollLeft: undefined,
|
|
381
|
-
};
|
|
382
|
-
autoCat.transactionIdsBySelectedPeriod = {};
|
|
383
|
-
autoCat.fetchState = 'Not-Started';
|
|
384
|
-
autoCat.error = undefined;
|
|
385
|
-
}
|
|
386
|
-
draft.selectedTransactionCategorizationCompletedSubTab = newSubTab;
|
|
387
|
-
},
|
|
388
|
-
prepare(newSubTab) {
|
|
389
|
-
return { payload: { newSubTab } };
|
|
390
|
-
},
|
|
391
|
-
},
|
|
392
270
|
updateTransactionCategorization: {
|
|
393
271
|
reducer(draft, action) {
|
|
394
272
|
const selectedTab = action.payload.selectedTab;
|
|
@@ -826,10 +704,6 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
826
704
|
const { selectedTab, selectedPeriod, totalCount } = action.payload;
|
|
827
705
|
draft.transactionCategorizationView[selectedTab].uiState.totalCount[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = totalCount;
|
|
828
706
|
},
|
|
829
|
-
updateParentTotalCountForTab(draft, action) {
|
|
830
|
-
const { selectedTab, selectedPeriod, parentTotalCount } = action.payload;
|
|
831
|
-
draft.parentTotalCountByTab[selectedTab][(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = parentTotalCount;
|
|
832
|
-
},
|
|
833
707
|
updateSelectedCheckboxTransactionIds(draft, action) {
|
|
834
708
|
const selectedTab = action.payload.selectedTab;
|
|
835
709
|
const transactionIds = action.payload.transactionIds;
|
|
@@ -840,16 +714,6 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
840
714
|
draft.transactionCategorizationView[selectedTab] = {
|
|
841
715
|
...exports.initialTransactionTabViewState,
|
|
842
716
|
};
|
|
843
|
-
draft.parentTotalCountByTab[selectedTab] = {};
|
|
844
|
-
// The per-sub-tab snapshot cache lives at the slice root and is
|
|
845
|
-
// exclusively populated by the autoCategorized tab's sub-tab switching
|
|
846
|
-
// (see updateTransactionCategorizationCompletedSubTab). When that tab
|
|
847
|
-
// is reset, leaving stale snapshots behind would short-circuit the
|
|
848
|
-
// next sub-tab visit with phantom row IDs / page tokens that no longer
|
|
849
|
-
// correspond to anything in state — drop them in lockstep.
|
|
850
|
-
if (selectedTab === 'autoCategorized') {
|
|
851
|
-
draft.autoCategorizedSubTabCache = {};
|
|
852
|
-
}
|
|
853
717
|
},
|
|
854
718
|
clearExpenseAutomationTransactionsView(draft) {
|
|
855
719
|
Object.assign(draft, exports.initialState);
|
|
@@ -946,5 +810,5 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
946
810
|
},
|
|
947
811
|
},
|
|
948
812
|
});
|
|
949
|
-
_a = expenseAutomationTransactionsView.actions, exports.fetchTransactionCategorization = _a.fetchTransactionCategorization, exports.updateTransactionCategorizationUIState = _a.updateTransactionCategorizationUIState, exports.
|
|
813
|
+
_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.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;
|
|
950
814
|
exports.default = expenseAutomationTransactionsView.reducer;
|
|
@@ -2,8 +2,7 @@ import { CompletionStatusType, FetchStateAndError, ID } from '../../../commonSta
|
|
|
2
2
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
3
3
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
4
4
|
import { SupportedTransaction } from '../../../entity/transaction/transactionState';
|
|
5
|
-
import type { CompletedSubTab } from '../types/
|
|
6
|
-
import type { BatchFileStatus, BatchListItem, BatchStatus, BulkUploadPhase, BulkUploadResultsTab, BulkUploadSortKey, ManualSearchState, MatchSource, MissingReceiptsViewUIState } from '../types/missingReceiptsViewState';
|
|
5
|
+
import type { BatchFileStatus, BatchListItem, BatchStatus, BulkUploadPhase, BulkUploadResultsTab, BulkUploadSortKey, CompletedSubTab, ManualSearchState, MatchSource, MissingReceiptsViewUIState } from '../types/missingReceiptsViewState';
|
|
7
6
|
export interface CompletedTransactionsSelectorData {
|
|
8
7
|
fetchState: FetchStateAndError;
|
|
9
8
|
nextPageToken: string | null;
|
|
@@ -7,7 +7,6 @@ import { ClassBase } from '../../../entity/class/classState';
|
|
|
7
7
|
import { SupportedTransactionWithCOT } from '../../../entity/transaction/transactionState';
|
|
8
8
|
import { UncategorizedAccounts } from '../../accountList/accountListSelector';
|
|
9
9
|
import { ProjectListSelectorView } from '../../projectList/projectListSelector';
|
|
10
|
-
import { CompletedSubTab } from '../types/completedSubTab';
|
|
11
10
|
import { TransactionReviewLocalData, TransactionsTab, TransactionsViewUIState } from '../types/transactionsViewState';
|
|
12
11
|
export interface TransactionReviewLocalDataSelectorView {
|
|
13
12
|
transactionId: ID;
|
|
@@ -22,23 +21,10 @@ export interface ExpenseAutomationTransactionViewSelector extends SelectorView {
|
|
|
22
21
|
fetchStateByTransactionTabs: Record<TransactionsTab, FetchStateAndError>;
|
|
23
22
|
isAccountingProjectsEnabled: boolean;
|
|
24
23
|
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>;
|
|
32
24
|
projectList: ProjectListSelectorView;
|
|
33
25
|
refreshStatus: FetchStateAndError;
|
|
34
26
|
saveStatus: FetchStateAndError;
|
|
35
27
|
selectedCheckBoxTransactionIds: ID[];
|
|
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
|
-
*/
|
|
42
28
|
totalCountByTab: Record<TransactionsTab, number>;
|
|
43
29
|
transactionIdsWithUnsavedData: ID[];
|
|
44
30
|
transactionLocalData: TransactionReviewLocalDataSelectorView[];
|
|
@@ -1,6 +1,3 @@
|
|
|
1
|
-
import { TransactionWithCOT } from '../../../entity/transaction/stateTypes/transaction';
|
|
2
1
|
import { RootState } from '../../../reducer';
|
|
3
|
-
import {
|
|
4
|
-
import { ExpenseAutomationTransactionViewSelector, TransactionReviewLocalDataSelectorView } from '../selectorTypes/transactionsViewSelectorTypes';
|
|
5
|
-
export declare const toTransactionView: (transaction: TransactionWithCOT, transactionLocalData?: TransactionReviewLocalDataSelectorView) => TransactionView;
|
|
2
|
+
import { ExpenseAutomationTransactionViewSelector } from '../selectorTypes/transactionsViewSelectorTypes';
|
|
6
3
|
export declare function getExpenseAutomationTransactionView(state: RootState): ExpenseAutomationTransactionViewSelector;
|
|
@@ -3,7 +3,6 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.toTransactionView = void 0;
|
|
7
6
|
exports.getExpenseAutomationTransactionView = getExpenseAutomationTransactionView;
|
|
8
7
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
9
8
|
const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState");
|
|
@@ -11,34 +10,14 @@ const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
|
11
10
|
const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
|
|
12
11
|
const transactionHelper_1 = require("../../../entity/transaction/transactionHelper");
|
|
13
12
|
const transactionSelector_1 = require("../../../entity/transaction/transactionSelector");
|
|
14
|
-
const transactionFilterHelpers_1 = require("../transactionFilterHelpers");
|
|
15
13
|
const accountListSelector_1 = require("../../accountList/accountListSelector");
|
|
16
14
|
const classListSelector_1 = require("../../classList/classListSelector");
|
|
17
15
|
const projectListSelector_1 = require("../../projectList/projectListSelector");
|
|
18
16
|
const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
|
|
19
|
-
const toTransactionView = (transaction, transactionLocalData) => {
|
|
20
|
-
return {
|
|
21
|
-
id: transaction.id,
|
|
22
|
-
date: transaction.date,
|
|
23
|
-
amount: transaction.amount,
|
|
24
|
-
vendorName: transaction.vendorName,
|
|
25
|
-
customerName: transaction.customerName,
|
|
26
|
-
vendorId: transaction.vendorId,
|
|
27
|
-
customerId: transaction.customerId,
|
|
28
|
-
description: transaction.description,
|
|
29
|
-
memo: transaction.memo,
|
|
30
|
-
type: transaction.type,
|
|
31
|
-
typeName: transaction.typeName,
|
|
32
|
-
createTime: transaction.createTime,
|
|
33
|
-
transaction: transaction,
|
|
34
|
-
transactionLocalData,
|
|
35
|
-
};
|
|
36
|
-
};
|
|
37
|
-
exports.toTransactionView = toTransactionView;
|
|
38
17
|
function getExpenseAutomationTransactionView(state) {
|
|
39
18
|
const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, projectState, projectListState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
|
|
40
|
-
const {
|
|
41
|
-
const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId,
|
|
19
|
+
const { selectedTransactionCategorizationTab } = expenseAutomationTransactionsViewState;
|
|
20
|
+
const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
|
|
42
21
|
const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(accountState, accountListState, 'accountList');
|
|
43
22
|
const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
|
|
44
23
|
const classList = (0, classListSelector_1.getClassList)(classState, classListState);
|
|
@@ -57,58 +36,20 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
57
36
|
? transactionIdsBySelectedPeriod[monthYearPeriodId]
|
|
58
37
|
: null;
|
|
59
38
|
const transactionIds = transactionIdsForSelectedPeriod ?? [];
|
|
60
|
-
const
|
|
61
|
-
|
|
62
|
-
const transactionLocalDataMap = new Map();
|
|
63
|
-
transactionIds.forEach((transactionId) => {
|
|
39
|
+
const transactionLocalData = transactionIds
|
|
40
|
+
.map((transactionId) => {
|
|
64
41
|
const transactionData = transactionReviewLocalDataById[transactionId];
|
|
65
42
|
if (transactionData != null) {
|
|
66
|
-
|
|
43
|
+
return {
|
|
67
44
|
transactionId,
|
|
68
45
|
transactionReviewLocalData: transactionData.transactionReviewLocalData,
|
|
69
|
-
}
|
|
70
|
-
}
|
|
71
|
-
});
|
|
72
|
-
// Step 2: Convert to TransactionView and apply advanced filters
|
|
73
|
-
const transactionViews = transactionsWithCOT.map((transaction) => {
|
|
74
|
-
const localData = transactionLocalDataMap.get(transaction.id);
|
|
75
|
-
return (0, exports.toTransactionView)(transaction, localData);
|
|
76
|
-
});
|
|
77
|
-
// Apply TC-specific filters (lives under expenseAutomationView, independent
|
|
78
|
-
// of the Spend Management filter pipeline).
|
|
79
|
-
const filteredTransactionViews = (0, transactionFilterHelpers_1.applyTransactionFilters)(transactionViews, filters);
|
|
80
|
-
// Convert back to TransactionWithCOT for return
|
|
81
|
-
const filteredTransactionsWithCOT = filteredTransactionViews.map((view) => view.transaction);
|
|
82
|
-
// Get transactionLocalData for filtered transactions
|
|
83
|
-
// Also include transactionLocalData for transactions that don't exist in transactionState
|
|
84
|
-
// but have local data (to match original behavior)
|
|
85
|
-
const filteredTransactionIds = new Set(filteredTransactionViews.map((view) => view.id));
|
|
86
|
-
// Pre-compute the membership set once. The previous implementation called
|
|
87
|
-
// `transactions.some(t => t.id === transactionId)` inside the per-id loop,
|
|
88
|
-
// turning the pipeline into O(n × m) — measurable on tenants with large
|
|
89
|
-
// transaction lists since this selector runs on every Redux dispatch.
|
|
90
|
-
const transactionExistsById = new Set(transactions.map((t) => t.id));
|
|
91
|
-
// `.flatMap` returns `X[]` directly when the callback returns `[]` for the
|
|
92
|
-
// skip case, so we don't need the trailing `.filter((d): d is X => …)` type
|
|
93
|
-
// predicate that the previous `map → filter` pipeline required.
|
|
94
|
-
const filteredTransactionLocalData = transactionIds.flatMap((transactionId) => {
|
|
95
|
-
const transactionData = transactionReviewLocalDataById[transactionId];
|
|
96
|
-
if (transactionData == null) {
|
|
97
|
-
return [];
|
|
46
|
+
};
|
|
98
47
|
}
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
{
|
|
105
|
-
transactionId,
|
|
106
|
-
transactionReviewLocalData: transactionData.transactionReviewLocalData,
|
|
107
|
-
},
|
|
108
|
-
];
|
|
109
|
-
}
|
|
110
|
-
return [];
|
|
111
|
-
});
|
|
48
|
+
return null;
|
|
49
|
+
})
|
|
50
|
+
.filter((transaction) => transaction != null);
|
|
51
|
+
const transactions = (0, transactionSelector_1.getSupportedTransactionsByIds)(transactionState, transactionIds);
|
|
52
|
+
const transactionsWithCOT = transactions.map((transaction) => (0, transactionHelper_1.getTransactionWithCOT)(transaction));
|
|
112
53
|
const monthEndFetchState = monthYearPeriodId != null
|
|
113
54
|
? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
|
|
114
55
|
: { fetchState: 'Not-Started', error: undefined };
|
|
@@ -128,27 +69,10 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
128
69
|
.uiState.totalCount;
|
|
129
70
|
const totalCountByAutoCat = expenseAutomationTransactionsViewState.transactionCategorizationView
|
|
130
71
|
.autoCategorized.uiState.totalCount;
|
|
131
|
-
// Per-(sub-)tab counts powering pagination, in-list "showing X of Y", and
|
|
132
|
-
// any save/refresh round-trips. Sourced from `uiState.totalCount` which
|
|
133
|
-
// mirrors the response's `total_count` for whatever tab/sub-tab the user is
|
|
134
|
-
// viewing (e.g. only the Manual sub-tab rows for Completed → Manual).
|
|
135
72
|
const totalCountByTab = {
|
|
136
73
|
review: monthYearPeriodId != null ? totalCountByReview[monthYearPeriodId] : 0,
|
|
137
74
|
autoCategorized: monthYearPeriodId != null ? totalCountByAutoCat[monthYearPeriodId] : 0,
|
|
138
75
|
};
|
|
139
|
-
// Parent-tab badge counts. Sourced from `parent_tab_total_count` in the
|
|
140
|
-
// listing response and used exclusively by the navbar / tab strip badges.
|
|
141
|
-
// Independent of which Completed sub-tab is active so the badge stays
|
|
142
|
-
// stable across sub-tab switches.
|
|
143
|
-
const parentTotalCountByTab = expenseAutomationTransactionsViewState.parentTotalCountByTab;
|
|
144
|
-
const parentTabTotalCountByTab = {
|
|
145
|
-
review: monthYearPeriodId != null
|
|
146
|
-
? (parentTotalCountByTab.review[monthYearPeriodId] ?? 0)
|
|
147
|
-
: 0,
|
|
148
|
-
autoCategorized: monthYearPeriodId != null
|
|
149
|
-
? (parentTotalCountByTab.autoCategorized[monthYearPeriodId] ?? 0)
|
|
150
|
-
: 0,
|
|
151
|
-
};
|
|
152
76
|
const fetchStateByTab = {
|
|
153
77
|
review: {
|
|
154
78
|
fetchState: expenseAutomationTransactionsViewState.transactionCategorizationView
|
|
@@ -172,7 +96,7 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
172
96
|
version: 0,
|
|
173
97
|
fetchState: fetchStatus.fetchState,
|
|
174
98
|
error: fetchStatus.error,
|
|
175
|
-
transactions:
|
|
99
|
+
transactions: transactionsWithCOT,
|
|
176
100
|
selectedCheckBoxTransactionIds,
|
|
177
101
|
transactionIdsWithUnsavedData,
|
|
178
102
|
uncategorizedAccounts: uncategorizedIncomeExpense,
|
|
@@ -183,18 +107,16 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
183
107
|
classHierarchyList,
|
|
184
108
|
isAccountingProjectsEnabled,
|
|
185
109
|
projectList,
|
|
186
|
-
transactionLocalData
|
|
110
|
+
transactionLocalData,
|
|
187
111
|
uiState,
|
|
188
112
|
refreshStatus,
|
|
189
113
|
saveStatus,
|
|
190
114
|
markAsNotMiscategorizedStatus,
|
|
191
115
|
completionStatus,
|
|
192
116
|
totalCountByTab,
|
|
193
|
-
parentTabTotalCountByTab,
|
|
194
117
|
fetchStateByTransactionTabs: fetchStateByTab,
|
|
195
118
|
uploadReceiptStatusById,
|
|
196
119
|
selectedTransactionId,
|
|
197
120
|
selectedTransactionLineId,
|
|
198
|
-
selectedTransactionCategorizationCompletedSubTab,
|
|
199
121
|
};
|
|
200
122
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
3
3
|
import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
4
|
-
import { CompletedSubTab } from './completedSubTab';
|
|
5
4
|
export declare const toMissingReceiptsSortKey: (v: string) => "date" | "amount" | "vendor" | "category" | "class";
|
|
6
5
|
export type MissingReceiptsSortKey = ReturnType<typeof toMissingReceiptsSortKey>;
|
|
7
6
|
export interface MissingReceiptsViewUIState {
|
|
@@ -32,6 +31,8 @@ export declare const toBulkUploadResultsTab: (v: string) => "completed" | "unmat
|
|
|
32
31
|
export type BulkUploadResultsTab = ReturnType<typeof toBulkUploadResultsTab>;
|
|
33
32
|
export declare const toMissingReceiptsTab: (v: string) => "completed" | "unmatched" | "missing";
|
|
34
33
|
export type MissingReceiptsTab = ReturnType<typeof toMissingReceiptsTab>;
|
|
34
|
+
export declare const toCompletedSubTab: (v: string) => "all" | "manual" | "ai_accountant";
|
|
35
|
+
export type CompletedSubTab = ReturnType<typeof toCompletedSubTab>;
|
|
35
36
|
export declare const toMatchSource: (v: string) => "manual" | "ai";
|
|
36
37
|
export type MatchSource = ReturnType<typeof toMatchSource>;
|
|
37
38
|
export declare const toBulkUploadSortKey: (v: string) => "date" | "amount" | "vendor" | "category" | "class";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toBulkUploadSortKey = exports.toMatchSource = exports.toMissingReceiptsTab = exports.toBulkUploadResultsTab = exports.toBulkUploadPhase = exports.toBatchFileStatus = exports.BATCH_FILE_STATUSES = exports.toBatchStatusValue = exports.MIN_MANUAL_TRANSACTION_SEARCH_LENGTH = exports.toMissingReceiptsSortKey = void 0;
|
|
3
|
+
exports.toBulkUploadSortKey = exports.toMatchSource = exports.toCompletedSubTab = exports.toMissingReceiptsTab = exports.toBulkUploadResultsTab = exports.toBulkUploadPhase = exports.toBatchFileStatus = exports.BATCH_FILE_STATUSES = exports.toBatchStatusValue = exports.MIN_MANUAL_TRANSACTION_SEARCH_LENGTH = exports.toMissingReceiptsSortKey = void 0;
|
|
4
4
|
exports.isUnmatchedTabFileStatus = isUnmatchedTabFileStatus;
|
|
5
5
|
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
6
6
|
const MISSING_RECEIPTS_SORT_KEYS = [
|
|
@@ -49,6 +49,9 @@ exports.toBulkUploadResultsTab = toBulkUploadResultsTab;
|
|
|
49
49
|
const MISSING_RECEIPTS_TABS = ['missing', 'completed', 'unmatched'];
|
|
50
50
|
const toMissingReceiptsTab = (v) => (0, stringToUnion_1.stringToUnion)(v.trim().toLowerCase(), MISSING_RECEIPTS_TABS);
|
|
51
51
|
exports.toMissingReceiptsTab = toMissingReceiptsTab;
|
|
52
|
+
const COMPLETED_SUB_TABS = ['all', 'ai_accountant', 'manual'];
|
|
53
|
+
const toCompletedSubTab = (v) => (0, stringToUnion_1.stringToUnion)(v.trim().toLowerCase(), COMPLETED_SUB_TABS);
|
|
54
|
+
exports.toCompletedSubTab = toCompletedSubTab;
|
|
52
55
|
const MATCH_SOURCES = ['ai', 'manual'];
|
|
53
56
|
const toMatchSource = (v) => (0, stringToUnion_1.stringToUnion)(v.trim().toLowerCase(), MATCH_SOURCES);
|
|
54
57
|
exports.toMatchSource = toMatchSource;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Amount } from '../../../commonStateTypes/amount';
|
|
2
|
-
import {
|
|
2
|
+
import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
|
|
3
3
|
import { Recommendation, RecommendationWithCOT } from '../../../commonStateTypes/recommendationBase';
|
|
4
4
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
5
5
|
import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
@@ -7,18 +7,15 @@ import { PageToken } from '../../../commonStateTypes/viewAndReport/viewAndReport
|
|
|
7
7
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
8
8
|
import { ClassBase } from '../../../entity/class/classState';
|
|
9
9
|
import { CustomerBase } from '../../../entity/customer/customerState';
|
|
10
|
-
import { Entity, EntityType } from '../../../entity/genericEntity/entity';
|
|
11
10
|
import { ProjectBase } from '../../../entity/project/projectState';
|
|
11
|
+
import { Entity, EntityType } from '../../../entity/genericEntity/entity';
|
|
12
12
|
import { TransactionID } from '../../../entity/transaction/stateTypes/transaction';
|
|
13
13
|
import { BillableStatus, CategorizationStatusType, PlatformLineDetailType, ProductOrService, TransactionLineBase } from '../../../entity/transaction/stateTypes/transactionLine';
|
|
14
14
|
import { TransactionCategory, TransactionType } from '../../../entity/transaction/stateTypes/transactionType';
|
|
15
15
|
import { VendorBase } from '../../../entity/vendor/vendorState';
|
|
16
|
-
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
17
16
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
18
17
|
import { EntityRecommendationKey } from '../../recommendation/recommendationState';
|
|
19
|
-
import { TransactionFilters } from '../transactionFilterHelpers';
|
|
20
18
|
import { TransactionDetailKey } from '../../transactionDetail/transactionDetailState';
|
|
21
|
-
import { CompletedSubTab } from './completedSubTab';
|
|
22
19
|
export declare const toTransactionsSortKey: (v: string) => "date" | "amount" | "vendor" | "project" | "category" | "class" | "payment_account" | "transaction_type" | "memo_and_receipt";
|
|
23
20
|
export type TransactionsSortKey = ReturnType<typeof toTransactionsSortKey>;
|
|
24
21
|
export declare const TRANSACTIONS_TABS: readonly ["review", "autoCategorized"];
|
|
@@ -94,7 +91,6 @@ export interface SupportedTransactionCategorization {
|
|
|
94
91
|
}
|
|
95
92
|
export declare const initialSupportedTransactionCategorization: SupportedTransactionCategorization;
|
|
96
93
|
export interface TransactionsTabViewState extends FetchedState {
|
|
97
|
-
filters: TransactionFilters;
|
|
98
94
|
markAsNotMiscategorizedStatus: FetchStateAndError;
|
|
99
95
|
refreshStatus: FetchStateAndError;
|
|
100
96
|
saveStatus: FetchStateAndError;
|
|
@@ -107,44 +103,7 @@ export interface TransactionsTabViewState extends FetchedState {
|
|
|
107
103
|
selectedTransactionId?: ID;
|
|
108
104
|
selectedTransactionLineId?: ID;
|
|
109
105
|
}
|
|
110
|
-
/**
|
|
111
|
-
* Snapshot of the autoCategorized tab's paginated dataset for a single
|
|
112
|
-
* Completed sub-tab. Stored in {@link TransactionsViewState.autoCategorizedSubTabCache}
|
|
113
|
-
* so revisiting an already-loaded sub-tab can short-circuit the fetch epic
|
|
114
|
-
* (mirrors parent-tab caching). The snapshot is period-spanning — both the
|
|
115
|
-
* `totalCount` map and `transactionIdsBySelectedPeriod` map preserve every
|
|
116
|
-
* period the user has paged through under that sub-tab.
|
|
117
|
-
*
|
|
118
|
-
* `scrollPosition` is captured per sub-tab so revisiting a sub-tab restores
|
|
119
|
-
* the user's last scroll offset; switching to a fresh / never-visited sub-tab
|
|
120
|
-
* starts at the top instead of inheriting the previous sub-tab's offset.
|
|
121
|
-
*/
|
|
122
|
-
export interface AutoCategorizedSubTabSnapshot {
|
|
123
|
-
error: ZeniAPIStatus | undefined;
|
|
124
|
-
fetchState: FetchState;
|
|
125
|
-
pageToken: PageToken;
|
|
126
|
-
scrollPosition: TransactionsViewUIState['scrollPosition'];
|
|
127
|
-
totalCount: Record<MonthYearPeriodId, number>;
|
|
128
|
-
transactionIdsBySelectedPeriod: Record<MonthYearPeriodId, ID[]>;
|
|
129
|
-
}
|
|
130
106
|
export type TransactionsViewState = {
|
|
131
|
-
/**
|
|
132
|
-
* Per-sub-tab snapshot cache for the Completed (autoCategorized) tab. Keyed
|
|
133
|
-
* by {@link CompletedSubTab}. Populated as the user navigates between
|
|
134
|
-
* sub-tabs and consulted on every switch — the active autoCategorized slot
|
|
135
|
-
* is restored from here when a snapshot exists, otherwise it is reset and
|
|
136
|
-
* the fetch epic loads page 1 fresh.
|
|
137
|
-
*/
|
|
138
|
-
autoCategorizedSubTabCache: Partial<Record<CompletedSubTab, AutoCategorizedSubTabSnapshot>>;
|
|
139
|
-
/**
|
|
140
|
-
* Period-keyed parent tab counts, scoped per {@link TransactionsTab}.
|
|
141
|
-
* Sourced from the listing response's `parent_tab_total_count` and used
|
|
142
|
-
* exclusively to drive the parent tab badges on the UI — every other
|
|
143
|
-
* count consumer (pagination, sub-tab chips, in-tab "showing X of Y")
|
|
144
|
-
* keeps reading from {@link TransactionsViewUIState.totalCount}.
|
|
145
|
-
*/
|
|
146
|
-
parentTotalCountByTab: Record<TransactionsTab, Record<MonthYearPeriodId, number>>;
|
|
147
|
-
selectedTransactionCategorizationCompletedSubTab: CompletedSubTab;
|
|
148
107
|
selectedTransactionCategorizationTab: TransactionsTab;
|
|
149
108
|
transactionCategorizationView: Record<TransactionsTab, TransactionsTabViewState>;
|
|
150
109
|
};
|
|
@@ -5,7 +5,6 @@ const toolkit_1 = require("@reduxjs/toolkit");
|
|
|
5
5
|
const coaBalanceType_1 = require("../../commonStateTypes/coaBalance/coaBalanceType");
|
|
6
6
|
const coaBalancesFilter_1 = require("../../commonStateTypes/coaBalance/coaBalancesFilter");
|
|
7
7
|
const coaBalancesFilterClassesView_1 = require("../../commonStateTypes/coaBalance/coaBalancesFilterClassesView");
|
|
8
|
-
const coaBalancesFilterProjectView_1 = require("../../commonStateTypes/coaBalance/coaBalancesFilterProjectView");
|
|
9
8
|
const dataAvailable_1 = require("../../commonStateTypes/dataAvailable");
|
|
10
9
|
const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
|
|
11
10
|
const timeframeTick_1 = require("../../commonStateTypes/timeframeTick");
|
|
@@ -13,6 +12,7 @@ const thisPeriodHelpers_1 = require("../../commonStateTypes/viewAndReport/thisPe
|
|
|
13
12
|
const balanceSheetSelector_1 = require("../balanceSheet/balanceSheetSelector");
|
|
14
13
|
const cashFlowSelector_1 = require("../cashFlow/cashFlowSelector");
|
|
15
14
|
const profitAndLossSelector_1 = require("../profitAndLoss/profitAndLossSelector");
|
|
15
|
+
const coaBalancesFilterProjectView_1 = require("../../commonStateTypes/coaBalance/coaBalancesFilterProjectView");
|
|
16
16
|
const profitAndLossClassesByClassHorizontalSelector_1 = require("../profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector");
|
|
17
17
|
const profitAndLossClassesViewSelector_1 = require("../profitAndLossClassesView/profitAndLossClassesViewSelector");
|
|
18
18
|
const profitAndLossProjectViewSelector_1 = require("../profitAndLossProjectView/profitAndLossProjectViewSelector");
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { SectionProjectViewReport } from '../../entity/sectionProjectView/sectionProjectViewSelectorTypes';
|
|
1
2
|
import { COABalancesFilterProjectView } from '../../commonStateTypes/coaBalance/coaBalancesFilterProjectView';
|
|
2
3
|
import { ID } from '../../commonStateTypes/common';
|
|
3
4
|
import { DataAvailable } from '../../commonStateTypes/dataAvailable';
|
|
4
5
|
import { CalculatedSection } from '../../commonStateTypes/selectorTypes/selectorTypes';
|
|
5
6
|
import { SelectorReport } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
6
7
|
import { Project } from '../../entity/project/projectState';
|
|
7
|
-
import { SectionProjectViewReport } from '../../entity/sectionProjectView/sectionProjectViewSelectorTypes';
|
|
8
8
|
import { PandLReportViewCalculatedSectionID, PandLReportViewSectionID } from '../profitAndLossClassesView/profitAndLossClassesViewSelectorTypes';
|
|
9
9
|
import { ProfitAndLossProjectViewUIState } from './profitAndLossProjectViewState';
|
|
10
10
|
export interface ProfitAndLossProjectViewReport extends SelectorReport {
|
|
@@ -45,7 +45,7 @@ export interface BillPayFilters {
|
|
|
45
45
|
}
|
|
46
46
|
export interface BillPayFilterCategory {
|
|
47
47
|
field: BillListViewFilterCategoryField;
|
|
48
|
-
matchingOperator: 'equal' | '
|
|
48
|
+
matchingOperator: 'equal' | 'not-equal';
|
|
49
49
|
values: (string | ZeniDate)[];
|
|
50
50
|
valuesCombinationOperator: 'ANY';
|
|
51
51
|
}
|
|
@@ -2,9 +2,7 @@ import { ZeniAPIStatus } from '../../../../responsePayload';
|
|
|
2
2
|
import { ChargeCardCashbackPayload } from './cashbackDetailPayload';
|
|
3
3
|
import { CashbackDetailState, CashbackDetailUIState } from './cashbackDetailState';
|
|
4
4
|
export declare const initialState: CashbackDetailState;
|
|
5
|
-
export declare const fetchCashbackDetail: import("@reduxjs/toolkit").
|
|
6
|
-
cacheOverride: boolean;
|
|
7
|
-
}, "cashbackDetail/fetchCashbackDetail", never, never>, updateCashbackDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<ChargeCardCashbackPayload, "cashbackDetail/updateCashbackDetail">, updateCashbackDetailFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "cashbackDetail/updateCashbackDetailFailure">, updateCashbackDetailUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
5
|
+
export declare const fetchCashbackDetail: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"cashbackDetail/fetchCashbackDetail">, updateCashbackDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<ChargeCardCashbackPayload, "cashbackDetail/updateCashbackDetail">, updateCashbackDetailFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "cashbackDetail/updateCashbackDetailFailure">, updateCashbackDetailUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
8
6
|
uiState: Partial<CashbackDetailUIState>;
|
|
9
7
|
}, "cashbackDetail/updateCashbackDetailUIState">, clearCashbackDetail: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"cashbackDetail/clearCashbackDetail">;
|
|
10
8
|
declare const _default: import("redux").Reducer<CashbackDetailState>;
|
|
@@ -5,7 +5,6 @@ exports.clearCashbackDetail = exports.updateCashbackDetailUIState = exports.upda
|
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const viewAndReportPayloadv2_1 = require("../../../../commonPayloadTypes/v2/viewAndReportPayloadv2");
|
|
7
7
|
const amount_1 = require("../../../../commonStateTypes/amount");
|
|
8
|
-
const cacheOverrideFetchReducer_1 = require("../../../../commonStateTypes/cacheOverrideFetchReducer");
|
|
9
8
|
const cashbackDetailState_1 = require("./cashbackDetailState");
|
|
10
9
|
exports.initialState = {
|
|
11
10
|
fetchState: 'Not-Started',
|
|
@@ -32,10 +31,10 @@ const cashbackDetail = (0, toolkit_1.createSlice)({
|
|
|
32
31
|
name: 'cashbackDetail',
|
|
33
32
|
initialState: exports.initialState,
|
|
34
33
|
reducers: {
|
|
35
|
-
fetchCashbackDetail
|
|
34
|
+
fetchCashbackDetail(draft) {
|
|
36
35
|
draft.fetchState = 'In-Progress';
|
|
37
36
|
draft.error = undefined;
|
|
38
|
-
}
|
|
37
|
+
},
|
|
39
38
|
updateCashbackDetail(draft, action) {
|
|
40
39
|
draft.cashbackByPeriod = toCashbackByPeriod(action.payload);
|
|
41
40
|
draft.cashbackSummary = toCashbackSummary(action.payload);
|