@zeniai/client-epic-state 4.20.2-beta37RR → 4.20.2-betaJK1

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 (221) 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/viewAndReport/viewAndReport.d.ts +2 -2
  5. package/lib/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
  6. package/lib/entity/account/accountPayload.d.ts +2 -0
  7. package/lib/entity/account/accountReducer.d.ts +5 -2
  8. package/lib/entity/account/accountReducer.js +7 -2
  9. package/lib/entity/account/accountSelector.d.ts +1 -0
  10. package/lib/entity/account/accountSelector.js +8 -1
  11. package/lib/entity/account/accountState.d.ts +1 -1
  12. package/lib/entity/accountGroup/accountGroupState.d.ts +1 -1
  13. package/lib/entity/aiCfo/aiCfoSelector.d.ts +1 -2
  14. package/lib/entity/billPay/billTransaction/billTransactionState.d.ts +2 -2
  15. package/lib/entity/class/classReducer.d.ts +4 -4
  16. package/lib/entity/class/classState.d.ts +1 -1
  17. package/lib/entity/forecast/forecastState.d.ts +1 -1
  18. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +38 -0
  19. package/lib/entity/jeSchedules/jeSchedulesPayload.js +78 -0
  20. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +4 -1
  21. package/lib/entity/jeSchedules/jeSchedulesSelector.js +5 -1
  22. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +37 -0
  23. package/lib/entity/sectionAccountsView/sectionAccountsView.d.ts +1 -1
  24. package/lib/entity/sectionClassesViewV2/sectionClassesView.d.ts +1 -1
  25. package/lib/entity/sectionClassesViewV2/sectionClassesViewReducer.d.ts +2 -2
  26. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  27. package/lib/entity/snackbar/snackbarTypes.js +0 -2
  28. package/lib/entity/task/taskPayload.d.ts +0 -3
  29. package/lib/entity/task/taskPayload.js +0 -5
  30. package/lib/entity/task/taskState.d.ts +0 -3
  31. package/lib/entity/tenant/tenantPayload.d.ts +1 -0
  32. package/lib/entity/tenant/tenantReducer.js +1 -0
  33. package/lib/entity/tenant/tenantSelector.d.ts +1 -0
  34. package/lib/entity/tenant/tenantSelector.js +9 -1
  35. package/lib/entity/tenant/tenantState.d.ts +1 -0
  36. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +4 -1
  37. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
  38. package/lib/entity/transaction/payloadTypes/transactionPayload.d.ts +3 -0
  39. package/lib/entity/transaction/payloadTypes/transactionPayload.js +18 -1
  40. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +1 -0
  41. package/lib/entity/transaction/stateTypes/transaction.d.ts +5 -0
  42. package/lib/entity/transaction/stateTypes/transactionLine.d.ts +1 -1
  43. package/lib/epic.d.ts +4 -3
  44. package/lib/epic.js +4 -3
  45. package/lib/esm/common/aiCfo/aiCfoSuggestedQuestionsPageContext.js +1 -0
  46. package/lib/esm/commonStateTypes/viewAndReport/viewAndReport.js +1 -0
  47. package/lib/esm/entity/account/accountReducer.js +6 -1
  48. package/lib/esm/entity/account/accountSelector.js +6 -0
  49. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +78 -0
  50. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +5 -1
  51. package/lib/esm/entity/snackbar/snackbarTypes.js +0 -2
  52. package/lib/esm/entity/task/taskPayload.js +0 -5
  53. package/lib/esm/entity/tenant/tenantReducer.js +1 -0
  54. package/lib/esm/entity/tenant/tenantSelector.js +7 -0
  55. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +1 -0
  56. package/lib/esm/entity/transaction/payloadTypes/transactionPayload.js +18 -1
  57. package/lib/esm/epic.js +4 -3
  58. package/lib/esm/index.js +14 -13
  59. package/lib/esm/view/aiCfoView/aiCfoViewReducer.js +82 -1
  60. package/lib/esm/view/aiCfoView/aiCfoViewSelector.js +8 -2
  61. package/lib/esm/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +29 -0
  62. package/lib/esm/view/classList/fetchClassListEpic.js +9 -2
  63. package/lib/esm/view/commonVendorView/vendorView/vendorViewSelector.js +18 -5
  64. package/lib/esm/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
  65. package/lib/esm/view/companyView/types/cockpitTypes.js +0 -1
  66. package/lib/esm/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js +44 -0
  67. package/lib/esm/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +6 -11
  68. package/lib/esm/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.js +44 -0
  69. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
  70. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +2 -2
  71. package/lib/esm/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +4 -3
  72. package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +0 -1
  73. package/lib/esm/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  74. package/lib/esm/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  75. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +17 -1
  76. package/lib/esm/view/expenseAutomationView/reducers/reconciliationViewReducer.js +148 -3
  77. package/lib/esm/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +10 -2
  78. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +63 -6
  79. package/lib/esm/view/expenseAutomationView/selectors/missingReceiptsSelector.js +12 -4
  80. package/lib/esm/view/expenseAutomationView/selectors/reconciliationViewSelector.js +90 -10
  81. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +12 -6
  82. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +18 -1
  83. package/lib/esm/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +3 -0
  84. package/lib/esm/view/spendManagement/billPay/billList/billListSelector.js +10 -0
  85. package/lib/esm/view/spendManagement/billPay/billList/billListState.js +1 -0
  86. package/lib/esm/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +7 -3
  87. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  88. package/lib/esm/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
  89. package/lib/esm/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
  90. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
  91. package/lib/esm/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
  92. package/lib/esm/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +7 -4
  93. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
  94. package/lib/esm/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
  95. package/lib/esm/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +0 -3
  96. package/lib/esm/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +0 -5
  97. package/lib/esm/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -1
  98. package/lib/esm/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +0 -1
  99. package/lib/esm/view/taskManager/taskDetailView/taskDetail.js +0 -4
  100. package/lib/esm/view/taskManager/taskDetailView/taskDetailReducer.js +1 -49
  101. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +2 -11
  102. package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +8 -56
  103. package/lib/esm/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +0 -1
  104. package/lib/esm/view/taskManager/taskListView/epics/fetchTaskListEpic.js +3 -13
  105. package/lib/esm/view/taskManager/taskListView/taskList.js +0 -8
  106. package/lib/esm/view/taskManager/taskListView/taskListReducer.js +12 -106
  107. package/lib/esm/view/taskManager/taskListView/taskListSelector.js +39 -51
  108. package/lib/esm/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  109. package/lib/esm/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
  110. package/lib/index.d.ts +20 -17
  111. package/lib/index.js +44 -36
  112. package/lib/view/aiCfoView/aiCfoViewPayload.d.ts +7 -0
  113. package/lib/view/aiCfoView/aiCfoViewReducer.d.ts +15 -1
  114. package/lib/view/aiCfoView/aiCfoViewReducer.js +83 -2
  115. package/lib/view/aiCfoView/aiCfoViewSelector.d.ts +4 -1
  116. package/lib/view/aiCfoView/aiCfoViewSelector.js +9 -2
  117. package/lib/view/aiCfoView/aiCfoViewState.d.ts +15 -1
  118. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.d.ts +8 -0
  119. package/lib/view/aiCfoView/epics/fetchSuggestedQuestionsEpic.js +33 -0
  120. package/lib/view/auditReportView/auditReportViewState.d.ts +2 -2
  121. package/lib/view/billPayCard/billPayCardSelector.d.ts +1 -1
  122. package/lib/view/cardBalance/cardBalanceSelector.d.ts +1 -1
  123. package/lib/view/cashBalance/cashBalanceSelector.d.ts +1 -1
  124. package/lib/view/cashInCashOut/cashInCashOutSelector.d.ts +1 -1
  125. package/lib/view/cashPosition/cashPositionSelector.d.ts +1 -1
  126. package/lib/view/classList/fetchClassListEpic.d.ts +1 -1
  127. package/lib/view/classList/fetchClassListEpic.js +8 -1
  128. package/lib/view/commonVendorView/vendorView/vendorViewSelector.d.ts +1 -0
  129. package/lib/view/commonVendorView/vendorView/vendorViewSelector.js +18 -5
  130. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.d.ts +1 -0
  131. package/lib/view/commonVendorView/vendorsTabVendorView/vendorsTabVendorViewSelector.js +6 -2
  132. package/lib/view/companyTaskManagerView/companyTaskManagerViewReducer.d.ts +2 -2
  133. package/lib/view/companyView/types/cockpitTypes.d.ts +1 -1
  134. package/lib/view/companyView/types/cockpitTypes.js +0 -1
  135. package/lib/view/dashboard/dashboardReducer.d.ts +2 -2
  136. package/lib/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.d.ts +8 -0
  137. package/lib/view/expenseAutomationView/epics/accountRecon/excludeAccountFromReconciliationEpic.js +48 -0
  138. package/lib/view/expenseAutomationView/epics/accountRecon/fetchReconciliationViewEpic.js +6 -11
  139. package/lib/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.d.ts +9 -0
  140. package/lib/view/expenseAutomationView/epics/accountRecon/includeAccountInReconciliationEpic.js +48 -0
  141. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +2 -2
  142. package/lib/view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic.js +1 -1
  143. package/lib/view/expenseAutomationView/epics/missingReceipts/watchBulkUploadBatchStatusEpic.js +4 -3
  144. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +0 -1
  145. package/lib/view/expenseAutomationView/helpers/saveTransactionHelper.js +2 -2
  146. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  147. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.js +2 -2
  148. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +1 -1
  149. package/lib/view/expenseAutomationView/payload/reconciliationPayload.d.ts +33 -0
  150. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +2 -2
  151. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +18 -2
  152. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.d.ts +14 -3
  153. package/lib/view/expenseAutomationView/reducers/reconciliationViewReducer.js +149 -4
  154. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +2 -0
  155. package/lib/view/expenseAutomationView/selectorTypes/reconciliationViewSelectorTypes.d.ts +11 -1
  156. package/lib/view/expenseAutomationView/selectors/fluxAnalysisViewSelector.js +10 -2
  157. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +63 -6
  158. package/lib/view/expenseAutomationView/selectors/missingReceiptsSelector.js +12 -4
  159. package/lib/view/expenseAutomationView/selectors/reconciliationViewSelector.js +89 -9
  160. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +11 -5
  161. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +5 -0
  162. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +20 -0
  163. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +12 -0
  164. package/lib/view/financeStatement/financeStatementReducer.d.ts +1 -1
  165. package/lib/view/globalMerchantView/globalMerchantViewReducer.d.ts +2 -2
  166. package/lib/view/onboardingView/cockpitView/types/onboardingCockpitViewTypes.d.ts +1 -1
  167. package/lib/view/profitAndLossClassesView/profitAndLossClassesByClassHorizontalSelector.js +3 -0
  168. package/lib/view/reimbursementCard/reimbursementCardSelector.d.ts +1 -1
  169. package/lib/view/reportsResync/reportsResyncReducer.d.ts +2 -2
  170. package/lib/view/scheduleView/scheduleListView/scheduleListTypes.d.ts +1 -1
  171. package/lib/view/spendManagement/billPay/billList/billListSelector.js +10 -0
  172. package/lib/view/spendManagement/billPay/billList/billListState.d.ts +1 -1
  173. package/lib/view/spendManagement/billPay/billList/billListState.js +1 -0
  174. package/lib/view/spendManagement/billPay/billPayReview/billPayReviewSelector.js +7 -3
  175. package/lib/view/spendManagement/billPay/billPaySetupApproverView/billPaySetupApproverViewSelector.js +5 -5
  176. package/lib/view/spendManagement/billPay/billPaySetupApproverView/epic/fetchBillPayApproversDetailsEpic.js +7 -2
  177. package/lib/view/spendManagement/billPay/editBillView/editBillViewSelector.js +13 -6
  178. package/lib/view/spendManagement/chargeCards/chargeCardDetail/chargeCardDetail.d.ts +1 -1
  179. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.d.ts +1 -1
  180. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardList.js +1 -0
  181. package/lib/view/spendManagement/chargeCards/chargeCardList/chargeCardListSelector.js +2 -0
  182. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +6 -3
  183. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.d.ts +1 -0
  184. package/lib/view/spendManagement/reimbursement/remiListView/remiListSelector.js +12 -0
  185. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.d.ts +1 -1
  186. package/lib/view/spendManagement/reimbursement/remiListView/remiListState.js +1 -0
  187. package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.d.ts +1 -2
  188. package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +0 -3
  189. package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.d.ts +1 -2
  190. package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +0 -5
  191. package/lib/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -1
  192. package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +0 -1
  193. package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +0 -2
  194. package/lib/view/taskManager/taskDetailView/taskDetail.js +0 -4
  195. package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +1 -10
  196. package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +2 -50
  197. package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +0 -4
  198. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +2 -11
  199. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +3 -9
  200. package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +7 -55
  201. package/lib/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +0 -1
  202. package/lib/view/taskManager/taskListView/epics/fetchTaskListEpic.js +3 -13
  203. package/lib/view/taskManager/taskListView/taskList.d.ts +1 -15
  204. package/lib/view/taskManager/taskListView/taskList.js +1 -10
  205. package/lib/view/taskManager/taskListView/taskListPayload.d.ts +0 -3
  206. package/lib/view/taskManager/taskListView/taskListReducer.d.ts +4 -8
  207. package/lib/view/taskManager/taskListView/taskListReducer.js +13 -107
  208. package/lib/view/taskManager/taskListView/taskListSelector.d.ts +3 -9
  209. package/lib/view/taskManager/taskListView/taskListSelector.js +39 -51
  210. package/lib/view/tasksCard/tasksCardSelector.d.ts +1 -1
  211. package/lib/view/topEx/topExSelector.d.ts +1 -1
  212. package/lib/view/transactionDetail/epics/saveTransactionHelper.js +2 -2
  213. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +16 -14
  214. package/package.json +1 -1
  215. package/lib/esm/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +0 -65
  216. package/lib/esm/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +0 -56
  217. package/lib/tsconfig.typecheck.tsbuildinfo +0 -1
  218. package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.d.ts +0 -9
  219. package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +0 -69
  220. package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.d.ts +0 -9
  221. package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +0 -60
@@ -0,0 +1,44 @@
1
+ import { of } from 'rxjs';
2
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
+ import { changeAccountKey } from '../../../../entity/account/accountReducer';
4
+ import { getAccountKey } from '../../../../entity/account/accountState';
5
+ import { getAccountReconByAccountIdAndSelectedPeriod } from '../../../../entity/accountRecon/accountReconSelector';
6
+ import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
7
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
8
+ import { excludeAccountFromReconciliation, excludeAccountFromReconciliationFailure, excludeAccountFromReconciliationSuccess, } from '../../reducers/reconciliationViewReducer';
9
+ export const excludeAccountFromReconciliationEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(excludeAccountFromReconciliation.match), mergeMap((action) => {
10
+ const { accountId } = action.payload;
11
+ const state = state$.value;
12
+ const currentTenant = getCurrentTenant(state);
13
+ const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
14
+ const reconciliationData = getAccountReconByAccountIdAndSelectedPeriod(state, accountId, selectedPeriod);
15
+ const payload = {
16
+ account_id: accountId,
17
+ bank_balance: reconciliationData?.balance?.amount ?? null,
18
+ cleared_balance: reconciliationData?.clearedBalance?.amount ?? null,
19
+ variance: reconciliationData?.variance?.amount ?? null,
20
+ };
21
+ const apiUrl = `https://dev.api.zeni.ai/version/reconciliation/himanshu/1.0/reconciliation/excluded-accounts`;
22
+ return zeniAPI
23
+ .postAndGetJSON(apiUrl, payload)
24
+ .pipe(mergeMap((response) => {
25
+ if (isSuccessResponse(response)) {
26
+ const newAccountKey = getAccountKey('excluded_account_reconciliation', accountId);
27
+ const oldAccountKey = getAccountKey('account_reconciliation', accountId);
28
+ return of(excludeAccountFromReconciliationSuccess({
29
+ account: response.data?.excluded_account ?? undefined,
30
+ selectedPeriod,
31
+ }), changeAccountKey({
32
+ oldKey: oldAccountKey,
33
+ newKey: newAccountKey,
34
+ }));
35
+ }
36
+ else {
37
+ return of(excludeAccountFromReconciliationFailure({
38
+ error: response.status,
39
+ }));
40
+ }
41
+ }), catchError((error) => of(excludeAccountFromReconciliationFailure({
42
+ error: createZeniAPIStatus('Unexpected Error', `Exclude account from reconciliation REST API call errored out ${JSON.stringify(error)}`),
43
+ }))));
44
+ }));
@@ -48,27 +48,22 @@ export const fetchReconciliationViewEpic = (actions$, state$, zeniAPI) => action
48
48
  queryParam.is_force_refresh = true;
49
49
  }
50
50
  const apiUrl = reconciliationId != null
51
- ? `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation/${reconciliationId}?query=${encodeURIComponent(JSON.stringify(queryParam))}`
52
- : `${zeniAPI.apiEndPoints.reconciliationMicroServiceBaseUrl}/1.0/reconciliation?query=${encodeURIComponent(JSON.stringify(queryParam))}`;
51
+ ? `https://dev.api.zeni.ai/version/reconciliation/himanshu/1.0/reconciliation?query=${encodeURIComponent(JSON.stringify(queryParam))}`
52
+ : `https://dev.api.zeni.ai/version/reconciliation/himanshu/1.0/reconciliation?query=${encodeURIComponent(JSON.stringify(queryParam))}`;
53
53
  return zeniAPI.getJSON(apiUrl).pipe(mergeMap((response) => {
54
54
  if (isSuccessResponse(response) && response.data != null) {
55
55
  const updateActions = [];
56
- updateActions.push(updateAccounts(response.data.accounts, 'account_reconciliation'));
57
- updateActions.push(updateAllUsers({
56
+ const allTransactionsPerRecon = getAllReviewTransactionsFromReconcilePayload(response.data.reconciliation);
57
+ updateActions.push(updateAccounts(response.data.accounts, 'account_reconciliation'), updateAccounts(response.data.excluded_accounts, 'excluded_account_reconciliation'), updateAllUsers({
58
58
  users: response.data.users ?? [],
59
59
  updateType: 'merge',
60
- }));
61
- updateActions.push(updateFiles({ files: response.data.files ?? [] }));
62
- const allTransactionsPerRecon = getAllReviewTransactionsFromReconcilePayload(response.data.reconciliation);
63
- updateActions.push(updateMultipleReconcileTransactions(allTransactionsPerRecon, 'merge'));
64
- updateActions.push(updateAccountRecon(selectedPeriod, response.data.reconciliation));
60
+ }), updateFiles({ files: response.data.files ?? [] }), updateMultipleReconcileTransactions(allTransactionsPerRecon, 'merge'), updateAccountRecon(selectedPeriod, response.data.reconciliation));
65
61
  const reviewTabLocalData = prepareReviewTabLocalData(response.data.reconciliation[0]?.transactions?.review ?? []);
66
62
  if (accountId != null) {
67
63
  const selectedTransactionIds = getTransactionIdFromCheckedMatchedTransactionPayload(response.data.reconciliation[0].transactions.reconcile);
68
64
  updateActions.push(updateReconcileTabLocalData({
69
65
  selectedTransactionIds: selectedTransactionIds,
70
- }));
71
- updateActions.push(initializeReconciliationReviewTabLocalData(reviewTabLocalData));
66
+ }), initializeReconciliationReviewTabLocalData(reviewTabLocalData));
72
67
  }
73
68
  updateActions.push(fetchReconciliationSuccess(selectedPeriod, response.data, refreshViewInBackground, accountId));
74
69
  return from(updateActions);
@@ -0,0 +1,44 @@
1
+ import { of } from 'rxjs';
2
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
+ import { convertToPeriod } from '../../../../commonStateTypes/timePeriod';
4
+ import { changeAccountKey } from '../../../../entity/account/accountReducer';
5
+ import { getAccountKey } from '../../../../entity/account/accountState';
6
+ import { updateAccountRecon } from '../../../../entity/accountRecon/accountReconReducer';
7
+ import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
8
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
9
+ import { includeAccountInReconciliation, includeAccountInReconciliationFailure, includeAccountInReconciliationSuccess, } from '../../reducers/reconciliationViewReducer';
10
+ export const includeAccountInReconciliationEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(includeAccountInReconciliation.match), mergeMap((action) => {
11
+ const { accountId } = action.payload;
12
+ const state = state$.value;
13
+ const currentTenant = getCurrentTenant(state);
14
+ const selectedPeriod = state.expenseAutomationViewState.selectedPeriodByTenantId[currentTenant.tenantId];
15
+ const period = convertToPeriod(selectedPeriod, true);
16
+ const query = JSON.stringify({
17
+ start_date: period.start,
18
+ end_date: period.end,
19
+ });
20
+ const apiUrl = `https://dev.api.zeni.ai/version/reconciliation/himanshu/1.0/reconciliation/excluded-accounts/${accountId}?query=${encodeURIComponent(query)}`;
21
+ return zeniAPI
22
+ .deleteAndGetJSON(apiUrl)
23
+ .pipe(mergeMap((response) => {
24
+ if (isSuccessResponse(response) && response.data != null) {
25
+ const reconciliation = response.data.reconciliation;
26
+ const oldAccountKey = getAccountKey('excluded_account_reconciliation', reconciliation.account_id);
27
+ const newAccountKey = getAccountKey('account_reconciliation', reconciliation.account_id);
28
+ return of(updateAccountRecon(selectedPeriod, [reconciliation]), includeAccountInReconciliationSuccess({
29
+ reconciliation,
30
+ selectedPeriod,
31
+ }), changeAccountKey({
32
+ oldKey: oldAccountKey,
33
+ newKey: newAccountKey,
34
+ }));
35
+ }
36
+ else {
37
+ return of(includeAccountInReconciliationFailure({
38
+ error: response.status,
39
+ }));
40
+ }
41
+ }), catchError((error) => of(includeAccountInReconciliationFailure({
42
+ error: createZeniAPIStatus('Unexpected Error', `Include account in reconciliation REST API call errored out ${JSON.stringify(error)}`),
43
+ }))));
44
+ }));
@@ -21,13 +21,13 @@ export const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe
21
21
  if (isSuccessResponse(response) && response.data != null) {
22
22
  const updateActions = [];
23
23
  updateActions.push(updateJESchedules([
24
- ...response.data.draft_je_schedules,
24
+ ...response.data.je_schedules,
25
25
  ...response.data.failed_je_postings.je_schedules,
26
26
  ]), updateJESchedulesDetails([...response.data.failed_je_postings.je_schedules], response.data.failed_je_postings.scheduled_journal_entries), initializeJeScheduleLocalData([
27
27
  ...response.data.failed_je_postings.je_schedules,
28
28
  ]));
29
29
  updateActions.push(fetchJeSchedulesSuccess({
30
- jeSchedules: [...response.data.draft_je_schedules],
30
+ jeSchedules: [...response.data.je_schedules],
31
31
  failedJeSchedules: [
32
32
  ...response.data.failed_je_postings.je_schedules,
33
33
  ],
@@ -1,9 +1,9 @@
1
1
  import { concat, of, timer } from 'rxjs';
2
- import { catchError, filter, mergeMap } from 'rxjs/operators';
2
+ import { catchError, filter, mergeMap, switchMap } from 'rxjs/operators';
3
3
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
4
4
  import { BULK_UPLOAD_BAR_COMPLETE_HOLD_MS } from '../../bulkUploadTiming';
5
5
  import { bulkUploadReceipts, bulkUploadReceiptsFailure, bulkUploadReceiptsSuccess, updateBulkUploadProgress, } from '../../reducers/missingReceiptsViewReducer';
6
- export const bulkUploadReceiptsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(bulkUploadReceipts.match), mergeMap((action) => {
6
+ export const bulkUploadReceiptsEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(bulkUploadReceipts.match), switchMap((action) => {
7
7
  const { files } = action.payload;
8
8
  const formData = new FormData();
9
9
  for (const file of files) {
@@ -25,7 +25,7 @@ export const pusherBatchStatusCompletionEpic = (actions$) => actions$.pipe(filte
25
25
  * force `phase` to `completed` (dismiss automatching banner) and refresh the batch list.
26
26
  * Cancels when the batch completes normally, bulk state is cleared, or another upload supersedes.
27
27
  */
28
- export const bulkUploadAutomatchingTimeoutEpic = (actions$, state$) => actions$.pipe(filter(bulkUploadReceiptsSuccess.match), mergeMap((action) => {
28
+ export const bulkUploadAutomatchingTimeoutEpic = (actions$, state$) => actions$.pipe(filter(bulkUploadReceiptsSuccess.match), switchMap((action) => {
29
29
  const { batchId } = action.payload;
30
30
  return timer(BULK_UPLOAD_AUTOMATCHING_TIMEOUT_MS).pipe(mergeMap(() => {
31
31
  const bulk = state$.value.expenseAutomationMissingReceiptsViewState.bulkUpload;
@@ -44,10 +44,11 @@ export const bulkUploadAutomatchingTimeoutEpic = (actions$, state$) => actions$.
44
44
  * error snackbar per upload session (first failure only) so the user is not spammed every
45
45
  * interval; Pusher or a later successful poll still completes the flow.
46
46
  */
47
- export const pollBulkUploadBatchStatusEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(bulkUploadReceiptsSuccess.match), mergeMap((action) => {
47
+ export const pollBulkUploadBatchStatusEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(bulkUploadReceiptsSuccess.match), switchMap((action) => {
48
48
  const { batchId } = action.payload;
49
49
  let pollErrorNotified = false;
50
- return timer(FALLBACK_FIRST_DELAY_MS, FALLBACK_POLL_INTERVAL_MS).pipe(takeUntil(merge(actions$.pipe(filter(clearBulkUpload.match)), actions$.pipe(filter(pusherBatchStatusUpdate.match), filter((action) => action.payload.batchId === batchId)), actions$.pipe(filter(fetchBulkUploadBatchDetailsSuccess.match), filter((action) => action.payload.batchId === batchId)), actions$.pipe(filter(bulkUploadAutomatchingTimedOut.match), filter((action) => action.payload.batchId === batchId)))), switchMap(() => zeniAPI
50
+ return timer(FALLBACK_FIRST_DELAY_MS, FALLBACK_POLL_INTERVAL_MS).pipe(takeUntil(merge(actions$.pipe(filter(clearBulkUpload.match)), actions$.pipe(filter(pusherBatchStatusUpdate.match), filter((action) => action.payload.batchId === batchId &&
51
+ action.payload.status === 'completed')), actions$.pipe(filter(fetchBulkUploadBatchDetailsSuccess.match), filter((action) => action.payload.batchId === batchId)), actions$.pipe(filter(bulkUploadAutomatchingTimedOut.match), filter((action) => action.payload.batchId === batchId)))), switchMap(() => zeniAPI
51
52
  .getJSON(`${zeniAPI.apiEndPoints.communicationAgentMicroServiceBaseUrl}/1.0/batches/${batchId}`)
52
53
  .pipe(mergeMap((response) => {
53
54
  /** Same batch-details URL; polls until `status` is completed (Pusher may win first). */
@@ -91,7 +91,6 @@ export function getExpenseAutomationView(state) {
91
91
  const fetchStateVariables = [
92
92
  expenseAutomationMissingReceiptsViewState,
93
93
  expenseAutomationJESchedulesViewState,
94
- monthEndCloseChecksView,
95
94
  expenseAutomationTransactionsView,
96
95
  expenseAutomationReconciliationViewState,
97
96
  ];
@@ -64,8 +64,8 @@ export const toTransactionUpdatesFromTransactionCategorizationLocalData = (trans
64
64
  lineItem.account?.qboId !== accountLine.account.qboId &&
65
65
  Boolean(lineItem.account?.qboId);
66
66
  hasClassChanged =
67
- Boolean(lineItem.class?.qboId) &&
68
- lineItem.class?.qboId !== accountLine.class.qboId;
67
+ (lineItem.class?.qboId != null || accountLine.class?.qboId != null) &&
68
+ lineItem.class?.qboId !== accountLine.class?.qboId;
69
69
  const recommendedAccountBase = toRecommendedAccountBase(lineItem.amount.amount, lineItem.account);
70
70
  const recommendedClassBase = toRecommendedClassBase(lineItem.amount.amount, lineItem.class);
71
71
  if (entityDetails != null &&
@@ -234,7 +234,7 @@ const buildLineItemById = (transaction, uncategorizedIncomeExpense, recommendati
234
234
  isPreFilled: true,
235
235
  };
236
236
  }
237
- if (accountLine.class.classId === '' &&
237
+ if (Boolean(accountLine.class?.classId) === false &&
238
238
  higherPreferenceRecommendation?.class != null) {
239
239
  record.class = {
240
240
  ...higherPreferenceRecommendation.class,
@@ -464,7 +464,7 @@ export const setEntityRecommendationForLineIdInLocalData = (draft, transaction,
464
464
  }
465
465
  : accountLine.account;
466
466
  record.class =
467
- accountLine.class.classId !== ''
467
+ Boolean(accountLine.class?.classId) !== false
468
468
  ? accountLine.class
469
469
  : recommendations?.[0]?.class
470
470
  ? {
@@ -44,6 +44,8 @@ export const initialState = {
44
44
  uiState: {
45
45
  searchString: '',
46
46
  scrollPosition: { scrollTop: 0, scrollLeft: undefined },
47
+ sortKey: 'startMonth',
48
+ sortOrder: 'descending',
47
49
  totalCount: 0,
48
50
  limit: 10,
49
51
  },
@@ -365,12 +367,26 @@ const expenseAutomationJESchedulesView = createSlice({
365
367
  clearJeAccountSettingsLocalData(draft) {
366
368
  draft.accountSettings.localData = accountSettingsInitialState.localData;
367
369
  },
370
+ updateJESchedulesUIState(draft, action) {
371
+ if (action.payload.sortKey != null) {
372
+ draft.uiState.sortKey = action.payload.sortKey;
373
+ }
374
+ if (action.payload.sortOrder != null) {
375
+ draft.uiState.sortOrder = action.payload.sortOrder;
376
+ }
377
+ if (action.payload.searchString != null) {
378
+ draft.uiState.searchString = action.payload.searchString;
379
+ }
380
+ if (action.payload.scrollPosition != null) {
381
+ draft.uiState.scrollPosition = action.payload.scrollPosition;
382
+ }
383
+ },
368
384
  clearExpenseAutomationJESchedulesView(draft) {
369
385
  Object.assign(draft, initialState);
370
386
  },
371
387
  },
372
388
  });
373
- export const { clearExpenseAutomationJESchedulesView, clearJeAccountSettingsLocalData, clearJeScheduleLocalData, fetchAccountSettingsListForAccountTypes, fetchJeSchedules, fetchJeSchedulesFailure, fetchJeSchedulesPage, fetchJeSchedulesSuccess, fetchRecommendationForAccountSettings, ignoreRecommendedJeSchedule, ignoreRecommendedJeScheduleFailure, ignoreRecommendedJeScheduleSuccess, initializeAccountSettingsView, initializeJeScheduleLocalData, removeFailedJeScheduleTransactionKey, removeJeScheduleLocalDataById, removeJeScheduleTransactionKey, retryJeSchedule, retryJeScheduleFailure, retryJeScheduleSuccess, saveAccountSettings, saveAccountSettingsFailure, saveAccountSettingsLocalData, saveAccountSettingsSuccess, updateAccountSettingsListForAccountTypes, updateAccountSettingsListForAccountTypesFailure, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, updateRecommendationForAccountSettings, updateRecommendationForAccountSettingsFailure, } = expenseAutomationJESchedulesView.actions;
389
+ export const { clearExpenseAutomationJESchedulesView, clearJeAccountSettingsLocalData, clearJeScheduleLocalData, fetchAccountSettingsListForAccountTypes, fetchJeSchedules, fetchJeSchedulesFailure, fetchJeSchedulesPage, fetchJeSchedulesSuccess, fetchRecommendationForAccountSettings, ignoreRecommendedJeSchedule, ignoreRecommendedJeScheduleFailure, ignoreRecommendedJeScheduleSuccess, initializeAccountSettingsView, initializeJeScheduleLocalData, removeFailedJeScheduleTransactionKey, removeJeScheduleLocalDataById, removeJeScheduleTransactionKey, retryJeSchedule, retryJeScheduleFailure, retryJeScheduleSuccess, saveAccountSettings, saveAccountSettingsFailure, saveAccountSettingsLocalData, saveAccountSettingsSuccess, updateAccountSettingsListForAccountTypes, updateAccountSettingsListForAccountTypesFailure, updateJESchedulesUIState, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, updateRecommendationForAccountSettings, updateRecommendationForAccountSettingsFailure, } = expenseAutomationJESchedulesView.actions;
374
390
  export default expenseAutomationJESchedulesView.reducer;
375
391
  const doUpdateRecommendationForAccountSettings = (draft, payload) => {
376
392
  const { prepaidExpensesRecommendations, fixedAssetsRecommendations, accruedExpensesRecommendations, } = mapAccountTypeRecommendationPayloadToAccountRecommendationByType(payload);
@@ -37,7 +37,15 @@ export const initialReconciliationTabsState = {
37
37
  },
38
38
  };
39
39
  export const initialActionFetchState = {
40
+ excludeAccountFetch: {
41
+ fetchState: 'Not-Started',
42
+ error: undefined,
43
+ },
40
44
  excludeFetchById: {},
45
+ includeAccountFetch: {
46
+ fetchState: 'Not-Started',
47
+ error: undefined,
48
+ },
41
49
  reconcileFetch: {
42
50
  fetchState: 'Not-Started',
43
51
  error: undefined,
@@ -51,6 +59,7 @@ export const initialActionFetchState = {
51
59
  export const initialState = {
52
60
  accountReconciliationRecordsBySelectedPeriod: {},
53
61
  accountConnectionStatusByAccountID: {},
62
+ excludedAccountExclusionInfo: {},
54
63
  fetchState: 'Not-Started',
55
64
  error: undefined,
56
65
  selectedTab: 'review',
@@ -64,6 +73,7 @@ export const initialState = {
64
73
  scrollTop: 0,
65
74
  },
66
75
  },
76
+ excludedAccountIDs: [],
67
77
  };
68
78
  // Create slice with reducers
69
79
  const expenseAutomationReconciliationView = createSlice({
@@ -132,7 +142,7 @@ const expenseAutomationReconciliationView = createSlice({
132
142
  fetchReconciliationSuccess: {
133
143
  reducer(draft, action) {
134
144
  if (action.payload.accountId == null) {
135
- updateAllReconciliation(draft, action.payload.reconciliation.accounts, action.payload.selectedPeriod, action.payload.reconciliation.reconciliation, action.payload.refreshViewInBackground);
145
+ updateAllReconciliation(draft, action.payload.reconciliation.accounts, action.payload.selectedPeriod, action.payload.reconciliation.reconciliation, action.payload.refreshViewInBackground, action.payload.reconciliation.excluded_accounts);
136
146
  }
137
147
  else if (action.payload.reconciliation.reconciliation.length > 0 &&
138
148
  action.payload.reconciliation.accounts.length > 0) {
@@ -421,6 +431,113 @@ const expenseAutomationReconciliationView = createSlice({
421
431
  ...localData,
422
432
  };
423
433
  },
434
+ excludeAccountFromReconciliation: {
435
+ reducer(draft) {
436
+ draft.actionFetchState.excludeAccountFetch = {
437
+ fetchState: 'In-Progress',
438
+ error: undefined,
439
+ };
440
+ },
441
+ prepare(payload) {
442
+ return { payload };
443
+ },
444
+ },
445
+ excludeAccountFromReconciliationSuccess: (draft, action) => {
446
+ draft.actionFetchState.excludeAccountFetch = {
447
+ fetchState: 'Completed',
448
+ error: undefined,
449
+ };
450
+ const { account, selectedPeriod } = action.payload;
451
+ if (account != null) {
452
+ if (!draft.excludedAccountIDs.includes(account.account_id)) {
453
+ draft.excludedAccountIDs.push(account.account_id);
454
+ }
455
+ draft.excludedAccountExclusionInfo[account.account_id] = {
456
+ bankBalance: account.bank_balance != null
457
+ ? {
458
+ amount: account.bank_balance,
459
+ currencyCode: account.currency_code ?? 'USD',
460
+ currencySymbol: account.currency_symbol ?? '$',
461
+ }
462
+ : undefined,
463
+ clearedBalance: account.cleared_balance != null
464
+ ? {
465
+ amount: account.cleared_balance,
466
+ currencyCode: account.currency_code ?? 'USD',
467
+ currencySymbol: account.currency_symbol ?? '$',
468
+ }
469
+ : undefined,
470
+ variance: account.variance != null
471
+ ? {
472
+ amount: account.variance,
473
+ currencyCode: account.currency_code ?? 'USD',
474
+ currencySymbol: account.currency_symbol ?? '$',
475
+ }
476
+ : undefined,
477
+ };
478
+ const monthYearPeriodId = toMonthYearPeriodId(selectedPeriod);
479
+ draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId].accountIDs = draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId].accountIDs.filter((id) => id !== account.account_id);
480
+ }
481
+ },
482
+ excludeAccountFromReconciliationFailure: (draft, action) => {
483
+ draft.actionFetchState.excludeAccountFetch = {
484
+ fetchState: 'Error',
485
+ error: action.payload.error,
486
+ };
487
+ },
488
+ includeAccountInReconciliation: {
489
+ reducer(draft) {
490
+ draft.actionFetchState.includeAccountFetch = {
491
+ fetchState: 'In-Progress',
492
+ error: undefined,
493
+ };
494
+ },
495
+ prepare(payload) {
496
+ return { payload };
497
+ },
498
+ },
499
+ includeAccountInReconciliationSuccess: (draft, action) => {
500
+ draft.actionFetchState.includeAccountFetch = {
501
+ fetchState: 'Completed',
502
+ error: undefined,
503
+ };
504
+ const { reconciliation, selectedPeriod } = action.payload;
505
+ if (reconciliation == null) {
506
+ return;
507
+ }
508
+ const accountId = reconciliation.account_id;
509
+ draft.excludedAccountIDs = draft.excludedAccountIDs.filter((id) => id !== accountId);
510
+ delete draft.excludedAccountExclusionInfo[accountId];
511
+ const monthYearPeriodId = toMonthYearPeriodId(selectedPeriod);
512
+ const accountReconciliationRecords = draft.accountReconciliationRecordsBySelectedPeriod[monthYearPeriodId];
513
+ if (accountReconciliationRecords != null) {
514
+ if (!accountReconciliationRecords.accountIDs.includes(accountId)) {
515
+ accountReconciliationRecords.accountIDs.push(accountId);
516
+ }
517
+ accountReconciliationRecords.reconciliationByAccountID[accountId] = {
518
+ accountId,
519
+ reconciliationId: reconciliation.reconciliation_id ?? undefined,
520
+ transactionFetchState: { fetchState: 'Not-Started', error: undefined },
521
+ refreshStatus: { fetchState: 'Not-Started', error: undefined },
522
+ statementDeleteStatus: { fetchState: 'Not-Started', error: undefined },
523
+ statementUploadStatus: { fetchState: 'Not-Started', error: undefined },
524
+ statementUpdateStatus: { fetchState: 'Not-Started', error: undefined },
525
+ statementParseInProgress: reconciliation.bank_status.code === 'parsing',
526
+ localData: {},
527
+ };
528
+ }
529
+ draft.accountConnectionStatusByAccountID[accountId] = {
530
+ status: toBankStatusCodeType(reconciliation.bank_status.code),
531
+ connectionInProgress: false,
532
+ paymentAccountId: undefined,
533
+ };
534
+ },
535
+ includeAccountInReconciliationFailure: (draft, action) => {
536
+ draft.actionFetchState.includeAccountFetch = {
537
+ fetchState: 'Error',
538
+ error: action.payload.error,
539
+ };
540
+ },
424
541
  updateStatementUploadChosen: (draft, action) => {
425
542
  draft.statementUploadChosen = action.payload.statementUploadChosen;
426
543
  },
@@ -430,10 +547,38 @@ const expenseAutomationReconciliationView = createSlice({
430
547
  },
431
548
  });
432
549
  // Export actions
433
- export const { fetchReconciliation, fetchReconciliationFailure, fetchReconciliationSuccess, saveReconciliationDetail, saveReconciliationDetailFailure, updateSelectedAccountId, setConnectionInProgressForAccount, setStatementParseInProgress, updateReconcileTabLocalData, updateReconcileTabListSortState, updateReconcileTabListScrollState, saveReconciliationDetailSuccess, updateSelectedTab, updateBalancesLocalData, initialiseLocalDataForSelectedAccountId, clearExpenseAutomationReconciliationView, updateSelectedDrawerAccountId, updateReviewTabSortState, initializeReconciliationReviewTabLocalData, updateReviewTabLocalData, saveReconciliationReview, updateSaveReconciliationReviewFetchStatus, updateReconListScrollPosition, updateAccountReconciliationLocalData, deleteAccountStatement, deleteAccountStatementSuccess, deleteAccountStatementFailure, uploadAccountStatement, uploadAccountStatementSuccess, uploadAccountStatementFailure, updateStatementUploadChosen, } = expenseAutomationReconciliationView.actions;
550
+ export const { fetchReconciliation, fetchReconciliationFailure, fetchReconciliationSuccess, saveReconciliationDetail, saveReconciliationDetailFailure, updateSelectedAccountId, setConnectionInProgressForAccount, setStatementParseInProgress, updateReconcileTabLocalData, updateReconcileTabListSortState, updateReconcileTabListScrollState, saveReconciliationDetailSuccess, updateSelectedTab, updateBalancesLocalData, initialiseLocalDataForSelectedAccountId, clearExpenseAutomationReconciliationView, updateSelectedDrawerAccountId, updateReviewTabSortState, initializeReconciliationReviewTabLocalData, updateReviewTabLocalData, saveReconciliationReview, updateSaveReconciliationReviewFetchStatus, updateReconListScrollPosition, updateAccountReconciliationLocalData, deleteAccountStatement, deleteAccountStatementSuccess, deleteAccountStatementFailure, excludeAccountFromReconciliation, excludeAccountFromReconciliationSuccess, excludeAccountFromReconciliationFailure, includeAccountInReconciliation, includeAccountInReconciliationSuccess, includeAccountInReconciliationFailure, uploadAccountStatement, uploadAccountStatementSuccess, uploadAccountStatementFailure, updateStatementUploadChosen, } = expenseAutomationReconciliationView.actions;
434
551
  // Export reducer
435
552
  export default expenseAutomationReconciliationView.reducer;
436
- function updateAllReconciliation(draft, accounts, selectedPeriod, reconciliationData, refreshViewInBackground) {
553
+ function updateAllReconciliation(draft, accounts, selectedPeriod, reconciliationData, refreshViewInBackground, excludedAccounts) {
554
+ draft.excludedAccountIDs = excludedAccounts.map((ea) => ea.account_id);
555
+ draft.excludedAccountExclusionInfo = {};
556
+ excludedAccounts.forEach((ea) => {
557
+ const { exclusion_info } = ea;
558
+ draft.excludedAccountExclusionInfo[ea.account_id] = {
559
+ bankBalance: exclusion_info.bank_balance != null
560
+ ? {
561
+ amount: exclusion_info.bank_balance,
562
+ currencyCode: ea.currency_code ?? 'USD',
563
+ currencySymbol: ea.currency_symbol ?? '$',
564
+ }
565
+ : undefined,
566
+ clearedBalance: exclusion_info.cleared_balance != null
567
+ ? {
568
+ amount: exclusion_info.cleared_balance,
569
+ currencyCode: ea.currency_code ?? 'USD',
570
+ currencySymbol: ea.currency_symbol ?? '$',
571
+ }
572
+ : undefined,
573
+ variance: exclusion_info.variance != null
574
+ ? {
575
+ amount: exclusion_info.variance,
576
+ currencyCode: ea.currency_code ?? 'USD',
577
+ currencySymbol: ea.currency_symbol ?? '$',
578
+ }
579
+ : undefined,
580
+ };
581
+ });
437
582
  draft.accountReconciliationRecordsBySelectedPeriod[toMonthYearPeriodId(selectedPeriod)] = {
438
583
  accountIDs: [],
439
584
  reconciliationByAccountID: {},
@@ -1,3 +1,4 @@
1
+ import { reduceAnyFetchState } from '../../../commonStateTypes/reduceFetchState';
1
2
  import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
2
3
  import { getAccountBase } from '../../../entity/account/accountSelector';
3
4
  import { getClassById } from '../../../entity/class/classSelector';
@@ -6,7 +7,7 @@ import { getUserByUserId } from '../../../entity/user/userSelector';
6
7
  import { getVendorByVendorId } from '../../../entity/vendor/vendorSelector';
7
8
  import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes';
8
9
  export function getExpenseAutomationFluxAnalysisView(state) {
9
- const { expenseAutomationFluxAnalysisViewState, monthEndCloseChecksState } = state;
10
+ const { expenseAutomationFluxAnalysisViewState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
10
11
  const { fetchState, error, refreshStatus, uiState, reviewOperatingExpenseIdsByPeriod, selectedSectionIdsByPeriod, groupsBySelectedPeriod, fluxAnalysisEntities, bulkReviewStatus, currency, totalBalancesAndVariance, } = expenseAutomationFluxAnalysisViewState;
11
12
  const fetchStateAndError = {
12
13
  fetchState,
@@ -91,10 +92,17 @@ export function getExpenseAutomationFluxAnalysisView(state) {
91
92
  },
92
93
  };
93
94
  const completionStatus = fluxCompletionStatus != null ? fluxCompletionStatus : 'incomplete';
95
+ const monthEndFetchState = monthYearPeriodId != null
96
+ ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
97
+ : { fetchState: 'Not-Started', error: undefined };
98
+ const reducedFetchStatus = reduceAnyFetchState([
99
+ fetchStateAndError,
100
+ monthEndFetchState,
101
+ ]);
94
102
  return {
95
103
  sections,
96
104
  totalBalancesAndVariance,
97
- fetchStatus: fetchStateAndError,
105
+ fetchStatus: reducedFetchStatus,
98
106
  bulkReviewStatus,
99
107
  reviewOperatingExpensesIds,
100
108
  selectedSectionIds,
@@ -1,4 +1,6 @@
1
1
  import omit from 'lodash/omit';
2
+ import orderBy from 'lodash/orderBy';
3
+ import { reduceAnyFetchState } from '../../../commonStateTypes/reduceFetchState';
2
4
  import { toMonthYearPeriodId } from '../../../commonStateTypes/timePeriod';
3
5
  import { getAccountIdsForTypes } from '../../../entity/account/accountSelector';
4
6
  import { getJEScheduledTransactionByJEScheduleTransactionKey, } from '../../../entity/jeSchedules/jeSchedulesSelector';
@@ -10,10 +12,48 @@ import { filterNestedAccountHierarchyById } from '../../scheduleView/scheduleDet
10
12
  import { getAccountLabelForScheduleType, getAccountsTypesForScheduleList, } from '../../scheduleView/scheduleListView/scheduleListHelper';
11
13
  import { getAllSteps } from '../selectorTypes/expenseAutomationViewSelectorTypes';
12
14
  import { getJEAccountSettingsView } from './jeAccountSettingsViewSelector';
15
+ function getJEScheduleSortAccessor(sortKey) {
16
+ switch (sortKey) {
17
+ case 'vendor':
18
+ return (s) => s.vendor.name?.toLowerCase();
19
+ case 'category':
20
+ return (s) => s.jeDebit.account?.accountName?.toLowerCase();
21
+ case 'class':
22
+ return (s) => s.jeDebit.accountingClass?.className?.toLowerCase();
23
+ case 'depCategory':
24
+ return (s) => s.jeCredit.account?.accountName?.toLowerCase();
25
+ case 'scheduleCategory':
26
+ return (s) => s.jeScheduleType;
27
+ case 'startMonth':
28
+ return (s) => s.startDate?.valueOf();
29
+ case 'type':
30
+ return (s) => s.baseTransaction.typeOfTransaction;
31
+ case 'amortizationPeriod':
32
+ return (s) => s.period;
33
+ case 'jePostingDate':
34
+ return (s) => s.dayOfPostingDate;
35
+ case 'remainingMonths':
36
+ return (s) => s.period;
37
+ case 'runningBalance':
38
+ return (s) => s.balanceAsOfToday?.amount;
39
+ case 'totalAmount':
40
+ return (s) => s.baseTransaction.amount.amount;
41
+ case 'transactionDate':
42
+ return (s) => s.baseTransaction.date.valueOf();
43
+ case 'memo':
44
+ return (s) => s.baseTransaction.memo?.toLowerCase();
45
+ default:
46
+ return (s) => s.startDate?.valueOf();
47
+ }
48
+ }
49
+ function sortJEScheduledTransactions(transactions, sortKey, sortOrder) {
50
+ const accessor = getJEScheduleSortAccessor(sortKey);
51
+ return orderBy(transactions, [accessor], [sortOrder === 'ascending' ? 'asc' : 'desc']);
52
+ }
13
53
  export function getExpenseAutomationJESchedulesView(state) {
14
54
  const jeScheduledTransaction = [];
15
55
  const failedJeScheduledTransaction = [];
16
- const { accountState, accountListState, classState, classListState, expenseAutomationJESchedulesViewState, expenseAutomationViewState, monthEndCloseChecksState, } = state;
56
+ const { accountState, accountListState, classState, classListState, expenseAutomationJESchedulesViewState, expenseAutomationViewState, monthEndCloseChecksState, monthEndCloseChecksViewState, } = state;
17
57
  const { jeScheduleTransactionKeysByPeriod, failedJeScheduleTransactionKeysByPeriod, jeScheduleLocalDataById, postStatusById, ignoreStatusById, uiState, error, fetchState, refreshStatus, } = expenseAutomationJESchedulesViewState;
18
58
  const accountSettingsView = getJEAccountSettingsView(state);
19
59
  const currentTenant = getCurrentTenant(state);
@@ -59,18 +99,33 @@ export function getExpenseAutomationJESchedulesView(state) {
59
99
  const jeScheduleDetails = getJEScheduledTransactionByJEScheduleTransactionKey(jeScheduleKey, state);
60
100
  failedJeScheduledTransaction.push(jeScheduleDetails);
61
101
  });
62
- const draftSchedules = jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft');
63
- const resolveSchedules = [];
102
+ const { sortKey, sortOrder } = uiState;
103
+ const draftSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'draft'), sortKey, sortOrder);
104
+ const ongoingSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'ongoing'), sortKey, sortOrder);
105
+ const completedSchedules = sortJEScheduledTransactions(jeScheduledTransaction.filter((schedule) => schedule.status.code === 'completed' ||
106
+ schedule.status.code === 'marked_as_completed'), sortKey, sortOrder);
107
+ const unsortedResolveSchedules = [];
64
108
  failedJeScheduledTransaction.forEach((schedule) => {
65
109
  schedule.scheduledJournalEntry.forEach((journalEntry) => {
66
- resolveSchedules.push({ ...schedule, scheduledJournalEntry: journalEntry });
110
+ unsortedResolveSchedules.push({
111
+ ...schedule,
112
+ scheduledJournalEntry: journalEntry,
113
+ });
67
114
  });
68
115
  });
116
+ const resolveSchedules = sortJEScheduledTransactions(unsortedResolveSchedules, sortKey, sortOrder);
69
117
  const allSteps = monthYearPeriodId != null
70
118
  ? getAllSteps(monthEndCloseChecksState, monthYearPeriodId, currentTenant.tenantId)
71
119
  : [];
72
120
  const jeCompletionStatus = allSteps.find((step) => step.step === 'je_schedules')?.completionStatus;
73
121
  const completionStatus = jeCompletionStatus != null ? jeCompletionStatus : 'incomplete';
122
+ const monthEndFetchState = monthYearPeriodId != null
123
+ ? (monthEndCloseChecksViewState.monthEndCloseChecksViewByTenantId[currentTenant.tenantId]?.[monthYearPeriodId] ?? { fetchState: 'Not-Started', error: undefined })
124
+ : { fetchState: 'Not-Started', error: undefined };
125
+ const reducedFetchStatus = reduceAnyFetchState([
126
+ { fetchState, error },
127
+ monthEndFetchState,
128
+ ]);
74
129
  return {
75
130
  uncategorizedAccounts,
76
131
  allDepreciationAccountList: filteredDepAccounts,
@@ -79,15 +134,17 @@ export function getExpenseAutomationJESchedulesView(state) {
79
134
  allAccountList: filteredAccounts,
80
135
  accountListNestedAccountHierarchy,
81
136
  allClassList: allClasses,
137
+ completedSchedules,
82
138
  draftSchedules,
139
+ ongoingSchedules,
83
140
  resolveSchedules: resolveSchedules,
84
141
  accountSettingsView,
85
142
  postStatusById: postStatusById,
86
143
  ignoreStatusById: ignoreStatusById,
87
- fetchState: fetchState,
144
+ fetchState: reducedFetchStatus.fetchState,
88
145
  jeScheduleLocalDataById: jeScheduleLocalDataById,
89
146
  uiState: uiState,
90
- error: error,
147
+ error: reducedFetchStatus.error,
91
148
  refreshStatus,
92
149
  completionStatus,
93
150
  };