@zeniai/client-epic-state 4.19.97 → 4.19.99-beta0ND

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 (251) hide show
  1. package/lib/commonStateTypes/animations.d.ts +1 -1
  2. package/lib/commonStateTypes/coaBalance/coaBalanceType.d.ts +2 -0
  3. package/lib/commonStateTypes/coaBalance/coaBalanceType.js +6 -0
  4. package/lib/commonStateTypes/currencyHelper.d.ts +3 -0
  5. package/lib/commonStateTypes/currencyHelper.js +6 -1
  6. package/lib/commonStateTypes/reduceFetchState.d.ts +9 -0
  7. package/lib/commonStateTypes/reduceFetchState.js +26 -0
  8. package/lib/entity/account/accountPayload.d.ts +2 -0
  9. package/lib/entity/account/accountPayload.js +2 -0
  10. package/lib/entity/account/accountState.d.ts +2 -0
  11. package/lib/entity/aiCfo/aiCfoSelector.d.ts +1 -2
  12. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
  13. package/lib/entity/customer/customerState.d.ts +0 -2
  14. package/lib/entity/customer/customerState.js +0 -5
  15. package/lib/entity/depositAccount/depositAccount.d.ts +1 -1
  16. package/lib/entity/depositAccount/depositAccount.js +8 -1
  17. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +35 -0
  18. package/lib/entity/jeSchedules/jeSchedulesPayload.js +44 -0
  19. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +2 -1
  20. package/lib/entity/jeSchedules/jeSchedulesSelector.js +2 -1
  21. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +13 -0
  22. package/lib/entity/reimbursement/reimbursementPayload.d.ts +2 -0
  23. package/lib/entity/reimbursement/reimbursementPayload.js +7 -0
  24. package/lib/entity/reimbursement/reimbursementState.d.ts +2 -0
  25. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  26. package/lib/entity/snackbar/snackbarTypes.js +1 -0
  27. package/lib/entity/task/taskPayload.d.ts +1 -0
  28. package/lib/entity/task/taskPayload.js +1 -0
  29. package/lib/entity/task/taskState.d.ts +1 -0
  30. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  31. package/lib/entity/tenant/tenantReducer.js +1 -0
  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/transactionPayload.d.ts +3 -0
  36. package/lib/entity/transaction/payloadTypes/transactionPayload.js +11 -0
  37. package/lib/entity/transaction/stateTypes/transaction.d.ts +3 -0
  38. package/lib/entity/transaction/stateTypes/transactionLine.d.ts +1 -1
  39. package/lib/entity/userGroups/userGroupsPayload.d.ts +7 -0
  40. package/lib/entity/userGroups/userGroupsPayload.js +10 -0
  41. package/lib/entity/userGroups/userGroupsReducer.d.ts +8 -0
  42. package/lib/entity/userGroups/userGroupsReducer.js +29 -0
  43. package/lib/entity/userGroups/userGroupsSelector.d.ts +4 -0
  44. package/lib/entity/userGroups/userGroupsSelector.js +12 -0
  45. package/lib/entity/userGroups/userGroupsState.d.ts +9 -0
  46. package/lib/entity/userGroups/userGroupsState.js +2 -0
  47. package/lib/epic.d.ts +13 -1
  48. package/lib/epic.js +13 -1
  49. package/lib/esm/commonStateTypes/coaBalance/coaBalanceType.js +5 -0
  50. package/lib/esm/commonStateTypes/currencyHelper.js +5 -0
  51. package/lib/esm/commonStateTypes/reduceFetchState.js +25 -0
  52. package/lib/esm/entity/account/accountPayload.js +2 -0
  53. package/lib/esm/entity/customer/customerState.js +1 -4
  54. package/lib/esm/entity/depositAccount/depositAccount.js +8 -1
  55. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +44 -0
  56. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +2 -1
  57. package/lib/esm/entity/reimbursement/reimbursementPayload.js +7 -0
  58. package/lib/esm/entity/snackbar/snackbarTypes.js +1 -0
  59. package/lib/esm/entity/task/taskPayload.js +1 -0
  60. package/lib/esm/entity/tenant/tenantReducer.js +1 -0
  61. package/lib/esm/entity/tenant/tenantSelector.js +7 -0
  62. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +11 -0
  63. package/lib/esm/entity/userGroups/userGroupsPayload.js +7 -0
  64. package/lib/esm/entity/userGroups/userGroupsReducer.js +25 -0
  65. package/lib/esm/entity/userGroups/userGroupsSelector.js +8 -0
  66. package/lib/esm/entity/userGroups/userGroupsState.js +1 -0
  67. package/lib/esm/epic.js +13 -1
  68. package/lib/esm/index.js +25 -16
  69. package/lib/esm/reducer.js +6 -0
  70. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +82 -1
  71. package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +8 -2
  72. package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +29 -0
  73. package/lib/esm/view/arAgingView/arAgingReport/arAgingReducer.js +1 -1
  74. package/lib/esm/view/arAgingView/arAgingReport/arAgingSelector.js +1 -1
  75. package/lib/esm/view/classList/fetchClassListEpic.js +9 -2
  76. package/lib/esm/view/commonVendorView/vendorView/vendorViewSelector.js +18 -5
  77. package/lib/esm/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
  78. package/lib/esm/view/expenseAutomationView/bulkUploadTiming.js +10 -0
  79. package/lib/esm/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +8 -3
  80. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +29 -0
  81. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +49 -0
  82. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +40 -0
  83. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +47 -0
  84. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +61 -0
  85. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +33 -0
  86. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +56 -0
  87. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +77 -0
  88. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +7 -5
  89. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +79 -0
  90. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +24 -0
  91. package/lib/esm/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  92. package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  93. package/lib/esm/view/expenseAutomationView/payload/missingReceiptsPayload.js +189 -1
  94. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +17 -1
  95. package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +433 -2
  96. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +23 -1
  97. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +50 -3
  98. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +245 -2
  99. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
  100. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +17 -1
  101. package/lib/esm/view/expenseAutomationView/types/missingReceiptsViewState.js +44 -0
  102. package/lib/esm/view/expenseAutomationView/types/transactionsViewState.js +2 -1
  103. package/lib/esm/view/financeStatement/financeStatementReducer.js +11 -8
  104. package/lib/esm/view/financeStatement/financeStatementSelector.js +24 -9
  105. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +322 -0
  106. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +9 -0
  107. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +6 -1
  108. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -29
  109. package/lib/esm/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +7 -5
  110. package/lib/esm/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +201 -0
  111. package/lib/esm/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.js +9 -7
  112. package/lib/esm/view/spendManagement/billPay/billList/billListSelector.js +10 -0
  113. package/lib/esm/view/spendManagement/billPay/billList/billListState.js +1 -0
  114. package/lib/esm/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +7 -3
  115. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  116. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
  117. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
  118. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
  119. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
  120. package/lib/esm/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +7 -4
  121. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
  122. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
  123. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +3 -3
  124. package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +1 -0
  125. package/lib/esm/view/taskManager/taskListView/taskListSelector.js +3 -1
  126. package/lib/esm/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  127. package/lib/esm/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
  128. package/lib/esm/view/userGroupListView/userGroupListViewReducer.js +65 -0
  129. package/lib/esm/view/userGroupListView/userGroupListViewSelector.js +16 -0
  130. package/lib/esm/view/userGroupListView/userGroupListViewState.js +1 -0
  131. package/lib/esm/view/userListView/fetchUserListByTypeEpic.js +11 -0
  132. package/lib/esm/zeniAPI.js +0 -2
  133. package/lib/index.d.ts +31 -21
  134. package/lib/index.js +102 -34
  135. package/lib/reducer.d.ts +6 -0
  136. package/lib/reducer.js +6 -0
  137. package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
  138. package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +7 -0
  139. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +15 -1
  140. package/lib/view/aiCfoView/aiCfoViewReducer.js +83 -2
  141. package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +4 -1
  142. package/lib/view/aiCfoView/aiCfoViewSelector.js +9 -2
  143. package/lib/view/aiCfoView/aiCfoViewState.d.ts +18 -1
  144. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +8 -0
  145. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +33 -0
  146. package/lib/view/arAgingView/arAgingReport/arAgingReducer.js +2 -2
  147. package/lib/view/arAgingView/arAgingReport/arAgingSelector.js +5 -5
  148. package/lib/view/auditReportView/auditReportViewState.d.ts +1 -1
  149. package/lib/view/classList/fetchClassListEpic.d.ts +1 -1
  150. package/lib/view/classList/fetchClassListEpic.js +8 -1
  151. package/lib/view/commonVendorView/vendorView/vendorViewSelector.d.ts +1 -0
  152. package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +18 -5
  153. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +1 -0
  154. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
  155. package/lib/view/expenseAutomationView/bulkUploadTiming.d.ts +10 -0
  156. package/lib/view/expenseAutomationView/bulkUploadTiming.js +13 -0
  157. package/lib/view/expenseAutomationView/epics/accountRecon/saveReconciliationReviewEpic.js +8 -3
  158. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.d.ts +18 -0
  159. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +33 -0
  160. package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.d.ts +7 -0
  161. package/lib/view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic.js +53 -0
  162. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.d.ts +8 -0
  163. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchDetailsEpic.js +44 -0
  164. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.d.ts +7 -0
  165. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +51 -0
  166. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.d.ts +8 -0
  167. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchCompletedTransactionsEpic.js +65 -0
  168. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.d.ts +8 -0
  169. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMoreBatchDetailsEpic.js +37 -0
  170. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.d.ts +9 -0
  171. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchMultipleBatchDetailsEpic.js +61 -0
  172. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.d.ts +14 -0
  173. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +81 -0
  174. package/lib/view/expenseAutomationView/epics/missingReceipts/uploadMissingReceiptSuccessEpic.js +7 -5
  175. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +25 -0
  176. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +85 -0
  177. package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.d.ts +7 -0
  178. package/lib/view/expenseAutomationView/epics/transactionCategorization/uploadTransactionReceiptSuccessEpic.js +28 -0
  179. package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  180. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  181. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  182. package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.d.ts +118 -0
  183. package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +201 -0
  184. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
  185. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +18 -2
  186. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +76 -3
  187. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +434 -2
  188. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +11 -3
  189. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +24 -2
  190. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +2 -0
  191. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +69 -1
  192. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +1 -0
  193. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +50 -3
  194. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.d.ts +1 -1
  195. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +244 -1
  196. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
  197. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +5 -0
  198. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +19 -0
  199. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +142 -0
  200. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.js +54 -1
  201. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +2 -1
  202. package/lib/view/expenseAutomationView/types/transactionsViewState.js +2 -1
  203. package/lib/view/financeStatement/financeStatementReducer.js +11 -8
  204. package/lib/view/financeStatement/financeStatementSelector.d.ts +2 -0
  205. package/lib/view/financeStatement/financeStatementSelector.js +24 -9
  206. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.d.ts +13 -0
  207. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +326 -0
  208. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.d.ts +111 -0
  209. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelectorTypes.js +13 -0
  210. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.d.ts +4 -2
  211. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewReducer.js +7 -2
  212. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewSelector.js +2 -29
  213. package/lib/view/profitAndLossClassesView/profitAndLossClassesViewState.d.ts +4 -0
  214. package/lib/view/profitAndLossClassesView/profitAndLossForTimeframeClassesViewEpic.js +7 -5
  215. package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.d.ts +6 -0
  216. package/lib/view/profitAndLossClassesView/profitAndLossHorizontalEnrichment.js +204 -0
  217. package/lib/view/reportUIOptions/updateReportUIOptionCOABalancesRangeEpic.js +8 -6
  218. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  219. package/lib/view/spendManagement/billPay/billList/billListSelector.js +10 -0
  220. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
  221. package/lib/view/spendManagement/billPay/billList/billListState.js +1 -0
  222. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +7 -3
  223. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  224. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
  225. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
  226. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  227. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
  228. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
  229. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +6 -3
  230. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +1 -0
  231. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
  232. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
  233. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
  234. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +3 -3
  235. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +1 -0
  236. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +1 -0
  237. package/lib/view/taskManager/taskListView/taskListSelector.d.ts +2 -0
  238. package/lib/view/taskManager/taskListView/taskListSelector.js +3 -1
  239. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  240. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
  241. package/lib/view/userGroupListView/userGroupListViewReducer.d.ts +23 -0
  242. package/lib/view/userGroupListView/userGroupListViewReducer.js +69 -0
  243. package/lib/view/userGroupListView/userGroupListViewSelector.d.ts +7 -0
  244. package/lib/view/userGroupListView/userGroupListViewSelector.js +20 -0
  245. package/lib/view/userGroupListView/userGroupListViewState.d.ts +8 -0
  246. package/lib/view/userGroupListView/userGroupListViewState.js +2 -0
  247. package/lib/view/userListView/fetchUserListByTypeEpic.d.ts +3 -1
  248. package/lib/view/userListView/fetchUserListByTypeEpic.js +11 -0
  249. package/lib/view/userListView/userListViewPayload.d.ts +2 -0
  250. package/lib/zeniAPI.js +0 -2
  251. package/package.json +2 -2
@@ -1,4 +1,19 @@
1
1
  import { createSlice } from '@reduxjs/toolkit';
2
+ function removeSessionIdFromPageKeyMap(draft, sessionId) {
3
+ const map = draft.uiState.chatSessionIdByPageKey;
4
+ for (const key of Object.keys(map)) {
5
+ if (map[key] === sessionId) {
6
+ delete map[key];
7
+ }
8
+ }
9
+ }
10
+ function mirrorCurrentSessionToPageKeyMapIfActive(draft) {
11
+ const key = draft.uiState.aiCfoSidePanelHostPageKey;
12
+ const sessionId = draft.uiState.currentChatSessionId;
13
+ if (key != null && sessionId != null) {
14
+ draft.uiState.chatSessionIdByPageKey[key] = sessionId;
15
+ }
16
+ }
2
17
  export const initialAiCfoViewState = {
3
18
  fetchState: 'Not-Started',
4
19
  error: undefined,
@@ -6,6 +21,8 @@ export const initialAiCfoViewState = {
6
21
  currentInput: '',
7
22
  scrollPositionByChatSessionId: {},
8
23
  currentChatSessionId: undefined,
24
+ aiCfoSidePanelHostPageKey: undefined,
25
+ chatSessionIdByPageKey: {},
9
26
  agentId: undefined,
10
27
  chatHistoryNextPageToken: {},
11
28
  chatSessionsNextPageToken: { nextPageToken: null, hasMore: false },
@@ -29,6 +46,7 @@ export const initialAiCfoViewState = {
29
46
  fetchChatSessionHistoryByChatSessionId: {},
30
47
  responseStateByChatSessionId: {},
31
48
  stopSubmitStateByChatSessionId: {},
49
+ suggestedQuestionsByPageContext: {},
32
50
  };
33
51
  const aiCfoView = createSlice({
34
52
  name: 'aiCfoView',
@@ -162,6 +180,7 @@ const aiCfoView = createSlice({
162
180
  setSession(draft, action) {
163
181
  draft.uiState.currentChatSessionId = action.payload.sessionId;
164
182
  draft.uiState.agentId = action.payload.agentId;
183
+ mirrorCurrentSessionToPageKeyMapIfActive(draft);
165
184
  },
166
185
  createSession: {
167
186
  reducer(draft, action) {
@@ -185,6 +204,7 @@ const aiCfoView = createSlice({
185
204
  nextPageToken: null,
186
205
  hasMore: false,
187
206
  };
207
+ mirrorCurrentSessionToPageKeyMapIfActive(draft);
188
208
  },
189
209
  createSessionFailure(draft, action) {
190
210
  draft.createSessionState.fetchState = 'Error';
@@ -222,6 +242,7 @@ const aiCfoView = createSlice({
222
242
  nextPageToken: null,
223
243
  hasMore: false,
224
244
  };
245
+ mirrorCurrentSessionToPageKeyMapIfActive(draft);
225
246
  },
226
247
  createSessionAndSubmitSuccess(draft) {
227
248
  // Note: currentChatSessionId, agentId, and chatHistoryNextPageToken are set by initializeNewSessionState
@@ -338,6 +359,7 @@ const aiCfoView = createSlice({
338
359
  draft.uiState.currentChatSessionId = undefined;
339
360
  draft.uiState.agentId = undefined;
340
361
  }
362
+ removeSessionIdFromPageKeyMap(draft, chatSessionId);
341
363
  delete draft.uiState.chatHistoryNextPageToken[chatSessionId];
342
364
  delete draft.uiState.scrollPositionByChatSessionId[chatSessionId];
343
365
  delete draft.fetchChatSessionHistoryByChatSessionId[chatSessionId];
@@ -360,6 +382,65 @@ const aiCfoView = createSlice({
360
382
  },
361
383
  clearCurrentSessionId(draft) {
362
384
  draft.uiState.currentChatSessionId = undefined;
385
+ const key = draft.uiState.aiCfoSidePanelHostPageKey;
386
+ if (key != null) {
387
+ delete draft.uiState.chatSessionIdByPageKey[key];
388
+ }
389
+ },
390
+ applyAiCfoSidePanelHostPageTransition(draft, action) {
391
+ const { newAiCfoSidePanelHostPageKey, nextCurrentChatSessionId } = action.payload;
392
+ const prevKey = draft.uiState.aiCfoSidePanelHostPageKey;
393
+ const curId = draft.uiState.currentChatSessionId;
394
+ if (prevKey != null &&
395
+ prevKey !== newAiCfoSidePanelHostPageKey &&
396
+ curId != null) {
397
+ draft.uiState.chatSessionIdByPageKey[prevKey] = curId;
398
+ }
399
+ draft.uiState.aiCfoSidePanelHostPageKey = newAiCfoSidePanelHostPageKey;
400
+ draft.uiState.currentChatSessionId =
401
+ nextCurrentChatSessionId != null ? nextCurrentChatSessionId : undefined;
402
+ draft.uiState.currentInput = '';
403
+ mirrorCurrentSessionToPageKeyMapIfActive(draft);
404
+ },
405
+ clearAiCfoSidePanelHostPageContext(draft) {
406
+ const key = draft.uiState.aiCfoSidePanelHostPageKey;
407
+ const curId = draft.uiState.currentChatSessionId;
408
+ if (key != null && curId != null) {
409
+ draft.uiState.chatSessionIdByPageKey[key] = curId;
410
+ }
411
+ draft.uiState.aiCfoSidePanelHostPageKey = undefined;
412
+ },
413
+ fetchSuggestedQuestions(draft, action) {
414
+ const { pageContext } = action.payload;
415
+ const prev = draft.suggestedQuestionsByPageContext[pageContext];
416
+ draft.suggestedQuestionsByPageContext[pageContext] = {
417
+ fetchState: 'In-Progress',
418
+ pageContext,
419
+ suggestedQuestions: prev?.suggestedQuestions ?? [],
420
+ generatedAt: prev?.generatedAt,
421
+ error: undefined,
422
+ };
423
+ },
424
+ fetchSuggestedQuestionsSuccess(draft, action) {
425
+ const { pageContext, generatedAt, suggestedQuestions } = action.payload;
426
+ draft.suggestedQuestionsByPageContext[pageContext] = {
427
+ fetchState: 'Completed',
428
+ pageContext,
429
+ generatedAt,
430
+ suggestedQuestions,
431
+ error: undefined,
432
+ };
433
+ },
434
+ fetchSuggestedQuestionsFailure(draft, action) {
435
+ const { pageContext, error } = action.payload;
436
+ const prev = draft.suggestedQuestionsByPageContext[pageContext];
437
+ draft.suggestedQuestionsByPageContext[pageContext] = {
438
+ fetchState: 'Error',
439
+ pageContext,
440
+ suggestedQuestions: prev?.suggestedQuestions ?? [],
441
+ generatedAt: prev?.generatedAt,
442
+ error,
443
+ };
363
444
  },
364
445
  clearAiCfoView(draft) {
365
446
  Object.assign(draft, initialAiCfoViewState);
@@ -371,5 +452,5 @@ const aiCfoView = createSlice({
371
452
  },
372
453
  },
373
454
  });
374
- export const { submitQuestion, submitQuestionSuccess, submitQuestionFailure, updateResponseState, updateAiCfoViewScrollPosition, updateCurrentInput, clearInput, setSession, createSession, createSessionSuccess, createSessionFailure, createSessionAndSubmit, initializeNewSessionState, createSessionAndSubmitSuccess, createSessionAndSubmitFailure, fetchChatSessionsForUser, fetchChatSessionsForUserSuccess, fetchChatSessionsForUserFailure, fetchChatHistory, fetchChatHistorySuccess, fetchChatHistoryFailure, clearCurrentSessionId, clearLastContextMessage, stopSubmit, stopSubmitSuccess, stopSubmitFailure, stopSubmitQuestion, stopSubmitQuestionSuccess, stopSubmitQuestionFailure, acceptMasterTOS, acceptMasterTOSSuccess, acceptMasterTOSFailure, deleteChatSession, deleteChatSessionSuccess, deleteChatSessionFailure, clearDeleteChatSessionStatus, clearAiCfoView, updateCotCollapsedState, } = aiCfoView.actions;
455
+ export const { submitQuestion, submitQuestionSuccess, submitQuestionFailure, updateResponseState, updateAiCfoViewScrollPosition, updateCurrentInput, clearInput, setSession, createSession, createSessionSuccess, createSessionFailure, createSessionAndSubmit, initializeNewSessionState, createSessionAndSubmitSuccess, createSessionAndSubmitFailure, fetchChatSessionsForUser, fetchChatSessionsForUserSuccess, fetchChatSessionsForUserFailure, fetchChatHistory, fetchChatHistorySuccess, fetchChatHistoryFailure, clearCurrentSessionId, clearLastContextMessage, stopSubmit, stopSubmitSuccess, stopSubmitFailure, stopSubmitQuestion, stopSubmitQuestionSuccess, stopSubmitQuestionFailure, acceptMasterTOS, acceptMasterTOSSuccess, acceptMasterTOSFailure, deleteChatSession, deleteChatSessionSuccess, deleteChatSessionFailure, clearDeleteChatSessionStatus, clearAiCfoView, updateCotCollapsedState, fetchSuggestedQuestions, fetchSuggestedQuestionsSuccess, fetchSuggestedQuestionsFailure, applyAiCfoSidePanelHostPageTransition, clearAiCfoSidePanelHostPageContext, } = aiCfoView.actions;
375
456
  export default aiCfoView.reducer;
@@ -1,6 +1,8 @@
1
+ import { initialAiCfoState } from '../../entity/aiCfo/aiCfoReducer';
1
2
  import { getAiCfoSelectorView, } from '../../entity/aiCfo/aiCfoSelector';
3
+ import { initialAiCfoViewState } from './aiCfoViewReducer';
2
4
  export const getAiCfoView = (state) => {
3
- const { fetchState, error, uiState, createSessionState, createSessionAndSubmitState, deleteChatSessionStateByChatSessionId, stopSubmitStateByChatSessionId, responseStateByChatSessionId, fetchChatSessionHistoryByChatSessionId, masterTOSAcceptanceState, } = state.aiCfoViewState;
5
+ const { fetchState, error, uiState, createSessionState, createSessionAndSubmitState, deleteChatSessionStateByChatSessionId, stopSubmitStateByChatSessionId, responseStateByChatSessionId, fetchChatSessionHistoryByChatSessionId, masterTOSAcceptanceState, suggestedQuestionsByPageContext, } = state.aiCfoViewState ?? initialAiCfoViewState;
4
6
  return {
5
7
  fetchState,
6
8
  error,
@@ -12,7 +14,11 @@ export const getAiCfoView = (state) => {
12
14
  uiState,
13
15
  fetchChatSessionHistoryByChatSessionId,
14
16
  masterTOSAcceptanceState,
15
- ...getAiCfoSelectorView(state.aiCfoState),
17
+ suggestedQuestionsByPageContext,
18
+ ...getAiCfoSelectorView(state.aiCfoState ?? initialAiCfoState),
16
19
  version: 1,
17
20
  };
18
21
  };
22
+ export function getSuggestedQuestionsForPageContext(state, pageContext) {
23
+ return state.aiCfoViewState?.suggestedQuestionsByPageContext?.[pageContext];
24
+ }
@@ -0,0 +1,29 @@
1
+ import { of } from 'rxjs';
2
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
+ import { createZeniAPIStatus, isSuccessResponse } from '../../../responsePayload';
4
+ import { fetchSuggestedQuestions, fetchSuggestedQuestionsFailure, fetchSuggestedQuestionsSuccess, } from '../aiCfoViewReducer';
5
+ /** GET {aiCfoMicroServiceBaseUrl}/1.0/suggested-questions?page_context=... */
6
+ export const fetchSuggestedQuestionsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchSuggestedQuestions.match),
7
+ // mergeMap (not switchMap): each page_context is keyed separately in Redux; switchMap
8
+ // would cancel in-flight HTTP for context A when B is requested, leaving A stuck In-Progress.
9
+ mergeMap((action) => {
10
+ const { pageContext } = action.payload;
11
+ const query = new URLSearchParams({ page_context: pageContext });
12
+ const url = `${zeniAPI.apiEndPoints.aiCfoMicroServiceBaseUrl}/1.0/suggested-questions?${query.toString()}`;
13
+ return zeniAPI.getJSON(url).pipe(mergeMap((response) => {
14
+ if (isSuccessResponse(response) && response.data != null) {
15
+ return of(fetchSuggestedQuestionsSuccess({
16
+ pageContext: response.data.page_context,
17
+ generatedAt: response.data.generated_at,
18
+ suggestedQuestions: response.data.suggested_questions,
19
+ }));
20
+ }
21
+ return of(fetchSuggestedQuestionsFailure({
22
+ pageContext,
23
+ error: response.status,
24
+ }));
25
+ }), catchError((error) => of(fetchSuggestedQuestionsFailure({
26
+ pageContext,
27
+ error: createZeniAPIStatus('Unexpected Error', 'Fetch suggested questions REST API call failed', error instanceof Error ? { message: error.message } : undefined),
28
+ }))));
29
+ }));
@@ -1,9 +1,9 @@
1
1
  import { createSlice } from '@reduxjs/toolkit';
2
2
  import { mapReportPayloadV2ToReportV2 } from '../../../commonPayloadTypes/v2/viewAndReportPayloadv2';
3
3
  import { getAgingBalancesKey, toAgingPeriod, } from '../../../commonStateTypes/agingBalance/agingBalance';
4
+ import { defaultCustomerCurrency } from '../../../commonStateTypes/currencyHelper';
4
5
  import { getNestedCustomerHierarchy } from '../../../commonStateTypes/customerView/getNestedCustomerHierarchy';
5
6
  import { toCustomer } from '../../../entity/customer/customerPayload';
6
- import { defaultCustomerCurrency } from '../../../entity/customer/customerState';
7
7
  import { dateNow } from '../../../zeniDayJS';
8
8
  import { toArAgingDataByCustomerId, toArAgingTotals, } from './arAgingPayload';
9
9
  export const inititalUIState = {
@@ -1,8 +1,8 @@
1
1
  import { createSelector } from '@reduxjs/toolkit';
2
2
  import orderBy from 'lodash/orderBy';
3
3
  import { getAgingBalancesKey, } from '../../../commonStateTypes/agingBalance/agingBalance';
4
+ import { defaultCustomerCurrency } from '../../../commonStateTypes/currencyHelper';
4
5
  import { getCustomer } from '../../../entity/customer/customerSelector';
5
- import { defaultCustomerCurrency, } from '../../../entity/customer/customerState';
6
6
  export const getArAgingReport = createSelector((state) => state.arAgingState, (state) => state.customerState, (arAgingState, customerState) => {
7
7
  const { reportId, reportTitle, fetchState, uiState, firstMonthOfFY, agingPeriods, } = arAgingState;
8
8
  const { searchString, sortOrder, sortKey, selectedDate } = uiState;
@@ -1,9 +1,16 @@
1
1
  import { of } from 'rxjs';
2
- import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
2
+ import { catchError, filter, mergeMap, switchMap, withLatestFrom, } from 'rxjs/operators';
3
3
  import { updateClasses } from '../../entity/class/classReducer';
4
+ import { getIsAccountingClassesEnabled } from '../../entity/tenant/tenantSelector';
4
5
  import { createZeniAPIStatus, isSuccessResponse } from '../../responsePayload';
5
6
  import { fetchClassList, updateClassList, updateClassListFailure, } from './classListReducer';
6
- export const fetchClassListEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchClassList.match), switchMap((action) => {
7
+ export const fetchClassListEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchClassList.match), withLatestFrom(state$), switchMap(([action, state]) => {
8
+ if (!getIsAccountingClassesEnabled(state)) {
9
+ return of(updateClassList({
10
+ status: createZeniAPIStatus('Success', ''),
11
+ data: { accounting_classes: [] },
12
+ }));
13
+ }
7
14
  const { isIncludeDeleted } = action.payload;
8
15
  const queryParams = isIncludeDeleted === true
9
16
  ? `?query=${encodeURIComponent(JSON.stringify({ is_include_deleted: true }))}`
@@ -6,6 +6,7 @@ import { getContactsByIds } from '../../../entity/billPay/contact/contactSelecto
6
6
  import { getClassById } from '../../../entity/class/classSelector';
7
7
  import { getFilesByFileIds } from '../../../entity/file/fileSelector';
8
8
  import { getPaymentInstrumentsByIds } from '../../../entity/paymentInstrument/paymentInstrumentSelector';
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 { getAccountList, getNestedAccountListHierarchy, } from '../../accountList/accountListSelector';
@@ -60,13 +61,17 @@ export const getVendorView = (state, vendorIdFromUrl) => {
60
61
  ?.vendorDetailLocalData,
61
62
  supportedCountries: billPayConfigState.vendor.supportedCountries,
62
63
  };
63
- fetchState = reduceFetchState([
64
+ const isAccountingClassesEnabled = getIsAccountingClassesEnabled(state);
65
+ const editFetchStateList = [
64
66
  accountList,
65
- classList,
66
67
  vendorTypeListState,
67
68
  vendorViewState.editVendorStateById[vendorIdFromUrl]?.fetchStatus ??
68
69
  vendorViewInitialState.newVendorState.fetchStatus,
69
- ]);
70
+ ];
71
+ if (isAccountingClassesEnabled) {
72
+ editFetchStateList.push(classList);
73
+ }
74
+ fetchState = reduceFetchState(editFetchStateList);
70
75
  }
71
76
  else {
72
77
  const basicVendorDetails = getBasicVendorDetailsForNewVendor(state, vendorViewState.newVendorState);
@@ -95,11 +100,17 @@ export const getVendorView = (state, vendorIdFromUrl) => {
95
100
  if (tentativeName != null) {
96
101
  entityRecommendations = getRecommendationsForEntity(state, tentativeName, 'vendor');
97
102
  }
103
+ const isAccountingClassesEnabled = getIsAccountingClassesEnabled(state);
98
104
  const fetchStateList = [
99
105
  { fetchState: accountList.fetchState, error: accountList.error },
100
- { fetchState: classList.fetchState, error: classList.error },
101
106
  vendorTypeListState,
102
107
  ];
108
+ if (isAccountingClassesEnabled) {
109
+ fetchStateList.push({
110
+ fetchState: classList.fetchState,
111
+ error: classList.error,
112
+ });
113
+ }
103
114
  if (entityRecommendations != null &&
104
115
  entityRecommendations.recommendations != null &&
105
116
  entityRecommendations.recommendations.length > 0) {
@@ -144,6 +155,7 @@ export const getVendorView = (state, vendorIdFromUrl) => {
144
155
  fetchState: fetchState.fetchState,
145
156
  hasWireTransfer,
146
157
  hasInternationalWireTransfer,
158
+ isAccountingClassesEnabled: getIsAccountingClassesEnabled(state),
147
159
  deleteFileStatusById,
148
160
  updateFileStatusById,
149
161
  loggedInUserVerification,
@@ -219,9 +231,10 @@ const getBasicVendorDetailsForNewVendor = (state, newVendor) => {
219
231
  };
220
232
  export const getVendorDetailPageView = (state, vendorId, entity) => {
221
233
  const trendWithTransactions = getTrendWithTransactions(state, entity, 'EntityDetail');
234
+ const isAccountingClassesEnabled = getIsAccountingClassesEnabled(state);
222
235
  const reducedFetchState = reduceAnyFetchState([
223
236
  state.accountListState.byReportId.accountList,
224
- state.classListState,
237
+ ...(isAccountingClassesEnabled ? [state.classListState] : []),
225
238
  state.vendorTypeListState,
226
239
  state.ownerListState,
227
240
  state.vendorViewState.editVendorStateById[vendorId]?.fetchStatus ?? {
@@ -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 ?? {
@@ -0,0 +1,10 @@
1
+ /**
2
+ * After upload API success, hold the bar at 100% this long before transitioning to matching,
3
+ * so the fill animation can complete without an abrupt swap to the auto-matching banner.
4
+ */
5
+ export const BULK_UPLOAD_BAR_COMPLETE_HOLD_MS = 400;
6
+ /**
7
+ * Max wall-clock wait for Pusher + batch-details resolution after upload. If exceeded, we stop
8
+ * fallback polling, clear the automatching banner (`phase` → completed), and refresh batch list.
9
+ */
10
+ export const BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS = 300000;
@@ -4,6 +4,7 @@ import { DEFAULT_DATE_FORMAT } from '../../../../commonStateTypes/fiscalYearHelp
4
4
  import { addTransactionToReconcileList, excludeReconReviewTransaction, } from '../../../../entity/accountRecon/accountReconReducer';
5
5
  import { getAccountReconByAccountIdAndSelectedPeriod, } from '../../../../entity/accountRecon/accountReconSelector';
6
6
  import { toAccountReconKey, } from '../../../../entity/accountRecon/accountReconState';
7
+ import { getEntityByEntityIDs } from '../../../../entity/genericEntity/entitySelector';
7
8
  import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
8
9
  import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
9
10
  import { updateMultipleReconcileTransactions } from '../../../../entity/transaction/transactionReducer';
@@ -12,6 +13,7 @@ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePay
12
13
  import { saveReconciliationReview, updateReconcileTabLocalData, updateSaveReconciliationReviewFetchStatus, } from '../../reducers/reconciliationViewReducer';
13
14
  export const saveReconciliationReviewEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(saveReconciliationReview.match), mergeMap((action) => {
14
15
  const state = state$.value;
16
+ const entityState = state.entityState;
15
17
  const { transactionId } = action.payload;
16
18
  const localData = state.expenseAutomationReconciliationViewState.reconTabsState.review
17
19
  .localData[transactionId];
@@ -59,7 +61,7 @@ export const saveReconciliationReviewEpic = (actions$, state$, zeniAPI) => actio
59
61
  payload = getPayloadForCCPayment(updatedTransaction, localData, reconciliationData?.account.accountType);
60
62
  break;
61
63
  case 'record_deposit':
62
- payload = getPayloadForDeposit(updatedTransaction, localData);
64
+ payload = getPayloadForDeposit(updatedTransaction, localData, entityState);
63
65
  break;
64
66
  }
65
67
  }
@@ -159,7 +161,10 @@ function getPayloadForExpenseRecord(updatedTransaction, localData) {
159
161
  currency_code: updatedTransaction.amount.currencyCode,
160
162
  };
161
163
  }
162
- function getPayloadForDeposit(updatedTransaction, localData) {
164
+ function getPayloadForDeposit(updatedTransaction, localData, entityState) {
165
+ const customerZeniId = localData.customer?.id != null
166
+ ? getEntityByEntityIDs(entityState, [localData.customer?.id])[0]?.zeniId
167
+ : undefined;
163
168
  return {
164
169
  amount: updatedTransaction.amount.amount,
165
170
  transaction_memo: updatedTransaction.memo,
@@ -167,7 +172,7 @@ function getPayloadForDeposit(updatedTransaction, localData) {
167
172
  transaction_date: updatedTransaction.transactionDate.format(DEFAULT_DATE_FORMAT),
168
173
  transaction_direction: updatedTransaction.transactionDirection,
169
174
  transaction_id: updatedTransaction.transactionId,
170
- customer_id: localData.customer?.id,
175
+ customer_id: customerZeniId,
171
176
  customer_name: localData.customer?.name,
172
177
  account_id: localData.categoryId,
173
178
  accounting_class_id: localData.classId,
@@ -0,0 +1,29 @@
1
+ import { concat, of, timer } from 'rxjs';
2
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
4
+ import { BULK_UPLOAD_BAR_COMPLETE_HOLD_MS } from '../../bulkUploadTiming';
5
+ import { bulkUploadReceipts, bulkUploadReceiptsFailure, bulkUploadReceiptsSuccess, updateBulkUploadProgress, } from '../../reducers/missingReceiptsViewReducer';
6
+ export const bulkUploadReceiptsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(bulkUploadReceipts.match), mergeMap((action) => {
7
+ const { files } = action.payload;
8
+ const formData = new FormData();
9
+ for (const file of files) {
10
+ formData.append('files', file, file.name);
11
+ }
12
+ return zeniAPI
13
+ .postFormData(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/receipts/bulk-upload`, formData)
14
+ .pipe(mergeMap((response) => {
15
+ if (isSuccessResponse(response) && response.data != null) {
16
+ const batchId = String(response.data.batch_id ?? '').trim();
17
+ if (batchId === '') {
18
+ return of(bulkUploadReceiptsFailure({
19
+ error: createZeniAPIStatus('Unexpected Error', 'Bulk upload succeeded but batch_id was missing or empty.'),
20
+ }));
21
+ }
22
+ return concat(of(updateBulkUploadProgress(100)), timer(BULK_UPLOAD_BAR_COMPLETE_HOLD_MS).pipe(mergeMap(() => of(bulkUploadReceiptsSuccess({ batchId })))));
23
+ }
24
+ return of(bulkUploadReceiptsFailure({ error: response.status }));
25
+ }), catchError((error) => of(bulkUploadReceiptsFailure({
26
+ error: createZeniAPIStatus('Unexpected Error', 'Bulk upload receipts API call errored out: ' +
27
+ JSON.stringify(error)),
28
+ }))));
29
+ }));
@@ -0,0 +1,49 @@
1
+ import { from } from 'rxjs';
2
+ import { catchError, exhaustMap, filter, mergeMap } from 'rxjs/operators';
3
+ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
5
+ import { confirmBulkUploadMatch, confirmBulkUploadMatchFailure, confirmBulkUploadMatchSuccess, } from '../../reducers/missingReceiptsViewReducer';
6
+ export const confirmBulkUploadMatchEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(confirmBulkUploadMatch.match), exhaustMap((action) => {
7
+ const { batchId, attachmentId, transactionId, transactionType, fileName } = action.payload;
8
+ return zeniAPI
9
+ .postAndGetJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/receipts/manual-match`, {
10
+ attachment_id: attachmentId,
11
+ transaction_id: transactionId,
12
+ transaction_type: transactionType,
13
+ file_name: fileName,
14
+ })
15
+ .pipe(mergeMap((response) => {
16
+ if (isSuccessResponse(response)) {
17
+ return from([
18
+ confirmBulkUploadMatchSuccess({
19
+ batchId,
20
+ attachmentId,
21
+ transactionId,
22
+ }),
23
+ openSnackbar({
24
+ messageSection: 'receipt_match',
25
+ messageText: 'success',
26
+ type: 'success',
27
+ }),
28
+ ]);
29
+ }
30
+ return from([
31
+ confirmBulkUploadMatchFailure({ error: response.status }),
32
+ openSnackbar({
33
+ messageSection: 'receipt_match',
34
+ messageText: 'failed',
35
+ type: 'error',
36
+ }),
37
+ ]);
38
+ }), catchError((error) => from([
39
+ confirmBulkUploadMatchFailure({
40
+ error: createZeniAPIStatus('Unexpected Error', 'Confirm bulk upload match errored out: ' +
41
+ JSON.stringify(error)),
42
+ }),
43
+ openSnackbar({
44
+ messageSection: 'receipt_match',
45
+ messageText: 'failed',
46
+ type: 'error',
47
+ }),
48
+ ])));
49
+ }));
@@ -0,0 +1,40 @@
1
+ import { EMPTY, from, of } from 'rxjs';
2
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
+ import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
4
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
5
+ import { extractTransactionPayloadsFromBatchFiles, isBatchDetailsApiStatusCompleted, shouldFetchBatchDetailsForBatchId, toBatchDetails, } from '../../payload/missingReceiptsPayload';
6
+ import { fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsFailure, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, } from '../../reducers/missingReceiptsViewReducer';
7
+ export const fetchBulkUploadBatchDetailsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchBulkUploadBatchDetails.match), mergeMap(() => {
8
+ const bulkUpload = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
9
+ const { currentBatchId } = bulkUpload;
10
+ if (currentBatchId == null) {
11
+ return of(fetchBulkUploadBatchDetailsFailure({
12
+ error: createZeniAPIStatus('Unexpected Error', 'No current batch ID available'),
13
+ }));
14
+ }
15
+ if (!shouldFetchBatchDetailsForBatchId(bulkUpload.batchStatusById, bulkUpload.batchListByPeriod, currentBatchId)) {
16
+ return EMPTY;
17
+ }
18
+ return zeniAPI
19
+ .getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches/${currentBatchId}`)
20
+ .pipe(mergeMap((response) => {
21
+ if (!isSuccessResponse(response) ||
22
+ response.data == null ||
23
+ !isBatchDetailsApiStatusCompleted(response.data.status)) {
24
+ if (isSuccessResponse(response) && response.data != null) {
25
+ return EMPTY;
26
+ }
27
+ return of(fetchBulkUploadBatchDetailsFailure({ error: response.status }));
28
+ }
29
+ const actions = [];
30
+ const transactionPayloads = extractTransactionPayloadsFromBatchFiles(response.data.files);
31
+ if (transactionPayloads.length > 0) {
32
+ actions.push(updateTransactions(transactionPayloads, (value) => value.transaction_id));
33
+ }
34
+ actions.push(fetchBulkUploadBatchDetailsSuccess(toBatchDetails(response.data, zeniAPI.apiEndPoints.fileMicroServiceBaseUrl)));
35
+ actions.push(fetchBulkUploadBatches({ cacheOverride: true }));
36
+ return from(actions);
37
+ }), catchError((error) => of(fetchBulkUploadBatchDetailsFailure({
38
+ error: createZeniAPIStatus('Unexpected Error', 'Fetch batch details errored out: ' + JSON.stringify(error)),
39
+ }))));
40
+ }));
@@ -0,0 +1,47 @@
1
+ import { of } from 'rxjs';
2
+ import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
+ import { convertToPeriod, toMonthYearPeriodId, } from '../../../../commonStateTypes/timePeriod';
4
+ import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
5
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
6
+ import { toBatchListItem, } from '../../payload/missingReceiptsPayload';
7
+ import { fetchBulkUploadBatches, fetchBulkUploadBatchesFailure, fetchBulkUploadBatchesSuccess, } from '../../reducers/missingReceiptsViewReducer';
8
+ export const fetchBulkUploadBatchesEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchBulkUploadBatches.match), switchMap((action) => {
9
+ const { cacheOverride } = action.payload;
10
+ const state = state$.value;
11
+ const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload }, } = state;
12
+ const currentTenant = getCurrentTenant(state);
13
+ const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
14
+ const periodId = toMonthYearPeriodId(selectedPeriod);
15
+ const existingBatches = bulkUpload.batchListByPeriod[periodId] ?? [];
16
+ if (cacheOverride !== true && existingBatches.length > 0) {
17
+ return of(fetchBulkUploadBatchesSuccess({
18
+ batchList: existingBatches,
19
+ selectedPeriod,
20
+ }));
21
+ }
22
+ const period = convertToPeriod(selectedPeriod);
23
+ const queryParam = {
24
+ start_date: period.start,
25
+ end_date: period.end,
26
+ sort_order: 'desc',
27
+ };
28
+ return zeniAPI
29
+ .getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
30
+ .pipe(mergeMap((response) => {
31
+ if (isSuccessResponse(response) && response.data != null) {
32
+ /** Full list (all statuses) for UI; batch-details epics filter to `completed` only. */
33
+ return of(fetchBulkUploadBatchesSuccess({
34
+ batchList: response.data.batches.map(toBatchListItem),
35
+ selectedPeriod,
36
+ }));
37
+ }
38
+ return of(fetchBulkUploadBatchesFailure({
39
+ error: response.status,
40
+ selectedPeriod,
41
+ }));
42
+ }), catchError((error) => of(fetchBulkUploadBatchesFailure({
43
+ error: createZeniAPIStatus('Unexpected Error', 'Fetch bulk upload batches errored out: ' +
44
+ JSON.stringify(error)),
45
+ selectedPeriod,
46
+ }))));
47
+ }));
@@ -0,0 +1,61 @@
1
+ import { from, of } from 'rxjs';
2
+ import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
+ import { convertToPeriod, toMonthYearPeriodId, } from '../../../../commonStateTypes/timePeriod';
4
+ import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
5
+ import { updateTransactions } from '../../../../entity/transaction/transactionReducer';
6
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
7
+ import { fetchCompletedTransactions, fetchCompletedTransactionsFailure, fetchCompletedTransactionsSuccess, getCompletedTransactionsCacheKey, } from '../../reducers/missingReceiptsViewReducer';
8
+ export const fetchCompletedTransactionsEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchCompletedTransactions.match), switchMap((action) => {
9
+ const state = state$.value;
10
+ const { expenseAutomationViewState: { selectedPeriodByTenantId }, expenseAutomationMissingReceiptsViewState: { bulkUpload }, } = state;
11
+ const currentTenant = getCurrentTenant(state);
12
+ const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
13
+ const periodId = toMonthYearPeriodId(selectedPeriod);
14
+ const isInitialLoad = action.payload.pageToken == null;
15
+ const cacheKey = getCompletedTransactionsCacheKey(periodId, bulkUpload.sortKey, bulkUpload.sortOrder, bulkUpload.completedSubTab);
16
+ const existingData = bulkUpload.completedTransactionsByPeriod[cacheKey];
17
+ if (isInitialLoad &&
18
+ action.payload.cacheOverride !== true &&
19
+ existingData != null &&
20
+ existingData.transactionIds.length > 0) {
21
+ return from([]);
22
+ }
23
+ const period = convertToPeriod(selectedPeriod);
24
+ const queryPayload = {
25
+ start_date: period.start,
26
+ end_date: period.end,
27
+ sort_by: bulkUpload.sortKey,
28
+ sort_order: bulkUpload.sortOrder === 'ascending' ? 'asc' : 'desc',
29
+ page_token: action.payload.pageToken ?? null,
30
+ page_size: 25,
31
+ };
32
+ if (bulkUpload.completedSubTab !== 'all') {
33
+ queryPayload.match_type = bulkUpload.completedSubTab;
34
+ }
35
+ const encodedQuery = encodeURIComponent(JSON.stringify(queryPayload));
36
+ return zeniAPI
37
+ .getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/receipt-agent/transactions/completed?query=${encodedQuery}`)
38
+ .pipe(mergeMap((response) => {
39
+ if (isSuccessResponse(response) && response.data != null) {
40
+ const transactionIds = response.data.transactions.map((t) => t.transaction_id);
41
+ const updateActions = [];
42
+ updateActions.push(updateTransactions(response.data.transactions, (value) => value.transaction_id));
43
+ updateActions.push(fetchCompletedTransactionsSuccess({
44
+ isInitialLoad,
45
+ transactionIds,
46
+ nextPageToken: response.data.next_page_token,
47
+ totalCount: response.data.total_count,
48
+ selectedPeriod,
49
+ }));
50
+ return from(updateActions);
51
+ }
52
+ return of(fetchCompletedTransactionsFailure({
53
+ error: response.status,
54
+ selectedPeriod,
55
+ }));
56
+ }), catchError((error) => of(fetchCompletedTransactionsFailure({
57
+ error: createZeniAPIStatus('Unexpected Error', 'Fetch completed transactions errored: ' +
58
+ JSON.stringify(error)),
59
+ selectedPeriod,
60
+ }))));
61
+ }));