@zeniai/client-epic-state 5.0.71 → 5.0.72
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.
- package/lib/coreEpics.js +1 -1
- package/lib/entity/account/accountSelector.d.ts +1 -1
- package/lib/entity/account/accountState.d.ts +1 -1
- package/lib/entity/account/subAccountSelector.d.ts +1 -1
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +3 -1
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +2 -1
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +1 -1
- package/lib/entity/chargeCard/chargeCardReducer.d.ts +2 -19
- package/lib/entity/chargeCard/chargeCardReducer.js +2 -35
- package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.d.ts +1 -14
- package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.js +2 -36
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +1 -1
- package/lib/entity/sectionProjectView/sectionProjectViewSelector.js +1 -1
- package/lib/entity/tenant/SessionManager.js +3 -6
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -2
- package/lib/entity/tenant/clearAllEpic.js +2 -2
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.js +2 -6
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.js +2 -6
- package/lib/entity/tenant/tenantReducer.js +1 -6
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +1 -3
- package/lib/epic.d.ts +9 -9
- package/lib/epic.js +10 -10
- package/lib/esm/coreEpics.js +1 -1
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +3 -1
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +2 -1
- package/lib/esm/entity/chargeCard/chargeCardReducer.js +1 -34
- package/lib/esm/entity/chargeCardTransaction/chargeCardTransactionReducer.js +1 -35
- package/lib/esm/entity/sectionProjectView/sectionProjectViewSelector.js +1 -1
- package/lib/esm/entity/tenant/SessionManager.js +1 -4
- package/lib/esm/entity/tenant/clearAllEpic.js +2 -2
- package/lib/esm/entity/tenant/epic/saveAPIKeyConnectionEpic.js +2 -6
- package/lib/esm/entity/tenant/epic/saveOAuthConnectionEpic.js +2 -6
- package/lib/esm/entity/tenant/tenantReducer.js +1 -6
- package/lib/esm/entity/transaction/payloadTypes/transactionLinePayload.js +1 -3
- package/lib/esm/epic.js +10 -10
- package/lib/esm/index.js +13 -17
- package/lib/esm/reducer.js +2 -2
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +5 -2
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +5 -2
- package/lib/esm/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +1 -4
- package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
- package/lib/esm/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +1 -1
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +2 -2
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +1 -2
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +6 -8
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +1 -7
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +1 -11
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +1 -2
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +1 -127
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +1 -20
- package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +2 -0
- package/lib/esm/view/financeStatement/financeStatementSelector.js +1 -1
- package/lib/esm/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +2 -3
- package/lib/esm/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +2 -3
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +18 -55
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +2 -16
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +4 -5
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +9 -26
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +6 -9
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +2 -3
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
- package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +3 -7
- package/lib/esm/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.js +1 -1
- package/lib/esm/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.js +1 -1
- package/lib/esm/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +1 -1
- package/lib/esm/view/transactionDetail/transactionDetailSelector.js +1 -7
- package/lib/index.d.ts +15 -19
- package/lib/index.js +58 -72
- package/lib/reducer.d.ts +2 -2
- package/lib/reducer.js +2 -2
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
- package/lib/view/aiAccountantView/aiAccountantViewPayload.d.ts +2 -2
- package/lib/view/aiAccountantView/aiAccountantViewReducer.d.ts +1 -1
- package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +5 -2
- package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +5 -2
- package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +1 -4
- package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.d.ts +1 -1
- package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +2 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +1 -2
- package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +6 -8
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +1 -7
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +0 -10
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +0 -21
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -2
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +1 -2
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +3 -9
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +2 -128
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +1 -2
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +0 -14
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +1 -20
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +2 -1
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +4 -1
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -41
- package/lib/view/financeStatement/financeStatementSelector.js +1 -1
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.d.ts +1 -3
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +2 -3
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.d.ts +1 -3
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +2 -3
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +18 -55
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +2 -16
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +4 -5
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +3 -18
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +10 -27
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +6 -9
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.d.ts +1 -3
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +2 -3
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.d.ts +1 -3
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +3 -7
- package/lib/view/transactionDetail/transactionDetailSelector.js +1 -7
- package/lib/view/zeniOAuthView/zeniOAuthSelector.d.ts +1 -1
- package/package.json +4 -9
- package/lib/commonStateTypes/cacheOverrideFetchReducer.d.ts +0 -17
- package/lib/commonStateTypes/cacheOverrideFetchReducer.js +0 -20
- package/lib/commonStateTypes/pusherActions.d.ts +0 -11
- package/lib/commonStateTypes/pusherActions.js +0 -6
- package/lib/esm/commonStateTypes/cacheOverrideFetchReducer.js +0 -16
- package/lib/esm/commonStateTypes/pusherActions.js +0 -3
- package/lib/esm/view/expenseAutomationView/types/completedSubTab.js +0 -17
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +0 -10
- package/lib/view/expenseAutomationView/types/completedSubTab.js +0 -21
|
@@ -1,7 +1,7 @@
|
|
|
1
|
-
import type { AiAccountantCustomerPayload, AiAccountantJobPayload } from '../../entity/aiAccountantCustomer/aiAccountantCustomerPayload';
|
|
2
|
-
import { UserPayload } from '../../entity/user/userPayload';
|
|
3
1
|
import { ZeniAPIResponse } from '../../responsePayload';
|
|
4
2
|
export { AiAccountantCustomerPayload, AiAccountantEnrollmentPayload, AiAccountantJobPayload, toAiAccountantCustomer, toAiAccountantEnrollment, toAiAccountantJob, } from '../../entity/aiAccountantCustomer/aiAccountantCustomerPayload';
|
|
3
|
+
import type { AiAccountantCustomerPayload, AiAccountantJobPayload } from '../../entity/aiAccountantCustomer/aiAccountantCustomerPayload';
|
|
4
|
+
import { UserPayload } from '../../entity/user/userPayload';
|
|
5
5
|
export interface AiAccountantCustomersResponseData {
|
|
6
6
|
customers: AiAccountantCustomerPayload[];
|
|
7
7
|
users: UserPayload[];
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ID } from '../../commonStateTypes/common';
|
|
2
1
|
import { AiAccountantCustomerPayload } from '../../entity/aiAccountantCustomer/aiAccountantCustomerPayload';
|
|
2
|
+
import { ID } from '../../commonStateTypes/common';
|
|
3
3
|
import { ZeniAPIStatus } from '../../responsePayload';
|
|
4
4
|
import { AiAccountantUIState, AiAccountantViewState } from './aiAccountantViewState';
|
|
5
5
|
export declare const initialAiAccountantViewState: AiAccountantViewState;
|
|
@@ -10,7 +10,9 @@ const aiAccountantViewReducer_1 = require("../aiAccountantViewReducer");
|
|
|
10
10
|
const fetchAiAccountantCustomersEpic = (actions$, _, zeniAPI) => actions$.pipe((0, operators_1.filter)(aiAccountantViewReducer_1.fetchAiAccountantCustomers.match), (0, operators_1.switchMap)(() => {
|
|
11
11
|
const base = `${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/cockpit-panels`;
|
|
12
12
|
const url = `${base}/ai-accountant/customers`;
|
|
13
|
-
return zeniAPI
|
|
13
|
+
return zeniAPI
|
|
14
|
+
.getJSON(url)
|
|
15
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
14
16
|
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
15
17
|
const customers = response.data?.customers ?? [];
|
|
16
18
|
const users = response.data?.users ?? [];
|
|
@@ -23,6 +25,7 @@ const fetchAiAccountantCustomersEpic = (actions$, _, zeniAPI) => actions$.pipe((
|
|
|
23
25
|
else {
|
|
24
26
|
return (0, rxjs_1.of)((0, aiAccountantViewReducer_1.updateAiAccountantCustomersFailure)(response.status));
|
|
25
27
|
}
|
|
26
|
-
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiAccountantViewReducer_1.updateAiAccountantCustomersFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'AI Accountant customers fetch failed: ' +
|
|
28
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiAccountantViewReducer_1.updateAiAccountantCustomersFailure)((0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'AI Accountant customers fetch failed: ' +
|
|
29
|
+
JSON.stringify(error))))));
|
|
27
30
|
}));
|
|
28
31
|
exports.fetchAiAccountantCustomersEpic = fetchAiAccountantCustomersEpic;
|
|
@@ -23,7 +23,9 @@ const fetchAiAccountantJobsEpic = (actions$, state$, zeniAPI) => actions$.pipe((
|
|
|
23
23
|
}
|
|
24
24
|
const base = `${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/cockpit-panels`;
|
|
25
25
|
const url = `${base}/ai-accountant/jobs?${params.toString()}`;
|
|
26
|
-
return zeniAPI
|
|
26
|
+
return zeniAPI
|
|
27
|
+
.getJSON(url)
|
|
28
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
27
29
|
if ((0, responsePayload_1.isSuccessResponse)(response)) {
|
|
28
30
|
const jobs = response.data?.jobs ?? [];
|
|
29
31
|
const users = response.data?.users ?? [];
|
|
@@ -42,7 +44,8 @@ const fetchAiAccountantJobsEpic = (actions$, state$, zeniAPI) => actions$.pipe((
|
|
|
42
44
|
}
|
|
43
45
|
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, aiAccountantViewReducer_1.updateAiAccountantJobsFailure)({
|
|
44
46
|
tenantId,
|
|
45
|
-
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'AI Accountant jobs fetch failed: ' +
|
|
47
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'AI Accountant jobs fetch failed: ' +
|
|
48
|
+
JSON.stringify(error)),
|
|
46
49
|
}))));
|
|
47
50
|
}));
|
|
48
51
|
exports.fetchAiAccountantJobsEpic = fetchAiAccountantJobsEpic;
|
|
@@ -54,10 +54,7 @@ const triggerAiAccountantJobEpic = (actions$, state$, zeniAPI) => actions$.pipe(
|
|
|
54
54
|
messageText: 'failed',
|
|
55
55
|
type: 'error',
|
|
56
56
|
variables: [
|
|
57
|
-
{
|
|
58
|
-
variableName: '__reason__',
|
|
59
|
-
variableValue: 'Unexpected error',
|
|
60
|
-
},
|
|
57
|
+
{ variableName: '__reason__', variableValue: 'Unexpected error' },
|
|
61
58
|
],
|
|
62
59
|
}),
|
|
63
60
|
])));
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { FetchState } from '../../commonStateTypes/common';
|
|
2
1
|
import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
3
2
|
import { Company } from '../../entity/company/companyStateTypes';
|
|
4
3
|
import { Tag } from '../../entity/tag/tagState';
|
|
@@ -6,6 +5,7 @@ import { Task } from '../../entity/task/taskState';
|
|
|
6
5
|
import { User } from '../../entity/user/userState';
|
|
7
6
|
import { RootState } from '../../reducer';
|
|
8
7
|
import { CompanyTaskManagerViewUIState, TaskManagerMetrics } from './companyTaskManagerViewState';
|
|
8
|
+
import { FetchState } from '../../commonStateTypes/common';
|
|
9
9
|
export interface TaskWithCompanyDetail {
|
|
10
10
|
assignees: User[];
|
|
11
11
|
company: Company;
|
|
@@ -7,7 +7,7 @@ const tagSelector_1 = require("../../entity/tag/tagSelector");
|
|
|
7
7
|
const taskSelector_1 = require("../../entity/task/taskSelector");
|
|
8
8
|
const userSelector_1 = require("../../entity/user/userSelector");
|
|
9
9
|
exports.getCompanyTaskManagerView = (0, toolkit_1.createSelector)((state) => state.companyTaskManagerViewState, (state) => state.companyState, (state) => state.userState, (state) => state.taskState, (state) => state.tagState, (companyTaskManagerViewState, companyState, userState, taskState, tagState) => {
|
|
10
|
-
const { taskIds, uiState, fetchState, error, totalTaskCount, metrics, metricsFetchState
|
|
10
|
+
const { taskIds, uiState, fetchState, error, totalTaskCount, metrics, metricsFetchState } = companyTaskManagerViewState;
|
|
11
11
|
const tasksList = [];
|
|
12
12
|
taskIds.forEach((taskId) => {
|
|
13
13
|
const task = (0, taskSelector_1.getTaskById)(taskState, taskId);
|
|
@@ -6,10 +6,10 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
7
|
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
8
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
9
|
-
const bulkUploadTiming_1 = require("../../helpers/bulkUploadTiming");
|
|
10
|
-
const rollingCalendarDateRangeInclusive_1 = require("../../helpers/rollingCalendarDateRangeInclusive");
|
|
11
9
|
const missingReceiptsPayload_1 = require("../../payload/missingReceiptsPayload");
|
|
12
10
|
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
11
|
+
const bulkUploadTiming_1 = require("../../helpers/bulkUploadTiming");
|
|
12
|
+
const rollingCalendarDateRangeInclusive_1 = require("../../helpers/rollingCalendarDateRangeInclusive");
|
|
13
13
|
const fetchBulkUploadBatchesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchBulkUploadBatches.match), (0, operators_1.switchMap)((action) => {
|
|
14
14
|
const { cacheOverride } = action.payload;
|
|
15
15
|
const state = state$.value;
|
package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js
CHANGED
|
@@ -8,7 +8,6 @@ const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
|
8
8
|
const transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
|
|
9
9
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
10
10
|
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
11
|
-
const completedSubTab_1 = require("../../types/completedSubTab");
|
|
12
11
|
const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(missingReceiptsViewReducer_1.fetchCompletedTransactions.match), (0, operators_1.switchMap)((action) => {
|
|
13
12
|
const state = state$.value;
|
|
14
13
|
const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload }, } = state;
|
|
@@ -43,7 +42,7 @@ const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => actions$.p
|
|
|
43
42
|
if (sortOrder != null) {
|
|
44
43
|
queryPayload.sort_order = sortOrder === 'ascending' ? 'asc' : 'desc';
|
|
45
44
|
}
|
|
46
|
-
if (completedSubTab !==
|
|
45
|
+
if (completedSubTab !== 'all') {
|
|
47
46
|
queryPayload.match_type = completedSubTab;
|
|
48
47
|
}
|
|
49
48
|
const encodedQuery = encodeURIComponent(JSON.stringify(queryPayload));
|
|
@@ -3,13 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.restoreBulkUploadAutomatchingOnMountEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
|
-
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
6
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
9
|
-
const bulkUploadTiming_1 = require("../../helpers/bulkUploadTiming");
|
|
10
|
-
const rollingCalendarDateRangeInclusive_1 = require("../../helpers/rollingCalendarDateRangeInclusive");
|
|
11
7
|
const missingReceiptsPayload_1 = require("../../payload/missingReceiptsPayload");
|
|
12
8
|
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
9
|
+
const bulkUploadTiming_1 = require("../../helpers/bulkUploadTiming");
|
|
10
|
+
const rollingCalendarDateRangeInclusive_1 = require("../../helpers/rollingCalendarDateRangeInclusive");
|
|
11
|
+
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
12
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
13
13
|
/**
|
|
14
14
|
* On missing-receipts entry / period switch, hydrate the automatching banner for the logged-in
|
|
15
15
|
* user without relying on UI-driven list fetches (the Missing tab does not fetch the batch list
|
|
@@ -52,12 +52,10 @@ const restoreBulkUploadAutomatchingOnMountEpic = (actions$, state$, zeniAPI) =>
|
|
|
52
52
|
bulkUpload.batchListFetchState.fetchState === 'Completed';
|
|
53
53
|
const listSource = alreadyCached
|
|
54
54
|
? (0, rxjs_1.of)(null)
|
|
55
|
-
: zeniAPI
|
|
56
|
-
.getJSON(listUrl)
|
|
57
|
-
.pipe((0, operators_1.catchError)(() => (0, rxjs_1.of)(null)));
|
|
55
|
+
: zeniAPI.getJSON(listUrl).pipe((0, operators_1.catchError)(() => (0, rxjs_1.of)(null)));
|
|
58
56
|
return listSource.pipe((0, operators_1.mergeMap)((listResponse) => {
|
|
59
57
|
const batchList = alreadyCached
|
|
60
|
-
?
|
|
58
|
+
? bulkUpload.batchListByPeriod[periodId] ?? []
|
|
61
59
|
: listResponse != null &&
|
|
62
60
|
(0, responsePayload_1.isSuccessResponse)(listResponse) &&
|
|
63
61
|
listResponse.data != null
|
package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js
CHANGED
|
@@ -5,11 +5,10 @@ const rxjs_1 = require("rxjs");
|
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
|
|
7
7
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
8
|
-
const rollingCalendarDateRangeInclusive_1 = require("../../helpers/rollingCalendarDateRangeInclusive");
|
|
9
8
|
const missingReceiptsPayload_1 = require("../../payload/missingReceiptsPayload");
|
|
10
9
|
const missingReceiptsViewReducer_1 = require("../../reducers/missingReceiptsViewReducer");
|
|
11
|
-
const completedSubTab_1 = require("../../types/completedSubTab");
|
|
12
10
|
const transactionsViewState_1 = require("../../types/transactionsViewState");
|
|
11
|
+
const rollingCalendarDateRangeInclusive_1 = require("../../helpers/rollingCalendarDateRangeInclusive");
|
|
13
12
|
/**
|
|
14
13
|
* `auto_categorized` for manual transaction search (Unmatched).
|
|
15
14
|
* Backend contract TBD — align with `fetchTransactionCategorizationEpic` (`selectedTab === 'autoCategorized'`)
|
|
@@ -50,11 +49,6 @@ const searchTransactionsForManualMatchEpic = (actions$, state$, zeniAPI) => {
|
|
|
50
49
|
page_token: pageToken ?? null,
|
|
51
50
|
page_size: manualSearch.pageSize,
|
|
52
51
|
search_text: query,
|
|
53
|
-
// Manual search ignores the Completed sub-tab axis — always span the
|
|
54
|
-
// default sentinel so the receipt-matching UX returns results
|
|
55
|
-
// regardless of where the transaction would otherwise be bucketed on
|
|
56
|
-
// the Completed tab.
|
|
57
|
-
sub_tab: completedSubTab_1.DEFAULT_COMPLETED_SUB_TAB,
|
|
58
52
|
};
|
|
59
53
|
return zeniAPI
|
|
60
54
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expense-automation/transactions?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
@@ -3,6 +3,6 @@ import { Observable } from 'rxjs';
|
|
|
3
3
|
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
4
4
|
import { RootState } from '../../../../reducer';
|
|
5
5
|
import { ZeniAPI } from '../../../../zeniAPI';
|
|
6
|
-
import { fetchTransactionCategorization, fetchTransactionCategorizationFailure, fetchTransactionCategorizationSuccess, initializeTransactionCategorizationViewLocalData, resetOtherTabsFetchState,
|
|
7
|
-
export type ActionType = ReturnType<typeof fetchTransactionCategorization> | ReturnType<typeof updateTransactions> | ReturnType<typeof initializeTransactionCategorizationViewLocalData> | ReturnType<typeof fetchTransactionCategorizationFailure> | ReturnType<typeof updateTransactionCategorizationUIState> | ReturnType<typeof updateTotalCountForTransactionCategorization> | ReturnType<typeof
|
|
6
|
+
import { fetchTransactionCategorization, fetchTransactionCategorizationFailure, fetchTransactionCategorizationSuccess, initializeTransactionCategorizationViewLocalData, resetOtherTabsFetchState, updateTotalCountForTransactionCategorization, updateTransactionCategorizationUIState } from '../../reducers/transactionsViewReducer';
|
|
7
|
+
export type ActionType = ReturnType<typeof fetchTransactionCategorization> | ReturnType<typeof updateTransactions> | ReturnType<typeof initializeTransactionCategorizationViewLocalData> | ReturnType<typeof fetchTransactionCategorizationFailure> | ReturnType<typeof updateTransactionCategorizationUIState> | ReturnType<typeof updateTotalCountForTransactionCategorization> | ReturnType<typeof fetchTransactionCategorizationSuccess> | ReturnType<typeof resetOtherTabsFetchState>;
|
|
8
8
|
export declare const fetchTransactionCategorizationEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
@@ -9,7 +9,6 @@ const transactionReducer_1 = require("../../../../entity/transaction/transaction
|
|
|
9
9
|
const responsePayload_1 = require("../../../../responsePayload");
|
|
10
10
|
const transactionCategorizationLocalDataHelper_1 = require("../../helpers/transactionCategorizationLocalDataHelper");
|
|
11
11
|
const transactionsViewReducer_1 = require("../../reducers/transactionsViewReducer");
|
|
12
|
-
const completedSubTab_1 = require("../../types/completedSubTab");
|
|
13
12
|
const transactionsViewState_1 = require("../../types/transactionsViewState");
|
|
14
13
|
const fetchTransactionCategorizationEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(transactionsViewReducer_1.fetchTransactionCategorization.match), (0, operators_1.switchMap)((action) => {
|
|
15
14
|
const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationTransactionsViewState, } = state$.value;
|
|
@@ -27,9 +26,6 @@ const fetchTransactionCategorizationEpic = (actions$, state$, zeniAPI) => action
|
|
|
27
26
|
page_token: pageToken,
|
|
28
27
|
page_size: 25,
|
|
29
28
|
search_text: uiState.searchString,
|
|
30
|
-
sub_tab: selectedTab === 'autoCategorized'
|
|
31
|
-
? expenseAutomationTransactionsViewState.selectedTransactionCategorizationCompletedSubTab
|
|
32
|
-
: completedSubTab_1.DEFAULT_COMPLETED_SUB_TAB,
|
|
33
29
|
};
|
|
34
30
|
return zeniAPI
|
|
35
31
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expense-automation/transactions?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
@@ -52,12 +48,6 @@ const fetchTransactionCategorizationEpic = (actions$, state$, zeniAPI) => action
|
|
|
52
48
|
selectedTab,
|
|
53
49
|
totalCount: response.data.total_count,
|
|
54
50
|
}));
|
|
55
|
-
updateActions.push((0, transactionsViewReducer_1.updateParentTotalCountForTab)({
|
|
56
|
-
selectedPeriod,
|
|
57
|
-
selectedTab,
|
|
58
|
-
parentTotalCount: response.data.parent_tab_total_count ??
|
|
59
|
-
response.data.total_count,
|
|
60
|
-
}));
|
|
61
51
|
updateActions.push((0, transactionsViewReducer_1.resetOtherTabsFetchState)({
|
|
62
52
|
refreshViewInBackground,
|
|
63
53
|
tabs: transactionsViewState_1.TRANSACTIONS_TABS.filter((tab) => selectedTab !== tab),
|
package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts
CHANGED
|
@@ -2,8 +2,8 @@ import { ID } from '../../../commonStateTypes/common';
|
|
|
2
2
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
3
3
|
import { UncategorizedAccountTypes } from '../../../entity/account/accountState';
|
|
4
4
|
import { ClassBase } from '../../../entity/class/classState';
|
|
5
|
-
import { Entity } from '../../../entity/genericEntity/entity';
|
|
6
5
|
import { ProjectBase } from '../../../entity/project/projectState';
|
|
6
|
+
import { Entity } from '../../../entity/genericEntity/entity';
|
|
7
7
|
import { RecommendationWithCOTByLineId } from '../../../entity/transaction/stateTypes/transaction';
|
|
8
8
|
import { SupportedTransactionPayload, SupportedTransactionWithCOT } from '../../../entity/transaction/transactionState';
|
|
9
9
|
import { UncategorizedAccounts } from '../../accountList/accountListSelector';
|
|
@@ -2,7 +2,6 @@ import { EntityRecommendationPayload } from '../../../commonPayloadTypes/recomme
|
|
|
2
2
|
import { TransactionPayload } from '../../../entity/transaction/payloadTypes/transactionPayload';
|
|
3
3
|
import { SupportedTransactionPayload } from '../../../entity/transaction/transactionState';
|
|
4
4
|
import { ZeniAPIResponse } from '../../../responsePayload';
|
|
5
|
-
import { CompletedSubTab } from '../types/completedSubTab';
|
|
6
5
|
export interface TransactionCategorizationQueryPayload {
|
|
7
6
|
auto_categorized: boolean;
|
|
8
7
|
end_date: string | null;
|
|
@@ -12,32 +11,12 @@ export interface TransactionCategorizationQueryPayload {
|
|
|
12
11
|
sort_by: string;
|
|
13
12
|
sort_order: string;
|
|
14
13
|
start_date: string | null;
|
|
15
|
-
/**
|
|
16
|
-
* Required. For the Completed (`auto_categorized=true`) listing, scopes the
|
|
17
|
-
* returned page + `total_count` to one of the Completed sub-tabs. For the
|
|
18
|
-
* Review listing it is forced to `'all'` to preserve parent-tab semantics
|
|
19
|
-
* on the backend.
|
|
20
|
-
*/
|
|
21
|
-
sub_tab: CompletedSubTab;
|
|
22
14
|
}
|
|
23
15
|
export interface TransactionCategorizationPayload {
|
|
24
16
|
next_page_token: string | null;
|
|
25
17
|
query: TransactionCategorizationQueryPayload;
|
|
26
18
|
total_count: number;
|
|
27
19
|
transactions: SupportedTransactionPayload[];
|
|
28
|
-
/**
|
|
29
|
-
* Count of transactions for the entire parent tab (Review or Completed),
|
|
30
|
-
* regardless of which sub-tab the listing was scoped to. Used solely to
|
|
31
|
-
* drive the parent tab badge counts on the UI; pagination, list-level
|
|
32
|
-
* counts, and sub-tab chips continue to consume {@link total_count}.
|
|
33
|
-
*
|
|
34
|
-
* Optional at the wire boundary so that any version-skew scenario
|
|
35
|
-
* (delayed BE rollout, cached SW response, hotfix without the BE change)
|
|
36
|
-
* deserializes cleanly. Consumers are expected to fall back to
|
|
37
|
-
* {@link total_count} when this is absent — see
|
|
38
|
-
* `fetchTransactionCategorizationEpic` for the canonical fallback.
|
|
39
|
-
*/
|
|
40
|
-
parent_tab_total_count?: number;
|
|
41
20
|
}
|
|
42
21
|
export type TransactionCategorizationResponse = ZeniAPIResponse<TransactionCategorizationPayload>;
|
|
43
22
|
export interface EntityRelatedUpdatesPayload {
|
|
@@ -6,8 +6,7 @@ import type { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
|
6
6
|
import { TransactionPayload } from '../../../entity/transaction/payloadTypes/transactionPayload';
|
|
7
7
|
import { SupportedTransactionPayload } from '../../../entity/transaction/transactionState';
|
|
8
8
|
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
9
|
-
import { type CompletedSubTab } from '../types/
|
|
10
|
-
import { type BatchDetails, type BatchListItem, type BatchStatus, type BulkUploadResultsTab, type BulkUploadSortKey, type BulkUploadState, type ManualSearchResult, type MissingReceiptsViewState, type MissingReceiptsViewUIState } from '../types/missingReceiptsViewState';
|
|
9
|
+
import { type BatchDetails, type BatchListItem, type BatchStatus, type BulkUploadResultsTab, type BulkUploadSortKey, type BulkUploadState, type CompletedSubTab, type ManualSearchResult, type MissingReceiptsViewState, type MissingReceiptsViewUIState } from '../types/missingReceiptsViewState';
|
|
11
10
|
export declare const getCompletedTransactionsCacheKey: (periodId: MonthYearPeriodId, sortKey: BulkUploadSortKey | undefined, sortOrder: SortOrder | undefined, subTab: CompletedSubTab) => string;
|
|
12
11
|
export declare const initialBulkUploadState: BulkUploadState;
|
|
13
12
|
export declare const initialState: MissingReceiptsViewState;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.fetchCompletedTransactionsFailure = exports.fetchCompletedTransactionsSuccess = exports.fetchCompletedTransactions = exports.acknowledgeBulkUploadConfirmMatchComplete = exports.clearManualSearchResults = exports.searchTransactionsForManualMatchFailure = exports.searchTransactionsForManualMatchSuccess = exports.searchTransactionsForManualMatch = exports.clearBulkUpload = exports.setBulkUploadSortConfig = exports.setBulkUploadCompletedSubTab = exports.setBulkUploadResultsTab = exports.confirmBulkUploadMatchFailure = exports.confirmBulkUploadMatchSuccess = exports.confirmBulkUploadMatch = exports.fetchBulkUploadBatchesFailure = exports.fetchBulkUploadBatchesSuccess = exports.fetchBulkUploadBatches = exports.fetchMoreBatchDetailsFailure = exports.fetchMoreBatchDetailsComplete = exports.fetchMoreBatchDetails = exports.setInitialBatchDetailsLoading = exports.batchDetailFetchFailed = exports.storeBatchDetails = exports.fetchBulkUploadBatchDetailsFailure = exports.fetchBulkUploadBatchDetailsSuccess = exports.clearMissingReceiptsTabNavigation = exports.requestMissingReceiptsTabNavigation = exports.pusherBatchStatusUpdate = exports.bulkUploadAutomatchingTimedOut = exports.restoreBulkUploadMatchingState = exports.bulkUploadReceiptsFailure = exports.bulkUploadReceiptsSuccess = exports.setBulkUploadUploadedFileCount = exports.updateBulkUploadProgress = exports.bulkUploadReceipts = exports.clearExpenseAutomationMissingReceiptsView = exports.markMissingReceiptAsDone = exports.updateMissingReceiptsUIState = exports.updateMissingReceiptUploadState = exports.uploadMissingReceiptSuccess = exports.fetchMissingReceiptsFailure = exports.fetchMissingReceiptsSuccess = exports.fetchMissingReceipts = exports.restoreBulkUploadAutomatchingOnMount = exports.fetchBulkUploadBatchDetails = exports.initialState = exports.initialBulkUploadState = exports.getCompletedTransactionsCacheKey = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
7
|
-
const completedSubTab_1 = require("../types/completedSubTab");
|
|
8
7
|
const missingReceiptsViewState_1 = require("../types/missingReceiptsViewState");
|
|
9
8
|
const getCompletedTransactionsCacheKey = (periodId, sortKey, sortOrder, subTab) => {
|
|
10
9
|
const sortKeyPart = sortKey ?? 'none';
|
|
@@ -18,7 +17,7 @@ exports.initialBulkUploadState = {
|
|
|
18
17
|
batchListByPeriod: {},
|
|
19
18
|
batchListFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
20
19
|
batchStatusById: {},
|
|
21
|
-
completedSubTab:
|
|
20
|
+
completedSubTab: 'all',
|
|
22
21
|
completedTransactionsByPeriod: {},
|
|
23
22
|
confirmMatchStatus: { fetchState: 'Not-Started', error: undefined },
|
|
24
23
|
currentBatchId: undefined,
|
|
@@ -4,9 +4,9 @@ import { MonthYearPeriod, TimePeriod } from '../../../commonStateTypes/timePerio
|
|
|
4
4
|
import { PageToken } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
5
5
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
6
6
|
import { ClassBase } from '../../../entity/class/classState';
|
|
7
|
+
import { ProjectBase } from '../../../entity/project/projectState';
|
|
7
8
|
import { CustomerBase } from '../../../entity/customer/customerState';
|
|
8
9
|
import { Entity } from '../../../entity/genericEntity/entity';
|
|
9
|
-
import { ProjectBase } from '../../../entity/project/projectState';
|
|
10
10
|
import { RecommendationWithCOTByLineId, TransactionID } from '../../../entity/transaction/stateTypes/transaction';
|
|
11
11
|
import { SupportedTransaction, SupportedTransactionPayload, SupportedTransactionWithCOT } from '../../../entity/transaction/transactionState';
|
|
12
12
|
import { VendorBase } from '../../../entity/vendor/vendorState';
|
|
@@ -65,9 +65,7 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
65
65
|
isUncategorizedExpenseCategoryEnabled: boolean | undefined;
|
|
66
66
|
}, "expenseAutomationTransactionsView/updateTransactionCategorization", never, never>, updateCurrentSelectedTransactionCategorizationTab: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[newSelectedTab: "review" | "autoCategorized"], {
|
|
67
67
|
newSelectedTab: "review" | "autoCategorized";
|
|
68
|
-
}, "expenseAutomationTransactionsView/updateCurrentSelectedTransactionCategorizationTab", never, never>,
|
|
69
|
-
newSubTab: "all" | "manual" | "ai_accountant";
|
|
70
|
-
}, "expenseAutomationTransactionsView/updateTransactionCategorizationCompletedSubTab", never, never>, updateTransactionCategorizationSaveStatus: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", fetchState: FetchState, error?: ZeniAPIStatus<Record<string, unknown>> | undefined], {
|
|
68
|
+
}, "expenseAutomationTransactionsView/updateCurrentSelectedTransactionCategorizationTab", never, never>, updateTransactionCategorizationSaveStatus: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", fetchState: FetchState, error?: ZeniAPIStatus<Record<string, unknown>> | undefined], {
|
|
71
69
|
selectedTab: "review" | "autoCategorized";
|
|
72
70
|
fetchState: FetchState;
|
|
73
71
|
error: ZeniAPIStatus<Record<string, unknown>> | undefined;
|
|
@@ -122,11 +120,7 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
122
120
|
selectedPeriod: MonthYearPeriod;
|
|
123
121
|
selectedTab: TransactionsTab;
|
|
124
122
|
totalCount: number;
|
|
125
|
-
}, "expenseAutomationTransactionsView/updateTotalCountForTransactionCategorization">,
|
|
126
|
-
parentTotalCount: number;
|
|
127
|
-
selectedPeriod: MonthYearPeriod;
|
|
128
|
-
selectedTab: TransactionsTab;
|
|
129
|
-
}, "expenseAutomationTransactionsView/updateParentTotalCountForTab">, fetchTransactionCategorizationSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
123
|
+
}, "expenseAutomationTransactionsView/updateTotalCountForTransactionCategorization">, fetchTransactionCategorizationSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
130
124
|
selectedTab: TransactionsTab;
|
|
131
125
|
status: ZeniAPIStatus;
|
|
132
126
|
refreshViewInBackground?: boolean;
|
|
@@ -4,14 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.uploadTransactionCategorizationReceiptSuccess = exports.updateTransactionCategorizationUploadReceiptState = exports.backgroundRefetchReviewTab = exports.syncTransactionCategorizationFromDetailSave = exports.updateSelectedTransactionId = exports.setEntityRecommendationForLineIdsForCategorization = exports.clearExpenseAutomationTransactionsView = exports.clearExpenseAutomationTransactionsViewPerTabView = exports.updateSelectedCheckboxTransactionIds = exports.fetchTransactionCategorizationView = exports.resetOtherTabsFetchState = exports.fetchTransactionCategorizationSuccess = exports.
|
|
7
|
+
exports.uploadTransactionCategorizationReceiptSuccess = exports.updateTransactionCategorizationUploadReceiptState = exports.backgroundRefetchReviewTab = exports.syncTransactionCategorizationFromDetailSave = exports.updateSelectedTransactionId = exports.setEntityRecommendationForLineIdsForCategorization = exports.clearExpenseAutomationTransactionsView = exports.clearExpenseAutomationTransactionsViewPerTabView = exports.updateSelectedCheckboxTransactionIds = exports.fetchTransactionCategorizationView = exports.resetOtherTabsFetchState = exports.fetchTransactionCategorizationSuccess = exports.updateTotalCountForTransactionCategorization = exports.setAllItemsToCategoryClassInLocalDataForCategorization = exports.updateSelectedCustomerForTransaction = exports.updateSelectedVendorForTransaction = exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = exports.markTransactionAsNotMiscategorized = exports.updateTransactionCategorizationSaveStatus = exports.updateCurrentSelectedTransactionCategorizationTab = exports.updateTransactionCategorization = exports.saveTransactionCategorization = exports.fetchTransactionCategorizationFailure = exports.saveTransactionCategorizationLocalData = exports.initializeTransactionCategorizationViewLocalData = exports.updateTransactionCategorizationUIState = exports.fetchTransactionCategorization = exports.initialState = exports.initialTransactionTabViewState = void 0;
|
|
8
8
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
9
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
10
10
|
const uniq_1 = __importDefault(require("lodash/uniq"));
|
|
11
11
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
12
12
|
const vendorTransaction_1 = require("../../../entity/transaction/stateTypes/vendorTransaction");
|
|
13
13
|
const transactionCategorizationLocalDataHelper_1 = require("../helpers/transactionCategorizationLocalDataHelper");
|
|
14
|
-
const completedSubTab_1 = require("../types/completedSubTab");
|
|
15
14
|
exports.initialTransactionTabViewState = {
|
|
16
15
|
saveStatus: {
|
|
17
16
|
fetchState: 'Not-Started',
|
|
@@ -49,74 +48,12 @@ exports.initialTransactionTabViewState = {
|
|
|
49
48
|
selectedTransactionLineId: undefined,
|
|
50
49
|
};
|
|
51
50
|
exports.initialState = {
|
|
52
|
-
autoCategorizedSubTabCache: {},
|
|
53
|
-
parentTotalCountByTab: {
|
|
54
|
-
review: {},
|
|
55
|
-
autoCategorized: {},
|
|
56
|
-
},
|
|
57
51
|
selectedTransactionCategorizationTab: 'review',
|
|
58
|
-
selectedTransactionCategorizationCompletedSubTab: completedSubTab_1.DEFAULT_COMPLETED_SUB_TAB,
|
|
59
52
|
transactionCategorizationView: {
|
|
60
53
|
review: { ...exports.initialTransactionTabViewState },
|
|
61
54
|
autoCategorized: { ...exports.initialTransactionTabViewState },
|
|
62
55
|
},
|
|
63
56
|
};
|
|
64
|
-
/**
|
|
65
|
-
* Capture the autoCategorized tab's current paginated dataset for a sub-tab.
|
|
66
|
-
* The mid-flight `'In-Progress'` state is normalised to `'Completed'` because
|
|
67
|
-
* the in-flight request is cancelled by `switchMap` in the fetch epic when the
|
|
68
|
-
* sub-tab changes — restoring `'In-Progress'` later would leave the UI stuck
|
|
69
|
-
* showing a phantom loading state with no fetch actually running. Length-zero
|
|
70
|
-
* datasets degrade to `'Not-Started'` so the next visit triggers a fresh
|
|
71
|
-
* fetch from page 1 instead of short-circuiting on stale empty caches.
|
|
72
|
-
*
|
|
73
|
-
* Snapshot scope (deliberately narrow):
|
|
74
|
-
* - Captured: `pageToken`, `totalCount`, `transactionIdsBySelectedPeriod`,
|
|
75
|
-
* `fetchState`, `error`, `scrollPosition`. The first five are the keys the
|
|
76
|
-
* fetch epic's cache check reads to decide whether to short-circuit a
|
|
77
|
-
* sub-tab revisit; `scrollPosition` is captured per sub-tab so revisiting
|
|
78
|
-
* restores the user's last offset and switching to a never-visited sub-tab
|
|
79
|
-
* starts at the top instead of inheriting the outgoing sub-tab's offset
|
|
80
|
-
* (which would land the user at a meaningless row index against a
|
|
81
|
-
* completely different list).
|
|
82
|
-
* - Intentionally NOT captured (left in place on `autoCat` and inherited by
|
|
83
|
-
* the incoming sub-tab):
|
|
84
|
-
* - `uiState.searchString`, `uiState.sortKey`, `uiState.sortOrder`,
|
|
85
|
-
* `uiState.nodeCollapseState`, `uiState.limit` — search and sort are
|
|
86
|
-
* user-applied preferences that persist across sub-tabs by design (a
|
|
87
|
-
* search query stays active when the user toggles between Manual / AI
|
|
88
|
-
* Accountant).
|
|
89
|
-
* - `selectedCheckBoxTransactionIds` — selection state is intentionally
|
|
90
|
-
* cleared at the action source (the fetch epic / save flow), not
|
|
91
|
-
* by the snapshot path. Carrying selection across sub-tabs is safe
|
|
92
|
-
* because every sub-tab change goes through a fetch round-trip that
|
|
93
|
-
* reconciles selection against the new row IDs.
|
|
94
|
-
* - `transactionReviewLocalDataById`, `transactionIdsWithUnsavedData`,
|
|
95
|
-
* `uploadReceiptStatusById`, `saveStatus`, `refreshStatus`,
|
|
96
|
-
* `markAsNotMiscategorizedStatus` — these are per-row / per-flight
|
|
97
|
-
* caches that are write-through global state, not sub-tab-scoped.
|
|
98
|
-
*
|
|
99
|
-
* If the contract changes (e.g. selection should reset on every sub-tab
|
|
100
|
-
* switch), update both this comment and the snapshot return shape together.
|
|
101
|
-
*/
|
|
102
|
-
function snapshotAutoCategorizedTab(autoCat) {
|
|
103
|
-
const transactionIdsBySelectedPeriod = {
|
|
104
|
-
...autoCat.transactionIdsBySelectedPeriod,
|
|
105
|
-
};
|
|
106
|
-
const hasAnyLoadedRows = Object.values(transactionIdsBySelectedPeriod).some((ids) => ids.length > 0);
|
|
107
|
-
let normalisedFetchState = autoCat.fetchState;
|
|
108
|
-
if (normalisedFetchState === 'In-Progress') {
|
|
109
|
-
normalisedFetchState = hasAnyLoadedRows ? 'Completed' : 'Not-Started';
|
|
110
|
-
}
|
|
111
|
-
return {
|
|
112
|
-
error: autoCat.error,
|
|
113
|
-
fetchState: normalisedFetchState,
|
|
114
|
-
pageToken: autoCat.uiState.pageToken,
|
|
115
|
-
scrollPosition: autoCat.uiState.scrollPosition,
|
|
116
|
-
totalCount: { ...autoCat.uiState.totalCount },
|
|
117
|
-
transactionIdsBySelectedPeriod,
|
|
118
|
-
};
|
|
119
|
-
}
|
|
120
57
|
const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
121
58
|
name: 'expenseAutomationTransactionsView',
|
|
122
59
|
initialState: exports.initialState,
|
|
@@ -330,55 +267,6 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
330
267
|
return { payload: { newSelectedTab } };
|
|
331
268
|
},
|
|
332
269
|
},
|
|
333
|
-
updateTransactionCategorizationCompletedSubTab: {
|
|
334
|
-
reducer(draft, action) {
|
|
335
|
-
const { newSubTab } = action.payload;
|
|
336
|
-
const previousSubTab = draft.selectedTransactionCategorizationCompletedSubTab;
|
|
337
|
-
if (previousSubTab === newSubTab) {
|
|
338
|
-
return;
|
|
339
|
-
}
|
|
340
|
-
const autoCat = draft.transactionCategorizationView.autoCategorized;
|
|
341
|
-
// Snapshot the outgoing sub-tab so a future revisit can short-circuit
|
|
342
|
-
// the fetch epic (mirrors the parent-tab "don't refetch what's
|
|
343
|
-
// already cached" behaviour). Period-scoped data is preserved as-is
|
|
344
|
-
// because the snapshot itself is keyed only by sub-tab; the active
|
|
345
|
-
// tab's per-period maps remain the source of truth while live.
|
|
346
|
-
draft.autoCategorizedSubTabCache[previousSubTab] =
|
|
347
|
-
snapshotAutoCategorizedTab(autoCat);
|
|
348
|
-
const cached = draft.autoCategorizedSubTabCache[newSubTab];
|
|
349
|
-
if (cached != null) {
|
|
350
|
-
autoCat.uiState.pageToken = cached.pageToken;
|
|
351
|
-
autoCat.uiState.totalCount = { ...cached.totalCount };
|
|
352
|
-
autoCat.uiState.scrollPosition = cached.scrollPosition;
|
|
353
|
-
autoCat.transactionIdsBySelectedPeriod = {
|
|
354
|
-
...cached.transactionIdsBySelectedPeriod,
|
|
355
|
-
};
|
|
356
|
-
autoCat.fetchState = cached.fetchState;
|
|
357
|
-
autoCat.error = cached.error;
|
|
358
|
-
}
|
|
359
|
-
else {
|
|
360
|
-
// Sub-tab has never been visited — clear the active slot so the
|
|
361
|
-
// view-epic's `fetchState === 'Not-Started' || transactionIds.length
|
|
362
|
-
// === 0` cache check falls through and triggers a fresh page-1
|
|
363
|
-
// fetch for the new dataset. `scrollPosition` is reset to the top
|
|
364
|
-
// so the incoming list isn't anchored to the outgoing sub-tab's
|
|
365
|
-
// offset (different rows → previous offset is meaningless).
|
|
366
|
-
autoCat.uiState.pageToken = null;
|
|
367
|
-
autoCat.uiState.totalCount = {};
|
|
368
|
-
autoCat.uiState.scrollPosition = {
|
|
369
|
-
scrollTop: 0,
|
|
370
|
-
scrollLeft: undefined,
|
|
371
|
-
};
|
|
372
|
-
autoCat.transactionIdsBySelectedPeriod = {};
|
|
373
|
-
autoCat.fetchState = 'Not-Started';
|
|
374
|
-
autoCat.error = undefined;
|
|
375
|
-
}
|
|
376
|
-
draft.selectedTransactionCategorizationCompletedSubTab = newSubTab;
|
|
377
|
-
},
|
|
378
|
-
prepare(newSubTab) {
|
|
379
|
-
return { payload: { newSubTab } };
|
|
380
|
-
},
|
|
381
|
-
},
|
|
382
270
|
updateTransactionCategorization: {
|
|
383
271
|
reducer(draft, action) {
|
|
384
272
|
const selectedTab = action.payload.selectedTab;
|
|
@@ -816,10 +704,6 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
816
704
|
const { selectedTab, selectedPeriod, totalCount } = action.payload;
|
|
817
705
|
draft.transactionCategorizationView[selectedTab].uiState.totalCount[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = totalCount;
|
|
818
706
|
},
|
|
819
|
-
updateParentTotalCountForTab(draft, action) {
|
|
820
|
-
const { selectedTab, selectedPeriod, parentTotalCount } = action.payload;
|
|
821
|
-
draft.parentTotalCountByTab[selectedTab][(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = parentTotalCount;
|
|
822
|
-
},
|
|
823
707
|
updateSelectedCheckboxTransactionIds(draft, action) {
|
|
824
708
|
const selectedTab = action.payload.selectedTab;
|
|
825
709
|
const transactionIds = action.payload.transactionIds;
|
|
@@ -830,16 +714,6 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
830
714
|
draft.transactionCategorizationView[selectedTab] = {
|
|
831
715
|
...exports.initialTransactionTabViewState,
|
|
832
716
|
};
|
|
833
|
-
draft.parentTotalCountByTab[selectedTab] = {};
|
|
834
|
-
// The per-sub-tab snapshot cache lives at the slice root and is
|
|
835
|
-
// exclusively populated by the autoCategorized tab's sub-tab switching
|
|
836
|
-
// (see updateTransactionCategorizationCompletedSubTab). When that tab
|
|
837
|
-
// is reset, leaving stale snapshots behind would short-circuit the
|
|
838
|
-
// next sub-tab visit with phantom row IDs / page tokens that no longer
|
|
839
|
-
// correspond to anything in state — drop them in lockstep.
|
|
840
|
-
if (selectedTab === 'autoCategorized') {
|
|
841
|
-
draft.autoCategorizedSubTabCache = {};
|
|
842
|
-
}
|
|
843
717
|
},
|
|
844
718
|
clearExpenseAutomationTransactionsView(draft) {
|
|
845
719
|
Object.assign(draft, exports.initialState);
|
|
@@ -936,5 +810,5 @@ const expenseAutomationTransactionsView = (0, toolkit_1.createSlice)({
|
|
|
936
810
|
},
|
|
937
811
|
},
|
|
938
812
|
});
|
|
939
|
-
_a = expenseAutomationTransactionsView.actions, exports.fetchTransactionCategorization = _a.fetchTransactionCategorization, exports.updateTransactionCategorizationUIState = _a.updateTransactionCategorizationUIState, exports.initializeTransactionCategorizationViewLocalData = _a.initializeTransactionCategorizationViewLocalData, exports.saveTransactionCategorizationLocalData = _a.saveTransactionCategorizationLocalData, exports.fetchTransactionCategorizationFailure = _a.fetchTransactionCategorizationFailure, exports.saveTransactionCategorization = _a.saveTransactionCategorization, exports.updateTransactionCategorization = _a.updateTransactionCategorization, exports.updateCurrentSelectedTransactionCategorizationTab = _a.updateCurrentSelectedTransactionCategorizationTab, exports.
|
|
813
|
+
_a = expenseAutomationTransactionsView.actions, exports.fetchTransactionCategorization = _a.fetchTransactionCategorization, exports.updateTransactionCategorizationUIState = _a.updateTransactionCategorizationUIState, exports.initializeTransactionCategorizationViewLocalData = _a.initializeTransactionCategorizationViewLocalData, exports.saveTransactionCategorizationLocalData = _a.saveTransactionCategorizationLocalData, exports.fetchTransactionCategorizationFailure = _a.fetchTransactionCategorizationFailure, exports.saveTransactionCategorization = _a.saveTransactionCategorization, exports.updateTransactionCategorization = _a.updateTransactionCategorization, exports.updateCurrentSelectedTransactionCategorizationTab = _a.updateCurrentSelectedTransactionCategorizationTab, exports.updateTransactionCategorizationSaveStatus = _a.updateTransactionCategorizationSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.updateStatusForTransactionNotMiscategorizedUpdateForCategorization = _a.updateStatusForTransactionNotMiscategorizedUpdateForCategorization, exports.updateSelectedVendorForTransaction = _a.updateSelectedVendorForTransaction, exports.updateSelectedCustomerForTransaction = _a.updateSelectedCustomerForTransaction, exports.setAllItemsToCategoryClassInLocalDataForCategorization = _a.setAllItemsToCategoryClassInLocalDataForCategorization, exports.updateTotalCountForTransactionCategorization = _a.updateTotalCountForTransactionCategorization, exports.fetchTransactionCategorizationSuccess = _a.fetchTransactionCategorizationSuccess, exports.resetOtherTabsFetchState = _a.resetOtherTabsFetchState, exports.fetchTransactionCategorizationView = _a.fetchTransactionCategorizationView, exports.updateSelectedCheckboxTransactionIds = _a.updateSelectedCheckboxTransactionIds, exports.clearExpenseAutomationTransactionsViewPerTabView = _a.clearExpenseAutomationTransactionsViewPerTabView, exports.clearExpenseAutomationTransactionsView = _a.clearExpenseAutomationTransactionsView, exports.setEntityRecommendationForLineIdsForCategorization = _a.setEntityRecommendationForLineIdsForCategorization, exports.updateSelectedTransactionId = _a.updateSelectedTransactionId, exports.syncTransactionCategorizationFromDetailSave = _a.syncTransactionCategorizationFromDetailSave, exports.backgroundRefetchReviewTab = _a.backgroundRefetchReviewTab, exports.updateTransactionCategorizationUploadReceiptState = _a.updateTransactionCategorizationUploadReceiptState, exports.uploadTransactionCategorizationReceiptSuccess = _a.uploadTransactionCategorizationReceiptSuccess;
|
|
940
814
|
exports.default = expenseAutomationTransactionsView.reducer;
|
|
@@ -2,8 +2,7 @@ import { CompletionStatusType, FetchStateAndError, ID } from '../../../commonSta
|
|
|
2
2
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
3
3
|
import { SelectorView } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
4
4
|
import { SupportedTransaction } from '../../../entity/transaction/transactionState';
|
|
5
|
-
import type { CompletedSubTab } from '../types/
|
|
6
|
-
import type { BatchFileStatus, BatchListItem, BatchStatus, BulkUploadPhase, BulkUploadResultsTab, BulkUploadSortKey, ManualSearchState, MatchSource, MissingReceiptsViewUIState } from '../types/missingReceiptsViewState';
|
|
5
|
+
import type { BatchFileStatus, BatchListItem, BatchStatus, BulkUploadPhase, BulkUploadResultsTab, BulkUploadSortKey, CompletedSubTab, ManualSearchState, MatchSource, MissingReceiptsViewUIState } from '../types/missingReceiptsViewState';
|
|
7
6
|
export interface CompletedTransactionsSelectorData {
|
|
8
7
|
fetchState: FetchStateAndError;
|
|
9
8
|
nextPageToken: string | null;
|
|
@@ -7,7 +7,6 @@ import { ClassBase } from '../../../entity/class/classState';
|
|
|
7
7
|
import { SupportedTransactionWithCOT } from '../../../entity/transaction/transactionState';
|
|
8
8
|
import { UncategorizedAccounts } from '../../accountList/accountListSelector';
|
|
9
9
|
import { ProjectListSelectorView } from '../../projectList/projectListSelector';
|
|
10
|
-
import { CompletedSubTab } from '../types/completedSubTab';
|
|
11
10
|
import { TransactionReviewLocalData, TransactionsTab, TransactionsViewUIState } from '../types/transactionsViewState';
|
|
12
11
|
export interface TransactionReviewLocalDataSelectorView {
|
|
13
12
|
transactionId: ID;
|
|
@@ -22,23 +21,10 @@ export interface ExpenseAutomationTransactionViewSelector extends SelectorView {
|
|
|
22
21
|
fetchStateByTransactionTabs: Record<TransactionsTab, FetchStateAndError>;
|
|
23
22
|
isAccountingProjectsEnabled: boolean;
|
|
24
23
|
markAsNotMiscategorizedStatus: FetchStateAndError;
|
|
25
|
-
/**
|
|
26
|
-
* Parent tab badge counts, sourced from the listing response's
|
|
27
|
-
* `parent_tab_total_count`. Used exclusively to drive the navbar / tab
|
|
28
|
-
* strip badge labels — every other count consumer (pagination, in-list
|
|
29
|
-
* "showing X of Y", save flows) keeps reading {@link totalCountByTab}.
|
|
30
|
-
*/
|
|
31
|
-
parentTabTotalCountByTab: Record<TransactionsTab, number>;
|
|
32
24
|
projectList: ProjectListSelectorView;
|
|
33
25
|
refreshStatus: FetchStateAndError;
|
|
34
26
|
saveStatus: FetchStateAndError;
|
|
35
27
|
selectedCheckBoxTransactionIds: ID[];
|
|
36
|
-
selectedTransactionCategorizationCompletedSubTab: CompletedSubTab;
|
|
37
|
-
/**
|
|
38
|
-
* Per-(sub-)tab counts mirroring `total_count` from the listing response.
|
|
39
|
-
* Powers pagination via `InfiniteLoader.itemCount`, in-list count copy,
|
|
40
|
-
* and the `resetTransactionCategorizationLocalData` round-trip.
|
|
41
|
-
*/
|
|
42
28
|
totalCountByTab: Record<TransactionsTab, number>;
|
|
43
29
|
transactionIdsWithUnsavedData: ID[];
|
|
44
30
|
transactionLocalData: TransactionReviewLocalDataSelectorView[];
|