@zeniai/client-epic-state 4.15.26 → 4.15.28
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/timePeriod.d.ts +1 -1
- package/lib/commonStateTypes/timePeriod.js +2 -2
- package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
- package/lib/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
- package/lib/configureStore.js +2 -1
- package/lib/entity/account/accountState.d.ts +1 -1
- package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
- package/lib/entity/accountRecon/accountReconPayload.d.ts +70 -0
- package/lib/entity/accountRecon/accountReconPayload.js +125 -0
- package/lib/entity/accountRecon/accountReconReducer.d.ts +16 -0
- package/lib/entity/accountRecon/accountReconReducer.js +71 -0
- package/lib/entity/accountRecon/accountReconSelector.d.ts +28 -0
- package/lib/entity/accountRecon/accountReconSelector.js +44 -0
- package/lib/entity/accountRecon/accountReconState.d.ts +70 -0
- package/lib/entity/accountRecon/accountReconState.js +28 -0
- package/lib/entity/class/classReducer.d.ts +4 -4
- package/lib/entity/class/classState.d.ts +1 -1
- package/lib/entity/customer/customerPayload.d.ts +1 -1
- package/lib/entity/customer/customerPayload.js +16 -6
- package/lib/entity/forecast/forecastState.d.ts +1 -1
- package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
- package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +4 -0
- package/lib/entity/task/taskState.d.ts +1 -1
- package/lib/entity/tenant/clearAllEpic.d.ts +4 -2
- package/lib/entity/tenant/clearAllEpic.js +4 -0
- package/lib/entity/tenant/tenantReducer.d.ts +1 -1
- package/lib/entity/tenant/tenantReducer.js +7 -2
- package/lib/entity/transaction/payloadTypes/customerTransactionPayload.d.ts +1 -1
- package/lib/entity/transaction/payloadTypes/customerTransactionPayload.js +1 -2
- package/lib/entity/transaction/payloadTypes/reconciliationTransactionPayloads.d.ts +35 -0
- package/lib/entity/transaction/payloadTypes/reconciliationTransactionPayloads.js +53 -0
- package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +2 -0
- package/lib/entity/transaction/payloadTypes/transactionPayload.js +7 -3
- package/lib/entity/transaction/payloadTypes/vendorTransactionPayload.d.ts +9 -1
- package/lib/entity/transaction/payloadTypes/vendorTransactionPayload.js +23 -2
- package/lib/entity/transaction/stateTypes/reconciliationTransaction.d.ts +32 -0
- package/lib/entity/transaction/stateTypes/reconciliationTransaction.js +10 -0
- package/lib/entity/transaction/stateTypes/transaction.d.ts +3 -1
- package/lib/entity/transaction/stateTypes/transactionType.d.ts +1 -1
- package/lib/entity/transaction/stateTypes/transactionType.js +1 -0
- package/lib/entity/transaction/stateTypes/vendorTransaction.d.ts +5 -0
- package/lib/entity/transaction/stateTypes/vendorTransaction.js +5 -1
- package/lib/entity/transaction/toSupportedTransaction.js +6 -1
- package/lib/entity/transaction/transactionReducer.d.ts +17 -0
- package/lib/entity/transaction/transactionReducer.js +47 -2
- package/lib/entity/transaction/transactionSelector.d.ts +2 -0
- package/lib/entity/transaction/transactionSelector.js +5 -0
- package/lib/entity/transaction/transactionState.d.ts +6 -4
- package/lib/entity/vendorExpense/vendorExpenseSelector.d.ts +2 -2
- package/lib/epic.d.ts +6 -1
- package/lib/epic.js +6 -1
- package/lib/index.d.ts +14 -6
- package/lib/index.js +52 -27
- package/lib/reducer.d.ts +7 -1
- package/lib/reducer.js +6 -0
- package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
- package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
- package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
- package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
- package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
- package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
- package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.d.ts +2 -2
- package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.d.ts +15 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +118 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/initialiseLocalDataForSelectedAccountIdEpic.d.ts +10 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/initialiseLocalDataForSelectedAccountIdEpic.js +49 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationDetailEpic.d.ts +14 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationDetailEpic.js +169 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.d.ts +9 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +154 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.d.ts +6 -0
- package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.js +110 -0
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +24 -10
- package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +2 -1
- package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +14 -0
- package/lib/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +20 -4
- package/lib/view/expenseAutomationView/expenseAutomationViewReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +17 -2
- package/lib/view/expenseAutomationView/expenseAutomationViewState.d.ts +2 -2
- package/lib/view/expenseAutomationView/expenseAutomationViewState.js +1 -1
- package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.d.ts +7 -0
- package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.js +18 -0
- package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +81 -30
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +54 -10
- package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +28 -0
- package/lib/view/expenseAutomationView/payload/reconciliationPayload.js +51 -0
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +66 -0
- package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +384 -0
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +5 -4
- package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +2 -0
- package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.js +1 -1
- package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +51 -0
- package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +7 -0
- package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.d.ts +5 -0
- package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +250 -0
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +103 -0
- package/lib/view/expenseAutomationView/types/reconciliationViewState.js +38 -0
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +8 -0
- package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
- package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
- package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billsBulkActionView/epics/validateBillsBulkActionEpic.ts.js +4 -3
- package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.js +11 -3
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +2 -1
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +3 -1
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +1 -1
- package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
- package/lib/view/topEx/topExSelector.d.ts +1 -1
- package/lib/view/transactionDetail/epics/saveTransactionHelper.js +13 -4
- package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +16 -3
- package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +22 -5
- package/lib/view/transactionDetail/transactionDetailState.d.ts +1 -0
- package/lib/view/transactionDetail/transactionDetailTypes.d.ts +6 -0
- package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewState.d.ts +1 -1
- package/lib/zeniAPI.d.ts +1 -0
- package/package.json +2 -1
|
@@ -12,7 +12,7 @@ export declare const getCashPosition: (accountState: AccountState, cashPositionS
|
|
|
12
12
|
firstMonthOfFY: 2 | 1 | 3 | 4 | 8 | 5 | 6 | 10 | 7 | 12 | 11 | 9;
|
|
13
13
|
dataAvailable: import("../../commonStateTypes/timeframeTick").TimeframeTick | undefined;
|
|
14
14
|
availableNumberOfPeriods: number | undefined;
|
|
15
|
-
reportId: "billing" | "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "flux_analysis_operating_expense";
|
|
15
|
+
reportId: "billing" | "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "flux_analysis_operating_expense" | "account_reconciliation";
|
|
16
16
|
reportTitle: string;
|
|
17
17
|
version: string | number | undefined;
|
|
18
18
|
status: import("../..").Status | undefined;
|
|
@@ -36,8 +36,8 @@ export declare const fetchVendorsTabVendorDetails: import("@reduxjs/toolkit").Ac
|
|
|
36
36
|
}, "vendorsTabVendorView/fetchVendorsTabVendorDetailPageView", never, never>, updateVendorsTabVendorAllTransactionsTabData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
37
37
|
timePeriod: TimePeriod;
|
|
38
38
|
numberOfQuartersFetched: number;
|
|
39
|
-
}, "vendorsTabVendorView/updateVendorsTabVendorAllTransactionsTabData">, resetSelectedTabType: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"vendorsTabVendorView/resetSelectedTabType">, updateSelectedTabType: import("@reduxjs/toolkit").ActionCreatorWithPayload<"spend_transactions" | "all_transactions", "vendorsTabVendorView/updateSelectedTabType">, updateVendorSpendTrendFilterTabValue: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorSpendTrendfilterTabValue: "last_month" | "
|
|
40
|
-
vendorSpendTrendfilterTabValue: "last_month" | "
|
|
39
|
+
}, "vendorsTabVendorView/updateVendorsTabVendorAllTransactionsTabData">, resetSelectedTabType: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"vendorsTabVendorView/resetSelectedTabType">, updateSelectedTabType: import("@reduxjs/toolkit").ActionCreatorWithPayload<"spend_transactions" | "all_transactions", "vendorsTabVendorView/updateSelectedTabType">, updateVendorSpendTrendFilterTabValue: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[vendorSpendTrendfilterTabValue: "last_month" | "variance" | "last_30_days" | "last_90_days" | "YTD_spend" | "last_3_months" | "last_6_months" | "last_12_months" | "last_year"], {
|
|
40
|
+
vendorSpendTrendfilterTabValue: "last_month" | "variance" | "last_30_days" | "last_90_days" | "YTD_spend" | "last_3_months" | "last_6_months" | "last_12_months" | "last_year";
|
|
41
41
|
}, "vendorsTabVendorView/updateVendorSpendTrendFilterTabValue", never, never>, resetVendorsTabVendorAllTransactionsTabData: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"vendorsTabVendorView/resetVendorsTabVendorAllTransactionsTabData">, updateContactsInVendorTabDetailLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
42
42
|
vendorId: ID;
|
|
43
43
|
localData?: Partial<VendorsTabVendorDetailLocalData>;
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import { DashboardState } from './dashboardState';
|
|
2
2
|
export declare const initialState: DashboardState;
|
|
3
|
-
export declare const fetchDashboard: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[userId: string, companyId: string, tenantId: string, fetchFullReport?: any, cacheOverride?: any, excludeResources?: ("billing" | "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "flux_analysis_operating_expense")[] | undefined], {
|
|
3
|
+
export declare const fetchDashboard: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[userId: string, companyId: string, tenantId: string, fetchFullReport?: any, cacheOverride?: any, excludeResources?: ("billing" | "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "flux_analysis_operating_expense" | "account_reconciliation")[] | undefined], {
|
|
4
4
|
userId: string;
|
|
5
5
|
companyId: string;
|
|
6
6
|
tenantId: string;
|
|
7
7
|
fetchFullReport: any;
|
|
8
8
|
cacheOverride: any;
|
|
9
|
-
excludeResources: ("billing" | "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "flux_analysis_operating_expense")[];
|
|
9
|
+
excludeResources: ("billing" | "cash_balance" | "card_balance" | "expense_automation_card" | "operating_expenses" | "operating_expenses_by_classes" | "revenue" | "revenue_by_classes" | "net_burn_or_income" | "net_burn_or_income_story_card" | "net_burn_or_income_by_classes" | "cash_position" | "top_expenses" | "profit_and_loss" | "profit_and_loss_by_classes" | "balance_sheet" | "cash_flow" | "dashboard" | "finance_statement" | "transaction_list_of_account" | "transaction_list_missing_receipt" | "transaction_list_of_account_by_class" | "transaction_detail" | "cash_in_cash_out" | "insights_dashboard" | "company_details" | "class_list" | "account_list" | "account_list_by_type" | "vendor" | "task_card" | "bill_pay" | "reimbursement" | "bill_pay_card" | "reimbursement_card" | "bill_pay_promo_card" | "zeni_accounts" | "zeni_accounts_promo_card" | "charge_cards" | "reimbursement_promo_card" | "onboarding" | "operating_expenses_by_vendor" | "operating_expenses_by_vendor_summary" | "vendors_tab" | "accounts_payable_aging" | "accounts_receivable_aging" | "vendor_global_review" | "prepaid_expenses" | "fixed_assets" | "notification" | "rewards_card" | "flux_analysis_operating_expense" | "account_reconciliation")[];
|
|
10
10
|
}, "dashboard/fetchDashboard", never, never>, clearDashboard: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"dashboard/clearDashboard">;
|
|
11
11
|
declare const _default: import("redux").Reducer<DashboardState>;
|
|
12
12
|
export default _default;
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ID } from '../../../../commonStateTypes/common';
|
|
4
|
+
import { updateAccounts } from '../../../../entity/account/accountReducer';
|
|
5
|
+
import { TransactionsToReviewPayload } from '../../../../entity/accountRecon/accountReconPayload';
|
|
6
|
+
import { updateAccountRecon } from '../../../../entity/accountRecon/accountReconReducer';
|
|
7
|
+
import { updateMultipleReconcileTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
8
|
+
import { updateAllUsers } from '../../../../entity/user/userReducer';
|
|
9
|
+
import { RootState } from '../../../../reducer';
|
|
10
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
11
|
+
import { fetchReconciliation, fetchReconciliationFailure, fetchReconciliationSuccess, initialiseLocalDataForSelectedAccountId, initializeReconciliationReviewTabLocalData, updateReconcileTabLocalData } from '../../reducers/reconciliationViewReducer';
|
|
12
|
+
import { ReconciliationReviewTabLocalData } from '../../types/reconciliationViewState';
|
|
13
|
+
export type ActionType = ReturnType<typeof fetchReconciliation> | ReturnType<typeof fetchReconciliationFailure> | ReturnType<typeof fetchReconciliationSuccess> | ReturnType<typeof initialiseLocalDataForSelectedAccountId> | ReturnType<typeof initializeReconciliationReviewTabLocalData> | ReturnType<typeof updateAccountRecon> | ReturnType<typeof updateAccounts> | ReturnType<typeof updateAllUsers> | ReturnType<typeof updateMultipleReconcileTransactions> | ReturnType<typeof updateReconcileTabLocalData>;
|
|
14
|
+
export declare const fetchReconciliationViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
15
|
+
export declare const prepareReviewTabLocalData: (transactionsToReview: TransactionsToReviewPayload[]) => Record<ID, ReconciliationReviewTabLocalData>;
|
|
@@ -0,0 +1,118 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prepareReviewTabLocalData = exports.fetchReconciliationViewEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
|
|
7
|
+
const accountReducer_1 = require("../../../../entity/account/accountReducer");
|
|
8
|
+
const accountReconReducer_1 = require("../../../../entity/accountRecon/accountReconReducer");
|
|
9
|
+
const accountReconSelector_1 = require("../../../../entity/accountRecon/accountReconSelector");
|
|
10
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
11
|
+
const transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
|
|
12
|
+
const userReducer_1 = require("../../../../entity/user/userReducer");
|
|
13
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
14
|
+
const reconciliationHelpers_1 = require("../../helpers/reconciliationHelpers");
|
|
15
|
+
const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewReducer");
|
|
16
|
+
const saveReconciliationDetailEpic_1 = require("./saveReconciliationDetailEpic");
|
|
17
|
+
const fetchReconciliationViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(reconciliationViewReducer_1.fetchReconciliation.match), (0, operators_1.mergeMap)((action) => {
|
|
18
|
+
const { accountId, cacheOverride, refreshViewInBackground } = action.payload;
|
|
19
|
+
const state = state$.value;
|
|
20
|
+
const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationReconciliationViewState: { accountReconciliationRecordsBySelectedPeriod: accountReconciliationRecords, }, } = state;
|
|
21
|
+
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
22
|
+
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
23
|
+
let reconciliationData = undefined;
|
|
24
|
+
let reconciliationId = undefined;
|
|
25
|
+
if (accountId != null) {
|
|
26
|
+
reconciliationData = (0, accountReconSelector_1.getAccountReconByAccountIdAndSelectedPeriod)(state, accountId, selectedPeriod);
|
|
27
|
+
reconciliationId = reconciliationData === null || reconciliationData === void 0 ? void 0 : reconciliationData.reconciliationId;
|
|
28
|
+
}
|
|
29
|
+
let fetchState;
|
|
30
|
+
if (accountId != null) {
|
|
31
|
+
fetchState =
|
|
32
|
+
accountReconciliationRecords[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)]
|
|
33
|
+
.reconciliationByAccountID[accountId].transactionFetchState
|
|
34
|
+
.fetchState;
|
|
35
|
+
}
|
|
36
|
+
else {
|
|
37
|
+
fetchState = state.expenseAutomationReconciliationViewState.fetchState;
|
|
38
|
+
}
|
|
39
|
+
if (cacheOverride === true || fetchState !== 'Completed') {
|
|
40
|
+
const { start, end } = (0, timePeriod_1.convertToPeriod)(selectedPeriod, true);
|
|
41
|
+
const queryParam = {
|
|
42
|
+
start_date: start.toString(),
|
|
43
|
+
end_date: end.toString(),
|
|
44
|
+
};
|
|
45
|
+
if (accountId != null) {
|
|
46
|
+
queryParam.account_id = accountId;
|
|
47
|
+
}
|
|
48
|
+
const apiUrl = reconciliationId != null
|
|
49
|
+
? `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/${reconciliationId}`
|
|
50
|
+
: `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation?query=${encodeURIComponent(JSON.stringify(queryParam))}`;
|
|
51
|
+
return zeniAPI.getJSON(apiUrl).pipe((0, operators_1.mergeMap)((response) => {
|
|
52
|
+
var _a, _b, _c, _d;
|
|
53
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
54
|
+
const updateActions = [];
|
|
55
|
+
updateActions.push((0, accountReducer_1.updateAccounts)(response.data.accounts, 'account_reconciliation'));
|
|
56
|
+
updateActions.push((0, userReducer_1.updateAllUsers)({
|
|
57
|
+
users: (_a = response.data.users) !== null && _a !== void 0 ? _a : [],
|
|
58
|
+
updateType: 'merge',
|
|
59
|
+
}));
|
|
60
|
+
const allTransactionsPerRecon = (0, reconciliationHelpers_1.getAllReviewTransactionsFromReconcilePayload)(response.data.reconciliation);
|
|
61
|
+
updateActions.push((0, transactionReducer_1.updateMultipleReconcileTransactions)(allTransactionsPerRecon, 'merge'));
|
|
62
|
+
updateActions.push((0, accountReconReducer_1.updateAccountRecon)(selectedPeriod, response.data.reconciliation));
|
|
63
|
+
const reviewTabLocalData = (0, exports.prepareReviewTabLocalData)((_d = (_c = (_b = response.data.reconciliation[0]) === null || _b === void 0 ? void 0 : _b.transactions) === null || _c === void 0 ? void 0 : _c.review) !== null && _d !== void 0 ? _d : []);
|
|
64
|
+
if (accountId != null) {
|
|
65
|
+
const selectedTransactionIds = (0, saveReconciliationDetailEpic_1.getTransactionIdFromCheckedMatchedTransactionPayload)(response.data.reconciliation[0].transactions.reconcile);
|
|
66
|
+
updateActions.push((0, reconciliationViewReducer_1.updateReconcileTabLocalData)({
|
|
67
|
+
selectedTransactionIds: selectedTransactionIds,
|
|
68
|
+
}));
|
|
69
|
+
updateActions.push((0, reconciliationViewReducer_1.initializeReconciliationReviewTabLocalData)(reviewTabLocalData));
|
|
70
|
+
}
|
|
71
|
+
updateActions.push((0, reconciliationViewReducer_1.fetchReconciliationSuccess)(selectedPeriod, response.data, refreshViewInBackground, accountId));
|
|
72
|
+
return (0, rxjs_1.from)(updateActions);
|
|
73
|
+
}
|
|
74
|
+
else {
|
|
75
|
+
return (0, rxjs_1.of)((0, reconciliationViewReducer_1.fetchReconciliationFailure)({
|
|
76
|
+
error: response.status,
|
|
77
|
+
selectedPeriod,
|
|
78
|
+
refreshViewInBackground,
|
|
79
|
+
accountId: accountId,
|
|
80
|
+
}));
|
|
81
|
+
}
|
|
82
|
+
}), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, reconciliationViewReducer_1.fetchReconciliationFailure)({
|
|
83
|
+
error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', `fetch reconciliation view REST API call errored out ${JSON.stringify(error)}`),
|
|
84
|
+
refreshViewInBackground,
|
|
85
|
+
selectedPeriod,
|
|
86
|
+
accountId: accountId,
|
|
87
|
+
}))));
|
|
88
|
+
}
|
|
89
|
+
else {
|
|
90
|
+
const updateActions = [];
|
|
91
|
+
if (accountId != null) {
|
|
92
|
+
updateActions.push((0, reconciliationViewReducer_1.initialiseLocalDataForSelectedAccountId)());
|
|
93
|
+
}
|
|
94
|
+
return (0, rxjs_1.from)(updateActions);
|
|
95
|
+
}
|
|
96
|
+
}));
|
|
97
|
+
exports.fetchReconciliationViewEpic = fetchReconciliationViewEpic;
|
|
98
|
+
const prepareReviewTabLocalData = (transactionsToReview) => {
|
|
99
|
+
return transactionsToReview.reduce((prev, currentTransaction) => {
|
|
100
|
+
var _a, _b, _c, _d, _e, _f;
|
|
101
|
+
const localData = {
|
|
102
|
+
memo: currentTransaction.transaction_memo,
|
|
103
|
+
categoryId: (_b = (_a = currentTransaction.recommended_action.recommended_transactions[0]) === null || _a === void 0 ? void 0 : _a.account_id) !== null && _b !== void 0 ? _b : undefined,
|
|
104
|
+
classId: (_d = (_c = currentTransaction.recommended_action.recommended_transactions[0]) === null || _c === void 0 ? void 0 : _c.class_id) !== null && _d !== void 0 ? _d : undefined,
|
|
105
|
+
vendor: ((_e = currentTransaction.recommended_action.recommended_transactions[0]) === null || _e === void 0 ? void 0 : _e.merchant_id) != null &&
|
|
106
|
+
((_f = currentTransaction.recommended_action.recommended_transactions[0]) === null || _f === void 0 ? void 0 : _f.merchant_name) != null
|
|
107
|
+
? {
|
|
108
|
+
id: currentTransaction.recommended_action
|
|
109
|
+
.recommended_transactions[0].merchant_id,
|
|
110
|
+
name: currentTransaction.recommended_action
|
|
111
|
+
.recommended_transactions[0].merchant_name,
|
|
112
|
+
}
|
|
113
|
+
: undefined,
|
|
114
|
+
};
|
|
115
|
+
return Object.assign(Object.assign({}, prev), { [currentTransaction.transaction_id]: localData });
|
|
116
|
+
}, {});
|
|
117
|
+
};
|
|
118
|
+
exports.prepareReviewTabLocalData = prepareReviewTabLocalData;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { ID } from '../../../../commonStateTypes/common';
|
|
4
|
+
import { TransactionsToReview } from '../../../../entity/accountRecon/accountReconState';
|
|
5
|
+
import { RootState } from '../../../../reducer';
|
|
6
|
+
import { initialiseLocalDataForSelectedAccountId, initializeReconciliationReviewTabLocalData, updateReconcileTabLocalData } from '../../reducers/reconciliationViewReducer';
|
|
7
|
+
import { ReconciliationReviewTabLocalData } from '../../types/reconciliationViewState';
|
|
8
|
+
export type ActionType = ReturnType<typeof initialiseLocalDataForSelectedAccountId> | ReturnType<typeof initializeReconciliationReviewTabLocalData> | ReturnType<typeof updateReconcileTabLocalData>;
|
|
9
|
+
export declare const initialiseDataForSelectedAccountIdEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|
|
10
|
+
export declare const prepareReviewTabLocalData: (transactionsToReview: TransactionsToReview[]) => Record<ID, ReconciliationReviewTabLocalData>;
|
|
@@ -0,0 +1,49 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.prepareReviewTabLocalData = exports.initialiseDataForSelectedAccountIdEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const accountReconSelector_1 = require("../../../../entity/accountRecon/accountReconSelector");
|
|
7
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
8
|
+
const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewReducer");
|
|
9
|
+
const initialiseDataForSelectedAccountIdEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(reconciliationViewReducer_1.initialiseLocalDataForSelectedAccountId.match), (0, operators_1.mergeMap)(() => {
|
|
10
|
+
var _a, _b, _c;
|
|
11
|
+
const state = state$.value;
|
|
12
|
+
const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationReconciliationViewState: { selectedAccountId }, } = state;
|
|
13
|
+
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
14
|
+
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
15
|
+
const actions = [];
|
|
16
|
+
if (selectedAccountId != null) {
|
|
17
|
+
const reconEntity = (0, accountReconSelector_1.getAccountReconByAccountIdAndSelectedPeriod)(state, selectedAccountId, selectedPeriod);
|
|
18
|
+
const checkedTransactions = (_a = reconEntity === null || reconEntity === void 0 ? void 0 : reconEntity.transactionsToReconcile) === null || _a === void 0 ? void 0 : _a.filter((transaction) => transaction.isTransactionChecked);
|
|
19
|
+
const selectedTransactionIds = (_b = checkedTransactions === null || checkedTransactions === void 0 ? void 0 : checkedTransactions.map((transaction) => transaction.id)) !== null && _b !== void 0 ? _b : [];
|
|
20
|
+
actions.push((0, reconciliationViewReducer_1.updateReconcileTabLocalData)({
|
|
21
|
+
selectedTransactionIds: selectedTransactionIds,
|
|
22
|
+
}));
|
|
23
|
+
const reviewTabLocalData = (0, exports.prepareReviewTabLocalData)((_c = reconEntity === null || reconEntity === void 0 ? void 0 : reconEntity.transactionsToReview) !== null && _c !== void 0 ? _c : []);
|
|
24
|
+
actions.push((0, reconciliationViewReducer_1.initializeReconciliationReviewTabLocalData)(reviewTabLocalData));
|
|
25
|
+
}
|
|
26
|
+
return (0, rxjs_1.from)(actions);
|
|
27
|
+
}));
|
|
28
|
+
exports.initialiseDataForSelectedAccountIdEpic = initialiseDataForSelectedAccountIdEpic;
|
|
29
|
+
const prepareReviewTabLocalData = (transactionsToReview) => {
|
|
30
|
+
return transactionsToReview.reduce((prev, currentTransaction) => {
|
|
31
|
+
var _a, _b, _c, _d, _e, _f;
|
|
32
|
+
const localData = {
|
|
33
|
+
memo: currentTransaction.memo,
|
|
34
|
+
categoryId: (_b = (_a = currentTransaction.recommendedAction.recommendedTransactions[0]) === null || _a === void 0 ? void 0 : _a.accountId) !== null && _b !== void 0 ? _b : undefined,
|
|
35
|
+
classId: (_d = (_c = currentTransaction.recommendedAction.recommendedTransactions[0]) === null || _c === void 0 ? void 0 : _c.classId) !== null && _d !== void 0 ? _d : undefined,
|
|
36
|
+
vendor: ((_e = currentTransaction.recommendedAction.recommendedTransactions[0]) === null || _e === void 0 ? void 0 : _e.merchantId) != null &&
|
|
37
|
+
((_f = currentTransaction.recommendedAction.recommendedTransactions[0]) === null || _f === void 0 ? void 0 : _f.merchantName) != null
|
|
38
|
+
? {
|
|
39
|
+
id: currentTransaction.recommendedAction
|
|
40
|
+
.recommendedTransactions[0].merchantId,
|
|
41
|
+
name: currentTransaction.recommendedAction
|
|
42
|
+
.recommendedTransactions[0].merchantName,
|
|
43
|
+
}
|
|
44
|
+
: undefined,
|
|
45
|
+
};
|
|
46
|
+
return Object.assign(Object.assign({}, prev), { [currentTransaction.transactionId]: localData });
|
|
47
|
+
}, {});
|
|
48
|
+
};
|
|
49
|
+
exports.prepareReviewTabLocalData = prepareReviewTabLocalData;
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { ID } from '../../../../commonStateTypes/common';
|
|
3
|
+
import { excludeReconReviewTransaction, updateAccountRecon } from '../../../../entity/accountRecon/accountReconReducer';
|
|
4
|
+
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
5
|
+
import { MatchedTransactionPayload } from '../../../../entity/transaction/payloadTypes/reconciliationTransactionPayloads';
|
|
6
|
+
import { updateMultipleReconcileTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
7
|
+
import { RootState } from '../../../../reducer';
|
|
8
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
9
|
+
import { saveReconciliationDetail, saveReconciliationDetailFailure, saveReconciliationDetailSuccess, updateBalancesLocalData, updateReconcileTabLocalData } from '../../reducers/reconciliationViewReducer';
|
|
10
|
+
import { ReconcileActionType } from '../../types/reconciliationViewState';
|
|
11
|
+
export type ActionType = ReturnType<typeof excludeReconReviewTransaction> | ReturnType<typeof openSnackbar> | ReturnType<typeof saveReconciliationDetail> | ReturnType<typeof saveReconciliationDetailFailure> | ReturnType<typeof saveReconciliationDetailSuccess> | ReturnType<typeof updateAccountRecon> | ReturnType<typeof updateBalancesLocalData> | ReturnType<typeof updateMultipleReconcileTransactions> | ReturnType<typeof updateReconcileTabLocalData>;
|
|
12
|
+
export declare const saveReconciliationDetailsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
|
|
13
|
+
export declare function createMessageForAction(action: ReconcileActionType): "Excluding Transaction" | "Reconciling" | "Saving for Later";
|
|
14
|
+
export declare function getTransactionIdFromCheckedMatchedTransactionPayload(transactions: MatchedTransactionPayload[]): ID[];
|
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.saveReconciliationDetailsEpic = void 0;
|
|
4
|
+
exports.createMessageForAction = createMessageForAction;
|
|
5
|
+
exports.getTransactionIdFromCheckedMatchedTransactionPayload = getTransactionIdFromCheckedMatchedTransactionPayload;
|
|
6
|
+
const rxjs_1 = require("rxjs");
|
|
7
|
+
const operators_1 = require("rxjs/operators");
|
|
8
|
+
const accountReconReducer_1 = require("../../../../entity/accountRecon/accountReconReducer");
|
|
9
|
+
const accountReconSelector_1 = require("../../../../entity/accountRecon/accountReconSelector");
|
|
10
|
+
const accountReconState_1 = require("../../../../entity/accountRecon/accountReconState");
|
|
11
|
+
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
12
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
13
|
+
const transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
|
|
14
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
15
|
+
const reconciliationHelpers_1 = require("../../helpers/reconciliationHelpers");
|
|
16
|
+
const reconciliationPayload_1 = require("../../payload/reconciliationPayload");
|
|
17
|
+
const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewReducer");
|
|
18
|
+
const saveReconciliationDetailsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(reconciliationViewReducer_1.saveReconciliationDetail.match), (0, operators_1.mergeMap)((action) => {
|
|
19
|
+
const state = state$.value;
|
|
20
|
+
const { reconcileAction } = action.payload;
|
|
21
|
+
const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationReconciliationViewState: { selectedAccountId, reconTabsState: { balances }, }, } = state;
|
|
22
|
+
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
23
|
+
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
24
|
+
let reconciliationData = undefined;
|
|
25
|
+
let reconciliationId = undefined;
|
|
26
|
+
if (selectedAccountId != null) {
|
|
27
|
+
reconciliationData = (0, accountReconSelector_1.getAccountReconByAccountIdAndSelectedPeriod)(state, selectedAccountId, selectedPeriod);
|
|
28
|
+
reconciliationId = reconciliationData === null || reconciliationData === void 0 ? void 0 : reconciliationData.reconciliationId;
|
|
29
|
+
}
|
|
30
|
+
let payload = {};
|
|
31
|
+
if (reconciliationData != null) {
|
|
32
|
+
payload = (0, reconciliationPayload_1.createSaveReconciliationPayloadBasedOnActionAndMethod)(state, selectedPeriod, balances, reconciliationData, action.payload, reconciliationId != null ? 'PUT' : 'POST');
|
|
33
|
+
}
|
|
34
|
+
const saveReconciliationDetailsApi = reconciliationId != null
|
|
35
|
+
? zeniAPI.putAndGetJSON(`${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/${reconciliationId}`, payload)
|
|
36
|
+
: zeniAPI.postAndGetJSON(`${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation`, payload);
|
|
37
|
+
return saveReconciliationDetailsApi.pipe((0, operators_1.mergeMap)((response) => {
|
|
38
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
39
|
+
const actions = [];
|
|
40
|
+
const selectedTransactionIds = getTransactionIdFromCheckedMatchedTransactionPayload(response.data.reconciliation[0].transactions.reconcile);
|
|
41
|
+
const allTransactionsPerRecon = (0, reconciliationHelpers_1.getAllReviewTransactionsFromReconcilePayload)(response.data.reconciliation);
|
|
42
|
+
actions.push((0, transactionReducer_1.updateMultipleReconcileTransactions)(allTransactionsPerRecon, 'merge'));
|
|
43
|
+
actions.push((0, accountReconReducer_1.updateAccountRecon)(selectedPeriod, response.data.reconciliation));
|
|
44
|
+
actions.push((0, reconciliationViewReducer_1.updateReconcileTabLocalData)({
|
|
45
|
+
selectedTransactionIds: selectedTransactionIds,
|
|
46
|
+
}));
|
|
47
|
+
if (action.payload.reconcileAction === 'exclude') {
|
|
48
|
+
if (selectedAccountId != null) {
|
|
49
|
+
const accountReconKey = (0, accountReconState_1.toAccountReconKey)(selectedAccountId, selectedPeriod);
|
|
50
|
+
actions.push((0, accountReconReducer_1.excludeReconReviewTransaction)(accountReconKey, action.payload.excludeTransactionId));
|
|
51
|
+
}
|
|
52
|
+
actions.push((0, reconciliationViewReducer_1.saveReconciliationDetailSuccess)({
|
|
53
|
+
reconcileAction,
|
|
54
|
+
excludeTransactionId: action.payload.excludeTransactionId,
|
|
55
|
+
}));
|
|
56
|
+
}
|
|
57
|
+
else if (action.payload.reconcileAction === 'reconcile' ||
|
|
58
|
+
action.payload.reconcileAction === 'save_reconcile_for_later') {
|
|
59
|
+
actions.push((0, reconciliationViewReducer_1.saveReconciliationDetailSuccess)({
|
|
60
|
+
reconcileAction: action.payload.reconcileAction,
|
|
61
|
+
}));
|
|
62
|
+
}
|
|
63
|
+
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
64
|
+
messageSection: action.payload.reconcileAction === 'reconcile'
|
|
65
|
+
? 'reconcile'
|
|
66
|
+
: action.payload.reconcileAction ===
|
|
67
|
+
'save_reconcile_for_later'
|
|
68
|
+
? 'save_reconcile_for_later'
|
|
69
|
+
: 'exclude_transaction',
|
|
70
|
+
messageText: 'success',
|
|
71
|
+
type: 'success',
|
|
72
|
+
}));
|
|
73
|
+
return (0, rxjs_1.from)(actions);
|
|
74
|
+
}
|
|
75
|
+
else {
|
|
76
|
+
const actions = [];
|
|
77
|
+
if (action.payload.reconcileAction === 'exclude') {
|
|
78
|
+
actions.push((0, reconciliationViewReducer_1.saveReconciliationDetailFailure)({
|
|
79
|
+
fetchStateByAction: {
|
|
80
|
+
reconcileAction: action.payload.reconcileAction,
|
|
81
|
+
excludeTransactionId: action.payload.excludeTransactionId,
|
|
82
|
+
},
|
|
83
|
+
error: response.status,
|
|
84
|
+
}));
|
|
85
|
+
}
|
|
86
|
+
else if (action.payload.reconcileAction === 'reconcile' ||
|
|
87
|
+
action.payload.reconcileAction === 'save_reconcile_for_later') {
|
|
88
|
+
actions.push((0, reconciliationViewReducer_1.saveReconciliationDetailFailure)({
|
|
89
|
+
fetchStateByAction: {
|
|
90
|
+
reconcileAction: action.payload.reconcileAction,
|
|
91
|
+
},
|
|
92
|
+
error: response.status,
|
|
93
|
+
}));
|
|
94
|
+
}
|
|
95
|
+
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
96
|
+
messageSection: action.payload.reconcileAction === 'reconcile'
|
|
97
|
+
? 'reconcile'
|
|
98
|
+
: action.payload.reconcileAction ===
|
|
99
|
+
'save_reconcile_for_later'
|
|
100
|
+
? 'save_reconcile_for_later'
|
|
101
|
+
: 'exclude_transaction',
|
|
102
|
+
messageText: 'failed',
|
|
103
|
+
type: 'error',
|
|
104
|
+
variables: [
|
|
105
|
+
{
|
|
106
|
+
variableName: '_api-error_',
|
|
107
|
+
variableValue: response.status.message,
|
|
108
|
+
},
|
|
109
|
+
],
|
|
110
|
+
}));
|
|
111
|
+
return (0, rxjs_1.from)(actions);
|
|
112
|
+
}
|
|
113
|
+
}), (0, operators_1.catchError)((error) => {
|
|
114
|
+
const actions = [];
|
|
115
|
+
if (action.payload.reconcileAction === 'exclude') {
|
|
116
|
+
actions.push((0, reconciliationViewReducer_1.saveReconciliationDetailFailure)({
|
|
117
|
+
fetchStateByAction: {
|
|
118
|
+
reconcileAction: action.payload.reconcileAction,
|
|
119
|
+
excludeTransactionId: action.payload.excludeTransactionId,
|
|
120
|
+
},
|
|
121
|
+
error: (0, responsePayload_1.createZeniAPIStatus)(`Unexpected Error occured while ${createMessageForAction(action.payload.reconcileAction)}`, 'save REST API call errored out' + JSON.stringify(error)),
|
|
122
|
+
}));
|
|
123
|
+
}
|
|
124
|
+
else if (action.payload.reconcileAction === 'reconcile' ||
|
|
125
|
+
action.payload.reconcileAction === 'save_reconcile_for_later') {
|
|
126
|
+
actions.push((0, reconciliationViewReducer_1.saveReconciliationDetailFailure)({
|
|
127
|
+
fetchStateByAction: {
|
|
128
|
+
reconcileAction: action.payload.reconcileAction,
|
|
129
|
+
},
|
|
130
|
+
error: (0, responsePayload_1.createZeniAPIStatus)(`Unexpected Error occured while ${createMessageForAction(action.payload.reconcileAction)}`, 'save REST API call errored out' + JSON.stringify(error)),
|
|
131
|
+
}));
|
|
132
|
+
}
|
|
133
|
+
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
134
|
+
messageSection: action.payload.reconcileAction === 'reconcile'
|
|
135
|
+
? 'reconcile'
|
|
136
|
+
: action.payload.reconcileAction ===
|
|
137
|
+
'save_reconcile_for_later'
|
|
138
|
+
? 'save_reconcile_for_later'
|
|
139
|
+
: 'exclude_transaction',
|
|
140
|
+
messageText: 'failed',
|
|
141
|
+
type: 'error',
|
|
142
|
+
variables: [
|
|
143
|
+
{
|
|
144
|
+
variableName: '_api-error_',
|
|
145
|
+
variableValue: `Unexpected Error occured while ${createMessageForAction(action.payload.reconcileAction)}` +
|
|
146
|
+
JSON.stringify(error),
|
|
147
|
+
},
|
|
148
|
+
],
|
|
149
|
+
}));
|
|
150
|
+
return (0, rxjs_1.from)(actions);
|
|
151
|
+
}));
|
|
152
|
+
}));
|
|
153
|
+
exports.saveReconciliationDetailsEpic = saveReconciliationDetailsEpic;
|
|
154
|
+
function createMessageForAction(action) {
|
|
155
|
+
switch (action) {
|
|
156
|
+
case 'exclude':
|
|
157
|
+
return 'Excluding Transaction';
|
|
158
|
+
case 'reconcile':
|
|
159
|
+
return 'Reconciling';
|
|
160
|
+
case 'save_reconcile_for_later':
|
|
161
|
+
return 'Saving for Later';
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
function getTransactionIdFromCheckedMatchedTransactionPayload(transactions) {
|
|
165
|
+
const selectedTransactionDetailKeys = transactions
|
|
166
|
+
.filter((transaction) => transaction.is_checked_transaction === true)
|
|
167
|
+
.map((transaction) => transaction.transaction_id);
|
|
168
|
+
return selectedTransactionDetailKeys;
|
|
169
|
+
}
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { addTransactionToReconcileList, excludeReconReviewTransaction } from '../../../../entity/accountRecon/accountReconReducer';
|
|
3
|
+
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
|
+
import { updateMultipleReconcileTransactions } from '../../../../entity/transaction/transactionReducer';
|
|
5
|
+
import { RootState } from '../../../../reducer';
|
|
6
|
+
import { ZeniAPI } from '../../../../zeniAPI';
|
|
7
|
+
import { saveReconciliationReview, updateReconcileTabLocalData, updateSaveReconciliationReviewFetchStatus } from '../../reducers/reconciliationViewReducer';
|
|
8
|
+
export type ActionType = ReturnType<typeof saveReconciliationReview> | ReturnType<typeof excludeReconReviewTransaction> | ReturnType<typeof updateMultipleReconcileTransactions> | ReturnType<typeof addTransactionToReconcileList> | ReturnType<typeof updateReconcileTabLocalData> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateSaveReconciliationReviewFetchStatus>;
|
|
9
|
+
export declare const saveReconciliationReviewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<ActionType>;
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.saveReconciliationReviewEpic = void 0;
|
|
4
|
+
const rxjs_1 = require("rxjs");
|
|
5
|
+
const operators_1 = require("rxjs/operators");
|
|
6
|
+
const formatZeniDateFY_1 = require("../../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
|
|
7
|
+
const accountReconReducer_1 = require("../../../../entity/accountRecon/accountReconReducer");
|
|
8
|
+
const accountReconSelector_1 = require("../../../../entity/accountRecon/accountReconSelector");
|
|
9
|
+
const accountReconState_1 = require("../../../../entity/accountRecon/accountReconState");
|
|
10
|
+
const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
|
|
11
|
+
const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
|
|
12
|
+
const transactionReducer_1 = require("../../../../entity/transaction/transactionReducer");
|
|
13
|
+
const vendorState_1 = require("../../../../entity/vendor/vendorState");
|
|
14
|
+
const responsePayload_1 = require("../../../../responsePayload");
|
|
15
|
+
const reconciliationViewReducer_1 = require("../../reducers/reconciliationViewReducer");
|
|
16
|
+
const saveReconciliationReviewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(reconciliationViewReducer_1.saveReconciliationReview.match), (0, operators_1.mergeMap)((action) => {
|
|
17
|
+
const state = state$.value;
|
|
18
|
+
const { transactionId } = action.payload;
|
|
19
|
+
const localData = state.expenseAutomationReconciliationViewState.reconTabsState.review
|
|
20
|
+
.localData[transactionId];
|
|
21
|
+
const reconcileTabLocalData = state.expenseAutomationReconciliationViewState.reconTabsState.reconcile
|
|
22
|
+
.localData;
|
|
23
|
+
const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationReconciliationViewState: { selectedAccountId }, } = state;
|
|
24
|
+
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
25
|
+
const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
|
|
26
|
+
let reconciliationData;
|
|
27
|
+
let reconciliationId = undefined;
|
|
28
|
+
let updatedTransaction;
|
|
29
|
+
if (selectedAccountId != null) {
|
|
30
|
+
reconciliationData = (0, accountReconSelector_1.getAccountReconByAccountIdAndSelectedPeriod)(state, selectedAccountId, selectedPeriod);
|
|
31
|
+
reconciliationId = reconciliationData === null || reconciliationData === void 0 ? void 0 : reconciliationData.reconciliationId;
|
|
32
|
+
updatedTransaction = reconciliationData === null || reconciliationData === void 0 ? void 0 : reconciliationData.transactionsToReview.find((transaction) => transaction.transactionId === transactionId);
|
|
33
|
+
}
|
|
34
|
+
const queryParam = {
|
|
35
|
+
review_action: updatedTransaction === null || updatedTransaction === void 0 ? void 0 : updatedTransaction.recommendedAction.action,
|
|
36
|
+
reconciliation_id: reconciliationId !== null && reconciliationId !== void 0 ? reconciliationId : '',
|
|
37
|
+
ref_account_id: selectedAccountId,
|
|
38
|
+
ref_account_name: reconciliationData === null || reconciliationData === void 0 ? void 0 : reconciliationData.account.accountName,
|
|
39
|
+
};
|
|
40
|
+
let payload = {};
|
|
41
|
+
if (reconciliationData != null &&
|
|
42
|
+
updatedTransaction != null &&
|
|
43
|
+
localData != null) {
|
|
44
|
+
if (updatedTransaction.recommendedAction.action === 'record_expense') {
|
|
45
|
+
payload = getPayloadForExpenseRecord(updatedTransaction, localData);
|
|
46
|
+
}
|
|
47
|
+
if (updatedTransaction.recommendedAction.action === 'record_bill_payment') {
|
|
48
|
+
const linkedTransaction = updatedTransaction.recommendedAction.recommendedTransactions.find((transaction) => transaction.transactionId === localData.matchedTransactionId);
|
|
49
|
+
payload = getPayloadForBillPayment(updatedTransaction, linkedTransaction, localData, reconciliationData === null || reconciliationData === void 0 ? void 0 : reconciliationData.account.accountType);
|
|
50
|
+
}
|
|
51
|
+
}
|
|
52
|
+
return zeniAPI
|
|
53
|
+
.postAndGetJSON(`${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/review?query=${encodeURIComponent(JSON.stringify(queryParam))}`, payload)
|
|
54
|
+
.pipe((0, operators_1.mergeMap)((response) => {
|
|
55
|
+
var _a, _b;
|
|
56
|
+
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
57
|
+
const actions = [];
|
|
58
|
+
actions.push((0, reconciliationViewReducer_1.updateSaveReconciliationReviewFetchStatus)({
|
|
59
|
+
transactionId,
|
|
60
|
+
fetchState: 'Completed',
|
|
61
|
+
}), (0, transactionReducer_1.updateMultipleReconcileTransactions)([
|
|
62
|
+
{
|
|
63
|
+
allReconciledTransactions: [response.data.reconciliation],
|
|
64
|
+
currencyPayload: {
|
|
65
|
+
currency_code: (_a = updatedTransaction === null || updatedTransaction === void 0 ? void 0 : updatedTransaction.amount.currencyCode) !== null && _a !== void 0 ? _a : vendorState_1.defaultVendorCurrency.currencyCode,
|
|
66
|
+
currency_symbol: (_b = updatedTransaction === null || updatedTransaction === void 0 ? void 0 : updatedTransaction.amount.currencySymbol) !== null && _b !== void 0 ? _b : vendorState_1.defaultVendorCurrency.currencySymbol,
|
|
67
|
+
},
|
|
68
|
+
},
|
|
69
|
+
], 'merge'));
|
|
70
|
+
if (selectedAccountId != null) {
|
|
71
|
+
const accountReconKey = (0, accountReconState_1.toAccountReconKey)(selectedAccountId, selectedPeriod);
|
|
72
|
+
actions.push((0, accountReconReducer_1.excludeReconReviewTransaction)(accountReconKey, transactionId), (0, accountReconReducer_1.addTransactionToReconcileList)(accountReconKey, response.data.reconciliation.transaction_id), (0, reconciliationViewReducer_1.updateReconcileTabLocalData)({
|
|
73
|
+
selectedTransactionIds: [
|
|
74
|
+
...reconcileTabLocalData.selectedTransactionIds,
|
|
75
|
+
response.data.reconciliation.transaction_id,
|
|
76
|
+
],
|
|
77
|
+
}));
|
|
78
|
+
}
|
|
79
|
+
actions.push((0, snackbarReducer_1.openSnackbar)({
|
|
80
|
+
messageSection: 'recon_transaction_creation',
|
|
81
|
+
messageText: 'success',
|
|
82
|
+
type: 'success',
|
|
83
|
+
}));
|
|
84
|
+
return (0, rxjs_1.from)(actions);
|
|
85
|
+
}
|
|
86
|
+
else {
|
|
87
|
+
const actions = [];
|
|
88
|
+
actions.push((0, reconciliationViewReducer_1.updateSaveReconciliationReviewFetchStatus)({
|
|
89
|
+
transactionId,
|
|
90
|
+
fetchState: 'Error',
|
|
91
|
+
error: response.status,
|
|
92
|
+
}), (0, snackbarReducer_1.openSnackbar)({
|
|
93
|
+
messageSection: 'recon_transaction_creation',
|
|
94
|
+
messageText: 'failed',
|
|
95
|
+
type: 'error',
|
|
96
|
+
variables: [
|
|
97
|
+
{
|
|
98
|
+
variableName: '_api-error_',
|
|
99
|
+
variableValue: response.status.message,
|
|
100
|
+
},
|
|
101
|
+
],
|
|
102
|
+
}));
|
|
103
|
+
return (0, rxjs_1.from)(actions);
|
|
104
|
+
}
|
|
105
|
+
}), (0, operators_1.catchError)((error) => {
|
|
106
|
+
const actions = [];
|
|
107
|
+
actions.push((0, reconciliationViewReducer_1.updateSaveReconciliationReviewFetchStatus)({
|
|
108
|
+
transactionId,
|
|
109
|
+
fetchState: 'Error',
|
|
110
|
+
error: (0, responsePayload_1.createZeniAPIStatus)(`Unexpected Error occurred while saving reconciliation review`, 'save reconciliation review REST API call errored out' +
|
|
111
|
+
JSON.stringify(error)),
|
|
112
|
+
}), (0, snackbarReducer_1.openSnackbar)({
|
|
113
|
+
messageSection: 'recon_transaction_creation',
|
|
114
|
+
messageText: 'failed',
|
|
115
|
+
type: 'error',
|
|
116
|
+
variables: [
|
|
117
|
+
{
|
|
118
|
+
variableName: '_api-error_',
|
|
119
|
+
variableValue: JSON.stringify('error'),
|
|
120
|
+
},
|
|
121
|
+
],
|
|
122
|
+
}));
|
|
123
|
+
return (0, rxjs_1.from)(actions);
|
|
124
|
+
}));
|
|
125
|
+
}));
|
|
126
|
+
exports.saveReconciliationReviewEpic = saveReconciliationReviewEpic;
|
|
127
|
+
function getPayloadForExpenseRecord(updatedTransaction, localData) {
|
|
128
|
+
var _a, _b;
|
|
129
|
+
return {
|
|
130
|
+
amount: updatedTransaction.amount.amount,
|
|
131
|
+
transaction_memo: localData.memo,
|
|
132
|
+
transaction_date: updatedTransaction.transactionDate.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT),
|
|
133
|
+
transaction_direction: updatedTransaction.transactionDirection,
|
|
134
|
+
transaction_id: updatedTransaction.transactionId,
|
|
135
|
+
vendor_id: (_a = localData.vendor) === null || _a === void 0 ? void 0 : _a.id,
|
|
136
|
+
vendor_name: (_b = localData.vendor) === null || _b === void 0 ? void 0 : _b.name,
|
|
137
|
+
account_id: localData.categoryId,
|
|
138
|
+
accounting_class_id: localData.classId,
|
|
139
|
+
currency_code: updatedTransaction.amount.currencyCode,
|
|
140
|
+
};
|
|
141
|
+
}
|
|
142
|
+
const getPayloadForBillPayment = (updatedTransaction, linkedTransaction, localData, accountType) => {
|
|
143
|
+
return {
|
|
144
|
+
account_type: accountType,
|
|
145
|
+
amount: updatedTransaction.amount.amount,
|
|
146
|
+
transaction_memo: localData.memo,
|
|
147
|
+
transaction_date: updatedTransaction.transactionDate.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT),
|
|
148
|
+
transaction_direction: updatedTransaction.transactionDirection,
|
|
149
|
+
transaction_id: updatedTransaction.transactionId,
|
|
150
|
+
linked_transaction_id: linkedTransaction === null || linkedTransaction === void 0 ? void 0 : linkedTransaction.transactionId,
|
|
151
|
+
linked_transaction_type: linkedTransaction === null || linkedTransaction === void 0 ? void 0 : linkedTransaction.transactionType,
|
|
152
|
+
currency_code: updatedTransaction.amount.currencyCode,
|
|
153
|
+
};
|
|
154
|
+
};
|
package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.d.ts
ADDED
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
+
import { Observable } from 'rxjs';
|
|
3
|
+
import { RootState } from '../../../../reducer';
|
|
4
|
+
import { updateBalancesLocalData, updateReconcileTabLocalData } from '../../reducers/reconciliationViewReducer';
|
|
5
|
+
export type ActionType = ReturnType<typeof updateReconcileTabLocalData> | ReturnType<typeof updateBalancesLocalData>;
|
|
6
|
+
export declare const updateReconcileTabLocalDataEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
|