@zeniai/client-epic-state 4.11.7 → 4.11.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.
Files changed (63) hide show
  1. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  2. package/lib/entity/snackbar/snackbarTypes.js +3 -0
  3. package/lib/entity/task/taskPayload.d.ts +2 -2
  4. package/lib/entity/task/taskPayload.js +1 -0
  5. package/lib/entity/task/taskState.d.ts +1 -0
  6. package/lib/entity/taskGroup/taskGroupPayload.d.ts +9 -0
  7. package/lib/entity/taskGroup/taskGroupPayload.js +14 -0
  8. package/lib/entity/taskGroup/taskGroupReducer.d.ts +6 -0
  9. package/lib/entity/taskGroup/taskGroupReducer.js +33 -0
  10. package/lib/entity/taskGroup/taskGroupSelector.d.ts +4 -0
  11. package/lib/entity/taskGroup/taskGroupSelector.js +18 -0
  12. package/lib/entity/taskGroup/taskGroupState.d.ts +12 -0
  13. package/lib/entity/taskGroup/taskGroupState.js +2 -0
  14. package/lib/entity/tenant/clearAllEpic.d.ts +4 -2
  15. package/lib/entity/tenant/clearAllEpic.js +6 -0
  16. package/lib/entity/toastNotification/epic/pushToastNotificationEpic.d.ts +1 -1
  17. package/lib/entity/transaction/stateTypes/transactionType.d.ts +3 -0
  18. package/lib/entity/transaction/stateTypes/transactionType.js +7 -3
  19. package/lib/epic.d.ts +7 -1
  20. package/lib/epic.js +7 -1
  21. package/lib/index.d.ts +6 -4
  22. package/lib/index.js +10 -2
  23. package/lib/reducer.d.ts +6 -0
  24. package/lib/reducer.js +6 -0
  25. package/lib/view/people/changeZeniPersonRolesEpic.d.ts +1 -1
  26. package/lib/view/people/deletePersonEpic.d.ts +1 -1
  27. package/lib/view/people/invitePeopleEpic.d.ts +1 -1
  28. package/lib/view/people/inviteZeniPeopleEpic.d.ts +1 -1
  29. package/lib/view/people/resendInviteEpic.d.ts +1 -1
  30. package/lib/view/settingsView/epic/saveNotificationSettingsEpic.d.ts +1 -1
  31. package/lib/view/tagView/epics/createTagEpic.d.ts +1 -1
  32. package/lib/view/tagView/epics/deleteTagEpic.d.ts +1 -1
  33. package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.d.ts +2 -1
  34. package/lib/view/taskManager/taskDetailView/epics/saveTaskDetailEpic.js +11 -4
  35. package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +2 -1
  36. package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +2 -1
  37. package/lib/view/taskManager/taskGroupView/epics/createNewTaskGroupEpic.d.ts +10 -0
  38. package/lib/view/taskManager/taskGroupView/epics/createNewTaskGroupEpic.js +57 -0
  39. package/lib/view/taskManager/taskGroupView/epics/deleteTaskGroupEpic.d.ts +10 -0
  40. package/lib/view/taskManager/taskGroupView/epics/deleteTaskGroupEpic.js +41 -0
  41. package/lib/view/taskManager/taskGroupView/epics/fetchAllTaskGroupsEpic.d.ts +8 -0
  42. package/lib/view/taskManager/taskGroupView/epics/fetchAllTaskGroupsEpic.js +33 -0
  43. package/lib/view/taskManager/taskGroupView/epics/updateTaskGroupNameEpic.d.ts +10 -0
  44. package/lib/view/taskManager/taskGroupView/epics/updateTaskGroupNameEpic.js +51 -0
  45. package/lib/view/taskManager/taskGroupView/taskGroupViewPayload.d.ts +6 -0
  46. package/lib/view/taskManager/taskGroupView/taskGroupViewPayload.js +2 -0
  47. package/lib/view/taskManager/taskGroupView/taskGroupViewReducer.d.ts +34 -0
  48. package/lib/view/taskManager/taskGroupView/taskGroupViewReducer.js +123 -0
  49. package/lib/view/taskManager/taskGroupView/taskGroupViewState.d.ts +7 -0
  50. package/lib/view/taskManager/taskGroupView/taskGroupViewState.js +2 -0
  51. package/lib/view/taskManager/taskListView/bulkUpdateTaskListEpic.d.ts +8 -0
  52. package/lib/view/taskManager/taskListView/bulkUpdateTaskListEpic.js +89 -0
  53. package/lib/view/taskManager/taskListView/dragNDropTasksEpic.d.ts +6 -0
  54. package/lib/view/taskManager/taskListView/dragNDropTasksEpic.js +20 -0
  55. package/lib/view/taskManager/taskListView/fetchTaskListPageEpic.d.ts +3 -1
  56. package/lib/view/taskManager/taskListView/fetchTaskListPageEpic.js +12 -0
  57. package/lib/view/taskManager/taskListView/taskList.d.ts +14 -1
  58. package/lib/view/taskManager/taskListView/taskListReducer.d.ts +31 -2
  59. package/lib/view/taskManager/taskListView/taskListReducer.js +136 -9
  60. package/lib/view/taskManager/taskListView/taskListSelector.d.ts +12 -2
  61. package/lib/view/taskManager/taskListView/taskListSelector.js +59 -23
  62. package/lib/view/transactionDetail/epics/updateTransactionDetailEpic.js +22 -5
  63. package/package.json +1 -1
@@ -0,0 +1,33 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.fetchAllTaskGroupsEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../../responsePayload");
7
+ const taskGroupViewReducer_1 = require("../taskGroupViewReducer");
8
+ const taskGroupReducer_1 = require("../../../../entity/taskGroup/taskGroupReducer");
9
+ const fetchAllTaskGroupsEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(taskGroupViewReducer_1.fetchAllTaskGroups.match), (0, operators_1.switchMap)(() => {
10
+ const queryParam = { filter_type: 'all' };
11
+ return zeniAPI
12
+ .getJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/groups?query=${encodeURIComponent(JSON.stringify(queryParam))}`)
13
+ .pipe((0, operators_1.mergeMap)((response) => {
14
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
15
+ return (0, rxjs_1.of)((0, taskGroupReducer_1.updateTaskGroups)(response.data.task_groups), (0, taskGroupViewReducer_1.updateTaskGroupsOnSuccess)({
16
+ data: response.data.task_groups,
17
+ }));
18
+ }
19
+ else {
20
+ return (0, rxjs_1.of)((0, taskGroupViewReducer_1.updateTaskGroupsFetchStatus)({
21
+ fetchState: 'Error',
22
+ error: response.status,
23
+ }));
24
+ }
25
+ }), (0, operators_1.catchError)((error) => {
26
+ return (0, rxjs_1.of)((0, taskGroupViewReducer_1.updateTaskGroupsFetchStatus)({
27
+ fetchState: 'Error',
28
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Fetch all task groups REST API call errored out' +
29
+ JSON.stringify(error)),
30
+ }));
31
+ }));
32
+ }));
33
+ exports.fetchAllTaskGroupsEpic = fetchAllTaskGroupsEpic;
@@ -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 { updateTaskGroupName, updateTaskGroupFetchStatus } from '../taskGroupViewReducer';
6
+ import { updateTaskListOnTaskGroupNameUpdate } from '../../taskListView/taskListReducer';
7
+ import { updateTaskGroup } from '../../../../entity/taskGroup/taskGroupReducer';
8
+ import { openSnackbar } from '../../../../entity/snackbar/snackbarReducer';
9
+ export declare type ActionType = ReturnType<typeof updateTaskGroupName> | ReturnType<typeof updateTaskGroupFetchStatus> | ReturnType<typeof updateTaskGroup> | ReturnType<typeof updateTaskListOnTaskGroupNameUpdate> | ReturnType<typeof openSnackbar>;
10
+ export declare const updateTaskGroupNameEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,51 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.updateTaskGroupNameEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const responsePayload_1 = require("../../../../responsePayload");
7
+ const taskGroupViewReducer_1 = require("../taskGroupViewReducer");
8
+ const taskListReducer_1 = require("../../taskListView/taskListReducer");
9
+ const taskGroupReducer_1 = require("../../../../entity/taskGroup/taskGroupReducer");
10
+ const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
11
+ const updateTaskGroupNameEpic = (actions$, _state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(taskGroupViewReducer_1.updateTaskGroupName.match), (0, operators_1.switchMap)((action) => {
12
+ const { taskGroupId, taskGroupName } = action.payload;
13
+ const payload = {
14
+ name: taskGroupName,
15
+ };
16
+ return zeniAPI
17
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/groups/${taskGroupId}`, payload)
18
+ .pipe((0, operators_1.mergeMap)((response) => {
19
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
20
+ const actions = [
21
+ (0, taskGroupReducer_1.updateTaskGroup)(response.data.task_groups[0]),
22
+ (0, taskGroupViewReducer_1.updateTaskGroupFetchStatus)({
23
+ fetchState: 'Completed',
24
+ }),
25
+ (0, taskListReducer_1.updateTaskListOnTaskGroupNameUpdate)({
26
+ taskGroupId,
27
+ taskGroupName,
28
+ }),
29
+ (0, snackbarReducer_1.openSnackbar)({
30
+ messageSection: 'task_group_update_success',
31
+ messageText: 'success',
32
+ type: 'success',
33
+ }),
34
+ ];
35
+ return (0, rxjs_1.from)(actions);
36
+ }
37
+ else {
38
+ return (0, rxjs_1.of)((0, taskGroupViewReducer_1.updateTaskGroupFetchStatus)({
39
+ fetchState: 'Error',
40
+ error: response.status,
41
+ }));
42
+ }
43
+ }), (0, operators_1.catchError)((error) => {
44
+ return (0, rxjs_1.of)((0, taskGroupViewReducer_1.updateTaskGroupFetchStatus)({
45
+ fetchState: 'Error',
46
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Update Task Group REST API call errored out' +
47
+ JSON.stringify(error)),
48
+ }));
49
+ }));
50
+ }));
51
+ exports.updateTaskGroupNameEpic = updateTaskGroupNameEpic;
@@ -0,0 +1,6 @@
1
+ import { TaskGroupPayload } from '../../../entity/taskGroup/taskGroupPayload';
2
+ import { ZeniAPIResponse } from '../../../responsePayload';
3
+ export interface FetchTaskGroupsPayload {
4
+ task_groups: TaskGroupPayload[];
5
+ }
6
+ export declare type FetchTaskGroupsResponse = ZeniAPIResponse<FetchTaskGroupsPayload>;
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,34 @@
1
+ import { FetchState, ID } from '../../../commonStateTypes/common';
2
+ import { TaskGroupPayload } from '../../../entity/taskGroup/taskGroupPayload';
3
+ import { ZeniAPIStatus } from '../../../responsePayload';
4
+ import { TaskGroupViewState } from './taskGroupViewState';
5
+ export declare const initialState: TaskGroupViewState;
6
+ export declare const fetchAllTaskGroups: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>, updateTaskGroupsOnSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
7
+ data: TaskGroupPayload[];
8
+ }, string>, updateTaskGroupsFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
9
+ fetchState: FetchState;
10
+ error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
11
+ }, string>, createNewTaskGroup: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[groupName: string, updateSelectedTasks: boolean], {
12
+ groupName: string;
13
+ updateSelectedTasks: boolean;
14
+ }, string, never, never>, updateTaskGroupCreationFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
15
+ fetchState: FetchState;
16
+ error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
17
+ }, string>, updateTaskGroupViewOnTaskGroupCreationSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
18
+ newTaskGroupId: ID;
19
+ }, string>, deleteTaskGroup: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[taskGroupId: string], {
20
+ taskGroupId: string;
21
+ }, string, never, never>, updateTaskGroupDeletionFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
22
+ fetchState: FetchState;
23
+ error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
24
+ }, string>, updateTaskGroupViewOnTaskDeletionSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
25
+ deletedTaskGroupId: ID;
26
+ }, string>, updateTaskGroupName: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[taskGroupId: any, taskGroupName: any], {
27
+ taskGroupId: any;
28
+ taskGroupName: any;
29
+ }, string, never, never>, updateTaskGroupFetchStatus: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
30
+ fetchState: FetchState;
31
+ error?: ZeniAPIStatus<Record<string, unknown>> | undefined;
32
+ }, string>, clearTaskGroupView: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
33
+ declare const _default: import("@reduxjs/toolkit").Reducer<TaskGroupViewState, import("@reduxjs/toolkit").AnyAction>;
34
+ export default _default;
@@ -0,0 +1,123 @@
1
+ "use strict";
2
+ var _a;
3
+ Object.defineProperty(exports, "__esModule", { value: true });
4
+ exports.clearTaskGroupView = exports.updateTaskGroupFetchStatus = exports.updateTaskGroupName = exports.updateTaskGroupViewOnTaskDeletionSuccess = exports.updateTaskGroupDeletionFetchStatus = exports.deleteTaskGroup = exports.updateTaskGroupViewOnTaskGroupCreationSuccess = exports.updateTaskGroupCreationFetchStatus = exports.createNewTaskGroup = exports.updateTaskGroupsFetchStatus = exports.updateTaskGroupsOnSuccess = exports.fetchAllTaskGroups = exports.initialState = void 0;
5
+ const toolkit_1 = require("@reduxjs/toolkit");
6
+ exports.initialState = {
7
+ taskGroupsIds: [],
8
+ fetchState: 'Not-Started',
9
+ error: undefined,
10
+ hasValidState() {
11
+ return this.fetchState == 'Completed';
12
+ },
13
+ taskGroupCreationStatus: {
14
+ fetchState: 'Not-Started',
15
+ error: undefined,
16
+ },
17
+ taskGroupDeleteStatus: {
18
+ fetchState: 'Not-Started',
19
+ error: undefined,
20
+ },
21
+ taskGroupUpdateStatus: {
22
+ fetchState: 'Not-Started',
23
+ error: undefined,
24
+ },
25
+ };
26
+ const taskGroupView = (0, toolkit_1.createSlice)({
27
+ name: 'taskGroupView',
28
+ initialState: exports.initialState,
29
+ reducers: {
30
+ fetchAllTaskGroups(draft) {
31
+ draft.fetchState = 'In-Progress';
32
+ draft.error = undefined;
33
+ },
34
+ updateTaskGroupsOnSuccess(draft, action) {
35
+ const { data } = action.payload;
36
+ draft.fetchState = 'Completed';
37
+ draft.error = undefined;
38
+ draft.taskGroupsIds = data.map((task) => task.task_group_id);
39
+ },
40
+ updateTaskGroupsFetchStatus(draft, action) {
41
+ draft.fetchState = action.payload.fetchState;
42
+ draft.error = action.payload.error;
43
+ },
44
+ createNewTaskGroup: {
45
+ reducer(draft) {
46
+ draft.taskGroupCreationStatus = {
47
+ fetchState: 'In-Progress',
48
+ error: undefined,
49
+ };
50
+ },
51
+ prepare(groupName, updateSelectedTasks) {
52
+ return {
53
+ payload: {
54
+ groupName,
55
+ updateSelectedTasks,
56
+ },
57
+ };
58
+ },
59
+ },
60
+ updateTaskGroupViewOnTaskGroupCreationSuccess(draft, action) {
61
+ const { newTaskGroupId } = action.payload;
62
+ draft.taskGroupsIds = [...draft.taskGroupsIds, newTaskGroupId];
63
+ draft.taskGroupCreationStatus.fetchState = 'Completed';
64
+ draft.taskGroupCreationStatus.error = undefined;
65
+ },
66
+ updateTaskGroupCreationFetchStatus(draft, action) {
67
+ draft.taskGroupCreationStatus.fetchState = action.payload.fetchState;
68
+ draft.taskGroupCreationStatus.error = action.payload.error;
69
+ },
70
+ deleteTaskGroup: {
71
+ reducer(draft) {
72
+ draft.taskGroupDeleteStatus = {
73
+ fetchState: 'In-Progress',
74
+ error: undefined,
75
+ };
76
+ },
77
+ prepare(taskGroupId) {
78
+ return {
79
+ payload: {
80
+ taskGroupId,
81
+ },
82
+ };
83
+ },
84
+ },
85
+ updateTaskGroupViewOnTaskDeletionSuccess(draft, action) {
86
+ const { deletedTaskGroupId } = action.payload;
87
+ draft.taskGroupsIds = draft.taskGroupsIds.filter((groupId) => groupId !== deletedTaskGroupId);
88
+ draft.taskGroupDeleteStatus.fetchState = 'Completed';
89
+ draft.taskGroupDeleteStatus.error = undefined;
90
+ },
91
+ updateTaskGroupDeletionFetchStatus(draft, action) {
92
+ draft.taskGroupDeleteStatus.fetchState = action.payload.fetchState;
93
+ draft.taskGroupDeleteStatus.error = action.payload.error;
94
+ },
95
+ updateTaskGroupName: {
96
+ reducer(draft) {
97
+ draft.taskGroupUpdateStatus = {
98
+ fetchState: 'In-Progress',
99
+ error: undefined,
100
+ };
101
+ },
102
+ prepare(taskGroupId, taskGroupName) {
103
+ return {
104
+ payload: {
105
+ taskGroupId,
106
+ taskGroupName,
107
+ },
108
+ };
109
+ },
110
+ },
111
+ updateTaskGroupFetchStatus(draft, action) {
112
+ draft.taskGroupUpdateStatus = {
113
+ fetchState: action.payload.fetchState,
114
+ error: action.payload.error,
115
+ };
116
+ },
117
+ clearTaskGroupView(draft) {
118
+ Object.assign(draft, exports.initialState);
119
+ },
120
+ },
121
+ });
122
+ _a = taskGroupView.actions, exports.fetchAllTaskGroups = _a.fetchAllTaskGroups, exports.updateTaskGroupsOnSuccess = _a.updateTaskGroupsOnSuccess, exports.updateTaskGroupsFetchStatus = _a.updateTaskGroupsFetchStatus, exports.createNewTaskGroup = _a.createNewTaskGroup, exports.updateTaskGroupCreationFetchStatus = _a.updateTaskGroupCreationFetchStatus, exports.updateTaskGroupViewOnTaskGroupCreationSuccess = _a.updateTaskGroupViewOnTaskGroupCreationSuccess, exports.deleteTaskGroup = _a.deleteTaskGroup, exports.updateTaskGroupDeletionFetchStatus = _a.updateTaskGroupDeletionFetchStatus, exports.updateTaskGroupViewOnTaskDeletionSuccess = _a.updateTaskGroupViewOnTaskDeletionSuccess, exports.updateTaskGroupName = _a.updateTaskGroupName, exports.updateTaskGroupFetchStatus = _a.updateTaskGroupFetchStatus, exports.clearTaskGroupView = _a.clearTaskGroupView;
123
+ exports.default = taskGroupView.reducer;
@@ -0,0 +1,7 @@
1
+ import { ID, FetchedState, FetchStateAndError } from '../../../commonStateTypes/common';
2
+ export interface TaskGroupViewState extends FetchedState {
3
+ taskGroupsIds: ID[];
4
+ taskGroupCreationStatus: FetchStateAndError;
5
+ taskGroupDeleteStatus: FetchStateAndError;
6
+ taskGroupUpdateStatus: FetchStateAndError;
7
+ }
@@ -0,0 +1,2 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
@@ -0,0 +1,8 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { RootState } from '../../../reducer';
4
+ import { ZeniAPI } from '../../../zeniAPI';
5
+ import { bulkUpdateTaskList, updateTasksListOnBulkUpdateTasksSuccess, updateTasksListOnBulkUpdateTasksFailure } from './taskListReducer';
6
+ import { updateTasks } from '../../../entity/task/taskReducer';
7
+ export declare type ActionType = ReturnType<typeof bulkUpdateTaskList> | ReturnType<typeof updateTasks> | ReturnType<typeof updateTasksListOnBulkUpdateTasksFailure> | ReturnType<typeof updateTasksListOnBulkUpdateTasksSuccess>;
8
+ export declare const bulkUpdateTaskListEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>, zeniAPI: ZeniAPI) => Observable<ActionType>;
@@ -0,0 +1,89 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.bulkUpdateTaskListEpic = void 0;
7
+ const rxjs_1 = require("rxjs");
8
+ const operators_1 = require("rxjs/operators");
9
+ const get_1 = __importDefault(require("lodash/get"));
10
+ const responsePayload_1 = require("../../../responsePayload");
11
+ const taskListReducer_1 = require("./taskListReducer");
12
+ const taskReducer_1 = require("../../../entity/task/taskReducer");
13
+ const formatZeniDateFY_1 = require("../../../commonStateTypes/fiscalYearHelpers/formatZeniDateFY");
14
+ const bulkUpdateTaskListEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(taskListReducer_1.bulkUpdateTaskList.match), (0, operators_1.switchMap)((action) => {
15
+ const state = state$.value;
16
+ const { taskIds, updates } = action.payload;
17
+ const payload = {
18
+ tasks: getTasksListPayload(state, taskIds, updates),
19
+ };
20
+ return zeniAPI
21
+ .putAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks`, payload)
22
+ .pipe((0, operators_1.mergeMap)((response) => {
23
+ if ((0, responsePayload_1.isSuccessResponse)(response) && response.data != null) {
24
+ return (0, rxjs_1.of)((0, taskReducer_1.updateTasks)(response.data.tasks), (0, taskListReducer_1.updateTasksListOnBulkUpdateTasksSuccess)({
25
+ taskIds,
26
+ groupId: updates.taskGroupIds != null &&
27
+ updates.taskGroupIds.length > 0
28
+ ? updates.taskGroupIds[0]
29
+ : null,
30
+ }));
31
+ }
32
+ else {
33
+ return (0, rxjs_1.of)((0, taskListReducer_1.updateTasksListOnBulkUpdateTasksFailure)({
34
+ error: response.status,
35
+ }));
36
+ }
37
+ }), (0, operators_1.catchError)((error) => {
38
+ return (0, rxjs_1.of)((0, taskListReducer_1.updateTasksListOnBulkUpdateTasksFailure)({
39
+ error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Bulk update task list REST API call errored out' +
40
+ JSON.stringify(error)),
41
+ }));
42
+ }));
43
+ }));
44
+ exports.bulkUpdateTaskListEpic = bulkUpdateTaskListEpic;
45
+ const getTasksListPayload = (state, taskIds, updates) => {
46
+ const { taskState } = state;
47
+ const tasksList = taskIds
48
+ .map((taskId) => {
49
+ const task = (0, get_1.default)(taskState.taskByID, taskId);
50
+ return Object.assign(Object.assign({}, task), updates);
51
+ })
52
+ .filter((task) => task != null);
53
+ const tasksPayload = tasksList.map((task) => toTaskPayload(state, task));
54
+ return tasksPayload;
55
+ };
56
+ const toTaskPayload = (state, task) => {
57
+ var _a;
58
+ const { tagState } = state;
59
+ const tags = task.tagIds
60
+ .map((tagId) => {
61
+ return (0, get_1.default)(tagState.tagByID, tagId);
62
+ })
63
+ .filter((tag) => tag != null);
64
+ const tagPayload = tags.map((tag) => {
65
+ return tag.tagId;
66
+ });
67
+ const taskPayload = {
68
+ task_id: task.id,
69
+ name: task.name,
70
+ assignees: task.assignees,
71
+ description: task.description,
72
+ due_date: task.dueDate != null ? task.dueDate.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT) : null,
73
+ priority: task.priority.code,
74
+ status: task.status.code,
75
+ tags: tagPayload,
76
+ type: task.type.code,
77
+ file_ids: task.fileIds,
78
+ recurring_end_date: task.recurringEndDate != null
79
+ ? task.recurringEndDate.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT)
80
+ : null,
81
+ recurring_frequency: (_a = task.recurringFrequency) !== null && _a !== void 0 ? _a : null,
82
+ recurring_start_date: task.recurringStartDate != null
83
+ ? task.recurringStartDate.format(formatZeniDateFY_1.DEFAULT_DATE_FORMAT)
84
+ : null,
85
+ task_group_ids: task.taskGroupIds,
86
+ sync_token: task.syncToken,
87
+ };
88
+ return taskPayload;
89
+ };
@@ -0,0 +1,6 @@
1
+ import { ActionsObservable, StateObservable } from 'redux-observable';
2
+ import { Observable } from 'rxjs';
3
+ import { dragNDropTasks, bulkUpdateTaskList, updateTasksListOnBulkUpdateTasksSuccess } from './taskListReducer';
4
+ import { RootState } from '../../../reducer';
5
+ export declare type ActionType = ReturnType<typeof dragNDropTasks> | ReturnType<typeof bulkUpdateTaskList> | ReturnType<typeof updateTasksListOnBulkUpdateTasksSuccess>;
6
+ export declare const dragNDropTasksEpic: (actions$: ActionsObservable<ActionType>, _state$: StateObservable<RootState>) => Observable<ActionType>;
@@ -0,0 +1,20 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.dragNDropTasksEpic = void 0;
4
+ const rxjs_1 = require("rxjs");
5
+ const operators_1 = require("rxjs/operators");
6
+ const taskListReducer_1 = require("./taskListReducer");
7
+ const dragNDropTasksEpic = (actions$,
8
+ // eslint-disable-next-line @typescript-eslint/no-unused-vars
9
+ _state$) => actions$.pipe((0, operators_1.filter)(taskListReducer_1.dragNDropTasks.match), (0, operators_1.mergeMap)((action) => {
10
+ const { taskIds, groupId } = action.payload;
11
+ const actions = [
12
+ (0, taskListReducer_1.updateTasksListOnBulkUpdateTasksSuccess)({
13
+ taskIds,
14
+ groupId,
15
+ }),
16
+ (0, taskListReducer_1.bulkUpdateTaskList)(taskIds, { taskGroupIds: [groupId] }),
17
+ ];
18
+ return (0, rxjs_1.from)(actions);
19
+ }));
20
+ exports.dragNDropTasksEpic = dragNDropTasksEpic;
@@ -4,5 +4,7 @@ import { fetchTaskListPage, fetchTaskList } from './taskListReducer';
4
4
  import { RootState } from '../../../reducer';
5
5
  import { fetchUserListByType } from '../../userListView/userListViewReducer';
6
6
  import { fetchClassList } from '../../classList/classListReducer';
7
- export declare type ActionType = ReturnType<typeof fetchTaskListPage> | ReturnType<typeof fetchTaskList> | ReturnType<typeof fetchUserListByType> | ReturnType<typeof fetchClassList>;
7
+ import { fetchTagList } from '../../tagView/tagViewReducer';
8
+ import { fetchAllTaskGroups } from '../taskGroupView/taskGroupViewReducer';
9
+ export declare type ActionType = ReturnType<typeof fetchTaskListPage> | ReturnType<typeof fetchTaskList> | ReturnType<typeof fetchUserListByType> | ReturnType<typeof fetchTagList> | ReturnType<typeof fetchAllTaskGroups> | ReturnType<typeof fetchClassList>;
8
10
  export declare const fetchTaskListPageEpic: (actions$: ActionsObservable<ActionType>, state$: StateObservable<RootState>) => Observable<ActionType>;
@@ -6,6 +6,8 @@ const operators_1 = require("rxjs/operators");
6
6
  const taskListReducer_1 = require("./taskListReducer");
7
7
  const userListViewReducer_1 = require("../../userListView/userListViewReducer");
8
8
  const classListReducer_1 = require("../../classList/classListReducer");
9
+ const tagViewReducer_1 = require("../../tagView/tagViewReducer");
10
+ const taskGroupViewReducer_1 = require("../taskGroupView/taskGroupViewReducer");
9
11
  const fetchTaskListPageEpic = (actions$, state$) => actions$.pipe((0, operators_1.filter)(taskListReducer_1.fetchTaskListPage.match), (0, operators_1.mergeMap)((action) => {
10
12
  const { cacheOverride } = action.payload;
11
13
  const taskListPageActions = [];
@@ -14,6 +16,8 @@ const fetchTaskListPageEpic = (actions$, state$) => actions$.pipe((0, operators_
14
16
  taskListPageActions.push((0, taskListReducer_1.fetchTaskList)());
15
17
  taskListPageActions.push((0, classListReducer_1.fetchClassList)());
16
18
  taskListPageActions.push((0, userListViewReducer_1.fetchUserListByType)('taskManagerCandidate', true));
19
+ taskListPageActions.push((0, tagViewReducer_1.fetchTagList)());
20
+ taskListPageActions.push((0, taskGroupViewReducer_1.fetchAllTaskGroups)());
17
21
  }
18
22
  else {
19
23
  taskListPageActions.push((0, taskListReducer_1.fetchTaskList)());
@@ -26,6 +30,14 @@ const fetchTaskListPageEpic = (actions$, state$) => actions$.pipe((0, operators_
26
30
  taskManageUsers.fetchState !== 'In-Progress') {
27
31
  taskListPageActions.push((0, userListViewReducer_1.fetchUserListByType)('taskManagerCandidate', false));
28
32
  }
33
+ if (state.tagViewState.hasValidState() === false &&
34
+ state.tagViewState.fetchState !== 'In-Progress') {
35
+ taskListPageActions.push((0, tagViewReducer_1.fetchTagList)());
36
+ }
37
+ if (state.taskGroupViewState.hasValidState() === false &&
38
+ state.taskGroupViewState.fetchState !== 'In-Progress') {
39
+ taskListPageActions.push((0, taskGroupViewReducer_1.fetchAllTaskGroups)());
40
+ }
29
41
  }
30
42
  return (0, rxjs_1.concat)((0, rxjs_1.from)(taskListPageActions));
31
43
  }));
@@ -1,12 +1,25 @@
1
- import { FetchedState, ID } from '../../../commonStateTypes/common';
1
+ import { FetchedState, FetchStateAndError, ID } from '../../../commonStateTypes/common';
2
2
  import { ZeniDate } from '../../../zeniDayJS';
3
3
  import { SpendManagementUIState } from '../../spendManagement/billPay/billList/billListState';
4
4
  import { CategoryCombinationOperator, FilterCategoryType } from '../../spendManagement/spendManagementFilterHelpers';
5
+ export interface NewTaskGroupLocalData {
6
+ taskIds: ID[];
7
+ groupName: string;
8
+ }
9
+ export interface TaskListLocalData {
10
+ newTaskGroupName: string;
11
+ selectedTaskIds: ID[];
12
+ existingTaskGroupNamesByGroupId: Record<ID, string>;
13
+ defaultTaskGroupId: ID | null;
14
+ }
5
15
  export interface TaskListState extends FetchedState {
6
16
  taskIds: ID[];
17
+ taskIdsByGroupsIds: Record<ID, ID[]>;
7
18
  uiState: TaskListUIState;
8
19
  searchText: string;
9
20
  filters: TaskListFilters;
21
+ localData: TaskListLocalData;
22
+ updateTasksFetchState: FetchStateAndError;
10
23
  }
11
24
  export interface TaskListFilters {
12
25
  categoryCombinationOperator: CategoryCombinationOperator;
@@ -1,7 +1,11 @@
1
- import { FetchState, UpdateType } from '../../../commonStateTypes/common';
1
+ import { FetchState, ID, UpdateType } from '../../../commonStateTypes/common';
2
2
  import { TaskPayload } from '../../../entity/task/taskPayload';
3
3
  import { ZeniAPIStatus } from '../../../responsePayload';
4
- import { TaskListFilters, TaskListState, TaskListUIState } from './taskList';
4
+ import { TaskListFilters, TaskListLocalData, TaskListState, TaskListUIState } from './taskList';
5
+ import { TaskGroup } from '../../../entity/taskGroup/taskGroupState';
6
+ import { Task } from '../../../entity/task/taskState';
7
+ import { TaskGroupPayload } from '../../../entity/taskGroup/taskGroupPayload';
8
+ export declare const initialLocalData: TaskListLocalData;
5
9
  export declare const initialState: TaskListState;
6
10
  export declare const fetchTaskListPage: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[cacheOverride: boolean], {
7
11
  cacheOverride: boolean;
@@ -17,6 +21,31 @@ export declare const fetchTaskListPage: import("@reduxjs/toolkit").ActionCreator
17
21
  uiState: Partial<TaskListUIState>;
18
22
  }, string>, updateTaskFilters: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
19
23
  filters: TaskListFilters;
24
+ }, string>, updateTaskListOnNewGroupCreationSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
25
+ newTaskGroup: TaskGroupPayload;
26
+ }, string>, bulkUpdateTaskList: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[taskIds: string[], updates: Partial<Task>], {
27
+ taskIds: string[];
28
+ updates: Partial<Task>;
29
+ }, string, never, never>, updateTasksListOnBulkUpdateTasksSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
30
+ taskIds: ID[];
31
+ groupId: ID | null;
32
+ }, string>, updateTasksListOnBulkUpdateTasksFailure: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
33
+ error: ZeniAPIStatus;
34
+ }, string>, initiateTaskListLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
35
+ taskGroupById: Record<ID, TaskGroup>;
36
+ }, string>, updateTaskListLocalData: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
37
+ localData: TaskListLocalData;
38
+ }, string>, updateTaskListOnTaskGroupDeletion: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
39
+ taskGroupId: ID;
40
+ }, string>, dragNDropTasks: import("@reduxjs/toolkit").ActionCreatorWithPreparedPayload<[taskIds: string[], groupId: any], {
41
+ taskIds: string[];
42
+ groupId: any;
43
+ }, string, never, never>, updateTaskListOnNewTaskCreationSuccess: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
44
+ taskId: ID;
45
+ taskGroupId: ID;
46
+ }, string>, updateTaskListOnTaskGroupNameUpdate: import("@reduxjs/toolkit").ActionCreatorWithPayload<{
47
+ taskGroupName: ID;
48
+ taskGroupId: ID;
20
49
  }, string>, clearTaskList: import("@reduxjs/toolkit").ActionCreatorWithoutPayload<string>;
21
50
  declare const _default: import("@reduxjs/toolkit").Reducer<TaskListState, import("@reduxjs/toolkit").AnyAction>;
22
51
  export default _default;