@zeniai/client-epic-state 4.19.91-betaJK6 → 4.19.92

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 (122) hide show
  1. package/lib/entity/account/accountPayload.d.ts +0 -2
  2. package/lib/entity/account/accountPayload.js +0 -2
  3. package/lib/entity/account/accountState.d.ts +0 -2
  4. package/lib/entity/depositAccount/depositAccount.d.ts +1 -1
  5. package/lib/entity/depositAccount/depositAccount.js +1 -8
  6. package/lib/entity/reimbursement/reimbursementPayload.d.ts +0 -2
  7. package/lib/entity/reimbursement/reimbursementPayload.js +0 -7
  8. package/lib/entity/reimbursement/reimbursementState.d.ts +0 -2
  9. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  10. package/lib/entity/snackbar/snackbarTypes.js +0 -1
  11. package/lib/entity/task/taskPayload.d.ts +0 -1
  12. package/lib/entity/task/taskPayload.js +0 -1
  13. package/lib/entity/task/taskState.d.ts +0 -1
  14. package/lib/epic.d.ts +1 -12
  15. package/lib/epic.js +1 -12
  16. package/lib/esm/entity/account/accountPayload.js +0 -2
  17. package/lib/esm/entity/depositAccount/depositAccount.js +1 -8
  18. package/lib/esm/entity/reimbursement/reimbursementPayload.js +0 -7
  19. package/lib/esm/entity/snackbar/snackbarTypes.js +0 -1
  20. package/lib/esm/entity/task/taskPayload.js +0 -1
  21. package/lib/esm/epic.js +1 -12
  22. package/lib/esm/index.js +3 -9
  23. package/lib/esm/reducer.js +0 -6
  24. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +5 -7
  25. package/lib/esm/view/expenseAutomationView/payload/missingReceiptsPayload.js +1 -189
  26. package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -433
  27. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +1 -23
  28. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +1 -244
  29. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +1 -2
  30. package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +0 -44
  31. package/lib/esm/view/expenseAutomationView/types/transactionsViewState.js +1 -2
  32. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +1 -1
  33. package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +0 -1
  34. package/lib/esm/view/taskManager/taskListView/taskListSelector.js +1 -3
  35. package/lib/esm/view/userListView/fetchUserListByTypeEpic.js +0 -11
  36. package/lib/esm/zeniAPI.js +2 -0
  37. package/lib/index.d.ts +4 -8
  38. package/lib/index.js +32 -82
  39. package/lib/reducer.d.ts +0 -6
  40. package/lib/reducer.js +0 -6
  41. package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
  42. package/lib/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +5 -7
  43. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  44. package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.d.ts +0 -118
  45. package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +0 -201
  46. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +3 -76
  47. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -434
  48. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +3 -11
  49. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +2 -24
  50. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +1 -69
  51. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +0 -1
  52. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.d.ts +1 -1
  53. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +0 -243
  54. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +1 -2
  55. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +0 -142
  56. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +1 -54
  57. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +1 -2
  58. package/lib/view/expenseAutomationView/types/transactionsViewState.js +1 -2
  59. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +1 -1
  60. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +0 -1
  61. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +0 -1
  62. package/lib/view/taskManager/taskListView/taskListSelector.d.ts +0 -2
  63. package/lib/view/taskManager/taskListView/taskListSelector.js +1 -3
  64. package/lib/view/userListView/fetchUserListByTypeEpic.d.ts +1 -3
  65. package/lib/view/userListView/fetchUserListByTypeEpic.js +0 -11
  66. package/lib/view/userListView/userListViewPayload.d.ts +0 -2
  67. package/lib/zeniAPI.js +2 -0
  68. package/package.json +2 -2
  69. package/lib/entity/userGroups/userGroupsPayload.d.ts +0 -7
  70. package/lib/entity/userGroups/userGroupsPayload.js +0 -10
  71. package/lib/entity/userGroups/userGroupsReducer.d.ts +0 -8
  72. package/lib/entity/userGroups/userGroupsReducer.js +0 -29
  73. package/lib/entity/userGroups/userGroupsSelector.d.ts +0 -4
  74. package/lib/entity/userGroups/userGroupsSelector.js +0 -12
  75. package/lib/entity/userGroups/userGroupsState.d.ts +0 -9
  76. package/lib/entity/userGroups/userGroupsState.js +0 -2
  77. package/lib/esm/entity/userGroups/userGroupsPayload.js +0 -7
  78. package/lib/esm/entity/userGroups/userGroupsReducer.js +0 -25
  79. package/lib/esm/entity/userGroups/userGroupsSelector.js +0 -8
  80. package/lib/esm/entity/userGroups/userGroupsState.js +0 -1
  81. package/lib/esm/view/expenseAutomationView/bulkUploadTiming.js +0 -10
  82. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +0 -29
  83. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +0 -49
  84. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +0 -40
  85. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +0 -47
  86. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +0 -61
  87. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +0 -33
  88. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +0 -56
  89. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +0 -77
  90. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +0 -79
  91. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +0 -24
  92. package/lib/esm/view/userGroupListView/userGroupListViewReducer.js +0 -69
  93. package/lib/esm/view/userGroupListView/userGroupListViewSelector.js +0 -16
  94. package/lib/esm/view/userGroupListView/userGroupListViewState.js +0 -1
  95. package/lib/view/expenseAutomationView/bulkUploadTiming.d.ts +0 -10
  96. package/lib/view/expenseAutomationView/bulkUploadTiming.js +0 -13
  97. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.d.ts +0 -18
  98. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +0 -33
  99. package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.d.ts +0 -7
  100. package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +0 -53
  101. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.d.ts +0 -8
  102. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +0 -44
  103. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.d.ts +0 -7
  104. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +0 -51
  105. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.d.ts +0 -8
  106. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +0 -65
  107. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.d.ts +0 -8
  108. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +0 -37
  109. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.d.ts +0 -9
  110. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +0 -61
  111. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.d.ts +0 -14
  112. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +0 -81
  113. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +0 -25
  114. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +0 -85
  115. package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.d.ts +0 -7
  116. package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +0 -28
  117. package/lib/view/userGroupListView/userGroupListViewReducer.d.ts +0 -23
  118. package/lib/view/userGroupListView/userGroupListViewReducer.js +0 -73
  119. package/lib/view/userGroupListView/userGroupListViewSelector.d.ts +0 -7
  120. package/lib/view/userGroupListView/userGroupListViewSelector.js +0 -20
  121. package/lib/view/userGroupListView/userGroupListViewState.d.ts +0 -8
  122. package/lib/view/userGroupListView/userGroupListViewState.js +0 -2
@@ -1,61 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.fetchMultipleBatchDetailsEpic = void 0;
4
- exports.fetchBatchDetailsByIds = fetchBatchDetailsByIds;
5
- const rxjs_1 = require("rxjs");
6
- const operators_1 = require("rxjs/operators");
7
- const transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
8
- const responsePayload_1 = require("../../../../responsePayload");
9
- const missingReceiptsPayload_1 = require("../../payload/missingReceiptsPayload");
10
- const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
11
- const INITIAL_BATCH_PAGE_SIZE = 5;
12
- function fetchBatchDetailsByIds(batchIds, zeniAPI) {
13
- if (batchIds.length === 0) {
14
- return rxjs_1.EMPTY;
15
- }
16
- return (0, rxjs_1.from)(batchIds).pipe((0, operators_1.mergeMap)((batchId) => zeniAPI
17
- .getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches/${batchId}`)
18
- .pipe((0, operators_1.mergeMap)((response) => {
19
- if (!(0, responsePayload_1.isSuccessResponse)(response) ||
20
- response.data == null ||
21
- !(0, missingReceiptsPayload_1.isBatchDetailsApiStatusCompleted)(response.data.status)) {
22
- return rxjs_1.EMPTY;
23
- }
24
- const actions = [];
25
- const transactionPayloads = (0, missingReceiptsPayload_1.extractTransactionPayloadsFromBatchFiles)(response.data.files);
26
- if (transactionPayloads.length > 0) {
27
- actions.push((0, transactionReducer_1.updateTransactions)(transactionPayloads, (value) => value.transaction_id));
28
- }
29
- actions.push((0, missingReceiptsViewReducer_1.storeBatchDetails)((0, missingReceiptsPayload_1.toBatchDetails)(response.data, zeniAPI.apiEndPoints.fileMicroServiceBaseUrl)));
30
- return (0, rxjs_1.from)(actions);
31
- }), (0, operators_1.catchError)((error) => {
32
- console.error(`Failed to fetch batch details for ${batchId}:`, (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch batch details errored out: ' + JSON.stringify(error)));
33
- return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.batchDetailFetchFailed)({ batchId }));
34
- })), 5));
35
- }
36
- const fetchMultipleBatchDetailsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchBulkUploadBatchesSuccess.match), (0, operators_1.mergeMap)((action) => {
37
- const batchList = action.payload.batchList;
38
- const { batchDetailsById } = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
39
- /** Only completed list rows may trigger batch-details API; preserve platform order. */
40
- const completedBatchesMissingDetails = (0, missingReceiptsPayload_1.filterBatchListItemsForBatchDetailsFetch)(batchList).filter((batch) => batchDetailsById[batch.batchId] == null);
41
- const completedBatchIds = completedBatchesMissingDetails.map((batch) => batch.batchId);
42
- const batchIdsToFetch = completedBatchIds.slice(0, INITIAL_BATCH_PAGE_SIZE);
43
- if (batchIdsToFetch.length === 0) {
44
- /**
45
- * List refresh can complete while no row is `completed` yet (multi-fetch skips), or
46
- * `currentBatchId` may not appear in the filtered list but still needs `GET /batches/:id`.
47
- * Fall back to the single-batch-details epic so `phase` and details can resolve.
48
- */
49
- const bulkUpload = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
50
- const currentId = bulkUpload.currentBatchId;
51
- if (currentId != null &&
52
- bulkUpload.phase === 'matching' &&
53
- bulkUpload.batchDetailsById[currentId] == null &&
54
- (0, missingReceiptsPayload_1.shouldFetchBatchDetailsForBatchId)(bulkUpload.batchStatusById, bulkUpload.batchListByPeriod, currentId)) {
55
- return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchBulkUploadBatchDetails)());
56
- }
57
- return rxjs_1.EMPTY;
58
- }
59
- return (0, rxjs_1.concat)((0, rxjs_1.of)((0, missingReceiptsViewReducer_1.setInitialBatchDetailsLoading)()), fetchBatchDetailsByIds(batchIdsToFetch, zeniAPI), (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.fetchMoreBatchDetailsComplete)()));
60
- }));
61
- exports.fetchMultipleBatchDetailsEpic = fetchMultipleBatchDetailsEpic;
@@ -1,14 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
4
- import { RootState } from '../../../../reducer';
5
- import { ZeniAPI } from '../../../../zeniAPI';
6
- import { searchTransactionsForManualMatch, searchTransactionsForManualMatchFailure, searchTransactionsForManualMatchSuccess } from '../../reducers/missingReceiptsViewReducer';
7
- /**
8
- * `auto_categorized` for manual transaction search (Unmatched).
9
- * Backend contract TBD — align with `fetchTransactionCategorizationEpic` (`selectedTab === 'autoCategorized'`)
10
- * when the expense-automation API documents the intended filter for this flow.
11
- */
12
- export declare const MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED = false;
13
- export type ActionType = ReturnType<typeof searchTransactionsForManualMatch> | ReturnType<typeof searchTransactionsForManualMatchSuccess> | ReturnType<typeof searchTransactionsForManualMatchFailure> | ReturnType<typeof updateTransactions>;
14
- export declare const searchTransactionsForManualMatchEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,81 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.searchTransactionsForManualMatchEpic = exports.MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED = 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 transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
9
- const responsePayload_1 = require("../../../../responsePayload");
10
- const missingReceiptsPayload_1 = require("../../payload/missingReceiptsPayload");
11
- const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
12
- const transactionsViewState_1 = require("../../types/transactionsViewState");
13
- /**
14
- * `auto_categorized` for manual transaction search (Unmatched).
15
- * Backend contract TBD — align with `fetchTransactionCategorizationEpic` (`selectedTab === 'autoCategorized'`)
16
- * when the expense-automation API documents the intended filter for this flow.
17
- */
18
- exports.MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED = false;
19
- const searchTransactionsForManualMatchEpic = (actions$, state$, zeniAPI) => {
20
- const searchActions$ = actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.searchTransactionsForManualMatch.match));
21
- const pagination$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken != null));
22
- /**
23
- * No API for empty or 1-char queries; immediate merge so switchMap cancels any in-flight HTTP.
24
- */
25
- const newSearchTooShortOrClear$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken == null &&
26
- action.payload.query.trim().length < 2));
27
- const newSearchDebounced$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken == null &&
28
- action.payload.query.trim().length >= 2), (0, operators_1.debounceTime)(300));
29
- return (0, rxjs_1.merge)(pagination$, newSearchTooShortOrClear$, newSearchDebounced$).pipe((0, operators_1.switchMap)((action) => {
30
- const { query, pageToken } = action.payload;
31
- if (pageToken == null && query.trim().length < 2) {
32
- return rxjs_1.EMPTY;
33
- }
34
- const state = state$.value;
35
- const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload: { manualSearch, sortKey, sortOrder }, }, } = state;
36
- const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
37
- const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
38
- if (selectedPeriod == null) {
39
- return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.searchTransactionsForManualMatchFailure)({
40
- error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Manual search requires a selected accounting period.'),
41
- }));
42
- }
43
- const period = (0, timePeriod_1.convertToPeriod)(selectedPeriod);
44
- const queryParam = {
45
- start_date: period.start,
46
- end_date: period.end,
47
- auto_categorized: exports.MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED,
48
- sort_by: (0, transactionsViewState_1.toTransactionsSortKey)(sortKey),
49
- sort_order: sortOrder === 'ascending' ? 'asc' : 'desc',
50
- page_token: pageToken ?? null,
51
- page_size: manualSearch.pageSize,
52
- search_text: query,
53
- };
54
- return zeniAPI
55
- .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expense-automation/transactions?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
56
- .pipe((0, operators_1.mergeMap)((response) => {
57
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
58
- const { transactions, next_page_token, total_count } = response.data;
59
- const append = pageToken != null;
60
- const results = transactions.map(missingReceiptsPayload_1.supportedTransactionPayloadToManualSearchResult);
61
- const actionsOut = [
62
- (0, transactionReducer_1.updateTransactions)(transactions, (value) => value.transaction_id, 'merge'),
63
- (0, missingReceiptsViewReducer_1.searchTransactionsForManualMatchSuccess)({
64
- append,
65
- nextPageToken: next_page_token ?? null,
66
- results,
67
- totalCount: total_count,
68
- }),
69
- ];
70
- return (0, rxjs_1.from)(actionsOut);
71
- }
72
- return (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.searchTransactionsForManualMatchFailure)({
73
- error: response.status,
74
- }));
75
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, missingReceiptsViewReducer_1.searchTransactionsForManualMatchFailure)({
76
- error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Search transactions for manual match errored: ' +
77
- JSON.stringify(error)),
78
- }))));
79
- }));
80
- };
81
- exports.searchTransactionsForManualMatchEpic = searchTransactionsForManualMatchEpic;
@@ -1,25 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { Observable } from 'rxjs';
3
- import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
- import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
5
- import { RootState } from '../../../../reducer';
6
- import { ZeniAPI } from '../../../../zeniAPI';
7
- import { bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation } from '../../reducers/missingReceiptsViewReducer';
8
- export type ActionType = ReturnType<typeof bulkUploadReceiptsSuccess> | ReturnType<typeof pusherBatchStatusUpdate> | ReturnType<typeof fetchBulkUploadBatchDetailsSuccess> | ReturnType<typeof fetchBulkUploadBatches> | ReturnType<typeof requestMissingReceiptsTabNavigation> | ReturnType<typeof updateTransactions> | ReturnType<typeof clearBulkUpload> | ReturnType<typeof openSnackbar> | ReturnType<typeof bulkUploadAutomatchingTimedOut>;
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.
12
- */
13
- export declare const pusherBatchStatusCompletionEpic: (actions$: ActionsObservable<ActionType>) => Observable<ActionType>;
14
- /**
15
- * If Pusher and batch-details are delayed beyond {@link BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS},
16
- * force `phase` to `completed` (dismiss automatching banner) and refresh the batch list.
17
- * Cancels when the batch completes normally, bulk state is cleared, or another upload supersedes.
18
- */
19
- export declare const bulkUploadAutomatchingTimeoutEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
20
- /**
21
- * Fallback polling when Pusher is slow or unavailable. Network errors on a poll tick show one
22
- * error snackbar per upload session (first failure only) so the user is not spammed every
23
- * interval; Pusher or a later successful poll still completes the flow.
24
- */
25
- export declare const pollBulkUploadBatchStatusEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -1,85 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.pollBulkUploadBatchStatusEpic = exports.bulkUploadAutomatchingTimeoutEpic = exports.pusherBatchStatusCompletionEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
7
- const transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
8
- const responsePayload_1 = require("../../../../responsePayload");
9
- const bulkUploadTiming_1 = require("../../bulkUploadTiming");
10
- const missingReceiptsPayload_1 = require("../../payload/missingReceiptsPayload");
11
- const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
12
- /** First poll after upload; then interval while batch not resolved via Pusher or API. */
13
- const FALLBACK_FIRST_DELAY_MS = 30000;
14
- const FALLBACK_POLL_INTERVAL_MS = 10000;
15
- /**
16
- * On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs),
17
- * and request switching to the Unmatched tab. Debounced to reduce duplicate refreshes.
18
- */
19
- 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)([
20
- (0, missingReceiptsViewReducer_1.fetchBulkUploadBatches)({
21
- cacheOverride: true,
22
- invalidateBatchDetailsCache: true,
23
- }),
24
- (0, missingReceiptsViewReducer_1.requestMissingReceiptsTabNavigation)({ tab: 'unmatched' }),
25
- ])));
26
- exports.pusherBatchStatusCompletionEpic = pusherBatchStatusCompletionEpic;
27
- /**
28
- * If Pusher and batch-details are delayed beyond {@link BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS},
29
- * force `phase` to `completed` (dismiss automatching banner) and refresh the batch list.
30
- * Cancels when the batch completes normally, bulk state is cleared, or another upload supersedes.
31
- */
32
- const bulkUploadAutomatchingTimeoutEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.bulkUploadReceiptsSuccess.match), (0, operators_1.mergeMap)((action) => {
33
- const { batchId } = action.payload;
34
- return (0, rxjs_1.timer)(bulkUploadTiming_1.BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS).pipe((0, operators_1.mergeMap)(() => {
35
- const bulk = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
36
- if (bulk.phase !== 'matching' || bulk.currentBatchId !== batchId) {
37
- return rxjs_1.EMPTY;
38
- }
39
- return (0, rxjs_1.from)([
40
- (0, missingReceiptsViewReducer_1.bulkUploadAutomatchingTimedOut)(batchId),
41
- (0, missingReceiptsViewReducer_1.fetchBulkUploadBatches)({ cacheOverride: true }),
42
- ]);
43
- }), (0, operators_1.takeUntil)((0, rxjs_1.merge)(actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.clearBulkUpload.match)), actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.pusherBatchStatusUpdate.match), (0, operators_1.filter)((a) => a.payload.batchId === batchId &&
44
- a.payload.status === 'completed')), actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchBulkUploadBatchDetailsSuccess.match), (0, operators_1.filter)((a) => a.payload.batchId === batchId)))));
45
- }));
46
- exports.bulkUploadAutomatchingTimeoutEpic = bulkUploadAutomatchingTimeoutEpic;
47
- /**
48
- * Fallback polling when Pusher is slow or unavailable. Network errors on a poll tick show one
49
- * error snackbar per upload session (first failure only) so the user is not spammed every
50
- * interval; Pusher or a later successful poll still completes the flow.
51
- */
52
- const pollBulkUploadBatchStatusEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.bulkUploadReceiptsSuccess.match), (0, operators_1.mergeMap)((action) => {
53
- const { batchId } = action.payload;
54
- let pollErrorNotified = false;
55
- return (0, rxjs_1.timer)(FALLBACK_FIRST_DELAY_MS, FALLBACK_POLL_INTERVAL_MS).pipe((0, operators_1.takeUntil)((0, rxjs_1.merge)(actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.clearBulkUpload.match)), actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.pusherBatchStatusUpdate.match), (0, operators_1.filter)((action) => action.payload.batchId === batchId)), actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchBulkUploadBatchDetailsSuccess.match), (0, operators_1.filter)((action) => action.payload.batchId === batchId)), actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.bulkUploadAutomatchingTimedOut.match), (0, operators_1.filter)((action) => action.payload.batchId === batchId)))), (0, operators_1.switchMap)(() => zeniAPI
56
- .getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches/${batchId}`)
57
- .pipe((0, operators_1.mergeMap)((response) => {
58
- /** Same batch-details URL; polls until `status` is completed (Pusher may win first). */
59
- if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
60
- if ((0, missingReceiptsPayload_1.isBatchDetailsApiStatusCompleted)(response.data.status)) {
61
- const actions = [];
62
- const transactionPayloads = (0, missingReceiptsPayload_1.extractTransactionPayloadsFromBatchFiles)(response.data.files);
63
- if (transactionPayloads.length > 0) {
64
- actions.push((0, transactionReducer_1.updateTransactions)(transactionPayloads, (value) => value.transaction_id));
65
- }
66
- actions.push((0, missingReceiptsViewReducer_1.fetchBulkUploadBatchDetailsSuccess)((0, missingReceiptsPayload_1.toBatchDetails)(response.data, zeniAPI.apiEndPoints.fileMicroServiceBaseUrl)));
67
- actions.push((0, missingReceiptsViewReducer_1.fetchBulkUploadBatches)({ cacheOverride: true }));
68
- actions.push((0, missingReceiptsViewReducer_1.requestMissingReceiptsTabNavigation)({ tab: 'unmatched' }));
69
- return (0, rxjs_1.from)(actions);
70
- }
71
- }
72
- return rxjs_1.EMPTY;
73
- }), (0, operators_1.catchError)(() => {
74
- if (!pollErrorNotified) {
75
- pollErrorNotified = true;
76
- return (0, rxjs_1.of)((0, snackbarReducer_1.openSnackbar)({
77
- messageSection: 'receipts_upload',
78
- messageText: 'failed',
79
- type: 'error',
80
- }));
81
- }
82
- return rxjs_1.EMPTY;
83
- }))));
84
- }));
85
- exports.pollBulkUploadBatchStatusEpic = pollBulkUploadBatchStatusEpic;
@@ -1,7 +0,0 @@
1
- import { ActionsObservable, StateObservable } from 'redux-observable';
2
- import { updateTransaction } from '../../../../entity/transaction/transactionReducer';
3
- import { RootState } from '../../../../reducer';
4
- import { fetchMonthEndCloseChecks } from '../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer';
5
- import { uploadTransactionCategorizationReceiptSuccess } from '../../reducers/transactionsViewReducer';
6
- export type ActionType = ReturnType<typeof uploadTransactionCategorizationReceiptSuccess> | ReturnType<typeof fetchMonthEndCloseChecks> | ReturnType<typeof updateTransaction>;
7
- export declare const uploadTransactionReceiptSuccessEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => import("rxjs").Observable<ActionType>;
@@ -1,28 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.uploadTransactionReceiptSuccessEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
7
- const transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
8
- const monthEndCloseChecksViewReducer_1 = require("../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer");
9
- const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
10
- const uploadTransactionReceiptSuccessEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(transactionsViewReducer_1.uploadTransactionCategorizationReceiptSuccess.match), (0, operators_1.mergeMap)((action) => {
11
- const { transactionPayload, updateType } = action.payload;
12
- const updateActions = [];
13
- const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state$.value);
14
- const selectedPeriodByTenantId = state$.value.expenseAutomationViewState.selectedPeriodByTenantId;
15
- updateActions.push((0, transactionReducer_1.updateTransaction)(transactionPayload.transaction_id, transactionPayload, updateType));
16
- if (currentTenant != null) {
17
- const monthEndChecksPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
18
- if (monthEndChecksPeriod != null) {
19
- updateActions.push((0, monthEndCloseChecksViewReducer_1.fetchMonthEndCloseChecks)({
20
- tenantId: currentTenant.tenantId,
21
- period: monthEndChecksPeriod,
22
- refreshViewInBackground: true,
23
- }));
24
- }
25
- }
26
- return (0, rxjs_1.from)(updateActions);
27
- }));
28
- exports.uploadTransactionReceiptSuccessEpic = uploadTransactionReceiptSuccessEpic;
@@ -1,23 +0,0 @@
1
- import { ID } from '../../commonStateTypes/common';
2
- import { UserGroupPayload } from '../../entity/userGroups/userGroupsPayload';
3
- import { ZeniAPIStatus } from '../../responsePayload';
4
- import { UserGroupListType, UserGroupListViewState } from './userGroupListViewState';
5
- export declare const initialState: UserGroupListViewState;
6
- export declare const fetchUserGroupListByType: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[userGroupType: "taskManagerCandidate", cacheOverride?: any], {
7
- userGroupType: "taskManagerCandidate";
8
- cacheOverride: any;
9
- }, "userGroupListView/fetchUserGroupListByType", never, never>, updateUserGroupIds: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
10
- userGroupsPayload: UserGroupPayload[];
11
- userGroupType: UserGroupListType;
12
- }, "userGroupListView/updateUserGroupIds">, addUserGroupId: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
13
- id: ID;
14
- userGroupType: UserGroupListType;
15
- }, "userGroupListView/addUserGroupId">, removeUserGroupId: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
16
- id: ID;
17
- userGroupType: UserGroupListType;
18
- }, "userGroupListView/removeUserGroupId">, updateUserGroupListFetchFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
19
- status: ZeniAPIStatus;
20
- userGroupType: UserGroupListType;
21
- }, "userGroupListView/updateUserGroupListFetchFailure">, clearUserGroupListView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"userGroupListView/clearUserGroupListView">;
22
- declare const _default: import("redux").Reducer<UserGroupListViewState>;
23
- export default _default;
@@ -1,73 +0,0 @@
1
- "use strict";
2
- var _a;
3
- Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.clearUserGroupListView = exports.updateUserGroupListFetchFailure = exports.removeUserGroupId = exports.addUserGroupId = exports.updateUserGroupIds = exports.fetchUserGroupListByType = exports.initialState = void 0;
5
- const toolkit_1 = require("@reduxjs/toolkit");
6
- const initialUserGroupList = {
7
- ids: [],
8
- fetchState: 'Not-Started',
9
- error: undefined,
10
- hasValidState() {
11
- return this.fetchState == 'Completed';
12
- },
13
- };
14
- exports.initialState = {
15
- userGroupListByType: {
16
- taskManagerCandidate: initialUserGroupList,
17
- },
18
- };
19
- const userGroupListView = (0, toolkit_1.createSlice)({
20
- name: 'userGroupListView',
21
- initialState: exports.initialState,
22
- reducers: {
23
- fetchUserGroupListByType: {
24
- reducer(draft, action) {
25
- const { userGroupType, cacheOverride } = action.payload;
26
- if (cacheOverride === true ||
27
- (cacheOverride === false &&
28
- draft.userGroupListByType[userGroupType].hasValidState() === false)) {
29
- draft.userGroupListByType[userGroupType].fetchState = 'In-Progress';
30
- draft.userGroupListByType[userGroupType].error = undefined;
31
- }
32
- },
33
- prepare(userGroupType, cacheOverride = false) {
34
- return {
35
- payload: {
36
- userGroupType,
37
- cacheOverride,
38
- },
39
- };
40
- },
41
- },
42
- updateUserGroupIds(draft, action) {
43
- const { userGroupType, userGroupsPayload } = action.payload;
44
- draft.userGroupListByType[userGroupType].fetchState = 'Completed';
45
- draft.userGroupListByType[userGroupType].error = undefined;
46
- draft.userGroupListByType[userGroupType].ids = userGroupsPayload.map((userGroup) => userGroup.id);
47
- },
48
- addUserGroupId(draft, action) {
49
- const { userGroupType, id } = action.payload;
50
- const index = draft.userGroupListByType[userGroupType].ids.indexOf(id);
51
- if (index < 0) {
52
- draft.userGroupListByType[userGroupType].ids.push(id);
53
- }
54
- },
55
- removeUserGroupId(draft, action) {
56
- const { userGroupType, id } = action.payload;
57
- const index = draft.userGroupListByType[userGroupType].ids.indexOf(id);
58
- if (index > -1) {
59
- draft.userGroupListByType[userGroupType].ids.splice(index, 1);
60
- }
61
- },
62
- updateUserGroupListFetchFailure(draft, action) {
63
- const { userGroupType, status } = action.payload;
64
- draft.userGroupListByType[userGroupType].fetchState = 'Error';
65
- draft.userGroupListByType[userGroupType].error = status;
66
- },
67
- clearUserGroupListView(draft) {
68
- Object.assign(draft, exports.initialState);
69
- },
70
- },
71
- });
72
- _a = userGroupListView.actions, exports.fetchUserGroupListByType = _a.fetchUserGroupListByType, exports.updateUserGroupIds = _a.updateUserGroupIds, exports.addUserGroupId = _a.addUserGroupId, exports.removeUserGroupId = _a.removeUserGroupId, exports.updateUserGroupListFetchFailure = _a.updateUserGroupListFetchFailure, exports.clearUserGroupListView = _a.clearUserGroupListView;
73
- exports.default = userGroupListView.reducer;
@@ -1,7 +0,0 @@
1
- import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
2
- import { UserGroup, UserGroupsState } from '../../entity/userGroups/userGroupsState';
3
- import { UserGroupListType, UserGroupListViewState } from './userGroupListViewState';
4
- export interface UserGroupListSelectorView extends SelectorView {
5
- userGroups: UserGroup[];
6
- }
7
- export declare const getUserGroupList: (userGroupsState: UserGroupsState, userGroupListViewState: UserGroupListViewState, userGroupType: UserGroupListType) => UserGroupListSelectorView;
@@ -1,20 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getUserGroupList = void 0;
4
- const userGroupsSelector_1 = require("../../entity/userGroups/userGroupsSelector");
5
- const getUserGroupList = (userGroupsState, userGroupListViewState, userGroupType) => {
6
- const listState = userGroupListViewState.userGroupListByType[userGroupType];
7
- return {
8
- userGroups: getUserGroupListByIds(userGroupsState, userGroupListViewState, userGroupType),
9
- fetchState: listState?.fetchState,
10
- error: listState?.error,
11
- version: 0,
12
- };
13
- };
14
- exports.getUserGroupList = getUserGroupList;
15
- function getUserGroupListByIds(userGroupsState, userGroupListViewState, type) {
16
- const userGroupIds = userGroupListViewState.userGroupListByType[type].ids;
17
- return userGroupIds
18
- .map((id) => (0, userGroupsSelector_1.getUserGroupByUserGroupId)(userGroupsState, id))
19
- .filter((value) => value != null);
20
- }
@@ -1,8 +0,0 @@
1
- import { FetchedState, ID } from '../../commonStateTypes/common';
2
- export type UserGroupListType = 'taskManagerCandidate';
3
- export interface UserGroupIdsByType extends FetchedState {
4
- ids: ID[];
5
- }
6
- export interface UserGroupListViewState {
7
- userGroupListByType: Record<UserGroupListType, UserGroupIdsByType>;
8
- }
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });