@zeniai/client-epic-state 5.0.64-betaSS1 → 5.0.64

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.
Files changed (30) hide show
  1. package/lib/esm/index.js +3 -4
  2. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +1 -2
  3. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +0 -6
  4. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +1 -11
  5. package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +1 -2
  6. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +1 -114
  7. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +1 -20
  8. package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +2 -0
  9. package/lib/index.d.ts +3 -4
  10. package/lib/index.js +36 -39
  11. package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
  12. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +1 -2
  13. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +0 -6
  14. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.d.ts +2 -2
  15. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +0 -10
  16. package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +0 -21
  17. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -2
  18. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +1 -2
  19. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -8
  20. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +2 -115
  21. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +1 -2
  22. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +0 -14
  23. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +1 -20
  24. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +2 -1
  25. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +4 -1
  26. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +1 -35
  27. package/package.json +1 -1
  28. package/lib/esm/view/expenseAutomationView/types/completedSubTab.js +0 -17
  29. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +0 -10
  30. package/lib/view/expenseAutomationView/types/completedSubTab.js +0 -21
@@ -8,7 +8,6 @@ const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
8
8
  const transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
9
9
  const responsePayload_1 = require("../../../../responsePayload");
10
10
  const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
11
- const completedSubTab_1 = require("../../types/completedSubTab");
12
11
  const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchCompletedTransactions.match), (0, operators_1.switchMap)((action) => {
13
12
  const state = state$.value;
14
13
  const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload }, } = state;
@@ -43,7 +42,7 @@ const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => actions$.p
43
42
  if (sortOrder != null) {
44
43
  queryPayload.sort_order = sortOrder === 'ascending' ? 'asc' : 'desc';
45
44
  }
46
- if (completedSubTab !== completedSubTab_1.DEFAULT_COMPLETED_SUB_TAB) {
45
+ if (completedSubTab !== 'all') {
47
46
  queryPayload.match_type = completedSubTab;
48
47
  }
49
48
  const encodedQuery = encodeURIComponent(JSON.stringify(queryPayload));
@@ -7,7 +7,6 @@ const transactionReducer_1 = require("../../../../entity/transaction/transaction
7
7
  const responsePayload_1 = require("../../../../responsePayload");
8
8
  const missingReceiptsPayload_1 = require("../../payload/missingReceiptsPayload");
9
9
  const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
10
- const completedSubTab_1 = require("../../types/completedSubTab");
11
10
  const transactionsViewState_1 = require("../../types/transactionsViewState");
12
11
  const rollingCalendarDateRangeInclusive_1 = require("../../helpers/rollingCalendarDateRangeInclusive");
13
12
  /**
@@ -50,11 +49,6 @@ const searchTransactionsForManualMatchEpic = (actions$, state$, zeniAPI) => {
50
49
  page_token: pageToken ?? null,
51
50
  page_size: manualSearch.pageSize,
52
51
  search_text: query,
53
- // Manual search ignores the Completed sub-tab axis — always span the
54
- // default sentinel so the receipt-matching UX returns results
55
- // regardless of where the transaction would otherwise be bucketed on
56
- // the Completed tab.
57
- sub_tab: completedSubTab_1.DEFAULT_COMPLETED_SUB_TAB,
58
52
  };
59
53
  return zeniAPI
60
54
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expense-automation/transactions?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
@@ -3,6 +3,6 @@ import { Observable } from 'rxjs';
3
3
  import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
4
4
  import { RootState } from '../../../../reducer';
5
5
  import { ZeniAPI } from '../../../../zeniAPI';
6
- import { fetchTransactionCategorization, fetchTransactionCategorizationFailure, fetchTransactionCategorizationSuccess, initializeTransactionCategorizationViewLocalData, resetOtherTabsFetchState, updateParentTotalCountForTab, updateTotalCountForTransactionCategorization, updateTransactionCategorizationUIState } from '../../reducers/transactionsViewReducer';
7
- export type ActionType = ReturnType<typeof fetchTransactionCategorization> | ReturnType<typeof updateTransactions> | ReturnType<typeof initializeTransactionCategorizationViewLocalData> | ReturnType<typeof fetchTransactionCategorizationFailure> | ReturnType<typeof updateTransactionCategorizationUIState> | ReturnType<typeof updateTotalCountForTransactionCategorization> | ReturnType<typeof updateParentTotalCountForTab> | ReturnType<typeof fetchTransactionCategorizationSuccess> | ReturnType<typeof resetOtherTabsFetchState>;
6
+ import { fetchTransactionCategorization, fetchTransactionCategorizationFailure, fetchTransactionCategorizationSuccess, initializeTransactionCategorizationViewLocalData, resetOtherTabsFetchState, updateTotalCountForTransactionCategorization, updateTransactionCategorizationUIState } from '../../reducers/transactionsViewReducer';
7
+ export type ActionType = ReturnType<typeof fetchTransactionCategorization> | ReturnType<typeof updateTransactions> | ReturnType<typeof initializeTransactionCategorizationViewLocalData> | ReturnType<typeof fetchTransactionCategorizationFailure> | ReturnType<typeof updateTransactionCategorizationUIState> | ReturnType<typeof updateTotalCountForTransactionCategorization> | ReturnType<typeof fetchTransactionCategorizationSuccess> | ReturnType<typeof resetOtherTabsFetchState>;
8
8
  export declare const fetchTransactionCategorizationEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -9,7 +9,6 @@ const transactionReducer_1 = require("../../../../entity/transaction/transaction
9
9
  const responsePayload_1 = require("../../../../responsePayload");
10
10
  const transactionCategorizationLocalDataHelper_1 = require("../../helpers/transactionCategorizationLocalDataHelper");
11
11
  const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
12
- const completedSubTab_1 = require("../../types/completedSubTab");
13
12
  const transactionsViewState_1 = require("../../types/transactionsViewState");
14
13
  const fetchTransactionCategorizationEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(transactionsViewReducer_1.fetchTransactionCategorization.match), (0, operators_1.switchMap)((action) => {
15
14
  const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationTransactionsViewState, } = state$.value;
@@ -27,9 +26,6 @@ const fetchTransactionCategorizationEpic = (actions$, state$, zeniAPI) => action
27
26
  page_token: pageToken,
28
27
  page_size: 25,
29
28
  search_text: uiState.searchString,
30
- sub_tab: selectedTab === 'autoCategorized'
31
- ? expenseAutomationTransactionsViewState.selectedTransactionCategorizationCompletedSubTab
32
- : completedSubTab_1.DEFAULT_COMPLETED_SUB_TAB,
33
29
  };
34
30
  return zeniAPI
35
31
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expense-automation/transactions?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
@@ -52,12 +48,6 @@ const fetchTransactionCategorizationEpic = (actions$, state$, zeniAPI) => action
52
48
  selectedTab,
53
49
  totalCount: response.data.total_count,
54
50
  }));
55
- updateActions.push((0, transactionsViewReducer_1.updateParentTotalCountForTab)({
56
- selectedPeriod,
57
- selectedTab,
58
- parentTotalCount: response.data.parent_tab_total_count ??
59
- response.data.total_count,
60
- }));
61
51
  updateActions.push((0, transactionsViewReducer_1.resetOtherTabsFetchState)({
62
52
  refreshViewInBackground,
63
53
  tabs: transactionsViewState_1.TRANSACTIONS_TABS.filter((tab) => selectedTab !== tab),
@@ -2,7 +2,6 @@ import { EntityRecommendationPayload } from '../../../commonPayloadTypes/recomme
2
2
  import { TransactionPayload } from '../../../entity/transaction/payloadTypes/transactionPayload';
3
3
  import { SupportedTransactionPayload } from '../../../entity/transaction/transactionState';
4
4
  import { ZeniAPIResponse } from '../../../responsePayload';
5
- import { CompletedSubTab } from '../types/completedSubTab';
6
5
  export interface TransactionCategorizationQueryPayload {
7
6
  auto_categorized: boolean;
8
7
  end_date: string | null;
@@ -12,32 +11,12 @@ export interface TransactionCategorizationQueryPayload {
12
11
  sort_by: string;
13
12
  sort_order: string;
14
13
  start_date: string | null;
15
- /**
16
- * Required. For the Completed (`auto_categorized=true`) listing, scopes the
17
- * returned page + `total_count` to one of the Completed sub-tabs. For the
18
- * Review listing it is forced to `'all'` to preserve parent-tab semantics
19
- * on the backend.
20
- */
21
- sub_tab: CompletedSubTab;
22
14
  }
23
15
  export interface TransactionCategorizationPayload {
24
16
  next_page_token: string | null;
25
17
  query: TransactionCategorizationQueryPayload;
26
18
  total_count: number;
27
19
  transactions: SupportedTransactionPayload[];
28
- /**
29
- * Count of transactions for the entire parent tab (Review or Completed),
30
- * regardless of which sub-tab the listing was scoped to. Used solely to
31
- * drive the parent tab badge counts on the UI; pagination, list-level
32
- * counts, and sub-tab chips continue to consume {@link total_count}.
33
- *
34
- * Optional at the wire boundary so that any version-skew scenario
35
- * (delayed BE rollout, cached SW response, hotfix without the BE change)
36
- * deserializes cleanly. Consumers are expected to fall back to
37
- * {@link total_count} when this is absent — see
38
- * `fetchTransactionCategorizationEpic` for the canonical fallback.
39
- */
40
- parent_tab_total_count?: number;
41
20
  }
42
21
  export type TransactionCategorizationResponse = ZeniAPIResponse<TransactionCategorizationPayload>;
43
22
  export interface EntityRelatedUpdatesPayload {
@@ -6,8 +6,7 @@ import type { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
6
6
  import { TransactionPayload } from '../../../entity/transaction/payloadTypes/transactionPayload';
7
7
  import { SupportedTransactionPayload } from '../../../entity/transaction/transactionState';
8
8
  import { ZeniAPIStatus } from '../../../responsePayload';
9
- import { type CompletedSubTab } from '../types/completedSubTab';
10
- import { type BatchDetails, type BatchListItem, type BatchStatus, type BulkUploadResultsTab, type BulkUploadSortKey, type BulkUploadState, type ManualSearchResult, type MissingReceiptsViewState, type MissingReceiptsViewUIState } from '../types/missingReceiptsViewState';
9
+ import { type BatchDetails, type BatchListItem, type BatchStatus, type BulkUploadResultsTab, type BulkUploadSortKey, type BulkUploadState, type CompletedSubTab, type ManualSearchResult, type MissingReceiptsViewState, type MissingReceiptsViewUIState } from '../types/missingReceiptsViewState';
11
10
  export declare const getCompletedTransactionsCacheKey: (periodId: MonthYearPeriodId, sortKey: BulkUploadSortKey | undefined, sortOrder: SortOrder | undefined, subTab: CompletedSubTab) => string;
12
11
  export declare const initialBulkUploadState: BulkUploadState;
13
12
  export declare const initialState: MissingReceiptsViewState;
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
4
4
  exports.fetchCompletedTransactionsFailure = exports.fetchCompletedTransactionsSuccess = exports.fetchCompletedTransactions = exports.acknowledgeBulkUploadConfirmMatchComplete = exports.clearManualSearchResults = exports.searchTransactionsForManualMatchFailure = exports.searchTransactionsForManualMatchSuccess = exports.searchTransactionsForManualMatch = exports.clearBulkUpload = exports.setBulkUploadSortConfig = exports.setBulkUploadCompletedSubTab = exports.setBulkUploadResultsTab = exports.confirmBulkUploadMatchFailure = exports.confirmBulkUploadMatchSuccess = exports.confirmBulkUploadMatch = exports.fetchBulkUploadBatchesFailure = exports.fetchBulkUploadBatchesSuccess = exports.fetchBulkUploadBatches = exports.fetchMoreBatchDetailsFailure = exports.fetchMoreBatchDetailsComplete = exports.fetchMoreBatchDetails = exports.setInitialBatchDetailsLoading = exports.batchDetailFetchFailed = exports.storeBatchDetails = exports.fetchBulkUploadBatchDetailsFailure = exports.fetchBulkUploadBatchDetailsSuccess = exports.clearMissingReceiptsTabNavigation = exports.requestMissingReceiptsTabNavigation = exports.pusherBatchStatusUpdate = exports.bulkUploadAutomatchingTimedOut = exports.restoreBulkUploadMatchingState = exports.bulkUploadReceiptsFailure = exports.bulkUploadReceiptsSuccess = exports.setBulkUploadUploadedFileCount = exports.updateBulkUploadProgress = exports.bulkUploadReceipts = exports.clearExpenseAutomationMissingReceiptsView = exports.markMissingReceiptAsDone = exports.updateMissingReceiptsUIState = exports.updateMissingReceiptUploadState = exports.uploadMissingReceiptSuccess = exports.fetchMissingReceiptsFailure = exports.fetchMissingReceiptsSuccess = exports.fetchMissingReceipts = exports.restoreBulkUploadAutomatchingOnMount = exports.fetchBulkUploadBatchDetails = exports.initialState = exports.initialBulkUploadState = exports.getCompletedTransactionsCacheKey = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
7
- const completedSubTab_1 = require("../types/completedSubTab");
8
7
  const missingReceiptsViewState_1 = require("../types/missingReceiptsViewState");
9
8
  const getCompletedTransactionsCacheKey = (periodId, sortKey, sortOrder, subTab) => {
10
9
  const sortKeyPart = sortKey ?? 'none';
@@ -18,7 +17,7 @@ exports.initialBulkUploadState = {
18
17
  batchListByPeriod: {},
19
18
  batchListFetchState: { fetchState: 'Not-Started', error: undefined },
20
19
  batchStatusById: {},
21
- completedSubTab: completedSubTab_1.DEFAULT_COMPLETED_SUB_TAB,
20
+ completedSubTab: 'all',
22
21
  completedTransactionsByPeriod: {},
23
22
  confirmMatchStatus: { fetchState: 'Not-Started', error: undefined },
24
23
  currentBatchId: undefined,
@@ -65,9 +65,7 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
65
65
  isUncategorizedExpenseCategoryEnabled: boolean | undefined;
66
66
  }, "expenseAutomationTransactionsView/updateTransactionCategorization", never, never>, updateCurrentSelectedTransactionCategorizationTab: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[newSelectedTab: "review" | "autoCategorized"], {
67
67
  newSelectedTab: "review" | "autoCategorized";
68
- }, "expenseAutomationTransactionsView/updateCurrentSelectedTransactionCategorizationTab", never, never>, updateTransactionCategorizationCompletedSubTab: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[newSubTab: "all" | "manual" | "ai_accountant"], {
69
- newSubTab: "all" | "manual" | "ai_accountant";
70
- }, "expenseAutomationTransactionsView/updateTransactionCategorizationCompletedSubTab", never, never>, updateTransactionCategorizationSaveStatus: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", fetchState: FetchState, error?: ZeniAPIStatus<Record<string, unknown>> | undefined], {
68
+ }, "expenseAutomationTransactionsView/updateCurrentSelectedTransactionCategorizationTab", never, never>, updateTransactionCategorizationSaveStatus: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", fetchState: FetchState, error?: ZeniAPIStatus<Record<string, unknown>> | undefined], {
71
69
  selectedTab: "review" | "autoCategorized";
72
70
  fetchState: FetchState;
73
71
  error: ZeniAPIStatus<Record<string, unknown>> | undefined;
@@ -122,11 +120,7 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
122
120
  selectedPeriod: MonthYearPeriod;
123
121
  selectedTab: TransactionsTab;
124
122
  totalCount: number;
125
- }, "expenseAutomationTransactionsView/updateTotalCountForTransactionCategorization">, updateParentTotalCountForTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
126
- parentTotalCount: number;
127
- selectedPeriod: MonthYearPeriod;
128
- selectedTab: TransactionsTab;
129
- }, "expenseAutomationTransactionsView/updateParentTotalCountForTab">, fetchTransactionCategorizationSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
123
+ }, "expenseAutomationTransactionsView/updateTotalCountForTransactionCategorization">, fetchTransactionCategorizationSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
130
124
  selectedTab: TransactionsTab;
131
125
  status: ZeniAPIStatus;
132
126
  refreshViewInBackground?: boolean;
@@ -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.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;
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',
@@ -49,68 +48,12 @@ exports.initialTransactionTabViewState = {
49
48
  selectedTransactionLineId: undefined,
50
49
  };
51
50
  exports.initialState = {
52
- autoCategorizedSubTabCache: {},
53
- parentTotalCountByTab: {
54
- review: {},
55
- autoCategorized: {},
56
- },
57
51
  selectedTransactionCategorizationTab: 'review',
58
- selectedTransactionCategorizationCompletedSubTab: completedSubTab_1.DEFAULT_COMPLETED_SUB_TAB,
59
52
  transactionCategorizationView: {
60
53
  review: { ...exports.initialTransactionTabViewState },
61
54
  autoCategorized: { ...exports.initialTransactionTabViewState },
62
55
  },
63
56
  };
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`. These are the keys the fetch epic's cache check
76
- * reads to decide whether to short-circuit a sub-tab revisit.
77
- * - Intentionally NOT captured (left in place on `autoCat` and inherited by
78
- * the incoming sub-tab):
79
- * - `uiState.searchString`, `uiState.sortKey`, `uiState.sortOrder`,
80
- * `uiState.scrollPosition`, `uiState.nodeCollapseState`,
81
- * `uiState.limit` — search and sort are user-applied preferences that
82
- * persist across sub-tabs by design (a search query stays active when
83
- * the user toggles between Manual / AI Accountant).
84
- * - `selectedCheckBoxTransactionIds` — selection state is intentionally
85
- * cleared at the action source (the fetch epic / save flow), not
86
- * by the snapshot path. Carrying selection across sub-tabs is safe
87
- * because every sub-tab change goes through a fetch round-trip that
88
- * reconciles selection against the new row IDs.
89
- * - `transactionReviewLocalDataById`, `transactionIdsWithUnsavedData`,
90
- * `uploadReceiptStatusById`, `saveStatus`, `refreshStatus`,
91
- * `markAsNotMiscategorizedStatus` — these are per-row / per-flight
92
- * caches that are write-through global state, not sub-tab-scoped.
93
- *
94
- * If the contract changes (e.g. selection should reset on every sub-tab
95
- * switch), update both this comment and the snapshot return shape together.
96
- */
97
- function snapshotAutoCategorizedTab(autoCat) {
98
- const transactionIdsBySelectedPeriod = {
99
- ...autoCat.transactionIdsBySelectedPeriod,
100
- };
101
- const hasAnyLoadedRows = Object.values(transactionIdsBySelectedPeriod).some((ids) => ids.length > 0);
102
- let normalisedFetchState = autoCat.fetchState;
103
- if (normalisedFetchState === 'In-Progress') {
104
- normalisedFetchState = hasAnyLoadedRows ? 'Completed' : 'Not-Started';
105
- }
106
- return {
107
- error: autoCat.error,
108
- fetchState: normalisedFetchState,
109
- pageToken: autoCat.uiState.pageToken,
110
- totalCount: { ...autoCat.uiState.totalCount },
111
- transactionIdsBySelectedPeriod,
112
- };
113
- }
114
57
  const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
115
58
  name: 'expenseAutomationTransactionsView',
116
59
  initialState: exports.initialState,
@@ -324,48 +267,6 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
324
267
  return { payload: { newSelectedTab } };
325
268
  },
326
269
  },
327
- updateTransactionCategorizationCompletedSubTab: {
328
- reducer(draft, action) {
329
- const { newSubTab } = action.payload;
330
- const previousSubTab = draft.selectedTransactionCategorizationCompletedSubTab;
331
- if (previousSubTab === newSubTab) {
332
- return;
333
- }
334
- const autoCat = draft.transactionCategorizationView.autoCategorized;
335
- // Snapshot the outgoing sub-tab so a future revisit can short-circuit
336
- // the fetch epic (mirrors the parent-tab "don't refetch what's
337
- // already cached" behaviour). Period-scoped data is preserved as-is
338
- // because the snapshot itself is keyed only by sub-tab; the active
339
- // tab's per-period maps remain the source of truth while live.
340
- draft.autoCategorizedSubTabCache[previousSubTab] =
341
- snapshotAutoCategorizedTab(autoCat);
342
- const cached = draft.autoCategorizedSubTabCache[newSubTab];
343
- if (cached != null) {
344
- autoCat.uiState.pageToken = cached.pageToken;
345
- autoCat.uiState.totalCount = { ...cached.totalCount };
346
- autoCat.transactionIdsBySelectedPeriod = {
347
- ...cached.transactionIdsBySelectedPeriod,
348
- };
349
- autoCat.fetchState = cached.fetchState;
350
- autoCat.error = cached.error;
351
- }
352
- else {
353
- // Sub-tab has never been visited — clear the active slot so the
354
- // view-epic's `fetchState === 'Not-Started' || transactionIds.length
355
- // === 0` cache check falls through and triggers a fresh page-1
356
- // fetch for the new dataset.
357
- autoCat.uiState.pageToken = null;
358
- autoCat.uiState.totalCount = {};
359
- autoCat.transactionIdsBySelectedPeriod = {};
360
- autoCat.fetchState = 'Not-Started';
361
- autoCat.error = undefined;
362
- }
363
- draft.selectedTransactionCategorizationCompletedSubTab = newSubTab;
364
- },
365
- prepare(newSubTab) {
366
- return { payload: { newSubTab } };
367
- },
368
- },
369
270
  updateTransactionCategorization: {
370
271
  reducer(draft, action) {
371
272
  const selectedTab = action.payload.selectedTab;
@@ -803,10 +704,6 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
803
704
  const { selectedTab, selectedPeriod, totalCount } = action.payload;
804
705
  draft.transactionCategorizationView[selectedTab].uiState.totalCount[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = totalCount;
805
706
  },
806
- updateParentTotalCountForTab(draft, action) {
807
- const { selectedTab, selectedPeriod, parentTotalCount } = action.payload;
808
- draft.parentTotalCountByTab[selectedTab][(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = parentTotalCount;
809
- },
810
707
  updateSelectedCheckboxTransactionIds(draft, action) {
811
708
  const selectedTab = action.payload.selectedTab;
812
709
  const transactionIds = action.payload.transactionIds;
@@ -817,16 +714,6 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
817
714
  draft.transactionCategorizationView[selectedTab] = {
818
715
  ...exports.initialTransactionTabViewState,
819
716
  };
820
- draft.parentTotalCountByTab[selectedTab] = {};
821
- // The per-sub-tab snapshot cache lives at the slice root and is
822
- // exclusively populated by the autoCategorized tab's sub-tab switching
823
- // (see updateTransactionCategorizationCompletedSubTab). When that tab
824
- // is reset, leaving stale snapshots behind would short-circuit the
825
- // next sub-tab visit with phantom row IDs / page tokens that no longer
826
- // correspond to anything in state — drop them in lockstep.
827
- if (selectedTab === 'autoCategorized') {
828
- draft.autoCategorizedSubTabCache = {};
829
- }
830
717
  },
831
718
  clearExpenseAutomationTransactionsView(draft) {
832
719
  Object.assign(draft, exports.initialState);
@@ -923,5 +810,5 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
923
810
  },
924
811
  },
925
812
  });
926
- _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;
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;
927
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/completedSubTab';
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[];
@@ -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 { selectedTransactionCategorizationCompletedSubTab, selectedTransactionCategorizationTab, } = expenseAutomationTransactionsViewState;
19
+ const { 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,27 +69,10 @@ 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).
76
72
  const totalCountByTab = {
77
73
  review: monthYearPeriodId != null ? totalCountByReview[monthYearPeriodId] : 0,
78
74
  autoCategorized: monthYearPeriodId != null ? totalCountByAutoCat[monthYearPeriodId] : 0,
79
75
  };
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
- };
93
76
  const fetchStateByTab = {
94
77
  review: {
95
78
  fetchState: expenseAutomationTransactionsViewState.transactionCategorizationView
@@ -131,11 +114,9 @@ function getExpenseAutomationTransactionView(state) {
131
114
  markAsNotMiscategorizedStatus,
132
115
  completionStatus,
133
116
  totalCountByTab,
134
- parentTabTotalCountByTab,
135
117
  fetchStateByTransactionTabs: fetchStateByTab,
136
118
  uploadReceiptStatusById,
137
119
  selectedTransactionId,
138
120
  selectedTransactionLineId,
139
- selectedTransactionCategorizationCompletedSubTab,
140
121
  };
141
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 { FetchState, FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
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';
@@ -13,11 +13,9 @@ import { TransactionID } from '../../../entity/transaction/stateTypes/transactio
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
18
  import { TransactionDetailKey } from '../../transactionDetail/transactionDetailState';
20
- import { CompletedSubTab } from './completedSubTab';
21
19
  export declare const toTransactionsSortKey: (v: string) => "date" | "amount" | "vendor" | "project" | "category" | "class" | "payment_account" | "transaction_type" | "memo_and_receipt";
22
20
  export type TransactionsSortKey = ReturnType<typeof toTransactionsSortKey>;
23
21
  export declare const TRANSACTIONS_TABS: readonly ["review", "autoCategorized"];
@@ -105,39 +103,7 @@ export interface TransactionsTabViewState extends FetchedState {
105
103
  selectedTransactionId?: ID;
106
104
  selectedTransactionLineId?: ID;
107
105
  }
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
- export interface AutoCategorizedSubTabSnapshot {
117
- error: ZeniAPIStatus | undefined;
118
- fetchState: FetchState;
119
- pageToken: PageToken;
120
- totalCount: Record<MonthYearPeriodId, number>;
121
- transactionIdsBySelectedPeriod: Record<MonthYearPeriodId, ID[]>;
122
- }
123
106
  export type TransactionsViewState = {
124
- /**
125
- * Per-sub-tab snapshot cache for the Completed (autoCategorized) tab. Keyed
126
- * by {@link CompletedSubTab}. Populated as the user navigates between
127
- * sub-tabs and consulted on every switch — the active autoCategorized slot
128
- * is restored from here when a snapshot exists, otherwise it is reset and
129
- * the fetch epic loads page 1 fresh.
130
- */
131
- autoCategorizedSubTabCache: Partial<Record<CompletedSubTab, AutoCategorizedSubTabSnapshot>>;
132
- /**
133
- * Period-keyed parent tab counts, scoped per {@link TransactionsTab}.
134
- * Sourced from the listing response's `parent_tab_total_count` and used
135
- * exclusively to drive the parent tab badges on the UI — every other
136
- * count consumer (pagination, sub-tab chips, in-tab "showing X of Y")
137
- * keeps reading from {@link TransactionsViewUIState.totalCount}.
138
- */
139
- parentTotalCountByTab: Record<TransactionsTab, Record<MonthYearPeriodId, number>>;
140
- selectedTransactionCategorizationCompletedSubTab: CompletedSubTab;
141
107
  selectedTransactionCategorizationTab: TransactionsTab;
142
108
  transactionCategorizationView: Record<TransactionsTab, TransactionsTabViewState>;
143
109
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.0.64-betaSS1",
3
+ "version": "5.0.64",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",
@@ -1,17 +0,0 @@
1
- import { stringToUnion } from '../../../commonStateTypes/stringToUnion';
2
- /**
3
- * Sub-tabs that can appear under any "Completed" tab in the Expense Automation
4
- * surface (Transaction Categorization Completed and Missing Receipts Completed
5
- * both use this exact union). Forwarded verbatim to listing APIs as `sub_tab`
6
- * / `match_type`. `'all'` preserves parent-tab semantics on the backend.
7
- */
8
- const COMPLETED_SUB_TABS = ['all', 'ai_accountant', 'manual'];
9
- export const toCompletedSubTab = (v) => stringToUnion(v.trim().toLowerCase(), COMPLETED_SUB_TABS);
10
- /**
11
- * "No sub-tab filter" sentinel — single source of truth for the default
12
- * value of {@link CompletedSubTab}. Use this constant in initial slice
13
- * state and at any call site that needs to fall back to the parent-tab
14
- * listing semantics (review tab requests, manual-search overrides, etc.)
15
- * so a future rename of the union doesn't require chasing literals.
16
- */
17
- export const DEFAULT_COMPLETED_SUB_TAB = 'all';
@@ -1,10 +0,0 @@
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;
@@ -1,21 +0,0 @@
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';