@zeniai/client-epic-state 5.0.79 → 5.0.80
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 -27
- package/lib/entity/account/accountSelector.js +1 -47
- package/lib/entity/account/accountState.d.ts +1 -6
- package/lib/entity/account/accountState.js +4 -11
- 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/class/classSelector.d.ts +0 -35
- package/lib/entity/class/classSelector.js +0 -50
- 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 +11 -11
- package/lib/epic.js +12 -12
- package/lib/esm/coreEpics.js +1 -1
- package/lib/esm/entity/account/accountSelector.js +1 -46
- package/lib/esm/entity/account/accountState.js +1 -7
- 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/class/classSelector.js +0 -48
- 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 +12 -12
- package/lib/esm/index.js +21 -31
- 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/companyHealthMetricView/companyHealthMetricViewSelector.js +1 -1
- package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
- package/lib/esm/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +1 -1
- package/lib/esm/view/companyView/helpers/cockpitHelpers.js +1 -1
- package/lib/esm/view/companyView/selector/companyManagementViewSelector.js +1 -1
- package/lib/esm/view/companyView/selector/companyPortfolioViewSelector.js +1 -1
- package/lib/esm/view/creditAgentView/creditAgentViewReducer.js +16 -1
- package/lib/esm/view/creditAgentView/epics/fetchCreditAgentAccessEpic.js +13 -0
- 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/helpers/transactionCategorizationLocalDataHelper.js +1 -21
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +1 -2
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +14 -253
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +13 -147
- package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +2 -0
- package/lib/esm/view/financeStatement/financeStatementSelector.js +1 -1
- package/lib/esm/view/recommendation/recommendationHelper.js +0 -29
- package/lib/esm/view/recommendation/recommendationReducer.js +1 -26
- 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/spendManagement/spendManagementFilterHelpers.js +2 -4
- package/lib/esm/view/subscriptionView/subscriptionViewSelector.js +1 -1
- 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/taskManager/taskListView/taskListReducer.js +1 -1
- package/lib/esm/view/transactionDetail/transactionDetailReducer.js +6 -121
- package/lib/esm/view/transactionDetail/transactionDetailSelector.js +1 -29
- package/lib/index.d.ts +24 -31
- package/lib/index.js +60 -84
- 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/companyHealthMetricView/companyHealthMetricViewSelector.js +1 -1
- package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.d.ts +1 -1
- package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.js +1 -1
- package/lib/view/companyView/helpers/cockpitHelpers.js +1 -1
- package/lib/view/companyView/selector/companyManagementViewSelector.js +1 -1
- package/lib/view/companyView/selector/companyPortfolioViewSelector.js +1 -1
- package/lib/view/companyView/types/cockpitTypes.d.ts +1 -1
- package/lib/view/creditAgentView/creditAgentViewPayload.d.ts +3 -0
- package/lib/view/creditAgentView/creditAgentViewReducer.d.ts +1 -1
- package/lib/view/creditAgentView/creditAgentViewReducer.js +17 -2
- package/lib/view/creditAgentView/creditAgentViewState.d.ts +5 -0
- package/lib/view/creditAgentView/epics/fetchCreditAgentAccessEpic.d.ts +11 -0
- package/lib/view/creditAgentView/epics/fetchCreditAgentAccessEpic.js +17 -0
- 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 -2
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -23
- 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 +5 -28
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +14 -253
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +1 -2
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +0 -16
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.d.ts +1 -7
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +13 -150
- 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 -44
- package/lib/view/financeStatement/financeStatementSelector.js +1 -1
- package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.d.ts +1 -1
- package/lib/view/recommendation/recommendationHelper.d.ts +0 -9
- package/lib/view/recommendation/recommendationHelper.js +1 -31
- package/lib/view/recommendation/recommendationReducer.d.ts +1 -20
- package/lib/view/recommendation/recommendationReducer.js +2 -27
- package/lib/view/spendManagement/billPay/billList/billListState.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/chargeCardPaymentHistory.d.ts +1 -1
- 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/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
- package/lib/view/spendManagement/spendManagementFilterHelpers.d.ts +3 -12
- package/lib/view/spendManagement/spendManagementFilterHelpers.js +2 -4
- package/lib/view/subscriptionView/subscriptionViewSelector.js +1 -1
- package/lib/view/taskManager/taskListView/taskList.d.ts +1 -1
- package/lib/view/taskManager/taskListView/taskListReducer.js +1 -1
- package/lib/view/transactionDetail/transactionDetailReducer.d.ts +1 -11
- package/lib/view/transactionDetail/transactionDetailReducer.js +7 -122
- package/lib/view/transactionDetail/transactionDetailSelector.d.ts +0 -2
- package/lib/view/transactionDetail/transactionDetailSelector.js +2 -31
- package/lib/view/transactionDetail/transactionDetailTypes.d.ts +0 -1
- 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/filterPrimitives.d.ts +0 -23
- package/lib/commonStateTypes/filterPrimitives.js +0 -21
- 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/filterPrimitives.js +0 -20
- package/lib/esm/commonStateTypes/pusherActions.js +0 -3
- package/lib/esm/view/expenseAutomationView/transactionFilterHelpers.js +0 -258
- package/lib/esm/view/expenseAutomationView/types/completedSubTab.js +0 -17
- package/lib/esm/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.js +0 -87
- package/lib/view/expenseAutomationView/transactionFilterHelpers.d.ts +0 -66
- package/lib/view/expenseAutomationView/transactionFilterHelpers.js +0 -262
- package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +0 -10
- package/lib/view/expenseAutomationView/types/completedSubTab.js +0 -21
- package/lib/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.d.ts +0 -9
- package/lib/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.js +0 -91
|
@@ -3,97 +3,21 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.toTransactionView = exports.getCategorizationHasInFlightRecommendations = exports.getCategorizationInFlightRecommendationsByTransactionId = void 0;
|
|
7
6
|
exports.getExpenseAutomationTransactionView = getExpenseAutomationTransactionView;
|
|
8
|
-
const toolkit_1 = require("@reduxjs/toolkit");
|
|
9
7
|
const omit_1 = __importDefault(require("lodash/omit"));
|
|
10
8
|
const reduceFetchState_1 = require("../../../commonStateTypes/reduceFetchState");
|
|
11
9
|
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
12
10
|
const tenantSelector_1 = require("../../../entity/tenant/tenantSelector");
|
|
13
11
|
const transactionHelper_1 = require("../../../entity/transaction/transactionHelper");
|
|
14
12
|
const transactionSelector_1 = require("../../../entity/transaction/transactionSelector");
|
|
15
|
-
const transactionFilterHelpers_1 = require("../transactionFilterHelpers");
|
|
16
13
|
const accountListSelector_1 = require("../../accountList/accountListSelector");
|
|
17
14
|
const classListSelector_1 = require("../../classList/classListSelector");
|
|
18
15
|
const projectListSelector_1 = require("../../projectList/projectListSelector");
|
|
19
16
|
const expenseAutomationViewSelectorTypes_1 = require("../selectorTypes/expenseAutomationViewSelectorTypes");
|
|
20
|
-
// Walks the tab's transactionReviewLocalDataById map and returns
|
|
21
|
-
// `{ [transactionId]: true }` for every transaction that has at least
|
|
22
|
-
// one line whose targeted-fetch is In-Progress. Pulled out as a plain
|
|
23
|
-
// function so each tab's createSelector can share it.
|
|
24
|
-
const computeCategorizationInFlightRecommendations = (transactionReviewLocalDataById) => {
|
|
25
|
-
const result = {};
|
|
26
|
-
if (transactionReviewLocalDataById == null) {
|
|
27
|
-
return result;
|
|
28
|
-
}
|
|
29
|
-
for (const [transactionId, data] of Object.entries(transactionReviewLocalDataById)) {
|
|
30
|
-
const lineItems = Object.values(data.transactionReviewLocalData.lineItemById);
|
|
31
|
-
if (lineItems.some((lineItem) => lineItem.categoryClassRecommendationsFetchState?.fetchState ===
|
|
32
|
-
'In-Progress')) {
|
|
33
|
-
result[transactionId] = true;
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
return result;
|
|
37
|
-
};
|
|
38
|
-
// Per-tab createSelector instances. Each one is memoized on its OWN tab's
|
|
39
|
-
// transactionReviewLocalDataById reference. Switching tabs A->B->A no
|
|
40
|
-
// longer busts the memo for tab A — the dispatcher below just returns
|
|
41
|
-
// whichever per-tab selector matches the active tab, and reselect keeps
|
|
42
|
-
// the prior result alive as long as the underlying slice ref is stable.
|
|
43
|
-
const getReviewInFlightRecommendationsByTransactionId = (0, toolkit_1.createSelector)((state) => state.expenseAutomationTransactionsViewState.transactionCategorizationView
|
|
44
|
-
.review.transactionReviewLocalDataById, computeCategorizationInFlightRecommendations);
|
|
45
|
-
const getAutoCategorizedInFlightRecommendationsByTransactionId = (0, toolkit_1.createSelector)((state) => state.expenseAutomationTransactionsViewState.transactionCategorizationView
|
|
46
|
-
.autoCategorized.transactionReviewLocalDataById, computeCategorizationInFlightRecommendations);
|
|
47
|
-
// Per-transaction "any line is fetching category/class recommendations?"
|
|
48
|
-
// map for the active categorization tab. Dispatches to the per-tab
|
|
49
|
-
// memoized selector above so steady state (no fetches in flight)
|
|
50
|
-
// recomputes only when the active tab's local data changes; tab switches
|
|
51
|
-
// are O(1) cache lookups.
|
|
52
|
-
//
|
|
53
|
-
// `default` guards against the union "lying" at runtime: `TransactionsTab`
|
|
54
|
-
// is produced via `stringToUnion`, which falls back to `s as StringUnion`
|
|
55
|
-
// for unrecognized strings, so an unexpected value can land in state. The
|
|
56
|
-
// downstream `getCategorizationHasInFlightRecommendations` calls
|
|
57
|
-
// `Object.keys` on this result, so we must always return an object.
|
|
58
|
-
const getCategorizationInFlightRecommendationsByTransactionId = (state) => {
|
|
59
|
-
const tab = state.expenseAutomationTransactionsViewState
|
|
60
|
-
.selectedTransactionCategorizationTab;
|
|
61
|
-
switch (tab) {
|
|
62
|
-
case 'review':
|
|
63
|
-
return getReviewInFlightRecommendationsByTransactionId(state);
|
|
64
|
-
case 'autoCategorized':
|
|
65
|
-
return getAutoCategorizedInFlightRecommendationsByTransactionId(state);
|
|
66
|
-
default:
|
|
67
|
-
return {};
|
|
68
|
-
}
|
|
69
|
-
};
|
|
70
|
-
exports.getCategorizationInFlightRecommendationsByTransactionId = getCategorizationInFlightRecommendationsByTransactionId;
|
|
71
|
-
// Page-level "any line on the active tab is in flight?" flag. Drives the
|
|
72
|
-
// list-page Save disable.
|
|
73
|
-
exports.getCategorizationHasInFlightRecommendations = (0, toolkit_1.createSelector)(exports.getCategorizationInFlightRecommendationsByTransactionId, (inFlightByTransactionId) => Object.keys(inFlightByTransactionId).length > 0);
|
|
74
|
-
const toTransactionView = (transaction, transactionLocalData) => {
|
|
75
|
-
return {
|
|
76
|
-
id: transaction.id,
|
|
77
|
-
date: transaction.date,
|
|
78
|
-
amount: transaction.amount,
|
|
79
|
-
vendorName: transaction.vendorName,
|
|
80
|
-
customerName: transaction.customerName,
|
|
81
|
-
vendorId: transaction.vendorId,
|
|
82
|
-
customerId: transaction.customerId,
|
|
83
|
-
description: transaction.description,
|
|
84
|
-
memo: transaction.memo,
|
|
85
|
-
type: transaction.type,
|
|
86
|
-
typeName: transaction.typeName,
|
|
87
|
-
createTime: transaction.createTime,
|
|
88
|
-
transaction: transaction,
|
|
89
|
-
transactionLocalData,
|
|
90
|
-
};
|
|
91
|
-
};
|
|
92
|
-
exports.toTransactionView = toTransactionView;
|
|
93
17
|
function getExpenseAutomationTransactionView(state) {
|
|
94
18
|
const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, projectState, projectListState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
|
|
95
|
-
const {
|
|
96
|
-
const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId,
|
|
19
|
+
const { selectedTransactionCategorizationTab } = expenseAutomationTransactionsViewState;
|
|
20
|
+
const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
|
|
97
21
|
const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(accountState, accountListState, 'accountList');
|
|
98
22
|
const accountList = (0, accountListSelector_1.getAccountList)(accountState, accountListState, 'accountList');
|
|
99
23
|
const classList = (0, classListSelector_1.getClassList)(classState, classListState);
|
|
@@ -112,58 +36,20 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
112
36
|
? transactionIdsBySelectedPeriod[monthYearPeriodId]
|
|
113
37
|
: null;
|
|
114
38
|
const transactionIds = transactionIdsForSelectedPeriod ?? [];
|
|
115
|
-
const
|
|
116
|
-
|
|
117
|
-
const transactionLocalDataMap = new Map();
|
|
118
|
-
transactionIds.forEach((transactionId) => {
|
|
39
|
+
const transactionLocalData = transactionIds
|
|
40
|
+
.map((transactionId) => {
|
|
119
41
|
const transactionData = transactionReviewLocalDataById[transactionId];
|
|
120
42
|
if (transactionData != null) {
|
|
121
|
-
|
|
43
|
+
return {
|
|
122
44
|
transactionId,
|
|
123
45
|
transactionReviewLocalData: transactionData.transactionReviewLocalData,
|
|
124
|
-
}
|
|
125
|
-
}
|
|
126
|
-
});
|
|
127
|
-
// Step 2: Convert to TransactionView and apply advanced filters
|
|
128
|
-
const transactionViews = transactionsWithCOT.map((transaction) => {
|
|
129
|
-
const localData = transactionLocalDataMap.get(transaction.id);
|
|
130
|
-
return (0, exports.toTransactionView)(transaction, localData);
|
|
131
|
-
});
|
|
132
|
-
// Apply TC-specific filters (lives under expenseAutomationView, independent
|
|
133
|
-
// of the Spend Management filter pipeline).
|
|
134
|
-
const filteredTransactionViews = (0, transactionFilterHelpers_1.applyTransactionFilters)(transactionViews, filters);
|
|
135
|
-
// Convert back to TransactionWithCOT for return
|
|
136
|
-
const filteredTransactionsWithCOT = filteredTransactionViews.map((view) => view.transaction);
|
|
137
|
-
// Get transactionLocalData for filtered transactions
|
|
138
|
-
// Also include transactionLocalData for transactions that don't exist in transactionState
|
|
139
|
-
// but have local data (to match original behavior)
|
|
140
|
-
const filteredTransactionIds = new Set(filteredTransactionViews.map((view) => view.id));
|
|
141
|
-
// Pre-compute the membership set once. The previous implementation called
|
|
142
|
-
// `transactions.some(t => t.id === transactionId)` inside the per-id loop,
|
|
143
|
-
// turning the pipeline into O(n × m) — measurable on tenants with large
|
|
144
|
-
// transaction lists since this selector runs on every Redux dispatch.
|
|
145
|
-
const transactionExistsById = new Set(transactions.map((t) => t.id));
|
|
146
|
-
// `.flatMap` returns `X[]` directly when the callback returns `[]` for the
|
|
147
|
-
// skip case, so we don't need the trailing `.filter((d): d is X => …)` type
|
|
148
|
-
// predicate that the previous `map → filter` pipeline required.
|
|
149
|
-
const filteredTransactionLocalData = transactionIds.flatMap((transactionId) => {
|
|
150
|
-
const transactionData = transactionReviewLocalDataById[transactionId];
|
|
151
|
-
if (transactionData == null) {
|
|
152
|
-
return [];
|
|
153
|
-
}
|
|
154
|
-
// Include if transaction is in filtered results, or if transaction doesn't exist in state
|
|
155
|
-
// (to maintain backward compatibility with tests)
|
|
156
|
-
const transactionExists = transactionExistsById.has(transactionId);
|
|
157
|
-
if (filteredTransactionIds.has(transactionId) || !transactionExists) {
|
|
158
|
-
return [
|
|
159
|
-
{
|
|
160
|
-
transactionId,
|
|
161
|
-
transactionReviewLocalData: transactionData.transactionReviewLocalData,
|
|
162
|
-
},
|
|
163
|
-
];
|
|
46
|
+
};
|
|
164
47
|
}
|
|
165
|
-
return
|
|
166
|
-
})
|
|
48
|
+
return null;
|
|
49
|
+
})
|
|
50
|
+
.filter((transaction) => transaction != null);
|
|
51
|
+
const transactions = (0, transactionSelector_1.getSupportedTransactionsByIds)(transactionState, transactionIds);
|
|
52
|
+
const transactionsWithCOT = transactions.map((transaction) => (0, transactionHelper_1.getTransactionWithCOT)(transaction));
|
|
167
53
|
const monthEndFetchState = monthYearPeriodId != null
|
|
168
54
|
? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
|
|
169
55
|
: { fetchState: 'Not-Started', error: undefined };
|
|
@@ -183,27 +69,10 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
183
69
|
.uiState.totalCount;
|
|
184
70
|
const totalCountByAutoCat = expenseAutomationTransactionsViewState.transactionCategorizationView
|
|
185
71
|
.autoCategorized.uiState.totalCount;
|
|
186
|
-
// Per-(sub-)tab counts powering pagination, in-list "showing X of Y", and
|
|
187
|
-
// any save/refresh round-trips. Sourced from `uiState.totalCount` which
|
|
188
|
-
// mirrors the response's `total_count` for whatever tab/sub-tab the user is
|
|
189
|
-
// viewing (e.g. only the Manual sub-tab rows for Completed → Manual).
|
|
190
72
|
const totalCountByTab = {
|
|
191
73
|
review: monthYearPeriodId != null ? totalCountByReview[monthYearPeriodId] : 0,
|
|
192
74
|
autoCategorized: monthYearPeriodId != null ? totalCountByAutoCat[monthYearPeriodId] : 0,
|
|
193
75
|
};
|
|
194
|
-
// Parent-tab badge counts. Sourced from `parent_tab_total_count` in the
|
|
195
|
-
// listing response and used exclusively by the navbar / tab strip badges.
|
|
196
|
-
// Independent of which Completed sub-tab is active so the badge stays
|
|
197
|
-
// stable across sub-tab switches.
|
|
198
|
-
const parentTotalCountByTab = expenseAutomationTransactionsViewState.parentTotalCountByTab;
|
|
199
|
-
const parentTabTotalCountByTab = {
|
|
200
|
-
review: monthYearPeriodId != null
|
|
201
|
-
? (parentTotalCountByTab.review[monthYearPeriodId] ?? 0)
|
|
202
|
-
: 0,
|
|
203
|
-
autoCategorized: monthYearPeriodId != null
|
|
204
|
-
? (parentTotalCountByTab.autoCategorized[monthYearPeriodId] ?? 0)
|
|
205
|
-
: 0,
|
|
206
|
-
};
|
|
207
76
|
const fetchStateByTab = {
|
|
208
77
|
review: {
|
|
209
78
|
fetchState: expenseAutomationTransactionsViewState.transactionCategorizationView
|
|
@@ -223,13 +92,11 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
223
92
|
: [];
|
|
224
93
|
const transactionCompletionStatus = allSteps.find((step) => step.step === 'transaction_categorization')?.completionStatus;
|
|
225
94
|
const completionStatus = transactionCompletionStatus ?? 'incomplete';
|
|
226
|
-
const inFlightCategoryClassRecommendationsByTransactionId = (0, exports.getCategorizationInFlightRecommendationsByTransactionId)(state);
|
|
227
|
-
const hasInFlightCategoryClassRecommendations = (0, exports.getCategorizationHasInFlightRecommendations)(state);
|
|
228
95
|
return {
|
|
229
96
|
version: 0,
|
|
230
97
|
fetchState: fetchStatus.fetchState,
|
|
231
98
|
error: fetchStatus.error,
|
|
232
|
-
transactions:
|
|
99
|
+
transactions: transactionsWithCOT,
|
|
233
100
|
selectedCheckBoxTransactionIds,
|
|
234
101
|
transactionIdsWithUnsavedData,
|
|
235
102
|
uncategorizedAccounts: uncategorizedIncomeExpense,
|
|
@@ -238,22 +105,18 @@ function getExpenseAutomationTransactionView(state) {
|
|
|
238
105
|
classList: allClasses,
|
|
239
106
|
accountsHierarchyList,
|
|
240
107
|
classHierarchyList,
|
|
241
|
-
hasInFlightCategoryClassRecommendations,
|
|
242
|
-
inFlightCategoryClassRecommendationsByTransactionId,
|
|
243
108
|
isAccountingProjectsEnabled,
|
|
244
109
|
projectList,
|
|
245
|
-
transactionLocalData
|
|
110
|
+
transactionLocalData,
|
|
246
111
|
uiState,
|
|
247
112
|
refreshStatus,
|
|
248
113
|
saveStatus,
|
|
249
114
|
markAsNotMiscategorizedStatus,
|
|
250
115
|
completionStatus,
|
|
251
116
|
totalCountByTab,
|
|
252
|
-
parentTabTotalCountByTab,
|
|
253
117
|
fetchStateByTransactionTabs: fetchStateByTab,
|
|
254
118
|
uploadReceiptStatusById,
|
|
255
119
|
selectedTransactionId,
|
|
256
120
|
selectedTransactionLineId,
|
|
257
|
-
selectedTransactionCategorizationCompletedSubTab,
|
|
258
121
|
};
|
|
259
122
|
}
|
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
|
|
2
2
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
3
3
|
import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
4
|
-
import { CompletedSubTab } from './completedSubTab';
|
|
5
4
|
export declare const toMissingReceiptsSortKey: (v: string) => "date" | "amount" | "vendor" | "category" | "class";
|
|
6
5
|
export type MissingReceiptsSortKey = ReturnType<typeof toMissingReceiptsSortKey>;
|
|
7
6
|
export interface MissingReceiptsViewUIState {
|
|
@@ -32,6 +31,8 @@ export declare const toBulkUploadResultsTab: (v: string) => "completed" | "unmat
|
|
|
32
31
|
export type BulkUploadResultsTab = ReturnType<typeof toBulkUploadResultsTab>;
|
|
33
32
|
export declare const toMissingReceiptsTab: (v: string) => "completed" | "unmatched" | "missing";
|
|
34
33
|
export type MissingReceiptsTab = ReturnType<typeof toMissingReceiptsTab>;
|
|
34
|
+
export declare const toCompletedSubTab: (v: string) => "all" | "manual" | "ai_accountant";
|
|
35
|
+
export type CompletedSubTab = ReturnType<typeof toCompletedSubTab>;
|
|
35
36
|
export declare const toMatchSource: (v: string) => "manual" | "ai";
|
|
36
37
|
export type MatchSource = ReturnType<typeof toMatchSource>;
|
|
37
38
|
export declare const toBulkUploadSortKey: (v: string) => "date" | "amount" | "vendor" | "category" | "class";
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toBulkUploadSortKey = exports.toMatchSource = exports.toMissingReceiptsTab = exports.toBulkUploadResultsTab = exports.toBulkUploadPhase = exports.toBatchFileStatus = exports.BATCH_FILE_STATUSES = exports.toBatchStatusValue = exports.MIN_MANUAL_TRANSACTION_SEARCH_LENGTH = exports.toMissingReceiptsSortKey = void 0;
|
|
3
|
+
exports.toBulkUploadSortKey = exports.toMatchSource = exports.toCompletedSubTab = exports.toMissingReceiptsTab = exports.toBulkUploadResultsTab = exports.toBulkUploadPhase = exports.toBatchFileStatus = exports.BATCH_FILE_STATUSES = exports.toBatchStatusValue = exports.MIN_MANUAL_TRANSACTION_SEARCH_LENGTH = exports.toMissingReceiptsSortKey = void 0;
|
|
4
4
|
exports.isUnmatchedTabFileStatus = isUnmatchedTabFileStatus;
|
|
5
5
|
const stringToUnion_1 = require("../../../commonStateTypes/stringToUnion");
|
|
6
6
|
const MISSING_RECEIPTS_SORT_KEYS = [
|
|
@@ -49,6 +49,9 @@ exports.toBulkUploadResultsTab = toBulkUploadResultsTab;
|
|
|
49
49
|
const MISSING_RECEIPTS_TABS = ['missing', 'completed', 'unmatched'];
|
|
50
50
|
const toMissingReceiptsTab = (v) => (0, stringToUnion_1.stringToUnion)(v.trim().toLowerCase(), MISSING_RECEIPTS_TABS);
|
|
51
51
|
exports.toMissingReceiptsTab = toMissingReceiptsTab;
|
|
52
|
+
const COMPLETED_SUB_TABS = ['all', 'ai_accountant', 'manual'];
|
|
53
|
+
const toCompletedSubTab = (v) => (0, stringToUnion_1.stringToUnion)(v.trim().toLowerCase(), COMPLETED_SUB_TABS);
|
|
54
|
+
exports.toCompletedSubTab = toCompletedSubTab;
|
|
52
55
|
const MATCH_SOURCES = ['ai', 'manual'];
|
|
53
56
|
const toMatchSource = (v) => (0, stringToUnion_1.stringToUnion)(v.trim().toLowerCase(), MATCH_SOURCES);
|
|
54
57
|
exports.toMatchSource = toMatchSource;
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { Amount } from '../../../commonStateTypes/amount';
|
|
2
|
-
import {
|
|
2
|
+
import { FetchStateAndError, FetchedState, ID } from '../../../commonStateTypes/common';
|
|
3
3
|
import { Recommendation, RecommendationWithCOT } from '../../../commonStateTypes/recommendationBase';
|
|
4
4
|
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
5
5
|
import { MonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
@@ -7,18 +7,15 @@ import { PageToken } from '../../../commonStateTypes/viewAndReport/viewAndReport
|
|
|
7
7
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
8
8
|
import { ClassBase } from '../../../entity/class/classState';
|
|
9
9
|
import { CustomerBase } from '../../../entity/customer/customerState';
|
|
10
|
-
import { Entity, EntityType } from '../../../entity/genericEntity/entity';
|
|
11
10
|
import { ProjectBase } from '../../../entity/project/projectState';
|
|
11
|
+
import { Entity, EntityType } from '../../../entity/genericEntity/entity';
|
|
12
12
|
import { TransactionID } from '../../../entity/transaction/stateTypes/transaction';
|
|
13
13
|
import { BillableStatus, CategorizationStatusType, PlatformLineDetailType, ProductOrService, TransactionLineBase } from '../../../entity/transaction/stateTypes/transactionLine';
|
|
14
14
|
import { TransactionCategory, TransactionType } from '../../../entity/transaction/stateTypes/transactionType';
|
|
15
15
|
import { VendorBase } from '../../../entity/vendor/vendorState';
|
|
16
|
-
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
17
16
|
import { ZeniDate } from '../../../zeniDayJS';
|
|
18
17
|
import { EntityRecommendationKey } from '../../recommendation/recommendationState';
|
|
19
|
-
import { TransactionFilters } from '../transactionFilterHelpers';
|
|
20
18
|
import { TransactionDetailKey } from '../../transactionDetail/transactionDetailState';
|
|
21
|
-
import { CompletedSubTab } from './completedSubTab';
|
|
22
19
|
export declare const toTransactionsSortKey: (v: string) => "date" | "amount" | "vendor" | "project" | "category" | "class" | "payment_account" | "transaction_type" | "memo_and_receipt";
|
|
23
20
|
export type TransactionsSortKey = ReturnType<typeof toTransactionsSortKey>;
|
|
24
21
|
export declare const TRANSACTIONS_TABS: readonly ["review", "autoCategorized"];
|
|
@@ -49,7 +46,6 @@ export interface TransactionCategorizationLineItemData extends TransactionLineBa
|
|
|
49
46
|
transactionId: ID;
|
|
50
47
|
account?: AccountBase;
|
|
51
48
|
categorizationStatus?: CategorizationStatusType;
|
|
52
|
-
categoryClassRecommendationsFetchState?: FetchStateAndError;
|
|
53
49
|
class?: ClassBase;
|
|
54
50
|
customer?: CustomerBase;
|
|
55
51
|
item?: ProductOrService;
|
|
@@ -95,7 +91,6 @@ export interface SupportedTransactionCategorization {
|
|
|
95
91
|
}
|
|
96
92
|
export declare const initialSupportedTransactionCategorization: SupportedTransactionCategorization;
|
|
97
93
|
export interface TransactionsTabViewState extends FetchedState {
|
|
98
|
-
filters: TransactionFilters;
|
|
99
94
|
markAsNotMiscategorizedStatus: FetchStateAndError;
|
|
100
95
|
refreshStatus: FetchStateAndError;
|
|
101
96
|
saveStatus: FetchStateAndError;
|
|
@@ -108,44 +103,7 @@ export interface TransactionsTabViewState extends FetchedState {
|
|
|
108
103
|
selectedTransactionId?: ID;
|
|
109
104
|
selectedTransactionLineId?: ID;
|
|
110
105
|
}
|
|
111
|
-
/**
|
|
112
|
-
* Snapshot of the autoCategorized tab's paginated dataset for a single
|
|
113
|
-
* Completed sub-tab. Stored in {@link TransactionsViewState.autoCategorizedSubTabCache}
|
|
114
|
-
* so revisiting an already-loaded sub-tab can short-circuit the fetch epic
|
|
115
|
-
* (mirrors parent-tab caching). The snapshot is period-spanning — both the
|
|
116
|
-
* `totalCount` map and `transactionIdsBySelectedPeriod` map preserve every
|
|
117
|
-
* period the user has paged through under that sub-tab.
|
|
118
|
-
*
|
|
119
|
-
* `scrollPosition` is captured per sub-tab so revisiting a sub-tab restores
|
|
120
|
-
* the user's last scroll offset; switching to a fresh / never-visited sub-tab
|
|
121
|
-
* starts at the top instead of inheriting the previous sub-tab's offset.
|
|
122
|
-
*/
|
|
123
|
-
export interface AutoCategorizedSubTabSnapshot {
|
|
124
|
-
error: ZeniAPIStatus | undefined;
|
|
125
|
-
fetchState: FetchState;
|
|
126
|
-
pageToken: PageToken;
|
|
127
|
-
scrollPosition: TransactionsViewUIState['scrollPosition'];
|
|
128
|
-
totalCount: Record<MonthYearPeriodId, number>;
|
|
129
|
-
transactionIdsBySelectedPeriod: Record<MonthYearPeriodId, ID[]>;
|
|
130
|
-
}
|
|
131
106
|
export type TransactionsViewState = {
|
|
132
|
-
/**
|
|
133
|
-
* Per-sub-tab snapshot cache for the Completed (autoCategorized) tab. Keyed
|
|
134
|
-
* by {@link CompletedSubTab}. Populated as the user navigates between
|
|
135
|
-
* sub-tabs and consulted on every switch — the active autoCategorized slot
|
|
136
|
-
* is restored from here when a snapshot exists, otherwise it is reset and
|
|
137
|
-
* the fetch epic loads page 1 fresh.
|
|
138
|
-
*/
|
|
139
|
-
autoCategorizedSubTabCache: Partial<Record<CompletedSubTab, AutoCategorizedSubTabSnapshot>>;
|
|
140
|
-
/**
|
|
141
|
-
* Period-keyed parent tab counts, scoped per {@link TransactionsTab}.
|
|
142
|
-
* Sourced from the listing response's `parent_tab_total_count` and used
|
|
143
|
-
* exclusively to drive the parent tab badges on the UI — every other
|
|
144
|
-
* count consumer (pagination, sub-tab chips, in-tab "showing X of Y")
|
|
145
|
-
* keeps reading from {@link TransactionsViewUIState.totalCount}.
|
|
146
|
-
*/
|
|
147
|
-
parentTotalCountByTab: Record<TransactionsTab, Record<MonthYearPeriodId, number>>;
|
|
148
|
-
selectedTransactionCategorizationCompletedSubTab: CompletedSubTab;
|
|
149
107
|
selectedTransactionCategorizationTab: TransactionsTab;
|
|
150
108
|
transactionCategorizationView: Record<TransactionsTab, TransactionsTabViewState>;
|
|
151
109
|
};
|
|
@@ -5,7 +5,6 @@ const toolkit_1 = require("@reduxjs/toolkit");
|
|
|
5
5
|
const coaBalanceType_1 = require("../../commonStateTypes/coaBalance/coaBalanceType");
|
|
6
6
|
const coaBalancesFilter_1 = require("../../commonStateTypes/coaBalance/coaBalancesFilter");
|
|
7
7
|
const coaBalancesFilterClassesView_1 = require("../../commonStateTypes/coaBalance/coaBalancesFilterClassesView");
|
|
8
|
-
const coaBalancesFilterProjectView_1 = require("../../commonStateTypes/coaBalance/coaBalancesFilterProjectView");
|
|
9
8
|
const dataAvailable_1 = require("../../commonStateTypes/dataAvailable");
|
|
10
9
|
const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
|
|
11
10
|
const timeframeTick_1 = require("../../commonStateTypes/timeframeTick");
|
|
@@ -13,6 +12,7 @@ const thisPeriodHelpers_1 = require("../../commonStateTypes/viewAndReport/thisPe
|
|
|
13
12
|
const balanceSheetSelector_1 = require("../balanceSheet/balanceSheetSelector");
|
|
14
13
|
const cashFlowSelector_1 = require("../cashFlow/cashFlowSelector");
|
|
15
14
|
const profitAndLossSelector_1 = require("../profitAndLoss/profitAndLossSelector");
|
|
15
|
+
const coaBalancesFilterProjectView_1 = require("../../commonStateTypes/coaBalance/coaBalancesFilterProjectView");
|
|
16
16
|
const profitAndLossClassesByClassHorizontalSelector_1 = require("../profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector");
|
|
17
17
|
const profitAndLossClassesViewSelector_1 = require("../profitAndLossClassesView/profitAndLossClassesViewSelector");
|
|
18
18
|
const profitAndLossProjectViewSelector_1 = require("../profitAndLossProjectView/profitAndLossProjectViewSelector");
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
+
import { SectionProjectViewReport } from '../../entity/sectionProjectView/sectionProjectViewSelectorTypes';
|
|
1
2
|
import { COABalancesFilterProjectView } from '../../commonStateTypes/coaBalance/coaBalancesFilterProjectView';
|
|
2
3
|
import { ID } from '../../commonStateTypes/common';
|
|
3
4
|
import { DataAvailable } from '../../commonStateTypes/dataAvailable';
|
|
4
5
|
import { CalculatedSection } from '../../commonStateTypes/selectorTypes/selectorTypes';
|
|
5
6
|
import { SelectorReport } from '../../commonStateTypes/viewAndReport/viewAndReport';
|
|
6
7
|
import { Project } from '../../entity/project/projectState';
|
|
7
|
-
import { SectionProjectViewReport } from '../../entity/sectionProjectView/sectionProjectViewSelectorTypes';
|
|
8
8
|
import { PandLReportViewCalculatedSectionID, PandLReportViewSectionID } from '../profitAndLossClassesView/profitAndLossClassesViewSelectorTypes';
|
|
9
9
|
import { ProfitAndLossProjectViewUIState } from './profitAndLossProjectViewState';
|
|
10
10
|
export interface ProfitAndLossProjectViewReport extends SelectorReport {
|
|
@@ -1,17 +1,8 @@
|
|
|
1
1
|
import { RecommendationPayload, RecommendationPayloadWithCOT } from '../../commonPayloadTypes/recommendationPayload';
|
|
2
2
|
import { ID } from '../../commonStateTypes/common';
|
|
3
3
|
import { Recommendation, RecommendationWithCOT } from '../../commonStateTypes/recommendationBase';
|
|
4
|
-
import { Entity } from '../../entity/genericEntity/entity';
|
|
5
4
|
import { RecommendationByLineId, RecommendationWithCOTByLineId } from '../../entity/transaction/stateTypes/transaction';
|
|
6
|
-
import { SupportedTransaction } from '../../entity/transaction/transactionState';
|
|
7
5
|
export declare const getRecommendationFromRecommendationPayload: (payload: RecommendationPayload[]) => Recommendation[] | undefined;
|
|
8
6
|
export declare const getRecommendationByLineIdFromRecommendationPayload: (recommendationPayload: RecommendationPayload[], lineIds: ID[]) => RecommendationByLineId | undefined;
|
|
9
7
|
export declare const getRecommendationWithCOTFromRecommendationPayloadWithCOT: (payload: RecommendationPayloadWithCOT[]) => RecommendationWithCOT[] | undefined;
|
|
10
|
-
export declare const buildRecommendationUrl: (accountMicroServiceBaseUrl: string, entity: Entity, amount: number, transactionDetails: {
|
|
11
|
-
lineIds: ID[];
|
|
12
|
-
transaction: SupportedTransaction;
|
|
13
|
-
transactionId: {
|
|
14
|
-
id: string;
|
|
15
|
-
};
|
|
16
|
-
}, isFetchCOT: boolean) => string;
|
|
17
8
|
export declare const getRecommendationByLineIdWithCOTFromRecommendationPayloadWithCOT: (recommendationPayload: RecommendationPayloadWithCOT[], lineIds: ID[]) => RecommendationWithCOTByLineId | undefined;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.getRecommendationByLineIdWithCOTFromRecommendationPayloadWithCOT = exports.
|
|
3
|
+
exports.getRecommendationByLineIdWithCOTFromRecommendationPayloadWithCOT = exports.getRecommendationWithCOTFromRecommendationPayloadWithCOT = exports.getRecommendationByLineIdFromRecommendationPayload = exports.getRecommendationFromRecommendationPayload = void 0;
|
|
4
4
|
const transactionPayload_1 = require("../../entity/transaction/payloadTypes/transactionPayload");
|
|
5
|
-
const transactionDetailState_1 = require("../transactionDetail/transactionDetailState");
|
|
6
5
|
const getRecommendationFromRecommendationPayload = (payload) => {
|
|
7
6
|
if (payload == null || payload.length === 0) {
|
|
8
7
|
return undefined;
|
|
@@ -44,35 +43,6 @@ const getRecommendationWithCOTFromRecommendationPayloadWithCOT = (payload) => {
|
|
|
44
43
|
return recommendations;
|
|
45
44
|
};
|
|
46
45
|
exports.getRecommendationWithCOTFromRecommendationPayloadWithCOT = getRecommendationWithCOTFromRecommendationPayloadWithCOT;
|
|
47
|
-
// Pluralized URL segment for entity types. Mirrors the legacy
|
|
48
|
-
// fetchEntityRecommendationsByTransactionIdEpic.toEntityTypeURL.
|
|
49
|
-
const toEntityTypeUrlSegment = (entityType) => `${entityType}s`;
|
|
50
|
-
// Build the recommendations URL for a single entity + transaction target.
|
|
51
|
-
// Centralizes the URL shape so the legacy
|
|
52
|
-
// fetchEntityRecommendationsByTransactionIdEpic and the new
|
|
53
|
-
// fetchEntityRecommendationsForLineUpdateEpic stay in lockstep.
|
|
54
|
-
const buildRecommendationUrl = (accountMicroServiceBaseUrl, entity, amount, transactionDetails, isFetchCOT) => {
|
|
55
|
-
const entityQuery = {
|
|
56
|
-
entity_name: entity.name,
|
|
57
|
-
entity_type: entity.type,
|
|
58
|
-
};
|
|
59
|
-
// Entity-id-null case: server expects entity_name / entity_type query
|
|
60
|
-
// instead of the {entityType}/{qboId}/recommendations path.
|
|
61
|
-
if (entity.qboId === entity.name) {
|
|
62
|
-
return `${accountMicroServiceBaseUrl}/1.0/recommendations?query=${encodeURIComponent(JSON.stringify(entityQuery))}`;
|
|
63
|
-
}
|
|
64
|
-
const query = {
|
|
65
|
-
amount,
|
|
66
|
-
transaction_id: (0, transactionDetailState_1.getActualTransactionID)(transactionDetails.transactionId.id),
|
|
67
|
-
transaction_type: transactionDetails.transaction.type,
|
|
68
|
-
line_ids: transactionDetails.lineIds,
|
|
69
|
-
};
|
|
70
|
-
if (isFetchCOT === true) {
|
|
71
|
-
query.include_cot = true;
|
|
72
|
-
}
|
|
73
|
-
return `${accountMicroServiceBaseUrl}/1.0/${toEntityTypeUrlSegment(entity.type)}/${entity.qboId}/recommendations?query=${encodeURIComponent(JSON.stringify(query))}`;
|
|
74
|
-
};
|
|
75
|
-
exports.buildRecommendationUrl = buildRecommendationUrl;
|
|
76
46
|
const getRecommendationByLineIdWithCOTFromRecommendationPayloadWithCOT = (recommendationPayload, lineIds) => {
|
|
77
47
|
if (recommendationPayload.length === 0) {
|
|
78
48
|
return undefined;
|
|
@@ -4,26 +4,7 @@ import { Entity, EntityType } from '../../entity/genericEntity/entity';
|
|
|
4
4
|
import { TransactionID } from '../../entity/transaction/stateTypes/transaction';
|
|
5
5
|
import { SupportedTransaction } from '../../entity/transaction/transactionState';
|
|
6
6
|
import { ZeniAPIStatus } from '../../responsePayload';
|
|
7
|
-
import { TransactionsTab } from '../expenseAutomationView/types/transactionsViewState';
|
|
8
7
|
import { EntityRecommendationState } from './recommendationState';
|
|
9
|
-
export type RecommendationLineUpdateFlowType = 'categorization' | 'detail';
|
|
10
|
-
type FetchEntityRecommendationsForLineUpdateCommonPayload = {
|
|
11
|
-
amount: number;
|
|
12
|
-
entity: Entity;
|
|
13
|
-
transactionDetails: {
|
|
14
|
-
lineIds: ID[];
|
|
15
|
-
transaction: SupportedTransaction;
|
|
16
|
-
transactionId: TransactionID;
|
|
17
|
-
};
|
|
18
|
-
isFetchCOT?: boolean;
|
|
19
|
-
isUncategorizedExpenseCategoryEnabled?: boolean;
|
|
20
|
-
};
|
|
21
|
-
export type FetchEntityRecommendationsForLineUpdatePayload = (FetchEntityRecommendationsForLineUpdateCommonPayload & {
|
|
22
|
-
flowType: 'categorization';
|
|
23
|
-
selectedTab: TransactionsTab;
|
|
24
|
-
}) | (FetchEntityRecommendationsForLineUpdateCommonPayload & {
|
|
25
|
-
flowType: 'detail';
|
|
26
|
-
});
|
|
27
8
|
export declare const initialState: EntityRecommendationState;
|
|
28
9
|
export declare const fetchEntityRecommendationsByTransactionId: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[entity: Entity, amount: number, transactionDetails: {
|
|
29
10
|
lineIds: ID[];
|
|
@@ -41,7 +22,7 @@ export declare const fetchEntityRecommendationsByTransactionId: import("@reduxjs
|
|
|
41
22
|
isTransactionCategorizationFlow: any;
|
|
42
23
|
isFetchCOT: any;
|
|
43
24
|
isUncategorizedExpenseCategoryEnabled: boolean | undefined;
|
|
44
|
-
}, "recommendation/fetchEntityRecommendationsByTransactionId", never, never>,
|
|
25
|
+
}, "recommendation/fetchEntityRecommendationsByTransactionId", never, never>, fetchRecommendationByEntityName: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[entityName: string, entityType: EntityType], {
|
|
45
26
|
entityName: string;
|
|
46
27
|
entityType: EntityType;
|
|
47
28
|
}, "recommendation/fetchRecommendationByEntityName", never, never>, fetchRecommendationByEntityId: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[entityId: string, entityType: EntityType], {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.clearRecommendation = exports.indicateReadyToInitializeRecommendation = exports.updateRecommendationForEntityFailure = exports.updateRecommendationForEntity = exports.fetchRecommendationByEntityId = exports.fetchRecommendationByEntityName = exports.
|
|
4
|
+
exports.clearRecommendation = exports.indicateReadyToInitializeRecommendation = exports.updateRecommendationForEntityFailure = exports.updateRecommendationForEntity = exports.fetchRecommendationByEntityId = exports.fetchRecommendationByEntityName = exports.fetchEntityRecommendationsByTransactionId = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const recommendationState_1 = require("./recommendationState");
|
|
7
7
|
exports.initialState = {
|
|
@@ -37,31 +37,6 @@ const recommendation = (0, toolkit_1.createSlice)({
|
|
|
37
37
|
};
|
|
38
38
|
},
|
|
39
39
|
},
|
|
40
|
-
// Targeted recommendations fetch fired when the user changes the
|
|
41
|
-
// payee/customer on a single transaction line (or the JE sibling set
|
|
42
|
-
// for that change). Routed by `fetchEntityRecommendationsForLineUpdateEpic`
|
|
43
|
-
// which uses groupBy + switchMap to keep fetches for distinct targets
|
|
44
|
-
// running in parallel while same-target re-fetches still cancel each
|
|
45
|
-
// other. The flowType discriminator selects the categorization vs
|
|
46
|
-
// detail slice for the per-line In-Progress / Completed / Error state.
|
|
47
|
-
fetchEntityRecommendationsForLineUpdate: {
|
|
48
|
-
reducer(draft, action) {
|
|
49
|
-
const { entity } = action.payload;
|
|
50
|
-
const key = (0, recommendationState_1.getEntityRecommendationKey)(entity.type, entity.id);
|
|
51
|
-
// Unconditional flip to In-Progress; the previous variant only
|
|
52
|
-
// seeded when missing, which left stale fetchStates when a prior
|
|
53
|
-
// fetch had already populated the entity entry.
|
|
54
|
-
draft.recommendationByEntity[key] = {
|
|
55
|
-
...(draft.recommendationByEntity[key] ??
|
|
56
|
-
recommendationState_1.initialEntityRecommendationState),
|
|
57
|
-
fetchState: 'In-Progress',
|
|
58
|
-
error: undefined,
|
|
59
|
-
};
|
|
60
|
-
},
|
|
61
|
-
prepare(args) {
|
|
62
|
-
return { payload: args };
|
|
63
|
-
},
|
|
64
|
-
},
|
|
65
40
|
fetchRecommendationByEntityName: {
|
|
66
41
|
reducer(draft, action) {
|
|
67
42
|
const { entityName, entityType } = action.payload;
|
|
@@ -140,7 +115,7 @@ const recommendation = (0, toolkit_1.createSlice)({
|
|
|
140
115
|
},
|
|
141
116
|
},
|
|
142
117
|
});
|
|
143
|
-
_a = recommendation.actions, exports.fetchEntityRecommendationsByTransactionId = _a.fetchEntityRecommendationsByTransactionId, exports.
|
|
118
|
+
_a = recommendation.actions, exports.fetchEntityRecommendationsByTransactionId = _a.fetchEntityRecommendationsByTransactionId, exports.fetchRecommendationByEntityName = _a.fetchRecommendationByEntityName, exports.fetchRecommendationByEntityId = _a.fetchRecommendationByEntityId, exports.updateRecommendationForEntity = _a.updateRecommendationForEntity, exports.updateRecommendationForEntityFailure = _a.updateRecommendationForEntityFailure, exports.indicateReadyToInitializeRecommendation = _a.indicateReadyToInitializeRecommendation, exports.clearRecommendation = _a.clearRecommendation;
|
|
144
119
|
exports.default = recommendation.reducer;
|
|
145
120
|
const doUpdateRecommendationForEntity = (draft, entityId, entityType, payload) => {
|
|
146
121
|
const key = (0, recommendationState_1.getEntityRecommendationKey)(entityType, entityId);
|
|
@@ -45,7 +45,7 @@ export interface BillPayFilters {
|
|
|
45
45
|
}
|
|
46
46
|
export interface BillPayFilterCategory {
|
|
47
47
|
field: BillListViewFilterCategoryField;
|
|
48
|
-
matchingOperator: 'equal' | '
|
|
48
|
+
matchingOperator: 'equal' | 'not-equal';
|
|
49
49
|
values: (string | ZeniDate)[];
|
|
50
50
|
valuesCombinationOperator: 'ANY';
|
|
51
51
|
}
|
|
@@ -2,9 +2,7 @@ import { ZeniAPIStatus } from '../../../../responsePayload';
|
|
|
2
2
|
import { ChargeCardCashbackPayload } from './cashbackDetailPayload';
|
|
3
3
|
import { CashbackDetailState, CashbackDetailUIState } from './cashbackDetailState';
|
|
4
4
|
export declare const initialState: CashbackDetailState;
|
|
5
|
-
export declare const fetchCashbackDetail: import("@reduxjs/toolkit").
|
|
6
|
-
cacheOverride: boolean;
|
|
7
|
-
}, "cashbackDetail/fetchCashbackDetail", never, never>, updateCashbackDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<ChargeCardCashbackPayload, "cashbackDetail/updateCashbackDetail">, updateCashbackDetailFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "cashbackDetail/updateCashbackDetailFailure">, updateCashbackDetailUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
5
|
+
export declare const fetchCashbackDetail: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"cashbackDetail/fetchCashbackDetail">, updateCashbackDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<ChargeCardCashbackPayload, "cashbackDetail/updateCashbackDetail">, updateCashbackDetailFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "cashbackDetail/updateCashbackDetailFailure">, updateCashbackDetailUIState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
8
6
|
uiState: Partial<CashbackDetailUIState>;
|
|
9
7
|
}, "cashbackDetail/updateCashbackDetailUIState">, clearCashbackDetail: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"cashbackDetail/clearCashbackDetail">;
|
|
10
8
|
declare const _default: import("redux").Reducer<CashbackDetailState>;
|
|
@@ -5,7 +5,6 @@ exports.clearCashbackDetail = exports.updateCashbackDetailUIState = exports.upda
|
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const viewAndReportPayloadv2_1 = require("../../../../commonPayloadTypes/v2/viewAndReportPayloadv2");
|
|
7
7
|
const amount_1 = require("../../../../commonStateTypes/amount");
|
|
8
|
-
const cacheOverrideFetchReducer_1 = require("../../../../commonStateTypes/cacheOverrideFetchReducer");
|
|
9
8
|
const cashbackDetailState_1 = require("./cashbackDetailState");
|
|
10
9
|
exports.initialState = {
|
|
11
10
|
fetchState: 'Not-Started',
|
|
@@ -32,10 +31,10 @@ const cashbackDetail = (0, toolkit_1.createSlice)({
|
|
|
32
31
|
name: 'cashbackDetail',
|
|
33
32
|
initialState: exports.initialState,
|
|
34
33
|
reducers: {
|
|
35
|
-
fetchCashbackDetail
|
|
34
|
+
fetchCashbackDetail(draft) {
|
|
36
35
|
draft.fetchState = 'In-Progress';
|
|
37
36
|
draft.error = undefined;
|
|
38
|
-
}
|
|
37
|
+
},
|
|
39
38
|
updateCashbackDetail(draft, action) {
|
|
40
39
|
draft.cashbackByPeriod = toCashbackByPeriod(action.payload);
|
|
41
40
|
draft.cashbackSummary = toCashbackSummary(action.payload);
|
|
@@ -2,8 +2,6 @@ import { ZeniAPIStatus } from '../../../../responsePayload';
|
|
|
2
2
|
import { ChargeCardConfigPayload } from './chargeCardConfigPayload';
|
|
3
3
|
import { ChargeCardConfigState } from './chargeCardConfigState';
|
|
4
4
|
export declare const initialState: ChargeCardConfigState;
|
|
5
|
-
export declare const fetchChargeCardConfig: import("@reduxjs/toolkit").
|
|
6
|
-
cacheOverride: boolean;
|
|
7
|
-
}, "chargeCardConfig/fetchChargeCardConfig", never, never>, updateChargeCardConfig: import("@reduxjs/toolkit").ActionCreatorWithPayload<ChargeCardConfigPayload, "chargeCardConfig/updateChargeCardConfig">, updateChargeCardConfigFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "chargeCardConfig/updateChargeCardConfigFailure">, clearChargeCardConfig: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chargeCardConfig/clearChargeCardConfig">;
|
|
5
|
+
export declare const fetchChargeCardConfig: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chargeCardConfig/fetchChargeCardConfig">, updateChargeCardConfig: import("@reduxjs/toolkit").ActionCreatorWithPayload<ChargeCardConfigPayload, "chargeCardConfig/updateChargeCardConfig">, updateChargeCardConfigFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<ZeniAPIStatus<Record<string, unknown>>, "chargeCardConfig/updateChargeCardConfigFailure">, clearChargeCardConfig: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"chargeCardConfig/clearChargeCardConfig">;
|
|
8
6
|
declare const _default: import("redux").Reducer<ChargeCardConfigState>;
|
|
9
7
|
export default _default;
|
|
@@ -4,7 +4,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
4
4
|
exports.clearChargeCardConfig = exports.updateChargeCardConfigFailure = exports.updateChargeCardConfig = exports.fetchChargeCardConfig = exports.initialState = void 0;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const amount_1 = require("../../../../commonStateTypes/amount");
|
|
7
|
-
const cacheOverrideFetchReducer_1 = require("../../../../commonStateTypes/cacheOverrideFetchReducer");
|
|
8
7
|
const chargeCard_1 = require("../../../../entity/chargeCard/chargeCard");
|
|
9
8
|
const chargeCardConfigPayload_1 = require("./chargeCardConfigPayload");
|
|
10
9
|
exports.initialState = {
|
|
@@ -35,10 +34,10 @@ const chargeCardConfig = (0, toolkit_1.createSlice)({
|
|
|
35
34
|
name: 'chargeCardConfig',
|
|
36
35
|
initialState: exports.initialState,
|
|
37
36
|
reducers: {
|
|
38
|
-
fetchChargeCardConfig
|
|
37
|
+
fetchChargeCardConfig(draft) {
|
|
39
38
|
draft.fetchState = 'In-Progress';
|
|
40
39
|
draft.error = undefined;
|
|
41
|
-
}
|
|
40
|
+
},
|
|
42
41
|
updateChargeCardConfig(draft, action) {
|
|
43
42
|
const { payload } = action;
|
|
44
43
|
draft.creditLimitFrequency =
|