@zeniai/client-epic-state 4.19.93 → 4.19.95-betaJK1
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.
Potentially problematic release.
This version of @zeniai/client-epic-state might be problematic. Click here for more details.
- package/lib/entity/account/accountPayload.d.ts +2 -0
- package/lib/entity/account/accountPayload.js +2 -0
- package/lib/entity/account/accountState.d.ts +2 -0
- package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
- package/lib/entity/depositAccount/depositAccount.d.ts +1 -1
- package/lib/entity/depositAccount/depositAccount.js +8 -1
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +1 -1
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +10 -5
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -2
- package/lib/entity/jeSchedules/jeSchedulesReducer.js +2 -2
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +1 -2
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +7 -3
- package/lib/entity/jeSchedules/jeSchedulesTypes.js +3 -1
- package/lib/entity/reimbursement/reimbursementPayload.d.ts +2 -0
- package/lib/entity/reimbursement/reimbursementPayload.js +7 -0
- package/lib/entity/reimbursement/reimbursementState.d.ts +2 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/entity/task/taskPayload.d.ts +1 -0
- package/lib/entity/task/taskPayload.js +1 -0
- package/lib/entity/task/taskState.d.ts +1 -0
- package/lib/entity/transaction/transactionReducer.js +3 -2
- package/lib/entity/transaction/transactionSelector.d.ts +2 -2
- package/lib/entity/transaction/transactionState.d.ts +3 -2
- package/lib/entity/userGroups/userGroupsPayload.d.ts +7 -0
- package/lib/entity/userGroups/userGroupsPayload.js +10 -0
- package/lib/entity/userGroups/userGroupsReducer.d.ts +8 -0
- package/lib/entity/userGroups/userGroupsReducer.js +29 -0
- package/lib/entity/userGroups/userGroupsSelector.d.ts +4 -0
- package/lib/entity/userGroups/userGroupsSelector.js +12 -0
- package/lib/entity/userGroups/userGroupsState.d.ts +9 -0
- package/lib/entity/userGroups/userGroupsState.js +2 -0
- package/lib/epic.d.ts +12 -1
- package/lib/epic.js +12 -1
- package/lib/esm/entity/account/accountPayload.js +2 -0
- package/lib/esm/entity/depositAccount/depositAccount.js +8 -1
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +10 -5
- package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +3 -3
- package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +1 -0
- package/lib/esm/entity/reimbursement/reimbursementPayload.js +7 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/esm/entity/task/taskPayload.js +1 -0
- package/lib/esm/entity/transaction/transactionReducer.js +3 -2
- package/lib/esm/entity/userGroups/userGroupsPayload.js +7 -0
- package/lib/esm/entity/userGroups/userGroupsReducer.js +25 -0
- package/lib/esm/entity/userGroups/userGroupsSelector.js +8 -0
- package/lib/esm/entity/userGroups/userGroupsState.js +1 -0
- package/lib/esm/epic.js +12 -1
- package/lib/esm/index.js +11 -5
- package/lib/esm/reducer.js +6 -0
- package/lib/esm/view/expenseAutomationView/bulkUploadTiming.js +10 -0
- package/lib/esm/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +8 -3
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +29 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +49 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +40 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +47 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +61 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +33 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +56 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +77 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +7 -5
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +79 -0
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +24 -0
- package/lib/esm/view/expenseAutomationView/payload/missingReceiptsPayload.js +189 -1
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +4 -12
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +433 -2
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +23 -1
- package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +244 -1
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
- package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +44 -0
- package/lib/esm/view/expenseAutomationView/types/transactionsViewState.js +2 -1
- package/lib/esm/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsEpic.js +2 -7
- package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +2 -7
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +1 -1
- package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +1 -0
- package/lib/esm/view/taskManager/taskListView/taskListSelector.js +3 -1
- package/lib/esm/view/userGroupListView/userGroupListViewReducer.js +65 -0
- package/lib/esm/view/userGroupListView/userGroupListViewSelector.js +16 -0
- package/lib/esm/view/userGroupListView/userGroupListViewState.js +1 -0
- package/lib/esm/view/userListView/fetchUserListByTypeEpic.js +11 -0
- package/lib/esm/zeniAPI.js +0 -2
- package/lib/index.d.ts +10 -6
- package/lib/index.js +83 -32
- package/lib/reducer.d.ts +6 -0
- package/lib/reducer.js +6 -0
- package/lib/view/expenseAutomationView/bulkUploadTiming.d.ts +10 -0
- package/lib/view/expenseAutomationView/bulkUploadTiming.js +13 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +8 -3
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.d.ts +18 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +33 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.d.ts +7 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +53 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +44 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.d.ts +7 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +51 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +65 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +37 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +61 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.d.ts +14 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +81 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +7 -5
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +25 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +85 -0
- package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.d.ts +7 -0
- package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +28 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.d.ts +118 -0
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +201 -0
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +11 -11
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +3 -11
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +76 -3
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +434 -2
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +11 -3
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +24 -2
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +69 -1
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +1 -0
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.d.ts +1 -1
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +243 -0
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +142 -0
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +54 -1
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -1
- package/lib/view/expenseAutomationView/types/transactionsViewState.js +2 -1
- package/lib/view/scheduleView/scheduleDetailView/epics/fetchScheduleDetailsEpic.js +2 -7
- package/lib/view/scheduleView/scheduleDetailView/scheduleDetailReducer.d.ts +4 -4
- package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +1 -6
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +1 -1
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +1 -0
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +1 -0
- package/lib/view/taskManager/taskListView/taskListSelector.d.ts +2 -0
- package/lib/view/taskManager/taskListView/taskListSelector.js +3 -1
- package/lib/view/userGroupListView/userGroupListViewReducer.d.ts +23 -0
- package/lib/view/userGroupListView/userGroupListViewReducer.js +69 -0
- package/lib/view/userGroupListView/userGroupListViewSelector.d.ts +7 -0
- package/lib/view/userGroupListView/userGroupListViewSelector.js +20 -0
- package/lib/view/userGroupListView/userGroupListViewState.d.ts +8 -0
- package/lib/view/userGroupListView/userGroupListViewState.js +2 -0
- package/lib/view/userListView/fetchUserListByTypeEpic.d.ts +3 -1
- package/lib/view/userListView/fetchUserListByTypeEpic.js +11 -0
- package/lib/view/userListView/userListViewPayload.d.ts +2 -0
- package/lib/zeniAPI.js +0 -2
- package/package.json +2 -2
- package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
|
@@ -1,8 +1,11 @@
|
|
|
1
1
|
import orderBy from 'lodash/orderBy';
|
|
2
2
|
import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
3
3
|
import { getCurrentTenant } from '../../../entity/tenant/tenantSelector';
|
|
4
|
-
import { getSupportedTransactionsByIds } from '../../../entity/transaction/transactionSelector';
|
|
4
|
+
import { getSupportedTransactionById, getSupportedTransactionsByIds, } from '../../../entity/transaction/transactionSelector';
|
|
5
|
+
import { isBatchListStatusCompleted } from '../payload/missingReceiptsPayload';
|
|
6
|
+
import { getCompletedTransactionsCacheKey } from '../reducers/missingReceiptsViewReducer';
|
|
5
7
|
import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes';
|
|
8
|
+
import { isUnmatchedTabFileStatus, } from '../types/missingReceiptsViewState';
|
|
6
9
|
export function getExpenseAutomationMissingReceiptsView(state) {
|
|
7
10
|
const { expenseAutomationMissingReceiptsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, } = state;
|
|
8
11
|
const currentTenant = getCurrentTenant(state);
|
|
@@ -47,6 +50,131 @@ export function getExpenseAutomationMissingReceiptsView(state) {
|
|
|
47
50
|
const completionStatus = missingReceiptsCompletionStatus != null
|
|
48
51
|
? missingReceiptsCompletionStatus
|
|
49
52
|
: 'incomplete';
|
|
53
|
+
const { bulkUpload, pendingMissingReceiptsTabNavigation } = expenseAutomationMissingReceiptsViewState;
|
|
54
|
+
const currentBatchStatus = bulkUpload.currentBatchId != null
|
|
55
|
+
? bulkUpload.batchStatusById[bulkUpload.currentBatchId]
|
|
56
|
+
: undefined;
|
|
57
|
+
const batchList = monthYearPeriodId != null
|
|
58
|
+
? (bulkUpload.batchListByPeriod[monthYearPeriodId] ?? [])
|
|
59
|
+
: [];
|
|
60
|
+
/**
|
|
61
|
+
* Primary "Unmatched" batch = first completed batch in platform list order, preferring the
|
|
62
|
+
* first batch that still has possible_matches/no_match work when any completed batch has such work.
|
|
63
|
+
* Batches without details yet: wait if the list row still reports unmatched work; otherwise skip
|
|
64
|
+
* so we do not block the whole tab while other rows are not fetched yet.
|
|
65
|
+
*/
|
|
66
|
+
const primaryBatchIdFromDetailsOrder = getPrimaryBatchIdFromBatchListOrder(batchList, bulkUpload.batchDetailsById, bulkUpload.failedBatchDetailIds);
|
|
67
|
+
/**
|
|
68
|
+
* During upload/matching, prefer `currentBatchId` only when its batch details are loaded,
|
|
69
|
+
* completed, and still have unmatched-tab work. Otherwise keep `primaryBatchIdFromDetailsOrder`.
|
|
70
|
+
*
|
|
71
|
+
* If we pinned to `currentBatchId` as soon as it was absent from the batch list (in-flight
|
|
72
|
+
* upload), details are often not loaded yet — `unmatchedFiles` would empty while older batches
|
|
73
|
+
* moved to "past", so the primary "Unmatched Receipts" section vanished during auto-matching.
|
|
74
|
+
*/
|
|
75
|
+
const unmatchedSectionBatchId = (() => {
|
|
76
|
+
const phase = bulkUpload.phase;
|
|
77
|
+
if (phase !== 'matching' && phase !== 'uploading') {
|
|
78
|
+
return primaryBatchIdFromDetailsOrder;
|
|
79
|
+
}
|
|
80
|
+
const currentId = bulkUpload.currentBatchId;
|
|
81
|
+
if (currentId == null) {
|
|
82
|
+
return primaryBatchIdFromDetailsOrder;
|
|
83
|
+
}
|
|
84
|
+
const currentDetails = bulkUpload.batchDetailsById[currentId];
|
|
85
|
+
if (currentDetails != null &&
|
|
86
|
+
currentDetails.status === 'completed' &&
|
|
87
|
+
batchDetailsHasUnmatchedWork(currentDetails)) {
|
|
88
|
+
return currentId;
|
|
89
|
+
}
|
|
90
|
+
return primaryBatchIdFromDetailsOrder;
|
|
91
|
+
})();
|
|
92
|
+
const completedBatchesInApiOrder = batchList.filter((batchListItem) => isBatchListStatusCompleted(batchListItem.status));
|
|
93
|
+
const currentBatchDetails = unmatchedSectionBatchId != null
|
|
94
|
+
? bulkUpload.batchDetailsById[unmatchedSectionBatchId]
|
|
95
|
+
: undefined;
|
|
96
|
+
const resolvedFiles = currentBatchDetails?.files.map((file) => resolveBatchFile(file, currentBatchDetails.batchId, transactionState));
|
|
97
|
+
const failedIds = new Set(bulkUpload.failedBatchDetailIds);
|
|
98
|
+
const hasMoreBatchDetails = completedBatchesInApiOrder.some((batchListItem) => bulkUpload.batchDetailsById[batchListItem.batchId] == null &&
|
|
99
|
+
!failedIds.has(batchListItem.batchId));
|
|
100
|
+
const getSortValue = (file) => {
|
|
101
|
+
const matchedTransaction = file.matchedTransaction;
|
|
102
|
+
if (matchedTransaction == null) {
|
|
103
|
+
return null;
|
|
104
|
+
}
|
|
105
|
+
switch (bulkUpload.sortKey) {
|
|
106
|
+
case 'vendor':
|
|
107
|
+
return ((matchedTransaction.vendorName ?? matchedTransaction.description)?.toLowerCase() ?? null);
|
|
108
|
+
case 'category': {
|
|
109
|
+
const line = matchedTransaction.lines?.[0];
|
|
110
|
+
return line?.account?.accountName?.toLowerCase() ?? null;
|
|
111
|
+
}
|
|
112
|
+
case 'class': {
|
|
113
|
+
const line = matchedTransaction.lines?.[0];
|
|
114
|
+
return line?.class?.className?.toLowerCase() ?? null;
|
|
115
|
+
}
|
|
116
|
+
case 'date':
|
|
117
|
+
return matchedTransaction.date.valueOf();
|
|
118
|
+
case 'amount':
|
|
119
|
+
return matchedTransaction.amount.amount;
|
|
120
|
+
default:
|
|
121
|
+
return null;
|
|
122
|
+
}
|
|
123
|
+
};
|
|
124
|
+
const bulkUploadSortDirection = bulkUpload.sortOrder === 'ascending' ? 'asc' : 'desc';
|
|
125
|
+
const matchedFiles = orderBy(resolvedFiles?.filter((resolvedFile) => resolvedFile.status === 'exact_match') ?? [], getSortValue, bulkUploadSortDirection);
|
|
126
|
+
const unmatchedFiles = orderBy(resolvedFiles?.filter((resolvedFile) => isUnmatchedTabFileStatus(resolvedFile.status)) ?? [], getSortValue, bulkUploadSortDirection);
|
|
127
|
+
const progress = currentBatchStatus != null
|
|
128
|
+
? {
|
|
129
|
+
...currentBatchStatus.progress,
|
|
130
|
+
percentage: currentBatchStatus.progress.total > 0
|
|
131
|
+
? Math.round((currentBatchStatus.progress.processed /
|
|
132
|
+
currentBatchStatus.progress.total) *
|
|
133
|
+
100)
|
|
134
|
+
: 0,
|
|
135
|
+
}
|
|
136
|
+
: { total: 0, processed: 0, percentage: 0 };
|
|
137
|
+
const batchListFetchState = bulkUpload.batchListFetchState;
|
|
138
|
+
/**
|
|
139
|
+
* When primary batch is not resolved yet, still aggregate unmatched files from every batch
|
|
140
|
+
* that has details loaded (otherwise past is empty and receipts vanish from the UI).
|
|
141
|
+
*/
|
|
142
|
+
const pastBatches = unmatchedSectionBatchId != null
|
|
143
|
+
? batchList.filter((batchListItem) => batchListItem.batchId !== unmatchedSectionBatchId)
|
|
144
|
+
: batchList;
|
|
145
|
+
const pastUnmatchedFiles = pastBatches.flatMap((pastBatch) => {
|
|
146
|
+
const details = bulkUpload.batchDetailsById[pastBatch.batchId];
|
|
147
|
+
if (details == null) {
|
|
148
|
+
return [];
|
|
149
|
+
}
|
|
150
|
+
return details.files
|
|
151
|
+
.filter((batchFile) => isUnmatchedTabFileStatus(batchFile.status))
|
|
152
|
+
.map((batchFile) => resolveBatchFile(batchFile, pastBatch.batchId, transactionState));
|
|
153
|
+
});
|
|
154
|
+
const completedTransactionsCacheKey = monthYearPeriodId != null
|
|
155
|
+
? getCompletedTransactionsCacheKey(monthYearPeriodId, bulkUpload.sortKey, bulkUpload.sortOrder, bulkUpload.completedSubTab)
|
|
156
|
+
: undefined;
|
|
157
|
+
const completedTransactionsForPeriod = completedTransactionsCacheKey != null
|
|
158
|
+
? bulkUpload.completedTransactionsByPeriod[completedTransactionsCacheKey]
|
|
159
|
+
: undefined;
|
|
160
|
+
const completedTransactionIds = completedTransactionsForPeriod?.transactionIds ?? [];
|
|
161
|
+
const resolvedCompletedTransactions = getSupportedTransactionsByIds(transactionState, completedTransactionIds);
|
|
162
|
+
const resolvedBatchDetails = currentBatchDetails != null && resolvedFiles != null
|
|
163
|
+
? {
|
|
164
|
+
batchId: currentBatchDetails.batchId,
|
|
165
|
+
createdAt: currentBatchDetails.createdAt,
|
|
166
|
+
files: resolvedFiles,
|
|
167
|
+
status: currentBatchDetails.status,
|
|
168
|
+
summary: currentBatchDetails.summary,
|
|
169
|
+
}
|
|
170
|
+
: undefined;
|
|
171
|
+
const manualSearchResults = bulkUpload.manualSearch.results.map((result) => {
|
|
172
|
+
const transaction = getSupportedTransactionById(transactionState, result.transactionId);
|
|
173
|
+
return {
|
|
174
|
+
...result,
|
|
175
|
+
vendorLogo: result.vendorLogo ?? transaction?.logo?.href,
|
|
176
|
+
};
|
|
177
|
+
});
|
|
50
178
|
return {
|
|
51
179
|
fetchState,
|
|
52
180
|
error,
|
|
@@ -55,5 +183,120 @@ export function getExpenseAutomationMissingReceiptsView(state) {
|
|
|
55
183
|
refreshStatus,
|
|
56
184
|
transactions: sortedTransactions,
|
|
57
185
|
completionStatus,
|
|
186
|
+
pendingMissingReceiptsTabNavigation: pendingMissingReceiptsTabNavigation ?? null,
|
|
187
|
+
bulkUpload: {
|
|
188
|
+
phase: bulkUpload.phase,
|
|
189
|
+
uploadStatus: bulkUpload.uploadStatus,
|
|
190
|
+
batchStatus: currentBatchStatus,
|
|
191
|
+
batchDetails: resolvedBatchDetails,
|
|
192
|
+
completedSubTab: bulkUpload.completedSubTab,
|
|
193
|
+
completedTransactions: {
|
|
194
|
+
fetchState: completedTransactionsForPeriod?.fetchState ?? {
|
|
195
|
+
fetchState: 'Not-Started',
|
|
196
|
+
error: undefined,
|
|
197
|
+
},
|
|
198
|
+
nextPageToken: completedTransactionsForPeriod?.nextPageToken ?? null,
|
|
199
|
+
totalCount: completedTransactionsForPeriod?.totalCount ?? 0,
|
|
200
|
+
transactions: resolvedCompletedTransactions,
|
|
201
|
+
},
|
|
202
|
+
matchedFiles,
|
|
203
|
+
unmatchedFiles,
|
|
204
|
+
progress,
|
|
205
|
+
currentResultsTab: bulkUpload.currentResultsTab,
|
|
206
|
+
sortKey: bulkUpload.sortKey,
|
|
207
|
+
sortOrder: bulkUpload.sortOrder,
|
|
208
|
+
batchList,
|
|
209
|
+
batchListFetchState,
|
|
210
|
+
pastBatches,
|
|
211
|
+
pastUnmatchedFiles,
|
|
212
|
+
confirmMatchStatus: bulkUpload.confirmMatchStatus,
|
|
213
|
+
manualSearchUiResetKey: bulkUpload.manualSearchUiResetKey,
|
|
214
|
+
hasMoreBatchDetails,
|
|
215
|
+
batchDetailsPaginationState: bulkUpload.batchDetailsPaginationState,
|
|
216
|
+
manualSearch: {
|
|
217
|
+
...bulkUpload.manualSearch,
|
|
218
|
+
results: manualSearchResults,
|
|
219
|
+
},
|
|
220
|
+
uploadProgress: bulkUpload.uploadProgress,
|
|
221
|
+
},
|
|
222
|
+
};
|
|
223
|
+
}
|
|
224
|
+
function batchDetailsHasUnmatchedWork(details) {
|
|
225
|
+
return details.files.some((file) => isUnmatchedTabFileStatus(file.status));
|
|
226
|
+
}
|
|
227
|
+
/** List row summary before batch details load — aligns with unmatched / possible-match work. */
|
|
228
|
+
function batchListItemHasUnmatchedWork(batch) {
|
|
229
|
+
return batch.noMatchCount > 0 || batch.possibleMatchesCount > 0;
|
|
230
|
+
}
|
|
231
|
+
/**
|
|
232
|
+
* `batchList` must match platform order (same sequence as the bulk-upload batches API). Picks the
|
|
233
|
+
* primary batch for the top "Unmatched" section. Skips failed detail fetches.
|
|
234
|
+
*
|
|
235
|
+
* If details are not loaded for an earlier list row but that row reports no unmatched work, we
|
|
236
|
+
* skip it so later rows with loaded details can be primary (avoids an empty tab when the first
|
|
237
|
+
* fetch page only loaded later batches). If the list reports unmatched work but details are still
|
|
238
|
+
* loading, we wait (undefined) so primary order stays correct once details arrive.
|
|
239
|
+
*/
|
|
240
|
+
function getPrimaryBatchIdFromBatchListOrder(batchListInPlatformOrder, batchDetailsById, failedBatchDetailIds) {
|
|
241
|
+
const failedIds = new Set(failedBatchDetailIds);
|
|
242
|
+
const anyCompletedBatchHasUnmatchedWork = batchListInPlatformOrder.some((batch) => {
|
|
243
|
+
if (failedIds.has(batch.batchId)) {
|
|
244
|
+
return false;
|
|
245
|
+
}
|
|
246
|
+
const details = batchDetailsById[batch.batchId];
|
|
247
|
+
if (details != null &&
|
|
248
|
+
details.status === 'completed' &&
|
|
249
|
+
batchDetailsHasUnmatchedWork(details)) {
|
|
250
|
+
return true;
|
|
251
|
+
}
|
|
252
|
+
return details == null && batchListItemHasUnmatchedWork(batch);
|
|
253
|
+
});
|
|
254
|
+
for (const batch of batchListInPlatformOrder) {
|
|
255
|
+
if (failedIds.has(batch.batchId)) {
|
|
256
|
+
continue;
|
|
257
|
+
}
|
|
258
|
+
const details = batchDetailsById[batch.batchId];
|
|
259
|
+
if (details == null) {
|
|
260
|
+
if (batchListItemHasUnmatchedWork(batch)) {
|
|
261
|
+
return undefined;
|
|
262
|
+
}
|
|
263
|
+
continue;
|
|
264
|
+
}
|
|
265
|
+
if (details.status !== 'completed') {
|
|
266
|
+
continue;
|
|
267
|
+
}
|
|
268
|
+
if (anyCompletedBatchHasUnmatchedWork) {
|
|
269
|
+
if (batchDetailsHasUnmatchedWork(details)) {
|
|
270
|
+
return batch.batchId;
|
|
271
|
+
}
|
|
272
|
+
continue;
|
|
273
|
+
}
|
|
274
|
+
return batch.batchId;
|
|
275
|
+
}
|
|
276
|
+
return undefined;
|
|
277
|
+
}
|
|
278
|
+
function resolveBatchFile(file, batchId, transactionState) {
|
|
279
|
+
const matchedTransaction = file.matchedTransactionId != null
|
|
280
|
+
? getSupportedTransactionById(transactionState, file.matchedTransactionId)
|
|
281
|
+
: undefined;
|
|
282
|
+
const candidates = file.candidates
|
|
283
|
+
?.map((ref) => {
|
|
284
|
+
const transaction = getSupportedTransactionById(transactionState, ref.transactionId);
|
|
285
|
+
return transaction != null
|
|
286
|
+
? { transaction, matchScore: ref.matchScore }
|
|
287
|
+
: undefined;
|
|
288
|
+
})
|
|
289
|
+
.filter((candidate) => candidate != null);
|
|
290
|
+
return {
|
|
291
|
+
attachmentId: file.attachmentId,
|
|
292
|
+
batchId,
|
|
293
|
+
fileDownloadUrl: file.fileDownloadUrl,
|
|
294
|
+
fileId: file.fileId,
|
|
295
|
+
filename: file.filename,
|
|
296
|
+
filePreviewUrl: file.filePreviewUrl,
|
|
297
|
+
status: file.status,
|
|
298
|
+
matchedTransaction,
|
|
299
|
+
candidates: candidates != null && candidates.length > 0 ? candidates : undefined,
|
|
300
|
+
matchSource: file.matchSource,
|
|
58
301
|
};
|
|
59
302
|
}
|
|
@@ -10,7 +10,7 @@ import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes
|
|
|
10
10
|
export function getExpenseAutomationTransactionView(state) {
|
|
11
11
|
const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, } = state;
|
|
12
12
|
const { selectedTransactionCategorizationTab } = expenseAutomationTransactionsViewState;
|
|
13
|
-
const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
|
|
13
|
+
const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
|
|
14
14
|
const uncategorizedIncomeExpense = getUncategorizedAccounts(accountState, accountListState, 'accountList');
|
|
15
15
|
const accountList = getAccountList(accountState, accountListState, 'accountList');
|
|
16
16
|
const classList = getClassList(classState, classListState);
|
|
@@ -94,6 +94,7 @@ export function getExpenseAutomationTransactionView(state) {
|
|
|
94
94
|
completionStatus,
|
|
95
95
|
totalCountByTab,
|
|
96
96
|
fetchStateByTransactionTabs: fetchStateByTab,
|
|
97
|
+
uploadReceiptStatusById,
|
|
97
98
|
selectedTransactionId,
|
|
98
99
|
selectedTransactionLineId,
|
|
99
100
|
};
|
|
@@ -7,3 +7,47 @@ const MISSING_RECEIPTS_SORT_KEYS = [
|
|
|
7
7
|
'amount',
|
|
8
8
|
];
|
|
9
9
|
export const toMissingReceiptsSortKey = (v) => stringToUnion(v, MISSING_RECEIPTS_SORT_KEYS);
|
|
10
|
+
// -- Bulk Receipt Upload Types --
|
|
11
|
+
/**
|
|
12
|
+
* Minimum trimmed query length before manual-match search calls the expense-automation API.
|
|
13
|
+
* Kept in sync with `ManualSearchInput` in web-components (fires search only when length ≥ this).
|
|
14
|
+
*/
|
|
15
|
+
export const MIN_MANUAL_TRANSACTION_SEARCH_LENGTH = 2;
|
|
16
|
+
const BATCH_STATUS_VALUES = ['pending', 'processing', 'completed'];
|
|
17
|
+
export const toBatchStatusValue = (v) => stringToUnion(v.trim().toLowerCase(), BATCH_STATUS_VALUES);
|
|
18
|
+
/** Canonical batch file statuses (API ingress may use aliases; see `parseBatchFileStatus`). */
|
|
19
|
+
export const BATCH_FILE_STATUSES = [
|
|
20
|
+
'exact_match',
|
|
21
|
+
'possible_matches',
|
|
22
|
+
'no_match',
|
|
23
|
+
'failed',
|
|
24
|
+
];
|
|
25
|
+
export const toBatchFileStatus = (v) => stringToUnion(v.trim().toLowerCase().replace(/-/g, '_'), BATCH_FILE_STATUSES);
|
|
26
|
+
const UNMATCHED_TAB_FILE_STATUSES = ['possible_matches', 'no_match'];
|
|
27
|
+
/** True for files that belong in the Unmatched tab (possible matches or no match). */
|
|
28
|
+
export function isUnmatchedTabFileStatus(status) {
|
|
29
|
+
return UNMATCHED_TAB_FILE_STATUSES.includes(status);
|
|
30
|
+
}
|
|
31
|
+
const BULK_UPLOAD_PHASES = [
|
|
32
|
+
'idle',
|
|
33
|
+
'uploading',
|
|
34
|
+
'matching',
|
|
35
|
+
'completed',
|
|
36
|
+
];
|
|
37
|
+
export const toBulkUploadPhase = (v) => stringToUnion(v.trim().toLowerCase(), BULK_UPLOAD_PHASES);
|
|
38
|
+
const BULK_UPLOAD_RESULTS_TABS = ['completed', 'unmatched'];
|
|
39
|
+
export const toBulkUploadResultsTab = (v) => stringToUnion(v.trim().toLowerCase(), BULK_UPLOAD_RESULTS_TABS);
|
|
40
|
+
const MISSING_RECEIPTS_TABS = ['missing', 'completed', 'unmatched'];
|
|
41
|
+
export const toMissingReceiptsTab = (v) => stringToUnion(v.trim().toLowerCase(), MISSING_RECEIPTS_TABS);
|
|
42
|
+
const COMPLETED_SUB_TABS = ['all', 'ai_accountant', 'manual'];
|
|
43
|
+
export const toCompletedSubTab = (v) => stringToUnion(v.trim().toLowerCase(), COMPLETED_SUB_TABS);
|
|
44
|
+
const MATCH_SOURCES = ['ai', 'manual'];
|
|
45
|
+
export const toMatchSource = (v) => stringToUnion(v.trim().toLowerCase(), MATCH_SOURCES);
|
|
46
|
+
const BULK_UPLOAD_SORT_KEYS = [
|
|
47
|
+
'amount',
|
|
48
|
+
'category',
|
|
49
|
+
'class',
|
|
50
|
+
'date',
|
|
51
|
+
'vendor',
|
|
52
|
+
];
|
|
53
|
+
export const toBulkUploadSortKey = (v) => stringToUnion(v.trim().toLowerCase(), BULK_UPLOAD_SORT_KEYS);
|
|
@@ -4,10 +4,11 @@ const TRANSACTIONS_SORT_KEYS = [
|
|
|
4
4
|
'vendor',
|
|
5
5
|
'amount',
|
|
6
6
|
'transaction_type',
|
|
7
|
+
'payment_account',
|
|
7
8
|
'date',
|
|
8
9
|
'category',
|
|
9
10
|
'class',
|
|
10
|
-
'
|
|
11
|
+
'memo_and_receipt',
|
|
11
12
|
];
|
|
12
13
|
export const toTransactionsSortKey = (v) => stringToUnion(v, TRANSACTIONS_SORT_KEYS);
|
|
13
14
|
export const TRANSACTIONS_TABS = ['review', 'autoCategorized'];
|
|
@@ -1,9 +1,8 @@
|
|
|
1
1
|
import { from, of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
+
import { getJEScheduleTransactionDetailKeyPayload, } from '../../../../entity/jeSchedules/jeSchedulesPayload';
|
|
3
4
|
import { updateJESchedules, updateJESchedulesDetails, } from '../../../../entity/jeSchedules/jeSchedulesReducer';
|
|
4
|
-
import { toTransactionType } from '../../../../entity/transaction/stateTypes/transactionType';
|
|
5
5
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
6
|
-
import { getZeniTransactionDetailKey } from '../../../transactionDetail/transactionDetailState';
|
|
7
6
|
import { createNewSchedules, fetchScheduleDetails, initializeScheduleDetailLocalData, saveScheduleDetailsSuccessOrFailure, updateScheduleDetailsFailure, updateScheduleDetailsSuccess, updateSelectedJEScheduleKey, } from '../scheduleDetailReducer';
|
|
8
7
|
export const fetchScheduleDetailsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchScheduleDetails.match), mergeMap((action) => {
|
|
9
8
|
const updateActions = [];
|
|
@@ -24,11 +23,7 @@ export const fetchScheduleDetailsEpic = (actions$, state$, zeniAPI) => actions$.
|
|
|
24
23
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules/${selectedJeScheduleDetailId}?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
25
24
|
.pipe(mergeMap((response) => {
|
|
26
25
|
if (isSuccessResponse(response) && response.data != null) {
|
|
27
|
-
const
|
|
28
|
-
const selectedJEScheduleKey = getZeniTransactionDetailKey({
|
|
29
|
-
id: transactionData.transaction_id,
|
|
30
|
-
type: toTransactionType(transactionData.transaction_type),
|
|
31
|
-
});
|
|
26
|
+
const selectedJEScheduleKey = getJEScheduleTransactionDetailKeyPayload(response.data.je_schedules[0].base_transaction);
|
|
32
27
|
updateActions.push(updateJESchedules(response.data.je_schedules), updateSelectedJEScheduleKey({ selectedJEScheduleKey }), updateJESchedulesDetails(response.data.je_schedules, response.data.scheduled_journal_entries), saveScheduleDetailsSuccessOrFailure('Not-Started'), initializeScheduleDetailLocalData(scheduleType, selectedJEScheduleKey, selectedJeScheduleDetailId), updateScheduleDetailsSuccess());
|
|
33
28
|
if (response.data.je_schedules[0].status.code === 'draft' &&
|
|
34
29
|
isCompleteJEScheduleFormDataPresent(response.data.je_schedules[0])) {
|
|
@@ -1,7 +1,5 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import { getJEScheduleKey, } from '../../../entity/jeSchedules/jeSchedulesPayload';
|
|
3
|
-
import { toTransactionID } from '../../../entity/transaction/payloadTypes/transactionIDPayload';
|
|
4
|
-
import { getZeniTransactionDetailKey } from '../../transactionDetail/transactionDetailState';
|
|
2
|
+
import { getJEScheduleKey, getJEScheduleTransactionDetailKeyPayload, } from '../../../entity/jeSchedules/jeSchedulesPayload';
|
|
5
3
|
import { getDefaultSelectedTimeframeForScheduleType } from './scheduleListHelper';
|
|
6
4
|
import { getScheduleListKey, } from './scheduleListTypes';
|
|
7
5
|
export const initialUIState = {
|
|
@@ -379,10 +377,7 @@ export default scheduleListView.reducer;
|
|
|
379
377
|
function doUpdateScheduleList(draft, payload, scheduleType, selectedTimeframe, selectedCategoryId) {
|
|
380
378
|
if (scheduleType !== 'accrued_expenses') {
|
|
381
379
|
const state = getState(draft, scheduleType);
|
|
382
|
-
const jeScheduleTransactionKeys = payload.map((schedules) =>
|
|
383
|
-
const transactionID = toTransactionID(schedules.base_transaction);
|
|
384
|
-
return getZeniTransactionDetailKey(transactionID);
|
|
385
|
-
});
|
|
380
|
+
const jeScheduleTransactionKeys = payload.map((schedules) => getJEScheduleTransactionDetailKeyPayload(schedules.base_transaction));
|
|
386
381
|
state.selectedCategoryId = selectedCategoryId;
|
|
387
382
|
state.selectedTimeframe = selectedTimeframe;
|
|
388
383
|
const key = getScheduleListKey(selectedCategoryId, selectedTimeframe);
|
|
@@ -70,6 +70,7 @@ const toTaskPayload = (state, task) => {
|
|
|
70
70
|
name: task.name,
|
|
71
71
|
assignees: task.assignees,
|
|
72
72
|
description: task.description,
|
|
73
|
+
group_assignees: task.groupAssignees,
|
|
73
74
|
due_date: task.dueDate != null ? task.dueDate.format(DEFAULT_DATE_FORMAT) : null,
|
|
74
75
|
priority: task.priority.code,
|
|
75
76
|
status: task.status.code,
|
|
@@ -11,6 +11,7 @@ import { getTaskGroupTemplateByIds } from '../../../entity/taskGroupTemplate/tas
|
|
|
11
11
|
import { getUserName, getUsersByUserIds, } from '../../../entity/user/userSelector';
|
|
12
12
|
import { getUserAndUserRole, } from '../../companyView/types/userAndRole';
|
|
13
13
|
import { applyAdvancedFiltersOnList } from '../../spendManagement/spendManagementFilterHelpers';
|
|
14
|
+
import { getUserGroupList } from '../../userGroupListView/userGroupListViewSelector';
|
|
14
15
|
import { getUserList, } from '../../userListView/userListViewSelector';
|
|
15
16
|
import { allTaskPriority, allTaskStatus, } from '../taskDetailView/taskDetailSelector';
|
|
16
17
|
import { DUE_DATE_GROUP_KEYS, } from './taskList';
|
|
@@ -308,7 +309,7 @@ const getTaskGroupsWithTaskList = ({ taskListState, taskState, userState, userRo
|
|
|
308
309
|
tagState,
|
|
309
310
|
});
|
|
310
311
|
};
|
|
311
|
-
export const getAllTasks = createSelector((state) => state.taskListState, (state) => state.taskState, (state) => state.userState, (state) => state.userRoleState, (state) => state.userListViewState, (state) => state.addressState, (state) => state.taskGroupState, (state) => state.taskGroupViewState, (state) => state.tagViewState, (state) => state.tagState, (state) => state.taskGroupTemplateState, (state) => state.taskGroupTemplateViewState, (_state, isTaskTemplatesEnabled) => isTaskTemplatesEnabled, (taskListState, taskState, userState, userRoleState, userListViewState, addressState, taskGroupState, taskGroupViewState, tagViewState, tagState, taskGroupTemplateState, taskGroupTemplateViewState, isTaskTemplatesEnabled) => {
|
|
312
|
+
export const getAllTasks = createSelector((state) => state.taskListState, (state) => state.taskState, (state) => state.userState, (state) => state.userRoleState, (state) => state.userListViewState, (state) => state.addressState, (state) => state.taskGroupState, (state) => state.taskGroupViewState, (state) => state.tagViewState, (state) => state.tagState, (state) => state.taskGroupTemplateState, (state) => state.taskGroupTemplateViewState, (state) => state.userGroupsState, (state) => state.userGroupListViewState, (_state, isTaskTemplatesEnabled) => isTaskTemplatesEnabled, (taskListState, taskState, userState, userRoleState, userListViewState, addressState, taskGroupState, taskGroupViewState, tagViewState, tagState, taskGroupTemplateState, taskGroupTemplateViewState, userGroupsState, userGroupListViewState, isTaskTemplatesEnabled) => {
|
|
312
313
|
const { localData } = taskListState;
|
|
313
314
|
const taskGroupsWithTasksList = getTaskGroupsWithTaskList({
|
|
314
315
|
taskListState,
|
|
@@ -336,6 +337,7 @@ export const getAllTasks = createSelector((state) => state.taskListState, (state
|
|
|
336
337
|
taskGroupTemplates,
|
|
337
338
|
fetchState: fetchState,
|
|
338
339
|
userList: getUserList(userState, userRoleState, userListViewState, 'taskManagerCandidate'),
|
|
340
|
+
userGroupList: getUserGroupList(userGroupsState, userGroupListViewState, 'taskManagerCandidate'),
|
|
339
341
|
error: error,
|
|
340
342
|
version: 0,
|
|
341
343
|
taskGroupsWithTasksList,
|
|
@@ -0,0 +1,65 @@
|
|
|
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;
|
|
@@ -0,0 +1,16 @@
|
|
|
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
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -3,9 +3,11 @@ import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
|
3
3
|
import { updateAddresses } from '../../entity/address/addressReducer';
|
|
4
4
|
import { getCurrentTenant, isZeniDomainTenant, } from '../../entity/tenant/tenantSelector';
|
|
5
5
|
import { updateAllUsers } from '../../entity/user/userReducer';
|
|
6
|
+
import { updateAllUserGroups } from '../../entity/userGroups/userGroupsReducer';
|
|
6
7
|
import { updateUserRoles } from '../../entity/userRole/userRoleReducer';
|
|
7
8
|
import { createZeniAPIStatus, isSuccessResponse } from '../../responsePayload';
|
|
8
9
|
import { updateChargeCardCount, updateDebitCardCount, } from '../spendManagement/chargeCards/issueChargeCard/issueChargeCardReducer';
|
|
10
|
+
import { updateUserGroupIds } from '../userGroupListView/userGroupListViewReducer';
|
|
9
11
|
import { fetchUserListByType, updateUserIds, updateUserListFetchFailure, } from './userListViewReducer';
|
|
10
12
|
export const fetchUserListByTypeEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchUserListByType.match), mergeMap((action) => {
|
|
11
13
|
const { userType, cacheOverride } = action.payload;
|
|
@@ -29,6 +31,15 @@ export const fetchUserListByTypeEpic = (actions$, state$, zeniAPI) => actions$.p
|
|
|
29
31
|
usersPayload: response.data?.users ?? [],
|
|
30
32
|
}),
|
|
31
33
|
];
|
|
34
|
+
if (response.data?.user_groups != null) {
|
|
35
|
+
userListAction.push(updateAllUserGroups({ userGroups: response.data.user_groups }));
|
|
36
|
+
if (userType === 'taskManagerCandidate') {
|
|
37
|
+
userListAction.push(updateUserGroupIds({
|
|
38
|
+
userGroupType: userType,
|
|
39
|
+
userGroupsPayload: response.data.user_groups,
|
|
40
|
+
}));
|
|
41
|
+
}
|
|
42
|
+
}
|
|
32
43
|
if (userType === 'cardHolderCandidate') {
|
|
33
44
|
userListAction.push(updateChargeCardCount(response.data?.cards_count_by_user_id ?? []));
|
|
34
45
|
userListAction.push(updateDebitCardCount(response.data?.debit_cards_count_by_deposit_account_id ?? {}));
|
package/lib/esm/zeniAPI.js
CHANGED
|
@@ -79,8 +79,6 @@ export class ZeniAPIClient {
|
|
|
79
79
|
return from(promise);
|
|
80
80
|
}
|
|
81
81
|
postFormData(restEndPoint, formData, signal) {
|
|
82
|
-
// Use apiHeaders for auth headers, then remove Content-Type
|
|
83
|
-
// so the browser sets multipart/form-data with the correct boundary
|
|
84
82
|
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
85
83
|
const { 'Content-Type': _contentType, ...headers } = this.apiHeaders();
|
|
86
84
|
const promise = fetch(restEndPoint, {
|