@zeniai/client-epic-state 5.2.7-betaAK2 → 5.2.7-betaRD2

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 (165) hide show
  1. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.d.ts +0 -0
  2. package/lib/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +1 -0
  3. package/lib/entity/invoicing/coupon/couponConstants.d.ts +11 -0
  4. package/lib/entity/invoicing/coupon/couponConstants.js +29 -0
  5. package/lib/entity/invoicing/invoicingCommonPayload.d.ts +0 -22
  6. package/lib/entity/invoicing/invoicingCommonPayload.js +5 -22
  7. package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +1 -0
  8. package/lib/entity/jeSchedules/jeScheduleHelper.js +7 -0
  9. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +66 -1
  10. package/lib/entity/jeSchedules/jeSchedulesPayload.js +135 -0
  11. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +4 -2
  12. package/lib/entity/jeSchedules/jeSchedulesReducer.js +30 -2
  13. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +11 -2
  14. package/lib/entity/jeSchedules/jeSchedulesSelector.js +38 -3
  15. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +79 -1
  16. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +24 -1
  17. package/lib/entity/jeSchedules/jeSchedulesTypes.js +88 -1
  18. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  19. package/lib/entity/snackbar/snackbarTypes.js +3 -0
  20. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +2 -0
  21. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  22. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +2 -0
  23. package/lib/epic.d.ts +9 -1
  24. package/lib/epic.js +16 -0
  25. package/lib/esm/commonStateTypes/selectorTypes/pickAndMergeForecastSection.js +1 -0
  26. package/lib/esm/entity/invoicing/coupon/couponConstants.js +26 -0
  27. package/lib/esm/entity/invoicing/invoicingCommonPayload.js +5 -22
  28. package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +6 -0
  29. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +135 -1
  30. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +30 -2
  31. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +36 -2
  32. package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +78 -0
  33. package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
  34. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  35. package/lib/esm/epic.js +16 -0
  36. package/lib/esm/index.js +16 -9
  37. package/lib/esm/view/accountList/accountListReducer.js +1 -0
  38. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
  39. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +41 -5
  40. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +45 -0
  41. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
  42. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +99 -0
  43. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
  44. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +110 -0
  45. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +79 -0
  46. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +139 -0
  47. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +106 -0
  48. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +22 -0
  49. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/backgroundRefetchReviewTabEpic.js +1 -0
  50. package/lib/esm/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +1 -0
  51. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +140 -0
  52. package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +55 -0
  53. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +306 -29
  54. package/lib/esm/view/expenseAutomationView/reducers/transactionsViewReducer.js +56 -11
  55. package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
  56. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +106 -0
  57. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +294 -22
  58. package/lib/esm/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
  59. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +5 -6
  60. package/lib/esm/view/expenseAutomationView/types/transactionGroup.js +21 -0
  61. package/lib/esm/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +1 -2
  62. package/lib/esm/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +0 -2
  63. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +5 -10
  64. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +25 -0
  65. package/lib/esm/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +15 -0
  66. package/lib/esm/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +3 -27
  67. package/lib/esm/view/invoicing/settingsView/settingsViewSelector.js +3 -7
  68. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  69. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
  70. package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
  71. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +18 -0
  72. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +18 -0
  73. package/lib/esm/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +18 -0
  74. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +16 -0
  75. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +1 -0
  76. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +60 -0
  77. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +12 -0
  78. package/lib/esm/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +1 -0
  79. package/lib/index.d.ts +19 -13
  80. package/lib/index.js +97 -48
  81. package/lib/view/accountList/accountListReducer.js +1 -0
  82. package/lib/view/accountList/accountListState.d.ts +1 -1
  83. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +6 -3
  84. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +3 -2
  85. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +39 -3
  86. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +20 -0
  87. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +49 -0
  88. package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
  89. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +8 -0
  90. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +103 -0
  91. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
  92. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +29 -0
  93. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +45 -0
  94. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +114 -0
  95. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
  96. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +83 -0
  97. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +12 -0
  98. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +146 -0
  99. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +64 -0
  100. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +110 -0
  101. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +6 -0
  102. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +26 -0
  103. package/lib/view/expenseAutomationView/epics/transactionCategorization/backgroundRefetchReviewTabEpic.js +1 -0
  104. package/lib/view/expenseAutomationView/epics/transactionCategorization/fetchTransactionCategorizationEpic.js +1 -0
  105. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +36 -0
  106. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +145 -0
  107. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  108. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +72 -3
  109. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +58 -1
  110. package/lib/view/expenseAutomationView/payload/transactionCategorizationPayload.d.ts +11 -0
  111. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +91 -12
  112. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +308 -29
  113. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
  114. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +6 -3
  115. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.js +57 -12
  116. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +42 -0
  117. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
  118. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +36 -7
  119. package/lib/view/expenseAutomationView/selectorTypes/transactionsViewSelectorTypes.d.ts +2 -0
  120. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +21 -0
  121. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +112 -0
  122. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +34 -0
  123. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +302 -21
  124. package/lib/view/expenseAutomationView/selectors/transactionCategorizationSelector.js +2 -1
  125. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
  126. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +82 -8
  127. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -8
  128. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
  129. package/lib/view/expenseAutomationView/types/transactionGroup.d.ts +21 -0
  130. package/lib/view/expenseAutomationView/types/transactionGroup.js +25 -0
  131. package/lib/view/expenseAutomationView/types/transactionsViewState.d.ts +11 -0
  132. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.d.ts +0 -5
  133. package/lib/view/invoicing/editInvoicingCatalogItemDetailView/editInvoicingCatalogItemDetailViewSelector.js +0 -1
  134. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.d.ts +0 -1
  135. package/lib/view/invoicing/invoicingConfigView/invoicingConfigViewSelector.js +0 -2
  136. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingAccountingPickersEpic.js +5 -10
  137. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.d.ts +6 -0
  138. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboAccountsEpic.js +29 -0
  139. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.d.ts +6 -0
  140. package/lib/view/invoicing/invoicingQboView/epics/fetchInvoicingQboClassesEpic.js +19 -0
  141. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.d.ts +1 -9
  142. package/lib/view/invoicing/invoicingQboView/invoicingQboViewSelector.js +4 -30
  143. package/lib/view/invoicing/settingsView/settingsViewSelector.d.ts +4 -11
  144. package/lib/view/invoicing/settingsView/settingsViewSelector.js +3 -7
  145. package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  146. package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
  147. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +4 -2
  148. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
  149. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.d.ts +8 -0
  150. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoIntroClosedByOutsideClickEpic.js +22 -0
  151. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.d.ts +8 -0
  152. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryPromoRemindMeLaterClickedEpic.js +22 -0
  153. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.d.ts +8 -0
  154. package/lib/view/spendManagement/treasury/treasurySetUp/epic/updateTreasuryVideoViewedEpic.js +22 -0
  155. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.d.ts +13 -0
  156. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardEpic.js +20 -0
  157. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.d.ts +11 -0
  158. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardPayload.js +2 -0
  159. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.d.ts +7 -0
  160. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardReducer.js +64 -0
  161. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.d.ts +12 -0
  162. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardSelector.js +15 -0
  163. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.d.ts +9 -0
  164. package/lib/view/zeniAccountsPromoCard/zeniAccountsPromoCardState.js +2 -0
  165. package/package.json +1 -1
package/lib/esm/epic.js CHANGED
@@ -195,9 +195,17 @@ import { initializeAccountSettingsViewEpic, } from './view/expenseAutomationView
195
195
  import { saveAccountSettingsViewEpic, } from './view/expenseAutomationView/epics/jeSchedule/accountSettings/saveAccountSettingsViewEpic';
196
196
  import { fetchJeSchedulesPageEpic as fetchExpenseAutomationJESchedulesPageEpic, } from './view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic';
197
197
  import { fetchJeSchedulesEpic as fetchExpenseAutomationJeSchedulesEpic, } from './view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic';
198
+ import { fetchOneTimeAccrualEpic, } from './view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic';
198
199
  import { ignoreRecommendedJeScheduleEpic as ignoreExpenseAutomationJEScheduleEpic, } from './view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic';
199
200
  import { initializeJeScheduleLocalDataEpic as initializeExpenseAutomationJeScheduleLocalDataEpic, } from './view/expenseAutomationView/epics/jeSchedule/initializeJeScheduleLocalDataEpic';
201
+ import { createOneTimeAccrualEpic, } from './view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic';
202
+ import { initializeNewScheduleEpic, } from './view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic';
203
+ import { saveNewScheduleEpic, } from './view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic';
204
+ import { searchTransactionsForNewScheduleEpic, } from './view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic';
205
+ import { oneTimeAccrualActionsEpic, } from './view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic';
200
206
  import { retryJeScheduleEpic as retryExpenseAutomationJEScheduleEpic, } from './view/expenseAutomationView/epics/jeSchedule/retryJeSchedulesEpic';
207
+ import { revertJeScheduleEpic, } from './view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic';
208
+ import { switchJESchedulesTabEpic as switchExpenseAutomationJESchedulesTabEpic, } from './view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic';
201
209
  import { bulkUploadMatchResultToastEpic, } from './view/expenseAutomationView/epics/missingReceipts/bulkUploadMatchResultToastEpic';
202
210
  import { bulkUploadReceiptsEpic, } from './view/expenseAutomationView/epics/missingReceipts/bulkUploadReceiptsEpic';
203
211
  import { confirmBulkUploadMatchEpic, } from './view/expenseAutomationView/epics/missingReceipts/confirmBulkUploadMatchEpic';
@@ -779,6 +787,7 @@ const ALL_EPICS = [
779
787
  createNewSchedulesAccruedEpic,
780
788
  createNewSchedulesEpic,
781
789
  createNewTaskGroupEpic,
790
+ createOneTimeAccrualEpic,
782
791
  createPaymentInstrumentEpic,
783
792
  createSessionAndSubmitEpic,
784
793
  createSessionEpic,
@@ -1058,6 +1067,7 @@ const ALL_EPICS = [
1058
1067
  fetchOnboardingCustomerSetupViewEpic,
1059
1068
  fetchOnboardingCustomerViewEpic,
1060
1069
  fetchOnboardingViewEpic,
1070
+ fetchOneTimeAccrualEpic,
1061
1071
  fetchOpExByVendorEpic,
1062
1072
  fetchOpExByVendorReportForTimeframeEpic,
1063
1073
  fetchOpExByVendorReportSummaryEpic,
@@ -1212,6 +1222,7 @@ const ALL_EPICS = [
1212
1222
  initializeInvoicingCustomerAddressEpic,
1213
1223
  initializeInvoicingSubscriptionAddressEpic,
1214
1224
  initializeMyProfileLocalDataEpic,
1225
+ initializeNewScheduleEpic,
1215
1226
  initializeOnboardingCustomerViewUpdateDataEpic,
1216
1227
  initializeRemiSetupApproverViewUpdateDataEpic,
1217
1228
  initializeRemiToLocalStoreEpic,
@@ -1234,6 +1245,7 @@ const ALL_EPICS = [
1234
1245
  markAsCompleteScheduleDetailEpic,
1235
1246
  markTransactionAsNotMiscategorizedEpic,
1236
1247
  notifyMeForFeatureEpic,
1248
+ oneTimeAccrualActionsEpic,
1237
1249
  parallelFetchAccountTransactionListEpic,
1238
1250
  parallelFetchClassTransactionListEpic,
1239
1251
  parallelFetchEntityTransactionListEpic,
@@ -1277,6 +1289,7 @@ const ALL_EPICS = [
1277
1289
  retryExpenseAutomationJEScheduleEpic,
1278
1290
  retryInvoicingQboSyncTaskEpic,
1279
1291
  retryOrRefundBillEpic,
1292
+ revertJeScheduleEpic,
1280
1293
  reviewDraftRemisBulkActionEpic,
1281
1294
  reviewExpenseAutomationFluxAnalysisViewEpic,
1282
1295
  revokeCardInviteEpic,
@@ -1312,6 +1325,7 @@ const ALL_EPICS = [
1312
1325
  saveInvoicingSubscriptionEpic,
1313
1326
  saveMagicLinkBankAccountEpic,
1314
1327
  saveNewAddressEpic,
1328
+ saveNewScheduleEpic,
1315
1329
  saveNotificationPreferencesEpic,
1316
1330
  saveNotificationSettingsEpic,
1317
1331
  saveOAuthConnectionEpic,
@@ -1336,6 +1350,7 @@ const ALL_EPICS = [
1336
1350
  saveVendorsTabVendorEpic,
1337
1351
  scheduleTenantCreditScoreCronEpic,
1338
1352
  searchTransactionsForManualMatchEpic,
1353
+ searchTransactionsForNewScheduleEpic,
1339
1354
  seedAiCardCreationFormDraftEpic,
1340
1355
  seedAiCardPolicyFormDraftEpic,
1341
1356
  sendCompanyMonthEndReportEpic,
@@ -1358,6 +1373,7 @@ const ALL_EPICS = [
1358
1373
  submitIntlVerificationEpic,
1359
1374
  submitInvoicingBrandingFormEpic,
1360
1375
  submitQuestionEpic,
1376
+ switchExpenseAutomationJESchedulesTabEpic,
1361
1377
  syncInvoicingSubscriptionCouponsEpic,
1362
1378
  syncTabsAfterAutomatchEpic,
1363
1379
  toggleReportUIOptionForecastModeEpic,
package/lib/esm/index.js CHANGED
@@ -60,7 +60,7 @@ import { getForecast } from './entity/forecast/forecastSelector';
60
60
  import { toEntityType, } from './entity/genericEntity/entity';
61
61
  import { updateEntities } from './entity/genericEntity/entityReducer';
62
62
  import { getEntityByEntityIDs } from './entity/genericEntity/entitySelector';
63
- import { ALL_SCHEDULES_TYPES, getJEScheduleTransactionKey, toScheduleTypesType, toScheduleTypesTypeStrict, } from './entity/jeSchedules/jeSchedulesTypes';
63
+ import { ALL_JE_SCHEDULE_IGNORE_REASONS, ALL_JE_SCHEDULE_REVERT_REASONS, ALL_ONE_TIME_ACCRUAL_IGNORE_REASONS, ALL_ONE_TIME_ACCRUAL_REVERT_REASONS, ALL_SCHEDULES_TYPES, getJEScheduleTransactionKey, toScheduleTypesType, toScheduleTypesTypeStrict, } from './entity/jeSchedules/jeSchedulesTypes';
64
64
  import { ALL_MONTH_END_CLOSE_CHECKS_FREQUENCY, } from './entity/monthEndCloseChecks/monthEndCloseChecksState';
65
65
  import { updateCommentsNotifications, updateCommentsNotificationsStatuses, } from './entity/notification/notificationReducer';
66
66
  import { toNotificationModeStrict, } from './entity/notification/types/notificationTypes';
@@ -83,7 +83,7 @@ import { isTransferTransaction, } from './entity/transaction/stateTypes/otherTra
83
83
  import { toPlatformLineDetailType, } from './entity/transaction/stateTypes/transactionLine';
84
84
  import { toTransactionCategory, toTransactionType, toTransactionTypeStrict, } from './entity/transaction/stateTypes/transactionType';
85
85
  import { isVendorTransaction, isVendorTransactionWithCustomer, } from './entity/transaction/stateTypes/vendorTransaction';
86
- import { getSupportedTransactionById } from './entity/transaction/transactionSelector';
86
+ import { getScheduleTransactionById, getSupportedTransactionById, } from './entity/transaction/transactionSelector';
87
87
  import { getUserRoleByUserId, getUserRoleByUserIds, } from './entity/userRole/userRoleSelector';
88
88
  import { hasBillPayAccessible, hasBillPayFallbackAdminLevelAccess, hasChargeCardAccessible, hasReimbursementAccessible, hasReimbursementUserAccess, hasRemiFallbackAdminLevelAccess, hasTreasuryAccessible, hasZeniAccountsAccessible, isZeniSignedInUser, } from './entity/userRole/userRoleTenantAccess';
89
89
  import { getUserRoleMap, hasAICFOAccess, hasAdminLevelAccess, hasAnyCompanyRole, hasAnyFinOpRole, hasBillPayAccess, hasBillPayAdminLevelAccess, hasBookKeepingAdminLevelAccess, hasBookKeepingUserLevelAccess, hasChargeCardAccess, hasChargeCardAdminLevelAccess, hasEmployeeLevelAccess, hasFullOrAdminLevelAccess, hasInvestorBankerLevelAccess, hasInvoicingAdminLevelAccess, hasOnlyBillPayAccess, hasOnlyChargeCardAccess, hasOnlyReimbursementAccess, hasOnlyZeniAccountsAccess, hasReimbursementAccess, hasReimbursementAdminLevelAccess, hasSpendManagementAccess, hasSpendManagementAdminLevelAccess, hasSuperAdminLevelAccess, hasTreasuryAccess, hasTreasuryAdminLevelAccess, hasZeniAccountsAccess, hasZeniAccountsAdminLevelAccess, hasZeniRoleOrCompanyOfficerAccess, isFinOpsUserRoleType, isNonZeniRole, toUserRoleType, toUserRoleTypeStrict, } from './entity/userRole/userRoleType';
@@ -181,20 +181,23 @@ import uploadAccountStatementIntoDocumentAI from './view/expenseAutomationView/e
181
181
  import { fetchAllExpenseAutomationTabs, refreshExpenseAutomationCurrentTab, updateCurrentSelectedPeriod, updateCurrentSelectedView, } from './view/expenseAutomationView/expenseAutomationViewReducer';
182
182
  import { getExpenseAutomationView } from './view/expenseAutomationView/expenseAutomationViewSelector';
183
183
  import { toExpenseAutomationViewType, } from './view/expenseAutomationView/expenseAutomationViewState';
184
+ import { computeNewScheduleJeDetails } from './view/expenseAutomationView/helpers/newScheduleLocalDataHelper';
184
185
  import { isReviewTransactionBankTransferType, isReviewTransactionBillPaymentType, isReviewTransactionCreditCardCreditType, isReviewTransactionCreditCardPaymentType, isReviewTransactionDepositType, isReviewTransactionExpenseType, } from './view/expenseAutomationView/helpers/reconciliationHelpers';
185
186
  import { MAX_SELECTION_LIMIT, checkIfAllLineItemsAreCategoryClassFilled, getLineItemsByTransactionIdsFromLocalData, isAnyItemWithUncategorizedExpenseAccount, } from './view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper';
186
187
  import { clearExpenseAutomationFluxAnalysisView, fetchFluxAnalysisView, reviewFluxAnalysisView, updateFluxAnalysisViewPageMetaData, updateFluxAnalysisViewUIState, updateOperatingExpensesIdsForReview, updateSelectedSectionIdsForReview, } from './view/expenseAutomationView/reducers/fluxAnalysisViewReducer';
187
- import { clearJeScheduleLocalData as clearExpenseAutomationJEScheduleLocalData, clearExpenseAutomationJESchedulesView, fetchJeSchedulesPage as fetchExpenseAutomationJESchedulesPage, ignoreRecommendedJeSchedule as ignoreExpenseAutomationJESchedule, initializeAccountSettingsView as initializeJeAccountSettingsView, initializeJeScheduleLocalData, removeJeScheduleTransactionKey, retryJeSchedule as retryExpenseAutomationJESchedule, saveAccountSettings as saveJeAccountSettings, saveAccountSettingsLocalData as saveJeAccountSettingsLocalData, updateJESchedulesUIState as updateExpenseAutomationJESchedulesUIState, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, } from './view/expenseAutomationView/reducers/jeSchedulesViewReducer';
188
+ import { clearJeScheduleLocalData as clearExpenseAutomationJEScheduleLocalData, clearExpenseAutomationJESchedulesView, clearSearchTransactionsForNewSchedule as clearJeSearchTransactionsForNewSchedule, createOneTimeAccrual, createOneTimeAccrualFailure, createOneTimeAccrualSuccess, fetchJeSchedulesPage as fetchExpenseAutomationJESchedulesPage, fetchOneTimeAccrual, ignoreRecommendedJeSchedule as ignoreExpenseAutomationJESchedule, ignoreOneTimeAccrual, initializeAccountSettingsView as initializeJeAccountSettingsView, initializeNewSchedule as initializeJeNewSchedule, initializeJeScheduleLocalData, promoteOneTimeAccrual, removeJeScheduleTransactionKey, resetNewScheduleLocalData as resetJeNewScheduleLocalData, retryJeSchedule as retryExpenseAutomationJESchedule, revertJeSchedule, revertOneTimeAccrual, saveAccountSettings as saveJeAccountSettings, saveAccountSettingsLocalData as saveJeAccountSettingsLocalData, saveNewSchedule as saveJeNewSchedule, saveNewScheduleFailure as saveJeNewScheduleFailure, saveNewScheduleSuccess as saveJeNewScheduleSuccess, searchTransactionsForNewSchedule as searchJeTransactionsForNewSchedule, searchTransactionsForNewScheduleFailure as searchJeTransactionsForNewScheduleFailure, searchTransactionsForNewScheduleSuccess as searchJeTransactionsForNewScheduleSuccess, toggleJECreatedGroupCollapsed, toggleJEPendingGroupCollapsed, updateJESchedulesUIState as updateExpenseAutomationJESchedulesUIState, updateJEScheduleTypeFilter, updateNewScheduleLocalData as updateJeNewScheduleLocalData, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, } from './view/expenseAutomationView/reducers/jeSchedulesViewReducer';
188
189
  import { acknowledgeBulkUploadConfirmMatchComplete, bulkUploadAutomatchingTimedOut, bulkUploadReceipts, bulkUploadReceiptsFailure, bulkUploadReceiptsSuccess, clearBulkUpload, clearBulkUploadBatchDetailsForScopeChange, clearManualSearchResults, clearMissingReceiptsTabNavigation, confirmBulkUploadMatch, confirmBulkUploadMatchFailure, confirmBulkUploadMatchSuccess, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsFailure, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatches, fetchBulkUploadBatchesFailure, fetchBulkUploadBatchesSuccess, fetchCompletedTransactions, fetchCompletedTransactionsFailure, fetchCompletedTransactionsSuccess, fetchMissingReceipts as fetchExpenseAutomationMissingReceipts, fetchMoreBatchDetails, fetchMoreBatchDetailsComplete, fetchMoreBatchDetailsFailure, markBatchDetailRefreshAttempted, markMissingReceiptAsDone as markExpenseAutomationMissingReceiptAsDone, pusherBatchStatusUpdate, refreshBatchDetailsForBatchId, requestMissingReceiptsTabNavigation, restoreBulkUploadAutomatchingOnMount, restoreBulkUploadMatchingState, searchTransactionsForManualMatch, searchTransactionsForManualMatchFailure, searchTransactionsForManualMatchSuccess, setBulkUploadCompletedSubTab, setBulkUploadResultsTab, setBulkUploadSortConfig, setBulkUploadUploadedFileCount, storeBatchDetails, updateBulkUploadProgress, updateMissingReceiptUploadState as updateExpenseAutomationMissingReceiptUploadState, updateMissingReceiptsUIState as updateExpenseAutomationMissingReceiptsUIState, uploadMissingReceiptSuccess as uploadExpenseAutomationMissingReceiptSuccess, } from './view/expenseAutomationView/reducers/missingReceiptsViewReducer';
189
190
  import { clearStatementDateConflict, confirmStatementMapping, deleteAccountStatement, excludeAccountFromReconciliation, fetchReconciliation as fetchReconciliationView, includeAccountInReconciliation, parseCombinedStatement, parseStatement, parseStatementFailure, parseStatementSuccess, reparseStatement, reparseStatementFailure, reparseStatementSuccess, resetReparseStatementStatus, saveReconciliationDetail as saveExpenseAutomationReconciliationDetail, saveReconciliationReview as saveExpenseAutomationReconciliationReview, setConnectionInProgressForAccount as setConnectionInProgressForAccountReconciliation, setStatementParseInProgress, setStatementProcessingDismissedToBackground, submitCombinedStatementUpdate, submitStatementUpdate, updateAccountReconciliationLocalData as updateExpenseAutomationAccountReconciliationLocalData, updateSelectedAccountId as updateExpenseAutomationAccountReconciliationSelectedAccountId, updateSelectedTab as updateExpenseAutomationAccountReconciliationSelectedTab, updateReconListScrollPosition as updateExpenseAutomationReconListScrollPosition, updateReviewTabSortState as updateExpenseAutomationReconReviewTabListSortState, updateReviewTabLocalData as updateExpenseAutomationReconReviewTabLocalData, updateReconcileTabListScrollState as updateExpenseAutomationReconcileTabListScrollState, updateReconcileTabListSortState as updateExpenseAutomationReconcileTabListSortState, updateReconcileTabLocalData as updateExpenseAutomationReconcileTabLocalData, updateSelectedDrawerAccountId as updateExpenseAutomationSelectedDrawerAccountId, updateNodeCollapseState, updateParsedStatementData, updateStatementProcessingBackgroundCompletedSteps, updateStatementProcessingFailed, updateStatementUpdateLocalData, updateStatementUploadChosen, uploadAccountStatement, } from './view/expenseAutomationView/reducers/reconciliationViewReducer';
190
- import { backgroundRefetchReviewTab, clearExpenseAutomationTransactionsView, fetchTransactionCategorization, fetchTransactionCategorizationFailure, fetchTransactionCategorizationView, initializeTransactionCategorizationViewLocalData, markCategoryClassRecommendationsFailureForCategorization, markTransactionAsNotMiscategorized, removeTransactionFromAllTabs, saveTransactionCategorization, saveTransactionCategorizationLocalData, setAllItemsToCategoryClassInLocalDataForCategorization, setEntityRecommendationForLineIdsForCategorization, syncTransactionCategorizationFromDetailSave, updateCurrentSelectedTransactionCategorizationTab, updateSelectedCheckboxTransactionIds, updateSelectedCustomerForTransaction, updateSelectedTransactionId, updateSelectedVendorForTransaction, updateTransactionCategorization, updateTransactionCategorizationCompletedSubTab, updateTransactionCategorizationSaveStatus, updateTransactionCategorizationUIState, updateTransactionCategorizationUploadReceiptState, updateTransactionFilters, uploadTransactionCategorizationReceiptSuccess, } from './view/expenseAutomationView/reducers/transactionsViewReducer';
191
+ import { backgroundRefetchReviewTab, clearExpenseAutomationTransactionsView, fetchTransactionCategorization, fetchTransactionCategorizationFailure, fetchTransactionCategorizationView, initializeTransactionCategorizationViewLocalData, markCategoryClassRecommendationsFailureForCategorization, markTransactionAsNotMiscategorized, removeTransactionFromAllTabs, saveTransactionCategorization, saveTransactionCategorizationLocalData, setAllItemsToCategoryClassInLocalDataForCategorization, setEntityRecommendationForLineIdsForCategorization, syncTransactionCategorizationFromDetailSave, updateCurrentSelectedTransactionCategorizationTab, updateSelectedCheckboxTransactionIds, updateSelectedCustomerForTransaction, updateSelectedTransactionId, updateSelectedVendorForTransaction, updateTransactionCategorization, updateTransactionCategorizationCompletedSubTab, updateTransactionCategorizationSaveStatus, updateTransactionCategorizationUIState, updateTransactionCategorizationUploadReceiptState, updateTransactionFilters, updateTransactionGroup, uploadTransactionCategorizationReceiptSuccess, } from './view/expenseAutomationView/reducers/transactionsViewReducer';
191
192
  import { getExpenseAutomationFluxAnalysisView } from './view/expenseAutomationView/selectors/fluxAnalysisViewSelector';
193
+ import { getNewAccrualAccountsView as getJeNewAccrualAccountsView, getNewScheduleSearchTransactionsView as getJeNewScheduleSearchTransactionsView, getNewScheduleView as getJeNewScheduleView, } from './view/expenseAutomationView/selectors/jeNewScheduleViewSelector';
192
194
  import { getExpenseAutomationReconciliationView, getLedgerAccountsForCombinedStatementMapping, getReparseStatementStatusByAccountId, getUnavailableLedgerAccountIds, isAccountReconReport, } from './view/expenseAutomationView/selectors/reconciliationViewSelector';
193
195
  import { getExpenseAutomationTransactionView, getLastTransferEntryReplacement, } from './view/expenseAutomationView/selectors/transactionCategorizationSelector';
194
196
  import { applyTransactionFilters } from './view/expenseAutomationView/transactionFilterHelpers';
195
197
  import { TRANSACTION_FILTER_CATEGORIES, } from './view/expenseAutomationView/transactionFilterTypes';
196
198
  import { DEFAULT_COMPLETED_SUB_TAB, toCompletedSubTab, } from './view/expenseAutomationView/types/completedSubTab';
197
- import { toJEScheduleMainTab as toExpenseAutomationJEScheduleMainTab, toJEScheduleSortKey as toExpenseAutomationJEScheduleSortKey, } from './view/expenseAutomationView/types/jeSchedulesViewState';
199
+ import { DEFAULT_TRANSACTION_GROUP, TRANSACTION_GROUPS, toTransactionGroup, } from './view/expenseAutomationView/types/transactionGroup';
200
+ import { toJEScheduleSortKey as toExpenseAutomationJEScheduleSortKey, toJEPageTab, } from './view/expenseAutomationView/types/jeSchedulesViewState';
198
201
  import { BATCH_FILE_STATUSES, isUnmatchedTabFileStatus, toBatchFileStatus, toBatchStatusValue, toBulkUploadPhase, toBulkUploadResultsTab, toBulkUploadSortKey, toMatchSource, toMissingReceiptsTab, } from './view/expenseAutomationView/types/missingReceiptsViewState';
199
202
  import { toMissingReceiptsSortKey as toExpenseAutomationMissingReceiptsSortKey, } from './view/expenseAutomationView/types/missingReceiptsViewState';
200
203
  import { toReconciliationTabsType, } from './view/expenseAutomationView/types/reconciliationViewState';
@@ -482,9 +485,10 @@ export { stringToUnion, stringToUnionStrict };
482
485
  export { fetchMonthEndCloseChecks, fetchMonthClosePerformanceTrend, getMonthEndCloseChecksViewByTenantId, ALL_MONTH_END_CLOSE_CHECKS_FREQUENCY, };
483
486
  export {
484
487
  // Bulk Upload Types
485
- BATCH_FILE_STATUSES, isUnmatchedTabFileStatus, DEFAULT_COMPLETED_SUB_TAB, toBatchFileStatus, toBatchStatusValue, toBulkUploadPhase, toBulkUploadResultsTab, toBulkUploadSortKey, toCompletedSubTab, toMatchSource, toMissingReceiptsTab, toExpenseAutomationJEScheduleMainTab, toExpenseAutomationJEScheduleSortKey, getExpenseAutomationView, toExpenseAutomationMissingReceiptsSortKey, toExpenseAutomationTransactionsTabKey, toExpenseAutomationViewType, uploadExpenseAutomationMissingReceiptSuccess, markExpenseAutomationMissingReceiptAsDone, fetchAllExpenseAutomationTabs, refreshExpenseAutomationCurrentTab, updateCurrentSelectedTransactionCategorizationTab, updateTransactionCategorizationCompletedSubTab, fetchExpenseAutomationMissingReceipts,
488
+ BATCH_FILE_STATUSES, isUnmatchedTabFileStatus, DEFAULT_COMPLETED_SUB_TAB, DEFAULT_TRANSACTION_GROUP, TRANSACTION_GROUPS, toTransactionGroup, toBatchFileStatus, toBatchStatusValue, toBulkUploadPhase, toBulkUploadResultsTab, toBulkUploadSortKey, toCompletedSubTab, toMatchSource, toMissingReceiptsTab, toExpenseAutomationJEScheduleSortKey, toJEPageTab, toggleJECreatedGroupCollapsed, toggleJEPendingGroupCollapsed, updateJEScheduleTypeFilter, getExpenseAutomationView, toExpenseAutomationMissingReceiptsSortKey, toExpenseAutomationTransactionsTabKey, toExpenseAutomationViewType, uploadExpenseAutomationMissingReceiptSuccess, markExpenseAutomationMissingReceiptAsDone, fetchAllExpenseAutomationTabs, refreshExpenseAutomationCurrentTab, updateCurrentSelectedTransactionCategorizationTab, updateTransactionCategorizationCompletedSubTab, updateTransactionGroup, fetchExpenseAutomationMissingReceipts,
486
489
  // Bulk Upload Actions
487
490
  bulkUploadReceipts, bulkUploadAutomatchingTimedOut, bulkUploadReceiptsSuccess, bulkUploadReceiptsFailure, restoreBulkUploadAutomatchingOnMount, restoreBulkUploadMatchingState, updateBulkUploadProgress, pusherBatchStatusUpdate, requestMissingReceiptsTabNavigation, clearMissingReceiptsTabNavigation, fetchBulkUploadBatchDetails, fetchBulkUploadBatchDetailsSuccess, fetchBulkUploadBatchDetailsFailure, storeBatchDetails, fetchMoreBatchDetails, fetchMoreBatchDetailsComplete, fetchMoreBatchDetailsFailure, fetchBulkUploadBatches, fetchBulkUploadBatchesSuccess, fetchBulkUploadBatchesFailure, clearBulkUploadBatchDetailsForScopeChange, markBatchDetailRefreshAttempted, refreshBatchDetailsForBatchId, confirmBulkUploadMatch, confirmBulkUploadMatchSuccess, confirmBulkUploadMatchFailure, setBulkUploadResultsTab, setBulkUploadCompletedSubTab, setBulkUploadSortConfig, setBulkUploadUploadedFileCount, clearBulkUpload, searchTransactionsForManualMatch, searchTransactionsForManualMatchSuccess, searchTransactionsForManualMatchFailure, clearManualSearchResults, acknowledgeBulkUploadConfirmMatchComplete, fetchCompletedTransactions, fetchCompletedTransactionsSuccess, fetchCompletedTransactionsFailure, fetchFluxAnalysisView, clearExpenseAutomationFluxAnalysisView, updateOperatingExpensesIdsForReview as updateFluxOperatingExpensesIdsForReview, updateSelectedSectionIdsForReview as updateFluxAnalysisSelectedSectionIdsForReview, reviewFluxAnalysisView, updateExpenseAutomationMissingReceiptUploadState, updateExpenseAutomationMissingReceiptsUIState, updateTransactionCategorizationUploadReceiptState, uploadTransactionCategorizationReceiptSuccess, getExpenseAutomationFluxAnalysisView, updateCurrentSelectedView, updateCurrentSelectedPeriod, getExpenseAutomationTransactionView, getLastTransferEntryReplacement, updateFluxAnalysisViewUIState, updateFluxAnalysisViewPageMetaData, MAX_SELECTION_LIMIT, checkIfAllLineItemsAreCategoryClassFilled, getLineItemsByTransactionIdsFromLocalData, isAnyItemWithUncategorizedExpenseAccount, excludeAccountFromReconciliation, includeAccountInReconciliation, saveExpenseAutomationReconciliationDetail, updateExpenseAutomationReconcileTabListScrollState, updateExpenseAutomationReconReviewTabListSortState, updateExpenseAutomationReconcileTabListSortState, updateExpenseAutomationReconcileTabLocalData, updateExpenseAutomationAccountReconciliationSelectedTab, updateExpenseAutomationAccountReconciliationSelectedAccountId, getExpenseAutomationReconciliationView, getLedgerAccountsForCombinedStatementMapping, getReparseStatementStatusByAccountId, getUnavailableLedgerAccountIds, fetchReconciliationView, uploadAccountStatementIntoDocumentAI, updateExpenseAutomationReconListScrollPosition, setConnectionInProgressForAccountReconciliation, getAccountReconByAccountIdAndSelectedPeriod, toReconciliationTabsType, isAccountReconReport, updateExpenseAutomationReconReviewTabLocalData, updateExpenseAutomationSelectedDrawerAccountId, updateStatementProcessingFailed, saveExpenseAutomationReconciliationReview, updateExpenseAutomationAccountReconciliationLocalData, toReconciliationAccountSource, deleteAccountStatement, uploadAccountStatement, parseCombinedStatement, parseStatement, parseStatementSuccess, parseStatementFailure, reparseStatement, reparseStatementSuccess, reparseStatementFailure, resetReparseStatementStatus, updateParsedStatementData, updateNodeCollapseState, updateStatementUploadChosen, submitCombinedStatementUpdate, submitStatementUpdate, clearStatementDateConflict, confirmStatementMapping, updateStatementUpdateLocalData, isReviewTransactionBankTransferType, isReviewTransactionBillPaymentType, isReviewTransactionCreditCardPaymentType, isReviewTransactionDepositType, isReviewTransactionExpenseType, isReviewTransactionCreditCardCreditType, setStatementParseInProgress, setStatementProcessingDismissedToBackground, updateStatementProcessingBackgroundCompletedSteps, };
491
+ export { computeNewScheduleJeDetails, createOneTimeAccrual, createOneTimeAccrualFailure, createOneTimeAccrualSuccess, fetchOneTimeAccrual, getJeNewAccrualAccountsView, ignoreOneTimeAccrual, promoteOneTimeAccrual, revertJeSchedule, revertOneTimeAccrual, getJeNewScheduleSearchTransactionsView, getJeNewScheduleView, };
488
492
  export { fetchTransactionCategorization, fetchTransactionCategorizationView, updateTransactionCategorizationUIState, updateTransactionFilters, updateSelectedCheckboxTransactionIds, markCategoryClassRecommendationsFailureForCategorization, setEntityRecommendationForLineIdsForCategorization, initializeTransactionCategorizationViewLocalData, setAllItemsToCategoryClassInLocalDataForCategorization, saveTransactionCategorizationLocalData, fetchTransactionCategorizationFailure, saveTransactionCategorization, updateTransactionCategorization, updateTransactionCategorizationSaveStatus, markTransactionAsNotMiscategorized, updateSelectedVendorForTransaction, updateSelectedCustomerForTransaction, updateSelectedTransactionId, syncTransactionCategorizationFromDetailSave, backgroundRefetchReviewTab, createTransferEntry, createTransferEntryFailure, createTransferEntryReplacedTransaction, createTransferEntrySuccess, resetCreateTransferEntryStatus, clearTransferEntryRouteReplacement, fetchAccountsForTransferFlow, removeTransactionFromAllTabs, clearExpenseAutomationTransactionsView, toTransactionsSortKey, };
489
493
  export { TOP_EX_TIME_PERIODS };
490
494
  export { toTimeframeTick, mapTimePeriodtoTimeframeTick, toTimePeriod, toAbsoluteDay, toMonthYearPeriodId, convertToPeriod, };
@@ -540,7 +544,7 @@ export { toTransactionType, toTransactionTypeStrict, toTransactionCategory, };
540
544
  export { defaultVendorCurrency, updateVendors };
541
545
  export { isVendorTransaction, isVendorTransactionWithCustomer, };
542
546
  export { isTransferTransaction };
543
- export { getSupportedTransactionById, };
547
+ export { getScheduleTransactionById, getSupportedTransactionById, };
544
548
  export { updateLatestTransactionId, parallelFetchAccountTransactionList, parallelFetchEntityTransactionList, fetchAccountTransactionList, updateTransactionListByAccount, updateTransactionListByAccountFailure, updateTransactionListByAccountUIState, parallelFetchClassTransactionList, updateTransactionListByClassUIState, updateTransactionListByClass, parallelFetchProjectTransactionList, updateTransactionListByProjectUIState, updateTransactionListByProject, updateTransactionListUIStateByCategoryType, parallelFetchTransactionListByCategoryType, };
545
549
  export { getTransactionListByAccount, getTransactionListUIStateByAccountKey, };
546
550
  export { fetchEntityTransactionList, updateTransactionListByEntity, saveTransactionDetailLocalData, clearTransactionDetailSaveStatus, updateTransactionListByEntityFailure, resetLineItemsCategoryClassInLocalData, setAllLineItemsToCategoryClassInLocalData, saveTransactionDetail, setAllLineItemsLocalDataIsUpdateAllChecked, initializeTransactionDetailLocalData, markCategoryClassRecommendationsFailureForTransactionDetail, removeEntityRecommendationForLineIdForTransactionDetail, updateSelectedVendor, updateSelectedCustomer, resetSelectedCustomer, resetVendor, updateLocalDataWithTransactionsUpdateWithVendorCheckbox, updateVendorToAllLineItems, resetAllLineItemsToVendor, updateLatestSelectedEntity, updateVendorBulkRecommendationsFetchStatus, setIsVendorUpdateAllChecked, addSplitLine, deleteSplitLine, toggleSplitEditMode, };
@@ -651,9 +655,9 @@ export { updateChargeCardTransactionAttachments, updateChargeCardStatusFromPushe
651
655
  export { TIME_SERIES_DURATIONS, convertToTimeSeriesSelectionRange, toTimeSeriesDuration, fetchAggregatedReport, aggregatedReportView, };
652
656
  export { fetchApAging, getApAgingReport, updateApAgingUIState, };
653
657
  export { fetchApAgingDetail, getApAgingDetailForVendor, updateApAgingDetailUIState, };
654
- export { clearExpenseAutomationJEScheduleLocalData, clearExpenseAutomationJESchedulesView, fetchExpenseAutomationJESchedulesPage, ignoreExpenseAutomationJESchedule, initializeJeAccountSettingsView, initializeJeScheduleLocalData, removeJeScheduleTransactionKey, retryExpenseAutomationJESchedule, updateExpenseAutomationJESchedulesUIState, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, };
658
+ export { clearExpenseAutomationJEScheduleLocalData, clearExpenseAutomationJESchedulesView, clearJeSearchTransactionsForNewSchedule, fetchExpenseAutomationJESchedulesPage, ignoreExpenseAutomationJESchedule, initializeJeAccountSettingsView, initializeJeNewSchedule, initializeJeScheduleLocalData, removeJeScheduleTransactionKey, resetJeNewScheduleLocalData, retryExpenseAutomationJESchedule, saveJeNewSchedule, saveJeNewScheduleFailure, saveJeNewScheduleSuccess, searchJeTransactionsForNewSchedule, searchJeTransactionsForNewScheduleFailure, searchJeTransactionsForNewScheduleSuccess, updateExpenseAutomationJESchedulesUIState, updateJeNewScheduleLocalData, updateJeScheduleLocalDataById, updateJeScheduleTransactionKeys, };
655
659
  export { createNewSchedulesAccrued, deleteScheduleAccruedDetail, cancelScheduleAccruedJournalEntry, fetchScheduleAccruedDetails, fetchScheduleAccruedDetailsPage, resetJEAccruedLinkInLocalData, saveScheduleAccruedDetails, updateAmountsInScheduleAccruedDetail, updatedJEAccruedLinkWithRecommendedLocalData, updatedJELinkInLocalDataAccruedExpenses, fetchRecommendedTransactionRowIndex, clearSelectedJELinkRowIndex, updateLinkBillExpenseLocalData, updateScheduleAccruedDetailsLocalData, updateSelectedJEAccruedScheduleKey, resetSelectedJEAccruedScheduleKey, resetAccruedDetailNewScheduleState, };
656
- export { getJEScheduleTransactionKey, ALL_SCHEDULES_TYPES, getScheduleListReport, getAccruedScheduleListReport, fetchScheduleList, fetchAccruedScheduleList, fetchDownloadSchedules, fetchSchedulesAccount, updateScheduleListLocalData, getFetchStateForScheduleAccountList, toScheduleTypesType, toScheduleTypesTypeStrict, toScheduleListTabsFileTypeStrict, toScheduleSubTabType, updateScheduleListSubTab, updateScheduleListSearchText, updateScheduleListScrollState, updateScheduleListSortState, updateSelectedJEScheduleKey, fetchScheduleDetails, getScheduleDetailsView, getAccruedScheduleDetailsView, fetchScheduleDetailsPage, saveScheduleDetails, deleteScheduleDetail, createNewSchedules, updateScheduleDetailsLocalData, updateScheduleListDownloadState, updateAccruedJEScheduleAccruedByListKey, updatedSelectedJELinkRowIndex, getQBOUrlForLink, getThirdPartyIDFromQBOURL, updatedJELinkInLocalData, updateAmountsInScheduleDetail, resetJELinkInLocalData, updatedJELinkWithRecommendedLocalData, getFetchStateForScheduleListByType, getDefaultSelectedTimeframeForScheduleType, markAsCompleteScheduleDetail, resetMarkAsCompleteStatus, fetchVendorTabView, updateVendorTabViewTab, getVendorTabView, };
660
+ export { getJEScheduleTransactionKey, ALL_JE_SCHEDULE_IGNORE_REASONS, ALL_JE_SCHEDULE_REVERT_REASONS, ALL_ONE_TIME_ACCRUAL_IGNORE_REASONS, ALL_ONE_TIME_ACCRUAL_REVERT_REASONS, ALL_SCHEDULES_TYPES, getScheduleListReport, getAccruedScheduleListReport, fetchScheduleList, fetchAccruedScheduleList, fetchDownloadSchedules, fetchSchedulesAccount, updateScheduleListLocalData, getFetchStateForScheduleAccountList, toScheduleTypesType, toScheduleTypesTypeStrict, toScheduleListTabsFileTypeStrict, toScheduleSubTabType, updateScheduleListSubTab, updateScheduleListSearchText, updateScheduleListScrollState, updateScheduleListSortState, updateSelectedJEScheduleKey, fetchScheduleDetails, getScheduleDetailsView, getAccruedScheduleDetailsView, fetchScheduleDetailsPage, saveScheduleDetails, deleteScheduleDetail, createNewSchedules, updateScheduleDetailsLocalData, updateScheduleListDownloadState, updateAccruedJEScheduleAccruedByListKey, updatedSelectedJELinkRowIndex, getQBOUrlForLink, getThirdPartyIDFromQBOURL, updatedJELinkInLocalData, updateAmountsInScheduleDetail, resetJELinkInLocalData, updatedJELinkWithRecommendedLocalData, getFetchStateForScheduleListByType, getDefaultSelectedTimeframeForScheduleType, markAsCompleteScheduleDetail, resetMarkAsCompleteStatus, fetchVendorTabView, updateVendorTabViewTab, getVendorTabView, };
657
661
  export { toVendorFirstReviewViewColumnKeyType, getGlobalMerchantAutoCompleteResults, getVendorFirstReviewView, getVendorFirstReviewAttachmentView, fetchVendorFirstReviewView, fetchVendorFirstReviewAttachments, updateVendorFirstReviewViewScrollYOffset, resetVendorFirstReviewLocalData, updateVendorFirstReviewViewPageToken, clearRecentlySavedErroredVendorData, saveVendorFirstReviewView, updateVendorFirstReviewViewLocalData, updateVendorFirstReviewSortUiState, fetchGlobalMerchantAutoCompleteView, clearGlobalMerchantAutoCompleteResults, updateReviewVendorDetailLocalData, saveVendorDetailsView, getVendorDetailSelectorView, };
658
662
  export { fetchGlobalMerchantRecommendation, createGlobalMerchant, updateCreateGlobalMerchantLocalData, clearGlobalMerchantView, getGlobalMerchantView, };
659
663
  export { approveVendorGlobalReview, rejectVendorGlobalReview, fetchVendorGlobalReviewView, updateSelectedGlobalMerchant, updateVendorGlobalReviewViewUIState, getVendorGlobalReviewView, getTenantMerchantByMerchantId, toVendorGlobalReviewColumnSortKeyType, updateVendorGlobalReviewViewLocalData, };
@@ -861,3 +865,6 @@ export { INVOICING_QBO_CUSTOMER_MATCHING_MODES, getInvoicingQboAccountMappingId,
861
865
  export { acceptInvoicingTerms, enableInvoicing, fetchInvoicingConfig, resetInvoicingConfigActionStates, updateInvoicingConfig, } from './view/invoicing/invoicingConfigView/invoicingConfigViewReducer';
862
866
  export { getInvoicingConfigView } from './view/invoicing/invoicingConfigView/invoicingConfigViewSelector';
863
867
  export { getInvoicingOnboardingGateView } from './view/invoicing/invoicingConfigView/invoicingConfigViewSelector';
868
+ // Accrued JE schedules are not a discriminated union member, so consumers need this guard to
869
+ // narrow a JEScheduleRow before reading baseTransaction / recurringAmount.
870
+ export { getExpenseAutomationJEOneTimeAccrualDetailView, getJEScheduleRowType, isAccruedScheduleRow, isAiAccountantSchedule, isExistingTabRow, isOneTimeAccrualRow, isRenderableOneTimeAccrual, isPendingReviewRow, } from './view/expenseAutomationView/selectors/jeSchedulesViewSelector';
@@ -28,6 +28,7 @@ export const initialState = {
28
28
  reimbursementAccountList: initialAccountList,
29
29
  schedulesAccountList: initialAccountList,
30
30
  billPayAccountList: initialAccountList,
31
+ invoicingAccountList: initialAccountList,
31
32
  },
32
33
  };
33
34
  const accountList = createSlice({
@@ -8,6 +8,7 @@ import { fetchJeSchedulesPage } from '../../reducers/jeSchedulesViewReducer';
8
8
  import { fetchMissingReceipts } from '../../reducers/missingReceiptsViewReducer';
9
9
  import { fetchReconciliation } from '../../reducers/reconciliationViewReducer';
10
10
  import { fetchTransactionCategorizationView } from '../../reducers/transactionsViewReducer';
11
+ import { getJESchedulePeriodTabKey } from '../../types/jeSchedulesViewState';
11
12
  export const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.pipe(filter(fetchAllExpenseAutomationTabs.match), switchMap((action) => {
12
13
  const { cacheOverride, refreshViewInBackground } = action.payload;
13
14
  const state = state$.value;
@@ -59,14 +60,16 @@ export const fetchAllExpenseAutomationTabsEpic = (actions$, state$) => actions$.
59
60
  state.expenseAutomationFluxAnalysisViewState.groupsBySelectedPeriod[monthYearPeriodId] == null)) {
60
61
  fetchActions.push(fetchFluxAnalysisView(selectedPeriod, cacheOverride, refreshViewInBackground, null));
61
62
  }
63
+ // The two JE tabs cache separately, so only the tab actually being shown decides whether a
64
+ // fetch is still needed.
65
+ const jeSchedulesPeriodTabKey = getJESchedulePeriodTabKey(state.expenseAutomationJESchedulesViewState.uiState.selectedPageTab, monthYearPeriodId);
62
66
  if (state.expenseAutomationJESchedulesViewState.fetchState !==
63
67
  'In-Progress' &&
64
68
  (!state.expenseAutomationJESchedulesViewState.hasValidState() ||
65
69
  state.expenseAutomationJESchedulesViewState
66
- .jeScheduleTransactionKeysByPeriod[monthYearPeriodId] == null ||
70
+ .jeScheduleTransactionKeysByPeriodAndTab[jeSchedulesPeriodTabKey] == null ||
67
71
  state.expenseAutomationJESchedulesViewState
68
- .failedJeScheduleTransactionKeysByPeriod[monthYearPeriodId] ==
69
- null)) {
72
+ .failedJeScheduleTransactionKeysByPeriodAndTab[jeSchedulesPeriodTabKey] == null)) {
70
73
  fetchActions.push(fetchJeSchedulesPage({ start: timePeriodStart, end: timePeriodEnd }, cacheOverride));
71
74
  }
72
75
  if (state.expenseAutomationReconciliationViewState.fetchState !==
@@ -1,9 +1,12 @@
1
1
  import { from, of } from 'rxjs';
2
- import { catchError, filter, mergeMap } from 'rxjs/operators';
3
- import { toString } from '../../../../commonStateTypes/timePeriod';
4
- import { updateJESchedules, updateJESchedulesDetails, } from '../../../../entity/jeSchedules/jeSchedulesReducer';
2
+ import { catchError, filter, mergeMap, takeUntil } from 'rxjs/operators';
3
+ import { DEFAULT_DATE_FORMAT } from '../../../../commonStateTypes/timePeriod';
4
+ import { toAbsoluteDay, toString } from '../../../../commonStateTypes/timePeriod';
5
+ import { updateAccruedJESchedules, updateAccruedJESchedulesDetails, updateJEOneTimeAccruals, updateJESchedules, updateJESchedulesDetails, } from '../../../../entity/jeSchedules/jeSchedulesReducer';
5
6
  import { getCurrentTenant } from '../../../../entity/tenant/tenantSelector';
6
7
  import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
8
+ import { clearAll } from '../../../../rootActions';
9
+ import { date } from '../../../../zeniDayJS';
7
10
  import { fetchJeSchedules, fetchJeSchedulesFailure, fetchJeSchedulesSuccess, initializeJeScheduleLocalData, } from '../../reducers/jeSchedulesViewReducer';
8
11
  export const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(fetchJeSchedules.match), mergeMap((action) => {
9
12
  const state = state$.value;
@@ -11,27 +14,54 @@ export const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe
11
14
  const { period, refreshViewInBackground } = action.payload;
12
15
  const currentTenant = getCurrentTenant(state);
13
16
  const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
17
+ const { selectedPageTab } = state.expenseAutomationJESchedulesViewState.uiState;
18
+ const isClosePeriodTab = selectedPageTab === 'schedules';
19
+ const existingEndDate = toAbsoluteDay(date(toString(period.start))
20
+ .subtract(1, 'month')
21
+ .endOf('month')
22
+ .format(DEFAULT_DATE_FORMAT));
14
23
  const queryParam = {
15
24
  start_date: toString(period.start),
16
- end_date: toString(period.end),
25
+ end_date: isClosePeriodTab || existingEndDate == null
26
+ ? toString(period.end)
27
+ : toString(existingEndDate),
28
+ include_accrued: true,
29
+ ...(isClosePeriodTab
30
+ ? { close_period_start_date: toString(period.start) }
31
+ : {}),
17
32
  };
18
33
  return zeniAPI
19
34
  .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/expenses_automation/je_schedules?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
20
35
  .pipe(mergeMap((response) => {
21
36
  if (isSuccessResponse(response) && response.data != null) {
22
37
  const updateActions = [];
38
+ const accruedJeSchedules = response.data.accrued_je_schedules?.je_schedules ?? [];
39
+ const oneTimeAccruals = response.data.one_time_accruals ?? [];
23
40
  updateActions.push(updateJESchedules([
24
41
  ...response.data.je_schedules,
25
42
  ...response.data.failed_je_postings.je_schedules,
26
43
  ]), updateJESchedulesDetails([...response.data.failed_je_postings.je_schedules], response.data.failed_je_postings.scheduled_journal_entries), initializeJeScheduleLocalData([
27
44
  ...response.data.failed_je_postings.je_schedules,
28
45
  ]));
46
+ if (accruedJeSchedules.length > 0) {
47
+ updateActions.push(updateAccruedJESchedules(accruedJeSchedules), updateAccruedJESchedulesDetails(accruedJeSchedules, response.data.accrued_je_schedules
48
+ ?.scheduled_journal_entries));
49
+ }
50
+ if (oneTimeAccruals.length > 0) {
51
+ // Single action, unlike the accrued pair above: this one writes the entity
52
+ // directly because an accrual denormalizes its vendor, accounts and classes, so
53
+ // there is no fan-out fetch to trigger.
54
+ updateActions.push(updateJEOneTimeAccruals(oneTimeAccruals));
55
+ }
29
56
  updateActions.push(fetchJeSchedulesSuccess({
30
57
  jeSchedules: [...response.data.je_schedules],
31
58
  failedJeSchedules: [
32
59
  ...response.data.failed_je_postings.je_schedules,
33
60
  ],
61
+ accruedJeSchedules: accruedJeSchedules,
62
+ oneTimeAccruals: oneTimeAccruals,
34
63
  selectedPeriod: selectedPeriod,
64
+ selectedPageTab: selectedPageTab,
35
65
  refreshViewInBackground: refreshViewInBackground,
36
66
  }));
37
67
  return from(updateActions);
@@ -40,11 +70,17 @@ export const fetchJeSchedulesEpic = (actions$, state$, zeniAPI) => actions$.pipe
40
70
  return of(fetchJeSchedulesFailure({
41
71
  status: response.status,
42
72
  selectedPeriod,
73
+ selectedPageTab,
43
74
  }));
44
75
  }
45
76
  }), catchError((error) => of(fetchJeSchedulesFailure({
46
77
  status: createZeniAPIStatus('Unexpected Error', 'fetch JE schedules REST API call errored out' +
47
78
  JSON.stringify(error)),
48
79
  selectedPeriod,
49
- }))));
80
+ selectedPageTab,
81
+ }))),
82
+ // A tenant switch clears the store while this request is still in flight. Without this
83
+ // the old tenant's rows are written back into the freshly cleared store and stay on
84
+ // screen under the new tenant until a manual refresh.
85
+ takeUntil(actions$.pipe(filter(clearAll.match))));
50
86
  }));
@@ -0,0 +1,45 @@
1
+ import { from } from 'rxjs';
2
+ import { catchError, filter, mergeMap, takeUntil } from 'rxjs/operators';
3
+ import { updateJEOneTimeAccruals } from '../../../../entity/jeSchedules/jeSchedulesReducer';
4
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
5
+ import { clearAll } from '../../../../rootActions';
6
+ import { fetchOneTimeAccrual, fetchOneTimeAccrualFailure, fetchOneTimeAccrualSuccess, } from '../../reducers/jeSchedulesViewReducer';
7
+ /**
8
+ * Read one accrual by id so its detail page can render from a URL alone.
9
+ *
10
+ * Every other row on this page arrives with the JE Schedules list, and the accrual detail page used
11
+ * to render only from what that list had already put in the store -- so opening its URL directly, on
12
+ * a refresh or a shared link, had nothing to render and showed not-found. This is the read that
13
+ * makes the URL self-sufficient.
14
+ *
15
+ * The response is the same `{accrual}` envelope promote / ignore / revert return, and it goes through
16
+ * the same `updateJEOneTimeAccruals`, so a page loaded cold holds exactly the entity a page reached
17
+ * through the list holds.
18
+ */
19
+ export const fetchOneTimeAccrualEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchOneTimeAccrual.match), mergeMap((action) => {
20
+ const { accrualId } = action.payload;
21
+ return zeniAPI
22
+ .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/${accrualId}`)
23
+ .pipe(mergeMap((response) => {
24
+ if (isSuccessResponse(response) && response.data != null) {
25
+ return from([
26
+ updateJEOneTimeAccruals([response.data.accrual]),
27
+ fetchOneTimeAccrualSuccess({ accrualId }),
28
+ ]);
29
+ }
30
+ // A deleted or ignored accrual answers 404 here, the same as an id that never existed.
31
+ // Both end as an error state the page turns into not-found, rather than a spinner that
32
+ // never resolves.
33
+ return from([
34
+ fetchOneTimeAccrualFailure({ accrualId, status: response.status }),
35
+ ]);
36
+ }), catchError((error) => from([
37
+ fetchOneTimeAccrualFailure({
38
+ accrualId,
39
+ status: createZeniAPIStatus('Unexpected Error', `Fetch one-time accrual REST API call errored out ${JSON.stringify(error)}`),
40
+ }),
41
+ ])),
42
+ // A tenant switch clears the store while this request is in flight. Without this the old
43
+ // tenant's accrual is written back into the freshly cleared store.
44
+ takeUntil(actions$.pipe(filter(clearAll.match))));
45
+ }));
@@ -11,13 +11,25 @@ import { ignoreRecommendedJeSchedule, ignoreRecommendedJeScheduleFailure, ignore
11
11
  export const ignoreRecommendedJeScheduleEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(ignoreRecommendedJeSchedule.match), mergeMap((action) => {
12
12
  const state = state$.value;
13
13
  const { expenseAutomationViewState: { selectedPeriodByTenantId }, } = state;
14
- const { scheduleType, jeScheduleTransactionKey } = action.payload;
14
+ const { scheduleType, jeScheduleTransactionKey, reason, note } = action.payload;
15
15
  const currentTenant = getCurrentTenant(state);
16
16
  const selectedPeriod = selectedPeriodByTenantId[currentTenant.tenantId];
17
17
  const actions = [];
18
18
  const jeScheduleTransactionState = getJEScheduledTransactionByJEScheduleTransactionKey(jeScheduleTransactionKey, state);
19
+ const ignorePayload = prepareIgnoreSchedulePayload(scheduleType, jeScheduleTransactionState, state);
20
+ // The gateway reads reason/note from je_schedules[0].feedback and nowhere else, and rejects
21
+ // anything but those two keys inside it — `action` is stamped server-side.
19
22
  const payload = {
20
- ...prepareIgnoreSchedulePayload(scheduleType, jeScheduleTransactionState, state),
23
+ ...ignorePayload,
24
+ je_schedules: ignorePayload.je_schedules.map((schedule, index) => index === 0
25
+ ? {
26
+ ...schedule,
27
+ feedback: {
28
+ reason,
29
+ ...(note != null && note !== '' ? { note } : {}),
30
+ },
31
+ }
32
+ : schedule),
21
33
  };
22
34
  const queryParam = {
23
35
  je_schedule_type: scheduleType,
@@ -0,0 +1,99 @@
1
+ import { from } from 'rxjs';
2
+ import { catchError, filter, mergeMap } from 'rxjs/operators';
3
+ import { convertToPeriod, toAbsoluteDay, } from '../../../../../commonStateTypes/timePeriod';
4
+ import { updateJEOneTimeAccruals } from '../../../../../entity/jeSchedules/jeSchedulesReducer';
5
+ import { openSnackbar } from '../../../../../entity/snackbar/snackbarReducer';
6
+ import { getCurrentTenant } from '../../../../../entity/tenant/tenantSelector';
7
+ import { createZeniAPIStatus, isSuccessResponse, } from '../../../../../responsePayload';
8
+ import { prepareCreateOneTimeAccrualPayload, } from '../../../payload/jeSchedulesPayload';
9
+ import { createOneTimeAccrual, createOneTimeAccrualFailure, createOneTimeAccrualSuccess, fetchJeSchedules, } from '../../../reducers/jeSchedulesViewReducer';
10
+ export const createOneTimeAccrualEpic = (actions$, state$, zeniAPI) => actions$.pipe(filter(createOneTimeAccrual.match), mergeMap((action) => {
11
+ const state = state$.value;
12
+ const { localData } = action.payload;
13
+ /*
14
+ * Idempotency for the create. agent-je dedupes on this: the same key again returns the
15
+ * existing accrual rather than posting a second JE to QBO.
16
+ *
17
+ * Body `request_id` rather than the `Idempotency-Key` header the API doc prefers, on Mohit's
18
+ * call (2026-08-24). The header cannot reach the service from a browser -- common's
19
+ * Access-Control-Allow-Headers does not list it, so cross-origin preflight rejects the
20
+ * request. Same meaning either way; the header simply wins when both are sent.
21
+ *
22
+ * Minted here, per create action, and deliberately not held in local data or the form: a new
23
+ * Save must produce a new key, and only a retry of *this* request may reuse one. Nothing
24
+ * retries today -- if a retry operator is ever added below, it has to sit inside this
25
+ * mergeMap so the key is not re-minted, or the guarantee is silently lost.
26
+ */
27
+ const requestId = crypto.randomUUID();
28
+ const payload = {
29
+ ...prepareCreateOneTimeAccrualPayload(state, localData),
30
+ request_id: requestId,
31
+ };
32
+ // convertToPeriod destructures, so an unset period would throw here and take the epic
33
+ // subscription down for the whole session — a missed refresh is the cheaper failure.
34
+ const selectedMonthYear = state.expenseAutomationViewState.selectedPeriodByTenantId[getCurrentTenant(state).tenantId];
35
+ const selectedPeriod = selectedMonthYear != null
36
+ ? convertToPeriod(selectedMonthYear)
37
+ : undefined;
38
+ const periodStart = selectedPeriod != null
39
+ ? toAbsoluteDay(selectedPeriod.start)
40
+ : undefined;
41
+ const periodEnd = selectedPeriod != null ? toAbsoluteDay(selectedPeriod.end) : undefined;
42
+ return zeniAPI
43
+ .postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals`, payload)
44
+ .pipe(mergeMap((response) => {
45
+ if (isSuccessResponse(response) && response.data != null) {
46
+ const successActions = [
47
+ updateJEOneTimeAccruals([response.data.accrual]),
48
+ createOneTimeAccrualSuccess(),
49
+ openSnackbar({
50
+ messageSection: 'create_schedule',
51
+ messageText: 'success',
52
+ type: 'success',
53
+ variables: [
54
+ {
55
+ variableName: '_vendor_name_',
56
+ variableValue: localData.vendorName,
57
+ },
58
+ ],
59
+ }),
60
+ ];
61
+ // The tab buckets (jeScheduleOneTimeAccrualKeysByPeriodAndTab) are rebuilt wholesale
62
+ // per fetch, and the backend decides whether a freshly posted accrual belongs to
63
+ // Review or Existing — so refetch rather than guess which bucket to insert into.
64
+ if (periodStart != null && periodEnd != null) {
65
+ successActions.push(fetchJeSchedules({ start: periodStart, end: periodEnd }, true));
66
+ }
67
+ return from(successActions);
68
+ }
69
+ return from([
70
+ createOneTimeAccrualFailure({ status: response.status }),
71
+ openSnackbar({
72
+ messageSection: 'create_schedule',
73
+ messageText: 'failed',
74
+ type: 'error',
75
+ variables: [
76
+ {
77
+ variableName: '_api-error_',
78
+ variableValue: response.status.message,
79
+ },
80
+ ],
81
+ }),
82
+ ]);
83
+ }), catchError((error) => from([
84
+ openSnackbar({
85
+ messageSection: 'create_schedule',
86
+ messageText: 'failed',
87
+ type: 'error',
88
+ variables: [
89
+ {
90
+ variableName: '_api-error_',
91
+ variableValue: JSON.stringify(error),
92
+ },
93
+ ],
94
+ }),
95
+ createOneTimeAccrualFailure({
96
+ status: createZeniAPIStatus('Unexpected Error', `Create One Time Accrual REST API call errored out ${JSON.stringify(error)}`),
97
+ }),
98
+ ])));
99
+ }));
@@ -0,0 +1,25 @@
1
+ import { from } from 'rxjs';
2
+ import { filter, mergeMap } from 'rxjs/operators';
3
+ import { fetchAccountList } from '../../../../accountList/accountListReducer';
4
+ import { fetchClassList } from '../../../../classList/classListReducer';
5
+ import { getAccountsTypesForScheduleEpics } from '../../../../scheduleView/scheduleListView/scheduleListHelper';
6
+ import { clearSearchTransactionsForNewSchedule, initializeNewSchedule, resetNewScheduleLocalData, } from '../../../reducers/jeSchedulesViewReducer';
7
+ export const initializeNewScheduleEpic = (actions$, state$) => actions$.pipe(filter(initializeNewSchedule.match), mergeMap((action) => {
8
+ const newScheduleActions = [];
9
+ const accountType = getAccountsTypesForScheduleEpics();
10
+ const { accountListState, classListState } = state$.value;
11
+ if (accountListState.byReportId[accountType.accountListKey]?.fetchState ===
12
+ 'Not-Started') {
13
+ newScheduleActions.push(fetchAccountList(accountType.accountListKey, true, false, false, false, accountType.allowedAccountList));
14
+ }
15
+ if (classListState.fetchState === 'Not-Started') {
16
+ newScheduleActions.push(fetchClassList());
17
+ }
18
+ // The account and class fetches above are idempotent (both guard on 'Not-Started'), so they
19
+ // can run on every open. Clearing what the user entered cannot, so it is opt-in.
20
+ if (action.payload.shouldResetEnteredData) {
21
+ newScheduleActions.push(resetNewScheduleLocalData({ scheduleType: action.payload.scheduleType }));
22
+ newScheduleActions.push(clearSearchTransactionsForNewSchedule());
23
+ }
24
+ return from(newScheduleActions);
25
+ }));