@zeniai/client-epic-state 4.20.3-betaSS11 → 4.20.3-betaSS13

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 (414) hide show
  1. package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.d.ts +19 -0
  2. package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.js +2 -0
  3. package/lib/commonPayloadTypes/subAccountView/reportBySubAccountPayload.d.ts +2 -0
  4. package/lib/commonStateTypes/animations.d.ts +1 -1
  5. package/lib/commonStateTypes/animations.js +4 -0
  6. package/lib/commonStateTypes/coaBalance/coaBalancesFilterProjectView.d.ts +13 -0
  7. package/lib/commonStateTypes/coaBalance/coaBalancesFilterProjectView.js +9 -0
  8. package/lib/commonStateTypes/common.d.ts +1 -1
  9. package/lib/commonStateTypes/projectView/projectViewParentID.d.ts +5 -0
  10. package/lib/commonStateTypes/projectView/projectViewParentID.js +2 -0
  11. package/lib/commonStateTypes/viewAndReport/reportIDHelper.d.ts +1 -0
  12. package/lib/commonStateTypes/viewAndReport/reportIDHelper.js +3 -1
  13. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  14. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +2 -0
  15. package/lib/entity/account/accountPayload.d.ts +2 -0
  16. package/lib/entity/account/accountReducer.d.ts +5 -2
  17. package/lib/entity/account/accountReducer.js +13 -5
  18. package/lib/entity/account/accountSelector.d.ts +7 -0
  19. package/lib/entity/account/accountSelector.js +4 -2
  20. package/lib/entity/account/accountState.d.ts +3 -1
  21. package/lib/entity/account/accountState.js +4 -1
  22. package/lib/entity/account/pickAndMergeForecastAccountReport.d.ts +1 -0
  23. package/lib/entity/account/subAccountSelector.d.ts +2 -0
  24. package/lib/entity/account/subAccountSelector.js +2 -0
  25. package/lib/entity/accountGroup/accountGroupSelector.d.ts +22 -0
  26. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  27. package/lib/entity/accountRecon/accountReconPayload.d.ts +1 -1
  28. package/lib/entity/accountRecon/accountReconPayload.js +4 -2
  29. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.d.ts +52 -0
  30. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +70 -0
  31. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.d.ts +10 -0
  32. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +51 -0
  33. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.d.ts +48 -0
  34. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +66 -0
  35. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerState.d.ts +52 -0
  36. package/lib/entity/aiAccountantCustomer/aiAccountantCustomerState.js +37 -0
  37. package/lib/entity/aiCfo/aiCfoSelector.d.ts +1 -2
  38. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +4 -4
  39. package/lib/entity/chargeCard/chargeCard.d.ts +1 -1
  40. package/lib/entity/class/classReducer.d.ts +4 -4
  41. package/lib/entity/class/classState.d.ts +1 -1
  42. package/lib/entity/depositAccountTransaction/depositAccountTransaction.d.ts +1 -1
  43. package/lib/entity/entityApprovalStatus/entityApprovalStatusState.d.ts +2 -2
  44. package/lib/entity/forecast/forecastState.d.ts +1 -1
  45. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +38 -0
  46. package/lib/entity/jeSchedules/jeSchedulesPayload.js +78 -0
  47. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +4 -1
  48. package/lib/entity/jeSchedules/jeSchedulesSelector.js +5 -1
  49. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +37 -0
  50. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +1 -1
  51. package/lib/entity/project/projectPayload.d.ts +13 -0
  52. package/lib/entity/project/projectPayload.js +30 -0
  53. package/lib/entity/project/projectReducer.d.ts +10 -0
  54. package/lib/entity/project/projectReducer.js +31 -0
  55. package/lib/entity/project/projectSelector.d.ts +5 -0
  56. package/lib/entity/project/projectSelector.js +12 -0
  57. package/lib/entity/project/projectState.d.ts +13 -0
  58. package/lib/entity/project/projectState.js +2 -0
  59. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  60. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  61. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  62. package/lib/entity/sectionProjectView/sectionProjectView.d.ts +13 -0
  63. package/lib/entity/sectionProjectView/sectionProjectView.js +6 -0
  64. package/lib/entity/sectionProjectView/sectionProjectViewEpic.d.ts +6 -0
  65. package/lib/entity/sectionProjectView/sectionProjectViewEpic.js +56 -0
  66. package/lib/entity/sectionProjectView/sectionProjectViewHelper.d.ts +11 -0
  67. package/lib/entity/sectionProjectView/sectionProjectViewHelper.js +15 -0
  68. package/lib/entity/sectionProjectView/sectionProjectViewReducer.d.ts +15 -0
  69. package/lib/entity/sectionProjectView/sectionProjectViewReducer.js +64 -0
  70. package/lib/entity/sectionProjectView/sectionProjectViewSelector.d.ts +11 -0
  71. package/lib/entity/sectionProjectView/sectionProjectViewSelector.js +57 -0
  72. package/lib/entity/sectionProjectView/sectionProjectViewSelectorTypes.d.ts +16 -0
  73. package/lib/entity/sectionProjectView/sectionProjectViewSelectorTypes.js +2 -0
  74. package/lib/entity/sectionProjectView/sectionProjectViewState.d.ts +4 -0
  75. package/lib/entity/sectionProjectView/sectionProjectViewState.js +2 -0
  76. package/lib/entity/snackbar/snackbarTypes.d.ts +2 -2
  77. package/lib/entity/snackbar/snackbarTypes.js +10 -0
  78. package/lib/entity/tenant/clearAllEpic.d.ts +7 -2
  79. package/lib/entity/tenant/clearAllEpic.js +10 -0
  80. package/lib/entity/tenant/tenantPayload.d.ts +2 -0
  81. package/lib/entity/tenant/tenantReducer.d.ts +5 -2
  82. package/lib/entity/tenant/tenantReducer.js +10 -2
  83. package/lib/entity/tenant/tenantSelector.d.ts +2 -0
  84. package/lib/entity/tenant/tenantSelector.js +17 -1
  85. package/lib/entity/tenant/tenantState.d.ts +2 -0
  86. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +4 -1
  87. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
  88. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +11 -0
  89. package/lib/entity/transaction/payloadTypes/transactionPayload.js +114 -1
  90. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +1 -0
  91. package/lib/entity/transaction/stateTypes/transaction.d.ts +11 -0
  92. package/lib/entity/transaction/stateTypes/transactionLine.d.ts +1 -1
  93. package/lib/entity/userRole/userRoleType.d.ts +2 -2
  94. package/lib/epic.d.ts +22 -2
  95. package/lib/epic.js +22 -2
  96. package/lib/esm/common/aiCfo/aiCfoSuggestedQuestionsPageContext.js +1 -0
  97. package/lib/esm/commonStateTypes/animations.js +4 -0
  98. package/lib/esm/commonStateTypes/coaBalance/coaBalancesFilterProjectView.js +5 -0
  99. package/lib/esm/commonStateTypes/projectView/projectViewParentID.js +1 -0
  100. package/lib/esm/commonStateTypes/viewAndReport/reportIDHelper.js +1 -0
  101. package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +2 -0
  102. package/lib/esm/entity/account/accountReducer.js +12 -4
  103. package/lib/esm/entity/account/accountSelector.js +4 -2
  104. package/lib/esm/entity/account/accountState.js +4 -1
  105. package/lib/esm/entity/account/subAccountSelector.js +2 -0
  106. package/lib/esm/entity/accountRecon/accountReconPayload.js +4 -2
  107. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerPayload.js +64 -0
  108. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerReducer.js +47 -0
  109. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerSelector.js +62 -0
  110. package/lib/esm/entity/aiAccountantCustomer/aiAccountantCustomerState.js +31 -0
  111. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +78 -0
  112. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +5 -1
  113. package/lib/esm/entity/project/projectPayload.js +26 -0
  114. package/lib/esm/entity/project/projectReducer.js +27 -0
  115. package/lib/esm/entity/project/projectSelector.js +8 -0
  116. package/lib/esm/entity/project/projectState.js +1 -0
  117. package/lib/esm/entity/sectionProjectView/sectionProjectView.js +3 -0
  118. package/lib/esm/entity/sectionProjectView/sectionProjectViewEpic.js +52 -0
  119. package/lib/esm/entity/sectionProjectView/sectionProjectViewHelper.js +11 -0
  120. package/lib/esm/entity/sectionProjectView/sectionProjectViewReducer.js +60 -0
  121. package/lib/esm/entity/sectionProjectView/sectionProjectViewSelector.js +50 -0
  122. package/lib/esm/entity/sectionProjectView/sectionProjectViewSelectorTypes.js +1 -0
  123. package/lib/esm/entity/sectionProjectView/sectionProjectViewState.js +1 -0
  124. package/lib/esm/entity/snackbar/snackbarTypes.js +10 -0
  125. package/lib/esm/entity/tenant/clearAllEpic.js +10 -0
  126. package/lib/esm/entity/tenant/tenantReducer.js +9 -1
  127. package/lib/esm/entity/tenant/tenantSelector.js +14 -0
  128. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
  129. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +114 -1
  130. package/lib/esm/epic.js +22 -2
  131. package/lib/esm/index.js +32 -19
  132. package/lib/esm/reducer.js +20 -2
  133. package/lib/esm/view/aiAccountantView/aiAccountantViewPayload.js +2 -0
  134. package/lib/esm/view/aiAccountantView/aiAccountantViewReducer.js +152 -0
  135. package/lib/esm/view/aiAccountantView/aiAccountantViewSelector.js +77 -0
  136. package/lib/esm/view/aiAccountantView/aiAccountantViewState.js +11 -0
  137. package/lib/esm/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.js +46 -0
  138. package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +27 -0
  139. package/lib/esm/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +47 -0
  140. package/lib/esm/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +76 -0
  141. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +82 -1
  142. package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +8 -2
  143. package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +29 -0
  144. package/lib/esm/view/classList/fetchClassListEpic.js +9 -2
  145. package/lib/esm/view/commonVendorView/vendorView/vendorViewSelector.js +18 -5
  146. package/lib/esm/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
  147. package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewReducer.js +19 -1
  148. package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewSelector.js +3 -1
  149. package/lib/esm/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +17 -0
  150. package/lib/esm/view/companyView/companyViewReducer.js +26 -1
  151. package/lib/esm/view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic.js +61 -0
  152. package/lib/esm/view/companyView/types/companyPassport/companyPassportViewState.js +4 -0
  153. package/lib/esm/view/creditAgentView/creditAgentViewReducer.js +2 -42
  154. package/lib/esm/view/creditAgentView/creditAgentViewSelector.js +0 -1
  155. package/lib/esm/view/creditAgentView/creditAgentViewState.js +0 -6
  156. package/lib/esm/view/creditAgentView/epics/downloadCreditReportEpic.js +49 -25
  157. package/lib/esm/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js +63 -0
  158. package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +4 -9
  159. package/lib/esm/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.js +65 -0
  160. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
  161. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic.js +33 -0
  162. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +3 -3
  163. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +6 -4
  164. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +20 -5
  165. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/refetchCompletedTransactionsOnBulkUploadSortEpic.js +12 -0
  166. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +98 -0
  167. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -13
  168. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +21 -5
  169. package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +0 -1
  170. package/lib/esm/view/expenseAutomationView/helpers/bulkUploadTiming.js +16 -0
  171. package/lib/esm/view/expenseAutomationView/helpers/rollingCalendarDateRangeInclusive.js +13 -0
  172. package/lib/esm/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  173. package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  174. package/lib/esm/view/expenseAutomationView/payload/missingReceiptsPayload.js +9 -0
  175. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +21 -1
  176. package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +29 -6
  177. package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +167 -3
  178. package/lib/esm/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +1 -2
  179. package/lib/esm/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +10 -2
  180. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +63 -6
  181. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +14 -4
  182. package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +136 -9
  183. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +15 -5
  184. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +24 -1
  185. package/lib/esm/view/financeStatement/financeStatementSelector.js +12 -1
  186. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +3 -0
  187. package/lib/esm/view/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.js +47 -0
  188. package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewEpic.js +30 -0
  189. package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewPayload.js +1 -0
  190. package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +113 -0
  191. package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewSelector.js +65 -0
  192. package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.js +1 -0
  193. package/lib/esm/view/profitAndLossProjectView/profitAndLossProjectViewState.js +1 -0
  194. package/lib/esm/view/reportsResync/reportsClassViewRefetchingEpic.js +4 -0
  195. package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesPayload.js +26 -0
  196. package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesReducer.js +199 -0
  197. package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +52 -0
  198. package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesState.js +1 -0
  199. package/lib/esm/view/spendManagement/autotransferRules/epics/createAutoTransferRuleEpic.js +100 -0
  200. package/lib/esm/view/spendManagement/autotransferRules/epics/deleteAutoTransferRuleEpic.js +48 -0
  201. package/lib/esm/view/spendManagement/autotransferRules/epics/fetchAutoTransferReviewDetailEpic.js +36 -0
  202. package/lib/esm/view/spendManagement/autotransferRules/epics/fetchAutoTransferRuleHistory.js +45 -0
  203. package/lib/esm/view/spendManagement/autotransferRules/epics/fetchAutoTransferRulesEpic.js +50 -0
  204. package/lib/esm/view/spendManagement/autotransferRules/epics/updateAutoTransferRuleEpic.js +69 -0
  205. package/lib/esm/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.js +5 -5
  206. package/lib/esm/view/spendManagement/billPay/billList/billListSelector.js +10 -0
  207. package/lib/esm/view/spendManagement/billPay/billList/billListState.js +1 -0
  208. package/lib/esm/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +7 -3
  209. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  210. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
  211. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
  212. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
  213. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
  214. package/lib/esm/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +7 -4
  215. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
  216. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
  217. package/lib/esm/view/spendManagement/treasury/treasuryList/epics/fetchTreasuryDetailEpic.js +2 -2
  218. package/lib/esm/view/spendManagement/treasury/treasuryList/treasuryDetailReducer.js +2 -1
  219. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
  220. package/lib/esm/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  221. package/lib/esm/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
  222. package/lib/esm/view/transactionDetail/transactionDetailSelector.js +9 -2
  223. package/lib/esm/view/twoFactorAuthentication/resendOtpEpic.js +16 -2
  224. package/lib/index.d.ts +49 -26
  225. package/lib/index.js +107 -39
  226. package/lib/reducer.d.ts +20 -2
  227. package/lib/reducer.js +20 -2
  228. package/lib/view/aiAccountantView/aiAccountantViewPayload.d.ts +33 -0
  229. package/lib/view/aiAccountantView/aiAccountantViewPayload.js +8 -0
  230. package/lib/view/aiAccountantView/aiAccountantViewReducer.d.ts +29 -0
  231. package/lib/view/aiAccountantView/aiAccountantViewReducer.js +156 -0
  232. package/lib/view/aiAccountantView/aiAccountantViewSelector.d.ts +16 -0
  233. package/lib/view/aiAccountantView/aiAccountantViewSelector.js +83 -0
  234. package/lib/view/aiAccountantView/aiAccountantViewState.d.ts +26 -0
  235. package/lib/view/aiAccountantView/aiAccountantViewState.js +13 -0
  236. package/lib/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.d.ts +33 -0
  237. package/lib/view/aiAccountantView/epics/cancelAiAccountantOnboardingEpic.js +50 -0
  238. package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.d.ts +23 -0
  239. package/lib/view/aiAccountantView/epics/fetchAiAccountantCustomersEpic.js +31 -0
  240. package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.d.ts +33 -0
  241. package/lib/view/aiAccountantView/epics/fetchAiAccountantJobsEpic.js +51 -0
  242. package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.d.ts +28 -0
  243. package/lib/view/aiAccountantView/epics/triggerAiAccountantJobEpic.js +80 -0
  244. package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +7 -0
  245. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +15 -1
  246. package/lib/view/aiCfoView/aiCfoViewReducer.js +83 -2
  247. package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +4 -1
  248. package/lib/view/aiCfoView/aiCfoViewSelector.js +9 -2
  249. package/lib/view/aiCfoView/aiCfoViewState.d.ts +15 -1
  250. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +8 -0
  251. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +33 -0
  252. package/lib/view/auditReportView/auditReportViewState.d.ts +2 -2
  253. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  254. package/lib/view/cardBalance/cardBalanceSelector.d.ts +2 -1
  255. package/lib/view/cashBalance/cashBalanceSelector.d.ts +2 -1
  256. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  257. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  258. package/lib/view/classList/fetchClassListEpic.d.ts +1 -1
  259. package/lib/view/classList/fetchClassListEpic.js +8 -1
  260. package/lib/view/commonVendorView/vendorView/vendorViewSelector.d.ts +1 -0
  261. package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +18 -5
  262. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +1 -0
  263. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
  264. package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +2 -2
  265. package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.js +20 -2
  266. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.d.ts +4 -1
  267. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.js +3 -1
  268. package/lib/view/companyTaskManagerView/companyTaskManagerViewState.d.ts +9 -1
  269. package/lib/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.d.ts +7 -0
  270. package/lib/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +21 -0
  271. package/lib/view/companyView/companyViewReducer.d.ts +6 -1
  272. package/lib/view/companyView/companyViewReducer.js +28 -2
  273. package/lib/view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic.d.ts +10 -0
  274. package/lib/view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic.js +65 -0
  275. package/lib/view/companyView/types/cockpitTypes.d.ts +6 -5
  276. package/lib/view/companyView/types/companyPassport/companyPassportViewState.d.ts +1 -0
  277. package/lib/view/companyView/types/companyPassport/companyPassportViewState.js +4 -0
  278. package/lib/view/creditAgentView/creditAgentViewPayload.d.ts +0 -36
  279. package/lib/view/creditAgentView/creditAgentViewReducer.d.ts +3 -5
  280. package/lib/view/creditAgentView/creditAgentViewReducer.js +3 -43
  281. package/lib/view/creditAgentView/creditAgentViewSelector.d.ts +0 -1
  282. package/lib/view/creditAgentView/creditAgentViewSelector.js +1 -2
  283. package/lib/view/creditAgentView/creditAgentViewState.d.ts +0 -31
  284. package/lib/view/creditAgentView/creditAgentViewState.js +0 -6
  285. package/lib/view/creditAgentView/epics/downloadCreditReportEpic.d.ts +1 -1
  286. package/lib/view/creditAgentView/epics/downloadCreditReportEpic.js +47 -23
  287. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  288. package/lib/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.d.ts +9 -0
  289. package/lib/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js +67 -0
  290. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +4 -9
  291. package/lib/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.d.ts +10 -0
  292. package/lib/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.js +69 -0
  293. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
  294. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic.d.ts +13 -0
  295. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic.js +37 -0
  296. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +2 -2
  297. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +5 -3
  298. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +20 -5
  299. package/lib/view/expenseAutomationView/epics/missingReceipts/refetchCompletedTransactionsOnBulkUploadSortEpic.d.ts +10 -0
  300. package/lib/view/expenseAutomationView/epics/missingReceipts/refetchCompletedTransactionsOnBulkUploadSortEpic.js +16 -0
  301. package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.d.ts +18 -0
  302. package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +102 -0
  303. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -13
  304. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +2 -2
  305. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +20 -4
  306. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +0 -1
  307. package/lib/view/expenseAutomationView/helpers/bulkUploadTiming.d.ts +16 -0
  308. package/lib/view/expenseAutomationView/helpers/bulkUploadTiming.js +19 -0
  309. package/lib/view/expenseAutomationView/helpers/rollingCalendarDateRangeInclusive.d.ts +7 -0
  310. package/lib/view/expenseAutomationView/helpers/rollingCalendarDateRangeInclusive.js +16 -0
  311. package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  312. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +2 -2
  313. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  314. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +1 -1
  315. package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.d.ts +5 -0
  316. package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +10 -0
  317. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +45 -0
  318. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
  319. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +22 -2
  320. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +18 -2
  321. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +30 -7
  322. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +18 -4
  323. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +168 -4
  324. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +2 -0
  325. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +2 -0
  326. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +7 -2
  327. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +2 -2
  328. package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +10 -2
  329. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +63 -6
  330. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +14 -4
  331. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +136 -9
  332. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +13 -3
  333. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +8 -0
  334. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +27 -0
  335. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +5 -1
  336. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +14 -0
  337. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  338. package/lib/view/financeStatement/financeStatementSelector.d.ts +2 -0
  339. package/lib/view/financeStatement/financeStatementSelector.js +12 -1
  340. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  341. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +3 -0
  342. package/lib/view/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.d.ts +9 -0
  343. package/lib/view/profitAndLossProjectView/profitAndLossForTimeframeProjectViewEpic.js +51 -0
  344. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewEpic.d.ts +6 -0
  345. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewEpic.js +34 -0
  346. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewPayload.d.ts +33 -0
  347. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewPayload.js +2 -0
  348. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewReducer.d.ts +33 -0
  349. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewReducer.js +117 -0
  350. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelector.d.ts +9 -0
  351. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelector.js +69 -0
  352. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.d.ts +19 -0
  353. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewSelectorTypes.js +2 -0
  354. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewState.d.ts +22 -0
  355. package/lib/view/profitAndLossProjectView/profitAndLossProjectViewState.js +2 -0
  356. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  357. package/lib/view/reportsResync/reportsClassViewRefetchingEpic.d.ts +2 -1
  358. package/lib/view/reportsResync/reportsClassViewRefetchingEpic.js +4 -0
  359. package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
  360. package/lib/view/reviewCompanyView/reviewCompanyViewState.d.ts +1 -1
  361. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  362. package/lib/view/spendManagement/autotransferRules/autoTransferRulesPayload.d.ts +75 -0
  363. package/lib/view/spendManagement/autotransferRules/autoTransferRulesPayload.js +30 -0
  364. package/lib/view/spendManagement/autotransferRules/autoTransferRulesReducer.d.ts +50 -0
  365. package/lib/view/spendManagement/autotransferRules/autoTransferRulesReducer.js +206 -0
  366. package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.d.ts +24 -0
  367. package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +61 -0
  368. package/lib/view/spendManagement/autotransferRules/autoTransferRulesState.d.ts +38 -0
  369. package/lib/view/spendManagement/autotransferRules/autoTransferRulesState.js +2 -0
  370. package/lib/view/spendManagement/autotransferRules/epics/createAutoTransferRuleEpic.d.ts +12 -0
  371. package/lib/view/spendManagement/autotransferRules/epics/createAutoTransferRuleEpic.js +106 -0
  372. package/lib/view/spendManagement/autotransferRules/epics/deleteAutoTransferRuleEpic.d.ts +8 -0
  373. package/lib/view/spendManagement/autotransferRules/epics/deleteAutoTransferRuleEpic.js +52 -0
  374. package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferReviewDetailEpic.d.ts +7 -0
  375. package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferReviewDetailEpic.js +40 -0
  376. package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferRuleHistory.d.ts +7 -0
  377. package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferRuleHistory.js +52 -0
  378. package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferRulesEpic.d.ts +10 -0
  379. package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferRulesEpic.js +54 -0
  380. package/lib/view/spendManagement/autotransferRules/epics/updateAutoTransferRuleEpic.d.ts +8 -0
  381. package/lib/view/spendManagement/autotransferRules/epics/updateAutoTransferRuleEpic.js +73 -0
  382. package/lib/view/spendManagement/billPay/billDetailView/epics/fetchBillDetailEpic.js +5 -5
  383. package/lib/view/spendManagement/billPay/billList/billListReducer.d.ts +1 -1
  384. package/lib/view/spendManagement/billPay/billList/billListSelector.js +10 -0
  385. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +2 -2
  386. package/lib/view/spendManagement/billPay/billList/billListState.js +1 -0
  387. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +7 -3
  388. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  389. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
  390. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
  391. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetailReducer.d.ts +4 -4
  392. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  393. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
  394. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
  395. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +6 -3
  396. package/lib/view/spendManagement/reimbursement/remiListView/remiListReducer.d.ts +1 -1
  397. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +1 -0
  398. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
  399. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +4 -4
  400. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
  401. package/lib/view/spendManagement/treasury/treasuryList/epics/fetchTreasuryDetailEpic.js +2 -2
  402. package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailReducer.d.ts +2 -1
  403. package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailReducer.js +2 -1
  404. package/lib/view/subscriptionView/types/subscriptionTypes.d.ts +1 -1
  405. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
  406. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  407. package/lib/view/topEx/topExSelector.d.ts +1 -1
  408. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  409. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
  410. package/lib/view/transactionDetail/transactionDetailSelector.d.ts +1 -0
  411. package/lib/view/transactionDetail/transactionDetailSelector.js +9 -2
  412. package/lib/view/twoFactorAuthentication/resendOtpEpic.d.ts +1 -1
  413. package/lib/view/twoFactorAuthentication/resendOtpEpic.js +15 -1
  414. package/package.json +1 -1
@@ -1,35 +1,59 @@
1
- import { of, from } from 'rxjs';
2
- import { catchError, filter, switchMap, mergeMap } from 'rxjs/operators';
1
+ import { of } from 'rxjs';
2
+ import { catchError, filter, switchMap } from 'rxjs/operators';
3
3
  import { downloadCreditReport, downloadCreditReportCompleted, downloadCreditReportFailed, } from '../creditAgentViewReducer';
4
- export const downloadCreditReportEpic = (actions$, _state$, _zeniAPI) => actions$.pipe(filter(downloadCreditReport.match), switchMap((action) => {
5
- const { bffBaseUrl } = action.payload;
6
- const url = `${bffBaseUrl}/api/creditAssessment?format=excel`;
7
- // Use the zeniAPI userId/sessionId from the store or fall back to a direct fetch.
8
- // The BFF proxy url is not a ZeniAPI endpoint; we build the fetch here manually
9
- // using the credentials already set on the zeniAPI instance.
10
- const promise = fetch(url, {
11
- method: 'GET',
12
- headers: {
13
- ...(_zeniAPI.userId != null ? { 'zeni-user-id': _zeniAPI.userId } : {}),
14
- ...(_zeniAPI.sessionId != null ? { 'zeni-session-id': _zeniAPI.sessionId } : {}),
15
- },
4
+ const CSV_HEADERS = [
5
+ 'Customer Name',
6
+ 'Card Status',
7
+ 'Credit Limit ($)',
8
+ 'Credit Score',
9
+ 'Recommended Amount ($)',
10
+ 'Rationale',
11
+ 'Report Date',
12
+ 'Tenant Namespace',
13
+ 'Tenant ID',
14
+ 'Company ID',
15
+ 'Updated By',
16
+ 'Updated On',
17
+ ];
18
+ function rowToCsvLine(row) {
19
+ const fields = [
20
+ row.customerName,
21
+ row.cardStatus,
22
+ row.creditLimit,
23
+ row.creditScore,
24
+ row.recommendedAmount,
25
+ row.rationale,
26
+ row.reportDate,
27
+ row.tenantNamespace,
28
+ row.tenantId,
29
+ row.companyId,
30
+ row.updatedByName,
31
+ row.updatedOn,
32
+ ];
33
+ return fields
34
+ .map((f) => {
35
+ const val = f == null ? '' : String(f);
36
+ return `"${val.replace(/"/g, '""')}"`;
16
37
  })
17
- .then(async (response) => {
18
- if (!response.ok) {
19
- throw new Error(`HTTP ${response.status}`);
20
- }
21
- const blob = await response.blob();
38
+ .join(',');
39
+ }
40
+ export const downloadCreditReportEpic = (actions$, state$, _zeniAPI) => actions$.pipe(filter(downloadCreditReport.match), switchMap(() => {
41
+ try {
42
+ const rows = state$.value.creditAgentViewState.cardProfiles.rows;
43
+ const csvLines = [CSV_HEADERS.join(','), ...rows.map(rowToCsvLine)];
44
+ const csv = csvLines.join('\n');
45
+ const blob = new Blob([csv], { type: 'text/csv;charset=utf-8;' });
22
46
  const objectUrl = URL.createObjectURL(blob);
23
47
  const link = document.createElement('a');
24
48
  link.href = objectUrl;
25
- link.setAttribute('download', 'tenant-credit-score-report.xlsx');
49
+ link.setAttribute('download', 'card-tenant-profiles.csv');
26
50
  document.body.appendChild(link);
27
51
  link.click();
28
52
  document.body.removeChild(link);
29
53
  URL.revokeObjectURL(objectUrl);
30
- });
31
- return from(promise).pipe(mergeMap(() => of(downloadCreditReportCompleted())), catchError(() => {
32
- window.alert('Failed to download the credit score report. Please try again.');
54
+ return of(downloadCreditReportCompleted());
55
+ }
56
+ catch {
33
57
  return of(downloadCreditReportFailed());
34
- }));
35
- }));
58
+ }
59
+ }), catchError(() => of(downloadCreditReportFailed())));
@@ -0,0 +1,63 @@
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 { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
7
+ import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
8
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
9
+ import { excludeAccountFromReconciliation, excludeAccountFromReconciliationFailure, excludeAccountFromReconciliationSuccess, } from '../../reducers/reconciliationViewReducer';
10
+ export const excludeAccountFromReconciliationEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(excludeAccountFromReconciliation.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 reconciliationData = getAccountReconByAccountIdAndSelectedPeriod(state, accountId, selectedPeriod);
16
+ const payload = {
17
+ account_id: accountId,
18
+ bank_balance: reconciliationData?.balance?.amount ?? null,
19
+ cleared_balance: reconciliationData?.clearedBalance?.amount ?? null,
20
+ variance: reconciliationData?.variance?.amount ?? null,
21
+ };
22
+ const apiUrl = `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/excluded-accounts`;
23
+ return zeniAPI
24
+ .postAndGetJSON(apiUrl, payload)
25
+ .pipe(mergeMap((response) => {
26
+ if (isSuccessResponse(response)) {
27
+ const newAccountKey = getAccountKey('excluded_account_reconciliation', accountId);
28
+ const oldAccountKey = getAccountKey('account_reconciliation', accountId);
29
+ return of(excludeAccountFromReconciliationSuccess({
30
+ account: response.data?.excluded_account ?? undefined,
31
+ selectedPeriod,
32
+ }), changeAccountKey({
33
+ oldKey: oldAccountKey,
34
+ newKey: newAccountKey,
35
+ }), openSnackbar({
36
+ messageSection: 'account_excluded_from_reconciliation',
37
+ messageText: 'success',
38
+ type: 'success',
39
+ variables: [
40
+ {
41
+ variableName: '_account-name_',
42
+ variableValue: reconciliationData?.account.accountName ?? '',
43
+ },
44
+ ],
45
+ }));
46
+ }
47
+ else {
48
+ return of(excludeAccountFromReconciliationFailure({
49
+ error: response.status,
50
+ }), openSnackbar({
51
+ messageSection: 'account_excluded_from_reconciliation',
52
+ messageText: 'failed',
53
+ type: 'error',
54
+ }));
55
+ }
56
+ }), catchError((error) => of(excludeAccountFromReconciliationFailure({
57
+ error: createZeniAPIStatus('Unexpected Error', `Exclude account from reconciliation REST API call errored out ${JSON.stringify(error)}`),
58
+ }), openSnackbar({
59
+ messageSection: 'account_excluded_from_reconciliation',
60
+ messageText: 'failed',
61
+ type: 'error',
62
+ }))));
63
+ }));
@@ -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,65 @@
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 { getAccountBase } from '../../../../entity/account/accountSelector';
6
+ import { getAccountKey } from '../../../../entity/account/accountState';
7
+ import { updateAccountRecon } from '../../../../entity/accountRecon/accountReconReducer';
8
+ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
9
+ import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
10
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
11
+ import { includeAccountInReconciliation, includeAccountInReconciliationFailure, includeAccountInReconciliationSuccess, } from '../../reducers/reconciliationViewReducer';
12
+ export const includeAccountInReconciliationEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(includeAccountInReconciliation.match), mergeMap((action) => {
13
+ const { accountId } = action.payload;
14
+ const state = state$.value;
15
+ const currentTenant = getCurrentTenant(state);
16
+ const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
17
+ const account = getAccountBase(state.accountState, accountId, 'excluded_account_reconciliation');
18
+ const period = convertToPeriod(selectedPeriod, true);
19
+ const query = JSON.stringify({
20
+ start_date: period.start,
21
+ end_date: period.end,
22
+ });
23
+ const apiUrl = `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/excluded-accounts/${accountId}?query=${encodeURIComponent(query)}`;
24
+ return zeniAPI
25
+ .deleteAndGetJSON(apiUrl)
26
+ .pipe(mergeMap((response) => {
27
+ if (isSuccessResponse(response) && response.data != null) {
28
+ const reconciliation = response.data.reconciliation;
29
+ const oldAccountKey = getAccountKey('excluded_account_reconciliation', reconciliation.account_id);
30
+ const newAccountKey = getAccountKey('account_reconciliation', reconciliation.account_id);
31
+ return of(updateAccountRecon(selectedPeriod, [reconciliation]), includeAccountInReconciliationSuccess({
32
+ reconciliation,
33
+ selectedPeriod,
34
+ }), changeAccountKey({
35
+ oldKey: oldAccountKey,
36
+ newKey: newAccountKey,
37
+ }), openSnackbar({
38
+ messageSection: 'account_included_in_reconciliation',
39
+ messageText: 'success',
40
+ type: 'success',
41
+ variables: [
42
+ {
43
+ variableName: '_account-name_',
44
+ variableValue: account?.accountName ?? '',
45
+ },
46
+ ],
47
+ }));
48
+ }
49
+ else {
50
+ return of(includeAccountInReconciliationFailure({
51
+ error: response.status,
52
+ }), openSnackbar({
53
+ messageSection: 'account_included_in_reconciliation',
54
+ messageText: 'failed',
55
+ type: 'error',
56
+ }));
57
+ }
58
+ }), catchError((error) => of(includeAccountInReconciliationFailure({
59
+ error: createZeniAPIStatus('Unexpected Error', `Include account in reconciliation REST API call errored out ${JSON.stringify(error)}`),
60
+ }), openSnackbar({
61
+ messageSection: 'account_included_in_reconciliation',
62
+ messageText: 'failed',
63
+ type: 'error',
64
+ }))));
65
+ }));
@@ -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
  ],
@@ -0,0 +1,33 @@
1
+ import { merge, of } from 'rxjs';
2
+ import { filter, mergeMap, switchMap, take, takeUntil } from 'rxjs/operators';
3
+ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
+ import { bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetailsSuccess, restoreBulkUploadMatchingState, storeBatchDetails, } from '../../reducers/missingReceiptsViewReducer';
5
+ /**
6
+ * Show a success toast when batch details arrive for the current upload batch,
7
+ * e.g. "17 out of 20 Receipts Matched". Scoped per upload session so it fires
8
+ * only once: starts on `bulkUploadReceiptsSuccess` (or `restoreBulkUploadMatchingState`
9
+ * for a restored session), waits for the first batch-details action for that batch,
10
+ * emits the toast, then stops. `clearBulkUpload` cancels the in-flight wait.
11
+ */
12
+ export const bulkUploadMatchResultToastEpic = (actions$) => actions$.pipe(filter((action) => bulkUploadReceiptsSuccess.match(action) ||
13
+ restoreBulkUploadMatchingState.match(action)), switchMap((uploadAction) => {
14
+ const { batchId } = uploadAction.payload;
15
+ return merge(actions$.pipe(filter(fetchBulkUploadBatchDetailsSuccess.match)), actions$.pipe(filter(storeBatchDetails.match))).pipe(filter((a) => a.payload.batchId === batchId), take(1), mergeMap((action) => {
16
+ const { summary } = action.payload;
17
+ return of(openSnackbar({
18
+ messageSection: 'receipts_bulk_match',
19
+ messageText: 'success',
20
+ type: 'success',
21
+ variables: [
22
+ {
23
+ variableName: '_matched_',
24
+ variableValue: String(summary.matched),
25
+ },
26
+ {
27
+ variableName: '_total_',
28
+ variableValue: String(summary.total),
29
+ },
30
+ ],
31
+ }));
32
+ }), takeUntil(actions$.pipe(filter(clearBulkUpload.match))));
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
- import { BULK_UPLOAD_BAR_COMPLETE_HOLD_MS } from '../../bulkUploadTiming';
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) {
@@ -1,10 +1,12 @@
1
1
  import { of } from 'rxjs';
2
2
  import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
- import { convertToPeriod, toMonthYearPeriodId, } from '../../../../commonStateTypes/timePeriod';
3
+ import { toMonthYearPeriodId } from '../../../../commonStateTypes/timePeriod';
4
4
  import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
5
5
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
6
6
  import { toBatchListItem, } from '../../payload/missingReceiptsPayload';
7
7
  import { fetchBulkUploadBatches, fetchBulkUploadBatchesFailure, fetchBulkUploadBatchesSuccess, } from '../../reducers/missingReceiptsViewReducer';
8
+ import { BULK_UPLOAD_BATCH_LIST_DATE_RANGE_DAYS } from '../../helpers/bulkUploadTiming';
9
+ import { rollingCalendarDateRangeInclusive } from '../../helpers/rollingCalendarDateRangeInclusive';
8
10
  export const fetchBulkUploadBatchesEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchBulkUploadBatches.match), switchMap((action) => {
9
11
  const { cacheOverride } = action.payload;
10
12
  const state = state$.value;
@@ -19,10 +21,10 @@ export const fetchBulkUploadBatchesEpic = (actions$, state$, zeniAPI) => actions
19
21
  selectedPeriod,
20
22
  }));
21
23
  }
22
- const period = convertToPeriod(selectedPeriod);
24
+ const { end, start } = rollingCalendarDateRangeInclusive(BULK_UPLOAD_BATCH_LIST_DATE_RANGE_DAYS);
23
25
  const queryParam = {
24
- start_date: period.start,
25
- end_date: period.end,
26
+ start_date: start,
27
+ end_date: end,
26
28
  sort_order: 'desc',
27
29
  };
28
30
  return zeniAPI
@@ -12,7 +12,13 @@ export const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => act
12
12
  const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
13
13
  const periodId = toMonthYearPeriodId(selectedPeriod);
14
14
  const isInitialLoad = action.payload.pageToken == null;
15
- const cacheKey = getCompletedTransactionsCacheKey(periodId, bulkUpload.sortKey, bulkUpload.sortOrder, bulkUpload.completedSubTab);
15
+ /**
16
+ * Snapshot sort config + subTab at request time so success/failure write
17
+ * into the same cache key the request was made under, even if the user
18
+ * toggles sort while the request is in flight.
19
+ */
20
+ const { sortKey, sortOrder, completedSubTab } = bulkUpload;
21
+ const cacheKey = getCompletedTransactionsCacheKey(periodId, sortKey, sortOrder, completedSubTab);
16
22
  const existingData = bulkUpload.completedTransactionsByPeriod[cacheKey];
17
23
  if (isInitialLoad &&
18
24
  action.payload.cacheOverride !== true &&
@@ -24,13 +30,13 @@ export const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => act
24
30
  const queryPayload = {
25
31
  start_date: period.start,
26
32
  end_date: period.end,
27
- sort_by: bulkUpload.sortKey,
28
- sort_order: bulkUpload.sortOrder === 'ascending' ? 'asc' : 'desc',
33
+ sort_by: sortKey,
34
+ sort_order: sortOrder === 'ascending' ? 'asc' : 'desc',
29
35
  page_token: action.payload.pageToken ?? null,
30
36
  page_size: 25,
31
37
  };
32
- if (bulkUpload.completedSubTab !== 'all') {
33
- queryPayload.match_type = bulkUpload.completedSubTab;
38
+ if (completedSubTab !== 'all') {
39
+ queryPayload.match_type = completedSubTab;
34
40
  }
35
41
  const encodedQuery = encodeURIComponent(JSON.stringify(queryPayload));
36
42
  return zeniAPI
@@ -46,16 +52,25 @@ export const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => act
46
52
  nextPageToken: response.data.next_page_token,
47
53
  totalCount: response.data.total_count,
48
54
  selectedPeriod,
55
+ sortKey,
56
+ sortOrder,
57
+ completedSubTab,
49
58
  }));
50
59
  return from(updateActions);
51
60
  }
52
61
  return of(fetchCompletedTransactionsFailure({
53
62
  error: response.status,
54
63
  selectedPeriod,
64
+ sortKey,
65
+ sortOrder,
66
+ completedSubTab,
55
67
  }));
56
68
  }), catchError((error) => of(fetchCompletedTransactionsFailure({
57
69
  error: createZeniAPIStatus('Unexpected Error', 'Fetch completed transactions errored: ' +
58
70
  JSON.stringify(error)),
59
71
  selectedPeriod,
72
+ sortKey,
73
+ sortOrder,
74
+ completedSubTab,
60
75
  }))));
61
76
  }));
@@ -0,0 +1,12 @@
1
+ import { of } from 'rxjs';
2
+ import { filter, mergeMap } from 'rxjs/operators';
3
+ import { fetchCompletedTransactions, setBulkUploadCompletedSubTab, setBulkUploadSortConfig, } from '../../reducers/missingReceiptsViewReducer';
4
+ /**
5
+ * Completed transactions are cached per sort key/order/sub-tab. After a sort or sub-tab
6
+ * change, the fetch epic would otherwise skip the network when that cache entry already
7
+ * exists — dispatch a cache-bypassing initial fetch whenever either changes from the UI.
8
+ */
9
+ export const refetchCompletedTransactionsOnBulkUploadSortEpic = (actions$) => {
10
+ return actions$.pipe(filter((action) => setBulkUploadSortConfig.match(action) ||
11
+ setBulkUploadCompletedSubTab.match(action)), mergeMap(() => of(fetchCompletedTransactions(undefined, true))));
12
+ };
@@ -0,0 +1,98 @@
1
+ import { EMPTY, concat, from, of } from 'rxjs';
2
+ import { catchError, concatMap, filter, mergeMap, take } from 'rxjs/operators';
3
+ import { isSuccessResponse } from '../../../../responsePayload';
4
+ import { isBatchDetailsStatusPendingOrProcessing, toBatchListItem, } from '../../payload/missingReceiptsPayload';
5
+ import { fetchBulkUploadBatchesSuccess, restoreBulkUploadAutomatchingOnMount, restoreBulkUploadMatchingState, } from '../../reducers/missingReceiptsViewReducer';
6
+ import { BULK_UPLOAD_BATCH_LIST_DATE_RANGE_DAYS } from '../../helpers/bulkUploadTiming';
7
+ import { rollingCalendarDateRangeInclusive } from '../../helpers/rollingCalendarDateRangeInclusive';
8
+ import { toMonthYearPeriodId } from '../../../../commonStateTypes/timePeriod';
9
+ import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
10
+ /**
11
+ * On missing-receipts entry / period switch, hydrate the automatching banner for the logged-in
12
+ * user without relying on UI-driven list fetches (the Missing tab does not fetch the batch list
13
+ * while `phase === 'idle'`). Flow:
14
+ * 1. Call `GET /1.0/batches` (rolling 30-day window).
15
+ * 2. Emit `fetchBulkUploadBatchesSuccess` so `batchListByPeriod` is populated for the selected
16
+ * period (prevents a duplicate list fetch when the user switches to the Unmatched tab).
17
+ * 3. For each `processing|pending` row, call `GET /1.0/batches/:id` in order; for the first row
18
+ * whose details `user_id` matches the logged-in user and whose status is still
19
+ * pending/processing, dispatch `restoreBulkUploadMatchingState` and stop.
20
+ */
21
+ export const restoreBulkUploadAutomatchingOnMountEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(restoreBulkUploadAutomatchingOnMount.match), mergeMap(() => {
22
+ const state = state$.value;
23
+ const { expenseAutomationMissingReceiptsViewState: { bulkUpload }, expenseAutomationViewState: { selectedPeriodByTenantId }, } = state;
24
+ if (bulkUpload.phase !== 'idle') {
25
+ return EMPTY;
26
+ }
27
+ if (bulkUpload.batchListFetchState.fetchState === 'In-Progress') {
28
+ return EMPTY;
29
+ }
30
+ const loggedInUserId = state.tenantState.loggedInUser?.userId;
31
+ if (loggedInUserId == null) {
32
+ return EMPTY;
33
+ }
34
+ const currentTenant = getCurrentTenant(state);
35
+ const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
36
+ if (selectedPeriod == null) {
37
+ return EMPTY;
38
+ }
39
+ const { end, start } = rollingCalendarDateRangeInclusive(BULK_UPLOAD_BATCH_LIST_DATE_RANGE_DAYS);
40
+ const queryParam = {
41
+ start_date: start,
42
+ end_date: end,
43
+ sort_order: 'desc',
44
+ };
45
+ const listUrl = `${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches?query=${encodeURIComponent(JSON.stringify(queryParam))}`;
46
+ const detailsBaseUrl = `${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches/`;
47
+ const periodId = toMonthYearPeriodId(selectedPeriod);
48
+ const alreadyCached = (bulkUpload.batchListByPeriod[periodId] ?? []).length > 0 &&
49
+ bulkUpload.batchListFetchState.fetchState === 'Completed';
50
+ const listSource = alreadyCached
51
+ ? of(null)
52
+ : zeniAPI.getJSON(listUrl).pipe(catchError(() => of(null)));
53
+ return listSource.pipe(mergeMap((listResponse) => {
54
+ const batchList = alreadyCached
55
+ ? bulkUpload.batchListByPeriod[periodId] ?? []
56
+ : listResponse != null &&
57
+ isSuccessResponse(listResponse) &&
58
+ listResponse.data != null
59
+ ? listResponse.data.batches.map(toBatchListItem)
60
+ : null;
61
+ if (batchList == null) {
62
+ return EMPTY;
63
+ }
64
+ const successAction = alreadyCached
65
+ ? null
66
+ : fetchBulkUploadBatchesSuccess({
67
+ batchList,
68
+ selectedPeriod,
69
+ });
70
+ const processingBatches = batchList.filter((b) => {
71
+ const status = b.status.toLowerCase();
72
+ return status === 'processing' || status === 'pending';
73
+ });
74
+ const restoreStream = from(processingBatches).pipe(concatMap((batch) => zeniAPI
75
+ .getJSON(`${detailsBaseUrl}${batch.batchId}`)
76
+ .pipe(mergeMap((response) => {
77
+ if (!isSuccessResponse(response) || response.data == null) {
78
+ return EMPTY;
79
+ }
80
+ const data = response.data;
81
+ const detailsUserId = data.user_id;
82
+ if (detailsUserId == null ||
83
+ detailsUserId !== loggedInUserId) {
84
+ return EMPTY;
85
+ }
86
+ if (!isBatchDetailsStatusPendingOrProcessing(data.status)) {
87
+ return EMPTY;
88
+ }
89
+ return of(restoreBulkUploadMatchingState({
90
+ batchId: batch.batchId,
91
+ totalFiles: batch.totalFiles,
92
+ }));
93
+ }), catchError(() => EMPTY))), take(1));
94
+ return successAction != null
95
+ ? concat(of(successAction), restoreStream)
96
+ : restoreStream;
97
+ }));
98
+ }));
@@ -1,18 +1,19 @@
1
1
  import { EMPTY, from, merge, of } from 'rxjs';
2
2
  import { catchError, debounceTime, filter, mergeMap, switchMap, } from 'rxjs/operators';
3
- import { convertToPeriod } from '../../../../commonStateTypes/timePeriod';
4
- import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
5
3
  import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
6
4
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
7
5
  import { supportedTransactionPayloadToManualSearchResult } from '../../payload/missingReceiptsPayload';
8
6
  import { searchTransactionsForManualMatch, searchTransactionsForManualMatchFailure, searchTransactionsForManualMatchSuccess, } from '../../reducers/missingReceiptsViewReducer';
9
7
  import { toTransactionsSortKey } from '../../types/transactionsViewState';
8
+ import { rollingCalendarDateRangeInclusive } from '../../helpers/rollingCalendarDateRangeInclusive';
10
9
  /**
11
10
  * `auto_categorized` for manual transaction search (Unmatched).
12
11
  * Backend contract TBD — align with `fetchTransactionCategorizationEpic` (`selectedTab === 'autoCategorized'`)
13
12
  * when the expense-automation API documents the intended filter for this flow.
14
13
  */
15
14
  export const MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED = false;
15
+ /** Inclusive rolling window for manual match search (ignores accounting period picker). */
16
+ const MANUAL_SEARCH_TRANSACTION_DATE_RANGE_DAYS = 90;
16
17
  export const searchTransactionsForManualMatchEpic = (actions$, state$, zeniAPI) => {
17
18
  const searchActions$ = actions$.pipe(filter(searchTransactionsForManualMatch.match));
18
19
  const pagination$ = searchActions$.pipe(filter((action) => action.payload.pageToken != null));
@@ -29,18 +30,11 @@ export const searchTransactionsForManualMatchEpic = (actions$, state$, zeniAPI)
29
30
  return EMPTY;
30
31
  }
31
32
  const state = state$.value;
32
- const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload: { manualSearch, sortKey, sortOrder }, }, } = state;
33
- const currentTenant = getCurrentTenant(state);
34
- const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
35
- if (selectedPeriod == null) {
36
- return of(searchTransactionsForManualMatchFailure({
37
- error: createZeniAPIStatus('Unexpected Error', 'Manual search requires a selected accounting period.'),
38
- }));
39
- }
40
- const period = convertToPeriod(selectedPeriod);
33
+ const { expenseAutomationMissingReceiptsViewState: { bulkUpload: { manualSearch, sortKey, sortOrder }, }, } = state;
34
+ const { end, start } = rollingCalendarDateRangeInclusive(MANUAL_SEARCH_TRANSACTION_DATE_RANGE_DAYS);
41
35
  const queryParam = {
42
- start_date: period.start,
43
- end_date: period.end,
36
+ start_date: start,
37
+ end_date: end,
44
38
  auto_categorized: MANUAL_TRANSACTION_SEARCH_AUTO_CATEGORIZED,
45
39
  sort_by: toTransactionsSortKey(sortKey),
46
40
  sort_order: sortOrder === 'ascending' ? 'asc' : 'desc',
@@ -3,11 +3,13 @@ import { catchError, debounceTime, filter, mergeMap, switchMap, takeUntil, } fro
3
3
  import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
4
  import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
5
5
  import { isSuccessResponse } from '../../../../responsePayload';
6
- import { BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS } from '../../bulkUploadTiming';
6
+ import { BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS } from '../../helpers/bulkUploadTiming';
7
7
  import { extractTransactionPayloadsFromBatchFiles, isBatchDetailsApiStatusCompleted, toBatchDetails, } from '../../payload/missingReceiptsPayload';
8
- import { bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation, } from '../../reducers/missingReceiptsViewReducer';
8
+ import { bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, clearBulkUpload, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation, restoreBulkUploadMatchingState, } from '../../reducers/missingReceiptsViewReducer';
9
9
  /** First poll after upload; then interval while batch not resolved via Pusher or API. */
10
10
  const FALLBACK_FIRST_DELAY_MS = 30000;
11
+ /** Shorter first poll for restored sessions — batch may already be near completion. */
12
+ const RESTORE_FIRST_DELAY_MS = 5000;
11
13
  const FALLBACK_POLL_INTERVAL_MS = 10000;
12
14
  /**
13
15
  * On Pusher batch completion: refresh batch list (then fetchMultipleBatchDetailsEpic runs),
@@ -25,16 +27,25 @@ export const pusherBatchStatusCompletionEpic = (actions$) => actions$.pipe(filte
25
27
  * force `phase` to `completed` (dismiss automatching banner) and refresh the batch list.
26
28
  * Cancels when the batch completes normally, bulk state is cleared, or another upload supersedes.
27
29
  */
28
- export const bulkUploadAutomatchingTimeoutEpic = (actions$, state$) => actions$.pipe(filter(bulkUploadReceiptsSuccess.match), mergeMap((action) => {
30
+ export const bulkUploadAutomatchingTimeoutEpic = (actions$, state$) => actions$.pipe(filter((action) => bulkUploadReceiptsSuccess.match(action) ||
31
+ restoreBulkUploadMatchingState.match(action)), mergeMap((action) => {
29
32
  const { batchId } = action.payload;
30
33
  return timer(BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS).pipe(mergeMap(() => {
31
34
  const bulk = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
32
35
  if (bulk.phase !== 'matching' || bulk.currentBatchId !== batchId) {
33
36
  return EMPTY;
34
37
  }
38
+ /**
39
+ * Also request the single-batch details directly so the "X out of Y Receipts Matched"
40
+ * toast still fires when the backend actually completed between the last Pusher ping
41
+ * and this timeout. If Pusher already tagged the batch as still `processing`,
42
+ * `fetchBulkUploadBatchDetailsEpic`'s guard will skip the call and we simply rely on
43
+ * the list refresh to eventually populate details via `fetchMultipleBatchDetailsEpic`.
44
+ */
35
45
  return from([
36
46
  bulkUploadAutomatchingTimedOut(batchId),
37
47
  fetchBulkUploadBatches({ cacheOverride: true }),
48
+ fetchBulkUploadBatchDetails(),
38
49
  ]);
39
50
  }), takeUntil(merge(actions$.pipe(filter(clearBulkUpload.match)), actions$.pipe(filter(pusherBatchStatusUpdate.match), filter((a) => a.payload.batchId === batchId &&
40
51
  a.payload.status === 'completed')), actions$.pipe(filter(fetchBulkUploadBatchDetailsSuccess.match), filter((a) => a.payload.batchId === batchId)))));
@@ -44,10 +55,15 @@ export const bulkUploadAutomatchingTimeoutEpic = (actions$, state$) => actions$.
44
55
  * error snackbar per upload session (first failure only) so the user is not spammed every
45
56
  * interval; Pusher or a later successful poll still completes the flow.
46
57
  */
47
- export const pollBulkUploadBatchStatusEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(bulkUploadReceiptsSuccess.match), mergeMap((action) => {
58
+ export const pollBulkUploadBatchStatusEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter((action) => bulkUploadReceiptsSuccess.match(action) ||
59
+ restoreBulkUploadMatchingState.match(action)), mergeMap((action) => {
48
60
  const { batchId } = action.payload;
49
61
  let pollErrorNotified = false;
50
- return timer(FALLBACK_FIRST_DELAY_MS, 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
62
+ const firstDelay = restoreBulkUploadMatchingState.match(action)
63
+ ? RESTORE_FIRST_DELAY_MS
64
+ : FALLBACK_FIRST_DELAY_MS;
65
+ 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 &&
66
+ 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
51
67
  .getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches/${batchId}`)
52
68
  .pipe(mergeMap((response) => {
53
69
  /** 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
  ];