@zeniai/client-epic-state 4.19.84-betaVR2 → 4.19.84-betaVR4

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.
@@ -9,7 +9,7 @@ const responsePayload_1 = require("../../../../responsePayload");
9
9
  const missingReceiptsPayload_1 = require("../../payload/missingReceiptsPayload");
10
10
  const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
11
11
  const fetchMultipleBatchDetailsEpic_1 = require("./fetchMultipleBatchDetailsEpic");
12
- const MORE_BATCH_PAGE_SIZE = 1;
12
+ const MORE_BATCH_PAGE_SIZE = 5;
13
13
  const fetchMoreBatchDetailsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchMoreBatchDetails.match),
14
14
  /** One page at a time — avoids duplicate loads if IO + scroll fallback both fire. */
15
15
  (0, operators_1.exhaustMap)(() => {
@@ -8,7 +8,7 @@ const transactionReducer_1 = require("../../../../entity/transaction/transaction
8
8
  const responsePayload_1 = require("../../../../responsePayload");
9
9
  const missingReceiptsPayload_1 = require("../../payload/missingReceiptsPayload");
10
10
  const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
11
- const INITIAL_BATCH_PAGE_SIZE = 1;
11
+ const INITIAL_BATCH_PAGE_SIZE = 5;
12
12
  function fetchBatchDetailsByIds(batchIds, zeniAPI) {
13
13
  if (batchIds.length === 0) {
14
14
  return rxjs_1.EMPTY;
@@ -19,9 +19,14 @@ exports.MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED = false;
19
19
  const searchTransactionsForManualMatchEpic = (actions$, state$, zeniAPI) => {
20
20
  const searchActions$ = actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.searchTransactionsForManualMatch.match));
21
21
  const pagination$ = searchActions$.pipe((0, operators_1.filter)((a) => a.payload.pageToken != null));
22
- const newSearch$ = searchActions$.pipe((0, operators_1.filter)((a) => a.payload.pageToken == null), (0, operators_1.debounceTime)(300));
23
- return (0, rxjs_1.merge)(pagination$, newSearch$).pipe((0, operators_1.switchMap)((action) => {
22
+ /** Clears: no debounce so switchMap cancels in-flight HTTP from the previous query immediately. */
23
+ const newSearchClear$ = searchActions$.pipe((0, operators_1.filter)((a) => a.payload.pageToken == null && a.payload.query.trim() === ''));
24
+ const newSearchDebounced$ = searchActions$.pipe((0, operators_1.filter)((a) => a.payload.pageToken == null && a.payload.query.trim() !== ''), (0, operators_1.debounceTime)(300));
25
+ return (0, rxjs_1.merge)(pagination$, newSearchClear$, newSearchDebounced$).pipe((0, operators_1.switchMap)((action) => {
24
26
  const { query, pageToken } = action.payload;
27
+ if (pageToken == null && query.trim() === '') {
28
+ return rxjs_1.EMPTY;
29
+ }
25
30
  const state = state$.value;
26
31
  const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload: { manualSearch, sortKey, sortOrder }, }, } = state;
27
32
  const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
@@ -357,7 +357,7 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
357
357
  if (originalStatus === 'no_match') {
358
358
  details.summary.noMatch = Math.max(0, details.summary.noMatch - 1);
359
359
  }
360
- else {
360
+ else if (originalStatus === 'un_matched') {
361
361
  details.summary.possibleMatches = Math.max(0, details.summary.possibleMatches - 1);
362
362
  }
363
363
  }
@@ -389,6 +389,16 @@ const expenseAutomationMissingReceiptsView = (0, toolkit_1.createSlice)({
389
389
  reducer(draft, action) {
390
390
  const { query, pageToken } = action.payload;
391
391
  const isLoadMore = pageToken != null;
392
+ const trimmed = query.trim();
393
+ /**
394
+ * Cleared input: reset fully (no In-Progress) so we never show a loader with stale rows,
395
+ * and the epic can cancel any in-flight search via switchMap without a debounce delay.
396
+ */
397
+ if (!isLoadMore && trimmed === '') {
398
+ draft.bulkUpload.manualSearch = exports.initialBulkUploadState.manualSearch;
399
+ draft.bulkUpload.manualSearchUiResetKey += 1;
400
+ return;
401
+ }
392
402
  draft.bulkUpload.manualSearch.searchQuery = query;
393
403
  if (isLoadMore) {
394
404
  draft.bulkUpload.manualSearch.isLoadingMore = true;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "4.19.84-betaVR2",
3
+ "version": "4.19.84-betaVR4",
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",
@@ -111,7 +111,7 @@
111
111
  "find-dead-code": "ts-prune | grep -v '(used in module)'",
112
112
  "find-unused-exports": "ts-unused-exports ./tsconfig.json",
113
113
  "circular-dependency": "npx madge --circular --extensions ts ./src",
114
- "build": "concurrently --kill-others-on-fail --handle-input \"echo 'Running ESLint...' && eslint . --ext .js,.jsx,.ts,.tsx\" \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\"",
114
+ "build": "concurrently --kill-others-on-fail --handle-input \"echo 'Running ESLint...' && eslint . --ext .js,.jsx,.ts,.tsx\" \"echo 'TypeScript build in progress...' && time tsc && echo 'ESM build...' && tsc -p tsconfig.esm.json\" \"echo 'Running tests and typecheck...' && pnpm test\" && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
115
115
  "only-build": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc && tsc -p tsconfig.esm.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
116
116
  "only-build-dev": "eslint . --ext .js,.jsx,.ts,.tsx && time tsc -p tsconfig.dev.json && tsc -p tsconfig.esm.dev.json && rimraf \"lib/**/__mocks__\" \"lib/**/__testHelpers__\"",
117
117
  "format": "prettier --write --ignore-unknown \"src/**/*\" && pnpm lint",