@zeniai/client-epic-state 5.0.55-betaRR01 → 5.0.55-betaSS2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (28) hide show
  1. package/lib/esm/index.js +4 -3
  2. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +4 -0
  3. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +9 -1
  4. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +80 -1
  5. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +20 -1
  6. package/lib/esm/view/expenseAutomationView/types/completedSubTab.js +9 -0
  7. package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +0 -2
  8. package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +6 -5
  9. package/lib/index.d.ts +4 -3
  10. package/lib/index.js +37 -35
  11. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +4 -0
  12. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.d.ts +2 -2
  13. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +8 -0
  14. package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +15 -0
  15. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +2 -1
  16. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +8 -2
  17. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +81 -2
  18. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +2 -1
  19. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +14 -0
  20. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +20 -1
  21. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +2 -0
  22. package/lib/view/expenseAutomationView/types/completedSubTab.js +13 -0
  23. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -2
  24. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +1 -4
  25. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +35 -1
  26. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +6 -5
  27. package/package.json +1 -1
  28. package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  var _a;
6
6
  Object.defineProperty(exports, "__esModule", { value: true });
7
- exports.uploadTransactionCategorizationReceiptSuccess = exports.updateTransactionCategorizationUploadReceiptState = exports.backgroundRefetchReviewTab = exports.syncTransactionCategorizationFromDetailSave = exports.updateSelectedTransactionId = exports.setEntityRecommendationForLineIdsForCategorization = exports.clearExpenseAutomationTransactionsView = exports.clearExpenseAutomationTransactionsViewPerTabView = exports.updateSelectedCheckboxTransactionIds = exports.fetchTransactionCategorizationView = exports.resetOtherTabsFetchState = exports.fetchTransactionCategorizationSuccess = exports.updateTotalCountForTransactionCategorization = exports.setAllItemsToCategoryClassInLocalDataForCategorization = exports.updateSelectedCustomerForTransaction = exports.updateSelectedVendorForTransaction = exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = exports.markTransactionAsNotMiscategorized = exports.updateTransactionCategorizationSaveStatus = exports.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"));
@@ -48,12 +48,44 @@ exports.initialTransactionTabViewState = {
48
48
  selectedTransactionLineId: undefined,
49
49
  };
50
50
  exports.initialState = {
51
+ autoCategorizedSubTabCache: {},
52
+ parentTotalCountByTab: {
53
+ review: {},
54
+ autoCategorized: {},
55
+ },
51
56
  selectedTransactionCategorizationTab: 'review',
57
+ selectedTransactionCategorizationCompletedSubTab: 'all',
52
58
  transactionCategorizationView: {
53
59
  review: { ...exports.initialTransactionTabViewState },
54
60
  autoCategorized: { ...exports.initialTransactionTabViewState },
55
61
  },
56
62
  };
63
+ /**
64
+ * Capture the autoCategorized tab's current paginated dataset for a sub-tab.
65
+ * The mid-flight `'In-Progress'` state is normalised to `'Completed'` because
66
+ * the in-flight request is cancelled by `switchMap` in the fetch epic when the
67
+ * sub-tab changes — restoring `'In-Progress'` later would leave the UI stuck
68
+ * showing a phantom loading state with no fetch actually running. Length-zero
69
+ * datasets degrade to `'Not-Started'` so the next visit triggers a fresh
70
+ * fetch from page 1 instead of short-circuiting on stale empty caches.
71
+ */
72
+ function snapshotAutoCategorizedTab(autoCat) {
73
+ const transactionIdsBySelectedPeriod = {
74
+ ...autoCat.transactionIdsBySelectedPeriod,
75
+ };
76
+ const hasAnyLoadedRows = Object.values(transactionIdsBySelectedPeriod).some((ids) => ids.length > 0);
77
+ let normalisedFetchState = autoCat.fetchState;
78
+ if (normalisedFetchState === 'In-Progress') {
79
+ normalisedFetchState = hasAnyLoadedRows ? 'Completed' : 'Not-Started';
80
+ }
81
+ return {
82
+ error: autoCat.error,
83
+ fetchState: normalisedFetchState,
84
+ pageToken: autoCat.uiState.pageToken,
85
+ totalCount: { ...autoCat.uiState.totalCount },
86
+ transactionIdsBySelectedPeriod,
87
+ };
88
+ }
57
89
  const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
58
90
  name: 'expenseAutomationTransactionsView',
59
91
  initialState: exports.initialState,
@@ -267,6 +299,48 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
267
299
  return { payload: { newSelectedTab } };
268
300
  },
269
301
  },
302
+ updateTransactionCategorizationCompletedSubTab: {
303
+ reducer(draft, action) {
304
+ const { newSubTab } = action.payload;
305
+ const previousSubTab = draft.selectedTransactionCategorizationCompletedSubTab;
306
+ if (previousSubTab === newSubTab) {
307
+ return;
308
+ }
309
+ const autoCat = draft.transactionCategorizationView.autoCategorized;
310
+ // Snapshot the outgoing sub-tab so a future revisit can short-circuit
311
+ // the fetch epic (mirrors the parent-tab "don't refetch what's
312
+ // already cached" behaviour). Period-scoped data is preserved as-is
313
+ // because the snapshot itself is keyed only by sub-tab; the active
314
+ // tab's per-period maps remain the source of truth while live.
315
+ draft.autoCategorizedSubTabCache[previousSubTab] =
316
+ snapshotAutoCategorizedTab(autoCat);
317
+ const cached = draft.autoCategorizedSubTabCache[newSubTab];
318
+ if (cached != null) {
319
+ autoCat.uiState.pageToken = cached.pageToken;
320
+ autoCat.uiState.totalCount = { ...cached.totalCount };
321
+ autoCat.transactionIdsBySelectedPeriod = {
322
+ ...cached.transactionIdsBySelectedPeriod,
323
+ };
324
+ autoCat.fetchState = cached.fetchState;
325
+ autoCat.error = cached.error;
326
+ }
327
+ else {
328
+ // Sub-tab has never been visited — clear the active slot so the
329
+ // view-epic's `fetchState === 'Not-Started' || transactionIds.length
330
+ // === 0` cache check falls through and triggers a fresh page-1
331
+ // fetch for the new dataset.
332
+ autoCat.uiState.pageToken = null;
333
+ autoCat.uiState.totalCount = {};
334
+ autoCat.transactionIdsBySelectedPeriod = {};
335
+ autoCat.fetchState = 'Not-Started';
336
+ autoCat.error = undefined;
337
+ }
338
+ draft.selectedTransactionCategorizationCompletedSubTab = newSubTab;
339
+ },
340
+ prepare(newSubTab) {
341
+ return { payload: { newSubTab } };
342
+ },
343
+ },
270
344
  updateTransactionCategorization: {
271
345
  reducer(draft, action) {
272
346
  const selectedTab = action.payload.selectedTab;
@@ -704,6 +778,10 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
704
778
  const { selectedTab, selectedPeriod, totalCount } = action.payload;
705
779
  draft.transactionCategorizationView[selectedTab].uiState.totalCount[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = totalCount;
706
780
  },
781
+ updateParentTotalCountForTab(draft, action) {
782
+ const { selectedTab, selectedPeriod, parentTotalCount } = action.payload;
783
+ draft.parentTotalCountByTab[selectedTab][(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = parentTotalCount;
784
+ },
707
785
  updateSelectedCheckboxTransactionIds(draft, action) {
708
786
  const selectedTab = action.payload.selectedTab;
709
787
  const transactionIds = action.payload.transactionIds;
@@ -714,6 +792,7 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
714
792
  draft.transactionCategorizationView[selectedTab] = {
715
793
  ...exports.initialTransactionTabViewState,
716
794
  };
795
+ draft.parentTotalCountByTab[selectedTab] = {};
717
796
  },
718
797
  clearExpenseAutomationTransactionsView(draft) {
719
798
  Object.assign(draft, exports.initialState);
@@ -810,5 +889,5 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
810
889
  },
811
890
  },
812
891
  });
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;
892
+ _a = expenseAutomationTransactionsView.actions, exports.fetchTransactionCategorization = _a.fetchTransactionCategorization, exports.updateTransactionCategorizationUIState = _a.updateTransactionCategorizationUIState, exports.initializeTransactionCategorizationViewLocalData = _a.initializeTransactionCategorizationViewLocalData, exports.saveTransactionCategorizationLocalData = _a.saveTransactionCategorizationLocalData, exports.fetchTransactionCategorizationFailure = _a.fetchTransactionCategorizationFailure, exports.saveTransactionCategorization = _a.saveTransactionCategorization, exports.updateTransactionCategorization = _a.updateTransactionCategorization, exports.updateCurrentSelectedTransactionCategorizationTab = _a.updateCurrentSelectedTransactionCategorizationTab, exports.updateTransactionCategorizationCompletedSubTab = _a.updateTransactionCategorizationCompletedSubTab, exports.updateTransactionCategorizationSaveStatus = _a.updateTransactionCategorizationSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = _a.updateStatusForTransactionNotMiscategorizedUpdateForCategorization, exports.updateSelectedVendorForTransaction = _a.updateSelectedVendorForTransaction, exports.updateSelectedCustomerForTransaction = _a.updateSelectedCustomerForTransaction, exports.setAllItemsToCategoryClassInLocalDataForCategorization = _a.setAllItemsToCategoryClassInLocalDataForCategorization, exports.updateTotalCountForTransactionCategorization = _a.updateTotalCountForTransactionCategorization, exports.updateParentTotalCountForTab = _a.updateParentTotalCountForTab, exports.fetchTransactionCategorizationSuccess = _a.fetchTransactionCategorizationSuccess, exports.resetOtherTabsFetchState = _a.resetOtherTabsFetchState, exports.fetchTransactionCategorizationView = _a.fetchTransactionCategorizationView, exports.updateSelectedCheckboxTransactionIds = _a.updateSelectedCheckboxTransactionIds, exports.clearExpenseAutomationTransactionsViewPerTabView = _a.clearExpenseAutomationTransactionsViewPerTabView, exports.clearExpenseAutomationTransactionsView = _a.clearExpenseAutomationTransactionsView, exports.setEntityRecommendationForLineIdsForCategorization = _a.setEntityRecommendationForLineIdsForCategorization, exports.updateSelectedTransactionId = _a.updateSelectedTransactionId, exports.syncTransactionCategorizationFromDetailSave = _a.syncTransactionCategorizationFromDetailSave, exports.backgroundRefetchReviewTab = _a.backgroundRefetchReviewTab, exports.updateTransactionCategorizationUploadReceiptState = _a.updateTransactionCategorizationUploadReceiptState, exports.uploadTransactionCategorizationReceiptSuccess = _a.uploadTransactionCategorizationReceiptSuccess;
814
893
  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 { BatchFileStatus, BatchListItem, BatchStatus, BulkUploadPhase, BulkUploadResultsTab, BulkUploadSortKey, CompletedSubTab, ManualSearchState, MatchSource, MissingReceiptsViewUIState } from '../types/missingReceiptsViewState';
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,2 @@
1
+ export declare const toCompletedSubTab: (v: string) => "all" | "manual" | "ai_accountant";
2
+ export type CompletedSubTab = ReturnType<typeof toCompletedSubTab>;
@@ -0,0 +1,13 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ 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;
@@ -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.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;
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';
@@ -13,9 +13,11 @@ 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';
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,39 @@ 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
+ export interface AutoCategorizedSubTabSnapshot {
117
+ error: ZeniAPIStatus | undefined;
118
+ fetchState: FetchState;
119
+ pageToken: PageToken;
120
+ totalCount: Record<MonthYearPeriodId, number>;
121
+ transactionIdsBySelectedPeriod: Record<MonthYearPeriodId, ID[]>;
122
+ }
106
123
  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;
107
141
  selectedTransactionCategorizationTab: TransactionsTab;
108
142
  transactionCategorizationView: Record<TransactionsTab, TransactionsTabViewState>;
109
143
  };
@@ -25,7 +25,7 @@ const bulkUpdateTaskListEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0,
25
25
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
26
26
  const removeFromList = updates.isArchived === true ||
27
27
  updates.isDeleted === true ||
28
- 'snoozedUntil' in updates;
28
+ ('snoozedUntil' in updates && updates.snoozedUntil == null);
29
29
  return (0, rxjs_1.of)((0, taskReducer_1.updateTasks)(response.data.tasks), (0, taskListReducer_1.updateTasksListOnBulkUpdateTasksSuccess)({
30
30
  taskIds,
31
31
  groupId,
@@ -77,11 +77,12 @@ const toBulkUpdatesPayload = (updates) => {
77
77
  if (updates.isDeleted != null) {
78
78
  payload.is_deleted = updates.isDeleted;
79
79
  }
80
+ // Bulk snooze is not supported — only bulk unsnooze (clear all snooze fields)
80
81
  if ('snoozedUntil' in updates) {
81
- payload.snoozed_until =
82
- updates.snoozedUntil != null
83
- ? updates.snoozedUntil.format('YYYY-MM-DDTHH:mm:ss')
84
- : null;
82
+ payload.snoozed_until = null;
83
+ payload.snoozed_by = null;
84
+ payload.snoozed_at = null;
85
+ payload.is_snooze_notification_sent = false;
85
86
  }
86
87
  return payload;
87
88
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.0.55-betaRR01",
3
+ "version": "5.0.55-betaSS2",
4
4
  "description": "Shared module between Web & Mobile containing required abstractions for state management, async network communication. ",
5
5
  "main": "lib/index.js",
6
6
  "module": "lib/esm/index.js",