@zeniai/client-epic-state 5.0.70 → 5.0.71-betaAK1
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/commonStateTypes/amount.d.ts +1 -0
- package/lib/commonStateTypes/amount.js +3 -1
- package/lib/commonStateTypes/cacheOverrideFetchReducer.d.ts +17 -0
- package/lib/commonStateTypes/cacheOverrideFetchReducer.js +20 -0
- package/lib/commonStateTypes/pusherActions.d.ts +11 -0
- package/lib/commonStateTypes/pusherActions.js +6 -0
- package/lib/coreEpics.js +1 -1
- package/lib/entity/account/accountSelector.d.ts +1 -1
- package/lib/entity/account/accountState.d.ts +1 -1
- package/lib/entity/account/subAccountSelector.d.ts +1 -1
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +1 -3
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +1 -2
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +1 -1
- package/lib/entity/chargeCard/chargeCardReducer.d.ts +19 -2
- package/lib/entity/chargeCard/chargeCardReducer.js +35 -2
- package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.d.ts +14 -1
- package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.js +36 -2
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +1 -1
- package/lib/entity/sectionProjectView/sectionProjectViewSelector.js +1 -1
- package/lib/entity/tenant/SessionManager.js +6 -3
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -2
- package/lib/entity/tenant/clearAllEpic.js +2 -2
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.js +6 -2
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.js +6 -2
- package/lib/entity/tenant/tenantReducer.js +6 -1
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +3 -1
- package/lib/entity/upcomingPaymentEvent/upcomingPaymentEventPayload.d.ts +11 -0
- package/lib/entity/upcomingPaymentEvent/upcomingPaymentEventPayload.js +23 -0
- package/lib/entity/upcomingPaymentEvent/upcomingPaymentEventReducer.d.ts +6 -0
- package/lib/entity/upcomingPaymentEvent/upcomingPaymentEventReducer.js +31 -0
- package/lib/entity/upcomingPaymentEvent/upcomingPaymentEventSelector.d.ts +4 -0
- package/lib/entity/upcomingPaymentEvent/upcomingPaymentEventSelector.js +16 -0
- package/lib/entity/upcomingPaymentEvent/upcomingPaymentEventState.d.ts +13 -0
- package/lib/entity/upcomingPaymentEvent/upcomingPaymentEventState.js +2 -0
- package/lib/epic.d.ts +13 -10
- package/lib/epic.js +14 -11
- package/lib/esm/commonStateTypes/amount.js +1 -0
- package/lib/esm/commonStateTypes/cacheOverrideFetchReducer.js +16 -0
- package/lib/esm/commonStateTypes/pusherActions.js +3 -0
- package/lib/esm/coreEpics.js +1 -1
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +1 -3
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +1 -2
- package/lib/esm/entity/chargeCard/chargeCardReducer.js +34 -1
- package/lib/esm/entity/chargeCardTransaction/chargeCardTransactionReducer.js +35 -1
- package/lib/esm/entity/sectionProjectView/sectionProjectViewSelector.js +1 -1
- package/lib/esm/entity/tenant/SessionManager.js +4 -1
- package/lib/esm/entity/tenant/clearAllEpic.js +2 -2
- package/lib/esm/entity/tenant/epic/saveAPIKeyConnectionEpic.js +6 -2
- package/lib/esm/entity/tenant/epic/saveOAuthConnectionEpic.js +6 -2
- package/lib/esm/entity/tenant/tenantReducer.js +6 -1
- package/lib/esm/entity/transaction/payloadTypes/transactionLinePayload.js +3 -1
- package/lib/esm/entity/upcomingPaymentEvent/upcomingPaymentEventPayload.js +19 -0
- package/lib/esm/entity/upcomingPaymentEvent/upcomingPaymentEventReducer.js +27 -0
- package/lib/esm/entity/upcomingPaymentEvent/upcomingPaymentEventSelector.js +11 -0
- package/lib/esm/entity/upcomingPaymentEvent/upcomingPaymentEventState.js +1 -0
- package/lib/esm/epic.js +14 -11
- package/lib/esm/index.js +19 -13
- package/lib/esm/reducer.js +8 -2
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +2 -5
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +2 -5
- package/lib/esm/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +4 -1
- package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
- package/lib/esm/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +1 -1
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +2 -1
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +8 -6
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -1
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +11 -1
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -1
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +127 -1
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +20 -1
- package/lib/esm/view/expenseAutomationView/types/completedSubTab.js +17 -0
- package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +0 -2
- package/lib/esm/view/financeStatement/financeStatementSelector.js +1 -1
- package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.js +1 -0
- package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer.js +82 -0
- package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.js +93 -0
- package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewState.js +14 -0
- package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.js +6 -0
- package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementOverviewPageEpic.js +42 -0
- package/lib/esm/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchUpcomingPaymentEventsEpic.js +22 -0
- package/lib/esm/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +3 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +3 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +55 -18
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +16 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +5 -4
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +26 -9
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +9 -6
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +3 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
- package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +7 -3
- package/lib/esm/view/spendManagement/commonHistoryView/commonHistoryPayload.js +1 -0
- 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/transactionDetail/transactionDetailSelector.js +7 -1
- package/lib/index.d.ts +22 -15
- package/lib/index.js +77 -58
- package/lib/reducer.d.ts +8 -2
- package/lib/reducer.js +8 -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 +2 -5
- package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +2 -5
- package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +4 -1
- package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.d.ts +1 -1
- package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +2 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +8 -6
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +10 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +21 -0
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +2 -1
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +9 -3
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +128 -2
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +2 -1
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +14 -0
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +20 -1
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +10 -0
- package/lib/view/expenseAutomationView/types/completedSubTab.js +21 -0
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -2
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +1 -4
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +41 -2
- package/lib/view/financeStatement/financeStatementSelector.js +1 -1
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.d.ts +1 -1
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.d.ts +10 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewPayload.js +2 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer.d.ts +20 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewReducer.js +86 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.d.ts +20 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewSelector.js +98 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewState.d.ts +21 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/cashManagementOverviewState.js +17 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.d.ts +5 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementBannerEpic.js +10 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementOverviewPageEpic.d.ts +9 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchCashManagementOverviewPageEpic.js +46 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchUpcomingPaymentEventsEpic.d.ts +8 -0
- package/lib/view/spendManagement/cashManagement/cashManagementOverview/epics/fetchUpcomingPaymentEventsEpic.js +26 -0
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +3 -2
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +3 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +55 -18
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +16 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +5 -4
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +18 -3
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +27 -10
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +9 -6
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +3 -2
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +7 -3
- package/lib/view/spendManagement/commonHistoryView/commonHistory.d.ts +1 -0
- package/lib/view/spendManagement/commonHistoryView/commonHistoryPayload.d.ts +1 -0
- package/lib/view/spendManagement/commonHistoryView/commonHistoryPayload.js +1 -0
- package/lib/view/transactionDetail/transactionDetailSelector.js +7 -1
- package/lib/view/zeniOAuthView/zeniOAuthSelector.d.ts +1 -1
- package/package.json +9 -4
|
@@ -4,13 +4,14 @@ 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.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"));
|
|
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");
|
|
14
15
|
exports.initialTransactionTabViewState = {
|
|
15
16
|
saveStatus: {
|
|
16
17
|
fetchState: 'Not-Started',
|
|
@@ -48,12 +49,74 @@ exports.initialTransactionTabViewState = {
|
|
|
48
49
|
selectedTransactionLineId: undefined,
|
|
49
50
|
};
|
|
50
51
|
exports.initialState = {
|
|
52
|
+
autoCategorizedSubTabCache: {},
|
|
53
|
+
parentTotalCountByTab: {
|
|
54
|
+
review: {},
|
|
55
|
+
autoCategorized: {},
|
|
56
|
+
},
|
|
51
57
|
selectedTransactionCategorizationTab: 'review',
|
|
58
|
+
selectedTransactionCategorizationCompletedSubTab: completedSubTab_1.DEFAULT_COMPLETED_SUB_TAB,
|
|
52
59
|
transactionCategorizationView: {
|
|
53
60
|
review: { ...exports.initialTransactionTabViewState },
|
|
54
61
|
autoCategorized: { ...exports.initialTransactionTabViewState },
|
|
55
62
|
},
|
|
56
63
|
};
|
|
64
|
+
/**
|
|
65
|
+
* Capture the autoCategorized tab's current paginated dataset for a sub-tab.
|
|
66
|
+
* The mid-flight `'In-Progress'` state is normalised to `'Completed'` because
|
|
67
|
+
* the in-flight request is cancelled by `switchMap` in the fetch epic when the
|
|
68
|
+
* sub-tab changes — restoring `'In-Progress'` later would leave the UI stuck
|
|
69
|
+
* showing a phantom loading state with no fetch actually running. Length-zero
|
|
70
|
+
* datasets degrade to `'Not-Started'` so the next visit triggers a fresh
|
|
71
|
+
* fetch from page 1 instead of short-circuiting on stale empty caches.
|
|
72
|
+
*
|
|
73
|
+
* Snapshot scope (deliberately narrow):
|
|
74
|
+
* - Captured: `pageToken`, `totalCount`, `transactionIdsBySelectedPeriod`,
|
|
75
|
+
* `fetchState`, `error`, `scrollPosition`. The first five are the keys the
|
|
76
|
+
* fetch epic's cache check reads to decide whether to short-circuit a
|
|
77
|
+
* sub-tab revisit; `scrollPosition` is captured per sub-tab so revisiting
|
|
78
|
+
* restores the user's last offset and switching to a never-visited sub-tab
|
|
79
|
+
* starts at the top instead of inheriting the outgoing sub-tab's offset
|
|
80
|
+
* (which would land the user at a meaningless row index against a
|
|
81
|
+
* completely different list).
|
|
82
|
+
* - Intentionally NOT captured (left in place on `autoCat` and inherited by
|
|
83
|
+
* the incoming sub-tab):
|
|
84
|
+
* - `uiState.searchString`, `uiState.sortKey`, `uiState.sortOrder`,
|
|
85
|
+
* `uiState.nodeCollapseState`, `uiState.limit` — search and sort are
|
|
86
|
+
* user-applied preferences that persist across sub-tabs by design (a
|
|
87
|
+
* search query stays active when the user toggles between Manual / AI
|
|
88
|
+
* Accountant).
|
|
89
|
+
* - `selectedCheckBoxTransactionIds` — selection state is intentionally
|
|
90
|
+
* cleared at the action source (the fetch epic / save flow), not
|
|
91
|
+
* by the snapshot path. Carrying selection across sub-tabs is safe
|
|
92
|
+
* because every sub-tab change goes through a fetch round-trip that
|
|
93
|
+
* reconciles selection against the new row IDs.
|
|
94
|
+
* - `transactionReviewLocalDataById`, `transactionIdsWithUnsavedData`,
|
|
95
|
+
* `uploadReceiptStatusById`, `saveStatus`, `refreshStatus`,
|
|
96
|
+
* `markAsNotMiscategorizedStatus` — these are per-row / per-flight
|
|
97
|
+
* caches that are write-through global state, not sub-tab-scoped.
|
|
98
|
+
*
|
|
99
|
+
* If the contract changes (e.g. selection should reset on every sub-tab
|
|
100
|
+
* switch), update both this comment and the snapshot return shape together.
|
|
101
|
+
*/
|
|
102
|
+
function snapshotAutoCategorizedTab(autoCat) {
|
|
103
|
+
const transactionIdsBySelectedPeriod = {
|
|
104
|
+
...autoCat.transactionIdsBySelectedPeriod,
|
|
105
|
+
};
|
|
106
|
+
const hasAnyLoadedRows = Object.values(transactionIdsBySelectedPeriod).some((ids) => ids.length > 0);
|
|
107
|
+
let normalisedFetchState = autoCat.fetchState;
|
|
108
|
+
if (normalisedFetchState === 'In-Progress') {
|
|
109
|
+
normalisedFetchState = hasAnyLoadedRows ? 'Completed' : 'Not-Started';
|
|
110
|
+
}
|
|
111
|
+
return {
|
|
112
|
+
error: autoCat.error,
|
|
113
|
+
fetchState: normalisedFetchState,
|
|
114
|
+
pageToken: autoCat.uiState.pageToken,
|
|
115
|
+
scrollPosition: autoCat.uiState.scrollPosition,
|
|
116
|
+
totalCount: { ...autoCat.uiState.totalCount },
|
|
117
|
+
transactionIdsBySelectedPeriod,
|
|
118
|
+
};
|
|
119
|
+
}
|
|
57
120
|
const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
58
121
|
name: 'expenseAutomationTransactionsView',
|
|
59
122
|
initialState: exports.initialState,
|
|
@@ -267,6 +330,55 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
267
330
|
return { payload: { newSelectedTab } };
|
|
268
331
|
},
|
|
269
332
|
},
|
|
333
|
+
updateTransactionCategorizationCompletedSubTab: {
|
|
334
|
+
reducer(draft, action) {
|
|
335
|
+
const { newSubTab } = action.payload;
|
|
336
|
+
const previousSubTab = draft.selectedTransactionCategorizationCompletedSubTab;
|
|
337
|
+
if (previousSubTab === newSubTab) {
|
|
338
|
+
return;
|
|
339
|
+
}
|
|
340
|
+
const autoCat = draft.transactionCategorizationView.autoCategorized;
|
|
341
|
+
// Snapshot the outgoing sub-tab so a future revisit can short-circuit
|
|
342
|
+
// the fetch epic (mirrors the parent-tab "don't refetch what's
|
|
343
|
+
// already cached" behaviour). Period-scoped data is preserved as-is
|
|
344
|
+
// because the snapshot itself is keyed only by sub-tab; the active
|
|
345
|
+
// tab's per-period maps remain the source of truth while live.
|
|
346
|
+
draft.autoCategorizedSubTabCache[previousSubTab] =
|
|
347
|
+
snapshotAutoCategorizedTab(autoCat);
|
|
348
|
+
const cached = draft.autoCategorizedSubTabCache[newSubTab];
|
|
349
|
+
if (cached != null) {
|
|
350
|
+
autoCat.uiState.pageToken = cached.pageToken;
|
|
351
|
+
autoCat.uiState.totalCount = { ...cached.totalCount };
|
|
352
|
+
autoCat.uiState.scrollPosition = cached.scrollPosition;
|
|
353
|
+
autoCat.transactionIdsBySelectedPeriod = {
|
|
354
|
+
...cached.transactionIdsBySelectedPeriod,
|
|
355
|
+
};
|
|
356
|
+
autoCat.fetchState = cached.fetchState;
|
|
357
|
+
autoCat.error = cached.error;
|
|
358
|
+
}
|
|
359
|
+
else {
|
|
360
|
+
// Sub-tab has never been visited — clear the active slot so the
|
|
361
|
+
// view-epic's `fetchState === 'Not-Started' || transactionIds.length
|
|
362
|
+
// === 0` cache check falls through and triggers a fresh page-1
|
|
363
|
+
// fetch for the new dataset. `scrollPosition` is reset to the top
|
|
364
|
+
// so the incoming list isn't anchored to the outgoing sub-tab's
|
|
365
|
+
// offset (different rows → previous offset is meaningless).
|
|
366
|
+
autoCat.uiState.pageToken = null;
|
|
367
|
+
autoCat.uiState.totalCount = {};
|
|
368
|
+
autoCat.uiState.scrollPosition = {
|
|
369
|
+
scrollTop: 0,
|
|
370
|
+
scrollLeft: undefined,
|
|
371
|
+
};
|
|
372
|
+
autoCat.transactionIdsBySelectedPeriod = {};
|
|
373
|
+
autoCat.fetchState = 'Not-Started';
|
|
374
|
+
autoCat.error = undefined;
|
|
375
|
+
}
|
|
376
|
+
draft.selectedTransactionCategorizationCompletedSubTab = newSubTab;
|
|
377
|
+
},
|
|
378
|
+
prepare(newSubTab) {
|
|
379
|
+
return { payload: { newSubTab } };
|
|
380
|
+
},
|
|
381
|
+
},
|
|
270
382
|
updateTransactionCategorization: {
|
|
271
383
|
reducer(draft, action) {
|
|
272
384
|
const selectedTab = action.payload.selectedTab;
|
|
@@ -704,6 +816,10 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
704
816
|
const { selectedTab, selectedPeriod, totalCount } = action.payload;
|
|
705
817
|
draft.transactionCategorizationView[selectedTab].uiState.totalCount[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = totalCount;
|
|
706
818
|
},
|
|
819
|
+
updateParentTotalCountForTab(draft, action) {
|
|
820
|
+
const { selectedTab, selectedPeriod, parentTotalCount } = action.payload;
|
|
821
|
+
draft.parentTotalCountByTab[selectedTab][(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = parentTotalCount;
|
|
822
|
+
},
|
|
707
823
|
updateSelectedCheckboxTransactionIds(draft, action) {
|
|
708
824
|
const selectedTab = action.payload.selectedTab;
|
|
709
825
|
const transactionIds = action.payload.transactionIds;
|
|
@@ -714,6 +830,16 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
714
830
|
draft.transactionCategorizationView[selectedTab] = {
|
|
715
831
|
...exports.initialTransactionTabViewState,
|
|
716
832
|
};
|
|
833
|
+
draft.parentTotalCountByTab[selectedTab] = {};
|
|
834
|
+
// The per-sub-tab snapshot cache lives at the slice root and is
|
|
835
|
+
// exclusively populated by the autoCategorized tab's sub-tab switching
|
|
836
|
+
// (see updateTransactionCategorizationCompletedSubTab). When that tab
|
|
837
|
+
// is reset, leaving stale snapshots behind would short-circuit the
|
|
838
|
+
// next sub-tab visit with phantom row IDs / page tokens that no longer
|
|
839
|
+
// correspond to anything in state — drop them in lockstep.
|
|
840
|
+
if (selectedTab === 'autoCategorized') {
|
|
841
|
+
draft.autoCategorizedSubTabCache = {};
|
|
842
|
+
}
|
|
717
843
|
},
|
|
718
844
|
clearExpenseAutomationTransactionsView(draft) {
|
|
719
845
|
Object.assign(draft, exports.initialState);
|
|
@@ -810,5 +936,5 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
810
936
|
},
|
|
811
937
|
},
|
|
812
938
|
});
|
|
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;
|
|
939
|
+
_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;
|
|
814
940
|
exports.default = expenseAutomationTransactionsView.reducer;
|
|
@@ -2,7 +2,8 @@ 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 {
|
|
5
|
+
import type { CompletedSubTab } from '../types/completedSubTab';
|
|
6
|
+
import type { BatchFileStatus, BatchListItem, BatchStatus, BulkUploadPhase, BulkUploadResultsTab, BulkUploadSortKey, ManualSearchState, MatchSource, MissingReceiptsViewUIState } from '../types/missingReceiptsViewState';
|
|
6
7
|
export interface CompletedTransactionsSelectorData {
|
|
7
8
|
fetchState: FetchStateAndError;
|
|
8
9
|
nextPageToken: string | null;
|
|
@@ -7,6 +7,7 @@ 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';
|
|
10
11
|
import { TransactionReviewLocalData, TransactionsTab, TransactionsViewUIState } from '../types/transactionsViewState';
|
|
11
12
|
export interface TransactionReviewLocalDataSelectorView {
|
|
12
13
|
transactionId: ID;
|
|
@@ -21,10 +22,23 @@ export interface ExpenseAutomationTransactionViewSelector extends SelectorView {
|
|
|
21
22
|
fetchStateByTransactionTabs: Record<TransactionsTab, FetchStateAndError>;
|
|
22
23
|
isAccountingProjectsEnabled: boolean;
|
|
23
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>;
|
|
24
32
|
projectList: ProjectListSelectorView;
|
|
25
33
|
refreshStatus: FetchStateAndError;
|
|
26
34
|
saveStatus: FetchStateAndError;
|
|
27
35
|
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
|
+
*/
|
|
28
42
|
totalCountByTab: Record<TransactionsTab, number>;
|
|
29
43
|
transactionIdsWithUnsavedData: ID[];
|
|
30
44
|
transactionLocalData: TransactionReviewLocalDataSelectorView[];
|
|
@@ -16,7 +16,7 @@ const projectListSelector_1 = require("../../projectList/projectListSelector");
|
|
|
16
16
|
const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
|
|
17
17
|
function getExpenseAutomationTransactionView(state) {
|
|
18
18
|
const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, projectState, projectListState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
|
|
19
|
-
const { selectedTransactionCategorizationTab } = expenseAutomationTransactionsViewState;
|
|
19
|
+
const { selectedTransactionCategorizationCompletedSubTab, selectedTransactionCategorizationTab, } = expenseAutomationTransactionsViewState;
|
|
20
20
|
const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
|
|
21
21
|
const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(accountState, accountListState, 'accountList');
|
|
22
22
|
const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
|
|
@@ -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,9 +131,11 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
114
131
|
markAsNotMiscategorizedStatus,
|
|
115
132
|
completionStatus,
|
|
116
133
|
totalCountByTab,
|
|
134
|
+
parentTabTotalCountByTab,
|
|
117
135
|
fetchStateByTransactionTabs: fetchStateByTab,
|
|
118
136
|
uploadReceiptStatusById,
|
|
119
137
|
selectedTransactionId,
|
|
120
138
|
selectedTransactionLineId,
|
|
139
|
+
selectedTransactionCategorizationCompletedSubTab,
|
|
121
140
|
};
|
|
122
141
|
}
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export declare const toCompletedSubTab: (v: string) => "all" | "manual" | "ai_accountant";
|
|
2
|
+
export type CompletedSubTab = ReturnType<typeof toCompletedSubTab>;
|
|
3
|
+
/**
|
|
4
|
+
* "No sub-tab filter" sentinel — single source of truth for the default
|
|
5
|
+
* value of {@link CompletedSubTab}. Use this constant in initial slice
|
|
6
|
+
* state and at any call site that needs to fall back to the parent-tab
|
|
7
|
+
* listing semantics (review tab requests, manual-search overrides, etc.)
|
|
8
|
+
* so a future rename of the union doesn't require chasing literals.
|
|
9
|
+
*/
|
|
10
|
+
export declare const DEFAULT_COMPLETED_SUB_TAB: CompletedSubTab;
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.DEFAULT_COMPLETED_SUB_TAB = exports.toCompletedSubTab = void 0;
|
|
4
|
+
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
5
|
+
/**
|
|
6
|
+
* Sub-tabs that can appear under any "Completed" tab in the Expense Automation
|
|
7
|
+
* surface (Transaction Categorization Completed and Missing Receipts Completed
|
|
8
|
+
* both use this exact union). Forwarded verbatim to listing APIs as `sub_tab`
|
|
9
|
+
* / `match_type`. `'all'` preserves parent-tab semantics on the backend.
|
|
10
|
+
*/
|
|
11
|
+
const COMPLETED_SUB_TABS = ['all', 'ai_accountant', 'manual'];
|
|
12
|
+
const toCompletedSubTab = (v) => (0, stringToUnion_1.stringToUnion)(v.trim().toLowerCase(), COMPLETED_SUB_TABS);
|
|
13
|
+
exports.toCompletedSubTab = toCompletedSubTab;
|
|
14
|
+
/**
|
|
15
|
+
* "No sub-tab filter" sentinel — single source of truth for the default
|
|
16
|
+
* value of {@link CompletedSubTab}. Use this constant in initial slice
|
|
17
|
+
* state and at any call site that needs to fall back to the parent-tab
|
|
18
|
+
* listing semantics (review tab requests, manual-search overrides, etc.)
|
|
19
|
+
* so a future rename of the union doesn't require chasing literals.
|
|
20
|
+
*/
|
|
21
|
+
exports.DEFAULT_COMPLETED_SUB_TAB = 'all';
|
|
@@ -1,6 +1,7 @@
|
|
|
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';
|
|
4
5
|
export declare const toMissingReceiptsSortKey: (v: string) => "date" | "amount" | "vendor" | "category" | "class";
|
|
5
6
|
export type MissingReceiptsSortKey = ReturnType<typeof toMissingReceiptsSortKey>;
|
|
6
7
|
export interface MissingReceiptsViewUIState {
|
|
@@ -31,8 +32,6 @@ export declare const toBulkUploadResultsTab: (v: string) => "completed" | "unmat
|
|
|
31
32
|
export type BulkUploadResultsTab = ReturnType<typeof toBulkUploadResultsTab>;
|
|
32
33
|
export declare const toMissingReceiptsTab: (v: string) => "completed" | "unmatched" | "missing";
|
|
33
34
|
export type MissingReceiptsTab = ReturnType<typeof toMissingReceiptsTab>;
|
|
34
|
-
export declare const toCompletedSubTab: (v: string) => "all" | "manual" | "ai_accountant";
|
|
35
|
-
export type CompletedSubTab = ReturnType<typeof toCompletedSubTab>;
|
|
36
35
|
export declare const toMatchSource: (v: string) => "manual" | "ai";
|
|
37
36
|
export type MatchSource = ReturnType<typeof toMatchSource>;
|
|
38
37
|
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.
|
|
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;
|
|
4
4
|
exports.isUnmatchedTabFileStatus = isUnmatchedTabFileStatus;
|
|
5
5
|
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
6
6
|
const MISSING_RECEIPTS_SORT_KEYS = [
|
|
@@ -49,9 +49,6 @@ 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;
|
|
55
52
|
const MATCH_SOURCES = ['ai', 'manual'];
|
|
56
53
|
const toMatchSource = (v) => (0, stringToUnion_1.stringToUnion)(v.trim().toLowerCase(), MATCH_SOURCES);
|
|
57
54
|
exports.toMatchSource = toMatchSource;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Amount } from '../../../commonStateTypes/amount';
|
|
2
|
-
import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
|
|
2
|
+
import { FetchState, 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,15 +7,17 @@ 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 { ProjectBase } from '../../../entity/project/projectState';
|
|
11
10
|
import { Entity, EntityType } from '../../../entity/genericEntity/entity';
|
|
11
|
+
import { ProjectBase } from '../../../entity/project/projectState';
|
|
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';
|
|
16
17
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
17
18
|
import { EntityRecommendationKey } from '../../recommendation/recommendationState';
|
|
18
19
|
import { TransactionDetailKey } from '../../transactionDetail/transactionDetailState';
|
|
20
|
+
import { CompletedSubTab } from './completedSubTab';
|
|
19
21
|
export declare const toTransactionsSortKey: (v: string) => "date" | "amount" | "vendor" | "project" | "category" | "class" | "payment_account" | "transaction_type" | "memo_and_receipt";
|
|
20
22
|
export type TransactionsSortKey = ReturnType<typeof toTransactionsSortKey>;
|
|
21
23
|
export declare const TRANSACTIONS_TABS: readonly ["review", "autoCategorized"];
|
|
@@ -103,7 +105,44 @@ export interface TransactionsTabViewState extends FetchedState {
|
|
|
103
105
|
selectedTransactionId?: ID;
|
|
104
106
|
selectedTransactionLineId?: ID;
|
|
105
107
|
}
|
|
108
|
+
/**
|
|
109
|
+
* Snapshot of the autoCategorized tab's paginated dataset for a single
|
|
110
|
+
* Completed sub-tab. Stored in {@link TransactionsViewState.autoCategorizedSubTabCache}
|
|
111
|
+
* so revisiting an already-loaded sub-tab can short-circuit the fetch epic
|
|
112
|
+
* (mirrors parent-tab caching). The snapshot is period-spanning — both the
|
|
113
|
+
* `totalCount` map and `transactionIdsBySelectedPeriod` map preserve every
|
|
114
|
+
* period the user has paged through under that sub-tab.
|
|
115
|
+
*
|
|
116
|
+
* `scrollPosition` is captured per sub-tab so revisiting a sub-tab restores
|
|
117
|
+
* the user's last scroll offset; switching to a fresh / never-visited sub-tab
|
|
118
|
+
* starts at the top instead of inheriting the previous sub-tab's offset.
|
|
119
|
+
*/
|
|
120
|
+
export interface AutoCategorizedSubTabSnapshot {
|
|
121
|
+
error: ZeniAPIStatus | undefined;
|
|
122
|
+
fetchState: FetchState;
|
|
123
|
+
pageToken: PageToken;
|
|
124
|
+
scrollPosition: TransactionsViewUIState['scrollPosition'];
|
|
125
|
+
totalCount: Record<MonthYearPeriodId, number>;
|
|
126
|
+
transactionIdsBySelectedPeriod: Record<MonthYearPeriodId, ID[]>;
|
|
127
|
+
}
|
|
106
128
|
export type TransactionsViewState = {
|
|
129
|
+
/**
|
|
130
|
+
* Per-sub-tab snapshot cache for the Completed (autoCategorized) tab. Keyed
|
|
131
|
+
* by {@link CompletedSubTab}. Populated as the user navigates between
|
|
132
|
+
* sub-tabs and consulted on every switch — the active autoCategorized slot
|
|
133
|
+
* is restored from here when a snapshot exists, otherwise it is reset and
|
|
134
|
+
* the fetch epic loads page 1 fresh.
|
|
135
|
+
*/
|
|
136
|
+
autoCategorizedSubTabCache: Partial<Record<CompletedSubTab, AutoCategorizedSubTabSnapshot>>;
|
|
137
|
+
/**
|
|
138
|
+
* Period-keyed parent tab counts, scoped per {@link TransactionsTab}.
|
|
139
|
+
* Sourced from the listing response's `parent_tab_total_count` and used
|
|
140
|
+
* exclusively to drive the parent tab badges on the UI — every other
|
|
141
|
+
* count consumer (pagination, sub-tab chips, in-tab "showing X of Y")
|
|
142
|
+
* keeps reading from {@link TransactionsViewUIState.totalCount}.
|
|
143
|
+
*/
|
|
144
|
+
parentTotalCountByTab: Record<TransactionsTab, Record<MonthYearPeriodId, number>>;
|
|
145
|
+
selectedTransactionCategorizationCompletedSubTab: CompletedSubTab;
|
|
107
146
|
selectedTransactionCategorizationTab: TransactionsTab;
|
|
108
147
|
transactionCategorizationView: Record<TransactionsTab, TransactionsTabViewState>;
|
|
109
148
|
};
|
|
@@ -5,6 +5,7 @@ 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");
|
|
8
9
|
const dataAvailable_1 = require("../../commonStateTypes/dataAvailable");
|
|
9
10
|
const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
|
|
10
11
|
const timeframeTick_1 = require("../../commonStateTypes/timeframeTick");
|
|
@@ -12,7 +13,6 @@ const thisPeriodHelpers_1 = require("../../commonStateTypes/viewAndReport/thisPe
|
|
|
12
13
|
const balanceSheetSelector_1 = require("../balanceSheet/balanceSheetSelector");
|
|
13
14
|
const cashFlowSelector_1 = require("../cashFlow/cashFlowSelector");
|
|
14
15
|
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';
|
|
2
1
|
import { COABalancesFilterProjectView } from '../../commonStateTypes/coaBalance/coaBalancesFilterProjectView';
|
|
3
2
|
import { ID } from '../../commonStateTypes/common';
|
|
4
3
|
import { DataAvailable } from '../../commonStateTypes/dataAvailable';
|
|
5
4
|
import { CalculatedSection } from '../../commonStateTypes/selectorTypes/selectorTypes';
|
|
6
5
|
import { SelectorReport } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
7
6
|
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 {
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { UpcomingPaymentEventPayload } from '../../../../entity/upcomingPaymentEvent/upcomingPaymentEventPayload';
|
|
2
|
+
import { ZeniAPIResponse } from '../../../../responsePayload';
|
|
3
|
+
export interface FetchUpcomingPaymentEventsPayload {
|
|
4
|
+
bill_stages: string[];
|
|
5
|
+
events: UpcomingPaymentEventPayload[];
|
|
6
|
+
horizon_days: number;
|
|
7
|
+
reimbursement_stages: string[];
|
|
8
|
+
tenant_namespace: string;
|
|
9
|
+
}
|
|
10
|
+
export type FetchUpcomingPaymentEventsResponse = ZeniAPIResponse<FetchUpcomingPaymentEventsPayload>;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { FetchState } from '../../../../commonStateTypes/common';
|
|
2
|
+
import { ZeniAPIStatus } from '../../../../responsePayload';
|
|
3
|
+
import { FetchUpcomingPaymentEventsPayload } from './cashManagementOverviewPayload';
|
|
4
|
+
import { CashManagementBannerData, CashManagementOverviewState } from './cashManagementOverviewState';
|
|
5
|
+
export declare const initialState: CashManagementOverviewState;
|
|
6
|
+
export declare const fetchCashManagementOverviewPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride: boolean], {
|
|
7
|
+
cacheOverride: boolean;
|
|
8
|
+
}, "cashManagementOverview/fetchCashManagementOverviewPage", never, never>, fetchUpcomingPaymentEvents: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"cashManagementOverview/fetchUpcomingPaymentEvents">, updateUpcomingPaymentEventsList: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
9
|
+
data: FetchUpcomingPaymentEventsPayload;
|
|
10
|
+
}, "cashManagementOverview/updateUpcomingPaymentEventsList">, updateUpcomingPaymentEventsListFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
11
|
+
fetchState: FetchState;
|
|
12
|
+
error?: ZeniAPIStatus;
|
|
13
|
+
}, "cashManagementOverview/updateUpcomingPaymentEventsListFetchStatus">, fetchCashManagementBanner: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"cashManagementOverview/fetchCashManagementBanner">, updateCashManagementBanner: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
14
|
+
data: CashManagementBannerData;
|
|
15
|
+
}, "cashManagementOverview/updateCashManagementBanner">, updateCashManagementBannerFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
16
|
+
fetchState: FetchState;
|
|
17
|
+
error?: ZeniAPIStatus;
|
|
18
|
+
}, "cashManagementOverview/updateCashManagementBannerFetchStatus">, clearCashManagementOverview: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"cashManagementOverview/clearCashManagementOverview">;
|
|
19
|
+
declare const _default: import("redux").Reducer<CashManagementOverviewState>;
|
|
20
|
+
export default _default;
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.clearCashManagementOverview = exports.updateCashManagementBannerFetchStatus = exports.updateCashManagementBanner = exports.fetchCashManagementBanner = exports.updateUpcomingPaymentEventsListFetchStatus = exports.updateUpcomingPaymentEventsList = exports.fetchUpcomingPaymentEvents = exports.fetchCashManagementOverviewPage = exports.initialState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const cashManagementOverviewState_1 = require("./cashManagementOverviewState");
|
|
7
|
+
exports.initialState = {
|
|
8
|
+
banner: cashManagementOverviewState_1.initialCashManagementBannerState,
|
|
9
|
+
upcomingPaymentEvents: cashManagementOverviewState_1.initialUpcomingPaymentEventsListState,
|
|
10
|
+
fetchState: 'Not-Started',
|
|
11
|
+
error: undefined,
|
|
12
|
+
hasValidState() {
|
|
13
|
+
return this.fetchState == 'Completed';
|
|
14
|
+
},
|
|
15
|
+
};
|
|
16
|
+
const cashManagementOverview = (0, toolkit_1.createSlice)({
|
|
17
|
+
name: 'cashManagementOverview',
|
|
18
|
+
initialState: exports.initialState,
|
|
19
|
+
reducers: {
|
|
20
|
+
fetchCashManagementOverviewPage: {
|
|
21
|
+
reducer() { },
|
|
22
|
+
prepare(cacheOverride) {
|
|
23
|
+
return { payload: { cacheOverride } };
|
|
24
|
+
},
|
|
25
|
+
},
|
|
26
|
+
fetchUpcomingPaymentEvents(draft) {
|
|
27
|
+
draft.upcomingPaymentEvents = {
|
|
28
|
+
...draft.upcomingPaymentEvents,
|
|
29
|
+
fetchState: 'In-Progress',
|
|
30
|
+
error: undefined,
|
|
31
|
+
};
|
|
32
|
+
},
|
|
33
|
+
updateUpcomingPaymentEventsList(draft, action) {
|
|
34
|
+
const { data } = action.payload;
|
|
35
|
+
const eventIds = [];
|
|
36
|
+
data.events.forEach((payload) => {
|
|
37
|
+
if (payload.id != null) {
|
|
38
|
+
eventIds.push(payload.id);
|
|
39
|
+
}
|
|
40
|
+
});
|
|
41
|
+
draft.upcomingPaymentEvents = {
|
|
42
|
+
fetchState: 'Completed',
|
|
43
|
+
error: undefined,
|
|
44
|
+
billStages: (data.bill_stages ?? []),
|
|
45
|
+
eventIds,
|
|
46
|
+
horizonDays: data.horizon_days,
|
|
47
|
+
reimbursementStages: (data.reimbursement_stages ??
|
|
48
|
+
[]),
|
|
49
|
+
tenantNamespace: data.tenant_namespace,
|
|
50
|
+
};
|
|
51
|
+
},
|
|
52
|
+
updateUpcomingPaymentEventsListFetchStatus(draft, action) {
|
|
53
|
+
draft.upcomingPaymentEvents = {
|
|
54
|
+
...draft.upcomingPaymentEvents,
|
|
55
|
+
fetchState: action.payload.fetchState,
|
|
56
|
+
error: action.payload.error,
|
|
57
|
+
};
|
|
58
|
+
},
|
|
59
|
+
fetchCashManagementBanner(draft) {
|
|
60
|
+
draft.banner = {
|
|
61
|
+
...cashManagementOverviewState_1.initialCashManagementBannerState,
|
|
62
|
+
fetchState: 'In-Progress',
|
|
63
|
+
error: undefined,
|
|
64
|
+
};
|
|
65
|
+
},
|
|
66
|
+
updateCashManagementBanner(draft, action) {
|
|
67
|
+
draft.banner = {
|
|
68
|
+
fetchState: 'Completed',
|
|
69
|
+
error: undefined,
|
|
70
|
+
data: action.payload.data,
|
|
71
|
+
};
|
|
72
|
+
},
|
|
73
|
+
updateCashManagementBannerFetchStatus(draft, action) {
|
|
74
|
+
draft.banner = {
|
|
75
|
+
...draft.banner,
|
|
76
|
+
fetchState: action.payload.fetchState,
|
|
77
|
+
error: action.payload.error,
|
|
78
|
+
};
|
|
79
|
+
},
|
|
80
|
+
clearCashManagementOverview(draft) {
|
|
81
|
+
Object.assign(draft, exports.initialState);
|
|
82
|
+
},
|
|
83
|
+
},
|
|
84
|
+
});
|
|
85
|
+
_a = cashManagementOverview.actions, exports.fetchCashManagementOverviewPage = _a.fetchCashManagementOverviewPage, exports.fetchUpcomingPaymentEvents = _a.fetchUpcomingPaymentEvents, exports.updateUpcomingPaymentEventsList = _a.updateUpcomingPaymentEventsList, exports.updateUpcomingPaymentEventsListFetchStatus = _a.updateUpcomingPaymentEventsListFetchStatus, exports.fetchCashManagementBanner = _a.fetchCashManagementBanner, exports.updateCashManagementBanner = _a.updateCashManagementBanner, exports.updateCashManagementBannerFetchStatus = _a.updateCashManagementBannerFetchStatus, exports.clearCashManagementOverview = _a.clearCashManagementOverview;
|
|
86
|
+
exports.default = cashManagementOverview.reducer;
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { Amount } from '../../../../commonStateTypes/amount';
|
|
2
|
+
import { FetchStateAndError } from '../../../../commonStateTypes/common';
|
|
3
|
+
import { SelectorView } from '../../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
4
|
+
import { UpcomingPaymentEvent } from '../../../../entity/upcomingPaymentEvent/upcomingPaymentEventState';
|
|
5
|
+
import { RootState } from '../../../../reducer';
|
|
6
|
+
import { CashManagementBannerData } from './cashManagementOverviewState';
|
|
7
|
+
export interface CashManagementOverviewBannerSelectorView extends SelectorView {
|
|
8
|
+
data?: CashManagementBannerData;
|
|
9
|
+
}
|
|
10
|
+
export interface CashManagementOverviewSelectorView extends SelectorView {
|
|
11
|
+
bannerFetchState: FetchStateAndError;
|
|
12
|
+
cashBalance: Amount;
|
|
13
|
+
horizonDays: number;
|
|
14
|
+
outflowEvents: UpcomingPaymentEvent[];
|
|
15
|
+
outflowEventsFetchState: FetchStateAndError;
|
|
16
|
+
totalCash: Amount;
|
|
17
|
+
treasuryBalance: Amount;
|
|
18
|
+
}
|
|
19
|
+
export declare const getCashManagementOverviewBanner: (state: RootState) => CashManagementOverviewBannerSelectorView;
|
|
20
|
+
export declare const getCashManagementOverview: (state: RootState) => CashManagementOverviewSelectorView;
|