@zeniai/client-epic-state 4.15.43 → 4.15.44
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/README.md +19 -1
- package/lib/commonPayloadTypes/recommendationPayload.d.ts +1 -0
- package/lib/commonStateTypes/common.d.ts +1 -1
- package/lib/commonStateTypes/fiscalYearHelpers/getFYMonths.d.ts +2 -2
- package/lib/commonStateTypes/fiscalYearHelpers/getFYQuarterAndYear.d.ts +2 -2
- package/lib/commonStateTypes/timePeriod.d.ts +7 -7
- package/lib/commonStateTypes/timePeriod.js +2 -2
- package/lib/commonStateTypes/viewAndReport/agingReportStateTypes.d.ts +1 -1
- 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/accountSelector.d.ts +3 -3
- package/lib/entity/account/accountState.d.ts +1 -1
- package/lib/entity/account/pickAndMergeForecastAccountReport.d.ts +1 -1
- package/lib/entity/accountGroup/accountGroupSelector.d.ts +22 -22
- 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/approvalRule/approvalRuleState.d.ts +2 -2
- package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +4 -4
- package/lib/entity/chargeCard/chargeCard.d.ts +1 -1
- package/lib/entity/chargeCardTransaction/chargeCardTransaction.d.ts +1 -1
- 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/depositAccountTransaction/depositAccountTransaction.d.ts +1 -1
- package/lib/entity/entityApprovalStatus/entityApprovalStatusState.d.ts +2 -2
- package/lib/entity/file/fileState.d.ts +3 -3
- package/lib/entity/forecast/forecastState.d.ts +1 -1
- package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +2 -2
- package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +2 -2
- package/lib/entity/notification/types/notificationTypes.d.ts +2 -2
- 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 +2 -2
- package/lib/entity/snackbar/snackbarTypes.js +4 -0
- package/lib/entity/task/taskState.d.ts +3 -3
- package/lib/entity/tenant/clearAllEpic.d.ts +4 -2
- package/lib/entity/tenant/clearAllEpic.js +4 -0
- package/lib/entity/tenant/tenantReducer.d.ts +2 -2
- 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 +24 -2
- package/lib/entity/transaction/stateTypes/attachment.d.ts +2 -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 +20 -12
- 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/auditReportViewReducer.d.ts +2 -2
- package/lib/view/auditReportView/auditReportViewState.d.ts +2 -2
- package/lib/view/balanceSheet/balanceSheetReducer.js +1 -6
- package/lib/view/bankAccountView/bankAccountViewReducer.js +0 -1
- package/lib/view/billPayCard/billPayCardSelector.d.ts +2 -2
- package/lib/view/cardBalance/cardBalanceSelector.d.ts +3 -3
- package/lib/view/cashBalance/cashBalanceSelector.d.ts +3 -3
- package/lib/view/cashFlow/cashFlowReducer.js +1 -4
- package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +2 -2
- package/lib/view/cashPosition/cashPositionReducer.js +0 -1
- package/lib/view/cashPosition/cashPositionSelector.d.ts +2 -2
- package/lib/view/common/reportsHelpers.d.ts +1 -1
- package/lib/view/commonVendorView/transactionVendorView/epics/saveTransactionVendorEpic.js +7 -0
- package/lib/view/commonVendorView/vendorView/epics/fetchAndUpdateVendorRecommendationsEpic.js +1 -3
- package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.d.ts +2 -2
- package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +2 -2
- package/lib/view/companyView/companyViewReducer.d.ts +1 -1
- package/lib/view/companyView/companyViewReducer.js +1 -10
- package/lib/view/companyView/types/cockpitTypes.d.ts +3 -3
- package/lib/view/companyView/types/companyPassport/companyUsersLocalData.d.ts +1 -1
- 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 +30 -7
- 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 +98 -42
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +86 -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/jeSchedulesViewReducer.d.ts +11 -11
- 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/jeSchedulesViewSelector.js +5 -2
- package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.d.ts +5 -0
- package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +254 -0
- package/lib/view/expenseAutomationView/types/fluxAnalysisViewState.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +1 -1
- package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +103 -0
- package/lib/view/expenseAutomationView/types/reconciliationViewState.js +37 -0
- package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +12 -2
- package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
- package/lib/view/financeStatement/financeStatementReducer.js +1 -4
- package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +4 -4
- 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/netBurnOrIncomeStoryCard/netBurnOrIncomeStoryCardState.d.ts +1 -1
- package/lib/view/notificationView/notificationViewReducer.d.ts +8 -8
- package/lib/view/notificationView/notificationViewState.d.ts +2 -2
- package/lib/view/onboardingView/cockpitView/onboardingCockpitViewReducer.js +0 -3
- package/lib/view/onboardingView/customerView/onboardingCustomerViewReducer.d.ts +2 -2
- 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/opExByVendor/opExByVendorState.d.ts +1 -1
- 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/referralView/referralState.d.ts +1 -1
- package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +2 -2
- package/lib/view/reportUIOptions/reportUIOptionsReducer.d.ts +8 -8
- 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/scheduleAccruedDetailView/LinkBillExpenseView/linkBillExpense.d.ts +1 -1
- package/lib/view/scheduleView/scheduleDetailView/scheduleDetailReducer.d.ts +4 -4
- package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +2 -2
- package/lib/view/settingsView/settingsViewReducer.js +0 -1
- package/lib/view/settingsView/settingsViewState.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListReducer.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billList/billListReducer.js +0 -1
- package/lib/view/spendManagement/billPay/billList/billListState.d.ts +2 -2
- package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.d.ts +1 -1
- package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.js +0 -6
- package/lib/view/spendManagement/billPay/billsBulkActionView/billsBulkActionViewReducer.d.ts +2 -2
- 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/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +2 -2
- package/lib/view/spendManagement/commonHistoryView/commonHistory.d.ts +1 -1
- package/lib/view/spendManagement/commonSetup/setupViewReducer.d.ts +7 -7
- package/lib/view/spendManagement/commonSetup/setupViewState.d.ts +1 -1
- package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.js +11 -3
- package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +11 -10
- 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.d.ts +1 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.js +0 -1
- package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +4 -4
- package/lib/view/spendManagement/reimbursement/remisBulkActionView/remisBulkActionViewReducer.d.ts +2 -2
- 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/taskManager/taskListView/taskList.d.ts +3 -3
- package/lib/view/taskManager/taskListView/taskListSelector.d.ts +1 -1
- package/lib/view/tasksCard/fetchTasksCardEpic.js +1 -2
- package/lib/view/tasksCard/tasksCardSelector.d.ts +2 -2
- package/lib/view/tasksCard/tasksCardSelector.js +1 -1
- package/lib/view/topEx/topExSelector.d.ts +3 -3
- package/lib/view/transactionDetail/epics/saveTransactionHelper.js +30 -52
- package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +22 -4
- package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +66 -13
- package/lib/view/transactionDetail/transactionDetailReducer.d.ts +13 -4
- package/lib/view/transactionDetail/transactionDetailReducer.js +51 -21
- package/lib/view/transactionDetail/transactionDetailState.d.ts +3 -2
- 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/vendorFiling1099/vendorFiling1099List/vendorFiling1099ListState.d.ts +1 -1
- package/lib/view/vendorReviewView/vendorFirstReviewView/vendorFirstReviewViewState.d.ts +1 -1
- package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewState.d.ts +1 -1
- package/lib/zeniAPI.d.ts +1 -0
- package/lib/zeniUrl.d.ts +1 -1
- package/package.json +13 -12
|
@@ -2,8 +2,6 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.isAccountUncategorized = exports.isTransactionUncategorized = exports.isTransactionMiscategorized = exports.toRecommendedClassBase = exports.toRecommendedAccountBase = exports.toTransactionUpdatesFromTransactionDetailLocalData = void 0;
|
|
4
4
|
const recommendationBase_1 = require("../../../commonStateTypes/recommendationBase");
|
|
5
|
-
const entity_1 = require("../../../entity/genericEntity/entity");
|
|
6
|
-
const customerTransaction_1 = require("../../../entity/transaction/stateTypes/customerTransaction");
|
|
7
5
|
const transactionType_1 = require("../../../entity/transaction/stateTypes/transactionType");
|
|
8
6
|
const vendorTransaction_1 = require("../../../entity/transaction/stateTypes/vendorTransaction");
|
|
9
7
|
const recommendationState_1 = require("../../recommendation/recommendationState");
|
|
@@ -25,7 +23,7 @@ const recommendationState_1 = require("../../recommendation/recommendationState"
|
|
|
25
23
|
* additionally fire “Mark as not miscat” for every point above.
|
|
26
24
|
*/
|
|
27
25
|
const toTransactionUpdatesFromTransactionDetailLocalData = (transactionDetailLocalData, transaction, isExpenseAutomationEnabled) => {
|
|
28
|
-
var _a, _b
|
|
26
|
+
var _a, _b;
|
|
29
27
|
const updates = {
|
|
30
28
|
updatesByLineId: {},
|
|
31
29
|
};
|
|
@@ -33,21 +31,28 @@ const toTransactionUpdatesFromTransactionDetailLocalData = (transactionDetailLoc
|
|
|
33
31
|
const entityUpdates = {};
|
|
34
32
|
const isTransactionMisCategorized = (0, exports.isTransactionMiscategorized)(transaction, isExpenseAutomationEnabled);
|
|
35
33
|
updates.memo = transactionDetailLocalData.memo;
|
|
34
|
+
const selectedEntity = transactionDetailLocalData.selectedEntity;
|
|
36
35
|
const updatedEntityId = transactionDetailLocalData.updatePreviousTransactionsWithUpdatedVendor ===
|
|
37
36
|
true
|
|
38
37
|
? (_a = transactionDetailLocalData.vendorUpdates) === null || _a === void 0 ? void 0 : _a.qboId
|
|
39
38
|
: undefined;
|
|
40
|
-
if ((0, vendorTransaction_1.isVendorTransaction)(transaction)
|
|
41
|
-
|
|
39
|
+
if ((0, vendorTransaction_1.isVendorTransaction)(transaction) &&
|
|
40
|
+
selectedEntity != null &&
|
|
41
|
+
selectedEntity.type === 'vendor') {
|
|
42
|
+
updates.vendorId = selectedEntity.id;
|
|
43
|
+
}
|
|
44
|
+
if ((0, vendorTransaction_1.isVendorTransaction)(transaction) &&
|
|
45
|
+
selectedEntity != null &&
|
|
46
|
+
selectedEntity.type === 'customer') {
|
|
47
|
+
updates.customerId = selectedEntity.id;
|
|
42
48
|
}
|
|
43
49
|
let isBulkUpdate = false;
|
|
44
|
-
const entity = getEntityFromTransaction(transaction);
|
|
45
50
|
let lastUpdatedCategory;
|
|
46
51
|
let lastUpdatedClass;
|
|
47
52
|
// single recommendation to just pick the last recommendation in the list of lines
|
|
48
|
-
(
|
|
53
|
+
(_b = transaction.lines) === null || _b === void 0 ? void 0 : _b.forEach((line) => {
|
|
49
54
|
var _a, _b, _c, _d, _e, _f;
|
|
50
|
-
const entityDetails = getEntityDetails(
|
|
55
|
+
const entityDetails = getEntityDetails(selectedEntity, transactionDetailLocalData.lineItemById[line.id], transactionDetailLocalData.vendorUpdates, transactionDetailLocalData.customerUpdates);
|
|
51
56
|
if (line.type === 'transaction_with_account_and_class_line' ||
|
|
52
57
|
line.type === 'transaction_with_product_or_service_line' ||
|
|
53
58
|
line.type === 'journal_entry_transaction_line') {
|
|
@@ -60,7 +65,14 @@ const toTransactionUpdatesFromTransactionDetailLocalData = (transactionDetailLoc
|
|
|
60
65
|
};
|
|
61
66
|
if (line.type === 'journal_entry_transaction_line' ||
|
|
62
67
|
line.platformLineDetailType === 'deposit_line_detail') {
|
|
63
|
-
|
|
68
|
+
const currentSelectedEntityLine = lineItem.lineEntity;
|
|
69
|
+
updatesByLineId[line.id] = Object.assign(Object.assign({}, updatesByLineId[line.id]), { customer: currentSelectedEntityLine != null &&
|
|
70
|
+
currentSelectedEntityLine.type === 'customer'
|
|
71
|
+
? lineItem.customer
|
|
72
|
+
: undefined, vendor: currentSelectedEntityLine != null &&
|
|
73
|
+
currentSelectedEntityLine.type === 'vendor'
|
|
74
|
+
? lineItem.vendor
|
|
75
|
+
: undefined });
|
|
64
76
|
}
|
|
65
77
|
let hasCategoryChanged = false;
|
|
66
78
|
let hasClassChanged = false;
|
|
@@ -187,49 +199,7 @@ const toRecommendedClassBase = (amountValue, classBase, recommendationBase) => {
|
|
|
187
199
|
}
|
|
188
200
|
};
|
|
189
201
|
exports.toRecommendedClassBase = toRecommendedClassBase;
|
|
190
|
-
const
|
|
191
|
-
var _a;
|
|
192
|
-
if (lineItem.lineEntity != null) {
|
|
193
|
-
const lineEntity = lineItem.lineEntity;
|
|
194
|
-
const type = lineItem.vendor != null ? 'vendor' : 'customer';
|
|
195
|
-
return {
|
|
196
|
-
[type]: {
|
|
197
|
-
name: lineEntity === null || lineEntity === void 0 ? void 0 : lineEntity.name,
|
|
198
|
-
id: (_a = lineEntity === null || lineEntity === void 0 ? void 0 : lineEntity.qboId) !== null && _a !== void 0 ? _a : lineEntity === null || lineEntity === void 0 ? void 0 : lineEntity.id, // For vendor we don't have qbo_id in VendorBase so using id instead
|
|
199
|
-
},
|
|
200
|
-
};
|
|
201
|
-
}
|
|
202
|
-
return {};
|
|
203
|
-
};
|
|
204
|
-
const getEntityFromTransaction = (transaction) => {
|
|
205
|
-
let entity = undefined;
|
|
206
|
-
if ((0, vendorTransaction_1.isVendorTransaction)(transaction)) {
|
|
207
|
-
const vendorEntity = transaction.vendor;
|
|
208
|
-
if (vendorEntity != null) {
|
|
209
|
-
entity = {
|
|
210
|
-
id: vendorEntity.id,
|
|
211
|
-
name: vendorEntity.name,
|
|
212
|
-
type: (0, entity_1.toEntityType)('vendor'),
|
|
213
|
-
qboId: vendorEntity.id,
|
|
214
|
-
zeniId: vendorEntity.id,
|
|
215
|
-
};
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
if ((0, customerTransaction_1.isCustomerTransaction)(transaction)) {
|
|
219
|
-
const customerEntity = transaction.customer;
|
|
220
|
-
if (customerEntity != null) {
|
|
221
|
-
entity = {
|
|
222
|
-
id: customerEntity.id,
|
|
223
|
-
name: customerEntity.name,
|
|
224
|
-
type: (0, entity_1.toEntityType)('customer'),
|
|
225
|
-
qboId: customerEntity.id,
|
|
226
|
-
zeniId: customerEntity.id,
|
|
227
|
-
};
|
|
228
|
-
}
|
|
229
|
-
}
|
|
230
|
-
return entity;
|
|
231
|
-
};
|
|
232
|
-
const getEntityDetails = (entity, lineItemLocalData, vendorUpdates) => {
|
|
202
|
+
const getEntityDetails = (entity, lineItemLocalData, vendorUpdates, customerUpdates) => {
|
|
233
203
|
var _a, _b, _c, _d;
|
|
234
204
|
if (entity != null) {
|
|
235
205
|
return {
|
|
@@ -243,6 +213,14 @@ const getEntityDetails = (entity, lineItemLocalData, vendorUpdates) => {
|
|
|
243
213
|
entityType: lineItemLocalData.vendor != null ? 'vendor' : 'customer',
|
|
244
214
|
};
|
|
245
215
|
}
|
|
216
|
+
if (customerUpdates != null &&
|
|
217
|
+
Boolean(customerUpdates.id) === true &&
|
|
218
|
+
customerUpdates.id != null) {
|
|
219
|
+
return {
|
|
220
|
+
entityId: customerUpdates.id,
|
|
221
|
+
entityType: 'customer',
|
|
222
|
+
};
|
|
223
|
+
}
|
|
246
224
|
if (vendorUpdates != null && vendorUpdates.id != null) {
|
|
247
225
|
return {
|
|
248
226
|
entityId: vendorUpdates.id,
|
|
@@ -126,8 +126,12 @@ function preparePayload(transactionState, vendorState, transactionDetailState, t
|
|
|
126
126
|
const detail = (0, transactionSelector_1.getSupportedTransactionById)(transactionState, transactionDetailKey);
|
|
127
127
|
const tranDetail = (0, get_1.default)(transactionDetailState.transactionDetailById, transactionDetailKey, undefined);
|
|
128
128
|
const tranVendorUpdates = tranDetail === null || tranDetail === void 0 ? void 0 : tranDetail.transactionDetailLocalData.vendorUpdates;
|
|
129
|
+
const tranCustomerUpdates = tranDetail === null || tranDetail === void 0 ? void 0 : tranDetail.transactionDetailLocalData.customerUpdates;
|
|
130
|
+
const currentSelectedEntity = tranDetail === null || tranDetail === void 0 ? void 0 : tranDetail.transactionDetailLocalData.selectedEntity;
|
|
129
131
|
let vendorUpdates = undefined;
|
|
130
|
-
if ((tranVendorUpdates === null || tranVendorUpdates === void 0 ? void 0 : tranVendorUpdates.qboId) != null
|
|
132
|
+
if ((tranVendorUpdates === null || tranVendorUpdates === void 0 ? void 0 : tranVendorUpdates.qboId) != null &&
|
|
133
|
+
currentSelectedEntity != null &&
|
|
134
|
+
currentSelectedEntity.type === 'vendor') {
|
|
131
135
|
const vendor = (0, vendorSelector_1.getVendorByVendorId)(vendorState, tranVendorUpdates.qboId);
|
|
132
136
|
if (vendor != null) {
|
|
133
137
|
vendorUpdates = {
|
|
@@ -142,8 +146,17 @@ function preparePayload(transactionState, vendorState, transactionDetailState, t
|
|
|
142
146
|
};
|
|
143
147
|
}
|
|
144
148
|
}
|
|
149
|
+
let customerUpdates = undefined;
|
|
150
|
+
if ((tranCustomerUpdates === null || tranCustomerUpdates === void 0 ? void 0 : tranCustomerUpdates.qboId) != null &&
|
|
151
|
+
currentSelectedEntity != null &&
|
|
152
|
+
currentSelectedEntity.type === 'customer') {
|
|
153
|
+
customerUpdates = {
|
|
154
|
+
id: tranCustomerUpdates.qboId,
|
|
155
|
+
name: tranCustomerUpdates.name,
|
|
156
|
+
};
|
|
157
|
+
}
|
|
145
158
|
if (detail != null) {
|
|
146
|
-
const transUpdates = toTransactionUpdatePayload(saveUpdates.updates, detail, vendorUpdates);
|
|
159
|
+
const transUpdates = toTransactionUpdatePayload(saveUpdates.updates, detail, vendorUpdates, customerUpdates, currentSelectedEntity);
|
|
147
160
|
const entityUpdates = toEntityUpdatePayload(saveUpdates.entityRelatedUpdates);
|
|
148
161
|
return {
|
|
149
162
|
entity_related_updates: entityUpdates,
|
|
@@ -153,7 +166,7 @@ function preparePayload(transactionState, vendorState, transactionDetailState, t
|
|
|
153
166
|
}
|
|
154
167
|
return undefined;
|
|
155
168
|
}
|
|
156
|
-
const toTransactionUpdatePayload = (updates, detail, vendorUpdates) => {
|
|
169
|
+
const toTransactionUpdatePayload = (updates, detail, vendorUpdates, customerUpdates, tranSelectedEntity) => {
|
|
157
170
|
var _a, _b;
|
|
158
171
|
const transaction = Object.assign({}, detail);
|
|
159
172
|
transaction.memo = (_a = updates.memo) !== null && _a !== void 0 ? _a : '';
|
|
@@ -197,7 +210,12 @@ const toTransactionUpdatePayload = (updates, detail, vendorUpdates) => {
|
|
|
197
210
|
return (0, customerTransactionPayload_1.toCustomerTransactionPayload)(transaction);
|
|
198
211
|
}
|
|
199
212
|
else if ((0, vendorTransaction_1.isVendorTransaction)(transaction)) {
|
|
200
|
-
|
|
213
|
+
if (tranSelectedEntity != null && tranSelectedEntity.type === 'customer') {
|
|
214
|
+
return (0, vendorTransactionPayload_1.toVendorTransactionWithCustomerPayload)(transaction, customerUpdates);
|
|
215
|
+
}
|
|
216
|
+
else {
|
|
217
|
+
return (0, vendorTransactionPayload_1.toVendorTransactionPayload)(transaction, vendorUpdates);
|
|
218
|
+
}
|
|
201
219
|
}
|
|
202
220
|
else if ((0, otherTransaction_1.isTransferTransaction)(transaction)) {
|
|
203
221
|
return (0, otherTransactionPayload_1.toTransferTransactionPayload)(transaction);
|
|
@@ -6,23 +6,75 @@ const customerTransaction_1 = require("../../entity/transaction/stateTypes/custo
|
|
|
6
6
|
const vendorTransaction_1 = require("../../entity/transaction/stateTypes/vendorTransaction");
|
|
7
7
|
const transactionDetailState_1 = require("./transactionDetailState");
|
|
8
8
|
const toTransactionDetailLocalData = (transaction, vendorId, uncategorizedIncomeExpense) => {
|
|
9
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
9
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m;
|
|
10
10
|
const transactionLocal = Object.assign({}, transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData);
|
|
11
|
+
const customerId = (_a = transaction.customer) === null || _a === void 0 ? void 0 : _a.id;
|
|
11
12
|
transactionLocal.memo = transaction.memo;
|
|
12
13
|
transactionLocal.vendorUpdates =
|
|
13
14
|
(0, vendorTransaction_1.isVendorTransaction)(transaction) && vendorId != null
|
|
14
15
|
? {
|
|
15
16
|
id: vendorId,
|
|
16
|
-
name: (
|
|
17
|
-
qboId: (
|
|
17
|
+
name: (_c = (_b = transaction.vendor) === null || _b === void 0 ? void 0 : _b.name) !== null && _c !== void 0 ? _c : '',
|
|
18
|
+
qboId: (_d = transaction.vendor) === null || _d === void 0 ? void 0 : _d.id,
|
|
18
19
|
}
|
|
19
20
|
: undefined;
|
|
21
|
+
transactionLocal.customerUpdates =
|
|
22
|
+
(0, vendorTransaction_1.isVendorTransactionWithCustomer)(transaction) && customerId != null
|
|
23
|
+
? {
|
|
24
|
+
id: customerId,
|
|
25
|
+
name: (_f = (_e = transaction.customer) === null || _e === void 0 ? void 0 : _e.name) !== null && _f !== void 0 ? _f : '',
|
|
26
|
+
qboId: (_h = (_g = transaction.customer) === null || _g === void 0 ? void 0 : _g.id) !== null && _h !== void 0 ? _h : '',
|
|
27
|
+
}
|
|
28
|
+
: undefined;
|
|
29
|
+
const vendorName = (_k = (_j = transaction.vendor) === null || _j === void 0 ? void 0 : _j.name) !== null && _k !== void 0 ? _k : '';
|
|
30
|
+
const customerName = (_m = (_l = transaction.customer) === null || _l === void 0 ? void 0 : _l.name) !== null && _m !== void 0 ? _m : '';
|
|
31
|
+
if ((0, vendorTransaction_1.isVendorTransactionWithCustomer)(transaction) === true &&
|
|
32
|
+
customerId != null &&
|
|
33
|
+
customerName != null &&
|
|
34
|
+
Boolean(customerName) === true) {
|
|
35
|
+
transactionLocal.selectedEntity = {
|
|
36
|
+
id: customerId,
|
|
37
|
+
name: customerName,
|
|
38
|
+
type: (0, entity_1.toEntityType)('customer'),
|
|
39
|
+
qboId: customerId,
|
|
40
|
+
zeniId: customerId,
|
|
41
|
+
};
|
|
42
|
+
}
|
|
43
|
+
else if ((0, vendorTransaction_1.isVendorTransaction)(transaction) === true &&
|
|
44
|
+
vendorId != null &&
|
|
45
|
+
vendorName &&
|
|
46
|
+
Boolean(vendorName) === true) {
|
|
47
|
+
transactionLocal.selectedEntity = {
|
|
48
|
+
id: vendorId,
|
|
49
|
+
name: vendorName,
|
|
50
|
+
type: (0, entity_1.toEntityType)('vendor'),
|
|
51
|
+
qboId: vendorId,
|
|
52
|
+
zeniId: vendorId,
|
|
53
|
+
};
|
|
54
|
+
}
|
|
55
|
+
else {
|
|
56
|
+
transactionLocal.selectedEntity = undefined;
|
|
57
|
+
}
|
|
20
58
|
transactionLocal.vendorDetails =
|
|
21
|
-
(0, vendorTransaction_1.isVendorTransaction)(transaction) &&
|
|
59
|
+
(0, vendorTransaction_1.isVendorTransaction)(transaction) &&
|
|
60
|
+
vendorId != null &&
|
|
61
|
+
vendorName != null &&
|
|
62
|
+
Boolean(vendorName) === true
|
|
22
63
|
? {
|
|
23
64
|
id: vendorId,
|
|
24
|
-
qboId:
|
|
25
|
-
name:
|
|
65
|
+
qboId: vendorId,
|
|
66
|
+
name: vendorName,
|
|
67
|
+
}
|
|
68
|
+
: undefined;
|
|
69
|
+
transactionLocal.customerDetails =
|
|
70
|
+
(0, vendorTransaction_1.isVendorTransactionWithCustomer)(transaction) &&
|
|
71
|
+
customerId != null &&
|
|
72
|
+
customerName != null &&
|
|
73
|
+
Boolean(customerName) === true
|
|
74
|
+
? {
|
|
75
|
+
id: customerId,
|
|
76
|
+
qboId: customerId,
|
|
77
|
+
name: customerName,
|
|
26
78
|
}
|
|
27
79
|
: undefined;
|
|
28
80
|
transactionLocal.lineItemById =
|
|
@@ -50,6 +102,7 @@ const buildLineItemById = (transaction, uncategorizedIncomeExpense, recommendati
|
|
|
50
102
|
? line.vendor != null ||
|
|
51
103
|
line.customer != null
|
|
52
104
|
: transaction.vendor != null ||
|
|
105
|
+
transaction.customer != null ||
|
|
53
106
|
transaction.customer != null;
|
|
54
107
|
record.account = accountLine.account;
|
|
55
108
|
record.class = accountLine.class;
|
|
@@ -324,7 +377,7 @@ const toUpdateLineItemsOriginalCategoryClass = (transaction, transactionDetailLo
|
|
|
324
377
|
}
|
|
325
378
|
});
|
|
326
379
|
}
|
|
327
|
-
const newLocalData = Object.assign(Object.assign({}, transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData), { memo: transactionDetailLocalData.memo, lineItemById: newLineItems, vendorDetails: transactionDetailLocalData.vendorDetails, vendorUpdates: transactionDetailLocalData.vendorUpdates, updatePreviousTransactionsWithUpdatedVendor: transactionDetailLocalData.updatePreviousTransactionsWithUpdatedVendor, isVendorUpdateAllChecked: transactionDetailLocalData.isVendorUpdateAllChecked, latestSelectedEntityOnLineItem: transactionDetailLocalData.latestSelectedEntityOnLineItem, latestUpdatedLineWithEntity: transactionDetailLocalData.latestUpdatedLineWithEntity });
|
|
380
|
+
const newLocalData = Object.assign(Object.assign({}, transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData), { memo: transactionDetailLocalData.memo, lineItemById: newLineItems, vendorDetails: transactionDetailLocalData.vendorDetails, vendorUpdates: transactionDetailLocalData.vendorUpdates, customerDetails: transactionDetailLocalData.customerDetails, customerUpdates: transactionDetailLocalData.customerUpdates, updatePreviousTransactionsWithUpdatedVendor: transactionDetailLocalData.updatePreviousTransactionsWithUpdatedVendor, isVendorUpdateAllChecked: transactionDetailLocalData.isVendorUpdateAllChecked, latestSelectedEntityOnLineItem: transactionDetailLocalData.latestSelectedEntityOnLineItem, latestUpdatedLineWithEntity: transactionDetailLocalData.latestUpdatedLineWithEntity, selectedEntity: transactionDetailLocalData.selectedEntity });
|
|
328
381
|
return newLocalData;
|
|
329
382
|
};
|
|
330
383
|
exports.toUpdateLineItemsOriginalCategoryClass = toUpdateLineItemsOriginalCategoryClass;
|
|
@@ -412,7 +465,7 @@ const toSetAllLineItemsToCategoryClass = (transaction, transactionDetailLocalDat
|
|
|
412
465
|
}
|
|
413
466
|
});
|
|
414
467
|
}
|
|
415
|
-
const newLocalData = Object.assign(Object.assign({}, transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData), { memo: transactionDetailLocalData.memo, lineItemById: newLineItems, vendorUpdates: transactionDetailLocalData.vendorUpdates, vendorDetails: transactionDetailLocalData.vendorDetails, updatePreviousTransactionsWithUpdatedVendor: transactionDetailLocalData.updatePreviousTransactionsWithUpdatedVendor, isVendorUpdateAllChecked: transactionDetailLocalData.isVendorUpdateAllChecked, latestSelectedEntityOnLineItem: transactionDetailLocalData.latestSelectedEntityOnLineItem, latestUpdatedLineWithEntity: transactionDetailLocalData.latestUpdatedLineWithEntity });
|
|
468
|
+
const newLocalData = Object.assign(Object.assign({}, transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData), { memo: transactionDetailLocalData.memo, lineItemById: newLineItems, vendorUpdates: transactionDetailLocalData.vendorUpdates, vendorDetails: transactionDetailLocalData.vendorDetails, customerUpdates: transactionDetailLocalData.customerUpdates, customerDetails: transactionDetailLocalData.customerDetails, updatePreviousTransactionsWithUpdatedVendor: transactionDetailLocalData.updatePreviousTransactionsWithUpdatedVendor, isVendorUpdateAllChecked: transactionDetailLocalData.isVendorUpdateAllChecked, latestSelectedEntityOnLineItem: transactionDetailLocalData.latestSelectedEntityOnLineItem, latestUpdatedLineWithEntity: transactionDetailLocalData.latestUpdatedLineWithEntity, selectedEntity: transactionDetailLocalData.selectedEntity });
|
|
416
469
|
return newLocalData;
|
|
417
470
|
};
|
|
418
471
|
exports.toSetAllLineItemsToCategoryClass = toSetAllLineItemsToCategoryClass;
|
|
@@ -438,7 +491,7 @@ const toSetAllLineItemsLocalDataIsUpdateAllChecked = (transaction, transactionDe
|
|
|
438
491
|
}
|
|
439
492
|
});
|
|
440
493
|
}
|
|
441
|
-
const newLocalData = Object.assign(Object.assign({}, transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData), { memo: transactionDetailLocalData.memo, lineItemById: newLineItems, vendorDetails: transactionDetailLocalData.vendorDetails, vendorUpdates: transactionDetailLocalData.vendorUpdates, updatePreviousTransactionsWithUpdatedVendor: transactionDetailLocalData.updatePreviousTransactionsWithUpdatedVendor, isVendorUpdateAllChecked: transactionDetailLocalData.isVendorUpdateAllChecked, latestSelectedEntityOnLineItem: transactionDetailLocalData.latestSelectedEntityOnLineItem, latestUpdatedLineWithEntity: transactionDetailLocalData.latestUpdatedLineWithEntity });
|
|
494
|
+
const newLocalData = Object.assign(Object.assign({}, transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData), { memo: transactionDetailLocalData.memo, lineItemById: newLineItems, vendorDetails: transactionDetailLocalData.vendorDetails, vendorUpdates: transactionDetailLocalData.vendorUpdates, customerUpdates: transactionDetailLocalData.customerUpdates, customerDetails: transactionDetailLocalData.customerDetails, updatePreviousTransactionsWithUpdatedVendor: transactionDetailLocalData.updatePreviousTransactionsWithUpdatedVendor, isVendorUpdateAllChecked: transactionDetailLocalData.isVendorUpdateAllChecked, latestSelectedEntityOnLineItem: transactionDetailLocalData.latestSelectedEntityOnLineItem, latestUpdatedLineWithEntity: transactionDetailLocalData.latestUpdatedLineWithEntity, selectedEntity: transactionDetailLocalData.selectedEntity });
|
|
442
495
|
return newLocalData;
|
|
443
496
|
};
|
|
444
497
|
exports.toSetAllLineItemsLocalDataIsUpdateAllChecked = toSetAllLineItemsLocalDataIsUpdateAllChecked;
|
|
@@ -560,7 +613,7 @@ const setEntityRecommendationForLineIdInLocalData = (transaction, transactionDet
|
|
|
560
613
|
newLineItems[matchingEntityLineId] = Object.assign(Object.assign({}, newLineItem), { isUpdateAllChecked: true, isCategoryUpdateSelected: matchingRecord.isCategoryUpdateSelected, isClassUpdateSelected: matchingRecord.isClassUpdateSelected, isRecommendedCategorySelected: matchingRecord.isRecommendedCategorySelected, isRecommendedClassSelected: matchingRecord.isRecommendedClassSelected, isRetainedCategorySelected: matchingRecord.isRetainedCategorySelected, isRetainedClassSelected: matchingRecord.isRetainedCategorySelected, class: matchingRecord.class, account: matchingRecord.account, lineEntity: matchingRecord.lineEntity });
|
|
561
614
|
}
|
|
562
615
|
}
|
|
563
|
-
const newLocalData = Object.assign(Object.assign({}, transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData), { memo: transactionDetailLocalData.memo, lineItemById: newLineItems, vendorUpdates: transactionDetailLocalData.vendorUpdates, vendorDetails: transactionDetailLocalData.vendorDetails, updatePreviousTransactionsWithUpdatedVendor: transactionDetailLocalData.updatePreviousTransactionsWithUpdatedVendor, isVendorUpdateAllChecked: transactionDetailLocalData.isVendorUpdateAllChecked, latestSelectedEntityOnLineItem: transactionDetailLocalData.latestSelectedEntityOnLineItem, latestUpdatedLineWithEntity: transactionDetailLocalData.latestUpdatedLineWithEntity, vendorBulkUpdateCategoryClassRecommendationsFetchStatus: transactionDetailLocalData.vendorBulkUpdateCategoryClassRecommendationsFetchStatus });
|
|
616
|
+
const newLocalData = Object.assign(Object.assign({}, transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData), { memo: transactionDetailLocalData.memo, lineItemById: newLineItems, vendorUpdates: transactionDetailLocalData.vendorUpdates, vendorDetails: transactionDetailLocalData.vendorDetails, customerUpdates: transactionDetailLocalData.customerUpdates, customerDetails: transactionDetailLocalData.customerDetails, updatePreviousTransactionsWithUpdatedVendor: transactionDetailLocalData.updatePreviousTransactionsWithUpdatedVendor, isVendorUpdateAllChecked: transactionDetailLocalData.isVendorUpdateAllChecked, latestSelectedEntityOnLineItem: transactionDetailLocalData.latestSelectedEntityOnLineItem, latestUpdatedLineWithEntity: transactionDetailLocalData.latestUpdatedLineWithEntity, vendorBulkUpdateCategoryClassRecommendationsFetchStatus: transactionDetailLocalData.vendorBulkUpdateCategoryClassRecommendationsFetchStatus, selectedEntity: transactionDetailLocalData.selectedEntity });
|
|
564
617
|
return newLocalData;
|
|
565
618
|
};
|
|
566
619
|
exports.setEntityRecommendationForLineIdInLocalData = setEntityRecommendationForLineIdInLocalData;
|
|
@@ -597,7 +650,7 @@ const removeEntityRecommendationForLineIdInLocalData = (transaction, transaction
|
|
|
597
650
|
}
|
|
598
651
|
});
|
|
599
652
|
}
|
|
600
|
-
const newLocalData = Object.assign(Object.assign({}, transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData), { memo: transactionDetailLocalData.memo, lineItemById: newLineItems, vendorDetails: transactionDetailLocalData.vendorDetails, vendorUpdates: transactionDetailLocalData.vendorUpdates, updatePreviousTransactionsWithUpdatedVendor: transactionDetailLocalData.updatePreviousTransactionsWithUpdatedVendor, isVendorUpdateAllChecked: transactionDetailLocalData.isVendorUpdateAllChecked, latestSelectedEntityOnLineItem: transactionDetailLocalData.latestSelectedEntityOnLineItem, latestUpdatedLineWithEntity: transactionDetailLocalData.latestUpdatedLineWithEntity });
|
|
653
|
+
const newLocalData = Object.assign(Object.assign({}, transactionDetailState_1.initialSupportedTransactionDetail.transactionDetailLocalData), { memo: transactionDetailLocalData.memo, lineItemById: newLineItems, vendorDetails: transactionDetailLocalData.vendorDetails, vendorUpdates: transactionDetailLocalData.vendorUpdates, customerUpdates: transactionDetailLocalData.customerUpdates, customerDetails: transactionDetailLocalData.customerDetails, updatePreviousTransactionsWithUpdatedVendor: transactionDetailLocalData.updatePreviousTransactionsWithUpdatedVendor, isVendorUpdateAllChecked: transactionDetailLocalData.isVendorUpdateAllChecked, latestSelectedEntityOnLineItem: transactionDetailLocalData.latestSelectedEntityOnLineItem, latestUpdatedLineWithEntity: transactionDetailLocalData.latestUpdatedLineWithEntity, selectedEntity: transactionDetailLocalData.selectedEntity });
|
|
601
654
|
return newLocalData;
|
|
602
655
|
};
|
|
603
656
|
exports.removeEntityRecommendationForLineIdInLocalData = removeEntityRecommendationForLineIdInLocalData;
|
|
@@ -661,12 +714,12 @@ const toSetAllLineItemsToVendor = (transaction, transactionDetailLocalData, enti
|
|
|
661
714
|
? toVendorBaseFromLineEntity(entity)
|
|
662
715
|
: undefined;
|
|
663
716
|
if (line.type === 'transaction_with_product_or_service_line') {
|
|
664
|
-
const lineRecord = Object.assign(Object.assign({}, transactionDetailLocalData.lineItemById[lineId]), { vendor: record.vendor });
|
|
717
|
+
const lineRecord = Object.assign(Object.assign({}, transactionDetailLocalData.lineItemById[lineId]), { vendor: record.vendor, customer: record.customer });
|
|
665
718
|
record.item = lineRecord.item;
|
|
666
719
|
record.lineDetailType = lineRecord.lineDetailType;
|
|
667
720
|
}
|
|
668
721
|
if (line.type === 'journal_entry_transaction_line') {
|
|
669
|
-
const lineRecord = Object.assign(Object.assign({}, transactionDetailLocalData.lineItemById[lineId]), { vendor: record.vendor });
|
|
722
|
+
const lineRecord = Object.assign(Object.assign({}, transactionDetailLocalData.lineItemById[lineId]), { vendor: record.vendor, customer: record.customer });
|
|
670
723
|
record.lineTransactionType = lineRecord.lineTransactionType;
|
|
671
724
|
record.postingType = lineRecord.postingType;
|
|
672
725
|
record.postingTypeName = lineRecord.postingTypeName;
|
|
@@ -63,17 +63,18 @@ export declare const downloadAccountingProviderAttachment: import("@reduxjs/tool
|
|
|
63
63
|
}, "transactionDetail/saveTransactionDetail">, initializeTransactionDetailLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
64
64
|
transactionId: TransactionID;
|
|
65
65
|
vendorId?: ID;
|
|
66
|
+
customerId?: ID;
|
|
66
67
|
}, "transactionDetail/initializeTransactionDetailLocalData">, saveTransactionDetailLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
67
68
|
transactionId: TransactionID;
|
|
68
69
|
transactionLocalData: TransactionDetailLocalData;
|
|
69
70
|
}, "transactionDetail/saveTransactionDetailLocalData">, clearTransactionDetailLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
70
71
|
transactionId: TransactionID;
|
|
71
|
-
}, "transactionDetail/clearTransactionDetailLocalData">, resetLineItemsCategoryClassInLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, transaction: SupportedTransaction, lineIdsForReplace: string[], lineIdsForUpdateAll: string[], replace: "
|
|
72
|
+
}, "transactionDetail/clearTransactionDetailLocalData">, resetLineItemsCategoryClassInLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, transaction: SupportedTransaction, lineIdsForReplace: string[], lineIdsForUpdateAll: string[], replace: "account" | "class" | "both", updateAll?: boolean | undefined], {
|
|
72
73
|
transactionId: TransactionID;
|
|
73
74
|
transaction: SupportedTransaction;
|
|
74
75
|
lineIdsForReplace: string[];
|
|
75
76
|
lineIdsForUpdateAll: string[];
|
|
76
|
-
replace: "
|
|
77
|
+
replace: "account" | "class" | "both";
|
|
77
78
|
updateAll: boolean | undefined;
|
|
78
79
|
}, "transactionDetail/resetLineItemsCategoryClassInLocalData", never, never>, setAllLineItemsToCategoryClassInLocalData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, transaction: SupportedTransaction, isUpdateAll: boolean, chosenAccount?: {
|
|
79
80
|
account: AccountBase;
|
|
@@ -115,10 +116,18 @@ export declare const downloadAccountingProviderAttachment: import("@reduxjs/tool
|
|
|
115
116
|
}, "transactionDetail/removeEntityRecommendationForLineIdForTransactionDetail", never, never>, updateSelectedVendor: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
116
117
|
transactionId: TransactionID;
|
|
117
118
|
vendorUpdates: TransactionVendorUpdates;
|
|
119
|
+
entity?: Entity;
|
|
118
120
|
resetRecommendations?: boolean;
|
|
119
|
-
}, "transactionDetail/updateSelectedVendor">,
|
|
121
|
+
}, "transactionDetail/updateSelectedVendor">, updateSelectedCustomer: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
120
122
|
transactionId: TransactionID;
|
|
121
|
-
|
|
123
|
+
customerUpdates: TransactionVendorUpdates;
|
|
124
|
+
entity?: Entity;
|
|
125
|
+
resetRecommendations?: boolean;
|
|
126
|
+
}, "transactionDetail/updateSelectedCustomer">, resetVendor: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
127
|
+
transactionId: TransactionID;
|
|
128
|
+
}, "transactionDetail/resetVendor">, resetSelectedCustomer: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
129
|
+
transactionId: TransactionID;
|
|
130
|
+
}, "transactionDetail/resetSelectedCustomer">, updateLocalDataWithTransactionsUpdateWithVendorCheckbox: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
122
131
|
transactionId: TransactionID;
|
|
123
132
|
isUpdateEnabled: boolean;
|
|
124
133
|
}, "transactionDetail/updateLocalDataWithTransactionsUpdateWithVendorCheckbox">, updateVendorToAllLineItems: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[transactionId: TransactionID, transaction: SupportedTransaction, entity: Entity], {
|
|
@@ -4,9 +4,10 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
var _a;
|
|
6
6
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
7
|
-
exports.setIsVendorUpdateAllChecked = exports.updateVendorBulkRecommendationsFetchStatus = exports.updateLatestSelectedEntity = exports.resetAllLineItemsToVendor = exports.updateVendorToAllLineItems = exports.updateLocalDataWithTransactionsUpdateWithVendorCheckbox = exports.resetVendor = exports.updateSelectedVendor = exports.removeEntityRecommendationForLineIdForTransactionDetail = exports.setEntityRecommendationForLineIdsForTransactionDetail = exports.setAllLineItemsLocalDataIsUpdateAllChecked = exports.setAllLineItemsToCategoryClassInLocalData = exports.resetLineItemsCategoryClassInLocalData = exports.clearTransactionDetailLocalData = exports.saveTransactionDetailLocalData = exports.initializeTransactionDetailLocalData = exports.saveTransactionDetail = exports.updateTransactionStateIfUpdateActionNotAllowed = exports.updateStatusConsolidatedSaveTransactionDetail = exports.updateStatusForTransactionNotMiscategorizedUpdate = exports.deleteTransactionAttachmentSuccess = exports.deleteTransactionAttachmentFailure = exports.deleteTransactionAttachment = exports.markTransactionAsNotMiscategorized = exports.clearTransactionDetailSaveStatus = exports.updateTransactionDetailSaveStatus = exports.updateTransactionDetail = exports.uploadMissingAttachmentSuccess = exports.clearTransactionDetail = exports.removeTransactionDetail = exports.updateTransactionDetailFetchState = exports.fetchTransactionDetail = exports.downloadAccountingProviderAttachmentFailure = exports.downloadAccountingProviderAttachmentSuccess = exports.downloadAccountingProviderAttachment = exports.initialState = void 0;
|
|
7
|
+
exports.setIsVendorUpdateAllChecked = exports.updateVendorBulkRecommendationsFetchStatus = exports.updateLatestSelectedEntity = exports.resetAllLineItemsToVendor = exports.updateVendorToAllLineItems = exports.updateLocalDataWithTransactionsUpdateWithVendorCheckbox = exports.resetSelectedCustomer = exports.resetVendor = exports.updateSelectedCustomer = exports.updateSelectedVendor = exports.removeEntityRecommendationForLineIdForTransactionDetail = exports.setEntityRecommendationForLineIdsForTransactionDetail = exports.setAllLineItemsLocalDataIsUpdateAllChecked = exports.setAllLineItemsToCategoryClassInLocalData = exports.resetLineItemsCategoryClassInLocalData = exports.clearTransactionDetailLocalData = exports.saveTransactionDetailLocalData = exports.initializeTransactionDetailLocalData = exports.saveTransactionDetail = exports.updateTransactionStateIfUpdateActionNotAllowed = exports.updateStatusConsolidatedSaveTransactionDetail = exports.updateStatusForTransactionNotMiscategorizedUpdate = exports.deleteTransactionAttachmentSuccess = exports.deleteTransactionAttachmentFailure = exports.deleteTransactionAttachment = exports.markTransactionAsNotMiscategorized = exports.clearTransactionDetailSaveStatus = exports.updateTransactionDetailSaveStatus = exports.updateTransactionDetail = exports.uploadMissingAttachmentSuccess = exports.clearTransactionDetail = exports.removeTransactionDetail = exports.updateTransactionDetailFetchState = exports.fetchTransactionDetail = exports.downloadAccountingProviderAttachmentFailure = exports.downloadAccountingProviderAttachmentSuccess = exports.downloadAccountingProviderAttachment = exports.initialState = void 0;
|
|
8
8
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
9
9
|
const get_1 = __importDefault(require("lodash/get"));
|
|
10
|
+
const entity_1 = require("../../entity/genericEntity/entity");
|
|
10
11
|
const transactionDetailLocalDataHelper_1 = require("./transactionDetailLocalDataHelper");
|
|
11
12
|
const transactionDetailState_1 = require("./transactionDetailState");
|
|
12
13
|
exports.initialState = {
|
|
@@ -337,35 +338,32 @@ const transactionDetail = (0, toolkit_1.createSlice)({
|
|
|
337
338
|
};
|
|
338
339
|
},
|
|
339
340
|
},
|
|
341
|
+
updateSelectedCustomer(draft, action) {
|
|
342
|
+
const key = (0, transactionDetailState_1.getTransactionDetailKey)(action.payload.transactionId);
|
|
343
|
+
const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
|
|
344
|
+
if (detail != null) {
|
|
345
|
+
draft.transactionDetailById[key] = Object.assign(Object.assign({}, detail), { transactionDetailLocalData: getUpdatedEntityLocalData(detail.transactionDetailLocalData, action.payload.customerUpdates, action.payload.entity, action.payload.resetRecommendations, 'customer') });
|
|
346
|
+
}
|
|
347
|
+
},
|
|
348
|
+
resetSelectedCustomer(draft, action) {
|
|
349
|
+
const key = (0, transactionDetailState_1.getTransactionDetailKey)(action.payload.transactionId);
|
|
350
|
+
const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
|
|
351
|
+
if (detail != null) {
|
|
352
|
+
draft.transactionDetailById[key] = Object.assign(Object.assign({}, detail), { transactionDetailLocalData: getResetEntityLocalData(detail.transactionDetailLocalData, 'customer') });
|
|
353
|
+
}
|
|
354
|
+
},
|
|
340
355
|
updateSelectedVendor(draft, action) {
|
|
341
356
|
const key = (0, transactionDetailState_1.getTransactionDetailKey)(action.payload.transactionId);
|
|
342
357
|
const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
|
|
343
358
|
if (detail != null) {
|
|
344
|
-
|
|
345
|
-
name: action.payload.vendorUpdates.name,
|
|
346
|
-
id: action.payload.vendorUpdates.id,
|
|
347
|
-
qboId: action.payload.vendorUpdates.qboId,
|
|
348
|
-
} });
|
|
349
|
-
// on creation success, we have to reset the recommendations
|
|
350
|
-
if (action.payload.resetRecommendations === true) {
|
|
351
|
-
for (const key in transactionDetailLocalData.lineItemById) {
|
|
352
|
-
transactionDetailLocalData.lineItemById[key].recommendedAccount =
|
|
353
|
-
undefined;
|
|
354
|
-
transactionDetailLocalData.lineItemById[key].recommendedClass =
|
|
355
|
-
undefined;
|
|
356
|
-
}
|
|
357
|
-
}
|
|
358
|
-
const transactionDetails = Object.assign(Object.assign({}, detail), { transactionDetailLocalData: transactionDetailLocalData });
|
|
359
|
-
draft.transactionDetailById[key] = transactionDetails;
|
|
359
|
+
draft.transactionDetailById[key] = Object.assign(Object.assign({}, detail), { transactionDetailLocalData: getUpdatedEntityLocalData(detail.transactionDetailLocalData, action.payload.vendorUpdates, action.payload.entity, action.payload.resetRecommendations, 'vendor') });
|
|
360
360
|
}
|
|
361
361
|
},
|
|
362
362
|
resetVendor(draft, action) {
|
|
363
363
|
const key = (0, transactionDetailState_1.getTransactionDetailKey)(action.payload.transactionId);
|
|
364
364
|
const detail = (0, get_1.default)(draft.transactionDetailById, key, undefined);
|
|
365
365
|
if (detail != null) {
|
|
366
|
-
|
|
367
|
-
const transactionDetails = Object.assign(Object.assign({}, detail), { transactionDetailLocalData: transactionDetailLocalData });
|
|
368
|
-
draft.transactionDetailById[key] = transactionDetails;
|
|
366
|
+
draft.transactionDetailById[key] = Object.assign(Object.assign({}, detail), { transactionDetailLocalData: getResetEntityLocalData(detail.transactionDetailLocalData, 'vendor') });
|
|
369
367
|
}
|
|
370
368
|
},
|
|
371
369
|
updateLocalDataWithTransactionsUpdateWithVendorCheckbox(draft, action) {
|
|
@@ -527,5 +525,37 @@ const transactionDetail = (0, toolkit_1.createSlice)({
|
|
|
527
525
|
},
|
|
528
526
|
},
|
|
529
527
|
});
|
|
530
|
-
_a = transactionDetail.actions, exports.downloadAccountingProviderAttachment = _a.downloadAccountingProviderAttachment, exports.downloadAccountingProviderAttachmentSuccess = _a.downloadAccountingProviderAttachmentSuccess, exports.downloadAccountingProviderAttachmentFailure = _a.downloadAccountingProviderAttachmentFailure, exports.fetchTransactionDetail = _a.fetchTransactionDetail, exports.updateTransactionDetailFetchState = _a.updateTransactionDetailFetchState, exports.removeTransactionDetail = _a.removeTransactionDetail, exports.clearTransactionDetail = _a.clearTransactionDetail, exports.uploadMissingAttachmentSuccess = _a.uploadMissingAttachmentSuccess, exports.updateTransactionDetail = _a.updateTransactionDetail, exports.updateTransactionDetailSaveStatus = _a.updateTransactionDetailSaveStatus, exports.clearTransactionDetailSaveStatus = _a.clearTransactionDetailSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.deleteTransactionAttachment = _a.deleteTransactionAttachment, exports.deleteTransactionAttachmentFailure = _a.deleteTransactionAttachmentFailure, exports.deleteTransactionAttachmentSuccess = _a.deleteTransactionAttachmentSuccess, exports.updateStatusForTransactionNotMiscategorizedUpdate = _a.updateStatusForTransactionNotMiscategorizedUpdate, exports.updateStatusConsolidatedSaveTransactionDetail = _a.updateStatusConsolidatedSaveTransactionDetail, exports.updateTransactionStateIfUpdateActionNotAllowed = _a.updateTransactionStateIfUpdateActionNotAllowed, exports.saveTransactionDetail = _a.saveTransactionDetail, exports.initializeTransactionDetailLocalData = _a.initializeTransactionDetailLocalData, exports.saveTransactionDetailLocalData = _a.saveTransactionDetailLocalData, exports.clearTransactionDetailLocalData = _a.clearTransactionDetailLocalData, exports.resetLineItemsCategoryClassInLocalData = _a.resetLineItemsCategoryClassInLocalData, exports.setAllLineItemsToCategoryClassInLocalData = _a.setAllLineItemsToCategoryClassInLocalData, exports.setAllLineItemsLocalDataIsUpdateAllChecked = _a.setAllLineItemsLocalDataIsUpdateAllChecked, exports.setEntityRecommendationForLineIdsForTransactionDetail = _a.setEntityRecommendationForLineIdsForTransactionDetail, exports.removeEntityRecommendationForLineIdForTransactionDetail = _a.removeEntityRecommendationForLineIdForTransactionDetail, exports.updateSelectedVendor = _a.updateSelectedVendor, exports.resetVendor = _a.resetVendor, exports.updateLocalDataWithTransactionsUpdateWithVendorCheckbox = _a.updateLocalDataWithTransactionsUpdateWithVendorCheckbox, exports.updateVendorToAllLineItems = _a.updateVendorToAllLineItems, exports.resetAllLineItemsToVendor = _a.resetAllLineItemsToVendor, exports.updateLatestSelectedEntity = _a.updateLatestSelectedEntity, exports.updateVendorBulkRecommendationsFetchStatus = _a.updateVendorBulkRecommendationsFetchStatus, exports.setIsVendorUpdateAllChecked = _a.setIsVendorUpdateAllChecked;
|
|
528
|
+
_a = transactionDetail.actions, exports.downloadAccountingProviderAttachment = _a.downloadAccountingProviderAttachment, exports.downloadAccountingProviderAttachmentSuccess = _a.downloadAccountingProviderAttachmentSuccess, exports.downloadAccountingProviderAttachmentFailure = _a.downloadAccountingProviderAttachmentFailure, exports.fetchTransactionDetail = _a.fetchTransactionDetail, exports.updateTransactionDetailFetchState = _a.updateTransactionDetailFetchState, exports.removeTransactionDetail = _a.removeTransactionDetail, exports.clearTransactionDetail = _a.clearTransactionDetail, exports.uploadMissingAttachmentSuccess = _a.uploadMissingAttachmentSuccess, exports.updateTransactionDetail = _a.updateTransactionDetail, exports.updateTransactionDetailSaveStatus = _a.updateTransactionDetailSaveStatus, exports.clearTransactionDetailSaveStatus = _a.clearTransactionDetailSaveStatus, exports.markTransactionAsNotMiscategorized = _a.markTransactionAsNotMiscategorized, exports.deleteTransactionAttachment = _a.deleteTransactionAttachment, exports.deleteTransactionAttachmentFailure = _a.deleteTransactionAttachmentFailure, exports.deleteTransactionAttachmentSuccess = _a.deleteTransactionAttachmentSuccess, exports.updateStatusForTransactionNotMiscategorizedUpdate = _a.updateStatusForTransactionNotMiscategorizedUpdate, exports.updateStatusConsolidatedSaveTransactionDetail = _a.updateStatusConsolidatedSaveTransactionDetail, exports.updateTransactionStateIfUpdateActionNotAllowed = _a.updateTransactionStateIfUpdateActionNotAllowed, exports.saveTransactionDetail = _a.saveTransactionDetail, exports.initializeTransactionDetailLocalData = _a.initializeTransactionDetailLocalData, exports.saveTransactionDetailLocalData = _a.saveTransactionDetailLocalData, exports.clearTransactionDetailLocalData = _a.clearTransactionDetailLocalData, exports.resetLineItemsCategoryClassInLocalData = _a.resetLineItemsCategoryClassInLocalData, exports.setAllLineItemsToCategoryClassInLocalData = _a.setAllLineItemsToCategoryClassInLocalData, exports.setAllLineItemsLocalDataIsUpdateAllChecked = _a.setAllLineItemsLocalDataIsUpdateAllChecked, exports.setEntityRecommendationForLineIdsForTransactionDetail = _a.setEntityRecommendationForLineIdsForTransactionDetail, exports.removeEntityRecommendationForLineIdForTransactionDetail = _a.removeEntityRecommendationForLineIdForTransactionDetail, exports.updateSelectedVendor = _a.updateSelectedVendor, exports.updateSelectedCustomer = _a.updateSelectedCustomer, exports.resetVendor = _a.resetVendor, exports.resetSelectedCustomer = _a.resetSelectedCustomer, exports.updateLocalDataWithTransactionsUpdateWithVendorCheckbox = _a.updateLocalDataWithTransactionsUpdateWithVendorCheckbox, exports.updateVendorToAllLineItems = _a.updateVendorToAllLineItems, exports.resetAllLineItemsToVendor = _a.resetAllLineItemsToVendor, exports.updateLatestSelectedEntity = _a.updateLatestSelectedEntity, exports.updateVendorBulkRecommendationsFetchStatus = _a.updateVendorBulkRecommendationsFetchStatus, exports.setIsVendorUpdateAllChecked = _a.setIsVendorUpdateAllChecked;
|
|
531
529
|
exports.default = transactionDetail.reducer;
|
|
530
|
+
function getUpdatedEntityLocalData(detail, updates, entity, resetRecommendations, type) {
|
|
531
|
+
const key = type === 'customer' ? 'customerUpdates' : 'vendorUpdates';
|
|
532
|
+
const transactionDetailLocalData = Object.assign(Object.assign({}, detail), { [key]: {
|
|
533
|
+
name: updates.name,
|
|
534
|
+
id: updates.id,
|
|
535
|
+
qboId: updates.qboId,
|
|
536
|
+
}, selectedEntity: entity });
|
|
537
|
+
if (resetRecommendations === true) {
|
|
538
|
+
for (const key in transactionDetailLocalData.lineItemById) {
|
|
539
|
+
transactionDetailLocalData.lineItemById[key].recommendedAccount =
|
|
540
|
+
undefined;
|
|
541
|
+
transactionDetailLocalData.lineItemById[key].recommendedClass = undefined;
|
|
542
|
+
}
|
|
543
|
+
}
|
|
544
|
+
return transactionDetailLocalData;
|
|
545
|
+
}
|
|
546
|
+
function getResetEntityLocalData(detail, type) {
|
|
547
|
+
const detailsKey = type === 'customer' ? 'customerDetails' : 'vendorDetails';
|
|
548
|
+
const updatesKey = type === 'customer' ? 'customerUpdates' : 'vendorUpdates';
|
|
549
|
+
const details = detail[detailsKey];
|
|
550
|
+
return Object.assign(Object.assign(Object.assign({}, detail), { [updatesKey]: details, selectedEntity: details != null
|
|
551
|
+
? {
|
|
552
|
+
id: details.id,
|
|
553
|
+
name: details.name,
|
|
554
|
+
qboId: details.qboId,
|
|
555
|
+
type: (0, entity_1.toEntityType)(type),
|
|
556
|
+
zeniId: details.id,
|
|
557
|
+
}
|
|
558
|
+
: undefined }), (type === 'vendor' && {
|
|
559
|
+
updatePreviousTransactionsWithUpdatedVendor: false,
|
|
560
|
+
}));
|
|
561
|
+
}
|
|
@@ -8,9 +8,9 @@ import { Transaction, TransactionID } from '../../entity/transaction/stateTypes/
|
|
|
8
8
|
import { VendorBase } from '../../entity/vendor/vendorState';
|
|
9
9
|
import { EntityRecommendationKey } from '../recommendation/recommendationState';
|
|
10
10
|
import { TransactionDetailLocalData } from './transactionDetailTypes';
|
|
11
|
-
export declare const getTransactionDetailKey: (transactionId: TransactionID) => `${string}
|
|
11
|
+
export declare const getTransactionDetailKey: (transactionId: TransactionID) => `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`;
|
|
12
12
|
export type TransactionDetailKey = ReturnType<typeof getTransactionDetailKey>;
|
|
13
|
-
export declare const getZeniTransactionDetailKey: (transactionId: TransactionID) => `${string}
|
|
13
|
+
export declare const getZeniTransactionDetailKey: (transactionId: TransactionID) => `${string}_invoice` | `${string}_payment` | `${string}_credit_memo` | `${string}_sales_receipt` | `${string}_delayed_credit` | `${string}_delayed_charge` | `${string}_refund` | `${string}_expense` | `${string}_check` | `${string}_bill` | `${string}_bill_payment` | `${string}_bill_payment_check` | `${string}_bill_payment_credit_card` | `${string}_vendor_credit` | `${string}_credit_card_credit` | `${string}_transfer` | `${string}_credit_card_payment` | `${string}_deposit` | `${string}_journal_entry`;
|
|
14
14
|
export type ZeniTransactionDetailKey = ReturnType<typeof getTransactionDetailKey>;
|
|
15
15
|
export declare const getThirdPartyIdFromTransactionId: (transactionId: TransactionID) => string;
|
|
16
16
|
/**
|
|
@@ -59,6 +59,7 @@ export interface TransactionUpdates {
|
|
|
59
59
|
memo?: string;
|
|
60
60
|
updatesByLineId: Record<ID, TransactionLineUpdates>;
|
|
61
61
|
vendorId?: ID;
|
|
62
|
+
customerId?: ID;
|
|
62
63
|
}
|
|
63
64
|
export interface EntityRelatedRecommendationUpdates {
|
|
64
65
|
entityId: ID;
|
|
@@ -35,6 +35,7 @@ export interface TransactionDetailLineItemData extends TransactionLineBase {
|
|
|
35
35
|
recommendations?: Recommendation[];
|
|
36
36
|
isCategoryMiscategorized: boolean;
|
|
37
37
|
isClassMiscategorized: boolean;
|
|
38
|
+
selectedEntityLine?: Entity;
|
|
38
39
|
}
|
|
39
40
|
export interface TransactionDetailLocalData {
|
|
40
41
|
memo?: string;
|
|
@@ -44,6 +45,13 @@ export interface TransactionDetailLocalData {
|
|
|
44
45
|
name: string;
|
|
45
46
|
qboId: ID;
|
|
46
47
|
};
|
|
48
|
+
customerDetails?: {
|
|
49
|
+
id: ID;
|
|
50
|
+
name: string;
|
|
51
|
+
qboId: ID;
|
|
52
|
+
};
|
|
53
|
+
selectedEntity?: Entity;
|
|
54
|
+
customerUpdates?: TransactionVendorUpdates;
|
|
47
55
|
vendorUpdates?: TransactionVendorUpdates;
|
|
48
56
|
updatePreviousTransactionsWithUpdatedVendor?: boolean;
|
|
49
57
|
isVendorUpdateAllChecked: boolean;
|
|
@@ -25,7 +25,6 @@ const getTransactionListByEntity = (transactionState, transactionListState, filt
|
|
|
25
25
|
.filter((eTransaction) => eTransaction != null);
|
|
26
26
|
const fetchState = (0, reduceTransactionListFetchState_1.reduceFetchState)(entityTransactions);
|
|
27
27
|
let transactions = [];
|
|
28
|
-
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
29
28
|
if ((0, reduceTransactionListFetchState_1.isAnyFetchCompleted)(entityTransactions)) {
|
|
30
29
|
const allTransactionIDs = (0, flatMap_1.default)(entityTransactions, (value) => value.transactionIDs);
|
|
31
30
|
const transactionsUnsorted = allTransactionIDs
|
|
@@ -75,7 +74,6 @@ const getTransactionListByEntityForSinglePeriod = (state, entity, numberOfQuarte
|
|
|
75
74
|
.filter((eTransaction) => eTransaction != null);
|
|
76
75
|
const fetchState = (0, reduceTransactionListFetchState_1.reduceFetchState)(entityTransactions);
|
|
77
76
|
let transactions = [];
|
|
78
|
-
// eslint-disable-next-line @typescript-eslint/strict-boolean-expressions
|
|
79
77
|
if ((0, reduceTransactionListFetchState_1.isAnyFetchCompleted)(entityTransactions)) {
|
|
80
78
|
const allTransactionIDs = (0, flatMap_1.default)(entityTransactions, (value) => value.transactionIDs);
|
|
81
79
|
const transactionsUnsorted = allTransactionIDs
|
|
@@ -303,9 +303,8 @@ exports.default = transactionList.reducer;
|
|
|
303
303
|
function doUpdateTransactionListByAccount(draft, payload) {
|
|
304
304
|
const transactionIDs = payload.account.transactions.map((transactionPaylod) => transactionPaylod.transaction_id);
|
|
305
305
|
const account = (0, accountPayload_1.mapAccountBasePayloadToAccountBase)(payload.account);
|
|
306
|
-
const start = (0, timePeriod_1.toAbsoluteDay)(payload.query.start_date);
|
|
307
|
-
const end = (0, timePeriod_1.toAbsoluteDay)(payload.query.end_date);
|
|
308
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
306
|
+
const start = (0, timePeriod_1.toAbsoluteDay)(payload.query.start_date);
|
|
307
|
+
const end = (0, timePeriod_1.toAbsoluteDay)(payload.query.end_date);
|
|
309
308
|
const key = (0, transactionListState_1.getAcTranKey)(account.accountId, account.accountType, {
|
|
310
309
|
start,
|
|
311
310
|
end,
|
|
@@ -325,9 +324,8 @@ function doUpdateTransactionListByClass(draft, payload) {
|
|
|
325
324
|
const transactionIDs = payload.account.transactions.map((transactionPaylod) => transactionPaylod.transaction_id);
|
|
326
325
|
const account = (0, accountPayload_1.mapAccountBasePayloadToAccountBase)(payload.account);
|
|
327
326
|
const classId = payload.query.accounting_class_id;
|
|
328
|
-
const start = (0, timePeriod_1.toAbsoluteDay)(payload.query.start_date);
|
|
329
|
-
const end = (0, timePeriod_1.toAbsoluteDay)(payload.query.end_date);
|
|
330
|
-
// eslint-disable-next-line @typescript-eslint/no-non-null-assertion
|
|
327
|
+
const start = (0, timePeriod_1.toAbsoluteDay)(payload.query.start_date);
|
|
328
|
+
const end = (0, timePeriod_1.toAbsoluteDay)(payload.query.end_date);
|
|
331
329
|
const key = (0, transactionListState_1.getClassAcTranKey)(account.accountId, account.accountType, classId, {
|
|
332
330
|
start,
|
|
333
331
|
end,
|
|
@@ -11,9 +11,7 @@ const userFinancialAccount = (0, toolkit_1.createSlice)({
|
|
|
11
11
|
initialState: exports.initialState,
|
|
12
12
|
reducers: {
|
|
13
13
|
fetchUserFinancialAccount: {
|
|
14
|
-
reducer(draft,
|
|
15
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
16
|
-
action) {
|
|
14
|
+
reducer(draft, action) {
|
|
17
15
|
const { userId } = action.payload;
|
|
18
16
|
draft.financialAccountByUserId[userId] = {
|
|
19
17
|
hasValidState() {
|