@zeniai/client-epic-state 5.1.61-betaDI0 → 5.1.62-betaRD1

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.
Files changed (81) hide show
  1. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +2 -0
  2. package/lib/entity/jeSchedules/jeSchedulesPayload.js +2 -0
  3. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +4 -0
  4. package/lib/entity/jeSchedules/jeSchedulesSelector.js +11 -1
  5. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +2 -0
  6. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  7. package/lib/entity/snackbar/snackbarTypes.js +3 -0
  8. package/lib/entity/tenant/tenantReducer.d.ts +4 -1
  9. package/lib/entity/tenant/tenantReducer.js +8 -2
  10. package/lib/entity/tenant/tenantSelector.d.ts +1 -0
  11. package/lib/entity/tenant/tenantSelector.js +4 -0
  12. package/lib/entity/transaction/scheduleTransactionHelper.d.ts +15 -0
  13. package/lib/entity/transaction/scheduleTransactionHelper.js +43 -0
  14. package/lib/epic.d.ts +8 -1
  15. package/lib/epic.js +8 -1
  16. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +2 -0
  17. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +11 -1
  18. package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
  19. package/lib/esm/entity/tenant/tenantReducer.js +7 -1
  20. package/lib/esm/entity/tenant/tenantSelector.js +3 -0
  21. package/lib/esm/entity/transaction/scheduleTransactionHelper.js +39 -0
  22. package/lib/esm/epic.js +8 -1
  23. package/lib/esm/index.js +9 -6
  24. package/lib/esm/view/companyView/companyViewReducer.js +68 -1
  25. package/lib/esm/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.js +2 -1
  26. package/lib/esm/view/companyView/epic/companyPassport/projects/disableAccountingProjectsEpic.js +56 -0
  27. package/lib/esm/view/companyView/epic/companyPassport/projects/enableAccountingProjectsEpic.js +37 -0
  28. package/lib/esm/view/companyView/epic/companyPassport/projects/resumeEnableAccountingProjectsEpic.js +73 -0
  29. package/lib/esm/view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic.js +2 -1
  30. package/lib/esm/view/companyView/epic/companyPassport/updateCapitalizationAccountThresholdEpic.js +2 -1
  31. package/lib/esm/view/companyView/types/companyPassport/companyPassportViewState.js +5 -0
  32. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +15 -2
  33. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +21 -0
  34. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +110 -0
  35. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +44 -0
  36. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +22 -0
  37. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +152 -0
  38. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +126 -6
  39. package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
  40. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +71 -0
  41. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +65 -11
  42. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +3 -6
  43. package/lib/index.d.ts +11 -8
  44. package/lib/index.js +70 -48
  45. package/lib/view/companyView/companyViewReducer.d.ts +9 -1
  46. package/lib/view/companyView/companyViewReducer.js +70 -3
  47. package/lib/view/companyView/epic/companyPassport/dismissCapitalizationOnboardingEpic.js +2 -1
  48. package/lib/view/companyView/epic/companyPassport/projects/disableAccountingProjectsEpic.d.ts +10 -0
  49. package/lib/view/companyView/epic/companyPassport/projects/disableAccountingProjectsEpic.js +60 -0
  50. package/lib/view/companyView/epic/companyPassport/projects/enableAccountingProjectsEpic.d.ts +11 -0
  51. package/lib/view/companyView/epic/companyPassport/projects/enableAccountingProjectsEpic.js +41 -0
  52. package/lib/view/companyView/epic/companyPassport/projects/resumeEnableAccountingProjectsEpic.d.ts +13 -0
  53. package/lib/view/companyView/epic/companyPassport/projects/resumeEnableAccountingProjectsEpic.js +77 -0
  54. package/lib/view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic.js +2 -1
  55. package/lib/view/companyView/epic/companyPassport/updateCapitalizationAccountThresholdEpic.js +2 -1
  56. package/lib/view/companyView/types/companyPassport/companyPassportViewState.d.ts +2 -0
  57. package/lib/view/companyView/types/companyPassport/companyPassportViewState.js +5 -0
  58. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +14 -1
  59. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
  60. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
  61. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +45 -0
  62. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +114 -0
  63. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
  64. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +48 -0
  65. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +6 -0
  66. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +26 -0
  67. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +43 -0
  68. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +158 -0
  69. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  70. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +1 -0
  71. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +36 -8
  72. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +128 -7
  73. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +25 -0
  74. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
  75. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +29 -4
  76. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +10 -0
  77. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +76 -0
  78. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +65 -11
  79. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +53 -6
  80. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -8
  81. package/package.json +1 -1
package/lib/esm/index.js CHANGED
@@ -152,7 +152,7 @@ import { fetchCompanyMonthEndReportHistoricData, fetchCompanyMonthEndReportHisto
152
152
  import { getCompanyMonthEndReportHistoricData, getCompanyMonthEndReportSelectorView, } from './view/companyMonthEndReportView/companyMonthEndReportViewSelector';
153
153
  import { fetchCockpitContext, fetchCompanyTaskManagerView, fetchTaskManagerMetrics, updateCompanyTaskManagerViewFilters, } from './view/companyTaskManagerView/companyTaskManagerViewReducer';
154
154
  import { getCompanyTaskManagerView, } from './view/companyTaskManagerView/companyTaskManagerViewSelector';
155
- import { clearCompanyView, companyManagementSaveUpdates, companyPassportClearDataInLocalStore, companyPassportSaveDataInLocalStore, deleteCompanyOfficerInLocalStore, dismissCapitalizationOnboarding, fetchAllCockpitViews, fetchCompanyManagementView, fetchCompanyPassportView, fetchCompanyPortfolioView, fetchManagementView, fetchOnboardingView, fetchParentSubsidiaryManagementView, fetchPortfolioView, fetchSubscriptionView, fetchZeniUsers, saveCompanyPassportDetails, saveIndustryAndIncDateInCompanyPassportLocalStore, updateAccountingClassesEnabled, updateCapitalizationAccountThreshold, updateCompanyDownloadState, updateCompanyManagementUIState, updateCompanyPassportLocalStoreData, updateCompanyPortfolioUIState, } from './view/companyView/companyViewReducer';
155
+ import { clearCompanyView, companyManagementSaveUpdates, companyPassportClearDataInLocalStore, companyPassportSaveDataInLocalStore, deleteCompanyOfficerInLocalStore, dismissCapitalizationOnboarding, fetchAllCockpitViews, fetchCompanyManagementView, fetchCompanyPassportView, fetchCompanyPortfolioView, fetchManagementView, fetchOnboardingView, fetchParentSubsidiaryManagementView, fetchPortfolioView, fetchSubscriptionView, fetchZeniUsers, saveCompanyPassportDetails, saveIndustryAndIncDateInCompanyPassportLocalStore, updateAccountingClassesEnabled, enableAccountingProjects, resumeEnableAccountingProjects, disableAccountingProjects, clearQboProjectsReconnectRequest, updateCapitalizationAccountThreshold, updateCompanyDownloadState, updateCompanyManagementUIState, updateCompanyPassportLocalStoreData, updateCompanyPortfolioUIState, } from './view/companyView/companyViewReducer';
156
156
  import { canSendMonthEndEmailReport, shouldEnableCalendarPickerForLastReportSent, } from './view/companyView/helpers/cockpitHelpers';
157
157
  import { getParentSubsidiaryManagementView } from './view/companyView/parentSubsidiaryView/parentSubsidiaryViewSelector';
158
158
  import { getAddonListZeniSku, getCompanyManagementView, getPlanListZeniSku, } from './view/companyView/selector/companyManagementViewSelector';
@@ -170,19 +170,21 @@ import uploadAccountStatementIntoDocumentAI from './view/expenseAutomationView/e
170
170
  import { fetchAllExpenseAutomationTabs, refreshExpenseAutomationCurrentTab, updateCurrentSelectedPeriod, updateCurrentSelectedView, } from './view/expenseAutomationView/expenseAutomationViewReducer';
171
171
  import { getExpenseAutomationView } from './view/expenseAutomationView/expenseAutomationViewSelector';
172
172
  import { toExpenseAutomationViewType, } from './view/expenseAutomationView/expenseAutomationViewState';
173
+ import { computeNewScheduleJeDetails } from './view/expenseAutomationView/helpers/newScheduleLocalDataHelper';
173
174
  import { isReviewTransactionBankTransferType, isReviewTransactionBillPaymentType, isReviewTransactionCreditCardCreditType, isReviewTransactionCreditCardPaymentType, isReviewTransactionDepositType, isReviewTransactionExpenseType, } from './view/expenseAutomationView/helpers/reconciliationHelpers';
174
175
  import { MAX_SELECTION_LIMIT, checkIfAllLineItemsAreCategoryClassFilled, getLineItemsByTransactionIdsFromLocalData, isAnyItemWithUncategorizedExpenseAccount, } from './view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper';
175
176
  import { clearExpenseAutomationFluxAnalysisView, fetchFluxAnalysisView, reviewFluxAnalysisView, updateFluxAnalysisViewPageMetaData, updateFluxAnalysisViewUIState, updateOperatingExpensesIdsForReview, updateSelectedSectionIdsForReview, } from './view/expenseAutomationView/reducers/fluxAnalysisViewReducer';
176
- 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';
177
+ import { clearJeScheduleLocalData as clearExpenseAutomationJEScheduleLocalData, clearExpenseAutomationJESchedulesView, clearSearchTransactionsForNewSchedule as clearJeSearchTransactionsForNewSchedule, fetchJeSchedulesPage as fetchExpenseAutomationJESchedulesPage, ignoreRecommendedJeSchedule as ignoreExpenseAutomationJESchedule, initializeAccountSettingsView as initializeJeAccountSettingsView, initializeNewSchedule as initializeJeNewSchedule, initializeJeScheduleLocalData, removeJeScheduleTransactionKey, resetNewScheduleLocalData as resetJeNewScheduleLocalData, retryJeSchedule as retryExpenseAutomationJESchedule, saveAccountSettings as saveJeAccountSettings, saveAccountSettingsLocalData as saveJeAccountSettingsLocalData, saveNewSchedule as saveJeNewSchedule, saveNewScheduleFailure as saveJeNewScheduleFailure, saveNewScheduleSuccess as saveJeNewScheduleSuccess, searchTransactionsForNewSchedule as searchJeTransactionsForNewSchedule, searchTransactionsForNewScheduleFailure as searchJeTransactionsForNewScheduleFailure, searchTransactionsForNewScheduleSuccess as searchJeTransactionsForNewScheduleSuccess, toggleJECreatedGroupCollapsed, toggleJEPendingGroupCollapsed, updateJESchedulesUIState as updateExpenseAutomationJESchedulesUIState, updateJEScheduleTypeFilter, updateNewScheduleLocalData as updateJeNewScheduleLocalData, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, } from './view/expenseAutomationView/reducers/jeSchedulesViewReducer';
177
178
  import { acknowledgeBulkUploadConfirmMatchComplete, bulkUploadAutomatchingTimedOut, bulkUploadReceipts, bulkUploadReceiptsFailure, bulkUploadReceiptsSuccess, clearBulkUpload, clearBulkUploadBatchDetailsForScopeChange, clearManualSearchResults, clearMissingReceiptsTabNavigation, confirmBulkUploadMatch, confirmBulkUploadMatchFailure, confirmBulkUploadMatchSuccess, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsFailure, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, fetchBulkUploadBatchesFailure, fetchBulkUploadBatchesSuccess, fetchCompletedTransactions, fetchCompletedTransactionsFailure, fetchCompletedTransactionsSuccess, fetchMissingReceipts as fetchExpenseAutomationMissingReceipts, fetchMoreBatchDetails, fetchMoreBatchDetailsComplete, fetchMoreBatchDetailsFailure, markBatchDetailRefreshAttempted, markMissingReceiptAsDone as markExpenseAutomationMissingReceiptAsDone, pusherBatchStatusUpdate, refreshBatchDetailsForBatchId, 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';
178
179
  import { clearStatementDateConflict, deleteAccountStatement, excludeAccountFromReconciliation, fetchReconciliation as fetchReconciliationView, includeAccountInReconciliation, parseStatement, parseStatementFailure, parseStatementSuccess, reparseStatement, reparseStatementFailure, reparseStatementSuccess, resetReparseStatementStatus, saveReconciliationDetail as saveExpenseAutomationReconciliationDetail, saveReconciliationReview as saveExpenseAutomationReconciliationReview, setConnectionInProgressForAccount as setConnectionInProgressForAccountReconciliation, setStatementParseInProgress, setStatementProcessingDismissedToBackground, submitStatementUpdate, 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, updateParsedStatementData, updateStatementProcessingBackgroundCompletedSteps, updateStatementProcessingFailed, updateStatementUpdateLocalData, updateStatementUploadChosen, uploadAccountStatement, } from './view/expenseAutomationView/reducers/reconciliationViewReducer';
179
180
  import { backgroundRefetchReviewTab, clearExpenseAutomationTransactionsView, fetchTransactionCategorization, fetchTransactionCategorizationFailure, fetchTransactionCategorizationView, initializeTransactionCategorizationViewLocalData, markCategoryClassRecommendationsFailureForCategorization, markTransactionAsNotMiscategorized, removeTransactionFromAllTabs, saveTransactionCategorization, saveTransactionCategorizationLocalData, setAllItemsToCategoryClassInLocalDataForCategorization, setEntityRecommendationForLineIdsForCategorization, syncTransactionCategorizationFromDetailSave, updateCurrentSelectedTransactionCategorizationTab, updateSelectedCheckboxTransactionIds, updateSelectedCustomerForTransaction, updateSelectedTransactionId, updateSelectedVendorForTransaction, updateTransactionCategorization, updateTransactionCategorizationCompletedSubTab, updateTransactionCategorizationSaveStatus, updateTransactionCategorizationUIState, updateTransactionCategorizationUploadReceiptState, updateTransactionFilters, uploadTransactionCategorizationReceiptSuccess, } from './view/expenseAutomationView/reducers/transactionsViewReducer';
180
181
  import { getExpenseAutomationFluxAnalysisView } from './view/expenseAutomationView/selectors/fluxAnalysisViewSelector';
182
+ import { getNewScheduleSearchTransactionsView as getJeNewScheduleSearchTransactionsView, getNewScheduleView as getJeNewScheduleView, } from './view/expenseAutomationView/selectors/jeNewScheduleViewSelector';
181
183
  import { getExpenseAutomationReconciliationView, getReparseStatementStatusByAccountId, isAccountReconReport, } from './view/expenseAutomationView/selectors/reconciliationViewSelector';
182
184
  import { getExpenseAutomationTransactionView, getLastTransferEntryReplacement, } from './view/expenseAutomationView/selectors/transactionCategorizationSelector';
183
185
  import { TRANSACTION_FILTER_CATEGORIES, applyTransactionFilters, } from './view/expenseAutomationView/transactionFilterHelpers';
184
186
  import { DEFAULT_COMPLETED_SUB_TAB, toCompletedSubTab, } from './view/expenseAutomationView/types/completedSubTab';
185
- import { toJEScheduleMainTab as toExpenseAutomationJEScheduleMainTab, toJEScheduleSortKey as toExpenseAutomationJEScheduleSortKey, } from './view/expenseAutomationView/types/jeSchedulesViewState';
187
+ import { toJEScheduleSortKey as toExpenseAutomationJEScheduleSortKey, toJEPageTab, } from './view/expenseAutomationView/types/jeSchedulesViewState';
186
188
  import { BATCH_FILE_STATUSES, isUnmatchedTabFileStatus, toBatchFileStatus, toBatchStatusValue, toBulkUploadPhase, toBulkUploadResultsTab, toBulkUploadSortKey, toMatchSource, toMissingReceiptsTab, } from './view/expenseAutomationView/types/missingReceiptsViewState';
187
189
  import { toMissingReceiptsSortKey as toExpenseAutomationMissingReceiptsSortKey, } from './view/expenseAutomationView/types/missingReceiptsViewState';
188
190
  import { toReconciliationTabsType, } from './view/expenseAutomationView/types/reconciliationViewState';
@@ -463,9 +465,10 @@ export { stringToUnion, stringToUnionStrict };
463
465
  export { fetchMonthEndCloseChecks, fetchMonthClosePerformanceTrend, getMonthEndCloseChecksViewByTenantId, ALL_MONTH_END_CLOSE_CHECKS_FREQUENCY, };
464
466
  export {
465
467
  // Bulk Upload Types
466
- 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,
468
+ BATCH_FILE_STATUSES, isUnmatchedTabFileStatus, DEFAULT_COMPLETED_SUB_TAB, toBatchFileStatus, toBatchStatusValue, toBulkUploadPhase, toBulkUploadResultsTab, toBulkUploadSortKey, toCompletedSubTab, toMatchSource, toMissingReceiptsTab, toExpenseAutomationJEScheduleSortKey, toJEPageTab, toggleJECreatedGroupCollapsed, toggleJEPendingGroupCollapsed, updateJEScheduleTypeFilter, getExpenseAutomationView, toExpenseAutomationMissingReceiptsSortKey, toExpenseAutomationTransactionsTabKey, toExpenseAutomationViewType, uploadExpenseAutomationMissingReceiptSuccess, markExpenseAutomationMissingReceiptAsDone, fetchAllExpenseAutomationTabs, refreshExpenseAutomationCurrentTab, updateCurrentSelectedTransactionCategorizationTab, updateTransactionCategorizationCompletedSubTab, fetchExpenseAutomationMissingReceipts,
467
469
  // Bulk Upload Actions
468
470
  bulkUploadReceipts, bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, bulkUploadReceiptsFailure, restoreBulkUploadAutomatchingOnMount, restoreBulkUploadMatchingState, updateBulkUploadProgress, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation, clearMissingReceiptsTabNavigation, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatchDetailsFailure, storeBatchDetails, fetchMoreBatchDetails, fetchMoreBatchDetailsComplete, fetchMoreBatchDetailsFailure, fetchBulkUploadBatches, fetchBulkUploadBatchesSuccess, fetchBulkUploadBatchesFailure, clearBulkUploadBatchDetailsForScopeChange, markBatchDetailRefreshAttempted, refreshBatchDetailsForBatchId, 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, getLastTransferEntryReplacement, updateFluxAnalysisViewUIState, updateFluxAnalysisViewPageMetaData, MAX_SELECTION_LIMIT, checkIfAllLineItemsAreCategoryClassFilled, getLineItemsByTransactionIdsFromLocalData, isAnyItemWithUncategorizedExpenseAccount, excludeAccountFromReconciliation, includeAccountInReconciliation, saveExpenseAutomationReconciliationDetail, updateExpenseAutomationReconcileTabListScrollState, updateExpenseAutomationReconReviewTabListSortState, updateExpenseAutomationReconcileTabListSortState, updateExpenseAutomationReconcileTabLocalData, updateExpenseAutomationAccountReconciliationSelectedTab, updateExpenseAutomationAccountReconciliationSelectedAccountId, getExpenseAutomationReconciliationView, getReparseStatementStatusByAccountId, fetchReconciliationView, uploadAccountStatementIntoDocumentAI, updateExpenseAutomationReconListScrollPosition, setConnectionInProgressForAccountReconciliation, getAccountReconByAccountIdAndSelectedPeriod, toReconciliationTabsType, isAccountReconReport, updateExpenseAutomationReconReviewTabLocalData, updateExpenseAutomationSelectedDrawerAccountId, updateStatementProcessingFailed, saveExpenseAutomationReconciliationReview, updateExpenseAutomationAccountReconciliationLocalData, toReconciliationAccountSource, deleteAccountStatement, uploadAccountStatement, parseStatement, parseStatementSuccess, parseStatementFailure, reparseStatement, reparseStatementSuccess, reparseStatementFailure, resetReparseStatementStatus, updateParsedStatementData, updateNodeCollapseState, updateStatementUploadChosen, submitStatementUpdate, clearStatementDateConflict, updateStatementUpdateLocalData, isReviewTransactionBankTransferType, isReviewTransactionBillPaymentType, isReviewTransactionCreditCardPaymentType, isReviewTransactionDepositType, isReviewTransactionExpenseType, isReviewTransactionCreditCardCreditType, setStatementParseInProgress, setStatementProcessingDismissedToBackground, updateStatementProcessingBackgroundCompletedSteps, };
471
+ export { computeNewScheduleJeDetails, getJeNewScheduleSearchTransactionsView, getJeNewScheduleView, };
469
472
  export { fetchTransactionCategorization, fetchTransactionCategorizationView, updateTransactionCategorizationUIState, updateTransactionFilters, updateSelectedCheckboxTransactionIds, markCategoryClassRecommendationsFailureForCategorization, setEntityRecommendationForLineIdsForCategorization, initializeTransactionCategorizationViewLocalData, setAllItemsToCategoryClassInLocalDataForCategorization, saveTransactionCategorizationLocalData, fetchTransactionCategorizationFailure, saveTransactionCategorization, updateTransactionCategorization, updateTransactionCategorizationSaveStatus, markTransactionAsNotMiscategorized, updateSelectedVendorForTransaction, updateSelectedCustomerForTransaction, updateSelectedTransactionId, syncTransactionCategorizationFromDetailSave, backgroundRefetchReviewTab, createTransferEntry, createTransferEntryFailure, createTransferEntryReplacedTransaction, createTransferEntrySuccess, resetCreateTransferEntryStatus, clearTransferEntryRouteReplacement, fetchAccountsForTransferFlow, removeTransactionFromAllTabs, clearExpenseAutomationTransactionsView, toTransactionsSortKey, };
470
473
  export { TOP_EX_TIME_PERIODS };
471
474
  export { toTimeframeTick, mapTimePeriodtoTimeframeTick, toTimePeriod, toAbsoluteDay, toMonthYearPeriodId, convertToPeriod, };
@@ -554,7 +557,7 @@ export { newAddressInLocalStore, getAddress, getNewAddress, getAllNewAddresses,
554
557
  export { toManagementSortKeyType, toOnboardingSortKeyType, toPortfolioSortKeyType, toHealthSortKeyType, toTaskManagerSortKeyType, updateCompanyTaskManagerViewFilters, };
555
558
  export { ALL_COCKPIT_TABS_FILE_TYPES, ALL_COCKPIT_TABS_IDS, toCockpitTabsIDStrict, toCockpitTabsFileTypeStrict, };
556
559
  export { isAllowedValueWithCode, isAllowedValueWithID, };
557
- export { fetchCompanyPassportView, getCompanyPassportView, getCompanyPassportLocalStoreData, isCompanyPassportDataToBeSaved, companyPassportSaveDataInLocalStore, saveIndustryAndIncDateInCompanyPassportLocalStore, deleteCompanyOfficerInLocalStore, companyPassportClearDataInLocalStore, updateCompanyPassportLocalStoreData, saveCompanyPassportDetails, updateAccountingClassesEnabled, updateCapitalizationAccountThreshold, dismissCapitalizationOnboarding, clearCompanyView, };
560
+ export { fetchCompanyPassportView, getCompanyPassportView, getCompanyPassportLocalStoreData, isCompanyPassportDataToBeSaved, companyPassportSaveDataInLocalStore, saveIndustryAndIncDateInCompanyPassportLocalStore, deleteCompanyOfficerInLocalStore, companyPassportClearDataInLocalStore, updateCompanyPassportLocalStoreData, saveCompanyPassportDetails, updateAccountingClassesEnabled, enableAccountingProjects, resumeEnableAccountingProjects, disableAccountingProjects, clearQboProjectsReconnectRequest, updateCapitalizationAccountThreshold, dismissCapitalizationOnboarding, clearCompanyView, };
558
561
  export { toCompanyPassportLocalData, };
559
562
  export { COMPANY_ONBOARDING_INDUSTRY_TYPE_CODES, COMPANY_ONBOARDING_SUB_INDUSTRY_CODES_BY_INDUSTRY, COMPANY_PURPOSE_OF_ACCOUNT_CODES, COMPANY_SOURCE_OF_FUNDS_CODES, COMPANY_TRANSACTION_VOLUME_CODES, COMPANY_US_NEXUS_TYPE_CODES, getCompanyOnboardingSubIndustryCodesForIndustry, };
560
563
  export { getUncategorizedAccounts, getNestedAccountListHierarchy, };
@@ -627,7 +630,7 @@ export { updateChargeCardTransactionAttachments, updateChargeCardStatusFromPushe
627
630
  export { TIME_SERIES_DURATIONS, convertToTimeSeriesSelectionRange, toTimeSeriesDuration, fetchAggregatedReport, aggregatedReportView, };
628
631
  export { fetchApAging, getApAgingReport, updateApAgingUIState, };
629
632
  export { fetchApAgingDetail, getApAgingDetailForVendor, updateApAgingDetailUIState, };
630
- export { clearExpenseAutomationJEScheduleLocalData, clearExpenseAutomationJESchedulesView, fetchExpenseAutomationJESchedulesPage, ignoreExpenseAutomationJESchedule, initializeJeAccountSettingsView, initializeJeScheduleLocalData, removeJeScheduleTransactionKey, retryExpenseAutomationJESchedule, updateExpenseAutomationJESchedulesUIState, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, };
633
+ export { clearExpenseAutomationJEScheduleLocalData, clearExpenseAutomationJESchedulesView, clearJeSearchTransactionsForNewSchedule, fetchExpenseAutomationJESchedulesPage, ignoreExpenseAutomationJESchedule, initializeJeAccountSettingsView, initializeJeNewSchedule, initializeJeScheduleLocalData, removeJeScheduleTransactionKey, resetJeNewScheduleLocalData, retryExpenseAutomationJESchedule, saveJeNewSchedule, saveJeNewScheduleFailure, saveJeNewScheduleSuccess, searchJeTransactionsForNewSchedule, searchJeTransactionsForNewScheduleFailure, searchJeTransactionsForNewScheduleSuccess, updateExpenseAutomationJESchedulesUIState, updateJeNewScheduleLocalData, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, };
631
634
  export { createNewSchedulesAccrued, deleteScheduleAccruedDetail, cancelScheduleAccruedJournalEntry, fetchScheduleAccruedDetails, fetchScheduleAccruedDetailsPage, resetJEAccruedLinkInLocalData, saveScheduleAccruedDetails, updateAmountsInScheduleAccruedDetail, updatedJEAccruedLinkWithRecommendedLocalData, updatedJELinkInLocalDataAccruedExpenses, fetchRecommendedTransactionRowIndex, clearSelectedJELinkRowIndex, updateLinkBillExpenseLocalData, updateScheduleAccruedDetailsLocalData, updateSelectedJEAccruedScheduleKey, resetSelectedJEAccruedScheduleKey, resetAccruedDetailNewScheduleState, };
632
635
  export { getJEScheduleTransactionKey, ALL_SCHEDULES_TYPES, getScheduleListReport, getAccruedScheduleListReport, fetchScheduleList, fetchAccruedScheduleList, fetchDownloadSchedules, fetchSchedulesAccount, updateScheduleListLocalData, getFetchStateForScheduleAccountList, toScheduleTypesType, toScheduleTypesTypeStrict, toScheduleListTabsFileTypeStrict, toScheduleSubTabType, updateScheduleListSubTab, updateScheduleListSearchText, updateScheduleListScrollState, updateScheduleListSortState, updateSelectedJEScheduleKey, fetchScheduleDetails, getScheduleDetailsView, getAccruedScheduleDetailsView, fetchScheduleDetailsPage, saveScheduleDetails, deleteScheduleDetail, createNewSchedules, updateScheduleDetailsLocalData, updateScheduleListDownloadState, updateAccruedJEScheduleAccruedByListKey, updatedSelectedJELinkRowIndex, getQBOUrlForLink, getThirdPartyIDFromQBOURL, updatedJELinkInLocalData, updateAmountsInScheduleDetail, resetJELinkInLocalData, updatedJELinkWithRecommendedLocalData, getFetchStateForScheduleListByType, getDefaultSelectedTimeframeForScheduleType, markAsCompleteScheduleDetail, resetMarkAsCompleteStatus, fetchVendorTabView, updateVendorTabViewTab, getVendorTabView, };
633
636
  export { toVendorFirstReviewViewColumnKeyType, getGlobalMerchantAutoCompleteResults, getVendorFirstReviewView, getVendorFirstReviewAttachmentView, fetchVendorFirstReviewView, fetchVendorFirstReviewAttachments, updateVendorFirstReviewViewScrollYOffset, resetVendorFirstReviewLocalData, updateVendorFirstReviewViewPageToken, clearRecentlySavedErroredVendorData, saveVendorFirstReviewView, updateVendorFirstReviewViewLocalData, updateVendorFirstReviewSortUiState, fetchGlobalMerchantAutoCompleteView, clearGlobalMerchantAutoCompleteResults, updateReviewVendorDetailLocalData, saveVendorDetailsView, getVendorDetailSelectorView, };
@@ -309,6 +309,73 @@ const companyView = createSlice({
309
309
  error: action.payload.status,
310
310
  };
311
311
  },
312
+ enableAccountingProjects: {
313
+ reducer(draft,
314
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
315
+ _action) {
316
+ draft.passportView.accountingProjectsUpdateStatus = {
317
+ fetchState: 'In-Progress',
318
+ error: undefined,
319
+ };
320
+ draft.passportView.needsQboProjectsReconnect = false;
321
+ },
322
+ prepare(companyId) {
323
+ return { payload: { companyId } };
324
+ },
325
+ },
326
+ resumeEnableAccountingProjects: {
327
+ reducer(draft,
328
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
329
+ _action) {
330
+ draft.passportView.accountingProjectsUpdateStatus = {
331
+ fetchState: 'In-Progress',
332
+ error: undefined,
333
+ };
334
+ draft.passportView.needsQboProjectsReconnect = false;
335
+ },
336
+ prepare(companyId) {
337
+ return { payload: { companyId } };
338
+ },
339
+ },
340
+ disableAccountingProjects: {
341
+ reducer(draft,
342
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
343
+ _action) {
344
+ draft.passportView.accountingProjectsUpdateStatus = {
345
+ fetchState: 'In-Progress',
346
+ error: undefined,
347
+ };
348
+ draft.passportView.needsQboProjectsReconnect = false;
349
+ },
350
+ prepare(companyId) {
351
+ return { payload: { companyId } };
352
+ },
353
+ },
354
+ updateAccountingProjectsEnabledSuccess(draft) {
355
+ draft.passportView.accountingProjectsUpdateStatus = {
356
+ fetchState: 'Completed',
357
+ error: undefined,
358
+ };
359
+ draft.passportView.needsQboProjectsReconnect = false;
360
+ },
361
+ updateAccountingProjectsEnabledFailure(draft, action) {
362
+ draft.passportView.accountingProjectsUpdateStatus = {
363
+ fetchState: 'Error',
364
+ error: action.payload.status,
365
+ };
366
+ draft.passportView.needsQboProjectsReconnect = false;
367
+ },
368
+ requestQboProjectsReconnect(draft) {
369
+ draft.passportView.needsQboProjectsReconnect = true;
370
+ // Keep In-Progress so the Projects toggle stays locked through OAuth.
371
+ draft.passportView.accountingProjectsUpdateStatus = {
372
+ fetchState: 'In-Progress',
373
+ error: undefined,
374
+ };
375
+ },
376
+ clearQboProjectsReconnectRequest(draft) {
377
+ draft.passportView.needsQboProjectsReconnect = false;
378
+ },
312
379
  updateCapitalizationAccountThreshold: {
313
380
  prepare(companyId, accountId, threshold, dismissOnboardingForAccount, allOverrides) {
314
381
  return {
@@ -627,5 +694,5 @@ const companyView = createSlice({
627
694
  },
628
695
  },
629
696
  });
630
- export const { fetchCompanyPassportView, fetchAllCockpitViews, fetchOnboardingView, fetchManagementView, fetchSubscriptionView, fetchPortfolioView, fetchCompanyManagementView, companyManagementSaveUpdates, companyManagementSavePendingUpdates, companyManagementDiscardUpdates, companyManagementSaveUpdatesSuccess, companyManagementSaveUpdatesFailure, updateCompanyViewOnSuccess, updateCompanyViewOnFailure, fetchCompanyPortfolioView, fetchZeniUsers, updateZeniUsersOnSuccess, updateZeniUsersOnFailure, clearCompanyView, updateCompanyPortfolioUIState, updateCompanyManagementUIState, companyPassportSaveDataInLocalStore, deleteCompanyOfficerInLocalStore, companyPassportClearDataInLocalStore, companyPassportUpdateCompanyDetails, companyPassportUpdateCompanyDetailsSuccess, companyPassportUpdateCompanyDetailsFailure, updateAccountingClassesEnabled, updateAccountingClassesEnabledSuccess, updateAccountingClassesEnabledFailure, updateCapitalizationAccountThreshold, updateCapitalizationAccountThresholdSuccess, updateCapitalizationAccountThresholdFailure, dismissCapitalizationOnboarding, companyPassportUpdatePrimaryContact, companyPassportUpdatePrimaryContactSuccess, companyPassportUpdatePrimaryContactFailure, companyPassportUpdateCompanyOfficer, companyPassportUpdateCompanyOfficerSuccess, companyPassportUpdateCompanyOfficerFailure, companyPassportCreateCompanyOfficers, companyPassportCreateCompanyOfficersSuccess, companyPassportCreateCompanyOfficersFailure, updateCompanyPassportLocalStoreData, saveIndustryAndIncDateInCompanyPassportLocalStore, saveCompanyPassportDetails, fetchParentSubsidiaryManagementView, updateParentSubsidiaryView, updateParentSubsidiaryViewOnFailure, updateCompanyDownloadState, fetchCompanyMetaData, updateCompanyMetaDataOnSuccess, updateCompanyMetaDataOnFailure, updateMetaDataOnSendMonthEndReport, } = companyView.actions;
697
+ export const { fetchCompanyPassportView, fetchAllCockpitViews, fetchOnboardingView, fetchManagementView, fetchSubscriptionView, fetchPortfolioView, fetchCompanyManagementView, companyManagementSaveUpdates, companyManagementSavePendingUpdates, companyManagementDiscardUpdates, companyManagementSaveUpdatesSuccess, companyManagementSaveUpdatesFailure, updateCompanyViewOnSuccess, updateCompanyViewOnFailure, fetchCompanyPortfolioView, fetchZeniUsers, updateZeniUsersOnSuccess, updateZeniUsersOnFailure, clearCompanyView, updateCompanyPortfolioUIState, updateCompanyManagementUIState, companyPassportSaveDataInLocalStore, deleteCompanyOfficerInLocalStore, companyPassportClearDataInLocalStore, companyPassportUpdateCompanyDetails, companyPassportUpdateCompanyDetailsSuccess, companyPassportUpdateCompanyDetailsFailure, updateAccountingClassesEnabled, updateAccountingClassesEnabledSuccess, updateAccountingClassesEnabledFailure, enableAccountingProjects, resumeEnableAccountingProjects, disableAccountingProjects, updateAccountingProjectsEnabledSuccess, updateAccountingProjectsEnabledFailure, requestQboProjectsReconnect, clearQboProjectsReconnectRequest, updateCapitalizationAccountThreshold, updateCapitalizationAccountThresholdSuccess, updateCapitalizationAccountThresholdFailure, dismissCapitalizationOnboarding, companyPassportUpdatePrimaryContact, companyPassportUpdatePrimaryContactSuccess, companyPassportUpdatePrimaryContactFailure, companyPassportUpdateCompanyOfficer, companyPassportUpdateCompanyOfficerSuccess, companyPassportUpdateCompanyOfficerFailure, companyPassportCreateCompanyOfficers, companyPassportCreateCompanyOfficersSuccess, companyPassportCreateCompanyOfficersFailure, updateCompanyPassportLocalStoreData, saveIndustryAndIncDateInCompanyPassportLocalStore, saveCompanyPassportDetails, fetchParentSubsidiaryManagementView, updateParentSubsidiaryView, updateParentSubsidiaryViewOnFailure, updateCompanyDownloadState, fetchCompanyMetaData, updateCompanyMetaDataOnSuccess, updateCompanyMetaDataOnFailure, updateMetaDataOnSendMonthEndReport, } = companyView.actions;
631
698
  export default companyView.reducer;
@@ -1,11 +1,12 @@
1
1
  import { from } from 'rxjs';
2
2
  import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
3
  import { updateTenantCapitalizationOnboardingDismissed } from '../../../../entity/tenant/tenantReducer';
4
+ import { getTenantIdByCompanyId } from '../../../../entity/tenant/tenantSelector';
4
5
  import { isSuccessResponse } from '../../../../responsePayload';
5
6
  import { dismissCapitalizationOnboarding } from '../../companyViewReducer';
6
7
  export const dismissCapitalizationOnboardingEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(dismissCapitalizationOnboarding.match), switchMap((action) => {
7
8
  const { companyId, accountId } = action.payload;
8
- const tenantId = Object.values(state$.value.tenantState.tenantsById).find((t) => t.companyId === companyId)?.tenantId;
9
+ const tenantId = getTenantIdByCompanyId(state$.value.tenantState, companyId);
9
10
  const body = {
10
11
  capitalization_onboarding_dismissed_accounts: { [accountId]: true },
11
12
  };
@@ -0,0 +1,56 @@
1
+ import { from, of } from 'rxjs';
2
+ import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
+ import { updateCompanies } from '../../../../../entity/company/companyReducer';
4
+ import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
5
+ import { updateTenantAccountingProjectsEnabled } from '../../../../../entity/tenant/tenantReducer';
6
+ import { getTenantIdByCompanyId } from '../../../../../entity/tenant/tenantSelector';
7
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
8
+ import { disableAccountingProjects, updateAccountingProjectsEnabledFailure, updateAccountingProjectsEnabledSuccess, } from '../../../companyViewReducer';
9
+ export const disableAccountingProjectsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(disableAccountingProjects.match), switchMap((action) => {
10
+ const { companyId } = action.payload;
11
+ const tenantId = getTenantIdByCompanyId(state$.value.tenantState, companyId);
12
+ return zeniAPI
13
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, { is_accounting_projects_enabled: false })
14
+ .pipe(mergeMap((response) => {
15
+ const companies = response.data?.companies ?? [];
16
+ if (isSuccessResponse(response) && companies.length > 0) {
17
+ const actions = [
18
+ updateCompanies({
19
+ payload: companies,
20
+ schema: {},
21
+ }),
22
+ ];
23
+ if (tenantId != null) {
24
+ actions.push(updateTenantAccountingProjectsEnabled({
25
+ enabled: false,
26
+ tenantId,
27
+ }));
28
+ }
29
+ actions.push(updateAccountingProjectsEnabledSuccess());
30
+ actions.push(openSnackbar({
31
+ messageSection: 'accounting_projects_enabled_update',
32
+ messageText: 'success',
33
+ type: 'success',
34
+ }));
35
+ return from(actions);
36
+ }
37
+ return from([
38
+ updateAccountingProjectsEnabledFailure({
39
+ status: response.status,
40
+ }),
41
+ openSnackbar({
42
+ messageSection: 'accounting_projects_enabled_update',
43
+ messageText: 'failed',
44
+ type: 'error',
45
+ }),
46
+ ]);
47
+ }), catchError((error) => of(updateAccountingProjectsEnabledFailure({
48
+ status: createZeniAPIStatus('Unexpected error', `Update Accounting Projects Enabled errored out - ${error instanceof Error
49
+ ? error.message
50
+ : JSON.stringify(error)}`),
51
+ }), openSnackbar({
52
+ messageSection: 'accounting_projects_enabled_update',
53
+ messageText: 'failed',
54
+ type: 'error',
55
+ }))));
56
+ }));
@@ -0,0 +1,37 @@
1
+ import { from, of } from 'rxjs';
2
+ import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
+ import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
4
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
5
+ import { enableAccountingProjects, requestQboProjectsReconnect, resumeEnableAccountingProjects, updateAccountingProjectsEnabledFailure, } from '../../../companyViewReducer';
6
+ export const enableAccountingProjectsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(enableAccountingProjects.match), switchMap((action) => {
7
+ const { companyId } = action.payload;
8
+ return zeniAPI
9
+ .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accounting_provider_project_authorization_status`)
10
+ .pipe(mergeMap((response) => {
11
+ if (!isSuccessResponse(response) || response.data == null) {
12
+ return from([
13
+ updateAccountingProjectsEnabledFailure({
14
+ status: response.status,
15
+ }),
16
+ openSnackbar({
17
+ messageSection: 'accounting_projects_enabled_update',
18
+ messageText: 'failed',
19
+ type: 'error',
20
+ }),
21
+ ]);
22
+ }
23
+ if (response.data.is_accounting_provider_project_apis_authorized !==
24
+ true) {
25
+ return from([requestQboProjectsReconnect()]);
26
+ }
27
+ return from([resumeEnableAccountingProjects(companyId)]);
28
+ }), catchError((error) => of(updateAccountingProjectsEnabledFailure({
29
+ status: createZeniAPIStatus('Unexpected error', `Accounting provider project authorization status errored out - ${error instanceof Error
30
+ ? error.message
31
+ : JSON.stringify(error)}`),
32
+ }), openSnackbar({
33
+ messageSection: 'accounting_projects_enabled_update',
34
+ messageText: 'failed',
35
+ type: 'error',
36
+ }))));
37
+ }));
@@ -0,0 +1,73 @@
1
+ import { from, of } from 'rxjs';
2
+ import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
+ import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
4
+ import { updateTenantAccountingProjectsEnabled } from '../../../../../entity/tenant/tenantReducer';
5
+ import { getTenantIdByCompanyId } from '../../../../../entity/tenant/tenantSelector';
6
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
7
+ import { resumeEnableAccountingProjects, updateAccountingProjectsEnabledFailure, updateAccountingProjectsEnabledSuccess, } from '../../../companyViewReducer';
8
+ export const resumeEnableAccountingProjectsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(resumeEnableAccountingProjects.match), switchMap((action) => {
9
+ const { companyId } = action.payload;
10
+ const tenantId = getTenantIdByCompanyId(state$.value.tenantState, companyId);
11
+ if (tenantId == null) {
12
+ return from([
13
+ updateAccountingProjectsEnabledFailure({
14
+ status: createZeniAPIStatus('Unexpected error', 'Tenant not found for company'),
15
+ }),
16
+ openSnackbar({
17
+ messageSection: 'accounting_projects_enabled_update',
18
+ messageText: 'failed',
19
+ type: 'error',
20
+ }),
21
+ ]);
22
+ }
23
+ return zeniAPI
24
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accounting_provider_project_enablement_status`)
25
+ .pipe(mergeMap((response) => {
26
+ if (!isSuccessResponse(response) || response.data == null) {
27
+ return from([
28
+ updateAccountingProjectsEnabledFailure({
29
+ status: response.status,
30
+ }),
31
+ openSnackbar({
32
+ messageSection: 'accounting_projects_enabled_update',
33
+ messageText: 'failed',
34
+ type: 'error',
35
+ }),
36
+ ]);
37
+ }
38
+ if (response.data.is_accounting_provider_project_apis_enabled !==
39
+ true ||
40
+ response.data.is_accounting_projects_enabled !== true) {
41
+ return from([
42
+ updateAccountingProjectsEnabledFailure({
43
+ status: createZeniAPIStatus('Projects not enabled in QBO', 'Please enable projects in QBO before enabling in the Zeni dashboard!'),
44
+ }),
45
+ openSnackbar({
46
+ messageSection: 'accounting_projects_qbo_not_enabled',
47
+ messageText: 'failed',
48
+ type: 'error',
49
+ }),
50
+ ]);
51
+ }
52
+ return from([
53
+ updateTenantAccountingProjectsEnabled({
54
+ enabled: true,
55
+ tenantId,
56
+ }),
57
+ updateAccountingProjectsEnabledSuccess(),
58
+ openSnackbar({
59
+ messageSection: 'accounting_projects_enabled_update',
60
+ messageText: 'success',
61
+ type: 'success',
62
+ }),
63
+ ]);
64
+ }), catchError((error) => of(updateAccountingProjectsEnabledFailure({
65
+ status: createZeniAPIStatus('Unexpected error', `Accounting provider project enablement status errored out - ${error instanceof Error
66
+ ? error.message
67
+ : JSON.stringify(error)}`),
68
+ }), openSnackbar({
69
+ messageSection: 'accounting_projects_enabled_update',
70
+ messageText: 'failed',
71
+ type: 'error',
72
+ }))));
73
+ }));
@@ -3,11 +3,12 @@ import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
3
  import { updateCompanies } from '../../../../entity/company/companyReducer';
4
4
  import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
5
5
  import { updateTenantAccountingClassesEnabled } from '../../../../entity/tenant/tenantReducer';
6
+ import { getTenantIdByCompanyId } from '../../../../entity/tenant/tenantSelector';
6
7
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
7
8
  import { updateAccountingClassesEnabled, updateAccountingClassesEnabledFailure, updateAccountingClassesEnabledSuccess, } from '../../companyViewReducer';
8
9
  export const updateAccountingClassesEnabledEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(updateAccountingClassesEnabled.match), switchMap((action) => {
9
10
  const { companyId, enabled } = action.payload;
10
- const tenantId = Object.values(state$.value.tenantState.tenantsById).find((t) => t.companyId === companyId)?.tenantId;
11
+ const tenantId = getTenantIdByCompanyId(state$.value.tenantState, companyId);
11
12
  return zeniAPI
12
13
  .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, { is_accounting_classes_enabled: enabled })
13
14
  .pipe(mergeMap((response) => {
@@ -3,11 +3,12 @@ import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
3
  import { updateCompanies } from '../../../../entity/company/companyReducer';
4
4
  import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
5
5
  import { updateTenantCapitalizationAccountOverride, updateTenantCapitalizationOnboardingDismissed, } from '../../../../entity/tenant/tenantReducer';
6
+ import { getTenantIdByCompanyId } from '../../../../entity/tenant/tenantSelector';
6
7
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
7
8
  import { updateCapitalizationAccountThreshold, updateCapitalizationAccountThresholdFailure, updateCapitalizationAccountThresholdSuccess, } from '../../companyViewReducer';
8
9
  export const updateCapitalizationAccountThresholdEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(updateCapitalizationAccountThreshold.match), switchMap((action) => {
9
10
  const { companyId, accountId, threshold, dismissOnboardingForAccount, allOverrides, } = action.payload;
10
- const tenantId = Object.values(state$.value.tenantState.tenantsById).find((t) => t.companyId === companyId)?.tenantId;
11
+ const tenantId = getTenantIdByCompanyId(state$.value.tenantState, companyId);
11
12
  let finalOverrides;
12
13
  if (allOverrides !== undefined) {
13
14
  finalOverrides = allOverrides ?? {};
@@ -5,10 +5,15 @@ export const initialCompanyPassportView = {
5
5
  fetchState: 'Not-Started',
6
6
  error: undefined,
7
7
  },
8
+ accountingProjectsUpdateStatus: {
9
+ fetchState: 'Not-Started',
10
+ error: undefined,
11
+ },
8
12
  capitalizationThresholdUpdateStatus: {
9
13
  fetchState: 'Not-Started',
10
14
  error: undefined,
11
15
  },
16
+ needsQboProjectsReconnect: false,
12
17
  companyDetails: {
13
18
  localData: undefined,
14
19
  updateStatus: {
@@ -1,9 +1,11 @@
1
1
  import { from, of } from 'rxjs';
2
2
  import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { toString } from '../../../../commonStateTypes/timePeriod';
3
+ import { DEFAULT_DATE_FORMAT } from '../../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY';
4
+ import { toAbsoluteDay, toString } from '../../../../commonStateTypes/timePeriod';
4
5
  import { updateJESchedules, updateJESchedulesDetails, } from '../../../../entity/jeSchedules/jeSchedulesReducer';
5
6
  import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
6
7
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
8
+ import { date } from '../../../../zeniDayJS';
7
9
  import { fetchJeSchedules, fetchJeSchedulesFailure, fetchJeSchedulesSuccess, initializeJeScheduleLocalData, } from '../../reducers/jeSchedulesViewReducer';
8
10
  export const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchJeSchedules.match), mergeMap((action) => {
9
11
  const state = state$.value;
@@ -11,9 +13,20 @@ export const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe
11
13
  const { period, refreshViewInBackground } = action.payload;
12
14
  const currentTenant = getCurrentTenant(state);
13
15
  const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
16
+ const isClosePeriodTab = state.expenseAutomationJESchedulesViewState.uiState.selectedPageTab ===
17
+ 'schedules';
18
+ const existingEndDate = toAbsoluteDay(date(toString(period.start))
19
+ .subtract(1, 'month')
20
+ .endOf('month')
21
+ .format(DEFAULT_DATE_FORMAT));
14
22
  const queryParam = {
15
23
  start_date: toString(period.start),
16
- end_date: toString(period.end),
24
+ end_date: isClosePeriodTab || existingEndDate == null
25
+ ? toString(period.end)
26
+ : toString(existingEndDate),
27
+ ...(isClosePeriodTab
28
+ ? { close_period_start_date: toString(period.start) }
29
+ : {}),
17
30
  };
18
31
  return zeniAPI
19
32
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expenses_automation/je_schedules?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
@@ -0,0 +1,21 @@
1
+ import { from } from 'rxjs';
2
+ import { filter, mergeMap } from 'rxjs/operators';
3
+ import { fetchAccountList } from '../../../../accountList/accountListReducer';
4
+ import { fetchClassList } from '../../../../classList/classListReducer';
5
+ import { getAccountsTypesForScheduleEpics } from '../../../../scheduleView/scheduleListView/scheduleListHelper';
6
+ import { clearSearchTransactionsForNewSchedule, initializeNewSchedule, resetNewScheduleLocalData, } from '../../../reducers/jeSchedulesViewReducer';
7
+ export const initializeNewScheduleEpic = (actions$, state$) => actions$.pipe(filter(initializeNewSchedule.match), mergeMap((action) => {
8
+ const newScheduleActions = [];
9
+ const accountType = getAccountsTypesForScheduleEpics();
10
+ const { accountListState, classListState } = state$.value;
11
+ if (accountListState.byReportId[accountType.accountListKey]?.fetchState ===
12
+ 'Not-Started') {
13
+ newScheduleActions.push(fetchAccountList(accountType.accountListKey, true, false, false, false, accountType.allowedAccountList));
14
+ }
15
+ if (classListState.fetchState === 'Not-Started') {
16
+ newScheduleActions.push(fetchClassList());
17
+ }
18
+ newScheduleActions.push(resetNewScheduleLocalData({ scheduleType: action.payload.scheduleType }));
19
+ newScheduleActions.push(clearSearchTransactionsForNewSchedule());
20
+ return from(newScheduleActions);
21
+ }));
@@ -0,0 +1,110 @@
1
+ import { from } from 'rxjs';
2
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
+ import { updateJESchedules, updateJESchedulesDetails, } from '../../../../../entity/jeSchedules/jeSchedulesReducer';
4
+ import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
5
+ import { getSupportedTransactionById } from '../../../../../entity/transaction/transactionSelector';
6
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
7
+ import { prepareNewSchedulePayload, } from '../../../helpers/newScheduleLocalDataHelper';
8
+ import { resetNewScheduleLocalData, saveNewSchedule, saveNewScheduleFailure, saveNewScheduleSuccess, } from '../../../reducers/jeSchedulesViewReducer';
9
+ const FAILURE_REASON_MESSAGES = {
10
+ multi_line_not_supported: 'This transaction has multiple lines and cannot be scheduled yet.',
11
+ missing_third_party_id: 'This transaction is missing a QuickBooks reference and cannot be scheduled.',
12
+ missing_vendor: 'Select a vendor before saving this schedule.',
13
+ };
14
+ export const saveNewScheduleEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(saveNewSchedule.match), mergeMap((action) => {
15
+ const { scheduleType } = action.payload;
16
+ const state = state$.value;
17
+ const localData = state.expenseAutomationJESchedulesViewState.newSchedule
18
+ .newScheduleState[scheduleType];
19
+ const transactionId = localData.selectedBaseTransactionId?.id;
20
+ const transaction = transactionId != null
21
+ ? getSupportedTransactionById(state.transactionState, transactionId)
22
+ : undefined;
23
+ if (transaction == null) {
24
+ return from([
25
+ saveNewScheduleFailure({
26
+ status: createZeniAPIStatus('Unexpected Error', 'No base transaction selected for this schedule.'),
27
+ }),
28
+ openSnackbar({
29
+ messageSection: 'create_schedule',
30
+ messageText: 'failed',
31
+ type: 'error',
32
+ variables: [
33
+ {
34
+ variableName: '_api-error_',
35
+ variableValue: 'No base transaction selected.',
36
+ },
37
+ ],
38
+ }),
39
+ ]);
40
+ }
41
+ const result = prepareNewSchedulePayload(transaction, localData, scheduleType);
42
+ if (!result.ok) {
43
+ const message = FAILURE_REASON_MESSAGES[result.reason];
44
+ return from([
45
+ saveNewScheduleFailure({
46
+ status: createZeniAPIStatus('Unexpected Error', message),
47
+ }),
48
+ openSnackbar({
49
+ messageSection: 'create_schedule',
50
+ messageText: 'failed',
51
+ type: 'error',
52
+ variables: [{ variableName: '_api-error_', variableValue: message }],
53
+ }),
54
+ ]);
55
+ }
56
+ const vendorName = localData.selectedVendor?.name ?? transaction.vendorName ?? '';
57
+ const queryParam = {
58
+ je_schedule_type: scheduleType,
59
+ };
60
+ const payload = { ...result.payload };
61
+ return zeniAPI
62
+ .postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/schedules?query=${encodeURIComponent(JSON.stringify(queryParam))}`, payload)
63
+ .pipe(mergeMap((response) => {
64
+ if (isSuccessResponse(response) && response.data != null) {
65
+ return from([
66
+ updateJESchedules(response.data.je_schedules),
67
+ updateJESchedulesDetails(response.data.je_schedules, response.data.scheduled_journal_entries),
68
+ resetNewScheduleLocalData({ scheduleType }),
69
+ saveNewScheduleSuccess(),
70
+ openSnackbar({
71
+ messageSection: 'create_schedule',
72
+ messageText: 'success',
73
+ type: 'success',
74
+ variables: [
75
+ { variableName: '_vendor_name_', variableValue: vendorName },
76
+ ],
77
+ }),
78
+ ]);
79
+ }
80
+ return from([
81
+ saveNewScheduleFailure({ status: response.status }),
82
+ openSnackbar({
83
+ messageSection: 'create_schedule',
84
+ messageText: 'failed',
85
+ type: 'error',
86
+ variables: [
87
+ {
88
+ variableName: '_api-error_',
89
+ variableValue: response.status.message,
90
+ },
91
+ ],
92
+ }),
93
+ ]);
94
+ }), catchError((error) => from([
95
+ openSnackbar({
96
+ messageSection: 'create_schedule',
97
+ messageText: 'failed',
98
+ type: 'error',
99
+ variables: [
100
+ {
101
+ variableName: '_api-error_',
102
+ variableValue: JSON.stringify(error),
103
+ },
104
+ ],
105
+ }),
106
+ saveNewScheduleFailure({
107
+ status: createZeniAPIStatus('Unexpected Error', `Save New Schedule REST API call errored out ${JSON.stringify(error)}`),
108
+ }),
109
+ ])));
110
+ }));