@zeniai/client-epic-state 4.20.8 → 4.20.9-betaAK1

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 (229) hide show
  1. package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.d.ts +19 -0
  2. package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.js +2 -0
  3. package/lib/commonStateTypes/animations.d.ts +1 -1
  4. package/lib/commonStateTypes/animations.js +3 -0
  5. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  6. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
  7. package/lib/entity/account/accountPayload.d.ts +2 -0
  8. package/lib/entity/account/accountReducer.d.ts +5 -2
  9. package/lib/entity/account/accountReducer.js +7 -2
  10. package/lib/entity/account/accountState.d.ts +1 -1
  11. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  12. package/lib/entity/accountRecon/accountReconPayload.d.ts +1 -1
  13. package/lib/entity/accountRecon/accountReconPayload.js +4 -2
  14. package/lib/entity/aiCfo/aiCfoSelector.d.ts +1 -2
  15. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
  16. package/lib/entity/class/classReducer.d.ts +4 -4
  17. package/lib/entity/class/classState.d.ts +1 -1
  18. package/lib/entity/forecast/forecastState.d.ts +1 -1
  19. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +38 -0
  20. package/lib/entity/jeSchedules/jeSchedulesPayload.js +78 -0
  21. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +4 -1
  22. package/lib/entity/jeSchedules/jeSchedulesSelector.js +5 -1
  23. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +37 -0
  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 +6 -0
  29. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  30. package/lib/entity/tenant/tenantReducer.d.ts +5 -2
  31. package/lib/entity/tenant/tenantReducer.js +9 -2
  32. package/lib/entity/tenant/tenantSelector.d.ts +1 -0
  33. package/lib/entity/tenant/tenantSelector.js +9 -1
  34. package/lib/entity/tenant/tenantState.d.ts +1 -0
  35. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +4 -1
  36. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
  37. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +9 -0
  38. package/lib/entity/transaction/payloadTypes/transactionPayload.js +79 -1
  39. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +1 -0
  40. package/lib/entity/transaction/stateTypes/transaction.d.ts +11 -0
  41. package/lib/entity/transaction/stateTypes/transactionLine.d.ts +1 -1
  42. package/lib/epic.d.ts +11 -1
  43. package/lib/epic.js +11 -1
  44. package/lib/esm/common/aiCfo/aiCfoSuggestedQuestionsPageContext.js +1 -0
  45. package/lib/esm/commonStateTypes/animations.js +3 -0
  46. package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
  47. package/lib/esm/entity/account/accountReducer.js +6 -1
  48. package/lib/esm/entity/accountRecon/accountReconPayload.js +4 -2
  49. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +78 -0
  50. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +5 -1
  51. package/lib/esm/entity/snackbar/snackbarTypes.js +6 -0
  52. package/lib/esm/entity/tenant/tenantReducer.js +8 -1
  53. package/lib/esm/entity/tenant/tenantSelector.js +7 -0
  54. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
  55. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +79 -1
  56. package/lib/esm/epic.js +11 -1
  57. package/lib/esm/index.js +14 -11
  58. package/lib/esm/reducer.js +3 -0
  59. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +82 -1
  60. package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +8 -2
  61. package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +29 -0
  62. package/lib/esm/view/classList/fetchClassListEpic.js +9 -2
  63. package/lib/esm/view/commonVendorView/vendorView/vendorViewSelector.js +18 -5
  64. package/lib/esm/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
  65. package/lib/esm/view/companyView/companyViewReducer.js +26 -1
  66. package/lib/esm/view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic.js +61 -0
  67. package/lib/esm/view/companyView/types/companyPassport/companyPassportViewState.js +4 -0
  68. package/lib/esm/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js +44 -0
  69. package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +4 -9
  70. package/lib/esm/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.js +44 -0
  71. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
  72. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +2 -2
  73. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +2 -1
  74. package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +0 -1
  75. package/lib/esm/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  76. package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  77. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +21 -1
  78. package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +167 -3
  79. package/lib/esm/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +1 -2
  80. package/lib/esm/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +10 -2
  81. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +63 -6
  82. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +13 -4
  83. package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +136 -9
  84. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +15 -5
  85. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +24 -1
  86. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +3 -0
  87. package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesPayload.js +26 -0
  88. package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesReducer.js +199 -0
  89. package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +52 -0
  90. package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesState.js +1 -0
  91. package/lib/esm/view/spendManagement/autotransferRules/epics/createAutoTransferRuleEpic.js +100 -0
  92. package/lib/esm/view/spendManagement/autotransferRules/epics/deleteAutoTransferRuleEpic.js +48 -0
  93. package/lib/esm/view/spendManagement/autotransferRules/epics/fetchAutoTransferReviewDetailEpic.js +36 -0
  94. package/lib/esm/view/spendManagement/autotransferRules/epics/fetchAutoTransferRuleHistory.js +45 -0
  95. package/lib/esm/view/spendManagement/autotransferRules/epics/fetchAutoTransferRulesEpic.js +50 -0
  96. package/lib/esm/view/spendManagement/autotransferRules/epics/updateAutoTransferRuleEpic.js +69 -0
  97. package/lib/esm/view/spendManagement/billPay/billList/billListSelector.js +10 -0
  98. package/lib/esm/view/spendManagement/billPay/billList/billListState.js +1 -0
  99. package/lib/esm/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +7 -3
  100. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  101. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
  102. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
  103. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
  104. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
  105. package/lib/esm/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +7 -4
  106. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
  107. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
  108. package/lib/esm/view/spendManagement/treasury/treasuryList/epics/fetchTreasuryDetailEpic.js +2 -2
  109. package/lib/esm/view/spendManagement/treasury/treasuryList/treasuryDetailReducer.js +2 -1
  110. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
  111. package/lib/esm/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  112. package/lib/esm/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
  113. package/lib/esm/view/transactionDetail/transactionDetailSelector.js +9 -2
  114. package/lib/index.d.ts +23 -16
  115. package/lib/index.js +61 -32
  116. package/lib/reducer.d.ts +3 -0
  117. package/lib/reducer.js +3 -0
  118. package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
  119. package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +7 -0
  120. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +15 -1
  121. package/lib/view/aiCfoView/aiCfoViewReducer.js +83 -2
  122. package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +4 -1
  123. package/lib/view/aiCfoView/aiCfoViewSelector.js +9 -2
  124. package/lib/view/aiCfoView/aiCfoViewState.d.ts +15 -1
  125. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +8 -0
  126. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +33 -0
  127. package/lib/view/auditReportView/auditReportViewState.d.ts +2 -2
  128. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  129. package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
  130. package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
  131. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  132. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  133. package/lib/view/classList/fetchClassListEpic.d.ts +1 -1
  134. package/lib/view/classList/fetchClassListEpic.js +8 -1
  135. package/lib/view/commonVendorView/vendorView/vendorViewSelector.d.ts +1 -0
  136. package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +18 -5
  137. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +1 -0
  138. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
  139. package/lib/view/companyView/companyViewReducer.d.ts +6 -1
  140. package/lib/view/companyView/companyViewReducer.js +28 -2
  141. package/lib/view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic.d.ts +10 -0
  142. package/lib/view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic.js +65 -0
  143. package/lib/view/companyView/types/companyPassport/companyPassportViewState.d.ts +1 -0
  144. package/lib/view/companyView/types/companyPassport/companyPassportViewState.js +4 -0
  145. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  146. package/lib/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.d.ts +8 -0
  147. package/lib/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js +48 -0
  148. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +4 -9
  149. package/lib/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.d.ts +9 -0
  150. package/lib/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.js +48 -0
  151. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
  152. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +1 -1
  153. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +2 -1
  154. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +0 -1
  155. package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  156. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  157. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  158. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +1 -1
  159. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +45 -0
  160. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
  161. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +22 -2
  162. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +18 -4
  163. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +168 -4
  164. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +2 -0
  165. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +1 -0
  166. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +7 -2
  167. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +2 -2
  168. package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +10 -2
  169. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +63 -6
  170. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +13 -4
  171. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +136 -9
  172. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +13 -3
  173. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +8 -0
  174. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +27 -0
  175. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +14 -0
  176. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  177. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  178. package/lib/view/onboardingView/cockpitView/types/onboardingCockpitViewTypes.d.ts +1 -1
  179. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +3 -0
  180. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  181. package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
  182. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  183. package/lib/view/spendManagement/autotransferRules/autoTransferRulesPayload.d.ts +75 -0
  184. package/lib/view/spendManagement/autotransferRules/autoTransferRulesPayload.js +30 -0
  185. package/lib/view/spendManagement/autotransferRules/autoTransferRulesReducer.d.ts +50 -0
  186. package/lib/view/spendManagement/autotransferRules/autoTransferRulesReducer.js +206 -0
  187. package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.d.ts +24 -0
  188. package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +61 -0
  189. package/lib/view/spendManagement/autotransferRules/autoTransferRulesState.d.ts +38 -0
  190. package/lib/view/spendManagement/autotransferRules/autoTransferRulesState.js +2 -0
  191. package/lib/view/spendManagement/autotransferRules/epics/createAutoTransferRuleEpic.d.ts +12 -0
  192. package/lib/view/spendManagement/autotransferRules/epics/createAutoTransferRuleEpic.js +106 -0
  193. package/lib/view/spendManagement/autotransferRules/epics/deleteAutoTransferRuleEpic.d.ts +8 -0
  194. package/lib/view/spendManagement/autotransferRules/epics/deleteAutoTransferRuleEpic.js +52 -0
  195. package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferReviewDetailEpic.d.ts +7 -0
  196. package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferReviewDetailEpic.js +40 -0
  197. package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferRuleHistory.d.ts +7 -0
  198. package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferRuleHistory.js +52 -0
  199. package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferRulesEpic.d.ts +10 -0
  200. package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferRulesEpic.js +54 -0
  201. package/lib/view/spendManagement/autotransferRules/epics/updateAutoTransferRuleEpic.d.ts +8 -0
  202. package/lib/view/spendManagement/autotransferRules/epics/updateAutoTransferRuleEpic.js +73 -0
  203. package/lib/view/spendManagement/billPay/billList/billListSelector.js +10 -0
  204. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
  205. package/lib/view/spendManagement/billPay/billList/billListState.js +1 -0
  206. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +7 -3
  207. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  208. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
  209. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
  210. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +1 -1
  211. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  212. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
  213. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
  214. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +6 -3
  215. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +1 -0
  216. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
  217. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
  218. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
  219. package/lib/view/spendManagement/treasury/treasuryList/epics/fetchTreasuryDetailEpic.js +2 -2
  220. package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailReducer.d.ts +2 -1
  221. package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailReducer.js +2 -1
  222. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
  223. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  224. package/lib/view/topEx/topExSelector.d.ts +1 -1
  225. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  226. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
  227. package/lib/view/transactionDetail/transactionDetailSelector.d.ts +1 -0
  228. package/lib/view/transactionDetail/transactionDetailSelector.js +9 -2
  229. package/package.json +1 -1
@@ -6,6 +6,7 @@ import { getAccountBase } from '../../../entity/account/accountSelector';
6
6
  import { getAddressByAddressId } from '../../../entity/address/addressSelector';
7
7
  import { getContactsByIds } from '../../../entity/billPay/contact/contactSelector';
8
8
  import { getClassById } from '../../../entity/class/classSelector';
9
+ import { getIsAccountingClassesEnabled } from '../../../entity/tenant/tenantSelector';
9
10
  import { getUserByUserId, getUsersByUserIds, } from '../../../entity/user/userSelector';
10
11
  import { getVendorByVendorId } from '../../../entity/vendor/vendorSelector';
11
12
  import { dateNow } from '../../../zeniDayJS';
@@ -20,6 +21,7 @@ const ALL_VENDOR_DETAIL_TABS_TYPES = [
20
21
  export const toVendorDetailTabsType = (v) => stringToUnion(v, ALL_VENDOR_DETAIL_TABS_TYPES);
21
22
  export const getVendorsTabVendorView = (state, vendorIdFromUrl) => {
22
23
  const { accountListState, accountState, classListState, classState, vendorState, userState, vendorsTabVendorViewState, vendorTypeListState, addressState, addressViewState, contactState, } = state;
24
+ const isAccountingClassesEnabled = getIsAccountingClassesEnabled(state);
23
25
  const accountList = getAccountList(accountState, accountListState, 'accountList');
24
26
  const classList = getClassList(classState, classListState);
25
27
  const ownerList = getUsersByUserIds(state.userState, state.ownerListState.ownerIds);
@@ -51,7 +53,7 @@ export const getVendorsTabVendorView = (state, vendorIdFromUrl) => {
51
53
  }
52
54
  fetchState = reduceFetchState([
53
55
  accountList,
54
- classList,
56
+ ...(isAccountingClassesEnabled ? [classList] : []),
55
57
  vendorTypeListState,
56
58
  vendorsTabVendorViewState.vendorStateById[vendorIdFromUrl]?.fetchStatus ?? {
57
59
  fetchState: 'Not-Started',
@@ -62,6 +64,7 @@ export const getVendorsTabVendorView = (state, vendorIdFromUrl) => {
62
64
  return {
63
65
  accountList: accountList,
64
66
  classList: classList,
67
+ isAccountingClassesEnabled,
65
68
  vendorTypeList: vendorTypeList,
66
69
  accountsHierarchyList,
67
70
  classHierarchyList,
@@ -102,9 +105,10 @@ export const getVendorsTabDetailPageView = (state, vendorId, entity) => {
102
105
  ? getTransactionListByEntityForSinglePeriod(state, entity, state.vendorsTabVendorViewState.allTransactionsTabData
103
106
  .numberOfQuartersFetched)
104
107
  : undefined;
108
+ const isAccountingClassesEnabled = getIsAccountingClassesEnabled(state);
105
109
  const reducedFetchState = reduceAnyFetchState([
106
110
  state.accountListState.byReportId.accountList,
107
- state.classListState,
111
+ ...(isAccountingClassesEnabled ? [state.classListState] : []),
108
112
  state.ownerListState,
109
113
  state.vendorTypeListState,
110
114
  state.vendorsTabVendorViewState.vendorStateById[vendorId]?.fetchStatus ?? {
@@ -284,6 +284,31 @@ const companyView = createSlice({
284
284
  error: status,
285
285
  };
286
286
  },
287
+ updateAccountingClassesEnabled: {
288
+ reducer(draft,
289
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
290
+ _action) {
291
+ draft.passportView.accountingClassesUpdateStatus = {
292
+ fetchState: 'In-Progress',
293
+ error: undefined,
294
+ };
295
+ },
296
+ prepare(companyId, enabled) {
297
+ return { payload: { companyId, enabled } };
298
+ },
299
+ },
300
+ updateAccountingClassesEnabledSuccess(draft) {
301
+ draft.passportView.accountingClassesUpdateStatus = {
302
+ fetchState: 'Completed',
303
+ error: undefined,
304
+ };
305
+ },
306
+ updateAccountingClassesEnabledFailure(draft, action) {
307
+ draft.passportView.accountingClassesUpdateStatus = {
308
+ fetchState: 'Error',
309
+ error: action.payload.status,
310
+ };
311
+ },
287
312
  companyPassportUpdatePrimaryContact: {
288
313
  reducer(draft, action) {
289
314
  const { primaryContact } = action.payload;
@@ -557,5 +582,5 @@ const companyView = createSlice({
557
582
  },
558
583
  },
559
584
  });
560
- export const { fetchCompanyPassportView, fetchAllCockpitViews, fetchOnboardingView, fetchManagementView, fetchSubscriptionView, fetchPortfolioView, fetchCompanyManagementView, companyManagementSaveUpdates, companyManagementSavePendingUpdates, companyManagementDiscardUpdates, companyManagementSaveUpdatesSuccess, companyManagementSaveUpdatesFailure, updateCompanyViewOnSuccess, updateCompanyViewOnFailure, fetchCompanyPortfolioView, fetchZeniUsers, updateZeniUsersOnSuccess, updateZeniUsersOnFailure, clearCompanyView, updateCompanyPortfolioUIState, updateCompanyManagementUIState, companyPassportSaveDataInLocalStore, deleteCompanyOfficerInLocalStore, companyPassportClearDataInLocalStore, companyPassportUpdateCompanyDetails, companyPassportUpdateCompanyDetailsSuccess, companyPassportUpdateCompanyDetailsFailure, companyPassportUpdatePrimaryContact, companyPassportUpdatePrimaryContactSuccess, companyPassportUpdatePrimaryContactFailure, companyPassportUpdateCompanyOfficer, companyPassportUpdateCompanyOfficerSuccess, companyPassportUpdateCompanyOfficerFailure, companyPassportCreateCompanyOfficers, companyPassportCreateCompanyOfficersSuccess, companyPassportCreateCompanyOfficersFailure, updateCompanyPassportLocalStoreData, saveIndustryAndIncDateInCompanyPassportLocalStore, saveCompanyPassportDetails, fetchParentSubsidiaryManagementView, updateParentSubsidiaryView, updateParentSubsidiaryViewOnFailure, updateCompanyDownloadState, fetchCompanyMetaData, updateCompanyMetaDataOnSuccess, updateCompanyMetaDataOnFailure, updateMetaDataOnSendMonthEndReport, } = companyView.actions;
585
+ export const { fetchCompanyPassportView, fetchAllCockpitViews, fetchOnboardingView, fetchManagementView, fetchSubscriptionView, fetchPortfolioView, fetchCompanyManagementView, companyManagementSaveUpdates, companyManagementSavePendingUpdates, companyManagementDiscardUpdates, companyManagementSaveUpdatesSuccess, companyManagementSaveUpdatesFailure, updateCompanyViewOnSuccess, updateCompanyViewOnFailure, fetchCompanyPortfolioView, fetchZeniUsers, updateZeniUsersOnSuccess, updateZeniUsersOnFailure, clearCompanyView, updateCompanyPortfolioUIState, updateCompanyManagementUIState, companyPassportSaveDataInLocalStore, deleteCompanyOfficerInLocalStore, companyPassportClearDataInLocalStore, companyPassportUpdateCompanyDetails, companyPassportUpdateCompanyDetailsSuccess, companyPassportUpdateCompanyDetailsFailure, updateAccountingClassesEnabled, updateAccountingClassesEnabledSuccess, updateAccountingClassesEnabledFailure, companyPassportUpdatePrimaryContact, companyPassportUpdatePrimaryContactSuccess, companyPassportUpdatePrimaryContactFailure, companyPassportUpdateCompanyOfficer, companyPassportUpdateCompanyOfficerSuccess, companyPassportUpdateCompanyOfficerFailure, companyPassportCreateCompanyOfficers, companyPassportCreateCompanyOfficersSuccess, companyPassportCreateCompanyOfficersFailure, updateCompanyPassportLocalStoreData, saveIndustryAndIncDateInCompanyPassportLocalStore, saveCompanyPassportDetails, fetchParentSubsidiaryManagementView, updateParentSubsidiaryView, updateParentSubsidiaryViewOnFailure, updateCompanyDownloadState, fetchCompanyMetaData, updateCompanyMetaDataOnSuccess, updateCompanyMetaDataOnFailure, updateMetaDataOnSendMonthEndReport, } = companyView.actions;
561
586
  export default companyView.reducer;
@@ -0,0 +1,61 @@
1
+ import { from } from 'rxjs';
2
+ import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
+ import { updateCompanies } from '../../../../entity/company/companyReducer';
4
+ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
5
+ import { updateTenantAccountingClassesEnabled } from '../../../../entity/tenant/tenantReducer';
6
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
7
+ import { updateAccountingClassesEnabled, updateAccountingClassesEnabledFailure, updateAccountingClassesEnabledSuccess, } from '../../companyViewReducer';
8
+ export const updateAccountingClassesEnabledEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(updateAccountingClassesEnabled.match), switchMap((action) => {
9
+ const { companyId, enabled } = action.payload;
10
+ const tenantId = Object.values(state$.value.tenantState.tenantsById).find((t) => t.companyId === companyId)?.tenantId;
11
+ return zeniAPI
12
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}`, { is_accounting_classes_enabled: enabled })
13
+ .pipe(mergeMap((response) => {
14
+ const companies = response.data?.companies ?? [];
15
+ if (isSuccessResponse(response) && companies.length > 0) {
16
+ const actions = [
17
+ updateCompanies({
18
+ payload: companies,
19
+ schema: {},
20
+ }),
21
+ ];
22
+ if (tenantId != null) {
23
+ actions.push(updateTenantAccountingClassesEnabled({
24
+ enabled,
25
+ tenantId,
26
+ }));
27
+ }
28
+ actions.push(updateAccountingClassesEnabledSuccess());
29
+ actions.push(openSnackbar({
30
+ messageSection: 'accounting_classes_enabled_update',
31
+ messageText: 'success',
32
+ type: 'success',
33
+ }));
34
+ return from(actions);
35
+ }
36
+ else {
37
+ return from([
38
+ updateAccountingClassesEnabledFailure({
39
+ status: response.status,
40
+ }),
41
+ openSnackbar({
42
+ messageSection: 'accounting_classes_enabled_update',
43
+ messageText: 'failed',
44
+ type: 'error',
45
+ }),
46
+ ]);
47
+ }
48
+ }), catchError((error) => from([
49
+ updateAccountingClassesEnabledFailure({
50
+ status: createZeniAPIStatus('Unexpected error', 'Update Accounting Classes Enabled errored out' +
51
+ (error instanceof Error
52
+ ? error.message
53
+ : JSON.stringify(error))),
54
+ }),
55
+ openSnackbar({
56
+ messageSection: 'accounting_classes_enabled_update',
57
+ messageText: 'failed',
58
+ type: 'error',
59
+ }),
60
+ ])));
61
+ }));
@@ -1,6 +1,10 @@
1
1
  import { initialCommonState } from '../commonState';
2
2
  export const initialCompanyPassportView = {
3
3
  ...initialCommonState,
4
+ accountingClassesUpdateStatus: {
5
+ fetchState: 'Not-Started',
6
+ error: undefined,
7
+ },
4
8
  companyDetails: {
5
9
  localData: undefined,
6
10
  updateStatus: {
@@ -0,0 +1,44 @@
1
+ import { of } from 'rxjs';
2
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
+ import { changeAccountKey } from '../../../../entity/account/accountReducer';
4
+ import { getAccountKey } from '../../../../entity/account/accountState';
5
+ import { getAccountReconByAccountIdAndSelectedPeriod } from '../../../../entity/accountRecon/accountReconSelector';
6
+ import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
7
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
8
+ import { excludeAccountFromReconciliation, excludeAccountFromReconciliationFailure, excludeAccountFromReconciliationSuccess, } from '../../reducers/reconciliationViewReducer';
9
+ export const excludeAccountFromReconciliationEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(excludeAccountFromReconciliation.match), mergeMap((action) => {
10
+ const { accountId } = action.payload;
11
+ const state = state$.value;
12
+ const currentTenant = getCurrentTenant(state);
13
+ const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
14
+ const reconciliationData = getAccountReconByAccountIdAndSelectedPeriod(state, accountId, selectedPeriod);
15
+ const payload = {
16
+ account_id: accountId,
17
+ bank_balance: reconciliationData?.balance?.amount ?? null,
18
+ cleared_balance: reconciliationData?.clearedBalance?.amount ?? null,
19
+ variance: reconciliationData?.variance?.amount ?? null,
20
+ };
21
+ const apiUrl = `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/excluded-accounts`;
22
+ return zeniAPI
23
+ .postAndGetJSON(apiUrl, payload)
24
+ .pipe(mergeMap((response) => {
25
+ if (isSuccessResponse(response)) {
26
+ const newAccountKey = getAccountKey('excluded_account_reconciliation', accountId);
27
+ const oldAccountKey = getAccountKey('account_reconciliation', accountId);
28
+ return of(excludeAccountFromReconciliationSuccess({
29
+ account: response.data?.excluded_account ?? undefined,
30
+ selectedPeriod,
31
+ }), changeAccountKey({
32
+ oldKey: oldAccountKey,
33
+ newKey: newAccountKey,
34
+ }));
35
+ }
36
+ else {
37
+ return of(excludeAccountFromReconciliationFailure({
38
+ error: response.status,
39
+ }));
40
+ }
41
+ }), catchError((error) => of(excludeAccountFromReconciliationFailure({
42
+ error: createZeniAPIStatus('Unexpected Error', `Exclude account from reconciliation REST API call errored out ${JSON.stringify(error)}`),
43
+ }))));
44
+ }));
@@ -53,22 +53,17 @@ export const fetchReconciliationViewEpic = (actions$, state$, zeniAPI) => action
53
53
  return zeniAPI.getJSON(apiUrl).pipe(mergeMap((response) => {
54
54
  if (isSuccessResponse(response) && response.data != null) {
55
55
  const updateActions = [];
56
- updateActions.push(updateAccounts(response.data.accounts, 'account_reconciliation'));
57
- updateActions.push(updateAllUsers({
56
+ const allTransactionsPerRecon = getAllReviewTransactionsFromReconcilePayload(response.data.reconciliation);
57
+ updateActions.push(updateAccounts(response.data.accounts, 'account_reconciliation'), updateAccounts(response.data.excluded_accounts ?? [], 'excluded_account_reconciliation'), updateAllUsers({
58
58
  users: response.data.users ?? [],
59
59
  updateType: 'merge',
60
- }));
61
- updateActions.push(updateFiles({ files: response.data.files ?? [] }));
62
- const allTransactionsPerRecon = getAllReviewTransactionsFromReconcilePayload(response.data.reconciliation);
63
- updateActions.push(updateMultipleReconcileTransactions(allTransactionsPerRecon, 'merge'));
64
- updateActions.push(updateAccountRecon(selectedPeriod, response.data.reconciliation));
60
+ }), updateFiles({ files: response.data.files ?? [] }), updateMultipleReconcileTransactions(allTransactionsPerRecon, 'merge'), updateAccountRecon(selectedPeriod, response.data.reconciliation));
65
61
  const reviewTabLocalData = prepareReviewTabLocalData(response.data.reconciliation[0]?.transactions?.review ?? []);
66
62
  if (accountId != null) {
67
63
  const selectedTransactionIds = getTransactionIdFromCheckedMatchedTransactionPayload(response.data.reconciliation[0].transactions.reconcile);
68
64
  updateActions.push(updateReconcileTabLocalData({
69
65
  selectedTransactionIds: selectedTransactionIds,
70
- }));
71
- updateActions.push(initializeReconciliationReviewTabLocalData(reviewTabLocalData));
66
+ }), initializeReconciliationReviewTabLocalData(reviewTabLocalData));
72
67
  }
73
68
  updateActions.push(fetchReconciliationSuccess(selectedPeriod, response.data, refreshViewInBackground, accountId));
74
69
  return from(updateActions);
@@ -0,0 +1,44 @@
1
+ import { of } from 'rxjs';
2
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
+ import { convertToPeriod } from '../../../../commonStateTypes/timePeriod';
4
+ import { changeAccountKey } from '../../../../entity/account/accountReducer';
5
+ import { getAccountKey } from '../../../../entity/account/accountState';
6
+ import { updateAccountRecon } from '../../../../entity/accountRecon/accountReconReducer';
7
+ import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
8
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
9
+ import { includeAccountInReconciliation, includeAccountInReconciliationFailure, includeAccountInReconciliationSuccess, } from '../../reducers/reconciliationViewReducer';
10
+ export const includeAccountInReconciliationEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(includeAccountInReconciliation.match), mergeMap((action) => {
11
+ const { accountId } = action.payload;
12
+ const state = state$.value;
13
+ const currentTenant = getCurrentTenant(state);
14
+ const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
15
+ const period = convertToPeriod(selectedPeriod, true);
16
+ const query = JSON.stringify({
17
+ start_date: period.start,
18
+ end_date: period.end,
19
+ });
20
+ const apiUrl = `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/excluded-accounts/${accountId}?query=${encodeURIComponent(query)}`;
21
+ return zeniAPI
22
+ .deleteAndGetJSON(apiUrl)
23
+ .pipe(mergeMap((response) => {
24
+ if (isSuccessResponse(response) && response.data != null) {
25
+ const reconciliation = response.data.reconciliation;
26
+ const oldAccountKey = getAccountKey('excluded_account_reconciliation', reconciliation.account_id);
27
+ const newAccountKey = getAccountKey('account_reconciliation', reconciliation.account_id);
28
+ return of(updateAccountRecon(selectedPeriod, [reconciliation]), includeAccountInReconciliationSuccess({
29
+ reconciliation,
30
+ selectedPeriod,
31
+ }), changeAccountKey({
32
+ oldKey: oldAccountKey,
33
+ newKey: newAccountKey,
34
+ }));
35
+ }
36
+ else {
37
+ return of(includeAccountInReconciliationFailure({
38
+ error: response.status,
39
+ }));
40
+ }
41
+ }), catchError((error) => of(includeAccountInReconciliationFailure({
42
+ error: createZeniAPIStatus('Unexpected Error', `Include account in reconciliation REST API call errored out ${JSON.stringify(error)}`),
43
+ }))));
44
+ }));
@@ -21,13 +21,13 @@ export const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe
21
21
  if (isSuccessResponse(response) && response.data != null) {
22
22
  const updateActions = [];
23
23
  updateActions.push(updateJESchedules([
24
- ...response.data.draft_je_schedules,
24
+ ...response.data.je_schedules,
25
25
  ...response.data.failed_je_postings.je_schedules,
26
26
  ]), updateJESchedulesDetails([...response.data.failed_je_postings.je_schedules], response.data.failed_je_postings.scheduled_journal_entries), initializeJeScheduleLocalData([
27
27
  ...response.data.failed_je_postings.je_schedules,
28
28
  ]));
29
29
  updateActions.push(fetchJeSchedulesSuccess({
30
- jeSchedules: [...response.data.draft_je_schedules],
30
+ jeSchedules: [...response.data.je_schedules],
31
31
  failedJeSchedules: [
32
32
  ...response.data.failed_je_postings.je_schedules,
33
33
  ],
@@ -1,9 +1,9 @@
1
1
  import { concat, of, timer } from 'rxjs';
2
- import { catchError, filter, mergeMap } from 'rxjs/operators';
2
+ import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
3
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
4
4
  import { BULK_UPLOAD_BAR_COMPLETE_HOLD_MS } from '../../helpers/bulkUploadTiming';
5
5
  import { bulkUploadReceipts, bulkUploadReceiptsFailure, bulkUploadReceiptsSuccess, updateBulkUploadProgress, } from '../../reducers/missingReceiptsViewReducer';
6
- export const bulkUploadReceiptsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(bulkUploadReceipts.match), mergeMap((action) => {
6
+ export const bulkUploadReceiptsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(bulkUploadReceipts.match), switchMap((action) => {
7
7
  const { files } = action.payload;
8
8
  const formData = new FormData();
9
9
  for (const file of files) {
@@ -54,7 +54,8 @@ export const pollBulkUploadBatchStatusEpic = (actions$, _state$, zeniAPI) => act
54
54
  const firstDelay = restoreBulkUploadMatchingState.match(action)
55
55
  ? RESTORE_FIRST_DELAY_MS
56
56
  : FALLBACK_FIRST_DELAY_MS;
57
- return timer(firstDelay, FALLBACK_POLL_INTERVAL_MS).pipe(takeUntil(merge(actions$.pipe(filter(clearBulkUpload.match)), actions$.pipe(filter(pusherBatchStatusUpdate.match), filter((action) => action.payload.batchId === batchId)), actions$.pipe(filter(fetchBulkUploadBatchDetailsSuccess.match), filter((action) => action.payload.batchId === batchId)), actions$.pipe(filter(bulkUploadAutomatchingTimedOut.match), filter((action) => action.payload.batchId === batchId)))), switchMap(() => zeniAPI
57
+ return timer(firstDelay, FALLBACK_POLL_INTERVAL_MS).pipe(takeUntil(merge(actions$.pipe(filter(clearBulkUpload.match)), actions$.pipe(filter(pusherBatchStatusUpdate.match), filter((action) => action.payload.batchId === batchId &&
58
+ action.payload.status === 'completed')), actions$.pipe(filter(fetchBulkUploadBatchDetailsSuccess.match), filter((action) => action.payload.batchId === batchId)), actions$.pipe(filter(bulkUploadAutomatchingTimedOut.match), filter((action) => action.payload.batchId === batchId)))), switchMap(() => zeniAPI
58
59
  .getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches/${batchId}`)
59
60
  .pipe(mergeMap((response) => {
60
61
  /** Same batch-details URL; polls until `status` is completed (Pusher may win first). */
@@ -91,7 +91,6 @@ export function getExpenseAutomationView(state) {
91
91
  const fetchStateVariables = [
92
92
  expenseAutomationMissingReceiptsViewState,
93
93
  expenseAutomationJESchedulesViewState,
94
- monthEndCloseChecksView,
95
94
  expenseAutomationTransactionsView,
96
95
  expenseAutomationReconciliationViewState,
97
96
  ];
@@ -64,8 +64,8 @@ export const toTransactionUpdatesFromTransactionCategorizationLocalData = (trans
64
64
  lineItem.account?.qboId !== accountLine.account.qboId &&
65
65
  Boolean(lineItem.account?.qboId);
66
66
  hasClassChanged =
67
- Boolean(lineItem.class?.qboId) &&
68
- lineItem.class?.qboId !== accountLine.class.qboId;
67
+ (lineItem.class?.qboId != null || accountLine.class?.qboId != null) &&
68
+ lineItem.class?.qboId !== accountLine.class?.qboId;
69
69
  const recommendedAccountBase = toRecommendedAccountBase(lineItem.amount.amount, lineItem.account);
70
70
  const recommendedClassBase = toRecommendedClassBase(lineItem.amount.amount, lineItem.class);
71
71
  if (entityDetails != null &&
@@ -234,7 +234,7 @@ const buildLineItemById = (transaction, uncategorizedIncomeExpense, recommendati
234
234
  isPreFilled: true,
235
235
  };
236
236
  }
237
- if (accountLine.class.classId === '' &&
237
+ if (Boolean(accountLine.class?.classId) === false &&
238
238
  higherPreferenceRecommendation?.class != null) {
239
239
  record.class = {
240
240
  ...higherPreferenceRecommendation.class,
@@ -464,7 +464,7 @@ export const setEntityRecommendationForLineIdInLocalData = (draft, transaction,
464
464
  }
465
465
  : accountLine.account;
466
466
  record.class =
467
- accountLine.class.classId !== ''
467
+ Boolean(accountLine.class?.classId) !== false
468
468
  ? accountLine.class
469
469
  : recommendations?.[0]?.class
470
470
  ? {
@@ -44,6 +44,9 @@ export const initialState = {
44
44
  uiState: {
45
45
  searchString: '',
46
46
  scrollPosition: { scrollTop: 0, scrollLeft: undefined },
47
+ selectedMainTab: 'pending_review',
48
+ sortKey: 'transactionDate',
49
+ sortOrder: 'descending',
47
50
  totalCount: 0,
48
51
  limit: 10,
49
52
  },
@@ -365,12 +368,29 @@ const expenseAutomationJESchedulesView = createSlice({
365
368
  clearJeAccountSettingsLocalData(draft) {
366
369
  draft.accountSettings.localData = accountSettingsInitialState.localData;
367
370
  },
371
+ updateJESchedulesUIState(draft, action) {
372
+ if (action.payload.sortKey != null) {
373
+ draft.uiState.sortKey = action.payload.sortKey;
374
+ }
375
+ if (action.payload.sortOrder != null) {
376
+ draft.uiState.sortOrder = action.payload.sortOrder;
377
+ }
378
+ if (action.payload.searchString != null) {
379
+ draft.uiState.searchString = action.payload.searchString;
380
+ }
381
+ if (action.payload.scrollPosition != null) {
382
+ draft.uiState.scrollPosition = action.payload.scrollPosition;
383
+ }
384
+ if (action.payload.selectedMainTab != null) {
385
+ draft.uiState.selectedMainTab = action.payload.selectedMainTab;
386
+ }
387
+ },
368
388
  clearExpenseAutomationJESchedulesView(draft) {
369
389
  Object.assign(draft, initialState);
370
390
  },
371
391
  },
372
392
  });
373
- export const { clearExpenseAutomationJESchedulesView, clearJeAccountSettingsLocalData, clearJeScheduleLocalData, fetchAccountSettingsListForAccountTypes, fetchJeSchedules, fetchJeSchedulesFailure, fetchJeSchedulesPage, fetchJeSchedulesSuccess, fetchRecommendationForAccountSettings, ignoreRecommendedJeSchedule, ignoreRecommendedJeScheduleFailure, ignoreRecommendedJeScheduleSuccess, initializeAccountSettingsView, initializeJeScheduleLocalData, removeFailedJeScheduleTransactionKey, removeJeScheduleLocalDataById, removeJeScheduleTransactionKey, retryJeSchedule, retryJeScheduleFailure, retryJeScheduleSuccess, saveAccountSettings, saveAccountSettingsFailure, saveAccountSettingsLocalData, saveAccountSettingsSuccess, updateAccountSettingsListForAccountTypes, updateAccountSettingsListForAccountTypesFailure, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, updateRecommendationForAccountSettings, updateRecommendationForAccountSettingsFailure, } = expenseAutomationJESchedulesView.actions;
393
+ export const { clearExpenseAutomationJESchedulesView, clearJeAccountSettingsLocalData, clearJeScheduleLocalData, fetchAccountSettingsListForAccountTypes, fetchJeSchedules, fetchJeSchedulesFailure, fetchJeSchedulesPage, fetchJeSchedulesSuccess, fetchRecommendationForAccountSettings, ignoreRecommendedJeSchedule, ignoreRecommendedJeScheduleFailure, ignoreRecommendedJeScheduleSuccess, initializeAccountSettingsView, initializeJeScheduleLocalData, removeFailedJeScheduleTransactionKey, removeJeScheduleLocalDataById, removeJeScheduleTransactionKey, retryJeSchedule, retryJeScheduleFailure, retryJeScheduleSuccess, saveAccountSettings, saveAccountSettingsFailure, saveAccountSettingsLocalData, saveAccountSettingsSuccess, updateAccountSettingsListForAccountTypes, updateAccountSettingsListForAccountTypesFailure, updateJESchedulesUIState, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, updateRecommendationForAccountSettings, updateRecommendationForAccountSettingsFailure, } = expenseAutomationJESchedulesView.actions;
374
394
  export default expenseAutomationJESchedulesView.reducer;
375
395
  const doUpdateRecommendationForAccountSettings = (draft, payload) => {
376
396
  const { prepaidExpensesRecommendations, fixedAssetsRecommendations, accruedExpensesRecommendations, } = mapAccountTypeRecommendationPayloadToAccountRecommendationByType(payload);
@@ -37,7 +37,15 @@ export const initialReconciliationTabsState = {
37
37
  },
38
38
  };
39
39
  export const initialActionFetchState = {
40
+ excludeAccountFetch: {
41
+ fetchState: 'Not-Started',
42
+ error: undefined,
43
+ },
40
44
  excludeFetchById: {},
45
+ includeAccountFetch: {
46
+ fetchState: 'Not-Started',
47
+ error: undefined,
48
+ },
41
49
  reconcileFetch: {
42
50
  fetchState: 'Not-Started',
43
51
  error: undefined,
@@ -51,6 +59,7 @@ export const initialActionFetchState = {
51
59
  export const initialState = {
52
60
  accountReconciliationRecordsBySelectedPeriod: {},
53
61
  accountConnectionStatusByAccountID: {},
62
+ excludedAccountExclusionInfo: {},
54
63
  fetchState: 'Not-Started',
55
64
  error: undefined,
56
65
  selectedTab: 'review',
@@ -60,10 +69,12 @@ export const initialState = {
60
69
  selectedAccountId: undefined,
61
70
  statementUploadChosen: false,
62
71
  reconListUIState: {
72
+ nodeCollapseState: {},
63
73
  scrollPosition: {
64
74
  scrollTop: 0,
65
75
  },
66
76
  },
77
+ excludedAccountIDs: [],
67
78
  };
68
79
  // Create slice with reducers
69
80
  const expenseAutomationReconciliationView = createSlice({
@@ -132,7 +143,7 @@ const expenseAutomationReconciliationView = createSlice({
132
143
  fetchReconciliationSuccess: {
133
144
  reducer(draft, action) {
134
145
  if (action.payload.accountId == null) {
135
- updateAllReconciliation(draft, action.payload.reconciliation.accounts, action.payload.selectedPeriod, action.payload.reconciliation.reconciliation, action.payload.refreshViewInBackground);
146
+ updateAllReconciliation(draft, action.payload.reconciliation.accounts, action.payload.selectedPeriod, action.payload.reconciliation.reconciliation, action.payload.refreshViewInBackground, action.payload.reconciliation.excluded_accounts ?? []);
136
147
  }
137
148
  else if (action.payload.reconciliation.reconciliation.length > 0 &&
138
149
  action.payload.reconciliation.accounts.length > 0) {
@@ -344,6 +355,10 @@ const expenseAutomationReconciliationView = createSlice({
344
355
  updateReconListScrollPosition: (draft, action) => {
345
356
  draft.reconListUIState.scrollPosition = action.payload.scrollPosition;
346
357
  },
358
+ updateNodeCollapseState: (draft, action) => {
359
+ draft.reconListUIState.nodeCollapseState[action.payload.nodeId] =
360
+ action.payload.collapsed;
361
+ },
347
362
  setConnectionInProgressForAccount: (draft, action) => {
348
363
  if (draft.accountConnectionStatusByAccountID[action.payload.accountId] ==
349
364
  null) {
@@ -421,6 +436,85 @@ const expenseAutomationReconciliationView = createSlice({
421
436
  ...localData,
422
437
  };
423
438
  },
439
+ excludeAccountFromReconciliation: {
440
+ reducer(draft) {
441
+ draft.actionFetchState.excludeAccountFetch = {
442
+ fetchState: 'In-Progress',
443
+ error: undefined,
444
+ };
445
+ },
446
+ prepare(payload) {
447
+ return { payload };
448
+ },
449
+ },
450
+ excludeAccountFromReconciliationSuccess: (draft, action) => {
451
+ draft.actionFetchState.excludeAccountFetch = {
452
+ fetchState: 'Completed',
453
+ error: undefined,
454
+ };
455
+ const { account, selectedPeriod } = action.payload;
456
+ if (account != null) {
457
+ if (!draft.excludedAccountIDs.includes(account.account_id)) {
458
+ draft.excludedAccountIDs.push(account.account_id);
459
+ }
460
+ updateExcludedAccountExclusionInfo(draft, account);
461
+ const monthYearPeriodId = toMonthYearPeriodId(selectedPeriod);
462
+ if (draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId]
463
+ ?.accountIDs != null) {
464
+ draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId].accountIDs = draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId].accountIDs.filter((id) => id !== account.account_id);
465
+ }
466
+ }
467
+ },
468
+ excludeAccountFromReconciliationFailure: (draft, action) => {
469
+ draft.actionFetchState.excludeAccountFetch = {
470
+ fetchState: 'Error',
471
+ error: action.payload.error,
472
+ };
473
+ },
474
+ includeAccountInReconciliation: {
475
+ reducer(draft) {
476
+ draft.actionFetchState.includeAccountFetch = {
477
+ fetchState: 'In-Progress',
478
+ error: undefined,
479
+ };
480
+ },
481
+ prepare(payload) {
482
+ return { payload };
483
+ },
484
+ },
485
+ includeAccountInReconciliationSuccess: (draft, action) => {
486
+ draft.actionFetchState.includeAccountFetch = {
487
+ fetchState: 'Completed',
488
+ error: undefined,
489
+ };
490
+ const { reconciliation, selectedPeriod } = action.payload;
491
+ if (reconciliation == null) {
492
+ return;
493
+ }
494
+ const accountId = reconciliation.account_id;
495
+ draft.excludedAccountIDs = draft.excludedAccountIDs.filter((id) => id !== accountId);
496
+ delete draft.excludedAccountExclusionInfo[accountId];
497
+ const monthYearPeriodId = toMonthYearPeriodId(selectedPeriod);
498
+ const accountReconciliationRecords = draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId];
499
+ if (accountReconciliationRecords != null) {
500
+ if (!accountReconciliationRecords.accountIDs.includes(accountId)) {
501
+ accountReconciliationRecords.accountIDs.push(accountId);
502
+ }
503
+ // put this in a function
504
+ updateReconciliationByAccountIDOnIncludeAccount(draft, accountId, reconciliation, monthYearPeriodId);
505
+ }
506
+ draft.accountConnectionStatusByAccountID[accountId] = {
507
+ status: toBankStatusCodeType(reconciliation.bank_status.code),
508
+ connectionInProgress: false,
509
+ paymentAccountId: undefined,
510
+ };
511
+ },
512
+ includeAccountInReconciliationFailure: (draft, action) => {
513
+ draft.actionFetchState.includeAccountFetch = {
514
+ fetchState: 'Error',
515
+ error: action.payload.error,
516
+ };
517
+ },
424
518
  updateStatementUploadChosen: (draft, action) => {
425
519
  draft.statementUploadChosen = action.payload.statementUploadChosen;
426
520
  },
@@ -430,10 +524,38 @@ const expenseAutomationReconciliationView = createSlice({
430
524
  },
431
525
  });
432
526
  // Export actions
433
- export const { fetchReconciliation, fetchReconciliationFailure, fetchReconciliationSuccess, saveReconciliationDetail, saveReconciliationDetailFailure, updateSelectedAccountId, setConnectionInProgressForAccount, setStatementParseInProgress, updateReconcileTabLocalData, updateReconcileTabListSortState, updateReconcileTabListScrollState, saveReconciliationDetailSuccess, updateSelectedTab, updateBalancesLocalData, initialiseLocalDataForSelectedAccountId, clearExpenseAutomationReconciliationView, updateSelectedDrawerAccountId, updateReviewTabSortState, initializeReconciliationReviewTabLocalData, updateReviewTabLocalData, saveReconciliationReview, updateSaveReconciliationReviewFetchStatus, updateReconListScrollPosition, updateAccountReconciliationLocalData, deleteAccountStatement, deleteAccountStatementSuccess, deleteAccountStatementFailure, uploadAccountStatement, uploadAccountStatementSuccess, uploadAccountStatementFailure, updateStatementUploadChosen, } = expenseAutomationReconciliationView.actions;
527
+ export const { fetchReconciliation, fetchReconciliationFailure, fetchReconciliationSuccess, saveReconciliationDetail, saveReconciliationDetailFailure, updateSelectedAccountId, setConnectionInProgressForAccount, setStatementParseInProgress, updateReconcileTabLocalData, updateReconcileTabListSortState, updateReconcileTabListScrollState, saveReconciliationDetailSuccess, updateSelectedTab, updateBalancesLocalData, initialiseLocalDataForSelectedAccountId, clearExpenseAutomationReconciliationView, updateSelectedDrawerAccountId, updateReviewTabSortState, initializeReconciliationReviewTabLocalData, updateReviewTabLocalData, saveReconciliationReview, updateSaveReconciliationReviewFetchStatus, updateReconListScrollPosition, updateAccountReconciliationLocalData, deleteAccountStatement, deleteAccountStatementSuccess, deleteAccountStatementFailure, excludeAccountFromReconciliation, excludeAccountFromReconciliationSuccess, excludeAccountFromReconciliationFailure, includeAccountInReconciliation, includeAccountInReconciliationSuccess, includeAccountInReconciliationFailure, uploadAccountStatement, uploadAccountStatementSuccess, uploadAccountStatementFailure, updateStatementUploadChosen, updateNodeCollapseState, } = expenseAutomationReconciliationView.actions;
434
528
  // Export reducer
435
529
  export default expenseAutomationReconciliationView.reducer;
436
- function updateAllReconciliation(draft, accounts, selectedPeriod, reconciliationData, refreshViewInBackground) {
530
+ function updateAllReconciliation(draft, accounts, selectedPeriod, reconciliationData, refreshViewInBackground, excludedAccounts) {
531
+ draft.excludedAccountIDs = excludedAccounts.map((ea) => ea.account_id);
532
+ draft.excludedAccountExclusionInfo = {};
533
+ excludedAccounts.forEach((ea) => {
534
+ const { exclusion_info } = ea;
535
+ draft.excludedAccountExclusionInfo[ea.account_id] = {
536
+ bankBalance: exclusion_info.bank_balance != null
537
+ ? {
538
+ amount: exclusion_info.bank_balance,
539
+ currencyCode: ea.currency_code ?? 'USD',
540
+ currencySymbol: ea.currency_symbol ?? '$',
541
+ }
542
+ : undefined,
543
+ clearedBalance: exclusion_info.cleared_balance != null
544
+ ? {
545
+ amount: exclusion_info.cleared_balance,
546
+ currencyCode: ea.currency_code ?? 'USD',
547
+ currencySymbol: ea.currency_symbol ?? '$',
548
+ }
549
+ : undefined,
550
+ variance: exclusion_info.variance != null
551
+ ? {
552
+ amount: exclusion_info.variance,
553
+ currencyCode: ea.currency_code ?? 'USD',
554
+ currencySymbol: ea.currency_symbol ?? '$',
555
+ }
556
+ : undefined,
557
+ };
558
+ });
437
559
  draft.accountReconciliationRecordsBySelectedPeriod[toMonthYearPeriodId(selectedPeriod)] = {
438
560
  accountIDs: [],
439
561
  reconciliationByAccountID: {},
@@ -471,6 +593,9 @@ function updateAllReconciliation(draft, accounts, selectedPeriod, reconciliation
471
593
  ? toReconciliationAccountSource(account.reconciliation_source)
472
594
  : undefined,
473
595
  },
596
+ accountDetectionReason: account?.detection_info != null && account.detection_reason != null
597
+ ? account.detection_reason
598
+ : undefined,
474
599
  };
475
600
  accountReconciliationRecords.accountIDs.push(reconciliation.account_id);
476
601
  });
@@ -516,3 +641,42 @@ function updateReconciliationByAccountID(draft, accounts, selectedPeriod, accoun
516
641
  };
517
642
  }
518
643
  }
644
+ const updateExcludedAccountExclusionInfo = (draft, account) => {
645
+ draft.excludedAccountExclusionInfo[account.account_id] = {
646
+ bankBalance: account.bank_balance != null
647
+ ? {
648
+ amount: account.bank_balance,
649
+ currencyCode: account.currency_code ?? 'USD',
650
+ currencySymbol: account.currency_symbol ?? '$',
651
+ }
652
+ : undefined,
653
+ clearedBalance: account.cleared_balance != null
654
+ ? {
655
+ amount: account.cleared_balance,
656
+ currencyCode: account.currency_code ?? 'USD',
657
+ currencySymbol: account.currency_symbol ?? '$',
658
+ }
659
+ : undefined,
660
+ variance: account.variance != null
661
+ ? {
662
+ amount: account.variance,
663
+ currencyCode: account.currency_code ?? 'USD',
664
+ currencySymbol: account.currency_symbol ?? '$',
665
+ }
666
+ : undefined,
667
+ };
668
+ };
669
+ const updateReconciliationByAccountIDOnIncludeAccount = (draft, accountId, reconciliation, monthYearPeriodId) => {
670
+ draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId].reconciliationByAccountID[accountId] = {
671
+ accountId,
672
+ reconciliationId: reconciliation.reconciliation_id ?? undefined,
673
+ transactionFetchState: { fetchState: 'Not-Started', error: undefined },
674
+ refreshStatus: { fetchState: 'Not-Started', error: undefined },
675
+ statementDeleteStatus: { fetchState: 'Not-Started', error: undefined },
676
+ statementUploadStatus: { fetchState: 'Not-Started', error: undefined },
677
+ statementUpdateStatus: { fetchState: 'Not-Started', error: undefined },
678
+ statementParseInProgress: reconciliation.bank_status.code === 'parsing',
679
+ localData: {},
680
+ accountDetectionReason: undefined,
681
+ };
682
+ };