@zeniai/client-epic-state 4.19.99-betaVR3 → 4.19.100
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/animations.d.ts +1 -1
- package/lib/commonStateTypes/coaBalance/coaBalanceType.d.ts +0 -2
- package/lib/commonStateTypes/coaBalance/coaBalanceType.js +0 -6
- package/lib/commonStateTypes/currencyHelper.d.ts +0 -3
- package/lib/commonStateTypes/currencyHelper.js +1 -6
- package/lib/commonStateTypes/reduceFetchState.d.ts +0 -9
- package/lib/commonStateTypes/reduceFetchState.js +0 -26
- package/lib/entity/account/accountPayload.d.ts +0 -2
- package/lib/entity/account/accountPayload.js +0 -2
- package/lib/entity/account/accountState.d.ts +0 -2
- package/lib/entity/aiCfo/aiCfoSelector.d.ts +2 -1
- package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
- package/lib/entity/customer/customerState.d.ts +2 -0
- package/lib/entity/customer/customerState.js +5 -0
- package/lib/entity/depositAccount/depositAccount.d.ts +1 -1
- package/lib/entity/depositAccount/depositAccount.js +1 -8
- package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +0 -38
- package/lib/entity/jeSchedules/jeSchedulesPayload.js +0 -78
- package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +1 -4
- package/lib/entity/jeSchedules/jeSchedulesSelector.js +1 -5
- package/lib/entity/jeSchedules/jeSchedulesState.d.ts +0 -37
- package/lib/entity/reimbursement/reimbursementPayload.d.ts +0 -2
- package/lib/entity/reimbursement/reimbursementPayload.js +0 -7
- package/lib/entity/reimbursement/reimbursementState.d.ts +0 -2
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -1
- package/lib/entity/task/taskPayload.d.ts +0 -1
- package/lib/entity/task/taskPayload.js +0 -1
- package/lib/entity/task/taskState.d.ts +0 -1
- package/lib/entity/tenant/tenantPayload.d.ts +0 -1
- package/lib/entity/tenant/tenantReducer.js +0 -1
- package/lib/entity/tenant/tenantSelector.d.ts +0 -1
- package/lib/entity/tenant/tenantSelector.js +1 -9
- package/lib/entity/tenant/tenantState.d.ts +0 -1
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +1 -4
- package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -1
- package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +0 -3
- package/lib/entity/transaction/payloadTypes/transactionPayload.js +1 -17
- package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +0 -1
- package/lib/entity/transaction/stateTypes/transaction.d.ts +0 -5
- package/lib/entity/transaction/stateTypes/transactionLine.d.ts +1 -1
- package/lib/epic.d.ts +1 -13
- package/lib/epic.js +1 -13
- package/lib/esm/commonStateTypes/coaBalance/coaBalanceType.js +0 -5
- package/lib/esm/commonStateTypes/currencyHelper.js +0 -5
- package/lib/esm/commonStateTypes/reduceFetchState.js +0 -25
- package/lib/esm/entity/account/accountPayload.js +0 -2
- package/lib/esm/entity/customer/customerState.js +4 -1
- package/lib/esm/entity/depositAccount/depositAccount.js +1 -8
- package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +0 -78
- package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +1 -5
- package/lib/esm/entity/reimbursement/reimbursementPayload.js +0 -7
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -1
- package/lib/esm/entity/task/taskPayload.js +0 -1
- package/lib/esm/entity/tenant/tenantReducer.js +0 -1
- package/lib/esm/entity/tenant/tenantSelector.js +0 -7
- package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +0 -1
- package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +1 -17
- package/lib/esm/epic.js +1 -13
- package/lib/esm/index.js +16 -25
- package/lib/esm/reducer.js +0 -6
- package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +1 -82
- package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +2 -8
- package/lib/esm/view/arAgingView/arAgingReport/arAgingReducer.js +1 -1
- package/lib/esm/view/arAgingView/arAgingReport/arAgingSelector.js +1 -1
- package/lib/esm/view/classList/fetchClassListEpic.js +2 -9
- package/lib/esm/view/commonVendorView/vendorView/vendorViewSelector.js +5 -18
- package/lib/esm/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +2 -6
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +5 -7
- package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +1 -0
- package/lib/esm/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
- package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
- package/lib/esm/view/expenseAutomationView/payload/missingReceiptsPayload.js +1 -189
- package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +1 -17
- package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -433
- package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +1 -23
- package/lib/esm/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +2 -10
- package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +6 -63
- package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +5 -256
- package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +9 -22
- package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +7 -14
- package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +1 -18
- package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +0 -44
- package/lib/esm/view/expenseAutomationView/types/transactionsViewState.js +1 -2
- package/lib/esm/view/financeStatement/financeStatementReducer.js +8 -11
- package/lib/esm/view/financeStatement/financeStatementSelector.js +9 -24
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +1 -6
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +29 -2
- package/lib/esm/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +5 -7
- package/lib/esm/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.js +7 -9
- package/lib/esm/view/spendManagement/billPay/billList/billListSelector.js +0 -10
- package/lib/esm/view/spendManagement/billPay/billList/billListState.js +0 -1
- package/lib/esm/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +3 -7
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
- package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +2 -7
- package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +6 -13
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +0 -1
- package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +0 -2
- package/lib/esm/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +4 -7
- package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListSelector.js +0 -12
- package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListState.js +0 -1
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +3 -3
- package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +0 -1
- package/lib/esm/view/taskManager/taskListView/taskListSelector.js +1 -3
- package/lib/esm/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
- package/lib/esm/view/transactionDetail/transactionDetailLocalDataHelper.js +14 -16
- package/lib/esm/view/twoFactorAuthentication/resendOtpEpic.js +16 -2
- package/lib/esm/view/userListView/fetchUserListByTypeEpic.js +0 -11
- package/lib/esm/zeniAPI.js +2 -0
- package/lib/index.d.ts +21 -31
- package/lib/index.js +34 -102
- package/lib/reducer.d.ts +0 -6
- package/lib/reducer.js +0 -6
- package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +0 -7
- package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +1 -15
- package/lib/view/aiCfoView/aiCfoViewReducer.js +2 -83
- package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +1 -4
- package/lib/view/aiCfoView/aiCfoViewSelector.js +2 -9
- package/lib/view/aiCfoView/aiCfoViewState.d.ts +1 -18
- package/lib/view/arAgingView/arAgingReport/arAgingReducer.js +2 -2
- package/lib/view/arAgingView/arAgingReport/arAgingSelector.js +5 -5
- package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
- package/lib/view/classList/fetchClassListEpic.d.ts +1 -1
- package/lib/view/classList/fetchClassListEpic.js +1 -8
- package/lib/view/commonVendorView/vendorView/vendorViewSelector.d.ts +0 -1
- package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +5 -18
- package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +0 -1
- package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +2 -6
- package/lib/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +5 -7
- package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +1 -0
- package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.d.ts +0 -118
- package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +0 -201
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +2 -18
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +3 -76
- package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +2 -434
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +3 -11
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +2 -24
- package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +0 -2
- package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +1 -69
- package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +0 -1
- package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +2 -10
- package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +6 -63
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.d.ts +1 -1
- package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +4 -255
- package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +9 -22
- package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +6 -13
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +0 -5
- package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +0 -20
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +0 -142
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +1 -54
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +1 -2
- package/lib/view/expenseAutomationView/types/transactionsViewState.js +1 -2
- package/lib/view/financeStatement/financeStatementReducer.js +8 -11
- package/lib/view/financeStatement/financeStatementSelector.d.ts +0 -2
- package/lib/view/financeStatement/financeStatementSelector.js +9 -24
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.d.ts +2 -4
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +2 -7
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +29 -2
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewState.d.ts +0 -4
- package/lib/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +5 -7
- package/lib/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.js +6 -8
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListSelector.js +0 -10
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListState.js +0 -1
- package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +3 -7
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
- package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +2 -7
- package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +6 -13
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +0 -1
- package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +0 -2
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +3 -6
- package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +0 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +0 -12
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.js +0 -1
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +3 -3
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +0 -1
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +0 -1
- package/lib/view/taskManager/taskListView/taskListSelector.d.ts +0 -2
- package/lib/view/taskManager/taskListView/taskListSelector.js +1 -3
- package/lib/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
- package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +14 -16
- package/lib/view/twoFactorAuthentication/resendOtpEpic.d.ts +1 -1
- package/lib/view/twoFactorAuthentication/resendOtpEpic.js +15 -1
- package/lib/view/userListView/fetchUserListByTypeEpic.d.ts +1 -3
- package/lib/view/userListView/fetchUserListByTypeEpic.js +0 -11
- package/lib/view/userListView/userListViewPayload.d.ts +0 -2
- package/lib/zeniAPI.js +2 -0
- package/package.json +2 -2
- package/lib/entity/userGroups/userGroupsPayload.d.ts +0 -7
- package/lib/entity/userGroups/userGroupsPayload.js +0 -10
- package/lib/entity/userGroups/userGroupsReducer.d.ts +0 -8
- package/lib/entity/userGroups/userGroupsReducer.js +0 -29
- package/lib/entity/userGroups/userGroupsSelector.d.ts +0 -4
- package/lib/entity/userGroups/userGroupsSelector.js +0 -12
- package/lib/entity/userGroups/userGroupsState.d.ts +0 -9
- package/lib/entity/userGroups/userGroupsState.js +0 -2
- package/lib/esm/entity/userGroups/userGroupsPayload.js +0 -7
- package/lib/esm/entity/userGroups/userGroupsReducer.js +0 -25
- package/lib/esm/entity/userGroups/userGroupsSelector.js +0 -8
- package/lib/esm/entity/userGroups/userGroupsState.js +0 -1
- package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +0 -29
- package/lib/esm/view/expenseAutomationView/bulkUploadTiming.js +0 -10
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +0 -29
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +0 -49
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +0 -40
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +0 -47
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +0 -61
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +0 -33
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +0 -56
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +0 -77
- package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +0 -80
- package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +0 -24
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +0 -317
- package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +0 -9
- package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +0 -282
- package/lib/esm/view/userGroupListView/userGroupListViewReducer.js +0 -65
- package/lib/esm/view/userGroupListView/userGroupListViewSelector.js +0 -16
- package/lib/esm/view/userGroupListView/userGroupListViewState.js +0 -1
- package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
- package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +0 -8
- package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +0 -33
- package/lib/view/expenseAutomationView/bulkUploadTiming.d.ts +0 -10
- package/lib/view/expenseAutomationView/bulkUploadTiming.js +0 -13
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.d.ts +0 -18
- package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +0 -33
- package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.d.ts +0 -7
- package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +0 -53
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +0 -44
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.d.ts +0 -7
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +0 -51
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +0 -65
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.d.ts +0 -8
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +0 -37
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.d.ts +0 -9
- package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +0 -61
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.d.ts +0 -14
- package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +0 -81
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +0 -25
- package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +0 -86
- package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.d.ts +0 -7
- package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +0 -28
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.d.ts +0 -13
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +0 -321
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.d.ts +0 -111
- package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +0 -13
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.d.ts +0 -6
- package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +0 -285
- package/lib/view/userGroupListView/userGroupListViewReducer.d.ts +0 -23
- package/lib/view/userGroupListView/userGroupListViewReducer.js +0 -69
- package/lib/view/userGroupListView/userGroupListViewSelector.d.ts +0 -7
- package/lib/view/userGroupListView/userGroupListViewSelector.js +0 -20
- package/lib/view/userGroupListView/userGroupListViewState.d.ts +0 -8
- package/lib/view/userGroupListView/userGroupListViewState.js +0 -2
package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js
DELETED
|
@@ -1,80 +0,0 @@
|
|
|
1
|
-
import { EMPTY, from, merge, of, timer } from 'rxjs';
|
|
2
|
-
import { catchError, debounceTime, filter, mergeMap, switchMap, takeUntil, } from 'rxjs/operators';
|
|
3
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
|
-
import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
5
|
-
import { isSuccessResponse } from '../../../../responsePayload';
|
|
6
|
-
import { BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS } from '../../bulkUploadTiming';
|
|
7
|
-
import { extractTransactionPayloadsFromBatchFiles, isBatchDetailsApiStatusCompleted, toBatchDetails, } from '../../payload/missingReceiptsPayload';
|
|
8
|
-
import { bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation, } from '../../reducers/missingReceiptsViewReducer';
|
|
9
|
-
/** First poll after upload; then interval while batch not resolved via Pusher or API. */
|
|
10
|
-
const FALLBACK_FIRST_DELAY_MS = 30000;
|
|
11
|
-
const FALLBACK_POLL_INTERVAL_MS = 10000;
|
|
12
|
-
/**
|
|
13
|
-
* On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs),
|
|
14
|
-
* and request switching to the Unmatched tab. Debounced to reduce duplicate refreshes.
|
|
15
|
-
*/
|
|
16
|
-
export const pusherBatchStatusCompletionEpic = (actions$) => actions$.pipe(filter(pusherBatchStatusUpdate.match), filter((action) => action.payload.status === 'completed'), debounceTime(300), mergeMap(() => from([
|
|
17
|
-
fetchBulkUploadBatches({
|
|
18
|
-
cacheOverride: true,
|
|
19
|
-
invalidateBatchDetailsCache: true,
|
|
20
|
-
}),
|
|
21
|
-
requestMissingReceiptsTabNavigation({ tab: 'unmatched' }),
|
|
22
|
-
])));
|
|
23
|
-
/**
|
|
24
|
-
* If Pusher and batch-details are delayed beyond {@link BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS},
|
|
25
|
-
* force `phase` to `completed` (dismiss automatching banner) and refresh the batch list.
|
|
26
|
-
* Cancels when the batch completes normally, bulk state is cleared, or another upload supersedes.
|
|
27
|
-
*/
|
|
28
|
-
export const bulkUploadAutomatchingTimeoutEpic = (actions$, state$) => actions$.pipe(filter(bulkUploadReceiptsSuccess.match), switchMap((action) => {
|
|
29
|
-
const { batchId } = action.payload;
|
|
30
|
-
return timer(BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS).pipe(mergeMap(() => {
|
|
31
|
-
const bulk = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
|
|
32
|
-
if (bulk.phase !== 'matching' || bulk.currentBatchId !== batchId) {
|
|
33
|
-
return EMPTY;
|
|
34
|
-
}
|
|
35
|
-
return from([
|
|
36
|
-
bulkUploadAutomatchingTimedOut(batchId),
|
|
37
|
-
fetchBulkUploadBatches({ cacheOverride: true }),
|
|
38
|
-
]);
|
|
39
|
-
}), takeUntil(merge(actions$.pipe(filter(clearBulkUpload.match)), actions$.pipe(filter(pusherBatchStatusUpdate.match), filter((a) => a.payload.batchId === batchId &&
|
|
40
|
-
a.payload.status === 'completed')), actions$.pipe(filter(fetchBulkUploadBatchDetailsSuccess.match), filter((a) => a.payload.batchId === batchId)))));
|
|
41
|
-
}));
|
|
42
|
-
/**
|
|
43
|
-
* Fallback polling when Pusher is slow or unavailable. Network errors on a poll tick show one
|
|
44
|
-
* error snackbar per upload session (first failure only) so the user is not spammed every
|
|
45
|
-
* interval; Pusher or a later successful poll still completes the flow.
|
|
46
|
-
*/
|
|
47
|
-
export const pollBulkUploadBatchStatusEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(bulkUploadReceiptsSuccess.match), switchMap((action) => {
|
|
48
|
-
const { batchId } = action.payload;
|
|
49
|
-
let pollErrorNotified = false;
|
|
50
|
-
return timer(FALLBACK_FIRST_DELAY_MS, FALLBACK_POLL_INTERVAL_MS).pipe(takeUntil(merge(actions$.pipe(filter(clearBulkUpload.match)), actions$.pipe(filter(pusherBatchStatusUpdate.match), filter((action) => action.payload.batchId === batchId &&
|
|
51
|
-
action.payload.status === 'completed')), actions$.pipe(filter(fetchBulkUploadBatchDetailsSuccess.match), filter((action) => action.payload.batchId === batchId)), actions$.pipe(filter(bulkUploadAutomatchingTimedOut.match), filter((action) => action.payload.batchId === batchId)))), switchMap(() => zeniAPI
|
|
52
|
-
.getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches/${batchId}`)
|
|
53
|
-
.pipe(mergeMap((response) => {
|
|
54
|
-
/** Same batch-details URL; polls until `status` is completed (Pusher may win first). */
|
|
55
|
-
if (isSuccessResponse(response) && response.data != null) {
|
|
56
|
-
if (isBatchDetailsApiStatusCompleted(response.data.status)) {
|
|
57
|
-
const actions = [];
|
|
58
|
-
const transactionPayloads = extractTransactionPayloadsFromBatchFiles(response.data.files);
|
|
59
|
-
if (transactionPayloads.length > 0) {
|
|
60
|
-
actions.push(updateTransactions(transactionPayloads, (value) => value.transaction_id));
|
|
61
|
-
}
|
|
62
|
-
actions.push(fetchBulkUploadBatchDetailsSuccess(toBatchDetails(response.data, zeniAPI.apiEndPoints.fileMicroServiceBaseUrl)));
|
|
63
|
-
actions.push(fetchBulkUploadBatches({ cacheOverride: true }));
|
|
64
|
-
actions.push(requestMissingReceiptsTabNavigation({ tab: 'unmatched' }));
|
|
65
|
-
return from(actions);
|
|
66
|
-
}
|
|
67
|
-
}
|
|
68
|
-
return EMPTY;
|
|
69
|
-
}), catchError(() => {
|
|
70
|
-
if (!pollErrorNotified) {
|
|
71
|
-
pollErrorNotified = true;
|
|
72
|
-
return of(openSnackbar({
|
|
73
|
-
messageSection: 'receipts_upload',
|
|
74
|
-
messageText: 'failed',
|
|
75
|
-
type: 'error',
|
|
76
|
-
}));
|
|
77
|
-
}
|
|
78
|
-
return EMPTY;
|
|
79
|
-
}))));
|
|
80
|
-
}));
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { from } from 'rxjs';
|
|
2
|
-
import { filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
|
|
4
|
-
import { updateTransaction } from '../../../../entity/transaction/transactionReducer';
|
|
5
|
-
import { fetchMonthEndCloseChecks } from '../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer';
|
|
6
|
-
import { uploadTransactionCategorizationReceiptSuccess } from '../../reducers/transactionsViewReducer';
|
|
7
|
-
export const uploadTransactionReceiptSuccessEpic = (actions$, state$) => actions$.pipe(filter(uploadTransactionCategorizationReceiptSuccess.match), mergeMap((action) => {
|
|
8
|
-
const { transactionPayload, updateType } = action.payload;
|
|
9
|
-
const updateActions = [];
|
|
10
|
-
const currentTenant = getCurrentTenant(state$.value);
|
|
11
|
-
const selectedPeriodByTenantId = state$.value.expenseAutomationViewState.selectedPeriodByTenantId;
|
|
12
|
-
updateActions.push(updateTransaction(transactionPayload.transaction_id, transactionPayload, updateType));
|
|
13
|
-
if (currentTenant != null) {
|
|
14
|
-
const monthEndChecksPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
15
|
-
if (monthEndChecksPeriod != null) {
|
|
16
|
-
updateActions.push(fetchMonthEndCloseChecks({
|
|
17
|
-
tenantId: currentTenant.tenantId,
|
|
18
|
-
period: monthEndChecksPeriod,
|
|
19
|
-
refreshViewInBackground: true,
|
|
20
|
-
}));
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return from(updateActions);
|
|
24
|
-
}));
|
package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js
DELETED
|
@@ -1,317 +0,0 @@
|
|
|
1
|
-
import { toAmountWC } from '../../commonStateTypes/amount';
|
|
2
|
-
import { getSummationFreeRangeTotalBalance } from '../../commonStateTypes/coaBalance/additionalBalances/getSummationBalance';
|
|
3
|
-
import { defaultCustomerCurrency } from '../../commonStateTypes/currencyHelper';
|
|
4
|
-
import { reduceFetchStateParallelTimeframes } from '../../commonStateTypes/reduceFetchState';
|
|
5
|
-
import { getSectionClassesViewReport } from '../../entity/sectionClassesViewV2/sectionClassesViewSelector';
|
|
6
|
-
import { enrichProfitAndLossByClassHorizontalReport } from './profitAndLossHorizontalEnrichment';
|
|
7
|
-
export const profitAndLossHorizontalIdsInOrder = [
|
|
8
|
-
'income',
|
|
9
|
-
'cogs',
|
|
10
|
-
'grossProfit',
|
|
11
|
-
'expenses',
|
|
12
|
-
'earningsBeforeInterestAndTax',
|
|
13
|
-
'otherIncome',
|
|
14
|
-
'otherExpenses',
|
|
15
|
-
'netOtherIncome',
|
|
16
|
-
'netIncome',
|
|
17
|
-
];
|
|
18
|
-
const SECTION_TITLES = {
|
|
19
|
-
income: 'Income',
|
|
20
|
-
cogs: 'Cost of Goods Sold',
|
|
21
|
-
grossProfit: 'Gross Profit',
|
|
22
|
-
expenses: 'Expenses',
|
|
23
|
-
earningsBeforeInterestAndTax: 'Net Operating Income',
|
|
24
|
-
otherIncome: 'Other Income',
|
|
25
|
-
otherExpenses: 'Other Expenses',
|
|
26
|
-
netOtherIncome: 'Net Other Income',
|
|
27
|
-
netIncome: 'Net Income',
|
|
28
|
-
};
|
|
29
|
-
/** Sections fetched and pivoted for horizontal layout (excludes e.g. `netOperatingIncome`). */
|
|
30
|
-
const HORIZONTAL_PANDL_SECTION_IDS = [
|
|
31
|
-
'income',
|
|
32
|
-
'cogs',
|
|
33
|
-
'expenses',
|
|
34
|
-
'otherIncome',
|
|
35
|
-
'otherExpenses',
|
|
36
|
-
];
|
|
37
|
-
export const getProfitAndLossClassesHorizontalView = (filter, accountState, classState, sectionsState, profitAndLossClassesViewState, selectedPeriod) => {
|
|
38
|
-
const fetchState = reduceFetchStateParallelTimeframes([
|
|
39
|
-
profitAndLossClassesViewState.fetchState.month,
|
|
40
|
-
profitAndLossClassesViewState.fetchState.quarter,
|
|
41
|
-
profitAndLossClassesViewState.fetchState.year,
|
|
42
|
-
]);
|
|
43
|
-
const reportId = 'profit_and_loss_by_classes';
|
|
44
|
-
// Build class columns from the class hierarchy (top-level only).
|
|
45
|
-
// Use `filter.classesToFilterOut` so PDF/Excel downloads (fresh store, empty UI state)
|
|
46
|
-
// respect `classes_to_filter_out` from the request; in-app `classFilter` mirrors uiState.
|
|
47
|
-
const classColumns = buildClassColumns(profitAndLossClassesViewState.classHierarchy, filter.classesToFilterOut);
|
|
48
|
-
const sections = {};
|
|
49
|
-
const calculatedSections = {};
|
|
50
|
-
let reportCurrency = defaultCustomerCurrency;
|
|
51
|
-
if (fetchState.fetchState === 'Completed' && selectedPeriod != null) {
|
|
52
|
-
reportCurrency =
|
|
53
|
-
profitAndLossClassesViewState.currency ?? defaultCustomerCurrency;
|
|
54
|
-
// Fetch each section and pivot class→account to account→class in one pass
|
|
55
|
-
HORIZONTAL_PANDL_SECTION_IDS.forEach((sectionId) => {
|
|
56
|
-
const sectionReport = getSectionClassesViewReport(accountState, classState, sectionsState, { reportId, sectionId }, filter);
|
|
57
|
-
if (sectionReport != null) {
|
|
58
|
-
sections[sectionId] = pivotSectionToHorizontal(sectionReport, classColumns, SECTION_TITLES[sectionId] ?? sectionId, reportCurrency);
|
|
59
|
-
}
|
|
60
|
-
});
|
|
61
|
-
// Calculate derived sections
|
|
62
|
-
const incomeSection = sections['income'];
|
|
63
|
-
const cogsSection = sections['cogs'];
|
|
64
|
-
const expensesSection = sections['expenses'];
|
|
65
|
-
const otherIncomeSection = sections['otherIncome'];
|
|
66
|
-
const otherExpensesSection = sections['otherExpenses'];
|
|
67
|
-
// Gross Profit = Income - COGS
|
|
68
|
-
if (incomeSection != null && cogsSection != null) {
|
|
69
|
-
calculatedSections['grossProfit'] = computeCalculatedSection(incomeSection.classTotals, cogsSection.classTotals, incomeSection.sectionTotal, cogsSection.sectionTotal, 'subtract', SECTION_TITLES['grossProfit']);
|
|
70
|
-
}
|
|
71
|
-
// EBIT = Gross Profit - Expenses
|
|
72
|
-
const grossProfit = calculatedSections['grossProfit'];
|
|
73
|
-
if (grossProfit != null && expensesSection != null) {
|
|
74
|
-
calculatedSections['earningsBeforeInterestAndTax'] =
|
|
75
|
-
computeCalculatedSection(grossProfit.classTotals, expensesSection.classTotals, grossProfit.sectionTotal, expensesSection.sectionTotal, 'subtract', SECTION_TITLES['earningsBeforeInterestAndTax']);
|
|
76
|
-
}
|
|
77
|
-
// Net Other Income = Other Income - Other Expenses
|
|
78
|
-
if (otherIncomeSection != null && otherExpensesSection != null) {
|
|
79
|
-
calculatedSections['netOtherIncome'] = computeCalculatedSection(otherIncomeSection.classTotals, otherExpensesSection.classTotals, otherIncomeSection.sectionTotal, otherExpensesSection.sectionTotal, 'subtract', SECTION_TITLES['netOtherIncome']);
|
|
80
|
-
}
|
|
81
|
-
// Net Income = EBIT + Net Other Income
|
|
82
|
-
const ebit = calculatedSections['earningsBeforeInterestAndTax'];
|
|
83
|
-
const netOtherIncome = calculatedSections['netOtherIncome'];
|
|
84
|
-
if (ebit != null && netOtherIncome != null) {
|
|
85
|
-
calculatedSections['netIncome'] = computeCalculatedSection(ebit.classTotals, netOtherIncome.classTotals, ebit.sectionTotal, netOtherIncome.sectionTotal, 'add', SECTION_TITLES['netIncome']);
|
|
86
|
-
}
|
|
87
|
-
}
|
|
88
|
-
// Build synthetic header COABalances for rendering class names as column headers
|
|
89
|
-
const headerBalances = buildHeaderBalances(classColumns, filter.timeframe, selectedPeriod, reportCurrency);
|
|
90
|
-
const report = {
|
|
91
|
-
reportId,
|
|
92
|
-
reportTitle: 'Profit and Loss by Class',
|
|
93
|
-
firstMonthOfFY: profitAndLossClassesViewState.firstMonthOfFY,
|
|
94
|
-
fetchState: fetchState.fetchState,
|
|
95
|
-
bookCloseDate: profitAndLossClassesViewState.bookCloseDate,
|
|
96
|
-
dataAvailable: profitAndLossClassesViewState.dataAvailable,
|
|
97
|
-
selectedPeriod,
|
|
98
|
-
classColumns,
|
|
99
|
-
sections,
|
|
100
|
-
calculatedSections,
|
|
101
|
-
idsInOrder: profitAndLossHorizontalIdsInOrder,
|
|
102
|
-
uiState: profitAndLossClassesViewState.uiState,
|
|
103
|
-
headerBalances,
|
|
104
|
-
};
|
|
105
|
-
enrichProfitAndLossByClassHorizontalReport(report);
|
|
106
|
-
return report;
|
|
107
|
-
};
|
|
108
|
-
/**
|
|
109
|
-
* Build column definitions from class hierarchy (top-level classes only).
|
|
110
|
-
*/
|
|
111
|
-
function buildClassColumns(classHierarchy, classesToFilterOut) {
|
|
112
|
-
const filteredIds = new Set(classesToFilterOut.map((id) => id[0]));
|
|
113
|
-
return classHierarchy
|
|
114
|
-
.filter((c) => !filteredIds.has(c.classId[0]))
|
|
115
|
-
.map((c) => ({
|
|
116
|
-
classId: c.classId[0],
|
|
117
|
-
className: c.className,
|
|
118
|
-
nestedClassId: c.classId,
|
|
119
|
-
qboId: c.qboId,
|
|
120
|
-
}))
|
|
121
|
-
.sort((a, b) => a.className.localeCompare(b.className, [], { sensitivity: 'base' }));
|
|
122
|
-
}
|
|
123
|
-
/**
|
|
124
|
-
* Pivot a section from class→account→balances to account→class→balance (single period).
|
|
125
|
-
*/
|
|
126
|
-
function pivotSectionToHorizontal(section, classColumns, title, currency) {
|
|
127
|
-
// Map: accountId -> { accountName, classId -> balance }
|
|
128
|
-
const accountMap = new Map();
|
|
129
|
-
// Also track class totals
|
|
130
|
-
const classTotalMap = new Map();
|
|
131
|
-
classColumns.forEach((col) => classTotalMap.set(col.classId, 0));
|
|
132
|
-
// Iterate over each class in the section
|
|
133
|
-
section.classes.forEach((classReport) => {
|
|
134
|
-
const classId = classReport.id[0];
|
|
135
|
-
// Only process classes that are in our columns
|
|
136
|
-
if (!classTotalMap.has(classId)) {
|
|
137
|
-
return;
|
|
138
|
-
}
|
|
139
|
-
// Sum all sliced period balances (same slice as vertical columns; multi-period = range total)
|
|
140
|
-
const classBalance = sumBalancesInSlice(classReport.childrenBalancesTotal.balances);
|
|
141
|
-
classTotalMap.set(classId, classBalance);
|
|
142
|
-
// Iterate through accounts in this class
|
|
143
|
-
collectAccountsFromClass(classReport, classId, accountMap);
|
|
144
|
-
});
|
|
145
|
-
// Build account rows in COA tree order (same parent/child ordering as vertical P&L by class).
|
|
146
|
-
// Sorting by depth + name flattened the hierarchy and broke sub-account grouping.
|
|
147
|
-
const orderedIds = collectAccountIdsInTreeOrder(section, classColumns);
|
|
148
|
-
const usedIds = new Set();
|
|
149
|
-
const accounts = [];
|
|
150
|
-
const pushAccountRow = (accountId) => {
|
|
151
|
-
const accountData = accountMap.get(accountId);
|
|
152
|
-
if (accountData == null) {
|
|
153
|
-
return;
|
|
154
|
-
}
|
|
155
|
-
usedIds.add(accountId);
|
|
156
|
-
const classBalances = classColumns.map((col) => ({
|
|
157
|
-
classId: col.classId,
|
|
158
|
-
balance: toAmountWC(accountData.classBalances.get(col.classId) ?? 0, currency),
|
|
159
|
-
}));
|
|
160
|
-
const rowTotal = classBalances.reduce((sum, cb) => sum + cb.balance.amount, 0);
|
|
161
|
-
accounts.push({
|
|
162
|
-
accountId,
|
|
163
|
-
accountName: accountData.accountName,
|
|
164
|
-
accountType: accountData.accountType,
|
|
165
|
-
depth: accountData.depth,
|
|
166
|
-
classBalances,
|
|
167
|
-
rowTotal: toAmountWC(rowTotal, currency),
|
|
168
|
-
});
|
|
169
|
-
};
|
|
170
|
-
for (const id of orderedIds) {
|
|
171
|
-
pushAccountRow(id);
|
|
172
|
-
}
|
|
173
|
-
for (const accountId of accountMap.keys()) {
|
|
174
|
-
if (!usedIds.has(accountId)) {
|
|
175
|
-
pushAccountRow(accountId);
|
|
176
|
-
}
|
|
177
|
-
}
|
|
178
|
-
// Build class totals
|
|
179
|
-
const classTotals = classColumns.map((col) => ({
|
|
180
|
-
classId: col.classId,
|
|
181
|
-
balance: toAmountWC(classTotalMap.get(col.classId) ?? 0, currency),
|
|
182
|
-
}));
|
|
183
|
-
const sectionTotal = classTotals.reduce((sum, ct) => sum + ct.balance.amount, 0);
|
|
184
|
-
return {
|
|
185
|
-
title,
|
|
186
|
-
accounts,
|
|
187
|
-
classTotals,
|
|
188
|
-
sectionTotal: toAmountWC(sectionTotal, currency),
|
|
189
|
-
};
|
|
190
|
-
}
|
|
191
|
-
/**
|
|
192
|
-
* DFS account ids in the same order as vertical P&L by class, using the first class
|
|
193
|
-
* column that appears in this section as the canonical tree (structure is identical per class).
|
|
194
|
-
*/
|
|
195
|
-
function collectAccountIdsInTreeOrder(section, classColumns) {
|
|
196
|
-
const ids = [];
|
|
197
|
-
const visitNested = (nested) => {
|
|
198
|
-
ids.push(nested.account.accountId);
|
|
199
|
-
nested.children.forEach(visitNested);
|
|
200
|
-
};
|
|
201
|
-
for (const col of classColumns) {
|
|
202
|
-
const classReport = section.classes.find((c) => c.id[0] === col.classId);
|
|
203
|
-
if (classReport == null) {
|
|
204
|
-
continue;
|
|
205
|
-
}
|
|
206
|
-
classReport.class.accounts.forEach(visitNested);
|
|
207
|
-
return ids;
|
|
208
|
-
}
|
|
209
|
-
return ids;
|
|
210
|
-
}
|
|
211
|
-
/**
|
|
212
|
-
* Recursively collect account balances from a NestedClassReportV2 into accountMap.
|
|
213
|
-
*/
|
|
214
|
-
function collectAccountsFromClass(classReport, classId, accountMap) {
|
|
215
|
-
// Process accounts directly on this class (depth 2 matches vertical `AccountsSection` first level)
|
|
216
|
-
classReport.class.accounts.forEach((nestedAccount) => {
|
|
217
|
-
collectAccountsFromNestedAccount(nestedAccount, classId, accountMap, 2);
|
|
218
|
-
});
|
|
219
|
-
}
|
|
220
|
-
/**
|
|
221
|
-
* Recursively collect accounts from NestedAccountReport (handles sub-accounts).
|
|
222
|
-
*/
|
|
223
|
-
function collectAccountsFromNestedAccount(nestedAccount, classId, accountMap, depth) {
|
|
224
|
-
const accountId = nestedAccount.account.accountId;
|
|
225
|
-
const accountName = nestedAccount.account.accountName;
|
|
226
|
-
const balance = sumBalancesInSlice(nestedAccount.account.balancesInTimeframe.balances);
|
|
227
|
-
if (!accountMap.has(accountId)) {
|
|
228
|
-
accountMap.set(accountId, {
|
|
229
|
-
accountName,
|
|
230
|
-
accountType: nestedAccount.account.accountType,
|
|
231
|
-
depth,
|
|
232
|
-
classBalances: new Map(),
|
|
233
|
-
});
|
|
234
|
-
}
|
|
235
|
-
const accountData = accountMap.get(accountId);
|
|
236
|
-
if (accountData == null) {
|
|
237
|
-
return;
|
|
238
|
-
}
|
|
239
|
-
accountData.depth = Math.max(accountData.depth, depth);
|
|
240
|
-
if (accountData.accountType == null &&
|
|
241
|
-
nestedAccount.account.accountType != null) {
|
|
242
|
-
accountData.accountType = nestedAccount.account.accountType;
|
|
243
|
-
}
|
|
244
|
-
const existing = accountData.classBalances.get(classId) ?? 0;
|
|
245
|
-
accountData.classBalances.set(classId, existing + balance);
|
|
246
|
-
// Process sub-accounts
|
|
247
|
-
nestedAccount.children.forEach((child) => {
|
|
248
|
-
collectAccountsFromNestedAccount(child, classId, accountMap, depth + 1);
|
|
249
|
-
});
|
|
250
|
-
}
|
|
251
|
-
/**
|
|
252
|
-
* Total `balance.amount` for the current COA slice (same aggregation as
|
|
253
|
-
* `getSummationFreeRangeTotalBalance`, used for class totals and account rows).
|
|
254
|
-
*/
|
|
255
|
-
function sumBalancesInSlice(balances) {
|
|
256
|
-
if (balances.length === 0) {
|
|
257
|
-
return 0;
|
|
258
|
-
}
|
|
259
|
-
const summed = getSummationFreeRangeTotalBalance(balances);
|
|
260
|
-
return summed?.balance.amount ?? 0;
|
|
261
|
-
}
|
|
262
|
-
/**
|
|
263
|
-
* Compute a calculated section by adding or subtracting two sets of class totals.
|
|
264
|
-
*/
|
|
265
|
-
function computeCalculatedSection(aTotals, bTotals, aTotal, bTotal, operation, title) {
|
|
266
|
-
const currency = {
|
|
267
|
-
currencyCode: aTotal.currencyCode,
|
|
268
|
-
currencySymbol: aTotal.currencySymbol,
|
|
269
|
-
};
|
|
270
|
-
const bTotalsMap = new Map(bTotals.map((b) => [b.classId, b.balance.amount]));
|
|
271
|
-
const classTotals = aTotals.map((a) => {
|
|
272
|
-
const bAmount = bTotalsMap.get(a.classId) ?? 0;
|
|
273
|
-
const resultAmount = operation === 'add'
|
|
274
|
-
? a.balance.amount + bAmount
|
|
275
|
-
: a.balance.amount - bAmount;
|
|
276
|
-
return {
|
|
277
|
-
classId: a.classId,
|
|
278
|
-
balance: toAmountWC(resultAmount, currency),
|
|
279
|
-
};
|
|
280
|
-
});
|
|
281
|
-
const sectionTotalAmount = operation === 'add'
|
|
282
|
-
? aTotal.amount + bTotal.amount
|
|
283
|
-
: aTotal.amount - bTotal.amount;
|
|
284
|
-
return {
|
|
285
|
-
title,
|
|
286
|
-
classTotals,
|
|
287
|
-
sectionTotal: toAmountWC(sectionTotalAmount, currency),
|
|
288
|
-
};
|
|
289
|
-
}
|
|
290
|
-
/**
|
|
291
|
-
* Build synthetic COABalance array for header rendering.
|
|
292
|
-
* One entry per class column + one for "Total".
|
|
293
|
-
*/
|
|
294
|
-
function buildHeaderBalances(classColumns, timeframe, selectedPeriod, currency) {
|
|
295
|
-
if (selectedPeriod == null) {
|
|
296
|
-
return [];
|
|
297
|
-
}
|
|
298
|
-
const { endDate, startDate } = selectedPeriod;
|
|
299
|
-
const balances = classColumns.map((col) => ({
|
|
300
|
-
balance: toAmountWC(0, currency),
|
|
301
|
-
balanceTimeFrame: timeframe,
|
|
302
|
-
endDate,
|
|
303
|
-
startDate,
|
|
304
|
-
type: 'default',
|
|
305
|
-
label: col.className,
|
|
306
|
-
}));
|
|
307
|
-
// Add a "Total" column
|
|
308
|
-
balances.push({
|
|
309
|
-
balance: toAmountWC(0, currency),
|
|
310
|
-
balanceTimeFrame: timeframe,
|
|
311
|
-
endDate,
|
|
312
|
-
startDate,
|
|
313
|
-
type: 'default',
|
|
314
|
-
label: 'Total',
|
|
315
|
-
});
|
|
316
|
-
return balances;
|
|
317
|
-
}
|
package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js
DELETED
|
@@ -1,9 +0,0 @@
|
|
|
1
|
-
/** Synthetic COABalance `id` for the horizontal class report Total column (transaction routing). */
|
|
2
|
-
export const HORIZONTAL_CLASS_TOTAL_BALANCE_ID = '__horizontal_total__';
|
|
3
|
-
export function isHorizontalAccountReportData(data) {
|
|
4
|
-
return (typeof data === 'object' &&
|
|
5
|
-
data !== null &&
|
|
6
|
-
'depth' in data &&
|
|
7
|
-
typeof data.depth === 'number' &&
|
|
8
|
-
!('filter' in data));
|
|
9
|
-
}
|