@zeniai/client-epic-state 5.0.65-betaML2 → 5.0.65-betaRR2
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/common/aiCfo/aiCfoSuggestedQuestionsPageContext.d.ts +1 -1
- package/lib/entity/aiCfo/aiCfoPayload.d.ts +168 -1
- package/lib/entity/aiCfo/aiCfoReducer.js +186 -2
- package/lib/entity/aiCfo/aiCfoState.d.ts +164 -4
- package/lib/entity/aiCfo/aiCfoState.js +10 -1
- package/lib/entity/cardPolicy/cardPolicyPayload.d.ts +171 -0
- package/lib/entity/cardPolicy/cardPolicyPayload.js +112 -0
- package/lib/entity/cardPolicy/cardPolicyReducer.d.ts +13 -0
- package/lib/entity/cardPolicy/cardPolicyReducer.js +203 -0
- package/lib/entity/cardPolicy/cardPolicySelector.d.ts +28 -0
- package/lib/entity/cardPolicy/cardPolicySelector.js +86 -0
- package/lib/entity/cardPolicy/cardPolicyState.d.ts +162 -0
- package/lib/entity/cardPolicy/cardPolicyState.js +14 -0
- package/lib/entity/cardPolicy/extractPolicyDocumentEpic.d.ts +18 -0
- package/lib/entity/cardPolicy/extractPolicyDocumentEpic.js +54 -0
- package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.d.ts +26 -0
- package/lib/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +47 -0
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -1
- package/lib/entity/monthEndCloseChecks/monthEndCloseChecksState.d.ts +1 -1
- package/lib/entity/tenant/clearAllEpic.d.ts +6 -2
- package/lib/entity/tenant/clearAllEpic.js +8 -0
- package/lib/epic.d.ts +9 -2
- package/lib/epic.js +9 -2
- package/lib/esm/entity/aiCfo/aiCfoReducer.js +187 -3
- package/lib/esm/entity/aiCfo/aiCfoState.js +7 -0
- package/lib/esm/entity/cardPolicy/cardPolicyPayload.js +101 -0
- package/lib/esm/entity/cardPolicy/cardPolicyReducer.js +199 -0
- package/lib/esm/entity/cardPolicy/cardPolicySelector.js +66 -0
- package/lib/esm/entity/cardPolicy/cardPolicyState.js +9 -0
- package/lib/esm/entity/cardPolicy/extractPolicyDocumentEpic.js +50 -0
- package/lib/esm/entity/cardPolicy/fetchCardPolicyVendorOptionsEpic.js +43 -0
- package/lib/esm/entity/tenant/clearAllEpic.js +8 -0
- package/lib/esm/epic.js +9 -2
- package/lib/esm/index.js +21 -7
- package/lib/esm/reducer.js +12 -0
- package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +1 -21
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +14 -117
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +0 -28
- package/lib/esm/view/recommendation/recommendationHelper.js +0 -29
- package/lib/esm/view/recommendation/recommendationReducer.js +1 -36
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +70 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +22 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +1 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +44 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +49 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +42 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +72 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +21 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +1 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +46 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +50 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +6 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +1 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +34 -0
- package/lib/esm/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +17 -0
- package/lib/esm/view/transactionDetail/transactionDetailReducer.js +1 -110
- package/lib/esm/view/transactionDetail/transactionDetailSelector.js +0 -22
- package/lib/index.d.ts +20 -8
- package/lib/index.js +119 -35
- package/lib/reducer.d.ts +12 -0
- package/lib/reducer.js +12 -0
- package/lib/view/companyHealthMetricView/companyHealthMetricViewSelector.d.ts +1 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +0 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -23
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +1 -14
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +14 -117
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +0 -2
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.d.ts +0 -3
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +0 -29
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +2 -2
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +1 -2
- package/lib/view/onboardingView/cockpitView/types/onboardingCockpitViewTypes.d.ts +1 -1
- package/lib/view/people/peopleTypes.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 -18
- package/lib/view/recommendation/recommendationReducer.js +2 -37
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.d.ts +14 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer.js +74 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.d.ts +21 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector.js +28 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.d.ts +25 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailState.js +2 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.d.ts +19 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/fetchCardPolicyDetailEpic.js +48 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.d.ts +18 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/updateCardPolicyEpic.js +53 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.d.ts +16 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/archiveCardPolicyEpic.js +46 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.d.ts +15 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer.js +76 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.d.ts +21 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector.js +27 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.d.ts +19 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListState.js +2 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.d.ts +19 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/cardPolicyList/fetchCardPolicyListEpic.js +50 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.d.ts +12 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer.js +54 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.d.ts +4 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector.js +10 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.d.ts +15 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyState.js +2 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.d.ts +8 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyTemplateEpic.js +38 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.d.ts +15 -0
- package/lib/view/spendManagement/chargeCards/cardPolicy/createCardPolicy/fetchCardPolicyMccCategoriesEpic.js +21 -0
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +1 -1
- package/lib/view/transactionDetail/transactionDetailReducer.d.ts +1 -11
- package/lib/view/transactionDetail/transactionDetailReducer.js +2 -111
- package/lib/view/transactionDetail/transactionDetailSelector.d.ts +0 -2
- package/lib/view/transactionDetail/transactionDetailSelector.js +1 -24
- package/lib/view/transactionDetail/transactionDetailTypes.d.ts +0 -1
- package/package.json +1 -1
- package/lib/esm/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.js +0 -88
- package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
- package/lib/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.d.ts +0 -9
- package/lib/view/recommendation/fetchEntityRecommendationsForLineUpdateEpic.js +0 -92
package/lib/esm/index.js
CHANGED
|
@@ -167,7 +167,7 @@ import { clearExpenseAutomationFluxAnalysisView, fetchFluxAnalysisView, reviewFl
|
|
|
167
167
|
import { clearJeScheduleLocalData as clearExpenseAutomationJEScheduleLocalData, clearExpenseAutomationJESchedulesView, fetchJeSchedulesPage as fetchExpenseAutomationJESchedulesPage, ignoreRecommendedJeSchedule as ignoreExpenseAutomationJESchedule, initializeAccountSettingsView as initializeJeAccountSettingsView, initializeJeScheduleLocalData, removeJeScheduleTransactionKey, retryJeSchedule as retryExpenseAutomationJESchedule, saveAccountSettings as saveJeAccountSettings, saveAccountSettingsLocalData as saveJeAccountSettingsLocalData, updateJESchedulesUIState as updateExpenseAutomationJESchedulesUIState, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, } from './view/expenseAutomationView/reducers/jeSchedulesViewReducer';
|
|
168
168
|
import { acknowledgeBulkUploadConfirmMatchComplete, bulkUploadAutomatchingTimedOut, bulkUploadReceipts, bulkUploadReceiptsFailure, bulkUploadReceiptsSuccess, clearBulkUpload, clearManualSearchResults, clearMissingReceiptsTabNavigation, confirmBulkUploadMatch, confirmBulkUploadMatchFailure, confirmBulkUploadMatchSuccess, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsFailure, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, fetchBulkUploadBatchesFailure, fetchBulkUploadBatchesSuccess, fetchCompletedTransactions, fetchCompletedTransactionsFailure, fetchCompletedTransactionsSuccess, fetchMissingReceipts as fetchExpenseAutomationMissingReceipts, fetchMoreBatchDetails, fetchMoreBatchDetailsComplete, fetchMoreBatchDetailsFailure, markMissingReceiptAsDone as markExpenseAutomationMissingReceiptAsDone, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation, restoreBulkUploadAutomatchingOnMount, restoreBulkUploadMatchingState, searchTransactionsForManualMatch, searchTransactionsForManualMatchFailure, searchTransactionsForManualMatchSuccess, setBulkUploadCompletedSubTab, setBulkUploadResultsTab, setBulkUploadSortConfig, setBulkUploadUploadedFileCount, storeBatchDetails, updateBulkUploadProgress, updateMissingReceiptUploadState as updateExpenseAutomationMissingReceiptUploadState, updateMissingReceiptsUIState as updateExpenseAutomationMissingReceiptsUIState, uploadMissingReceiptSuccess as uploadExpenseAutomationMissingReceiptSuccess, } from './view/expenseAutomationView/reducers/missingReceiptsViewReducer';
|
|
169
169
|
import { deleteAccountStatement, excludeAccountFromReconciliation, fetchReconciliation as fetchReconciliationView, includeAccountInReconciliation, saveReconciliationDetail as saveExpenseAutomationReconciliationDetail, saveReconciliationReview as saveExpenseAutomationReconciliationReview, setConnectionInProgressForAccount as setConnectionInProgressForAccountReconciliation, setStatementParseInProgress, updateAccountReconciliationLocalData as updateExpenseAutomationAccountReconciliationLocalData, updateSelectedAccountId as updateExpenseAutomationAccountReconciliationSelectedAccountId, updateSelectedTab as updateExpenseAutomationAccountReconciliationSelectedTab, updateReconListScrollPosition as updateExpenseAutomationReconListScrollPosition, updateReviewTabSortState as updateExpenseAutomationReconReviewTabListSortState, updateReviewTabLocalData as updateExpenseAutomationReconReviewTabLocalData, updateReconcileTabListScrollState as updateExpenseAutomationReconcileTabListScrollState, updateReconcileTabListSortState as updateExpenseAutomationReconcileTabListSortState, updateReconcileTabLocalData as updateExpenseAutomationReconcileTabLocalData, updateSelectedDrawerAccountId as updateExpenseAutomationSelectedDrawerAccountId, updateNodeCollapseState, updateStatementUploadChosen, uploadAccountStatement, } from './view/expenseAutomationView/reducers/reconciliationViewReducer';
|
|
170
|
-
import { backgroundRefetchReviewTab, clearExpenseAutomationTransactionsView, fetchTransactionCategorization, fetchTransactionCategorizationFailure, fetchTransactionCategorizationView, initializeTransactionCategorizationViewLocalData,
|
|
170
|
+
import { backgroundRefetchReviewTab, clearExpenseAutomationTransactionsView, fetchTransactionCategorization, fetchTransactionCategorizationFailure, fetchTransactionCategorizationView, initializeTransactionCategorizationViewLocalData, markTransactionAsNotMiscategorized, saveTransactionCategorization, saveTransactionCategorizationLocalData, setAllItemsToCategoryClassInLocalDataForCategorization, setEntityRecommendationForLineIdsForCategorization, syncTransactionCategorizationFromDetailSave, updateCurrentSelectedTransactionCategorizationTab, updateTransactionCategorizationCompletedSubTab, updateSelectedCheckboxTransactionIds, updateSelectedCustomerForTransaction, updateSelectedTransactionId, updateSelectedVendorForTransaction, updateTransactionCategorization, updateTransactionCategorizationSaveStatus, updateTransactionCategorizationUIState, updateTransactionCategorizationUploadReceiptState, uploadTransactionCategorizationReceiptSuccess, } from './view/expenseAutomationView/reducers/transactionsViewReducer';
|
|
171
171
|
import { getExpenseAutomationFluxAnalysisView } from './view/expenseAutomationView/selectors/fluxAnalysisViewSelector';
|
|
172
172
|
import { getExpenseAutomationReconciliationView, isAccountReconReport, } from './view/expenseAutomationView/selectors/reconciliationViewSelector';
|
|
173
173
|
import { getExpenseAutomationTransactionView } from './view/expenseAutomationView/selectors/transactionCategorizationSelector';
|
|
@@ -232,7 +232,7 @@ import { getProfitAndLossClassesView } from './view/profitAndLossClassesView/pro
|
|
|
232
232
|
import { isPandLReportViewCalculatedSectionID, isPandLReportViewSectionID, } from './view/profitAndLossClassesView/profitAndLossClassesViewSelectorTypes';
|
|
233
233
|
import { clearProfitAndLossProjectView, fetchProfitAndLossForTimeframeProjectView, fetchProfitAndLossProjectView, resetProfitAndLossProjectNodeCollapseState, updateProfitAndLossProjectViewUIState, updateProjectViewAccountViewMode, updateProjectsToFilterOut, } from './view/profitAndLossProjectView/profitAndLossProjectViewReducer';
|
|
234
234
|
import { getProfitAndLossProjectView } from './view/profitAndLossProjectView/profitAndLossProjectViewSelector';
|
|
235
|
-
import { fetchEntityRecommendationsByTransactionId,
|
|
235
|
+
import { fetchEntityRecommendationsByTransactionId, fetchRecommendationByEntityId, fetchRecommendationByEntityName, } from './view/recommendation/recommendationReducer';
|
|
236
236
|
import { clearReferrals, fetchReferrals, fetchRewardsPlan, resendReferralInvite, saveReferralFormDataInLocalStore, sendReferralInvite, updateReferViewed, updateReferralListSortUiState, } from './view/referralView/referralReducer';
|
|
237
237
|
import { getInviteFormView, getReferralListView, getRewardsPlanCard, } from './view/referralView/referralSelector';
|
|
238
238
|
import { AmountStatusTypes, StatusTypes, toReferralListViewSortKeyType, } from './view/referralView/referralState';
|
|
@@ -379,7 +379,7 @@ import { getAllTopExpenses, getTop6Expenses, getTopExpenses, } from './view/topE
|
|
|
379
379
|
import { TOP_EX_TIME_PERIODS, } from './view/topEx/topExState';
|
|
380
380
|
import { getAccountingProviderAttachment, } from './view/transactionDetail/getAccountingProviderAttachmentSelector';
|
|
381
381
|
import { getChangedLineItemCountFromLocalData, isAccountUncategorized, } from './view/transactionDetail/transactionDetailLocalDataHelper';
|
|
382
|
-
import { clearTransactionDetailSaveStatus, deleteTransactionAttachment, downloadAccountingProviderAttachment, downloadAccountingProviderAttachmentFailure, downloadAccountingProviderAttachmentSuccess, fetchTransactionDetail, initializeTransactionDetailLocalData,
|
|
382
|
+
import { clearTransactionDetailSaveStatus, deleteTransactionAttachment, downloadAccountingProviderAttachment, downloadAccountingProviderAttachmentFailure, downloadAccountingProviderAttachmentSuccess, fetchTransactionDetail, initializeTransactionDetailLocalData, removeEntityRecommendationForLineIdForTransactionDetail, resetAllLineItemsToVendor, resetLineItemsCategoryClassInLocalData, resetSelectedCustomer, resetVendor, saveTransactionDetail, saveTransactionDetailLocalData, setAllLineItemsLocalDataIsUpdateAllChecked, setAllLineItemsToCategoryClassInLocalData, setIsVendorUpdateAllChecked, updateLatestSelectedEntity, updateLocalDataWithTransactionsUpdateWithVendorCheckbox, updateSelectedCustomer, updateSelectedVendor, updateTransactionDetail, updateVendorBulkRecommendationsFetchStatus, updateVendorToAllLineItems, uploadMissingAttachmentSuccess, } from './view/transactionDetail/transactionDetailReducer';
|
|
383
383
|
import { getInitialUpdatablePeriodsForTransactionRecommendations, getTransactionDetail, getTransactionDetailForTransaction, } from './view/transactionDetail/transactionDetailSelector';
|
|
384
384
|
import { getThirdPartyIdFromTransactionId, } from './view/transactionDetail/transactionDetailState';
|
|
385
385
|
import { getTransactionListByAccount, getTransactionListUIStateByAccountKey, } from './view/transactionList/transactionListByAccountSelector';
|
|
@@ -445,7 +445,7 @@ export {
|
|
|
445
445
|
BATCH_FILE_STATUSES, isUnmatchedTabFileStatus, DEFAULT_COMPLETED_SUB_TAB, toBatchFileStatus, toBatchStatusValue, toBulkUploadPhase, toBulkUploadResultsTab, toBulkUploadSortKey, toCompletedSubTab, toMatchSource, toMissingReceiptsTab, toExpenseAutomationJEScheduleMainTab, toExpenseAutomationJEScheduleSortKey, getExpenseAutomationView, toExpenseAutomationMissingReceiptsSortKey, toExpenseAutomationTransactionsTabKey, toExpenseAutomationViewType, uploadExpenseAutomationMissingReceiptSuccess, markExpenseAutomationMissingReceiptAsDone, fetchAllExpenseAutomationTabs, refreshExpenseAutomationCurrentTab, updateCurrentSelectedTransactionCategorizationTab, updateTransactionCategorizationCompletedSubTab, fetchExpenseAutomationMissingReceipts,
|
|
446
446
|
// Bulk Upload Actions
|
|
447
447
|
bulkUploadReceipts, bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, bulkUploadReceiptsFailure, restoreBulkUploadAutomatchingOnMount, restoreBulkUploadMatchingState, updateBulkUploadProgress, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation, clearMissingReceiptsTabNavigation, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatchDetailsFailure, storeBatchDetails, fetchMoreBatchDetails, fetchMoreBatchDetailsComplete, fetchMoreBatchDetailsFailure, fetchBulkUploadBatches, fetchBulkUploadBatchesSuccess, fetchBulkUploadBatchesFailure, confirmBulkUploadMatch, confirmBulkUploadMatchSuccess, confirmBulkUploadMatchFailure, setBulkUploadResultsTab, setBulkUploadCompletedSubTab, setBulkUploadSortConfig, setBulkUploadUploadedFileCount, clearBulkUpload, searchTransactionsForManualMatch, searchTransactionsForManualMatchSuccess, searchTransactionsForManualMatchFailure, clearManualSearchResults, acknowledgeBulkUploadConfirmMatchComplete, fetchCompletedTransactions, fetchCompletedTransactionsSuccess, fetchCompletedTransactionsFailure, fetchFluxAnalysisView, clearExpenseAutomationFluxAnalysisView, updateOperatingExpensesIdsForReview as updateFluxOperatingExpensesIdsForReview, updateSelectedSectionIdsForReview as updateFluxAnalysisSelectedSectionIdsForReview, reviewFluxAnalysisView, updateExpenseAutomationMissingReceiptUploadState, updateExpenseAutomationMissingReceiptsUIState, updateTransactionCategorizationUploadReceiptState, uploadTransactionCategorizationReceiptSuccess, getExpenseAutomationFluxAnalysisView, updateCurrentSelectedView, updateCurrentSelectedPeriod, getExpenseAutomationTransactionView, updateFluxAnalysisViewUIState, updateFluxAnalysisViewPageMetaData, MAX_SELECTION_LIMIT, checkIfAllLineItemsAreCategoryClassFilled, getLineItemsByTransactionIdsFromLocalData, isAnyItemWithUncategorizedExpenseAccount, excludeAccountFromReconciliation, includeAccountInReconciliation, saveExpenseAutomationReconciliationDetail, updateExpenseAutomationReconcileTabListScrollState, updateExpenseAutomationReconReviewTabListSortState, updateExpenseAutomationReconcileTabListSortState, updateExpenseAutomationReconcileTabLocalData, updateExpenseAutomationAccountReconciliationSelectedTab, updateExpenseAutomationAccountReconciliationSelectedAccountId, getExpenseAutomationReconciliationView, fetchReconciliationView, uploadAccountStatementIntoDocumentAI, updateExpenseAutomationReconListScrollPosition, setConnectionInProgressForAccountReconciliation, getAccountReconByAccountIdAndSelectedPeriod, toReconciliationTabsType, isAccountReconReport, updateExpenseAutomationReconReviewTabLocalData, updateExpenseAutomationSelectedDrawerAccountId, saveExpenseAutomationReconciliationReview, updateExpenseAutomationAccountReconciliationLocalData, toReconciliationAccountSource, deleteAccountStatement, uploadAccountStatement, updateNodeCollapseState, updateStatementUploadChosen, isReviewTransactionBankTransferType, isReviewTransactionBillPaymentType, isReviewTransactionCreditCardPaymentType, isReviewTransactionDepositType, isReviewTransactionExpenseType, isReviewTransactionCreditCardCreditType, setStatementParseInProgress, };
|
|
448
|
-
export { fetchTransactionCategorization, fetchTransactionCategorizationView, updateTransactionCategorizationUIState, updateSelectedCheckboxTransactionIds,
|
|
448
|
+
export { fetchTransactionCategorization, fetchTransactionCategorizationView, updateTransactionCategorizationUIState, updateSelectedCheckboxTransactionIds, setEntityRecommendationForLineIdsForCategorization, initializeTransactionCategorizationViewLocalData, setAllItemsToCategoryClassInLocalDataForCategorization, saveTransactionCategorizationLocalData, fetchTransactionCategorizationFailure, saveTransactionCategorization, updateTransactionCategorization, updateTransactionCategorizationSaveStatus, markTransactionAsNotMiscategorized, updateSelectedVendorForTransaction, updateSelectedCustomerForTransaction, updateSelectedTransactionId, syncTransactionCategorizationFromDetailSave, backgroundRefetchReviewTab, clearExpenseAutomationTransactionsView, toTransactionsSortKey, };
|
|
449
449
|
export { TOP_EX_TIME_PERIODS };
|
|
450
450
|
export { toTimeframeTick, mapTimePeriodtoTimeframeTick, toTimePeriod, toAbsoluteDay, toMonthYearPeriodId, convertToPeriod, };
|
|
451
451
|
export { toVendorSpendTrendFilterTabsTypeStrict, } from './entity/vendorExpense/vendorExpenseSelector';
|
|
@@ -498,7 +498,7 @@ export { isTransferTransaction };
|
|
|
498
498
|
export { getSupportedTransactionById, };
|
|
499
499
|
export { clearTransactionList, updateLatestTransactionId, parallelFetchAccountTransactionList, parallelFetchEntityTransactionList, fetchAccountTransactionList, updateTransactionListByAccount, updateTransactionListByAccountFailure, updateTransactionListByAccountUIState, parallelFetchClassTransactionList, updateTransactionListByClassUIState, updateTransactionListByClass, parallelFetchProjectTransactionList, updateTransactionListByProjectUIState, updateTransactionListByProject, updateTransactionListUIStateByCategoryType, parallelFetchTransactionListByCategoryType, };
|
|
500
500
|
export { getTransactionListByAccount, getTransactionListUIStateByAccountKey, };
|
|
501
|
-
export { fetchEntityTransactionList, updateTransactionListByEntity, saveTransactionDetailLocalData, clearTransactionDetailSaveStatus, updateTransactionListByEntityFailure, resetLineItemsCategoryClassInLocalData, setAllLineItemsToCategoryClassInLocalData, saveTransactionDetail, setAllLineItemsLocalDataIsUpdateAllChecked, initializeTransactionDetailLocalData,
|
|
501
|
+
export { fetchEntityTransactionList, updateTransactionListByEntity, saveTransactionDetailLocalData, clearTransactionDetailSaveStatus, updateTransactionListByEntityFailure, resetLineItemsCategoryClassInLocalData, setAllLineItemsToCategoryClassInLocalData, saveTransactionDetail, setAllLineItemsLocalDataIsUpdateAllChecked, initializeTransactionDetailLocalData, removeEntityRecommendationForLineIdForTransactionDetail, updateSelectedVendor, updateSelectedCustomer, resetSelectedCustomer, resetVendor, updateLocalDataWithTransactionsUpdateWithVendorCheckbox, updateVendorToAllLineItems, resetAllLineItemsToVendor, updateLatestSelectedEntity, updateVendorBulkRecommendationsFetchStatus, setIsVendorUpdateAllChecked, };
|
|
502
502
|
export { downloadAccountingProviderAttachment, downloadAccountingProviderAttachmentSuccess, downloadAccountingProviderAttachmentFailure, fetchTransactionDetail, updateTransactionDetail, uploadMissingAttachmentSuccess, deleteTransactionAttachment, getThirdPartyIdFromTransactionId, };
|
|
503
503
|
export { getTransactionListByEntity };
|
|
504
504
|
export { getTransactionListByClass, getTransactionListUIStateByClassKey, getTransactionListByProject, getTransactionListUIStateByProjectKey, getTransactionListByEntityForSinglePeriod, };
|
|
@@ -578,7 +578,7 @@ export { getSpendManagementEffectiveListPeriod, getSelectedCompanyOfficer, showB
|
|
|
578
578
|
export { canSendMonthEndEmailReport, shouldEnableCalendarPickerForLastReportSent, };
|
|
579
579
|
export { getInternationalSubConfigCodeKey, BILL_NEW_PAYMENT_METHODS, NEW_INTERNATIONAL_METHOD_SUBTEXT, SWIFT_OUR_INTERNATIONAL_METHOD_SUBTEXT, LOCAL_CURRENCY_INTERNATIONAL_METHOD_SUBTEXT, };
|
|
580
580
|
export { getVendorList, updateSortUiState, updatePageToken, updateYTDSelectionUIState, isColumnYTDSpend, isVendorsTabVisible, toVendorReportIDType, getVendorFiling1099List, fetchVendorsFiling1099Download, };
|
|
581
|
-
export { fetchEntityRecommendationsByTransactionId,
|
|
581
|
+
export { fetchEntityRecommendationsByTransactionId, fetchRecommendationByEntityId, fetchRecommendationByEntityName, };
|
|
582
582
|
export { fetchOwnerList };
|
|
583
583
|
export { getZeniAccountsConfigDetail, getZeniAccountList, fetchZeniAccountList, fetchAccountList, createCheckingAccount, fetchPaymentAccountList, unlinkPaymentAccount, getDepositAccountDetail, getAllDepositAccounts, getDepositAccountDetailForPDF, fetchDepositAccount, fetchZeniAccountsConfig, updateTransferMoneyLocalData, updateTransferToLocalData, updateDepositToLocalData, transferMoney, getTransferDetail, clearTransferDetail, clearReviewTransferDetail, fetchReviewTransferDetail, fetchDepositAccountDetail, depositCheck, updateCheckDepositLocalData, clearCheckDeposit, getCheckDepositDetail, updateDepositAccount, fetchDepositAccountHistorySuccess, fetchDepositAccountHistoryFailure, fetchZeniAccStatementPage, getZeniAccStatements, };
|
|
584
584
|
export { fetchDepositAccountTransactionList, getDepositAccountTransactionList, };
|
|
@@ -637,7 +637,21 @@ export { fetchChatSessionsForUser, createSession, submitQuestion, updateAiCfoVie
|
|
|
637
637
|
export { getAiCfoView, getSuggestedQuestionsForPageContext, } from './view/aiCfoView/aiCfoViewSelector';
|
|
638
638
|
export { setNewSession, setSessions, upsertAnswerPayload, upsertOrAddQuestionAnswerPayload, addQuestionPayload, clearSession, clearAiCfo, toAiCfoVisualization, } from './entity/aiCfo/aiCfoReducer';
|
|
639
639
|
export { getAllQuestionAnswersForChatSession, getQuestionAnswerByIdForChatSession, getAllQuestionsForChatSession, getAiCfoSelectorView, } from './entity/aiCfo/aiCfoSelector';
|
|
640
|
-
export { ALL_AI_CFO_CHARTS_TYPES, ALL_AI_CFO_VISUALIZATION_TYPES, ALL_AI_CFO_ANSWER_STATE_TYPES, ALL_AI_CFO_ANSWER_RESPONSE_TYPES, toAiCfoVisualizationType, toAiCfoVisualizationTypeStrict, toAiCfoChartType, toAiCfoChartTypeStrict, toAiCfoAnswerStateType, toAiCfoAnswerStateTypeStrict, toAiCfoAnswerResponseType, toAiCfoAnswerResponseTypeStrict, toMessageSender, toMessageType, } from './entity/aiCfo/aiCfoState';
|
|
640
|
+
export { ALL_AI_CFO_CHARTS_TYPES, ALL_AI_CFO_VISUALIZATION_TYPES, ALL_AI_CFO_ANSWER_STATE_TYPES, ALL_AI_CFO_ANSWER_RESPONSE_TYPES, ALL_INTERACTIVE_FORM_TYPES, toAiCfoVisualizationType, toAiCfoVisualizationTypeStrict, toAiCfoChartType, toAiCfoChartTypeStrict, toAiCfoAnswerStateType, toAiCfoAnswerStateTypeStrict, toAiCfoAnswerResponseType, toAiCfoAnswerResponseTypeStrict, toInteractiveFormType, toInteractiveFormTypeStrict, toMessageSender, toMessageType, } from './entity/aiCfo/aiCfoState';
|
|
641
|
+
// ── Card Policy (shared between manual + AI-driven flows) ────────────
|
|
642
|
+
export { clearPolicyDocumentExtraction, extractPolicyDocument, fetchCardPolicyMccCategories, fetchCardPolicyVendorOptions, removeCardPolicyTemplate, updateCardPolicyMccCategories, updateCardPolicyMccCategoriesFailure, updateCardPolicyStats, updateCardPolicyTemplates, updateCardPolicyVendorOptions, updateCardPolicyVendorOptionsFailure, updateCreatedCardPolicyTemplate, updatePolicyDocumentExtractionFailure, updatePolicyDocumentExtractionSuccess, clearCardPolicy, } from './entity/cardPolicy/cardPolicyReducer';
|
|
643
|
+
export { getAllCardPolicyTemplates, getCardPolicyMccCategories, getCardPolicyMccCategoriesError, getCardPolicyMccCategoriesFetchState, getCardPolicyStats, getCardPolicySuggestedAllowCategories, getCardPolicySuggestedAllowMerchants, getCardPolicySuggestedBlockCategories, getCardPolicySuggestedBlockMerchants, getCardPolicyTemplateById, getCardPolicyTemplatesByIds, getCardPolicyVendorSearchFetchState, getCardPolicyVendorSearchOptions, getCardPolicyVendorSearchString, getExtractedCardPolicyRules, getPolicyDocumentExtractionError, getPolicyDocumentExtractionFetchState, getUploadedPolicyDocumentFileName, } from './entity/cardPolicy/cardPolicySelector';
|
|
644
|
+
export { ALL_CARD_POLICY_TEMPLATE_MODES, ALL_CARD_POLICY_TEMPLATE_STATUSES, toCardPolicyTemplateMode, toCardPolicyTemplateStatus, } from './entity/cardPolicy/cardPolicyState';
|
|
645
|
+
export { toCardPolicyEditFormDraft, toCardPolicyStats, toCardPolicyTemplate, toCardPolicyTemplateList, toCardPolicyVendorSearchOption, toCreateCardPolicyTemplateRequestBody, toExtractedCardPolicyRules, toUpdateCardPolicyTemplateRequestBody, } from './entity/cardPolicy/cardPolicyPayload';
|
|
646
|
+
// Create flow (manual)
|
|
647
|
+
export { createCardPolicyTemplate, updateCreateCardPolicyTemplateRequestState, clearCreateCardPolicy, } from './view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer';
|
|
648
|
+
export { getCreateCardPolicyTemplateRequestState, getLastCreatedCardPolicyTemplateId, } from './view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicySelector';
|
|
649
|
+
// List
|
|
650
|
+
export { archiveCardPolicy, clearCardPolicyList, fetchCardPolicyList, updateArchiveCardPolicyFetchStatus, updateCardPolicyListFetchStatus, } from './view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer';
|
|
651
|
+
export { getArchiveCardPolicyFetchState, getCardPolicyListFetchState, getCardPolicyListView, getCardPolicyTemplateIds, } from './view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListSelector';
|
|
652
|
+
// Detail (edit-only)
|
|
653
|
+
export { clearCardPolicyDetail, fetchCardPolicyDetail, updateCardPolicy, updateCardPolicyDetailFetchStatus, updateCardPolicyFetchStatus, updateCardPolicyFormDraft, } from './view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer';
|
|
654
|
+
export { getCardPolicyDetailFetchState, getCardPolicyDetailView, getCardPolicyFormDraft, getUpdateCardPolicyFetchState, } from './view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailSelector';
|
|
641
655
|
export { fetchTreasuryOverviewDetail, fetchTreasuryTransactionList, updateTreasuryTransactionListUIState, } from './view/spendManagement/treasury/treasuryList/treasuryDetailReducer';
|
|
642
656
|
export { getTreasuryDetail, } from './view/spendManagement/treasury/treasuryList/treasuryDetailSelector';
|
|
643
657
|
export { executeTreasuryTransferMoney, updateTreasuryTransferMoneyLocalData, clearTreasuryTransferMoney, } from './view/spendManagement/treasury/treasuryTransferMoney/treasuryTransferMoneyReducer';
|
package/lib/esm/reducer.js
CHANGED
|
@@ -12,6 +12,7 @@ import billTransaction, { initialState as initialBillTransactionState, } from '.
|
|
|
12
12
|
import contact, { initialState as initialContactState, } from './entity/billPay/contact/contactReducer';
|
|
13
13
|
import recurringBill, { initialState as initialRecurringBillState, } from './entity/billPay/recurringBills/recurringBillsReducer';
|
|
14
14
|
import cardPayment, { initialState as initialCardPaymentState, } from './entity/cardPayment/cardPaymentReducer';
|
|
15
|
+
import cardPolicy, { initialState as initialCardPolicyState, } from './entity/cardPolicy/cardPolicyReducer';
|
|
15
16
|
import chargeCard, { initialState as initialChargeCardState, } from './entity/chargeCard/chargeCardReducer';
|
|
16
17
|
import chargeCardRepayment, { initialState as initialChargeCardRepaymentState, } from './entity/chargeCardRepayment/chargeCardRepaymentReducer';
|
|
17
18
|
import chargeCardTransaction, { initialState as initialChargeCardTransactionState, } from './entity/chargeCardTransaction/chargeCardTransactionReducer';
|
|
@@ -84,6 +85,9 @@ import bankAccountView, { initialState as initialBankAccountView, } from './view
|
|
|
84
85
|
import billPayCard, { initialState as initialBillPayCardState, } from './view/billPayCard/billPayCardReducer';
|
|
85
86
|
import cardBalance, { initialState as initialCardBalanceState, } from './view/cardBalance/cardBalanceReducer';
|
|
86
87
|
import cardPaymentView, { initialState as initialCardPaymentViewState, } from './view/cardPayment/cardPaymentViewReducer';
|
|
88
|
+
import cardPolicyDetail, { initialState as initialCardPolicyDetailState, } from './view/spendManagement/chargeCards/cardPolicy/cardPolicyDetail/cardPolicyDetailReducer';
|
|
89
|
+
import cardPolicyList, { initialState as initialCardPolicyListState, } from './view/spendManagement/chargeCards/cardPolicy/cardPolicyList/cardPolicyListReducer';
|
|
90
|
+
import createCardPolicy, { initialState as initialCreateCardPolicyState, } from './view/spendManagement/chargeCards/cardPolicy/createCardPolicy/createCardPolicyReducer';
|
|
87
91
|
import cashBalance, { initialState as initialCashBalanceState, } from './view/cashBalance/cashBalanceReducer';
|
|
88
92
|
import cashFlow, { initialState as initialCashFlowState, } from './view/cashFlow/cashFlowReducer';
|
|
89
93
|
import cashInCashOut, { initialState as initialCashInCashOutState, } from './view/cashInCashOut/cashInCashOutReducer';
|
|
@@ -237,6 +241,7 @@ const initialEntitiesState = {
|
|
|
237
241
|
bankAccountState: initialBankAccountState,
|
|
238
242
|
billTransactionState: initialBillTransactionState,
|
|
239
243
|
cardPaymentState: initialCardPaymentState,
|
|
244
|
+
cardPolicyState: initialCardPolicyState,
|
|
240
245
|
chargeCardState: initialChargeCardState,
|
|
241
246
|
chargeCardRepaymentState: initialChargeCardRepaymentState,
|
|
242
247
|
chargeCardTransactionState: initialChargeCardTransactionState,
|
|
@@ -321,6 +326,8 @@ const initialViewsState = {
|
|
|
321
326
|
billsBulkActionViewState: initialBillsBulkActionViewState,
|
|
322
327
|
cardBalanceState: initialCardBalanceState,
|
|
323
328
|
cardPaymentViewState: initialCardPaymentViewState,
|
|
329
|
+
cardPolicyDetailState: initialCardPolicyDetailState,
|
|
330
|
+
cardPolicyListState: initialCardPolicyListState,
|
|
324
331
|
cardUserOnboardingState: initialCardUserOnboardingState,
|
|
325
332
|
cashbackDetailState: initialCashbackDetailState,
|
|
326
333
|
cashBalanceState: initialCashBalanceState,
|
|
@@ -344,6 +351,7 @@ const initialViewsState = {
|
|
|
344
351
|
companyTaskManagerViewState: initialCompanyTaskManagerViewState,
|
|
345
352
|
companyViewState: initialCompanyViewState,
|
|
346
353
|
countryListState: initialCountryListState,
|
|
354
|
+
createCardPolicyState: initialCreateCardPolicyState,
|
|
347
355
|
creditAgentEntityState: initialCreditAgentEntityState,
|
|
348
356
|
creditAgentViewState: initialCreditAgentViewState,
|
|
349
357
|
dashboardLayoutState: initialDashboardLayoutState,
|
|
@@ -473,6 +481,7 @@ const entityReducers = {
|
|
|
473
481
|
billPayConfigState: billPayConfig,
|
|
474
482
|
billTransactionState: billTransaction,
|
|
475
483
|
cardPaymentState: cardPayment,
|
|
484
|
+
cardPolicyState: cardPolicy,
|
|
476
485
|
chargeCardState: chargeCard,
|
|
477
486
|
chargeCardRepaymentState: chargeCardRepayment,
|
|
478
487
|
chargeCardTransactionState: chargeCardTransaction,
|
|
@@ -556,6 +565,8 @@ const viewReducers = {
|
|
|
556
565
|
billsBulkActionViewState: billsBulkActionView,
|
|
557
566
|
cardBalanceState: cardBalance,
|
|
558
567
|
cardPaymentViewState: cardPaymentView,
|
|
568
|
+
cardPolicyDetailState: cardPolicyDetail,
|
|
569
|
+
cardPolicyListState: cardPolicyList,
|
|
559
570
|
cardUserOnboardingState: cardUserOnboarding,
|
|
560
571
|
cashbackDetailState: cashbackDetail,
|
|
561
572
|
cashBalanceState: cashBalance,
|
|
@@ -579,6 +590,7 @@ const viewReducers = {
|
|
|
579
590
|
companyTaskManagerViewState: companyTaskManagerView,
|
|
580
591
|
companyViewState: companyView,
|
|
581
592
|
countryListState: countryList,
|
|
593
|
+
createCardPolicyState: createCardPolicy,
|
|
582
594
|
creditAgentEntityState: creditAgentEntity,
|
|
583
595
|
creditAgentViewState: creditAgentView,
|
|
584
596
|
dashboardState: dashboard,
|
package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js
CHANGED
|
@@ -59,22 +59,6 @@ export const filterAutoTabLineItems = (tabView, transactionId, updatedTransactio
|
|
|
59
59
|
}
|
|
60
60
|
};
|
|
61
61
|
export const MAX_SELECTION_LIMIT = 5;
|
|
62
|
-
// Returns true when the transaction should be auto-added to the
|
|
63
|
-
// selectedCheckBoxTransactionIds list after a categorization-related
|
|
64
|
-
// state mutation: all line items are filled, the selection limit has
|
|
65
|
-
// not been hit, and the id isn't already in the list. Consolidates the
|
|
66
|
-
// triplet that was inlined at four sites (updateSelectedCustomer/Vendor,
|
|
67
|
-
// setAllItemsToCategoryClassInLocalDataForCategorization, and
|
|
68
|
-
// setEntityRecommendationForLineIdInLocalData below).
|
|
69
|
-
export const shouldAutoSelectAndAdd = (transaction, localData, selectedCheckBoxTransactionIds, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) => {
|
|
70
|
-
if (selectedCheckBoxTransactionIds.includes(transaction.id)) {
|
|
71
|
-
return false;
|
|
72
|
-
}
|
|
73
|
-
if (selectedCheckBoxTransactionIds.length >= MAX_SELECTION_LIMIT) {
|
|
74
|
-
return false;
|
|
75
|
-
}
|
|
76
|
-
return checkIfAllLineItemsAreCategoryClassFilled(transaction, localData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled);
|
|
77
|
-
};
|
|
78
62
|
export const toTransactionDetailLocalData = (transaction, selectedTab, lineItemsByTransactionIds, uncategorizedIncomeExpense, isUncategorizedExpenseCategoryEnabled) => {
|
|
79
63
|
const transactionLocal = {
|
|
80
64
|
...initialSupportedTransactionCategorization.transactionReviewLocalData,
|
|
@@ -560,14 +544,10 @@ export const setEntityRecommendationForLineIdInLocalData = (draft, transaction,
|
|
|
560
544
|
selectedEntity: transactionDetailLocalData.selectedEntity,
|
|
561
545
|
tabSpecificLineItems: transactionDetailLocalData.tabSpecificLineItems,
|
|
562
546
|
};
|
|
563
|
-
// Auto-uncheck if not all line items are filled (the row's
|
|
564
|
-
// category/class became stale after the entity update). Otherwise
|
|
565
|
-
// route through shouldAutoSelectAndAdd so the MAX_SELECTION_LIMIT
|
|
566
|
-
// gate is consistently applied across all auto-add sites.
|
|
567
547
|
if (!checkIfAllLineItemsAreCategoryClassFilled(transaction, newLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled)) {
|
|
568
548
|
selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds.filter((id) => id !== transaction.id);
|
|
569
549
|
}
|
|
570
|
-
else if (
|
|
550
|
+
else if (selectedCheckBoxTransactionIds.includes(transaction.id) === false) {
|
|
571
551
|
selectedCheckBoxTransactionIds.push(transaction.id);
|
|
572
552
|
}
|
|
573
553
|
draft.selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds;
|
|
@@ -3,7 +3,7 @@ import recordGet from 'lodash/get';
|
|
|
3
3
|
import uniq from 'lodash/uniq';
|
|
4
4
|
import { toMonthYearPeriodId, } from '../../../commonStateTypes/timePeriod';
|
|
5
5
|
import { isVendorTransaction } from '../../../entity/transaction/stateTypes/vendorTransaction';
|
|
6
|
-
import { filterAutoTabLineItems, mergeTabSpecificLineItems, removeTransactionFromTabView, setEntityRecommendationForLineIdInLocalData,
|
|
6
|
+
import { MAX_SELECTION_LIMIT, checkIfAllLineItemsAreCategoryClassFilled, filterAutoTabLineItems, mergeTabSpecificLineItems, removeTransactionFromTabView, setEntityRecommendationForLineIdInLocalData, toSetAllLineItemsToCategoryClass, toTransactionDetailLocalData, } from '../helpers/transactionCategorizationLocalDataHelper';
|
|
7
7
|
import { DEFAULT_COMPLETED_SUB_TAB, } from '../types/completedSubTab';
|
|
8
8
|
export const initialTransactionTabViewState = {
|
|
9
9
|
saveStatus: {
|
|
@@ -420,9 +420,12 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
420
420
|
const selectedCheckBoxTransactionIds = draft.transactionCategorizationView[selectedTab]
|
|
421
421
|
.selectedCheckBoxTransactionIds;
|
|
422
422
|
if (selectedTransaction != null &&
|
|
423
|
-
|
|
423
|
+
checkIfAllLineItemsAreCategoryClassFilled(selectedTransaction, newTransactionLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) === true && // check if all line items are filled
|
|
424
|
+
selectedCheckBoxTransactionIds.length < MAX_SELECTION_LIMIT &&
|
|
425
|
+
selectedCheckBoxTransactionIds.includes(transactionId) === false) {
|
|
424
426
|
draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds = [
|
|
425
|
-
...
|
|
427
|
+
...draft.transactionCategorizationView[selectedTab]
|
|
428
|
+
.selectedCheckBoxTransactionIds,
|
|
426
429
|
transactionId,
|
|
427
430
|
];
|
|
428
431
|
}
|
|
@@ -505,26 +508,9 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
505
508
|
const transactionLocalData = recordGet(draft.transactionCategorizationView[selectedTab]
|
|
506
509
|
.transactionReviewLocalDataById, transactionId.id, undefined);
|
|
507
510
|
if (transactionLocalData != null) {
|
|
508
|
-
const newLocalData = setEntityRecommendationForLineIdInLocalData(draft.transactionCategorizationView[selectedTab], transaction, transactionLocalData.transactionReviewLocalData, entity, lineIds, uncategorizedAccounts, action.payload.recommendationWithCOTByLineId, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled);
|
|
509
|
-
// Release the per-line fetch flag for every line this fetch
|
|
510
|
-
// covered. Done in-place on the freshly returned local data
|
|
511
|
-
// (the helper produces a new mutable object), before we write
|
|
512
|
-
// it back to the draft.
|
|
513
|
-
lineIds.forEach((lineId) => {
|
|
514
|
-
const lineItem = newLocalData.lineItemById[lineId];
|
|
515
|
-
if (lineItem != null) {
|
|
516
|
-
newLocalData.lineItemById[lineId] = {
|
|
517
|
-
...lineItem,
|
|
518
|
-
categoryClassRecommendationsFetchState: {
|
|
519
|
-
fetchState: 'Completed',
|
|
520
|
-
error: undefined,
|
|
521
|
-
},
|
|
522
|
-
};
|
|
523
|
-
}
|
|
524
|
-
});
|
|
525
511
|
draft.transactionCategorizationView[selectedTab].transactionReviewLocalDataById[transaction.id] = {
|
|
526
512
|
transactionId: transaction.id,
|
|
527
|
-
transactionReviewLocalData:
|
|
513
|
+
transactionReviewLocalData: setEntityRecommendationForLineIdInLocalData(draft.transactionCategorizationView[selectedTab], transaction, transactionLocalData.transactionReviewLocalData, entity, lineIds, uncategorizedAccounts, action.payload.recommendationWithCOTByLineId, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled),
|
|
528
514
|
};
|
|
529
515
|
// Mark transaction as dirty (autofill happened)
|
|
530
516
|
if (!draft.transactionCategorizationView[selectedTab].transactionIdsWithUnsavedData.includes(transaction.id)) {
|
|
@@ -537,99 +523,6 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
537
523
|
}
|
|
538
524
|
},
|
|
539
525
|
},
|
|
540
|
-
// Start arm of the line-update recommendations fetch. Flips covered
|
|
541
|
-
// lines to In-Progress AND removes the transaction from
|
|
542
|
-
// selectedCheckBoxTransactionIds — the row is unchecked + disabled
|
|
543
|
-
// until either the success arm (recheck if limit allows) or the
|
|
544
|
-
// failure arm releases the per-line flag.
|
|
545
|
-
markCategoryClassRecommendationsInProgressForCategorization: {
|
|
546
|
-
reducer(draft, action) {
|
|
547
|
-
const { selectedTab, transactionId, lineIds } = action.payload;
|
|
548
|
-
const tab = draft.transactionCategorizationView[selectedTab];
|
|
549
|
-
const transactionLocalData = recordGet(tab.transactionReviewLocalDataById, transactionId.id, undefined);
|
|
550
|
-
if (transactionLocalData != null) {
|
|
551
|
-
lineIds.forEach((lineId) => {
|
|
552
|
-
const lineItem = transactionLocalData.transactionReviewLocalData.lineItemById[lineId];
|
|
553
|
-
if (lineItem != null) {
|
|
554
|
-
transactionLocalData.transactionReviewLocalData.lineItemById[lineId] = {
|
|
555
|
-
...lineItem,
|
|
556
|
-
categoryClassRecommendationsFetchState: {
|
|
557
|
-
fetchState: 'In-Progress',
|
|
558
|
-
error: undefined,
|
|
559
|
-
},
|
|
560
|
-
};
|
|
561
|
-
}
|
|
562
|
-
});
|
|
563
|
-
}
|
|
564
|
-
// Uncheck on fetch start: the row's existing category/class are
|
|
565
|
-
// stale after a payee change, so we drop the auto-selection until
|
|
566
|
-
// fresh recommendations land.
|
|
567
|
-
if (tab.selectedCheckBoxTransactionIds.includes(transactionId.id)) {
|
|
568
|
-
tab.selectedCheckBoxTransactionIds =
|
|
569
|
-
tab.selectedCheckBoxTransactionIds.filter((id) => id !== transactionId.id);
|
|
570
|
-
}
|
|
571
|
-
},
|
|
572
|
-
prepare(selectedTab, transactionId, lineIds) {
|
|
573
|
-
return { payload: { selectedTab, transactionId, lineIds } };
|
|
574
|
-
},
|
|
575
|
-
},
|
|
576
|
-
// Completed arm. Used by the epic when the HTTP call succeeds but the
|
|
577
|
-
// server returned no per-line recommendations — we still need to
|
|
578
|
-
// release the In-Progress flag so the skeleton resolves. Successful
|
|
579
|
-
// responses with recommendations go through
|
|
580
|
-
// setEntityRecommendationForLineIdsForCategorization instead (which
|
|
581
|
-
// also flips the lines to Completed).
|
|
582
|
-
markCategoryClassRecommendationsCompletedForCategorization: {
|
|
583
|
-
reducer(draft, action) {
|
|
584
|
-
const { selectedTab, transactionId, lineIds } = action.payload;
|
|
585
|
-
const transactionLocalData = recordGet(draft.transactionCategorizationView[selectedTab]
|
|
586
|
-
.transactionReviewLocalDataById, transactionId.id, undefined);
|
|
587
|
-
if (transactionLocalData != null) {
|
|
588
|
-
lineIds.forEach((lineId) => {
|
|
589
|
-
const lineItem = transactionLocalData.transactionReviewLocalData.lineItemById[lineId];
|
|
590
|
-
if (lineItem != null) {
|
|
591
|
-
transactionLocalData.transactionReviewLocalData.lineItemById[lineId] = {
|
|
592
|
-
...lineItem,
|
|
593
|
-
categoryClassRecommendationsFetchState: {
|
|
594
|
-
fetchState: 'Completed',
|
|
595
|
-
error: undefined,
|
|
596
|
-
},
|
|
597
|
-
};
|
|
598
|
-
}
|
|
599
|
-
});
|
|
600
|
-
}
|
|
601
|
-
},
|
|
602
|
-
prepare(selectedTab, transactionId, lineIds) {
|
|
603
|
-
return { payload: { selectedTab, transactionId, lineIds } };
|
|
604
|
-
},
|
|
605
|
-
},
|
|
606
|
-
// Failure arm. Flips covered lines to Error so the skeleton resolves
|
|
607
|
-
// and downstream UI can react to the failure. The transaction stays
|
|
608
|
-
// unchecked from the start-arm action.
|
|
609
|
-
markCategoryClassRecommendationsFailureForCategorization: {
|
|
610
|
-
reducer(draft, action) {
|
|
611
|
-
const { selectedTab, transactionId, lineIds, error } = action.payload;
|
|
612
|
-
const transactionLocalData = recordGet(draft.transactionCategorizationView[selectedTab]
|
|
613
|
-
.transactionReviewLocalDataById, transactionId.id, undefined);
|
|
614
|
-
if (transactionLocalData != null) {
|
|
615
|
-
lineIds.forEach((lineId) => {
|
|
616
|
-
const lineItem = transactionLocalData.transactionReviewLocalData.lineItemById[lineId];
|
|
617
|
-
if (lineItem != null) {
|
|
618
|
-
transactionLocalData.transactionReviewLocalData.lineItemById[lineId] = {
|
|
619
|
-
...lineItem,
|
|
620
|
-
categoryClassRecommendationsFetchState: {
|
|
621
|
-
fetchState: 'Error',
|
|
622
|
-
error,
|
|
623
|
-
},
|
|
624
|
-
};
|
|
625
|
-
}
|
|
626
|
-
});
|
|
627
|
-
}
|
|
628
|
-
},
|
|
629
|
-
prepare(selectedTab, transactionId, lineIds, error) {
|
|
630
|
-
return { payload: { selectedTab, transactionId, lineIds, error } };
|
|
631
|
-
},
|
|
632
|
-
},
|
|
633
526
|
fetchTransactionCategorizationSuccess(draft, action) {
|
|
634
527
|
const { selectedTab, refreshViewInBackground } = action.payload;
|
|
635
528
|
if (draft.transactionCategorizationView[selectedTab].fetchState ===
|
|
@@ -725,7 +618,9 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
725
618
|
.selectedCheckBoxTransactionIds;
|
|
726
619
|
if (newTransactionLocalData.customer != null &&
|
|
727
620
|
newTransactionLocalData.customer.id != null &&
|
|
728
|
-
|
|
621
|
+
checkIfAllLineItemsAreCategoryClassFilled(selectedTransaction, newTransactionLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) === true && // check if all line items are filled
|
|
622
|
+
selectedCheckBoxTransactionIds.length < MAX_SELECTION_LIMIT &&
|
|
623
|
+
selectedCheckBoxTransactionIds.includes(transactionId) === false) {
|
|
729
624
|
draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds = [
|
|
730
625
|
...selectedCheckBoxTransactionIds,
|
|
731
626
|
transactionId,
|
|
@@ -799,7 +694,9 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
799
694
|
.selectedCheckBoxTransactionIds;
|
|
800
695
|
if (newTransactionLocalData.vendor != null &&
|
|
801
696
|
newTransactionLocalData.vendor.id != null &&
|
|
802
|
-
|
|
697
|
+
checkIfAllLineItemsAreCategoryClassFilled(selectedTransaction, newTransactionLocalData, uncategorizedAccounts, isUncategorizedExpenseCategoryEnabled, isAccountingClassesEnabled) === true && // check if all line items are filled
|
|
698
|
+
selectedCheckBoxTransactionIds.length < MAX_SELECTION_LIMIT &&
|
|
699
|
+
selectedCheckBoxTransactionIds.includes(transactionId) === false) {
|
|
803
700
|
draft.transactionCategorizationView[selectedTab].selectedCheckBoxTransactionIds = [
|
|
804
701
|
...selectedCheckBoxTransactionIds,
|
|
805
702
|
transactionId,
|
|
@@ -1032,5 +929,5 @@ const expenseAutomationTransactionsView = createSlice({
|
|
|
1032
929
|
},
|
|
1033
930
|
},
|
|
1034
931
|
});
|
|
1035
|
-
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,
|
|
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;
|
|
1036
933
|
export default expenseAutomationTransactionsView.reducer;
|
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
import { createSelector } from '@reduxjs/toolkit';
|
|
2
1
|
import omit from 'lodash/omit';
|
|
3
2
|
import { reduceAllFetchState, reduceAnyFetchState, } from '../../../commonStateTypes/reduceFetchState';
|
|
4
3
|
import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
|
|
@@ -9,29 +8,6 @@ import { getAccountList, getNestedAccountListHierarchy, getUncategorizedAccounts
|
|
|
9
8
|
import { getClassList, getNestedClassListHierarchy, } from '../../classList/classListSelector';
|
|
10
9
|
import { getProjectList } from '../../projectList/projectListSelector';
|
|
11
10
|
import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes';
|
|
12
|
-
// Per-transaction "any line is fetching category/class recommendations?"
|
|
13
|
-
// map for the active categorization tab. Memoized on the active tab's
|
|
14
|
-
// transactionReviewLocalDataById reference, so steady state (no fetches
|
|
15
|
-
// in flight) recomputes only when local data changes — and the row-table
|
|
16
|
-
// can read a single map lookup per row instead of re-iterating the
|
|
17
|
-
// row's lineItemById in the render path.
|
|
18
|
-
export const getCategorizationInFlightRecommendationsByTransactionId = createSelector((state) => state.expenseAutomationTransactionsViewState
|
|
19
|
-
.selectedTransactionCategorizationTab, (state) => state.expenseAutomationTransactionsViewState
|
|
20
|
-
.transactionCategorizationView, (selectedTab, transactionCategorizationView) => {
|
|
21
|
-
const tab = transactionCategorizationView[selectedTab];
|
|
22
|
-
const result = {};
|
|
23
|
-
for (const [transactionId, data] of Object.entries(tab.transactionReviewLocalDataById)) {
|
|
24
|
-
const lineItems = Object.values(data.transactionReviewLocalData.lineItemById);
|
|
25
|
-
if (lineItems.some((lineItem) => lineItem.categoryClassRecommendationsFetchState?.fetchState ===
|
|
26
|
-
'In-Progress')) {
|
|
27
|
-
result[transactionId] = true;
|
|
28
|
-
}
|
|
29
|
-
}
|
|
30
|
-
return result;
|
|
31
|
-
});
|
|
32
|
-
// Page-level "any line on the active tab is in flight?" flag. Drives the
|
|
33
|
-
// list-page Save disable.
|
|
34
|
-
export const getCategorizationHasInFlightRecommendations = createSelector(getCategorizationInFlightRecommendationsByTransactionId, (inFlightByTransactionId) => Object.keys(inFlightByTransactionId).length > 0);
|
|
35
11
|
export function getExpenseAutomationTransactionView(state) {
|
|
36
12
|
const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, projectState, projectListState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
|
|
37
13
|
const { selectedTransactionCategorizationCompletedSubTab, selectedTransactionCategorizationTab, } = expenseAutomationTransactionsViewState;
|
|
@@ -127,8 +103,6 @@ export function getExpenseAutomationTransactionView(state) {
|
|
|
127
103
|
: [];
|
|
128
104
|
const transactionCompletionStatus = allSteps.find((step) => step.step === 'transaction_categorization')?.completionStatus;
|
|
129
105
|
const completionStatus = transactionCompletionStatus ?? 'incomplete';
|
|
130
|
-
const inFlightCategoryClassRecommendationsByTransactionId = getCategorizationInFlightRecommendationsByTransactionId(state);
|
|
131
|
-
const hasInFlightCategoryClassRecommendations = getCategorizationHasInFlightRecommendations(state);
|
|
132
106
|
return {
|
|
133
107
|
version: 0,
|
|
134
108
|
fetchState: fetchStatus.fetchState,
|
|
@@ -142,8 +116,6 @@ export function getExpenseAutomationTransactionView(state) {
|
|
|
142
116
|
classList: allClasses,
|
|
143
117
|
accountsHierarchyList,
|
|
144
118
|
classHierarchyList,
|
|
145
|
-
hasInFlightCategoryClassRecommendations,
|
|
146
|
-
inFlightCategoryClassRecommendationsByTransactionId,
|
|
147
119
|
isAccountingProjectsEnabled,
|
|
148
120
|
projectList,
|
|
149
121
|
transactionLocalData,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { transformRecommendation, transformRecommendationWithCOT, } from '../../entity/transaction/payloadTypes/transactionPayload';
|
|
2
|
-
import { getActualTransactionID } from '../transactionDetail/transactionDetailState';
|
|
3
2
|
export const getRecommendationFromRecommendationPayload = (payload) => {
|
|
4
3
|
if (payload == null || payload.length === 0) {
|
|
5
4
|
return undefined;
|
|
@@ -38,34 +37,6 @@ export const getRecommendationWithCOTFromRecommendationPayloadWithCOT = (payload
|
|
|
38
37
|
});
|
|
39
38
|
return recommendations;
|
|
40
39
|
};
|
|
41
|
-
// Pluralized URL segment for entity types. Mirrors the legacy
|
|
42
|
-
// fetchEntityRecommendationsByTransactionIdEpic.toEntityTypeURL.
|
|
43
|
-
const toEntityTypeUrlSegment = (entityType) => `${entityType}s`;
|
|
44
|
-
// Build the recommendations URL for a single entity + transaction target.
|
|
45
|
-
// Centralizes the URL shape so the legacy
|
|
46
|
-
// fetchEntityRecommendationsByTransactionIdEpic and the new
|
|
47
|
-
// fetchEntityRecommendationsForLineUpdateEpic stay in lockstep.
|
|
48
|
-
export const buildRecommendationUrl = (accountMicroServiceBaseUrl, entity, amount, transactionDetails, isFetchCOT) => {
|
|
49
|
-
const entityQuery = {
|
|
50
|
-
entity_name: entity.name,
|
|
51
|
-
entity_type: entity.type,
|
|
52
|
-
};
|
|
53
|
-
// Entity-id-null case: server expects entity_name / entity_type query
|
|
54
|
-
// instead of the {entityType}/{qboId}/recommendations path.
|
|
55
|
-
if (entity.qboId === entity.name) {
|
|
56
|
-
return `${accountMicroServiceBaseUrl}/1.0/recommendations?query=${encodeURIComponent(JSON.stringify(entityQuery))}`;
|
|
57
|
-
}
|
|
58
|
-
const query = {
|
|
59
|
-
amount,
|
|
60
|
-
transaction_id: getActualTransactionID(transactionDetails.transactionId.id),
|
|
61
|
-
transaction_type: transactionDetails.transaction.type,
|
|
62
|
-
line_ids: transactionDetails.lineIds,
|
|
63
|
-
};
|
|
64
|
-
if (isFetchCOT === true) {
|
|
65
|
-
query.include_cot = true;
|
|
66
|
-
}
|
|
67
|
-
return `${accountMicroServiceBaseUrl}/1.0/${toEntityTypeUrlSegment(entity.type)}/${entity.qboId}/recommendations?query=${encodeURIComponent(JSON.stringify(query))}`;
|
|
68
|
-
};
|
|
69
40
|
export const getRecommendationByLineIdWithCOTFromRecommendationPayloadWithCOT = (recommendationPayload, lineIds) => {
|
|
70
41
|
if (recommendationPayload.length === 0) {
|
|
71
42
|
return undefined;
|
|
@@ -33,41 +33,6 @@ const recommendation = createSlice({
|
|
|
33
33
|
};
|
|
34
34
|
},
|
|
35
35
|
},
|
|
36
|
-
// Targeted recommendations fetch fired when the user changes the
|
|
37
|
-
// payee/customer on a single transaction line (or the JE sibling set
|
|
38
|
-
// for that change). Routed by `fetchEntityRecommendationsForLineUpdateEpic`
|
|
39
|
-
// which uses groupBy + switchMap to keep fetches for distinct targets
|
|
40
|
-
// running in parallel while same-target re-fetches still cancel each
|
|
41
|
-
// other. The flowType discriminator selects the categorization vs
|
|
42
|
-
// detail slice for the per-line In-Progress / Completed / Error state.
|
|
43
|
-
fetchEntityRecommendationsForLineUpdate: {
|
|
44
|
-
reducer(draft, action) {
|
|
45
|
-
const { entity } = action.payload;
|
|
46
|
-
const key = getEntityRecommendationKey(entity.type, entity.id);
|
|
47
|
-
// Unconditional flip to In-Progress; the previous variant only
|
|
48
|
-
// seeded when missing, which left stale fetchStates when a prior
|
|
49
|
-
// fetch had already populated the entity entry.
|
|
50
|
-
draft.recommendationByEntity[key] = {
|
|
51
|
-
...(draft.recommendationByEntity[key] ??
|
|
52
|
-
initialEntityRecommendationState),
|
|
53
|
-
fetchState: 'In-Progress',
|
|
54
|
-
error: undefined,
|
|
55
|
-
};
|
|
56
|
-
},
|
|
57
|
-
prepare(entity, amount, transactionDetails, flowType, selectedTab, isFetchCOT = false, isUncategorizedExpenseCategoryEnabled) {
|
|
58
|
-
return {
|
|
59
|
-
payload: {
|
|
60
|
-
entity,
|
|
61
|
-
amount,
|
|
62
|
-
transactionDetails,
|
|
63
|
-
flowType,
|
|
64
|
-
selectedTab,
|
|
65
|
-
isFetchCOT,
|
|
66
|
-
isUncategorizedExpenseCategoryEnabled,
|
|
67
|
-
},
|
|
68
|
-
};
|
|
69
|
-
},
|
|
70
|
-
},
|
|
71
36
|
fetchRecommendationByEntityName: {
|
|
72
37
|
reducer(draft, action) {
|
|
73
38
|
const { entityName, entityType } = action.payload;
|
|
@@ -146,7 +111,7 @@ const recommendation = createSlice({
|
|
|
146
111
|
},
|
|
147
112
|
},
|
|
148
113
|
});
|
|
149
|
-
export const { fetchEntityRecommendationsByTransactionId,
|
|
114
|
+
export const { fetchEntityRecommendationsByTransactionId, fetchRecommendationByEntityName, fetchRecommendationByEntityId, updateRecommendationForEntity, updateRecommendationForEntityFailure, indicateReadyToInitializeRecommendation, clearRecommendation, } = recommendation.actions;
|
|
150
115
|
export default recommendation.reducer;
|
|
151
116
|
const doUpdateRecommendationForEntity = (draft, entityId, entityType, payload) => {
|
|
152
117
|
const key = getEntityRecommendationKey(entityType, entityId);
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
+
export const initialState = {
|
|
3
|
+
detailTemplateId: undefined,
|
|
4
|
+
detailFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
5
|
+
updateFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
6
|
+
formDraft: undefined,
|
|
7
|
+
};
|
|
8
|
+
const cardPolicyDetail = createSlice({
|
|
9
|
+
name: 'cardPolicyDetail',
|
|
10
|
+
initialState,
|
|
11
|
+
reducers: {
|
|
12
|
+
/**
|
|
13
|
+
* Kick off the `GET /cards/1.0/policy-templates/{id}` request. The
|
|
14
|
+
* accompanying epic dispatches `updateCreatedCardPolicyTemplate` on
|
|
15
|
+
* the entity slice + `updateCardPolicyFormDraft` (seeded from the
|
|
16
|
+
* template) + `updateCardPolicyDetailFetchStatus` here.
|
|
17
|
+
*/
|
|
18
|
+
fetchCardPolicyDetail: {
|
|
19
|
+
reducer(draft, action) {
|
|
20
|
+
draft.detailTemplateId = action.payload;
|
|
21
|
+
draft.detailFetchState.fetchState = 'In-Progress';
|
|
22
|
+
draft.detailFetchState.error = undefined;
|
|
23
|
+
// Reset the draft so a stale form from a previous template
|
|
24
|
+
// doesn't leak into the new edit session.
|
|
25
|
+
draft.formDraft = undefined;
|
|
26
|
+
},
|
|
27
|
+
prepare(templateId) {
|
|
28
|
+
return { payload: templateId };
|
|
29
|
+
},
|
|
30
|
+
},
|
|
31
|
+
updateCardPolicyDetailFetchStatus(draft, action) {
|
|
32
|
+
draft.detailFetchState.fetchState = action.payload.fetchState;
|
|
33
|
+
draft.detailFetchState.error = action.payload.error;
|
|
34
|
+
},
|
|
35
|
+
/**
|
|
36
|
+
* Replace (or seed) the local edit-form draft. Dispatched by the
|
|
37
|
+
* detail-fetch epic with the camelCased values pulled from the
|
|
38
|
+
* fetched template, and by the edit page itself as the user types.
|
|
39
|
+
*/
|
|
40
|
+
updateCardPolicyFormDraft(draft, action) {
|
|
41
|
+
draft.formDraft = action.payload;
|
|
42
|
+
},
|
|
43
|
+
/**
|
|
44
|
+
* Kick off the `PUT /cards/1.0/policy-templates/{id}` save. The
|
|
45
|
+
* epic reads the current `formDraft` from state, posts the wire
|
|
46
|
+
* body, then dispatches `updateCreatedCardPolicyTemplate` (entity)
|
|
47
|
+
* + `updateCardPolicyFetchStatus({fetchState: 'Completed'})` here.
|
|
48
|
+
*/
|
|
49
|
+
updateCardPolicy: {
|
|
50
|
+
reducer(draft,
|
|
51
|
+
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
52
|
+
_action) {
|
|
53
|
+
draft.updateFetchState.fetchState = 'In-Progress';
|
|
54
|
+
draft.updateFetchState.error = undefined;
|
|
55
|
+
},
|
|
56
|
+
prepare(templateId) {
|
|
57
|
+
return { payload: templateId };
|
|
58
|
+
},
|
|
59
|
+
},
|
|
60
|
+
updateCardPolicyFetchStatus(draft, action) {
|
|
61
|
+
draft.updateFetchState.fetchState = action.payload.fetchState;
|
|
62
|
+
draft.updateFetchState.error = action.payload.error;
|
|
63
|
+
},
|
|
64
|
+
clearCardPolicyDetail(draft) {
|
|
65
|
+
Object.assign(draft, initialState);
|
|
66
|
+
},
|
|
67
|
+
},
|
|
68
|
+
});
|
|
69
|
+
export const { fetchCardPolicyDetail, updateCardPolicyDetailFetchStatus, updateCardPolicyFormDraft, updateCardPolicy, updateCardPolicyFetchStatus, clearCardPolicyDetail, } = cardPolicyDetail.actions;
|
|
70
|
+
export default cardPolicyDetail.reducer;
|