@zeniai/client-epic-state 5.0.71-betaVR3 → 5.0.71

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 (25) hide show
  1. package/lib/epic.d.ts +1 -3
  2. package/lib/epic.js +1 -3
  3. package/lib/esm/epic.js +1 -3
  4. package/lib/esm/index.js +2 -2
  5. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +5 -21
  6. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +9 -13
  7. package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +1 -79
  8. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +0 -2
  9. package/lib/index.d.ts +2 -2
  10. package/lib/index.js +34 -37
  11. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +5 -21
  12. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +5 -11
  13. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +8 -12
  14. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -13
  15. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -81
  16. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +0 -12
  17. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +0 -2
  18. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +0 -19
  19. package/package.json +2 -2
  20. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/refreshBatchDetailsForBatchIdEpic.js +0 -52
  21. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/syncTabsAfterAutomatchEpic.js +0 -53
  22. package/lib/view/expenseAutomationView/epics/missingReceipts/refreshBatchDetailsForBatchIdEpic.d.ts +0 -18
  23. package/lib/view/expenseAutomationView/epics/missingReceipts/refreshBatchDetailsForBatchIdEpic.js +0 -56
  24. package/lib/view/expenseAutomationView/epics/missingReceipts/syncTabsAfterAutomatchEpic.d.ts +0 -28
  25. package/lib/view/expenseAutomationView/epics/missingReceipts/syncTabsAfterAutomatchEpic.js +0 -57
@@ -1,57 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.syncTabsAfterAutomatchEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
7
- const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
8
- const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
9
- /**
10
- * After automatch completes for the active bulk-upload batch, refresh the two
11
- * caches that are not invalidated by the existing batch-details refresh path:
12
- * - Missing Receipts list (`transactionIdsBySelectedPeriod`)
13
- * - Completed transactions cache (`bulkUpload.completedTransactionsByPeriod`)
14
- *
15
- * The Unmatched tab is already kept fresh via `pusherBatchStatusCompletionEpic`
16
- * dispatching `fetchBulkUploadBatches({invalidateBatchDetailsCache: true})`,
17
- * which feeds `fetchMultipleBatchDetailsEpic` and re-stores batch details.
18
- *
19
- * Lifecycle mirrors `bulkUploadMatchResultToastEpic`: trigger on
20
- * `bulkUploadReceiptsSuccess` (fresh upload) or `restoreBulkUploadMatchingState`
21
- * (restored session), then wait for the first batch-details action for that
22
- * batchId — landing as either `fetchBulkUploadBatchDetailsSuccess` or
23
- * `storeBatchDetails`. `clearBulkUpload` cancels the in-flight wait.
24
- *
25
- * Refetches use `cacheOverride: true` to bypass per-tab cache guards, and
26
- * `fetchMissingReceipts` uses `refreshViewInBackground: true` to keep the
27
- * existing rows visible while fresh data is in flight (the authoritative
28
- * server filter `is_attachment_missing_only=true` removes matched rows once
29
- * the response lands).
30
- */
31
- const syncTabsAfterAutomatchEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)((action) => missingReceiptsViewReducer_1.bulkUploadReceiptsSuccess.match(action) ||
32
- missingReceiptsViewReducer_1.restoreBulkUploadMatchingState.match(action)), (0, operators_1.switchMap)((uploadAction) => {
33
- const { batchId } = uploadAction.payload;
34
- return (0, rxjs_1.merge)(actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchBulkUploadBatchDetailsSuccess.match)), actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.storeBatchDetails.match))).pipe((0, operators_1.filter)((a) => a.payload.batchId === batchId), (0, operators_1.take)(1), (0, operators_1.switchMap)((action) => {
35
- const { summary } = action.payload;
36
- if (summary.matched <= 0) {
37
- return rxjs_1.EMPTY;
38
- }
39
- const state = state$.value;
40
- const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
41
- const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
42
- if (selectedPeriod == null) {
43
- return (0, rxjs_1.from)([(0, missingReceiptsViewReducer_1.fetchCompletedTransactions)(undefined, true)]);
44
- }
45
- const period = (0, timePeriod_1.convertToPeriod)(selectedPeriod);
46
- const timePeriodStart = (0, timePeriod_1.toAbsoluteDay)(period.start);
47
- const timePeriodEnd = (0, timePeriod_1.toAbsoluteDay)(period.end);
48
- if (timePeriodStart == null || timePeriodEnd == null) {
49
- return (0, rxjs_1.from)([(0, missingReceiptsViewReducer_1.fetchCompletedTransactions)(undefined, true)]);
50
- }
51
- return (0, rxjs_1.from)([
52
- (0, missingReceiptsViewReducer_1.fetchMissingReceipts)({ start: timePeriodStart, end: timePeriodEnd }, { amount: 75.0, currencyCode: 'USD', currencySymbol: '$' }, true, true),
53
- (0, missingReceiptsViewReducer_1.fetchCompletedTransactions)(undefined, true),
54
- ]);
55
- }), (0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.clearBulkUpload.match))));
56
- }));
57
- exports.syncTabsAfterAutomatchEpic = syncTabsAfterAutomatchEpic;