@zeniai/client-epic-state 4.19.100 → 4.20.0-beta0ND
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/commonStateTypes/coaBalance/coaBalanceType.d.ts +2 -0
- package/lib/commonStateTypes/coaBalance/coaBalanceType.js +6 -0
- package/lib/commonStateTypes/currencyHelper.d.ts +3 -0
- package/lib/commonStateTypes/currencyHelper.js +6 -1
- package/lib/commonStateTypes/reduceFetchState.d.ts +9 -0
- package/lib/commonStateTypes/reduceFetchState.js +26 -0
- package/lib/entity/account/accountPayload.d.ts +2 -0
- package/lib/entity/account/accountPayload.js +2 -0
- package/lib/entity/account/accountState.d.ts +2 -0
- package/lib/entity/customer/customerState.d.ts +0 -2
- package/lib/entity/customer/customerState.js +0 -5
- package/lib/entity/depositAccount/depositAccount.d.ts +1 -1
- package/lib/entity/depositAccount/depositAccount.js +8 -1
- package/lib/entity/reimbursement/reimbursementPayload.d.ts +2 -0
- package/lib/entity/reimbursement/reimbursementPayload.js +7 -0
- package/lib/entity/reimbursement/reimbursementState.d.ts +2 -0
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/entity/task/taskPayload.d.ts +1 -0
- package/lib/entity/task/taskPayload.js +1 -0
- package/lib/entity/task/taskState.d.ts +1 -0
- package/lib/entity/userGroups/userGroupsPayload.d.ts +7 -0
- package/lib/entity/userGroups/userGroupsPayload.js +10 -0
- package/lib/entity/userGroups/userGroupsReducer.d.ts +8 -0
- package/lib/entity/userGroups/userGroupsReducer.js +29 -0
- package/lib/entity/userGroups/userGroupsSelector.d.ts +4 -0
- package/lib/entity/userGroups/userGroupsSelector.js +12 -0
- package/lib/entity/userGroups/userGroupsState.d.ts +9 -0
- package/lib/entity/userGroups/userGroupsState.js +2 -0
- package/lib/epic.d.ts +12 -1
- package/lib/epic.js +12 -1
- package/lib/esm/commonStateTypes/coaBalance/coaBalanceType.js +5 -0
- package/lib/esm/commonStateTypes/currencyHelper.js +5 -0
- package/lib/esm/commonStateTypes/reduceFetchState.js +25 -0
- package/lib/esm/entity/account/accountPayload.js +2 -0
- package/lib/esm/entity/customer/customerState.js +1 -4
- package/lib/esm/entity/depositAccount/depositAccount.js +8 -1
- package/lib/esm/entity/reimbursement/reimbursementPayload.js +7 -0
- package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
- package/lib/esm/entity/task/taskPayload.js +1 -0
- package/lib/esm/entity/userGroups/userGroupsPayload.js +7 -0
- package/lib/esm/entity/userGroups/userGroupsReducer.js +25 -0
- package/lib/esm/entity/userGroups/userGroupsSelector.js +8 -0
- package/lib/esm/entity/userGroups/userGroupsState.js +1 -0
- package/lib/esm/epic.js +12 -1
- package/lib/esm/index.js +18 -10
- package/lib/esm/reducer.js +6 -0
- package/lib/esm/view/arAgingView/arAgingReport/arAgingReducer.js +1 -1
- package/lib/esm/view/arAgingView/arAgingReport/arAgingSelector.js +1 -1
- package/lib/esm/view/expenseAutomationView/bulkUploadTiming.js +10 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +29 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +49 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +40 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +47 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +61 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +33 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +56 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +77 -0
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +7 -5
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +79 -0
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +24 -0
- package/lib/esm/view/expenseAutomationView/payload/missingReceiptsPayload.js +189 -1
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +433 -2
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +23 -1
- package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +244 -1
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
- package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +44 -0
- package/lib/esm/view/expenseAutomationView/types/transactionsViewState.js +2 -1
- package/lib/esm/view/financeStatement/financeStatementReducer.js +11 -8
- package/lib/esm/view/financeStatement/financeStatementSelector.js +24 -9
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +317 -0
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +9 -0
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +6 -1
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -29
- package/lib/esm/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +7 -5
- package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +282 -0
- package/lib/esm/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.js +9 -7
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +1 -1
- package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +1 -0
- package/lib/esm/view/taskManager/taskListView/taskListSelector.js +3 -1
- package/lib/esm/view/twoFactorAuthentication/resendOtpEpic.js +2 -16
- package/lib/esm/view/userGroupListView/userGroupListViewReducer.js +65 -0
- package/lib/esm/view/userGroupListView/userGroupListViewSelector.js +16 -0
- package/lib/esm/view/userGroupListView/userGroupListViewState.js +1 -0
- package/lib/esm/view/userListView/fetchUserListByTypeEpic.js +11 -0
- package/lib/esm/zeniAPI.js +0 -2
- package/lib/index.d.ts +19 -12
- package/lib/index.js +81 -23
- package/lib/reducer.d.ts +6 -0
- package/lib/reducer.js +6 -0
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
- package/lib/view/arAgingView/arAgingReport/arAgingReducer.js +2 -2
- package/lib/view/arAgingView/arAgingReport/arAgingSelector.js +5 -5
- package/lib/view/expenseAutomationView/bulkUploadTiming.d.ts +10 -0
- package/lib/view/expenseAutomationView/bulkUploadTiming.js +13 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.d.ts +18 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +33 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.d.ts +7 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +53 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +44 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.d.ts +7 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +51 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +65 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.d.ts +8 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +37 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +61 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.d.ts +14 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +81 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +7 -5
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +25 -0
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +85 -0
- package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.d.ts +7 -0
- package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +28 -0
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.d.ts +118 -0
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +201 -0
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +76 -3
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +434 -2
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +11 -3
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +24 -2
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +69 -1
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +1 -0
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.d.ts +1 -1
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +243 -0
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +142 -0
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +54 -1
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -1
- package/lib/view/expenseAutomationView/types/transactionsViewState.js +2 -1
- package/lib/view/financeStatement/financeStatementReducer.js +11 -8
- package/lib/view/financeStatement/financeStatementSelector.d.ts +2 -0
- package/lib/view/financeStatement/financeStatementSelector.js +24 -9
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.d.ts +13 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +321 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.d.ts +111 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +13 -0
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.d.ts +4 -2
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +7 -2
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -29
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewState.d.ts +4 -0
- package/lib/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +7 -5
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.d.ts +6 -0
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +285 -0
- package/lib/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.js +8 -6
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +1 -1
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +1 -0
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +1 -0
- package/lib/view/taskManager/taskListView/taskListSelector.d.ts +2 -0
- package/lib/view/taskManager/taskListView/taskListSelector.js +3 -1
- package/lib/view/twoFactorAuthentication/resendOtpEpic.d.ts +1 -1
- package/lib/view/twoFactorAuthentication/resendOtpEpic.js +1 -15
- package/lib/view/userGroupListView/userGroupListViewReducer.d.ts +23 -0
- package/lib/view/userGroupListView/userGroupListViewReducer.js +69 -0
- package/lib/view/userGroupListView/userGroupListViewSelector.d.ts +7 -0
- package/lib/view/userGroupListView/userGroupListViewSelector.js +20 -0
- package/lib/view/userGroupListView/userGroupListViewState.d.ts +8 -0
- package/lib/view/userGroupListView/userGroupListViewState.js +2 -0
- package/lib/view/userListView/fetchUserListByTypeEpic.d.ts +3 -1
- package/lib/view/userListView/fetchUserListByTypeEpic.js +11 -0
- package/lib/view/userListView/userListViewPayload.d.ts +2 -0
- package/lib/zeniAPI.js +0 -2
- package/package.json +3 -3
package/lib/esm/index.js
CHANGED
|
@@ -2,9 +2,10 @@ import { isAllowedValueWithCode, isAllowedValueWithID, } from './commonStateType
|
|
|
2
2
|
import { toAmount } from './commonStateTypes/amount';
|
|
3
3
|
import { getTimeframeTickTag, isIncompleteMonthPresentInTimeframeTick, } from './commonStateTypes/bookCloseDateHelper';
|
|
4
4
|
import { toCOABalanceTimeframe, } from './commonStateTypes/coaBalance/coaBalance';
|
|
5
|
-
import { isCalculatedBalanceType, toCOABalanceType, toCOABalanceTypeStrict, } from './commonStateTypes/coaBalance/coaBalanceType';
|
|
5
|
+
import { isCalculatedBalanceType, stripCompareAdditionalBalanceTypes, toCOABalanceType, toCOABalanceTypeStrict, } from './commonStateTypes/coaBalance/coaBalanceType';
|
|
6
6
|
import { newBalancesFilter, newBalancesFilterForDateRange, toCOABalancesOrderStrict, } from './commonStateTypes/coaBalance/coaBalancesFilter';
|
|
7
7
|
import { newBalancesFilterClassesView, } from './commonStateTypes/coaBalance/coaBalancesFilterClassesView';
|
|
8
|
+
import { defaultCustomerCurrency } from './commonStateTypes/currencyHelper';
|
|
8
9
|
import { getNumberOfPeriods } from './commonStateTypes/dataAvailable';
|
|
9
10
|
import { ALL_FILE_TYPES, toFileTypeStrict, } from './commonStateTypes/fileType';
|
|
10
11
|
import { addPeriod, subtractPeriod, } from './commonStateTypes/fiscalYearHelpers/addSubtractPeriod';
|
|
@@ -14,7 +15,7 @@ import { getActualPeriodOfFY, getActualPeriodOfFYQtr, } from './commonStateTypes
|
|
|
14
15
|
import { getFYMonths } from './commonStateTypes/fiscalYearHelpers/getFYMonths';
|
|
15
16
|
import { getFYQuarterAndYear, getLastMonthOfFYQuarter, getLastMonthOfFYYear, } from './commonStateTypes/fiscalYearHelpers/getFYQuarterAndYear';
|
|
16
17
|
import { getStartOfAndEndOfTimeframeForFY } from './commonStateTypes/fiscalYearHelpers/getStartOfAndEndOfTimeframeFY';
|
|
17
|
-
import { isAllFetchCompleted, isAnyFetchInProgress, reduceAllFetchState, reduceAnyCompletedFetchState, reduceAnyFetchState, reduceFetchState, } from './commonStateTypes/reduceFetchState';
|
|
18
|
+
import { isAllFetchCompleted, isAnyFetchInProgress, reduceAllFetchState, reduceAnyCompletedFetchState, reduceAnyFetchState, reduceFetchState, reduceFetchStateParallelTimeframes, } from './commonStateTypes/reduceFetchState';
|
|
18
19
|
import { toReimbursementTypeCode } from './commonStateTypes/reimbursementTypeCode';
|
|
19
20
|
import { stringToUnion, stringToUnionStrict, } from './commonStateTypes/stringToUnion';
|
|
20
21
|
import { SCHEDULE_DAYS_OF_MONTH, convertToPeriod, toAbsoluteDay, toMonth, toMonthStrict, toMonthYearPeriodId, toQuarter, toQuarterStrict, toScheduleDaysOfMonth, } from './commonStateTypes/timePeriod';
|
|
@@ -40,7 +41,6 @@ import { getControllersName, getFirstControllerEmail, getFirstControllerId, } fr
|
|
|
40
41
|
import { getCompanyByCompanyId, getCompanyInfoForAllCockpitCompaniesInState, getControllersForCompany, } from './entity/company/companySelector';
|
|
41
42
|
import { ALL_ACCOUNTING_CONNECTION_CREATION_MODES, isCompanyEligibleForTreasury, } from './entity/company/companyStateTypes';
|
|
42
43
|
import { updateCompaniesHealth, updateCompanyHealth, } from './entity/companyHealthMetric/companyHealthMetricReducer';
|
|
43
|
-
import { defaultCustomerCurrency, } from './entity/customer/customerState';
|
|
44
44
|
import { CustomerIncomeTrend } from './entity/customerIncome/customerIncomeTrend';
|
|
45
45
|
import { getDepositAccountLimitForChargeCardByDepositAccountId } from './entity/depositAccount/depositAccountSelector';
|
|
46
46
|
import { mapAttachmentFilePayloadToFile, mapAttachmentFileToAttachmentFilePayload, mapFilePayloadToFile, removeAttachmentFiles, updateAttachmentFiles, updateFiles, } from './entity/file/fileReducer';
|
|
@@ -163,12 +163,13 @@ import { isReviewTransactionBankTransferType, isReviewTransactionBillPaymentType
|
|
|
163
163
|
import { MAX_SELECTION_LIMIT, checkIfAllLineItemsAreCategoryClassFilled, getLineItemsByTransactionIdsFromLocalData, isAnyItemWithUncategorizedExpenseAccount, } from './view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper';
|
|
164
164
|
import { clearExpenseAutomationFluxAnalysisView, fetchFluxAnalysisView, reviewFluxAnalysisView, updateFluxAnalysisViewPageMetaData, updateFluxAnalysisViewUIState, updateOperatingExpensesIdsForReview, updateSelectedSectionIdsForReview, } from './view/expenseAutomationView/reducers/fluxAnalysisViewReducer';
|
|
165
165
|
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, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, } from './view/expenseAutomationView/reducers/jeSchedulesViewReducer';
|
|
166
|
-
import { fetchMissingReceipts as fetchExpenseAutomationMissingReceipts, markMissingReceiptAsDone as markExpenseAutomationMissingReceiptAsDone, updateMissingReceiptUploadState as updateExpenseAutomationMissingReceiptUploadState, updateMissingReceiptsUIState as updateExpenseAutomationMissingReceiptsUIState, uploadMissingReceiptSuccess as uploadExpenseAutomationMissingReceiptSuccess, } from './view/expenseAutomationView/reducers/missingReceiptsViewReducer';
|
|
166
|
+
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, searchTransactionsForManualMatch, searchTransactionsForManualMatchFailure, searchTransactionsForManualMatchSuccess, setBulkUploadCompletedSubTab, setBulkUploadResultsTab, setBulkUploadSortConfig, storeBatchDetails, updateBulkUploadProgress, updateMissingReceiptUploadState as updateExpenseAutomationMissingReceiptUploadState, updateMissingReceiptsUIState as updateExpenseAutomationMissingReceiptsUIState, uploadMissingReceiptSuccess as uploadExpenseAutomationMissingReceiptSuccess, } from './view/expenseAutomationView/reducers/missingReceiptsViewReducer';
|
|
167
167
|
import { deleteAccountStatement, fetchReconciliation as fetchReconciliationView, 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, updateStatementUploadChosen, uploadAccountStatement, } from './view/expenseAutomationView/reducers/reconciliationViewReducer';
|
|
168
|
-
import { backgroundRefetchReviewTab, clearExpenseAutomationTransactionsView, fetchTransactionCategorization, fetchTransactionCategorizationFailure, fetchTransactionCategorizationView, initializeTransactionCategorizationViewLocalData, markTransactionAsNotMiscategorized, saveTransactionCategorization, saveTransactionCategorizationLocalData, setAllItemsToCategoryClassInLocalDataForCategorization, setEntityRecommendationForLineIdsForCategorization, syncTransactionCategorizationFromDetailSave, updateCurrentSelectedTransactionCategorizationTab, updateSelectedCheckboxTransactionIds, updateSelectedCustomerForTransaction, updateSelectedTransactionId, updateSelectedVendorForTransaction, updateTransactionCategorization, updateTransactionCategorizationSaveStatus, updateTransactionCategorizationUIState, } from './view/expenseAutomationView/reducers/transactionsViewReducer';
|
|
168
|
+
import { backgroundRefetchReviewTab, clearExpenseAutomationTransactionsView, fetchTransactionCategorization, fetchTransactionCategorizationFailure, fetchTransactionCategorizationView, initializeTransactionCategorizationViewLocalData, markTransactionAsNotMiscategorized, saveTransactionCategorization, saveTransactionCategorizationLocalData, setAllItemsToCategoryClassInLocalDataForCategorization, setEntityRecommendationForLineIdsForCategorization, syncTransactionCategorizationFromDetailSave, updateCurrentSelectedTransactionCategorizationTab, updateSelectedCheckboxTransactionIds, updateSelectedCustomerForTransaction, updateSelectedTransactionId, updateSelectedVendorForTransaction, updateTransactionCategorization, updateTransactionCategorizationSaveStatus, updateTransactionCategorizationUIState, updateTransactionCategorizationUploadReceiptState, uploadTransactionCategorizationReceiptSuccess, } from './view/expenseAutomationView/reducers/transactionsViewReducer';
|
|
169
169
|
import { getExpenseAutomationFluxAnalysisView } from './view/expenseAutomationView/selectors/fluxAnalysisViewSelector';
|
|
170
170
|
import { getExpenseAutomationReconciliationView, isAccountReconReport, } from './view/expenseAutomationView/selectors/reconciliationViewSelector';
|
|
171
171
|
import { getExpenseAutomationTransactionView } from './view/expenseAutomationView/selectors/transactionCategorizationSelector';
|
|
172
|
+
import { BATCH_FILE_STATUSES, isUnmatchedTabFileStatus, toBatchFileStatus, toBatchStatusValue, toBulkUploadPhase, toBulkUploadResultsTab, toBulkUploadSortKey, toCompletedSubTab, toMatchSource, toMissingReceiptsTab, } from './view/expenseAutomationView/types/missingReceiptsViewState';
|
|
172
173
|
import { toMissingReceiptsSortKey as toExpenseAutomationMissingReceiptsSortKey, } from './view/expenseAutomationView/types/missingReceiptsViewState';
|
|
173
174
|
import { toReconciliationTabsType, } from './view/expenseAutomationView/types/reconciliationViewState';
|
|
174
175
|
import { toTransactionsTabKey as toExpenseAutomationTransactionsTabKey, toTransactionsSortKey, } from './view/expenseAutomationView/types/transactionsViewState';
|
|
@@ -216,7 +217,9 @@ import { changeZeniPersonRoles, deletePerson, fetchAllPeopleRequiredViews, fetch
|
|
|
216
217
|
import { getPeople, getPeopleLocalData } from './view/people/peopleSelector';
|
|
217
218
|
import { fetchProfitAndLoss, fetchProfitAndLossForTimeframe, resetProfitAndLossNodeCollapseState, updateProfitAndLossUIState, } from './view/profitAndLoss/profitAndLossReducer';
|
|
218
219
|
import { getPandLReportFetchState, getProfitAndLossReport, } from './view/profitAndLoss/profitAndLossSelector';
|
|
219
|
-
import {
|
|
220
|
+
import { getProfitAndLossClassesHorizontalView } from './view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector';
|
|
221
|
+
import { HORIZONTAL_CLASS_TOTAL_BALANCE_ID, isHorizontalAccountReportData, } from './view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes';
|
|
222
|
+
import { fetchProfitAndLossClassesView, resetProfitAndLossClassesNodeCollapseState, updateClassViewLayout, updateAccountViewMode as updateProfitAndLossAccountViewMode, updateClassesToFilterOut as updateProfitAndLossClassesToFilterOut, updateProfitAndLossClassesViewUIState, } from './view/profitAndLossClassesView/profitAndLossClassesViewReducer';
|
|
220
223
|
import { getProfitAndLossClassesView } from './view/profitAndLossClassesView/profitAndLossClassesViewSelector';
|
|
221
224
|
import { isPandLReportViewCalculatedSectionID, isPandLReportViewSectionID, } from './view/profitAndLossClassesView/profitAndLossClassesViewSelectorTypes';
|
|
222
225
|
import { fetchEntityRecommendationsByTransactionId, fetchRecommendationByEntityId, fetchRecommendationByEntityName, } from './view/recommendation/recommendationReducer';
|
|
@@ -412,10 +415,14 @@ export { toReportID, toReportFormatStrict, isCashFlowOrBalanceSheetReport, isDas
|
|
|
412
415
|
export { toCOABalanceTimeframe, };
|
|
413
416
|
export { toCOABalancesOrderStrict, newBalancesFilter, newBalancesFilterForDateRange, };
|
|
414
417
|
export { newBalancesFilterClassesView };
|
|
415
|
-
export { toCOABalanceTypeStrict, toCOABalanceType as toCOABlanaceType, isCalculatedBalanceType, };
|
|
418
|
+
export { toCOABalanceTypeStrict, toCOABalanceType as toCOABlanaceType, isCalculatedBalanceType, stripCompareAdditionalBalanceTypes, };
|
|
416
419
|
export { stringToUnion, stringToUnionStrict };
|
|
417
420
|
export { fetchMonthEndCloseChecks, fetchMonthClosePerformanceTrend, getMonthEndCloseChecksViewByTenantId, ALL_MONTH_END_CLOSE_CHECKS_FREQUENCY, };
|
|
418
|
-
export {
|
|
421
|
+
export {
|
|
422
|
+
// Bulk Upload Types
|
|
423
|
+
BATCH_FILE_STATUSES, isUnmatchedTabFileStatus, toBatchFileStatus, toBatchStatusValue, toBulkUploadPhase, toBulkUploadResultsTab, toBulkUploadSortKey, toCompletedSubTab, toMatchSource, toMissingReceiptsTab, getExpenseAutomationView, toExpenseAutomationMissingReceiptsSortKey, toExpenseAutomationTransactionsTabKey, toExpenseAutomationViewType, uploadExpenseAutomationMissingReceiptSuccess, markExpenseAutomationMissingReceiptAsDone, fetchAllExpenseAutomationTabs, refreshExpenseAutomationCurrentTab, updateCurrentSelectedTransactionCategorizationTab, fetchExpenseAutomationMissingReceipts,
|
|
424
|
+
// Bulk Upload Actions
|
|
425
|
+
bulkUploadReceipts, bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, bulkUploadReceiptsFailure, updateBulkUploadProgress, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation, clearMissingReceiptsTabNavigation, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatchDetailsFailure, storeBatchDetails, fetchMoreBatchDetails, fetchMoreBatchDetailsComplete, fetchMoreBatchDetailsFailure, fetchBulkUploadBatches, fetchBulkUploadBatchesSuccess, fetchBulkUploadBatchesFailure, confirmBulkUploadMatch, confirmBulkUploadMatchSuccess, confirmBulkUploadMatchFailure, setBulkUploadResultsTab, setBulkUploadCompletedSubTab, setBulkUploadSortConfig, 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, saveExpenseAutomationReconciliationDetail, updateExpenseAutomationReconcileTabListScrollState, updateExpenseAutomationReconReviewTabListSortState, updateExpenseAutomationReconcileTabListSortState, updateExpenseAutomationReconcileTabLocalData, updateExpenseAutomationAccountReconciliationSelectedTab, updateExpenseAutomationAccountReconciliationSelectedAccountId, getExpenseAutomationReconciliationView, fetchReconciliationView, uploadAccountStatementIntoDocumentAI, updateExpenseAutomationReconListScrollPosition, setConnectionInProgressForAccountReconciliation, getAccountReconByAccountIdAndSelectedPeriod, toReconciliationTabsType, isAccountReconReport, updateExpenseAutomationReconReviewTabLocalData, updateExpenseAutomationSelectedDrawerAccountId, saveExpenseAutomationReconciliationReview, updateExpenseAutomationAccountReconciliationLocalData, toReconciliationAccountSource, deleteAccountStatement, uploadAccountStatement, updateStatementUploadChosen, isReviewTransactionBankTransferType, isReviewTransactionBillPaymentType, isReviewTransactionCreditCardPaymentType, isReviewTransactionDepositType, isReviewTransactionExpenseType, isReviewTransactionCreditCardCreditType, setStatementParseInProgress, };
|
|
419
426
|
export { fetchTransactionCategorization, fetchTransactionCategorizationView, updateTransactionCategorizationUIState, updateSelectedCheckboxTransactionIds, setEntityRecommendationForLineIdsForCategorization, initializeTransactionCategorizationViewLocalData, setAllItemsToCategoryClassInLocalDataForCategorization, saveTransactionCategorizationLocalData, fetchTransactionCategorizationFailure, saveTransactionCategorization, updateTransactionCategorization, updateTransactionCategorizationSaveStatus, markTransactionAsNotMiscategorized, updateSelectedVendorForTransaction, updateSelectedCustomerForTransaction, updateSelectedTransactionId, syncTransactionCategorizationFromDetailSave, backgroundRefetchReviewTab, clearExpenseAutomationTransactionsView, toTransactionsSortKey, };
|
|
420
427
|
export { TOP_EX_TIME_PERIODS };
|
|
421
428
|
export { toTimeframeTick, mapTimePeriodtoTimeframeTick, toTimePeriod, toAbsoluteDay, toMonthYearPeriodId, convertToPeriod, };
|
|
@@ -446,7 +453,7 @@ export { fetchDashboard, getDashboard, updateTreasuryVideoClosed, };
|
|
|
446
453
|
export { updateDashboardLayout };
|
|
447
454
|
export { getPandLWithForecast, } from './view/profitAndLoss/pAndLWithForecast/pAndLWithForecastSelector';
|
|
448
455
|
export { fetchProfitAndLoss, resetProfitAndLossNodeCollapseState, updateProfitAndLossUIState, getProfitAndLossReport, getPandLReportFetchState, fetchProfitAndLossForTimeframe, };
|
|
449
|
-
export { fetchProfitAndLossClassesView, updateProfitAndLossClassesToFilterOut, resetProfitAndLossClassesNodeCollapseState, updateProfitAndLossClassesViewUIState, updateProfitAndLossAccountViewMode, getProfitAndLossClassesView, isPandLReportViewCalculatedSectionID, isPandLReportViewSectionID, };
|
|
456
|
+
export { fetchProfitAndLossClassesView, updateProfitAndLossClassesToFilterOut, resetProfitAndLossClassesNodeCollapseState, updateProfitAndLossClassesViewUIState, updateProfitAndLossAccountViewMode, updateClassViewLayout, getProfitAndLossClassesView, getProfitAndLossClassesHorizontalView, isPandLReportViewCalculatedSectionID, isPandLReportViewSectionID, HORIZONTAL_CLASS_TOTAL_BALANCE_ID, isHorizontalAccountReportData, };
|
|
450
457
|
export { getAccountingProviderAttachment };
|
|
451
458
|
export { fetchUserListByType, getUserList };
|
|
452
459
|
export { fetchAllPeopleRequiredViews, fetchPeoplePage, fetchPeople, deletePerson, resendInvite, changeZeniPersonRoles, invitePeople, inviteZeniPeople, updatePeopleUIState, peopleSaveUpdates, resetUpdateErrorMessage, peopleSaveDataInLocalStore, peopleClearDataInLocalStore, getPeople, getPeopleLocalData, initializeEditPerson, };
|
|
@@ -538,7 +545,7 @@ export { saveRealTimeApproval, updateIsEditModeRealTimeApprovals, };
|
|
|
538
545
|
export { deleteRemi, fetchRemiDetail, cancelAndDeleteRemi, approveOrRejectRemi, clearRemiDetailView, fetchDuplicateReimbursement, clearDuplicateReimbursementDetail, removeDuplicateReimbursementByLineId, };
|
|
539
546
|
export { getEditRemiDetail, };
|
|
540
547
|
export { fetchEditRemiDetailPage, fetchRecommendationsAndUpdateMerchantRecommendations, fetchRemiAndInitializeLocalStore, initializeRemiToLocalStore, saveRemiUpdatesToLocalStore, fetchCurrencyConversionValue, discardRemiUpdatesInLocalStore, removeFileFromRemiUpdatesInLocalStore, saveRemiDetail, saveRemiSuccessOrFailure, parseReceiptsToRemi, clearEditRemiViewDetail, updateAddRemiAutoFields, updateUploadFetchState, updateTentativeMerchantNames, clearTentativeMerchantName, updateReimbursementType, updateHomeCurrencyConversion, clearAddRemiAutoFields, };
|
|
541
|
-
export { reduceFetchState, reduceAnyFetchState, reduceAllFetchState, reduceAnyCompletedFetchState, isAnyFetchInProgress, isAllFetchCompleted, ALL_FILE_TYPES, toFileTypeStrict, };
|
|
548
|
+
export { reduceFetchState, reduceFetchStateParallelTimeframes, reduceAnyFetchState, reduceAllFetchState, reduceAnyCompletedFetchState, isAnyFetchInProgress, isAllFetchCompleted, ALL_FILE_TYPES, toFileTypeStrict, };
|
|
542
549
|
export { getNextNthWorkingDay, getPreviousNthWorkingDay, isHolidayToday, filterDays, getYearsList, isHoliday, holidaysFormatted, PAYMENT_BUSINESS_DAYS, };
|
|
543
550
|
export { fetchCompanyOnboardingView, fetchQBOConnectionPool, updateQBOConnectionPoolExternalConnection, fetchOnboardingCompletedCompanies, saveOnboardingCustomerCompletedStatus, toProductType, toProductTypeStrict, getOnboardingCockpitView, getNewOnboardingCustomerView, getOnboardingEmailGroup, initializeOnboardingCustomerViewUpdateData, clearOnboardingCustomerViewUpdateData, saveOnboardingCustomerViewUpdateData, updateOnboardingCustomerListUIState, updateCustomerCreationStatus, updateStatusAfterOnboardingCompleted, saveOnboardingCustomerViewUpdates, saveOnboardingCustomerNotes, saveOnboardingCustomerDataInLocalStore, updateOnboardingCustomerDataInLocalStore, resetNewOnboardedCustomerId, sendOnboardingCustomerViewInvite, retryBankAccountConnectionForOnboarding, };
|
|
544
551
|
export { getTransactionsListByCategoryType, getTransactionListUIStateByCategoryType, };
|
|
@@ -607,5 +614,6 @@ export { fetchTreasuryStatementList } from './view/spendManagement/treasury/trea
|
|
|
607
614
|
export { getTreasuryStatements, } from './view/spendManagement/treasury/treasuryStatementList/treasuryStatementListSelector';
|
|
608
615
|
export { fetchTreasuryTaxLetterList } from './view/spendManagement/treasury/treasuryTaxLetterList/treasuryTaxLetterListReducer';
|
|
609
616
|
export { getTreasuryTaxLetters, } from './view/spendManagement/treasury/treasuryTaxLetterList/treasuryTaxLetterListSelector';
|
|
617
|
+
export { BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS, BULK_UPLOAD_BAR_COMPLETE_HOLD_MS, } from './view/expenseAutomationView/bulkUploadTiming';
|
|
610
618
|
export { fetchTransactionActivityLog } from './view/transactionActivityLogView/transactionActivityLogViewReducer';
|
|
611
619
|
export { getTransactionActivityLogView, } from './view/transactionActivityLogView/transactionActivityLogViewSelector';
|
package/lib/esm/reducer.js
CHANGED
|
@@ -58,6 +58,7 @@ import toastNotification, { initialState as initialToastNotificationState, } fro
|
|
|
58
58
|
import transaction, { initialState as initialTransactionState, } from './entity/transaction/transactionReducer';
|
|
59
59
|
import transactionActivityLog, { initialState as initialTransactionActivityLogState, } from './entity/transactionActivityLog/transactionActivityLogReducer';
|
|
60
60
|
import user, { initialState as initialUserState, } from './entity/user/userReducer';
|
|
61
|
+
import userGroups, { initialState as initialUserGroupsState, } from './entity/userGroups/userGroupsReducer';
|
|
61
62
|
import userRole, { initialState as initialUserRoleState, } from './entity/userRole/userRoleReducer';
|
|
62
63
|
import vendor, { initialState as initialVendorState, } from './entity/vendor/vendorReducer';
|
|
63
64
|
import vendorExpense, { initialState as initialVendorExpenseState, } from './entity/vendorExpense/vendorExpenseReducer';
|
|
@@ -198,6 +199,7 @@ import trend, { initialTrendState } from './view/trend/trendReducer';
|
|
|
198
199
|
import trendWithTransactions, { initialTrendWithTransactionsState, } from './view/trendWithTransactions/trendWithTransactionsReducer';
|
|
199
200
|
import twoFactorAuthentication, { initialState as initialTwoFactorAuthenticationState, } from './view/twoFactorAuthentication/twoFactorAuthenticationReducer';
|
|
200
201
|
import userFinancialAccountState, { initialState as initialUserFinancialAccountState, } from './view/userFinancialAccount/userFinancialAccountReducer';
|
|
202
|
+
import userGroupListView, { initialState as initialUserGroupListViewState, } from './view/userGroupListView/userGroupListViewReducer';
|
|
201
203
|
import userListView, { initialState as initialUserListViewState, } from './view/userListView/userListViewReducer';
|
|
202
204
|
import userRoleConfig, { initialState as initialUserRoleConfigState, } from './view/userRoleConfigView/userRoleConfigReducer';
|
|
203
205
|
import vendor1099TypeList, { initialState as initialVendor1099TypeListState, } from './view/vendor1099TypeList/vendor1099TypeListReducer';
|
|
@@ -270,6 +272,7 @@ const initialEntitiesState = {
|
|
|
270
272
|
toastNotificationState: initialToastNotificationState,
|
|
271
273
|
transactionActivityLogState: initialTransactionActivityLogState,
|
|
272
274
|
transactionState: initialTransactionState,
|
|
275
|
+
userGroupsState: initialUserGroupsState,
|
|
273
276
|
userRoleState: initialUserRoleState,
|
|
274
277
|
userState: initialUserState,
|
|
275
278
|
vendorExpenseState: initialVendorExpenseState,
|
|
@@ -408,6 +411,7 @@ const initialViewsState = {
|
|
|
408
411
|
trendWithTransactionsState: initialTrendWithTransactionsState,
|
|
409
412
|
twoFactorAuthenticationState: initialTwoFactorAuthenticationState,
|
|
410
413
|
userFinancialAccountState: initialUserFinancialAccountState,
|
|
414
|
+
userGroupListViewState: initialUserGroupListViewState,
|
|
411
415
|
userListViewState: initialUserListViewState,
|
|
412
416
|
userRoleConfigState: initialUserRoleConfigState,
|
|
413
417
|
vendorFirstReviewViewState: initialVendorFirstReviewViewState,
|
|
@@ -492,6 +496,7 @@ const entityReducers = {
|
|
|
492
496
|
toastNotificationState: toastNotification,
|
|
493
497
|
transactionActivityLogState: transactionActivityLog,
|
|
494
498
|
transactionState: transaction,
|
|
499
|
+
userGroupsState: userGroups,
|
|
495
500
|
userRoleState: userRole,
|
|
496
501
|
userState: user,
|
|
497
502
|
vendorExpenseState: vendorExpense,
|
|
@@ -630,6 +635,7 @@ const viewReducers = {
|
|
|
630
635
|
trendWithTransactionsState: trendWithTransactions,
|
|
631
636
|
twoFactorAuthenticationState: twoFactorAuthentication,
|
|
632
637
|
userFinancialAccountState: userFinancialAccountState,
|
|
638
|
+
userGroupListViewState: userGroupListView,
|
|
633
639
|
userListViewState: userListView,
|
|
634
640
|
userRoleConfigState: userRoleConfig,
|
|
635
641
|
vendorFirstReviewViewState: vendorFirstReviewView,
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { createSlice } from '@reduxjs/toolkit';
|
|
2
2
|
import { mapReportPayloadV2ToReportV2 } from '../../../commonPayloadTypes/v2/viewAndReportPayloadv2';
|
|
3
3
|
import { getAgingBalancesKey, toAgingPeriod, } from '../../../commonStateTypes/agingBalance/agingBalance';
|
|
4
|
+
import { defaultCustomerCurrency } from '../../../commonStateTypes/currencyHelper';
|
|
4
5
|
import { getNestedCustomerHierarchy } from '../../../commonStateTypes/customerView/getNestedCustomerHierarchy';
|
|
5
6
|
import { toCustomer } from '../../../entity/customer/customerPayload';
|
|
6
|
-
import { defaultCustomerCurrency } from '../../../entity/customer/customerState';
|
|
7
7
|
import { dateNow } from '../../../zeniDayJS';
|
|
8
8
|
import { toArAgingDataByCustomerId, toArAgingTotals, } from './arAgingPayload';
|
|
9
9
|
export const inititalUIState = {
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { createSelector } from '@reduxjs/toolkit';
|
|
2
2
|
import orderBy from 'lodash/orderBy';
|
|
3
3
|
import { getAgingBalancesKey, } from '../../../commonStateTypes/agingBalance/agingBalance';
|
|
4
|
+
import { defaultCustomerCurrency } from '../../../commonStateTypes/currencyHelper';
|
|
4
5
|
import { getCustomer } from '../../../entity/customer/customerSelector';
|
|
5
|
-
import { defaultCustomerCurrency, } from '../../../entity/customer/customerState';
|
|
6
6
|
export const getArAgingReport = createSelector((state) => state.arAgingState, (state) => state.customerState, (arAgingState, customerState) => {
|
|
7
7
|
const { reportId, reportTitle, fetchState, uiState, firstMonthOfFY, agingPeriods, } = arAgingState;
|
|
8
8
|
const { searchString, sortOrder, sortKey, selectedDate } = uiState;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* After upload API success, hold the bar at 100% this long before transitioning to matching,
|
|
3
|
+
* so the fill animation can complete without an abrupt swap to the auto-matching banner.
|
|
4
|
+
*/
|
|
5
|
+
export const BULK_UPLOAD_BAR_COMPLETE_HOLD_MS = 400;
|
|
6
|
+
/**
|
|
7
|
+
* Max wall-clock wait for Pusher + batch-details resolution after upload. If exceeded, we stop
|
|
8
|
+
* fallback polling, clear the automatching banner (`phase` → completed), and refresh batch list.
|
|
9
|
+
*/
|
|
10
|
+
export const BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS = 300000;
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { concat, of, timer } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
4
|
+
import { BULK_UPLOAD_BAR_COMPLETE_HOLD_MS } from '../../bulkUploadTiming';
|
|
5
|
+
import { bulkUploadReceipts, bulkUploadReceiptsFailure, bulkUploadReceiptsSuccess, updateBulkUploadProgress, } from '../../reducers/missingReceiptsViewReducer';
|
|
6
|
+
export const bulkUploadReceiptsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(bulkUploadReceipts.match), mergeMap((action) => {
|
|
7
|
+
const { files } = action.payload;
|
|
8
|
+
const formData = new FormData();
|
|
9
|
+
for (const file of files) {
|
|
10
|
+
formData.append('files', file, file.name);
|
|
11
|
+
}
|
|
12
|
+
return zeniAPI
|
|
13
|
+
.postFormData(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/receipts/bulk-upload`, formData)
|
|
14
|
+
.pipe(mergeMap((response) => {
|
|
15
|
+
if (isSuccessResponse(response) && response.data != null) {
|
|
16
|
+
const batchId = String(response.data.batch_id ?? '').trim();
|
|
17
|
+
if (batchId === '') {
|
|
18
|
+
return of(bulkUploadReceiptsFailure({
|
|
19
|
+
error: createZeniAPIStatus('Unexpected Error', 'Bulk upload succeeded but batch_id was missing or empty.'),
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
return concat(of(updateBulkUploadProgress(100)), timer(BULK_UPLOAD_BAR_COMPLETE_HOLD_MS).pipe(mergeMap(() => of(bulkUploadReceiptsSuccess({ batchId })))));
|
|
23
|
+
}
|
|
24
|
+
return of(bulkUploadReceiptsFailure({ error: response.status }));
|
|
25
|
+
}), catchError((error) => of(bulkUploadReceiptsFailure({
|
|
26
|
+
error: createZeniAPIStatus('Unexpected Error', 'Bulk upload receipts API call errored out: ' +
|
|
27
|
+
JSON.stringify(error)),
|
|
28
|
+
}))));
|
|
29
|
+
}));
|
package/lib/esm/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js
ADDED
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
import { from } from 'rxjs';
|
|
2
|
+
import { catchError, exhaustMap, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
+
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
5
|
+
import { confirmBulkUploadMatch, confirmBulkUploadMatchFailure, confirmBulkUploadMatchSuccess, } from '../../reducers/missingReceiptsViewReducer';
|
|
6
|
+
export const confirmBulkUploadMatchEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(confirmBulkUploadMatch.match), exhaustMap((action) => {
|
|
7
|
+
const { batchId, attachmentId, transactionId, transactionType, fileName } = action.payload;
|
|
8
|
+
return zeniAPI
|
|
9
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/receipts/manual-match`, {
|
|
10
|
+
attachment_id: attachmentId,
|
|
11
|
+
transaction_id: transactionId,
|
|
12
|
+
transaction_type: transactionType,
|
|
13
|
+
file_name: fileName,
|
|
14
|
+
})
|
|
15
|
+
.pipe(mergeMap((response) => {
|
|
16
|
+
if (isSuccessResponse(response)) {
|
|
17
|
+
return from([
|
|
18
|
+
confirmBulkUploadMatchSuccess({
|
|
19
|
+
batchId,
|
|
20
|
+
attachmentId,
|
|
21
|
+
transactionId,
|
|
22
|
+
}),
|
|
23
|
+
openSnackbar({
|
|
24
|
+
messageSection: 'receipt_match',
|
|
25
|
+
messageText: 'success',
|
|
26
|
+
type: 'success',
|
|
27
|
+
}),
|
|
28
|
+
]);
|
|
29
|
+
}
|
|
30
|
+
return from([
|
|
31
|
+
confirmBulkUploadMatchFailure({ error: response.status }),
|
|
32
|
+
openSnackbar({
|
|
33
|
+
messageSection: 'receipt_match',
|
|
34
|
+
messageText: 'failed',
|
|
35
|
+
type: 'error',
|
|
36
|
+
}),
|
|
37
|
+
]);
|
|
38
|
+
}), catchError((error) => from([
|
|
39
|
+
confirmBulkUploadMatchFailure({
|
|
40
|
+
error: createZeniAPIStatus('Unexpected Error', 'Confirm bulk upload match errored out: ' +
|
|
41
|
+
JSON.stringify(error)),
|
|
42
|
+
}),
|
|
43
|
+
openSnackbar({
|
|
44
|
+
messageSection: 'receipt_match',
|
|
45
|
+
messageText: 'failed',
|
|
46
|
+
type: 'error',
|
|
47
|
+
}),
|
|
48
|
+
])));
|
|
49
|
+
}));
|
package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js
ADDED
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { EMPTY, from, of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
+
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
4
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
5
|
+
import { extractTransactionPayloadsFromBatchFiles, isBatchDetailsApiStatusCompleted, shouldFetchBatchDetailsForBatchId, toBatchDetails, } from '../../payload/missingReceiptsPayload';
|
|
6
|
+
import { fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsFailure, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, } from '../../reducers/missingReceiptsViewReducer';
|
|
7
|
+
export const fetchBulkUploadBatchDetailsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchBulkUploadBatchDetails.match), mergeMap(() => {
|
|
8
|
+
const bulkUpload = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
|
|
9
|
+
const { currentBatchId } = bulkUpload;
|
|
10
|
+
if (currentBatchId == null) {
|
|
11
|
+
return of(fetchBulkUploadBatchDetailsFailure({
|
|
12
|
+
error: createZeniAPIStatus('Unexpected Error', 'No current batch ID available'),
|
|
13
|
+
}));
|
|
14
|
+
}
|
|
15
|
+
if (!shouldFetchBatchDetailsForBatchId(bulkUpload.batchStatusById, bulkUpload.batchListByPeriod, currentBatchId)) {
|
|
16
|
+
return EMPTY;
|
|
17
|
+
}
|
|
18
|
+
return zeniAPI
|
|
19
|
+
.getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches/${currentBatchId}`)
|
|
20
|
+
.pipe(mergeMap((response) => {
|
|
21
|
+
if (!isSuccessResponse(response) ||
|
|
22
|
+
response.data == null ||
|
|
23
|
+
!isBatchDetailsApiStatusCompleted(response.data.status)) {
|
|
24
|
+
if (isSuccessResponse(response) && response.data != null) {
|
|
25
|
+
return EMPTY;
|
|
26
|
+
}
|
|
27
|
+
return of(fetchBulkUploadBatchDetailsFailure({ error: response.status }));
|
|
28
|
+
}
|
|
29
|
+
const actions = [];
|
|
30
|
+
const transactionPayloads = extractTransactionPayloadsFromBatchFiles(response.data.files);
|
|
31
|
+
if (transactionPayloads.length > 0) {
|
|
32
|
+
actions.push(updateTransactions(transactionPayloads, (value) => value.transaction_id));
|
|
33
|
+
}
|
|
34
|
+
actions.push(fetchBulkUploadBatchDetailsSuccess(toBatchDetails(response.data, zeniAPI.apiEndPoints.fileMicroServiceBaseUrl)));
|
|
35
|
+
actions.push(fetchBulkUploadBatches({ cacheOverride: true }));
|
|
36
|
+
return from(actions);
|
|
37
|
+
}), catchError((error) => of(fetchBulkUploadBatchDetailsFailure({
|
|
38
|
+
error: createZeniAPIStatus('Unexpected Error', 'Fetch batch details errored out: ' + JSON.stringify(error)),
|
|
39
|
+
}))));
|
|
40
|
+
}));
|
package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js
ADDED
|
@@ -0,0 +1,47 @@
|
|
|
1
|
+
import { of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
+
import { convertToPeriod, toMonthYearPeriodId, } from '../../../../commonStateTypes/timePeriod';
|
|
4
|
+
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
5
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
6
|
+
import { toBatchListItem, } from '../../payload/missingReceiptsPayload';
|
|
7
|
+
import { fetchBulkUploadBatches, fetchBulkUploadBatchesFailure, fetchBulkUploadBatchesSuccess, } from '../../reducers/missingReceiptsViewReducer';
|
|
8
|
+
export const fetchBulkUploadBatchesEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchBulkUploadBatches.match), switchMap((action) => {
|
|
9
|
+
const { cacheOverride } = action.payload;
|
|
10
|
+
const state = state$.value;
|
|
11
|
+
const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload }, } = state;
|
|
12
|
+
const currentTenant = getCurrentTenant(state);
|
|
13
|
+
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
14
|
+
const periodId = toMonthYearPeriodId(selectedPeriod);
|
|
15
|
+
const existingBatches = bulkUpload.batchListByPeriod[periodId] ?? [];
|
|
16
|
+
if (cacheOverride !== true && existingBatches.length > 0) {
|
|
17
|
+
return of(fetchBulkUploadBatchesSuccess({
|
|
18
|
+
batchList: existingBatches,
|
|
19
|
+
selectedPeriod,
|
|
20
|
+
}));
|
|
21
|
+
}
|
|
22
|
+
const period = convertToPeriod(selectedPeriod);
|
|
23
|
+
const queryParam = {
|
|
24
|
+
start_date: period.start,
|
|
25
|
+
end_date: period.end,
|
|
26
|
+
sort_order: 'desc',
|
|
27
|
+
};
|
|
28
|
+
return zeniAPI
|
|
29
|
+
.getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
30
|
+
.pipe(mergeMap((response) => {
|
|
31
|
+
if (isSuccessResponse(response) && response.data != null) {
|
|
32
|
+
/** Full list (all statuses) for UI; batch-details epics filter to `completed` only. */
|
|
33
|
+
return of(fetchBulkUploadBatchesSuccess({
|
|
34
|
+
batchList: response.data.batches.map(toBatchListItem),
|
|
35
|
+
selectedPeriod,
|
|
36
|
+
}));
|
|
37
|
+
}
|
|
38
|
+
return of(fetchBulkUploadBatchesFailure({
|
|
39
|
+
error: response.status,
|
|
40
|
+
selectedPeriod,
|
|
41
|
+
}));
|
|
42
|
+
}), catchError((error) => of(fetchBulkUploadBatchesFailure({
|
|
43
|
+
error: createZeniAPIStatus('Unexpected Error', 'Fetch bulk upload batches errored out: ' +
|
|
44
|
+
JSON.stringify(error)),
|
|
45
|
+
selectedPeriod,
|
|
46
|
+
}))));
|
|
47
|
+
}));
|
package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js
ADDED
|
@@ -0,0 +1,61 @@
|
|
|
1
|
+
import { from, of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
|
|
3
|
+
import { convertToPeriod, toMonthYearPeriodId, } from '../../../../commonStateTypes/timePeriod';
|
|
4
|
+
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
5
|
+
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
6
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
7
|
+
import { fetchCompletedTransactions, fetchCompletedTransactionsFailure, fetchCompletedTransactionsSuccess, getCompletedTransactionsCacheKey, } from '../../reducers/missingReceiptsViewReducer';
|
|
8
|
+
export const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchCompletedTransactions.match), switchMap((action) => {
|
|
9
|
+
const state = state$.value;
|
|
10
|
+
const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload }, } = state;
|
|
11
|
+
const currentTenant = getCurrentTenant(state);
|
|
12
|
+
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
13
|
+
const periodId = toMonthYearPeriodId(selectedPeriod);
|
|
14
|
+
const isInitialLoad = action.payload.pageToken == null;
|
|
15
|
+
const cacheKey = getCompletedTransactionsCacheKey(periodId, bulkUpload.sortKey, bulkUpload.sortOrder, bulkUpload.completedSubTab);
|
|
16
|
+
const existingData = bulkUpload.completedTransactionsByPeriod[cacheKey];
|
|
17
|
+
if (isInitialLoad &&
|
|
18
|
+
action.payload.cacheOverride !== true &&
|
|
19
|
+
existingData != null &&
|
|
20
|
+
existingData.transactionIds.length > 0) {
|
|
21
|
+
return from([]);
|
|
22
|
+
}
|
|
23
|
+
const period = convertToPeriod(selectedPeriod);
|
|
24
|
+
const queryPayload = {
|
|
25
|
+
start_date: period.start,
|
|
26
|
+
end_date: period.end,
|
|
27
|
+
sort_by: bulkUpload.sortKey,
|
|
28
|
+
sort_order: bulkUpload.sortOrder === 'ascending' ? 'asc' : 'desc',
|
|
29
|
+
page_token: action.payload.pageToken ?? null,
|
|
30
|
+
page_size: 25,
|
|
31
|
+
};
|
|
32
|
+
if (bulkUpload.completedSubTab !== 'all') {
|
|
33
|
+
queryPayload.match_type = bulkUpload.completedSubTab;
|
|
34
|
+
}
|
|
35
|
+
const encodedQuery = encodeURIComponent(JSON.stringify(queryPayload));
|
|
36
|
+
return zeniAPI
|
|
37
|
+
.getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/receipt-agent/transactions/completed?query=${encodedQuery}`)
|
|
38
|
+
.pipe(mergeMap((response) => {
|
|
39
|
+
if (isSuccessResponse(response) && response.data != null) {
|
|
40
|
+
const transactionIds = response.data.transactions.map((t) => t.transaction_id);
|
|
41
|
+
const updateActions = [];
|
|
42
|
+
updateActions.push(updateTransactions(response.data.transactions, (value) => value.transaction_id));
|
|
43
|
+
updateActions.push(fetchCompletedTransactionsSuccess({
|
|
44
|
+
isInitialLoad,
|
|
45
|
+
transactionIds,
|
|
46
|
+
nextPageToken: response.data.next_page_token,
|
|
47
|
+
totalCount: response.data.total_count,
|
|
48
|
+
selectedPeriod,
|
|
49
|
+
}));
|
|
50
|
+
return from(updateActions);
|
|
51
|
+
}
|
|
52
|
+
return of(fetchCompletedTransactionsFailure({
|
|
53
|
+
error: response.status,
|
|
54
|
+
selectedPeriod,
|
|
55
|
+
}));
|
|
56
|
+
}), catchError((error) => of(fetchCompletedTransactionsFailure({
|
|
57
|
+
error: createZeniAPIStatus('Unexpected Error', 'Fetch completed transactions errored: ' +
|
|
58
|
+
JSON.stringify(error)),
|
|
59
|
+
selectedPeriod,
|
|
60
|
+
}))));
|
|
61
|
+
}));
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
import { concat, of } from 'rxjs';
|
|
2
|
+
import { catchError, exhaustMap, filter } from 'rxjs/operators';
|
|
3
|
+
import { toMonthYearPeriodId } from '../../../../commonStateTypes/timePeriod';
|
|
4
|
+
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
5
|
+
import { createZeniAPIStatus } from '../../../../responsePayload';
|
|
6
|
+
import { filterBatchListItemsForBatchDetailsFetch } from '../../payload/missingReceiptsPayload';
|
|
7
|
+
import { fetchMoreBatchDetails, fetchMoreBatchDetailsComplete, fetchMoreBatchDetailsFailure, } from '../../reducers/missingReceiptsViewReducer';
|
|
8
|
+
import { fetchBatchDetailsByIds } from './fetchMultipleBatchDetailsEpic';
|
|
9
|
+
const MORE_BATCH_PAGE_SIZE = 5;
|
|
10
|
+
export const fetchMoreBatchDetailsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchMoreBatchDetails.match),
|
|
11
|
+
/** One page at a time — avoids duplicate loads if IO + scroll fallback both fire. */
|
|
12
|
+
exhaustMap(() => {
|
|
13
|
+
const state = state$.value;
|
|
14
|
+
const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload }, } = state;
|
|
15
|
+
const currentTenant = getCurrentTenant(state);
|
|
16
|
+
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
17
|
+
if (selectedPeriod == null) {
|
|
18
|
+
return of(fetchMoreBatchDetailsComplete());
|
|
19
|
+
}
|
|
20
|
+
const periodId = toMonthYearPeriodId(selectedPeriod);
|
|
21
|
+
const batchList = bulkUpload.batchListByPeriod[periodId] ?? [];
|
|
22
|
+
const failedIds = new Set(bulkUpload.failedBatchDetailIds);
|
|
23
|
+
const unfetchedBatches = filterBatchListItemsForBatchDetailsFetch(batchList).filter((batch) => bulkUpload.batchDetailsById[batch.batchId] == null &&
|
|
24
|
+
!failedIds.has(batch.batchId));
|
|
25
|
+
const unfetchedBatchIds = unfetchedBatches.map((batch) => batch.batchId);
|
|
26
|
+
if (unfetchedBatchIds.length === 0) {
|
|
27
|
+
return of(fetchMoreBatchDetailsComplete());
|
|
28
|
+
}
|
|
29
|
+
const nextPage = unfetchedBatchIds.slice(0, MORE_BATCH_PAGE_SIZE);
|
|
30
|
+
return concat(fetchBatchDetailsByIds(nextPage, zeniAPI), of(fetchMoreBatchDetailsComplete())).pipe(catchError((error) => of(fetchMoreBatchDetailsFailure({
|
|
31
|
+
error: createZeniAPIStatus('Unexpected Error', 'Fetch more batch details errored out: ' + JSON.stringify(error)),
|
|
32
|
+
}))));
|
|
33
|
+
}));
|
package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js
ADDED
|
@@ -0,0 +1,56 @@
|
|
|
1
|
+
import { EMPTY, concat, from, of } from 'rxjs';
|
|
2
|
+
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
+
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
4
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
5
|
+
import { extractTransactionPayloadsFromBatchFiles, filterBatchListItemsForBatchDetailsFetch, isBatchDetailsApiStatusCompleted, shouldFetchBatchDetailsForBatchId, toBatchDetails, } from '../../payload/missingReceiptsPayload';
|
|
6
|
+
import { batchDetailFetchFailed, fetchBulkUploadBatchDetails, fetchBulkUploadBatchesSuccess, fetchMoreBatchDetailsComplete, setInitialBatchDetailsLoading, storeBatchDetails, } from '../../reducers/missingReceiptsViewReducer';
|
|
7
|
+
const INITIAL_BATCH_PAGE_SIZE = 5;
|
|
8
|
+
export function fetchBatchDetailsByIds(batchIds, zeniAPI) {
|
|
9
|
+
if (batchIds.length === 0) {
|
|
10
|
+
return EMPTY;
|
|
11
|
+
}
|
|
12
|
+
return from(batchIds).pipe(mergeMap((batchId) => zeniAPI
|
|
13
|
+
.getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches/${batchId}`)
|
|
14
|
+
.pipe(mergeMap((response) => {
|
|
15
|
+
if (!isSuccessResponse(response) ||
|
|
16
|
+
response.data == null ||
|
|
17
|
+
!isBatchDetailsApiStatusCompleted(response.data.status)) {
|
|
18
|
+
return EMPTY;
|
|
19
|
+
}
|
|
20
|
+
const actions = [];
|
|
21
|
+
const transactionPayloads = extractTransactionPayloadsFromBatchFiles(response.data.files);
|
|
22
|
+
if (transactionPayloads.length > 0) {
|
|
23
|
+
actions.push(updateTransactions(transactionPayloads, (value) => value.transaction_id));
|
|
24
|
+
}
|
|
25
|
+
actions.push(storeBatchDetails(toBatchDetails(response.data, zeniAPI.apiEndPoints.fileMicroServiceBaseUrl)));
|
|
26
|
+
return from(actions);
|
|
27
|
+
}), catchError((error) => {
|
|
28
|
+
console.error(`Failed to fetch batch details for ${batchId}:`, createZeniAPIStatus('Unexpected Error', 'Fetch batch details errored out: ' + JSON.stringify(error)));
|
|
29
|
+
return of(batchDetailFetchFailed({ batchId }));
|
|
30
|
+
})), 5));
|
|
31
|
+
}
|
|
32
|
+
export const fetchMultipleBatchDetailsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchBulkUploadBatchesSuccess.match), mergeMap((action) => {
|
|
33
|
+
const batchList = action.payload.batchList;
|
|
34
|
+
const { batchDetailsById } = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
|
|
35
|
+
/** Only completed list rows may trigger batch-details API; preserve platform order. */
|
|
36
|
+
const completedBatchesMissingDetails = filterBatchListItemsForBatchDetailsFetch(batchList).filter((batch) => batchDetailsById[batch.batchId] == null);
|
|
37
|
+
const completedBatchIds = completedBatchesMissingDetails.map((batch) => batch.batchId);
|
|
38
|
+
const batchIdsToFetch = completedBatchIds.slice(0, INITIAL_BATCH_PAGE_SIZE);
|
|
39
|
+
if (batchIdsToFetch.length === 0) {
|
|
40
|
+
/**
|
|
41
|
+
* List refresh can complete while no row is `completed` yet (multi-fetch skips), or
|
|
42
|
+
* `currentBatchId` may not appear in the filtered list but still needs `GET /batches/:id`.
|
|
43
|
+
* Fall back to the single-batch-details epic so `phase` and details can resolve.
|
|
44
|
+
*/
|
|
45
|
+
const bulkUpload = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
|
|
46
|
+
const currentId = bulkUpload.currentBatchId;
|
|
47
|
+
if (currentId != null &&
|
|
48
|
+
bulkUpload.phase === 'matching' &&
|
|
49
|
+
bulkUpload.batchDetailsById[currentId] == null &&
|
|
50
|
+
shouldFetchBatchDetailsForBatchId(bulkUpload.batchStatusById, bulkUpload.batchListByPeriod, currentId)) {
|
|
51
|
+
return of(fetchBulkUploadBatchDetails());
|
|
52
|
+
}
|
|
53
|
+
return EMPTY;
|
|
54
|
+
}
|
|
55
|
+
return concat(of(setInitialBatchDetailsLoading()), fetchBatchDetailsByIds(batchIdsToFetch, zeniAPI), of(fetchMoreBatchDetailsComplete()));
|
|
56
|
+
}));
|
|
@@ -0,0 +1,77 @@
|
|
|
1
|
+
import { EMPTY, from, merge, of } from 'rxjs';
|
|
2
|
+
import { catchError, debounceTime, filter, mergeMap, switchMap, } from 'rxjs/operators';
|
|
3
|
+
import { convertToPeriod } from '../../../../commonStateTypes/timePeriod';
|
|
4
|
+
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
5
|
+
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
6
|
+
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
7
|
+
import { supportedTransactionPayloadToManualSearchResult } from '../../payload/missingReceiptsPayload';
|
|
8
|
+
import { searchTransactionsForManualMatch, searchTransactionsForManualMatchFailure, searchTransactionsForManualMatchSuccess, } from '../../reducers/missingReceiptsViewReducer';
|
|
9
|
+
import { toTransactionsSortKey } from '../../types/transactionsViewState';
|
|
10
|
+
/**
|
|
11
|
+
* `auto_categorized` for manual transaction search (Unmatched).
|
|
12
|
+
* Backend contract TBD — align with `fetchTransactionCategorizationEpic` (`selectedTab === 'autoCategorized'`)
|
|
13
|
+
* when the expense-automation API documents the intended filter for this flow.
|
|
14
|
+
*/
|
|
15
|
+
export const MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED = false;
|
|
16
|
+
export const searchTransactionsForManualMatchEpic = (actions$, state$, zeniAPI) => {
|
|
17
|
+
const searchActions$ = actions$.pipe(filter(searchTransactionsForManualMatch.match));
|
|
18
|
+
const pagination$ = searchActions$.pipe(filter((action) => action.payload.pageToken != null));
|
|
19
|
+
/**
|
|
20
|
+
* No API for empty or 1-char queries; immediate merge so switchMap cancels any in-flight HTTP.
|
|
21
|
+
*/
|
|
22
|
+
const newSearchTooShortOrClear$ = searchActions$.pipe(filter((action) => action.payload.pageToken == null &&
|
|
23
|
+
action.payload.query.trim().length < 2));
|
|
24
|
+
const newSearchDebounced$ = searchActions$.pipe(filter((action) => action.payload.pageToken == null &&
|
|
25
|
+
action.payload.query.trim().length >= 2), debounceTime(300));
|
|
26
|
+
return merge(pagination$, newSearchTooShortOrClear$, newSearchDebounced$).pipe(switchMap((action) => {
|
|
27
|
+
const { query, pageToken } = action.payload;
|
|
28
|
+
if (pageToken == null && query.trim().length < 2) {
|
|
29
|
+
return EMPTY;
|
|
30
|
+
}
|
|
31
|
+
const state = state$.value;
|
|
32
|
+
const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload: { manualSearch, sortKey, sortOrder }, }, } = state;
|
|
33
|
+
const currentTenant = getCurrentTenant(state);
|
|
34
|
+
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
35
|
+
if (selectedPeriod == null) {
|
|
36
|
+
return of(searchTransactionsForManualMatchFailure({
|
|
37
|
+
error: createZeniAPIStatus('Unexpected Error', 'Manual search requires a selected accounting period.'),
|
|
38
|
+
}));
|
|
39
|
+
}
|
|
40
|
+
const period = convertToPeriod(selectedPeriod);
|
|
41
|
+
const queryParam = {
|
|
42
|
+
start_date: period.start,
|
|
43
|
+
end_date: period.end,
|
|
44
|
+
auto_categorized: MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED,
|
|
45
|
+
sort_by: toTransactionsSortKey(sortKey),
|
|
46
|
+
sort_order: sortOrder === 'ascending' ? 'asc' : 'desc',
|
|
47
|
+
page_token: pageToken ?? null,
|
|
48
|
+
page_size: manualSearch.pageSize,
|
|
49
|
+
search_text: query,
|
|
50
|
+
};
|
|
51
|
+
return zeniAPI
|
|
52
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expense-automation/transactions?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
|
|
53
|
+
.pipe(mergeMap((response) => {
|
|
54
|
+
if (isSuccessResponse(response) && response.data != null) {
|
|
55
|
+
const { transactions, next_page_token, total_count } = response.data;
|
|
56
|
+
const append = pageToken != null;
|
|
57
|
+
const results = transactions.map(supportedTransactionPayloadToManualSearchResult);
|
|
58
|
+
const actionsOut = [
|
|
59
|
+
updateTransactions(transactions, (value) => value.transaction_id, 'merge'),
|
|
60
|
+
searchTransactionsForManualMatchSuccess({
|
|
61
|
+
append,
|
|
62
|
+
nextPageToken: next_page_token ?? null,
|
|
63
|
+
results,
|
|
64
|
+
totalCount: total_count,
|
|
65
|
+
}),
|
|
66
|
+
];
|
|
67
|
+
return from(actionsOut);
|
|
68
|
+
}
|
|
69
|
+
return of(searchTransactionsForManualMatchFailure({
|
|
70
|
+
error: response.status,
|
|
71
|
+
}));
|
|
72
|
+
}), catchError((error) => of(searchTransactionsForManualMatchFailure({
|
|
73
|
+
error: createZeniAPIStatus('Unexpected Error', 'Search transactions for manual match errored: ' +
|
|
74
|
+
JSON.stringify(error)),
|
|
75
|
+
}))));
|
|
76
|
+
}));
|
|
77
|
+
};
|