@zeniai/client-epic-state 4.19.96 → 4.19.97

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 (124) 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/accountRecon/saveReconciliationReviewEpic.js +3 -8
  25. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +5 -7
  26. package/lib/esm/view/expenseAutomationView/payload/missingReceiptsPayload.js +1 -189
  27. package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -433
  28. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +1 -23
  29. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +1 -244
  30. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +1 -2
  31. package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +0 -44
  32. package/lib/esm/view/expenseAutomationView/types/transactionsViewState.js +1 -2
  33. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +1 -1
  34. package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +0 -1
  35. package/lib/esm/view/taskManager/taskListView/taskListSelector.js +1 -3
  36. package/lib/esm/view/userListView/fetchUserListByTypeEpic.js +0 -11
  37. package/lib/esm/zeniAPI.js +2 -0
  38. package/lib/index.d.ts +4 -8
  39. package/lib/index.js +32 -82
  40. package/lib/reducer.d.ts +0 -6
  41. package/lib/reducer.js +0 -6
  42. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +3 -8
  43. package/lib/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +5 -7
  44. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  45. package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.d.ts +0 -118
  46. package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +0 -201
  47. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +3 -76
  48. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -434
  49. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +3 -11
  50. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +2 -24
  51. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +1 -69
  52. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +0 -1
  53. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.d.ts +1 -1
  54. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +0 -243
  55. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +1 -2
  56. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +0 -142
  57. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +1 -54
  58. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +1 -2
  59. package/lib/view/expenseAutomationView/types/transactionsViewState.js +1 -2
  60. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +1 -1
  61. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +0 -1
  62. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +0 -1
  63. package/lib/view/taskManager/taskListView/taskListSelector.d.ts +0 -2
  64. package/lib/view/taskManager/taskListView/taskListSelector.js +1 -3
  65. package/lib/view/userListView/fetchUserListByTypeEpic.d.ts +1 -3
  66. package/lib/view/userListView/fetchUserListByTypeEpic.js +0 -11
  67. package/lib/view/userListView/userListViewPayload.d.ts +0 -2
  68. package/lib/zeniAPI.js +2 -0
  69. package/package.json +2 -2
  70. package/lib/entity/userGroups/userGroupsPayload.d.ts +0 -7
  71. package/lib/entity/userGroups/userGroupsPayload.js +0 -10
  72. package/lib/entity/userGroups/userGroupsReducer.d.ts +0 -8
  73. package/lib/entity/userGroups/userGroupsReducer.js +0 -29
  74. package/lib/entity/userGroups/userGroupsSelector.d.ts +0 -4
  75. package/lib/entity/userGroups/userGroupsSelector.js +0 -12
  76. package/lib/entity/userGroups/userGroupsState.d.ts +0 -9
  77. package/lib/entity/userGroups/userGroupsState.js +0 -2
  78. package/lib/esm/entity/userGroups/userGroupsPayload.js +0 -7
  79. package/lib/esm/entity/userGroups/userGroupsReducer.js +0 -25
  80. package/lib/esm/entity/userGroups/userGroupsSelector.js +0 -8
  81. package/lib/esm/entity/userGroups/userGroupsState.js +0 -1
  82. package/lib/esm/view/expenseAutomationView/bulkUploadTiming.js +0 -10
  83. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +0 -29
  84. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +0 -49
  85. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +0 -40
  86. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +0 -47
  87. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +0 -61
  88. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +0 -33
  89. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +0 -56
  90. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +0 -77
  91. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +0 -79
  92. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +0 -24
  93. package/lib/esm/view/userGroupListView/userGroupListViewReducer.js +0 -65
  94. package/lib/esm/view/userGroupListView/userGroupListViewSelector.js +0 -16
  95. package/lib/esm/view/userGroupListView/userGroupListViewState.js +0 -1
  96. package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
  97. package/lib/view/expenseAutomationView/bulkUploadTiming.d.ts +0 -10
  98. package/lib/view/expenseAutomationView/bulkUploadTiming.js +0 -13
  99. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.d.ts +0 -18
  100. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +0 -33
  101. package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.d.ts +0 -7
  102. package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +0 -53
  103. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.d.ts +0 -8
  104. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +0 -44
  105. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.d.ts +0 -7
  106. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +0 -51
  107. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.d.ts +0 -8
  108. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +0 -65
  109. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.d.ts +0 -8
  110. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +0 -37
  111. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.d.ts +0 -9
  112. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +0 -61
  113. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.d.ts +0 -14
  114. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +0 -81
  115. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +0 -25
  116. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +0 -85
  117. package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.d.ts +0 -7
  118. package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +0 -28
  119. package/lib/view/userGroupListView/userGroupListViewReducer.d.ts +0 -23
  120. package/lib/view/userGroupListView/userGroupListViewReducer.js +0 -69
  121. package/lib/view/userGroupListView/userGroupListViewSelector.d.ts +0 -7
  122. package/lib/view/userGroupListView/userGroupListViewSelector.js +0 -20
  123. package/lib/view/userGroupListView/userGroupListViewState.d.ts +0 -8
  124. package/lib/view/userGroupListView/userGroupListViewState.js +0 -2
@@ -1,79 +0,0 @@
1
- import { EMPTY, from, merge, of, timer } from 'rxjs';
2
- import { catchError, debounceTime, filter, mergeMap, switchMap, takeUntil, } from 'rxjs/operators';
3
- import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
- import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
5
- import { isSuccessResponse } from '../../../../responsePayload';
6
- import { BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS } from '../../bulkUploadTiming';
7
- import { extractTransactionPayloadsFromBatchFiles, isBatchDetailsApiStatusCompleted, toBatchDetails, } from '../../payload/missingReceiptsPayload';
8
- import { bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation, } from '../../reducers/missingReceiptsViewReducer';
9
- /** First poll after upload; then interval while batch not resolved via Pusher or API. */
10
- const FALLBACK_FIRST_DELAY_MS = 30000;
11
- const FALLBACK_POLL_INTERVAL_MS = 10000;
12
- /**
13
- * On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs),
14
- * and request switching to the Unmatched tab. Debounced to reduce duplicate refreshes.
15
- */
16
- export const pusherBatchStatusCompletionEpic = (actions$) => actions$.pipe(filter(pusherBatchStatusUpdate.match), filter((action) => action.payload.status === 'completed'), debounceTime(300), mergeMap(() => from([
17
- fetchBulkUploadBatches({
18
- cacheOverride: true,
19
- invalidateBatchDetailsCache: true,
20
- }),
21
- requestMissingReceiptsTabNavigation({ tab: 'unmatched' }),
22
- ])));
23
- /**
24
- * If Pusher and batch-details are delayed beyond {@link BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS},
25
- * force `phase` to `completed` (dismiss automatching banner) and refresh the batch list.
26
- * Cancels when the batch completes normally, bulk state is cleared, or another upload supersedes.
27
- */
28
- export const bulkUploadAutomatchingTimeoutEpic = (actions$, state$) => actions$.pipe(filter(bulkUploadReceiptsSuccess.match), mergeMap((action) => {
29
- const { batchId } = action.payload;
30
- return timer(BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS).pipe(mergeMap(() => {
31
- const bulk = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
32
- if (bulk.phase !== 'matching' || bulk.currentBatchId !== batchId) {
33
- return EMPTY;
34
- }
35
- return from([
36
- bulkUploadAutomatchingTimedOut(batchId),
37
- fetchBulkUploadBatches({ cacheOverride: true }),
38
- ]);
39
- }), takeUntil(merge(actions$.pipe(filter(clearBulkUpload.match)), actions$.pipe(filter(pusherBatchStatusUpdate.match), filter((a) => a.payload.batchId === batchId &&
40
- a.payload.status === 'completed')), actions$.pipe(filter(fetchBulkUploadBatchDetailsSuccess.match), filter((a) => a.payload.batchId === batchId)))));
41
- }));
42
- /**
43
- * Fallback polling when Pusher is slow or unavailable. Network errors on a poll tick show one
44
- * error snackbar per upload session (first failure only) so the user is not spammed every
45
- * interval; Pusher or a later successful poll still completes the flow.
46
- */
47
- export const pollBulkUploadBatchStatusEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(bulkUploadReceiptsSuccess.match), mergeMap((action) => {
48
- const { batchId } = action.payload;
49
- let pollErrorNotified = false;
50
- return timer(FALLBACK_FIRST_DELAY_MS, FALLBACK_POLL_INTERVAL_MS).pipe(takeUntil(merge(actions$.pipe(filter(clearBulkUpload.match)), actions$.pipe(filter(pusherBatchStatusUpdate.match), filter((action) => action.payload.batchId === batchId)), actions$.pipe(filter(fetchBulkUploadBatchDetailsSuccess.match), filter((action) => action.payload.batchId === batchId)), actions$.pipe(filter(bulkUploadAutomatchingTimedOut.match), filter((action) => action.payload.batchId === batchId)))), switchMap(() => zeniAPI
51
- .getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches/${batchId}`)
52
- .pipe(mergeMap((response) => {
53
- /** Same batch-details URL; polls until `status` is completed (Pusher may win first). */
54
- if (isSuccessResponse(response) && response.data != null) {
55
- if (isBatchDetailsApiStatusCompleted(response.data.status)) {
56
- const actions = [];
57
- const transactionPayloads = extractTransactionPayloadsFromBatchFiles(response.data.files);
58
- if (transactionPayloads.length > 0) {
59
- actions.push(updateTransactions(transactionPayloads, (value) => value.transaction_id));
60
- }
61
- actions.push(fetchBulkUploadBatchDetailsSuccess(toBatchDetails(response.data, zeniAPI.apiEndPoints.fileMicroServiceBaseUrl)));
62
- actions.push(fetchBulkUploadBatches({ cacheOverride: true }));
63
- actions.push(requestMissingReceiptsTabNavigation({ tab: 'unmatched' }));
64
- return from(actions);
65
- }
66
- }
67
- return EMPTY;
68
- }), catchError(() => {
69
- if (!pollErrorNotified) {
70
- pollErrorNotified = true;
71
- return of(openSnackbar({
72
- messageSection: 'receipts_upload',
73
- messageText: 'failed',
74
- type: 'error',
75
- }));
76
- }
77
- return EMPTY;
78
- }))));
79
- }));
@@ -1,24 +0,0 @@
1
- import { from } from 'rxjs';
2
- import { filter, mergeMap } from 'rxjs/operators';
3
- import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
4
- import { updateTransaction } from '../../../../entity/transaction/transactionReducer';
5
- import { fetchMonthEndCloseChecks } from '../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer';
6
- import { uploadTransactionCategorizationReceiptSuccess } from '../../reducers/transactionsViewReducer';
7
- export const uploadTransactionReceiptSuccessEpic = (actions$, state$) => actions$.pipe(filter(uploadTransactionCategorizationReceiptSuccess.match), mergeMap((action) => {
8
- const { transactionPayload, updateType } = action.payload;
9
- const updateActions = [];
10
- const currentTenant = getCurrentTenant(state$.value);
11
- const selectedPeriodByTenantId = state$.value.expenseAutomationViewState.selectedPeriodByTenantId;
12
- updateActions.push(updateTransaction(transactionPayload.transaction_id, transactionPayload, updateType));
13
- if (currentTenant != null) {
14
- const monthEndChecksPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
15
- if (monthEndChecksPeriod != null) {
16
- updateActions.push(fetchMonthEndCloseChecks({
17
- tenantId: currentTenant.tenantId,
18
- period: monthEndChecksPeriod,
19
- refreshViewInBackground: true,
20
- }));
21
- }
22
- }
23
- return from(updateActions);
24
- }));
@@ -1,65 +0,0 @@
1
- import { createSlice } from '@reduxjs/toolkit';
2
- const initialUserGroupList = {
3
- ids: [],
4
- fetchState: 'Not-Started',
5
- error: undefined,
6
- hasValidState() {
7
- return this.fetchState == 'Completed';
8
- },
9
- };
10
- export const initialState = {
11
- userGroupListByType: {
12
- taskManagerCandidate: initialUserGroupList,
13
- },
14
- };
15
- const userGroupListView = createSlice({
16
- name: 'userGroupListView',
17
- initialState,
18
- reducers: {
19
- fetchUserGroupListByType: {
20
- reducer(draft, action) {
21
- const { userGroupType } = action.payload;
22
- draft.userGroupListByType[userGroupType].fetchState = 'In-Progress';
23
- draft.userGroupListByType[userGroupType].error = undefined;
24
- },
25
- prepare(userGroupType, cacheOverride = false) {
26
- return {
27
- payload: {
28
- userGroupType,
29
- cacheOverride,
30
- },
31
- };
32
- },
33
- },
34
- updateUserGroupIds(draft, action) {
35
- const { userGroupType, userGroupsPayload } = action.payload;
36
- draft.userGroupListByType[userGroupType].fetchState = 'Completed';
37
- draft.userGroupListByType[userGroupType].error = undefined;
38
- draft.userGroupListByType[userGroupType].ids = userGroupsPayload.map((userGroup) => userGroup.id);
39
- },
40
- addUserGroupId(draft, action) {
41
- const { userGroupType, id } = action.payload;
42
- const index = draft.userGroupListByType[userGroupType].ids.indexOf(id);
43
- if (index < 0) {
44
- draft.userGroupListByType[userGroupType].ids.push(id);
45
- }
46
- },
47
- removeUserGroupId(draft, action) {
48
- const { userGroupType, id } = action.payload;
49
- const index = draft.userGroupListByType[userGroupType].ids.indexOf(id);
50
- if (index > -1) {
51
- draft.userGroupListByType[userGroupType].ids.splice(index, 1);
52
- }
53
- },
54
- updateUserGroupListFetchFailure(draft, action) {
55
- const { userGroupType, status } = action.payload;
56
- draft.userGroupListByType[userGroupType].fetchState = 'Error';
57
- draft.userGroupListByType[userGroupType].error = status;
58
- },
59
- clearUserGroupListView(draft) {
60
- Object.assign(draft, initialState);
61
- },
62
- },
63
- });
64
- export const { fetchUserGroupListByType, updateUserGroupIds, addUserGroupId, removeUserGroupId, updateUserGroupListFetchFailure, clearUserGroupListView, } = userGroupListView.actions;
65
- export default userGroupListView.reducer;
@@ -1,16 +0,0 @@
1
- import { getUserGroupByUserGroupId } from '../../entity/userGroups/userGroupsSelector';
2
- export const getUserGroupList = (userGroupsState, userGroupListViewState, userGroupType) => {
3
- const listState = userGroupListViewState.userGroupListByType[userGroupType];
4
- return {
5
- userGroups: getUserGroupListByIds(userGroupsState, userGroupListViewState, userGroupType),
6
- fetchState: listState?.fetchState,
7
- error: listState?.error,
8
- version: 0,
9
- };
10
- };
11
- function getUserGroupListByIds(userGroupsState, userGroupListViewState, type) {
12
- const userGroupIds = userGroupListViewState.userGroupListByType[type].ids;
13
- return userGroupIds
14
- .map((id) => getUserGroupByUserGroupId(userGroupsState, id))
15
- .filter((value) => value != null);
16
- }