@zeniai/client-epic-state 4.20.10 → 5.0.0-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 (277) hide show
  1. package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.d.ts +19 -0
  2. package/lib/common/aiCfo/aiCfoSuggestedQuestionsPageContext.js +2 -0
  3. package/lib/commonStateTypes/animations.d.ts +1 -1
  4. package/lib/commonStateTypes/animations.js +3 -0
  5. package/lib/commonStateTypes/viewAndReport/viewAndReport.d.ts +2 -2
  6. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
  7. package/lib/coreEpics.js +2 -1
  8. package/lib/entity/account/accountPayload.d.ts +2 -0
  9. package/lib/entity/account/accountReducer.d.ts +5 -2
  10. package/lib/entity/account/accountReducer.js +7 -2
  11. package/lib/entity/account/accountState.d.ts +1 -1
  12. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  13. package/lib/entity/accountRecon/accountReconPayload.d.ts +1 -1
  14. package/lib/entity/accountRecon/accountReconPayload.js +4 -2
  15. package/lib/entity/aiCfo/aiCfoSelector.d.ts +1 -2
  16. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
  17. package/lib/entity/class/classReducer.d.ts +4 -4
  18. package/lib/entity/class/classState.d.ts +1 -1
  19. package/lib/entity/forecast/forecastState.d.ts +1 -1
  20. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +38 -0
  21. package/lib/entity/jeSchedules/jeSchedulesPayload.js +78 -0
  22. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +4 -1
  23. package/lib/entity/jeSchedules/jeSchedulesSelector.js +5 -1
  24. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +37 -0
  25. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  26. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  27. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  28. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  29. package/lib/entity/snackbar/snackbarTypes.js +7 -0
  30. package/lib/entity/tenant/SessionManager.d.ts +38 -0
  31. package/lib/entity/tenant/SessionManager.js +171 -0
  32. package/lib/entity/tenant/epic/sessionHeartbeatEpic.d.ts +16 -0
  33. package/lib/entity/tenant/epic/sessionHeartbeatEpic.js +16 -0
  34. package/lib/entity/tenant/sessionTypes.d.ts +26 -0
  35. package/lib/entity/tenant/sessionTypes.js +12 -0
  36. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  37. package/lib/entity/tenant/tenantReducer.d.ts +10 -3
  38. package/lib/entity/tenant/tenantReducer.js +30 -2
  39. package/lib/entity/tenant/tenantSelector.d.ts +1 -0
  40. package/lib/entity/tenant/tenantSelector.js +9 -1
  41. package/lib/entity/tenant/tenantState.d.ts +2 -0
  42. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +4 -1
  43. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
  44. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +9 -0
  45. package/lib/entity/transaction/payloadTypes/transactionPayload.js +79 -1
  46. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +1 -0
  47. package/lib/entity/transaction/stateTypes/transaction.d.ts +11 -0
  48. package/lib/entity/transaction/stateTypes/transactionLine.d.ts +1 -1
  49. package/lib/epic.d.ts +15 -1
  50. package/lib/epic.js +15 -1
  51. package/lib/esm/common/aiCfo/aiCfoSuggestedQuestionsPageContext.js +1 -0
  52. package/lib/esm/commonStateTypes/animations.js +3 -0
  53. package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
  54. package/lib/esm/coreEpics.js +2 -1
  55. package/lib/esm/entity/account/accountReducer.js +6 -1
  56. package/lib/esm/entity/accountRecon/accountReconPayload.js +4 -2
  57. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +78 -0
  58. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +5 -1
  59. package/lib/esm/entity/snackbar/snackbarTypes.js +7 -0
  60. package/lib/esm/entity/tenant/SessionManager.js +167 -0
  61. package/lib/esm/entity/tenant/epic/sessionHeartbeatEpic.js +12 -0
  62. package/lib/esm/entity/tenant/sessionTypes.js +9 -0
  63. package/lib/esm/entity/tenant/tenantReducer.js +28 -1
  64. package/lib/esm/entity/tenant/tenantSelector.js +7 -0
  65. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
  66. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +79 -1
  67. package/lib/esm/epic.js +15 -1
  68. package/lib/esm/index.js +22 -16
  69. package/lib/esm/reducer.js +3 -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/classList/fetchClassListEpic.js +9 -2
  74. package/lib/esm/view/commonVendorView/vendorView/vendorViewSelector.js +18 -5
  75. package/lib/esm/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
  76. package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewReducer.js +19 -1
  77. package/lib/esm/view/companyTaskManagerView/companyTaskManagerViewSelector.js +3 -1
  78. package/lib/esm/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +17 -0
  79. package/lib/esm/view/companyView/companyViewReducer.js +26 -1
  80. package/lib/esm/view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic.js +61 -0
  81. package/lib/esm/view/companyView/types/companyPassport/companyPassportViewState.js +4 -0
  82. package/lib/esm/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js +44 -0
  83. package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +4 -9
  84. package/lib/esm/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.js +44 -0
  85. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
  86. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic.js +33 -0
  87. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +3 -3
  88. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +6 -4
  89. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/refetchCompletedTransactionsOnBulkUploadSortEpic.js +12 -0
  90. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +98 -0
  91. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -13
  92. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +13 -5
  93. package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +0 -1
  94. package/lib/esm/view/expenseAutomationView/{bulkUploadTiming.js → helpers/bulkUploadTiming.js} +6 -0
  95. package/lib/esm/view/expenseAutomationView/helpers/rollingCalendarDateRangeInclusive.js +13 -0
  96. package/lib/esm/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  97. package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  98. package/lib/esm/view/expenseAutomationView/payload/missingReceiptsPayload.js +9 -0
  99. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +21 -1
  100. package/lib/esm/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +26 -3
  101. package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +167 -3
  102. package/lib/esm/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +1 -2
  103. package/lib/esm/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +10 -2
  104. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +63 -6
  105. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +14 -4
  106. package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +136 -9
  107. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +15 -5
  108. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +24 -1
  109. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +3 -0
  110. package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesPayload.js +26 -0
  111. package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesReducer.js +199 -0
  112. package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +52 -0
  113. package/lib/esm/view/spendManagement/autotransferRules/autoTransferRulesState.js +1 -0
  114. package/lib/esm/view/spendManagement/autotransferRules/epics/createAutoTransferRuleEpic.js +100 -0
  115. package/lib/esm/view/spendManagement/autotransferRules/epics/deleteAutoTransferRuleEpic.js +48 -0
  116. package/lib/esm/view/spendManagement/autotransferRules/epics/fetchAutoTransferReviewDetailEpic.js +36 -0
  117. package/lib/esm/view/spendManagement/autotransferRules/epics/fetchAutoTransferRuleHistory.js +45 -0
  118. package/lib/esm/view/spendManagement/autotransferRules/epics/fetchAutoTransferRulesEpic.js +50 -0
  119. package/lib/esm/view/spendManagement/autotransferRules/epics/updateAutoTransferRuleEpic.js +69 -0
  120. package/lib/esm/view/spendManagement/billPay/billList/billListSelector.js +10 -0
  121. package/lib/esm/view/spendManagement/billPay/billList/billListState.js +1 -0
  122. package/lib/esm/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +7 -3
  123. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  124. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
  125. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
  126. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
  127. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
  128. package/lib/esm/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +7 -4
  129. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
  130. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
  131. package/lib/esm/view/spendManagement/treasury/treasuryList/epics/fetchTreasuryDetailEpic.js +2 -2
  132. package/lib/esm/view/spendManagement/treasury/treasuryList/treasuryDetailReducer.js +2 -1
  133. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
  134. package/lib/esm/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  135. package/lib/esm/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
  136. package/lib/esm/view/transactionDetail/transactionDetailSelector.js +9 -2
  137. package/lib/index.d.ts +32 -22
  138. package/lib/index.js +72 -33
  139. package/lib/reducer.d.ts +3 -0
  140. package/lib/reducer.js +3 -0
  141. package/lib/tsconfig.typecheck.tsbuildinfo +1 -0
  142. package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +7 -0
  143. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +15 -1
  144. package/lib/view/aiCfoView/aiCfoViewReducer.js +83 -2
  145. package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +4 -1
  146. package/lib/view/aiCfoView/aiCfoViewSelector.js +9 -2
  147. package/lib/view/aiCfoView/aiCfoViewState.d.ts +15 -1
  148. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +8 -0
  149. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +33 -0
  150. package/lib/view/auditReportView/auditReportViewState.d.ts +2 -2
  151. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  152. package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
  153. package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
  154. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  155. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  156. package/lib/view/classList/fetchClassListEpic.d.ts +1 -1
  157. package/lib/view/classList/fetchClassListEpic.js +8 -1
  158. package/lib/view/commonVendorView/vendorView/vendorViewSelector.d.ts +1 -0
  159. package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +18 -5
  160. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +1 -0
  161. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
  162. package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +2 -2
  163. package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.js +20 -2
  164. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.d.ts +4 -1
  165. package/lib/view/companyTaskManagerView/companyTaskManagerViewSelector.js +3 -1
  166. package/lib/view/companyTaskManagerView/companyTaskManagerViewState.d.ts +9 -1
  167. package/lib/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.d.ts +7 -0
  168. package/lib/view/companyTaskManagerView/epics/fetchTaskManagerMetricsEpic.js +21 -0
  169. package/lib/view/companyView/companyViewReducer.d.ts +6 -1
  170. package/lib/view/companyView/companyViewReducer.js +28 -2
  171. package/lib/view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic.d.ts +10 -0
  172. package/lib/view/companyView/epic/companyPassport/updateAccountingClassesEnabledEpic.js +65 -0
  173. package/lib/view/companyView/types/companyPassport/companyPassportViewState.d.ts +1 -0
  174. package/lib/view/companyView/types/companyPassport/companyPassportViewState.js +4 -0
  175. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  176. package/lib/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.d.ts +8 -0
  177. package/lib/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js +48 -0
  178. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +4 -9
  179. package/lib/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.d.ts +9 -0
  180. package/lib/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.js +48 -0
  181. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
  182. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic.d.ts +13 -0
  183. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic.js +37 -0
  184. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +2 -2
  185. package/lib/view/expenseAutomationView/epics/missingReceipts/fetchBulkUploadBatchesEpic.js +5 -3
  186. package/lib/view/expenseAutomationView/epics/missingReceipts/refetchCompletedTransactionsOnBulkUploadSortEpic.d.ts +10 -0
  187. package/lib/view/expenseAutomationView/epics/missingReceipts/refetchCompletedTransactionsOnBulkUploadSortEpic.js +16 -0
  188. package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.d.ts +18 -0
  189. package/lib/view/expenseAutomationView/epics/missingReceipts/restoreBulkUploadAutomatchingOnMountEpic.js +102 -0
  190. package/lib/view/expenseAutomationView/epics/missingReceipts/searchTransactionsForManualMatchEpic.js +7 -13
  191. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.d.ts +2 -2
  192. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +12 -4
  193. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +0 -1
  194. package/lib/view/expenseAutomationView/{bulkUploadTiming.d.ts → helpers/bulkUploadTiming.d.ts} +6 -0
  195. package/lib/view/expenseAutomationView/{bulkUploadTiming.js → helpers/bulkUploadTiming.js} +7 -1
  196. package/lib/view/expenseAutomationView/helpers/rollingCalendarDateRangeInclusive.d.ts +7 -0
  197. package/lib/view/expenseAutomationView/helpers/rollingCalendarDateRangeInclusive.js +16 -0
  198. package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  199. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  200. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  201. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +1 -1
  202. package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.d.ts +5 -0
  203. package/lib/view/expenseAutomationView/payload/missingReceiptsPayload.js +10 -0
  204. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +45 -0
  205. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
  206. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +22 -2
  207. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +12 -2
  208. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.js +27 -4
  209. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +18 -4
  210. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +168 -4
  211. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +2 -0
  212. package/lib/view/expenseAutomationView/selectorTypes/missingReceiptsSelectorTypes.d.ts +2 -0
  213. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +7 -2
  214. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.js +2 -2
  215. package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +10 -2
  216. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +63 -6
  217. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +14 -4
  218. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +136 -9
  219. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +13 -3
  220. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +8 -0
  221. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +27 -0
  222. package/lib/view/expenseAutomationView/types/missingReceiptsViewState.d.ts +4 -0
  223. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +14 -0
  224. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  225. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  226. package/lib/view/onboardingView/cockpitView/types/onboardingCockpitViewTypes.d.ts +1 -1
  227. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +3 -0
  228. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  229. package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
  230. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  231. package/lib/view/spendManagement/autotransferRules/autoTransferRulesPayload.d.ts +75 -0
  232. package/lib/view/spendManagement/autotransferRules/autoTransferRulesPayload.js +30 -0
  233. package/lib/view/spendManagement/autotransferRules/autoTransferRulesReducer.d.ts +50 -0
  234. package/lib/view/spendManagement/autotransferRules/autoTransferRulesReducer.js +206 -0
  235. package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.d.ts +24 -0
  236. package/lib/view/spendManagement/autotransferRules/autoTransferRulesSelector.js +61 -0
  237. package/lib/view/spendManagement/autotransferRules/autoTransferRulesState.d.ts +38 -0
  238. package/lib/view/spendManagement/autotransferRules/autoTransferRulesState.js +2 -0
  239. package/lib/view/spendManagement/autotransferRules/epics/createAutoTransferRuleEpic.d.ts +12 -0
  240. package/lib/view/spendManagement/autotransferRules/epics/createAutoTransferRuleEpic.js +106 -0
  241. package/lib/view/spendManagement/autotransferRules/epics/deleteAutoTransferRuleEpic.d.ts +8 -0
  242. package/lib/view/spendManagement/autotransferRules/epics/deleteAutoTransferRuleEpic.js +52 -0
  243. package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferReviewDetailEpic.d.ts +7 -0
  244. package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferReviewDetailEpic.js +40 -0
  245. package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferRuleHistory.d.ts +7 -0
  246. package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferRuleHistory.js +52 -0
  247. package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferRulesEpic.d.ts +10 -0
  248. package/lib/view/spendManagement/autotransferRules/epics/fetchAutoTransferRulesEpic.js +54 -0
  249. package/lib/view/spendManagement/autotransferRules/epics/updateAutoTransferRuleEpic.d.ts +8 -0
  250. package/lib/view/spendManagement/autotransferRules/epics/updateAutoTransferRuleEpic.js +73 -0
  251. package/lib/view/spendManagement/billPay/billList/billListSelector.js +10 -0
  252. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
  253. package/lib/view/spendManagement/billPay/billList/billListState.js +1 -0
  254. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +7 -3
  255. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  256. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
  257. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
  258. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +1 -1
  259. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  260. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
  261. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
  262. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +6 -3
  263. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +1 -0
  264. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
  265. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
  266. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
  267. package/lib/view/spendManagement/treasury/treasuryList/epics/fetchTreasuryDetailEpic.js +2 -2
  268. package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailReducer.d.ts +2 -1
  269. package/lib/view/spendManagement/treasury/treasuryList/treasuryDetailReducer.js +2 -1
  270. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +2 -2
  271. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  272. package/lib/view/topEx/topExSelector.d.ts +1 -1
  273. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  274. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
  275. package/lib/view/transactionDetail/transactionDetailSelector.d.ts +1 -0
  276. package/lib/view/transactionDetail/transactionDetailSelector.js +9 -2
  277. package/package.json +1 -1
@@ -1,14 +1,14 @@
1
1
  import omit from 'lodash/omit';
2
- import { reduceAllFetchState } from '../../../commonStateTypes/reduceFetchState';
2
+ import { reduceAllFetchState, reduceAnyFetchState, } from '../../../commonStateTypes/reduceFetchState';
3
3
  import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
4
- import { getCurrentTenant } from '../../../entity/tenant/tenantSelector';
4
+ import { getIsAccountingClassesEnabled, getCurrentTenant, } from '../../../entity/tenant/tenantSelector';
5
5
  import { getTransactionWithCOT } from '../../../entity/transaction/transactionHelper';
6
6
  import { getSupportedTransactionsByIds } from '../../../entity/transaction/transactionSelector';
7
7
  import { getAccountList, getNestedAccountListHierarchy, getUncategorizedAccounts, } from '../../accountList/accountListSelector';
8
8
  import { getClassList, getNestedClassListHierarchy, } from '../../classList/classListSelector';
9
9
  import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes';
10
10
  export function getExpenseAutomationTransactionView(state) {
11
- const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, } = state;
11
+ const { accountState, classState, classListState, accountListState, expenseAutomationTransactionsViewState, expenseAutomationViewState, transactionState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
12
12
  const { selectedTransactionCategorizationTab } = expenseAutomationTransactionsViewState;
13
13
  const { uiState, refreshStatus, saveStatus, markAsNotMiscategorizedStatus, transactionIdsBySelectedPeriod, transactionReviewLocalDataById, selectedCheckBoxTransactionIds, transactionIdsWithUnsavedData, uploadReceiptStatusById, selectedTransactionId, selectedTransactionLineId, } = expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab];
14
14
  const uncategorizedIncomeExpense = getUncategorizedAccounts(accountState, accountListState, 'accountList');
@@ -41,10 +41,20 @@ export function getExpenseAutomationTransactionView(state) {
41
41
  .filter((transaction) => transaction != null);
42
42
  const transactions = getSupportedTransactionsByIds(transactionState, transactionIds);
43
43
  const transactionsWithCOT = transactions.map((transaction) => getTransactionWithCOT(transaction));
44
- const fetchStatus = reduceAllFetchState([
44
+ const monthEndFetchState = monthYearPeriodId != null
45
+ ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
46
+ : { fetchState: 'Not-Started', error: undefined };
47
+ const isAccountingClassesEnabled = getIsAccountingClassesEnabled(state);
48
+ const allFetchStateList = [
45
49
  accountList,
46
- classList,
47
50
  expenseAutomationTransactionsViewState.transactionCategorizationView[selectedTransactionCategorizationTab],
51
+ ];
52
+ if (isAccountingClassesEnabled) {
53
+ allFetchStateList.push(classList);
54
+ }
55
+ const fetchStatus = reduceAnyFetchState([
56
+ reduceAllFetchState(allFetchStateList),
57
+ monthEndFetchState,
48
58
  ]);
49
59
  const totalCountByReview = expenseAutomationTransactionsViewState.transactionCategorizationView.review
50
60
  .uiState.totalCount;
@@ -1 +1,24 @@
1
- export {};
1
+ import { stringToUnion } from '../../../commonStateTypes/stringToUnion';
2
+ const JE_SCHEDULE_SORT_KEYS = [
3
+ 'vendor',
4
+ 'category',
5
+ 'class',
6
+ 'depCategory',
7
+ 'scheduleCategory',
8
+ 'startMonth',
9
+ 'type',
10
+ 'amortizationPeriod',
11
+ 'jePostingDate',
12
+ 'remainingMonths',
13
+ 'runningBalance',
14
+ 'totalAmount',
15
+ 'transactionDate',
16
+ 'memo',
17
+ ];
18
+ export const toJEScheduleSortKey = (v) => stringToUnion(v, JE_SCHEDULE_SORT_KEYS);
19
+ const JE_SCHEDULE_MAIN_TABS = [
20
+ 'pending_review',
21
+ 'ongoing',
22
+ 'completed',
23
+ ];
24
+ export const toJEScheduleMainTab = (v) => stringToUnion(v, JE_SCHEDULE_MAIN_TABS);
@@ -3,6 +3,7 @@ import { getSummationFreeRangeTotalBalance } from '../../commonStateTypes/coaBal
3
3
  import { defaultCustomerCurrency } from '../../commonStateTypes/currencyHelper';
4
4
  import { reduceFetchStateParallelTimeframes } from '../../commonStateTypes/reduceFetchState';
5
5
  import { getSectionClassesViewReport } from '../../entity/sectionClassesViewV2/sectionClassesViewSelector';
6
+ import { HORIZONTAL_CLASS_TOTAL_BALANCE_ID, } from './profitAndLossClassesByClassHorizontalSelectorTypes';
6
7
  import { enrichProfitAndLossByClassHorizontalReport } from './profitAndLossHorizontalEnrichment';
7
8
  /** Standard class ID returned by the accounting platform for transactions without an assigned class. */
8
9
  export const NOT_SPECIFIED_CLASS_ID = 'not_specified';
@@ -317,6 +318,7 @@ function buildHeaderBalances(classColumns, timeframe, selectedPeriod, currency)
317
318
  startDate,
318
319
  type: 'default',
319
320
  label: col.className,
321
+ id: col.classId,
320
322
  }));
321
323
  // Add a "Total" column
322
324
  balances.push({
@@ -326,6 +328,7 @@ function buildHeaderBalances(classColumns, timeframe, selectedPeriod, currency)
326
328
  startDate,
327
329
  type: 'default',
328
330
  label: 'Total',
331
+ id: HORIZONTAL_CLASS_TOTAL_BALANCE_ID,
329
332
  });
330
333
  return balances;
331
334
  }
@@ -0,0 +1,26 @@
1
+ import { date } from '../../../zeniDayJS';
2
+ export const mapPayloadToAutoTransferRule = (payload) => ({
3
+ amount: payload.amount,
4
+ autoTransferRuleId: payload.auto_transfer_rule_id,
5
+ createTime: payload.create_time != null ? date(payload.create_time) : undefined,
6
+ currencyCode: payload.currency_code,
7
+ currencySymbol: payload.currency_symbol ?? '$',
8
+ destinationBankAccountId: payload.destination_bank_account_id,
9
+ destinationBankAccountMetadata: payload.destination_bank_account_metadata?.map((m) => ({
10
+ accountId: m.account_id,
11
+ accountType: m.account_type,
12
+ percentage: m.percentage,
13
+ })) ?? undefined,
14
+ destinationBankAccountType: payload.destination_bank_account_type ?? undefined,
15
+ frequency: payload.frequency,
16
+ isActive: payload.is_active,
17
+ isDeleted: payload.is_deleted,
18
+ lastRunTime: payload.last_run_time,
19
+ nextTransferDate: payload.next_transfer_date != null
20
+ ? date(payload.next_transfer_date)
21
+ : undefined,
22
+ ruleType: payload.rule_type,
23
+ sourceBankAccountId: payload.source_bank_account_id,
24
+ sourceBankAccountType: payload.source_bank_account_type,
25
+ updateTime: payload.update_time != null ? date(payload.update_time) : undefined,
26
+ });
@@ -0,0 +1,199 @@
1
+ import { createSlice } from '@reduxjs/toolkit';
2
+ import recordGet from 'lodash/get';
3
+ import { initialCommonHistory } from '../commonHistoryView/commonHistory';
4
+ import { toHistoricEvent, } from '../commonHistoryView/commonHistoryPayload';
5
+ import { mapReviewTransferMoneyPayloadToReviewTransferMoney, } from '../zeniAccounts/transferDetail/transferDetailPayload';
6
+ export const initialState = {
7
+ autoTransferReviewDetail: {
8
+ reviewTransferMoney: {
9
+ isShowDailyAchLimitWarning: false,
10
+ dailyAchDebitLimit: {
11
+ amount: 0,
12
+ currencyCode: 'USD',
13
+ currencySymbol: '$',
14
+ },
15
+ transferSchedules: [],
16
+ },
17
+ fetchState: 'Not-Started',
18
+ error: undefined,
19
+ },
20
+ historyByRuleId: {},
21
+ ruleDeleteStatusById: {},
22
+ ruleUpdateLocalData: {},
23
+ ruleUpdateStatusById: {},
24
+ rules: [],
25
+ fetchState: 'Not-Started',
26
+ error: undefined,
27
+ createRuleFetchState: {
28
+ fetchState: 'Not-Started',
29
+ error: undefined,
30
+ },
31
+ hasValidState() {
32
+ return this.fetchState === 'Completed';
33
+ },
34
+ };
35
+ const autotransferRules = createSlice({
36
+ name: 'autotransferRules',
37
+ initialState,
38
+ reducers: {
39
+ fetchAutoTransferRules: {
40
+ reducer(draft) {
41
+ draft.fetchState = 'In-Progress';
42
+ },
43
+ prepare(cacheOverride = false) {
44
+ return {
45
+ payload: {
46
+ cacheOverride,
47
+ },
48
+ };
49
+ },
50
+ },
51
+ updateAutoTransferRules(draft, action) {
52
+ draft.rules = action.payload.rules;
53
+ draft.fetchState = 'Completed';
54
+ draft.error = undefined;
55
+ },
56
+ updateAutoTransferRulesFailure(draft, action) {
57
+ draft.fetchState = action.payload.fetchState;
58
+ draft.error = action.payload.error;
59
+ },
60
+ updateRuleLocalData(draft, action) {
61
+ draft.ruleUpdateLocalData = {
62
+ ...draft.ruleUpdateLocalData,
63
+ ...action.payload,
64
+ };
65
+ },
66
+ clearRuleUpdateLocalData(draft) {
67
+ draft.ruleUpdateLocalData = {};
68
+ },
69
+ fetchAutoTransferReviewDetail(draft) {
70
+ draft.autoTransferReviewDetail.fetchState = 'In-Progress';
71
+ draft.autoTransferReviewDetail.error = undefined;
72
+ },
73
+ updateAutoTransferReviewDetail(draft, action) {
74
+ draft.autoTransferReviewDetail.fetchState = 'Completed';
75
+ draft.autoTransferReviewDetail.error = undefined;
76
+ draft.autoTransferReviewDetail.reviewTransferMoney =
77
+ mapReviewTransferMoneyPayloadToReviewTransferMoney(action.payload);
78
+ },
79
+ updateAutoTransferReviewDetailFailure(draft, action) {
80
+ draft.autoTransferReviewDetail.fetchState = 'Error';
81
+ draft.autoTransferReviewDetail.error = action.payload;
82
+ },
83
+ clearAutoTransferReviewDetail(draft) {
84
+ draft.autoTransferReviewDetail = initialState.autoTransferReviewDetail;
85
+ },
86
+ createAutoTransferRule(draft) {
87
+ draft.createRuleFetchState = {
88
+ fetchState: 'In-Progress',
89
+ error: undefined,
90
+ };
91
+ },
92
+ createAutoTransferRuleSuccess(draft, action) {
93
+ draft.rules = [...draft.rules, action.payload.rule];
94
+ draft.createRuleFetchState = {
95
+ fetchState: 'Completed',
96
+ error: undefined,
97
+ };
98
+ },
99
+ createAutoTransferRuleFailure(draft, action) {
100
+ draft.createRuleFetchState = {
101
+ fetchState: action.payload.fetchState,
102
+ error: action.payload.error,
103
+ };
104
+ },
105
+ updateAutoTransferRule: {
106
+ reducer(draft, action) {
107
+ draft.ruleUpdateStatusById[action.payload.ruleId] = {
108
+ fetchState: 'In-Progress',
109
+ error: undefined,
110
+ };
111
+ },
112
+ prepare(ruleId, pauseRule, resumeRule) {
113
+ return { payload: { ruleId, pauseRule, resumeRule } };
114
+ },
115
+ },
116
+ updateAutoTransferRuleSuccess(draft, action) {
117
+ const updatedRule = action.payload.rule;
118
+ draft.rules = draft.rules.map((rule) => rule.autoTransferRuleId === updatedRule.autoTransferRuleId
119
+ ? updatedRule
120
+ : rule);
121
+ draft.ruleUpdateStatusById[updatedRule.autoTransferRuleId] = {
122
+ fetchState: 'Completed',
123
+ error: undefined,
124
+ };
125
+ },
126
+ updateAutoTransferRuleFailure(draft, action) {
127
+ draft.ruleUpdateStatusById[action.payload.ruleId] = {
128
+ fetchState: action.payload.fetchState,
129
+ error: action.payload.error,
130
+ };
131
+ },
132
+ deleteAutoTransferRule: {
133
+ reducer(draft, action) {
134
+ draft.ruleDeleteStatusById[action.payload.ruleId] = {
135
+ fetchState: 'In-Progress',
136
+ error: undefined,
137
+ };
138
+ },
139
+ prepare(ruleId) {
140
+ return { payload: { ruleId } };
141
+ },
142
+ },
143
+ deleteAutoTransferRuleSuccess(draft, action) {
144
+ const { ruleId } = action.payload;
145
+ draft.rules = draft.rules.filter((rule) => rule.autoTransferRuleId !== ruleId);
146
+ draft.ruleDeleteStatusById[ruleId] = {
147
+ fetchState: 'Completed',
148
+ error: undefined,
149
+ };
150
+ },
151
+ deleteAutoTransferRuleFailure(draft, action) {
152
+ draft.ruleDeleteStatusById[action.payload.ruleId] = {
153
+ fetchState: action.payload.fetchState,
154
+ error: action.payload.error,
155
+ };
156
+ },
157
+ fetchAutoTransferRuleHistory: {
158
+ reducer(draft, action) {
159
+ const { ruleId, cacheOverride } = action.payload;
160
+ const detail = recordGet(draft.historyByRuleId, ruleId, undefined);
161
+ if (cacheOverride === true ||
162
+ detail == null ||
163
+ detail.fetchState !== 'In-Progress') {
164
+ draft.historyByRuleId[ruleId] = {
165
+ ...initialCommonHistory,
166
+ };
167
+ }
168
+ },
169
+ prepare(ruleId, cacheOverride = true) {
170
+ return {
171
+ payload: { ruleId, cacheOverride },
172
+ };
173
+ },
174
+ },
175
+ updateAutoTransferRuleHistory(draft, action) {
176
+ const { ruleId, historicEventsPayload } = action.payload;
177
+ const historicEvents = historicEventsPayload.map((historicEventPayload) => toHistoricEvent(historicEventPayload));
178
+ draft.historyByRuleId[ruleId] = {
179
+ ...initialCommonHistory,
180
+ fetchState: 'Completed',
181
+ error: undefined,
182
+ historicEvents,
183
+ };
184
+ },
185
+ updateAutoTransferRuleHistoryFetchStatus(draft, action) {
186
+ const { ruleId, fetchState, error } = action.payload;
187
+ const detail = recordGet(draft.historyByRuleId, ruleId, undefined);
188
+ if (detail != null) {
189
+ detail.fetchState = fetchState;
190
+ detail.error = error;
191
+ }
192
+ },
193
+ clearAutoTransferRules(draft) {
194
+ Object.assign(draft, initialState);
195
+ },
196
+ },
197
+ });
198
+ export const { fetchAutoTransferRules, updateAutoTransferRules, updateAutoTransferRulesFailure, fetchAutoTransferReviewDetail, updateAutoTransferReviewDetail, updateAutoTransferReviewDetailFailure, clearAutoTransferReviewDetail, createAutoTransferRule, createAutoTransferRuleSuccess, createAutoTransferRuleFailure, updateAutoTransferRule, updateAutoTransferRuleSuccess, updateAutoTransferRuleFailure, deleteAutoTransferRule, deleteAutoTransferRuleSuccess, deleteAutoTransferRuleFailure, fetchAutoTransferRuleHistory, updateAutoTransferRuleHistory, updateAutoTransferRuleHistoryFetchStatus, updateRuleLocalData, clearRuleUpdateLocalData, clearAutoTransferRules, } = autotransferRules.actions;
199
+ export default autotransferRules.reducer;
@@ -0,0 +1,52 @@
1
+ import recordGet from 'lodash/get';
2
+ import { reduceAllFetchState } from '../../../commonStateTypes/reduceFetchState';
3
+ import { getAllFundingAccounts, } from '../commonSetup/setupViewSelector';
4
+ import { getAllDepositAccounts } from '../zeniAccounts/depositAccountList/depositAccountListSelector';
5
+ import { getAllPaymentAccounts } from '../zeniAccounts/paymentAccountList/paymentAccountListSelector';
6
+ export const getAutoTransferRules = (state) => {
7
+ const { autotransferRulesState, depositAccountState, paymentAccountState, depositAccountListState, paymentAccountListState, treasuryDetailState, } = state;
8
+ const { rules, error, historyByRuleId, ruleUpdateLocalData, ruleUpdateStatusById, ruleDeleteStatusById, createRuleFetchState, autoTransferReviewDetail, } = autotransferRulesState;
9
+ const depositAccountsView = getAllDepositAccounts(depositAccountState, depositAccountListState);
10
+ const paymentAccountsView = getAllPaymentAccounts(paymentAccountState, paymentAccountListState);
11
+ let transferMoneyParties = [];
12
+ const transferMoneyPartiesFetchState = reduceAllFetchState([
13
+ depositAccountsView,
14
+ paymentAccountsView,
15
+ ]).fetchState;
16
+ const fetchState = reduceAllFetchState([
17
+ autotransferRulesState,
18
+ depositAccountsView,
19
+ paymentAccountsView,
20
+ ]).fetchState;
21
+ if (depositAccountsView.fetchState === 'Completed' &&
22
+ paymentAccountsView.fetchState === 'Completed') {
23
+ transferMoneyParties = getAllFundingAccounts(depositAccountsView.depositAccounts, paymentAccountsView.paymentAccounts, paymentAccountListState.paymentAccountBalanceFetchStatus);
24
+ }
25
+ const treasuryAccount = {
26
+ accType: 'treasuryAccount',
27
+ label: 'Treasury',
28
+ id: 'treasury',
29
+ balance: treasuryDetailState.accountSummary?.availableBalance,
30
+ };
31
+ return {
32
+ autoTransferReviewDetail,
33
+ rules,
34
+ ruleUpdateLocalData,
35
+ ruleUpdateStatusById,
36
+ ruleDeleteStatusById,
37
+ ruleHistory: historyByRuleId,
38
+ treasuryAccount,
39
+ transferMoneyParties,
40
+ transferMoneyPartiesFetchState,
41
+ createRuleFetchState,
42
+ fetchState,
43
+ error,
44
+ version: 0,
45
+ };
46
+ };
47
+ export const getAutoTransferRuleById = (state, ruleId) => {
48
+ return state.autotransferRulesState.rules.find((rule) => rule.autoTransferRuleId === ruleId);
49
+ };
50
+ export const getAutoTransferRuleHistory = (state, ruleId) => {
51
+ return recordGet(state.autotransferRulesState.historyByRuleId, ruleId, undefined);
52
+ };
@@ -0,0 +1,100 @@
1
+ import { from, of } from 'rxjs';
2
+ import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
+ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
5
+ import { mapPayloadToAutoTransferRule, } from '../autoTransferRulesPayload';
6
+ import { createAutoTransferRule, createAutoTransferRuleFailure, createAutoTransferRuleSuccess, } from '../autoTransferRulesReducer';
7
+ export const createAutoTransferRuleEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(createAutoTransferRule.match), switchMap(() => {
8
+ const requestBody = mapAutoTransferRuleLocalDataToPayload(state$.value.autotransferRulesState.ruleUpdateLocalData);
9
+ return zeniAPI
10
+ .postAndGetJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/rules/transfer/auto`, requestBody)
11
+ .pipe(mergeMap((response) => {
12
+ if (isSuccessResponse(response) && response.data != null) {
13
+ const rule = mapPayloadToAutoTransferRule(response.data.auto_transfer_rule);
14
+ const actions = [
15
+ createAutoTransferRuleSuccess({ rule }),
16
+ openSnackbar({
17
+ messageSection: 'auto_transfer_rule_create',
18
+ messageText: 'success',
19
+ type: 'success',
20
+ }),
21
+ ];
22
+ return from(actions);
23
+ }
24
+ else {
25
+ return from([
26
+ createAutoTransferRuleFailure({
27
+ fetchState: 'Error',
28
+ error: response.status,
29
+ }),
30
+ openSnackbar({
31
+ messageSection: 'auto_transfer_rule_create',
32
+ messageText: 'failed',
33
+ type: 'error',
34
+ variables: [
35
+ {
36
+ variableName: '_api-error_',
37
+ variableValue: response.status.message,
38
+ },
39
+ ],
40
+ }),
41
+ ]);
42
+ }
43
+ }), catchError((error) => of(createAutoTransferRuleFailure({
44
+ fetchState: 'Error',
45
+ error: createZeniAPIStatus('Unexpected Error', 'Create auto transfer rule REST API call errored out ' +
46
+ JSON.stringify(error)),
47
+ }))));
48
+ }));
49
+ export function mapAutoTransferRuleLocalDataToPayload(localData, pauseRule, resumeRule) {
50
+ if (pauseRule === true) {
51
+ return {
52
+ is_active: false,
53
+ };
54
+ }
55
+ if (resumeRule === true) {
56
+ return {
57
+ is_active: true,
58
+ };
59
+ }
60
+ const payload = {
61
+ ...(localData.amount != null &&
62
+ localData.ruleType !== 'percentage_of_balance' && {
63
+ amount: localData.amount.amount,
64
+ currency_code: localData.amount.currencyCode,
65
+ }),
66
+ ...(localData.destinationAccount != null && {
67
+ destination_bank_account_id: localData.destinationAccount.id,
68
+ destination_bank_account_type: accountTypeSubConfigCodeToAccType(localData.destinationAccount.accType),
69
+ }),
70
+ ...(localData.destinationAccountWithPercentAllocation != null && {
71
+ destination_bank_account_metadata: localData.destinationAccountWithPercentAllocation.map((allocation) => ({
72
+ account_id: allocation.account.id,
73
+ account_type: accountTypeSubConfigCodeToAccType(allocation.account.accType),
74
+ percentage: allocation.percentage,
75
+ })),
76
+ }),
77
+ frequency: localData.frequency,
78
+ rule_type: localData.ruleType,
79
+ ...(localData.sourceAccount != null && {
80
+ source_bank_account_id: localData.sourceAccount.id,
81
+ source_bank_account_type: accountTypeSubConfigCodeToAccType(localData.sourceAccount.accType),
82
+ }),
83
+ ...(localData.firstTransferDate != null && {
84
+ first_transfer_date: localData.firstTransferDate.format('YYYY-MM-DD'),
85
+ }),
86
+ };
87
+ return payload;
88
+ }
89
+ export const accountTypeSubConfigCodeToAccType = (code) => {
90
+ switch (code) {
91
+ case 'depositAccount':
92
+ return 'deposit_account';
93
+ case 'paymentAccount':
94
+ return 'payment_account';
95
+ case 'treasuryAccount':
96
+ return 'treasury_account';
97
+ default:
98
+ return undefined;
99
+ }
100
+ };
@@ -0,0 +1,48 @@
1
+ import { from, of } from 'rxjs';
2
+ import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
+ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
4
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
5
+ import { deleteAutoTransferRule, deleteAutoTransferRuleFailure, deleteAutoTransferRuleSuccess, } from '../autoTransferRulesReducer';
6
+ export const deleteAutoTransferRuleEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(deleteAutoTransferRule.match), switchMap((action) => {
7
+ const { ruleId } = action.payload;
8
+ return zeniAPI
9
+ .deleteAndGetJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/rules/transfer/auto/${ruleId}`)
10
+ .pipe(mergeMap((response) => {
11
+ if (isSuccessResponse(response)) {
12
+ const actions = [
13
+ deleteAutoTransferRuleSuccess({ ruleId }),
14
+ openSnackbar({
15
+ messageSection: 'auto_transfer_rule_delete',
16
+ messageText: 'success',
17
+ type: 'success',
18
+ }),
19
+ ];
20
+ return from(actions);
21
+ }
22
+ else {
23
+ return from([
24
+ deleteAutoTransferRuleFailure({
25
+ ruleId,
26
+ fetchState: 'Error',
27
+ error: response.status,
28
+ }),
29
+ openSnackbar({
30
+ messageSection: 'auto_transfer_rule_delete',
31
+ messageText: 'failed',
32
+ type: 'error',
33
+ variables: [
34
+ {
35
+ variableName: '_api-error_',
36
+ variableValue: response.status.message,
37
+ },
38
+ ],
39
+ }),
40
+ ]);
41
+ }
42
+ }), catchError((error) => of(deleteAutoTransferRuleFailure({
43
+ ruleId,
44
+ fetchState: 'Error',
45
+ error: createZeniAPIStatus('Unexpected Error', 'Delete auto transfer rule REST API call errored out ' +
46
+ JSON.stringify(error)),
47
+ }))));
48
+ }));
@@ -0,0 +1,36 @@
1
+ import { of } from 'rxjs';
2
+ import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
4
+ import { fetchAutoTransferReviewDetail, updateAutoTransferReviewDetail, updateAutoTransferReviewDetailFailure, } from '../autoTransferRulesReducer';
5
+ import { accountTypeSubConfigCodeToAccType } from './createAutoTransferRuleEpic';
6
+ export const fetchAutoTransferReviewDetailEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchAutoTransferReviewDetail.match), switchMap(() => {
7
+ const localData = state$.value.autotransferRulesState.ruleUpdateLocalData;
8
+ const payload = {
9
+ ...(localData.sourceAccount != null && {
10
+ from_account: {
11
+ account_id: localData.sourceAccount.id,
12
+ account_type: accountTypeSubConfigCodeToAccType(localData.sourceAccount.accType) ?? '',
13
+ },
14
+ }),
15
+ ...(localData.destinationAccount != null && {
16
+ to_account: {
17
+ account_id: localData.destinationAccount.id,
18
+ account_type: accountTypeSubConfigCodeToAccType(localData.destinationAccount.accType) ?? '',
19
+ },
20
+ }),
21
+ ...(localData.amount != null && {
22
+ amount: localData.amount.amount,
23
+ currency_code: localData.amount.currencyCode,
24
+ currency_symbol: localData.amount.currencySymbol,
25
+ }),
26
+ };
27
+ return zeniAPI
28
+ .postAndGetJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/deposit-accounts/transfers/review`, payload)
29
+ .pipe(mergeMap((response) => {
30
+ if (isSuccessResponse(response) && response.data != null) {
31
+ return of(updateAutoTransferReviewDetail(response.data));
32
+ }
33
+ return of(updateAutoTransferReviewDetailFailure(response.status));
34
+ }), catchError((error) => of(updateAutoTransferReviewDetailFailure(createZeniAPIStatus('Unexpected Error', 'Fetch auto transfer review detail REST API call errored out ' +
35
+ JSON.stringify(error))))));
36
+ }));
@@ -0,0 +1,45 @@
1
+ import recordGet from 'lodash/get';
2
+ import { concat, from, of } from 'rxjs';
3
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
4
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
5
+ import { fetchAutoTransferRuleHistory, updateAutoTransferRuleHistory, updateAutoTransferRuleHistoryFetchStatus, } from '../autoTransferRulesReducer';
6
+ export const fetchAutoTransferRuleHistoryEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchAutoTransferRuleHistory.match), mergeMap((action) => {
7
+ const { ruleId, cacheOverride } = action.payload;
8
+ const historyActions = [];
9
+ const state = state$.value;
10
+ const historyDetail = recordGet(state.autotransferRulesState.historyByRuleId, ruleId, undefined);
11
+ if (cacheOverride === true ||
12
+ historyDetail == null ||
13
+ historyDetail.fetchState !== 'In-Progress') {
14
+ historyActions.push(updateAutoTransferRuleHistoryFetchStatus({
15
+ ruleId,
16
+ fetchState: 'In-Progress',
17
+ }));
18
+ const getHistoryDetail$ = zeniAPI
19
+ .getJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/rules/transfer/auto/${ruleId}/history`)
20
+ .pipe(mergeMap((response) => {
21
+ if (isSuccessResponse(response) && response.data != null) {
22
+ return of(updateAutoTransferRuleHistory({
23
+ ruleId,
24
+ historicEventsPayload: response.data.activities,
25
+ }));
26
+ }
27
+ else {
28
+ return of(updateAutoTransferRuleHistoryFetchStatus({
29
+ ruleId,
30
+ fetchState: 'Error',
31
+ error: response.status,
32
+ }));
33
+ }
34
+ }), catchError((error) => of(updateAutoTransferRuleHistoryFetchStatus({
35
+ ruleId,
36
+ fetchState: 'Error',
37
+ error: createZeniAPIStatus('Unexpected Error', 'Fetch auto transfer rule history REST API call errored out ' +
38
+ JSON.stringify(error)),
39
+ }))));
40
+ return concat(from(historyActions), getHistoryDetail$);
41
+ }
42
+ else {
43
+ return from(historyActions);
44
+ }
45
+ }));
@@ -0,0 +1,50 @@
1
+ import { from, of } from 'rxjs';
2
+ import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
4
+ import { fetchTreasuryOverviewDetail } from '../../treasury/treasuryList/treasuryDetailReducer';
5
+ import { fetchDepositAccountList } from '../../zeniAccounts/depositAccountList/depositAccountListReducer';
6
+ import { fetchPaymentAccountList } from '../../zeniAccounts/paymentAccountList/paymentAccountListReducer';
7
+ import { mapPayloadToAutoTransferRule, } from '../autoTransferRulesPayload';
8
+ import { fetchAutoTransferRules, updateAutoTransferRules, updateAutoTransferRulesFailure, } from '../autoTransferRulesReducer';
9
+ export const fetchAutoTransferRulesEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchAutoTransferRules.match), switchMap((action) => {
10
+ const state = state$.value;
11
+ const { cacheOverride } = action.payload;
12
+ const { autotransferRulesState, depositAccountListState, paymentAccountListState, } = state;
13
+ if (cacheOverride === true ||
14
+ (autotransferRulesState.hasValidState() === false &&
15
+ autotransferRulesState.fetchState !== 'In-Progress')) {
16
+ return zeniAPI
17
+ .getJSON(`${zeniAPI.apiEndPoints.bankingMicroServiceBaseUrl}/1.0/rules/transfer/auto/list`)
18
+ .pipe(mergeMap((response) => {
19
+ if (isSuccessResponse(response) && response.data != null) {
20
+ const rules = response.data.auto_transfer_rules.map(mapPayloadToAutoTransferRule);
21
+ const actions = [
22
+ updateAutoTransferRules({ rules }),
23
+ ];
24
+ if (depositAccountListState.fetchState !== 'In-Progress' &&
25
+ depositAccountListState.fetchState !== 'Completed') {
26
+ actions.push(fetchDepositAccountList());
27
+ }
28
+ if (paymentAccountListState.fetchState !== 'In-Progress' &&
29
+ paymentAccountListState.fetchState !== 'Completed') {
30
+ actions.push(fetchPaymentAccountList());
31
+ }
32
+ actions.push(fetchTreasuryOverviewDetail(false, true));
33
+ return from(actions);
34
+ }
35
+ else {
36
+ return of(updateAutoTransferRulesFailure({
37
+ fetchState: 'Error',
38
+ error: response.status,
39
+ }));
40
+ }
41
+ }), catchError((error) => of(updateAutoTransferRulesFailure({
42
+ fetchState: 'Error',
43
+ error: createZeniAPIStatus('Unexpected Error', 'Fetch auto transfer rules REST API call errored out ' +
44
+ JSON.stringify(error)),
45
+ }))));
46
+ }
47
+ else {
48
+ return from([]);
49
+ }
50
+ }));