@zeniai/client-epic-state 5.1.13 → 5.1.15-betaRD1

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.
@@ -51,6 +51,8 @@ export interface TransactionPayload extends TransactionIDPayload, AccountBasePay
51
51
  to_from_account_integration_id?: string | null;
52
52
  to_from_account_name?: string | null;
53
53
  total_amount?: number;
54
+ /** Transactions list API: count of categorizable lines across all statuses (not just the active tab) */
55
+ total_lines_count?: number;
54
56
  transaction_type_name?: string;
55
57
  transaction_update_time?: string;
56
58
  vendor_id?: string | null;
@@ -124,6 +124,9 @@ const toTransaction = (payload) => {
124
124
  : {}),
125
125
  linkedTransactions: payload.linked_transactions?.map((transactionIDPayload) => (0, transactionIDPayload_1.toTransactionID)(transactionIDPayload)),
126
126
  lines,
127
+ ...(payload.total_lines_count != null
128
+ ? { totalLinesCount: payload.total_lines_count }
129
+ : {}),
127
130
  account: payloadHasAccountInfo(payload)
128
131
  ? (0, accountPayload_1.mapAccountBasePayloadToAccountBase)(payload)
129
132
  : undefined,
@@ -56,6 +56,8 @@ export interface Transaction extends BaseTransaction {
56
56
  toFromAccountId?: ID;
57
57
  toFromAccountIntegrationId?: string;
58
58
  toFromAccountName?: string;
59
+ /** Count of categorizable lines across all statuses (transactions list API); used to gate single-line-only flows */
60
+ totalLinesCount?: number;
59
61
  updateTime?: ZeniDate;
60
62
  vendorId?: ID;
61
63
  vendorName?: string;
@@ -120,6 +120,9 @@ export const toTransaction = (payload) => {
120
120
  : {}),
121
121
  linkedTransactions: payload.linked_transactions?.map((transactionIDPayload) => toTransactionID(transactionIDPayload)),
122
122
  lines,
123
+ ...(payload.total_lines_count != null
124
+ ? { totalLinesCount: payload.total_lines_count }
125
+ : {}),
123
126
  account: payloadHasAccountInfo(payload)
124
127
  ? mapAccountBasePayloadToAccountBase(payload)
125
128
  : undefined,
@@ -24,6 +24,7 @@ export const fetchTransactionCategorizationEpic = (actions$, state$, zeniAPI) =>
24
24
  page_token: pageToken,
25
25
  page_size: 25,
26
26
  search_text: uiState.searchString,
27
+ search_all_statuses: false,
27
28
  sub_tab: selectedTab === 'autoCategorized'
28
29
  ? expenseAutomationTransactionsViewState.selectedTransactionCategorizationCompletedSubTab
29
30
  : DEFAULT_COMPLETED_SUB_TAB,
@@ -7,6 +7,7 @@ import { fetchClassList } from '../../../classList/classListReducer';
7
7
  import { fetchOwnerList } from '../../../ownerList/ownerListReducer';
8
8
  import { fetchProjectList } from '../../../projectList/projectListReducer';
9
9
  import { fetchTransactionCategorization, fetchTransactionCategorizationView, } from '../../reducers/transactionsViewReducer';
10
+ import { TRANSACTIONS_TABS } from '../../types/transactionsViewState';
10
11
  export const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pipe(filter(fetchTransactionCategorizationView.match), mergeMap((action) => {
11
12
  const { selectedTab, cacheOverride, keepExistingListItems, pageToken, period, refreshViewInBackground, searchString, resetListItems, isUncategorizedExpenseCategoryEnabled, } = action.payload;
12
13
  const updateActions = [];
@@ -44,5 +45,15 @@ export const fetchTransactionCategorizationViewEpic = (actions$, state$) => acti
44
45
  transactionIds.length === 0) {
45
46
  updateActions.push(fetchTransactionCategorization(selectedTab, period, cacheOverride, keepExistingListItems, searchString, pageToken, refreshViewInBackground, resetListItems, isUncategorizedExpenseCategoryEnabled));
46
47
  }
48
+ // When search changes (searchString defined, including empty string to
49
+ // clear), also fetch the other tab so both tabs always reflect the same
50
+ // search query. cacheOverride=true bypasses the cache check; pageToken
51
+ // is reset to undefined so the other tab starts from page 1.
52
+ if (searchString !== undefined) {
53
+ const otherTab = TRANSACTIONS_TABS.find((tab) => tab !== selectedTab);
54
+ if (otherTab != null) {
55
+ updateActions.push(fetchTransactionCategorization(otherTab, period, true, keepExistingListItems, searchString, undefined, refreshViewInBackground, true, isUncategorizedExpenseCategoryEnabled));
56
+ }
57
+ }
47
58
  return from(updateActions);
48
59
  }));
@@ -27,6 +27,7 @@ const fetchTransactionCategorizationEpic = (actions$, state$, zeniAPI) => action
27
27
  page_token: pageToken,
28
28
  page_size: 25,
29
29
  search_text: uiState.searchString,
30
+ search_all_statuses: false,
30
31
  sub_tab: selectedTab === 'autoCategorized'
31
32
  ? expenseAutomationTransactionsViewState.selectedTransactionCategorizationCompletedSubTab
32
33
  : completedSubTab_1.DEFAULT_COMPLETED_SUB_TAB,
@@ -10,6 +10,7 @@ const classListReducer_1 = require("../../../classList/classListReducer");
10
10
  const ownerListReducer_1 = require("../../../ownerList/ownerListReducer");
11
11
  const projectListReducer_1 = require("../../../projectList/projectListReducer");
12
12
  const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
13
+ const transactionsViewState_1 = require("../../types/transactionsViewState");
13
14
  const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(transactionsViewReducer_1.fetchTransactionCategorizationView.match), (0, operators_1.mergeMap)((action) => {
14
15
  const { selectedTab, cacheOverride, keepExistingListItems, pageToken, period, refreshViewInBackground, searchString, resetListItems, isUncategorizedExpenseCategoryEnabled, } = action.payload;
15
16
  const updateActions = [];
@@ -47,6 +48,16 @@ const fetchTransactionCategorizationViewEpic = (actions$, state$) => actions$.pi
47
48
  transactionIds.length === 0) {
48
49
  updateActions.push((0, transactionsViewReducer_1.fetchTransactionCategorization)(selectedTab, period, cacheOverride, keepExistingListItems, searchString, pageToken, refreshViewInBackground, resetListItems, isUncategorizedExpenseCategoryEnabled));
49
50
  }
51
+ // When search changes (searchString defined, including empty string to
52
+ // clear), also fetch the other tab so both tabs always reflect the same
53
+ // search query. cacheOverride=true bypasses the cache check; pageToken
54
+ // is reset to undefined so the other tab starts from page 1.
55
+ if (searchString !== undefined) {
56
+ const otherTab = transactionsViewState_1.TRANSACTIONS_TABS.find((tab) => tab !== selectedTab);
57
+ if (otherTab != null) {
58
+ updateActions.push((0, transactionsViewReducer_1.fetchTransactionCategorization)(otherTab, period, true, keepExistingListItems, searchString, undefined, refreshViewInBackground, true, isUncategorizedExpenseCategoryEnabled));
59
+ }
60
+ }
50
61
  return (0, rxjs_1.from)(updateActions);
51
62
  }));
52
63
  exports.fetchTransactionCategorizationViewEpic = fetchTransactionCategorizationViewEpic;
@@ -19,6 +19,13 @@ export interface TransactionCategorizationQueryPayload {
19
19
  * on the backend.
20
20
  */
21
21
  sub_tab: CompletedSubTab;
22
+ /**
23
+ * When `false`, the backend scopes the search to the active tab's
24
+ * categorization status (respects `auto_categorized`). When `true` or
25
+ * omitted, the backend searches across all statuses — the legacy behaviour
26
+ * that the Receipts manual-match flow relies on.
27
+ */
28
+ search_all_statuses?: boolean;
22
29
  }
23
30
  export interface TransactionCategorizationPayload {
24
31
  next_page_token: string | null;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.1.13",
3
+ "version": "5.1.15-betaRD1",
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",
@@ -79,7 +79,7 @@
79
79
  "ts-prune": "^0.10.3",
80
80
  "ts-unused-exports": "^11.0.1",
81
81
  "typescript": "^5.7.3",
82
- "vitest": "^3.2.4"
82
+ "vitest": "^4.1.8"
83
83
  },
84
84
  "dependencies": {
85
85
  "@redux-devtools/extension": "^3.3.0",