@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
|
@@ -40,13 +40,17 @@ const updateTransactionCategorizationEpic = (actions$, state$, zeniAPI) => actio
|
|
|
40
40
|
}));
|
|
41
41
|
exports.updateTransactionCategorizationEpic = updateTransactionCategorizationEpic;
|
|
42
42
|
function prepareTransactionPayload(selectedTab, transactionState, vendorState, transactionsViewState, transactionId, saveUpdates) {
|
|
43
|
-
var _a;
|
|
43
|
+
var _a, _b, _c;
|
|
44
44
|
const detail = (0, transactionSelector_1.getSupportedTransactionById)(transactionState, transactionId);
|
|
45
45
|
const tranDetail = (0, get_1.default)(transactionsViewState.transactionCategorizationView[selectedTab]
|
|
46
46
|
.transactionReviewLocalDataById, transactionId, undefined);
|
|
47
47
|
const tranVendorUpdates = (_a = tranDetail === null || tranDetail === void 0 ? void 0 : tranDetail.transactionReviewLocalData) === null || _a === void 0 ? void 0 : _a.vendorUpdates;
|
|
48
|
+
const tranCustomerUpdates = (_b = tranDetail === null || tranDetail === void 0 ? void 0 : tranDetail.transactionReviewLocalData) === null || _b === void 0 ? void 0 : _b.customerUpdates;
|
|
49
|
+
const tranSelectedEntity = (_c = tranDetail === null || tranDetail === void 0 ? void 0 : tranDetail.transactionReviewLocalData) === null || _c === void 0 ? void 0 : _c.selectedEntity;
|
|
48
50
|
let vendorUpdates = undefined;
|
|
49
|
-
if ((tranVendorUpdates === null || tranVendorUpdates === void 0 ? void 0 : tranVendorUpdates.qboId) != null
|
|
51
|
+
if ((tranVendorUpdates === null || tranVendorUpdates === void 0 ? void 0 : tranVendorUpdates.qboId) != null &&
|
|
52
|
+
tranSelectedEntity != null &&
|
|
53
|
+
tranSelectedEntity.type === 'vendor') {
|
|
50
54
|
const vendor = (0, vendorSelector_1.getVendorByVendorId)(vendorState, tranVendorUpdates.qboId);
|
|
51
55
|
if (vendor != null) {
|
|
52
56
|
vendorUpdates = {
|
|
@@ -61,8 +65,23 @@ function prepareTransactionPayload(selectedTab, transactionState, vendorState, t
|
|
|
61
65
|
};
|
|
62
66
|
}
|
|
63
67
|
}
|
|
68
|
+
let customerUpdates = undefined;
|
|
69
|
+
if (tranSelectedEntity != null && tranSelectedEntity.type === 'customer') {
|
|
70
|
+
if ((tranCustomerUpdates === null || tranCustomerUpdates === void 0 ? void 0 : tranCustomerUpdates.qboId) != null) {
|
|
71
|
+
customerUpdates = {
|
|
72
|
+
id: tranCustomerUpdates.qboId,
|
|
73
|
+
name: tranCustomerUpdates.name,
|
|
74
|
+
};
|
|
75
|
+
}
|
|
76
|
+
else {
|
|
77
|
+
customerUpdates = {
|
|
78
|
+
id: tranSelectedEntity.id,
|
|
79
|
+
name: tranSelectedEntity.name,
|
|
80
|
+
};
|
|
81
|
+
}
|
|
82
|
+
}
|
|
64
83
|
if (detail != null) {
|
|
65
|
-
const transUpdates = toTransactionUpdatePayload(saveUpdates.updates, detail, vendorUpdates);
|
|
84
|
+
const transUpdates = toTransactionUpdatePayload(saveUpdates.updates, detail, vendorUpdates, customerUpdates);
|
|
66
85
|
const entityUpdates = toEntityUpdatePayload(saveUpdates.entityRelatedUpdates);
|
|
67
86
|
return {
|
|
68
87
|
entity_related_updates: entityUpdates,
|
|
@@ -91,12 +110,14 @@ function preparePayload(selectedTab, transactionState, vendorState, transactions
|
|
|
91
110
|
return payload;
|
|
92
111
|
}
|
|
93
112
|
}
|
|
94
|
-
const toTransactionUpdatePayload = (updates, detail, vendorUpdates) => {
|
|
113
|
+
const toTransactionUpdatePayload = (updates, detail, vendorUpdates, customerUpdates) => {
|
|
95
114
|
var _a, _b;
|
|
96
115
|
const transaction = Object.assign({}, detail);
|
|
97
116
|
transaction.memo = (_a = updates.memo) !== null && _a !== void 0 ? _a : '';
|
|
98
117
|
transaction.vendorId = vendorUpdates === null || vendorUpdates === void 0 ? void 0 : vendorUpdates.id;
|
|
99
118
|
transaction.vendorName = vendorUpdates === null || vendorUpdates === void 0 ? void 0 : vendorUpdates.name;
|
|
119
|
+
transaction.customerId = customerUpdates === null || customerUpdates === void 0 ? void 0 : customerUpdates.id;
|
|
120
|
+
transaction.customerName = customerUpdates === null || customerUpdates === void 0 ? void 0 : customerUpdates.name;
|
|
100
121
|
const recommendationUpdates = {};
|
|
101
122
|
for (const key in updates.updatesByLineId) {
|
|
102
123
|
const lineUpdates = updates.updatesByLineId[key];
|
|
@@ -133,11 +154,17 @@ const toTransactionUpdatePayload = (updates, detail, vendorUpdates) => {
|
|
|
133
154
|
transaction.lines = newLineMap;
|
|
134
155
|
}
|
|
135
156
|
transaction.recommendations = recommendationUpdates;
|
|
157
|
+
// Added this check because now customer are also part of Expense,Journal Entry and Check type of transactions
|
|
136
158
|
if ((0, customerTransaction_1.isCustomerTransaction)(transaction)) {
|
|
137
159
|
return (0, customerTransactionPayload_1.toCustomerTransactionPayload)(transaction);
|
|
138
160
|
}
|
|
139
161
|
else if ((0, vendorTransaction_1.isVendorTransaction)(transaction)) {
|
|
140
|
-
|
|
162
|
+
if ((0, vendorTransaction_1.isVendorTransactionWithCustomer)(transaction)) {
|
|
163
|
+
return (0, vendorTransactionPayload_1.toVendorTransactionWithCustomerPayload)(transaction, vendorUpdates, customerUpdates);
|
|
164
|
+
}
|
|
165
|
+
else {
|
|
166
|
+
return (0, vendorTransactionPayload_1.toVendorTransactionPayload)(transaction, vendorUpdates);
|
|
167
|
+
}
|
|
141
168
|
}
|
|
142
169
|
else if ((0, otherTransaction_1.isTransferTransaction)(transaction)) {
|
|
143
170
|
return (0, otherTransactionPayload_1.toTransferTransactionPayload)(transaction);
|
|
@@ -8,8 +8,8 @@ export declare const fetchAllExpenseAutomationTabs: import("@reduxjs/toolkit").A
|
|
|
8
8
|
}, "expenseAutomationView/fetchAllExpenseAutomationTabs", never, never>, updateCurrentSelectedPeriod: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[tenantId: string, newSelectedPeriod: MonthYearPeriod], {
|
|
9
9
|
newSelectedPeriod: MonthYearPeriod;
|
|
10
10
|
tenantId: string;
|
|
11
|
-
}, "expenseAutomationView/updateCurrentSelectedPeriod", never, never>, updateCurrentSelectedView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[newSelectedView: "transaction_categorization" | "je_schedules" | "
|
|
12
|
-
newSelectedView: "transaction_categorization" | "je_schedules" | "
|
|
11
|
+
}, "expenseAutomationView/updateCurrentSelectedPeriod", never, never>, updateCurrentSelectedView: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[newSelectedView: "transaction_categorization" | "je_schedules" | "reconciliation" | "missing_receipts" | "flux_analysis" | "month_end_insights"], {
|
|
12
|
+
newSelectedView: "transaction_categorization" | "je_schedules" | "reconciliation" | "missing_receipts" | "flux_analysis" | "month_end_insights";
|
|
13
13
|
}, "expenseAutomationView/updateCurrentSelectedView", never, never>, clearExpenseAutomationView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationView/clearExpenseAutomationView">, initializeSelectedPeriodForTenants: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
14
14
|
selectedPeriodByTenantId: Record<ID, MonthYearPeriod>;
|
|
15
15
|
}, "expenseAutomationView/initializeSelectedPeriodForTenants">, refreshExpenseAutomationCurrentTab: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<"expenseAutomationView/refreshExpenseAutomationCurrentTab">;
|
|
@@ -22,11 +22,7 @@ const expenseAutomationView = (0, toolkit_1.createSlice)({
|
|
|
22
22
|
reducer() {
|
|
23
23
|
//do nothing
|
|
24
24
|
},
|
|
25
|
-
prepare(
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
27
|
-
cacheOverride = false,
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/no-inferrable-types
|
|
29
|
-
refreshViewInBackground = false) {
|
|
25
|
+
prepare(cacheOverride = false, refreshViewInBackground = false) {
|
|
30
26
|
return {
|
|
31
27
|
payload: { cacheOverride, refreshViewInBackground },
|
|
32
28
|
};
|
|
@@ -11,6 +11,7 @@ const expenseAutomationViewSelectorTypes_1 = require("./selectorTypes/expenseAut
|
|
|
11
11
|
const fluxAnalysisViewSelector_1 = require("./selectors/fluxAnalysisViewSelector");
|
|
12
12
|
const jeSchedulesViewSelector_1 = require("./selectors/jeSchedulesViewSelector");
|
|
13
13
|
const missingReceiptsSelector_1 = require("./selectors/missingReceiptsSelector");
|
|
14
|
+
const reconciliationViewSelector_1 = require("./selectors/reconciliationViewSelector");
|
|
14
15
|
const transactionCategorizationSelector_1 = require("./selectors/transactionCategorizationSelector");
|
|
15
16
|
const isPreviousStepDisabled = (selectedTransactionCategorizationTab, allSteps, stepIndex, currentTenant, selectedPeriod, userAllowedToAccessMonthEndInsights, reportEmailSentDate, auditSummary) => {
|
|
16
17
|
if (stepIndex === 0) {
|
|
@@ -24,7 +25,7 @@ const isPreviousStepDisabled = (selectedTransactionCategorizationTab, allSteps,
|
|
|
24
25
|
};
|
|
25
26
|
function getExpenseAutomationView(state) {
|
|
26
27
|
var _a, _b, _c;
|
|
27
|
-
const { expenseAutomationViewState, tenantState, expenseAutomationMissingReceiptsViewState, expenseAutomationJESchedulesViewState, expenseAutomationTransactionsViewState, monthEndCloseChecksState, companyState, } = state;
|
|
28
|
+
const { expenseAutomationViewState, tenantState, expenseAutomationMissingReceiptsViewState, expenseAutomationJESchedulesViewState, expenseAutomationTransactionsViewState, expenseAutomationReconciliationViewState, monthEndCloseChecksState, companyState, } = state;
|
|
28
29
|
const { loggedInUser, currentTenantId } = tenantState;
|
|
29
30
|
const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
|
|
30
31
|
const { currentSelectedView, selectedPeriodByTenantId } = expenseAutomationViewState;
|
|
@@ -42,9 +43,15 @@ function getExpenseAutomationView(state) {
|
|
|
42
43
|
const missingReceipts = (0, missingReceiptsSelector_1.getExpenseAutomationMissingReceiptsView)(state);
|
|
43
44
|
const fluxAnalysis = (0, fluxAnalysisViewSelector_1.getExpenseAutomationFluxAnalysisView)(state);
|
|
44
45
|
const monthEndInsights = (0, companyMonthEndReportViewSelector_1.getCompanyMonthEndReportSelectorView)(state, currentTenant.companyId, loggedInUser);
|
|
46
|
+
const reconciliation = (0, reconciliationViewSelector_1.getExpenseAutomationReconciliationView)(state);
|
|
45
47
|
const expenseAutomationTransactionsView = (0, transactionCategorizationSelector_1.getExpenseAutomationTransactionView)(state);
|
|
46
48
|
const jeSchedules = (0, jeSchedulesViewSelector_1.getExpenseAutomationJESchedulesView)(state);
|
|
47
49
|
switch (currentSelectedView) {
|
|
50
|
+
case 'reconciliation':
|
|
51
|
+
currentSelectedViewFetchState = reconciliation.fetchStatus;
|
|
52
|
+
currentSelectedViewBackgroundRefreshFetchState =
|
|
53
|
+
reconciliation.refreshStatus;
|
|
54
|
+
break;
|
|
48
55
|
case 'flux_analysis':
|
|
49
56
|
currentSelectedViewFetchState = fluxAnalysis.fetchStatus;
|
|
50
57
|
currentSelectedViewBackgroundRefreshFetchState =
|
|
@@ -90,6 +97,7 @@ function getExpenseAutomationView(state) {
|
|
|
90
97
|
expenseAutomationJESchedulesViewState,
|
|
91
98
|
monthEndCloseChecksView,
|
|
92
99
|
expenseAutomationTransactionsView,
|
|
100
|
+
expenseAutomationReconciliationViewState,
|
|
93
101
|
];
|
|
94
102
|
let allSteps = [];
|
|
95
103
|
let auditSummary = undefined;
|
|
@@ -122,6 +130,9 @@ function getExpenseAutomationView(state) {
|
|
|
122
130
|
? (0, monthEndCloseChecksViewSelector_1.isMonthEndInsightDisabled)(currentTenant, selectedPeriod, userAllowedToAccessMonthEndInsights, auditSummary)
|
|
123
131
|
: true });
|
|
124
132
|
return;
|
|
133
|
+
case 'reconciliation':
|
|
134
|
+
allStepsOriginal[index] = Object.assign(Object.assign({}, stepDetail), { completionStatus: reconciliation.completionStatus });
|
|
135
|
+
return;
|
|
125
136
|
case 'flux_analysis':
|
|
126
137
|
default:
|
|
127
138
|
allStepsOriginal[index] = Object.assign(Object.assign({}, stepDetail), { completionStatus: fluxAnalysis.completionStatus });
|
|
@@ -131,7 +142,10 @@ function getExpenseAutomationView(state) {
|
|
|
131
142
|
allSteps.forEach((stepDetail, index, allStepsOriginal) => {
|
|
132
143
|
allStepsOriginal[index] = Object.assign(Object.assign({}, stepDetail), { isNextDisabled: index === allStepsOriginal.length - 1
|
|
133
144
|
? allStepsOriginal[0].isDisabled
|
|
134
|
-
:
|
|
145
|
+
: stepDetail.step === 'reconciliation' &&
|
|
146
|
+
reconciliation.selectedTab === 'review'
|
|
147
|
+
? false
|
|
148
|
+
: allStepsOriginal[index + 1].isDisabled, isPrevDisabled: isPreviousStepDisabled(selectedTransactionCategorizationTab, allStepsOriginal, index, currentTenant, selectedPeriod, userAllowedToAccessMonthEndInsights, reportEmailSentDate, auditSummary) });
|
|
135
149
|
});
|
|
136
150
|
}
|
|
137
151
|
const reducedFetchStatus = (0, reduceFetchState_1.reduceAnyFetchState)(fetchStateVariables); // Add more states
|
|
@@ -146,6 +160,7 @@ function getExpenseAutomationView(state) {
|
|
|
146
160
|
jeSchedules,
|
|
147
161
|
transactionView: expenseAutomationTransactionsView,
|
|
148
162
|
missingReceipts,
|
|
163
|
+
reconciliation,
|
|
149
164
|
currentSelectedViewFetchState,
|
|
150
165
|
currentSelectedViewBackgroundRefreshFetchState,
|
|
151
166
|
fluxAnalysis,
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { FetchStateAndError, FetchedState, ID } from '../../commonStateTypes/common';
|
|
2
2
|
import { MonthYearPeriod } from '../../commonStateTypes/timePeriod';
|
|
3
|
-
export declare const EXPENSE_AUTOMATION_VIEW_TYPES: readonly ["transaction_categorization", "je_schedules", "
|
|
4
|
-
export declare const toExpenseAutomationViewType: (v: string) => "transaction_categorization" | "je_schedules" | "
|
|
3
|
+
export declare const EXPENSE_AUTOMATION_VIEW_TYPES: readonly ["transaction_categorization", "je_schedules", "reconciliation", "missing_receipts", "flux_analysis", "month_end_insights"];
|
|
4
|
+
export declare const toExpenseAutomationViewType: (v: string) => "transaction_categorization" | "je_schedules" | "reconciliation" | "missing_receipts" | "flux_analysis" | "month_end_insights";
|
|
5
5
|
export type ExpenseAutomationViewType = ReturnType<typeof toExpenseAutomationViewType>;
|
|
6
6
|
export interface ExpenseAutomationViewState extends FetchedState {
|
|
7
7
|
saveStatus: FetchStateAndError;
|
|
@@ -5,7 +5,7 @@ const stringToUnion_1 = require("../../commonStateTypes/stringToUnion");
|
|
|
5
5
|
exports.EXPENSE_AUTOMATION_VIEW_TYPES = [
|
|
6
6
|
'transaction_categorization',
|
|
7
7
|
'je_schedules',
|
|
8
|
-
'
|
|
8
|
+
'reconciliation',
|
|
9
9
|
'missing_receipts',
|
|
10
10
|
'flux_analysis',
|
|
11
11
|
'month_end_insights',
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { CurrencyPayload } from '../../../commonPayloadTypes/v2/viewAndReportPayloadv2';
|
|
2
|
+
import { ReconciliationDataPayload } from '../../../entity/accountRecon/accountReconPayload';
|
|
3
|
+
import { MatchedTransactionPayload } from '../../../entity/transaction/payloadTypes/reconciliationTransactionPayloads';
|
|
4
|
+
export declare const getAllReviewTransactionsFromReconcilePayload: (reconcilePayload: ReconciliationDataPayload[]) => {
|
|
5
|
+
allReconciledTransactions: MatchedTransactionPayload[];
|
|
6
|
+
currencyPayload: CurrencyPayload;
|
|
7
|
+
}[];
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getAllReviewTransactionsFromReconcilePayload = void 0;
|
|
4
|
+
const getAllReviewTransactionsFromReconcilePayload = (reconcilePayload) => {
|
|
5
|
+
const transactionsPerRecon = reconcilePayload.map((reconcile) => {
|
|
6
|
+
const allReconciledTransactions = [];
|
|
7
|
+
const currencyPayload = reconcile.currency;
|
|
8
|
+
reconcile.transactions.reconcile.forEach((reconciledTransaction) => {
|
|
9
|
+
allReconciledTransactions.push(reconciledTransaction);
|
|
10
|
+
});
|
|
11
|
+
return {
|
|
12
|
+
allReconciledTransactions,
|
|
13
|
+
currencyPayload,
|
|
14
|
+
};
|
|
15
|
+
});
|
|
16
|
+
return transactionsPerRecon;
|
|
17
|
+
};
|
|
18
|
+
exports.getAllReviewTransactionsFromReconcilePayload = getAllReviewTransactionsFromReconcilePayload;
|
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.toTransactionUpdatesFromTransactionCategorizationLocalData = void 0;
|
|
4
4
|
const entity_1 = require("../../../entity/genericEntity/entity");
|
|
5
|
+
const customerTransaction_1 = require("../../../entity/transaction/stateTypes/customerTransaction");
|
|
5
6
|
const vendorTransaction_1 = require("../../../entity/transaction/stateTypes/vendorTransaction");
|
|
6
7
|
const recommendationState_1 = require("../../recommendation/recommendationState");
|
|
7
8
|
const saveTransactionHelper_1 = require("../../transactionDetail/epics/saveTransactionHelper");
|
|
@@ -10,7 +11,7 @@ const saveTransactionHelper_1 = require("../../transactionDetail/epics/saveTrans
|
|
|
10
11
|
* @param transactionCategorizationLocalData
|
|
11
12
|
*/
|
|
12
13
|
const toTransactionUpdatesFromTransactionCategorizationLocalData = (transactionCategorizationLocalData, transaction, uncategorizedIncomeExpense) => {
|
|
13
|
-
var _a
|
|
14
|
+
var _a;
|
|
14
15
|
const updates = {
|
|
15
16
|
updatesByLineId: {},
|
|
16
17
|
};
|
|
@@ -19,25 +20,27 @@ const toTransactionUpdatesFromTransactionCategorizationLocalData = (transactionC
|
|
|
19
20
|
const isTransactionMisCategorized = (0, saveTransactionHelper_1.isTransactionMiscategorized)(transaction, true);
|
|
20
21
|
const isTransactionUnCategorized = (0, saveTransactionHelper_1.isTransactionUncategorized)(transaction, uncategorizedIncomeExpense);
|
|
21
22
|
updates.memo = transactionCategorizationLocalData.memo;
|
|
22
|
-
|
|
23
|
-
|
|
23
|
+
const currentSelectedEntity = transactionCategorizationLocalData.selectedEntity;
|
|
24
|
+
if ((0, vendorTransaction_1.isVendorTransaction)(transaction) === true &&
|
|
25
|
+
currentSelectedEntity != null &&
|
|
26
|
+
currentSelectedEntity.type === 'vendor') {
|
|
27
|
+
updates.vendorId = currentSelectedEntity.id;
|
|
24
28
|
}
|
|
25
|
-
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
zeniId: transaction.vendorId,
|
|
32
|
-
}
|
|
33
|
-
: undefined;
|
|
29
|
+
if ((0, vendorTransaction_1.isVendorTransactionWithCustomer)(transaction) === true &&
|
|
30
|
+
currentSelectedEntity != null &&
|
|
31
|
+
currentSelectedEntity.type === 'customer') {
|
|
32
|
+
updates.customerId = currentSelectedEntity.id;
|
|
33
|
+
}
|
|
34
|
+
const entity = getEntityFromTransaction(transaction, currentSelectedEntity);
|
|
34
35
|
let lastUpdatedCategory;
|
|
35
36
|
let lastUpdatedClass;
|
|
36
37
|
// single recommendation to just pick the last recommendation in the list of lines
|
|
37
|
-
(
|
|
38
|
-
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
39
|
-
const updatedEntityId = (_a = transactionCategorizationLocalData.vendorUpdates) === null || _a === void 0 ? void 0 : _a.qboId;
|
|
40
|
-
const
|
|
38
|
+
(_a = transaction.lines) === null || _a === void 0 ? void 0 : _a.forEach((line) => {
|
|
39
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t, _u, _v, _w;
|
|
40
|
+
const updatedEntityId = (_b = (_a = transactionCategorizationLocalData.vendorUpdates) === null || _a === void 0 ? void 0 : _a.qboId) !== null && _b !== void 0 ? _b : (_c = transactionCategorizationLocalData.customerUpdates) === null || _c === void 0 ? void 0 : _c.qboId;
|
|
41
|
+
const currentSelectedEntityLine = transactionCategorizationLocalData.lineItemById[line.id]
|
|
42
|
+
.selectedEntityLine;
|
|
43
|
+
const entityDetails = getEntityDetails(entity, transactionCategorizationLocalData.lineItemById[line.id], transactionCategorizationLocalData.vendorUpdates, transactionCategorizationLocalData.customerUpdates, currentSelectedEntityLine);
|
|
41
44
|
if (line.type === 'transaction_with_account_and_class_line' ||
|
|
42
45
|
line.type === 'transaction_with_product_or_service_line' ||
|
|
43
46
|
line.type === 'journal_entry_transaction_line') {
|
|
@@ -50,24 +53,34 @@ const toTransactionUpdatesFromTransactionCategorizationLocalData = (transactionC
|
|
|
50
53
|
};
|
|
51
54
|
if (line.type === 'journal_entry_transaction_line' ||
|
|
52
55
|
line.platformLineDetailType === 'deposit_line_detail') {
|
|
53
|
-
updatesByLineId[line.id] = Object.assign(Object.assign({}, updatesByLineId[line.id]), { vendor:
|
|
56
|
+
updatesByLineId[line.id] = Object.assign(Object.assign({}, updatesByLineId[line.id]), { vendor: currentSelectedEntityLine != null &&
|
|
57
|
+
currentSelectedEntityLine.type === 'vendor'
|
|
58
|
+
? lineItem.vendor
|
|
59
|
+
: undefined, customer: currentSelectedEntityLine != null &&
|
|
60
|
+
currentSelectedEntityLine.type === 'customer'
|
|
61
|
+
? lineItem.customer
|
|
62
|
+
: undefined });
|
|
54
63
|
}
|
|
55
64
|
let hasCategoryChanged = false;
|
|
56
65
|
let hasClassChanged = false;
|
|
57
66
|
const accountLine = line;
|
|
58
67
|
hasCategoryChanged =
|
|
59
|
-
((
|
|
60
|
-
Boolean((
|
|
68
|
+
((_d = lineItem.account) === null || _d === void 0 ? void 0 : _d.qboId) !== accountLine.account.qboId &&
|
|
69
|
+
Boolean((_e = lineItem.account) === null || _e === void 0 ? void 0 : _e.qboId);
|
|
61
70
|
hasClassChanged =
|
|
62
|
-
Boolean((
|
|
63
|
-
((
|
|
71
|
+
Boolean((_f = lineItem.class) === null || _f === void 0 ? void 0 : _f.qboId) &&
|
|
72
|
+
((_g = lineItem.class) === null || _g === void 0 ? void 0 : _g.qboId) !== accountLine.class.qboId;
|
|
64
73
|
const recommendedAccountBase = (0, saveTransactionHelper_1.toRecommendedAccountBase)(lineItem.amount.amount, lineItem.account);
|
|
65
74
|
const recommendedClassBase = (0, saveTransactionHelper_1.toRecommendedClassBase)(lineItem.amount.amount, lineItem.class);
|
|
66
|
-
const updatedLineEntityId = ((
|
|
67
|
-
? ((
|
|
68
|
-
? (
|
|
69
|
-
: (
|
|
70
|
-
:
|
|
75
|
+
const updatedLineEntityId = ((_h = accountLine.vendor) === null || _h === void 0 ? void 0 : _h.id) != null
|
|
76
|
+
? ((_j = accountLine.vendor) === null || _j === void 0 ? void 0 : _j.id) != ((_k = lineItem.vendor) === null || _k === void 0 ? void 0 : _k.id)
|
|
77
|
+
? (_l = lineItem.vendor) === null || _l === void 0 ? void 0 : _l.id
|
|
78
|
+
: (_m = accountLine.vendor) === null || _m === void 0 ? void 0 : _m.id
|
|
79
|
+
: ((_o = accountLine.customer) === null || _o === void 0 ? void 0 : _o.id) != null
|
|
80
|
+
? ((_p = accountLine.customer) === null || _p === void 0 ? void 0 : _p.id) != ((_q = lineItem.customer) === null || _q === void 0 ? void 0 : _q.id)
|
|
81
|
+
? (_r = lineItem.customer) === null || _r === void 0 ? void 0 : _r.id
|
|
82
|
+
: (_s = accountLine.customer) === null || _s === void 0 ? void 0 : _s.id
|
|
83
|
+
: undefined;
|
|
71
84
|
if (entityDetails != null &&
|
|
72
85
|
(hasCategoryChanged === true || hasClassChanged === true)) {
|
|
73
86
|
lastUpdatedCategory =
|
|
@@ -83,16 +96,16 @@ const toTransactionUpdatesFromTransactionCategorizationLocalData = (transactionC
|
|
|
83
96
|
if (recommended.class != null ||
|
|
84
97
|
recommended.account != null ||
|
|
85
98
|
updatedEntityId != null) {
|
|
86
|
-
const vendorIdToUpdate = (
|
|
87
|
-
let entityId = entityDetails.entityId;
|
|
99
|
+
const vendorIdToUpdate = (_t = transactionCategorizationLocalData.vendorUpdates) === null || _t === void 0 ? void 0 : _t.qboId;
|
|
88
100
|
if (line.type === 'journal_entry_transaction_line' ||
|
|
89
101
|
line.platformLineDetailType === 'deposit_line_detail') {
|
|
90
|
-
const entityId = (
|
|
102
|
+
const entityId = (_v = (_u = accountLine.vendor) === null || _u === void 0 ? void 0 : _u.id) !== null && _v !== void 0 ? _v : (_w = accountLine.customer) === null || _w === void 0 ? void 0 : _w.id;
|
|
91
103
|
if (entityId != null) {
|
|
92
104
|
doUpdateEntityUpdates(entityUpdates, entityId, entityDetails.entityType, recommended, false, updatedLineEntityId);
|
|
93
105
|
}
|
|
94
106
|
}
|
|
95
107
|
else {
|
|
108
|
+
let entityId = entityDetails.entityId;
|
|
96
109
|
if (vendorIdToUpdate != null) {
|
|
97
110
|
entityId = vendorIdToUpdate;
|
|
98
111
|
}
|
|
@@ -135,8 +148,8 @@ const doUpdateEntityUpdates = (entityUpdates, entityId, entityType, recommendati
|
|
|
135
148
|
entityUpdates[entityKey] = Object.assign(Object.assign({}, entityUpdate), { recommendations: recommendation });
|
|
136
149
|
}
|
|
137
150
|
};
|
|
138
|
-
const getEntityDetails = (entity, lineItemLocalData, vendorUpdates) => {
|
|
139
|
-
var _a, _b, _c;
|
|
151
|
+
const getEntityDetails = (entity, lineItemLocalData, vendorUpdates, customerUpdates, currentSelectedEntityLine) => {
|
|
152
|
+
var _a, _b, _c, _d;
|
|
140
153
|
if (entity != null) {
|
|
141
154
|
return {
|
|
142
155
|
entityId: (_a = entity.qboId) !== null && _a !== void 0 ? _a : entity.id,
|
|
@@ -149,13 +162,35 @@ const getEntityDetails = (entity, lineItemLocalData, vendorUpdates) => {
|
|
|
149
162
|
entityType: lineItemLocalData.vendor != null ? 'vendor' : 'customer',
|
|
150
163
|
};
|
|
151
164
|
}
|
|
152
|
-
if (
|
|
165
|
+
if (currentSelectedEntityLine != null &&
|
|
166
|
+
currentSelectedEntityLine.type === 'vendor') {
|
|
167
|
+
if (vendorUpdates != null && vendorUpdates.id != null) {
|
|
168
|
+
return {
|
|
169
|
+
entityId: vendorUpdates.id,
|
|
170
|
+
entityType: 'vendor',
|
|
171
|
+
};
|
|
172
|
+
}
|
|
173
|
+
}
|
|
174
|
+
if (currentSelectedEntityLine != null &&
|
|
175
|
+
currentSelectedEntityLine.type === 'customer') {
|
|
176
|
+
if (customerUpdates != null && customerUpdates.id != null) {
|
|
177
|
+
return {
|
|
178
|
+
entityId: customerUpdates.id,
|
|
179
|
+
entityType: 'customer',
|
|
180
|
+
};
|
|
181
|
+
}
|
|
182
|
+
}
|
|
183
|
+
if (((_c = lineItemLocalData.customer) === null || _c === void 0 ? void 0 : _c.id) != null &&
|
|
184
|
+
currentSelectedEntityLine != null &&
|
|
185
|
+
currentSelectedEntityLine.type === 'customer') {
|
|
153
186
|
return {
|
|
154
|
-
entityId:
|
|
155
|
-
entityType: '
|
|
187
|
+
entityId: lineItemLocalData.customer.id,
|
|
188
|
+
entityType: 'customer',
|
|
156
189
|
};
|
|
157
190
|
}
|
|
158
|
-
if (((
|
|
191
|
+
if (((_d = lineItemLocalData.vendor) === null || _d === void 0 ? void 0 : _d.id) != null &&
|
|
192
|
+
currentSelectedEntityLine != null &&
|
|
193
|
+
currentSelectedEntityLine.type === 'vendor') {
|
|
159
194
|
return {
|
|
160
195
|
entityId: lineItemLocalData.vendor.id,
|
|
161
196
|
entityType: 'vendor',
|
|
@@ -163,3 +198,44 @@ const getEntityDetails = (entity, lineItemLocalData, vendorUpdates) => {
|
|
|
163
198
|
}
|
|
164
199
|
return undefined;
|
|
165
200
|
};
|
|
201
|
+
const getEntityFromTransaction = (transaction, currentSelectedEntity) => {
|
|
202
|
+
if ((0, vendorTransaction_1.isVendorTransaction)(transaction)) {
|
|
203
|
+
const vendor = transaction.vendor;
|
|
204
|
+
const customer = transaction.customer;
|
|
205
|
+
if (customer != null &&
|
|
206
|
+
currentSelectedEntity != null &&
|
|
207
|
+
currentSelectedEntity.type === 'customer') {
|
|
208
|
+
return {
|
|
209
|
+
id: customer.id,
|
|
210
|
+
name: customer.name,
|
|
211
|
+
type: (0, entity_1.toEntityType)('customer'),
|
|
212
|
+
qboId: customer.id,
|
|
213
|
+
zeniId: customer.id,
|
|
214
|
+
};
|
|
215
|
+
}
|
|
216
|
+
if (vendor != null &&
|
|
217
|
+
currentSelectedEntity != null &&
|
|
218
|
+
currentSelectedEntity.type === 'vendor') {
|
|
219
|
+
return {
|
|
220
|
+
id: vendor.id,
|
|
221
|
+
name: vendor.name,
|
|
222
|
+
type: (0, entity_1.toEntityType)('vendor'),
|
|
223
|
+
qboId: vendor.id,
|
|
224
|
+
zeniId: vendor.id,
|
|
225
|
+
};
|
|
226
|
+
}
|
|
227
|
+
}
|
|
228
|
+
if ((0, customerTransaction_1.isCustomerTransaction)(transaction)) {
|
|
229
|
+
const customerEntity = transaction.customer;
|
|
230
|
+
if (customerEntity != null) {
|
|
231
|
+
return {
|
|
232
|
+
id: customerEntity.id,
|
|
233
|
+
name: customerEntity.name,
|
|
234
|
+
type: (0, entity_1.toEntityType)('customer'),
|
|
235
|
+
qboId: customerEntity.id,
|
|
236
|
+
zeniId: customerEntity.id,
|
|
237
|
+
};
|
|
238
|
+
}
|
|
239
|
+
}
|
|
240
|
+
return undefined;
|
|
241
|
+
};
|
package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts
CHANGED
|
@@ -8,6 +8,6 @@ import { UncategorizedAccounts } from '../../accountList/accountListSelector';
|
|
|
8
8
|
import { TransactionReviewLocalData, TransactionsTabViewState } from '../types/transactionsViewState';
|
|
9
9
|
export declare const MAX_SELECTION_LIMIT = 5;
|
|
10
10
|
export declare const toTransactionDetailLocalData: (transaction: SupportedTransaction) => TransactionReviewLocalData;
|
|
11
|
-
export declare const toSetAllLineItemsToCategoryClass: (draft: TransactionsTabViewState, transaction: SupportedTransaction, transactionId: ID, transactionLineId: ID, transactionDetailLocalData: TransactionReviewLocalData, updatedItem: "category" | "class", uncategorizedAccounts: UncategorizedAccounts, vendorId?: ID, selectedAccount?: AccountBase, selectedClassBase?: ClassBase) => TransactionReviewLocalData;
|
|
11
|
+
export declare const toSetAllLineItemsToCategoryClass: (draft: TransactionsTabViewState, transaction: SupportedTransaction, transactionId: ID, transactionLineId: ID, transactionDetailLocalData: TransactionReviewLocalData, updatedItem: "category" | "class", uncategorizedAccounts: UncategorizedAccounts, vendorId?: ID, customerId?: ID, selectedAccount?: AccountBase, selectedClassBase?: ClassBase) => TransactionReviewLocalData;
|
|
12
12
|
export declare const setEntityRecommendationForLineIdInLocalData: (draft: TransactionsTabViewState, transaction: SupportedTransaction, transactionDetailLocalData: TransactionReviewLocalData, entity: Entity, recommendationLineIds: ID[], uncategorizedAccounts: UncategorizedAccounts, recommendationByLineId?: RecommendationByLineId) => TransactionReviewLocalData;
|
|
13
13
|
export declare const checkIfAllLineItemsAreCategoryClassFilled: (transaction: SupportedTransaction, transactionDetailLocalData: TransactionReviewLocalData, uncategorizedAccounts: UncategorizedAccounts) => boolean;
|
|
@@ -19,7 +19,41 @@ const toTransactionDetailLocalData = (transaction) => {
|
|
|
19
19
|
logo: transaction.logo,
|
|
20
20
|
}
|
|
21
21
|
: undefined;
|
|
22
|
+
transactionLocal.customer =
|
|
23
|
+
transaction.customerId != null &&
|
|
24
|
+
transaction.customerName != null &&
|
|
25
|
+
Boolean(transaction.customerId) === true &&
|
|
26
|
+
Boolean(transaction.customerName) === true
|
|
27
|
+
? {
|
|
28
|
+
id: transaction.customerId,
|
|
29
|
+
name: transaction.customerName,
|
|
30
|
+
logo: transaction.logo,
|
|
31
|
+
}
|
|
32
|
+
: undefined;
|
|
33
|
+
if ((0, vendorTransaction_1.isVendorTransaction)(transaction) &&
|
|
34
|
+
transaction.vendorId != null &&
|
|
35
|
+
transaction.vendorName != null) {
|
|
36
|
+
transactionLocal.selectedEntity = {
|
|
37
|
+
id: transaction.vendorId,
|
|
38
|
+
name: transaction.vendorName,
|
|
39
|
+
type: 'vendor',
|
|
40
|
+
qboId: transaction.vendorId,
|
|
41
|
+
zeniId: transaction.vendorId,
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
if ((0, vendorTransaction_1.isVendorTransaction)(transaction) &&
|
|
45
|
+
transaction.customerId != null &&
|
|
46
|
+
transaction.customerName != null) {
|
|
47
|
+
transactionLocal.selectedEntity = {
|
|
48
|
+
id: transaction.customerId,
|
|
49
|
+
name: transaction.customerName,
|
|
50
|
+
type: 'customer',
|
|
51
|
+
qboId: transaction.customerId,
|
|
52
|
+
zeniId: transaction.customerId,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
22
55
|
transactionLocal.vendorUpdates = undefined;
|
|
56
|
+
transactionLocal.customerUpdates = undefined;
|
|
23
57
|
transactionLocal.lineItemById =
|
|
24
58
|
transaction.lines != null && transaction.lines.length > 0
|
|
25
59
|
? buildLineItemById(transaction, transaction.recommendations)
|
|
@@ -53,7 +87,34 @@ const buildLineItemById = (transaction, recommendations) => {
|
|
|
53
87
|
logo: accountLine.vendor.logo,
|
|
54
88
|
}
|
|
55
89
|
: undefined;
|
|
56
|
-
record.customer =
|
|
90
|
+
record.customer =
|
|
91
|
+
accountLine.customer != null &&
|
|
92
|
+
Boolean(accountLine.customer.id) === true &&
|
|
93
|
+
Boolean(accountLine.customer.name) === true
|
|
94
|
+
? {
|
|
95
|
+
id: accountLine.customer.id,
|
|
96
|
+
name: accountLine.customer.name,
|
|
97
|
+
logo: accountLine.customer.logo,
|
|
98
|
+
}
|
|
99
|
+
: undefined;
|
|
100
|
+
record.selectedEntityLine =
|
|
101
|
+
record.vendor != null
|
|
102
|
+
? {
|
|
103
|
+
id: record.vendor.id,
|
|
104
|
+
name: record.vendor.name,
|
|
105
|
+
type: 'vendor',
|
|
106
|
+
qboId: record.vendor.id,
|
|
107
|
+
zeniId: record.vendor.id,
|
|
108
|
+
}
|
|
109
|
+
: record.customer != null
|
|
110
|
+
? {
|
|
111
|
+
id: record.customer.id,
|
|
112
|
+
name: record.customer.name,
|
|
113
|
+
type: 'customer',
|
|
114
|
+
qboId: record.customer.id,
|
|
115
|
+
zeniId: record.customer.id,
|
|
116
|
+
}
|
|
117
|
+
: undefined;
|
|
57
118
|
record.billable = accountLine.billable;
|
|
58
119
|
record.categorizationStatus = accountLine.categorizationStatus;
|
|
59
120
|
record.reviewPendingReasons = accountLine.reviewPendingReasons;
|
|
@@ -89,7 +150,7 @@ const buildLineItemById = (transaction, recommendations) => {
|
|
|
89
150
|
});
|
|
90
151
|
return lineItemData;
|
|
91
152
|
};
|
|
92
|
-
const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, transactionLineId, transactionDetailLocalData, updatedItem, uncategorizedAccounts, vendorId, selectedAccount, selectedClassBase) => {
|
|
153
|
+
const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, transactionLineId, transactionDetailLocalData, updatedItem, uncategorizedAccounts, vendorId, customerId, selectedAccount, selectedClassBase) => {
|
|
93
154
|
const newLineItems = {};
|
|
94
155
|
let selectedCheckBoxTransactionIds = draft.selectedCheckBoxTransactionIds;
|
|
95
156
|
if (transaction.lines != null) {
|
|
@@ -124,8 +185,11 @@ const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, tra
|
|
|
124
185
|
}
|
|
125
186
|
}
|
|
126
187
|
else {
|
|
127
|
-
if ((transactionDetailLocalData.
|
|
128
|
-
transactionDetailLocalData.
|
|
188
|
+
if ((transactionDetailLocalData.customer != null &&
|
|
189
|
+
transactionDetailLocalData.customer.id === customerId) ||
|
|
190
|
+
(record.customer != null && record.customer.id === customerId) ||
|
|
191
|
+
(transactionDetailLocalData.vendor != null &&
|
|
192
|
+
transactionDetailLocalData.vendor.id === vendorId) ||
|
|
129
193
|
(record.vendor != null && record.vendor.id === vendorId)) {
|
|
130
194
|
// if the vendor is same, then set the account and class with the selected ones and add the transaction to the selected list
|
|
131
195
|
if (selectedAccount != null &&
|
|
@@ -174,7 +238,7 @@ const toSetAllLineItemsToCategoryClass = (draft, transaction, transactionId, tra
|
|
|
174
238
|
}
|
|
175
239
|
});
|
|
176
240
|
}
|
|
177
|
-
const newLocalData = Object.assign(Object.assign({}, transactionsViewState_1.initialSupportedTransactionCategorization.transactionReviewLocalData), { sortedLineItems: transactionDetailLocalData.sortedLineItems, memo: transactionDetailLocalData.memo, lineItemById: newLineItems, transactionDate: transactionDetailLocalData.transactionDate, transactionType: transactionDetailLocalData.transactionType, transactionTypeName: transactionDetailLocalData.transactionTypeName, vendor: transactionDetailLocalData.vendor, vendorUpdates: transactionDetailLocalData.vendorUpdates, vendorDetails: transactionDetailLocalData.vendorDetails });
|
|
241
|
+
const newLocalData = Object.assign(Object.assign({}, transactionsViewState_1.initialSupportedTransactionCategorization.transactionReviewLocalData), { sortedLineItems: transactionDetailLocalData.sortedLineItems, memo: transactionDetailLocalData.memo, lineItemById: newLineItems, transactionDate: transactionDetailLocalData.transactionDate, transactionType: transactionDetailLocalData.transactionType, transactionTypeName: transactionDetailLocalData.transactionTypeName, vendor: transactionDetailLocalData.vendor, customer: transactionDetailLocalData.customer, vendorUpdates: transactionDetailLocalData.vendorUpdates, customerUpdates: transactionDetailLocalData.customerUpdates, vendorDetails: transactionDetailLocalData.vendorDetails, customerDetails: transactionDetailLocalData.customerDetails, selectedEntity: transactionDetailLocalData.selectedEntity });
|
|
178
242
|
if (!(0, exports.checkIfAllLineItemsAreCategoryClassFilled)(transaction, newLocalData, uncategorizedAccounts)) {
|
|
179
243
|
selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds.filter((id) => id !== transaction.id);
|
|
180
244
|
}
|
|
@@ -238,7 +302,7 @@ const setEntityRecommendationForLineIdInLocalData = (draft, transaction, transac
|
|
|
238
302
|
const newLineItem = newLineItems[matchingEntityLineId];
|
|
239
303
|
newLineItems[matchingEntityLineId] = Object.assign(Object.assign({}, newLineItem), { class: matchingRecord.class, account: matchingRecord.account, lineEntity: matchingRecord.lineEntity });
|
|
240
304
|
}
|
|
241
|
-
const newLocalData = Object.assign(Object.assign({}, transactionsViewState_1.initialSupportedTransactionCategorization.transactionReviewLocalData), { sortedLineItems: transactionDetailLocalData.sortedLineItems, memo: transactionDetailLocalData.memo, lineItemById: newLineItems, transactionDate: transactionDetailLocalData.transactionDate, transactionType: transactionDetailLocalData.transactionType, transactionTypeName: transactionDetailLocalData.transactionTypeName, vendorUpdates: transactionDetailLocalData.vendorUpdates, vendorDetails: transactionDetailLocalData.vendorDetails, vendor: transactionDetailLocalData.vendor });
|
|
305
|
+
const newLocalData = Object.assign(Object.assign({}, transactionsViewState_1.initialSupportedTransactionCategorization.transactionReviewLocalData), { sortedLineItems: transactionDetailLocalData.sortedLineItems, memo: transactionDetailLocalData.memo, lineItemById: newLineItems, transactionDate: transactionDetailLocalData.transactionDate, transactionType: transactionDetailLocalData.transactionType, transactionTypeName: transactionDetailLocalData.transactionTypeName, vendorUpdates: transactionDetailLocalData.vendorUpdates, customerUpdates: transactionDetailLocalData.customerUpdates, vendorDetails: transactionDetailLocalData.vendorDetails, customerDetails: transactionDetailLocalData.customerDetails, vendor: transactionDetailLocalData.vendor, customer: transactionDetailLocalData.customer, selectedEntity: transactionDetailLocalData.selectedEntity });
|
|
242
306
|
if (!(0, exports.checkIfAllLineItemsAreCategoryClassFilled)(transaction, newLocalData, uncategorizedAccounts)) {
|
|
243
307
|
selectedCheckBoxTransactionIds = selectedCheckBoxTransactionIds.filter((id) => id !== transaction.id);
|
|
244
308
|
}
|
|
@@ -250,7 +314,7 @@ const checkIfAllLineItemsAreCategoryClassFilled = (transaction, transactionDetai
|
|
|
250
314
|
const lineItems = Object.values(transactionDetailLocalData.lineItemById);
|
|
251
315
|
const isVendorTransactionAvailable = (0, vendorTransaction_1.isVendorTransaction)(transaction);
|
|
252
316
|
return lineItems.every((lineItem) => {
|
|
253
|
-
var _a, _b, _c
|
|
317
|
+
var _a, _b, _c;
|
|
254
318
|
return lineItem.account != null &&
|
|
255
319
|
Boolean(lineItem.account.qboId) === true &&
|
|
256
320
|
lineItem.class != null &&
|
|
@@ -260,10 +324,20 @@ const checkIfAllLineItemsAreCategoryClassFilled = (transaction, transactionDetai
|
|
|
260
324
|
(_b = uncategorizedAccounts.expense) === null || _b === void 0 ? void 0 : _b.qboId,
|
|
261
325
|
(_c = uncategorizedAccounts.income) === null || _c === void 0 ? void 0 : _c.qboId,
|
|
262
326
|
].includes(lineItem.account.qboId)) &&
|
|
263
|
-
(isVendorTransactionAvailable
|
|
264
|
-
?
|
|
327
|
+
((isVendorTransactionAvailable
|
|
328
|
+
? transactionDetailLocalData.vendor != null &&
|
|
329
|
+
transactionDetailLocalData.vendor.id != null &&
|
|
265
330
|
Boolean(transactionDetailLocalData.vendor.id) === true
|
|
266
|
-
:
|
|
331
|
+
: lineItem.vendor != null &&
|
|
332
|
+
lineItem.vendor.id != null &&
|
|
333
|
+
Boolean(lineItem.vendor.id) === true) ||
|
|
334
|
+
(isVendorTransactionAvailable
|
|
335
|
+
? transactionDetailLocalData.customer != null &&
|
|
336
|
+
transactionDetailLocalData.customer.id != null &&
|
|
337
|
+
Boolean(transactionDetailLocalData.customer.id) === true
|
|
338
|
+
: lineItem.customer != null &&
|
|
339
|
+
lineItem.customer.id != null &&
|
|
340
|
+
Boolean(lineItem.customer.id) === true));
|
|
267
341
|
});
|
|
268
342
|
};
|
|
269
343
|
exports.checkIfAllLineItemsAreCategoryClassFilled = checkIfAllLineItemsAreCategoryClassFilled;
|