@zeniai/client-epic-state 4.9.8 → 4.9.9

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 (52) hide show
  1. package/lib/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.d.ts +1 -0
  2. package/lib/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.js +2 -1
  3. package/lib/entity/company/companyHelper.d.ts +5 -0
  4. package/lib/entity/company/companyHelper.js +24 -0
  5. package/lib/entity/company/companySelector.d.ts +7 -0
  6. package/lib/entity/company/companySelector.js +17 -1
  7. package/lib/epic.d.ts +8 -6
  8. package/lib/epic.js +8 -6
  9. package/lib/index.d.ts +11 -11
  10. package/lib/index.js +21 -14
  11. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewPayload.d.ts +16 -0
  12. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.d.ts +21 -1
  13. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +77 -3
  14. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewSelector.d.ts +9 -1
  15. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewSelector.js +42 -1
  16. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.d.ts +15 -3
  17. package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.js +18 -1
  18. package/lib/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportHistoricDataEpic.d.ts +8 -0
  19. package/lib/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportHistoricDataEpic.js +66 -0
  20. package/lib/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportHistoricDatesEpic.d.ts +7 -0
  21. package/lib/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportHistoricDatesEpic.js +54 -0
  22. package/lib/view/companyMonthEndReportView/{fetchCompanyMonthEndReportViewEpic.d.ts → epics/fetchCompanyMonthEndReportViewEpic.d.ts} +4 -4
  23. package/lib/view/companyMonthEndReportView/{fetchCompanyMonthEndReportViewEpic.js → epics/fetchCompanyMonthEndReportViewEpic.js} +4 -2
  24. package/lib/view/companyMonthEndReportView/{improveUsingZeniGPTEpic.d.ts → epics/improveUsingZeniGPTEpic.d.ts} +3 -3
  25. package/lib/view/companyMonthEndReportView/{improveUsingZeniGPTEpic.js → epics/improveUsingZeniGPTEpic.js} +2 -2
  26. package/lib/view/companyMonthEndReportView/{saveCompanyMonthEndReportEpic.d.ts → epics/saveCompanyMonthEndReportEpic.d.ts} +5 -5
  27. package/lib/view/companyMonthEndReportView/{saveCompanyMonthEndReportEpic.js → epics/saveCompanyMonthEndReportEpic.js} +9 -7
  28. package/lib/view/companyMonthEndReportView/{sendCompanyMonthEndReportEpic.d.ts → epics/sendCompanyMonthEndReportEpic.d.ts} +5 -5
  29. package/lib/view/companyMonthEndReportView/{sendCompanyMonthEndReportEpic.js → epics/sendCompanyMonthEndReportEpic.js} +9 -7
  30. package/lib/view/recommendation/fetchEntityRecommendationsByTransactionIdEpic.d.ts +10 -0
  31. package/lib/view/recommendation/{fetchRecommendationByEntityQboIdEpic.js → fetchEntityRecommendationsByTransactionIdEpic.js} +13 -6
  32. package/lib/view/recommendation/fetchRecommendationByEntityIdEpic.js +2 -2
  33. package/lib/view/recommendation/recommendationHelper.d.ts +3 -0
  34. package/lib/view/recommendation/recommendationHelper.js +37 -21
  35. package/lib/view/recommendation/recommendationReducer.d.ts +1 -1
  36. package/lib/view/recommendation/recommendationReducer.js +3 -3
  37. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.d.ts +1 -0
  38. package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +17 -13
  39. package/lib/view/spendManagement/reimbursement/reimbursementConfig/reimbursementConfigState.d.ts +1 -0
  40. package/lib/view/spendManagement/reimbursement/reimbursementConfig/reimbursementConfigState.js +2 -1
  41. package/lib/view/spendManagement/reimbursement/remiDetailView/epics/fetchRemiDetailEpic.d.ts +2 -1
  42. package/lib/view/spendManagement/reimbursement/remiDetailView/epics/fetchRemiDetailEpic.js +8 -2
  43. package/lib/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.d.ts +2 -1
  44. package/lib/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.js +23 -14
  45. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.d.ts +2 -1
  46. package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +3 -2
  47. package/lib/view/transactionDetail/transactionDetailReducer.d.ts +3 -3
  48. package/lib/view/transactionDetail/transactionDetailReducer.js +4 -4
  49. package/lib/view/transactionDetail/transactionDetailState.d.ts +7 -0
  50. package/lib/view/transactionDetail/transactionDetailState.js +4 -3
  51. package/package.json +1 -1
  52. package/lib/view/recommendation/fetchRecommendationByEntityQboIdEpic.d.ts +0 -10
@@ -1,7 +1,8 @@
1
1
  import { FetchState, FetchStateAndError, ID } from '../../commonStateTypes/common';
2
2
  import { ZeniAPIStatus } from '../../responsePayload';
3
- import { CompanyMonthEndReportViewPayload } from './companyMonthEndReportViewPayload';
3
+ import { CompanyMonthEndReportViewPayload, CompanyMonthEndReportHistoricDatesPayload, CompanyMonthEndHistoricReportPayload } from './companyMonthEndReportViewPayload';
4
4
  import { CompanyMonthEndReportViewState, CompanyMonthEndReportData } from './companyMonthEndReportViewState';
5
+ import { ZeniDate } from '../../zeniDayJS';
5
6
  export declare const initialState: CompanyMonthEndReportViewState;
6
7
  export declare const initialCompanyMonthEndReportData: CompanyMonthEndReportData;
7
8
  export declare const initialSendMonthEndReportStatus: FetchStateAndError;
@@ -49,6 +50,25 @@ export declare const fetchImproveUsingZeniGPT: import("@reduxjs/toolkit").Action
49
50
  isPreview: boolean;
50
51
  }, string, never, never>, clearCompanyMonthEndReportView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetCompanyMonthEndReportFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
51
52
  companyId: ID;
53
+ }, string>, fetchCompanyMonthEndReportHistoricDates: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string], {
54
+ companyId: string;
55
+ }, string, never, never>, updateCompanyMonthEndReportHistoricDatesOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
56
+ error: ZeniAPIStatus;
57
+ companyId: ID;
58
+ }, string>, updateCompanyMonthEndReportHistoricDatesOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
59
+ companyId: ID;
60
+ data: CompanyMonthEndReportHistoricDatesPayload;
61
+ }, string>, fetchCompanyMonthEndReportHistoricData: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[companyId: string, reportSentDate: import("dayjs").Dayjs], {
62
+ reportSentDate: import("dayjs").Dayjs;
63
+ companyId: string;
64
+ }, string, never, never>, updateCompanyMonthEndReportHistoricDataOnFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
65
+ error: ZeniAPIStatus;
66
+ companyId: ID;
67
+ reportSentDate: ZeniDate;
68
+ }, string>, updateCompanyMonthEndReportHistoricDataOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
69
+ companyId: ID;
70
+ reportSentDate: ZeniDate;
71
+ data: CompanyMonthEndHistoricReportPayload;
52
72
  }, string>;
53
73
  declare const _default: import("@reduxjs/toolkit").Reducer<CompanyMonthEndReportViewState, import("@reduxjs/toolkit").AnyAction>;
54
74
  export default _default;
@@ -1,11 +1,14 @@
1
1
  "use strict";
2
2
  var _a;
3
3
  Object.defineProperty(exports, "__esModule", { value: true });
4
- exports.resetCompanyMonthEndReportFetchStatus = exports.clearCompanyMonthEndReportView = exports.updateStatusForCompanyMonthEndReportOnSaveFailure = exports.updateCompanyMonthEndReportDataOnSaveSuccess = exports.updateStatusForSendCompanyMonthEndReport = exports.saveCompanyMonthEndReport = exports.sendCompanyMonthEndReport = exports.updateCompanyMonthEndReportViewOnFailure = exports.updateCompanyMonthEndReportViewOnSuccess = exports.fetchCompanyMonthEndReportView = exports.updateImproveUsingZeniGPTFailure = exports.updateImproveUsingZeniGPTSuccess = exports.fetchImproveUsingZeniGPT = exports.initialImproveUsingZeniGPTStatus = exports.initialSendMonthEndReportStatus = exports.initialCompanyMonthEndReportData = exports.initialState = void 0;
4
+ exports.updateCompanyMonthEndReportHistoricDataOnSuccess = exports.updateCompanyMonthEndReportHistoricDataOnFailure = exports.fetchCompanyMonthEndReportHistoricData = exports.updateCompanyMonthEndReportHistoricDatesOnSuccess = exports.updateCompanyMonthEndReportHistoricDatesOnFailure = exports.fetchCompanyMonthEndReportHistoricDates = exports.resetCompanyMonthEndReportFetchStatus = exports.clearCompanyMonthEndReportView = exports.updateStatusForCompanyMonthEndReportOnSaveFailure = exports.updateCompanyMonthEndReportDataOnSaveSuccess = exports.updateStatusForSendCompanyMonthEndReport = exports.saveCompanyMonthEndReport = exports.sendCompanyMonthEndReport = exports.updateCompanyMonthEndReportViewOnFailure = exports.updateCompanyMonthEndReportViewOnSuccess = exports.fetchCompanyMonthEndReportView = exports.updateImproveUsingZeniGPTFailure = exports.updateImproveUsingZeniGPTSuccess = exports.fetchImproveUsingZeniGPT = exports.initialImproveUsingZeniGPTStatus = exports.initialSendMonthEndReportStatus = exports.initialCompanyMonthEndReportData = exports.initialState = void 0;
5
5
  const toolkit_1 = require("@reduxjs/toolkit");
6
6
  const companyMonthEndReportViewState_1 = require("./companyMonthEndReportViewState");
7
+ const zeniDayJS_1 = require("../../zeniDayJS");
7
8
  exports.initialState = {
8
9
  monthEndReportDataByCompanyId: {},
10
+ historicData: {},
11
+ historicDatesListByCompanyId: {},
9
12
  };
10
13
  exports.initialCompanyMonthEndReportData = {
11
14
  subject: '',
@@ -182,14 +185,85 @@ const companyMonthEndReportView = (0, toolkit_1.createSlice)({
182
185
  exports.initialSendMonthEndReportStatus;
183
186
  draft.monthEndReportDataByCompanyId[companyId].previewMonthEndReportStatus = exports.initialSendMonthEndReportStatus;
184
187
  },
188
+ fetchCompanyMonthEndReportHistoricDates: {
189
+ prepare(companyId) {
190
+ return {
191
+ payload: {
192
+ companyId,
193
+ },
194
+ };
195
+ },
196
+ reducer(draft, action) {
197
+ const { companyId } = action.payload;
198
+ draft.historicDatesListByCompanyId[companyId] = {
199
+ fetchState: 'In-Progress',
200
+ error: undefined,
201
+ reportSentDates: [],
202
+ };
203
+ },
204
+ },
205
+ updateCompanyMonthEndReportHistoricDatesOnSuccess(draft, action) {
206
+ const { companyId, data } = action.payload;
207
+ draft.historicDatesListByCompanyId[companyId] = {
208
+ fetchState: 'Completed',
209
+ error: undefined,
210
+ reportSentDates: data.history_dates.map((date) => (0, zeniDayJS_1.date)(date)),
211
+ };
212
+ },
213
+ updateCompanyMonthEndReportHistoricDatesOnFailure(draft, action) {
214
+ const { companyId, error } = action.payload;
215
+ draft.historicDatesListByCompanyId[companyId] = {
216
+ fetchState: 'Error',
217
+ error: error,
218
+ reportSentDates: [],
219
+ };
220
+ },
221
+ fetchCompanyMonthEndReportHistoricData: {
222
+ prepare(companyId, reportSentDate) {
223
+ return {
224
+ payload: {
225
+ reportSentDate,
226
+ companyId,
227
+ },
228
+ };
229
+ },
230
+ reducer(draft, action) {
231
+ const { reportSentDate, companyId } = action.payload;
232
+ const key = (0, companyMonthEndReportViewState_1.getMonthEndReportHistoricDataKey)(companyId, reportSentDate);
233
+ draft.historicData[key] = {
234
+ fetchState: 'In-Progress',
235
+ error: undefined,
236
+ data: null,
237
+ };
238
+ },
239
+ },
240
+ updateCompanyMonthEndReportHistoricDataOnSuccess(draft, action) {
241
+ const { companyId, data, reportSentDate } = action.payload;
242
+ const key = (0, companyMonthEndReportViewState_1.getMonthEndReportHistoricDataKey)(companyId, reportSentDate);
243
+ draft.historicData[key] = {
244
+ fetchState: 'Completed',
245
+ error: undefined,
246
+ data: (0, companyMonthEndReportViewState_1.toMonthEndHistoricData)(data),
247
+ };
248
+ },
249
+ updateCompanyMonthEndReportHistoricDataOnFailure(draft, action) {
250
+ const { companyId, error, reportSentDate } = action.payload;
251
+ const key = (0, companyMonthEndReportViewState_1.getMonthEndReportHistoricDataKey)(companyId, reportSentDate);
252
+ draft.historicData[key] = {
253
+ fetchState: 'Error',
254
+ error: error,
255
+ data: null,
256
+ };
257
+ },
185
258
  clearCompanyMonthEndReportView(draft) {
186
259
  Object.assign(draft, exports.initialState);
187
260
  },
188
261
  },
189
262
  });
190
- _a = companyMonthEndReportView.actions, exports.fetchImproveUsingZeniGPT = _a.fetchImproveUsingZeniGPT, exports.updateImproveUsingZeniGPTSuccess = _a.updateImproveUsingZeniGPTSuccess, exports.updateImproveUsingZeniGPTFailure = _a.updateImproveUsingZeniGPTFailure, exports.fetchCompanyMonthEndReportView = _a.fetchCompanyMonthEndReportView, exports.updateCompanyMonthEndReportViewOnSuccess = _a.updateCompanyMonthEndReportViewOnSuccess, exports.updateCompanyMonthEndReportViewOnFailure = _a.updateCompanyMonthEndReportViewOnFailure, exports.sendCompanyMonthEndReport = _a.sendCompanyMonthEndReport, exports.saveCompanyMonthEndReport = _a.saveCompanyMonthEndReport, exports.updateStatusForSendCompanyMonthEndReport = _a.updateStatusForSendCompanyMonthEndReport, exports.updateCompanyMonthEndReportDataOnSaveSuccess = _a.updateCompanyMonthEndReportDataOnSaveSuccess, exports.updateStatusForCompanyMonthEndReportOnSaveFailure = _a.updateStatusForCompanyMonthEndReportOnSaveFailure, exports.clearCompanyMonthEndReportView = _a.clearCompanyMonthEndReportView, exports.resetCompanyMonthEndReportFetchStatus = _a.resetCompanyMonthEndReportFetchStatus;
263
+ _a = companyMonthEndReportView.actions, exports.fetchImproveUsingZeniGPT = _a.fetchImproveUsingZeniGPT, exports.updateImproveUsingZeniGPTSuccess = _a.updateImproveUsingZeniGPTSuccess, exports.updateImproveUsingZeniGPTFailure = _a.updateImproveUsingZeniGPTFailure, exports.fetchCompanyMonthEndReportView = _a.fetchCompanyMonthEndReportView, exports.updateCompanyMonthEndReportViewOnSuccess = _a.updateCompanyMonthEndReportViewOnSuccess, exports.updateCompanyMonthEndReportViewOnFailure = _a.updateCompanyMonthEndReportViewOnFailure, exports.sendCompanyMonthEndReport = _a.sendCompanyMonthEndReport, exports.saveCompanyMonthEndReport = _a.saveCompanyMonthEndReport, exports.updateStatusForSendCompanyMonthEndReport = _a.updateStatusForSendCompanyMonthEndReport, exports.updateCompanyMonthEndReportDataOnSaveSuccess = _a.updateCompanyMonthEndReportDataOnSaveSuccess, exports.updateStatusForCompanyMonthEndReportOnSaveFailure = _a.updateStatusForCompanyMonthEndReportOnSaveFailure, exports.clearCompanyMonthEndReportView = _a.clearCompanyMonthEndReportView, exports.resetCompanyMonthEndReportFetchStatus = _a.resetCompanyMonthEndReportFetchStatus, exports.fetchCompanyMonthEndReportHistoricDates = _a.fetchCompanyMonthEndReportHistoricDates, exports.updateCompanyMonthEndReportHistoricDatesOnFailure = _a.updateCompanyMonthEndReportHistoricDatesOnFailure, exports.updateCompanyMonthEndReportHistoricDatesOnSuccess = _a.updateCompanyMonthEndReportHistoricDatesOnSuccess, exports.fetchCompanyMonthEndReportHistoricData = _a.fetchCompanyMonthEndReportHistoricData, exports.updateCompanyMonthEndReportHistoricDataOnFailure = _a.updateCompanyMonthEndReportHistoricDataOnFailure, exports.updateCompanyMonthEndReportHistoricDataOnSuccess = _a.updateCompanyMonthEndReportHistoricDataOnSuccess;
191
264
  exports.default = companyMonthEndReportView.reducer;
192
265
  function updateMonthEndReportDataOnSaveSuccess(draft, payload) {
266
+ var _a;
193
267
  const { isPreview, companyId, data } = payload;
194
268
  const currentDataState = draft.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData;
195
269
  if (isPreview === true) {
@@ -200,5 +274,5 @@ function updateMonthEndReportDataOnSaveSuccess(draft, payload) {
200
274
  draft.monthEndReportDataByCompanyId[companyId].saveMonthEndReportStatus.fetchState = 'Completed';
201
275
  draft.monthEndReportDataByCompanyId[companyId].saveMonthEndReportStatus.error = undefined;
202
276
  }
203
- draft.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData = Object.assign(Object.assign({}, (0, companyMonthEndReportViewState_1.toCompanyMonthEndReportData)(data)), { html: currentDataState.html, concatenatedHtml: data.html != null ? data.html : undefined });
277
+ draft.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData = Object.assign(Object.assign({}, (0, companyMonthEndReportViewState_1.toCompanyMonthEndReportData)(data)), { html: currentDataState.html, concatenatedHtml: (_a = data.html) !== null && _a !== void 0 ? _a : undefined });
204
278
  }
@@ -2,7 +2,8 @@ import { FetchStateAndError, ID } from '../../commonStateTypes/common';
2
2
  import { SelectorView } from '../../commonStateTypes/viewAndReport/viewAndReport';
3
3
  import { User } from '../../entity/user/userState';
4
4
  import { RootState } from '../../reducer';
5
- import { CompanyMonthEndReportData } from './companyMonthEndReportViewState';
5
+ import { CompanyMonthEndReportData, CompanyMonthEndReportHistoricData } from './companyMonthEndReportViewState';
6
+ import { ZeniDate } from '../../zeniDayJS';
6
7
  export interface CompanyMonthEndReportSelectorView extends SelectorView, CompanyMonthEndReportData {
7
8
  reportLastSavedByUser?: User;
8
9
  sendMonthEndReportStatus: FetchStateAndError;
@@ -11,4 +12,11 @@ export interface CompanyMonthEndReportSelectorView extends SelectorView, Company
11
12
  previewMonthEndReportStatus: FetchStateAndError;
12
13
  companyName: string;
13
14
  }
15
+ export interface CompanyMonthEndReportHistoricDataSelectorView extends CompanyMonthEndReportHistoricData {
16
+ historicReportSentDates: ZeniDate[];
17
+ companyName: string;
18
+ companyId: ID;
19
+ reportLastSentByUser?: User;
20
+ }
14
21
  export declare const getCompanyMonthEndReportSelectorView: (state: RootState, companyId: ID) => CompanyMonthEndReportSelectorView;
22
+ export declare const getCompanyMonthEndReportHistoricData: (state: RootState, companyId: ID, reportSentDate: ZeniDate) => CompanyMonthEndReportHistoricDataSelectorView;
@@ -1,8 +1,10 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.getCompanyMonthEndReportSelectorView = void 0;
3
+ exports.getCompanyMonthEndReportHistoricData = exports.getCompanyMonthEndReportSelectorView = void 0;
4
4
  const toolkit_1 = require("@reduxjs/toolkit");
5
5
  const userSelector_1 = require("../../entity/user/userSelector");
6
+ const companyMonthEndReportViewState_1 = require("./companyMonthEndReportViewState");
7
+ const reduceFetchState_1 = require("../../commonStateTypes/reduceFetchState");
6
8
  exports.getCompanyMonthEndReportSelectorView = (0, toolkit_1.createSelector)([(state) => state, (_, companyId) => companyId], (rootState, companyId) => {
7
9
  var _a;
8
10
  const companyMonthEndReport = rootState.companyMonthEndReportViewState.monthEndReportDataByCompanyId[companyId];
@@ -14,3 +16,42 @@ exports.getCompanyMonthEndReportSelectorView = (0, toolkit_1.createSelector)([(s
14
16
  ? companyMonthEndReport.fetchState
15
17
  : 'Not-Started', error: companyMonthEndReport != null ? companyMonthEndReport.error : undefined });
16
18
  });
19
+ exports.getCompanyMonthEndReportHistoricData = (0, toolkit_1.createSelector)([
20
+ (state) => state,
21
+ (_, companyId) => companyId,
22
+ (_, _companyId, reportSentDate) => reportSentDate,
23
+ ], (rootState, companyId, reportSentDate) => {
24
+ var _a;
25
+ const { companyMonthEndReportViewState } = rootState;
26
+ const key = (0, companyMonthEndReportViewState_1.getMonthEndReportHistoricDataKey)(companyId, reportSentDate);
27
+ const companyName = (_a = rootState.companyState.companiesById[companyId]) === null || _a === void 0 ? void 0 : _a.companyInfo.name;
28
+ if (companyMonthEndReportViewState.historicDatesListByCompanyId[companyId] ==
29
+ null ||
30
+ companyMonthEndReportViewState.historicData[key] == null) {
31
+ return {
32
+ historicReportSentDates: [],
33
+ companyName,
34
+ companyId,
35
+ fetchState: 'Not-Started',
36
+ data: null,
37
+ };
38
+ }
39
+ const fetchState = (0, reduceFetchState_1.reduceAnyFetchState)([
40
+ companyMonthEndReportViewState.historicData[key],
41
+ companyMonthEndReportViewState.historicDatesListByCompanyId[companyId],
42
+ ]);
43
+ const historicReportSentDates = companyMonthEndReportViewState.historicDatesListByCompanyId[companyId]
44
+ .reportSentDates;
45
+ const companyMonthEndReport = companyMonthEndReportViewState.historicData[key].data;
46
+ return {
47
+ data: companyMonthEndReport,
48
+ reportLastSentByUser: (companyMonthEndReport === null || companyMonthEndReport === void 0 ? void 0 : companyMonthEndReport.draftUserId) != null
49
+ ? (0, userSelector_1.getUserByUserId)(rootState.userState, companyMonthEndReport.draftUserId)
50
+ : undefined,
51
+ companyName,
52
+ fetchState: fetchState.fetchState,
53
+ error: fetchState.error,
54
+ historicReportSentDates,
55
+ companyId,
56
+ };
57
+ });
@@ -1,19 +1,19 @@
1
1
  import { FetchStateAndError, ID } from '../../commonStateTypes/common';
2
2
  import { AttachmentFile } from '../../entity/file/fileState';
3
3
  import { ZeniDate } from '../../zeniDayJS';
4
- import { MonthEndTemplateData, CompanyMonthEndReportViewPayload } from './companyMonthEndReportViewPayload';
4
+ import { MonthEndTemplateData, CompanyMonthEndReportViewPayload, CompanyMonthEndHistoricReportPayload } from './companyMonthEndReportViewPayload';
5
5
  export interface CompanyMonthEndReportData {
6
+ recipientEmailList: string[];
6
7
  html?: string;
7
8
  subject?: string;
8
9
  attachmentFile?: AttachmentFile;
9
10
  zeniRequestsHtml?: string;
10
11
  templateData?: MonthEndTemplateData;
11
- recipientEmailList: string[];
12
12
  tenantReceiverEmailList?: string[];
13
13
  concatenatedHtml?: string;
14
14
  lastDraftSavedDate?: ZeniDate;
15
- draft_user_id?: string;
16
15
  draftUserId?: string;
16
+ reportSentDate?: ZeniDate;
17
17
  }
18
18
  export interface CompanyMonthEndReport extends FetchStateAndError {
19
19
  companyMonthEndReportData: CompanyMonthEndReportData;
@@ -22,7 +22,19 @@ export interface CompanyMonthEndReport extends FetchStateAndError {
22
22
  previewMonthEndReportStatus: FetchStateAndError;
23
23
  improveUsingZeniGPTStatus: FetchStateAndError;
24
24
  }
25
+ export declare const getMonthEndReportHistoricDataKey: (companyId: ID, reportDate: ZeniDate) => `${string}_${string}`;
26
+ export declare type CompanyMonthEndReportHistoricDataKey = ReturnType<typeof getMonthEndReportHistoricDataKey>;
27
+ interface HistoricDatesList extends FetchStateAndError {
28
+ reportSentDates: ZeniDate[];
29
+ }
30
+ export interface CompanyMonthEndReportHistoricData extends FetchStateAndError {
31
+ data: CompanyMonthEndReportData | null;
32
+ }
25
33
  export interface CompanyMonthEndReportViewState {
26
34
  monthEndReportDataByCompanyId: Record<ID, CompanyMonthEndReport>;
35
+ historicDatesListByCompanyId: Record<ID, HistoricDatesList>;
36
+ historicData: Record<CompanyMonthEndReportHistoricDataKey, CompanyMonthEndReportHistoricData>;
27
37
  }
28
38
  export declare const toCompanyMonthEndReportData: (data: CompanyMonthEndReportViewPayload) => CompanyMonthEndReportData;
39
+ export declare function toMonthEndHistoricData(data: CompanyMonthEndHistoricReportPayload): CompanyMonthEndReportData;
40
+ export {};
@@ -1,8 +1,11 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.toCompanyMonthEndReportData = void 0;
3
+ exports.toMonthEndHistoricData = exports.toCompanyMonthEndReportData = exports.getMonthEndReportHistoricDataKey = void 0;
4
+ const formatZeniDateFY_1 = require("../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
4
5
  const fileReducer_1 = require("../../entity/file/fileReducer");
5
6
  const zeniDayJS_1 = require("../../zeniDayJS");
7
+ const getMonthEndReportHistoricDataKey = (companyId, reportDate) => `${companyId}_${reportDate.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT)}`;
8
+ exports.getMonthEndReportHistoricDataKey = getMonthEndReportHistoricDataKey;
6
9
  const toCompanyMonthEndReportData = (data) => {
7
10
  var _a, _b;
8
11
  return {
@@ -22,3 +25,17 @@ const toCompanyMonthEndReportData = (data) => {
22
25
  };
23
26
  };
24
27
  exports.toCompanyMonthEndReportData = toCompanyMonthEndReportData;
28
+ function toMonthEndHistoricData(data) {
29
+ const { history: historicData } = data;
30
+ return {
31
+ recipientEmailList: historicData[0].recipient_email_list,
32
+ concatenatedHtml: historicData[0].email_history_html,
33
+ reportSentDate: (0, zeniDayJS_1.date)(historicData[0].month_end_email_send_date),
34
+ subject: historicData[0].subject,
35
+ draftUserId: historicData[0].user_id,
36
+ attachmentFile: historicData[0].files != null && historicData[0].files.length > 0
37
+ ? (0, fileReducer_1.mapAttachmentFilePayloadToFile)(historicData[0].files[0])
38
+ : undefined,
39
+ };
40
+ }
41
+ exports.toMonthEndHistoricData = toMonthEndHistoricData;
@@ -0,0 +1,8 @@
1
+ import { Observable } from 'rxjs';
2
+ import { ActionsObservable, StateObservable } from 'redux-observable';
3
+ import { ZeniAPI } from '../../../zeniAPI';
4
+ import { RootState } from '../../../reducer';
5
+ import { fetchCompanyMonthEndReportHistoricData, updateCompanyMonthEndReportHistoricDataOnSuccess, updateCompanyMonthEndReportHistoricDataOnFailure } from '../companyMonthEndReportViewReducer';
6
+ import { updateAttachmentFiles } from '../../../entity/file/fileReducer';
7
+ export declare type ActionType = ReturnType<typeof fetchCompanyMonthEndReportHistoricData> | ReturnType<typeof updateCompanyMonthEndReportHistoricDataOnSuccess> | ReturnType<typeof updateCompanyMonthEndReportHistoricDataOnFailure> | ReturnType<typeof updateAttachmentFiles>;
8
+ export declare const fetchCompanyMonthEndReportHistoricDataEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchCompanyMonthEndReportHistoricDataEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../responsePayload");
7
+ const companyMonthEndReportViewReducer_1 = require("../companyMonthEndReportViewReducer");
8
+ const formatZeniDateFY_1 = require("../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
9
+ const fileReducer_1 = require("../../../entity/file/fileReducer");
10
+ const fetchCompanyMonthEndReportHistoricDataEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyMonthEndReportViewReducer_1.fetchCompanyMonthEndReportHistoricData.match), (0, operators_1.switchMap)((action) => {
11
+ const { companyId, reportSentDate } = action.payload;
12
+ const state = state$.value;
13
+ const tenantId = state.companyState.companiesById[companyId].companyInfo.tenantId;
14
+ const queryParam = {
15
+ history: true,
16
+ month_year: reportSentDate.format(formatZeniDateFY_1.FULL_MONTH_FULL_YEAR_FORMAT),
17
+ };
18
+ if (tenantId != null) {
19
+ return zeniAPI
20
+ .getJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}/emails/month-end?query=${encodeURIComponent(JSON.stringify(queryParam))}`, {
21
+ 'zeni-tenant-id': tenantId,
22
+ })
23
+ .pipe((0, operators_1.mergeMap)((response) => {
24
+ var _a;
25
+ if ((0, responsePayload_1.isSuccessResponse)(response) &&
26
+ ((_a = response.data) === null || _a === void 0 ? void 0 : _a.history) != null &&
27
+ response.data.history.length > 0) {
28
+ const actions = [
29
+ (0, companyMonthEndReportViewReducer_1.updateCompanyMonthEndReportHistoricDataOnSuccess)({
30
+ companyId,
31
+ reportSentDate,
32
+ data: response.data,
33
+ }),
34
+ (0, fileReducer_1.updateAttachmentFiles)({
35
+ files: response.data.history[0].files,
36
+ }),
37
+ ];
38
+ return (0, rxjs_1.from)(actions);
39
+ }
40
+ else {
41
+ const actions = [
42
+ (0, companyMonthEndReportViewReducer_1.updateCompanyMonthEndReportHistoricDataOnFailure)({
43
+ companyId,
44
+ reportSentDate,
45
+ error: response.status,
46
+ }),
47
+ ];
48
+ return (0, rxjs_1.from)(actions);
49
+ }
50
+ }), (0, operators_1.catchError)((error) => {
51
+ const actions = [
52
+ (0, companyMonthEndReportViewReducer_1.updateCompanyMonthEndReportHistoricDataOnFailure)({
53
+ companyId,
54
+ reportSentDate,
55
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Company Month End Report Historic Data errored out' +
56
+ JSON.stringify(error)),
57
+ }),
58
+ ];
59
+ return (0, rxjs_1.from)(actions);
60
+ }));
61
+ }
62
+ else {
63
+ return (0, rxjs_1.from)([]);
64
+ }
65
+ }));
66
+ exports.fetchCompanyMonthEndReportHistoricDataEpic = fetchCompanyMonthEndReportHistoricDataEpic;
@@ -0,0 +1,7 @@
1
+ import { Observable } from 'rxjs';
2
+ import { ActionsObservable, StateObservable } from 'redux-observable';
3
+ import { ZeniAPI } from '../../../zeniAPI';
4
+ import { RootState } from '../../../reducer';
5
+ import { fetchCompanyMonthEndReportHistoricDates, updateCompanyMonthEndReportHistoricDatesOnSuccess, updateCompanyMonthEndReportHistoricDatesOnFailure } from '../companyMonthEndReportViewReducer';
6
+ export declare type ActionType = ReturnType<typeof fetchCompanyMonthEndReportHistoricDates> | ReturnType<typeof updateCompanyMonthEndReportHistoricDatesOnSuccess> | ReturnType<typeof updateCompanyMonthEndReportHistoricDatesOnFailure>;
7
+ export declare const fetchCompanyMonthEndReportHistoricDatesEpic: (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.fetchCompanyMonthEndReportHistoricDatesEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../responsePayload");
7
+ const companyMonthEndReportViewReducer_1 = require("../companyMonthEndReportViewReducer");
8
+ const fetchCompanyMonthEndReportHistoricDatesEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyMonthEndReportViewReducer_1.fetchCompanyMonthEndReportHistoricDates.match), (0, operators_1.switchMap)((action) => {
9
+ const { companyId } = action.payload;
10
+ const state = state$.value;
11
+ const tenantId = state.companyState.companiesById[companyId].companyInfo.tenantId;
12
+ const queryParam = {
13
+ history_dates: true,
14
+ };
15
+ if (tenantId != null) {
16
+ return zeniAPI
17
+ .getJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}/emails/month-end?query=${encodeURIComponent(JSON.stringify(queryParam))}`, {
18
+ 'zeni-tenant-id': tenantId,
19
+ })
20
+ .pipe((0, operators_1.mergeMap)((response) => {
21
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
22
+ const actions = [
23
+ (0, companyMonthEndReportViewReducer_1.updateCompanyMonthEndReportHistoricDatesOnSuccess)({
24
+ companyId,
25
+ data: response.data,
26
+ }),
27
+ ];
28
+ return (0, rxjs_1.from)(actions);
29
+ }
30
+ else {
31
+ const actions = [
32
+ (0, companyMonthEndReportViewReducer_1.updateCompanyMonthEndReportHistoricDatesOnFailure)({
33
+ companyId,
34
+ error: response.status,
35
+ }),
36
+ ];
37
+ return (0, rxjs_1.from)(actions);
38
+ }
39
+ }), (0, operators_1.catchError)((error) => {
40
+ const actions = [
41
+ (0, companyMonthEndReportViewReducer_1.updateCompanyMonthEndReportHistoricDatesOnFailure)({
42
+ companyId,
43
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected error', 'Company Month End Report Historic Dates errored out' +
44
+ JSON.stringify(error)),
45
+ }),
46
+ ];
47
+ return (0, rxjs_1.from)(actions);
48
+ }));
49
+ }
50
+ else {
51
+ return (0, rxjs_1.from)([]);
52
+ }
53
+ }));
54
+ exports.fetchCompanyMonthEndReportHistoricDatesEpic = fetchCompanyMonthEndReportHistoricDatesEpic;
@@ -1,8 +1,8 @@
1
1
  import { Observable } from 'rxjs';
2
2
  import { ActionsObservable, StateObservable } from 'redux-observable';
3
- import { ZeniAPI } from '../../zeniAPI';
4
- import { RootState } from '../../reducer';
5
- import { fetchCompanyMonthEndReportView, updateCompanyMonthEndReportViewOnFailure, updateCompanyMonthEndReportViewOnSuccess } from './companyMonthEndReportViewReducer';
6
- import { updateAttachmentFiles } from '../../entity/file/fileReducer';
3
+ import { ZeniAPI } from '../../../zeniAPI';
4
+ import { RootState } from '../../../reducer';
5
+ import { fetchCompanyMonthEndReportView, updateCompanyMonthEndReportViewOnFailure, updateCompanyMonthEndReportViewOnSuccess } from '../companyMonthEndReportViewReducer';
6
+ import { updateAttachmentFiles } from '../../../entity/file/fileReducer';
7
7
  export declare type ActionType = ReturnType<typeof fetchCompanyMonthEndReportView> | ReturnType<typeof updateCompanyMonthEndReportViewOnSuccess> | ReturnType<typeof updateCompanyMonthEndReportViewOnFailure> | ReturnType<typeof updateAttachmentFiles>;
8
8
  export declare const fetchCompanyMonthEndReportViewEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -3,8 +3,9 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.fetchCompanyMonthEndReportViewEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
- const responsePayload_1 = require("../../responsePayload");
7
- const companyMonthEndReportViewReducer_1 = require("./companyMonthEndReportViewReducer");
6
+ const responsePayload_1 = require("../../../responsePayload");
7
+ const companyMonthEndReportViewReducer_1 = require("../companyMonthEndReportViewReducer");
8
+ const fileReducer_1 = require("../../../entity/file/fileReducer");
8
9
  const fetchCompanyMonthEndReportViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyMonthEndReportViewReducer_1.fetchCompanyMonthEndReportView.match), (0, operators_1.switchMap)((action) => {
9
10
  const { cacheOverride, companyId } = action.payload;
10
11
  const state = state$.value;
@@ -20,6 +21,7 @@ const fetchCompanyMonthEndReportViewEpic = (actions$, state$, zeniAPI) => action
20
21
  if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
21
22
  const actions = [
22
23
  (0, companyMonthEndReportViewReducer_1.updateCompanyMonthEndReportViewOnSuccess)(companyId, response.data),
24
+ (0, fileReducer_1.updateAttachmentFiles)({ files: response.data.files }),
23
25
  ];
24
26
  return (0, rxjs_1.from)(actions);
25
27
  }
@@ -1,7 +1,7 @@
1
1
  import { ActionsObservable, StateObservable } from 'redux-observable';
2
2
  import { Observable } from 'rxjs';
3
- import { RootState } from '../../reducer';
4
- import { ZeniAPI } from '../../zeniAPI';
5
- import { fetchImproveUsingZeniGPT, updateImproveUsingZeniGPTSuccess, updateImproveUsingZeniGPTFailure } from './companyMonthEndReportViewReducer';
3
+ import { RootState } from '../../../reducer';
4
+ import { ZeniAPI } from '../../../zeniAPI';
5
+ import { fetchImproveUsingZeniGPT, updateImproveUsingZeniGPTSuccess, updateImproveUsingZeniGPTFailure } from '../companyMonthEndReportViewReducer';
6
6
  export declare type ActionType = ReturnType<typeof fetchImproveUsingZeniGPT> | ReturnType<typeof updateImproveUsingZeniGPTSuccess> | ReturnType<typeof updateImproveUsingZeniGPTFailure>;
7
7
  export declare const improveUsingZeniGPTEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -3,8 +3,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.improveUsingZeniGPTEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
- const companyMonthEndReportViewReducer_1 = require("./companyMonthEndReportViewReducer");
7
- const responsePayload_1 = require("../../responsePayload");
6
+ const companyMonthEndReportViewReducer_1 = require("../companyMonthEndReportViewReducer");
7
+ const responsePayload_1 = require("../../../responsePayload");
8
8
  const improveUsingZeniGPTEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyMonthEndReportViewReducer_1.fetchImproveUsingZeniGPT.match), (0, operators_1.switchMap)((action) => {
9
9
  const { companyId } = action.payload;
10
10
  const state = state$.value;
@@ -1,9 +1,9 @@
1
1
  import { ActionsObservable, StateObservable } from 'redux-observable';
2
2
  import { Observable } from 'rxjs';
3
- import { RootState } from '../../reducer';
4
- import { ZeniAPI } from '../../zeniAPI';
5
- import { saveCompanyMonthEndReport, updateCompanyMonthEndReportDataOnSaveSuccess, updateStatusForCompanyMonthEndReportOnSaveFailure } from './companyMonthEndReportViewReducer';
6
- import { openSnackbar } from '../../entity/snackbar/snackbarReducer';
7
- import { toggleCompanyMonthEndReportDraftFlag } from '../../entity/company/companyReducer';
3
+ import { RootState } from '../../../reducer';
4
+ import { ZeniAPI } from '../../../zeniAPI';
5
+ import { saveCompanyMonthEndReport, updateCompanyMonthEndReportDataOnSaveSuccess, updateStatusForCompanyMonthEndReportOnSaveFailure } from '../companyMonthEndReportViewReducer';
6
+ import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
7
+ import { toggleCompanyMonthEndReportDraftFlag } from '../../../entity/company/companyReducer';
8
8
  export declare type ActionType = ReturnType<typeof saveCompanyMonthEndReport> | ReturnType<typeof updateStatusForCompanyMonthEndReportOnSaveFailure> | ReturnType<typeof toggleCompanyMonthEndReportDraftFlag> | ReturnType<typeof openSnackbar> | ReturnType<typeof updateCompanyMonthEndReportDataOnSaveSuccess>;
9
9
  export declare const saveCompanyMonthEndReportEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.saveCompanyMonthEndReportEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
- const companyMonthEndReportViewReducer_1 = require("./companyMonthEndReportViewReducer");
7
- const responsePayload_1 = require("../../responsePayload");
8
- const zeniDayJS_1 = require("../../zeniDayJS");
9
- const snackbarReducer_1 = require("../../entity/snackbar/snackbarReducer");
10
- const companyReducer_1 = require("../../entity/company/companyReducer");
11
- const fileSelector_1 = require("../../entity/file/fileSelector");
6
+ const companyMonthEndReportViewReducer_1 = require("../companyMonthEndReportViewReducer");
7
+ const responsePayload_1 = require("../../../responsePayload");
8
+ const zeniDayJS_1 = require("../../../zeniDayJS");
9
+ const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
10
+ const companyReducer_1 = require("../../../entity/company/companyReducer");
11
+ const fileSelector_1 = require("../../../entity/file/fileSelector");
12
+ const formatZeniDateFY_1 = require("../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
12
13
  const saveCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyMonthEndReportViewReducer_1.saveCompanyMonthEndReport.match), (0, operators_1.mergeMap)((action) => {
13
14
  const { companyId, recipientEmailList, subject, isPreview, fileId, zeniRequestsHtml, } = action.payload;
14
15
  const state = state$.value;
@@ -33,8 +34,9 @@ const saveCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pi
33
34
  recipient_email_list: recipientEmailList,
34
35
  tenant_receiver_email_list: state.companyMonthEndReportViewState.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData.tenantReceiverEmailList,
35
36
  last_report_sent_business_day: lastReportSentBusinessDay,
36
- last_report_sent_date: lastReportSentDate.format('YYYY-MM-DD'),
37
+ last_report_sent_date: lastReportSentDate.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT),
37
38
  zeni_requests_html: zeniRequestsHtml,
39
+ files: filePayload,
38
40
  };
39
41
  const query = { is_preview: isPreview };
40
42
  return zeniAPI
@@ -1,9 +1,9 @@
1
1
  import { ActionsObservable, StateObservable } from 'redux-observable';
2
2
  import { Observable } from 'rxjs';
3
- import { RootState } from '../../reducer';
4
- import { ZeniAPI } from '../../zeniAPI';
5
- import { sendCompanyMonthEndReport, updateStatusForSendCompanyMonthEndReport } from './companyMonthEndReportViewReducer';
6
- import { toggleCompanyMonthEndReportDraftFlag, updateCompanyMonthEndReportSentDate } from '../../entity/company/companyReducer';
7
- import { openSnackbar } from '../../entity/snackbar/snackbarReducer';
3
+ import { RootState } from '../../../reducer';
4
+ import { ZeniAPI } from '../../../zeniAPI';
5
+ import { sendCompanyMonthEndReport, updateStatusForSendCompanyMonthEndReport } from '../companyMonthEndReportViewReducer';
6
+ import { toggleCompanyMonthEndReportDraftFlag, updateCompanyMonthEndReportSentDate } from '../../../entity/company/companyReducer';
7
+ import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
8
8
  export declare type ActionType = ReturnType<typeof sendCompanyMonthEndReport> | ReturnType<typeof updateCompanyMonthEndReportSentDate> | ReturnType<typeof updateStatusForSendCompanyMonthEndReport> | ReturnType<typeof toggleCompanyMonthEndReportDraftFlag> | ReturnType<typeof openSnackbar>;
9
9
  export declare const sendCompanyMonthEndReportEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -3,12 +3,13 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.sendCompanyMonthEndReportEpic = void 0;
4
4
  const rxjs_1 = require("rxjs");
5
5
  const operators_1 = require("rxjs/operators");
6
- const companyMonthEndReportViewReducer_1 = require("./companyMonthEndReportViewReducer");
7
- const responsePayload_1 = require("../../responsePayload");
8
- const zeniDayJS_1 = require("../../zeniDayJS");
9
- const companyReducer_1 = require("../../entity/company/companyReducer");
10
- const snackbarReducer_1 = require("../../entity/snackbar/snackbarReducer");
11
- const fileSelector_1 = require("../../entity/file/fileSelector");
6
+ const companyMonthEndReportViewReducer_1 = require("../companyMonthEndReportViewReducer");
7
+ const responsePayload_1 = require("../../../responsePayload");
8
+ const zeniDayJS_1 = require("../../../zeniDayJS");
9
+ const companyReducer_1 = require("../../../entity/company/companyReducer");
10
+ const snackbarReducer_1 = require("../../../entity/snackbar/snackbarReducer");
11
+ const fileSelector_1 = require("../../../entity/file/fileSelector");
12
+ const formatZeniDateFY_1 = require("../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
12
13
  const sendCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyMonthEndReportViewReducer_1.sendCompanyMonthEndReport.match), (0, operators_1.mergeMap)((action) => {
13
14
  const { companyId, fileId } = action.payload;
14
15
  const state = state$.value;
@@ -36,8 +37,9 @@ const sendCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pi
36
37
  recipient_email_list: recipientEmailList,
37
38
  tenant_receiver_email_list: state.companyMonthEndReportViewState.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData.tenantReceiverEmailList,
38
39
  last_report_sent_business_day: lastReportSentBusinessDay,
39
- last_report_sent_date: lastReportSentDate.format('YYYY-MM-DD'),
40
+ last_report_sent_date: lastReportSentDate.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT),
40
41
  zeni_requests_html: zeniRequestsHtml,
42
+ files: filePayload,
41
43
  };
42
44
  return zeniAPI
43
45
  .postAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}/emails/month-end`, payload, {
@@ -0,0 +1,10 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { RootState } from '../../reducer';
4
+ import { ZeniAPI } from '../../zeniAPI';
5
+ import { EntityType } from '../../entity/genericEntity/entity';
6
+ import { fetchEntityRecommendationsByTransactionId, updateRecommendationForEntity, updateRecommendationForEntityFailure } from './recommendationReducer';
7
+ import { setEntityRecommendationForLineIdsForTransactionDetail } from '../transactionDetail/transactionDetailReducer';
8
+ export declare type ActionType = ReturnType<typeof updateRecommendationForEntity> | ReturnType<typeof fetchEntityRecommendationsByTransactionId> | ReturnType<typeof updateRecommendationForEntityFailure> | ReturnType<typeof setEntityRecommendationForLineIdsForTransactionDetail>;
9
+ export declare const fetchEntityRecommendationsByTransactionIdEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
10
+ export declare const toEntityTypeURL: (entityType: EntityType) => string;