@zeniai/client-epic-state 4.15.34 → 4.15.36
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/commonPayloadTypes/recommendationPayload.d.ts +1 -0
- package/lib/commonStateTypes/timePeriod.d.ts +1 -1
- package/lib/commonStateTypes/timePeriod.js +2 -2
- package/lib/commonStateTypes/viewAndReport/agingReportStateTypes.js +1 -1
- 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/company/companyReducer.js +0 -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.js +0 -1
- 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 +9 -6
- 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 -1
- 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/vendorExpenseReducer.js +0 -1
- 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 +22 -13
- package/lib/index.js +56 -27
- package/lib/init.d.ts +2 -1
- package/lib/init.js +9 -2
- package/lib/reducer.d.ts +7 -1
- package/lib/reducer.js +6 -0
- package/lib/view/accountList/accountListReducer.js +1 -3
- package/lib/view/accountMappingView/accountMappingReducer.js +0 -1
- package/lib/view/apAgingView/apAgingDetail/apAgingDetailReducer.js +1 -2
- package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
- package/lib/view/balanceSheet/balanceSheetReducer.js +1 -6
- package/lib/view/bankAccountView/bankAccountViewReducer.js +0 -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/cashFlow/cashFlowReducer.js +1 -4
- package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
- package/lib/view/cashPosition/cashPositionReducer.js +0 -1
- package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
- package/lib/view/commonVendorView/vendorView/epics/fetchAndUpdateVendorRecommendationsEpic.js +1 -3
- package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.d.ts +2 -2
- package/lib/view/companyView/companyViewReducer.js +1 -10
- package/lib/view/dashboard/dashboardEpic.js +0 -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 +32 -5
- package/lib/view/expenseAutomationView/expenseAutomationViewReducer.d.ts +2 -2
- package/lib/view/expenseAutomationView/expenseAutomationViewReducer.js +1 -5
- 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 +111 -35
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +84 -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 +12 -1
- package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +66 -7
- 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 +10 -0
- package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
- package/lib/view/financeStatement/financeStatementReducer.js +1 -4
- package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
- package/lib/view/netBurnOrIncome/netBurnOrIncomeReducer.js +3 -10
- package/lib/view/netBurnOrIncomeClassesView/netBurnOrIncomeClassesViewReducer.js +1 -6
- package/lib/view/netBurnOrIncomeStoryCard/netBurnOrIncomeStoryCardReducer.js +0 -1
- package/lib/view/onboardingView/cockpitView/onboardingCockpitViewReducer.js +0 -3
- package/lib/view/opEx/opExForTimeFrameEpic.js +1 -1
- package/lib/view/opEx/opExReducer.js +4 -14
- package/lib/view/opExByVendor/opExByVendorReducer.js +1 -3
- package/lib/view/opExClassesView/opExClassesViewReducer.js +1 -6
- package/lib/view/people/fetchPeopleEpic.js +1 -3
- package/lib/view/people/invitePeopleEpic.js +1 -3
- package/lib/view/people/inviteZeniPeopleEpic.js +1 -3
- package/lib/view/people/peopleReducer.js +0 -1
- package/lib/view/people/peopleSaveUpdatesEpic.js +1 -1
- package/lib/view/profitAndLoss/profitAndLossReducer.js +1 -6
- package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +1 -6
- package/lib/view/recommendation/recommendationReducer.js +1 -4
- package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
- package/lib/view/reportUIOptions/updateReportUIOptionThisPeriodEpic.js +1 -3
- package/lib/view/revenue/revenueReducer.js +3 -10
- package/lib/view/revenueClassesView/revenueClassesViewReducer.js +1 -6
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
- package/lib/view/settingsView/settingsViewReducer.js +0 -1
- package/lib/view/spendManagement/billPay/billList/billListReducer.js +0 -1
- package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigPayload.d.ts +5 -1
- package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.js +0 -6
- package/lib/view/spendManagement/billPay/billsBulkActionView/epics/validateBillsBulkActionEpic.ts.js +4 -3
- package/lib/view/spendManagement/billPay/editBillView/epics/fetchBillAndInitializeLocalStoreEpic.js +1 -3
- package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.d.ts +2 -1
- 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/spendManagement/reimbursement/editRemiView/epics/fetchRecommendationsAndUpdateMerchantRecommendationsEpic.js +2 -6
- package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchRemiAndInitializeLocalStoreEpic.js +1 -3
- package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.js +0 -1
- package/lib/view/spendManagement/zeniAccounts/expressPay/epics/fetchExpressPayInitialDetailsEpic.d.ts +2 -2
- package/lib/view/spendManagement/zeniAccounts/expressPay/epics/fetchExpressPayInitialDetailsEpic.js +7 -7
- package/lib/view/spendManagement/zeniAccounts/expressPay/expressPaySelector.d.ts +2 -2
- package/lib/view/spendManagement/zeniAccounts/expressPay/expressPaySelector.js +5 -4
- package/lib/view/spendManagement/zeniAccounts/expressPay/expressPayState.d.ts +2 -2
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigPayload.d.ts +14 -0
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigPayload.js +78 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigReducer.js +3 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigSelector.d.ts +2 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigSelector.js +2 -1
- package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigState.d.ts +9 -0
- package/lib/view/subscriptionView/subscriptionViewReducer.js +0 -1
- package/lib/view/subscriptionView/types/subscriptionTypes.js +0 -1
- package/lib/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +1 -3
- package/lib/view/tasksCard/fetchTasksCardEpic.js +1 -2
- package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
- package/lib/view/tasksCard/tasksCardSelector.js +1 -1
- package/lib/view/topEx/topExSelector.d.ts +1 -1
- package/lib/view/transactionDetail/epics/saveTransactionHelper.js +45 -15
- package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +22 -4
- package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +69 -13
- package/lib/view/transactionDetail/transactionDetailReducer.d.ts +11 -2
- package/lib/view/transactionDetail/transactionDetailReducer.js +51 -21
- package/lib/view/transactionDetail/transactionDetailState.d.ts +1 -0
- package/lib/view/transactionDetail/transactionDetailTypes.d.ts +8 -0
- package/lib/view/transactionList/transactionListByEntitySelector.js +0 -2
- package/lib/view/transactionList/transactionListReducer.js +4 -6
- package/lib/view/trendWithTransactions/trendWithTransactionsReducer.js +0 -1
- package/lib/view/userFinancialAccount/userFinancialAccountReducer.js +1 -3
- package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewState.d.ts +1 -1
- package/lib/zeniAPI.d.ts +1 -0
- package/package.json +9 -3
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
import { MonthYearPeriod } from '../../../commonStateTypes/timePeriod';
|
|
2
|
+
import { AccountPayload } from '../../../entity/account/accountPayload';
|
|
3
|
+
import { ReconciliationDataPayload, TransactionsToReviewPayload } from '../../../entity/accountRecon/accountReconPayload';
|
|
4
|
+
import { AccountReconciliationEntity } from '../../../entity/accountRecon/accountReconSelector';
|
|
5
|
+
import { MatchedTransactionPayload } from '../../../entity/transaction/payloadTypes/reconciliationTransactionPayloads';
|
|
6
|
+
import { UserPayload } from '../../../entity/user/userPayload';
|
|
7
|
+
import { RootState } from '../../../reducer';
|
|
8
|
+
import { ZeniAPIResponse } from '../../../responsePayload';
|
|
9
|
+
import { BalancesLocalData, SaveReconcileDetailActionPayload } from '../types/reconciliationViewState';
|
|
10
|
+
export interface AccountAndPaymentAccountPayload extends AccountPayload {
|
|
11
|
+
payment_account_id: string | null;
|
|
12
|
+
}
|
|
13
|
+
export interface ReconciliationPayload {
|
|
14
|
+
accounts: AccountAndPaymentAccountPayload[];
|
|
15
|
+
reconciliation: ReconciliationDataPayload[];
|
|
16
|
+
users: UserPayload[];
|
|
17
|
+
}
|
|
18
|
+
export type ReconciliationResponse = ZeniAPIResponse<ReconciliationPayload>;
|
|
19
|
+
export interface SaveReconciliationReviewPayload {
|
|
20
|
+
reconciliation: MatchedTransactionPayload;
|
|
21
|
+
}
|
|
22
|
+
export type SaveReconciliationReviewResponse = ZeniAPIResponse<SaveReconciliationReviewPayload>;
|
|
23
|
+
export declare function createSaveReconciliationPayloadBasedOnActionAndMethod(state: RootState, selectedPeriod: MonthYearPeriod, localData: BalancesLocalData, accountReconciliationEntity: AccountReconciliationEntity, action: SaveReconcileDetailActionPayload, method: 'PUT' | 'POST'): {
|
|
24
|
+
transactions: {
|
|
25
|
+
reconcile: MatchedTransactionPayload[];
|
|
26
|
+
review: TransactionsToReviewPayload[];
|
|
27
|
+
};
|
|
28
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.createSaveReconciliationPayloadBasedOnActionAndMethod = createSaveReconciliationPayloadBasedOnActionAndMethod;
|
|
4
|
+
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
5
|
+
const accountReconPayload_1 = require("../../../entity/accountRecon/accountReconPayload");
|
|
6
|
+
const reconciliationTransactionPayloads_1 = require("../../../entity/transaction/payloadTypes/reconciliationTransactionPayloads");
|
|
7
|
+
function createSaveReconciliationPayloadBasedOnActionAndMethod(state, selectedPeriod, localData, accountReconciliationEntity, action, method) {
|
|
8
|
+
var _a;
|
|
9
|
+
const { balance, initialClearedBalance } = accountReconciliationEntity;
|
|
10
|
+
const { expenseAutomationReconciliationViewState: { selectedAccountId, reconTabsState: { reconcile: { localData: { selectedTransactionIds }, }, }, }, } = state;
|
|
11
|
+
const period = (0, timePeriod_1.convertToPeriod)(selectedPeriod, true);
|
|
12
|
+
let payload = {};
|
|
13
|
+
payload = Object.assign({ action: action.reconcileAction === 'save_reconcile_for_later'
|
|
14
|
+
? 'save_for_later'
|
|
15
|
+
: action.reconcileAction, account_type: 'bank', bank_balance: (_a = balance === null || balance === void 0 ? void 0 : balance.amount) !== null && _a !== void 0 ? _a : 0, cleared_balance: localData.clearedBalance.amount, variance: localData.variance.amount, currency_code: balance === null || balance === void 0 ? void 0 : balance.currencyCode }, ((initialClearedBalance === null || initialClearedBalance === void 0 ? void 0 : initialClearedBalance.amount) != null
|
|
16
|
+
? {
|
|
17
|
+
initial_cleared_balance: initialClearedBalance.amount,
|
|
18
|
+
}
|
|
19
|
+
: {}));
|
|
20
|
+
if (method === 'POST') {
|
|
21
|
+
payload = Object.assign(Object.assign({}, payload), { account_id: selectedAccountId, start_date: period.start, end_date: period.end });
|
|
22
|
+
}
|
|
23
|
+
if (action.reconcileAction === 'exclude') {
|
|
24
|
+
payload = Object.assign(Object.assign({}, payload), { exclude_transaction_ids: [action.excludeTransactionId] });
|
|
25
|
+
}
|
|
26
|
+
const reconciledTransactionsPayload = createReconcileTransactionPayload(selectedTransactionIds, accountReconciliationEntity);
|
|
27
|
+
const reviewTransactionsPayload = createReviewTransactionPayload(accountReconciliationEntity);
|
|
28
|
+
return Object.assign(Object.assign({}, payload), { transactions: {
|
|
29
|
+
reconcile: reconciledTransactionsPayload,
|
|
30
|
+
review: reviewTransactionsPayload,
|
|
31
|
+
} });
|
|
32
|
+
}
|
|
33
|
+
function createReconcileTransactionPayload(selectedIds, accountReconciliationEntity) {
|
|
34
|
+
const matchedTransactionsPayload = [];
|
|
35
|
+
const matchedReconcileTransactions = accountReconciliationEntity.transactionsToReconcile.map((transaction) => {
|
|
36
|
+
return Object.assign(Object.assign({}, transaction), { isTransactionChecked: selectedIds.includes(transaction.id) });
|
|
37
|
+
});
|
|
38
|
+
matchedReconcileTransactions.forEach((transaction) => {
|
|
39
|
+
const matchTransactionPayload = (0, reconciliationTransactionPayloads_1.toMatchedTransactionPayload)(transaction);
|
|
40
|
+
matchedTransactionsPayload.push(matchTransactionPayload);
|
|
41
|
+
});
|
|
42
|
+
return matchedTransactionsPayload;
|
|
43
|
+
}
|
|
44
|
+
function createReviewTransactionPayload(accountReconciliationEntity) {
|
|
45
|
+
const reviewTransactionsPayload = [];
|
|
46
|
+
accountReconciliationEntity.transactionsToReview.forEach((transaction) => {
|
|
47
|
+
const matchTransactionPayload = (0, accountReconPayload_1.toTransactionsToReviewPayload)(transaction);
|
|
48
|
+
reviewTransactionsPayload.push(matchTransactionPayload);
|
|
49
|
+
});
|
|
50
|
+
return reviewTransactionsPayload;
|
|
51
|
+
}
|
|
@@ -0,0 +1,66 @@
|
|
|
1
|
+
import { Amount } from '../../../commonStateTypes/amount';
|
|
2
|
+
import { FetchState, ID } from '../../../commonStateTypes/common';
|
|
3
|
+
import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderTypes';
|
|
4
|
+
import { MonthYearPeriod } from '../../../commonStateTypes/timePeriod';
|
|
5
|
+
import { ZeniAPIStatus } from '../../../responsePayload';
|
|
6
|
+
import { ReconciliationPayload } from '../payload/reconciliationPayload';
|
|
7
|
+
import { ActionFetchStates, ReconReconcileSortKey, ReconReviewSortKey, ReconciliationReviewTabLocalData, ReconciliationTabsState, ReconciliationViewState, ReconciliationViewTabType, SaveReconcileDetailActionPayload, SaveReconciliationDetailFailurePayload, TransactionSummary } from '../types/reconciliationViewState';
|
|
8
|
+
export declare const initialReconciliationTabsState: ReconciliationTabsState;
|
|
9
|
+
export declare const initialActionFetchState: ActionFetchStates;
|
|
10
|
+
export declare const initialState: ReconciliationViewState;
|
|
11
|
+
export declare const fetchReconciliation: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedPeriod: MonthYearPeriod, accountId?: string | undefined, cacheOverride?: any, refreshViewInBackground?: any], {
|
|
12
|
+
selectedPeriod: MonthYearPeriod;
|
|
13
|
+
accountId: string | undefined;
|
|
14
|
+
cacheOverride: any;
|
|
15
|
+
refreshViewInBackground: any;
|
|
16
|
+
}, "expenseAutomationReconciliationView/fetchReconciliation", never, never>, fetchReconciliationFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
17
|
+
selectedPeriod: MonthYearPeriod;
|
|
18
|
+
error: ZeniAPIStatus;
|
|
19
|
+
refreshViewInBackground: boolean;
|
|
20
|
+
accountId?: ID;
|
|
21
|
+
reconciliationId?: ID;
|
|
22
|
+
}, "expenseAutomationReconciliationView/fetchReconciliationFailure">, fetchReconciliationSuccess: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedPeriod: MonthYearPeriod, reconciliation: ReconciliationPayload, refreshViewInBackground?: any, accountId?: string | undefined, reconciliationId?: string | undefined], {
|
|
23
|
+
selectedPeriod: MonthYearPeriod;
|
|
24
|
+
reconciliation: ReconciliationPayload;
|
|
25
|
+
refreshViewInBackground: any;
|
|
26
|
+
accountId: string | undefined;
|
|
27
|
+
reconciliationId: string | undefined;
|
|
28
|
+
}, "expenseAutomationReconciliationView/fetchReconciliationSuccess", never, never>, saveReconciliationDetail: import("@reduxjs/toolkit").ActionCreatorWithPayload<SaveReconcileDetailActionPayload, "expenseAutomationReconciliationView/saveReconciliationDetail">, saveReconciliationDetailFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<SaveReconciliationDetailFailurePayload, "expenseAutomationReconciliationView/saveReconciliationDetailFailure">, updateSelectedAccountId: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
29
|
+
selectedAccountId?: ID;
|
|
30
|
+
}, "expenseAutomationReconciliationView/updateSelectedAccountId">, setConnectionInProgressForAccount: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
31
|
+
accountId: ID;
|
|
32
|
+
connectionInProgress: boolean;
|
|
33
|
+
}, "expenseAutomationReconciliationView/setConnectionInProgressForAccount">, updateReconcileTabLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
34
|
+
selectedTransactionIds: ID[];
|
|
35
|
+
}, "expenseAutomationReconciliationView/updateReconcileTabLocalData">, updateReconcileTabListSortState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
36
|
+
sortKey: ReconReconcileSortKey;
|
|
37
|
+
sortOrder: SortOrder;
|
|
38
|
+
}, "expenseAutomationReconciliationView/updateReconcileTabListSortState">, updateReconcileTabListScrollState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
39
|
+
scrollYOffset: number;
|
|
40
|
+
}, "expenseAutomationReconciliationView/updateReconcileTabListScrollState">, saveReconciliationDetailSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<SaveReconcileDetailActionPayload, "expenseAutomationReconciliationView/saveReconciliationDetailSuccess">, updateSelectedTab: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
41
|
+
selectedTab: ReconciliationViewTabType;
|
|
42
|
+
}, "expenseAutomationReconciliationView/updateSelectedTab">, updateBalancesLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
43
|
+
clearedBalance: Amount;
|
|
44
|
+
variance: Amount;
|
|
45
|
+
variancePercentage: number;
|
|
46
|
+
payments: TransactionSummary;
|
|
47
|
+
deposits: TransactionSummary;
|
|
48
|
+
}, "expenseAutomationReconciliationView/updateBalancesLocalData">, initialiseLocalDataForSelectedAccountId: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationReconciliationView/initialiseLocalDataForSelectedAccountId">, clearExpenseAutomationReconciliationView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationReconciliationView/clearExpenseAutomationReconciliationView">, updateSelectedDrawerAccountId: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
49
|
+
selectedDrawerAccountId?: ID;
|
|
50
|
+
}, "expenseAutomationReconciliationView/updateSelectedDrawerAccountId">, updateReviewTabSortState: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
51
|
+
sortKey: ReconReviewSortKey;
|
|
52
|
+
sortOrder: SortOrder;
|
|
53
|
+
}, "expenseAutomationReconciliationView/updateReviewTabSortState">, initializeReconciliationReviewTabLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[localData: Record<string, ReconciliationReviewTabLocalData>], {
|
|
54
|
+
localData: Record<string, ReconciliationReviewTabLocalData>;
|
|
55
|
+
}, "expenseAutomationReconciliationView/initializeReconciliationReviewTabLocalData", never, never>, updateReviewTabLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
56
|
+
data: ReconciliationReviewTabLocalData;
|
|
57
|
+
transactionId: ID;
|
|
58
|
+
}, "expenseAutomationReconciliationView/updateReviewTabLocalData">, saveReconciliationReview: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: string], {
|
|
59
|
+
transactionId: string;
|
|
60
|
+
}, "expenseAutomationReconciliationView/saveReconciliationReview", never, never>, updateSaveReconciliationReviewFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
61
|
+
transactionId: ID;
|
|
62
|
+
fetchState: FetchState;
|
|
63
|
+
error?: ZeniAPIStatus;
|
|
64
|
+
}, "expenseAutomationReconciliationView/updateSaveReconciliationReviewFetchStatus">;
|
|
65
|
+
declare const _default: import("redux").Reducer<ReconciliationViewState>;
|
|
66
|
+
export default _default;
|
|
@@ -0,0 +1,384 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var _a;
|
|
3
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
+
exports.updateSaveReconciliationReviewFetchStatus = exports.saveReconciliationReview = exports.updateReviewTabLocalData = exports.initializeReconciliationReviewTabLocalData = exports.updateReviewTabSortState = exports.updateSelectedDrawerAccountId = exports.clearExpenseAutomationReconciliationView = exports.initialiseLocalDataForSelectedAccountId = exports.updateBalancesLocalData = exports.updateSelectedTab = exports.saveReconciliationDetailSuccess = exports.updateReconcileTabListScrollState = exports.updateReconcileTabListSortState = exports.updateReconcileTabLocalData = exports.setConnectionInProgressForAccount = exports.updateSelectedAccountId = exports.saveReconciliationDetailFailure = exports.saveReconciliationDetail = exports.fetchReconciliationSuccess = exports.fetchReconciliationFailure = exports.fetchReconciliation = exports.initialState = exports.initialActionFetchState = exports.initialReconciliationTabsState = void 0;
|
|
5
|
+
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
|
+
const timePeriod_1 = require("../../../commonStateTypes/timePeriod");
|
|
7
|
+
const accountReconState_1 = require("../../../entity/accountRecon/accountReconState");
|
|
8
|
+
// Initial state
|
|
9
|
+
exports.initialReconciliationTabsState = {
|
|
10
|
+
balances: {
|
|
11
|
+
clearedBalance: { amount: 0, currencyCode: 'USD', currencySymbol: '$' },
|
|
12
|
+
variance: { amount: 0, currencyCode: 'USD', currencySymbol: '$' },
|
|
13
|
+
variancePercentage: 0,
|
|
14
|
+
deposits: {
|
|
15
|
+
count: 0,
|
|
16
|
+
totalAmount: { amount: 0, currencyCode: 'USD', currencySymbol: '$' },
|
|
17
|
+
},
|
|
18
|
+
payments: {
|
|
19
|
+
count: 0,
|
|
20
|
+
totalAmount: { amount: 0, currencyCode: 'USD', currencySymbol: '$' },
|
|
21
|
+
},
|
|
22
|
+
},
|
|
23
|
+
reconcile: {
|
|
24
|
+
localData: {
|
|
25
|
+
selectedTransactionIds: [],
|
|
26
|
+
},
|
|
27
|
+
uiState: {
|
|
28
|
+
scrollYOffset: undefined,
|
|
29
|
+
sortKey: 'date',
|
|
30
|
+
sortOrder: 'descending',
|
|
31
|
+
},
|
|
32
|
+
},
|
|
33
|
+
review: {
|
|
34
|
+
localData: {},
|
|
35
|
+
uiState: {
|
|
36
|
+
scrollPosition: undefined,
|
|
37
|
+
sortKey: 'date',
|
|
38
|
+
sortOrder: 'descending',
|
|
39
|
+
},
|
|
40
|
+
},
|
|
41
|
+
};
|
|
42
|
+
exports.initialActionFetchState = {
|
|
43
|
+
excludeFetchById: {},
|
|
44
|
+
reconcileFetch: {
|
|
45
|
+
fetchState: 'Not-Started',
|
|
46
|
+
error: undefined,
|
|
47
|
+
},
|
|
48
|
+
saveForLaterFetch: {
|
|
49
|
+
fetchState: 'Not-Started',
|
|
50
|
+
error: undefined,
|
|
51
|
+
},
|
|
52
|
+
saveReconciliationReviewFetch: {},
|
|
53
|
+
};
|
|
54
|
+
exports.initialState = {
|
|
55
|
+
accountReconciliationRecordsBySelectedPeriod: {},
|
|
56
|
+
accountConnectionStatusByAccountID: {},
|
|
57
|
+
fetchState: 'Not-Started',
|
|
58
|
+
error: undefined,
|
|
59
|
+
selectedTab: 'review',
|
|
60
|
+
reconTabsState: exports.initialReconciliationTabsState,
|
|
61
|
+
refreshStatus: { fetchState: 'Not-Started', error: undefined },
|
|
62
|
+
actionFetchState: exports.initialActionFetchState,
|
|
63
|
+
selectedAccountId: undefined,
|
|
64
|
+
};
|
|
65
|
+
// Create slice with reducers
|
|
66
|
+
const expenseAutomationReconciliationView = (0, toolkit_1.createSlice)({
|
|
67
|
+
name: 'expenseAutomationReconciliationView',
|
|
68
|
+
initialState: exports.initialState,
|
|
69
|
+
reducers: {
|
|
70
|
+
fetchReconciliation: {
|
|
71
|
+
reducer(draft, action) {
|
|
72
|
+
if (action.payload.accountId == null) {
|
|
73
|
+
if (action.payload.refreshViewInBackground === true) {
|
|
74
|
+
draft.refreshStatus = { fetchState: 'In-Progress', error: undefined };
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
draft.fetchState = 'In-Progress';
|
|
78
|
+
draft.error = undefined;
|
|
79
|
+
}
|
|
80
|
+
}
|
|
81
|
+
else {
|
|
82
|
+
// select the account for which we are fetching
|
|
83
|
+
draft.selectedAccountId = action.payload.accountId;
|
|
84
|
+
const accountReconciliationRecords = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(action.payload.selectedPeriod)];
|
|
85
|
+
const { transactionFetchState } = accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId];
|
|
86
|
+
if (transactionFetchState.fetchState !== 'Completed' ||
|
|
87
|
+
action.payload.cacheOverride === true) {
|
|
88
|
+
const data = accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId];
|
|
89
|
+
if (action.payload.refreshViewInBackground === true) {
|
|
90
|
+
accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId] = Object.assign(Object.assign({}, data), { refreshStatus: {
|
|
91
|
+
fetchState: 'In-Progress',
|
|
92
|
+
error: undefined,
|
|
93
|
+
}, accountId: action.payload.accountId, reconciliationId: undefined });
|
|
94
|
+
}
|
|
95
|
+
else {
|
|
96
|
+
accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId] = Object.assign(Object.assign({}, data), { transactionFetchState: {
|
|
97
|
+
fetchState: 'In-Progress',
|
|
98
|
+
error: undefined,
|
|
99
|
+
}, accountId: action.payload.accountId, reconciliationId: undefined });
|
|
100
|
+
}
|
|
101
|
+
}
|
|
102
|
+
}
|
|
103
|
+
},
|
|
104
|
+
prepare(selectedPeriod, accountId, cacheOverride = false, refreshViewInBackground = false) {
|
|
105
|
+
return {
|
|
106
|
+
payload: {
|
|
107
|
+
selectedPeriod,
|
|
108
|
+
accountId,
|
|
109
|
+
cacheOverride,
|
|
110
|
+
refreshViewInBackground,
|
|
111
|
+
},
|
|
112
|
+
};
|
|
113
|
+
},
|
|
114
|
+
},
|
|
115
|
+
fetchReconciliationSuccess: {
|
|
116
|
+
reducer(draft, action) {
|
|
117
|
+
if (action.payload.accountId == null) {
|
|
118
|
+
updateAllReconciliation(draft, action.payload.reconciliation.accounts, action.payload.selectedPeriod, action.payload.reconciliation.reconciliation, action.payload.refreshViewInBackground);
|
|
119
|
+
}
|
|
120
|
+
else if (action.payload.reconciliation.reconciliation.length > 0 &&
|
|
121
|
+
action.payload.reconciliation.accounts.length > 0) {
|
|
122
|
+
updateReconciliationByAccountID(draft, action.payload.reconciliation.accounts[0], action.payload.selectedPeriod, action.payload.accountId, action.payload.reconciliation.reconciliation[0], action.payload.refreshViewInBackground);
|
|
123
|
+
}
|
|
124
|
+
},
|
|
125
|
+
prepare(selectedPeriod, reconciliation, refreshViewInBackground = false, accountId, reconciliationId) {
|
|
126
|
+
return {
|
|
127
|
+
payload: {
|
|
128
|
+
selectedPeriod,
|
|
129
|
+
reconciliation,
|
|
130
|
+
refreshViewInBackground,
|
|
131
|
+
accountId,
|
|
132
|
+
reconciliationId,
|
|
133
|
+
},
|
|
134
|
+
};
|
|
135
|
+
},
|
|
136
|
+
},
|
|
137
|
+
fetchReconciliationFailure: (draft, action) => {
|
|
138
|
+
if (action.payload.accountId == null) {
|
|
139
|
+
if (action.payload.refreshViewInBackground === true) {
|
|
140
|
+
draft.refreshStatus = {
|
|
141
|
+
fetchState: 'Error',
|
|
142
|
+
error: action.payload.error,
|
|
143
|
+
};
|
|
144
|
+
}
|
|
145
|
+
else {
|
|
146
|
+
draft.error = action.payload.error;
|
|
147
|
+
draft.fetchState = 'Error';
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
else {
|
|
151
|
+
const accountReconciliationRecords = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(action.payload.selectedPeriod)];
|
|
152
|
+
if (action.payload.refreshViewInBackground === true) {
|
|
153
|
+
accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId].refreshStatus.error = action.payload.error;
|
|
154
|
+
accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId].refreshStatus.fetchState = 'Error';
|
|
155
|
+
}
|
|
156
|
+
else {
|
|
157
|
+
accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId].transactionFetchState.error = action.payload.error;
|
|
158
|
+
accountReconciliationRecords.reconciliationByAccountID[action.payload.accountId].transactionFetchState.fetchState = 'Error';
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
},
|
|
162
|
+
saveReconciliationDetail: (draft, action) => {
|
|
163
|
+
const { reconcileAction } = action.payload;
|
|
164
|
+
if (reconcileAction === 'reconcile') {
|
|
165
|
+
draft.actionFetchState.reconcileFetch = {
|
|
166
|
+
fetchState: 'In-Progress',
|
|
167
|
+
error: undefined,
|
|
168
|
+
};
|
|
169
|
+
}
|
|
170
|
+
else if (reconcileAction === 'save_reconcile_for_later') {
|
|
171
|
+
draft.actionFetchState.saveForLaterFetch = {
|
|
172
|
+
fetchState: 'In-Progress',
|
|
173
|
+
error: undefined,
|
|
174
|
+
};
|
|
175
|
+
}
|
|
176
|
+
else if (reconcileAction === 'exclude') {
|
|
177
|
+
const excludeTransactionId = action.payload.excludeTransactionId;
|
|
178
|
+
const excludeFetchStates = draft.actionFetchState.excludeFetchById;
|
|
179
|
+
draft.actionFetchState.excludeFetchById = Object.assign(Object.assign({}, excludeFetchStates), { [excludeTransactionId]: {
|
|
180
|
+
fetchState: 'In-Progress',
|
|
181
|
+
error: undefined,
|
|
182
|
+
} });
|
|
183
|
+
}
|
|
184
|
+
},
|
|
185
|
+
saveReconciliationDetailFailure: (draft, action) => {
|
|
186
|
+
const { reconcileAction } = action.payload.fetchStateByAction;
|
|
187
|
+
const { error } = action.payload;
|
|
188
|
+
if (reconcileAction === 'reconcile') {
|
|
189
|
+
draft.actionFetchState.reconcileFetch = {
|
|
190
|
+
fetchState: 'Error',
|
|
191
|
+
error: error,
|
|
192
|
+
};
|
|
193
|
+
}
|
|
194
|
+
else if (reconcileAction === 'save_reconcile_for_later') {
|
|
195
|
+
draft.actionFetchState.saveForLaterFetch = {
|
|
196
|
+
fetchState: 'Error',
|
|
197
|
+
error: error,
|
|
198
|
+
};
|
|
199
|
+
}
|
|
200
|
+
else if (reconcileAction === 'exclude') {
|
|
201
|
+
const excludeTransactionId = action.payload.fetchStateByAction.excludeTransactionId;
|
|
202
|
+
const excludeFetchStates = draft.actionFetchState.excludeFetchById;
|
|
203
|
+
draft.actionFetchState.excludeFetchById = Object.assign(Object.assign({}, excludeFetchStates), { [excludeTransactionId]: {
|
|
204
|
+
fetchState: 'Error',
|
|
205
|
+
error: error,
|
|
206
|
+
} });
|
|
207
|
+
}
|
|
208
|
+
},
|
|
209
|
+
saveReconciliationDetailSuccess: (draft, action) => {
|
|
210
|
+
const { reconcileAction } = action.payload;
|
|
211
|
+
if (reconcileAction === 'reconcile') {
|
|
212
|
+
draft.actionFetchState.reconcileFetch = {
|
|
213
|
+
fetchState: 'Completed',
|
|
214
|
+
error: undefined,
|
|
215
|
+
};
|
|
216
|
+
}
|
|
217
|
+
else if (reconcileAction === 'save_reconcile_for_later') {
|
|
218
|
+
draft.actionFetchState.saveForLaterFetch = {
|
|
219
|
+
fetchState: 'Completed',
|
|
220
|
+
error: undefined,
|
|
221
|
+
};
|
|
222
|
+
}
|
|
223
|
+
else if (reconcileAction === 'exclude') {
|
|
224
|
+
const excludeTransactionId = action.payload.excludeTransactionId;
|
|
225
|
+
const excludeFetchStates = draft.actionFetchState.excludeFetchById;
|
|
226
|
+
draft.actionFetchState.excludeFetchById = Object.assign(Object.assign({}, excludeFetchStates), { [excludeTransactionId]: {
|
|
227
|
+
fetchState: 'Completed',
|
|
228
|
+
error: undefined,
|
|
229
|
+
} });
|
|
230
|
+
}
|
|
231
|
+
},
|
|
232
|
+
updateReconcileTabLocalData: (draft, action) => {
|
|
233
|
+
const { selectedTransactionIds } = action.payload;
|
|
234
|
+
draft.reconTabsState.reconcile.localData.selectedTransactionIds =
|
|
235
|
+
selectedTransactionIds;
|
|
236
|
+
},
|
|
237
|
+
updateBalancesLocalData: (draft, action) => {
|
|
238
|
+
const { clearedBalance, variance, payments, deposits, variancePercentage } = action.payload;
|
|
239
|
+
draft.reconTabsState.balances = {
|
|
240
|
+
clearedBalance,
|
|
241
|
+
variance,
|
|
242
|
+
variancePercentage,
|
|
243
|
+
payments: payments,
|
|
244
|
+
deposits: deposits,
|
|
245
|
+
};
|
|
246
|
+
},
|
|
247
|
+
updateSelectedAccountId: (draft, action) => {
|
|
248
|
+
draft.selectedAccountId = action.payload.selectedAccountId;
|
|
249
|
+
},
|
|
250
|
+
updateSelectedDrawerAccountId: (draft, action) => {
|
|
251
|
+
draft.selectedDrawerAccountId = action.payload.selectedDrawerAccountId;
|
|
252
|
+
},
|
|
253
|
+
initialiseLocalDataForSelectedAccountId: () => { },
|
|
254
|
+
updateSelectedTab: (draft, action) => {
|
|
255
|
+
const { selectedTab } = action.payload;
|
|
256
|
+
draft.selectedTab = selectedTab;
|
|
257
|
+
},
|
|
258
|
+
updateReconcileTabListSortState: (draft, action) => {
|
|
259
|
+
draft.reconTabsState.reconcile.uiState = Object.assign(Object.assign({}, draft.reconTabsState.reconcile.uiState), { sortOrder: action.payload.sortOrder, sortKey: action.payload.sortKey });
|
|
260
|
+
},
|
|
261
|
+
updateReviewTabSortState: (draft, action) => {
|
|
262
|
+
draft.reconTabsState.review.uiState = Object.assign(Object.assign({}, draft.reconTabsState.review.uiState), { sortOrder: action.payload.sortOrder, sortKey: action.payload.sortKey });
|
|
263
|
+
},
|
|
264
|
+
updateReconcileTabListScrollState: (draft, action) => {
|
|
265
|
+
draft.reconTabsState.reconcile.uiState = Object.assign(Object.assign({}, draft.reconTabsState.reconcile.uiState), { scrollYOffset: action.payload.scrollYOffset });
|
|
266
|
+
},
|
|
267
|
+
updateReviewTabLocalData(draft, action) {
|
|
268
|
+
const { data, transactionId } = action.payload;
|
|
269
|
+
draft.reconTabsState.review.localData = Object.assign(Object.assign({}, draft.reconTabsState.review.localData), { [transactionId]: data });
|
|
270
|
+
},
|
|
271
|
+
saveReconciliationReview: {
|
|
272
|
+
reducer(draft, action) {
|
|
273
|
+
const { transactionId } = action.payload;
|
|
274
|
+
draft.actionFetchState.saveReconciliationReviewFetch[transactionId] = {
|
|
275
|
+
fetchState: 'In-Progress',
|
|
276
|
+
error: undefined,
|
|
277
|
+
};
|
|
278
|
+
},
|
|
279
|
+
prepare(transactionId) {
|
|
280
|
+
return {
|
|
281
|
+
payload: {
|
|
282
|
+
transactionId,
|
|
283
|
+
},
|
|
284
|
+
};
|
|
285
|
+
},
|
|
286
|
+
},
|
|
287
|
+
updateSaveReconciliationReviewFetchStatus: (draft, action) => {
|
|
288
|
+
const { transactionId, error, fetchState } = action.payload;
|
|
289
|
+
draft.actionFetchState.saveReconciliationReviewFetch[transactionId] = {
|
|
290
|
+
fetchState: fetchState,
|
|
291
|
+
error,
|
|
292
|
+
};
|
|
293
|
+
},
|
|
294
|
+
initializeReconciliationReviewTabLocalData: {
|
|
295
|
+
reducer(draft, action) {
|
|
296
|
+
draft.reconTabsState.review.localData = action.payload.localData;
|
|
297
|
+
},
|
|
298
|
+
prepare(localData) {
|
|
299
|
+
return {
|
|
300
|
+
payload: { localData },
|
|
301
|
+
};
|
|
302
|
+
},
|
|
303
|
+
},
|
|
304
|
+
setConnectionInProgressForAccount: (draft, action) => {
|
|
305
|
+
if (draft.accountConnectionStatusByAccountID[action.payload.accountId] ==
|
|
306
|
+
null) {
|
|
307
|
+
console.error(`Account ${action.payload.accountId} not found to set connection in progress`);
|
|
308
|
+
}
|
|
309
|
+
else {
|
|
310
|
+
draft.accountConnectionStatusByAccountID[action.payload.accountId] = Object.assign(Object.assign({}, draft.accountConnectionStatusByAccountID[action.payload.accountId]), { connectionInProgress: action.payload.connectionInProgress });
|
|
311
|
+
}
|
|
312
|
+
},
|
|
313
|
+
clearExpenseAutomationReconciliationView: (draft) => {
|
|
314
|
+
Object.assign(draft, exports.initialState);
|
|
315
|
+
},
|
|
316
|
+
},
|
|
317
|
+
});
|
|
318
|
+
// Export actions
|
|
319
|
+
_a = expenseAutomationReconciliationView.actions, exports.fetchReconciliation = _a.fetchReconciliation, exports.fetchReconciliationFailure = _a.fetchReconciliationFailure, exports.fetchReconciliationSuccess = _a.fetchReconciliationSuccess, exports.saveReconciliationDetail = _a.saveReconciliationDetail, exports.saveReconciliationDetailFailure = _a.saveReconciliationDetailFailure, exports.updateSelectedAccountId = _a.updateSelectedAccountId, exports.setConnectionInProgressForAccount = _a.setConnectionInProgressForAccount, exports.updateReconcileTabLocalData = _a.updateReconcileTabLocalData, exports.updateReconcileTabListSortState = _a.updateReconcileTabListSortState, exports.updateReconcileTabListScrollState = _a.updateReconcileTabListScrollState, exports.saveReconciliationDetailSuccess = _a.saveReconciliationDetailSuccess, exports.updateSelectedTab = _a.updateSelectedTab, exports.updateBalancesLocalData = _a.updateBalancesLocalData, exports.initialiseLocalDataForSelectedAccountId = _a.initialiseLocalDataForSelectedAccountId, exports.clearExpenseAutomationReconciliationView = _a.clearExpenseAutomationReconciliationView, exports.updateSelectedDrawerAccountId = _a.updateSelectedDrawerAccountId, exports.updateReviewTabSortState = _a.updateReviewTabSortState, exports.initializeReconciliationReviewTabLocalData = _a.initializeReconciliationReviewTabLocalData, exports.updateReviewTabLocalData = _a.updateReviewTabLocalData, exports.saveReconciliationReview = _a.saveReconciliationReview, exports.updateSaveReconciliationReviewFetchStatus = _a.updateSaveReconciliationReviewFetchStatus;
|
|
320
|
+
// Export reducer
|
|
321
|
+
exports.default = expenseAutomationReconciliationView.reducer;
|
|
322
|
+
function updateAllReconciliation(draft, accounts, selectedPeriod, reconciliationData, refreshViewInBackground) {
|
|
323
|
+
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)] = {
|
|
324
|
+
accountIDs: [],
|
|
325
|
+
reconciliationByAccountID: {},
|
|
326
|
+
};
|
|
327
|
+
const accountReconciliationRecords = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)];
|
|
328
|
+
reconciliationData.forEach((reconciliation) => {
|
|
329
|
+
var _a, _b, _c;
|
|
330
|
+
const account = accounts.find((account) => account.account_id === reconciliation.account_id);
|
|
331
|
+
const oldConnectionStatus = draft.accountConnectionStatusByAccountID[reconciliation.account_id];
|
|
332
|
+
if (oldConnectionStatus == null) {
|
|
333
|
+
draft.accountConnectionStatusByAccountID[reconciliation.account_id] = {
|
|
334
|
+
status: (0, accountReconState_1.toBankStatusCodeType)(reconciliation.bank_status.code),
|
|
335
|
+
connectionInProgress: false,
|
|
336
|
+
paymentAccountId: (_a = account === null || account === void 0 ? void 0 : account.payment_account_id) !== null && _a !== void 0 ? _a : undefined,
|
|
337
|
+
};
|
|
338
|
+
}
|
|
339
|
+
else {
|
|
340
|
+
draft.accountConnectionStatusByAccountID[reconciliation.account_id] = {
|
|
341
|
+
status: (0, accountReconState_1.toBankStatusCodeType)(reconciliation.bank_status.code),
|
|
342
|
+
connectionInProgress: reconciliation.bank_status.code === 'not_connected' &&
|
|
343
|
+
oldConnectionStatus.connectionInProgress === true,
|
|
344
|
+
paymentAccountId: (_b = account === null || account === void 0 ? void 0 : account.payment_account_id) !== null && _b !== void 0 ? _b : undefined,
|
|
345
|
+
};
|
|
346
|
+
}
|
|
347
|
+
accountReconciliationRecords.reconciliationByAccountID[reconciliation.account_id] = {
|
|
348
|
+
accountId: reconciliation.account_id,
|
|
349
|
+
reconciliationId: (_c = reconciliation.reconciliation_id) !== null && _c !== void 0 ? _c : undefined,
|
|
350
|
+
transactionFetchState: { fetchState: 'Not-Started', error: undefined },
|
|
351
|
+
refreshStatus: { fetchState: 'Not-Started', error: undefined },
|
|
352
|
+
};
|
|
353
|
+
accountReconciliationRecords.accountIDs.push(reconciliation.account_id);
|
|
354
|
+
});
|
|
355
|
+
if (refreshViewInBackground === true) {
|
|
356
|
+
draft.refreshStatus = {
|
|
357
|
+
fetchState: 'Completed',
|
|
358
|
+
error: undefined,
|
|
359
|
+
};
|
|
360
|
+
}
|
|
361
|
+
else {
|
|
362
|
+
draft.fetchState = 'Completed';
|
|
363
|
+
draft.error = undefined;
|
|
364
|
+
}
|
|
365
|
+
}
|
|
366
|
+
function updateReconciliationByAccountID(draft, accounts, selectedPeriod, accountId, reconciliationData, refreshViewInBackground) {
|
|
367
|
+
var _a, _b, _c;
|
|
368
|
+
const oldRecord = draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId];
|
|
369
|
+
const oldConnectionStatus = draft.accountConnectionStatusByAccountID[accountId];
|
|
370
|
+
draft.accountConnectionStatusByAccountID[accountId] = {
|
|
371
|
+
status: (0, accountReconState_1.toBankStatusCodeType)(reconciliationData.bank_status.code),
|
|
372
|
+
connectionInProgress: oldConnectionStatus != null
|
|
373
|
+
? reconciliationData.bank_status.code === 'not_connected' &&
|
|
374
|
+
oldConnectionStatus.connectionInProgress === true
|
|
375
|
+
: false,
|
|
376
|
+
paymentAccountId: (_a = accounts.payment_account_id) !== null && _a !== void 0 ? _a : undefined,
|
|
377
|
+
};
|
|
378
|
+
if (refreshViewInBackground === true) {
|
|
379
|
+
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId] = Object.assign(Object.assign({}, oldRecord), { reconciliationId: (_b = reconciliationData.reconciliation_id) !== null && _b !== void 0 ? _b : undefined, refreshStatus: { fetchState: 'Completed', error: undefined } });
|
|
380
|
+
}
|
|
381
|
+
else {
|
|
382
|
+
draft.accountReconciliationRecordsBySelectedPeriod[(0, timePeriod_1.toMonthYearPeriodId)(selectedPeriod)].reconciliationByAccountID[accountId] = Object.assign(Object.assign({}, oldRecord), { reconciliationId: (_c = reconciliationData.reconciliation_id) !== null && _c !== void 0 ? _c : undefined, transactionFetchState: { fetchState: 'Completed', error: undefined } });
|
|
383
|
+
}
|
|
384
|
+
}
|
|
@@ -4,6 +4,7 @@ import { MonthYearPeriod, TimePeriod } from '../../../commonStateTypes/timePerio
|
|
|
4
4
|
import { PageToken } from '../../../commonStateTypes/viewAndReport/viewAndReport';
|
|
5
5
|
import { AccountBase } from '../../../entity/account/accountState';
|
|
6
6
|
import { ClassBase } from '../../../entity/class/classState';
|
|
7
|
+
import { CustomerBase } from '../../../entity/customer/customerState';
|
|
7
8
|
import { Entity } from '../../../entity/genericEntity/entity';
|
|
8
9
|
import { RecommendationByLineId, TransactionID } from '../../../entity/transaction/stateTypes/transaction';
|
|
9
10
|
import { SupportedTransaction } from '../../../entity/transaction/transactionState';
|
|
@@ -76,12 +77,22 @@ export declare const fetchTransactionCategorization: import("@reduxjs/toolkit").
|
|
|
76
77
|
selectedTransaction: SupportedTransaction;
|
|
77
78
|
uncategorizedAccounts: UncategorizedAccounts;
|
|
78
79
|
updatedVendor?: VendorBase;
|
|
79
|
-
|
|
80
|
+
selectedEntity?: Entity;
|
|
81
|
+
}, "expenseAutomationTransactionsView/updateSelectedVendorForTransaction">, updateSelectedCustomerForTransaction: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
82
|
+
selectedTab: TransactionsTab;
|
|
83
|
+
transactionId: ID;
|
|
84
|
+
lineId: ID;
|
|
85
|
+
selectedTransaction: SupportedTransaction;
|
|
86
|
+
uncategorizedAccounts: UncategorizedAccounts;
|
|
87
|
+
updatedCustomer?: CustomerBase;
|
|
88
|
+
selectedEntity?: Entity;
|
|
89
|
+
}, "expenseAutomationTransactionsView/updateSelectedCustomerForTransaction">, setAllItemsToCategoryClassInLocalDataForCategorization: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[selectedTab: "review" | "autoCategorized", transactionId: string, lineId: string, transactions: SupportedTransaction[], uncategorizedAccounts: UncategorizedAccounts, vendorId?: string | undefined, customerId?: string | undefined, selectedAccount?: AccountBase | undefined, selectedClassBase?: ClassBase | undefined, lineEntity?: Entity | undefined, recommendations?: Recommendation[] | undefined], {
|
|
80
90
|
selectedTab: "review" | "autoCategorized";
|
|
81
91
|
transactionId: string;
|
|
82
92
|
lineId: string;
|
|
83
93
|
transactions: SupportedTransaction[];
|
|
84
94
|
vendorId: string | undefined;
|
|
95
|
+
customerId: string | undefined;
|
|
85
96
|
lineEntity: Entity | undefined;
|
|
86
97
|
selectedAccount: AccountBase | undefined;
|
|
87
98
|
selectedClassBase: ClassBase | undefined;
|