@zeniai/client-epic-state 5.0.67 → 5.0.69-beta0ND
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/commonStateTypes/cacheOverrideFetchReducer.d.ts +17 -0
- package/lib/commonStateTypes/cacheOverrideFetchReducer.js +20 -0
- package/lib/commonStateTypes/pusherActions.d.ts +11 -0
- package/lib/commonStateTypes/pusherActions.js +6 -0
- 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 +1 -3
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +1 -2
- package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +1 -1
- package/lib/entity/chargeCard/chargeCardReducer.d.ts +19 -2
- package/lib/entity/chargeCard/chargeCardReducer.js +35 -2
- package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.d.ts +14 -1
- package/lib/entity/chargeCardTransaction/chargeCardTransactionReducer.js +36 -2
- package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +1 -1
- package/lib/entity/sectionProjectView/sectionProjectViewSelector.js +1 -1
- package/lib/entity/tenant/SessionManager.js +6 -3
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -2
- package/lib/entity/tenant/clearAllEpic.js +2 -2
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.js +6 -2
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.js +6 -2
- package/lib/entity/tenant/tenantReducer.js +6 -1
- package/lib/entity/transaction/payloadTypes/transactionLinePayload.js +3 -1
- package/lib/epic.d.ts +12 -10
- package/lib/epic.js +13 -11
- package/lib/esm/commonStateTypes/cacheOverrideFetchReducer.js +16 -0
- package/lib/esm/commonStateTypes/pusherActions.js +3 -0
- package/lib/esm/coreEpics.js +1 -1
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +1 -3
- package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +1 -2
- package/lib/esm/entity/chargeCard/chargeCardReducer.js +34 -1
- package/lib/esm/entity/chargeCardTransaction/chargeCardTransactionReducer.js +35 -1
- package/lib/esm/entity/sectionProjectView/sectionProjectViewSelector.js +1 -1
- package/lib/esm/entity/tenant/SessionManager.js +4 -1
- package/lib/esm/entity/tenant/clearAllEpic.js +2 -2
- package/lib/esm/entity/tenant/epic/saveAPIKeyConnectionEpic.js +6 -2
- package/lib/esm/entity/tenant/epic/saveOAuthConnectionEpic.js +6 -2
- package/lib/esm/entity/tenant/tenantReducer.js +6 -1
- package/lib/esm/entity/transaction/payloadTypes/transactionLinePayload.js +3 -1
- package/lib/esm/epic.js +13 -11
- package/lib/esm/index.js +23 -17
- package/lib/esm/reducer.js +2 -2
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +2 -5
- package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +2 -5
- package/lib/esm/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +4 -1
- 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 +2 -1
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +8 -6
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -1
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +11 -1
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -1
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +127 -1
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +20 -1
- package/lib/esm/view/expenseAutomationView/types/completedSubTab.js +17 -0
- package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +0 -2
- package/lib/esm/view/financeStatement/financeStatementSelector.js +1 -1
- package/lib/esm/view/onboardingView/customerView/onboardingCustomerViewReducer.js +61 -50
- package/lib/esm/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +3 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +3 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +55 -18
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +16 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +5 -4
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +26 -9
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +9 -6
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +3 -2
- package/lib/esm/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
- package/lib/esm/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +7 -3
- package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +49 -0
- package/lib/esm/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +58 -0
- package/lib/esm/view/spendManagement/commonSetup/kycKybAutofillActions.js +12 -0
- package/lib/esm/view/spendManagement/commonSetup/kycKybParseMapper.js +205 -0
- package/lib/esm/view/spendManagement/commonSetup/setupViewReducer.js +71 -52
- package/lib/esm/view/spendManagement/commonSetup/setupViewSelector.js +2 -0
- package/lib/esm/view/spendManagement/commonSetup/types/kycKybAutofill.js +28 -0
- 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 +7 -1
- package/lib/index.d.ts +26 -19
- package/lib/index.js +83 -58
- package/lib/reducer.d.ts +2 -2
- package/lib/reducer.js +2 -2
- 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 +2 -5
- package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +2 -5
- package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +4 -1
- 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 +2 -1
- package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +8 -6
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -1
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +10 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +21 -0
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +2 -1
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +9 -3
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +128 -2
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +2 -1
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +14 -0
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +20 -1
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +10 -0
- package/lib/view/expenseAutomationView/types/completedSubTab.js +21 -0
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -2
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +1 -4
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +41 -2
- package/lib/view/financeStatement/financeStatementSelector.js +1 -1
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +25 -2
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.js +62 -51
- package/lib/view/onboardingView/customerView/onboardingCustomerViewState.d.ts +10 -0
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/cashbackDetail/cashbackDetailReducer.js +3 -2
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/chargeCardConfig/chargeCardConfigReducer.js +3 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.js +55 -18
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailEpic.js +16 -2
- package/lib/view/spendManagement/chargeCards/chargeCardDetail/fetchChargeCardDetailPageEpic.js +5 -4
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.d.ts +18 -3
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListReducer.js +27 -10
- package/lib/view/spendManagement/chargeCards/chargeCardList/fetchChargeCardListPageEpic.js +9 -6
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/chargeCardPaymentHistoryReducer.js +3 -2
- package/lib/view/spendManagement/chargeCards/chargeCardPaymentHistory/fetchChargeCardPaymentPageEpic.js +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.d.ts +3 -1
- package/lib/view/spendManagement/chargeCards/chargeCardRepaymentDetail/chargeCardRepaymentDetailReducer.js +7 -3
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.d.ts +8 -0
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKybDocumentEpic.js +53 -0
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.d.ts +8 -0
- package/lib/view/spendManagement/commonSetup/epic/setup/parseUploadedKycDocumentEpic.js +62 -0
- package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.d.ts +27 -0
- package/lib/view/spendManagement/commonSetup/kycKybAutofillActions.js +15 -0
- package/lib/view/spendManagement/commonSetup/kycKybParseMapper.d.ts +24 -0
- package/lib/view/spendManagement/commonSetup/kycKybParseMapper.js +213 -0
- package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +24 -2
- package/lib/view/spendManagement/commonSetup/setupViewReducer.js +72 -53
- package/lib/view/spendManagement/commonSetup/setupViewSelector.d.ts +4 -0
- package/lib/view/spendManagement/commonSetup/setupViewSelector.js +2 -0
- package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +12 -0
- package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.d.ts +125 -0
- package/lib/view/spendManagement/commonSetup/types/kycKybAutofill.js +32 -0
- package/lib/view/transactionDetail/transactionDetailSelector.js +7 -1
- package/lib/view/zeniOAuthView/zeniOAuthSelector.d.ts +1 -1
- package/package.json +9 -4
package/lib/esm/reducer.js
CHANGED
|
@@ -4,7 +4,6 @@ import accountGroup, { initialState as initialAccountGroupState, } from './entit
|
|
|
4
4
|
import accountRecon, { initialState as initialAccountReconState, } from './entity/accountRecon/accountReconReducer';
|
|
5
5
|
import address, { initialState as initialAddressState, } from './entity/address/addressReducer';
|
|
6
6
|
import aiAccountantCustomer, { initialAiAccountantCustomerState, } from './entity/aiAccountantCustomer/aiAccountantCustomerReducer';
|
|
7
|
-
import creditAgentEntity, { initialCreditAgentEntityState, } from './entity/creditAgent/creditAgentReducer';
|
|
8
7
|
import aiCfo, { initialAiCfoState } from './entity/aiCfo/aiCfoReducer';
|
|
9
8
|
import approvalRule, { initialState as initialApprovalRuleState, } from './entity/approvalRule/approvalRuleReducer';
|
|
10
9
|
import bankAccount, { initialState as initialBankAccountState, } from './entity/bankAccount/bankAccountReducer';
|
|
@@ -20,6 +19,7 @@ import company, { initialState as initialCompanyState, } from './entity/company/
|
|
|
20
19
|
import companyHealthMetric, { initialState as initialCompanyHealthMetricState, } from './entity/companyHealthMetric/companyHealthMetricReducer';
|
|
21
20
|
import connectedAccount, { initialState as initialConnectedAccountState, } from './entity/connectedAccount/connectedAccountReducer';
|
|
22
21
|
import countryList, { initialState as initialCountryListState, } from './entity/countryList/countryListReducer';
|
|
22
|
+
import creditAgentEntity, { initialCreditAgentEntityState, } from './entity/creditAgent/creditAgentReducer';
|
|
23
23
|
import currency, { initialState as initialCurrencyState, } from './entity/currency/currencyReducer';
|
|
24
24
|
import customer, { initialState as initialCustomerState, } from './entity/customer/customerReducer';
|
|
25
25
|
import customerIncome, { initialState as initialCustomerIncomeState, } from './entity/customerIncome/customerIncomeTrendReducer';
|
|
@@ -107,9 +107,9 @@ import expenseAutomationJESchedulesView, { initialState as initialExpenseAutomat
|
|
|
107
107
|
import expenseAutomationMissingReceiptsView, { initialState as initialExpenseAutomationMissingReceiptsViewState, } from './view/expenseAutomationView/reducers/missingReceiptsViewReducer';
|
|
108
108
|
import expenseAutomationReconciliationView, { initialState as initialExpenseAutomationReconciliationViewState, } from './view/expenseAutomationView/reducers/reconciliationViewReducer';
|
|
109
109
|
import expenseAutomationTransactionsView, { initialState as initialExpenseAutomationTransactionsViewState, } from './view/expenseAutomationView/reducers/transactionsViewReducer';
|
|
110
|
+
import featureNotificationView, { initialState as initialFeatureNotificationViewState, } from './view/featureNotificationView/featureNotificationViewReducer';
|
|
110
111
|
import fileView from './view/fileView/fileViewReducer';
|
|
111
112
|
import { initialFileViewState, } from './view/fileView/fileViewState';
|
|
112
|
-
import featureNotificationView, { initialState as initialFeatureNotificationViewState, } from './view/featureNotificationView/featureNotificationViewReducer';
|
|
113
113
|
import financeStatement, { initialFinanceStatementState, } from './view/financeStatement/financeStatementReducer';
|
|
114
114
|
import forecastList, { initialState as initialForecastListState, } from './view/forecastList/forecastListReducer';
|
|
115
115
|
import globalMerchantAutoComplete, { initialState as initialGlobalMerchantAutoCompleteState, } from './view/globalMerchantView/globalMerchantAutoCompleteView/globalMerchantAutoCompleteViewReducer';
|
|
@@ -7,9 +7,7 @@ import { fetchAiAccountantCustomers, updateAiAccountantCustomers, updateAiAccoun
|
|
|
7
7
|
export const fetchAiAccountantCustomersEpic = (actions$, _, zeniAPI) => actions$.pipe(filter(fetchAiAccountantCustomers.match), switchMap(() => {
|
|
8
8
|
const base = `${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/cockpit-panels`;
|
|
9
9
|
const url = `${base}/ai-accountant/customers`;
|
|
10
|
-
return zeniAPI
|
|
11
|
-
.getJSON(url)
|
|
12
|
-
.pipe(mergeMap((response) => {
|
|
10
|
+
return zeniAPI.getJSON(url).pipe(mergeMap((response) => {
|
|
13
11
|
if (isSuccessResponse(response)) {
|
|
14
12
|
const customers = response.data?.customers ?? [];
|
|
15
13
|
const users = response.data?.users ?? [];
|
|
@@ -22,6 +20,5 @@ export const fetchAiAccountantCustomersEpic = (actions$, _, zeniAPI) => actions$
|
|
|
22
20
|
else {
|
|
23
21
|
return of(updateAiAccountantCustomersFailure(response.status));
|
|
24
22
|
}
|
|
25
|
-
}), catchError((error) => of(updateAiAccountantCustomersFailure(createZeniAPIStatus('Unexpected error', 'AI Accountant customers fetch failed: ' +
|
|
26
|
-
JSON.stringify(error))))));
|
|
23
|
+
}), catchError((error) => of(updateAiAccountantCustomersFailure(createZeniAPIStatus('Unexpected error', 'AI Accountant customers fetch failed: ' + JSON.stringify(error))))));
|
|
27
24
|
}));
|
|
@@ -20,9 +20,7 @@ export const fetchAiAccountantJobsEpic = (actions$, state$, zeniAPI) => actions$
|
|
|
20
20
|
}
|
|
21
21
|
const base = `${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/cockpit-panels`;
|
|
22
22
|
const url = `${base}/ai-accountant/jobs?${params.toString()}`;
|
|
23
|
-
return zeniAPI
|
|
24
|
-
.getJSON(url)
|
|
25
|
-
.pipe(mergeMap((response) => {
|
|
23
|
+
return zeniAPI.getJSON(url).pipe(mergeMap((response) => {
|
|
26
24
|
if (isSuccessResponse(response)) {
|
|
27
25
|
const jobs = response.data?.jobs ?? [];
|
|
28
26
|
const users = response.data?.users ?? [];
|
|
@@ -41,7 +39,6 @@ export const fetchAiAccountantJobsEpic = (actions$, state$, zeniAPI) => actions$
|
|
|
41
39
|
}
|
|
42
40
|
}), catchError((error) => of(updateAiAccountantJobsFailure({
|
|
43
41
|
tenantId,
|
|
44
|
-
error: createZeniAPIStatus('Unexpected error', 'AI Accountant jobs fetch failed: ' +
|
|
45
|
-
JSON.stringify(error)),
|
|
42
|
+
error: createZeniAPIStatus('Unexpected error', 'AI Accountant jobs fetch failed: ' + JSON.stringify(error)),
|
|
46
43
|
}))));
|
|
47
44
|
}));
|
|
@@ -51,7 +51,10 @@ export const triggerAiAccountantJobEpic = (actions$, state$, zeniAPI) => actions
|
|
|
51
51
|
messageText: 'failed',
|
|
52
52
|
type: 'error',
|
|
53
53
|
variables: [
|
|
54
|
-
{
|
|
54
|
+
{
|
|
55
|
+
variableName: '__reason__',
|
|
56
|
+
variableValue: 'Unexpected error',
|
|
57
|
+
},
|
|
55
58
|
],
|
|
56
59
|
}),
|
|
57
60
|
])));
|
|
@@ -4,7 +4,7 @@ import { getTagsByIds } from '../../entity/tag/tagSelector';
|
|
|
4
4
|
import { getTaskById } from '../../entity/task/taskSelector';
|
|
5
5
|
import { getUserByUserId, getUsersByUserIds, } from '../../entity/user/userSelector';
|
|
6
6
|
export const getCompanyTaskManagerView = createSelector((state) => state.companyTaskManagerViewState, (state) => state.companyState, (state) => state.userState, (state) => state.taskState, (state) => state.tagState, (companyTaskManagerViewState, companyState, userState, taskState, tagState) => {
|
|
7
|
-
const { taskIds, uiState, fetchState, error, totalTaskCount, metrics, metricsFetchState } = companyTaskManagerViewState;
|
|
7
|
+
const { taskIds, uiState, fetchState, error, totalTaskCount, metrics, metricsFetchState, } = companyTaskManagerViewState;
|
|
8
8
|
const tasksList = [];
|
|
9
9
|
taskIds.forEach((taskId) => {
|
|
10
10
|
const task = getTaskById(taskState, taskId);
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { of } from 'rxjs';
|
|
2
2
|
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
-
import { isSuccessResponse
|
|
3
|
+
import { isSuccessResponse } from '../../../responsePayload';
|
|
4
4
|
import { fetchTaskManagerMetrics, updateTaskManagerMetrics, updateTaskManagerMetricsOnFailure, } from '../companyTaskManagerViewReducer';
|
|
5
5
|
export const fetchTaskManagerMetricsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchTaskManagerMetrics.match), switchMap(() => {
|
|
6
6
|
const query = JSON.stringify({ is_filter_by_logged_in_user: true });
|
package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js
CHANGED
|
@@ -3,10 +3,10 @@ import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
|
3
3
|
import { toMonthYearPeriodId } from '../../../../commonStateTypes/timePeriod';
|
|
4
4
|
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
5
5
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
6
|
-
import { toBatchListItem, } from '../../payload/missingReceiptsPayload';
|
|
7
|
-
import { fetchBulkUploadBatches, fetchBulkUploadBatchesFailure, fetchBulkUploadBatchesSuccess, } from '../../reducers/missingReceiptsViewReducer';
|
|
8
6
|
import { BULK_UPLOAD_BATCH_LIST_DATE_RANGE_DAYS } from '../../helpers/bulkUploadTiming';
|
|
9
7
|
import { rollingCalendarDateRangeInclusive } from '../../helpers/rollingCalendarDateRangeInclusive';
|
|
8
|
+
import { toBatchListItem, } from '../../payload/missingReceiptsPayload';
|
|
9
|
+
import { fetchBulkUploadBatches, fetchBulkUploadBatchesFailure, fetchBulkUploadBatchesSuccess, } from '../../reducers/missingReceiptsViewReducer';
|
|
10
10
|
export const fetchBulkUploadBatchesEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchBulkUploadBatches.match), switchMap((action) => {
|
|
11
11
|
const { cacheOverride } = action.payload;
|
|
12
12
|
const state = state$.value;
|
package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js
CHANGED
|
@@ -5,6 +5,7 @@ import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
|
5
5
|
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
6
6
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
7
7
|
import { fetchCompletedTransactions, fetchCompletedTransactionsFailure, fetchCompletedTransactionsSuccess, getCompletedTransactionsCacheKey, } from '../../reducers/missingReceiptsViewReducer';
|
|
8
|
+
import { DEFAULT_COMPLETED_SUB_TAB } from '../../types/completedSubTab';
|
|
8
9
|
export const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchCompletedTransactions.match), switchMap((action) => {
|
|
9
10
|
const state = state$.value;
|
|
10
11
|
const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload }, } = state;
|
|
@@ -39,7 +40,7 @@ export const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => act
|
|
|
39
40
|
if (sortOrder != null) {
|
|
40
41
|
queryPayload.sort_order = sortOrder === 'ascending' ? 'asc' : 'desc';
|
|
41
42
|
}
|
|
42
|
-
if (completedSubTab !==
|
|
43
|
+
if (completedSubTab !== DEFAULT_COMPLETED_SUB_TAB) {
|
|
43
44
|
queryPayload.match_type = completedSubTab;
|
|
44
45
|
}
|
|
45
46
|
const encodedQuery = encodeURIComponent(JSON.stringify(queryPayload));
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { EMPTY, concat, from, of } from 'rxjs';
|
|
2
2
|
import { catchError, concatMap, filter, mergeMap, take } from 'rxjs/operators';
|
|
3
|
+
import { toMonthYearPeriodId } from '../../../../commonStateTypes/timePeriod';
|
|
4
|
+
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
3
5
|
import { isSuccessResponse } from '../../../../responsePayload';
|
|
4
|
-
import { isBatchDetailsStatusPendingOrProcessing, toBatchListItem, } from '../../payload/missingReceiptsPayload';
|
|
5
|
-
import { fetchBulkUploadBatchesSuccess, restoreBulkUploadAutomatchingOnMount, restoreBulkUploadMatchingState, } from '../../reducers/missingReceiptsViewReducer';
|
|
6
6
|
import { BULK_UPLOAD_BATCH_LIST_DATE_RANGE_DAYS } from '../../helpers/bulkUploadTiming';
|
|
7
7
|
import { rollingCalendarDateRangeInclusive } from '../../helpers/rollingCalendarDateRangeInclusive';
|
|
8
|
-
import {
|
|
9
|
-
import {
|
|
8
|
+
import { isBatchDetailsStatusPendingOrProcessing, toBatchListItem, } from '../../payload/missingReceiptsPayload';
|
|
9
|
+
import { fetchBulkUploadBatchesSuccess, restoreBulkUploadAutomatchingOnMount, restoreBulkUploadMatchingState, } from '../../reducers/missingReceiptsViewReducer';
|
|
10
10
|
/**
|
|
11
11
|
* On missing-receipts entry / period switch, hydrate the automatching banner for the logged-in
|
|
12
12
|
* user without relying on UI-driven list fetches (the Missing tab does not fetch the batch list
|
|
@@ -49,10 +49,12 @@ export const restoreBulkUploadAutomatchingOnMountEpic = (actions$, state$, zeniA
|
|
|
49
49
|
bulkUpload.batchListFetchState.fetchState === 'Completed';
|
|
50
50
|
const listSource = alreadyCached
|
|
51
51
|
? of(null)
|
|
52
|
-
: zeniAPI
|
|
52
|
+
: zeniAPI
|
|
53
|
+
.getJSON(listUrl)
|
|
54
|
+
.pipe(catchError(() => of(null)));
|
|
53
55
|
return listSource.pipe(mergeMap((listResponse) => {
|
|
54
56
|
const batchList = alreadyCached
|
|
55
|
-
? bulkUpload.batchListByPeriod[periodId] ?? []
|
|
57
|
+
? (bulkUpload.batchListByPeriod[periodId] ?? [])
|
|
56
58
|
: listResponse != null &&
|
|
57
59
|
isSuccessResponse(listResponse) &&
|
|
58
60
|
listResponse.data != null
|
|
@@ -2,10 +2,11 @@ import { EMPTY, from, merge, of } from 'rxjs';
|
|
|
2
2
|
import { catchError, debounceTime, filter, mergeMap, switchMap, } from 'rxjs/operators';
|
|
3
3
|
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
4
4
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
5
|
+
import { rollingCalendarDateRangeInclusive } from '../../helpers/rollingCalendarDateRangeInclusive';
|
|
5
6
|
import { supportedTransactionPayloadToManualSearchResult } from '../../payload/missingReceiptsPayload';
|
|
6
7
|
import { searchTransactionsForManualMatch, searchTransactionsForManualMatchFailure, searchTransactionsForManualMatchSuccess, } from '../../reducers/missingReceiptsViewReducer';
|
|
8
|
+
import { DEFAULT_COMPLETED_SUB_TAB } from '../../types/completedSubTab';
|
|
7
9
|
import { toTransactionsSortKey } from '../../types/transactionsViewState';
|
|
8
|
-
import { rollingCalendarDateRangeInclusive } from '../../helpers/rollingCalendarDateRangeInclusive';
|
|
9
10
|
/**
|
|
10
11
|
* `auto_categorized` for manual transaction search (Unmatched).
|
|
11
12
|
* Backend contract TBD — align with `fetchTransactionCategorizationEpic` (`selectedTab === 'autoCategorized'`)
|
|
@@ -46,6 +47,11 @@ export const searchTransactionsForManualMatchEpic = (actions$, state$, zeniAPI)
|
|
|
46
47
|
page_token: pageToken ?? null,
|
|
47
48
|
page_size: manualSearch.pageSize,
|
|
48
49
|
search_text: query,
|
|
50
|
+
// Manual search ignores the Completed sub-tab axis — always span the
|
|
51
|
+
// default sentinel so the receipt-matching UX returns results
|
|
52
|
+
// regardless of where the transaction would otherwise be bucketed on
|
|
53
|
+
// the Completed tab.
|
|
54
|
+
sub_tab: DEFAULT_COMPLETED_SUB_TAB,
|
|
49
55
|
};
|
|
50
56
|
return zeniAPI
|
|
51
57
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expense-automation/transactions?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
@@ -5,7 +5,8 @@ import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
|
5
5
|
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
6
6
|
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
7
7
|
import { getLineItemsByTransactionsIdsFromResponse } from '../../helpers/transactionCategorizationLocalDataHelper';
|
|
8
|
-
import { fetchTransactionCategorization, fetchTransactionCategorizationFailure, fetchTransactionCategorizationSuccess, initializeTransactionCategorizationViewLocalData, resetOtherTabsFetchState, updateTotalCountForTransactionCategorization, updateTransactionCategorizationUIState, } from '../../reducers/transactionsViewReducer';
|
|
8
|
+
import { fetchTransactionCategorization, fetchTransactionCategorizationFailure, fetchTransactionCategorizationSuccess, initializeTransactionCategorizationViewLocalData, resetOtherTabsFetchState, updateParentTotalCountForTab, updateTotalCountForTransactionCategorization, updateTransactionCategorizationUIState, } from '../../reducers/transactionsViewReducer';
|
|
9
|
+
import { DEFAULT_COMPLETED_SUB_TAB } from '../../types/completedSubTab';
|
|
9
10
|
import { TRANSACTIONS_TABS, toTransactionsSortKey, } from '../../types/transactionsViewState';
|
|
10
11
|
export const fetchTransactionCategorizationEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchTransactionCategorization.match), switchMap((action) => {
|
|
11
12
|
const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationTransactionsViewState, } = state$.value;
|
|
@@ -23,6 +24,9 @@ export const fetchTransactionCategorizationEpic = (actions$, state$, zeniAPI) =>
|
|
|
23
24
|
page_token: pageToken,
|
|
24
25
|
page_size: 25,
|
|
25
26
|
search_text: uiState.searchString,
|
|
27
|
+
sub_tab: selectedTab === 'autoCategorized'
|
|
28
|
+
? expenseAutomationTransactionsViewState.selectedTransactionCategorizationCompletedSubTab
|
|
29
|
+
: DEFAULT_COMPLETED_SUB_TAB,
|
|
26
30
|
};
|
|
27
31
|
return zeniAPI
|
|
28
32
|
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expense-automation/transactions?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
@@ -45,6 +49,12 @@ export const fetchTransactionCategorizationEpic = (actions$, state$, zeniAPI) =>
|
|
|
45
49
|
selectedTab,
|
|
46
50
|
totalCount: response.data.total_count,
|
|
47
51
|
}));
|
|
52
|
+
updateActions.push(updateParentTotalCountForTab({
|
|
53
|
+
selectedPeriod,
|
|
54
|
+
selectedTab,
|
|
55
|
+
parentTotalCount: response.data.parent_tab_total_count ??
|
|
56
|
+
response.data.total_count,
|
|
57
|
+
}));
|
|
48
58
|
updateActions.push(resetOtherTabsFetchState({
|
|
49
59
|
refreshViewInBackground,
|
|
50
60
|
tabs: TRANSACTIONS_TABS.filter((tab) => selectedTab !== tab),
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
import { createAction, createSlice } from '@reduxjs/toolkit';
|
|
2
2
|
import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
3
|
+
import { DEFAULT_COMPLETED_SUB_TAB, } from '../types/completedSubTab';
|
|
3
4
|
import { MIN_MANUAL_TRANSACTION_SEARCH_LENGTH, } from '../types/missingReceiptsViewState';
|
|
4
5
|
export const getCompletedTransactionsCacheKey = (periodId, sortKey, sortOrder, subTab) => {
|
|
5
6
|
const sortKeyPart = sortKey ?? 'none';
|
|
@@ -12,7 +13,7 @@ export const initialBulkUploadState = {
|
|
|
12
13
|
batchListByPeriod: {},
|
|
13
14
|
batchListFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
14
15
|
batchStatusById: {},
|
|
15
|
-
completedSubTab:
|
|
16
|
+
completedSubTab: DEFAULT_COMPLETED_SUB_TAB,
|
|
16
17
|
completedTransactionsByPeriod: {},
|
|
17
18
|
confirmMatchStatus: { fetchState: 'Not-Started', error: undefined },
|
|
18
19
|
currentBatchId: undefined,
|
|
@@ -4,6 +4,7 @@ import uniq from 'lodash/uniq';
|
|
|
4
4
|
import { toMonthYearPeriodId, } from '../../../commonStateTypes/timePeriod';
|
|
5
5
|
import { isVendorTransaction } from '../../../entity/transaction/stateTypes/vendorTransaction';
|
|
6
6
|
import { MAX_SELECTION_LIMIT, checkIfAllLineItemsAreCategoryClassFilled, filterAutoTabLineItems, mergeTabSpecificLineItems, removeTransactionFromTabView, setEntityRecommendationForLineIdInLocalData, toSetAllLineItemsToCategoryClass, toTransactionDetailLocalData, } from '../helpers/transactionCategorizationLocalDataHelper';
|
|
7
|
+
import { DEFAULT_COMPLETED_SUB_TAB, } from '../types/completedSubTab';
|
|
7
8
|
export const initialTransactionTabViewState = {
|
|
8
9
|
saveStatus: {
|
|
9
10
|
fetchState: 'Not-Started',
|
|
@@ -41,12 +42,74 @@ export const initialTransactionTabViewState = {
|
|
|
41
42
|
selectedTransactionLineId: undefined,
|
|
42
43
|
};
|
|
43
44
|
export const initialState = {
|
|
45
|
+
autoCategorizedSubTabCache: {},
|
|
46
|
+
parentTotalCountByTab: {
|
|
47
|
+
review: {},
|
|
48
|
+
autoCategorized: {},
|
|
49
|
+
},
|
|
44
50
|
selectedTransactionCategorizationTab: 'review',
|
|
51
|
+
selectedTransactionCategorizationCompletedSubTab: DEFAULT_COMPLETED_SUB_TAB,
|
|
45
52
|
transactionCategorizationView: {
|
|
46
53
|
review: { ...initialTransactionTabViewState },
|
|
47
54
|
autoCategorized: { ...initialTransactionTabViewState },
|
|
48
55
|
},
|
|
49
56
|
};
|
|
57
|
+
/**
|
|
58
|
+
* Capture the autoCategorized tab's current paginated dataset for a sub-tab.
|
|
59
|
+
* The mid-flight `'In-Progress'` state is normalised to `'Completed'` because
|
|
60
|
+
* the in-flight request is cancelled by `switchMap` in the fetch epic when the
|
|
61
|
+
* sub-tab changes — restoring `'In-Progress'` later would leave the UI stuck
|
|
62
|
+
* showing a phantom loading state with no fetch actually running. Length-zero
|
|
63
|
+
* datasets degrade to `'Not-Started'` so the next visit triggers a fresh
|
|
64
|
+
* fetch from page 1 instead of short-circuiting on stale empty caches.
|
|
65
|
+
*
|
|
66
|
+
* Snapshot scope (deliberately narrow):
|
|
67
|
+
* - Captured: `pageToken`, `totalCount`, `transactionIdsBySelectedPeriod`,
|
|
68
|
+
* `fetchState`, `error`, `scrollPosition`. The first five are the keys the
|
|
69
|
+
* fetch epic's cache check reads to decide whether to short-circuit a
|
|
70
|
+
* sub-tab revisit; `scrollPosition` is captured per sub-tab so revisiting
|
|
71
|
+
* restores the user's last offset and switching to a never-visited sub-tab
|
|
72
|
+
* starts at the top instead of inheriting the outgoing sub-tab's offset
|
|
73
|
+
* (which would land the user at a meaningless row index against a
|
|
74
|
+
* completely different list).
|
|
75
|
+
* - Intentionally NOT captured (left in place on `autoCat` and inherited by
|
|
76
|
+
* the incoming sub-tab):
|
|
77
|
+
* - `uiState.searchString`, `uiState.sortKey`, `uiState.sortOrder`,
|
|
78
|
+
* `uiState.nodeCollapseState`, `uiState.limit` — search and sort are
|
|
79
|
+
* user-applied preferences that persist across sub-tabs by design (a
|
|
80
|
+
* search query stays active when the user toggles between Manual / AI
|
|
81
|
+
* Accountant).
|
|
82
|
+
* - `selectedCheckBoxTransactionIds` — selection state is intentionally
|
|
83
|
+
* cleared at the action source (the fetch epic / save flow), not
|
|
84
|
+
* by the snapshot path. Carrying selection across sub-tabs is safe
|
|
85
|
+
* because every sub-tab change goes through a fetch round-trip that
|
|
86
|
+
* reconciles selection against the new row IDs.
|
|
87
|
+
* - `transactionReviewLocalDataById`, `transactionIdsWithUnsavedData`,
|
|
88
|
+
* `uploadReceiptStatusById`, `saveStatus`, `refreshStatus`,
|
|
89
|
+
* `markAsNotMiscategorizedStatus` — these are per-row / per-flight
|
|
90
|
+
* caches that are write-through global state, not sub-tab-scoped.
|
|
91
|
+
*
|
|
92
|
+
* If the contract changes (e.g. selection should reset on every sub-tab
|
|
93
|
+
* switch), update both this comment and the snapshot return shape together.
|
|
94
|
+
*/
|
|
95
|
+
function snapshotAutoCategorizedTab(autoCat) {
|
|
96
|
+
const transactionIdsBySelectedPeriod = {
|
|
97
|
+
...autoCat.transactionIdsBySelectedPeriod,
|
|
98
|
+
};
|
|
99
|
+
const hasAnyLoadedRows = Object.values(transactionIdsBySelectedPeriod).some((ids) => ids.length > 0);
|
|
100
|
+
let normalisedFetchState = autoCat.fetchState;
|
|
101
|
+
if (normalisedFetchState === 'In-Progress') {
|
|
102
|
+
normalisedFetchState = hasAnyLoadedRows ? 'Completed' : 'Not-Started';
|
|
103
|
+
}
|
|
104
|
+
return {
|
|
105
|
+
error: autoCat.error,
|
|
106
|
+
fetchState: normalisedFetchState,
|
|
107
|
+
pageToken: autoCat.uiState.pageToken,
|
|
108
|
+
scrollPosition: autoCat.uiState.scrollPosition,
|
|
109
|
+
totalCount: { ...autoCat.uiState.totalCount },
|
|
110
|
+
transactionIdsBySelectedPeriod,
|
|
111
|
+
};
|
|
112
|
+
}
|
|
50
113
|
const expenseAutomationTransactionsView = createSlice({
|
|
51
114
|
name: 'expenseAutomationTransactionsView',
|
|
52
115
|
initialState,
|
|
@@ -260,6 +323,55 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
260
323
|
return { payload: { newSelectedTab } };
|
|
261
324
|
},
|
|
262
325
|
},
|
|
326
|
+
updateTransactionCategorizationCompletedSubTab: {
|
|
327
|
+
reducer(draft, action) {
|
|
328
|
+
const { newSubTab } = action.payload;
|
|
329
|
+
const previousSubTab = draft.selectedTransactionCategorizationCompletedSubTab;
|
|
330
|
+
if (previousSubTab === newSubTab) {
|
|
331
|
+
return;
|
|
332
|
+
}
|
|
333
|
+
const autoCat = draft.transactionCategorizationView.autoCategorized;
|
|
334
|
+
// Snapshot the outgoing sub-tab so a future revisit can short-circuit
|
|
335
|
+
// the fetch epic (mirrors the parent-tab "don't refetch what's
|
|
336
|
+
// already cached" behaviour). Period-scoped data is preserved as-is
|
|
337
|
+
// because the snapshot itself is keyed only by sub-tab; the active
|
|
338
|
+
// tab's per-period maps remain the source of truth while live.
|
|
339
|
+
draft.autoCategorizedSubTabCache[previousSubTab] =
|
|
340
|
+
snapshotAutoCategorizedTab(autoCat);
|
|
341
|
+
const cached = draft.autoCategorizedSubTabCache[newSubTab];
|
|
342
|
+
if (cached != null) {
|
|
343
|
+
autoCat.uiState.pageToken = cached.pageToken;
|
|
344
|
+
autoCat.uiState.totalCount = { ...cached.totalCount };
|
|
345
|
+
autoCat.uiState.scrollPosition = cached.scrollPosition;
|
|
346
|
+
autoCat.transactionIdsBySelectedPeriod = {
|
|
347
|
+
...cached.transactionIdsBySelectedPeriod,
|
|
348
|
+
};
|
|
349
|
+
autoCat.fetchState = cached.fetchState;
|
|
350
|
+
autoCat.error = cached.error;
|
|
351
|
+
}
|
|
352
|
+
else {
|
|
353
|
+
// Sub-tab has never been visited — clear the active slot so the
|
|
354
|
+
// view-epic's `fetchState === 'Not-Started' || transactionIds.length
|
|
355
|
+
// === 0` cache check falls through and triggers a fresh page-1
|
|
356
|
+
// fetch for the new dataset. `scrollPosition` is reset to the top
|
|
357
|
+
// so the incoming list isn't anchored to the outgoing sub-tab's
|
|
358
|
+
// offset (different rows → previous offset is meaningless).
|
|
359
|
+
autoCat.uiState.pageToken = null;
|
|
360
|
+
autoCat.uiState.totalCount = {};
|
|
361
|
+
autoCat.uiState.scrollPosition = {
|
|
362
|
+
scrollTop: 0,
|
|
363
|
+
scrollLeft: undefined,
|
|
364
|
+
};
|
|
365
|
+
autoCat.transactionIdsBySelectedPeriod = {};
|
|
366
|
+
autoCat.fetchState = 'Not-Started';
|
|
367
|
+
autoCat.error = undefined;
|
|
368
|
+
}
|
|
369
|
+
draft.selectedTransactionCategorizationCompletedSubTab = newSubTab;
|
|
370
|
+
},
|
|
371
|
+
prepare(newSubTab) {
|
|
372
|
+
return { payload: { newSubTab } };
|
|
373
|
+
},
|
|
374
|
+
},
|
|
263
375
|
updateTransactionCategorization: {
|
|
264
376
|
reducer(draft, action) {
|
|
265
377
|
const selectedTab = action.payload.selectedTab;
|
|
@@ -697,6 +809,10 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
697
809
|
const { selectedTab, selectedPeriod, totalCount } = action.payload;
|
|
698
810
|
draft.transactionCategorizationView[selectedTab].uiState.totalCount[toMonthYearPeriodId(selectedPeriod)] = totalCount;
|
|
699
811
|
},
|
|
812
|
+
updateParentTotalCountForTab(draft, action) {
|
|
813
|
+
const { selectedTab, selectedPeriod, parentTotalCount } = action.payload;
|
|
814
|
+
draft.parentTotalCountByTab[selectedTab][toMonthYearPeriodId(selectedPeriod)] = parentTotalCount;
|
|
815
|
+
},
|
|
700
816
|
updateSelectedCheckboxTransactionIds(draft, action) {
|
|
701
817
|
const selectedTab = action.payload.selectedTab;
|
|
702
818
|
const transactionIds = action.payload.transactionIds;
|
|
@@ -707,6 +823,16 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
707
823
|
draft.transactionCategorizationView[selectedTab] = {
|
|
708
824
|
...initialTransactionTabViewState,
|
|
709
825
|
};
|
|
826
|
+
draft.parentTotalCountByTab[selectedTab] = {};
|
|
827
|
+
// The per-sub-tab snapshot cache lives at the slice root and is
|
|
828
|
+
// exclusively populated by the autoCategorized tab's sub-tab switching
|
|
829
|
+
// (see updateTransactionCategorizationCompletedSubTab). When that tab
|
|
830
|
+
// is reset, leaving stale snapshots behind would short-circuit the
|
|
831
|
+
// next sub-tab visit with phantom row IDs / page tokens that no longer
|
|
832
|
+
// correspond to anything in state — drop them in lockstep.
|
|
833
|
+
if (selectedTab === 'autoCategorized') {
|
|
834
|
+
draft.autoCategorizedSubTabCache = {};
|
|
835
|
+
}
|
|
710
836
|
},
|
|
711
837
|
clearExpenseAutomationTransactionsView(draft) {
|
|
712
838
|
Object.assign(draft, initialState);
|
|
@@ -803,5 +929,5 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
803
929
|
},
|
|
804
930
|
},
|
|
805
931
|
});
|
|
806
|
-
export const { fetchTransactionCategorization, updateTransactionCategorizationUIState, initializeTransactionCategorizationViewLocalData, saveTransactionCategorizationLocalData, fetchTransactionCategorizationFailure, saveTransactionCategorization, updateTransactionCategorization, updateCurrentSelectedTransactionCategorizationTab, updateTransactionCategorizationSaveStatus, markTransactionAsNotMiscategorized, updateStatusForTransactionNotMiscategorizedUpdateForCategorization, updateSelectedVendorForTransaction, updateSelectedCustomerForTransaction, setAllItemsToCategoryClassInLocalDataForCategorization, updateTotalCountForTransactionCategorization, fetchTransactionCategorizationSuccess, resetOtherTabsFetchState, fetchTransactionCategorizationView, updateSelectedCheckboxTransactionIds, clearExpenseAutomationTransactionsViewPerTabView, clearExpenseAutomationTransactionsView, setEntityRecommendationForLineIdsForCategorization, updateSelectedTransactionId, syncTransactionCategorizationFromDetailSave, backgroundRefetchReviewTab, updateTransactionCategorizationUploadReceiptState, uploadTransactionCategorizationReceiptSuccess, } = expenseAutomationTransactionsView.actions;
|
|
932
|
+
export const { fetchTransactionCategorization, updateTransactionCategorizationUIState, initializeTransactionCategorizationViewLocalData, saveTransactionCategorizationLocalData, fetchTransactionCategorizationFailure, saveTransactionCategorization, updateTransactionCategorization, updateCurrentSelectedTransactionCategorizationTab, updateTransactionCategorizationCompletedSubTab, updateTransactionCategorizationSaveStatus, markTransactionAsNotMiscategorized, updateStatusForTransactionNotMiscategorizedUpdateForCategorization, updateSelectedVendorForTransaction, updateSelectedCustomerForTransaction, setAllItemsToCategoryClassInLocalDataForCategorization, updateTotalCountForTransactionCategorization, updateParentTotalCountForTab, fetchTransactionCategorizationSuccess, resetOtherTabsFetchState, fetchTransactionCategorizationView, updateSelectedCheckboxTransactionIds, clearExpenseAutomationTransactionsViewPerTabView, clearExpenseAutomationTransactionsView, setEntityRecommendationForLineIdsForCategorization, updateSelectedTransactionId, syncTransactionCategorizationFromDetailSave, backgroundRefetchReviewTab, updateTransactionCategorizationUploadReceiptState, uploadTransactionCategorizationReceiptSuccess, } = expenseAutomationTransactionsView.actions;
|
|
807
933
|
export default expenseAutomationTransactionsView.reducer;
|
|
@@ -10,7 +10,7 @@ import { getProjectList } from '../../projectList/projectListSelector';
|
|
|
10
10
|
import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes';
|
|
11
11
|
export function getExpenseAutomationTransactionView(state) {
|
|
12
12
|
const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, projectState, projectListState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
|
|
13
|
-
const { selectedTransactionCategorizationTab } = expenseAutomationTransactionsViewState;
|
|
13
|
+
const { selectedTransactionCategorizationCompletedSubTab, selectedTransactionCategorizationTab, } = expenseAutomationTransactionsViewState;
|
|
14
14
|
const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
|
|
15
15
|
const uncategorizedIncomeExpense = getUncategorizedAccounts(accountState, accountListState, 'accountList');
|
|
16
16
|
const accountList = getAccountList(accountState, accountListState, 'accountList');
|
|
@@ -63,10 +63,27 @@ export function getExpenseAutomationTransactionView(state) {
|
|
|
63
63
|
.uiState.totalCount;
|
|
64
64
|
const totalCountByAutoCat = expenseAutomationTransactionsViewState.transactionCategorizationView
|
|
65
65
|
.autoCategorized.uiState.totalCount;
|
|
66
|
+
// Per-(sub-)tab counts powering pagination, in-list "showing X of Y", and
|
|
67
|
+
// any save/refresh round-trips. Sourced from `uiState.totalCount` which
|
|
68
|
+
// mirrors the response's `total_count` for whatever tab/sub-tab the user is
|
|
69
|
+
// viewing (e.g. only the Manual sub-tab rows for Completed → Manual).
|
|
66
70
|
const totalCountByTab = {
|
|
67
71
|
review: monthYearPeriodId != null ? totalCountByReview[monthYearPeriodId] : 0,
|
|
68
72
|
autoCategorized: monthYearPeriodId != null ? totalCountByAutoCat[monthYearPeriodId] : 0,
|
|
69
73
|
};
|
|
74
|
+
// Parent-tab badge counts. Sourced from `parent_tab_total_count` in the
|
|
75
|
+
// listing response and used exclusively by the navbar / tab strip badges.
|
|
76
|
+
// Independent of which Completed sub-tab is active so the badge stays
|
|
77
|
+
// stable across sub-tab switches.
|
|
78
|
+
const parentTotalCountByTab = expenseAutomationTransactionsViewState.parentTotalCountByTab;
|
|
79
|
+
const parentTabTotalCountByTab = {
|
|
80
|
+
review: monthYearPeriodId != null
|
|
81
|
+
? (parentTotalCountByTab.review[monthYearPeriodId] ?? 0)
|
|
82
|
+
: 0,
|
|
83
|
+
autoCategorized: monthYearPeriodId != null
|
|
84
|
+
? (parentTotalCountByTab.autoCategorized[monthYearPeriodId] ?? 0)
|
|
85
|
+
: 0,
|
|
86
|
+
};
|
|
70
87
|
const fetchStateByTab = {
|
|
71
88
|
review: {
|
|
72
89
|
fetchState: expenseAutomationTransactionsViewState.transactionCategorizationView
|
|
@@ -108,9 +125,11 @@ export function getExpenseAutomationTransactionView(state) {
|
|
|
108
125
|
markAsNotMiscategorizedStatus,
|
|
109
126
|
completionStatus,
|
|
110
127
|
totalCountByTab,
|
|
128
|
+
parentTabTotalCountByTab,
|
|
111
129
|
fetchStateByTransactionTabs: fetchStateByTab,
|
|
112
130
|
uploadReceiptStatusById,
|
|
113
131
|
selectedTransactionId,
|
|
114
132
|
selectedTransactionLineId,
|
|
133
|
+
selectedTransactionCategorizationCompletedSubTab,
|
|
115
134
|
};
|
|
116
135
|
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
import { stringToUnion } from '../../../commonStateTypes/stringToUnion';
|
|
2
|
+
/**
|
|
3
|
+
* Sub-tabs that can appear under any "Completed" tab in the Expense Automation
|
|
4
|
+
* surface (Transaction Categorization Completed and Missing Receipts Completed
|
|
5
|
+
* both use this exact union). Forwarded verbatim to listing APIs as `sub_tab`
|
|
6
|
+
* / `match_type`. `'all'` preserves parent-tab semantics on the backend.
|
|
7
|
+
*/
|
|
8
|
+
const COMPLETED_SUB_TABS = ['all', 'ai_accountant', 'manual'];
|
|
9
|
+
export const toCompletedSubTab = (v) => stringToUnion(v.trim().toLowerCase(), COMPLETED_SUB_TABS);
|
|
10
|
+
/**
|
|
11
|
+
* "No sub-tab filter" sentinel — single source of truth for the default
|
|
12
|
+
* value of {@link CompletedSubTab}. Use this constant in initial slice
|
|
13
|
+
* state and at any call site that needs to fall back to the parent-tab
|
|
14
|
+
* listing semantics (review tab requests, manual-search overrides, etc.)
|
|
15
|
+
* so a future rename of the union doesn't require chasing literals.
|
|
16
|
+
*/
|
|
17
|
+
export const DEFAULT_COMPLETED_SUB_TAB = 'all';
|
|
@@ -39,8 +39,6 @@ const BULK_UPLOAD_RESULTS_TABS = ['completed', 'unmatched'];
|
|
|
39
39
|
export const toBulkUploadResultsTab = (v) => stringToUnion(v.trim().toLowerCase(), BULK_UPLOAD_RESULTS_TABS);
|
|
40
40
|
const MISSING_RECEIPTS_TABS = ['missing', 'completed', 'unmatched'];
|
|
41
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
42
|
const MATCH_SOURCES = ['ai', 'manual'];
|
|
45
43
|
export const toMatchSource = (v) => stringToUnion(v.trim().toLowerCase(), MATCH_SOURCES);
|
|
46
44
|
const BULK_UPLOAD_SORT_KEYS = [
|
|
@@ -2,6 +2,7 @@ import { createSelector } from '@reduxjs/toolkit';
|
|
|
2
2
|
import { stripCompareAdditionalBalanceTypes } from '../../commonStateTypes/coaBalance/coaBalanceType';
|
|
3
3
|
import { newBalancesFilter, newBalancesFilterForDateRange, } from '../../commonStateTypes/coaBalance/coaBalancesFilter';
|
|
4
4
|
import { newBalancesFilterClassesView } from '../../commonStateTypes/coaBalance/coaBalancesFilterClassesView';
|
|
5
|
+
import { newBalancesFilterProjectView } from '../../commonStateTypes/coaBalance/coaBalancesFilterProjectView';
|
|
5
6
|
import { getNumberOfPeriods, } from '../../commonStateTypes/dataAvailable';
|
|
6
7
|
import { reduceAnyCompletedFetchState } from '../../commonStateTypes/reduceFetchState';
|
|
7
8
|
import { toTimeframeTick, } from '../../commonStateTypes/timeframeTick';
|
|
@@ -9,7 +10,6 @@ import { extractThisPeriod } from '../../commonStateTypes/viewAndReport/thisPeri
|
|
|
9
10
|
import { getBalanceSheet } from '../balanceSheet/balanceSheetSelector';
|
|
10
11
|
import { getCashFlow } from '../cashFlow/cashFlowSelector';
|
|
11
12
|
import { getProfitAndLossReport, } from '../profitAndLoss/profitAndLossSelector';
|
|
12
|
-
import { newBalancesFilterProjectView } from '../../commonStateTypes/coaBalance/coaBalancesFilterProjectView';
|
|
13
13
|
import { getProfitAndLossClassesHorizontalView } from '../profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector';
|
|
14
14
|
import { getProfitAndLossClassesView } from '../profitAndLossClassesView/profitAndLossClassesViewSelector';
|
|
15
15
|
import { getProfitAndLossProjectView } from '../profitAndLossProjectView/profitAndLossProjectViewSelector';
|