@zeniai/client-epic-state 5.0.12-betaVR1 → 5.0.12-betaVR11

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.
@@ -5,22 +5,23 @@ import { updateTransactions } from '../../../../entity/transaction/transactionRe
5
5
  import { isSuccessResponse } from '../../../../responsePayload';
6
6
  import { BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS } from '../../helpers/bulkUploadTiming';
7
7
  import { extractTransactionPayloadsFromBatchFiles, isBatchDetailsApiStatusCompleted, toBatchDetails, } from '../../payload/missingReceiptsPayload';
8
- import { bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation, restoreBulkUploadMatchingState, } from '../../reducers/missingReceiptsViewReducer';
8
+ import { bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, pusherBatchStatusUpdate, restoreBulkUploadMatchingState, } from '../../reducers/missingReceiptsViewReducer';
9
9
  /** First poll after upload; then interval while batch not resolved via Pusher or API. */
10
10
  const FALLBACK_FIRST_DELAY_MS = 30000;
11
11
  /** Shorter first poll for restored sessions — batch may already be near completion. */
12
12
  const RESTORE_FIRST_DELAY_MS = 5000;
13
13
  const FALLBACK_POLL_INTERVAL_MS = 10000;
14
14
  /**
15
- * On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs),
16
- * and request switching to the Unmatched tab. Debounced to reduce duplicate refreshes.
15
+ * On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs).
16
+ * Debounced to reduce duplicate refreshes. The post-match tab decision
17
+ * (Unmatched vs Completed) is made client-side in `ExpenseAutomationPage` once fresh
18
+ * batch details land -- do not dispatch `requestMissingReceiptsTabNavigation` here.
17
19
  */
18
20
  export const pusherBatchStatusCompletionEpic = (actions$) => actions$.pipe(filter(pusherBatchStatusUpdate.match), filter((action) => action.payload.status === 'completed'), debounceTime(300), mergeMap(() => from([
19
21
  fetchBulkUploadBatches({
20
22
  cacheOverride: true,
21
23
  invalidateBatchDetailsCache: true,
22
24
  }),
23
- requestMissingReceiptsTabNavigation({ tab: 'unmatched' }),
24
25
  ])));
25
26
  /**
26
27
  * If Pusher and batch-details are delayed beyond {@link BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS},
@@ -76,7 +77,6 @@ export const pollBulkUploadBatchStatusEpic = (actions$, _state$, zeniAPI) => act
76
77
  }
77
78
  actions.push(fetchBulkUploadBatchDetailsSuccess(toBatchDetails(response.data, zeniAPI.apiEndPoints.fileMicroServiceBaseUrl)));
78
79
  actions.push(fetchBulkUploadBatches({ cacheOverride: true }));
79
- actions.push(requestMissingReceiptsTabNavigation({ tab: 'unmatched' }));
80
80
  return from(actions);
81
81
  }
82
82
  }
@@ -199,6 +199,8 @@ export function getExpenseAutomationMissingReceiptsView(state) {
199
199
  batchDetails: resolvedBatchDetails,
200
200
  completedSubTab: bulkUpload.completedSubTab,
201
201
  currentBatchId: bulkUpload.currentBatchId,
202
+ currentBatchDetailsFetched: bulkUpload.currentBatchId != null &&
203
+ bulkUpload.batchDetailsById[bulkUpload.currentBatchId] != null,
202
204
  completedTransactions: {
203
205
  fetchState: completedTransactionsForPeriod?.fetchState ?? {
204
206
  fetchState: 'Not-Started',
@@ -4,11 +4,13 @@ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
4
  import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
5
5
  import { RootState } from '../../../../reducer';
6
6
  import { ZeniAPI } from '../../../../zeniAPI';
7
- import { bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation, restoreBulkUploadMatchingState } from '../../reducers/missingReceiptsViewReducer';
8
- export type ActionType = ReturnType<typeof bulkUploadReceiptsSuccess> | ReturnType<typeof restoreBulkUploadMatchingState> | ReturnType<typeof pusherBatchStatusUpdate> | ReturnType<typeof fetchBulkUploadBatchDetails> | ReturnType<typeof fetchBulkUploadBatchDetailsSuccess> | ReturnType<typeof fetchBulkUploadBatches> | ReturnType<typeof requestMissingReceiptsTabNavigation> | ReturnType<typeof updateTransactions> | ReturnType<typeof clearBulkUpload> | ReturnType<typeof openSnackbar> | ReturnType<typeof bulkUploadAutomatchingTimedOut>;
7
+ import { bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, pusherBatchStatusUpdate, restoreBulkUploadMatchingState } from '../../reducers/missingReceiptsViewReducer';
8
+ export type ActionType = ReturnType<typeof bulkUploadReceiptsSuccess> | ReturnType<typeof restoreBulkUploadMatchingState> | ReturnType<typeof pusherBatchStatusUpdate> | ReturnType<typeof fetchBulkUploadBatchDetails> | ReturnType<typeof fetchBulkUploadBatchDetailsSuccess> | ReturnType<typeof fetchBulkUploadBatches> | ReturnType<typeof updateTransactions> | ReturnType<typeof clearBulkUpload> | ReturnType<typeof openSnackbar> | ReturnType<typeof bulkUploadAutomatchingTimedOut>;
9
9
  /**
10
- * On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs),
11
- * and request switching to the Unmatched tab. Debounced to reduce duplicate refreshes.
10
+ * On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs).
11
+ * Debounced to reduce duplicate refreshes. The post-match tab decision
12
+ * (Unmatched vs Completed) is made client-side in `ExpenseAutomationPage` once fresh
13
+ * batch details land -- do not dispatch `requestMissingReceiptsTabNavigation` here.
12
14
  */
13
15
  export declare const pusherBatchStatusCompletionEpic: (actions$: ActionsObservable<ActionType>) => Observable<ActionType>;
14
16
  /**
@@ -15,15 +15,16 @@ const FALLBACK_FIRST_DELAY_MS = 30000;
15
15
  const RESTORE_FIRST_DELAY_MS = 5000;
16
16
  const FALLBACK_POLL_INTERVAL_MS = 10000;
17
17
  /**
18
- * On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs),
19
- * and request switching to the Unmatched tab. Debounced to reduce duplicate refreshes.
18
+ * On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs).
19
+ * Debounced to reduce duplicate refreshes. The post-match tab decision
20
+ * (Unmatched vs Completed) is made client-side in `ExpenseAutomationPage` once fresh
21
+ * batch details land -- do not dispatch `requestMissingReceiptsTabNavigation` here.
20
22
  */
21
23
  const pusherBatchStatusCompletionEpic = (actions$) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.pusherBatchStatusUpdate.match), (0, operators_1.filter)((action) => action.payload.status === 'completed'), (0, operators_1.debounceTime)(300), (0, operators_1.mergeMap)(() => (0, rxjs_1.from)([
22
24
  (0, missingReceiptsViewReducer_1.fetchBulkUploadBatches)({
23
25
  cacheOverride: true,
24
26
  invalidateBatchDetailsCache: true,
25
27
  }),
26
- (0, missingReceiptsViewReducer_1.requestMissingReceiptsTabNavigation)({ tab: 'unmatched' }),
27
28
  ])));
28
29
  exports.pusherBatchStatusCompletionEpic = pusherBatchStatusCompletionEpic;
29
30
  /**
@@ -81,7 +82,6 @@ const pollBulkUploadBatchStatusEpic = (actions$, _state$, zeniAPI) => actions$.p
81
82
  }
82
83
  actions.push((0, missingReceiptsViewReducer_1.fetchBulkUploadBatchDetailsSuccess)((0, missingReceiptsPayload_1.toBatchDetails)(response.data, zeniAPI.apiEndPoints.fileMicroServiceBaseUrl)));
83
84
  actions.push((0, missingReceiptsViewReducer_1.fetchBulkUploadBatches)({ cacheOverride: true }));
84
- actions.push((0, missingReceiptsViewReducer_1.requestMissingReceiptsTabNavigation)({ tab: 'unmatched' }));
85
85
  return (0, rxjs_1.from)(actions);
86
86
  }
87
87
  }
@@ -54,6 +54,8 @@ export interface BulkUploadSelectorData {
54
54
  uploadedFileCount: number;
55
55
  uploadProgress: number;
56
56
  uploadStatus: FetchStateAndError;
57
+ /** True iff `batchDetailsById[currentBatchId]` is populated -- signals post-match data is fresh. */
58
+ currentBatchDetailsFetched?: boolean;
57
59
  currentBatchId?: ID;
58
60
  }
59
61
  export interface ResolvedBatchDetails {
@@ -205,6 +205,8 @@ function getExpenseAutomationMissingReceiptsView(state) {
205
205
  batchDetails: resolvedBatchDetails,
206
206
  completedSubTab: bulkUpload.completedSubTab,
207
207
  currentBatchId: bulkUpload.currentBatchId,
208
+ currentBatchDetailsFetched: bulkUpload.currentBatchId != null &&
209
+ bulkUpload.batchDetailsById[bulkUpload.currentBatchId] != null,
208
210
  completedTransactions: {
209
211
  fetchState: completedTransactionsForPeriod?.fetchState ?? {
210
212
  fetchState: 'Not-Started',
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@zeniai/client-epic-state",
3
- "version": "5.0.12-betaVR1",
3
+ "version": "5.0.12-betaVR11",
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",