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

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 (27) 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 +3 -0
  4. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +71 -1
  5. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -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.js +3 -0
  13. package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +8 -0
  14. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +2 -1
  15. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +3 -1
  16. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +72 -2
  17. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +2 -1
  18. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +2 -0
  19. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
  20. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +2 -0
  21. package/lib/view/expenseAutomationView/types/completedSubTab.js +13 -0
  22. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -2
  23. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +1 -4
  24. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +27 -1
  25. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +6 -5
  26. package/package.json +1 -1
  27. package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
@@ -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');
@@ -118,5 +118,6 @@ function getExpenseAutomationTransactionView(state) {
118
118
  uploadReceiptStatusById,
119
119
  selectedTransactionId,
120
120
  selectedTransactionLineId,
121
+ selectedTransactionCategorizationCompletedSubTab,
121
122
  };
122
123
  }
@@ -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,31 @@ 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
+ selectedTransactionCategorizationCompletedSubTab: CompletedSubTab;
107
133
  selectedTransactionCategorizationTab: TransactionsTab;
108
134
  transactionCategorizationView: Record<TransactionsTab, TransactionsTabViewState>;
109
135
  };
@@ -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-betaSS1",
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",