@zeniai/client-epic-state 4.9.6 → 4.9.8
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.
- package/lib/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.d.ts +0 -1
- package/lib/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.js +1 -2
- package/lib/entity/userRole/userRoleType.d.ts +1 -0
- package/lib/entity/userRole/userRoleType.js +8 -1
- package/lib/epic.d.ts +6 -8
- package/lib/epic.js +6 -8
- package/lib/index.d.ts +11 -10
- package/lib/index.js +20 -22
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewPayload.d.ts +0 -16
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.d.ts +1 -21
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewReducer.js +3 -77
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewSelector.d.ts +1 -9
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewSelector.js +1 -42
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.d.ts +3 -15
- package/lib/view/companyMonthEndReportView/companyMonthEndReportViewState.js +1 -18
- package/lib/view/companyMonthEndReportView/{epics/fetchCompanyMonthEndReportViewEpic.d.ts → fetchCompanyMonthEndReportViewEpic.d.ts} +4 -4
- package/lib/view/companyMonthEndReportView/{epics/fetchCompanyMonthEndReportViewEpic.js → fetchCompanyMonthEndReportViewEpic.js} +2 -4
- package/lib/view/companyMonthEndReportView/{epics/improveUsingZeniGPTEpic.d.ts → improveUsingZeniGPTEpic.d.ts} +3 -3
- package/lib/view/companyMonthEndReportView/{epics/improveUsingZeniGPTEpic.js → improveUsingZeniGPTEpic.js} +2 -2
- package/lib/view/companyMonthEndReportView/{epics/saveCompanyMonthEndReportEpic.d.ts → saveCompanyMonthEndReportEpic.d.ts} +5 -5
- package/lib/view/companyMonthEndReportView/{epics/saveCompanyMonthEndReportEpic.js → saveCompanyMonthEndReportEpic.js} +7 -9
- package/lib/view/companyMonthEndReportView/{epics/sendCompanyMonthEndReportEpic.d.ts → sendCompanyMonthEndReportEpic.d.ts} +5 -5
- package/lib/view/companyMonthEndReportView/{epics/sendCompanyMonthEndReportEpic.js → sendCompanyMonthEndReportEpic.js} +7 -9
- package/lib/view/recommendation/fetchRecommendationByEntityIdEpic.js +2 -2
- package/lib/view/recommendation/fetchRecommendationByEntityQboIdEpic.d.ts +10 -0
- package/lib/view/recommendation/{fetchEntityRecommendationsByTransactionIdEpic.js → fetchRecommendationByEntityQboIdEpic.js} +6 -13
- package/lib/view/recommendation/recommendationHelper.d.ts +0 -3
- package/lib/view/recommendation/recommendationHelper.js +21 -37
- package/lib/view/recommendation/recommendationReducer.d.ts +1 -1
- package/lib/view/recommendation/recommendationReducer.js +3 -3
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.d.ts +0 -1
- package/lib/view/spendManagement/reimbursement/editRemiView/editRemiViewSelector.js +13 -17
- package/lib/view/spendManagement/reimbursement/reimbursementConfig/reimbursementConfigState.d.ts +0 -1
- package/lib/view/spendManagement/reimbursement/reimbursementConfig/reimbursementConfigState.js +1 -2
- package/lib/view/spendManagement/reimbursement/remiDetailView/epics/fetchRemiDetailEpic.d.ts +1 -2
- package/lib/view/spendManagement/reimbursement/remiDetailView/epics/fetchRemiDetailEpic.js +2 -8
- package/lib/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.d.ts +1 -2
- package/lib/view/spendManagement/reimbursement/remiDetailView/remiDetailViewSelector.js +14 -23
- package/lib/view/transactionDetail/transactionDetailLocalDataHelper.d.ts +1 -2
- package/lib/view/transactionDetail/transactionDetailLocalDataHelper.js +2 -3
- package/lib/view/transactionDetail/transactionDetailReducer.d.ts +3 -3
- package/lib/view/transactionDetail/transactionDetailReducer.js +4 -4
- package/lib/view/transactionDetail/transactionDetailState.d.ts +0 -7
- package/lib/view/transactionDetail/transactionDetailState.js +3 -4
- package/package.json +1 -1
- package/lib/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportHistoricDataEpic.d.ts +0 -8
- package/lib/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportHistoricDataEpic.js +0 -66
- package/lib/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportHistoricDatesEpic.d.ts +0 -7
- package/lib/view/companyMonthEndReportView/epics/fetchCompanyMonthEndReportHistoricDatesEpic.js +0 -54
- package/lib/view/recommendation/fetchEntityRecommendationsByTransactionIdEpic.d.ts +0 -10
|
@@ -12,26 +12,10 @@ export interface CompanyMonthEndReportViewPayload {
|
|
|
12
12
|
last_month_end_email_draft_saved_at?: string;
|
|
13
13
|
draft_user_id?: string;
|
|
14
14
|
}
|
|
15
|
-
export interface MonthEndHistoricReportPayload {
|
|
16
|
-
email_history_html: string;
|
|
17
|
-
recipient_email_list: string[];
|
|
18
|
-
subject: string;
|
|
19
|
-
user_id: string;
|
|
20
|
-
month_end_email_send_date: string;
|
|
21
|
-
files: AttachmentFilePayload[];
|
|
22
|
-
}
|
|
23
|
-
export interface CompanyMonthEndHistoricReportPayload {
|
|
24
|
-
history: MonthEndHistoricReportPayload[];
|
|
25
|
-
}
|
|
26
15
|
export interface ImproveUsingZeniGPTPayload {
|
|
27
16
|
text: string;
|
|
28
17
|
}
|
|
29
|
-
export interface CompanyMonthEndReportHistoricDatesPayload {
|
|
30
|
-
history_dates: string[];
|
|
31
|
-
}
|
|
32
18
|
export declare type CompanyMonthEndReportViewResponse = ZeniAPIResponse<CompanyMonthEndReportViewPayload>;
|
|
33
19
|
export declare type SendCompanyMonthEndReportResponse = ZeniAPIResponse<CompanyMonthEndReportViewPayload>;
|
|
34
20
|
export declare type SaveCompanyMonthEndReportResponse = ZeniAPIResponse<CompanyMonthEndReportViewPayload>;
|
|
35
21
|
export declare type ImproveUsingZeniGPTResponse = ZeniAPIResponse<ImproveUsingZeniGPTPayload>;
|
|
36
|
-
export declare type CompanyMonthEndReportHistoricDatesResponse = ZeniAPIResponse<CompanyMonthEndReportHistoricDatesPayload>;
|
|
37
|
-
export declare type CompanyMonthEndHistoricReportResponse = ZeniAPIResponse<CompanyMonthEndHistoricReportPayload>;
|
|
@@ -1,8 +1,7 @@
|
|
|
1
1
|
import { FetchState, FetchStateAndError, ID } from '../../commonStateTypes/common';
|
|
2
2
|
import { ZeniAPIStatus } from '../../responsePayload';
|
|
3
|
-
import { CompanyMonthEndReportViewPayload
|
|
3
|
+
import { CompanyMonthEndReportViewPayload } from './companyMonthEndReportViewPayload';
|
|
4
4
|
import { CompanyMonthEndReportViewState, CompanyMonthEndReportData } from './companyMonthEndReportViewState';
|
|
5
|
-
import { ZeniDate } from '../../zeniDayJS';
|
|
6
5
|
export declare const initialState: CompanyMonthEndReportViewState;
|
|
7
6
|
export declare const initialCompanyMonthEndReportData: CompanyMonthEndReportData;
|
|
8
7
|
export declare const initialSendMonthEndReportStatus: FetchStateAndError;
|
|
@@ -50,25 +49,6 @@ export declare const fetchImproveUsingZeniGPT: import("@reduxjs/toolkit").Action
|
|
|
50
49
|
isPreview: boolean;
|
|
51
50
|
}, string, never, never>, clearCompanyMonthEndReportView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, resetCompanyMonthEndReportFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
|
|
52
51
|
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;
|
|
72
52
|
}, string>;
|
|
73
53
|
declare const _default: import("@reduxjs/toolkit").Reducer<CompanyMonthEndReportViewState, import("@reduxjs/toolkit").AnyAction>;
|
|
74
54
|
export default _default;
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
var _a;
|
|
3
3
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
4
|
-
exports.
|
|
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;
|
|
5
5
|
const toolkit_1 = require("@reduxjs/toolkit");
|
|
6
6
|
const companyMonthEndReportViewState_1 = require("./companyMonthEndReportViewState");
|
|
7
|
-
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
8
7
|
exports.initialState = {
|
|
9
8
|
monthEndReportDataByCompanyId: {},
|
|
10
|
-
historicData: {},
|
|
11
|
-
historicDatesListByCompanyId: {},
|
|
12
9
|
};
|
|
13
10
|
exports.initialCompanyMonthEndReportData = {
|
|
14
11
|
subject: '',
|
|
@@ -185,85 +182,14 @@ const companyMonthEndReportView = (0, toolkit_1.createSlice)({
|
|
|
185
182
|
exports.initialSendMonthEndReportStatus;
|
|
186
183
|
draft.monthEndReportDataByCompanyId[companyId].previewMonthEndReportStatus = exports.initialSendMonthEndReportStatus;
|
|
187
184
|
},
|
|
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
|
-
},
|
|
258
185
|
clearCompanyMonthEndReportView(draft) {
|
|
259
186
|
Object.assign(draft, exports.initialState);
|
|
260
187
|
},
|
|
261
188
|
},
|
|
262
189
|
});
|
|
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
|
|
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;
|
|
264
191
|
exports.default = companyMonthEndReportView.reducer;
|
|
265
192
|
function updateMonthEndReportDataOnSaveSuccess(draft, payload) {
|
|
266
|
-
var _a;
|
|
267
193
|
const { isPreview, companyId, data } = payload;
|
|
268
194
|
const currentDataState = draft.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData;
|
|
269
195
|
if (isPreview === true) {
|
|
@@ -274,5 +200,5 @@ function updateMonthEndReportDataOnSaveSuccess(draft, payload) {
|
|
|
274
200
|
draft.monthEndReportDataByCompanyId[companyId].saveMonthEndReportStatus.fetchState = 'Completed';
|
|
275
201
|
draft.monthEndReportDataByCompanyId[companyId].saveMonthEndReportStatus.error = undefined;
|
|
276
202
|
}
|
|
277
|
-
draft.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData = Object.assign(Object.assign({}, (0, companyMonthEndReportViewState_1.toCompanyMonthEndReportData)(data)), { html: currentDataState.html, concatenatedHtml:
|
|
203
|
+
draft.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData = Object.assign(Object.assign({}, (0, companyMonthEndReportViewState_1.toCompanyMonthEndReportData)(data)), { html: currentDataState.html, concatenatedHtml: data.html != null ? data.html : undefined });
|
|
278
204
|
}
|
|
@@ -2,8 +2,7 @@ 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
|
|
6
|
-
import { ZeniDate } from '../../zeniDayJS';
|
|
5
|
+
import { CompanyMonthEndReportData } from './companyMonthEndReportViewState';
|
|
7
6
|
export interface CompanyMonthEndReportSelectorView extends SelectorView, CompanyMonthEndReportData {
|
|
8
7
|
reportLastSavedByUser?: User;
|
|
9
8
|
sendMonthEndReportStatus: FetchStateAndError;
|
|
@@ -12,11 +11,4 @@ export interface CompanyMonthEndReportSelectorView extends SelectorView, Company
|
|
|
12
11
|
previewMonthEndReportStatus: FetchStateAndError;
|
|
13
12
|
companyName: string;
|
|
14
13
|
}
|
|
15
|
-
export interface CompanyMonthEndReportHistoricDataSelectorView extends CompanyMonthEndReportHistoricData {
|
|
16
|
-
historicReportSentDates: ZeniDate[];
|
|
17
|
-
companyName: string;
|
|
18
|
-
companyId: ID;
|
|
19
|
-
reportLastSentByUser?: User;
|
|
20
|
-
}
|
|
21
14
|
export declare const getCompanyMonthEndReportSelectorView: (state: RootState, companyId: ID) => CompanyMonthEndReportSelectorView;
|
|
22
|
-
export declare const getCompanyMonthEndReportHistoricData: (state: RootState, companyId: ID, reportSentDate: ZeniDate) => CompanyMonthEndReportHistoricDataSelectorView;
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
3
|
+
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");
|
|
8
6
|
exports.getCompanyMonthEndReportSelectorView = (0, toolkit_1.createSelector)([(state) => state, (_, companyId) => companyId], (rootState, companyId) => {
|
|
9
7
|
var _a;
|
|
10
8
|
const companyMonthEndReport = rootState.companyMonthEndReportViewState.monthEndReportDataByCompanyId[companyId];
|
|
@@ -16,42 +14,3 @@ exports.getCompanyMonthEndReportSelectorView = (0, toolkit_1.createSelector)([(s
|
|
|
16
14
|
? companyMonthEndReport.fetchState
|
|
17
15
|
: 'Not-Started', error: companyMonthEndReport != null ? companyMonthEndReport.error : undefined });
|
|
18
16
|
});
|
|
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
|
|
4
|
+
import { MonthEndTemplateData, CompanyMonthEndReportViewPayload } from './companyMonthEndReportViewPayload';
|
|
5
5
|
export interface CompanyMonthEndReportData {
|
|
6
|
-
recipientEmailList: string[];
|
|
7
6
|
html?: string;
|
|
8
7
|
subject?: string;
|
|
9
8
|
attachmentFile?: AttachmentFile;
|
|
10
9
|
zeniRequestsHtml?: string;
|
|
11
10
|
templateData?: MonthEndTemplateData;
|
|
11
|
+
recipientEmailList: string[];
|
|
12
12
|
tenantReceiverEmailList?: string[];
|
|
13
13
|
concatenatedHtml?: string;
|
|
14
14
|
lastDraftSavedDate?: ZeniDate;
|
|
15
|
+
draft_user_id?: string;
|
|
15
16
|
draftUserId?: string;
|
|
16
|
-
reportSentDate?: ZeniDate;
|
|
17
17
|
}
|
|
18
18
|
export interface CompanyMonthEndReport extends FetchStateAndError {
|
|
19
19
|
companyMonthEndReportData: CompanyMonthEndReportData;
|
|
@@ -22,19 +22,7 @@ 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
|
-
}
|
|
33
25
|
export interface CompanyMonthEndReportViewState {
|
|
34
26
|
monthEndReportDataByCompanyId: Record<ID, CompanyMonthEndReport>;
|
|
35
|
-
historicDatesListByCompanyId: Record<ID, HistoricDatesList>;
|
|
36
|
-
historicData: Record<CompanyMonthEndReportHistoricDataKey, CompanyMonthEndReportHistoricData>;
|
|
37
27
|
}
|
|
38
28
|
export declare const toCompanyMonthEndReportData: (data: CompanyMonthEndReportViewPayload) => CompanyMonthEndReportData;
|
|
39
|
-
export declare function toMonthEndHistoricData(data: CompanyMonthEndHistoricReportPayload): CompanyMonthEndReportData;
|
|
40
|
-
export {};
|
|
@@ -1,11 +1,8 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
4
|
-
const formatZeniDateFY_1 = require("../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
|
|
3
|
+
exports.toCompanyMonthEndReportData = void 0;
|
|
5
4
|
const fileReducer_1 = require("../../entity/file/fileReducer");
|
|
6
5
|
const zeniDayJS_1 = require("../../zeniDayJS");
|
|
7
|
-
const getMonthEndReportHistoricDataKey = (companyId, reportDate) => `${companyId}_${reportDate.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT)}`;
|
|
8
|
-
exports.getMonthEndReportHistoricDataKey = getMonthEndReportHistoricDataKey;
|
|
9
6
|
const toCompanyMonthEndReportData = (data) => {
|
|
10
7
|
var _a, _b;
|
|
11
8
|
return {
|
|
@@ -25,17 +22,3 @@ const toCompanyMonthEndReportData = (data) => {
|
|
|
25
22
|
};
|
|
26
23
|
};
|
|
27
24
|
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;
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
import { Observable } from 'rxjs';
|
|
2
2
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
3
|
-
import { ZeniAPI } from '
|
|
4
|
-
import { RootState } from '
|
|
5
|
-
import { fetchCompanyMonthEndReportView, updateCompanyMonthEndReportViewOnFailure, updateCompanyMonthEndReportViewOnSuccess } from '
|
|
6
|
-
import { updateAttachmentFiles } from '
|
|
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,9 +3,8 @@ 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("
|
|
7
|
-
const companyMonthEndReportViewReducer_1 = require("
|
|
8
|
-
const fileReducer_1 = require("../../../entity/file/fileReducer");
|
|
6
|
+
const responsePayload_1 = require("../../responsePayload");
|
|
7
|
+
const companyMonthEndReportViewReducer_1 = require("./companyMonthEndReportViewReducer");
|
|
9
8
|
const fetchCompanyMonthEndReportViewEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyMonthEndReportViewReducer_1.fetchCompanyMonthEndReportView.match), (0, operators_1.switchMap)((action) => {
|
|
10
9
|
const { cacheOverride, companyId } = action.payload;
|
|
11
10
|
const state = state$.value;
|
|
@@ -21,7 +20,6 @@ const fetchCompanyMonthEndReportViewEpic = (actions$, state$, zeniAPI) => action
|
|
|
21
20
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
22
21
|
const actions = [
|
|
23
22
|
(0, companyMonthEndReportViewReducer_1.updateCompanyMonthEndReportViewOnSuccess)(companyId, response.data),
|
|
24
|
-
(0, fileReducer_1.updateAttachmentFiles)({ files: response.data.files }),
|
|
25
23
|
];
|
|
26
24
|
return (0, rxjs_1.from)(actions);
|
|
27
25
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '
|
|
4
|
-
import { ZeniAPI } from '
|
|
5
|
-
import { fetchImproveUsingZeniGPT, updateImproveUsingZeniGPTSuccess, updateImproveUsingZeniGPTFailure } from '
|
|
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("
|
|
7
|
-
const responsePayload_1 = require("
|
|
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 '
|
|
4
|
-
import { ZeniAPI } from '
|
|
5
|
-
import { saveCompanyMonthEndReport, updateCompanyMonthEndReportDataOnSaveSuccess, updateStatusForCompanyMonthEndReportOnSaveFailure } from '
|
|
6
|
-
import { openSnackbar } from '
|
|
7
|
-
import { toggleCompanyMonthEndReportDraftFlag } from '
|
|
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,13 +3,12 @@ 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("
|
|
7
|
-
const responsePayload_1 = require("
|
|
8
|
-
const zeniDayJS_1 = require("
|
|
9
|
-
const snackbarReducer_1 = require("
|
|
10
|
-
const companyReducer_1 = require("
|
|
11
|
-
const fileSelector_1 = require("
|
|
12
|
-
const formatZeniDateFY_1 = require("../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
|
|
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");
|
|
13
12
|
const saveCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyMonthEndReportViewReducer_1.saveCompanyMonthEndReport.match), (0, operators_1.mergeMap)((action) => {
|
|
14
13
|
const { companyId, recipientEmailList, subject, isPreview, fileId, zeniRequestsHtml, } = action.payload;
|
|
15
14
|
const state = state$.value;
|
|
@@ -34,9 +33,8 @@ const saveCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pi
|
|
|
34
33
|
recipient_email_list: recipientEmailList,
|
|
35
34
|
tenant_receiver_email_list: state.companyMonthEndReportViewState.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData.tenantReceiverEmailList,
|
|
36
35
|
last_report_sent_business_day: lastReportSentBusinessDay,
|
|
37
|
-
last_report_sent_date: lastReportSentDate.format(
|
|
36
|
+
last_report_sent_date: lastReportSentDate.format('YYYY-MM-DD'),
|
|
38
37
|
zeni_requests_html: zeniRequestsHtml,
|
|
39
|
-
files: filePayload,
|
|
40
38
|
};
|
|
41
39
|
const query = { is_preview: isPreview };
|
|
42
40
|
return zeniAPI
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
2
|
import { Observable } from 'rxjs';
|
|
3
|
-
import { RootState } from '
|
|
4
|
-
import { ZeniAPI } from '
|
|
5
|
-
import { sendCompanyMonthEndReport, updateStatusForSendCompanyMonthEndReport } from '
|
|
6
|
-
import { toggleCompanyMonthEndReportDraftFlag, updateCompanyMonthEndReportSentDate } from '
|
|
7
|
-
import { openSnackbar } from '
|
|
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,13 +3,12 @@ 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("
|
|
7
|
-
const responsePayload_1 = require("
|
|
8
|
-
const zeniDayJS_1 = require("
|
|
9
|
-
const companyReducer_1 = require("
|
|
10
|
-
const snackbarReducer_1 = require("
|
|
11
|
-
const fileSelector_1 = require("
|
|
12
|
-
const formatZeniDateFY_1 = require("../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
|
|
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");
|
|
13
12
|
const sendCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(companyMonthEndReportViewReducer_1.sendCompanyMonthEndReport.match), (0, operators_1.mergeMap)((action) => {
|
|
14
13
|
const { companyId, fileId } = action.payload;
|
|
15
14
|
const state = state$.value;
|
|
@@ -37,9 +36,8 @@ const sendCompanyMonthEndReportEpic = (actions$, state$, zeniAPI) => actions$.pi
|
|
|
37
36
|
recipient_email_list: recipientEmailList,
|
|
38
37
|
tenant_receiver_email_list: state.companyMonthEndReportViewState.monthEndReportDataByCompanyId[companyId].companyMonthEndReportData.tenantReceiverEmailList,
|
|
39
38
|
last_report_sent_business_day: lastReportSentBusinessDay,
|
|
40
|
-
last_report_sent_date: lastReportSentDate.format(
|
|
39
|
+
last_report_sent_date: lastReportSentDate.format('YYYY-MM-DD'),
|
|
41
40
|
zeni_requests_html: zeniRequestsHtml,
|
|
42
|
-
files: filePayload,
|
|
43
41
|
};
|
|
44
42
|
return zeniAPI
|
|
45
43
|
.postAndGetJSON(`${zeniAPI.apiEndPoints.tenantMicroServiceBaseUrl}/1.0/companies/${companyId}/emails/month-end`, payload, {
|
|
@@ -6,11 +6,11 @@ const operators_1 = require("rxjs/operators");
|
|
|
6
6
|
const responsePayload_1 = require("../../responsePayload");
|
|
7
7
|
const recommendationReducer_1 = require("./recommendationReducer");
|
|
8
8
|
const recommendationHelper_1 = require("./recommendationHelper");
|
|
9
|
-
const
|
|
9
|
+
const fetchRecommendationByEntityQboIdEpic_1 = require("./fetchRecommendationByEntityQboIdEpic");
|
|
10
10
|
const fetchRecommendationByEntityIdEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(recommendationReducer_1.fetchRecommendationByEntityId.match), (0, operators_1.mergeMap)((action) => {
|
|
11
11
|
const { entityId, entityType } = action.payload;
|
|
12
12
|
return zeniAPI
|
|
13
|
-
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/${(0,
|
|
13
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/${(0, fetchRecommendationByEntityQboIdEpic_1.toEntityTypeURL)(entityType)}/${entityId}/recommendations`)
|
|
14
14
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
15
15
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
16
16
|
const actions = [];
|
|
@@ -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 { fetchRecommendationByEntityQboId, updateRecommendationForEntity, updateRecommendationForEntityFailure } from './recommendationReducer';
|
|
7
|
+
import { setEntityRecommendationForLineIdsForTransactionDetail } from '../transactionDetail/transactionDetailReducer';
|
|
8
|
+
export declare type ActionType = ReturnType<typeof updateRecommendationForEntity> | ReturnType<typeof fetchRecommendationByEntityQboId> | ReturnType<typeof updateRecommendationForEntityFailure> | ReturnType<typeof setEntityRecommendationForLineIdsForTransactionDetail>;
|
|
9
|
+
export declare const fetchRecommendationByEntityQboIdEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
|
|
10
|
+
export declare const toEntityTypeURL: (entityType: EntityType) => string;
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.toEntityTypeURL = exports.
|
|
3
|
+
exports.toEntityTypeURL = exports.fetchRecommendationByEntityQboIdEpic = void 0;
|
|
4
4
|
const rxjs_1 = require("rxjs");
|
|
5
5
|
const operators_1 = require("rxjs/operators");
|
|
6
6
|
const responsePayload_1 = require("../../responsePayload");
|
|
@@ -8,30 +8,23 @@ const recommendationReducer_1 = require("./recommendationReducer");
|
|
|
8
8
|
const transactionDetailReducer_1 = require("../transactionDetail/transactionDetailReducer");
|
|
9
9
|
const recommendationHelper_1 = require("./recommendationHelper");
|
|
10
10
|
const accountListSelector_1 = require("../accountList/accountListSelector");
|
|
11
|
-
const
|
|
12
|
-
const fetchEntityRecommendationsByTransactionIdEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(recommendationReducer_1.fetchEntityRecommendationsByTransactionId.match), (0, operators_1.switchMap)((action) => {
|
|
11
|
+
const fetchRecommendationByEntityQboIdEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(recommendationReducer_1.fetchRecommendationByEntityQboId.match), (0, operators_1.switchMap)((action) => {
|
|
13
12
|
const { entity, amount, transactionDetails } = action.payload;
|
|
14
|
-
const query = {
|
|
15
|
-
amount,
|
|
16
|
-
transaction_id: (0, transactionDetailState_1.getActualTransactionID)(transactionDetails.transactionId.id),
|
|
17
|
-
transaction_type: transactionDetails.transaction.type,
|
|
18
|
-
};
|
|
19
13
|
return zeniAPI
|
|
20
|
-
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/${(0, exports.toEntityTypeURL)(entity.type)}/${entity.qboId}/recommendations?query=${encodeURIComponent(
|
|
14
|
+
.getJSON(`${zeniAPI.apiEndPoints.accountMicroServiceBaseUrl}/1.0/${(0, exports.toEntityTypeURL)(entity.type)}/${entity.qboId}/recommendations?query=${encodeURIComponent(`{"amount":${amount}}`)}`)
|
|
21
15
|
.pipe((0, operators_1.mergeMap)((response) => {
|
|
22
16
|
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
23
17
|
const actions = [];
|
|
24
18
|
const { transactionId, transaction, lineIds } = transactionDetails;
|
|
25
|
-
const recommendationByLineId = (0, recommendationHelper_1.getRecommendationByLineIdFromRecommendationPayload)(response.data.recommendations, lineIds);
|
|
26
19
|
const recommendations = (0, recommendationHelper_1.getRecommendationFromRecommendationPayload)(response.data.recommendations);
|
|
27
20
|
actions.push((0, recommendationReducer_1.updateRecommendationForEntity)({
|
|
28
21
|
entityId: entity.id,
|
|
29
22
|
entityType: entity.type,
|
|
30
23
|
recommendations,
|
|
31
24
|
}));
|
|
32
|
-
if (
|
|
25
|
+
if (recommendations != null) {
|
|
33
26
|
const uncategorizedIncomeExpense = (0, accountListSelector_1.getUncategorizedAccounts)(state$.value.accountState, state$.value.accountListState, 'accountList');
|
|
34
|
-
actions.push((0, transactionDetailReducer_1.setEntityRecommendationForLineIdsForTransactionDetail)(transactionId, transaction, lineIds, entity, amount,
|
|
27
|
+
actions.push((0, transactionDetailReducer_1.setEntityRecommendationForLineIdsForTransactionDetail)(transactionId, transaction, lineIds, entity, amount, recommendations, uncategorizedIncomeExpense));
|
|
35
28
|
}
|
|
36
29
|
return (0, rxjs_1.from)(actions);
|
|
37
30
|
}
|
|
@@ -49,7 +42,7 @@ const fetchEntityRecommendationsByTransactionIdEpic = (actions$, state$, zeniAPI
|
|
|
49
42
|
JSON.stringify(error)),
|
|
50
43
|
}))));
|
|
51
44
|
}));
|
|
52
|
-
exports.
|
|
45
|
+
exports.fetchRecommendationByEntityQboIdEpic = fetchRecommendationByEntityQboIdEpic;
|
|
53
46
|
const toEntityTypeURL = (entityType) => {
|
|
54
47
|
return `${entityType}s`;
|
|
55
48
|
};
|
|
@@ -1,6 +1,3 @@
|
|
|
1
1
|
import { RecommendationPayload } from '../../commonPayloadTypes/recommendationPayload';
|
|
2
|
-
import { ID } from '../../commonStateTypes/common';
|
|
3
2
|
import { Recommendation } from '../../commonStateTypes/recommendationBase';
|
|
4
|
-
import { RecommendationByLineId } from '../../entity/transaction/stateTypes/transaction';
|
|
5
3
|
export declare const getRecommendationFromRecommendationPayload: (payload: RecommendationPayload[]) => Recommendation[] | undefined;
|
|
6
|
-
export declare const getRecommendationByLineIdFromRecommendationPayload: (recommendationPayload: RecommendationPayload[], lineIds: ID[]) => RecommendationByLineId | undefined;
|