@zeniai/client-epic-state 5.0.36-betaRR05 → 5.0.37
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/file/fileState.d.ts +4 -4
- package/lib/entity/file/fileState.js +0 -4
- package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
- package/lib/entity/snackbar/snackbarTypes.js +0 -4
- package/lib/entity/task/taskPayload.d.ts +0 -4
- package/lib/entity/task/taskPayload.js +0 -10
- package/lib/entity/task/taskState.d.ts +0 -8
- package/lib/entity/task/taskState.js +1 -6
- package/lib/entity/tenant/clearAllEpic.d.ts +2 -5
- package/lib/entity/tenant/clearAllEpic.js +0 -6
- package/lib/entity/tenant/tenantPayload.d.ts +0 -1
- package/lib/entity/tenant/tenantReducer.d.ts +1 -59
- package/lib/entity/tenant/tenantReducer.js +4 -139
- package/lib/entity/tenant/tenantState.d.ts +0 -7
- package/lib/entity/transaction/stateTypes/attachment.d.ts +2 -2
- package/lib/epic.d.ts +1 -9
- package/lib/epic.js +1 -12
- package/lib/esm/commonStateTypes/fiscalYearHelpers/formatZeniDateFY.js +0 -1
- package/lib/esm/entity/file/fileState.js +0 -4
- package/lib/esm/entity/snackbar/snackbarTypes.js +0 -4
- package/lib/esm/entity/task/taskPayload.js +1 -11
- package/lib/esm/entity/task/taskState.js +0 -3
- package/lib/esm/entity/tenant/clearAllEpic.js +0 -6
- package/lib/esm/entity/tenant/tenantReducer.js +2 -135
- package/lib/esm/epic.js +1 -12
- package/lib/esm/index.js +9 -18
- package/lib/esm/init.js +16 -71
- package/lib/esm/reducer.js +0 -9
- package/lib/esm/view/common/recurringViewHelper.js +0 -17
- package/lib/esm/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +0 -3
- package/lib/esm/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +0 -5
- package/lib/esm/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -3
- package/lib/esm/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +0 -6
- package/lib/esm/view/taskManager/taskDetailView/taskDetail.js +0 -5
- package/lib/esm/view/taskManager/taskDetailView/taskDetailReducer.js +7 -60
- package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +0 -17
- package/lib/esm/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +21 -56
- package/lib/esm/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +0 -1
- package/lib/esm/view/taskManager/taskListView/epics/fetchTaskListEpic.js +4 -13
- package/lib/esm/view/taskManager/taskListView/epics/updateTaskFromListViewEpic.js +2 -3
- package/lib/esm/view/taskManager/taskListView/taskList.js +0 -7
- package/lib/esm/view/taskManager/taskListView/taskListReducer.js +12 -106
- package/lib/esm/view/taskManager/taskListView/taskListSelector.js +39 -48
- package/lib/index.d.ts +9 -21
- package/lib/index.js +30 -70
- package/lib/init.d.ts +3 -5
- package/lib/init.js +16 -71
- package/lib/reducer.d.ts +0 -9
- package/lib/reducer.js +0 -9
- package/lib/tsconfig.typecheck.tsbuildinfo +1 -1
- package/lib/view/common/recurringViewHelper.d.ts +2 -3
- package/lib/view/common/recurringViewHelper.js +1 -18
- package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
- package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.d.ts +1 -2
- package/lib/view/taskManager/taskDetailView/epics/archiveTaskEpic.js +0 -3
- package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.d.ts +1 -2
- package/lib/view/taskManager/taskDetailView/epics/deleteTaskEpic.js +0 -5
- package/lib/view/taskManager/taskDetailView/epics/initializeTaskToLocalStoreEpic.js +0 -3
- package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +0 -6
- package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +1 -5
- package/lib/view/taskManager/taskDetailView/taskDetail.js +0 -5
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +1 -10
- package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +8 -61
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.d.ts +0 -6
- package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +0 -17
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.d.ts +7 -6
- package/lib/view/taskManager/taskListView/epics/bulkUpdateTaskListEpic.js +22 -56
- package/lib/view/taskManager/taskListView/epics/dragNDropTasksEpic.js +0 -1
- package/lib/view/taskManager/taskListView/epics/fetchTaskListEpic.js +4 -13
- package/lib/view/taskManager/taskListView/epics/updateTaskFromListViewEpic.js +2 -3
- package/lib/view/taskManager/taskListView/taskList.d.ts +1 -14
- package/lib/view/taskManager/taskListView/taskList.js +1 -8
- package/lib/view/taskManager/taskListView/taskListPayload.d.ts +0 -3
- package/lib/view/taskManager/taskListView/taskListReducer.d.ts +6 -9
- package/lib/view/taskManager/taskListView/taskListReducer.js +13 -107
- package/lib/view/taskManager/taskListView/taskListSelector.d.ts +3 -9
- package/lib/view/taskManager/taskListView/taskListSelector.js +39 -48
- package/package.json +1 -1
- package/lib/entity/tenant/epic/deleteConnectionEpic.d.ts +0 -19
- package/lib/entity/tenant/epic/deleteConnectionEpic.js +0 -29
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.d.ts +0 -19
- package/lib/entity/tenant/epic/saveAPIKeyConnectionEpic.js +0 -31
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.d.ts +0 -19
- package/lib/entity/tenant/epic/saveOAuthConnectionEpic.js +0 -33
- package/lib/esm/entity/tenant/epic/deleteConnectionEpic.js +0 -25
- package/lib/esm/entity/tenant/epic/saveAPIKeyConnectionEpic.js +0 -27
- package/lib/esm/entity/tenant/epic/saveOAuthConnectionEpic.js +0 -29
- package/lib/esm/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.js +0 -23
- package/lib/esm/view/featureNotificationView/epics/notifyMeForFeatureEpic.js +0 -25
- package/lib/esm/view/featureNotificationView/featureNotificationViewPayload.js +0 -11
- package/lib/esm/view/featureNotificationView/featureNotificationViewReducer.js +0 -106
- package/lib/esm/view/featureNotificationView/featureNotificationViewSelector.js +0 -4
- package/lib/esm/view/featureNotificationView/featureNotificationViewState.js +0 -1
- package/lib/esm/view/taskManager/cannedResponsesView/cannedResponses.js +0 -1
- package/lib/esm/view/taskManager/cannedResponsesView/cannedResponsesPayload.js +0 -12
- package/lib/esm/view/taskManager/cannedResponsesView/cannedResponsesReducer.js +0 -64
- package/lib/esm/view/taskManager/cannedResponsesView/cannedResponsesSelector.js +0 -3
- package/lib/esm/view/taskManager/cannedResponsesView/epics/deleteCannedResponseEpic.js +0 -17
- package/lib/esm/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.js +0 -21
- package/lib/esm/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.js +0 -29
- package/lib/esm/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +0 -66
- package/lib/esm/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +0 -57
- package/lib/esm/view/zeniOAuthView/epics/approveOAuthConsentEpic.js +0 -65
- package/lib/esm/view/zeniOAuthView/zeniOAuthParamsParser.js +0 -41
- package/lib/esm/view/zeniOAuthView/zeniOAuthReducer.js +0 -49
- package/lib/esm/view/zeniOAuthView/zeniOAuthSelector.js +0 -3
- package/lib/esm/view/zeniOAuthView/zeniOAuthState.js +0 -1
- package/lib/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.d.ts +0 -16
- package/lib/view/featureNotificationView/epics/fetchRegisteredInterestsEpic.js +0 -27
- package/lib/view/featureNotificationView/epics/notifyMeForFeatureEpic.d.ts +0 -14
- package/lib/view/featureNotificationView/epics/notifyMeForFeatureEpic.js +0 -29
- package/lib/view/featureNotificationView/featureNotificationViewPayload.d.ts +0 -23
- package/lib/view/featureNotificationView/featureNotificationViewPayload.js +0 -15
- package/lib/view/featureNotificationView/featureNotificationViewReducer.d.ts +0 -19
- package/lib/view/featureNotificationView/featureNotificationViewReducer.js +0 -110
- package/lib/view/featureNotificationView/featureNotificationViewSelector.d.ts +0 -6
- package/lib/view/featureNotificationView/featureNotificationViewSelector.js +0 -11
- package/lib/view/featureNotificationView/featureNotificationViewState.d.ts +0 -26
- package/lib/view/featureNotificationView/featureNotificationViewState.js +0 -2
- package/lib/view/taskManager/cannedResponsesView/cannedResponses.d.ts +0 -19
- package/lib/view/taskManager/cannedResponsesView/cannedResponses.js +0 -2
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesPayload.d.ts +0 -21
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesPayload.js +0 -15
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesReducer.d.ts +0 -30
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesReducer.js +0 -68
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesSelector.d.ts +0 -3
- package/lib/view/taskManager/cannedResponsesView/cannedResponsesSelector.js +0 -6
- package/lib/view/taskManager/cannedResponsesView/epics/deleteCannedResponseEpic.d.ts +0 -7
- package/lib/view/taskManager/cannedResponsesView/epics/deleteCannedResponseEpic.js +0 -21
- package/lib/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.d.ts +0 -7
- package/lib/view/taskManager/cannedResponsesView/epics/fetchCannedResponsesEpic.js +0 -25
- package/lib/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.d.ts +0 -7
- package/lib/view/taskManager/cannedResponsesView/epics/saveCannedResponseEpic.js +0 -33
- package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.d.ts +0 -9
- package/lib/view/taskManager/taskDetailView/epics/snoozeTaskEpic.js +0 -70
- package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.d.ts +0 -9
- package/lib/view/taskManager/taskDetailView/epics/unsnoozeTaskEpic.js +0 -61
- package/lib/view/zeniOAuthView/epics/approveOAuthConsentEpic.d.ts +0 -27
- package/lib/view/zeniOAuthView/epics/approveOAuthConsentEpic.js +0 -69
- package/lib/view/zeniOAuthView/zeniOAuthParamsParser.d.ts +0 -16
- package/lib/view/zeniOAuthView/zeniOAuthParamsParser.js +0 -44
- package/lib/view/zeniOAuthView/zeniOAuthReducer.d.ts +0 -29
- package/lib/view/zeniOAuthView/zeniOAuthReducer.js +0 -53
- package/lib/view/zeniOAuthView/zeniOAuthSelector.d.ts +0 -5
- package/lib/view/zeniOAuthView/zeniOAuthSelector.js +0 -9
- package/lib/view/zeniOAuthView/zeniOAuthState.d.ts +0 -4
- package/lib/view/zeniOAuthView/zeniOAuthState.js +0 -2
|
@@ -1,106 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
import { toFeatureInterest, } from './featureNotificationViewPayload';
|
|
3
|
-
export const initialState = {
|
|
4
|
-
fetchRegisteredInterestsState: {
|
|
5
|
-
fetchState: 'Not-Started',
|
|
6
|
-
error: undefined,
|
|
7
|
-
},
|
|
8
|
-
notifyMeForFeatureState: {
|
|
9
|
-
fetchState: 'Not-Started',
|
|
10
|
-
error: undefined,
|
|
11
|
-
},
|
|
12
|
-
registeredInterests: [],
|
|
13
|
-
};
|
|
14
|
-
const featureNotificationView = createSlice({
|
|
15
|
-
name: 'featureNotificationView',
|
|
16
|
-
initialState,
|
|
17
|
-
reducers: {
|
|
18
|
-
notifyMeForFeature: {
|
|
19
|
-
prepare(feature, additionalInfo, email) {
|
|
20
|
-
return { payload: { feature, additionalInfo, email } };
|
|
21
|
-
},
|
|
22
|
-
reducer(draft,
|
|
23
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
24
|
-
_action) {
|
|
25
|
-
draft.notifyMeForFeatureState = {
|
|
26
|
-
fetchState: 'In-Progress',
|
|
27
|
-
error: undefined,
|
|
28
|
-
};
|
|
29
|
-
},
|
|
30
|
-
},
|
|
31
|
-
notifyMeForFeatureSuccess: {
|
|
32
|
-
prepare(payload) {
|
|
33
|
-
return { payload };
|
|
34
|
-
},
|
|
35
|
-
reducer(draft, action) {
|
|
36
|
-
draft.notifyMeForFeatureState = {
|
|
37
|
-
fetchState: 'Completed',
|
|
38
|
-
error: undefined,
|
|
39
|
-
};
|
|
40
|
-
const interest = toFeatureInterest(action.payload);
|
|
41
|
-
// Idempotent: if a row for this (feature, additional_info) already
|
|
42
|
-
// exists in the slice, replace it; otherwise append.
|
|
43
|
-
const existingIndex = draft.registeredInterests.findIndex((r) => r.feature === interest.feature &&
|
|
44
|
-
r.additionalInfo === interest.additionalInfo);
|
|
45
|
-
if (existingIndex >= 0) {
|
|
46
|
-
draft.registeredInterests[existingIndex] = interest;
|
|
47
|
-
}
|
|
48
|
-
else {
|
|
49
|
-
draft.registeredInterests.push(interest);
|
|
50
|
-
}
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
notifyMeForFeatureFailure: {
|
|
54
|
-
prepare(status) {
|
|
55
|
-
return { payload: { status } };
|
|
56
|
-
},
|
|
57
|
-
reducer(draft, action) {
|
|
58
|
-
draft.notifyMeForFeatureState = {
|
|
59
|
-
fetchState: 'Error',
|
|
60
|
-
error: action.payload.status,
|
|
61
|
-
};
|
|
62
|
-
},
|
|
63
|
-
},
|
|
64
|
-
fetchRegisteredInterests: {
|
|
65
|
-
prepare(feature) {
|
|
66
|
-
return { payload: { feature } };
|
|
67
|
-
},
|
|
68
|
-
reducer(draft,
|
|
69
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-vars
|
|
70
|
-
_action) {
|
|
71
|
-
draft.fetchRegisteredInterestsState = {
|
|
72
|
-
fetchState: 'In-Progress',
|
|
73
|
-
error: undefined,
|
|
74
|
-
};
|
|
75
|
-
},
|
|
76
|
-
},
|
|
77
|
-
fetchRegisteredInterestsSuccess: {
|
|
78
|
-
prepare(interests) {
|
|
79
|
-
return { payload: { interests } };
|
|
80
|
-
},
|
|
81
|
-
reducer(draft, action) {
|
|
82
|
-
draft.fetchRegisteredInterestsState = {
|
|
83
|
-
fetchState: 'Completed',
|
|
84
|
-
error: undefined,
|
|
85
|
-
};
|
|
86
|
-
draft.registeredInterests = action.payload.interests;
|
|
87
|
-
},
|
|
88
|
-
},
|
|
89
|
-
fetchRegisteredInterestsFailure: {
|
|
90
|
-
prepare(status) {
|
|
91
|
-
return { payload: { status } };
|
|
92
|
-
},
|
|
93
|
-
reducer(draft, action) {
|
|
94
|
-
draft.fetchRegisteredInterestsState = {
|
|
95
|
-
fetchState: 'Error',
|
|
96
|
-
error: action.payload.status,
|
|
97
|
-
};
|
|
98
|
-
},
|
|
99
|
-
},
|
|
100
|
-
clearFeatureNotificationView(draft) {
|
|
101
|
-
Object.assign(draft, initialState);
|
|
102
|
-
},
|
|
103
|
-
},
|
|
104
|
-
});
|
|
105
|
-
export const { clearFeatureNotificationView, fetchRegisteredInterests, fetchRegisteredInterestsFailure, fetchRegisteredInterestsSuccess, notifyMeForFeature, notifyMeForFeatureFailure, notifyMeForFeatureSuccess, } = featureNotificationView.actions;
|
|
106
|
-
export default featureNotificationView.reducer;
|
|
@@ -1,4 +0,0 @@
|
|
|
1
|
-
export const getFeatureNotificationView = (state) => state.featureNotificationViewState;
|
|
2
|
-
export const getRegisteredInterests = (state) => state.featureNotificationViewState.registeredInterests;
|
|
3
|
-
export const getRegisteredInterestsByFeature = (state, feature) => state.featureNotificationViewState.registeredInterests.filter((interest) => interest.feature === feature);
|
|
4
|
-
export const isFeatureInterestRegistered = (state, feature, additionalInfo) => state.featureNotificationViewState.registeredInterests.some((interest) => interest.feature === feature && interest.additionalInfo === additionalInfo);
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
import { date } from '../../../zeniDayJS';
|
|
2
|
-
export function mapCannedResponsePayloadToCannedResponse(payload) {
|
|
3
|
-
return {
|
|
4
|
-
cannedResponseId: payload.canned_response_id,
|
|
5
|
-
content: payload.content,
|
|
6
|
-
createTime: date(payload.create_time),
|
|
7
|
-
createdBy: payload.created_by,
|
|
8
|
-
isDeleted: payload.is_deleted,
|
|
9
|
-
name: payload.name,
|
|
10
|
-
updateTime: date(payload.update_time),
|
|
11
|
-
};
|
|
12
|
-
}
|
|
@@ -1,64 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
export const initialState = {
|
|
3
|
-
cannedResponses: [],
|
|
4
|
-
fetchState: 'Not-Started',
|
|
5
|
-
saveFetchState: 'Not-Started',
|
|
6
|
-
deleteFetchState: 'Not-Started',
|
|
7
|
-
error: undefined,
|
|
8
|
-
};
|
|
9
|
-
const cannedResponsesView = createSlice({
|
|
10
|
-
name: 'cannedResponsesView',
|
|
11
|
-
initialState,
|
|
12
|
-
reducers: {
|
|
13
|
-
fetchCannedResponses(draft) {
|
|
14
|
-
draft.fetchState =
|
|
15
|
-
draft.cannedResponses.length > 0 ? 'Completed' : 'In-Progress';
|
|
16
|
-
draft.error = undefined;
|
|
17
|
-
},
|
|
18
|
-
updateCannedResponses(draft, action) {
|
|
19
|
-
draft.cannedResponses = action.payload.cannedResponses;
|
|
20
|
-
draft.fetchState = 'Completed';
|
|
21
|
-
draft.error = undefined;
|
|
22
|
-
},
|
|
23
|
-
updateCannedResponsesFetchStatus(draft, action) {
|
|
24
|
-
draft.fetchState = action.payload.fetchState;
|
|
25
|
-
draft.error = action.payload.error;
|
|
26
|
-
},
|
|
27
|
-
saveCannedResponse: {
|
|
28
|
-
reducer(draft) {
|
|
29
|
-
draft.saveFetchState = 'In-Progress';
|
|
30
|
-
},
|
|
31
|
-
prepare(payload) {
|
|
32
|
-
return { payload };
|
|
33
|
-
},
|
|
34
|
-
},
|
|
35
|
-
saveCannedResponseSuccess(draft) {
|
|
36
|
-
draft.saveFetchState = 'Completed';
|
|
37
|
-
},
|
|
38
|
-
saveCannedResponseFailure(draft, action) {
|
|
39
|
-
draft.saveFetchState = 'Error';
|
|
40
|
-
draft.error = action.payload.error;
|
|
41
|
-
},
|
|
42
|
-
deleteCannedResponse: {
|
|
43
|
-
reducer(draft) {
|
|
44
|
-
draft.deleteFetchState = 'In-Progress';
|
|
45
|
-
},
|
|
46
|
-
prepare(payload) {
|
|
47
|
-
return { payload };
|
|
48
|
-
},
|
|
49
|
-
},
|
|
50
|
-
deleteCannedResponseSuccess(draft, action) {
|
|
51
|
-
draft.deleteFetchState = 'Completed';
|
|
52
|
-
draft.cannedResponses = draft.cannedResponses.filter((r) => r.cannedResponseId !== action.payload.cannedResponseId);
|
|
53
|
-
},
|
|
54
|
-
deleteCannedResponseFailure(draft, action) {
|
|
55
|
-
draft.deleteFetchState = 'Error';
|
|
56
|
-
draft.error = action.payload.error;
|
|
57
|
-
},
|
|
58
|
-
clearCannedResponses() {
|
|
59
|
-
return initialState;
|
|
60
|
-
},
|
|
61
|
-
},
|
|
62
|
-
});
|
|
63
|
-
export const { fetchCannedResponses, updateCannedResponses, updateCannedResponsesFetchStatus, saveCannedResponse, saveCannedResponseSuccess, saveCannedResponseFailure, deleteCannedResponse, deleteCannedResponseSuccess, deleteCannedResponseFailure, clearCannedResponses, } = cannedResponsesView.actions;
|
|
64
|
-
export default cannedResponsesView.reducer;
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
4
|
-
import { deleteCannedResponse, deleteCannedResponseFailure, deleteCannedResponseSuccess, } from '../cannedResponsesReducer';
|
|
5
|
-
export const deleteCannedResponseEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(deleteCannedResponse.match), mergeMap((action) => {
|
|
6
|
-
const { cannedResponseId } = action.payload;
|
|
7
|
-
return zeniAPI
|
|
8
|
-
.deleteAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/canned-responses/${cannedResponseId}`)
|
|
9
|
-
.pipe(mergeMap((response) => {
|
|
10
|
-
if (isSuccessResponse(response)) {
|
|
11
|
-
return of(deleteCannedResponseSuccess({ cannedResponseId }));
|
|
12
|
-
}
|
|
13
|
-
return of(deleteCannedResponseFailure({ error: response.status }));
|
|
14
|
-
}), catchError((error) => of(deleteCannedResponseFailure({
|
|
15
|
-
error: createZeniAPIStatus('Unexpected Error', 'Delete Canned Response errored: ' + JSON.stringify(error)),
|
|
16
|
-
}))));
|
|
17
|
-
}));
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, switchMap, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
4
|
-
import { mapCannedResponsePayloadToCannedResponse, } from '../cannedResponsesPayload';
|
|
5
|
-
import { fetchCannedResponses, updateCannedResponses, updateCannedResponsesFetchStatus, } from '../cannedResponsesReducer';
|
|
6
|
-
export const fetchCannedResponsesEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(fetchCannedResponses.match), switchMap(() => zeniAPI
|
|
7
|
-
.getJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/canned-responses`)
|
|
8
|
-
.pipe(mergeMap((response) => {
|
|
9
|
-
if (isSuccessResponse(response) && response.data != null) {
|
|
10
|
-
return of(updateCannedResponses({
|
|
11
|
-
cannedResponses: (response.data.canned_responses ?? []).map(mapCannedResponsePayloadToCannedResponse),
|
|
12
|
-
}));
|
|
13
|
-
}
|
|
14
|
-
return of(updateCannedResponsesFetchStatus({
|
|
15
|
-
fetchState: 'Error',
|
|
16
|
-
error: response.status,
|
|
17
|
-
}));
|
|
18
|
-
}), catchError((error) => of(updateCannedResponsesFetchStatus({
|
|
19
|
-
fetchState: 'Error',
|
|
20
|
-
error: createZeniAPIStatus('Unexpected Error', 'Fetch Canned Responses errored: ' + JSON.stringify(error)),
|
|
21
|
-
}))))));
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
import { of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, switchMap, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
4
|
-
import { fetchCannedResponses, saveCannedResponse, saveCannedResponseFailure, saveCannedResponseSuccess, } from '../cannedResponsesReducer';
|
|
5
|
-
export const saveCannedResponseEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(saveCannedResponse.match), switchMap((action) => {
|
|
6
|
-
const { name, content, cannedResponseId } = action.payload;
|
|
7
|
-
const isUpdate = cannedResponseId != null;
|
|
8
|
-
const url = isUpdate
|
|
9
|
-
? `${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/canned-responses/${cannedResponseId}`
|
|
10
|
-
: `${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/canned-responses`;
|
|
11
|
-
const apiCall = isUpdate
|
|
12
|
-
? zeniAPI.putAndGetJSON(url, {
|
|
13
|
-
name,
|
|
14
|
-
content,
|
|
15
|
-
})
|
|
16
|
-
: zeniAPI.postAndGetJSON(url, {
|
|
17
|
-
name,
|
|
18
|
-
content,
|
|
19
|
-
});
|
|
20
|
-
return apiCall.pipe(mergeMap((response) => {
|
|
21
|
-
if (isSuccessResponse(response)) {
|
|
22
|
-
return of(saveCannedResponseSuccess(), fetchCannedResponses() // Refresh list after save
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
return of(saveCannedResponseFailure({ error: response.status }));
|
|
26
|
-
}), catchError((error) => of(saveCannedResponseFailure({
|
|
27
|
-
error: createZeniAPIStatus('Unexpected Error', 'Save Canned Response errored: ' + JSON.stringify(error)),
|
|
28
|
-
}))));
|
|
29
|
-
}));
|
|
@@ -1,66 +0,0 @@
|
|
|
1
|
-
import { from, of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { SNOOZED_DISPLAY_FORMAT } from '../../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY';
|
|
4
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
5
|
-
import { updateTasks } from '../../../../entity/task/taskReducer';
|
|
6
|
-
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
7
|
-
import { date } from '../../../../zeniDayJS';
|
|
8
|
-
import { fetchTaskList, removeTaskFromList, } from '../../taskListView/taskListReducer';
|
|
9
|
-
import { snoozeTask, snoozeTaskSuccessOrFailure } from '../taskDetailReducer';
|
|
10
|
-
export const snoozeTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(snoozeTask.match), mergeMap((action) => handleSnoozeTask(action.payload.taskId, action.payload.snoozedUntil, zeniAPI)));
|
|
11
|
-
const formatSnoozedUntilForDisplay = (snoozedUntil) => date(snoozedUntil).format(SNOOZED_DISPLAY_FORMAT);
|
|
12
|
-
const handleSnoozeTask = (taskId, snoozedUntil, zeniAPI) => {
|
|
13
|
-
const snoozeTaskApi$ = zeniAPI.postAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}/snooze`, { snoozed_until: snoozedUntil });
|
|
14
|
-
return snoozeTaskApi$.pipe(mergeMap((response) => handleApiResponse(response, taskId, snoozedUntil)), catchError((error) => of(snoozeTaskSuccessOrFailure({
|
|
15
|
-
fetchState: 'Error',
|
|
16
|
-
taskId,
|
|
17
|
-
error: createZeniAPIStatus('Unexpected Error', 'Snooze Task REST API call errored out: ' + JSON.stringify(error)),
|
|
18
|
-
}))));
|
|
19
|
-
};
|
|
20
|
-
const handleApiResponse = (response, taskId, snoozedUntil) => {
|
|
21
|
-
if (isSuccessResponse(response) &&
|
|
22
|
-
response.data != null &&
|
|
23
|
-
response.data.tasks.length > 0) {
|
|
24
|
-
const fetchActions = [
|
|
25
|
-
updateTasks(response.data.tasks),
|
|
26
|
-
removeTaskFromList(taskId),
|
|
27
|
-
fetchTaskList(),
|
|
28
|
-
snoozeTaskSuccessOrFailure({
|
|
29
|
-
fetchState: 'Completed',
|
|
30
|
-
taskId,
|
|
31
|
-
}),
|
|
32
|
-
openSnackbar({
|
|
33
|
-
messageSection: 'snooze_task',
|
|
34
|
-
messageText: 'success',
|
|
35
|
-
type: 'success',
|
|
36
|
-
variables: [
|
|
37
|
-
{
|
|
38
|
-
variableName: '_snoozed_until_',
|
|
39
|
-
variableValue: formatSnoozedUntilForDisplay(snoozedUntil),
|
|
40
|
-
},
|
|
41
|
-
],
|
|
42
|
-
}),
|
|
43
|
-
];
|
|
44
|
-
return from(fetchActions);
|
|
45
|
-
}
|
|
46
|
-
else {
|
|
47
|
-
return from([
|
|
48
|
-
snoozeTaskSuccessOrFailure({
|
|
49
|
-
fetchState: 'Error',
|
|
50
|
-
taskId,
|
|
51
|
-
error: response.status,
|
|
52
|
-
}),
|
|
53
|
-
openSnackbar({
|
|
54
|
-
messageSection: 'snooze_task',
|
|
55
|
-
messageText: 'failed',
|
|
56
|
-
type: 'error',
|
|
57
|
-
variables: [
|
|
58
|
-
{
|
|
59
|
-
variableName: '_api-error_',
|
|
60
|
-
variableValue: response.status.message,
|
|
61
|
-
},
|
|
62
|
-
],
|
|
63
|
-
}),
|
|
64
|
-
]);
|
|
65
|
-
}
|
|
66
|
-
};
|
|
@@ -1,57 +0,0 @@
|
|
|
1
|
-
import { from, of } from 'rxjs';
|
|
2
|
-
import { catchError, filter, mergeMap } from 'rxjs/operators';
|
|
3
|
-
import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
|
|
4
|
-
import { updateTasks } from '../../../../entity/task/taskReducer';
|
|
5
|
-
import { createZeniAPIStatus, isSuccessResponse, } from '../../../../responsePayload';
|
|
6
|
-
import { fetchTaskList, removeTaskFromList, } from '../../taskListView/taskListReducer';
|
|
7
|
-
import { snoozeTaskSuccessOrFailure, unsnoozeTask, } from '../taskDetailReducer';
|
|
8
|
-
export const unsnoozeTaskEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(unsnoozeTask.match), mergeMap((action) => handleUnsnoozeTask(action.payload.taskId, zeniAPI)));
|
|
9
|
-
const handleUnsnoozeTask = (taskId, zeniAPI) => {
|
|
10
|
-
const unsnoozeTaskApi$ = zeniAPI.deleteAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks/${taskId}/snooze`);
|
|
11
|
-
return unsnoozeTaskApi$.pipe(mergeMap((response) => handleApiResponse(response, taskId)), catchError((error) => of(snoozeTaskSuccessOrFailure({
|
|
12
|
-
fetchState: 'Error',
|
|
13
|
-
taskId,
|
|
14
|
-
error: createZeniAPIStatus('Unexpected Error', 'Unsnooze Task REST API call errored out: ' + JSON.stringify(error)),
|
|
15
|
-
}))));
|
|
16
|
-
};
|
|
17
|
-
const handleApiResponse = (response, taskId) => {
|
|
18
|
-
if (isSuccessResponse(response) &&
|
|
19
|
-
response.data != null &&
|
|
20
|
-
response.data.tasks.length > 0) {
|
|
21
|
-
const fetchActions = [
|
|
22
|
-
updateTasks(response.data.tasks),
|
|
23
|
-
removeTaskFromList(taskId),
|
|
24
|
-
fetchTaskList(),
|
|
25
|
-
snoozeTaskSuccessOrFailure({
|
|
26
|
-
fetchState: 'Completed',
|
|
27
|
-
taskId,
|
|
28
|
-
}),
|
|
29
|
-
openSnackbar({
|
|
30
|
-
messageSection: 'unsnooze_task',
|
|
31
|
-
messageText: 'success',
|
|
32
|
-
type: 'success',
|
|
33
|
-
}),
|
|
34
|
-
];
|
|
35
|
-
return from(fetchActions);
|
|
36
|
-
}
|
|
37
|
-
else {
|
|
38
|
-
return from([
|
|
39
|
-
snoozeTaskSuccessOrFailure({
|
|
40
|
-
fetchState: 'Error',
|
|
41
|
-
taskId,
|
|
42
|
-
error: response.status,
|
|
43
|
-
}),
|
|
44
|
-
openSnackbar({
|
|
45
|
-
messageSection: 'unsnooze_task',
|
|
46
|
-
messageText: 'failed',
|
|
47
|
-
type: 'error',
|
|
48
|
-
variables: [
|
|
49
|
-
{
|
|
50
|
-
variableName: '_api-error_',
|
|
51
|
-
variableValue: response.status.message,
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
}),
|
|
55
|
-
]);
|
|
56
|
-
}
|
|
57
|
-
};
|
|
@@ -1,65 +0,0 @@
|
|
|
1
|
-
import { from, of } from 'rxjs';
|
|
2
|
-
import { catchError, concatMap, exhaustMap, filter, mergeMap, } from 'rxjs/operators';
|
|
3
|
-
import { openSnackbar } from '../../../entity/snackbar/snackbarReducer';
|
|
4
|
-
import { createZeniAPIStatus } from '../../../responsePayload';
|
|
5
|
-
import { approveOAuthConsent, approveOAuthConsentFailure, approveOAuthConsentSuccess, } from '../zeniOAuthReducer';
|
|
6
|
-
const failureSnackbar = (reason) => openSnackbar({
|
|
7
|
-
messageSection: 'oauth_consent_approve',
|
|
8
|
-
messageText: 'failed',
|
|
9
|
-
type: 'error',
|
|
10
|
-
variables: [{ variableName: '__reason__', variableValue: reason }],
|
|
11
|
-
});
|
|
12
|
-
export const approveOAuthConsentEpic = (actions$, _state$, zeniAPI) => actions$.pipe(filter(approveOAuthConsent.match),
|
|
13
|
-
// `approveOAuthConsent` reducer sets fetchState to In-Progress before epics
|
|
14
|
-
// run, so a guard on In-Progress would block every legitimate request.
|
|
15
|
-
// exhaustMap drops duplicate approve clicks while the HTTP call is in flight.
|
|
16
|
-
exhaustMap((action) => {
|
|
17
|
-
const { userId, zeniSessionId, tenantId, clientId, redirectUri, codeChallenge, codeChallengeMethod, state, responseType, } = action.payload;
|
|
18
|
-
const authHeaders = {
|
|
19
|
-
'zeni-user-id': userId,
|
|
20
|
-
'zeni-tenant-id': tenantId,
|
|
21
|
-
};
|
|
22
|
-
if (zeniSessionId != null) {
|
|
23
|
-
authHeaders['zeni-session-id'] = zeniSessionId;
|
|
24
|
-
}
|
|
25
|
-
return zeniAPI
|
|
26
|
-
.postJSON(`${zeniAPI.apiEndPoints.authMicroServiceBaseUrl}/oauth/authorize/approve`, {
|
|
27
|
-
client_id: clientId,
|
|
28
|
-
redirect_uri: redirectUri,
|
|
29
|
-
code_challenge: codeChallenge,
|
|
30
|
-
code_challenge_method: codeChallengeMethod,
|
|
31
|
-
state,
|
|
32
|
-
response_type: responseType,
|
|
33
|
-
tenant_id: tenantId,
|
|
34
|
-
}, authHeaders)
|
|
35
|
-
.pipe(concatMap((response) => from(response.json()).pipe(mergeMap((responseJson) => {
|
|
36
|
-
if (!response.ok) {
|
|
37
|
-
const errBody = responseJson;
|
|
38
|
-
const errorMessage = errBody?.error ??
|
|
39
|
-
errBody?.message ??
|
|
40
|
-
errBody?.status?.message ??
|
|
41
|
-
`Authorization failed (${response.status})`;
|
|
42
|
-
return from([
|
|
43
|
-
approveOAuthConsentFailure(createZeniAPIStatus(errorMessage)),
|
|
44
|
-
failureSnackbar(errorMessage),
|
|
45
|
-
]);
|
|
46
|
-
}
|
|
47
|
-
const body = responseJson;
|
|
48
|
-
const redirectUrl = body?.redirect_url ?? body?.data?.redirect_url;
|
|
49
|
-
if (redirectUrl == null || redirectUrl === '') {
|
|
50
|
-
const noRedirectMessage = 'No redirect URL returned from authorization server';
|
|
51
|
-
return from([
|
|
52
|
-
approveOAuthConsentFailure(createZeniAPIStatus(noRedirectMessage)),
|
|
53
|
-
failureSnackbar(noRedirectMessage),
|
|
54
|
-
]);
|
|
55
|
-
}
|
|
56
|
-
return of(approveOAuthConsentSuccess({ redirectUrl }));
|
|
57
|
-
}))), catchError((error) => {
|
|
58
|
-
const errorDetail = error instanceof Error ? error.message : JSON.stringify(error);
|
|
59
|
-
const networkErrorMessage = 'OAuth approve request failed: ' + errorDetail;
|
|
60
|
-
return from([
|
|
61
|
-
approveOAuthConsentFailure(createZeniAPIStatus(networkErrorMessage)),
|
|
62
|
-
failureSnackbar(networkErrorMessage),
|
|
63
|
-
]);
|
|
64
|
-
}));
|
|
65
|
-
}));
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
export function parseOAuthParams(search) {
|
|
2
|
-
const searchParams = new URLSearchParams(search);
|
|
3
|
-
const clientId = searchParams.get('client_id');
|
|
4
|
-
const redirectUri = searchParams.get('redirect_uri');
|
|
5
|
-
const codeChallenge = searchParams.get('code_challenge');
|
|
6
|
-
const codeChallengeMethod = searchParams.get('code_challenge_method') ?? 'S256';
|
|
7
|
-
const state = searchParams.get('state');
|
|
8
|
-
const responseType = searchParams.get('response_type') ?? 'code';
|
|
9
|
-
if (clientId == null || clientId === '') {
|
|
10
|
-
return { params: null, error: 'Missing client_id parameter' };
|
|
11
|
-
}
|
|
12
|
-
if (redirectUri == null || redirectUri === '') {
|
|
13
|
-
return { params: null, error: 'Missing redirect_uri parameter' };
|
|
14
|
-
}
|
|
15
|
-
try {
|
|
16
|
-
void new URL(redirectUri);
|
|
17
|
-
}
|
|
18
|
-
catch {
|
|
19
|
-
return { params: null, error: 'Invalid redirect_uri parameter' };
|
|
20
|
-
}
|
|
21
|
-
if (codeChallenge == null || codeChallenge === '') {
|
|
22
|
-
return {
|
|
23
|
-
params: null,
|
|
24
|
-
error: 'Missing code_challenge parameter (PKCE required)',
|
|
25
|
-
};
|
|
26
|
-
}
|
|
27
|
-
if (state == null || state === '') {
|
|
28
|
-
return { params: null, error: 'Missing state parameter' };
|
|
29
|
-
}
|
|
30
|
-
return {
|
|
31
|
-
params: {
|
|
32
|
-
clientId,
|
|
33
|
-
redirectUri,
|
|
34
|
-
codeChallenge,
|
|
35
|
-
codeChallengeMethod,
|
|
36
|
-
state,
|
|
37
|
-
responseType,
|
|
38
|
-
},
|
|
39
|
-
error: null,
|
|
40
|
-
};
|
|
41
|
-
}
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
import { createSlice } from '@reduxjs/toolkit';
|
|
2
|
-
export const initialState = {
|
|
3
|
-
fetchState: 'Not-Started',
|
|
4
|
-
error: undefined,
|
|
5
|
-
approveRedirectUrl: undefined,
|
|
6
|
-
};
|
|
7
|
-
const zeniOAuthView = createSlice({
|
|
8
|
-
name: 'zeniOAuthView',
|
|
9
|
-
initialState,
|
|
10
|
-
reducers: {
|
|
11
|
-
approveOAuthConsent: {
|
|
12
|
-
prepare(userId, zeniSessionId, tenantId, clientId, redirectUri, codeChallenge, codeChallengeMethod, state, responseType) {
|
|
13
|
-
return {
|
|
14
|
-
payload: {
|
|
15
|
-
userId,
|
|
16
|
-
zeniSessionId,
|
|
17
|
-
tenantId,
|
|
18
|
-
clientId,
|
|
19
|
-
redirectUri,
|
|
20
|
-
codeChallenge,
|
|
21
|
-
codeChallengeMethod,
|
|
22
|
-
state,
|
|
23
|
-
responseType,
|
|
24
|
-
},
|
|
25
|
-
};
|
|
26
|
-
},
|
|
27
|
-
reducer(draft) {
|
|
28
|
-
draft.fetchState = 'In-Progress';
|
|
29
|
-
draft.error = undefined;
|
|
30
|
-
draft.approveRedirectUrl = undefined;
|
|
31
|
-
},
|
|
32
|
-
},
|
|
33
|
-
approveOAuthConsentSuccess(draft, action) {
|
|
34
|
-
draft.fetchState = 'Completed';
|
|
35
|
-
draft.error = undefined;
|
|
36
|
-
draft.approveRedirectUrl = action.payload.redirectUrl;
|
|
37
|
-
},
|
|
38
|
-
approveOAuthConsentFailure(draft, action) {
|
|
39
|
-
draft.fetchState = 'Error';
|
|
40
|
-
draft.error = action.payload;
|
|
41
|
-
draft.approveRedirectUrl = undefined;
|
|
42
|
-
},
|
|
43
|
-
clearZeniOAuthView() {
|
|
44
|
-
return initialState;
|
|
45
|
-
},
|
|
46
|
-
},
|
|
47
|
-
});
|
|
48
|
-
export const { approveOAuthConsent, approveOAuthConsentSuccess, approveOAuthConsentFailure, clearZeniOAuthView, } = zeniOAuthView.actions;
|
|
49
|
-
export default zeniOAuthView.reducer;
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
export const getZeniOAuthApproveFetchState = (state) => state.zeniOAuthViewState.fetchState;
|
|
2
|
-
export const getZeniOAuthApproveRedirectUrl = (state) => state.zeniOAuthViewState.approveRedirectUrl;
|
|
3
|
-
export const getZeniOAuthApproveError = (state) => state.zeniOAuthViewState.error?.message ?? null;
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { RootState } from '../../../reducer';
|
|
3
|
-
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
-
import { fetchRegisteredInterests, fetchRegisteredInterestsFailure, fetchRegisteredInterestsSuccess } from '../featureNotificationViewReducer';
|
|
5
|
-
export type ActionType = ReturnType<typeof fetchRegisteredInterests> | ReturnType<typeof fetchRegisteredInterestsSuccess> | ReturnType<typeof fetchRegisteredInterestsFailure>;
|
|
6
|
-
export declare const fetchRegisteredInterestsEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
7
|
-
payload: {
|
|
8
|
-
interests: import("../featureNotificationViewState").FeatureInterest[];
|
|
9
|
-
};
|
|
10
|
-
type: "featureNotificationView/fetchRegisteredInterestsSuccess";
|
|
11
|
-
} | {
|
|
12
|
-
payload: {
|
|
13
|
-
status: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
|
|
14
|
-
};
|
|
15
|
-
type: "featureNotificationView/fetchRegisteredInterestsFailure";
|
|
16
|
-
}>;
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.fetchRegisteredInterestsEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
-
const featureNotificationViewPayload_1 = require("../featureNotificationViewPayload");
|
|
8
|
-
const featureNotificationViewReducer_1 = require("../featureNotificationViewReducer");
|
|
9
|
-
const fetchRegisteredInterestsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(featureNotificationViewReducer_1.fetchRegisteredInterests.match), (0, operators_1.switchMap)((action) => zeniAPI
|
|
10
|
-
.getJSON(`${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/feature-interests?feature=${encodeURIComponent(action.payload.feature)}`)
|
|
11
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
12
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
13
|
-
const interests = response.data.feature_interests.map(featureNotificationViewPayload_1.toFeatureInterest);
|
|
14
|
-
return (0, rxjs_1.from)([(0, featureNotificationViewReducer_1.fetchRegisteredInterestsSuccess)(interests)]);
|
|
15
|
-
}
|
|
16
|
-
const status = response.status ??
|
|
17
|
-
(0, responsePayload_1.createZeniAPIStatus)('Failed to fetch registered interests. Please try again.');
|
|
18
|
-
return (0, rxjs_1.from)([(0, featureNotificationViewReducer_1.fetchRegisteredInterestsFailure)(status)]);
|
|
19
|
-
}), (0, operators_1.catchError)((error) => {
|
|
20
|
-
const message = error instanceof Error
|
|
21
|
-
? error.message
|
|
22
|
-
: 'Unexpected error fetching registered interests.';
|
|
23
|
-
return (0, rxjs_1.from)([
|
|
24
|
-
(0, featureNotificationViewReducer_1.fetchRegisteredInterestsFailure)((0, responsePayload_1.createZeniAPIStatus)(message)),
|
|
25
|
-
]);
|
|
26
|
-
}))));
|
|
27
|
-
exports.fetchRegisteredInterestsEpic = fetchRegisteredInterestsEpic;
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { ActionsObservable, StateObservable } from 'redux-observable';
|
|
2
|
-
import { RootState } from '../../../reducer';
|
|
3
|
-
import { ZeniAPI } from '../../../zeniAPI';
|
|
4
|
-
import { notifyMeForFeature, notifyMeForFeatureFailure, notifyMeForFeatureSuccess } from '../featureNotificationViewReducer';
|
|
5
|
-
export type ActionType = ReturnType<typeof notifyMeForFeature> | ReturnType<typeof notifyMeForFeatureSuccess> | ReturnType<typeof notifyMeForFeatureFailure>;
|
|
6
|
-
export declare const notifyMeForFeatureEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => import("rxjs").Observable<{
|
|
7
|
-
payload: import("../featureNotificationViewPayload").FeatureInterestDataPayload;
|
|
8
|
-
type: "featureNotificationView/notifyMeForFeatureSuccess";
|
|
9
|
-
} | {
|
|
10
|
-
payload: {
|
|
11
|
-
status: import("../../../responsePayload").ZeniAPIStatus<Record<string, unknown>>;
|
|
12
|
-
};
|
|
13
|
-
type: "featureNotificationView/notifyMeForFeatureFailure";
|
|
14
|
-
}>;
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.notifyMeForFeatureEpic = void 0;
|
|
4
|
-
const rxjs_1 = require("rxjs");
|
|
5
|
-
const operators_1 = require("rxjs/operators");
|
|
6
|
-
const responsePayload_1 = require("../../../responsePayload");
|
|
7
|
-
const featureNotificationViewReducer_1 = require("../featureNotificationViewReducer");
|
|
8
|
-
const notifyMeForFeatureEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(featureNotificationViewReducer_1.notifyMeForFeature.match), (0, operators_1.switchMap)((action) => zeniAPI
|
|
9
|
-
.postAndGetJSON(`${zeniAPI.apiEndPoints.notificationMicroServiceBaseUrl}/1.0/feature-interests`, {
|
|
10
|
-
additional_info: action.payload.additionalInfo,
|
|
11
|
-
email: action.payload.email,
|
|
12
|
-
feature: action.payload.feature,
|
|
13
|
-
})
|
|
14
|
-
.pipe((0, operators_1.mergeMap)((response) => {
|
|
15
|
-
if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
|
|
16
|
-
return (0, rxjs_1.from)([(0, featureNotificationViewReducer_1.notifyMeForFeatureSuccess)(response.data)]);
|
|
17
|
-
}
|
|
18
|
-
const status = response.status ??
|
|
19
|
-
(0, responsePayload_1.createZeniAPIStatus)('Failed to register interest. Please try again.');
|
|
20
|
-
return (0, rxjs_1.from)([(0, featureNotificationViewReducer_1.notifyMeForFeatureFailure)(status)]);
|
|
21
|
-
}), (0, operators_1.catchError)((error) => {
|
|
22
|
-
const message = error instanceof Error
|
|
23
|
-
? error.message
|
|
24
|
-
: 'Unexpected error registering interest.';
|
|
25
|
-
return (0, rxjs_1.from)([
|
|
26
|
-
(0, featureNotificationViewReducer_1.notifyMeForFeatureFailure)((0, responsePayload_1.createZeniAPIStatus)(message)),
|
|
27
|
-
]);
|
|
28
|
-
}))));
|
|
29
|
-
exports.notifyMeForFeatureEpic = notifyMeForFeatureEpic;
|