@zeniai/client-epic-state 5.0.84-betaJK8 → 5.0.84

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 (30) hide show
  1. package/lib/entity/snackbar/snackbarTypes.d.ts +1 -1
  2. package/lib/entity/snackbar/snackbarTypes.js +0 -1
  3. package/lib/entity/task/taskPayload.d.ts +0 -1
  4. package/lib/entity/task/taskPayload.js +0 -13
  5. package/lib/entity/task/taskReducer.d.ts +1 -5
  6. package/lib/entity/task/taskReducer.js +2 -8
  7. package/lib/entity/task/taskState.d.ts +0 -1
  8. package/lib/epic.d.ts +1 -2
  9. package/lib/epic.js +1 -2
  10. package/lib/esm/entity/snackbar/snackbarTypes.js +0 -1
  11. package/lib/esm/entity/task/taskPayload.js +0 -13
  12. package/lib/esm/entity/task/taskReducer.js +1 -7
  13. package/lib/esm/epic.js +1 -2
  14. package/lib/esm/index.js +2 -2
  15. package/lib/esm/view/taskManager/taskDetailView/epics/fetchTaskDetailEpic.js +0 -14
  16. package/lib/esm/view/taskManager/taskDetailView/taskDetailReducer.js +2 -24
  17. package/lib/esm/view/taskManager/taskDetailView/taskDetailSelector.js +3 -6
  18. package/lib/index.d.ts +3 -3
  19. package/lib/index.js +6 -7
  20. package/lib/view/expenseAutomationView/helpers/transactionCategorizationLocalDataHelper.d.ts +1 -1
  21. package/lib/view/taskManager/taskDetailView/epics/fetchTaskDetailEpic.d.ts +1 -2
  22. package/lib/view/taskManager/taskDetailView/epics/fetchTaskDetailEpic.js +0 -13
  23. package/lib/view/taskManager/taskDetailView/taskDetail.d.ts +0 -12
  24. package/lib/view/taskManager/taskDetailView/taskDetailReducer.d.ts +2 -6
  25. package/lib/view/taskManager/taskDetailView/taskDetailReducer.js +3 -25
  26. package/lib/view/taskManager/taskDetailView/taskDetailSelector.js +3 -6
  27. package/package.json +1 -1
  28. package/lib/esm/view/taskManager/taskDetailView/epics/createSubTaskEpic.js +0 -80
  29. package/lib/view/taskManager/taskDetailView/epics/createSubTaskEpic.d.ts +0 -9
  30. package/lib/view/taskManager/taskDetailView/epics/createSubTaskEpic.js +0 -84
@@ -1,84 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.createSubTaskEpic = void 0;
4
- const rxjs_1 = require("rxjs");
5
- const operators_1 = require("rxjs/operators");
6
- const formatMinutesToFromHHMM_1 = require("../../../../commonStateTypes/fiscalYearHelpers/formatMinutesToFromHHMM");
7
- const snackbarReducer_1 = require("../../../../entity/snackbar/snackbarReducer");
8
- const taskReducer_1 = require("../../../../entity/task/taskReducer");
9
- const taskSelector_1 = require("../../../../entity/task/taskSelector");
10
- const responsePayload_1 = require("../../../../responsePayload");
11
- const taskListReducer_1 = require("../../taskListView/taskListReducer");
12
- const taskDetailReducer_1 = require("../taskDetailReducer");
13
- const createSubTaskEpic = (actions$, state$, zeniAPI) => actions$.pipe((0, operators_1.filter)(taskDetailReducer_1.createSubTask.match), (0, operators_1.mergeMap)((action) => {
14
- const state = state$.value;
15
- const parentTask = (0, taskSelector_1.getTaskById)(state.taskState, action.payload.parentTaskId);
16
- const parentTaskGroupId = parentTask?.taskGroupIds[0];
17
- const isTaskListFetched = state.taskListState.fetchState === 'Completed';
18
- const payload = prepareSubTaskPayload(action.payload, parentTaskGroupId);
19
- return zeniAPI
20
- .postAndGetJSON(`${zeniAPI.apiEndPoints.taskMicroServiceBaseUrl}/1.0/task-manager/tasks`, payload)
21
- .pipe((0, operators_1.mergeMap)((response) => {
22
- if ((0, responsePayload_1.isSuccessResponse)(response) &&
23
- response.data != null &&
24
- response.data.tasks.length > 0) {
25
- const newTaskId = response.data.tasks[0].task_id;
26
- const actions = [
27
- (0, taskReducer_1.updateTasks)(response.data.tasks),
28
- (0, taskReducer_1.appendSubTaskId)({
29
- parentTaskId: action.payload.parentTaskId,
30
- subTaskId: newTaskId,
31
- }),
32
- (0, taskDetailReducer_1.createSubTaskSuccessOrFailure)({
33
- fetchState: 'Completed',
34
- newTaskId,
35
- }),
36
- (0, snackbarReducer_1.openSnackbar)({
37
- messageSection: 'create_sub_task',
38
- messageText: 'success',
39
- type: 'success',
40
- }),
41
- ];
42
- if (isTaskListFetched === true && parentTaskGroupId != null) {
43
- actions.push((0, taskListReducer_1.updateTaskListOnNewTaskCreationSuccess)({
44
- taskGroupId: parentTaskGroupId,
45
- task: response.data.tasks[0],
46
- }));
47
- }
48
- return (0, rxjs_1.from)(actions);
49
- }
50
- else {
51
- return (0, rxjs_1.of)((0, taskDetailReducer_1.createSubTaskSuccessOrFailure)({
52
- fetchState: 'Error',
53
- error: response.status,
54
- }), (0, snackbarReducer_1.openSnackbar)({
55
- messageSection: 'create_sub_task',
56
- messageText: 'failed',
57
- type: 'error',
58
- variables: [
59
- {
60
- variableName: '_api-error_',
61
- variableValue: response.status.message,
62
- },
63
- ],
64
- }));
65
- }
66
- }), (0, operators_1.catchError)((error) => (0, rxjs_1.of)((0, taskDetailReducer_1.createSubTaskSuccessOrFailure)({
67
- fetchState: 'Error',
68
- error: (0, responsePayload_1.createZeniAPIStatus)('Unexpected Error', 'Create Sub Task REST API call errored out' +
69
- JSON.stringify(error)),
70
- }))));
71
- }));
72
- exports.createSubTaskEpic = createSubTaskEpic;
73
- const prepareSubTaskPayload = (subTask, parentTaskGroupId) => ({
74
- name: subTask.name,
75
- assignees: subTask.assignee,
76
- description: subTask.description,
77
- priority: subTask.priority,
78
- status: subTask.status,
79
- tags: subTask.tagIds,
80
- time_spent: (0, formatMinutesToFromHHMM_1.convertHHMMStrToMinutes)(subTask.timeSpent),
81
- group_assignees: subTask.groupAssignees,
82
- parent_task_id: subTask.parentTaskId,
83
- task_group_ids: parentTaskGroupId == null ? [] : [parentTaskGroupId],
84
- });