@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.
Files changed (191) hide show
  1. package/lib/commonPayloadTypes/recommendationPayload.d.ts +1 -0
  2. package/lib/commonStateTypes/timePeriod.d.ts +1 -1
  3. package/lib/commonStateTypes/timePeriod.js +2 -2
  4. package/lib/commonStateTypes/viewAndReport/agingReportStateTypes.js +1 -1
  5. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  6. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
  7. package/lib/configureStore.js +2 -1
  8. package/lib/entity/account/accountState.d.ts +1 -1
  9. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  10. package/lib/entity/accountRecon/accountReconPayload.d.ts +70 -0
  11. package/lib/entity/accountRecon/accountReconPayload.js +125 -0
  12. package/lib/entity/accountRecon/accountReconReducer.d.ts +16 -0
  13. package/lib/entity/accountRecon/accountReconReducer.js +71 -0
  14. package/lib/entity/accountRecon/accountReconSelector.d.ts +28 -0
  15. package/lib/entity/accountRecon/accountReconSelector.js +44 -0
  16. package/lib/entity/accountRecon/accountReconState.d.ts +70 -0
  17. package/lib/entity/accountRecon/accountReconState.js +28 -0
  18. package/lib/entity/class/classReducer.d.ts +4 -4
  19. package/lib/entity/class/classState.d.ts +1 -1
  20. package/lib/entity/company/companyReducer.js +0 -1
  21. package/lib/entity/customer/customerPayload.d.ts +1 -1
  22. package/lib/entity/customer/customerPayload.js +16 -6
  23. package/lib/entity/forecast/forecastState.d.ts +1 -1
  24. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  25. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  26. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  27. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  28. package/lib/entity/snackbar/snackbarTypes.js +4 -0
  29. package/lib/entity/task/taskState.d.ts +1 -1
  30. package/lib/entity/tenant/clearAllEpic.d.ts +4 -2
  31. package/lib/entity/tenant/clearAllEpic.js +4 -0
  32. package/lib/entity/tenant/tenantReducer.js +0 -1
  33. package/lib/entity/transaction/payloadTypes/customerTransactionPayload.d.ts +1 -1
  34. package/lib/entity/transaction/payloadTypes/customerTransactionPayload.js +1 -2
  35. package/lib/entity/transaction/payloadTypes/reconciliationTransactionPayloads.d.ts +35 -0
  36. package/lib/entity/transaction/payloadTypes/reconciliationTransactionPayloads.js +53 -0
  37. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +2 -0
  38. package/lib/entity/transaction/payloadTypes/transactionPayload.js +9 -6
  39. package/lib/entity/transaction/payloadTypes/vendorTransactionPayload.d.ts +9 -1
  40. package/lib/entity/transaction/payloadTypes/vendorTransactionPayload.js +23 -2
  41. package/lib/entity/transaction/stateTypes/reconciliationTransaction.d.ts +32 -0
  42. package/lib/entity/transaction/stateTypes/reconciliationTransaction.js +10 -0
  43. package/lib/entity/transaction/stateTypes/transaction.d.ts +3 -1
  44. package/lib/entity/transaction/stateTypes/transactionType.d.ts +1 -1
  45. package/lib/entity/transaction/stateTypes/transactionType.js +1 -1
  46. package/lib/entity/transaction/stateTypes/vendorTransaction.d.ts +5 -0
  47. package/lib/entity/transaction/stateTypes/vendorTransaction.js +5 -1
  48. package/lib/entity/transaction/toSupportedTransaction.js +6 -1
  49. package/lib/entity/transaction/transactionReducer.d.ts +17 -0
  50. package/lib/entity/transaction/transactionReducer.js +47 -2
  51. package/lib/entity/transaction/transactionSelector.d.ts +2 -0
  52. package/lib/entity/transaction/transactionSelector.js +5 -0
  53. package/lib/entity/transaction/transactionState.d.ts +6 -4
  54. package/lib/entity/vendorExpense/vendorExpenseReducer.js +0 -1
  55. package/lib/entity/vendorExpense/vendorExpenseSelector.d.ts +2 -2
  56. package/lib/epic.d.ts +6 -1
  57. package/lib/epic.js +6 -1
  58. package/lib/index.d.ts +22 -13
  59. package/lib/index.js +56 -27
  60. package/lib/init.d.ts +2 -1
  61. package/lib/init.js +9 -2
  62. package/lib/reducer.d.ts +7 -1
  63. package/lib/reducer.js +6 -0
  64. package/lib/view/accountList/accountListReducer.js +1 -3
  65. package/lib/view/accountMappingView/accountMappingReducer.js +0 -1
  66. package/lib/view/apAgingView/apAgingDetail/apAgingDetailReducer.js +1 -2
  67. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  68. package/lib/view/balanceSheet/balanceSheetReducer.js +1 -6
  69. package/lib/view/bankAccountView/bankAccountViewReducer.js +0 -1
  70. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  71. package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
  72. package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
  73. package/lib/view/cashFlow/cashFlowReducer.js +1 -4
  74. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  75. package/lib/view/cashPosition/cashPositionReducer.js +0 -1
  76. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  77. package/lib/view/commonVendorView/vendorView/epics/fetchAndUpdateVendorRecommendationsEpic.js +1 -3
  78. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewReducer.d.ts +2 -2
  79. package/lib/view/companyView/companyViewReducer.js +1 -10
  80. package/lib/view/dashboard/dashboardEpic.js +0 -2
  81. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  82. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.d.ts +15 -0
  83. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +118 -0
  84. package/lib/view/expenseAutomationView/epics/accountRecon/initialiseLocalDataForSelectedAccountIdEpic.d.ts +10 -0
  85. package/lib/view/expenseAutomationView/epics/accountRecon/initialiseLocalDataForSelectedAccountIdEpic.js +49 -0
  86. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationDetailEpic.d.ts +14 -0
  87. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationDetailEpic.js +169 -0
  88. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.d.ts +9 -0
  89. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +154 -0
  90. package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.d.ts +6 -0
  91. package/lib/view/expenseAutomationView/epics/accountRecon/updateReconcileTabLocalDataEpic.js +110 -0
  92. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +2 -1
  93. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +24 -10
  94. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +2 -1
  95. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +14 -0
  96. package/lib/view/expenseAutomationView/epics/transactionCategorization/updateTransactionCategorizationEpic.js +32 -5
  97. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.d.ts +2 -2
  98. package/lib/view/expenseAutomationView/expenseAutomationViewReducer.js +1 -5
  99. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +17 -2
  100. package/lib/view/expenseAutomationView/expenseAutomationViewState.d.ts +2 -2
  101. package/lib/view/expenseAutomationView/expenseAutomationViewState.js +1 -1
  102. package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.d.ts +7 -0
  103. package/lib/view/expenseAutomationView/helpers/reconciliationHelpers.js +18 -0
  104. package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +111 -35
  105. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  106. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +84 -10
  107. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +28 -0
  108. package/lib/view/expenseAutomationView/payload/reconciliationPayload.js +51 -0
  109. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +66 -0
  110. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +384 -0
  111. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +12 -1
  112. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +66 -7
  113. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +2 -0
  114. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.js +1 -1
  115. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +51 -0
  116. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +7 -0
  117. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.d.ts +5 -0
  118. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +250 -0
  119. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +103 -0
  120. package/lib/view/expenseAutomationView/types/reconciliationViewState.js +38 -0
  121. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +10 -0
  122. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  123. package/lib/view/financeStatement/financeStatementReducer.js +1 -4
  124. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  125. package/lib/view/netBurnOrIncome/netBurnOrIncomeReducer.js +3 -10
  126. package/lib/view/netBurnOrIncomeClassesView/netBurnOrIncomeClassesViewReducer.js +1 -6
  127. package/lib/view/netBurnOrIncomeStoryCard/netBurnOrIncomeStoryCardReducer.js +0 -1
  128. package/lib/view/onboardingView/cockpitView/onboardingCockpitViewReducer.js +0 -3
  129. package/lib/view/opEx/opExForTimeFrameEpic.js +1 -1
  130. package/lib/view/opEx/opExReducer.js +4 -14
  131. package/lib/view/opExByVendor/opExByVendorReducer.js +1 -3
  132. package/lib/view/opExClassesView/opExClassesViewReducer.js +1 -6
  133. package/lib/view/people/fetchPeopleEpic.js +1 -3
  134. package/lib/view/people/invitePeopleEpic.js +1 -3
  135. package/lib/view/people/inviteZeniPeopleEpic.js +1 -3
  136. package/lib/view/people/peopleReducer.js +0 -1
  137. package/lib/view/people/peopleSaveUpdatesEpic.js +1 -1
  138. package/lib/view/profitAndLoss/profitAndLossReducer.js +1 -6
  139. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +1 -6
  140. package/lib/view/recommendation/recommendationReducer.js +1 -4
  141. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  142. package/lib/view/reportUIOptions/updateReportUIOptionThisPeriodEpic.js +1 -3
  143. package/lib/view/revenue/revenueReducer.js +3 -10
  144. package/lib/view/revenueClassesView/revenueClassesViewReducer.js +1 -6
  145. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  146. package/lib/view/settingsView/settingsViewReducer.js +0 -1
  147. package/lib/view/spendManagement/billPay/billList/billListReducer.js +0 -1
  148. package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigPayload.d.ts +5 -1
  149. package/lib/view/spendManagement/billPay/billPayConfig/billPayConfigState.js +0 -6
  150. package/lib/view/spendManagement/billPay/billsBulkActionView/epics/validateBillsBulkActionEpic.ts.js +4 -3
  151. package/lib/view/spendManagement/billPay/editBillView/epics/fetchBillAndInitializeLocalStoreEpic.js +1 -3
  152. package/lib/view/spendManagement/billPay/editBillView/epics/saveBillDetailEpic.d.ts +2 -1
  153. package/lib/view/spendManagement/plaidAccount/epic/plaidConnection/establishPlaidConnectionEpic.js +11 -3
  154. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.d.ts +2 -1
  155. package/lib/view/spendManagement/plaidAccount/plaidAccountViewReducer.js +3 -1
  156. package/lib/view/spendManagement/plaidAccount/plaidAccountViewState.d.ts +1 -1
  157. package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchRecommendationsAndUpdateMerchantRecommendationsEpic.js +2 -6
  158. package/lib/view/spendManagement/reimbursement/editRemiView/epics/fetchRemiAndInitializeLocalStoreEpic.js +1 -3
  159. package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.js +0 -1
  160. package/lib/view/spendManagement/zeniAccounts/expressPay/epics/fetchExpressPayInitialDetailsEpic.d.ts +2 -2
  161. package/lib/view/spendManagement/zeniAccounts/expressPay/epics/fetchExpressPayInitialDetailsEpic.js +7 -7
  162. package/lib/view/spendManagement/zeniAccounts/expressPay/expressPaySelector.d.ts +2 -2
  163. package/lib/view/spendManagement/zeniAccounts/expressPay/expressPaySelector.js +5 -4
  164. package/lib/view/spendManagement/zeniAccounts/expressPay/expressPayState.d.ts +2 -2
  165. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigPayload.d.ts +14 -0
  166. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigPayload.js +78 -1
  167. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigReducer.js +3 -1
  168. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigSelector.d.ts +2 -1
  169. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigSelector.js +2 -1
  170. package/lib/view/spendManagement/zeniAccounts/zeniAccountsConfig/zeniAccountsConfigState.d.ts +9 -0
  171. package/lib/view/subscriptionView/subscriptionViewReducer.js +0 -1
  172. package/lib/view/subscriptionView/types/subscriptionTypes.js +0 -1
  173. package/lib/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +1 -3
  174. package/lib/view/tasksCard/fetchTasksCardEpic.js +1 -2
  175. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  176. package/lib/view/tasksCard/tasksCardSelector.js +1 -1
  177. package/lib/view/topEx/topExSelector.d.ts +1 -1
  178. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +45 -15
  179. package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +22 -4
  180. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +69 -13
  181. package/lib/view/transactionDetail/transactionDetailReducer.d.ts +11 -2
  182. package/lib/view/transactionDetail/transactionDetailReducer.js +51 -21
  183. package/lib/view/transactionDetail/transactionDetailState.d.ts +1 -0
  184. package/lib/view/transactionDetail/transactionDetailTypes.d.ts +8 -0
  185. package/lib/view/transactionList/transactionListByEntitySelector.js +0 -2
  186. package/lib/view/transactionList/transactionListReducer.js +4 -6
  187. package/lib/view/trendWithTransactions/trendWithTransactionsReducer.js +0 -1
  188. package/lib/view/userFinancialAccount/userFinancialAccountReducer.js +1 -3
  189. package/lib/view/vendorReviewView/vendorGlobalReviewView/vendorGlobalReviewViewState.d.ts +1 -1
  190. package/lib/zeniAPI.d.ts +1 -0
  191. package/package.json +9 -3
@@ -25,7 +25,7 @@ const recommendationState_1 = require("../../recommendation/recommendationState"
25
25
  * additionally fire “Mark as not miscat” for every point above.
26
26
  */
27
27
  const toTransactionUpdatesFromTransactionDetailLocalData = (transactionDetailLocalData, transaction, isExpenseAutomationEnabled) => {
28
- var _a, _b, _c;
28
+ var _a, _b;
29
29
  const updates = {
30
30
  updatesByLineId: {},
31
31
  };
@@ -33,21 +33,29 @@ const toTransactionUpdatesFromTransactionDetailLocalData = (transactionDetailLoc
33
33
  const entityUpdates = {};
34
34
  const isTransactionMisCategorized = (0, exports.isTransactionMiscategorized)(transaction, isExpenseAutomationEnabled);
35
35
  updates.memo = transactionDetailLocalData.memo;
36
+ const selectedEntity = transactionDetailLocalData.selectedEntity;
36
37
  const updatedEntityId = transactionDetailLocalData.updatePreviousTransactionsWithUpdatedVendor ===
37
38
  true
38
39
  ? (_a = transactionDetailLocalData.vendorUpdates) === null || _a === void 0 ? void 0 : _a.qboId
39
40
  : undefined;
40
- if ((0, vendorTransaction_1.isVendorTransaction)(transaction)) {
41
- updates.vendorId = (_b = transactionDetailLocalData.vendorUpdates) === null || _b === void 0 ? void 0 : _b.id;
41
+ if ((0, vendorTransaction_1.isVendorTransaction)(transaction) &&
42
+ selectedEntity != null &&
43
+ selectedEntity.type === 'vendor') {
44
+ updates.vendorId = selectedEntity.id;
45
+ }
46
+ if ((0, vendorTransaction_1.isVendorTransaction)(transaction) &&
47
+ selectedEntity != null &&
48
+ selectedEntity.type === 'customer') {
49
+ updates.customerId = selectedEntity.id;
42
50
  }
43
51
  let isBulkUpdate = false;
44
- const entity = getEntityFromTransaction(transaction);
52
+ const entity = getEntityFromTransaction(transaction, selectedEntity);
45
53
  let lastUpdatedCategory;
46
54
  let lastUpdatedClass;
47
55
  // single recommendation to just pick the last recommendation in the list of lines
48
- (_c = transaction.lines) === null || _c === void 0 ? void 0 : _c.forEach((line) => {
56
+ (_b = transaction.lines) === null || _b === void 0 ? void 0 : _b.forEach((line) => {
49
57
  var _a, _b, _c, _d, _e, _f;
50
- const entityDetails = getEntityDetails(entity, transactionDetailLocalData.lineItemById[line.id], transactionDetailLocalData.vendorUpdates);
58
+ const entityDetails = getEntityDetails(entity, transactionDetailLocalData.lineItemById[line.id], transactionDetailLocalData.vendorUpdates, transactionDetailLocalData.customerUpdates);
51
59
  if (line.type === 'transaction_with_account_and_class_line' ||
52
60
  line.type === 'transaction_with_product_or_service_line' ||
53
61
  line.type === 'journal_entry_transaction_line') {
@@ -201,17 +209,31 @@ const getVendorOrCustomerDetails = (lineItem) => {
201
209
  }
202
210
  return {};
203
211
  };
204
- const getEntityFromTransaction = (transaction) => {
212
+ const getEntityFromTransaction = (transaction, currentSelectedEntity) => {
205
213
  let entity = undefined;
206
214
  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,
215
+ const vendor = transaction.vendor;
216
+ const customer = transaction.customer;
217
+ if (customer != null &&
218
+ currentSelectedEntity != null &&
219
+ currentSelectedEntity.type === 'customer') {
220
+ return {
221
+ id: customer.id,
222
+ name: customer.name,
223
+ type: (0, entity_1.toEntityType)('customer'),
224
+ qboId: customer.id,
225
+ zeniId: customer.id,
226
+ };
227
+ }
228
+ if (vendor != null &&
229
+ currentSelectedEntity != null &&
230
+ currentSelectedEntity.type === 'vendor') {
231
+ return {
232
+ id: vendor.id,
233
+ name: vendor.name,
212
234
  type: (0, entity_1.toEntityType)('vendor'),
213
- qboId: vendorEntity.id,
214
- zeniId: vendorEntity.id,
235
+ qboId: vendor.id,
236
+ zeniId: vendor.id,
215
237
  };
216
238
  }
217
239
  }
@@ -229,7 +251,7 @@ const getEntityFromTransaction = (transaction) => {
229
251
  }
230
252
  return entity;
231
253
  };
232
- const getEntityDetails = (entity, lineItemLocalData, vendorUpdates) => {
254
+ const getEntityDetails = (entity, lineItemLocalData, vendorUpdates, customerUpdates) => {
233
255
  var _a, _b, _c, _d;
234
256
  if (entity != null) {
235
257
  return {
@@ -243,6 +265,14 @@ const getEntityDetails = (entity, lineItemLocalData, vendorUpdates) => {
243
265
  entityType: lineItemLocalData.vendor != null ? 'vendor' : 'customer',
244
266
  };
245
267
  }
268
+ if (customerUpdates != null &&
269
+ Boolean(customerUpdates.id) === true &&
270
+ customerUpdates.id != null) {
271
+ return {
272
+ entityId: customerUpdates.id,
273
+ entityType: 'customer',
274
+ };
275
+ }
246
276
  if (vendorUpdates != null && vendorUpdates.id != null) {
247
277
  return {
248
278
  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);
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) => {
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
- return (0, vendorTransactionPayload_1.toVendorTransactionPayload)(transaction, vendorUpdates);
213
+ if ((0, vendorTransaction_1.isVendorTransactionWithCustomer)(transaction)) {
214
+ return (0, vendorTransactionPayload_1.toVendorTransactionWithCustomerPayload)(transaction, vendorUpdates, 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: (_b = (_a = transaction.vendor) === null || _a === void 0 ? void 0 : _a.name) !== null && _b !== void 0 ? _b : '',
17
- qboId: (_c = transaction.vendor) === null || _c === void 0 ? void 0 : _c.id,
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) && vendorId != null
59
+ (0, vendorTransaction_1.isVendorTransaction)(transaction) &&
60
+ vendorId != null &&
61
+ vendorName != null &&
62
+ Boolean(vendorName) === true
22
63
  ? {
23
64
  id: vendorId,
24
- qboId: (_e = (_d = transaction.vendor) === null || _d === void 0 ? void 0 : _d.id) !== null && _e !== void 0 ? _e : '',
25
- name: (_g = (_f = transaction.vendor) === null || _f === void 0 ? void 0 : _f.name) !== null && _g !== void 0 ? _g : '',
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;
@@ -400,6 +453,7 @@ const toSetAllLineItemsToCategoryClass = (transaction, transactionDetailLocalDat
400
453
  record.postingType = lineRecord.postingType;
401
454
  record.postingTypeName = lineRecord.postingTypeName;
402
455
  record.lineEntity = (0, exports.toLineEntity)(lineRecord);
456
+ record.selectedEntityLine = (0, exports.toLineEntity)(lineRecord);
403
457
  }
404
458
  newLineItems[lineId] = record;
405
459
  }
@@ -412,7 +466,7 @@ const toSetAllLineItemsToCategoryClass = (transaction, transactionDetailLocalDat
412
466
  }
413
467
  });
414
468
  }
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 });
469
+ 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
470
  return newLocalData;
417
471
  };
418
472
  exports.toSetAllLineItemsToCategoryClass = toSetAllLineItemsToCategoryClass;
@@ -438,7 +492,7 @@ const toSetAllLineItemsLocalDataIsUpdateAllChecked = (transaction, transactionDe
438
492
  }
439
493
  });
440
494
  }
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 });
495
+ 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
496
  return newLocalData;
443
497
  };
444
498
  exports.toSetAllLineItemsLocalDataIsUpdateAllChecked = toSetAllLineItemsLocalDataIsUpdateAllChecked;
@@ -466,8 +520,10 @@ const setEntityRecommendationForLineIdInLocalData = (transaction, transactionDet
466
520
  if (checkIfNotJEAndDeposit === true) {
467
521
  record.customer = accountLine.customer;
468
522
  record.vendor = accountLine.vendor;
523
+ record.selectedEntityLine = entity;
469
524
  }
470
525
  else {
526
+ record.selectedEntityLine = entity;
471
527
  record.lineEntity = entity;
472
528
  record.vendor = undefined;
473
529
  record.customer = undefined;
@@ -560,7 +616,7 @@ const setEntityRecommendationForLineIdInLocalData = (transaction, transactionDet
560
616
  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
617
  }
562
618
  }
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 });
619
+ 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
620
  return newLocalData;
565
621
  };
566
622
  exports.setEntityRecommendationForLineIdInLocalData = setEntityRecommendationForLineIdInLocalData;
@@ -597,7 +653,7 @@ const removeEntityRecommendationForLineIdInLocalData = (transaction, transaction
597
653
  }
598
654
  });
599
655
  }
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 });
656
+ 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 });
601
657
  return newLocalData;
602
658
  };
603
659
  exports.removeEntityRecommendationForLineIdInLocalData = removeEntityRecommendationForLineIdInLocalData;
@@ -661,12 +717,12 @@ const toSetAllLineItemsToVendor = (transaction, transactionDetailLocalData, enti
661
717
  ? toVendorBaseFromLineEntity(entity)
662
718
  : undefined;
663
719
  if (line.type === 'transaction_with_product_or_service_line') {
664
- const lineRecord = Object.assign(Object.assign({}, transactionDetailLocalData.lineItemById[lineId]), { vendor: record.vendor });
720
+ const lineRecord = Object.assign(Object.assign({}, transactionDetailLocalData.lineItemById[lineId]), { vendor: record.vendor, customer: record.customer });
665
721
  record.item = lineRecord.item;
666
722
  record.lineDetailType = lineRecord.lineDetailType;
667
723
  }
668
724
  if (line.type === 'journal_entry_transaction_line') {
669
- const lineRecord = Object.assign(Object.assign({}, transactionDetailLocalData.lineItemById[lineId]), { vendor: record.vendor });
725
+ const lineRecord = Object.assign(Object.assign({}, transactionDetailLocalData.lineItemById[lineId]), { vendor: record.vendor, customer: record.customer });
670
726
  record.lineTransactionType = lineRecord.lineTransactionType;
671
727
  record.postingType = lineRecord.postingType;
672
728
  record.postingTypeName = lineRecord.postingTypeName;
@@ -63,6 +63,7 @@ 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;
@@ -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">, resetVendor: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
121
+ }, "transactionDetail/updateSelectedVendor">, updateSelectedCustomer: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
120
122
  transactionId: TransactionID;
121
- }, "transactionDetail/resetVendor">, updateLocalDataWithTransactionsUpdateWithVendorCheckbox: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
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
- const transactionDetailLocalData = Object.assign(Object.assign({}, detail.transactionDetailLocalData), { vendorUpdates: {
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
- const transactionDetailLocalData = Object.assign(Object.assign({}, detail.transactionDetailLocalData), { vendorUpdates: detail.transactionDetailLocalData.vendorDetails, updatePreviousTransactionsWithUpdatedVendor: false });
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
+ }
@@ -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); // eslint-disable-line @typescript-eslint/no-non-null-assertion
307
- const end = (0, timePeriod_1.toAbsoluteDay)(payload.query.end_date); // eslint-disable-line @typescript-eslint/no-non-null-assertion
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); // eslint-disable-line @typescript-eslint/no-non-null-assertion
329
- const end = (0, timePeriod_1.toAbsoluteDay)(payload.query.end_date); // eslint-disable-line @typescript-eslint/no-non-null-assertion
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,
@@ -48,7 +48,6 @@ const trendWithTransactions = (0, toolkit_1.createSlice)({
48
48
  },
49
49
  },
50
50
  clearTrendWithTransactions: {
51
- // eslint-disable-next-line @typescript-eslint/no-inferrable-types
52
51
  prepare(keepUiState = true) {
53
52
  return { payload: { keepUiState } };
54
53
  },
@@ -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() {
@@ -3,7 +3,7 @@ import { SortOrder } from '../../../commonStateTypes/selectorTypes/sortOrderType
3
3
  import { PageToken } from '../../../commonStateTypes/viewAndReport/viewAndReport';
4
4
  import { GlobalVendorReviewRowCurrentSelection } from '../common/state/commonTypes';
5
5
  import { RecommendedNonExistingGlobalMerchant } from '../vendorFirstReviewView/vendorFirstReviewViewState';
6
- export declare const toVendorGlobalReviewColumnSortKeyType: (v: string) => "tenants" | "originalVendor" | "recommended" | "requestedVendor";
6
+ export declare const toVendorGlobalReviewColumnSortKeyType: (v: string) => "tenants" | "recommended" | "originalVendor" | "requestedVendor";
7
7
  export type VendorGlobalReviewViewColumnSortKey = ReturnType<typeof toVendorGlobalReviewColumnSortKeyType>;
8
8
  export interface GlobalReviewPageCurrentSelectionByColumn {
9
9
  requested: boolean;
package/lib/zeniAPI.d.ts CHANGED
@@ -18,6 +18,7 @@ export interface RESTAPIEndpoints {
18
18
  readonly cardMicroServiceBaseUrl: string;
19
19
  readonly taskMicroServiceBaseUrl: string;
20
20
  readonly notificationMicroServiceBaseUrl: string;
21
+ readonly reconciliationMicroServiceBaseUrl: string;
21
22
  }
22
23
  export interface ZeniAPI<ResponseType = FetchResponse> {
23
24
  readonly apiEndPoints: RESTAPIEndpoints;