@zeniai/client-epic-state 5.2.10 → 5.2.11-betaAM1

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 (155) hide show
  1. package/lib/entity/jeSchedules/jeScheduleHelper.d.ts +1 -0
  2. package/lib/entity/jeSchedules/jeScheduleHelper.js +7 -0
  3. package/lib/entity/jeSchedules/jeSchedulesPayload.d.ts +86 -1
  4. package/lib/entity/jeSchedules/jeSchedulesPayload.js +172 -0
  5. package/lib/entity/jeSchedules/jeSchedulesReducer.d.ts +4 -2
  6. package/lib/entity/jeSchedules/jeSchedulesReducer.js +30 -2
  7. package/lib/entity/jeSchedules/jeSchedulesSelector.d.ts +11 -2
  8. package/lib/entity/jeSchedules/jeSchedulesSelector.js +38 -3
  9. package/lib/entity/jeSchedules/jeSchedulesState.d.ts +101 -1
  10. package/lib/entity/jeSchedules/jeSchedulesTypes.d.ts +24 -1
  11. package/lib/entity/jeSchedules/jeSchedulesTypes.js +88 -1
  12. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  13. package/lib/entity/snackbar/snackbarTypes.js +3 -0
  14. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.d.ts +2 -0
  15. package/lib/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  16. package/lib/entity/transaction/stateTypes/scheduleTransaction.d.ts +2 -0
  17. package/lib/epic.d.ts +14 -1
  18. package/lib/epic.js +26 -0
  19. package/lib/esm/entity/jeSchedules/jeScheduleHelper.js +6 -0
  20. package/lib/esm/entity/jeSchedules/jeSchedulesPayload.js +172 -1
  21. package/lib/esm/entity/jeSchedules/jeSchedulesReducer.js +30 -2
  22. package/lib/esm/entity/jeSchedules/jeSchedulesSelector.js +36 -2
  23. package/lib/esm/entity/jeSchedules/jeSchedulesTypes.js +78 -0
  24. package/lib/esm/entity/snackbar/snackbarTypes.js +3 -0
  25. package/lib/esm/entity/transaction/payloadTypes/scheduleTransactionPayload.js +2 -0
  26. package/lib/esm/epic.js +26 -0
  27. package/lib/esm/index.js +19 -9
  28. package/lib/esm/reducer.js +3 -0
  29. package/lib/esm/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +6 -2
  30. package/lib/esm/view/companyMonthEndReportView/companyMonthEndReportViewState.js +4 -0
  31. package/lib/esm/view/companyMonthEndReportView/epics/saveCompanyMonthEndReportEpic.js +10 -6
  32. package/lib/esm/view/companyMonthEndReportView/epics/sendCompanyMonthEndReportEpic.js +9 -5
  33. package/lib/esm/view/companyMonthEndReportView/monthEndTemplateData.js +32 -0
  34. package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +46 -0
  35. package/lib/esm/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +7 -0
  36. package/lib/esm/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +50 -0
  37. package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +44 -0
  38. package/lib/esm/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +44 -0
  39. package/lib/esm/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +30 -10
  40. package/lib/esm/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
  41. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
  42. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +41 -5
  43. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +45 -0
  44. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
  45. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +104 -0
  46. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +25 -0
  47. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +136 -0
  48. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +79 -0
  49. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +157 -0
  50. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +111 -0
  51. package/lib/esm/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +33 -0
  52. package/lib/esm/view/expenseAutomationView/expenseAutomationViewSelector.js +22 -7
  53. package/lib/esm/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +140 -0
  54. package/lib/esm/view/expenseAutomationView/payload/actualMatchingPayload.js +35 -0
  55. package/lib/esm/view/expenseAutomationView/payload/jeSchedulesPayload.js +55 -0
  56. package/lib/esm/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +260 -0
  57. package/lib/esm/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +314 -29
  58. package/lib/esm/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +1 -0
  59. package/lib/esm/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +1 -0
  60. package/lib/esm/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +162 -0
  61. package/lib/esm/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
  62. package/lib/esm/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +106 -0
  63. package/lib/esm/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +297 -22
  64. package/lib/esm/view/expenseAutomationView/types/actualMatchingViewState.js +22 -0
  65. package/lib/esm/view/expenseAutomationView/types/jeSchedulesViewState.js +8 -5
  66. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  67. package/lib/esm/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
  68. package/lib/esm/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
  69. package/lib/index.d.ts +25 -14
  70. package/lib/index.js +119 -51
  71. package/lib/reducer.d.ts +1 -0
  72. package/lib/reducer.js +3 -0
  73. package/lib/rootStateTypes.d.ts +2 -0
  74. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewPayload.d.ts +8 -0
  75. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.d.ts +6 -2
  76. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +6 -2
  77. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.d.ts +2 -0
  78. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.js +4 -0
  79. package/lib/view/companyMonthEndReportView/epics/saveCompanyMonthEndReportEpic.js +10 -6
  80. package/lib/view/companyMonthEndReportView/epics/sendCompanyMonthEndReportEpic.js +9 -5
  81. package/lib/view/companyMonthEndReportView/monthEndTemplateData.d.ts +16 -0
  82. package/lib/view/companyMonthEndReportView/monthEndTemplateData.js +36 -0
  83. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.d.ts +9 -0
  84. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingEpic.js +50 -0
  85. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.d.ts +5 -0
  86. package/lib/view/expenseAutomationView/epics/actualMatching/fetchActualMatchingPageEpic.js +11 -0
  87. package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.d.ts +8 -0
  88. package/lib/view/expenseAutomationView/epics/actualMatching/matchAndReverseAccrualsEpic.js +54 -0
  89. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.d.ts +8 -0
  90. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchAccrualsEpic.js +48 -0
  91. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.d.ts +8 -0
  92. package/lib/view/expenseAutomationView/epics/actualMatching/searchMatchTransactionsEpic.js +48 -0
  93. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.d.ts +2 -1
  94. package/lib/view/expenseAutomationView/epics/common/fetchAllExpenseAutomationTabsEpic.js +30 -10
  95. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.d.ts +2 -1
  96. package/lib/view/expenseAutomationView/epics/common/refreshExpenseAutomationCurrentTabEpic.js +9 -1
  97. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulePageEpic.js +9 -1
  98. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.d.ts +3 -2
  99. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchJeSchedulesEpic.js +39 -3
  100. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.d.ts +21 -0
  101. package/lib/view/expenseAutomationView/epics/jeSchedule/fetchOneTimeAccrualEpic.js +49 -0
  102. package/lib/view/expenseAutomationView/epics/jeSchedule/ignoreRecommendedJeScheduleEpic.js +14 -2
  103. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.d.ts +9 -0
  104. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/createOneTimeAccrualEpic.js +108 -0
  105. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.d.ts +8 -0
  106. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/initializeNewScheduleEpic.js +29 -0
  107. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.d.ts +9 -0
  108. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/saveNewScheduleEpic.js +140 -0
  109. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.d.ts +8 -0
  110. package/lib/view/expenseAutomationView/epics/jeSchedule/newSchedule/searchTransactionsForNewScheduleEpic.js +83 -0
  111. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.d.ts +13 -0
  112. package/lib/view/expenseAutomationView/epics/jeSchedule/oneTimeAccrualActionsEpic.js +164 -0
  113. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.d.ts +65 -0
  114. package/lib/view/expenseAutomationView/epics/jeSchedule/revertJeScheduleEpic.js +115 -0
  115. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.d.ts +7 -0
  116. package/lib/view/expenseAutomationView/epics/jeSchedule/switchJESchedulesTabEpic.js +37 -0
  117. package/lib/view/expenseAutomationView/expenseAutomationViewSelector.js +22 -7
  118. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.d.ts +36 -0
  119. package/lib/view/expenseAutomationView/helpers/newScheduleLocalDataHelper.js +145 -0
  120. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  121. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.d.ts +66 -0
  122. package/lib/view/expenseAutomationView/payload/actualMatchingPayload.js +40 -0
  123. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.d.ts +72 -3
  124. package/lib/view/expenseAutomationView/payload/jeSchedulesPayload.js +58 -1
  125. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.d.ts +53 -0
  126. package/lib/view/expenseAutomationView/reducers/actualMatchingViewReducer.js +264 -0
  127. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.d.ts +91 -12
  128. package/lib/view/expenseAutomationView/reducers/jeSchedulesViewReducer.js +316 -29
  129. package/lib/view/expenseAutomationView/reducers/missingReceiptsViewReducer.d.ts +1 -1
  130. package/lib/view/expenseAutomationView/reducers/transactionsViewReducer.d.ts +2 -2
  131. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.d.ts +58 -0
  132. package/lib/view/expenseAutomationView/selectorTypes/actualMatchingViewSelectorTypes.js +2 -0
  133. package/lib/view/expenseAutomationView/selectorTypes/expenseAutomationViewSelectorTypes.d.ts +2 -0
  134. package/lib/view/expenseAutomationView/selectorTypes/jeAccountSettingsViewSelectorTypes.d.ts +1 -0
  135. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.d.ts +42 -0
  136. package/lib/view/expenseAutomationView/selectorTypes/jeNewScheduleViewSelectorTypes.js +2 -0
  137. package/lib/view/expenseAutomationView/selectorTypes/jeSchedulesSelectorTypes.d.ts +36 -7
  138. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.d.ts +9 -0
  139. package/lib/view/expenseAutomationView/selectors/actualMatchingViewSelector.js +172 -0
  140. package/lib/view/expenseAutomationView/selectors/jeAccountSettingsViewSelector.js +1 -0
  141. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.d.ts +21 -0
  142. package/lib/view/expenseAutomationView/selectors/jeNewScheduleViewSelector.js +112 -0
  143. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.d.ts +34 -0
  144. package/lib/view/expenseAutomationView/selectors/jeSchedulesViewSelector.js +305 -21
  145. package/lib/view/expenseAutomationView/types/actualMatchingViewState.d.ts +76 -0
  146. package/lib/view/expenseAutomationView/types/actualMatchingViewState.js +27 -0
  147. package/lib/view/expenseAutomationView/types/completedSubTab.d.ts +1 -1
  148. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.d.ts +83 -8
  149. package/lib/view/expenseAutomationView/types/jeSchedulesViewState.js +11 -7
  150. package/lib/view/expenseAutomationView/types/reconciliationViewState.d.ts +1 -1
  151. package/lib/view/scheduleView/scheduleListView/epics/fetchAccruedScheduleListEpic.js +1 -1
  152. package/lib/view/scheduleView/scheduleListView/epics/fetchDownloadSchedulesEpic.js +7 -2
  153. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.d.ts +4 -2
  154. package/lib/view/scheduleView/scheduleListView/scheduleListReducer.js +5 -3
  155. package/package.json +1 -1
package/lib/reducer.d.ts CHANGED
@@ -65,6 +65,7 @@ declare const reducers: import("redux").Reducer<import("redux").CombinedState<{
65
65
  entityAutoCompleteState: import("./view/autoComplete/entityAutoCompleteState").EntityAutoCompleteState;
66
66
  entityRecommendationState: import("./view/recommendation/recommendationState").EntityRecommendationState;
67
67
  expenseAutomationFluxAnalysisViewState: import("./view/expenseAutomationView/types/fluxAnalysisViewState").FluxAnalysisViewState;
68
+ expenseAutomationActualMatchingViewState: import("./view/expenseAutomationView/types/actualMatchingViewState").ActualMatchingViewState;
68
69
  expenseAutomationJESchedulesViewState: import("./view/expenseAutomationView/types/jeSchedulesViewState").JESchedulesViewState;
69
70
  expenseAutomationMissingReceiptsViewState: import(".").ExpenseAutomationMissingReceiptsViewState;
70
71
  expenseAutomationReconciliationViewState: import("./view/expenseAutomationView/types/reconciliationViewState").ReconciliationViewState;
package/lib/reducer.js CHANGED
@@ -155,6 +155,7 @@ const creditAgentViewReducer_1 = __importStar(require("./view/creditAgentView/cr
155
155
  const dashboardReducer_1 = __importStar(require("./view/dashboard/dashboardReducer"));
156
156
  const dashboardLayoutReducer_1 = __importStar(require("./view/dashboardLayout/dashboardLayoutReducer"));
157
157
  const expenseAutomationViewReducer_1 = __importStar(require("./view/expenseAutomationView/expenseAutomationViewReducer"));
158
+ const actualMatchingViewReducer_1 = __importStar(require("./view/expenseAutomationView/reducers/actualMatchingViewReducer"));
158
159
  const fluxAnalysisViewReducer_1 = __importStar(require("./view/expenseAutomationView/reducers/fluxAnalysisViewReducer"));
159
160
  const jeSchedulesViewReducer_1 = __importStar(require("./view/expenseAutomationView/reducers/jeSchedulesViewReducer"));
160
161
  const missingReceiptsViewReducer_1 = __importStar(require("./view/expenseAutomationView/reducers/missingReceiptsViewReducer"));
@@ -468,6 +469,7 @@ const initialViewsState = {
468
469
  entityAutoCompleteState: entityAutoCompleteReducer_1.initialState,
469
470
  entityRecommendationState: recommendationReducer_1.initialState,
470
471
  expenseAutomationFluxAnalysisViewState: fluxAnalysisViewReducer_1.initialState,
472
+ expenseAutomationActualMatchingViewState: actualMatchingViewReducer_1.initialState,
471
473
  expenseAutomationJESchedulesViewState: jeSchedulesViewReducer_1.initialState,
472
474
  expenseAutomationMissingReceiptsViewState: missingReceiptsViewReducer_1.initialState,
473
475
  expenseAutomationReconciliationViewState: reconciliationViewReducer_1.initialState,
@@ -762,6 +764,7 @@ const viewReducers = {
762
764
  entityAutoCompleteState: entityAutoCompleteReducer_1.default,
763
765
  entityRecommendationState: recommendationReducer_1.default,
764
766
  expenseAutomationFluxAnalysisViewState: fluxAnalysisViewReducer_1.default,
767
+ expenseAutomationActualMatchingViewState: actualMatchingViewReducer_1.default,
765
768
  expenseAutomationJESchedulesViewState: jeSchedulesViewReducer_1.default,
766
769
  expenseAutomationMissingReceiptsViewState: missingReceiptsViewReducer_1.default,
767
770
  expenseAutomationReconciliationViewState: reconciliationViewReducer_1.default,
@@ -114,6 +114,7 @@ import { CreditAgentViewState } from './view/creditAgentView/creditAgentViewStat
114
114
  import { DashboardState } from './view/dashboard/dashboardState';
115
115
  import { DashboardLayoutState } from './view/dashboardLayout/dashboardLayoutState';
116
116
  import { ExpenseAutomationViewState } from './view/expenseAutomationView/expenseAutomationViewState';
117
+ import { ActualMatchingViewState as ExpenseAutomationActualMatchingViewState } from './view/expenseAutomationView/types/actualMatchingViewState';
117
118
  import { FluxAnalysisViewState as ExpenseAutomationFluxAnalysisViewState } from './view/expenseAutomationView/types/fluxAnalysisViewState';
118
119
  import { JESchedulesViewState as ExpenseAutomationJESchedulesViewState } from './view/expenseAutomationView/types/jeSchedulesViewState';
119
120
  import { MissingReceiptsViewState as ExpenseAutomationMissingReceiptsViewState } from './view/expenseAutomationView/types/missingReceiptsViewState';
@@ -429,6 +430,7 @@ export type ViewsState = {
429
430
  editRemiDetailViewState: EditRemiDetailViewState;
430
431
  entityAutoCompleteState: EntityAutoCompleteState;
431
432
  entityRecommendationState: EntityRecommendationState;
433
+ expenseAutomationActualMatchingViewState: ExpenseAutomationActualMatchingViewState;
432
434
  expenseAutomationFluxAnalysisViewState: ExpenseAutomationFluxAnalysisViewState;
433
435
  expenseAutomationJESchedulesViewState: ExpenseAutomationJESchedulesViewState;
434
436
  expenseAutomationMissingReceiptsViewState: ExpenseAutomationMissingReceiptsViewState;
@@ -1,6 +1,12 @@
1
1
  import { AttachmentFilePayload } from '../../entity/file/filePayload';
2
2
  import { ZeniAPIResponse } from '../../responsePayload';
3
3
  export type MonthEndTemplateData = Record<string, unknown>;
4
+ /**
5
+ * The AI CFO insight fields a controller can edit before the month-end email
6
+ * is sent. Keys are the `agent_insights_*` merge vars the email template
7
+ * renders from, so this object is merged straight into `template_data`.
8
+ */
9
+ export type AgentInsightEdits = Record<`agent_insights_${string}`, string>;
4
10
  export interface CompanyMonthEndReportViewPayload {
5
11
  files: AttachmentFilePayload[];
6
12
  html: string | null;
@@ -9,6 +15,8 @@ export interface CompanyMonthEndReportViewPayload {
9
15
  template_data: MonthEndTemplateData;
10
16
  tenant_receiver_email_list: string[];
11
17
  zeni_requests_data: string[];
18
+ agent_insights_edited_at?: string | null;
19
+ agent_insights_edited_by?: string | null;
12
20
  draft_user_id?: string;
13
21
  last_month_end_email_draft_saved_at?: string;
14
22
  zeni_requests_html?: string;
@@ -1,7 +1,7 @@
1
1
  import { FetchState, FetchStateAndError, ID } from '../../commonStateTypes/common';
2
2
  import { ZeniAPIStatus } from '../../responsePayload';
3
3
  import { ZeniDate } from '../../zeniDayJS';
4
- import { CompanyMonthEndHistoricReportPayload, CompanyMonthEndReportHistoricDatesPayload, CompanyMonthEndReportTemplatesPayload, CompanyMonthEndReportViewPayload } from './companyMonthEndReportViewPayload';
4
+ import { AgentInsightEdits, CompanyMonthEndHistoricReportPayload, CompanyMonthEndReportHistoricDatesPayload, CompanyMonthEndReportTemplatesPayload, CompanyMonthEndReportViewPayload } from './companyMonthEndReportViewPayload';
5
5
  import { AuditSummaryData, CompanyMonthEndReportData, CompanyMonthEndReportViewState, CompanyMonthReportTemplates } from './companyMonthEndReportViewState';
6
6
  export declare const initialState: CompanyMonthEndReportViewState;
7
7
  export declare const initialCompanyMonthEndReportData: CompanyMonthEndReportData;
@@ -35,7 +35,10 @@ export declare const fetchImproveUsingZeniGPT: import("@reduxjs/toolkit").Action
35
35
  companyId: string;
36
36
  fileId: string | undefined;
37
37
  tenantId: string | undefined;
38
- }, "reviewCompanyView/sendCompanyMonthEndReport", never, never>, saveCompanyMonthEndReport: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[recipientEmailList: any, companyId: string, subject: string, isPreview: boolean, fileId?: string | undefined, zeniRequestsHtml?: string | undefined, tenantId?: string | undefined], {
38
+ }, "reviewCompanyView/sendCompanyMonthEndReport", never, never>, saveCompanyMonthEndReport: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[recipientEmailList: any, companyId: string, subject: string, isPreview: boolean, fileId?: string | undefined, zeniRequestsHtml?: string | undefined, options?: {
39
+ agentInsightEdits?: AgentInsightEdits;
40
+ tenantId?: ID;
41
+ } | undefined], {
39
42
  recipientEmailList: any;
40
43
  companyId: string;
41
44
  subject: string;
@@ -43,6 +46,7 @@ export declare const fetchImproveUsingZeniGPT: import("@reduxjs/toolkit").Action
43
46
  fileId: string | undefined;
44
47
  zeniRequestsHtml: string | undefined;
45
48
  tenantId: string | undefined;
49
+ agentInsightEdits: AgentInsightEdits | undefined;
46
50
  }, "reviewCompanyView/saveCompanyMonthEndReport", never, never>, updateStatusForSendCompanyMonthEndReport: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, status: FetchState, error?: ZeniAPIStatus<Record<string, unknown>> | undefined], {
47
51
  companyId: string;
48
52
  status: FetchState;
@@ -99,7 +99,10 @@ const companyMonthEndReportView = (0, toolkit_1.createSlice)({
99
99
  },
100
100
  },
101
101
  saveCompanyMonthEndReport: {
102
- prepare(recipientEmailList, companyId, subject, isPreview, fileId, zeniRequestsHtml, tenantId) {
102
+ // The trailing pair is an object, not two more positional optionals: both
103
+ // are optional and neither is a distinct type, so a swapped call would
104
+ // compile silently.
105
+ prepare(recipientEmailList, companyId, subject, isPreview, fileId, zeniRequestsHtml, options) {
103
106
  return {
104
107
  payload: {
105
108
  recipientEmailList,
@@ -108,7 +111,8 @@ const companyMonthEndReportView = (0, toolkit_1.createSlice)({
108
111
  isPreview,
109
112
  fileId,
110
113
  zeniRequestsHtml,
111
- tenantId,
114
+ tenantId: options?.tenantId,
115
+ agentInsightEdits: options?.agentInsightEdits,
112
116
  },
113
117
  };
114
118
  },
@@ -5,6 +5,8 @@ import { AuditSummary } from '../reviewCompanyView/reviewCompanyViewState';
5
5
  import { CompanyMonthEndHistoricReportPayload, CompanyMonthEndReportViewPayload, MonthEndTemplateData } from './companyMonthEndReportViewPayload';
6
6
  export interface CompanyMonthEndReportData {
7
7
  recipientEmailList: string[];
8
+ agentInsightsEditedAt?: ZeniDate;
9
+ agentInsightsEditedBy?: string;
8
10
  attachmentFile?: AttachmentFile;
9
11
  concatenatedHtml?: string;
10
12
  draftUserId?: string;
@@ -23,6 +23,10 @@ const toCompanyMonthEndReportData = (data) => {
23
23
  : undefined,
24
24
  draftUserId: data.draft_user_id,
25
25
  zeniRequestsData: data.zeni_requests_data ?? [],
26
+ agentInsightsEditedBy: data.agent_insights_edited_by ?? undefined,
27
+ agentInsightsEditedAt: data.agent_insights_edited_at != null
28
+ ? (0, zeniDayJS_1.date)(data.agent_insights_edited_at)
29
+ : undefined,
26
30
  };
27
31
  };
28
32
  exports.toCompanyMonthEndReportData = toCompanyMonthEndReportData;
@@ -9,9 +9,10 @@ const fileSelector_1 = require("../../../entity/file/fileSelector");
9
9
  const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
10
10
  const responsePayload_1 = require("../../../responsePayload");
11
11
  const zeniDayJS_1 = require("../../../zeniDayJS");
12
+ const monthEndTemplateData_1 = require("../monthEndTemplateData");
12
13
  const companyMonthEndReportViewReducer_1 = require("../companyMonthEndReportViewReducer");
13
14
  const saveCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyMonthEndReportViewReducer_1.saveCompanyMonthEndReport.match), (0, operators_1.mergeMap)((action) => {
14
- const { companyId, recipientEmailList, subject, isPreview, fileId, zeniRequestsHtml, tenantId, } = action.payload;
15
+ const { agentInsightEdits, companyId, recipientEmailList, subject, isPreview, fileId, zeniRequestsHtml, tenantId, } = action.payload;
15
16
  const state = state$.value;
16
17
  const company = state.companyState.companiesById[companyId];
17
18
  const companyName = state.companyState.companiesById[companyId].companyInfo.name;
@@ -30,15 +31,18 @@ const saveCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pi
30
31
  }
31
32
  }
32
33
  const payload = {
33
- template_data: {
34
- ...state.companyMonthEndReportViewState.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData.templateData,
35
- subject,
36
- },
34
+ template_data: (0, monthEndTemplateData_1.buildMonthEndTemplateData)(state.companyMonthEndReportViewState.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData.templateData, subject, agentInsightEdits),
37
35
  recipient_email_list: recipientEmailList,
38
36
  tenant_receiver_email_list: state.companyMonthEndReportViewState.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData.tenantReceiverEmailList,
39
37
  last_report_sent_business_day: lastReportSentBusinessDay,
40
38
  last_report_sent_date: lastReportSentDate.format(timePeriod_1.DEFAULT_DATE_FORMAT),
41
- zeni_requests_html: zeniRequestsHtml,
39
+ // Three-way, because the server distinguishes all three: an empty string means the user
40
+ // cleared the box and is sent as an explicit null, a value is sent as-is, and undefined
41
+ // means this save was not about Zeni Requests at all — the key is omitted so the draft's
42
+ // existing text is left alone.
43
+ ...(zeniRequestsHtml !== undefined && {
44
+ zeni_requests_html: zeniRequestsHtml === '' ? null : zeniRequestsHtml,
45
+ }),
42
46
  files: filePayload,
43
47
  };
44
48
  const query = { is_preview: isPreview };
@@ -10,6 +10,7 @@ const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
10
10
  const responsePayload_1 = require("../../../responsePayload");
11
11
  const zeniDayJS_1 = require("../../../zeniDayJS");
12
12
  const companyViewReducer_1 = require("../../companyView/companyViewReducer");
13
+ const monthEndTemplateData_1 = require("../monthEndTemplateData");
13
14
  const companyMonthEndReportViewReducer_1 = require("../companyMonthEndReportViewReducer");
14
15
  const sendCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyMonthEndReportViewReducer_1.sendCompanyMonthEndReport.match), (0, operators_1.mergeMap)((action) => {
15
16
  const { companyId, fileId, tenantId } = action.payload;
@@ -34,15 +35,18 @@ const sendCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pi
34
35
  }
35
36
  }
36
37
  const payload = {
37
- template_data: {
38
- ...state.companyMonthEndReportViewState.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData.templateData,
39
- subject,
40
- },
38
+ template_data: (0, monthEndTemplateData_1.buildMonthEndTemplateData)(state.companyMonthEndReportViewState.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData.templateData, subject),
41
39
  recipient_email_list: recipientEmailList,
42
40
  tenant_receiver_email_list: state.companyMonthEndReportViewState.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData.tenantReceiverEmailList,
43
41
  last_report_sent_business_day: lastReportSentBusinessDay,
44
42
  last_report_sent_date: lastReportSentDate.format(timePeriod_1.DEFAULT_DATE_FORMAT),
45
- zeni_requests_html: zeniRequestsHtml,
43
+ // Three-way, because the server distinguishes all three: an empty string means the user
44
+ // cleared the box and is sent as an explicit null, a value is sent as-is, and undefined
45
+ // means this save was not about Zeni Requests at all — the key is omitted so the draft's
46
+ // existing text is left alone.
47
+ ...(zeniRequestsHtml !== undefined && {
48
+ zeni_requests_html: zeniRequestsHtml === '' ? null : zeniRequestsHtml,
49
+ }),
46
50
  files: filePayload,
47
51
  };
48
52
  return zeniAPI
@@ -0,0 +1,16 @@
1
+ import { AgentInsightEdits, MonthEndTemplateData } from './companyMonthEndReportViewPayload';
2
+ /**
3
+ * The AI CFO (V2) month-end email renders its subject line from this merge var
4
+ * rather than from the generic `subject` key, so a subject typed in the cockpit
5
+ * has to be written here too or the sent email keeps the AI's original subject.
6
+ */
7
+ export declare const AGENT_INSIGHTS_SUBJECT_KEY = "agent_insights_subject";
8
+ /**
9
+ * Build the `template_data` sent to the month-end email endpoint.
10
+ *
11
+ * Controller edits to the AI-generated insight fields are merged over the
12
+ * template data held in the store. The server sanitizes and persists whichever
13
+ * `agent_insights_*` keys are present, and the send path renders from the
14
+ * persisted draft — so only a save (`is_preview: false`) makes an edit stick.
15
+ */
16
+ export declare const buildMonthEndTemplateData: (templateData: MonthEndTemplateData | undefined, subject: string | undefined, agentInsightEdits?: AgentInsightEdits) => MonthEndTemplateData;
@@ -0,0 +1,36 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.buildMonthEndTemplateData = exports.AGENT_INSIGHTS_SUBJECT_KEY = void 0;
4
+ /**
5
+ * The AI CFO (V2) month-end email renders its subject line from this merge var
6
+ * rather than from the generic `subject` key, so a subject typed in the cockpit
7
+ * has to be written here too or the sent email keeps the AI's original subject.
8
+ */
9
+ exports.AGENT_INSIGHTS_SUBJECT_KEY = 'agent_insights_subject';
10
+ /**
11
+ * Build the `template_data` sent to the month-end email endpoint.
12
+ *
13
+ * Controller edits to the AI-generated insight fields are merged over the
14
+ * template data held in the store. The server sanitizes and persists whichever
15
+ * `agent_insights_*` keys are present, and the send path renders from the
16
+ * persisted draft — so only a save (`is_preview: false`) makes an edit stick.
17
+ */
18
+ const buildMonthEndTemplateData = (templateData, subject, agentInsightEdits) => {
19
+ const merged = {
20
+ ...templateData,
21
+ ...agentInsightEdits,
22
+ subject,
23
+ };
24
+ // Only for AI CFO drafts (the key is absent on legacy ones), never over an
25
+ // explicit edit to the field itself, and never with an empty value — on send
26
+ // the subject comes from store state and can be absent, which must not blank
27
+ // the AI's subject line.
28
+ if (exports.AGENT_INSIGHTS_SUBJECT_KEY in merged &&
29
+ agentInsightEdits?.[exports.AGENT_INSIGHTS_SUBJECT_KEY] == null &&
30
+ subject != null &&
31
+ subject !== '') {
32
+ merged[exports.AGENT_INSIGHTS_SUBJECT_KEY] = subject;
33
+ }
34
+ return merged;
35
+ };
36
+ exports.buildMonthEndTemplateData = buildMonthEndTemplateData;
@@ -0,0 +1,9 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { updateJEOneTimeAccruals } from '../../../../entity/jeSchedules/jeSchedulesReducer';
4
+ import { clearAll } from '../../../../rootActions';
5
+ import { RootState } from '../../../../rootStateTypes';
6
+ import { ZeniAPI } from '../../../../zeniAPI';
7
+ import { fetchActualMatching, fetchActualMatchingFailure, fetchActualMatchingSuccess } from '../../reducers/actualMatchingViewReducer';
8
+ export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof fetchActualMatching> | ReturnType<typeof fetchActualMatchingFailure> | ReturnType<typeof fetchActualMatchingSuccess> | ReturnType<typeof updateJEOneTimeAccruals>;
9
+ export declare const fetchActualMatchingEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,50 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchActualMatchingEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const jeSchedulesReducer_1 = require("../../../../entity/jeSchedules/jeSchedulesReducer");
7
+ const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
8
+ const responsePayload_1 = require("../../../../responsePayload");
9
+ const rootActions_1 = require("../../../../rootActions");
10
+ const actualMatchingPayload_1 = require("../../payload/actualMatchingPayload");
11
+ const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
12
+ const fetchActualMatchingEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.fetchActualMatching.match), (0, operators_1.mergeMap)((action) => {
13
+ const state = state$.value;
14
+ const { period, refreshViewInBackground } = action.payload;
15
+ const currentTenant = (0, tenantSelector_1.getCurrentTenant)(state);
16
+ const selectedPeriod = state.expenseAutomationViewState
17
+ .selectedPeriodByTenantId[currentTenant.tenantId] ?? {
18
+ month: period.start.month,
19
+ year: period.start.year,
20
+ };
21
+ const serviceMonth = (0, actualMatchingPayload_1.toServiceMonthFromPeriod)(period);
22
+ return zeniAPI
23
+ .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals?service_month=${encodeURIComponent(serviceMonth)}&view=actual_matching`)
24
+ .pipe((0, operators_1.mergeMap)((response) => {
25
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
26
+ const accruals = response.data.accruals ?? [];
27
+ const updateActions = [];
28
+ if (accruals.length > 0) {
29
+ updateActions.push((0, jeSchedulesReducer_1.updateJEOneTimeAccruals)(accruals));
30
+ }
31
+ updateActions.push((0, actualMatchingViewReducer_1.fetchActualMatchingSuccess)({
32
+ accruals,
33
+ selectedPeriod,
34
+ refreshViewInBackground,
35
+ }));
36
+ return (0, rxjs_1.from)(updateActions);
37
+ }
38
+ return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.fetchActualMatchingFailure)({
39
+ status: response.status,
40
+ selectedPeriod,
41
+ refreshViewInBackground,
42
+ }));
43
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.fetchActualMatchingFailure)({
44
+ status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'fetch actual matching REST API call errored out' +
45
+ JSON.stringify(error)),
46
+ selectedPeriod,
47
+ refreshViewInBackground,
48
+ }))), (0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
49
+ }));
50
+ exports.fetchActualMatchingEpic = fetchActualMatchingEpic;
@@ -0,0 +1,5 @@
1
+ import { ActionsObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { fetchActualMatching, fetchActualMatchingPage } from '../../reducers/actualMatchingViewReducer';
4
+ export type ActionType = ReturnType<typeof fetchActualMatching> | ReturnType<typeof fetchActualMatchingPage>;
5
+ export declare const fetchActualMatchingPageEpic: (actions$: ActionsObservable<ActionType>) => Observable<ActionType>;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchActualMatchingPageEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
7
+ const fetchActualMatchingPageEpic = (actions$) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.fetchActualMatchingPage.match), (0, operators_1.mergeMap)((action) => {
8
+ const { period, refreshViewInBackground } = action.payload;
9
+ return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.fetchActualMatching)(period, refreshViewInBackground));
10
+ }));
11
+ exports.fetchActualMatchingPageEpic = fetchActualMatchingPageEpic;
@@ -0,0 +1,8 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { clearAll } from '../../../../rootActions';
4
+ import { RootState } from '../../../../rootStateTypes';
5
+ import { ZeniAPI } from '../../../../zeniAPI';
6
+ import { clearMatchNewModal, fetchActualMatching, matchAndReverseAccruals, matchAndReverseAccrualsFailure, matchAndReverseAccrualsSuccess } from '../../reducers/actualMatchingViewReducer';
7
+ export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof clearMatchNewModal> | ReturnType<typeof fetchActualMatching> | ReturnType<typeof matchAndReverseAccruals> | ReturnType<typeof matchAndReverseAccrualsFailure> | ReturnType<typeof matchAndReverseAccrualsSuccess>;
8
+ export declare const matchAndReverseAccrualsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,54 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.matchAndReverseAccrualsEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const timePeriod_1 = require("../../../../commonStateTypes/timePeriod");
7
+ const tenantSelector_1 = require("../../../../entity/tenant/tenantSelector");
8
+ const responsePayload_1 = require("../../../../responsePayload");
9
+ const rootActions_1 = require("../../../../rootActions");
10
+ const actualMatchingPayload_1 = require("../../payload/actualMatchingPayload");
11
+ const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
12
+ function refreshActualMatchingList(state) {
13
+ const selectedMonthYear = state.expenseAutomationViewState.selectedPeriodByTenantId[(0, tenantSelector_1.getCurrentTenant)(state).tenantId];
14
+ if (selectedMonthYear == null) {
15
+ return [];
16
+ }
17
+ const period = (0, timePeriod_1.convertToPeriod)(selectedMonthYear);
18
+ const start = (0, timePeriod_1.toAbsoluteDay)(period.start);
19
+ const end = (0, timePeriod_1.toAbsoluteDay)(period.end);
20
+ if (start == null || end == null) {
21
+ return [];
22
+ }
23
+ return [(0, actualMatchingViewReducer_1.fetchActualMatching)({ start, end }, true)];
24
+ }
25
+ const matchAndReverseAccrualsEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.matchAndReverseAccruals.match), (0, operators_1.mergeMap)((action) => {
26
+ const { transactionId, transactionIntegrationId, transactionType, lineId, accrualIds, } = action.payload;
27
+ const body = {
28
+ transaction_id: transactionId,
29
+ transaction_integration_id: transactionIntegrationId,
30
+ transaction_type: transactionType,
31
+ line_id: lineId,
32
+ accrual_ids: accrualIds,
33
+ };
34
+ return zeniAPI
35
+ .postAndGetJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/match-and-reverse`, body)
36
+ .pipe((0, operators_1.mergeMap)((response) => {
37
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
38
+ const results = (response.data.results ?? []).map(actualMatchingPayload_1.toMatchAndReverseResult);
39
+ const successActions = [
40
+ (0, actualMatchingViewReducer_1.matchAndReverseAccrualsSuccess)({ results }),
41
+ ];
42
+ const anyReversed = results.some((result) => result.status === 'reversed');
43
+ if (anyReversed) {
44
+ successActions.push(...refreshActualMatchingList(state$.value), (0, actualMatchingViewReducer_1.clearMatchNewModal)());
45
+ }
46
+ return (0, rxjs_1.from)(successActions);
47
+ }
48
+ return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.matchAndReverseAccrualsFailure)({ status: response.status }));
49
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.matchAndReverseAccrualsFailure)({
50
+ status: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Match and reverse accruals REST API call errored out' +
51
+ JSON.stringify(error)),
52
+ }))), (0, operators_1.takeUntil)(actions$.pipe((0, operators_1.filter)(rootActions_1.clearAll.match))));
53
+ }));
54
+ exports.matchAndReverseAccrualsEpic = matchAndReverseAccrualsEpic;
@@ -0,0 +1,8 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { updateJEOneTimeAccruals } from '../../../../entity/jeSchedules/jeSchedulesReducer';
4
+ import { RootState } from '../../../../rootStateTypes';
5
+ import { ZeniAPI } from '../../../../zeniAPI';
6
+ import { searchMatchAccruals, searchMatchAccrualsFailure, searchMatchAccrualsSuccess } from '../../reducers/actualMatchingViewReducer';
7
+ export type ActionType = ReturnType<typeof searchMatchAccruals> | ReturnType<typeof searchMatchAccrualsFailure> | ReturnType<typeof searchMatchAccrualsSuccess> | ReturnType<typeof updateJEOneTimeAccruals>;
8
+ export declare const searchMatchAccrualsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.searchMatchAccrualsEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const jeSchedulesReducer_1 = require("../../../../entity/jeSchedules/jeSchedulesReducer");
7
+ const responsePayload_1 = require("../../../../responsePayload");
8
+ const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
9
+ const actualMatchingViewState_1 = require("../../types/actualMatchingViewState");
10
+ const searchMatchAccrualsEpic = (actions$, _state$, zeniAPI) => {
11
+ const searchActions$ = actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.searchMatchAccruals.match));
12
+ const pagination$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken != null));
13
+ const newSearchDebounced$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken == null), (0, operators_1.debounceTime)(actualMatchingViewState_1.MATCH_SEARCH_DEBOUNCE_MS));
14
+ return (0, rxjs_1.merge)(pagination$, newSearchDebounced$).pipe((0, operators_1.switchMap)((action) => {
15
+ const { query, pageToken } = action.payload;
16
+ const offset = pageToken != null && pageToken.length > 0 ? Number(pageToken) : 0;
17
+ const searchText = encodeURIComponent(query);
18
+ const limit = actualMatchingViewState_1.MATCH_ACCRUAL_SEARCH_LIMIT;
19
+ return zeniAPI
20
+ .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals?status=posted&reversal_policy=on_bill_match&search_text=${searchText}&limit=${limit}&offset=${offset}`)
21
+ .pipe((0, operators_1.mergeMap)((response) => {
22
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
23
+ const accruals = response.data.accruals ?? [];
24
+ const append = pageToken != null;
25
+ const nextOffset = offset + accruals.length;
26
+ const total = response.data.total ?? nextOffset;
27
+ const nextPageToken = nextOffset < total ? String(nextOffset) : null;
28
+ const actionsOut = [];
29
+ if (accruals.length > 0) {
30
+ actionsOut.push((0, jeSchedulesReducer_1.updateJEOneTimeAccruals)(accruals));
31
+ }
32
+ actionsOut.push((0, actualMatchingViewReducer_1.searchMatchAccrualsSuccess)({
33
+ append,
34
+ nextPageToken,
35
+ results: accruals,
36
+ }));
37
+ return (0, rxjs_1.from)(actionsOut);
38
+ }
39
+ return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchAccrualsFailure)({
40
+ error: response.status,
41
+ }));
42
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchAccrualsFailure)({
43
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Search match accruals REST API call errored out' +
44
+ JSON.stringify(error)),
45
+ }))));
46
+ }));
47
+ };
48
+ exports.searchMatchAccrualsEpic = searchMatchAccrualsEpic;
@@ -0,0 +1,8 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { clearAll } from '../../../../rootActions';
4
+ import { RootState } from '../../../../rootStateTypes';
5
+ import { ZeniAPI } from '../../../../zeniAPI';
6
+ import { openMatchNewModal, searchMatchAccruals, searchMatchTransactions, searchMatchTransactionsFailure, searchMatchTransactionsSuccess } from '../../reducers/actualMatchingViewReducer';
7
+ export type ActionType = ReturnType<typeof clearAll> | ReturnType<typeof openMatchNewModal> | ReturnType<typeof searchMatchAccruals> | ReturnType<typeof searchMatchTransactions> | ReturnType<typeof searchMatchTransactionsFailure> | ReturnType<typeof searchMatchTransactionsSuccess>;
8
+ export declare const searchMatchTransactionsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.searchMatchTransactionsEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../../responsePayload");
7
+ const actualMatchingPayload_1 = require("../../payload/actualMatchingPayload");
8
+ const actualMatchingViewReducer_1 = require("../../reducers/actualMatchingViewReducer");
9
+ const actualMatchingViewState_1 = require("../../types/actualMatchingViewState");
10
+ const searchMatchTransactionsEpic = (actions$, _state$, zeniAPI) => {
11
+ const openModal$ = actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.openMatchNewModal.match), (0, operators_1.mergeMap)(() => (0, rxjs_1.from)([
12
+ (0, actualMatchingViewReducer_1.searchMatchTransactions)({ query: '' }),
13
+ (0, actualMatchingViewReducer_1.searchMatchAccruals)({ query: '' }),
14
+ ])));
15
+ const searchActions$ = actions$.pipe((0, operators_1.filter)(actualMatchingViewReducer_1.searchMatchTransactions.match));
16
+ const pagination$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken != null));
17
+ const newSearchDebounced$ = searchActions$.pipe((0, operators_1.filter)((action) => action.payload.pageToken == null), (0, operators_1.debounceTime)(actualMatchingViewState_1.MATCH_SEARCH_DEBOUNCE_MS));
18
+ const search$ = (0, rxjs_1.merge)(pagination$, newSearchDebounced$).pipe((0, operators_1.switchMap)((action) => {
19
+ const { query, pageToken } = action.payload;
20
+ const queryParam = {
21
+ search_text: query,
22
+ page_size: actualMatchingViewState_1.MATCH_TRANSACTION_SEARCH_PAGE_SIZE,
23
+ ...(pageToken != null ? { page_token: pageToken } : {}),
24
+ };
25
+ return zeniAPI
26
+ .getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/accruals/match-transaction-search?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
27
+ .pipe((0, operators_1.mergeMap)((response) => {
28
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
29
+ const { transactions, next_page_token } = response.data;
30
+ const append = pageToken != null;
31
+ const results = (transactions ?? []).map(actualMatchingPayload_1.toActualMatchingTransactionSearchResult);
32
+ return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchTransactionsSuccess)({
33
+ append,
34
+ nextPageToken: next_page_token ?? null,
35
+ results,
36
+ }));
37
+ }
38
+ return (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchTransactionsFailure)({
39
+ error: response.status,
40
+ }));
41
+ }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, actualMatchingViewReducer_1.searchMatchTransactionsFailure)({
42
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Search match transactions REST API call errored out' +
43
+ JSON.stringify(error)),
44
+ }))));
45
+ }));
46
+ return (0, rxjs_1.merge)(openModal$, search$);
47
+ };
48
+ exports.searchMatchTransactionsEpic = searchMatchTransactionsEpic;
@@ -3,10 +3,11 @@ import { Observable } from 'rxjs';
3
3
  import { RootState } from '../../../../rootStateTypes';
4
4
  import { fetchMonthEndCloseChecks } from '../../../monthEndCloseChecksView/monthEndCloseChecksViewReducer';
5
5
  import { fetchAllExpenseAutomationTabs } from '../../expenseAutomationViewReducer';
6
+ import { fetchActualMatchingPage } from '../../reducers/actualMatchingViewReducer';
6
7
  import { fetchFluxAnalysisView } from '../../reducers/fluxAnalysisViewReducer';
7
8
  import { fetchJeSchedulesPage } from '../../reducers/jeSchedulesViewReducer';
8
9
  import { fetchMissingReceipts } from '../../reducers/missingReceiptsViewReducer';
9
10
  import { fetchReconciliation } from '../../reducers/reconciliationViewReducer';
10
11
  import { fetchTransactionCategorizationView } from '../../reducers/transactionsViewReducer';
11
- export type ActionType = ReturnType<typeof fetchAllExpenseAutomationTabs> | ReturnType<typeof fetchMissingReceipts> | ReturnType<typeof fetchMonthEndCloseChecks> | ReturnType<typeof fetchFluxAnalysisView> | ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof fetchReconciliation> | ReturnType<typeof fetchTransactionCategorizationView>;
12
+ export type ActionType = ReturnType<typeof fetchAllExpenseAutomationTabs> | ReturnType<typeof fetchActualMatchingPage> | ReturnType<typeof fetchMissingReceipts> | ReturnType<typeof fetchMonthEndCloseChecks> | ReturnType<typeof fetchFluxAnalysisView> | ReturnType<typeof fetchJeSchedulesPage> | ReturnType<typeof fetchReconciliation> | ReturnType<typeof fetchTransactionCategorizationView>;
12
13
  export declare const fetchAllExpenseAutomationTabsEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;